10#ifdef MOOSE_MFEM_ENABLED
15#include "libmesh/int_range.h"
22 "Variable(s) to store transferred values in.");
24 "Variable(s) to transfer from.");
30 _from_var_names(getParam<
std::vector<VariableName>>(
"source_variables")),
31 _to_var_names(getParam<
std::vector<VariableName>>(
"variables"))
34 paramError(
"source_variables",
"Number of variables transferred must be same in both systems.");
40 TIME_SECTION(
"MFEMMultiAppTransfer::execute", 5,
"Perform transfer to and/or from subapps.");
44 for (
const auto i : make_range(
getToMultiApp()->numGlobalApps()))
62 bool transfers_done =
false;
63 for (
const auto from_app_id : make_range(
getFromMultiApp()->numGlobalApps()))
65 for (
const auto to_app_id : make_range(
getToMultiApp()->numGlobalApps()))
67 bool is_target_local =
getToMultiApp()->hasLocalApp(to_app_id);
72 transfers_done |= is_target_local;
75 mooseError(
"BETWEEN_MULTIAPP transfer not supported if there is not at least one subapp "
76 "per multiapp involved on each rank");
87 mooseError(
"No displaced problem to provide a displaced equation system");
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual libMesh::EquationSystems & es() override
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
void setActiveFromProblem(FEProblemBase &from_problem, const unsigned int global_app_index)
Set current problem to fetch source variables from.
void setActiveToProblem(FEProblemBase &to_problem, const unsigned int global_app_index)
Set current problem to fetch destination variables from.
unsigned int numToVar() const
Return for the number of destination variables.
MFEMMultiAppTransfer(InputParameters const ¶ms)
static InputParameters validParams()
virtual void transferVariables(bool is_target_local)=0
Transfer all variables from active source problem to active destination problem.
libMesh::EquationSystems & getlibMeshEquationSystem(FEProblemBase &problem, bool use_displaced) const
Get libMesh EquationSystem, which may or may not be displaced.
void execute() override
Set active source and destination problems, and execute variable transfer.
unsigned int numFromVar() const
Return the number of source variables.
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 ...
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.
MooseEnum _current_direction