From 2e67dae1af463f732cc15266d33d5a612122beed Mon Sep 17 00:00:00 2001 From: Martin Schneider <martin.schneider@iws.uni-stuttgart.de> Date: Tue, 27 Sep 2016 09:15:23 +0200 Subject: [PATCH] [adaptive] Update of adaptive test problems --- .../2p/implicit/CMakeLists.txt | 3 ++ .../2p/implicit/lensproblem.hh | 31 +++++++++++++++++-- .../2p/implicit/lensspatialparams.hh | 6 ++-- .../2p/implicit/test_boxadaptive2p.input | 5 ++- .../2p/implicit/test_cc2p.input | 17 +++++----- 5 files changed, 49 insertions(+), 13 deletions(-) diff --git a/test/porousmediumflow/2p/implicit/CMakeLists.txt b/test/porousmediumflow/2p/implicit/CMakeLists.txt index bb9c0f8c03..58f07295b1 100644 --- a/test/porousmediumflow/2p/implicit/CMakeLists.txt +++ b/test/porousmediumflow/2p/implicit/CMakeLists.txt @@ -23,6 +23,9 @@ add_dumux_test(test_ccadaptive2p test_ccadaptive2p test_ccadaptive2p.cc ${CMAKE_CURRENT_BINARY_DIR}/lensccadaptive-00017.vtu --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccadaptive2p") +add_dumux_test(test_boxadaptive2p test_boxadaptive2p test_boxadaptive2p.cc + ${CMAKE_CURRENT_BINARY_DIR}/test_boxadaptive2p) + add_dumux_test(test_generalizeddirichlet test_generalizeddirichlet test_generalizeddirichlet.cc python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py --script fuzzy diff --git a/test/porousmediumflow/2p/implicit/lensproblem.hh b/test/porousmediumflow/2p/implicit/lensproblem.hh index fd64d71f22..a17e557d7b 100644 --- a/test/porousmediumflow/2p/implicit/lensproblem.hh +++ b/test/porousmediumflow/2p/implicit/lensproblem.hh @@ -32,6 +32,7 @@ #include <dumux/porousmediumflow/implicit/problem.hh> #include <dumux/implicit/cellcentered/propertydefaults.hh> #include <dumux/porousmediumflow/2p/implicit/gridadaptindicator.hh> +#include <dumux/porousmediumflow/2p/implicit/adaptionhelper.hh> #include <dumux/implicit/adaptive/gridadaptinitializationindicator.hh> #include "lensspatialparams.hh" @@ -61,8 +62,9 @@ SET_TYPE_PROP(LensCCProblem, Grid, Dune::YaspGrid<2>); SET_TYPE_PROP(LensBoxProblem, Grid, Dune::YaspGrid<2>); #endif +SET_TYPE_PROP(LensBoxAdaptiveProblem, Grid, Dune::UGGrid<2>); + #if HAVE_DUNE_ALUGRID -SET_TYPE_PROP(LensBoxAdaptiveProblem, Grid, Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>); SET_TYPE_PROP(LensCCAdaptiveProblem, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); #endif @@ -97,10 +99,12 @@ SET_TYPE_PROP(LensBoxAdaptiveProblem, LinearSolver, ILU0BiCGSTABBackend<TypeTag> SET_BOOL_PROP(LensCCAdaptiveProblem, AdaptiveGrid, true); SET_TYPE_PROP(LensCCAdaptiveProblem, AdaptionIndicator, TwoPImplicitGridAdaptIndicator<TypeTag>); SET_TYPE_PROP(LensCCAdaptiveProblem, AdaptionInitializationIndicator, ImplicitGridAdaptInitializationIndicator<TypeTag>); +SET_TYPE_PROP(LensCCAdaptiveProblem, AdaptionHelper, TwoPAdaptionHelper<TypeTag>); SET_BOOL_PROP(LensBoxAdaptiveProblem, AdaptiveGrid, true); SET_TYPE_PROP(LensBoxAdaptiveProblem, AdaptionIndicator, TwoPImplicitGridAdaptIndicator<TypeTag>); -SET_TYPE_PROP(LensBoxAdaptiveProblem, AdaptionInitializationIndicator, ImplicitGridAdaptInitializationIndicator<TypeTag>); +//SET_TYPE_PROP(LensBoxAdaptiveProblem, AdaptionInitializationIndicator, ImplicitGridAdaptInitializationIndicator<TypeTag>); +SET_TYPE_PROP(LensBoxAdaptiveProblem, AdaptionHelper, TwoPAdaptionHelper<TypeTag>); #endif NEW_PROP_TAG(BaseProblem); @@ -364,6 +368,29 @@ public: } // \} + void addOutputVtkFields() + { + typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField; + + unsigned numElements = this->gridView().size(0); + ScalarField *isNew = this->resultWriter().allocateManagedBuffer(numElements); + ScalarField *gridLevel = this->resultWriter().allocateManagedBuffer(numElements); + + for (const auto& element : elements(this->gridView())) + { + if(element.partitionType() == Dune::InteriorEntity) + { + int eIdx = this->elementMapper().index(element); + + (*isNew)[eIdx] = element.isNew(); + (*gridLevel)[eIdx] = element.level(); + } + } + + this->resultWriter().attachCellData(*isNew, "isNew"); + this->resultWriter().attachCellData(*gridLevel, "gridLevel"); + } + private: bool onLeftBoundary_(const GlobalPosition &globalPos) const diff --git a/test/porousmediumflow/2p/implicit/lensspatialparams.hh b/test/porousmediumflow/2p/implicit/lensspatialparams.hh index 4a622dbfd6..4f7e74f1be 100644 --- a/test/porousmediumflow/2p/implicit/lensspatialparams.hh +++ b/test/porousmediumflow/2p/implicit/lensspatialparams.hh @@ -131,7 +131,7 @@ public: const FVElementGeometry &fvGeometry, int scvIdx) const { - const GlobalPosition& globalPos = fvGeometry.subContVol[scvIdx].global; + const GlobalPosition& globalPos = element.geometry().center(); if (isInLens_(globalPos)) return lensK_; @@ -163,8 +163,8 @@ public: { const GlobalPosition& globalPos = fvGeometry.subContVol[scvIdx].global; - if (isInLens_(globalPos)) - return lensMaterialParams_; +// if (isInLens_(globalPos)) +// return lensMaterialParams_; return outerMaterialParams_; } diff --git a/test/porousmediumflow/2p/implicit/test_boxadaptive2p.input b/test/porousmediumflow/2p/implicit/test_boxadaptive2p.input index 0641558f9f..15a3d8dba9 100644 --- a/test/porousmediumflow/2p/implicit/test_boxadaptive2p.input +++ b/test/porousmediumflow/2p/implicit/test_boxadaptive2p.input @@ -5,7 +5,10 @@ TEnd = 3000 # [s] [Grid] LowerLeft = 0 0 UpperRight = 6 4 -Cells = 48 32 +#Cells = 48 32 +Cells = 24 16 +Refinement = 2 +CellType = Cube [SpatialParams] LensLowerLeftX = 1.0 # [m] x-coordinate of the lower left lens corner diff --git a/test/porousmediumflow/2p/implicit/test_cc2p.input b/test/porousmediumflow/2p/implicit/test_cc2p.input index e2162947fd..1a724c827b 100644 --- a/test/porousmediumflow/2p/implicit/test_cc2p.input +++ b/test/porousmediumflow/2p/implicit/test_cc2p.input @@ -1,11 +1,11 @@ [TimeManager] -DtInitial = 250 # [s] -TEnd = 3000 # [s] +DtInitial = 1.0e2 # [s] +TEnd = 1.0e8 # [s] [Grid] LowerLeft = 0 0 -UpperRight = 6 4 -Cells = 48 32 +UpperRight = 100 100 +Cells = 100 100 [SpatialParams] LensLowerLeftX = 1.0 # [m] x-coordinate of the lower left lens corner @@ -14,8 +14,11 @@ LensUpperRightX = 4.0 # [m] x-coordinate of the upper right lens corner LensUpperRightY = 3.0 # [m] y-coordinate of the upper right lens corner [Problem] -Name = lenscc # name passed to the output routines +Name = FiveSpot # name passed to the output routines +InjectionRate = 1.5e-3 +InjectionRadius = 5.0 + [Implicit] -EnablePartialReassemble = 1 # enable partial reassembly of the jacobian matrix? -EnableJacobianRecycling = 1 # Enable reuse of jacobian matrices? +EnablePartialReassemble = 0 # enable partial reassembly of the jacobian matrix? +EnableJacobianRecycling = 0 # Enable reuse of jacobian matrices? -- GitLab