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

pCO2, Piston velocity and solubility output #202

Merged
merged 5 commits into from
Nov 22, 2022

Conversation

jmaerz
Copy link
Collaborator

@jmaerz jmaerz commented Nov 18, 2022

Hi Tomas, hi Jörg,

I added output for pCO2 under moist air assumption (which can actually make quite some difference - up to ca. O(10ppm)), pure piston velocity, and solubility under dry and moist air assumption. There are two things to note, though:

  1. the former kwco2 now really only holds the Piston velocity (not times solubility anymore) - Piston times solubility (moist air, as before) is available via kwco2kh now. Does that change need some changes in any cmorization packages (which I am currently not fully aware of)?
  2. I am uncertain, why kwco2sol(i,j) = kwco2*Kh*1e-6 (WHY 1e-6???, carchm l. 533) From my understanding, kwco2 has units of m/s and Kh mol/kg/atm - so to which units were/is it converted to? Should it be per µatm?

Another thing might be, if we want to keep track of the air-pressure correction rpp0 used for calculating CO2 fluxes (which affects the gas saturation).

Closes #31

@jmaerz jmaerz added enhancement New feature or request iHAMOCC Issue mainly concerns the iHAMOCC code base labels Nov 18, 2022
@jmaerz jmaerz added this to the BLOM/iHAMOCC-1.3.0 milestone Nov 18, 2022
@jmaerz jmaerz self-assigned this Nov 18, 2022
@jmaerz jmaerz changed the title Co2flux output pCO2, Piston velocity and solubility output Nov 18, 2022
Copy link
Contributor

@TomasTorsvik TomasTorsvik left a comment

Choose a reason for hiding this comment

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

Thanks, Jöran! This looks fine to me. I have a few pedantic comments about code alignment, if you could take a moment to look at it.

hamocc/carchm.F90 Outdated Show resolved Hide resolved
hamocc/ncout_hamocc.F90 Outdated Show resolved Hide resolved
hamocc/ncout_hamocc.F90 Outdated Show resolved Hide resolved
hamocc/ncout_hamocc.F90 Outdated Show resolved Hide resolved
hamocc/ncout_hamocc.F90 Outdated Show resolved Hide resolved
! KWCO2 - kwco2
! KWCO2KH - kwco2 x solubility (moist air)
! CO2KHD - khd CO2 solubility under dry air assumption
! CO2KH - kh CO2 solubility under moist air assumption
! CO2FXD - Downward CO2 flux (co2fxd) [kg C m-2 s-1]
Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding the naming of of these variables, I find it confusing that sometimes a "D" for dry is appended, and sometimes a "M" for moist, and sometimes nothing. I would suggest to use only "M" to indicate the moist air assumption:

! PCO2M - Surface PCO2 under moist air assumption [uatm]
! KWCO2 - kwco2
! KWCO2KHM - kwco2 x solubility (moist air)
! CO2KH - khd CO2 solubility under dry air assumption
! CO2KHM - kh CO2 solubility under moist air assumption

I see that the idea was to use names that are close to the values in the code, but in the namelist, it should make sense for users that have no insights in the code. To resolve this one could also rename kh -> khm and khd -> kh in carchm, but not sure if this would make sense

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can do this. One question though was/is the issue with previous names and potential confusion about it during subsequent cmorization steps. Any opinion/insights/knowledge about this? I tried to keep the former names, if possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

What is important is that PCO2 is not changed (since this was/is of course used in cmorization). Everything else is not CMIP6 output. So the only potential confusion is that KWCO2 will change its meaning, but this was actually very confusing before, so this is an improvement (not backwards-compatible though).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should still be fine, but we should remember to mention the change in KWCO2 in the CHANGELOG (for both BLOM/iHAMOCC-1.3.0 and NorESM-2.0.6)

@JorgSchwinger
Copy link
Contributor

