www.mooseframework.org
DisplacedProblem.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
10 // MOOSE includes
11 
12 #include "AuxiliarySystem.h"
13 #include "FEProblem.h"
14 #include "MooseApp.h"
15 #include "MooseMesh.h"
16 #include "NonlinearSystem.h"
17 #include "Problem.h"
19 #include "SubProblem.h"
21 #include "Assembly.h"
22 #include "DisplacedProblem.h"
23 
24 #include "libmesh/numeric_vector.h"
25 
27 
28 template <>
31 {
33  params.addPrivateParam<std::vector<std::string>>("displacements");
34  return params;
35 }
36 
38  : SubProblem(parameters),
39  _mproblem(parameters.have_parameter<FEProblemBase *>("_fe_problem_base")
40  ? *getParam<FEProblemBase *>("_fe_problem_base")
41  : *getParam<FEProblem *>("_fe_problem")),
42  _mesh(*getParam<MooseMesh *>("mesh")),
43  _eq(_mesh),
44  _ref_mesh(_mproblem.mesh()),
45  _displacements(getParam<std::vector<std::string>>("displacements")),
46  _displaced_nl(*this,
47  _mproblem.getNonlinearSystemBase(),
48  _mproblem.getNonlinearSystemBase().name() + "_displaced",
50  _displaced_aux(*this,
51  _mproblem.getAuxiliarySystem(),
52  _mproblem.getAuxiliarySystem().name() + "_displaced",
54  _geometric_search_data(_mproblem, _mesh),
55  _eq_init_timer(registerTimedSection("eq::init", 2)),
56  _update_mesh_timer(registerTimedSection("updateMesh", 3)),
57  _sync_solutions_timer(registerTimedSection("syncSolutions", 5)),
58  _update_geometric_search_timer(registerTimedSection("updateGeometricSearch", 3))
59 {
60  // Possibly turn off default ghosting in libMesh
61  _eq.enable_default_ghosting(_default_ghosting);
62 
63  // TODO: Move newAssemblyArray further up to SubProblem so that we can use it here
64  unsigned int n_threads = libMesh::n_threads();
65 
66  _assembly.reserve(n_threads);
67  for (unsigned int i = 0; i < n_threads; ++i)
68  _assembly.emplace_back(libmesh_make_unique<Assembly>(_displaced_nl, i));
69 
71 }
72 
73 bool
75 {
76  return _mproblem.isTransient();
77 }
78 
81 {
82  return _mproblem.getCoordSystem(sid);
83 }
84 
85 std::set<dof_id_type> &
87 {
88  return _mproblem.ghostedElems();
89 }
90 
91 void
93  Order order,
94  Order volume_order,
95  Order face_order)
96 {
97  for (unsigned int tid = 0; tid < libMesh::n_threads(); ++tid)
98  _assembly[tid]->createQRules(type, order, volume_order, face_order);
99 }
100 
101 void
103 {
104  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
105  {
106  _assembly[tid]->init(_mproblem.couplingMatrix());
107  std::vector<unsigned> disp_numbers;
108  for (const auto & disp_string : _displacements)
109  {
110  const auto & disp_variable = getVariable(tid, disp_string);
111  if (disp_variable.kind() == Moose::VarKindType::VAR_NONLINEAR)
112  disp_numbers.push_back(disp_variable.number());
113  }
114  _assembly[tid]->assignDisplacements(std::move(disp_numbers));
115  }
116 
117  _displaced_nl.dofMap().attach_extra_send_list_function(&extraSendList, &_displaced_nl);
118  _displaced_aux.dofMap().attach_extra_send_list_function(&extraSendList, &_displaced_aux);
119 
121 
123 
124  {
125  TIME_SECTION(_eq_init_timer);
126  _eq.init();
127  }
128 
129  _mesh.meshChanged();
130 }
131 
132 void
134 {
135 }
136 
137 void
139 {
142 }
143 
144 void
146 {
149 }
150 
151 void
153 {
154  TIME_SECTION(_sync_solutions_timer);
155 
160 }
161 
162 void
163 DisplacedProblem::syncSolutions(const NumericVector<Number> & soln,
164  const NumericVector<Number> & aux_soln)
165 {
166  TIME_SECTION(_sync_solutions_timer);
167 
168  (*_displaced_nl.sys().solution) = soln;
169  (*_displaced_aux.sys().solution) = aux_soln;
172 }
173 
174 void
176 {
177  TIME_SECTION(_update_mesh_timer);
178 
179  syncSolutions();
180 
183 
184  // If the displaced mesh has been serialized to one processor (as
185  // may have occurred if it was used for Exodus output), then we need
186  // the reference mesh to be also. For that matter, did anyone
187  // somehow serialize the whole mesh? Hopefully not but let's avoid
188  // causing errors if so.
189  if (_mesh.getMesh().is_serial() && !this->refMesh().getMesh().is_serial())
190  this->refMesh().getMesh().allgather();
191 
192  if (_mesh.getMesh().is_serial_on_zero() && !this->refMesh().getMesh().is_serial_on_zero())
193  this->refMesh().getMesh().gather_to_zero();
194 
196 
197  // We displace all nodes, not just semilocal nodes, because
198  // parallel-inconsistent mesh geometry makes libMesh cry.
199  NodeRange node_range(_mesh.getMesh().nodes_begin(),
200  _mesh.getMesh().nodes_end(),
201  /*grainsize=*/1);
202 
203  Threads::parallel_reduce(node_range, udmt);
204 
205  // Update the geometric searches that depend on the displaced mesh
207 
208  // Since the Mesh changed, update the PointLocator object used by DiracKernels.
210 }
211 
212 void
213 DisplacedProblem::updateMesh(const NumericVector<Number> & soln,
214  const NumericVector<Number> & aux_soln)
215 {
216  TIME_SECTION(_update_mesh_timer);
217 
218  syncSolutions(soln, aux_soln);
219 
220  _nl_solution = &soln;
221  _aux_solution = &aux_soln;
222 
224 
225  // We displace all nodes, not just semilocal nodes, because
226  // parallel-inconsistent mesh geometry makes libMesh cry.
227  NodeRange node_range(_mesh.getMesh().nodes_begin(),
228  _mesh.getMesh().nodes_end(),
229  /*grainsize=*/1);
230 
231  Threads::parallel_reduce(node_range, udmt);
232 
233  // Update the geometric searches that depend on the displaced mesh
235 
236  // Since the Mesh changed, update the PointLocator object used by DiracKernels.
238 }
239 
240 TagID
242 {
243  return _mproblem.addVectorTag(tag_name);
244 }
245 
246 TagID
247 DisplacedProblem::getVectorTagID(const TagName & tag_name)
248 {
249  return _mproblem.getVectorTagID(tag_name);
250 }
251 
252 TagName
254 {
255  return _mproblem.vectorTagName(tag);
256 }
257 
258 bool
260 {
261  return _mproblem.vectorTagExists(tag);
262 }
263 
264 unsigned int
266 {
267  return _mproblem.numVectorTags();
268 }
269 
270 std::map<TagName, TagID> &
272 {
273  return _mproblem.getVectorTags();
274 }
275 
276 TagID
278 {
279  return _mproblem.addMatrixTag(tag_name);
280 }
281 
282 TagID
283 DisplacedProblem::getMatrixTagID(const TagName & tag_name)
284 {
285  return _mproblem.getMatrixTagID(tag_name);
286 }
287 
288 TagName
290 {
291  return _mproblem.matrixTagName(tag);
292 }
293 
294 bool
295 DisplacedProblem::matrixTagExists(const TagName & tag_name)
296 {
297  return _mproblem.matrixTagExists(tag_name);
298 }
299 
300 bool
302 {
303  return _mproblem.matrixTagExists(tag_id);
304 }
305 
306 unsigned int
308 {
309  return _mproblem.numMatrixTags();
310 }
311 
312 bool
313 DisplacedProblem::hasVariable(const std::string & var_name) const
314 {
315  if (_displaced_nl.hasVariable(var_name))
316  return true;
317  else if (_displaced_aux.hasVariable(var_name))
318  return true;
319  else
320  return false;
321 }
322 
325  const std::string & var_name,
326  Moose::VarKindType expected_var_type,
327  Moose::VarFieldType expected_var_field_type)
328 {
329  return getVariableHelper(
330  tid, var_name, expected_var_type, expected_var_field_type, _displaced_nl, _displaced_aux);
331 }
332 
334 DisplacedProblem::getStandardVariable(THREAD_ID tid, const std::string & var_name)
335 {
336  if (_displaced_nl.hasVariable(var_name))
337  return _displaced_nl.getFieldVariable<Real>(tid, var_name);
338  else if (!_displaced_aux.hasVariable(var_name))
339  mooseError("No variable with name '" + var_name + "'");
340 
341  return _displaced_aux.getFieldVariable<Real>(tid, var_name);
342 }
343 
345 DisplacedProblem::getVectorVariable(THREAD_ID tid, const std::string & var_name)
346 {
347  if (_displaced_nl.hasVariable(var_name))
348  return _displaced_nl.getFieldVariable<RealVectorValue>(tid, var_name);
349  else if (!_displaced_aux.hasVariable(var_name))
350  mooseError("No variable with name '" + var_name + "'");
351 
352  return _displaced_aux.getFieldVariable<RealVectorValue>(tid, var_name);
353 }
354 
355 bool
356 DisplacedProblem::hasScalarVariable(const std::string & var_name) const
357 {
358  if (_displaced_nl.hasScalarVariable(var_name))
359  return true;
360  else if (_displaced_aux.hasScalarVariable(var_name))
361  return true;
362  else
363  return false;
364 }
365 
367 DisplacedProblem::getScalarVariable(THREAD_ID tid, const std::string & var_name)
368 {
369  if (_displaced_nl.hasScalarVariable(var_name))
370  return _displaced_nl.getScalarVariable(tid, var_name);
371  else if (_displaced_aux.hasScalarVariable(var_name))
372  return _displaced_aux.getScalarVariable(tid, var_name);
373  else
374  mooseError("No variable with name '" + var_name + "'");
375 }
376 
377 System &
378 DisplacedProblem::getSystem(const std::string & var_name)
379 {
380  if (_displaced_nl.hasVariable(var_name))
381  return _displaced_nl.system();
382  else if (_displaced_aux.hasVariable(var_name))
383  return _displaced_aux.system();
384  else
385  mooseError("Unable to find a system containing the variable " + var_name);
386 }
387 
388 void
389 DisplacedProblem::addVariable(const std::string & var_name,
390  const FEType & type,
391  Real scale_factor,
392  const std::set<SubdomainID> * const active_subdomains)
393 {
394  _displaced_nl.addVariable(var_name, type, scale_factor, active_subdomains);
395 }
396 
397 void
398 DisplacedProblem::addAuxVariable(const std::string & var_name,
399  const FEType & type,
400  const std::set<SubdomainID> * const active_subdomains)
401 {
402  _displaced_aux.addVariable(var_name, type, 1.0, active_subdomains);
403 }
404 
405 void
406 DisplacedProblem::addScalarVariable(const std::string & var_name,
407  Order order,
408  Real scale_factor,
409  const std::set<SubdomainID> * const active_subdomains)
410 {
411  _displaced_nl.addScalarVariable(var_name, order, scale_factor, active_subdomains);
412 }
413 
414 void
415 DisplacedProblem::addAuxScalarVariable(const std::string & var_name,
416  Order order,
417  Real scale_factor,
418  const std::set<SubdomainID> * const active_subdomains)
419 {
420  _displaced_aux.addScalarVariable(var_name, order, scale_factor, active_subdomains);
421 }
422 
423 void
424 DisplacedProblem::prepare(const Elem * elem, THREAD_ID tid)
425 {
426  _assembly[tid]->reinit(elem);
427 
428  _displaced_nl.prepare(tid);
429  _displaced_aux.prepare(tid);
431  _assembly[tid]->prepareJacobianBlock();
432  _assembly[tid]->prepareResidual();
433 }
434 
435 void
437 {
438  _assembly[tid]->prepareNonlocal();
439 }
440 
441 void
442 DisplacedProblem::prepareFace(const Elem * /*elem*/, THREAD_ID tid)
443 {
444  _displaced_nl.prepareFace(tid, true);
445  _displaced_aux.prepareFace(tid, false);
446 }
447 
448 void
449 DisplacedProblem::prepare(const Elem * elem,
450  unsigned int ivar,
451  unsigned int jvar,
452  const std::vector<dof_id_type> & dof_indices,
453  THREAD_ID tid)
454 {
455  _assembly[tid]->reinit(elem);
456 
457  _displaced_nl.prepare(tid);
458  _displaced_aux.prepare(tid);
459  _assembly[tid]->prepareBlock(ivar, jvar, dof_indices);
460 }
461 
462 void
464 {
465  SubdomainID did = elem->subdomain_id();
466  _assembly[tid]->setCurrentSubdomainID(did);
467 }
468 
469 void
470 DisplacedProblem::setNeighborSubdomainID(const Elem * elem, unsigned int side, THREAD_ID tid)
471 {
472  SubdomainID did = elem->neighbor_ptr(side)->subdomain_id();
473  _assembly[tid]->setCurrentNeighborSubdomainID(did);
474 }
475 
476 void
478  unsigned int jvar,
479  const std::vector<dof_id_type> & idof_indices,
480  const std::vector<dof_id_type> & jdof_indices,
481  THREAD_ID tid)
482 {
483  _assembly[tid]->prepareBlockNonlocal(ivar, jvar, idof_indices, jdof_indices);
484 }
485 
486 void
488 {
489  _assembly[tid]->prepare();
490 }
491 
492 void
494 {
495  _assembly[tid]->prepareNeighbor();
496 }
497 
498 bool
500 {
501  std::vector<Point> & points = _dirac_kernel_info.getPoints()[elem].first;
502 
503  unsigned int n_points = points.size();
504 
505  if (n_points)
506  {
507  _assembly[tid]->reinitAtPhysical(elem, points);
508 
509  _displaced_nl.prepare(tid);
510  _displaced_aux.prepare(tid);
511 
512  reinitElem(elem, tid);
513  }
514 
515  _assembly[tid]->prepare();
516 
517  return n_points > 0;
518 }
519 
520 void
522 {
523  _displaced_nl.reinitElem(elem, tid);
524  _displaced_aux.reinitElem(elem, tid);
525 }
526 
527 void
529  const std::vector<Point> & phys_points_in_elem,
530  THREAD_ID tid,
531  bool)
532 {
533  _assembly[tid]->reinitAtPhysical(elem, phys_points_in_elem);
534 
535  _displaced_nl.prepare(tid);
536  _displaced_aux.prepare(tid);
537  _assembly[tid]->prepare();
538 
539  reinitElem(elem, tid);
540 }
541 
542 void
544  unsigned int side,
545  BoundaryID bnd_id,
546  THREAD_ID tid)
547 {
548  _assembly[tid]->reinit(elem, side);
549  _displaced_nl.reinitElemFace(elem, side, bnd_id, tid);
550  _displaced_aux.reinitElemFace(elem, side, bnd_id, tid);
551 }
552 
553 void
555 {
556  _assembly[tid]->reinit(node);
557  _displaced_nl.reinitNode(node, tid);
558  _displaced_aux.reinitNode(node, tid);
559 }
560 
561 void
563 {
564  _assembly[tid]->reinit(node);
565  _displaced_nl.reinitNodeFace(node, bnd_id, tid);
566  _displaced_aux.reinitNodeFace(node, bnd_id, tid);
567 }
568 
569 void
570 DisplacedProblem::reinitNodes(const std::vector<dof_id_type> & nodes, THREAD_ID tid)
571 {
572  _displaced_nl.reinitNodes(nodes, tid);
573  _displaced_aux.reinitNodes(nodes, tid);
574 }
575 
576 void
577 DisplacedProblem::reinitNodesNeighbor(const std::vector<dof_id_type> & nodes, THREAD_ID tid)
578 {
581 }
582 
583 void
584 DisplacedProblem::reinitNeighbor(const Elem * elem, unsigned int side, THREAD_ID tid)
585 {
586  const Elem * neighbor = elem->neighbor_ptr(side);
587  unsigned int neighbor_side = neighbor->which_neighbor_am_i(elem);
588 
589  _assembly[tid]->reinitElemAndNeighbor(elem, side, neighbor, neighbor_side);
590 
593 
594  _assembly[tid]->prepareNeighbor();
595 
596  BoundaryID bnd_id = 0; // some dummy number (it is not really used for anything, right now)
597  _displaced_nl.reinitElemFace(elem, side, bnd_id, tid);
598  _displaced_aux.reinitElemFace(elem, side, bnd_id, tid);
599 
600  _displaced_nl.reinitNeighborFace(neighbor, neighbor_side, bnd_id, tid);
601  _displaced_aux.reinitNeighborFace(neighbor, neighbor_side, bnd_id, tid);
602 }
603 
604 void
606  unsigned int neighbor_side,
607  const std::vector<Point> & physical_points,
608  THREAD_ID tid)
609 {
610  // Reinit shape functions
611  _assembly[tid]->reinitNeighborAtPhysical(neighbor, neighbor_side, physical_points);
612 
613  // Set the neighbor dof indices
616 
618 
619  // Compute values at the points
620  _displaced_nl.reinitNeighborFace(neighbor, neighbor_side, 0, tid);
621  _displaced_aux.reinitNeighborFace(neighbor, neighbor_side, 0, tid);
622 }
623 
624 void
626  const std::vector<Point> & physical_points,
627  THREAD_ID tid)
628 {
629  // Reinit shape functions
630  _assembly[tid]->reinitNeighborAtPhysical(neighbor, physical_points);
631 
632  // Set the neighbor dof indices
635 
637 
638  // Compute values at the points
639  _displaced_nl.reinitNeighbor(neighbor, tid);
640  _displaced_aux.reinitNeighbor(neighbor, tid);
641 }
642 
643 void
645 {
648 }
649 
650 void
652 {
653  _assembly[tid]->prepareOffDiagScalar();
654 }
655 
656 void
657 DisplacedProblem::getDiracElements(std::set<const Elem *> & elems)
658 {
660 }
661 
662 void
664 {
666 }
667 
668 void
670 {
671  _assembly[tid]->addResidual(getVectorTags());
672 }
673 
674 void
676 {
677  _assembly[tid]->addResidualNeighbor(getVectorTags());
678 }
679 
680 void
682 {
683  _assembly[tid]->cacheResidual();
684 }
685 
686 void
688 {
689  _assembly[tid]->cacheResidualNeighbor();
690 }
691 
692 void
694 {
695  _assembly[tid]->addCachedResiduals();
696 }
697 
698 void
699 DisplacedProblem::addCachedResidualDirectly(NumericVector<Number> & residual, THREAD_ID tid)
700 {
701  _assembly[tid]->addCachedResidual(residual, _displaced_nl.timeVectorTag());
702  _assembly[tid]->addCachedResidual(residual, _displaced_nl.nonTimeVectorTag());
703 }
704 
705 void
706 DisplacedProblem::setResidual(NumericVector<Number> & residual, THREAD_ID tid)
707 {
708  _assembly[tid]->setResidual(residual);
709 }
710 
711 void
712 DisplacedProblem::setResidualNeighbor(NumericVector<Number> & residual, THREAD_ID tid)
713 {
714  _assembly[tid]->setResidualNeighbor(residual);
715 }
716 
717 void
719 {
720  _assembly[tid]->addJacobian();
721 }
722 
723 void
725 {
726  _assembly[tid]->addJacobianNonlocal();
727 }
728 
729 void
731 {
732  _assembly[tid]->addJacobianNeighbor();
733 }
734 
735 void
737 {
738  _assembly[tid]->cacheJacobian();
739 }
740 
741 void
743 {
744  _assembly[tid]->cacheJacobianNonlocal();
745 }
746 
747 void
749 {
750  _assembly[tid]->cacheJacobianNeighbor();
751 }
752 
753 void
755 {
756  _assembly[tid]->addCachedJacobian();
757 }
758 
759 void
760 DisplacedProblem::addJacobianBlock(SparseMatrix<Number> & jacobian,
761  unsigned int ivar,
762  unsigned int jvar,
763  const DofMap & dof_map,
764  std::vector<dof_id_type> & dof_indices,
765  THREAD_ID tid)
766 {
767  _assembly[tid]->addJacobianBlock(jacobian, ivar, jvar, dof_map, dof_indices);
768 }
769 
770 void
771 DisplacedProblem::addJacobianBlockNonlocal(SparseMatrix<Number> & jacobian,
772  unsigned int ivar,
773  unsigned int jvar,
774  const DofMap & dof_map,
775  const std::vector<dof_id_type> & idof_indices,
776  const std::vector<dof_id_type> & jdof_indices,
777  THREAD_ID tid)
778 {
779  _assembly[tid]->addJacobianBlockNonlocal(
780  jacobian, ivar, jvar, dof_map, idof_indices, jdof_indices);
781 }
782 
783 void
784 DisplacedProblem::addJacobianNeighbor(SparseMatrix<Number> & jacobian,
785  unsigned int ivar,
786  unsigned int jvar,
787  const DofMap & dof_map,
788  std::vector<dof_id_type> & dof_indices,
789  std::vector<dof_id_type> & neighbor_dof_indices,
790  THREAD_ID tid)
791 {
792  _assembly[tid]->addJacobianNeighbor(
793  jacobian, ivar, jvar, dof_map, dof_indices, neighbor_dof_indices);
794 }
795 
796 void
798 {
799  _assembly[tid]->copyShapes(var);
800 }
801 
802 void
804 {
805  _assembly[tid]->copyFaceShapes(var);
806 }
807 
808 void
810 {
811  _assembly[tid]->copyNeighborShapes(var);
812 }
813 
814 void
816 {
817  TIME_SECTION(_update_geometric_search_timer);
818 
820 }
821 
822 void
824 {
825  // mesh changed
826  _eq.reinit();
827  _mesh.meshChanged();
828 
829  // Since the Mesh changed, update the PointLocator object used by DiracKernels.
831 
833 }
834 
835 void
837 {
838  _mproblem.addGhostedElem(elem_id);
839 }
840 
841 void
843 {
844  _mproblem.addGhostedBoundary(boundary_id);
845 }
846 
847 void
849 {
851 }
852 
853 MooseMesh &
855 {
856  return _ref_mesh;
857 }
858 
859 void
861 {
862 }
863 
864 bool
866 {
867  return _mproblem.converged();
868 }
869 
870 bool
872 {
874 }
875 
876 void
878 {
879 }
880 
881 void
883 {
884 }
885 
886 void
888 {
889  // If undisplaceMesh() is called during initial adaptivity, it is
890  // not valid to call _mesh.getActiveSemiLocalNodeRange() since it is
891  // not set up yet. So we are creating the Range by hand.
892  //
893  // We must undisplace *all* our nodes to the _ref_mesh
894  // configuration, not just the local ones, since the partitioners
895  // require this. We are using the GRAIN_SIZE=1 from MooseMesh.C,
896  // not sure how this value was decided upon.
897  //
898  // (DRG: The grainsize parameter is ultimately passed to TBB to help
899  // it choose how to split up the range. A grainsize of 1 says "split
900  // it as much as you want". Years ago I experimentally found that it
901  // didn't matter much and that using 1 was fine.)
902  //
903  // Note: we don't have to invalidate/update as much stuff as
904  // DisplacedProblem::updateMesh() does, since this will be handled
905  // by a later call to updateMesh().
906  NodeRange node_range(_mesh.getMesh().nodes_begin(),
907  _mesh.getMesh().nodes_end(),
908  /*grainsize=*/1);
909 
910  ResetDisplacedMeshThread rdmt(_mproblem, *this);
911 
912  // Undisplace the mesh using threads.
913  Threads::parallel_reduce(node_range, rdmt);
914 }
virtual void cacheJacobian(THREAD_ID tid) override
VarFieldType
Definition: MooseTypes.h:488
GeometricSearchData _geometric_search_data
virtual void cacheResidualNeighbor(THREAD_ID tid) override
virtual void addJacobianNeighbor(THREAD_ID tid) override
virtual void reinitNode(const Node *node, THREAD_ID tid)
Reinit nodal assembly info.
Definition: SystemBase.C:372
virtual void addGhostedElem(dof_id_type elem_id) override
Will make sure that all dofs connected to elem_id are ghosted to this processor.
virtual bool computingInitialResidual() const override
Returns true if the problem is in the process of computing it&#39;s initial residual. ...
virtual bool converged() override
virtual TagID getVectorTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:91
virtual void setResidual(NumericVector< Number > &residual, THREAD_ID tid) override
DisplacedProblem(const InputParameters &parameters)
PerfID _update_geometric_search_timer
virtual System & getSystem(const std::string &var_name) override
Returns the equation system containing the variable provided.
const CouplingMatrix * couplingMatrix()
virtual std::map< TagName, TagID > & getVectorTags()
Return all vector tags, where a tag is represented by a map from name to ID.
Definition: SubProblem.h:107
virtual void reinitScalars(THREAD_ID tid) override
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
virtual TagName vectorTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:106
virtual void addGhostedElem(dof_id_type elem_id) override
Will make sure that all dofs connected to elem_id are ghosted to this processor.
virtual void saveOldSolutions()
Allocate vectors and save old solutions into them.
virtual void reinitScalars(THREAD_ID tid)
Reinit scalar varaibles.
Definition: SystemBase.C:422
virtual void reinitNeighborFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)
Compute the values of the variables at all the current points.
Definition: SystemBase.C:345
void undisplaceMesh()
Resets the displaced mesh to the reference mesh.
virtual TagID addVectorTag(TagName tag_name)
Create a Tag.
Definition: SubProblem.C:66
virtual Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) override
NonlinearSystemBase & getNonlinearSystemBase()
unsigned int TagID
Definition: MooseTypes.h:162
virtual TransientExplicitSystem & sys()
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)
Reinit assembly info for a side of an element.
Definition: SystemBase.C:334
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblem.h:24
virtual void initAdaptivity()
VectorValue< Real > RealVectorValue
Definition: Assembly.h:31
virtual void prepareFace(const Elem *elem, THREAD_ID tid) override
virtual void prepareAssembly(THREAD_ID tid) override
virtual void addJacobianNonlocal(THREAD_ID tid)
virtual void addVariable(const std::string &var_name, const FEType &type, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL)
Adds a variable to the system.
Definition: SystemBase.C:613
virtual void reinitElem(const Elem *elem, THREAD_ID tid)
Reinit an element assembly info.
Definition: SystemBase.C:314
FEProblemBase & _mproblem
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, THREAD_ID tid) override
std::vector< std::unique_ptr< Assembly > > _assembly
virtual void addAuxScalarVariable(const std::string &var_name, Order order, Real scale_factor=1., const std::set< SubdomainID > *const active_subdomains=NULL)
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided...
const NumericVector< Number > *const & currentSolution() const override
The solution vector that is currently being operated on.
DisplacedSystem _displaced_aux
virtual void setResidualNeighbor(NumericVector< Number > &residual, THREAD_ID tid) override
virtual void addGhostedBoundary(BoundaryID boundary_id) override
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
MooseVariableFEBase & getVariableHelper(THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type, Moose::VarFieldType expected_var_field_type, SystemBase &nl, SystemBase &aux)
Helper function called by getVariable that handles the logic for checking whether Variables of the re...
Definition: SubProblem.C:614
DisplacedSystem _displaced_nl
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
PerfID _eq_init_timer
Timers.
virtual void cacheResidual(THREAD_ID tid) override
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, THREAD_ID tid) override
virtual void prepareFace(THREAD_ID tid, bool resize_data)
Prepare the system for use on sides.
Definition: SystemBase.C:265
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
virtual void createQRules(QuadratureType type, Order order, Order volume_order, Order face_order)
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of nodes.
Definition: SystemBase.C:400
virtual void addJacobianBlockNonlocal(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, THREAD_ID tid)
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of neighbor nodes.
Definition: SystemBase.C:411
virtual void reinitOffDiagScalars(THREAD_ID tid) override
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
registerMooseObject("MooseApp", DisplacedProblem)
virtual void onTimestepBegin() override
virtual unsigned int numVectorTags() const override
The total number of tags.
virtual void syncSolutions()
Copy the solutions on the undisplaced systems to the displaced systems.
virtual std::set< dof_id_type > & ghostedElems() override
Return the list of elements that should have their DoFs ghosted to this processor.
virtual void reinitNeighbor(const Elem *elem, unsigned int side, THREAD_ID tid) override
virtual void solve() override
InputParameters validParams< SubProblem >()
Definition: SubProblem.C:23
virtual void meshChanged() override
virtual void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1020
const std::string & type() const
Get the type of this object.
Definition: MooseObject.h:53
virtual bool matrixTagExists(const TagName &tag_name)
Check to see if a particular Tag exists.
Definition: SubProblem.C:129
virtual void addCachedJacobian(THREAD_ID tid) override
virtual TagID timeVectorTag() override
Ideally, we should not need this API.
void addTimeIntegrator(std::shared_ptr< TimeIntegrator > ti) override
bool hasJacobian() const
Returns _has_jacobian.
EquationSystems _eq
virtual bool converged() override
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:932
virtual void addResidual(THREAD_ID tid) override
virtual void cacheJacobianNonlocal(THREAD_ID tid)
virtual void prepareNeighborShapes(unsigned int var, THREAD_ID tid) override
virtual void setCurrentSubdomainID(const Elem *elem, THREAD_ID tid) override
MultiPointMap & getPoints()
Returns a writeable reference to the _points container.
virtual TagID getMatrixTagID(const TagName &tag_name) override
Get a TagID from a TagName.
virtual VectorMooseVariable & getVectorVariable(THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested VectorMooseVariable which may be in any system...
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2567
virtual TagName vectorTagName(TagID tag) override
Retrieve the name associated with a TagID.
MooseMesh & _ref_mesh
reference mesh
void extraSendList(std::vector< dof_id_type > &send_list, void *context)
///< Type of coordinate system
Definition: SystemBase.C:31
virtual void prepareAssemblyNeighbor(THREAD_ID tid)
virtual void prepare(const Elem *elem, THREAD_ID tid) override
virtual void addJacobianBlock(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, std::vector< dof_id_type > &dof_indices, THREAD_ID tid) override
boundary_id_type BoundaryID
virtual bool vectorTagExists(TagID tag) override
Check to see if a particular Tag exists.
virtual void clearDiracInfo() override
Gets called before Dirac Kernels are asked to add the points they are supposed to be evaluated in...
bool constJacobian() const
Returns _const_jacobian (whether a MOOSE object has specified that the Jacobian is the same as the pr...
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:481
virtual void restoreOldSolutions()
Restore old solutions from the backup vectors and deallocate them.
virtual void prepareNeighbor(THREAD_ID tid)
Prepare the system for use.
Definition: SystemBase.C:298
DofMap & dof_map
virtual TagID addMatrixTag(TagName tag_name)
Create a Tag.
Definition: SubProblem.C:112
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
virtual void prepareBlockNonlocal(unsigned int ivar, unsigned int jvar, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, THREAD_ID tid)
virtual bool hasVariable(const std::string &var_name) const override
virtual TagID addVectorTag(TagName tag_name) override
Create a Tag.
void reinit()
Completely redo all geometric search objects.
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, THREAD_ID tid) override
virtual std::set< dof_id_type > & ghostedElems()
Return the list of elements that should have their DoFs ghosted to this processor.
Definition: SubProblem.h:561
std::vector< std::string > _displacements
virtual bool vectorTagExists(TagID tag)
Check to see if a particular Tag exists.
Definition: SubProblem.h:112
subdomain_id_type SubdomainID
void clearPoints()
Remove all of the current points and elements.
const NumericVector< Number > * _aux_solution
virtual MooseVariableFEBase & getVariable(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) override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
virtual void addResidualNeighbor(THREAD_ID tid) override
AuxiliarySystem & getAuxiliarySystem()
virtual std::map< TagName, TagID > & getVectorTags() override
Return all vector tags, where a tag is represented by a map from name to ID.
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, THREAD_ID tid, bool=false) override
virtual void reinitNeighbor(const Elem *elem, THREAD_ID tid)
Compute the values of the variables at all the current points.
Definition: SystemBase.C:356
virtual TagID nonTimeVectorTag() override
virtual void updateMesh()
Copy the solutions on the undisplaced systems to the displaced systems and reinitialize the geometry ...
virtual bool isTransient() const override
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:668
virtual unsigned int numVectorTags() const
The total number of tags.
Definition: SubProblem.h:122
GeometricSearchType
Used to select groups of geometric search objects to update.
virtual System & system() override
Get the reference to the libMesh system.
CoordinateSystemType
Definition: MooseTypes.h:556
virtual void onTimestepEnd() override
const NumericVector< Number > *const & currentSolution() const override
The solution vector that is currently being operated on.
virtual void addJacobian(THREAD_ID tid) override
virtual void cacheJacobianNeighbor(THREAD_ID tid) override
virtual void prepareFaceShapes(unsigned int var, THREAD_ID tid) override
virtual TagID getVectorTagID(const TagName &tag_name) override
Get a TagID from a TagName.
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:157
virtual TagName matrixTagName(TagID tag) override
Retrieve the name associated with a TagID.
virtual void saveOldSolutions()
Save the old and older solutions.
Definition: SystemBase.C:488
MatType type
bool _default_ghosting
Whether or not to use default libMesh coupling.
Definition: SubProblem.h:703
std::shared_ptr< TimeIntegrator > getSharedTimeIntegrator()
Definition: SystemBase.h:732
virtual void prepareShapes(unsigned int var, THREAD_ID tid) override
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
InputParameters validParams< DisplacedProblem >()
MooseVariableFE< T > & getFieldVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:136
virtual TagID addMatrixTag(TagName tag_name) override
Create a Tag.
virtual MooseVariable & getStandardVariable(THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested MooseVariable which may be in any system.
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, THREAD_ID tid)
Reinit nodal assembly info on a face.
Definition: SystemBase.C:386
virtual void addVariable(const std::string &var_name, const FEType &type, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL)
virtual TagID getMatrixTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:143
virtual Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) override
void update(GeometricSearchType type=ALL)
Update all of the search objects.
Class for scalar variables (they are different).
virtual void addCachedResidualDirectly(NumericVector< Number > &residual, THREAD_ID tid)
virtual bool matrixTagExists(const TagName &tag_name) override
Check to see if a particular Tag exists.
virtual void prepare(THREAD_ID tid)
Prepare the system for use.
Definition: SystemBase.C:242
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, THREAD_ID tid) override
virtual void addCachedResidual(THREAD_ID tid) override
virtual unsigned int numMatrixTags() const override
The total number of tags.
virtual void updateGeomSearch(GeometricSearchData::GeometricSearchType type=GeometricSearchData::ALL) override
const NumericVector< Number > * _nl_solution
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, THREAD_ID tid) override
std::set< const Elem * > & getElements()
Returns a writeable reference to the _elements container.
MooseMesh & refMesh()
Definition: Moose.h:112
virtual void init() override
Initialize the system.
virtual void reinitNode(const Node *node, THREAD_ID tid) override
virtual bool isTransient() const override
virtual void getDiracElements(std::set< const Elem *> &elems) override
Fills "elems" with the elements that should be looped over for Dirac Kernels.
virtual bool computingInitialResidual() const override
Returns true if the problem is in the process of computing it&#39;s initial residual. ...
DiracKernelInfo _dirac_kernel_info
Definition: SubProblem.h:656
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:677
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid) override
virtual bool reinitDirac(const Elem *elem, THREAD_ID tid) override
Returns true if the Problem has Dirac kernels it needs to compute on elem.
virtual void addGhostedBoundary(BoundaryID boundary_id) override
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
virtual void reinitElem(const Elem *elem, THREAD_ID tid) override
virtual void prepareNonlocal(THREAD_ID tid)
void updatePointLocator(const MooseMesh &mesh)
Called during FEProblemBase::meshChanged() to update the PointLocator object used by the DiracKernels...
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a scalar variable with specified number.
Definition: SystemBase.C:149
virtual void restoreOldSolutions()
Restore the old and older solutions when the saved solutions present.
Definition: SystemBase.C:513
virtual void addScalarVariable(const std::string &var_name, Order order, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL)
Adds a scalar variable.
Definition: SystemBase.C:644
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:158
void meshChanged()
Declares that the MooseMesh has changed, invalidates cached data and rebuilds caches.
Definition: MooseMesh.C:490
unsigned int THREAD_ID
Definition: MooseTypes.h:161
virtual void ghostGhostedBoundaries() override
Causes the boundaries added using addGhostedBoundary to actually be ghosted.
virtual void init() override
virtual void ghostGhostedBoundaries() override
Causes the boundaries added using addGhostedBoundary to actually be ghosted.
virtual void addAuxVariable(const std::string &var_name, const FEType &type, const std::set< SubdomainID > *const active_subdomains=NULL)
virtual void addScalarVariable(const std::string &var_name, Order order, Real scale_factor=1., const std::set< SubdomainID > *const active_subdomains=NULL)