|
3 | 3 | # ## Aim
|
4 | 4 | # In this tutorial, your will learn how to use [Chmy](https://github.com/PTsolvers/Chmy.jl) to perform a 2D diffusion simulation
|
5 | 5 | # on one or multiple CPU's or GPU's.
|
6 |
| -# `Chmy` is a package that allows you to specify grids and fields and create finite difference simulations |
| 6 | +# `Chmy` is a package that allows you to specify grids and fields and create finite difference simulations, by |
| 7 | +# applying stencil-based kernels in an efficient manner. |
7 | 8 | #
|
8 | 9 | # ## 1. Load Chmy and required packages
|
9 | 10 | using Chmy, Chmy.Architectures, Chmy.Grids, Chmy.Fields, Chmy.BoundaryConditions, Chmy.GridOperators, Chmy.KernelLaunch
|
@@ -35,14 +36,14 @@ MPI.Init()
|
35 | 36 | q.y[I...] = -χ * ∂y(C, g, I...)
|
36 | 37 | end
|
37 | 38 |
|
38 |
| -# You need to specify compute kernel to update the concentration |
| 39 | +# You need to specify a compute kernel to update the concentration |
39 | 40 | @kernel inbounds = true function update_C!(C, q, Δt, g::StructuredGrid, O)
|
40 | 41 | I = @index(Global, NTuple)
|
41 | 42 | I = I + O
|
42 | 43 | C[I...] -= Δt * divg(q, g, I...)
|
43 | 44 | end
|
44 | 45 |
|
45 |
| -# And a main function is required: |
| 46 | +# And the main function is: |
46 | 47 | @views function main(backend=CPU(); nxy_l=(126, 126))
|
47 | 48 | arch = Arch(backend, MPI.COMM_WORLD, (0, 0))
|
48 | 49 | topo = topology(arch)
|
|
104 | 105 | # ```julia
|
105 | 106 | # add_box!(P,C,grid, xlim=(-1.0,1.0), zlim=(-1.0,1.0), phase=ConstantPhase(4), T=ConstantTemp(400))
|
106 | 107 | # ```
|
107 |
| -# which works just like any of the other GMG function. |
| 108 | +# which works just like any of the other GMG function, except that you pass Chmy Scalar Fields and a Chmy grid object. |
| 109 | +# Note that this also works in MPI-parallel. |
108 | 110 |
|
109 | 111 | # ## 3. Run the simulation on one CPU machine or GPU card:
|
110 | 112 |
|
|
0 commit comments