diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index de11f63..d97caad 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -9,3 +9,4 @@ | JoeCartonKelly-MO | Joseph Carton-Kelly | Met Office | 2026-04-15 | | yg460-cam | Yao Ge | University of Cambridge | 2026-04-17 | | theabro | Nathan Luke Abraham | NCAS & University of Cambridge | 2026-03-19 | +| RobWatersMet | Rob Waters | NCAS & University of Cambridge | 2026-07-06 | diff --git a/src/control/core/top_level/ukca_main1-ukca_main1.F90 b/src/control/core/top_level/ukca_main1-ukca_main1.F90 index 044776f..6df0be3 100644 --- a/src/control/core/top_level/ukca_main1-ukca_main1.F90 +++ b/src/control/core/top_level/ukca_main1-ukca_main1.F90 @@ -2368,8 +2368,8 @@ SUBROUTINE ukca_main1(error_code_ptr, timestep_number, current_time, & atm_mebr_mol, & atm_h2_mol, & H_plus_3d_arr, & - zdryrt, zwetrt, nlev_with_ddep, L_stratosphere, co2_interactive, & - l_firstchem & + zdryrt, zwetrt, nlev_with_ddep, L_stratosphere, & + co2_interactive, l_firstchem & ) ELSE IF (ukca_config%l_ukca_asad_columns) THEN @@ -2406,7 +2406,7 @@ SUBROUTINE ukca_main1(error_code_ptr, timestep_number, current_time, & atm_mebr_mol, & atm_h2_mol, & H_plus_3d_arr, & - zdryrt, zwetrt, nlev_with_ddep & + zdryrt, zwetrt, nlev_with_ddep, co2_interactive & ) ELSE @@ -2442,7 +2442,8 @@ SUBROUTINE ukca_main1(error_code_ptr, timestep_number, current_time, & atm_mebr_mol, & atm_h2_mol, & H_plus_3d_arr, & - zdryrt, zwetrt, nlev_with_ddep, co2_interactive, L_stratosphere, & + zdryrt, zwetrt, nlev_with_ddep, & + co2_interactive, L_stratosphere, & l_firstchem & ) END IF diff --git a/src/science/core/chemistry/ukca_chemistry_ctl.F90 b/src/science/core/chemistry/ukca_chemistry_ctl.F90 index 4f61281..0b12f02 100644 --- a/src/science/core/chemistry/ukca_chemistry_ctl.F90 +++ b/src/science/core/chemistry/ukca_chemistry_ctl.F90 @@ -88,6 +88,7 @@ SUBROUTINE ukca_chemistry_ctl( & USE ukca_config_constants_mod, ONLY: avogadro USE ukca_config_specification_mod, ONLY: ukca_config USE ukca_ntp_mod, ONLY: ntp_type, dim_ntp, name2ntpindex + USE yomhook, ONLY: lhook, dr_hook USE parkind1, ONLY: jprb, jpim USE ereport_mod, ONLY: ereport @@ -118,7 +119,11 @@ SUBROUTINE ukca_chemistry_ctl( & REAL, INTENT(IN) :: zdryrt(theta_field_size,jpdd) ! dry dep rate REAL, INTENT(IN) :: zwetrt(tot_n_pnts,jpdw) ! wet dep rate REAL, INTENT(IN) :: photol_rates(tot_n_pnts,jppj) -REAL, INTENT(IN) :: co2_interactive(tot_n_pnts) + +! must be allocatable as passed unallocated from main if l_chem_environ_co2_fld +! is false +REAL, INTENT(IN), ALLOCATABLE :: co2_interactive(:,:,:) + REAL, INTENT(OUT) :: shno3_3d(tot_n_pnts) REAL, INTENT(IN OUT) :: q(tot_n_pnts) ! water vapour REAL, INTENT(IN OUT) :: tracer(tot_n_pnts,ntracers) ! tracer MMR @@ -302,15 +307,24 @@ SUBROUTINE ukca_chemistry_ctl( & ! Put tracer mmr into 1-D array for use in ASAD chemical solver zq(:) = q(kcs:kce)/c_h2o + ! CO2 as species IF (ANY(speci(:) == 'CO2 ')) THEN ! Copy the CO2 concentration into the asad module as VMR IF (ukca_config%l_chem_environ_co2_fld) THEN - co2_1d(:) = co2_interactive(kcs:kce)/c_co2 + + ! co2_interactive should be allocated if config option on + IF (.NOT. ALLOCATED(co2_interactive)) THEN + errcode = 1 + CALL ereport(ModuleName//':'//RoutineName, errcode, & + 'ERROR: co2_interactive array not allocated') + END IF + + co2_1d(:) = RESHAPE(co2_interactive(:,:,k), [theta_field_size]) / c_co2 ELSE co2_1d(:) = rmdi END IF - END IF ! CO2 as species + END IF ! Convert mmr into vmr for tracers. Pass data from the tracer 3D array, ! unwrap it and pass into the 1D zftr array before calling ASAD_CDRIVE. diff --git a/src/science/core/chemistry/ukca_chemistry_ctl_col_mod.F90 b/src/science/core/chemistry/ukca_chemistry_ctl_col_mod.F90 index d892256..65b4d6d 100644 --- a/src/science/core/chemistry/ukca_chemistry_ctl_col_mod.F90 +++ b/src/science/core/chemistry/ukca_chemistry_ctl_col_mod.F90 @@ -61,7 +61,7 @@ SUBROUTINE ukca_chemistry_ctl_col( & atm_mebr_mol, & atm_h2_mol, & H_plus_3d_arr, & - zdryrt, zwetrt, nlev_with_ddep & + zdryrt, zwetrt, nlev_with_ddep, co2_interactive & ) USE asad_mod, ONLY: advt, cdt_diag, ctype, & @@ -90,7 +90,6 @@ SUBROUTINE ukca_chemistry_ctl_col( & USE ukca_config_specification_mod, ONLY: ukca_config USE ukca_ntp_mod, ONLY: ntp_type, dim_ntp, name2ntpindex -USE ukca_environment_fields_mod, ONLY: co2_interactive USE yomhook, ONLY: lhook, dr_hook USE parkind1, ONLY: jprb, jpim @@ -141,6 +140,11 @@ SUBROUTINE ukca_chemistry_ctl_col( & REAL, INTENT(IN) :: zdryrt(row_length,rows,jpdd) ! dry dep rate REAL, INTENT(IN) :: zwetrt(row_length,rows,model_levels,jpdw) ! wet dep rate REAL, INTENT(IN) :: photol_rates(row_length,rows,model_levels,jppj) + +! must be allocatable as passed unallocated from main if l_chem_environ_co2_fld +! is false +REAL, INTENT(IN), ALLOCATABLE :: co2_interactive(:,:,:) + REAL, INTENT(OUT) :: shno3_3d(row_length,rows,model_levels) REAL, INTENT(IN OUT) :: q(row_length,rows,model_levels) ! water vapour REAL, INTENT(IN OUT) :: tracer(row_length,rows,model_levels, & @@ -342,6 +346,14 @@ SUBROUTINE ukca_chemistry_ctl_col( & IF (ANY(speci(:) == 'CO2 ')) THEN ! Copy the CO2 concentration into the asad module as VMR IF (ukca_config%l_chem_environ_co2_fld) THEN + + ! co2_interactive should be allocated if config option on + IF (.NOT. ALLOCATED(co2_interactive)) THEN + errcode = 1 + CALL ereport(ModuleName//':'//RoutineName, errcode, & + 'ERROR: co2_interactive array not allocated') + END IF + co2_1d(:) = co2_interactive(j,i,:)/c_co2 ELSE co2_1d(:) = rmdi diff --git a/src/science/core/chemistry/ukca_chemistry_ctl_full_mod.F90 b/src/science/core/chemistry/ukca_chemistry_ctl_full_mod.F90 index bc84636..9ecfcff 100644 --- a/src/science/core/chemistry/ukca_chemistry_ctl_full_mod.F90 +++ b/src/science/core/chemistry/ukca_chemistry_ctl_full_mod.F90 @@ -122,7 +122,11 @@ SUBROUTINE ukca_chemistry_ctl_full( & REAL, INTENT(IN) :: zdryrt(theta_field_size,jpdd) ! dry dep rate REAL, INTENT(IN) :: zwetrt(tot_n_pnts,jpdw) ! wet dep rate REAL, INTENT(IN) :: photol_rates(tot_n_pnts,jppj) -REAL, INTENT(IN) :: co2_interactive(tot_n_pnts) + +! must be allocatable as passed unallocated from main if l_chem_environ_co2_fld +! is false +REAL, INTENT(IN), ALLOCATABLE :: co2_interactive(:,:,:) + REAL, INTENT(OUT) :: shno3(tot_n_pnts) REAL, INTENT(IN OUT) :: q(tot_n_pnts) ! water vapour REAL, INTENT(IN OUT) :: tracer(tot_n_pnts,ntracers) ! tracer MMR @@ -245,14 +249,23 @@ SUBROUTINE ukca_chemistry_ctl_full( & zprt1d(:,:) = photol_rates(:,:) END IF +! CO2 as species IF (ANY(speci(:) == 'CO2 ')) THEN ! Copy the CO2 concentration into the asad module as VMR IF (ukca_config%l_chem_environ_co2_fld) THEN - co2_1d(:) = co2_interactive(:)/c_co2 + + ! co2_interactive should be allocated if config option on + IF (.NOT. ALLOCATED(co2_interactive)) THEN + errcode = 1 + CALL ereport(ModuleName//':'//RoutineName, errcode, & + 'ERROR: co2_interactive array not allocated') + END IF + + co2_1d(:) = RESHAPE(co2_interactive, [tot_n_pnts]) / c_co2 ELSE co2_1d(:) = rmdi END IF -END IF ! CO2 as species +END IF ! Retrieve tropospheric heterogeneous rates from previous time step IF (ukca_config%l_ukca_trophet) THEN