We give two ways to program an advection-like example, in files data_basicmodel.h and data_advancedmodel.h. We consider the equation
with the parameters Ω = [-2, 2]2, T = 0.5, f(x 1,x2) = 2π(-x2,x1). (Hence the Hamiltonian H(x,p,t) = max(0,-f(x) ⋅ p).)
In the first way (data_basicmodel.h), we define dynamics
with two control values a ∈{0, 1}.
In the second way (data_advancedmodel.h), we define the Lax-Friedrich numerical hamiltonian function Hnum associated to H (see (22)).
see the files data_FD_2d_ex1_basic.h and data_FD_2d_ex1_advanced.h The problem solved is
with d = 2, T = 1, here c(x,t) ≡ 1, and with some (radially symetric) initial data u0(x).
In the file data_FD_2d_ex1_basic.h, a scheme is programmed using a control-discretisation of ∥∇u∥ as follows:
where NCD is the number of controls.
In the file data_FD_2d_ex1_advanced.h, a scheme is programmed using a Lax-Friedriech numerical approximation Hnum associated to H :
The exact solution is given for comparison.