opm-common
PRParams.hpp
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  Copyright 2022 NORCE.
5  Copyright 2022 SINTEF Digital, Mathematics and Cybernetics.
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 
22  Consult the COPYING file in the top-level source directory of this
23  module for the precise wording of the license and the list of
24  copyright holders.
25 */
26 #ifndef PR_PARAMS_HPP
27 #define PR_PARAMS_HPP
28 
29 #include <cmath>
30 
31 namespace Opm {
32 
33 template <class Scalar, class FluidSystem>
34 class PRParams
35 {
36  static constexpr Scalar R = Constants<Scalar>::R;
37 
38 public:
39  static Scalar calcOmegaA(Scalar temperature, unsigned compIdx, bool modified)
40  {
41  Scalar Tr = temperature / FluidSystem::criticalTemperature(compIdx);
42  Scalar omega = FluidSystem::acentricFactor(compIdx);
43  Scalar f_omega;
44  if (!modified || omega <= 0.49)
45  f_omega = 0.37464 + omega * (1.54226 + omega * (-0.26992));
46  else
47  f_omega = 0.379642 + omega * (1.48503 + omega * (-0.164423 + omega * 0.016666));
48  Valgrind::CheckDefined(f_omega);
49 
50  Scalar tmp = 1 + f_omega*(1 - sqrt(Tr));
51  return 0.457235529 * tmp * tmp;
52  }
53 
54  static Scalar calcOmegaB()
55  {
56  return Scalar(0.077796074);
57  }
58 
59  static Scalar calcm1()
60  {
61  return Scalar(1 + std::sqrt(2));
62  }
63 
64  static Scalar calcm2()
65  {
66  return Scalar(1 - std::sqrt(2));
67  }
68 
69 }; // class PRParams
70 
71 } // namespace Opm
72 
73 #endif
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: Constants.hpp:41
Definition: PRParams.hpp:34