move ebos/eclgenerictracermodel[_impl].[hh|cc] to opm/simulators/flow

This commit is contained in:
Arne Morten Kvarving
2024-02-02 10:46:44 +01:00
parent a01e1bd902
commit 3a3881e8d9
9 changed files with 117 additions and 118 deletions

View File

@@ -26,7 +26,6 @@ list (APPEND MAIN_SOURCE_FILES
ebos/eclgenericcpgridvanguard.cc
ebos/eclgenericproblem.cc
ebos/eclgenericthresholdpressure.cc
ebos/eclgenerictracermodel.cc
ebos/eclgenericvanguard.cc
ebos/ecltransmissibility.cc
ebos/equil/equilibrationhelpers.cc
@@ -43,6 +42,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/ExtraConvergenceOutputThread.cpp
opm/simulators/flow/FlowUtils.cpp
opm/simulators/flow/GenericOutputBlackoilModule.cpp
opm/simulators/flow/GenericTracerModel.cpp
opm/simulators/flow/InterRegFlows.cpp
opm/simulators/flow/KeywordValidation.cpp
opm/simulators/flow/LogOutputHelper.cpp
@@ -419,8 +419,6 @@ list (APPEND PUBLIC_HEADER_FILES
ebos/eclgenericproblem_impl.hh
ebos/eclgenericthresholdpressure.hh
ebos/eclgenericthresholdpressure_impl.hh
ebos/eclgenerictracermodel.hh
ebos/eclgenerictracermodel_impl.hh
ebos/eclgenericvanguard.hh
ebos/eclnewtonmethod.hh
ebos/eclproblem.hh
@@ -453,6 +451,8 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/FlowUtils.hpp
opm/simulators/flow/FlowsData.hpp
opm/simulators/flow/GenericOutputBlackoilModule.hpp
opm/simulators/flow/GenericTracerModel.hpp
opm/simulators/flow/GenericTracerModel_impl.hpp
opm/simulators/flow/InterRegFlows.hpp
opm/simulators/flow/KeywordValidation.hpp
opm/simulators/flow/LogOutputHelper.hpp

View File

@@ -1,57 +0,0 @@
// -*- 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/>.
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.
*/
#include <config.h>
#include "eclgenerictracermodel_impl.hh"
#if HAVE_DUNE_FEM
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
#include <dune/fem/gridpart/common/gridpart2gridview.hh>
#include <opm/simulators/flow/FemCpGridCompat.hpp>
#endif // HAVE_DUNE_FEM
namespace Opm {
template class EclGenericTracerModel<Dune::CpGrid,
Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>,
Dune::MultipleCodimMultipleGeomTypeMapper<Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>>,
Opm::EcfvStencil<double,Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>,false,false>,
double>;
#if HAVE_DUNE_FEM
template class EclGenericTracerModel<Dune::CpGrid,
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,
Dune::MultipleCodimMultipleGeomTypeMapper<Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>>,
Opm::EcfvStencil<double,Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,false,false>,
double>;
template class EclGenericTracerModel<Dune::CpGrid,
Dune::Fem::GridPart2GridViewImpl<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, (Dune::PartitionIteratorType)4, false> >,
Dune::MultipleCodimMultipleGeomTypeMapper<
Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false> > >,
Opm::EcfvStencil<double, Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false> >,
false, false>,
double>;
#endif // HAVE_DUNE_FEM
} // namespace Opm

View File

@@ -28,12 +28,11 @@
#ifndef EWOMS_ECL_TRACER_MODEL_HH
#define EWOMS_ECL_TRACER_MODEL_HH
#include <ebos/eclgenerictracermodel.hh>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/models/utils/propertysystem.hh>
#include <opm/simulators/flow/GenericTracerModel.hpp>
#include <opm/simulators/utils/VectorVectorDataHandle.hpp>
#include <array>
@@ -60,17 +59,17 @@ namespace Opm {
* \brief A class which handles tracers as specified in by ECL
*/
template <class TypeTag>
class EclTracerModel : public EclGenericTracerModel<GetPropType<TypeTag, Properties::Grid>,
GetPropType<TypeTag, Properties::GridView>,
GetPropType<TypeTag, Properties::DofMapper>,
GetPropType<TypeTag, Properties::Stencil>,
GetPropType<TypeTag, Properties::Scalar>>
class EclTracerModel : public GenericTracerModel<GetPropType<TypeTag, Properties::Grid>,
GetPropType<TypeTag, Properties::GridView>,
GetPropType<TypeTag, Properties::DofMapper>,
GetPropType<TypeTag, Properties::Stencil>,
GetPropType<TypeTag, Properties::Scalar>>
{
using BaseType = EclGenericTracerModel<GetPropType<TypeTag, Properties::Grid>,
GetPropType<TypeTag, Properties::GridView>,
GetPropType<TypeTag, Properties::DofMapper>,
GetPropType<TypeTag, Properties::Stencil>,
GetPropType<TypeTag, Properties::Scalar>>;
using BaseType = GenericTracerModel<GetPropType<TypeTag, Properties::Grid>,
GetPropType<TypeTag, Properties::GridView>,
GetPropType<TypeTag, Properties::DofMapper>,
GetPropType<TypeTag, Properties::Stencil>,
GetPropType<TypeTag, Properties::Scalar>>;
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Grid = GetPropType<TypeTag, Properties::Grid>;

View File

@@ -29,12 +29,12 @@
// these are not explicitly instanced in library
#include <ebos/eclgenericproblem_impl.hh>
#include <ebos/eclgenericthresholdpressure_impl.hh>
#include <ebos/eclgenerictracermodel_impl.hh>
#include <ebos/ecltransmissibility_impl.hh>
#include <ebos/equil/initstateequil_impl.hh>
#include <opm/simulators/flow/AluGridVanguard.hpp>
#include <opm/simulators/flow/CollectDataOnIORank_impl.hpp>
#include <opm/simulators/flow/EclGenericWriter_impl.hpp>
#include <opm/simulators/flow/GenericTracerModel_impl.hpp>
#include <opm/simulators/utils/GridDataOutput_impl.hpp>
namespace Opm {

View File

@@ -29,11 +29,11 @@
// these are not explicitly instanced in library
#include <ebos/eclgenericproblem_impl.hh>
#include <ebos/eclgenericthresholdpressure_impl.hh>
#include <ebos/eclgenerictracermodel_impl.hh>
#include <ebos/ecltransmissibility_impl.hh>
#include <ebos/equil/initstateequil_impl.hh>
#include <opm/simulators/flow/CollectDataOnIORank_impl.hpp>
#include <opm/simulators/flow/EclGenericWriter_impl.hpp>
#include <opm/simulators/flow/GenericTracerModel_impl.hpp>
#include <opm/simulators/utils/GridDataOutput_impl.hpp>
namespace Opm {

View File

@@ -0,0 +1,58 @@
// -*- 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/>.
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.
*/
#include <config.h>
#include <opm/simulators/flow/GenericTracerModel_impl.hpp>
#if HAVE_DUNE_FEM
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
#include <dune/fem/gridpart/common/gridpart2gridview.hh>
#include <opm/simulators/flow/FemCpGridCompat.hpp>
#endif // HAVE_DUNE_FEM
namespace Opm {
template class GenericTracerModel<Dune::CpGrid,
Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>,
Dune::MultipleCodimMultipleGeomTypeMapper<Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>>,
Opm::EcfvStencil<double,Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>,false,false>,
double>;
#if HAVE_DUNE_FEM
template class GenericTracerModel<Dune::CpGrid,
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,
Dune::MultipleCodimMultipleGeomTypeMapper<Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>>,
EcfvStencil<double,Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,false,false>,
double>;
template class GenericTracerModel<Dune::CpGrid,
Dune::Fem::GridPart2GridViewImpl<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, (Dune::PartitionIteratorType)4, false> >,
Dune::MultipleCodimMultipleGeomTypeMapper<
Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false> > >,
EcfvStencil<double, Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false> >,
false, false>,
double>;
#endif // HAVE_DUNE_FEM
} // namespace Opm

View File

@@ -23,10 +23,10 @@
/**
* \file
*
* \copydoc Opm::EclTracerModel
* \copydoc Opm::TracerModel
*/
#ifndef EWOMS_ECL_GENERIC_TRACER_MODEL_HH
#define EWOMS_ECL_GENERIC_TRACER_MODEL_HH
#ifndef OPM_GENERIC_TRACER_MODEL_HPP
#define OPM_GENERIC_TRACER_MODEL_HPP
#include <dune/istl/bcrsmatrix.hh>
@@ -50,7 +50,7 @@ class EclipseState;
class Well;
template<class Grid, class GridView, class DofMapper, class Stencil, class Scalar>
class EclGenericTracerModel {
class GenericTracerModel {
public:
using TracerMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
using TracerVector = Dune::BlockVector<Dune::FieldVector<Scalar,1>>;
@@ -88,11 +88,11 @@ public:
}
protected:
EclGenericTracerModel(const GridView& gridView,
const EclipseState& eclState,
const CartesianIndexMapper& cartMapper,
const DofMapper& dofMapper,
const std::function<std::array<double,dimWorld>(int)> centroids);
GenericTracerModel(const GridView& gridView,
const EclipseState& eclState,
const CartesianIndexMapper& cartMapper,
const DofMapper& dofMapper,
const std::function<std::array<double,dimWorld>(int)> centroids);
/*!
* \brief Initialize all internal data structures needed by the tracer module
@@ -127,4 +127,4 @@ protected:
} // namespace Opm
#endif
#endif // OPM_GENERIC_TRACER_MODEL_HPP

View File

@@ -23,10 +23,10 @@
/**
* \file
*
* \copydoc Opm::EclTracerModel
* \copydoc Opm::TracerModel
*/
#ifndef EWOMS_ECL_GENERIC_TRACER_MODEL_IMPL_HH
#define EWOMS_ECL_GENERIC_TRACER_MODEL_IMPL_HH
#ifndef OPM_GENERIC_TRACER_MODEL_IMPL_HPP
#define OPM_GENERIC_TRACER_MODEL_IMPL_HPP
#include <dune/istl/operators.hh>
#include <dune/istl/solvers.hh>
@@ -34,8 +34,6 @@
#include <dune/istl/preconditioners.hh>
#include <dune/istl/schwarz.hh>
#include <ebos/eclgenerictracermodel.hh>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/grid/CpGrid.hpp>
@@ -48,6 +46,7 @@
#include <opm/models/discretization/ecfv/ecfvstencil.hh>
#include <opm/simulators/flow/GenericTracerModel.hpp>
#include <opm/simulators/linalg/ilufirstelement.hh>
#include <opm/simulators/linalg/PropertyTree.hpp>
#include <opm/simulators/linalg/FlexibleSolver.hpp>
@@ -56,7 +55,6 @@
#include <array>
#include <functional>
#include <iostream>
#include <memory>
#include <set>
#include <stdexcept>
@@ -100,12 +98,12 @@ createParallelFlexibleSolver(const Dune::CpGrid& grid, const Matrix& M, const Pr
#endif
template<class Grid, class GridView, class DofMapper, class Stencil, class Scalar>
EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
EclGenericTracerModel(const GridView& gridView,
const EclipseState& eclState,
const CartesianIndexMapper& cartMapper,
const DofMapper& dofMapper,
const std::function<std::array<double,dimWorld>(int)> centroids)
GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
GenericTracerModel(const GridView& gridView,
const EclipseState& eclState,
const CartesianIndexMapper& cartMapper,
const DofMapper& dofMapper,
const std::function<std::array<double,dimWorld>(int)> centroids)
: gridView_(gridView)
, eclState_(eclState)
, cartMapper_(cartMapper)
@@ -115,7 +113,7 @@ EclGenericTracerModel(const GridView& gridView,
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
Scalar EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
Scalar GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
tracerConcentration(int tracerIdx, int globalDofIdx) const
{
if (tracerConcentration_.empty())
@@ -125,42 +123,42 @@ tracerConcentration(int tracerIdx, int globalDofIdx) const
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
void EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
void GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
setTracerConcentration(int tracerIdx, int globalDofIdx, Scalar value)
{
this->tracerConcentration_[tracerIdx][globalDofIdx] = value;
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
int EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
int GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
numTracers() const
{
return this->eclState_.tracer().size();
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
std::string EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
std::string GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
fname(int tracerIdx) const
{
return this->eclState_.tracer()[tracerIdx].fname();
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
double EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
double GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
currentConcentration_(const Well& eclWell, const std::string& name) const
{
return eclWell.getTracerProperties().getConcentration(name);
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
const std::string& EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
const std::string& GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
name(int tracerIdx) const
{
return this->eclState_.tracer()[tracerIdx].name;
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
void EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
void GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
doInit(bool rst, std::size_t numGridDof,
std::size_t gasPhaseIdx, std::size_t oilPhaseIdx, std::size_t waterPhaseIdx)
{
@@ -256,7 +254,7 @@ doInit(bool rst, std::size_t numGridDof,
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
bool EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
bool GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
linearSolve_(const TracerMatrix& M, TracerVector& x, TracerVector& b)
{
x = 0.0;
@@ -311,7 +309,7 @@ linearSolve_(const TracerMatrix& M, TracerVector& x, TracerVector& b)
}
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
bool EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
bool GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
linearSolveBatchwise_(const TracerMatrix& M, std::vector<TracerVector>& x, std::vector<TracerVector>& b)
{
Scalar tolerance = 1e-2;
@@ -371,6 +369,6 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector<TracerVector>& x, std::
#endif
}
} // namespace Opm
#endif
#endif // OPM_GENERIC_TRACER_MODEL_IMPL_HPP

View File

@@ -350,10 +350,11 @@ BOOST_AUTO_TEST_CASE(BlackoilWellModelGeneric)
}
template<class Grid, class GridView, class DofMapper, class Stencil, class Scalar>
class EclGenericTracerModelTest : public Opm::EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar> {
using Base = Opm::EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>;
class GenericTracerModelTest : public Opm::GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>
{
using Base = Opm::GenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>;
public:
EclGenericTracerModelTest(const GridView& gridView,
GenericTracerModelTest(const GridView& gridView,
const Opm::EclipseState& eclState,
const Dune::CartesianIndexMapper<Grid>& cartMapper,
const DofMapper& dofMapper,
@@ -361,21 +362,21 @@ public:
Base(gridView, eclState, cartMapper, dofMapper, centroids)
{}
static EclGenericTracerModelTest
static GenericTracerModelTest
serializationTestObject(const GridView& gridView,
const Opm::EclipseState& eclState,
const Dune::CartesianIndexMapper<Grid>& cartMapper,
const DofMapper& dofMapper,
const std::function<std::array<double,Grid::dimensionworld>(int)> centroids)
{
EclGenericTracerModelTest result(gridView, eclState, cartMapper, dofMapper, centroids);
GenericTracerModelTest result(gridView, eclState, cartMapper, dofMapper, centroids);
result.tracerConcentration_ = {{1.0}, {2.0}, {3.0}};
result.wellTracerRate_.insert({{"foo", "bar"}, 4.0});
return result;
}
bool operator==(const EclGenericTracerModelTest& rhs) const
bool operator==(const GenericTracerModelTest& rhs) const
{
if (this->tracerConcentration_.size() != rhs.tracerConcentration_.size()) {
return false;
@@ -408,11 +409,11 @@ BOOST_AUTO_TEST_CASE(EclGenericTracerModel)
auto gridView = grid.leafGridView();
#endif // HAVE_DUNE_FEM
Dune::MultipleCodimMultipleGeomTypeMapper<GridView> dofMapper(gridView, Dune::mcmgElementLayout());
auto data_out = EclGenericTracerModelTest<Dune::CpGrid,
GridView,
Dune::MultipleCodimMultipleGeomTypeMapper<GridView>,
Opm::EcfvStencil<double, GridView, false, false>,
double>
auto data_out = GenericTracerModelTest<Dune::CpGrid,
GridView,
Dune::MultipleCodimMultipleGeomTypeMapper<GridView>,
Opm::EcfvStencil<double, GridView, false, false>,
double>
::serializationTestObject(gridView, eclState, mapper, dofMapper, centroids);
Opm::Serialization::MemPacker packer;
Opm::Serializer ser(packer);