https://mooseframework.inl.gov
MultiAppUserObjectTransfer.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "MooseAppCoordTransform.h"
12 
13 #include <limits>
14 
15 // MOOSE includes
16 #include "DisplacedProblem.h"
17 #include "FEProblem.h"
18 #include "MooseMesh.h"
19 #include "MooseTypes.h"
20 #include "MooseVariableFE.h"
21 #include "MultiApp.h"
22 #include "UserObject.h"
23 
24 // libMesh
25 #include "libmesh/meshfree_interpolation.h"
26 #include "libmesh/system.h"
27 #include "libmesh/mesh_function.h"
28 #include "libmesh/mesh_tools.h"
29 
30 registerMooseObjectDeprecated("MooseApp", MultiAppUserObjectTransfer, "12/31/2024 24:00");
31 
34 {
36  // MultiAppUserObjectTransfer does not need source variable since it query values from user
37  // objects
38  params.set<std::vector<VariableName>>("source_variable") = std::vector<VariableName>{};
39  params.suppressParameter<std::vector<VariableName>>("source_variable");
40  params.addRequiredParam<UserObjectName>(
41  "user_object",
42  "The UserObject you want to transfer values from. Note: This might be a "
43  "UserObject from your MultiApp's input file!");
44  params.addParam<bool>("all_parent_nodes_contained_in_sub_app",
45  false,
46  "Set to true if every parent app node is mapped to a distinct point on one "
47  "of the subApps during a transfer from sub App to Parent App. If parent app"
48  " node cannot be found within bounding boxes of any of the subApps, an "
49  " error is generated.");
50  params.addDeprecatedParam<bool>(
51  "all_master_nodes_contained_in_sub_app",
52  "Set to true if every parent app node is mapped to a distinct point on one "
53  "of the subApps during a transfer from sub App to Parent App. If parent app"
54  " node cannot be found within bounding boxes of any of the subApps, an "
55  " error is generated.",
56  "all_master_nodes_contained_in_sub_app is deprecated. Use "
57  "all_parent_nodes_contained_in_sub_app");
58  params.addParam<bool>(
59  "skip_bounding_box_check",
60  false,
61  "Skip the check if the to_elem is within the bounding box of the from_app.");
62  params.addParam<std::vector<SubdomainName>>(
63  "block", "The block we are transferring to (if not specified, whole domain is used).");
64  params.addParam<std::vector<BoundaryName>>(
65  "boundary",
66  "The boundary we are transferring to (if not specified, whole domain is used unless 'block' "
67  "parameter is used).");
68 
69  params.addClassDescription(
70  "Samples a variable's value in the Parent app domain at the point where the MultiApp is and "
71  "copies that value into a post-processor in the MultiApp");
72 
73  params.addParam<bool>("nearest_sub_app",
74  false,
75  "When True, a from_multiapp transfer will work by finding the nearest "
76  "(using the `location`) sub-app and query that for the value to transfer");
77  return params;
78 }
79 
81  : MultiAppConservativeTransfer(parameters),
82  _user_object_name(getParam<UserObjectName>("user_object")),
83  _all_parent_nodes_contained_in_sub_app(
84  isParamValid("all_master_nodes_contained_in_sub_app")
85  ? getParam<bool>("all_master_nodes_contained_in_sub_app")
86  : getParam<bool>("all_parent_nodes_contained_in_sub_app")),
87  _skip_bbox_check(getParam<bool>("skip_bounding_box_check")),
88  _nearest_sub_app(getParam<bool>("nearest_sub_app"))
89 {
90  mooseDeprecated("MultiAppUserObjectTransfer is deprecated. Use "
91  "MultiAppGeneralFieldUserObjectTransfer instead and adapt the parameters");
92 
93  // This transfer does not work with DistributedMesh
94  _fe_problem.mesh().errorIfDistributedMesh("MultiAppUserObjectTransfer");
95 
96  if (_to_var_names.size() != 1)
97  paramError("variable", " Support single to-variable only ");
98 
99  if (_from_var_names.size() > 0)
100  paramError("source_variable",
101  " You should not provide any source variables since the transfer takes values from "
102  "user objects ");
103 
104  if (isParamValid("block") && isParamValid("boundary"))
105  mooseError(name(), ": Transfer can be either block- or boundary-restricted. Not both.");
106 
107  if (isParamValid("to_multi_app") && isParamValid("from_multi_app") &&
109  paramError("to_multi_app",
110  "Sibling multiapp transfer has not been implemented for this transfer.");
111 }
112 
113 void
115 {
116  TIME_SECTION(
117  "MultiAppUserObjectTransfer::execute()", 5, "Performing transfer with a user object");
118 
119  getAppInfo();
120 
121  // Execute the user object if it was specified to execute on TRANSFER
122  switch (_current_direction)
123  {
124  case TO_MULTIAPP:
125  {
128  break;
129  }
130  case FROM_MULTIAPP:
132  }
133 
134  switch (_current_direction)
135  {
136  case TO_MULTIAPP:
137  {
138  for (unsigned int i = 0; i < getToMultiApp()->numGlobalApps(); i++)
139  {
140  if (getToMultiApp()->hasLocalApp(i))
141  {
143 
144  // Loop over the parent app nodes and set the value of the variable
145  System * to_sys = find_sys(getToMultiApp()->appProblemBase(i).es(), _to_var_name);
146 
147  unsigned int sys_num = to_sys->number();
148  unsigned int var_num = to_sys->variable_number(_to_var_name);
149 
150  NumericVector<Real> & solution = getToMultiApp()->appTransferVector(i, _to_var_name);
151 
152  MooseMesh * mesh = NULL;
153 
154  if (_displaced_target_mesh && getToMultiApp()->appProblemBase(i).getDisplacedProblem())
155  mesh = &getToMultiApp()->appProblemBase(i).getDisplacedProblem()->mesh();
156  else
157  mesh = &getToMultiApp()->appProblemBase(i).mesh();
158 
159  _blk_ids.clear();
160  _bnd_ids.clear();
161  if (isParamValid("block"))
162  {
163  const std::vector<SubdomainName> & blocks =
164  getParam<std::vector<SubdomainName>>("block");
165  for (const auto & b : blocks)
167  paramError("block", "The block '", b, "' was not found in the mesh");
168 
169  std::vector<SubdomainID> ids = mesh->getSubdomainIDs(blocks);
170  _blk_ids.insert(ids.begin(), ids.end());
171  }
172  else if (isParamValid("boundary"))
173  {
174  const std::vector<BoundaryName> & boundary_names =
175  getParam<std::vector<BoundaryName>>("boundary");
176  for (const auto & b : boundary_names)
178  paramError("boundary", "The boundary '", b, "' was not found in the mesh");
179 
180  std::vector<BoundaryID> ids = mesh->getBoundaryIDs(boundary_names, true);
181  _bnd_ids.insert(ids.begin(), ids.end());
182  }
183 
184  auto & fe_type = to_sys->variable_type(var_num);
185  bool is_constant = fe_type.order == CONSTANT;
186  bool is_nodal = fe_type.family == LAGRANGE;
187 
188  if (fe_type.order > FIRST && !is_nodal)
189  mooseError("We don't currently support second order or higher elemental variable ");
190 
191  const UserObject & user_object =
192  getToMultiApp()->problemBase().getUserObjectBase(_user_object_name);
193  mooseAssert(_from_transforms.size() == 1, "This should have size 1");
194  const auto & from_transform = *_from_transforms[0];
195  const auto & to_transform = *_to_transforms[i];
196 
197  if (is_nodal)
198  {
199  for (auto & node : mesh->getMesh().local_node_ptr_range())
200  {
201  if (blockRestricted() && !hasBlocks(mesh, node))
202  continue;
203 
204  if (boundaryRestricted() && !isBoundaryNode(mesh, node))
205  continue;
206 
207  if (node->n_dofs(sys_num, var_num) > 0) // If this variable has dofs at this node
208  {
209  // The zero only works for LAGRANGE!
210  dof_id_type dof = node->dof_number(sys_num, var_num, 0);
211 
212  swapper.forceSwap();
213  Real from_value =
214  user_object.spatialValue(from_transform.mapBack(to_transform(*node)));
215  swapper.forceSwap();
216 
217  solution.set(dof, from_value);
218  }
219  }
220  }
221  else // Elemental
222  {
223  std::vector<Point> points;
224  for (auto & elem : as_range(mesh->getMesh().local_elements_begin(),
225  mesh->getMesh().local_elements_end()))
226  {
227  if (blockRestricted() && !hasBlocks(elem))
228  continue;
229 
230  if (boundaryRestricted() && !isBoundaryElem(mesh, elem))
231  continue;
232 
233  // Skip this element if the variable has no dofs at it.
234  if (elem->n_dofs(sys_num, var_num) < 1)
235  continue;
236 
237  points.clear();
238  // grap sample points
239  // for constant shape function, we take the element centroid
240  if (is_constant)
241  points.push_back(elem->vertex_average());
242  // for higher order method, we take all nodes of element
243  // this works for the first order L2 Lagrange.
244  else
245  for (auto & node : elem->node_ref_range())
246  points.push_back(node);
247 
248  auto n_points = points.size();
249  unsigned int n_comp = elem->n_comp(sys_num, var_num);
250  // We assume each point corresponds to one component of elemental variable
251  if (n_points != n_comp)
252  mooseError(" Number of points ",
253  n_points,
254  " does not equal to number of variable components ",
255  n_comp);
256 
257  unsigned int offset = 0;
258  for (auto & point : points) // If this variable has dofs at this elem
259  {
260  dof_id_type dof = elem->dof_number(sys_num, var_num, offset++);
261 
262  swapper.forceSwap();
263  Real from_value =
264  user_object.spatialValue(from_transform.mapBack(to_transform(point)));
265  swapper.forceSwap();
266 
267  solution.set(dof, from_value);
268  }
269  }
270  }
271 
272  solution.close();
273  to_sys->update();
274  }
275  }
276 
277  break;
278  }
279  case FROM_MULTIAPP:
280  {
281  FEProblemBase & to_problem = getFromMultiApp()->problemBase();
282  mooseAssert(_to_transforms.size() == 1, "This should only be size one");
283  const auto & to_transform = *_to_transforms[0];
284  MooseVariableFEBase & to_var = to_problem.getVariable(
286  SystemBase & to_system_base = to_var.sys();
287 
288  System & to_sys = to_system_base.system();
289 
290  unsigned int to_sys_num = to_sys.number();
291 
292  // Only works with a serialized mesh to transfer to!
293  mooseAssert(to_sys.get_mesh().is_serial(),
294  "MultiAppUserObjectTransfer only works with ReplicatedMesh!");
295 
296  unsigned int to_var_num = to_sys.variable_number(to_var.name());
297 
298  // EquationSystems & to_es = to_sys.get_equation_systems();
299 
300  // Create a serialized version of the solution vector
301  NumericVector<Number> * to_solution = to_sys.solution.get();
302 
303  MooseMesh * to_mesh = NULL;
304 
305  if (_displaced_target_mesh && to_problem.getDisplacedProblem())
306  to_mesh = &to_problem.getDisplacedProblem()->mesh();
307  else
308  to_mesh = &to_problem.mesh();
309 
310  _blk_ids.clear();
311  _bnd_ids.clear();
312  if (isParamValid("block"))
313  {
314  const std::vector<SubdomainName> & blocks = getParam<std::vector<SubdomainName>>("block");
315  for (const auto & b : blocks)
316  if (!MooseMeshUtils::hasSubdomainName(*to_mesh, b))
317  paramError("block", "The block '", b, "' was not found in the mesh");
318 
319  std::vector<SubdomainID> ids = to_mesh->getSubdomainIDs(blocks);
320  _blk_ids.insert(ids.begin(), ids.end());
321  }
322  else if (isParamValid("boundary"))
323  {
324  const std::vector<BoundaryName> & boundary_names =
325  getParam<std::vector<BoundaryName>>("boundary");
326  for (const auto & b : boundary_names)
327  if (!MooseMeshUtils::hasBoundaryName(*to_mesh, b))
328  paramError("boundary", "The boundary '", b, "' was not found in the mesh");
329 
330  std::vector<BoundaryID> ids = to_mesh->getBoundaryIDs(boundary_names, true);
331  _bnd_ids.insert(ids.begin(), ids.end());
332  }
333 
334  auto & fe_type = to_sys.variable_type(to_var_num);
335  bool is_constant = fe_type.order == CONSTANT;
336  bool is_nodal = fe_type.family == LAGRANGE;
337 
338  if (fe_type.order > FIRST && !is_nodal)
339  mooseError("We don't currently support second order or higher elemental variable ");
340 
342  {
343  // check to see if parent app nodes or elements lies within any of the sub application
344  // bounding boxes
345  if (is_nodal)
346  {
347  for (auto & node : to_mesh->getMesh().node_ptr_range())
348  {
349  if (blockRestricted() && !hasBlocks(to_mesh, node))
350  continue;
351 
352  if (boundaryRestricted() && !isBoundaryNode(to_mesh, node))
353  continue;
354 
355  if (node->n_dofs(to_sys_num, to_var_num) > 0)
356  {
357  const auto transformed_node = to_transform(*node);
358 
359  unsigned int node_found_in_sub_app = 0;
360  for (unsigned int i = 0; i < getFromMultiApp()->numGlobalApps(); i++)
361  {
362  if (!getFromMultiApp()->hasLocalApp(i))
363  continue;
364 
365  BoundingBox app_box = getFromMultiApp()->getBoundingBox(
367 
368  if (app_box.contains_point(transformed_node))
369  ++node_found_in_sub_app;
370  }
371 
372  if (node_found_in_sub_app == 0)
373  mooseError("MultiAppUserObjectTransfer: Parent app node ",
374  transformed_node,
375  " not found within the bounding box of any of the sub applications.");
376  else if (node_found_in_sub_app > 1)
377  mooseError("MultiAppUserObjectTransfer: Parent app node ",
378  transformed_node,
379  " found within the bounding box of two or more sub applications.");
380  }
381  }
382  }
383  else // elemental
384  {
385  std::vector<Point> points;
386  for (auto & elem :
387  as_range(to_mesh->getMesh().elements_begin(), to_mesh->getMesh().elements_end()))
388  {
389  if (blockRestricted() && !hasBlocks(elem))
390  continue;
391 
392  if (boundaryRestricted() && !isBoundaryElem(to_mesh, elem))
393  continue;
394 
395  // Skip this element if the variable has no dofs at it.
396  if (elem->n_dofs(to_sys_num, to_var_num) < 1)
397  continue;
398 
399  points.clear();
400  // grap sample points
401  // for constant shape function, we take the element centroid
402  if (is_constant)
403  points.push_back(to_transform(elem->vertex_average()));
404  // for higher order method, we take all nodes of element
405  // this works for the first order L2 Lagrange.
406  else
407  for (auto & node : elem->node_ref_range())
408  points.push_back(to_transform(node));
409 
410  auto n_points = points.size();
411  unsigned int n_comp = elem->n_comp(to_sys_num, to_var_num);
412  // We assume each point corresponds to one component of elemental variable
413  if (n_points != n_comp)
414  mooseError(" Number of points ",
415  n_points,
416  " does not equal to number of variable components ",
417  n_comp);
418 
419  for (auto & point : points)
420  {
421  unsigned int elem_found_in_sub_app = 0;
422 
423  for (unsigned int i = 0; i < getFromMultiApp()->numGlobalApps(); i++)
424  {
425  if (!getFromMultiApp()->hasLocalApp(i))
426  continue;
427 
428  BoundingBox app_box = getFromMultiApp()->getBoundingBox(
430 
431  if (app_box.contains_point(point))
432  ++elem_found_in_sub_app;
433  }
434 
435  if (elem_found_in_sub_app == 0)
436  mooseError("MultiAppUserObjectTransfer: Parent app element with ",
437  n_points > 1 ? "node" : "centroid",
438  " at ",
439  point,
440  " not found within the bounding box of any of the sub applications.");
441 
442  else if (elem_found_in_sub_app > 1)
443  mooseError("MultiAppUserObjectTransfer: Parent app element with ",
444  n_points > 1 ? "node" : "centroid",
445  " at ",
446  point,
447  " found within the bounding box of two or more sub applications.");
448  }
449  }
450  }
451  }
452 
453  if (is_nodal)
454  {
455  for (auto & node : to_mesh->getMesh().node_ptr_range())
456  {
457  if (blockRestricted() && !hasBlocks(to_mesh, node))
458  continue;
459 
460  if (boundaryRestricted() && !isBoundaryNode(to_mesh, node))
461  continue;
462 
463  if (node->n_dofs(to_sys_num, to_var_num) > 0) // If this variable has dofs at this node
464  {
465  const auto transformed_node = to_transform(*node);
466  const auto sub_app = findSubAppToTransferFrom(transformed_node);
467 
468  // Check to see if a sub-app was found
469  if (sub_app == static_cast<unsigned int>(-1))
470  continue;
471 
472  const auto & from_transform = *_from_transforms[sub_app];
473  const auto & user_object = _multi_app->appUserObjectBase(sub_app, _user_object_name);
474 
475  dof_id_type dof = node->dof_number(to_sys_num, to_var_num, 0);
476 
477  Real from_value = 0;
478  {
480  from_value = user_object.spatialValue(from_transform.mapBack(transformed_node));
481  }
482 
483  if (from_value == std::numeric_limits<Real>::infinity())
484  mooseError("MultiAppUserObjectTransfer: Point corresponding to parent app node at (",
485  transformed_node,
486  ") not found in the sub application.");
487  to_solution->set(dof, from_value);
488  }
489  }
490  }
491  else // Elemental
492  {
493  std::vector<Point> points;
494  for (auto & elem :
495  as_range(to_mesh->getMesh().elements_begin(), to_mesh->getMesh().elements_end()))
496  {
497  if (blockRestricted() && !hasBlocks(elem))
498  continue;
499 
500  if (boundaryRestricted() && !isBoundaryElem(to_mesh, elem))
501  continue;
502 
503  // Skip this element if the variable has no dofs at it.
504  if (elem->n_dofs(to_sys_num, to_var_num) < 1)
505  continue;
506 
507  points.clear();
508  // grap sample points
509  // for constant shape function, we take the element centroid
510  if (is_constant)
511  points.push_back(to_transform(elem->vertex_average()));
512  // for higher order method, we take all nodes of element
513  // this works for the first order L2 Lagrange.
514  else
515  for (auto & node : elem->node_ref_range())
516  points.push_back(to_transform(node));
517 
518  auto n_points = points.size();
519  unsigned int n_comp = elem->n_comp(to_sys_num, to_var_num);
520  // We assume each point corresponds to one component of elemental variable
521  if (n_points != n_comp)
522  mooseError(" Number of points ",
523  n_points,
524  " does not equal to number of variable components ",
525  n_comp);
526 
527  unsigned int offset = 0;
528  for (auto & point : points) // If this variable has dofs at this elem
529  {
530  const auto sub_app = findSubAppToTransferFrom(point);
531 
532  // Check to see if a sub-app was found
533  if (sub_app == static_cast<unsigned int>(-1))
534  continue;
535 
536  const auto & from_transform = *_from_transforms[sub_app];
537  const auto & user_object =
538  getFromMultiApp()->appUserObjectBase(sub_app, _user_object_name);
539 
540  dof_id_type dof = elem->dof_number(to_sys_num, to_var_num, offset++);
541 
542  Real from_value = 0;
543  {
545  from_value = user_object.spatialValue(from_transform.mapBack(point));
546  }
547 
548  if (from_value == std::numeric_limits<Real>::infinity())
549  mooseError("MultiAppUserObjectTransfer: Point corresponding to element's centroid (",
550  point,
551  ") not found in sub application.");
552 
553  to_solution->set(dof, from_value);
554  }
555  }
556  }
557 
558  to_solution->close();
559  to_sys.update();
560 
561  break;
562  }
563  }
564 
565  postExecute();
566 }
567 
568 bool
570 {
571  return !_blk_ids.empty();
572 }
573 
574 bool
576 {
577  return !_bnd_ids.empty();
578 }
579 
580 bool
582 {
583  return _blk_ids.find(elem->subdomain_id()) != _blk_ids.end();
584 }
585 
586 bool
587 MultiAppUserObjectTransfer::hasBlocks(const MooseMesh * mesh, const Node * node) const
588 {
589  const auto & node_blk_ids = mesh->getNodeBlockIds(*node);
590  std::set<SubdomainID> u;
591  std::set_intersection(_blk_ids.begin(),
592  _blk_ids.end(),
593  node_blk_ids.begin(),
594  node_blk_ids.end(),
595  std::inserter(u, u.begin()));
596  return !u.empty();
597 }
598 
599 bool
600 MultiAppUserObjectTransfer::isBoundaryNode(const MooseMesh * mesh, const Node * node) const
601 {
602  for (auto & bid : _bnd_ids)
603  if (mesh->isBoundaryNode(node->id(), bid))
604  return true;
605  return false;
606 }
607 
608 bool
609 MultiAppUserObjectTransfer::isBoundaryElem(const MooseMesh * mesh, const Elem * elem) const
610 {
611  for (auto & bid : _bnd_ids)
612  if (mesh->isBoundaryElem(elem->id(), bid))
613  return true;
614  return false;
615 }
616 
617 unsigned int
619 {
620  // Just find the nearest app to this point
621  if (_nearest_sub_app)
622  {
623  unsigned int closest_app = 0;
624  Real closest_distance = std::numeric_limits<Real>::max();
625 
626  mooseAssert(_multi_app->numGlobalApps() > 0, "No Multiapps To Transfer From");
627 
628  for (unsigned int i = 0; i < _multi_app->numGlobalApps(); i++)
629  {
630  // Obtain the possibly transformed app position by querying the transform with the origin
631  const auto app_position = _multi_app->runningInPosition()
632  ? (*_from_transforms[i])(_multi_app->position(i))
633  : (*_from_transforms[i])(Point(0));
634 
635  auto distance = (p - app_position).norm();
636 
637  if (distance < closest_distance)
638  {
639  closest_app = i;
640  closest_distance = distance;
641  }
642  }
643 
644  // We can only get the value if we have this app
645  // otherwise - another processor will set it
646  if (_multi_app->hasLocalApp(closest_app))
647  return closest_app;
648  else
649  return -1;
650  }
651 
652  // Find the app that contains this point...
653 
654  // This loop counts _down_ so that it can preserve legacy behavior of the
655  // last sub-app "winning" to be able to set the value at this point
656  for (int i = _multi_app->numGlobalApps() - 1; i >= 0; i--)
657  {
658  if (!_multi_app->hasLocalApp(i))
659  continue;
660 
661  BoundingBox app_box =
662  _multi_app->getBoundingBox(i, _displaced_source_mesh, _from_transforms[i].get());
663 
664  if (_skip_bbox_check || app_box.contains_point(p))
665  return static_cast<unsigned int>(i);
666  }
667 
668  return -1;
669 }
LAGRANGE
std::vector< std::unique_ptr< MultiAppCoordTransform > > _to_transforms
const ExecFlagType EXEC_TRANSFER
Definition: Moose.C:53
bool hasBlocks(const Elem *elem) const
Check that element &#39;elem&#39; is part of the domain this transfer is restricted to.
bool isBoundaryElem(const MooseMesh *mesh, const Elem *elem) const
Check that the element belongs to boundary this transfer is restricted to.
static InputParameters validParams()
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void mooseDeprecated(Args &&... args) const
const std::shared_ptr< MultiApp > getFromMultiApp() const
Get the MultiApp to transfer data from.
bool hasBoundaryName(const MeshBase &input_mesh, const BoundaryName &name)
Whether a particular boundary name exists in the mesh.
const bool _all_parent_nodes_contained_in_sub_app
Boolean variable to generate error if every parent app node cannot be mapped to a subApp during from_...
MooseEnum _current_direction
Definition: Transfer.h:106
char ** blocks
virtual void get(const std::vector< numeric_index_type > &index, Number *values) const
bool isBoundaryNode(const MooseMesh *mesh, const Node *node) const
Check that the node belongs to boundary this transfer is restricted to.
FIRST
virtual void execute() override
Execute the transfer.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > _from_var_names
Name of variables transferring from.
MeshBase & mesh
const std::string & name() const override
Get the variable name.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Parallel::Communicator & comm() const
virtual void postExecute()
Add some extra work if necessary after execute().
FEProblemBase & _fe_problem
Definition: Transfer.h:97
const bool _skip_bbox_check
whether to check the bounding box check or not
const std::shared_ptr< MultiApp > getToMultiApp() const
Get the MultiApp to transfer data to.
This class provides an interface for common operations on field variables of both FE and FV types wit...
Base class for a system (of equations)
Definition: SystemBase.h:84
std::shared_ptr< MultiApp > _multi_app
Deprecated class attribute for compatibility with the apps.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Real distance(const Point &p)
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
Definition: MooseMesh.C:1734
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
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 override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
auto max(const L &left, const R &right)
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn&#39;t required or valid in the derived class...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
bool _displaced_target_mesh
True if displaced mesh is used for the target mesh, otherwise false.
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition: MooseMesh.C:3612
CONSTANT
unsigned int number() const
void forceSwap()
Forcibly swap the currently swapped-out communicator back in to libmesh.
Definition: Moose.h:278
void errorIfObjectExecutesOnTransferInSourceApp(const std::string &object_name) const
Error if executing this MooseObject on EXEC_TRANSFER in a source multiapp (from_multiapp, e.g.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3443
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
std::set< SubdomainID > _blk_ids
Set of block ids this transfer is restricted to.
const std::vector< AuxVariableName > _to_var_names
Name of variables transferring to.
static libMesh::System * find_sys(libMesh::EquationSystems &es, const std::string &var_name)
Small helper function for finding the system containing the variable.
Definition: Transfer.C:91
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
Transfers variables on possibly different meshes while conserving a user defined property (Postproces...
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
auto norm(const T &a) -> decltype(std::abs(a))
virtual void close()=0
bool hasSubdomainName(const MeshBase &input_mesh, const SubdomainName &name)
Whether a particular subdomain name exists in the mesh.
Loops over a target mesh and uses either node or element centroid location (based on the target varia...
const bool & _nearest_sub_app
Whether to utilize the nearest sub-app to transfer from.
virtual Real spatialValue(const Point &) const
Optional interface function for "evaluating" a UserObject at a spatial position.
Definition: UserObject.h:95
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
unsigned int findSubAppToTransferFrom(const Point &p)
Gets the UserObject to transfer from when transferring from_multiapp.
std::vector< std::unique_ptr< MultiAppCoordTransform > > _from_transforms
virtual MooseMesh & mesh() override
bool _displaced_source_mesh
True if displaced mesh is used for the source mesh, otherwise false.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
virtual void set(const numeric_index_type i, const Number value)=0
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...
virtual void computeUserObjectByName(const ExecFlagType &type, const Moose::AuxGroup &group, const std::string &name)
Compute an user object with the given name.
MultiAppUserObjectTransfer(const InputParameters &parameters)
virtual void getAppInfo()
This method will fill information into the convenience member variables (_to_problems, _from_meshes, etc.)
SystemBase & sys()
Get the system this variable is part of.
Base class for user-specific data.
Definition: UserObject.h:40
registerMooseObjectDeprecated("MooseApp", MultiAppUserObjectTransfer, "12/31/2024 24:00")
uint8_t dof_id_type