larson-group / clubb_release

Cloud Layers Unified By Binormals (CLUBB)
https://carson.math.uwm.edu/larson-group/clubb_site/
Other
5 stars 5 forks source link

Add Lscale variable as an intent(out) to advance_clubb_core #16

Open adamrher opened 1 month ago

adamrher commented 1 month ago

Requesting the Lscale variable be added as an intent(out) argument to advance_clubb_core, and its api (called from clubb_intr.F90 in CAM). The purpose is for modifying the khzm diffusion coefficient computed in clubb with additional kinetic energy terms stemming from the CLUBB+MF CPT. In CAM, khzm is used outside of clubb to transport aerosols.

I also had trouble accessing the c_K variable used for computing khzm. In advance_clubb_core:

    !----------------------------------------------------------------
    ! Eddy diffusivity coefficient
    !----------------------------------------------------------------
    ! c_K is 0.548 usually (Duynkerke and Driedonks 1987)
    ! CLUBB uses a smaller value to better fit empirical data.

    ! Calculate CLUBB's eddy diffusivity as
    !   CLUBB's length scale times a velocity scale.
    c_K = clubb_params(ic_K)

    !$acc parallel loop gang vector collapse(2) default(present)
    do k = 1, nz
      do i = 1, ngrdcol
        Kh_zt(i,k) = c_K * Lscale(i,k) * sqrt_em_zt(i,k)
      end do
    end do

If this could also be made available in the clubb_intr.F90 interface that would be preferable to what I'm currently doing (duplicating and hard coding this value).

vlarson commented 4 weeks ago

Requesting the Lscale variable be added as an intent(out) argument to advance_clubb_core, and its api (called from clubb_intr.F90 in CAM). The purpose is for modifying the khzm diffusion coefficient computed in clubb with additional kinetic energy terms stemming from the CLUBB+MF CPT. In CAM, khzm is used outside of clubb to transport aerosols.

OK, this sounds doable.

I also had trouble accessing the c_K variable used for computing khzm. In advance_clubb_core: If this could also be made available in the clubb_intr.F90 interface that would be preferable to what I'm currently doing (duplicating and hard coding this value).

In clubb_intr, c_K should be brought into clubb_params_single_col and later into clubb_params. Hence c_K should be accessible in clubb_intr by a line like c_K = clubb_params(i,ic_K). Is this good enough for c_K?

adamrher commented 3 weeks ago

Yes, I was able to access c_K by invoking clubb_params(ic_K). That's good to know, thanks. And so I'm just requesting the Lscale from the api.