Conversation
… in visualize_partitioned_domain.py. Wrap boundary conditions in new class BoundaryWrapper because they are dependent on the solver iterations. Implement implicit Euler (and Jacobian and residual for the root finding iteration. Initialize participants. Zero gradient condition on the outside boundaries.
…-surrogate.sh, generate-training-data.sh. Fix floating point issue in t_index. Add --savefile argument to solver-scipy-fvolumes.py to save data for training.
…n scripts. Fix requirements.txt for scipy and surrogate solvers. Add example images for README
…ipt to check for initial conditions after installing environment.
uekerman
left a comment
There was a problem hiding this comment.
Thanks for the very nice addition already! I only had brief look in this first iteration and did not yet try to run things. Please see comments below.
Let's indeed remove the Nutils solver. Could always be added later again.
| rm -rf precice-profiling | ||
| rm -f neumann-surrogate.log precice-Neumann-convergence.log precice-Neumann-iterations.log | ||
| rm -f surrogate.npz No newline at end of file |
There was a problem hiding this comment.
Compare how other tutorials do this.
There was a problem hiding this comment.
Renamed clean.sh to clean-tutorial.sh. But should it be symlinked to clean-tutorial-base.sh? I need these additional commands.
There was a problem hiding this comment.
Use tooling in ../tools/cleaning-tools.sh and add a function there if necessary.
…arate from images directory.
… versions in requirements. Remove commented out code from solvers.
uekerman
left a comment
There was a problem hiding this comment.
I was able to run the cases and got meaningful results. We are probably close to merging this. Mainly cosmetics now.
I think a few scripts of utils could go into solver-scipy. Only keep those in utils that are used by neumann-surrogate as well.
| @@ -0,0 +1 @@ | |||
| New tutorial case: Partitioned Burgers' Equation in 1D solved with Finite Volumes and a Neural Network surrogate model ! | |||
There was a problem hiding this comment.
| New tutorial case: Partitioned Burgers' Equation in 1D solved with Finite Volumes and a Neural Network surrogate model ! | |
| - Added new case: 1D partitioned Burgers' equation with one finite volume and one NN surrogate participant. |
|
|
||
| --- |
There was a problem hiding this comment.
| --- |
Not used in the docs, but should also not be necessary here.
| The conservative formulation of the Burgers' equation `solver-scipy` is implemented in a first-order finite volume code using Lax-Friedrichs fluxes and implicit Euler time stepping. | ||
|
|
||
| This tutorial includes two versions for the Neumann participant: | ||
|
|
||
| - A standard finite volume solver (`neumann-scipy`). | ||
| - A pre-trained neural network surrogate that approximates the solver (`neumann-surrogate`). |
There was a problem hiding this comment.
| The conservative formulation of the Burgers' equation `solver-scipy` is implemented in a first-order finite volume code using Lax-Friedrichs fluxes and implicit Euler time stepping. | |
| This tutorial includes two versions for the Neumann participant: | |
| - A standard finite volume solver (`neumann-scipy`). | |
| - A pre-trained neural network surrogate that approximates the solver (`neumann-surrogate`). | |
| Currently, the SciPy solver can be used for both side, the NN surrogate solver only for the Neumann side. | |
| - SciPy. Simple finite volume solver using Lax-Friedrichs fluxes and implicit Euler time stepping. | |
| - Surrogate. Pre-trained neural network surrogate. |
To be consistent with other tutorials.
TODO: It would be nice to write a few more words on the surrogate here.
| <p align="center"> | ||
| <img src="images/tutorials-partitioned-burgers-1d-precice-config.png" alt="preCICE configuration visualization" width="600"/> | ||
| </p> |
There was a problem hiding this comment.
I don't think we need html for the images in the README, we normally don't use it here.
| <p align="center"> | |
| <img src="images/tutorials-partitioned-burgers-1d-precice-config.png" alt="preCICE configuration visualization" width="600"/> | |
| </p> | |
|  |
Similarly everywhere here.
| <img src="images/tutorials-partitioned-burgers-1d-precice-config.png" alt="preCICE configuration visualization" width="600"/> | ||
| </p> | ||
|
|
||
| ## Available Solvers |
There was a problem hiding this comment.
| ## Available Solvers | |
| ## Available solvers |
| <img src="images/tutorials-partitioned-burgers-1d-full-domain-timestep-slice.png" alt="Full Domain Timestep Slice" width="400"/> | ||
| </p> | ||
|
|
||
| - `gradient-timestep-slice.png`: Gradient $du/dx$ at a selected timestep |
There was a problem hiding this comment.
| - `gradient-timestep-slice.png`: Gradient $du/dx$ at a selected timestep | |
| - `gradient-timestep-slice.png`: Gradient $du/dx$ at the selected timestep |
| ## Visualization | ||
|
|
||
| After both participants (and/or monolithic simulation) have finished, you can run the visualization script. | ||
| `visualize_partitioned_domain.py` generates plots comparing the partitioned and monolithic solutions. You can specify which timestep to plot: |
There was a problem hiding this comment.
| `visualize_partitioned_domain.py` generates plots comparing the partitioned and monolithic solutions. You can specify which timestep to plot: | |
| `visualize_partitioned_domain.py` generates plots comparing the partitioned and monolithic solutions. You can specify which timestep to plot. Call from the root of the tutorial: |
| `visualize_partitioned_domain.py` generates plots comparing the partitioned and monolithic solutions. You can specify which timestep to plot: | ||
|
|
||
| ```bash | ||
| python3 visualize_partitioned_domain.py --neumann neumann-surrogate/surrogate.npz [timestep] |
There was a problem hiding this comment.
| python3 visualize_partitioned_domain.py --neumann neumann-surrogate/surrogate.npz [timestep] | |
| python3 utils/visualize_partitioned_domain.py --neumann neumann-surrogate/surrogate.npz [timestep] |
| pyprecice==3.3.1 | ||
| scipy==1.16.3 | ||
| matplotlib==3.10.8 | ||
| torch==2.9.1 No newline at end of file |
There was a problem hiding this comment.
Is there a variant to get PyTorch without all GPU builds? Just to make it smaller here.
| ## Visualization | ||
|
|
||
| After both participants (and/or monolithic simulation) have finished, you can run the visualization script. | ||
| `visualize_partitioned_domain.py` generates plots comparing the partitioned and monolithic solutions. You can specify which timestep to plot: |
There was a problem hiding this comment.
How can I compare partitioned and monolithic solutions? If I just run it after one setup, I only get that one setup.
New tutorial case: Partitioned Burgers' Equation in 1D solved with SciPy Finite Volume implementation and a Neural Network surrogate model !
Checklist:
changelog-entries/<PRnumber>.md.