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

Add global mean CO2 diagnostic #45

Merged

Conversation

spencerkclark
Copy link
Member

Description

This PR adds a diagnostic for the global mean volume mixing ratio of CO2. It does so following the conventions / approximations in radlw_main.f:

!> -# Prepare atmospheric profile for use in rrtm.
! the vertical index of internal array is from surface to top
! --- ... molecular amounts are input or converted to volume mixing ratio
! and later then converted to molecular amount (molec/cm2) by the
! dry air column coldry (in molec/cm2) which is calculated from the
! layer pressure thickness (in mb), based on the hydrostatic equation
! --- ... and includes a correction to account for h2o in the layer.
if (ivflip == 0) then ! input from toa to sfc
tem1 = 100.0 * con_g
tem2 = 1.0e-20 * 1.0e3 * con_avgd
tz(0) = tlvl(iplon,nlp1)
do k = 1, nlay
k1 = nlp1 - k
pavel(k)= plyr(iplon,k1)
delp(k) = plvl(iplon,k1+1) - plvl(iplon,k1)
tavel(k)= tlyr(iplon,k1)
tz(k) = tlvl(iplon,k1)
!> -# Set absorber amount for h2o, co2, and o3.
!test use
! h2ovmr(k)= max(f_zero,qlyr(iplon,k1)*amdw) ! input mass mixing ratio
! h2ovmr(k)= max(f_zero,qlyr(iplon,k1)) ! input vol mixing ratio
! o3vmr (k)= max(f_zero,olyr(iplon,k1)) ! input vol mixing ratio
!ncep model use
h2ovmr(k)= max(f_zero,qlyr(iplon,k1) &
& *amdw/(f_one-qlyr(iplon,k1))) ! input specific humidity
o3vmr (k)= max(f_zero,olyr(iplon,k1)*amdo3) ! input mass mixing ratio
! --- ... tem0 is the molecular weight of moist air
tem0 = (f_one - h2ovmr(k))*con_amd + h2ovmr(k)*con_amw
coldry(k) = tem2*delp(k) / (tem1*tem0*(f_one+h2ovmr(k)))
temcol(k) = 1.0e-12 * coldry(k)
colamt(k,1) = max(f_zero, coldry(k)*h2ovmr(k)) ! h2o
colamt(k,2) = max(temcol(k), coldry(k)*gasvmr(iplon,k1,1)) ! co2
colamt(k,3) = max(temcol(k), coldry(k)*o3vmr(k)) ! o3
enddo

It assumes the moles of CO2 per area can be computed by scaling the prescribed volume mixing ratio of CO2 by the moles of dry air per area. A global mean volume mixing ratio then can be computed by dividing the total moles of CO2 globally the by the total moles of dry air globally.

How Has This Been Tested?

This has been tested in a three-month C24 simulation outputting the instantaneous global mean CO2 concentration every 6 hours. The plot of the time series can be found below.

2024-06-05-global-mean-co2-diagnostic

The simulation uses gfs_physics_nml.ico2 = 2. For globally uniform CO2 (e.g. with gfs_physics_nml.ico2 = 1 and gfs_physics_nml.ictm = 19970), the diagnostic behaves as expected, producing a value exactly the same as that prescribed.

Checklist:

Please check all whether they apply or not

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Copy link
Contributor

@lharris4 lharris4 left a comment

Choose a reason for hiding this comment

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

I think this is fine. Writing a 0-D variable to the history fields is a bit different (usually we output global integrals to stdout or to a text file) but this additional functionality is potentially useful too.

@spencerkclark
Copy link
Member Author

Thanks @lharris4—indeed I was not aware of this functionality until reading the AM4 code. It is a little funky since the diagnostics manager has no choice but to write copies of the scalar fields out to all (sub)-tile files, but nevertheless it is nice to have the data all in one place (with clear / standardized metadata) instead of having to parse it out from another source.

@lharris4
Copy link
Contributor

lharris4 commented Jun 5, 2024 via email

@spencerkclark
Copy link
Member Author

There might be ways to output global-mean values to a single NetCDF file,
since this is done for the restart files.

Indeed there is! Thanks for prompting me to think about it a bit more. The issue was that I set up my diagnostics table to include the scalar field in the same files as horizontally-resolved fields. If only scalar fields are specified to be output to a particular file then that file will not be split across (sub)-tiles.

@lharris4
Copy link
Contributor

lharris4 commented Jun 5, 2024 via email

@spencerkclark
Copy link
Member Author

@laurenchilutti and / or @bensonr does this look good to merge?

@laurenchilutti laurenchilutti merged commit 5b80fb5 into NOAA-GFDL:main Jun 7, 2024
74 checks passed
@spencerkclark spencerkclark deleted the global-mean-co2-diagnostic branch June 7, 2024 19:30
@spencerkclark
Copy link
Member Author

Thanks @laurenchilutti!

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