25#ifndef DUMUX_2P1C_PRIMARY_VARIABLE_SWITCH_HH
26#define DUMUX_2P1C_PRIMARY_VARIABLE_SWITCH_HH
46 using ParentType::ParentType;
58 template<
class VolumeVariables,
class GlobalPosition>
59 bool update_(
typename VolumeVariables::PrimaryVariables& priVars,
60 const VolumeVariables& volVars,
61 std::size_t dofIdxGlobal,
62 const GlobalPosition& globalPos)
64 using Scalar =
typename VolumeVariables::PrimaryVariables::value_type;
65 using FluidSystem =
typename VolumeVariables::FluidSystem;
66 using Indices =
typename VolumeVariables::Indices;
68 static constexpr auto formulation = VolumeVariables::priVarFormulation();
70 "Chosen TwoPFormulation not supported!");
73 bool wouldSwitch =
false;
84 if (volVars.saturation(FluidSystem::gasPhaseIdx) <= Smin)
89 std::cout <<
"Gas phase (" << FluidSystem::phaseName(FluidSystem::gasPhaseIdx)
90 <<
") disappears at dof " << dofIdxGlobal
91 <<
", coordinates: " << globalPos
92 <<
", S_" << FluidSystem::phaseName(FluidSystem::gasPhaseIdx) <<
": "
93 << volVars.saturation(FluidSystem::gasPhaseIdx)
95 newPhasePresence = Indices::liquidPhaseOnly;
97 priVars[Indices::switchIdx] = volVars.fluidState().temperature();
99 else if (volVars.saturation(FluidSystem::liquidPhaseIdx) <= Smin)
104 std::cout <<
"Liquid phase (" << FluidSystem::phaseName(FluidSystem::liquidPhaseIdx)
105 <<
") disappears at dof " << dofIdxGlobal
106 <<
", coordinates: " << globalPos
107 <<
", S_" << FluidSystem::phaseName(FluidSystem::liquidPhaseIdx) <<
": "
108 << volVars.saturation(FluidSystem::liquidPhaseIdx)
110 newPhasePresence = Indices::gasPhaseOnly;
112 priVars[Indices::switchIdx] = volVars.fluidState().temperature();
118 const Scalar temp = volVars.fluidState().temperature();
119 const Scalar tempVap = volVars.vaporTemperature();
128 std::cout <<
"Gas phase (" << FluidSystem::phaseName(FluidSystem::gasPhaseIdx)
129 <<
") appears at dof " << dofIdxGlobal
130 <<
", coordinates: " << globalPos
132 newPhasePresence = Indices::twoPhases;
134 priVars[Indices::switchIdx] = 0.9999;
136 priVars[Indices::switchIdx] = 0.0001;
141 const Scalar temp = volVars.fluidState().temperature();
142 const Scalar tempVap = volVars.vaporTemperature();
149 std::cout <<
"Liquid phase (" << FluidSystem::phaseName(FluidSystem::liquidPhaseIdx) <<
") appears at dof " << dofIdxGlobal
150 <<
", coordinates: " << globalPos << std::endl;
152 newPhasePresence = Indices::twoPhases;
154 priVars[Indices::switchIdx] = 0.0001;
156 priVars[Indices::switchIdx] = 0.9999;
159 priVars.setState(newPhasePresence);
Defines an enumeration for the formulations accepted by the two-phase model.
@ p1s0
first phase saturation and second phase pressure as primary variables
@ p0s1
first phase pressure and second phase saturation as primary variables
std::string phasePresence() noexcept
I/O name of phase presence.
Definition: name.hh:147
The primary variable switch for the two-phase one-component model.
Definition: 2p1c/primaryvariableswitch.hh:41
bool update_(typename VolumeVariables::PrimaryVariables &priVars, const VolumeVariables &volVars, std::size_t dofIdxGlobal, const GlobalPosition &globalPos)
Performs variable switch at a degree of freedom location.
Definition: 2p1c/primaryvariableswitch.hh:59
The primary variable switch controlling the phase presence state variable.
Definition: compositional/primaryvariableswitch.hh:61
std::vector< bool > wasSwitched_
Definition: compositional/primaryvariableswitch.hh:445
int verbosity() const
The verbosity level.
Definition: compositional/primaryvariableswitch.hh:283
The primary variable switch base class for compositional models.