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 to . We specify Robin boundary conditions (with conductivity ) on to , and Neumann boundary condition (with ) on . 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 1, define coefficient coef_alpha 1e5, 1e5, 1e5, 0, define coefficient coef_f 1, 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