version 3.10-dev
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// 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_ONEPNC_IO_FIELDS_HH
14#define DUMUX_ONEPNC_IO_FIELDS_HH
15
16#include <string>
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 out.addVolumeVariable([](const auto& volVars){ return volVars.pressure(0); },
36 out.addVolumeVariable([](const auto& volVars){ return volVars.density(0); },
38 out.addVolumeVariable([](const auto& volVars){ return volVars.viscosity(0); },
40
41 for (int i = 0; i < VolumeVariables::numFluidComponents(); ++i)
42 out.addVolumeVariable([i](const auto& volVars){ return volVars.moleFraction(0, i); },
43 IOName::moleFraction<FluidSystem>(0, i));
44
45 for (int i = 0; i < VolumeVariables::numFluidComponents(); ++i)
46 out.addVolumeVariable([i](const auto& volVars){ return volVars.massFraction(0, i); },
47 IOName::massFraction<FluidSystem>(0, i));
48 }
49
50 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
51 static std::string primaryVariableName(int pvIdx, int state = 0)
52 {
53 if (pvIdx == 0)
54 return IOName::pressure();
55 else if (ModelTraits::useMoles())
56 return IOName::moleFraction<FluidSystem>(0, pvIdx);
57 else
58 return IOName::massFraction<FluidSystem>(0, pvIdx);
59 }
60};
61
62} // end namespace Dumux
63
64#endif
Adds I/O fields specific to the OnePNC model.
Definition: porousmediumflow/1pnc/iofields.hh:26
static std::string primaryVariableName(int pvIdx, int state=0)
Definition: porousmediumflow/1pnc/iofields.hh:51
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/1pnc/iofields.hh:29
A collection of input/output field names for common physical quantities.
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:22
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17