mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
use diffusivity
This commit is contained in:
@@ -388,27 +388,13 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void update_(const ElementContext& elemCtx, unsigned faceIdx, unsigned timeIdx)
|
void update_(const ElementContext& elemCtx, unsigned faceIdx, unsigned timeIdx)
|
||||||
{
|
{
|
||||||
// This uses a simple finite difference approach and is only correct for a Cartesian grids.
|
|
||||||
// TODO compute diffusive "transmissibilities" by re-using the logic in EclTransmissibility
|
|
||||||
const auto& stencil = elemCtx.stencil(timeIdx);
|
const auto& stencil = elemCtx.stencil(timeIdx);
|
||||||
const auto& face = stencil.interiorFace(faceIdx);
|
const auto& face = stencil.interiorFace(faceIdx);
|
||||||
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, timeIdx);
|
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, timeIdx);
|
||||||
|
|
||||||
const auto& intQuantsInside = elemCtx.intensiveQuantities(extQuants.interiorIndex(), timeIdx);
|
const auto& intQuantsInside = elemCtx.intensiveQuantities(extQuants.interiorIndex(), timeIdx);
|
||||||
const auto& intQuantsOutside = elemCtx.intensiveQuantities(extQuants.exteriorIndex(), timeIdx);
|
const auto& intQuantsOutside = elemCtx.intensiveQuantities(extQuants.exteriorIndex(), timeIdx);
|
||||||
|
|
||||||
// distance between the centers
|
Scalar diffusivity = elemCtx.problem().diffusivity(elemCtx, face.interiorIndex(), face.exteriorIndex());
|
||||||
const auto& insideScv = stencil.subControlVolume(face.interiorIndex());
|
|
||||||
const auto& outsideScv = stencil.subControlVolume(face.exteriorIndex());
|
|
||||||
|
|
||||||
DimVector distVec = outsideScv.globalPos();
|
|
||||||
distVec -= insideScv.globalPos();
|
|
||||||
Scalar dist = distVec.two_norm();
|
|
||||||
|
|
||||||
// if the following assertation triggers, the center of the
|
|
||||||
// center of the interior SCV was not inside the element!
|
|
||||||
assert(dist > 0);
|
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -422,7 +408,7 @@ protected:
|
|||||||
(intQuantsOutside.fluidState().moleFraction(phaseIdx, compIdx)
|
(intQuantsOutside.fluidState().moleFraction(phaseIdx, compIdx)
|
||||||
-
|
-
|
||||||
intQuantsInside.fluidState().moleFraction(phaseIdx, compIdx))
|
intQuantsInside.fluidState().moleFraction(phaseIdx, compIdx))
|
||||||
/ dist;
|
* diffusivity;
|
||||||
Opm::Valgrind::CheckDefined(moleFractionGradientNormal_[phaseIdx][compIdx]);
|
Opm::Valgrind::CheckDefined(moleFractionGradientNormal_[phaseIdx][compIdx]);
|
||||||
|
|
||||||
// use the arithmetic average for the effective
|
// use the arithmetic average for the effective
|
||||||
@@ -439,59 +425,12 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Context, class FluidState>
|
template <class Context, class FluidState>
|
||||||
void updateBoundary_(const Context& context,
|
void updateBoundary_(const Context& context OPM_UNUSED,
|
||||||
unsigned bfIdx,
|
unsigned bfIdx OPM_UNUSED,
|
||||||
unsigned timeIdx,
|
unsigned timeIdx OPM_UNUSED,
|
||||||
const FluidState& fluidState)
|
const FluidState& fluidState OPM_UNUSED)
|
||||||
{
|
{
|
||||||
// This uses a simple finite difference approach and is only correct for a Cartesian grids.
|
throw std::runtime_error("Not implemented: Diffusion across boundary not implemented for blackoil");
|
||||||
// TODO compute diffusive "transmissibilities" by re-using the logic in EclTransmissibility
|
|
||||||
const auto& stencil = context.stencil(timeIdx);
|
|
||||||
const auto& face = stencil.boundaryFace(bfIdx);
|
|
||||||
|
|
||||||
const auto& elemCtx = context.elementContext();
|
|
||||||
unsigned insideScvIdx = face.interiorIndex();
|
|
||||||
const auto& insideScv = stencil.subControlVolume(insideScvIdx);
|
|
||||||
|
|
||||||
const auto& intQuantsInside = elemCtx.intensiveQuantities(insideScvIdx, timeIdx);
|
|
||||||
const auto& fluidStateInside = intQuantsInside.fluidState();
|
|
||||||
|
|
||||||
// distance between the center of the SCV and center of the boundary face
|
|
||||||
DimVector distVec = face.integrationPos();
|
|
||||||
distVec -= context.element().geometry().global(insideScv.localGeometry().center());
|
|
||||||
|
|
||||||
Scalar dist = distVec.two_norm();
|
|
||||||
|
|
||||||
// if the following assertation triggers, the center of the
|
|
||||||
// center of the interior SCV was not inside the element!
|
|
||||||
assert(dist > 0);
|
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
|
||||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// no diffusion in water for blackoil models
|
|
||||||
if (FluidSystem::waterPhaseIdx == phaseIdx) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
|
||||||
// calculate mole fraction gradient using two-point
|
|
||||||
// gradients
|
|
||||||
moleFractionGradientNormal_[phaseIdx][compIdx] =
|
|
||||||
(fluidState.moleFraction(phaseIdx, compIdx)
|
|
||||||
-
|
|
||||||
fluidStateInside.moleFraction(phaseIdx, compIdx))
|
|
||||||
/ dist;
|
|
||||||
Opm::Valgrind::CheckDefined(moleFractionGradientNormal_[phaseIdx][compIdx]);
|
|
||||||
|
|
||||||
// use effective diffusion coefficients of the interior finite
|
|
||||||
// volume.
|
|
||||||
effectiveDiffusionCoefficient_[phaseIdx][compIdx] =
|
|
||||||
intQuantsInside.effectiveDiffusionCoefficient(phaseIdx, compIdx);
|
|
||||||
|
|
||||||
Opm::Valgrind::CheckDefined(effectiveDiffusionCoefficient_[phaseIdx][compIdx]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ public:
|
|||||||
MultiPhaseParent::updateBoundary(ctx, bfIdx, timeIdx, fluidState);
|
MultiPhaseParent::updateBoundary(ctx, bfIdx, timeIdx, fluidState);
|
||||||
|
|
||||||
asImp_().updateEnergyBoundary(ctx, bfIdx, timeIdx, fluidState);
|
asImp_().updateEnergyBoundary(ctx, bfIdx, timeIdx, fluidState);
|
||||||
|
|
||||||
DiffusionExtensiveQuantities::updateBoundary_(ctx, bfIdx, timeIdx, fluidState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user