20 #ifndef OPM_BLACKOILREORDERINGTRANSPORTMODEL_HEADER_INCLUDED
21 #define OPM_BLACKOILREORDERINGTRANSPORTMODEL_HEADER_INCLUDED
23 #include <opm/autodiff/BlackoilModelBase.hpp>
24 #include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
25 #include <opm/autodiff/BlackoilModelParameters.hpp>
26 #include <opm/autodiff/DebugTimeReport.hpp>
27 #include <opm/autodiff/multiPhaseUpwind.hpp>
28 #include <opm/core/grid.h>
29 #include <opm/core/transport/reorder/reordersequence.h>
30 #include <opm/core/simulator/BlackoilState.hpp>
32 #include <opm/autodiff/BlackoilTransportModel.hpp>
40 template <
typename Scalar>
43 Scalar operator()(
double value,
int index)
45 return Scalar::createVariable(value, index);
54 double operator()(
double value,
int)
62 template <
typename Scalar>
65 Scalar operator()(
double value)
67 return Scalar::createConstant(value);
76 double operator()(
double value)
87 Connection(
const int ind,
const double s) : index(ind), sign(s) {}
106 grad_ia_ = grad_.outerIndexPtr();
107 grad_ja_ = grad_.innerIndexPtr();
108 grad_sign_ = grad_.valuePtr();
109 div_ia_ = div_.outerIndexPtr();
110 div_ja_ = div_.innerIndexPtr();
111 div_sign_ = div_.valuePtr();
116 std::array<int, 2> connectionCells(
const int connection)
const
118 const int pos = div_ia_[connection];
119 assert(div_ia_[connection + 1] == pos + 2);
120 const double sign1 = div_sign_[pos];
121 assert(div_sign_[pos + 1] == -sign1);
123 return {{ div_ja_[pos], div_ja_[pos + 1] }};
125 return {{ div_ja_[pos + 1], div_ja_[pos] }};
131 typedef HelperOps::M M;
136 const double* grad_sign_;
139 const double* div_sign_;
149 return cg_.grad_ia_[cell_ + 1] - cg_.grad_ia_[cell_];
160 bool operator!=(
const Iterator& other)
162 assert(&c_ == &other.c_);
163 return index_ != other.index_;
167 assert(index_ >= 0 && index_ < c_.size());
168 const int pos = c_.cg_.grad_ia_[c_.cell_] + index_;
169 return Connection(c_.cg_.grad_ja_[pos], -c_.cg_.grad_sign_[pos]);
176 Iterator end()
const {
return Iterator(*
this, size()); }
178 friend class Iterator;
179 const ConnectivityGraph& cg_;
184 inline Connections ConnectivityGraph::cellConnections(
const int cell)
const
186 return Connections(*
this, cell);
200 template<
class Gr
id,
class WellModel>
202 :
public BlackoilModelBase<Grid, WellModel, BlackoilReorderingTransportModel<Grid, WellModel> >
208 typedef typename Base::ReservoirState ReservoirState;
209 typedef typename Base::WellState WellState;
210 typedef typename Base::SolutionState SolutionState;
211 typedef typename Base::V V;
232 const RockCompressibility* rock_comp_props,
235 std::shared_ptr<const EclipseState> eclState,
236 const bool has_disgas,
237 const bool has_vapoil,
238 const bool terminal_output)
239 :
Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
240 eclState, has_disgas, has_vapoil, terminal_output)
243 , state0_{ ReservoirState(0, 0, 0), WellState(), V(), V() }
244 , state_{ ReservoirState(0, 0, 0), WellState(), V(), V() }
245 , tr_model_(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
246 eclState, has_disgas, has_vapoil, terminal_output)
250 const V transi =
subset(geo_.transmissibility(), ops_.internal_faces);
252 trans_all_ = V::Zero(transi.size() + trans_nnc.size());
253 trans_all_ << transi, trans_nnc;
254 gdz_ = geo_.gravity()[2] * (ops_.
grad * geo_.z().matrix());
255 rhos_ = DataBlock::Zero(ops_.
div.
rows(), 3);
265 void prepareStep(
const SimulatorTimerInterface& timer,
266 const ReservoirState& reservoir_state,
267 const WellState& well_state)
269 tr_model_.prepareStep(timer, reservoir_state, well_state);
271 Base::param_.solve_welleq_initially_ =
false;
272 state0_.reservoir_state = reservoir_state;
273 state0_.well_state = well_state;
276 const std::vector<double>& p = reservoir_state.pressure();
277 state0_.tr_mult = Base::transMult(
ADB::constant(Eigen::Map<const V>(p.data(), p.size()))).value();
278 state0_.pv_mult = Base::poroMult(
ADB::constant(Eigen::Map<const V>(p.data(), p.size()))).value();
279 const int num_cells = p.size();
280 cstate0_.resize(num_cells);
281 for (
int cell = 0; cell < num_cells; ++cell) {
282 computeCellState(cell, state0_, cstate0_[cell]);
291 template <
class NonlinearSolverType>
292 SimulatorReport nonlinearIteration(
const int iteration,
293 const SimulatorTimerInterface& timer,
294 NonlinearSolverType& nonlinear_solver,
295 ReservoirState& reservoir_state,
296 const WellState& well_state)
300 DebugTimeReport tr(
"Extracting fluxes");
301 extractFluxes(reservoir_state, well_state);
302 extractState(reservoir_state, well_state);
307 DebugTimeReport tr(
"Topological sort");
313 DebugTimeReport tr(
"Solving all components");
314 for (
int ii = 0; ii < 5; ++ii) {
315 DebugTimeReport tr2(
"Solving components single sweep.");
321 reservoir_state = state_.reservoir_state;
325 auto rs = reservoir_state;
326 auto ws = well_state;
327 tr_model_.nonlinearIteration( 0, timer, nonlinear_solver, rs, ws);
331 SimulatorReport report;
332 report.converged =
true;
340 void afterStep(
const SimulatorTimerInterface& ,
341 const ReservoirState& ,
354 using Vec2 = Dune::FieldVector<double, 2>;
355 using Mat22 = Dune::FieldMatrix<double, 2, 2>;
356 using Eval = DenseAd::Evaluation<double, 2>;
363 ReservoirState reservoir_state;
364 WellState well_state;
373 template <
typename ScalarT>
376 using Scalar = ScalarT;
393 const Scalar& saturation(
int phaseIdx)
const
398 template <
typename T>
402 { s[0].value(), s[1].value(), s[2].value() },
405 { p[0].value(), p[1].value(), p[2].value() },
406 { kr[0].value(), kr[1].value(), kr[2].value() },
407 { pc[0].value(), pc[1].value(), pc[2].value() },
409 { mu[0].value(), mu[1].value(), mu[2].value() },
410 { b[0].value(), b[1].value(), b[2].value() },
411 { lambda[0].value(), lambda[1].value(), lambda[2].value() },
412 { rho[0].value(), rho[1].value(), rho[2].value() },
434 std::vector<CellState<double>> cstate0_;
435 std::vector<CellState<double>> cstate_;
438 V total_wellperf_flux_;
439 DataBlock comp_wellperf_flux_;
440 V total_wellflux_cell_;
441 V oil_wellflux_cell_;
442 V gas_wellflux_cell_;
443 std::vector<int> sequence_;
444 std::vector<int> components_;
449 std::array<double, 2> max_abs_dx_;
450 std::array<int, 2> max_abs_dx_cell_;
462 template <
typename Scalar>
468 const auto hcstate = state.reservoir_state.hydroCarbonState()[cell];
469 const bool is_sg = (hcstate == HydroCarbonState::GasAndOil);
470 const bool is_rs = (hcstate == HydroCarbonState::OilOnly);
471 const bool is_rv = (hcstate == HydroCarbonState::GasOnly);
472 const double swval = state.reservoir_state.saturation()[3*cell + Water];
473 const double sgval = state.reservoir_state.saturation()[3*cell + Gas];
474 const double rsval = state.reservoir_state.gasoilratio()[cell];
475 const double rvval = state.reservoir_state.rv()[cell];
476 const double poval = state.reservoir_state.pressure()[cell];
477 const int pvt_region = props_.pvtRegions()[cell];
481 const auto& oilpvt = props_.
oilProps();
482 const auto& gaspvt = props_.
gasProps();
488 cstate.s[Water] = variable(swval, 0);
489 cstate.s[Gas] = is_sg ? variable(sgval, 1) : constant(sgval);
490 cstate.s[Oil] = 1.0 - cstate.s[Water] - cstate.s[Gas];
491 cstate.rs = is_rs ? variable(rsval, 1) : constant(rsval);
492 cstate.rv = is_rv ? variable(rvval, 1) : constant(rvval);
495 const auto& params = satfunc.materialLawParams(cell);
496 typedef BlackoilPropsAdFromDeck::MaterialLawManager::MaterialLaw MaterialLaw;
497 MaterialLaw::relativePermeabilities(cstate.kr, params, cstate);
498 MaterialLaw::capillaryPressures(cstate.pc, params, cstate);
501 cstate.p[Oil] = constant(poval);
502 cstate.p[Water] = cstate.p[Oil] + cstate.pc[Water];
503 cstate.p[Gas] = cstate.p[Oil] + cstate.pc[Gas];
506 cstate.temperature = constant(0.0);
507 cstate.mu[Water] = waterpvt.viscosity(pvt_region, cstate.temperature, cstate.p[Water]);
508 cstate.mu[Oil] = is_sg
509 ? oilpvt.saturatedViscosity(pvt_region, cstate.temperature, cstate.p[Oil])
510 : oilpvt.viscosity(pvt_region, cstate.temperature, cstate.p[Oil], cstate.rs);
511 cstate.mu[Gas] = is_sg
512 ? gaspvt.saturatedViscosity(pvt_region, cstate.temperature, cstate.p[Gas])
513 : gaspvt.viscosity(pvt_region, cstate.temperature, cstate.p[Gas], cstate.rv);
514 cstate.b[Water] = waterpvt.inverseFormationVolumeFactor(pvt_region, cstate.temperature, cstate.p[Water]);
515 cstate.b[Oil] = is_sg
516 ? oilpvt.saturatedInverseFormationVolumeFactor(pvt_region, cstate.temperature, cstate.p[Oil])
517 : oilpvt.inverseFormationVolumeFactor(pvt_region, cstate.temperature, cstate.p[Oil], cstate.rs);
518 cstate.b[Gas] = is_sg
519 ? gaspvt.saturatedInverseFormationVolumeFactor(pvt_region, cstate.temperature, cstate.p[Gas])
520 : gaspvt.inverseFormationVolumeFactor(pvt_region, cstate.temperature, cstate.p[Gas], cstate.rv);
523 for (
int phase = 0; phase < 3; ++phase) {
524 cstate.lambda[phase] = cstate.kr[phase] / cstate.mu[phase];
528 cstate.rho[Water] = rhos_(cell, Water) * cstate.b[Water];
529 cstate.rho[Oil] = (rhos_(cell, Oil) + cstate.rs*rhos_(cell, Gas)) * cstate.b[Oil];
530 cstate.rho[Gas] = (rhos_(cell, Gas) + cstate.rv*rhos_(cell, Oil)) * cstate.b[Gas];
533 cstate.rssat = oilpvt.saturatedGasDissolutionFactor(pvt_region, cstate.temperature, cstate.p[Oil]);
534 cstate.rvsat = gaspvt.saturatedOilVaporizationFactor(pvt_region, cstate.temperature, cstate.p[Gas]);
541 void extractFluxes(
const ReservoirState& reservoir_state,
542 const WellState& well_state)
545 total_flux_ = Eigen::Map<const V>(reservoir_state.faceflux().data(),
546 reservoir_state.faceflux().size());
547 total_wellperf_flux_ = Eigen::Map<const V>(well_state.perfRates().data(),
548 well_state.perfRates().size());
549 comp_wellperf_flux_ = Eigen::Map<const DataBlock>(well_state.perfPhaseRates().data(),
550 well_state.perfRates().size(),
552 const int num_cells = reservoir_state.pressure().size();
555 V oilflux = comp_wellperf_flux_.col(1);
556 V gasflux = comp_wellperf_flux_.col(2);
559 assert(
numPhases() * well_state.perfRates().size() == well_state.perfPhaseRates().size());
566 void extractState(
const ReservoirState& reservoir_state,
567 const WellState& well_state)
569 state_.reservoir_state = reservoir_state;
570 state_.well_state = well_state;
571 const std::vector<double>& p = reservoir_state.pressure();
572 state_.tr_mult = Base::transMult(
ADB::constant(Eigen::Map<const V>(p.data(), p.size()))).value();
573 state_.pv_mult = Base::poroMult(
ADB::constant(Eigen::Map<const V>(p.data(), p.size()))).value();
580 void computeOrdering()
582 assert(!geo_.nnc().hasNNC());
583 static_assert(std::is_same<Grid, UnstructuredGrid>::value,
584 "compute_sequence() is written in C and therefore requires an UnstructuredGrid, "
585 "it must be rewritten to use other grid classes such as CpGrid");
586 using namespace Opm::AutoDiffGrid;
587 const int num_cells = numCells(grid_);
588 sequence_.resize(num_cells);
589 components_.resize(num_cells + 1);
590 int num_components = -1;
593 using namespace Opm::AutoDiffGrid;
594 const int num_faces = numFaces(grid_);
595 V flux_on_all_faces =
superset(total_flux_, ops_.internal_faces, num_faces);
596 compute_sequence(&grid_, flux_on_all_faces.data(), sequence_.data(), components_.data(), &num_components);
597 OpmLog::debug(std::string(
"Number of components: ") + std::to_string(num_components));
598 components_.resize(num_components + 1);
604 void solveComponents()
607 max_abs_dx_[0] = 0.0;
608 max_abs_dx_[1] = 0.0;
609 max_abs_dx_cell_[0] = -1;
610 max_abs_dx_cell_[1] = -1;
613 const int num_components = components_.size() - 1;
614 for (
int comp = 0; comp < num_components; ++comp) {
615 const int comp_size = components_[comp + 1] - components_[comp];
616 if (comp_size == 1) {
617 solveSingleCell(sequence_[components_[comp]]);
619 solveMultiCell(comp_size, &sequence_[components_[comp]]);
625 std::ostringstream os;
626 os <<
"=== Max abs dx[0]: " << max_abs_dx_[0] <<
" (cell " << max_abs_dx_cell_[0]
627 <<
") dx[1]: " << max_abs_dx_[1] <<
" (cell " << max_abs_dx_cell_[1] <<
")";
628 OpmLog::debug(os.str());
636 void solveSingleCell(
const int cell)
641 assembleSingleCell(cell, res, jac);
645 const int max_iter = 100;
646 double relaxation = 1.0;
647 while (!getConvergence(cell, res) && iter < max_iter) {
652 updateState(cell, -dx);
654 assembleSingleCell(cell, res, jac);
677 if (iter == max_iter) {
678 std::ostringstream os;
679 os <<
"Failed to converge in cell " << cell <<
", residual = " << res
680 <<
", cell values { s = ( " << cstate_[cell].s[Water] <<
", " << cstate_[cell].s[Oil] <<
", " << cstate_[cell].s[Gas]
681 <<
" ), rs = " << cstate_[cell].rs <<
", rv = " << cstate_[cell].rv <<
" }";
682 OpmLog::debug(os.str());
690 void solveMultiCell(
const int comp_size,
const int* cell_array)
693 for (
int ii = 0; ii < comp_size; ++ii) {
694 solveSingleCell(cell_array[ii]);
701 template <
typename Scalar>
702 Scalar oilAccumulation(
const CellState<Scalar>& cs)
704 return cs.b[Oil]*cs.s[Oil] + cs.rv*cs.b[Gas]*cs.s[Gas];
710 template <
typename Scalar>
711 Scalar gasAccumulation(
const CellState<Scalar>& cs)
713 return cs.b[Gas]*cs.s[Gas] + cs.rs*cs.b[Oil]*cs.s[Oil];
719 void applyThresholdPressure(
const int connection, Eval& dp)
721 const double thres_press = Base::threshold_pressures_by_connection_[connection];
722 if (std::fabs(dp.value()) < thres_press) {
725 dp -= dp.value() > 0.0 ? thres_press : -thres_press;
732 void assembleSingleCell(
const int cell, Vec2& res, Mat22& jac)
737 computeCellState(cell, state_, st);
738 cstate_[cell] = st.template flatten<double>();
741 const double pvm0 = state0_.pv_mult[cell];
742 const double pvm = state_.pv_mult[cell];
743 const double ao0 = oilAccumulation(cstate0_[cell]) * pvm0;
744 const Eval ao = oilAccumulation(st) * pvm;
745 const double ag0 = gasAccumulation(cstate0_[cell]) * pvm0;
746 const Eval ag = gasAccumulation(st) * pvm;
749 Eval div_oilflux = Eval::createConstant(0.0);
750 Eval div_gasflux = Eval::createConstant(0.0);
751 for (
auto conn : graph_.cellConnections(cell)) {
752 auto conn_cells = graph_.connectionCells(conn.index);
753 const int from = conn_cells[0];
754 const int to = conn_cells[1];
755 if (from < 0 || to < 0) {
758 assert((from == cell) == (conn.sign > 0.0));
759 const int other = from == cell ? to : from;
760 const double vt = conn.sign * total_flux_[conn.index];
761 const double gdz = conn.sign * gdz_[conn.index];
770 const Eval grad_oil_press = cstate_[other].p[Oil] - st.p[Oil];
771 for (
int phase : { Water, Oil, Gas }) {
772 const Eval gradp = cstate_[other].p[phase] - st.p[phase];
773 const Eval rhoavg = 0.5 * (st.rho[phase] + cstate_[other].rho[phase]);
774 dh[phase] = gradp - rhoavg * gdz;
775 if (Base::use_threshold_pressure_) {
776 applyThresholdPressure(conn.index, dh[phase]);
778 dh_sat[phase] = grad_oil_press - dh[phase];
780 const double tran = trans_all_[conn.index];
781 const auto& m1 = st.lambda;
782 const auto& m2 = cstate_[other].lambda;
784 {{ m1[Water].value(), m1[Oil].value(), m1[Gas].value() }},
785 {{ m2[Water], m2[Oil], m2[Gas] }},
792 Eval tot_mob = Eval::createConstant(0.0);
793 for (
int phase : { Water, Oil, Gas }) {
794 b[phase] = upw[phase] > 0.0 ? st.b[phase] : cstate_[other].b[phase];
795 mob[phase] = upw[phase] > 0.0 ? m1[phase] : m2[phase];
796 tot_mob += mob[phase];
798 Eval rs = upw[Oil] > 0.0 ? st.rs : cstate_[other].rs;
799 Eval rv = upw[Gas] > 0.0 ? st.rv : cstate_[other].rv;
802 for (
int phase : { Oil, Gas }) {
803 Eval gflux = Eval::createConstant(0.0);
804 for (
int other_phase : { Water, Oil, Gas }) {
805 if (phase != other_phase) {
806 gflux += mob[other_phase] * (dh_sat[phase] - dh_sat[other_phase]);
809 flux[phase] = b[phase] * (mob[phase] / tot_mob) * (vt + tran*gflux);
811 div_oilflux += flux[Oil] + rv*flux[Gas];
812 div_gasflux += flux[Gas] + rs*flux[Oil];
816 if (total_wellflux_cell_[cell] > 0.0) {
818 assert(oil_wellflux_cell_[cell] >= 0.0);
819 assert(gas_wellflux_cell_[cell] >= 0.0);
820 div_oilflux -= oil_wellflux_cell_[cell];
821 div_gasflux -= gas_wellflux_cell_[cell];
822 }
else if (total_wellflux_cell_[cell] < 0.0) {
824 Eval totmob = st.lambda[Water] + st.lambda[Oil] + st.lambda[Gas];
825 Eval oilflux = st.b[Oil] * (st.lambda[Oil]/totmob) * total_wellflux_cell_[cell];
826 Eval gasflux = st.b[Gas] * (st.lambda[Gas]/totmob) * total_wellflux_cell_[cell];
827 div_oilflux -= (oilflux + st.rv * gasflux);
828 div_gasflux -= (gasflux + st.rs * oilflux);
831 const Eval oileq = Base::pvdt_[cell]*(ao - ao0) + div_oilflux;
832 const Eval gaseq = Base::pvdt_[cell]*(ag - ag0) + div_gasflux;
834 res[0] = oileq.value();
835 res[1] = gaseq.value();
836 jac[0][0] = oileq.derivative(0);
837 jac[0][1] = oileq.derivative(1);
838 jac[1][0] = gaseq.derivative(0);
839 jac[1][1] = gaseq.derivative(1);
846 bool getConvergence(
const int cell,
const Vec2& res)
848 const double tol = 1e-7;
850 double sres[] = { res[0] / (cstate_[cell].b[Oil] * Base::pvdt_[cell]),
851 res[1] / (cstate_[cell].b[Gas] * Base::pvdt_[cell]) };
852 return std::fabs(sres[0]) < tol && std::fabs(sres[1]) < tol;
858 void updateState(
const int cell,
861 if (std::fabs(dx[0]) > max_abs_dx_[0]) {
862 max_abs_dx_cell_[0] = cell;
864 if (std::fabs(dx[1]) > max_abs_dx_[1]) {
865 max_abs_dx_cell_[1] = cell;
867 max_abs_dx_[0] = std::max(max_abs_dx_[0], std::fabs(dx[0]));
868 max_abs_dx_[1] = std::max(max_abs_dx_[1], std::fabs(dx[1]));
871 const double dsw = dx[0];
873 auto& hcstate = state_.reservoir_state.hydroCarbonState()[cell];
874 if (hcstate == HydroCarbonState::GasAndOil) {
876 }
else if (hcstate == HydroCarbonState::GasOnly) {
879 const double dso = -(dsw + dsg);
882 const double maxval = std::max(std::fabs(dsw), std::max(std::fabs(dso), std::fabs(dsg)));
883 const double sfactor = std::min(1.0, Base::dsMax() / maxval);
884 double* s = state_.reservoir_state.saturation().data() + 3*cell;
885 s[Water] += sfactor*dsw;
886 s[Gas] += sfactor*dsg;
887 s[Oil] = 1.0 - s[Water] - s[Gas];
890 for (
int phase : { Gas, Oil, Water }) {
891 if (s[phase] < 0.0) {
892 for (
int other_phase : { Water, Oil, Gas }) {
893 if (phase != other_phase) {
894 s[other_phase] /= (1.0 - s[phase]);
902 double& rs = state_.reservoir_state.gasoilratio()[cell];
903 const double rs_old = rs;
904 if (hcstate == HydroCarbonState::OilOnly) {
906 const double drs = dx[1];
910 rs = std::max(rs, 0.0);
914 double& rv = state_.reservoir_state.rv()[cell];
915 const double rv_old = rv;
916 if (hcstate == HydroCarbonState::GasOnly) {
918 const double drv = dx[1];
922 rv = std::max(rv, 0.0);
925 const double epsilon = std::sqrt(std::numeric_limits<double>::epsilon());
926 const bool water_only = s[Water] > (1 - epsilon);
927 const auto old_hcstate = hcstate;
928 hcstate = HydroCarbonState::GasAndOil;
931 const double rssat_old = cstate_[cell].rssat;
932 const double rssat = rssat_old;
933 const bool is_rs = old_hcstate == HydroCarbonState::OilOnly;
934 const bool has_gas = (s[Gas] > 0.0 && !is_rs);
935 const bool gas_vaporized = ( (rs > rssat * (1+epsilon) && is_rs ) && (rs_old > rssat_old * (1-epsilon)) );
936 if (water_only || has_gas || gas_vaporized) {
939 hcstate = HydroCarbonState::OilOnly;
945 const double rvsat_old = cstate_[cell].rvsat;
946 const double rvsat = rvsat_old;
947 const bool is_rv = old_hcstate == HydroCarbonState::GasOnly;
948 const bool has_oil = (s[Oil] > 0.0 && !is_rv);
949 const bool oil_condensed = ( (rv > rvsat * (1+epsilon) && is_rv) && (rv_old > rvsat_old * (1-epsilon)) );
950 if (water_only || has_oil || oil_condensed) {
953 hcstate = HydroCarbonState::GasOnly;
967 template <
class Gr
id,
class WellModel>
970 typedef BlackoilState ReservoirState;
981 #endif // OPM_BLACKOILREORDERINGTRANSPORTMODEL_HEADER_INCLUDED
Contains vectors and sparse matrices that represent subsets or operations on (AD or regular) vectors ...
Definition: AutoDiffHelpers.hpp:44
V nnc_trans
The NNC transmissibilities.
Definition: AutoDiffHelpers.hpp:72
M div
Extract for each cell the sum of its adjacent interior faces' (signed) values.
Definition: AutoDiffHelpers.hpp:60
Definition: BlackoilReorderingTransportModel.hpp:151
BlackoilReorderingTransportModel(const typename Base::ModelParameters ¶m, const Grid &grid, const BlackoilPropsAdFromDeck &fluid, const DerivedGeology &geo, const RockCompressibility *rock_comp_props, const StandardWells &std_wells, const NewtonIterationBlackoilInterface &linsolver, std::shared_ptr< const EclipseState > eclState, const bool has_disgas, const bool has_vapoil, const bool terminal_output)
Construct the model.
Definition: BlackoilReorderingTransportModel.hpp:228
const OilPvt & oilProps() const
Direct access to lower-level oil pvt props.
Definition: BlackoilPropsAdFromDeck.hpp:437
A model implementation for three-phase black oil.
Definition: BlackoilModelBase.hpp:76
Definition: BlackoilReorderingTransportModel.hpp:63
A model implementation for the transport equation in three-phase black oil.
Definition: BlackoilReorderingTransportModel.hpp:201
std::array< double, 3 > connectionMultiPhaseUpwind(const std::array< double, 3 > &head_diff, const std::array< double, 3 > &mob1, const std::array< double, 3 > &mob2, const double transmissibility, const double flux)
Compute upwind directions for three-phase flow across a connection.
Definition: multiPhaseUpwind.cpp:31
Definition: BlackoilReorderingTransportModel.hpp:41
Solver parameters for the BlackoilModel.
Definition: BlackoilModelParameters.hpp:31
Class for handling the standard well model.
Definition: StandardWells.hpp:51
Definition: BlackoilReorderingTransportModel.hpp:143
Definition: BlackoilReorderingTransportModel.hpp:361
void prepareStep(const SimulatorTimerInterface &timer, const ReservoirState &reservoir_state, const WellState &well_state)
Called once before each time step.
Definition: BlackoilReorderingTransportModel.hpp:374
int numPhases() const
The number of active fluid phases in the model.
const WaterPvt & waterProps() const
Direct access to lower-level water pvt props.
Definition: BlackoilPropsAdFromDeck.hpp:431
Traits to encapsulate the types used by classes using or extending this model.
Definition: BlackoilModelBase.hpp:60
AutoDiffBlock< Scalar > superset(const AutoDiffBlock< Scalar > &x, const IntVec &indices, const int n)
Returns v where v(indices) == x, v(!indices) == 0 and v.size() == n.
Definition: AutoDiffHelpers.hpp:319
WellModel & wellModel()
return the WellModel object
Definition: BlackoilModelBase.hpp:268
const MaterialLawManager & materialLaws() const
Direct access to lower-level saturation functions.
Definition: BlackoilPropsAdFromDeck.hpp:449
V surfaceDensity(const int phaseIdx, const Cells &cells) const
Densities of stock components at surface conditions.
Definition: BlackoilPropsAdFromDeck.cpp:242
static AutoDiffBlock constant(V &&val)
Create an AutoDiffBlock representing a constant.
Definition: AutoDiffBlock.hpp:111
Eigen::Array< Scalar, Eigen::Dynamic, 1 > subset(const Eigen::Array< Scalar, Eigen::Dynamic, 1 > &x, const IntVec &indices)
Returns x(indices).
Definition: AutoDiffHelpers.hpp:292
Definition: BlackoilReorderingTransportModel.hpp:99
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellStateFullyImplicitBlackoil.hpp:44
Struct for containing iteration variables.
Definition: DefaultBlackoilSolutionState.hpp:29
int rows() const
Returns number of rows in the matrix.
Definition: AutoDiffMatrix.hpp:565
Definition: BlackoilReorderingTransportModel.hpp:85
Class containing static geological properties that are derived from grid and petrophysical properties...
Definition: GeoProps.hpp:59
M grad
Extract for each face the difference of its adjacent cells' values (second - first).
Definition: AutoDiffHelpers.hpp:56
Interface class for (linear) solvers for the fully implicit black-oil system.
Definition: NewtonIterationBlackoilInterface.hpp:31
const GasPvt & gasProps() const
Direct access to lower-level gas pvt props.
Definition: BlackoilPropsAdFromDeck.hpp:443
This class implements the AD-adapted fluid interface for three-phase black-oil.
Definition: BlackoilPropsAdFromDeck.hpp:61
A model implementation for the transport equation in three-phase black oil.
Definition: BlackoilTransportModel.hpp:35