12 def sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
13 return list_indenters[0].sDF(x,y,z)
16 def grad_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
17 return list_indenters[0].gradSdf(x,y,z)
20 def hess_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
21 return list_indenters[0].hessSdf(x,y,z)
41 def sDF(self, x, y, z):
42 return np.subtract(y,self.
shift)
45 dx = np.zeros_like(x).reshape((-1, 1))
46 dy = np.ones_like(y).reshape((-1, 1))
47 dz = np.zeros_like(z).reshape((-1, 1))
48 return np.hstack([dx, dy, dz])
51 zeros = np.zeros_like(x).reshape((-1, 1))
52 return np.hstack([zeros
for _
in range(6)])
69 def sDF(self, x, y, z):
70 return np.sqrt((x - self.
xc)**2 + (y - self.
yc)**2) - self.
radius
73 a = (x-self.
xc)**2 + (y-self.
yc)**2
74 c_val_A = 1./np.sqrt(a)
75 c_val_dx = c_val_A * (x-self.
xc)
76 c_val_dy = c_val_A * (y-self.
yc)
77 c_val_dz = np.zeros_like(c_val_dy)
79 return np.hstack([c_val_dx.reshape((-1,1)), c_val_dy.reshape((-1,1)), c_val_dz.reshape((-1,1))])
82 a = (x-self.
xc)**2 + (y-self.
yc)**2
83 c_val_A = 1./np.sqrt(a)
84 c_val_B = 1./(a**(3./2.))
85 Hxx = c_val_A - c_val_B * (x-self.
xc)**2
86 Hxy = -c_val_B * (x-self.
xc)*(y-self.
yc)
87 Hyy = c_val_A - c_val_B * (y-self.
yc)**2
88 zeros = np.zeros_like(Hxx).reshape((-1,1))
90 return np.hstack([Hxx.reshape((-1,1)), Hxy.reshape((-1,1)), zeros, Hyy.reshape((-1,1)), zeros, zeros])
108 return np.sqrt((x - self.
xc)**2 + (y - self.
yc)**2 + (z - self.
zc)**2) - self.
radius
111 a = (x-self.
xc)**2 + (y-self.
yc)**2 + (z-self.
zc)**2
112 c_val_A = 1./np.sqrt(a)
113 c_val_dx = c_val_A * (x-self.
xc)
114 c_val_dy = c_val_A * (y-self.
yc)
115 c_val_dz = c_val_A * (z-self.
zc)
117 return np.hstack([c_val_dx.reshape((-1,1)), c_val_dy.reshape((-1,1)), c_val_dz.reshape((-1,1))])
120 x, y, z = x-self.
xc, y-self.
yc, z-self.
zc
121 denom = (x**2 + y**2 + z**2)**(3/2)
122 sqrt_denom = np.sqrt(x**2 + y**2 + z**2)
123 Hxx = -x**2/denom + 1/sqrt_denom
126 Hyy = -y**2/denom + 1/sqrt_denom
128 Hzz = -z**2/denom + 1/sqrt_denom
130 return np.hstack([Hxx.reshape((-1,1)), Hxy.reshape((-1,1)), Hzx.reshape((-1,1)), Hyy.reshape((-1,1)), Hzy.reshape((-1,1)), Hzz.reshape((-1,1))])
137 list_indenters.append(
CylinderZ(0.0,-0.5-r, 0.0, 2*r))