Ensure solvent boundary fluxes work.

This does the job for the element-context-based linearizer,
but not for the TpfaLinearizer, which when combined with the
solvent model will require a bit more work for bcs.
This commit is contained in:
Atgeirr Flø Rasmussen 2022-09-23 16:03:18 +02:00
parent b7758aa706
commit 04183dea31

View File

@ -421,12 +421,15 @@ protected:
const FluidState& exFluidState) const FluidState& exFluidState)
{ {
const auto& scvf = elemCtx.stencil(timeIdx).boundaryFace(scvfIdx); const auto& scvf = elemCtx.stencil(timeIdx).boundaryFace(scvfIdx);
Scalar faceArea = scvf.area(); const Scalar faceArea = scvf.area();
Scalar zEx = scvf.integrationPos()[dimWorld - 1]; const Scalar zEx = scvf.integrationPos()[dimWorld - 1];
const auto& problem = elemCtx.problem(); const auto& problem = elemCtx.problem();
const unsigned globalSpaceIdx = elemCtx.globalSpaceIndex(0, timeIdx);
const auto& intQuantsIn = elemCtx.intensiveQuantities(0, timeIdx);
calculateBoundaryGradients_(problem, calculateBoundaryGradients_(problem,
elemCtx.globalSpaceIndex(0, timeIdx), globalSpaceIdx,
elemCtx.intensiveQuantities(0, timeIdx), intQuantsIn,
scvfIdx, scvfIdx,
timeIdx, timeIdx,
faceArea, faceArea,
@ -436,6 +439,20 @@ protected:
dnIdx_, dnIdx_,
volumeFlux_, volumeFlux_,
pressureDifference_); pressureDifference_);
// Treating solvent here and not in the static method, since that would require more
// extensive refactoring. It means that the TpfaLinearizer will not support bcs for solvent until this is
// addressed.
if constexpr (enableSolvent) {
if (upIdx_[gasPhaseIdx] == 0) {
const Scalar trans = problem.transmissibilityBoundary(globalSpaceIdx, scvfIdx);
const Scalar transModified = trans * Toolbox::value(intQuantsIn.rockCompTransMultiplier());
const auto solventFlux = pressureDifference_[gasPhaseIdx] * intQuantsIn.mobility(gasPhaseIdx) * (-transModified/faceArea);
asImp_().setSolventVolumeFlux(solventFlux);
} else {
asImp_().setSolventVolumeFlux(0.0);
}
}
} }
public: public:
@ -461,7 +478,6 @@ public:
if (!enableBoundaryMassFlux) if (!enableBoundaryMassFlux)
return; return;
Scalar trans = problem.transmissibilityBoundary(globalSpaceIdx, bfIdx); Scalar trans = problem.transmissibilityBoundary(globalSpaceIdx, bfIdx);
// estimate the gravity correction: for performance reasons we use a simplified // estimate the gravity correction: for performance reasons we use a simplified
@ -520,15 +536,11 @@ public:
const auto& up = intQuantsIn; const auto& up = intQuantsIn;
// deal with water induced rock compaction // deal with water induced rock compaction
const double transMult = Toolbox::value(up.rockCompTransMultiplier()); const Scalar transMult = Toolbox::value(up.rockCompTransMultiplier());
transModified *= transMult; transModified *= transMult;
volumeFlux[phaseIdx] = volumeFlux[phaseIdx] =
pressureDifference[phaseIdx]*up.mobility(phaseIdx)*(-transModified/faceArea); pressureDifference[phaseIdx]*up.mobility(phaseIdx)*(-transModified/faceArea);
// TODO: Figure out if this did have any effect. It should?
// if (enableSolvent && phaseIdx == gasPhaseIdx)
// asImp_().setSolventVolumeFlux( pressureDifference[phaseIdx]*up.solventMobility()*(-transModified/faceArea));
} }
else { else {
// compute the phase mobility using the material law parameters of the // compute the phase mobility using the material law parameters of the
@ -540,10 +552,6 @@ public:
const auto& mob = kr[phaseIdx]/exFluidState.viscosity(phaseIdx); const auto& mob = kr[phaseIdx]/exFluidState.viscosity(phaseIdx);
volumeFlux[phaseIdx] = volumeFlux[phaseIdx] =
pressureDifference[phaseIdx]*mob*(-transModified/faceArea); pressureDifference[phaseIdx]*mob*(-transModified/faceArea);
// Solvent inflow is not yet supported
// if (enableSolvent && phaseIdx == gasPhaseIdx)
// asImp_().setSolventVolumeFlux(0.0);
} }
} }
} }