From fa016a6008df09adfacb95a4fa8030e58eba1f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 20 Jun 2019 10:15:51 +0200 Subject: [PATCH] Moved all remaining files out of opm/autodiff. --- CMakeLists_files.cmake | 9 +- opm/autodiff/GridInit.hpp | 143 ------------------ opm/autodiff/IterationReport.hpp | 37 ----- opm/autodiff/MPIUtilities.cpp | 44 ------ opm/autodiff/createGlobalCellArray.hpp | 49 ------ opm/autodiff/opm-simulators_doxygen_main.hpp | 51 ------- opm/simulators/flow/BlackoilModelEbos.hpp | 3 +- .../flow/countGlobalCells.hpp} | 0 opm/simulators/linalg/ISTLSolverEbos.hpp | 1 - .../opm-simulators_doxygen_main.hpp} | 23 +-- opm/simulators/wells/BlackoilWellModel.hpp | 3 +- .../wells/BlackoilWellModel_impl.hpp | 1 + .../wells}/SimFIBODetails.hpp | 0 tests/test_wellmodel.cpp | 13 +- 14 files changed, 22 insertions(+), 355 deletions(-) delete mode 100644 opm/autodiff/GridInit.hpp delete mode 100644 opm/autodiff/IterationReport.hpp delete mode 100644 opm/autodiff/MPIUtilities.cpp delete mode 100644 opm/autodiff/createGlobalCellArray.hpp delete mode 100644 opm/autodiff/opm-simulators_doxygen_main.hpp rename opm/{autodiff/BlackoilDetails.hpp => simulators/flow/countGlobalCells.hpp} (100%) rename opm/{autodiff/MPIUtilities.hpp => simulators/opm-simulators_doxygen_main.hpp} (58%) rename opm/{autodiff => simulators/wells}/SimFIBODetails.hpp (100%) diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index fd8fb775c..336699ea4 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -24,7 +24,6 @@ # find opm -name '*.c*' -printf '\t%p\n' | sort list (APPEND MAIN_SOURCE_FILES ebos/nncsorter.cpp - opm/autodiff/MPIUtilities.cpp opm/core/props/rock/RockFromDeck.cpp opm/core/props/satfunc/RelpermDiagnostics.cpp opm/core/simulator/SimulatorReport.cpp @@ -123,16 +122,11 @@ list (APPEND TEST_DATA_FILES # originally generated with the command: # find opm -name '*.h*' -a ! -name '*-pch.hpp' -printf '\t%p\n' | sort list (APPEND PUBLIC_HEADER_FILES - opm/autodiff/BlackoilDetails.hpp + opm/simulators/flow/countGlobalCells.hpp opm/simulators/flow/BlackoilModelEbos.hpp opm/simulators/flow/BlackoilModelParametersEbos.hpp - opm/autodiff/createGlobalCellArray.hpp opm/simulators/flow/FlowMainEbos.hpp - opm/autodiff/GridInit.hpp - opm/autodiff/IterationReport.hpp - opm/autodiff/MPIUtilities.hpp opm/simulators/flow/NonlinearSolverEbos.hpp - opm/autodiff/SimFIBODetails.hpp opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp opm/simulators/flow/MissingFeatures.hpp opm/core/props/BlackoilPhases.hpp @@ -194,6 +188,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/simulators/utils/gatherDeferredLogger.hpp opm/simulators/utils/moduleVersion.hpp opm/simulators/wells/RateConverter.hpp + opm/simulators/wells/SimFIBODetails.hpp opm/simulators/wells/WellConnectionAuxiliaryModule.hpp opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp opm/simulators/wells/VFPProperties.hpp diff --git a/opm/autodiff/GridInit.hpp b/opm/autodiff/GridInit.hpp deleted file mode 100644 index 1610e23bb..000000000 --- a/opm/autodiff/GridInit.hpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright 2015 SINTEF ICT, Applied Mathematics. - - 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 . -*/ - -#ifndef OPM_GRIDINIT_HEADER_INCLUDED -#define OPM_GRIDINIT_HEADER_INCLUDED - -#include -#include -#include - -#if HAVE_OPM_GRID -#include -#include -#endif - - -namespace Opm -{ - - /// A class intended to give a generic interface to - /// initializing and accessing UnstructuredGrid and CpGrid, - /// using specialized templates to accomplish this. - template - class GridInit - { - public: - /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. - GridInit(const EclipseState&, const std::vector&) - { - OPM_THROW(std::logic_error, "Found no specialization for GridInit for the requested Grid class."); - } - }; - - - /// Specialization for UnstructuredGrid. - template <> - class GridInit - { - public: - /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. - GridInit(const EclipseState& eclipse_state, const std::vector& porv) - : grid_manager_(eclipse_state.getInputGrid(), porv) - { - } - /// Access the created grid. - const UnstructuredGrid& grid() - { - return *grid_manager_.c_grid(); - } - private: - GridManager grid_manager_; - }; - - -#if HAVE_OPM_GRID - /// Specialization for PolyhedralGrid. - template < int dim, int dimworld > - class GridInit< Dune::PolyhedralGrid< dim, dimworld > > - { - public: - typedef Dune::PolyhedralGrid< dim, dimworld > Grid; - /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. - GridInit(const EclipseState& eclipse_state, const std::vector& porv) - : grid_manager_(eclipse_state.getInputGrid(), porv), - grid_( *grid_manager_.c_grid() ) - { - } - - /// Access the created grid. - const Grid& grid() - { - return grid_; - } - private: - GridManager grid_manager_; - Grid grid_; - }; - - - /// Specialization for CpGrid. - template <> - class GridInit - { - public: - GridInit() - { - gridSelfManaged_ = false; - } - - /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. - GridInit(const EclipseState& eclipse_state, const std::vector& porv) - { - gridSelfManaged_ = true; - - grid_ = new Dune::CpGrid; - grid_->processEclipseFormat(eclipse_state.getInputGrid(), false, false, false, porv); - } - - ~GridInit() - { - if (gridSelfManaged_) - delete grid_; - } - - /// Access the created grid. Note that mutable access may be required for load balancing. - Dune::CpGrid& grid() - { - return *grid_; - } - - /// set the grid from the outside - void setGrid(Dune::CpGrid& newGrid) - { - gridSelfManaged_ = false; - grid_ = &newGrid; - } - - private: - Dune::CpGrid* grid_; - bool gridSelfManaged_; - }; -#endif // HAVE_OPM_GRID - - -} // namespace Opm - -#endif // OPM_GRIDINIT_HEADER_INCLUDED diff --git a/opm/autodiff/IterationReport.hpp b/opm/autodiff/IterationReport.hpp deleted file mode 100644 index dc1ea55d0..000000000 --- a/opm/autodiff/IterationReport.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright 2013, 2015 SINTEF ICT, Applied Mathematics. - Copyright 2014, 2015 Statoil ASA. - Copyright 2014, 2015 Dr. Markus Blatt - HPC-Simulation-Software & Services - Copyright 2015 NTNU - - 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 . -*/ - -#ifndef OPM_ITERATION_REPORT_HEADER_INCLUDED -#define OPM_ITERATION_REPORT_HEADER_INCLUDED - -namespace Opm { - /// Class used for reporting the outcome of a nonlinearIteration() call. - struct IterationReport - { - bool failed; - bool converged; - int linear_iterations; - int well_iterations; - }; -} // namespace Opm - -#endif // OPM_ITERATION_REPORT_HEADER_INCLUDED diff --git a/opm/autodiff/MPIUtilities.cpp b/opm/autodiff/MPIUtilities.cpp deleted file mode 100644 index 11baf402d..000000000 --- a/opm/autodiff/MPIUtilities.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright 2014 SINTEF ICT, Applied Mathematics. - Copyright 2014 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 . -*/ - -#include -#include -#include - -namespace Opm -{ - /// Return true if this is a serial run, or rank zero on an MPI run. - bool isIORank(const boost::any& parallel_info) - { -#if HAVE_MPI - if (parallel_info.type() == typeid(ParallelISTLInformation)) { - const ParallelISTLInformation& info = - boost::any_cast(parallel_info); - return info.communicator().rank() == 0; - } else { - return true; - } -#else - static_cast(parallel_info); // Suppress unused argument warning. - return true; -#endif - } -} // namespace Opm - diff --git a/opm/autodiff/createGlobalCellArray.hpp b/opm/autodiff/createGlobalCellArray.hpp deleted file mode 100644 index 4616ae741..000000000 --- a/opm/autodiff/createGlobalCellArray.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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 . -*/ -#ifndef OPM_CREATE_GLOBAL_CELL_ARRAY_HPP -#define OPM_CREATE_GLOBAL_CELL_ARRAY_HPP - -#include - -namespace Opm -{ -/*! - * \brief Create a mapping from a global cell index of a grid to the logically - * Cartesian index of the ECL deck. - */ -template -void createGlobalCellArray(const Grid &grid, std::vector& dest) -{ - int numCells = Opm::UgGridHelpers::numCells(grid); - dest.resize(numCells); - const auto& globalCell = Opm::UgGridHelpers::globalCell(grid); - std::vector compressedToCartesianIdx(numCells); - for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) { - if (globalCell) { - dest[cellIdx] = globalCell[cellIdx]; - } - else { - dest[cellIdx] = cellIdx; - } - } - -} -} - -#endif diff --git a/opm/autodiff/opm-simulators_doxygen_main.hpp b/opm/autodiff/opm-simulators_doxygen_main.hpp deleted file mode 100644 index 006089b5c..000000000 --- a/opm/autodiff/opm-simulators_doxygen_main.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright 2013, 2016 SINTEF ICT, Applied Mathematics. - - 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 . -*/ - -#ifndef OPM_OPM-SIMULATORS_DOXYGEN_MAIN_HEADER_INCLUDED -#define OPM_OPM-SIMULATORS_DOXYGEN_MAIN_HEADER_INCLUDED - - -/** \mainpage Documentation for the opm-simulators library. - - -

