100 void setFreeFlow(
const Context& context,
unsigned bfIdx,
unsigned timeIdx,
const FluidState& fluidState)
102 ExtensiveQuantities extQuants;
103 extQuants.updateBoundary(context, bfIdx, timeIdx, fluidState);
104 const auto& insideIntQuants = context.intensiveQuantities(bfIdx, timeIdx);
105 const unsigned focusDofIdx = context.focusDofIndex();
106 const unsigned interiorDofIdx = context.interiorScvIndex(bfIdx, timeIdx);
111 (*this) = Evaluation(0.0);
112 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
113 const auto& pBoundary = fluidState.pressure(phaseIdx);
114 const Evaluation& pInside = insideIntQuants.fluidState().pressure(phaseIdx);
118 if (pBoundary > pInside) {
119 if (focusDofIdx == interiorDofIdx) {
120 density = fluidState.density(phaseIdx);
123 density = getValue(fluidState.density(phaseIdx));
126 else if (focusDofIdx == interiorDofIdx) {
127 density = insideIntQuants.fluidState().density(phaseIdx);
130 density = getValue(insideIntQuants.fluidState().density(phaseIdx));
133 Valgrind::CheckDefined(density);
134 Valgrind::CheckDefined(extQuants.volumeFlux(phaseIdx));
136 (*this)[conti0EqIdx + phaseIdx] += extQuants.volumeFlux(phaseIdx) * density;
139 if constexpr (enableEnergy) {
140 Evaluation specificEnthalpy;
141 if (pBoundary > pInside) {
142 if (focusDofIdx == interiorDofIdx) {
143 specificEnthalpy = fluidState.enthalpy(phaseIdx);
146 specificEnthalpy = getValue(fluidState.enthalpy(phaseIdx));
149 else if (focusDofIdx == interiorDofIdx) {
150 specificEnthalpy = insideIntQuants.fluidState().enthalpy(phaseIdx);
153 specificEnthalpy = getValue(insideIntQuants.fluidState().enthalpy(phaseIdx));
156 const Evaluation enthalpyRate = density * extQuants.volumeFlux(phaseIdx) * specificEnthalpy;
157 EnergyModule::addToEnthalpyRate(*
this, enthalpyRate);
162 EnergyModule::addToEnthalpyRate(*
this, EnergyModule::thermalConductionRate(extQuants));
165 for (
unsigned i = 0; i < numEq; ++i) {
166 Valgrind::CheckDefined((*
this)[i]);
168 Valgrind::CheckDefined(*
this);