Skip to content

Commit

Permalink
fix parabolic terms
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha committed Nov 9, 2022
1 parent b14650f commit 3199ac7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using Reexport: @reexport
using SciMLBase: SciMLBase, unwrapped_f,
CallbackSet, DiscreteCallback,
ODEProblem, ODESolution, ODEFunction,
SplitODEProblem
SplitODEProblem, SplitFunction
import SciMLBase: get_du, get_tmp_cache, u_modified!,
AbstractODEIntegrator, init, step!, check_error,
get_proposed_dt, set_proposed_dt!,
Expand Down
26 changes: 18 additions & 8 deletions src/semidiscretization/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,37 @@ end

# get the semidiscretization from an `ODEIntegrator`
function extract_semidiscretization(integrator)
f = unwrapped_f(integrator.f.f)
if f isa RHSWrapper
return f.semi
else
return integrator.p
end
# TODO: check alternatives such as
# f = unwrapped_f(integrator.f.f)
# if f isa RHSWrapper
# return f.semi
# else
# return integrator.p
# end
extract_semidiscretization(integrator.sol)
end

function extract_semidiscretization(sol::ODESolution)
extract_semidiscretization(sol.prob)
end

function extract_semidiscretization(ode::ODEProblem)
f = unwrapped_f(ode.f.f)
_extract_semidiscretization(ode.f, ode.p)
end

function _extract_semidiscretization(f, p)
f = unwrapped_f(f.f)
if f isa RHSWrapper
return f.semi
else
return ode.p
return p
end
end

function _extract_semidiscretization(f::SplitFunction, p)
_extract_semidiscretization(f.f1, p)
end


"""
semidiscretize(semi::AbstractSemidiscretization, tspan, restart_file::AbstractString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function semidiscretize(semi::SemidiscretizationHyperbolicParabolic, tspan)
# See https://github.com/trixi-framework/Trixi.jl/issues/328
iip = true # is-inplace, i.e., we modify a vector when calling rhs!, rhs_parabolic!
wrapper_hyperbolic = RHSWrapper(semi, rhs!) # wrap `rhs!`` and `semi` to reduce latency, see `RHSWrapper`
wrapper_parabolic = RHSWrapper(rhs_parabolic!, rhs!)
wrapper_parabolic = RHSWrapper(semi, rhs_parabolic!)
return SplitODEProblem{iip}(wrapper_hyperbolic, wrapper_parabolic, u0_ode, tspan, semi)
end

Expand Down

0 comments on commit 3199ac7

Please sign in to comment.