deepxde icon indicating copy to clipboard operation
deepxde copied to clipboard

How to build a cylinder from 2D disk?

Open leafcai opened this issue 2 years ago • 2 comments

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?

leafcai avatar Feb 15 '23 08:02 leafcai

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.

praksharma avatar Feb 20 '23 13:02 praksharma

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.

leafcai avatar Feb 24 '23 09:02 leafcai

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

bakhtiyar-k avatar May 18 '24 06:05 bakhtiyar-k