From 1b8124cc31291ffd1a0ed20dbc73fe23386723b5 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Thu, 21 Mar 2019 12:29:42 +0100 Subject: [PATCH 1/9] EclProblem: remove the initialTemperature_ array this was not used since the fluid states that correspond to the initial condition are kept permanently. --- ebos/eclproblem.hh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index e1448a510..f3a619711 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -1321,12 +1321,10 @@ public: template Scalar temperature(const Context& context, unsigned spaceIdx, unsigned timeIdx) const { - // use the temporally constant temperature, i.e. use the initial temperature of - // the DOF + // use the initial temperature of the DOF if temperature is not a primary + // variable unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); - if (!initialFluidStates_.empty()) - return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0); - return initialTemperature_[globalDofIdx]; + return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0); } /*! @@ -2666,7 +2664,6 @@ private: std::vector maxPolymerAdsorption_; std::vector initialFluidStates_; - std::vector initialTemperature_; std::vector polymerConcentration_; // polymer molecular weight From f1d3be27a77d5740ddef2616ddeada89f52e2862 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Thu, 21 Mar 2019 12:31:12 +0100 Subject: [PATCH 2/9] ISTLSolverEbos: fix valgrind complaint that isIORank_ is not initialized like most of the rest of the code, we now simply assume that rank 0 does all printing. --- opm/autodiff/ISTLSolverEbos.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opm/autodiff/ISTLSolverEbos.hpp b/opm/autodiff/ISTLSolverEbos.hpp index a336d92eb..0031cdc87 100644 --- a/opm/autodiff/ISTLSolverEbos.hpp +++ b/opm/autodiff/ISTLSolverEbos.hpp @@ -492,7 +492,9 @@ protected: // TODO: Revise when linear solvers interface opm-core is done // Construct linear solver. // GMRes solver - int verbosity = ( isIORank_ ) ? parameters_.linear_solver_verbosity_ : 0; + int verbosity = 0; + if (simulator_.gridView().comm().rank() == 0) + verbosity = parameters_.linear_solver_verbosity_; if ( parameters_.newton_use_gmres_ ) { Dune::RestartedGMResSolver linsolve(opA, sp, precond, @@ -836,7 +838,6 @@ protected: mutable int iterations_; mutable bool converged_; boost::any parallelInformation_; - bool isIORank_; std::unique_ptr matrix_; Vector *rhs_; From cdb2c6312a4c305f244eba4ec74a849564d76cef Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 22 Mar 2019 15:04:07 +0100 Subject: [PATCH 3/9] ebos: add a stub implementation for API tracking the only thing which this does so far is to introduce the respective property and `ebos` will abort the run if the deck requests API tracking. As usual for experimental features, `flow` is unaffected. --- ebos/eclproblem.hh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 52cf2bc89..1d3362345 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -140,6 +140,10 @@ NEW_PROP_TAG(EnableDebuggingChecks); // thermal gradient specified via the TEMPVD keyword NEW_PROP_TAG(EnableThermalFluxBoundaries); +// Specify whether API tracking should be enabled (replaces PVT regions). +// TODO: This is not yet implemented +NEW_PROP_TAG(EnableApiTracking); + // The class which deals with ECL aquifers NEW_PROP_TAG(EclAquiferModel); @@ -229,6 +233,9 @@ SET_BOOL_PROP(EclBaseProblem, EnableGravity, true); // only write the solutions for the report steps to disk SET_BOOL_PROP(EclBaseProblem, EnableWriteAllSolutions, false); +// disable API tracking +SET_BOOL_PROP(EclBaseProblem, EnableApiTracking, false); + // The default for the end time of the simulation [s] // // By default, stop it after the universe will probably have stopped @@ -390,6 +397,7 @@ class EclProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) enum { enableTemperature = GET_PROP_VALUE(TypeTag, EnableTemperature) }; enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) }; enum { enableThermalFluxBoundaries = GET_PROP_VALUE(TypeTag, EnableThermalFluxBoundaries) }; + enum { enableApiTracking = GET_PROP_VALUE(TypeTag, EnableApiTracking) }; enum { gasPhaseIdx = FluidSystem::gasPhaseIdx }; enum { oilPhaseIdx = FluidSystem::oilPhaseIdx }; enum { waterPhaseIdx = FluidSystem::waterPhaseIdx }; @@ -1686,6 +1694,11 @@ private: { const auto& deck = this->simulator().vanguard().deck(); + if (enableApiTracking) + throw std::logic_error("API tracking is not yet implemented but requested at compile time."); + if (!enableApiTracking && deck.hasKeyword("API")) + throw std::logic_error("The simulator is build with API tracking disabled, but API tracking is requested by the deck."); + if (enableSolvent && !deck.hasKeyword("SOLVENT")) throw std::runtime_error("The simulator requires the solvent option to be enabled, but the deck does not."); else if (!enableSolvent && deck.hasKeyword("SOLVENT")) From cd681c64455ea22eec0e2b7c9758f538da102c6a Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 26 Mar 2019 13:17:54 +0100 Subject: [PATCH 4/9] ebos: make its core headers self sufficient this is part of the release maintainance. in this context "core headers" means the ones which do not include the well model headers, and only those which are concerned with non-exotic functionality, e.g., the PolyhedralGrid and ALUGrid vanguards are not changed. --- ebos/alucartesianindexmapper.hh | 2 +- ebos/ebos.hh | 5 +++++ ebos/ecltracermodel.hh | 4 ++++ ebos/eclwriter.hh | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ebos/alucartesianindexmapper.hh b/ebos/alucartesianindexmapper.hh index 062e32bac..eb9ac7bd5 100644 --- a/ebos/alucartesianindexmapper.hh +++ b/ebos/alucartesianindexmapper.hh @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include diff --git a/ebos/ebos.hh b/ebos/ebos.hh index 77390c48c..ba32ed163 100644 --- a/ebos/ebos.hh +++ b/ebos/ebos.hh @@ -25,6 +25,9 @@ * * \brief The common settings for all ebos variants. */ +#ifndef EBOS_HH +#define EBOS_HH + #include "eclproblem.hh" #include @@ -133,3 +136,5 @@ public: using ParentType::EclProblem; }; } + +#endif // EBOS_HH diff --git a/ebos/ecltracermodel.hh b/ebos/ecltracermodel.hh index 7ee178339..c9e733c66 100644 --- a/ebos/ecltracermodel.hh +++ b/ebos/ecltracermodel.hh @@ -30,10 +30,14 @@ #include "tracervdtable.hh" +#include + #include #include #include +#include + #include #include #include diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index a43ab0d7c..7159bae01 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -31,6 +31,7 @@ #include "collecttoiorank.hh" #include "ecloutputblackoilmodule.hh" +#include #include #include #include From 2156f15d5fc379029b3a18a0c2d953b2bdcfd137 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 19 Mar 2019 12:31:28 +0100 Subject: [PATCH 5/9] Adapt to new deck specification for the boundary condition --- ebos/eclfluxmodule.hh | 2 +- ebos/eclproblem.hh | 158 +++++++++++++++++++++++------------------- 2 files changed, 89 insertions(+), 71 deletions(-) diff --git a/ebos/eclfluxmodule.hh b/ebos/eclfluxmodule.hh index ad2ac3751..cb5368a0a 100644 --- a/ebos/eclfluxmodule.hh +++ b/ebos/eclfluxmodule.hh @@ -363,7 +363,7 @@ protected: { const auto& problem = elemCtx.problem(); - bool enableBoundaryMassFlux = problem.hasFreeBoundaryConditions(); + bool enableBoundaryMassFlux = problem.nonTrivialBoundaryConditions(); if (!enableBoundaryMassFlux) return; diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 9b43736c3..fd01f275f 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -1363,7 +1363,7 @@ public: values.setThermalFlow(context, spaceIdx, timeIdx, initialFluidStates_[globalDofIdx]); } - if (hasFreeBoundaryConditions()) { + if (nonTrivialBoundaryConditions()) { unsigned indexInInside = context.intersection(spaceIdx).indexInInside(); unsigned interiorDofIdx = context.interiorScvIndex(spaceIdx, timeIdx); unsigned globalDofIdx = context.globalSpaceIndex(interiorDofIdx, timeIdx); @@ -1618,8 +1618,8 @@ public: return (oilVaporizationControl.getType() == Opm::OilVaporizationEnum::VAPPARS); } - bool hasFreeBoundaryConditions() const - { return hasFreeBoundaryConditions_; } + bool nonTrivialBoundaryConditions() const + { return nonTrivialBoundaryConditions_; } /*! * \brief Propose the size of the next time step to the simulator. @@ -2549,18 +2549,11 @@ private: void readBoundaryConditions_() { - hasFreeBoundaryConditions_ = false; - readBoundaryConditionKeyword_("FREEBCX", freebcX_); - readBoundaryConditionKeyword_("FREEBCX-", freebcXMinus_); - readBoundaryConditionKeyword_("FREEBCY", freebcY_); - readBoundaryConditionKeyword_("FREEBCY-", freebcYMinus_); - readBoundaryConditionKeyword_("FREEBCZ", freebcZ_); - readBoundaryConditionKeyword_("FREEBCZ-", freebcZMinus_); - + nonTrivialBoundaryConditions_ = false; const auto& vanguard = this->simulator().vanguard(); - if (vanguard.deck().hasKeyword("BCRATE")) { - hasFreeBoundaryConditions_ = true; + if (vanguard.deck().hasKeyword("BC")) { + nonTrivialBoundaryConditions_ = true; size_t numCartDof = vanguard.cartesianSize(); unsigned numElems = vanguard.gridView().size(/*codim=*/0); std::vector cartesianToCompressedElemIdx(numCartDof); @@ -2574,14 +2567,21 @@ private: massratebcY_.resize(numElems, 0.0); massratebcZMinus_.resize(numElems, 0.0); massratebcZ_.resize(numElems, 0.0); + freebcX_.resize(numElems, false); + freebcXMinus_.resize(numElems, false); + freebcY_.resize(numElems, false); + freebcYMinus_.resize(numElems, false); + freebcZ_.resize(numElems, false); + freebcZMinus_.resize(numElems, false); - const auto& ratebcs = vanguard.deck().getKeywordList("BCRATE"); - for (size_t listIdx = 0; listIdx < ratebcs.size(); ++listIdx) { - const auto& ratebc = *ratebcs[listIdx]; + const auto& bcs = vanguard.deck().getKeywordList("BC"); + for (size_t listIdx = 0; listIdx < bcs.size(); ++listIdx) { + const auto& bc = *bcs[listIdx]; - for (size_t record = 0; record < ratebc.size(); ++record) { + for (size_t record = 0; record < bc.size(); ++record) { - std::string compName = ratebc.getRecord(record).getItem("COMPONENT").getTrimmedString(0); + std::string type = bc.getRecord(record).getItem("TYPE").getTrimmedString(0); + std::string compName = bc.getRecord(record).getItem("COMPONENT").getTrimmedString(0); int compIdx = -999; if (compName == "OIL") @@ -2593,77 +2593,95 @@ private: else if (compName == "SOLVENT") { if (!enableSolvent) - throw std::logic_error("solvent is disabled and you're trying to add solvent to BCRATE"); + throw std::logic_error("solvent is disabled and you're trying to add solvent to BC"); compIdx = Indices::solventSaturationIdx; } else if (compName == "POLYMER") { if (!enablePolymer) - throw std::logic_error("polymer is disabled and you're trying to add polymer to BCRATE"); + throw std::logic_error("polymer is disabled and you're trying to add polymer to BC"); compIdx = Indices::polymerConcentrationIdx; } + else if (compName == "NONE") + { + if ( type == "RATE") + throw std::logic_error("you need to specify the component when RATE type is set in BC"); + } else - throw std::logic_error("invalid component name for BCRATE"); - assert(compIdx >= 0); + throw std::logic_error("invalid component name for BC"); - std::string direction = ratebc.getRecord(record).getItem("DIRECTION").getTrimmedString(0); - std::vector* data = 0; - if (direction == "X-") - data = &massratebcXMinus_; - else if (direction == "X") - data = &massratebcX_; - else if (direction == "Y-") - data = &massratebcYMinus_; - else if (direction == "Y") - data = &massratebcY_; - else if (direction == "Z-") - data = &massratebcZMinus_; - else if (direction == "Z") - data = &massratebcZ_; - else - throw std::logic_error("invalid direction for BCRATE"); + int i1 = bc.getRecord(record).getItem("I1").template get< int >(0) - 1; + int i2 = bc.getRecord(record).getItem("I2").template get< int >(0) - 1; + int j1 = bc.getRecord(record).getItem("J1").template get< int >(0) - 1; + int j2 = bc.getRecord(record).getItem("J2").template get< int >(0) - 1; + int k1 = bc.getRecord(record).getItem("K1").template get< int >(0) - 1; + int k2 = bc.getRecord(record).getItem("K2").template get< int >(0) - 1; + std::string direction = bc.getRecord(record).getItem("DIRECTION").getTrimmedString(0); - int i1 = ratebc.getRecord(record).getItem("I1").template get< int >(0) - 1; - int i2 = ratebc.getRecord(record).getItem("I2").template get< int >(0) - 1; - int j1 = ratebc.getRecord(record).getItem("J1").template get< int >(0) - 1; - int j2 = ratebc.getRecord(record).getItem("J2").template get< int >(0) - 1; - int k1 = ratebc.getRecord(record).getItem("K1").template get< int >(0) - 1; - int k2 = ratebc.getRecord(record).getItem("K2").template get< int >(0) - 1; - const Evaluation rate = ratebc.getRecord(record).getItem("RATE").getSIDouble(0); - for (int i = i1; i <= i2; ++i) { - for (int j = j1; j <= j2; ++j) { - for (int k = k1; k <= k2; ++k) { - std::array tmp = {i,j,k}; - size_t elemIdx = cartesianToCompressedElemIdx[vanguard.cartesianIndex(tmp)]; - (*data)[elemIdx][compIdx] = rate; + if (type == "RATE") { + assert(compIdx >= 0); + std::vector* data = 0; + if (direction == "X-") + data = &massratebcXMinus_; + else if (direction == "X") + data = &massratebcX_; + else if (direction == "Y-") + data = &massratebcYMinus_; + else if (direction == "Y") + data = &massratebcY_; + else if (direction == "Z-") + data = &massratebcZMinus_; + else if (direction == "Z") + data = &massratebcZ_; + else + throw std::logic_error("invalid direction for BC"); + + const Evaluation rate = bc.getRecord(record).getItem("RATE").getSIDouble(0); + for (int i = i1; i <= i2; ++i) { + for (int j = j1; j <= j2; ++j) { + for (int k = k1; k <= k2; ++k) { + std::array tmp = {i,j,k}; + size_t elemIdx = cartesianToCompressedElemIdx[vanguard.cartesianIndex(tmp)]; + (*data)[elemIdx][compIdx] = rate; + } } } + } else if (type == "FREE") { + std::vector* data = 0; + if (direction == "X-") + data = &freebcXMinus_; + else if (direction == "X") + data = &freebcX_; + else if (direction == "Y-") + data = &freebcYMinus_; + else if (direction == "Y") + data = &freebcY_; + else if (direction == "Z-") + data = &freebcZMinus_; + else if (direction == "Z") + data = &freebcZ_; + else + throw std::logic_error("invalid direction for BC"); + + for (int i = i1; i <= i2; ++i) { + for (int j = j1; j <= j2; ++j) { + for (int k = k1; k <= k2; ++k) { + std::array tmp = {i,j,k}; + size_t elemIdx = cartesianToCompressedElemIdx[vanguard.cartesianIndex(tmp)]; + (*data)[elemIdx] = true; + } + } + } + } else { + throw std::logic_error("invalid type for BC. Use FREE or RATE"); } } } } } - void readBoundaryConditionKeyword_(const std::string& name, std::vector& compressedData) - { - const auto& eclProps = this->simulator().vanguard().eclState().get3DProperties(); - const auto& vanguard = this->simulator().vanguard(); - - unsigned numElems = vanguard.gridView().size(/*codim=*/0); - compressedData.resize(numElems, false); - - if (eclProps.hasDeckDoubleGridProperty(name)) { - const std::vector& data = eclProps.getDoubleGridProperty(name).getData(); - for (unsigned elemIdx = 0; elemIdx < numElems; ++elemIdx) { - unsigned cartElemIdx = vanguard.cartesianIndex(elemIdx); - compressedData[elemIdx] = (data[cartElemIdx] > 0); - } - hasFreeBoundaryConditions_ = true; - } - } - // this method applies the runtime constraints specified via the deck and/or command // line parameters for the size of the next time step size. Scalar limitNextTimeStepSize_(Scalar dtNext) const @@ -2754,7 +2772,7 @@ private: PffGridVector pffDofData_; TracerModel tracerModel_; - bool hasFreeBoundaryConditions_; + bool nonTrivialBoundaryConditions_; std::vector freebcX_; std::vector freebcXMinus_; std::vector freebcY_; From 415694f2060531a882144be2a808bfa3014086c1 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 29 Mar 2019 12:26:15 +0100 Subject: [PATCH 6/9] Remove RPTSCHED from list of unsupported keywords --- opm/autodiff/MissingFeatures.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index 4dc43a29d..a8a25a416 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -170,7 +170,6 @@ namespace MissingFeatures { "RPTPROS", "PRTRST", "RPTRUNSP", - "RPTSCHED", "RPTSMRY", "RPTSOL", "RSCONST", From a9f680119afb79adad8a3c2e6414bc168b5c2a9c Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 29 Mar 2019 12:26:35 +0100 Subject: [PATCH 7/9] Remove WTEST from list of unsupported keywords --- opm/autodiff/MissingFeatures.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index a8a25a416..3fec99b14 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -204,7 +204,6 @@ namespace MissingFeatures { "WPAVE", "WPITAB", "WTEMP", - "WTEST", "WTRACER", "ZIPPY2" }; std::multimap > string_options; From 798c20a8869a36d40ee8ac03c32c385919794a08 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 29 Mar 2019 12:26:54 +0100 Subject: [PATCH 8/9] Remove EDITNNC from list of unsupported keywords --- opm/autodiff/MissingFeatures.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index 3fec99b14..e7a3f265f 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -95,7 +95,6 @@ namespace MissingFeatures { "CPR", "DATE", "ECHO", - "EDITNNC", "ENDACTIO", "ENDFIN" "ENDNUM", From 66b7d1596a433aa9a734e242a2f88f4057269df8 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 29 Mar 2019 12:27:11 +0100 Subject: [PATCH 9/9] Remove ECHO and NOECHO from list of unsupported keywords --- opm/autodiff/MissingFeatures.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/opm/autodiff/MissingFeatures.cpp b/opm/autodiff/MissingFeatures.cpp index e7a3f265f..6f10c33db 100644 --- a/opm/autodiff/MissingFeatures.cpp +++ b/opm/autodiff/MissingFeatures.cpp @@ -94,7 +94,6 @@ namespace MissingFeatures { "CONNECTION", "CPR", "DATE", - "ECHO", "ENDACTIO", "ENDFIN" "ENDNUM", @@ -130,7 +129,6 @@ namespace MissingFeatures { "NETBALAN", "NEXTSTEP", "NOCASC", - "NOECHO", "NOGGF", "NOINSPEC", "NOMONITO",