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>
50template <
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()
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 requires std::is_base_of_v<Opm::FvBasePrimaryVariables<TypeTag>,
188 EwomsPrimaryVariable<TypeTag> >
189 struct FieldTraits<EwomsPrimaryVariable<TypeTag> >
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:54
OPM_HOST_DEVICE FvBasePrimaryVariables(const FvBasePrimaryVariables< OtherTypeTag, OtherVectorType > &other)
Copy constructor from another primary variables object.
Definition: fvbaseprimaryvariables.hh:74
OPM_HOST_DEVICE FvBasePrimaryVariables()
Definition: fvbaseprimaryvariables.hh:64
OPM_HOST_DEVICE Evaluation makeEvaluation(unsigned varIdx, unsigned timeIdx, LinearizationType linearizationType=LinearizationType()) const
Return a primary variable intensive evaluation.
Definition: fvbaseprimaryvariables.hh:116
OPM_HOST_DEVICE void checkDefined() const
Instruct valgrind to check the definedness of all attributes of this class.
Definition: fvbaseprimaryvariables.hh:153
OPM_HOST_DEVICE void assignNaive(const FluidState &)
Assign the primary variables "somehow" from a fluid state.
Definition: fvbaseprimaryvariables.hh:144
FvBasePrimaryVariables(const FvBasePrimaryVariables &value)=default
Assignment from another primary variables object.
static void registerParameters()
Definition: fvbaseprimaryvariables.hh:104
static OPM_HOST_DEVICE void init()
< Import base class assignment operators.
Definition: fvbaseprimaryvariables.hh:99
FvBasePrimaryVariables & operator=(const FvBasePrimaryVariables &value)=default
Assignment from another primary variables object.
Declare the properties used by the infrastructure code of the finite volume discretizations.
Definition: fvbaseprimaryvariables.hh:161
Definition: blackoilbioeffectsmodules.hh:45
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:166
Definition: linearizationtype.hh:34