Skip to content

Evasinha/ehc/degree days#10

Open
evasinha-pnnl wants to merge 11 commits into
masterfrom
evasinha/ehc/degree_days
Open

Evasinha/ehc/degree days#10
evasinha-pnnl wants to merge 11 commits into
masterfrom
evasinha/ehc/degree_days

Conversation

@evasinha-pnnl

Copy link
Copy Markdown
Contributor

Merging the HDD/CDD addition in the giac branch.

Add 2m reference temperature (t_ref2m) coupling field and degree-days
computation to the IAC Fortran interface:

- gcam_cpl_indices.F90: Add index_x2z_Sl_t_ref2m coupling index for
  per-PFT 2m temperature field (Sl_t_ref2m_topo##); add elm_ehc_deg_days
  to namelist read
- iac_import_export.F90: Import t_ref2m from coupler into lnd2iac_vars
- iac_data_mod.F90: Add t_ref2m(lon,lat,pft) and degree_days(lon,lat)
  to lnd2iac_type
- iac_init_mod.F90: Allocate t_ref2m and degree_days arrays; log
  elm_ehc_deg_days namelist value
- gcam_var_mod.F90: Add elm_ehc_deg_days logical namelist variable
- gcam_comp_mod.F90: Compute PFT-weighted degree-days (base 18C) from
  5-year averaged t_ref2m; guard computation to only run on GCAM model
  years when coupler data is properly averaged; pass degree_days and
  aUseDegDays flag to runcGCAM
- Update iac/gcam submodule pointer
Replace the old t_ref2m-based HDD/CDD derivation with direct consumption of
the cumulative per-PFT HDD_accum/CDD_accum fields sent from ELM.  Each GCAM
year the accumulators are differenced against the previous snapshot to obtain
the annual increment, PFT-weight-averaged to gridcell level, and summed over
the 5-year GCAM period before being divided and passed to runcGCAM.

Changes:
- gcam_cpl_indices.F90: Replace index_x2z_Sl_t_ref2m with
  index_x2z_Sl_HDD_accum and index_x2z_Sl_CDD_accum per-PFT index arrays.
- iac_import_export.F90: Read HDD_accum/CDD_accum from the x2z coupler
  vector into lnd2iac_vars per PFT; remove t_ref2m import.
- iac_data_mod.F90: Replace t_ref2m and 2D HDD/CDD_accum fields in
  lnd2iac_type with 3D HDD_accum(lon,lat,pft), CDD_accum, HDD_accum_prev,
  CDD_accum_prev, and 2D gridcell-mean HDD/CDD passed to runcGCAM.
- iac_init_mod.F90: Allocate and zero-initialize all new fields.
- gcam_comp_mod.F90: In gcam_run_mod, compute annual PFT-weighted HDD/CDD
  increments by differencing accum - accum_prev; accumulate over the 5-year
  GCAM period; on GCAM years divide by iac_gcam_timestep and pass to
  runcGCAM; reset period accumulators after runcGCAM.  Add iac_first_run
  bootstrap flag to prevent a spurious large diff on the first call after
  a restart (sets prev = accum on first entry).
HDD CDD transfer from ELM to GCAM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the IAC/GCAM coupling to support heating/cooling degree days (HDD/CDD)
(and associated baseline files + runtime toggles), wiring the new fields through the
coupler import path, IAC data structures, and the GCAM interface call.

Changes:

  • Add HDD/CDD (and forc_hdm) fields to the lnd→iac data type and allocate them at init.
  • Add namelist/config variables and coupling flags for baseline HDD/CDD files and
    HDD/CDD diagnostic output.
  • Extend coupler indices + import logic and pass HDD/CDD/forc_hdm through to runcGCAM.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
iac/coupling/iac_init_mod.F90 Adds HDD/CDD namelist items and allocates new lnd→iac arrays.
iac/coupling/iac_data_mod.F90 Extends lnd2iac_type with forc_hdm, hdd, and cdd.
iac/coupling/gcam_var_mod.F90 Declares new HDD/CDD baseline file variables and runtime flags.
iac/coupling/gcam_comp_mod.F90 Passes HDD/CDD + forc_hdm into runcGCAM; adds new control flags.
cpl/iac_import_export.F90 Imports scalar per-gridcell HDD/CDD/forc_hdm fields (with unit conversion).
cpl/gcam_cpl_indices.F90 Adds coupler indices for the new scalar lnd→iac fields and namelist entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cpl/iac_import_export.F90 Outdated
Comment thread iac/coupling/gcam_comp_mod.F90 Outdated
Comment thread iac/coupling/gcam_comp_mod.F90 Outdated
Comment thread iac/coupling/gcam_comp_mod.F90 Outdated
@aldivi

aldivi commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

@evasinha-pnnl I think a namelist item needs to be added for reading DD. currently rdd is set to zero. and there should be a check to make sure that both read and write DD are not the same, especially if they are true. i think there is a check somewhere for the read/write carbon scalars items. i don't recall where, but i think it selects one as an override rather than returning an error; it may also depend on whether scaling is on or off.

@aldivi

aldivi commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

I also agree with copilot that the new variables can be initialized to zero.

@aldivi

aldivi commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

@evasinha-pnnl I think in iac_init, once the namelist is read in, the read/write scalars and read/write DD flags should be checked for both read and write being true. In both cases the read trumps the calculation, use, and writing of values. So if they are both true we should write to the ehc log that the read is true and the write is effectively false and that no calculations or writes are performed for these values.

@aldivi

aldivi commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

@evasinha-pnnl this looks good. i will look at some outputs next week before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants