Skip to content

Commit 922cbb4

Browse files
committed
undo scaling and Tini introduced
1 parent fc3e815 commit 922cbb4

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/default_parameters.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
Tprog=T # number format for prognostic variables
66
Tcomm=Tprog # number format for ghost-point copies
7+
Tini=Tprog # number format to reduce precision for initial conditions
78

89
# DOMAIN RESOLUTION AND RATIO
910
nx::Int=100 # number of grid cells in x-direction
@@ -157,6 +158,7 @@ Creates a Parameter struct with following options and default values
157158
158159
Tprog=T # number format for prognostic variables
159160
Tcomm=Tprog # number format for ghost-point copies
161+
Tini=Tprog # number format to reduce precision for initial conditions
160162
161163
# DOMAIN RESOLUTION AND RATIO
162164
nx::Int=100 # number of grid cells in x-direction

src/ghost_points.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ function remove_halo( u::Array{T,2},
4242
@unpack halo,haloη,halosstx,halossty = S.grid
4343
@unpack scale_inv = S.constants
4444

45+
# undo scaling as well
4546
ucut = scale_inv*u[halo+1:end-halo,halo+1:end-halo]
4647
vcut = scale_inv*v[halo+1:end-halo,halo+1:end-halo]
4748
ηcut = η[haloη+1:end-haloη,haloη+1:end-haloη]
48-
sstcut = sst[halosstx+1:end-halosstx,halossty+1:end-halossty]
49+
sstcut = scale_inv*sst[halosstx+1:end-halosstx,halossty+1:end-halossty]
4950

5051
return ucut,vcut,ηcut,sstcut
5152
end

src/initial_conditions.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat}
2828
## PROGNOSTIC VARIABLES U,V,η
2929
@unpack nux,nuy,nvx,nvy,nx,ny = S.grid
3030
@unpack initial_cond = S.parameters
31+
@unpack Tini = S.parameters
3132

3233
if initial_cond == "rest"
3334

@@ -146,10 +147,11 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat}
146147
end
147148

148149
# Convert to number format T
149-
sst = T.(sst)
150-
u = T.(u)
151-
v = T.(v)
152-
η = T.(η)
150+
# allow for comparable initial conditions via Tini
151+
sst = T.(Tini.(sst))
152+
u = T.(Tini.(u))
153+
v = T.(Tini.(v))
154+
η = T.(Tini.(η))
153155

154156
#TODO SST INTERPOLATION
155157
u,v,η,sst = add_halo(u,v,η,sst,S)

0 commit comments

Comments
 (0)