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

View File

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