https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MooseVariableFV.h
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#pragma once
11
12#include "MooseTypes.h"
13#include "MooseVariableField.h"
14#include "SubProblem.h"
15#include "MooseMesh.h"
16#include "MooseVariableDataFV.h"
17
18#include "libmesh/numeric_vector.h"
19#include "libmesh/dof_map.h"
20#include "libmesh/elem.h"
21#include "libmesh/quadrature.h"
22#include "libmesh/dense_vector.h"
23#include "libmesh/enum_fe_family.h"
24
25template <typename>
26class MooseVariableFV;
27
30class FVFluxBC;
31
32namespace libMesh
33{
34template <typename>
35class NumericVector;
36}
37
51template <typename OutputType>
52class MooseVariableFV : public MooseVariableField<OutputType>
53{
54public:
58
64
69
74
91
93
95
96 virtual bool isFV() const override { return true; }
97
98 // TODO: many of these functions are not relevant to FV variables but are
99 // still called at various points from existing moose code paths. Ideally we
100 // would figure out how to remove calls to these functions and then allow
101 // throwing mooseError's from them instead of silently doing nothing (e.g.
102 // reinitNodes, reinitAux, prepareLowerD, etc.).
103
104 virtual void prepare() override final {}
105 virtual void prepareNeighbor() override final {}
106 virtual void prepareAux() override final;
107 virtual void reinitNode() override final {}
108 virtual void reinitNodes(const std::vector<dof_id_type> & /*nodes*/) override final {}
109 virtual void reinitNodesNeighbor(const std::vector<dof_id_type> & /*nodes*/) override final {}
110 virtual void reinitAux() override final {}
111 virtual void reinitAuxNeighbor() override final {}
112 virtual void prepareLowerD() override final {}
113
114 virtual const dof_id_type & nodalDofIndex() const override final
115 {
116 mooseError("nodalDofIndex not supported by MooseVariableFVBase");
117 }
118 virtual const dof_id_type & nodalDofIndexNeighbor() const override final
119 {
120 mooseError("nodalDofIndexNeighbor not supported by MooseVariableFVBase");
121 }
122 virtual std::size_t phiSize() const override final { return _phi.size(); }
123 virtual std::size_t phiFaceSize() const override final { return _phi_face.size(); }
124 virtual std::size_t phiNeighborSize() const override final { return _phi_neighbor.size(); }
125 virtual std::size_t phiFaceNeighborSize() const override final
126 {
127 return _phi_face_neighbor.size();
128 }
129 virtual std::size_t phiLowerSize() const override final
130 {
131 mooseError("phiLowerSize not supported by MooseVariableFVBase");
132 }
133
134 virtual void computeElemValuesFace() override;
135 virtual void computeNeighborValuesFace() override;
136 virtual void computeNeighborValues() override;
137 virtual void computeLowerDValues() override final
138 {
139 // mooseError("computeLowerDValues not supported by MooseVariableFVBase");
140 }
141 virtual void computeNodalNeighborValues() override final
142 {
143 // mooseError("computeNodalNeighborValues not supported by MooseVariableFVBase");
144 }
145 virtual void computeNodalValues() override final
146 {
147 // mooseError("computeNodalValues not supported by MooseVariableFVBase");
148 }
149 virtual const std::vector<dof_id_type> & dofIndicesLower() const override final;
150
151 unsigned int numberOfDofs() const override final { return _element_data->numberOfDofs(); }
152
153 virtual unsigned int numberOfDofsNeighbor() override final
154 {
155 mooseError("numberOfDofsNeighbor not supported by MooseVariableFVBase");
156 }
157
158 virtual bool isNodal() const override final { return false; }
159
160 bool hasDoFsOnNodes() const override final { return false; }
161
163 {
164 return _element_data->getContinuity();
165 };
166
167 virtual bool isNodalDefined() const override final { return false; }
168
169 virtual void setNodalValue(const OutputType & value) override;
170
171 virtual void setDofValue(const DofValue & value, unsigned int index) override;
172
173 void clearDofIndices() override;
174
175 virtual void prepareIC() override;
176
177 virtual const Elem * const & currentElem() const override { return _element_data->currentElem(); }
178
179 virtual void getDofIndices(const Elem * elem,
180 std::vector<dof_id_type> & dof_indices) const override
181 {
182 return _element_data->getDofIndices(elem, dof_indices);
183 }
184
185 virtual const std::vector<dof_id_type> & dofIndices() const final
186 {
187 return _element_data->dofIndices();
188 }
189 virtual const std::vector<dof_id_type> & dofIndicesNeighbor() const final
190 {
191 return _neighbor_data->dofIndices();
192 }
193
195
196 void clearAllDofIndices() final;
197
198 const DofValues & nodalVectorTagValue(TagID) const override
199 {
200 mooseError("nodalVectorTagValue not implemented for finite volume variables.");
201 }
202 const DofValues & nodalMatrixTagValue(TagID) const override
203 {
204 mooseError("nodalMatrixTagValue not implemented for finite volume variables.");
205 }
206
207 const FieldVariableValue & vectorTagValue(TagID tag) const override
208 {
209 return _element_data->vectorTagValue(tag);
210 }
211 const DofValues & vectorTagDofValue(TagID tag) const override
212 {
213 return _element_data->vectorTagDofValue(tag);
214 }
215 const FieldVariableValue & matrixTagValue(TagID tag) const override
216 {
217 return _element_data->matrixTagValue(tag);
218 }
220 {
221 return _neighbor_data->vectorTagValue(tag);
222 }
224 {
225 return _neighbor_data->matrixTagValue(tag);
226 }
227
228 const FieldVariableValue & uDot() const { return _element_data->uDot(); }
229 const FieldVariableValue & sln() const override { return _element_data->sln(Moose::Current); }
230 const FieldVariableValue & slnOld() const override { return _element_data->sln(Moose::Old); }
231 const FieldVariableValue & slnOlder() const override { return _element_data->sln(Moose::Older); }
232 const FieldVariableGradient & gradSln() const override
233 {
234 return _element_data->gradSln(Moose::Current);
235 }
236 const FieldVariableGradient & gradSlnOld() const override
237 {
238 return _element_data->gradSln(Moose::Old);
239 }
240 const FieldVariableValue & uDotNeighbor() const { return _neighbor_data->uDot(); }
241 const FieldVariableValue & slnNeighbor() const override
242 {
243 return _neighbor_data->sln(Moose::Current);
244 }
245 const FieldVariableValue & slnOldNeighbor() const override
246 {
247 return _neighbor_data->sln(Moose::Old);
248 }
249 const FieldVariableGradient & gradSlnNeighbor() const override
250 {
251 return _neighbor_data->gradSln(Moose::Current);
252 }
254 {
255 return _neighbor_data->gradSln(Moose::Old);
256 }
257
258 const VariableValue & duDotDu() const { return _element_data->duDotDu(); }
259 const VariableValue & duDotDotDu() const { return _element_data->duDotDotDu(); }
260 const VariableValue & duDotDuNeighbor() const { return _neighbor_data->duDotDu(); }
261 const VariableValue & duDotDotDuNeighbor() const { return _neighbor_data->duDotDotDu(); }
262
265 {
266 return _element_data->adSln();
267 }
269 {
270 return _element_data->adGradSln();
271 }
274 {
275 return adGradSln();
276 }
277
288 virtual const VectorValue<ADReal> & adGradSln(const Elem * const elem,
289 const StateArg & state,
290 const bool correct_skewness = false) const;
291
302 virtual VectorValue<ADReal>
303 adGradSln(const FaceInfo & fi, const StateArg & state, const bool correct_skewness = false) const;
304
317 virtual VectorValue<ADReal> uncorrectedAdGradSln(const FaceInfo & fi,
318 const StateArg & state,
319 const bool correct_skewness = false) const;
320
328 const StateArg & state,
329 bool correct_skewness = false) const;
330
332 {
333 return _element_data->adSecondSln();
334 }
336 {
337 return _element_data->adUDot();
338 }
340 {
341 return _element_data->adUDotDot();
342 }
344 {
345 return _element_data->adGradSlnDot();
346 }
348 {
349 mooseError("We don't currently implement curl for FV");
350 }
352 {
353 mooseError("We don't currently implement divergence for FV");
354 }
355
358 {
359 return _neighbor_data->adSln();
360 }
362 {
363 return _neighbor_data->adGradSln();
364 }
366 {
367 return _neighbor_data->adSecondSln();
368 }
370 {
371 return _neighbor_data->adUDot();
372 }
374 {
375 return _neighbor_data->adUDotDot();
376 }
378 {
379 return _neighbor_data->adGradSlnDot();
380 }
382 {
383 mooseError("We don't currently implement curl for FV");
384 }
386 {
387 mooseError("We don't currently implement divergence for FV");
388 }
389
395 virtual void computeElemValues() override;
403 virtual void computeFaceValues(const FaceInfo & fi) override;
404
408 virtual void setDofValues(const DenseVector<DofValue> & values) override;
409 virtual void setLowerDofValues(const DenseVector<DofValue> & values) override;
410
415 DofValue getElementalValue(const Elem * elem, unsigned int idx = 0) const;
420 DofValue getElementalValueOld(const Elem * elem, unsigned int idx = 0) const;
425 DofValue getElementalValueOlder(const Elem * elem, unsigned int idx = 0) const;
426
427 virtual void insert(libMesh::NumericVector<libMesh::Number> & vector) override;
428 virtual void insertLower(libMesh::NumericVector<libMesh::Number> & vector) override;
429 virtual void add(libMesh::NumericVector<libMesh::Number> & vector) override;
430
431 const DofValues & dofValues() const override;
432 const DofValues & dofValuesOld() const override;
433 const DofValues & dofValuesOlder() const override;
434 const DofValues & dofValuesPreviousNL() const override;
435 const DofValues & dofValuesNeighbor() const override;
436 const DofValues & dofValuesOldNeighbor() const override;
437 const DofValues & dofValuesOlderNeighbor() const override;
438 const DofValues & dofValuesPreviousNLNeighbor() const override;
439 const DofValues & dofValuesDot() const override;
440 const DofValues & dofValuesDotNeighbor() const override;
441 const DofValues & dofValuesDotOld() const override;
442 const DofValues & dofValuesDotOldNeighbor() const override;
443 const DofValues & dofValuesDotDot() const override;
444 const DofValues & dofValuesDotDotNeighbor() const override;
445 const DofValues & dofValuesDotDotOld() const override;
446 const DofValues & dofValuesDotDotOldNeighbor() const override;
447 const MooseArray<libMesh::Number> & dofValuesDuDotDu() const override;
449 const MooseArray<libMesh::Number> & dofValuesDuDotDotDu() const override;
451
452 const ADDofValues & adDofValues() const override;
453 const ADDofValues & adDofValuesNeighbor() const override;
454 const ADDofValues & adDofValuesDot() const override;
455
458 OutputType getValue(const Elem * elem) const;
459
464 typename OutputTools<OutputType>::OutputGradient getGradient(const Elem * elem) const;
465
470 bool hasDirichletBC() const
471 {
472 return _element_data->hasDirichletBC() || _neighbor_data->hasDirichletBC();
473 }
474
475 std::pair<bool, const FVDirichletBCBase *> getDirichletBC(const FaceInfo & fi) const;
476
477 std::pair<bool, std::vector<const FVFluxBC *>> getFluxBCs(const FaceInfo & fi) const;
478
479 virtual void residualSetup() override;
480 virtual void initialSetup() override;
481 virtual void jacobianSetup() override;
482 virtual void timestepSetup() override;
483 virtual void meshChanged() override;
484
492 ADReal getElemValue(const Elem * elem, const StateArg & state) const;
493
494 void setActiveTags(const std::set<TagID> & vtags) override;
495
496 bool supportsQpBasedLoops() const override { return true; }
497 bool supportsGeometricInfoBasedLoops() const override { return true; }
498
511 virtual bool isDirichletBoundaryFace(const FaceInfo & fi,
512 const Elem * elem,
513 const Moose::StateArg & state) const;
514
515 bool supportsFaceArg() const override final { return true; }
516 bool supportsElemSideQpArg() const override final { return true; }
517
518 virtual void sizeMatrixTagData() override;
519
520protected:
536 const Elem * elem,
537 const Moose::StateArg & state) const;
538
553 bool isExtrapolatedBoundaryFace(const FaceInfo & fi,
554 const Elem * elem,
555 const Moose::StateArg & state) const override;
556
557private:
558 using MooseVariableField<OutputType>::evaluate;
559 using MooseVariableField<OutputType>::evaluateGradient;
560 using MooseVariableField<OutputType>::evaluateDot;
561
562 ValueType evaluate(const ElemArg & elem, const StateArg &) const override final;
563 ValueType evaluate(const FaceArg & face, const StateArg &) const override final;
564 ValueType evaluate(const NodeArg & node, const StateArg &) const override final;
565 ValueType evaluate(const ElemPointArg & elem_point, const StateArg & state) const override final;
566 ValueType evaluate(const ElemQpArg & elem_qp, const StateArg & state) const override final;
567 ValueType evaluate(const ElemSideQpArg & elem_side_qp,
568 const StateArg & state) const override final;
569 GradientType evaluateGradient(const ElemQpArg & qp_arg, const StateArg &) const override final;
570 GradientType evaluateGradient(const ElemArg & elem_arg, const StateArg &) const override final;
571 GradientType evaluateGradient(const FaceArg & face, const StateArg &) const override final;
572 DotType evaluateDot(const ElemArg & elem, const StateArg &) const override final;
573 DotType evaluateDot(const FaceArg & face, const StateArg &) const override final;
574 DotType evaluateDot(const ElemQpArg & elem_qp, const StateArg &) const override final;
575
580
583
588
590 bool _flux_map_setup = false;
591
592public:
594 {
595 mooseError("Finite volume variables do not have defined values at nodes.");
596 }
598 {
599 mooseError("Finite volume variables do not have defined values at nodes.");
600 }
602 {
603 mooseError("Finite volume variables do not have defined values at nodes.");
604 }
605
606 bool computingSecond() const override final { return false; }
607 bool computingCurl() const override final { return false; }
608 bool computingDiv() const override final { return false; }
609 bool usesSecondPhiNeighbor() const override final { return false; }
610
611 const FieldVariablePhiValue & phi() const override final { return _phi; }
612 const FieldVariablePhiGradient & gradPhi() const override final { return _grad_phi; }
613 const FieldVariablePhiSecond & secondPhi() const override final
614 {
615 mooseError("We don't currently implement second derivatives for FV");
616 }
617 const FieldVariablePhiValue & curlPhi() const override final
618 {
619 mooseError("We don't currently implement curl for FV");
620 }
621 const FieldVariablePhiDivergence & divPhi() const override final
622 {
623 mooseError("We don't currently implement divergence for FV");
624 }
625
626 const FieldVariablePhiValue & phiFace() const override final { return _phi_face; }
627 const FieldVariablePhiGradient & gradPhiFace() const override final { return _grad_phi_face; }
628 const FieldVariablePhiSecond & secondPhiFace() const override final
629 {
630 mooseError("We don't currently implement second derivatives for FV");
631 }
632
633 const FieldVariablePhiValue & phiFaceNeighbor() const override final
634 {
635 return _phi_face_neighbor;
636 }
637 const FieldVariablePhiGradient & gradPhiFaceNeighbor() const override final
638 {
640 }
641 const FieldVariablePhiSecond & secondPhiFaceNeighbor() const override final
642 {
643 mooseError("We don't currently implement second derivatives for FV");
644 }
645
646 const FieldVariablePhiValue & phiNeighbor() const override final { return _phi_neighbor; }
647 const FieldVariablePhiGradient & gradPhiNeighbor() const override final
648 {
649 return _grad_phi_neighbor;
650 }
651 const FieldVariablePhiSecond & secondPhiNeighbor() const override final
652 {
653 mooseError("We don't currently implement second derivatives for FV");
654 }
655
656 virtual const FieldVariablePhiValue & phiLower() const override;
657
658 unsigned int oldestSolutionStateRequested() const override final;
659
682 bool two_term_expansion,
683 bool correct_skewness,
684 const Elem * elem_side_to_extrapolate_from,
685 const StateArg & state) const;
686
689
690protected:
694 void clearCaches();
695
697
699 std::unique_ptr<MooseVariableDataFV<OutputType>> _element_data;
700
702 std::unique_ptr<MooseVariableDataFV<OutputType>> _neighbor_data;
703
704private:
709
719
722 mutable const Elem * _prev_elem;
723
726 std::unordered_map<BoundaryID, const FVDirichletBCBase *> _boundary_id_to_dirichlet_bc;
727
730 std::unordered_map<BoundaryID, std::vector<const FVFluxBC *>> _boundary_id_to_flux_bc;
731
735 [[noreturn]] void lowerDError() const;
736
737protected:
739 mutable std::unordered_map<const Elem *, VectorValue<ADReal>> _elem_to_grad;
740
743
746 mutable VectorValue<ADReal> _temp_cell_gradient;
747
750
755
756 friend void Moose::initDofIndices<>(MooseVariableFV<OutputType> &, const Elem &);
757};
758
759template <typename OutputType>
760inline const typename MooseVariableFV<OutputType>::ADDofValues &
762{
763 return _element_data->adDofValues();
764}
765
766template <typename OutputType>
767inline const typename MooseVariableFV<OutputType>::ADDofValues &
769{
770 return _neighbor_data->adDofValues();
771}
772
773template <typename OutputType>
774inline const typename MooseVariableFV<OutputType>::ADDofValues &
776{
777 return _element_data->adDofValuesDot();
778}
779
780template <typename OutputType>
782MooseVariableFV<OutputType>::evaluate(const ElemArg & elem_arg, const StateArg & state) const
783{
784 return getElemValue(elem_arg.elem, state);
785}
786
787template <typename OutputType>
789MooseVariableFV<OutputType>::evaluate(const ElemPointArg & elem_point, const StateArg & state) const
790{
791 return (*this)(elem_point.makeElem(), state) +
792 (elem_point.point - elem_point.elem->vertex_average()) *
793 this->gradient(elem_point.makeElem(), state);
794}
795
796template <typename OutputType>
798MooseVariableFV<OutputType>::evaluate(const ElemQpArg & elem_qp, const StateArg & state) const
799{
800 return (*this)(ElemPointArg{elem_qp.elem,
801 elem_qp.point,
802 _face_interp_method == Moose::FV::InterpMethod::SkewCorrectedAverage},
803 state);
804}
805
806template <typename OutputType>
809 const StateArg & state) const
810{
811 return (*this)(ElemPointArg{elem_side_qp.elem,
812 elem_side_qp.point,
813 _face_interp_method == Moose::FV::InterpMethod::SkewCorrectedAverage},
814 state);
815}
816
817template <typename OutputType>
820 const StateArg & state) const
821{
822 return adGradSln(
823 qp_arg.elem, state, _face_interp_method == Moose::FV::InterpMethod::SkewCorrectedAverage);
824}
825
826template <typename OutputType>
829 const StateArg & state) const
830{
831 return adGradSln(elem_arg.elem, state, elem_arg.correct_skewness);
832}
833
834template <typename OutputType>
837{
838 mooseAssert(face.fi, "We must have a non-null face information");
839 return adGradSln(*face.fi, state, face.correct_skewness);
840}
841
842template <typename OutputType>
843void
844MooseVariableFV<OutputType>::setActiveTags(const std::set<TagID> & vtags)
845{
846 _element_data->setActiveTags(vtags);
847 _neighbor_data->setActiveTags(vtags);
848}
849
850template <typename OutputType>
851const std::vector<dof_id_type> &
853{
854 static const std::vector<dof_id_type> empty;
855 return empty;
856}
857
858template <typename OutputType>
859void
861{
862 determineBoundaryToDirichletBCMap();
863 determineBoundaryToFluxBCMap();
865}
866
867template <typename OutputType>
868void
870{
871 _prev_elem = nullptr;
872 _dirichlet_map_setup = false;
873 _flux_map_setup = false;
875}
876
877template <typename OutputType>
878void
880{
881 _dirichlet_map_setup = false;
882 _flux_map_setup = false;
884}
885
886template <typename OutputType>
889{
890 lowerDError();
891}
892
893template <typename OutputType>
894void
896{
897 mooseError("Lower dimensional element support not implemented for finite volume variables");
898}
899
900// Declare all the specializations, as the template specialization declaration below must know
901template <>
902ADReal MooseVariableFV<Real>::evaluateDot(const ElemArg & elem, const StateArg & state) const;
903template <>
904ADReal MooseVariableFV<Real>::evaluateDot(const FaceArg & elem_arg, const StateArg & state) const;
905template <>
906ADReal MooseVariableFV<Real>::evaluateDot(const ElemQpArg & elem_arg, const StateArg & state) const;
907
908// Prevent implicit instantiation in other translation units where these classes are used
909extern template class MooseVariableFV<Real>;
DualNumber< Real, DNDerivativeType, true > ADReal
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
unsigned int TagID
Definition MooseTypes.h:238
OutputTools< Real >::VariableValue VariableValue
Definition MooseTypes.h:348
typename OutputTools< typename Moose::ADType< T >::type >::VariableSecond ADTemplateVariableSecond
Definition MooseTypes.h:660
typename OutputTools< typename Moose::ADType< T >::type >::VariableValue ADTemplateVariableValue
Definition MooseTypes.h:654
typename OutputTools< typename Moose::ADType< T >::type >::VariableDivergence ADTemplateVariableDivergence
Definition MooseTypes.h:665
typename OutputTools< typename Moose::ADType< T >::type >::VariableCurl ADTemplateVariableCurl
Definition MooseTypes.h:662
typename OutputTools< typename Moose::ADType< T >::type >::VariableGradient ADTemplateVariableGradient
Definition MooseTypes.h:657
MooseVariableFV< Real > MooseVariableFVReal
std::array< Real, 2 > values
Definition MortarUtils.C:52
Base class for finite volume Dirichlet boundaray conditions.
Provides an interface for computing residual contributions from finite volume numerical fluxes comput...
Definition FVFluxBC.h:27
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
virtual void meshChanged()
Called on this object when the mesh changes.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
This class provides variable solution values for other classes/objects to bind to when looping over f...
const DofValues & nodalVectorTagValue(TagID) const override
const ADTemplateVariableGradient< OutputType > & adGradSlnNeighborDot() const override
AD grad of time derivative neighbor solution getter.
virtual void computeNeighborValuesFace() override
Compute values at facial quadrature points for the neighbor.
const DofValues & dofValuesDot() const override
bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
const FieldVariablePhiDivergence & divPhi() const override final
Divergence of the shape functions.
const FieldVariablePhiValue & phiNeighbor() const override final
Return the variable's shape functions on a neighboring element.
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &) override final
const FieldVariablePhiValue & _phi
Shape functions.
virtual const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
DofValue getElementalValue(const Elem *elem, unsigned int idx=0) const
Get the current value of this variable on an element.
std::unique_ptr< MooseVariableDataFV< OutputType > > _element_data
Holder for all the data associated with the "main" element.
const FieldVariableValue & uDotNeighbor() const
const FieldVariableGradient & gradSlnOld() const override
const Elem * _prev_elem
A member used to help determine when we can return cached data as opposed to computing new data.
ValueType evaluate(const ElemSideQpArg &elem_side_qp, const StateArg &state) const override final
virtual bool isFV() const override
bool _dirichlet_map_setup
Whether the boundary to Dirichlet cache map has been setup yet.
unsigned int numberOfDofs() const override final
Get the number of local DoFs.
virtual void meshChanged() override
Called on this object when the mesh changes.
const ADDofValues & adDofValues() const override
Return the AD dof values.
static InputParameters validParams()
const FieldVariableGradient & gradSlnNeighbor() const override
neighbor solution gradients
typename MooseVariableField< OutputType >::OutputSecond OutputSecond
const DofValues & dofValuesDotDotOld() const override
const ADTemplateVariableValue< OutputType > & adSln() const override
AD.
typename MooseVariableField< OutputType >::FieldVariableDivergence FieldVariableDivergence
const ADDofValues & adDofValuesDot() const override
Return the AD time derivatives at dofs.
const FieldVariablePhiSecond & secondPhiFace() const override final
Return the rank-2 tensor of second derivatives of the variable's shape functions on an element face.
virtual void reinitAuxNeighbor() override final
GradientType evaluateGradient(const ElemQpArg &qp_arg, const StateArg &) const override final
DofValue getElementalValueOlder(const Elem *elem, unsigned int idx=0) const
Get the older value of this variable on an element.
const ADTemplateVariableSecond< OutputType > & adSecondSln() const override
AD second solution getter.
virtual std::size_t phiLowerSize() const override final
Return the number of shape functions on the lower dimensional element for this variable.
virtual const FieldVariablePhiValue & phiLower() const override
Return the variable's shape functions on a lower-dimensional element.
const DofValues & dofValuesOld() const override
virtual VectorValue< ADReal > uncorrectedAdGradSln(const FaceInfo &fi, const StateArg &state, const bool correct_skewness=false) const
Retrieve (or potentially compute) the uncorrected gradient on the provided face.
virtual void prepareIC() override
Prepare the initial condition.
std::unordered_map< BoundaryID, const FVDirichletBCBase * > _boundary_id_to_dirichlet_bc
Map from boundary ID to Dirichlet boundary conditions.
void clearDofIndices() override
Clear out the dof indices.
virtual const dof_id_type & nodalDofIndex() const override final
const FieldVariablePhiSecond & secondPhiNeighbor() const override final
Return the rank-2 tensor of second derivatives of the variable's shape functions on a neighboring ele...
bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const override
Returns whether this is an extrapolated boundary face.
DotType evaluateDot(const ElemQpArg &elem_qp, const StateArg &) const override final
typename MooseVariableField< OutputType >::OutputShapeDivergence OutputShapeDivergence
void determineBoundaryToDirichletBCMap()
Setup the boundary to Dirichlet BC map.
libMesh::FEContinuity getContinuity() const override final
Return the continuity of this variable.
const FieldVariablePhiGradient & gradPhiFace() const override final
Return the gradients of the variable's shape functions on an element face.
std::unordered_map< const Elem *, VectorValue< ADReal > > _elem_to_grad
A cache for storing gradients on elements.
const MooseArray< OutputType > & nodalValueOldArray() const override
const bool & getTwoTermBoundaryExpansion() const
Function to get wether two term boundary expansion is used for the variable.
Moose::FV::InterpMethod _face_interp_method
Decides if an average or skewed corrected average is used for the face interpolation.
GradientType evaluateGradient(const ElemArg &elem_arg, const StateArg &) const override final
Evaluate the functor gradient with a given element.
virtual void reinitAux() override final
const DofValues & vectorTagDofValue(TagID tag) const override
OutputTools< OutputType >::OutputGradient getGradient(const Elem *elem) const
Compute the variable gradient value at a point on an element.
typename MooseVariableField< OutputType >::FieldVariablePhiDivergence FieldVariablePhiDivergence
const MooseArray< libMesh::Number > & dofValuesDuDotDu() const override
const FieldVariablePhiValue & curlPhi() const override final
Curl of the shape functions.
const FieldVariablePhiValue & phi() const override final
Return the variable's elemental shape functions.
const DofValues & dofValuesOldNeighbor() const override
virtual bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
Determine whether a specified face side is a Dirichlet boundary face.
bool supportsQpBasedLoops() const override
Whether this variable supports QP-indexed loops.
const MooseArray< libMesh::Number > & dofValuesDuDotDotDu() const override
Moose::FV::InterpMethod faceInterpolationMethod() const
const FieldVariablePhiGradient & _grad_phi
void setActiveTags(const std::set< TagID > &vtags) override
Set the active vector tags.
std::pair< bool, std::vector< const FVFluxBC * > > getFluxBCs(const FaceInfo &fi) const
DofValue getElementalValueOld(const Elem *elem, unsigned int idx=0) const
Get the old value of this variable on an element.
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job.
const VariableValue & duDotDotDu() const
const ADTemplateVariableValue< OutputType > & adUDotNeighbor() const override
AD neighbor time derivative getter.
virtual std::size_t phiSize() const override final
Return phi size.
Moose::StateArg StateArg
const DofValues & dofValuesDotOldNeighbor() const override
virtual bool isNodalDefined() const override final
Is this variable defined at nodes.
const FieldVariablePhiGradient & _grad_phi_face_neighbor
virtual ADReal getExtrapolatedBoundaryFaceValue(const FaceInfo &fi, bool two_term_expansion, bool correct_skewness, const Elem *elem_side_to_extrapolate_from, const StateArg &state) const
Retrieves an extrapolated boundary value for the provided face.
const FieldVariableValue & slnNeighbor() const override
const ADTemplateVariableCurl< OutputType > & adCurlSlnNeighbor() const override
AD curl neighbor solution getter.
OutputType getValue(const Elem *elem) const
Note: const monomial is always the case - higher order solns are reconstructed - so this is simpler f...
void lowerDError() const
Emit an error message for unsupported lower-d ops.
const FieldVariablePhiGradient & _grad_phi_face
bool hasDirichletBC() const
Returns true if a Dirichlet BC exists on the current face.
const DofValues & dofValuesPreviousNL() const override
typename MooseVariableField< OutputType >::FieldVariableValue FieldVariableValue
const FieldVariableValue & sln() const override
virtual void getDofIndices(const Elem *elem, std::vector< dof_id_type > &dof_indices) const override
const ADTemplateVariableDivergence< OutputType > & adDivSlnNeighbor() const override
AD divergence neighbor solution getter.
bool supportsGeometricInfoBasedLoops() const override
Whether this variable supports geometric-info-based loops, such as ElemInfo/FaceInfo loops.
const DofValues & dofValuesDotNeighbor() const override
const FieldVariableValue & vectorTagValue(TagID tag) const override
tag values getters
const DofValues & dofValuesNeighbor() const override
const DofValues & dofValuesDotDot() const override
std::unordered_map< BoundaryID, std::vector< const FVFluxBC * > > _boundary_id_to_flux_bc
Map from boundary ID to flux boundary conditions.
virtual const Elem *const & currentElem() const override
Current element this variable is evaluated at.
const FieldVariablePhiValue & phiFace() const override final
Return the variable's shape functions on an element face.
unsigned int oldestSolutionStateRequested() const override final
The oldest solution state that is requested for this variable (0 = current, 1 = old,...
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...
virtual void setDofValues(const DenseVector< DofValue > &values) override
Set local DOF values and evaluate the values on quadrature points.
const FieldVariablePhiSecond & secondPhi() const override final
Return the rank-2 tensor of second derivatives of the variable's elemental shape functions.
typename MooseVariableField< OutputType >::FieldVariableCurl FieldVariableCurl
ADReal getElemValue(const Elem *elem, const StateArg &state) const
Get the solution value for the provided element and seed the derivative for the corresponding dof ind...
typename MooseVariableField< OutputType >::OutputShapeSecond OutputShapeSecond
ADReal getBoundaryFaceValue(const FaceInfo &fi, const StateArg &state, bool correct_skewness=false) const
Retrieve the solution value at a boundary face.
bool hasDoFsOnNodes() const override final
Does this variable have DoFs on nodes.
virtual void insert(libMesh::NumericVector< libMesh::Number > &vector) override
Insert the currently cached degree of freedom values into the provided vector.
const ADTemplateVariableValue< OutputType > & adUDotDot() const override
AD second time derivative getter.
virtual const std::vector< dof_id_type > & dofIndicesNeighbor() const final
Get neighbor DOF indices for currently selected element.
const FieldVariablePhiValue & _phi_face_neighbor
const VariableValue & duDotDu() const
const FieldVariableValue & vectorTagValueNeighbor(TagID tag)
bool _two_term_boundary_expansion
Whether to use a two term expansion for computing boundary face values.
virtual void reinitNode() override final
const FieldVariablePhiValue & _phi_neighbor
virtual void residualSetup() override
Gets called just before the residual is computed and before this object is asked to do its job.
virtual void reinitNodes(const std::vector< dof_id_type > &) override final
const DofValues & dofValuesPreviousNLNeighbor() const override
bool usesSecondPhiNeighbor() const override final
Whether or not this variable is actually using the shape function second derivatives.
ValueType evaluate(const ElemQpArg &elem_qp, const StateArg &state) const override final
const FieldVariablePhiSecond & secondPhiFaceNeighbor() const override final
Return the rank-2 tensor of second derivatives of the variable's shape functions on a neighboring ele...
GradientType evaluateGradient(const FaceArg &face, const StateArg &) const override final
const FieldVariableValue & slnOlder() const override
virtual void setNodalValue(const OutputType &value) override
const DofValues & dofValuesOlder() const override
virtual void computeNeighborValues() override
Compute values at quadrature points for the neighbor.
virtual unsigned int numberOfDofsNeighbor() override final
typename MooseVariableField< OutputType >::FieldVariableSecond FieldVariableSecond
typename MooseVariableField< OutputType >::FieldVariablePhiGradient FieldVariablePhiGradient
std::pair< bool, const FVDirichletBCBase * > getDirichletBC(const FaceInfo &fi) const
DotType evaluateDot(const FaceArg &face, const StateArg &) const override final
virtual void prepareLowerD() override final
Prepare a lower dimensional element's degrees of freedom.
typename MooseVariableField< OutputType >::OutputGradient OutputGradient
const ADDofValues & adDofValuesNeighbor() const override
Return the AD neighbor dof values.
typename MooseVariableField< OutputType >::FieldVariablePhiSecond FieldVariablePhiSecond
virtual void computeElemValuesFace() override
Compute values at facial quadrature points.
void clearAllDofIndices() final
const DofValues & nodalMatrixTagValue(TagID) const override
virtual ADReal getDirichletBoundaryFaceValue(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
Retrieves a Dirichlet boundary value for the provided face.
std::unique_ptr< MooseVariableDataFV< OutputType > > _neighbor_data
Holder for all the data associated with the neighbor element.
const ADTemplateVariableGradient< OutputType > & adGradSlnDot() const override
AD grad of time derivative solution getter.
typename MooseVariableField< OutputType >::OutputDivergence OutputDivergence
const VariableValue & duDotDotDuNeighbor() const
virtual void add(libMesh::NumericVector< libMesh::Number > &vector) override
Add the currently cached degree of freedom values into the provided vector.
const FieldVariableGradient & gradSln() const override
element gradients
virtual void computeLowerDValues() override final
compute values at quadrature points on the lower dimensional element
virtual void setLowerDofValues(const DenseVector< DofValue > &values) override
Set local DOF values for a lower dimensional element and evaluate the values on quadrature points.
const FieldVariablePhiGradient & gradPhiFaceNeighbor() const override final
Return the gradients of the variable's shape functions on a neighboring element face.
virtual std::size_t phiFaceSize() const override final
Return phiFace size.
const MooseArray< OutputType > & nodalValueArray() const override
Methods for retrieving values of variables at the nodes in a MooseArray for AuxKernelBase.
const MooseArray< OutputType > & nodalValueOlderArray() const override
virtual void computeNodalValues() override final
Compute nodal values of this variable.
virtual void sizeMatrixTagData() override
Size data structures related to matrix tagging.
const FieldVariableValue & uDot() const
const ADTemplateVariableGradient< OutputType > & adGradSlnFace() const override
Finite volume variables do not distinguish face and volume AD gradient requests.
DotType evaluateDot(const ElemArg &elem, const StateArg &) const override final
Evaluate the functor time derivative with a given element.
void clearCaches()
clear finite volume caches
virtual void computeNodalNeighborValues() override final
Compute nodal values of this variable in the neighbor.
virtual void prepare() override final
Prepare the elemental degrees of freedom.
ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const override final
Evaluate the functor with a given element and point.
const FieldVariablePhiValue & _phi_face
bool _flux_map_setup
Whether the boundary to fluxBC cache map has been setup yet.
typename MooseVariableField< OutputType >::FieldVariablePhiValue FieldVariablePhiValue
virtual void prepareNeighbor() override final
Prepare the neighbor element degrees of freedom.
const ADTemplateVariableCurl< OutputType > & adCurlSln() const override
AD curl solution getter.
void determineBoundaryToFluxBCMap()
Setup the boundary to Flux BC map.
virtual void computeFaceValues(const FaceInfo &fi) override
Initializes/computes variable values from the solution vectors for the face represented by fi.
bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
const bool _cache_cell_gradients
Whether to cache cell gradients.
const FieldVariableGradient & gradSlnOldNeighbor() const override
bool computingCurl() const override final
Whether or not this variable is computing any curl quantities.
const FieldVariableValue & matrixTagValue(TagID tag) const override
const FieldVariableValue & matrixTagValueNeighbor(TagID tag)
const libMesh::NumericVector< libMesh::Number > *const & _solution
The current (ghosted) solution.
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 ...
const FieldVariablePhiValue & phiFaceNeighbor() const override final
Return the variable's shape functions on a neighboring element face.
bool computingDiv() const override final
Whether or not this variable is computing any divergence quantities.
const MooseArray< libMesh::Number > & dofValuesDuDotDuNeighbor() const override
typename MooseVariableField< OutputType >::OutputShape OutputShape
virtual void prepareAux() override final
virtual void computeElemValues() override
Initializes/computes variable values from the solution vectors for the current element being operated...
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
virtual std::size_t phiFaceNeighborSize() const override final
Return phiFaceNeighbor size.
const DofValues & dofValuesDotOld() const override
const ADTemplateVariableValue< OutputType > & adUDotDotNeighbor() const override
AD neighbor second time derivative getter.
const ADTemplateVariableSecond< OutputType > & adSecondSlnNeighbor() const override
AD second neighbor solution getter.
const ADTemplateVariableGradient< OutputType > & adGradSlnNeighbor() const override
AD grad neighbor solution getter.
typename MooseVariableField< OutputType >::OutputShapeGradient OutputShapeGradient
virtual std::size_t phiNeighborSize() const override final
Return phiNeighbor size.
const FieldVariablePhiGradient & gradPhi() const override final
Return the gradients of the variable's elemental shape functions.
const DofValues & dofValuesDotDotNeighbor() const override
const VariableValue & duDotDuNeighbor() const
const FieldVariableValue & slnOld() const override
bool computingSecond() const override final
Whether or not this variable is computing any second derivatives.
const DofValues & dofValues() const override
dof values getters
const ADTemplateVariableGradient< OutputType > & adGradSln() const override
AD grad solution getter.
virtual void jacobianSetup() override
Gets called just before the Jacobian is computed and before this object is asked to do its job.
const FieldVariablePhiGradient & _grad_phi_neighbor
VectorValue< ADReal > _temp_cell_gradient
A member to hold the cell gradient when not caching, used to return a reference (due to expensive ADR...
const DofValues & dofValuesDotDotOldNeighbor() const override
virtual void setDofValue(const DofValue &value, unsigned int index) override
Degree of freedom value setters.
const FieldVariablePhiGradient & gradPhiNeighbor() const override final
Return the gradients of the variable's shape functions on a neighboring element.
virtual bool isNodal() const override final
Is this variable nodal.
const ADTemplateVariableValue< OutputType > & adUDot() const override
AD time derivative getter.
ValueType evaluate(const ElemArg &elem, const StateArg &) const override final
Evaluate the functor with a given element.
const ADTemplateVariableValue< OutputType > & adSlnNeighbor() const override
neighbor AD
typename MooseVariableField< OutputType >::FieldVariableGradient FieldVariableGradient
const ADTemplateVariableDivergence< OutputType > & adDivSln() const override
AD divergence solution getter.
const DofValues & dofValuesOlderNeighbor() const override
virtual const dof_id_type & nodalDofIndexNeighbor() const override final
const MooseArray< libMesh::Number > & dofValuesDuDotDotDuNeighbor() const override
const FieldVariableValue & slnOldNeighbor() const override
Class for stuff related to variables.
typename MooseVariableDataBase< OutputType >::ADDofValue ADDofValue
Moose::ShapeType< OutputType >::type OutputShape
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job.
libMesh::TensorTools::DecrementRank< OutputShape >::type OutputShapeDivergence
typename MooseVariableDataBase< OutputType >::ADDofValues ADDofValues
libMesh::TensorTools::DecrementRank< OutputType >::type OutputDivergence
typename MooseVariableDataBase< OutputType >::DofValue DofValue
typename MooseVariableDataBase< OutputType >::DofValues DofValues
typename FunctorReturnType< Moose::ADType< OutputType >::type, FunctorEvaluationKind::Gradient >::type GradientType
This rigmarole makes it so that a user can create functors that return containers (std::vector,...
virtual void initialSetup()
Gets called at the beginning of the simulation before this object is asked to do its job.
Point vertex_average() const
InterpMethod
This codifies a set of available ways to interpolate with elem+neighbor solution information to calcu...
Definition MathFVUtils.h:39
@ SkewCorrectedAverage
(gc*elem+(1-gc)*neighbor)+gradient*(rf-rf')
@ Current
Definition MooseTypes.h:263
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
A structure that is used to evaluate Moose functors logically at an element/cell center.
const libMesh::Elem * elem
A structure that is used to evaluate Moose functors at an arbitrary physical point contained within a...
ElemArg makeElem() const
Make a ElemArg from our data.
const libMesh::Elem * elem
Argument for requesting functor evaluation at a quadrature point location in an element.
const libMesh::Elem * elem
The element.
libMesh::Point point
The physical location of the quadrature point.
Argument for requesting functor evaluation at quadrature point locations on an element side.
const libMesh::Elem * elem
The element.
Point point
The physical location of the quadrature point.
A structure defining a "face" evaluation calling argument for Moose functors.
bool correct_skewness
Whether to perform skew correction.
const FaceInfo * fi
a face information object which defines our location in space
State argument for evaluating functors.