From 6d6ba6909c580732e0b90ad4360ddf64370c9f55 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Fri, 7 Feb 2020 15:44:22 +0100 Subject: [PATCH 01/12] [properties] replace propertysystem --- examples/problems/co2injectionproblem.hh | 9 - examples/problems/fingerproblem.hh | 1 - examples/problems/groundwaterproblem.hh | 8 - examples/problems/lensproblem.hh | 6 - examples/problems/reservoirproblem.hh | 3 - examples/tutorial1.cpp | 1 + examples/tutorial1problem.hh | 2 + opm/models/blackoil/blackoilnewtonmethod.hh | 5 - opm/models/blackoil/blackoilproperties.hh | 14 - opm/models/common/darcyfluxmodule.hh | 1 - opm/models/common/diffusionmodule.hh | 1 - opm/models/common/energymodule.hh | 6 - opm/models/common/forchheimerfluxmodule.hh | 1 - opm/models/common/multiphasebasemodel.hh | 4 +- opm/models/common/multiphasebaseproblem.hh | 4 - opm/models/common/multiphasebaseproperties.hh | 13 - .../discretefractureproblem.hh | 3 - .../discretefractureproperties.hh | 1 - .../common/baseauxiliarymodule.hh | 6 - .../common/fvbaseadlocallinearizer.hh | 11 - .../common/fvbaseconstraints.hh | 1 - .../common/fvbasefdlocallinearizer.hh | 15 - .../common/fvbasenewtonconvergencewriter.hh | 5 - .../common/fvbasenewtonmethod.hh | 6 - .../discretization/common/fvbaseproperties.hh | 66 +- .../discretization/vcfv/vcfvproperties.hh | 1 - opm/models/flash/flashproperties.hh | 7 - opm/models/immiscible/immiscibleproperties.hh | 5 - opm/models/io/baseoutputmodule.hh | 11 - opm/models/io/basevanguard.hh | 8 - opm/models/io/cubegridvanguard.hh | 9 - opm/models/io/dgfvanguard.hh | 19 +- opm/models/io/simplexvanguard.hh | 9 - opm/models/io/structuredgridvanguard.hh | 9 - opm/models/io/vtkblackoilenergymodule.hh | 6 - opm/models/io/vtkblackoilmodule.hh | 13 - opm/models/io/vtkblackoilpolymermodule.hh | 8 - opm/models/io/vtkblackoilsolventmodule.hh | 6 - opm/models/io/vtkcompositionmodule.hh | 9 - opm/models/io/vtkdiffusionmodule.hh | 5 - opm/models/io/vtkdiscretefracturemodule.hh | 11 - opm/models/io/vtkenergymodule.hh | 6 - opm/models/io/vtkmultiphasemodule.hh | 14 - opm/models/io/vtkphasepresencemodule.hh | 3 - opm/models/io/vtkprimaryvarsmodule.hh | 6 - opm/models/io/vtktemperaturemodule.hh | 3 - opm/models/ncp/ncpproperties.hh | 6 - opm/models/nonlinear/newtonmethod.hh | 22 - opm/models/nonlinear/nullconvergencewriter.hh | 3 - opm/models/parallel/threadmanager.hh | 5 +- opm/models/pvs/pvsproperties.hh | 6 - opm/models/richards/richardsproperties.hh | 7 - opm/models/utils/basicproperties.hh | 249 +++- opm/models/utils/parametersystem.hh | 86 +- opm/models/utils/propertysystem.hh | 1325 ++--------------- opm/models/utils/propertysystemmacros.hh | 392 +++++ opm/models/utils/simulator.hh | 14 +- opm/models/utils/start.hh | 7 - .../linalg/istlpreconditionerwrappers.hh | 6 - opm/simulators/linalg/istlsolverwrappers.hh | 8 - opm/simulators/linalg/parallelamgbackend.hh | 2 - opm/simulators/linalg/parallelbasebackend.hh | 23 - .../linalg/parallelbicgstabbackend.hh | 1 - opm/simulators/linalg/parallelistlbackend.hh | 3 - opm/simulators/linalg/superlubackend.hh | 7 - 65 files changed, 865 insertions(+), 1668 deletions(-) create mode 100644 opm/models/utils/propertysystemmacros.hh diff --git a/examples/problems/co2injectionproblem.hh b/examples/problems/co2injectionproblem.hh index 1a2b53e1a..cfeb36c1b 100644 --- a/examples/problems/co2injectionproblem.hh +++ b/examples/problems/co2injectionproblem.hh @@ -73,16 +73,7 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(Co2InjectionBaseProblem); // declare the CO2 injection problem specific property tags -NEW_PROP_TAG(FluidSystemPressureLow); -NEW_PROP_TAG(FluidSystemPressureHigh); -NEW_PROP_TAG(FluidSystemNumPressure); -NEW_PROP_TAG(FluidSystemTemperatureLow); -NEW_PROP_TAG(FluidSystemTemperatureHigh); -NEW_PROP_TAG(FluidSystemNumTemperature); -NEW_PROP_TAG(MaxDepth); -NEW_PROP_TAG(Temperature); -NEW_PROP_TAG(SimulationName); // Set the grid type SET_TYPE_PROP(Co2InjectionBaseProblem, Grid, Dune::YaspGrid<2>); diff --git a/examples/problems/fingerproblem.hh b/examples/problems/fingerproblem.hh index 7e4db6bec..b18978cfe 100644 --- a/examples/problems/fingerproblem.hh +++ b/examples/problems/fingerproblem.hh @@ -77,7 +77,6 @@ SET_TYPE_PROP(FingerBaseProblem, #endif // declare the properties used by the finger problem -NEW_PROP_TAG(InitialWaterSaturation); // Set the problem property SET_TYPE_PROP(FingerBaseProblem, Problem, Opm::FingerProblem); diff --git a/examples/problems/groundwaterproblem.hh b/examples/problems/groundwaterproblem.hh index 4f62c59ee..0d9393e2d 100644 --- a/examples/problems/groundwaterproblem.hh +++ b/examples/problems/groundwaterproblem.hh @@ -55,14 +55,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(GroundWaterBaseProblem); -NEW_PROP_TAG(LensLowerLeftX); -NEW_PROP_TAG(LensLowerLeftY); -NEW_PROP_TAG(LensLowerLeftZ); -NEW_PROP_TAG(LensUpperRightX); -NEW_PROP_TAG(LensUpperRightY); -NEW_PROP_TAG(LensUpperRightZ); -NEW_PROP_TAG(Permeability); -NEW_PROP_TAG(PermeabilityLens); SET_PROP(GroundWaterBaseProblem, Fluid) { diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index 094d042a4..bb7575739 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -61,12 +61,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(LensBaseProblem, INHERITS_FROM(StructuredGridVanguard)); // declare the properties specific for the lens problem -NEW_PROP_TAG(LensLowerLeftX); -NEW_PROP_TAG(LensLowerLeftY); -NEW_PROP_TAG(LensLowerLeftZ); -NEW_PROP_TAG(LensUpperRightX); -NEW_PROP_TAG(LensUpperRightY); -NEW_PROP_TAG(LensUpperRightZ); // Set the problem property SET_TYPE_PROP(LensBaseProblem, Problem, Opm::LensProblem); diff --git a/examples/problems/reservoirproblem.hh b/examples/problems/reservoirproblem.hh index 2cb0ef2b3..c1bfed2db 100644 --- a/examples/problems/reservoirproblem.hh +++ b/examples/problems/reservoirproblem.hh @@ -62,11 +62,8 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ReservoirBaseProblem); // Maximum depth of the reservoir -NEW_PROP_TAG(MaxDepth); // The temperature inside the reservoir -NEW_PROP_TAG(Temperature); // The width of producer/injector wells as a fraction of the width of the spatial domain -NEW_PROP_TAG(WellWidth); // Set the grid type SET_TYPE_PROP(ReservoirBaseProblem, Grid, Dune::YaspGrid<2>); diff --git a/examples/tutorial1.cpp b/examples/tutorial1.cpp index a65e78f0f..831c83df5 100644 --- a/examples/tutorial1.cpp +++ b/examples/tutorial1.cpp @@ -27,6 +27,7 @@ * immisciblility. */ #include "config.h" /*@\label{tutorial1:include-begin}@*/ +#include #include /*@\label{tutorial1:include-end}@*/ #include "tutorial1problem.hh" /*@\label{tutorial1:include-problem-header}@*/ diff --git a/examples/tutorial1problem.hh b/examples/tutorial1problem.hh index 1d01cb2e0..65c6c6618 100644 --- a/examples/tutorial1problem.hh +++ b/examples/tutorial1problem.hh @@ -34,6 +34,8 @@ // The spatial discretization (VCFV == Vertex-Centered Finite Volumes) #include /*@\label{tutorial1:include-discretization}@*/ +#include + // The chemical species that are used #include #include diff --git a/opm/models/blackoil/blackoilnewtonmethod.hh b/opm/models/blackoil/blackoilnewtonmethod.hh index 345a67d3b..3ff53148f 100644 --- a/opm/models/blackoil/blackoilnewtonmethod.hh +++ b/opm/models/blackoil/blackoilnewtonmethod.hh @@ -36,11 +36,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(DpMaxRel); -NEW_PROP_TAG(DsMax); -NEW_PROP_TAG(PriVarOscilationThreshold); -NEW_PROP_TAG(ProjectSaturations); - SET_SCALAR_PROP(NewtonMethod, DpMaxRel, 0.3); SET_SCALAR_PROP(NewtonMethod, DsMax, 0.2); SET_SCALAR_PROP(NewtonMethod, PriVarOscilationThreshold, 1e-5); diff --git a/opm/models/blackoil/blackoilproperties.hh b/opm/models/blackoil/blackoilproperties.hh index 56ae6dfa6..3160c39f0 100644 --- a/opm/models/blackoil/blackoilproperties.hh +++ b/opm/models/blackoil/blackoilproperties.hh @@ -35,37 +35,24 @@ BEGIN_PROPERTIES //! Specifies if the simulation should write output files that are //! compatible with those produced by the commercial Eclipse simulator -NEW_PROP_TAG(EnableEclipseOutput); //! The material law for thermal conduction -NEW_PROP_TAG(ThermalConductionLaw); //! The parameters of the material law for thermal conduction -NEW_PROP_TAG(ThermalConductionLawParams); //! The material law for energy storage of the rock -NEW_PROP_TAG(SolidEnergyLaw); //! The parameters for material law for energy storage of the rock -NEW_PROP_TAG(SolidEnergyLawParams); //! Enable the ECL-blackoil extension for solvents. ("Second gas") -NEW_PROP_TAG(EnableSolvent); //! Enable the ECL-blackoil extension for polymer. -NEW_PROP_TAG(EnablePolymer); //! Enable the tracking polymer molecular weight tracking and related functionalities -NEW_PROP_TAG(EnablePolymerMW); //! Enable surface volume scaling -NEW_PROP_TAG(BlackoilConserveSurfaceVolume); //! Enable the ECL-blackoil extension for foam -NEW_PROP_TAG(EnableFoam); //! Enable the ECL-blackoil extension for salt -NEW_PROP_TAG(EnableBrine); //! Allow the spatial and temporal domains to exhibit non-constant temperature //! in the black-oil model -NEW_PROP_TAG(EnableTemperature); //! Enable the ECL-blackoil extension for energy conservation //! //! Setting this property to true implies EnableTemperature. -NEW_PROP_TAG(EnableEnergy); //! The relative weight of the residual of the energy equation compared to the mass //! residuals @@ -74,7 +61,6 @@ NEW_PROP_TAG(EnableEnergy); //! of unmodified dune-istl linear solvers cannot weight the individual equations. if the //! energy equation is not scaled, its absolute value is normally several orders of //! magnitude larger than that of the mass balance equations -NEW_PROP_TAG(BlackOilEnergyScalingFactor); END_PROPERTIES diff --git a/opm/models/common/darcyfluxmodule.hh b/opm/models/common/darcyfluxmodule.hh index 410cbbed5..59c75f989 100644 --- a/opm/models/common/darcyfluxmodule.hh +++ b/opm/models/common/darcyfluxmodule.hh @@ -44,7 +44,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(MaterialLaw); END_PROPERTIES diff --git a/opm/models/common/diffusionmodule.hh b/opm/models/common/diffusionmodule.hh index 4cb12d538..09c3b267f 100644 --- a/opm/models/common/diffusionmodule.hh +++ b/opm/models/common/diffusionmodule.hh @@ -39,7 +39,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Indices); END_PROPERTIES diff --git a/opm/models/common/energymodule.hh b/opm/models/common/energymodule.hh index 53da3b2c2..6339f3328 100644 --- a/opm/models/common/energymodule.hh +++ b/opm/models/common/energymodule.hh @@ -42,12 +42,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Indices); -NEW_PROP_TAG(EnableEnergy); -NEW_PROP_TAG(ThermalConductionLaw); -NEW_PROP_TAG(ThermalConductionLawParams); -NEW_PROP_TAG(SolidEnergyLaw); -NEW_PROP_TAG(SolidEnergyLawParams); END_PROPERTIES diff --git a/opm/models/common/forchheimerfluxmodule.hh b/opm/models/common/forchheimerfluxmodule.hh index 81a5fa369..61307c9f6 100644 --- a/opm/models/common/forchheimerfluxmodule.hh +++ b/opm/models/common/forchheimerfluxmodule.hh @@ -45,7 +45,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(MaterialLaw); END_PROPERTIES diff --git a/opm/models/common/multiphasebasemodel.hh b/opm/models/common/multiphasebasemodel.hh index e6c6346cd..2b29f0d87 100644 --- a/opm/models/common/multiphasebasemodel.hh +++ b/opm/models/common/multiphasebasemodel.hh @@ -51,10 +51,10 @@ class MultiPhaseBaseModel; BEGIN_PROPERTIES //! The generic type tag for problems using the immiscible multi-phase model -NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(VtkMultiPhase, VtkTemperature)); +NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(NumericModel, VtkMultiPhase, VtkTemperature)); //! Specify the splices of the MultiPhaseBaseModel type tag -SET_SPLICES(MultiPhaseBaseModel, SpatialDiscretizationSplice); +//SET_SPLICES(MultiPhaseBaseModel, SpatialDiscretizationSplice); //! Set the default spatial discretization //! diff --git a/opm/models/common/multiphasebaseproblem.hh b/opm/models/common/multiphasebaseproblem.hh index a5b8c7c5b..a83b846f6 100644 --- a/opm/models/common/multiphasebaseproblem.hh +++ b/opm/models/common/multiphasebaseproblem.hh @@ -43,10 +43,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(SolidEnergyLawParams); -NEW_PROP_TAG(ThermalConductionLawParams); -NEW_PROP_TAG(EnableGravity); -NEW_PROP_TAG(FluxModule); END_PROPERTIES diff --git a/opm/models/common/multiphasebaseproperties.hh b/opm/models/common/multiphasebaseproperties.hh index ec391e49e..99a52d302 100644 --- a/opm/models/common/multiphasebaseproperties.hh +++ b/opm/models/common/multiphasebaseproperties.hh @@ -37,32 +37,19 @@ BEGIN_PROPERTIES //! The splice to be used for the spatial discretization -NEW_PROP_TAG(SpatialDiscretizationSplice); //! Number of fluid phases in the system -NEW_PROP_TAG(NumPhases); //! Number of chemical species in the system -NEW_PROP_TAG(NumComponents); //! Enumerations used by the model -NEW_PROP_TAG(Indices); //! The material law which ought to be used (extracted from the spatial parameters) -NEW_PROP_TAG(MaterialLaw); //! The context material law (extracted from the spatial parameters) -NEW_PROP_TAG(MaterialLawParams); //! The material law for the energy stored in the solid matrix -NEW_PROP_TAG(SolidEnergyLaw); //! The parameters of the material law for energy storage of the solid -NEW_PROP_TAG(SolidEnergyLawParams); //! The material law for thermal conduction -NEW_PROP_TAG(ThermalConductionLaw); //! The parameters of the material law for thermal conduction -NEW_PROP_TAG(ThermalConductionLawParams); //!The fluid systems including the information about the phases -NEW_PROP_TAG(FluidSystem); //! Specifies the relation used for velocity -NEW_PROP_TAG(FluxModule); //! Returns whether gravity is considered in the problem -NEW_PROP_TAG(EnableGravity); END_PROPERTIES diff --git a/opm/models/discretefracture/discretefractureproblem.hh b/opm/models/discretefracture/discretefractureproblem.hh index 8793a3d4d..7c184e7b8 100644 --- a/opm/models/discretefracture/discretefractureproblem.hh +++ b/opm/models/discretefracture/discretefractureproblem.hh @@ -41,9 +41,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(ThermalConductionLawParams); -NEW_PROP_TAG(EnableGravity); -NEW_PROP_TAG(FluxModule); END_PROPERTIES diff --git a/opm/models/discretefracture/discretefractureproperties.hh b/opm/models/discretefracture/discretefractureproperties.hh index 31e39df6e..1fd66e64c 100644 --- a/opm/models/discretefracture/discretefractureproperties.hh +++ b/opm/models/discretefracture/discretefractureproperties.hh @@ -36,7 +36,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(UseTwoPointGradients); END_PROPERTIES diff --git a/opm/models/discretization/common/baseauxiliarymodule.hh b/opm/models/discretization/common/baseauxiliarymodule.hh index 3f0381200..1e425c00e 100644 --- a/opm/models/discretization/common/baseauxiliarymodule.hh +++ b/opm/models/discretization/common/baseauxiliarymodule.hh @@ -39,12 +39,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(AuxModule); // declare the properties required by the for the ecl grid manager -NEW_PROP_TAG(Grid); -NEW_PROP_TAG(GridView); -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(DofMapper); -NEW_PROP_TAG(GlobalEqVector); -NEW_PROP_TAG(SparseMatrixAdapter); END_PROPERTIES diff --git a/opm/models/discretization/common/fvbaseadlocallinearizer.hh b/opm/models/discretization/common/fvbaseadlocallinearizer.hh index 5bc9d53ce..7b5cf10db 100644 --- a/opm/models/discretization/common/fvbaseadlocallinearizer.hh +++ b/opm/models/discretization/common/fvbaseadlocallinearizer.hh @@ -51,18 +51,7 @@ BEGIN_PROPERTIES // declare the property tags required for the finite differences local linearizer NEW_TYPE_TAG(AutoDiffLocalLinearizer); -NEW_PROP_TAG(LocalLinearizer); -NEW_PROP_TAG(Evaluation); -NEW_PROP_TAG(LocalResidual); -NEW_PROP_TAG(Simulator); -NEW_PROP_TAG(Problem); -NEW_PROP_TAG(Model); -NEW_PROP_TAG(PrimaryVariables); -NEW_PROP_TAG(ElementContext); -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Evaluation); -NEW_PROP_TAG(GridView); // set the properties to be spliced in SET_TYPE_PROP(AutoDiffLocalLinearizer, LocalLinearizer, diff --git a/opm/models/discretization/common/fvbaseconstraints.hh b/opm/models/discretization/common/fvbaseconstraints.hh index ad3af67da..1b152123e 100644 --- a/opm/models/discretization/common/fvbaseconstraints.hh +++ b/opm/models/discretization/common/fvbaseconstraints.hh @@ -33,7 +33,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(PrimaryVariables); END_PROPERTIES diff --git a/opm/models/discretization/common/fvbasefdlocallinearizer.hh b/opm/models/discretization/common/fvbasefdlocallinearizer.hh index c53ed18b5..52428b3aa 100644 --- a/opm/models/discretization/common/fvbasefdlocallinearizer.hh +++ b/opm/models/discretization/common/fvbasefdlocallinearizer.hh @@ -54,21 +54,6 @@ BEGIN_PROPERTIES // declare the property tags required for the finite differences local linearizer NEW_TYPE_TAG(FiniteDifferenceLocalLinearizer); -NEW_PROP_TAG(LocalLinearizer); -NEW_PROP_TAG(Evaluation); -NEW_PROP_TAG(NumericDifferenceMethod); -NEW_PROP_TAG(BaseEpsilon); -NEW_PROP_TAG(SparseMatrixAdapter); -NEW_PROP_TAG(LocalResidual); -NEW_PROP_TAG(Simulator); -NEW_PROP_TAG(Problem); -NEW_PROP_TAG(Model); -NEW_PROP_TAG(PrimaryVariables); -NEW_PROP_TAG(ElementContext); -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Evaluation); -NEW_PROP_TAG(GridView); -NEW_PROP_TAG(NumEq); // set the properties to be spliced in SET_TYPE_PROP(FiniteDifferenceLocalLinearizer, LocalLinearizer, diff --git a/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh b/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh index b66b44bbd..d20644642 100644 --- a/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh +++ b/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh @@ -37,11 +37,6 @@ BEGIN_PROPERTIES // forward declaration of the required property tags -NEW_PROP_TAG(GridView); -NEW_PROP_TAG(NewtonMethod); -NEW_PROP_TAG(SolutionVector); -NEW_PROP_TAG(GlobalEqVector); -NEW_PROP_TAG(VtkOutputFormat); END_PROPERTIES //! \endcond diff --git a/opm/models/discretization/common/fvbasenewtonmethod.hh b/opm/models/discretization/common/fvbasenewtonmethod.hh index c482ea086..1becc3323 100644 --- a/opm/models/discretization/common/fvbasenewtonmethod.hh +++ b/opm/models/discretization/common/fvbasenewtonmethod.hh @@ -48,23 +48,17 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(FvBaseNewtonMethod, INHERITS_FROM(NewtonMethod)); //! The class dealing with the balance equations -NEW_PROP_TAG(Model); //! The class storing primary variables plus pseudo primary variables -NEW_PROP_TAG(PrimaryVariables); //! The class storing values of conservation equations (e.g., a "naked" primary varible //! vector) -NEW_PROP_TAG(EqVector); //! The number of balance equations. -NEW_PROP_TAG(NumEq); //! The discretization specific part of he implementing the Newton algorithm -NEW_PROP_TAG(DiscNewtonMethod); //! The class implementing the Newton algorithm -NEW_PROP_TAG(NewtonMethod); // set default values SET_TYPE_PROP(FvBaseNewtonMethod, DiscNewtonMethod, diff --git a/opm/models/discretization/common/fvbaseproperties.hh b/opm/models/discretization/common/fvbaseproperties.hh index bf643f100..1ebc9e96d 100644 --- a/opm/models/discretization/common/fvbaseproperties.hh +++ b/opm/models/discretization/common/fvbaseproperties.hh @@ -48,13 +48,9 @@ NEW_TYPE_TAG(FvBaseDiscretization, //! set the splices for the finite volume discretizations -NEW_PROP_TAG(LinearSolverSplice); -NEW_PROP_TAG(ParallelBiCGStabLinearSolver); -NEW_PROP_TAG(LocalLinearizerSplice); -NEW_PROP_TAG(FiniteDifferenceLocalLinearizer); -SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice); +//SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice); //! use a parallel BiCGStab linear solver by default SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSolver); @@ -70,108 +66,69 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * "Scalar" property (if the finite difference linearizer is used), or it may be more * complex (for the linearizer which uses automatic differentiation). */ -NEW_PROP_TAG(Evaluation); //! The type of the DUNE grid -NEW_PROP_TAG(Grid); //! The type of the grid view -NEW_PROP_TAG(GridView); //! The class describing the stencil of the spatial discretization -NEW_PROP_TAG(Stencil); //! The class describing the discrete function space when dune-fem is used, otherwise it points to the stencil class -NEW_PROP_TAG(DiscreteFunctionSpace); //! The type of the problem -NEW_PROP_TAG(Problem); //! The type of the base class for all problems which use this model -NEW_PROP_TAG(BaseProblem); //! The type of the model -NEW_PROP_TAG(Model); //! Number of equations in the system of PDEs -NEW_PROP_TAG(NumEq); //! The type of the spatial discretization used by the model -NEW_PROP_TAG(Discretization); //! The discretization specific part of the local residual -NEW_PROP_TAG(DiscLocalResidual); //! The type of the local residual function -NEW_PROP_TAG(LocalResidual); //! The type of the local linearizer -NEW_PROP_TAG(LocalLinearizer); //! Specify if elements that do not belong to the local process' grid partition should be //! skipped -NEW_PROP_TAG(LinearizeNonLocalElements); //! Linearizes the global non-linear system of equations -NEW_PROP_TAG(BaseLinearizer); //! The class that allows to manipulate sparse matrices -NEW_PROP_TAG(SparseMatrixAdapter); //! A vector of holding a quantity for each equation (usually at a given spatial location) -NEW_PROP_TAG(EqVector); //! A vector of holding a quantity for each equation for each DOF of an element -NEW_PROP_TAG(ElementEqVector); //! Vector containing a quantity of for equation for each DOF of the whole grid -NEW_PROP_TAG(GlobalEqVector); //! Vector containing volumetric or areal rates of quantities -NEW_PROP_TAG(RateVector); //! Type of object for specifying boundary conditions -NEW_PROP_TAG(BoundaryRateVector); //! The class which represents a constraint degree of freedom -NEW_PROP_TAG(Constraints); //! Vector containing all primary variables of the grid -NEW_PROP_TAG(SolutionVector); //! A vector of primary variables within a sub-control volume -NEW_PROP_TAG(PrimaryVariables); //! The secondary variables within a sub-control volume -NEW_PROP_TAG(IntensiveQuantities); //! The discretization specific part of the intensive quantities -NEW_PROP_TAG(DiscIntensiveQuantities); //! The secondary variables of all degrees of freedom in an element's stencil -NEW_PROP_TAG(ElementContext); //! The secondary variables of a boundary segment -NEW_PROP_TAG(BoundaryContext); //! The secondary variables of a constraint degree of freedom -NEW_PROP_TAG(ConstraintsContext); //! Data required to calculate a flux over a face -NEW_PROP_TAG(ExtensiveQuantities); //! Calculates gradients of arbitrary quantities at flux integration points -NEW_PROP_TAG(GradientCalculator); //! The part of the intensive quantities which is specific to the spatial discretization -NEW_PROP_TAG(DiscBaseIntensiveQuantities); //! The part of the extensive quantities which is specific to the spatial discretization -NEW_PROP_TAG(DiscExtensiveQuantities); //! The part of the VTK ouput modules which is specific to the spatial discretization -NEW_PROP_TAG(DiscBaseOutputModule); //! The class to create grid communication handles -NEW_PROP_TAG(GridCommHandleFactory); /*! * \brief The OpenMP threads manager */ -NEW_PROP_TAG(ThreadManager); -NEW_PROP_TAG(ThreadsPerProcess); //! use locking to prevent race conditions when linearizing the global system of //! equations in multi-threaded mode. (setting this property to true is always save, but //! it may slightly deter performance in multi-threaded simlations and some //! discretizations do not need this.) -NEW_PROP_TAG(UseLinearizationLock); // high-level simulation control //! Manages the simulation time -NEW_PROP_TAG(Simulator); /*! * \brief Switch to enable or disable grid adaptation @@ -179,12 +136,10 @@ NEW_PROP_TAG(Simulator); * Currently grid adaptation requires the presence of the dune-FEM module. If it is not * available and grid adaptation is enabled, an exception is thrown. */ -NEW_PROP_TAG(EnableGridAdaptation); /*! * \brief The directory to which simulation output ought to be written to. */ -NEW_PROP_TAG(OutputDir); /*! * \brief Global switch to enable or disable the writing of VTK output files @@ -192,7 +147,6 @@ NEW_PROP_TAG(OutputDir); * If writing VTK files is disabled, then the WriteVtk$FOO options do * not have any effect... */ -NEW_PROP_TAG(EnableVtkOutput); /*! * \brief Determines if the VTK output is written to disk asynchronously @@ -203,7 +157,6 @@ NEW_PROP_TAG(EnableVtkOutput); * not support multi-threaded multi-process VTK output and even if it would, the result * would be slower than when using synchronous output. */ -NEW_PROP_TAG(EnableAsyncVtkOutput); /*! * \brief Specify the format the VTK output is written to disk @@ -214,37 +167,31 @@ NEW_PROP_TAG(EnableAsyncVtkOutput); * - Dune::VTK::appendedraw * - Dune::VTK::appendedbase64 */ -NEW_PROP_TAG(VtkOutputFormat); //! Specify whether the some degrees of fredom can be constraint -NEW_PROP_TAG(EnableConstraints); /*! * \brief Specify the maximum size of a time integration [s]. * * The default is to not limit the step size. */ -NEW_PROP_TAG(MaxTimeStepSize); /*! * \brief Specify the minimal size of a time integration [s]. * * The default is to not limit the step size. */ -NEW_PROP_TAG(MinTimeStepSize); /*! * \brief The maximum allowed number of timestep divisions for the * Newton solver. */ -NEW_PROP_TAG(MaxTimeStepDivisions); /*! * \brief Continue with a non-converged solution instead of giving up * if we encounter a time step size smaller than the minimum time * step size. */ -NEW_PROP_TAG(ContinueOnConvergenceError); /*! * \brief Specify whether all intensive quantities for the grid should be @@ -255,7 +202,6 @@ NEW_PROP_TAG(ContinueOnConvergenceError); * may cause the simulation to exhibit worse cache coherence behavior * which eats some of the computational benefits again. */ -NEW_PROP_TAG(EnableIntensiveQuantityCache); /*! * \brief Specify whether the storage terms for previous solutions should be cached. @@ -263,7 +209,6 @@ NEW_PROP_TAG(EnableIntensiveQuantityCache); * This potentially reduces the CPU time, but comes at the cost of higher memory * consumption. */ -NEW_PROP_TAG(EnableStorageCache); /*! * \brief Specify whether to use the already calculated solutions as @@ -273,24 +218,20 @@ NEW_PROP_TAG(EnableStorageCache); * very expensive (e.g. for non-linear fugacity functions where the * solver converges faster). */ -NEW_PROP_TAG(EnableThermodynamicHints); // mappers from local to global DOF indices /*! * \brief The mapper to find the global index of a vertex. */ -NEW_PROP_TAG(VertexMapper); /*! * \brief The mapper to find the global index of an element. */ -NEW_PROP_TAG(ElementMapper); /*! * \brief The mapper to find the global index of a degree of freedom. */ -NEW_PROP_TAG(DofMapper); /*! * \brief The class which marks the border indices associated with the @@ -298,26 +239,21 @@ NEW_PROP_TAG(DofMapper); * * This is required for the algebraic overlap stuff. */ -NEW_PROP_TAG(BorderListCreator); /*! * \brief The history size required by the time discretization */ -NEW_PROP_TAG(TimeDiscHistorySize); /*! * \brief Specify whether the storage terms use extensive quantities or not. * * Most models don't need this, but the (Navier-)Stokes ones do... */ -NEW_PROP_TAG(ExtensiveStorageTerm); //! \brief Specify whether to use volumetric residuals or not -NEW_PROP_TAG(UseVolumetricResidual); //! Specify if experimental features should be enabled or not. -NEW_PROP_TAG(EnableExperiments); END_PROPERTIES diff --git a/opm/models/discretization/vcfv/vcfvproperties.hh b/opm/models/discretization/vcfv/vcfvproperties.hh index 706b17ff4..a1ab7cc9a 100644 --- a/opm/models/discretization/vcfv/vcfvproperties.hh +++ b/opm/models/discretization/vcfv/vcfvproperties.hh @@ -40,7 +40,6 @@ NEW_TYPE_TAG(VcfvDiscretization, INHERITS_FROM(FvBaseDiscretization)); //! Use P1 finite-elements gradients instead of two-point gradients. Note that setting //! this property to true requires the dune-localfunctions module to be available. -NEW_PROP_TAG(UseP1FiniteElementGradients); END_PROPERTIES diff --git a/opm/models/flash/flashproperties.hh b/opm/models/flash/flashproperties.hh index 108b6d63b..899c19c33 100644 --- a/opm/models/flash/flashproperties.hh +++ b/opm/models/flash/flashproperties.hh @@ -38,21 +38,14 @@ BEGIN_PROPERTIES //! Provides the thermodynamic relations -NEW_PROP_TAG(FluidSystem); //! The type of the flash constraint solver -NEW_PROP_TAG(FlashSolver); //! The maximum accepted error of the flash solver -NEW_PROP_TAG(FlashTolerance); //! The thermal conduction law which ought to be used -NEW_PROP_TAG(ThermalConductionLaw); //! The parameters of the thermal conduction law -NEW_PROP_TAG(ThermalConductionLawParams); //! Specifies whether energy should be considered as a conservation quantity or not -NEW_PROP_TAG(EnableEnergy); //! Enable diffusive fluxes? -NEW_PROP_TAG(EnableDiffusion); END_PROPERTIES diff --git a/opm/models/immiscible/immiscibleproperties.hh b/opm/models/immiscible/immiscibleproperties.hh index 77380a375..df095acc2 100644 --- a/opm/models/immiscible/immiscibleproperties.hh +++ b/opm/models/immiscible/immiscibleproperties.hh @@ -36,21 +36,16 @@ BEGIN_PROPERTIES //!The fluid systems including the information about the phases -NEW_PROP_TAG(FluidSystem); //! Specify whether energy should be considered as a conservation quantity or not -NEW_PROP_TAG(EnableEnergy); // these properties only make sense for the ImmiscibleTwoPhase type tag //! The wetting phase for two-phase models -NEW_PROP_TAG(WettingPhase); //! The non-wetting phase for two-phase models -NEW_PROP_TAG(NonwettingPhase); // these properties only make sense for the ImmiscibleSinglePhase type tag //! The fluid used by the model -NEW_PROP_TAG(Fluid); END_PROPERTIES diff --git a/opm/models/io/baseoutputmodule.hh b/opm/models/io/baseoutputmodule.hh index fc18a5ba9..a2d1e0bd6 100644 --- a/opm/models/io/baseoutputmodule.hh +++ b/opm/models/io/baseoutputmodule.hh @@ -47,18 +47,7 @@ BEGIN_PROPERTIES // forward definition of property tags -NEW_PROP_TAG(NumPhases); -NEW_PROP_TAG(NumComponents); -NEW_PROP_TAG(NumEq); -NEW_PROP_TAG(Model); -NEW_PROP_TAG(Simulator); -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Evaluation); -NEW_PROP_TAG(GridView); -NEW_PROP_TAG(ElementContext); -NEW_PROP_TAG(FluidSystem); -NEW_PROP_TAG(DiscBaseOutputModule); END_PROPERTIES diff --git a/opm/models/io/basevanguard.hh b/opm/models/io/basevanguard.hh index 061de0764..98857aa81 100644 --- a/opm/models/io/basevanguard.hh +++ b/opm/models/io/basevanguard.hh @@ -41,14 +41,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Grid); -NEW_PROP_TAG(Vanguard); -NEW_PROP_TAG(GridView); -NEW_PROP_TAG(GridPart); -NEW_PROP_TAG(GridViewLevel); -NEW_PROP_TAG(GridFile); -NEW_PROP_TAG(GridGlobalRefinements); -NEW_PROP_TAG(Simulator); END_PROPERTIES diff --git a/opm/models/io/cubegridvanguard.hh b/opm/models/io/cubegridvanguard.hh index 4ee8d474a..d6a836c23 100644 --- a/opm/models/io/cubegridvanguard.hh +++ b/opm/models/io/cubegridvanguard.hh @@ -40,18 +40,9 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Grid); -NEW_PROP_TAG(DomainSizeX); -NEW_PROP_TAG(DomainSizeY); -NEW_PROP_TAG(DomainSizeZ); -NEW_PROP_TAG(CellsX); -NEW_PROP_TAG(CellsY); -NEW_PROP_TAG(CellsZ); -NEW_PROP_TAG(GridGlobalRefinements); END_PROPERTIES diff --git a/opm/models/io/dgfvanguard.hh b/opm/models/io/dgfvanguard.hh index 15a9bd0e8..7e90e7509 100644 --- a/opm/models/io/dgfvanguard.hh +++ b/opm/models/io/dgfvanguard.hh @@ -41,12 +41,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Grid); -NEW_PROP_TAG(GridFile); -NEW_PROP_TAG(Vanguard); -NEW_PROP_TAG(GridGlobalRefinements); -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Simulator); END_PROPERTIES @@ -73,8 +67,13 @@ public: */ static void registerParameters() { - EWOMS_REGISTER_PARAM(TypeTag, std::string, GridFile, - "The file name of the DGF file to load"); +// #define EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description) +// ::Opm::Parameters::registerParam( +// #ParamName, #ParamName, Description) +// EWOMS_REGISTER_PARAM(TypeTag, std::string, GridFile, +// "The file name of the DGF file to load"); + ::Opm::Parameters::template registerParam + ("GridFile", "GridFile", "The file name of the DGF file to load"); EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements, "The number of global refinements of the grid " "executed after it was loaded"); @@ -198,6 +197,10 @@ private: FractureMapper fractureMapper_; }; +namespace Properties { +SET_TYPE_PROP(NumericModel, Vanguard, Opm::DgfVanguard); +} + } // namespace Opm #endif diff --git a/opm/models/io/simplexvanguard.hh b/opm/models/io/simplexvanguard.hh index a12165a4f..efebb5f54 100644 --- a/opm/models/io/simplexvanguard.hh +++ b/opm/models/io/simplexvanguard.hh @@ -38,18 +38,9 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Grid); -NEW_PROP_TAG(DomainSizeX); -NEW_PROP_TAG(DomainSizeY); -NEW_PROP_TAG(DomainSizeZ); -NEW_PROP_TAG(CellsX); -NEW_PROP_TAG(CellsY); -NEW_PROP_TAG(CellsZ); -NEW_PROP_TAG(GridGlobalRefinements); END_PROPERTIES diff --git a/opm/models/io/structuredgridvanguard.hh b/opm/models/io/structuredgridvanguard.hh index 3e143737c..1af91287d 100644 --- a/opm/models/io/structuredgridvanguard.hh +++ b/opm/models/io/structuredgridvanguard.hh @@ -57,18 +57,9 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(StructuredGridVanguard); // declare the properties required by the for the structured grid simulator vanguard -NEW_PROP_TAG(Grid); -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(DomainSizeX); -NEW_PROP_TAG(DomainSizeY); -NEW_PROP_TAG(DomainSizeZ); -NEW_PROP_TAG(CellsX); -NEW_PROP_TAG(CellsY); -NEW_PROP_TAG(CellsZ); -NEW_PROP_TAG(GridGlobalRefinements); // GRIDDIM is only set by the finger problem #ifndef GRIDDIM diff --git a/opm/models/io/vtkblackoilenergymodule.hh b/opm/models/io/vtkblackoilenergymodule.hh index 54fed458c..79f9a482f 100644 --- a/opm/models/io/vtkblackoilenergymodule.hh +++ b/opm/models/io/vtkblackoilenergymodule.hh @@ -46,12 +46,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOilEnergy); // create the property tags needed for the energy module -NEW_PROP_TAG(VtkWriteRockInternalEnergy); -NEW_PROP_TAG(VtkWriteTotalThermalConductivity); -NEW_PROP_TAG(VtkWriteFluidInternalEnergies); -NEW_PROP_TAG(VtkWriteFluidEnthalpies); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOilEnergy, VtkWriteRockInternalEnergy, true); diff --git a/opm/models/io/vtkblackoilmodule.hh b/opm/models/io/vtkblackoilmodule.hh index ec0d251ce..2807ac05d 100644 --- a/opm/models/io/vtkblackoilmodule.hh +++ b/opm/models/io/vtkblackoilmodule.hh @@ -46,19 +46,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOil); // create the property tags needed for the multi phase module -NEW_PROP_TAG(EnableVtkOutput); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(VtkWriteGasDissolutionFactor); -NEW_PROP_TAG(VtkWriteOilVaporizationFactor); -NEW_PROP_TAG(VtkWriteOilFormationVolumeFactor); -NEW_PROP_TAG(VtkWriteGasFormationVolumeFactor); -NEW_PROP_TAG(VtkWriteWaterFormationVolumeFactor); -NEW_PROP_TAG(VtkWriteOilSaturationPressure); -NEW_PROP_TAG(VtkWriteGasSaturationPressure); -NEW_PROP_TAG(VtkWriteSaturationRatios); -NEW_PROP_TAG(VtkWriteSaturatedOilGasDissolutionFactor); -NEW_PROP_TAG(VtkWriteSaturatedGasOilVaporizationFactor); -NEW_PROP_TAG(VtkWritePrimaryVarsMeaning); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOil, VtkWriteGasDissolutionFactor, false); diff --git a/opm/models/io/vtkblackoilpolymermodule.hh b/opm/models/io/vtkblackoilpolymermodule.hh index 03a9ea78c..2fa0da136 100644 --- a/opm/models/io/vtkblackoilpolymermodule.hh +++ b/opm/models/io/vtkblackoilpolymermodule.hh @@ -46,14 +46,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOilPolymer); // create the property tags needed for the polymer output module -NEW_PROP_TAG(EnablePolymer); -NEW_PROP_TAG(EnableVtkOutput); -NEW_PROP_TAG(VtkWritePolymerConcentration); -NEW_PROP_TAG(VtkWritePolymerDeadPoreVolume); -NEW_PROP_TAG(VtkWritePolymerAdsorption); -NEW_PROP_TAG(VtkWritePolymerRockDensity); -NEW_PROP_TAG(VtkWritePolymerViscosityCorrection); -NEW_PROP_TAG(VtkWriteWaterViscosityCorrection); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOilPolymer, VtkWritePolymerConcentration, true); diff --git a/opm/models/io/vtkblackoilsolventmodule.hh b/opm/models/io/vtkblackoilsolventmodule.hh index cbdcd75fa..86a7d655d 100644 --- a/opm/models/io/vtkblackoilsolventmodule.hh +++ b/opm/models/io/vtkblackoilsolventmodule.hh @@ -46,12 +46,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOilSolvent); // create the property tags needed for the solvent output module -NEW_PROP_TAG(EnableSolvent); -NEW_PROP_TAG(EnableVtkOutput); -NEW_PROP_TAG(VtkWriteSolventSaturation); -NEW_PROP_TAG(VtkWriteSolventDensity); -NEW_PROP_TAG(VtkWriteSolventViscosity); -NEW_PROP_TAG(VtkWriteSolventMobility); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOilSolvent, VtkWriteSolventSaturation, true); diff --git a/opm/models/io/vtkcompositionmodule.hh b/opm/models/io/vtkcompositionmodule.hh index 172e53bdc..5ce2667e0 100644 --- a/opm/models/io/vtkcompositionmodule.hh +++ b/opm/models/io/vtkcompositionmodule.hh @@ -41,15 +41,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkComposition); // create the property tags needed for the composition module -NEW_PROP_TAG(VtkWriteMassFractions); -NEW_PROP_TAG(VtkWriteMoleFractions); -NEW_PROP_TAG(VtkWriteTotalMassFractions); -NEW_PROP_TAG(VtkWriteTotalMoleFractions); -NEW_PROP_TAG(VtkWriteMolarities); -NEW_PROP_TAG(VtkWriteFugacities); -NEW_PROP_TAG(VtkWriteFugacityCoeffs); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); // set default values for what quantities to output SET_BOOL_PROP(VtkComposition, VtkWriteMassFractions, false); diff --git a/opm/models/io/vtkdiffusionmodule.hh b/opm/models/io/vtkdiffusionmodule.hh index ac9d75c7c..2fb76eaf2 100644 --- a/opm/models/io/vtkdiffusionmodule.hh +++ b/opm/models/io/vtkdiffusionmodule.hh @@ -44,11 +44,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkDiffusion); // create the property tags needed for the diffusion module -NEW_PROP_TAG(VtkWriteTortuosities); -NEW_PROP_TAG(VtkWriteDiffusionCoefficients); -NEW_PROP_TAG(VtkWriteEffectiveDiffusionCoefficients); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); // set default values for what quantities to output SET_BOOL_PROP(VtkDiffusion, VtkWriteTortuosities, false); diff --git a/opm/models/io/vtkdiscretefracturemodule.hh b/opm/models/io/vtkdiscretefracturemodule.hh index bf4dc6188..dc5272fb8 100644 --- a/opm/models/io/vtkdiscretefracturemodule.hh +++ b/opm/models/io/vtkdiscretefracturemodule.hh @@ -45,17 +45,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkDiscreteFracture); // create the property tags needed for the multi phase module -NEW_PROP_TAG(Vanguard); -NEW_PROP_TAG(VtkWriteFractureSaturations); -NEW_PROP_TAG(VtkWriteFractureMobilities); -NEW_PROP_TAG(VtkWriteFractureRelativePermeabilities); -NEW_PROP_TAG(VtkWriteFracturePorosity); -NEW_PROP_TAG(VtkWriteFractureIntrinsicPermeabilities); -NEW_PROP_TAG(VtkWriteFractureFilterVelocities); -NEW_PROP_TAG(VtkWriteFractureVolumeFraction); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); -NEW_PROP_TAG(DiscBaseOutputModule); // set default values for what quantities to output SET_BOOL_PROP(VtkDiscreteFracture, VtkWriteFractureSaturations, true); diff --git a/opm/models/io/vtkenergymodule.hh b/opm/models/io/vtkenergymodule.hh index f0e6323c0..ae51310e4 100644 --- a/opm/models/io/vtkenergymodule.hh +++ b/opm/models/io/vtkenergymodule.hh @@ -41,12 +41,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkEnergy); // create the property tags needed for the energy module -NEW_PROP_TAG(VtkWriteSolidInternalEnergy); -NEW_PROP_TAG(VtkWriteThermalConductivity); -NEW_PROP_TAG(VtkWriteInternalEnergies); -NEW_PROP_TAG(VtkWriteEnthalpies); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); // set default values for what quantities to output SET_BOOL_PROP(VtkEnergy, VtkWriteSolidInternalEnergy, false); diff --git a/opm/models/io/vtkmultiphasemodule.hh b/opm/models/io/vtkmultiphasemodule.hh index 2cc4763b5..846a6a729 100644 --- a/opm/models/io/vtkmultiphasemodule.hh +++ b/opm/models/io/vtkmultiphasemodule.hh @@ -46,20 +46,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkMultiPhase); // create the property tags needed for the multi phase module -NEW_PROP_TAG(VtkWriteExtrusionFactor); -NEW_PROP_TAG(VtkWritePressures); -NEW_PROP_TAG(VtkWriteDensities); -NEW_PROP_TAG(VtkWriteSaturations); -NEW_PROP_TAG(VtkWriteMobilities); -NEW_PROP_TAG(VtkWriteRelativePermeabilities); -NEW_PROP_TAG(VtkWriteViscosities); -NEW_PROP_TAG(VtkWriteAverageMolarMasses); -NEW_PROP_TAG(VtkWritePorosity); -NEW_PROP_TAG(VtkWriteIntrinsicPermeabilities); -NEW_PROP_TAG(VtkWritePotentialGradients); -NEW_PROP_TAG(VtkWriteFilterVelocities); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); // set default values for what quantities to output SET_BOOL_PROP(VtkMultiPhase, VtkWriteExtrusionFactor, false); diff --git a/opm/models/io/vtkphasepresencemodule.hh b/opm/models/io/vtkphasepresencemodule.hh index 21bd832cc..d6b1a5c38 100644 --- a/opm/models/io/vtkphasepresencemodule.hh +++ b/opm/models/io/vtkphasepresencemodule.hh @@ -39,9 +39,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkPhasePresence); // create the property tags needed for the primary variables module -NEW_PROP_TAG(VtkWritePhasePresence); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); SET_BOOL_PROP(VtkPhasePresence, VtkWritePhasePresence, false); diff --git a/opm/models/io/vtkprimaryvarsmodule.hh b/opm/models/io/vtkprimaryvarsmodule.hh index bace701ba..b4a06d9ec 100644 --- a/opm/models/io/vtkprimaryvarsmodule.hh +++ b/opm/models/io/vtkprimaryvarsmodule.hh @@ -36,15 +36,9 @@ BEGIN_PROPERTIES // create new type tag for the VTK primary variables output -NEW_PROP_TAG(EnableVtkOutput); NEW_TYPE_TAG(VtkPrimaryVars); // create the property tags needed for the primary variables module -NEW_PROP_TAG(VtkWritePrimaryVars); -NEW_PROP_TAG(VtkWriteProcessRank); -NEW_PROP_TAG(VtkWriteDofIndex); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); SET_BOOL_PROP(VtkPrimaryVars, VtkWritePrimaryVars, false); SET_BOOL_PROP(VtkPrimaryVars, VtkWriteProcessRank, false); diff --git a/opm/models/io/vtktemperaturemodule.hh b/opm/models/io/vtktemperaturemodule.hh index ed9d7e9b0..f0db69258 100644 --- a/opm/models/io/vtktemperaturemodule.hh +++ b/opm/models/io/vtktemperaturemodule.hh @@ -41,9 +41,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkTemperature); // create the property tags needed for the temperature module -NEW_PROP_TAG(VtkWriteTemperature); -NEW_PROP_TAG(VtkOutputFormat); -NEW_PROP_TAG(EnableVtkOutput); // set default values for what quantities to output SET_BOOL_PROP(VtkTemperature, VtkWriteTemperature, true); diff --git a/opm/models/ncp/ncpproperties.hh b/opm/models/ncp/ncpproperties.hh index bd49ae6c0..181c7fd02 100644 --- a/opm/models/ncp/ncpproperties.hh +++ b/opm/models/ncp/ncpproperties.hh @@ -38,21 +38,15 @@ BEGIN_PROPERTIES //! Enable the energy equation? -NEW_PROP_TAG(EnableEnergy); //! Enable diffusive fluxes? -NEW_PROP_TAG(EnableDiffusion); //! The unmodified weight for the pressure primary variable -NEW_PROP_TAG(NcpPressureBaseWeight); //! The weight for the saturation primary variables -NEW_PROP_TAG(NcpSaturationsBaseWeight); //! The unmodified weight for the fugacity primary variables -NEW_PROP_TAG(NcpFugacitiesBaseWeight); //! The themodynamic constraint solver which calculates the //! composition of any phase given all component fugacities. -NEW_PROP_TAG(NcpCompositionFromFugacitiesSolver); END_PROPERTIES diff --git a/opm/models/nonlinear/newtonmethod.hh b/opm/models/nonlinear/newtonmethod.hh index 27649c11d..b8450bbe7 100644 --- a/opm/models/nonlinear/newtonmethod.hh +++ b/opm/models/nonlinear/newtonmethod.hh @@ -66,60 +66,42 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(NewtonMethod); //! The simulation management class of the simulation -NEW_PROP_TAG(Simulator); //! The physical model which we would like to solve -NEW_PROP_TAG(Problem); //! The model describing the PDEs for the conservation quantities -NEW_PROP_TAG(Model); //! The type of scalar values -NEW_PROP_TAG(Scalar); //! Specifies the type of the actual Newton method -NEW_PROP_TAG(NewtonMethod); //! Specifies the type of a solution -NEW_PROP_TAG(SolutionVector); //! Specifies the type of a solution for a single degee of freedom -NEW_PROP_TAG(PrimaryVariables); //! Specifies whether the problem to be simulated exhibits contraint degrees of freedom -NEW_PROP_TAG(EnableConstraints); //! Specifies the type of objects which specify constraints for a single degee of freedom -NEW_PROP_TAG(Constraints); //! Vector containing a quantity of for equation on the whole grid -NEW_PROP_TAG(GlobalEqVector); //! Vector containing a quantity of for equation for a single degee of freedom -NEW_PROP_TAG(EqVector); //! The class which linearizes the non-linear system of equations -NEW_PROP_TAG(Linearizer); //! Specifies the type of a global Jacobian matrix -NEW_PROP_TAG(SparseMatrixAdapter); //! Specifies the type of the linear solver to be used -NEW_PROP_TAG(LinearSolverBackend); //! Specifies whether the Newton method should print messages or not -NEW_PROP_TAG(NewtonVerbose); //! Specifies the type of the class which writes out the Newton convergence -NEW_PROP_TAG(NewtonConvergenceWriter); //! Specifies whether the convergence rate and the global residual //! gets written out to disk for every Newton iteration -NEW_PROP_TAG(NewtonWriteConvergence); //! Specifies whether the convergence rate and the global residual //! gets written out to disk for every Newton iteration -NEW_PROP_TAG(ConvergenceWriter); /*! * \brief The value for the error below which convergence is declared @@ -127,11 +109,9 @@ NEW_PROP_TAG(ConvergenceWriter); * This value can (and for the porous media models will) be changed to account for grid * scaling and other effects. */ -NEW_PROP_TAG(NewtonTolerance); //! The maximum error which may occur in a simulation before the //! Newton method for the time step is aborted -NEW_PROP_TAG(NewtonMaxError); /*! * \brief The number of iterations at which the Newton method @@ -141,10 +121,8 @@ NEW_PROP_TAG(NewtonMaxError); * is to scale the last time-step size by the deviation of the * number of iterations used from the target steps. */ -NEW_PROP_TAG(NewtonTargetIterations); //! Number of maximum iterations for the Newton method. -NEW_PROP_TAG(NewtonMaxIterations); // set default values for the properties SET_TYPE_PROP(NewtonMethod, NewtonMethod, Opm::NewtonMethod); diff --git a/opm/models/nonlinear/nullconvergencewriter.hh b/opm/models/nonlinear/nullconvergencewriter.hh index b58377801..5da6caa4e 100644 --- a/opm/models/nonlinear/nullconvergencewriter.hh +++ b/opm/models/nonlinear/nullconvergencewriter.hh @@ -34,10 +34,7 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(NewtonMethod); -NEW_PROP_TAG(SolutionVector); -NEW_PROP_TAG(GlobalEqVector); END_PROPERTIES diff --git a/opm/models/parallel/threadmanager.hh b/opm/models/parallel/threadmanager.hh index 7f89df0c2..967831d5b 100644 --- a/opm/models/parallel/threadmanager.hh +++ b/opm/models/parallel/threadmanager.hh @@ -40,7 +40,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(ThreadsPerProcess); END_PROPERTIES @@ -127,6 +126,10 @@ private: static int numThreads_; }; +namespace Properties { + SET_TYPE_PROP(NumericModel, ThreadManager, Opm::ThreadManager); +} + template int ThreadManager::numThreads_ = 1; } // namespace Opm diff --git a/opm/models/pvs/pvsproperties.hh b/opm/models/pvs/pvsproperties.hh index 7bcb183dc..10193b80c 100644 --- a/opm/models/pvs/pvsproperties.hh +++ b/opm/models/pvs/pvsproperties.hh @@ -41,18 +41,12 @@ BEGIN_PROPERTIES //! Specifies whether energy is considered as a conservation quantity or not -NEW_PROP_TAG(EnableEnergy); //! Enable diffusive fluxes? -NEW_PROP_TAG(EnableDiffusion); //! The verbosity of the model (0 -> do not print anything, 2 -> spam stdout a lot) -NEW_PROP_TAG(PvsVerbosity); //! The basis value for the weight of the pressure primary variable -NEW_PROP_TAG(PvsPressureBaseWeight); //! The basis value for the weight of the saturation primary variables -NEW_PROP_TAG(PvsSaturationsBaseWeight); //! The basis value for the weight of the mole fraction primary variables -NEW_PROP_TAG(PvsMoleFractionsBaseWeight); END_PROPERTIES diff --git a/opm/models/richards/richardsproperties.hh b/opm/models/richards/richardsproperties.hh index 424a11cc8..ac88d0e04 100644 --- a/opm/models/richards/richardsproperties.hh +++ b/opm/models/richards/richardsproperties.hh @@ -35,27 +35,20 @@ BEGIN_PROPERTIES //! The fluid system used for the problem -NEW_PROP_TAG(FluidSystem); //! The fluid used as the wetting phase (by default, we set the fluid //! system to the immiscible one, which requires this property.) -NEW_PROP_TAG(WettingFluid); //! The fluid used as the non-wetting phase (by default, we set the //! fluid system to the immiscible one, which requires this property.) -NEW_PROP_TAG(NonWettingFluid); //! Index of the fluid which represents the wetting phase -NEW_PROP_TAG(LiquidPhaseIndex); //! Index of the fluid which represents the non-wetting phase -NEW_PROP_TAG(GasPhaseIndex); //! Index of the component which constitutes the liquid -NEW_PROP_TAG(LiquidComponentIndex); //! Index of the component which constitutes the gas -NEW_PROP_TAG(GasComponentIndex); // \} diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 2eb64d5a9..019218ef6 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -30,9 +30,23 @@ #include +// explicitly guard the include so that the property system +// header doesn't need to be opened and checked all the time +#ifndef OPM_PROPERTY_SYSTEM_HH #include + +// remove this after release 3.1 to disable macros per default +#ifndef OPM_ENABLE_OLD_PROPERTY_MACROS +#define OPM_ENABLE_OLD_PROPERTY_MACROS 1 +#endif + +// remove this after release 3.2 to remove macros completely +#if OPM_ENABLE_OLD_PROPERTY_MACROS +#include +#endif // OPM_ENABLE_OLD_PROPERTY_MACROS +#endif // OPM_PROPERTY_SYSTEM_HH + #include -#include #if HAVE_DUNE_FEM #include @@ -50,6 +64,7 @@ BEGIN_PROPERTIES // +-> ImplicitModel /////////////////////////////////// +NEW_TYPE_TAG(ParameterSystem); //! Type tag for all models. NEW_TYPE_TAG(NumericModel, INHERITS_FROM(ParameterSystem)); @@ -76,10 +91,238 @@ NEW_PROP_TAG(Vanguard); NEW_PROP_TAG(GridView); +NEW_PROP_TAG(Simulator); +NEW_PROP_TAG(Grid); +NEW_PROP_TAG(GridFile); +NEW_PROP_TAG(Model); +NEW_PROP_TAG(Problem); +NEW_PROP_TAG(ThreadManager); +NEW_PROP_TAG(NewtonMethod); +NEW_PROP_TAG(SolutionVector); +NEW_PROP_TAG(GlobalEqVector); +NEW_PROP_TAG(VtkOutputFormat); + +//! Specifies the type of a solution for a single degee of freedom +NEW_PROP_TAG(PrimaryVariables); + +//! Specifies whether the problem to be simulated exhibits contraint degrees of freedom +NEW_PROP_TAG(EnableConstraints); + +//! Specifies the type of objects which specify constraints for a single degee of freedom +NEW_PROP_TAG(Constraints); + +//! Vector containing a quantity of for equation for a single degee of freedom +NEW_PROP_TAG(EqVector); + +//! The class which linearizes the non-linear system of equations +NEW_PROP_TAG(Linearizer); + +//! Specifies the type of a global Jacobian matrix +NEW_PROP_TAG(SparseMatrixAdapter); + +//! Specifies the type of the linear solver to be used +NEW_PROP_TAG(LinearSolverBackend); + +//! Specifies whether the Newton method should print messages or not +NEW_PROP_TAG(NewtonVerbose); + +//! Specifies the type of the class which writes out the Newton convergence +NEW_PROP_TAG(NewtonConvergenceWriter); + +//! Specifies whether the convergence rate and the global residual +//! gets written out to disk for every Newton iteration +NEW_PROP_TAG(NewtonWriteConvergence); + +//! Specifies whether the convergence rate and the global residual +//! gets written out to disk for every Newton iteration +NEW_PROP_TAG(ConvergenceWriter); + +/*! + * \brief The value for the error below which convergence is declared + * + * This value can (and for the porous media models will) be changed to account for grid + * scaling and other effects. + */ +NEW_PROP_TAG(NewtonTolerance); + +//! The maximum error which may occur in a simulation before the +//! Newton method for the time step is aborted +NEW_PROP_TAG(NewtonMaxError); + +/*! + * \brief The number of iterations at which the Newton method + * should aim at. + * + * This is used to control the time-step size. The heuristic used + * is to scale the last time-step size by the deviation of the + * number of iterations used from the target steps. + */ +NEW_PROP_TAG(NewtonTargetIterations); + +//! Number of maximum iterations for the Newton method. +NEW_PROP_TAG(NewtonMaxIterations); + + + #if HAVE_DUNE_FEM NEW_PROP_TAG(GridPart); #endif +NEW_PROP_TAG(LocalLinearizer); +NEW_PROP_TAG(Evaluation); +NEW_PROP_TAG(NumericDifferenceMethod); +NEW_PROP_TAG(BaseEpsilon); +NEW_PROP_TAG(LocalResidual); +NEW_PROP_TAG(ElementContext); + +NEW_PROP_TAG(NumPhases); +NEW_PROP_TAG(NumComponents); +NEW_PROP_TAG(NumEq); +NEW_PROP_TAG(FluidSystem); +NEW_PROP_TAG(DiscBaseOutputModule); + +// create new type tag for the VTK primary variables output +NEW_PROP_TAG(EnableVtkOutput); + +// create the property tags needed for the primary variables module +NEW_PROP_TAG(VtkWritePrimaryVars); +NEW_PROP_TAG(VtkWriteProcessRank); +NEW_PROP_TAG(VtkWriteDofIndex); +NEW_PROP_TAG(VtkWriteExtrusionFactor); +NEW_PROP_TAG(VtkWritePressures); +NEW_PROP_TAG(VtkWriteDensities); +NEW_PROP_TAG(VtkWriteSaturations); +NEW_PROP_TAG(VtkWriteMobilities); +NEW_PROP_TAG(VtkWriteRelativePermeabilities); +NEW_PROP_TAG(VtkWriteViscosities); +NEW_PROP_TAG(VtkWriteAverageMolarMasses); +NEW_PROP_TAG(VtkWritePorosity); +NEW_PROP_TAG(VtkWriteIntrinsicPermeabilities); +NEW_PROP_TAG(VtkWritePotentialGradients); +NEW_PROP_TAG(VtkWriteFilterVelocities); +NEW_PROP_TAG(VtkWriteTemperature); +NEW_PROP_TAG(VtkWriteSolidInternalEnergy); +NEW_PROP_TAG(VtkWriteThermalConductivity); +NEW_PROP_TAG(VtkWriteInternalEnergies); +NEW_PROP_TAG(VtkWriteEnthalpies); +NEW_PROP_TAG(IntensiveQuantities); + +NEW_PROP_TAG(BoundaryContext); +NEW_PROP_TAG(BoundaryRateVector); +NEW_PROP_TAG(CellsX); +NEW_PROP_TAG(CellsY); +NEW_PROP_TAG(CellsZ); +NEW_PROP_TAG(ContinueOnConvergenceError); +NEW_PROP_TAG(DiscExtensiveQuantities); +NEW_PROP_TAG(DiscIntensiveQuantities); +NEW_PROP_TAG(DiscLocalResidual); +NEW_PROP_TAG(Discretization); +NEW_PROP_TAG(DofMapper); +NEW_PROP_TAG(DomainSizeX); +NEW_PROP_TAG(DomainSizeY); +NEW_PROP_TAG(DomainSizeZ); +NEW_PROP_TAG(ElementMapper); +NEW_PROP_TAG(EnableAsyncVtkOutput); +NEW_PROP_TAG(EnableEnergy); +NEW_PROP_TAG(EnableGravity); +NEW_PROP_TAG(EnableGridAdaptation); +NEW_PROP_TAG(EnableStorageCache); +NEW_PROP_TAG(ExtensiveQuantities); +NEW_PROP_TAG(ExtensiveStorageTerm); +NEW_PROP_TAG(Fluid); +NEW_PROP_TAG(FluxModule); +NEW_PROP_TAG(GradientCalculator); +NEW_PROP_TAG(GridCommHandleFactory); +NEW_PROP_TAG(Indices); +NEW_PROP_TAG(LinearizeNonLocalElements); +NEW_PROP_TAG(MaterialLaw); +NEW_PROP_TAG(MaterialLawParams); +NEW_PROP_TAG(MaxTimeStepDivisions); +NEW_PROP_TAG(MaxTimeStepSize); +NEW_PROP_TAG(MinTimeStepSize); +NEW_PROP_TAG(OutputDir); +NEW_PROP_TAG(RateVector); +NEW_PROP_TAG(SolidEnergyLaw); +NEW_PROP_TAG(Stencil); +NEW_PROP_TAG(ThermalConductionLaw); +NEW_PROP_TAG(ThreadsPerProcess); +NEW_PROP_TAG(TimeDiscHistorySize); +NEW_PROP_TAG(UseLinearizationLock); +NEW_PROP_TAG(UseP1FiniteElementGradients); +NEW_PROP_TAG(UseVolumetricResidual); +NEW_PROP_TAG(VertexMapper); +NEW_PROP_TAG(SolidEnergyLawParams); +NEW_PROP_TAG(ThermalConductionLawParams); + +NEW_PROP_TAG(BaseProblem); +NEW_PROP_TAG(ConstraintsContext); +NEW_PROP_TAG(ElementEqVector); +NEW_PROP_TAG(EnableExperiments); +NEW_PROP_TAG(EnableIntensiveQuantityCache); +NEW_PROP_TAG(EnableThermodynamicHints); +NEW_PROP_TAG(NonwettingPhase); +NEW_PROP_TAG(SpatialDiscretizationSplice); +NEW_PROP_TAG(WettingPhase); + +NEW_PROP_TAG(OverlappingMatrix); +NEW_PROP_TAG(OverlappingVector); +NEW_PROP_TAG(PreconditionerOrder); +NEW_PROP_TAG(PreconditionerRelaxation); + +NEW_PROP_TAG(AmgCoarsenTarget); + +NEW_PROP_TAG(BorderListCreator); +NEW_PROP_TAG(Overlap); +NEW_PROP_TAG(OverlappingScalarProduct); +NEW_PROP_TAG(OverlappingLinearOperator); + + +//! the preconditioner used by the linear solver +NEW_PROP_TAG(PreconditionerWrapper); + + +//! The floating point type used internally by the linear solver +NEW_PROP_TAG(LinearSolverScalar); + +/*! + * \brief The size of the algebraic overlap of the linear solver. + * + * Algebraic overlaps can be thought as being the same as the overlap + * of a grid, but it is only existant for the linear system of + * equations. + */ +NEW_PROP_TAG(LinearSolverOverlapSize); + +/*! + * \brief Maximum accepted error of the solution of the linear solver. + */ +NEW_PROP_TAG(LinearSolverTolerance); + +/*! + * \brief Maximum accepted error of the norm of the residual. + */ +NEW_PROP_TAG(LinearSolverAbsTolerance); + +/*! + * \brief Specifies the verbosity of the linear solver + * + * By default it is 0, i.e. it doesn't print anything. Setting this + * property to 1 prints aggregated convergence rates, 2 prints the + * convergence rate of every iteration of the scheme. + */ +NEW_PROP_TAG(LinearSolverVerbosity); + +//! Maximum number of iterations eyecuted by the linear solver +NEW_PROP_TAG(LinearSolverMaxIterations); + +NEW_PROP_TAG(LinearSolverMaxError); + +NEW_PROP_TAG(LinearSolverSplice); +NEW_PROP_TAG(LocalLinearizerSplice); + +//! The discretization specific part of he implementing the Newton algorithm +NEW_PROP_TAG(DiscNewtonMethod); + //! Property which tells the Vanguard how often the grid should be refined //! after creation. NEW_PROP_TAG(GridGlobalRefinements); @@ -116,6 +359,8 @@ NEW_PROP_TAG(RestartTime); //! The name of the file with a number of forced time step lengths NEW_PROP_TAG(PredeterminedTimeStepsFile); +NEW_PROP_TAG(ParameterMetaData); + /////////////////////////////////// // Values for the properties /////////////////////////////////// @@ -138,8 +383,6 @@ SET_PROP(NumericModel, ParameterTree) //! use the global group as default for the model's parameter group SET_STRING_PROP(NumericModel, ModelParameterGroup, ""); -//! Use the DgfVanguard by default -SET_TYPE_PROP(NumericModel, Vanguard, Opm::DgfVanguard); //! Set a value for the GridFile property SET_STRING_PROP(NumericModel, GridFile, ""); diff --git a/opm/models/utils/parametersystem.hh b/opm/models/utils/parametersystem.hh index a1f5f6af0..0c7c6ef08 100644 --- a/opm/models/utils/parametersystem.hh +++ b/opm/models/utils/parametersystem.hh @@ -32,7 +32,7 @@ #ifndef EWOMS_PARAMETER_SYSTEM_HH #define EWOMS_PARAMETER_SYSTEM_HH -#include +#include #include #include @@ -74,8 +74,8 @@ * \endcode */ #define EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description) \ - ::Opm::Parameters::registerParam( \ - #ParamName, #ParamName, Description) + ::Opm::Parameters::registerParam( \ + #ParamName, #ParamName, GET_PROP_VALUE(TypeTag, ParamName), Description) /*! * \ingroup Parameter @@ -85,7 +85,7 @@ * This allows to deal with unused parameters */ #define EWOMS_HIDE_PARAM(TypeTag, ParamName) \ - ::Opm::Parameters::hideParam(#ParamName) + ::Opm::Parameters::hideParam(#ParamName) /*! * \ingroup Parameter @@ -115,14 +115,14 @@ * \endcode */ #define EWOMS_GET_PARAM(TypeTag, ParamType, ParamName) \ - (::Opm::Parameters::get(#ParamName, \ - #ParamName)) + (::Opm::Parameters::get(#ParamName, \ + GET_PROP_VALUE(TypeTag, ParamName))) //!\cond SKIP_THIS #define EWOMS_GET_PARAM_(TypeTag, ParamType, ParamName) \ - (::Opm::Parameters::get( \ - #ParamName, #ParamName, \ - /*errorIfNotRegistered=*/false)) + (::Opm::Parameters::get(#ParamName, \ + GET_PROP_VALUE(TypeTag, ParamName), \ + /*errorIfNotRegistered=*/false)) /*! * \ingroup Parameter @@ -148,7 +148,7 @@ * If the parameter in question has not been registered, this throws an exception. */ #define EWOMS_PARAM_IS_SET(TypeTag, ParamType, ParamName) \ - (::Opm::Parameters::isSet(#ParamName, \ + (::Opm::Parameters::isSet(#ParamName, \ #ParamName)) namespace Opm { @@ -180,6 +180,10 @@ template const ParamType get(const char *propTagName, const char *paramName, bool errorIfNotRegistered = true); +template +const ParamType get(const char *paramName, + const ParamType& defaultValue, + bool errorIfNotRegistered = true); class ParamRegFinalizerBase_ { @@ -189,12 +193,13 @@ public: virtual void retrieve() = 0; }; -template +template class ParamRegFinalizer_ : public ParamRegFinalizerBase_ { public: - ParamRegFinalizer_(const std::string& paramName) + ParamRegFinalizer_(const std::string& paramName, const ParamType& defaultValue) : paramName_(paramName) + , defaultValue_(defaultValue) {} virtual void retrieve() override @@ -202,13 +207,14 @@ public: // retrieve the parameter once to make sure that its value does // not contain a syntax error. ParamType __attribute__((unused)) dummy = - get(/*propTagName=*/paramName_.data(), - paramName_.data(), - /*errorIfNotRegistered=*/true); + get(paramName_.data(), + defaultValue_, + /*errorIfNotRegistered=*/true); } private: std::string paramName_; + ParamType defaultValue_; }; } // namespace Parameters @@ -218,9 +224,8 @@ BEGIN_PROPERTIES // type tag which is supposed to spliced in or inherited from if the // parameter system is to be used -NEW_TYPE_TAG(ParameterSystem); +//NEW_TYPE_TAG(ParameterSystem); -NEW_PROP_TAG(ParameterMetaData); //! Set the ParameterMetaData property @@ -943,15 +948,21 @@ class Param public: template - static const ParamType get(const char *propTagName, - const char *paramName, - bool errorIfNotRegistered = true) + static ParamType get(const char *propTagName, + const char *paramName, + bool errorIfNotRegistered = true) { - return retrieve_(propTagName, - paramName, - errorIfNotRegistered); + return retrieve_(paramName, getPropValue(), errorIfNotRegistered); } - + + template + static ParamType get(const char *paramName, + const ParamType& defaultValue, + bool errorIfNotRegistered = true) + { + return retrieve_(paramName, defaultValue, errorIfNotRegistered); + } + static void clear() { ParamsMeta::clear(); @@ -1035,10 +1046,10 @@ private: } } - template - static const ParamType retrieve_(const char OPM_OPTIM_UNUSED *propTagName, - const char *paramName, - bool errorIfNotRegistered = true) + template + static ParamType retrieve_(const char *paramName, + const ParamType& defaultValue, + bool errorIfNotRegistered = true) { #ifndef NDEBUG // make sure that the parameter is used consistently. since @@ -1066,8 +1077,7 @@ private: std::string canonicalName(paramName); // retrieve actual parameter from the parameter tree - const ParamType defaultValue = GET_PROP_VALUE_(TypeTag, PropTag); - return ParamsMeta::tree().template get(canonicalName, defaultValue ); + return ParamsMeta::tree().template get(canonicalName, defaultValue); } }; @@ -1079,6 +1089,12 @@ const ParamType get(const char *propTagName, const char *paramName, bool errorIf errorIfNotRegistered); } +template +const ParamType get(const char *paramName, const ParamType& defaultValue, bool errorIfNotRegistered) +{ + return Param::template get(paramName, defaultValue, errorIfNotRegistered); +} + template void getLists(Container& usedParams, Container& unusedParams) { @@ -1121,8 +1137,8 @@ bool isSet(const char *propTagName, const char *paramName, bool errorIfNotRegist errorIfNotRegistered); } -template -void registerParam(const char *paramName, const char *propertyName, const char *usageString) +template +void registerParam(const char *paramName, const char *propertyName, const ParamType& defaultValue, const char *usageString) { typedef typename GET_PROP(TypeTag, ParameterMetaData) ParamsMeta; if (!ParamsMeta::registrationOpen()) @@ -1130,7 +1146,7 @@ void registerParam(const char *paramName, const char *propertyName, const char * "the parameter '"+std::string(paramName)+"' was registered."); ParamsMeta::registrationFinalizers().emplace_back( - new ParamRegFinalizer_(paramName)); + new ParamRegFinalizer_(paramName, defaultValue)); ParamInfo paramInfo; paramInfo.paramName = paramName; @@ -1140,7 +1156,7 @@ void registerParam(const char *paramName, const char *propertyName, const char * paramInfo.propertyName = propertyName; paramInfo.usageString = usageString; std::ostringstream oss; - oss << GET_PROP_VALUE_(TypeTag, PropTag); + oss << defaultValue; paramInfo.compileTimeValue = oss.str(); paramInfo.isHidden = false; if (ParamsMeta::registry().find(paramName) != ParamsMeta::registry().end()) { @@ -1160,7 +1176,7 @@ void hideParam(const char *paramName) { // make sure that a property with the parameter name exists. we cannot check if a // parameter exists at compile time, so this will only be caught at runtime - static const auto defaultValue OPM_UNUSED = GET_PROP_VALUE_(TypeTag, PropTag); + static const auto defaultValue OPM_UNUSED = getPropValue; typedef typename GET_PROP(TypeTag, ParameterMetaData) ParamsMeta; if (!ParamsMeta::registrationOpen()) diff --git a/opm/models/utils/propertysystem.hh b/opm/models/utils/propertysystem.hh index a6a3368ed..c7bb4aaa6 100644 --- a/opm/models/utils/propertysystem.hh +++ b/opm/models/utils/propertysystem.hh @@ -1,132 +1,171 @@ // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: -/* - This file is part of the Open Porous Media project (OPM). - - OPM is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - OPM is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OPM. If not, see . - - Consult the COPYING file in the top-level source directory of this - module for the precise wording of the license and the list of - copyright holders. -*/ +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *****************************************************************************/ /*! * \file - * \brief Provides the magic behind the eWoms property system. - * - * Properties allow to associate arbitrary data types to - * identifiers. A property is always defined on a pair (\c TypeTag, - * \c PropertyTag) where \c TypeTag is the identifier for the object the - * property is defined for and \c PropertyTag is an unique identifier of - * the property. - * - * Type tags are hierarchic and inherit properties defined on their - * ancesters. At each level, properties defined on lower levels can be - * overwritten or even made undefined. - * - * Properties may use other properties for the respective type tag and - * these properties can also be defined on an arbitrary level of the - * hierarchy. The only restriction on this is that cycles are not - * allowed when defining properties. + * \ingroup Properties + * \ingroup TypeTraits + * \author Timo Koch + * \brief The Opm property system, traits with inheritance */ -#ifndef EWOMS_PROPERTIES_HH -#define EWOMS_PROPERTIES_HH +#ifndef OPM_PROPERTY_SYSTEM_HH +#define OPM_PROPERTY_SYSTEM_HH -#include -#include - -#include - -#include // required for 'is_base_of' -#include -#include -#include -#include -#include -#include -#include #include -#include - -//! \cond SKIP_THIS +#include +#include namespace Opm { namespace Properties { -#define EWOMS_GET_HEAD_(Arg1, ...) Arg1 +//! a tag to mark properties as undefined +struct UndefinedProperty {}; -#if !defined NO_PROPERTY_INTROSPECTION +//! implementation details for template meta programming +namespace Detail { -//! Internal macro which is only required if the property introspection is enabled -#define PROP_INFO_(EffTypeTagName, PropKind, PropTagName, ...) \ - template <> \ - struct PropertyInfo \ - { \ - static int init() { \ - PropertyRegistryKey key( \ - /*effTypeTagName=*/ Dune::className(), \ - /*kind=*/PropKind, \ - /*name=*/propertyName(), \ - /*value=*/#__VA_ARGS__, \ - /*file=*/__FILE__, \ - /*line=*/__LINE__); \ - PropertyRegistry::addKey(key); \ - return 0; \ - } \ - static std::string propertyName() { return #PropTagName; } \ - }; \ - namespace fooPropInfo_ ## EffTypeTagName { \ - static const int foo_ ## PropTagName OPM_UNUSED = \ - PropertyInfo::init(); \ - } +//! check if a property P is defined +template +constexpr auto isDefinedProperty(int) +-> decltype(std::integral_constant::value>{}) +{ return {}; } +//! fall back if a Property is defined +template +constexpr std::true_type isDefinedProperty(...) { return {}; } -//! Internal macro which is only required if the property introspection is enabled -#define TTAG_INFO_(TagName, ...) \ - template <> \ - struct TypeTagInfo \ - { \ - static int init() { \ - TypeTagRegistry::addAllChildren(); \ - return 0; \ - } \ - }; \ - static const int fooTypeTagInfo_ ## TagName OPM_UNUSED = \ - TypeTagInfo::init(); +//! check if a TypeTag inherits from other TypeTags +//! the enable_if portion of decltype is only needed for the macro hack to work, if no macros are in use anymore it can be removed, +//! i.e. then trailing return type is then -> decltype(std::declval(), std::true_type{}) +template +constexpr auto hasParentTypeTag(int) +-> decltype(std::declval(), std::enable_if_t::value, int>{}, std::true_type{}) +{ return {}; } -//! Internal macro which is only required if the property introspection is enabled -#define SPLICE_INFO_(SpliceName, ...) \ - template <> \ - struct SpliceInfo \ - { \ - static int init() { \ - TypeTagRegistry::addAllSplices(); \ - return 0; \ - } \ - }; \ - static const int fooSpliceInfo_ ## SpliceName OPM_UNUSED = \ - SpliceInfo::init(); +//! fall back if a TypeTag doesn't inherit +template +constexpr std::false_type hasParentTypeTag(...) { return {}; } -#else -//! Don't do anything if introspection is disabled -#define PROP_INFO_(EffTypeTagName, PropKind, PropTagName, ...) -#define TTAG_INFO_(EffTypeTagName, ...) -#define SPLICE_INFO_(EffTypeTagName, ...) +//! helper alias to concatenate multiple tuples +template +using ConCatTuples = decltype(std::tuple_cat(std::declval()...)); + +//! helper struct to get the first property that is defined in the TypeTag hierarchy +template class Property, class TTagList> +struct GetDefined; + +//! helper struct to iteratre over the TypeTag hierarchy +template class Property, class TTagList, class Enable> +struct GetNextTypeTag; + +template class Property, class LastTypeTag> +struct GetNextTypeTag, std::enable_if_t(int{}), void>> +{ using type = typename GetDefined::type; }; + +template class Property, class LastTypeTag> +struct GetNextTypeTag, std::enable_if_t(int{}), void>> +{ using type = UndefinedProperty; }; + +template class Property, class FirstTypeTag, class ...Args> +struct GetNextTypeTag, std::enable_if_t(int{}), void>> +{ using type = typename GetDefined>>::type; }; + +template class Property, class FirstTypeTag, class ...Args> +struct GetNextTypeTag, std::enable_if_t(int{}), void>> +{ using type = typename GetDefined>::type; }; + +template class Property, class LastTypeTag> +struct GetDefined> +{ +// For clang, the following alias triggers compiler warnings if instantiated +// from something like `GetPropType<..., DeprecatedProperty>`, even if that is +// contained in a diagnostic pragma construct that should prevent these warnings. +// As a workaround, also add the pragmas around this line. +// See the discussion in MR 1647 for more details. +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + using LastType = Property; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + using type = std::conditional_t(int{}), LastType, + typename GetNextTypeTag, void>::type>; +}; + +template class Property, class FirstTypeTag, class ...Args> +struct GetDefined> +{ +// See the comment above. +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + using FirstType = Property; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + using type = std::conditional_t(int{}), FirstType, + typename GetNextTypeTag, void>::type>; +}; + +//! helper struct to extract get the Property specilization given a TypeTag, asserts that the property is defined +template class Property> +struct GetPropImpl +{ + using type = typename Detail::GetDefined>::type; + static_assert(!std::is_same::value, "Property is undefined!"); +}; + +} // end namespace Detail +} // end namespace Property + +//! get the type of a property (equivalent to old macro GET_PROP(...)) +template class Property> +using GetProp = typename Properties::Detail::GetPropImpl::type; + +// See the comment above. +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif +//! get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(...)) +template class Property> +using GetPropType = typename Properties::Detail::GetPropImpl::type::type; + +//! get the value data member of a property +template class Property> +constexpr auto getPropValue() { return Properties::Detail::GetPropImpl::type::value; } +#ifdef __clang__ +#pragma clang diagnostic pop #endif -// some macros for simplification - -//! \endcond +namespace Properties { +template +void printValues(std::ostream& os = std::cout) +{ + os << + "The eWoms property system was compiled with the macro\n" + "NO_PROPERTY_INTROSPECTION defined.\n" + "No diagnostic messages this time, sorry.\n"; +} +} /*! * \ingroup Properties @@ -140,1070 +179,6 @@ namespace Properties { */ #define END_PROPERTIES }} -/*! - * \ingroup Properties - * \brief Convert a type tag name to a type - * - * The main advantage of the type of a \c TypeTag is that it can be - * passed as a template argument. - */ -#define TTAG(TypeTagName) Opm::Properties::TTag::TypeTagName - -/*! - * \ingroup Properties - * \brief Makes a type out of a property tag name - * - * Again property type names can be passed as template argument. This - * is rarely needed, though. - */ -#define PTAG(PropTagName) Opm::Properties::PTag::PropTagName - -/*! - * \ingroup Properties - * \brief Define a new type tag. - * - * A type tag can inherit the properties defined on up to five parent - * type tags. Examples: - * - * \code - * // The type tag doesn't inherit any properties from other type tags - * NEW_TYPE_TAG(FooTypeTag); - * - * // BarTypeTag inherits all properties from FooTypeTag - * NEW_TYPE_TAG(BarTypeTag, INHERITS_FROM(FooTypeTag)); - * - * // FooBarTypeTag inherits the properties of FooTypeTag as well as - * // those of BarTypeTag. Properties defined on BarTypeTag have - * // preceedence over those defined for FooTypeTag: - * NEW_TYPE_TAG(FooBarTypeTag, INHERITS_FROM(FooTypeTag, BarTypeTag)); - * \endcode - */ -#define NEW_TYPE_TAG(...) \ - namespace TTag { \ - struct EWOMS_GET_HEAD_(__VA_ARGS__, dontcare) \ - : public TypeTag<__VA_ARGS__> \ - { }; \ - TTAG_INFO_(__VA_ARGS__, void) \ - } \ - extern int semicolonHack_ - -/*! - * \ingroup Properties - * \brief Define splices for a given type tag. - * - * Splices can be seen as children which can be overridden lower in - * the hierarchy. It can thus be seen as a "deferred inheritance" - * mechanism. Example: - * - * \code - * // First, define type tags for two different linear solvers: - * // BiCGStab and SuperLU. The first needs the "MaxIterations" - * // property, the second defines the "UsePivoting" property. - * NEW_TYPE_TAG(BiCGStabSolver); - * NEW_PROP_TAG(MaxIterations); - * SET_INT_PROP(BiCGStabSolver, MaxIterations, 100); - * - * NEW_TYPE_TAG(SuperLUSolver); - * NEW_PROP_TAG(UsePivoting); - * SET_BOOL_PROP(SuperLUSolver, UsePivoting, true); - * - * // The model type tag defines the splice 'LinearSolver' and sets it - * // to the 'BiCGStabSolver' type tag. - * NEW_TYPE_TAG(ModelTypeTag); - * NEW_PROP_TAG(LinearSolver); - * SET_SPLICES(ModelTypeTag, LinearSolver); - * SET_TAG_PROP(ModelTypeTag, LinearSolver, BiCGStabSolver); - * - * // The problem type tag is derived from the model type tag, but uses - * // the SuperLU solver. Since this is done using a splice, all properties - * // defined for the "SuperLUSolver" are inherited and the ones for the - * // BiCGStabSolver type tag are undefined - * NEW_TYPE_TAG(ProblemTypeTag, INHERITS_FROM(ModelTypeTag)); - * SET_TAG_PROP(ProblemTypeTag, LinearSolver, SuperLUSolver); - * \endcode - */ -#define SET_SPLICES(TypeTagName, ...) \ - namespace PTag { \ - template<> \ - struct Splices \ - { \ - typedef RevertedTuple<__VA_ARGS__>::type tuple; \ - }; \ - SPLICE_INFO_(TypeTagName, __VA_ARGS__) \ - } \ - extern int semicolonHack_ - -/*! - * \ingroup Properties - * \brief Syntactic sugar for NEW_TYPE_TAG. - * - * See the documentation for NEW_TYPE_TAG. - */ -#define INHERITS_FROM(...) __VA_ARGS__ - -/*! -// * \ingroup Properties - * \brief Define a property tag. - * - * A property tag is the unique identifier for a property. It may only - * be declared once in your program. There is also no hierarchy of - * property tags as for type tags. - * - * Examples: - * - * \code - * NEW_PROP_TAG(blubbPropTag); - * NEW_PROP_TAG(blabbPropTag); - * \endcode - */ -#define NEW_PROP_TAG(PTagName) \ - namespace PTag { \ - struct PTagName; } extern int semicolonHack_ - -//! \cond SKIP_THIS -#define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \ - template \ - struct Property; \ - PROP_INFO_(EffTypeTagName, \ - /*kind=*/PropKind, \ - PropTagName, \ - /*value=*/__VA_ARGS__) \ - template \ - struct Property -//! \endcond - -/*! - * \ingroup Properties - * \brief Set a property for a specific type tag. - * - * After this macro, you must to specify a complete body of a class - * template, including the trailing semicolon. If you need to retrieve - * another property within the class body, you can use \c TypeTag as the - * argument for the type tag for the \c GET_PROP macro. - * - * Example: - * - * \code - * SET_PROP(FooTypeTag, blubbPropTag) - * { - * static int value = 10; - * static int calculate(int arg) - * { calculateInternal_(arg); } - * - * private: - * // retrieve the blabbProp property for the TypeTag the - * // property is defined on. Note that blabbProb does not need to - * // be defined on FooTypeTag, but can also be defined for some - * // derived type tag. - * typedef typename GET_PROP(TypeTag, blabbProp) blabb; - * - * static int calculateInternal_(int arg) - * { return arg * blabb::value; }; - * \endcode - * }; - */ -#define SET_PROP(EffTypeTagName, PropTagName) \ - template \ - struct Property; \ - PROP_INFO_(EffTypeTagName, \ - /*kind=*/"opaque", \ - PropTagName, \ - /*value=*/"") \ - template \ - struct Property - -/*! - * \ingroup Properties - * \brief Explicitly unset a property for a type tag. - * - * This means that the property will not be inherited from the type - * tag's parents. - * - * Example: - * - * \code - * // make the blabbPropTag property undefined for the BarTypeTag. - * UNSET_PROP(BarTypeTag, blabbPropTag); - * \endcode - */ -#define UNSET_PROP(EffTypeTagName, PropTagName) \ - template <> \ - struct PropertyUnset; \ - PROP_INFO_(EffTypeTagName, \ - /*kind=*/"withdraw", \ - PropTagName, \ - /*value=*/) \ - template <> \ - struct PropertyUnset \ - : public PropertyExplicitlyUnset \ - {} - -/*! - * \ingroup Properties - * \brief Set a property to a simple constant integer value. - * - * The constant can be accessed by the \c value attribute. - */ -#define SET_INT_PROP(EffTypeTagName, PropTagName, /*Value*/...) \ - SET_PROP_(EffTypeTagName, \ - /*kind=*/"int ", \ - PropTagName, \ - /*value=*/__VA_ARGS__) \ - { \ - typedef int type; \ - static const int value = __VA_ARGS__; \ - } - -/*! - * \ingroup Properties - * \brief Set a property to a simple constant boolean value. - * - * The constant can be accessed by the \c value attribute. - */ -#define SET_BOOL_PROP(EffTypeTagName, PropTagName, /*Value*/...) \ - SET_PROP_(EffTypeTagName, \ - /*kind=*/"bool ", \ - PropTagName, \ - /*value=*/__VA_ARGS__) \ - { \ - typedef bool type; \ - static const bool value = __VA_ARGS__; \ - } - -/*! - * \ingroup Properties - * \brief Set a property which defines a type. - * - * The type can be accessed by the \c type attribute. - */ -#define SET_TYPE_PROP(EffTypeTagName, PropTagName, /*Value*/...) \ - SET_PROP_(EffTypeTagName, \ - /*kind=*/"type ", \ - PropTagName, \ - /*value=*/__VA_ARGS__) \ - { \ - typedef __VA_ARGS__ type; \ - } - -/*! - * \ingroup Properties - * \brief This macro provides the boiler plate code to declare a static constant member - * outside of a property definition. - * - * This macro is fairly low-level and there should rarely be a need to use it. - */ -#define PROP_STATIC_CONST_MEMBER_DEFINITION_PREFIX_(EffTypeTagName, PropTagName) \ - template \ - const typename Property::type \ - Property - -/*! - * \ingroup Properties - * \brief This macro provides the boiler plate code to declare a static member outside of - * a property definition. - * - * This macro is fairly low-level and there should rarely be a need to use it. - */ -#define PROP_STATIC_MEMBER_DEFINITION_PREFIX_(EffTypeTagName, PropTagName) \ - template \ - typename Property::type \ - Property - -/*! - * \ingroup Properties - * \brief Set a property to a simple constant scalar value. - * - * The constant can be accessed by the \c value attribute. In order to - * use this macro, the property tag \c Scalar needs to be defined for - * the type tag. - */ -#define SET_SCALAR_PROP(EffTypeTagName, PropTagName, ...) \ - SET_PROP_(EffTypeTagName, \ - /*kind=*/"scalar", \ - PropTagName, \ - /*value=*/__VA_ARGS__) \ - { \ - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \ - public: \ - typedef Scalar type; \ - static const Scalar value; \ - }; \ - PROP_STATIC_CONST_MEMBER_DEFINITION_PREFIX_(EffTypeTagName, PropTagName)::value(__VA_ARGS__) - -/*! - * \ingroup Properties - * \brief Set a property to a simple constant string value. - * - * The constant can be accessed by the \c value attribute and is of - * type std::string. - */ -#define SET_STRING_PROP(EffTypeTagName, PropTagName, ...) \ - SET_PROP_(EffTypeTagName, \ - /*kind=*/"string", \ - PropTagName, \ - /*value=*/__VA_ARGS__) \ - { \ - public: \ - typedef std::string type; \ - static const std::string value; \ - }; \ - PROP_STATIC_CONST_MEMBER_DEFINITION_PREFIX_(EffTypeTagName, PropTagName)::value(__VA_ARGS__) - -/*! - * \ingroup Properties - * \brief Define a property containing a type tag. - * - * This is convenient for splices. - */ -#define SET_TAG_PROP(EffTypeTagName, PropTagName, ValueTypeTagName) \ - SET_PROP_(EffTypeTagName, \ - /*kind=*/"tag ", \ - PropTagName, \ - /*value=*/TTAG(ValueTypeTagName)) \ - { \ - typedef TTAG(ValueTypeTagName) type; \ - } - - -/*! - * \ingroup Properties - * \brief Retrieve a property for a type tag. - * - * If you use \c GET_PROP within a template and want to refer to some - * type (including the property itself), \c GET_PROP must be preceeded by - * the '\c typename' keyword. - */ -#define GET_PROP(TypeTag, PropTagName) \ - ::Opm::Properties::GetProperty::p -//!\cond SKIP_THIS -#define GET_PROP_(TypeTag, PropTag) \ - ::Opm::Properties::GetProperty::p -//!\endcond - -/*! - * \ingroup Properties - * \brief Access the \c value attribute of a property for a type tag. - * - * This is just for convenience and equivalent to - * GET_PROP(TypeTag, PropTag)::value . If the property doesn't - * have an attribute named \c value, this yields a compiler error. - */ -#define GET_PROP_VALUE(TypeTag, PropTagName) \ - ::Opm::Properties::GetProperty::p::value -//!\cond SKIP_THIS -#define GET_PROP_VALUE_(TypeTag, PropTag) \ - ::Opm::Properties::GetProperty::p::value -//!\endcond - -/*! - * \ingroup Properties - * \brief Access the \c type attribute of a property for a type tag. - * - * This is just for convenience and equivalent to - * GET_PROP(TypeTag, PropTag)::type. If the property doesn't - * have an attribute named \c type, this yields a compiler error. Also, - * if you use this macro within a template, it must be preceeded by - * the \c typename keyword. - */ -#define GET_PROP_TYPE(TypeTag, PropTagName) \ - ::Opm::Properties::GetProperty::p::type -//!\cond SKIP_THIS -#define GET_PROP_TYPE_(TypeTag, PropTag) \ - ::Opm::Properties::GetProperty::p::type -//!\endcond - -#if !defined NO_PROPERTY_INTROSPECTION -/*! - * \ingroup Properties - * \brief Return a human readable diagnostic message how exactly a - * property was defined. - * - * This is only enabled if the \c NO_PROPERTY_INTROSPECTION macro is not - * defined. - * - * Example: - * - * \code - * int main() - * { - * std::cout << PROP_DIAGNOSTIC(FooBarTypeTag, blabbPropTag) << "\n"; - * }; - * \endcode - */ -#define PROP_DIAGNOSTIC(TypeTag, PropTagName) \ - ::Opm::Properties::getDiagnostic(#PropTagName) - -#else -#define PROP_DIAGNOSTIC(TypeTag, PropTagName) "Property introspection disabled by macro NO_PROPERTY_INTROSPECTION." -#endif - -////////////////////////////////////////////// -// some serious template kung fu. Don't look at it too closely, it -// might damage your brain! -////////////////////////////////////////////// - -//! \cond SKIP_THIS - -namespace PTag {} -namespace TTag {} - -#if !defined NO_PROPERTY_INTROSPECTION - -namespace TTag -{ -template -struct TypeTagInfo -{}; -} - -namespace PTag -{ -template -struct SpliceInfo -{}; -} - -template -struct PropertyInfo -{}; - -class PropertyRegistryKey -{ -public: - PropertyRegistryKey() - {} - - PropertyRegistryKey(const std::string& effTypeTagName, - const std::string& propertyKind, - const std::string& propertyName, - const std::string& propertyValue, - const std::string& fileDefined, - int lineDefined) - : effTypeTagName_(effTypeTagName) - , propertyKind_(propertyKind) - , propertyName_(propertyName) - , propertyValue_(propertyValue) - , fileDefined_(fileDefined) - , lineDefined_(lineDefined) - { } - - // copy constructor - PropertyRegistryKey(const PropertyRegistryKey&) = default; - PropertyRegistryKey& operator=(const PropertyRegistryKey&) = default; - - const std::string& effTypeTagName() const - { return effTypeTagName_; } - const std::string& propertyKind() const - { return propertyKind_; } - const std::string& propertyName() const - { return propertyName_; } - const std::string& propertyValue() const - { return propertyValue_; } - const std::string& fileDefined() const - { return fileDefined_; } - int lineDefined() const - { return lineDefined_; } - -private: - std::string effTypeTagName_; - std::string propertyKind_; - std::string propertyName_; - std::string propertyValue_; - std::string fileDefined_; - int lineDefined_; -}; - - -template -struct GetProperty; - -class TypeTagRegistry -{ -public: - struct SpliceRegistryEntry { - SpliceRegistryEntry(const std::string& name) - { name_ = name; } - - std::string propertyName() const - { return name_; } - - private: - std::string name_; - }; - - typedef std::list > SpliceList; - typedef std::map SpliceListMap; - - typedef std::list ChildrenList; - typedef std::map ChildrenListMap; - - // this method adds the children of a type tag to the registry if the registry does - // not yet contain an entry for that type tag - template - static void addAllChildren() - { - std::string typeTagName = Dune::className(); - - if (children_().find(typeTagName) == children_().end()) - addChildren(); - } - - - // end of recursion. the last argument is not a child, but 'void' - // which is required for the macro magic... - template - static void addChildren() - {} - - // the last argument is not a child, but 'void' which is required - // for the macro magic... - template - static void addChildren() - { - std::string typeTagName = Dune::className(); - - children_()[typeTagName].emplace_front(Dune::className()); - - addChildren(); - } - - // this method adds the splices of a type tag to the registry if the registry does - // not yet contain an entry for that type tag - template - static void addAllSplices() - { - std::string typeTagName = Dune::className(); - - if (splices_().find(typeTagName) == splices_().end()) - addSplices(); - } - - - // end of recursion. the last argument is not a child, but 'void' - // which is required for the macro magic... - template - static void addSplices() - { } - - // the last argument is not a child, but 'void' which is required - // for the macro magic... - template - static void addSplices() - { - const std::string& typeTagName = Dune::className(); - const std::string& propName = - PropertyInfo::template GetEffectiveTypeTag_::type, Splice1>::propertyName(); - - splices_()[typeTagName].emplace_front(new SpliceRegistryEntry(propName)); - - addSplices(); - } - - static const SpliceList& splices(const std::string& typeTagName) - { return splices_()[typeTagName]; } - - static const ChildrenList& children(const std::string& typeTagName) - { return children_()[typeTagName]; } - -private: - static SpliceListMap& splices_() - { - static SpliceListMap data; - return data; - } - static ChildrenListMap& children_() - { - static ChildrenListMap data; - return data; - } -}; - -class PropertyRegistry -{ - typedef Opm::Properties::TypeTagRegistry TypeTagRegistry; - -public: - typedef std::map KeyList; - typedef std::map KeyListMap; - - static void addKey(const PropertyRegistryKey& key) - { - keys_()[key.effTypeTagName()][key.propertyName()] = key; - } - - static const std::string& getSpliceTypeTagName(const std::string& typeTagName, - const std::string& propertyName) - { - const auto& keyIt = keys_().find(typeTagName); - const auto& keyEndIt = keys_().end(); - if (keyIt == keyEndIt) - throw std::runtime_error("Unknown type tag key '"+typeTagName+"'"); - - // check whether the propery is directly defined for the type tag currently - // checked, ... - const auto& propIt = keyIt->second.find(propertyName); - const auto& propEndIt = keyIt->second.end(); - if (propIt != propEndIt) - return propIt->second.propertyValue(); - - // ..., if not, check all splices, ... - typedef typename TypeTagRegistry::SpliceList SpliceList; - const SpliceList& splices = TypeTagRegistry::splices(typeTagName); - SpliceList::const_iterator spliceIt = splices.begin(); - for (; spliceIt != splices.end(); ++spliceIt) { - const auto& spliceTypeTagName = - PropertyRegistry::getSpliceTypeTagName(typeTagName, - (*spliceIt)->propertyName()); - - if (spliceTypeTagName == "") - continue; - - const auto& tmp = getSpliceTypeTagName(spliceTypeTagName, propertyName); - if (tmp != "") - return tmp; - } - - // .. if still not, check all normal children. - typedef TypeTagRegistry::ChildrenList ChildrenList; - const ChildrenList& children = TypeTagRegistry::children(typeTagName); - ChildrenList::const_iterator ttagIt = children.begin(); - for (; ttagIt != children.end(); ++ttagIt) { - const auto& tmp = getSpliceTypeTagName(*ttagIt, propertyName); - if (tmp != "") - return tmp; - } - - // if the property was not defined on a given type tag, return - // the empty string. - static std::string tmp(""); - return tmp; - } - - static const PropertyRegistryKey& getKey(const std::string& effTypeTagName, - const std::string& propertyName) - { return keys_()[effTypeTagName][propertyName]; } - - static const KeyList& getKeys(const std::string& effTypeTagName) - { return keys_()[effTypeTagName]; } - -private: - static KeyListMap& keys_() - { - static KeyListMap data; - return data; - } -}; - -#endif // !defined NO_PROPERTY_INTROSPECTION - -struct PropertyUndefined { }; -class PropertyExplicitlyUnset {}; - -template -struct Property : public PropertyUndefined -{}; - -template -struct PropertyUnset : public PropertyUndefined -{}; - -template -struct propertyExplicitlyUnset -{ - const static bool value = - std::is_base_of - >::value; -}; - -template -class propertyExplicitlyUnsetOnTree -{ - static const bool explicitlyUnset = propertyExplicitlyUnset::value; - - template - struct unsetOnAllChildren - { static const bool value = true; }; - - template - struct unsetOnAllChildren > - { static const bool value = - propertyExplicitlyUnsetOnTree::value - && unsetOnAllChildren >::value; }; - -public: - static const bool value = - (explicitlyUnset || (!Tree::isLeaf && unsetOnAllChildren::value)); -}; - -template -struct propertyExplicitlyUnsetOnTree -{ - const static bool value = std::true_type::value; -}; - -template -struct propertyDefinedOnSelf -{ - const static bool value = - ! std::is_base_of >::value; -}; - -// template class to revert the order or a std::tuple's arguments. This is required to -// make the properties of children defined on the right overwrite the properties of the -// children on the left. See https://sydius.me/2011/07/reverse-tuple-in-c/ -template -class RevertedTuple -{ -private: - template - struct RevertedTupleOuter - { - template - struct RevertedTupleInner: RevertedTupleOuter::template RevertedTupleInner { }; - }; - - template - struct RevertedTupleOuter<0, All...> - { - template - struct RevertedTupleInner { - typedef std::tuple type; - }; - }; - -public: - typedef typename RevertedTupleOuter::template RevertedTupleInner::type type; -}; - -template -class TypeTag -{ -public: - typedef SelfT SelfType; - - typedef typename RevertedTuple::type ChildrenTuple; - static const bool isLeaf = std::is_same >::value; -}; - -namespace PTag { -// this class needs to be located in the PTag namespace for reasons -// you don't really want to know... -template -struct Splices -{ - typedef typename std::tuple<> tuple; -}; -} // namespace PTag - -template -struct GetProperty -{ - // find the type tag for which the property is defined - template ::value> - struct GetEffectiveTypeTag_ - { typedef typename CurTree::SelfType type; }; - - template - struct SearchTypeTagList_; - - template - struct SearchTypeTagList_FirstThenRemaining_; - - template - struct SearchSpliceList_; - - template - struct SearchSpliceList_FirstThenRemaining_; - - // find the first type tag in a tuple for which the property is - // defined - template - struct SearchTypeTagTuple_ - { typedef void type; }; - - template - struct SearchTypeTagTuple_ > - { typedef typename SearchTypeTagList_::type type; }; - - template - struct SearchTypeTagList_ - { typedef void type; }; - - template - struct SearchTypeTagList_ - { - typedef typename SearchTypeTagList_FirstThenRemaining_< - typename GetEffectiveTypeTag_::type, - RemainingElements...>::type type; - }; - - template - struct SearchTypeTagList_FirstThenRemaining_ - { typedef EffectiveTypeTag type; }; - - template - struct SearchTypeTagList_FirstThenRemaining_ - { typedef typename SearchTypeTagList_::type type; }; - - // find the first type tag in a tuple of splices for which the - // property is defined - template - struct SearchSpliceTuple_ - { typedef void type; }; - - template - struct SearchSpliceTuple_ > - { typedef typename SearchSpliceList_::type type; }; - - template - struct SearchSpliceList_ - { typedef void type; }; - - template - struct SearchSpliceList_ - { - typedef typename SearchSpliceList_FirstThenRemaining_< - typename GetEffectiveTypeTag_::p::type>::type, - RemainingSplices...>::type type; - }; - - template - struct SearchSpliceList_FirstThenRemaining_ - { typedef EffectiveTypeTag type; }; - - template - struct SearchSpliceList_FirstThenRemaining_ - { typedef typename SearchSpliceList_::type type; }; - - // find the splice or the child type tag for which the property is defined - template ::tuple >::type > - struct SearchSplicesThenChildren_ - { typedef SpliceTypeTag type; }; - - template - struct SearchSplicesThenChildren_ - { typedef typename SearchTypeTagTuple_::type type; }; - - template - struct GetEffectiveTypeTag_ - { typedef typename SearchSplicesThenChildren_::type type; }; - -public: - typedef Property::type, PropertyTag> p; -}; - -#if !defined NO_PROPERTY_INTROSPECTION -inline int myReplaceAll_(std::string& s, - const std::string& pattern, - const std::string& replacement); -inline int myReplaceAll_(std::string& s, - const std::string& pattern, - const std::string& replacement) -{ - size_t pos; - int i = 0; - while ( (pos = s.find(pattern)) != s.npos) { - s.replace(pos, pattern.size(), replacement); - ++i; - }; - return i; -} - -inline std::string canonicalTypeTagNameToName_(const std::string& canonicalName); -inline std::string canonicalTypeTagNameToName_(const std::string& canonicalName) -{ - std::string result(canonicalName); - myReplaceAll_(result, "Opm::Properties::TTag::", "TTAG("); - myReplaceAll_(result, "::", ""); - result += ")"; - return result; -} - -inline bool getDiagnostic_(const std::string& typeTagName, - const std::string& propTagName, - std::string& result, - const std::string indent) -{ - const PropertyRegistryKey *key = 0; - - const typename PropertyRegistry::KeyList& keys = - PropertyRegistry::getKeys(typeTagName); - typename PropertyRegistry::KeyList::const_iterator it = keys.begin(); - for (; it != keys.end(); ++it) { - if (it->second.propertyName() == propTagName) { - key = &it->second; - break; - }; - } - - if (key) { - std::ostringstream oss; - oss << indent - << key->propertyKind() << " " - << key->propertyName() << " defined on '" - << canonicalTypeTagNameToName_(key->effTypeTagName()) << "' at " - << key->fileDefined() << ":" << key->lineDefined() << "\n"; - result = oss.str(); - return true; - } - - // print properties defined on children - typedef typename TypeTagRegistry::ChildrenList ChildrenList; - const ChildrenList& children = TypeTagRegistry::children(typeTagName); - ChildrenList::const_iterator ttagIt = children.begin(); - std::string newIndent = indent + " "; - for (; ttagIt != children.end(); ++ttagIt) { - if (getDiagnostic_(*ttagIt, propTagName, result, newIndent)) { - result.insert(0, indent + "Inherited from " + canonicalTypeTagNameToName_(typeTagName) + "\n"); - return true; - } - } - - return false; -} - -template -const std::string getDiagnostic(std::string propTagName) -{ - std::string result; - - std::string TypeTagName(Dune::className()); - - propTagName.replace(0, strlen("PTag("), ""); - auto n = propTagName.length(); - propTagName.replace(n - 1, 1, ""); - //TypeTagName.replace(0, strlen("Opm::Properties::TTag::"), ""); - - return result; -} - -inline void print_(const std::string& rootTypeTagName, - const std::string& curTypeTagName, - const std::string& splicePropName, - std::ostream& os, - const std::string indent, - std::set& printedProperties) -{ - if (indent == "") { - os << indent << "###########\n"; - os << indent << "# Properties\n"; - os << indent << "###########\n"; - os << indent << "Properties for " << canonicalTypeTagNameToName_(curTypeTagName) << ":"; - } - else if (splicePropName != "") - os << indent << "Inherited from splice " << splicePropName << " (set to " << canonicalTypeTagNameToName_(curTypeTagName) << "):"; - else - os << indent << "Inherited from " << canonicalTypeTagNameToName_(curTypeTagName) << ":"; - const typename PropertyRegistry::KeyList& keys = - PropertyRegistry::getKeys(curTypeTagName); - typename PropertyRegistry::KeyList::const_iterator it = keys.begin(); - bool somethingPrinted = false; - for (; it != keys.end(); ++it) { - const PropertyRegistryKey& key = it->second; - if (printedProperties.count(key.propertyName()) > 0) - continue; // property already printed - if (!somethingPrinted) { - os << "\n"; - somethingPrinted = true; - } - os << indent << " " - << key.propertyKind() << " " << key.propertyName(); - if (key.propertyKind() != "opaque") { - std::string s(key.propertyValue()); - myReplaceAll_(s, "typename ", ""); - if (myReplaceAll_(s, "::Opm::Properties::TTag::", "TTAG(")) - s += ')'; - myReplaceAll_(s, "::Opm::Properties::PTag::", ""); - myReplaceAll_(s, "::Opm::Properties::GetProperty<", "GET_PROP("); - myReplaceAll_(s, ">::p::", ")::"); - myReplaceAll_(s, "GET_PROP(TypeTag, Scalar)::type", "Scalar"); - - os << " = '" << s << "'"; - } - os << " defined at " << key.fileDefined() - << ":" << key.lineDefined() - << "\n"; - printedProperties.insert(key.propertyName()); - }; - if (!somethingPrinted) - os << " (none)\n"; - // print properties defined on splices or children - std::string newIndent = indent + " "; - - // first, iterate over the splices, ... - typedef TypeTagRegistry::SpliceList SpliceList; - const SpliceList& splices = TypeTagRegistry::splices(curTypeTagName); - SpliceList::const_iterator spliceIt = splices.begin(); - for (; spliceIt != splices.end(); ++ spliceIt) { - const auto& spliceTypeTagName = PropertyRegistry::getSpliceTypeTagName(rootTypeTagName, - (*spliceIt)->propertyName()); - print_(rootTypeTagName, spliceTypeTagName, (*spliceIt)->propertyName(), os, newIndent, printedProperties); - } - - // ... then, over the children - typedef typename TypeTagRegistry::ChildrenList ChildrenList; - const ChildrenList& children = TypeTagRegistry::children(curTypeTagName); - ChildrenList::const_iterator ttagIt = children.begin(); - for (; ttagIt != children.end(); ++ttagIt) { - print_(rootTypeTagName, *ttagIt, /*splicePropName=*/"", os, newIndent, printedProperties); - } -} - -template -void printValues(std::ostream& os = std::cout) -{ - std::set printedProps; - print_(Dune::className(), Dune::className(), /*splicePropertyName=*/"", os, /*indent=*/"", printedProps); -} -#else // !defined NO_PROPERTY_INTROSPECTION -template -void printValues(std::ostream& os = std::cout) -{ - os << - "The eWoms property system was compiled with the macro\n" - "NO_PROPERTY_INTROSPECTION defined.\n" - "No diagnostic messages this time, sorry.\n"; -} - -template -const std::string getDiagnostic(std::string propTagName) -{ - std::string result; - result = - "The eWoms property system was compiled with the macro\n" - "NO_PROPERTY_INTROSPECTION defined.\n" - "No diagnostic messages this time, sorry.\n"; - return result; -} - -#endif // !defined NO_PROPERTY_INTROSPECTION - -//! \endcond - -} // namespace Properties -} // namespace Opm +} // end namespace Opm #endif diff --git a/opm/models/utils/propertysystemmacros.hh b/opm/models/utils/propertysystemmacros.hh new file mode 100644 index 000000000..2a987c5d1 --- /dev/null +++ b/opm/models/utils/propertysystemmacros.hh @@ -0,0 +1,392 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *****************************************************************************/ +/*! + * \file + * \ingroup Properties + * \brief Provides the magic behind the DuMuX property system. + * + * Properties allow to associate arbitrary data types to + * identifiers. A property is always defined on a pair (TypeTag, + * PropertyTag) where TypeTag is the identifier for the object the + * property is defined for and PropertyTag is an unique identifier of + * the property. + * + * Type tags are hierarchic and inherit properties defined on their + * ancesters. At each level, properties defined on lower levels can be + * overwritten or even made undefined. It is also possible to define + * defaults for properties if it makes sense. + * + * Properties may make use other properties for the respective type + * tag and these properties can also be defined on an arbitrary level + * of the hierarchy. + */ +#ifndef OPM_PROPERTY_SYSTEM_MACROS_HH +#define OPM_PROPERTY_SYSTEM_MACROS_HH +#warning "Property macros are deprecated and will be removed after release 3.2. \ +If you are not using property macros you can disable this warning by \ +setting OPM_ENABLE_OLD_PROPERTY_MACROS to 0 (false) when configuring DuMux. \ +OPM_ENABLE_OLD_PROPERTY_MACROS defaults to 1 (true) until release 3.1. \ +After release 3.1 it will default to 0 (false) so you will have to manually \ +enable property macros in order to use them." + +#include + +namespace Opm { +namespace Properties { + +namespace TTag {} + +/*! + * \brief Makes a type out of a type tag name + */ +#define TTAG(TypeTagName) ::Opm::Properties::TTag::TypeTagName + +/*! + * \brief Makes a type out of a property tag name + */ +//#define PTAG(PropTagName) PropTagName + +/*! + * \brief Makes a type out of a property tag name + */ +#define PTAG_(PropTagName) ::Opm::Properties::PropTagName + + +// in the old property system the order in inherit_from was the other way around +// this flips the order of a tuple to restore old behaviour when using the macro. +// when you are using non-macro version make sure to flip the order. +template +struct ReverseTupleImpl; + +template +struct ReverseTupleImpl> +{ + using type = std::tuple...>; +}; + +// revert tuple argument order +template +using ReverseTuple = typename ReverseTupleImpl::value>>::type; + +// a temporary hack to make the macro still work, we set using InheritsFrom = void, +// which gets picked up by the new property as non inheritance, this can be removed +// once all macros are gone +namespace Detail { +template +struct GetTypeTagInheritance; + +template +struct GetTypeTagInheritance> +{ + using type = void; +}; + +template +struct GetTypeTagInheritance> +{ + // reverse order to restore old behaviour + using type = ReverseTuple>; +}; +} // end namespace Detail + +/*! + * \ingroup Properties + * \brief Define a new type tag. + * + * A type tag can inherit the properties defined on up to five parent + * type tags. Examples: + * + * \code + * // The type tag doesn't inherit any properties from other type tags + * NEW_TYPE_TAG(FooTypeTag); + * + * // BarTypeTag inherits all properties from FooTypeTag + * NEW_TYPE_TAG(BarTypeTag, INHERITS_FROM(FooTypeTag)); + * + * // FooBarTypeTag inherits the properties of FooTypeTag as well as + * // those of BarTypeTag. Properties defined on BarTypeTag have + * // preceedence over those defined for FooTypeTag: + * NEW_TYPE_TAG(FooBarTypeTag, INHERITS_FROM(FooTypeTag, BarTypeTag)); + * \endcode + */ +#define OPM_GET_HEAD_(Arg1, ...) Arg1 + +#define NEW_TYPE_TAG(...) \ + namespace TTag { \ + struct OPM_GET_HEAD_(__VA_ARGS__) \ + { using InheritsFrom = Detail::GetTypeTagInheritance>::type; }; \ + } extern int semicolonHack_ + +/*! + * \ingroup Properties + * \brief Syntactic sugar for NEW_TYPE_TAG. + * + * See the documentation for NEW_TYPE_TAG. + */ +#define INHERITS_FROM(...) __VA_ARGS__ + +/*! + * \ingroup Properties + * \brief Define a property tag. + * + * A property tag is the unique identifier for a property. It may only + * be declared once in your program. There is also no hierarchy of + * property tags as for type tags. + * + * Examples: + * + * \code + * NEW_PROP_TAG(blubbPropTag); + * NEW_PROP_TAG(blabbPropTag); + * \endcode + */ +#define NEW_PROP_TAG(PTagName) \ + template \ + struct PTagName { using type = UndefinedProperty; }; \ + extern int semicolonHack_ + +/*! + * \ingroup Properties + * \brief Set a property for a specific type tag. + * + * After this macro, you must to specify a complete body of a class + * template, including the trailing semicolon. If you need to retrieve + * another property within the class body, you can use TypeTag as the + * argument for the type tag for the GET_PROP macro. + * + * Example: + * + * \code + * SET_PROP(FooTypeTag, blubbPropTag) + * { + * static int value = 10; + * static int calculate(int arg) + * { calculateInternal_(arg); } + * + * private: + * // retrieve the blabbProp property for the real TypeTag the + * // property is defined on. Note that blabbProb does not need to + * // be defined on FooTypeTag, but can also be defined for some + * // derived type tag. + * using blabb = typename GET_PROP(TypeTag, blabbProp); + * + * static int calculateInternal_(int arg) + * { return arg * blabb::value; }; + * \endcode + * }; + */ +#define SET_PROP(EffTypeTagName, PropTagName) \ + template \ + struct PropTagName + +/*! + * \ingroup Properties + * \brief Set a property to a simple constant integer value. + * + * The constant can be accessed by the 'value' attribute. + */ +#define SET_INT_PROP(EffTypeTagName, PropTagName, /*Value*/...) \ + template \ + struct PropTagName \ + { \ + using type = int; \ + static constexpr int value = __VA_ARGS__; \ + } + +/*! + * \ingroup Properties + * \brief Set a property to a simple constant boolean value. + * + * The constant can be accessed by the 'value' attribute. + */ +#define SET_BOOL_PROP(EffTypeTagName, PropTagName, /*Value*/...) \ + template \ + struct PropTagName \ + { \ + using type = bool; \ + static constexpr bool value = __VA_ARGS__; \ + } + +/*! + * \ingroup Properties + * \brief Set a property which defines a type. + * + * The type can be accessed by the 'type' attribute. + */ +#define SET_TYPE_PROP(EffTypeTagName, PropTagName, /*Value*/...) \ + template \ + struct PropTagName \ + { \ + using type = __VA_ARGS__; \ + } + +/*! + * \ingroup Properties + * \brief Set a property to a simple constant scalar value. + * + * The constant can be accessed by the 'value' attribute. In order to + * use this macro, the property tag "Scalar" needs to be defined for + * the real type tag. + */ +#define SET_SCALAR_PROP(EffTypeTagName, PropTagName, ...) \ + template \ + struct PropTagName \ + { \ + using Scalar = Opm::GetPropType; \ + public: \ + using type = Scalar; \ + static const Scalar value; \ + }; \ + template \ + const typename PropTagName::type \ + PropTagName::value(__VA_ARGS__) + +/*! + * \ingroup Properties + * \brief Set a property to a simple constant string value. + * + * The constant can be accessed by the 'value' attribute and is of + * type std::string. + */ +#define SET_STRING_PROP(EffTypeTagName, PropTagName, ...) \ + template \ + struct PropTagName \ + { \ + public: \ + using type = std::string; \ + static const std::string value; \ + }; \ + template \ + const typename PropTagName::type \ + PropTagName::value(__VA_ARGS__) + + +// getters +#define GET_PROP(TypeTag, PropTagName) ::Opm::Properties::Detail::GetPropImpl::type +#define GET_PROP_VALUE(TypeTag, PropTagName) ::Opm::Properties::Detail::GetPropImpl::type::value +#define GET_PROP_TYPE(TypeTag, PropTagName) ::Opm::Properties::Detail::GetPropImpl::type::type + + /*! + * \ingroup Properties + * \brief Define splices for a given type tag. + * + * Splices can be seen as children which can be overridden lower in + * the hierarchy. It can thus be seen as a "deferred inheritance" + * mechanism. Example: + * + * \code + * // First, define type tags for two different linear solvers: + * // BiCGStab and SuperLU. The first needs the "MaxIterations" + * // property, the second defines the "UsePivoting" property. + * NEW_TYPE_TAG(BiCGStabSolver); + * NEW_PROP_TAG(MaxIterations); + * SET_INT_PROP(BiCGStabSolver, MaxIterations, 100); + * + * NEW_TYPE_TAG(SuperLUSolver); + * NEW_PROP_TAG(UsePivoting); + * SET_BOOL_PROP(SuperLUSolver, UsePivoting, true); + * + * // The model type tag defines the splice 'LinearSolver' and sets it + * // to the 'BiCGStabSolver' type tag. + * NEW_TYPE_TAG(ModelTypeTag); + * NEW_PROP_TAG(LinearSolver); + * SET_SPLICES(ModelTypeTag, LinearSolver); + * SET_TAG_PROP(ModelTypeTag, LinearSolver, BiCGStabSolver); + * + * // The problem type tag is derived from the model type tag, but uses + * // the SuperLU solver. Since this is done using a splice, all properties + * // defined for the "SuperLUSolver" are inherited and the ones for the + * // BiCGStabSolver type tag are undefined + * NEW_TYPE_TAG(ProblemTypeTag, INHERITS_FROM(ModelTypeTag)); + * SET_TAG_PROP(ProblemTypeTag, LinearSolver, SuperLUSolver); + * \endcode +*/ + + // template class to revert the order or a std::tuple's arguments. This is required to + // make the properties of children defined on the right overwrite the properties of the + // children on the left. See https://sydius.me/2011/07/reverse-tuple-in-c/ + template + class RevertedTuple + { + private: + template + struct RevertedTupleOuter + { + template + struct RevertedTupleInner: RevertedTupleOuter::template RevertedTupleInner { }; + }; + + template + struct RevertedTupleOuter<0, All...> + { + template + struct RevertedTupleInner { + typedef std::tuple type; + }; + }; + + public: + typedef typename RevertedTupleOuter::template RevertedTupleInner::type type; + }; + +namespace PTag { +// this class needs to be located in the PTag namespace for reasons +// you don't really want to know... +template +struct Splices +{ + typedef typename std::tuple<> tuple; +}; +} // namespace PTag + +#define SET_SPLICES(TypeTagName, ...) \ +namespace PTag { \ +template<> \ +struct Splices \ +{ \ + typedef RevertedTuple<__VA_ARGS__>::type tuple; \ +}; \ +SPLICE_INFO_(TypeTagName, __VA_ARGS__) \ +} \ +extern int semicolonHack_ + +#define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \ +template \ +struct PropTagName + + +/*! + * \ingroup Properties + * \brief Define a property containing a type tag. + * + * This is convenient for splices. +*/ +#define SET_TAG_PROP(EffTypeTagName, PropTagName, ValueTypeTagName) \ +SET_PROP_(EffTypeTagName, \ + /*kind=*/"tag ", \ + PropTagName, \ + /*value=*/TTAG(ValueTypeTagName)) \ +{ \ + typedef TTAG(ValueTypeTagName) type; \ +} + +} // namespace Properties +} // namespace Opm + +#endif // OPM_PROPERTY_SYSTEM_HH diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index 11f8b850d..a8519773c 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -48,15 +48,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Vanguard); -NEW_PROP_TAG(GridView); -NEW_PROP_TAG(Model); -NEW_PROP_TAG(Problem); -NEW_PROP_TAG(EndTime); -NEW_PROP_TAG(RestartTime); -NEW_PROP_TAG(InitialTimeStepSize); -NEW_PROP_TAG(PredeterminedTimeStepsFile); END_PROPERTIES @@ -984,6 +975,11 @@ private: bool finished_; bool verbose_; }; + +namespace Properties { +SET_TYPE_PROP(NumericModel, Simulator, Opm::Simulator); +} + } // namespace Opm #endif diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index 92af8ab9c..b48d46f93 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -71,13 +71,6 @@ BEGIN_PROPERTIES // forward declaration of property tags -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(Simulator); -NEW_PROP_TAG(ThreadManager); -NEW_PROP_TAG(PrintProperties); -NEW_PROP_TAG(PrintParameters); -NEW_PROP_TAG(ParameterFile); -NEW_PROP_TAG(Problem); END_PROPERTIES diff --git a/opm/simulators/linalg/istlpreconditionerwrappers.hh b/opm/simulators/linalg/istlpreconditionerwrappers.hh index 8a78b982d..ebfd02159 100644 --- a/opm/simulators/linalg/istlpreconditionerwrappers.hh +++ b/opm/simulators/linalg/istlpreconditionerwrappers.hh @@ -51,12 +51,6 @@ #include BEGIN_PROPERTIES -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(SparseMatrixAdapter); -NEW_PROP_TAG(OverlappingMatrix); -NEW_PROP_TAG(OverlappingVector); -NEW_PROP_TAG(PreconditionerOrder); -NEW_PROP_TAG(PreconditionerRelaxation); END_PROPERTIES namespace Opm { diff --git a/opm/simulators/linalg/istlsolverwrappers.hh b/opm/simulators/linalg/istlsolverwrappers.hh index 615f8a034..057776b2e 100644 --- a/opm/simulators/linalg/istlsolverwrappers.hh +++ b/opm/simulators/linalg/istlsolverwrappers.hh @@ -50,14 +50,6 @@ BEGIN_PROPERTIES -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(SparseMatrixAdapter); -NEW_PROP_TAG(OverlappingMatrix); -NEW_PROP_TAG(OverlappingVector); -NEW_PROP_TAG(GMResRestart); -NEW_PROP_TAG(LinearSolverTolerance); -NEW_PROP_TAG(LinearSolverMaxIterations); -NEW_PROP_TAG(LinearSolverVerbosity); END_PROPERTIES diff --git a/opm/simulators/linalg/parallelamgbackend.hh b/opm/simulators/linalg/parallelamgbackend.hh index f3ac560c2..03a542b58 100644 --- a/opm/simulators/linalg/parallelamgbackend.hh +++ b/opm/simulators/linalg/parallelamgbackend.hh @@ -51,8 +51,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ParallelAmgLinearSolver, INHERITS_FROM(ParallelBaseLinearSolver)); -NEW_PROP_TAG(AmgCoarsenTarget); -NEW_PROP_TAG(LinearSolverMaxError); //! The target number of DOFs per processor for the parallel algebraic //! multi-grid solver diff --git a/opm/simulators/linalg/parallelbasebackend.hh b/opm/simulators/linalg/parallelbasebackend.hh index 221e8f393..0b0d6dc31 100644 --- a/opm/simulators/linalg/parallelbasebackend.hh +++ b/opm/simulators/linalg/parallelbasebackend.hh @@ -54,30 +54,14 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ParallelBaseLinearSolver); // forward declaration of the required property tags -NEW_PROP_TAG(Simulator); -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(NumEq); -NEW_PROP_TAG(SparseMatrixAdapter); -NEW_PROP_TAG(GlobalEqVector); -NEW_PROP_TAG(VertexMapper); -NEW_PROP_TAG(GridView); -NEW_PROP_TAG(BorderListCreator); -NEW_PROP_TAG(Overlap); -NEW_PROP_TAG(OverlappingVector); -NEW_PROP_TAG(OverlappingMatrix); -NEW_PROP_TAG(OverlappingScalarProduct); -NEW_PROP_TAG(OverlappingLinearOperator); //! The type of the linear solver to be used -NEW_PROP_TAG(LinearSolverBackend); //! the preconditioner used by the linear solver -NEW_PROP_TAG(PreconditionerWrapper); //! The floating point type used internally by the linear solver -NEW_PROP_TAG(LinearSolverScalar); /*! * \brief The size of the algebraic overlap of the linear solver. @@ -86,17 +70,14 @@ NEW_PROP_TAG(LinearSolverScalar); * of a grid, but it is only existant for the linear system of * equations. */ -NEW_PROP_TAG(LinearSolverOverlapSize); /*! * \brief Maximum accepted error of the solution of the linear solver. */ -NEW_PROP_TAG(LinearSolverTolerance); /*! * \brief Maximum accepted error of the norm of the residual. */ -NEW_PROP_TAG(LinearSolverAbsTolerance); /*! * \brief Specifies the verbosity of the linear solver @@ -105,16 +86,12 @@ NEW_PROP_TAG(LinearSolverAbsTolerance); * property to 1 prints aggregated convergence rates, 2 prints the * convergence rate of every iteration of the scheme. */ -NEW_PROP_TAG(LinearSolverVerbosity); //! Maximum number of iterations eyecuted by the linear solver -NEW_PROP_TAG(LinearSolverMaxIterations); //! The order of the sequential preconditioner -NEW_PROP_TAG(PreconditionerOrder); //! The relaxation factor of the preconditioner -NEW_PROP_TAG(PreconditionerRelaxation); //! Set the type of a global jacobian matrix for linear solvers that are based on //! dune-istl. diff --git a/opm/simulators/linalg/parallelbicgstabbackend.hh b/opm/simulators/linalg/parallelbicgstabbackend.hh index 19bd5c97c..11b76c6b3 100644 --- a/opm/simulators/linalg/parallelbicgstabbackend.hh +++ b/opm/simulators/linalg/parallelbicgstabbackend.hh @@ -44,7 +44,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ParallelBiCGStabLinearSolver, INHERITS_FROM(ParallelBaseLinearSolver)); -NEW_PROP_TAG(LinearSolverMaxError); SET_TYPE_PROP(ParallelBiCGStabLinearSolver, LinearSolverBackend, diff --git a/opm/simulators/linalg/parallelistlbackend.hh b/opm/simulators/linalg/parallelistlbackend.hh index 5c7ad2c53..dbb6619fd 100644 --- a/opm/simulators/linalg/parallelistlbackend.hh +++ b/opm/simulators/linalg/parallelistlbackend.hh @@ -37,11 +37,8 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ParallelIstlLinearSolver, INHERITS_FROM(ParallelBaseLinearSolver)); -NEW_PROP_TAG(LinearSolverWrapper); -NEW_PROP_TAG(SparseMatrixAdapter); //! number of iterations between solver restarts for the GMRES solver -NEW_PROP_TAG(GMResRestart); END_PROPERTIES diff --git a/opm/simulators/linalg/superlubackend.hh b/opm/simulators/linalg/superlubackend.hh index a9624d2b7..ee7370eff 100644 --- a/opm/simulators/linalg/superlubackend.hh +++ b/opm/simulators/linalg/superlubackend.hh @@ -41,13 +41,6 @@ BEGIN_PROPERTIES // forward declaration of the required property tags -NEW_PROP_TAG(Scalar); -NEW_PROP_TAG(NumEq); -NEW_PROP_TAG(Simulator); -NEW_PROP_TAG(SparseMatrixAdapter); -NEW_PROP_TAG(GlobalEqVector); -NEW_PROP_TAG(LinearSolverVerbosity); -NEW_PROP_TAG(LinearSolverBackend); NEW_TYPE_TAG(SuperLULinearSolver); END_PROPERTIES From 5fe2bc0aa9940f59e48f35fe270467f1e4b78eb3 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Fri, 6 Mar 2020 16:08:39 +0100 Subject: [PATCH 02/12] intermediate state of reimplementing the splice functionality --- opm/models/common/multiphasebasemodel.hh | 6 ++++ opm/models/utils/basicproperties.hh | 3 +- opm/models/utils/propertysystem.hh | 40 ++++++++++++++++++++++-- opm/models/utils/propertysystemmacros.hh | 17 +++------- 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/opm/models/common/multiphasebasemodel.hh b/opm/models/common/multiphasebasemodel.hh index 2b29f0d87..40bd23e3a 100644 --- a/opm/models/common/multiphasebasemodel.hh +++ b/opm/models/common/multiphasebasemodel.hh @@ -54,7 +54,13 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(NumericModel, VtkMultiPhase, VtkTemperature)); //! Specify the splices of the MultiPhaseBaseModel type tag +//NEW_PROP_TAG(SpatialDiscretizationSplice); //SET_SPLICES(MultiPhaseBaseModel, SpatialDiscretizationSplice); +template +struct Splices +{ + using tuple = std::tuple>; +}; //! Set the default spatial discretization //! diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 019218ef6..bb77eb677 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -100,7 +100,7 @@ NEW_PROP_TAG(ThreadManager); NEW_PROP_TAG(NewtonMethod); NEW_PROP_TAG(SolutionVector); NEW_PROP_TAG(GlobalEqVector); -NEW_PROP_TAG(VtkOutputFormat); +//NEW_PROP_TAG(VtkOutputFormat); //! Specifies the type of a solution for a single degee of freedom NEW_PROP_TAG(PrimaryVariables); @@ -261,7 +261,6 @@ NEW_PROP_TAG(EnableExperiments); NEW_PROP_TAG(EnableIntensiveQuantityCache); NEW_PROP_TAG(EnableThermodynamicHints); NEW_PROP_TAG(NonwettingPhase); -NEW_PROP_TAG(SpatialDiscretizationSplice); NEW_PROP_TAG(WettingPhase); NEW_PROP_TAG(OverlappingMatrix); diff --git a/opm/models/utils/propertysystem.hh b/opm/models/utils/propertysystem.hh index c7bb4aaa6..ea6febd0c 100644 --- a/opm/models/utils/propertysystem.hh +++ b/opm/models/utils/propertysystem.hh @@ -36,6 +36,26 @@ namespace Properties { //! a tag to mark properties as undefined struct UndefinedProperty {}; +template +struct SpatialDiscretizationSplice { using type = UndefinedProperty; }; + +namespace TTag { +struct MyTTag {}; +struct MySDTTag {}; +} + +template +struct SpatialDiscretizationSplice +{ using type = TTag::MySDTTag; }; + +template +struct VtkOutputFormat { using type = UndefinedProperty; }; + +template +struct VtkOutputFormat +{ static constexpr auto value = 2; }; + + //! implementation details for template meta programming namespace Detail { @@ -69,7 +89,7 @@ using ConCatTuples = decltype(std::tuple_cat(std::declval()...)); template class Property, class TTagList> struct GetDefined; -//! helper struct to iteratre over the TypeTag hierarchy +//! helper struct to iterate over the TypeTag hierarchy template class Property, class TTagList, class Enable> struct GetNextTypeTag; @@ -129,7 +149,23 @@ struct GetDefined> template class Property> struct GetPropImpl { - using type = typename Detail::GetDefined>::type; + using PType = Properties::SpatialDiscretizationSplice; + using testtype = std::conditional_t(int{}), PType, UndefinedProperty>; + static_assert(!std::is_same::value, "SpatialDiscretizationSplice is undefined in MyTTag!"); + + using QType = Properties::VtkOutputFormat; + using testtype2 = std::conditional_t(int{}), QType, UndefinedProperty>; + static_assert(!std::is_same::value, "VtkOutputFormat is undefined in MySDTTag!"); + +// using testtype = typename Detail::GetDefined +// >::type; + + using type = typename Detail::GetDefined + >::type; static_assert(!std::is_same::value, "Property is undefined!"); }; diff --git a/opm/models/utils/propertysystemmacros.hh b/opm/models/utils/propertysystemmacros.hh index 2a987c5d1..8eb628a16 100644 --- a/opm/models/utils/propertysystemmacros.hh +++ b/opm/models/utils/propertysystemmacros.hh @@ -316,7 +316,7 @@ struct GetTypeTagInheritance> * NEW_TYPE_TAG(ProblemTypeTag, INHERITS_FROM(ModelTypeTag)); * SET_TAG_PROP(ProblemTypeTag, LinearSolver, SuperLUSolver); * \endcode -*/ + */ // template class to revert the order or a std::tuple's arguments. This is required to // make the properties of children defined on the right overwrite the properties of the @@ -345,25 +345,18 @@ struct GetTypeTagInheritance> typedef typename RevertedTupleOuter::template RevertedTupleInner::type type; }; -namespace PTag { -// this class needs to be located in the PTag namespace for reasons -// you don't really want to know... -template +template struct Splices { - typedef typename std::tuple<> tuple; + using tuple = std::tuple<>; }; -} // namespace PTag #define SET_SPLICES(TypeTagName, ...) \ -namespace PTag { \ -template<> \ -struct Splices \ +template \ +struct Splices \ { \ typedef RevertedTuple<__VA_ARGS__>::type tuple; \ }; \ -SPLICE_INFO_(TypeTagName, __VA_ARGS__) \ -} \ extern int semicolonHack_ #define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \ From 2ffc13e9c3a5c4b5671287951104f7fd9c0b6a9e Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Wed, 11 Mar 2020 13:17:08 +0100 Subject: [PATCH 03/12] [properties] splice mechanism almost working again --- opm/models/utils/propertysystem.hh | 132 ++++++++++++++++++----- opm/models/utils/propertysystemmacros.hh | 6 -- 2 files changed, 107 insertions(+), 31 deletions(-) diff --git a/opm/models/utils/propertysystem.hh b/opm/models/utils/propertysystem.hh index ea6febd0c..ec2a2cfd2 100644 --- a/opm/models/utils/propertysystem.hh +++ b/opm/models/utils/propertysystem.hh @@ -36,25 +36,12 @@ namespace Properties { //! a tag to mark properties as undefined struct UndefinedProperty {}; -template -struct SpatialDiscretizationSplice { using type = UndefinedProperty; }; - -namespace TTag { -struct MyTTag {}; -struct MySDTTag {}; -} - -template -struct SpatialDiscretizationSplice -{ using type = TTag::MySDTTag; }; - -template -struct VtkOutputFormat { using type = UndefinedProperty; }; - -template -struct VtkOutputFormat -{ static constexpr auto value = 2; }; - +template +struct Splices +{ + using tuple = std::tuple<>; +}; + //! implementation details for template meta programming namespace Detail { @@ -145,7 +132,97 @@ struct GetDefined> typename GetNextTypeTag, void>::type>; }; -//! helper struct to extract get the Property specilization given a TypeTag, asserts that the property is defined + +//! check if a splice S is defined +template +constexpr auto isDefinedSplice(int) +-> decltype(std::integral_constant>::value>{}) +{ return {}; } + +//! fall back if a splice is defined +template +constexpr std::true_type isDefinedSplice(...) { return {}; } + +template +struct GetSplicesTypeTags; + +template +struct GetNextSplicesTypeTag; + +template +struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> +{ using tuple = typename GetSplicesTypeTags::tuple; }; + +template +struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> +{ using tuple = std::tuple<>; }; + +template +struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> +{ using tuple = typename GetSplicesTypeTags>>::tuple; }; + +template +struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> +{ using tuple = typename GetSplicesTypeTags>::tuple; }; + +template +struct GetSplicesTypeTags> +{ + using LastSplices = Splices; + using nexttuple = typename GetNextSplicesTypeTag, void>::tuple; + // originally intended +// using tuple = std::conditional_t(int{}), +// typename ConCatTuples::tuple, +// nexttuple>; + using tuple = std::conditional_t(int{}), + typename LastSplices::tuple, + typename GetNextSplicesTypeTag, void>::tuple>; +}; + +template +struct GetSplicesTypeTags> +{ + using FirstSplices = Splices; + using nexttuple = typename GetNextSplicesTypeTag, void>::tuple; + // originally intended +// using tuple = std::conditional_t(int{}), +// typename ConCatTuples::tuple, +// nexttuple>; + using tuple = std::conditional_t(int{}), + typename FirstSplices::tuple, + typename GetNextSplicesTypeTag, void>::tuple>; +}; + +} // end namespace Detail + +template +struct SpatialDiscretizationSplice { using type = UndefinedProperty; }; + +namespace TTag { +struct MyTTag {}; +struct MySDTTag {}; +} + +template +struct SpatialDiscretizationSplice +{ using type = TTag::MySDTTag; }; + +template +struct VtkOutputFormat { using type = UndefinedProperty; }; + +template +struct VtkOutputFormat +{ static constexpr auto value = 2; }; + +namespace TTag { +struct FvBaseDiscretization; +struct VcfvDiscretization; +struct MultiPhaseBaseModel; +} + +namespace Detail { + + //! helper struct to extract get the Property specilization given a TypeTag, asserts that the property is defined template class Property> struct GetPropImpl { @@ -157,14 +234,19 @@ struct GetPropImpl using testtype2 = std::conditional_t(int{}), QType, UndefinedProperty>; static_assert(!std::is_same::value, "VtkOutputFormat is undefined in MySDTTag!"); -// using testtype = typename Detail::GetDefined -// >::type; + using RType = Properties::VtkOutputFormat; + using testtype3 = std::conditional_t(int{}), RType, UndefinedProperty>; + static_assert(!std::is_same::value, "VtkOutputFormat is undefined in FvBaseDiscretization!"); + // works: +// using type = typename Detail::GetDefined +// >::type; + using tuple = typename GetSplicesTypeTags>::tuple; using type = typename Detail::GetDefined + typename ConCatTuples, tuple>::type >::type; static_assert(!std::is_same::value, "Property is undefined!"); }; diff --git a/opm/models/utils/propertysystemmacros.hh b/opm/models/utils/propertysystemmacros.hh index 8eb628a16..f18e18285 100644 --- a/opm/models/utils/propertysystemmacros.hh +++ b/opm/models/utils/propertysystemmacros.hh @@ -345,12 +345,6 @@ struct GetTypeTagInheritance> typedef typename RevertedTupleOuter::template RevertedTupleInner::type type; }; -template -struct Splices -{ - using tuple = std::tuple<>; -}; - #define SET_SPLICES(TypeTagName, ...) \ template \ struct Splices \ From 4f890ed37915deec521dab04844515d96ea38709 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Fri, 13 Mar 2020 11:25:43 +0100 Subject: [PATCH 04/12] [properties] continue with splice mechanism --- opm/models/common/multiphasebasemodel.hh | 7 +- .../discretization/common/fvbaseproperties.hh | 8 + opm/models/utils/basicproperties.hh | 3 +- opm/models/utils/propertysystem.hh | 147 +++++++----------- 4 files changed, 70 insertions(+), 95 deletions(-) diff --git a/opm/models/common/multiphasebasemodel.hh b/opm/models/common/multiphasebasemodel.hh index 40bd23e3a..b2fd150bb 100644 --- a/opm/models/common/multiphasebasemodel.hh +++ b/opm/models/common/multiphasebasemodel.hh @@ -50,6 +50,11 @@ class MultiPhaseBaseModel; BEGIN_PROPERTIES +namespace TTag { +struct ParallelBiCGStabLinearSolver; +struct FiniteDifferenceLocalLinearizer; +} + //! The generic type tag for problems using the immiscible multi-phase model NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(NumericModel, VtkMultiPhase, VtkTemperature)); @@ -59,7 +64,7 @@ NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(NumericModel, VtkMultiPhase, Vtk template struct Splices { - using tuple = std::tuple>; + using type = std::tuple>; }; //! Set the default spatial discretization diff --git a/opm/models/discretization/common/fvbaseproperties.hh b/opm/models/discretization/common/fvbaseproperties.hh index 1ebc9e96d..54ac34beb 100644 --- a/opm/models/discretization/common/fvbaseproperties.hh +++ b/opm/models/discretization/common/fvbaseproperties.hh @@ -51,6 +51,14 @@ NEW_TYPE_TAG(FvBaseDiscretization, //SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice); +template +struct Splices +{ +// using type = std::tuple, +// GetSplicePropType>; + using type = std::tuple; +}; //! use a parallel BiCGStab linear solver by default SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSolver); diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index bb77eb677..27a13982b 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -100,7 +100,7 @@ NEW_PROP_TAG(ThreadManager); NEW_PROP_TAG(NewtonMethod); NEW_PROP_TAG(SolutionVector); NEW_PROP_TAG(GlobalEqVector); -//NEW_PROP_TAG(VtkOutputFormat); +NEW_PROP_TAG(VtkOutputFormat); //! Specifies the type of a solution for a single degee of freedom NEW_PROP_TAG(PrimaryVariables); @@ -318,6 +318,7 @@ NEW_PROP_TAG(LinearSolverMaxError); NEW_PROP_TAG(LinearSolverSplice); NEW_PROP_TAG(LocalLinearizerSplice); +NEW_PROP_TAG(SpatialDiscretizationSplice); //! The discretization specific part of he implementing the Newton algorithm NEW_PROP_TAG(DiscNewtonMethod); diff --git a/opm/models/utils/propertysystem.hh b/opm/models/utils/propertysystem.hh index ec2a2cfd2..afa9d9567 100644 --- a/opm/models/utils/propertysystem.hh +++ b/opm/models/utils/propertysystem.hh @@ -39,7 +39,7 @@ struct UndefinedProperty {}; template struct Splices { - using tuple = std::tuple<>; + using type = std::tuple<>; }; @@ -133,124 +133,82 @@ struct GetDefined> }; +//! helper struct to get the first property that is defined in the TypeTag hierarchy +template +struct GetDefinedSplice; + +//! helper struct to iterate over the TypeTag hierarchy +template +struct GetNextSpliceTypeTag; + +template +struct GetNextSpliceTypeTag, std::enable_if_t(int{}), void>> +{ using type = typename GetDefinedSplice::type; }; + +template +struct GetNextSpliceTypeTag, std::enable_if_t(int{}), void>> +{ using type = std::tuple<>; }; + +template +struct GetNextSpliceTypeTag, std::enable_if_t(int{}), void>> +{ using type = typename GetDefinedSplice>>::type; }; + +template +struct GetNextSpliceTypeTag, std::enable_if_t(int{}), void>> +{ using type = typename GetDefinedSplice>::type; }; + //! check if a splice S is defined template constexpr auto isDefinedSplice(int) --> decltype(std::integral_constant>::value>{}) +-> decltype(std::integral_constant>::value>{}) { return {}; } //! fall back if a splice is defined template constexpr std::true_type isDefinedSplice(...) { return {}; } -template -struct GetSplicesTypeTags; - -template -struct GetNextSplicesTypeTag; - template -struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> -{ using tuple = typename GetSplicesTypeTags::tuple; }; - -template -struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> -{ using tuple = std::tuple<>; }; - -template -struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> -{ using tuple = typename GetSplicesTypeTags>>::tuple; }; - -template -struct GetNextSplicesTypeTag, std::enable_if_t(int{}), void>> -{ using tuple = typename GetSplicesTypeTags>::tuple; }; - -template -struct GetSplicesTypeTags> +struct GetDefinedSplice> { - using LastSplices = Splices; - using nexttuple = typename GetNextSplicesTypeTag, void>::tuple; - // originally intended -// using tuple = std::conditional_t(int{}), -// typename ConCatTuples::tuple, -// nexttuple>; - using tuple = std::conditional_t(int{}), - typename LastSplices::tuple, - typename GetNextSplicesTypeTag, void>::tuple>; + using LastSplice = Splices; + using nexttuple = typename GetNextSpliceTypeTag, void>::type; + + using type = std::conditional_t(int{}), + ConCatTuples, + nexttuple>; }; template -struct GetSplicesTypeTags> +struct GetDefinedSplice> { - using FirstSplices = Splices; - using nexttuple = typename GetNextSplicesTypeTag, void>::tuple; - // originally intended -// using tuple = std::conditional_t(int{}), -// typename ConCatTuples::tuple, -// nexttuple>; - using tuple = std::conditional_t(int{}), - typename FirstSplices::tuple, - typename GetNextSplicesTypeTag, void>::tuple>; + using FirstSplice = Splices; + using nexttuple = typename GetNextSpliceTypeTag, void>::type; + + using type = std::conditional_t(int{}), + ConCatTuples, + nexttuple>; }; -} // end namespace Detail - -template -struct SpatialDiscretizationSplice { using type = UndefinedProperty; }; - -namespace TTag { -struct MyTTag {}; -struct MySDTTag {}; -} - -template -struct SpatialDiscretizationSplice -{ using type = TTag::MySDTTag; }; - -template -struct VtkOutputFormat { using type = UndefinedProperty; }; - -template -struct VtkOutputFormat -{ static constexpr auto value = 2; }; - -namespace TTag { -struct FvBaseDiscretization; -struct VcfvDiscretization; -struct MultiPhaseBaseModel; -} - -namespace Detail { - - //! helper struct to extract get the Property specilization given a TypeTag, asserts that the property is defined +//! helper struct to extract get the Property specilization given a TypeTag, asserts that the property is defined template class Property> struct GetPropImpl { - using PType = Properties::SpatialDiscretizationSplice; - using testtype = std::conditional_t(int{}), PType, UndefinedProperty>; - static_assert(!std::is_same::value, "SpatialDiscretizationSplice is undefined in MyTTag!"); - - using QType = Properties::VtkOutputFormat; - using testtype2 = std::conditional_t(int{}), QType, UndefinedProperty>; - static_assert(!std::is_same::value, "VtkOutputFormat is undefined in MySDTTag!"); - - using RType = Properties::VtkOutputFormat; - using testtype3 = std::conditional_t(int{}), RType, UndefinedProperty>; - static_assert(!std::is_same::value, "VtkOutputFormat is undefined in FvBaseDiscretization!"); - - // works: -// using type = typename Detail::GetDefined -// >::type; - using tuple = typename GetSplicesTypeTags>::tuple; + using splice = typename Detail::GetDefinedSplice>::type; + using tuple = std::conditional_t>::value, std::tuple<>, splice>; using type = typename Detail::GetDefined, tuple>::type + ConCatTuples, tuple> >::type; static_assert(!std::is_same::value, "Property is undefined!"); }; +template class Property> +struct GetSplicePropImpl +{ + using type = typename Detail::GetDefined>::type; + static_assert(!std::is_same>::value, "Splice is undefined!"); +}; + } // end namespace Detail } // end namespace Property @@ -267,6 +225,9 @@ using GetProp = typename Properties::Detail::GetPropImpl::typ template class Property> using GetPropType = typename Properties::Detail::GetPropImpl::type::type; +template class Property> +using GetSplicePropType = typename Properties::Detail::GetSplicePropImpl::type::type; + //! get the value data member of a property template class Property> constexpr auto getPropValue() { return Properties::Detail::GetPropImpl::type::value; } From 54d665a532bd505827de9dd17a8c32ac9eba6584 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Fri, 13 Mar 2020 16:08:49 +0100 Subject: [PATCH 05/12] [properties] recover splice mechanism --- opm/models/common/multiphasebasemodel.hh | 10 ++----- .../discretization/common/fvbaseproperties.hh | 13 ++-------- opm/models/parallel/threadmanager.hh | 4 --- opm/models/utils/propertysystem.hh | 26 ++++++++++++------- opm/models/utils/propertysystemmacros.hh | 24 ++++++++++++----- 5 files changed, 38 insertions(+), 39 deletions(-) diff --git a/opm/models/common/multiphasebasemodel.hh b/opm/models/common/multiphasebasemodel.hh index b2fd150bb..45721966b 100644 --- a/opm/models/common/multiphasebasemodel.hh +++ b/opm/models/common/multiphasebasemodel.hh @@ -56,16 +56,10 @@ struct FiniteDifferenceLocalLinearizer; } //! The generic type tag for problems using the immiscible multi-phase model -NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(NumericModel, VtkMultiPhase, VtkTemperature)); +NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(VtkMultiPhase, VtkTemperature)); //! Specify the splices of the MultiPhaseBaseModel type tag -//NEW_PROP_TAG(SpatialDiscretizationSplice); -//SET_SPLICES(MultiPhaseBaseModel, SpatialDiscretizationSplice); -template -struct Splices -{ - using type = std::tuple>; -}; +SET_SPLICE(MultiPhaseBaseModel, SpatialDiscretizationSplice); //! Set the default spatial discretization //! diff --git a/opm/models/discretization/common/fvbaseproperties.hh b/opm/models/discretization/common/fvbaseproperties.hh index 54ac34beb..59b982ca9 100644 --- a/opm/models/discretization/common/fvbaseproperties.hh +++ b/opm/models/discretization/common/fvbaseproperties.hh @@ -48,17 +48,7 @@ NEW_TYPE_TAG(FvBaseDiscretization, //! set the splices for the finite volume discretizations - - -//SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice); -template -struct Splices -{ -// using type = std::tuple, -// GetSplicePropType>; - using type = std::tuple; -}; +SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice); //! use a parallel BiCGStab linear solver by default SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSolver); @@ -66,6 +56,7 @@ SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSol //! by default, use finite differences to linearize the system of PDEs SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalLinearizer); + /*! * \brief Representation of a function evaluation and all necessary derivatives with * regard to the intensive quantities of the primary variables. diff --git a/opm/models/parallel/threadmanager.hh b/opm/models/parallel/threadmanager.hh index 967831d5b..15f408133 100644 --- a/opm/models/parallel/threadmanager.hh +++ b/opm/models/parallel/threadmanager.hh @@ -126,10 +126,6 @@ private: static int numThreads_; }; -namespace Properties { - SET_TYPE_PROP(NumericModel, ThreadManager, Opm::ThreadManager); -} - template int ThreadManager::numThreads_ = 1; } // namespace Opm diff --git a/opm/models/utils/propertysystem.hh b/opm/models/utils/propertysystem.hh index afa9d9567..6c49db5ec 100644 --- a/opm/models/utils/propertysystem.hh +++ b/opm/models/utils/propertysystem.hh @@ -41,7 +41,6 @@ struct Splices { using type = std::tuple<>; }; - //! implementation details for template meta programming namespace Detail { @@ -171,7 +170,12 @@ template struct GetDefinedSplice> { using LastSplice = Splices; - using nexttuple = typename GetNextSpliceTypeTag, void>::type; + using nexttuple = typename GetNextSpliceTypeTag, + typename LastSplice::type + >, + void>::type; using type = std::conditional_t(int{}), ConCatTuples, @@ -182,7 +186,12 @@ template struct GetDefinedSplice> { using FirstSplice = Splices; - using nexttuple = typename GetNextSpliceTypeTag, void>::type; + using nexttuple = typename GetNextSpliceTypeTag, + typename FirstSplice::type + >, + void>::type; using type = std::conditional_t(int{}), ConCatTuples, @@ -193,8 +202,7 @@ struct GetDefinedSplice> template class Property> struct GetPropImpl { - using splice = typename Detail::GetDefinedSplice>::type; - using tuple = std::conditional_t>::value, std::tuple<>, splice>; + using tuple = typename Detail::GetDefinedSplice>::type; using type = typename Detail::GetDefined, tuple> @@ -202,10 +210,10 @@ struct GetPropImpl static_assert(!std::is_same::value, "Property is undefined!"); }; -template class Property> +template class Property> struct GetSplicePropImpl { - using type = typename Detail::GetDefined>::type; + using type = typename Detail::GetDefined>::type; static_assert(!std::is_same>::value, "Splice is undefined!"); }; @@ -225,8 +233,8 @@ using GetProp = typename Properties::Detail::GetPropImpl::typ template class Property> using GetPropType = typename Properties::Detail::GetPropImpl::type::type; -template class Property> -using GetSplicePropType = typename Properties::Detail::GetSplicePropImpl::type::type; +template class Property> +using GetSplicePropType = typename Properties::Detail::GetSplicePropImpl::type::type; //! get the value data member of a property template class Property> diff --git a/opm/models/utils/propertysystemmacros.hh b/opm/models/utils/propertysystemmacros.hh index f18e18285..437dab89b 100644 --- a/opm/models/utils/propertysystemmacros.hh +++ b/opm/models/utils/propertysystemmacros.hh @@ -345,14 +345,24 @@ struct GetTypeTagInheritance> typedef typename RevertedTupleOuter::template RevertedTupleInner::type type; }; -#define SET_SPLICES(TypeTagName, ...) \ -template \ -struct Splices \ -{ \ - typedef RevertedTuple<__VA_ARGS__>::type tuple; \ -}; \ +#define SET_SPLICE(TypeTagName, SpliceName) \ +template \ +struct Splices \ +{ \ + using type = std::tuple>; \ +}; \ extern int semicolonHack_ - + +#define SET_SPLICES(TypeTagName, SpliceName1, SpliceName2) \ +template \ +struct Splices \ +{ \ + using type = std::tuple, \ + GetSplicePropType>; \ +}; \ +extern int semicolonHack_ + + #define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \ template \ struct PropTagName From 5e411a8665a2ab4596c2a7b7f32a3ff1434273be Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Tue, 24 Mar 2020 17:47:11 +0100 Subject: [PATCH 06/12] fix test suite --- examples/lens_immiscible_ecfv_ad.cpp | 4 +- examples/lens_immiscible_ecfv_ad_23.cpp | 6 +- examples/lens_immiscible_ecfv_ad_cu1.cpp | 4 +- examples/lens_immiscible_ecfv_ad_cu2.cpp | 4 +- examples/problems/co2injectionproblem.hh | 4 +- examples/problems/fingerproblem.hh | 1 + examples/problems/groundwaterproblem.hh | 8 ++ examples/problems/lensproblem.hh | 7 ++ examples/problems/reservoirproblem.hh | 5 ++ opm/models/blackoil/blackoilmodel.hh | 5 +- opm/models/common/multiphasebasemodel.hh | 5 -- .../discretization/common/fvbaseproperties.hh | 4 +- opm/models/io/dgfvanguard.hh | 14 +--- opm/models/utils/basicproperties.hh | 84 ++++++++++++++++++- opm/models/utils/start.hh | 1 + tests/models/test_propertysystem.cpp | 22 +---- 16 files changed, 124 insertions(+), 54 deletions(-) diff --git a/examples/lens_immiscible_ecfv_ad.cpp b/examples/lens_immiscible_ecfv_ad.cpp index 9a91e1ab7..0df0537cd 100644 --- a/examples/lens_immiscible_ecfv_ad.cpp +++ b/examples/lens_immiscible_ecfv_ad.cpp @@ -28,10 +28,10 @@ */ #include "config.h" -#include "lens_immiscible_ecfv_ad.hh" - #include +#include "lens_immiscible_ecfv_ad.hh" + int main(int argc, char **argv) { typedef TTAG(LensProblemEcfvAd) ProblemTypeTag; diff --git a/examples/lens_immiscible_ecfv_ad_23.cpp b/examples/lens_immiscible_ecfv_ad_23.cpp index 9c79a7587..7a24e7eb6 100644 --- a/examples/lens_immiscible_ecfv_ad_23.cpp +++ b/examples/lens_immiscible_ecfv_ad_23.cpp @@ -28,11 +28,13 @@ */ #include "config.h" -#include "lens_immiscible_ecfv_ad.hh" - #include #include +#include + +#include "lens_immiscible_ecfv_ad.hh" + BEGIN_PROPERTIES // Use Dune-grid's GeometryGrid< YaspGrid > diff --git a/examples/lens_immiscible_ecfv_ad_cu1.cpp b/examples/lens_immiscible_ecfv_ad_cu1.cpp index bcfc7142c..b0aff7f66 100644 --- a/examples/lens_immiscible_ecfv_ad_cu1.cpp +++ b/examples/lens_immiscible_ecfv_ad_cu1.cpp @@ -34,10 +34,10 @@ */ #include "config.h" -#include "lens_immiscible_ecfv_ad.hh" - #include +#include "lens_immiscible_ecfv_ad.hh" + // fake forward declaration to prevent esoteric compiler warning int mainCU1(int argc, char **argv); diff --git a/examples/lens_immiscible_ecfv_ad_cu2.cpp b/examples/lens_immiscible_ecfv_ad_cu2.cpp index c6d1d5df8..7dede5a9f 100644 --- a/examples/lens_immiscible_ecfv_ad_cu2.cpp +++ b/examples/lens_immiscible_ecfv_ad_cu2.cpp @@ -34,10 +34,10 @@ */ #include "config.h" -#include "lens_immiscible_ecfv_ad.hh" - #include +#include "lens_immiscible_ecfv_ad.hh" + // fake forward declaration to prevent esoteric compiler warning int mainCU2(int argc, char **argv); diff --git a/examples/problems/co2injectionproblem.hh b/examples/problems/co2injectionproblem.hh index cfeb36c1b..3f5a7b531 100644 --- a/examples/problems/co2injectionproblem.hh +++ b/examples/problems/co2injectionproblem.hh @@ -73,7 +73,9 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(Co2InjectionBaseProblem); // declare the CO2 injection problem specific property tags - +NEW_PROP_TAG(MaxDepth); +NEW_PROP_TAG(Temperature); +NEW_PROP_TAG(SimulationName); // Set the grid type SET_TYPE_PROP(Co2InjectionBaseProblem, Grid, Dune::YaspGrid<2>); diff --git a/examples/problems/fingerproblem.hh b/examples/problems/fingerproblem.hh index b18978cfe..7e4db6bec 100644 --- a/examples/problems/fingerproblem.hh +++ b/examples/problems/fingerproblem.hh @@ -77,6 +77,7 @@ SET_TYPE_PROP(FingerBaseProblem, #endif // declare the properties used by the finger problem +NEW_PROP_TAG(InitialWaterSaturation); // Set the problem property SET_TYPE_PROP(FingerBaseProblem, Problem, Opm::FingerProblem); diff --git a/examples/problems/groundwaterproblem.hh b/examples/problems/groundwaterproblem.hh index 0d9393e2d..4f62c59ee 100644 --- a/examples/problems/groundwaterproblem.hh +++ b/examples/problems/groundwaterproblem.hh @@ -55,6 +55,14 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(GroundWaterBaseProblem); +NEW_PROP_TAG(LensLowerLeftX); +NEW_PROP_TAG(LensLowerLeftY); +NEW_PROP_TAG(LensLowerLeftZ); +NEW_PROP_TAG(LensUpperRightX); +NEW_PROP_TAG(LensUpperRightY); +NEW_PROP_TAG(LensUpperRightZ); +NEW_PROP_TAG(Permeability); +NEW_PROP_TAG(PermeabilityLens); SET_PROP(GroundWaterBaseProblem, Fluid) { diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index bb7575739..ecf3feaf4 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -61,6 +61,13 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(LensBaseProblem, INHERITS_FROM(StructuredGridVanguard)); // declare the properties specific for the lens problem +NEW_PROP_TAG(LensLowerLeftX); +NEW_PROP_TAG(LensLowerLeftY); +NEW_PROP_TAG(LensLowerLeftZ); +NEW_PROP_TAG(LensUpperRightX); +NEW_PROP_TAG(LensUpperRightY); +NEW_PROP_TAG(LensUpperRightZ); + // Set the problem property SET_TYPE_PROP(LensBaseProblem, Problem, Opm::LensProblem); diff --git a/examples/problems/reservoirproblem.hh b/examples/problems/reservoirproblem.hh index c1bfed2db..5598ce4c1 100644 --- a/examples/problems/reservoirproblem.hh +++ b/examples/problems/reservoirproblem.hh @@ -62,8 +62,13 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ReservoirBaseProblem); // Maximum depth of the reservoir +NEW_PROP_TAG(MaxDepth); + // The temperature inside the reservoir +NEW_PROP_TAG(Temperature); + // The width of producer/injector wells as a fraction of the width of the spatial domain +NEW_PROP_TAG(WellWidth); // Set the grid type SET_TYPE_PROP(ReservoirBaseProblem, Grid, Dune::YaspGrid<2>); diff --git a/opm/models/blackoil/blackoilmodel.hh b/opm/models/blackoil/blackoilmodel.hh index 42ada382c..4d240da2d 100644 --- a/opm/models/blackoil/blackoilmodel.hh +++ b/opm/models/blackoil/blackoilmodel.hh @@ -153,12 +153,9 @@ private: public: typedef Scalar type; - static const Scalar value; + static constexpr Scalar value = 1.0/(30.0*4184.0*alpha); }; -PROP_STATIC_CONST_MEMBER_DEFINITION_PREFIX_(BlackOilModel, BlackOilEnergyScalingFactor) - ::value = 1.0/(30*4184.0*alpha); - // by default, ebos formulates the conservation equations in terms of mass not surface // volumes SET_BOOL_PROP(BlackOilModel, BlackoilConserveSurfaceVolume, false); diff --git a/opm/models/common/multiphasebasemodel.hh b/opm/models/common/multiphasebasemodel.hh index 45721966b..087121d4b 100644 --- a/opm/models/common/multiphasebasemodel.hh +++ b/opm/models/common/multiphasebasemodel.hh @@ -50,11 +50,6 @@ class MultiPhaseBaseModel; BEGIN_PROPERTIES -namespace TTag { -struct ParallelBiCGStabLinearSolver; -struct FiniteDifferenceLocalLinearizer; -} - //! The generic type tag for problems using the immiscible multi-phase model NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(VtkMultiPhase, VtkTemperature)); diff --git a/opm/models/discretization/common/fvbaseproperties.hh b/opm/models/discretization/common/fvbaseproperties.hh index 59b982ca9..90cd8cbd8 100644 --- a/opm/models/discretization/common/fvbaseproperties.hh +++ b/opm/models/discretization/common/fvbaseproperties.hh @@ -31,10 +31,10 @@ #define EWOMS_FV_BASE_PROPERTIES_HH #include "fvbasenewtonmethod.hh" -#include "fvbaseproperties.hh" #include "fvbasefdlocallinearizer.hh" #include +#include #include #include @@ -254,6 +254,8 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL //! Specify if experimental features should be enabled or not. +SET_TYPE_PROP(NumericModel, Vanguard, Opm::DgfVanguard); + END_PROPERTIES #endif diff --git a/opm/models/io/dgfvanguard.hh b/opm/models/io/dgfvanguard.hh index 7e90e7509..69a55cfdf 100644 --- a/opm/models/io/dgfvanguard.hh +++ b/opm/models/io/dgfvanguard.hh @@ -41,7 +41,6 @@ BEGIN_PROPERTIES - END_PROPERTIES namespace Opm { @@ -67,13 +66,8 @@ public: */ static void registerParameters() { -// #define EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description) -// ::Opm::Parameters::registerParam( -// #ParamName, #ParamName, Description) -// EWOMS_REGISTER_PARAM(TypeTag, std::string, GridFile, -// "The file name of the DGF file to load"); - ::Opm::Parameters::template registerParam - ("GridFile", "GridFile", "The file name of the DGF file to load"); + EWOMS_REGISTER_PARAM(TypeTag, std::string, GridFile, + "The file name of the DGF file to load"); EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements, "The number of global refinements of the grid " "executed after it was loaded"); @@ -197,10 +191,6 @@ private: FractureMapper fractureMapper_; }; -namespace Properties { -SET_TYPE_PROP(NumericModel, Vanguard, Opm::DgfVanguard); -} - } // namespace Opm #endif diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 27a13982b..1ce23c5ed 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -54,6 +54,7 @@ #include + BEGIN_PROPERTIES /////////////////////////////////// @@ -205,6 +206,75 @@ NEW_PROP_TAG(VtkWriteSolidInternalEnergy); NEW_PROP_TAG(VtkWriteThermalConductivity); NEW_PROP_TAG(VtkWriteInternalEnergies); NEW_PROP_TAG(VtkWriteEnthalpies); +NEW_PROP_TAG(VtkWriteMassFractions); +NEW_PROP_TAG(VtkWriteMoleFractions); +NEW_PROP_TAG(VtkWriteTotalMassFractions); +NEW_PROP_TAG(VtkWriteTotalMoleFractions); +NEW_PROP_TAG(VtkWriteMolarities); +NEW_PROP_TAG(VtkWriteFugacities); +NEW_PROP_TAG(VtkWriteFugacityCoeffs); +NEW_PROP_TAG(VtkWriteEffectiveDiffusionCoefficients); +NEW_PROP_TAG(VtkWriteDiffusionCoefficients); +NEW_PROP_TAG(VtkWriteTortuosities); +NEW_PROP_TAG(VtkWritePhasePresence); +NEW_PROP_TAG(VtkWriteSolventSaturation); +NEW_PROP_TAG(VtkWriteSolventDensity); +NEW_PROP_TAG(VtkWriteSolventViscosity); +NEW_PROP_TAG(VtkWriteSolventMobility); +NEW_PROP_TAG(EnableSolvent); +NEW_PROP_TAG(BlackoilConserveSurfaceVolume); +NEW_PROP_TAG(VtkWritePolymerConcentration); +NEW_PROP_TAG(VtkWritePolymerDeadPoreVolume); +NEW_PROP_TAG(VtkWritePolymerViscosityCorrection); +NEW_PROP_TAG(VtkWriteWaterViscosityCorrection); +NEW_PROP_TAG(VtkWritePolymerRockDensity); +NEW_PROP_TAG(VtkWritePolymerAdsorption); +NEW_PROP_TAG(EnablePolymer); +NEW_PROP_TAG(EnablePolymerMW); +NEW_PROP_TAG(VtkWriteRockInternalEnergy); +NEW_PROP_TAG(VtkWriteTotalThermalConductivity); +NEW_PROP_TAG(VtkWriteFluidInternalEnergies); +NEW_PROP_TAG(VtkWriteFluidEnthalpies); +NEW_PROP_TAG(BlackOilEnergyScalingFactor); +NEW_PROP_TAG(EnableTemperature); +NEW_PROP_TAG(EnableFoam); +NEW_PROP_TAG(EnableBrine); +NEW_PROP_TAG(DpMaxRel); +NEW_PROP_TAG(DsMax); +NEW_PROP_TAG(PriVarOscilationThreshold); +NEW_PROP_TAG(VtkWriteGasDissolutionFactor); +NEW_PROP_TAG(VtkWriteOilVaporizationFactor); +NEW_PROP_TAG(VtkWriteOilFormationVolumeFactor); +NEW_PROP_TAG(VtkWriteGasFormationVolumeFactor); +NEW_PROP_TAG(VtkWriteWaterFormationVolumeFactor); +NEW_PROP_TAG(VtkWriteOilSaturationPressure); +NEW_PROP_TAG(VtkWriteGasSaturationPressure); +NEW_PROP_TAG(VtkWriteSaturationRatios); +NEW_PROP_TAG(VtkWriteSaturatedOilGasDissolutionFactor); +NEW_PROP_TAG(VtkWriteSaturatedGasOilVaporizationFactor); +NEW_PROP_TAG(VtkWritePrimaryVarsMeaning); +NEW_PROP_TAG(VtkWriteFractureSaturations); +NEW_PROP_TAG(VtkWriteFractureMobilities); +NEW_PROP_TAG(VtkWriteFractureRelativePermeabilities); +NEW_PROP_TAG(VtkWriteFracturePorosity); +NEW_PROP_TAG(VtkWriteFractureIntrinsicPermeabilities); +NEW_PROP_TAG(VtkWriteFractureFilterVelocities); +NEW_PROP_TAG(VtkWriteFractureVolumeFraction); +NEW_PROP_TAG(UseTwoPointGradients); + +NEW_PROP_TAG(PvsVerbosity); +NEW_PROP_TAG(PvsPressureBaseWeight); +NEW_PROP_TAG(PvsSaturationsBaseWeight); +NEW_PROP_TAG(PvsMoleFractionsBaseWeight); +NEW_PROP_TAG(NcpPressureBaseWeight); +NEW_PROP_TAG(NcpSaturationsBaseWeight); +NEW_PROP_TAG(NcpFugacitiesBaseWeight); +NEW_PROP_TAG(FluidSystemPressureLow); +NEW_PROP_TAG(FluidSystemPressureHigh); +NEW_PROP_TAG(FluidSystemNumPressure); +NEW_PROP_TAG(FluidSystemTemperatureLow); +NEW_PROP_TAG(FluidSystemTemperatureHigh); +NEW_PROP_TAG(FluidSystemNumTemperature); NEW_PROP_TAG(IntensiveQuantities); NEW_PROP_TAG(BoundaryContext); @@ -223,6 +293,7 @@ NEW_PROP_TAG(DomainSizeY); NEW_PROP_TAG(DomainSizeZ); NEW_PROP_TAG(ElementMapper); NEW_PROP_TAG(EnableAsyncVtkOutput); +NEW_PROP_TAG(EnableDiffusion); NEW_PROP_TAG(EnableEnergy); NEW_PROP_TAG(EnableGravity); NEW_PROP_TAG(EnableGridAdaptation); @@ -253,6 +324,8 @@ NEW_PROP_TAG(UseVolumetricResidual); NEW_PROP_TAG(VertexMapper); NEW_PROP_TAG(SolidEnergyLawParams); NEW_PROP_TAG(ThermalConductionLawParams); +NEW_PROP_TAG(FlashSolver); +NEW_PROP_TAG(FlashTolerance); NEW_PROP_TAG(BaseProblem); NEW_PROP_TAG(ConstraintsContext); @@ -275,11 +348,16 @@ NEW_PROP_TAG(Overlap); NEW_PROP_TAG(OverlappingScalarProduct); NEW_PROP_TAG(OverlappingLinearOperator); +NEW_PROP_TAG(LiquidPhaseIndex); +NEW_PROP_TAG(GasPhaseIndex); +NEW_PROP_TAG(LiquidComponentIndex); +NEW_PROP_TAG(GasComponentIndex); +NEW_PROP_TAG(WettingFluid); +NEW_PROP_TAG(NonWettingFluid); //! the preconditioner used by the linear solver NEW_PROP_TAG(PreconditionerWrapper); - //! The floating point type used internally by the linear solver NEW_PROP_TAG(LinearSolverScalar); @@ -316,6 +394,9 @@ NEW_PROP_TAG(LinearSolverMaxIterations); NEW_PROP_TAG(LinearSolverMaxError); +NEW_PROP_TAG(GMResRestart); +NEW_PROP_TAG(LinearSolverWrapper); + NEW_PROP_TAG(LinearSolverSplice); NEW_PROP_TAG(LocalLinearizerSplice); NEW_PROP_TAG(SpatialDiscretizationSplice); @@ -428,7 +509,6 @@ SET_SCALAR_PROP(NumericModel, RestartTime, -1e35); //! By default, do not force any time steps SET_STRING_PROP(NumericModel, PredeterminedTimeStepsFile, ""); - END_PROPERTIES #endif diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index b48d46f93..1b09980fa 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -27,6 +27,7 @@ #ifndef EWOMS_START_HH #define EWOMS_START_HH +#include #include // the following header is not required here, but it must be included before // dune/common/densematrix.hh because of some c++ ideosyncrasies diff --git a/tests/models/test_propertysystem.cpp b/tests/models/test_propertysystem.cpp index 3d7cc76ac..a7071e9be 100644 --- a/tests/models/test_propertysystem.cpp +++ b/tests/models/test_propertysystem.cpp @@ -32,6 +32,7 @@ #include "config.h" #include +#include #include @@ -120,10 +121,6 @@ SET_INT_PROP(Pickup, Payload, 5); SET_INT_PROP(HummerH1, TopSpeed, GET_PROP_VALUE(TTAG(Pickup), TopSpeed)); -/////////////////// -// Unmount the canon from the Hummer -UNSET_PROP(HummerH1, CanonCaliber); - END_PROPERTIES @@ -176,23 +173,6 @@ int main() std::cout << "(HummerH1, GasUsage) = " << GET_PROP_VALUE(TTAG(HummerH1), GasUsage) << "\n"; std::cout << "(HummerH1, Payload) = " << GET_PROP_VALUE(TTAG(HummerH1), Payload) << "\n"; std::cout << "(HummerH1, AutomaticTransmission) = " << GET_PROP_VALUE(TTAG(HummerH1), AutomaticTransmission) << "\n"; - // CanonCaliber is explcitly unset for the Hummer -> this would not compile: - // std::cout << "(HummerH1, CanonCaliber) = " << GET_PROP_VALUE(TTAG(HummerH1), CanonCaliber) << "\n"; - - std::cout << "\n"; - std::cout << "---------------------------------------\n"; - std::cout << "-- Diagnostic messages\n"; - std::cout << "---------------------------------------\n"; - - std::cout << "---- All properties for Sedan ---\n"; - Opm::Properties::printValues(); - - std::cout << "---- Message for (HummerH1, CanonCaliber) ---\n" - << PROP_DIAGNOSTIC(TTAG(HummerH1), CanonCaliber); - std::cout << "---- Message for (HummerH1, GasUsage) ---\n" - << PROP_DIAGNOSTIC(TTAG(HummerH1), GasUsage); - std::cout << "---- Message for (HummerH1, AutomaticTransmission) ---\n" - << PROP_DIAGNOSTIC(TTAG(HummerH1), AutomaticTransmission); return 0; } From de2ca522ff3207611d34a3a529c113aed5c8ed88 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Wed, 13 May 2020 15:24:57 +0200 Subject: [PATCH 07/12] [properties] redistribute property tag definitions Minimize changes compared to master. Avoid having the one and only file for property tag definitions. --- examples/problems/co2injectionproblem.hh | 7 + opm/models/blackoil/blackoilnewtonmethod.hh | 9 + opm/models/blackoil/blackoilproperties.hh | 17 +- opm/models/common/multiphasebasemodel.hh | 2 + opm/models/common/multiphasebaseproperties.hh | 21 +- .../discretefractureproperties.hh | 1 + .../common/fvbasediscretization.hh | 1 + .../common/fvbaseextensivequantities.hh | 2 + .../common/fvbasefdlocallinearizer.hh | 3 + .../common/fvbasenewtonconvergencewriter.hh | 11 +- .../common/fvbasenewtonmethod.hh | 12 +- .../discretization/common/fvbaseproblem.hh | 7 + .../discretization/common/fvbaseproperties.hh | 80 +++- .../discretization/vcfv/vcfvproperties.hh | 1 + opm/models/flash/flashproperties.hh | 9 +- opm/models/immiscible/immiscibleproperties.hh | 9 +- opm/models/io/baseoutputmodule.hh | 17 +- opm/models/io/basevanguard.hh | 5 - opm/models/io/vtkblackoilenergymodule.hh | 4 + opm/models/io/vtkblackoilmodule.hh | 11 + opm/models/io/vtkblackoilpolymermodule.hh | 6 + opm/models/io/vtkblackoilsolventmodule.hh | 4 + opm/models/io/vtkcompositionmodule.hh | 7 + opm/models/io/vtkdiffusionmodule.hh | 3 + opm/models/io/vtkdiscretefracturemodule.hh | 7 + opm/models/io/vtkenergymodule.hh | 4 + opm/models/io/vtkmultiphasemodule.hh | 12 + opm/models/io/vtkphasepresencemodule.hh | 1 + opm/models/io/vtkprimaryvarsmodule.hh | 3 + opm/models/io/vtktemperaturemodule.hh | 1 + opm/models/ncp/ncpnewtonmethod.hh | 10 +- opm/models/ncp/ncpproperties.hh | 8 +- opm/models/nonlinear/newtonmethod.hh | 35 +- opm/models/nonlinear/nullconvergencewriter.hh | 3 +- opm/models/pvs/pvsnewtonmethod.hh | 9 + opm/models/pvs/pvsproperties.hh | 7 +- opm/models/richards/richardsproperties.hh | 8 +- opm/models/utils/basicproperties.hh | 348 ++---------------- opm/models/utils/parametersystem.hh | 6 +- opm/models/utils/simulator.hh | 1 + .../linalg/istlpreconditionerwrappers.hh | 4 +- opm/simulators/linalg/istlsolverwrappers.hh | 6 +- opm/simulators/linalg/linalgproperties.hh | 104 ++++++ opm/simulators/linalg/parallelamgbackend.hh | 2 +- opm/simulators/linalg/parallelbasebackend.hh | 42 +-- .../linalg/parallelbicgstabbackend.hh | 1 + opm/simulators/linalg/parallelistlbackend.hh | 4 +- opm/simulators/linalg/superlubackend.hh | 1 + 48 files changed, 403 insertions(+), 473 deletions(-) create mode 100644 opm/simulators/linalg/linalgproperties.hh diff --git a/examples/problems/co2injectionproblem.hh b/examples/problems/co2injectionproblem.hh index 3f5a7b531..1a2b53e1a 100644 --- a/examples/problems/co2injectionproblem.hh +++ b/examples/problems/co2injectionproblem.hh @@ -73,6 +73,13 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(Co2InjectionBaseProblem); // declare the CO2 injection problem specific property tags +NEW_PROP_TAG(FluidSystemPressureLow); +NEW_PROP_TAG(FluidSystemPressureHigh); +NEW_PROP_TAG(FluidSystemNumPressure); +NEW_PROP_TAG(FluidSystemTemperatureLow); +NEW_PROP_TAG(FluidSystemTemperatureHigh); +NEW_PROP_TAG(FluidSystemNumTemperature); + NEW_PROP_TAG(MaxDepth); NEW_PROP_TAG(Temperature); NEW_PROP_TAG(SimulationName); diff --git a/opm/models/blackoil/blackoilnewtonmethod.hh b/opm/models/blackoil/blackoilnewtonmethod.hh index 3ff53148f..3abe41914 100644 --- a/opm/models/blackoil/blackoilnewtonmethod.hh +++ b/opm/models/blackoil/blackoilnewtonmethod.hh @@ -31,11 +31,20 @@ #include "blackoilproperties.hh" #include +#include #include BEGIN_PROPERTIES +template +struct DiscNewtonMethod; + +NEW_PROP_TAG(DpMaxRel); +NEW_PROP_TAG(DsMax); +NEW_PROP_TAG(PriVarOscilationThreshold); +NEW_PROP_TAG(ProjectSaturations); + SET_SCALAR_PROP(NewtonMethod, DpMaxRel, 0.3); SET_SCALAR_PROP(NewtonMethod, DsMax, 0.2); SET_SCALAR_PROP(NewtonMethod, PriVarOscilationThreshold, 1e-5); diff --git a/opm/models/blackoil/blackoilproperties.hh b/opm/models/blackoil/blackoilproperties.hh index 3160c39f0..e84cdf61b 100644 --- a/opm/models/blackoil/blackoilproperties.hh +++ b/opm/models/blackoil/blackoilproperties.hh @@ -35,24 +35,24 @@ BEGIN_PROPERTIES //! Specifies if the simulation should write output files that are //! compatible with those produced by the commercial Eclipse simulator -//! The material law for thermal conduction -//! The parameters of the material law for thermal conduction -//! The material law for energy storage of the rock -//! The parameters for material law for energy storage of the rock +NEW_PROP_TAG(EnableEclipseOutput); //! Enable the ECL-blackoil extension for solvents. ("Second gas") +NEW_PROP_TAG(EnableSolvent); //! Enable the ECL-blackoil extension for polymer. +NEW_PROP_TAG(EnablePolymer); //! Enable the tracking polymer molecular weight tracking and related functionalities +NEW_PROP_TAG(EnablePolymerMW); //! Enable surface volume scaling +NEW_PROP_TAG(BlackoilConserveSurfaceVolume); //! Enable the ECL-blackoil extension for foam +NEW_PROP_TAG(EnableFoam); //! Enable the ECL-blackoil extension for salt +NEW_PROP_TAG(EnableBrine); //! Allow the spatial and temporal domains to exhibit non-constant temperature //! in the black-oil model - -//! Enable the ECL-blackoil extension for energy conservation -//! -//! Setting this property to true implies EnableTemperature. +NEW_PROP_TAG(EnableTemperature); //! The relative weight of the residual of the energy equation compared to the mass //! residuals @@ -61,6 +61,7 @@ BEGIN_PROPERTIES //! of unmodified dune-istl linear solvers cannot weight the individual equations. if the //! energy equation is not scaled, its absolute value is normally several orders of //! magnitude larger than that of the mass balance equations +NEW_PROP_TAG(BlackOilEnergyScalingFactor); END_PROPERTIES diff --git a/opm/models/common/multiphasebasemodel.hh b/opm/models/common/multiphasebasemodel.hh index 087121d4b..9d4871619 100644 --- a/opm/models/common/multiphasebasemodel.hh +++ b/opm/models/common/multiphasebasemodel.hh @@ -36,6 +36,8 @@ #include #include +#include +#include #include #include diff --git a/opm/models/common/multiphasebaseproperties.hh b/opm/models/common/multiphasebaseproperties.hh index 99a52d302..f9c48b87f 100644 --- a/opm/models/common/multiphasebaseproperties.hh +++ b/opm/models/common/multiphasebaseproperties.hh @@ -30,26 +30,41 @@ #ifndef EWOMS_MULTI_PHASE_BASE_PROPERTIES_HH #define EWOMS_MULTI_PHASE_BASE_PROPERTIES_HH -#include -#include -#include +#include BEGIN_PROPERTIES //! The splice to be used for the spatial discretization +NEW_PROP_TAG(SpatialDiscretizationSplice); //! Number of fluid phases in the system +NEW_PROP_TAG(NumPhases); //! Number of chemical species in the system +NEW_PROP_TAG(NumComponents); //! Enumerations used by the model +NEW_PROP_TAG(Indices); //! The material law which ought to be used (extracted from the spatial parameters) +NEW_PROP_TAG(MaterialLaw); //! The context material law (extracted from the spatial parameters) +NEW_PROP_TAG(MaterialLawParams); //! The material law for the energy stored in the solid matrix +NEW_PROP_TAG(SolidEnergyLaw); //! The parameters of the material law for energy storage of the solid +NEW_PROP_TAG(SolidEnergyLawParams); //! The material law for thermal conduction +NEW_PROP_TAG(ThermalConductionLaw); //! The parameters of the material law for thermal conduction +NEW_PROP_TAG(ThermalConductionLawParams); //!The fluid systems including the information about the phases +NEW_PROP_TAG(FluidSystem); //! Specifies the relation used for velocity +NEW_PROP_TAG(FluxModule); +//! Specify whether energy should be considered as a conservation quantity or not +NEW_PROP_TAG(EnableEnergy); //! Returns whether gravity is considered in the problem +NEW_PROP_TAG(EnableGravity); +//! Enable diffusive fluxes? +NEW_PROP_TAG(EnableDiffusion); END_PROPERTIES diff --git a/opm/models/discretefracture/discretefractureproperties.hh b/opm/models/discretefracture/discretefractureproperties.hh index 1fd66e64c..31e39df6e 100644 --- a/opm/models/discretefracture/discretefractureproperties.hh +++ b/opm/models/discretefracture/discretefractureproperties.hh @@ -36,6 +36,7 @@ BEGIN_PROPERTIES +NEW_PROP_TAG(UseTwoPointGradients); END_PROPERTIES diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index c65d4d2f0..d969e414c 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -54,6 +54,7 @@ #include #include #include +#include #include #include diff --git a/opm/models/discretization/common/fvbaseextensivequantities.hh b/opm/models/discretization/common/fvbaseextensivequantities.hh index c15b8f41d..4ea3dbe2f 100644 --- a/opm/models/discretization/common/fvbaseextensivequantities.hh +++ b/opm/models/discretization/common/fvbaseextensivequantities.hh @@ -30,6 +30,8 @@ #include "fvbaseproperties.hh" +#include + #include #include diff --git a/opm/models/discretization/common/fvbasefdlocallinearizer.hh b/opm/models/discretization/common/fvbasefdlocallinearizer.hh index 52428b3aa..f27189cbe 100644 --- a/opm/models/discretization/common/fvbasefdlocallinearizer.hh +++ b/opm/models/discretization/common/fvbasefdlocallinearizer.hh @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -54,6 +55,8 @@ BEGIN_PROPERTIES // declare the property tags required for the finite differences local linearizer NEW_TYPE_TAG(FiniteDifferenceLocalLinearizer); +NEW_PROP_TAG(NumericDifferenceMethod); +NEW_PROP_TAG(BaseEpsilon); // set the properties to be spliced in SET_TYPE_PROP(FiniteDifferenceLocalLinearizer, LocalLinearizer, diff --git a/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh b/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh index d20644642..4f0c2adef 100644 --- a/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh +++ b/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh @@ -33,13 +33,18 @@ #include -//! \cond SKIP_THIS BEGIN_PROPERTIES -// forward declaration of the required property tags +template +struct SolutionVector; +template +struct GlobalEqVector; +template +struct NewtonMethod; +template +struct VtkOutputFormat; END_PROPERTIES -//! \endcond namespace Opm { /*! diff --git a/opm/models/discretization/common/fvbasenewtonmethod.hh b/opm/models/discretization/common/fvbasenewtonmethod.hh index 1becc3323..e5addb85d 100644 --- a/opm/models/discretization/common/fvbasenewtonmethod.hh +++ b/opm/models/discretization/common/fvbasenewtonmethod.hh @@ -47,18 +47,8 @@ BEGIN_PROPERTIES //! create a type tag for the Newton method of the finite-volume discretization NEW_TYPE_TAG(FvBaseNewtonMethod, INHERITS_FROM(NewtonMethod)); -//! The class dealing with the balance equations - -//! The class storing primary variables plus pseudo primary variables - -//! The class storing values of conservation equations (e.g., a "naked" primary varible -//! vector) - -//! The number of balance equations. - //! The discretization specific part of he implementing the Newton algorithm - -//! The class implementing the Newton algorithm +NEW_PROP_TAG(DiscNewtonMethod); // set default values SET_TYPE_PROP(FvBaseNewtonMethod, DiscNewtonMethod, diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index b493f9397..12601376b 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -45,6 +45,13 @@ #include +BEGIN_PROPERTIES + +template +struct NewtonMethod; + +END_PROPERTIES + namespace Opm { /*! diff --git a/opm/models/discretization/common/fvbaseproperties.hh b/opm/models/discretization/common/fvbaseproperties.hh index 90cd8cbd8..25db7c3fa 100644 --- a/opm/models/discretization/common/fvbaseproperties.hh +++ b/opm/models/discretization/common/fvbaseproperties.hh @@ -30,16 +30,18 @@ #ifndef EWOMS_FV_BASE_PROPERTIES_HH #define EWOMS_FV_BASE_PROPERTIES_HH -#include "fvbasenewtonmethod.hh" -#include "fvbasefdlocallinearizer.hh" - #include #include -#include #include BEGIN_PROPERTIES +namespace TTag { +struct FvBaseNewtonMethod; +struct VtkPrimaryVars; +struct FiniteDifferenceLocalLinearizer; +} + //! The type tag for models based on the finite volume schemes NEW_TYPE_TAG(FvBaseDiscretization, INHERITS_FROM(ImplicitModel, @@ -48,6 +50,8 @@ NEW_TYPE_TAG(FvBaseDiscretization, //! set the splices for the finite volume discretizations +NEW_PROP_TAG(LinearSolverSplice); +NEW_PROP_TAG(LocalLinearizerSplice); SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice); //! use a parallel BiCGStab linear solver by default @@ -65,80 +69,105 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * "Scalar" property (if the finite difference linearizer is used), or it may be more * complex (for the linearizer which uses automatic differentiation). */ - -//! The type of the DUNE grid -//! The type of the grid view +NEW_PROP_TAG(Evaluation); //! The class describing the stencil of the spatial discretization +NEW_PROP_TAG(Stencil); //! The class describing the discrete function space when dune-fem is used, otherwise it points to the stencil class +NEW_PROP_TAG(DiscreteFunctionSpace); //! The type of the problem +NEW_PROP_TAG(Problem); //! The type of the base class for all problems which use this model -//! The type of the model -//! Number of equations in the system of PDEs +NEW_PROP_TAG(BaseProblem); //! The type of the spatial discretization used by the model +NEW_PROP_TAG(Discretization); //! The discretization specific part of the local residual +NEW_PROP_TAG(DiscLocalResidual); //! The type of the local residual function +NEW_PROP_TAG(LocalResidual); //! The type of the local linearizer +NEW_PROP_TAG(LocalLinearizer); //! Specify if elements that do not belong to the local process' grid partition should be //! skipped +NEW_PROP_TAG(LinearizeNonLocalElements); //! Linearizes the global non-linear system of equations -//! The class that allows to manipulate sparse matrices +NEW_PROP_TAG(BaseLinearizer); //! A vector of holding a quantity for each equation (usually at a given spatial location) +NEW_PROP_TAG(EqVector); //! A vector of holding a quantity for each equation for each DOF of an element -//! Vector containing a quantity of for equation for each DOF of the whole grid +NEW_PROP_TAG(ElementEqVector); //! Vector containing volumetric or areal rates of quantities +NEW_PROP_TAG(RateVector); //! Type of object for specifying boundary conditions +NEW_PROP_TAG(BoundaryRateVector); //! The class which represents a constraint degree of freedom +NEW_PROP_TAG(Constraints); //! Vector containing all primary variables of the grid +NEW_PROP_TAG(SolutionVector); //! A vector of primary variables within a sub-control volume +NEW_PROP_TAG(PrimaryVariables); //! The secondary variables within a sub-control volume +NEW_PROP_TAG(IntensiveQuantities); //! The discretization specific part of the intensive quantities +NEW_PROP_TAG(DiscIntensiveQuantities); //! The secondary variables of all degrees of freedom in an element's stencil +NEW_PROP_TAG(ElementContext); //! The secondary variables of a boundary segment +NEW_PROP_TAG(BoundaryContext); //! The secondary variables of a constraint degree of freedom +NEW_PROP_TAG(ConstraintsContext); //! Data required to calculate a flux over a face +NEW_PROP_TAG(ExtensiveQuantities); //! Calculates gradients of arbitrary quantities at flux integration points +NEW_PROP_TAG(GradientCalculator); //! The part of the intensive quantities which is specific to the spatial discretization +NEW_PROP_TAG(DiscBaseIntensiveQuantities); //! The part of the extensive quantities which is specific to the spatial discretization +NEW_PROP_TAG(DiscExtensiveQuantities); //! The part of the VTK ouput modules which is specific to the spatial discretization +NEW_PROP_TAG(DiscBaseOutputModule); //! The class to create grid communication handles +NEW_PROP_TAG(GridCommHandleFactory); /*! * \brief The OpenMP threads manager */ +NEW_PROP_TAG(ThreadManager); +NEW_PROP_TAG(ThreadsPerProcess); //! use locking to prevent race conditions when linearizing the global system of //! equations in multi-threaded mode. (setting this property to true is always save, but //! it may slightly deter performance in multi-threaded simlations and some //! discretizations do not need this.) +NEW_PROP_TAG(UseLinearizationLock); // high-level simulation control -//! Manages the simulation time - /*! * \brief Switch to enable or disable grid adaptation * * Currently grid adaptation requires the presence of the dune-FEM module. If it is not * available and grid adaptation is enabled, an exception is thrown. */ +NEW_PROP_TAG(EnableGridAdaptation); /*! * \brief The directory to which simulation output ought to be written to. */ +NEW_PROP_TAG(OutputDir); /*! * \brief Global switch to enable or disable the writing of VTK output files @@ -146,6 +175,7 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * If writing VTK files is disabled, then the WriteVtk$FOO options do * not have any effect... */ +NEW_PROP_TAG(EnableVtkOutput); /*! * \brief Determines if the VTK output is written to disk asynchronously @@ -156,6 +186,7 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * not support multi-threaded multi-process VTK output and even if it would, the result * would be slower than when using synchronous output. */ +NEW_PROP_TAG(EnableAsyncVtkOutput); /*! * \brief Specify the format the VTK output is written to disk @@ -166,31 +197,37 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * - Dune::VTK::appendedraw * - Dune::VTK::appendedbase64 */ +NEW_PROP_TAG(VtkOutputFormat); //! Specify whether the some degrees of fredom can be constraint +NEW_PROP_TAG(EnableConstraints); /*! * \brief Specify the maximum size of a time integration [s]. * * The default is to not limit the step size. */ +NEW_PROP_TAG(MaxTimeStepSize); /*! * \brief Specify the minimal size of a time integration [s]. * * The default is to not limit the step size. */ +NEW_PROP_TAG(MinTimeStepSize); /*! * \brief The maximum allowed number of timestep divisions for the * Newton solver. */ +NEW_PROP_TAG(MaxTimeStepDivisions); /*! * \brief Continue with a non-converged solution instead of giving up * if we encounter a time step size smaller than the minimum time * step size. */ +NEW_PROP_TAG(ContinueOnConvergenceError); /*! * \brief Specify whether all intensive quantities for the grid should be @@ -201,6 +238,7 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * may cause the simulation to exhibit worse cache coherence behavior * which eats some of the computational benefits again. */ +NEW_PROP_TAG(EnableIntensiveQuantityCache); /*! * \brief Specify whether the storage terms for previous solutions should be cached. @@ -208,6 +246,7 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * This potentially reduces the CPU time, but comes at the cost of higher memory * consumption. */ +NEW_PROP_TAG(EnableStorageCache); /*! * \brief Specify whether to use the already calculated solutions as @@ -217,42 +256,43 @@ SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalL * very expensive (e.g. for non-linear fugacity functions where the * solver converges faster). */ +NEW_PROP_TAG(EnableThermodynamicHints); // mappers from local to global DOF indices /*! * \brief The mapper to find the global index of a vertex. */ +NEW_PROP_TAG(VertexMapper); /*! * \brief The mapper to find the global index of an element. */ +NEW_PROP_TAG(ElementMapper); /*! * \brief The mapper to find the global index of a degree of freedom. */ - -/*! - * \brief The class which marks the border indices associated with the - * degrees of freedom on a process boundary. - * - * This is required for the algebraic overlap stuff. - */ +NEW_PROP_TAG(DofMapper); /*! * \brief The history size required by the time discretization */ +NEW_PROP_TAG(TimeDiscHistorySize); /*! * \brief Specify whether the storage terms use extensive quantities or not. * * Most models don't need this, but the (Navier-)Stokes ones do... */ +NEW_PROP_TAG(ExtensiveStorageTerm); //! \brief Specify whether to use volumetric residuals or not +NEW_PROP_TAG(UseVolumetricResidual); //! Specify if experimental features should be enabled or not. +NEW_PROP_TAG(EnableExperiments); SET_TYPE_PROP(NumericModel, Vanguard, Opm::DgfVanguard); diff --git a/opm/models/discretization/vcfv/vcfvproperties.hh b/opm/models/discretization/vcfv/vcfvproperties.hh index a1ab7cc9a..706b17ff4 100644 --- a/opm/models/discretization/vcfv/vcfvproperties.hh +++ b/opm/models/discretization/vcfv/vcfvproperties.hh @@ -40,6 +40,7 @@ NEW_TYPE_TAG(VcfvDiscretization, INHERITS_FROM(FvBaseDiscretization)); //! Use P1 finite-elements gradients instead of two-point gradients. Note that setting //! this property to true requires the dune-localfunctions module to be available. +NEW_PROP_TAG(UseP1FiniteElementGradients); END_PROPERTIES diff --git a/opm/models/flash/flashproperties.hh b/opm/models/flash/flashproperties.hh index 899c19c33..fb12be56e 100644 --- a/opm/models/flash/flashproperties.hh +++ b/opm/models/flash/flashproperties.hh @@ -37,15 +37,10 @@ BEGIN_PROPERTIES -//! Provides the thermodynamic relations //! The type of the flash constraint solver +NEW_PROP_TAG(FlashSolver); //! The maximum accepted error of the flash solver - -//! The thermal conduction law which ought to be used -//! The parameters of the thermal conduction law - -//! Specifies whether energy should be considered as a conservation quantity or not -//! Enable diffusive fluxes? +NEW_PROP_TAG(FlashTolerance); END_PROPERTIES diff --git a/opm/models/immiscible/immiscibleproperties.hh b/opm/models/immiscible/immiscibleproperties.hh index df095acc2..0eaa087c1 100644 --- a/opm/models/immiscible/immiscibleproperties.hh +++ b/opm/models/immiscible/immiscibleproperties.hh @@ -35,18 +35,15 @@ BEGIN_PROPERTIES -//!The fluid systems including the information about the phases -//! Specify whether energy should be considered as a conservation quantity or not - // these properties only make sense for the ImmiscibleTwoPhase type tag - //! The wetting phase for two-phase models +NEW_PROP_TAG(WettingPhase); //! The non-wetting phase for two-phase models +NEW_PROP_TAG(NonwettingPhase); // these properties only make sense for the ImmiscibleSinglePhase type tag - //! The fluid used by the model - +NEW_PROP_TAG(Fluid); END_PROPERTIES diff --git a/opm/models/io/baseoutputmodule.hh b/opm/models/io/baseoutputmodule.hh index a2d1e0bd6..275841645 100644 --- a/opm/models/io/baseoutputmodule.hh +++ b/opm/models/io/baseoutputmodule.hh @@ -31,6 +31,9 @@ #include #include +#include +#include +#include #include @@ -44,15 +47,15 @@ #include -BEGIN_PROPERTIES - -// forward definition of property tags - - -END_PROPERTIES - namespace Opm { +namespace Properties { + +template +struct FluidSystem; + +} // namespace Properties + #if __GNUC__ || __clang__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" diff --git a/opm/models/io/basevanguard.hh b/opm/models/io/basevanguard.hh index 98857aa81..e2bb7276b 100644 --- a/opm/models/io/basevanguard.hh +++ b/opm/models/io/basevanguard.hh @@ -39,11 +39,6 @@ #include #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/io/vtkblackoilenergymodule.hh b/opm/models/io/vtkblackoilenergymodule.hh index 79f9a482f..b8b7c4a14 100644 --- a/opm/models/io/vtkblackoilenergymodule.hh +++ b/opm/models/io/vtkblackoilenergymodule.hh @@ -46,6 +46,10 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOilEnergy); // create the property tags needed for the energy module +NEW_PROP_TAG(VtkWriteRockInternalEnergy); +NEW_PROP_TAG(VtkWriteTotalThermalConductivity); +NEW_PROP_TAG(VtkWriteFluidInternalEnergies); +NEW_PROP_TAG(VtkWriteFluidEnthalpies); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOilEnergy, VtkWriteRockInternalEnergy, true); diff --git a/opm/models/io/vtkblackoilmodule.hh b/opm/models/io/vtkblackoilmodule.hh index 2807ac05d..449163236 100644 --- a/opm/models/io/vtkblackoilmodule.hh +++ b/opm/models/io/vtkblackoilmodule.hh @@ -46,6 +46,17 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOil); // create the property tags needed for the multi phase module +NEW_PROP_TAG(VtkWriteGasDissolutionFactor); +NEW_PROP_TAG(VtkWriteOilVaporizationFactor); +NEW_PROP_TAG(VtkWriteOilFormationVolumeFactor); +NEW_PROP_TAG(VtkWriteGasFormationVolumeFactor); +NEW_PROP_TAG(VtkWriteWaterFormationVolumeFactor); +NEW_PROP_TAG(VtkWriteOilSaturationPressure); +NEW_PROP_TAG(VtkWriteGasSaturationPressure); +NEW_PROP_TAG(VtkWriteSaturationRatios); +NEW_PROP_TAG(VtkWriteSaturatedOilGasDissolutionFactor); +NEW_PROP_TAG(VtkWriteSaturatedGasOilVaporizationFactor); +NEW_PROP_TAG(VtkWritePrimaryVarsMeaning); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOil, VtkWriteGasDissolutionFactor, false); diff --git a/opm/models/io/vtkblackoilpolymermodule.hh b/opm/models/io/vtkblackoilpolymermodule.hh index 2fa0da136..ff5c54d37 100644 --- a/opm/models/io/vtkblackoilpolymermodule.hh +++ b/opm/models/io/vtkblackoilpolymermodule.hh @@ -46,6 +46,12 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOilPolymer); // create the property tags needed for the polymer output module +NEW_PROP_TAG(VtkWritePolymerConcentration); +NEW_PROP_TAG(VtkWritePolymerDeadPoreVolume); +NEW_PROP_TAG(VtkWritePolymerAdsorption); +NEW_PROP_TAG(VtkWritePolymerRockDensity); +NEW_PROP_TAG(VtkWritePolymerViscosityCorrection); +NEW_PROP_TAG(VtkWriteWaterViscosityCorrection); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOilPolymer, VtkWritePolymerConcentration, true); diff --git a/opm/models/io/vtkblackoilsolventmodule.hh b/opm/models/io/vtkblackoilsolventmodule.hh index 86a7d655d..07f6050fd 100644 --- a/opm/models/io/vtkblackoilsolventmodule.hh +++ b/opm/models/io/vtkblackoilsolventmodule.hh @@ -46,6 +46,10 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkBlackOilSolvent); // create the property tags needed for the solvent output module +NEW_PROP_TAG(VtkWriteSolventSaturation); +NEW_PROP_TAG(VtkWriteSolventDensity); +NEW_PROP_TAG(VtkWriteSolventViscosity); +NEW_PROP_TAG(VtkWriteSolventMobility); // set default values for what quantities to output SET_BOOL_PROP(VtkBlackOilSolvent, VtkWriteSolventSaturation, true); diff --git a/opm/models/io/vtkcompositionmodule.hh b/opm/models/io/vtkcompositionmodule.hh index 5ce2667e0..1ae2d5a99 100644 --- a/opm/models/io/vtkcompositionmodule.hh +++ b/opm/models/io/vtkcompositionmodule.hh @@ -41,6 +41,13 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkComposition); // create the property tags needed for the composition module +NEW_PROP_TAG(VtkWriteMassFractions); +NEW_PROP_TAG(VtkWriteMoleFractions); +NEW_PROP_TAG(VtkWriteTotalMassFractions); +NEW_PROP_TAG(VtkWriteTotalMoleFractions); +NEW_PROP_TAG(VtkWriteMolarities); +NEW_PROP_TAG(VtkWriteFugacities); +NEW_PROP_TAG(VtkWriteFugacityCoeffs); // set default values for what quantities to output SET_BOOL_PROP(VtkComposition, VtkWriteMassFractions, false); diff --git a/opm/models/io/vtkdiffusionmodule.hh b/opm/models/io/vtkdiffusionmodule.hh index 2fb76eaf2..d72547f40 100644 --- a/opm/models/io/vtkdiffusionmodule.hh +++ b/opm/models/io/vtkdiffusionmodule.hh @@ -44,6 +44,9 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkDiffusion); // create the property tags needed for the diffusion module +NEW_PROP_TAG(VtkWriteTortuosities); +NEW_PROP_TAG(VtkWriteDiffusionCoefficients); +NEW_PROP_TAG(VtkWriteEffectiveDiffusionCoefficients); // set default values for what quantities to output SET_BOOL_PROP(VtkDiffusion, VtkWriteTortuosities, false); diff --git a/opm/models/io/vtkdiscretefracturemodule.hh b/opm/models/io/vtkdiscretefracturemodule.hh index dc5272fb8..3c535d7b1 100644 --- a/opm/models/io/vtkdiscretefracturemodule.hh +++ b/opm/models/io/vtkdiscretefracturemodule.hh @@ -45,6 +45,13 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkDiscreteFracture); // create the property tags needed for the multi phase module +NEW_PROP_TAG(VtkWriteFractureSaturations); +NEW_PROP_TAG(VtkWriteFractureMobilities); +NEW_PROP_TAG(VtkWriteFractureRelativePermeabilities); +NEW_PROP_TAG(VtkWriteFracturePorosity); +NEW_PROP_TAG(VtkWriteFractureIntrinsicPermeabilities); +NEW_PROP_TAG(VtkWriteFractureFilterVelocities); +NEW_PROP_TAG(VtkWriteFractureVolumeFraction); // set default values for what quantities to output SET_BOOL_PROP(VtkDiscreteFracture, VtkWriteFractureSaturations, true); diff --git a/opm/models/io/vtkenergymodule.hh b/opm/models/io/vtkenergymodule.hh index ae51310e4..b23bd5bc4 100644 --- a/opm/models/io/vtkenergymodule.hh +++ b/opm/models/io/vtkenergymodule.hh @@ -41,6 +41,10 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkEnergy); // create the property tags needed for the energy module +NEW_PROP_TAG(VtkWriteSolidInternalEnergy); +NEW_PROP_TAG(VtkWriteThermalConductivity); +NEW_PROP_TAG(VtkWriteInternalEnergies); +NEW_PROP_TAG(VtkWriteEnthalpies); // set default values for what quantities to output SET_BOOL_PROP(VtkEnergy, VtkWriteSolidInternalEnergy, false); diff --git a/opm/models/io/vtkmultiphasemodule.hh b/opm/models/io/vtkmultiphasemodule.hh index 846a6a729..8f1f0b376 100644 --- a/opm/models/io/vtkmultiphasemodule.hh +++ b/opm/models/io/vtkmultiphasemodule.hh @@ -46,6 +46,18 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkMultiPhase); // create the property tags needed for the multi phase module +NEW_PROP_TAG(VtkWriteExtrusionFactor); +NEW_PROP_TAG(VtkWritePressures); +NEW_PROP_TAG(VtkWriteDensities); +NEW_PROP_TAG(VtkWriteSaturations); +NEW_PROP_TAG(VtkWriteMobilities); +NEW_PROP_TAG(VtkWriteRelativePermeabilities); +NEW_PROP_TAG(VtkWriteViscosities); +NEW_PROP_TAG(VtkWriteAverageMolarMasses); +NEW_PROP_TAG(VtkWritePorosity); +NEW_PROP_TAG(VtkWriteIntrinsicPermeabilities); +NEW_PROP_TAG(VtkWritePotentialGradients); +NEW_PROP_TAG(VtkWriteFilterVelocities); // set default values for what quantities to output SET_BOOL_PROP(VtkMultiPhase, VtkWriteExtrusionFactor, false); diff --git a/opm/models/io/vtkphasepresencemodule.hh b/opm/models/io/vtkphasepresencemodule.hh index d6b1a5c38..a6fccf3b0 100644 --- a/opm/models/io/vtkphasepresencemodule.hh +++ b/opm/models/io/vtkphasepresencemodule.hh @@ -39,6 +39,7 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkPhasePresence); // create the property tags needed for the primary variables module +NEW_PROP_TAG(VtkWritePhasePresence); SET_BOOL_PROP(VtkPhasePresence, VtkWritePhasePresence, false); diff --git a/opm/models/io/vtkprimaryvarsmodule.hh b/opm/models/io/vtkprimaryvarsmodule.hh index b4a06d9ec..90c9fe26a 100644 --- a/opm/models/io/vtkprimaryvarsmodule.hh +++ b/opm/models/io/vtkprimaryvarsmodule.hh @@ -39,6 +39,9 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkPrimaryVars); // create the property tags needed for the primary variables module +NEW_PROP_TAG(VtkWritePrimaryVars); +NEW_PROP_TAG(VtkWriteProcessRank); +NEW_PROP_TAG(VtkWriteDofIndex); SET_BOOL_PROP(VtkPrimaryVars, VtkWritePrimaryVars, false); SET_BOOL_PROP(VtkPrimaryVars, VtkWriteProcessRank, false); diff --git a/opm/models/io/vtktemperaturemodule.hh b/opm/models/io/vtktemperaturemodule.hh index f0db69258..6135df00f 100644 --- a/opm/models/io/vtktemperaturemodule.hh +++ b/opm/models/io/vtktemperaturemodule.hh @@ -41,6 +41,7 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(VtkTemperature); // create the property tags needed for the temperature module +NEW_PROP_TAG(VtkWriteTemperature); // set default values for what quantities to output SET_BOOL_PROP(VtkTemperature, VtkWriteTemperature, true); diff --git a/opm/models/ncp/ncpnewtonmethod.hh b/opm/models/ncp/ncpnewtonmethod.hh index 001564655..a65f1ad35 100644 --- a/opm/models/ncp/ncpnewtonmethod.hh +++ b/opm/models/ncp/ncpnewtonmethod.hh @@ -30,11 +30,19 @@ #include "ncpproperties.hh" +#include + #include #include - #include +BEGIN_PROPERTIES + +template +struct DiscNewtonMethod; + +END_PROPERTIES + namespace Opm { /*! diff --git a/opm/models/ncp/ncpproperties.hh b/opm/models/ncp/ncpproperties.hh index 181c7fd02..7b9909702 100644 --- a/opm/models/ncp/ncpproperties.hh +++ b/opm/models/ncp/ncpproperties.hh @@ -37,16 +37,16 @@ BEGIN_PROPERTIES -//! Enable the energy equation? - -//! Enable diffusive fluxes? - //! The unmodified weight for the pressure primary variable +NEW_PROP_TAG(NcpPressureBaseWeight); //! The weight for the saturation primary variables +NEW_PROP_TAG(NcpSaturationsBaseWeight); //! The unmodified weight for the fugacity primary variables +NEW_PROP_TAG(NcpFugacitiesBaseWeight); //! The themodynamic constraint solver which calculates the //! composition of any phase given all component fugacities. +NEW_PROP_TAG(NcpCompositionFromFugacitiesSolver); END_PROPERTIES diff --git a/opm/models/nonlinear/newtonmethod.hh b/opm/models/nonlinear/newtonmethod.hh index b8450bbe7..e4c389397 100644 --- a/opm/models/nonlinear/newtonmethod.hh +++ b/opm/models/nonlinear/newtonmethod.hh @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -65,43 +66,25 @@ BEGIN_PROPERTIES //! are attached NEW_TYPE_TAG(NewtonMethod); -//! The simulation management class of the simulation - -//! The physical model which we would like to solve - -//! The model describing the PDEs for the conservation quantities - -//! The type of scalar values - //! Specifies the type of the actual Newton method - -//! Specifies the type of a solution - -//! Specifies the type of a solution for a single degee of freedom - -//! Specifies whether the problem to be simulated exhibits contraint degrees of freedom - -//! Specifies the type of objects which specify constraints for a single degee of freedom - -//! Vector containing a quantity of for equation on the whole grid - -//! Vector containing a quantity of for equation for a single degee of freedom +NEW_PROP_TAG(NewtonMethod); //! The class which linearizes the non-linear system of equations - -//! Specifies the type of a global Jacobian matrix - -//! Specifies the type of the linear solver to be used +NEW_PROP_TAG(Linearizer); //! Specifies whether the Newton method should print messages or not +NEW_PROP_TAG(NewtonVerbose); //! Specifies the type of the class which writes out the Newton convergence +NEW_PROP_TAG(NewtonConvergenceWriter); //! Specifies whether the convergence rate and the global residual //! gets written out to disk for every Newton iteration +NEW_PROP_TAG(NewtonWriteConvergence); //! Specifies whether the convergence rate and the global residual //! gets written out to disk for every Newton iteration +NEW_PROP_TAG(ConvergenceWriter); /*! * \brief The value for the error below which convergence is declared @@ -109,9 +92,11 @@ NEW_TYPE_TAG(NewtonMethod); * This value can (and for the porous media models will) be changed to account for grid * scaling and other effects. */ +NEW_PROP_TAG(NewtonTolerance); //! The maximum error which may occur in a simulation before the //! Newton method for the time step is aborted +NEW_PROP_TAG(NewtonMaxError); /*! * \brief The number of iterations at which the Newton method @@ -121,8 +106,10 @@ NEW_TYPE_TAG(NewtonMethod); * is to scale the last time-step size by the deviation of the * number of iterations used from the target steps. */ +NEW_PROP_TAG(NewtonTargetIterations); //! Number of maximum iterations for the Newton method. +NEW_PROP_TAG(NewtonMaxIterations); // set default values for the properties SET_TYPE_PROP(NewtonMethod, NewtonMethod, Opm::NewtonMethod); diff --git a/opm/models/nonlinear/nullconvergencewriter.hh b/opm/models/nonlinear/nullconvergencewriter.hh index 5da6caa4e..009e7642a 100644 --- a/opm/models/nonlinear/nullconvergencewriter.hh +++ b/opm/models/nonlinear/nullconvergencewriter.hh @@ -34,7 +34,8 @@ BEGIN_PROPERTIES - +template +struct NewtonMethod; END_PROPERTIES diff --git a/opm/models/pvs/pvsnewtonmethod.hh b/opm/models/pvs/pvsnewtonmethod.hh index 3bbb0efd2..10d8769a4 100644 --- a/opm/models/pvs/pvsnewtonmethod.hh +++ b/opm/models/pvs/pvsnewtonmethod.hh @@ -30,6 +30,15 @@ #include "pvsproperties.hh" +#include + +BEGIN_PROPERTIES + +template +struct DiscNewtonMethod; + +END_PROPERTIES + namespace Opm { /*! diff --git a/opm/models/pvs/pvsproperties.hh b/opm/models/pvs/pvsproperties.hh index 10193b80c..c1db5df8b 100644 --- a/opm/models/pvs/pvsproperties.hh +++ b/opm/models/pvs/pvsproperties.hh @@ -40,13 +40,14 @@ BEGIN_PROPERTIES -//! Specifies whether energy is considered as a conservation quantity or not -//! Enable diffusive fluxes? - //! The verbosity of the model (0 -> do not print anything, 2 -> spam stdout a lot) +NEW_PROP_TAG(PvsVerbosity); //! The basis value for the weight of the pressure primary variable +NEW_PROP_TAG(PvsPressureBaseWeight); //! The basis value for the weight of the saturation primary variables +NEW_PROP_TAG(PvsSaturationsBaseWeight); //! The basis value for the weight of the mole fraction primary variables +NEW_PROP_TAG(PvsMoleFractionsBaseWeight); END_PROPERTIES diff --git a/opm/models/richards/richardsproperties.hh b/opm/models/richards/richardsproperties.hh index ac88d0e04..1748286f9 100644 --- a/opm/models/richards/richardsproperties.hh +++ b/opm/models/richards/richardsproperties.hh @@ -34,21 +34,25 @@ // \{ BEGIN_PROPERTIES -//! The fluid system used for the problem - //! The fluid used as the wetting phase (by default, we set the fluid //! system to the immiscible one, which requires this property.) +NEW_PROP_TAG(WettingFluid); //! The fluid used as the non-wetting phase (by default, we set the //! fluid system to the immiscible one, which requires this property.) +NEW_PROP_TAG(NonWettingFluid); //! Index of the fluid which represents the wetting phase +NEW_PROP_TAG(LiquidPhaseIndex); //! Index of the fluid which represents the non-wetting phase +NEW_PROP_TAG(GasPhaseIndex); //! Index of the component which constitutes the liquid +NEW_PROP_TAG(LiquidComponentIndex); //! Index of the component which constitutes the gas +NEW_PROP_TAG(GasComponentIndex); // \} diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 1ce23c5ed..44d7642dd 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -57,6 +57,10 @@ BEGIN_PROPERTIES +// type tag which is supposed to spliced in or inherited from if the +// parameter system is to be used +NEW_TYPE_TAG(ParameterSystem); + /////////////////////////////////// // Type tag definitions: // @@ -65,7 +69,6 @@ BEGIN_PROPERTIES // +-> ImplicitModel /////////////////////////////////// -NEW_TYPE_TAG(ParameterSystem); //! Type tag for all models. NEW_TYPE_TAG(NumericModel, INHERITS_FROM(ParameterSystem)); @@ -81,329 +84,30 @@ NEW_TYPE_TAG(ImplicitModel, INHERITS_FROM(NumericModel)); //! Property to specify the type of scalar values. NEW_PROP_TAG(Scalar); +//! Number of equations in the system of PDEs +NEW_PROP_TAG(NumEq); + //! Property which provides a Dune::ParameterTree. NEW_PROP_TAG(ParameterTree); +//! The type of the model +NEW_PROP_TAG(Model); + //! Property which defines the group that is queried for parameters by default NEW_PROP_TAG(ModelParameterGroup); //! Property which provides a Vanguard (manages grids) NEW_PROP_TAG(Vanguard); -NEW_PROP_TAG(GridView); - -NEW_PROP_TAG(Simulator); +//! The type of the DUNE grid NEW_PROP_TAG(Grid); -NEW_PROP_TAG(GridFile); -NEW_PROP_TAG(Model); -NEW_PROP_TAG(Problem); -NEW_PROP_TAG(ThreadManager); -NEW_PROP_TAG(NewtonMethod); -NEW_PROP_TAG(SolutionVector); -NEW_PROP_TAG(GlobalEqVector); -NEW_PROP_TAG(VtkOutputFormat); - -//! Specifies the type of a solution for a single degee of freedom -NEW_PROP_TAG(PrimaryVariables); - -//! Specifies whether the problem to be simulated exhibits contraint degrees of freedom -NEW_PROP_TAG(EnableConstraints); - -//! Specifies the type of objects which specify constraints for a single degee of freedom -NEW_PROP_TAG(Constraints); - -//! Vector containing a quantity of for equation for a single degee of freedom -NEW_PROP_TAG(EqVector); - -//! The class which linearizes the non-linear system of equations -NEW_PROP_TAG(Linearizer); - -//! Specifies the type of a global Jacobian matrix -NEW_PROP_TAG(SparseMatrixAdapter); - -//! Specifies the type of the linear solver to be used -NEW_PROP_TAG(LinearSolverBackend); - -//! Specifies whether the Newton method should print messages or not -NEW_PROP_TAG(NewtonVerbose); - -//! Specifies the type of the class which writes out the Newton convergence -NEW_PROP_TAG(NewtonConvergenceWriter); - -//! Specifies whether the convergence rate and the global residual -//! gets written out to disk for every Newton iteration -NEW_PROP_TAG(NewtonWriteConvergence); - -//! Specifies whether the convergence rate and the global residual -//! gets written out to disk for every Newton iteration -NEW_PROP_TAG(ConvergenceWriter); - -/*! - * \brief The value for the error below which convergence is declared - * - * This value can (and for the porous media models will) be changed to account for grid - * scaling and other effects. - */ -NEW_PROP_TAG(NewtonTolerance); - -//! The maximum error which may occur in a simulation before the -//! Newton method for the time step is aborted -NEW_PROP_TAG(NewtonMaxError); - -/*! - * \brief The number of iterations at which the Newton method - * should aim at. - * - * This is used to control the time-step size. The heuristic used - * is to scale the last time-step size by the deviation of the - * number of iterations used from the target steps. - */ -NEW_PROP_TAG(NewtonTargetIterations); - -//! Number of maximum iterations for the Newton method. -NEW_PROP_TAG(NewtonMaxIterations); - +NEW_PROP_TAG(GridView); #if HAVE_DUNE_FEM NEW_PROP_TAG(GridPart); #endif -NEW_PROP_TAG(LocalLinearizer); -NEW_PROP_TAG(Evaluation); -NEW_PROP_TAG(NumericDifferenceMethod); -NEW_PROP_TAG(BaseEpsilon); -NEW_PROP_TAG(LocalResidual); -NEW_PROP_TAG(ElementContext); - -NEW_PROP_TAG(NumPhases); -NEW_PROP_TAG(NumComponents); -NEW_PROP_TAG(NumEq); -NEW_PROP_TAG(FluidSystem); -NEW_PROP_TAG(DiscBaseOutputModule); - -// create new type tag for the VTK primary variables output -NEW_PROP_TAG(EnableVtkOutput); - -// create the property tags needed for the primary variables module -NEW_PROP_TAG(VtkWritePrimaryVars); -NEW_PROP_TAG(VtkWriteProcessRank); -NEW_PROP_TAG(VtkWriteDofIndex); -NEW_PROP_TAG(VtkWriteExtrusionFactor); -NEW_PROP_TAG(VtkWritePressures); -NEW_PROP_TAG(VtkWriteDensities); -NEW_PROP_TAG(VtkWriteSaturations); -NEW_PROP_TAG(VtkWriteMobilities); -NEW_PROP_TAG(VtkWriteRelativePermeabilities); -NEW_PROP_TAG(VtkWriteViscosities); -NEW_PROP_TAG(VtkWriteAverageMolarMasses); -NEW_PROP_TAG(VtkWritePorosity); -NEW_PROP_TAG(VtkWriteIntrinsicPermeabilities); -NEW_PROP_TAG(VtkWritePotentialGradients); -NEW_PROP_TAG(VtkWriteFilterVelocities); -NEW_PROP_TAG(VtkWriteTemperature); -NEW_PROP_TAG(VtkWriteSolidInternalEnergy); -NEW_PROP_TAG(VtkWriteThermalConductivity); -NEW_PROP_TAG(VtkWriteInternalEnergies); -NEW_PROP_TAG(VtkWriteEnthalpies); -NEW_PROP_TAG(VtkWriteMassFractions); -NEW_PROP_TAG(VtkWriteMoleFractions); -NEW_PROP_TAG(VtkWriteTotalMassFractions); -NEW_PROP_TAG(VtkWriteTotalMoleFractions); -NEW_PROP_TAG(VtkWriteMolarities); -NEW_PROP_TAG(VtkWriteFugacities); -NEW_PROP_TAG(VtkWriteFugacityCoeffs); -NEW_PROP_TAG(VtkWriteEffectiveDiffusionCoefficients); -NEW_PROP_TAG(VtkWriteDiffusionCoefficients); -NEW_PROP_TAG(VtkWriteTortuosities); -NEW_PROP_TAG(VtkWritePhasePresence); -NEW_PROP_TAG(VtkWriteSolventSaturation); -NEW_PROP_TAG(VtkWriteSolventDensity); -NEW_PROP_TAG(VtkWriteSolventViscosity); -NEW_PROP_TAG(VtkWriteSolventMobility); -NEW_PROP_TAG(EnableSolvent); -NEW_PROP_TAG(BlackoilConserveSurfaceVolume); -NEW_PROP_TAG(VtkWritePolymerConcentration); -NEW_PROP_TAG(VtkWritePolymerDeadPoreVolume); -NEW_PROP_TAG(VtkWritePolymerViscosityCorrection); -NEW_PROP_TAG(VtkWriteWaterViscosityCorrection); -NEW_PROP_TAG(VtkWritePolymerRockDensity); -NEW_PROP_TAG(VtkWritePolymerAdsorption); -NEW_PROP_TAG(EnablePolymer); -NEW_PROP_TAG(EnablePolymerMW); -NEW_PROP_TAG(VtkWriteRockInternalEnergy); -NEW_PROP_TAG(VtkWriteTotalThermalConductivity); -NEW_PROP_TAG(VtkWriteFluidInternalEnergies); -NEW_PROP_TAG(VtkWriteFluidEnthalpies); -NEW_PROP_TAG(BlackOilEnergyScalingFactor); -NEW_PROP_TAG(EnableTemperature); -NEW_PROP_TAG(EnableFoam); -NEW_PROP_TAG(EnableBrine); -NEW_PROP_TAG(DpMaxRel); -NEW_PROP_TAG(DsMax); -NEW_PROP_TAG(PriVarOscilationThreshold); -NEW_PROP_TAG(VtkWriteGasDissolutionFactor); -NEW_PROP_TAG(VtkWriteOilVaporizationFactor); -NEW_PROP_TAG(VtkWriteOilFormationVolumeFactor); -NEW_PROP_TAG(VtkWriteGasFormationVolumeFactor); -NEW_PROP_TAG(VtkWriteWaterFormationVolumeFactor); -NEW_PROP_TAG(VtkWriteOilSaturationPressure); -NEW_PROP_TAG(VtkWriteGasSaturationPressure); -NEW_PROP_TAG(VtkWriteSaturationRatios); -NEW_PROP_TAG(VtkWriteSaturatedOilGasDissolutionFactor); -NEW_PROP_TAG(VtkWriteSaturatedGasOilVaporizationFactor); -NEW_PROP_TAG(VtkWritePrimaryVarsMeaning); -NEW_PROP_TAG(VtkWriteFractureSaturations); -NEW_PROP_TAG(VtkWriteFractureMobilities); -NEW_PROP_TAG(VtkWriteFractureRelativePermeabilities); -NEW_PROP_TAG(VtkWriteFracturePorosity); -NEW_PROP_TAG(VtkWriteFractureIntrinsicPermeabilities); -NEW_PROP_TAG(VtkWriteFractureFilterVelocities); -NEW_PROP_TAG(VtkWriteFractureVolumeFraction); -NEW_PROP_TAG(UseTwoPointGradients); - -NEW_PROP_TAG(PvsVerbosity); -NEW_PROP_TAG(PvsPressureBaseWeight); -NEW_PROP_TAG(PvsSaturationsBaseWeight); -NEW_PROP_TAG(PvsMoleFractionsBaseWeight); -NEW_PROP_TAG(NcpPressureBaseWeight); -NEW_PROP_TAG(NcpSaturationsBaseWeight); -NEW_PROP_TAG(NcpFugacitiesBaseWeight); -NEW_PROP_TAG(FluidSystemPressureLow); -NEW_PROP_TAG(FluidSystemPressureHigh); -NEW_PROP_TAG(FluidSystemNumPressure); -NEW_PROP_TAG(FluidSystemTemperatureLow); -NEW_PROP_TAG(FluidSystemTemperatureHigh); -NEW_PROP_TAG(FluidSystemNumTemperature); -NEW_PROP_TAG(IntensiveQuantities); - -NEW_PROP_TAG(BoundaryContext); -NEW_PROP_TAG(BoundaryRateVector); -NEW_PROP_TAG(CellsX); -NEW_PROP_TAG(CellsY); -NEW_PROP_TAG(CellsZ); -NEW_PROP_TAG(ContinueOnConvergenceError); -NEW_PROP_TAG(DiscExtensiveQuantities); -NEW_PROP_TAG(DiscIntensiveQuantities); -NEW_PROP_TAG(DiscLocalResidual); -NEW_PROP_TAG(Discretization); -NEW_PROP_TAG(DofMapper); -NEW_PROP_TAG(DomainSizeX); -NEW_PROP_TAG(DomainSizeY); -NEW_PROP_TAG(DomainSizeZ); -NEW_PROP_TAG(ElementMapper); -NEW_PROP_TAG(EnableAsyncVtkOutput); -NEW_PROP_TAG(EnableDiffusion); -NEW_PROP_TAG(EnableEnergy); -NEW_PROP_TAG(EnableGravity); -NEW_PROP_TAG(EnableGridAdaptation); -NEW_PROP_TAG(EnableStorageCache); -NEW_PROP_TAG(ExtensiveQuantities); -NEW_PROP_TAG(ExtensiveStorageTerm); -NEW_PROP_TAG(Fluid); -NEW_PROP_TAG(FluxModule); -NEW_PROP_TAG(GradientCalculator); -NEW_PROP_TAG(GridCommHandleFactory); -NEW_PROP_TAG(Indices); -NEW_PROP_TAG(LinearizeNonLocalElements); -NEW_PROP_TAG(MaterialLaw); -NEW_PROP_TAG(MaterialLawParams); -NEW_PROP_TAG(MaxTimeStepDivisions); -NEW_PROP_TAG(MaxTimeStepSize); -NEW_PROP_TAG(MinTimeStepSize); -NEW_PROP_TAG(OutputDir); -NEW_PROP_TAG(RateVector); -NEW_PROP_TAG(SolidEnergyLaw); -NEW_PROP_TAG(Stencil); -NEW_PROP_TAG(ThermalConductionLaw); -NEW_PROP_TAG(ThreadsPerProcess); -NEW_PROP_TAG(TimeDiscHistorySize); -NEW_PROP_TAG(UseLinearizationLock); -NEW_PROP_TAG(UseP1FiniteElementGradients); -NEW_PROP_TAG(UseVolumetricResidual); -NEW_PROP_TAG(VertexMapper); -NEW_PROP_TAG(SolidEnergyLawParams); -NEW_PROP_TAG(ThermalConductionLawParams); -NEW_PROP_TAG(FlashSolver); -NEW_PROP_TAG(FlashTolerance); - -NEW_PROP_TAG(BaseProblem); -NEW_PROP_TAG(ConstraintsContext); -NEW_PROP_TAG(ElementEqVector); -NEW_PROP_TAG(EnableExperiments); -NEW_PROP_TAG(EnableIntensiveQuantityCache); -NEW_PROP_TAG(EnableThermodynamicHints); -NEW_PROP_TAG(NonwettingPhase); -NEW_PROP_TAG(WettingPhase); - -NEW_PROP_TAG(OverlappingMatrix); -NEW_PROP_TAG(OverlappingVector); -NEW_PROP_TAG(PreconditionerOrder); -NEW_PROP_TAG(PreconditionerRelaxation); - -NEW_PROP_TAG(AmgCoarsenTarget); - -NEW_PROP_TAG(BorderListCreator); -NEW_PROP_TAG(Overlap); -NEW_PROP_TAG(OverlappingScalarProduct); -NEW_PROP_TAG(OverlappingLinearOperator); - -NEW_PROP_TAG(LiquidPhaseIndex); -NEW_PROP_TAG(GasPhaseIndex); -NEW_PROP_TAG(LiquidComponentIndex); -NEW_PROP_TAG(GasComponentIndex); -NEW_PROP_TAG(WettingFluid); -NEW_PROP_TAG(NonWettingFluid); - -//! the preconditioner used by the linear solver -NEW_PROP_TAG(PreconditionerWrapper); - -//! The floating point type used internally by the linear solver -NEW_PROP_TAG(LinearSolverScalar); - -/*! - * \brief The size of the algebraic overlap of the linear solver. - * - * Algebraic overlaps can be thought as being the same as the overlap - * of a grid, but it is only existant for the linear system of - * equations. - */ -NEW_PROP_TAG(LinearSolverOverlapSize); - -/*! - * \brief Maximum accepted error of the solution of the linear solver. - */ -NEW_PROP_TAG(LinearSolverTolerance); - -/*! - * \brief Maximum accepted error of the norm of the residual. - */ -NEW_PROP_TAG(LinearSolverAbsTolerance); - -/*! - * \brief Specifies the verbosity of the linear solver - * - * By default it is 0, i.e. it doesn't print anything. Setting this - * property to 1 prints aggregated convergence rates, 2 prints the - * convergence rate of every iteration of the scheme. - */ -NEW_PROP_TAG(LinearSolverVerbosity); - -//! Maximum number of iterations eyecuted by the linear solver -NEW_PROP_TAG(LinearSolverMaxIterations); - -NEW_PROP_TAG(LinearSolverMaxError); - -NEW_PROP_TAG(GMResRestart); -NEW_PROP_TAG(LinearSolverWrapper); - -NEW_PROP_TAG(LinearSolverSplice); -NEW_PROP_TAG(LocalLinearizerSplice); -NEW_PROP_TAG(SpatialDiscretizationSplice); - -//! The discretization specific part of he implementing the Newton algorithm -NEW_PROP_TAG(DiscNewtonMethod); - //! Property which tells the Vanguard how often the grid should be refined //! after creation. NEW_PROP_TAG(GridGlobalRefinements); @@ -440,7 +144,32 @@ NEW_PROP_TAG(RestartTime); //! The name of the file with a number of forced time step lengths NEW_PROP_TAG(PredeterminedTimeStepsFile); -NEW_PROP_TAG(ParameterMetaData); +//! domain size +NEW_PROP_TAG(DomainSizeX); +NEW_PROP_TAG(DomainSizeY); +NEW_PROP_TAG(DomainSizeZ); + +//! grid resolution +NEW_PROP_TAG(CellsX); +NEW_PROP_TAG(CellsY); +NEW_PROP_TAG(CellsZ); + +//! name of the grid file +NEW_PROP_TAG(GridFile); + +//! level of the grid view +NEW_PROP_TAG(GridViewLevel); + +//! Manages the simulation time +NEW_PROP_TAG(Simulator); + +/*! + * \brief The class which marks the border indices associated with the + * degrees of freedom on a process boundary. + * + * This is required for the algebraic overlap stuff. + */ +NEW_PROP_TAG(BorderListCreator); /////////////////////////////////// // Values for the properties @@ -464,7 +193,6 @@ SET_PROP(NumericModel, ParameterTree) //! use the global group as default for the model's parameter group SET_STRING_PROP(NumericModel, ModelParameterGroup, ""); - //! Set a value for the GridFile property SET_STRING_PROP(NumericModel, GridFile, ""); diff --git a/opm/models/utils/parametersystem.hh b/opm/models/utils/parametersystem.hh index 0c7c6ef08..1c54f291c 100644 --- a/opm/models/utils/parametersystem.hh +++ b/opm/models/utils/parametersystem.hh @@ -222,11 +222,7 @@ private: BEGIN_PROPERTIES -// type tag which is supposed to spliced in or inherited from if the -// parameter system is to be used -//NEW_TYPE_TAG(ParameterSystem); - - +NEW_PROP_TAG(ParameterMetaData); //! Set the ParameterMetaData property SET_PROP(ParameterSystem, ParameterMetaData) diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index a8519773c..58b5dcd46 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -35,6 +35,7 @@ #include #include #include +#include #include #include diff --git a/opm/simulators/linalg/istlpreconditionerwrappers.hh b/opm/simulators/linalg/istlpreconditionerwrappers.hh index ebfd02159..e83ab2de0 100644 --- a/opm/simulators/linalg/istlpreconditionerwrappers.hh +++ b/opm/simulators/linalg/istlpreconditionerwrappers.hh @@ -45,14 +45,12 @@ #include #include +#include #include #include -BEGIN_PROPERTIES -END_PROPERTIES - namespace Opm { namespace Linear { #define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \ diff --git a/opm/simulators/linalg/istlsolverwrappers.hh b/opm/simulators/linalg/istlsolverwrappers.hh index 057776b2e..25c315a60 100644 --- a/opm/simulators/linalg/istlsolverwrappers.hh +++ b/opm/simulators/linalg/istlsolverwrappers.hh @@ -45,14 +45,10 @@ #include #include +#include #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { namespace Linear { diff --git a/opm/simulators/linalg/linalgproperties.hh b/opm/simulators/linalg/linalgproperties.hh new file mode 100644 index 000000000..7393ef1b2 --- /dev/null +++ b/opm/simulators/linalg/linalgproperties.hh @@ -0,0 +1,104 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . + + Consult the COPYING file in the top-level source directory of this + module for the precise wording of the license and the list of + copyright holders. +*/ +/*! + * \file + * \ingroup BlackOilModel + * + * \brief Declares the properties required by the black oil model. + */ +#ifndef EWOMS_LINALG_PROPERTIES_HH +#define EWOMS_LINALG_PROPERTIES_HH + +#include + +BEGIN_PROPERTIES + +//! The type of the linear solver to be used +NEW_PROP_TAG(LinearSolverBackend); + +//! the preconditioner used by the linear solver +NEW_PROP_TAG(PreconditionerWrapper); + + +//! The floating point type used internally by the linear solver +NEW_PROP_TAG(LinearSolverScalar); + +/*! + * \brief The size of the algebraic overlap of the linear solver. + * + * Algebraic overlaps can be thought as being the same as the overlap + * of a grid, but it is only existant for the linear system of + * equations. + */ +NEW_PROP_TAG(LinearSolverOverlapSize); + +/*! + * \brief Maximum accepted error of the solution of the linear solver. + */ +NEW_PROP_TAG(LinearSolverTolerance); + +/*! + * \brief Maximum accepted error of the norm of the residual. + */ +NEW_PROP_TAG(LinearSolverAbsTolerance); + +/*! + * \brief Specifies the verbosity of the linear solver + * + * By default it is 0, i.e. it doesn't print anything. Setting this + * property to 1 prints aggregated convergence rates, 2 prints the + * convergence rate of every iteration of the scheme. + */ +NEW_PROP_TAG(LinearSolverVerbosity); + +//! Maximum number of iterations eyecuted by the linear solver +NEW_PROP_TAG(LinearSolverMaxIterations); + +//! The order of the sequential preconditioner +NEW_PROP_TAG(PreconditionerOrder); + +//! The relaxation factor of the preconditioner +NEW_PROP_TAG(PreconditionerRelaxation); + +//! number of iterations between solver restarts for the GMRES solver +NEW_PROP_TAG(GMResRestart); + +//! The class that allows to manipulate sparse matrices +NEW_PROP_TAG(SparseMatrixAdapter); + +//! Vector containing a quantity of for equation for each DOF of the whole grid +NEW_PROP_TAG(GlobalEqVector); + +NEW_PROP_TAG(AmgCoarsenTarget); +NEW_PROP_TAG(LinearSolverMaxError); +NEW_PROP_TAG(LinearSolverWrapper); +NEW_PROP_TAG(Overlap); +NEW_PROP_TAG(OverlappingLinearOperator); +NEW_PROP_TAG(OverlappingMatrix); +NEW_PROP_TAG(OverlappingScalarProduct); +NEW_PROP_TAG(OverlappingVector); +NEW_TYPE_TAG(ParallelBaseLinearSolver); + +END_PROPERTIES + +#endif diff --git a/opm/simulators/linalg/parallelamgbackend.hh b/opm/simulators/linalg/parallelamgbackend.hh index 03a542b58..cc30c393e 100644 --- a/opm/simulators/linalg/parallelamgbackend.hh +++ b/opm/simulators/linalg/parallelamgbackend.hh @@ -27,6 +27,7 @@ #ifndef EWOMS_PARALLEL_AMG_BACKEND_HH #define EWOMS_PARALLEL_AMG_BACKEND_HH +#include "linalgproperties.hh" #include "parallelbasebackend.hh" #include "bicgstabsolver.hh" #include "combinedcriterion.hh" @@ -51,7 +52,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ParallelAmgLinearSolver, INHERITS_FROM(ParallelBaseLinearSolver)); - //! The target number of DOFs per processor for the parallel algebraic //! multi-grid solver SET_INT_PROP(ParallelAmgLinearSolver, AmgCoarsenTarget, 5000); diff --git a/opm/simulators/linalg/parallelbasebackend.hh b/opm/simulators/linalg/parallelbasebackend.hh index 0b0d6dc31..33f0e6209 100644 --- a/opm/simulators/linalg/parallelbasebackend.hh +++ b/opm/simulators/linalg/parallelbasebackend.hh @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -51,47 +52,6 @@ #include BEGIN_PROPERTIES -NEW_TYPE_TAG(ParallelBaseLinearSolver); - -// forward declaration of the required property tags - - -//! The type of the linear solver to be used - -//! the preconditioner used by the linear solver - - -//! The floating point type used internally by the linear solver - -/*! - * \brief The size of the algebraic overlap of the linear solver. - * - * Algebraic overlaps can be thought as being the same as the overlap - * of a grid, but it is only existant for the linear system of - * equations. - */ - -/*! - * \brief Maximum accepted error of the solution of the linear solver. - */ - -/*! - * \brief Maximum accepted error of the norm of the residual. - */ - -/*! - * \brief Specifies the verbosity of the linear solver - * - * By default it is 0, i.e. it doesn't print anything. Setting this - * property to 1 prints aggregated convergence rates, 2 prints the - * convergence rate of every iteration of the scheme. - */ - -//! Maximum number of iterations eyecuted by the linear solver - -//! The order of the sequential preconditioner - -//! The relaxation factor of the preconditioner //! Set the type of a global jacobian matrix for linear solvers that are based on //! dune-istl. diff --git a/opm/simulators/linalg/parallelbicgstabbackend.hh b/opm/simulators/linalg/parallelbicgstabbackend.hh index 11b76c6b3..81ab6e457 100644 --- a/opm/simulators/linalg/parallelbicgstabbackend.hh +++ b/opm/simulators/linalg/parallelbicgstabbackend.hh @@ -27,6 +27,7 @@ #ifndef EWOMS_PARALLEL_BICGSTAB_BACKEND_HH #define EWOMS_PARALLEL_BICGSTAB_BACKEND_HH +#include "linalgproperties.hh" #include "parallelbasebackend.hh" #include "bicgstabsolver.hh" #include "combinedcriterion.hh" diff --git a/opm/simulators/linalg/parallelistlbackend.hh b/opm/simulators/linalg/parallelistlbackend.hh index dbb6619fd..577f31a92 100644 --- a/opm/simulators/linalg/parallelistlbackend.hh +++ b/opm/simulators/linalg/parallelistlbackend.hh @@ -27,6 +27,7 @@ #ifndef EWOMS_PARALLEL_ISTL_BACKEND_HH #define EWOMS_PARALLEL_ISTL_BACKEND_HH +#include "linalgproperties.hh" #include "parallelbasebackend.hh" #include "istlsolverwrappers.hh" #include "istlsparsematrixadapter.hh" @@ -37,9 +38,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ParallelIstlLinearSolver, INHERITS_FROM(ParallelBaseLinearSolver)); - -//! number of iterations between solver restarts for the GMRES solver - END_PROPERTIES namespace Opm { diff --git a/opm/simulators/linalg/superlubackend.hh b/opm/simulators/linalg/superlubackend.hh index ee7370eff..170aa1511 100644 --- a/opm/simulators/linalg/superlubackend.hh +++ b/opm/simulators/linalg/superlubackend.hh @@ -31,6 +31,7 @@ #include #include +#include #include From 58182fe3799b2a3de627e2511ab333de40578645 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Wed, 13 May 2020 17:16:31 +0200 Subject: [PATCH 08/12] [properties] clean up --- examples/lens_immiscible_ecfv_ad.cpp | 4 ++-- examples/lens_immiscible_ecfv_ad_23.cpp | 6 ++---- examples/lens_immiscible_ecfv_ad_cu1.cpp | 4 ++-- examples/lens_immiscible_ecfv_ad_cu2.cpp | 4 ++-- examples/problems/lensproblem.hh | 1 - examples/problems/reservoirproblem.hh | 2 -- examples/tutorial1.cpp | 1 - examples/tutorial1problem.hh | 2 -- opm/models/common/darcyfluxmodule.hh | 5 ----- opm/models/common/diffusionmodule.hh | 5 ----- opm/models/common/energymodule.hh | 5 ----- opm/models/common/forchheimerfluxmodule.hh | 5 ----- opm/models/common/multiphasebaseproblem.hh | 5 ----- opm/models/discretefracture/discretefractureproblem.hh | 5 ----- .../discretization/common/baseauxiliarymodule.hh | 2 -- .../discretization/common/fvbaseadlocallinearizer.hh | 1 - opm/models/discretization/common/fvbaseconstraints.hh | 5 ----- .../common/fvbasenewtonconvergencewriter.hh | 3 +++ opm/models/discretization/common/fvbaseproperties.hh | 1 - opm/models/io/baseoutputmodule.hh | 8 ++++---- opm/models/io/cubegridvanguard.hh | 8 -------- opm/models/io/dgfvanguard.hh | 4 ---- opm/models/io/simplexvanguard.hh | 8 -------- opm/models/io/structuredgridvanguard.hh | 5 ----- opm/models/ncp/ncpnewtonmethod.hh | 1 + opm/models/parallel/threadmanager.hh | 5 ----- opm/models/utils/basicproperties.hh | 10 +++------- opm/models/utils/parametersystem.hh | 7 ++++++- opm/models/utils/propertysystemmacros.hh | 8 ++++---- opm/models/utils/simulator.hh | 5 ----- opm/models/utils/start.hh | 6 ------ opm/simulators/linalg/linalgproperties.hh | 1 - opm/simulators/linalg/parallelbasebackend.hh | 1 + opm/simulators/linalg/parallelbicgstabbackend.hh | 1 - opm/simulators/linalg/superlubackend.hh | 1 - 35 files changed, 30 insertions(+), 115 deletions(-) diff --git a/examples/lens_immiscible_ecfv_ad.cpp b/examples/lens_immiscible_ecfv_ad.cpp index 0df0537cd..9a91e1ab7 100644 --- a/examples/lens_immiscible_ecfv_ad.cpp +++ b/examples/lens_immiscible_ecfv_ad.cpp @@ -28,10 +28,10 @@ */ #include "config.h" -#include - #include "lens_immiscible_ecfv_ad.hh" +#include + int main(int argc, char **argv) { typedef TTAG(LensProblemEcfvAd) ProblemTypeTag; diff --git a/examples/lens_immiscible_ecfv_ad_23.cpp b/examples/lens_immiscible_ecfv_ad_23.cpp index 7a24e7eb6..9c79a7587 100644 --- a/examples/lens_immiscible_ecfv_ad_23.cpp +++ b/examples/lens_immiscible_ecfv_ad_23.cpp @@ -28,13 +28,11 @@ */ #include "config.h" +#include "lens_immiscible_ecfv_ad.hh" + #include #include -#include - -#include "lens_immiscible_ecfv_ad.hh" - BEGIN_PROPERTIES // Use Dune-grid's GeometryGrid< YaspGrid > diff --git a/examples/lens_immiscible_ecfv_ad_cu1.cpp b/examples/lens_immiscible_ecfv_ad_cu1.cpp index b0aff7f66..bcfc7142c 100644 --- a/examples/lens_immiscible_ecfv_ad_cu1.cpp +++ b/examples/lens_immiscible_ecfv_ad_cu1.cpp @@ -34,10 +34,10 @@ */ #include "config.h" -#include - #include "lens_immiscible_ecfv_ad.hh" +#include + // fake forward declaration to prevent esoteric compiler warning int mainCU1(int argc, char **argv); diff --git a/examples/lens_immiscible_ecfv_ad_cu2.cpp b/examples/lens_immiscible_ecfv_ad_cu2.cpp index 7dede5a9f..c6d1d5df8 100644 --- a/examples/lens_immiscible_ecfv_ad_cu2.cpp +++ b/examples/lens_immiscible_ecfv_ad_cu2.cpp @@ -34,10 +34,10 @@ */ #include "config.h" -#include - #include "lens_immiscible_ecfv_ad.hh" +#include + // fake forward declaration to prevent esoteric compiler warning int mainCU2(int argc, char **argv); diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index ecf3feaf4..094d042a4 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -68,7 +68,6 @@ NEW_PROP_TAG(LensUpperRightX); NEW_PROP_TAG(LensUpperRightY); NEW_PROP_TAG(LensUpperRightZ); - // Set the problem property SET_TYPE_PROP(LensBaseProblem, Problem, Opm::LensProblem); diff --git a/examples/problems/reservoirproblem.hh b/examples/problems/reservoirproblem.hh index 5598ce4c1..2cb0ef2b3 100644 --- a/examples/problems/reservoirproblem.hh +++ b/examples/problems/reservoirproblem.hh @@ -63,10 +63,8 @@ NEW_TYPE_TAG(ReservoirBaseProblem); // Maximum depth of the reservoir NEW_PROP_TAG(MaxDepth); - // The temperature inside the reservoir NEW_PROP_TAG(Temperature); - // The width of producer/injector wells as a fraction of the width of the spatial domain NEW_PROP_TAG(WellWidth); diff --git a/examples/tutorial1.cpp b/examples/tutorial1.cpp index 831c83df5..a65e78f0f 100644 --- a/examples/tutorial1.cpp +++ b/examples/tutorial1.cpp @@ -27,7 +27,6 @@ * immisciblility. */ #include "config.h" /*@\label{tutorial1:include-begin}@*/ -#include #include /*@\label{tutorial1:include-end}@*/ #include "tutorial1problem.hh" /*@\label{tutorial1:include-problem-header}@*/ diff --git a/examples/tutorial1problem.hh b/examples/tutorial1problem.hh index 65c6c6618..1d01cb2e0 100644 --- a/examples/tutorial1problem.hh +++ b/examples/tutorial1problem.hh @@ -34,8 +34,6 @@ // The spatial discretization (VCFV == Vertex-Centered Finite Volumes) #include /*@\label{tutorial1:include-discretization}@*/ -#include - // The chemical species that are used #include #include diff --git a/opm/models/common/darcyfluxmodule.hh b/opm/models/common/darcyfluxmodule.hh index 59c75f989..42cc7f421 100644 --- a/opm/models/common/darcyfluxmodule.hh +++ b/opm/models/common/darcyfluxmodule.hh @@ -42,11 +42,6 @@ #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { template diff --git a/opm/models/common/diffusionmodule.hh b/opm/models/common/diffusionmodule.hh index 09c3b267f..c2785b847 100644 --- a/opm/models/common/diffusionmodule.hh +++ b/opm/models/common/diffusionmodule.hh @@ -37,11 +37,6 @@ #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/common/energymodule.hh b/opm/models/common/energymodule.hh index 6339f3328..c52379f4c 100644 --- a/opm/models/common/energymodule.hh +++ b/opm/models/common/energymodule.hh @@ -40,11 +40,6 @@ #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { /*! * \ingroup Energy diff --git a/opm/models/common/forchheimerfluxmodule.hh b/opm/models/common/forchheimerfluxmodule.hh index 61307c9f6..45ce29fdc 100644 --- a/opm/models/common/forchheimerfluxmodule.hh +++ b/opm/models/common/forchheimerfluxmodule.hh @@ -43,11 +43,6 @@ #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { template class ForchheimerIntensiveQuantities; diff --git a/opm/models/common/multiphasebaseproblem.hh b/opm/models/common/multiphasebaseproblem.hh index a83b846f6..2097acba4 100644 --- a/opm/models/common/multiphasebaseproblem.hh +++ b/opm/models/common/multiphasebaseproblem.hh @@ -41,11 +41,6 @@ #include #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/discretefracture/discretefractureproblem.hh b/opm/models/discretefracture/discretefractureproblem.hh index 7c184e7b8..1f45d53b1 100644 --- a/opm/models/discretefracture/discretefractureproblem.hh +++ b/opm/models/discretefracture/discretefractureproblem.hh @@ -39,11 +39,6 @@ #include #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/discretization/common/baseauxiliarymodule.hh b/opm/models/discretization/common/baseauxiliarymodule.hh index 1e425c00e..b4dbb6fe6 100644 --- a/opm/models/discretization/common/baseauxiliarymodule.hh +++ b/opm/models/discretization/common/baseauxiliarymodule.hh @@ -38,8 +38,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(AuxModule); -// declare the properties required by the for the ecl grid manager - END_PROPERTIES namespace Opm { diff --git a/opm/models/discretization/common/fvbaseadlocallinearizer.hh b/opm/models/discretization/common/fvbaseadlocallinearizer.hh index 7b5cf10db..ea7fc34e7 100644 --- a/opm/models/discretization/common/fvbaseadlocallinearizer.hh +++ b/opm/models/discretization/common/fvbaseadlocallinearizer.hh @@ -52,7 +52,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(AutoDiffLocalLinearizer); - // set the properties to be spliced in SET_TYPE_PROP(AutoDiffLocalLinearizer, LocalLinearizer, Opm::FvBaseAdLocalLinearizer); diff --git a/opm/models/discretization/common/fvbaseconstraints.hh b/opm/models/discretization/common/fvbaseconstraints.hh index 1b152123e..feb7b259e 100644 --- a/opm/models/discretization/common/fvbaseconstraints.hh +++ b/opm/models/discretization/common/fvbaseconstraints.hh @@ -31,11 +31,6 @@ #include #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh b/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh index 4f0c2adef..6b7e26290 100644 --- a/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh +++ b/opm/models/discretization/common/fvbasenewtonconvergencewriter.hh @@ -33,8 +33,10 @@ #include +//! \cond SKIP_THIS BEGIN_PROPERTIES +// forward declaration of the required property tags template struct SolutionVector; template @@ -45,6 +47,7 @@ template struct VtkOutputFormat; END_PROPERTIES +//! \endcond namespace Opm { /*! diff --git a/opm/models/discretization/common/fvbaseproperties.hh b/opm/models/discretization/common/fvbaseproperties.hh index 25db7c3fa..3d336830c 100644 --- a/opm/models/discretization/common/fvbaseproperties.hh +++ b/opm/models/discretization/common/fvbaseproperties.hh @@ -60,7 +60,6 @@ SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSol //! by default, use finite differences to linearize the system of PDEs SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalLinearizer); - /*! * \brief Representation of a function evaluation and all necessary derivatives with * regard to the intensive quantities of the primary variables. diff --git a/opm/models/io/baseoutputmodule.hh b/opm/models/io/baseoutputmodule.hh index 275841645..c2909b015 100644 --- a/opm/models/io/baseoutputmodule.hh +++ b/opm/models/io/baseoutputmodule.hh @@ -47,14 +47,14 @@ #include -namespace Opm { - -namespace Properties { +BEGIN_PROPERTIES template struct FluidSystem; -} // namespace Properties +END_PROPERTIES + +namespace Opm { #if __GNUC__ || __clang__ #pragma GCC diagnostic push diff --git a/opm/models/io/cubegridvanguard.hh b/opm/models/io/cubegridvanguard.hh index d6a836c23..0037a48a0 100644 --- a/opm/models/io/cubegridvanguard.hh +++ b/opm/models/io/cubegridvanguard.hh @@ -38,14 +38,6 @@ #include -BEGIN_PROPERTIES - - - - - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/io/dgfvanguard.hh b/opm/models/io/dgfvanguard.hh index 69a55cfdf..64d0b46be 100644 --- a/opm/models/io/dgfvanguard.hh +++ b/opm/models/io/dgfvanguard.hh @@ -39,10 +39,6 @@ #include #include -BEGIN_PROPERTIES - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/io/simplexvanguard.hh b/opm/models/io/simplexvanguard.hh index efebb5f54..6add92600 100644 --- a/opm/models/io/simplexvanguard.hh +++ b/opm/models/io/simplexvanguard.hh @@ -36,14 +36,6 @@ #include -BEGIN_PROPERTIES - - - - - -END_PROPERTIES - namespace Opm { /*! * \brief Provides a simulator vanguard which a creates regular grid made of simplices. diff --git a/opm/models/io/structuredgridvanguard.hh b/opm/models/io/structuredgridvanguard.hh index 1af91287d..c79e9a478 100644 --- a/opm/models/io/structuredgridvanguard.hh +++ b/opm/models/io/structuredgridvanguard.hh @@ -56,11 +56,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(StructuredGridVanguard); -// declare the properties required by the for the structured grid simulator vanguard - - - - // GRIDDIM is only set by the finger problem #ifndef GRIDDIM static const int dim = 2; diff --git a/opm/models/ncp/ncpnewtonmethod.hh b/opm/models/ncp/ncpnewtonmethod.hh index a65f1ad35..ef3b5eea0 100644 --- a/opm/models/ncp/ncpnewtonmethod.hh +++ b/opm/models/ncp/ncpnewtonmethod.hh @@ -34,6 +34,7 @@ #include #include + #include BEGIN_PROPERTIES diff --git a/opm/models/parallel/threadmanager.hh b/opm/models/parallel/threadmanager.hh index 15f408133..6ecb29d3e 100644 --- a/opm/models/parallel/threadmanager.hh +++ b/opm/models/parallel/threadmanager.hh @@ -38,11 +38,6 @@ #include -BEGIN_PROPERTIES - - -END_PROPERTIES - namespace Opm { /*! diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 44d7642dd..32ee8ff48 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -35,12 +35,12 @@ #ifndef OPM_PROPERTY_SYSTEM_HH #include -// remove this after release 3.1 to disable macros per default +// remove this after release 2020.10 to disable macros per default #ifndef OPM_ENABLE_OLD_PROPERTY_MACROS #define OPM_ENABLE_OLD_PROPERTY_MACROS 1 #endif -// remove this after release 3.2 to remove macros completely +// remove this after release 2021.04 to remove macros completely #if OPM_ENABLE_OLD_PROPERTY_MACROS #include #endif // OPM_ENABLE_OLD_PROPERTY_MACROS @@ -54,13 +54,8 @@ #include - BEGIN_PROPERTIES -// type tag which is supposed to spliced in or inherited from if the -// parameter system is to be used -NEW_TYPE_TAG(ParameterSystem); - /////////////////////////////////// // Type tag definitions: // @@ -237,6 +232,7 @@ SET_SCALAR_PROP(NumericModel, RestartTime, -1e35); //! By default, do not force any time steps SET_STRING_PROP(NumericModel, PredeterminedTimeStepsFile, ""); + END_PROPERTIES #endif diff --git a/opm/models/utils/parametersystem.hh b/opm/models/utils/parametersystem.hh index 1c54f291c..557dcbfd8 100644 --- a/opm/models/utils/parametersystem.hh +++ b/opm/models/utils/parametersystem.hh @@ -32,7 +32,7 @@ #ifndef EWOMS_PARAMETER_SYSTEM_HH #define EWOMS_PARAMETER_SYSTEM_HH -#include +#include #include #include @@ -222,8 +222,13 @@ private: BEGIN_PROPERTIES +// type tag which is supposed to spliced in or inherited from if the +// parameter system is to be used +NEW_TYPE_TAG(ParameterSystem); + NEW_PROP_TAG(ParameterMetaData); + //! Set the ParameterMetaData property SET_PROP(ParameterSystem, ParameterMetaData) { diff --git a/opm/models/utils/propertysystemmacros.hh b/opm/models/utils/propertysystemmacros.hh index 437dab89b..134b3a556 100644 --- a/opm/models/utils/propertysystemmacros.hh +++ b/opm/models/utils/propertysystemmacros.hh @@ -38,11 +38,11 @@ */ #ifndef OPM_PROPERTY_SYSTEM_MACROS_HH #define OPM_PROPERTY_SYSTEM_MACROS_HH -#warning "Property macros are deprecated and will be removed after release 3.2. \ +#warning "Property macros are deprecated and will be removed after release 2021.04. \ If you are not using property macros you can disable this warning by \ -setting OPM_ENABLE_OLD_PROPERTY_MACROS to 0 (false) when configuring DuMux. \ -OPM_ENABLE_OLD_PROPERTY_MACROS defaults to 1 (true) until release 3.1. \ -After release 3.1 it will default to 0 (false) so you will have to manually \ +setting OPM_ENABLE_OLD_PROPERTY_MACROS to 0 (false) when configuring OPM. \ +OPM_ENABLE_OLD_PROPERTY_MACROS defaults to 1 (true) until release 2020.10. \ +After release 2020.10 it will default to 0 (false) so you will have to manually \ enable property macros in order to use them." #include diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index 58b5dcd46..207623e4b 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -47,11 +47,6 @@ #include #include -BEGIN_PROPERTIES - - -END_PROPERTIES - #define EWOMS_CATCH_PARALLEL_EXCEPTIONS_FATAL(code) \ { \ const auto& comm = Dune::MPIHelper::getCollectiveCommunication(); \ diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index 1b09980fa..7ff3fc778 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -69,12 +69,6 @@ #include #endif -BEGIN_PROPERTIES - -// forward declaration of property tags - -END_PROPERTIES - //! \cond SKIP_THIS namespace Opm { diff --git a/opm/simulators/linalg/linalgproperties.hh b/opm/simulators/linalg/linalgproperties.hh index 7393ef1b2..9f9d68e87 100644 --- a/opm/simulators/linalg/linalgproperties.hh +++ b/opm/simulators/linalg/linalgproperties.hh @@ -97,7 +97,6 @@ NEW_PROP_TAG(OverlappingLinearOperator); NEW_PROP_TAG(OverlappingMatrix); NEW_PROP_TAG(OverlappingScalarProduct); NEW_PROP_TAG(OverlappingVector); -NEW_TYPE_TAG(ParallelBaseLinearSolver); END_PROPERTIES diff --git a/opm/simulators/linalg/parallelbasebackend.hh b/opm/simulators/linalg/parallelbasebackend.hh index 33f0e6209..25232f524 100644 --- a/opm/simulators/linalg/parallelbasebackend.hh +++ b/opm/simulators/linalg/parallelbasebackend.hh @@ -52,6 +52,7 @@ #include BEGIN_PROPERTIES +NEW_TYPE_TAG(ParallelBaseLinearSolver); //! Set the type of a global jacobian matrix for linear solvers that are based on //! dune-istl. diff --git a/opm/simulators/linalg/parallelbicgstabbackend.hh b/opm/simulators/linalg/parallelbicgstabbackend.hh index 81ab6e457..036370b3b 100644 --- a/opm/simulators/linalg/parallelbicgstabbackend.hh +++ b/opm/simulators/linalg/parallelbicgstabbackend.hh @@ -45,7 +45,6 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(ParallelBiCGStabLinearSolver, INHERITS_FROM(ParallelBaseLinearSolver)); - SET_TYPE_PROP(ParallelBiCGStabLinearSolver, LinearSolverBackend, Opm::Linear::ParallelBiCGStabSolverBackend); diff --git a/opm/simulators/linalg/superlubackend.hh b/opm/simulators/linalg/superlubackend.hh index 170aa1511..2c1d0190c 100644 --- a/opm/simulators/linalg/superlubackend.hh +++ b/opm/simulators/linalg/superlubackend.hh @@ -41,7 +41,6 @@ BEGIN_PROPERTIES -// forward declaration of the required property tags NEW_TYPE_TAG(SuperLULinearSolver); END_PROPERTIES From 2fe69dfd9b61d2108d90cb02f74a2e20df7a4c6d Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Fri, 15 May 2020 16:17:21 +0200 Subject: [PATCH 09/12] [properties] fix macros that are used in opm-simulators, change include order --- opm/models/io/basevanguard.hh | 2 +- opm/models/utils/basicproperties.hh | 15 --------------- opm/models/utils/parametersystem.hh | 23 +++++++++-------------- opm/models/utils/propertysystem.hh | 10 ++++++++++ 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/opm/models/io/basevanguard.hh b/opm/models/io/basevanguard.hh index e2bb7276b..e484ccf04 100644 --- a/opm/models/io/basevanguard.hh +++ b/opm/models/io/basevanguard.hh @@ -27,7 +27,7 @@ #ifndef EWOMS_BASE_VANGUARD_HH #define EWOMS_BASE_VANGUARD_HH -#include +#include #include #include diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 32ee8ff48..b82430994 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -30,22 +30,7 @@ #include -// explicitly guard the include so that the property system -// header doesn't need to be opened and checked all the time -#ifndef OPM_PROPERTY_SYSTEM_HH #include - -// remove this after release 2020.10 to disable macros per default -#ifndef OPM_ENABLE_OLD_PROPERTY_MACROS -#define OPM_ENABLE_OLD_PROPERTY_MACROS 1 -#endif - -// remove this after release 2021.04 to remove macros completely -#if OPM_ENABLE_OLD_PROPERTY_MACROS -#include -#endif // OPM_ENABLE_OLD_PROPERTY_MACROS -#endif // OPM_PROPERTY_SYSTEM_HH - #include #if HAVE_DUNE_FEM diff --git a/opm/models/utils/parametersystem.hh b/opm/models/utils/parametersystem.hh index 557dcbfd8..0ba9b8ca7 100644 --- a/opm/models/utils/parametersystem.hh +++ b/opm/models/utils/parametersystem.hh @@ -85,7 +85,7 @@ * This allows to deal with unused parameters */ #define EWOMS_HIDE_PARAM(TypeTag, ParamName) \ - ::Opm::Parameters::hideParam(#ParamName) + ::Opm::Parameters::hideParam(#ParamName, GET_PROP_VALUE(TypeTag, ParamName)) /*! * \ingroup Parameter @@ -148,8 +148,7 @@ * If the parameter in question has not been registered, this throws an exception. */ #define EWOMS_PARAM_IS_SET(TypeTag, ParamType, ParamName) \ - (::Opm::Parameters::isSet(#ParamName, \ - #ParamName)) + (::Opm::Parameters::isSet(#ParamName, #ParamName)) namespace Opm { namespace Parameters { @@ -969,7 +968,7 @@ public: ParamsMeta::clear(); } - template + template static bool isSet(const char *propTagName OPM_OPTIM_UNUSED, const char *paramName OPM_OPTIM_UNUSED, bool errorIfNotRegistered = true) @@ -1130,12 +1129,12 @@ void reset() return Param::clear(); } -template +template bool isSet(const char *propTagName, const char *paramName, bool errorIfNotRegistered = true) { - return Param::template isSet(propTagName, - paramName, - errorIfNotRegistered); + return Param::template isSet(propTagName, + paramName, + errorIfNotRegistered); } template @@ -1172,13 +1171,9 @@ void registerParam(const char *paramName, const char *propertyName, const ParamT ParamsMeta::mutableRegistry()[paramName] = paramInfo; } -template -void hideParam(const char *paramName) +template +void hideParam(const char *paramName, const ParamType& defaultValue) { - // make sure that a property with the parameter name exists. we cannot check if a - // parameter exists at compile time, so this will only be caught at runtime - static const auto defaultValue OPM_UNUSED = getPropValue; - typedef typename GET_PROP(TypeTag, ParameterMetaData) ParamsMeta; if (!ParamsMeta::registrationOpen()) throw std::logic_error("Parameter '"+std::string(paramName)+"' declared as hidden" diff --git a/opm/models/utils/propertysystem.hh b/opm/models/utils/propertysystem.hh index 6c49db5ec..916d2a59c 100644 --- a/opm/models/utils/propertysystem.hh +++ b/opm/models/utils/propertysystem.hh @@ -268,4 +268,14 @@ void printValues(std::ostream& os = std::cout) } // end namespace Opm +// remove this after release 2020.10 to disable macros per default +#ifndef OPM_ENABLE_OLD_PROPERTY_MACROS +#define OPM_ENABLE_OLD_PROPERTY_MACROS 1 +#endif + +// remove this after release 2021.04 to remove macros completely +#if OPM_ENABLE_OLD_PROPERTY_MACROS +#include +#endif // OPM_ENABLE_OLD_PROPERTY_MACROS + #endif From cb81d87fd342cffedd269bfd84a364eef4d917de Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Fri, 15 May 2020 16:20:32 +0200 Subject: [PATCH 10/12] [properties] add forward declaration --- opm/models/utils/propertysystemmacros.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opm/models/utils/propertysystemmacros.hh b/opm/models/utils/propertysystemmacros.hh index 134b3a556..a1b046728 100644 --- a/opm/models/utils/propertysystemmacros.hh +++ b/opm/models/utils/propertysystemmacros.hh @@ -236,6 +236,9 @@ struct GetTypeTagInheritance> using type = __VA_ARGS__; \ } +template +struct Scalar; + /*! * \ingroup Properties * \brief Set a property to a simple constant scalar value. From 4c3bd69687874305d5584f29301962207f165258 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Fri, 15 May 2020 17:27:37 +0200 Subject: [PATCH 11/12] [properties] recover a more general SET_SPLICES macro --- opm/models/common/multiphasebasemodel.hh | 2 +- opm/models/utils/propertysystemmacros.hh | 114 ++++++++++------------- 2 files changed, 51 insertions(+), 65 deletions(-) diff --git a/opm/models/common/multiphasebasemodel.hh b/opm/models/common/multiphasebasemodel.hh index 9d4871619..6c7640f9b 100644 --- a/opm/models/common/multiphasebasemodel.hh +++ b/opm/models/common/multiphasebasemodel.hh @@ -56,7 +56,7 @@ BEGIN_PROPERTIES NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(VtkMultiPhase, VtkTemperature)); //! Specify the splices of the MultiPhaseBaseModel type tag -SET_SPLICE(MultiPhaseBaseModel, SpatialDiscretizationSplice); +SET_SPLICES(MultiPhaseBaseModel, SpatialDiscretizationSplice); //! Set the default spatial discretization //! diff --git a/opm/models/utils/propertysystemmacros.hh b/opm/models/utils/propertysystemmacros.hh index a1b046728..1746f8200 100644 --- a/opm/models/utils/propertysystemmacros.hh +++ b/opm/models/utils/propertysystemmacros.hh @@ -285,70 +285,43 @@ struct Scalar; #define GET_PROP_VALUE(TypeTag, PropTagName) ::Opm::Properties::Detail::GetPropImpl::type::value #define GET_PROP_TYPE(TypeTag, PropTagName) ::Opm::Properties::Detail::GetPropImpl::type::type - /*! - * \ingroup Properties - * \brief Define splices for a given type tag. - * - * Splices can be seen as children which can be overridden lower in - * the hierarchy. It can thus be seen as a "deferred inheritance" - * mechanism. Example: - * - * \code - * // First, define type tags for two different linear solvers: - * // BiCGStab and SuperLU. The first needs the "MaxIterations" - * // property, the second defines the "UsePivoting" property. - * NEW_TYPE_TAG(BiCGStabSolver); - * NEW_PROP_TAG(MaxIterations); - * SET_INT_PROP(BiCGStabSolver, MaxIterations, 100); - * - * NEW_TYPE_TAG(SuperLUSolver); - * NEW_PROP_TAG(UsePivoting); - * SET_BOOL_PROP(SuperLUSolver, UsePivoting, true); - * - * // The model type tag defines the splice 'LinearSolver' and sets it - * // to the 'BiCGStabSolver' type tag. - * NEW_TYPE_TAG(ModelTypeTag); - * NEW_PROP_TAG(LinearSolver); - * SET_SPLICES(ModelTypeTag, LinearSolver); - * SET_TAG_PROP(ModelTypeTag, LinearSolver, BiCGStabSolver); - * - * // The problem type tag is derived from the model type tag, but uses - * // the SuperLU solver. Since this is done using a splice, all properties - * // defined for the "SuperLUSolver" are inherited and the ones for the - * // BiCGStabSolver type tag are undefined - * NEW_TYPE_TAG(ProblemTypeTag, INHERITS_FROM(ModelTypeTag)); - * SET_TAG_PROP(ProblemTypeTag, LinearSolver, SuperLUSolver); - * \endcode - */ +/*! + * \ingroup Properties + * \brief Define splices for a given type tag. + * + * Splices can be seen as children which can be overridden lower in + * the hierarchy. It can thus be seen as a "deferred inheritance" + * mechanism. Example: + * + * \code + * // First, define type tags for two different linear solvers: + * // BiCGStab and SuperLU. The first needs the "MaxIterations" + * // property, the second defines the "UsePivoting" property. + * NEW_TYPE_TAG(BiCGStabSolver); + * NEW_PROP_TAG(MaxIterations); + * SET_INT_PROP(BiCGStabSolver, MaxIterations, 100); + * + * NEW_TYPE_TAG(SuperLUSolver); + * NEW_PROP_TAG(UsePivoting); + * SET_BOOL_PROP(SuperLUSolver, UsePivoting, true); + * + * // The model type tag defines the splice 'LinearSolver' and sets it + * // to the 'BiCGStabSolver' type tag. + * NEW_TYPE_TAG(ModelTypeTag); + * NEW_PROP_TAG(LinearSolver); + * SET_SPLICES(ModelTypeTag, LinearSolver); + * SET_TAG_PROP(ModelTypeTag, LinearSolver, BiCGStabSolver); + * + * // The problem type tag is derived from the model type tag, but uses + * // the SuperLU solver. Since this is done using a splice, all properties + * // defined for the "SuperLUSolver" are inherited and the ones for the + * // BiCGStabSolver type tag are undefined + * NEW_TYPE_TAG(ProblemTypeTag, INHERITS_FROM(ModelTypeTag)); + * SET_TAG_PROP(ProblemTypeTag, LinearSolver, SuperLUSolver); + * \endcode + */ - // template class to revert the order or a std::tuple's arguments. This is required to - // make the properties of children defined on the right overwrite the properties of the - // children on the left. See https://sydius.me/2011/07/reverse-tuple-in-c/ - template - class RevertedTuple - { - private: - template - struct RevertedTupleOuter - { - template - struct RevertedTupleInner: RevertedTupleOuter::template RevertedTupleInner { }; - }; - - template - struct RevertedTupleOuter<0, All...> - { - template - struct RevertedTupleInner { - typedef std::tuple type; - }; - }; - - public: - typedef typename RevertedTupleOuter::template RevertedTupleInner::type type; - }; - -#define SET_SPLICE(TypeTagName, SpliceName) \ +#define SET_ONE_SPLICE(TypeTagName, SpliceName) \ template \ struct Splices \ { \ @@ -356,7 +329,7 @@ struct Splices \ }; \ extern int semicolonHack_ -#define SET_SPLICES(TypeTagName, SpliceName1, SpliceName2) \ +#define SET_TWO_SPLICES(TypeTagName, SpliceName1, SpliceName2) \ template \ struct Splices \ { \ @@ -365,6 +338,19 @@ struct Splices \ }; \ extern int semicolonHack_ +#define SET_THREE_SPLICES(TypeTagName, SpliceName1, SpliceName2, SpliceName3) \ +template \ +struct Splices \ +{ \ + using type = std::tuple, \ + GetSplicePropType, \ + GetSplicePropType>; \ +}; \ +extern int semicolonHack_ + +// From https://stackoverflow.com/questions/11761703/overloading-macro-on-number-of-arguments +#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME +#define SET_SPLICES(...) GET_MACRO(__VA_ARGS__, SET_THREE_SPLICES, SET_TWO_SPLICES, SET_ONE_SPLICE)(__VA_ARGS__) #define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \ template \ From 196e0b9b9babe5edc4f508792eef2bb547045af1 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Tue, 19 May 2020 13:52:34 +0200 Subject: [PATCH 12/12] [parameters] restore full functionality of getting parameters --- opm/models/utils/parametersystem.hh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/opm/models/utils/parametersystem.hh b/opm/models/utils/parametersystem.hh index 0ba9b8ca7..e3f7f14b0 100644 --- a/opm/models/utils/parametersystem.hh +++ b/opm/models/utils/parametersystem.hh @@ -115,12 +115,12 @@ * \endcode */ #define EWOMS_GET_PARAM(TypeTag, ParamType, ParamName) \ - (::Opm::Parameters::get(#ParamName, \ + (::Opm::Parameters::get(#ParamName, #ParamName, \ GET_PROP_VALUE(TypeTag, ParamName))) //!\cond SKIP_THIS #define EWOMS_GET_PARAM_(TypeTag, ParamType, ParamName) \ - (::Opm::Parameters::get(#ParamName, \ + (::Opm::Parameters::get(#ParamName, #ParamName, \ GET_PROP_VALUE(TypeTag, ParamName), \ /*errorIfNotRegistered=*/false)) @@ -180,7 +180,8 @@ const ParamType get(const char *propTagName, const char *paramName, bool errorIfNotRegistered = true); template -const ParamType get(const char *paramName, +const ParamType get(const char *propTagName, + const char *paramName, const ParamType& defaultValue, bool errorIfNotRegistered = true); @@ -206,7 +207,8 @@ public: // retrieve the parameter once to make sure that its value does // not contain a syntax error. ParamType __attribute__((unused)) dummy = - get(paramName_.data(), + get(/*propTagName=*/paramName_.data(), + paramName_.data(), defaultValue_, /*errorIfNotRegistered=*/true); } @@ -952,15 +954,16 @@ public: const char *paramName, bool errorIfNotRegistered = true) { - return retrieve_(paramName, getPropValue(), errorIfNotRegistered); + return retrieve_(propTagName, paramName, getPropValue(), errorIfNotRegistered); } template - static ParamType get(const char *paramName, + static ParamType get(const char *propTagName, + const char *paramName, const ParamType& defaultValue, bool errorIfNotRegistered = true) { - return retrieve_(paramName, defaultValue, errorIfNotRegistered); + return retrieve_(propTagName, paramName, defaultValue, errorIfNotRegistered); } static void clear() @@ -1047,9 +1050,10 @@ private: } template - static ParamType retrieve_(const char *paramName, - const ParamType& defaultValue, - bool errorIfNotRegistered = true) + static ParamType retrieve_(const char OPM_OPTIM_UNUSED *propTagName, + const char *paramName, + const ParamType& defaultValue, + bool errorIfNotRegistered = true) { #ifndef NDEBUG // make sure that the parameter is used consistently. since @@ -1090,9 +1094,9 @@ const ParamType get(const char *propTagName, const char *paramName, bool errorIf } template -const ParamType get(const char *paramName, const ParamType& defaultValue, bool errorIfNotRegistered) +const ParamType get(const char *propTagName, const char *paramName, const ParamType& defaultValue, bool errorIfNotRegistered) { - return Param::template get(paramName, defaultValue, errorIfNotRegistered); + return Param::template get(propTagName, paramName, defaultValue, errorIfNotRegistered); } template