immiscibleratevector.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_IMMISCIBLE_RATE_VECTOR_HH
29#define EWOMS_IMMISCIBLE_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
37
38namespace Opm {
47template <class TypeTag>
49 : public Dune::FieldVector<GetPropType<TypeTag, Properties::Evaluation>,
50 getPropValue<TypeTag, Properties::NumEq>()>
51{
56
57 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
58 enum { conti0EqIdx = Indices::conti0EqIdx };
59 enum { numComponents = getPropValue<TypeTag, Properties::NumComponents>() };
60 enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
61
62 using ParentType = Dune::FieldVector<Evaluation, numEq>;
64
65public:
69 ImmiscibleRateVector() : ParentType()
70 { Opm::Valgrind::SetUndefined(*this); }
71
77 ImmiscibleRateVector(const Evaluation& value)
78 : ParentType(value)
79 {}
80
87 : ParentType(value)
88 {}
89
99 void setMassRate(const ParentType& value)
100 { ParentType::operator=(value); }
101
111 void setMolarRate(const ParentType& value)
112 {
113 // convert to mass rates
114 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx)
115 ParentType::operator[](conti0EqIdx + compIdx) =
116 value[conti0EqIdx + compIdx]*FluidSystem::molarMass(compIdx);
117 }
118
126 template <class RhsEval>
127 void setEnthalpyRate(const RhsEval& rate)
128 { EnergyModule::setEnthalpyRate(*this, rate); }
129
145 template <class FluidState, class RhsEval>
146 void setVolumetricRate(const FluidState& fluidState, unsigned phaseIdx, const RhsEval& volume)
147 {
148 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx)
149 (*this)[conti0EqIdx + compIdx] =
150 fluidState.density(phaseIdx, compIdx)
151 * fluidState.massFraction(phaseIdx, compIdx)
152 * volume;
153
154 EnergyModule::setEnthalpyRate(*this, fluidState, phaseIdx, volume);
155 }
156
160 template <class RhsEval>
161 ImmiscibleRateVector& operator=(const RhsEval& value)
162 {
163 for (unsigned i=0; i < this->size(); ++i)
164 (*this)[i] = value;
165 return *this;
166 }
167
172 {
173 for (unsigned i=0; i < this->size(); ++i)
174 (*this)[i] = other[i];
175 return *this;
176 }
177};
178
179} // namespace Opm
180
181#endif
Provides the auxiliary methods required for consideration of the energy equation.
Definition: energymodule.hh:48
Implements a vector representing rates of conserved quantities.
Definition: immiscibleratevector.hh:51
ImmiscibleRateVector & operator=(const ImmiscibleRateVector &other)
Assignment operator from another rate vector.
Definition: immiscibleratevector.hh:171
void setEnthalpyRate(const RhsEval &rate)
Set an enthalpy rate [J/As] where .
Definition: immiscibleratevector.hh:127
ImmiscibleRateVector(const Evaluation &value)
Constructor with assignment from scalar.
Definition: immiscibleratevector.hh:77
ImmiscibleRateVector(const ImmiscibleRateVector &value)
Copy constructor.
Definition: immiscibleratevector.hh:86
void setMassRate(const ParentType &value)
Set a mass rate of the conservation quantities.
Definition: immiscibleratevector.hh:99
ImmiscibleRateVector()
Default constructor.
Definition: immiscibleratevector.hh:69
void setVolumetricRate(const FluidState &fluidState, unsigned phaseIdx, const RhsEval &volume)
Set a volumetric rate of a phase.
Definition: immiscibleratevector.hh:146
ImmiscibleRateVector & operator=(const RhsEval &value)
Assignment operator from a scalar or a function evaluation.
Definition: immiscibleratevector.hh:161
void setMolarRate(const ParentType &value)
Set a molar rate of the conservation quantities.
Definition: immiscibleratevector.hh:111
Definition: blackoilboundaryratevector.hh:37
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:242