Commit f48e5e23 authored by Santiago Ospina's avatar Santiago Ospina

use of sub inifiles instead of "richards." keywords

Signed-off-by: Santiago Ospina De Los Ríos's avatarSantiago Ospina <santiago.ospina@iup.uni-heidelberg.de>
parent b9c41599
......@@ -105,13 +105,20 @@ int main(int argc, char** argv)
sleep(5);
}
// move grid extensions into richards category (needed for reading parameters)
inifile["richards.grid.extensions"] = inifile["grid.extensions"];
// configure a global verbose level
inifile["output.verbose"] = inifile["richards.output.verbose"];
// extract richards configuration
Dune::ParameterTree richards_config = inifile.sub("richards");
// Read necessary variables
const std::string gtype = inifile.get<std::string>("grid.gridType");
const int dim = inifile.get<int>("grid.dimensions");
const int FEorder = inifile.get<int>("richards.numerics.FEorder");
const int verbose = inifile.get<int>("richards.output.verbose");
const std::string outputPath = inifile.get<std::string>("richards.output.outputPath");
const int verbose = inifile.get<int>("output.verbose");
const bool adaptivity = inifile.get<bool>("adaptivity.useAdaptivity");
const int FEorder = richards_config.get<int>("numerics.FEorder");
const std::string outputPath = richards_config.get<std::string>("output.outputPath");
// Attempt to create output directory
mkdir(outputPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
......@@ -121,8 +128,8 @@ int main(int argc, char** argv)
if (helper.rank()==0){
std::cout << "INPUT FILE: " << inifilename << std::endl;
std::cout << "BC FILE: " << inifile.get<std::string>("richards.boundary.file") << std::endl;
std::cout << "OUTPUT PATH: " << inifile.get<std::string>("richards.output.outputPath") << std::endl;
std::cout << "BC FILE: " << richards_config.get<std::string>("boundary.file") << std::endl;
std::cout << "OUTPUT PATH: " << richards_config.get<std::string>("output.outputPath") << std::endl;
if (verbose>0){
if(Dune::MPIHelper::isFake) std::cout << "MPI: SEQUENTIAL RUN" << std::endl;
else std::cout << "MPI: PARALLEL RUN ON " << helper.size() << " PROCESS(ES)" << std::endl;
......@@ -132,21 +139,21 @@ int main(int argc, char** argv)
if (dim==2)
{
if (gtype == "gmsh"){
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile,helper);
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(richards_config,helper);
if(adaptivity){
switch(FEorder){
case 1:{
Sim<SimplexAdaptive<2,1>> sim(helper,grid,inifile);
Sim<SimplexAdaptive<2,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<SimplexAdaptive<2,2>> sim(helper,grid,inifile);
Sim<SimplexAdaptive<2,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<SimplexAdaptive<2,3>> sim(helper,grid,inifile);
Sim<SimplexAdaptive<2,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......@@ -157,17 +164,17 @@ int main(int argc, char** argv)
else{ // no adaptivity
switch(FEorder){
case 1:{
Sim<Simplex<2,1>> sim(helper,grid,inifile);
Sim<Simplex<2,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<Simplex<2,2>> sim(helper,grid,inifile);
Sim<Simplex<2,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<Simplex<2,3>> sim(helper,grid,inifile);
Sim<Simplex<2,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......@@ -181,17 +188,17 @@ int main(int argc, char** argv)
auto grid = Dune::Dorie::build_grid_cube<Dune::UGGrid<2>>(inifile,helper);
switch(FEorder){
case 1:{
Sim<CubeAdaptive<2,1>> sim(helper,grid,inifile);
Sim<CubeAdaptive<2,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<CubeAdaptive<2,2>> sim(helper,grid,inifile);
Sim<CubeAdaptive<2,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<CubeAdaptive<2,3>> sim(helper,grid,inifile);
Sim<CubeAdaptive<2,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......@@ -203,17 +210,17 @@ int main(int argc, char** argv)
auto grid = Dune::Dorie::build_grid_cube<Dune::YaspGrid<2>>(inifile,helper);
switch(FEorder){
case 1:{
Sim<Cube<2,1>> sim(helper,grid,inifile);
Sim<Cube<2,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<Cube<2,2>> sim(helper,grid,inifile);
Sim<Cube<2,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<Cube<2,3>> sim(helper,grid,inifile);
Sim<Cube<2,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......@@ -233,17 +240,17 @@ int main(int argc, char** argv)
if(adaptivity){
switch(FEorder){
case 1:{
Sim<SimplexAdaptive<3,1>> sim(helper,grid,inifile);
Sim<SimplexAdaptive<3,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<SimplexAdaptive<3,2>> sim(helper,grid,inifile);
Sim<SimplexAdaptive<3,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<SimplexAdaptive<3,3>> sim(helper,grid,inifile);
Sim<SimplexAdaptive<3,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......@@ -254,17 +261,17 @@ int main(int argc, char** argv)
else{ // no adaptivity
switch(FEorder){
case 1:{
Sim<Simplex<3,1>> sim(helper,grid,inifile);
Sim<Simplex<3,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<Simplex<3,2>> sim(helper,grid,inifile);
Sim<Simplex<3,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<Simplex<3,3>> sim(helper,grid,inifile);
Sim<Simplex<3,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......@@ -278,17 +285,17 @@ int main(int argc, char** argv)
auto grid = Dune::Dorie::build_grid_cube<Dune::UGGrid<3>>(inifile,helper);
switch(FEorder){
case 1:{
Sim<CubeAdaptive<3,1>> sim(helper,grid,inifile);
Sim<CubeAdaptive<3,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<CubeAdaptive<3,2>> sim(helper,grid,inifile);
Sim<CubeAdaptive<3,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<CubeAdaptive<3,3>> sim(helper,grid,inifile);
Sim<CubeAdaptive<3,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......@@ -300,17 +307,17 @@ int main(int argc, char** argv)
auto grid = Dune::Dorie::build_grid_cube<Dune::YaspGrid<3>>(inifile,helper);
switch(FEorder){
case 1:{
Sim<Cube<3,1>> sim(helper,grid,inifile);
Sim<Cube<3,1>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 2:{
Sim<Cube<3,2>> sim(helper,grid,inifile);
Sim<Cube<3,2>> sim(helper,grid,richards_config);
sim.run();
break;
}
case 3:{
Sim<Cube<3,3>> sim(helper,grid,inifile);
Sim<Cube<3,3>> sim(helper,grid,richards_config);
sim.run();
break;
}
......
......@@ -100,7 +100,7 @@ public:
alpha(inifile.get<float>("adaptivity.refinementFraction")),
beta(inifile.get<float>("adaptivity.coarseningFraction")),
adaptivityThreshold(inifile.get<float>("adaptivity.threshold")),
verbose(inifile.get<int>("richards.output.verbose")),
verbose(inifile.get<int>("output.verbose")),
total_time(0.)
{
if(strategy!="elementFraction" && strategy!="errorFraction" && strategy!="threshold")
......
......@@ -8,8 +8,8 @@ RichardsSimulation<Traits>::RichardsSimulation (Dune::MPIHelper& _helper, std::s
helper(_helper), grid(_grid), inifile(_inifile), gv(grid->leafGridView()),
mbe_slop(estimate_mbe_entries<typename MBE::size_type>(Traits::dim,Traits::GridGeometryType)),
mbe_tlop(1),
verbose(inifile.get<int>("richards.output.verbose")),
output_type(_inifile.get<bool>("richards.output.asciiVtk") ? Dune::VTK::OutputType::ascii : Dune::VTK::OutputType::base64)
verbose(inifile.get<int>("output.verbose")),
output_type(_inifile.get<bool>("output.asciiVtk") ? Dune::VTK::OutputType::ascii : Dune::VTK::OutputType::base64)
{
Dune::Timer timer;
const int verbose_low = helper.rank() == 0 ? verbose : 0;
......@@ -51,7 +51,7 @@ RichardsSimulation<Traits>::RichardsSimulation (Dune::MPIHelper& _helper, std::s
#endif // EXPERIMENTAL_DG_FEATURES
tlop = std::make_unique<TLOP>(inifile, *fparam, gv);
controller = std::make_unique<CalculationController>(inifile.sub("richards"),*fboundary,helper);
controller = std::make_unique<CalculationController>(inifile,*fboundary,helper);
// --- Solution Vectors and Initial Condition ---
u = std::make_shared<U>(*gfs,.0);
......@@ -63,14 +63,14 @@ RichardsSimulation<Traits>::RichardsSimulation (Dune::MPIHelper& _helper, std::s
// --- Utility Class Setup --- //
if constexpr (Traits::write_output)
{
const int subsamling_lvl = _inifile.get<int>("richards.output.subsamplingLevel", 0);
const int subsamling_lvl = _inifile.get<int>("output.subsamplingLevel", 0);
const auto subsamling_intervals = Dune::refinementLevels(subsamling_lvl);
auto subsamling_vtk = std::make_shared<Dune::SubsamplingVTKWriter<GV>>(gv,
subsamling_intervals);
vtkwriter = std::make_unique<Writer>(subsamling_vtk,
inifile.get<std::string>("richards.output.fileName"),
inifile.get<std::string>("richards.output.outputPath"),
inifile.get<std::string>("output.fileName"),
inifile.get<std::string>("output.outputPath"),
"./");
}
......@@ -96,7 +96,7 @@ void RichardsSimulation<Traits>::operator_setup ()
ls = std::make_unique<LS>(*igo,*cc,*lsgfs,*lscc,1000,0,true,true);
pdesolver = std::make_unique<PDESOLVER>(*igo,*ls);
pdesolver->setParameters(inifile.sub("richards.NewtonParameters"));
pdesolver->setParameters(inifile.sub("NewtonParameters"));
pdesolver->setVerbosityLevel(verbose);
// --- Time Step Operators ---
......@@ -213,7 +213,7 @@ void RichardsSimulation<Traits>::write_data (RF time)
if constexpr (Traits::write_output)
{
update_adapters();
if (inifile.get<bool>("richards.output.vertexData")) {
if (inifile.get<bool>("output.vertexData")) {
vtkwriter->addVertexData(udgf,"head");
vtkwriter->addVertexData(fluxdgf,"flux");
vtkwriter->addVertexData(condgf,"K_0");
......
......@@ -79,7 +79,7 @@ inline auto read_experimental_operator_settings(
RichardsDGUpwinding::Type upwinding;
RichardsDGWeights::Type weights;
const auto method_str = inifile.get<std::string>("richards.numerics.experimental.method");
const auto method_str = inifile.get<std::string>("numerics.experimental.method");
if (method_str == "SIPG")
method = RichardsDGMethod::SIPG;
else if (method_str == "NIPG")
......@@ -92,7 +92,7 @@ inline auto read_experimental_operator_settings(
DUNE_THROW(Dune::IOError, "Unknown DG method '" + method_str + "'!");
const auto upwinding_str
= inifile.get<std::string>("richards.numerics.experimental.upwinding");
= inifile.get<std::string>("numerics.experimental.upwinding");
if (upwinding_str == "none")
upwinding = RichardsDGUpwinding::none;
else if (upwinding_str == "semiUpwind")
......@@ -102,7 +102,7 @@ inline auto read_experimental_operator_settings(
else
DUNE_THROW(Dune::IOError, "Unknown upwinding '" + upwinding_str + "'!");
const auto weights_str = inifile.get<bool>("richards.numerics.experimental.weights");
const auto weights_str = inifile.get<bool>("numerics.experimental.weights");
if (weights_str)
weights = RichardsDGWeights::weightsOn;
else
......@@ -205,7 +205,7 @@ public:
param(param_), boundary(boundary_), sourceTerm(sourceTerm_), method(method_), upwinding(upwinding_), weights(weights_),
mapper(view_, Dune::mcmgElementLayout()),
intorderadd(intorderadd_), quadrature_factor(quadrature_factor_),
penalty_factor(config.get<RF>("richards.numerics.penaltyFactor")),
penalty_factor(config.get<RF>("numerics.penaltyFactor")),
time(0.0),
cache(20)
{
......
......@@ -67,7 +67,7 @@ namespace Dune {
int intorderadd_ = 2, int quadrature_factor_ = 2)
: param(param_), boundary(boundary_),
intorderadd(intorderadd_), quadrature_factor(quadrature_factor_),
penalty_factor(config.get<RF>("richards.numerics.penaltyFactor")),
penalty_factor(config.get<RF>("numerics.penaltyFactor")),
time(0.0)
{
if (method_ == RichardsDGMethod::OOB)
......
......@@ -120,8 +120,8 @@ namespace Dune {
, millerSimilarity(h5file.read_attribute<bool>("millerSimilarity","parameters"))
, variance(h5file.read_attribute<RF>("variance","parameters"))
, grid_extensions(config.get<Domain>("grid.extensions"))
, scale(config.get<Domain>("richards.parameters.scale"))
, offset(config.get<Domain>("richards.parameters.offset"))
, scale(config.get<Domain>("parameters.scale"))
, offset(config.get<Domain>("parameters.offset"))
, millerField("raw_field")
{
gVector=0;
......
......@@ -37,8 +37,8 @@ namespace Dune {
Interpolator& interpolator_,
const int verbose_)
: config(config_), helper(helper_), interpolator(interpolator_), verbose(verbose_)
, arrayPath(config.get<std::string>("richards.parameters.arrayFile"))
, interpMethod(config.get<std::string>("richards.parameters.interpolation"))
, arrayPath(config.get<std::string>("parameters.arrayFile"))
, interpMethod(config.get<std::string>("parameters.interpolation"))
, h5array(arrayPath,verbose)
, parType(h5array.read_attribute<std::string>("parameterization","parameters"))
{}
......
......@@ -40,9 +40,9 @@ namespace Dune{
*/
FlowBoundary(const Dune::ParameterTree& config)
{
std::string bcFileType = config.get<std::string>("richards.boundary.fileType");
std::string bcFileType = config.get<std::string>("boundary.fileType");
if(bcFileType == "rectangularGrid") {
bcDataHandler = std::make_unique<RectangularGrid<Traits>>(config,"richards");
bcDataHandler = std::make_unique<RectangularGrid<Traits>>(config);
}
else
DUNE_THROW(IOError,"unknown bcFileType specified!");
......
......@@ -40,9 +40,9 @@ namespace Dune {
/** \throw Dune::IOError BC File Type not supported
*/
FlowInitial (const Dune::ParameterTree& config, const typename T::GridView& gv)
: initialCondition(config.get<std::string>("richards.initial.condition"))
, constGrad(config.get<typename T::RangeField>("richards.initial.headGradient"))
, constLower(config.get<typename T::RangeField>("richards.initial.headLower"))
: initialCondition(config.get<std::string>("initial.condition"))
, constGrad(config.get<typename T::RangeField>("initial.headGradient"))
, constLower(config.get<typename T::RangeField>("initial.headLower"))
, g(gv)
, hydrEquilibrium(false), gravityFlow(false)
{
......
......@@ -120,13 +120,13 @@ namespace Dorie{
/// Read necessary parameters. Then read out BC data file with rectangular boundary decomposition.
/** \throw Dune::IOError BC File path not specified
*/
RectangularGrid (const ParameterTree& config, std::string model)
RectangularGrid (const ParameterTree& config)
: BCReadoutInterface<Traits>()
, extensions(config.get<Domain>("grid.extensions"))
, bcFilePath(config.get<std::string>(model + ".boundary.file"))
, tStart(config.get<RF>(model + ".time.start"))
, tEnd(config.get<RF>(model + ".time.end"))
, interpolate(config.get<bool>(model + ".boundary.interpolateBCvalues"))
, bcFilePath(config.get<std::string>("boundary.file"))
, tStart(config.get<RF>("time.start"))
, tEnd(config.get<RF>("time.end"))
, interpolate(config.get<bool>("boundary.interpolateBCvalues"))
, eps(1e-8)
{
// Check if bcFilePath is specified
......
......@@ -85,7 +85,7 @@ std::shared_ptr<GridType> build_grid_gmsh (const Dune::ParameterTree& inifile, c
Dune::Timer timer;
ios_base_all_saver restore(std::cout);
enum { dim = GridType::dimension };
const int verbose = inifile.get<int>("richards.output.verbose");
const int verbose = inifile.get<int>("output.verbose");
const int level = inifile.get<int>("grid.initialLevel");
const std::string meshfilename = inifile.get<std::string>("grid.gridFile");
......
......@@ -520,7 +520,7 @@ namespace Dune {
explicit InterpolatorFactory(const ParameterTree& config_,
const Dune::MPIHelper& helper_, const int verbose_)
: config(config_), helper(helper_), verbose(verbose_)
, interpMethod(config.get<std::string>("richards.parameters.interpolation"))
, interpMethod(config.get<std::string>("parameters.interpolation"))
{}
std::unique_ptr<IB> create()
......
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