114 Teko_DEBUG_SCOPE(
"InvModALStrategy::buildState", 10);
117 TEUCHOS_ASSERT(modALState != NULL);
121 Teko_DEBUG_EXPR(Teuchos::Time timer(
""));
125 Teko_DEBUG_SCOPE(
"ModAL::buildState: Initializing state object", 1);
126 Teko_DEBUG_EXPR(timer.start(
true));
130 Teko_DEBUG_EXPR(timer.stop());
131 Teko_DEBUG_MSG(
"ModAL::buildState: BuildOpsTime = " << timer.totalElapsedTime(), 1);
136 Teko_DEBUG_SCOPE(
"ModAL::buildState: Computing inverses", 1);
137 Teko_DEBUG_EXPR(timer.start(
true));
141 Teko_DEBUG_EXPR(timer.stop());
142 Teko_DEBUG_MSG(
"ModAL::buildState: BuildInvTime = " << timer.totalElapsedTime(), 1);
150 Teko_DEBUG_SCOPE(
"InvModALStrategy::initializeState", 10);
154 TEUCHOS_ASSERT(dim == 2 || dim == 3);
156 LinearOp lpA11 =
getBlock(0, 0, alOp);
157 LinearOp lpA22 =
getBlock(1, 1, alOp);
158 LinearOp lpA33, lpB1, lpB2, lpB3, lpB1t, lpB2t, lpB3t, lpC;
182 LinearOp B1t = (rcp_dynamic_cast<const Thyra::DefaultAddedLinearOp<double> >(lpB1t))->getOp(0);
183 LinearOp B2t = (rcp_dynamic_cast<const Thyra::DefaultAddedLinearOp<double> >(lpB2t))->getOp(0);
186 B3t = (rcp_dynamic_cast<const Thyra::DefaultAddedLinearOp<double> >(lpB3t))->getOp(0);
191 state->isStabilized_ = (not isZeroOp(lpC));
195 state->pressureMassMatrix_ = pressureMassMatrix_;
197 if (state->pressureMassMatrix_ == Teuchos::null) {
198 Teko_DEBUG_MSG(
"InvModALStrategy::initializeState(): Build identity type \""
199 << getDiagonalName(scaleType_) <<
"\"",
201 state->invPressureMassMatrix_ = Thyra::identity<double>(lpB1->range());
205 else if (state->invPressureMassMatrix_ == Teuchos::null) {
206 Teko_DEBUG_MSG(
"ModAL::initializeState(): Build Scaling <mass> type \""
207 << getDiagonalName(scaleType_) <<
"\"",
209 state->invPressureMassMatrix_ = getInvDiagonalOp(pressureMassMatrix_, scaleType_);
212 state->gamma_ = gamma_;
214 std::cout << Teuchos::describe(*(state->invPressureMassMatrix_), Teuchos::VERB_EXTREME)
219 if (state->B1tMpB1_ == Teuchos::null)
220 state->B1tMpB1_ = explicitMultiply(B1t, state->invPressureMassMatrix_, lpB1, state->B1tMpB1_);
224 LinearOp A11 = (rcp_dynamic_cast<const Thyra::DefaultAddedLinearOp<double> >(lpA11))->getOp(0);
225 state->A11p_ = explicitAdd(A11,
scale(state->gamma_, state->B1tMpB1_), state->A11p_);
227 Teko_DEBUG_MSG(
"Computed A11p", 10);
229 if (state->B2tMpB2_ == Teuchos::null)
230 state->B2tMpB2_ = explicitMultiply(B2t, state->invPressureMassMatrix_, lpB2, state->B2tMpB2_);
231 LinearOp A22 = (rcp_dynamic_cast<const Thyra::DefaultAddedLinearOp<double> >(lpA22))->getOp(0);
232 state->A22p_ = explicitAdd(A22,
scale(state->gamma_, state->B2tMpB2_), state->A22p_);
233 Teko_DEBUG_MSG(
"Computed A22p", 10);
236 if (state->B3tMpB3_ == Teuchos::null)
237 state->B3tMpB3_ = explicitMultiply(B3t, state->invPressureMassMatrix_, lpB3, state->B3tMpB3_);
238 LinearOp A33 = (rcp_dynamic_cast<const Thyra::DefaultAddedLinearOp<double> >(lpA33))->getOp(0);
239 state->A33p_ = explicitAdd(A33,
scale(state->gamma_, state->B3tMpB3_), state->A33p_);
240 Teko_DEBUG_MSG(
"Computed A33p", 10);
244 if (state->isStabilized_) {
245 if (state->S_ == Teuchos::null) {
247 explicitAdd(
scale(-1.0, lpC),
scale(1.0 / state->gamma_, pressureMassMatrix_), state->S_);
249 Teko_DEBUG_MSG(
"Computed S", 10);
252 state->setInitialized(
true);
259 TEUCHOS_ASSERT(dim == 2 || dim == 3);
261 Teko_DEBUG_SCOPE(
"InvModALStrategy::computeInverses", 10);
262 Teko_DEBUG_EXPR(Teuchos::Time invTimer(
""));
265 Teko_DEBUG_MSG(
"ModAL::computeInverses(): Building inv(A11)", 1);
266 Teko_DEBUG_EXPR(invTimer.start(
true));
268 InverseLinearOp invA11p = state->getInverse(
"invA11p");
269 if (invA11p == Teuchos::null) {
271 state->addInverse(
"invA11p", invA11p);
276 Teko_DEBUG_EXPR(invTimer.stop());
277 Teko_DEBUG_MSG(
"ModAL::computeInverses GetInvA11 = " << invTimer.totalElapsedTime(), 1);
280 Teko_DEBUG_MSG(
"ModAL::computeInverses(): Building inv(A22)", 2);
281 Teko_DEBUG_EXPR(invTimer.start(
true));
283 InverseLinearOp invA22p = state->getInverse(
"invA22p");
284 if (invA22p == Teuchos::null) {
286 state->addInverse(
"invA22p", invA22p);
291 Teko_DEBUG_EXPR(invTimer.stop());
292 Teko_DEBUG_MSG(
"ModAL::computeInverses(): GetInvA22 = " << invTimer.totalElapsedTime(), 2);
296 Teko_DEBUG_MSG(
"ModAL::computeInverses Building inv(A33)", 3);
297 Teko_DEBUG_EXPR(invTimer.start(
true));
299 InverseLinearOp invA33p = state->getInverse(
"invA33p");
300 if (invA33p == Teuchos::null) {
302 state->addInverse(
"invA33p", invA33p);
307 Teko_DEBUG_EXPR(invTimer.stop());
308 Teko_DEBUG_MSG(
"ModAL::computeInverses GetInvA33 = " << invTimer.totalElapsedTime(), 3);
312 Teko_DEBUG_MSG(
"ModAL::computeInverses Building inv(S)", 4);
313 Teko_DEBUG_EXPR(invTimer.start(
true));
319 if (state->isStabilized_) {
320 InverseLinearOp invS = state->getInverse(
"invS");
321 if (invS == Teuchos::null) {
323 state->addInverse(
"invS", invS);
329 Teko_DEBUG_EXPR(invTimer.stop());
330 Teko_DEBUG_MSG(
"ModAL::computeInverses GetInvS = " << invTimer.totalElapsedTime(), 4);