# murge.c

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

The solution should be

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

./murge <size> <DofNbr>

#### Authors

 Xavier LACOSTE lac.nosp@m.oste@labr.nosp@m.i.fr
Summary
 murge.c Example that generate A Laplacian with multiple degrees of freedom and solves it. GetCoef Function GetCoef GetRhs Function GetRhs store Function store main

## GetCoef

 void GetCoef( COEF * matElem, INTS i, INTS j, double xmin, double xmax, INTS n, INTS dof )

Function GetCoef

Computes the value for a given coefficient.

#### Parameters

 val Value to set i Row of the coefficient. j Column of the coefficient. xmin Minimum value of the interval. xmax Maximum value of the interval. n Number of points in the interval.

## GetRhs

 void GetRhs( COEF * val, INTS i, double xmin, double xmax, INTS n )

Function GetRhs

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

#### Parameters

 val Value to set. i Index of the value. xmin Minimum value of the interval. xmax Maximum value of the interval. n Number of points in the interval.

## store

 void store( COEF * sol, double xmin, double xmax, INTS n, INTS dof )

Function store

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

 sol The solution of the problem xmin The minimum value of the interval. xmax The maximum value of the interval. dof The Number of degree of freedom.

## main

 int main( int argc, char ** argv )
 void GetCoef( COEF * matElem, INTS i, INTS j, double xmin, double xmax, INTS n, INTS dof )
Function GetCoef
 void GetRhs( COEF * val, INTS i, double xmin, double xmax, INTS n )
Function GetRhs
 void store( COEF * sol, double xmin, double xmax, INTS n, INTS dof )
Function store
 int main( int argc, char ** argv )