mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-07-07 04:53:03 -05:00
add flow_ebos, an ebos based simulator
it uses ebos for linearization of the mass balance equations and the current flow code from opm-simulators for all the rest. currently, the results match the ones from plain `flow` for SPE1, SPE9 and Norne, but performance is not optimal: on SPE9, converting from and to the legacy data structures takes about a third of the time to do the actual mass balance assembly. nevertheless `flow_ebos` is almost as fast as plain `flow` for SPE9. (for Norne `flow_ebos` is about 15% slower, even though the results match quite closely. the reason for this is that it requires more iterations for some reason.)
This commit is contained in:
parent
4d63a4b0ba
commit
3db63b0a22
|
@ -81,6 +81,7 @@ include (CMakeLists_files.cmake)
|
|||
macro (config_hook)
|
||||
opm_need_version_of ("dune-common")
|
||||
opm_need_version_of ("dune-istl")
|
||||
opm_need_version_of ("ewoms")
|
||||
endmacro (config_hook)
|
||||
|
||||
macro (prereqs_hook)
|
||||
|
|
|
@ -103,6 +103,7 @@ list (APPEND EXAMPLE_SOURCE_FILES
|
|||
examples/find_zero.cpp
|
||||
examples/flow.cpp
|
||||
examples/flow_sequential.cpp
|
||||
examples/flow_ebos.cpp
|
||||
examples/flow_multisegment.cpp
|
||||
examples/flow_solvent.cpp
|
||||
examples/sim_2p_incomp.cpp
|
||||
|
|
|
@ -10,4 +10,4 @@ Label: 2016.10-pre
|
|||
Maintainer: atgeirr@sintef.no
|
||||
MaintainerName: Atgeirr F. Rasmussen
|
||||
Url: http://opm-project.org
|
||||
Depends: opm-common opm-parser opm-output opm-material opm-core opm-grid dune-istl (>=2.2)
|
||||
Depends: opm-common opm-parser opm-output opm-material opm-core opm-grid dune-istl (>=2.2) ewoms
|
||||
|
|
42
examples/flow_ebos.cpp
Normal file
42
examples/flow_ebos.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
|
||||
Copyright 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
|
||||
#include <dune/grid/CpGrid.hpp>
|
||||
#include <opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp>
|
||||
#include <opm/autodiff/FlowMain.hpp>
|
||||
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
typedef Dune::CpGrid Grid;
|
||||
typedef Opm::SimulatorFullyImplicitBlackoilEbos<Grid> Simulator;
|
||||
|
||||
Opm::FlowMain<Grid, Simulator> mainfunc;
|
||||
return mainfunc.execute(argc, argv);
|
||||
}
|
|
@ -558,6 +558,28 @@ namespace Opm
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts the AutoDiffMatrix to an Eigen SparseMatrix.This might be
|
||||
* an expensive operation to perform for e.g., an identity matrix or a
|
||||
* diagonal matrix.
|
||||
*/
|
||||
template<class Scalar, int Options, class Index>
|
||||
void assign(const Eigen::SparseMatrix<Scalar, Options, Index>& s)
|
||||
{
|
||||
(*this) = AutoDiffMatrix( s.rows(), s.cols() );
|
||||
type_ = Sparse;
|
||||
sparse_ = s;
|
||||
}
|
||||
|
||||
|
||||
template<class Scalar, int Options, class Index>
|
||||
void assign(const Eigen::SparseMatrix<Scalar, Options, Index>&& s)
|
||||
{
|
||||
(*this) = AutoDiffMatrix( s.rows(), s.cols() );
|
||||
type_ = Sparse;
|
||||
sparse_ = std::move(s);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns number of rows in the matrix
|
||||
|
|
1922
opm/autodiff/BlackoilModelEbos.hpp
Normal file
1922
opm/autodiff/BlackoilModelEbos.hpp
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -110,7 +110,6 @@ namespace Opm
|
|||
}
|
||||
|
||||
|
||||
|
||||
template <class PhysicalModel>
|
||||
int
|
||||
NonlinearSolver<PhysicalModel>::
|
||||
|
@ -169,7 +168,6 @@ namespace Opm
|
|||
}
|
||||
|
||||
|
||||
|
||||
template <class PhysicalModel>
|
||||
void NonlinearSolver<PhysicalModel>::SolverParameters::
|
||||
reset()
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef OPM_SIMULATORBASE_HEADER_INCLUDED
|
||||
#define OPM_SIMULATORBASE_HEADER_INCLUDED
|
||||
|
||||
#include <ewoms/common/timer.hh>
|
||||
#include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
|
||||
#include <opm/autodiff/IterationReport.hpp>
|
||||
#include <opm/autodiff/NewtonIterationBlackoilInterface.hpp>
|
||||
|
|
73
opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp
Normal file
73
opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Copyright 2013, 2015 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2015 Andreas Lauser
|
||||
|
||||
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_SIMULATORFULLYIMPLICITBLACKOIL_HEADER_INCLUDED
|
||||
#define OPM_SIMULATORFULLYIMPLICITBLACKOIL_HEADER_INCLUDED
|
||||
|
||||
#include <opm/autodiff/SimulatorBase.hpp>
|
||||
#include <opm/autodiff/NonlinearSolver.hpp>
|
||||
#include <opm/autodiff/BlackoilModelEbos.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template <class GridT>
|
||||
class SimulatorFullyImplicitBlackoilEbos;
|
||||
class StandardWells;
|
||||
|
||||
template <class GridT>
|
||||
struct SimulatorTraits<SimulatorFullyImplicitBlackoilEbos<GridT> >
|
||||
{
|
||||
typedef WellStateFullyImplicitBlackoil WellState;
|
||||
typedef BlackoilState ReservoirState;
|
||||
typedef BlackoilOutputWriter OutputWriter;
|
||||
typedef GridT Grid;
|
||||
typedef BlackoilModelEbos<Grid> Model;
|
||||
typedef NonlinearSolver<Model> Solver;
|
||||
typedef StandardWells WellModel;
|
||||
};
|
||||
|
||||
/// a simulator for the blackoil model
|
||||
template <class GridT>
|
||||
class SimulatorFullyImplicitBlackoilEbos
|
||||
: public SimulatorBase<SimulatorFullyImplicitBlackoilEbos<GridT> >
|
||||
{
|
||||
typedef SimulatorBase<SimulatorFullyImplicitBlackoilEbos<GridT> > Base;
|
||||
public:
|
||||
// forward the constructor to the base class
|
||||
SimulatorFullyImplicitBlackoilEbos(const parameter::ParameterGroup& param,
|
||||
const typename Base::Grid& grid,
|
||||
DerivedGeology& geo,
|
||||
BlackoilPropsAdInterface& props,
|
||||
const RockCompressibility* rock_comp_props,
|
||||
NewtonIterationBlackoilInterface& linsolver,
|
||||
const double* gravity,
|
||||
const bool disgas,
|
||||
const bool vapoil,
|
||||
std::shared_ptr<EclipseState> eclipse_state,
|
||||
BlackoilOutputWriter& output_writer,
|
||||
const std::vector<double>& threshold_pressures_by_face)
|
||||
: Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil,
|
||||
eclipse_state, output_writer, threshold_pressures_by_face)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_SIMULATORFULLYIMPLICITBLACKOIL_HEADER_INCLUDED
|
|
@ -205,8 +205,8 @@ namespace {
|
|||
PolymerBlackoilState& x ,
|
||||
WellStateFullyImplicitBlackoilPolymer& xw)
|
||||
{
|
||||
const std::vector<double>& polymer_inflow = xw.polymerInflow();
|
||||
const double dt = timer.currentStepLength();
|
||||
const std::vector<double>& polymer_inflow = xw.polymerInflow();
|
||||
|
||||
// Initial max concentration of this time step from PolymerBlackoilState.
|
||||
cmax_ = Eigen::Map<V>(&x.getCellData( x.CMAX )[0], Opm::AutoDiffGrid::numCells(grid_));
|
||||
|
|
Loading…
Reference in New Issue
Block a user