Skip to content

Commit c4d3500

Browse files
authored
Merge pull request #164 from WaterLily-jl/youtube_link
Updated YouTube link
2 parents f44ef6d + 6b5c7c5 commit c4d3500

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
**WaterLily.jl** is a simple and fast fluid simulator written in pure Julia. This project is supported by awesome libraries developed within the Julia scientific community, and it aims to accelerate and enhance fluid simulations. Watch the JuliaCon2024 talk here:
1313

14-
[![JuliaCon2024 still and link](assets/JuliaCon2024.png)](https://www.youtube.com/live/qru5G5Yp77E?t=29074s)
14+
[![JuliaCon2024 still and link](assets/JuliaCon2024.png)](https://www.youtube.com/watch?v=FwMh2rq9kOU)
1515

1616
If you have used WaterLily for research, please __cite us__! The [2024 paper](https://physics.paperswithcode.com/paper/waterlily-jl-a-differentiable-and-backend) describes the main features of the solver and provides benchmarking, validation, and profiling results.
1717
```
@@ -42,14 +42,14 @@ function circle(n,m;Re=100,U=1)
4242
radius, center = m/8, m/2-1
4343
sdf(x,t) = sum(abs2, x .- center) - radius
4444

45-
Simulation((n,m), # domain size
45+
Simulation((n,m), # domain size
4646
(U,0), # domain velocity (& velocity scale)
4747
2radius; # length scale
48-
ν=U*2radius/Re, # fluid viscosity
48+
ν=U*2radius/Re, # fluid viscosity
4949
body=AutoBody(sdf)) # geometry
5050
end
5151
```
52-
The circle geometry is defined using a [signed distance function](https://en.wikipedia.org/wiki/Signed_distance_function#Applications). The `AutoBody` function uses [automatic differentiation](https://github.com/JuliaDiff/) to infer the other geometric parameters of the body automatically. Replace the circle's distance function with any other, and now you have the flow around something else... such as a [donut](https://github.com/WaterLily-jl/WaterLily-Examples/blob/main/examples/ThreeD_Donut.jl) or the [Julia logo](https://github.com/WaterLily-jl/WaterLily-Examples/blob/main/examples/TwoD_Julia.jl). For more complex geometries, [ParametricBodies.jl](https://github.com/WaterLily-jl/ParametricBodies.jl) defines a `body` using any parametric curve, such as a spline. See that repo (and the video above) for examples.
52+
The circle geometry is defined using a [signed distance function](https://en.wikipedia.org/wiki/Signed_distance_function#Applications). The `AutoBody` function uses [automatic differentiation](https://github.com/JuliaDiff/) to infer the other geometric parameters of the body automatically. Replace the circle's distance function with any other, and now you have the flow around something else... such as a [donut](https://github.com/WaterLily-jl/WaterLily-Examples/blob/main/examples/ThreeD_Donut.jl) or the [Julia logo](https://github.com/WaterLily-jl/WaterLily-Examples/blob/main/examples/TwoD_Julia.jl). For more complex geometries, [ParametricBodies.jl](https://github.com/WaterLily-jl/ParametricBodies.jl) defines a `body` using any parametric curve, such as a spline. See that repo (and the video above) for examples.
5353

5454
The code block above return a `Simulation` with the parameters we've defined. Now we can initialize a simulation (first line) and step it forward in time (second line)
5555
```julia
@@ -66,9 +66,9 @@ contourf(u') # transpose the array for the plot
6666
```
6767
![Initial velocity field](assets/u0.png)
6868

69-
As you can see, the velocity within the circle is zero, the velocity far from the circle is one, and there are accelerated and decelerated regions around the circle. The `sim_step!` has only taken a single time step, and this initial flow around our circle looks similar to the potential flow because the viscous boundary layer has not separated yet.
69+
As you can see, the velocity within the circle is zero, the velocity far from the circle is one, and there are accelerated and decelerated regions around the circle. The `sim_step!` has only taken a single time step, and this initial flow around our circle looks similar to the potential flow because the viscous boundary layer has not separated yet.
7070

71-
A set of [flow metric functions](https://github.com/WaterLily-jl/WaterLily.jl/blob/master/src/Metrics.jl) have been implemented, and we can use them to measure the simulation. The following code block defines a function to step the simulation to time `t` and then use the `pressure_force` metric to measure the force on the immersed body. The function is applied over a time range, and the forces are plotted.
71+
A set of [flow metric functions](https://github.com/WaterLily-jl/WaterLily.jl/blob/master/src/Metrics.jl) have been implemented, and we can use them to measure the simulation. The following code block defines a function to step the simulation to time `t` and then use the `pressure_force` metric to measure the force on the immersed body. The function is applied over a time range, and the forces are plotted.
7272
```Julia
7373
function get_forces!(sim,t)
7474
sim_step!(sim,t,remeasure=false)
@@ -81,7 +81,7 @@ time = 1:0.1:50 # time scale is sim.L/sim.U
8181
forces = [get_forces!(circ,t) for t in time];
8282

8383
#Plot it
84-
plot(time,[first.(forces), last.(forces)],
84+
plot(time,[first.(forces), last.(forces)],
8585
labels=permutedims(["drag","lift"]),
8686
xlabel="tU/L",
8787
ylabel="Pressure force coefficients")
@@ -109,7 +109,7 @@ As you can see, WaterLily correctly predicts that the flow is unsteady, with an
109109

110110
WaterLily uses [KernelAbstractions.jl](https://github.com/JuliaGPU/KernelAbstractions.jl) to multi-thread on CPU and run on GPU backends. The implementation method and speed-up are documented in the [2024 paper](https://physics.paperswithcode.com/paper/waterlily-jl-a-differentiable-and-backend), with costs as low as 1.44 nano-seconds measured per degree of freedom and time step!
111111

112-
Note that multi-threading requires _starting_ Julia with the `--threads` argument, see [the multi-threading section](https://docs.julialang.org/en/v1/manual/multi-threading/) of the manual. If you are running Julia with multiple threads, KernelAbstractions will detect this and multi-thread the loops automatically.
112+
Note that multi-threading requires _starting_ Julia with the `--threads` argument, see [the multi-threading section](https://docs.julialang.org/en/v1/manual/multi-threading/) of the manual. If you are running Julia with multiple threads, KernelAbstractions will detect this and multi-thread the loops automatically.
113113

114114
Running on a GPU requires initializing the `Simulation` memory on the GPU, and care needs to be taken to move the data back to the CPU for visualization. As an example, let's compare a **3D** GPU simulation of a sphere to the **2D** multi-threaded CPU circle defined above
115115
```Julia
@@ -123,7 +123,7 @@ function sphere(n,m;Re=100,U=1,T=Float64,mem=Array)
123123
mem) # memory type
124124
end
125125

126-
@assert CUDA.functional() # is your CUDA GPU working??
126+
@assert CUDA.functional() # is your CUDA GPU working??
127127
GPUsim = sphere(3*2^5,2^6;T=Float32,mem=CuArray); # 3D GPU sim!
128128
println(length(GPUsim.flow.u)) # 1.3M degrees-of freedom!
129129
sim_step!(GPUsim) # compile GPU code & run one step

assets/JuliaCon2024.png

-13.6 KB
Loading

0 commit comments

Comments
 (0)