GFem language documentation -- 3.4.4 Special functions:dx(), dy(), convect()

Previous: 3.4.3 Value of a function at one point
Up: 3.4 Functions

### 3.4.4 Special functions:dx(), dy(), convect()

`dx(f)` is the partial derivative of `f` with respect to `x` ; the result is piecewise constant when `precise` is set and interpolated with mass lumping as a the piecewise linear function when precise is not set.

Note that `dx()` is a non local operator so statements like `f=dx(f)` would give the wrong answer because the new value for `f` is place before the end of the use of the old one.

The Finite Element Method does not handle convection terms properly when they dominate the viscous terms: upwinding is necessary; `convect` provides a tool for Lagrangian upwinding. By `g=convect(f,u,v,dt)` Gfem construct an approximation of

f(x-u1(x,y)dt,y-u2(x,y)dt)

Recall that when

(pdf)/(pdt) + u(pdf)/(pdx) + v(pdf)/(pdy) = lim_dt -> 0(f(x,y,t) - f(x-u(x,y)dt,y-v(x,y)dt,t-dt))/(dt)

Thus to solve

(pdf)/(pdt) + u(pdf)/(pdx) + v(pdf)/(pdy) -div(µgrad f) = g,

in a much more stable way that if the operator `dx(.)` and `dy(.)` were use, the following scheme can be used:

    iter(n) begin
       id(f)/dt - laplace(f)*mu =g + convect(oldf,u,v,dt)/dt;
       oldf = f
    end;

Remark: Note that `convect` is a nonlocal operator. The statement `f = convect(f,u,v,dt)` would give an incorrect result because it modifies `f` at some vertex where the old value is still needed later. It is necessary to do

    g=convect(f,u,v,dt);
    f=g;