version 3.10-dev
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// 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_THREEPTHREEC_IO_FIELDS_HH
14#define DUMUX_THREEPTHREEC_IO_FIELDS_HH
15
16#include <array>
17#include <dumux/io/name.hh>
18
19namespace Dumux {
20
26{
27public:
28 template <class OutputModule>
29 static void initOutputModule(OutputModule& out)
30 {
31 using VolumeVariables = typename OutputModule::VolumeVariables;
32 using FluidSystem = typename VolumeVariables::FluidSystem;
33
34 // register standardized output fields
35 for (int phaseIdx = 0; phaseIdx < VolumeVariables::numFluidPhases(); ++phaseIdx)
36 {
37 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.saturation(phaseIdx); },
38 IOName::saturation<FluidSystem>(phaseIdx));
39 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.pressure(phaseIdx); },
40 IOName::pressure<FluidSystem>(phaseIdx));
41 out.addVolumeVariable( [phaseIdx](const auto& v){ return v.density(phaseIdx); },
42 IOName::density<FluidSystem>(phaseIdx));
43
44 for (int compIdx = 0; compIdx < VolumeVariables::numFluidComponents(); ++compIdx)
45 out.addVolumeVariable([phaseIdx, compIdx](const auto& v){ return v.moleFraction(phaseIdx, compIdx); },
46 IOName::moleFraction<FluidSystem>(phaseIdx, compIdx));
47 }
48
49 out.addVolumeVariable( [](const auto& v){ return v.porosity(); },
51 out.addVolumeVariable( [](const auto& v){ return v.priVars().state(); },
53 out.addVolumeVariable( [](const auto& v){ return v.permeability(); },
55 }
56
57 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
58 static std::string primaryVariableName(int pvIdx, int state)
59 {
60 using Indices = typename ModelTraits::Indices;
61 static constexpr auto numEq = ModelTraits::numEq();
62 using StringVec = std::array<std::string, numEq>;
63
64 switch (state)
65 {
66 case Indices::threePhases:
67 {
68 static const StringVec s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
69 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
70 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
71 return s1[pvIdx];
72 }
73 case Indices::wPhaseOnly:
74 {
75 static const StringVec s2 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
76 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx),
77 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)};
78 return s2[pvIdx];
79 }
80 case Indices::gnPhaseOnly:
81 {
82 static const StringVec s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
83 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx),
84 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
85 return s3[pvIdx];
86 }
87 case Indices::wnPhaseOnly:
88 {
89 static const StringVec s4 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
90 IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx),
91 IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)};
92 return s4[pvIdx];
93 }
94 case Indices::gPhaseOnly:
95 {
96 static const StringVec s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
97 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx),
98 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
99 return s5[pvIdx];
100 }
101 case Indices::wgPhaseOnly:
102 {
103 static const StringVec s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx),
104 IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx),
105 IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)};
106 return s6[pvIdx];
107 }
108 }
109 }
110};
111
112} // end namespace Dumux
113
114#endif
Adds I/O fields specific to the three-phase three-component model.
Definition: porousmediumflow/3p3c/iofields.hh:26
static std::string primaryVariableName(int pvIdx, int state)
Definition: porousmediumflow/3p3c/iofields.hh:58
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/3p3c/iofields.hh:29
A collection of input/output field names for common physical quantities.
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