richardsratevector.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
28#ifndef EWOMS_RICHARDS_RATE_VECTOR_HH
29#define EWOMS_RICHARDS_RATE_VECTOR_HH
30
31#include <dune/common/fvector.hh>
32
33#include <opm/material/common/Valgrind.hpp>
34#include <opm/material/constraintsolvers/NcpFlash.hpp>
35
39
40namespace Opm {
41
50template <class TypeTag>
52 : public Dune::FieldVector<GetPropType<TypeTag, Properties::Evaluation>,
53 getPropValue<TypeTag, Properties::NumEq>()>
54{
60
61 enum { contiEqIdx = Indices::contiEqIdx };
62 enum { liquidCompIdx = getPropValue<TypeTag, Properties::LiquidComponentIndex>() };
63 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
64
65 using ParentType = Dune::FieldVector<Evaluation, numEq>;
66
67public:
69 : ParentType()
70 { Opm::Valgrind::SetUndefined(*this); }
71
75 explicit RichardsRateVector(const Evaluation& value)
76 : ParentType(value)
77 {}
78
84 : ParentType(value)
85 {}
86
90 void setMassRate(const ParentType& value)
91 { ParentType::operator=(value); }
92
96 void setMolarRate(const ParentType& value)
97 {
98 // convert to mass rates
99 ParentType::operator[](contiEqIdx) =
100 value[contiEqIdx] * FluidSystem::molarMass(liquidCompIdx);
101 }
102
106 template <class RhsEval>
107 void setEnthalpyRate(const RhsEval& rate)
108 { EnergyModule::setEnthalpyRate(*this, rate); }
109
113 template <class FluidState, class RhsEval>
114 void setVolumetricRate(const FluidState& fluidState, unsigned phaseIdx, const RhsEval& volume)
115 {
116 (*this)[contiEqIdx] =
117 fluidState.density(phaseIdx) *
118 fluidState.massFraction(phaseIdx, liquidCompIdx) *
119 volume;
120
121 EnergyModule::setEnthalpyRate(*this, fluidState, phaseIdx, volume);
122 }
123
124
128 template <class RhsEval>
129 RichardsRateVector& operator=(const RhsEval& value)
130 {
131 for (unsigned i = 0; i < this->size(); ++i) {
132 (*this)[i] = value;
133 }
134 return *this;
135 }
136
141 {
142 for (unsigned i = 0; i < this->size(); ++i) {
143 (*this)[i] = other[i];
144 }
145 return *this;
146 }
147};
148
149} // namespace Opm
150
151#endif
Implements a vector representing mass, molar or volumetric rates.
Definition: richardsratevector.hh:54
RichardsRateVector(const Evaluation &value)
Definition: richardsratevector.hh:75
void setEnthalpyRate(const RhsEval &rate)
Set an enthalpy rate [J/As] where .
Definition: richardsratevector.hh:107
void setMassRate(const ParentType &value)
Set a mass rate of the conservation quantities.
Definition: richardsratevector.hh:90
void setVolumetricRate(const FluidState &fluidState, unsigned phaseIdx, const RhsEval &volume)
Set a volumetric rate of a phase.
Definition: richardsratevector.hh:114
RichardsRateVector(const RichardsRateVector &value)
Definition: richardsratevector.hh:83
void setMolarRate(const ParentType &value)
Set a molar rate of the conservation quantities.
Definition: richardsratevector.hh:96
RichardsRateVector()
Definition: richardsratevector.hh:68
RichardsRateVector & operator=(const RhsEval &value)
Assignment operator from a scalar or a function evaluation.
Definition: richardsratevector.hh:129
RichardsRateVector & operator=(const RichardsRateVector &other)
Assignment operator from another rate vector.
Definition: richardsratevector.hh:140
Declare the properties used by the infrastructure code of the finite volume discretizations.
Defines the common properties required by the porous medium multi-phase models.
Definition: blackoilboundaryratevector.hh:39
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
Contains the property declarations for the Richards model.