fmurge.F90

Example that generate A Laplacian with multiple degrees of freedom and solves it.

That example only works with the -DDISTRIBUTED option.

The laplacian looks like :

   1       0                      ... 0
-2(n-1)  (n-1)  -2(n-1)   0       ... 0
   0    -2(n-1)  (n-1)  -2(n-1) 0 ... 0
             ....
             ....
   0 ...              -2(n-1)  n-1  -2(n-1)
   0 ...                        0     1

The Right-hand-side member is defined by $$RHS_i = - 4\pi^2 sin(2\pi x)$$

The solution should be $$X_i = sin(2\pi x)$$

The solution is stored in the file “result.plot” that can be ploted using

gnuplot> plot "./result.plot" u 2:3 t "reference", "./result.plot" u 2:4 t "Result, first degree of freedom"

Usage

./fmurge <size> <DofNbr>

Authors

Pascal JACQja.nosp@m.cq@labr.nosp@m.i.fr
Xavier LACOSTElac.nosp@m.oste@labr.nosp@m.i.fr
Summary
fmurge.F90Example that generate A Laplacian with multiple degrees of freedom and solves it.
GetCoefComputes the value for a given coefficient.
GetRhscomputes the value of a coefficient of the Right-hand-side member.
storeWrite the solution into a file result.plot.

GetCoef

SUBROUTINE GetCoef(val,
i,
j,
xmin,
xmax,
n)

Computes the value for a given coefficient.

Parameters

valValue to set
iRow of the coefficient.
jColumn of the coefficient.
xminMinimum value of the interval.
xmaxMaximum value of the interval.
nNumber of points in the interval.

GetRhs

SUBROUTINE GetRhs(val,
i,
xmin,
xmax,
n)

computes the value of a coefficient of the Right-hand-side member.

Parameters

valValue to set.
iIndex of the value.
xminMinimum value of the interval.
xmaxMaximum value of the interval.
nNumber of points in the interval.

store

SUBROUTINE store(sol,
xmin,
xmax,
dof)

Write the solution into a file result.plot.

The file contains :

k x sin(2 \pi x) sol(k:k+dofnbr-1)

Where k goes from 1 to n*dofnbr, dofnbr by dofnbr and x goes from xmin to xmax, with a step of (xmax - xmin) / (n-1).

Parameters

solThe solution of the problem
xminThe minimum value of the interval.
xmaxThe maximum value of the interval.
dofThe Number of degree of freedom.
SUBROUTINE GetCoef(val,
i,
j,
xmin,
xmax,
n)
Computes the value for a given coefficient.
SUBROUTINE GetRhs(val,
i,
xmin,
xmax,
n)
computes the value of a coefficient of the Right-hand-side member.
SUBROUTINE store(sol,
xmin,
xmax,
dof)
Write the solution into a file result.plot.
Close