WIP, now runs with just this flux module replacing original versions.

This commit is contained in:
Atgeirr Flø Rasmussen 2022-07-05 14:28:13 +02:00
parent c48770dc5f
commit fdce3e590d

View File

@ -170,7 +170,7 @@ public:
*/ */
const Evaluation& volumeFlux(unsigned phaseIdx) const const Evaluation& volumeFlux(unsigned phaseIdx) const
{ {
throw std::invalid_argument("Should not acces volume flux for eclmoduletpfa"); //throw std::invalid_argument("Should not acces volume flux for eclmoduletpfa");
return volumeFlux_[phaseIdx]; return volumeFlux_[phaseIdx];
} }
@ -184,7 +184,7 @@ protected:
*/ */
unsigned upstreamIndex_(unsigned phaseIdx) const unsigned upstreamIndex_(unsigned phaseIdx) const
{ {
throw std::invalid_argument("No upstreamIndex"); //throw std::invalid_argument("No upstreamIndex");
assert(phaseIdx < numPhases); assert(phaseIdx < numPhases);
return upIdx_[phaseIdx]; return upIdx_[phaseIdx];
@ -199,7 +199,7 @@ protected:
*/ */
unsigned downstreamIndex_(unsigned phaseIdx) const unsigned downstreamIndex_(unsigned phaseIdx) const
{ {
throw std::invalid_argument("No downstream index"); //throw std::invalid_argument("No downstream index");
assert(phaseIdx < numPhases); assert(phaseIdx < numPhases);
return dnIdx_[phaseIdx]; return dnIdx_[phaseIdx];
@ -517,7 +517,7 @@ protected:
*/ */
void calculateGradients_(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx) void calculateGradients_(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
{ {
throw std::invalid_argument("No calculateGradients_"); //throw std::invalid_argument("No calculateGradients_");
Valgrind::SetUndefined(*this); Valgrind::SetUndefined(*this);
@ -529,15 +529,12 @@ protected:
exteriorDofIdx_ = scvf.exteriorIndex(); exteriorDofIdx_ = scvf.exteriorIndex();
assert(interiorDofIdx_ != exteriorDofIdx_); assert(interiorDofIdx_ != exteriorDofIdx_);
//unsigned I = stencil.globalSpaceIndex(interiorDofIdx_); unsigned I = stencil.globalSpaceIndex(interiorDofIdx_);
//unsigned J = stencil.globalSpaceIndex(exteriorDofIdx_); unsigned J = stencil.globalSpaceIndex(exteriorDofIdx_);
Scalar Vin = elemCtx.dofVolume(interiorDofIdx_, /*timeIdx=*/0);
Scalar Vex = elemCtx.dofVolume(exteriorDofIdx_, /*timeIdx=*/0);
const auto& globalIndexIn = stencil.globalSpaceIndex(interiorDofIdx_);
const auto& globalIndexEx = stencil.globalSpaceIndex(exteriorDofIdx_);
Scalar trans = problem.transmissibility(elemCtx, interiorDofIdx_, exteriorDofIdx_); Scalar trans = problem.transmissibility(elemCtx, interiorDofIdx_, exteriorDofIdx_);
Scalar faceArea = scvf.area(); Scalar faceArea = scvf.area();
Scalar thpres = problem.thresholdPressure(globalIndexIn, globalIndexEx); Scalar thpres = problem.thresholdPressure(I, J);
// estimate the gravity correction: for performance reasons we use a simplified // estimate the gravity correction: for performance reasons we use a simplified
// approach for this flux module that assumes that gravity is constant and always // approach for this flux module that assumes that gravity is constant and always
@ -559,6 +556,9 @@ protected:
// exterior DOF) // exterior DOF)
Scalar distZ = zIn - zEx; Scalar distZ = zIn - zEx;
Scalar Vin = elemCtx.dofVolume(interiorDofIdx_, /*timeIdx=*/0);
Scalar Vex = elemCtx.dofVolume(exteriorDofIdx_, /*timeIdx=*/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;
@ -573,23 +573,23 @@ protected:
exteriorDofIdx_, // intput exteriorDofIdx_, // intput
Vin, Vin,
Vex, Vex,
globalIndexIn, I,
globalIndexEx, J,
distZ * g, distZ * g,
thpres); thpres);
if (pressureDifference_[phaseIdx] == 0) { if (pressureDifference_[phaseIdx] == 0) {
volumeFlux_[phaseIdx] = 0.0; volumeFlux_[phaseIdx] = 0.0;
continue; continue;
} }
IntensiveQuantities up; const IntensiveQuantities& up = (upIdx_[phaseIdx] == interiorDofIdx_) ? intQuantsIn : intQuantsEx;
//unsigned globalIndex; //unsigned globalIndex;
if(upIdx_[phaseIdx] == interiorDofIdx_){ // if(upIdx_[phaseIdx] == interiorDofIdx_){
up = intQuantsIn; // up = intQuantsIn;
//globalIndex = globalIndexIn; // //globalIndex = I;
}else{ // }else{
up = intQuantsEx; // up = intQuantsEx;
//globalIndex = globalIndexEx; // //globalIndex = J;
} // }
// TODO: should the rock compaction transmissibility multiplier be upstreamed // TODO: should the rock compaction transmissibility multiplier be upstreamed
// or averaged? all fluids should see the same compaction?! // or averaged? all fluids should see the same compaction?!
//const auto& globalIndex = stencil.globalSpaceIndex(upstreamIdx); //const auto& globalIndex = stencil.globalSpaceIndex(upstreamIdx);
@ -604,7 +604,6 @@ protected:
else else
volumeFlux_[phaseIdx] = volumeFlux_[phaseIdx] =
pressureDifference_[phaseIdx]*(Toolbox::value(up.mobility(phaseIdx))*Toolbox::value(transMult)*(-trans/faceArea)); pressureDifference_[phaseIdx]*(Toolbox::value(up.mobility(phaseIdx))*Toolbox::value(transMult)*(-trans/faceArea));
} }
} }