version 3.8
porousmediumflow/2p/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_TWOP_IO_FIELDS_HH
14#define DUMUX_TWOP_IO_FIELDS_HH
15
16#include <dumux/io/name.hh>
17
18#include "model.hh"
19
20namespace Dumux {
21
27{
28public:
29 template <class OutputModule>
30 static void initOutputModule(OutputModule& out)
31 {
32 using VolumeVariables = typename OutputModule::VolumeVariables;
33 using FS = typename VolumeVariables::FluidSystem;
34
35 for (int phaseIdx = 0; phaseIdx < FS::numPhases; ++phaseIdx)
36 {
37 out.addVolumeVariable([phaseIdx](const VolumeVariables& v){ return v.saturation(phaseIdx); },
38 IOName::saturation<FS>(phaseIdx));
39 out.addVolumeVariable([phaseIdx](const VolumeVariables& v){ return v.pressure(phaseIdx); },
40 IOName::pressure<FS>(phaseIdx));
41 out.addVolumeVariable([phaseIdx](const auto& v){ return v.density(phaseIdx); },
42 IOName::density<FS>(phaseIdx));
43 out.addVolumeVariable([phaseIdx](const auto& v){ return v.mobility(phaseIdx); },
44 IOName::mobility<FS>(phaseIdx));
45 }
46
47 out.addVolumeVariable([](const auto& v){ return v.capillaryPressure(); },
49 out.addVolumeVariable([](const auto& v){ return v.porosity(); },
51 }
52
53 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
54 static std::string primaryVariableName(int pvIdx, int state = 0)
55 {
56 if (ModelTraits::priVarFormulation() == TwoPFormulation::p0s1)
57 return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase0Idx)
58 : IOName::saturation<FluidSystem>(FluidSystem::phase1Idx);
59 else
60 return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase1Idx)
61 : IOName::saturation<FluidSystem>(FluidSystem::phase0Idx);
62 }
63};
64
65} // end namespace Dumux
66
67#endif
Adds I/O fields specific to the two-phase model.
Definition: porousmediumflow/2p/iofields.hh:27
static std::string primaryVariableName(int pvIdx, int state=0)
Definition: porousmediumflow/2p/iofields.hh:54
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/2p/iofields.hh:30
@ p0s1
first phase pressure and second phase saturation as primary variables
A collection of input/output field names for common physical quantities.
std::string capillaryPressure() noexcept
I/O name of capillary pressure.
Definition: name.hh:123
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:127
Definition: adapt.hh:17
Adaption of the fully implicit scheme to the tracer transport model.