22 "Serializes and transfers solution vectors for given variables from sub-applications.");
24 "The name of the parallel storage reporter.");
26 "The name of the solution container on the subapp.");
29 "The names of the variables which should be serialized and transferred to this application.");
30 params.
addParam<
bool>(
"serialize_on_root",
32 "If we want to gather the solution fields only on the root processors of " 33 "the subapps before transfering to the main app.");
39 _variable_names(getParam<
std::vector<VariableName>>(
"variables")),
40 _serialize_on_root(getParam<bool>(
"serialize_on_root"))
43 paramError(
"to_multi_app",
"To and between multiapp directions are not implemented");
51 getParam<std::string>(
"parallel_storage"));
59 const auto & serialized_solution_reporter = getParam<std::string>(
"solution_container");
61 for (MooseIndex(n) i = 0; i < n; i++)
90 for (MooseIndex(n) i = 0; i < n; i++)
157 num_new_local_entries,
158 new_local_entries_begin,
159 new_local_entries_end);
164 for (
const auto & snapshot : solution_container.
getSnapshots())
166 DenseVector<Real> serialized_solution;
171 serialized_solution.get_values(),
172 (local_app_index >= new_local_entries_begin && local_app_index < new_local_entries_end)
174 : std::vector<dof_id_type>());
176 if (local_app_index >= new_local_entries_begin && local_app_index < new_local_entries_end)
195 for (
const auto & snapshot : solution_container.
getSnapshots())
197 DenseVector<Real> serialized_solution;
200 snapshot.localize(serialized_solution.get_values(),
202 : std::vector<dof_id_type>());
214 return variable.
sys();
registerMooseObject("StochasticToolsApp", SerializedSolutionTransfer)
T & getUserObject(const std::string &name, unsigned int tid=0) const
const std::shared_ptr< MultiApp > getFromMultiApp() const
const Snapshots & getSnapshots() const
Return the whole snapshot container.
void initializeInNormalMode()
Initializes the solution container if the multiapp is run in normal mode.
void addEntry(const VariableName &vname, unsigned int global_i, const DenseVector< Real > &solution)
Add a new solution entry to the container.
SerializedSolutionTransfer(const InputParameters ¶meters)
void initializeInBatchMode()
This routine queries the solution container addresses from the subapps.
processor_id_type rank() const
dof_id_type getLocalRowBegin() const
const Parallel::Communicator & comm() const
FEProblemBase & _fe_problem
void linearPartitionItems(dof_id_type num_items, dof_id_type num_chunks, dof_id_type chunk_id, dof_id_type &num_local_items, dof_id_type &local_items_begin, dof_id_type &local_items_end)
dof_id_type getNumberOfLocalRows() const
const bool _serialize_on_root
User-selected switch that determines if we want to serialize on the root of the subapp only or distri...
void transferInParallel(FEProblemBase &app_problem, SolutionContainer &solution_container, const dof_id_type global_i)
Serialize on methodically determined rank of the subapp and transfer to the main application.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
processor_id_type size() const
virtual void execute() override
const std::vector< dof_id_type > & getVariableGlobalDoFs()
void paramError(const std::string ¶m, Args... args) const
static InputParameters validParams()
void executeFromMultiapp() override
void transferToSubAppRoot(FEProblemBase &app_problem, SolutionContainer &solution_container, const dof_id_type global_i)
Serialize on the root processor of the subapplication and transfer the result to the main application...
SystemBase & getSystem(FEProblemBase &app_problem, const VariableName &vname)
Return the system which contains the given variable.
bool hasToMultiApp() const
virtual void initialSetup() override
ParallelSolutionStorage * _parallel_storage
The storage on the main application where the serialized solutions should be transferred.
void setVariableGlobalDoFs(const std::string &var_name)
This class is responsible for collecting solution vectors in one place.
std::vector< VariableName > _variable_names
The names of the variables which should be extracted from the solution vector.
This class is responsible for serializing solutions coming from subapps on specific processors...
A Reporter which stores serialized solution fields for given variables in a distributed fashion...
std::vector< SolutionContainer * > _solution_container
Link to the storage spaces on the subapplications (will only hold one in batch mode) ...