mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
BlackoilModelEbos: enumerate solver approach for NLDD
adds command line validation and allows us to remove an assert on user provided data
This commit is contained in:
parent
8eb5e173c3
commit
c6cd74270b
@ -541,12 +541,16 @@ namespace Opm {
|
|||||||
for (const int domain_index : domain_order) {
|
for (const int domain_index : domain_order) {
|
||||||
const auto& domain = domains_[domain_index];
|
const auto& domain = domains_[domain_index];
|
||||||
SimulatorReportSingle local_report;
|
SimulatorReportSingle local_report;
|
||||||
if (param_.local_solve_approach_ == "jacobi") {
|
switch (param_.local_solve_approach_) {
|
||||||
|
case DomainSolveApproach::Jacobi:
|
||||||
solveDomainJacobi(solution, locally_solved, local_report,
|
solveDomainJacobi(solution, locally_solved, local_report,
|
||||||
iteration, timer, domain);
|
iteration, timer, domain);
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
|
case DomainSolveApproach::GaussSeidel:
|
||||||
solveDomainGaussSeidel(solution, locally_solved, local_report,
|
solveDomainGaussSeidel(solution, locally_solved, local_report,
|
||||||
iteration, timer, domain);
|
iteration, timer, domain);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// This should have updated the global matrix to be
|
// This should have updated the global matrix to be
|
||||||
// dR_i/du_j evaluated at new local solutions for
|
// dR_i/du_j evaluated at new local solutions for
|
||||||
@ -576,7 +580,7 @@ namespace Opm {
|
|||||||
local_reports_accumulated_ += rep;
|
local_reports_accumulated_ += rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param_.local_solve_approach_ == "jacobi") {
|
if (param_.local_solve_approach_ == DomainSolveApproach::Jacobi) {
|
||||||
solution = locally_solved;
|
solution = locally_solved;
|
||||||
ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
|
ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
|
||||||
}
|
}
|
||||||
@ -1746,7 +1750,8 @@ namespace Opm {
|
|||||||
const auto& solution = ebosSimulator().model().solution(0);
|
const auto& solution = ebosSimulator().model().solution(0);
|
||||||
|
|
||||||
std::vector<int> domain_order(domains_.size());
|
std::vector<int> domain_order(domains_.size());
|
||||||
if (param_.local_solve_approach_ == "gauss-seidel") {
|
switch (param_.local_solve_approach_) {
|
||||||
|
case DomainSolveApproach::GaussSeidel: {
|
||||||
switch (param_.local_domain_ordering_) {
|
switch (param_.local_domain_ordering_) {
|
||||||
case DomainOrderingMeasure::AveragePressure: {
|
case DomainOrderingMeasure::AveragePressure: {
|
||||||
// Use average pressures to order domains.
|
// Use average pressures to order domains.
|
||||||
@ -1790,9 +1795,15 @@ namespace Opm {
|
|||||||
domain_order[ii] = maxres_per_domain[ii].second;
|
domain_order[ii] = maxres_per_domain[ii].second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case DomainSolveApproach::Jacobi:
|
||||||
|
default:
|
||||||
std::iota(domain_order.begin(), domain_order.end(), 0);
|
std::iota(domain_order.begin(), domain_order.end(), 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return domain_order;
|
return domain_order;
|
||||||
@ -1830,7 +1841,6 @@ namespace Opm {
|
|||||||
const SimulatorTimerInterface& timer,
|
const SimulatorTimerInterface& timer,
|
||||||
const Domain& domain)
|
const Domain& domain)
|
||||||
{
|
{
|
||||||
assert(param_.local_solve_approach_ == "gauss-seidel");
|
|
||||||
auto initial_local_well_primary_vars = wellModel().getPrimaryVarsDomain(domain);
|
auto initial_local_well_primary_vars = wellModel().getPrimaryVarsDomain(domain);
|
||||||
auto initial_local_solution = Details::extractVector(solution, domain.cells);
|
auto initial_local_solution = Details::extractVector(solution, domain.cells);
|
||||||
auto res = solveDomain(domain, timer, iteration);
|
auto res = solveDomain(domain, timer, iteration);
|
||||||
|
@ -539,7 +539,7 @@ namespace Opm
|
|||||||
/// Nonlinear solver type: newton or nldd.
|
/// Nonlinear solver type: newton or nldd.
|
||||||
std::string nonlinear_solver_;
|
std::string nonlinear_solver_;
|
||||||
/// 'jacobi' and 'gauss-seidel' supported.
|
/// 'jacobi' and 'gauss-seidel' supported.
|
||||||
std::string local_solve_approach_;
|
DomainSolveApproach local_solve_approach_{DomainSolveApproach::Jacobi};
|
||||||
|
|
||||||
int max_local_solve_iterations_;
|
int max_local_solve_iterations_;
|
||||||
|
|
||||||
@ -587,7 +587,15 @@ namespace Opm
|
|||||||
max_number_of_well_switches_ = EWOMS_GET_PARAM(TypeTag, int, MaximumNumberOfWellSwitches);
|
max_number_of_well_switches_ = EWOMS_GET_PARAM(TypeTag, int, MaximumNumberOfWellSwitches);
|
||||||
use_average_density_ms_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseAverageDensityMsWells);
|
use_average_density_ms_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseAverageDensityMsWells);
|
||||||
nonlinear_solver_ = EWOMS_GET_PARAM(TypeTag, std::string, NonlinearSolver);
|
nonlinear_solver_ = EWOMS_GET_PARAM(TypeTag, std::string, NonlinearSolver);
|
||||||
local_solve_approach_ = EWOMS_GET_PARAM(TypeTag, std::string, LocalSolveApproach);
|
std::string approach = EWOMS_GET_PARAM(TypeTag, std::string, LocalSolveApproach);
|
||||||
|
if (approach == "jacobi") {
|
||||||
|
local_solve_approach_ = DomainSolveApproach::Jacobi;
|
||||||
|
} else if (approach == "gauss-seidel") {
|
||||||
|
local_solve_approach_ = DomainSolveApproach::GaussSeidel;
|
||||||
|
} else {
|
||||||
|
throw std::runtime_error("Invalid domain solver approach '" + approach + "' specified.");
|
||||||
|
}
|
||||||
|
|
||||||
max_local_solve_iterations_ = EWOMS_GET_PARAM(TypeTag, int, MaxLocalSolveIterations);
|
max_local_solve_iterations_ = EWOMS_GET_PARAM(TypeTag, int, MaxLocalSolveIterations);
|
||||||
local_tolerance_scaling_mb_ = EWOMS_GET_PARAM(TypeTag, double, LocalToleranceScalingMb);
|
local_tolerance_scaling_mb_ = EWOMS_GET_PARAM(TypeTag, double, LocalToleranceScalingMb);
|
||||||
local_tolerance_scaling_cnv_ = EWOMS_GET_PARAM(TypeTag, double, LocalToleranceScalingCnv);
|
local_tolerance_scaling_cnv_ = EWOMS_GET_PARAM(TypeTag, double, LocalToleranceScalingCnv);
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
//! \brief Solver approach for NLDD.
|
||||||
|
enum class DomainSolveApproach {
|
||||||
|
Jacobi,
|
||||||
|
GaussSeidel
|
||||||
|
};
|
||||||
|
|
||||||
//! \brief Measure to use for domain ordering.
|
//! \brief Measure to use for domain ordering.
|
||||||
enum class DomainOrderingMeasure {
|
enum class DomainOrderingMeasure {
|
||||||
|
Loading…
Reference in New Issue
Block a user