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");
46 _from_pp_name(getParam<PostprocessorName>(
"from_postprocessor")),
47 _to_pp_name(getParam<PostprocessorName>(
"to_postprocessor")),
48 _reduction_type(getParam<
MooseEnum>(
"reduction_type"))
51 paramError(
"direction",
"This transfer is only unidirectional");
55 mooseError(
"In MultiAppPostprocessorTransfer, must specify 'reduction_type' if direction = " 60 mooseError(
"Reductions are not supported for multiapp sibling transfers");
66 TIME_SECTION(
"MultiAppPostprocessorTransfer::execute()", 5,
"Transferring a postprocessor");
87 "Source and target app parallel distribution must be the same");
110 for (
unsigned int i = 0; i <
getToMultiApp()->numGlobalApps(); i++)
119 Real reduced_pp_value;
124 reduced_pp_value = 0;
134 "Can't get here unless someone adds a new enum and fails to add it to this switch");
139 for (
unsigned int i = 0; i < multi_app->numGlobalApps(); i++)
141 if (multi_app->hasLocalApp(i) && multi_app->isRootProcessor())
143 const Real & curr_pp_value =
144 multi_app->appProblemBase(i).getPostprocessorValueByName(
_from_pp_name);
149 reduced_pp_value += curr_pp_value;
152 reduced_pp_value =
std::max(curr_pp_value, reduced_pp_value);
155 reduced_pp_value =
std::min(curr_pp_value, reduced_pp_value);
158 mooseError(
"Can't get here unless someone adds a new enum and fails to add it to " 168 reduced_pp_value /=
static_cast<Real>(multi_app->numGlobalApps());
181 "Can't get here unless someone adds a new enum and fails to add it to this switch");
200 mooseError(
"Child application allocation on parallel processes must be the same to support " 201 "siblings postprocessor transfer");
207 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 std::shared_ptr< MultiApp > getFromMultiApp() const
Get the MultiApp to transfer data from.
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)
MultiAppPostprocessorTransfer(const InputParameters ¶meters)
static InputParameters validParams()
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
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)
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
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...
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 ...
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)
MooseEnum _reduction_type
Reduction operation to perform when transferring from multiple child apps to the parent app...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
PostprocessorName _to_pp_name
Name of the postprocessor to transfer data to.
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.