Loading...
Searching...
No Matches
SingleWellState.hpp
/*
Copyright 2021 Equinor ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_SINGLE_WELL_STATE_HEADER_INCLUDED
#define OPM_SINGLE_WELL_STATE_HEADER_INCLUDED
#include <functional>
#include <vector>
#include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
#include <opm/input/eclipse/Schedule/Events.hpp>
#include <opm/material/fluidsystems/PhaseUsageInfo.hpp>
#include <opm/simulators/wells/SegmentState.hpp>
#include <opm/simulators/wells/PerfData.hpp>
#include <opm/simulators/wells/ParallelWellInfo.hpp>
#include <opm/simulators/wells/ALQState.hpp>
namespace Opm {
template<class Scalar> struct PerforationData;
class SummaryState;
class Well;
template<typename Scalar, typename IndexTraits>
class SingleWellState {
public:
static const int waterPhaseIdx = PhaseUsageInfo<IndexTraits>::waterPhaseIdx;
static const int oilPhaseIdx = PhaseUsageInfo<IndexTraits>::oilPhaseIdx;
static const int gasPhaseIdx = PhaseUsageInfo<IndexTraits>::gasPhaseIdx;
SingleWellState(const std::string& name,
const ParallelWellInfo<Scalar>& pinfo,
const PhaseUsageInfo<IndexTraits>& pu,
bool is_producer,
Scalar presssure_first_connection,
const std::vector<PerforationData<Scalar>>& perf_input,
Scalar temp);
static SingleWellState serializationTestObject(const ParallelWellInfo<Scalar>& pinfo);
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(name);
serializer(status);
serializer(producer);
serializer(bhp);
serializer(thp);
serializer(temperature);
serializer(efficiency_scaling_factor);
serializer(phase_mixing_rates);
serializer(well_potentials);
serializer(productivity_index);
serializer(implicit_ipr_a);
serializer(implicit_ipr_b);
serializer(surface_rates);
serializer(reservoir_rates);
serializer(prev_surface_rates);
serializer(trivial_group_target);
serializer(segments);
serializer(events);
serializer(injection_cmode);
serializer(production_cmode);
serializer(filtrate_conc);
serializer(perf_data);
serializer(primaryvar);
serializer(alq_state);
serializer(group_target);
}
bool operator==(const SingleWellState&) const;
std::string name;
std::reference_wrapper<const ParallelWellInfo<Scalar>> parallel_info;
WellStatus status{WellStatus::OPEN};
bool producer;
PhaseUsageInfo<IndexTraits> pu;
Scalar bhp{0};
Scalar thp{0};
Scalar temperature{0};
Scalar efficiency_scaling_factor{1.0};
// filtration injection concentration
Scalar filtrate_conc{0};
std::array<Scalar,4> phase_mixing_rates{};
enum RateIndices {
dissolved_gas = 0,
dissolved_gas_in_water = 1,
vaporized_oil = 2,
vaporized_water = 3
};
std::vector<Scalar> well_potentials;
std::vector<Scalar> productivity_index;
std::vector<Scalar> implicit_ipr_a;
std::vector<Scalar> implicit_ipr_b;
std::vector<Scalar> surface_rates;
std::vector<Scalar> reservoir_rates;
std::vector<Scalar> prev_surface_rates;
PerfData<Scalar> perf_data;
bool trivial_group_target;
std::optional<Scalar> group_target;
SegmentState<Scalar> segments;
Events events;
WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
WellProducerCMode production_cmode{WellProducerCMode::CMODE_UNDEFINED};
std::vector<Scalar> primaryvar;
ALQState<Scalar> alq_state;
void reset_connection_factors(const std::vector<PerforationData<Scalar>>& new_perf_data);
void update_producer_targets(const Well& ecl_well, const SummaryState& st);
void update_injector_targets(const Well& ecl_well, const SummaryState& st);
void update_type_and_targets(const Well& ecl_well, const SummaryState& st);
bool updateStatus(WellStatus status);
void init_timestep(const SingleWellState& other);
void shut();
void stop();
void open();
// The sum_xxx_rates() functions sum over all connection rates of pertinent
// types. In the case of distributed wells this involves an MPI
// communication.
Scalar sum_solvent_rates() const;
Scalar sum_polymer_rates() const;
Scalar sum_brine_rates() const;
Scalar sum_microbial_rates() const;
Scalar sum_oxygen_rates() const;
Scalar sum_urea_rates() const;
Scalar sum_wat_mass_rates() const;
Scalar sum_filtrate_rate() const;
Scalar sum_filtrate_total() const;
private:
Scalar sum_connection_rates(const std::vector<Scalar>& connection_rates) const;
};
}
#endif
Opm::ALQState
Definition ALQState.hpp:32
Opm::ParallelWellInfo
Class encapsulating some information about parallel wells.
Definition ParallelWellInfo.hpp:198
Opm::PerfData
Definition PerfData.hpp:34
Opm::PhaseUsageInfo
Definition GasLiftGroupInfo.hpp:37
Opm::SegmentState
Definition SegmentState.hpp:34
Opm::SingleWellState::reset_connection_factors
void reset_connection_factors(const std::vector< PerforationData< Scalar > > &new_perf_data)
Special purpose method to support dynamically rescaling a well's CTFs through WELPI.
Definition SingleWellState.cpp:149
Opm::SingleWellState::update_type_and_targets
void update_type_and_targets(const Well &ecl_well, const SummaryState &st)
update the type of the well and the targets.
Definition SingleWellState.cpp:357
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
Opm::PerforationData
Static data associated with a well perforation.
Definition PerforationData.hpp:30