Allow user to request aggregating the pressure system before solving it.

For this we added a new parameter cpr_pressure_aggregation. If it is true
we will aggregate the pressure already for the first system.
This commit is contained in:
Markus Blatt 2018-02-05 16:55:33 +01:00
parent e24d338ddc
commit 8fc20456c5
2 changed files with 12 additions and 7 deletions

View File

@ -615,15 +615,17 @@ public:
typedef Communication ParallelInformation;
public:
OneComponentAggregationLevelTransferPolicy(const Criterion& crit, const Communication& comm)
: criterion_(crit), communication_(&const_cast<Communication&>(comm)), use_aggregation_(false)
OneComponentAggregationLevelTransferPolicy(const Criterion& crit, const Communication& comm,
bool cpr_pressure_aggregation)
: criterion_(crit), communication_(&const_cast<Communication&>(comm)),
cpr_pressure_aggregation_(cpr_pressure_aggregation)
{}
void createCoarseLevelSystem(const Operator& fineOperator)
{
prolongDamp_ = 1;
if ( use_aggregation_ )
if ( cpr_pressure_aggregation_ )
{
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
typedef Dune::Amg::PropertiesGraphCreator<Operator,Communication> GraphCreator;
@ -755,7 +757,7 @@ public:
// Set coarse vector to zero
this->rhs_=0;
if ( use_aggregation_ )
if ( cpr_pressure_aggregation_ )
{
auto end = fine.end(), begin=fine.begin();
@ -783,7 +785,7 @@ public:
void moveToFineLevel(typename FatherType::FineDomainType& fine)
{
if( use_aggregation_ )
if( cpr_pressure_aggregation_ )
{
this->lhs_ *= prolongDamp_;
auto end=fine.end(), begin=fine.begin();
@ -823,7 +825,7 @@ private:
Communication* communication_;
std::shared_ptr<Communication> coarseLevelCommunication_;
std::shared_ptr<typename CoarseOperator::matrix_type> coarseLevelMatrix_;
bool use_aggregation_;
bool cpr_pressure_aggregation_;
};
template<typename O, typename S, typename C,
@ -882,7 +884,7 @@ public:
COMPONENT_INDEX)),
smoother_(Detail::constructSmoother<Smoother>(std::get<1>(scaledMatrixOperator_),
smargs, comm)),
levelTransferPolicy_(criterion, comm),
levelTransferPolicy_(criterion, comm, param.cpr_pressure_aggregation_),
coarseSolverPolicy_(&param, smargs, criterion),
twoLevelMethod_(std::get<1>(scaledMatrixOperator_), smoother_,
levelTransferPolicy_,

View File

@ -240,6 +240,7 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std:
bool cpr_use_amg_;
bool cpr_use_bicgstab_;
bool cpr_solver_verbose_;
bool cpr_pressure_aggregation_;
CPRParameter() { reset(); }
@ -255,6 +256,7 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std:
cpr_use_amg_ = param.getDefault("cpr_use_amg", cpr_use_amg_);
cpr_use_bicgstab_ = param.getDefault("cpr_use_bicgstab", cpr_use_bicgstab_);
cpr_solver_verbose_ = param.getDefault("cpr_solver_verbose", cpr_solver_verbose_);
cpr_pressure_aggregation_ = param.getDefault("cpr_pressure_aggregation", cpr_pressure_aggregation_);
}
void reset()
@ -266,6 +268,7 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std:
cpr_use_amg_ = true;
cpr_use_bicgstab_ = true;
cpr_solver_verbose_ = false;
cpr_pressure_aggregation_ = false;
}
};