https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KokkosVariableValue.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "KokkosDatum.h"
13
14#include "MooseError.h"
16#include "SystemBase.h"
17
18namespace Moose::Kokkos
19{
20
21inline void
22checkVariable(const Variable & var, bool expect_vector, const std::string & wrapper_name)
23{
24 if (!var.initialized())
25 mooseError("Attempted to construct Kokkos ", wrapper_name, " with an uninitialized variable.");
26
27 if (var.vector() != expect_vector)
28 mooseError("Kokkos ",
29 wrapper_name,
30 " cannot be constructed with ",
31 var.vector() ? "vector" : "scalar",
32 " variables.");
33}
34
39template <bool is_test>
41{
42public:
50 KOKKOS_FUNCTION Real operator()(AssemblyDatum & datum, unsigned int i, unsigned int qp) const
51 {
52 auto & elem = datum.elem();
53 auto side = datum.side();
54 auto fe = is_test ? datum.ife() : datum.jfe();
55
56 return side == libMesh::invalid_uint
57 ? datum.assembly().getPhi(elem.subdomain, elem.type, fe)(i, qp)
58 : datum.assembly().getPhiFace(elem.subdomain, elem.type, fe)(side)(i, qp);
59 }
60};
61
62template <bool is_test>
64{
65public:
73 KOKKOS_FUNCTION const Real3 &
74 reference(AssemblyDatum & datum, unsigned int i, unsigned int qp) const;
75
83 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum, unsigned int i, unsigned int qp) const
84 {
85 return datum.J(qp) * reference(datum, i, qp);
86 }
87};
88
89template <bool is_test>
90KOKKOS_FUNCTION const Real3 &
92 unsigned int i,
93 unsigned int qp) const
94{
95 auto & elem = datum.elem();
96 auto side = datum.side();
97 auto fe = is_test ? datum.ife() : datum.jfe();
98
99 return side == libMesh::invalid_uint
100 ? datum.assembly().getGradPhi(elem.subdomain, elem.type, fe)(i, qp)
101 : datum.assembly().getGradPhiFace(elem.subdomain, elem.type, fe)(side)(i, qp);
102}
103
112
113template <bool is_test>
115{
116public:
124 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum, unsigned int i, unsigned int qp) const
125 {
126 auto & elem = datum.elem();
127 auto side = datum.side();
128 auto fe = is_test ? datum.ife() : datum.jfe();
129
130 return side == libMesh::invalid_uint
131 ? datum.assembly().getVectorPhi(elem.subdomain, elem.type, fe)(i, qp)
132 : datum.assembly().getVectorPhiFace(elem.subdomain, elem.type, fe)(side)(i, qp);
133 }
134};
135
136template <bool is_test>
138{
139public:
147 KOKKOS_FUNCTION const Real33 &
148 reference(AssemblyDatum & datum, unsigned int i, unsigned int qp) const;
149
157 KOKKOS_FUNCTION Real33 operator()(AssemblyDatum & datum, unsigned int i, unsigned int qp) const
158 {
159 return reference(datum, i, qp) * datum.J(qp).transpose();
160 }
161};
162
163template <bool is_test>
164KOKKOS_FUNCTION const Real33 &
166 unsigned int i,
167 unsigned int qp) const
168{
169 auto & elem = datum.elem();
170 auto side = datum.side();
171 auto fe = is_test ? datum.ife() : datum.jfe();
172
173 return side == libMesh::invalid_uint
174 ? datum.assembly().getVectorGradPhi(elem.subdomain, elem.type, fe)(i, qp)
175 : datum.assembly().getVectorGradPhiFace(elem.subdomain, elem.type, fe)(side)(i, qp);
176}
177
178template <bool is_test>
180{
181public:
189 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum, unsigned int i, unsigned int qp) const
190 {
191 auto & elem = datum.elem();
192 auto side = datum.side();
193 auto fe = is_test ? datum.ife() : datum.jfe();
194
195 auto grad =
197 ? datum.assembly().getVectorGradPhi(elem.subdomain, elem.type, fe)(i, qp)
198 : datum.assembly().getVectorGradPhiFace(elem.subdomain, elem.type, fe)(side)(i, qp);
199
200 return curlFromVectorGradient(grad * datum.J(qp).transpose(), datum.assembly().getDimension());
201 }
202};
203
211
216template <bool is_ad>
218{
219 using real_type = std::conditional_t<is_ad, ADReal, Real>;
220
221public:
231 VariableValueTempl(Variable var, bool dof = false) : _var(var), _dof(dof || _var.scalar())
232 {
233 checkVariable(_var, false, is_ad ? "ADVariableValue" : "VariableValue");
234 }
242 const TagName & tag = Moose::SOLUTION_TAG,
243 bool dof = false)
244 : _var(var, tag), _dof(dof || _var.scalar())
245 {
246 checkVariable(_var, false, is_ad ? "ADVariableValue" : "VariableValue");
247 }
255 VariableValueTempl(const std::vector<const MooseVariableFieldBase *> & vars,
256 const TagName & tag = Moose::SOLUTION_TAG,
257 bool dof = false)
258 : _var(vars, tag), _dof(dof)
259 {
260 checkVariable(_var, false, is_ad ? "ADVariableValue" : "VariableValue");
261 }
262 VariableValueTempl(const std::vector<MooseVariableFieldBase *> & vars,
263 const TagName & tag = Moose::SOLUTION_TAG,
264 bool dof = false)
265 : _var(vars, tag), _dof(dof)
266 {
267 checkVariable(_var, false, is_ad ? "ADVariableValue" : "VariableValue");
268 }
270
279
284 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
285
293 KOKKOS_FUNCTION auto operator()(Datum & datum, unsigned int idx, unsigned int comp = 0) const
294 {
295 return get(datum, idx, comp);
296 }
297
306 KOKKOS_FUNCTION auto operator()(AssemblyDatum & datum, unsigned int idx, unsigned int comp) const;
307 KOKKOS_FUNCTION auto operator()(AssemblyDatum & datum, unsigned int idx) const
308 {
309 return this->operator()(datum, idx, _var.components() > 1 ? datum.comp() : 0);
310 }
312
317 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
318
319private:
328 KOKKOS_FUNCTION auto
329 get(Datum & datum, unsigned int idx, unsigned int comp = 0, Real seed = 0) const;
330
342 bool _dof = false;
343};
344
345template <bool is_ad>
347 : _var(object._var), _seed(object._seed), _dof(object._dof)
348{
349 if constexpr (is_ad)
350 if (_var.coupled())
351 {
352 if (!_seed.isAlloc())
354
355 for (unsigned int comp = 0; comp < _var.components(); ++comp)
356 _seed[comp] =
357 _var.dot() ? _var.mooseVar(comp)->sys().duDotDu(_var.var(comp)) : (_var.old() ? 0 : 1);
358
360 }
361}
362
363template <bool is_ad>
366{
367 _var = object._var;
368 _dof = object._dof;
369
370 return *this;
371}
372
373template <bool is_ad>
374KOKKOS_FUNCTION auto
376 unsigned int idx,
377 unsigned int comp) const
378{
379 if constexpr (is_ad)
380 {
381 Real seed =
382 datum.do_derivatives() && _var.coupled() && _var.sys(comp) == datum.sys() ? _seed[comp] : 0;
383
384 return get(datum, idx, comp, seed);
385 }
386 else
387 return get(datum, idx, comp);
388}
389
390template <bool is_ad>
391KOKKOS_FUNCTION auto
393 unsigned int idx,
394 unsigned int comp,
395 [[maybe_unused]] Real seed) const
396{
397 KOKKOS_ASSERT(_var.initialized());
398
399 real_type value;
400
401 if (_var.coupled())
402 {
403 KOKKOS_ASSERT(comp < _var.components());
404
405 auto & sys = datum.system(_var.sys(comp));
406 auto var = _var.var(comp);
407 auto tag = _var.tag();
408
409 if (_dof)
410 {
411 unsigned int dof;
412
413 if (_var.scalar())
414 dof = sys.getScalarLocalDofIndex(idx, var);
415 else if (datum.isNodal())
416 {
417 auto node = datum.node();
418 dof = sys.getNodeLocalDofIndex(node, 0, var);
419 }
420 else
421 {
422 auto elem = datum.elem().id;
423 dof = sys.getElemLocalDofIndex(elem, idx, var);
424 }
425
426 if constexpr (is_ad)
427 value = sys.getVectorDofADValue(dof, tag, seed);
428 else
429 value = sys.getVectorDofValue(dof, tag);
430 }
431 else
432 {
433 auto & elem = datum.elem();
434 auto side = datum.side();
435
436 if constexpr (is_ad)
437 value = side == libMesh::invalid_uint
438 ? sys.getVectorQpADValue(elem, datum.qpOffset(), idx, var, tag, seed)
439 : sys.getVectorQpADValueFace(elem, side, idx, var, tag, seed);
440 else
441 value = side == libMesh::invalid_uint
442 ? sys.getVectorQpValue(elem, datum.qpOffset() + idx, var, tag)
443 : sys.getVectorQpValueFace(elem, side, idx, var, tag);
444 }
445 }
446 else
447 value = _var.value(_var.scalar() ? idx : comp);
448
449 return value;
450}
451
452template <bool is_ad>
454{
455 using real3_type = std::conditional_t<is_ad, ADReal3, Real3>;
456
457public:
467 {
468 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
469 }
476 const TagName & tag = Moose::SOLUTION_TAG)
477 : _var(var, tag)
478 {
479 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
480 }
487 VariableGradientTempl(const std::vector<const MooseVariableFieldBase *> & vars,
488 const TagName & tag = Moose::SOLUTION_TAG)
489 : _var(vars, tag)
490 {
491 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
492 }
493 VariableGradientTempl(const std::vector<MooseVariableFieldBase *> & vars,
494 const TagName & tag = Moose::SOLUTION_TAG)
495 : _var(vars, tag)
496 {
497 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
498 }
500
509
514 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
515
523 KOKKOS_FUNCTION auto operator()(Datum & datum, unsigned int qp, unsigned int comp = 0) const
524 {
525 return get(datum, qp, comp);
526 }
527
536 KOKKOS_FUNCTION auto operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const;
537 KOKKOS_FUNCTION auto operator()(AssemblyDatum & datum, unsigned int qp) const
538 {
539 return this->operator()(datum, qp, _var.components() > 1 ? datum.comp() : 0);
540 }
542
547 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
548
549private:
558 KOKKOS_FUNCTION auto
559 get(Datum & datum, unsigned int qp, unsigned int comp = 0, Real seed = 0) const;
560
569};
570
571template <bool is_ad>
573 : _var(object._var), _seed(object._seed)
574{
575 if constexpr (is_ad)
576 if (_var.coupled())
577 {
578 if (!_seed.isAlloc())
580
581 for (unsigned int comp = 0; comp < _var.components(); ++comp)
582 _seed[comp] =
583 _var.dot() ? _var.mooseVar(comp)->sys().duDotDu(_var.var(comp)) : (_var.old() ? 0 : 1);
584
586 }
587}
588
589template <bool is_ad>
592{
593 _var = object._var;
594
595 return *this;
596}
597
598template <bool is_ad>
599KOKKOS_FUNCTION auto
601 unsigned int qp,
602 unsigned int comp) const
603{
604 if constexpr (is_ad)
605 {
606 Real seed =
607 datum.do_derivatives() && _var.coupled() && _var.sys(comp) == datum.sys() ? _seed[comp] : 0;
608
609 return get(datum, qp, comp, seed);
610 }
611 else
612 return get(datum, qp, comp);
613}
614
615template <bool is_ad>
616KOKKOS_FUNCTION auto
618 unsigned int qp,
619 unsigned int comp,
620 [[maybe_unused]] Real seed) const
621{
622 KOKKOS_ASSERT(_var.initialized());
623
624 real3_type grad;
625
626 if (_var.coupled())
627 {
628 KOKKOS_ASSERT(!datum.isNodal());
629
630 auto & elem = datum.elem();
631 auto side = datum.side();
632
633 KOKKOS_ASSERT(comp < _var.components());
634
635 if constexpr (is_ad)
636 grad =
638 ? datum.system(_var.sys(comp))
639 .getVectorQpADGrad(
640 elem, datum.J(qp), datum.qpOffset(), qp, _var.var(comp), _var.tag(), seed)
641 : datum.system(_var.sys(comp))
643 elem, side, datum.J(qp), qp, _var.var(comp), _var.tag(), seed);
644 else
645 grad =
647 ? datum.system(_var.sys(comp))
648 .getVectorQpGrad(elem, datum.qpOffset() + qp, _var.var(comp), _var.tag())
649 : datum.system(_var.sys(comp))
650 .getVectorQpGradFace(elem, side, datum.J(qp), qp, _var.var(comp), _var.tag());
651 }
652
653 return grad;
654}
655
662
664{
665public:
675 VectorVariableValue(Variable var, bool dof = false) : _var(var), _dof(dof)
676 {
677 checkVariable(_var, true, "VectorVariableValue");
678 }
686 const TagName & tag = Moose::SOLUTION_TAG,
687 bool dof = false)
688 : _var(var, tag), _dof(dof)
689 {
690 checkVariable(_var, true, "VectorVariableValue");
691 }
692
697 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
698
705 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
706 unsigned int idx,
707 unsigned int comp = 0) const;
708
713 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
714
715private:
723 bool _dof = false;
724};
725
727{
728public:
738 {
739 checkVariable(_var, true, "VectorVariableGradient");
740 }
747 const TagName & tag = Moose::SOLUTION_TAG)
748 : _var(var, tag)
749 {
750 checkVariable(_var, true, "VectorVariableGradient");
751 }
752
757 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
758
765 KOKKOS_FUNCTION Real33 operator()(AssemblyDatum & datum,
766 unsigned int qp,
767 unsigned int comp = 0) const;
768
773 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
774
775private:
780};
781
783{
784public:
793 VectorVariableCurl(Variable var) : _var(var) { checkVariable(_var, true, "VectorVariableCurl"); }
800 : _var(var, tag)
801 {
802 checkVariable(_var, true, "VectorVariableCurl");
803 }
804
809 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
810
817 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
818 unsigned int qp,
819 unsigned int comp = 0) const;
820
825 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
826
827private:
832};
833
834KOKKOS_FUNCTION inline Real3
835VectorVariableValue::operator()(AssemblyDatum & datum, unsigned int idx, unsigned int comp) const
836{
837 KOKKOS_ASSERT(_var.initialized());
838
839 Real3 value = 0;
840
841 if (_var.coupled())
842 {
843 auto & sys = datum.system(_var.sys(comp));
844 auto var = _var.var(comp);
845 auto tag = _var.tag();
846
847 if (_dof)
848 {
849 auto dimension = datum.assembly().getDimension();
850
851 if (datum.isNodal())
852 {
853 auto node = datum.node();
854
855 for (unsigned int c = 0; c < dimension; ++c)
856 value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
857 }
858 else
859 {
860 auto elem = datum.elem().id;
861 auto offset = idx * dimension;
862
863 for (unsigned int c = 0; c < dimension; ++c)
864 value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
865 }
866 }
867 else
868 {
869 KOKKOS_ASSERT(!datum.isNodal());
870
871 auto & elem = datum.elem();
872 auto side = datum.side();
873
874 if (side == libMesh::invalid_uint)
875 value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
876 else
877 value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
878 }
879 }
880 else
881 value = _var.vectorValue(comp);
882
883 return value;
884}
885
886KOKKOS_FUNCTION inline Real33
887VectorVariableGradient::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
888{
889 KOKKOS_ASSERT(_var.initialized());
890
891 Real33 grad = 0;
892
893 if (_var.coupled())
894 {
895 KOKKOS_ASSERT(!datum.isNodal());
896
897 auto & elem = datum.elem();
898 auto side = datum.side();
899 auto & sys = datum.system(_var.sys(comp));
900 auto var = _var.var(comp);
901 auto tag = _var.tag();
902
903 if (side == libMesh::invalid_uint)
904 grad = sys.getVectorQpVectorGrad(elem, datum.qpOffset() + qp, var, tag);
905 else
906 grad = sys.getVectorQpVectorGradFace(elem, side, datum.J(qp), qp, var, tag);
907 }
908
909 return grad;
910}
911
912KOKKOS_FUNCTION inline Real3
913VectorVariableCurl::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
914{
915 KOKKOS_ASSERT(_var.initialized());
916
917 Real3 curl = 0;
918
919 if (_var.coupled())
920 {
921 KOKKOS_ASSERT(!datum.isNodal());
922
923 auto & elem = datum.elem();
924 auto side = datum.side();
925 auto & sys = datum.system(_var.sys(comp));
926 auto var = _var.var(comp);
927 auto tag = _var.tag();
928
929 if (side == libMesh::invalid_uint)
930 curl = sys.getVectorQpVectorCurl(elem, datum.qpOffset() + qp, var, tag);
931 else
932 {
933 auto fe = sys.getFETypeID(var);
934 auto n_dofs = datum.assembly().getNumDofs(elem.type, fe);
935 auto & grad_phi = datum.assembly().getVectorGradPhiFace(elem.subdomain, elem.type, fe)(side);
936 auto jacobian = datum.J(qp);
937 auto jacobian_transpose = jacobian.transpose();
938 Real33 grad = 0;
939
940 for (unsigned int i = 0; i < n_dofs; ++i)
941 grad += sys.getVectorDofValue(sys.getElemLocalDofIndex(elem.id, i, var), tag) *
942 (grad_phi(i, qp) * jacobian_transpose);
943
944 curl = curlFromVectorGradient(grad, datum.assembly().getDimension());
945 }
946 }
947
948 return curl;
949}
950
951template <>
953{
954 static constexpr bool value = true;
955};
956
957template <>
959{
960 static constexpr bool value = true;
961};
963
964} // namespace Moose::Kokkos
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
char ** vars
Base variable class.
SystemBase & sys()
Get the system this variable is part of.
This class provides an interface for common operations on field variables of both FE and FV types wit...
void copyToDevice()
Copy data from host to device.
KOKKOS_FUNCTION bool isAlloc() const
Get whether the array was allocated either on host or device.
void create(const std::vector< index_type > &n)
Allocate array on host and device.
The Kokkos array class.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels.
KOKKOS_FUNCTION unsigned int sys() const
Get the system number of variable.
KOKKOS_FUNCTION unsigned int jfe() const
Get the coupled variable FE type ID.
KOKKOS_FUNCTION void do_derivatives(const bool flag)
Set whether to compute derivatives for automatic differentiation (AD)
KOKKOS_FUNCTION unsigned int ife() const
Get the variable FE type ID.
KOKKOS_FUNCTION unsigned int comp() const
Get the variable component.
KOKKOS_FUNCTION const auto & getVectorPhiFace(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the face vector shape functions of a FE type for an element type and subdomain.
KOKKOS_FUNCTION const auto & getPhiFace(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the face shape functions of a FE type for an element type and subdomain.
KOKKOS_FUNCTION unsigned int getNumDofs(unsigned int elem_type, unsigned int fe_type) const
Get the number of DOFs of a FE type for an element type.
KOKKOS_FUNCTION const auto & getGradPhi(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the gradient of shape functions of a FE type for an element type and subdomain.
KOKKOS_FUNCTION const auto & getGradPhiFace(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the gradient of face shape functions of a FE type for an element type and subdomain.
KOKKOS_FUNCTION const auto & getVectorGradPhi(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the gradient of vector shape functions of a FE type for an element type and subdomain.
KOKKOS_FUNCTION unsigned int getDimension() const
Get the mesh dimension.
KOKKOS_FUNCTION const auto & getVectorPhi(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the vector shape functions of a FE type for an element type and subdomain.
KOKKOS_FUNCTION const auto & getVectorGradPhiFace(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the gradient of face vector shape functions of a FE type for an element type and subdomain.
KOKKOS_FUNCTION const auto & getPhi(ContiguousSubdomainID subdomain, unsigned int elem_type, unsigned int fe_type) const
Get the shape functions of a FE type for an element type and subdomain.
The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object.
KOKKOS_FUNCTION const FESystem & system(unsigned int sys) const
Get the Kokkos system.
KOKKOS_FUNCTION const Real33 & J(const unsigned int qp)
Get the inverse of Jacobian matrix | dxi/dx deta/dx dzeta/dx | | dxi/dy deta/dy dzeta/dy | | dxi/dz d...
KOKKOS_FUNCTION ContiguousNodeID node() const
Get the contiguous node ID.
KOKKOS_FUNCTION dof_id_type qpOffset() const
Get the starting offset into the global quadrature point index.
KOKKOS_FUNCTION const Assembly & assembly() const
Get the Kokkos assembly.
KOKKOS_FUNCTION bool isNodal() const
Get whether the current datum is on a node.
KOKKOS_FUNCTION Real3 getVectorQpGradFace(const ElementInfo info, const unsigned int side, const Real33 jacobian, const unsigned int qp, const unsigned int var, const TagID tag) const
Get the face quadrature point gradient of a variable from a tagged vector.
KOKKOS_FUNCTION ADReal3 getVectorQpADGradFace(const ElementInfo info, const unsigned int side, const Real33 jacobian, const unsigned int qp, const unsigned int var, const TagID tag, const Real seed) const
Get the face quadrature point gradient of a variable from a tagged vector for automatic differentiati...
KOKKOS_FUNCTION Real3 & getVectorQpGrad(const ElementInfo info, const dof_id_type qp, const unsigned int var, const TagID tag) const
Get the quadrature point gradient of a variable from a tagged vector.
KOKKOS_FUNCTION unsigned int side() const
Get the side index.
Definition KokkosDatum.h:79
KOKKOS_FUNCTION const ElementInfo & elem() const
Get the element information object.
Definition KokkosDatum.h:46
KOKKOS_FUNCTION dof_id_type getScalarLocalDofIndex(unsigned int i, unsigned int var) const
Get the local DOF index of a scalar variable.
VariableGradientTempl(const std::vector< MooseVariableFieldBase * > &vars, const TagName &tag=Moose::SOLUTION_TAG)
VariableGradientTempl()=default
Default constructor.
KOKKOS_FUNCTION auto operator()(Datum &datum, unsigned int qp, unsigned int comp=0) const
Get the current variable gradient.
VariableGradientTempl(const std::vector< const MooseVariableFieldBase * > &vars, const TagName &tag=Moose::SOLUTION_TAG)
Constructor.
Array< Real > _seed
Derivative seed of each component for AD.
VariableGradientTempl(const MooseVariableFieldBase &var, const TagName &tag=Moose::SOLUTION_TAG)
Constructor.
KOKKOS_FUNCTION auto get(Datum &datum, unsigned int qp, unsigned int comp=0, Real seed=0) const
Get the current variable gradient.
KOKKOS_FUNCTION const Variable & variable() const
Get the Kokkos variable.
KOKKOS_FUNCTION auto operator()(AssemblyDatum &datum, unsigned int qp) const
VariableGradientTempl< is_ad > & operator=(const VariableGradientTempl< is_ad > &object)
Copy assignment operator.
Variable _var
Coupled Kokkos variable.
VariableGradientTempl(Variable var)
Constructor.
std::conditional_t< is_ad, ADReal3, Real3 > real3_type
KOKKOS_FUNCTION const Real3 & reference(AssemblyDatum &datum, unsigned int i, unsigned int qp) const
Get the gradient of the current shape function in reference space.
KOKKOS_FUNCTION Real3 operator()(AssemblyDatum &datum, unsigned int i, unsigned int qp) const
Get the gradient of the current shape function.
The Kokkos wrapper classes for MOOSE-like shape function access.
KOKKOS_FUNCTION Real operator()(AssemblyDatum &datum, unsigned int i, unsigned int qp) const
Get the current shape function.
The Kokkos wrapper classes for MOOSE-like variable value access.
bool _dof
Flag whether DOF values are requested.
KOKKOS_FUNCTION auto get(Datum &datum, unsigned int idx, unsigned int comp=0, Real seed=0) const
Get the current variable value.
KOKKOS_FUNCTION auto operator()(AssemblyDatum &datum, unsigned int idx) const
std::conditional_t< is_ad, ADReal, Real > real_type
VariableValueTempl(const MooseVariableBase &var, const TagName &tag=Moose::SOLUTION_TAG, bool dof=false)
Constructor.
VariableValueTempl()=default
Default constructor.
KOKKOS_FUNCTION auto operator()(Datum &datum, unsigned int idx, unsigned int comp=0) const
Get the current variable value.
VariableValueTempl(Variable var, bool dof=false)
Constructor.
Variable _var
Coupled Kokkos variable.
VariableValueTempl(const std::vector< const MooseVariableFieldBase * > &vars, const TagName &tag=Moose::SOLUTION_TAG, bool dof=false)
Constructor.
Array< Real > _seed
Derivative seed of each component for AD.
VariableValueTempl< is_ad > & operator=(const VariableValueTempl< is_ad > &object)
Copy assignment operator.
VariableValueTempl(const std::vector< MooseVariableFieldBase * > &vars, const TagName &tag=Moose::SOLUTION_TAG, bool dof=false)
KOKKOS_FUNCTION const Variable & variable() const
Get the Kokkos variable.
The Kokkos variable object that carries the coupled variable and tag information.
KOKKOS_FUNCTION unsigned int components() const
Get the number of components.
KOKKOS_FUNCTION bool vector() const
Get whether the variable is vector variable.
KOKKOS_FUNCTION bool old() const
Get whether the tag is old/older value.
KOKKOS_FUNCTION unsigned int var(unsigned int comp=0) const
Get the variable number of a component.
KOKKOS_FUNCTION bool coupled() const
Get whether the variable is coupled.
const MooseVariableBase * mooseVar(unsigned int comp=0)
Get the MOOSE variable of a component.
KOKKOS_FUNCTION TagID tag() const
Get the vector tag ID.
KOKKOS_FUNCTION Real3 vectorValue(unsigned int comp=0) const
Get the default vector value of a component.
KOKKOS_FUNCTION bool dot() const
Get whether the tag is time derivative.
KOKKOS_FUNCTION bool initialized() const
Get whether the variable is initialized.
KOKKOS_FUNCTION unsigned int sys(unsigned int comp=0) const
Get the system number of a component.
VectorVariableCurl(const MooseVariableFieldBase &var, const TagName &tag=Moose::SOLUTION_TAG)
Constructor.
KOKKOS_FUNCTION Real3 operator()(AssemblyDatum &datum, unsigned int qp, unsigned int comp=0) const
Get the current vector variable curl.
VectorVariableCurl(Variable var)
Constructor.
VectorVariableCurl()=default
Default constructor.
KOKKOS_FUNCTION const Variable & variable() const
Get the Kokkos variable.
Variable _var
Coupled Kokkos variable.
Variable _var
Coupled Kokkos variable.
VectorVariableGradient()=default
Default constructor.
KOKKOS_FUNCTION Real33 operator()(AssemblyDatum &datum, unsigned int qp, unsigned int comp=0) const
Get the current vector variable gradient.
KOKKOS_FUNCTION const Variable & variable() const
Get the Kokkos variable.
VectorVariableGradient(Variable var)
Constructor.
VectorVariableGradient(const MooseVariableFieldBase &var, const TagName &tag=Moose::SOLUTION_TAG)
Constructor.
KOKKOS_FUNCTION Real3 operator()(AssemblyDatum &datum, unsigned int i, unsigned int qp) const
Get the curl of the current vector shape function.
KOKKOS_FUNCTION Real33 operator()(AssemblyDatum &datum, unsigned int i, unsigned int qp) const
Get the gradient of the current vector shape function.
KOKKOS_FUNCTION const Real33 & reference(AssemblyDatum &datum, unsigned int i, unsigned int qp) const
Get the gradient of the current vector shape function in reference space.
KOKKOS_FUNCTION Real3 operator()(AssemblyDatum &datum, unsigned int i, unsigned int qp) const
Get the current vector shape function.
VectorVariableValue(Variable var, bool dof=false)
Constructor.
KOKKOS_FUNCTION Real3 operator()(AssemblyDatum &datum, unsigned int idx, unsigned int comp=0) const
Get the current vector variable value.
VectorVariableValue(const MooseVariableFieldBase &var, const TagName &tag=Moose::SOLUTION_TAG, bool dof=false)
Constructor.
bool _dof
Flag whether DOF values are requested.
KOKKOS_FUNCTION const Variable & variable() const
Get the Kokkos variable.
Variable _var
Coupled Kokkos variable.
VectorVariableValue()=default
Default constructor.
virtual const Number & duDotDu(unsigned int var_num=0) const
VariableShapeValue< true > VariableTestValue
VariableValueTempl< false > VariableValue
VariableShapeGradient< false > VariablePhiGradient
KOKKOS_INLINE_FUNCTION Real3 curlFromVectorGradient(const Real33 grad, const unsigned int dim)
Vector3< Real > Real3
Definition KokkosTypes.h:32
void checkVariable(const Variable &var, bool expect_vector, const std::string &wrapper_name)
VariableShapeValue< false > VariablePhiValue
VariableGradientTempl< false > VariableGradient
VariableShapeGradient< true > VariableTestGradient
const TagName SOLUTION_TAG
Definition MooseTypes.C:25
const unsigned int invalid_uint
The type trait that determines the default behavior of copy constructor and deepCopy() If this type t...
Definition KokkosArray.h:92
static constexpr bool value
Definition KokkosArray.h:93
ContiguousElementID id
Contiguous element ID.
Definition KokkosMesh.h:42
KOKKOS_INLINE_FUNCTION Real33 transpose() const