Skip to content

Commit

Permalink
Merge pull request #28 from NCAR/develop-20-new-data-sets-tsmlt
Browse files Browse the repository at this point in the history
add new data sets for WACCM
  • Loading branch information
mattldawson authored Jan 11, 2024
2 parents 856770c + cb6efa6 commit 90a1688
Show file tree
Hide file tree
Showing 16 changed files with 989 additions and 9 deletions.
Binary file added data/cross_sections/BRO_JPL06.nc
Binary file not shown.
Binary file added data/cross_sections/CL2O2_JPL10.nc
Binary file not shown.
Binary file added data/cross_sections/CLO_JPL06.nc
Binary file not shown.
Binary file added data/cross_sections/HNO3_JPL06.nc
Binary file not shown.
24 changes: 17 additions & 7 deletions examples/ts1_tsmlt.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
"__reaction": "HNO3 + hv -> OH + NO2",
"cross section": {
"netcdf files": [
{ "file path": "data/cross_sections/HNO3_1.nc" }
{ "file path": "data/cross_sections/HNO3_JPL06.nc" }
],
"type": "HNO3+hv->OH+NO2"
},
Expand Down Expand Up @@ -555,11 +555,7 @@
"cross section": {
"netcdf files": [
{
"file path": "data/cross_sections/BrO_1.nc",
"interpolator": {
"type": "fractional target",
"fold in": true
}
"file path": "data/cross_sections/BRO_JPL06.nc"
}
],
"type": "base"
Expand Down Expand Up @@ -818,7 +814,7 @@
"__comments": "TODO - this doesn't exactly match the products in TS1",
"cross section": {
"netcdf files": [
{ "file path": "data/cross_sections/ClOOCl_1.nc" }
{ "file path": "data/cross_sections/CL2O2_JPL10.nc" }
],
"type": "base"
},
Expand All @@ -840,6 +836,20 @@
"type": "ClO+hv->Cl+O(1D)"
}
},
{
"name": "jclo_o3p",
"__reaction": "ClO + hv -> Cl + O",
"cross section": {
"netcdf files": [
{ "file path": "data/cross_sections/CLO_JPL06.nc" }
],
"type": "base"
},
"quantum yield": {
"type": "base",
"constant value": 1.0
}
},
{
"name": "jclono2_a",
"__reaction": "ClONO2 + hv -> Cl + NO3",
Expand Down
121 changes: 121 additions & 0 deletions test/data/xsqy.doug.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,126 @@
},
"label": "CH2Br2 + hv -> 2Br",
"tolerance": 1.0e-3
},
{
"cross section": {
"type": "base",
"netcdf files": [
{ "file path": "data/cross_sections/BRO_JPL06.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "BRO + hv -> Br + O",
"__note": "first test: excluding edges of interpolation because of double vs float algoritms",
"mask" : [ { "index": 62 }, { "index": 86 }]
},
{
"cross section": {
"type": "base",
"netcdf files": [
{ "file path": "data/cross_sections/BRO_JPL06.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "BRO + hv -> Br + O",
"__note": "second test: including edges of interpolation with relaxed tolerance",
"tolerance": 5.0e-3
},
{
"cross section": {
"type": "base",
"netcdf files": [
{ "file path": "data/cross_sections/CL2O2_JPL10.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "Cl2O2 + hv -> Cl + ClOO",
"__note": "first test: excluding edges of interpolation because of double vs float algoritms",
"mask" : [ { "index": 34 }, { "index": 97 } ]
},
{
"cross section": {
"type": "base",
"netcdf files": [
{ "file path": "data/cross_sections/CL2O2_JPL10.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "Cl2O2 + hv -> Cl + ClOO",
"__note": "second test: including edges of interpolation with relaxed tolerance",
"tolerance": 1.0e-3
},
{
"cross section": {
"type": "base",
"netcdf files": [
{ "file path": "data/cross_sections/CLO_JPL06.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "ClO + hv -> Cl + O",
"__note": "first test: excluding edges of interpolation because of double vs float algoritms",
"mask": [ { "index": 51 }, { "index": 71 }]
},
{
"cross section": {
"type": "base",
"netcdf files": [
{ "file path": "data/cross_sections/CLO_JPL06.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "ClO + hv -> Cl + O",
"__note": "second test: including edges of interpolation with relaxed tolerance",
"tolerance": 1.0e-3
},
{
"cross section": {
"type": "HNO3+hv->OH+NO2",
"netcdf files": [
{ "file path": "data/cross_sections/HNO3_JPL06.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "HNO3 + hv -> OH + NO2",
"__note": "first test: excluding edges of interpolation because of double vs float algoritms",
"mask": [ { "index": 30 }, { "index": 79 } ]
},
{
"cross section": {
"type": "HNO3+hv->OH+NO2",
"netcdf files": [
{ "file path": "data/cross_sections/HNO3_JPL06.nc" }
]
},
"quantum yield": {
"type": "base",
"constant value": 1.0
},
"label": "HNO3 + hv -> OH + NO2",
"__note": "second test: including lower edge of interpolation with relaxed tolerance (upper edge is a very small value with large relative difference)",
"tolerance": 1.0e-3,
"mask": [ { "index": 79 } ]
}
]
4 changes: 4 additions & 0 deletions test/unit/tuv_doug/JCALC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

target_sources(tuv_doug
PRIVATE
XSQY_BRO.f
XSQY_CH2BR2.f
XSQY_CL2O2.f
XSQY_CLO.f
XSQY_H2O.f
XSQY_HNO3.f
XSQY_N2O5.f
)

Expand Down
116 changes: 116 additions & 0 deletions test/unit/tuv_doug/JCALC/XSQY_BRO.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
subroutine XSQY_BRO(nw,wl,wc,nz,tlev,airlev,j,sq,jlabel,pn)
!-----------------------------------------------------------------------------!
! purpose: !
! provide product (cross section) x (quantum yield): !
! BrO + hv -> Br + O !
! cross section: JPL06 !
! quantum yield: is unity. !
!-----------------------------------------------------------------------------!
! parameters: !
! nw - integer, number of specified intervals + 1 in working (i) !
! wavelength grid !
! wl - real, vector of lower limits of wavelength intervals in (i) !
! working wavelength grid !
! wc - real, vector of center points of wavelength intervals in (i) !
! working wavelength grid !
! nz - integer, number of altitude levels in working altitude grid (i) !
! tlev - real, temperature (k) at each specified altitude level (i) !
! airlev - real, air density (molec/cc) at each altitude level (i) !
! j - integer, counter for number of weighting functions defined (io) !
! sq - real, cross section x quantum yield (cm^2) for each (o) !
! photolysis reaction defined, at each defined wavelength and !
! at each defined altitude level !
! jlabel - character*60, string identifier for each photolysis reaction (o) !
! defined !
!-----------------------------------------------------------------------------!
! edit history: !
! 07/27/07 Doug Kinnison !
!-----------------------------------------------------------------------------!
implicit none
include 'params'

!-----------------------------------------------------------------------------!
! ... input !
!-----------------------------------------------------------------------------!
real, intent(in) :: wl(kw)
real, intent(in) :: wc(kw)
real, intent(in) :: tlev(kz)
real, intent(in) :: airlev(kz)

integer, intent(in) :: nz
integer, intent(in) :: nw

character*80, intent(in) :: pn
character*60, intent(out) :: jlabel(kj)
real, intent(out) :: sq(kj,kz,kw)

!-----------------------------------------------------------------------------!
! ... input/output !
!-----------------------------------------------------------------------------!
integer, intent(inout) :: j

!-----------------------------------------------------------------------------!
! ... local !
!-----------------------------------------------------------------------------!
integer kdata
parameter(kdata=300)
integer i, iw, n, idum, ierr, iz
real x1(kdata)
real y1(kdata)
real yg(kw)
real qy

!----------------------------------------------
! ... jlabel(j) = 'BRO + hv -> Br + O'
!----------------------------------------------
j = j+1
jlabel(j) = 'BRO + hv -> Br + O'

!----------------------------------------------------
! ... cross sections from JPL06 recommendation
!----------------------------------------------------
! ... 0.5nm resolution JPL06.
open(kin,file=TRIM(pn)//'XS_BRO_JPL06.txt',status='old')

read(kin,*) idum, n
do i = 1, idum-2
read(kin,*)
enddo

do i = 1, n
read(kin,*) x1(i), y1(i)
enddo
close(kin)

call addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.)
call addpnt(x1,y1,kdata,n, 0.,0.)
call addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.)
call addpnt(x1,y1,kdata,n, 1e38,0.)
call inter2(nw,wl,yg, n,x1, y1,ierr)

if (ierr .ne. 0) then
write(*,*) ierr, jlabel(j)
stop
endif

!-------------------------------------------------------
! ... quantum yield (assumed) to be unity (JPL06)
!-------------------------------------------------------
qy = 1.0

do iw = 1, nw-1
do iz = 1, nz
sq(j,iz,iw) = qy * yg(iw)

enddo
enddo

!-------------------------------------------------------
! ... Check Routine
! do iw = 61, 87
! print*, iw, wc(iw), (qy * yg(iw))
! enddo
! stop
!-------------------------------------------------------

end subroutine XSQY_BRO
Loading

0 comments on commit 90a1688

Please sign in to comment.