2016-01-05 12:32:36 -06:00
|
|
|
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
// vi: set et ts=4 sw=4 sts=4:
|
|
|
|
/*
|
|
|
|
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 2 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/>.
|
2016-03-14 07:21:47 -05:00
|
|
|
|
|
|
|
Consult the COPYING file in the top-level source directory of this
|
|
|
|
module for the precise wording of the license and the list of
|
|
|
|
copyright holders.
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
|
|
|
/*!
|
|
|
|
* \file
|
2019-09-05 10:04:39 -05:00
|
|
|
* \copydoc Opm::EclBaseVanguard
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
2018-02-01 09:26:58 -06:00
|
|
|
#ifndef EWOMS_ECL_BASE_VANGUARD_HH
|
|
|
|
#define EWOMS_ECL_BASE_VANGUARD_HH
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2019-09-16 03:13:06 -05:00
|
|
|
#include <opm/models/io/basevanguard.hh>
|
2019-09-16 03:58:20 -05:00
|
|
|
#include <opm/models/utils/propertysystem.hh>
|
|
|
|
#include <opm/models/utils/parametersystem.hh>
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2019-04-04 07:37:37 -05:00
|
|
|
#include <opm/grid/CpGrid.hpp>
|
|
|
|
#include <opm/grid/cpgrid/GridHelpers.hpp>
|
|
|
|
#include <opm/core/props/satfunc/RelpermDiagnostics.hpp>
|
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
2016-03-16 20:08:50 -05:00
|
|
|
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
2019-01-07 03:04:44 -06:00
|
|
|
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
2016-01-05 12:32:36 -06:00
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
2017-10-27 02:07:23 -05:00
|
|
|
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
2019-05-13 02:16:24 -05:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2016-12-30 07:09:51 -06:00
|
|
|
#if HAVE_MPI
|
|
|
|
#include <mpi.h>
|
|
|
|
#endif // HAVE_MPI
|
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
#include <array>
|
2019-09-19 17:49:40 -05:00
|
|
|
#include <chrono>
|
|
|
|
#include <unordered_set>
|
|
|
|
#include <vector>
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2019-09-05 10:04:39 -05:00
|
|
|
namespace Opm {
|
2016-01-05 12:32:36 -06:00
|
|
|
template <class TypeTag>
|
2018-02-01 09:26:58 -06:00
|
|
|
class EclBaseVanguard;
|
2018-06-14 09:06:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
BEGIN_PROPERTIES
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2018-02-01 09:26:58 -06:00
|
|
|
NEW_TYPE_TAG(EclBaseVanguard);
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2018-02-01 09:26:58 -06:00
|
|
|
// declare the properties required by the for the ecl simulator vanguard
|
2016-01-05 12:32:36 -06:00
|
|
|
NEW_PROP_TAG(Grid);
|
|
|
|
NEW_PROP_TAG(EquilGrid);
|
|
|
|
NEW_PROP_TAG(Scalar);
|
|
|
|
NEW_PROP_TAG(EclDeckFileName);
|
2018-08-14 03:26:36 -05:00
|
|
|
NEW_PROP_TAG(OutputDir);
|
2018-09-12 12:33:46 -05:00
|
|
|
NEW_PROP_TAG(EnableOpmRstFile);
|
2019-01-07 09:02:13 -06:00
|
|
|
NEW_PROP_TAG(EclStrictParsing);
|
2018-06-15 07:34:50 -05:00
|
|
|
NEW_PROP_TAG(EclOutputInterval);
|
2018-10-08 16:24:58 -05:00
|
|
|
NEW_PROP_TAG(IgnoreKeywords);
|
2019-04-04 07:37:37 -05:00
|
|
|
NEW_PROP_TAG(EnableExperiments);
|
2019-07-08 08:50:34 -05:00
|
|
|
NEW_PROP_TAG(EdgeWeightsMethod);
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2018-10-08 16:24:58 -05:00
|
|
|
SET_STRING_PROP(EclBaseVanguard, IgnoreKeywords, "");
|
2018-08-06 08:05:17 -05:00
|
|
|
SET_STRING_PROP(EclBaseVanguard, EclDeckFileName, "");
|
2018-06-15 07:34:50 -05:00
|
|
|
SET_INT_PROP(EclBaseVanguard, EclOutputInterval, -1); // use the deck-provided value
|
2019-01-15 06:05:45 -06:00
|
|
|
SET_BOOL_PROP(EclBaseVanguard, EnableOpmRstFile, false);
|
2019-01-07 09:02:13 -06:00
|
|
|
SET_BOOL_PROP(EclBaseVanguard, EclStrictParsing, false);
|
2019-07-08 08:50:34 -05:00
|
|
|
SET_INT_PROP(EclBaseVanguard, EdgeWeightsMethod, 1);
|
2018-06-14 09:06:05 -05:00
|
|
|
|
|
|
|
END_PROPERTIES
|
|
|
|
|
2019-09-05 10:04:39 -05:00
|
|
|
namespace Opm {
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \ingroup EclBlackOilSimulator
|
|
|
|
*
|
|
|
|
* \brief Helper class for grid instantiation of ECL file-format using problems.
|
|
|
|
*/
|
|
|
|
template <class TypeTag>
|
2018-02-01 09:26:58 -06:00
|
|
|
class EclBaseVanguard : public BaseVanguard<TypeTag>
|
2016-01-05 12:32:36 -06:00
|
|
|
{
|
2018-02-01 09:26:58 -06:00
|
|
|
typedef BaseVanguard<TypeTag> ParentType;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Vanguard) Implementation;
|
2016-01-05 12:32:36 -06:00
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
|
|
|
|
|
2019-04-04 07:37:37 -05:00
|
|
|
enum { enableExperiments = GET_PROP_VALUE(TypeTag, EnableExperiments) };
|
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
public:
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static const int dimension = Grid::dimension;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/*!
|
2018-02-01 09:26:58 -06:00
|
|
|
* \brief Register the common run-time parameters for all ECL simulator vanguards.
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
|
|
|
static void registerParameters()
|
|
|
|
{
|
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, EclDeckFileName,
|
|
|
|
"The name of the file which contains the ECL deck to be simulated");
|
2018-06-15 07:34:50 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, int, EclOutputInterval,
|
|
|
|
"The number of report steps that ought to be skipped between two writes of ECL results");
|
2018-09-17 04:21:49 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableOpmRstFile,
|
|
|
|
"Include OPM-specific keywords in the ECL restart file to enable restart of OPM simulators from these files");
|
2018-10-08 16:24:58 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, IgnoreKeywords,
|
|
|
|
"List of Eclipse keywords which should be ignored. As a ':' separated string.");
|
2019-01-07 09:02:13 -06:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, bool, EclStrictParsing,
|
|
|
|
"Use strict mode for parsing - all errors are collected before the applicaton exists.");
|
2019-07-08 08:50:34 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, int, EdgeWeightsMethod,
|
|
|
|
"Choose edge-weighing strategy: 0=uniform, 1=trans, 2=log(trans).");
|
2016-01-05 12:32:36 -06:00
|
|
|
}
|
|
|
|
|
2018-06-19 08:23:26 -05:00
|
|
|
/*!
|
|
|
|
* \brief Returns the canonical path to a deck file.
|
|
|
|
*
|
|
|
|
* The input can either be the canonical deck file name or the name of the case
|
|
|
|
* (i.e., without the .DATA extension)
|
|
|
|
*/
|
|
|
|
static boost::filesystem::path canonicalDeckPath(const std::string& caseName)
|
|
|
|
{
|
|
|
|
const auto fileExists = [](const boost::filesystem::path& f) -> bool
|
|
|
|
{
|
|
|
|
if (!boost::filesystem::exists(f))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (boost::filesystem::is_regular_file(f))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return boost::filesystem::is_symlink(f) && boost::filesystem::is_regular_file(boost::filesystem::read_symlink(f));
|
|
|
|
};
|
|
|
|
|
|
|
|
auto simcase = boost::filesystem::path(caseName);
|
|
|
|
if (fileExists(simcase))
|
|
|
|
return simcase;
|
|
|
|
|
|
|
|
for (const auto& ext : { std::string("data"), std::string("DATA") }) {
|
|
|
|
if (fileExists(simcase.replace_extension(ext)))
|
|
|
|
return simcase;
|
|
|
|
}
|
|
|
|
|
2018-08-17 06:08:23 -05:00
|
|
|
throw std::invalid_argument("Cannot find input case '"+caseName+"'");
|
2018-06-19 08:23:26 -05:00
|
|
|
}
|
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
/*!
|
|
|
|
* \brief Creates an Opm::parseContext object assuming that the parameters are ready.
|
|
|
|
*/
|
|
|
|
static std::unique_ptr<Opm::ParseContext> createParseContext()
|
|
|
|
{
|
|
|
|
typedef std::pair<std::string, Opm::InputError::Action> ParseModePair;
|
|
|
|
typedef std::vector<ParseModePair> ParseModePairs;
|
|
|
|
ParseModePairs tmp;
|
|
|
|
tmp.emplace_back(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE);
|
|
|
|
tmp.emplace_back(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN);
|
|
|
|
tmp.emplace_back(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN);
|
|
|
|
tmp.emplace_back(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN);
|
|
|
|
tmp.emplace_back(Opm::ParseContext::PARSE_EXTRA_RECORDS, Opm::InputError::WARN);
|
|
|
|
|
|
|
|
std::unique_ptr<Opm::ParseContext> parseContext(new Opm::ParseContext(tmp));
|
|
|
|
|
|
|
|
const std::string ignoredKeywords = EWOMS_GET_PARAM(TypeTag, std::string, IgnoreKeywords);
|
|
|
|
if (ignoredKeywords.size() > 0) {
|
|
|
|
size_t pos;
|
|
|
|
size_t offset = 0;
|
|
|
|
while (true) {
|
|
|
|
pos = ignoredKeywords.find(':', offset);
|
|
|
|
if (pos == std::string::npos) {
|
|
|
|
parseContext->ignoreKeyword(ignoredKeywords.substr(offset));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
parseContext->ignoreKeyword(ignoredKeywords.substr(offset, pos - offset));
|
|
|
|
offset = pos + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (EWOMS_GET_PARAM(TypeTag, bool, EclStrictParsing))
|
|
|
|
parseContext->update(Opm::InputError::DELAYED_EXIT1);
|
|
|
|
|
|
|
|
return parseContext;
|
|
|
|
}
|
|
|
|
|
2019-02-05 09:51:34 -06:00
|
|
|
/*!
|
|
|
|
* \brief Set the wall time which was spend externally to set up the external data structures
|
|
|
|
*
|
|
|
|
* i.e., the objects specified via the other setExternal*() methods.
|
|
|
|
*/
|
|
|
|
static void setExternalSetupTime(Scalar t)
|
|
|
|
{ externalSetupTime_ = t; }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the wall time required to set up the simulator before it was born.
|
|
|
|
*/
|
|
|
|
static Scalar externalSetupTime()
|
|
|
|
{ return externalSetupTime_; }
|
|
|
|
|
2017-10-05 09:15:17 -05:00
|
|
|
/*!
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
* \brief Set the Opm::ParseContext object which ought to be used for parsing the deck and creating the Opm::EclipseState object.
|
|
|
|
*/
|
|
|
|
static void setExternalParseContext(Opm::ParseContext* parseContext)
|
|
|
|
{ externalParseContext_ = parseContext; }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Set the Opm::ErrorGuard object which ought to be used for parsing the deck and creating the Opm::EclipseState object.
|
|
|
|
*/
|
|
|
|
static void setExternalErrorGuard(Opm::ErrorGuard* errorGuard)
|
|
|
|
{ externalErrorGuard_ = errorGuard; }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Set the Opm::Deck object which ought to be used when the simulator vanguard
|
|
|
|
* is instantiated.
|
2017-10-05 09:15:17 -05:00
|
|
|
*
|
|
|
|
* This is basically an optimization: In cases where the ECL input deck must be
|
|
|
|
* examined to decide which simulator ought to be used, this avoids having to parse
|
|
|
|
* the input twice. When this method is used, the caller is responsible for lifetime
|
|
|
|
* management of these two objects, i.e., they are not allowed to be deleted as long
|
2018-02-01 09:26:58 -06:00
|
|
|
* as the simulator vanguard object is alive.
|
2017-10-05 09:15:17 -05:00
|
|
|
*/
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
static void setExternalDeck(Opm::Deck* deck)
|
|
|
|
{ externalDeck_ = deck; }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Set the Opm::EclipseState object which ought to be used when the simulator
|
|
|
|
* vanguard is instantiated.
|
|
|
|
*/
|
|
|
|
static void setExternalEclState(Opm::EclipseState* eclState)
|
|
|
|
{ externalEclState_ = eclState; }
|
2017-10-05 09:15:17 -05:00
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
/*!
|
|
|
|
* \brief Create the grid for problem data files which use the ECL file format.
|
|
|
|
*
|
|
|
|
* This is the file format used by the commercial ECLiPSE simulator. Usually it uses
|
|
|
|
* a cornerpoint description of the grid.
|
|
|
|
*/
|
2018-02-01 09:26:58 -06:00
|
|
|
EclBaseVanguard(Simulator& simulator)
|
2016-01-05 12:32:36 -06:00
|
|
|
: ParentType(simulator)
|
|
|
|
{
|
2016-01-23 05:58:12 -06:00
|
|
|
int myRank = 0;
|
|
|
|
#if HAVE_MPI
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
|
|
|
|
#endif
|
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
std::string fileName = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName);
|
2019-07-08 08:50:34 -05:00
|
|
|
edgeWeightsMethod_ = Dune::EdgeWeightMethod(EWOMS_GET_PARAM(TypeTag, int, EdgeWeightsMethod));
|
2018-08-06 08:05:17 -05:00
|
|
|
|
|
|
|
if (fileName == "")
|
|
|
|
throw std::runtime_error("No input deck file has been specified as a command line argument,"
|
|
|
|
" or via '--ecl-deck-file-name=CASE.DATA'");
|
|
|
|
|
2018-06-19 08:23:26 -05:00
|
|
|
fileName = canonicalDeckPath(fileName).string();
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
// compute the base name of the input file name
|
|
|
|
const char directorySeparator = '/';
|
|
|
|
long int i;
|
|
|
|
for (i = fileName.size(); i >= 0; -- i)
|
|
|
|
if (fileName[i] == directorySeparator)
|
|
|
|
break;
|
|
|
|
std::string baseName = fileName.substr(i + 1, fileName.size());
|
|
|
|
|
|
|
|
// remove the extension from the input file
|
|
|
|
for (i = baseName.size(); i >= 0; -- i)
|
|
|
|
if (baseName[i] == '.')
|
|
|
|
break;
|
|
|
|
std::string rawCaseName;
|
|
|
|
if (i < 0)
|
|
|
|
rawCaseName = baseName;
|
|
|
|
else
|
|
|
|
rawCaseName = baseName.substr(0, i);
|
|
|
|
|
|
|
|
// transform the result to ALL_UPPERCASE
|
2016-12-30 03:06:11 -06:00
|
|
|
caseName_ = rawCaseName;
|
|
|
|
std::transform(caseName_.begin(), caseName_.end(), caseName_.begin(), ::toupper);
|
2016-01-05 12:32:36 -06:00
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
// create the parser objects for the deck or use their externally specified
|
|
|
|
// versions (if desired)
|
|
|
|
if (!externalParseContext_) {
|
|
|
|
internalParseContext_ = createParseContext();
|
|
|
|
parseContext_ = internalParseContext_.get();
|
2018-11-07 03:56:12 -06:00
|
|
|
}
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
else
|
|
|
|
parseContext_ = externalParseContext_;
|
2018-11-07 03:56:12 -06:00
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
if (!externalParseContext_) {
|
|
|
|
internalErrorGuard_.reset(new Opm::ErrorGuard);
|
|
|
|
errorGuard_ = internalErrorGuard_.get();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
errorGuard_ = externalErrorGuard_;
|
2019-01-07 09:02:13 -06:00
|
|
|
|
2017-10-11 08:58:01 -05:00
|
|
|
if (!externalDeck_) {
|
|
|
|
if (myRank == 0)
|
|
|
|
std::cout << "Reading the deck file '" << fileName << "'" << std::endl;
|
|
|
|
|
|
|
|
Opm::Parser parser;
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
internalDeck_.reset(new Opm::Deck(parser.parseFile(fileName, *parseContext_, *errorGuard_)));
|
|
|
|
deck_ = internalDeck_.get();
|
2017-10-11 08:58:01 -05:00
|
|
|
|
2019-04-04 07:37:37 -05:00
|
|
|
if (enableExperiments && myRank == 0)
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
Opm::checkDeck(*deck_, parser, *parseContext_, *errorGuard_);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert(externalDeck_);
|
|
|
|
|
|
|
|
deck_ = externalDeck_;
|
|
|
|
}
|
2019-04-04 07:37:37 -05:00
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
if (!externalEclState_) {
|
|
|
|
internalEclState_.reset(new Opm::EclipseState(*deck_, *parseContext_, *errorGuard_));
|
|
|
|
eclState_ = internalEclState_.get();
|
2017-10-11 08:58:01 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert(externalDeck_);
|
|
|
|
assert(externalEclState_);
|
|
|
|
|
|
|
|
deck_ = externalDeck_;
|
|
|
|
eclState_ = externalEclState_;
|
2017-08-23 08:49:53 -05:00
|
|
|
}
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2018-11-08 02:44:20 -06:00
|
|
|
if (!externalEclSchedule_) {
|
|
|
|
// create the schedule object. Note that if eclState is supposed to represent
|
|
|
|
// the internalized version of the deck, this constitutes a layering
|
|
|
|
// violation.
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
internalEclSchedule_.reset(new Opm::Schedule(*deck_, *eclState_, *parseContext_, *errorGuard_));
|
|
|
|
eclSchedule_ = internalEclSchedule_.get();
|
2018-11-08 02:44:20 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
eclSchedule_ = externalEclSchedule_;
|
2019-09-19 17:49:40 -05:00
|
|
|
this->summaryState_.reset( new Opm::SummaryState( std::chrono::system_clock::from_time_t(this->eclSchedule_->getStartTime() )));
|
2018-11-08 02:44:20 -06:00
|
|
|
|
|
|
|
if (!externalEclSummaryConfig_) {
|
|
|
|
// create the schedule object. Note that if eclState is supposed to represent
|
|
|
|
// the internalized version of the deck, this constitutes a layering
|
|
|
|
// violation.
|
|
|
|
internalEclSummaryConfig_.reset(new Opm::SummaryConfig(*deck_,
|
|
|
|
*eclSchedule_,
|
|
|
|
eclState_->getTableManager(),
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
*parseContext_,
|
|
|
|
*errorGuard_));
|
2018-11-08 02:44:20 -06:00
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
eclSummaryConfig_ = internalEclSummaryConfig_.get();
|
2018-11-08 02:44:20 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
eclSummaryConfig_ = externalEclSummaryConfig_;
|
2018-11-07 03:56:12 -06:00
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
if (*errorGuard_) {
|
|
|
|
errorGuard_->dump();
|
|
|
|
errorGuard_->clear();
|
2019-01-07 03:04:44 -06:00
|
|
|
|
|
|
|
throw std::runtime_error("Unrecoverable errors were encountered while loading input.");
|
|
|
|
}
|
|
|
|
|
2018-06-15 07:34:50 -05:00
|
|
|
// Possibly override IOConfig setting for how often RESTART files should get
|
|
|
|
// written to disk (every N report step)
|
|
|
|
int outputInterval = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
|
|
|
|
if (outputInterval >= 0)
|
|
|
|
eclState_->getRestartConfig().overrideRestartWriteInterval(outputInterval);
|
2016-01-05 12:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2018-11-07 03:56:12 -06:00
|
|
|
* \brief Return a reference to the parsed ECL deck.
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
2016-12-05 11:05:56 -06:00
|
|
|
const Opm::Deck& deck() const
|
2017-08-23 08:49:53 -05:00
|
|
|
{ return *deck_; }
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2016-12-05 11:05:56 -06:00
|
|
|
Opm::Deck& deck()
|
2017-08-23 08:49:53 -05:00
|
|
|
{ return *deck_; }
|
2016-08-08 08:47:41 -05:00
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
/*!
|
2018-11-07 03:56:12 -06:00
|
|
|
* \brief Return a reference to the internalized ECL deck.
|
2016-01-05 12:32:36 -06:00
|
|
|
*/
|
2016-12-05 11:05:56 -06:00
|
|
|
const Opm::EclipseState& eclState() const
|
|
|
|
{ return *eclState_; }
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2016-12-05 11:05:56 -06:00
|
|
|
Opm::EclipseState& eclState()
|
|
|
|
{ return *eclState_; }
|
2016-01-05 12:32:36 -06:00
|
|
|
|
2018-11-07 03:56:12 -06:00
|
|
|
/*!
|
|
|
|
* \brief Return a reference to the object that managages the ECL schedule.
|
|
|
|
*/
|
|
|
|
const Opm::Schedule& schedule() const
|
|
|
|
{ return *eclSchedule_; }
|
2017-10-27 02:07:23 -05:00
|
|
|
|
2018-11-07 03:56:12 -06:00
|
|
|
Opm::Schedule& schedule()
|
|
|
|
{ return *eclSchedule_; }
|
|
|
|
|
2018-11-08 02:44:20 -06:00
|
|
|
/*!
|
|
|
|
* \brief Set the schedule object.
|
|
|
|
*
|
|
|
|
* The lifetime of this object is not managed by the vanguard, i.e., the object must
|
|
|
|
* stay valid until after the vanguard gets destroyed.
|
|
|
|
*/
|
|
|
|
static void setExternalSchedule(Opm::Schedule* schedule)
|
|
|
|
{ externalEclSchedule_ = schedule; }
|
|
|
|
|
2018-11-07 03:56:12 -06:00
|
|
|
/*!
|
|
|
|
* \brief Return a reference to the object that determines which quantities ought to
|
|
|
|
* be put into the ECL summary output.
|
|
|
|
*/
|
|
|
|
const Opm::SummaryConfig& summaryConfig() const
|
|
|
|
{ return *eclSummaryConfig_; }
|
2018-02-07 04:21:57 -06:00
|
|
|
|
2018-11-08 02:44:20 -06:00
|
|
|
/*!
|
|
|
|
* \brief Set the summary configuration object.
|
|
|
|
*
|
|
|
|
* The lifetime of this object is not managed by the vanguard, i.e., the object must
|
|
|
|
* stay valid until after the vanguard gets destroyed.
|
|
|
|
*/
|
|
|
|
static void setExternalSummaryConfig(Opm::SummaryConfig* summaryConfig)
|
|
|
|
{ externalEclSummaryConfig_ = summaryConfig; }
|
|
|
|
|
2019-05-13 02:16:24 -05:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the summary state
|
|
|
|
*
|
|
|
|
* The summary state is a small container object for
|
|
|
|
* computed, ready to use summary values. The values will typically be used by
|
|
|
|
* the UDQ, WTEST and ACTIONX calculations.
|
|
|
|
*/
|
2019-06-17 03:02:11 -05:00
|
|
|
Opm::SummaryState& summaryState()
|
2019-09-19 17:49:40 -05:00
|
|
|
{ return *summaryState_; }
|
2019-05-13 02:16:24 -05:00
|
|
|
|
2019-06-17 03:02:11 -05:00
|
|
|
const Opm::SummaryState& summaryState() const
|
2019-09-19 17:49:40 -05:00
|
|
|
{ return *summaryState_; }
|
2019-07-08 08:50:34 -05:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Parameter deciding the edge-weight strategy of the load balancer.
|
|
|
|
*/
|
|
|
|
Dune::EdgeWeightMethod edgeWeightsMethod() const
|
|
|
|
{ return edgeWeightsMethod_; }
|
2016-01-05 12:32:36 -06:00
|
|
|
/*!
|
|
|
|
* \brief Returns the name of the case.
|
|
|
|
*
|
|
|
|
* i.e., the all-uppercase version of the file name from which the
|
|
|
|
* deck is loaded with the ".DATA" suffix removed.
|
|
|
|
*/
|
|
|
|
const std::string& caseName() const
|
|
|
|
{ return caseName_; }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the number of logically Cartesian cells in each direction
|
|
|
|
*/
|
|
|
|
const std::array<int, dimension>& cartesianDimensions() const
|
|
|
|
{ return asImp_().cartesianIndexMapper().cartesianDimensions(); }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the overall number of cells of the logically Cartesian grid
|
|
|
|
*/
|
|
|
|
int cartesianSize() const
|
|
|
|
{ return asImp_().cartesianIndexMapper().cartesianSize(); }
|
2016-12-02 11:47:59 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the overall number of cells of the logically EquilCartesian grid
|
|
|
|
*/
|
|
|
|
int equilCartesianSize() const
|
|
|
|
{ return asImp_().equilCartesianIndexMapper().cartesianSize(); }
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the Cartesian cell id for identifaction with ECL data
|
|
|
|
*/
|
|
|
|
unsigned cartesianIndex(unsigned compressedCellIdx) const
|
|
|
|
{ return asImp_().cartesianIndexMapper().cartesianIndex(compressedCellIdx); }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Return the index of the cells in the logical Cartesian grid
|
|
|
|
*/
|
|
|
|
unsigned cartesianIndex(const std::array<int,dimension>& coords) const
|
|
|
|
{
|
|
|
|
unsigned cartIndex = coords[0];
|
|
|
|
int factor = cartesianDimensions()[0];
|
|
|
|
for (unsigned i = 1; i < dimension; ++i) {
|
|
|
|
cartIndex += coords[i]*factor;
|
|
|
|
factor *= cartesianDimensions()[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return cartIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Extract Cartesian index triplet (i,j,k) of an active cell.
|
|
|
|
*
|
|
|
|
* \param [in] cellIdx Active cell index.
|
|
|
|
* \param [out] ijk Cartesian index triplet
|
|
|
|
*/
|
|
|
|
void cartesianCoordinate(unsigned cellIdx, std::array<int,3>& ijk) const
|
|
|
|
{ return asImp_().cartesianIndexMapper().cartesianCoordinate(cellIdx, ijk); }
|
|
|
|
|
2016-01-17 14:15:18 -06:00
|
|
|
/*!
|
|
|
|
* \brief Returns the Cartesian cell id given an element index for the grid used for equilibration
|
|
|
|
*/
|
|
|
|
unsigned equilCartesianIndex(unsigned compressedEquilCellIdx) const
|
|
|
|
{ return asImp_().equilCartesianIndexMapper().cartesianIndex(compressedEquilCellIdx); }
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Extract Cartesian index triplet (i,j,k) of an active cell of the grid used for EQUIL.
|
|
|
|
*
|
|
|
|
* \param [in] cellIdx Active cell index.
|
|
|
|
* \param [out] ijk Cartesian index triplet
|
|
|
|
*/
|
|
|
|
void equilCartesianCoordinate(unsigned cellIdx, std::array<int,3>& ijk) const
|
|
|
|
{ return asImp_().equilCartesianIndexMapper().cartesianCoordinate(cellIdx, ijk); }
|
|
|
|
|
2016-12-06 12:39:06 -06:00
|
|
|
/*!
|
|
|
|
* \brief Return the names of the wells which do not penetrate any cells on the local
|
|
|
|
* process.
|
|
|
|
*
|
|
|
|
* This is a kludge around the fact that for distributed grids, not all wells are
|
|
|
|
* seen by all proccesses.
|
|
|
|
*/
|
|
|
|
std::unordered_set<std::string> defunctWellNames() const
|
|
|
|
{ return std::unordered_set<std::string>(); }
|
|
|
|
|
2019-10-01 14:18:17 -05:00
|
|
|
protected:
|
|
|
|
void callImplementationInit()
|
|
|
|
{
|
|
|
|
asImp_().createGrids_();
|
|
|
|
asImp_().filterConnections_();
|
|
|
|
asImp_().updateOutputDir_();
|
|
|
|
asImp_().finalizeInit_();
|
|
|
|
|
|
|
|
if (enableExperiments) {
|
|
|
|
Opm::RelpermDiagnostics relpermDiagnostics;
|
|
|
|
relpermDiagnostics.diagnosis(*eclState_, *deck_, asImp_().grid());
|
|
|
|
}
|
|
|
|
}
|
2016-01-05 12:32:36 -06:00
|
|
|
private:
|
2018-08-14 03:26:36 -05:00
|
|
|
void updateOutputDir_()
|
|
|
|
{
|
|
|
|
// update the location for output
|
|
|
|
std::string outputDir = EWOMS_GET_PARAM(TypeTag, std::string, OutputDir);
|
|
|
|
auto& ioConfig = eclState_->getIOConfig();
|
|
|
|
if (outputDir == "")
|
|
|
|
// If no output directory parameter is specified, use the output directory
|
|
|
|
// which Opm::IOConfig thinks that should be used. Normally this is the
|
|
|
|
// directory in which the input files are located.
|
|
|
|
outputDir = ioConfig.getOutputDir();
|
|
|
|
|
|
|
|
// ensure that the output directory exists and that it is a directory
|
|
|
|
if (!boost::filesystem::is_directory(outputDir)) {
|
|
|
|
try {
|
|
|
|
boost::filesystem::create_directories(outputDir);
|
|
|
|
}
|
|
|
|
catch (...) {
|
|
|
|
throw std::runtime_error("Creation of output directory '"+outputDir+"' failed\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// specify the directory output. This is not a very nice mechanism because
|
|
|
|
// the eclState is supposed to be immutable here, IMO.
|
|
|
|
ioConfig.setOutputDir(outputDir);
|
2018-09-12 12:33:46 -05:00
|
|
|
|
2018-11-07 03:56:12 -06:00
|
|
|
ioConfig.setEclCompatibleRST(!EWOMS_GET_PARAM(TypeTag, bool, EnableOpmRstFile));
|
2018-08-14 03:26:36 -05:00
|
|
|
}
|
|
|
|
|
2016-01-05 12:32:36 -06:00
|
|
|
Implementation& asImp_()
|
|
|
|
{ return *static_cast<Implementation*>(this); }
|
|
|
|
|
|
|
|
const Implementation& asImp_() const
|
|
|
|
{ return *static_cast<const Implementation*>(this); }
|
|
|
|
|
|
|
|
std::string caseName_;
|
2017-10-05 09:15:17 -05:00
|
|
|
|
2019-02-05 09:51:34 -06:00
|
|
|
static Scalar externalSetupTime_;
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
|
|
|
|
static Opm::ParseContext* externalParseContext_;
|
|
|
|
static Opm::ErrorGuard* externalErrorGuard_;
|
2017-10-05 09:15:17 -05:00
|
|
|
static Opm::Deck* externalDeck_;
|
|
|
|
static Opm::EclipseState* externalEclState_;
|
2018-11-08 02:44:20 -06:00
|
|
|
static Opm::Schedule* externalEclSchedule_;
|
|
|
|
static Opm::SummaryConfig* externalEclSummaryConfig_;
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
|
|
|
|
std::unique_ptr<Opm::ParseContext> internalParseContext_;
|
|
|
|
std::unique_ptr<Opm::ErrorGuard> internalErrorGuard_;
|
2017-10-05 09:15:17 -05:00
|
|
|
std::unique_ptr<Opm::Deck> internalDeck_;
|
|
|
|
std::unique_ptr<Opm::EclipseState> internalEclState_;
|
2018-11-08 02:44:20 -06:00
|
|
|
std::unique_ptr<Opm::Schedule> internalEclSchedule_;
|
|
|
|
std::unique_ptr<Opm::SummaryConfig> internalEclSummaryConfig_;
|
2019-09-19 17:49:40 -05:00
|
|
|
std::unique_ptr<Opm::SummaryState> summaryState_;
|
2017-10-05 09:15:17 -05:00
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
// these attributes point either to the internal or to the external version of the
|
|
|
|
// parser objects.
|
|
|
|
Opm::ParseContext* parseContext_;
|
|
|
|
Opm::ErrorGuard* errorGuard_;
|
2017-10-05 09:15:17 -05:00
|
|
|
Opm::Deck* deck_;
|
|
|
|
Opm::EclipseState* eclState_;
|
2018-11-08 02:44:20 -06:00
|
|
|
Opm::Schedule* eclSchedule_;
|
|
|
|
Opm::SummaryConfig* eclSummaryConfig_;
|
2019-05-13 02:16:24 -05:00
|
|
|
|
2019-07-08 08:50:34 -05:00
|
|
|
Dune::EdgeWeightMethod edgeWeightsMethod_;
|
2016-01-05 12:32:36 -06:00
|
|
|
};
|
|
|
|
|
2019-02-05 09:51:34 -06:00
|
|
|
template <class TypeTag>
|
|
|
|
typename EclBaseVanguard<TypeTag>::Scalar EclBaseVanguard<TypeTag>::externalSetupTime_ = 0.0;
|
|
|
|
|
add `mebos`, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.
to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 03:22:11 -05:00
|
|
|
template <class TypeTag>
|
|
|
|
Opm::ParseContext* EclBaseVanguard<TypeTag>::externalParseContext_ = nullptr;
|
|
|
|
|
|
|
|
template <class TypeTag>
|
|
|
|
Opm::ErrorGuard* EclBaseVanguard<TypeTag>::externalErrorGuard_ = nullptr;
|
|
|
|
|
2017-10-05 09:15:17 -05:00
|
|
|
template <class TypeTag>
|
2018-02-01 09:26:58 -06:00
|
|
|
Opm::Deck* EclBaseVanguard<TypeTag>::externalDeck_ = nullptr;
|
2017-10-05 09:15:17 -05:00
|
|
|
|
|
|
|
template <class TypeTag>
|
2018-02-01 09:26:58 -06:00
|
|
|
Opm::EclipseState* EclBaseVanguard<TypeTag>::externalEclState_;
|
2017-10-05 09:15:17 -05:00
|
|
|
|
2018-11-08 02:44:20 -06:00
|
|
|
template <class TypeTag>
|
|
|
|
Opm::Schedule* EclBaseVanguard<TypeTag>::externalEclSchedule_ = nullptr;
|
|
|
|
|
|
|
|
template <class TypeTag>
|
|
|
|
Opm::SummaryConfig* EclBaseVanguard<TypeTag>::externalEclSummaryConfig_ = nullptr;
|
|
|
|
|
2019-09-05 10:04:39 -05:00
|
|
|
} // namespace Opm
|
2016-01-05 12:32:36 -06:00
|
|
|
|
|
|
|
#endif
|