25 "Creates a full-solve type sub-application for each row of a Sampler matrix. " 26 "On second call, this object creates residuals for a PODReducedBasisTrainer with given basis " 29 "trainer_name",
"Trainer object that contains the solutions for different samples.");
38 _snapshot_generation(true)
40 if (getParam<unsigned int>(
"max_procs_per_app") != 1)
41 paramError(
"max_procs_per_app",
" does not support more than one processors per subapp!");
45 " needs to be run with fewer processors (detected ",
47 ") than samples (detected ",
61 "There are no basis vectors available for residual generation." 62 " This indicates that the bases have not been created yet." 63 " The most common cause of this error is the wrong setting" 64 " of the 'execute_on' flags in the PODFullSolveMultiApp and/or PODReducedBasisTrainer.");
79 bool last_solve_converged =
true;
97 return last_solve_converged;
113 mooseCheckMPIErr(ierr);
125 std::set<TagID> tags_to_compute;
126 for (
auto & tag_name : trainer_tags)
148 std::vector<std::shared_ptr<PODSamplerSolutionTransfer>> to_transfers =
150 std::vector<std::shared_ptr<PODResidualTransfer>> from_transfers =
154 for (
auto transfer : to_transfers)
155 transfer->initializeToMultiapp();
157 for (
auto transfer : from_transfers)
158 transfer->initializeFromMultiapp();
165 for (
dof_id_type i = local_base_begin; i < local_base_end; ++i)
167 for (
auto & transfer : to_transfers)
169 transfer->setGlobalMultiAppIndex(i);
170 transfer->executeToMultiapp();
175 for (
auto & transfer : from_transfers)
177 transfer->setGlobalMultiAppIndex(i);
178 transfer->executeFromMultiapp();
196 for (
auto transfer : to_transfers)
197 transfer->finalizeToMultiapp();
198 for (
auto transfer : from_transfers)
199 transfer->finalizeFromMultiapp();
202 std::vector<std::shared_ptr<PODSamplerSolutionTransfer>>
205 std::vector<std::shared_ptr<PODSamplerSolutionTransfer>> output;
212 output.push_back(ptr);
217 std::vector<std::shared_ptr<PODResidualTransfer>>
220 std::vector<std::shared_ptr<PODResidualTransfer>> output;
227 output.push_back(ptr);
const StochasticTools::MultiAppMode _mode
The Sup-application solve mode.
virtual TagID getVectorTagID(const TagName &tag_name) const
virtual void initialSetup() override
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
std::vector< std::shared_ptr< PODResidualTransfer > > getActiveResidualTransfers(Transfer::DIRECTION direction)
Returning pointers to the solution transfers. Used in batch mode.
Transfer solutions from sub-applications to a container in a Trainer.
std::vector< std::shared_ptr< MooseApp > > _apps
std::vector< std::shared_ptr< PODSamplerSolutionTransfer > > getActiveSolutionTransfers(Transfer::DIRECTION direction)
Returning pointers to the solution transfers. Used in batch mode.
dof_id_type _local_batch_app_index
Counter for extracting command line arguments in batch mode.
virtual void preTransfer(Real dt, Real target_time) override
Overriding preTransfer to reinit the subappliations if the object needs to be executed twice...
const Parallel::Communicator & _communicator
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)
FEProblemBase & _fe_problem
virtual void computeResidualTags(const std::set< TagID > &tags)
static InputParameters validParams()
processor_id_type n_processors() const
const std::vector< std::shared_ptr< Transfer > > & getActiveObjects(THREAD_ID tid=0) const
void setCurrentNonlinearSystem(const unsigned int nl_sys_num)
Transfers residuals for given variables and vector tags from a sub-subapplication to a PODReducedBasi...
Sampler & _sampler
Sampler to utilize for creating MultiApps.
const std::vector< std::string > & getTagNames() const
bool _snapshot_generation
Switch used to differentiate between snapshot generation and residual computation.
const std::string & type() const
void paramError(const std::string ¶m, Args... args) const
const LocalRankConfig & getRankConfig(bool batch_mode) const
PODFullSolveMultiApp(const InputParameters ¶meters)
virtual void resetApp(unsigned int global_app, Real time=0.0)
static InputParameters validParams()
dof_id_type getLocalRowEnd() const
unsigned int _my_num_apps
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
dof_id_type getNumberOfRows() const
const ExecuteMooseObjectWarehouse< Transfer > & getMultiAppTransferWarehouse(Transfer::DIRECTION direction) const
virtual void preTransfer(Real dt, Real target_time) override
Interface for objects that need to use samplers.
virtual void restore(bool force=true) override
PODReducedBasisTrainer & _trainer
Pointer to the trainer object itself.
registerMooseObject("StochasticToolsApp", PODFullSolveMultiApp)
void mooseError(Args &&... args) const
void init(unsigned int num_apps, bool batch_mode=false)
void computeResidualBatch(Real target_time)
Evaluating the residuals for every tag in the trainer in batch mode.
processor_id_type processor_id() const
unsigned int getSumBaseSize() const
Getting the overall base size, which is the sum of the individual bases.
void computeResidual()
Evaluating the residuals for every tag in the trainer.