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

[!343] Make it possible to generate drivers with higher time stepping order

Merge branch 'feature/higher-time-step-order' into 'master'

See merge request [extensions/dune-codegen!343]

  [extensions/dune-codegen!343]: Noneextensions/dune-codegen/merge_requests/343
parents 759c2432 ebbd9a23
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ class CodegenGlobalOptionsArray(ImmutableRecord): ...@@ -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.") 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") driver_file = CodegenOption(helpstr="The filename for the generated driver header")
explicit_time_stepping = CodegenOption(default=False, helpstr="use explicit time stepping") 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") 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)") 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.") 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(): ...@@ -132,10 +132,25 @@ def name_time():
def typedef_timesteppingmethod(name): def typedef_timesteppingmethod(name):
r_type = type_range() r_type = type_range()
explicit = get_option('explicit_time_stepping') explicit = get_option('explicit_time_stepping')
order = get_option('time_stepping_order')
if explicit: 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: 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(): def type_timesteppingmethod():
...@@ -150,8 +165,12 @@ def define_timesteppingmethod(name): ...@@ -150,8 +165,12 @@ def define_timesteppingmethod(name):
if explicit: if explicit:
return "{} {};".format(tsm_type, name) return "{} {};".format(tsm_type, name)
else: else:
ini = name_initree() order = get_option('time_stepping_order')
return "{} {}({}.get<double>(\"instat.theta\",1.0));".format(tsm_type, name, ini) 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(): 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