The inner domain is a complex geometry defined by geometry.pointcloud.PointCloud(), as is shown below:
The outer domain is a rectangle defined by geometry.geometry_2d.Rectangle(). Thus, the expected output domain should be
(outer domain - inner domain). However, it looks like the geometry.csg.CSGDifference() function does not work at all since only outer domain is generated, as is shown below:
My question here is how to generate the correct geometry. Many thanks for answer my question!
Dear all: I am generating a complex domain via geometry.csg.CSGDifference() function, here is my code:
import numpy as np import pandas as pd from matplotlib import pyplot as plt from scipy import interpolate as inter import deepxde as dde
def geom_generation(xmin, ymin, xmax, ymax, points, num_inner, num_outer, ref_l = 1, offset_x = 0, offset_y = 0, is_save = False): farfield = dde.geometry.geometry_2d.Rectangle([xmin, ymin], [xmax, ymax]) # outer domain points = np.divide(points, ref_l) mat = np.hstack([np.full((points.shape[0],1), offset_x), np.full((points.shape[0],1), offset_y)]) points = points + mat fossil = dde.geometry.pointcloud.PointCloud(points) # generate inner domain geom = dde.geometry.csg.CSGDifference(farfield, fossil) # outer - inner inner_points = geom.random_points(num_inner) farfield_points = farfield.random_boundary_points(num_outer) geom_points = np.append(inner_points, farfield_points, axis = 0) plt.figure(figsize=(20,10), dpi = 500) plt.scatter(geom_points[:, 0], geom_points[:, 1], 0.1)
plt.scatter(points[:, 0], points[:, 1], 0.1)
print(points.shape) plt.figure(figsize=(10,5), dpi = 300) plt.scatter(points[:, 0], points[:, 1], 0.5) plt.axis('equal')
num_inner, num_outer = 40000, 10000
xmin, xmax = -1.0, 1.0 # define outer domain ymin, ymax = -0.5, 0.5
ref_l, offset_x, offset_y = 1, -0, 0 geom_generation(xmin, ymin, xmax, ymax, points, num_inner, num_outer, ref_l, offset_x, offset_y, False)
The inner domain is a complex geometry defined by geometry.pointcloud.PointCloud(), as is shown below:
The outer domain is a rectangle defined by geometry.geometry_2d.Rectangle(). Thus, the expected output domain should be
(outer domain - inner domain). However, it looks like the geometry.csg.CSGDifference() function does not work at all since only outer domain is generated, as is shown below:
![image](https://github.com/lululxvi/deepxde/assets/130856019/635352c8-ab38-4c68-95e1-aa473a104662)
My question here is how to generate the correct geometry. Many thanks for answer my question!