EffToAbsLawParams.hpp
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*/
27#ifndef OPM_EFF_TO_ABS_LAW_PARAMS_HPP
28#define OPM_EFF_TO_ABS_LAW_PARAMS_HPP
29
30#include <cassert>
31
33
34namespace Opm {
42template <class EffLawParamsT, int numPhases>
43class EffToAbsLawParams : public EffLawParamsT
44{
45 typedef EffLawParamsT EffLawParams;
46 typedef typename EffLawParams::Traits::Scalar Scalar;
47
48public:
49 typedef typename EffLawParams::Traits Traits;
50
51
53 : EffLawParams()
54 {
55 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
56 residualSaturation_[phaseIdx] = 0.0;
57 }
58
63 void finalize()
64 {
65 sumResidualSaturations_ = 0.0;
66 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
67 sumResidualSaturations_ += residualSaturation_[phaseIdx];
68
69 EffLawParams::finalize();
70 }
71
75 Scalar residualSaturation(unsigned phaseIdx) const
76 { EnsureFinalized::check(); return residualSaturation_[phaseIdx]; }
77
82 { EnsureFinalized::check(); return sumResidualSaturations_; }
83
87 void setResidualSaturation(unsigned phaseIdx, Scalar value)
88 { residualSaturation_[phaseIdx] = value; }
89
90private:
91
92 Scalar residualSaturation_[numPhases];
93 Scalar sumResidualSaturations_;
94};
95
96} // namespace Opm
97
98#endif
A default implementation of the parameters for the adapter class to convert material laws from effect...
Definition: EffToAbsLawParams.hpp:44
EffToAbsLawParams()
Definition: EffToAbsLawParams.hpp:52
Scalar residualSaturation(unsigned phaseIdx) const
Return the residual saturation of a phase.
Definition: EffToAbsLawParams.hpp:75
Scalar sumResidualSaturations() const
Return the sum of the residual saturations.
Definition: EffToAbsLawParams.hpp:81
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: EffToAbsLawParams.hpp:63
EffLawParams::Traits Traits
Definition: EffToAbsLawParams.hpp:49
void setResidualSaturation(unsigned phaseIdx, Scalar value)
Set the residual saturation of a phase.
Definition: EffToAbsLawParams.hpp:87
void check() const
Definition: EnsureFinalized.hpp:63
Definition: Air_Mesitylene.hpp:34