Skip to content

xsmrpool_loss should only be written to the restart file if use_crop is true #1097

@billsacks

Description

@billsacks

Brief summary of bug

The xsmrpool_loss state variable looks like it's only used if use_crop is true, but it's written to the restart file always. I think this is responsible for the carbon balance errors we're seeing when we try to interpolate a non-crop initial condition file to a crop case.

General bug information

CTSM version you are using: ctsm1.0.dev105-22-gfc141769d

Does this bug cause significantly incorrect results in the model's science? No

Configurations affected: Any crop configuration that interpolates initial conditions from a non-crop case

Details of bug

@ekluzek found that, with new initial conditions files, a number of Clm45BgcCrop cases are failing. I reproduced the failure in one of these tests (ERP_P36x2_D_Ld5.f10_f10_musgs.I1850Clm45BgcCrop.cheyenne_intel.clm-crop) using his branch with updated initial conditions files (ctsm1.0.dev105-22-gfc141769d). This fails with a carbon balance error, with beg & end carbon balance of 1e36. An interesting thing about this configuration is that it appears to be interpolating from a non-crop initial conditions file onto a crop case (I'm not sure if this is intentional).

It looks like the problem – or at least a problem – is related to the relatively new xsmrpool_loss restart variable. It looks like this variable is only used in crop cases, and it is only set to 0 in InitCold if running with crop. However, it is always written to the restart file. So, in a non-crop case, NaN values will be written to the restart file. If you interpolate from a non-crop case to a crop case using such a restart file, you will end up with NaN (or maybe spval) values on the finidat_interp_dest.nc file, which I think is what is causing these carbon balance errors. (If you use an older restart file that doesn't have the xsmrpool_loss field, then this problem doesn't show up because, in the crop case, the values on the finidat_interp_dest.nc file will be left at their cold start initialization values, which are, correctly, 0.)

I think the solution is to only add the xsmrpool_loss restart variable if use_crop is true – similarly to other crop-specific variables in CNVegCarbonStateType. I have not verified that this solves the problem. Note that this change will need to be made in the code base that you use to create the new (non-crop) initial conditions files (it is not enough to put this code change in place in the code base from which you run the Clm45BgcCrop tests if they are using already-bad non-crop initial conditions files).

Metadata

Metadata

Assignees

Labels

bugsomething is working incorrectlypriority: highHigh priority to fix/merge soon, e.g., because it is a problem in important configurations

Type

No type
No fields configured for issues without a type.

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions