28 #ifndef EWOMS_FV_BASE_PRIMARY_VARIABLES_HH 29 #define EWOMS_FV_BASE_PRIMARY_VARIABLES_HH 31 #include <dune/common/fvector.hh> 32 #include <opm/common/utility/gpuDecorators.hpp> 34 #include <opm/material/common/MathToolbox.hpp> 35 #include <opm/material/common/Valgrind.hpp> 41 #include <type_traits> 50 template <
class TypeTag,
template<
class,
int>
class VectorType = Dune::FieldVector>
52 :
public VectorType<GetPropType<TypeTag, Properties::Scalar>,
53 getPropValue<TypeTag, Properties::NumEq>()>
58 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
60 using Toolbox = MathToolbox<Evaluation>;
61 using ParentType = VectorType<Scalar, numEq>;
66 { Valgrind::SetUndefined(*
this); }
73 template <
class OtherTypeTag,
template<
class,
int>
class OtherVectorType>
78 static_assert(getPropValue<TypeTag, Properties::NumEq>() ==
79 getPropValue<OtherTypeTag, Properties::NumEq>(),
80 "Incompatible number of equations in primary variables copy " 82 for (
unsigned i = 0; i < this->size(); ++i) {
83 (*this)[i] = other[i];
97 using ParentType::operator=;
99 OPM_HOST_DEVICE
static void init()
104 static void registerParameters()
119 if constexpr (std::is_same_v<Evaluation, Scalar>) {
120 return (*
this)[varIdx];
124 if (timeIdx == linearizationType.time) {
125 return Toolbox::createVariable((*
this)[varIdx], varIdx);
128 return Toolbox::createConstant((*
this)[varIdx]);
143 template <
class Flu
idState>
146 throw std::runtime_error(
"The PrimaryVariables class does not define " 147 "an assignNaive() method");
155 Valgrind::CheckDefined(*static_cast<const ParentType*>(
this));
165 template<
class TypeTag,
bool>
170 template<
class TypeTag>
172 :
public FieldTraits<FieldVector<Opm::GetPropType<TypeTag, Opm::Properties::Scalar>,
173 Opm::getPropValue<TypeTag, Opm::Properties::NumEq>()>>
181 :
public FieldTraits<T>
186 template<
class TypeTag,
template <
class>
class EwomsPrimaryVariable>
187 struct FieldTraits<EwomsPrimaryVariable<TypeTag>>
189 std::is_base_of_v<Opm::FvBasePrimaryVariables<TypeTag>,
190 EwomsPrimaryVariable<TypeTag>>>
OPM_HOST_DEVICE FvBasePrimaryVariables(const FvBasePrimaryVariables< OtherTypeTag, OtherVectorType > &other)
Copy constructor from another primary variables object.
Definition: fvbaseprimaryvariables.hh:74
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(...))
Definition: propertysystem.hh:233
Definition: fvbaseprimaryvariables.hh:161
FvBasePrimaryVariables & operator=(const FvBasePrimaryVariables &value)=default
Assignment from another primary variables object.
OPM_HOST_DEVICE void checkDefined() const
Instruct valgrind to check the definedness of all attributes of this class.
Definition: fvbaseprimaryvariables.hh:153
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
static OPM_HOST_DEVICE void init()
< Import base class assignment operators.
Definition: fvbaseprimaryvariables.hh:99
OPM_HOST_DEVICE void assignNaive(const FluidState &)
Assign the primary variables "somehow" from a fluid state.
Definition: fvbaseprimaryvariables.hh:144
Declare the properties used by the infrastructure code of the finite volume discretizations.
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:51
Definition: linearizationtype.hh:33
The common code for the linearizers of non-linear systems of equations.
OPM_HOST_DEVICE Evaluation makeEvaluation(unsigned varIdx, unsigned timeIdx, LinearizationType linearizationType=LinearizationType()) const
Return a primary variable intensive evaluation.
Definition: fvbaseprimaryvariables.hh:116
Compatibility traits class for DenseVector and DenseMatrix.
Definition: fvbaseprimaryvariables.hh:166