2016-07-12 12:01:14 -05:00
|
|
|
/*
|
|
|
|
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
|
|
|
|
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
|
|
|
|
Copyright 2015 IRIS AS
|
|
|
|
Copyright 2014 STATOIL ASA.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
|
|
|
|
#define OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
|
|
|
|
|
|
|
|
#include <opm/autodiff/FlowMain.hpp>
|
|
|
|
#include <opm/autodiff/BlackoilModelEbos.hpp>
|
|
|
|
|
2016-11-14 07:05:24 -06:00
|
|
|
#include <ewoms/version.hh>
|
|
|
|
|
2016-07-12 12:01:14 -05:00
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
// The FlowMain class is the ebos based black-oil simulator.
|
2016-08-08 08:12:51 -05:00
|
|
|
class FlowMainEbos : public FlowMainBase<FlowMainEbos, Dune::CpGrid, Opm::SimulatorFullyImplicitBlackoilEbos>
|
2016-07-12 12:01:14 -05:00
|
|
|
{
|
|
|
|
protected:
|
2016-08-08 08:12:51 -05:00
|
|
|
typedef Opm::SimulatorFullyImplicitBlackoilEbos Simulator;
|
2016-07-12 12:01:14 -05:00
|
|
|
typedef FlowMainBase<FlowMainEbos, Dune::CpGrid, Simulator> Base;
|
|
|
|
friend Base;
|
|
|
|
|
2016-08-08 08:26:09 -05:00
|
|
|
typedef typename TTAG(EclFlowProblem) TypeTag;
|
|
|
|
typedef typename GET_PROP_TYPE(TypeTag, Simulator) EbosSimulator;
|
|
|
|
|
2016-11-14 07:05:24 -06:00
|
|
|
// Print startup message if on output rank.
|
|
|
|
void printStartupMessage()
|
|
|
|
{
|
|
|
|
if (output_cout_) {
|
|
|
|
const int lineLen = 70;
|
|
|
|
const std::string version = moduleVersionName();
|
|
|
|
const std::string banner = "This is flow_ebos (version "+version+")";
|
|
|
|
const std::string ewomsVersion = "(eWoms version: " + Ewoms::versionString() + ")";
|
|
|
|
const int bannerPreLen = (lineLen - 2 - banner.size())/2;
|
|
|
|
const int bannerPostLen = bannerPreLen + (lineLen - 2 - banner.size())%2;
|
|
|
|
const int eVPreLen = (lineLen - 2 - ewomsVersion.size())/2;
|
|
|
|
const int eVPostLen = eVPreLen + (lineLen - 2 - ewomsVersion.size())%2;
|
|
|
|
std::cout << "**********************************************************************\n";
|
|
|
|
std::cout << "* *\n";
|
|
|
|
std::cout << "*" << std::string(bannerPreLen, ' ') << banner << std::string(bannerPostLen, ' ') << "*\n";
|
|
|
|
std::cout << "*" << std::string(eVPreLen, ' ') << ewomsVersion << std::string(eVPostLen, ' ') << "*\n";
|
|
|
|
std::cout << "* *\n";
|
|
|
|
std::cout << "* Flow is a simulator for fully implicit three-phase black-oil flow, *\n";
|
|
|
|
std::cout << "* and is part of OPM. For more information see: *\n";
|
|
|
|
std::cout << "* http://opm-project.org *\n";
|
|
|
|
std::cout << "* *\n";
|
|
|
|
std::cout << "**********************************************************************\n\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-08 08:26:09 -05:00
|
|
|
// Parser the input and creates the Deck and EclipseState objects.
|
|
|
|
// Writes to:
|
|
|
|
// deck_
|
|
|
|
// eclipse_state_
|
|
|
|
// May throw if errors are encountered, here configured to be somewhat tolerant.
|
|
|
|
void readDeckInput()
|
|
|
|
{
|
|
|
|
std::string progName("flow_ebos");
|
|
|
|
std::string deckFile("--ecl-deck-file-name=");
|
|
|
|
deckFile += param_.get<std::string>("deck_filename");
|
|
|
|
char* ptr[2];
|
|
|
|
ptr[ 0 ] = const_cast< char * > (progName.c_str());
|
|
|
|
ptr[ 1 ] = const_cast< char * > (deckFile.c_str());
|
|
|
|
EbosSimulator::registerParameters();
|
|
|
|
Ewoms::setupParameters_< TypeTag > ( 2, ptr );
|
2016-08-09 07:48:37 -05:00
|
|
|
ebosSimulator_.reset(new EbosSimulator(/*verbose=*/false));
|
2016-08-08 08:26:09 -05:00
|
|
|
ebosSimulator_->model().applyInitialSolution();
|
|
|
|
|
|
|
|
Base::deck_ = ebosSimulator_->gridManager().deck();
|
|
|
|
Base::eclipse_state_ = ebosSimulator_->gridManager().eclState();
|
2016-10-20 13:16:42 -05:00
|
|
|
IOConfig& ioConfig = Base::eclipse_state_->getIOConfig();
|
|
|
|
ioConfig.setOutputDir(Base::output_dir_);
|
2016-08-08 08:26:09 -05:00
|
|
|
|
|
|
|
// Possibly override IOConfig setting (from deck) for how often RESTART files should get written to disk (every N report step)
|
|
|
|
if (Base::param_.has("output_interval")) {
|
|
|
|
const int output_interval = Base::param_.get<int>("output_interval");
|
2016-08-19 03:30:49 -05:00
|
|
|
eclipse_state_->getRestartConfig().overrideRestartWriteInterval( size_t( output_interval ) );
|
|
|
|
|
2016-08-08 08:26:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Possible to force initialization only behavior (NOSIM).
|
|
|
|
if (Base::param_.has("nosim")) {
|
|
|
|
const bool nosim = Base::param_.get<bool>("nosim");
|
2016-10-20 13:16:42 -05:00
|
|
|
ioConfig.overrideNOSIM( nosim );
|
2016-08-08 08:26:09 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-02 07:10:44 -05:00
|
|
|
// Setup linear solver.
|
|
|
|
// Writes to:
|
|
|
|
// fis_solver_
|
|
|
|
void setupLinearSolver()
|
|
|
|
{
|
|
|
|
typedef typename BlackoilModelEbos :: ISTLSolverType ISTLSolverType;
|
|
|
|
Base::fis_solver_.reset( new ISTLSolverType( Base::param_, Base::parallel_information_ ) );
|
|
|
|
}
|
|
|
|
|
2016-08-08 08:26:09 -05:00
|
|
|
/// This is the main function of Flow.
|
2016-07-12 12:01:14 -05:00
|
|
|
// Create simulator instance.
|
|
|
|
// Writes to:
|
|
|
|
// simulator_
|
|
|
|
void createSimulator()
|
|
|
|
{
|
|
|
|
// Create the simulator instance.
|
2016-08-08 08:26:09 -05:00
|
|
|
Base::simulator_.reset(new Simulator(*ebosSimulator_,
|
|
|
|
Base::param_,
|
2016-07-12 12:01:14 -05:00
|
|
|
*Base::geoprops_,
|
|
|
|
*Base::fluidprops_,
|
|
|
|
Base::rock_comp_->isActive() ? Base::rock_comp_.get() : nullptr,
|
|
|
|
*Base::fis_solver_,
|
|
|
|
Base::gravity_.data(),
|
|
|
|
Base::deck_->hasKeyword("DISGAS"),
|
|
|
|
Base::deck_->hasKeyword("VAPOIL"),
|
|
|
|
Base::eclipse_state_,
|
|
|
|
*Base::output_writer_,
|
|
|
|
Base::threshold_pressures_));
|
|
|
|
}
|
2016-08-08 08:26:09 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<EbosSimulator> ebosSimulator_;
|
2016-07-12 12:01:14 -05:00
|
|
|
};
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#endif // OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
|