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://www.mooseframework.org
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)
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)
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
305 KOKKOS_FUNCTION auto
306 operator()(AssemblyDatum & datum, unsigned int idx, unsigned int comp = 0) const;
307
312 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
313
314private:
323 KOKKOS_FUNCTION auto
324 get(Datum & datum, unsigned int idx, unsigned int comp = 0, Real seed = 0) const;
325
337 bool _dof = false;
338};
339
340template <bool is_ad>
342 : _var(object._var), _seed(object._seed), _dof(object._dof)
343{
344 if constexpr (is_ad)
345 if (_var.coupled())
346 {
347 if (!_seed.isAlloc())
349
350 for (unsigned int comp = 0; comp < _var.components(); ++comp)
351 _seed[comp] =
352 _var.dot() ? _var.mooseVar(comp)->sys().duDotDu(_var.var(comp)) : (_var.old() ? 0 : 1);
353
355 }
356}
357
358template <bool is_ad>
361{
362 _var = object._var;
363 _dof = object._dof;
364
365 return *this;
366}
367
368template <bool is_ad>
369KOKKOS_FUNCTION auto
371 unsigned int idx,
372 unsigned int comp) const
373{
374 if constexpr (is_ad)
375 {
376 Real seed =
377 datum.do_derivatives() && _var.coupled() && _var.sys(comp) == datum.sys() ? _seed[comp] : 0;
378
379 return get(datum, idx, comp, seed);
380 }
381 else
382 return get(datum, idx, comp);
383}
384
385template <bool is_ad>
386KOKKOS_FUNCTION auto
388 unsigned int idx,
389 unsigned int comp,
390 [[maybe_unused]] Real seed) const
391{
392 KOKKOS_ASSERT(_var.initialized());
393
394 real_type value;
395
396 if (_var.coupled())
397 {
398 auto & sys = datum.system(_var.sys(comp));
399 auto var = _var.var(comp);
400 auto tag = _var.tag();
401
402 if (_dof)
403 {
404 unsigned int dof;
405
406 if (datum.isNodal())
407 {
408 auto node = datum.node();
409 dof = sys.getNodeLocalDofIndex(node, 0, var);
410 }
411 else
412 {
413 auto elem = datum.elem().id;
414 dof = sys.getElemLocalDofIndex(elem, idx, var);
415 }
416
417 if constexpr (is_ad)
418 value = sys.getVectorDofADValue(dof, tag, seed);
419 else
420 value = sys.getVectorDofValue(dof, tag);
421 }
422 else
423 {
424 auto & elem = datum.elem();
425 auto side = datum.side();
426
427 if constexpr (is_ad)
428 value = side == libMesh::invalid_uint
429 ? sys.getVectorQpADValue(elem, datum.qpOffset(), idx, var, tag, seed)
430 : sys.getVectorQpADValueFace(elem, side, idx, var, tag, seed);
431 else
432 value = side == libMesh::invalid_uint
433 ? sys.getVectorQpValue(elem, datum.qpOffset() + idx, var, tag)
434 : sys.getVectorQpValueFace(elem, side, idx, var, tag);
435 }
436 }
437 else
438 value = _var.value(comp);
439
440 return value;
441}
442
443template <bool is_ad>
445{
446 using real3_type = std::conditional_t<is_ad, ADReal3, Real3>;
447
448public:
458 {
459 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
460 }
467 const TagName & tag = Moose::SOLUTION_TAG)
468 : _var(var, tag)
469 {
470 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
471 }
478 VariableGradientTempl(const std::vector<const MooseVariableFieldBase *> & vars,
479 const TagName & tag = Moose::SOLUTION_TAG)
480 : _var(vars, tag)
481 {
482 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
483 }
484 VariableGradientTempl(const std::vector<MooseVariableFieldBase *> & vars,
485 const TagName & tag = Moose::SOLUTION_TAG)
486 : _var(vars, tag)
487 {
488 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
489 }
491
500
505 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
506
514 KOKKOS_FUNCTION auto operator()(Datum & datum, unsigned int qp, unsigned int comp = 0) const
515 {
516 return get(datum, qp, comp);
517 }
518
526 KOKKOS_FUNCTION auto
527 operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp = 0) const;
528
533 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
534
535private:
544 KOKKOS_FUNCTION auto
545 get(Datum & datum, unsigned int qp, unsigned int comp = 0, Real seed = 0) const;
546
555};
556
557template <bool is_ad>
559 : _var(object._var), _seed(object._seed)
560{
561 if constexpr (is_ad)
562 if (_var.coupled())
563 {
564 if (!_seed.isAlloc())
566
567 for (unsigned int comp = 0; comp < _var.components(); ++comp)
568 _seed[comp] =
569 _var.dot() ? _var.mooseVar(comp)->sys().duDotDu(_var.var(comp)) : (_var.old() ? 0 : 1);
570
572 }
573}
574
575template <bool is_ad>
578{
579 _var = object._var;
580
581 return *this;
582}
583
584template <bool is_ad>
585KOKKOS_FUNCTION auto
587 unsigned int qp,
588 unsigned int comp) const
589{
590 if constexpr (is_ad)
591 {
592 Real seed =
593 datum.do_derivatives() && _var.coupled() && _var.sys(comp) == datum.sys() ? _seed[comp] : 0;
594
595 return get(datum, qp, comp, seed);
596 }
597 else
598 return get(datum, qp, comp);
599}
600
601template <bool is_ad>
602KOKKOS_FUNCTION auto
604 unsigned int qp,
605 unsigned int comp,
606 [[maybe_unused]] Real seed) const
607{
608 KOKKOS_ASSERT(_var.initialized());
609
610 real3_type grad;
611
612 if (_var.coupled())
613 {
614 KOKKOS_ASSERT(!datum.isNodal());
615
616 auto & elem = datum.elem();
617 auto side = datum.side();
618
619 if constexpr (is_ad)
620 grad =
622 ? datum.system(_var.sys(comp))
623 .getVectorQpADGrad(
624 elem, datum.J(qp), datum.qpOffset(), qp, _var.var(comp), _var.tag(), seed)
625 : datum.system(_var.sys(comp))
627 elem, side, datum.J(qp), qp, _var.var(comp), _var.tag(), seed);
628 else
629 grad =
631 ? datum.system(_var.sys(comp))
632 .getVectorQpGrad(elem, datum.qpOffset() + qp, _var.var(comp), _var.tag())
633 : datum.system(_var.sys(comp))
634 .getVectorQpGradFace(elem, side, datum.J(qp), qp, _var.var(comp), _var.tag());
635 }
636
637 return grad;
638}
639
644
646{
647public:
657 VectorVariableValue(Variable var, bool dof = false) : _var(var), _dof(dof)
658 {
659 checkVariable(_var, true, "VectorVariableValue");
660 }
668 const TagName & tag = Moose::SOLUTION_TAG,
669 bool dof = false)
670 : _var(var, tag), _dof(dof)
671 {
672 checkVariable(_var, true, "VectorVariableValue");
673 }
674
679 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
680
687 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
688 unsigned int idx,
689 unsigned int comp = 0) const;
690
695 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
696
697private:
705 bool _dof = false;
706};
707
709{
710public:
720 {
721 checkVariable(_var, true, "VectorVariableGradient");
722 }
729 const TagName & tag = Moose::SOLUTION_TAG)
730 : _var(var, tag)
731 {
732 checkVariable(_var, true, "VectorVariableGradient");
733 }
734
739 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
740
747 KOKKOS_FUNCTION Real33 operator()(AssemblyDatum & datum,
748 unsigned int qp,
749 unsigned int comp = 0) const;
750
755 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
756
757private:
762};
763
765{
766public:
775 VectorVariableCurl(Variable var) : _var(var) { checkVariable(_var, true, "VectorVariableCurl"); }
782 : _var(var, tag)
783 {
784 checkVariable(_var, true, "VectorVariableCurl");
785 }
786
791 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
792
799 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
800 unsigned int qp,
801 unsigned int comp = 0) const;
802
807 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
808
809private:
814};
815
816KOKKOS_FUNCTION inline Real3
817VectorVariableValue::operator()(AssemblyDatum & datum, unsigned int idx, unsigned int comp) const
818{
819 KOKKOS_ASSERT(_var.initialized());
820
821 Real3 value = 0;
822
823 if (_var.coupled())
824 {
825 auto & sys = datum.system(_var.sys(comp));
826 auto var = _var.var(comp);
827 auto tag = _var.tag();
828
829 if (_dof)
830 {
831 auto dimension = datum.assembly().getDimension();
832
833 if (datum.isNodal())
834 {
835 auto node = datum.node();
836
837 for (unsigned int c = 0; c < dimension; ++c)
838 value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
839 }
840 else
841 {
842 auto elem = datum.elem().id;
843 auto offset = idx * dimension;
844
845 for (unsigned int c = 0; c < dimension; ++c)
846 value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
847 }
848 }
849 else
850 {
851 KOKKOS_ASSERT(!datum.isNodal());
852
853 auto & elem = datum.elem();
854 auto side = datum.side();
855
856 if (side == libMesh::invalid_uint)
857 value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
858 else
859 value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
860 }
861 }
862 else
863 value = _var.vectorValue(comp);
864
865 return value;
866}
867
868KOKKOS_FUNCTION inline Real33
869VectorVariableGradient::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
870{
871 KOKKOS_ASSERT(_var.initialized());
872
873 Real33 grad = 0;
874
875 if (_var.coupled())
876 {
877 KOKKOS_ASSERT(!datum.isNodal());
878
879 auto & elem = datum.elem();
880 auto side = datum.side();
881 auto & sys = datum.system(_var.sys(comp));
882 auto var = _var.var(comp);
883 auto tag = _var.tag();
884
885 if (side == libMesh::invalid_uint)
886 grad = sys.getVectorQpVectorGrad(elem, datum.qpOffset() + qp, var, tag);
887 else
888 grad = sys.getVectorQpVectorGradFace(elem, side, datum.J(qp), qp, var, tag);
889 }
890
891 return grad;
892}
893
894KOKKOS_FUNCTION inline Real3
895VectorVariableCurl::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
896{
897 KOKKOS_ASSERT(_var.initialized());
898
899 Real3 curl = 0;
900
901 if (_var.coupled())
902 {
903 KOKKOS_ASSERT(!datum.isNodal());
904
905 auto & elem = datum.elem();
906 auto side = datum.side();
907 auto & sys = datum.system(_var.sys(comp));
908 auto var = _var.var(comp);
909 auto tag = _var.tag();
910
911 if (side == libMesh::invalid_uint)
912 curl = sys.getVectorQpVectorCurl(elem, datum.qpOffset() + qp, var, tag);
913 else
914 {
915 auto fe = sys.getFETypeID(var);
916 auto n_dofs = datum.assembly().getNumDofs(elem.type, fe);
917 auto & grad_phi = datum.assembly().getVectorGradPhiFace(elem.subdomain, elem.type, fe)(side);
918 auto jacobian = datum.J(qp);
919 auto jacobian_transpose = jacobian.transpose();
920 Real33 grad = 0;
921
922 for (unsigned int i = 0; i < n_dofs; ++i)
923 grad += sys.getVectorDofValue(sys.getElemLocalDofIndex(elem.id, i, var), tag) *
924 (grad_phi(i, qp) * jacobian_transpose);
925
926 curl = curlFromVectorGradient(grad, datum.assembly().getDimension());
927 }
928 }
929
930 return curl;
931}
932
933template <>
935{
936 static constexpr bool value = true;
937};
938
939template <>
941{
942 static constexpr bool value = true;
943};
945
946} // 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
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 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
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.
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.
std::conditional_t< is_ad, ADReal, Real > real_type
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 MooseVariableFieldBase &var, const TagName &tag=Moose::SOLUTION_TAG, bool dof=false)
Constructor.
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.
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.
const MooseVariableFieldBase * mooseVar(unsigned int comp=0)
Get the MOOSE variable of a component.
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
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
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