# Fenics/Example

As an example for using fenics, we are running a script that solves a differential equation:

```[leonhard@euler01 ~]\$ module load new gcc/4.8.2 open_mpi/1.6.5 boost/1.59.0_py2.7.9 mpfr/3.1.2_gmp6 qt/4.8.4 netcdf/4.3.2 eigen/3.2.1 swig/3.0.5 suitesparse/4.4.4 fenics/1.6.0
[leonhard@euler01 ~]\$ ls -ltr
total 4
-rwxr-xr-x 1 leonhard T0000 219 Sep 14 08:20 test.py
[leonhard@euler01 ~]\$ cat test.py
#!/usr/bin/env python

from dolfin import *
mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
u, v = TrialFunction(V), TestFunction(V)
a = u*v*dx
L = f*v*dx
u = Function(V)
solve(a == L, u)
[leonhard@euler01 ~]\$ bsub -n 1 -W 4:00 -R "rusage[mem=2048]" python ./test.py
Generic job.
Job <27435524> is submitted to queue <normal.4h>.
[leonhard@euler01 ~]\$ bjobs
JOBID      USER        STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
27435524   leonhard    PEND  normal.4h  euler01                 *./test.py Sep 14 08:51
[leonhard@euler01 ~]\$ bjobs
JOBID      USER        STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
27435524   leonhard    RUN   normal.4h  euler01     e1448       *./test.py Sep 14 08:51
[leonhard@euler01 ~]\$ bjobs
No unfinished job found
[leonhard@euler01 ~]\$ ls -ltr
total 8
-rwxr-xr-x 1 leonhard T0000  219 Sep 14 08:20 test.py
-rw-r--r-- 1 leonhard T0000 1127 Sep 14 08:53 lsf.o27435524
```

The resource usage summary as well as the job logs can be found in the LSF log file lsf.o27435524.