Trixi.jl icon indicating copy to clipboard operation
Trixi.jl copied to clipboard

How to handle default arguments of `solve`

Open ranocha opened this issue 3 years ago • 2 comments

We need some default arguments of solve, e.g., save_everystep=false. With our coming MPI array type, we also need to think about how to handle the parallel norm computations for error-based step size control with MPI. We tried to let length return a global length, but that came with too many problems. Thus, #1104 adds new functions that must be passed as additional keyword arguments as in sol = solve(ode, ...; kwargs..., internalnorm=ode_norm, unstable_check=ode_unstable_check).

We basically have two options I can think of right now:

  1. Create a function ode_default_options() returning the default options we use.
  2. Create a function trixi_solve(args...; kwargs...) = solve(args...; save_everystep=false, internalnorm=ode_norm, unstable_check=ode_unstable_check, kwargs...)

See https://github.com/trixi-framework/Trixi.jl/pull/1104, especially https://github.com/trixi-framework/Trixi.jl/pull/1104#discussion_r840319907

ranocha avatar Apr 01 '22 15:04 ranocha

We might also consider turning on multithreading in solve by default this way, couldn't we?

sloede avatar Apr 01 '22 15:04 sloede

That's a bit more difficult since it's part of the algorithm, not a standard keyword argument (since not all algorithms support that).

ranocha avatar Apr 01 '22 15:04 ranocha