Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Issue with Cloud configuration sampling in RRTMG (radiation) as used in CAM6

Dorri

Dorri Halbertal
New Member
What version of the code are you using? Relevant for all CAM versions, to the best of my knowledge (checked the CAM6 code based on the Github repository).

Describe your problem or question:

This question is related to cloud sampling in the radiation transfer module as part of the implementation of the MC-ICA approach for clouds. To the best of my understanding within

CAM6 the parameter permuteseed is hard-coded with a certain fixed value for short-wave (SW) and another fixed value for long-wave (LW). This parameter is passed to the function generate_stochastic_clouds as the input parameter changeSeed as part of the implementation of the MC-ICA cloud parametrization approach (Monte-Carlo Independent Cloud Approximation). The result is basically that the same configuration is sampled again and again. The only seed permutation is done between columns and not between function calls.
In fact, in the comments of the function generate_stochastic_clouds the following statement appears: "If the stochastic cloud generator is called several times during the same timestep, one should change the seed between the call to insure that the subcolumns are different. This is done by changing the argument 'changeSeed'". This suggested seed shift is not done to the best of my understanding in CAM6. I would be happy to be mistaken, please let me know where I am wrong in this post.
 

brianpm

Active Member
In the CAM interface to RRTMG, the SW and LW radiation calculations each use a parameter called permuteseed, and they are offset from each other. The offset is recommended in the comments to the code.

  1. CAM/src/physics/rrtmg/radsw.F90, in subroutine rad_rrtmg_sw link to code:
    Code:
    ! Set permute seed (must be offset between LW and SW by at least 140 to insure 
    ! effective randomization)
    permuteseed = 1
    call mcica_subcol_sw(lchnk, Nday, rrtmg_levs-1, icld, permuteseed, pmid, & 
    cld, cicewp, cliqwp, rei, rel, tauc_sw, ssac_sw, asmc_sw, fsfc_sw, & 
    cld_stosw, cicewp_stosw, cliqwp_stosw, rei_stosw, rel_stosw, & 
    tauc_stosw, ssac_stosw, asmc_stosw, fsfc_stosw)
  2. and in radlw.F90 in subroutine rad_rrtmg_lw link to code
    Code:
    ! Set permute seed (must be offset between LW and SW by at least 140 to insure 
    ! effective randomization) 
    permuteseed = 150 
    ! These fields are no longer supplied by CAM. 
    cicewp = 0.0_r8 
    cliqwp = 0.0_r8 
    rei = 0.0_r8 
    rel = 0.0_r8 
    call mcica_subcol_lw(lchnk, ncol, rrtmg_levs-1, icld, permuteseed, pmid(:, pverp-rrtmg_levs+1:pverp-1), & 
    cld(:, pverp-rrtmg_levs+1:pverp-1), cicewp, cliqwp, rei, rel, tauc_lw(:, :ncol, pverp-rrtmg_levs+1:pverp-1), & 
    cld_stolw, cicewp_stolw, cliqwp_stolw, rei_stolw, rel_stolw, tauc_stolw)
So at least we do see that they are offset in SW vs LW as indicated.

The mcica_subcol_sw and mcica_subcol_lw subroutines are in the aer_src directory.

To understand the implementation, we need to dive into these routines to see how permuteseed is used.

From mcica_subcloud_lw:
Code:
integer, intent(in) :: permuteseed 
! if the cloud generator is called multiple times, 
! permute the seed between each call. 
! between calls for LW and SW, recommended 
! permuteseed differes by 'ngpt'
So as we have seen above, the recommendation is followed to offset the SW and LW values.

The comment raised here is that this fixed value (1, 150) is then passed to generate_stochastic_clouds within mcica_subcloud_lw and mcica_subcloud_sw, and it sounds like the concern is that the seed is not permuted on each call of that function?

Looking into generate_stochastic_clouds, I believe should alleviate these concerns.

There are two random number generators (RNG) that can be used, but the code is fixed to use the kissvec one, so I will only show that part. The model uses RNGs from a module in $CESMROOT/cime/src/share/RandNum/src.

Here's the block from mcica_subcloud_sw:
Code:
      ! For kissvec, create a seed that depends on the state of the columns. Maybe not the best way, but it works.  
      ! Must use pmid from bottom four layers. 
      do i = 1, ncol
         if (pmid(i,nlay) < pmid(i,nlay-1)) then
            call endrun('MCICA_SUBCOL: KISSVEC SEED GENERATOR REQUIRES PMID FROM BOTTOM FOUR LAYERS.')
         end if
         kiss_seed(i,1) = (pmid(i,nlay)   - int(pmid(i,nlay)))    * 1000000000
         kiss_seed(i,2) = (pmid(i,nlay-1) - int(pmid(i,nlay-1)))  * 1000000000
         kiss_seed(i,3) = (pmid(i,nlay-2) - int(pmid(i,nlay-2)))  * 1000000000
         kiss_seed(i,4) = (pmid(i,nlay-3) - int(pmid(i,nlay-3)))  * 1000000000
      end do

      kiss_gen = ShrKissRandGen(kiss_seed)

      do i = 1, changeSeed
         call kiss_gen%random(rand_num_1d)
      end do

The main thing to note here is specified in that top-line comment, the seed depends on the state of the columns.

The line kiss_gen = ShrKissRandGen(kiss_seed) sends the array of size (ncol, 4) to the RNG constructor. When kiss_gen%random(rand_num_1d) is called, the rand_num_1d is the output, and it uses the array of seed values in the direct call to the RNG:
Code:
call kissvec((self%seed(:,1), self%seed(:,2), self%seed(:,3),self%seed(:,4), array(:,i), nstream)
The random numbers that are produced depend on those seed values, which we can see here depend on the the pressure values in the bottom 4 layers. The pressure values change in both space and time, so each model time step and each grid point will produce a different set of random numbers. Along with the offset to get different random numbers between SW and LW, I think this means that the stochastic aspect of the clouds is behaving appropriately.

@Dorri : If you think this is not a correct analysis, or if I am misunderstanding your concern, please let me know.
 
Top