r0 = 1.
    theta = .5 * np.pi * x
    r = y + r0
    ux = -x + r * np.cos(theta**2)
    uy = -y + r * np.sin(theta**2)
    uz = 0. * z
    return ux, uy, uz


N1, N2 = 30, 30
l1, l2 = .75, 1.

m = RegularQuadMesh(N1=N1, N2=N2, l1=l1, l2=l2)
vectorField = m.nodes.eval_vectorFunction(function)
m.nodes.apply_displacement(vectorField)
patches = m.dump2polygons()
bb = m.nodes.boundingBox()
patches.set_linewidth(1.)

fig = plt.figure(0)
plt.clf()
ax = fig.add_subplot(111)
ax.set_aspect("equal")
ax.add_collection(patches)
plt.grid()
plt.xlim(bb[0])
plt.ylim(bb[1])
plt.xlabel("$x$ position")
plt.ylabel("$y$ position")
plt.show()
  r = y + r0
  ux = -x + r * np.cos(theta**2)
  uy = -y + r * np.sin(theta**2)
  uz = 0. * z
  return ux, uy, uz
N1, N2, N3 = 10, 10, 5
l1, l2, l3 = .75, 1., 1.



m = RegularQuadMesh(N1 = N1, N2 = N2, l1 = l1, l2 = l2)
m = m.extrude(l = l3, N = N3 )
vectorField = m.nodes.eval_vectorFunction(function)
m.nodes.apply_displacement(vectorField)
patches = m.dump2polygons(use_3D = True, 
                          face_color = None, 
                          edge_color = "black")
bb = m.nodes.boundingBox()
patches.set_linewidth(1.)

fig = plt.figure(0)
plt.clf()
ax = a3.Axes3D(fig)
ax.set_aspect("equal")
ax.add_collection3d(patches)
plt.xlim(bb[0])
plt.ylim(bb[1])
plt.xlabel("$x$ position")
plt.ylabel("$y$ position")
plt.show()
Exemple #3
0
    theta = 0.5 * np.pi * x
    r = y + r0
    ux = -x + r * np.cos(theta ** 2)
    uy = -y + r * np.sin(theta ** 2)
    uz = 0.0 * z
    return ux, uy, uz


N1, N2 = 30, 30
l1, l2 = 0.75, 1.0


m = RegularQuadMesh(N1=N1, N2=N2, l1=l1, l2=l2)
vectorField = m.nodes.eval_vectorFunction(function)
m.nodes.apply_displacement(vectorField)
patches = m.dump2polygons()
volume = m.volume()
bb = m.nodes.boundingBox()
patches.set_facecolor(None)  # Required to allow face color
patches.set_array(volume)
patches.set_linewidth(1.0)
fig = plt.figure(0)
plt.clf()
ax = fig.add_subplot(111)
ax.set_aspect("equal")
ax.add_collection(patches)
plt.legend()
cbar = plt.colorbar(patches)
plt.grid()
plt.xlim(bb[0])
plt.ylim(bb[1])
Exemple #4
0
    r0 = 1.
    theta = .5 * np.pi * x
    r = y + r0
    ux = -x + r * np.cos(theta**2)
    uy = -y + r * np.sin(theta**2)
    uz = 0. * z
    return ux, uy, uz


N1, N2, N3 = 10, 10, 5
l1, l2, l3 = .75, 1., 1.

m = RegularQuadMesh(N1=N1, N2=N2, l1=l1, l2=l2)
m = m.extrude(l=l3, N=N3)
vectorField = m.nodes.eval_vectorFunction(function)
m.nodes.apply_displacement(vectorField)
patches = m.dump2polygons(use_3D=True, face_color=None, edge_color="black")
bb = m.nodes.boundingBox()
patches.set_linewidth(1.)

fig = plt.figure(0)
plt.clf()
ax = a3.Axes3D(fig)
ax.set_aspect("equal")
ax.add_collection3d(patches)
plt.xlim(bb[0])
plt.ylim(bb[1])
plt.xlabel("$x$ position")
plt.ylabel("$y$ position")
plt.show()