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>
51class FvBasePrimaryVariables
52 :
public VectorType<GetPropType<TypeTag, Properties::Scalar>,
53 getPropValue<TypeTag, Properties::NumEq>()>
60 using Toolbox = MathToolbox<Evaluation>;
61 using ParentType = VectorType<Scalar, numEq>;
64 OPM_HOST_DEVICE FvBasePrimaryVariables()
66 { Valgrind::SetUndefined(*
this); }
73 template <
class OtherTypeTag,
template<
class,
int>
class OtherVectorType>
75 const FvBasePrimaryVariables<OtherTypeTag, OtherVectorType>& other)
80 "Incompatible number of equations in primary variables copy "
82 for (
unsigned i = 0; i < this->size(); ++i) {
83 (*this)[i] = other[i];
95 FvBasePrimaryVariables&
operator=(
const FvBasePrimaryVariables& value) =
default;
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
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 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.
The common code for the linearizers of non-linear systems of equations.
This file contains a set of helper functions used by VFPProd / VFPInj.
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
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
Compatibility traits class for DenseVector and DenseMatrix.
Definition fvbaseprimaryvariables.hh:166
Definition linearizationtype.hh:34