Skip to content

Main driver and input parsing

Kevin" Seung Whan Chung edited this page Dec 12, 2023 · 7 revisions

bin/main is the main executable that handles the entire workflow from sample generation to ROM prediction.

Syntax:

main -i input_file -f key1=val1:key2=val2:...

YAML input file

bin/main mainly takes the options from a YAML-based input file. One example of running a full order model (FOM) single prediction of Poisson equation can be found in examples/poisson. From the built directory,

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

In essence, this reads a mesh file meshes/test.2x2.mesh, refines it 5 times, and solves FOM Poisson equation with a parameterized problem poisson0. poisson0 defines a right-hand side and a boundary condition as: $$-\nabla^2 u = \sin2\pi\left(kx + ky + kz + \theta\right)$$ $$u = 0 \qquad \text{on } \partial D$$ In poisson.yml file, $k$ is defined as:

single_run:
  poisson0:
    k: 2.5

which sets the parameters as: $$k = 2.5, \quad \theta = 0 \text{ (default)}$$ The corresponding solution is visualized with paraview file named paraview_output, shown as below:

Overwriting an input option with forced input

It is possible to overwrite an input option in runtime, not changing the original input file. This can be done by using forced input argument. The syntax is:

main -i input_file -f key1=val1:key2=val2:...

The command above will read the option from input file, overwrite the option key1, key2, ... to have a value val1, val2, ... respectively, then run the normal workflow. The YAML levels of key1 is specified by /. For example, if we want to solve the same problem as above but with a different $k$,

../../bin/main -i poisson.yml -f single_run/poisson0/k=1.5

will return a solution with $k=1.5$,

Single run: (1) with full order model (FOM)

The main category in the input file specifies the mode of main and the type of the solver. For example, examples/poisson/poisson.yml specifies,

main:
  mode: single_run
  use_rom: false
  solver: poisson

that (1) it is single_run mode, (2) FOM simulation will be run, and (3) Poisson equation will be solved.

At single_run mode, the equation will be solved on a particular right-hand side function and boundary condition set by the parameterized problem. In examples/poisson/poisson.yml, the type of the parameterized problem is set as:

parameterized_problem:
  name: poisson0

There are a variety of parameterized problems defined for each physics solver, which can be found in the source code include/parameterized_problem.hpp.

The parameters for each parameterized problem can be set under single_run/[the name of parameterized problem]. For example of examples/poisson/poisson.yml, as we have seen above,

single_run:
  poisson0:
    k: 2.5