Merge pull request #4718 from vkip/num_pressure_points_equil

Adding --num-pressure-points-equil as a developer parameter
This commit is contained in:
Bård Skaflestad 2023-06-30 12:45:39 +02:00 committed by GitHub
commit b39f2f20ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 4 deletions

View File

@ -118,7 +118,8 @@ public:
vanguard.grid(),
vanguard.gridView(),
vanguard.cartesianMapper(),
simulator.problem().gravity()[dimWorld - 1]);
simulator.problem().gravity()[dimWorld - 1],
simulator.problem().numPressurePointsEquil());
// copy the result into the array of initial fluid states
initialFluidStates_.resize(numElems);

View File

@ -272,6 +272,9 @@ public:
{ return maxFails_; }
bool vapparsActive(int episodeIdx) const;
int numPressurePointsEquil() const
{ return numPressurePointsEquil_; }
bool operator==(const EclGenericProblem& rhs) const;
@ -404,6 +407,9 @@ protected:
Scalar restartShrinkFactor_;
unsigned maxFails_;
Scalar minTimeStepSize_;
// equilibration parameters
int numPressurePointsEquil_;
private:
template<class T>

View File

@ -91,6 +91,8 @@
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/Parser/ParserKeywords/E.hpp>
#include <set>
#include <vector>
#include <string>
@ -198,6 +200,12 @@ template<class TypeTag, class MyTypeTag>
struct OutputMode {
using type = UndefinedProperty;
};
// Parameterize equilibration accuracy
template<class TypeTag, class MyTypeTag>
struct NumPressurePointsEquil {
using type = UndefinedProperty;
};
// Set the problem property
template<class TypeTag>
@ -583,6 +591,12 @@ template<class TypeTag>
struct OutputMode<TypeTag, TTag::EclBaseProblem> {
static constexpr auto value = "all";
};
// Parameterize equilibration accuracy
template<class TypeTag>
struct NumPressurePointsEquil<TypeTag, TTag::EclBaseProblem> {
static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue;
};
} // namespace Opm::Properties
@ -727,6 +741,9 @@ public:
"Honor some aspects of the TUNING keyword from the ECL deck.");
EWOMS_REGISTER_PARAM(TypeTag, std::string, OutputMode,
"Specify which messages are going to be printed. Valid values are: none, log, all (default)");
EWOMS_REGISTER_PARAM(TypeTag, int, NumPressurePointsEquil,
"Number of pressure points (in each direction) in tables used for equilibration");
EWOMS_HIDE_PARAM(TypeTag, NumPressurePointsEquil); // Users will typically not need to modify this parameter..
}
@ -806,6 +823,17 @@ public:
this->maxTimeStepAfterWellEvent_ = EWOMS_GET_PARAM(TypeTag, Scalar, EclMaxTimeStepSizeAfterWellEvent);
this->restartShrinkFactor_ = EWOMS_GET_PARAM(TypeTag, Scalar, EclRestartShrinkFactor);
this->maxFails_ = EWOMS_GET_PARAM(TypeTag, unsigned, MaxTimeStepDivisions);
// The value N for this parameter is defined in the following order of presedence:
// 1. Command line value (--num-pressure-points-equil=N)
// 2. EQLDIMS item 2
// Default value is defined in opm-common/src/opm/input/eclipse/share/keywords/000_Eclipse100/E/EQLDIMS
if (EWOMS_PARAM_IS_SET(TypeTag, int, NumPressurePointsEquil))
{
this->numPressurePointsEquil_ = EWOMS_GET_PARAM(TypeTag, int, NumPressurePointsEquil);
} else {
this->numPressurePointsEquil_ = simulator.vanguard().eclState().getTableManager().getEqldims().getNumDepthNodesP();
}
RelpermDiagnostics relpermDiagnostics;
relpermDiagnostics.diagnosis(vanguard.eclState(), vanguard.cartesianIndexMapper());

View File

@ -57,6 +57,7 @@ template InitialStateComputer<BlackOilFluidSystem<double>,
const GridView&,
const Dune::CartesianIndexMapper<Dune::CpGrid>&,
const double,
const int,
const bool);
#if HAVE_DUNE_ALUGRID
#if HAVE_MPI
@ -84,6 +85,7 @@ template InitialStateComputer<BlackOilFluidSystem<double>,
const ALUGridView&,
const Dune::CartesianIndexMapper<ALUGrid3CN>&,
const double,
const int,
const bool);
#endif //HAVE_DUNE_ALUGRID

View File

@ -686,6 +686,7 @@ public:
const GridView& gridView,
const CartesianIndexMapper& cartMapper,
const double grav,
const int num_pressure_points = 2000,
const bool applySwatInit = true);
using Vec = std::vector<double>;
@ -763,6 +764,7 @@ private:
Vec cellCenterDepth_;
std::vector<std::pair<double,double>> cellZSpan_;
std::vector<std::pair<double,double>> cellZMinMax_;
int num_pressure_points_;
};
} // namespace DeckDependent

View File

@ -1309,6 +1309,7 @@ InitialStateComputer(MaterialLawManager& materialLawManager,
const GridView& gridView,
const CartesianIndexMapper& cartMapper,
const double grav,
const int num_pressure_points,
const bool applySwatInit)
: temperature_(grid.size(/*codim=*/0)),
saltConcentration_(grid.size(/*codim=*/0)),
@ -1320,7 +1321,8 @@ InitialStateComputer(MaterialLawManager& materialLawManager,
rs_(grid.size(/*codim=*/0)),
rv_(grid.size(/*codim=*/0)),
rvw_(grid.size(/*codim=*/0)),
cartesianIndexMapper_(cartMapper)
cartesianIndexMapper_(cartMapper),
num_pressure_points_(num_pressure_points)
{
//Check for presence of kw SWATINIT
if (applySwatInit) {
@ -1760,8 +1762,8 @@ calcPressSatRsRv(const RMap& reg,
using PhaseSat = Details::PhaseSaturations<
MaterialLawManager, FluidSystem, EquilReg, typename RMap::CellId
>;
auto ptable = Details::PressureTable<FluidSystem, EquilReg>{ grav };
auto ptable = Details::PressureTable<FluidSystem, EquilReg>{ grav, this->num_pressure_points_ };
auto psat = PhaseSat { materialLawManager, this->swatInit_ };
auto vspan = std::array<double, 2>{};