24 template <
typename TypeTag>
25 BlackoilAquiferModel<TypeTag>::BlackoilAquiferModel(Simulator& simulator)
26 : simulator_(simulator)
29 using Grid = std::remove_const_t<std::remove_reference_t<decltype(simulator.vanguard().grid())>>;
30 static_assert(SupportsFaceTag<Grid>::value,
"Grid has to support assumptions about face tag.");
35 template <
typename TypeTag>
37 BlackoilAquiferModel<TypeTag>::initialSolutionApplied()
39 for (
auto& aquifer : aquifers)
40 aquifer->initialSolutionApplied();
43 template <
typename TypeTag>
45 BlackoilAquiferModel<TypeTag>::initFromRestart(
const data::Aquifers& aquiferSoln)
47 for (
auto& aquifer : this->aquifers)
48 aquifer->initFromRestart(aquiferSoln);
51 template <
typename TypeTag>
53 BlackoilAquiferModel<TypeTag>::beginEpisode()
56 template <
typename TypeTag>
58 BlackoilAquiferModel<TypeTag>::beginIteration()
61 template <
typename TypeTag>
63 BlackoilAquiferModel<TypeTag>::beginTimeStep()
65 for (
auto& aquifer : aquifers)
66 aquifer->beginTimeStep();
69 template <
typename TypeTag>
70 template <
class Context>
72 BlackoilAquiferModel<TypeTag>::addToSource(RateVector& rates,
73 const Context& context,
75 unsigned timeIdx)
const
77 for (
auto& aquifer : aquifers)
78 aquifer->addToSource(rates, context, spaceIdx, timeIdx);
81 template <
typename TypeTag>
83 BlackoilAquiferModel<TypeTag>::addToSource(RateVector& rates,
84 unsigned globalSpaceIdx,
85 unsigned timeIdx)
const
87 for (
auto& aquifer : aquifers)
88 aquifer->addToSource(rates, globalSpaceIdx, timeIdx);
91 template <
typename TypeTag>
93 BlackoilAquiferModel<TypeTag>::endIteration()
96 template <
typename TypeTag>
98 BlackoilAquiferModel<TypeTag>::endTimeStep()
100 for (
auto& aquifer : aquifers) {
101 aquifer->endTimeStep();
102 using NumAq = AquiferNumerical<TypeTag>;
103 NumAq* num =
dynamic_cast<NumAq*
>(aquifer.get());
105 this->simulator_.vanguard().grid().comm().barrier();
109 template <
typename TypeTag>
111 BlackoilAquiferModel<TypeTag>::endEpisode()
114 template <
typename TypeTag>
115 template <
class Restarter>
117 BlackoilAquiferModel<TypeTag>::serialize(Restarter& )
120 throw std::logic_error(
"BlackoilAquiferModel::serialize() is not yet implemented");
123 template <
typename TypeTag>
124 template <
class Restarter>
126 BlackoilAquiferModel<TypeTag>::deserialize(Restarter& )
129 throw std::logic_error(
"BlackoilAquiferModel::deserialize() is not yet implemented");
133 template <
typename TypeTag>
135 BlackoilAquiferModel<TypeTag>::init()
137 const auto& aquifer = this->simulator_.vanguard().eclState().aquifer();
139 if (!aquifer.active()) {
143 const auto& connections = aquifer.connections();
144 for (
const auto& aq : aquifer.ct()) {
145 if (!connections.hasAquiferConnections(aq.aquiferID)) {
146 auto msg = fmt::format(
"No valid connections for Carter-Tracy aquifer {}, aquifer {} will be ignored.",
147 aq.aquiferID, aq.aquiferID);
148 OpmLog::warning(msg);
151 auto aqf = std::make_unique<AquiferCarterTracy<TypeTag>>(connections.getConnections(aq.aquiferID),
152 this->simulator_, aq);
153 aquifers.push_back(std::move(aqf));
156 for (
const auto& aq : aquifer.fetp()) {
157 if (!connections.hasAquiferConnections(aq.aquiferID)) {
158 auto msg = fmt::format(
"No valid connections for Fetkovich aquifer {}, aquifer {} will be ignored.",
159 aq.aquiferID, aq.aquiferID);
160 OpmLog::warning(msg);
163 auto aqf = std::make_unique<AquiferFetkovich<TypeTag>>(connections.getConnections(aq.aquiferID),
164 this->simulator_, aq);
165 aquifers.push_back(std::move(aqf));
168 if (aquifer.hasNumericalAquifer()) {
169 const auto& num_aquifers = aquifer.numericalAquifers().aquifers();
170 for ([[maybe_unused]]
const auto& [
id, aqu] : num_aquifers) {
171 auto aqf = std::make_unique<AquiferNumerical<TypeTag>>(aqu, this->simulator_);
172 aquifers.push_back(std::move(aqf));
177 template<
typename TypeTag>
178 data::Aquifers BlackoilAquiferModel<TypeTag>::aquiferData()
const
181 for (
const auto& aqu : this->aquifers)
182 data.insert_or_assign(aqu->aquiferID(), aqu->aquiferData());
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27