-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jagoosw/jsw/precomputed-roughness-length
added precomputed roughness length and friction velocity + fix bug
- Loading branch information
Showing
13 changed files
with
302 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Walrus" | ||
uuid = "bec5164f-1c7a-4c32-8768-be9354254d6a" | ||
authors = ["Jago Stong-Wright <[email protected]>"] | ||
version = "0.4.2" | ||
version = "0.4.3" | ||
|
||
[deps] | ||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Interpolations | ||
|
||
export SimpleInterpolation | ||
|
||
using Adapt: adapt | ||
|
||
using Oceananigans.Architectures: arch_array, CPU | ||
|
||
import Adapt: adapt_structure | ||
|
||
struct SimpleInterpolation{R, V} | ||
range :: R | ||
values :: V | ||
end | ||
|
||
adapt_structure(to, itp::SimpleInterpolation) = SimpleInterpolation(adapt(to, itp.range), | ||
adapt(to, itp.values)) | ||
|
||
function SimpleInterpolation(range::Array, values; arch = CPU()) | ||
x₀ = minimum(range) | ||
|
||
(range[2] - range[1] ≈ range[end] - range[end - 1]) || throw(ArgumentError("Interpolation range must be regularly spaced")) | ||
|
||
Δx = range[2] - range[1] | ||
|
||
return SimpleInterpolation((; x₀, Δx), arch_array(arch, values)) | ||
end | ||
|
||
|
||
function (itp::SimpleInterpolation)(x) | ||
n₁ = floor(Int, (x - itp.range.x₀) / itp.range.Δx) | ||
|
||
x₁ = itp.range.x₀ + itp.range.Δx * n₁ | ||
x₂ = x₁ + itp.range.Δx | ||
|
||
y₁ = @inbounds itp.values[n₁ + 1] | ||
y₂ = @inbounds itp.values[n₁ + 2] | ||
|
||
return y₁ + (x - x₁) * (y₂ - y₁) / (x₂ - x₁) | ||
end | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
98fd5f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
Release notes:
Breaking changes
Changed API for wind stress, surface heat exchange and wall stress to allow friction velocities to be precomputed (which causes a large speed up for all but the smallest of grids).
Additionally fixes a major error in the homogenous body heating.
98fd5f4
There was a problem hiding this comment.
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/99174
Tagging
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 the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: