GFem language documentation -- 3.7.3 Solve()

Previous: 3.7.2 Pde()
Up: 3.7 Solving an equation
Next: 3.7.4 2-Systems

### 3.7.3 Solve()

The syntax for a single unknown function u solution of a PDE is

    solve(u)
     begin
       onbdy()...;
       onbdy()...;
       ...;
       pde(u)...
     end;

For 2-systems and the use of `solve(u,v)`, see the section `2-Systems` . It defines a PDE and its boundary conditions. It will be solved by the Finite Element Method of degree 1 on triangles and a Gauss factorization.

Once the matrix is built and factorized `solve` may be called again by `solve(u,-1)...;` then the matrix is not rebuilt nor factorized and only a solution of the linear system is performed by an up and a down sweep in the Gauss algorithm only. This saves a lot of CPU time whenever possible. Several matrices can be stored and used simultaneously, in which case the sequence is

    solve(u,i)...;
    ...
    solve(u,-i)...;

where `i` is a scalar variable (not an array function).

However matrices must be constructed in the natural order: `i=1` first then `i=2....` after they can be re-used in any order. One can also re-use an old matrix with a new definition, as in

    solve(u,i)...;
    ...
    solve(u,i)...;
    solve(u,ħi)...;

Notice that `solve(u)` is equivalent to `solve(u,1)` .

Remark: 2-Systems have their own matrices, so they do not count in the previous ordering.