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

dgnumwet

Does anyone know where in the code does the DGNUMWET values get put into the physics buffer?  It appears that they are initially set to zero in aerosol_init but I can't find where non-zero values are assigned.  Once modal_size_parameters is called from modal_aero_sw they suddenly have values. My case:  CESM1_2_1, running F_2000_CAM5_PM with ZM deep convection and CLUBB_SGS activated. Thanks!Mark Branson 
 

jedwards

CSEG and Liaisons
Staff member
Hi Mark chemistry/utils/modal_aero_wateruptake.F90 subroutine modal_aero_wateruptake_dr
 

jedwards

CSEG and Liaisons
Staff member
Hi Mark chemistry/utils/modal_aero_wateruptake.F90 subroutine modal_aero_wateruptake_dr
 
Hi Jim.At first I also thought the values were getting set in modal_aero_wateruptake_dr.  But, for my case, tphysbc calls aerosol_wet_intr which has this call to modal_aero_wateruptake_dr:      call modal_aero_wateruptake_dr(state, pbuf)   So the optional argument variable dgnumwet_m is not used.  Then, further down in tphysbc, radiation_tend calls aer_rad_props_sw which then calls modal_aero_sw, and that subroutine contains this block of code:   ! loop over all aerosol modes   call rad_cnst_get_info(list_idx, nmodes=nmodes)   if (list_idx == 0) then      ! water uptake and wet radius for the climate list has already been calculated      call pbuf_get_field(pbuf, dgnumwet_idx, dgnumwet_m)      call pbuf_get_field(pbuf, qaerwat_idx,  qaerwat_m)   else      ! If doing a diagnostic calculation then need to calculate the wet radius      ! and water uptake for the diagnostic modes      call modal_aero_calcsize_diag(state, pbuf, list_idx, dgnumdry_m)        call modal_aero_wateruptake_dr(state, pbuf, list_idx, dgnumdry_m, dgnumwet_m, &                                     qaerwat_m, wetdens_m)   endifBut for my case the call to rad_cnst_get_info returns list_indx=0, so you do the pbuf_get_field calls and you don't call modal_aero_wateruptake_dr.  But apparently the pbuf_get_field for dgnumwet_m is returning non-zero values so that array got filled with values somehow. What am I missing? 
 
Hi Jim.At first I also thought the values were getting set in modal_aero_wateruptake_dr.  But, for my case, tphysbc calls aerosol_wet_intr which has this call to modal_aero_wateruptake_dr:      call modal_aero_wateruptake_dr(state, pbuf)   So the optional argument variable dgnumwet_m is not used.  Then, further down in tphysbc, radiation_tend calls aer_rad_props_sw which then calls modal_aero_sw, and that subroutine contains this block of code:   ! loop over all aerosol modes   call rad_cnst_get_info(list_idx, nmodes=nmodes)   if (list_idx == 0) then      ! water uptake and wet radius for the climate list has already been calculated      call pbuf_get_field(pbuf, dgnumwet_idx, dgnumwet_m)      call pbuf_get_field(pbuf, qaerwat_idx,  qaerwat_m)   else      ! If doing a diagnostic calculation then need to calculate the wet radius      ! and water uptake for the diagnostic modes      call modal_aero_calcsize_diag(state, pbuf, list_idx, dgnumdry_m)        call modal_aero_wateruptake_dr(state, pbuf, list_idx, dgnumdry_m, dgnumwet_m, &                                     qaerwat_m, wetdens_m)   endifBut for my case the call to rad_cnst_get_info returns list_indx=0, so you do the pbuf_get_field calls and you don't call modal_aero_wateruptake_dr.  But apparently the pbuf_get_field for dgnumwet_m is returning non-zero values so that array got filled with values somehow. What am I missing? 
 

santos

Member
> So the optional argument variable dgnumwet_m is not used.I think that you have it backwards. The optional argument "dgnumwet_m" is an alternative to the pbuf field, which is not necessary if the pbuf version is being used. So the aerosol_wet_intr call that does not have this argument actually does set the pbuf field. The call in the radiation would never set this field, even if you did reach the else clause of that conditional. In effect, the aerosol_wet_intr call is actually operating on the model state, whereas the call in radiation_tend is to support diagnostic calculations.
 

santos

Member
> So the optional argument variable dgnumwet_m is not used.I think that you have it backwards. The optional argument "dgnumwet_m" is an alternative to the pbuf field, which is not necessary if the pbuf version is being used. So the aerosol_wet_intr call that does not have this argument actually does set the pbuf field. The call in the radiation would never set this field, even if you did reach the else clause of that conditional. In effect, the aerosol_wet_intr call is actually operating on the model state, whereas the call in radiation_tend is to support diagnostic calculations.
 
Hi Sean.Thanks, I think I now understand that the pbuf field is getting the values instead of the dgnumwet_m variable.  Can you point me to the specific lines of code where that is happening?  Is it inside the modal_aero_wateruptake_dr subroutine itself, or somewhere else?Thanks!
 
Hi Sean.Thanks, I think I now understand that the pbuf field is getting the values instead of the dgnumwet_m variable.  Can you point me to the specific lines of code where that is happening?  Is it inside the modal_aero_wateruptake_dr subroutine itself, or somewhere else?Thanks!
 

santos

Member
This variable is indeed set in modal_aero_wateruptake_dr.In CESM 1.2.2, which is probably similar or identical to CESM 1.2.1 here, there's a pbuf_get_field call on line 302 using dgnumwet_idx. (This index is the local copy of the index for "DGNUMWET", retrieved by the module during model initialization using the pbuf_get_index call on line 53.) The effect of pbuf_get_field is to retrieve a pointer to the field, which is dgncur_awet. Then this field is set, through the dgncur_awet pointer, just a little ways down on line 319.
 

santos

Member
This variable is indeed set in modal_aero_wateruptake_dr.In CESM 1.2.2, which is probably similar or identical to CESM 1.2.1 here, there's a pbuf_get_field call on line 302 using dgnumwet_idx. (This index is the local copy of the index for "DGNUMWET", retrieved by the module during model initialization using the pbuf_get_index call on line 53.) The effect of pbuf_get_field is to retrieve a pointer to the field, which is dgncur_awet. Then this field is set, through the dgncur_awet pointer, just a little ways down on line 319.
 

santos

Member
Just as a side note, we've been moving in the direction of having the pbuf_add_field for every variable be in the module that is responsible for setting the field. That's not the case here for CESM 1.2, but in the newer development version of the code, and in many other cases in CESM 1.2, if you want to find where a pbuf field is set, you just find the pbuf_add_field call for that field, and the field setting should be in the same file.
 

santos

Member
Just as a side note, we've been moving in the direction of having the pbuf_add_field for every variable be in the module that is responsible for setting the field. That's not the case here for CESM 1.2, but in the newer development version of the code, and in many other cases in CESM 1.2, if you want to find where a pbuf field is set, you just find the pbuf_add_field call for that field, and the field setting should be in the same file.
 
Top