Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit air-conditioning adoption #2275

Merged
merged 48 commits into from
Jul 11, 2024

Conversation

cathyxinchangli
Copy link
Contributor

@cathyxinchangli cathyxinchangli commented Dec 2, 2023

Description of changes

This update include code changes for adding an explicit air-conditioning (AC) adoption parameterization scheme in CLMU. This includes adding a new time-varying input variable (AC adoption rate, p_ac), changes to building energy calculations, and a toggle (new namelist variable urban_explicit_ac)

Specific notes

The explicit-AC-adoption scheme is on by default (urban_explicit_ac = .true.) in this pull request. The default urban time-varying input data file (namelist variable stream_fldfilename_urbantv) needs to be changed to include p_ac_[TBD/HD/MD] variables, whether or not the explicit-AC-adoption scheme is on. Additional changes needed include:

  • If explicit AC adoption is off, the p_ac_[TBD/HD/MD] variables are set to 1 universally, and the building interior setpoints (tbuildmax_[TBD/HD/MD]) remain unchanged, to ensure the model reproduces previous results;
  • If explicit AC adoption is on, the p_ac_[TBD/HD/MD] variables take on actual AC adoption rate values (present-day global data were developed together with the code change), and tbuildmax_[TBD/HD/MD] are set to 300K/27°C universally.

Contributors other than yourself, if any:

Lei Zhao (@Face2sea), Keith Oleson (@olyson), Bowen Fang (@fang-bowen), Keer Zhang (@keerzhang1).

