deepxde icon indicating copy to clipboard operation
deepxde copied to clipboard

Define BC, Periodic BC and Dirichlet condition, meaning on components_x and component argument.

Open camolina2 opened this issue 2 years ago • 7 comments

Hi Lulu,

Thank you so much for such amazing library!

I will really appreciate if you can help me to define my problem.

The domain of my problem is: x_min = np.array([-180, -90]) x_max = np.array([180, 90]) geometry_rectangle = dde.geometry.geometry_2d.Rectangle(x_min, x_max)

What I am trying to do is the next conditions:

conditions

what I did is the next:

def periodic_boundary(x, domain): return domain and (np.isclose(x[0], -180) or np.isclose(x[0], 180))

periodic_condition = dde.PeriodicBC(geometry_rectangle, 0, periodic_boundary, derivative_order= 0) periodic_condition_derivate = dde.PeriodicBC(geometry_rectangle, 0, periodic_boundary, derivative_order=1)

def space_boundary(x, on_boundary): print(on_boundary and (np.isclose(x[1], -90) or np.isclose(x[1], 90))) return on_boundary and (np.isclose(x[1], -90) or np.isclose(x[1], 90))

def u_north(x): return (-13)

def u_south(x): return (13)

boundary_condition_north = dde.DirichletBC(geometry_rectangle, u_north, lambda _, on_boundary: on_boundary, component= 0) boundary_condition_south = dde.DirichletBC(geometry_rectangle, u_south, lambda _, on_boundary: on_boundary, component= 0)

I am very very confused with the argument "component" and "component_x".

I think @Fayaud and @forxltk were talking about this in another issue. If anyone can help me I will be so happy!

Thank you in advance!

camolina2 avatar May 30 '22 12:05 camolina2

component means the component of the output of the network.

lululxvi avatar May 31 '22 21:05 lululxvi

Thank you so much! So just to be sure, If I have 1D output, always I have component = 0, right?

On the another hand, what is the meaning of component_x?

for example in:

periodic_condition = dde.PeriodicBC(geometry_rectangle, 0, periodic_boundary, derivative_order= 0)

component_x = 0

Thank you so much in advice

camolina2 avatar Jun 01 '22 10:06 camolina2

Thank you so much! So just to be sure, If I have 1D output, always I have component = 0, right?

Yes.

On the another hand, what is the meaning of component_x?

for example in:

periodic_condition = dde.PeriodicBC(geometry_rectangle, 0, periodic_boundary, derivative_order= 0)

component_x = 0

0 means the solution is periodic in the first coordinate direction.

lululxvi avatar Jun 03 '22 19:06 lululxvi

Thank you always help me Lulu, I really hope you can help me with my problem

I have a 2D problem and I have periodic boundary conditions in the axis y. When x=-1 and x=1

def periodic_boundary(x, domain): return domain and (np.isclose(-1, x[0], rtol=1e-02 )) or (np.isclose(1, x[0], rtol=1e-02 ))

periodic_condition = dde.PeriodicBC(geometry_rectangle, 1, periodic_boundary, derivative_order= 0) periodic_condition_derivate = dde.PeriodicBC(geometry_rectangle, 1, periodic_boundary, derivative_order=1)

The thing is that when I put component = 1 then the loss function that I have in the axis es always 0, and I can't understand why.

Also I wanted to ask you, How can I implement hard periodic boundary conditions?

Thank you sooo much in advance!

camolina2 avatar Jul 11 '22 09:07 camolina2

periodic boundary conditions in the x direction or y direction?

lululxvi avatar Jul 14 '22 21:07 lululxvi

Thank you so much for your quick response.

The periodic boundary conditions are in the y direction. I mean, $u(x=-1, y ) = u(x=1, y)$.

Thank you sooo much!

camolina2 avatar Jul 16 '22 15:07 camolina2

  • This is periodic for x, so component_x = 0.
  • See https://doi.org/10.1137/21M1397908 for hard periodic BC.

lululxvi avatar Jul 19 '22 23:07 lululxvi

@camolina2 Hello, your variable range is (- 180,180). Do you need to rescale to (- 1,1) when inputting the network? If so, could you tell me how to do it?

Little7776 avatar Sep 27 '22 07:09 Little7776