diff --git a/dumux/implicit/cellcentered/ccproblem.hh b/dumux/implicit/cellcentered/ccproblem.hh index ed4dbeb0739da6be232bdf317a280f5ceae3fdf4..716bc59f568906ed6085ee3f78584737ed14f70b 100644 --- a/dumux/implicit/cellcentered/ccproblem.hh +++ b/dumux/implicit/cellcentered/ccproblem.hh @@ -102,22 +102,12 @@ public: , newtonCtl_(asImp_()) { // calculate the bounding box of the local partition of the grid view -// VertexIterator vIt = gridView.template begin<dim>(); -// const VertexIterator vEndIt = gridView.template end<dim>(); -// for (; vIt!=vEndIt; ++vIt) { -// for (int i=0; i<dim; i++) { -// bboxMin_[i] = std::min(bboxMin_[i], vIt->geometry().corner(0)[i]); -// bboxMax_[i] = std::max(bboxMax_[i], vIt->geometry().corner(0)[i]); -// } -// } - - // HACK due to current handling of Dirichlet boundary conditions - ElementIterator it = gridView.template begin<0>(); - const ElementIterator endIt = gridView.template end<0>(); - for (; it!=endIt; ++it) { + VertexIterator vIt = gridView.template begin<dim>(); + const VertexIterator vEndIt = gridView.template end<dim>(); + for (; vIt!=vEndIt; ++vIt) { for (int i=0; i<dim; i++) { - bboxMin_[i] = std::min(bboxMin_[i], it->geometry().center()[i]); - bboxMax_[i] = std::max(bboxMax_[i], it->geometry().center()[i]); + bboxMin_[i] = std::min(bboxMin_[i], vIt->geometry().corner(0)[i]); + bboxMax_[i] = std::max(bboxMax_[i], vIt->geometry().corner(0)[i]); } } diff --git a/test/implicit/2p/lensproblem.hh b/test/implicit/2p/lensproblem.hh index cd2507f91d82c0fe01449788c8ad52d3dbdfe167..78d953f198177a8c714e0d10628dc706903ed228 100644 --- a/test/implicit/2p/lensproblem.hh +++ b/test/implicit/2p/lensproblem.hh @@ -202,11 +202,15 @@ public: */ LensProblem(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView), - isBox_(GET_PROP_VALUE(TypeTag, ImplicitIsBox)) + : ParentType(timeManager, gridView) { eps_ = 3e-6; temperature_ = 273.15 + 20; // -> 20°C + + name_ = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, + std::string, + Problem, + Name); } /*! @@ -221,10 +225,7 @@ public: */ const char *name() const { - if (isBox_) - return "lensbox"; - else - return "lenscc"; + return name_.c_str(); } /*! @@ -301,40 +302,15 @@ public: Scalar densityW = FluidSystem::density(fluidState, FluidSystem::wPhaseIdx); - if (isBox_) - { - if (onLeftBoundary_(globalPos)) - { - Scalar height = this->bboxMax()[1] - this->bboxMin()[1]; - Scalar depth = this->bboxMax()[1] - globalPos[1]; - Scalar alpha = (1 + 1.5/height); - - // hydrostatic pressure scaled by alpha - values[pwIdx] = 1e5 - alpha*densityW*this->gravity()[1]*depth; - values[SnIdx] = 0.0; - } - else if (onRightBoundary_(globalPos)) - { - Scalar depth = this->bboxMax()[1] - globalPos[1]; - - // hydrostatic pressure - values[pwIdx] = 1e5 - densityW*this->gravity()[1]*depth; - values[SnIdx] = 0.0; - } - else - values = 0.0; - } - else - { - Scalar height = 4.0;//this->bboxMax()[1] - this->bboxMin()[1]; - Scalar depth = 4.0 - globalPos[1];//this->bboxMax()[1] - globalPos[1]; - Scalar alpha = 1 + 1.5/height; - Scalar factor = (6.0*alpha + (1.0 - alpha)*globalPos[0])/6.0; - - // hydrostatic pressure scaled by alpha - values[pwIdx] = 1e5 - factor*densityW*this->gravity()[1]*depth; - values[SnIdx] = 0.0; - } + Scalar height = this->bboxMax()[1] - this->bboxMin()[1]; + Scalar depth = this->bboxMax()[1] - globalPos[1]; + Scalar alpha = 1 + 1.5/height; + Scalar width = this->bboxMax()[0] - this->bboxMin()[0]; + Scalar factor = (width*alpha + (1.0 - alpha)*globalPos[0])/width; + + // hydrostatic pressure scaled by alpha + values[pwIdx] = 1e5 - factor*densityW*this->gravity()[1]*depth; + values[SnIdx] = 0.0; } /*! @@ -382,11 +358,7 @@ public: Scalar densityW = FluidSystem::density(fluidState, FluidSystem::wPhaseIdx); - Scalar depth; - if (isBox_) - depth = this->bboxMax()[1] - globalPos[1]; - else - depth = 4.0 - globalPos[1]; + Scalar depth = this->bboxMax()[1] - globalPos[1]; // hydrostatic pressure values[pwIdx] = 1e5 - densityW*this->gravity()[1]*depth; @@ -418,23 +390,14 @@ private: bool onInlet_(const GlobalPosition &globalPos) const { - if (isBox_) - { - Scalar width = this->bboxMax()[0] - this->bboxMin()[0]; - Scalar lambda = (this->bboxMax()[0] - globalPos[0])/width; - return onUpperBoundary_(globalPos) && 0.5 < lambda && lambda < 2.0/3.0; - } - else - { - Scalar width = 6.0;//this->bboxMax()[0] - this->bboxMin()[0]; - Scalar lambda = (6.0/*this->bboxMax()[0]*/ - globalPos[0])/width; - return (globalPos[1] > 4.0 - eps_) && 0.5 < lambda && lambda < 2.0/3.0; - } + Scalar width = this->bboxMax()[0] - this->bboxMin()[0]; + Scalar lambda = (this->bboxMax()[0] - globalPos[0])/width; + return onUpperBoundary_(globalPos) && 0.5 < lambda && lambda < 2.0/3.0; } Scalar temperature_; Scalar eps_; - const bool isBox_; + std::string name_; }; } //end namespace diff --git a/test/implicit/2p/lensspatialparams.hh b/test/implicit/2p/lensspatialparams.hh index 63b909c947bd371495045a0b7b741e058e1b832c..836e1ed6b3376c17ee47969dfa47a2129749c875 100644 --- a/test/implicit/2p/lensspatialparams.hh +++ b/test/implicit/2p/lensspatialparams.hh @@ -91,8 +91,7 @@ public: typedef typename MaterialLaw::Params MaterialLawParams; LensSpatialParams(const GridView& gridView) - : ParentType(gridView), - isBox_(GET_PROP_VALUE(TypeTag, ImplicitIsBox)) + : ParentType(gridView) { try { @@ -203,7 +202,6 @@ private: Scalar outerK_; MaterialLawParams lensMaterialParams_; MaterialLawParams outerMaterialParams_; - const bool isBox_; }; } // end namespace diff --git a/test/implicit/2p/test_box2p.cc b/test/implicit/2p/test_box2p.cc index afec6a3114977f23ae9458950581d97fc130889f..63b26f4c151b3ebc1b036db9c2d48a3d1929e352 100644 --- a/test/implicit/2p/test_box2p.cc +++ b/test/implicit/2p/test_box2p.cc @@ -37,22 +37,22 @@ void usage(const char *progName, const std::string &errorMsg) { if (errorMsg.size() > 0) { std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.File Name of the file containing the grid \n" - "\t definition in DGF format\n" - "\t-SpatialParams.LensLowerLeftX x-coordinate of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensLowerLeftY y-coordinate of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRightX x-coordinate of the upper right corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRightY y-coordinate of the upper right corner of the lens [m] \n" - "\n"; + errorMessageOut += progName; + errorMessageOut += " [options]\n"; + errorMessageOut += errorMsg; + errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" + "\t-TimeManager.TEnd End of the simulation [s] \n" + "\t-TimeManager.DtInitial Initial timestep size [s] \n" + "\t-Grid.File Name of the file containing the grid \n" + "\t definition in DGF format\n" + "\t-SpatialParams.LensLowerLeftX x-coordinate of the lower left corner of the lens [m] \n" + "\t-SpatialParams.LensLowerLeftY y-coordinate of the lower left corner of the lens [m] \n" + "\t-SpatialParams.LensUpperRightX x-coordinate of the upper right corner of the lens [m] \n" + "\t-SpatialParams.LensUpperRightY y-coordinate of the upper right corner of the lens [m] \n" + "\t-Problem.Name String for naming of the output files \n" + "\n"; - std::cout << errorMessageOut - << "\n"; + std::cout << errorMessageOut << std::endl; } } diff --git a/test/implicit/2p/test_box2p.input b/test/implicit/2p/test_box2p.input index 61d3a4f31d5ba107ac7d65427613ee90b7ecfc2d..6a8c23673a65996fda3a0e8b69db31c24e3f0f70 100644 --- a/test/implicit/2p/test_box2p.input +++ b/test/implicit/2p/test_box2p.input @@ -21,6 +21,9 @@ LensLowerLeftY = 2.0 # [m] y-coordinate of the lower left lens corner 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 = lensbox # for output files + ############################################################### # Simulation restart # diff --git a/test/implicit/2p/test_cc2p.cc b/test/implicit/2p/test_cc2p.cc index 747e9d350a9f0b8926015a89a5da8a5354113b5d..fdccb8c8b6eeb526958d5c04d24110f2f59618e9 100644 --- a/test/implicit/2p/test_cc2p.cc +++ b/test/implicit/2p/test_cc2p.cc @@ -42,22 +42,22 @@ void usage(const char *progName, const std::string &errorMsg) { if (errorMsg.size() > 0) { std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe List of Mandatory arguments for this program is:\n" - "\t-tEnd The end of the simulation [s] \n" - "\t-dtInitial The initial timestep size [s] \n" - "\t-gridFile The file name of the file containing the grid \n" - "\t definition in DGF format\n" - "\t-SpatialParameters.lensLowerLeftX Dimension of the lens [m] \n" - "\t-SpatialParameters.lensLowerLeftY Dimension of the lens [m] \n" - "\t-SpatialParameters.lensUpperRightX Dimension of the lens [m] \n" - "\t-SpatialParameters.lensUpperRighty Dimension of the lens [m] \n" - "\n"; - - std::cout << errorMessageOut - << "\n"; + errorMessageOut += progName; + errorMessageOut += " [options]\n"; + errorMessageOut += errorMsg; + errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" + "\t-TimeManager.TEnd End of the simulation [s] \n" + "\t-TimeManager.DtInitial Initial timestep size [s] \n" + "\t-Grid.File Name of the file containing the grid \n" + "\t definition in DGF format\n" + "\t-SpatialParams.LensLowerLeftX x-coordinate of the lower left corner of the lens [m] \n" + "\t-SpatialParams.LensLowerLeftY y-coordinate of the lower left corner of the lens [m] \n" + "\t-SpatialParams.LensUpperRightX x-coordinate of the upper right corner of the lens [m] \n" + "\t-SpatialParams.LensUpperRightY y-coordinate of the upper right corner of the lens [m] \n" + "\t-Problem.Name String for naming of the output files \n" + "\n"; + + std::cout << errorMessageOut << std::endl; } } diff --git a/test/implicit/2p/test_cc2p.input b/test/implicit/2p/test_cc2p.input index 61d3a4f31d5ba107ac7d65427613ee90b7ecfc2d..a63fa6c64ec03bf90e441ec23f724dc9064d9bec 100644 --- a/test/implicit/2p/test_cc2p.input +++ b/test/implicit/2p/test_cc2p.input @@ -21,6 +21,9 @@ LensLowerLeftY = 2.0 # [m] y-coordinate of the lower left lens corner 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 # for output files + ############################################################### # Simulation restart #