Train ROM - LLNL/scaleupROM GitHub Wiki

TL;DR

In this section of the tutorial, we run the following commands

cd examples/poisson
../../bin/main -i poisson.sample.yml
../../bin/main -i poisson.train.yml
../../bin/main -i poisson.sample.yml -f model_reduction/subdomain_training=individual
../../bin/main -i poisson.train.dom.yml

By "training ROM", here we refer to performing proper orthogonal decomposition (POD) over the collected snapshots from the sample generation stage. This can be specified in the input file as main/mode:

main:
  mode: train_rom
  solver: poisson

In order to train ROM, we need to specify the list of basis for which we collected snapshots. In the example of examples/poisson/poisson.train.yml, we have the option

basis:
  prefix: "poisson0"
  number_of_basis: 3
  tags:
    - name: "empty"
    - name: "square-circle"
    - name: "square-square"
    - name: "square-star"
  svd:
    save_spectrum: true
    update_right_sv: false

Here are the description for the input options:

  • basis/prefix: the prefix string used for snapshots and basis, which is usually the same as sample_generation/file_path/prefix.
  • basis/number_of_basis: the default number of basis vectors for all basis tags, unless their custom number of basis is specified.
  • basis/tags: the list of snapshots/basis names according to model_reduction/subdomain_training
    • For universal subdomain training, the snapshots/basis are named after their reference component names.
    • For individual subdomain training, the snapshots/basis are named as dom0, dom1, ...
  • basis/svd: sets the option of saving singular value spectrum or computing right-hand singular vectors.

By default, train_rom mode will attempt to read the snapshot file in the format of

[basis/prefix]_[basis/tag]_snapshots.000000

We first generate the snapshots by running the command

cd examples/poisson
../../bin/main -i poisson.sample.yml

Running the command

../../bin/main -i poisson.train.yml

performs POD over 4 reference components.

Basis-specific options

It is possible to train ROM with a custom number of basis or a custom snapshot file. In the example of examples/poisson/poisson.train.dom.yml,

basis:
  prefix: "poisson0"
  number_of_basis: 3
  tags:
    - name: "empty"
      snapshot_files: [poisson0_sample_dom2_snapshot]
    - name: "square-circle"
      snapshot_files: [poisson0_sample_dom0_snapshot]
      number_of_basis: 2
    - name: "square-square"
      snapshot_files: [poisson0_sample_dom1_snapshot]
    - name: "square-star"
      snapshot_files: [poisson0_sample_dom3_snapshot]

train_rom mode will attempt to read a file with the specified name followed by .000000. For example of empty component, the file poisson0_sample_dom2_snapshot.000000 will be attempted to be read. Note that the file names are given as a list of strings, not a string itself. This is to support multiple snapshot files in future.

In order to generate the snapshot files named as above, we run the following command:

../../bin/main -i poisson.sample.yml -f model_reduction/subdomain_training=individual

It is also possible to set different number of basis for each basis tag. For the example of examples/poisson/poisson.train.dom.yml, square-circle component will have 2 basis vectors, while the others will have the default 3 basis vectors. Running

../../bin/main -i poisson.train.dom.yml

performs the POD as follows:

We see that by using 2 basis vectors only, ROM basis for the square-circle component covers only 81% of the snapshots, while the others can cover 100% (by taking the same number of basis as that of the snapshots).