Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
glwagner committed Oct 4, 2023
1 parent 4da9f13 commit 7be7aaa
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 18 deletions.
2 changes: 1 addition & 1 deletion validation/regional_polar_simulation/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.9.2"
manifest_format = "2.0"
project_hash = "c1a73b67fc5e93c8c1cb2aae545f1978d14ff7f5"
project_hash = "45e4ea807dbc9ecd252e5ce907312f8871fa5cfe"

[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
Expand Down
1 change: 1 addition & 0 deletions validation/regional_polar_simulation/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
SeawaterPolynomials = "d496a93d-167e-4197-9f49-d3af4ff8fe40"
26 changes: 26 additions & 0 deletions validation/regional_polar_simulation/initial_condition.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using NCDatasets

# Initial condition
dir = "/storage2/alir/bsose_i122"
T_filename = "bsose_i122_2013to2017_1day_Theta.nc"
S_filename = "bsose_i122_2013to2017_1day_Salt.nc"
grid_filename = "grid.nc"

T_filepath = joinpath(dir, T_filename)
S_filepath = joinpath(dir, S_filename)
grid_filepath = joinpath(dir, grid_filename)

T_ds = Dataset(T_filepath)
S_ds = Dataset(S_filepath)
grid_ds = Dataset(grid_filepath)

z = reverse(grid_ds["RF"][:])
zb = - grid_ds["Depth"][:, :]

longitude = (0, 360)
φ = grid_ds["YG"][1, :]
Δφ = φ[end] - φ[end-1]
push!(φ, φ[end] + Δφ)

# Tᵢ = T_ds["THETA"][:, :, :, 1]
# Sᵢ = S_ds["SALT"][:, :, :, 1]
53 changes: 36 additions & 17 deletions validation/regional_polar_simulation/regional_polar_simulation.jl
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
using Oceananigans
#using GLMakie
using Oceananigans.TurbulenceClosures: CATKEVerticalDiffusivity
using SeawaterPolynomials.TEOS10: TEOS10EquationOfState
using MAT

vars = matread("grid.mat")

z = reverse(vars["RF"][:])
h = - vars["Depth"]
φ = vars["YC"][1, :]
Nx, Ny = size(h)
using NCDatasets

# Load grid
dir = "/storage2/alir/bsose_i122"
grid_filename = "grid.nc"
grid_filepath = joinpath(dir, grid_filename)
grid_ds = Dataset(grid_filepath)

z = reverse(grid_ds["RF"][:])
zb = - grid_ds["Depth"][:, :]
φ = grid_ds["YG"][1, :]
Δφ = φ[end] - φ[end-1]
push!(φ, φ[end] + Δφ)

arch = GPU()
Nx = 6 * 360 # 1/6th degree
Ny = length(φ) - 1
Nz = length(z) - 1

Δφ = 1/6
φ₁ = minimum(φ) - Δφ / 2
φ₂ = maximum(φ) + Δφ / 2

longitude = (0, 360)
latitude = (φ₁, φ₂)

grid = LatitudeLongitudeGrid(; longitude, latitude, z,
grid = LatitudeLongitudeGrid(arch; z,
latitude = φ,
longitude = (0, 360),
size = (Nx, Ny, Nz),
halo = (5, 5, 5),
topology = (Periodic, Bounded, Bounded))

grid = ImmersedBoundaryGrid(grid, GridFittedBottom(h))
grid = ImmersedBoundaryGrid(grid, GridFittedBottom(zb))

equation_of_state = TEOS10EquationOfState()

Expand All @@ -36,3 +41,17 @@ model = HydrostaticFreeSurfaceModel(; grid,
tracer_advection = WENO(),
closure = CATKEVerticalDiffusivity())

# Initial condition
dir = "/storage2/alir/bsose_i122"

T_filename = "bsose_i122_2013to2017_1day_Theta.nc"
S_filename = "bsose_i122_2013to2017_1day_Salt.nc"
T_filepath = joinpath(dir, T_filename)
S_filepath = joinpath(dir, S_filename)
T_ds = Dataset(T_filepath)
S_ds = Dataset(S_filepath)
Tᵢ = T_ds["THETA"][:, :, :, 1]
Sᵢ = S_ds["SALT"][:, :, :, 1]

set!(model, T=Tᵢ, S=Sᵢ)

0 comments on commit 7be7aaa

Please sign in to comment.