lululxvi / deepxde

A library for scientific machine learning and physics-informed learning
https://deepxde.readthedocs.io
GNU Lesser General Public License v2.1
2.64k stars 739 forks source link

Ignoring a boundary condition if it is included in the geometry? #500

Closed hildeiren closed 2 years ago

hildeiren commented 2 years ago

Hi, I am trying to solve a set of equations by using DeepXDE, that have these boundary conditions:

F(x, x) = -0.5 b exp(-gamma x) G(x, 0) = q F(x, 0)

Where the domain for the solution is a triangle with edges (0,0), (1,0) and (1,1), and D = {(x,y): 0 =< y =< x =< 1}.

I am wondering if the second boundary condition would be redundant because of dde.geometry.Triangle(), or should I include it in the code? The second boundary condition is on the x-axis.

geom = dde.geometry.Triangle([0,0], [1,0], [1,1]) timedomain = dde.geometry.TimeDomain(0, 1) geomtime = dde.geometry.GeometryXTime(geom, timedomain)

def bc_diagonal(): x = diagonal_points[:, 0] return -0.5 b np.exp(gamma * x)

def boundary_triangle(x, on_boundary): return on_boundary and triangle.on_boundary(x)

bc = dde.OperatorBC(geom, bc_diagonal, boundary_triangle) data = dde.data.TimePDE( geomtime, pde, bc, num_domain=2540, num_boundary=80, num_initial=0)

lululxvi commented 2 years ago

I didn't quite get your question.

hildeiren commented 2 years ago

Sorry, I will try to explain it better. I have two boundary conditions. One on the diagonal: F(x, x) = -0.5 b exp(-gamma x) And one on the x-axis: G(x, 0) = q F(x, 0).

The solution will belong to a domain that will have the shape of triangle. And so I define this as: geom = dde.geometry.Triangle([0,0], [1,0], [1,1]) I am wondering if this will make the second boundary condition on the x-axis redundant, since it might overlap with the domain already defined in geom?

lululxvi commented 2 years ago

I don't see why the second BC is redundant, because It is on the boundary of the triangle.