Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
MultiAppProjectionTransfer.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 
12 // MOOSE includes
13 #include "AddVariableAction.h"
14 #include "FEProblem.h"
15 #include "MooseMesh.h"
16 #include "MooseVariableFE.h"
17 #include "SystemBase.h"
18 #include "MooseAppCoordTransform.h"
19 
20 #include "libmesh/dof_map.h"
21 #include "libmesh/linear_implicit_system.h"
22 #include "libmesh/mesh_function.h"
23 #include "libmesh/mesh_tools.h"
24 #include "libmesh/numeric_vector.h"
25 #include "libmesh/parallel_algebra.h"
26 #include "libmesh/quadrature_gauss.h"
27 #include "libmesh/sparse_matrix.h"
28 #include "libmesh/string_to_enum.h"
29 #include "libmesh/default_coupling.h"
30 
31 // TIMPI includes
32 #include "timpi/parallel_sync.h"
33 
34 using namespace libMesh;
35 
36 void
37 assemble_l2(EquationSystems & es, const std::string & system_name)
38 {
39  MultiAppProjectionTransfer * transfer =
40  es.parameters.get<MultiAppProjectionTransfer *>("transfer");
41  transfer->assembleL2(es, system_name);
42 }
43 
45 
48 {
50  params.addClassDescription(
51  "Perform a projection between a master and sub-application mesh of a field variable.");
52 
53  MooseEnum proj_type("l2", "l2");
54  params.addParam<MooseEnum>("proj_type", proj_type, "The type of the projection.");
55 
56  params.addParam<bool>("fixed_meshes",
57  false,
58  "Set to true when the meshes are not changing (ie, "
59  "no movement or adaptivity). This will cache some "
60  "information to speed up the transfer.");
61 
62  // Need one layer of ghosting
63  params.addRelationshipManager("ElementSideNeighborLayers",
67  return params;
68 }
69 
71  : MultiAppConservativeTransfer(parameters),
72  _proj_type(getParam<MooseEnum>("proj_type")),
73  _compute_matrix(true),
74  _fixed_meshes(getParam<bool>("fixed_meshes")),
75  _qps_cached(false)
76 {
77  if (_to_var_names.size() != 1)
78  paramError("variable", " Support single to-variable only ");
79 
80  if (_from_var_names.size() != 1)
81  paramError("source_variable", " Support single from-variable only ");
82 }
83 
84 void
86 {
88 
89  _proj_sys.resize(_to_problems.size(), NULL);
90 
91  for (unsigned int i_to = 0; i_to < _to_problems.size(); i_to++)
92  {
93  FEProblemBase & to_problem = *_to_problems[i_to];
94  EquationSystems & to_es = to_problem.es();
95 
96  // Add the projection system.
97  FEType fe_type = to_problem
98  .getVariable(0,
102  .feType();
103 
104  LinearImplicitSystem & proj_sys = to_es.add_system<LinearImplicitSystem>("proj-sys-" + name());
105 
107  proj_sys.get_dof_map().default_coupling(),
108  false); // The false keeps it from getting added to the mesh
109 
110  _proj_var_num = proj_sys.add_variable("var", fe_type);
112  _proj_sys[i_to] = &proj_sys;
113 
114  // Prevent the projection system from being written to checkpoint
115  // files. In the event of a recover or restart, we'll read the checkpoint
116  // before this initialSetup method is called. As a result, we'll find
117  // systems in the checkpoint (the projection systems) that we don't know
118  // what to do with, and there will be a crash. We could fix this by making
119  // the systems in the constructor, except we don't know how many sub apps
120  // there are at the time of construction. So instead, we'll just nuke the
121  // projection system and rebuild it from scratch every recover/restart.
122  proj_sys.hide_output() = true;
123 
124  // Reinitialize EquationSystems since we added a system.
125  to_es.reinit();
126  }
127 }
128 
129 void
130 MultiAppProjectionTransfer::assembleL2(EquationSystems & es, const std::string & system_name)
131 {
132  // Get the system and mesh from the input arguments.
133  LinearImplicitSystem & system = es.get_system<LinearImplicitSystem>(system_name);
134  MeshBase & to_mesh = es.get_mesh();
135 
136  // Get the meshfunction evaluations and the map that was stashed in the es.
137  std::vector<Real> & final_evals = *es.parameters.get<std::vector<Real> *>("final_evals");
138  std::map<dof_id_type, unsigned int> & element_map =
139  *es.parameters.get<std::map<dof_id_type, unsigned int> *>("element_map");
140 
141  // Setup system vectors and matrices.
142  FEType fe_type = system.variable_type(0);
143  std::unique_ptr<FEBase> fe(FEBase::build(to_mesh.mesh_dimension(), fe_type));
144  QGauss qrule(to_mesh.mesh_dimension(), fe_type.default_quadrature_order());
145  fe->attach_quadrature_rule(&qrule);
146  const DofMap & dof_map = system.get_dof_map();
149  std::vector<dof_id_type> dof_indices;
150  const std::vector<Real> & JxW = fe->get_JxW();
151  const std::vector<std::vector<Real>> & phi = fe->get_phi();
152  auto & system_matrix = system.get_system_matrix();
153 
154  for (const auto & elem : to_mesh.active_local_element_ptr_range())
155  {
156  fe->reinit(elem);
157 
158  dof_map.dof_indices(elem, dof_indices);
159  Ke.resize(dof_indices.size(), dof_indices.size());
160  Fe.resize(dof_indices.size());
161 
162  for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
163  {
164  Real meshfun_eval = 0.;
165  if (element_map.find(elem->id()) != element_map.end())
166  {
167  // We have evaluations for this element.
168  meshfun_eval = final_evals[element_map[elem->id()] + qp];
169  }
170 
171  // Now compute the element matrix and RHS contributions.
172  for (unsigned int i = 0; i < phi.size(); i++)
173  {
174  // RHS
175  Fe(i) += JxW[qp] * (meshfun_eval * phi[i][qp]);
176 
177  if (_compute_matrix)
178  for (unsigned int j = 0; j < phi.size(); j++)
179  {
180  // The matrix contribution
181  Ke(i, j) += JxW[qp] * (phi[i][qp] * phi[j][qp]);
182  }
183  }
184  dof_map.constrain_element_matrix_and_vector(Ke, Fe, dof_indices);
185 
186  if (_compute_matrix)
187  system_matrix.add_matrix(Ke, dof_indices);
188  system.rhs->add_vector(Fe, dof_indices);
189  }
190  }
191 }
192 
193 void
195 {
196  TIME_SECTION(
197  "MultiAppProjectionTransfer::execute()", 5, "Transferring variables through projection");
198 
200  // We are going to project the solutions by solving some linear systems. In
201  // order to assemble the systems, we need to evaluate the "from" domain
202  // solutions at quadrature points in the "to" domain. Some parallel
203  // communication is necessary because each processor doesn't necessarily have
204  // all the "from" information it needs to set its "to" values. We don't want
205  // to use a bunch of big all-to-all broadcasts, so we'll use bounding boxes to
206  // figure out which processors have the information we need and only
207  // communicate with those processors.
208  //
209  // Each processor will
210  // 1. Check its local quadrature points in the "to" domains to see which
211  // "from" domains they might be in.
212  // 2. Send quadrature points to the processors with "from" domains that might
213  // contain those points.
214  // 3. Recieve quadrature points from other processors, evaluate its mesh
215  // functions at those points, and send the values back to the proper
216  // processor
217  // 4. Recieve mesh function evaluations from all relevant processors and
218  // decide which one to use at every quadrature point (the lowest global app
219  // index always wins)
220  // 5. And use the mesh function evaluations to assemble and solve an L2
221  // projection system on its local elements.
223 
225  // For every combination of global "from" problem and local "to" problem, find
226  // which "from" bounding boxes overlap with which "to" elements. Keep track
227  // of which processors own bounding boxes that overlap with which elements.
228  // Build vectors of quadrature points to send to other processors for mesh
229  // function evaluations.
231 
232  // Get the bounding boxes for the "from" domains.
233  std::vector<BoundingBox> bboxes = getFromBoundingBoxes();
234 
235  // Figure out how many "from" domains each processor owns.
236  std::vector<unsigned int> froms_per_proc = getFromsPerProc();
237 
238  std::map<processor_id_type, std::vector<Point>> outgoing_qps;
239  std::map<processor_id_type, std::map<std::pair<unsigned int, unsigned int>, unsigned int>>
240  element_index_map;
241  // element_index_map[i_to, element_id] = index
242  // outgoing_qps[index] is the first quadrature point in element
243 
244  if (!_qps_cached)
245  {
246  for (unsigned int i_to = 0; i_to < _to_problems.size(); i_to++)
247  {
248  // Indexing into the coordinate transforms vector
249  const auto to_global_num =
251  MeshBase & to_mesh = _to_meshes[i_to]->getMesh();
252 
253  LinearImplicitSystem & system = *_proj_sys[i_to];
254 
255  FEType fe_type = system.variable_type(0);
256  std::unique_ptr<FEBase> fe(FEBase::build(to_mesh.mesh_dimension(), fe_type));
257  QGauss qrule(to_mesh.mesh_dimension(), fe_type.default_quadrature_order());
258  fe->attach_quadrature_rule(&qrule);
259  const std::vector<Point> & xyz = fe->get_xyz();
260 
261  unsigned int from0 = 0;
262  for (processor_id_type i_proc = 0; i_proc < n_processors();
263  from0 += froms_per_proc[i_proc], i_proc++)
264  {
265  for (const auto & elem :
266  as_range(to_mesh.local_elements_begin(), to_mesh.local_elements_end()))
267  {
268  fe->reinit(elem);
269 
270  bool qp_hit = false;
271  for (unsigned int i_from = 0; i_from < froms_per_proc[i_proc] && !qp_hit; i_from++)
272  {
273  for (unsigned int qp = 0; qp < qrule.n_points() && !qp_hit; qp++)
274  {
275  Point qpt = xyz[qp];
276  if (bboxes[from0 + i_from].contains_point((*_to_transforms[to_global_num])(qpt)))
277  qp_hit = true;
278  }
279  }
280 
281  if (qp_hit)
282  {
283  // The selected processor's bounding box contains at least one
284  // quadrature point from this element. Send all qps from this element
285  // and remember where they are in the array using the map.
286  std::pair<unsigned int, unsigned int> key(i_to, elem->id());
287  element_index_map[i_proc][key] = outgoing_qps[i_proc].size();
288  for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
289  {
290  Point qpt = xyz[qp];
291  outgoing_qps[i_proc].push_back((*_to_transforms[to_global_num])(qpt));
292  }
293  }
294  }
295  }
296  }
297 
298  if (_fixed_meshes)
299  _cached_index_map = element_index_map;
300  }
301  else
302  {
303  element_index_map = _cached_index_map;
304  }
305 
307  // Request quadrature point evaluations from other processors and handle
308  // requests sent to this processor.
310 
311  // Get the local bounding boxes.
312  std::vector<BoundingBox> local_bboxes(froms_per_proc[processor_id()]);
313  {
314  // Find the index to the first of this processor's local bounding boxes.
315  unsigned int local_start = 0;
316  for (processor_id_type i_proc = 0; i_proc < n_processors() && i_proc != processor_id();
317  i_proc++)
318  local_start += froms_per_proc[i_proc];
319 
320  // Extract the local bounding boxes.
321  for (unsigned int i_from = 0; i_from < froms_per_proc[processor_id()]; i_from++)
322  local_bboxes[i_from] = bboxes[local_start + i_from];
323  }
324 
325  // Setup the local mesh functions.
326  std::vector<MeshFunction> local_meshfuns;
327  for (unsigned int i_from = 0; i_from < _from_problems.size(); i_from++)
328  {
329  FEProblemBase & from_problem = *_from_problems[i_from];
330  MooseVariableFEBase & from_var = from_problem.getVariable(
332  System & from_sys = from_var.sys().system();
333  unsigned int from_var_num = from_sys.variable_number(from_var.name());
334 
335  local_meshfuns.emplace_back(
336  from_problem.es(), *from_sys.current_local_solution, from_sys.get_dof_map(), from_var_num);
337  local_meshfuns.back().init();
338  local_meshfuns.back().enable_out_of_mesh_mode(OutOfMeshValue);
339  }
340 
341  // Recieve quadrature points from other processors, evaluate mesh frunctions
342  // at those points, and send the values back.
343  std::map<processor_id_type, std::vector<std::pair<Real, unsigned int>>> outgoing_evals_ids;
344 
345  // If there is no cached data, we need to do communication
346  // Quadrature points I will receive from remote processors
347  std::map<processor_id_type, std::vector<Point>> incoming_qps;
348  if (!_qps_cached)
349  {
350  auto qps_action_functor = [&incoming_qps](processor_id_type pid, const std::vector<Point> & qps)
351  {
352  // Quadrature points from processor 'pid'
353  auto & incoming_qps_from_pid = incoming_qps[pid];
354  // Store data for late use
355  incoming_qps_from_pid.reserve(incoming_qps_from_pid.size() + qps.size());
356  std::copy(qps.begin(), qps.end(), std::back_inserter(incoming_qps_from_pid));
357  };
358 
359  Parallel::push_parallel_vector_data(comm(), outgoing_qps, qps_action_functor);
360  }
361 
362  // Cache data
363  if (!_qps_cached)
364  _cached_qps = incoming_qps;
365 
366  for (auto & qps : _cached_qps)
367  {
368  const processor_id_type pid = qps.first;
369 
370  outgoing_evals_ids[pid].resize(qps.second.size(),
371  std::make_pair(OutOfMeshValue, libMesh::invalid_uint));
372 
373  for (unsigned int qp = 0; qp < qps.second.size(); qp++)
374  {
375  Point qpt = qps.second[qp];
376 
377  // Loop until we've found the lowest-ranked app that actually contains
378  // the quadrature point.
379  for (unsigned int i_from = 0; i_from < _from_problems.size(); i_from++)
380  {
381  if (local_bboxes[i_from].contains_point(qpt))
382  {
383  const auto from_global_num =
385  outgoing_evals_ids[pid][qp].first =
386  (local_meshfuns[i_from])(_from_transforms[from_global_num]->mapBack(qpt));
388  outgoing_evals_ids[pid][qp].second = from_global_num;
389  }
390  }
391  }
392  }
393 
395  // Gather all of the qp evaluations and pick out the best ones for each qp.
397 
398  // Values back from remote processors for my local quadrature points
399  std::map<processor_id_type, std::vector<std::pair<Real, unsigned int>>> incoming_evals_ids;
400 
401  auto evals_action_functor =
402  [&incoming_evals_ids](processor_id_type pid,
403  const std::vector<std::pair<Real, unsigned int>> & evals)
404  {
405  // evals for processor 'pid'
406  auto & incoming_evals_ids_for_pid = incoming_evals_ids[pid];
407  // Copy evals for late use
408  incoming_evals_ids_for_pid.reserve(incoming_evals_ids_for_pid.size() + evals.size());
409  std::copy(evals.begin(), evals.end(), std::back_inserter(incoming_evals_ids_for_pid));
410  };
411 
412  Parallel::push_parallel_vector_data(comm(), outgoing_evals_ids, evals_action_functor);
413 
414  std::vector<std::vector<Real>> final_evals(_to_problems.size());
415  std::vector<std::map<dof_id_type, unsigned int>> trimmed_element_maps(_to_problems.size());
416 
417  for (unsigned int i_to = 0; i_to < _to_problems.size(); i_to++)
418  {
419  MeshBase & to_mesh = _to_meshes[i_to]->getMesh();
420  LinearImplicitSystem & system = *_proj_sys[i_to];
421 
422  FEType fe_type = system.variable_type(0);
423  std::unique_ptr<FEBase> fe(FEBase::build(to_mesh.mesh_dimension(), fe_type));
424  QGauss qrule(to_mesh.mesh_dimension(), fe_type.default_quadrature_order());
425 
426  for (const auto & elem : to_mesh.active_local_element_ptr_range())
427  {
428  qrule.init(*elem);
429 
430  bool element_is_evaled = false;
431  std::vector<Real> evals(qrule.n_points(), 0.);
432 
433  for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
434  {
435  unsigned int lowest_app_rank = libMesh::invalid_uint;
436  for (auto & values_ids : incoming_evals_ids)
437  {
438  // Current processor id
439  const processor_id_type pid = values_ids.first;
440 
441  // Ignore the selected processor if the element wasn't found in it's
442  // bounding box.
443  std::map<std::pair<unsigned int, unsigned int>, unsigned int> & map =
444  element_index_map[pid];
445  std::pair<unsigned int, unsigned int> key(i_to, elem->id());
446  if (map.find(key) == map.end())
447  continue;
448  unsigned int qp0 = map[key];
449 
450  // Ignore the selected processor if it's app has a higher rank than the
451  // previously found lowest app rank.
453  if (values_ids.second[qp0 + qp].second >= lowest_app_rank)
454  continue;
455 
456  // Ignore the selected processor if the qp was actually outside the
457  // processor's subapp's mesh.
458  if (values_ids.second[qp0 + qp].first == OutOfMeshValue)
459  continue;
460 
461  // This is the best meshfunction evaluation so far, save it.
462  element_is_evaled = true;
463  evals[qp] = values_ids.second[qp0 + qp].first;
464  }
465  }
466 
467  // If we found good evaluations for any of the qps in this element, save
468  // those evaluations for later.
469  if (element_is_evaled)
470  {
471  trimmed_element_maps[i_to][elem->id()] = final_evals[i_to].size();
472  for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
473  final_evals[i_to].push_back(evals[qp]);
474  }
475  }
476  }
477 
479  // We now have just one or zero mesh function values at all of our local
480  // quadrature points. Stash those values (and a map linking them to element
481  // ids) in the equation systems parameters and project the solution.
483 
484  for (unsigned int i_to = 0; i_to < _to_problems.size(); i_to++)
485  {
486  _to_es[i_to]->parameters.set<std::vector<Real> *>("final_evals") = &final_evals[i_to];
487  _to_es[i_to]->parameters.set<std::map<dof_id_type, unsigned int> *>("element_map") =
488  &trimmed_element_maps[i_to];
489  projectSolution(i_to);
490  _to_es[i_to]->parameters.set<std::vector<Real> *>("final_evals") = NULL;
491  _to_es[i_to]->parameters.set<std::map<dof_id_type, unsigned int> *>("element_map") = NULL;
492  }
493 
494  if (_fixed_meshes)
495  _qps_cached = true;
496 
497  postExecute();
498 }
499 
500 void
502 {
503  FEProblemBase & to_problem = *_to_problems[i_to];
504  EquationSystems & proj_es = to_problem.es();
505  LinearImplicitSystem & ls = *_proj_sys[i_to];
506  // activate the current transfer
507  proj_es.parameters.set<MultiAppProjectionTransfer *>("transfer") = this;
508 
509  // TODO: specify solver params in an input file
510  // solver tolerance
511  Real tol = proj_es.parameters.get<Real>("linear solver tolerance");
512  proj_es.parameters.set<Real>("linear solver tolerance") = 1e-10; // set our tolerance
513  // solve it
514  ls.solve();
515  proj_es.parameters.set<Real>("linear solver tolerance") = tol; // restore the original tolerance
516 
517  // copy projected solution into target es
518  MeshBase & to_mesh = proj_es.get_mesh();
519 
520  MooseVariableFEBase & to_var = to_problem.getVariable(
522  System & to_sys = to_var.sys().system();
523  NumericVector<Number> * to_solution = to_sys.solution.get();
524 
525  for (const auto & node : to_mesh.local_node_ptr_range())
526  {
527  for (unsigned int comp = 0; comp < node->n_comp(to_sys.number(), to_var.number()); comp++)
528  {
529  const dof_id_type proj_index = node->dof_number(ls.number(), _proj_var_num, comp);
530  const dof_id_type to_index = node->dof_number(to_sys.number(), to_var.number(), comp);
531  to_solution->set(to_index, (*ls.solution)(proj_index));
532  }
533  }
534  for (const auto & elem : to_mesh.active_local_element_ptr_range())
535  for (unsigned int comp = 0; comp < elem->n_comp(to_sys.number(), to_var.number()); comp++)
536  {
537  const dof_id_type proj_index = elem->dof_number(ls.number(), _proj_var_num, comp);
538  const dof_id_type to_index = elem->dof_number(to_sys.number(), to_var.number(), comp);
539  to_solution->set(to_index, (*ls.solution)(proj_index));
540  }
541 
542  to_solution->close();
543  to_sys.update();
544 }
std::vector< std::unique_ptr< MultiAppCoordTransform > > _to_transforms
void assemble_l2(EquationSystems &es, const std::string &system_name)
std::unique_ptr< FEGenericBase< Real > > build(const unsigned int dim, const FEType &fet)
std::vector< libMesh::EquationSystems * > _to_es
const libMesh::FEType & feType() const
Get the type of finite element object.
DefaultCoupling & default_coupling()
const unsigned int invalid_uint
MooseEnum _current_direction
Definition: Transfer.h:106
void constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
unsigned int number() const
Get variable number coming from libMesh.
std::map< processor_id_type, std::map< std::pair< unsigned int, unsigned int >, unsigned int > > _cached_index_map
void resize(const unsigned int n)
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
std::vector< libMesh::BoundingBox > getFromBoundingBoxes()
Return the bounding boxes of all the "from" domains, including all the domains not local to this proc...
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > _from_var_names
Name of variables transferring from.
std::vector< FEProblemBase * > _to_problems
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...
NumericVector< Number > * rhs
const Parallel::Communicator & comm() const
Order default_quadrature_order() const
virtual void postExecute()
Add some extra work if necessary after execute().
This class provides an interface for common operations on field variables of both FE and FV types wit...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
virtual void solve() override
const T_sys & get_system(std::string_view name) const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
registerMooseObject("MooseApp", MultiAppProjectionTransfer)
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...
std::vector< unsigned int > _to_local2global_map
Given local app index, returns global app index.
unsigned int variable_number(std::string_view var) const
void assembleL2(libMesh::EquationSystems &es, const std::string &system_name)
virtual void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup...
uint8_t processor_id_type
processor_id_type n_processors() const
unsigned int number() const
const T & get(std::string_view) const
Project values from one domain to another.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
bool _compute_matrix
True, if we need to recompute the projection matrix.
virtual libMesh::EquationSystems & es() override
const std::vector< AuxVariableName > _to_var_names
Name of variables transferring to.
std::unique_ptr< NumericVector< Number > > solution
std::vector< unsigned int > getFromsPerProc()
Return the number of "from" domains that each processor owns.
Transfers variables on possibly different meshes while conserving a user defined property (Postproces...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
static InputParameters validParams()
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
virtual void execute() override
Execute the transfer.
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 ...
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
static const libMesh::Number OutOfMeshValue
Definition: Transfer.h:113
std::map< processor_id_type, std::vector< libMesh::Point > > _cached_qps
virtual void close()=0
MultiAppProjectionTransfer(const InputParameters &parameters)
virtual void update()
const FEType & variable_type(const unsigned int i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
T & set(const std::string &)
const MeshBase & get_mesh() const
void resize(const unsigned int new_m, const unsigned int new_n)
std::vector< std::unique_ptr< MultiAppCoordTransform > > _from_transforms
unsigned int mesh_dimension() const
virtual void init(const Elem &e, unsigned int p_level=invalid_uint)
std::vector< unsigned int > _from_local2global_map
Given local app index, returns global app index.
std::unique_ptr< NumericVector< Number > > current_local_solution
static void addBBoxFactorParam(InputParameters &params)
Add the bounding box factor parameter to the supplied input parameters.
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...
void projectSolution(unsigned int to_problem)
friend void assemble_l2(libMesh::EquationSystems &es, const std::string &system_name)
virtual void set(const numeric_index_type i, const T value)=0
virtual void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup...
unsigned int _proj_var_num
Having one projection variable number seems weird, but there is always one variable in every system b...
virtual System & add_system(std::string_view system_type, std::string_view name)
processor_id_type processor_id() const
SystemBase & sys()
Get the system this variable is part of.
std::vector< libMesh::LinearImplicitSystem * > _proj_sys
const DofMap & get_dof_map() const
const SparseMatrix< Number > & get_system_matrix() const
std::vector< FEProblemBase * > _from_problems
std::vector< MooseMesh * > _to_meshes
uint8_t dof_id_type
VariableName _from_var_name
This values are used if a derived class only supports one variable.