3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/mpnc/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_MPNC_IO_FIELDS_HH
26#define DUMUX_MPNC_IO_FIELDS_HH
27
28#include <dune/common/exceptions.hh>
29
30#include <dumux/io/name.hh>
32
33namespace Dumux {
34
40{
41public:
42 template <class OutputModule>
43 static void initOutputModule(OutputModule& out)
44 {
45 using VolumeVariables = typename OutputModule::VolumeVariables;
46 using FluidSystem = typename VolumeVariables::FluidSystem;
47
48 for (int i = 0; i < VolumeVariables::numFluidPhases(); ++i)
49 {
50 out.addVolumeVariable([i](const auto& v){ return v.saturation(i); },
51 IOName::saturation<FluidSystem>(i));
52 out.addVolumeVariable([i](const auto& v){ return v.pressure(i); },
53 IOName::pressure<FluidSystem>(i));
54 out.addVolumeVariable([i](const auto& v){ return v.density(i); },
55 IOName::density<FluidSystem>(i));
56 out.addVolumeVariable([i](const auto& v){ return v.mobility(i); },
57 IOName::mobility<FluidSystem>(i));
58
59 for (int j = 0; j < VolumeVariables::numFluidComponents(); ++j)
60 out.addVolumeVariable([i,j](const auto& v){ return v.moleFraction(i,j); },
61 IOName::moleFraction<FluidSystem>(i, j));
62 }
63
64 for (int j = 0; j < VolumeVariables::numFluidComponents(); ++j)
65 out.addVolumeVariable([j](const auto& v){ return v.fugacity(j); },
66 "fugacity^"+ FluidSystem::componentName(j));
67
68
69 out.addVolumeVariable([](const auto& v){ return v.porosity(); },
71 }
72
73 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
74 static std::string primaryVariableName(int pvIdx, int state=0)
75 {
76 if (pvIdx < ModelTraits::numFluidComponents())
77 return "fugacity^"+ FluidSystem::componentName(pvIdx);
78 else if (pvIdx < ModelTraits::numEq()-1)
79 return "S_"+ FluidSystem::phaseName(pvIdx - ModelTraits::numFluidComponents());
80 else
81 {
82 switch (ModelTraits::pressureFormulation())
83 {
85 return "p_"+ FluidSystem::phaseName(0);
87 return "p_"+ FluidSystem::phaseName(ModelTraits::numFluidPhases()-1);
88 default: DUNE_THROW(Dune::InvalidStateException, "Invalid formulation ");
89 }
90 }
91 }
92
93};
94
95} // end namespace Dumux
96
97#endif
A collection of input/output field names for common physical quantities.
Enumeration of the formulations accepted by the MpNc model.
Definition: adapt.hh:29
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:139
Adds I/O fields specific to the mpnc model.
Definition: porousmediumflow/mpnc/iofields.hh:40
static std::string primaryVariableName(int pvIdx, int state=0)
Definition: porousmediumflow/mpnc/iofields.hh:74
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/mpnc/iofields.hh:43