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, datum.comp());
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 auto & sys = datum.system(_var.sys(comp));
404 auto var = _var.var(comp);
405 auto tag = _var.tag();
406
407 if (_dof)
408 {
409 unsigned int dof;
410
411 if (_var.scalar())
412 dof = sys.getScalarLocalDofIndex(idx, var);
413 else if (datum.isNodal())
414 {
415 auto node = datum.node();
416 dof = sys.getNodeLocalDofIndex(node, 0, var);
417 }
418 else
419 {
420 auto elem = datum.elem().id;
421 dof = sys.getElemLocalDofIndex(elem, idx, var);
422 }
423
424 if constexpr (is_ad)
425 value = sys.getVectorDofADValue(dof, tag, seed);
426 else
427 value = sys.getVectorDofValue(dof, tag);
428 }
429 else
430 {
431 auto & elem = datum.elem();
432 auto side = datum.side();
433
434 if constexpr (is_ad)
435 value = side == libMesh::invalid_uint
436 ? sys.getVectorQpADValue(elem, datum.qpOffset(), idx, var, tag, seed)
437 : sys.getVectorQpADValueFace(elem, side, idx, var, tag, seed);
438 else
439 value = side == libMesh::invalid_uint
440 ? sys.getVectorQpValue(elem, datum.qpOffset() + idx, var, tag)
441 : sys.getVectorQpValueFace(elem, side, idx, var, tag);
442 }
443 }
444 else
445 value = _var.value(_var.scalar() ? idx : comp);
446
447 return value;
448}
449
450template <bool is_ad>
452{
453 using real3_type = std::conditional_t<is_ad, ADReal3, Real3>;
454
455public:
465 {
466 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
467 }
474 const TagName & tag = Moose::SOLUTION_TAG)
475 : _var(var, tag)
476 {
477 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
478 }
485 VariableGradientTempl(const std::vector<const MooseVariableFieldBase *> & vars,
486 const TagName & tag = Moose::SOLUTION_TAG)
487 : _var(vars, tag)
488 {
489 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
490 }
491 VariableGradientTempl(const std::vector<MooseVariableFieldBase *> & vars,
492 const TagName & tag = Moose::SOLUTION_TAG)
493 : _var(vars, tag)
494 {
495 checkVariable(_var, false, is_ad ? "ADVariableGradient" : "VariableGradient");
496 }
498
507
512 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
513
521 KOKKOS_FUNCTION auto operator()(Datum & datum, unsigned int qp, unsigned int comp = 0) const
522 {
523 return get(datum, qp, comp);
524 }
525
534 KOKKOS_FUNCTION auto operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const;
535 KOKKOS_FUNCTION auto operator()(AssemblyDatum & datum, unsigned int qp) const
536 {
537 return this->operator()(datum, qp, datum.comp());
538 }
540
545 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
546
547private:
556 KOKKOS_FUNCTION auto
557 get(Datum & datum, unsigned int qp, unsigned int comp = 0, Real seed = 0) const;
558
567};
568
569template <bool is_ad>
571 : _var(object._var), _seed(object._seed)
572{
573 if constexpr (is_ad)
574 if (_var.coupled())
575 {
576 if (!_seed.isAlloc())
578
579 for (unsigned int comp = 0; comp < _var.components(); ++comp)
580 _seed[comp] =
581 _var.dot() ? _var.mooseVar(comp)->sys().duDotDu(_var.var(comp)) : (_var.old() ? 0 : 1);
582
584 }
585}
586
587template <bool is_ad>
590{
591 _var = object._var;
592
593 return *this;
594}
595
596template <bool is_ad>
597KOKKOS_FUNCTION auto
599 unsigned int qp,
600 unsigned int comp) const
601{
602 if constexpr (is_ad)
603 {
604 Real seed =
605 datum.do_derivatives() && _var.coupled() && _var.sys(comp) == datum.sys() ? _seed[comp] : 0;
606
607 return get(datum, qp, comp, seed);
608 }
609 else
610 return get(datum, qp, comp);
611}
612
613template <bool is_ad>
614KOKKOS_FUNCTION auto
616 unsigned int qp,
617 unsigned int comp,
618 [[maybe_unused]] Real seed) const
619{
620 KOKKOS_ASSERT(_var.initialized());
621
622 real3_type grad;
623
624 if (_var.coupled())
625 {
626 KOKKOS_ASSERT(!datum.isNodal());
627
628 auto & elem = datum.elem();
629 auto side = datum.side();
630
631 if constexpr (is_ad)
632 grad =
634 ? datum.system(_var.sys(comp))
635 .getVectorQpADGrad(
636 elem, datum.J(qp), datum.qpOffset(), qp, _var.var(comp), _var.tag(), seed)
637 : datum.system(_var.sys(comp))
639 elem, side, datum.J(qp), qp, _var.var(comp), _var.tag(), seed);
640 else
641 grad =
643 ? datum.system(_var.sys(comp))
644 .getVectorQpGrad(elem, datum.qpOffset() + qp, _var.var(comp), _var.tag())
645 : datum.system(_var.sys(comp))
646 .getVectorQpGradFace(elem, side, datum.J(qp), qp, _var.var(comp), _var.tag());
647 }
648
649 return grad;
650}
651
656
658{
659public:
669 VectorVariableValue(Variable var, bool dof = false) : _var(var), _dof(dof)
670 {
671 checkVariable(_var, true, "VectorVariableValue");
672 }
680 const TagName & tag = Moose::SOLUTION_TAG,
681 bool dof = false)
682 : _var(var, tag), _dof(dof)
683 {
684 checkVariable(_var, true, "VectorVariableValue");
685 }
686
691 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
692
699 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
700 unsigned int idx,
701 unsigned int comp = 0) const;
702
707 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
708
709private:
717 bool _dof = false;
718};
719
721{
722public:
732 {
733 checkVariable(_var, true, "VectorVariableGradient");
734 }
741 const TagName & tag = Moose::SOLUTION_TAG)
742 : _var(var, tag)
743 {
744 checkVariable(_var, true, "VectorVariableGradient");
745 }
746
751 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
752
759 KOKKOS_FUNCTION Real33 operator()(AssemblyDatum & datum,
760 unsigned int qp,
761 unsigned int comp = 0) const;
762
767 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
768
769private:
774};
775
777{
778public:
787 VectorVariableCurl(Variable var) : _var(var) { checkVariable(_var, true, "VectorVariableCurl"); }
794 : _var(var, tag)
795 {
796 checkVariable(_var, true, "VectorVariableCurl");
797 }
798
803 KOKKOS_FUNCTION operator bool() const { return _var.coupled(); }
804
811 KOKKOS_FUNCTION Real3 operator()(AssemblyDatum & datum,
812 unsigned int qp,
813 unsigned int comp = 0) const;
814
819 KOKKOS_FUNCTION const Variable & variable() const { return _var; }
820
821private:
826};
827
828KOKKOS_FUNCTION inline Real3
829VectorVariableValue::operator()(AssemblyDatum & datum, unsigned int idx, unsigned int comp) const
830{
831 KOKKOS_ASSERT(_var.initialized());
832
833 Real3 value = 0;
834
835 if (_var.coupled())
836 {
837 auto & sys = datum.system(_var.sys(comp));
838 auto var = _var.var(comp);
839 auto tag = _var.tag();
840
841 if (_dof)
842 {
843 auto dimension = datum.assembly().getDimension();
844
845 if (datum.isNodal())
846 {
847 auto node = datum.node();
848
849 for (unsigned int c = 0; c < dimension; ++c)
850 value(c) = sys.getVectorDofValue(sys.getNodeLocalDofIndex(node, c, var), tag);
851 }
852 else
853 {
854 auto elem = datum.elem().id;
855 auto offset = idx * dimension;
856
857 for (unsigned int c = 0; c < dimension; ++c)
858 value(c) = sys.getVectorDofValue(sys.getElemLocalDofIndex(elem, offset + c, var), tag);
859 }
860 }
861 else
862 {
863 KOKKOS_ASSERT(!datum.isNodal());
864
865 auto & elem = datum.elem();
866 auto side = datum.side();
867
868 if (side == libMesh::invalid_uint)
869 value = sys.getVectorQpVectorValue(elem, datum.qpOffset() + idx, var, tag);
870 else
871 value = sys.getVectorQpVectorValueFace(elem, side, idx, var, tag);
872 }
873 }
874 else
875 value = _var.vectorValue(comp);
876
877 return value;
878}
879
880KOKKOS_FUNCTION inline Real33
881VectorVariableGradient::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
882{
883 KOKKOS_ASSERT(_var.initialized());
884
885 Real33 grad = 0;
886
887 if (_var.coupled())
888 {
889 KOKKOS_ASSERT(!datum.isNodal());
890
891 auto & elem = datum.elem();
892 auto side = datum.side();
893 auto & sys = datum.system(_var.sys(comp));
894 auto var = _var.var(comp);
895 auto tag = _var.tag();
896
897 if (side == libMesh::invalid_uint)
898 grad = sys.getVectorQpVectorGrad(elem, datum.qpOffset() + qp, var, tag);
899 else
900 grad = sys.getVectorQpVectorGradFace(elem, side, datum.J(qp), qp, var, tag);
901 }
902
903 return grad;
904}
905
906KOKKOS_FUNCTION inline Real3
907VectorVariableCurl::operator()(AssemblyDatum & datum, unsigned int qp, unsigned int comp) const
908{
909 KOKKOS_ASSERT(_var.initialized());
910
911 Real3 curl = 0;
912
913 if (_var.coupled())
914 {
915 KOKKOS_ASSERT(!datum.isNodal());
916
917 auto & elem = datum.elem();
918 auto side = datum.side();
919 auto & sys = datum.system(_var.sys(comp));
920 auto var = _var.var(comp);
921 auto tag = _var.tag();
922
923 if (side == libMesh::invalid_uint)
924 curl = sys.getVectorQpVectorCurl(elem, datum.qpOffset() + qp, var, tag);
925 else
926 {
927 auto fe = sys.getFETypeID(var);
928 auto n_dofs = datum.assembly().getNumDofs(elem.type, fe);
929 auto & grad_phi = datum.assembly().getVectorGradPhiFace(elem.subdomain, elem.type, fe)(side);
930 auto jacobian = datum.J(qp);
931 auto jacobian_transpose = jacobian.transpose();
932 Real33 grad = 0;
933
934 for (unsigned int i = 0; i < n_dofs; ++i)
935 grad += sys.getVectorDofValue(sys.getElemLocalDofIndex(elem.id, i, var), tag) *
936 (grad_phi(i, qp) * jacobian_transpose);
937
938 curl = curlFromVectorGradient(grad, datum.assembly().getDimension());
939 }
940 }
941
942 return curl;
943}
944
945template <>
947{
948 static constexpr bool value = true;
949};
950
951template <>
953{
954 static constexpr bool value = true;
955};
957
958} // 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
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