18 #include "libmesh/meshfree_interpolation.h" 19 #include "libmesh/system.h" 28 "Transfers postprocessor data between the master application and sub-application(s).");
31 "The name of the Postprocessor in the Master to transfer the value from.");
34 "The name of the Postprocessor in the MultiApp to transfer the value to. " 35 " This should most likely be a Reporter Postprocessor.");
36 MooseEnum reduction_type(
"average sum maximum minimum");
39 "The type of reduction to perform to reduce postprocessor " 40 "values from multiple SubApps to a single value");
48 _from_pp_name(getParam<PostprocessorName>(
"from_postprocessor")),
49 _to_pp_name(getParam<PostprocessorName>(
"to_postprocessor")),
50 _reduction_type(getParam<
MooseEnum>(
"reduction_type"))
53 paramError(
"direction",
"This transfer is only unidirectional");
57 mooseError(
"In MultiAppPostprocessorTransfer, must specify 'reduction_type' if direction = " 62 mooseError(
"Reductions are not supported for multiapp sibling transfers");
68 TIME_SECTION(
"MultiAppPostprocessorTransfer::execute()", 5,
"Transferring a postprocessor");
104 "Source and target app parallel distribution must be the same");
127 for (
unsigned int i = 0; i <
getToMultiApp()->numGlobalApps(); i++)
136 Real reduced_pp_value;
141 reduced_pp_value = 0;
151 "Can't get here unless someone adds a new enum and fails to add it to this switch");
156 for (
unsigned int i = 0; i < multi_app->numGlobalApps(); i++)
158 if (multi_app->hasLocalApp(i) && multi_app->isRootProcessor())
160 const Real & curr_pp_value =
161 multi_app->appProblemBase(i).getPostprocessorValueByName(
_from_pp_name);
166 reduced_pp_value += curr_pp_value;
169 reduced_pp_value =
std::max(curr_pp_value, reduced_pp_value);
172 reduced_pp_value =
std::min(curr_pp_value, reduced_pp_value);
175 mooseError(
"Can't get here unless someone adds a new enum and fails to add it to " 185 reduced_pp_value /=
static_cast<Real>(multi_app->numGlobalApps());
198 "Can't get here unless someone adds a new enum and fails to add it to this switch");
217 mooseError(
"Child application allocation on parallel processes must be the same to support " 218 "siblings postprocessor transfer");
224 mooseError(
"Number of source and target child apps must either match or only a single source " virtual void checkSiblingsTransferSupported() const override
Siblings transfers only supported for a single origin app.
const ExecFlagType EXEC_TRANSFER
const std::shared_ptr< MultiApp > getFromMultiApp() const
Get the MultiApp to transfer data from.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
MooseEnum _current_direction
PostprocessorName _from_pp_name
Name of the postprocessor to transfer data from.
void setPostprocessorValueByName(const PostprocessorName &name, const PostprocessorValue &value, std::size_t t_index=0)
Set the value of a PostprocessorValue.
registerMooseObject("MooseApp", MultiAppPostprocessorTransfer)
static void addUserObjectExecutionCheckParam(InputParameters ¶ms)
Add the execution order check parameter (to skip the warning if needed)
MultiAppPostprocessorTransfer(const InputParameters ¶meters)
static InputParameters validParams()
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
void checkParentAppUserObjectExecuteOn(const std::string &object_name) const
Checks the execute_on flags for user object transfers with user objects on the source app which is al...
FEProblemBase & _fe_problem
const std::shared_ptr< MultiApp > getToMultiApp() const
Get the MultiApp to transfer data to.
const Parallel::Communicator & _communicator
bool hasFromMultiApp() const
Whether the transfer owns a non-null from_multi_app.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
auto max(const L &left, const R &right)
void errorIfObjectExecutesOnTransferInSourceApp(const std::string &object_name) const
Error if executing this MooseObject on EXEC_TRANSFER in a source multiapp (from_multiapp, e.g.
void min(const T &r, T &o, Request &req) const
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
static InputParameters validParams()
const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name, std::size_t t_index=0) const
Get a read-only reference to the value associated with a Postprocessor that exists.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MultiMooseEnum _directions
The directions this Transfer is to be executed on.
void max(const T &r, T &o, Request &req) const
Base class for all MultiAppTransfer objects.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
MooseEnum _reduction_type
Reduction operation to perform when transferring from multiple child apps to the parent app...
PostprocessorName _to_pp_name
Name of the postprocessor to transfer data to.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
virtual void computeUserObjectByName(const ExecFlagType &type, const Moose::AuxGroup &group, const std::string &name)
Compute an user object with the given name.
auto min(const L &left, const R &right)
Copies the value of a Postprocessor either:
virtual void execute() override
Execute the transfer.
virtual bool isValid() const override
IsValid.