Line data Source code
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 "MooseVariableDataLinearFV.h" 17 : #include "GradientLimiterType.h" 18 : 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" 25 : 26 : template <typename> 27 : class MooseLinearVariableFV; 28 : 29 : typedef MooseLinearVariableFV<Real> MooseLinearVariableFVReal; 30 : class AuxiliarySystem; 31 : class FVDirichletBCBase; 32 : class FVFluxBC; 33 : class LinearFVBoundaryCondition; 34 : class LinearSystem; 35 : 36 : namespace libMesh 37 : { 38 : template <typename> 39 : class NumericVector; 40 : } 41 : 42 : /// This class provides variable solution interface for linear 43 : /// finite volume problems. 44 : /// This class is designed to store gradient information when enabled. 45 : template <typename OutputType> 46 : class MooseLinearVariableFV : public MooseVariableField<OutputType> 47 : { 48 : public: 49 : using OutputGradient = typename MooseVariableField<OutputType>::OutputGradient; 50 : using OutputSecond = typename MooseVariableField<OutputType>::OutputSecond; 51 : using OutputDivergence = typename MooseVariableField<OutputType>::OutputDivergence; 52 : 53 : using FieldVariableValue = typename MooseVariableField<OutputType>::FieldVariableValue; 54 : using FieldVariableGradient = typename MooseVariableField<OutputType>::FieldVariableGradient; 55 : using FieldVariableSecond = typename MooseVariableField<OutputType>::FieldVariableSecond; 56 : using FieldVariableCurl = typename MooseVariableField<OutputType>::FieldVariableCurl; 57 : using FieldVariableDivergence = typename MooseVariableField<OutputType>::FieldVariableDivergence; 58 : 59 : using OutputShape = typename MooseVariableField<OutputType>::OutputShape; 60 : using OutputShapeGradient = typename MooseVariableField<OutputType>::OutputShapeGradient; 61 : using OutputShapeSecond = typename MooseVariableField<OutputType>::OutputShapeSecond; 62 : using OutputShapeDivergence = typename MooseVariableField<OutputType>::OutputShapeDivergence; 63 : 64 : using DofValue = typename MooseVariableField<OutputType>::DofValue; 65 : using DofValues = typename MooseVariableField<OutputType>::DofValues; 66 : using ADDofValue = typename MooseVariableField<OutputType>::ADDofValue; 67 : using ADDofValues = typename MooseVariableField<OutputType>::ADDofValues; 68 : 69 : using FieldVariablePhiValue = typename MooseVariableField<OutputType>::FieldVariablePhiValue; 70 : using FieldVariablePhiGradient = 71 : typename MooseVariableField<OutputType>::FieldVariablePhiGradient; 72 : using FieldVariablePhiSecond = typename MooseVariableField<OutputType>::FieldVariablePhiSecond; 73 : using FieldVariablePhiDivergence = 74 : typename MooseVariableField<OutputType>::FieldVariablePhiDivergence; 75 : using ElemQpArg = Moose::ElemQpArg; 76 : using ElemSideQpArg = Moose::ElemSideQpArg; 77 : using ElemArg = Moose::ElemArg; 78 : using FaceArg = Moose::FaceArg; 79 : using StateArg = Moose::StateArg; 80 : using NodeArg = Moose::NodeArg; 81 : using ElemPointArg = Moose::ElemPointArg; 82 : using typename MooseVariableField<OutputType>::ValueType; 83 : using typename MooseVariableField<OutputType>::DotType; 84 : using typename MooseVariableField<OutputType>::GradientType; 85 : 86 : static InputParameters validParams(); 87 : MooseLinearVariableFV(const InputParameters & parameters); 88 : 89 1105966 : virtual bool isFV() const override { return true; } 90 : 91 : /** 92 : * If the variable has a dirichlet boundary condition at face described by \p fi . 93 : */ 94 : virtual bool isDirichletBoundaryFace(const FaceInfo & fi) const; 95 : 96 : /** 97 : * Switch to request cell gradient computations. 98 : */ 99 1205 : void computeCellGradients() { _needs_cell_gradients = true; } 100 : 101 : /** 102 : * Switch to request cell gradient computations with an optional gradient limiter. 103 : * 104 : * `GradientLimiterType::None` is equivalent to requesting the regular gradients only. 105 : */ 106 : void computeCellGradients(const Moose::FV::GradientLimiterType limiter_type); 107 : 108 : /** 109 : * Switch to request limited cell gradient computations. 110 : * 111 : * Limited gradients are stored in limiter-specific containers on the system and are computed 112 : * using the raw cell gradients. 113 : */ 114 : void computeCellLimitedGradients(const Moose::FV::GradientLimiterType limiter_type); 115 : 116 : /** 117 : * Check if cell gradient computations were requested for this variable. 118 : */ 119 98448 : virtual bool needsGradientVectorStorage() const override { return _needs_cell_gradients; } 120 : 121 : virtual bool isExtrapolatedBoundaryFace(const FaceInfo & fi, 122 : const Elem * elem, 123 : const Moose::StateArg & state) const override; 124 : 125 : /** 126 : * Get the variable gradient at a cell center. 127 : * @param elem_info The ElemInfo of the cell where we need the gradient 128 : * @param state State argument describing which solution state to evaluate 129 : */ 130 : VectorValue<Real> gradSln(const ElemInfo & elem_info, const StateArg & state) const; 131 : 132 : /** 133 : * Get one raw gradient component at a cell center without materializing the full gradient. 134 : * @param elem_info The ElemInfo of the cell where we need the gradient 135 : * @param component The gradient component to retrieve 136 : */ 137 : Real gradSlnComponent(const ElemInfo & elem_info, unsigned int component) const; 138 : 139 : /** 140 : * Get either the raw or limited gradient at a cell center. 141 : * @param elem_info The ElemInfo of the cell where we need the gradient 142 : * @param state State argument describing which solution state to evaluate 143 : * @param limiter_type The limiter type used to compute/store limited gradients 144 : */ 145 : VectorValue<Real> gradSln(const ElemInfo & elem_info, 146 : const StateArg & state, 147 : const Moose::FV::GradientLimiterType limiter_type) const; 148 : 149 : /** 150 : * Get the limited gradient at a cell center. 151 : * @param elem_info The ElemInfo of the cell where we need the gradient 152 : * @param state State argument describing which solution state to evaluate 153 : * @param limiter_type The limiter type used to compute/store limited gradients 154 : */ 155 : VectorValue<Real> limitedGradSln(const ElemInfo & elem_info, 156 : const StateArg & state, 157 : const Moose::FV::GradientLimiterType limiter_type) const; 158 : 159 : /** 160 : * Compute interpolated gradient on the provided face. 161 : * @param fi The face for which to retrieve the gradient 162 : * @param state State argument describing which solution state to evaluate 163 : */ 164 : VectorValue<Real> gradSln(const FaceInfo & fi, const StateArg & state) const; 165 : 166 : /** 167 : * Compute interpolated raw/limited gradient on the provided face. 168 : * @param fi The face for which to retrieve the gradient 169 : * @param state State argument describing which solution state to evaluate 170 : * @param limiter_type The limiter type used to compute/store limited gradients 171 : */ 172 : VectorValue<Real> gradSln(const FaceInfo & fi, 173 : const StateArg & state, 174 : const Moose::FV::GradientLimiterType limiter_type) const; 175 : 176 : /** 177 : * Compute interpolated limited gradient on the provided face. 178 : * @param fi The face for which to retrieve the gradient 179 : * @param state State argument describing which solution state to evaluate 180 : * @param limiter_type The limiter type used to compute/store limited gradients 181 : */ 182 : VectorValue<Real> limitedGradSln(const FaceInfo & fi, 183 : const StateArg & state, 184 : const Moose::FV::GradientLimiterType limiter_type) const; 185 : 186 : virtual void initialSetup() override; 187 : virtual void timestepSetup() override; 188 : 189 : /** 190 : * Get the solution value for the provided element and seed the derivative for the corresponding 191 : * dof index 192 : * @param elem_info The element to retrieve the solution value for 193 : * @param state State argument which describes at what time / solution iteration state we want to 194 : * evaluate the variable 195 : */ 196 : Real getElemValue(const ElemInfo & elem_info, const StateArg & state) const; 197 : 198 : /** 199 : * Get the boundary condition object which corresponds to the given boundary ID 200 : * @param bd_id The boundary ID whose condition should be fetched 201 : */ 202 : LinearFVBoundaryCondition * getBoundaryCondition(const BoundaryID bd_id) const; 203 : 204 1157 : const std::unordered_map<BoundaryID, LinearFVBoundaryCondition *> & getBoundaryConditionMap() 205 : { 206 1157 : return _boundary_id_to_bc; 207 : } 208 : 209 : virtual void prepareIC() override; 210 : 211 3093 : virtual bool isNodal() const override final { return false; } 212 : 213 0 : virtual bool hasDoFsOnNodes() const override final { return false; } 214 : 215 0 : virtual bool isNodalDefined() const override final { return false; } 216 : 217 0 : virtual bool supportsFaceArg() const override final { return true; } 218 0 : virtual bool supportsElemSideQpArg() const override final { return false; } 219 : 220 : virtual const Elem * const & currentElem() const override; 221 : 222 0 : virtual bool computingSecond() const override final { return false; } 223 0 : virtual bool computingCurl() const override final { return false; } 224 0 : virtual bool computingDiv() const override final { return false; } 225 0 : virtual bool usesSecondPhiNeighbor() const override final { return false; } 226 : 227 : virtual void sizeMatrixTagData() override; 228 : 229 1805 : void requireQpComputations() const override { _compute_qp_data = true; } 230 230 : bool supportsQpBasedLoops() const override { return _compute_qp_data; } 231 226 : bool supportsGeometricInfoBasedLoops() const override { return true; } 232 : 233 : protected: 234 : /// Throw an error when somebody requests time-related data from this variable 235 : [[noreturn]] void timeIntegratorError() const; 236 : 237 : /// Throw and error when somebody requests lower-dimensional data from this variable 238 : [[noreturn]] void lowerDError() const; 239 : 240 : /// Throw an error when somebody wants to use this variable as a nodal variable 241 : [[noreturn]] void nodalError() const; 242 : 243 : /// Throw an error when somebody wants to use this variable with automatic differentiation 244 : [[noreturn]] void adError() const; 245 : 246 : /// Throw an error when somebody requests gradients at a non-current solution state 247 : [[noreturn]] void gradientStateError(const StateArg & state) const; 248 : 249 : /** 250 : * Setup the boundary to Dirichlet BC map 251 : */ 252 : void cacheBoundaryBCMap(); 253 : 254 : usingMooseVariableBaseMembers; 255 : 256 : /// Whether QP computation has been requested for this variable (opt-in) 257 : mutable bool _compute_qp_data = false; 258 : 259 : /// Boolean to check if this variable needs gradient computations. 260 : bool _needs_cell_gradients; 261 : 262 : /// Temporary storage for the cell gradient to avoid unnecessary allocations. 263 : mutable RealVectorValue _cell_gradient; 264 : 265 : /// Owning concrete system pointers. One will be null. 266 : LinearSystem * const _linear_system; 267 : AuxiliarySystem * const _auxiliary_system; 268 : 269 : /// Pointer to the unlimited cell gradient stored by the owning concrete system 270 : const std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> & _grad_container; 271 : 272 : /// Holder for all the data associated with the "main" element. The data in this is 273 : /// mainly used by finite element-based loops such as the postprocessor and auxkernel 274 : /// loops 275 : std::unique_ptr<MooseVariableDataLinearFV<OutputType>> _element_data; 276 : 277 : /// Holder for all the data associated with the "neighbor" element. The data in this is 278 : /// mainly used by finite element-based loops such as the postprocessor and auxkernel 279 : /// loops 280 : std::unique_ptr<MooseVariableDataLinearFV<OutputType>> _neighbor_data; 281 : 282 : /// Map for easily accessing the boundary conditions based on the boundary IDs. 283 : /// We assume that each boundary has one boundary condition only. 284 : std::unordered_map<BoundaryID, LinearFVBoundaryCondition *> _boundary_id_to_bc; 285 : 286 : /// Cache the number of the system this variable belongs to 287 : const unsigned int _sys_num; 288 : 289 : friend void Moose::initDofIndices<>(MooseLinearVariableFV<OutputType> &, const Elem &); 290 : 291 : private: 292 : using MooseVariableField<OutputType>::evaluate; 293 : using MooseVariableField<OutputType>::evaluateGradient; 294 : using MooseVariableField<OutputType>::evaluateDot; 295 : 296 : virtual ValueType evaluate(const ElemArg & elem, const StateArg &) const override final; 297 : virtual ValueType evaluate(const FaceArg & face, const StateArg &) const override final; 298 : virtual ValueType evaluate(const NodeArg & node, const StateArg &) const override final; 299 : virtual ValueType evaluate(const ElemPointArg & elem_point, 300 : const StateArg & state) const override final; 301 : virtual ValueType evaluate(const ElemQpArg & elem_qp, 302 : const StateArg & state) const override final; 303 : virtual ValueType evaluate(const ElemSideQpArg & elem_side_qp, 304 : const StateArg & state) const override final; 305 : virtual GradientType evaluateGradient(const ElemQpArg & qp_arg, 306 : const StateArg &) const override final; 307 : virtual GradientType evaluateGradient(const ElemArg & elem_arg, 308 : const StateArg &) const override final; 309 : virtual GradientType evaluateGradient(const FaceArg & face, 310 : const StateArg &) const override final; 311 : virtual DotType evaluateDot(const ElemArg & elem, const StateArg &) const override final; 312 : 313 : /// The current (ghosted) solution. Note that this needs to be stored as a reference to a pointer 314 : /// because the solution might not exist at the time that this variable is constructed, so we 315 : /// cannot safely dereference at that time 316 : const libMesh::NumericVector<libMesh::Number> * const & _solution; 317 : 318 : /// Shape functions, only used when we are postprocessing or using this variable 319 : /// in an auxiliary system 320 : const FieldVariablePhiValue & _phi; 321 : const FieldVariablePhiGradient & _grad_phi; 322 : const FieldVariablePhiValue & _phi_face; 323 : const FieldVariablePhiGradient & _grad_phi_face; 324 : const FieldVariablePhiValue & _phi_face_neighbor; 325 : const FieldVariablePhiGradient & _grad_phi_face_neighbor; 326 : const FieldVariablePhiValue & _phi_neighbor; 327 : const FieldVariablePhiGradient & _grad_phi_neighbor; 328 : 329 : public: 330 : // ********************************************************************************* 331 : // ********************************************************************************* 332 : // The following functions are separated here because they are not essential for the 333 : // solver but are necessary to interface with the auxiliary and postprocessor 334 : // systems. 335 : // ********************************************************************************* 336 : // ********************************************************************************* 337 : 338 : virtual void setDofValue(const DofValue & /*value*/, unsigned int /*index*/) override; 339 : 340 : virtual void getDofIndices(const Elem * elem, 341 : std::vector<dof_id_type> & dof_indices) const override; 342 : 343 : virtual void setDofValues(const DenseVector<DofValue> & values) override; 344 : 345 : virtual void clearDofIndices() override; 346 : 347 614 : virtual unsigned int numberOfDofs() const override final { return 1; } 348 0 : virtual unsigned int numberOfDofsNeighbor() override final { return 1; } 349 : 350 : virtual unsigned int oldestSolutionStateRequested() const override final; 351 : 352 : virtual void clearAllDofIndices() override final; 353 : 354 : [[noreturn]] virtual const std::vector<dof_id_type> & dofIndicesLower() const override final; 355 : [[noreturn]] virtual const FieldVariablePhiValue & phiLower() const override; 356 : 357 : // Overriding these to make sure nothing happens during residual/jacobian setup. 358 : // The only time this can actually happen is when residual setup is called on the auxiliary 359 : // system. 360 20 : virtual void residualSetup() override {} 361 329 : virtual void jacobianSetup() override {} 362 : 363 0 : virtual libMesh::FEContinuity getContinuity() const override 364 : { 365 0 : return _element_data->getContinuity(); 366 : }; 367 : 368 : virtual void setNodalValue(const OutputType & value, unsigned int idx = 0) override; 369 : 370 : [[noreturn]] virtual const DofValues & nodalVectorTagValue(TagID) const override; 371 : 372 : virtual const std::vector<dof_id_type> & dofIndices() const final; 373 : virtual const std::vector<dof_id_type> & dofIndicesNeighbor() const final; 374 : 375 625722 : virtual void prepare() override final {} 376 0 : virtual void prepareNeighbor() override final {} 377 0 : virtual void prepareAux() override final {} 378 0 : virtual void reinitNode() override final {} 379 0 : virtual void reinitNodes(const std::vector<dof_id_type> & /*nodes*/) override final {} 380 0 : virtual void reinitNodesNeighbor(const std::vector<dof_id_type> & /*nodes*/) override final {} 381 2089 : virtual void reinitAux() override final {} 382 0 : virtual void reinitAuxNeighbor() override final {} 383 0 : virtual void prepareLowerD() override final {} 384 : 385 : virtual void computeElemValuesFace() override; 386 : virtual void computeNeighborValuesFace() override; 387 : virtual void computeNeighborValues() override; 388 : virtual void computeLowerDValues() override final; 389 : 390 : virtual void computeNodalNeighborValues() override final; 391 : virtual void computeNodalValues() override final; 392 : 393 : virtual void computeElemValues() override; 394 0 : virtual void computeFaceValues(const FaceInfo & /*fi*/) override {} 395 : 396 : virtual void setLowerDofValues(const DenseVector<DofValue> & values) override; 397 : 398 : virtual void insert(libMesh::NumericVector<libMesh::Number> & vector) override; 399 : virtual void insertLower(libMesh::NumericVector<libMesh::Number> & vector) override; 400 : virtual void add(libMesh::NumericVector<libMesh::Number> & vector) override; 401 : 402 : virtual void setActiveTags(const std::set<TagID> & vtags) override; 403 : 404 : [[noreturn]] virtual const MooseArray<OutputType> & nodalValueArray() const override; 405 : [[noreturn]] virtual const MooseArray<OutputType> & nodalValueOldArray() const override; 406 : [[noreturn]] virtual const MooseArray<OutputType> & nodalValueOlderArray() const override; 407 : 408 232 : virtual const FieldVariablePhiValue & phi() const override final { return _phi; } 409 0 : virtual const FieldVariablePhiGradient & gradPhi() const override final { return _grad_phi; } 410 : [[noreturn]] virtual const FieldVariablePhiSecond & secondPhi() const override final; 411 : [[noreturn]] const FieldVariablePhiValue & curlPhi() const override final; 412 : [[noreturn]] const FieldVariablePhiDivergence & divPhi() const override final; 413 : 414 0 : virtual const FieldVariablePhiValue & phiFace() const override final { return _phi_face; } 415 0 : virtual const FieldVariablePhiGradient & gradPhiFace() const override final 416 : { 417 0 : return _grad_phi_face; 418 : } 419 : [[noreturn]] virtual const FieldVariablePhiSecond & secondPhiFace() const override final; 420 : 421 0 : virtual const FieldVariablePhiValue & phiFaceNeighbor() const override final 422 : { 423 0 : return _phi_face_neighbor; 424 : } 425 0 : virtual const FieldVariablePhiGradient & gradPhiFaceNeighbor() const override final 426 : { 427 0 : return _grad_phi_face_neighbor; 428 : } 429 : [[noreturn]] virtual const FieldVariablePhiSecond & secondPhiFaceNeighbor() const override final; 430 : 431 0 : virtual const FieldVariablePhiValue & phiNeighbor() const override final { return _phi_neighbor; } 432 0 : virtual const FieldVariablePhiGradient & gradPhiNeighbor() const override final 433 : { 434 0 : return _grad_phi_neighbor; 435 : } 436 : [[noreturn]] virtual const FieldVariablePhiSecond & secondPhiNeighbor() const override final; 437 : 438 : virtual const FieldVariableValue & vectorTagValue(TagID tag) const override; 439 : virtual const DofValues & vectorTagDofValue(TagID tag) const override; 440 : [[noreturn]] virtual const DofValues & nodalMatrixTagValue(TagID tag) const override; 441 : virtual const FieldVariableValue & matrixTagValue(TagID tag) const override; 442 : 443 : virtual const FieldVariableValue & sln() const override; 444 : virtual const FieldVariableValue & slnOld() const override; 445 : virtual const FieldVariableValue & slnOlder() const override; 446 : virtual const FieldVariableGradient & gradSln() const override; 447 : virtual const FieldVariableGradient & gradSlnOld() const override; 448 : virtual const FieldVariableValue & slnNeighbor() const override; 449 : virtual const FieldVariableValue & slnOldNeighbor() const override; 450 : virtual const FieldVariableGradient & gradSlnNeighbor() const override; 451 : virtual const FieldVariableGradient & gradSlnOldNeighbor() const override; 452 : 453 : [[noreturn]] virtual const ADTemplateVariableSecond<OutputType> & adSecondSln() const override; 454 : [[noreturn]] virtual const ADTemplateVariableValue<OutputType> & adUDot() const override; 455 : [[noreturn]] virtual const ADTemplateVariableValue<OutputType> & adUDotDot() const override; 456 : [[noreturn]] virtual const ADTemplateVariableGradient<OutputType> & adGradSlnDot() const override; 457 : [[noreturn]] virtual const ADTemplateVariableValue<OutputType> & adSlnNeighbor() const override; 458 : [[noreturn]] virtual const ADTemplateVariableGradient<OutputType> & 459 : adGradSlnNeighbor() const override; 460 : [[noreturn]] virtual const ADTemplateVariableSecond<OutputType> & 461 : adSecondSlnNeighbor() const override; 462 : [[noreturn]] virtual const ADTemplateVariableValue<OutputType> & adUDotNeighbor() const override; 463 : [[noreturn]] virtual const ADTemplateVariableValue<OutputType> & 464 : adUDotDotNeighbor() const override; 465 : [[noreturn]] virtual const ADTemplateVariableGradient<OutputType> & 466 : adGradSlnNeighborDot() const override; 467 : [[noreturn]] virtual const ADTemplateVariableValue<OutputType> & adSln() const override; 468 : [[noreturn]] virtual const ADTemplateVariableGradient<OutputType> & adGradSln() const override; 469 : [[noreturn]] virtual const ADTemplateVariableCurl<OutputType> & adCurlSln() const override; 470 : [[noreturn]] virtual const ADTemplateVariableCurl<OutputType> & 471 : adCurlSlnNeighbor() const override; 472 : 473 : virtual const DofValues & dofValues() const override; 474 : virtual const DofValues & dofValuesOld() const override; 475 : 476 : virtual const DofValues & dofValuesOlder() const override; 477 : virtual const DofValues & dofValuesPreviousNL() const override; 478 : virtual const DofValues & dofValuesNeighbor() const override; 479 : virtual const DofValues & dofValuesOldNeighbor() const override; 480 : virtual const DofValues & dofValuesOlderNeighbor() const override; 481 : virtual const DofValues & dofValuesPreviousNLNeighbor() const override; 482 : [[noreturn]] virtual const DofValues & dofValuesDot() const override; 483 : [[noreturn]] virtual const DofValues & dofValuesDotNeighbor() const override; 484 : [[noreturn]] virtual const DofValues & dofValuesDotOld() const override; 485 : [[noreturn]] virtual const DofValues & dofValuesDotOldNeighbor() const override; 486 : [[noreturn]] virtual const DofValues & dofValuesDotDot() const override; 487 : [[noreturn]] virtual const DofValues & dofValuesDotDotNeighbor() const override; 488 : [[noreturn]] virtual const DofValues & dofValuesDotDotOld() const override; 489 : [[noreturn]] virtual const DofValues & dofValuesDotDotOldNeighbor() const override; 490 : [[noreturn]] virtual const MooseArray<libMesh::Number> & dofValuesDuDotDu() const override; 491 : [[noreturn]] virtual const MooseArray<libMesh::Number> & 492 : dofValuesDuDotDuNeighbor() const override; 493 : [[noreturn]] virtual const MooseArray<libMesh::Number> & dofValuesDuDotDotDu() const override; 494 : [[noreturn]] virtual const MooseArray<libMesh::Number> & 495 : dofValuesDuDotDotDuNeighbor() const override; 496 : 497 : [[noreturn]] virtual const ADDofValues & adDofValues() const override; 498 : [[noreturn]] virtual const ADDofValues & adDofValuesNeighbor() const override; 499 : [[noreturn]] virtual const ADDofValues & adDofValuesDot() const override; 500 : [[noreturn]] virtual const dof_id_type & nodalDofIndex() const override final; 501 : [[noreturn]] virtual const dof_id_type & nodalDofIndexNeighbor() const override final; 502 : 503 0 : virtual std::size_t phiSize() const override final { return _phi.size(); } 504 0 : virtual std::size_t phiFaceSize() const override final { return _phi_face.size(); } 505 0 : virtual std::size_t phiNeighborSize() const override final { return _phi_neighbor.size(); } 506 0 : virtual std::size_t phiFaceNeighborSize() const override final 507 : { 508 0 : return _phi_face_neighbor.size(); 509 : } 510 : [[noreturn]] virtual std::size_t phiLowerSize() const override final; 511 : }; 512 : 513 : template <typename OutputType> 514 : typename MooseLinearVariableFV<OutputType>::ValueType 515 7015 : MooseLinearVariableFV<OutputType>::evaluate(const ElemArg & elem_arg, const StateArg & state) const 516 : { 517 7015 : const auto & elem_info = this->_mesh.elemInfo(elem_arg.elem->id()); 518 7015 : return getElemValue(elem_info, state); 519 : } 520 : 521 : template <typename OutputType> 522 : typename MooseLinearVariableFV<OutputType>::ValueType 523 0 : MooseLinearVariableFV<OutputType>::evaluate(const ElemPointArg & elem_point, 524 : const StateArg & state) const 525 : { 526 0 : const auto & elem_info = this->_mesh.elemInfo(elem_point.elem->id()); 527 0 : return getElemValue(elem_info, state); 528 : } 529 : 530 : template <typename OutputType> 531 : typename MooseLinearVariableFV<OutputType>::ValueType 532 122718 : MooseLinearVariableFV<OutputType>::evaluate(const ElemQpArg & elem_qp, const StateArg & state) const 533 : { 534 122718 : const auto & elem_info = this->_mesh.elemInfo(elem_qp.elem->id()); 535 122718 : return getElemValue(elem_info, state); 536 : } 537 : 538 : template <typename OutputType> 539 : typename MooseLinearVariableFV<OutputType>::ValueType 540 0 : MooseLinearVariableFV<OutputType>::evaluate(const ElemSideQpArg & elem_side_qp, 541 : const StateArg & state) const 542 : { 543 0 : return (*this)(ElemPointArg{elem_side_qp.elem, elem_side_qp.point, false}, state); 544 : } 545 : 546 : template <typename OutputType> 547 : typename MooseLinearVariableFV<OutputType>::GradientType 548 1400 : MooseLinearVariableFV<OutputType>::evaluateGradient(const ElemQpArg & qp_arg, 549 : const StateArg & state) const 550 : { 551 1400 : const auto & elem_info = this->_mesh.elemInfo(qp_arg.elem->id()); 552 1400 : return gradSln(elem_info, state); 553 : } 554 : 555 : template <typename OutputType> 556 : typename MooseLinearVariableFV<OutputType>::GradientType 557 0 : MooseLinearVariableFV<OutputType>::evaluateGradient(const ElemArg & elem_arg, 558 : const StateArg & state) const 559 : { 560 0 : const auto & elem_info = this->_mesh.elemInfo(elem_arg.elem->id()); 561 0 : return gradSln(elem_info, state); 562 : } 563 : 564 : template <typename OutputType> 565 : typename MooseLinearVariableFV<OutputType>::GradientType 566 140 : MooseLinearVariableFV<OutputType>::evaluateGradient(const FaceArg & face, 567 : const StateArg & state) const 568 : { 569 : mooseAssert(face.fi, "We must have a non-null face information"); 570 140 : return gradSln(*face.fi, state); 571 : } 572 : 573 : template <typename OutputType> 574 : void 575 0 : MooseLinearVariableFV<OutputType>::timeIntegratorError() const 576 : { 577 0 : mooseError("MooseLinearVariableFV does not support time integration at the moment! The variable " 578 : "which is causing the issue: ", 579 0 : this->name()); 580 : } 581 : 582 : template <typename OutputType> 583 : void 584 0 : MooseLinearVariableFV<OutputType>::gradientStateError(const StateArg & state) const 585 : { 586 0 : mooseError("MooseLinearVariableFV does not currently support ElemInfo/FaceInfo gradient " 587 : "evaluation for non-current states. Requested state index ", 588 0 : state.state, 589 : " for variable '", 590 0 : this->name(), 591 : "'. Old-state requests typically use state index 1."); 592 : } 593 : 594 : template <typename OutputType> 595 : void 596 0 : MooseLinearVariableFV<OutputType>::lowerDError() const 597 : { 598 0 : mooseError("Lower dimensional element support not implemented for finite volume variables!The " 599 : "variable which is causing the issue: ", 600 0 : this->name()); 601 : } 602 : 603 : template <typename OutputType> 604 : void 605 0 : MooseLinearVariableFV<OutputType>::nodalError() const 606 : { 607 0 : mooseError("FV variables don't support nodal variable treatment! The variable which is causing " 608 : "the issue: ", 609 0 : this->name()); 610 : } 611 : 612 : template <typename OutputType> 613 : void 614 0 : MooseLinearVariableFV<OutputType>::adError() const 615 : { 616 0 : mooseError("Linear FV variable does not support automatic differentiation, the variable which is " 617 : "attempting it is: ", 618 0 : this->name()); 619 : } 620 : 621 : // Declare all the specializations, as the template specialization declarations below must know 622 : template <> 623 : ADReal MooseLinearVariableFV<Real>::evaluateDot(const ElemArg & elem, const StateArg & state) const; 624 : 625 : // Prevent implicit instantiation in other translation units where these classes are used 626 : extern template class MooseLinearVariableFV<Real>;