Small missing code related to Qair/Tair and typo

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
hugobastos
Posts: 15
Joined: Tue May 06, 2008 8:46 pm
Location: FURG

Small missing code related to Qair/Tair and typo

#1 Unread post by hugobastos »

Hello to all,

today i realized that i have found a little bug sometime ago, but only today i have seen that i do not reported it ( i think)

The bug: Looks like the options associated to output the variable Specific humidity and Air Temperature are missing in the whole code. I can see that this kind of variables are less important, since you already have it inside the forcing file, but , when using the internal interpolation and getting the data inside an station or averaged file, together with others fields are great ( e.g. for a time series plot u dont need to load the frc file , interp to the station locations and so on, just load them from your beloved sta.nc). Moreover, the options to save Uwind and Vwind are working, so why not Tair and Hair !?( Probably more variables are missing too :? ).

I will talk about the Hair variable, because its the most evident missing parts ( The Tair variable have some different missing parts inside the main code).

First:

The option to write the Specific humidity on the *.in files r missing ("idQair"). The mod_ncparam.F file have the entry for idQair, but there is no code to write the variable "Hair" in wrt_his.F, wrt_avg.F and wrt_station.F.

the code that should be inside wrt_his( and others) are very similar to Pair, except with the "idQair" and right cpp entries.

file wrt_his.F
#line 1035

Code: Select all

# if defined BULK_FLUXES || defined ECOSIM || defined ANA_HUMIDITY
!
!  Write out surface air humidity.
!
      IF (Hout(idQair,ng)) THEN
        scale=1.0_r8
        gtype=gfactor*r2dvar
        status=nf_fwrite2d(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idQair), &
     &                     HIS(ng)%Rindex, gtype,                       &
     &                     LBi, UBi, LBj, UBj, scale,                   &
#  ifdef MASKING
     &                     GRID(ng) % rmask_io,                         &
#  endif
     &                     FORCES(ng) % Hair)
        IF (status.ne.nf90_noerr) THEN
          IF (Master) THEN
            WRITE (stdout,10) TRIM(Vname(1,idHair)), HIS(ng)%Rindex
          END IF
          exit_flag=3
          ioerror=status
          RETURN
        END IF
      END IF
# endif
Similiar to this, we need to code the missing parts inside def_his(and def_avg,def_sta). * Tair already have this part of the code.

file: def_his.F

#line 1193

Code: Select all

# if defined BULK_FLUXES || defined ECOSIM || defined ANA_HUMIDITY
!
!  Define surface air humidity.
!
        IF (Hout(idQair,ng)) THEN
          Vinfo( 1)=Vname(1,idQair)
          Vinfo( 2)=Vname(2,idQair)
          Vinfo( 3)=Vname(3,idQair)
          Vinfo(14)=Vname(4,idQair)
          Vinfo(16)=Vname(1,idtime)
#  if defined WRITE_WATER && defined MASKING
          Vinfo(20)='mask_rho'
#  endif
          Vinfo(22)='coordinates'
          Aval(5)=REAL(Iinfo(1,idQair,ng),r8)
          status=def_var(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idQair),   &
     &                   NF_FOUT, nvd3, t2dgrd, Aval, Vinfo, ncname)
          IF (exit_flag.ne.NoError) RETURN
        END IF
# endif

#line 2444

Code: Select all

# if defined BULK_FLUXES || defined ECOSIM || defined ANA_HUMIDITY
          ELSE IF (TRIM(var_name(i)).eq.TRIM(Vname(1,idQair))) THEN
            got_var(idQair)=.TRUE.
            HIS(ng)%Vid(idQair)=var_id(i)
# endif
#line 2861

Code: Select all

# if defined BULK_FLUXES || defined ECOSIM || defined ANA_HUMIDITY
        IF (.not.got_var(idQair).and.Hout(idQair,ng)) THEN
          IF (Master) WRITE (stdout,60) TRIM(Vname(1,idQair)),          &
     &                                  TRIM(ncname)
          exit_flag=3
          RETURN
        END IF
# endif
and inside inp_par.F:

file: inp_par.F
#line 2222

Code: Select all

# if defined BULK_FLUXES || defined ECOSIM || defined ANA_HUMIDITY
          ELSE IF (TRIM(KeyWord).eq.'Hout(idQair)') THEN
            IF (idQair.eq.0) THEN
              IF (Master) WRITE (out,280) 'idQair'
              exit_flag=5
              RETURN
            END IF
            Npts=load_l(Nval, Cval, Ngrids, Hout(idQair,:))
# endif

At least, when i was checking if everything was ok, i have found a typo inside inp_par just below the new code and inside the directive associated to write Uwind and Vwind :

file: inp_par.F
#line 2231

Code: Select all

IF (idPair.eq.0) THEN
This should be:

Code: Select all

IF (idVair.eq.0) THEN
hope that helps.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Small missing code related to Qair/Tair and typo

#2 Unread post by kate »

So you have the new code, but not the new new code? The line you refer to is now line 1434 of read_phypar.F.

Thanks!

User avatar
arango
Site Admin
Posts: 1350
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: Small missing code related to Qair/Tair and typo

#3 Unread post by arango »

Well, we never intended to write out input data for specific or relative humidity (Hair) neither air temperature (Tair) in the history, time-averaged, or stations NetCDF files. We are not missing code here, so this is not a bug :!: The indices idQair and idTair need to be processed in mod_ncparam.F because this is part of the input Metadata.

We added the wind components (Uair, Vair) and air pressure (Pair) because of their importance in surface forcing and their use in several places of ROMS physical kernel. Notice that we do output every component of the surface heat and freshwater fluxes because this is more important that just analyzing and plotting Hair and Tair. These are more important surface forcing terms for the temperature and salinity governing equations. The impact of Hair and Tair is more difficult to analyze because of their nonlinear relationship with latent and sensible heat fluxes (which we do output).

Notice, that we need to declare, allocate, and initialize arrays to hold the time-averaged field accumulation that we output. I designed a strategy that each of these arrays are allocated if the associated index in Aout is activated to minimized the memory requirement. Otherwise, these arrays are null pointers.

The issue with idVair in read_phypar.F is indeed a typo. As Kate pointed out, you are using an older version of ROMS. Thank you for reporting this typo.

I added writing out Hair and Tair to the request list since you took the time for reporting this with sufficient detail... I like that from users that really put their hands in the code to understand it and solve their problems.

Post Reply