https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
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
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");
78
79 return params;
80}
81
83 : MultiAppConservativeTransfer(parameters),
84 _user_object_name(getParam<UserObjectName>("user_object")),
85 _all_parent_nodes_contained_in_sub_app(
86 isParamValid("all_master_nodes_contained_in_sub_app")
87 ? getParam<bool>("all_master_nodes_contained_in_sub_app")
88 : getParam<bool>("all_parent_nodes_contained_in_sub_app")),
89 _skip_bbox_check(getParam<bool>("skip_bounding_box_check")),
90 _nearest_sub_app(getParam<bool>("nearest_sub_app"))
91{
92 mooseDeprecated("MultiAppUserObjectTransfer is deprecated. Use "
93 "MultiAppGeneralFieldUserObjectTransfer instead and adapt the parameters");
94
95 // This transfer does not work with DistributedMesh
96 _fe_problem.mesh().errorIfDistributedMesh("MultiAppUserObjectTransfer");
97
98 if (_to_var_names.size() != 1)
99 paramError("variable", " Support single to-variable only ");
100
101 if (_from_var_names.size() > 0)
102 paramError("source_variable",
103 " You should not provide any source variables since the transfer takes values from "
104 "user objects ");
105
106 if (isParamValid("block") && isParamValid("boundary"))
107 mooseError(name(), ": Transfer can be either block- or boundary-restricted. Not both.");
108
109 if (isParamValid("to_multi_app") && isParamValid("from_multi_app") &&
111 paramError("to_multi_app",
112 "Sibling multiapp transfer has not been implemented for this transfer.");
113}
114
115void
117{
118 TIME_SECTION(
119 "MultiAppUserObjectTransfer::execute()", 5, "Performing transfer with a user object");
120
121 getAppInfo();
122
123 // Execute the user object if it was specified to execute on TRANSFER
124 switch (_current_direction)
125 {
126 case TO_MULTIAPP:
127 {
131 break;
132 }
133 case FROM_MULTIAPP:
135 }
136
137 switch (_current_direction)
138 {
139 case TO_MULTIAPP:
140 {
141 for (unsigned int i = 0; i < getToMultiApp()->numGlobalApps(); i++)
142 {
143 if (getToMultiApp()->hasLocalApp(i))
144 {
146
147 // Loop over the parent app nodes and set the value of the variable
148 System * to_sys = find_sys(getToMultiApp()->appProblemBase(i).es(), _to_var_name);
149
150 unsigned int sys_num = to_sys->number();
151 unsigned int var_num = to_sys->variable_number(_to_var_name);
152
153 NumericVector<Real> & solution = getToMultiApp()->appTransferVector(i, _to_var_name);
154
155 MooseMesh * mesh = NULL;
156
157 if (_displaced_target_mesh && getToMultiApp()->appProblemBase(i).getDisplacedProblem())
158 mesh = &getToMultiApp()->appProblemBase(i).getDisplacedProblem()->mesh();
159 else
160 mesh = &getToMultiApp()->appProblemBase(i).mesh();
161
162 _blk_ids.clear();
163 _bnd_ids.clear();
164 if (isParamValid("block"))
165 {
166 const std::vector<SubdomainName> & blocks =
167 getParam<std::vector<SubdomainName>>("block");
168 for (const auto & b : blocks)
170 paramError("block", "The block '", b, "' was not found in the mesh");
171
172 std::vector<SubdomainID> ids = mesh->getSubdomainIDs(blocks);
173 _blk_ids.insert(ids.begin(), ids.end());
174 }
175 else if (isParamValid("boundary"))
176 {
177 const std::vector<BoundaryName> & boundary_names =
178 getParam<std::vector<BoundaryName>>("boundary");
179 for (const auto & b : boundary_names)
181 paramError("boundary", "The boundary '", b, "' was not found in the mesh");
182
183 std::vector<BoundaryID> ids = mesh->getBoundaryIDs(boundary_names, true);
184 _bnd_ids.insert(ids.begin(), ids.end());
185 }
186
187 auto & fe_type = to_sys->variable_type(var_num);
188 bool is_constant = fe_type.order == CONSTANT;
189 bool is_nodal = fe_type.family == LAGRANGE;
190
191 if (fe_type.order > FIRST && !is_nodal)
192 mooseError("We don't currently support second order or higher elemental variable ");
193
194 const UserObject & user_object =
196 mooseAssert(_from_transforms.size() == 1, "This should have size 1");
197 const auto & from_transform = *_from_transforms[0];
198 const auto & to_transform = *_to_transforms[i];
199
200 if (is_nodal)
201 {
202 for (auto & node : mesh->getMesh().local_node_ptr_range())
203 {
204 if (blockRestricted() && !hasBlocks(mesh, node))
205 continue;
206
207 if (boundaryRestricted() && !isBoundaryNode(mesh, node))
208 continue;
209
210 if (node->n_dofs(sys_num, var_num) > 0) // If this variable has dofs at this node
211 {
212 // The zero only works for LAGRANGE!
213 dof_id_type dof = node->dof_number(sys_num, var_num, 0);
214
215 swapper.forceSwap();
216 Real from_value =
217 user_object.spatialValue(from_transform.mapBack(to_transform(*node)));
218 swapper.forceSwap();
219
220 solution.set(dof, from_value);
221 }
222 }
223 }
224 else // Elemental
225 {
226 std::vector<Point> points;
227 for (auto & elem : as_range(mesh->getMesh().local_elements_begin(),
228 mesh->getMesh().local_elements_end()))
229 {
230 if (blockRestricted() && !hasBlocks(elem))
231 continue;
232
233 if (boundaryRestricted() && !isBoundaryElem(mesh, elem))
234 continue;
235
236 // Skip this element if the variable has no dofs at it.
237 if (elem->n_dofs(sys_num, var_num) < 1)
238 continue;
239
240 points.clear();
241 // grap sample points
242 // for constant shape function, we take the element centroid
243 if (is_constant)
244 points.push_back(elem->vertex_average());
245 // for higher order method, we take all nodes of element
246 // this works for the first order L2 Lagrange.
247 else
248 for (auto & node : elem->node_ref_range())
249 points.push_back(node);
250
251 auto n_points = points.size();
252 unsigned int n_comp = elem->n_comp(sys_num, var_num);
253 // We assume each point corresponds to one component of elemental variable
254 if (n_points != n_comp)
255 mooseError(" Number of points ",
256 n_points,
257 " does not equal to number of variable components ",
258 n_comp);
259
260 unsigned int offset = 0;
261 for (auto & point : points) // If this variable has dofs at this elem
262 {
263 dof_id_type dof = elem->dof_number(sys_num, var_num, offset++);
264
265 swapper.forceSwap();
266 Real from_value =
267 user_object.spatialValue(from_transform.mapBack(to_transform(point)));
268 swapper.forceSwap();
269
270 solution.set(dof, from_value);
271 }
272 }
273 }
274
275 solution.close();
276 to_sys->update();
277 }
278 }
279
280 break;
281 }
282 case FROM_MULTIAPP:
283 {
284 FEProblemBase & to_problem = getFromMultiApp()->problemBase();
285 mooseAssert(_to_transforms.size() == 1, "This should only be size one");
286 const auto & to_transform = *_to_transforms[0];
287 MooseVariableFEBase & to_var = to_problem.getVariable(
289 SystemBase & to_system_base = to_var.sys();
290
291 System & to_sys = to_system_base.system();
292
293 unsigned int to_sys_num = to_sys.number();
294
295 // Only works with a serialized mesh to transfer to!
296 mooseAssert(to_sys.get_mesh().is_serial(),
297 "MultiAppUserObjectTransfer only works with ReplicatedMesh!");
298
299 unsigned int to_var_num = to_sys.variable_number(to_var.name());
300
301 // EquationSystems & to_es = to_sys.get_equation_systems();
302
303 // Create a serialized version of the solution vector
304 NumericVector<Number> * to_solution = to_sys.solution.get();
305
306 MooseMesh * to_mesh = NULL;
307
309 to_mesh = &to_problem.getDisplacedProblem()->mesh();
310 else
311 to_mesh = &to_problem.mesh();
312
313 _blk_ids.clear();
314 _bnd_ids.clear();
315 if (isParamValid("block"))
316 {
317 const std::vector<SubdomainName> & blocks = getParam<std::vector<SubdomainName>>("block");
318 for (const auto & b : blocks)
319 if (!MooseMeshUtils::hasSubdomainName(*to_mesh, b))
320 paramError("block", "The block '", b, "' was not found in the mesh");
321
322 std::vector<SubdomainID> ids = to_mesh->getSubdomainIDs(blocks);
323 _blk_ids.insert(ids.begin(), ids.end());
324 }
325 else if (isParamValid("boundary"))
326 {
327 const std::vector<BoundaryName> & boundary_names =
328 getParam<std::vector<BoundaryName>>("boundary");
329 for (const auto & b : boundary_names)
330 if (!MooseMeshUtils::hasBoundaryNameOrID(*to_mesh, b))
331 paramError("boundary", "The boundary '", b, "' was not found in the mesh");
332
333 std::vector<BoundaryID> ids = to_mesh->getBoundaryIDs(boundary_names, true);
334 _bnd_ids.insert(ids.begin(), ids.end());
335 }
336
337 auto & fe_type = to_sys.variable_type(to_var_num);
338 bool is_constant = fe_type.order == CONSTANT;
339 bool is_nodal = fe_type.family == LAGRANGE;
340
341 if (fe_type.order > FIRST && !is_nodal)
342 mooseError("We don't currently support second order or higher elemental variable ");
343
345 {
346 // check to see if parent app nodes or elements lies within any of the sub application
347 // bounding boxes
348 if (is_nodal)
349 {
350 for (auto & node : to_mesh->getMesh().node_ptr_range())
351 {
352 if (blockRestricted() && !hasBlocks(to_mesh, node))
353 continue;
354
355 if (boundaryRestricted() && !isBoundaryNode(to_mesh, node))
356 continue;
357
358 if (node->n_dofs(to_sys_num, to_var_num) > 0)
359 {
360 const auto transformed_node = to_transform(*node);
361
362 unsigned int node_found_in_sub_app = 0;
363 for (unsigned int i = 0; i < getFromMultiApp()->numGlobalApps(); i++)
364 {
365 if (!getFromMultiApp()->hasLocalApp(i))
366 continue;
367
368 BoundingBox app_box = getFromMultiApp()->getBoundingBox(
370
371 if (app_box.contains_point(transformed_node))
372 ++node_found_in_sub_app;
373 }
374
375 if (node_found_in_sub_app == 0)
376 mooseError("MultiAppUserObjectTransfer: Parent app node ",
377 transformed_node,
378 " not found within the bounding box of any of the sub applications.");
379 else if (node_found_in_sub_app > 1)
380 mooseError("MultiAppUserObjectTransfer: Parent app node ",
381 transformed_node,
382 " found within the bounding box of two or more sub applications.");
383 }
384 }
385 }
386 else // elemental
387 {
388 std::vector<Point> points;
389 for (auto & elem :
390 as_range(to_mesh->getMesh().elements_begin(), to_mesh->getMesh().elements_end()))
391 {
392 if (blockRestricted() && !hasBlocks(elem))
393 continue;
394
395 if (boundaryRestricted() && !isBoundaryElem(to_mesh, elem))
396 continue;
397
398 // Skip this element if the variable has no dofs at it.
399 if (elem->n_dofs(to_sys_num, to_var_num) < 1)
400 continue;
401
402 points.clear();
403 // grap sample points
404 // for constant shape function, we take the element centroid
405 if (is_constant)
406 points.push_back(to_transform(elem->vertex_average()));
407 // for higher order method, we take all nodes of element
408 // this works for the first order L2 Lagrange.
409 else
410 for (auto & node : elem->node_ref_range())
411 points.push_back(to_transform(node));
412
413 auto n_points = points.size();
414 unsigned int n_comp = elem->n_comp(to_sys_num, to_var_num);
415 // We assume each point corresponds to one component of elemental variable
416 if (n_points != n_comp)
417 mooseError(" Number of points ",
418 n_points,
419 " does not equal to number of variable components ",
420 n_comp);
421
422 for (auto & point : points)
423 {
424 unsigned int elem_found_in_sub_app = 0;
425
426 for (unsigned int i = 0; i < getFromMultiApp()->numGlobalApps(); i++)
427 {
428 if (!getFromMultiApp()->hasLocalApp(i))
429 continue;
430
431 BoundingBox app_box = getFromMultiApp()->getBoundingBox(
433
434 if (app_box.contains_point(point))
435 ++elem_found_in_sub_app;
436 }
437
438 if (elem_found_in_sub_app == 0)
439 mooseError("MultiAppUserObjectTransfer: Parent app element with ",
440 n_points > 1 ? "node" : "centroid",
441 " at ",
442 point,
443 " not found within the bounding box of any of the sub applications.");
444
445 else if (elem_found_in_sub_app > 1)
446 mooseError("MultiAppUserObjectTransfer: Parent app element with ",
447 n_points > 1 ? "node" : "centroid",
448 " at ",
449 point,
450 " found within the bounding box of two or more sub applications.");
451 }
452 }
453 }
454 }
455
456 if (is_nodal)
457 {
458 for (auto & node : to_mesh->getMesh().node_ptr_range())
459 {
460 if (blockRestricted() && !hasBlocks(to_mesh, node))
461 continue;
462
463 if (boundaryRestricted() && !isBoundaryNode(to_mesh, node))
464 continue;
465
466 if (node->n_dofs(to_sys_num, to_var_num) > 0) // If this variable has dofs at this node
467 {
468 const auto transformed_node = to_transform(*node);
469 const auto sub_app = findSubAppToTransferFrom(transformed_node);
470
471 // Check to see if a sub-app was found
472 if (sub_app == static_cast<unsigned int>(-1))
473 continue;
474
475 const auto & from_transform = *_from_transforms[sub_app];
476 const auto & user_object = _multi_app->appUserObjectBase(sub_app, _user_object_name);
477
478 dof_id_type dof = node->dof_number(to_sys_num, to_var_num, 0);
479
480 Real from_value = 0;
481 {
483 from_value = user_object.spatialValue(from_transform.mapBack(transformed_node));
484 }
485
486 if (from_value == std::numeric_limits<Real>::infinity())
487 mooseError("MultiAppUserObjectTransfer: Point corresponding to parent app node at (",
488 transformed_node,
489 ") not found in the sub application.");
490 to_solution->set(dof, from_value);
491 }
492 }
493 }
494 else // Elemental
495 {
496 std::vector<Point> points;
497 for (auto & elem :
498 as_range(to_mesh->getMesh().elements_begin(), to_mesh->getMesh().elements_end()))
499 {
500 if (blockRestricted() && !hasBlocks(elem))
501 continue;
502
503 if (boundaryRestricted() && !isBoundaryElem(to_mesh, elem))
504 continue;
505
506 // Skip this element if the variable has no dofs at it.
507 if (elem->n_dofs(to_sys_num, to_var_num) < 1)
508 continue;
509
510 points.clear();
511 // grap sample points
512 // for constant shape function, we take the element centroid
513 if (is_constant)
514 points.push_back(to_transform(elem->vertex_average()));
515 // for higher order method, we take all nodes of element
516 // this works for the first order L2 Lagrange.
517 else
518 for (auto & node : elem->node_ref_range())
519 points.push_back(to_transform(node));
520
521 auto n_points = points.size();
522 unsigned int n_comp = elem->n_comp(to_sys_num, to_var_num);
523 // We assume each point corresponds to one component of elemental variable
524 if (n_points != n_comp)
525 mooseError(" Number of points ",
526 n_points,
527 " does not equal to number of variable components ",
528 n_comp);
529
530 unsigned int offset = 0;
531 for (auto & point : points) // If this variable has dofs at this elem
532 {
533 const auto sub_app = findSubAppToTransferFrom(point);
534
535 // Check to see if a sub-app was found
536 if (sub_app == static_cast<unsigned int>(-1))
537 continue;
538
539 const auto & from_transform = *_from_transforms[sub_app];
540 const auto & user_object =
541 getFromMultiApp()->appUserObjectBase(sub_app, _user_object_name);
542
543 dof_id_type dof = elem->dof_number(to_sys_num, to_var_num, offset++);
544
545 Real from_value = 0;
546 {
548 from_value = user_object.spatialValue(from_transform.mapBack(point));
549 }
550
551 if (from_value == std::numeric_limits<Real>::infinity())
552 mooseError("MultiAppUserObjectTransfer: Point corresponding to element's centroid (",
553 point,
554 ") not found in sub application.");
555
556 to_solution->set(dof, from_value);
557 }
558 }
559 }
560
561 to_solution->close();
562 to_sys.update();
563
564 break;
565 }
566 }
567
568 postExecute();
569}
570
571bool
573{
574 return !_blk_ids.empty();
575}
576
577bool
579{
580 return !_bnd_ids.empty();
581}
582
583bool
585{
586 return _blk_ids.find(elem->subdomain_id()) != _blk_ids.end();
587}
588
589bool
590MultiAppUserObjectTransfer::hasBlocks(const MooseMesh * mesh, const Node * node) const
591{
592 const auto & node_blk_ids = mesh->getNodeBlockIds(*node);
593 std::set<SubdomainID> u;
594 std::set_intersection(_blk_ids.begin(),
595 _blk_ids.end(),
596 node_blk_ids.begin(),
597 node_blk_ids.end(),
598 std::inserter(u, u.begin()));
599 return !u.empty();
600}
601
602bool
603MultiAppUserObjectTransfer::isBoundaryNode(const MooseMesh * mesh, const Node * node) const
604{
605 for (auto & bid : _bnd_ids)
606 if (mesh->isBoundaryNode(node->id(), bid))
607 return true;
608 return false;
609}
610
611bool
612MultiAppUserObjectTransfer::isBoundaryElem(const MooseMesh * mesh, const Elem * elem) const
613{
614 for (auto & bid : _bnd_ids)
615 if (mesh->isBoundaryElem(elem->id(), bid))
616 return true;
617 return false;
618}
619
620unsigned int
622{
623 // Just find the nearest app to this point
625 {
626 unsigned int closest_app = 0;
627 Real closest_distance = std::numeric_limits<Real>::max();
628
629 mooseAssert(_multi_app->numGlobalApps() > 0, "No Multiapps To Transfer From");
630
631 for (unsigned int i = 0; i < _multi_app->numGlobalApps(); i++)
632 {
633 // Obtain the possibly transformed app position by querying the transform with the origin
634 const auto app_position = _multi_app->runningInPosition()
635 ? (*_from_transforms[i])(_multi_app->position(i))
636 : (*_from_transforms[i])(Point(0));
637
638 auto distance = (p - app_position).norm();
639
640 if (distance < closest_distance)
641 {
642 closest_app = i;
643 closest_distance = distance;
644 }
645 }
646
647 // We can only get the value if we have this app
648 // otherwise - another processor will set it
649 if (_multi_app->hasLocalApp(closest_app))
650 return closest_app;
651 else
652 return -1;
653 }
654
655 // Find the app that contains this point...
656
657 // This loop counts _down_ so that it can preserve legacy behavior of the
658 // last sub-app "winning" to be able to set the value at this point
659 for (int i = _multi_app->numGlobalApps() - 1; i >= 0; i--)
660 {
661 if (!_multi_app->hasLocalApp(i))
662 continue;
663
664 BoundingBox app_box =
665 _multi_app->getBoundingBox(i, _displaced_source_mesh, _from_transforms[i].get());
666
667 if (_skip_bbox_check || app_box.contains_point(p))
668 return static_cast<unsigned int>(i);
669 }
670
671 return -1;
672}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition MooseError.h:363
const ExecFlagType EXEC_TRANSFER
Definition Moose.C:57
registerMooseObjectDeprecated("MooseApp", MultiAppUserObjectTransfer, "12/31/2024 24:00")
char ** blocks
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
virtual void computeUserObjectByName(const ExecFlagType &type, const Moose::AuxGroup &group, const std::string &name)
Compute an user object with the given name.
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...
virtual MooseMesh & mesh() override
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn't required or valid in the derived class...
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.
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...
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
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 ...
Definition MooseBase.h:457
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3549
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:1726
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.
Definition MooseMesh.C:3027
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition MooseMesh.C:3718
SystemBase & sys()
Get the system this variable is part of.
This class provides an interface for common operations on field variables of both FE and FV types wit...
void forceSwap()
Forcibly swap the currently swapped-out communicator back in to libmesh.
Definition Moose.h:286
Transfers variables on possibly different meshes while conserving a user defined property (Postproces...
const std::vector< VariableName > _from_var_names
Name of variables transferring from.
const std::vector< AuxVariableName > _to_var_names
Name of variables transferring to.
virtual void postExecute()
Add some extra work if necessary after execute().
void errorIfObjectExecutesOnTransferInSourceApp(const std::string &object_name) const
Error if executing this MooseObject on EXEC_TRANSFER in a source multiapp (from_multiapp,...
bool _displaced_source_mesh
True if displaced mesh is used for the source mesh, otherwise false.
static void addUserObjectExecutionCheckParam(InputParameters &params)
Add the execution order check parameter (to skip the warning if needed)
virtual void getAppInfo()
This method will fill information into the convenience member variables (_to_problems,...
std::vector< std::unique_ptr< MultiAppCoordTransform > > _from_transforms
bool _displaced_target_mesh
True if displaced mesh is used for the target mesh, otherwise false.
void checkParentAppUserObjectExecuteOn(const std::string &object_name) const
Checks the execute_on flags for user object transfers with user objects on the source app which is al...
const std::shared_ptr< MultiApp > getToMultiApp() const
Get the MultiApp to transfer data to.
const std::shared_ptr< MultiApp > getFromMultiApp() const
Get the MultiApp to transfer data from.
std::vector< std::unique_ptr< MultiAppCoordTransform > > _to_transforms
std::shared_ptr< MultiApp > _multi_app
Deprecated class attribute for compatibility with the apps.
Loops over a target mesh and uses either node or element centroid location (based on the target varia...
std::set< SubdomainID > _blk_ids
Set of block ids this transfer is restricted to.
std::set< BoundaryID > _bnd_ids
Set of the boundary ids.
MultiAppUserObjectTransfer(const InputParameters &parameters)
const bool & _nearest_sub_app
Whether to utilize the nearest sub-app to transfer from.
bool isBoundaryElem(const MooseMesh *mesh, const Elem *elem) const
Check that the element belongs to boundary this transfer is restricted to.
bool hasBlocks(const Elem *elem) const
Check that element 'elem' is part of the domain this transfer is restricted to.
unsigned int findSubAppToTransferFrom(const Point &p)
Gets the UserObject to transfer from when transferring from_multiapp.
virtual void execute() override
Execute the transfer.
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_...
const bool _skip_bbox_check
whether to check the bounding box check or not
bool isBoundaryNode(const MooseMesh *mesh, const Node *node) const
Check that the node belongs to boundary this transfer is restricted to.
static InputParameters validParams()
Base class for a system (of equations)
Definition SystemBase.h:87
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
@ FROM_MULTIAPP
Definition Transfer.h:71
@ TO_MULTIAPP
Definition Transfer.h:70
FEProblemBase & _fe_problem
Definition Transfer.h:97
MooseEnum _current_direction
Definition Transfer.h:106
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
const UserObjectBase & getUserObjectBase(const std::string &param_name, bool is_dependency=true) const
Get an user object with a given parameter param_name.
Base class for user-specific data.
Definition UserObject.h:20
virtual Real spatialValue(const Point &) const
Optional interface function for "evaluating" a UserObject at a spatial position.
Definition UserObject.h:36
const Parallel::Communicator & comm() const
unsigned int number() const
MeshBase & mesh
bool hasSubdomainName(const MeshBase &input_mesh, const SubdomainName &name)
Whether a particular subdomain name exists in the mesh.
bool hasBoundaryNameOrID(const MeshBase &mesh, const BoundaryName &name_or_id)
Whether a particular boundary name or ID exists in the mesh.
@ VAR_FIELD_STANDARD
Definition MooseTypes.h:777
@ POST_AUX
Definition MooseTypes.h:761
@ PRE_AUX
Definition MooseTypes.h:760
@ VAR_ANY
Definition MooseTypes.h:772
Real distance(const Point &p)