3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/3pwateroil/iofields.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program 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 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
25#ifndef DUMUX_3P2CNI_IO_FIELDS_HH
26#define DUMUX_3P2CNI_IO_FIELDS_HH
27
28#include <dumux/io/name.hh>
30
31namespace Dumux {
32
38{
39
40public:
41 template <class OutputModule>
42 static void initOutputModule(OutputModule& out)
43 {
44 using VolumeVariables = typename OutputModule::VolumeVariables;
45 using FluidSystem = typename VolumeVariables::FluidSystem;
46
47 // register standardized output fields
48 for (int phaseIdx = 0; phaseIdx < VolumeVariables::numFluidPhases(); ++phaseIdx)
49 {
50 out.addVolumeVariable([phaseIdx](const auto& v){ return v.saturation(phaseIdx); },
51 IOName::saturation<FluidSystem>(phaseIdx));
52 out.addVolumeVariable([phaseIdx](const auto& v){ return v.pressure(phaseIdx); },
53 IOName::pressure<FluidSystem>(phaseIdx));
54 out.addVolumeVariable([phaseIdx](const auto& v){ return v.density(phaseIdx); },
55 IOName::density<FluidSystem>(phaseIdx));
56 out.addVolumeVariable([phaseIdx](const auto& v){ return v.mobility(phaseIdx); },
57 IOName::mobility<FluidSystem>(phaseIdx));
58 out.addVolumeVariable([phaseIdx](const auto& v){ return v.viscosity(phaseIdx); },
59 IOName::viscosity<FluidSystem>(phaseIdx));
60
61 for (int compIdx = 0; compIdx < VolumeVariables::numFluidComponents(); ++compIdx)
62 out.addVolumeVariable([phaseIdx, compIdx](const auto& v){ return v.moleFraction(phaseIdx, compIdx); },
63 IOName::moleFraction<FluidSystem>(phaseIdx, compIdx));
64 }
65
66 out.addVolumeVariable([](const auto& v){ return v.porosity(); },
68 out.addVolumeVariable([](const auto& v){ return v.priVars().state(); },
70 out.addVolumeVariable([](const auto& v){ return v.permeability(); },
72 }
73
74 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
75 static std::string primaryVariableName(int pvIdx, int state)
76 {
77 using Indices = typename ModelTraits::Indices;
78 static constexpr auto numEq = ModelTraits::numEq();
79 using StringVec = std::array<std::string, numEq>;
80
81 switch (state)
82 {
83 case Indices::threePhases:
84 {
85 static const StringVec s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
86 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
87 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
88 return s1[pvIdx];
89 }
90 case Indices::wPhaseOnly:
91 {
92 static const StringVec s2 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx),
94 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)};
95 return s2[pvIdx];
96 }
97 case Indices::gnPhaseOnly:
98 {
99 static const StringVec s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
100 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx),
101 IOName::moleFraction<FluidSystem>(FluidSystem::nPhaseIdx, FluidSystem::wCompIdx)};
102 return s3[pvIdx];
103 }
104 case Indices::wnPhaseOnly:
105 {
106 static const StringVec s4 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx),
108 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
109 return s4[pvIdx];
110 }
111 case Indices::gPhaseOnly:
112 {
113 static const StringVec s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
115 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
116 return s5[pvIdx];
117 }
118 case Indices::wgPhaseOnly:
119 {
120 static const StringVec s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
121 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
122 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
123 return s6[pvIdx];
124 }
125 }
126 }
127};
128
129} // end namespace Dumux
130
131#endif
A collection of input/output field names for common physical quantities.
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string phasePresence() noexcept
I/O name of phase presence.
Definition: name.hh:147
std::string permeability() noexcept
I/O name of permeability.
Definition: name.hh:143
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:139
Adds I/O fields specific to the three-phase three-component model.
Definition: porousmediumflow/3pwateroil/iofields.hh:38
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/3pwateroil/iofields.hh:42
static std::string primaryVariableName(int pvIdx, int state)
Definition: porousmediumflow/3pwateroil/iofields.hh:75
Adds I/O fields specific to the three-phase three-component model.