Usage of Feelpp / Mor : Offline part

1. Usage

This part can be run in parallel.

Usage of generate_basis script
[mpirun -np <nproc>] python3 generate_basis.py
    --config-file <path to cfg file>
    --odir <path to export directory>
    --dim <DIM>
    --case <name of the case>
    [--algo {0|1|2}]
    [--train-size <size>]
    [--tol <tol>]
    [--time-dependant={True | False}]
Table 1. Parameters
Name Description Default value

config-file

path to config cfg file

mandatory

odir

path to output directory, where data will be saved

mandatory

case

name of the case

generate_basis

dim

dimension of the case (must be 2 or 3)

mandatory

algo

algorithm used to generate a basis, see table below

1

train-size

Size of the train set (depending on algorithm used)

40

tol

tolerance used for generating (depends on algorithm)

1e-6

time-dependant

time dependant case

False

2. Algorithms

Table 2. Algorithms
Value Algorithm Description

0

From sample

Generates a basis of size \(N=\)train-size elements, [log-]randomly taken in the space.

1

Greedy algorithm

Run the greedy algorithm on a train set of element of size train-size. This algorithm also stores the evolution of the maximal error bound at each step.

2

POD generation

Takes the largest POD modes from a basis of size train-size. The resulting basis will have a size \(N\leqslant\)train-size. This algorithm also stores the evolution of the maximal error bound at each step.

For now, the computation of error bound is only valid when the decomposition is coercive (i.e. \(A(\mu)=\displaystyle\sum_{q}\beta_A(\mu)A^q\), with \(\beta_A(\mu)\geqslant 0\))

3. Exported files

Here is a description of the generated files :

  1. A JSON file, exported in odir directory, containing the following informations :

    • Qa : Size of the decomposition of \(A(\mu)\)

    • Qf : Size of the decomposition of \(F(\mu)\)

    • QLk : Sizes of the decompositions of \(L_k(\mu)\) for \(k\in\{1,n_\text{output}\}\), gathers in a list.

    • N_output : Number of output described in the JSON (CRBOutput)

    • output_names : names of those outputs

    • N : Size of the reduced basis

    • path : Path where h5 file is stored

    • mubar : Values of \(\bar{\mu}\)

  2. A h5 file, containing all the matrices used in the online part (of « small » size).

4. Documentation for developpers

The function to call to generate the basis is generatebasis :

import feelpp.mor.generate_basis as g               # import the module
g.generatebasis(worldcomm=worldcomm, config=config) # run the script

Where :

  1. worldcomm is a pointer to the MPI communicator. This argument is optionnal. If none (or None) is given, the function will get the communicaotr from feelpp.Environment.

  2. config is an object of type g.generateBasisConfig. It contains the paramters used by the script to generate the application.

config = generateBasisConfig(dim, config_file, time_dependant, odir, case, algo, size, tol)

The description and the default values of those parameters are descirbed above.

If odir contains $name, this expression will be replaced by the name of the case, defined by concatenation <case>-np_<nproc>, where case is the name of the case given in the configuration, and nproc is the number of processors where the simulation is run.

5. Files created by Feel++

Some files are created by Feel++. The emplacement of those file is important because they are used by the online part. In the following list, <feel-dir> represents the path to the feel directory. If nothing has been change in ~/.feelppconfig, the path to the <feel-dir> is ~/feel.

  • Model repository : <feel-dir>/crbdb/<name>/<uuid>, where :

    • <name> is the name of the case, defined by the option --case.

    • <uuid> is a unique identifier of the model, computed by the toolbox. This repository contains the meshes for the EIM decomposition.

  • DEIM and MDEIM sampling files : <feel-dir>/generate_basis-<name>/np_<nproc>/DmuDEim-P<dim>-Ne<size>-generated-by-master-proc :

    • <dim> is the dimension of the parameter space.

    • <size> is the size of the train set used on the EIM algorithm. This corresponds to the option toolboxmor.trainset-deim-size and trainset-mdeim-size in the cfg file. Those two files (one for the EIM decomposition of the matrix, and one for the EIM decomposition of the right-hand side) are generated by the toolbox, and contain the values of the parameters used to generate the basis.