-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add tutorial for setting up a simulation #514
base: main
Are you sure you want to change the base?
Conversation
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. This also needs some suggestions for which modifications can be made to see some other results. For example moving the initial fluid up 0.1...
At the beginning of most simulation files, we define the numerical resolution, | ||
so that it can easily be found and changed. | ||
First, we import TrixiParticles.jl and | ||
[OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl), which we will | ||
use at the very end for the time integration. | ||
```jldoctest tut_setup; output = false | ||
using TrixiParticles | ||
using OrdinaryDiffEq |
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 needs:
- What does numerical resolution mean here?
- What is the common name that we use?
- What impact does that have?
- Concrete values for the example that you are discussing.
...
We also set the number of boundary layers, which need to be sufficiently | ||
large, depending on the smoothing kernel and smoothing length, so that | ||
the compact support of the smoothing kernel is fully sampled with particles | ||
for a fluid particle close to a boundary. |
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 would be much more concrete if you would just write compact_support < boundary layers and give here the common values for the compact support or how one can find them.
|
||
# output | ||
1000.0 | ||
``` |
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.
Add a drawing.
For stability, we need numerical dissipation in form of an artificial viscosity | ||
term. | ||
```jldoctest tut_setup; output = false | ||
viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) | ||
|
||
# output | ||
ArtificialViscosityMonaghan{Float64}(0.02, 0.0, 0.01) | ||
``` | ||
We choose the parameters as small as possible to avoid visible viscosity, | ||
but as large as possible to stabilize the simulation. |
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 is formulated in a way that the only reason to use this type of viscosity is for stability reasons, which is not true it needs to be set according to the viscosity of the fluid to be simulated. It should also be mentioned here that beta
is usually 0.0 in fluid simulations.
The WCSPH method can either compute the particle density by a kernel summation | ||
over all neighboring particles (see [`SummationDensity`](@ref)) or by making | ||
the particle density a variable in the ODE system and integrating it over time. | ||
We choose the latter approach here by using the density calculator | ||
[`ContinuityDensity`](@ref). |
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 should also shortly mention the pro/cons of these methods.
We will use the [`BoundaryModelDummyParticles`](@ref) with | ||
[`AdamiPressureExtrapolation`](@ref), which generally produces the best results | ||
of the implemented methods. |
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.
Since we don't know which methods will still be implemented this should be formulated more neutrally.
|
||
The key component of every simulation is the [`Semidiscretization`](@ref), | ||
which couples all systems of the simulation. | ||
All methods in TrixiParticles.jl are semidiscretizations, which discretize |
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.
All methods
? That is a bit too general.
``` | ||
|
||
See [Visualization](@ref) for how to visualize the solution. | ||
|
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.
Add image here
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 a lot!
It would be nice to have a sketch of the tank at the very beginning. Also, a short description (or also sketch?) how we usually structure our example files.
|
||
``` | ||
Now, we define the particle spacing, which is our numerical resolution. | ||
We also set the number of boundary layers, which need to be sufficiently | ||
large, depending on the smoothing kernel and smoothing length, so that |
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.
link to the corresponding doc section
First, we import TrixiParticles.jl and | ||
[OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl), which we will | ||
use at the very end for the time integration. |
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.
put this somewhere above the section ## Resolution
?
|
||
For different setups and physics, have a look at [our other example files](@ref examples). |
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.
Maybe explain how we usually structure our example files. Resolution, experiment setup, ...
First, we define the physical parameters gravitational acceleration, | ||
initial fluid size, tank size, fluid density, and simulation time. |
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.
First, we define the physical parameters gravitational acceleration, | |
initial fluid size, tank size, fluid density, and simulation time. | |
First, we define the physical parameters gravitational acceleration, simulation time, initial fluid size, tank size and fluid density. |
hydrostatic pressure gradient, we need to define a state equation, which | ||
relates the fluid density to pressure. |
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.
link to docs?
In order to define a boundary system, we first have to choose a boundary model, | ||
which defines how the fluid interacts with boundary particles. | ||
We will use the [`BoundaryModelDummyParticles`](@ref) with |
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.
It might make sense to mention that the BC in SPH are modeled numerically with particles instead of having an analytical described surface
information about the current simulation time and runtime during the simulation, | ||
and a performance summary at the end of the simulation. | ||
We also want to save the current solution in regular intervals in terms of | ||
simulation time as VTK, so that we can look at the solution in ParaView. |
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.
link to the visualization section
simulation time as VTK, so that we can look at the solution in ParaView. | ||
The [`SolutionSavingCallback`](@ref) provides this functionality. | ||
To pass the callbacks to OrdinaryDiffEq.jl, we have to bundle them into a | ||
`CallbackSet`. |
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.
link CallbackSet
to the corresponding doc page in SciML?
Finally, we can start the simulation by solving the `ODEProblem`. | ||
We use the method `RDPK3SpFSAL35` of OrdinaryDiffEq.jl, which is a Runge-Kutta |
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.
links?
# output | ||
|
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.
maybe add something like plot(my_kernel)
to visualize the Kernel in 1D (or more fancy in 2D)?
Find the rendered page here:
https://trixi-framework.github.io/TrixiParticles.jl/previews/PR514/tutorials/tut_setup_replaced/