Indoor humidity and air-conditioning dehumidification - #4164
Indoor humidity and air-conditioning dehumidification#4164cathyxinchangli wants to merge 64 commits into
Conversation
Define, initialize, create history field, and create restart variable for `q_building`, internal building air specific humidity. Add argument "is_prog_buildtemp" to various subroutines to only initialize/create restart file for `q_building` if using prognostic temperature method.
1. define `q_building_max` as a constant in clm_varcon.F90 2. add latent heat component to `eflx_ventilation` and `eflx_building`
1. update `q_building` for the current time step assuming perfect mixing; 2. implement dehumidification process under explicit-AC-adoption scheme: introduce local variable `eflx_urban_ac_sat_lat` to represent latent heat load being removed. Dehumidification under original scheme is not implemented. Humidification for heating is also not implemented. 3. reset `q_building` based on `eflx_urban_ac_sat_lat`.
add one line to account for when there is no sensible heat load and only latent heat load.
Revoke some changes from before b/c they may not be necessary.
Change all waterdiagnostic_type into waterdiagnosticbulk_type to try to fix the error of no "water_inst%waterdiagnostic_inst" defined when trying to call it in clm_driver.F90.
1. Define RH_building, add hist field 2. Convert RH_building_max (RH setpoint) to q_building_max (spec hum setpoint) 3. Calculate RH_building from q_building
Change density and specific heat capacity from dry air to humid air. NOT DONE IN THIS COMMIT but may need to change pressure from forc_pbot to pstd in some QSat() calls to maintain consistency with original code.
change all pressure in QSat() calls to pstd for consistency with original code (i.e., in calculation of rho_dair).
This reverts commit 5f39e20. Changing back to using bottom layer of atmos. pressure to calculate rh_building, based on email discussion with Keith. Need another commit to update the use of pressure in density of humid air calculation.
Change all pressure from pstd (standard pressure) to forc_pbot (bottom layer atmos. forcing pressure).
1. Add variable 'eflx_urban_ac_sen_lun` and hist field `URBAN_AC_SEN` 2. Output `URBAN_AC_SEN` before latent heat is calculated
1. Calculate total condensed water, and convert it to water flux per impervious surface area in UrbBuildTempOlesonMod.F90 (incl. a write statement); 2. Add new variable `qflx_condensate_from_ac_col` in WaterFluxType.F90; 3. Update BuildingTemperature() calls
1. calculate condensate flux w.r.t. urban land unit area in BuildingTemperature subroutine; 2. add condensate flux to surface runoff in TotalSurfaceRunoff subroutine.
`qflx_condensate_from_ac_col` is added to column-level water balance check, and `qflx_condensate_from_ac_grc` is calculated & added to grid-cell-level water balance check. Note these two terms have not been added to the error messages.
|
Hi @olyson, sorry for the delay! I completed the tests after a couple more failed attempts. The comparisons between Modes 0, 1, and 2 are in the following notebooks:
Results in general look reasonable to me in terms of spatial patterns and magnitude. The spatial patterns are mostly consistent before and after merging. It seems after merging, the difference between variables are larger between Mode 1 and 2 (i.e., dehumidification is run more). This seems to agree with the fact that QBUILD is higher after merging for regions with high dehumidification needs (see end of Notebook 1 for plots; also note below). In contrast, the difference between variables are smaller between Mode 0 and 1 after merging, which made sense to me, since before merging, Mode 0 and 1 also used different indoor pressures, which would have contributed to some of the differences. Note: I should point out I used different surface data for running the simulations before and after merging, since the old surface data I used (a version of U-Surf) was no longer compatible with ctsm5.4, so I let the model use the default surface data. Apart from higher QBUILD, the code produced lower (up to 6 K over India) monthly mean TBUILD after merging. Was this to be expected because of surface data? Does the default surface data for urban properties use U-Surf in ctsm5.4? |
|
Thanks @cathyxinchangli . U-Surf isn't in ctsm5.4, it uses the Oleson and Feddema data, so yes that's probably why you are seeing those differences. I guess you could try running your older setup (before the merge) with whatever default surface dataset comes with that code (which should include the Oleson and Feddema data), and then compare to your after the merge setup. There will still be differences but they should be much smaller. But if you think the dehumidification parameterization is working fine in the after the merge code, then maybe it's not necessary to do that. |
|
Thanks @olyson! For my peace of mind, I reran Modes 0, 1, and 2 tests with before-merging code base using the default surface datasets, and compared TSA_U, RH2M_U, QBUILD, and TBUILD between Mode 1 simulations done with before- and after-merging code bases. All four variables show smaller differences now, and the spatial patterns of the differences are also more random, which is more aligned with what I would expect from a code base change. I summarize the spatiotemporal maximum absolute differences for the four variables below, and the plots can be seen in the last section of this notebook if you are interested:
I also compared the two default surface datasets, and the differences are not that small -- it seems both the urban extent (changing from Gao and O'Neill to CIMP7) and the urban surface properties (such as CV_ROOF/WALL/IMPROAD) changed. See Given this, do you think we are now ready for a code review @olyson? |
olyson
left a comment
There was a problem hiding this comment.
Hi @cathyxinchangli , I'm submitting my review, thanks. I'll be meeting with @ekluzek soon to discuss code changes required for the fortran unit tests, but I don't think that will interfere with resolving these comments when you have time.
|
Hi @olyson, sorry about the delay as I stepped away for other projects! I have now addressed all review comments with new commits and replies when needed. I verified that the results are bit-for-bit for all three modes compared to before I addressed the comments, except for floating point differences for ERRH2O under Mode 2 (see my reply to the specific comment for more details). |
|
Thanks @cathyxinchangli , this looks good, I've resolved all comments. There are three new comments for minor spelling errors. |
|
Hi @cathyxinchangli , with guidance from @ekluzek I've resolved the five fortran unit test failures with this commit: The failures were due to the fact that the namelist is not read in for these unit tests and that triggered the errors in these blocks of code: The solution was to add a InitForTesting subroutine to src/biogeophys/UrbanParamsType.F90 where ReadNamelist is set to .false. and building_humidity_mode is set to its default value, currently 0. The five unit tests then call this subroutine at the appropriate place so that the namelist functions IsBuildingHumidityEnabled and IsACDehumidificationEnabled can be used. Next step is for you to convert the PR from a draft. I've marked this PR with "next" so that we can discuss next steps with the software engineers. |
|
Next step would be a paired review with @slevis-lmwg , you, and myself, to go over the code one more time. You could just email Sam and myself about your availability for meeting via zoom next week if possible. |

Description of changes
The code changes add indoor humidity and air-conditioning dehumidification to the CLMU BEM. It prognoses indoor specific humidity, calculates sensible cooling and latent dehumidification loads, and diagnoses condensate production and routes the condensate into urban runoff. The behavior is controlled by an integer CLM namelist variable,
building_humidity_mode:building_temp_method=1); andurban_hacto beONorON_WASTEHEATandurban_explicit_ac=.true.).The default is set to 0 to ensure bit-for-bit reproducibility with the original scheme.
Specific notes
Contributors other than yourself, if any:
Lei Zhao (@Face2sea), Zhiwen Luo, Keith Oleson (@olyson), Yifan Cheng (@yifanc17), Xiaoxiong Xie, Alvin C. G. Varquez, Mitsuna Sekiya
CTSM issues resolved or otherwise addressed, if any:
Resolves #4162
If answers are expected to change, describe (delete this line otherwise):
Results remain bit-for-bit under
building_humidity_mode=0. Comparingbuilding_humidity_mode=1with0, two new variables are added (QBUILD,RHBUILD), andVENTILATIONandEFLXBUILDchanges because they now include latent heat exchanges between indoors and outdoors, andURBAN_ACandURBAN_HEATchanges slightly because of the changes in ventilation and higher heat capacity of moist air. Comparingbuilding_humidity_mode=2with1, three more new variables (URBAN_AC_SEN,QCOND_FROM_AC,QCOND_FROM_AC_LUN) are added, andURBAN_ACincreases because it now includes sensible (for cooling) and latent (for dehumidification) heat components of urban AC demand.URBAN_HEAT,VENTILATION,EFLXBUILD,WASTEHEATchanges slightly as an indirect results of the changes in AC.Any user interface changes (namelist or namelist defaults changes)?
Yes,
building_humidity_modeis added as a namelist variable.Testing planned or performed, if any:
Results of the tests are under
/glade/work/xinchang/03b_Dehumidification/05_pull_request/.building_humidity_regression_diagnostics.ipynb);building_humidity_mode_diagnostics.ipynb);QAFwere bit-for-bit after a continues 2-month run and a 1-month, 1-resubmit run in all three modes (building_humidity_restart_diagnostics.ipynb). The fact that theQAFdiscrepancy exists under Mode 0 (which is bit-for-bit as the original CLMU) seems to suggest this is not a problem of the new scheme. The reason might be becauseQAFhistory field is computed from the patch-level variable, whereas theQAFrestart field is saved from the land-unit-level variable.Requirements before merge:
/glade/u/home/xinchang/cases_dehumidification/.