12 #include "../tmop.hpp" 14 #include "../linearform.hpp" 15 #include "../../general/forall.hpp" 16 #include "../../linalg/kernels.hpp" 22 const double lim_normal,
37 const bool const_c0 = c0_.
Size() == 1;
39 constexpr
int DIM = 3;
40 const int D1D = T_D1D ? T_D1D : d1d;
41 const int Q1D = T_Q1D ? T_Q1D : q1d;
43 const auto C0 = const_c0 ?
46 const auto LD =
Reshape(lim_dist.
Read(), D1D, D1D, D1D, NE);
56 MFEM_FORALL_3D(e, NE, Q1D, Q1D, Q1D,
58 const int D1D = T_D1D ? T_D1D : d1d;
59 const int Q1D = T_Q1D ? T_Q1D : q1d;
60 constexpr
int MQ1 = T_Q1D ? T_Q1D : T_MAX;
61 constexpr
int MD1 = T_D1D ? T_D1D : T_MAX;
62 constexpr
int MDQ = (MQ1 > MD1) ? MQ1 : MD1;
64 MFEM_SHARED
double B[MQ1*MD1];
65 MFEM_SHARED
double sBLD[MQ1*MD1];
66 kernels::internal::LoadB<MD1,MQ1>(D1D,Q1D,bld,sBLD);
69 MFEM_SHARED
double sm0[MDQ*MDQ*MDQ];
70 MFEM_SHARED
double sm1[MDQ*MDQ*MDQ];
76 MFEM_SHARED
double DDD0[3][MD1*MD1*MD1];
77 MFEM_SHARED
double DDQ0[3][MD1*MD1*MQ1];
78 MFEM_SHARED
double DQQ0[3][MD1*MQ1*MQ1];
79 MFEM_SHARED
double QQQ0[3][MQ1*MQ1*MQ1];
81 MFEM_SHARED
double DDD1[3][MD1*MD1*MD1];
82 MFEM_SHARED
double DDQ1[3][MD1*MD1*MQ1];
83 MFEM_SHARED
double DQQ1[3][MD1*MQ1*MQ1];
84 MFEM_SHARED
double QQQ1[3][MQ1*MQ1*MQ1];
86 kernels::internal::LoadX(e,D1D,LD,DDD);
87 kernels::internal::LoadX<MD1>(e,D1D,X0,DDD0);
88 kernels::internal::LoadX<MD1>(e,D1D,X1,DDD1);
90 kernels::internal::LoadB<MD1,MQ1>(D1D,Q1D,
b,B);
92 kernels::internal::EvalX(D1D,Q1D,BLD,DDD,DDQ);
93 kernels::internal::EvalY(D1D,Q1D,BLD,DDQ,DQQ);
94 kernels::internal::EvalZ(D1D,Q1D,BLD,DQQ,QQQ);
96 kernels::internal::EvalX<MD1,MQ1>(D1D,Q1D,B,DDD0,DDQ0);
97 kernels::internal::EvalY<MD1,MQ1>(D1D,Q1D,B,DDQ0,DQQ0);
98 kernels::internal::EvalZ<MD1,MQ1>(D1D,Q1D,B,DQQ0,QQQ0);
100 kernels::internal::EvalX<MD1,MQ1>(D1D,Q1D,B,DDD1,DDQ1);
101 kernels::internal::EvalY<MD1,MQ1>(D1D,Q1D,B,DDQ1,DQQ1);
102 kernels::internal::EvalZ<MD1,MQ1>(D1D,Q1D,B,DQQ1,QQQ1);
104 MFEM_FOREACH_THREAD(qz,z,Q1D)
106 MFEM_FOREACH_THREAD(qy,y,Q1D)
108 MFEM_FOREACH_THREAD(qx,x,Q1D)
110 const double *Jtr = &J(0,0,qx,qy,qz,e);
111 const double detJtr = kernels::Det<3>(Jtr);
112 const double weight = W(qx,qy,qz) * detJtr;
114 double D, p0[3], p1[3];
115 const double coeff0 = const_c0 ? C0(0,0,0,0) : C0(qx,qy,qz,e);
116 kernels::internal::PullEval(qx,qy,qz,QQQ,D);
117 kernels::internal::PullEval<MQ1>(Q1D,qx,qy,qz,QQQ0,p0);
118 kernels::internal::PullEval<MQ1>(Q1D,qx,qy,qz,QQQ1,p1);
132 const double dist = D;
134 const double w = weight * lim_normal * coeff0;
135 const double dist_squared = dist * dist;
139 a = 1.0 / dist_squared;
143 double dsq = kernels::DistanceSquared<3>(p1,p0) / dist_squared;
144 a = 20.0*exp(10.0*(dsq - 1.0))/dist_squared;
147 kernels::Subtract<3>(w*
a, p1, p0, d1);
148 kernels::internal::PushEval<MQ1>(Q1D,qx,qy,qz,d1,QQQ0);
153 kernels::internal::LoadBt<MD1,MQ1>(D1D,Q1D,
b,B);
154 kernels::internal::EvalXt<MD1,MQ1>(D1D,Q1D,B,QQQ0,DQQ0);
155 kernels::internal::EvalYt<MD1,MQ1>(D1D,Q1D,B,DQQ0,DDQ0);
156 kernels::internal::EvalZt<MD1,MQ1>(D1D,Q1D,B,DDQ0,Y,e);
163 const int D1D =
PA.maps->ndof;
164 const int Q1D =
PA.maps->nqpt;
165 const int id = (D1D << 4 ) | Q1D;
172 MFEM_VERIFY(
PA.maps_lim->ndof == D1D,
"");
173 MFEM_VERIFY(
PA.maps_lim->nqpt == Q1D,
"");
177 const bool exp_lim = (el) ?
true :
false;
179 MFEM_LAUNCH_TMOP_KERNEL(AddMultPA_Kernel_C0_3D,
id,ln,
LD,
C0,N,J,W,B,BLD,
X0,X,Y,
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
struct mfem::TMOP_Integrator::@23 PA
int Size() const
Returns the size of the vector.
virtual const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
const double * Read(bool on_dev=true) const
Shortcut for mfem::Read( GetMemory(), TotalSize(), on_dev).
MFEM_REGISTER_TMOP_KERNELS(void, DatcSize, const int NE, const int ncomp, const int sizeidx, const DenseMatrix &w_, const Array< double > &b_, const Vector &x_, DenseTensor &j_, const int d1d, const int q1d)
A basic generic Tensor class, appropriate for use on the GPU.
void AddMultPA_C0_3D(const Vector &, Vector &) const
virtual double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
Exponential limiter function in TMOP_Integrator.
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
Rank 3 tensor (array of matrices)
TMOP_LimiterFunction * lim_func