StandardWellEval: use Scalar type

This commit is contained in:
Arne Morten Kvarving 2024-02-20 12:59:31 +01:00
parent 5636721bab
commit 21c2352c44
2 changed files with 17 additions and 17 deletions

View File

@ -99,13 +99,13 @@ template<class FluidSystem, class Indices>
ConvergenceReport ConvergenceReport
StandardWellEval<FluidSystem,Indices>:: StandardWellEval<FluidSystem,Indices>::
getWellConvergence(const WellState<Scalar>& well_state, getWellConvergence(const WellState<Scalar>& well_state,
const std::vector<double>& B_avg, const std::vector<Scalar>& B_avg,
const double maxResidualAllowed, const Scalar maxResidualAllowed,
const double tol_wells, const Scalar tol_wells,
const double relaxed_tolerance_flow, const Scalar relaxed_tolerance_flow,
const bool relax_tolerance, const bool relax_tolerance,
const bool well_is_stopped, const bool well_is_stopped,
std::vector<double>& res, std::vector<Scalar>& res,
DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
res.resize(this->primary_variables_.numWellEq()); res.resize(this->primary_variables_.numWellEq());
@ -114,7 +114,7 @@ getWellConvergence(const WellState<Scalar>& well_state,
res[eq_idx] = std::abs(this->linSys_.residual()[0][eq_idx]); res[eq_idx] = std::abs(this->linSys_.residual()[0][eq_idx]);
} }
std::vector<double> well_flux_residual(baseif_.numComponents()); std::vector<Scalar> well_flux_residual(baseif_.numComponents());
// Finish computation // Finish computation
for (int compIdx = 0; compIdx < baseif_.numComponents(); ++compIdx ) for (int compIdx = 0; compIdx < baseif_.numComponents(); ++compIdx )
@ -157,7 +157,7 @@ getWellConvergence(const WellState<Scalar>& well_state,
// for BHP or THP controlled wells, we need to make sure the flow direction is correct // for BHP or THP controlled wells, we need to make sure the flow direction is correct
if (!well_is_stopped && baseif_.isPressureControlled(well_state)) { if (!well_is_stopped && baseif_.isPressureControlled(well_state)) {
// checking the flow direction // checking the flow direction
const double sign = baseif_.isProducer() ? -1. : 1.; const Scalar sign = baseif_.isProducer() ? -1. : 1.;
const auto weight_total_flux = this->primary_variables_.value(PrimaryVariables::WQTotal) * sign; const auto weight_total_flux = this->primary_variables_.value(PrimaryVariables::WQTotal) * sign;
constexpr int dummy_phase = -1; constexpr int dummy_phase = -1;
if (weight_total_flux < 0.) { if (weight_total_flux < 0.) {
@ -172,8 +172,8 @@ getWellConvergence(const WellState<Scalar>& well_state,
template<class FluidSystem, class Indices> template<class FluidSystem, class Indices>
void void
StandardWellEval<FluidSystem,Indices>:: StandardWellEval<FluidSystem,Indices>::
init(std::vector<double>& perf_depth, init(std::vector<Scalar>& perf_depth,
const std::vector<double>& depth_arg, const std::vector<Scalar>& depth_arg,
const int num_cells, const int num_cells,
const bool has_polymermw) const bool has_polymermw)
{ {

View File

@ -79,17 +79,17 @@ protected:
void computeAccumWell(); void computeAccumWell();
ConvergenceReport getWellConvergence(const WellState<Scalar>& well_state, ConvergenceReport getWellConvergence(const WellState<Scalar>& well_state,
const std::vector<double>& B_avg, const std::vector<Scalar>& B_avg,
const double maxResidualAllowed, const Scalar maxResidualAllowed,
const double tol_wells, const Scalar tol_wells,
const double relaxed_tolerance_flow, const Scalar relaxed_tolerance_flow,
const bool relax_tolerance, const bool relax_tolerance,
const bool well_is_stopped, const bool well_is_stopped,
std::vector<double>& res, std::vector<Scalar>& res,
DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
void init(std::vector<double>& perf_depth, void init(std::vector<Scalar>& perf_depth,
const std::vector<double>& depth_arg, const std::vector<Scalar>& depth_arg,
const int num_cells, const int num_cells,
const bool has_polymermw); const bool has_polymermw);
@ -101,7 +101,7 @@ protected:
PrimaryVariables primary_variables_; //!< Primary variables for well PrimaryVariables primary_variables_; //!< Primary variables for well
// the saturations in the well bore under surface conditions at the beginning of the time step // the saturations in the well bore under surface conditions at the beginning of the time step
std::vector<double> F0_; std::vector<Scalar> F0_;
StandardWellEquations<Scalar,Indices::numEq> linSys_; //!< Linear equation system StandardWellEquations<Scalar,Indices::numEq> linSys_; //!< Linear equation system
StdWellConnections connections_; //!< Connection level values StdWellConnections connections_; //!< Connection level values