diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index deccde761..848445ea1 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -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 diff --git a/ebos/eclgenerictracermodel.cc b/ebos/eclgenerictracermodel.cc deleted file mode 100644 index d4d9d8e4a..000000000 --- a/ebos/eclgenerictracermodel.cc +++ /dev/null @@ -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 . - - 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 -#include "eclgenerictracermodel_impl.hh" - -#if HAVE_DUNE_FEM -#include -#include -#include -#endif // HAVE_DUNE_FEM - -namespace Opm { - -template class EclGenericTracerModel>, - Dune::MultipleCodimMultipleGeomTypeMapper>>, - Opm::EcfvStencil>,false,false>, - double>; - -#if HAVE_DUNE_FEM -template class EclGenericTracerModel>>, - Dune::MultipleCodimMultipleGeomTypeMapper>>>, - Opm::EcfvStencil>>,false,false>, - double>; -template class EclGenericTracerModel >, - Dune::MultipleCodimMultipleGeomTypeMapper< - Dune::Fem::GridPart2GridViewImpl< - Dune::Fem::AdaptiveLeafGridPart > >, - Opm::EcfvStencil >, - false, false>, - double>; -#endif // HAVE_DUNE_FEM - -} // namespace Opm diff --git a/ebos/ecltracermodel.hh b/ebos/ecltracermodel.hh index d5ca5d356..cc16d8ef6 100644 --- a/ebos/ecltracermodel.hh +++ b/ebos/ecltracermodel.hh @@ -28,12 +28,11 @@ #ifndef EWOMS_ECL_TRACER_MODEL_HH #define EWOMS_ECL_TRACER_MODEL_HH -#include - #include #include +#include #include #include @@ -60,17 +59,17 @@ namespace Opm { * \brief A class which handles tracers as specified in by ECL */ template -class EclTracerModel : public EclGenericTracerModel, - GetPropType, - GetPropType, - GetPropType, - GetPropType> +class EclTracerModel : public GenericTracerModel, + GetPropType, + GetPropType, + GetPropType, + GetPropType> { - using BaseType = EclGenericTracerModel, - GetPropType, - GetPropType, - GetPropType, - GetPropType>; + using BaseType = GenericTracerModel, + GetPropType, + GetPropType, + GetPropType, + GetPropType>; using Simulator = GetPropType; using GridView = GetPropType; using Grid = GetPropType; diff --git a/flow/flow_blackoil_alugrid.cpp b/flow/flow_blackoil_alugrid.cpp index 0051714a2..99b548a4d 100644 --- a/flow/flow_blackoil_alugrid.cpp +++ b/flow/flow_blackoil_alugrid.cpp @@ -29,12 +29,12 @@ // these are not explicitly instanced in library #include #include -#include #include #include #include #include #include +#include #include namespace Opm { diff --git a/flow/flow_blackoil_polyhedralgrid.cpp b/flow/flow_blackoil_polyhedralgrid.cpp index e27cc1570..b4b1abdc0 100644 --- a/flow/flow_blackoil_polyhedralgrid.cpp +++ b/flow/flow_blackoil_polyhedralgrid.cpp @@ -29,11 +29,11 @@ // these are not explicitly instanced in library #include #include -#include #include #include #include #include +#include #include namespace Opm { diff --git a/opm/simulators/flow/GenericTracerModel.cpp b/opm/simulators/flow/GenericTracerModel.cpp new file mode 100644 index 000000000..df8f3519e --- /dev/null +++ b/opm/simulators/flow/GenericTracerModel.cpp @@ -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 . + + 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 + +#include + +#if HAVE_DUNE_FEM +#include +#include +#include +#endif // HAVE_DUNE_FEM + +namespace Opm { + +template class GenericTracerModel>, + Dune::MultipleCodimMultipleGeomTypeMapper>>, + Opm::EcfvStencil>,false,false>, + double>; + +#if HAVE_DUNE_FEM +template class GenericTracerModel>>, + Dune::MultipleCodimMultipleGeomTypeMapper>>>, + EcfvStencil>>,false,false>, + double>; +template class GenericTracerModel >, + Dune::MultipleCodimMultipleGeomTypeMapper< + Dune::Fem::GridPart2GridViewImpl< + Dune::Fem::AdaptiveLeafGridPart > >, + EcfvStencil >, + false, false>, + double>; +#endif // HAVE_DUNE_FEM + +} // namespace Opm diff --git a/ebos/eclgenerictracermodel.hh b/opm/simulators/flow/GenericTracerModel.hpp similarity index 88% rename from ebos/eclgenerictracermodel.hh rename to opm/simulators/flow/GenericTracerModel.hpp index 8cf339c4e..4e7b10ccc 100644 --- a/ebos/eclgenerictracermodel.hh +++ b/opm/simulators/flow/GenericTracerModel.hpp @@ -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 @@ -50,7 +50,7 @@ class EclipseState; class Well; template -class EclGenericTracerModel { +class GenericTracerModel { public: using TracerMatrix = Dune::BCRSMatrix>; using TracerVector = Dune::BlockVector>; @@ -88,11 +88,11 @@ public: } protected: - EclGenericTracerModel(const GridView& gridView, - const EclipseState& eclState, - const CartesianIndexMapper& cartMapper, - const DofMapper& dofMapper, - const std::function(int)> centroids); + GenericTracerModel(const GridView& gridView, + const EclipseState& eclState, + const CartesianIndexMapper& cartMapper, + const DofMapper& dofMapper, + const std::function(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 diff --git a/ebos/eclgenerictracermodel_impl.hh b/opm/simulators/flow/GenericTracerModel_impl.hpp similarity index 91% rename from ebos/eclgenerictracermodel_impl.hh rename to opm/simulators/flow/GenericTracerModel_impl.hpp index 16a1441c7..5bcef4323 100644 --- a/ebos/eclgenerictracermodel_impl.hh +++ b/opm/simulators/flow/GenericTracerModel_impl.hpp @@ -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 #include @@ -34,8 +34,6 @@ #include #include -#include - #include #include @@ -48,6 +46,7 @@ #include +#include #include #include #include @@ -56,7 +55,6 @@ #include #include -#include #include #include #include @@ -100,12 +98,12 @@ createParallelFlexibleSolver(const Dune::CpGrid& grid, const Matrix& M, const Pr #endif template -EclGenericTracerModel:: -EclGenericTracerModel(const GridView& gridView, - const EclipseState& eclState, - const CartesianIndexMapper& cartMapper, - const DofMapper& dofMapper, - const std::function(int)> centroids) +GenericTracerModel:: +GenericTracerModel(const GridView& gridView, + const EclipseState& eclState, + const CartesianIndexMapper& cartMapper, + const DofMapper& dofMapper, + const std::function(int)> centroids) : gridView_(gridView) , eclState_(eclState) , cartMapper_(cartMapper) @@ -115,7 +113,7 @@ EclGenericTracerModel(const GridView& gridView, } template -Scalar EclGenericTracerModel:: +Scalar GenericTracerModel:: tracerConcentration(int tracerIdx, int globalDofIdx) const { if (tracerConcentration_.empty()) @@ -125,42 +123,42 @@ tracerConcentration(int tracerIdx, int globalDofIdx) const } template -void EclGenericTracerModel:: +void GenericTracerModel:: setTracerConcentration(int tracerIdx, int globalDofIdx, Scalar value) { this->tracerConcentration_[tracerIdx][globalDofIdx] = value; } template -int EclGenericTracerModel:: +int GenericTracerModel:: numTracers() const { return this->eclState_.tracer().size(); } template -std::string EclGenericTracerModel:: +std::string GenericTracerModel:: fname(int tracerIdx) const { return this->eclState_.tracer()[tracerIdx].fname(); } template -double EclGenericTracerModel:: +double GenericTracerModel:: currentConcentration_(const Well& eclWell, const std::string& name) const { return eclWell.getTracerProperties().getConcentration(name); } template -const std::string& EclGenericTracerModel:: +const std::string& GenericTracerModel:: name(int tracerIdx) const { return this->eclState_.tracer()[tracerIdx].name; } template -void EclGenericTracerModel:: +void GenericTracerModel:: 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 -bool EclGenericTracerModel:: +bool GenericTracerModel:: linearSolve_(const TracerMatrix& M, TracerVector& x, TracerVector& b) { x = 0.0; @@ -311,7 +309,7 @@ linearSolve_(const TracerMatrix& M, TracerVector& x, TracerVector& b) } template -bool EclGenericTracerModel:: +bool GenericTracerModel:: linearSolveBatchwise_(const TracerMatrix& M, std::vector& x, std::vector& b) { Scalar tolerance = 1e-2; @@ -371,6 +369,6 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector& x, std:: #endif } - } // namespace Opm -#endif + +#endif // OPM_GENERIC_TRACER_MODEL_IMPL_HPP diff --git a/tests/test_RestartSerialization.cpp b/tests/test_RestartSerialization.cpp index 9edafa12b..520fe0099 100644 --- a/tests/test_RestartSerialization.cpp +++ b/tests/test_RestartSerialization.cpp @@ -350,10 +350,11 @@ BOOST_AUTO_TEST_CASE(BlackoilWellModelGeneric) } template -class EclGenericTracerModelTest : public Opm::EclGenericTracerModel { - using Base = Opm::EclGenericTracerModel; +class GenericTracerModelTest : public Opm::GenericTracerModel +{ + using Base = Opm::GenericTracerModel; public: - EclGenericTracerModelTest(const GridView& gridView, + GenericTracerModelTest(const GridView& gridView, const Opm::EclipseState& eclState, const Dune::CartesianIndexMapper& 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& cartMapper, const DofMapper& dofMapper, const std::function(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 dofMapper(gridView, Dune::mcmgElementLayout()); - auto data_out = EclGenericTracerModelTest, - Opm::EcfvStencil, - double> + auto data_out = GenericTracerModelTest, + Opm::EcfvStencil, + double> ::serializationTestObject(gridView, eclState, mapper, dofMapper, centroids); Opm::Serialization::MemPacker packer; Opm::Serializer ser(packer);