FlowProblemComp.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 Copyright 2024, 2026 SINTEF Digital
5
6 This file is part of the Open Porous Media project (OPM).
7
8 OPM is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 OPM is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with OPM. If not, see <http://www.gnu.org/licenses/>.
20
21 Consult the COPYING file in the top-level source directory of this
22 module for the precise wording of the license and the list of
23 copyright holders.
24*/
30#ifndef OPM_FLOW_PROBLEM_COMP_HPP
31#define OPM_FLOW_PROBLEM_COMP_HPP
32
33
43
44#include <opm/grid/LookUpData.hh>
45
46#include <opm/material/constraintsolvers/PTFlashMethod.hpp>
47#include <opm/material/fluidstates/CompositionalFluidState.hpp>
48
49#include <opm/material/thermal/EclThermalLawManager.hpp>
50
51#include <opm/common/OpmLog/OpmLog.hpp>
52
53#include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquifers.hpp>
54#include <opm/input/eclipse/Schedule/BCState.hpp>
55#include <opm/input/eclipse/Schedule/RPTConfig.hpp>
56
57#include <dune/grid/common/rangegenerators.hh>
58
59#include <fmt/format.h>
60
61#include <algorithm>
62#include <array>
63#include <cmath>
64#include <cstdint>
65#include <functional>
66#include <limits>
67#include <optional>
68#include <stdexcept>
69#include <string>
70#include <string_view>
71#include <utility>
72#include <vector>
73
74namespace Opm::Parameters {
75
76// Treat explicit compositional saturations as given before the hydrocarbon
77// flash and rescale SWAT accordingly. By default, keep the input SWAT.
78struct NormalizeExplicitSwat { static constexpr bool value = false; };
79
80} // namespace Opm::Parameters
81
82namespace Opm {
83
90template <class TypeTag>
91class FlowProblemComp : public FlowProblem<TypeTag>
92{
93 // TODO: the naming of the Types will be adjusted
95
96 using typename FlowProblemType::Scalar;
97 using typename FlowProblemType::Simulator;
98 using typename FlowProblemType::GridView;
99 using typename FlowProblemType::FluidSystem;
100 using typename FlowProblemType::Vanguard;
101
102 // might not be needed
105
108
112
113 using typename FlowProblemType::Indices;
116 using typename FlowProblemType::Evaluation;
118 using typename FlowProblemType::MaterialLaw;
119 using typename FlowProblemType::RateVector;
120
121 using InitialFluidState = CompositionalFluidState<Scalar, FluidSystem>;
123
124public:
127
131 static void registerParameters()
132 {
134 Parameters::SetDefault<Parameters::InputSkipMode>("300");
135
137
138 // tighter tolerance is needed for compositional modeling here
139 Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-7);
140 // the CPR solves of compositional systems converge far more reliably
141 // when the fine smoother also runs before the pressure correction.
142 // Only ISTLSolver and its runtime proxy register the parameter;
143 // flowexp_comp uses another linear solver.
145 if constexpr (std::is_same_v<Backend, ISTLSolver<TypeTag>>
146 || std::is_same_v<Backend, ISTLSolverRuntimeOptionProxy<TypeTag>>) {
147 Parameters::SetDefault<Parameters::CprPreSmooth>(1);
148 }
149
150 Parameters::Register<Parameters::NormalizeExplicitSwat>(
151 "Treat the explicit initial saturations of compositional runs as "
152 "saturations before the hydrocarbon flash: SGAS and the oil "
153 "saturation 1 - SWAT - SGAS each hold their input composition at "
154 "the vapour or liquid equation-of-state root, and water and the "
155 "flashed phases are then rescaled to fill the pore volume. When "
156 "disabled (the default), the input SWAT is retained.");
158 }
159
161 unsigned eosRegionIndex(const unsigned globalDofIdx) const
162 { return eosnum_.empty() ? 0 : eosnum_[globalDofIdx]; }
163
167 explicit FlowProblemComp(Simulator& simulator)
168 : FlowProblemType(simulator)
169 {
170 eclWriter_ = std::make_unique<EclWriterType>(simulator);
171 enableEclOutput_ = Parameters::Get<Parameters::EnableEclOutput>();
172 }
173
178 {
179 FlowProblemType::finishInit();
180
181 auto& simulator = this->simulator();
182 const bool transmissibilitiesFinished =
183 this->prepareTransmissibilityOutput_(*eclWriter_, enableEclOutput_);
184 if (!transmissibilitiesFinished) {
186 }
187
188 const auto& eclState = simulator.vanguard().eclState();
189 const auto& schedule = simulator.vanguard().schedule();
191
192 this->initFluidSystem_();
193 if (eclState.getSimulationConfig().rock_config().active()) {
194 throw std::runtime_error("Rock compaction (ROCKCOMP) is not supported "
195 "by compositional modeling yet");
196 }
197 if (eclState.getSimulationConfig().bcconfig().size() > 0) {
198 throw std::runtime_error("Boundary conditions (BCCON) are not supported "
199 "by compositional modeling yet");
200 }
201 this->updateNum("EOSNUM", eosnum_, eclState.getTableManager().getTabdims().getNumEosRes());
203
204 // write the static output files (EGRID, INIT)
205 if (enableEclOutput_) {
206 eclWriter_->writeInit();
207 }
208
209 const auto& initconfig = eclState.getInitConfig();
210 if (initconfig.restartRequested())
212 else
213 this->readInitialCondition_();
214
216
217 if constexpr (getPropValue<TypeTag, Properties::EnablePolymer>()) {
218 const auto& vanguard = this->simulator().vanguard();
219 const auto& gridView = vanguard.gridView();
220 int numElements = gridView.size(/*codim=*/0);
221 this->polymer_.maxAdsorption.resize(numElements, 0.0);
222 }
223
224 /* readBoundaryConditions_();
225
226 // compute and set eq weights based on initial b values
227 computeAndSetEqWeights_();
228
229 if (enableDriftCompensation_) {
230 drift_.resize(this->model().numGridDof());
231 drift_ = 0.0;
232 } */
233
234 // TODO: check wether the following can work with compostional
235 if (this->enableVtkOutput_() && eclState.getIOConfig().initOnly()) {
236 simulator.setTimeStepSize(0.0);
238 }
239
240 // after finishing the initialization and writing the initial solution, we move
241 // to the first "real" episode/report step
242 // for restart the episode index and start is already set
243 if (!initconfig.restartRequested()) {
244 simulator.startNextEpisode(schedule.seconds(1));
245 simulator.setEpisodeIndex(0);
246 simulator.setTimeStepIndex(0);
247 }
248 }
249
254 {
256
257 // Defaulted threshold pressures are taken from the initial solution.
258 this->thresholdPressures_.finishInit();
259
260 reportTwoPhaseEquilCells_();
261 }
262
266 void endTimeStep() override
267 {
269
270 // after the solution is updated, the values in output module also needs to be updated
271 this->eclWriter_->mutableOutputModule().invalidateLocalData();
272
273 // For CpGrid with LGRs, ecl/vtk output is not supported yet.
274 const auto& grid = this->simulator().vanguard().gridView().grid();
275
276 using GridType = std::remove_cv_t<std::remove_reference_t<decltype(grid)>>;
277 constexpr bool isCpGrid = std::is_same_v<GridType, Dune::CpGrid>;
278 if (!isCpGrid || (grid.maxLevel() == 0)) {
279 this->eclWriter_->evalSummaryState(! this->episodeWillBeOver());
280 }
281 }
282
283 void writeReports(const SimulatorTimer& timer) {
284 if (enableEclOutput_){
285 eclWriter_->writeReports(timer);
286 }
287 }
288
293 void writeOutput(bool verbose) override
294 {
296
297 if (! this->enableEclOutput_) {
298 return;
299 }
300
301 const auto isSubStep = !this->episodeWillBeOver();
302
303 if (!isSubStep || Parameters::Get<Parameters::EnableWriteAllSolutions>()) {
304 auto localCellData = data::Solution {};
305
306 this->eclWriter_->writeOutput(std::move(localCellData), isSubStep,
307 this->simulator().vanguard().schedule()
308 .exitStatus().has_value());
309 }
310 }
311
317 template <class Context>
318 void boundary(BoundaryRateVector& values,
319 const Context& context,
320 unsigned spaceIdx,
321 unsigned /* timeIdx */) const
322 {
323 OPM_TIMEBLOCK_LOCAL(eclProblemBoundary, Subsystem::Assembly);
324 if (!context.intersection(spaceIdx).boundary())
325 return;
326
327 values.setNoFlow();
328 }
329
331 std::pair<BCType, RateVector>
332 boundaryCondition(const unsigned int /* globalSpaceIdx */, const int /* directionId */) const
333 {
334 return { BCType::NONE, RateVector(0.0) };
335 }
336
337 typename IntensiveQuantities::ScalarFluidState
338 boundaryFluidState(unsigned /* globalDofIdx */, const int /* directionId */) const
339 {
340 throw std::logic_error("Boundary conditions are not supported "
341 "by compositional modeling yet");
342 }
343
350 template <class Context>
351 void initial(PrimaryVariables& values, const Context& context, unsigned spaceIdx, unsigned timeIdx) const
352 {
353 const unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
354 const unsigned eosRegionIdx = eosRegionIndex(globalDofIdx);
355 const auto& initial_fs = initialFluidStates_[globalDofIdx];
356 Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
357 for (unsigned p = 0; p < numPhases; ++p) { // TODO: assuming the phaseidx continuous
358 // pressure
359 fs.setPressure(p, initial_fs.pressure(p));
360
361 // saturation
362 fs.setSaturation(p, initial_fs.saturation(p));
363
364 // temperature
365 fs.setTemperature(initial_fs.temperature(p));
366 }
367
368
369 if (!zmf_initialization_) {
370 for (unsigned p = 0; p < numPhases; ++p) {
371 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
372 fs.setMoleFraction(p, compIdx, initial_fs.moleFraction(p, compIdx));
373 }
374 }
375
376 {
377 typename FluidSystem::template ParameterCache<Scalar> paramCache(eosRegionIdx);
378 paramCache.updatePhase(fs, FluidSystem::oilPhaseIdx);
379 paramCache.updatePhase(fs, FluidSystem::gasPhaseIdx);
380 fs.setDensity(FluidSystem::oilPhaseIdx, FluidSystem::density(fs, paramCache, FluidSystem::oilPhaseIdx));
381 fs.setDensity(FluidSystem::gasPhaseIdx, FluidSystem::density(fs, paramCache, FluidSystem::gasPhaseIdx));
382 }
383 // determine the component fractions
384 Dune::FieldVector<Scalar, numComponents> z(0.0);
385 Scalar sumMoles = 0.0;
386 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
387 if (Indices::waterEnabled && phaseIdx == static_cast<unsigned int>(waterPhaseIdx)){
388 continue;
389 }
390 const auto saturation = fs.saturation(phaseIdx);
391 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
392 Scalar tmp = fs.molarity(phaseIdx, compIdx) * saturation;
393 tmp = max(tmp, 1e-8);
394 z[compIdx] += tmp;
395 sumMoles += tmp;
396 }
397 }
398 z /= sumMoles;
399 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
400 fs.setMoleFraction(compIdx, z[compIdx]);
401 }
402 } else {
403 // TODO: should we normalize the input?
404 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
405 fs.setMoleFraction(compIdx, initial_fs.moleFraction(compIdx));
406 }
407 }
408
409 // Set initial K and L
410 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
411 const auto& Ktmp = fs.wilsonK_(compIdx, eosRegionIdx);
412 fs.setKvalue(compIdx, Ktmp);
413 }
414
415 const Scalar& Ltmp = -1.0;
416 fs.setLvalue(Ltmp);
417
418 values.assignNaive(fs);
419 }
420
421 void addToSourceDense(RateVector&, unsigned, unsigned) const override
422 {
423 // we do nothing for now
424 }
425
426 const InitialFluidState& initialFluidState(unsigned globalDofIdx) const
427 { return initialFluidStates_[globalDofIdx]; }
428
429 std::vector<InitialFluidState>& initialFluidStates()
430 { return initialFluidStates_; }
431
432 const std::vector<InitialFluidState>& initialFluidStates() const
433 { return initialFluidStates_; }
434
436 { return *eclWriter_; }
437
439 { return *eclWriter_; }
440
442 { return eclWriter_->setSubStepReport(report); }
443
445 { return eclWriter_->setSimulationReport(report); }
446
448 {
449 OPM_TIMEBLOCK(finalizeOutput);
450 eclWriter_.reset();
451 }
452
453 // TODO: do we need this one?
454 template<class Serializer>
455 void serializeOp(Serializer& serializer)
456 {
457 serializer(static_cast<FlowProblemType&>(*this));
458 serializer(*eclWriter_);
459 }
460protected:
461
462 void updateExplicitQuantities_(int /* episodeIdx*/, int /* timeStepSize */, bool /* first_step_after_restart */) override
463 {
464 // we do nothing here for now
465 }
466
468 {
469 const auto& simulator = this->simulator();
470 const auto& vanguard = simulator.vanguard();
471 const auto& eclState = vanguard.eclState();
472
473 // Zero-based equilibration region of every cell (EQLNUM, or region 0).
474 // EQLNUM is given on the unrefined input grid while the equilibration
475 // works on the leaf grid, so a refined cell takes its parent's region;
476 // without local refinement the mapping is the identity.
477 std::vector<int> eqlnum(this->model().numGridDof(), 0);
478 if (eclState.fieldProps().has_int("EQLNUM")) {
480 lookUpData(vanguard.gridView());
481 eqlnum = lookUpData.template assignFieldPropsIntOnLeaf<int>(
482 eclState.fieldProps(), "EQLNUM", /*needsTranslation=*/true);
483 }
484
485 // The water saturation endpoints are selected by SATNUM and scaled per
486 // cell, so they are read here rather than from the equilibration region.
487 std::vector<Scalar> connateWater, maxWater;
488 if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
489 const auto numDof = this->model().numGridDof();
490 connateWater.resize(numDof);
491 maxWater.resize(numDof);
492 for (std::size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
493 const auto& eps = this->materialLawManager()
494 .oilWaterScaledEpsInfoDrainage(static_cast<int>(dofIdx));
495 connateWater[dofIdx] = eps.Swl;
496 maxWater[dofIdx] = eps.Swu;
497 }
498 }
499
501 eclState,
502 eosnum_,
503 vanguard.cellCenterDepths(),
504 eqlnum,
505 this->pvtnum_,
506 vanguard.gridView().comm(),
507 this->gravity()[dimWorld - 1],
508 this->numPressurePointsEquil(),
509 connateWater,
510 maxWater);
511
512 const auto& rptsol = vanguard.schedule().initialReportConfiguration();
513 if (rptsol.has_value() && rptsol->contains("SOLVD") && (rptsol->at("SOLVD") > 0)) {
514 reportCompositionVersusDepth_(initialState, eqlnum);
515 }
516
517 initialFluidStates_ = std::move(initialState.fluidStates());
518 twoPhaseCheckRegions_ = std::move(initialState.twoPhaseCheckRegions());
519 // The current flash has one pressure for all phases. Adapt the
520 // independent equilibrium columns here, using the water column below
521 // the contact. Once phase-pressure differences are supported by the
522 // flash, the equilibrated phase pressures can be used directly.
523 for (std::size_t cell = 0; cell < initialFluidStates_.size(); ++cell) {
524 for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
525 initialFluidStates_[cell].setPressure(phaseIdx,
526 initialState.referencePressures()[cell]);
527 }
528 }
530 // The primary variables are formed from the total composition; see initial().
531 zmf_initialization_ = true;
532 }
533
534 // Numerical aquifer cells start full of water, at the AQUNUM pressure when
535 // one is given. Their mole fractions are not touched: the cell keeps the
536 // total composition equilibrated at its depth. With no hydrocarbon in the
537 // cell that composition has no effect, but the flash still needs a valid one.
539 {
540 const auto& vanguard = this->simulator().vanguard();
541 const auto aquiferCells
542 = vanguard.eclState().aquifer().numericalAquifers().allAquiferCells();
543 if (aquiferCells.empty()) {
544 return;
545 }
546
547 if (!FluidSystem::phaseIsActive(waterPhaseIdx)) {
548 throw std::logic_error("Water phase has to be active for numerical aquifer case");
549 }
550
551 for (std::size_t cell = 0; cell < initialFluidStates_.size(); ++cell) {
552 const auto pos = aquiferCells.find(vanguard.cartesianIndex(cell));
553 if (pos == aquiferCells.end()) {
554 continue;
555 }
556
557 const auto* aquCell = pos->second;
558 auto& fs = initialFluidStates_[cell];
559 fs.setSaturation(oilPhaseIdx, 0.0);
560 fs.setSaturation(gasPhaseIdx, 0.0);
561 fs.setSaturation(waterPhaseIdx, 1.0);
562 if (aquCell->init_pressure) {
563 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
564 fs.setPressure(phaseIdx, *aquCell->init_pressure);
565 }
566 }
567
568 OpmLog::info(fmt::format("FOR AQUIFER CELL AT ({}, {}, {}) OF NUMERICAL "
569 "AQUIFER {}, WATER SATURATION IS SET TO BE UNITY",
570 aquCell->I + 1,
571 aquCell->J + 1,
572 aquCell->K + 1,
573 aquCell->aquifer_id));
574 }
575 }
576
578 {
579 throw std::logic_error("Restarting is not supported by compositional modeling yet");
580 }
581
583 {
585 }
586
588 {
589 const auto& simulator = this->simulator();
590 const auto& vanguard = simulator.vanguard();
591 const auto& eclState = vanguard.eclState();
592 const auto& fp = eclState.fieldProps();
593 const bool has_pressure = fp.has_double("PRESSURE");
594 if (!has_pressure)
595 throw std::runtime_error("The ECL input file requires the presence of the PRESSURE "
596 "keyword if the model is initialized explicitly");
597
598 const bool has_xmf = fp.has_double("XMF");
599 const bool has_ymf = fp.has_double("YMF");
600 const bool has_zmf = fp.has_double("ZMF");
601 if ( !has_zmf && !(has_xmf && has_ymf) ) {
602 throw std::runtime_error("The ECL input file requires the presence of ZMF or XMF and YMF "
603 "keyword if the model is initialized explicitly");
604 }
605
606 if (has_zmf && (has_xmf || has_ymf)) {
607 throw std::runtime_error("The ECL input file can not handle explicit initialization "
608 "with both ZMF and XMF or YMF");
609 }
610
611 if (has_xmf != has_ymf) {
612 throw std::runtime_error("The ECL input file needs XMF and YMF combined to do the explicit "
613 "initializtion when using XMF or YMF");
614 }
615
616 std::size_t numDof = this->model().numGridDof();
617
618 initialFluidStates_.resize(numDof);
619
620 const bool water_active = FluidSystem::phaseIsActive(waterPhaseIdx);
621 const bool gas_active = FluidSystem::phaseIsActive(gasPhaseIdx);
622 const bool oil_active = FluidSystem::phaseIsActive(oilPhaseIdx);
623 const std::array activePhases {water_active, oil_active, gas_active};
624 constexpr std::array saturationKeywords {"SWAT", "SOIL", "SGAS"};
625 std::array<const std::vector<double>*, 3> saturationData {};
626 bool allActiveSaturationsSupplied = true;
627 for (std::size_t phase = 0; phase < activePhases.size(); ++phase) {
628 if (!activePhases[phase]) {
629 continue;
630 }
631 if (fp.has_double(saturationKeywords[phase])) {
632 saturationData[phase] = &fp.get_double(saturationKeywords[phase]);
633 } else {
634 allActiveSaturationsSupplied = false;
635 }
636 }
637
638 const auto& pressureData = fp.get_double("PRESSURE");
639
640 // Without TEMPI in the deck, this is the temperature from RTEMPVD or RTEMP.
641 const auto& tempiData = fp.get_double("TEMPI");
642
643 const auto cellName = [&vanguard](const std::size_t dofIdx) {
644 std::array<int, 3> ijk;
645 vanguard.cartesianCoordinate(dofIdx, ijk);
646 return fmt::format("cell ({}, {}, {})", ijk[0] + 1, ijk[1] + 1, ijk[2] + 1);
647 };
648
649 // Invalid input on one rank must not leave the others entering the
650 // collective operations in normalizeExplicitSwat_().
651 const auto& comm = vanguard.grid().comm();
652 DeferredLogger deferredLogger;
653 std::vector<bool> ownedCells;
654 if (allActiveSaturationsSupplied) {
655 ownedCells.resize(numDof, false);
656 for (const auto& element : elements(vanguard.gridView(), Dune::Partitions::interior)) {
657 ownedCells[this->elementMapper().index(element)] = true;
658 }
659 }
660 std::uint64_t normalizedCellCount = 0;
661 double maxNormalizationDeviation = 0.0;
663 for (std::size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
664 auto& dofFluidState = initialFluidStates_[dofIdx];
665 // dofFluidState.setPvtRegionIndex(pvtRegionIndex(dofIdx));
666
667 std::array<std::optional<double>, 3> supplied;
668 for (std::size_t phase = 0; phase < saturationData.size(); ++phase) {
669 if (saturationData[phase]) {
670 supplied[phase] = (*saturationData[phase])[dofIdx];
671 }
672 }
674 try {
675 completed = completeExplicitSaturations(supplied, activePhases);
676 } catch (const std::invalid_argument& error) {
677 throw std::invalid_argument("Invalid explicit saturations in "
678 + cellName(dofIdx) + ": " + error.what());
679 }
680 const auto& saturations = completed.saturations;
681 if (allActiveSaturationsSupplied && ownedCells[dofIdx]
682 && completed.normalizationDeviation > 0.0) {
683 ++normalizedCellCount;
684 maxNormalizationDeviation
685 = std::max(maxNormalizationDeviation, completed.normalizationDeviation);
686 }
687
688 const Scalar temperatureLoc = tempiData[dofIdx];
689 if (!std::isfinite(temperatureLoc) || temperatureLoc <= 0) {
690 throw std::invalid_argument(fmt::format("Invalid temperature in {}: "
691 "expected a finite, positive value, got {} K",
692 cellName(dofIdx), temperatureLoc));
693 }
694 dofFluidState.setTemperature(temperatureLoc);
695
696 if (gas_active) {
697 dofFluidState.setSaturation(FluidSystem::gasPhaseIdx,
698 saturations[2]);
699 }
700 if (oil_active) {
701 dofFluidState.setSaturation(FluidSystem::oilPhaseIdx,
702 saturations[1]);
703 }
704 if (water_active) {
705 dofFluidState.setSaturation(FluidSystem::waterPhaseIdx,
706 saturations[0]);
707 }
708
710 // set phase pressures
712 const Scalar pressure = pressureData[dofIdx]; // oil pressure (or gas pressure for water-gas system or water pressure for single phase)
713
714 // TODO: zero capillary pressure for now
715 const std::array<Scalar, numPhases> pc = {0};
716 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
717 if (!FluidSystem::phaseIsActive(phaseIdx))
718 continue;
719
720 if (Indices::oilEnabled)
721 dofFluidState.setPressure(phaseIdx, pressure + (pc[phaseIdx] - pc[oilPhaseIdx]));
722 else if (Indices::gasEnabled)
723 dofFluidState.setPressure(phaseIdx, pressure + (pc[phaseIdx] - pc[gasPhaseIdx]));
724 else if (Indices::waterEnabled)
725 // single (water) phase
726 dofFluidState.setPressure(phaseIdx, pressure);
727 }
728
729 if (has_xmf && has_ymf) {
730 const auto& xmfData = fp.get_double("XMF");
731 const auto& ymfData = fp.get_double("YMF");
732 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
733 const std::size_t data_idx = compIdx * numDof + dofIdx;
734 const Scalar xmf = xmfData[data_idx];
735 const Scalar ymf = ymfData[data_idx];
736
737 dofFluidState.setMoleFraction(FluidSystem::oilPhaseIdx, compIdx, xmf);
738 dofFluidState.setMoleFraction(FluidSystem::gasPhaseIdx, compIdx, ymf);
739 }
740 }
741
742 if (has_zmf) {
743 zmf_initialization_ = true;
744 const auto& zmfData = fp.get_double("ZMF");
745 for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
746 const std::size_t data_idx = compIdx * numDof + dofIdx;
747 const Scalar zmf = zmfData[data_idx];
748 dofFluidState.setMoleFraction(compIdx, zmf);
749
750 if (gas_active) {
751 const auto ymf = (dofFluidState.saturation(FluidSystem::gasPhaseIdx) > 0.) ? zmf : Scalar{0};
752 dofFluidState.setMoleFraction(FluidSystem::gasPhaseIdx, compIdx, ymf);
753 }
754 if (oil_active) {
755 const auto xmf = (dofFluidState.saturation(FluidSystem::oilPhaseIdx) > 0.) ? zmf : Scalar{0};
756 dofFluidState.setMoleFraction(FluidSystem::oilPhaseIdx, compIdx, xmf);
757 }
758 }
759 }
760 }
761 OPM_END_PARALLEL_TRY_CATCH_LOG(deferredLogger,
762 "FlowProblemComp: invalid explicit initial state: ",
763 comm.rank() == 0, comm);
764
765 const auto globalNormalizedCellCount = comm.sum(normalizedCellCount);
766 const auto globalMaxDeviation = comm.max(maxNormalizationDeviation);
767 if (globalNormalizedCellCount > 0 && comm.rank() == 0) {
768 OpmLog::warning(
769 "EXPLICIT_SATURATION_NORMALIZATION",
770 fmt::format("Normalized explicit saturations in {} cells; "
771 "largest absolute deviation of their input sum from 1: {:.6g}",
772 globalNormalizedCellCount,
773 globalMaxDeviation));
774 }
775
776 if (water_active && Parameters::Get<Parameters::NormalizeExplicitSwat>()) {
778 }
779 }
780
781 // The explicit saturations describe the cell before the hydrocarbon
782 // flash. SGAS and the oil saturation So = 1 - SWAT - SGAS each hold
783 // their input composition at the vapour or liquid EOS root, whatever the
784 // stable state, and with volume shift applied. After flashing the total,
785 // water and the flashed phases are rescaled to fill the pore volume:
786 //
787 // Sw = SWAT / (SWAT + n * Vm_flash), n = So / Vm_liquid + SGAS / Vm_vapour
789 {
791 // Flash as the model does, so that this converges wherever the model's flash does.
792 const Scalar flash_tolerance = Parameters::Get<Parameters::FlashTolerance<Scalar>>();
793 const int flash_verbosity = Parameters::Get<Parameters::FlashVerbosity>();
794 const auto flash_method
795 = ptFlashMethodFromString(Parameters::Get<Parameters::FlashTwoPhaseMethod>());
796 bool zmf_oil_and_gas = false;
797
798 // A failing flash on one rank must not leave the others in the reduction below.
799 const auto& comm = this->simulator().vanguard().grid().comm();
801 for (std::size_t cell = 0; cell < initialFluidStates_.size(); ++cell) {
802 auto& fs = initialFluidStates_[cell];
803 const Scalar sw_in = fs.saturation(FluidSystem::waterPhaseIdx);
804 if (sw_in <= 0.0 || sw_in >= 1.0) {
805 continue;
806 }
807 if (!zmf_oil_and_gas && zmf_initialization_
808 && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)
809 && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)
810 && fs.saturation(FluidSystem::oilPhaseIdx) > 0.0
811 && fs.saturation(FluidSystem::gasPhaseIdx) > 0.0) {
812 zmf_oil_and_gas = true;
813 }
814
815 const unsigned eos_region = eosRegionIndex(cell);
816 typename FluidSystem::template ParameterCache<Scalar> param_cache(eos_region);
817
818 // Hydrocarbon moles per unit pore volume as given. Each given phase holds its
819 // input composition, ZMF or XMF/YMF, before the flash, so this is the molar
820 // volume of that composition at the phase's own root.
821 Dune::FieldVector<Scalar, numComponents> moles(0.0);
822 Scalar total_moles = 0.0;
823 for (const unsigned phaseIdx : {FluidSystem::oilPhaseIdx, FluidSystem::gasPhaseIdx}) {
824 const Scalar saturation = fs.saturation(phaseIdx);
825 if (!FluidSystem::phaseIsActive(phaseIdx) || saturation <= 0.0) {
826 continue;
827 }
828 param_cache.updatePhase(fs, phaseIdx);
829 const Scalar phase_moles = saturation / param_cache.correctedMolarVolume(phaseIdx);
830 for (unsigned c = 0; c < numComponents; ++c) {
831 moles[c] += phase_moles * fs.moleFraction(phaseIdx, c);
832 }
833 total_moles += phase_moles;
834 }
835 if (total_moles <= 0.0) {
836 continue;
837 }
838
839 // Overall composition of the given phases, which is ZMF itself with ZMF input.
840 // Floor and renormalize it as the model does before its flash.
841 Dune::FieldVector<Scalar, numComponents> z(0.0);
842 Scalar sum_z = 0.0;
843 for (unsigned c = 0; c < numComponents; ++c) {
844 z[c] = std::max(moles[c] / total_moles, IntensiveQuantities::compositionFloor);
845 sum_z += z[c];
846 }
847
848 InitialFluidState flash_fs;
849 flash_fs.setTemperature(fs.temperature(0));
850 flash_fs.setPressure(FluidSystem::oilPhaseIdx, fs.pressure(FluidSystem::oilPhaseIdx));
851 flash_fs.setPressure(FluidSystem::gasPhaseIdx, fs.pressure(FluidSystem::gasPhaseIdx));
852 for (unsigned c = 0; c < numComponents; ++c) {
853 flash_fs.setMoleFraction(c, z[c] / sum_z);
854 flash_fs.setKvalue(c, flash_fs.wilsonK_(c, eos_region));
855 }
856 flash_fs.setLvalue(-1.0);
857 FlashSolver::flash_solve_scalar(
858 flash_fs, flash_method, flash_tolerance, eos_region, flash_verbosity);
859
860 // A single-phase result has L = 0 or 1, so only one phase counts.
861 const Scalar L = flash_fs.L();
862 Scalar vm_flash = 0.0;
863 if (L > 0.0) {
864 param_cache.updatePhase(flash_fs, FluidSystem::oilPhaseIdx);
865 vm_flash += L * param_cache.correctedMolarVolume(FluidSystem::oilPhaseIdx);
866 }
867 if (L < 1.0) {
868 param_cache.updatePhase(flash_fs, FluidSystem::gasPhaseIdx);
869 vm_flash += (1.0 - L) * param_cache.correctedMolarVolume(FluidSystem::gasPhaseIdx);
870 }
871
872 const Scalar sw = sw_in / (sw_in + total_moles * vm_flash);
873 const Scalar hc_scale = (1.0 - sw) / (1.0 - sw_in);
874
875 fs.setSaturation(FluidSystem::waterPhaseIdx, sw);
876 if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
877 fs.setSaturation(FluidSystem::gasPhaseIdx,
878 fs.saturation(FluidSystem::gasPhaseIdx) * hc_scale);
879 }
880 if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
881 fs.setSaturation(FluidSystem::oilPhaseIdx,
882 fs.saturation(FluidSystem::oilPhaseIdx) * hc_scale);
883 }
884 }
885 OPM_END_PARALLEL_TRY_CATCH("FlowProblemComp::normalizeExplicitSwat_() failed: ", comm);
886
887 if (comm.max(zmf_oil_and_gas ? 1 : 0) > 0 && comm.rank() == 0) {
888 OpmLog::warning("ZMF is given with both oil and gas saturations; both phases take "
889 "the ZMF composition when SWAT is normalized.");
890 }
891 }
892
893private:
894
897 void reportTwoPhaseEquilCells_()
898 {
899 if (!twoPhaseCheckRegions_.has_value()) {
900 return;
901 }
902
903 const auto liquidFraction = [this](const std::size_t cell) {
904 const auto& intQuants
905 = this->model().intensiveQuantities(static_cast<unsigned>(cell), /*timeIdx=*/0);
906 return getValue(intQuants.fluidState().L());
907 };
908 const auto& vanguard = this->simulator().vanguard();
909 EQUIL::Comp::reportTwoPhaseCells(*twoPhaseCheckRegions_,
910 vanguard.cellCenterDepths(),
911 liquidFraction,
912 vanguard.eclState().getInitConfig().getEquil().size(),
913 vanguard.gridView().comm());
914 twoPhaseCheckRegions_.reset();
915 }
916
924 void reportCompositionVersusDepth_(const EQUIL::Comp::InitialStateComputer<FluidSystem>& initialState,
925 const std::vector<int>& eqlnum) const
926 {
927 const auto& vanguard = this->simulator().vanguard();
928 const auto& comm = vanguard.gridView().comm();
929 const auto numRegions = vanguard.eclState().getInitConfig().getEquil().size();
930 const auto count = static_cast<int>(numRegions);
931 const auto& depths = vanguard.cellCenterDepths();
932 const auto aquiferCells =
933 vanguard.eclState().aquifer().numericalAquifers().allAquiferCells();
934
935 // Half the distance between the mean depths of a hexahedron's top and
936 // bottom faces, or between the extreme corners of another cell.
937 const auto halfThickness = [](const auto& geometry) {
938 const auto depth = [&geometry](const int corner) -> Scalar
939 { return geometry.corner(corner)[dimWorld - 1]; };
940 if (geometry.corners() == 8) {
941 Scalar topFace = 0;
942 Scalar bottomFace = 0;
943 for (int corner = 0; corner < 4; ++corner) {
944 topFace += depth(corner);
945 bottomFace += depth(corner + 4);
946 }
947 return std::abs(bottomFace - topFace) / 8;
948 }
949 Scalar shallowest = std::numeric_limits<Scalar>::max();
950 Scalar deepest = std::numeric_limits<Scalar>::lowest();
951 for (int corner = 0; corner < geometry.corners(); ++corner) {
952 shallowest = std::min(shallowest, depth(corner));
953 deepest = std::max(deepest, depth(corner));
954 }
955 return (deepest - shallowest) / 2;
956 };
957
958 // The last cell in input order represents a region, a numerical
959 // aquifer cell only if the region has no other: those rank first.
960 const auto representativeRank = [&aquiferCells,
961 numCartesian = vanguard.cartesianSize()](const auto cartesianCell)
962 {
963 return static_cast<int>(cartesianCell)
964 + (aquiferCells.contains(cartesianCell) ? 0 : numCartesian);
965 };
966
967 std::vector<Scalar> top(numRegions, std::numeric_limits<Scalar>::max());
968 std::vector<Scalar> bottom(numRegions, std::numeric_limits<Scalar>::lowest());
969 std::vector<int> lastCell(numRegions, -1);
970 for (const auto& element : elements(vanguard.gridView())) {
971 const auto cell = this->elementMapper().index(element);
972 const auto r = static_cast<std::size_t>(eqlnum[cell]);
973 const auto cartesianCell = vanguard.cartesianIndex(cell);
974 // A numerical aquifer cell sits at its aquifer depth.
975 const Scalar half = aquiferCells.contains(cartesianCell)
976 ? Scalar{0} : halfThickness(element.geometry());
977 top[r] = std::min(top[r], depths[cell] - half);
978 bottom[r] = std::max(bottom[r], depths[cell] + half);
979 lastCell[r] = std::max(lastCell[r], representativeRank(cartesianCell));
980 }
981 comm.min(top.data(), count);
982 comm.max(bottom.data(), count);
983 comm.max(lastCell.data(), count);
984
985 const bool waterActive = FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx);
986 std::vector<int> satTable(numRegions, -1);
987 std::vector<int> pvtRegion(numRegions, -1);
988 std::vector<Scalar> swl(numRegions, std::numeric_limits<Scalar>::lowest());
989 std::vector<Scalar> swu(numRegions, std::numeric_limits<Scalar>::lowest());
990 for (const auto& element : elements(vanguard.gridView())) {
991 const auto cell = this->elementMapper().index(element);
992 const auto r = static_cast<std::size_t>(eqlnum[cell]);
993 if (representativeRank(vanguard.cartesianIndex(cell)) == lastCell[r]) {
994 satTable[r] = this->materialLawManager().satnumRegionIdx(cell);
995 pvtRegion[r] = this->pvtnum_.empty() ? 0 : this->pvtnum_[cell];
996 if (waterActive) {
997 const auto& eps = this->materialLawManager().oilWaterScaledEpsInfoDrainage(cell);
998 swl[r] = eps.Swl;
999 swu[r] = eps.Swu;
1000 }
1001 }
1002 }
1003 comm.max(satTable.data(), count);
1004 comm.max(pvtRegion.data(), count);
1005 comm.max(swl.data(), count);
1006 comm.max(swu.data(), count);
1007
1008 if (comm.rank() != 0) {
1009 return;
1010 }
1011 using ReportRegion = typename EQUIL::Comp::InitialStateComputer<FluidSystem>::ReportRegion;
1012 std::vector<ReportRegion> regions(numRegions);
1013 for (std::size_t r = 0; r < numRegions; ++r) {
1014 // A region without cells is left out of the report.
1015 if (satTable[r] < 0) {
1016 continue;
1017 }
1018 regions[r] = ReportRegion{top[r], bottom[r],
1019 waterActive ? swl[r] : Scalar{0},
1020 waterActive ? swu[r] : Scalar{1},
1021 static_cast<unsigned>(pvtRegion[r])};
1022 }
1023 std::array<std::string_view, FluidSystem::numComponents> componentNames{};
1024 for (unsigned c = 0; c < componentNames.size(); ++c) {
1025 componentNames[c] = FluidSystem::componentName(c);
1026 }
1027 const auto rows = initialState.compositionVersusDepth(regions);
1028 std::string report;
1029 for (std::size_t r = 0; r < numRegions; ++r) {
1030 if (!rows[r].empty()) {
1032 r + 1, satTable[r] + 1, rows[r], componentNames,
1033 vanguard.eclState().getDeckUnitSystem());
1034 }
1035 }
1036 OpmLog::note(report);
1037 }
1038
1039 void handleSolventBC(const BCState::BCFace& /* bc */, RateVector& /* rate */) const override
1040 {
1041 throw std::logic_error("solvent is disabled for compositional modeling and you're trying to add solvent to BC");
1042 }
1043
1044 void handlePolymerBC(const BCState::BCFace& /* bc */, RateVector& /* rate */) const override
1045 {
1046 throw std::logic_error("polymer is disabled for compositional modeling and you're trying to add polymer to BC");
1047 }
1048
1049 void handleMicrBC(const BCState::BCFace& /* bc */, RateVector& /* rate */) const override
1050 {
1051 throw std::logic_error("MICP is disabled for compositional modeling and you're trying to add microbes to BC");
1052 }
1053
1054 void handleOxygBC(const BCState::BCFace& /* bc */, RateVector& /* rate */) const override
1055 {
1056 throw std::logic_error("MICP is disabled for compositional modeling and you're trying to add oxygen to BC");
1057 }
1058
1059 void handleUreaBC(const BCState::BCFace& /* bc */, RateVector& /* rate */) const override
1060 {
1061 throw std::logic_error("MICP is disabled for compositional modeling and you're trying to add urea to BC");
1062 }
1063
1064 std::vector<InitialFluidState> initialFluidStates_;
1067 std::optional<std::vector<int>> twoPhaseCheckRegions_;
1068 // Zero-based reservoir EOS region of each cell, empty for a single region.
1069 std::vector<int> eosnum_;
1070
1071 bool zmf_initialization_ {false};
1072
1073 bool enableEclOutput_{false};
1074 std::unique_ptr<EclWriterType> eclWriter_;
1075};
1076
1077} // namespace Opm
1078
1079#endif // OPM_FLOW_PROBLEM_COMP_HPP
#define OPM_END_PARALLEL_TRY_CATCH_LOG(obptc_logger, obptc_prefix, obptc_output, comm)
Catch exception, log, and throw in a parallel try-catch clause.
Definition: DeferredLoggingErrorHelpers.hpp:207
#define OPM_END_PARALLEL_TRY_CATCH(prefix, comm)
Catch exception and throw in a parallel try-catch clause.
Definition: DeferredLoggingErrorHelpers.hpp:197
#define OPM_BEGIN_PARALLEL_TRY_CATCH()
Macro to setup the try of a parallel try-catch.
Definition: DeferredLoggingErrorHelpers.hpp:160
Composition versus depth report (RPTSOL SOLVD) of the compositional equilibration.
Hydrostatic equilibration for the compositional simulator (EQUIL + ZMFVD/COMPVD).
Definition: DeferredLogger.hpp:57
Computes the initial state of a compositional model from hydrostatic equilibrium (the EQUIL and ZMFVD...
Definition: InitStateEquilComp.hpp:243
std::vector< int > & twoPhaseCheckRegions()
Definition: InitStateEquilComp.hpp:389
const std::vector< Scalar > & referencePressures() const
Definition: InitStateEquilComp.hpp:382
std::vector< FluidState > & fluidStates()
Definition: InitStateEquilComp.hpp:373
Collects necessary output values and pass it to opm-common's ECL output.
Definition: EclWriter.hpp:124
static void registerParameters()
Definition: EclWriter.hpp:152
void updateNum(const std::string &name, std::vector< T > &numbers, std::size_t num_regions)
Read a region keyword as zero-based indices, checked against num_regions.
Definition: FlowGenericProblem_impl.hpp:568
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition: FlowProblemComp.hpp:92
void writeOutput(bool verbose) override
Write the requested quantities of the current solution into the output files.
Definition: FlowProblemComp.hpp:293
const std::vector< InitialFluidState > & initialFluidStates() const
Definition: FlowProblemComp.hpp:432
void finishInit()
Called by the Opm::Simulator in order to initialize the problem.
Definition: FlowProblemComp.hpp:177
unsigned eosRegionIndex(const unsigned globalDofIdx) const
The zero-based reservoir EOS region of a cell.
Definition: FlowProblemComp.hpp:161
FlowProblemComp(Simulator &simulator)
Definition: FlowProblemComp.hpp:167
void writeReports(const SimulatorTimer &timer)
Definition: FlowProblemComp.hpp:283
void readExplicitInitialCondition_() override
Definition: FlowProblemComp.hpp:582
void applyNumericalAquifers_()
Definition: FlowProblemComp.hpp:538
void readExplicitInitialConditionCompositional_()
Definition: FlowProblemComp.hpp:587
void endTimeStep() override
Called by the simulator after each time integration.
Definition: FlowProblemComp.hpp:266
const EclWriterType & eclWriter() const
Definition: FlowProblemComp.hpp:435
std::vector< InitialFluidState > & initialFluidStates()
Definition: FlowProblemComp.hpp:429
std::pair< BCType, RateVector > boundaryCondition(const unsigned int, const int) const
Boundary conditions are not supported; finishInit() rejects decks with BCCON.
Definition: FlowProblemComp.hpp:332
void readEclRestartSolution_()
Definition: FlowProblemComp.hpp:577
void normalizeExplicitSwat_()
Definition: FlowProblemComp.hpp:788
void finalizeOutput()
Definition: FlowProblemComp.hpp:447
const InitialFluidState & initialFluidState(unsigned globalDofIdx) const
Definition: FlowProblemComp.hpp:426
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned) const
Evaluate the boundary conditions for a boundary segment.
Definition: FlowProblemComp.hpp:318
void initial(PrimaryVariables &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the initial value for a control volume.
Definition: FlowProblemComp.hpp:351
void readEquilInitialCondition_() override
Definition: FlowProblemComp.hpp:467
void serializeOp(Serializer &serializer)
Definition: FlowProblemComp.hpp:455
void updateExplicitQuantities_(int, int, bool) override
Definition: FlowProblemComp.hpp:462
void addToSourceDense(RateVector &, unsigned, unsigned) const override
Definition: FlowProblemComp.hpp:421
void setSubStepReport(const SimulatorReportSingle &report)
Definition: FlowProblemComp.hpp:441
void initialSolutionApplied() override
Callback used by the model to indicate that the initial solution has been determined for all degrees ...
Definition: FlowProblemComp.hpp:253
IntensiveQuantities::ScalarFluidState boundaryFluidState(unsigned, const int) const
Definition: FlowProblemComp.hpp:338
static void registerParameters()
Registers all available parameters for the problem and the model.
Definition: FlowProblemComp.hpp:131
EclWriterType & eclWriter()
Definition: FlowProblemComp.hpp:438
void setSimulationReport(const SimulatorReport &report)
Definition: FlowProblemComp.hpp:444
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition: FlowProblem.hpp:101
virtual bool episodeWillBeOver() const
Definition: FlowProblem.hpp:2200
GetPropType< TypeTag, Properties::Evaluation > Evaluation
Definition: FlowProblem.hpp:166
virtual void writeOutput(bool verbose)
Write the requested quantities of the current solution into the output files.
Definition: FlowProblem.hpp:546
unsigned pvtRegionIndex(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Returns the index of the relevant region for thermodynmic properties.
Definition: FlowProblem.hpp:964
Scalar porosity(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: FlowProblem.hpp:744
GetPropType< TypeTag, Properties::Vanguard > Vanguard
Definition: FlowProblem.hpp:114
@ numComponents
Definition: FlowProblem.hpp:124
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: FlowProblem.hpp:108
GetPropType< TypeTag, Properties::RateVector > RateVector
Definition: FlowProblem.hpp:155
FlowThresholdPressure< TypeTag > thresholdPressures_
Definition: FlowProblem.hpp:2133
@ waterPhaseIdx
Definition: FlowProblem.hpp:146
GetPropType< TypeTag, Properties::Indices > Indices
Definition: FlowProblem.hpp:115
const EclMaterialLawManager & materialLawManager() const
Returns the ECL material law manager.
Definition: FlowProblem.hpp:916
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: FlowProblem.hpp:156
@ dimWorld
Definition: FlowProblem.hpp:119
@ gasPhaseIdx
Definition: FlowProblem.hpp:144
@ numPhases
Definition: FlowProblem.hpp:123
void finishTransmissibilities_()
Definition: FlowProblem.hpp:1430
@ dim
Definition: FlowProblem.hpp:118
GetPropType< TypeTag, Properties::IntensiveQuantities > IntensiveQuantities
Definition: FlowProblem.hpp:167
GetPropType< TypeTag, Properties::GridView > GridView
Definition: FlowProblem.hpp:109
bool prepareTransmissibilityOutput_(EclWriterType &eclWriter, const bool enableEclOutput)
Definition: FlowProblem.hpp:1439
void initializeSimulatorTime_()
Definition: FlowProblem.hpp:1498
static void registerParameters()
Registers all available parameters for the problem and the model.
Definition: FlowProblem.hpp:200
void updatePffDofData_()
Definition: FlowProblem.hpp:1894
@ oilPhaseIdx
Definition: FlowProblem.hpp:145
GetPropType< TypeTag, Properties::PrimaryVariables > PrimaryVariables
Definition: FlowProblem.hpp:154
virtual void endTimeStep()
Called by the simulator after each time integration.
Definition: FlowProblem.hpp:464
virtual void readInitialCondition_()
Definition: FlowProblem.hpp:1802
virtual void initialSolutionApplied()
Callback used by the model to indicate that the initial solution has been determined for all degrees ...
Definition: FlowProblem.hpp:1082
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: FlowProblem.hpp:111
GetPropType< TypeTag, Properties::MaterialLaw > MaterialLaw
Definition: FlowProblem.hpp:164
void initializeModelProperties_()
Definition: FlowProblem.hpp:1522
Definition: FlowGenericProblem.hpp:52
Definition: SimulatorTimer.hpp:38
std::string formatCompositionVersusDepth(const std::size_t region, const int satTable, const std::vector< CompositionVersusDepthRow< Scalar, NumComponents > > &rows, const std::array< std::string_view, NumComponents > &componentNames, const UnitSystem &units)
Definition: EquilCompReport.hpp:82
void reportTwoPhaseCells(const std::vector< int > &checkRegions, const std::vector< Scalar > &cellCenterDepth, const LiquidFraction &liquidFraction, const std::size_t numRegions, const Parallel::Communication &comm)
Definition: InitStateEquilComp.hpp:1666
@ NONE
Definition: DeferredLogger.hpp:46
Definition: blackoilnewtonmethodparams.hpp:31
Definition: blackoilbioeffectsmodules.hh:45
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:233
ExplicitInitialSaturations completeExplicitSaturations(const std::array< std::optional< double >, 3 > &supplied, const std::array< bool, 3 > &active)
Declares the parameters for the compositional multi-phase model based on flash calculations.
Definition: ExplicitInitialSaturations.hpp:29
double normalizationDeviation
Absolute input closure error for a nontrivial normalization.
Definition: ExplicitInitialSaturations.hpp:32
std::array< double, 3 > saturations
Definition: ExplicitInitialSaturations.hpp:30
Definition: FlowProblemComp.hpp:78
static constexpr bool value
Definition: FlowProblemComp.hpp:78
Definition: SimulatorReport.hpp:202
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:34