Skip to content

Commit

Permalink
Merge pull request #5455 from akva2/fvbasediscretization_param_split
Browse files Browse the repository at this point in the history
Adjust to to changes in fvbaseproperties.hh (moving of parameters to Opm::Parmeters namespace)
  • Loading branch information
bska authored Jul 1, 2024
2 parents 1e831ba + d442274 commit 9f8075e
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 76 deletions.
25 changes: 14 additions & 11 deletions flowexperimental/flowexp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,27 +176,30 @@ struct NewtonMaxIterations<TypeTag, TTag::FlowExpTypeTag> {
static constexpr int value = 8;
};

template<class TypeTag>
struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
using type = ISTLSolver<TypeTag>;
};

} // 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, TTag::FlowExpTypeTag> {
static constexpr int value = 2;
};
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, TTag::FlowExpTypeTag> {
static constexpr bool value = true;
};
template<class TypeTag>
struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
using type = ISTLSolver<TypeTag>;
};
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = true; };

} // namespace Opm::Properties
} // namespace Opm::Parameters

namespace Opm {
template <class TypeTag>
Expand Down
24 changes: 12 additions & 12 deletions flowexperimental/flowexp_blackoil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ struct Problem<TypeTag, TTag::FlowExpProblemBlackOil>
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>
struct EclNewtonSumTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
{
Expand Down Expand Up @@ -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)
{
using TypeTag = Opm::Properties::TTag::FlowExpProblemBlackOil;
Expand Down
2 changes: 2 additions & 0 deletions opm/simulators/aquifers/AquiferAnalytical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef OPM_AQUIFERANALYTICAL_HEADER_INCLUDED
#define OPM_AQUIFERANALYTICAL_HEADER_INCLUDED

#include <dune/grid/common/partitionset.hh>

#include <opm/common/ErrorMacros.hpp>

#include <opm/input/eclipse/EclipseState/Aquifer/Aquancon.hpp>
Expand Down
2 changes: 2 additions & 0 deletions opm/simulators/aquifers/AquiferNumerical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#ifndef 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/material/common/MathToolbox.hpp>
Expand Down
12 changes: 8 additions & 4 deletions opm/simulators/flow/BlackoilModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ struct FlowProblem {
};
}
template<class TypeTag>
struct OutputDir<TypeTag, TTag::FlowProblem> {
static constexpr auto value = "";
};
template<class TypeTag>
struct EnableDebuggingChecks<TypeTag, TTag::FlowProblem> {
static constexpr bool value = false;
};
Expand Down Expand Up @@ -152,6 +148,14 @@ struct LinearSolverSplice<TypeTag, TTag::FlowProblem> {

} // namespace Opm::Properties

namespace Opm::Parameters {

template<class TypeTag>
struct OutputDir<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto value = ""; };

}

namespace Opm {

/// A model implementation for three-phase black oil.
Expand Down
11 changes: 9 additions & 2 deletions opm/simulators/flow/BlackoilModelParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef 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/utils/basicproperties.hh>
Expand Down Expand Up @@ -467,15 +468,21 @@ template<class TypeTag>
struct LocalDomainsOrderingMeasure<TypeTag, TTag::FlowModelParameters> {
static constexpr auto value = "maxpressure";
};

} // namespace Opm::Properties

namespace Opm::Parameters {

// if openMP is available, determine the number threads per process automatically.
#if _OPENMP
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::FlowModelParameters> {
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowModelParameters>
{
static constexpr int value = -1;
};
#endif

} // namespace Opm::Properties
} // namespace Opm::Parameters

