Commit d3791e4d authored by Santiago Ospina's avatar Santiago Ospina

Fixed adaptivity keywords in inifiles

Signed-off-by: Santiago Ospina De Los Ríos's avatarSantiago Ospina <santiago.ospina@iup.uni-heidelberg.de>
parent bcb1bd74
......@@ -107,8 +107,8 @@ adding an empty line, make text **bold** or ``monospaced``.
(h-adaptivity). If enabled, an unstructured grid manager with higher
computational cost is used when using rectangular / cubic grids.
Only one policy available at the moment.</definition>
<values> waterFlux </values>
<suggestion> waterFlux </suggestion>
<values> none, waterFlux </values>
<suggestion> none </suggestion>
</parameter>
<parameter name="maxLevel">
......
......@@ -24,13 +24,17 @@ namespace Setup
// move grid extensions into richards category (needed for reading parameters)
richards_ini["grid.extensions"] = ini["grid.extensions"];
const std::string adapt_policy_str = ini.get<std::string>("adaptivity.policy");
// copy adaptivity keywords into richards category
if (ini.get<std::string>("adaptivity.policy") == "waterFlux")
richards_ini.sub("richards.adaptivity") = ini.sub("adaptivity");
else
if (adapt_policy_str == "waterFlux") {
richards_ini.sub("adaptivity") = ini.sub("adaptivity");
} else if (adapt_policy_str != "none") {
DUNE_THROW(NotImplemented, "Not known adaptativity policy ("
<< ini.get<std::string>("adaptivity.policy") << ")!");
}
richards_ini.report(std::cout);
return richards_ini;
}
};
......
......@@ -110,14 +110,19 @@ int main(int argc, char** argv)
const std::string gtype = inifile.get<std::string>("grid.gridType");
const int dim = inifile.get<int>("grid.dimensions");
const int verbose = inifile.get<int>("output.verbose");
const bool adaptivity = inifile.get<bool>("adaptivity.useAdaptivity");
const std::string adapt_policy_str = inifile.get<std::string>("adaptivity.policy");
const int FEorder = richards_config.get<int>("numerics.FEorder");
const std::string outputPath = richards_config.get<std::string>("output.outputPath");
Dune::Dorie::AdaptivityPolicy adapt_policy =
Dune::Dorie::AdaptivityPolicy::None;
if (adaptivity) {
Dune::Dorie::AdaptivityPolicy adapt_policy;
if (adapt_policy_str == "none")
Dune::Dorie::AdaptivityPolicy adapt_policy =
Dune::Dorie::AdaptivityPolicy::None;
else if (adapt_policy_str == "waterFlux") {
adapt_policy = Dune::Dorie::AdaptivityPolicy::WaterFlux;
} else {
DUNE_THROW(Dune::NotImplemented,"The adaptivity policy " <<
adapt_policy_str << " is not implemented!");
}
// Attempt to create output directory
......@@ -165,7 +170,7 @@ int main(int argc, char** argv)
}
}
else if (gtype == "rectangular"){
if(adaptivity){
if (adapt_policy != Dune::Dorie::AdaptivityPolicy::None) {
Dune::Dorie::GridCreator<Dune::UGGrid<2>> grid_creator(inifile, helper);
auto grid_mapper = grid_creator.get_mapper();
switch(FEorder){
......@@ -248,7 +253,7 @@ int main(int argc, char** argv)
}
}
else if (gtype == "rectangular"){
if(adaptivity){
if(adapt_policy != Dune::Dorie::AdaptivityPolicy::None){
Dune::Dorie::GridCreator<Dune::UGGrid<3>> grid_creator(inifile, helper);
auto grid_mapper = grid_creator.get_mapper();
switch(FEorder){
......
......@@ -60,10 +60,22 @@ int main (int argc, char** argv)
// run test
// double result {0.0};
const auto adaptive = inifile.get<bool>("adaptivity.useAdaptivity");
const std::string adapt_policy_str = inifile.get<std::string>("adaptivity.policy");
Dune::Dorie::AdaptivityPolicy adapt_policy;
if (adapt_policy_str == "none")
Dune::Dorie::AdaptivityPolicy adapt_policy =
Dune::Dorie::AdaptivityPolicy::None;
else if (adapt_policy_str == "waterFlux") {
adapt_policy = Dune::Dorie::AdaptivityPolicy::WaterFlux;
} else {
DUNE_THROW(Dune::NotImplemented,"The adaptivity policy " <<
adapt_policy_str << " is not implemented!");
}
const auto grid_type = inifile.get<std::string>("grid.gridType");
if (grid_type == "rectangular") {
if (adaptive) {
if (adapt_policy != Dune::Dorie::AdaptivityPolicy::None) {
using TestSim = Dune::Dorie::ParameterizationTest<CubeAdaptive<2, 1>>;
Dune::Dorie::GridCreator<Dune::UGGrid<2>> grid_creator(inifile, helper);
auto grid_mapper = grid_creator.get_mapper();
......
......@@ -9,7 +9,7 @@ except NameError:
pass
# paths set by cmake
DORIEDIR = "/home/saospina/Codes/DUNE_INSTALL/Debug/dorie"
DORIEDIR = "/home/saospina/Codes/DUNE_INSTALL/Release/dorie"
MPIEXEC = "/usr/bin/mpiexec"
MPIEXEC_NUMPROC_FLAG = "-n"
MPIEXEC_PREFLAG = ""
......
......@@ -36,7 +36,7 @@ def evaluate(iniinfo,runtime):
print("Operating on files: {}, {}".format(vtks[-1].path,reference))
# demand equal grids when not using adaptivity
strict_compare = not text_to_bool(iniinfo["adaptivity.useAdaptivity"])
strict_compare = iniinfo["adaptivity.useAdaptivity"] == "none"
abstol = float(iniinfo["_abstol"]) if "_abstol" in iniinfo else None
reltol = float(iniinfo["_reltol"]) if "_reltol" in iniinfo else None
ret = fuzzy_compare_grid.compare(vtkfile_run.grid, vtkfile_ref.grid,
......
......@@ -13,7 +13,7 @@ _suffix = _static, _adapt | expand adaptive
limit = {_limit{_prefix}{_suffix}}
adaptivity.useAdaptivity = false, true | expand adaptive
adaptivity.policy = none, waterFlux | expand adaptive
adaptivity.maxLevel = 3
adaptivity.markingStrategy = threshold
adaptivity.refinementFraction = 5E-9
......
......@@ -12,8 +12,6 @@ grid.cells = 1 160, 1 40, 1 20 | expand prec
grid.mappingFile = none
grid.globalIndex = 0
adaptivity.useAdaptivity = false
[richards]
output.fileName = ode_homogeneous_sand | unique
......
......@@ -12,8 +12,6 @@ grid.cells = 1 160, 1 40, 1 20 | expand prec
grid.mappingFile = none
grid.globalIndex = 1
adaptivity.useAdaptivity = false
[richards]
output.fileName = ode_homogeneous_silt | unique
......
......@@ -12,8 +12,6 @@ grid.cells = 1 160, 1 40, 1 20 | expand prec
grid.mappingFile = "{_asset_path}/maps/cell_ids.h5"
grid.mappingFileDataset = ode_layered_160, ode_layered_40, ode_layered_20 | expand prec
adaptivity.useAdaptivity = false
[richards]
output.fileName = ode_layered | unique
......
......@@ -12,8 +12,6 @@ grid.extensions = 1 1
grid.mappingFile = "{_asset_path}/maps/cell_ids.h5"
grid.mappingFileDataset = parallel_reference_2d
adaptivity.useAdaptivity = false
[richards]
output.fileName = parallel_reference
......
......@@ -22,8 +22,6 @@ grid.extensions = 1 1
grid.mappingFile = "{_asset_path}/maps/cell_ids.h5"
grid.mappingFileDataset = parallel_reference_2d
adaptivity.useAdaptivity = false
[richards]
output.fileName = parallel_reference_compare | unique
......
......@@ -14,7 +14,7 @@ grid.cells = 20 20
grid.extensions = 1 1
grid.gridFile = "{_asset_path}/meshes/square.msh"
adaptivity.useAdaptivity = false
adaptivity.policy = none
adaptivity.threshold = 5E-8
adaptivity.refinementFraction = 0.05
adaptivity.maxLevel = 7
......
......@@ -13,7 +13,7 @@ grid.gridType = gmsh
grid.extensions = 1 1 1
grid.gridFile = "{_asset_path}/meshes/3dcube.msh"
adaptivity.useAdaptivity = false
adaptivity.policy = none
adaptivity.threshold = 1E-6
[richards]
......
......@@ -15,7 +15,7 @@ grid.cells = 20 20
grid.extensions = 1 1
grid.gridFile = "{_asset_path}/meshes/square.msh"
adaptivity.useAdaptivity = false
adaptivity.policy = none
adaptivity.threshold = 1E-7
[richards]
......
......@@ -15,7 +15,7 @@ grid.cells = 20 20
grid.extensions = 1 1
grid.gridFile = "{_asset_path}/meshes/square.msh"
adaptivity.useAdaptivity = true
adaptivity.policy = waterFlux
adaptivity.threshold = 7E-8
[richards]
......
......@@ -13,8 +13,6 @@ grid.extensions = 1 1
grid.mappingFile = None
grid.globalIndex = 0
adaptivity.useAdaptivity = false
[richards]
output.fileName = run | unique name
......
......@@ -54,17 +54,22 @@ int main (int argc, char** argv)
// run test
double result {0.0};
const auto adaptive = inifile.get<bool>("adaptivity.useAdaptivity");
const std::string adapt_policy_str = inifile.get<std::string>("adaptivity.policy");
const auto grid_type = inifile.get<std::string>("grid.gridType");
Dune::Dorie::AdaptivityPolicy adapt_policy =
Dune::Dorie::AdaptivityPolicy::None;
if (adaptive) {
Dune::Dorie::AdaptivityPolicy adapt_policy;
if (adapt_policy_str == "none")
Dune::Dorie::AdaptivityPolicy adapt_policy =
Dune::Dorie::AdaptivityPolicy::None;
else if (adapt_policy_str == "waterFlux") {
adapt_policy = Dune::Dorie::AdaptivityPolicy::WaterFlux;
} else {
DUNE_THROW(Dune::NotImplemented,"The adaptivity policy " <<
adapt_policy_str << " is not implemented!");
}
if (grid_type == "rectangular") {
if (adaptive) {
if (adapt_policy != Dune::Dorie::AdaptivityPolicy::None) {
using TestSim = Dune::Dorie::TestSimulation<CubeAdaptive<2, 1>>;
Dune::Dorie::GridCreator<Dune::UGGrid<2>> grid_creator(inifile, helper);
......
Markdown is supported
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