diff --git a/dumux/common/start.hh b/dumux/common/start.hh index 50dfe0a2337d85d4c98859fdb88fb80b8949672f..2a885517dcab380e87e9836aac48190ff1320f02 100644 --- a/dumux/common/start.hh +++ b/dumux/common/start.hh @@ -529,7 +529,11 @@ int start_(int argc, // instantiate and run the concrete problem TimeManager timeManager; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + Problem problem(timeManager, GridCreator::grid().leafGridView()); +#else Problem problem(timeManager, GridCreator::grid().leafView()); +#endif timeManager.init(problem, restartTime, dt, tEnd, restart); timeManager.run(); // print dumux end message diff --git a/dumux/decoupled/common/variableclassadaptive.hh b/dumux/decoupled/common/variableclassadaptive.hh index 9682c30ac8424a4e7a7a8afb154fa6f4235d1f22..74952f6303c7c5ad06ccf3c44fef53a94007560c 100644 --- a/dumux/decoupled/common/variableclassadaptive.hh +++ b/dumux/decoupled/common/variableclassadaptive.hh @@ -99,7 +99,11 @@ public: for (int level = grid_.maxLevel(); level >= 0; level--) { //get grid view on level grid +#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) + LevelGridView levelView = grid_.levelGridView(level); +#else LevelGridView levelView = grid_.levelView(level); +#endif for (LevelIterator eIt = levelView.template begin<0>(); eIt != levelView.template end<0>(); ++eIt) { //get your map entry @@ -153,7 +157,11 @@ public: for (int level = 0; level <= grid_.maxLevel(); level++) { +#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) + LevelGridView levelView = grid_.levelGridView(level); +#else LevelGridView levelView = grid_.levelView(level); +#endif for (LevelIterator eIt = levelView.template begin<0>(); eIt != levelView.template end<0>(); ++eIt) { // only treat non-ghosts, ghost data is communicated afterwards diff --git a/dumux/io/interfacemeshcreator.hh b/dumux/io/interfacemeshcreator.hh index b137c960082f19d902114b563c6090cdbe477733..89423b44b7dc93f9e32aa0b2a4a4210ed045c6df 100644 --- a/dumux/io/interfacemeshcreator.hh +++ b/dumux/io/interfacemeshcreator.hh @@ -1,7 +1,8 @@ #ifndef DUMUX_INTERFACEMESHCREATOR_HH #define DUMUX_INTERFACEMESHCREATOR_HH -#include<dune/grid/common/gridfactory.hh> +#include <dune/common/version.hh> +#include <dune/grid/common/gridfactory.hh> #include <dune/grid/io/file/dgfparser/dgfs.hh> namespace Dumux @@ -28,7 +29,11 @@ public: typedef typename HelperGridView::Traits::template Codim<0>::Entity HelperElement; typedef typename HelperElement::Geometry HelperGeometry; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + HelperElementIterator helperElementIterator = helperGrid.leafGridView().template begin<0>(); +#else HelperElementIterator helperElementIterator = helperGrid.leafView().template begin<0>(); +#endif const HelperElement& helperElement = *helperElementIterator; const HelperGeometry& helperGeometry = helperElement.geometry(); diff --git a/test/decoupled/1p/resultevaluation3d.hh b/test/decoupled/1p/resultevaluation3d.hh index b5531c5a077941e785a2f4998ac3d7d528a35a93..3c55ab4390a0fcad4f7a4a305f59d9a220fd6a3b 100644 --- a/test/decoupled/1p/resultevaluation3d.hh +++ b/test/decoupled/1p/resultevaluation3d.hh @@ -17,8 +17,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ -#include <dumux/decoupled/common/onemodelproblem.hh> - /*! * \file * @@ -28,6 +26,9 @@ #ifndef DUMUX_BENCHMARKRESULT_HH #define DUMUX_BENCHMARKRESULT_HH +#include <dune/common/version.hh> +#include <dumux/decoupled/common/onemodelproblem.hh> + namespace Dumux { @@ -106,15 +107,20 @@ public: #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) typedef typename Geometry::JacobianInverseTransposed JacobianInverseTransposed; typedef typename Dune::ReferenceElements<ct, dim> ReferenceElements; + const GV& gridview(grid.levelGridView(grid.maxLevel())); + const IS& indexset(gridview.indexSet()); + EM elementmapper(gridview); + FM facemapper(gridview); + SolutionType& exactSol(grid.levelGridView(grid.maxLevel())); #else typedef typename Geometry::Jacobian JacobianInverseTransposed; typedef typename Dune::GenericReferenceElements<ct, dim> ReferenceElements; -#endif const GV& gridview(grid.levelView(grid.maxLevel())); const IS& indexset(gridview.indexSet()); EM elementmapper(gridview); FM facemapper(gridview); SolutionType& exactSol(grid.levelView(grid.maxLevel())); +#endif uMean = 0; double domainVolume = 0; diff --git a/test/decoupled/1p/test_diffusion.cc b/test/decoupled/1p/test_diffusion.cc index 8ff63507cf387972a8d6d37c874297fc605c3a37..c88ccac2f66bc1b1f28b64375baa59a208d5fde9 100644 --- a/test/decoupled/1p/test_diffusion.cc +++ b/test/decoupled/1p/test_diffusion.cc @@ -91,7 +91,11 @@ int main(int argc, char** argv) bool consecutiveNumbering = true; typedef GET_PROP_TYPE(TTAG(FVVelocity2PTestProblem), Problem) FVProblem; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + FVProblem fvProblem(grid->leafGridView(), delta); +#else FVProblem fvProblem(grid->leafView(), delta); +#endif fvProblem.setName("fvdiffusion"); timer.reset(); fvProblem.init(); @@ -99,27 +103,45 @@ int main(int argc, char** argv) double fvTime = timer.elapsed(); fvProblem.writeOutput(); Dumux::ResultEvaluation fvResult; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + fvResult.evaluate(grid->leafGridView(), fvProblem, consecutiveNumbering); + + typedef GET_PROP_TYPE(TTAG(FVMPFAOVelocity2PTestProblem), Problem) MPFAOProblem; + MPFAOProblem mpfaProblem(grid->leafGridView(), delta); +#else fvResult.evaluate(grid->leafView(), fvProblem, consecutiveNumbering); typedef GET_PROP_TYPE(TTAG(FVMPFAOVelocity2PTestProblem), Problem) MPFAOProblem; MPFAOProblem mpfaProblem(grid->leafView(), delta); +#endif mpfaProblem.setName("fvmpfaodiffusion"); timer.reset(); mpfaProblem.init(); double mpfaTime = timer.elapsed(); mpfaProblem.writeOutput(); Dumux::ResultEvaluation mpfaResult; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + mpfaResult.evaluate(grid->leafGridView(), mpfaProblem, consecutiveNumbering); + + typedef GET_PROP_TYPE(TTAG(MimeticPressure2PTestProblem), Problem) MimeticProblem; + MimeticProblem mimeticProblem(grid->leafGridView(), delta); +#else mpfaResult.evaluate(grid->leafView(), mpfaProblem, consecutiveNumbering); typedef GET_PROP_TYPE(TTAG(MimeticPressure2PTestProblem), Problem) MimeticProblem; MimeticProblem mimeticProblem(grid->leafView(), delta); +#endif mimeticProblem.setName("mimeticdiffusion"); timer.reset(); mimeticProblem.init(); double mimeticTime = timer.elapsed(); mimeticProblem.writeOutput(); Dumux::ResultEvaluation mimeticResult; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + mimeticResult.evaluate(grid->leafGridView(), mimeticProblem, consecutiveNumbering); +#else mimeticResult.evaluate(grid->leafView(), mimeticProblem, consecutiveNumbering); +#endif std::cout.setf(std::ios_base::scientific, std::ios_base::floatfield); std::cout.precision(2); diff --git a/test/decoupled/1p/test_diffusion3d.cc b/test/decoupled/1p/test_diffusion3d.cc index fe5a7cf9869e0619cb22b3a104028b3d2141aae1..9f18e98a2b7f1f193e9e95455d740c81ed892185 100644 --- a/test/decoupled/1p/test_diffusion3d.cc +++ b/test/decoupled/1p/test_diffusion3d.cc @@ -132,7 +132,11 @@ int main(int argc, char** argv) typedef GET_PROP_TYPE(FVTypeTag, Problem) FVProblem; typedef GET_PROP(FVTypeTag, ParameterTree) FVParameterTree; Dune::ParameterTreeParser::readINITree(parameterFileName, FVParameterTree::tree()); +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + FVProblem *fvProblem = new FVProblem(grid->leafGridView()); +#else FVProblem *fvProblem = new FVProblem(grid->leafView()); +#endif std::string fvOutput("test_diffusion3d_fv"); fvOutput += outputName; if (numRefine > 0) @@ -148,7 +152,11 @@ int main(int argc, char** argv) double fvTime = timer.elapsed(); fvProblem->writeOutput(); Dumux::ResultEvaluation fvResult; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + fvResult.evaluate(grid->leafGridView(), *fvProblem, consecutiveNumbering); +#else fvResult.evaluate(grid->leafView(), *fvProblem, consecutiveNumbering); +#endif delete fvProblem; @@ -157,7 +165,12 @@ int main(int argc, char** argv) typedef GET_PROP_TYPE(MPFALTypeTag, Problem) MPFALProblem; typedef GET_PROP(MPFALTypeTag, ParameterTree) MPFALParameterTree; Dune::ParameterTreeParser::readINITree(parameterFileName, MPFALParameterTree::tree()); + +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + MPFALProblem *mpfaProblem = new MPFALProblem(grid->leafGridView()); +#else MPFALProblem *mpfaProblem = new MPFALProblem(grid->leafView()); +#endif std::string fvmpfaOutput("test_diffusion3d_fvmpfal"); fvmpfaOutput += outputName; if (numRefine > 0) @@ -172,7 +185,11 @@ int main(int argc, char** argv) double mpfaTime = timer.elapsed(); mpfaProblem->writeOutput(); Dumux::ResultEvaluation mpfaResult; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + mpfaResult.evaluate(grid->leafGridView(), *mpfaProblem, consecutiveNumbering); +#else mpfaResult.evaluate(grid->leafView(), *mpfaProblem, consecutiveNumbering); +#endif delete mpfaProblem; @@ -181,7 +198,12 @@ int main(int argc, char** argv) typedef GET_PROP_TYPE(MimeticTypeTag, Problem) MimeticProblem; typedef GET_PROP(MimeticTypeTag, ParameterTree) MimeticParameterTree; Dune::ParameterTreeParser::readINITree(parameterFileName, MimeticParameterTree::tree()); + +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + MimeticProblem *mimeticProblem = new MimeticProblem(grid->leafGridView()); +#else MimeticProblem *mimeticProblem = new MimeticProblem(grid->leafView()); +#endif std::string mimeticOutput("test_diffusion3d_mimetic"); mimeticOutput += outputName; if (numRefine > 0) @@ -196,7 +218,11 @@ int main(int argc, char** argv) double mimeticTime = timer.elapsed(); mimeticProblem->writeOutput(); Dumux::ResultEvaluation mimeticResult; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + mimeticResult.evaluate(grid->leafGridView(), *mimeticProblem, consecutiveNumbering); +#else mimeticResult.evaluate(grid->leafView(), *mimeticProblem, consecutiveNumbering); +#endif delete mimeticProblem; diff --git a/test/decoupled/2p2c/test_multiphysics2p2c.cc b/test/decoupled/2p2c/test_multiphysics2p2c.cc index 0c2cd1fe3af1aa0349df1b772b439c871a48207b..de8f0b852fd5f5b2605d755f51d9545bfc03daec 100644 --- a/test/decoupled/2p2c/test_multiphysics2p2c.cc +++ b/test/decoupled/2p2c/test_multiphysics2p2c.cc @@ -104,7 +104,11 @@ int main(int argc, char** argv) // instantiate and run the concrete problem //////////////////////////////////////////////////////////// TimeManager timeManager; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + Problem problem(timeManager, grid.leafGridView(), L, H); +#else Problem problem(timeManager, grid.leafView(), L, H); +#endif // initialize the simulation timeManager.init(problem, startTime, firstDt, tEnd, restart); diff --git a/test/geomechanics/el2p/test_el2p.cc b/test/geomechanics/el2p/test_el2p.cc index 7ba5d398b49bd5e0a871500adc8be3f45e3dfc61..cb14a896da88b18682cdc918c464f507bf92c18c 100644 --- a/test/geomechanics/el2p/test_el2p.cc +++ b/test/geomechanics/el2p/test_el2p.cc @@ -28,9 +28,10 @@ // Check if DUNE-PDELab has been patched for our needs. #ifdef DUNE_PDELAB_IS_PATCHED_FOR_DUMUX -#include "el2pproblem.hh" #include <dune/common/precision.hh> +#include <dune/common/version.hh> #include <dumux/common/start.hh> +#include "el2pproblem.hh" int main(int argc, char** argv) { try { @@ -68,7 +69,11 @@ int main(int argc, char** argv) { TimeManager timeManager; // instantiate problem +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + Problem problem(timeManager, gridPtr->leafGridView(), tInitEnd); +#else Problem problem(timeManager, gridPtr->leafView(),tInitEnd); +#endif // set the initial approximated hydrostatic pressure distribution // based on an averaged brine density diff --git a/test/implicit/2p2c/injectionproblem.hh b/test/implicit/2p2c/injectionproblem.hh index 8794828d5b37ef6a6d5996d7b887bd5f8406f7f4..8134b0bfa69ae069738a1a9ce96d00340f8ed1a4 100644 --- a/test/implicit/2p2c/injectionproblem.hh +++ b/test/implicit/2p2c/injectionproblem.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_INJECTION_PROBLEM_HH #define DUMUX_INJECTION_PROBLEM_HH +#include <dune/common/version.hh> #include <dune/grid/io/file/dgfparser/dgfs.hh> #include <dumux/implicit/2p2c/2p2cmodel.hh> @@ -157,7 +158,11 @@ public: */ InjectionProblem(TimeManager &timeManager, const GridView &gridView) +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + : ParentType(timeManager, GridCreator::grid().leafGridView()) +#else : ParentType(timeManager, GridCreator::grid().leafView()) +#endif { try { diff --git a/test/implicit/co2/heterogeneousproblem.hh b/test/implicit/co2/heterogeneousproblem.hh index 29c0ee3d6a0e3d81345502a2c21bbaae31b53a71..ef15b8401796cff7090fa2ac46a92289ad5ef41a 100644 --- a/test/implicit/co2/heterogeneousproblem.hh +++ b/test/implicit/co2/heterogeneousproblem.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_HETEROGENEOUS_PROBLEM_HH #define DUMUX_HETEROGENEOUS_PROBLEM_HH +#include <dune/common/version.hh> #if HAVE_ALUGRID #include <dune/grid/alugrid/2d/alugrid.hh> @@ -193,7 +194,11 @@ public: */ HeterogeneousProblem(TimeManager &timeManager, const GridView &gridView) +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + : ParentType(timeManager, GridCreator::grid().leafGridView()), +#else : ParentType(timeManager, GridCreator::grid().leafView()), +#endif //Boundary Id Setup: injectionTop_(1), injectionBottom_(2), diff --git a/test/implicit/co2/heterogeneousspatialparameters.hh b/test/implicit/co2/heterogeneousspatialparameters.hh index 29a53a79e76ddbe969edc902a885513d107c8c6a..6b13fd82eb7d5571d75e98e664f27914fc679221 100644 --- a/test/implicit/co2/heterogeneousspatialparameters.hh +++ b/test/implicit/co2/heterogeneousspatialparameters.hh @@ -26,6 +26,8 @@ #ifndef DUMUX_HETEROGENEOUS_SPATIAL_PARAMS_HH #define DUMUX_HETEROGENEOUS_SPATIAL_PARAMS_HH +#include <dune/common/version.hh> + #include <dumux/material/spatialparams/implicitspatialparams.hh> #include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh> #include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> @@ -143,6 +145,19 @@ public: void setParams(GridPointer *gridPtr) { gridPtr_ = gridPtr; +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + int numElements = (*gridPtr_)->leafGridView().size(0); + paramIdx_.resize(numElements); + + ElementIterator eIt = (*gridPtr_)->leafGridView().template begin<0>(); + const ElementIterator eEndIt = (*gridPtr_)->leafGridView().template end<0>(); + for (; eIt != eEndIt; ++eIt) + { + int eIdx = (*gridPtr_)->leafGridView().indexSet().index(*eIt); + int param = (*gridPtr_).parameters(*eIt)[0]; + paramIdx_[eIdx] = param; + } +#else int numElements = (*gridPtr_)->leafView().size(0); paramIdx_.resize(numElements); @@ -154,6 +169,7 @@ public: int param = (*gridPtr_).parameters(*eIt)[0]; paramIdx_[eIdx] = param; } +#endif } @@ -169,7 +185,13 @@ public: const FVElementGeometry &fvGeometry, int scvIdx) const { - int eIdx = (*gridPtr_)->leafView().indexSet().index(element); //Get the global index of the element +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + //Get the global index of the element + int eIdx = (*gridPtr_)->leafGridView().indexSet().index(element); +#else + //Get the global index of the element + int eIdx = (*gridPtr_)->leafView().indexSet().index(element); +#endif if (paramIdx_[eIdx] == barrierTop_) return barrierTopK_; @@ -191,7 +213,13 @@ public: const FVElementGeometry &fvGeometry, int scvIdx) const { - int eIdx = (*gridPtr_)->leafView().indexSet().index(element); //Get the global index of the element +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + //Get the global index of the element + int eIdx = (*gridPtr_)->leafGridView().indexSet().index(element); +#else + //Get the global index of the element + int eIdx = (*gridPtr_)->leafView().indexSet().index(element); +#endif if (paramIdx_[eIdx] == barrierTop_) return barrierTopPorosity_; diff --git a/test/implicit/co2ni/heterogeneousproblemni.hh b/test/implicit/co2ni/heterogeneousproblemni.hh index e1db70dd92d03c5377bc56fa942a93f57fba3fe0..c9b47495c31442c6978d7cb934c9500c4109eecf 100644 --- a/test/implicit/co2ni/heterogeneousproblemni.hh +++ b/test/implicit/co2ni/heterogeneousproblemni.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_HETEROGENEOUS_NI_PROBLEM_NI_HH #define DUMUX_HETEROGENEOUS_NI_PROBLEM_NI_HH +#include <dune/common/version.hh> + #if HAVE_ALUGRID #include <dune/grid/alugrid/2d/alugrid.hh> #else @@ -183,7 +185,11 @@ public: */ HeterogeneousNIProblem(TimeManager &timeManager, const GridView &gridView) +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + : ParentType(timeManager, GridCreator::grid().leafGridView()), +#else : ParentType(timeManager, GridCreator::grid().leafView()), +#endif //Boundary Id Setup: injectionTop_ (1), injectionBottom_(2), diff --git a/test/implicit/mpnc/test_boxmpnckinetic.cc b/test/implicit/mpnc/test_boxmpnckinetic.cc index 94f0447d70e9a52ae6be301501b745a7a7c1b584..6b566e62332a89ab5251354c4208cc3bd993e29e 100644 --- a/test/implicit/mpnc/test_boxmpnckinetic.cc +++ b/test/implicit/mpnc/test_boxmpnckinetic.cc @@ -18,12 +18,11 @@ *****************************************************************************/ #include "config.h" -#include "evaporationatmosphereproblem.hh" +#include <dune/common/version.hh> #include <dumux/common/start.hh> - #include <dumux/io/interfacemeshcreator.hh> - +#include "evaporationatmosphereproblem.hh" /*! * \brief Print a usage string for simulations. @@ -283,8 +282,12 @@ int start_(int argc, TimeManager timeManager; // instantiate coupled problem +#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) + Problem problem(timeManager, gridPtr->leafGridView()); +#else Problem problem(timeManager, gridPtr->leafView()); +#endif Dumux::Parameters::print<TypeTag>();