Trying to use PINN to solve to equations, however I only manages to solve one


I am using PINN to solve to hyperbolic PDEs. However, the solution to the first equation is the only solution that is close to a true solution, and the second equation is close, but not close enough. I have two boundary conditions. Only one of the conditions are met with the solution of the network. The second boundary condition is not met. I am not sure what code I should provide to make this question easier to answer. Please let me know, and also if I should provide equations.

What i don’t understand is why the network is able to provide a good solution to one of the equations but not the other. These equations are dependent on each other. So any suggestion of what I should look into or investigate more to solve this is highly appreciated.


I assume you are following the work by maziarraissi/PINNs. The main issue related here is that they use ‘soft constraint’ for satisfying boundary conditions and although it should work on paper, but when the boundary conditions make the loss landscape too complicated, model might not converge to a good solution at all. You can read about problems (and possible solutions) [2109.01050] (

One of the easiest way to deal with problem is that put more emphasize on the loss terms corresponding to boundary conditions using weighted sum. This ensures that the optimization won’t ignore the BCs if the they are hard to satisfy.

But in a more general sense, the more complicated the loss landscape gets (more complicated BCs), it becomes harder for the model the predict a good solution and mostly the solution predicted by model is too smooth (low frequency). To enable model to capture more details, a mapping from low-dimensional input to a higher dimension seems useful SIREN and FourFeat.

PS: If you are in a rush to try this out, don’t feel overwhelmed by the proofs and theories; you can easily intergrate their code into yours (source code if available by authors on github)


Thank you for your reply! I was starting to loose my head with this issue.
I will read the suggested literature and have a look at the suggested solutions. Thanks!