12 #include "../tmop.hpp" 14 #include "../linearform.hpp" 15 #include "../../general/forall.hpp" 16 #include "../../linalg/kernels.hpp" 22 const double lim_normal,
38 const bool const_c0 = c0_.
Size() == 1;
40 constexpr
int DIM = 2;
41 constexpr
int NBZ = 1;
43 const int D1D = T_D1D ? T_D1D : d1d;
44 const int Q1D = T_Q1D ? T_Q1D : q1d;
46 const auto C0 = const_c0 ?
49 const auto LD =
Reshape(lim_dist.
Read(), D1D, D1D, NE);
61 const int D1D = T_D1D ? T_D1D : d1d;
62 const int Q1D = T_Q1D ? T_Q1D : q1d;
63 constexpr
int NBZ = 1;
64 constexpr
int MQ1 = T_Q1D ? T_Q1D : T_MAX;
65 constexpr
int MD1 = T_D1D ? T_D1D : T_MAX;
67 MFEM_SHARED
double B[MQ1*MD1];
68 MFEM_SHARED
double BLD[MQ1*MD1];
70 MFEM_SHARED
double XY[NBZ][MD1*MD1];
71 MFEM_SHARED
double DQ[NBZ][MD1*MQ1];
72 MFEM_SHARED
double QQ[NBZ][MQ1*MQ1];
74 MFEM_SHARED
double XY0[2][NBZ][MD1*MD1];
75 MFEM_SHARED
double DQ0[2][NBZ][MD1*MQ1];
76 MFEM_SHARED
double QQ0[2][NBZ][MQ1*MQ1];
78 MFEM_SHARED
double XY1[2][NBZ][MD1*MD1];
79 MFEM_SHARED
double DQ1[2][NBZ][MD1*MQ1];
80 MFEM_SHARED
double QQ1[2][NBZ][MQ1*MQ1];
82 kernels::internal::LoadX<MD1,NBZ>(e,D1D,LD,XY);
83 kernels::internal::LoadX<MD1,NBZ>(e,D1D,X0,XY0);
84 kernels::internal::LoadX<MD1,NBZ>(e,D1D,X1,XY1);
86 kernels::internal::LoadB<MD1,MQ1>(D1D,Q1D,
b,B);
87 kernels::internal::LoadB<MD1,MQ1>(D1D,Q1D,bld,BLD);
89 kernels::internal::EvalX<MD1,MQ1,NBZ>(D1D,Q1D,BLD,XY,DQ);
90 kernels::internal::EvalY<MD1,MQ1,NBZ>(D1D,Q1D,BLD,DQ,QQ);
92 kernels::internal::EvalX<MD1,MQ1,NBZ>(D1D,Q1D,B,XY0,DQ0);
93 kernels::internal::EvalY<MD1,MQ1,NBZ>(D1D,Q1D,B,DQ0,QQ0);
95 kernels::internal::EvalX<MD1,MQ1,NBZ>(D1D,Q1D,B,XY1,DQ1);
96 kernels::internal::EvalY<MD1,MQ1,NBZ>(D1D,Q1D,B,DQ1,QQ1);
98 MFEM_FOREACH_THREAD(qy,y,Q1D)
100 MFEM_FOREACH_THREAD(qx,x,Q1D)
102 double ld, p0[2], p1[2];
103 const double *Jtr = &J(0,0,qx,qy,e);
104 const double detJtr = kernels::Det<2>(Jtr);
105 const double weight = W(qx,qy) * detJtr;
106 const double coeff0 = const_c0 ? C0(0,0,0) : C0(qx,qy,e);
107 kernels::internal::PullEval<MQ1,NBZ>(Q1D,qx,qy,QQ,ld);
108 kernels::internal::PullEval<MQ1,NBZ>(Q1D,qx,qy,QQ0,p0);
109 kernels::internal::PullEval<MQ1,NBZ>(Q1D,qx,qy,QQ1,p1);
110 const double dist = ld;
115 id2 = 0.5 / (dist*dist);
116 dsq = kernels::DistanceSquared<2>(p1,p0) * id2;
117 E(qx,qy,e) = weight * lim_normal * dsq * coeff0;
121 id2 = 1.0 / (dist*dist);
122 dsq = kernels::DistanceSquared<2>(p1,p0) * id2;
123 E(qx,qy,e) = weight * lim_normal * exp(10.0*(dsq-1.0)) * coeff0;
128 return energy * ones;
134 const int D1D =
PA.maps->ndof;
135 const int Q1D =
PA.maps->nqpt;
136 const int id = (D1D << 4 ) | Q1D;
143 MFEM_VERIFY(
PA.maps_lim->ndof == D1D,
"");
144 MFEM_VERIFY(
PA.maps_lim->nqpt == Q1D,
"");
151 const bool exp_lim = (el) ?
true :
false;
153 MFEM_LAUNCH_TMOP_KERNEL(EnergyPA_C0_2D,
id,ln,
LD,
C0,N,J,W,B,BLD,
X0,X,
O,
E,
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 double input_min_size, const DenseMatrix &w_, const Array< double > &b_, const Vector &x_, const Vector &nc_reduce, DenseTensor &j_, const int d1d, const int q1d)
virtual double * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
void forall_2D_batch(int N, int X, int Y, int BZ, lambda &&body)
double GetLocalStateEnergyPA_C0_2D(const Vector &) const
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