diff --git a/test/implicit/2p2cni/Makefile.am b/test/implicit/2p2cni/Makefile.am index dc1f1914f8e30e93d700bb3279628fcff508f9b2..8bb91ed0e365f17d231e05a2a90beef5624e4422 100644 --- a/test/implicit/2p2cni/Makefile.am +++ b/test/implicit/2p2cni/Makefile.am @@ -1,8 +1,9 @@ -check_PROGRAMS = test_2p2cni +check_PROGRAMS = test_box2p2cni test_cc2p2cni noinst_HEADERS = *.hh EXTRA_DIST=*reference.vtu *.input grids/*.dgf CMakeLists.txt -test_2p2cni_SOURCES = test_2p2cni.cc +test_box2p2cni_SOURCES = test_box2p2cni.cc +test_cc2p2cni_SOURCES = test_cc2p2cni.cc include $(top_srcdir)/am/global-rules diff --git a/test/implicit/2p2cni/test_box2p2cni.cc b/test/implicit/2p2cni/test_box2p2cni.cc new file mode 100644 index 0000000000000000000000000000000000000000..17f0177ff10d972e478bc9c37c9f0f402e4d8c0e --- /dev/null +++ b/test/implicit/2p2cni/test_box2p2cni.cc @@ -0,0 +1,58 @@ +// -*- 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 2p2cni box model + */ +#include "config.h" +#include "waterairproblem.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(WaterAirBoxProblem) ProblemTypeTag; + return Dumux::start<ProblemTypeTag>(argc, argv, usage); +} diff --git a/test/implicit/2p2cni/test_box2p2cni.input b/test/implicit/2p2cni/test_box2p2cni.input new file mode 100644 index 0000000000000000000000000000000000000000..143114b0d9c3193d668a648927aa66dbfafdb110 --- /dev/null +++ b/test/implicit/2p2cni/test_box2p2cni.input @@ -0,0 +1,31 @@ +############################################################### +# Parameter file for test_2p2cni. +# Everything behind a '#' is a comment. +# Type "./test_2p2cni --help" for more information. +############################################################### + +############################################################### +# Mandatory arguments +############################################################### + +[TimeManager] +DtInitial = 250 # [s] +TEnd = 1e4 # [s] + +[Grid] +File = ./grids/test_2p2cni.dgf + +[Problem] +Name = waterairbox + +############################################################### +# 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/2p2cni/test_2p2cni.cc b/test/implicit/2p2cni/test_cc2p2cni.cc similarity index 98% rename from test/implicit/2p2cni/test_2p2cni.cc rename to test/implicit/2p2cni/test_cc2p2cni.cc index 36b3c45a3766803fc92ce992dd2cdb6f435272f7..0c961ec950c5e0051c4a1d0ca83c3a9ac99b186e 100644 --- a/test/implicit/2p2cni/test_2p2cni.cc +++ b/test/implicit/2p2cni/test_cc2p2cni.cc @@ -53,6 +53,6 @@ void usage(const char *progName, const std::string &errorMsg) int main(int argc, char** argv) { - typedef TTAG(WaterAirProblem) ProblemTypeTag; + typedef TTAG(WaterAirCCProblem) ProblemTypeTag; return Dumux::start<ProblemTypeTag>(argc, argv, usage); } diff --git a/test/implicit/2p2cni/test_2p2cni.input b/test/implicit/2p2cni/test_cc2p2cni.input similarity index 96% rename from test/implicit/2p2cni/test_2p2cni.input rename to test/implicit/2p2cni/test_cc2p2cni.input index 452091098bba631f2dabe6ddc291c0319f313036..ae956e9d200be96c0fae246ad4104fe66aefa26a 100644 --- a/test/implicit/2p2cni/test_2p2cni.input +++ b/test/implicit/2p2cni/test_cc2p2cni.input @@ -14,7 +14,10 @@ TEnd = 1e4 # [s] [Grid] File = ./grids/test_2p2cni.dgf - + +[Problem] +Name = wateraircc + ############################################################### # Simulation restart # diff --git a/test/implicit/2p2cni/waterairproblem.hh b/test/implicit/2p2cni/waterairproblem.hh index b88a5141a66dd9f9d546b3cf721840446a57f39b..5d90179b232305f01a4ba87a6b76fbdc5027a8b4 100644 --- a/test/implicit/2p2cni/waterairproblem.hh +++ b/test/implicit/2p2cni/waterairproblem.hh @@ -45,8 +45,10 @@ class WaterAirProblem; namespace Properties { -NEW_TYPE_TAG(WaterAirProblem, INHERITS_FROM(BoxTwoPTwoCNI, WaterAirSpatialParams)); - +NEW_TYPE_TAG(WaterAirProblem, INHERITS_FROM(TwoPTwoCNI, WaterAirSpatialParams)); +NEW_TYPE_TAG(WaterAirBoxProblem, INHERITS_FROM(BoxModel, WaterAirProblem)); +NEW_TYPE_TAG(WaterAirCCProblem, INHERITS_FROM(CCModel, WaterAirProblem)); + // Set the grid type SET_PROP(WaterAirProblem, Grid) { @@ -148,6 +150,8 @@ class WaterAirProblem : public ImplicitPorousMediaProblem<TypeTag> typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; + enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; + public: /*! * \brief The constructor @@ -162,6 +166,8 @@ public: eps_ = 1e-6; FluidSystem::init(); + + name_ = GET_RUNTIME_PARAM(TypeTag, std::string, Problem.Name); } /*! @@ -174,8 +180,8 @@ public: * * This is used as a prefix for files generated by the simulation. */ - const char *name() const - { return "waterair"; } + const std::string name() const + { return name_; } #if ISOTHERMAL /*! @@ -211,12 +217,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] > 40 - eps_ || globalPos[0] < eps_) values.setAllDirichlet(); else @@ -232,14 +237,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); } @@ -264,9 +267,14 @@ public: const int scvIdx, const 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] > 15 && globalPos[0] < 25 && globalPos[1] < eps_) @@ -286,20 +294,13 @@ 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 fvGeometry 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 &fvGeometry, - int scvIdx) const + void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { - const GlobalPosition &globalPos = element.geometry().corner(scvIdx); - initial_(values, globalPos); #if !ISOTHERMAL @@ -338,6 +339,7 @@ private: Scalar maxDepth_; Scalar eps_; + std::string name_; }; } //end namespace