Skip to content

Commit 278b478

Browse files
committed
mixed prec on tendencies not sum of tend
1 parent 8a01918 commit 278b478

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/Continuity.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function continuity_itself!(Diag::DiagnosticVars{T,Tprog},
6262

6363
@inbounds for j 1:n
6464
for i 1:m
65-
dη[i+1,j+1] = -(Tprog(dUdx[i,j+1] + dVdy[i+1,j]))
65+
dη[i+1,j+1] = -(Tprog(dUdx[i,j+1]) + Tprog(dVdy[i+1,j]))
6666
end
6767
end
6868
end

src/Diffusion.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function add_drag_diff_tendencies!( u::Array{Tprog,2},
234234

235235
@inbounds for j 1:n
236236
for i 1:m
237-
u[i+2,j+2] += Δt_diff*(Tprog(Bu[i+1-ep,j+1] + LLu1[i,j+1] + LLu2[i+1-ep,j]))
237+
u[i+2,j+2] += Δt_diff*(Tprog(Bu[i+1-ep,j+1]) + Tprog(LLu1[i,j+1]) + Tprog(LLu2[i+1-ep,j]))
238238
end
239239
end
240240

@@ -245,7 +245,7 @@ function add_drag_diff_tendencies!( u::Array{Tprog,2},
245245

246246
@inbounds for j 1:n
247247
for i 1:m
248-
v[i+2,j+2] += Δt_diff*(Tprog(Bv[i+1,j+1] + LLv1[i,j+1] + LLv2[i+1,j]))
248+
v[i+2,j+2] += Δt_diff*(Tprog(Bv[i+1,j+1]) + Tprog(LLv1[i,j+1]) + Tprog(LLv2[i+1,j]))
249249
end
250250
end
251251
end

src/TestJuls.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
include("Juls.jl")
22
using .Juls
3-
RunJuls()
3+
using BFloat16s
4+
5+
Base.round(x::BFloat16, r::RoundingMode{:Up}) = BFloat16(ceil(Float32(x)))
6+
Base.round(x::BFloat16, r::RoundingMode{:Down}) = BFloat16(floor(Float32(x)))
7+
Base.round(x::BFloat16, r::RoundingMode{:Nearest}) = BFloat16(round(Float32(x)))
8+
9+
a = BFloat16(1.2)
10+
floor(a)
11+
12+
#RunJuls(BFloat16,Tprog=Float32)
13+
#RunJuls(BFloat16,Tprog=Float32,output=true,nx=200,Ndays=100,initial_cond="ncfile",sst_initial="rect",sst_rect_coords=[0.,0.5,0.,1.0],outpath="/local/home/kloewer/julsdata/mixedprec")

src/rhs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function momentum_u!(Diag::DiagnosticVars{T,Tprog},S::ModelSetup) where {T,Tprog
296296

297297
@inbounds for j 1:n
298298
for i 1:m
299-
du[i+2,j+2] = Tprog(qhv[i,j] - dpdx[i+1-ep,j+1] + Fx[i,j])
299+
du[i+2,j+2] = Tprog(qhv[i,j]) - Tprog(dpdx[i+1-ep,j+1]) + Tprog(Fx[i,j])
300300
end
301301
end
302302
end
@@ -316,7 +316,7 @@ function momentum_v!(Diag::DiagnosticVars{T,Tprog},S::ModelSetup) where {T,Tprog
316316

317317
@inbounds for j 1:n
318318
for i 1:m
319-
dv[i+2,j+2] = Tprog(-qhu[i,j] - dpdy[i+1,j+1] + Fy[i,j])
319+
dv[i+2,j+2] = -Tprog(qhu[i,j]) - Tprog(dpdy[i+1,j+1]) + Tprog(Fy[i,j])
320320
end
321321
end
322322
end

0 commit comments

Comments
 (0)