mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -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;
|
typedef std::vector<Scalar> ScalarBuffer;
|
||||||
|
|
||||||
struct FipDataType {
|
struct FipDataType
|
||||||
|
{
|
||||||
enum FipId {
|
enum FipId
|
||||||
|
{
|
||||||
WaterInPlace = 0, //WIP
|
WaterInPlace = 0, //WIP
|
||||||
OilInPlace = 1, //OIP
|
OilInPlace = 1, //OIP
|
||||||
GasInPlace = 2, //GIP
|
GasInPlace = 2, //GIP
|
||||||
@ -136,7 +137,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void allocBuffers(unsigned bufferSize, unsigned reportStepNum, const bool substep, const bool log)
|
void allocBuffers(unsigned bufferSize, unsigned reportStepNum, const bool substep, const bool log)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
|
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -162,16 +162,17 @@ public:
|
|||||||
}
|
}
|
||||||
fip_[i].resize(bufferSize, 0.0);
|
fip_[i].resize(bufferSize, 0.0);
|
||||||
computeFip_ = true;
|
computeFip_ = true;
|
||||||
} else {
|
|
||||||
fip_[i].clear();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
fip_[i].clear();
|
||||||
}
|
}
|
||||||
if (!substep || summaryConfig.hasKeyword("FPR") || summaryConfig.hasKeyword("FPRP") || summaryConfig.hasKeyword("RPR")) {
|
if (!substep || summaryConfig.hasKeyword("FPR") || summaryConfig.hasKeyword("FPRP") || summaryConfig.hasKeyword("RPR")) {
|
||||||
fip_[FipDataType::PoreVolume].resize(bufferSize, 0.0);
|
fip_[FipDataType::PoreVolume].resize(bufferSize, 0.0);
|
||||||
hydrocarbonPoreVolume_.resize(bufferSize, 0.0);
|
hydrocarbonPoreVolume_.resize(bufferSize, 0.0);
|
||||||
pressureTimesPoreVolume_.resize(bufferSize, 0.0);
|
pressureTimesPoreVolume_.resize(bufferSize, 0.0);
|
||||||
pressureTimesHydrocarbonVolume_.resize(bufferSize, 0.0);
|
pressureTimesHydrocarbonVolume_.resize(bufferSize, 0.0);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hydrocarbonPoreVolume_.clear();
|
hydrocarbonPoreVolume_.clear();
|
||||||
pressureTimesPoreVolume_.clear();
|
pressureTimesPoreVolume_.clear();
|
||||||
pressureTimesHydrocarbonVolume_.clear();
|
pressureTimesHydrocarbonVolume_.clear();
|
||||||
@ -182,8 +183,8 @@ public:
|
|||||||
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
|
// don't bother with wells not on this process
|
||||||
const auto& defunct_well_names = simulator_.vanguard().defunctWellNames();
|
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
|
||||||
if ( defunct_well_names.find(well->name()) != defunct_well_names.end() ) {
|
if (defunctWellNames.find(well->name()) != defunctWellNames.end()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,23 +218,17 @@ public:
|
|||||||
}
|
}
|
||||||
// and oil pressure
|
// and oil pressure
|
||||||
oilPressure_.resize(bufferSize, 0.0);
|
oilPressure_.resize(bufferSize, 0.0);
|
||||||
|
|
||||||
if (true) // adding some logic here when the energy module is done
|
|
||||||
temperature_.resize(bufferSize, 0.0);
|
temperature_.resize(bufferSize, 0.0);
|
||||||
|
|
||||||
if (FluidSystem::enableDissolvedGas()) {
|
if (FluidSystem::enableDissolvedGas())
|
||||||
rs_.resize(bufferSize, 0.0);
|
rs_.resize(bufferSize, 0.0);
|
||||||
}
|
if (FluidSystem::enableVaporizedOil())
|
||||||
if (FluidSystem::enableVaporizedOil()) {
|
|
||||||
rv_.resize(bufferSize, 0.0);
|
rv_.resize(bufferSize, 0.0);
|
||||||
}
|
|
||||||
|
|
||||||
if (GET_PROP_VALUE(TypeTag, EnableSolvent)) {
|
if (GET_PROP_VALUE(TypeTag, EnableSolvent))
|
||||||
sSol_.resize(bufferSize, 0.0);
|
sSol_.resize(bufferSize, 0.0);
|
||||||
}
|
if (GET_PROP_VALUE(TypeTag, EnablePolymer))
|
||||||
if (GET_PROP_VALUE(TypeTag, EnablePolymer)) {
|
|
||||||
cPolymer_.resize(bufferSize, 0.0);
|
cPolymer_.resize(bufferSize, 0.0);
|
||||||
}
|
|
||||||
|
|
||||||
if (simulator_.problem().vapparsActive())
|
if (simulator_.problem().vapparsActive())
|
||||||
soMax_.resize(bufferSize, 0.0);
|
soMax_.resize(bufferSize, 0.0);
|
||||||
@ -254,18 +249,15 @@ public:
|
|||||||
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;
|
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;
|
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;
|
rstKeywords["BG"] = 0;
|
||||||
invB_[gasPhaseIdx].resize(bufferSize, 0.0);
|
invB_[gasPhaseIdx].resize(bufferSize, 0.0);
|
||||||
}
|
}
|
||||||
@ -283,34 +275,28 @@ public:
|
|||||||
const bool hasVGAS = (rstKeywords["VISC"] > 0) || (rstKeywords["VGAS"] > 0);
|
const bool hasVGAS = (rstKeywords["VISC"] > 0) || (rstKeywords["VGAS"] > 0);
|
||||||
rstKeywords["VISC"] = 0;
|
rstKeywords["VISC"] = 0;
|
||||||
|
|
||||||
if (FluidSystem::phaseIsActive(waterPhaseIdx) && hasVWAT)
|
if (FluidSystem::phaseIsActive(waterPhaseIdx) && hasVWAT) {
|
||||||
{
|
|
||||||
rstKeywords["VWAT"] = 0;
|
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;
|
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;
|
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;
|
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;
|
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;
|
rstKeywords["KRG"] = 0;
|
||||||
relativePermeability_[gasPhaseIdx].resize(bufferSize, 0.0);
|
relativePermeability_[gasPhaseIdx].resize(bufferSize, 0.0);
|
||||||
}
|
}
|
||||||
@ -349,7 +335,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void processElement(const ElementContext& elemCtx)
|
void processElement(const ElementContext& elemCtx)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
|
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -461,24 +446,22 @@ public:
|
|||||||
cPolymer_[globalDofIdx] = intQuants.polymerConcentration().value();
|
cPolymer_[globalDofIdx] = intQuants.polymerConcentration().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bubblePointPressure_.size() > 0)
|
if (bubblePointPressure_.size() > 0) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
bubblePointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::bubblePointPressure(fs, intQuants.pvtRegionIndex()));
|
bubblePointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::bubblePointPressure(fs, intQuants.pvtRegionIndex()));
|
||||||
}
|
}
|
||||||
catch (const Opm::NumericalIssue&) {
|
catch (const Opm::NumericalIssue&) {
|
||||||
const auto globalIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
const auto cartesianIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||||
failedCellsPb_.push_back(globalIdx);
|
failedCellsPb_.push_back(cartesianIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dewPointPressure_.size() > 0)
|
if (dewPointPressure_.size() > 0) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
dewPointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::dewPointPressure(fs, intQuants.pvtRegionIndex()));
|
dewPointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::dewPointPressure(fs, intQuants.pvtRegionIndex()));
|
||||||
}
|
}
|
||||||
catch (const Opm::NumericalIssue&) {
|
catch (const Opm::NumericalIssue&) {
|
||||||
const auto globalIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
const auto cartesianIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||||
failedCellsPd_.push_back(globalIdx);
|
failedCellsPd_.push_back(cartesianIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,39 +492,39 @@ public:
|
|||||||
// This can be removed when ebos has 100% controll over output
|
// 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
|
// use initial rs and rv values
|
||||||
if (rv_.size() > 0)
|
if (rv_.size() > 0)
|
||||||
rv_[globalDofIdx] = fs_initial.Rv();
|
rv_[globalDofIdx] = fsInitial.Rv();
|
||||||
|
|
||||||
if (rs_.size() > 0)
|
if (rs_.size() > 0)
|
||||||
rs_[globalDofIdx] = fs_initial.Rs();
|
rs_[globalDofIdx] = fsInitial.Rs();
|
||||||
|
|
||||||
// re-compute the volume factors, viscosities and densities if asked for
|
// re-compute the volume factors, viscosities and densities if asked for
|
||||||
if (density_[oilPhaseIdx].size() > 0)
|
if (density_[oilPhaseIdx].size() > 0)
|
||||||
density_[oilPhaseIdx][globalDofIdx] = FluidSystem::density(fs_initial,
|
density_[oilPhaseIdx][globalDofIdx] = FluidSystem::density(fsInitial,
|
||||||
oilPhaseIdx,
|
oilPhaseIdx,
|
||||||
intQuants.pvtRegionIndex());
|
intQuants.pvtRegionIndex());
|
||||||
if (density_[gasPhaseIdx].size() > 0)
|
if (density_[gasPhaseIdx].size() > 0)
|
||||||
density_[gasPhaseIdx][globalDofIdx] = FluidSystem::density(fs_initial,
|
density_[gasPhaseIdx][globalDofIdx] = FluidSystem::density(fsInitial,
|
||||||
gasPhaseIdx,
|
gasPhaseIdx,
|
||||||
intQuants.pvtRegionIndex());
|
intQuants.pvtRegionIndex());
|
||||||
|
|
||||||
if (invB_[oilPhaseIdx].size() > 0)
|
if (invB_[oilPhaseIdx].size() > 0)
|
||||||
invB_[oilPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fs_initial,
|
invB_[oilPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fsInitial,
|
||||||
oilPhaseIdx,
|
oilPhaseIdx,
|
||||||
intQuants.pvtRegionIndex());
|
intQuants.pvtRegionIndex());
|
||||||
if (invB_[gasPhaseIdx].size() > 0)
|
if (invB_[gasPhaseIdx].size() > 0)
|
||||||
invB_[gasPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fs_initial,
|
invB_[gasPhaseIdx][globalDofIdx] = FluidSystem::inverseFormationVolumeFactor(fsInitial,
|
||||||
gasPhaseIdx,
|
gasPhaseIdx,
|
||||||
intQuants.pvtRegionIndex());
|
intQuants.pvtRegionIndex());
|
||||||
if (viscosity_[oilPhaseIdx].size() > 0)
|
if (viscosity_[oilPhaseIdx].size() > 0)
|
||||||
viscosity_[oilPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fs_initial,
|
viscosity_[oilPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fsInitial,
|
||||||
oilPhaseIdx,
|
oilPhaseIdx,
|
||||||
intQuants.pvtRegionIndex());
|
intQuants.pvtRegionIndex());
|
||||||
if (viscosity_[gasPhaseIdx].size() > 0)
|
if (viscosity_[gasPhaseIdx].size() > 0)
|
||||||
viscosity_[gasPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fs_initial,
|
viscosity_[gasPhaseIdx][globalDofIdx] = FluidSystem::viscosity(fsInitial,
|
||||||
gasPhaseIdx,
|
gasPhaseIdx,
|
||||||
intQuants.pvtRegionIndex());
|
intQuants.pvtRegionIndex());
|
||||||
}
|
}
|
||||||
@ -550,18 +533,18 @@ public:
|
|||||||
updateFluidInPlace_(elemCtx, dofIdx);
|
updateFluidInPlace_(elemCtx, dofIdx);
|
||||||
|
|
||||||
// Adding block data
|
// Adding block data
|
||||||
const auto globalIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
const auto cartesianIdx = elemCtx.simulator().vanguard().grid().globalCell()[globalDofIdx];
|
||||||
for (auto& val: blockData_) {
|
for (auto& val: blockData_) {
|
||||||
const auto& key = val.first;
|
const auto& key = val.first;
|
||||||
int global_index = key.second - 1;
|
int cartesianIdxBlock = key.second - 1;
|
||||||
if (global_index == globalIdx) {
|
if (cartesianIdx == cartesianIdxBlock) {
|
||||||
if (key.first == "BWSAT") {
|
if (key.first == "BWSAT")
|
||||||
val.second = Opm::getValue(fs.saturation(waterPhaseIdx));
|
val.second = Opm::getValue(fs.saturation(waterPhaseIdx));
|
||||||
} else if (key.first == "BGSAT") {
|
else if (key.first == "BGSAT")
|
||||||
val.second = Opm::getValue(fs.saturation(gasPhaseIdx));
|
val.second = Opm::getValue(fs.saturation(gasPhaseIdx));
|
||||||
} else if (key.first == "BPR") {
|
else if (key.first == "BPR")
|
||||||
val.second = Opm::getValue(fs.pressure(oilPhaseIdx));
|
val.second = Opm::getValue(fs.pressure(oilPhaseIdx));
|
||||||
} else {
|
else {
|
||||||
std::string logstring = "Keyword '";
|
std::string logstring = "Keyword '";
|
||||||
logstring.append(key.first);
|
logstring.append(key.first);
|
||||||
logstring.append("' is unhandled for output to file.");
|
logstring.append("' is unhandled for output to file.");
|
||||||
@ -571,14 +554,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adding Well RFT data
|
// Adding Well RFT data
|
||||||
if (oilCompletionPressures_.count(globalIdx) > 0) {
|
if (oilCompletionPressures_.count(cartesianIdx) > 0) {
|
||||||
oilCompletionPressures_[globalIdx] = Opm::getValue(fs.pressure(oilPhaseIdx));
|
oilCompletionPressures_[cartesianIdx] = Opm::getValue(fs.pressure(oilPhaseIdx));
|
||||||
}
|
}
|
||||||
if (waterCompletionSaturations_.count(globalIdx) > 0) {
|
if (waterCompletionSaturations_.count(cartesianIdx) > 0) {
|
||||||
waterCompletionSaturations_[globalIdx] = Opm::getValue(fs.saturation(waterPhaseIdx));
|
waterCompletionSaturations_[cartesianIdx] = Opm::getValue(fs.saturation(waterPhaseIdx));
|
||||||
}
|
}
|
||||||
if (gasCompletionSaturations_.count(globalIdx) > 0) {
|
if (gasCompletionSaturations_.count(cartesianIdx) > 0) {
|
||||||
gasCompletionSaturations_[globalIdx] = Opm::getValue(fs.saturation(gasPhaseIdx));
|
gasCompletionSaturations_[cartesianIdx] = Opm::getValue(fs.saturation(gasPhaseIdx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,12 +571,11 @@ public:
|
|||||||
{
|
{
|
||||||
const size_t maxNumCellsFaillog = 20;
|
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;
|
std::vector<int> displPb, displPd, recvLenPb, recvLenPd;
|
||||||
const auto& comm = simulator_.gridView().comm();
|
const auto& comm = simulator_.gridView().comm();
|
||||||
|
|
||||||
if ( isIORank_() )
|
if (isIORank_()) {
|
||||||
{
|
|
||||||
displPb.resize(comm.size()+1, 0);
|
displPb.resize(comm.size()+1, 0);
|
||||||
displPd.resize(comm.size()+1, 0);
|
displPd.resize(comm.size()+1, 0);
|
||||||
recvLenPb.resize(comm.size());
|
recvLenPb.resize(comm.size());
|
||||||
@ -601,13 +583,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
comm.gather(&pbSize, recvLenPb.data(), 1, 0);
|
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(recvLenPb.begin(), recvLenPb.end(), displPb.begin()+1);
|
||||||
std::partial_sum(recvLenPd.begin(), recvLenPd.end(), displPd.begin()+1);
|
std::partial_sum(recvLenPd.begin(), recvLenPd.end(), displPd.begin()+1);
|
||||||
std::vector<int> globalFailedCellsPb, globalFailedCellsPd;
|
std::vector<int> globalFailedCellsPb, globalFailedCellsPd;
|
||||||
|
|
||||||
if ( isIORank_() )
|
if (isIORank_()) {
|
||||||
{
|
|
||||||
globalFailedCellsPb.resize(displPb.back());
|
globalFailedCellsPb.resize(displPb.back());
|
||||||
globalFailedCellsPd.resize(displPd.back());
|
globalFailedCellsPd.resize(displPd.back());
|
||||||
}
|
}
|
||||||
@ -625,8 +606,8 @@ public:
|
|||||||
std::stringstream errlog;
|
std::stringstream errlog;
|
||||||
errlog << "Finding the bubble point pressure failed for " << globalFailedCellsPb.size() << " cells [";
|
errlog << "Finding the bubble point pressure failed for " << globalFailedCellsPb.size() << " cells [";
|
||||||
errlog << globalFailedCellsPb[0];
|
errlog << globalFailedCellsPb[0];
|
||||||
const size_t max_elems = std::min(maxNumCellsFaillog, globalFailedCellsPb.size());
|
const size_t maxElems = std::min(maxNumCellsFaillog, globalFailedCellsPb.size());
|
||||||
for (size_t i = 1; i < max_elems; ++i) {
|
for (size_t i = 1; i < maxElems; ++i) {
|
||||||
errlog << ", " << globalFailedCellsPb[i];
|
errlog << ", " << globalFailedCellsPb[i];
|
||||||
}
|
}
|
||||||
if (globalFailedCellsPb.size() > maxNumCellsFaillog) {
|
if (globalFailedCellsPb.size() > maxNumCellsFaillog) {
|
||||||
@ -639,8 +620,8 @@ public:
|
|||||||
std::stringstream errlog;
|
std::stringstream errlog;
|
||||||
errlog << "Finding the dew point pressure failed for " << globalFailedCellsPd.size() << " cells [";
|
errlog << "Finding the dew point pressure failed for " << globalFailedCellsPd.size() << " cells [";
|
||||||
errlog << globalFailedCellsPd[0];
|
errlog << globalFailedCellsPd[0];
|
||||||
const size_t max_elems = std::min(maxNumCellsFaillog, globalFailedCellsPd.size());
|
const size_t maxElems = std::min(maxNumCellsFaillog, globalFailedCellsPd.size());
|
||||||
for (size_t i = 1; i < max_elems; ++i) {
|
for (size_t i = 1; i < maxElems; ++i) {
|
||||||
errlog << ", " << globalFailedCellsPd[i];
|
errlog << ", " << globalFailedCellsPd[i];
|
||||||
}
|
}
|
||||||
if (globalFailedCellsPd.size() > maxNumCellsFaillog) {
|
if (globalFailedCellsPd.size() > maxNumCellsFaillog) {
|
||||||
@ -656,8 +637,8 @@ public:
|
|||||||
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
|
// don't bother with wells not on this process
|
||||||
const auto& defunct_well_names = simulator_.vanguard().defunctWellNames();
|
const auto& defunctWellNames = simulator_.vanguard().defunctWellNames();
|
||||||
if ( defunct_well_names.find(well->name()) != defunct_well_names.end() ) {
|
if (defunctWellNames.find(well->name()) != defunctWellNames.end()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +652,6 @@ public:
|
|||||||
wellData.completions.resize(well->getCompletions(reportStepNum).size());
|
wellData.completions.resize(well->getCompletions(reportStepNum).size());
|
||||||
size_t count = 0;
|
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 i = size_t(completion.getI());
|
||||||
const size_t j = size_t(completion.getJ());
|
const size_t j = size_t(completion.getJ());
|
||||||
const size_t k = size_t(completion.getK());
|
const size_t k = size_t(completion.getK());
|
||||||
@ -816,8 +796,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write Fluid In Place to output log
|
// 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();
|
const auto& comm = simulator_.gridView().comm();
|
||||||
size_t ntFip = *std::max_element(fipnum_.begin(), fipnum_.end());
|
size_t ntFip = *std::max_element(fipnum_.begin(), fipnum_.end());
|
||||||
ntFip = comm.max(ntFip);
|
ntFip = comm.max(ntFip);
|
||||||
@ -918,7 +898,6 @@ public:
|
|||||||
saturation_[waterPhaseIdx][elemIdx] = sol.data("SWAT")[globalDofIndex];
|
saturation_[waterPhaseIdx][elemIdx] = sol.data("SWAT")[globalDofIndex];
|
||||||
so -= 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];
|
saturation_[gasPhaseIdx][elemIdx] = sol.data("SGAS")[globalDofIndex];
|
||||||
so -= sol.data("SGAS")[globalDofIndex];
|
so -= sol.data("SGAS")[globalDofIndex];
|
||||||
@ -927,56 +906,33 @@ public:
|
|||||||
assert(saturation_[oilPhaseIdx].size() > 0);
|
assert(saturation_[oilPhaseIdx].size() > 0);
|
||||||
saturation_[oilPhaseIdx][elemIdx] = so;
|
saturation_[oilPhaseIdx][elemIdx] = so;
|
||||||
|
|
||||||
if( oilPressure_.size() > 0 && sol.has( "PRESSURE" ) ) {
|
if (oilPressure_.size() > 0 && sol.has("PRESSURE"))
|
||||||
oilPressure_[elemIdx] = sol.data("PRESSURE")[globalDofIndex];
|
oilPressure_[elemIdx] = sol.data("PRESSURE")[globalDofIndex];
|
||||||
}
|
if (temperature_.size() > 0 && sol.has("TEMP"))
|
||||||
|
|
||||||
if( temperature_.size() > 0 && sol.has( "TEMP" ) ) {
|
|
||||||
temperature_[elemIdx] = sol.data("TEMP")[globalDofIndex];
|
temperature_[elemIdx] = sol.data("TEMP")[globalDofIndex];
|
||||||
}
|
if (rs_.size() > 0 && sol.has("RS"))
|
||||||
|
|
||||||
if( rs_.size() > 0 && sol.has( "RS" ) ) {
|
|
||||||
rs_[elemIdx] = sol.data("RS")[globalDofIndex];
|
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];
|
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];
|
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];
|
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];
|
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];
|
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];
|
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];
|
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];
|
krnSwMdcGo_[elemIdx] = sol.data("KRNSW_GO")[globalDofIndex];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class FluidState>
|
template <class FluidState>
|
||||||
void assignToFluidState(FluidState& fs, unsigned elemIdx) const
|
void assignToFluidState(FluidState& fs, unsigned elemIdx) const
|
||||||
{
|
{
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||||
if (saturation_[phaseIdx].size() == 0)
|
if (saturation_[phaseIdx].size() == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -985,7 +941,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (oilPressure_.size() > 0) {
|
if (oilPressure_.size() > 0) {
|
||||||
|
|
||||||
// this assumes that capillary pressures only depend on the phase saturations
|
// this assumes that capillary pressures only depend on the phase saturations
|
||||||
// and possibly on temperature. (this is always the case for ECL problems.)
|
// and possibly on temperature. (this is always the case for ECL problems.)
|
||||||
Dune::FieldVector< Scalar, numPhases > pc(0);
|
Dune::FieldVector< Scalar, numPhases > pc(0);
|
||||||
@ -1002,18 +957,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (temperature_.size() > 0) {
|
if (temperature_.size() > 0)
|
||||||
fs.setTemperature(temperature_[elemIdx]);
|
fs.setTemperature(temperature_[elemIdx]);
|
||||||
}
|
if (rs_.size() > 0)
|
||||||
|
|
||||||
if (rs_.size() > 0) {
|
|
||||||
fs.setRs(rs_[elemIdx]);
|
fs.setRs(rs_[elemIdx]);
|
||||||
|
if (rv_.size() > 0)
|
||||||
}
|
|
||||||
if (rv_.size() > 0) {
|
|
||||||
fs.setRv(rv_[elemIdx]);
|
fs.setRv(rv_[elemIdx]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void initHysteresisParams(Simulator& simulator, unsigned elemIdx) const {
|
void initHysteresisParams(Simulator& simulator, unsigned elemIdx) const {
|
||||||
|
|
||||||
@ -1107,14 +1057,15 @@ private:
|
|||||||
|
|
||||||
if (computeFip_) {
|
if (computeFip_) {
|
||||||
Scalar fip[FluidSystem::numPhases];
|
Scalar fip[FluidSystem::numPhases];
|
||||||
for (unsigned phase = 0; phase < FluidSystem::numPhases; ++phase) {
|
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
|
||||||
if (!FluidSystem::phaseIsActive(phase)) {
|
fip[phaseIdx] = 0.0;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const double b = Opm::getValue(fs.invB(phase));
|
if (!FluidSystem::phaseIsActive(phaseIdx))
|
||||||
const double s = Opm::getValue(fs.saturation(phase));
|
continue;
|
||||||
fip[phase] = b * s * pv;
|
|
||||||
|
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)
|
if (FluidSystem::phaseIsActive(oilPhaseIdx) && fip_[FipDataType::OilInPlace].size() > 0)
|
||||||
@ -1152,12 +1103,12 @@ private:
|
|||||||
|
|
||||||
void createLocalFipnum_()
|
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.
|
// Get compressed cell fipnum.
|
||||||
const auto& gridView = simulator_.vanguard().gridView();
|
const auto& gridView = simulator_.vanguard().gridView();
|
||||||
unsigned numElements = gridView.size(/*codim=*/0);
|
unsigned numElements = gridView.size(/*codim=*/0);
|
||||||
fipnum_.resize(numElements, 0.0);
|
fipnum_.resize(numElements, 0.0);
|
||||||
if (!fipnum_global.empty()) {
|
if (!fipnumGlobal.empty()) {
|
||||||
ElementContext elemCtx(simulator_);
|
ElementContext elemCtx(simulator_);
|
||||||
ElementIterator elemIt = gridView.template begin</*codim=*/0>();
|
ElementIterator elemIt = gridView.template begin</*codim=*/0>();
|
||||||
const ElementIterator& elemEndIt = gridView.template end</*codim=*/0>();
|
const ElementIterator& elemEndIt = gridView.template end</*codim=*/0>();
|
||||||
@ -1168,7 +1119,7 @@ private:
|
|||||||
|
|
||||||
elemCtx.updatePrimaryStencil(elem);
|
elemCtx.updatePrimaryStencil(elem);
|
||||||
const unsigned elemIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0);
|
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,7 +1151,8 @@ private:
|
|||||||
return totals;
|
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();
|
size_t size = pressurePvHydrocarbon.size();
|
||||||
assert(pvHydrocarbon.size() == size);
|
assert(pvHydrocarbon.size() == size);
|
||||||
assert(pressurePv.size() == size);
|
assert(pressurePv.size() == size);
|
||||||
@ -1213,7 +1165,8 @@ private:
|
|||||||
return fraction;
|
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)
|
if (pvHydrocarbon > 1e-10 && hydrocarbon)
|
||||||
return pressurePvHydrocarbon / pvHydrocarbon;
|
return pressurePvHydrocarbon / pvHydrocarbon;
|
||||||
|
|
||||||
@ -1241,11 +1194,13 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pressureUnitConvert_(Scalar& pav) {
|
void pressureUnitConvert_(Scalar& pav)
|
||||||
|
{
|
||||||
const Opm::UnitSystem& units = simulator_.vanguard().eclState().getUnits();
|
const Opm::UnitSystem& units = simulator_.vanguard().eclState().getUnits();
|
||||||
if (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_FIELD) {
|
if (units.getType() == Opm::UnitSystem::UnitType::UNIT_TYPE_FIELD) {
|
||||||
pav = Opm::unit::convert::to(pav, Opm::unit::psia);
|
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);
|
pav = Opm::unit::convert::to(pav, Opm::unit::barsa);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1260,7 +1215,8 @@ private:
|
|||||||
if (!reg) {
|
if (!reg) {
|
||||||
ss << " ===================================================\n"
|
ss << " ===================================================\n"
|
||||||
<< " : Field Totals :\n";
|
<< " : Field Totals :\n";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ss << " ===================================================\n"
|
ss << " ===================================================\n"
|
||||||
<< " : FIPNUM report region "
|
<< " : FIPNUM report region "
|
||||||
<< std::setw(2) << reg << " :\n";
|
<< std::setw(2) << reg << " :\n";
|
||||||
@ -1296,7 +1252,8 @@ private:
|
|||||||
Opm::OpmLog::note(ss.str());
|
Opm::OpmLog::note(ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fipEnumToString_(int i) {
|
std::string fipEnumToString_(int i)
|
||||||
|
{
|
||||||
typedef typename FipDataType::FipId FipId;
|
typedef typename FipDataType::FipId FipId;
|
||||||
switch(static_cast<FipId>(i))
|
switch(static_cast<FipId>(i))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user