Open
Conversation
Add a forward 1D wave equation example complementing the existing inverse wave equation. Solves u_tt = c^2 * u_xx on [0,1] x [0,1] with fixed-end BCs, sinusoidal initial displacement, and zero initial velocity using the built-in WaveNode PDE. Includes initial displacement, initial velocity, and boundary conditions as separate sample domains, inference with exact solution comparison, and L2 error computation.
There was a problem hiding this comment.
Pull request overview
Adds a new forward-solve example for the 1D wave equation to complement the existing inverse wave equation example, demonstrating how to set up interior PDE constraints, initial conditions, and boundary conditions with IDRLnet.
Changes:
- Added
examples/wave_equation/wave_equation.pyimplementing a forward wave-equation PINN workflow (training, inference, exact-solution comparison, plots, L2 error). - Added
examples/wave_equation/readme.mdwith problem statement and usage instructions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| examples/wave_equation/wave_equation.py | New forward wave-equation example script using WaveNode, including visualization and error reporting. |
| examples/wave_equation/readme.md | Documentation for running and understanding the new example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| Exact solution: u(x, t) = sin(pi * x) * cos(pi * c * t) | ||
| """ | ||
|
|
||
| from sympy import Symbol, sin, cos, pi |
There was a problem hiding this comment.
cos is imported from sympy but not used anywhere in this script. Consider removing it to avoid unused-import lint failures and keep dependencies minimal.
Suggested change
| from sympy import Symbol, sin, cos, pi | |
| from sympy import Symbol, sin, pi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a forward wave equation example, complementing the existing inverse wave equation example.
Problem
The 1D wave equation u_tt = c^2 * u_xx on [0, 1] x [0, 1] with:
Analytical solution: u(x, t) = sin(pi * x) * cos(pi * c * t)
What's included
examples/wave_equation/wave_equation.py: Complete forward problem using the built-inWaveNode, with:examples/wave_equation/readme.md: Usage instructionsMotivation
The existing
inverse_wave_equationexample shows parameter inference but there is no forward problem example for the wave equation. The wave equation is one of the most fundamental PDEs in physics (acoustics, electromagnetics, seismology), so having a forward example helps users understand IDRLnet's PDE-solving capability for hyperbolic equations.