#### Focus Manuals: Programing Guide: Building matrices and vectors: Available construction of Matrices

links from Programing Guide and from Building matrices and vectors

#### FORMULs of SUBROUTINE MATRIX

##### MATMAS

*FORMUL = 'MATMAS '*

(in library BIEF subroutines with names which start with MT01)

Mass-matrix.

##### MATDIF

*FORMUL = 'MATDIF '*

(in library BIEF subroutines with names which start with MT02)

Diffusion matrix with different coefficients according to the directions x, y and z.

**In 2 dimensions – isotropic**:

The case of an isotropic viscosity is given above. But the viscosity may also be tensorial. In this case

(a **U**

structure) must have a second dimension, for example 3- in 2-dimensional applications. **BIEF_OBJ**

will have the general form:
**U**

but the tensor is symmetric and .

Elements of the tensor must be stored in

as follows:
**U**

- in
**U(*,1)** - in
**U(*,2)** - in
**U(*,3)**

**In a 2 dimensions – non isotropic**:

When a transversal

and longitudinal **K_t**

dispersion are used (case of Elder's turbulence model), the formula giving the tensor **K_l**

is:
**U**

**In 3 dimensions** (beware,

, **F**

and **G**

are used in this case, unlike in 2D where **H**

, **U**

and **V**

are used):
**W**

##### MATDIF2

*FORMUL = 'MATDIF2 '*

In 3D only, formula MATDIF2 is like MATDIF, but the hydrostatic inconsistencies are dealt with.

##### MATDIF3

*FORMUL = 'MATDIF3 '*

In 2D only so far, diffusion matrix with diffusion coefficients which are piece-wise linear or constant, but may be discontinuous between elements (this is used in groundwater flows).

Here one must have :

- U%ELM=10, U%DIM2=3, U%DIMDISC=11
- V%ELM=10, V%DIM2=3, V%DIMDISC=11

##### MASUPG

*FORMUL = 'MASUPG '*

(subroutines with names which start with MT03)

Matrix used for the convection term with method SUPG option 1.

- here is a vector with the components

,**F**

and**G**

.**H** - is a vector with the components

,**U**

and**V**

.**W**

##### MAUGUG

*FORMUL = 'MAUGUG '*

(subroutines with names which start with MT04)

Matrix used for the convection term with method SUPG option 2.

- is a vector with the components

,**U**

and**V**

.**W**

##### MATVGR

*FORMUL = 'MATVGR '*

(subroutines with names which start with MT05)

Matrix used for the convection term with centred discretisation.

- is a vector with the components

,**U**

and**V**

.**W**

##### FMATMA

*FORMUL = 'FMATMA '*

(subroutines with names which start with MT06)

Matrix used for conservative smoothing.

##### MSLUMP

*FORMUL = 'MSLUMP '*

(subroutines with names which start with MT07)

Mass matrix with local mass-lumping.

Here,

must be a **F**

function, that is, constant for each element. If the value of **P0**

is locally 0, the mass-matrix will be locally lumped into a diagonal.
**F**

##### MATFGR

*FORMUL = 'MATFGR X'*

(subroutines with names which start with MT08)

Beware the minus sign !!!!

If

is equal to**FORMUL(16:16)**

or** 'Y' **

instead of** 'Z' **

, the derivatives will be obtained according to y or z.
** 'X' **

##### MATQGR

*FORMUL = 'MATQGR '* (not programmed yet)

(subroutines with names which start with MT09)

Subroutines with names which start with MT10 are not yet programmed.

##### MATGRF

*FORMUL = 'MATGRF X'*

(subroutines with names which start with MT11)

Beware the minus sign !!!!

If

is equal to**FORMUL(16:16)**

or** 'Y' **

instead of** 'Z' **

, the derivatives will be obtained according to y or z.
** 'X' **

##### MATUGH

*FORMUL = 'MATUGH X'*

(subroutines with names which start with MT12)

Matrix used for the method SUPG, options 1 and 2.

If

is equal to**FORMUL(16:16)**

or** 'Y' **

instead of** 'Z' **

, the derivatives will be obtained according to y or z.
** 'X' **

- is a vector with the components

,**U**

and**V**

.**W**

##### MATGRA

*FORMUL = 'MATGRA X'*

(subroutines with names which start with MT13)

Gradient matrix.

is equal to**FORMUL(16:16)**

or** 'Y' **

instead of** 'Z' **

, the derivatives will be obtained according to y or z.
** 'X' **

##### MAMURD PSI and MAMURD2 PSI

*FORMUL = 'MAMURD PSI'</u> or <u>FORMUL = 'MAMURD2 PSI'*

(subroutines with names which start with MT14)

Distribution matrix in case of use of the Multidimensional Upwind Residual Distribution scheme in 3D. See reference [4] for more details.

If

is equal to**FORMUL(14:16)**

instead of 'PSI' the matrix will be assembled.
** ' N' **

##### FFBT

*FORMUL = 'FFBT '*

(subroutines with names which start with MT99)

This is in fact a series of different matrices and the string

is also used for defining the formula. For example if **FORMUL(8:16)**

, the matrix will be:
**FORMUL(8:16)=' 0XX0' **

**Explanation**: the term in the integral is a product of 4 terms based, for the first 2, on the vector

, and then on the Basis function called here **F**

and the test function called **B**

.
**T**

- If the first character is

, the first term will be**0**

.**F** - If the first character is

, the first term will be**X** - * If the first character is

, the first term will be**Y**

Then we proceed to second character and again function F, to third character and function , to fourth character and function

The combinations

, **0XX0**

, **0YY0**

, **XX00**

, **0X0Y**

, **XY00**

, **YY00**

have so far been implemented. The formula **0Y0X**

is also available. Note that missing combinations can be obtained because the first two characters can be exchanged. Moreover exchanging the last two characters gives the transposed matrix of the previous formula.
**FORMUL(8:16)='00XX+00YY' **

#### SUBROUTINE by names

The existing subroutines building matrices in version 6.+ are the following, their function can be deduced from the explanations above:

mt01aa.f mt01bb.f mt01cc.f mt01oo.f mt01pp.f mt01tt.f mt02aa.f mt02aa_2.f mt02bb.f mt02cc.f mt02pp.f mt02pt.f mt02tt.f mt03aa.f mt03bb.f mt03cc.f mt04aa.f mt04bb.f mt04cc.f mt04pp.f mt04tt.f mt05aa.f mt05bb.f mt05cc.f mt05pp.f mt05tt.f mt06aa.f mt06bb.f mt06cc.f mt06ff.f mt06ft.f mt06ft2.f mt06oo.f mt06oc.f mt06pp.f mt06tt.f mt07aa.f mt07bb.f mt07cc.f mt08aa.f mt08ab.f mt08ac.f mt08ba.f mt08bb.f mt08pp.f mt08tt.f mt11aa.f mt11ab.f mt11ac.f mt11ba.f mt11bb.f mt12aa.f mt12ab.f mt12ac.f mt12ba.f mt12bb.f mt13aa.f mt13ab.f mt13ba.f mt13bb.f mt13cc.f mt13ca.f mt14pp.f mt99aa.f