deepxde
deepxde copied to clipboard
How to build a cylinder from 2D disk?
Many thanks to your great work, Prof Lulu. Now I meet a problem. I want to build a cylinder from 2D disk. And I have check the document source https://deepxde.readthedocs.io/en/latest/, but still don't know how to make it. Is there any other information I can refer to?
Use deepxde.geometry.pointcloud()
You need to supply the interior and boundary points, which is super easy. Create a linspace of x coordinates. define a function to return the y-coordinate of circle from the x coordinate and the radius (elementary school stuff).
Use a constant radius to generate the boundary points, set the radius to a random values to generate the interior points. Create a linspace of z coordinates for the height of the cylinder. Now use itertools.multiply to create a combination of the bc and the interior points for each z-coodinate. Now store the arrays and import them using the pointcloud function in deepxde.
Use deepxde.geometry.pointcloud()
You need to supply the interior and boundary points, which is super easy. Create a linspace of x coordinates. define a function to return the y-coordinate of circle from the x coordinate and the radius (elementary school stuff).
Use a constant radius to generate the boundary points, set the radius to a random values to generate the interior points. Create a linspace of z coordinates for the height of the cylinder. Now use itertools.multiply to create a combination of the bc and the interior points for each z-coodinate. Now store the arrays and import them using the pointcloud function in deepxde.
Thanks for your reply, praksharma. I will try it.
Hello, @praksharma
For a 3D cylinder, what would be the BC location function for the bottom wall (z = 0) ?
def bottom_wall(X, on_boundary):
return np.isclose(X[2], 0) and on_boundary
or
def bottom_wall(X, on_boundary):
bot = np.logical_and(np.logical_and(np.isclose(X[0] ** 2 + X[1] ** 2, radius ** 2), np.isclose(X[2], 0)),
on_boundary)
return bot