Commit 37153005 authored by Santiago Ospina's avatar Santiago Ospina

allow richards simulation to be instantiated for raviart thomas elements that exist in dune

parent 90a083bc
......@@ -142,12 +142,12 @@ int main(int argc, char** argv)
sim.run();
break;
}
// case 2:{
// Sim<Simplex<2,2>> sim(helper,grid,inifile);
// sim.set_policy(adapt_policy);
// sim.run();
// break;
// }
case 2:{
Sim<Simplex<2,2>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
// case 3:{
// Sim<Simplex<2,3>> sim(helper,grid,inifile);
// sim.set_policy(adapt_policy);
......@@ -168,18 +168,18 @@ int main(int argc, char** argv)
sim.run();
break;
}
// case 2:{
// Sim<CubeAdaptive<2,2>> sim(helper,grid,inifile);
// sim.set_policy(adapt_policy);
// sim.run();
// break;
// }
// case 3:{
// Sim<CubeAdaptive<2,3>> sim(helper,grid,inifile);
// sim.set_policy(adapt_policy);
// sim.run();
// break;
// }
case 2:{
Sim<CubeAdaptive<2,2>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 3:{
Sim<CubeAdaptive<2,3>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
}
......@@ -187,21 +187,21 @@ int main(int argc, char** argv)
else{ // no adaptivity
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.run();
// break;
// }
// case 2:{
// Sim<Cube<2,2>> sim(helper,grid,inifile);
// sim.run();
// break;
// }
// case 3:{
// Sim<Cube<2,3>> sim(helper,grid,inifile);
// sim.run();
// break;
// }
case 1:{
Sim<Cube<2,1>> sim(helper,grid,inifile);
sim.run();
break;
}
case 2:{
Sim<Cube<2,2>> sim(helper,grid,inifile);
sim.run();
break;
}
case 3:{
Sim<Cube<2,3>> sim(helper,grid,inifile);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
}
......@@ -242,18 +242,18 @@ int main(int argc, char** argv)
if(adaptivity){
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.set_policy(adapt_policy);
// sim.run();
// break;
// }
// case 2:{
// Sim<CubeAdaptive<3,2>> sim(helper,grid,inifile);
// sim.set_policy(adapt_policy);
// sim.run();
// break;
// }
case 1:{
Sim<CubeAdaptive<3,1>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 2:{
Sim<CubeAdaptive<3,2>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
// case 3:{
// Sim<CubeAdaptive<3,3>> sim(helper,grid,inifile);
// sim.set_policy(adapt_policy);
......@@ -267,16 +267,16 @@ int main(int argc, char** argv)
else{ // no adaptivity
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.run();
// break;
// }
// case 2:{
// Sim<Cube<3,2>> sim(helper,grid,inifile);
// sim.run();
// break;
// }
case 1:{
Sim<Cube<3,1>> sim(helper,grid,inifile);
sim.run();
break;
}
case 2:{
Sim<Cube<3,2>> sim(helper,grid,inifile);
sim.run();
break;
}
// case 3:{
// Sim<Cube<3,3>> sim(helper,grid,inifile);
// sim.run();
......
......@@ -8,8 +8,8 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<2>,Geo::cube>,2>>;
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<2>,Geo::simplex>,2>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<2>,Geo::cube>,2>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<2>,Geo::simplex>,2>>;
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<2>,Geo::cube>,3>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<2>,Geo::cube>,3>>;
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<2>,Geo::simplex>,3>>;
} // namespace Dorie
......
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::cube>,1>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::cube>,1>>;
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::simplex>,1>>;
} // namespace Dorie
......
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::cube>,2>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::cube>,2>>;
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::simplex>,2>>;
} // namespace Dorie
......
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<2>,Geo::cube>,1>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<2>,Geo::cube>,1>>;
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<2>,Geo::cube>,2>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<2>,Geo::cube>,2>>;
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<2>,Geo::cube>,3>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<2>,Geo::cube>,3>>;
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<3>,Geo::cube>,1>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<3>,Geo::cube>,1>>;
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
......@@ -8,7 +8,7 @@
namespace Dune{
namespace Dorie{
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<3>,Geo::cube>,2>>;
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<YaspGrid<3>,Geo::cube>,2>>;
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
......@@ -9,8 +9,8 @@ except NameError:
pass
# paths set by cmake
DORIEDIR = "/home/saospina/Codes/DUNE_INSTALL/Debug/dorie"
MPIEXEC = "/usr/bin/mpiexec"
DORIEDIR = "/Users/soilros/Codes/DORIE_INSTALL/Debug/dorie"
MPIEXEC = "/usr/local/bin/mpiexec"
MPIEXEC_NUMPROC_FLAG = "-n"
MPIEXEC_PREFLAG = ""
MPIEXEC_POSTFLAGS = ""
......
#!/usr/bin/env python3
from __future__ import absolute_import
import os
import sys
import argparse
import warnings
import subprocess
import multiprocessing
from dorie.parfield import configparser, pfgerror
from dorie.parfield.converter import ImageConverter, CSVConverter, H5Converter, FFTH5Converter
"""
Script invoking the image to h5 converter on a file given via command line.
"""
# paths set by CMake
DORIEDIR = "/Users/soilros/Codes/DORIE_INSTALL/Debug/dorie"
MPIEXEC = "/usr/local/bin/mpiexec"
MPIEXEC_NUMPROC_FLAG = "-n"
MPIEXEC_PREFLAG = ""
MPIEXEC_POSTFLAGS = ""
#
RFG_EXEC = os.path.join(DORIEDIR, "dune/dorie-rfg/dorie-rfg")
def MPIRUN(nproc,exe,*args,**kwargs):
mpi_flags = kwargs.get("mpi_flags") or []
return [k for k in [MPIEXEC,MPIEXEC_NUMPROC_FLAG,str(nproc)] \
+ mpi_flags + [MPIEXEC_PREFLAG,str(exe),
MPIEXEC_POSTFLAGS] + list(args) if k]
if __name__ == "__main__":
try: # catch all exceptions we we can output an error message
with warnings.catch_warnings(record=True) as warn: # catch all warnings so we can count them
# PARSE COMMAND LINE
parser = argparse.ArgumentParser()
parser.add_argument('param',help='The configuration file holding all parameterization information')
parser.add_argument('-p','--parallel', metavar='N', nargs='?', default=1, const=multiprocessing.cpu_count(), type=int, required=False,
help="Run in parallel on N processes. If N is not specified, run on all available CPU threads.")
parser.add_argument('-m','--mpi-flags', action="append", required=False,
help="Additional flags that are passed to mpirun when run in parallel. "
"May be specified multiple times.")
parser.add_argument('--debug',help='Display warnings',action='store_true',required=False)
args = vars(parser.parse_args())
cp = configparser.cp(args["param"])
params = {}
for par in ("generator","inputFile","outputFile"):
try:
params[par] = cp["general"][par]
except KeyError:
raise RuntimeError("Missing option general.generator in parameter file {}".format(args["param"]))
# CALL CONVERTER
if params["generator"] == "image":
ImageConverter(args["param"])
elif params["generator"] == "csv":
CSVConverter(args["param"])
elif params["generator"] == "fft":
try:
if args["parallel"] == 1:
subprocess.check_call([RFG_EXEC,args["param"]])
else:
subprocess.check_call(MPIRUN(args["parallel"], RFG_EXEC, args["param"], mpi_flags=args["mpi_flags"]))
except subprocess.CalledProcessError:
print("FFT Field generator failed")
sys.exit(1)
out_path = cp.get("generator.fft","outputPath")
FFTH5Converter(args["param"], out_path + "/yfield.stoch.h5")
elif params["generator"] == "hdf5":
H5Converter(args["param"])
else:
raise RuntimeError("Unrecognized generator {}".format(gen))
# HANDLE WARNINGS
if not "debug" in args:
debug = False
else:
debug = args["debug"]
if debug:
for w in warn:
print(" {0}: {1}".format(w.category.__name__,w.message))
print("Parameter field generator exited successfully with ({0}) warning(s) and ({1}) error(s)".format(len(warn),0))
except Exception as e:
print("Parameter field generator failed with ({0}) warning(s) and ({1}) error(s)".format(len(warn),1))
raise
#!/usr/bin/env python3
from __future__ import absolute_import
import sys
import os
from dune.testtools.wrapper.argumentparser import get_args
from dune.testtools.parser import parse_ini_file
from dorie.testtools.wrapper import test_dorie
# paths set by cmake
DORIEDIR = "/Users/soilros/Codes/DORIE_INSTALL/Debug/dorie"
#
DORIE_WRAPPER = os.path.join(DORIEDIR, "bin/dorie")
if __name__ == "__main__":
args = get_args()
iniargument = args["ini"]
iniinfo = parse_ini_file(args["ini"])
sys.exit(test_dorie.test_dorie(iniinfo,iniargument,DORIE_WRAPPER))
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