And yes, the 1e-6 (or 1e6) converts atm to microatm, I think.

@jmaerz
Copy link
Collaborator Author

jmaerz commented Nov 22, 2022

Hi @JorgSchwinger and @TomasTorsvik , I tried to adopt your suggestions with the last commit.

kwco2sol(i,j) = kwco2*Kh*1e-6

kwco2sol(i,j) = kwco2*Kh*1e-6 !m/s mol/kg/muatm
kwco2d(i,j) = kwco2 ! m/s (incl. ice fraction!)
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming is also a bit confusing here, because the piston velocity is not changed by dry/moist assumptions. Since kwco2 is already taken a different name as "piston" or "vp" or so might be an alternative. Sorry quite picky, can go without changing this.

Copy link
Collaborator Author

@jmaerz jmaerz Nov 22, 2022

Choose a reason for hiding this comment

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

Ok, I read the pco2d formerly as 2D (not dry) as opposed to pco2 (as local variable) - so extended it to kwco2d, since a local variable kwco2 is already provided .... - didn't want to rewrite the code.

! PCO2M - Surface PCO2 under moist air assumption [uatm]
! KWCO2 - kwco2
! KWCO2KHM - kwco2 x solubility (moist air)
! CO2KH - khd CO2 solubility under dry air assumption
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to stick to the convention used for the other namamelist entries, e.g.

CO2KH - CO2 solubility under dry air assumption (khd) [mol/kg/atm]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I hope the last commit satisfies the conventions. I left the other comment untouched (kwco2d) for the mentioned reasons. I hope that's ok.

