-
-
Notifications
You must be signed in to change notification settings - Fork 129
New tutorial: Partitioned Burgers eq. 1D #670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| @@ -0,0 +1,142 @@ | |||
| --- | |||
| title: Partitioned 1D Burgers' Equation | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| title: Partitioned 1D Burgers' Equation | |
| title: Partitioned Burgers' equation 1D |
| - **Dirichlet**: Solves the left half $[0,1]$ and receives Dirichlet boundary conditions at the interface. | ||
| - **Neumann**: Solves the right half $[1,2]$ and receives Neumann boundary conditions at the interface. | ||
|
|
||
| Both outer boundaries use zero-gradient conditions $\frac{\partial u}{\partial x} = 0$. The problem is solved for different initial conditions of superimposed sine waves, which can be generated using the provided script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which script, how/when do I need to run it?
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This information goes into subsection "Available solvers"
| </p> | ||
|
|
||
|
|
||
| ## Running the tutorial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Running the tutorial | |
| ## Running the simulation |
| ```bash | ||
| python3 generate_ic.py --epoch <seed> | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really a script that is general to all solvers? (otherwise, put in subfolders)
still, a tools subfolder could be good`
| # sol = solve_ivp(wrapper.rhs, (t, t_end), u, method='BDF', t_eval=[t_end], jac=wrapper.jac) # BDF higher order implicit timestepping | ||
| # u = sol.y[:, -1] | ||
| # u = u + dt * burgers_rhs(t, u, dx, C_viscosity, wrapper.bc_left(u), wrapper.bc_right(u)) # Explicit Euler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this commented-out code? If yes, could we make this configurable (i.e. testable)?
| <!-- <acceleration:constant> | ||
| <relaxation value="0.01" /> | ||
| </acceleration:constant> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <!-- <acceleration:constant> | |
| <relaxation value="0.01" /> | |
| </acceleration:constant> --> |
| . ../../tools/log.sh | ||
| exec > >(tee --append "$LOGFILE") 2>&1 | ||
|
|
||
| echo "[preCICE] Waiting for Dirichlet participant..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to log this. preCICE should do this, no?
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compare how other tutorials do this.
| set -e -u | ||
|
|
||
| rm -f solver-scipy/full_domain.npz | ||
| rm -f images/full_domain_evolution.png images/full_domain_timestep_slice.png images/gradient_timestep_slice.png images/initial_condition.png |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move those results to output/?
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.