namespace Opm
{
Expand Down
2 changes: 1 addition & 1 deletion opm/simulators/flow/FlowBaseVanguard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class FlowBaseVanguard : public BaseVanguard<TypeTag>,
{
asImp_().createGrids_();
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>();
asImp_().updateOutputDir_(outputDir, enableEclCompatFile);
asImp_().finalizeInit_();
Expand Down
14 changes: 7 additions & 7 deletions opm/simulators/flow/FlowMain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,25 +129,25 @@ namespace Opm {

// hide the parameters unused by flow. TODO: this is a pain to maintain
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
// hard-codes the assumption that the intensive quantities cache is enabled,
// 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
// model
Parameters::hideParam<TypeTag, Properties::EnableThermodynamicHints>();
Parameters::hideParam<TypeTag, Parameters::EnableThermodynamicHints>();

// in flow only the deck file determines the end time of the simulation
Parameters::hideParam<TypeTag, Properties::EndTime>();

// time stepping is not done by the eWoms code in flow
Parameters::hideParam<TypeTag, Properties::InitialTimeStepSize>();
Parameters::hideParam<TypeTag, Properties::MaxTimeStepDivisions>();
Parameters::hideParam<TypeTag, Properties::MaxTimeStepSize>();
Parameters::hideParam<TypeTag, Properties::MinTimeStepSize>();
Parameters::hideParam<TypeTag, Parameters::MaxTimeStepDivisions>();
Parameters::hideParam<TypeTag, Parameters::MaxTimeStepSize>();
Parameters::hideParam<TypeTag, Parameters::MinTimeStepSize>();
Parameters::hideParam<TypeTag, Properties::PredeterminedTimeStepsFile>();

// flow also does not use the eWoms Newton method
Expand Down Expand Up @@ -388,7 +388,7 @@ namespace Opm {
if (!getenv("OMP_NUM_THREADS"))
{
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)
threads = requested_threads;

Expand Down
50 changes: 25 additions & 25 deletions opm/simulators/flow/FlowProblemProperties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,6 @@ struct NewtonTolerance<TypeTag, TTag::FlowBaseProblem> {
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
template<class TypeTag>
struct EnableEclOutput<TypeTag,TTag::FlowBaseProblem> {
Expand Down Expand Up @@ -404,25 +398,6 @@ struct EclOutputDoublePrecision<TypeTag, TTag::FlowBaseProblem> {
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
template<class TypeTag>
struct FluxModule<TypeTag, TTag::FlowBaseProblem> {
Expand Down Expand Up @@ -523,4 +498,29 @@ struct ExplicitRockCompaction<TypeTag, TTag::FlowBaseProblem> {

} // 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
4 changes: 2 additions & 2 deletions opm/simulators/flow/Main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class Main
}
else {
deckFilename = Parameters::get<PreTypeTag, Properties::EclDeckFileName>();
outputDir = Parameters::get<PreTypeTag, Properties::OutputDir>();
outputDir = Parameters::get<PreTypeTag, Parameters::OutputDir>();
}

#if HAVE_DAMARIS
Expand Down Expand Up @@ -719,7 +719,7 @@ class Main
else {
threads = 2;

const int input_threads = Parameters::get<TypeTag, Properties::ThreadsPerProcess>();
const int input_threads = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();

if (input_threads > 0)
threads = input_threads;
Expand Down
8 changes: 3 additions & 5 deletions opm/simulators/flow/VtkTracerModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <dune/common/fvector.hh>

#include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/io/baseoutputmodule.hh>
#include <opm/models/io/vtkmultiwriter.hh>
#include <opm/models/utils/parametersystem.hh>
Expand Down Expand Up @@ -126,7 +127,7 @@ namespace Opm {
*/
void processElement(const ElementContext& elemCtx)
{
if (!Parameters::get<TypeTag, Properties::EnableVtkOutput>())
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>())
return;

if (eclTracerConcentrationOutput_()) {
Expand Down Expand Up @@ -172,9 +173,6 @@ namespace Opm {
}
}
}



}

private:
Expand All @@ -184,10 +182,10 @@ namespace Opm {
return val;
}


std::vector<ScalarBuffer> eclFreeTracerConcentration_;
std::vector<ScalarBuffer> eclSolTracerConcentration_;
};

} // namespace Opm

#endif // OPM_VTK_TRACER_MODULE_HPP
16 changes: 9 additions & 7 deletions tests/TestTypeTag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,24 @@ struct NewtonMaxIterations<TypeTag, TTag::TestTypeTag> {
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
// simulation to 2 (instead of grabbing everything that is available).
#if _OPENMP
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::TestTypeTag> {
static constexpr int value = 2;
};
struct ThreadsPerProcess<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr int value = 2; };
#endif

// By default, ebos accepts the result of the time integration unconditionally if the
// smallest time step size is reached.
template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, TTag::TestTypeTag> {
static constexpr bool value = true;
};
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = true; };

} // namespace Opm::Properties
} // namespace Opm::Parameters

#endif // OPM_TEST_TYPETAG_HPP

0 comments on commit 9f8075e

Please sign in to comment.