Skip to content

Commit e49f6fa

Browse files
committed
fixup
1 parent 83f3ecc commit e49f6fa

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

source/simulator/solver.cc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,13 @@ namespace aspect
386386
virtual unsigned int n_iterations() const=0;
387387

388388
};
389+
390+
391+
/**
392+
* Given a diagonal matrix stored as a vector,
393+
* create an operator that represents its action.
394+
*/
395+
389396
template<typename Range,
390397
typename Domain,
391398
typename Payload>
@@ -402,10 +409,11 @@ namespace aspect
402409
dest = src;
403410
dest.scale(diagonal);
404411
};
405-
// std::cout << "ok" << std::endl;
406412
return return_op;
407413
}
408414

415+
416+
409417
/**
410418
* This class approximates the Schur Complement inverse operator
411419
* by S^{-1} = (BC^{-1}B^T)^{-1}(BC^{-1}AD^{-1}B^T)(BD^{-1}B^T)^{-1},
@@ -483,11 +491,11 @@ namespace aspect
483491
SolverControl solver_control(5000, 1e-6 * src.l2_norm(), false, true);
484492
SolverCG<TrilinosWrappers::MPI::Vector> solver(solver_control);
485493
//Solve with Schur Complement approximation
486-
auto Op_A=LinearOperator<TrilinosWrappers::MPI::Vector>(system_matrix.block(0,0));
487-
auto Op_BT = LinearOperator<TrilinosWrappers::MPI::Vector>(system_matrix.block(0,1));
488-
auto Op_B = LinearOperator<TrilinosWrappers::MPI::Vector>(system_matrix.block(1,0));
489-
auto Op_C = diag_operator(Op_A,inverse_lumped_mass_matrix);
490-
auto matrix = Op_B*Op_C*Op_BT;
494+
const auto Op_A = LinearOperator<TrilinosWrappers::MPI::Vector>(system_matrix.block(0,0));
495+
const auto Op_BT = LinearOperator<TrilinosWrappers::MPI::Vector>(system_matrix.block(0,1));
496+
const auto Op_B = LinearOperator<TrilinosWrappers::MPI::Vector>(system_matrix.block(1,0));
497+
const auto Op_C_inv = diag_operator(Op_A,inverse_lumped_mass_matrix);
498+
const auto BC_invBT = Op_B*Op_C_inv*Op_BT;
491499

492500

493501

@@ -504,7 +512,7 @@ namespace aspect
504512
system_matrix.block(1,0).vmult(ptmp,wtmp);
505513

506514
dst=0;
507-
solver.solve(matrix,
515+
solver.solve(BC_invBT,
508516
dst,
509517
ptmp,
510518
mp_preconditioner);

0 commit comments

Comments
 (0)