From 3426a1db1d12821a6f063a709df0bec018da2eab Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Wed, 8 Oct 2025 16:08:01 +0000 Subject: [PATCH 1/6] update upp hash to 334ca0b5 --- upp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upp b/upp index 8f6caa9d0..334ca0b53 160000 --- a/upp +++ b/upp @@ -1 +1 @@ -Subproject commit 8f6caa9d04f1caf2ca8ce1b362aedcebf9b14c8c +Subproject commit 334ca0b53fcfa0ebe44d57825a76f95d700474cd From c593bb17ffab3937543b4a366b6d9a0f693e7b85 Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Fri, 10 Oct 2025 17:35:18 +0000 Subject: [PATCH 2/6] Update inline post interface and upp hash --- io/post_fv3.F90 | 54 ++++++++++++++++++++++++++++++++++++++++++++++--- upp | 2 +- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/io/post_fv3.F90 b/io/post_fv3.F90 index 6fa5e47a2..05611e792 100644 --- a/io/post_fv3.F90 +++ b/io/post_fv3.F90 @@ -542,7 +542,7 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) no3cb, nh4cb, dusmass, ducmass, dusmass25,ducmass25, & snownc, graupelnc, qrmax, hail_maxhailcast, & smoke_ave,dust_ave,coarsepm_ave,swddif,swddni, & - xlaixy,wspd10umax,wspd10vmax + xlaixy,wspd10umax,wspd10vmax,f10m use soil, only: sldpth, sh2o, smc, stc, sllevel use masks, only: lmv, lmh, htm, vtm, gdlat, gdlon, dx, dy, hbm2, sm, sice use ctlblk_mod, only: im, jm, lm, lp1, jsta, jend, jsta_2l, jend_2u, jsta_m,jend_m, & @@ -554,7 +554,7 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) alsl, spl, ihrst, modelname, nsoil, rdaod, gocart_on, & gccpp_on, nasa_on, d2d_chem, nbin_ss, nbin_bc, nbin_oc,& nbin_du,nbin_su, nbin_no3, nbin_nh4 - use params_mod, only: erad, dtr, capa, p1000, small,h1, d608, pi, rd + use params_mod, only: erad, dtr, capa, p1000, small,h1, d608, pi, rd, rtd use gridspec_mod,only: latstart, latlast, lonstart, lonlast, cenlon, cenlat, & dxval, dyval, truelat2, truelat1, psmapf, cenlat, & lonstartv, lonlastv, cenlonv, latstartv, latlastv, & @@ -584,12 +584,13 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) integer i, ip1, j, l, k, n, iret, ibdl, rc, kstart, kend integer i1,i2,j1,j2,k1,k2 integer fieldDimCount,gridDimCount,ncount_field,bundle_grid_id - integer jdate(8) + integer jdate(8), jdn logical foundland, foundice, found, mvispresent integer totalLBound3d(3), totalUBound3d(3) real(4) rinc(5), fillvalue real(8) fillvalue8 real tlmh,RADI,TMP,ES,TV,RHOAIR,tem,tstart,dtp + real sun_zenith, sun_azimuth real, dimension(:),allocatable :: ak5, bk5 real(ESMF_KIND_R4),dimension(:,:),pointer :: arrayr42d real(ESMF_KIND_R8),dimension(:,:),pointer :: arrayr82d @@ -597,6 +598,7 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) real(ESMF_KIND_R8),dimension(:,:,:),pointer :: arrayr83d real,dimension(:), allocatable :: slat,qstl real,external::FPVSNEW + real,external::iw3jdn real,dimension(:,:),allocatable :: dummy, p2d, t2d, q2d, qs2d, & cw2d, cfr2d, snacc_land, snacc_ice, & acsnom_land, acsnom_ice @@ -1115,6 +1117,18 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) enddo enddo endif + + ! surface specific humidity + if(trim(fieldname)=='qs') then + !$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,arrayr42d,qs,spval) + do j=jsta,jend + do i=ista, iend + if(arrayr42d(i,j) /= spval) then + qs(i,j) = arrayr42d(i,j) + endif + enddo + enddo + endif ! foundation temperature if(trim(fieldname)=='tref') then @@ -2383,6 +2397,17 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) enddo endif + ! f10m + if(trim(fieldname)=='f10m') then + !$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,f10m,arrayr42d,v10h,spval,fillValue) + do j=jsta,jend + do i=ista, iend + f10m(i,j) = arrayr42d(i,j) + if( abs(arrayr42d(i,j)-fillValue) < small) f10m(i,j) = spval + enddo + enddo + endif + ! vegetation type if(trim(fieldname)=='vtype') then !$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,spval,arrayr42d,ivgtyp,fillValue) @@ -4416,6 +4441,29 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) ! end file_loop_all enddo file_loop_all +! calculate cos(SZA) + call w3fs13(idat(3),idat(1),idat(2),jdn) +!$omp parallel do default(none) private(i,j,sun_zenith,sun_azimuth) shared(jsta,jend,ista,iend,czen,czmean,rtd,pi,gdlat,gdlon,jdn) + do j=jsta,jend + do i=ista,iend + call zensun(jdn,float(idat(4)),gdlat(i,j),gdlon(i,j),pi,sun_zenith,sun_azimuth) + czen(i,j) = cos(sun_zenith/rtd) + czmean(i,j) = czen(i,j) + enddo + enddo + +! if u10/v10 are missing, derive them from f10m and surface wind +!$omp parallel do default(none) private(i,j) shared(jsta,jend,lm,spval,ista,iend,u10,v10,f10m,uh,vh) + do j=jsta,jend + do i=ista,iend + if(u10(i,j) == spval .and. v10(i,j) == spval .and. & + f10m(i,j) /=spval .and. uh(i,j,lm)/=spval) then + u10(i,j) = f10m(i,j) * uh(i,j,lm) + v10(i,j) = f10m(i,j) * vh(i,j,lm) + endif + enddo + enddo + ! recompute full layer of zint !$omp parallel do default(none) private(i,j) shared(jsta,jend,lp1,spval,zint,fis,ista,iend) do j=jsta,jend diff --git a/upp b/upp index 334ca0b53..92b0baf83 160000 --- a/upp +++ b/upp @@ -1 +1 @@ -Subproject commit 334ca0b53fcfa0ebe44d57825a76f95d700474cd +Subproject commit 92b0baf836cd1cd9112b7e2fb74ec513d858047d From 328fa52a2abe4d3dc49e5e3e83efac3da2c8fcd1 Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Fri, 10 Oct 2025 19:19:35 +0000 Subject: [PATCH 3/6] Correct syntax errors --- io/post_fv3.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/post_fv3.F90 b/io/post_fv3.F90 index 05611e792..f0a989746 100644 --- a/io/post_fv3.F90 +++ b/io/post_fv3.F90 @@ -4443,7 +4443,7 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) ! calculate cos(SZA) call w3fs13(idat(3),idat(1),idat(2),jdn) -!$omp parallel do default(none) private(i,j,sun_zenith,sun_azimuth) shared(jsta,jend,ista,iend,czen,czmean,rtd,pi,gdlat,gdlon,jdn) +!$omp parallel do default(none) private(i,j,sun_zenith,sun_azimuth) shared(jsta,jend,ista,iend,czen,czmean,gdlat,gdlon,jdn) do j=jsta,jend do i=ista,iend call zensun(jdn,float(idat(4)),gdlat(i,j),gdlon(i,j),pi,sun_zenith,sun_azimuth) From 525fb318ea85dbf66da629e8779839e21dbc029d Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Fri, 10 Oct 2025 19:57:19 +0000 Subject: [PATCH 4/6] Correct compiling error --- io/post_fv3.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/post_fv3.F90 b/io/post_fv3.F90 index f0a989746..61daccf27 100644 --- a/io/post_fv3.F90 +++ b/io/post_fv3.F90 @@ -4443,7 +4443,7 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) ! calculate cos(SZA) call w3fs13(idat(3),idat(1),idat(2),jdn) -!$omp parallel do default(none) private(i,j,sun_zenith,sun_azimuth) shared(jsta,jend,ista,iend,czen,czmean,gdlat,gdlon,jdn) +!$omp parallel do default(none) private(i,j,sun_zenith,sun_azimuth) shared(jsta,jend,ista,iend,czen,czmean,gdlat,gdlon,jdn,idat) do j=jsta,jend do i=ista,iend call zensun(jdn,float(idat(4)),gdlat(i,j),gdlon(i,j),pi,sun_zenith,sun_azimuth) From b7003d38969d4de7f2cdbfd5ed5e98ff70a6aa73 Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Tue, 14 Oct 2025 12:53:34 +0000 Subject: [PATCH 5/6] Tweak changes --- io/post_fv3.F90 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/io/post_fv3.F90 b/io/post_fv3.F90 index 61daccf27..157e247a4 100644 --- a/io/post_fv3.F90 +++ b/io/post_fv3.F90 @@ -1120,24 +1120,22 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) ! surface specific humidity if(trim(fieldname)=='qs') then - !$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,arrayr42d,qs,spval) + !$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,arrayr42d,qs,fillValue,spval) do j=jsta,jend do i=ista, iend - if(arrayr42d(i,j) /= spval) then - qs(i,j) = arrayr42d(i,j) - endif + qs(i,j) = arrayr42d(i,j) + if(abs(arrayr42d(i,j)-fillValue) < small) qs(i,j)=spval enddo enddo endif ! foundation temperature if(trim(fieldname)=='tref') then - !$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,spval,arrayr42d,fdnsst) + !$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,spval,arrayr42d,fdnsst,fillValue) do j=jsta,jend do i=ista, iend - if (arrayr42d(i,j) /= spval) then - fdnsst(i,j) = arrayr42d(i,j) - endif + fdnsst(i,j) = arrayr42d(i,j) + if (abs(arrayr42d(i,j)-fillValue) < small) fdnsst(i,j)=spval enddo enddo endif @@ -4457,7 +4455,7 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp) do j=jsta,jend do i=ista,iend if(u10(i,j) == spval .and. v10(i,j) == spval .and. & - f10m(i,j) /=spval .and. uh(i,j,lm)/=spval) then + f10m(i,j) /=spval .and. uh(i,j,lm)/=spval .and. vh(i,j,lm)/=spval) then u10(i,j) = f10m(i,j) * uh(i,j,lm) v10(i,j) = f10m(i,j) * vh(i,j,lm) endif From f0d9902307e3f65e8fc9ec560b520e6f5ef19e92 Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Wed, 15 Oct 2025 11:41:26 +0000 Subject: [PATCH 6/6] Update upp hash to 4a5d595f --- upp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upp b/upp index 92b0baf83..4a5d595fd 160000 --- a/upp +++ b/upp @@ -1 +1 @@ -Subproject commit 92b0baf836cd1cd9112b7e2fb74ec513d858047d +Subproject commit 4a5d595fdbf6c3d658f4becc045af1b6d0b65a5a