The main content of this commit is that the loading of restart files is based on map of keys passed in from calling scope. This way the selection of keywords to save and load is fully under control of calling scope, but in addition there are many small refactorings: - The EclipseWriter class and implementation has been renamed EclipseIO. - The loading and saving of restart files has been moved to file and namespace RestartIO, which contains two loose functions load( ) and save( ). - The Summary() and RFT( ) data get their own copies of the data::Cells vector. - Removed some abstractions and wrrappers around C / ert datastructures. Using ecl_file_view when loading restart files, instead of bare ecl_file. Simplified opening of unified restart files. - Removed the ability to save restart keywords in double precision.
92 lines
2.9 KiB
C++
92 lines
2.9 KiB
C++
/*
|
|
Copyright (c) 2016 Statoil ASA
|
|
Copyright (c) 2013-2015 Andreas Lauser
|
|
Copyright (c) 2013 SINTEF ICT, Applied Mathematics.
|
|
Copyright (c) 2013 Uni Research AS
|
|
Copyright (c) 2015 IRIS AS
|
|
|
|
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 RESTART_IO_HPP
|
|
#define RESTART_IO_HPP
|
|
|
|
#include <vector>
|
|
|
|
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
|
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
|
|
|
#include <opm/output/data/Cells.hpp>
|
|
#include <opm/output/data/Solution.hpp>
|
|
#include <opm/output/data/Wells.hpp>
|
|
|
|
#include <ert/ecl/EclKW.hpp>
|
|
#include <ert/ecl/ecl_rsthead.h>
|
|
#include <ert/ecl/ecl_rst_file.h>
|
|
#include <ert/util/util.h>
|
|
|
|
namespace Opm {
|
|
|
|
class EclipseGrid;
|
|
class EclipseState;
|
|
class Phases;
|
|
class Schedule;
|
|
|
|
namespace RestartIO {
|
|
|
|
|
|
/*
|
|
The two loose functions RestartIO::save() and RestartIO::load() can
|
|
be used to save and load reservoir and well state from restart
|
|
files. Observe that these functions 'just do it', i.e. the checking
|
|
of which report step to load from, if output is enabled at all and
|
|
so on is handled by an outer scope.
|
|
|
|
If the filename corresponds to unified eclipse restart file,
|
|
i.e. UNRST the functions will seek correctly to the correct report
|
|
step, and truncate in the case of save. For any other filename the
|
|
functions will start reading and writing from file offset zero. If
|
|
the input filename does not correspond to a unified restart file
|
|
there is no consistency checking between filename and report step;
|
|
i.e. these calls:
|
|
|
|
load("CASE.X0010" , 99 , ...)
|
|
save("CASE.X0010" , 99 , ...)
|
|
|
|
will read and write to the file "CASE.X0010" - completely ignoring
|
|
the report step argument '99'.
|
|
*/
|
|
|
|
void save(const std::string& filename,
|
|
int report_step,
|
|
double seconds_elapsed,
|
|
data::Solution cells,
|
|
data::Wells wells,
|
|
const EclipseState& es,
|
|
const EclipseGrid& grid);
|
|
|
|
|
|
|
|
std::pair< data::Solution, data::Wells > load( const std::string& filename,
|
|
int report_step,
|
|
const std::map<std::string, UnitSystem::measure>& keys,
|
|
const EclipseState& es,
|
|
const EclipseGrid& grid);
|
|
|
|
}
|
|
}
|
|
#endif
|