82#define dx(s) ((s[1,0] - s[-1,0])/(2.*Delta))
83#define dy(s) ((s[0,1] - s[0,-1])/(2.*Delta))
84#define d2x(s) ((s[1,0] + s[-1,0] - 2.*s[])/sq(Delta))
85#define d2y(s) ((s[0,1] + s[0,-1] - 2.*s[])/sq(Delta))
86#define d2xy(s) ((s[1,1] - s[1,-1] - s[-1,1] + s[-1,-1])/sq(2.*Delta))
102#define R1(h,zb,w) (-h[]*(h[]/3.*dx(w) + w[]*(dx(h) + dx(zb)/2.)))
103#define R2(h,zb,w) (h[]/2.*dx(w) + w[]*(dx(zb) + dx(h)))
162 if (
wet[-1] == 1 &&
wet[] == 1 &&
wet[1] == 1) {
206#if GAUSS_SEIDEL || _GPU
214 if (
h[] >
dry &&
wet[-1] == 1 &&
wet[] == 1 &&
wet[1] == 1) {
326 if (
wet[-1] == 1 &&
wet[] == 1 &&
wet[1] == 1)
double dtmax
The timestep is computed using the CFL condition on the face velocity field.
define VT _attribute[s.i] v y scalar * list
static number sq(number x)
static number cube(number x)
void event_defaults(void) update
Event: defaults (i = 0)
static double residual_GN(scalar *a, scalar *r, scalar *resl, void *data)
#define R1(h, zb, w)
The definitions of the and operators.
#define dx(s)
We first define some useful macros, following the notations in Bonneton et al, 2011.
static void relax_GN(scalar *a, scalar *r, int l, void *data)
The relaxation function is built by copying and pasting the residual implementation above and inverti...
vector D[]
The linear system can be inverted with the multigrid Poisson solver.
static double update_green_naghdi(scalar *current, scalar *updates, double dtmax)
void(* restriction)(Point, scalar)
trace mgstats mg_solve(scalar *a, scalar *b, double(*residual)(scalar *a, scalar *b, scalar *res, void *data), void(*relax)(scalar *da, scalar *res, int depth, void *data), void *data=NULL, int nrelax=4, scalar *res=NULL, int minlevel=0, double tolerance=TOLERANCE)
The user needs to provide a function which computes the residual field (and returns its maximum) as w...
double(* update)(scalar *evolving, scalar *updates, double dtmax)
trace double update_saint_venant(scalar *evolving, scalar *updates, double dtmax)
Information about the convergence of the solver is returned in a structure.