Skip to content

Commit

Permalink
Merge pull request #74 from jbisits/jib-exampleupdates
Browse files Browse the repository at this point in the history
Seperate examples
  • Loading branch information
jbisits authored Nov 16, 2024
2 parents cb9291b + 8f214ef commit 9567634
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.jld2
*.nc
*.vscode
*.mp4
/Manifest.toml
/deps/deps.jl
/docs/Manifest.toml
Expand Down
35 changes: 35 additions & 0 deletions examples/single_interface_periodic_linear_background.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using StaircaseShenanigans

architecture = CPU() # or GPU()
diffusivities == 1e-5, κ = (S = 1e-7, T = 1e-5))
domain_extent = (Lx = 0.1, Ly = 0.1, Lz = -1.0)
resolution = (Nx = 5, Ny = 5, Nz = 50)
eos = CustomLinearEquationOfState(-0.5, 34.6)
model_setup = (;architecture, diffusivities, domain_extent, resolution, eos)

## Initial conditions
depth_of_interface = -0.5
salinity = [34.56, 34.70]
temperature = [-1.5, 0.5]
interface_ics = PeriodoicSingleInterfaceICs(eos, depth_of_interface, salinity, temperature,
BackgroundLinear())
tracer_noise = TracerNoise(1e-6, 1e-6)

## setup model
sdns = StaircaseDNS(model_setup, interface_ics, tracer_noise)

## Build simulation
Δt = 1e-1
stop_time = 4 * 60 * 60 # seconds
save_schedule = 30 # seconds
output_path = joinpath(@__DIR__, "output_linear_background")
simulation = SDNS_simulation_setup(sdns, stop_time, save_computed_output!,
save_vertical_velocities!;
Δt, save_schedule,
output_path, max_Δt = 5)
## Run
run!(simulation)

## Compute density ratio
compute_R_ρ!(simulation.output_writers[:computed_output].filepath,
simulation.output_writers[:tracers].filepath, eos)
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ model_setup = (;architecture, diffusivities, domain_extent, resolution, eos)

## Initial conditions
depth_of_interface = -0.5
salinity = [34.58, 34.70]
salinity = [34.56, 34.70]
temperature = [-1.5, 0.5]
interface_ics = PeriodoicSingleInterfaceICs(eos, depth_of_interface, salinity, temperature, BackgroundTanh(tanh_background, 100, NamedTuple()))
interface_ics = PeriodoicSingleInterfaceICs(eos, depth_of_interface, salinity, temperature,
BackgroundTanh())
tracer_noise = TracerNoise(1e-6, 1e-6)

## setup model
sdns = StaircaseDNS(model_setup, interface_ics, tracer_noise)

## Build simulation
Δt = 1e-1
stop_time = 200 * 60 # seconds
save_schedule = 10 # seconds
output_path = joinpath(@__DIR__, "output")
stop_time = 4 * 60 * 60 # seconds
save_schedule = 30 # seconds
output_path = joinpath(@__DIR__, "output_tanh_background")
simulation = SDNS_simulation_setup(sdns, stop_time, save_computed_output!,
save_vertical_velocities!;
Δt, save_schedule,
Expand Down

0 comments on commit 9567634

Please sign in to comment.