Solvers and simulators

- -The opm-simulators module contains a diverse set of simulator programs. -Notable simulator programs include -- examples/flow.cpp, a fully implicit black-oil simulator. -- examples/flow_polymer.cpp, a version of Flow that supports polymer EOR simulation -- examples/flow_solvent.cpp, a version of Flow that supports solvent EOR simulation -- examples/sim_2p_incomp_ad.cpp, a sequential incompressible 2-phase simulator. - -

Automatic differentiation

- -This library implements automatic differentiation for vector data with -multiple blocks of sparse jacobians. This is contained in the class -Opm::AutoDiffBlock. Also available is Opm::AutoDiff, a much simpler -single-value single-derivative AD class. - -There are also some helper classes and functions that are intended to -aid in the development of solvers and simulators with AD, these -include Opm::HelperOps, Opm::UpwindSelector, Opm::subset, -Opm::superset, Opm::Selector, Opm::collapseJacs, Opm::vertcat, -Opm::Span and Opm::sign. - -*/ - -#endif // OPM_OPM-SIMULATORS_DOXYGEN_MAIN_HEADER_INCLUDED diff --git a/opm/simulators/flow/BlackoilModelEbos.hpp b/opm/simulators/flow/BlackoilModelEbos.hpp index bcac2d157..e6568057b 100644 --- a/opm/simulators/flow/BlackoilModelEbos.hpp +++ b/opm/simulators/flow/BlackoilModelEbos.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include @@ -64,7 +64,6 @@ #include #include #include -//#include BEGIN_PROPERTIES diff --git a/opm/autodiff/BlackoilDetails.hpp b/opm/simulators/flow/countGlobalCells.hpp similarity index 100% rename from opm/autodiff/BlackoilDetails.hpp rename to opm/simulators/flow/countGlobalCells.hpp diff --git a/opm/simulators/linalg/ISTLSolverEbos.hpp b/opm/simulators/linalg/ISTLSolverEbos.hpp index 313252ab6..3167bf185 100644 --- a/opm/simulators/linalg/ISTLSolverEbos.hpp +++ b/opm/simulators/linalg/ISTLSolverEbos.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/opm/autodiff/MPIUtilities.hpp b/opm/simulators/opm-simulators_doxygen_main.hpp similarity index 58% rename from opm/autodiff/MPIUtilities.hpp rename to opm/simulators/opm-simulators_doxygen_main.hpp index 598d3f950..7a9a126c8 100644 --- a/opm/autodiff/MPIUtilities.hpp +++ b/opm/simulators/opm-simulators_doxygen_main.hpp @@ -1,5 +1,5 @@ /* - Copyright 2015 SINTEF ICT, Applied Mathematics. + Copyright 2013, 2016 SINTEF ICT, Applied Mathematics. This file is part of the Open Porous Media project (OPM). @@ -17,16 +17,19 @@ along with OPM. If not, see . */ -#ifndef OPM_MPIUTILITIES_HEADER_INCLUDED -#define OPM_MPIUTILITIES_HEADER_INCLUDED +#ifndef OPM_OPM-SIMULATORS_DOXYGEN_MAIN_HEADER_INCLUDED +#define OPM_OPM-SIMULATORS_DOXYGEN_MAIN_HEADER_INCLUDED -#include -namespace Opm -{ - /// Return true if this is a serial run, or rank zero on an MPI run. - bool isIORank(const boost::any& parallel_info); +/** \mainpage Documentation for the opm-simulators library. -} // namespace Opm -#endif // OPM_MPIUTILITIES_HEADER_INCLUDED +

