22 SCMPinSolutionTransfer,
35 "The auxiliary variables to transfer.");
36 MooseEnum transfer_type(
"subchannel pin",
"subchannel");
39 "Whether to transfer subchannel-centered or pin-centered fields.");
41 "Transfers subchannel or pin solutions from a SubChannel mesh onto a visualization mesh.");
47 _var_names(getParam<
std::vector<AuxVariableName>>(
"variable")),
48 _pin_transfer(getParam<
MooseEnum>(
"transfer_type") ==
"pin")
51 paramError(
"from_multiapp",
"This transfer works only into multi-app.");
58 for (std::size_t var_index = 0; var_index <
_var_names.size(); ++var_index)
64 0,
_var_names[var_index], Moose::VarKindType::VAR_ANY, Moose::VarFieldType::VAR_FIELD_ANY);
65 const auto & fe_type = from_var.
feType();
69 "This transfer requires a first order Lagrange variable for the source variable");
72 0,
_var_names[var_index], Moose::VarKindType::VAR_ANY, Moose::VarFieldType::VAR_FIELD_ANY);
73 const auto & fe_type_target = to_var.
feType();
75 if (fe_type_target.family !=
LAGRANGE || fe_type_target.order !=
FIRST)
77 "This transfer requires a first order Lagrange variable for the source variable");
85 "MultiAppDetailedSolutionBaseTransfer::execute()", 5,
"Transferring subchannel solutions");
103 mooseAssert(
_from_meshes.size() == 1,
"Only one source mesh can be active in this transfer.");
105 if (from_mesh ==
nullptr)
106 mooseError(
"This transfer works only with SubChannelMesh classes.");
109 "This transfer was configured for pin variables, but the source mesh has no pin mesh.");
111 for (
unsigned int i = 0; i <
getToMultiApp()->numGlobalApps(); i++)
137 for (
auto & node :
mesh->getMesh().local_node_ptr_range())
145 System * to_sys =
find_sys(to_problem.
es(), var_name);
146 unsigned int to_sys_num = to_sys->
number();
147 unsigned int to_var_num = to_sys->variable_number(var_name);
149 if (node->n_dofs(to_sys_num, to_var_num) > 0)
151 System * from_sys =
find_sys(from_problem.
es(), var_name);
152 unsigned int from_sys_num = from_sys->
number();
153 unsigned int from_var_num = from_sys->variable_number(var_name);
157 NumericVector<Real> * from_solution = from_sys->solution.get();
158 dof_id_type from_dof = from_node->dof_number(from_sys_num, from_var_num, 0);
159 Real from_value = (*from_solution)(from_dof);
162 NumericVector<Real> & to_solution =
getToMultiApp()->appTransferVector(app_idx, var_name);
163 dof_id_type to_dof = node->dof_number(to_sys_num, to_var_num, 0);
164 to_solution.set(to_dof, from_value);
171 getToMultiApp()->appTransferVector(app_idx, var_name).close();
172 find_sys(to_problem.
es(), var_name)->update();
179 unsigned int sch_idx =
181 unsigned iz = from_mesh.
getZIndex(src_node);
virtual void execute() override
virtual unsigned int pinIndex(const Point &p) const =0
const libMesh::FEType & feType() const
void paramError(const std::string ¶m, Args... args) const
MooseEnum _current_direction
void transferVarsToApp(unsigned int app_idx)
static InputParameters validParams()
virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const =0
Get the pin mesh node for a given pin index and elevation index.
const std::vector< AuxVariableName > & _var_names
Variable names to transfer.
void initialSetup() override
std::vector< FEProblemBase *> _to_problems
const Parallel::Communicator & comm() const
const std::shared_ptr< MultiApp > getToMultiApp() const
bool _displaced_target_mesh
bool contains(const std::string &value) const
unsigned int number() const
std::vector< MooseMesh *> _from_meshes
SCMSolutionTransfer(const InputParameters ¶meters)
Transfers subchannel and pin solutions from a SubChannel mesh onto a visualization mesh...
void initialSetup() override
Node * getFromNode(const SubChannelMesh &from_mesh, const Point &src_node)
virtual libMesh::EquationSystems & es() override
static libMesh::System * find_sys(libMesh::EquationSystems &es, const std::string &var_name)
registerMooseObjectRenamed("SubChannelApp", SolutionTransfer, "06/30/2027 24:00", SCMSolutionTransfer)
void transferNodalVars(unsigned int app_idx)
virtual Node * getChannelNode(unsigned int i_chan, unsigned int iz) const =0
Get the subchannel mesh node for a given channel index and elevation index.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const=0
static InputParameters validParams()
const bool _pin_transfer
Whether pin fields should be transferred instead of subchannel fields.
virtual unsigned int channelIndex(const Point &point) const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MultiMooseEnum _directions
registerMooseObject("SubChannelApp", SCMSolutionTransfer)
virtual MooseMesh & mesh() override
void mooseError(Args &&... args) const
Base class for subchannel meshes.
processor_id_type processor_id() const
virtual void getAppInfo()
virtual unsigned int getZIndex(const Point &point) const
Get axial index of point.
std::vector< FEProblemBase *> _from_problems
void transferToMultiApps()