version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_3P2CNI_IO_FIELDS_HH
14#define DUMUX_3P2CNI_IO_FIELDS_HH
15
16#include <dumux/io/name.hh>
18
19namespace Dumux {
20
26{
27
28public:
29 template <class OutputModule>
30 static void initOutputModule(OutputModule& out)
31 {
32 using VolumeVariables = typename OutputModule::VolumeVariables;
33 using FluidSystem = typename VolumeVariables::FluidSystem;
34
35 // register standardized output fields
36 for (int phaseIdx = 0; phaseIdx < VolumeVariables::numFluidPhases(); ++phaseIdx)
37 {
38 out.addVolumeVariable([phaseIdx](const auto& v){ return v.saturation(phaseIdx); },
39 IOName::saturation<FluidSystem>(phaseIdx));
40 out.addVolumeVariable([phaseIdx](const auto& v){ return v.pressure(phaseIdx); },
41 IOName::pressure<FluidSystem>(phaseIdx));
42 out.addVolumeVariable([phaseIdx](const auto& v){ return v.density(phaseIdx); },
43 IOName::density<FluidSystem>(phaseIdx));
44 out.addVolumeVariable([phaseIdx](const auto& v){ return v.mobility(phaseIdx); },
45 IOName::mobility<FluidSystem>(phaseIdx));
46 out.addVolumeVariable([phaseIdx](const auto& v){ return v.viscosity(phaseIdx); },
47 IOName::viscosity<FluidSystem>(phaseIdx));
48
49 for (int compIdx = 0; compIdx < VolumeVariables::numFluidComponents(); ++compIdx)
50 out.addVolumeVariable([phaseIdx, compIdx](const auto& v){ return v.moleFraction(phaseIdx, compIdx); },
51 IOName::moleFraction<FluidSystem>(phaseIdx, compIdx));
52 }
53
54 out.addVolumeVariable([](const auto& v){ return v.porosity(); },
56 out.addVolumeVariable([](const auto& v){ return v.priVars().state(); },
58 out.addVolumeVariable([](const auto& v){ return v.permeability(); },
60 }
61
62 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
63 static std::string primaryVariableName(int pvIdx, int state)
64 {
65 using Indices = typename ModelTraits::Indices;
66 static constexpr auto numEq = ModelTraits::numEq();
67 using StringVec = std::array<std::string, numEq>;
68
69 switch (state)
70 {
71 case Indices::threePhases:
72 {
73 static const StringVec s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
74 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
75 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
76 return s1[pvIdx];
77 }
78 case Indices::wPhaseOnly:
79 {
80 static const StringVec s2 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx),
82 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)};
83 return s2[pvIdx];
84 }
85 case Indices::gnPhaseOnly:
86 {
87 static const StringVec s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
88 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx),
89 IOName::moleFraction<FluidSystem>(FluidSystem::nPhaseIdx, FluidSystem::wCompIdx)};
90 return s3[pvIdx];
91 }
92 case Indices::wnPhaseOnly:
93 {
94 static const StringVec s4 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx),
96 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
97 return s4[pvIdx];
98 }
99 case Indices::gPhaseOnly:
100 {
101 static const StringVec s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
103 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
104 return s5[pvIdx];
105 }
106 case Indices::wgPhaseOnly:
107 {
108 static const StringVec s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
109 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
110 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
111 return s6[pvIdx];
112 }
113 }
114 }
115};
116
117} // end namespace Dumux
118
119#endif
Adds I/O fields specific to the three-phase three-component model.
Definition: porousmediumflow/3pwateroil/iofields.hh:26
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/3pwateroil/iofields.hh:30
static std::string primaryVariableName(int pvIdx, int state)
Definition: porousmediumflow/3pwateroil/iofields.hh:63
A collection of input/output field names for common physical quantities.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string phasePresence() noexcept
I/O name of phase presence.
Definition: name.hh:135
std::string permeability() noexcept
I/O name of permeability.
Definition: name.hh:131
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:127
Definition: adapt.hh:17
Adds I/O fields specific to the three-phase three-component model.