www.mooseframework.org
SubProblem.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 #include "SubProblem.h"
11 #include "Factory.h"
12 #include "MooseMesh.h"
13 #include "Conversion.h"
14 #include "Function.h"
15 #include "MooseApp.h"
16 #include "MooseVariableFE.h"
17 #include "MooseArray.h"
18 #include "SystemBase.h"
19 #include "Assembly.h"
20 
21 template <>
24 {
26  params.addPrivateParam<MooseMesh *>("mesh");
27 
28  params.addParam<bool>(
29  "default_ghosting",
30  false,
31  "Whether or not to use libMesh's default amount of algebraic and geometric ghosting");
32 
33  params.addParamNamesToGroup("default_ghosting", "Advanced");
34 
35  return params;
36 }
37 
38 // SubProblem /////
40  : Problem(parameters),
41  _factory(_app.getFactory()),
42  _nonlocal_cm(),
43  _requires_nonlocal_coupling(false),
44  _default_ghosting(getParam<bool>("default_ghosting")),
45  _rz_coord_axis(1), // default to RZ rotation around y-axis
46  _currently_computing_jacobian(false),
47  _computing_nonlinear_residual(false),
48  _safe_access_tagged_matrices(false),
49  _safe_access_tagged_vectors(false),
50  _have_ad_objects(false)
51 {
52  unsigned int n_threads = libMesh::n_threads();
53  _active_elemental_moose_variables.resize(n_threads);
54  _has_active_elemental_moose_variables.resize(n_threads);
55  _active_material_property_ids.resize(n_threads);
56 
57  _active_fe_var_coupleable_matrix_tags.resize(n_threads);
58  _active_fe_var_coupleable_vector_tags.resize(n_threads);
59  _active_sc_var_coupleable_matrix_tags.resize(n_threads);
60  _active_sc_var_coupleable_vector_tags.resize(n_threads);
61 }
62 
64 
65 TagID
66 SubProblem::addVectorTag(TagName tag_name)
67 {
68  auto tag_name_upper = MooseUtils::toUpper(tag_name);
69  auto existing_tag = _vector_tag_name_to_tag_id.find(tag_name_upper);
70  if (existing_tag == _vector_tag_name_to_tag_id.end())
71  {
72  auto tag_id = _vector_tag_name_to_tag_id.size();
73 
74  _vector_tag_name_to_tag_id[tag_name_upper] = tag_id;
75 
76  _vector_tag_id_to_tag_name[tag_id] = tag_name_upper;
77  }
78 
79  return _vector_tag_name_to_tag_id.at(tag_name_upper);
80 }
81 
82 bool
83 SubProblem::vectorTagExists(const TagName & tag_name)
84 {
85  auto tag_name_upper = MooseUtils::toUpper(tag_name);
86 
87  return _vector_tag_name_to_tag_id.find(tag_name_upper) != _vector_tag_name_to_tag_id.end();
88 }
89 
90 TagID
91 SubProblem::getVectorTagID(const TagName & tag_name)
92 {
93  auto tag_name_upper = MooseUtils::toUpper(tag_name);
94 
95  if (!vectorTagExists(tag_name))
96  mooseError("Vector tag: ",
97  tag_name,
98  " does not exist. ",
99  "If this is a TimeKernel then this may have happened because you didn't "
100  "specify a Transient Executioner.");
101 
102  return _vector_tag_name_to_tag_id.at(tag_name_upper);
103 }
104 
105 TagName
107 {
108  return _vector_tag_id_to_tag_name[tag];
109 }
110 
111 TagID
112 SubProblem::addMatrixTag(TagName tag_name)
113 {
114  auto tag_name_upper = MooseUtils::toUpper(tag_name);
115  auto existing_tag = _matrix_tag_name_to_tag_id.find(tag_name_upper);
116  if (existing_tag == _matrix_tag_name_to_tag_id.end())
117  {
118  auto tag_id = _matrix_tag_name_to_tag_id.size();
119 
120  _matrix_tag_name_to_tag_id[tag_name_upper] = tag_id;
121 
122  _matrix_tag_id_to_tag_name[tag_id] = tag_name_upper;
123  }
124 
125  return _matrix_tag_name_to_tag_id.at(tag_name_upper);
126 }
127 
128 bool
129 SubProblem::matrixTagExists(const TagName & tag_name)
130 {
131  auto tag_name_upper = MooseUtils::toUpper(tag_name);
132 
133  return _matrix_tag_name_to_tag_id.find(tag_name_upper) != _matrix_tag_name_to_tag_id.end();
134 }
135 
136 bool
138 {
139  return _matrix_tag_id_to_tag_name.find(tag_id) != _matrix_tag_id_to_tag_name.end();
140 }
141 
142 TagID
143 SubProblem::getMatrixTagID(const TagName & tag_name)
144 {
145  auto tag_name_upper = MooseUtils::toUpper(tag_name);
146 
147  if (!matrixTagExists(tag_name))
148  mooseError("Matrix tag: ",
149  tag_name,
150  " does not exist. ",
151  "If this is a TimeKernel then this may have happened because you didn't "
152  "specify a Transient Executioner.");
153 
154  return _matrix_tag_name_to_tag_id.at(tag_name_upper);
155 }
156 
157 TagName
159 {
160  return _matrix_tag_id_to_tag_name[tag];
161 }
162 
163 void
165 {
167 }
168 
169 void
171 {
173 }
174 
175 void
177 {
179 }
180 
181 void
183 {
185 }
186 
187 const std::set<TagID> &
189 {
191 }
192 
193 const std::set<TagID> &
195 {
197 }
198 
199 void
201 {
203 }
204 
205 void
207 {
209 }
210 
211 void
213 {
215 }
216 
217 void
219 {
221 }
222 
223 const std::set<TagID> &
225 {
227 }
228 
229 const std::set<TagID> &
231 {
233 }
234 
235 void
236 SubProblem::setActiveElementalMooseVariables(const std::set<MooseVariableFEBase *> & moose_vars,
237  THREAD_ID tid)
238 {
239  if (!moose_vars.empty())
240  {
242  _active_elemental_moose_variables[tid] = moose_vars;
243  }
244 }
245 
246 const std::set<MooseVariableFEBase *> &
248 {
250 }
251 
252 bool
254 {
256 }
257 
258 void
260 {
263 }
264 
265 void
266 SubProblem::setActiveMaterialProperties(const std::set<unsigned int> & mat_prop_ids, THREAD_ID tid)
267 {
268  if (!mat_prop_ids.empty())
269  _active_material_property_ids[tid] = mat_prop_ids;
270 }
271 
272 const std::set<unsigned int> &
274 {
275  return _active_material_property_ids[tid];
276 }
277 
278 bool
280 {
281  return !_active_material_property_ids[tid].empty();
282 }
283 
284 void
286 {
287  _active_material_property_ids[tid].clear();
288 }
289 
290 std::set<SubdomainID>
291 SubProblem::getMaterialPropertyBlocks(const std::string & prop_name)
292 {
293  std::set<SubdomainID> blocks;
294 
295  for (const auto & it : _map_block_material_props)
296  {
297  const std::set<std::string> & prop_names = it.second;
298  std::set<std::string>::iterator name_it = prop_names.find(prop_name);
299  if (name_it != prop_names.end())
300  blocks.insert(it.first);
301  }
302 
303  return blocks;
304 }
305 
306 std::vector<SubdomainName>
307 SubProblem::getMaterialPropertyBlockNames(const std::string & prop_name)
308 {
309  std::set<SubdomainID> blocks = getMaterialPropertyBlocks(prop_name);
310  std::vector<SubdomainName> block_names;
311  block_names.reserve(blocks.size());
312  for (const auto & block_id : blocks)
313  {
314  SubdomainName name;
315  if (block_id == Moose::ANY_BLOCK_ID)
316  name = "ANY_BLOCK_ID";
317  else
318  {
319  name = mesh().getMesh().subdomain_name(block_id);
320  if (name.empty())
321  {
322  std::ostringstream oss;
323  oss << block_id;
324  name = oss.str();
325  }
326  }
327  block_names.push_back(name);
328  }
329 
330  return block_names;
331 }
332 
333 bool
334 SubProblem::hasBlockMaterialProperty(SubdomainID bid, const std::string & prop_name)
335 {
336  auto it = _map_block_material_props.find(bid);
337  if (it == _map_block_material_props.end())
338  return false;
339 
340  if (it->second.count(prop_name) > 0)
341  return true;
342  else
343  return false;
344 }
345 
346 // TODO: remove code duplication by templating
347 std::set<BoundaryID>
348 SubProblem::getMaterialPropertyBoundaryIDs(const std::string & prop_name)
349 {
350  std::set<BoundaryID> boundaries;
351 
352  for (const auto & it : _map_boundary_material_props)
353  {
354  const std::set<std::string> & prop_names = it.second;
355  std::set<std::string>::iterator name_it = prop_names.find(prop_name);
356  if (name_it != prop_names.end())
357  boundaries.insert(it.first);
358  }
359 
360  return boundaries;
361 }
362 
363 std::vector<BoundaryName>
364 SubProblem::getMaterialPropertyBoundaryNames(const std::string & prop_name)
365 {
366  std::set<BoundaryID> boundaries = getMaterialPropertyBoundaryIDs(prop_name);
367  std::vector<BoundaryName> boundary_names;
368  boundary_names.reserve(boundaries.size());
369  const BoundaryInfo & boundary_info = mesh().getMesh().get_boundary_info();
370 
371  for (const auto & bnd_id : boundaries)
372  {
373  BoundaryName name;
374  if (bnd_id == Moose::ANY_BOUNDARY_ID)
375  name = "ANY_BOUNDARY_ID";
376  else
377  {
378  name = boundary_info.get_sideset_name(bnd_id);
379  if (name.empty())
380  {
381  std::ostringstream oss;
382  oss << bnd_id;
383  name = oss.str();
384  }
385  }
386  boundary_names.push_back(name);
387  }
388 
389  return boundary_names;
390 }
391 
392 bool
393 SubProblem::hasBoundaryMaterialProperty(BoundaryID bid, const std::string & prop_name)
394 {
395  auto it = _map_boundary_material_props.find(bid);
396  if (it == _map_boundary_material_props.end())
397  return false;
398 
399  if (it->second.count(prop_name) > 0)
400  return true;
401  else
402  return false;
403 }
404 
405 void
406 SubProblem::storeSubdomainMatPropName(SubdomainID block_id, const std::string & name)
407 {
408  _map_block_material_props[block_id].insert(name);
409 }
410 
411 void
412 SubProblem::storeBoundaryMatPropName(BoundaryID boundary_id, const std::string & name)
413 {
414  _map_boundary_material_props[boundary_id].insert(name);
415 }
416 
417 void
418 SubProblem::storeSubdomainZeroMatProp(SubdomainID block_id, const MaterialPropertyName & name)
419 {
420  _zero_block_material_props[block_id].insert(name);
421 }
422 
423 void
424 SubProblem::storeBoundaryZeroMatProp(BoundaryID boundary_id, const MaterialPropertyName & name)
425 {
426  _zero_boundary_material_props[boundary_id].insert(name);
427 }
428 
429 void
430 SubProblem::storeSubdomainDelayedCheckMatProp(const std::string & requestor,
431  SubdomainID block_id,
432  const std::string & name)
433 {
434  _map_block_material_props_check[block_id].insert(std::make_pair(requestor, name));
435 }
436 
437 void
438 SubProblem::storeBoundaryDelayedCheckMatProp(const std::string & requestor,
439  BoundaryID boundary_id,
440  const std::string & name)
441 {
442  _map_boundary_material_props_check[boundary_id].insert(std::make_pair(requestor, name));
443 }
444 
445 void
447 {
448  // Variable for storing the value for ANY_BLOCK_ID/ANY_BOUNDARY_ID
450 
451  // Variable for storing all available blocks/boundaries from the mesh
452  std::set<SubdomainID> all_ids(mesh().meshSubdomains());
453 
454  // Loop through the properties to check
455  for (const auto & check_it : _map_block_material_props_check)
456  {
457  // The current id for the property being checked (BoundaryID || BlockID)
458  SubdomainID check_id = check_it.first;
459 
460  // In the case when the material being checked has an ID is set to ANY, then loop through all
461  // the possible ids and verify that the material property is defined.
462  std::set<SubdomainID> check_ids = {check_id};
463  if (check_id == any_id)
464  check_ids = all_ids;
465 
466  // Loop through all the block/boundary ids
467  for (const auto & id : check_ids)
468  {
469  // Loop through all the stored properties
470  for (const auto & prop_it : check_it.second)
471  {
472  // Produce an error if the material property is not defined on the current block/boundary
473  // and any block/boundary
474  // and not is not a zero material property.
475  if (_map_block_material_props[id].count(prop_it.second) == 0 &&
476  _map_block_material_props[any_id].count(prop_it.second) == 0 &&
477  _zero_block_material_props[id].count(prop_it.second) == 0 &&
478  _zero_block_material_props[any_id].count(prop_it.second) == 0)
479  {
480  std::string check_name = restrictionSubdomainCheckName(id);
481  if (check_name.empty())
482  check_name = std::to_string(id);
483  mooseError("Material property '",
484  prop_it.second,
485  "', requested by '",
486  prop_it.first,
487  "' is not defined on block ",
488  check_name);
489  }
490  }
491  }
492  }
493 }
494 
495 void
497 {
498  // Variable for storing the value for ANY_BLOCK_ID/ANY_BOUNDARY_ID
500 
501  // Variable for storing all available blocks/boundaries from the mesh
502  std::set<BoundaryID> all_ids(mesh().getBoundaryIDs());
503 
504  // Loop through the properties to check
505  for (const auto & check_it : _map_boundary_material_props_check)
506  {
507  // The current id for the property being checked (BoundaryID || BlockID)
508  BoundaryID check_id = check_it.first;
509 
510  // In the case when the material being checked has an ID is set to ANY, then loop through all
511  // the possible ids and verify that the material property is defined.
512  std::set<BoundaryID> check_ids{check_id};
513  if (check_id == any_id)
514  check_ids = all_ids;
515 
516  // Loop through all the block/boundary ids
517  for (const auto & id : check_ids)
518  {
519  // Loop through all the stored properties
520  for (const auto & prop_it : check_it.second)
521  {
522  // Produce an error if the material property is not defined on the current block/boundary
523  // and any block/boundary
524  // and not is not a zero material property.
525  if (_map_boundary_material_props[id].count(prop_it.second) == 0 &&
526  _map_boundary_material_props[any_id].count(prop_it.second) == 0 &&
527  _zero_boundary_material_props[id].count(prop_it.second) == 0 &&
528  _zero_boundary_material_props[any_id].count(prop_it.second) == 0)
529  {
530  std::string check_name = restrictionBoundaryCheckName(id);
531  if (check_name.empty())
532  check_name = std::to_string(id);
533  mooseError("Material property '",
534  prop_it.second,
535  "', requested by '",
536  prop_it.first,
537  "' is not defined on boundary ",
538  check_name);
539  }
540  }
541  }
542  }
543 }
544 
545 void
546 SubProblem::markMatPropRequested(const std::string & prop_name)
547 {
548  _material_property_requested.insert(prop_name);
549 }
550 
551 bool
552 SubProblem::isMatPropRequested(const std::string & prop_name) const
553 {
554  return _material_property_requested.find(prop_name) != _material_property_requested.end();
555 }
556 
559 {
560  return _dirac_kernel_info;
561 }
562 
563 Real
565 {
566  return 0;
567 }
568 
569 unsigned int
571 {
572  return 0;
573 }
574 
575 unsigned int
577 {
578  return 0;
579 }
580 
581 void
583 {
584  mooseError("This system does not support changing the mesh");
585 }
586 
587 std::string
589 {
590  // TODO: Put a better a interface in MOOSE
591  std::map<subdomain_id_type, std::string> & name_map = mesh().getMesh().set_subdomain_name_map();
592  std::map<subdomain_id_type, std::string>::const_iterator pos = name_map.find(check_id);
593  if (pos != name_map.end())
594  return pos->second;
595  return "";
596 }
597 
598 std::string
600 {
601  return mesh().getMesh().get_boundary_info().sideset_name(check_id);
602 }
603 
604 unsigned int
606 {
607  if (_rz_coord_axis == 0)
608  return 1; // if the rotation axis is x (0), then the radial direction is y (1)
609  else
610  return 0; // otherwise the radial direction is assumed to be x, i.e., the rotation axis is y
611 }
612 
615  const std::string & var_name,
616  Moose::VarKindType expected_var_type,
617  Moose::VarFieldType expected_var_field_type,
618  SystemBase & nl,
619  SystemBase & aux)
620 {
621  // Eventual return value
622  MooseVariableFEBase * var = nullptr;
623 
624  // First check that the variable is found on the expected system.
625  if (expected_var_type == Moose::VarKindType::VAR_ANY)
626  {
627  if (nl.hasVariable(var_name))
628  var = &(nl.getVariable(tid, var_name));
629  else if (aux.hasVariable(var_name))
630  var = &(aux.getVariable(tid, var_name));
631  else
632  mooseError("Unknown variable " + var_name);
633  }
634  else if (expected_var_type == Moose::VarKindType::VAR_NONLINEAR && nl.hasVariable(var_name))
635  var = &(nl.getVariable(tid, var_name));
636  else if (expected_var_type == Moose::VarKindType::VAR_AUXILIARY && aux.hasVariable(var_name))
637  var = &(aux.getVariable(tid, var_name));
638  else
639  {
640  std::string expected_var_type_string =
641  (expected_var_type == Moose::VarKindType::VAR_NONLINEAR ? "nonlinear" : "auxiliary");
642  mooseError("No ",
643  expected_var_type_string,
644  " variable named ",
645  var_name,
646  " found. "
647  "Did you specify an auxiliary variable when you meant to specify a nonlinear "
648  "variable (or vice-versa)?");
649  }
650 
651  // Now make sure the var found has the expected field type.
652  bool var_is_vector = var->isVector();
653  if ((expected_var_field_type == Moose::VarFieldType::VAR_FIELD_ANY) ||
654  (var_is_vector && expected_var_field_type == Moose::VarFieldType::VAR_FIELD_VECTOR) ||
655  (!var_is_vector && expected_var_field_type == Moose::VarFieldType::VAR_FIELD_STANDARD))
656  return *var;
657  else
658  {
659  std::string expected_var_field_type_string =
660  (expected_var_field_type == Moose::VarFieldType::VAR_FIELD_STANDARD ? "standard"
661  : "vector");
662 
663  mooseError("No ",
664  expected_var_field_type_string,
665  " variable named ",
666  var_name,
667  " found. "
668  "Did you specify a vector variable when you meant to specify a standard variable "
669  "(or vice-versa)?");
670  }
671 }
672 
673 void
675  unsigned int side,
676  BoundaryID bnd_id,
677  Real tolerance,
678  const std::vector<Point> * const pts,
679  const std::vector<Real> * const weights,
680  THREAD_ID tid)
681 {
682  // - Set our _current_elem for proper dof index getting in the moose variables
683  // - Reinitialize all of our FE objects so we have current phi, dphi, etc. data
684  // Note that our number of shape functions will reflect the number of shapes associated with the
685  // interior element while the number of quadrature points will be determined by the passed pts
686  // parameter (which presumably will have a number of pts reflective of a facial quadrature rule)
687  assembly(tid).reinitElemFaceRef(elem, side, tolerance, pts, weights);
688 
689  // Actually get the dof indices in the moose variables
692 
693  // With the dof indices set in the moose variables, now let's properly size
694  // our local residuals/Jacobians
696  assembly(tid).prepareResidual();
697 
698  // Let's finally compute our variable values!
699  systemBaseNonlinear().reinitElemFace(elem, side, bnd_id, tid);
700  systemBaseAuxiliary().reinitElemFace(elem, side, bnd_id, tid);
701 }
702 
703 void
704 SubProblem::reinitNeighborFaceRef(const Elem * neighbor_elem,
705  unsigned int neighbor_side,
706  BoundaryID bnd_id,
707  Real tolerance,
708  const std::vector<Point> * const pts,
709  const std::vector<Real> * const weights,
710  THREAD_ID tid)
711 {
712  // - Set our _current_neighbor_elem for proper dof index getting in the moose variables
713  // - Reinitialize all of our FE objects so we have current phi, dphi, etc. data
714  // Note that our number of shape functions will reflect the number of shapes associated with the
715  // interior element while the number of quadrature points will be determined by the passed pts
716  // parameter (which presumably will have a number of pts reflective of a facial quadrature rule)
717  assembly(tid).reinitNeighborFaceRef(neighbor_elem, neighbor_side, tolerance, pts, weights);
718 
719  // Actually get the dof indices in the moose variables
722 
723  // With the dof indices set in the moose variables, now let's properly size
724  // our local residuals/Jacobians
725  assembly(tid).prepareNeighbor();
726 
727  // Let's finally compute our variable values!
728  systemBaseNonlinear().reinitNeighborFace(neighbor_elem, neighbor_side, bnd_id, tid);
729  systemBaseAuxiliary().reinitNeighborFace(neighbor_elem, neighbor_side, bnd_id, tid);
730 }
731 
732 void
734  const std::vector<Point> * const pts,
735  const std::vector<Real> * const weights,
736  THREAD_ID tid)
737 {
738  // - Set our _current_lower_d_elem for proper dof index getting in the moose variables
739  // - Reinitialize all of our lower-d FE objects so we have current phi, dphi, etc. data
740  assembly(tid).reinitLowerDElemRef(elem, pts, weights);
741 
742  // Actually get the dof indices in the moose variables
745 
746  // With the dof indices set in the moose variables, now let's properly size
747  // our local residuals/Jacobians
748  assembly(tid).prepareLowerD();
749 
750  // Let's finally compute our variable values!
753 }
754 
755 void
757 {
758  assembly(tid).reinitMortarElem(elem);
759 }
virtual unsigned int nNonlinearIterations() const
Definition: SubProblem.C:570
virtual MooseMesh & mesh()=0
VarFieldType
Definition: MooseTypes.h:488
unsigned int getAxisymmetricRadialCoord() const
Returns the desired radial direction for RZ coordinate transformation.
Definition: SubProblem.C:605
std::map< TagName, TagID > _matrix_tag_name_to_tag_id
The currently declared tags.
Definition: SubProblem.h:643
virtual bool hasActiveMaterialProperties(THREAD_ID tid) const
Method to check whether or not a list of active material roperties has been set.
Definition: SubProblem.C:279
virtual TagID getVectorTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:91
virtual bool hasBoundaryMaterialProperty(BoundaryID boundary_id, const std::string &prop_name)
Check if a material property is defined on a block.
Definition: SubProblem.C:393
std::map< BoundaryID, std::multimap< std::string, std::string > > _map_boundary_material_props_check
Definition: SubProblem.h:678
virtual TagName vectorTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:106
The DiracKernelInfo object is a place where all the Dirac points added by different DiracKernels are ...
unsigned int _rz_coord_axis
Storage for RZ axis selection.
Definition: SubProblem.h:709
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
virtual std::set< BoundaryID > getMaterialPropertyBoundaryIDs(const std::string &prop_name)
Get a vector containing the block ids the material property is defined on.
Definition: SubProblem.C:348
std::map< TagName, TagID > _vector_tag_name_to_tag_id
The currently declared tags.
Definition: SubProblem.h:637
virtual TagID addVectorTag(TagName tag_name)
Create a Tag.
Definition: SubProblem.C:66
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
Definition: MooseUtils.C:651
unsigned int TagID
Definition: MooseTypes.h:162
virtual void storeSubdomainZeroMatProp(SubdomainID block_id, const MaterialPropertyName &name)
Adds to a map based on block ids of material properties for which a zero value can be returned...
Definition: SubProblem.C:418
virtual bool hasBlockMaterialProperty(SubdomainID block_id, const std::string &prop_name)
Check if a material property is defined on a block.
Definition: SubProblem.C:334
std::string restrictionBoundaryCheckName(BoundaryID check_id)
Definition: SubProblem.C:599
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...
void prepareJacobianBlock()
Sizes and zeroes the Jacobian blocks used for the current element.
Definition: Assembly.C:2302
virtual bool hasActiveElementalMooseVariables(THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:253
virtual Real finalNonlinearResidual() const
Definition: SubProblem.C:564
virtual void storeSubdomainDelayedCheckMatProp(const std::string &requestor, SubdomainID block_id, const std::string &name)
Adds to a map based on block ids of material properties to validate.
Definition: SubProblem.C:430
virtual void reinitLowerD(THREAD_ID tid)
Compute the values of the variables on the lower dimensional element.
Definition: SystemBase.C:364
virtual ~SubProblem()
Definition: SubProblem.C:63
virtual Assembly & assembly(THREAD_ID tid)=0
void reinitMortarElem(const Elem *elem, THREAD_ID tid=0)
Reinit a mortar element to obtain a valid JxW.
Definition: SubProblem.C:756
virtual void storeBoundaryZeroMatProp(BoundaryID boundary_id, const MaterialPropertyName &name)
Adds to a map based on boundary ids of material properties for which a zero value can be returned...
Definition: SubProblem.C:424
Class that hold the whole problem being solved.
Definition: Problem.h:24
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
virtual void setActiveScalarVariableCoupleableVectorTags(std::set< TagID > &vtags, THREAD_ID tid)
Definition: SubProblem.C:206
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void storeBoundaryDelayedCheckMatProp(const std::string &requestor, BoundaryID boundary_id, const std::string &name)
Adds to a map based on boundary ids of material properties to validate.
Definition: SubProblem.C:438
void prepareNeighbor()
Definition: Assembly.C:2419
void reinitNeighborFaceRef(const Elem *neighbor_elem, unsigned int neighbor_side, BoundaryID bnd_id, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, THREAD_ID tid=0)
reinitialize FE objects on a given neighbor element on a given side at a given set of reference point...
Definition: SubProblem.C:704
const std::set< TagID > & getActiveScalarVariableCoupleableMatrixTags(THREAD_ID tid) const
Definition: SubProblem.C:224
virtual unsigned int nLinearIterations() const
Definition: SubProblem.C:576
virtual void clearActiveScalarVariableCoupleableVectorTags(THREAD_ID tid)
Definition: SubProblem.C:212
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
Base class for a system (of equations)
Definition: SystemBase.h:92
virtual const std::set< MooseVariableFEBase * > & getActiveElementalMooseVariables(THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:247
virtual void setActiveFEVariableCoupleableMatrixTags(std::set< TagID > &mtags, THREAD_ID tid)
Definition: SubProblem.C:164
virtual void markMatPropRequested(const std::string &)
Helper method for adding a material property name to the _material_property_requested set...
Definition: SubProblem.C:546
std::vector< std::set< TagID > > _active_sc_var_coupleable_vector_tags
Definition: SubProblem.h:697
std::map< BoundaryID, std::set< MaterialPropertyName > > _zero_boundary_material_props
Definition: SubProblem.h:666
void reinitLowerDElemRef(const Elem *elem, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, THREAD_ID tid=0)
reinitialize a lower dimensional FE object at a given set of reference points and then compute variab...
Definition: SubProblem.C:733
std::map< BoundaryID, std::set< std::string > > _map_boundary_material_props
Map for boundary material properties (boundary_id -> list of properties)
Definition: SubProblem.h:662
virtual bool matrixTagExists(const TagName &tag_name)
Check to see if a particular Tag exists.
Definition: SubProblem.C:129
virtual void clearActiveFEVariableCoupleableVectorTags(THREAD_ID tid)
Definition: SubProblem.C:176
NonlinearSystemBase * nl
virtual const std::set< unsigned int > & getActiveMaterialProperties(THREAD_ID tid) const
Get the material properties required by the current computing thread.
Definition: SubProblem.C:273
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:105
virtual void checkBoundaryMatProps()
Checks boundary material properties integrity.
Definition: SubProblem.C:496
void prepareLowerD()
Prepare the Jacobians and residuals for a lower dimensional element.
Definition: Assembly.C:2459
virtual bool isMatPropRequested(const std::string &prop_name) const
Find out if a material property has been requested by any object.
Definition: SubProblem.C:552
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2567
virtual void setActiveFEVariableCoupleableVectorTags(std::set< TagID > &vtags, THREAD_ID tid)
Definition: SubProblem.C:170
void prepareResidual()
Sizes and zeroes the residual for the current element.
Definition: Assembly.C:2322
std::map< TagID, TagName > _matrix_tag_id_to_tag_name
Reverse map.
Definition: SubProblem.h:646
virtual void clearActiveElementalMooseVariables(THREAD_ID tid)
Clear the active elemental MooseVariableFEBase.
Definition: SubProblem.C:259
virtual DiracKernelInfo & diracKernelInfo()
Definition: SubProblem.C:558
virtual const SystemBase & systemBaseAuxiliary() const =0
Return the auxiliary system object as a base class reference.
boundary_id_type BoundaryID
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:481
virtual void storeBoundaryMatPropName(BoundaryID boundary_id, const std::string &name)
Adds the given material property to a storage map based on boundary ids.
Definition: SubProblem.C:412
SubProblem(const InputParameters &parameters)
Definition: SubProblem.C:39
virtual void prepareNeighbor(THREAD_ID tid)
Prepare the system for use.
Definition: SystemBase.C:298
virtual TagID addMatrixTag(TagName tag_name)
Create a Tag.
Definition: SubProblem.C:112
std::string restrictionSubdomainCheckName(SubdomainID check_id)
Helper functions for checking MaterialProperties.
Definition: SubProblem.C:588
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
virtual void checkBlockMatProps()
Checks block material properties integrity.
Definition: SubProblem.C:446
std::vector< std::set< unsigned int > > _active_material_property_ids
Set of material property ids that determine whether materials get reinited.
Definition: SubProblem.h:689
virtual const SystemBase & systemBaseNonlinear() const =0
Return the nonlinear system object as a base class reference.
virtual void clearActiveFEVariableCoupleableMatrixTags(THREAD_ID tid)
Definition: SubProblem.C:182
virtual std::vector< SubdomainName > getMaterialPropertyBlockNames(const std::string &prop_name)
Get a vector of block id equivalences that the material property is defined on.
Definition: SubProblem.C:307
virtual bool vectorTagExists(TagID tag)
Check to see if a particular Tag exists.
Definition: SubProblem.h:112
subdomain_id_type SubdomainID
virtual void setActiveScalarVariableCoupleableMatrixTags(std::set< TagID > &mtags, THREAD_ID tid)
Definition: SubProblem.C:200
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFEBase *> &moose_vars, THREAD_ID tid)
Set the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:236
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:668
void reinitMortarElem(const Elem *elem)
reinitialize a mortar segment mesh element in order to get a proper JxW
Definition: Assembly.C:1967
std::vector< std::set< TagID > > _active_fe_var_coupleable_vector_tags
Definition: SubProblem.h:693
std::vector< libMesh::boundary_id_type > getBoundaryIDs(const libMesh::MeshBase &mesh, const std::vector< BoundaryName > &boundary_name, bool generate_unknown)
void reinitLowerDElemRef(const Elem *elem, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr)
Reinitialize FE data for a lower dimenesional element with a given set of reference points...
Definition: Assembly.C:1935
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:15
virtual std::set< SubdomainID > getMaterialPropertyBlocks(const std::string &prop_name)
Get a vector containing the block ids the material property is defined on.
Definition: SubProblem.C:291
virtual bool isVector() const =0
std::map< SubdomainID, std::set< MaterialPropertyName > > _zero_block_material_props
Set of properties returned as zero properties.
Definition: SubProblem.h:665
virtual std::vector< BoundaryName > getMaterialPropertyBoundaryNames(const std::string &prop_name)
Get a vector of block id equivalences that the material property is defined on.
Definition: SubProblem.C:364
void reinitNeighborFaceRef(const Elem *neighbor_elem, unsigned int neighbor_side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr)
Reinitialize FE data for the given neighbor_element on the given side with a given set of reference p...
Definition: Assembly.C:1866
std::vector< unsigned int > _has_active_elemental_moose_variables
Whether or not there is currently a list of active elemental moose variables.
Definition: SubProblem.h:686
const std::set< TagID > & getActiveScalarVariableCoupleableVectorTags(THREAD_ID tid) const
Definition: SubProblem.C:230
virtual TagID getMatrixTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:143
std::vector< std::set< MooseVariableFEBase * > > _active_elemental_moose_variables
This is the set of MooseVariableFEBases that will actually get reinited by a call to reinit(elem) ...
Definition: SubProblem.h:682
std::map< TagID, TagName > _vector_tag_id_to_tag_name
Reverse map.
Definition: SubProblem.h:640
std::set< std::string > _material_property_requested
set containing all material property names that have been requested by getMaterialProperty* ...
Definition: SubProblem.h:669
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
virtual void prepare(THREAD_ID tid)
Prepare the system for use.
Definition: SystemBase.C:242
InputParameters validParams< Problem >()
Definition: Problem.C:16
void reinitElemFaceRef(const Elem *elem, unsigned int elem_side, Real tolerance, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)
Reinitialize FE data for the given element on the given side, optionally with a given set of referenc...
Definition: Assembly.C:1699
void reinitElemFaceRef(const Elem *elem, unsigned int side, BoundaryID bnd_id, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, THREAD_ID tid=0)
reinitialize FE objects on a given element on a given side at a given set of reference points and the...
Definition: SubProblem.C:674
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
virtual void prepareLowerD(THREAD_ID tid)
Prepare the system for use for lower dimensional elements.
Definition: SystemBase.C:306
std::map< SubdomainID, std::multimap< std::string, std::string > > _map_block_material_props_check
Data structures of the requested material properties.
Definition: SubProblem.h:677
virtual void clearActiveScalarVariableCoupleableMatrixTags(THREAD_ID tid)
Definition: SubProblem.C:218
virtual void clearActiveMaterialProperties(THREAD_ID tid)
Clear the active material properties.
Definition: SubProblem.C:285
DiracKernelInfo _dirac_kernel_info
Definition: SubProblem.h:656
std::map< SubdomainID, std::set< std::string > > _map_block_material_props
Map of material properties (block_id -> list of properties)
Definition: SubProblem.h:659
const std::set< TagID > & getActiveFEVariableCoupleableMatrixTags(THREAD_ID tid) const
Definition: SubProblem.C:188
InputParameters validParams< SubProblem >()
Definition: SubProblem.C:23
std::vector< std::set< TagID > > _active_fe_var_coupleable_matrix_tags
Definition: SubProblem.h:691
std::vector< std::set< TagID > > _active_sc_var_coupleable_matrix_tags
Definition: SubProblem.h:695
virtual void storeSubdomainMatPropName(SubdomainID block_id, const std::string &name)
Adds the given material property to a storage map based on block ids.
Definition: SubProblem.C:406
virtual void meshChanged()
Definition: SubProblem.C:582
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:158
const std::set< TagID > & getActiveFEVariableCoupleableVectorTags(THREAD_ID tid) const
Definition: SubProblem.C:194
const BoundaryID ANY_BOUNDARY_ID
Definition: MooseTypes.C:17
unsigned int THREAD_ID
Definition: MooseTypes.h:161
virtual void setActiveMaterialProperties(const std::set< unsigned int > &mat_prop_ids, THREAD_ID tid)
Record and set the material properties required by the current computing thread.
Definition: SubProblem.C:266
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...