19#include "libmesh/meshfree_interpolation.h"
20#include "libmesh/system.h"
30 "variable from different applications.");
32 "The name of the scalar variable to "
33 "transfer the value from.");
35 "The name of the scalar auxiliary variable to "
36 "transfer the value to.");
43 _from_variable_name(getParam<VariableName>(
"source_variable")),
44 _to_aux_name(getParam<VariableName>(
"to_aux_scalar"))
47 paramError(
"direction",
"This transfer is only unidirectional");
54 "MultiAppScalarToAuxScalarTransfer::execute()", 5,
"Performing a scalar variable transfer");
68 for (
unsigned int i = 0; i <
getToMultiApp()->numGlobalApps(); i++)
79 auto & from_values = from_variable->
sln();
82 if (from_variable->
sln().size() != to_variable->
sln().size())
83 mooseError(
"Order of SCALAR variables do not match for sending and "
84 "receiving data for the "
85 "MultiAppScalarToAuxScalarTransfer!");
87 for (MooseIndex(from_values) j = 0; j < from_values.size(); ++j)
119 auto & from_values = from_variable->
sln();
122 if (from_variable->
sln().size() != to_variable->
sln().size())
123 mooseError(
"Order of SCALAR variables do not match for sending and "
124 "receiving data for the "
125 "MultiAppScalarToAuxScalarTransfer!");
127 for (MooseIndex(from_values) j = 0; j < from_values.size(); ++j)
160 auto & from_values = from_variable->
sln();
163 if (from_variable->
sln().size() != to_variable->
sln().size())
164 mooseError(
"Order of SCALAR variables do not match for sending and "
165 "receiving data for the "
166 "MultiAppScalarToAuxScalarTransfer!");
168 for (MooseIndex(from_values) k = 0; k < from_values.size(); ++k)
187 for (
const auto i : make_range(
getToMultiApp()->numGlobalApps()))
189 mooseError(
"Child application allocation on parallel processes must be the same to support "
190 "siblings scalar variable transfer");
193 mooseError(
"Number of source and target child apps must match for siblings transfer");
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
registerMooseObject("MooseApp", MultiAppScalarToAuxScalarTransfer)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
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 ...
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
SystemBase & sys()
Get the system this variable is part of.
Class for scalar variables (they are different).
const VariableValue & sln() const
void reinit(bool reinit_for_derivative_reordering=false)
Fill out the VariableValue arrays from the system solution vector.
Copies the value of a SCALAR variable from one App to another.
VariableName _to_aux_name
The name of the auxiliary scalar variable to which the scalar values are being transfered.
virtual void checkSiblingsTransferSupported() const override
Whether the transfer supports siblings transfer.
virtual void execute() override
Execute the transfer.
static InputParameters validParams()
VariableName _from_variable_name
The name of the scalar variable from which the values are being transfered.
MultiAppScalarToAuxScalarTransfer(const InputParameters ¶meters)
Base class for all MultiAppTransfer objects.
const std::shared_ptr< MultiApp > getToMultiApp() const
Get the MultiApp to transfer data to.
static InputParameters validParams()
const std::shared_ptr< MultiApp > getFromMultiApp() const
Get the MultiApp to transfer data from.
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
NumericVector< Number > & solution()
MultiMooseEnum _directions
The directions this Transfer is to be executed on.
MooseEnum _current_direction
virtual void set(const numeric_index_type i, const T value)=0