ESCOMP / ESCOMP/CTSM

Have CTSM buildnml fail if CCSM_BGC and CLM_CO2_TYPE isn't consistent

Open
#4,183 1 comment 0 reactions 1 assignee Claimed by @ekluzek View on GitHub
b4b code health enhancement size: small usability
Dominant language
Fortran
Stars
352
Forks
361
Avg merge
2d 21h
Merged PRs (30d)
7

Description

### Brief summary of bug

CLM allows CLM_CO2_TYPE to be independent of CCSM_BGC. But, they are connected and CLM_CO2_TYPE can only be set to something besides constant if CCSM_BGC is CO2A or higher so that the ATM sends CO2

### General bug information

**CTSM version you are using:** ctsm5.4.053
**Does this bug cause significantly incorrect results in the model's science?** Potentially (CO2 might end up undefined)

**Configurations affected:** Inconsisten CCSM_BGC, and CLM_CO2_TYPE

### Details of bug

If CCSM_BGC is none ==> CLM_CO2_TYPE can ONLY be constant
If CCSM_BGC is CO2A, CO2B, CO2C ==> CLM_CO2_TYPE should NOT be constant

### Important details of your setup / configuration so we can reproduce the bug

Having CCSM_BGC==CO2A (or higher) but CLM_CO2_TYPE set to constant could be allowed. CLM will just use CO2 from the constant. But, this is probably a case that means the user is setting it up improperly. If you are sending CO2 from the ATM -- but making it constant in CTSM -- is that really a configuration you want to do? Maybe that could be allowed if coupled to the OCN and CO2 is being used for MARBL. In that case maybe you want MARBL to use CO2 from the ATM -- but want CLM to have constant CO2.

For CLM purposes, CO2A, CO2B, and CO2C all mean that CO2 is coming from the ATM. CO2B and CO2C mean that CLM is sending CO2 fluxes from LND to ATM. So normally you only want to do that if ATM is an active model (so only if CAM for CESM).

Note, also that DATM should also do similar checking here (for DATM_CO2_TSERIES), and shouldn't allow CO2B (except for software testing).

#### Cases:

##### CCSM_BGC == none and CLM_CO2_TYPE != constant

This means CLM is listening to the ATM for CO2 -- but it's NOT being sent. The Fortran code does die with an error:

ERROR: must have Sa_co2prog in import state if co2_type is prognostic

or

ERROR: must have Sa_co2diag in import state if co2_type equal diagnostic

But, better to catch this to preview_namelist time.

##### If CCSM_BGC is CO2A, CO2B, CO2C ==> CLM_CO2_TYPE should NOT be constant

This is mainly because it indicates the user likely isn't setting up their case correctly. If the ATM is bothering to send CO2 to LND -- most of the time CLM should use it. I can think of only two possible counterexamples.

1. CAM sending CO2, but you want fixed CO2 in CLM
2. ATM sending CO2 when coupled to LND/OCN, but you only want it only used by OCN (and constant in CLM)

These cases could be allowed, and other cases cause the model to abort, because it's probably wrong.

So for example I think this should be an error

1. DATM sends CO2, but constant in CLM without active OCN

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.