CTSM Issues Fixed (include github issue #):

#2254

Are answers expected to change (and if so in what way)?

No if explicit AC adoption is off. Otherwise, with the accompanying AC adoption rate dataset, urban air-conditioning energy flux (URBAN_AC) and waste heat flux (WASTEHEAT) increase in some regions, bringing modeled anthropogenic heat closer to the observational estimates. Urban 2-m air temperature (TSA_U) increases slightly (up to 0.1K) in some places as a result.

Any User Interface Changes (namelist or namelist defaults changes)?

  • New namelist variable added: urban_explicit_ac = .true. by default.
  • Default input file to stream_fldfilename_urbantv needs to change (example files available in my directory).

Testing performed, if any:

We ran land-only simulations at 0.9 by 1.25 degree resolution for 2005 - 2014 driven by GSWP3 forcings, and compared simulated anthropogenic heat flux (AHF) due to AC with published AHF datasets. We also conducted experiments with various AC adoption rates (p_ac = 0, 0.03, and 1 everywhere, and using the present-day dataset) to verify that the model behaves as expected.

1. `src\cpl\share_esmf\UrbanTimeVarType.F90`: Modify `stream_varnames` dimensions so that it becomes independent of urban density type indices (7-9), to prepare for future time varying data input for `p_ac` (and `p_h`, possibly);
2.  `src\biogeophys\UrbBuildTempOleson2015Mod.F90`: Add `p_ac` to the equation of `eflx_urban_ac`; not being implemented yet.
Add missing comment signs
[dev.01] Debugging after first test run.

Problem:
First test run (job 6762983) returned all URBAN_AC results as 0. Suspect a mismatch between the indices of `stream_varnames` and `t_building_max`, which may have resulted in all `t_building_max` being set to nan/very large number.

Solution:
Modify subroutine `urbantv_interp` by hard-coding *land unit type - 6* to ensure the if statement criterion returns true.
1. `src\cpl\share_esmf\UrbanTimeVarType.F90`: Add 3 more dimensions to `stream_varnames` (4,5,6) for `p_ac`;
2.  `src\biogeophys\UrbBuildTempOleson2015Mod.F90`: Use `p_ac` in the equation of `eflx_urban_ac`.
Bug fix: added missing "end if"
Bug fix: declare p_ac type; comment out original code
1. changed how interior building temperature is updated based on proposed scheme, by adding back the heat not removed by AC;
2. added an intermediate local variable `efllx_urban_ac_sat`;
3. `t_building_max` now indicates the saturation setpoints.
Remove 8 write to log statements (added in as part of dev.02 for debugging) to fix the timing issues
1. Add a new logical variable `urban_explicit_ac` (default true) in __UrbanParamsType.F90__;
2. Add if-else block to building interior building temperature and AC flux calculation in __UrbBuildTempOleson2015Mod.F90__: use p_ac if `urban_explicit_ac` is set to true, otherwise use the original way of calculation;
3. Add `urban_explicit_ac` to __namelist_definition_ctsm.xml__; and
4. Add `urban_explicit_ac` default value (.true.) to __namelist_defaults_ctsm.xml__.
5. Add `urban_explicit_ac` to __CLMBuildNamelist.pm__.
Add missing ";"
Add "`end if`"
Changed nlevurb to 10 (line 207) to conform to the new surfdata file.
Fix syntax error
Bug fix: t_building calculation
Bug fix on view factor and radiative energy balance check
Formalized comments in the code
@samsrabin samsrabin added the next this should get some attention in the next week or two. Normally each Thursday SE meeting. label Dec 2, 2023
@samsrabin samsrabin added tag: enh - new science enhancement new capability or improved behavior of existing capability labels Jan 4, 2024
@samsrabin samsrabin removed the next this should get some attention in the next week or two. Normally each Thursday SE meeting. label Jan 4, 2024
@ekluzek
Copy link
Collaborator

ekluzek commented Jan 19, 2024

I'm converting this to a draft, as it may be awhile before we can bring this in. Don't worry this is just a normal thing here.

@olyson are you dialed in on this project and have your reviewed this PR?

@ekluzek ekluzek marked this pull request as draft January 19, 2024 16:38
@cathyxinchangli
Copy link
Contributor Author

Thanks, @olyson! I have deleted case_id and added citation. Here's the final list of global attributes:

:date = "Thu Jun 22 15:08:20 MDT 2023" ;
:source = "/glade/work/xinchang/02_Explicit_AC_Adoption/02_data_present_day/03_create_urbantv_file_netCDF4.ipynb" ;
:title = "Streams File for Air-conditioning Penetration Rate and Maximum Building Interior Temperature for TBD, HD, and MD urban classes from Li et al. (2024)" ;
:history = <...omitted...>
:NCO = "netCDF Operators version 5.1.9 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco, Citation = 10.1016/j.envsoft.2008.03.004)" ;
:citation = "Li, X., Zhao, L., Oleson, K., Zhou, Y., Qin, Y., Zhang, K., & Fang, B. (2024). Enhancing urban climate-energy modeling in the Community Earth System Model (CESM) through explicit representation of urban air-conditioning adoption. Journal of Advances in Modeling Earth Systems, 16, e2023MS004107. https://doi.org/10.1029/2023MS004107" ;

Let me know if these look good! The new file is here:

/glade/work/xinchang/02_Explicit_AC_Adoption/02_data_present_day/CTSM52_urbantv_Li_2024_0.9x1.25_simyr1849-2106_c20230621.nc

@olyson
Copy link
Contributor

olyson commented May 23, 2024

Looks good, thanks!

@olyson
Copy link
Contributor

olyson commented May 23, 2024

Ran aux_clm testing on Izumi. Failed tests:

NLCOMPs for Clm60, Clm50, and Clm45 tests - expected due to presence of urban_explicit_ac = .false. (Clm50 and Clm45) and urban_explicit_ac = .true. (Clm60).
BASELINEs for Clm60 - expected.
The following tests which are marked as expected FAIL, PASSed:

    PASS FUNITCTSM_P1x1.f10_f10_mg37.I2000Clm50Sp.izumi_intel RUN time=171 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.izumi_nag.clm-FatesFireLightningPopDens--clm-NEON-FATES-NIWO RUN time=71 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.izumi_nag.clm-FatesPRISM--clm-NEON-FATES-YELL RUN time=49 (UNEXPECTED: expected FAIL)

Update externals to cesm2_3_beta17, remove mct, retire /test/tools

Changes unrelated to the tag's title:
@olyson
Copy link
Contributor

olyson commented May 30, 2024

Merged up to ctsm5.2.006. No conflicts. Ran aux_clm testing on Derecho. Failed tests:

NLCOMPs for Clm60, Clm51, Clm50, and Clm45 tests - expected due to presence of urban_explicit_ac = .false. (Clm50 and Clm45) and urban_explicit_ac = .true. (Clm60 and Clm51).
BASELINEs for Clm60 and Clm51 tests - expected. I again spotchecked RMS for a couple of these tests. The expectation is that while urban and gridcell level fields can differ, any rural fields, e.g., *_R, should not differ. I found this to be the case.

The following test FAILed as PEND at the COMPARE_base_rest stage:

PEND ERP_P256x2_Ld30.f45_f45_mg37.I2000Clm60FatesRs.derecho_intel.clm-mimicsFatesCold COMPARE_base_rest

which is not marked as an expected FAIL, but the RUN part is marked as an expected FAIL so this seems ok.

The following tests which are marked as expected FAIL, PASSed:

    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Bgc.derecho_gnu.clm-default--clm-NEON-NIWO SHAREDLIB_BUILD time=14 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Bgc.derecho_gnu.clm-default--clm-NEON-NIWO RUN time=24 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Bgc.derecho_gnu.clm-NEON-MOAB--clm-PRISM SHAREDLIB_BUILD time=8 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Bgc.derecho_gnu.clm-NEON-MOAB--clm-PRISM RUN time=31 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.derecho_gnu.clm-FatesPRISM--clm-NEON-FATES-YELL SHAREDLIB_BUILD time=11 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.derecho_gnu.clm-FatesPRISM--clm-NEON-FATES-YELL RUN time=14 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.derecho_intel.clm-FatesFireLightningPopDens--clm-NEON-FATES-NIWO SHAREDLIB_BUILD time=10 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.derecho_intel.clm-FatesFireLightningPopDens--clm-NEON-FATES-NIWO RUN time=18 (UNEXPECTED: expected FAIL)

@olyson
Copy link
Contributor

olyson commented May 30, 2024

Ran aux_clm testing on Izumi. Failed tests:

NLCOMPs for Clm60, Clm50, and Clm45 tests - expected due to presence of urban_explicit_ac = .false. (Clm50 and Clm45) and urban_explicit_ac = .true. (Clm60).
BASELINEs for Clm60 tests - expected

The following tests which are marked as expected FAIL, PASSed:

    PASS FUNITCTSM_P1x1.f10_f10_mg37.I2000Clm50Sp.izumi_intel RUN time=167 (UNEXPECTED: expected FAIL)
    PASS ERS_D_Ld15.f45_f45_mg37.I2000Clm50FatesRs.izumi_nag.clm-FatesColdTwoStream CREATE_NEWCASE (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.izumi_nag.clm-FatesFireLightningPopDens--clm-NEON-FATES-NIWO SHAREDLIB_BUILD time=11 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.izumi_nag.clm-FatesFireLightningPopDens--clm-NEON-FATES-NIWO RUN time=74 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.izumi_nag.clm-FatesPRISM--clm-NEON-FATES-YELL SHAREDLIB_BUILD time=11 (UNEXPECTED: expected FAIL)
    PASS SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.izumi_nag.clm-FatesPRISM--clm-NEON-FATES-YELL RUN time=51 (UNEXPECTED: expected FAIL)

@olyson
Copy link
Contributor

olyson commented Jun 1, 2024

Ran ctsm_sci testing on Derecho.Failed tests:

NLCOMPs for Clm60, Clm50 tests - expected due to presence of urban_explicit_ac = .false. (Clm50) and urban_explicit_ac = .true. (Clm60).
BASELINEs for Clm60 tests - expected

The following tests FAILed initially but PASSed after rerunning them.

    Exceeded resource walltime: SMS_Ld5.f09_g17.IHistClm50Sp.derecho_intel.clm-default
    inputdata not found: SMS_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.IHistClm60Sp.derecho_intel.clm-clm60cam6LndTuningMode_2013Start
    SHAREDLIB_BUILD failed to initialize: RXCROPMATURITY_Lm61.f09_g17.IHistClm50BgcCrop.derecho_intel.clm-cropMonthOutput

@ekluzek ekluzek added the PR status: ready PR: author feels this is ready to merge in label Jun 6, 2024
@slevis-lmwg slevis-lmwg self-assigned this Jun 6, 2024
@slevis-lmwg
Copy link
Contributor

slevis-lmwg commented Jun 6, 2024

From software meeting 2024/6/6:

  • ./rimport needs to be done on file: /glade/work/xinchang/02_Explicit_AC_Adoption/02_data_present_day/CTSM52_urbantv_Li_2024_0.9x1.25_simyr1849-2106_c20230621.nc. This should be put in /glade/campaign/cesm/cesmdata/inputdata/lnd/clm2/urbandata and in /fs/cgd/csm/inputdata/lnd/clm2/urbandata

@slevis-lmwg will merge and tag this on main with the namelist option OFF first as bfb no change.
Then @slevis-lmwg will merge and tag on main with the namelist option ON with expected changes to answers.

Rm manage_externals and update documentation accordingly

Fixes ESCOMP#2537 Remove manage_externals stuff from run_sys_tests
Fixes ESCOMP#2536 Update documentation for git-fleximod
Fixes ESCOMP#2467 Remove references to cheyenne from the testlist
…adoption

Update git fleximod to resolve some issues we found with it

Just update the gitfleximod subtree to v0.7.8. This fixes an issue in identifying that a tag is out of sync in a submodule.
An issue about recursion on a submodule. Allows untracked files, and fixes a MS Window Memory error. And
also git-fleximod status marks optional submodules, which helps explain why they are marked as not-checked out.
@olyson
Copy link
Contributor

olyson commented Jun 24, 2024

Updated to branch_tags/tmp-240620.n02.ctsm5.2.007
git status gives:

Untracked files:
(use "git add ..." to include in what will be committed)
components/cpl7/
components/mizuroute/

@ekluzek , should I just delete those directories?

@ekluzek
Copy link
Collaborator

ekluzek commented Jun 24, 2024

@olyson yes just delete those directories. This is an artifact of the externals update and moving to git-fleximod. We removed the cpl7 directory explicitly and the name was changed for mizuRoute.

@slevis-lmwg slevis-lmwg changed the base branch from master to tmp-240620 June 24, 2024 17:22
@slevis-lmwg slevis-lmwg changed the base branch from tmp-240620 to master July 10, 2024 22:28
Handle CAM7 and C/E in long compsets

Changes so that CAM7 is allowed for the land-tuning mode. Allow "C" and
"E" after period designation in long compset names. Fix an
issue with Zender dust emission soil eroditability files.
@slevis-lmwg
Copy link
Contributor

slevis-lmwg commented Jul 10, 2024

  • I need to update the ChangeLog/ChangeSum files
  • aux_clm on derecho OK
  • aux_clm on izumi OK
    NB: Since I could not push to the PR for now, I recreated my derecho updates to the branch on izumi manually:
git clone https://github.com/cathyxinchangli/ctsm.git explicit-hac-adoption
cd explicit-hac-adoption/
git remote rename origin cathyxinchangli
git checkout -b explicit-hac-adoption cathyxinchangli/explicit-hac-adoption
git remote add escomp https://github.com/ESCOMP/ctsm.git
git fetch escomp
git merge ctsm5.2.009
./bin/git-fleximod update
./run_sys_tests -s aux_clm -c ctsm5.2.009 -g ctsm5.2.010

@slevis-lmwg
Copy link
Contributor

Hi @cathyxinchangli
I updated my local copy of this branch to the latest clm tag and tried to push to the PR, but I do not have permissions. Could you add me as collaborator? Instructions:
Click on your branch explicit-hac-adoption at the top of this screen, then Settings, then "Collaborators" and you should see a way to add me as a collaborator there. Thank you.

@cathyxinchangli
Copy link
Contributor Author

HI @slevis-lmwg! Thanks for letting me know. I just sent you an invite. Let me know if it still doesn't work!

@slevis-lmwg slevis-lmwg merged commit 45bd3a2 into ESCOMP:master Jul 11, 2024
2 checks passed
@slevis-lmwg slevis-lmwg deleted the explicit-hac-adoption branch July 11, 2024 17:32
@slevis-lmwg
Copy link
Contributor

Thank you @cathyxinchangli and everyone! This PR is now merged and tagged as ctsm5.2.010. Keep in mind that we made the change .false. by default (for now) in order to keep answers bit-for-bit identical with ctsm5.2.009.

@cathyxinchangli
Copy link
Contributor Author

That's great news! Thank you @slevis-lmwg, @olyson and everyone else who have contributed and made it happen! 🎊

@Face2sea
Copy link

This is so exciting! Thank you @cathyxinchangli, @olyson, @slevis-lmwg and everyone else!!

@samsrabin samsrabin added the science Enhancement to or bug impacting science label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new capability or improved behavior of existing capability PR status: ready PR: author feels this is ready to merge in science Enhancement to or bug impacting science
Projects
Status: Ready to eat (Done!)
Status: Done (non release/external)
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants