lululxvi / deepxde

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

Issue using PeriodicBC #821

Open ethanshoemaker opened 2 years ago

ethanshoemaker commented 2 years ago

I am having difficulty interpreting this error. Is anyone able to help me on this? I assume it should be an easy fix.

Traceback (most recent call last):
  File "/gen/home/eshoema1/single_passage_mallory_4.py", line 252, in <module>
    data = dde.data.PDE(geom, navier_stokes, bcs, num_domain = 40000, num_boundary = 5000, train_distribution = "pseudo")
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/data/pde.py", line 124, in __init__
    self.train_next_batch()
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/utils/internal.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/data/pde.py", line 173, in train_next_batch
    self.train_x = self.bc_points()
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/utils/internal.py", line 37, in wrapper
    return func(self, *args, **kwargs)
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/data/pde.py", line 260, in bc_points
    x_bcs = [bc.collocation_points(self.train_x_all) for bc in self.bcs]
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/data/pde.py", line 260, in <listcomp>
    x_bcs = [bc.collocation_points(self.train_x_all) for bc in self.bcs]
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/icbc/boundary_conditions.py", line 120, in collocation_points
    X2 = self.geom.periodic_point(X1, self.component_x)
  File "/gen/home/eshoema1/.local/lib/python3.9/site-packages/deepxde/geometry/geometry.py", line 65, in periodic_point
    raise NotImplementedError(
NotImplementedError: Polygon.periodic_point to be implemented
srun: error: gengpu02: task 0: Exited with exit code 1
lululxvi commented 2 years ago

"NotImplementedError: Polygon.periodic_point to be implemented"

ethanshoemaker commented 2 years ago

Hi Lu Lu, Thanks for the response. Does this mean periodicBC cannot be implemented for polygon geometry?

lululxvi commented 2 years ago

In general, yes, for example, how to define a periodic BC for a triangle?

But for special cases, it can be defined. But you need to implement case by case.

ethanshoemaker commented 2 years ago

Hi Lu Lu, Thank you for the response, I have begun to implement this by modifying the source code on my machine. I have a couple of questions regarding this. If, for example, I have a square geometry and I want periodic BC for y-direction (i.e. periodic for top and bottom), would I need my function periodic_point to include points on both of these boundaries or just one? Additionally, I have the same question for the argument 'on_boundary' into PeriodicBC. Should this include both boundaries or just 1? Thanks, Ethan

ethanshoemaker commented 2 years ago

Also, my losses from PeriodicBC are exactly 0. I am having a hard time understanding if this is correct or not?

lululxvi commented 2 years ago

would I need my function periodic_point to include points on both of these boundaries or just one?

Yes.

I have the same question for the argument 'on_boundary' into PeriodicBC. Should this include both boundaries or just 1?

Both boundaries.

my losses from PeriodicBC are exactly 0. I am having a hard time understanding if this is correct or not?

Then it might be not correct.