@jmaerz jmaerz merged commit 98ade59 into NorESMhub:master Nov 22, 2022
TomasTorsvik pushed a commit to TomasTorsvik/BLOM-TTfork that referenced this pull request Dec 5, 2022
* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)
TomasTorsvik pushed a commit to TomasTorsvik/BLOM-TTfork that referenced this pull request Dec 5, 2022
* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)
jmaerz added a commit that referenced this pull request Jan 25, 2023
* Dynamic mapping of pore water tracers to ocean tracers (#192)

* Initial restructuring of sediment-related tracer declaration and initialization

* Introducing mapping function

* Remove unncessary comments

* Fixed diagnostics bug and updated index naming

* Added initial support for NUOPC driver.

* Lon-lat variable sediment porosity (#189)

Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting.

* Added wave forcing fields.

* Renamed folder for MCT driver.

* Moved MCT specific file from drivers/cpl_share/ to drivers/mct/.

* Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90.

* Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran.

* Remove redundant definition of kOBL.

* Redefine kOBL, cast as integer

* Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (#198)

* Removing bodensed -  Initialization of sediment parameters and fields now in mo_sedmnt

* Hamocc hybrid coord2 (#179)

Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.

* Fix porosity read (#201)

* Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release

Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926

* Provide number of layers (3rd dim) via ks and not hard-coded

* minor clean-up

* Correct unit of diagnostic variable dp_trc.

* Made conservation and checksum diagnostics selectable by namelist options (default off).

* pCO2, Piston velocity and solubility output (#202)

* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)

* Bugfix pnetcdf (#208)

* Add variables used by PNETCDF to explicit use staements.

* Move implicit none statments

* update explicit use statement for pnetcdf

* fixed units and renamed calcium burial to CaCO3 burial (#212)

Fixed sediment clay units.

* Add option for surface pH output (#221)

* Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90

* Import get_bgc_namelist only in subroutine where it is needed. (#225)

Co-authored-by: Mats Bentsen <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Jörg Schwinger <[email protected]>
jmaerz added a commit that referenced this pull request Feb 9, 2023
* Dynamic mapping of pore water tracers to ocean tracers (#192)

* Initial restructuring of sediment-related tracer declaration and initialization

* Introducing mapping function

* Remove unncessary comments

* Fixed diagnostics bug and updated index naming

* Added initial support for NUOPC driver.

* Lon-lat variable sediment porosity (#189)

Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting.

* Added wave forcing fields.

* Renamed folder for MCT driver.

* Moved MCT specific file from drivers/cpl_share/ to drivers/mct/.

* Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90.

* Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran.

* Remove redundant definition of kOBL.

* Redefine kOBL, cast as integer

* Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (#198)

* Removing bodensed -  Initialization of sediment parameters and fields now in mo_sedmnt

* This is the first commit of MKS units. All variables in the subroutines have been converted to MKS [meter, kg, seconds] instead of CGS [cm, gram, seconds] with necessary coefficients. The default option which is CGS reproduce old results. The new option MKS cannot reproduce because of machine precision.

* Hamocc hybrid coord2 (#179)

Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.

* BLOM CIME cpp updates to run in NorESM

* bug fixes for the CGS MKS conversion

* cesm thermal forcing bug fixes for reproducibility

* BLOM MKS update to export winds into the CESM using proper units.

* input values in ocn_in case is updated for mks setup

* default cgsmks value changed

* Initialize some variables in the k-epsilon model.

* Fix porosity read (#201)

* Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release

Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926

* Provide number of layers (3rd dim) via ks and not hard-coded

* minor clean-up

* Correct unit of diagnostic variable dp_trc.

* Made conservation and checksum diagnostics selectable by namelist options (default off).

* pCO2, Piston velocity and solubility output (#202)

* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)

* Bugfix pnetcdf (#208)

* Add variables used by PNETCDF to explicit use staements.

* Move implicit none statments

* update explicit use statement for pnetcdf

* fixed units and renamed calcium burial to CaCO3 burial (#212)

Fixed sediment clay units.

* - Made the "fuk95" configuration work with MKS units.
- Removed "CGS" CPP flag.
- Changed some unit conversion factors from variables to parameters.
- Introduced rho0 (= 1/alpha0) parameter.
- Updated copyright statements.

* Correct unit conversion of mixed layer depth to pressure.

* Updated NorESM coupling scripts for the use of MKS units.

* Fixed check of unit system when building as NorESM component.

* Add option for surface pH output (#221)

* Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90

* Import get_bgc_namelist only in subroutine where it is needed. (#225)

* fix missing ' (#228)

Fixing a missing ' that only showed up when using `cisonew`

---------

Co-authored-by: Mats Bentsen <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Mehmet Ilicak <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Jörg Schwinger <[email protected]>
jmaerz added a commit to jmaerz/BLOM that referenced this pull request Aug 9, 2023
* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)
jmaerz added a commit to jmaerz/BLOM that referenced this pull request Aug 9, 2023
* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)
jmaerz added a commit to jmaerz/BLOM that referenced this pull request Aug 9, 2023
* Dynamic mapping of pore water tracers to ocean tracers (NorESMhub#192)

* Initial restructuring of sediment-related tracer declaration and initialization

* Introducing mapping function

* Remove unncessary comments

* Fixed diagnostics bug and updated index naming

* Added initial support for NUOPC driver.

* Lon-lat variable sediment porosity (NorESMhub#189)

Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting.

* Added wave forcing fields.

* Renamed folder for MCT driver.

* Moved MCT specific file from drivers/cpl_share/ to drivers/mct/.

* Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90.

* Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran.

* Remove redundant definition of kOBL.

* Redefine kOBL, cast as integer

* Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (NorESMhub#198)

* Removing bodensed -  Initialization of sediment parameters and fields now in mo_sedmnt

* Hamocc hybrid coord2 (NorESMhub#179)

Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.

* Fix porosity read (NorESMhub#201)

* Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release

Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926

* Provide number of layers (3rd dim) via ks and not hard-coded

* minor clean-up

* Correct unit of diagnostic variable dp_trc.

* Made conservation and checksum diagnostics selectable by namelist options (default off).

* pCO2, Piston velocity and solubility output (NorESMhub#202)

* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)

* Bugfix pnetcdf (NorESMhub#208)

* Add variables used by PNETCDF to explicit use staements.

* Move implicit none statments

* update explicit use statement for pnetcdf

* fixed units and renamed calcium burial to CaCO3 burial (NorESMhub#212)

Fixed sediment clay units.

* Add option for surface pH output (NorESMhub#221)

* Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90

* Import get_bgc_namelist only in subroutine where it is needed. (NorESMhub#225)

Co-authored-by: Mats Bentsen <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Jörg Schwinger <[email protected]>
jmaerz added a commit to jmaerz/BLOM that referenced this pull request Aug 9, 2023
…b#232)

* Dynamic mapping of pore water tracers to ocean tracers (NorESMhub#192)

* Initial restructuring of sediment-related tracer declaration and initialization

* Introducing mapping function

* Remove unncessary comments

* Fixed diagnostics bug and updated index naming

* Added initial support for NUOPC driver.

* Lon-lat variable sediment porosity (NorESMhub#189)

Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting.

* Added wave forcing fields.

* Renamed folder for MCT driver.

* Moved MCT specific file from drivers/cpl_share/ to drivers/mct/.

* Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90.

* Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran.

* Remove redundant definition of kOBL.

* Redefine kOBL, cast as integer

* Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (NorESMhub#198)

* Removing bodensed -  Initialization of sediment parameters and fields now in mo_sedmnt

* This is the first commit of MKS units. All variables in the subroutines have been converted to MKS [meter, kg, seconds] instead of CGS [cm, gram, seconds] with necessary coefficients. The default option which is CGS reproduce old results. The new option MKS cannot reproduce because of machine precision.

* Hamocc hybrid coord2 (NorESMhub#179)

Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.

* BLOM CIME cpp updates to run in NorESM

* bug fixes for the CGS MKS conversion

* cesm thermal forcing bug fixes for reproducibility

* BLOM MKS update to export winds into the CESM using proper units.

* input values in ocn_in case is updated for mks setup

* default cgsmks value changed

* Initialize some variables in the k-epsilon model.

* Fix porosity read (NorESMhub#201)

* Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release

Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926

* Provide number of layers (3rd dim) via ks and not hard-coded

* minor clean-up

* Correct unit of diagnostic variable dp_trc.

* Made conservation and checksum diagnostics selectable by namelist options (default off).

* pCO2, Piston velocity and solubility output (NorESMhub#202)

* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)

* Bugfix pnetcdf (NorESMhub#208)

* Add variables used by PNETCDF to explicit use staements.

* Move implicit none statments

* update explicit use statement for pnetcdf

* fixed units and renamed calcium burial to CaCO3 burial (NorESMhub#212)

Fixed sediment clay units.

* - Made the "fuk95" configuration work with MKS units.
- Removed "CGS" CPP flag.
- Changed some unit conversion factors from variables to parameters.
- Introduced rho0 (= 1/alpha0) parameter.
- Updated copyright statements.

* Correct unit conversion of mixed layer depth to pressure.

* Updated NorESM coupling scripts for the use of MKS units.

* Fixed check of unit system when building as NorESM component.

* Add option for surface pH output (NorESMhub#221)

* Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90

* Import get_bgc_namelist only in subroutine where it is needed. (NorESMhub#225)

* fix missing ' (NorESMhub#228)

Fixing a missing ' that only showed up when using `cisonew`

---------

Co-authored-by: Mats Bentsen <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Mehmet Ilicak <[email protected]>
Co-authored-by: Tomas Torsvik <[email protected]>
Co-authored-by: Jörg Schwinger <[email protected]>
@jmaerz jmaerz deleted the co2flux-output branch November 23, 2023 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request iHAMOCC Issue mainly concerns the iHAMOCC code base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add output for actually used atmopheric pCO2 and pCO2 water vapour correction
3 participants