From ce547a20c4b51bbfd12130b34e5bb61f21a76e52 Mon Sep 17 00:00:00 2001 From: David Dowell Date: Thu, 26 May 2022 20:33:48 +0000 Subject: [PATCH] Changes needed to run OU-MAP GSI-EnKF assimilation of reflectivity observations, in a second step after EnKF assimilation of conventional observations. --- src/enkf/gridio_fv3reg.f90 | 6 ++++-- src/gsi/gsi_dbzOper.F90 | 28 +++++++++++++++++++++++++++- src/gsi/setupdbz.f90 | 21 +++++++++++++++------ 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 1101b948ae..f116aa65f9 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -1235,10 +1235,12 @@ subroutine type_bound_setupfile(this,fileid1,fv3fn1,fileid2,fv3fn2,fileid3,fv3fn this%l_filecombined=.false. this%fv3lamfilename(1)=trim(fv3fn1) this%fv3lamfilename(2)=trim(fv3fn2) - this%fv3lamfilename(3)=trim(fv3fn3) this%fv3lam_fileid(1)=fileid1 this%fv3lam_fileid(2)=fileid2 - this%fv3lam_fileid(3)=fileid3 + if (present (fileid3)) then + this%fv3lamfilename(3)=trim(fv3fn3) + this%fv3lam_fileid(3)=fileid3 + endif else this%l_filecombined=.true. this%fv3lamfilename(1)=fv3fn1 diff --git a/src/gsi/gsi_dbzOper.F90 b/src/gsi/gsi_dbzOper.F90 index 74d9bdf65d..661d4b9fe0 100644 --- a/src/gsi/gsi_dbzOper.F90 +++ b/src/gsi/gsi_dbzOper.F90 @@ -83,6 +83,10 @@ subroutine setup_(self, lunin, mype, is, nobs, init_pass,last_pass) use jfunc , only: jiter use mpeu_util, only: die + + use directDA_radaruse_mod, only: l_use_dbz_directDA + use obsmod, only: dirname, ianldate + implicit none class(dbzOper ), intent(inout):: self integer(i_kind), intent(in):: lunin @@ -99,8 +103,30 @@ subroutine setup_(self, lunin, mype, is, nobs, init_pass,last_pass) character(len=len_isis ):: isis integer(i_kind):: nreal,nchanl,ier,nele logical:: diagsave + integer(i_kind):: lu_diag + character(128):: diag_file + character(80):: string + + if(nobs == 0) then + + if(mype == 0) then + write(6,*) 'init_pass = ', init_pass + write(6,*) 'l_use_dbz_directDA = ', l_use_dbz_directDA + endif - if(nobs == 0) return + if( (mype == 0) .and. init_pass .and. (.not. l_use_dbz_directDA) ) then + write(string,600) jiter +600 format('radardbz_',i2.2) + diag_file=trim(dirname) // trim(string) + write(6,*) 'write ianldate to ', diag_file + open(newunit=lu_diag,file=trim(diag_file),form='unformatted',status='unknown',position='rewind') + write(lu_diag) ianldate + close(lu_diag) + endif + + return + + endif read(lunin,iostat=ier) obstype,isis,nreal,nchanl if(ier/=0) call die(myname_,'read(obstype,...), iostat =',ier) diff --git a/src/gsi/setupdbz.f90 b/src/gsi/setupdbz.f90 index a7f7ba52e1..4499cd3449 100644 --- a/src/gsi/setupdbz.f90 +++ b/src/gsi/setupdbz.f90 @@ -1453,11 +1453,19 @@ subroutine setupdbz(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,radardbz_d ! Write information to diagnostic file if(radardbz_diagsave .and. ii>0 )then - if( .not. l_use_dbz_directDA )then - write(7)'dbz',nchar,nreal,ii,mype,ioff0 - write(7)cdiagbuf(1:ii),rdiagbuf(:,1:ii) - deallocate(cdiagbuf,rdiagbuf) - else +! DCD 25 May 2022: When the following if test returns "true", reflectivity diagnostics are written to +! the same diag file as for the conventional observations. However, separate conventional and reflectivity +! diagnostic files are what we typically want for EnKF assimilation, i.e., conventional observations +! are assimilated in the first execution of EnKF and then reflectivity observations are assimilated +! in a second execution of EnKF. It's unclear why the following if test appears +! in the EMC master GSI. For now, I've commented out this if test so that we'll always have +! the separate conventional and reflectivity diag files needed for a two-step EnKF analysis. + +! if( .not. l_use_dbz_directDA )then +! write(7)'dbz',nchar,nreal,ii,mype,ioff0 +! write(7)cdiagbuf(1:ii),rdiagbuf(:,1:ii) +! deallocate(cdiagbuf,rdiagbuf) +! else write(string,600) jiter 600 format('radardbz_',i2.2) @@ -1472,6 +1480,7 @@ subroutine setupdbz(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,radardbz_d open(lu_diag,file=trim(diag_file),form='unformatted',status='unknown',position='rewind') endif endif + if(init_pass .and. mype == 0) then if ( .not. l_use_dbz_directDA ) then ! EnKF uses these diagnostics and EnKF uses single OBS file for now. write(lu_diag) ianldate ! So do not write analysis date for binary in case of using direct reflectivity DA. @@ -1484,7 +1493,7 @@ subroutine setupdbz(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,radardbz_d write(lu_diag)cdiagbuf(1:ii),rdiagbuf(:,1:ii) deallocate(cdiagbuf,rdiagbuf) close(lu_diag) - end if + ! end if end if write(6,*)'mype, irefsmlobs,irejrefsmlobs are ',mype,' ',irefsmlobs, ' ',irejrefsmlobs ! close(52) !simulated obs