Skip to content

Commit

Permalink
Merge pull request #54 from jbisits/jib-cleanups
Browse files Browse the repository at this point in the history
Som cleanups
  • Loading branch information
jbisits authored Nov 12, 2024
2 parents 00e5eda + bd25191 commit 4b1b737
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/StaircaseShenanigans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export STStaircaseInitialConditions, StaircaseICs, SmoothSTStaircaseInitialCondi
PeriodicSTSingleInterfaceInitialConditions, PeriodoicSingleInterfaceICs,
set_staircase_initial_conditions!

export tanh_background
export tanh_background, linear_background

export AbstractNoise, VelocityNoise, TracerNoise

Expand Down
18 changes: 10 additions & 8 deletions src/set_staircase_initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ function set_staircase_initial_conditions!(model, ics::STStaircaseInitialConditi

return nothing
end
function set_staircase_initial_conditions!(model, ics::SmoothSTStaircaseInitialConditions)

# TODO: write methods to set smooth changes using the function provied in
# `ics::SmoothSTStaircaseInitialConditions`. I can use something like the above
# normalise then set with the smoothing function
#set!(model, S = initial_S_steps, T = initial_T_steps)

return nothing
end
function set_staircase_initial_conditions!(model, ics::SingleInterfaceICs)

depth_of_interface = ics.depth_of_interface
Expand All @@ -45,15 +54,8 @@ end
"Here the `BackgroundField` behaves as the `initial_condition` and noise is added to the
tracer fields to create an instability."
set_staircase_initial_conditions!(model, ics::PeriodoicSingleInterfaceICs) = nothing
function set_staircase_initial_conditions!(model, ics::SmoothSTStaircaseInitialConditions)

# TODO: write methods to set smooth changes using the function provied in
# `ics::SmoothSTStaircaseInitialConditions`. I can use something like the above
# normalise then set with the smoothing function
#set!(model, S = initial_S_steps, T = initial_T_steps)

return nothing
end
"Fallback --- don't set any noise."
set_noise!(model, noise::Nothing) = nothing
"""
function set_noise!(model, noise::VelocityNoise)
Expand Down
8 changes: 4 additions & 4 deletions src/staircase_initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ by a step change). The property `maintain_interface` is a `Boolean` which if set
set [reentrant_boundary_conditions](@ref) so that the interface will be maintained (by not
letting the system run down).
"""
struct STSingleInterfaceInitialConditions{T, A} <: AbstractStaircaseInitialConditions
struct STSingleInterfaceInitialConditions{T, A, B} <: AbstractStaircaseInitialConditions
"The depth of the interface"
depth_of_interface :: T
"Salinity values in each layer"
Expand All @@ -21,7 +21,7 @@ struct STSingleInterfaceInitialConditions{T, A} <: AbstractStaircaseInitialCondi
R_ρ :: T
"Boolean whether or not to set reentrant boundary condtions to approximately maintain the initial
interface gradients"
maintain_interface :: Bool
maintain_interface :: B
end
function STSingleInterfaceInitialConditions(model, depth_of_interface, salinity, temperature;
maintain_interface = false)
Expand All @@ -48,7 +48,7 @@ const SingleInterfaceICs = STSingleInterfaceInitialConditions # alias
Sets a `BackgroundField` according to `background_State` and uses a triply periodic domain
to evolve salinity and temperature anomalies about the background state.
"""
struct PeriodicSTSingleInterfaceInitialConditions{T, A} <: AbstractStaircaseInitialConditions
struct PeriodicSTSingleInterfaceInitialConditions{T, A, F} <: AbstractStaircaseInitialConditions
"The depth of the interface"
depth_of_interface :: T
"Salinity values in each layer"
Expand All @@ -58,7 +58,7 @@ struct PeriodicSTSingleInterfaceInitialConditions{T, A} <: AbstractStaircaseInit
"Initial R_ρ at the interface"
R_ρ :: T
"Function used to define the background state about which an anomaly is evolved."
background_state :: Function
background_state :: F
end
function PeriodicSTSingleInterfaceInitialConditions(eos::BoussinesqEquationOfState, depth_of_interface, salinity, temperature, background_state)

Expand Down
2 changes: 1 addition & 1 deletion src/staircase_restoring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function S_and_T_background_fields(ics::PeriodicSTSingleInterfaceInitialConditio

ΔS = diff(ics.salinity_values)[1]
Sᵤ, Sₗ = ics.salinity_values
S_parameters = (Sᵤ = Sᵤ, Cₗ = Sₗ, ΔC = ΔS, Lz = abs(Lz), z_interface, τ)
S_parameters = (Cᵤ = Sᵤ, Cₗ = Sₗ, ΔC = ΔS, Lz = abs(Lz), z_interface, τ)
S_background = BackgroundField(ics.background_state, parameters=S_parameters)
T_background = BackgroundField(ics.background_state, parameters=T_parameters)

Expand Down

0 comments on commit 4b1b737

Please sign in to comment.