You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem in this approach is that the update behaviour of Dtx depends on vy (and Dty depends on vx), but Dtx doesn't ever see vy (and Dtyvx) in the ODE function.
Janky solution
The janky solution to the problem would be to modify the ODE function to manually update the SciMLOperators as follows:
this is, of-course, not robust as different discretizations and function spaces would place vx, vy differently and this wouldn't extend to 3D easily either.
Quick fix
Even though Dtx, Dty act only on vx, vy respectively, they need access to the entire velocity vector during update_coefficients!. This can be done by supporting keyword arguments in update_coefficients!. The ODEFunction would then look like
update_coefficients! can be easily modified to use kwargs. This is both robust as the advection diagonal operator containing velocity can be prescribed advection behaviour as follows:
The long term goal should be to just pass a SciMLOperator as your ODE function. So we'd have to write a SciMLOperator that can act on vector of vectors or ComponentArray types.
The text was updated successfully, but these errors were encountered:
Problem
To solve the 2D Burgers equation with
OrdinaryDiffEq.jl
https://github.com/vpuri3/PDEInterfaces.jl/blob/d1402040c35b80dc5815e508ea56daf6805b28ba/examples/fourier2d/coupled.jl#L2-L7
I am concatenating
vx, vy
into aComponentArray
https://github.com/vpuri3/PDEInterfaces.jl/blob/d1402040c35b80dc5815e508ea56daf6805b28ba/examples/fourier2d/coupled.jl#L60-L66
and encapsulating the right-hand side into separate SciMLOperators for
vx
, andvy
calledDtx, Dty
respectively.https://github.com/vpuri3/PDEInterfaces.jl/blob/d1402040c35b80dc5815e508ea56daf6805b28ba/examples/fourier2d/coupled.jl#L57-L58
My ODE function is now:
https://github.com/vpuri3/PDEInterfaces.jl/blob/d1402040c35b80dc5815e508ea56daf6805b28ba/examples/fourier2d/coupled.jl#L68-L73
The problem in this approach is that the update behaviour of
Dtx
depends onvy
(andDty
depends onvx
), butDtx
doesn't ever seevy
(andDty
vx
) in the ODE function.Janky solution
The janky solution to the problem would be to modify the ODE function to manually update the
SciMLOperator
s as follows:https://github.com/vpuri3/PDEInterfaces.jl/blob/7b7d26df4aae491f8b2ea2148985d5f85c1ca7ca/examples/fourier2d/coupled_jank.jl#L63-L75
this is, of-course, not robust as different discretizations and function spaces would place
vx
,vy
differently and this wouldn't extend to 3D easily either.Quick fix
Even though
Dtx
,Dty
act only onvx, vy
respectively, they need access to the entire velocity vector duringupdate_coefficients!
. This can be done by supporting keyword arguments inupdate_coefficients!
. The ODEFunction would then look likehttps://github.com/vpuri3/PDEInterfaces.jl/blob/347bdcecafc16715c774a079d0a7246897ed1c07/examples/fourier2d/coupled.jl#L63-L71
update_coefficients!
can be easily modified to use kwargs. This is both robust as the advection diagonal operator containing velocity can be prescribed advection behaviour as follows:Long term solution
The long term goal should be to just pass a
SciMLOperator
as your ODE function. So we'd have to write a SciMLOperator that can act on vector of vectors orComponentArray
types.The text was updated successfully, but these errors were encountered: