125 dz.x +=
h[] -
h[-1],
dzp.x +=
h[1] -
h[];
126 for (
int l = 0,
m =
nl - 1;
l <
nl;
l++,
m--) {
129 for (
int k = 0;
k <
nl;
k++)
143 H[
l*(
nl + 1) - 1] = 4.;
153 for (
int k =
l + 1,
s = -1;
k <
nl;
k++,
s = -
s) {
154 double hk =
h[0,0,
nl-1-
k];
179#if GAUSS_SEIDEL || _GPU
265 res[] = rhs[] + 4.*
phi[];
271 res[] -=
h[]*(
g.
x[0,0,-1] +
g.
x[1,0,-1])/
275 res[] -= 4.*
phi[0,0,1];
276 for (
int k = - 1,
s = -1;
k >= -
point.l;
k--,
s = -
s) {
277 double hk =
h[0,0,
k];
359 double h1 = 0.,
v1 = 0.;
372 for (
int k = - 1,
s = -1;
k >= -
point.l;
k--,
s = -
s)
373 rhs[] += 4.*
s*
w[0,0,
k];
400 nrelax = 4, minlevel = 1,
452 w[] = (
w[] > 0. ? 1. : -1.)*
wmax;
scalar * tracers
Here we set the gradient functions for each tracer (as defined in the user-provided tracers list).
vector g[]
We store the combined pressure gradient and acceleration field in g*.
define m((k)==0 &&(l)==0 &&(m)==0) macro2 foreach_point(double _x=0.
static number sq(number x)
scalar * list_append(scalar *list, scalar s)
macro2 diagonalize(int a)
void solve_hessenberg(double H[nl *nl], double x[nl])
#define slope_limited(dz)
#define gmetric(i)
The macro below can be overloaded to define the barotropic acceleration.
#define hpg(pg, phi, i, code)
void vertical_diffusion(Point point, scalar h, scalar s, double dt, double D, double dst, double s_b, double lambda_b)
scalar res_eta
This can be used to optionally store the residual (for debugging).
bool rigid
The free-surface can be replaced with a "rigid lid" by setting rigid to true.
void(* restriction)(Point, scalar)
void event_pressure(void)
Event: pressure (i++)
static void box_matrix(Point point, scalar phi, scalar rhs, vector hf, scalar eta, double H[nl *nl], double d[nl])
void event_viscous_term(void)
Event: viscous_term (i++)
void event_cleanup(void)
Event: cleanup (i = end, last)
void event_defaults(void)
Event: defaults (i = 0)
static trace void relax_nh(scalar *phil, scalar *rhsl, int lev, void *data)
scalar phi
The electric potential and the volume charge density are scalars while the permittivity and conductiv...
static trace double residual_nh(scalar *phil, scalar *rhsl, scalar *resl, void *data)
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...
Information about the convergence of the solver is returned in a structure.