remove duplication in setting of history fields for carbon isotopes (c13 and c14)
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
**Bill Sacks < sacks@ucar.edu > - 2016-02-16 14:09:01 -0700**
**Bugzilla Id:** [2284](http://bugz.cgd.ucar.edu/show_bug.cgi?id=2284)
**Bugzilla CC:** rfisher@ucar.edu,
There is a lot of near-duplicate code in the InitHistory subroutines of CNVegCarbonStateType.F90 and SoilBiogeochemCarbonStateType.F90 (and maybe elsewhere): Basically the same blocks of code are done for c12, c13 and c14. At a recent CLM-CMT meeting, we decided that this duplication should be removed. Steps to doing so are:
(1) Examine differences between the blocks for c12, c13, c14: confirm that the below steps capture all relevant differences
(2) For variables that currently have hist fields for c12, but not c13 / c14: determine if the exclusion for c13 & c14 is intentional or accidental. (This step is the main thing stopping me from just going ahead and doing this now.)
(3) Introduce the following variables that differ for each instance:
- shortname_prefix: blank for c12, 'C13_' or 'C14_'
- longname_prefix: blank for c12, 'C13 ' or 'C14 '
- units: 'gC', 'gC13', 'gC14'
(4) Use the above variables where they are needed; e.g.:
call hist_addfld1d (fname=shortname_prefix//'LEAFC', ...)
(5) Introduce a variable default_for_non_isotope_fields (probably can come up with a better name). This is 'active' for c12, 'inactive' for c13 and c14. Then, for fields that are currently active by default for c12, but inactive by default for c13 or c14 (or weren't added at all for c13/c14), set: default=default_for_non_isotope_fields
(6) Check header of an h0 history file in a BGC case: should be the same as before
Contributor guide
Assessment
This issue has not been assessed yet.