geoschem / geos-chem

GEOS-Chem "Science Codebase" repository. Contains GEOS-Chem science routines, run directory generation scripts, and interface code. This repository is used as a submodule within the GCClassic and GCHP wrappers, as well as in other modeling contexts (external ESMs).
http://geos-chem.org
Other
167 stars 162 forks source link

Can KPP take in loss frequency from netcdf file? #2200

Closed laura-hyesung-yang closed 4 months ago

laura-hyesung-yang commented 7 months ago

Name and Institution (Required)

Name: Laura Yang Institution: Harvard University

Description of your issue or question

I have a simple question regarding KPP. I wish to implement a chemistry in which OH -> Y where Y is a dummy species. I want the rate constant k (unit: 1/s) that varies spatially around the globe. If I have a file that specifies the rate constant k in the netcdf file similar to that of the HEMCO input file, can I make the KPP to read in that netcdf file and make the rate constant k to spatially vary?

yantosca commented 7 months ago

Hi @laura-hyesung-yang, thanks for writing. We do a similar thing in the carbon mechanism. Basically what you can do is to set the externally-defined species in the #DEFFIX section. See the FixedOH and FixedCl species in the carbon.eqn file.

{ carbon.eqn
===============================================================================
DESCRIPTION
===============================================================================

GEOS-Chem KPP file containing species and equations for the carbon
chemistry mechanism

===============================================================================
FILE HISTORY
===============================================================================

v14.1.0 (release TBD)
---------------------
(1) Initial version (MSL)

}

#include atoms.kpp     { Periodic table information               }

#DEFVAR
CH4         = IGNORE;  { Active methane species                   }
CO          = IGNORE;  { Active carbon monoxide species           }
CO2         = IGNORE;  { Active carbon dioxide species            }
COfromCH4   = IGNORE;  { Tracks P(CO)  from CH4   for diagnostics }
COfromNMVOC = IGNORE;  { Tracks P(CO)  from NMVOC for diagnostics }
CO2fromOH   = IGNORE;  { Tracks P(CO2) from OH    for diagnostics }
Dummy       = IGNORE;  { Dummy placeholder product                }

#DEFFIX
FixedOH     = IGNORE;  { Externally-supplied OH concentration     }
FixedCl     = IGNORE;  { Externally-supplied Cl concentration     }
DummyCH4    = IGNORE;  { Dummy placeholder for CH4   reactant     }
DummyNMVOC  = IGNORE;  { Dummy placeholder for NMVOC reactant     }

#EQUATIONS
//
// Reactions extracted from ch4_co_co2_mod.F
// Based on Bukosa et al. (2021) with additions for OCS
//
// %%%%%%%%%%%%%%%%%%%%%%%%
// %%%%%  TROP CHEM   %%%%%
// %%%%%%%%%%%%%%%%%%%%%%%%
//
// Rate k_Trop(1) [1/s] is set to HEMCO-supplied P(CO) from CH4
CH4 + FixedOH = CO    + COfromCH4   : k_Trop(1);
//
// Rate [1/s] is from Kirschke et al, 2013 (Nature Geosci.)
CH4 + FixedCl = Dummy               : 9.60d-12*EXP(-1360.0d0/TEMP)*TROP;
//
// Rate k_trop(2) [1/s] is the output of rate law function GC_OHCO
CO  + FixedOH = CO2   + CO2fromOH   : k_Trop(2);
//
// DummyNMVOC is a placeholder species set to 1 molec/cm3.
// This is a KPP "trick" in order to set the final CO concentration
// to k_Trop(3) [molec/cm3/s] * dt [s], where dt is the chemistry
// timestep.  k_Trop(3) contains externally-supplied P(CO) from NMVOC.
DummyNMVOC    = CO    + COfromNMVOC : k_Trop(3);
//
// %%%%%%%%%%%%%%%%%%%%%%%%
// %%%%%  STRAT CHEM  %%%%%
// %%%%%%%%%%%%%%%%%%%%%%%%
//
// Rate k_Strat(1) [1/s] is set to HEMCO-supplied loss of CH4 by OH
CH4           = Dummy               : k_Strat(1);
//
// DummyCH4 is a placeholder species set to 1 molec/cm3.
// This is a KPP "trick" in order to set the final CO concentration
// to k_Strat(2) [molec/cm3/s] * dt [s], where dt is the chemistry
// timestep.  k_Strat(2) contains externally-supplied strat P(CO).
DummyCH4      = CO                  : k_Strat(2);
//
// Rate k_Strat(3) [1/s] is set to HEMCO-supplied stratospheric loss of CO
CO            = CO2   + CO2fromOH   : k_Strat(3);

Then also see the routine ReadChemInputFields in GeosCore/carbon_gases_mod.F90 to see how we read in the fields from HEMCO:

https://github.com/geoschem/geos-chem/blob/b288af1563a9a49a154a93bdd0f88be1f58f3f2f/GeosCore/carbon_gases_mod.F90#L876-L1081

and then see the unit conversion routines in

https://github.com/geoschem/geos-chem/blob/main/KPP/carbon/carbon_Funcs.F90

to see how these are copied into the KPP C array of concentrations.

laura-hyesung-yang commented 7 months ago

@yantosca Thank you, Bob! I will take a look at this implementation and close the issue for now. Will reopen as needed!

laura-hyesung-yang commented 7 months ago

@yantosca Hi Bob! Would it be possible to have all the OH chemistry in KPP/fullchem to happen as usual and supply additional loss of OH with a specified loss rate constant (k) from NetCDF file in KPP/fullchem? The idea of this is that GEOS-Chem is missing OH sinks. So, I will create a netcdf file with the missing OH sink. Then I will add OH -> Y mechanism with a loss rate constant k which is specified in the NetCDF file. Would it be too complicated? The example with KPP/Carbon files seem to just have OH and Cl concentrations to be fixed and have no additional chemical equations that govern their concentrations.

yantosca commented 7 months ago

Hi @laura-hyesung-yang. I think this would be possible but you would need to add a new rxn to the fullchem.eqn file and then set that to the rate constant (see FixedOH example above).

yantosca commented 4 months ago

Closing out this issue