From 6b4a588b9cf56b8e82758934160a27d7d1978239 Mon Sep 17 00:00:00 2001 From: Joe Wallwork Date: Wed, 26 Mar 2025 16:16:59 +0000 Subject: [PATCH 1/3] Loop over RxnRate info definitions --- model/CHEM_DRV.F90 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/model/CHEM_DRV.F90 b/model/CHEM_DRV.F90 index 2e84b336..20c790dc 100644 --- a/model/CHEM_DRV.F90 +++ b/model/CHEM_DRV.F90 @@ -4181,10 +4181,12 @@ SUBROUTINE tijlh_defs(arr,nmax,decl_count) ! info_type_ is a homemade structure constructor for older compilers use subdd_mod, only : info_type_ use chem_com, only : ntm, trname, nsp, spname +USE gckpp_Parameters, ONLY : NREACT implicit none integer :: nmax,decl_count integer :: n type(info_type) :: arr(nmax) +character(len=3) :: eqn decl_count = 0 @@ -4449,6 +4451,23 @@ SUBROUTINE tijlh_defs(arr,nmax,decl_count) units = 'm s-1' & ) +! Reaction rates +do n=1,NREACT + ! TODO: Avoid this hacky approach to padding with zeros + if (n < 10) then + write(eqn,"('00',i1)") n + else if (n < 100) then + write(eqn,"('0',i2)") n + else + write(eqn,"(i3)") n + end if + arr(next()) = info_type_( & + sname = 'RxnRate_EQ'//eqn, & + lname = 'RxnRate_EQ'//eqn, & + units = 'molec cm-3 s-1' & + ) +end do ! tracers loop + return contains integer function next() From 926ed3f3517bc54677bded12a7babb071df5117b Mon Sep 17 00:00:00 2001 From: Joe Wallwork Date: Wed, 26 Mar 2025 16:30:25 +0000 Subject: [PATCH 2/3] Pass data from GEOS-Chem to GISS model - TODO [skip ci] --- model/CHEM_DRV.F90 | 25 +++++++++++++++++++++++++ model/SUBDD.f | 2 ++ 2 files changed, 27 insertions(+) diff --git a/model/CHEM_DRV.F90 b/model/CHEM_DRV.F90 index 20c790dc..f0bbf673 100644 --- a/model/CHEM_DRV.F90 +++ b/model/CHEM_DRV.F90 @@ -2221,6 +2221,7 @@ SUBROUTINE accumGCsubdd ! use geom, only : byaxyp ! use atm_com, only : byma USE UnitConv_Mod + USE gckpp_Parameters, ONLY : NREACT implicit none @@ -2769,6 +2770,30 @@ SUBROUTINE accumGCsubdd enddo ! k enddo ! igroup + do igrp=1,ngroups + subdd => subdd_groups(grpids(igrp)) + ! TODO: Set up number of reactions properly + do k=1,subdd%nrxns + nslot_loop: do n=1,NREACT + ! TODO: Check names match properly + if( trim( State_Chm%SpcData(N)%Info%Name ) .eq. trim(subdd%name(k)) ) then + DO L=1,LmaxSUBDD + DO J=J_0,J_1 + DO I=I_0,I_1 + II = I - I_0 + 1 + JJ = J - J_0 + 1 + ! TODO: Copy over reaction rate data + ! sddarr3d(I,J,L) = State_Chm%Species(N)%Conc(II,JJ,L) + ENDDO + ENDDO + ENDDO + call inc_subdd(subdd,k,sddarr3d) + exit nslot_loop + end if + end do nslot_loop + enddo ! k + enddo ! igroup + ! Convert back to kg species CALL Convert_Spc_Units( & Input_Opt = Input_Opt, & diff --git a/model/SUBDD.f b/model/SUBDD.f index 1293c7c2..5615d79e 100644 --- a/model/SUBDD.f +++ b/model/SUBDD.f @@ -227,6 +227,8 @@ module subdd_mod integer :: subdd_period !@var ndiags number of outputs in this group integer :: ndiags=0 +!@var nrxns number of reactions in this group + integer :: nrxns=0 !@var dtime length of each output period (hr) !@var timelast time of last accumulation/store in this group and output file !@+ (hrs since start of run) From 6d848e2e47b8410402315ca1ceda07db46b3e578 Mon Sep 17 00:00:00 2001 From: Joe Wallwork Date: Wed, 26 Mar 2025 16:35:27 +0000 Subject: [PATCH 3/3] Triply nested loop for extracting GISS data into GEOS-Chem - TODO [skip ci] --- model/CHEM_DRV.F90 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/model/CHEM_DRV.F90 b/model/CHEM_DRV.F90 index f0bbf673..73539c04 100644 --- a/model/CHEM_DRV.F90 +++ b/model/CHEM_DRV.F90 @@ -609,6 +609,27 @@ SUBROUTINE DO_CHEM ENDDO ENDDO + + DO K=1,LM + DO JJJ=J_0,J_1 + DO III=I_0,I_1 + + ! GEOS-Chem local index + II = III - I_0 + 1 + JJ = JJJ - J_0 + 1 + + ! GISS meteorology index (GISS only has one polar box) + I = III + J = JJJ + if(hassouthpole(grid) .and. JJJ .eq. J_0 ) I = 1 + if(hasnorthpole(grid) .and. JJJ .eq. J_1 ) I = 1 + + ! TODO: RxnRate + + ENDDO + ENDDO + ENDDO + ! Set the pressure at level edges [hPa] from the GCM CALL Accept_External_Pedge( State_Met = State_Met, & State_Grid = State_Grid, &