My Project
Loading...
Searching...
No Matches
BlackOilFluidSystem.hpp
1/*
2 Copyright 2025 Equinor ASA
3
4 This file is part of the Open Porous Media project (OPM).
5 OPM is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 OPM is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with OPM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef OPM_BLACK_OIL_FLUID_SYSTEM_HPP
19#define OPM_BLACK_OIL_FLUID_SYSTEM_HPP
20
21// Here we need to define certain macros before including the macrotemplate file.
22//
23// The idea is in essence the following:
24// 1) In the macrotemplate file, we have method declarations of the form
25//
26// `STATIC_OR_DEVICE void foo();`
27//
28// and member variable declarations of the form
29//
30// `STATIC_OR_NOTHING int bar;`
31//
32// 2) We want to be able to compile the same code for both the dynamic (non-static) and static
33// versions of the fluid system. The dynamic version is used when the fluid system is accessed
34// from the GPU, while the static version is used when the fluid system is accessed from the CPU.
35// 3) We want to be able to compile the same code for both the dynamic and static versions of the
36// fluid system, but with different method and member variable declarations.
37//
38// Furthermore, we need to specify the class name of the fluid system, which is different for the
39// nonstatic and static versions of the fluid system. We also need to specify if we are compiling
40// the static version of the fluid system, since we will define certain constructors and singleton
41// functions only in the static or nonstatic case.
42
43// Is defined for the static version of the fluid system.
44#define COMPILING_STATIC_FLUID_SYSTEM
45
46// The static version does not need any gpu decorators, simply static
47#define STATIC_OR_DEVICE static
48
49// Make sure member variables are declared as static
50#define STATIC_OR_NOTHING static
51
52// Define the class names for the static and nonstatic versions of the fluid system
53#define FLUIDSYSTEM_CLASSNAME_NONSTATIC BlackOilFluidSystemNonStatic
54#define FLUIDSYSTEM_CLASSNAME_STATIC BlackOilFluidSystem
55
56// Define the class name for the fluid system
57#define FLUIDSYSTEM_CLASSNAME BlackOilFluidSystem
58
59
60// We need to forward-declare the nonstatic version of the fluid system, since we will
61// make the nonstatic version a friend of the static version being defined here.
62namespace Opm
63{
64template <class Scalar,
65 class IndexTraits,
66 template <typename> typename Storage,
67 template <typename> typename SmartPointer>
69}
70
71// Include the macrotemplate file
73
74// Undefine the macros we defined above
75#undef STATIC_OR_DEVICE
76#undef COMPILING_STATIC_FLUID_SYSTEM
77#undef STATIC_OR_NOTHING
78#undef FLUIDSYSTEM_CLASSNAME_STATIC
79#undef FLUIDSYSTEM_CLASSNAME_NONSTATIC
80#undef FLUIDSYSTEM_CLASSNAME
81
82#endif // OPM_BLACK_OIL_FLUID_SYSTEM_HPP
Definition BlackOilFluidSystem.hpp:68
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30