Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

More coriolis options #438

Merged
merged 27 commits into from
Oct 24, 2019
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f8ad496
Provides Fplane with rotation rate and latitude
suyashbire1 Oct 3, 2019
24fd4e3
Adds beta-plane
suyashbire1 Oct 3, 2019
6916358
Fixes docstrings, whitespace, uses inbounds
suyashbire1 Oct 3, 2019
ca849be
Merge branch 'outputwriters_with_assoc_dimensions' into more-coriolis…
suyashbire1 Oct 3, 2019
574a9c7
Merge branch 'master' into more-coriolis-options
glwagner Oct 8, 2019
16c7843
Additional format for specifying beta plane
suyashbire1 Oct 10, 2019
15f4875
Merge branch 'more-coriolis-options' of github.com:climate-machine/Oc…
suyashbire1 Oct 10, 2019
29cc97d
Fixes a typo
suyashbire1 Oct 10, 2019
a9489c3
Now rotation calls f0 instead of f for BetaPlane
suyashbire1 Oct 10, 2019
d56d755
zfcrossu for betaplane
suyashbire1 Oct 10, 2019
9cb54b1
z_f_cross_U for betaplane
suyashbire1 Oct 10, 2019
6313f51
Merge branch 'master' into more-coriolis-options
glwagner Oct 21, 2019
59ee18a
Adds BetaPlane as possible coriolis option
glwagner Oct 21, 2019
966ec68
Adds tests for instantiating beta plane and exports from top level
glwagner Oct 21, 2019
5d8b480
Adds test for argument error on instatntiation of betaplane
glwagner Oct 21, 2019
23e44f9
Fixes bugs in coriolis force and beta plane arguments
glwagner Oct 21, 2019
383e103
Adds test for time-stepping with beta plane coriolis
glwagner Oct 21, 2019
de5764b
Another bug fix in beta plane coriolis implementation
glwagner Oct 21, 2019
efa43fc
Few minor changes
suyashbire1 Oct 21, 2019
a034990
Merge branch 'master' into more-coriolis-options
suyashbire1 Oct 21, 2019
979d777
Merge branch 'more-coriolis-options' of github.com:climate-machine/Oc…
suyashbire1 Oct 21, 2019
0ce93b8
Merge remote-tracking branch 'upstream/glw/circulation-experiment' in…
suyashbire1 Oct 23, 2019
da6954f
Merge branch 'master' into more-coriolis-options
suyashbire1 Oct 23, 2019
282db77
Fixes tests
suyashbire1 Oct 23, 2019
d84656a
Adds more tests
suyashbire1 Oct 23, 2019
eecb297
Eliminates whitespace
suyashbire1 Oct 23, 2019
88427a6
Merge branch 'master' into more-coriolis-options
ali-ramadhan Oct 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/coriolis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end
FPlane([T=Float64;] f)

Returns a parameter object for constant rotation at the angular frequency
`f`, and therefore with background vorticity `2f`, around a vertical axis.
`f/2`, and therefore with background vorticity `f`, around a vertical axis.

Also called `FPlane`, after the "f-plane" approximation for the local effect of
Earth's rotation in a planar coordinate system tangent to the Earth's surface.
Expand All @@ -34,32 +34,32 @@ function FPlane(T=Float64; f)
end

"""
FPlane([T=Float64;] Ω, lat)
FPlane([T=Float64;] Ω, latitude)

Returns a parameter object for constant rotation at the angular frequency
`f = 2Ωsin(lat)`, and therefore with background vorticity `f = 4Ωsin(lat)`,
`Ωsin(latitude), and therefore with background vorticity `f = 2Ωsin(latitude),
around a vertical axis.

Also called `FPlane`, after the "f-plane" approximation for the local effect of
Earth's rotation in a planar coordinate system tangent to the Earth's surface.
"""
function FPlane(T=Float64; Ω, lat)
return FPlane{T}(2*Ω*sind(lat))
function FPlane(T=Float64; Ω, latitude)
return FPlane{T}(2*Ω*sind(latitude))
end


"""
βPlane{T} <: AbstractRotation
BetaPlane{T} <: AbstractRotation

A parameter object for meridionally increasing rotation (`f = f₀ + βy`).
"""
struct βPlane{T} <: AbstractRotation
struct BetaPlane{T} <: AbstractRotation
f₀ :: T
β :: T
end

function βPlane(T=Float64; f₀, β)
return βPlane{T}(f₀, β)
function BetaPlane(T=Float64; f₀, β)
return BetaPlane{T}(f₀, β)
end

@inline fv(i, j, k, grid::RegularCartesianGrid{T}, f, v) where T =
Expand All @@ -69,14 +69,16 @@ end
T(0.5) * f * (avgx_f2c(grid, u, i, j-1, k) + avgx_f2c(grid, u, i, j, k))

@inline fv(i, j, k, grid::RegularCartesianGrid{T}, f₀, β, v) where T =
T(0.5) * (f₀ + β * grid.yC[j]) * (avgy_f2c(grid, v, i-1, j, k) + avgy_f2c(grid, v, i, j, k))
T(0.5) * (f₀ + β * @inbounds(grid.yC[j])) * (avgy_f2c(grid, v, i-1, j, k) + avgy_f2c(grid, v, i, j, k))
suyashbire1 marked this conversation as resolved.
Show resolved Hide resolved

@inline fu(i, j, k, grid::RegularCartesianGrid{T}, f₀, β, u) where T =
T(0.5) * (f₀ + β * grid.yF[j]) * (avgx_f2c(grid, u, i, j-1, k) + avgx_f2c(grid, u, i, j, k))
T(0.5) * (f₀ + β * @inbounds(grid.yF[j])) * (avgx_f2c(grid, u, i, j-1, k) + avgx_f2c(grid, u, i, j, k))

@inline x_f_cross_U(i, j, k, grid, rotation::FPlane, U) = -fv(i, j, k, grid, rotation.f, U.v)
@inline y_f_cross_U(i, j, k, grid, rotation::FPlane, U) = fu(i, j, k, grid, rotation.f, U.u)
@inline x_f_cross_U(i, j, k, grid, rotation::βPlane, U) = -fv(i, j, k, grid, rotation.f, rotation.β, U.v)
@inline y_f_cross_U(i, j, k, grid, rotation::βPlane, U) = fu(i, j, k, grid, rotation.f, rotation.β, U.u)

@inline x_f_cross_U(i, j, k, grid, rotation::BetaPlane, U) = -fv(i, j, k, grid, rotation.f, rotation.β, U.v)
@inline y_f_cross_U(i, j, k, grid, rotation::BetaPlane, U) = fu(i, j, k, grid, rotation.f, rotation.β, U.u)

@inline z_f_cross_U(i, j, k, grid::AbstractGrid{T}, ::FPlane, U) where T = zero(T)