Skip to content

Commit

Permalink
Bugfixes in UGWP v1 for uninitialized variable azmeti(jk-1)
Browse files Browse the repository at this point in the history
  • Loading branch information
climbfuji committed Mar 15, 2021
1 parent b23f06a commit b67acad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
25 changes: 14 additions & 11 deletions physics/cires_ugwpv1_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,19 @@ subroutine cires_ugwpv1_init (me, master, nlunit, logunit, jdat_gfs, con_pi, &
integer :: k
integer :: ddd_ugwp, curday_ugwp
! integer :: version


! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

!
if (me == master) print *, trim (fn_nml), ' GW-namelist file '
inquire (file =trim (fn_nml) , exist = exists)
!
if (.not. exists) then
if (me == master) &
write (6, *) 'separate ugwp :: namelist file: ', trim (fn_nml), ' does not exist'
write(errmsg,'(3a)') 'cires_ugwpv1_init: namelist file: ', trim (fn_nml), ' does not exist'
errflg = 1
return
else
open (unit = nlunit, file = trim(fn_nml), action = 'read', status = 'old', iostat = ios)
endif
Expand All @@ -209,11 +212,6 @@ subroutine cires_ugwpv1_init (me, master, nlunit, logunit, jdat_gfs, con_pi, &
close (nlunit)
!

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0


strsolver= knob_ugwp_orosolv

curday_ugwp = jdat_gfs(1)*10000 + jdat_gfs(2)*100 +jdat_gfs(3)
Expand Down Expand Up @@ -248,7 +246,7 @@ subroutine cires_ugwpv1_init (me, master, nlunit, logunit, jdat_gfs, con_pi, &
! allocate(fcor(latr), fcor2(latr) )
!
allocate( kvg(levs+1), ktg(levs+1) )
allocate( krad(levs+1), kion(levs+1) )
allocate( krad(levs+1), kion(levs+1) )
allocate( zkm(levs), pmb(levs) )

!
Expand All @@ -263,7 +261,12 @@ subroutine cires_ugwpv1_init (me, master, nlunit, logunit, jdat_gfs, con_pi, &
!
! find ilaunch
!

if (knob_ugwp_palaunch gt 900.e2) then
write(errmsg,'(a,e16.7)') 'cires_ugwpv1_init: unrealistic value of knob_ugwp_palaunch', knob_ugwp_palaunch
errflg = 1
return
endif

do k=levs, 1, -1
if (pmb(k) .gt. knob_ugwp_palaunch ) exit
enddo
Expand Down
19 changes: 9 additions & 10 deletions physics/cires_ugwpv1_solv2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,14 @@ subroutine cires_ugwpv1_ngw_solv2(mpi_id, master, im, levs, kdt, dtp, &

!=====ksrc

aum(km2:levs) = um(jl,km2:levs)
avm(km2:levs) = vm(jl,km2:levs)
atm(km2:levs) = tm(jl,km2:levs)
aqm(km2:levs) = qm(jl,km2:levs)
azmet(km2:levs) = zmet(jl,km2:levs)
aprsi(km2:levs+1) = prsi(jl,km2:levs+1)
azmeti(km2:levs+1) = zmeti(jl,km2:levs+1)
aum(1:levs) = um(jl,1:levs)
avm(1:levs) = vm(jl,1:levs)
atm(1:levs) = tm(jl,1:levs)
aqm(1:levs) = qm(jl,1:levs)
azmet(1:levs) = zmet(jl,1:levs)
aprsi(1:levs+1) = prsi(jl,1:levs+1)
azmeti(1:levs+1) = zmeti(jl,1:levs+1)


rho_src = aprsl(ksrc)*rdi/atm(ksrc)
taub_ch = max(tau_ngw(jl), tau_min)
taub_src = taub_ch
Expand All @@ -288,8 +287,8 @@ subroutine cires_ugwpv1_ngw_solv2(mpi_id, master, im, levs, kdt, dtp, &
!
do jk = km2, levs
dz_meti(jk) = azmeti(jk+1)-azmeti(jk)
dz_met(jk) = azmet(jk)-azmeti(jk-1)
enddo
dz_met(jk) = azmet(jk)-azmeti(jk-1)
enddo
! ---------------------------------------------
! interface mean flow parameters launch -> levs+1
! ---------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions physics/ugwpv1_gsldrag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ subroutine ugwpv1_gsldrag_init ( &
if ( do_ugwp_v0_orog_only .or. do_ugwp_v0) then
print *, ' ccpp do_ugwp_v0 active ', do_ugwp_v0
print *, ' ccpp do_ugwp_v1_orog_only active ', do_ugwp_v0_orog_only
write(errmsg,'(*(a))') " the CIRES <ugwpv1_gsldrag> CCPP-suite does not &
write(errmsg,'(*(a))') " the CIRES <ugwpv1_gsldrag> CCPP-suite does not &
support <ugwp_v0> schemes "
errflg = 1
return
Expand All @@ -171,7 +171,7 @@ subroutine ugwpv1_gsldrag_init ( &
print *, ' do_ugwp_v1_w_gsldrag ', do_ugwp_v1_w_gsldrag
print *, ' do_ugwp_v1_orog_only ', do_ugwp_v1_orog_only
print *, ' do_gsl_drag_ls_bl ',do_gsl_drag_ls_bl
write(errmsg,'(*(a))') " the CIRES <ugwpv1_gsldrag> CCPP-suite intend to &
write(errmsg,'(*(a))') " the CIRES <ugwpv1_gsldrag> CCPP-suite intend to &
support <ugwp_v1> with <gsldrag> but has Logic error"
errflg = 1
return
Expand Down Expand Up @@ -232,6 +232,7 @@ subroutine ugwpv1_gsldrag_init ( &
call cires_ugwpv1_init (me, master, nlunit, logunit, jdat, con_pi, &
con_rerth, fn_nml2, lonr, latr, levs, ak, bk, &
con_p0, dtp, errmsg, errflg)
if (errflg/=0) return
end if

if (me == master) then
Expand Down

0 comments on commit b67acad

Please sign in to comment.