new eclproblemtpfa

This commit is contained in:
hnil 2022-06-17 12:00:12 +02:00 committed by Atgeirr Flø Rasmussen
parent 8f5e0940fe
commit 409f60642e
3 changed files with 3278 additions and 2 deletions

View File

@ -1429,6 +1429,11 @@ public:
/*!
* \copydoc EclTransmissiblity::transmissibility
*/
Scalar transmissibility(unsigned globalCenterElemIdx,unsigned globalElemIdx) const
{
return transmissibilities_.transmissibility(globalCenterElemIdx, globalElemIdx);
}
template <class Context>
Scalar transmissibility(const Context& context,
[[maybe_unused]] unsigned fromDofLocalIdx,
@ -1537,6 +1542,13 @@ public:
return this->referencePorosity_[timeIdx][globalSpaceIdx];
}
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
{
//unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
return this->referencePorosity_[timeIdx][globalSpaceIdx];
}
/*!
* \brief Returns the depth of an degree of freedom [m]
*
@ -1561,6 +1573,11 @@ public:
return this->simulator().vanguard().cellCenterDepth(globalSpaceIdx);
}
Scalar dofCenterDepth(unsigned globalSpaceIdx, unsigned timeIdx) const
{
return this->simulator().vanguard().cellCenterDepth(globalSpaceIdx);
}
/*!
* \copydoc BlackoilProblem::rockCompressibility
@ -1580,6 +1597,20 @@ public:
return this->rockParams_[tableIdx].compressibility;
}
Scalar rockCompressibility(unsigned globalSpaceIdx, unsigned timeIdx) const
{
// if (this->rockParams_.empty())
// return 0.0;
// unsigned tableIdx = 0;
// if (!this->rockTableIdx_.empty()) {
// tableIdx = this->rockTableIdx_[globalSpaceIdx];
// }
unsigned tableIdx = 0;
return this->rockParams_[tableIdx].compressibility;
}
/*!
* \copydoc BlackoilProblem::rockReferencePressure
*/
@ -1594,10 +1625,21 @@ public:
unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
tableIdx = this->rockTableIdx_[globalSpaceIdx];
}
return this->rockParams_[tableIdx].referencePressure;
}
Scalar rockReferencePressure(unsigned globalSpaceIdx, unsigned timeIdx) const
{
// if (this->rockParams_.empty())
// return 1e5;
// unsigned tableIdx = 0;
// if (!this->rockTableIdx_.empty()) {
// tableIdx = this->rockTableIdx_[globalSpaceIdx];
// }
unsigned tableIdx = 0;//this->rockTableIdx_[globalSpaceIdx];
return this->rockParams_[tableIdx].referencePressure;
}
/*!
* \copydoc FvBaseMultiPhaseProblem::materialLawParams
*/
@ -1825,6 +1867,7 @@ public:
*/
Scalar maxGasDissolutionFactor(unsigned timeIdx, unsigned globalDofIdx) const
{
int pvtRegionIdx = this->pvtRegionIndex(globalDofIdx);
int episodeIdx = this->episodeIndex();
if (!this->drsdtActive_(episodeIdx) || this->maxDRs_[pvtRegionIdx] < 0.0)
@ -1943,6 +1986,61 @@ public:
aquiferModel_.initialSolutionApplied();
}
template <class Context>
void source(RateVector& rate,
unsigned globalSpaceIdx,
unsigned timeIdx) const
{
rate = 0.0;
wellModel_.computeTotalRatesForDof(rate, globalSpaceIdx, timeIdx);
// convert the source term from the total mass rate of the
// cell to the one per unit of volume as used by the model.
for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx) {
rate[eqIdx] /= this->model().dofTotalVolume(globalSpaceIdx);
Valgrind::CheckDefined(rate[eqIdx]);
assert(isfinite(rate[eqIdx]));
}
// if (enableAquifers_)
// aquiferModel_.addToSource(rate, context, spaceIdx, timeIdx);
// if requested, compensate systematic mass loss for cells which were "well
// behaved" in the last time step
// if (enableDriftCompensation_) {
// const auto& intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
// const auto& simulator = this->simulator();
// const auto& model = this->model();
// // we need a higher maxCompensation than the Newton tolerance because the
// // current time step might be shorter than the last one
// Scalar maxCompensation = 10.0*model.newtonMethod().tolerance();
// Scalar poro = intQuants.referencePorosity();
// Scalar dt = simulator.timeStepSize();
// EqVector dofDriftRate = drift_[globalDofIdx];
// dofDriftRate /= dt*context.dofTotalVolume(spaceIdx, timeIdx);
// // compute the weighted total drift rate
// Scalar totalDriftRate = 0.0;
// for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx)
// totalDriftRate +=
// std::abs(dofDriftRate[eqIdx])*dt*model.eqWeight(globalDofIdx, eqIdx)/poro;
// // make sure that we do not exceed the maximum rate of drift compensation
// if (totalDriftRate > maxCompensation)
// dofDriftRate *= maxCompensation/totalDriftRate;
// for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx)
// rate[eqIdx] -= dofDriftRate[eqIdx];
// }
}
/*!
* \copydoc FvBaseProblem::source
*

3168
ebos/eclproblemtpfa.hh Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@
#include <opm/models/discretization/common/fvbaseadlocallinearizertpfa.hh>
#include <opm/models/discretization/common/smallelementcontext.hh>
#include <ebos/eclfluxmoduletpfa.hh>
#include <ebos/eclproblemtpfa.hh>
namespace Opm {
namespace Properties {
namespace TTag {
@ -32,10 +33,19 @@ namespace Opm {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
}
}
namespace Opm {
namespace Properties {
template<class TypeTag>
struct Problem<TypeTag, TTag::EclFlowProblemTPFA> {
using type = EclProblemTPFA<TypeTag>;
};
}
}
namespace Opm {
namespace Properties {
template<class TypeTag>