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
444 MooseLinearVariableFV<OutputType>::setDofValues(const DenseVector<DofValue> & values)
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  _element_data->setGeometry(Moose::Volume);
601  _element_data->computeValues();
602 }
603 
604 template <typename OutputType>
605 void
607 {
608  _element_data->setGeometry(Moose::Face);
609  _element_data->computeValues();
610 }
611 
612 template <typename OutputType>
613 void
615 {
616  _neighbor_data->setGeometry(Moose::Face);
617  _neighbor_data->computeValues();
618 }
619 
620 template <typename OutputType>
621 void
623 {
624  _neighbor_data->setGeometry(Moose::Volume);
625  _neighbor_data->computeValues();
626 }
627 
628 template <typename OutputType>
629 void
631 {
632  lowerDError();
633 }
634 
635 template <typename OutputType>
636 void
638 {
639  nodalError();
640 }
641 
642 template <typename OutputType>
643 void
645 {
646  nodalError();
647 }
648 
649 template <typename OutputType>
650 const std::vector<dof_id_type> &
652 {
653  return _element_data->dofIndices();
654 }
655 
656 template <typename OutputType>
657 const std::vector<dof_id_type> &
659 {
660  return _neighbor_data->dofIndices();
661 }
662 
663 template <typename OutputType>
664 void
666 {
667  lowerDError();
668 }
669 
670 template <typename OutputType>
671 unsigned int
673 {
674  unsigned int state = 0;
675  state = std::max(state, _element_data->oldestSolutionStateRequested());
676  state = std::max(state, _neighbor_data->oldestSolutionStateRequested());
677  return state;
678 }
679 
680 template <typename OutputType>
681 void
683 {
684  _element_data->clearDofIndices();
685  _neighbor_data->clearDofIndices();
686 }
687 
688 template <typename OutputType>
689 void
690 MooseLinearVariableFV<OutputType>::setNodalValue(const OutputType & /*value*/, unsigned int /*idx*/)
691 {
692  nodalError();
693 }
694 
695 template <typename OutputType>
698 {
699  nodalError();
700 }
701 
702 template <typename OutputType>
705 {
706  nodalError();
707 }
708 
709 template <typename OutputType>
710 const std::vector<dof_id_type> &
712 {
713  lowerDError();
714 }
715 
716 template <typename OutputType>
719 {
720  lowerDError();
721 }
722 
723 template <typename OutputType>
724 void
726 {
727  _element_data->insert(vector);
728 }
729 
730 template <typename OutputType>
731 void
733 {
734  mooseError("We don't support value insertion to residuals in MooseLinearVariableFV!");
735 }
736 
737 template <typename OutputType>
738 void
740 {
741  mooseError("We don't support value addition to residuals in MooseLinearVariableFV!");
742 }
743 
744 template <typename OutputType>
745 void
747 {
748  _element_data->setActiveTags(vtags);
749  _neighbor_data->setActiveTags(vtags);
750 }
751 
752 template <typename OutputType>
755 {
756  nodalError();
757 }
758 
759 template <typename OutputType>
762 {
763  nodalError();
764 }
765 
766 template <typename OutputType>
769 {
770  nodalError();
771 }
772 
773 template <typename OutputType>
774 std::size_t
776 {
777  lowerDError();
778 }
779 
780 template <typename OutputType>
783 {
784  return _element_data->vectorTagValue(tag);
785 }
786 
787 template <typename OutputType>
790 {
791  return _element_data->vectorTagDofValue(tag);
792 }
793 
794 template <typename OutputType>
797 {
798  return _element_data->matrixTagValue(tag);
799 }
800 
801 template <typename OutputType>
804 {
805  mooseError("We don't currently implement second derivatives for FV");
806 }
807 
808 template <typename OutputType>
811 {
812  mooseError("We don't currently implement curl for FV");
813 }
814 
815 template <typename OutputType>
818 {
819  mooseError("We don't currently implement divergence for FV");
820 }
821 
822 template <typename OutputType>
825 {
826  mooseError("We don't currently implement second derivatives for FV");
827 }
828 
829 template <typename OutputType>
832 {
833  mooseError("We don't currently implement second derivatives for FV");
834 }
835 
836 template <typename OutputType>
839 {
840  mooseError("We don't currently implement second derivatives for FV");
841 }
842 
843 template <typename OutputType>
846 {
847  return _element_data->sln(Moose::Current);
848 }
849 
850 template <typename OutputType>
853 {
854  return _element_data->sln(Moose::Old);
855 }
856 
857 template <typename OutputType>
860 {
861  return _element_data->sln(Moose::Older);
862 }
863 
864 template <typename OutputType>
867 {
868  return _element_data->gradSln(Moose::Current);
869 }
870 
871 template <typename OutputType>
874 {
875  return _element_data->gradSln(Moose::Old);
876 }
877 
878 template <typename OutputType>
881 {
882  return _neighbor_data->sln(Moose::Current);
883 }
884 
885 template <typename OutputType>
888 {
889  return _neighbor_data->sln(Moose::Old);
890 }
891 
892 template <typename OutputType>
895 {
896  return _neighbor_data->gradSln(Moose::Current);
897 }
898 
899 template <typename OutputType>
902 {
903  return _neighbor_data->gradSln(Moose::Old);
904 }
905 
906 template <typename OutputType>
909 {
910  adError();
911 }
912 
913 template <typename OutputType>
916 {
917  adError();
918 }
919 
920 template <typename OutputType>
923 {
924  adError();
925 }
926 
927 template <typename OutputType>
930 {
931  adError();
932 }
933 
934 template <typename OutputType>
937 {
938  adError();
939 }
940 
941 template <typename OutputType>
944 {
945  adError();
946 }
947 
948 template <typename OutputType>
951 {
952  adError();
953 }
954 
955 template <typename OutputType>
958 {
959  adError();
960 }
961 
962 template <typename OutputType>
965 {
966  adError();
967 }
968 
969 template <typename OutputType>
972 {
973  adError();
974 }
975 
976 template <typename OutputType>
979 {
980  adError();
981 }
982 
983 template <typename OutputType>
986 {
987  adError();
988 }
989 
990 template <typename OutputType>
993 {
994  adError();
995 }
996 
997 template <typename OutputType>
1000 {
1001  adError();
1002 }
1003 
1004 template <typename OutputType>
1007 {
1008  adError();
1009 }
1010 
1011 template <typename OutputType>
1014 {
1015  adError();
1016 }
1017 
1018 template <typename OutputType>
1021 {
1022  adError();
1023 }
1024 
1025 template <typename OutputType>
1026 const dof_id_type &
1028 {
1029  nodalError();
1030 }
1031 
1032 template <typename OutputType>
1033 const dof_id_type &
1035 {
1036  nodalError();
1037 }
1038 
1039 template <typename OutputType>
1040 void
1042 {
1043  _element_data->sizeMatrixTagData();
1044 }
1045 
1046 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:467
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
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:281
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:39
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.
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.