diff --git a/test/implicit/3p3cni/Makefile.am b/test/implicit/3p3cni/Makefile.am index f1eaf98125f5526a15be290645e4a2680f500c12..5eaa31dae3c76a6b2ee378380f7c6dad6bccfde2 100644 --- a/test/implicit/3p3cni/Makefile.am +++ b/test/implicit/3p3cni/Makefile.am @@ -1,8 +1,9 @@ -check_PROGRAMS = test_3p3cni +check_PROGRAMS = test_box3p3cni test_cc3p3cni noinst_HEADERS = *.hh EXTRA_DIST=*reference.vtu *.input grids/*.dgf CMakeLists.txt -test_3p3cni_SOURCES = test_3p3cni.cc +test_box3p3cni_SOURCES = test_box3p3cni.cc +test_cc3p3cni_SOURCES = test_cc3p3cni.cc include $(top_srcdir)/am/global-rules diff --git a/test/implicit/3p3cni/columnxylolproblem.hh b/test/implicit/3p3cni/columnxylolproblem.hh index 0bc6e1f9820ffc80c25ff7234a52fea6217f79a2..c9193430a62c324246dd4d2008886f6c57c52a03 100644 --- a/test/implicit/3p3cni/columnxylolproblem.hh +++ b/test/implicit/3p3cni/columnxylolproblem.hh @@ -46,8 +46,10 @@ class ColumnProblem; namespace Properties { -NEW_TYPE_TAG(ColumnProblem, INHERITS_FROM(BoxThreePThreeCNI, ColumnSpatialParams)); - +NEW_TYPE_TAG(ColumnProblem, INHERITS_FROM(ThreePThreeCNI, ColumnSpatialParams)); +NEW_TYPE_TAG(ColumnBoxProblem, INHERITS_FROM(BoxModel, ColumnProblem)); +NEW_TYPE_TAG(ColumnCCProblem, INHERITS_FROM(CCModel, ColumnProblem)); + // Set the grid type SET_PROP(ColumnProblem, Grid) { @@ -124,6 +126,8 @@ class ColumnProblem : public ImplicitPorousMediaProblem<TypeTag> typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; + enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; + public: /*! * \brief The constructor @@ -135,6 +139,8 @@ public: : ParentType(timeManager, gridView), eps_(1e-6) { FluidSystem::init(); + + name_ = GET_RUNTIME_PARAM(TypeTag, std::string, Problem.Name); } /*! @@ -147,8 +153,8 @@ public: * * This is used as a prefix for files generated by the simulation. */ - const char *name() const - { return "columnxylol"; } + const std::string name() const + { return name_; } void sourceAtPos(PrimaryVariables &values, @@ -169,12 +175,11 @@ public: * used for which equation on a given boundary segment. * * \param values The boundary types for the conservation equations - * \param vertex The vertex for which the boundary type is set + * \param globalPos The position for which the bc type should be evaluated */ - void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const + void boundaryTypesAtPos(BoundaryTypes &values, + const GlobalPosition &globalPos) const { - const GlobalPosition globalPos = vertex.geometry().center(); - if (globalPos[1] < eps_) values.setAllDirichlet(); else @@ -186,14 +191,12 @@ public: * boundary segment. * * \param values The dirichlet values for the primary variables - * \param vertex The vertex for which the boundary type is set + * \param globalPos The position for which the bc type should be evaluated * * For this method, the \a values parameter stores primary variables. */ - void dirichlet(PrimaryVariables &values, const Vertex &vertex) const + void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { - const GlobalPosition globalPos = vertex.geometry().center(); - initial_(values, globalPos); } @@ -218,9 +221,14 @@ public: const int scvIdx, int boundaryFaceIdx) const { - const GlobalPosition &globalPos = element.geometry().corner(scvIdx); values = 0; - + + GlobalPosition globalPos; + if (isBox) + globalPos = element.geometry().corner(scvIdx); + else + globalPos = is.geometry().center(); + // negative values for injection if (globalPos[1] > 1.2 - eps_) { @@ -242,22 +250,14 @@ public: * \brief Evaluate the initial value for a control volume. * * \param values The initial values for the primary variables - * \param element The finite element - * \param fvGeomtry The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index + * \param globalPos The position for which the initial condition should be evaluated * * For this method, the \a values parameter stores primary * variables. */ - void initial(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeomtry, - const int scvIdx) const + void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { - const GlobalPosition &globalPos = element.geometry().corner(scvIdx); - initial_(values, globalPos); - } /*! @@ -274,48 +274,6 @@ public: return threePhases; } - /* - bool shouldWriteOutput() const - { - return - this->timeManager().timeStepIndex() == 0 || - this->timeManager().timeStepIndex() == 10 || - this->timeManager().timeStepIndex() == 20 || - this->timeManager().timeStepIndex() == 50 || - this->timeManager().timeStepIndex() == 100 || - this->timeManager().timeStepIndex() == 200 || - this->timeManager().timeStepIndex() == 300 || - this->timeManager().timeStepIndex() == 400 || - this->timeManager().timeStepIndex() == 500 || - this->timeManager().timeStepIndex() == 600 || - this->timeManager().timeStepIndex() == 700 || - this->timeManager().timeStepIndex() == 800 || - this->timeManager().timeStepIndex() == 900 || - this->timeManager().timeStepIndex() == 1000 || - this->timeManager().timeStepIndex() == 1100 || - this->timeManager().timeStepIndex() == 1200 || - this->timeManager().timeStepIndex() == 1300 || - this->timeManager().timeStepIndex() == 1400 || - this->timeManager().timeStepIndex() == 1500 || - this->timeManager().timeStepIndex() == 1600 || - this->timeManager().timeStepIndex() == 1700 || - this->timeManager().timeStepIndex() == 1800 || - this->timeManager().timeStepIndex() == 1900 || - this->timeManager().timeStepIndex() == 2000 || - this->timeManager().timeStepIndex() == 2100 || - this->timeManager().timeStepIndex() == 2200 || - this->timeManager().timeStepIndex() == 2300 || - this->timeManager().timeStepIndex() == 2400 || - this->timeManager().timeStepIndex() == 2500 || - this->timeManager().timeStepIndex() == 2600 || - this->timeManager().timeStepIndex() == 2700 || - this->timeManager().timeStepIndex() == 2800 || - this->timeManager().timeStepIndex() == 2900 || - this->timeManager().willBeFinished(); - } - */ - - private: // internal method for the initial condition (reused for the // dirichlet conditions!) @@ -375,6 +333,7 @@ private: } const Scalar eps_; + std::string name_; }; } //end namespace diff --git a/test/implicit/3p3cni/kuevetteproblem.hh b/test/implicit/3p3cni/kuevetteproblem.hh index f6ead4d8f7f68abc6faa7e83574254076c8ebde3..b193e5a610f894662eb0664888c9a4916feeaa35 100644 --- a/test/implicit/3p3cni/kuevetteproblem.hh +++ b/test/implicit/3p3cni/kuevetteproblem.hh @@ -46,8 +46,10 @@ class KuevetteProblem; namespace Properties { -NEW_TYPE_TAG(KuevetteProblem, INHERITS_FROM(BoxThreePThreeCNI, KuevetteSpatialParams)); - +NEW_TYPE_TAG(KuevetteProblem, INHERITS_FROM(ThreePThreeCNI, KuevetteSpatialParams)); +NEW_TYPE_TAG(KuevetteBoxProblem, INHERITS_FROM(BoxModel, KuevetteProblem)); +NEW_TYPE_TAG(KuevetteCCProblem, INHERITS_FROM(CCModel, KuevetteProblem)); + // Set the grid type SET_PROP(KuevetteProblem, Grid) { @@ -158,6 +160,8 @@ class KuevetteProblem : public ImplicitPorousMediaProblem<TypeTag> typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; + enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; + public: /*! * \brief The constructor @@ -169,6 +173,8 @@ public: : ParentType(timeManager, gridView), eps_(1e-6) { FluidSystem::init(); + + name_ = GET_RUNTIME_PARAM(TypeTag, std::string, Problem.Name); } /*! @@ -181,9 +187,9 @@ public: * * This is used as a prefix for files generated by the simulation. */ - const char *name() const - { return "kuevette3p3cni"; } - + const std::string name() const + { return name_; } + void sourceAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { @@ -203,12 +209,11 @@ public: * used for which equation on a given boundary segment. * * \param values The boundary types for the conservation equations - * \param vertex The vertex for which the boundary type is set + * \param globalPos The position for which the bc type should be evaluated */ - void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const + void boundaryTypesAtPos(BoundaryTypes &values, + const GlobalPosition &globalPos) const { - const GlobalPosition globalPos = vertex.geometry().center(); - if(globalPos[0] > 1.5 - eps_) values.setAllDirichlet(); else @@ -221,14 +226,12 @@ public: * boundary segment. * * \param values The dirichlet values for the primary variables - * \param vertex The vertex for which the boundary type is set + * \param globalPos The position for which the bc type should be evaluated * * For this method, the \a values parameter stores primary variables. */ - void dirichlet(PrimaryVariables &values, const Vertex &vertex) const + void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { - const GlobalPosition globalPos = vertex.geometry().center(); - initial_(values, globalPos); } @@ -253,9 +256,14 @@ public: const int scvIdx, int boundaryFaceIdx) const { - const GlobalPosition &globalPos = element.geometry().corner(scvIdx); values = 0; - + + GlobalPosition globalPos; + if (isBox) + globalPos = element.geometry().corner(scvIdx); + else + globalPos = is.geometry().center(); + // negative values for injection if (globalPos[0] < eps_) { @@ -277,22 +285,14 @@ public: * \brief Evaluate the initial value for a control volume. * * \param values The initial values for the primary variables - * \param element The finite element - * \param fvGeomtry The finite-volume geometry in the box scheme - * \param scvIdx The local vertex index + * \param globalPos The position for which the initial condition should be evaluated * * For this method, the \a values parameter stores primary * variables. */ - void initial(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeomtry, - const int scvIdx) const + void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { - const GlobalPosition &globalPos = element.geometry().corner(scvIdx); - initial_(values, globalPos); - } /*! @@ -332,6 +332,7 @@ private: } const Scalar eps_; + std::string name_; }; } //end namespace diff --git a/test/implicit/3p3cni/kuevettespatialparams.hh b/test/implicit/3p3cni/kuevettespatialparams.hh index 40f502991f7a915e7778daa5a0d45066f77fcf61..d3487b383c2559e49fb9df29b002fbdbad146af6 100644 --- a/test/implicit/3p3cni/kuevettespatialparams.hh +++ b/test/implicit/3p3cni/kuevettespatialparams.hh @@ -159,14 +159,14 @@ public: * potential gradient. * * \param element The current finite element - * \param fvGeomtry The current finite volume geometry of the element + * \param fvGeometry The current finite volume geometry of the element * \param scvIdx The index of the sub-control volume */ const Scalar intrinsicPermeability(const Element &element, - const FVElementGeometry &fvGeomtry, + const FVElementGeometry &fvGeometry, const int scvIdx) const { - const GlobalPosition &pos = fvGeomtry.subContVol[scvIdx].global; + const GlobalPosition &pos = fvGeometry.subContVol[scvIdx].global; if (isFineMaterial_(pos)) return fineK_; return coarseK_; @@ -176,15 +176,15 @@ public: * \brief Define the porosity \f$[-]\f$ of the spatial parameters * * \param element The finite element - * \param fvGeomtry The finite volume geometry + * \param fvGeometry The finite volume geometry * \param scvIdx The local index of the sub-control volume where * the porosity needs to be defined */ double porosity(const Element &element, - const FVElementGeometry &fvGeomtry, + const FVElementGeometry &fvGeometry, const int scvIdx) const { - const GlobalPosition &pos = fvGeomtry.subContVol[scvIdx].global; + const GlobalPosition &pos = fvGeometry.subContVol[scvIdx].global; if (isFineMaterial_(pos)) return finePorosity_; else @@ -196,14 +196,14 @@ public: * \brief return the parameter object for the Brooks-Corey material law which depends on the position * * \param element The current finite element - * \param fvGeomtry The current finite volume geometry of the element + * \param fvGeometry The current finite volume geometry of the element * \param scvIdx The index of the sub-control volume */ const MaterialLawParams& materialLawParams(const Element &element, - const FVElementGeometry &fvGeomtry, + const FVElementGeometry &fvGeometry, const int scvIdx) const { - const GlobalPosition &pos = fvGeomtry.subContVol[scvIdx].global; + const GlobalPosition &pos = fvGeometry.subContVol[scvIdx].global; if (isFineMaterial_(pos)) return fineMaterialParams_; else @@ -216,18 +216,18 @@ public: * This is only required for non-isothermal models. * * \param element The finite element - * \param fvGeomtry The finite volume geometry + * \param fvGeometry The finite volume geometry * \param scvIdx The local index of the sub-control volume where * the heat capacity needs to be defined */ double heatCapacity(const Element &element, - const FVElementGeometry &fvGeomtry, + const FVElementGeometry &fvGeometry, const int scvIdx) const { return 850 // specific heat capacity [J / (kg K)] * 2650 // density of sand [kg/m^3] - * (1 - porosity(element, fvGeomtry, scvIdx)); + * (1 - porosity(element, fvGeometry, scvIdx)); } /*! @@ -241,7 +241,7 @@ public: * \param elemVolVars The volume variables * \param tempGrad The temperature gradient * \param element The current finite element - * \param fvGeomtry The finite volume geometry of the current element + * \param fvGeometry The finite volume geometry of the current element * \param faceIdx The local index of the sub-control volume face where * the matrix heat flux should be calculated */ @@ -250,7 +250,7 @@ public: const ElementVolumeVariables &elemVolVars, const DimVector &tempGrad, const Element &element, - const FVElementGeometry &fvGeomtry, + const FVElementGeometry &fvGeometry, const int faceIdx) const { static const Scalar ldry = 0.35; @@ -258,8 +258,8 @@ public: static const Scalar lSn1 = 0.65; // arithmetic mean of the liquid saturation and the porosity - const int i = fvGeomtry.subContVolFace[faceIdx].i; - const int j = fvGeomtry.subContVolFace[faceIdx].j; + const int i = fvGeometry.subContVolFace[faceIdx].i; + const int j = fvGeometry.subContVolFace[faceIdx].j; Scalar Sw = std::max(0.0, (elemVolVars[i].saturation(wPhaseIdx) + elemVolVars[j].saturation(wPhaseIdx)) / 2); Scalar Sn = std::max(0.0, (elemVolVars[i].saturation(nPhaseIdx) + diff --git a/test/implicit/3p3cni/test_3p3cni.cc b/test/implicit/3p3cni/test_box3p3cni.cc similarity index 95% rename from test/implicit/3p3cni/test_3p3cni.cc rename to test/implicit/3p3cni/test_box3p3cni.cc index 3b5710201bb5d0fbdfde1652021930f1eab51103..6eb5ff6b879662d778649e22768718745949c4e8 100644 --- a/test/implicit/3p3cni/test_3p3cni.cc +++ b/test/implicit/3p3cni/test_box3p3cni.cc @@ -24,7 +24,6 @@ #include "config.h" //#include "kuevetteproblem.hh" #include "columnxylolproblem.hh" -//#include "permdruckproblem.hh" #include <dumux/common/start.hh> @@ -56,7 +55,7 @@ void usage(const char *progName, const std::string &errorMsg) int main(int argc, char** argv) { -// typedef TTAG(KuevetteProblem) ProblemTypeTag; - typedef TTAG(ColumnProblem) ProblemTypeTag; +// typedef TTAG(KuevetteBoxProblem) ProblemTypeTag; + typedef TTAG(ColumnBoxProblem) ProblemTypeTag; return Dumux::start<ProblemTypeTag>(argc, argv, usage); } diff --git a/test/implicit/3p3cni/test_box3p3cni.input b/test/implicit/3p3cni/test_box3p3cni.input new file mode 100644 index 0000000000000000000000000000000000000000..c1e0432b0500fc891a5f70313e52827bd6a08b75 --- /dev/null +++ b/test/implicit/3p3cni/test_box3p3cni.input @@ -0,0 +1,31 @@ +############################################################### +# Parameter file for test_3p3cni. +# Everything behind a '#' is a comment. +# Type "./test_3p3cni --help" for more information. +############################################################### + +############################################################### +# Mandatory arguments +############################################################### + +[TimeManager] +DtInitial = 1 # [s] +TEnd = 200 # [s] + +[Grid] +File = ./grids/column.dgf + +[Problem] +Name = columnxylolbox # name passed to the output routines + +############################################################### +# Simulation restart +# +# DuMux simulations can be restarted from *.drs files +# Set Restart to the value of a specific file, +# e.g.: 'Restart = 27184.1' for the restart file +# name_time=27184.1_rank=0.drs +# Please comment in the two lines below, if restart is desired. +############################################################### +# [TimeManager] +# Restart = ... diff --git a/test/implicit/3p3cni/test_cc3p3cni.cc b/test/implicit/3p3cni/test_cc3p3cni.cc new file mode 100644 index 0000000000000000000000000000000000000000..69a2abe259781bbd8e76fc655faf5b73917a28e3 --- /dev/null +++ b/test/implicit/3p3cni/test_cc3p3cni.cc @@ -0,0 +1,61 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program 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. * + * * + * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * + * \brief test for the 3p3cni box model + */ +#include "config.h" +//#include "kuevetteproblem.hh" +#include "columnxylolproblem.hh" +#include <dumux/common/start.hh> + + +/*! + * \brief Provides an interface for customizing error messages associated with + * reading in parameters. + * + * \param progName The name of the program, that was tried to be started. + * \param errorMsg The error message that was issued by the start function. + * Comprises the thing that went wrong and a general help message. + */ +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"; + + std::cout << errorMessageOut + << "\n"; + } +} + +int main(int argc, char** argv) +{ +// typedef TTAG(KuevetteCCProblem) ProblemTypeTag; + typedef TTAG(ColumnCCProblem) ProblemTypeTag; + return Dumux::start<ProblemTypeTag>(argc, argv, usage); +} diff --git a/test/implicit/3p3cni/test_3p3cni.input b/test/implicit/3p3cni/test_cc3p3cni.input similarity index 93% rename from test/implicit/3p3cni/test_3p3cni.input rename to test/implicit/3p3cni/test_cc3p3cni.input index 7be6df79dd5a8cc0ffbb55d069a25ea3f9f65fc4..d41669fddecc208d4b80db50b4c5099f86594ba4 100644 --- a/test/implicit/3p3cni/test_3p3cni.input +++ b/test/implicit/3p3cni/test_cc3p3cni.input @@ -15,6 +15,9 @@ TEnd = 200 # [s] [Grid] File = ./grids/column.dgf +[Problem] +Name = columnxylolcc # name passed to the output routines + ############################################################### # Simulation restart #