jdtoscano94 / Learning-Scientific_Machine_Learning_Residual_Based_Attention_PINNs_DeepONets

Physics Informed Machine Learning Tutorials (Pytorch and Jax)
466 stars 169 forks source link

An error occurs in SimpleODE #10

Open vivaldi370 opened 2 months ago

vivaldi370 commented 2 months ago

Thanks for your awesome work, but I found a few minor bugs in simpleODE.

First, the values x_BC and x_PDE are passed in the wrong places:

def loss(self,x_BC,x_PDE):
    ...
# train neural network
for i in range(steps):
    loss = model.loss(x_PDE,x_BC)# use mean squared error

However, def f_BC is

def f_BC(x):
  return torch.sin(x)

rather than

def f_BC(x):
  return torch.zeros_like(x)

So this code will still get the correct result when this error occurs. The code corrected by me has been uploaded as an attachment simple_ode.txt , which may explain this bug more clearly.