19#include "libmesh/numeric_vector.h"
20#include "libmesh/dof_map.h"
21#include "libmesh/elem.h"
22#include "libmesh/quadrature.h"
23#include "libmesh/dense_vector.h"
24#include "libmesh/enum_fe_family.h"
45template <
typename OutputType>
89 virtual bool isFV()
const override {
return true; }
204 const std::unordered_map<BoundaryID, LinearFVBoundaryCondition *> &
212 virtual bool isNodal() const override final {
return false; }
221 virtual const Elem *
const &
currentElem()
const override;
271 const std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> &
_grad_container;
301 const StateArg & state)
const override final;
303 const StateArg & state)
const override final;
305 const StateArg & state)
const override final;
307 const StateArg &)
const override final;
309 const StateArg &)
const override final;
311 const StateArg &)
const override final;
342 std::vector<dof_id_type> & dof_indices)
const override;
355 [[noreturn]] virtual const
std::vector<dof_id_type> &
dofIndicesLower() const override final;
369 virtual void setNodalValue(
const OutputType & value,
unsigned int idx = 0)
override;
373 virtual const std::vector<dof_id_type> &
dofIndices() const final;
380 virtual void reinitNodes(
const std::vector<dof_id_type> & )
override final {}
403 virtual void setActiveTags(
const std::set<TagID> & vtags)
override;
501 [[noreturn]] virtual const dof_id_type &
nodalDofIndex() const override final;
511 [[noreturn]]
virtual std::size_t
phiLowerSize() const override final;
514template <typename OutputType>
518 const auto & elem_info = this->
_mesh.
elemInfo(elem_arg.elem->id());
522template <
typename OutputType>
531template <
typename OutputType>
539template <
typename OutputType>
547template <
typename OutputType>
553 return gradSln(elem_info, state);
556template <
typename OutputType>
562 return gradSln(elem_info, state);
565template <
typename OutputType>
570 mooseAssert(face.
fi,
"We must have a non-null face information");
574template <
typename OutputType>
578 mooseError(
"MooseLinearVariableFV does not support time integration at the moment! The variable "
579 "which is causing the issue: ",
583template <
typename OutputType>
587 mooseError(
"MooseLinearVariableFV does not currently support ElemInfo/FaceInfo gradient "
588 "evaluation for non-current states. Requested state index ",
592 "'. Old-state requests typically use state index 1.");
595template <
typename OutputType>
599 mooseError(
"Lower dimensional element support not implemented for finite volume variables!The "
600 "variable which is causing the issue: ",
604template <
typename OutputType>
608 mooseError(
"FV variables don't support nodal variable treatment! The variable which is causing "
613template <
typename OutputType>
617 mooseError(
"Linear FV variable does not support automatic differentiation, the variable which is "
618 "attempting it is: ",
DualNumber< Real, DNDerivativeType, true > ADReal
boundary_id_type BoundaryID
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
MooseLinearVariableFV< Real > MooseLinearVariableFVReal
typename OutputTools< typename Moose::ADType< T >::type >::VariableSecond ADTemplateVariableSecond
typename OutputTools< typename Moose::ADType< T >::type >::VariableValue ADTemplateVariableValue
typename OutputTools< typename Moose::ADType< T >::type >::VariableCurl ADTemplateVariableCurl
typename OutputTools< typename Moose::ADType< T >::type >::VariableGradient ADTemplateVariableGradient
std::array< Real, 2 > values
A system that holds auxiliary variables.
Class used for caching additional information for elements such as the volume and centroid.
Base class for finite volume Dirichlet boundaray conditions.
Provides an interface for computing residual contributions from finite volume numerical fluxes comput...
This data structure is used to store geometric and variable related metadata about each cell face in ...
Base class for boundary conditions for linear FV systems.
Linear system to be solved.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & name() const
Get the name of the class.
This class provides variable solution interface for linear finite volume problems.
virtual std::size_t phiSize() const override final
Return phi size.
virtual const DofValues & dofValues() const override
dof values getters
typename MooseVariableField< OutputType >::DofValues DofValues
const std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & _grad_container
Pointer to the unlimited cell gradient stored by the owning concrete system.
virtual const FieldVariableGradient & gradSlnOldNeighbor() const override
virtual void getDofIndices(const Elem *elem, std::vector< dof_id_type > &dof_indices) const override
virtual const ADTemplateVariableGradient< OutputType > & adGradSlnDot() const override
AD grad of time derivative solution getter.
Real gradSlnComponent(const ElemInfo &elem_info, unsigned int component) const
Get one raw gradient component at a cell center without materializing the full gradient.
virtual void clearAllDofIndices() override final
virtual const dof_id_type & nodalDofIndex() const override final
virtual const FieldVariablePhiGradient & gradPhiFace() const override final
Return the gradients of the variable's shape functions on an element face.
typename MooseVariableField< OutputType >::OutputShapeSecond OutputShapeSecond
std::unordered_map< BoundaryID, LinearFVBoundaryCondition * > _boundary_id_to_bc
Map for easily accessing the boundary conditions based on the boundary IDs.
virtual std::size_t phiFaceNeighborSize() const override final
Return phiFaceNeighbor size.
virtual const FieldVariablePhiSecond & secondPhi() const override final
Return the rank-2 tensor of second derivatives of the variable's elemental shape functions.
const libMesh::NumericVector< libMesh::Number > *const & _solution
The current (ghosted) solution.
virtual const FieldVariableGradient & gradSlnNeighbor() const override
neighbor solution gradients
virtual const Elem *const & currentElem() const override
Current element this variable is evaluated at.
virtual const std::vector< dof_id_type > & dofIndicesNeighbor() const final
Get neighbor DOF indices for currently selected element.
virtual unsigned int numberOfDofs() const override final
Get the number of local DoFs.
const FieldVariablePhiValue & curlPhi() const override final
Curl of the shape functions.
virtual void add(libMesh::NumericVector< libMesh::Number > &vector) override
Add the currently cached degree of freedom values into the provided vector.
virtual bool isDirichletBoundaryFace(const FaceInfo &fi) const
If the variable has a dirichlet boundary condition at face described by fi .
usingMooseVariableBaseMembers
virtual const ADTemplateVariableGradient< OutputType > & adGradSlnNeighborDot() const override
AD grad of time derivative neighbor solution getter.
typename MooseVariableField< OutputType >::OutputSecond OutputSecond
virtual const DofValues & dofValuesOlderNeighbor() const override
virtual std::size_t phiFaceSize() const override final
Return phiFace size.
const FieldVariablePhiGradient & _grad_phi_face_neighbor
virtual const FieldVariablePhiGradient & gradPhi() const override final
Return the gradients of the variable'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.
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 prepare() override final
Prepare the elemental degrees of freedom.
virtual void setNodalValue(const OutputType &value, unsigned int idx=0) override
virtual bool computingSecond() const override final
Whether or not this variable is computing any second derivatives.
virtual const ADTemplateVariableGradient< OutputType > & adGradSlnNeighbor() const override
AD grad neighbor solution getter.
virtual const ADTemplateVariableCurl< OutputType > & adCurlSln() const override
AD curl solution getter.
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 & _phi_face
virtual const DofValues & dofValuesDotNeighbor() const override
virtual const DofValues & dofValuesNeighbor() const override
virtual const DofValues & vectorTagDofValue(TagID tag) const override
virtual void computeNeighborValues() override
Compute values at quadrature points for the neighbor.
virtual const FieldVariableValue & matrixTagValue(TagID tag) const override
typename MooseVariableField< OutputType >::DofValue DofValue
void computeCellGradients()
Switch to request cell gradient computations.
virtual const FieldVariablePhiSecond & secondPhiFaceNeighbor() const override final
Return the rank-2 tensor of second derivatives of the variable's shape functions on a neighboring ele...
virtual const DofValues & dofValuesDot() const override
virtual void residualSetup() override
Gets called just before the residual is computed and before this object is asked to do its job.
virtual const ADTemplateVariableValue< OutputType > & adUDot() const override
AD time derivative getter.
virtual const FieldVariableValue & slnNeighbor() const override
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 const ADTemplateVariableValue< OutputType > & adSlnNeighbor() const override
AD neighbor solution getter.
virtual void prepareLowerD() override final
Prepare a lower dimensional element's degrees of freedom.
virtual const FieldVariablePhiSecond & secondPhiFace() const override final
Return the rank-2 tensor of second derivatives of the variable's shape functions on an element face.
const FieldVariablePhiGradient & _grad_phi_face
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDu() const override
virtual void prepareIC() override
Prepare the initial condition.
virtual const DofValues & dofValuesPreviousNLNeighbor() const override
virtual const ADTemplateVariableValue< OutputType > & adUDotDotNeighbor() const override
AD neighbor second time derivative getter.
virtual DotType evaluateDot(const ElemArg &elem, const StateArg &) const override final
Evaluate the functor time derivative with a given element.
virtual const FieldVariablePhiValue & phiFaceNeighbor() const override final
Return the variable's shape functions on a neighboring element face.
const FieldVariablePhiValue & _phi_neighbor
LinearSystem *const _linear_system
Owning concrete system pointers. One will be null.
const FieldVariablePhiGradient & _grad_phi
virtual void reinitNode() override final
virtual const FieldVariableValue & slnOldNeighbor() const override
virtual const DofValues & dofValuesDotDotOldNeighbor() const override
typename MooseVariableField< OutputType >::FieldVariablePhiGradient FieldVariablePhiGradient
virtual void reinitNodes(const std::vector< dof_id_type > &) override final
virtual void computeFaceValues(const FaceInfo &) override
Compute values at face quadrature points for the element+neighbor (both sides of the face).
void lowerDError() const
Throw and error when somebody requests lower-dimensional data from this variable.
bool supportsGeometricInfoBasedLoops() const override
Whether this variable supports geometric-info-based loops, such as ElemInfo/FaceInfo loops.
virtual const ADTemplateVariableCurl< OutputType > & adCurlSlnNeighbor() const override
AD curl neighbor solution getter.
typename MooseVariableField< OutputType >::FieldVariablePhiDivergence FieldVariablePhiDivergence
virtual const FieldVariablePhiGradient & gradPhiNeighbor() const override final
Return the gradients of the variable's shape functions on a neighboring element.
virtual const FieldVariableValue & slnOlder() const override
virtual const FieldVariablePhiValue & phi() const override final
Return the variable's elemental shape functions.
virtual void computeNodalNeighborValues() override final
Compute nodal values of this variable in the neighbor.
typename MooseVariableField< OutputType >::FieldVariableValue FieldVariableValue
typename MooseVariableField< OutputType >::FieldVariableDivergence FieldVariableDivergence
virtual const DofValues & dofValuesDotOld() const override
virtual void computeNeighborValuesFace() override
Compute values at facial quadrature points for the neighbor.
virtual const ADTemplateVariableSecond< OutputType > & adSecondSln() const override
AD second solution getter.
typename MooseVariableField< OutputType >::FieldVariableCurl FieldVariableCurl
void computeCellLimitedGradients(const Moose::FV::GradientLimiterType limiter_type)
Switch to request limited cell gradient computations.
virtual const FieldVariablePhiValue & phiFace() const override final
Return the variable's shape functions on an element face.
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDuNeighbor() const override
virtual void sizeMatrixTagData() override
Size data structures related to matrix tagging.
virtual bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDotDuNeighbor() const override
virtual void prepareNeighbor() override final
Prepare the neighbor element degrees of freedom.
virtual bool usesSecondPhiNeighbor() const override final
Whether or not this variable is actually using the shape function second derivatives.
virtual void reinitAuxNeighbor() override final
bool supportsQpBasedLoops() const override
Whether this variable supports QP-indexed loops.
virtual const DofValues & dofValuesPreviousNL() const override
virtual const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
virtual void insert(libMesh::NumericVector< libMesh::Number > &vector) override
Insert the currently cached degree of freedom values into the provided vector.
virtual void computeElemValues() override
Compute values at interior quadrature points.
virtual void setLowerDofValues(const DenseVector< DofValue > &values) override
Set local DOF values for a lower dimensional element and evaluate the values on quadrature points.
std::unique_ptr< MooseVariableDataLinearFV< OutputType > > _element_data
Holder for all the data associated with the "main" element.
virtual bool hasDoFsOnNodes() const override final
Does this variable have DoFs on nodes.
virtual void clearDofIndices() override
Clear out the dof indices.
typename MooseVariableField< OutputType >::FieldVariableGradient FieldVariableGradient
virtual const FieldVariablePhiSecond & secondPhiNeighbor() const override final
Return the rank-2 tensor of second derivatives of the variable's shape functions on a neighboring ele...
typename MooseVariableField< OutputType >::ADDofValues ADDofValues
typename MooseVariableField< OutputType >::OutputDivergence OutputDivergence
const FieldVariablePhiDivergence & divPhi() const override final
Divergence of the shape functions.
virtual const FieldVariablePhiGradient & gradPhiFaceNeighbor() const override final
Return the gradients of the variable's shape functions on a neighboring element face.
void timeIntegratorError() const
Throw an error when somebody requests time-related data from this variable.
virtual const MooseArray< libMesh::Number > & dofValuesDuDotDotDu() const override
const FieldVariablePhiGradient & _grad_phi_neighbor
virtual const ADTemplateVariableGradient< OutputType > & adGradSln() const override
AD grad solution getter.
bool _compute_qp_data
Whether QP computation has been requested for this variable (opt-in)
virtual bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
virtual const DofValues & dofValuesDotOldNeighbor() const override
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &) override final
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 bool computingCurl() const override final
Whether or not this variable is computing any curl quantities.
virtual const MooseArray< OutputType > & nodalValueOlderArray() const override
virtual const ADTemplateVariableValue< OutputType > & adUDotNeighbor() const override
AD neighbor time derivative getter.
const unsigned int _sys_num
Cache the number of the system this variable belongs to.
bool _needs_cell_gradients
Boolean to check if this variable needs gradient computations.
virtual void computeNodalValues() override final
Compute nodal values of this variable.
virtual ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const override final
Evaluate the functor with a given element and point.
void gradientStateError(const StateArg &state) const
Throw an error when somebody requests gradients at a non-current solution state.
virtual const FieldVariableGradient & gradSlnOld() const override
LinearFVBoundaryCondition * getBoundaryCondition(const BoundaryID bd_id) const
Get the boundary condition object which corresponds to the given boundary ID.
const FieldVariablePhiValue & _phi
Shape functions, only used when we are postprocessing or using this variable in an auxiliary system.
virtual const FieldVariableValue & sln() const override
const std::unordered_map< BoundaryID, LinearFVBoundaryCondition * > & getBoundaryConditionMap() const
virtual const dof_id_type & nodalDofIndexNeighbor() const override final
void cacheBoundaryBCMap()
Setup the boundary to Dirichlet BC map.
typename MooseVariableField< OutputType >::FieldVariablePhiValue FieldVariablePhiValue
virtual const DofValues & dofValuesOld() const override
virtual void jacobianSetup() override
Gets called just before the Jacobian is computed and before this object is asked to do its job.
virtual bool isNodalDefined() const override final
Is this variable defined at nodes.
virtual void setActiveTags(const std::set< TagID > &vtags) override
Set the active vector tags.
void adError() const
Throw an error when somebody wants to use this variable with automatic differentiation.
virtual bool isFV() const override
RealVectorValue _cell_gradient
Temporary storage for the cell gradient to avoid unnecessary allocations.
typename MooseVariableField< OutputType >::OutputShapeGradient OutputShapeGradient
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 setDofValue(const DofValue &, unsigned int) override
Degree of freedom value setters.
virtual const DofValues & dofValuesDotDotOld() const override
typename MooseVariableField< OutputType >::FieldVariableSecond FieldVariableSecond
virtual ValueType evaluate(const ElemSideQpArg &elem_side_qp, const StateArg &state) const override final
virtual const DofValues & nodalVectorTagValue(TagID) const override
virtual void prepareAux() override final
virtual GradientType evaluateGradient(const FaceArg &face, const StateArg &) const override final
virtual const FieldVariableGradient & gradSln() const override
element gradients
virtual void reinitAux() override final
virtual const ADDofValues & adDofValuesNeighbor() const override
Return the AD neighbor dof values.
virtual void computeLowerDValues() override final
compute values at quadrature points on the lower dimensional element
virtual const ADTemplateVariableSecond< OutputType > & adSecondSlnNeighbor() const override
AD second neighbor solution getter.
virtual bool needsGradientVectorStorage() const override
Check if cell gradient computations were requested for this variable.
virtual const DofValues & dofValuesDotDot() const override
virtual GradientType evaluateGradient(const ElemQpArg &qp_arg, const StateArg &) const override final
typename MooseVariableField< OutputType >::OutputGradient OutputGradient
virtual void setDofValues(const DenseVector< DofValue > &values) override
Set local DOF values and evaluate the values on quadrature points.
typename MooseVariableField< OutputType >::ADDofValue ADDofValue
virtual const FieldVariablePhiValue & phiNeighbor() const override final
Return the variable's shape functions on a neighboring element.
virtual const ADTemplateVariableValue< OutputType > & adSln() const override
AD solution getter.
virtual const ADDofValues & adDofValues() const override
Return the AD dof values.
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job.
AuxiliarySystem *const _auxiliary_system
virtual const DofValues & dofValuesDotDotNeighbor() const override
virtual const DofValues & nodalMatrixTagValue(TagID tag) const override
virtual GradientType evaluateGradient(const ElemArg &elem_arg, const StateArg &) const override final
Evaluate the functor gradient with a given element.
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.
void nodalError() const
Throw an error when somebody wants to use this variable as a nodal variable.
virtual const FieldVariableValue & slnOld() const override
virtual libMesh::FEContinuity getContinuity() const override
Return the continuity of this variable.
typename MooseVariableField< OutputType >::OutputShapeDivergence OutputShapeDivergence
typename MooseVariableField< OutputType >::OutputShape OutputShape
virtual bool isNodal() const override final
Is this variable nodal.
virtual const DofValues & dofValuesOlder() const override
virtual void computeElemValuesFace() override
Compute values at facial quadrature points.
void requireQpComputations() const override
Request that quadrature point data be (pre)computed.
std::unique_ptr< MooseVariableDataLinearFV< OutputType > > _neighbor_data
Holder for all the data associated with the "neighbor" element.
virtual const MooseArray< OutputType > & nodalValueArray() const override
Methods for retrieving values of variables at the nodes in a MooseArray for AuxKernelBase.
virtual std::size_t phiNeighborSize() const override final
Return phiNeighbor size.
virtual unsigned int numberOfDofsNeighbor() override final
static InputParameters validParams()
const FieldVariablePhiValue & _phi_face_neighbor
virtual bool computingDiv() const override final
Whether or not this variable is computing any divergence quantities.
virtual ValueType evaluate(const ElemQpArg &elem_qp, const StateArg &state) const override final
virtual const ADDofValues & adDofValuesDot() const override
Return the AD time derivatives at dofs.
virtual const ADTemplateVariableValue< OutputType > & adUDotDot() const override
AD second time derivative getter.
virtual const MooseArray< OutputType > & nodalValueOldArray() const override
virtual ValueType evaluate(const ElemArg &elem, const StateArg &) const override final
Evaluate the functor with a given element.
typename MooseVariableField< OutputType >::FieldVariablePhiSecond FieldVariablePhiSecond
virtual const DofValues & dofValuesOldNeighbor() const override
virtual const FieldVariableValue & vectorTagValue(TagID tag) const override
tag values getters
virtual unsigned int oldestSolutionStateRequested() const override final
The oldest solution state that is requested for this variable (0 = current, 1 = old,...
const ElemInfo & elemInfo(const dof_id_type id) const
Accessor for the elemInfo object for a given element ID.
MooseMesh & _mesh
mesh the variable is active in
Class for stuff related to variables.
typename MooseVariableDataBase< OutputType >::ADDofValue ADDofValue
Moose::ShapeType< OutputType >::type OutputShape
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,...
Moose::ADType< OutputType >::type ValueType
GradientLimiterType
Cell-gradient limiter variants used for MUSCL-style reconstructions.
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...
const libMesh::Elem * elem
Argument for requesting functor evaluation at a quadrature point location in an element.
const libMesh::Elem * elem
The element.
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.
const FaceInfo * fi
a face information object which defines our location in space
State argument for evaluating functors.
unsigned int state
The state.