mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-22 15:33:29 -06:00
Update second stage preconditioner for CPR instead of recreate
This commit is contained in:
parent
5b002b2a77
commit
3ec01f7d7b
@ -183,28 +183,24 @@ private:
|
||||
FlexibleSolver<CoarseOperator>,
|
||||
LevelTransferPolicy>;
|
||||
using TwoLevelMethod
|
||||
= Dune::Amg::TwoLevelMethodCpr<OperatorType, CoarseSolverPolicy, Dune::Preconditioner<VectorType, VectorType>>;
|
||||
= Dune::Amg::TwoLevelMethodCpr<OperatorType, CoarseSolverPolicy, Dune::PreconditionerWithUpdate<VectorType, VectorType>>;
|
||||
|
||||
// Handling parallel vs serial instantiation of preconditioner factory.
|
||||
template <class Comm>
|
||||
void updateImpl(const Comm*)
|
||||
{
|
||||
// Parallel case.
|
||||
auto child = prm_.get_child_optional("finesmoother");
|
||||
finesmoother_ = PrecFactory::create(linear_operator_, child ? *child : Opm::PropertyTree(), *comm_);
|
||||
twolevel_method_.updatePreconditioner(finesmoother_, coarseSolverPolicy_);
|
||||
}
|
||||
|
||||
void updateImpl(const Dune::Amg::SequentialInformation*)
|
||||
{
|
||||
// Serial case.
|
||||
auto child = prm_.get_child_optional("finesmoother");
|
||||
finesmoother_ = PrecFactory::create(linear_operator_, child ? *child : Opm::PropertyTree());
|
||||
twolevel_method_.updatePreconditioner(finesmoother_, coarseSolverPolicy_);
|
||||
}
|
||||
|
||||
const OperatorType& linear_operator_;
|
||||
std::shared_ptr<Dune::Preconditioner<VectorType, VectorType>> finesmoother_;
|
||||
std::shared_ptr<PreconditionerWithUpdate<VectorType, VectorType>> finesmoother_;
|
||||
const Communication* comm_;
|
||||
std::function<VectorType()> weightsCalculator_;
|
||||
VectorType weights_;
|
||||
|
@ -472,8 +472,9 @@ public:
|
||||
void updatePreconditioner(std::shared_ptr<SmootherType> smoother,
|
||||
CoarseLevelSolverPolicy& coarsePolicy)
|
||||
{
|
||||
//assume new matrix is not reallocated the new precondition should anyway be made
|
||||
smoother_ = smoother;
|
||||
// We assume the matrix has the same sparsity structure and memory locations throughout, only the values are changed.
|
||||
smoother_->update();
|
||||
if (coarseSolver_) {
|
||||
policy_->calculateCoarseEntries(*operator_);
|
||||
coarsePolicy.setCoarseOperator(*policy_);
|
||||
|
Loading…
Reference in New Issue
Block a user