diff --git a/examples/problems/fingergridmanager.hh b/examples/problems/fingergridmanager.hh deleted file mode 100644 index eb73fc1bc..000000000 --- a/examples/problems/fingergridmanager.hh +++ /dev/null @@ -1,190 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/* - Copyright (C) 2012-2013 by 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 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 . -*/ -/*! - * \file - * \copydoc Ewoms::FingerGridManager - */ -#ifndef EWOMS_FINGER_GRID_MANAGER_HH -#define EWOMS_FINGER_GRID_MANAGER_HH - -#include -#include -#include - -#if HAVE_DUNE_ALUGRID -// we cannot use SFC reordering since it messes up the test case logic -#define DISABLE_ALUGRID_SFC_ORDERING -#include -#include -#else -#include -#endif - -#include -#include - -#include -#include - -#include -#include - -// some hacky defines for the grid manager -#define FINGER_DIM 2 -#define FINGER_CUBES 1 - -namespace Ewoms { -template -class FingerGridManager; - -template -class FingerProblem; - -namespace Properties { -// declare the properties required by the for the finger grid manager -NEW_TYPE_TAG(FingerGridManager); - -NEW_PROP_TAG(Grid); -NEW_PROP_TAG(Scalar); - -NEW_PROP_TAG(DomainSizeX); -NEW_PROP_TAG(DomainSizeY); -NEW_PROP_TAG(DomainSizeZ); - -NEW_PROP_TAG(CellsX); -NEW_PROP_TAG(CellsY); -NEW_PROP_TAG(CellsZ); - -NEW_PROP_TAG(GridGlobalRefinements); - -#if HAVE_DUNE_ALUGRID -SET_TYPE_PROP(FingerGridManager, Grid, Dune::ALUGrid); -#else -SET_TYPE_PROP(FingerGridManager, Grid, Dune::YaspGrid ); -#endif -SET_TYPE_PROP(FingerGridManager, GridManager, Ewoms::FingerGridManager); - -} // namespace Properties - -/*! - * \brief Helper class for grid instantiation of the finger problem. - */ -template -class FingerGridManager : public BaseGridManager -{ - typedef BaseGridManager ParentType; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; - typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; - - typedef std::unique_ptr GridPointer; - - enum { dim = FINGER_DIM }; - -public: - /*! - * \brief Register all run-time parameters for the grid manager. - */ - static void registerParameters() - { - EWOMS_REGISTER_PARAM(TypeTag, unsigned, GridGlobalRefinements, - "The number of global refinements of the grid " - "executed after it was loaded"); - EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeX, - "The size of the domain in x direction"); - EWOMS_REGISTER_PARAM(TypeTag, int, CellsX, - "The number of intervalls in x direction"); - if (dim > 1) { - EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeY, - "The size of the domain in y direction"); - EWOMS_REGISTER_PARAM(TypeTag, int, CellsY, - "The number of intervalls in y direction"); - } - if (dim > 2) { - EWOMS_REGISTER_PARAM(TypeTag, Scalar, DomainSizeZ, - "The size of the domain in z direction"); - EWOMS_REGISTER_PARAM(TypeTag, int, CellsZ, - "The number of intervalls in z direction"); - } - } - - /*! - * \brief Create the grid for the finger problem - */ - FingerGridManager(Simulator &simulator) - : ParentType(simulator) - { - Dune::FieldVector cellRes; - Dune::FieldVector upperRight; - Dune::FieldVector lowerLeft; - - lowerLeft = 0.0; - upperRight[0] = EWOMS_GET_PARAM(TypeTag, Scalar, DomainSizeX); - upperRight[1] = EWOMS_GET_PARAM(TypeTag, Scalar, DomainSizeY); - - cellRes[0] = EWOMS_GET_PARAM(TypeTag, int, CellsX); - cellRes[1] = EWOMS_GET_PARAM(TypeTag, int, CellsY); - if (dim == 3) { - upperRight[2] = EWOMS_GET_PARAM(TypeTag, Scalar, DomainSizeZ); - cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ); - } - - // create a DGF input stream containing an interval block - std::stringstream dgfFile; - dgfFile << "DGF" << std::endl; - dgfFile << "Interval" << std::endl; - dgfFile << lowerLeft << std::endl; - dgfFile << upperRight << std::endl; - dgfFile << cellRes << std::endl; - dgfFile << "#" << std::endl; - dgfFile << "GridParameter" << std::endl; - dgfFile << "overlap 1" << std::endl; - dgfFile << "#" << std::endl; - dgfFile << "Simplex" << std::endl; - dgfFile << "#" << std::endl; - - gridPtr_.reset( Dune::GridPtr< Grid >(dgfFile).release() ); - - unsigned numRefinments = EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements); - gridPtr_->globalRefine(numRefinments); - - this->finalizeInit_(); - } - - /*! - * \brief Return a reference to the grid. - */ - Grid& grid() - { return *gridPtr_; } - - /*! - * \brief Return a reference to the grid. - */ - const Grid& grid() const - { return *gridPtr_; } - -private: - GridPointer gridPtr_; -}; - -} // namespace Ewoms - -#endif diff --git a/examples/problems/fingerproblem.hh b/examples/problems/fingerproblem.hh index f02e28ec1..e1445ce9c 100644 --- a/examples/problems/fingerproblem.hh +++ b/examples/problems/fingerproblem.hh @@ -26,7 +26,10 @@ #ifndef EWOMS_FINGER_PROBLEM_HH #define EWOMS_FINGER_PROBLEM_HH -#include "fingergridmanager.hh" +// uncomment to run problem in 3d +// #define GRIDDIM 3 + +#include "structuredgridmanager.hh" #include #include @@ -55,7 +58,7 @@ template class FingerProblem; namespace Properties { -NEW_TYPE_TAG(FingerBaseProblem, INHERITS_FROM(FingerGridManager)); +NEW_TYPE_TAG(FingerBaseProblem, INHERITS_FROM(StructuredGridManager)); // declare the properties used by the finger problem NEW_PROP_TAG(InitialWaterSaturation); diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index e14eb331c..73ff96371 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -26,7 +26,7 @@ #ifndef EWOMS_LENS_PROBLEM_HH #define EWOMS_LENS_PROBLEM_HH -#include "lensgridmanager.hh" +#include "structuredgridmanager.hh" #include @@ -39,12 +39,6 @@ #include #include -//#define LENS_USE_ALUGRID 1 -#if LENS_USE_ALUGRID -#include -#include -#endif - #include #include #include @@ -58,11 +52,7 @@ template class LensProblem; namespace Properties { -#if LENS_USE_ALUGRID -NEW_TYPE_TAG(LensBaseProblem); -#else -NEW_TYPE_TAG(LensBaseProblem, INHERITS_FROM(LensGridManager)); -#endif +NEW_TYPE_TAG(LensBaseProblem, INHERITS_FROM(StructuredGridManager)); // declare the properties specific for the lens problem NEW_PROP_TAG(LensLowerLeftX); @@ -95,10 +85,6 @@ public: typedef Opm::LiquidPhase > type; }; -#if LENS_USE_ALUGRID -SET_TYPE_PROP(LensBaseProblem, Grid, Dune::ALUGrid< 2, 2, Dune::cube, Dune::nonconforming > ); -#endif - // Set the material Law SET_PROP(LensBaseProblem, MaterialLaw) { diff --git a/examples/problems/lensgridmanager.hh b/examples/problems/structuredgridmanager.hh similarity index 83% rename from examples/problems/lensgridmanager.hh rename to examples/problems/structuredgridmanager.hh index 3417ee1e9..e6ce10d9a 100644 --- a/examples/problems/lensgridmanager.hh +++ b/examples/problems/structuredgridmanager.hh @@ -2,6 +2,7 @@ // vi: set et ts=4 sw=4 sts=4: /* Copyright (C) 2012-2013 by Andreas Lauser + Copyright (C) 2016 IRIS AS This file is part of the Open Porous Media project (OPM). @@ -20,10 +21,10 @@ */ /*! * \file - * \copydoc Ewoms::LensGridManager + * \copydoc Ewoms::StructuredGridManager */ -#ifndef EWOMS_LENS_GRID_MANAGER_HH -#define EWOMS_LENS_GRID_MANAGER_HH +#ifndef EWOMS_STRUCTURED_GRID_MANAGER_HH +#define EWOMS_STRUCTURED_GRID_MANAGER_HH #include #include @@ -32,6 +33,12 @@ #include #include +//#define TESTS_USE_ALUGRID 1 +#if TESTS_USE_ALUGRID +#include +#include +#endif + #include #include @@ -39,14 +46,12 @@ #include namespace Ewoms { -template -class LensProblem; template -class LensGridManager; +class StructuredGridManager; namespace Properties { -NEW_TYPE_TAG(LensGridManager); +NEW_TYPE_TAG(StructuredGridManager); // declare the properties required by the for the lens grid manager NEW_PROP_TAG(Grid); @@ -62,10 +67,21 @@ NEW_PROP_TAG(CellsZ); NEW_PROP_TAG(GridGlobalRefinements); -// set the Grid and GridManager properties -SET_TYPE_PROP(LensGridManager, Grid, Dune::YaspGrid<2>); +// GRIDDIM is only set by the finger problem +#ifndef GRIDDIM +static const int dim = 2; +#else +static const int dim = GRIDDIM; +#endif -SET_TYPE_PROP(LensGridManager, GridManager, Ewoms::LensGridManager); +// set the Grid and GridManager properties +#if TESTS_USE_ALUGRID +SET_TYPE_PROP(StructuredGridManager, Grid, Dune::ALUGrid< dim, dim, Dune::cube, Dune::nonconforming >); +#else +SET_TYPE_PROP(StructuredGridManager, Grid, Dune::YaspGrid< dim >); +#endif + +SET_TYPE_PROP(StructuredGridManager, GridManager, Ewoms::StructuredGridManager); } // namespace Properties /*! @@ -74,7 +90,7 @@ SET_TYPE_PROP(LensGridManager, GridManager, Ewoms::LensGridManager); * \brief Helper class for grid instantiation of the lens problem. */ template -class LensGridManager : public BaseGridManager +class StructuredGridManager : public BaseGridManager { typedef BaseGridManager ParentType; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; @@ -115,7 +131,7 @@ public: /*! * \brief Create the grid for the lens problem */ - LensGridManager(Simulator &simulator) + StructuredGridManager(Simulator &simulator) : ParentType(simulator) { Dune::FieldVector cellRes; @@ -144,6 +160,8 @@ public: dgffile << "GridParameter" << std::endl; dgffile << "overlap 1" << std::endl; dgffile << "#" << std::endl; + dgffile << "Simplex" << std::endl; + dgffile << "#" << std::endl; // use DGF parser to create a grid from interval block gridPtr_.reset( Dune::GridPtr< Grid >( dgffile ).release() );