Skip to content
Snippets Groups Projects
Commit ebbd9a23 authored by René Heß's avatar René Heß
Browse files

Make it possible to generate drivers with higher time stepping order

parent 759c2432
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ class CodegenGlobalOptionsArray(ImmutableRecord):
debug_cache_with_stack = CodegenOption(default=False, helpstr="Store stack along with cache objects. Makes debugging caching issues easier.")
driver_file = CodegenOption(helpstr="The filename for the generated driver header")
explicit_time_stepping = CodegenOption(default=False, helpstr="use explicit time stepping")
time_stepping_order = CodegenOption(default=1, helpstr="Order of the time stepping method")
exact_solution_expression = CodegenOption(helpstr="name of the exact solution expression in the ufl file")
compare_l2errorsquared = CodegenOption(helpstr="maximal allowed l2 error squared of difference between numerical solution and interpolation of exact solution (NOTE: requires --exact-solution-expression)")
grid_info = CodegenOption(default=None, helpstr="Path to file with information about facedir and facemod variations. This can be used to limit the generation of skeleton kernels.")
......
......@@ -132,10 +132,25 @@ def name_time():
def typedef_timesteppingmethod(name):
r_type = type_range()
explicit = get_option('explicit_time_stepping')
order = get_option('time_stepping_order')
if explicit:
return "using {} = Dune::PDELab::ExplicitEulerParameter<{}>;".format(name, r_type)
if order == 1:
return "using {} = Dune::PDELab::ExplicitEulerParameter<{}>;".format(name, r_type)
elif order == 2:
return "using {} = Dune::PDELab::HeunParameter<{}>;".format(name, r_type)
elif order == 3:
return "using {} = Dune::PDELab::Shu3Parameter<{}>;".format(name, r_type)
elif order == 4:
return "using {} = Dune::PDELab::RK4Parameter<{}>;".format(name, r_type)
else:
raise NotImplementedError("Time stepping method not supported")
else:
return "using {} = Dune::PDELab::OneStepThetaParameter<{}>;".format(name, r_type)
if order == 1:
return "using {} = Dune::PDELab::OneStepThetaParameter<{}>;".format(name, r_type)
elif order == 2:
return "using {} = Dune::PDELab::Alexander2Parameter<{}>;".format(name, r_type)
elif order == 3:
return "using {} = Dune::PDELab::Alexander3Parameter<{}>;".format(name, r_type)
def type_timesteppingmethod():
......@@ -150,8 +165,12 @@ def define_timesteppingmethod(name):
if explicit:
return "{} {};".format(tsm_type, name)
else:
ini = name_initree()
return "{} {}({}.get<double>(\"instat.theta\",1.0));".format(tsm_type, name, ini)
order = get_option('time_stepping_order')
if order == 1:
ini = name_initree()
return "{} {}({}.get<double>(\"instat.theta\",1.0));".format(tsm_type, name, ini)
else:
return "{} {};".format(tsm_type, name)
def name_timesteppingmethod():
......
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