CartesianProductSampler

Provides complete Cartesian product for the supplied variables.

Overview

The Cartesian product creates a sample for all possible combinations for a set of values, . For example, given the vectors , , and . The resulting Cartesian product (Z) is:

Implementation

The CartesianProductSampler utilizes what is referred to as a "lazy" scheme for the calculation of the matrix, using the algorithm below. This simply means that any given row () in the matrix can be computed directly without the need for computing the values prior to the entry. As such the sampling works efficiently in parallel to create distributed sample data.

Example Input File Syntax

The following input file snippet demonstrates the creation of a CartesianProductSampler object with three variables. The variables are provided using triplets that provide the starting point, the stepsize, and the number of steps. For example, the triplet of 10 1.5 3 result in .

[Samplers]
  [sample]
    type = CartesianProduct
    linear_space_items = '10 1.5 3
                        20 1 4
                        130 10 2'
    execute_on = 'initial timestep_end'
  []
[]
(modules/stochastic_tools/test/tests/samplers/cartesian_product/grid.i)

The resulting Cartesian product is provided in the output file, as shown below.

sample_0,sample_1,sample_2
10,20,130
10,20,140
10,21,130
10,21,140
10,22,130
10,22,140
10,23,130
10,23,140
11.5,20,130
11.5,20,140
11.5,21,130
11.5,21,140
11.5,22,130
11.5,22,140
11.5,23,130
11.5,23,140
13,20,130
13,20,140
13,21,130
13,21,140
13,22,130
13,22,140
13,23,130
13,23,140
(modules/stochastic_tools/test/tests/samplers/cartesian_product/gold/grid_out_data_0000.csv)

Input Parameters

  • linear_space_itemsA list of triplets, each item should include the min, step size, and number of steps.

    C++ Type:std::vector<double>

    Controllable:No

    Description:A list of triplets, each item should include the min, step size, and number of steps.

Required Parameters

  • execute_onINITIALThe list of flag(s) indicating when this object should be executed, the available options include FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.

    Default:INITIAL

    C++ Type:ExecFlagEnum

    Options:FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, PRE_MULTIAPP_SETUP

    Controllable:No

    Description:The list of flag(s) indicating when this object should be executed, the available options include FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.

  • limit_get_global_samples429496729The maximum allowed number of items in the DenseMatrix returned by getGlobalSamples method.

    Default:429496729

    C++ Type:unsigned long

    Controllable:No

    Description:The maximum allowed number of items in the DenseMatrix returned by getGlobalSamples method.

  • limit_get_local_samples429496729The maximum allowed number of items in the DenseMatrix returned by getLocalSamples method.

    Default:429496729

    C++ Type:unsigned long

    Controllable:No

    Description:The maximum allowed number of items in the DenseMatrix returned by getLocalSamples method.

  • limit_get_next_local_row429496729The maximum allowed number of items in the std::vector returned by getNextLocalRow method.

    Default:429496729

    C++ Type:unsigned long

    Controllable:No

    Description:The maximum allowed number of items in the std::vector returned by getNextLocalRow method.

  • max_procs_per_row4294967295This will ensure that the sampler is partitioned properly when 'MultiApp/*/max_procs_per_app' is specified. It is not recommended to use otherwise.

    Default:4294967295

    C++ Type:unsigned int

    Controllable:No

    Description:This will ensure that the sampler is partitioned properly when 'MultiApp/*/max_procs_per_app' is specified. It is not recommended to use otherwise.

  • min_procs_per_row1This will ensure that the sampler is partitioned properly when 'MultiApp/*/min_procs_per_app' is specified. It is not recommended to use otherwise.

    Default:1

    C++ Type:unsigned int

    Controllable:No

    Description:This will ensure that the sampler is partitioned properly when 'MultiApp/*/min_procs_per_app' is specified. It is not recommended to use otherwise.

  • seed0Random number generator initial seed

    Default:0

    C++ Type:unsigned int

    Controllable:No

    Description:Random number generator initial seed

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters