Skip to content

Commit

Permalink
Add condition to only read ni and nl when imp_physics is 8 (Thompson)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyhcliu authored Aug 20, 2024
1 parent 8678811 commit 3404ddf
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions src/gsi/general_read_gfsatm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3591,66 +3591,67 @@ subroutine general_read_gfsatm_allhydro_nc(grd,sp_a,filename,uvflag,vordivflag,z
endif
enddo ! do k=1,nlevs

do k=1,nlevs
icount=icount+1
iflag(icount)=15
ilev(icount)=k
kr = levs+1-k ! netcdf is top to bottom, need to flip
if (imp_physics == 8) then
do k=1,nlevs
icount=icount+1
iflag(icount)=15
ilev(icount)=k
kr = levs+1-k ! netcdf is top to bottom, need to flip

if (mype==mype_use(icount)) then
call read_vardata(filges, 'nccice', rwork3d0, nslice=kr, slicedim=3)
! cloud ice water number concentration.
if ( diff_res ) then
grid_b=rwork3d0(:,:,1)
vector(1)=.false.
call fill2_ns(grid_b,grid_c(:,:,1),latb+2,lonb)
call g_egrid2agrid(p_high,grid_c,grid2,1,1,vector)
do kk=1,grd%itotsub
i=grd%ltosi_s(kk)
j=grd%ltosj_s(kk)
work(kk)=grid2(i,j,1)
enddo
else
grid=rwork3d0(:,:,1)
call general_fill_ns(grd,grid,work)
if (mype==mype_use(icount)) then
call read_vardata(filges, 'nccice', rwork3d0, nslice=kr, slicedim=3)
! cloud ice water number concentration.
if ( diff_res ) then
grid_b=rwork3d0(:,:,1)
vector(1)=.false.
call fill2_ns(grid_b,grid_c(:,:,1),latb+2,lonb)
call g_egrid2agrid(p_high,grid_c,grid2,1,1,vector)
do kk=1,grd%itotsub
i=grd%ltosi_s(kk)
j=grd%ltosj_s(kk)
work(kk)=grid2(i,j,1)
enddo
else
grid=rwork3d0(:,:,1)
call general_fill_ns(grd,grid,work)
endif
endif
endif
if ( icount == icm .or. k==nlevs ) then
call general_reload2(grd,g_z,g_ps,g_tv,g_vor,g_div,g_u,g_v,g_q,g_oz, &
g_ql,g_qi,g_qr,g_qs,g_qg,icount,iflag,ilev,work,uvflag,vordivflag,g_ni,g_nr)
endif
enddo ! do k=1,nlevs
if ( icount == icm .or. k==nlevs ) then
call general_reload2(grd,g_z,g_ps,g_tv,g_vor,g_div,g_u,g_v,g_q,g_oz, &
g_ql,g_qi,g_qr,g_qs,g_qg,icount,iflag,ilev,work,uvflag,vordivflag,g_ni,g_nr)
endif
enddo ! do k=1,nlevs

do k=1,nlevs
icount=icount+1
iflag(icount)=16
ilev(icount)=k
kr = levs+1-k ! netcdf is top to bottom, need to flip
do k=1,nlevs
icount=icount+1
iflag(icount)=16
ilev(icount)=k
kr = levs+1-k ! netcdf is top to bottom, need to flip

if (mype==mype_use(icount)) then
call read_vardata(filges, 'nconrd', rwork3d0, nslice=kr, slicedim=3)
! rain number concentration.
if ( diff_res ) then
grid_b=rwork3d0(:,:,1)
vector(1)=.false.
call fill2_ns(grid_b,grid_c(:,:,1),latb+2,lonb)
call g_egrid2agrid(p_high,grid_c,grid2,1,1,vector)
do kk=1,grd%itotsub
i=grd%ltosi_s(kk)
j=grd%ltosj_s(kk)
work(kk)=grid2(i,j,1)
enddo
else
grid=rwork3d0(:,:,1)
call general_fill_ns(grd,grid,work)
if (mype==mype_use(icount)) then
call read_vardata(filges, 'nconrd', rwork3d0, nslice=kr, slicedim=3)
! rain number concentration.
if ( diff_res ) then
grid_b=rwork3d0(:,:,1)
vector(1)=.false.
call fill2_ns(grid_b,grid_c(:,:,1),latb+2,lonb)
call g_egrid2agrid(p_high,grid_c,grid2,1,1,vector)
do kk=1,grd%itotsub
i=grd%ltosi_s(kk)
j=grd%ltosj_s(kk)
work(kk)=grid2(i,j,1)
enddo
else
grid=rwork3d0(:,:,1)
call general_fill_ns(grd,grid,work)
endif
endif
endif
if ( icount == icm .or. k==nlevs) then
call general_reload2(grd,g_z,g_ps,g_tv,g_vor,g_div,g_u,g_v,g_q,g_oz, &
g_ql,g_qi,g_qr,g_qs,g_qg,icount,iflag,ilev,work,uvflag,vordivflag,g_ni,g_nr)
endif
enddo ! do k=1,nlevs

if ( icount == icm .or. k==nlevs) then
call general_reload2(grd,g_z,g_ps,g_tv,g_vor,g_div,g_u,g_v,g_q,g_oz, &
g_ql,g_qi,g_qr,g_qs,g_qg,icount,iflag,ilev,work,uvflag,vordivflag,g_ni,g_nr)
endif
enddo ! do k=1,nlevs
endif ! imp_physics
! do k=1,nlevs
! icount=icount+1
! iflag(icount)=17
Expand All @@ -3674,7 +3675,6 @@ subroutine general_read_gfsatm_allhydro_nc(grd,sp_a,filename,uvflag,vordivflag,z
! grid=rwork3d0(:,:,1)
! call general_fill_ns(grd,grid,work)
! endif
!
! endif
! if ( icount == icm .or. k==nlevs ) then
! call general_reload2(grd,g_z,g_ps,g_tv,g_vor,g_div,g_u,g_v,g_q,g_oz, &
Expand Down

0 comments on commit 3404ddf

Please sign in to comment.