25#ifndef DUMUX_TWOP_NC_IO_FIELDS_HH
26#define DUMUX_TWOP_NC_IO_FIELDS_HH
41 template <
class OutputModule>
44 using VolumeVariables =
typename OutputModule::VolumeVariables;
45 using FluidSystem =
typename VolumeVariables::FluidSystem;
51 for (
int phaseIdx = 0; phaseIdx < VolumeVariables::numFluidPhases(); ++phaseIdx)
53 for (
int compIdx = 0; compIdx < VolumeVariables::numFluidComponents(); ++compIdx)
55 out.addVolumeVariable([phaseIdx,compIdx](
const auto& v){
return v.moleFraction(phaseIdx,compIdx); },
56 IOName::moleFraction<FluidSystem>(phaseIdx, compIdx));
57 if (VolumeVariables::numFluidComponents() < 3)
58 out.addVolumeVariable([phaseIdx,compIdx](
const auto& v){
return v.massFraction(phaseIdx,compIdx); },
59 IOName::massFraction<FluidSystem>(phaseIdx, compIdx));
62 out.addVolumeVariable([phaseIdx](
const auto& v){
return v.molarDensity(phaseIdx); },
63 IOName::molarDensity<FluidSystem>(phaseIdx));
66 out.addVolumeVariable([](
const auto& v){
return v.priVars().state(); },
70 template <
class ModelTraits,
class Flu
idSystem,
class Sol
idSystem =
void>
74 static constexpr auto numStates = 3;
75 using StringVec = std::array<std::string, numStates>;
78 if (state == Indices::firstPhaseOnly
79 || (state == Indices::bothPhases && ModelTraits::setMoleFractionsForFirstPhase()))
80 idxSecComps = FluidSystem::phase0Idx;
82 idxSecComps = FluidSystem::phase1Idx;
85 return ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(idxSecComps, pvIdx)
86 : IOName::massFraction<FluidSystem>(idxSecComps, pvIdx);
88 static const StringVec p0s1SwitchedPvNames = {
89 ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx)
90 : IOName::massFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx),
91 ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase1Idx, FluidSystem::comp0Idx)
92 : IOName::massFraction<FluidSystem>(FluidSystem::phase1Idx, FluidSystem::comp0Idx),
93 IOName::saturation<FluidSystem>(FluidSystem::phase1Idx)};
95 static const StringVec p1s0SwitchedPvNames = {
96 ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx)
97 : IOName::massFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx),
98 ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase1Idx, FluidSystem::comp0Idx)
99 : IOName::massFraction<FluidSystem>(FluidSystem::phase1Idx, FluidSystem::comp0Idx),
100 IOName::saturation<FluidSystem>(FluidSystem::phase0Idx)};
102 switch (ModelTraits::priVarFormulation())
105 return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase0Idx)
106 : p0s1SwitchedPvNames[state-1];
108 return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase1Idx)
109 : p1s0SwitchedPvNames[state-1];
110 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid formulation ");
A collection of input/output field names for common physical quantities.
@ p1s0
first phase saturation and second phase pressure as primary variables
@ p0s1
first phase pressure and second phase saturation as primary variables
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
std::string phasePresence() noexcept
I/O name of phase presence.
Definition: name.hh:147
static void initOutputModule(OutputModule &out)
Definition: dumux/porousmediumflow/2p/iofields.hh:42
Adds I/O fields specific to the TwoPNC model.
Definition: dumux/porousmediumflow/2pnc/iofields.hh:39
static std::string primaryVariableName(int pvIdx, int state)
Definition: dumux/porousmediumflow/2pnc/iofields.hh:71
static void initOutputModule(OutputModule &out)
Definition: dumux/porousmediumflow/2pnc/iofields.hh:42
Adds I/O fields specific to the two-phase model.