Adding Dust 1-5 Variable to wrf_cntrl

I am using UPP version 3.1.1, and have been trying to output Dust_1 - 5 from
wrfout. I added LLWS in the past in wrf_cntrl file and I can view the
variable easily by running run_unipost. However, I did the same process for
Dust 1-5 and I get no added parameters in the grib1 output.


(DUST 1 ON P SFCS    ) SCAL=( 6.0)
L=(10000 01001 01010 10101 01010 10101 01010 11111 11111 10000 00000 00000
00000 00000)
(DUST 2 ON P SFCS    ) SCAL=( 6.0)
L=(10000 01001 01010 10101 01010 10101 01010 11111 11111 10000 00000 00000
00000 00000)
(DUST 3 ON P SFCS    ) SCAL=( 6.0)
L=(10000 01001 01010 10101 01010 10101 01010 11111 11111 10000 00000 00000
00000 00000)
(DUST 4 ON P SFCS    ) SCAL=( 6.0)
L=(10000 01001 01010 10101 01010 10101 01010 11111 11111 10000 00000 00000
00000 00000)
(DUST 5 ON P SFCS    ) SCAL=( 6.0)
L=(10000 01001 01010 10101 01010 10101 01010 11111 11111 10000 00000 00000
00000 00000)

I am not sure where the issue is coming from, because i check the .out file
and there are no major errors.
Also, there is another wrfout parameter that I would like to add to UPP but
it's not available in Table 1 (TOT_DUST). I would like to know how to add the
that variable if anyone has ever tried to do it in the community.
Looking forward to hearing from you.
Kind regards,
Khalid Ahmad Festok

I can give some general information on outputting dust based on a previous user issue. Note that this has not been tested with your version of UPP (V3.1.1) or with GRIB1 output since that format is no longer supported.

1. Outputting dust requires gocart to be turned on. In the source code directory in WRFPOST.f, search 'gocart_on' and change it to .true.

2. In the source code directory in INITPOST.F, search 'DUST_1' to find where these variables are being read in. You will see an if-statement 'if (1=2) then'. Either change this statement so that it is true or remove the if-statement altogether. Due to this statement, DUST is never read in, even if gocart is turned on.

3. For GRIB2 output only. In the parm directory in post_avblflds.xml, change 'fixed_sfc1_type' from isobaric_lvl to isobaric_sfc for each of the isobaric DUST parameter entries.

Re-compile the UPP code for the source code changes to take effect.

Thank you hertneky for your informative answer. I got the output to include Dust1-5 in GRIB1 format.

There is another wrfout parameter that I would like to add to UPP but it's not available in Table 1 (TOT_DUST). I would like to add the that variable, just like we added Dust1-5, if you've ever attempted to do it. If not, has it ever been attempted to output Dust Load or Dust Concentration through UPP? 

Appreciate your help and looking forward to hearing from you again.

 

Total dust, dust load, and dust concentration are not currently available in the UPP code. These are fields you would need to add yourself and would require modifications to some of the routines. Total dust would be easy to add since dust 1-5 are already read into UPP. For the other two, you would either need them in your model output or the ability to compute them in UPP. Please reference these instructions for Adding a New Variable:

https://dtcenter.org/sites/default/files/community-code/add-new-upp-variable.pdf

Thank for your continuous support.

I had no issues with adding new GRIB1 Variable. Going back to your first reply for GRIB2. I followed the exact instruction in modifying the file post_avblflds.xml, but I didn't get any results.

    <param>
       <post_avblfldidx>438</post_avblfldidx>
       <shortname>DUST1_ON_ISOBARIC_LVL</shortname>
       <pdstmpl>tmpl4_48</pdstmpl>
       <pname>MASSMR</pname>
       <fixed_sfc1_type>isobaric_sfc</fixed_sfc1_type>
       <aerosol_type>dust_dry</aerosol_type>
       <typ_intvl_size>between_first_second_limit_noincl2ndlmt</typ_intvl_size>
       <scale_fact_1st_size>7</scale_fact_1st_size>
       <scale_val_1st_size>2</scale_val_1st_size>
       <scale_fact_2nd_size>7</scale_fact_2nd_size>
       <scale_val_2nd_size>20</scale_val_2nd_size>
       <scale>11.0</scale>
    </param>
 

Am I missing something? Or is there another step that I need to follow?

For GRIB2 output, there is an additional pre-processing step. UPP does not read the xml file directly, but instead reads a text file postxconfig-NT.txt. Please see https://upp.readthedocs.io/en/upp-v9.0.0/InputsOutputs.html#control-file section 3.1.2.3 Creating the Flat Text File for information on how to do this if you have not already done it. Then point UPP to the new text file before running. While this txt file is not very readable, you can check that it has your dust parameters in it before running.

I got them both to work GRIB1&2. Thank you. 

I'm trying to add a dust parameter which is TOT_DUST from wrf. I've followed all the steps, and I do get a new variable but with no data. I've modified the following:

1- CTLBLK.f

! Add GOCART aerosol specification
  integer, parameter :: nbin_du = 6             ! dust
 

2- RQSTFLD.f:

! Add Total Dust
      DATA IFILV(912),AVBL(912),IQ(912),IS(912),AVBLGRB2(912)      &
     &                      /1,'TOT DUST ON P SFCS    ',253,100,     &
     &                       'TOTDU ON isobaric_sfc'/
 

3- INITPOST.F

     VarName='TOT_DUST'
      call getVariable(fileName,DateStr,DataHandle,VarName,DUM3D,       & 
         IM+1,1,JM+1,LM+1,IM,JS,JE,LM)
!      call getVariable(fileName,DateStr,DataHandle,VarName,DUM3D,
!     &  IM,1,JM,1,IM,JS,JE,1)
      do l=1,lm
       do j = jsta_2l, jend_2u
        do i = 1, im
!            CLDFRA( i, j ) = dummy ( i, j )
            DUST ( i, j, l, 6) = dum3d ( i, j, l )
        end do
       end do
      end do


4- MDL2P.f

         IF (IGET(912) > 0) THEN
          IF (LVLS(LP,IGET(912)) > 0) THEN
!$omp  parallel do private(i,j)
             DO J=JSTA,JEND
               DO I=1,IM
                 GRID1(I,J) = DUSTSL(I,J,6)
               ENDDO
             ENDDO
             if(grib == 'grib1')then
               ID(1:25)=0
               ID(02)=141             ! Parameter Table 141
               CALL GRIBIT(IGET(912),LP,GRID1,IM,JM)
             elseif(grib == 'grib2') then
               cfld = cfld + 1
               fld_info(cfld)%ifld=IAVBLFLD(IGET(912))
               fld_info(cfld)%lvl=LVLSXML(LP,IGET(912))
!$omp parallel do private(i,j,jj)
               do j=1,jend-jsta+1
                 jj = jsta+j-1
                 do i=1,im
                   datapd(i,j,cfld) = GRID1(i,jj)
                 enddo
               enddo
             endif
          ENDIF
         ENDIF
         endif  ! if gocart_on
 

As you can see i changed the dust bins to 6 instead of 5 in CTLBLK and other fortran files and I'm not sure if I am doing it correctly.This is the Error I got with unipost.out

GRIBIT:  253 TOT DUST ON P SFCS   100     0  1000
 starting computing canopy conductance
*** Error in `/home/nwp/WRF3/UPPV3.1.1/bin/unipost.exe': free(): invalid pointer: 0x00002b4ff1d99010 ***
======= Backtrace: =========
 end of MDL2THandpv
/lib64/libc.so.6(+0x7cfe1)[0x2b4fede05fe1]