This action is a crutch that gets around a construction and initialSetup execution order of operations problem between three types of objects. More...
#include <StochasticResultsAction.h>
Public Types | |
typedef DataFileName | DataFileParameterType |
Public Member Functions | |
StochasticResultsAction (const InputParameters ¶ms) | |
virtual void | act () override |
void | timedAct () |
virtual void | addRelationshipManagers (Moose::RelationshipManagerType when_type) |
MooseObjectName | uniqueActionName () const |
const std::string & | specificTaskName () const |
const std::set< std::string > & | getAllTasks () const |
void | appendTask (const std::string &task) |
MooseApp & | getMooseApp () const |
const std::string & | type () const |
virtual const std::string & | name () const |
std::string | typeAndName () const |
std::string | errorPrefix (const std::string &error_type) const |
void | callMooseError (std::string msg, const bool with_prefix) const |
MooseObjectParameterName | uniqueParameterName (const std::string ¶meter_name) const |
const InputParameters & | parameters () const |
MooseObjectName | uniqueName () const |
const T & | getParam (const std::string &name) const |
std::vector< std::pair< T1, T2 > > | getParam (const std::string ¶m1, const std::string ¶m2) const |
const T * | queryParam (const std::string &name) const |
const T & | getRenamedParam (const std::string &old_name, const std::string &new_name) const |
T | getCheckedPointerParam (const std::string &name, const std::string &error_string="") const |
bool | isParamValid (const std::string &name) const |
bool | isParamSetByUser (const std::string &nm) const |
void | paramError (const std::string ¶m, Args... args) const |
void | paramWarning (const std::string ¶m, Args... args) const |
void | paramInfo (const std::string ¶m, Args... args) const |
void | connectControllableParams (const std::string ¶meter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const |
void | mooseError (Args &&... args) const |
void | mooseErrorNonPrefixed (Args &&... args) const |
void | mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const |
void | mooseWarning (Args &&... args) const |
void | mooseWarningNonPrefixed (Args &&... args) const |
void | mooseDeprecated (Args &&... args) const |
void | mooseInfo (Args &&... args) const |
std::string | getDataFileName (const std::string ¶m) const |
std::string | getDataFileNameByName (const std::string &relative_path) const |
std::string | getDataFilePath (const std::string &relative_path) const |
PerfGraph & | perfGraph () |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
Static Public Member Functions | |
static InputParameters | validParams () |
Public Attributes | |
const ConsoleStream | _console |
Static Public Attributes | |
static constexpr auto | SYSTEM |
static constexpr auto | NAME |
Protected Member Functions | |
bool | addRelationshipManagers (Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars) |
void | associateWithParameter (const std::string ¶m_name, InputParameters ¶ms) const |
void | associateWithParameter (const InputParameters &from_params, const std::string ¶m_name, InputParameters ¶ms) const |
const T & | getMeshProperty (const std::string &data_name, const std::string &prefix) |
const T & | getMeshProperty (const std::string &data_name) |
bool | hasMeshProperty (const std::string &data_name, const std::string &prefix) const |
bool | hasMeshProperty (const std::string &data_name, const std::string &prefix) const |
bool | hasMeshProperty (const std::string &data_name) const |
bool | hasMeshProperty (const std::string &data_name) const |
std::string | meshPropertyName (const std::string &data_name) const |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level) const |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const |
std::string | timedSectionName (const std::string §ion_name) const |
Static Protected Member Functions | |
static std::string | meshPropertyName (const std::string &data_name, const std::string &prefix) |
Protected Attributes | |
std::string | _registered_identifier |
std::string | _specific_task_name |
std::set< std::string > | _all_tasks |
ActionWarehouse & | _awh |
const std::string & | _current_task |
std::shared_ptr< MooseMesh > & | _mesh |
std::shared_ptr< MooseMesh > & | _displaced_mesh |
std::shared_ptr< FEProblemBase > & | _problem |
PerfID | _act_timer |
MooseApp & | _app |
const std::string | _type |
const std::string | _name |
const InputParameters & | _pars |
Factory & | _factory |
ActionFactory & | _action_factory |
MooseApp & | _pg_moose_app |
const std::string | _prefix |
const Parallel::Communicator & | _communicator |
This action is a crutch that gets around a construction and initialSetup execution order of operations problem between three types of objects.
SPT = SamplerPostprocessorTransfer (MultiappTransfer) SR = StochasticResults (VectorPostprocessor) PCT = PolynomialChaosTrainer (GeneralUserObject)
Here is the scenario (see surrogats/load_store/train.i)
The following objects and data needed:
SPT: transfers PP values from sub-applications to the the master SR. The names of the vectors on the master are dictated by the PP names being captured from the sub-app. SR: stores vectors of stochastic data from the SPT PCT: uses the data from the SR to train a reduced order model
A problem arises because the SPT dictates the what vectors are declared in the SR.
The following construction order exists as dictated by MOOSE: PCT, SPT, SR
Therefore, the SPT must wait until initialSetup to declare the vectors on the SR because the SR is not constructed until after the SPT.
The PCT needs to query information about the data vectors in SR (e.g., size, is distributed), which needs to happen in initialSetup because the SR is not constructed until after the PCT.
The following initialSetup order exists as dictated by MOOSE: PCT, SR, SPT
As mentioned above the SPT::initialSetup creates vectors in the SR. However, the PCT needs the vectors in-place during initialSetup. Therefore, the current API doesn't meet the needs for this workflow.
The first implementation of this relationship required that both the SPT and the SR required the sampe Sampler object. The name of the Sampler was used as the name of the result vectors in the SR. This worked, but limited the ability to retrieve more than one PP value from a sub-application. Multiple values were only possible if the sub-application that was computing them was based on another Sampler object. That scenario is far less likely then trying to collect more the one PP value from a sub-application. Furthermore, the sampler name is irrelevant to the data being captured from the sub-applications.
The goal is to have this SPT be able to grab many PP values from a sub-application and store them in vectors in SR using the PP name as the name of the vector. This basic goal can be accomplished by using the initialSetup functions of the SPT and SRT, until the results are needed by another object, such as a Trainer, as shown above.
There are a few possible solutions. It is important to state that the PCT should always operate on generic VPP data to allow for training data to come from any VPP objects. So, solutions that require PCT to have knowledge of the SR are not considered.
The solution implemented takes the approach of (4). When the SPT is created it caches the PP names associated with the SR object that will be populated in this action. Then when the SR is created it declares the vectors in the cache.
Definition at line 88 of file StochasticResultsAction.h.
StochasticResultsAction::StochasticResultsAction | ( | const InputParameters & | params | ) |
Definition at line 31 of file StochasticResultsAction.C.
|
overridevirtual |
Implements Action.
Definition at line 34 of file StochasticResultsAction.C.
|
static |
Definition at line 23 of file StochasticResultsAction.C.