https://mooseframework.inl.gov
MooseLinearVariableFV.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 
10 #include "MooseLinearVariableFV.h"
11 #include "TimeIntegrator.h"
12 #include "NonlinearSystemBase.h"
13 #include "DisplacedSystem.h"
14 #include "SystemBase.h"
15 #include "LinearSystem.h"
16 #include "AuxiliarySystem.h"
17 #include "SubProblem.h"
18 #include "Assembly.h"
19 #include "MathFVUtils.h"
20 #include "FVUtils.h"
21 #include "FVFluxBC.h"
22 #include "FVDirichletBCBase.h"
23 #include "GreenGaussGradient.h"
26 #include "GradientLimiterType.h"
27 
28 #include "libmesh/numeric_vector.h"
29 
30 #include <climits>
31 #include <typeinfo>
32 
33 using namespace Moose;
34 
36 
37 namespace
38 {
39 const std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> &
40 linearFVGradientContainer(SystemBase & sys)
41 {
42  if (auto * const linear_system = dynamic_cast<LinearSystem *>(&sys))
43  return linear_system->linearFVGradientContainer();
44 
45  if (auto * const auxiliary_system = dynamic_cast<AuxiliarySystem *>(&sys))
46  return auxiliary_system->linearFVGradientContainer();
47 
48  mooseError("The assigned system is not a linear or an auxiliary system. Linear variables can "
49  "only be assigned to linear or auxiliary systems.");
50 }
51 }
52 
53 template <typename OutputType>
56 {
58  params.set<bool>("fv") = true;
59  params.set<MooseEnum>("family") = "MONOMIAL";
60  params.set<MooseEnum>("order") = "CONSTANT";
61  return params;
62 }
63 
64 template <typename OutputType>
66  : MooseVariableField<OutputType>(parameters),
67  _needs_cell_gradients(false),
68  _linear_system(dynamic_cast<LinearSystem *>(&this->_sys)),
69  _auxiliary_system(dynamic_cast<AuxiliarySystem *>(&this->_sys)),
70  _grad_container(linearFVGradientContainer(this->_sys)),
71  _sys_num(this->_sys.number()),
72  _solution(this->_sys.currentSolution()),
73  // The following members are needed to be able to interface with the postprocessor and
74  // auxiliary systems
75  _phi(this->_assembly.template fePhi<OutputShape>(FEType(CONSTANT, MONOMIAL))),
76  _grad_phi(this->_assembly.template feGradPhi<OutputShape>(FEType(CONSTANT, MONOMIAL))),
77  _phi_face(this->_assembly.template fePhiFace<OutputShape>(FEType(CONSTANT, MONOMIAL))),
78  _grad_phi_face(this->_assembly.template feGradPhiFace<OutputShape>(FEType(CONSTANT, MONOMIAL))),
79  _phi_face_neighbor(
80  this->_assembly.template fePhiFaceNeighbor<OutputShape>(FEType(CONSTANT, MONOMIAL))),
81  _grad_phi_face_neighbor(
82  this->_assembly.template feGradPhiFaceNeighbor<OutputShape>(FEType(CONSTANT, MONOMIAL))),
83  _phi_neighbor(this->_assembly.template fePhiNeighbor<OutputShape>(FEType(CONSTANT, MONOMIAL))),
84  _grad_phi_neighbor(
85  this->_assembly.template feGradPhiNeighbor<OutputShape>(FEType(CONSTANT, MONOMIAL)))
86 {
88  this->paramError("solver_sys",
89  "The assigned system is not a linear or an auxiliary system! Linear variables "
90  "can only be assigned to linear or auxiliary systems!");
91  _element_data = std::make_unique<MooseVariableDataLinearFV<OutputType>>(
93  _neighbor_data = std::make_unique<MooseVariableDataLinearFV<OutputType>>(
95 
96  if (libMesh::n_threads() > 1)
97  mooseError("MooseLinearVariableFV does not support threading at the moment!");
98 }
99 
100 template <typename OutputType>
101 void
103  const Moose::FV::GradientLimiterType limiter_type)
104 {
105  if (limiter_type == Moose::FV::GradientLimiterType::None)
107  else
108  computeCellLimitedGradients(limiter_type);
109 }
110 
111 template <typename OutputType>
112 void
114  const Moose::FV::GradientLimiterType limiter_type)
115 {
116  computeCellGradients();
117 
118  if (_linear_system)
119  _linear_system->requestLinearFVLimitedGradients(limiter_type, this->_var_num);
120  else
121  _auxiliary_system->requestLinearFVLimitedGradients(limiter_type, this->_var_num);
122 }
123 
124 template <typename OutputType>
125 bool
127  const FaceInfo & /*fi*/, const Elem * const /*elem*/, const Moose::StateArg & /*state*/) const
128 {
130  return false;
131 }
132 
133 template <typename OutputType>
134 Real
136  const StateArg & state) const
137 {
138  mooseAssert(
139  this->hasBlocks(elem_info.subdomain_id()),
140  "The variable should be defined on the element's subdomain! This typically occurs when the "
141  "user wants to evaluate the elements right next to the boundary of two variables (block "
142  "boundary). The subdomain which is queried: " +
143  Moose::stringify(this->activeSubdomains()) + " the subdomain of the element " +
144  std::to_string(elem_info.subdomain_id()));
145 
146  // It's not safe to use solutionState(0) because it returns the libMesh System solution member
147  // which is wrong during things like finite difference Jacobian evaluation, e.g. when PETSc
148  // perturbs the solution vector we feed these perturbations into the current_local_solution
149  // while the libMesh solution is frozen in the non-perturbed state
150  const auto & global_soln = (state.state == 0)
151  ? *this->_sys.currentSolution()
152  : this->_sys.solutionState(state.state, state.iteration_type);
153 
154  return global_soln(elem_info.dofIndices()[this->_sys_num][this->_var_num]);
155 }
156 
157 template <typename OutputType>
159 MooseLinearVariableFV<OutputType>::gradSln(const ElemInfo & elem_info, const StateArg & state) const
160 {
161  if (state.state != 0)
162  gradientStateError(state);
163 
164  if (_needs_cell_gradients)
165  {
166  _cell_gradient.zero();
167  for (const auto i : make_range(this->_mesh.dimension()))
168  _cell_gradient(i) =
169  (*_grad_container[i])(elem_info.dofIndices()[this->_sys_num][this->_var_num]);
170  }
171 
172  return _cell_gradient;
173 }
174 
175 template <typename OutputType>
176 Real
178  const unsigned int component) const
179 {
180  mooseAssert(_needs_cell_gradients,
181  "Gradient component requested without calling computeCellGradients().");
182  mooseAssert(component < _grad_container.size(), "Gradient component index out of range.");
183 
184  return (*_grad_container[component])(elem_info.dofIndices()[this->_sys_num][this->_var_num]);
185 }
186 
187 template <typename OutputType>
190  const StateArg & state,
191  const Moose::FV::GradientLimiterType limiter_type) const
192 {
193  return (limiter_type == Moose::FV::GradientLimiterType::None)
194  ? gradSln(elem_info, state)
195  : limitedGradSln(elem_info, state, limiter_type);
196 }
197 
198 template <typename OutputType>
201  const ElemInfo & elem_info,
202  const StateArg & state,
203  const Moose::FV::GradientLimiterType limiter_type) const
204 {
205  if (state.state != 0)
206  gradientStateError(state);
207 
208  _cell_gradient.zero();
209  const auto & limited_grad_container =
210  _linear_system ? _linear_system->linearFVLimitedGradientContainer(limiter_type)
211  : _auxiliary_system->linearFVLimitedGradientContainer(limiter_type);
212  for (const auto i : make_range(this->_mesh.dimension()))
213  _cell_gradient(i) =
214  (*limited_grad_container[i])(elem_info.dofIndices()[this->_sys_num][this->_var_num]);
215 
216  return _cell_gradient;
217 }
218 
219 template <typename OutputType>
222 {
223  const auto face_type = fi.faceType(std::make_pair(this->_var_num, this->_sys_num));
224  mooseAssert(face_type != FaceInfo::VarFaceNeighbors::NEITHER,
225  "Gradient requested on a face where the variable is defined on neither side.");
226 
227  const bool var_defined_on_elem = (face_type == FaceInfo::VarFaceNeighbors::BOTH) ||
228  (face_type == FaceInfo::VarFaceNeighbors::ELEM);
229  const auto * const elem_one = var_defined_on_elem ? fi.elemInfo() : fi.neighborInfo();
230  const auto * const elem_two = var_defined_on_elem ? fi.neighborInfo() : fi.elemInfo();
231 
232  const auto elem_one_grad = gradSln(*elem_one, state);
233 
234  // If we have a neighbor then we interpolate between the two to the face.
235  if (face_type == FaceInfo::VarFaceNeighbors::BOTH)
236  {
237  mooseAssert(elem_two, "Face type indicates BOTH but neighbor information is missing.");
238  const auto elem_two_grad = gradSln(*elem_two, state);
239  return Moose::FV::linearInterpolation(elem_one_grad, elem_two_grad, fi, var_defined_on_elem);
240  }
241  else
242  return elem_one_grad;
243 }
244 
245 template <typename OutputType>
248  const StateArg & state,
249  const Moose::FV::GradientLimiterType limiter_type) const
250 {
251  return (limiter_type == Moose::FV::GradientLimiterType::None)
252  ? gradSln(fi, state)
253  : limitedGradSln(fi, state, limiter_type);
254 }
255 
256 template <typename OutputType>
259  const FaceInfo & fi,
260  const StateArg & state,
261  const Moose::FV::GradientLimiterType limiter_type) const
262 {
263  const auto face_type = fi.faceType(std::make_pair(this->_var_num, this->_sys_num));
264  mooseAssert(face_type != FaceInfo::VarFaceNeighbors::NEITHER,
265  "Limited gradient requested on a face where the variable is defined on neither "
266  "side.");
267 
268  const bool var_defined_on_elem = (face_type == FaceInfo::VarFaceNeighbors::BOTH) ||
269  (face_type == FaceInfo::VarFaceNeighbors::ELEM);
270  const auto * const elem_one = var_defined_on_elem ? fi.elemInfo() : fi.neighborInfo();
271  const auto * const elem_two = var_defined_on_elem ? fi.neighborInfo() : fi.elemInfo();
272 
273  const auto elem_one_grad = limitedGradSln(*elem_one, state, limiter_type);
274 
275  if (face_type == FaceInfo::VarFaceNeighbors::BOTH)
276  {
277  mooseAssert(elem_two, "Face type indicates BOTH but neighbor information is missing.");
278  const auto elem_two_grad = limitedGradSln(*elem_two, state, limiter_type);
279  return Moose::FV::linearInterpolation(elem_one_grad, elem_two_grad, fi, var_defined_on_elem);
280  }
281  else
282  return elem_one_grad;
283 }
284 
285 template <typename OutputType>
286 void
288 {
290  cacheBoundaryBCMap();
291 }
292 
293 template <typename OutputType>
294 void
296 {
298  cacheBoundaryBCMap();
299 }
300 
301 template <typename OutputType>
304 {
305  const FaceInfo * const fi = face.fi;
306 
307  mooseAssert(fi, "The face information must be non-null");
308 
309  const auto face_type = fi->faceType(std::make_pair(this->_var_num, this->_sys_num));
310 
311  if (face_type == FaceInfo::VarFaceNeighbors::BOTH)
312  return Moose::FV::interpolate(*this, face, state);
313  else if (auto * bc_pointer = this->getBoundaryCondition(*fi->boundaryIDs().begin()))
314  {
315  mooseAssert(fi->boundaryIDs().size() == 1, "We should only have one boundary on every face.");
316  bc_pointer->setupFaceData(fi, face_type);
317  return bc_pointer->computeBoundaryValue();
318  }
319  // If no boundary condition is defined but we are evaluating on a boundary, just return the
320  // element value
321  else if (face_type == FaceInfo::VarFaceNeighbors::ELEM)
322  {
323  const auto & elem_info = this->_mesh.elemInfo(fi->elemPtr()->id());
324  return getElemValue(elem_info, state);
325  }
326  else if (face_type == FaceInfo::VarFaceNeighbors::NEIGHBOR)
327  {
328  const auto & elem_info = this->_mesh.elemInfo(fi->neighborPtr()->id());
329  return getElemValue(elem_info, state);
330  }
331  else
332  mooseError("We should never get here!");
333 }
334 
335 template <typename OutputType>
338  const StateArg & /*state*/) const
339 {
340  mooseError("Not implemented yet");
341 }
342 
343 template <typename OutputType>
346 {
347  timeIntegratorError();
348 }
349 
350 template <>
351 ADReal
353  const StateArg & /*state*/) const
354 {
356 }
357 
358 template <typename OutputType>
359 void
361 {
362  _boundary_id_to_bc.clear();
363  std::vector<LinearFVBoundaryCondition *> bcs;
364 
365  // I believe because query() returns by value but condition returns by reference that binding to a
366  // const lvalue reference results in the query() getting destructed and us holding onto a dangling
367  // reference. I think that condition returned by value we would be able to bind to a const lvalue
368  // reference here. But as it is we'll bind to a regular lvalue
369  auto base_query = this->_subproblem.getMooseApp()
370  .theWarehouse()
371  .query()
372  .template condition<AttribSystem>("LinearFVBoundaryCondition")
373  .template condition<AttribThread>(_tid)
374  .template condition<AttribVar>(_var_num)
375  .template condition<AttribSysNum>(this->_sys.number());
376 
377  for (const auto bnd_id : this->_mesh.getBoundaryIDs())
378  {
379  auto base_query_copy = base_query;
380  base_query_copy.template condition<AttribBoundaries>(std::set<BoundaryID>({bnd_id}))
381  .queryInto(bcs);
382  mooseAssert(bcs.size() <= 1, "cannot have multiple BCs on the same boundary");
383  if (!bcs.empty())
384  _boundary_id_to_bc.emplace(bnd_id, bcs[0]);
385  }
386 }
387 
388 template <typename OutputType>
391 {
392  const auto iter = _boundary_id_to_bc.find(bd_id);
393  if (iter == _boundary_id_to_bc.end())
394  return nullptr;
395  else
396  return iter->second;
397 }
398 
399 template <typename OutputType>
400 const Elem * const &
402 {
403  return this->_assembly.elem();
404 }
405 
406 template <typename OutputType>
407 bool
409 {
410  for (const auto bnd_id : fi.boundaryIDs())
411  if (auto it = _boundary_id_to_bc.find(bnd_id); it != _boundary_id_to_bc.end())
412  if (dynamic_cast<LinearFVAdvectionDiffusionFunctorDirichletBC *>(it->second))
413  return true;
414 
415  return false;
416 }
417 
418 // ****************************************************************************
419 // The functions below are used for interfacing the auxiliary and
420 // postprocessor/userobject systems. Most of the postprocessors/
421 // auxkernels require quadrature-based evaluations and we provide that
422 // interface with the functions below.
423 // ****************************************************************************
424 
425 template <typename OutputType>
426 void
428  std::vector<dof_id_type> & dof_indices) const
429 {
430  dof_indices.clear();
431  const auto & elem_info = this->_mesh.elemInfo(elem->id());
432  dof_indices.push_back(elem_info.dofIndices()[this->_sys_num][this->number()]);
433 }
434 
435 template <typename OutputType>
436 void
438 {
439  _element_data->setDofValue(value, index);
440 }
441 
442 template <typename OutputType>
443 void
445 {
446  _element_data->setDofValues(values);
447 }
448 
449 template <typename OutputType>
450 void
452 {
453  _element_data->clearDofIndices();
454 }
455 
456 template <typename OutputType>
459 {
460  return _element_data->dofValues();
461 }
462 
463 template <typename OutputType>
466 {
467  return _neighbor_data->dofValues();
468 }
469 
470 template <typename OutputType>
473 {
474  return _element_data->dofValuesOld();
475 }
476 
477 template <typename OutputType>
480 {
481  return _element_data->dofValuesOlder();
482 }
483 
484 template <typename OutputType>
487 {
488  return _element_data->dofValuesPreviousNL();
489 }
490 
491 template <typename OutputType>
494 {
495  return _neighbor_data->dofValuesOld();
496 }
497 
498 template <typename OutputType>
501 {
502  return _neighbor_data->dofValuesOlder();
503 }
504 
505 template <typename OutputType>
508 {
509  return _neighbor_data->dofValuesPreviousNL();
510 }
511 
512 template <typename OutputType>
515 {
516  timeIntegratorError();
517 }
518 
519 template <typename OutputType>
522 {
523  timeIntegratorError();
524 }
525 
526 template <typename OutputType>
529 {
530  timeIntegratorError();
531 }
532 
533 template <typename OutputType>
536 {
537  timeIntegratorError();
538 }
539 
540 template <typename OutputType>
543 {
544  timeIntegratorError();
545 }
546 
547 template <typename OutputType>
550 {
551  timeIntegratorError();
552 }
553 
554 template <typename OutputType>
557 {
558  timeIntegratorError();
559 }
560 
561 template <typename OutputType>
564 {
565  timeIntegratorError();
566 }
567 
568 template <typename OutputType>
569 const MooseArray<Number> &
571 {
572  timeIntegratorError();
573 }
574 
575 template <typename OutputType>
576 const MooseArray<Number> &
578 {
579  timeIntegratorError();
580 }
581 
582 template <typename OutputType>
583 const MooseArray<Number> &
585 {
586  timeIntegratorError();
587 }
588 
589 template <typename OutputType>
590 const MooseArray<Number> &
592 {
593  timeIntegratorError();
594 }
595 
596 template <typename OutputType>
597 void
599 {
600  if (_compute_qp_data)
601  {
602  _element_data->setGeometry(Moose::Volume);
603  _element_data->computeValues();
604  }
605 }
606 
607 template <typename OutputType>
608 void
610 {
611  if (_compute_qp_data)
612  {
613  _element_data->setGeometry(Moose::Face);
614  _element_data->computeValues();
615  }
616 }
617 
618 template <typename OutputType>
619 void
621 {
622  if (_compute_qp_data)
623  {
624  _neighbor_data->setGeometry(Moose::Face);
625  _neighbor_data->computeValues();
626  }
627 }
628 
629 template <typename OutputType>
630 void
632 {
633  if (_compute_qp_data)
634  {
635  _neighbor_data->setGeometry(Moose::Volume);
636  _neighbor_data->computeValues();
637  }
638 }
639 
640 template <typename OutputType>
641 void
643 {
644  lowerDError();
645 }
646 
647 template <typename OutputType>
648 void
650 {
651  nodalError();
652 }
653 
654 template <typename OutputType>
655 void
657 {
658  nodalError();
659 }
660 
661 template <typename OutputType>
662 const std::vector<dof_id_type> &
664 {
665  return _element_data->dofIndices();
666 }
667 
668 template <typename OutputType>
669 const std::vector<dof_id_type> &
671 {
672  return _neighbor_data->dofIndices();
673 }
674 
675 template <typename OutputType>
676 void
678 {
679  lowerDError();
680 }
681 
682 template <typename OutputType>
683 unsigned int
685 {
686  unsigned int state = 0;
687  state = std::max(state, _element_data->oldestSolutionStateRequested());
688  state = std::max(state, _neighbor_data->oldestSolutionStateRequested());
689  return state;
690 }
691 
692 template <typename OutputType>
693 void
695 {
696  _element_data->prepareIC();
697 }
698 
699 template <typename OutputType>
700 void
702 {
703  _element_data->clearDofIndices();
704  _neighbor_data->clearDofIndices();
705 }
706 
707 template <typename OutputType>
708 void
709 MooseLinearVariableFV<OutputType>::setNodalValue(const OutputType & /*value*/, unsigned int /*idx*/)
710 {
711  nodalError();
712 }
713 
714 template <typename OutputType>
717 {
718  nodalError();
719 }
720 
721 template <typename OutputType>
724 {
725  nodalError();
726 }
727 
728 template <typename OutputType>
729 const std::vector<dof_id_type> &
731 {
732  lowerDError();
733 }
734 
735 template <typename OutputType>
738 {
739  lowerDError();
740 }
741 
742 template <typename OutputType>
743 void
745 {
746  _element_data->insert(vector);
747 }
748 
749 template <typename OutputType>
750 void
752 {
753  mooseError("We don't support value insertion to residuals in MooseLinearVariableFV!");
754 }
755 
756 template <typename OutputType>
757 void
759 {
760  mooseError("We don't support value addition to residuals in MooseLinearVariableFV!");
761 }
762 
763 template <typename OutputType>
764 void
766 {
767  _element_data->setActiveTags(vtags);
768  _neighbor_data->setActiveTags(vtags);
769 }
770 
771 template <typename OutputType>
774 {
775  nodalError();
776 }
777 
778 template <typename OutputType>
781 {
782  nodalError();
783 }
784 
785 template <typename OutputType>
788 {
789  nodalError();
790 }
791 
792 template <typename OutputType>
793 std::size_t
795 {
796  lowerDError();
797 }
798 
799 template <typename OutputType>
802 {
803  return _element_data->vectorTagValue(tag);
804 }
805 
806 template <typename OutputType>
809 {
810  return _element_data->vectorTagDofValue(tag);
811 }
812 
813 template <typename OutputType>
816 {
817  return _element_data->matrixTagValue(tag);
818 }
819 
820 template <typename OutputType>
823 {
824  mooseError("We don't currently implement second derivatives for FV");
825 }
826 
827 template <typename OutputType>
830 {
831  mooseError("We don't currently implement curl for FV");
832 }
833 
834 template <typename OutputType>
837 {
838  mooseError("We don't currently implement divergence for FV");
839 }
840 
841 template <typename OutputType>
844 {
845  mooseError("We don't currently implement second derivatives for FV");
846 }
847 
848 template <typename OutputType>
851 {
852  mooseError("We don't currently implement second derivatives for FV");
853 }
854 
855 template <typename OutputType>
858 {
859  mooseError("We don't currently implement second derivatives for FV");
860 }
861 
862 template <typename OutputType>
865 {
866  return _element_data->sln(Moose::Current);
867 }
868 
869 template <typename OutputType>
872 {
873  return _element_data->sln(Moose::Old);
874 }
875 
876 template <typename OutputType>
879 {
880  return _element_data->sln(Moose::Older);
881 }
882 
883 template <typename OutputType>
886 {
887  return _element_data->gradSln(Moose::Current);
888 }
889 
890 template <typename OutputType>
893 {
894  return _element_data->gradSln(Moose::Old);
895 }
896 
897 template <typename OutputType>
900 {
901  return _neighbor_data->sln(Moose::Current);
902 }
903 
904 template <typename OutputType>
907 {
908  return _neighbor_data->sln(Moose::Old);
909 }
910 
911 template <typename OutputType>
914 {
915  return _neighbor_data->gradSln(Moose::Current);
916 }
917 
918 template <typename OutputType>
921 {
922  return _neighbor_data->gradSln(Moose::Old);
923 }
924 
925 template <typename OutputType>
928 {
929  adError();
930 }
931 
932 template <typename OutputType>
935 {
936  adError();
937 }
938 
939 template <typename OutputType>
942 {
943  adError();
944 }
945 
946 template <typename OutputType>
949 {
950  adError();
951 }
952 
953 template <typename OutputType>
956 {
957  adError();
958 }
959 
960 template <typename OutputType>
963 {
964  adError();
965 }
966 
967 template <typename OutputType>
970 {
971  adError();
972 }
973 
974 template <typename OutputType>
977 {
978  adError();
979 }
980 
981 template <typename OutputType>
984 {
985  adError();
986 }
987 
988 template <typename OutputType>
991 {
992  adError();
993 }
994 
995 template <typename OutputType>
998 {
999  adError();
1000 }
1001 
1002 template <typename OutputType>
1005 {
1006  adError();
1007 }
1008 
1009 template <typename OutputType>
1012 {
1013  adError();
1014 }
1015 
1016 template <typename OutputType>
1019 {
1020  adError();
1021 }
1022 
1023 template <typename OutputType>
1026 {
1027  adError();
1028 }
1029 
1030 template <typename OutputType>
1033 {
1034  adError();
1035 }
1036 
1037 template <typename OutputType>
1040 {
1041  adError();
1042 }
1043 
1044 template <typename OutputType>
1045 const dof_id_type &
1047 {
1048  nodalError();
1049 }
1050 
1051 template <typename OutputType>
1052 const dof_id_type &
1054 {
1055  nodalError();
1056 }
1057 
1058 template <typename OutputType>
1059 void
1061 {
1062  _element_data->sizeMatrixTagData();
1063 }
1064 
1065 template class MooseLinearVariableFV<Real>;
virtual void clearAllDofIndices() override final
typename OutputTools< typename Moose::ADType< T >::type >::VariableSecond ADTemplateVariableSecond
Definition: MooseTypes.h:654
const Elem *const & elem() const
Return the current element.
Definition: Assembly.h:414
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDotDuNeighbor() const override
virtual void setActiveTags(const std::set< TagID > &vtags) override
Set the active vector tags.
GradientLimiterType
Cell-gradient limiter variants used for MUSCL-style reconstructions.
typename OutputTools< typename Moose::ADType< T >::type >::VariableCurl ADTemplateVariableCurl
Definition: MooseTypes.h:656
virtual bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const override
Returns whether this (sided) face is an extrapolated boundary face for this functor.
virtual void computeElemValuesFace() override
Compute values at facial quadrature points.
virtual const DofValues & dofValuesDotDot() const override
Base class for boundary conditions for linear FV systems.
virtual const MooseArray< OutputType > & nodalValueOlderArray() const override
virtual const ADTemplateVariableCurl< OutputType > & adCurlSln() const override
AD curl solution getter.
unsigned int n_threads()
const std::set< BoundaryID > & boundaryIDs() const
Const getter for every associated boundary ID.
Definition: FaceInfo.h:124
virtual DotType evaluateDot(const ElemArg &elem, const StateArg &) const override final
Evaluate the functor time derivative with a given element.
virtual const FieldVariableValue & sln() const override
virtual bool isDirichletBoundaryFace(const FaceInfo &fi) const
If the variable has a dirichlet boundary condition at face described by fi .
virtual const DofValues & dofValuesDotOld() const override
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseBase.h:457
unsigned int TagID
Definition: MooseTypes.h:238
Class for stuff related to variables.
virtual const MooseArray< OutputType > & nodalValueArray() const override
Methods for retrieving values of variables at the nodes in a MooseArray for AuxKernelBase.
LinearSystem *const _linear_system
Owning concrete system pointers. One will be null.
VectorValue< Real > limitedGradSln(const ElemInfo &elem_info, const StateArg &state, const Moose::FV::GradientLimiterType limiter_type) const
Get the limited gradient at a cell center.
virtual const Elem *const & currentElem() const override
Current element this variable is evaluated at.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual const DofValues & dofValuesDotDotNeighbor() const override
virtual const ADTemplateVariableGradient< OutputType > & adGradSlnDot() const override
AD grad of time derivative solution getter.
virtual const FieldVariablePhiSecond & secondPhiFace() const override final
Return the rank-2 tensor of second derivatives of the variable&#39;s shape functions on an element face...
typename MooseVariableField< OutputType >::FieldVariablePhiSecond FieldVariablePhiSecond
const FieldVariablePhiDivergence & divPhi() const override final
Divergence of the shape functions.
virtual const FieldVariablePhiSecond & secondPhiFaceNeighbor() const override final
Return the rank-2 tensor of second derivatives of the variable&#39;s shape functions on a neighboring ele...
virtual const DofValues & dofValues() const override
dof values getters
virtual const ADTemplateVariableValue< OutputType > & adSln() const override
AD solution getter.
virtual const FieldVariableGradient & gradSlnOldNeighbor() const override
Real gradSlnComponent(const ElemInfo &elem_info, unsigned int component) const
Get one raw gradient component at a cell center without materializing the full gradient.
const ElemInfo * neighborInfo() const
Definition: FaceInfo.h:90
virtual const DofValues & nodalVectorTagValue(TagID) const override
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
registerMooseObject("MooseApp", MooseLinearVariableFVReal)
typename OutputTools< typename Moose::ADType< T >::type >::VariableValue ADTemplateVariableValue
Definition: MooseTypes.h:648
virtual const DofValues & dofValuesPreviousNL() const override
virtual const DofValues & nodalMatrixTagValue(TagID tag) const override
virtual const DofValues & dofValuesPreviousNLNeighbor() const override
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void setLowerDofValues(const DenseVector< DofValue > &values) override
virtual void getDofIndices(const Elem *elem, std::vector< dof_id_type > &dof_indices) const override
virtual const DofValues & dofValuesDotDotOldNeighbor() const override
const ElemInfo * elemInfo() const
Definition: FaceInfo.h:89
virtual void setNodalValue(const OutputType &value, unsigned int idx=0) override
LinearFVBoundaryCondition * getBoundaryCondition(const BoundaryID bd_id) const
Get the boundary condition object which corresponds to the given boundary ID.
virtual const std::vector< dof_id_type > & dofIndicesNeighbor() const final
Get neighbor DOF indices for currently selected element.
virtual const FieldVariablePhiSecond & secondPhi() const override final
Return the rank-2 tensor of second derivatives of the variable&#39;s elemental shape functions.
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
Base class for a system (of equations)
Definition: SystemBase.h:85
libMesh::CompareTypes< T, T2 >::supertype linearInterpolation(const T &value1, const T2 &value2, const FaceInfo &fi, const bool one_is_elem, const InterpMethod interp_method=InterpMethod::Average)
A simple linear interpolation of values between cell centers to a cell face.
Definition: MathFVUtils.h:153
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:42
virtual const DofValues & dofValuesDotDotOld() const override
void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
virtual void clearDofIndices() override
Clear out the dof indices.
virtual const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
virtual void computeElemValues() override
Compute values at interior quadrature points.
THREAD_ID _tid
Thread ID.
auto max(const L &left, const R &right)
virtual const ADTemplateVariableCurl< OutputType > & adCurlSlnNeighbor() const override
AD curl neighbor solution getter.
static InputParameters validParams()
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDuNeighbor() const override
virtual const FieldVariablePhiSecond & secondPhiNeighbor() const override final
Return the rank-2 tensor of second derivatives of the variable&#39;s shape functions on a neighboring ele...
virtual const ADTemplateVariableValue< OutputType > & adUDotDot() const override
AD second time derivative getter.
virtual const ADTemplateVariableGradient< OutputType > & adGradSlnNeighbor() const override
AD grad neighbor solution getter.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:37
CONSTANT
virtual const ADDofValues & adDofValuesNeighbor() const override
Return the AD neighbor dof values.
virtual const DofValues & dofValuesDotNeighbor() const override
virtual const FieldVariableValue & slnOld() const override
typename MooseVariableField< OutputType >::FieldVariablePhiValue FieldVariablePhiValue
const Elem * neighborPtr() const
Definition: FaceInfo.h:88
void timeIntegratorError() const
Throw an error when somebody requests time-related data from this variable.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
A structure defining a "face" evaluation calling argument for Moose functors.
void computeCellLimitedGradients(const Moose::FV::GradientLimiterType limiter_type)
Switch to request limited cell gradient computations.
virtual const DofValues & vectorTagDofValue(TagID tag) const override
virtual void setDofValue(const DofValue &, unsigned int) override
virtual void insertLower(libMesh::NumericVector< libMesh::Number > &vector) override
Insert the currently cached degree of freedom values for a lower-dimensional element into the provide...
const FaceInfo * fi
a face information object which defines our location in space
virtual const FieldVariablePhiValue & phiLower() const override
Return the variable&#39;s shape functions on a lower-dimensional element.
SystemBase & _sys
System this variable is part of.
SolutionIterationType iteration_type
The solution iteration type, e.g. time or nonlinear.
boundary_id_type BoundaryID
typename MooseVariableField< OutputType >::DofValues DofValues
virtual const FieldVariableValue & matrixTagValue(TagID tag) const override
typename OutputTools< typename Moose::ADType< T >::type >::VariableGradient ADTemplateVariableGradient
Definition: MooseTypes.h:651
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
virtual const DofValues & dofValuesNeighbor() const override
std::unique_ptr< MooseVariableDataLinearFV< OutputType > > _element_data
Holder for all the data associated with the "main" element.
virtual const ADTemplateVariableGradient< OutputType > & adGradSlnNeighborDot() const override
AD grad of time derivative neighbor solution getter.
virtual const DofValues & dofValuesOlder() const override
A structure that is used to evaluate Moose functors logically at an element/cell center.
AuxiliarySystem *const _auxiliary_system
virtual void prepareIC() override
Prepare the initial condition.
typename MooseVariableField< OutputType >::FieldVariableGradient FieldVariableGradient
MooseLinearVariableFV(const InputParameters &parameters)
virtual const dof_id_type & nodalDofIndex() const override final
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDu() const override
virtual const ADTemplateVariableSecond< OutputType > & adSecondSln() const override
AD second solution getter.
const FieldVariablePhiValue & curlPhi() const override final
Curl of the shape functions.
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
virtual const std::vector< dof_id_type > & dofIndicesLower() const override final
Get dof indices for the current lower dimensional element (this is meaningful when performing mortar ...
virtual const FieldVariableValue & slnNeighbor() const override
virtual const ADDofValues & adDofValuesDot() const override
Return the AD time derivatives at dofs.
virtual const FieldVariableGradient & gradSlnNeighbor() const override
neighbor solution gradients
MONOMIAL
virtual const FieldVariableGradient & gradSlnOld() const override
const Elem * elemPtr() const
Definition: FaceInfo.h:86
virtual const MooseArray< OutputType > & nodalValueOldArray() const override
const std::vector< std::vector< dof_id_type > > & dofIndices() const
Definition: ElemInfo.h:39
virtual void timestepSetup() override
virtual const DofValues & dofValuesDotOldNeighbor() const override
virtual void computeNodalNeighborValues() override final
Compute nodal values of this variable in the neighbor.
virtual const DofValues & dofValuesOldNeighbor() const override
virtual void add(libMesh::NumericVector< libMesh::Number > &vector) override
Add the currently cached degree of freedom values into the provided vector.
typename MooseVariableField< OutputType >::ADDofValues ADDofValues
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computeNeighborValuesFace() override
Compute values at facial quadrature points for the neighbor.
virtual const FieldVariableValue & vectorTagValue(TagID tag) const override
tag values getters
Assembly & _assembly
Assembly data.
virtual void sizeMatrixTagData() override
Size data structures related to matrix tagging.
std::unique_ptr< MooseVariableDataLinearFV< OutputType > > _neighbor_data
Holder for all the data associated with the "neighbor" element.
virtual void computeNodalValues() override final
Compute nodal values of this variable.
static InputParameters validParams()
virtual const dof_id_type & nodalDofIndexNeighbor() const override final
typename MooseVariableField< OutputType >::FieldVariablePhiDivergence FieldVariablePhiDivergence
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
Get the solution value for the provided element and seed the derivative for the corresponding dof ind...
virtual void computeLowerDValues() override final
compute values at quadrature points on the lower dimensional element
void cacheBoundaryBCMap()
Setup the boundary to Dirichlet BC map.
const Elem *const & neighbor() const
Return the neighbor element.
Definition: Assembly.h:470
virtual std::size_t phiLowerSize() const override final
Return the number of shape functions on the lower dimensional element for this variable.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:271
typename MooseVariableField< OutputType >::FieldVariableValue FieldVariableValue
virtual void insert(libMesh::NumericVector< libMesh::Number > &vector) override
Insert the currently cached degree of freedom values into the provided vector.
virtual const ADTemplateVariableValue< OutputType > & adUDotNeighbor() const override
AD neighbor time derivative getter.
State argument for evaluating functors.
virtual const OutputTools< T >::VariableSecond & second()
The second derivative of the variable this object is operating on.
Linear system to be solved.
Definition: LinearSystem.h:48
virtual const ADTemplateVariableValue< OutputType > & adSlnNeighbor() const override
AD neighbor solution getter.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
virtual const ADTemplateVariableSecond< OutputType > & adSecondSlnNeighbor() const override
AD second neighbor solution getter.
virtual void computeNeighborValues() override
Compute values at quadrature points for the neighbor.
Class used for caching additional information for elements such as the volume and centroid...
Definition: ElemInfo.h:25
virtual const DofValues & dofValuesOlderNeighbor() const override
virtual void timestepSetup() override
void computeCellGradients()
Switch to request cell gradient computations.
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDotDu() const override
virtual const ADDofValues & adDofValues() const override
Return the AD dof values.
std::array< Real, 2 > values
Definition: MortarUtils.C:52
virtual unsigned int oldestSolutionStateRequested() const override final
The oldest solution state that is requested for this variable (0 = current, 1 = old, 2 = older, etc).
typename MooseVariableDataBase< Real >::DofValue DofValue
virtual void setDofValues(const DenseVector< DofValue > &values) override
virtual const DofValues & dofValuesOld() const override
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
Provides interpolation of face values for non-advection-specific purposes (although it can/will still...
Definition: MathFVUtils.h:285
virtual const FieldVariableValue & slnOlder() const override
virtual const ADTemplateVariableValue< OutputType > & adUDot() const override
AD time derivative getter.
void computeCellGradients(const Moose::FV::GradientLimiterType limiter_type)
Switch to request cell gradient computations with an optional gradient limiter.
virtual const FieldVariableGradient & gradSln() const override
element gradients
A system that holds auxiliary variables.
virtual const ADTemplateVariableGradient< OutputType > & adGradSln() const override
AD grad solution getter.
Moose::ShapeType< Real >::type OutputShape
virtual const DofValues & dofValuesDot() const override
SubdomainID subdomain_id() const
We return the subdomain ID of the corresponding libmesh element.
Definition: ElemInfo.h:43
unsigned int state
The state.
uint8_t dof_id_type
virtual const FieldVariableValue & slnOldNeighbor() const override
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const
Returns which side(s) the given variable-system number pair is defined on for this face...
Definition: FaceInfo.h:229
virtual ValueType evaluate(const ElemArg &elem, const StateArg &) const override final
Evaluate the functor with a given element.
virtual const ADTemplateVariableValue< OutputType > & adUDotDotNeighbor() const override
AD neighbor second time derivative getter.