- add default for CPRW

- cleanded code
This commit is contained in:
hnil 2022-05-09 11:22:59 +02:00 committed by Atgeirr Flø Rasmussen
parent 8a757a4935
commit 541edeaf67
6 changed files with 69 additions and 15 deletions

View File

@ -75,6 +75,14 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
return setupCPR(conf, p);
}
if ((conf == "cprw")) {
if (!LinearSolverMaxIterSet) {
// Use our own default unless it was explicitly overridden by user.
p.linear_solver_maxiter_ = 20;
}
return setupCPRW(conf, p);
}
if (conf == "amg") {
return setupAMG(conf, p);
}
@ -95,6 +103,56 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
<< " Please use ilu0, cpr, cpr_trueimpes, cpr_quasiimpes or isai");
}
PropertyTree
setupCPRW(const std::string& conf, const FlowLinearSolverParameters& p)
{
using namespace std::string_literals;
PropertyTree prm;
prm.put("maxiter", p.linear_solver_maxiter_);
prm.put("tol", p.linear_solver_reduction_);
prm.put("verbosity", p.linear_solver_verbosity_);
prm.put("solver", "bicgstab"s);
prm.put("preconditioner.type", "cprw"s);
if (conf == "cpr_quasiimpes") {
prm.put("preconditioner.weight_type", "quasiimpes"s);
} else {
prm.put("preconditioner.weight_type", "trueimpes"s);
}
prm.put("preconditioner.finesmoother.post_smooth",1);
prm.put("preconditioner.finesmoother.pre_smooth",1);
prm.put("preconditioner.finesmoother.use_well_weight", "false"s);
prm.put("preconditioner.finesmoother.add_wells", "true"s);
prm.put("preconditioner.finesmoother.type", "ParOverILU0"s);
prm.put("preconditioner.finesmoother.relaxation", 1.0);
prm.put("preconditioner.verbosity", 0);
prm.put("preconditioner.coarsesolver.maxiter", 1);
prm.put("preconditioner.coarsesolver.tol", 1e-1);
prm.put("preconditioner.coarsesolver.solver", "loopsolver"s);
prm.put("preconditioner.coarsesolver.verbosity", 0);
prm.put("preconditioner.coarsesolver.preconditioner.type", "amg"s);
prm.put("preconditioner.coarsesolver.preconditioner.alpha", 0.333333333333);
prm.put("preconditioner.coarsesolver.preconditioner.relaxation", 1.0);
prm.put("preconditioner.coarsesolver.preconditioner.iterations", p.cpr_max_ell_iter_);
prm.put("preconditioner.coarsesolver.preconditioner.coarsenTarget", 1200);
prm.put("preconditioner.coarsesolver.preconditioner.pre_smooth", 1);
prm.put("preconditioner.coarsesolver.preconditioner.post_smooth", 1);
prm.put("preconditioner.coarsesolver.preconditioner.beta", 0.0);
prm.put("preconditioner.coarsesolver.preconditioner.smoother", "ILU0"s);
prm.put("preconditioner.coarsesolver.preconditioner.verbosity", 0);
prm.put("preconditioner.coarsesolver.preconditioner.maxlevel", 15);
prm.put("preconditioner.coarsesolver.preconditioner.skip_isolated", 0);
// We request to accumulate data to 1 process always as our matrix
// graph might be unsymmetric and hence not supported by the PTScotch/ParMetis
// calls in DUNE. Accumulating to 1 skips PTScotch/ParMetis
prm.put("preconditioner.coarsesolver.preconditioner.accumulate", 1);
prm.put("preconditioner.coarsesolver.preconditioner.prolongationdamping", 1.0);
prm.put("preconditioner.coarsesolver.preconditioner.maxdistance", 2);
prm.put("preconditioner.coarsesolver.preconditioner.maxconnectivity", 15);
prm.put("preconditioner.coarsesolver.preconditioner.maxaggsize", 6);
prm.put("preconditioner.coarsesolver.preconditioner.minaggsize", 4);
return prm;
}
PropertyTree
setupCPR(const std::string& conf, const FlowLinearSolverParameters& p)
{

View File

@ -32,6 +32,7 @@ PropertyTree setupPropertyTree(FlowLinearSolverParameters p,
bool LinearSolverMaxIterSet,
bool CprMaxEllIterSet);
PropertyTree setupCPRW(const std::string& conf, const FlowLinearSolverParameters& p);
PropertyTree setupCPR(const std::string& conf, const FlowLinearSolverParameters& p);
PropertyTree setupAMG(const std::string& conf, const FlowLinearSolverParameters& p);
PropertyTree setupILU(const std::string& conf, const FlowLinearSolverParameters& p);

View File

@ -302,9 +302,12 @@ namespace Opm {
void initGliftEclWellMap(GLiftEclWells &ecl_well_map);
/// \brief Get list of local nonshut wells
const std::vector<WellInterfacePtr>& localNonshutWells() const;
const std::vector<WellInterfacePtr>& localNonshutWells() const
{
return well_container_;
}
int numLocalNonshutWells() const
int numLocalNonshutWells() const;
protected:
Simulator& ebosSimulator_;

View File

@ -1291,14 +1291,6 @@ namespace Opm {
}
}
template<typename TypeTag>
const std::vector<WellInterfacePtr>&
BlackoilWellModel<TypeTag>::
localNonshutWells() const;
{
return well_container_;
}
template<typename TypeTag>
int
BlackoilWellModel<TypeTag>::

View File

@ -2181,10 +2181,10 @@ namespace Opm
int nperf = 0;
auto cell_weights = weights[0]*0.0;// not need for not(use_well_weights)
assert(this->duneC_.M() == weights.size());
const int welldof_ind = this->duneC_.M() + this->index_of_well_;
// do not assume anything about pressure controlled with use_well_weights (work fine with the assumtion also)
if(not(this->isPressureControlled(well_state)) || use_well_weights){
// make coupling for reservoir to well
const int welldof_ind = this->duneC_.M() + this->index_of_well_;
// make coupling for reservoir to well
for (auto colC = this->duneC_[0].begin(), endC = this->duneC_[0].end(); colC != endC; ++colC) {
const auto row_ind = colC.index();
const auto& bw = weights[row_ind];
@ -2261,11 +2261,11 @@ namespace Opm
matel += (*colB)[i][pressureVarIndex] * bw[i];
}
jacobian[welldof_ind][col_index] = matel;
}
}
}
template<typename TypeTag>
typename StandardWell<TypeTag>::EvalWell

View File

@ -535,7 +535,7 @@ namespace Opm
}
template<typename TypeTag>
void
bool
WellInterface<TypeTag>::isPressureControlled(const WellState& well_state) const
{
bool thp_controlled_well = false;