Skip to content

Commit

Permalink
Update forcing function model setup documentation (#604)
Browse files Browse the repository at this point in the history
Update forcing function model setup documentation
  • Loading branch information
ali-ramadhan committed Jan 31, 2020
2 parents 8d1b164 + 1baef0f commit 88a4f8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Oceananigans"
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
version = "0.19.0"
version = "0.20.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
12 changes: 6 additions & 6 deletions docs/src/model_setup/forcing_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ tracer evolution equations.

Forcing functions will be called with the signature
```
f(i, j, k, grid, t, U, C, params)
f(i, j, k, grid, t, U, C, p)
```
where `i, j, k` is the grid index, `grid` is `model.grid`, `t` is the `model.clock.time`, `U` is the named tuple
`model.velocities`, `C` is the named tuple `C.tracers`, and `params` is the user-defined `model.parameters`.
`model.velocities`, `C` is the named tuple `C.tracers`, and `p` is the user-defined `model.parameters`.

Once you have defined all the forcing functions needed by the model, `ModelForcing` can be used to create a named tuple
of forcing functions that can be passed to the `Model` constructor.
Expand All @@ -25,11 +25,11 @@ const τ⁻¹ = 1 / 60 # Damping/relaxation time scale [s⁻¹].
const Δμ = 0.01L # Sponge layer width [m] set to 1% of the domain height.
@inline μ(z, Lz) = τ⁻¹ * exp(-(z+Lz) / Δμ)
@inline Fu(grid, U, Φ, i, j, k) = @inbounds -μ(grid.zC[k], grid.Lz) * U.u[i, j, k]
@inline Fv(grid, U, Φ, i, j, k) = @inbounds -μ(grid.zC[k], grid.Lz) * U.v[i, j, k]
@inline Fw(grid, U, Φ, i, j, k) = @inbounds -μ(grid.zF[k], grid.Lz) * U.w[i, j, k]
@inline Fu(i, j, k, grid, t, U, C, p) = @inbounds -μ(grid.zC[k], grid.Lz) * U.u[i, j, k]
@inline Fv(i, j, k, grid, t, U, C, p) = @inbounds -μ(grid.zC[k], grid.Lz) * U.v[i, j, k]
@inline Fw(i, j, k, grid, t, U, C, p) = @inbounds -μ(grid.zF[k], grid.Lz) * U.w[i, j, k]
forcing = ModelForcing(Fu=Fu, Fv=Fv, Fw=Fw)
forcing = ModelForcing(u=Fu, v=Fv, w=Fw)
model = Model(grid=grid, forcing=forcing)
nothing # hide
```
Expand Down

2 comments on commit 88a4f8f

@ali-ramadhan
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/8695

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.20.0 -m "<description of version>" 88a4f8f08d976bb0029ea337202bf94fe292374d
git push origin v0.20.0

Please sign in to comment.