3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/1pnc/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_ONEPNC_IO_FIELDS_HH
26#define DUMUX_ONEPNC_IO_FIELDS_HH
27
28#include <string>
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 out.addVolumeVariable([](const auto& volVars){ return volVars.pressure(0); },
48 out.addVolumeVariable([](const auto& volVars){ return volVars.density(0); },
50 out.addVolumeVariable([](const auto& volVars){ return volVars.viscosity(0); },
52 out.addVolumeVariable([](const auto& volVars){ return volVars.pressure(0) - 1e5; },
53 "delp");
54
55 for (int i = 0; i < VolumeVariables::numFluidComponents(); ++i)
56 out.addVolumeVariable([i](const auto& volVars){ return volVars.moleFraction(0, i); },
57 IOName::moleFraction<FluidSystem>(0, i));
58
59 for (int i = 0; i < VolumeVariables::numFluidComponents(); ++i)
60 out.addVolumeVariable([i](const auto& volVars){ return volVars.massFraction(0, i); },
61 IOName::massFraction<FluidSystem>(0, i));
62 }
63
64 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
65 static std::string primaryVariableName(int pvIdx, int state = 0)
66 {
67 if (pvIdx == 0)
68 return IOName::pressure();
69 else if (ModelTraits::useMoles())
70 return IOName::moleFraction<FluidSystem>(0, pvIdx);
71 else
72 return IOName::massFraction<FluidSystem>(0, pvIdx);
73 }
74};
75
76} // end namespace Dumux
77
78#endif
A collection of input/output field names for common physical quantities.
Definition: adapt.hh:29
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Adds I/O fields specific to the OnePNC model.
Definition: porousmediumflow/1pnc/iofields.hh:38
static std::string primaryVariableName(int pvIdx, int state=0)
Definition: porousmediumflow/1pnc/iofields.hh:65
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/1pnc/iofields.hh:41