Commit 28113740 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[test][md] Fix freeFlow-darcy convergence test

* use unique names for log files
parent 921757a2
......@@ -10,6 +10,7 @@ dune_add_test(NAME test_md_boundary_darcy1p_stokes1p_convtest
CMAKE_GUARD HAVE_UMFPACK
COMMAND ./convergencetest.py
CMD_ARGS test_md_boundary_darcy1p_freeflow1p_convtest params.input
-Problem.TestCase ShiueExampleTwo
-Darcy.SpatialParams.Permeability 1.0)
dune_add_test(NAME test_md_boundary_darcy1p_navierstokes1p_convtest
......
......@@ -8,8 +8,9 @@ if len(sys.argv) < 2:
sys.stderr.write('Please provide a single argument <testname> to the script\n')
sys.exit(1)
testname = str(sys.argv[1])
executableName = str(sys.argv[1])
testargs = [str(i) for i in sys.argv][2:]
testname = testargs[testargs.index('-Problem.TestCase')+1]
# remove the old log files
subprocess.call(['rm', testname + '_freeFlow.log'])
......@@ -19,8 +20,7 @@ print("Removed old log file ({})!".format(testname + '_darcy.log'))
# do the runs with different refinement
for i in [0, 1, 2]:
subprocess.call(['./' + testname] + testargs + ['-Grid.Refinement', str(i),
'-Vtk.OutputName', testname])
subprocess.call(['./' + executableName] + testargs + ['-Grid.Refinement', str(i)])
def checkRatesFreeFlow():
# check the rates and append them to the log file
......
......@@ -289,26 +289,26 @@ int main(int argc, char** argv) try
constexpr auto darcyIdx = CouplingManager::darcyIdx;
// the problem (initial and boundary conditions)
const auto testCase = []()
const auto testCaseName = getParam<std::string>("Problem.TestCase");
const auto testCase = [&testCaseName]()
{
const auto testCaseInput = getParam<std::string>("Problem.TestCase", "ShiueExampleTwo");
if (testCaseInput == "ShiueExampleOne")
if (testCaseName == "ShiueExampleOne")
return TestCase::ShiueExampleOne;
else if (testCaseInput == "ShiueExampleTwo")
else if (testCaseName == "ShiueExampleTwo")
return TestCase::ShiueExampleTwo;
else if (testCaseInput == "Rybak")
else if (testCaseName == "Rybak")
return TestCase::Rybak;
else if (testCaseInput == "Schneider")
else if (testCaseName == "Schneider")
return TestCase::Schneider;
else
DUNE_THROW(Dune::InvalidStateException, testCaseInput + " is not a valid test case");
DUNE_THROW(Dune::InvalidStateException, testCaseName + " is not a valid test case");
}();
using FreeFlowProblem = GetPropType<FreeFlowTypeTag, Properties::Problem>;
auto freeFlowProblem = std::make_shared<FreeFlowProblem>(freeFlowGridGeometry, couplingManager, testCase);
auto freeFlowProblem = std::make_shared<FreeFlowProblem>(freeFlowGridGeometry, couplingManager, testCase, testCaseName);
using DarcyProblem = GetPropType<DarcyTypeTag, Properties::Problem>;
auto spatialParams = std::make_shared<typename DarcyProblem::SpatialParams>(darcyGridGeometry, testCase);
auto darcyProblem = std::make_shared<DarcyProblem>(darcyGridGeometry, couplingManager, spatialParams, testCase);
auto darcyProblem = std::make_shared<DarcyProblem>(darcyGridGeometry, couplingManager, spatialParams, testCase, testCaseName);
// the solution vector
Traits::SolutionVector sol;
......
......@@ -17,9 +17,6 @@ Name = darcy
[Darcy.SpatialParams]
AlphaBeaversJoseph = 1.0
[Vtk]
OutputName = test_md_boundary_freeflow1p_darcy1p_convergencetest
[Problem]
EnableGravity = false
......
......@@ -108,12 +108,13 @@ public:
DarcySubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
std::shared_ptr<CouplingManager> couplingManager,
std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
const TestCase testCase)
const TestCase testCase,
const std::string& name)
: ParentType(gridGeometry, spatialParams, "Darcy")
, couplingManager_(couplingManager)
, testCase_(testCase)
{
problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
problemName_ = name + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
}
/*!
......
......@@ -96,12 +96,15 @@ public:
//! export the Indices
using Indices = typename ModelTraits::Indices;
FreeFlowSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<CouplingManager> couplingManager, const TestCase testCase)
FreeFlowSubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
std::shared_ptr<CouplingManager> couplingManager,
const TestCase testCase,
const std::string& name)
: ParentType(gridGeometry, "FreeFlow")
, couplingManager_(couplingManager)
, testCase_(testCase)
{
problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
problemName_ = name + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
}
/*!
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment