Skip to content

Commit

Permalink
Added celerity profile
Browse files Browse the repository at this point in the history
  • Loading branch information
kapple19 committed Aug 6, 2024
1 parent f4ff62f commit bb1eba4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
8 changes: 0 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,5 @@ uuid = "03019ade-4524-4ecd-af79-46d4f04a1b56"
authors = ["Aaron Kaw <[email protected]> and contributors"]
version = "1.0.0-DEV"

[deps]
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
IntervalArithmetic = "0.22.14"
NaNMath = "1.0.2"
Symbolics = "5.34.0"
julia = "1.10"
1 change: 1 addition & 0 deletions src/06_postliminary/02_profiles/celerity/01_preliminary.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
struct CelerityProfileFunctionType{MediumType <: Medium} <: ModellingFunction{3} end
7 changes: 7 additions & 0 deletions src/06_postliminary/02_profiles/celerity/02_atmosphere.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export atmosphere_celerity_profile

## Instantiation
const atmosphere_celerity_profile = CelerityProfileFunctionType{Atmosphere}()

## Models
atmosphere_celerity_profile(::ModelName{:Homogeneous}, x::Real, y::Real, z::Real; c::Real = 343.0)::Real = c
14 changes: 14 additions & 0 deletions src/06_postliminary/02_profiles/celerity/02_ocean.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export ocean_celerity_profile

const ocean_celerity_profile = CelerityProfileFunctionType{Ocean}()

ocean_celerity_profile(::ModelName{:Homogeneous}, x::Real, y::Real, z::Real; c::Real = 1500.0)::Real = c

function ocean_celerity_profile(::ModelName{:Munk}, x::Real, y::Real, z::Real; ϵ = 7.47e-3)
= 2(z/1300 - 1)
return 1500(
1 + ϵ * (
- 1 + exp(-z̃)
)
)
end
5 changes: 5 additions & 0 deletions src/06_postliminary/02_profiles/celerity/02_seabed.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export seabed_celerity_profile

const seabed_celerity_profile = CelerityProfileFunctionType{Seabed}()

seabed_celerity_profile(::ModelName{:Homogeneous}, x::Real, y::Real, z::Real; c::Real = 2000.0)::Real = c
15 changes: 15 additions & 0 deletions src/06_postliminary/02_profiles/celerity/99_postliminary.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export CelerityProfile

struct CelerityProfile{MediumType <: Medium, ProfileFunctionType <: Function} <: ModellingFunctor{3}
profile::ProfileFunctionType

function CelerityProfile{MediumType}(model::ModelName; pars...) where {MediumType <: Medium}
celerity_profile = CelerityProfileFunctionType{MediumType}()
profile(x::Real, y::Real, z::Real) = celerity_profile(model, x, y, z; pars...)
new{MediumType, profile |> typeof}(profile)
end
end

function (cel::CelerityProfile{<:Medium, <:Function})(x::Real, y::Real, z::Real)
cel.profile(x, y, z)
end

0 comments on commit bb1eba4

Please sign in to comment.