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