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 || _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 }
248
257
262 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
263
271 KOKKOS_FUNCTION auto operator()(Datum & datum, unsigned int idx, unsigned int comp = 0) const
272 {
273 return get(datum, idx, comp);
274 }
275
283 KOKKOS_FUNCTION auto
284 operator()(AssemblyDatum & datum, unsigned int idx, unsigned int comp = 0) const;
285
290 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
291
292private:
301 KOKKOS_FUNCTION auto
302 get(Datum & datum, unsigned int idx, unsigned int comp = 0, Real seed = 0) const;
303
315 bool _dof = false;
316};
317
318template <bool is_ad>
320 : _var(object._var), _seed(object._seed), _dof(object._dof)
321{
322 if constexpr (is_ad)
323 if (_var.coupled())
324 {
325 if (!_seed.isAlloc())
327
328 for (unsigned int comp = 0; comp < _var.components(); ++comp)
329 _seed[comp] =
330 _var.dot() ? _var.mooseVar(comp)->sys().duDotDu(_var.var(comp)) : (_var.old() ? 0 : 1);
331
333 }
334}
335
336template <bool is_ad>
339{
340 _var = object._var;
341 _dof = object._dof;
342
343 return *this;
344}
345
346template <bool is_ad>
347KOKKOS_FUNCTION auto
349 unsigned int idx,
350 unsigned int comp) const
351{
352 if constexpr (is_ad)
353 {
354 Real seed =
355 datum.do_derivatives() && _var.coupled() && _var.sys(comp) == datum.sys() ? _seed[comp] : 0;
356
357 return get(datum, idx, comp, seed);
358 }
359 else
360 return get(datum, idx, comp);
361}
362
363template <bool is_ad>
364KOKKOS_FUNCTION auto
366 unsigned int idx,
367 unsigned int comp,
368 [[maybe_unused]] Real seed) const
369{
370 KOKKOS_ASSERT(_var.initialized());
371
372 real_type value;
373
374 if (_var.coupled())
375 {
376 auto & sys = datum.system(_var.sys(comp));
377 auto var = _var.var(comp);
378 auto tag = _var.tag();
379
380 if (_dof)
381 {
382 unsigned int dof;
383
384 if (_var.scalar())
385 dof = sys.getScalarLocalDofIndex(idx, var);
386 else if (datum.isNodal())
387 {
388 auto node = datum.node();
389 dof = sys.getNodeLocalDofIndex(node, 0, var);
390 }
391 else
392 {
393 auto elem = datum.elem().id;
394 dof = sys.getElemLocalDofIndex(elem, idx, var);
395 }
396
397 if constexpr (is_ad)
398 value = sys.getVectorDofADValue(dof, tag, seed);
399 else
400 value = sys.getVectorDofValue(dof, tag);
401 }
402 else
403 {
404 auto & elem = datum.elem();
405 auto side = datum.side();
406
407 if constexpr (is_ad)
408 value = side == libMesh::invalid_uint
409 ? sys.getVectorQpADValue(elem, datum.qpOffset(), idx, var, tag, seed)
410 : sys.getVectorQpADValueFace(elem, side, idx, var, tag, seed);
411 else
412 value = side == libMesh::invalid_uint
413 ? sys.getVectorQpValue(elem, datum.qpOffset() + idx, var, tag)
414 : sys.getVectorQpValueFace(elem, side, idx, var, tag);
415 }
416 }
417 else
418 value = _var.value(_var.scalar() ? idx : comp);
419
420 return value;
421}
422
423template <bool is_ad>
425{
426 using real3_type = std::conditional_t<is_ad, ADReal3, Real3>;
427
428public:
438 {
439 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
440 }
447 const TagName & tag = Moose::SOLUTION_TAG)
448 : _var(var, tag)
449 {
450 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
451 }
452
461
466 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
467
475 KOKKOS_FUNCTION auto operator()(Datum & datum, unsigned int qp, unsigned int comp = 0) const
476 {
477 return get(datum, qp, comp);
478 }
479
487 KOKKOS_FUNCTION auto
488 operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp = 0) const;
489
494 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
495
496private:
505 KOKKOS_FUNCTION auto
506 get(Datum & datum, unsigned int qp, unsigned int comp = 0, Real seed = 0) const;
507
516};
517
518template <bool is_ad>
520 : _var(object._var), _seed(object._seed)
521{
522 if constexpr (is_ad)
523 if (_var.coupled())
524 {
525 if (!_seed.isAlloc())
527
528 for (unsigned int comp = 0; comp < _var.components(); ++comp)
529 _seed[comp] =
530 _var.dot() ? _var.mooseVar(comp)->sys().duDotDu(_var.var(comp)) : (_var.old() ? 0 : 1);
531
533 }
534}
535
536template <bool is_ad>
539{
540 _var = object._var;
541
542 return *this;
543}
544
545template <bool is_ad>
546KOKKOS_FUNCTION auto
548 unsigned int qp,
549 unsigned int comp) const
550{
551 if constexpr (is_ad)
552 {
553 Real seed =
554 datum.do_derivatives() && _var.coupled() && _var.sys(comp) == datum.sys() ? _seed[comp] : 0;
555
556 return get(datum, qp, comp, seed);
557 }
558 else
559 return get(datum, qp, comp);
560}
561
562template <bool is_ad>
563KOKKOS_FUNCTION auto
565 unsigned int qp,
566 unsigned int comp,
567 [[maybe_unused]] Real seed) const
568{
569 KOKKOS_ASSERT(_var.initialized());
570
571 real3_type grad;
572
573 if (_var.coupled())
574 {
575 KOKKOS_ASSERT(!datum.isNodal());
576
577 auto & elem = datum.elem();
578 auto side = datum.side();
579
580 if constexpr (is_ad)
581 grad =
583 ? datum.system(_var.sys(comp))
584 .getVectorQpADGrad(
585 elem, datum.J(qp), datum.qpOffset(), qp, _var.var(comp), _var.tag(), seed)
586 : datum.system(_var.sys(comp))
588 elem, side, datum.J(qp), qp, _var.var(comp), _var.tag(), seed);
589 else
590 grad =
592 ? datum.system(_var.sys(comp))
593 .getVectorQpGrad(elem, datum.qpOffset() + qp, _var.var(comp), _var.tag())
594 : datum.system(_var.sys(comp))
595 .getVectorQpGradFace(elem, side, datum.J(qp), qp, _var.var(comp), _var.tag());
596 }
597
598 return grad;
599}
600
605
607{
608public:
618 VectorVariableValue(Variable var, bool dof = false) : _var(var), _dof(dof)
619 {
620 checkVariable(_var, true, "VectorVariableValue");
621 }
629 const TagName & tag = Moose::SOLUTION_TAG,
630 bool dof = false)
631 : _var(var, tag), _dof(dof)
632 {
633 checkVariable(_var, true, "VectorVariableValue");
634 }
635
640 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
641
648 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
649 unsigned int idx,
650 unsigned int comp = 0) const;
651
656 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
657
658private:
666 bool _dof = false;
667};
668
670{
671public:
681 {
682 checkVariable(_var, true, "VectorVariableGradient");
683 }
690 const TagName & tag = Moose::SOLUTION_TAG)
691 : _var(var, tag)
692 {
693 checkVariable(_var, true, "VectorVariableGradient");
694 }
695
700 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
701
708 KOKKOS_FUNCTION Real33 operator()(AssemblyDatum & datum,
709 unsigned int qp,
710 unsigned int comp = 0) const;
711
716 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
717
718private:
723};
724
726{
727public:
736 VectorVariableCurl(Variable var) : _var(var) { checkVariable(_var, true, "VectorVariableCurl"); }
743 : _var(var, tag)
744 {
745 checkVariable(_var, true, "VectorVariableCurl");
746 }
747
752 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
753
760 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
761 unsigned int qp,
762 unsigned int comp = 0) const;
763
768 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
769
770private:
775};
776
777KOKKOS_FUNCTION inline Real3
778VectorVariableValue::operator()(AssemblyDatum & datum, unsigned int idx, unsigned int comp) const
779{
780 KOKKOS_ASSERT(_var.initialized());
781
782 Real3 value = 0;
783
784 if (_var.coupled())
785 {
786 auto & sys = datum.system(_var.sys(comp));
787 auto var = _var.var(comp);
788 auto tag = _var.tag();
789
790 if (_dof)
791 {
792 auto dimension = datum.assembly().getDimension();
793
794 if (datum.isNodal())
795 {
796 auto node = datum.node();
797
798 for (unsigned int c = 0; c < dimension; ++c)
799 value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
800 }
801 else
802 {
803 auto elem = datum.elem().id;
804 auto offset = idx * dimension;
805
806 for (unsigned int c = 0; c < dimension; ++c)
807 value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
808 }
809 }
810 else
811 {
812 KOKKOS_ASSERT(!datum.isNodal());
813
814 auto & elem = datum.elem();
815 auto side = datum.side();
816
817 if (side == libMesh::invalid_uint)
818 value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
819 else
820 value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
821 }
822 }
823 else
824 value = _var.vectorValue(comp);
825
826 return value;
827}
828
829KOKKOS_FUNCTION inline Real33
830VectorVariableGradient::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
831{
832 KOKKOS_ASSERT(_var.initialized());
833
834 Real33 grad = 0;
835
836 if (_var.coupled())
837 {
838 KOKKOS_ASSERT(!datum.isNodal());
839
840 auto & elem = datum.elem();
841 auto side = datum.side();
842 auto & sys = datum.system(_var.sys(comp));
843 auto var = _var.var(comp);
844 auto tag = _var.tag();
845
846 if (side == libMesh::invalid_uint)
847 grad = sys.getVectorQpVectorGrad(elem, datum.qpOffset() + qp, var, tag);
848 else
849 grad = sys.getVectorQpVectorGradFace(elem, side, datum.J(qp), qp, var, tag);
850 }
851
852 return grad;
853}
854
855KOKKOS_FUNCTION inline Real3
856VectorVariableCurl::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
857{
858 KOKKOS_ASSERT(_var.initialized());
859
860 Real3 curl = 0;
861
862 if (_var.coupled())
863 {
864 KOKKOS_ASSERT(!datum.isNodal());
865
866 auto & elem = datum.elem();
867 auto side = datum.side();
868 auto & sys = datum.system(_var.sys(comp));
869 auto var = _var.var(comp);
870 auto tag = _var.tag();
871
872 if (side == libMesh::invalid_uint)
873 curl = sys.getVectorQpVectorCurl(elem, datum.qpOffset() + qp, var, tag);
874 else
875 {
876 auto fe = sys.getFETypeID(var);
877 auto n_dofs = datum.assembly().getNumDofs(elem.type, fe);
878 auto & grad_phi = datum.assembly().getVectorGradPhiFace(elem.subdomain, elem.type, fe)(side);
879 auto jacobian = datum.J(qp);
880 auto jacobian_transpose = jacobian.transpose();
881 Real33 grad = 0;
882
883 for (unsigned int i = 0; i < n_dofs; ++i)
884 grad += sys.getVectorDofValue(sys.getElemLocalDofIndex(elem.id, i, var), tag) *
885 (grad_phi(i, qp) * jacobian_transpose);
886
887 curl = curlFromVectorGradient(grad, datum.assembly().getDimension());
888 }
889 }
890
891 return curl;
892}
893
894template <>
896{
897 static constexpr bool value = true;
898};
899
900template <>
902{
903 static constexpr bool value = true;
904};
906
907} // 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
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 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()=default
Default constructor.
KOKKOS_FUNCTION auto operator()(Datum &datum, unsigned int qp, unsigned int comp=0) const
Get the current variable gradient.
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(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.
Array< Real > _seed
Derivative seed of each component for AD.
VariableValueTempl< is_ad > & operator=(const VariableValueTempl< is_ad > &object)
Copy assignment operator.
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
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