- Ensure periodic boundary conditions are handled correctly for both 𝑈 and its derivative. In the loss function, enforce both U(x=L1,t)=U(x=L2,t) and dU/dx(x=L1,t)=dU/dx(x=L2,t) properly. You might need a small penalty term for BC violations.
- Check if the time step dt and space step dx satisfy the CFL condition for stability. You might need to reduce “dt” or increase “numInternalCollocationPoints” to improve accuracy.
- LBFGS might not be ideal for PINNs. Try using the "Adam optimizer", which is often more effective for training neural networks in this context. You can read more about "Adam optimizer" here: https://www.mathworks.com/matlabcentral/fileexchange/127843-understanding-the-adam-optimization-algorithm
Physics informed Neural Network - Periodic Boundary condition
43 views (last 30 days)
Show older comments
Dear Matlab Community Members,
I am working on implementing physics-informed neural networks (PINNs) in MATLAB to solve the Allen-Cahn equation with periodic boundary conditions. The equation is as follows:
Ut=alpha*Uxx+5U-5U^3; with Periodic BCs U(X=L1,t)=U(X=L2,t) and dU/dx(X=L1,t)=dU/dx(X=L2,t) and Ics T(X,t=0)=x.*x.*cos(pi*x);where alpha=0.001;
I have written a PINN-based MATLAB code to solve this, but the predicted results are not matching the target results. I suspect there might be issues with either the implementation of the periodic boundary conditions, the loss function, or the numerical settings.
I have attached my code for reference. If anyone has experience with PINNs or solving PDEs with periodic boundary conditions in MATLAB, I would greatly appreciate your help in identifying and fixing the issue.
Thank you for your time and support!
Best regards,
Shankar
0 Comments
Answers (1)
Ayush
on 29 Nov 2024 at 6:44
I understand you are facing issues with the output of your MATLAB code.
Your MATLAB code for implementing a Physics-Informed Neural Network (PINN) to solve the Allen-Cahn equation looks mostly well-structured. However, there are a few aspects that could be contributing to the discrepancy between your predicted and target results. Let me offer suggestions for improvement:
By addressing these points, you should improve your model's accuracy and training stability.
Hope it helps!
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!