mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'frankenstein' of git://github.com/OPM/opm-simulators into frankenstein
This commit is contained in:
commit
ae0ebf1200
@ -666,7 +666,7 @@ namespace Opm {
|
||||
const auto& intQuants = *(ebosSimulator_.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
B_idx [cell_idx] = 1 / fs.invB(ebosPhaseIdx).value;
|
||||
B_idx [cell_idx] = 1 / fs.invB(ebosPhaseIdx).value();
|
||||
R2_idx[cell_idx] = ebosResid[cell_idx][ebosCompIdx];
|
||||
}
|
||||
}
|
||||
|
@ -313,40 +313,40 @@ namespace Opm
|
||||
const auto& intQuants = *ebosModel.cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
pressureOil[cellIdx] = fs.pressure(FluidSystem::oilPhaseIdx).value;
|
||||
pressureOil[cellIdx] = fs.pressure(FluidSystem::oilPhaseIdx).value();
|
||||
|
||||
temperature[cellIdx] = fs.temperature(FluidSystem::oilPhaseIdx).value;
|
||||
temperature[cellIdx] = fs.temperature(FluidSystem::oilPhaseIdx).value();
|
||||
|
||||
satWater[cellIdx] = fs.saturation(FluidSystem::waterPhaseIdx).value;
|
||||
satGas[cellIdx] = fs.saturation(FluidSystem::gasPhaseIdx).value;
|
||||
satWater[cellIdx] = fs.saturation(FluidSystem::waterPhaseIdx).value();
|
||||
satGas[cellIdx] = fs.saturation(FluidSystem::gasPhaseIdx).value();
|
||||
|
||||
bWater[cellIdx] = fs.invB(FluidSystem::waterPhaseIdx).value;
|
||||
bOil[cellIdx] = fs.invB(FluidSystem::oilPhaseIdx).value;
|
||||
bGas[cellIdx] = fs.invB(FluidSystem::gasPhaseIdx).value;
|
||||
bWater[cellIdx] = fs.invB(FluidSystem::waterPhaseIdx).value();
|
||||
bOil[cellIdx] = fs.invB(FluidSystem::oilPhaseIdx).value();
|
||||
bGas[cellIdx] = fs.invB(FluidSystem::gasPhaseIdx).value();
|
||||
|
||||
Rs[cellIdx] = fs.Rs().value;
|
||||
Rs[cellIdx] = fs.Rv().value;
|
||||
Rs[cellIdx] = fs.Rs().value();
|
||||
Rs[cellIdx] = fs.Rv().value();
|
||||
|
||||
rhoWater[cellIdx] = fs.density(FluidSystem::waterPhaseIdx).value;
|
||||
rhoOil[cellIdx] = fs.density(FluidSystem::oilPhaseIdx).value;
|
||||
rhoGas[cellIdx] = fs.density(FluidSystem::gasPhaseIdx).value;
|
||||
rhoWater[cellIdx] = fs.density(FluidSystem::waterPhaseIdx).value();
|
||||
rhoOil[cellIdx] = fs.density(FluidSystem::oilPhaseIdx).value();
|
||||
rhoGas[cellIdx] = fs.density(FluidSystem::gasPhaseIdx).value();
|
||||
|
||||
muWater[cellIdx] = fs.viscosity(FluidSystem::waterPhaseIdx).value;
|
||||
muOil[cellIdx] = fs.viscosity(FluidSystem::oilPhaseIdx).value;
|
||||
muGas[cellIdx] = fs.viscosity(FluidSystem::gasPhaseIdx).value;
|
||||
muWater[cellIdx] = fs.viscosity(FluidSystem::waterPhaseIdx).value();
|
||||
muOil[cellIdx] = fs.viscosity(FluidSystem::oilPhaseIdx).value();
|
||||
muGas[cellIdx] = fs.viscosity(FluidSystem::gasPhaseIdx).value();
|
||||
|
||||
krWater[cellIdx] = intQuants.relativePermeability(FluidSystem::waterPhaseIdx).value;
|
||||
krOil[cellIdx] = intQuants.relativePermeability(FluidSystem::oilPhaseIdx).value;
|
||||
krGas[cellIdx] = intQuants.relativePermeability(FluidSystem::gasPhaseIdx).value;
|
||||
krWater[cellIdx] = intQuants.relativePermeability(FluidSystem::waterPhaseIdx).value();
|
||||
krOil[cellIdx] = intQuants.relativePermeability(FluidSystem::oilPhaseIdx).value();
|
||||
krGas[cellIdx] = intQuants.relativePermeability(FluidSystem::gasPhaseIdx).value();
|
||||
|
||||
RsSat[cellIdx] = FluidSystem::saturatedDissolutionFactor(fs,
|
||||
FluidSystem::oilPhaseIdx,
|
||||
intQuants.pvtRegionIndex(),
|
||||
/*maxOilSaturation=*/1.0).value;
|
||||
/*maxOilSaturation=*/1.0).value();
|
||||
RvSat[cellIdx] = FluidSystem::saturatedDissolutionFactor(fs,
|
||||
FluidSystem::gasPhaseIdx,
|
||||
intQuants.pvtRegionIndex(),
|
||||
/*maxOilSaturation=*/1.0).value;
|
||||
/*maxOilSaturation=*/1.0).value();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,24 +238,24 @@ namespace Opm {
|
||||
|
||||
if (!only_wells) {
|
||||
// subtract sum of phase fluxes in the reservoir equation.
|
||||
ebosResid[cell_idx][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].value;
|
||||
ebosResid[cell_idx][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].value();
|
||||
}
|
||||
|
||||
// subtract sum of phase fluxes in the well equations.
|
||||
resWell_[w][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].value;
|
||||
resWell_[w][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].value();
|
||||
|
||||
// assemble the jacobians
|
||||
for (int p2 = 0; p2 < np; ++p2) {
|
||||
if (!only_wells) {
|
||||
ebosJac[cell_idx][cell_idx][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] -= cq_s[p1].derivatives[p2];
|
||||
duneB_[w][cell_idx][flowToEbosPvIdx(p2)][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].derivatives[p2+3]; // intput in transformed matrix
|
||||
duneC_[w][cell_idx][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] -= cq_s[p1].derivatives[p2];
|
||||
ebosJac[cell_idx][cell_idx][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] -= cq_s[p1].derivative(p2);
|
||||
duneB_[w][cell_idx][flowToEbosPvIdx(p2)][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].derivative(p2+3); // intput in transformed matrix
|
||||
duneC_[w][cell_idx][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] -= cq_s[p1].derivative(p2);
|
||||
}
|
||||
invDuneD_[w][w][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] -= cq_s[p1].derivatives[p2+3];
|
||||
invDuneD_[w][w][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] -= cq_s[p1].derivative(p2+3);
|
||||
}
|
||||
|
||||
// Store the perforation phase flux for later usage.
|
||||
well_state.perfPhaseRates()[perf*np + p1] = cq_s[p1].value;
|
||||
well_state.perfPhaseRates()[perf*np + p1] = cq_s[p1].value();
|
||||
}
|
||||
// Store the perforation pressure for later usage.
|
||||
well_state.perfPress()[perf] = well_state.bhp()[w] + wellPerforationPressureDiffs()[perf];
|
||||
@ -266,9 +266,9 @@ namespace Opm {
|
||||
EvalWell resWell_loc = (wellVolumeFraction(w, p1) - F0_[w + nw*p1]) * volume / dt;
|
||||
resWell_loc += getQs(w, p1);
|
||||
for (int p2 = 0; p2 < np; ++p2) {
|
||||
invDuneD_[w][w][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] += resWell_loc.derivatives[p2+3];
|
||||
invDuneD_[w][w][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] += resWell_loc.derivative(p2+3);
|
||||
}
|
||||
resWell_[w][flowPhaseToEbosCompIdx(p1)] += resWell_loc.value;
|
||||
resWell_[w][flowPhaseToEbosCompIdx(p1)] += resWell_loc.value();
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,10 +295,10 @@ namespace Opm {
|
||||
EvalWell well_pressure = bhp + wellPerforationPressureDiffs()[perf];
|
||||
EvalWell drawdown = pressure - well_pressure;
|
||||
|
||||
if ( drawdown.value < 0 && wells().type[w] == INJECTOR) {
|
||||
if ( drawdown.value() < 0 && wells().type[w] == INJECTOR) {
|
||||
return false;
|
||||
}
|
||||
if ( drawdown.value > 0 && wells().type[w] == PRODUCER) {
|
||||
if ( drawdown.value() > 0 && wells().type[w] == PRODUCER) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -460,9 +460,9 @@ namespace Opm {
|
||||
typedef DenseAd::Evaluation<double, /*size=*/3> Eval;
|
||||
EvalWell extendEval(Eval in) const {
|
||||
EvalWell out = 0.0;
|
||||
out.value = in.value;
|
||||
out.setValue(in.value());
|
||||
for(int i = 0;i<3;++i) {
|
||||
out.derivatives[i] = in.derivatives[flowToEbosPvIdx(i)];
|
||||
out.setDerivative(i, in.derivative(flowToEbosPvIdx(i)));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@ -474,16 +474,16 @@ namespace Opm {
|
||||
for (int phaseIdx = 0; phaseIdx < np; ++phaseIdx) {
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
wellVariables_[w + nw*phaseIdx] = 0.0;
|
||||
wellVariables_[w + nw*phaseIdx].value = xw.wellSolutions()[w + nw* phaseIdx];
|
||||
wellVariables_[w + nw*phaseIdx].derivatives[np + phaseIdx] = 1.0;
|
||||
wellVariables_[w + nw*phaseIdx].setValue(xw.wellSolutions()[w + nw* phaseIdx]);
|
||||
wellVariables_[w + nw*phaseIdx].setDerivative(np + phaseIdx, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(EvalWell in) const {
|
||||
std::cout << in.value << std::endl;
|
||||
for (int i = 0; i < in.derivatives.size(); ++i) {
|
||||
std::cout << in.derivatives[i] << std::endl;
|
||||
std::cout << in.value() << std::endl;
|
||||
for (int i = 0; i < in.size; ++i) {
|
||||
std::cout << in.derivative(i) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,7 +493,7 @@ namespace Opm {
|
||||
const int nw = wells().number_of_wells;
|
||||
for (int phaseIdx = 0; phaseIdx < np; ++phaseIdx) {
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
F0_[w + nw * phaseIdx] = wellVolumeFraction(w,phaseIdx).value;
|
||||
F0_[w + nw * phaseIdx] = wellVolumeFraction(w,phaseIdx).value();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -529,7 +529,7 @@ namespace Opm {
|
||||
EvalWell drawdown = pressure - well_pressure;
|
||||
|
||||
// injection perforations
|
||||
if ( drawdown.value > 0 ) {
|
||||
if ( drawdown.value() > 0 ) {
|
||||
|
||||
//Do nothing if crossflow is not allowed
|
||||
if (!allow_cf && wells().type[w] == INJECTOR)
|
||||
@ -586,16 +586,16 @@ namespace Opm {
|
||||
if (cmix_s[gaspos] > 0)
|
||||
rvPerf = cmix_s[oilpos] / cmix_s[gaspos];
|
||||
|
||||
if (rvPerf.value > rvSatEval.value) {
|
||||
if (rvPerf.value() > rvSatEval.value()) {
|
||||
rvPerf = rvSatEval;
|
||||
//rvPerf.value = rvSatEval.value;
|
||||
//rvPerf.setValue(rvSatEval.value());
|
||||
}
|
||||
|
||||
EvalWell rsPerf = 0.0;
|
||||
if (cmix_s[oilpos] > 0)
|
||||
rsPerf = cmix_s[gaspos] / cmix_s[oilpos];
|
||||
|
||||
if (rsPerf.value > rsSatEval.value) {
|
||||
if (rsPerf.value() > rsSatEval.value()) {
|
||||
//rsPerf = 0.0;
|
||||
rsPerf= rsSatEval;
|
||||
}
|
||||
@ -719,7 +719,7 @@ namespace Opm {
|
||||
|
||||
int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(idx);
|
||||
|
||||
b[cell_idx] = 1 / fs.invB(ebosPhaseIdx).value;
|
||||
b[cell_idx] = 1 / fs.invB(ebosPhaseIdx).value();
|
||||
}
|
||||
B.col(idx) = b;
|
||||
}
|
||||
@ -821,7 +821,7 @@ namespace Opm {
|
||||
|
||||
const double p_above = perf == wells().well_connpos[w] ? xw.bhp()[w] : xw.perfPress()[perf - 1];
|
||||
const double p_avg = (xw.perfPress()[perf] + p_above)/2;
|
||||
double temperature = fs.temperature(FluidSystem::oilPhaseIdx).value;
|
||||
double temperature = fs.temperature(FluidSystem::oilPhaseIdx).value();
|
||||
|
||||
if (pu.phase_used[BlackoilPhases::Aqua]) {
|
||||
b_perf[ pu.phase_pos[BlackoilPhases::Aqua] + perf * pu.num_phases] =
|
||||
@ -1426,7 +1426,7 @@ namespace Opm {
|
||||
if (well_controls_get_current_type(wc) == BHP) {
|
||||
EvalWell bhp = 0.0;
|
||||
const double target_rate = well_controls_get_current_target(wc);
|
||||
bhp.value = target_rate;
|
||||
bhp.setValue(target_rate);
|
||||
return bhp;
|
||||
} else if (well_controls_get_current_type(wc) == THP) {
|
||||
const int control = well_controls_get_current(wc);
|
||||
@ -1483,7 +1483,7 @@ namespace Opm {
|
||||
if (well_controls_get_current_type(wc) == BHP || well_controls_get_current_type(wc) == THP) {
|
||||
return wellVariables_[wellIdx];
|
||||
}
|
||||
qs.value = target_rate;
|
||||
qs.setValue(target_rate);
|
||||
return qs;
|
||||
}
|
||||
|
||||
@ -1495,7 +1495,7 @@ namespace Opm {
|
||||
const double comp_frac = wells().comp_frac[np*wellIdx + phaseIdx];
|
||||
|
||||
if (comp_frac == 1.0) {
|
||||
qs.value = target_rate;
|
||||
qs.setValue(target_rate);
|
||||
return qs;
|
||||
}
|
||||
int currentControlIdx = 0;
|
||||
|
@ -50,7 +50,7 @@ inline double zeroIfNan(const double& value) {
|
||||
* Returns zero if input value is NaN
|
||||
*/
|
||||
inline double zeroIfNan(const EvalWell& value) {
|
||||
return (std::isnan(value.value)) ? 0.0 : value.value;
|
||||
return (std::isnan(value.value())) ? 0.0 : value.value();
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,16 +106,16 @@ VFPInjProperties::EvalWell VFPInjProperties::bhp(const int table_id,
|
||||
if (table != nullptr) {
|
||||
//First, find the values to interpolate between
|
||||
//Value of FLO is negative in OPM for producers, but positive in VFP table
|
||||
auto flo_i = detail::findInterpData(flo.value, table->getFloAxis());
|
||||
auto flo_i = detail::findInterpData(flo.value(), table->getFloAxis());
|
||||
auto thp_i = detail::findInterpData( thp, table->getTHPAxis()); // assume constant
|
||||
|
||||
detail::VFPEvaluation bhp_val = detail::interpolate(table->getTable(), flo_i, thp_i);
|
||||
|
||||
bhp = bhp_val.dflo * flo;
|
||||
bhp.value = bhp_val.value; // thp is assumed constant i.e.
|
||||
bhp.setValue(bhp_val.value); // thp is assumed constant i.e.
|
||||
}
|
||||
else {
|
||||
bhp.value = -1e100; //Signal that this value has not been calculated properly, due to "missing" table
|
||||
bhp.setValue(-1e100); //Signal that this value has not been calculated properly, due to "missing" table
|
||||
}
|
||||
return bhp;
|
||||
}
|
||||
|
@ -95,19 +95,19 @@ VFPProdProperties::EvalWell VFPProdProperties::bhp(const int table_id,
|
||||
if (table != nullptr) {
|
||||
//First, find the values to interpolate between
|
||||
//Value of FLO is negative in OPM for producers, but positive in VFP table
|
||||
auto flo_i = detail::findInterpData(-flo.value, table->getFloAxis());
|
||||
auto flo_i = detail::findInterpData(-flo.value(), table->getFloAxis());
|
||||
auto thp_i = detail::findInterpData( thp, table->getTHPAxis()); // assume constant
|
||||
auto wfr_i = detail::findInterpData( wfr.value, table->getWFRAxis());
|
||||
auto gfr_i = detail::findInterpData( gfr.value, table->getGFRAxis());
|
||||
auto wfr_i = detail::findInterpData( wfr.value(), table->getWFRAxis());
|
||||
auto gfr_i = detail::findInterpData( gfr.value(), table->getGFRAxis());
|
||||
auto alq_i = detail::findInterpData( alq, table->getALQAxis()); //assume constant
|
||||
|
||||
detail::VFPEvaluation bhp_val = detail::interpolate(table->getTable(), flo_i, thp_i, wfr_i, gfr_i, alq_i);
|
||||
|
||||
bhp = (bhp_val.dwfr * wfr) + (bhp_val.dgfr * gfr) - (bhp_val.dflo * flo);
|
||||
bhp.value = bhp_val.value;
|
||||
bhp.setValue(bhp_val.value);
|
||||
}
|
||||
else {
|
||||
bhp.value = -1e100; //Signal that this value has not been calculated properly, due to "missing" table
|
||||
bhp.setValue(-1e100); //Signal that this value has not been calculated properly, due to "missing" table
|
||||
}
|
||||
return bhp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user