mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-11 00:41:56 -06:00
ecloutputblackoilmodule.hh: adapt coding style to the rest of eWoms
the style was mostly fine, but there were a few leftovers from the pre-eWoms epoch of that code.
This commit is contained in:
parent
91139efa27
commit
a53ef08699
@ -94,9 +94,10 @@ class EclOutputBlackOilModule
|
||||
|
||||
typedef std::vector<Scalar> ScalarBuffer;
|
||||
|
||||
struct FipDataType {
|
||||
|
||||
enum FipId {
|
||||
struct FipDataType
|
||||
{
|
||||
enum FipId
|
||||
{
|
||||
WaterInPlace = 0, //WIP
|
||||
OilInPlace = 1, //OIP
|
||||
GasInPlace = 2, //GIP
|
||||
@ -104,7 +105,7 @@ class EclOutputBlackOilModule
|
||||
OilInPlaceInGasPhase = 4, //OIPG
|
||||
GasInPlaceInLiquidPhase = 5, //GIPL
|
||||
GasInPlaceInGasPhase = 6, //GIPG
|
||||
PoreVolume = 7, //PV
|
||||
PoreVolume = 7, //PV
|
||||
};
|
||||
static const int numFipValues = PoreVolume + 1 ;
|
||||
};
|
||||
@ -120,9 +121,9 @@ public:
|
||||
const Opm::SummaryConfig summaryConfig = simulator_.vanguard().summaryConfig();
|
||||
|
||||
// Initialize block output
|
||||
for( const auto& node : summaryConfig ) {
|
||||
for (const auto& node: summaryConfig) {
|
||||
if (node.type() == ECL_SMSPEC_BLOCK_VAR) {
|
||||
if(collectToIORank.isGlobalIdxOnThisRank(node.num() - 1)) {
|
||||
if (collectToIORank.isGlobalIdxOnThisRank(node.num() - 1)) {
|
||||
std::pair<std::string, int> key = std::make_pair(node.keyword(), node.num());
|
||||
blockData_[key] = 0.0;
|
||||
}
|
||||
@ -136,7 +137,6 @@ public:
|
||||
*/
|
||||
void allocBuffers(unsigned bufferSize, unsigned reportStepNum, const bool substep, const bool log)
|
||||
{
|
||||
|
||||
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
|
||||
return;
|
||||
|
||||
@ -146,7 +146,7 @@ public:
|
||||
// Only output RESTART_AUXILIARY asked for by the user.
|
||||
const Opm::RestartConfig& restartConfig = simulator_.vanguard().eclState().getRestartConfig();
|
||||
std::map<std::string, int> rstKeywords = restartConfig.getRestartKeywords(reportStepNum);
|
||||
for (auto& keyValue : rstKeywords) {
|
||||
for (auto& keyValue: rstKeywords) {
|
||||
keyValue.second = restartConfig.getKeyword(keyValue.first, reportStepNum);
|
||||
}
|
||||
|
||||
@ -162,16 +162,17 @@ public:
|
||||
}
|
||||
fip_[i].resize(bufferSize, 0.0);
|
||||
computeFip_ = true;
|
||||
} else {
|
||||
fip_[i].clear();
|
||||
}
|
||||
else
|
||||
fip_[i].clear();
|
||||
}
|
||||
if (!substep || summaryConfig.hasKeyword("FPR") || summaryConfig.hasKeyword("FPRP") || summaryConfig.hasKeyword("RPR")) {
|
||||
fip_[FipDataType::PoreVolume].resize(bufferSize, 0.0);
|
||||
hydrocarbonPoreVolume_.resize(bufferSize, 0.0);
|
||||
pressureTimesPoreVolume_.resize(bufferSize, 0.0);
|
||||
pressureTimesHydrocarbonVolume_.resize(bufferSize, 0.0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
hydrocarbonPoreVolume_.clear();
|
||||
pressureTimesPoreVolume_.clear();
|
||||
pressureTimesHydrocarbonVolume_.clear();
|
||||
@ -179,23 +180,23 @@ public:
|
||||
|
||||
// Well RFT data
|
||||
if (!substep) {
|
||||
for ( const auto& well : simulator_.vanguard().schedule().getWells( reportStepNum )) {
|
||||
for (const auto& well: simulator_.vanguard().schedule().getWells(reportStepNum)) {
|
||||
|
||||
// don't bother with wells not on this process
|
||||
const auto& defunct_well_names = simulator_.vanguard().defunctWellNames();
|
||||
if ( defunct_well_names.find(well->name()) != defunct_well_names.end() ) {
|
||||
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
|
||||
if (defunctWellNames.find(well->name()) != defunctWellNames.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !( well->getRFTActive( reportStepNum )
|
||||
|| well->getPLTActive( reportStepNum ) ) )
|
||||
if (!(well->getRFTActive(reportStepNum)
|
||||
|| well->getPLTActive(reportStepNum)))
|
||||
continue;
|
||||
|
||||
for( const auto& completion : well->getCompletions( reportStepNum ) ) {
|
||||
const size_t i = size_t( completion.getI() );
|
||||
const size_t j = size_t( completion.getJ() );
|
||||
const size_t k = size_t( completion.getK() );
|
||||
const size_t index = simulator_.vanguard().eclState().getInputGrid().getGlobalIndex( i, j, k );
|
||||
for (const auto& completion: well->getCompletions(reportStepNum)) {
|
||||
const size_t i = size_t(completion.getI());
|
||||
const size_t j = size_t(completion.getJ());
|
||||
const size_t k = size_t(completion.getK());
|
||||
const size_t index = simulator_.vanguard().eclState().getInputGrid().getGlobalIndex(i, j, k);
|
||||
|
||||
oilCompletionPressures_.emplace(std::make_pair(index, 0.0));
|
||||
waterCompletionSaturations_.emplace(std::make_pair(index, 0.0));
|
||||
@ -213,61 +214,52 @@ public:
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx))
|
||||
continue;
|
||||
|
||||
saturation_[phaseIdx].resize(bufferSize,0.0);
|
||||
saturation_[phaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
// and oil pressure
|
||||
oilPressure_.resize(bufferSize,0.0);
|
||||
oilPressure_.resize(bufferSize, 0.0);
|
||||
temperature_.resize(bufferSize, 0.0);
|
||||
|
||||
if (true) // adding some logic here when the energy module is done
|
||||
temperature_.resize(bufferSize,0.0);
|
||||
if (FluidSystem::enableDissolvedGas())
|
||||
rs_.resize(bufferSize, 0.0);
|
||||
if (FluidSystem::enableVaporizedOil())
|
||||
rv_.resize(bufferSize, 0.0);
|
||||
|
||||
if (FluidSystem::enableDissolvedGas()) {
|
||||
rs_.resize(bufferSize,0.0);
|
||||
}
|
||||
if (FluidSystem::enableVaporizedOil()) {
|
||||
rv_.resize(bufferSize,0.0);
|
||||
}
|
||||
|
||||
if (GET_PROP_VALUE(TypeTag, EnableSolvent)) {
|
||||
sSol_.resize(bufferSize,0.0);
|
||||
}
|
||||
if (GET_PROP_VALUE(TypeTag, EnablePolymer)) {
|
||||
cPolymer_.resize(bufferSize,0.0);
|
||||
}
|
||||
if (GET_PROP_VALUE(TypeTag, EnableSolvent))
|
||||
sSol_.resize(bufferSize, 0.0);
|
||||
if (GET_PROP_VALUE(TypeTag, EnablePolymer))
|
||||
cPolymer_.resize(bufferSize, 0.0);
|
||||
|
||||
if (simulator_.problem().vapparsActive())
|
||||
soMax_.resize(bufferSize,0.0);
|
||||
soMax_.resize(bufferSize, 0.0);
|
||||
|
||||
if (simulator_.problem().materialLawManager()->enableHysteresis()) {
|
||||
pcSwMdcOw_.resize(bufferSize,0.0);
|
||||
krnSwMdcOw_.resize(bufferSize,0.0);
|
||||
pcSwMdcGo_.resize(bufferSize,0.0);
|
||||
krnSwMdcGo_.resize(bufferSize,0.0);
|
||||
pcSwMdcOw_.resize(bufferSize, 0.0);
|
||||
krnSwMdcOw_.resize(bufferSize, 0.0);
|
||||
pcSwMdcGo_.resize(bufferSize, 0.0);
|
||||
krnSwMdcGo_.resize(bufferSize, 0.0);
|
||||
}
|
||||
|
||||
if (FluidSystem::enableDissolvedGas() && rstKeywords["RSSAT"] > 0) {
|
||||
rstKeywords["RSSAT"] = 0;
|
||||
gasDissolutionFactor_.resize(bufferSize,0.0);
|
||||
gasDissolutionFactor_.resize(bufferSize, 0.0);
|
||||
}
|
||||
if (FluidSystem::enableVaporizedOil() && rstKeywords["RVSAT"] > 0) {
|
||||
rstKeywords["RVSAT"] = 0;
|
||||
oilVaporizationFactor_.resize(bufferSize,0.0);
|
||||
oilVaporizationFactor_.resize(bufferSize, 0.0);
|
||||
}
|
||||
|
||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && rstKeywords["BW"] > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && rstKeywords["BW"] > 0) {
|
||||
rstKeywords["BW"] = 0;
|
||||
invB_[waterPhaseIdx].resize(bufferSize,0.0);
|
||||
invB_[waterPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx) && rstKeywords["BO"] > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx) && rstKeywords["BO"] > 0) {
|
||||
rstKeywords["BO"] = 0;
|
||||
invB_[oilPhaseIdx].resize(bufferSize,0.0);
|
||||
invB_[oilPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) && rstKeywords["BG"] > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) && rstKeywords["BG"] > 0) {
|
||||
rstKeywords["BG"] = 0;
|
||||
invB_[gasPhaseIdx].resize(bufferSize,0.0);
|
||||
invB_[gasPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
|
||||
if (rstKeywords["DEN"] > 0) {
|
||||
@ -275,7 +267,7 @@ public:
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx))
|
||||
continue;
|
||||
density_[phaseIdx].resize(bufferSize,0.0);
|
||||
density_[phaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
}
|
||||
const bool hasVWAT = (rstKeywords["VISC"] > 0) || (rstKeywords["VWAT"] > 0);
|
||||
@ -283,47 +275,41 @@ public:
|
||||
const bool hasVGAS = (rstKeywords["VISC"] > 0) || (rstKeywords["VGAS"] > 0);
|
||||
rstKeywords["VISC"] = 0;
|
||||
|
||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && hasVWAT)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && hasVWAT) {
|
||||
rstKeywords["VWAT"] = 0;
|
||||
viscosity_[waterPhaseIdx].resize(bufferSize,0.0);
|
||||
viscosity_[waterPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx) && hasVOIL > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx) && hasVOIL > 0) {
|
||||
rstKeywords["VOIL"] = 0;
|
||||
viscosity_[oilPhaseIdx].resize(bufferSize,0.0);
|
||||
viscosity_[oilPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) && hasVGAS > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) && hasVGAS > 0) {
|
||||
rstKeywords["VGAS"] = 0;
|
||||
viscosity_[gasPhaseIdx].resize(bufferSize,0.0);
|
||||
viscosity_[gasPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
|
||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && rstKeywords["KRW"] > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && rstKeywords["KRW"] > 0) {
|
||||
rstKeywords["KRW"] = 0;
|
||||
relativePermeability_[waterPhaseIdx].resize(bufferSize,0.0);
|
||||
relativePermeability_[waterPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx) && rstKeywords["KRO"] > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx) && rstKeywords["KRO"] > 0) {
|
||||
rstKeywords["KRO"] = 0;
|
||||
relativePermeability_[oilPhaseIdx].resize(bufferSize,0.0);
|
||||
relativePermeability_[oilPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) && rstKeywords["KRG"] > 0)
|
||||
{
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) && rstKeywords["KRG"] > 0) {
|
||||
rstKeywords["KRG"] = 0;
|
||||
relativePermeability_[gasPhaseIdx].resize(bufferSize,0.0);
|
||||
relativePermeability_[gasPhaseIdx].resize(bufferSize, 0.0);
|
||||
}
|
||||
|
||||
if (rstKeywords["PBPD"] > 0) {
|
||||
rstKeywords["PBPD"] = 0;
|
||||
bubblePointPressure_.resize(bufferSize,0.0);
|
||||
dewPointPressure_.resize(bufferSize,0.0);
|
||||
bubblePointPressure_.resize(bufferSize, 0.0);
|
||||
dewPointPressure_.resize(bufferSize, 0.0);
|
||||
}
|
||||
|
||||
//Warn for any unhandled keyword
|
||||
if (log) {
|
||||
for (auto& keyValue : rstKeywords) {
|
||||
for (auto& keyValue: rstKeywords) {
|
||||
if (keyValue.second > 0) {
|
||||
std::string logstring = "Keyword '";
|
||||
logstring.append(keyValue.first);
|
||||
@ -338,9 +324,9 @@ public:
|
||||
|
||||
// Not supported in flow legacy
|
||||
if (false)
|
||||
saturatedOilFormationVolumeFactor_.resize(bufferSize,0.0);
|
||||
saturatedOilFormationVolumeFactor_.resize(bufferSize, 0.0);
|
||||
if (false)
|
||||
oilSaturationPressure_.resize(bufferSize,0.0);
|
||||
oilSaturationPressure_.resize(bufferSize, 0.0);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -349,7 +335,6 @@ public:
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
|
||||
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
|
||||
return;
|
||||
|
||||
@ -461,24 +446,22 @@ public:
|
||||
cPolymer_[globalDofIdx] = intQuants.polymerConcentration().value();
|
||||
}
|
||||
|
||||
if (bubblePointPressure_.size() > 0)
|
||||
{
|
||||
if (bubblePointPressure_.size() > 0) {
|
||||
try {
|
||||
bubblePointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::bubblePointPressure(fs, intQuants.pvtRegionIndex()));
|
||||
}
|
||||
catch (const Opm::NumericalIssue&) {
|
||||
const auto globalIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||
failedCellsPb_.push_back(globalIdx);
|
||||
const auto cartesianIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||
failedCellsPb_.push_back(cartesianIdx);
|
||||
}
|
||||
}
|
||||
if (dewPointPressure_.size() > 0)
|
||||
{
|
||||
if (dewPointPressure_.size() > 0) {
|
||||
try {
|
||||
dewPointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::dewPointPressure(fs, intQuants.pvtRegionIndex()));
|
||||
}
|
||||
catch (const Opm::NumericalIssue&) {
|
||||
const auto globalIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||
failedCellsPd_.push_back(globalIdx);
|
||||
const auto cartesianIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||
failedCellsPd_.push_back(cartesianIdx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -507,61 +490,61 @@ public:
|
||||
// rs and rv with the values computed in the initially.
|
||||
// Volume factors, densities and viscosities need to be recalculated with the updated rs and rv values.
|
||||
// This can be removed when ebos has 100% controll over output
|
||||
if (elemCtx.simulator().episodeIndex() < 0 && FluidSystem::phaseIsActive(oilPhaseIdx) && FluidSystem::phaseIsActive(gasPhaseIdx) ) {
|
||||
if (elemCtx.simulator().episodeIndex() < 0 && FluidSystem::phaseIsActive(oilPhaseIdx) && FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
||||
|
||||
const auto& fs_initial = elemCtx.simulator().problem().initialFluidState(globalDofIdx);
|
||||
const auto& fsInitial = elemCtx.simulator().problem().initialFluidState(globalDofIdx);
|
||||
|
||||
// use initial rs and rv values
|
||||
if (rv_.size() > 0)
|
||||
rv_[globalDofIdx] = fs_initial.Rv();
|
||||
rv_[globalDofIdx] = fsInitial.Rv();
|
||||
|
||||
if (rs_.size() > 0)
|
||||
rs_[globalDofIdx] = fs_initial.Rs();
|
||||
rs_[globalDofIdx] = fsInitial.Rs();
|
||||
|
||||
// re-compute the volume factors, viscosities and densities if asked for
|
||||
if (density_[oilPhaseIdx].size() > 0)
|
||||
density_[oilPhaseIdx][globalDofIdx] = FluidSystem::density(fs_initial,
|
||||
oilPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
density_[oilPhaseIdx][globalDofIdx] = FluidSystem::density(fsInitial,
|
||||
oilPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
if (density_[gasPhaseIdx].size() > 0)
|
||||
density_[gasPhaseIdx][globalDofIdx] = FluidSystem::density(fs_initial,
|
||||
gasPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
density_[gasPhaseIdx][globalDofIdx] = FluidSystem::density(fsInitial,
|
||||
gasPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
|
||||
if (invB_[oilPhaseIdx].size() > 0)
|
||||
invB_[oilPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fs_initial,
|
||||
oilPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
invB_[oilPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fsInitial,
|
||||
oilPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
if (invB_[gasPhaseIdx].size() > 0)
|
||||
invB_[gasPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fs_initial,
|
||||
gasPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
invB_[gasPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fsInitial,
|
||||
gasPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
if (viscosity_[oilPhaseIdx].size() > 0)
|
||||
viscosity_[oilPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fs_initial,
|
||||
oilPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
viscosity_[oilPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fsInitial,
|
||||
oilPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
if (viscosity_[gasPhaseIdx].size() > 0)
|
||||
viscosity_[gasPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fs_initial,
|
||||
gasPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
viscosity_[gasPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fsInitial,
|
||||
gasPhaseIdx,
|
||||
intQuants.pvtRegionIndex());
|
||||
}
|
||||
|
||||
// Add fluid in Place values
|
||||
updateFluidInPlace_(elemCtx, dofIdx);
|
||||
|
||||
// Adding block data
|
||||
const auto globalIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||
for( auto& val : blockData_ ) {
|
||||
const auto cartesianIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||
for (auto& val: blockData_) {
|
||||
const auto& key = val.first;
|
||||
int global_index = key.second - 1;
|
||||
if (global_index == globalIdx) {
|
||||
if (key.first == "BWSAT") {
|
||||
int cartesianIdxBlock = key.second - 1;
|
||||
if (cartesianIdx == cartesianIdxBlock) {
|
||||
if (key.first == "BWSAT")
|
||||
val.second = Opm::getValue(fs.saturation(waterPhaseIdx));
|
||||
} else if (key.first == "BGSAT") {
|
||||
else if (key.first == "BGSAT")
|
||||
val.second = Opm::getValue(fs.saturation(gasPhaseIdx));
|
||||
} else if (key.first == "BPR") {
|
||||
else if (key.first == "BPR")
|
||||
val.second = Opm::getValue(fs.pressure(oilPhaseIdx));
|
||||
} else {
|
||||
else {
|
||||
std::string logstring = "Keyword '";
|
||||
logstring.append(key.first);
|
||||
logstring.append("' is unhandled for output to file.");
|
||||
@ -571,14 +554,14 @@ public:
|
||||
}
|
||||
|
||||
// Adding Well RFT data
|
||||
if (oilCompletionPressures_.count(globalIdx) > 0) {
|
||||
oilCompletionPressures_[globalIdx] = Opm::getValue(fs.pressure(oilPhaseIdx));
|
||||
if (oilCompletionPressures_.count(cartesianIdx) > 0) {
|
||||
oilCompletionPressures_[cartesianIdx] = Opm::getValue(fs.pressure(oilPhaseIdx));
|
||||
}
|
||||
if (waterCompletionSaturations_.count(globalIdx) > 0) {
|
||||
waterCompletionSaturations_[globalIdx] = Opm::getValue(fs.saturation(waterPhaseIdx));
|
||||
if (waterCompletionSaturations_.count(cartesianIdx) > 0) {
|
||||
waterCompletionSaturations_[cartesianIdx] = Opm::getValue(fs.saturation(waterPhaseIdx));
|
||||
}
|
||||
if (gasCompletionSaturations_.count(globalIdx) > 0) {
|
||||
gasCompletionSaturations_[globalIdx] = Opm::getValue(fs.saturation(gasPhaseIdx));
|
||||
if (gasCompletionSaturations_.count(cartesianIdx) > 0) {
|
||||
gasCompletionSaturations_[cartesianIdx] = Opm::getValue(fs.saturation(gasPhaseIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -588,12 +571,11 @@ public:
|
||||
{
|
||||
const size_t maxNumCellsFaillog = 20;
|
||||
|
||||
int pbSize = failedCellsPb_.size(), pd_size = failedCellsPd_.size();
|
||||
int pbSize = failedCellsPb_.size(), pdSize = failedCellsPd_.size();
|
||||
std::vector<int> displPb, displPd, recvLenPb, recvLenPd;
|
||||
const auto& comm = simulator_.gridView().comm();
|
||||
|
||||
if ( isIORank_() )
|
||||
{
|
||||
if (isIORank_()) {
|
||||
displPb.resize(comm.size()+1, 0);
|
||||
displPd.resize(comm.size()+1, 0);
|
||||
recvLenPb.resize(comm.size());
|
||||
@ -601,13 +583,12 @@ public:
|
||||
}
|
||||
|
||||
comm.gather(&pbSize, recvLenPb.data(), 1, 0);
|
||||
comm.gather(&pd_size, recvLenPd.data(), 1, 0);
|
||||
comm.gather(&pdSize, recvLenPd.data(), 1, 0);
|
||||
std::partial_sum(recvLenPb.begin(), recvLenPb.end(), displPb.begin()+1);
|
||||
std::partial_sum(recvLenPd.begin(), recvLenPd.end(), displPd.begin()+1);
|
||||
std::vector<int> globalFailedCellsPb, globalFailedCellsPd;
|
||||
|
||||
if ( isIORank_() )
|
||||
{
|
||||
if (isIORank_()) {
|
||||
globalFailedCellsPb.resize(displPb.back());
|
||||
globalFailedCellsPd.resize(displPd.back());
|
||||
}
|
||||
@ -625,8 +606,8 @@ public:
|
||||
std::stringstream errlog;
|
||||
errlog << "Finding the bubble point pressure failed for " << globalFailedCellsPb.size() << " cells [";
|
||||
errlog << globalFailedCellsPb[0];
|
||||
const size_t max_elems = std::min(maxNumCellsFaillog, globalFailedCellsPb.size());
|
||||
for (size_t i = 1; i < max_elems; ++i) {
|
||||
const size_t maxElems = std::min(maxNumCellsFaillog, globalFailedCellsPb.size());
|
||||
for (size_t i = 1; i < maxElems; ++i) {
|
||||
errlog << ", " << globalFailedCellsPb[i];
|
||||
}
|
||||
if (globalFailedCellsPb.size() > maxNumCellsFaillog) {
|
||||
@ -639,8 +620,8 @@ public:
|
||||
std::stringstream errlog;
|
||||
errlog << "Finding the dew point pressure failed for " << globalFailedCellsPd.size() << " cells [";
|
||||
errlog << globalFailedCellsPd[0];
|
||||
const size_t max_elems = std::min(maxNumCellsFaillog, globalFailedCellsPd.size());
|
||||
for (size_t i = 1; i < max_elems; ++i) {
|
||||
const size_t maxElems = std::min(maxNumCellsFaillog, globalFailedCellsPd.size());
|
||||
for (size_t i = 1; i < maxElems; ++i) {
|
||||
errlog << ", " << globalFailedCellsPd[i];
|
||||
}
|
||||
if (globalFailedCellsPd.size() > maxNumCellsFaillog) {
|
||||
@ -653,39 +634,38 @@ public:
|
||||
|
||||
void addRftDataToWells(Opm::data::Wells& wellDatas, size_t reportStepNum)
|
||||
{
|
||||
for ( const auto& well : simulator_.vanguard().schedule().getWells( reportStepNum )) {
|
||||
for (const auto& well: simulator_.vanguard().schedule().getWells(reportStepNum)) {
|
||||
|
||||
// don't bother with wells not on this process
|
||||
const auto& defunct_well_names = simulator_.vanguard().defunctWellNames();
|
||||
if ( defunct_well_names.find(well->name()) != defunct_well_names.end() ) {
|
||||
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
|
||||
if (defunctWellNames.find(well->name()) != defunctWellNames.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//add data infrastructure for shut wells
|
||||
if (!wellDatas.count(well->name())){
|
||||
if (!wellDatas.count(well->name())) {
|
||||
Opm::data::Well wellData;
|
||||
|
||||
if( !( well->getRFTActive( reportStepNum )
|
||||
|| well->getPLTActive( reportStepNum ) ) )
|
||||
if (!(well->getRFTActive(reportStepNum)
|
||||
|| well->getPLTActive(reportStepNum)))
|
||||
continue;
|
||||
wellData.completions.resize(well->getCompletions( reportStepNum ).size());
|
||||
wellData.completions.resize(well->getCompletions(reportStepNum).size());
|
||||
size_t count = 0;
|
||||
for( const auto& completion : well->getCompletions( reportStepNum ) ) {
|
||||
for (const auto& completion: well->getCompletions(reportStepNum)) {
|
||||
const size_t i = size_t(completion.getI());
|
||||
const size_t j = size_t(completion.getJ());
|
||||
const size_t k = size_t(completion.getK());
|
||||
|
||||
const size_t i = size_t( completion.getI() );
|
||||
const size_t j = size_t( completion.getJ() );
|
||||
const size_t k = size_t( completion.getK() );
|
||||
|
||||
const size_t index = simulator_.vanguard().eclState().getInputGrid().getGlobalIndex( i, j, k );
|
||||
auto& completionData = wellData.completions[ count ];
|
||||
const size_t index = simulator_.vanguard().eclState().getInputGrid().getGlobalIndex(i, j, k);
|
||||
auto& completionData = wellData.completions[count];
|
||||
completionData.index = index;
|
||||
count++;
|
||||
}
|
||||
wellDatas.emplace( std::make_pair(well->name(),wellData) );
|
||||
wellDatas.emplace(std::make_pair(well->name(), wellData));
|
||||
}
|
||||
|
||||
Opm::data::Well& wellData = wellDatas.at(well->name());
|
||||
for (auto& completionData : wellData.completions) {
|
||||
for (auto& completionData: wellData.completions) {
|
||||
const auto index = completionData.index;
|
||||
if (oilCompletionPressures_.count(index) > 0)
|
||||
completionData.cell_pressure = oilCompletionPressures_.at(index);
|
||||
@ -705,79 +685,79 @@ public:
|
||||
*/
|
||||
void assignToSolution(Opm::data::Solution& sol)
|
||||
{
|
||||
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
|
||||
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag>>::value)
|
||||
return;
|
||||
|
||||
if ( oilPressure_.size() > 0 ) {
|
||||
sol.insert( "PRESSURE", Opm::UnitSystem::measure::pressure, std::move(oilPressure_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
if (oilPressure_.size() > 0) {
|
||||
sol.insert("PRESSURE", Opm::UnitSystem::measure::pressure, std::move(oilPressure_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
}
|
||||
|
||||
if ( temperature_.size() > 0 ) {
|
||||
sol.insert( "TEMP", Opm::UnitSystem::measure::temperature, std::move(temperature_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
if (temperature_.size() > 0) {
|
||||
sol.insert("TEMP", Opm::UnitSystem::measure::temperature, std::move(temperature_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
}
|
||||
|
||||
if( FluidSystem::phaseIsActive(waterPhaseIdx) && saturation_[waterPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "SWAT", Opm::UnitSystem::measure::identity, std::move(saturation_[waterPhaseIdx]), Opm::data::TargetType::RESTART_SOLUTION );
|
||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && saturation_[waterPhaseIdx].size() > 0) {
|
||||
sol.insert("SWAT", Opm::UnitSystem::measure::identity, std::move(saturation_[waterPhaseIdx]), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
}
|
||||
if( FluidSystem::phaseIsActive(gasPhaseIdx) && saturation_[gasPhaseIdx].size() > 0) {
|
||||
sol.insert( "SGAS", Opm::UnitSystem::measure::identity, std::move(saturation_[gasPhaseIdx]), Opm::data::TargetType::RESTART_SOLUTION );
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) && saturation_[gasPhaseIdx].size() > 0) {
|
||||
sol.insert("SGAS", Opm::UnitSystem::measure::identity, std::move(saturation_[gasPhaseIdx]), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
}
|
||||
|
||||
if ( gasDissolutionFactor_.size() > 0 ) {
|
||||
sol.insert( "RSSAT", Opm::UnitSystem::measure::gas_oil_ratio, std::move(gasDissolutionFactor_), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (gasDissolutionFactor_.size() > 0) {
|
||||
sol.insert("RSSAT", Opm::UnitSystem::measure::gas_oil_ratio, std::move(gasDissolutionFactor_), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
|
||||
}
|
||||
if ( oilVaporizationFactor_.size() > 0 ) {
|
||||
sol.insert( "RVSAT", Opm::UnitSystem::measure::oil_gas_ratio, std::move(oilVaporizationFactor_) , Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (oilVaporizationFactor_.size() > 0) {
|
||||
sol.insert("RVSAT", Opm::UnitSystem::measure::oil_gas_ratio, std::move(oilVaporizationFactor_), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if ( rs_.size() > 0 ) {
|
||||
sol.insert( "RS", Opm::UnitSystem::measure::gas_oil_ratio, std::move(rs_), Opm::data::TargetType::RESTART_SOLUTION );
|
||||
if (rs_.size() > 0) {
|
||||
sol.insert("RS", Opm::UnitSystem::measure::gas_oil_ratio, std::move(rs_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
|
||||
}
|
||||
if (rv_.size() > 0 ) {
|
||||
sol.insert( "RV", Opm::UnitSystem::measure::oil_gas_ratio, std::move(rv_) , Opm::data::TargetType::RESTART_SOLUTION );
|
||||
if (rv_.size() > 0) {
|
||||
sol.insert("RV", Opm::UnitSystem::measure::oil_gas_ratio, std::move(rv_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
}
|
||||
if (invB_[waterPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "1OVERBW", Opm::UnitSystem::measure::water_inverse_formation_volume_factor, std::move(invB_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (invB_[waterPhaseIdx].size() > 0) {
|
||||
sol.insert("1OVERBW", Opm::UnitSystem::measure::water_inverse_formation_volume_factor, std::move(invB_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (invB_[oilPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "1OVERBO", Opm::UnitSystem::measure::oil_inverse_formation_volume_factor, std::move(invB_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (invB_[oilPhaseIdx].size() > 0) {
|
||||
sol.insert("1OVERBO", Opm::UnitSystem::measure::oil_inverse_formation_volume_factor, std::move(invB_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (invB_[gasPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "1OVERBG", Opm::UnitSystem::measure::gas_inverse_formation_volume_factor, std::move(invB_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (invB_[gasPhaseIdx].size() > 0) {
|
||||
sol.insert("1OVERBG", Opm::UnitSystem::measure::gas_inverse_formation_volume_factor, std::move(invB_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
|
||||
if (density_[waterPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "WAT_DEN", Opm::UnitSystem::measure::density, std::move(density_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (density_[waterPhaseIdx].size() > 0) {
|
||||
sol.insert("WAT_DEN", Opm::UnitSystem::measure::density, std::move(density_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (density_[oilPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "OIL_DEN", Opm::UnitSystem::measure::density, std::move(density_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (density_[oilPhaseIdx].size() > 0) {
|
||||
sol.insert("OIL_DEN", Opm::UnitSystem::measure::density, std::move(density_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (density_[gasPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "GAS_DEN", Opm::UnitSystem::measure::density, std::move(density_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (density_[gasPhaseIdx].size() > 0) {
|
||||
sol.insert("GAS_DEN", Opm::UnitSystem::measure::density, std::move(density_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
|
||||
if (viscosity_[waterPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "WAT_VISC", Opm::UnitSystem::measure::viscosity, std::move(viscosity_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
if (viscosity_[waterPhaseIdx].size() > 0) {
|
||||
sol.insert("WAT_VISC", Opm::UnitSystem::measure::viscosity, std::move(viscosity_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (viscosity_[oilPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "OIL_VISC", Opm::UnitSystem::measure::viscosity, std::move(viscosity_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
if (viscosity_[oilPhaseIdx].size() > 0) {
|
||||
sol.insert("OIL_VISC", Opm::UnitSystem::measure::viscosity, std::move(viscosity_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (viscosity_[gasPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "GAS_VISC", Opm::UnitSystem::measure::viscosity, std::move(viscosity_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY );
|
||||
if (viscosity_[gasPhaseIdx].size() > 0) {
|
||||
sol.insert("GAS_VISC", Opm::UnitSystem::measure::viscosity, std::move(viscosity_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
|
||||
if (relativePermeability_[waterPhaseIdx].size() > 0) {
|
||||
sol.insert( "WATKR", Opm::UnitSystem::measure::identity, std::move(relativePermeability_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
sol.insert("WATKR", Opm::UnitSystem::measure::identity, std::move(relativePermeability_[waterPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (relativePermeability_[oilPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "OILKR", Opm::UnitSystem::measure::identity, std::move(relativePermeability_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
if (relativePermeability_[oilPhaseIdx].size() > 0) {
|
||||
sol.insert("OILKR", Opm::UnitSystem::measure::identity, std::move(relativePermeability_[oilPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
if (relativePermeability_[gasPhaseIdx].size() > 0 ) {
|
||||
sol.insert( "GASKR", Opm::UnitSystem::measure::identity, std::move(relativePermeability_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
if (relativePermeability_[gasPhaseIdx].size() > 0) {
|
||||
sol.insert("GASKR", Opm::UnitSystem::measure::identity, std::move(relativePermeability_[gasPhaseIdx]), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
}
|
||||
|
||||
if (pcSwMdcOw_.size() > 0 )
|
||||
if (pcSwMdcOw_.size() > 0)
|
||||
sol.insert ("PCSWM_OW", Opm::UnitSystem::measure::identity, std::move(pcSwMdcOw_), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
|
||||
if (krnSwMdcOw_.size() > 0)
|
||||
@ -809,22 +789,22 @@ public:
|
||||
if (outputFipRestart_ && fip_[i].size() > 0) {
|
||||
sol.insert(fipEnumToString_(i),
|
||||
Opm::UnitSystem::measure::volume,
|
||||
fip_[i] ,
|
||||
fip_[i],
|
||||
Opm::data::TargetType::SUMMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// write Fluid In Place to output log
|
||||
void outputFipLog(std::map<std::string, double>& miscSummaryData, std::map<std::string, std::vector<double>>& regionData, const bool substep) {
|
||||
|
||||
void outputFipLog(std::map<std::string, double>& miscSummaryData, std::map<std::string, std::vector<double>>& regionData, const bool substep)
|
||||
{
|
||||
const auto& comm = simulator_.gridView().comm();
|
||||
size_t ntFip = *std::max_element(fipnum_.begin(), fipnum_.end());
|
||||
ntFip = comm.max(ntFip);
|
||||
|
||||
// sum values over each region
|
||||
ScalarBuffer regionFipValues[FipDataType::numFipValues];
|
||||
for (int i = 0; i<FipDataType::numFipValues; i++) {
|
||||
for (int i = 0; i < FipDataType::numFipValues; i++) {
|
||||
regionFipValues[i] = computeFipForRegions_(fip_[i], fipnum_, ntFip);
|
||||
if (isIORank_() && origRegionValues_[i].empty())
|
||||
origRegionValues_[i] = regionFipValues[i];
|
||||
@ -832,7 +812,7 @@ public:
|
||||
|
||||
// sum all region values to compute the field total
|
||||
std::vector<int> fieldNum(ntFip, 1);
|
||||
ScalarBuffer fieldFipValues(FipDataType::numFipValues,0.0);
|
||||
ScalarBuffer fieldFipValues(FipDataType::numFipValues, 0.0);
|
||||
bool comunicateSum = false; // the regionValues are already summed over all ranks.
|
||||
for (int i = 0; i<FipDataType::numFipValues; i++) {
|
||||
const ScalarBuffer& tmp = computeFipForRegions_(regionFipValues[i], fieldNum, 1, comunicateSum);
|
||||
@ -853,7 +833,7 @@ public:
|
||||
// TODO: Store initial Fip in the init file and restore them
|
||||
// and use them here.
|
||||
const Opm::SummaryConfig summaryConfig = simulator_.vanguard().summaryConfig();
|
||||
if ( isIORank_()) {
|
||||
if (isIORank_()) {
|
||||
// Field summary output
|
||||
for (int i = 0; i<FipDataType::numFipValues; i++) {
|
||||
std::string key = "F" + fipEnumToString_(i);
|
||||
@ -891,13 +871,13 @@ public:
|
||||
Scalar fieldHydroCarbonPoreVolumeAveragedPressure = pressureAverage_(fieldPressurePvHydrocarbon[0], fieldPvHydrocarbon[0], fieldPressurePv[0], fieldFipValues[FipDataType::PoreVolume], true);
|
||||
pressureUnitConvert_(fieldHydroCarbonPoreVolumeAveragedPressure);
|
||||
outputRegionFluidInPlace_(origTotalValues_, fieldFipValues, fieldHydroCarbonPoreVolumeAveragedPressure, 0);
|
||||
for (size_t reg = 0; reg < ntFip; ++reg ) {
|
||||
ScalarBuffer tmpO(FipDataType::numFipValues,0.0);
|
||||
for (size_t reg = 0; reg < ntFip; ++reg) {
|
||||
ScalarBuffer tmpO(FipDataType::numFipValues, 0.0);
|
||||
for (int i = 0; i<FipDataType::numFipValues; i++) {
|
||||
tmpO[i] = origRegionValues_[i][reg];
|
||||
}
|
||||
fipUnitConvert_(tmpO);
|
||||
ScalarBuffer tmp(FipDataType::numFipValues,0.0);
|
||||
ScalarBuffer tmp(FipDataType::numFipValues, 0.0);
|
||||
for (int i = 0; i<FipDataType::numFipValues; i++) {
|
||||
tmp[i] = regionFipValues[i][reg];
|
||||
}
|
||||
@ -914,12 +894,11 @@ public:
|
||||
void setRestart(const Opm::data::Solution& sol, unsigned elemIdx, unsigned globalDofIndex)
|
||||
{
|
||||
Scalar so = 1.0;
|
||||
if( saturation_[waterPhaseIdx].size() > 0 && sol.has( "SWAT" ) ) {
|
||||
if (saturation_[waterPhaseIdx].size() > 0 && sol.has("SWAT")) {
|
||||
saturation_[waterPhaseIdx][elemIdx] = sol.data("SWAT")[globalDofIndex];
|
||||
so -= sol.data("SWAT")[globalDofIndex];
|
||||
}
|
||||
|
||||
if( saturation_[gasPhaseIdx].size() > 0 && sol.has( "SGAS" ) ) {
|
||||
if (saturation_[gasPhaseIdx].size() > 0 && sol.has("SGAS")) {
|
||||
saturation_[gasPhaseIdx][elemIdx] = sol.data("SGAS")[globalDofIndex];
|
||||
so -= sol.data("SGAS")[globalDofIndex];
|
||||
}
|
||||
@ -927,56 +906,33 @@ public:
|
||||
assert(saturation_[oilPhaseIdx].size() > 0);
|
||||
saturation_[oilPhaseIdx][elemIdx] = so;
|
||||
|
||||
if( oilPressure_.size() > 0 && sol.has( "PRESSURE" ) ) {
|
||||
oilPressure_[elemIdx] = sol.data( "PRESSURE" )[globalDofIndex];
|
||||
}
|
||||
|
||||
if( temperature_.size() > 0 && sol.has( "TEMP" ) ) {
|
||||
temperature_[elemIdx] = sol.data( "TEMP" )[globalDofIndex];
|
||||
}
|
||||
|
||||
if( rs_.size() > 0 && sol.has( "RS" ) ) {
|
||||
if (oilPressure_.size() > 0 && sol.has("PRESSURE"))
|
||||
oilPressure_[elemIdx] = sol.data("PRESSURE")[globalDofIndex];
|
||||
if (temperature_.size() > 0 && sol.has("TEMP"))
|
||||
temperature_[elemIdx] = sol.data("TEMP")[globalDofIndex];
|
||||
if (rs_.size() > 0 && sol.has("RS"))
|
||||
rs_[elemIdx] = sol.data("RS")[globalDofIndex];
|
||||
}
|
||||
|
||||
if( rv_.size() > 0 && sol.has( "RV" ) ) {
|
||||
if (rv_.size() > 0 && sol.has("RV"))
|
||||
rv_[elemIdx] = sol.data("RV")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sSol_.size() > 0 && sol.has( "SSOL" ) ) {
|
||||
if (sSol_.size() > 0 && sol.has("SSOL"))
|
||||
sSol_[elemIdx] = sol.data("SSOL")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( cPolymer_.size() > 0 && sol.has("POLYMER" ) ) {
|
||||
if (cPolymer_.size() > 0 && sol.has("POLYMER"))
|
||||
cPolymer_[elemIdx] = sol.data("POLYMER")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( soMax_.size() > 0 && sol.has("SOMAX" ) ) {
|
||||
if (soMax_.size() > 0 && sol.has("SOMAX"))
|
||||
soMax_[elemIdx] = sol.data("SOMAX")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( pcSwMdcOw_.size() > 0 &&sol.has("PCSWM_OW" ) ) {
|
||||
if (pcSwMdcOw_.size() > 0 &&sol.has("PCSWM_OW"))
|
||||
pcSwMdcOw_[elemIdx] = sol.data("PCSWM_OW")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( krnSwMdcOw_.size() > 0 && sol.has("KRNSW_OW" ) ) {
|
||||
if (krnSwMdcOw_.size() > 0 && sol.has("KRNSW_OW"))
|
||||
krnSwMdcOw_[elemIdx] = sol.data("KRNSW_OW")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( pcSwMdcGo_.size() > 0 && sol.has("PCSWM_GO" ) ) {
|
||||
if (pcSwMdcGo_.size() > 0 && sol.has("PCSWM_GO"))
|
||||
pcSwMdcGo_[elemIdx] = sol.data("PCSWM_GO")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( krnSwMdcGo_.size() > 0 && sol.has("KRNSW_GO" ) ) {
|
||||
if (krnSwMdcGo_.size() > 0 && sol.has("KRNSW_GO"))
|
||||
krnSwMdcGo_[elemIdx] = sol.data("KRNSW_GO")[globalDofIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class FluidState>
|
||||
void assignToFluidState(FluidState& fs, unsigned elemIdx) const
|
||||
void assignToFluidState(FluidState& fs, unsigned elemIdx) const
|
||||
{
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||
if (saturation_[phaseIdx].size() == 0)
|
||||
continue;
|
||||
@ -985,10 +941,9 @@ public:
|
||||
}
|
||||
|
||||
if (oilPressure_.size() > 0) {
|
||||
|
||||
// this assumes that capillary pressures only depend on the phase saturations
|
||||
// and possibly on temperature. (this is always the case for ECL problems.)
|
||||
Dune::FieldVector< Scalar, numPhases > pc( 0 );
|
||||
Dune::FieldVector< Scalar, numPhases > pc(0);
|
||||
const MaterialLawParams& matParams = simulator_.problem().materialLawParams(elemIdx);
|
||||
MaterialLaw::capillaryPressures(pc, matParams, fs);
|
||||
Opm::Valgrind::CheckDefined(oilPressure_[elemIdx]);
|
||||
@ -1002,17 +957,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
if (temperature_.size() > 0) {
|
||||
fs.setTemperature( temperature_[elemIdx]);
|
||||
}
|
||||
|
||||
if (rs_.size() > 0) {
|
||||
if (temperature_.size() > 0)
|
||||
fs.setTemperature(temperature_[elemIdx]);
|
||||
if (rs_.size() > 0)
|
||||
fs.setRs(rs_[elemIdx]);
|
||||
|
||||
}
|
||||
if (rv_.size() > 0) {
|
||||
if (rv_.size() > 0)
|
||||
fs.setRv(rv_[elemIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
void initHysteresisParams(Simulator& simulator, unsigned elemIdx) const {
|
||||
@ -1040,14 +990,14 @@ public:
|
||||
}
|
||||
|
||||
Scalar getSolventSaturation(unsigned elemIdx) const {
|
||||
if(sSol_.size() > 0)
|
||||
if (sSol_.size() > 0)
|
||||
return sSol_[elemIdx];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Scalar getPolymerConcentration(unsigned elemIdx) const {
|
||||
if(cPolymer_.size() > 0)
|
||||
if (cPolymer_.size() > 0)
|
||||
return cPolymer_[elemIdx];
|
||||
|
||||
return 0;
|
||||
@ -1087,7 +1037,7 @@ private:
|
||||
|
||||
if (pressureTimesHydrocarbonVolume_.size() > 0 && pressureTimesPoreVolume_.size() > 0) {
|
||||
assert(hydrocarbonPoreVolume_.size() == pressureTimesHydrocarbonVolume_.size());
|
||||
assert(fip_[FipDataType::PoreVolume].size() == pressureTimesPoreVolume_.size() );
|
||||
assert(fip_[FipDataType::PoreVolume].size() == pressureTimesPoreVolume_.size());
|
||||
|
||||
fip_[FipDataType::PoreVolume][globalDofIdx] = pv;
|
||||
|
||||
@ -1107,14 +1057,15 @@ private:
|
||||
|
||||
if (computeFip_) {
|
||||
Scalar fip[FluidSystem::numPhases];
|
||||
for (unsigned phase = 0; phase < FluidSystem::numPhases; ++phase) {
|
||||
if (!FluidSystem::phaseIsActive(phase)) {
|
||||
continue;
|
||||
}
|
||||
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
|
||||
fip[phaseIdx] = 0.0;
|
||||
|
||||
const double b = Opm::getValue(fs.invB(phase));
|
||||
const double s = Opm::getValue(fs.saturation(phase));
|
||||
fip[phase] = b * s * pv;
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx))
|
||||
continue;
|
||||
|
||||
const double b = Opm::getValue(fs.invB(phaseIdx));
|
||||
const double s = Opm::getValue(fs.saturation(phaseIdx));
|
||||
fip[phaseIdx] = b * s * pv;
|
||||
}
|
||||
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx) && fip_[FipDataType::OilInPlace].size() > 0)
|
||||
@ -1152,12 +1103,12 @@ private:
|
||||
|
||||
void createLocalFipnum_()
|
||||
{
|
||||
const std::vector<int>& fipnum_global = simulator_.vanguard().eclState().get3DProperties().getIntGridProperty("FIPNUM").getData();
|
||||
const std::vector<int>& fipnumGlobal = simulator_.vanguard().eclState().get3DProperties().getIntGridProperty("FIPNUM").getData();
|
||||
// Get compressed cell fipnum.
|
||||
const auto& gridView = simulator_.vanguard().gridView();
|
||||
unsigned numElements = gridView.size(/*codim=*/0);
|
||||
fipnum_.resize(numElements, 0.0);
|
||||
if (!fipnum_global.empty()) {
|
||||
if (!fipnumGlobal.empty()) {
|
||||
ElementContext elemCtx(simulator_);
|
||||
ElementIterator elemIt = gridView.template begin</*codim=*/0>();
|
||||
const ElementIterator& elemEndIt = gridView.template end</*codim=*/0>();
|
||||
@ -1168,7 +1119,7 @@ private:
|
||||
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
const unsigned elemIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0);
|
||||
fipnum_[elemIdx] = fipnum_global[simulator_.vanguard().cartesianIndex( elemIdx )];
|
||||
fipnum_[elemIdx] = fipnumGlobal[simulator_.vanguard().cartesianIndex(elemIdx)];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1200,20 +1151,22 @@ private:
|
||||
return totals;
|
||||
}
|
||||
|
||||
ScalarBuffer pressureAverage_(const ScalarBuffer& pressurePvHydrocarbon, const ScalarBuffer& pvHydrocarbon, const ScalarBuffer& pressurePv, const ScalarBuffer& pv, bool hydrocarbon) {
|
||||
ScalarBuffer pressureAverage_(const ScalarBuffer& pressurePvHydrocarbon, const ScalarBuffer& pvHydrocarbon, const ScalarBuffer& pressurePv, const ScalarBuffer& pv, bool hydrocarbon)
|
||||
{
|
||||
size_t size = pressurePvHydrocarbon.size();
|
||||
assert(pvHydrocarbon.size() == size);
|
||||
assert(pressurePv.size() == size);
|
||||
assert(pv.size() == size);
|
||||
|
||||
ScalarBuffer fraction(size,0.0);
|
||||
ScalarBuffer fraction(size, 0.0);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
fraction[i] = pressureAverage_(pressurePvHydrocarbon[i], pvHydrocarbon[i], pressurePv[i], pv[i], hydrocarbon);
|
||||
}
|
||||
return fraction;
|
||||
}
|
||||
|
||||
Scalar pressureAverage_(const Scalar& pressurePvHydrocarbon, const Scalar& pvHydrocarbon, const Scalar& pressurePv, const Scalar& pv, bool hydrocarbon) {
|
||||
Scalar pressureAverage_(const Scalar& pressurePvHydrocarbon, const Scalar& pvHydrocarbon, const Scalar& pressurePv, const Scalar& pv, bool hydrocarbon)
|
||||
{
|
||||
if (pvHydrocarbon > 1e-10 && hydrocarbon)
|
||||
return pressurePvHydrocarbon / pvHydrocarbon;
|
||||
|
||||
@ -1241,11 +1194,13 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void pressureUnitConvert_(Scalar& pav) {
|
||||
void pressureUnitConvert_(Scalar& pav)
|
||||
{
|
||||
const Opm::UnitSystem& units = simulator_.vanguard().eclState().getUnits();
|
||||
if (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_FIELD) {
|
||||
pav = Opm::unit::convert::to(pav, Opm::unit::psia);
|
||||
} else if (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC) {
|
||||
}
|
||||
else if (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC) {
|
||||
pav = Opm::unit::convert::to(pav, Opm::unit::barsa);
|
||||
}
|
||||
else {
|
||||
@ -1260,7 +1215,8 @@ private:
|
||||
if (!reg) {
|
||||
ss << " ===================================================\n"
|
||||
<< " : Field Totals :\n";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ss << " ===================================================\n"
|
||||
<< " : FIPNUM report region "
|
||||
<< std::setw(2) << reg << " :\n";
|
||||
@ -1296,9 +1252,10 @@ private:
|
||||
Opm::OpmLog::note(ss.str());
|
||||
}
|
||||
|
||||
std::string fipEnumToString_(int i) {
|
||||
std::string fipEnumToString_(int i)
|
||||
{
|
||||
typedef typename FipDataType::FipId FipId;
|
||||
switch( static_cast<FipId>(i) )
|
||||
switch(static_cast<FipId>(i))
|
||||
{
|
||||
case FipDataType::WaterInPlace: return "WIP";
|
||||
case FipDataType::OilInPlace: return "OIP";
|
||||
|
Loading…
Reference in New Issue
Block a user