-
Notifications
You must be signed in to change notification settings - Fork 5
Sample generation
In order to run sample generation, we set the option main/mode
to be sample_generation
in the input file. In the example of examples/poisson/poisson.sample.yml
,
main:
mode: sample_generation
use_rom: true
solver: poisson
There are two types of sampling:
-
base
sample generator that samples over uniform grid points on parameter space -
random
sample generator that randomly choose the parameter values over a uniform random distribution
In the example of examples/poisson/poisson.sample.yml
, we use base
sample generator, saving snapshots in the name of poisson0
,
sample_generation:
type: base
file_path:
prefix: "poisson0"
The list of parameters to be sampled is specified in the input file under sample_generation/parameter
. In the example of examples/poisson/poisson.sample.yml
, we sample over one parameter:
sample_generation:
parameters:
- key: single_run/poisson0/k
type: double
sample_size: 3
minimum: 2.0
maximum: 3.0
For each parameter listed, base
sample generator creates an 1D uniform grid space between minimum
and maximum
with the specified sample_size
. In sample generation, base
sample generator replaces the value of the input option key
with a sample value, and executes a single-run. Running the main driver with this input file
cd examples/poisson/
../../bin/main -i poisson.sample.yml
executes three single-runs that solve for Poisson equation with a sample value for parameter single_run/poisson0/k
.
Technically, any option within the input file can be chosen as a sampling parameter. Currently, however, we only support double
and filename
type of input options. The example examples/poisson/poisson.sample.2d.yml
samples over global configuration files for component meshes as an additional parameter:
sample_generation:
parameters:
- key: single_run/poisson0/k
type: double
sample_size: 3
minimum: 2.0
maximum: 3.0
- key: mesh/component-wise/global_config
type: filename
sample_size: 4
minimum: 1
maximum: 4
format: "config/sample.config-%02d.h5"
For filename
parameter, the key
input option is set to a string that follows the format
with an integer index. The integer index is chosen from 1D uniform grid space of size sample_size
between minimum
and maximum
In this example, 4 global configuration files will be used for sampling:
config/sample.config-01.h5
config/sample.config-02.h5
config/sample.config-03.h5
config/sample.config-04.h5
If multiple base
sample generator creates an
Running the example input file above
../../bin/main -i poisson.sample.2d.yml
will collect single_run/poisson0/k
values and mesh/component-wise/global_config
files.