Merge pull request #5883 from akva2/flowproblem_param_generic

FlowProblem: move some more code to FlowGenericProblem
This commit is contained in:
Bård Skaflestad 2025-01-15 10:44:48 +01:00 committed by GitHub
commit 3cb1f16e05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 38 additions and 36 deletions

View File

@ -806,10 +806,10 @@ public:
protected:
Scalar nextTimeStepSize_;
private:
bool enableVtkOutput_() const
{ return Parameters::Get<Parameters::EnableVtkOutput>(); }
private:
//! Returns the implementation of the problem (i.e. static polymorphism)
Implementation& asImp_()
{ return *static_cast<Implementation *>(this); }

View File

@ -28,7 +28,6 @@
#ifndef OPM_FLOW_GENERIC_PROBLEM_HPP
#define OPM_FLOW_GENERIC_PROBLEM_HPP
#include <opm/material/common/UniformXTabulated2DFunction.hpp>
#include <opm/material/common/Tabulated1DFunction.hpp>
@ -37,7 +36,6 @@
#include <array>
#include <cstddef>
#include <functional>
#include <set>
#include <string>
#include <vector>
@ -355,6 +353,9 @@ protected:
// equilibration parameters
int numPressurePointsEquil_;
bool enableDriftCompensation_;
bool explicitRockCompaction_;
// To lookup origin cell indices
using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
using LookUpData = Opm::LookUpData<Grid,GridView>;

View File

@ -23,6 +23,11 @@
#ifndef OPM_FLOW_GENERIC_PROBLEM_IMPL_HPP
#define OPM_FLOW_GENERIC_PROBLEM_IMPL_HPP
#ifndef OPM_FLOW_GENERIC_PROBLEM_HPP
#include <config.h>
#include <opm/simulators/flow/FlowGenericProblem.hpp>
#endif
#include <dune/common/parametertree.hh>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
@ -31,9 +36,15 @@
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <opm/simulators/flow/FlowGenericProblem.hpp>
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/utils/basicparameters.hh>
#include <opm/models/utils/parametersystem.hpp>
#include <opm/simulators/flow/FlowProblemParameters.hpp>
#include <opm/simulators/flow/SolutionContainers.hpp>
#include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
#include <boost/date_time.hpp>
#include <fmt/format.h>
@ -54,6 +65,24 @@ FlowGenericProblem(const EclipseState& eclState,
, gridView_(gridView)
, lookUpData_(gridView)
{
enableTuning_ = Parameters::Get<Parameters::EnableTuning>();
enableDriftCompensation_ = Parameters::Get<Parameters::EnableDriftCompensation>();
initialTimeStepSize_ = Parameters::Get<Parameters::InitialTimeStepSize<Scalar>>();
maxTimeStepAfterWellEvent_ = unit::convert::from
(Parameters::Get<Parameters::TimeStepAfterEventInDays<Scalar>>(), unit::day);
// The value N for this parameter is defined in the following order of precedence:
//
// 1. Command line value (--num-pressure-points-equil=N)
//
// 2. EQLDIMS item 2. Default value from
// opm-common/opm/input/eclipse/share/keywords/000_Eclipse100/E/EQLDIMS
numPressurePointsEquil_ = Parameters::IsSet<Parameters::NumPressurePointsEquil>()
? Parameters::Get<Parameters::NumPressurePointsEquil>()
: eclState.getTableManager().getEqldims().getNumDepthNodesP();
explicitRockCompaction_ = Parameters::Get<Parameters::ExplicitRockCompaction>();
}
template<class GridView, class FluidSystem>

View File

@ -184,7 +184,6 @@ public:
registerFlowProblemParameters<Scalar>();
}
/*!
* \copydoc FvBaseProblem::handlePositionalParameter
*/
@ -225,27 +224,6 @@ public:
, pffDofData_(simulator.gridView(), this->elementMapper())
, tracerModel_(simulator)
{
this->enableDriftCompensation_ = Parameters::Get<Parameters::EnableDriftCompensation>();
this->enableVtkOutput_ = Parameters::Get<Parameters::EnableVtkOutput>();
this->enableTuning_ = Parameters::Get<Parameters::EnableTuning>();
this->initialTimeStepSize_ = Parameters::Get<Parameters::InitialTimeStepSize<Scalar>>();
this->maxTimeStepAfterWellEvent_ = unit::convert::from
(Parameters::Get<Parameters::TimeStepAfterEventInDays<Scalar>>(), unit::day);
// The value N for this parameter is defined in the following order of precedence:
//
// 1. Command line value (--num-pressure-points-equil=N)
//
// 2. EQLDIMS item 2. Default value from
// opm-common/opm/input/eclipse/share/keywords/000_Eclipse100/E/EQLDIMS
this->numPressurePointsEquil_ = Parameters::IsSet<Parameters::NumPressurePointsEquil>()
? Parameters::Get<Parameters::NumPressurePointsEquil>()
: simulator.vanguard().eclState().getTableManager().getEqldims().getNumDepthNodesP();
this->explicitRockCompaction_ = Parameters::Get<Parameters::ExplicitRockCompaction>();
if (! Parameters::Get<Parameters::CheckSatfuncConsistency>()) {
// User did not enable the "new" saturation function consistency
// check module. Run the original checker instead. This is a
@ -1682,15 +1660,11 @@ protected:
std::shared_ptr<EclMaterialLawManager> materialLawManager_;
std::shared_ptr<EclThermalLawManager> thermalLawManager_;
bool enableDriftCompensation_;
GlobalEqVector drift_;
WellModel wellModel_;
AquiferModel aquiferModel_;
bool enableVtkOutput_;
PffGridVector<GridView, Stencil, PffDofData_, DofMapper> pffDofData_;
TracerModel tracerModel_;
@ -1729,7 +1703,6 @@ protected:
BCData<int> bcindex_;
bool nonTrivialBoundaryConditions_ = false;
bool explicitRockCompaction_ = false;
bool first_step_ = true;
};

View File

@ -390,7 +390,7 @@ public:
this->drift_ = 0.0;
}
if (this->enableVtkOutput_ && eclState.getIOConfig().initOnly()) {
if (this->enableVtkOutput_() && eclState.getIOConfig().initOnly()) {
simulator.setTimeStepSize(0.0);
FlowProblemType::writeOutput(true);
}

View File

@ -228,7 +228,7 @@ public:
} */
// TODO: check wether the following can work with compostional
if (enableVtkOutput_ && eclState.getIOConfig().initOnly()) {
if (this->enableVtkOutput_() && eclState.getIOConfig().initOnly()) {
simulator.setTimeStepSize(0.0);
FlowProblemType::writeOutput(true);
}
@ -597,8 +597,6 @@ private:
bool enableEclOutput_{false};
std::unique_ptr<EclWriterType> eclWriter_;
bool enableVtkOutput_{false};
};
} // namespace Opm

View File

@ -14,7 +14,6 @@
#include <opm/models/utils/propertysystem.hh>
#include <opm/simulators/timestepping/AdaptiveSimulatorTimer.hpp>
#include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/timestepping/SimulatorTimer.hpp>
#include <opm/simulators/timestepping/TimeStepControl.hpp>

View File

@ -19,6 +19,8 @@
#include <opm/models/utils/parametersystem.hpp>
#include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
#include <algorithm>
#include <cassert>
#include <cmath>