Solvers and simulators

+ +The opm-simulators module is the home for the Flow reservoir +simulator, the Ebos experimental simulator and library functionality +on which they both depend. + +*/ + +#endif // OPM_OPM-SIMULATORS_DOXYGEN_MAIN_HEADER_INCLUDED diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index d1aa1aa65..e24718640 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -41,14 +41,13 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include #include #include #include diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 413c4b281..a866e4442 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -21,6 +21,7 @@ */ #include +#include namespace Opm { template diff --git a/opm/autodiff/SimFIBODetails.hpp b/opm/simulators/wells/SimFIBODetails.hpp similarity index 100% rename from opm/autodiff/SimFIBODetails.hpp rename to opm/simulators/wells/SimFIBODetails.hpp diff --git a/tests/test_wellmodel.cpp b/tests/test_wellmodel.cpp index 31263da60..6173b3e39 100644 --- a/tests/test_wellmodel.cpp +++ b/tests/test_wellmodel.cpp @@ -43,8 +43,6 @@ #include #include #include -#include -#include #include #include @@ -58,12 +56,13 @@ #include #endif + + using StandardWell = Opm::StandardWell; struct SetupTest { using Grid = UnstructuredGrid; - using GridInit = Opm::GridInit; SetupTest () { @@ -81,12 +80,8 @@ struct SetupTest { const std::vector& porv = ecl_state->get3DProperties().getDoubleGridProperty("PORV").getData(); - std::unique_ptr grid_init(new GridInit(*ecl_state, porv)); - const Grid& grid = grid_init->grid(); - - // Create material law manager. - std::vector compressed_to_cartesianIdx; - Opm::createGlobalCellArray(grid, compressed_to_cartesianIdx); + Opm::GridManager gm(ecl_state->getInputGrid(), porv); + const Grid& grid = *(gm.c_grid()); current_timestep = 0;