Merge pull request #5455 from akva2/fvbasediscretization_param_split

Adjust to to changes in fvbaseproperties.hh (moving of parameters to Opm::Parmeters namespace)
This commit is contained in:
Bård Skaflestad 2024-07-01 13:22:26 +02:00 committed by GitHub
commit 9f8075e8a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 98 additions and 80 deletions

View File

@ -176,21 +176,6 @@ struct NewtonMaxIterations<TypeTag, TTag::FlowExpTypeTag> {
static constexpr int value = 8; static constexpr int value = 8;
}; };
// if openMP is available, set the default the number of threads per process for the main
// simulation to 2 (instead of grabbing everything that is available).
#if _OPENMP
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::FlowExpTypeTag> {
static constexpr int value = 2;
};
#endif
// By default, flowexp accepts the result of the time integration unconditionally if the
// smallest time step size is reached.
template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, TTag::FlowExpTypeTag> {
static constexpr bool value = true;
};
template<class TypeTag> template<class TypeTag>
struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> { struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
using type = ISTLSolver<TypeTag>; using type = ISTLSolver<TypeTag>;
@ -198,6 +183,24 @@ struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
} // namespace Opm::Properties } // namespace Opm::Properties
namespace Opm::Parameters {
// if openMP is available, set the default the number of threads per process for the main
// simulation to 2 (instead of grabbing everything that is available).
#if _OPENMP
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr int value = 2; };
#endif
// By default, flowexp accepts the result of the time integration unconditionally if the
// smallest time step size is reached.
template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm { namespace Opm {
template <class TypeTag> template <class TypeTag>
class FlowExpProblem : public FlowProblem<TypeTag> //, public FvBaseProblem<TypeTag> class FlowExpProblem : public FlowProblem<TypeTag> //, public FvBaseProblem<TypeTag>

View File

@ -54,18 +54,6 @@ struct Problem<TypeTag, TTag::FlowExpProblemBlackOil>
using type = FlowExpProblem<TypeTag>; using type = FlowExpProblem<TypeTag>;
}; };
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::FlowExpProblemBlackOil>
{
static constexpr int value = 1;
};
template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, TTag::FlowExpProblemBlackOil>
{
static constexpr bool value = false;
};
template<class TypeTag> template<class TypeTag>
struct EclNewtonSumTolerance<TypeTag, TTag::FlowExpProblemBlackOil> struct EclNewtonSumTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
{ {
@ -117,6 +105,18 @@ struct Simulator<TypeTag, TTag::FlowExpProblemBlackOil>
} }
namespace Opm::Parameters {
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{ static constexpr int value = 1; };
template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using TypeTag = Opm::Properties::TTag::FlowExpProblemBlackOil; using TypeTag = Opm::Properties::TTag::FlowExpProblemBlackOil;

View File

@ -22,6 +22,8 @@
#ifndef OPM_AQUIFERANALYTICAL_HEADER_INCLUDED #ifndef OPM_AQUIFERANALYTICAL_HEADER_INCLUDED
#define OPM_AQUIFERANALYTICAL_HEADER_INCLUDED #define OPM_AQUIFERANALYTICAL_HEADER_INCLUDED
#include <dune/grid/common/partitionset.hh>
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <opm/input/eclipse/EclipseState/Aquifer/Aquancon.hpp> #include <opm/input/eclipse/EclipseState/Aquifer/Aquancon.hpp>

View File

@ -21,6 +21,8 @@
#ifndef OPM_AQUIFERNUMERICAL_HEADER_INCLUDED #ifndef OPM_AQUIFERNUMERICAL_HEADER_INCLUDED
#define OPM_AQUIFERNUMERICAL_HEADER_INCLUDED #define OPM_AQUIFERNUMERICAL_HEADER_INCLUDED
#include <dune/grid/common/partitionset.hh>
#include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/SingleNumericalAquifer.hpp> #include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/SingleNumericalAquifer.hpp>
#include <opm/material/common/MathToolbox.hpp> #include <opm/material/common/MathToolbox.hpp>

View File

@ -80,10 +80,6 @@ struct FlowProblem {
}; };
} }
template<class TypeTag> template<class TypeTag>
struct OutputDir<TypeTag, TTag::FlowProblem> {
static constexpr auto value = "";
};
template<class TypeTag>
struct EnableDebuggingChecks<TypeTag, TTag::FlowProblem> { struct EnableDebuggingChecks<TypeTag, TTag::FlowProblem> {
static constexpr bool value = false; static constexpr bool value = false;
}; };
@ -152,6 +148,14 @@ struct LinearSolverSplice<TypeTag, TTag::FlowProblem> {
} // namespace Opm::Properties } // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct OutputDir<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto value = ""; };
}
namespace Opm { namespace Opm {
/// A model implementation for three-phase black oil. /// A model implementation for three-phase black oil.

View File

@ -20,6 +20,7 @@
#ifndef OPM_BLACKOILMODELPARAMETERS_HEADER_INCLUDED #ifndef OPM_BLACKOILMODELPARAMETERS_HEADER_INCLUDED
#define OPM_BLACKOILMODELPARAMETERS_HEADER_INCLUDED #define OPM_BLACKOILMODELPARAMETERS_HEADER_INCLUDED
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/discretization/common/fvbaseproperties.hh> #include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/utils/basicproperties.hh> #include <opm/models/utils/basicproperties.hh>
@ -467,15 +468,21 @@ template<class TypeTag>
struct LocalDomainsOrderingMeasure<TypeTag, TTag::FlowModelParameters> { struct LocalDomainsOrderingMeasure<TypeTag, TTag::FlowModelParameters> {
static constexpr auto value = "maxpressure"; static constexpr auto value = "maxpressure";
}; };
} // namespace Opm::Properties
namespace Opm::Parameters {
// if openMP is available, determine the number threads per process automatically. // if openMP is available, determine the number threads per process automatically.
#if _OPENMP #if _OPENMP
template<class TypeTag> template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::FlowModelParameters> { struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowModelParameters>
{
static constexpr int value = -1; static constexpr int value = -1;
}; };
#endif #endif
} // namespace Opm::Properties } // namespace Opm::Parameters
namespace Opm namespace Opm
{ {

View File

@ -530,7 +530,7 @@ protected:
{ {
asImp_().createGrids_(); asImp_().createGrids_();
asImp_().filterConnections_(); asImp_().filterConnections_();
std::string outputDir = Parameters::get<TypeTag, Properties::OutputDir>(); std::string outputDir = Parameters::get<TypeTag, Parameters::OutputDir>();
bool enableEclCompatFile = !Parameters::get<TypeTag, Properties::EnableOpmRstFile>(); bool enableEclCompatFile = !Parameters::get<TypeTag, Properties::EnableOpmRstFile>();
asImp_().updateOutputDir_(outputDir, enableEclCompatFile); asImp_().updateOutputDir_(outputDir, enableEclCompatFile);
asImp_().finalizeInit_(); asImp_().finalizeInit_();

View File

@ -129,25 +129,25 @@ namespace Opm {
// hide the parameters unused by flow. TODO: this is a pain to maintain // hide the parameters unused by flow. TODO: this is a pain to maintain
Parameters::hideParam<TypeTag, Properties::EnableGravity>(); Parameters::hideParam<TypeTag, Properties::EnableGravity>();
Parameters::hideParam<TypeTag, Properties::EnableGridAdaptation>(); Parameters::hideParam<TypeTag, Parameters::EnableGridAdaptation>();
// this parameter is actually used in eWoms, but the flow well model // this parameter is actually used in eWoms, but the flow well model
// hard-codes the assumption that the intensive quantities cache is enabled, // hard-codes the assumption that the intensive quantities cache is enabled,
// so flow crashes. Let's hide the parameter for that reason. // so flow crashes. Let's hide the parameter for that reason.
Parameters::hideParam<TypeTag, Properties::EnableIntensiveQuantityCache>(); Parameters::hideParam<TypeTag, Parameters::EnableIntensiveQuantityCache>();
// thermodynamic hints are not implemented/required by the eWoms blackoil // thermodynamic hints are not implemented/required by the eWoms blackoil
// model // model
Parameters::hideParam<TypeTag, Properties::EnableThermodynamicHints>(); Parameters::hideParam<TypeTag, Parameters::EnableThermodynamicHints>();
// in flow only the deck file determines the end time of the simulation // in flow only the deck file determines the end time of the simulation
Parameters::hideParam<TypeTag, Properties::EndTime>(); Parameters::hideParam<TypeTag, Properties::EndTime>();
// time stepping is not done by the eWoms code in flow // time stepping is not done by the eWoms code in flow
Parameters::hideParam<TypeTag, Properties::InitialTimeStepSize>(); Parameters::hideParam<TypeTag, Properties::InitialTimeStepSize>();
Parameters::hideParam<TypeTag, Properties::MaxTimeStepDivisions>(); Parameters::hideParam<TypeTag, Parameters::MaxTimeStepDivisions>();
Parameters::hideParam<TypeTag, Properties::MaxTimeStepSize>(); Parameters::hideParam<TypeTag, Parameters::MaxTimeStepSize>();
Parameters::hideParam<TypeTag, Properties::MinTimeStepSize>(); Parameters::hideParam<TypeTag, Parameters::MinTimeStepSize>();
Parameters::hideParam<TypeTag, Properties::PredeterminedTimeStepsFile>(); Parameters::hideParam<TypeTag, Properties::PredeterminedTimeStepsFile>();
// flow also does not use the eWoms Newton method // flow also does not use the eWoms Newton method
@ -388,7 +388,7 @@ namespace Opm {
if (!getenv("OMP_NUM_THREADS")) if (!getenv("OMP_NUM_THREADS"))
{ {
int threads = 2; int threads = 2;
const int requested_threads = Parameters::get<TypeTag, Properties::ThreadsPerProcess>(); const int requested_threads = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();
if (requested_threads > 0) if (requested_threads > 0)
threads = requested_threads; threads = requested_threads;

View File

@ -297,12 +297,6 @@ struct NewtonTolerance<TypeTag, TTag::FlowBaseProblem> {
static constexpr type value = 1e-2; static constexpr type value = 1e-2;
}; };
// Disable the VTK output by default for this problem ...
template<class TypeTag>
struct EnableVtkOutput<TypeTag, TTag::FlowBaseProblem> {
static constexpr bool value = false;
};
// ... but enable the ECL output by default // ... but enable the ECL output by default
template<class TypeTag> template<class TypeTag>
struct EnableEclOutput<TypeTag,TTag::FlowBaseProblem> { struct EnableEclOutput<TypeTag,TTag::FlowBaseProblem> {
@ -404,25 +398,6 @@ struct EclOutputDoublePrecision<TypeTag, TTag::FlowBaseProblem> {
static constexpr bool value = false; static constexpr bool value = false;
}; };
// The default location for the ECL output files
template<class TypeTag>
struct OutputDir<TypeTag, TTag::FlowBaseProblem> {
static constexpr auto value = ".";
};
// the cache for intensive quantities can be used for ECL problems and also yields a
// decent speedup...
template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, TTag::FlowBaseProblem> {
static constexpr bool value = true;
};
// the cache for the storage term can also be used and also yields a decent speedup
template<class TypeTag>
struct EnableStorageCache<TypeTag, TTag::FlowBaseProblem> {
static constexpr bool value = true;
};
// Use the "velocity module" which uses the Eclipse "NEWTRAN" transmissibilities // Use the "velocity module" which uses the Eclipse "NEWTRAN" transmissibilities
template<class TypeTag> template<class TypeTag>
struct FluxModule<TypeTag, TTag::FlowBaseProblem> { struct FluxModule<TypeTag, TTag::FlowBaseProblem> {
@ -523,4 +498,29 @@ struct ExplicitRockCompaction<TypeTag, TTag::FlowBaseProblem> {
} // namespace Opm::Properties } // namespace Opm::Properties
namespace Opm::Parameters {
// The default location for the ECL output files
template<class TypeTag>
struct OutputDir<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = "."; };
// Disable the VTK output by default for this problem ...
template<class TypeTag>
struct EnableVtkOutput<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// the cache for intensive quantities can be used for ECL problems and also yields a
// decent speedup...
template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// the cache for the storage term can also be used and also yields a decent speedup
template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
#endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP #endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP

View File

@ -336,7 +336,7 @@ private:
} }
else { else {
deckFilename = Parameters::get<PreTypeTag, Properties::EclDeckFileName>(); deckFilename = Parameters::get<PreTypeTag, Properties::EclDeckFileName>();
outputDir = Parameters::get<PreTypeTag, Properties::OutputDir>(); outputDir = Parameters::get<PreTypeTag, Parameters::OutputDir>();
} }
#if HAVE_DAMARIS #if HAVE_DAMARIS
@ -719,7 +719,7 @@ private:
else { else {
threads = 2; threads = 2;
const int input_threads = Parameters::get<TypeTag, Properties::ThreadsPerProcess>(); const int input_threads = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();
if (input_threads > 0) if (input_threads > 0)
threads = input_threads; threads = input_threads;

View File

@ -30,6 +30,7 @@
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <opm/models/blackoil/blackoilproperties.hh> #include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/io/baseoutputmodule.hh> #include <opm/models/io/baseoutputmodule.hh>
#include <opm/models/io/vtkmultiwriter.hh> #include <opm/models/io/vtkmultiwriter.hh>
#include <opm/models/utils/parametersystem.hh> #include <opm/models/utils/parametersystem.hh>
@ -126,7 +127,7 @@ namespace Opm {
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Properties::EnableVtkOutput>()) if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>())
return; return;
if (eclTracerConcentrationOutput_()) { if (eclTracerConcentrationOutput_()) {
@ -172,9 +173,6 @@ namespace Opm {
} }
} }
} }
} }
private: private:
@ -184,10 +182,10 @@ namespace Opm {
return val; return val;
} }
std::vector<ScalarBuffer> eclFreeTracerConcentration_; std::vector<ScalarBuffer> eclFreeTracerConcentration_;
std::vector<ScalarBuffer> eclSolTracerConcentration_; std::vector<ScalarBuffer> eclSolTracerConcentration_;
}; };
} // namespace Opm } // namespace Opm
#endif // OPM_VTK_TRACER_MODULE_HPP #endif // OPM_VTK_TRACER_MODULE_HPP

View File

@ -126,22 +126,24 @@ struct NewtonMaxIterations<TypeTag, TTag::TestTypeTag> {
static constexpr int value = 8; static constexpr int value = 8;
}; };
} // namespace Opm::Properties
namespace Opm::Parameters {
// if openMP is available, set the default the number of threads per process for the main // if openMP is available, set the default the number of threads per process for the main
// simulation to 2 (instead of grabbing everything that is available). // simulation to 2 (instead of grabbing everything that is available).
#if _OPENMP #if _OPENMP
template<class TypeTag> template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::TestTypeTag> { struct ThreadsPerProcess<TypeTag, Properties::TTag::TestTypeTag>
static constexpr int value = 2; { static constexpr int value = 2; };
};
#endif #endif
// By default, ebos accepts the result of the time integration unconditionally if the // By default, ebos accepts the result of the time integration unconditionally if the
// smallest time step size is reached. // smallest time step size is reached.
template<class TypeTag> template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, TTag::TestTypeTag> { struct ContinueOnConvergenceError<TypeTag, Properties::TTag::TestTypeTag>
static constexpr bool value = true; { static constexpr bool value = true; };
};
} // namespace Opm::Properties } // namespace Opm::Parameters
#endif // OPM_TEST_TYPETAG_HPP #endif // OPM_TEST_TYPETAG_HPP