3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/3p3c/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_THREEPTHREEC_IO_FIELDS_HH
26#define DUMUX_THREEPTHREEC_IO_FIELDS_HH
27
28#include <array>
29#include <dumux/io/name.hh>
30
31namespace Dumux {
32
38{
39public:
40 template <class OutputModule>
41 static void initOutputModule(OutputModule& out)
42 {
43 using VolumeVariables = typename OutputModule::VolumeVariables;
44 using FluidSystem = typename VolumeVariables::FluidSystem;
45
46 // register standardized output fields
47 for (int phaseIdx = 0; phaseIdx < VolumeVariables::numFluidPhases(); ++phaseIdx)
48 {
49 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.saturation(phaseIdx); },
50 IOName::saturation<FluidSystem>(phaseIdx));
51 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.pressure(phaseIdx); },
52 IOName::pressure<FluidSystem>(phaseIdx));
53 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.density(phaseIdx); },
54 IOName::density<FluidSystem>(phaseIdx));
55
56 for (int compIdx = 0; compIdx < VolumeVariables::numFluidComponents(); ++compIdx)
57 out.addVolumeVariable([phaseIdx, compIdx](const auto& v){ return v.moleFraction(phaseIdx, compIdx); },
58 IOName::moleFraction<FluidSystem>(phaseIdx, compIdx));
59 }
60
61 out.addVolumeVariable( [](const auto& v){ return v.porosity(); },
63 out.addVolumeVariable( [](const auto& v){ return v.priVars().state(); },
65 out.addVolumeVariable( [](const auto& v){ return v.permeability(); },
67 }
68
69 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
70 static std::string primaryVariableName(int pvIdx, int state)
71 {
72 using Indices = typename ModelTraits::Indices;
73 static constexpr auto numEq = ModelTraits::numEq();
74 using StringVec = std::array<std::string, numEq>;
75
76 switch (state)
77 {
78 case Indices::threePhases:
79 {
80 static const StringVec s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
81 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
82 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
83 return s1[pvIdx];
84 }
85 case Indices::wPhaseOnly:
86 {
87 static const StringVec s2 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
88 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx),
89 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)};
90 return s2[pvIdx];
91 }
92 case Indices::gnPhaseOnly:
93 {
94 static const StringVec s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
95 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx),
96 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
97 return s3[pvIdx];
98 }
99 case Indices::wnPhaseOnly:
100 {
101 static const StringVec s4 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
102 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx),
103 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
104 return s4[pvIdx];
105 }
106 case Indices::gPhaseOnly:
107 {
108 static const StringVec s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
109 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx),
110 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
111 return s5[pvIdx];
112 }
113 case Indices::wgPhaseOnly:
114 {
115 static const StringVec s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
116 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
117 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
118 return s6[pvIdx];
119 }
120 }
121 }
122};
123
124} // end namespace Dumux
125
126#endif
A collection of input/output field names for common physical quantities.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
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/3p3c/iofields.hh:38
static std::string primaryVariableName(int pvIdx, int state)
Definition: porousmediumflow/3p3c/iofields.hh:70
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/3p3c/iofields.hh:41