Skip to content
Snippets Groups Projects
Commit 870f8348 authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

Merge branch 'fix/generallensproblem' into 'master'

Fix/generallensproblem

Use the parameter macro instead of the tree directly.

See merge request !19
parents 01642b1f 9d811602
No related branches found
No related tags found
1 merge request!31Feature/colebrookwhiteboundarylayer
......@@ -5,27 +5,21 @@ add_dumux_test(test_general_box test_general test_generalproblem2p.cc
--script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/generallens_box-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/generallens_box-00003.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_general
-ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/test_generalproblem2p_reference.input
-ModelType Box")
--command "${CMAKE_CURRENT_BINARY_DIR}/test_general -ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/test_generalproblem2p_reference.input -ModelType box")
add_dumux_test(test_general_cc test_general test_generalproblem2p.cc
python ${CMAKE_SOURCE_DIR}/bin/runtest.py
--script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/generallens_cc-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/generallens_cc-00003.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_general
-ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/test_generalproblem2p_reference.input
-ModelType CC")
--command "${CMAKE_CURRENT_BINARY_DIR}/test_general -ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/test_generalproblem2p_reference.input -ModelType cc")
add_dumux_test(test_general_dec test_general test_generalproblem2p.cc
python ${CMAKE_SOURCE_DIR}/bin/runtest.py
--script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/generallens_decoupled-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/generallens_decoupled-00003.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_general
-ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/test_generalproblem2p_reference.input
-ModelType Decoupled")
--command "${CMAKE_CURRENT_BINARY_DIR}/test_general -ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/test_generalproblem2p_reference.input -ModelType decoupled")
#install sources
install(FILES
......
......@@ -27,9 +27,6 @@
#define DUMUX_GENERALLENSPROBLEM_HH
//common includes
#include <dune/grid/yaspgrid.hh>
#include <dumux/io/cubegridcreator.hh>
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/material/components/dnapl.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
......@@ -66,9 +63,6 @@ NEW_PROP_TAG(ProblemBaseClass);
// Set the grid type
SET_TYPE_PROP(GeneralLensProblem, Grid, Dune::YaspGrid<2>);
// set the GridCreator property
SET_TYPE_PROP(GeneralLensProblem, GridCreator, CubeGridCreator<TypeTag>);
// Set the problem property
SET_TYPE_PROP(GeneralLensProblem, Problem, Dumux::GeneralLensProblem<TypeTag>);
......@@ -195,8 +189,6 @@ class GeneralLensProblem : public GET_PROP_TYPE(TypeTag, ProblemBaseClass)
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP(TypeTag, ParameterTree) ParameterTree;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
......@@ -207,8 +199,7 @@ public:
* \param timeManager The time manager
* \param gridView The grid view
*/
GeneralLensProblem(TimeManager &timeManager,
const GridView &gridView)
GeneralLensProblem(TimeManager &timeManager, const GridView &gridView)
: ParentType(timeManager, gridView)
{
eps_ = 3e-6;
......@@ -249,17 +240,9 @@ public:
*
* This is used as a prefix for files generated by the simulation.
*/
const char *name() const
const std::string name() const
{
if (ParameterTree::tree().hasKey("Problem.OutputfileName"))
{
std::string fileName(GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Problem, OutputfileName));
return fileName.c_str();
}
else
{
return "test_generalproblem2p";
}
return "generallens_" + GET_RUNTIME_PARAM(TypeTag, std::string, ModelType);
}
/*!
......@@ -282,7 +265,7 @@ public:
*/
Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
{
return 1e5; // -> 10°C
return 1.0e5; // -> 1 bar
}
/*! \brief Returns the source term
......@@ -394,7 +377,7 @@ public:
const GlobalPosition &globalPos) const
{
Scalar depth = this->bBoxMax()[1] - globalPos[1];
Scalar densityW = WettingPhase::density(temperature_, /*pressure=*/1e5);
Scalar densityW = WettingPhase::density(temperature_, /*pressure=*/1.0e5);
// hydrostatic pressure
values[pwIdx] = 1e5 - densityW*this->gravity()[1]*depth;
......@@ -429,7 +412,7 @@ private:
{
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;
return onUpperBoundary_(globalPos) && 0.5 < lambda + eps_ && lambda < 2.0/3.0 + eps_;
}
Scalar temperature_;
......
......@@ -89,12 +89,10 @@ public:
typedef typename MaterialLaw::Params MaterialLawParams;
GeneralLensSpatialParams(const GridView& gridView)
: ParentType(gridView)
: ParentType(gridView), eps_(3e-6)
{
lensLowerLeft_[0] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensLowerLeftX);
lensLowerLeft_[1] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensLowerLeftY);
lensUpperRight_[0] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensUpperRightX);
lensUpperRight_[1] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensUpperRightY);
lensLowerLeft_ = GET_RUNTIME_PARAM(TypeTag, GlobalPosition, SpatialParams.LensLowerLeft);
lensUpperRight_ = GET_RUNTIME_PARAM(TypeTag, GlobalPosition, SpatialParams.LensUpperRight);
// residual saturations
lensMaterialParams_.setSwr(0.18);
......@@ -109,10 +107,12 @@ public:
outerMaterialParams_.setVgAlpha(0.0037);
outerMaterialParams_.setVgn(4.7);
// initialize with zero
lensK_ = 0.0; outerK_ = 0.0;
for (int i=0; i < dim; i++)
{
lensK_[i][i] = 9.05e-12;
outerK_[i][i] = 4.6e-10;
lensK_[i][i] = 9.05e-12;
outerK_[i][i] = 4.6e-10;
}
}
......@@ -155,10 +155,10 @@ public:
private:
bool isInLens_(const GlobalPosition &globalPos) const
{
for (int i = 0; i < dim; ++i) {
if (globalPos[i] < lensLowerLeft_[i] || globalPos[i] > lensUpperRight_[i])
for (int i = 0; i < dim; ++i)
if (globalPos[i] < lensLowerLeft_[i] + eps_ || globalPos[i] > lensUpperRight_[i])
return false;
}
return true;
}
......@@ -170,6 +170,8 @@ private:
MaterialLawParams lensMaterialParams_;
MaterialLawParams outerMaterialParams_;
const Scalar eps_;
};
} // end namespace
......
......@@ -40,12 +40,10 @@ void usage(const char *progName, const std::string &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-Grid.NumberOfCellsX Resolution in x-direction [-]\n"
"\t-Grid.NumberOfCellsY Resolution in y-direction [-]\n"
"\t-Grid.UpperRightX Dimension of the grid [m]\n"
"\t-Grid.UpperRightY Dimension of the grid [m]\n";
"\t-Grid.Cells Number of cells in (x,y)-direction [-]\n"
"\t-Grid.UpperRight Coordinates of upper right grid corner [m]\n";
errorMessageOut += "\n\nThe Optional command line argument:\n"
"\t-ModelType Can be: Box (2p box model), Decoupled (2p impes model),\n";
"\t-ModelType Can be: box (2p box model, default), cc (2p cc model), decoupled (2p impes model)\n";
std::cout << errorMessageOut << "\n";
}
}
......@@ -54,76 +52,34 @@ int main(int argc, char** argv)
{
Dune::ParameterTree paramTree;
std::string s(Dumux::readOptions_(argc, argv, paramTree));
if (s.empty())
if (s.empty()) // everything was read correctly
{
if (paramTree.hasKey("ModelType"))
// default model type is box
const std::string modelType(paramTree.get<std::string>("ModelType", "box"));
if (modelType == "box")
{
std::string modelType(paramTree.get<std::string>("ModelType"));
if (modelType == "Box")
{
typedef TTAG(BoxGeneralLensProblem) ProblemTypeTag;
typedef GET_PROP(ProblemTypeTag, ParameterTree) ParamTree;
Dune::ParameterTree &rt = ParamTree::runTimeParams();
rt["ModelType"]=modelType;
ParamTree::tree()["Problem.OutputfileName"] = "generallens_box";
int startReturn = Dumux::start<ProblemTypeTag>(argc, argv, usage);
std::cout<<"######################################################\n";
std::cout<<"Used box 2p model\n";
return startReturn;
}
else if (modelType == "CC")
{
typedef TTAG(CCGeneralLensProblem) ProblemTypeTag;
typedef GET_PROP(ProblemTypeTag, ParameterTree) ParamTree;
Dune::ParameterTree &rt = ParamTree::runTimeParams();
rt["ModelType"]=modelType;
ParamTree::tree()["Problem.OutputfileName"] = "generallens_cc";
int startReturn = Dumux::start<ProblemTypeTag>(argc, argv, usage);
std::cout<<"######################################################\n";
std::cout<<"Used cc 2p model\n";
return startReturn;
}
else if (modelType == "Decoupled")
{
typedef TTAG(DecoupledGeneralLensProblem) ProblemTypeTag;
typedef GET_PROP(ProblemTypeTag, ParameterTree) ParamTree;
Dune::ParameterTree &rt = ParamTree::runTimeParams();
rt["ModelType"]=modelType;
ParamTree::tree()["Problem.OutputfileName"] = "generallens_decoupled";
int startReturn = Dumux::start<ProblemTypeTag>(argc, argv, usage);
std::cout<<"######################################################\n";
std::cout<<"Used decoupled 2p model\n";
return startReturn;
}
else
{
typedef TTAG(BoxGeneralLensProblem) ProblemTypeTag;
int startReturn = Dumux::start<ProblemTypeTag>(argc, argv, usage);
std::cout<<"######################################################\n";
std::cout<<"Unknwon model type "<<modelType<<" specified\n";
std::cout<<"Default to box model\n";
return startReturn;
}
typedef TTAG(BoxGeneralLensProblem) ProblemTypeTag;
GET_PROP(ProblemTypeTag, ParameterTree)::runTimeParams()["ModelType"] = "box";
return Dumux::start<ProblemTypeTag>(argc, argv, usage);
}
else if (modelType == "cc")
{
typedef TTAG(CCGeneralLensProblem) ProblemTypeTag;
return Dumux::start<ProblemTypeTag>(argc, argv, usage);
}
else if (modelType == "decoupled")
{
typedef TTAG(DecoupledGeneralLensProblem) ProblemTypeTag;
return Dumux::start<ProblemTypeTag>(argc, argv, usage);
}
else
{
typedef TTAG(BoxGeneralLensProblem) ProblemTypeTag;
int startReturn = Dumux::start<ProblemTypeTag>(argc, argv, usage);
std::cout<<"######################################################\n";
std::cout<<"No model type specified\n";
std::cout<<"Default to box model\n";
return startReturn;
Dumux::ParameterException e("Unknown ModelType: " + modelType);
std::cerr << e << ". Abort!" << std::endl
<< "ModelType can be: box (2p box model), cc (2p cc model), decoupled (2p impes model)" << std::endl;
exit(1);
}
}
else
{
typedef TTAG(BoxGeneralLensProblem) ProblemTypeTag;
int startReturn = Dumux::start<ProblemTypeTag>(argc, argv, usage);
std::cout<<"######################################################\n";
std::cout<<s<<" is not a valid model type specification!\n";
std::cout<<"Default to box model\n";
return startReturn;
}
DUNE_THROW(Dumux::ParameterException, "Unknown command line option " << s);
}
......@@ -3,17 +3,12 @@ DtInitial = 250 # [s]
TEnd = 3000 # [s]
[Grid]
NumberOfCellsX = 48 # [-] level 0 resolution in x-direction
NumberOfCellsY = 32 # [-] level 0 resolution in y-direction
UpperRightX = 6 # [m] dimension of the grid
UpperRightY = 4 # [m] dimension of the grid
UpperRight = 6 4 # upper right corner coordinates [m]
Cells = 48 32 # number of cells in (x, y)-direction [-]
[SpatialParams]
LensLowerLeftX = 1.0 # [m] x-coordinate of the lower left lens corner
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
LensLowerLeft = 1.0 2.0 # coordinates of the lower left lens corner [m]
LensUpperRight = 4.0 3.0 # coordinates of the upper right lens corner [m]
[Vtk]
OutputLevel = 1
......
......@@ -3,17 +3,12 @@ DtInitial = 2e1 # [s]
TEnd = 1e2 # [s]
[Grid]
NumberOfCellsX = 48 # [-] level 0 resolution in x-direction
NumberOfCellsY = 32 # [-] level 0 resolution in y-direction
UpperRightX = 6 # [m] dimension of the grid
UpperRightY = 4 # [m] dimension of the grid
UpperRight = 6 4 # upper right corner coordinates [m]
Cells = 48 32 # number of cells in (x, y)-direction [-]
[SpatialParams]
LensLowerLeftX = 1.0 # [m] x-coordinate of the lower left lens corner
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
LensLowerLeft = 1.0 2.0 # coordinates of the lower left lens corner [m]
LensUpperRight = 4.0 3.0 # coordinates of the upper right lens corner [m]
[Vtk]
OutputLevel = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment