13#ifndef DUMUX_2P1C_PRIMARY_VARIABLE_SWITCH_HH
14#define DUMUX_2P1C_PRIMARY_VARIABLE_SWITCH_HH
34 using ParentType::ParentType;
46 template<
class VolumeVariables,
class GlobalPosition>
47 bool update_(
typename VolumeVariables::PrimaryVariables& priVars,
48 const VolumeVariables& volVars,
49 std::size_t dofIdxGlobal,
50 const GlobalPosition& globalPos)
52 using Scalar =
typename VolumeVariables::PrimaryVariables::value_type;
53 using FluidSystem =
typename VolumeVariables::FluidSystem;
54 using Indices =
typename VolumeVariables::Indices;
56 static constexpr auto formulation = VolumeVariables::priVarFormulation();
58 "Chosen TwoPFormulation not supported!");
61 bool wouldSwitch =
false;
72 if (volVars.saturation(FluidSystem::gasPhaseIdx) <= Smin)
77 std::cout <<
"Gas phase (" << FluidSystem::phaseName(FluidSystem::gasPhaseIdx)
78 <<
") disappears at dof " << dofIdxGlobal
79 <<
", coordinates: " << globalPos
80 <<
", S_" << FluidSystem::phaseName(FluidSystem::gasPhaseIdx) <<
": "
81 << volVars.saturation(FluidSystem::gasPhaseIdx)
83 newPhasePresence = Indices::liquidPhaseOnly;
85 priVars[Indices::switchIdx] = volVars.fluidState().temperature();
87 else if (volVars.saturation(FluidSystem::liquidPhaseIdx) <= Smin)
92 std::cout <<
"Liquid phase (" << FluidSystem::phaseName(FluidSystem::liquidPhaseIdx)
93 <<
") disappears at dof " << dofIdxGlobal
94 <<
", coordinates: " << globalPos
95 <<
", S_" << FluidSystem::phaseName(FluidSystem::liquidPhaseIdx) <<
": "
96 << volVars.saturation(FluidSystem::liquidPhaseIdx)
98 newPhasePresence = Indices::gasPhaseOnly;
100 priVars[Indices::switchIdx] = volVars.fluidState().temperature();
106 const Scalar temp = volVars.fluidState().temperature();
107 const Scalar tempVap = volVars.vaporTemperature();
116 std::cout <<
"Gas phase (" << FluidSystem::phaseName(FluidSystem::gasPhaseIdx)
117 <<
") appears at dof " << dofIdxGlobal
118 <<
", coordinates: " << globalPos
120 newPhasePresence = Indices::twoPhases;
122 priVars[Indices::switchIdx] = 0.9999;
124 priVars[Indices::switchIdx] = 0.0001;
129 const Scalar temp = volVars.fluidState().temperature();
130 const Scalar tempVap = volVars.vaporTemperature();
137 std::cout <<
"Liquid phase (" << FluidSystem::phaseName(FluidSystem::liquidPhaseIdx) <<
") appears at dof " << dofIdxGlobal
138 <<
", coordinates: " << globalPos << std::endl;
140 newPhasePresence = Indices::twoPhases;
142 priVars[Indices::switchIdx] = 0.0001;
144 priVars[Indices::switchIdx] = 0.9999;
147 priVars.setState(newPhasePresence);
The primary variable switch controlling the phase presence state variable.
Definition: compositional/primaryvariableswitch.hh:49
std::vector< bool > wasSwitched_
Definition: compositional/primaryvariableswitch.hh:433
int verbosity() const
The verbosity level.
Definition: compositional/primaryvariableswitch.hh:271
The primary variable switch for the two-phase one-component model.
Definition: 2p1c/primaryvariableswitch.hh:29
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:47
The primary variable switch base class for compositional models.
@ 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:135