diff --git a/src/StaircaseShenanigans.jl b/src/StaircaseShenanigans.jl index fd1675a..d172fdf 100644 --- a/src/StaircaseShenanigans.jl +++ b/src/StaircaseShenanigans.jl @@ -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 diff --git a/src/set_staircase_initial_conditions.jl b/src/set_staircase_initial_conditions.jl index 476964b..d1b5cf0 100644 --- a/src/set_staircase_initial_conditions.jl +++ b/src/set_staircase_initial_conditions.jl @@ -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 @@ -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) diff --git a/src/staircase_initial_conditions.jl b/src/staircase_initial_conditions.jl index 8c6661b..9a133e6 100644 --- a/src/staircase_initial_conditions.jl +++ b/src/staircase_initial_conditions.jl @@ -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" @@ -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) @@ -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" @@ -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) diff --git a/src/staircase_restoring.jl b/src/staircase_restoring.jl index 7ddabd7..a0a3910 100644 --- a/src/staircase_restoring.jl +++ b/src/staircase_restoring.jl @@ -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)