next up previous contents
Next: Reference Manual Up: The PDE Description file Previous: The weak formulation   Contents

The input file

The file below is a valid input file to NGSolve. The first two lines load the prepared geometry file and the mesh file. It is a square. The boundary splits into the 4 sides $\Gamma_1$ to $\Gamma_4$. We specify Robin boundary conditions (with conductivity $\alpha = 10^5$) on $\Gamma_1$ to $\Gamma_3$, and Neumann boundary condition (with $g = 1$) on $\Gamma_4$. This is defined in terms of coefficients. The list of numbers correspond to the sub-domains, if the integral is taken over the domain, or, to parts of the boundary, if the integral is taken over the boundary, respectively. The next lines define the mathematical objects finite-element space, grid-function, bilinear-form, linear-form, and a preconditioner. The last line (numproc) calls the solver for boundary value problems (bvp). Here, a preconditioned conjugate gradients iteration is called.

geometry = ngsolve/pde_tutorial/square.in2d
mesh = ngsolve/pde_tutorial/square.vol

define coefficient coef_lam

define coefficient coef_alpha
1e5, 1e5, 1e5, 0, 

define coefficient coef_f

define coefficient coef_g
0, 0, 0, 1,

define fespace v -order=1
define gridfunction u -fespace=v -nested

define bilinearform a -fespace=v
laplace coef_lam
robin coef_penalty

define linearform f -fespace=v
source coef_source
neumann coef_g

define preconditioner c -type=multigrid -bilinearform=a -smoothingsteps=1

numproc bvp np1 -bilinearform=a -linearform=f -gridfunction=u -preconditioner=c -maxsteps=50

Joachim Schoeberl 2002-07-15