Skip to content

Commit

Permalink
more tutorial corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskaus committed Oct 10, 2024
1 parent da6d06b commit 610b57b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions docs/src/man/Tutorial_Chmy_MPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ EditURL = "../../../tutorials/Tutorial_Chmy_MPI.jl"
## Aim
In this tutorial, your will learn how to use [Chmy](https://github.com/PTsolvers/Chmy.jl) to perform a 2D diffusion simulation
on one or multiple CPU's or GPU's.
`Chmy` is a package that allows you to specify grids and fields and create finite difference simulations
`Chmy` is a package that allows you to specify grids and fields and create finite difference simulations, by
applying stencil-based kernels in an efficient manner.

## 1. Load Chmy and required packages

Expand Down Expand Up @@ -46,7 +47,7 @@ You need to specify compute kernel for the gradients:
end
```

You need to specify compute kernel to update the concentration
You need to specify a compute kernel to update the concentration

```julia
@kernel inbounds = true function update_C!(C, q, Δt, g::StructuredGrid, O)
Expand All @@ -56,7 +57,7 @@ You need to specify compute kernel to update the concentration
end
```

And a main function is required:
And the main function is:

```julia
@views function main(backend=CPU(); nxy_l=(126, 126))
Expand Down Expand Up @@ -121,7 +122,8 @@ In the code above, the part that calls `GMG` is:
```julia
add_box!(P,C,grid, xlim=(-1.0,1.0), zlim=(-1.0,1.0), phase=ConstantPhase(4), T=ConstantTemp(400))
```
which works just like any of the other GMG function.
which works just like any of the other GMG function, except that you pass Chmy Scalar Fields and a Chmy grid object.
Note that this also works in MPI-parallel.

## 3. Run the simulation on one CPU machine or GPU card:

Expand Down
10 changes: 6 additions & 4 deletions tutorials/Tutorial_Chmy_MPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# ## Aim
# In this tutorial, your will learn how to use [Chmy](https://github.com/PTsolvers/Chmy.jl) to perform a 2D diffusion simulation
# on one or multiple CPU's or GPU's.
# `Chmy` is a package that allows you to specify grids and fields and create finite difference simulations
# `Chmy` is a package that allows you to specify grids and fields and create finite difference simulations, by
# applying stencil-based kernels in an efficient manner.
#
# ## 1. Load Chmy and required packages
using Chmy, Chmy.Architectures, Chmy.Grids, Chmy.Fields, Chmy.BoundaryConditions, Chmy.GridOperators, Chmy.KernelLaunch
Expand Down Expand Up @@ -35,14 +36,14 @@ MPI.Init()
q.y[I...] = -χ * ∂y(C, g, I...)
end

# You need to specify compute kernel to update the concentration
# You need to specify a compute kernel to update the concentration
@kernel inbounds = true function update_C!(C, q, Δt, g::StructuredGrid, O)
I = @index(Global, NTuple)
I = I + O
C[I...] -= Δt * divg(q, g, I...)
end

# And a main function is required:
# And the main function is:
@views function main(backend=CPU(); nxy_l=(126, 126))
arch = Arch(backend, MPI.COMM_WORLD, (0, 0))
topo = topology(arch)
Expand Down Expand Up @@ -104,7 +105,8 @@ end
# ```julia
# add_box!(P,C,grid, xlim=(-1.0,1.0), zlim=(-1.0,1.0), phase=ConstantPhase(4), T=ConstantTemp(400))
# ```
# which works just like any of the other GMG function.
# which works just like any of the other GMG function, except that you pass Chmy Scalar Fields and a Chmy grid object.
# Note that this also works in MPI-parallel.

# ## 3. Run the simulation on one CPU machine or GPU card:

Expand Down

0 comments on commit 610b57b

Please sign in to comment.