diff --git a/doc/NamesNotInDictionary.txt b/doc/NamesNotInDictionary.txt index 4cfd6aa1..99c2e48b 100644 --- a/doc/NamesNotInDictionary.txt +++ b/doc/NamesNotInDictionary.txt @@ -1,16 +1,42 @@ ####################### Date/time of when script was run: -2024-12-04 09:38:58.707515 +2024-12-16 11:19:41.130567 ####################### Non-dictionary standard names found in the following metadata files: -------------------------- -atmospheric_physics/test/test_schemes/initialize_constituents.meta +atmospheric_physics/schemes/sima_diagnostics/check_energy_gmean_diagnostics.meta - - dynamic_constituents_for_initialize_constituents + - flag_for_energy_global_means_output + - global_mean_heating_rate_correction_for_energy_conservation + - global_mean_vertically_integrated_total_energy_at_end_of_physics_timestep + - global_mean_vertically_integrated_total_energy_using_dycore_energy_formula_at_start_of_physics_timestep + +-------------------------- + +atmospheric_physics/schemes/sima_diagnostics/check_energy_diagnostics.meta + + - cumulative_total_energy_boundary_flux_using_physics_energy_formula + - cumulative_total_water_boundary_flux + - ratio_of_specific_heat_of_air_used_in_physics_energy_formula_to_specific_heat_of_air_used_in_dycore_energy_formula + - specific_heat_of_air_used_in_dycore + - vertically_integrated_total_energy_at_end_of_physics_timestep + - vertically_integrated_total_energy_using_dycore_energy_formula + - vertically_integrated_total_energy_using_physics_energy_formula + - vertically_integrated_total_water + +-------------------------- + +atmospheric_physics/schemes/sima_diagnostics/sima_state_diagnostics.meta + + - air_pressure_at_interface + - air_pressure_of_dry_air_at_interface + - ln_air_pressure_at_interface + - ln_air_pressure_of_dry_air_at_interface + - surface_air_pressure -------------------------- @@ -42,36 +68,43 @@ atmospheric_physics/schemes/sima_diagnostics/tropopause_diagnostics.meta -------------------------- -atmospheric_physics/schemes/sima_diagnostics/sima_state_diagnostics.meta +atmospheric_physics/schemes/tj2016/tj2016_precip.meta - - air_pressure_at_interface - - air_pressure_of_dry_air_at_interface - - geopotential_height_wrt_surface_at_interface - - ln_air_pressure_at_interface - - ln_air_pressure_of_dry_air_at_interface - - surface_air_pressure + - gas_constant_of_water_vapor + - lwe_large_scale_precipitation_rate_at_surface + - ratio_of_water_vapor_to_dry_air_molecular_weights + - sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient -------------------------- -atmospheric_physics/schemes/sima_diagnostics/check_energy_gmean_diagnostics.meta +atmospheric_physics/schemes/tj2016/tj2016_sfc_pbl_hs.meta - - flag_for_energy_global_means_output - - global_mean_heating_rate_correction_for_energy_conservation - - global_mean_vertically_integrated_total_energy_at_end_of_physics_timestep - - global_mean_vertically_integrated_total_energy_using_dycore_energy_formula_at_start_of_physics_timestep + - air_pressure_at_interface + - eddy_heat_diffusivity + - eddy_momentum_diffusivity + - gas_constant_of_water_vapor + - ln_air_pressure_at_interface + - pi_constant + - ratio_of_water_vapor_to_dry_air_molecular_weights + - sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient + - surface_air_pressure + - surface_eastward_wind_stress + - surface_evaporation_rate + - surface_northward_wind_stress + - surface_upward_sensible_heat_flux + - tendency_of_air_temperature_due_to_diabatic_heating + - tendency_of_air_temperature_due_to_vertical_diffusion + - tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water_due_to_vertical_diffusion -------------------------- -atmospheric_physics/schemes/sima_diagnostics/check_energy_diagnostics.meta +atmospheric_physics/schemes/dry_adiabatic_adjust/dadadj.meta - - cumulative_total_energy_boundary_flux_using_physics_energy_formula - - cumulative_total_water_boundary_flux - - ratio_of_specific_heat_of_air_used_in_physics_energy_formula_to_specific_heat_of_air_used_in_dycore_energy_formula - - specific_heat_of_air_used_in_dycore - - vertically_integrated_total_energy_at_end_of_physics_timestep - - vertically_integrated_total_energy_using_dycore_energy_formula - - vertically_integrated_total_energy_using_physics_energy_formula - - vertically_integrated_total_water + - air_pressure_at_interface + - binary_indicator_for_dry_adiabatic_adjusted_grid_cell + - number_of_iterations_for_dry_adiabatic_adjustment_algorithm_convergence + - number_of_vertical_levels_from_model_top_where_dry_adiabatic_adjustment_occurs + - tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water -------------------------- @@ -128,28 +161,6 @@ atmospheric_physics/schemes/zhang_mcfarlane/zm_conv_evap.meta -------------------------- -atmospheric_physics/schemes/zhang_mcfarlane/zm_conv_convtran.meta - - - atmosphere_detrainment_convective_mass_flux_for_deep_convection_for_convective_columns - - atmosphere_downdraft_convective_mass_flux_for_deep_convection_for_convective_columns - - atmosphere_downdraft_entrainment_convective_mass_flux_for_deep_convection_for_convective_columns - - atmosphere_updraft_convective_mass_flux_for_deep_convection_for_convective_columns - - atmosphere_updraft_entrainment_convective_mass_flux_for_deep_convection_for_convective_columns - - current_timestep_number - - flag_for_zhang_mcfarlane_deep_convective_transport? - - fraction_of_water_insoluble_convectively_transported_species - - horizontal_index_of_convective_columns_for_deep_convection_for_convective_columns - - maximum_number_of_grid_cells_with_deep_convection? - - minimum_number_of_grid_cells_with_deep_convection? - - pressure_thickness_for_deep_convection_for_convective_columns - - pressure_thickness_for_subcloud_layer_for_deep_convection_for_convective_columns - - pressure_thickness_of_dry_air_for_deep_convection_for_convective_columns? - - tendency_of_ccpp_constituents? - - vertical_index_at_top_of_deep_convection_for_convective_columns - - vertical_index_of_deep_conveciton_launch_level_for_convective_columns - --------------------------- - atmospheric_physics/schemes/zhang_mcfarlane/zm_convr.meta - air_pressure_at_interface @@ -178,7 +189,6 @@ atmospheric_physics/schemes/zhang_mcfarlane/zm_convr.meta - flag_for_no_deep_convection_in_pbl? - freezing_point_of_water? - gas_constant_of_water_vapor? - - geopotential_height_wrt_surface_at_interface - horizontal_index_of_convective_columns_for_deep_convection_for_convective_columns - in_cloud_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water_due_to_deep_convection - initial_parcel_property_as_function_of_well-mixed_pbl_for_zhang_mcfarlane? @@ -207,19 +217,45 @@ atmospheric_physics/schemes/zhang_mcfarlane/zm_convr.meta -------------------------- -atmospheric_physics/schemes/check_energy/dycore_energy_consistency_adjust.meta +atmospheric_physics/schemes/zhang_mcfarlane/zm_conv_convtran.meta - - flag_for_dycore_energy_consistency_adjustment - - ratio_of_specific_heat_of_air_used_in_physics_energy_formula_to_specific_heat_of_air_used_in_dycore_energy_formula + - atmosphere_detrainment_convective_mass_flux_for_deep_convection_for_convective_columns + - atmosphere_downdraft_convective_mass_flux_for_deep_convection_for_convective_columns + - atmosphere_downdraft_entrainment_convective_mass_flux_for_deep_convection_for_convective_columns + - atmosphere_updraft_convective_mass_flux_for_deep_convection_for_convective_columns + - atmosphere_updraft_entrainment_convective_mass_flux_for_deep_convection_for_convective_columns + - current_timestep_number + - flag_for_zhang_mcfarlane_deep_convective_transport? + - fraction_of_water_insoluble_convectively_transported_species + - horizontal_index_of_convective_columns_for_deep_convection_for_convective_columns + - maximum_number_of_grid_cells_with_deep_convection? + - minimum_number_of_grid_cells_with_deep_convection? + - pressure_thickness_for_deep_convection_for_convective_columns + - pressure_thickness_for_subcloud_layer_for_deep_convection_for_convective_columns + - pressure_thickness_of_dry_air_for_deep_convection_for_convective_columns? + - tendency_of_ccpp_constituents? + - vertical_index_at_top_of_deep_convection_for_convective_columns + - vertical_index_of_deep_conveciton_launch_level_for_convective_columns -------------------------- -atmospheric_physics/schemes/check_energy/check_energy_zero_fluxes.meta +atmospheric_physics/schemes/utilities/geopotential_temp.meta - - net_liquid_and_lwe_ice_fluxes_through_top_and_bottom_of_atmosphere_column - - net_lwe_ice_fluxes_through_top_and_bottom_of_atmosphere_column - - net_sensible_heat_flux_through_top_and_bottom_of_atmosphere_column - - net_water_vapor_fluxes_through_top_and_bottom_of_atmosphere_column + - air_pressure_at_interface + - ln_air_pressure_at_interface + +-------------------------- + +atmospheric_physics/schemes/utilities/physics_tendency_updaters.meta + + - ccpp_constituent_tendencies + +-------------------------- + +atmospheric_physics/schemes/check_energy/check_energy_save_teout.meta + + - vertically_integrated_total_energy_at_end_of_physics_timestep + - vertically_integrated_total_energy_using_dycore_energy_formula -------------------------- @@ -251,18 +287,19 @@ atmospheric_physics/schemes/check_energy/check_energy_chng.meta -------------------------- -atmospheric_physics/schemes/check_energy/check_energy_fix.meta +atmospheric_physics/schemes/check_energy/check_energy_zero_fluxes.meta - - air_pressure_at_interface - - global_mean_heating_rate_correction_for_energy_conservation + - net_liquid_and_lwe_ice_fluxes_through_top_and_bottom_of_atmosphere_column + - net_lwe_ice_fluxes_through_top_and_bottom_of_atmosphere_column - net_sensible_heat_flux_through_top_and_bottom_of_atmosphere_column + - net_water_vapor_fluxes_through_top_and_bottom_of_atmosphere_column -------------------------- -atmospheric_physics/schemes/check_energy/check_energy_save_teout.meta +atmospheric_physics/schemes/check_energy/dycore_energy_consistency_adjust.meta - - vertically_integrated_total_energy_at_end_of_physics_timestep - - vertically_integrated_total_energy_using_dycore_energy_formula + - flag_for_dycore_energy_consistency_adjustment + - ratio_of_specific_heat_of_air_used_in_physics_energy_formula_to_specific_heat_of_air_used_in_dycore_energy_formula -------------------------- @@ -273,6 +310,14 @@ atmospheric_physics/schemes/check_energy/check_energy_scaling.meta -------------------------- +atmospheric_physics/schemes/check_energy/check_energy_fix.meta + + - air_pressure_at_interface + - global_mean_heating_rate_correction_for_energy_conservation + - net_sensible_heat_flux_through_top_and_bottom_of_atmosphere_column + +-------------------------- + atmospheric_physics/schemes/check_energy/check_energy_gmean/check_energy_gmean.meta - air_pressure_at_interface @@ -287,97 +332,27 @@ atmospheric_physics/schemes/check_energy/check_energy_gmean/check_energy_gmean.m -------------------------- -atmospheric_physics/schemes/tj2016/tj2016_sfc_pbl_hs.meta - - - air_pressure_at_interface - - eddy_heat_diffusivity - - eddy_momentum_diffusivity - - gas_constant_of_water_vapor - - ln_air_pressure_at_interface - - pi_constant - - ratio_of_water_vapor_to_dry_air_molecular_weights - - sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient - - surface_air_pressure - - surface_eastward_wind_stress - - surface_evaporation_rate - - surface_northward_wind_stress - - surface_upward_sensible_heat_flux - - tendency_of_air_temperature_due_to_diabatic_heating - - tendency_of_air_temperature_due_to_vertical_diffusion - - tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water_due_to_vertical_diffusion - --------------------------- - -atmospheric_physics/schemes/tj2016/tj2016_precip.meta - - - gas_constant_of_water_vapor - - lwe_large_scale_precipitation_rate_at_surface - - ratio_of_water_vapor_to_dry_air_molecular_weights - - sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient - --------------------------- - -atmospheric_physics/schemes/musica/musica_ccpp.meta - - - blackbody_temperature_at_surface - - cloud_area_fraction - - dynamic_constituents_for_musica_ccpp - - extraterrestrial_radiation_flux - - geopotential_height_wrt_surface_at_interface - - micm_solver_type - - number_of_grid_cells - - number_of_photolysis_wavelength_grid_sections - - photolysis_wavelength_grid_interfaces - - surface_albedo_due_to_UV_and_VIS_direct - --------------------------- - -atmospheric_physics/schemes/dry_adiabatic_adjust/dadadj.meta - - - air_pressure_at_interface - - binary_indicator_for_dry_adiabatic_adjusted_grid_cell - - number_of_iterations_for_dry_adiabatic_adjustment_algorithm_convergence - - number_of_vertical_levels_from_model_top_where_dry_adiabatic_adjustment_occurs - - tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water - --------------------------- - -atmospheric_physics/schemes/utilities/physics_tendency_updaters.meta - - - ccpp_constituent_tendencies - --------------------------- - -atmospheric_physics/schemes/utilities/geopotential_temp.meta - - - air_pressure_at_interface - - geopotential_height_wrt_surface_at_interface - - ln_air_pressure_at_interface - --------------------------- - atmospheric_physics/schemes/tropopause_find/tropopause_find.meta - air_pressure_at_interface - fill_value_for_diagnostic_output - fractional_calendar_days_on_end_of_current_timestep - - geopotential_height_wrt_surface_at_interface - pi_constant - ratio_of_dry_air_gas_constant_to_specific_heat_of_dry_air_at_constant_pressure - tropopause_air_pressure - tropopause_air_pressure_from_chemical_method - tropopause_air_pressure_from_climatological_method - - tropopause_air_pressure_from_climatology_dataset - tropopause_air_pressure_from_cold_point_method - tropopause_air_pressure_from_hybrid_stobie_linoz_with_climatological_backup_method - tropopause_air_pressure_from_lapse_rate_method + - tropopause_air_pressure_from_tropopause_climatology_dataset - tropopause_air_temperature - tropopause_air_temperature_from_chemical_method - tropopause_air_temperature_from_climatological_method - tropopause_air_temperature_from_cold_point_method - tropopause_air_temperature_from_hybrid_stobie_linoz_with_climatological_backup_method - tropopause_air_temperature_from_lapse_rate_method - - tropopause_calendar_days_from_climatology + - tropopause_calendar_days_from_tropopause_climatology - tropopause_geopotential_height_wrt_surface - tropopause_geopotential_height_wrt_surface_from_chemical_method - tropopause_geopotential_height_wrt_surface_from_climatological_method @@ -394,4 +369,23 @@ atmospheric_physics/schemes/tropopause_find/tropopause_find.meta - vertical_layer_index_lower_bound_from_hybrid_stobie_linoz_with_climatological_backup_method_for_linearized_ozone_chemistry - vertical_layer_index_lower_bound_from_hybrid_stobie_linoz_with_climatological_backup_method_for_stratospheric_chemistry +-------------------------- + +atmospheric_physics/schemes/musica/musica_ccpp.meta + + - blackbody_temperature_at_surface + - cloud_area_fraction + - dynamic_constituents_for_musica_ccpp + - earth_sun_distance + - extraterrestrial_radiation_flux + - photolysis_wavelength_grid_interfaces + - solar_zenith_angle + - surface_albedo_due_to_UV_and_VIS_direct + +-------------------------- + +atmospheric_physics/test/test_schemes/initialize_constituents.meta + + - dynamic_constituents_for_initialize_constituents + ####################### diff --git a/schemes/musica/micm/musica_ccpp_micm.F90 b/schemes/musica/micm/musica_ccpp_micm.F90 index d2c6044d..c2e40d95 100644 --- a/schemes/musica/micm/musica_ccpp_micm.F90 +++ b/schemes/musica/micm/musica_ccpp_micm.F90 @@ -38,6 +38,10 @@ subroutine micm_register(solver_type, number_of_grid_cells, constituent_props, & logical :: is_advected integer :: i, species_index + if (associated( micm )) then + deallocate( micm ) + micm => null() + end if micm => micm_t(trim(filename_of_micm_configuration), solver_type, & number_of_grid_cells, error) if (has_error_occurred(error, errmsg, errcode)) return diff --git a/schemes/musica/musica_ccpp.F90 b/schemes/musica/musica_ccpp.F90 index d5526f52..4c79511f 100644 --- a/schemes/musica/musica_ccpp.F90 +++ b/schemes/musica/musica_ccpp.F90 @@ -14,18 +14,23 @@ module musica_ccpp !> \section arg_table_musica_ccpp_register Argument Table !! \htmlinclude musica_ccpp_register.html - subroutine musica_ccpp_register(micm_solver_type, number_of_grid_cells, & - constituent_props, errmsg, errcode) + subroutine musica_ccpp_register(constituent_props, errmsg, & + errcode) use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t + use musica_ccpp_namelist, only: micm_solver_type - integer, intent(in) :: micm_solver_type - integer, intent(in) :: number_of_grid_cells type(ccpp_constituent_properties_t), allocatable, intent(out) :: constituent_props(:) character(len=512), intent(out) :: errmsg integer, intent(out) :: errcode type(ccpp_constituent_properties_t), allocatable :: constituent_props_subset(:) + integer :: number_of_grid_cells + ! Temporary fix until the number of grid cells is only needed to create a MICM state + ! instead of when the solver is created. + ! The number of grid cells is not known at this point, so we set it to 1 and recreate + ! the solver when the number of grid cells is known at the init stage. + number_of_grid_cells = 1 call micm_register(micm_solver_type, number_of_grid_cells, constituent_props_subset, & errmsg, errcode) if (errcode /= 0) return @@ -40,13 +45,16 @@ end subroutine musica_ccpp_register !> \section arg_table_musica_ccpp_init Argument Table !! \htmlinclude musica_ccpp_init.html - subroutine musica_ccpp_init(vertical_layer_dimension, vertical_interface_dimension, & + subroutine musica_ccpp_init(horizontal_dimension, vertical_layer_dimension, & + vertical_interface_dimension, & photolysis_wavelength_grid_interfaces, & constituent_props, errmsg, errcode) - use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t + use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t, ccpp_constituent_prop_ptr_t use ccpp_kinds, only : kind_phys use musica_ccpp_micm, only: micm + use musica_ccpp_namelist, only: micm_solver_type use musica_ccpp_util, only: has_error_occurred + integer, intent(in) :: horizontal_dimension ! (count) integer, intent(in) :: vertical_layer_dimension ! (count) integer, intent(in) :: vertical_interface_dimension ! (count) real(kind_phys), intent(in) :: photolysis_wavelength_grid_interfaces(:) ! m @@ -54,6 +62,14 @@ subroutine musica_ccpp_init(vertical_layer_dimension, vertical_interface_dimensi character(len=512), intent(out) :: errmsg integer, intent(out) :: errcode + integer :: number_of_grid_cells + type(ccpp_constituent_properties_t), allocatable :: micm_species_props(:) + + ! Temporary fix until the number of grid cells is only needed to create a MICM state + ! instead of when the solver is created. + ! Re-create the MICM solver with the correct number of grid cells + number_of_grid_cells = horizontal_dimension * vertical_layer_dimension + call micm_register(micm_solver_type, number_of_grid_cells, micm_species_props, errmsg, errcode) call micm_init(errmsg, errcode) if (errcode /= 0) return call tuvx_init(vertical_layer_dimension, vertical_interface_dimension, & @@ -74,10 +90,10 @@ subroutine musica_ccpp_run(time_step, temperature, pressure, dry_air_density, co constituents, geopotential_height_wrt_surface_at_midpoint, & geopotential_height_wrt_surface_at_interface, surface_geopotential, & surface_temperature, surface_albedo, & - number_of_photolysis_wavelength_grid_sections, & photolysis_wavelength_grid_interfaces, extraterrestrial_flux, & standard_gravitational_acceleration, cloud_area_fraction, & - air_pressure_thickness, errmsg, errcode) + air_pressure_thickness, solar_zenith_angle, & + earth_sun_distance, errmsg, errcode) use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t use ccpp_kinds, only: kind_phys use musica_ccpp_micm, only: number_of_rate_parameters @@ -95,12 +111,13 @@ subroutine musica_ccpp_run(time_step, temperature, pressure, dry_air_density, co real(kind_phys), intent(in) :: surface_geopotential(:) ! m2 s-2 real(kind_phys), intent(in) :: surface_temperature(:) ! K real(kind_phys), intent(in) :: surface_albedo ! unitless - integer, intent(in) :: number_of_photolysis_wavelength_grid_sections ! (count) real(kind_phys), intent(in) :: photolysis_wavelength_grid_interfaces(:) ! nm real(kind_phys), intent(in) :: extraterrestrial_flux(:) ! photons cm-2 s-1 nm-1 real(kind_phys), intent(in) :: standard_gravitational_acceleration ! m s-2 real(kind_phys), intent(in) :: cloud_area_fraction(:,:) ! unitless (column, level) real(kind_phys), intent(in) :: air_pressure_thickness(:,:) ! Pa (column, level) + real(kind_phys), intent(in) :: solar_zenith_angle(:) ! radians (column) + real(kind_phys), intent(in) :: earth_sun_distance ! AU character(len=512), intent(out) :: errmsg integer, intent(out) :: errcode @@ -113,16 +130,19 @@ subroutine musica_ccpp_run(time_step, temperature, pressure, dry_air_density, co ! Calculate photolysis rate constants using TUV-x call tuvx_run(temperature, dry_air_density, & + constituents, & geopotential_height_wrt_surface_at_midpoint, & geopotential_height_wrt_surface_at_interface, & surface_geopotential, surface_temperature, & surface_albedo, & - number_of_photolysis_wavelength_grid_sections, & photolysis_wavelength_grid_interfaces, & extraterrestrial_flux, & standard_gravitational_acceleration, & - cloud_area_fraction, constituents, & - air_pressure_thickness, rate_parameters, & + cloud_area_fraction, & + air_pressure_thickness, & + solar_zenith_angle, & + earth_sun_distance, & + rate_parameters, & errmsg, errcode) ! Get the molar mass that is set in the call to instantiate() diff --git a/schemes/musica/musica_ccpp.meta b/schemes/musica/musica_ccpp.meta index e69afa30..801c3c79 100644 --- a/schemes/musica/musica_ccpp.meta +++ b/schemes/musica/musica_ccpp.meta @@ -6,18 +6,6 @@ [ccpp-arg-table] name = musica_ccpp_register type = scheme -[ micm_solver_type ] - standard_name = micm_solver_type - units = none - type = integer - dimensions = () - intent = in -[ number_of_grid_cells ] - standard_name = number_of_grid_cells - units = count - type = integer - dimensions = () - intent = in [ constituent_props ] standard_name = dynamic_constituents_for_musica_ccpp units = none @@ -41,15 +29,21 @@ [ccpp-arg-table] name = musica_ccpp_init type = scheme +[ horizontal_dimension ] + standard_name = horizontal_dimension + units = count + type = integer + dimensions = () + intent = in [ vertical_layer_dimension ] standard_name = vertical_layer_dimension - units = none + units = count type = integer dimensions = () intent = in [ vertical_interface_dimension ] standard_name = vertical_interface_dimension - units = none + units = count type = integer dimensions = () intent = in @@ -144,26 +138,20 @@ [ surface_albedo ] standard_name = surface_albedo_due_to_UV_and_VIS_direct type = real | kind = kind_phys - units = None - dimensions = () - intent = in -[ number_of_photolysis_wavelength_grid_sections ] - standard_name = number_of_photolysis_wavelength_grid_sections - type = integer - units = None + units = fraction dimensions = () intent = in [ photolysis_wavelength_grid_interfaces ] standard_name = photolysis_wavelength_grid_interfaces type = real | kind = kind_phys - units = nm - dimensions = (horizontal_loop_extent) + units = m + dimensions = (photolysis_wavelength_grid_interface_dimension) intent = in [ extraterrestrial_flux ] standard_name = extraterrestrial_radiation_flux type = real | kind = kind_phys units = photons cm-2 s-1 nm-1 - dimensions = (horizontal_loop_extent) + dimensions = (photolysis_wavelength_grid_section_dimension) intent = in [ standard_gravitational_acceleration ] standard_name = standard_gravitational_acceleration @@ -183,6 +171,18 @@ type = real | kind = kind_phys dimensions = (horizontal_loop_extent,vertical_layer_dimension) intent = in +[ solar_zenith_angle ] + standard_name = solar_zenith_angle + units = rad + type = real | kind = kind_phys + dimensions = (horizontal_loop_extent) + intent = in +[ earth_sun_distance ] + standard_name = earth_sun_distance + units = AU + type = real | kind = kind_phys + dimensions = () + intent = in [ errmsg ] standard_name = ccpp_error_message units = none diff --git a/schemes/musica/musica_ccpp_namelist.xml b/schemes/musica/musica_ccpp_namelist.xml index 31999ef2..c36d1b81 100644 --- a/schemes/musica/musica_ccpp_namelist.xml +++ b/schemes/musica/musica_ccpp_namelist.xml @@ -75,16 +75,20 @@ units This is the CCPP unit specification of the variable (e.g., m s-1). --> -
- - integer - - - integer - -
- + + integer + musica_ccpp + musica_ccpp + micm_solver_type + none + + The type of MICM solver to use. + + + 1 + + char*512 musica_ccpp diff --git a/schemes/musica/musica_ccpp_util.F90 b/schemes/musica/musica_ccpp_util.F90 index 5a4eda9c..c87cce2f 100644 --- a/schemes/musica/musica_ccpp_util.F90 +++ b/schemes/musica/musica_ccpp_util.F90 @@ -2,11 +2,16 @@ ! SPDX-License-Identifier: Apache-2.0 module musica_ccpp_util + use ccpp_kinds, only: kind_phys + implicit none private public :: has_error_occurred + real(kind_phys), parameter, public :: PI = 3.14159265358979323846_kind_phys + real(kind_phys), parameter, public :: DEGREE_TO_RADIAN = PI / 180.0_kind_phys + contains !> @brief Evaluate a MUSICA error for failure and convert to CCPP error data diff --git a/schemes/musica/tuvx/musica_ccpp_tuvx.F90 b/schemes/musica/tuvx/musica_ccpp_tuvx.F90 index d285c4a3..681a1952 100644 --- a/schemes/musica/tuvx/musica_ccpp_tuvx.F90 +++ b/schemes/musica/tuvx/musica_ccpp_tuvx.F90 @@ -13,6 +13,9 @@ module musica_ccpp_tuvx public :: tuvx_register, tuvx_init, tuvx_run, tuvx_final + real(kind_phys), parameter :: MAX_SOLAR_ZENITH_ANGLE = 110.0_kind_phys ! degrees + real(kind_phys), parameter :: MIN_SOLAR_ZENITH_ANGLE = 0.0_kind_phys ! degrees + type(tuvx_t), pointer :: tuvx => null() type(grid_t), pointer :: height_grid => null() type(grid_t), pointer :: wavelength_grid => null() @@ -135,6 +138,7 @@ subroutine tuvx_init(vertical_layer_dimension, vertical_interface_dimension, & use musica_tuvx, only: grid_map_t, profile_map_t, radiator_map_t use musica_util, only: error_t, configuration_t use musica_ccpp_namelist, only: filename_of_tuvx_micm_mapping_configuration + use musica_ccpp_util, only: PI use musica_ccpp_tuvx_height_grid, & only: create_height_grid, height_grid_label, height_grid_unit use musica_ccpp_tuvx_wavelength_grid, & @@ -439,21 +443,24 @@ end subroutine tuvx_init !> Calculates photolysis rate constants for the current model conditions subroutine tuvx_run(temperature, dry_air_density, & + constituents, & geopotential_height_wrt_surface_at_midpoint, & geopotential_height_wrt_surface_at_interface, & surface_geopotential, surface_temperature, & surface_albedo, & - number_of_photolysis_wavelength_grid_sections, & photolysis_wavelength_grid_interfaces, & extraterrestrial_flux, & standard_gravitational_acceleration, & - cloud_area_fraction, constituents, & - air_pressure_thickness, rate_parameters, & + cloud_area_fraction, & + air_pressure_thickness, & + solar_zenith_angle, & + earth_sun_distance, & + rate_parameters, & errmsg, errcode) use musica_util, only: error_t use musica_ccpp_tuvx_height_grid, only: set_height_grid_values, calculate_heights use musica_ccpp_tuvx_temperature, only: set_temperature_values - use musica_ccpp_util, only: has_error_occurred + use musica_ccpp_util, only: has_error_occurred, PI use musica_ccpp_tuvx_surface_albedo, only: set_surface_albedo_values use musica_ccpp_tuvx_extraterrestrial_flux, only: set_extraterrestrial_flux_values use musica_ccpp_tuvx_cloud_optics, only: set_cloud_optics_values @@ -461,18 +468,19 @@ subroutine tuvx_run(temperature, dry_air_density, & real(kind_phys), intent(in) :: temperature(:,:) ! K (column, layer) real(kind_phys), intent(in) :: dry_air_density(:,:) ! kg m-3 (column, layer) + real(kind_phys), intent(in) :: constituents(:,:,:) ! various (column, layer, constituent) real(kind_phys), intent(in) :: geopotential_height_wrt_surface_at_midpoint(:,:) ! m (column, layer) real(kind_phys), intent(in) :: geopotential_height_wrt_surface_at_interface(:,:) ! m (column, interface) real(kind_phys), intent(in) :: surface_geopotential(:) ! m2 s-2 real(kind_phys), intent(in) :: surface_temperature(:) ! K real(kind_phys), intent(in) :: surface_albedo ! unitless - integer, intent(in) :: number_of_photolysis_wavelength_grid_sections ! (count) real(kind_phys), intent(in) :: photolysis_wavelength_grid_interfaces(:) ! nm real(kind_phys), intent(in) :: extraterrestrial_flux(:) ! photons cm-2 s-1 nm-1 real(kind_phys), intent(in) :: standard_gravitational_acceleration ! m s-2 real(kind_phys), intent(in) :: cloud_area_fraction(:,:) ! unitless (column, layer) - real(kind_phys), intent(in) :: constituents(:,:,:) ! various (column, layer, constituent) real(kind_phys), intent(in) :: air_pressure_thickness(:,:) ! Pa (column, layer) + real(kind_phys), intent(in) :: solar_zenith_angle(:) ! radians + real(kind_phys), intent(in) :: earth_sun_distance ! m real(kind_phys), intent(inout) :: rate_parameters(:,:,:) ! various units (column, layer, reaction) character(len=512), intent(out) :: errmsg integer, intent(out) :: errcode @@ -484,8 +492,7 @@ subroutine tuvx_run(temperature, dry_air_density, & number_of_photolysis_rate_constants) :: photolysis_rate_constants, & ! s-1 heating_rates ! K s-1 (TODO: check units) real(kind_phys) :: reciprocal_of_gravitational_acceleration ! s2 m-1 - real(kind_phys) :: solar_zenith_angle ! degrees - real(kind_phys) :: earth_sun_distance ! AU + real(kind_phys) :: solar_zenith_angle_degrees type(error_t) :: error integer :: i_col, i_level @@ -496,48 +503,51 @@ subroutine tuvx_run(temperature, dry_air_density, & if (errcode /= 0) return call set_extraterrestrial_flux_values( extraterrestrial_flux_profile, & - number_of_photolysis_wavelength_grid_sections, & photolysis_wavelength_grid_interfaces, & extraterrestrial_flux, errmsg, errcode ) if (errcode /= 0) return do i_col = 1, size(temperature, dim=1) - call calculate_heights( geopotential_height_wrt_surface_at_midpoint(i_col,:), & - geopotential_height_wrt_surface_at_interface(i_col,:), & - surface_geopotential(i_col), & - reciprocal_of_gravitational_acceleration, & - height_midpoints, height_interfaces ) - call set_height_grid_values( height_grid, height_midpoints, height_interfaces, & + + ! check if solar zenith angle is within the range to calculate photolysis rate constants + solar_zenith_angle_degrees = solar_zenith_angle(i_col) * 180.0_kind_phys / PI + if (solar_zenith_angle_degrees > MAX_SOLAR_ZENITH_ANGLE .or. & + solar_zenith_angle_degrees < MIN_SOLAR_ZENITH_ANGLE) then + photolysis_rate_constants(:,:) = 0.0_kind_phys + else + call calculate_heights( geopotential_height_wrt_surface_at_midpoint(i_col,:), & + geopotential_height_wrt_surface_at_interface(i_col,:), & + surface_geopotential(i_col), & + reciprocal_of_gravitational_acceleration, & + height_midpoints, height_interfaces ) + call set_height_grid_values( height_grid, height_midpoints, height_interfaces, & errmsg, errcode ) - if (errcode /= 0) return + if (errcode /= 0) return - call set_temperature_values( temperature_profile, temperature(i_col,:), & + call set_temperature_values( temperature_profile, temperature(i_col,:), & surface_temperature(i_col), errmsg, errcode ) - if (errcode /= 0) return - - call set_cloud_optics_values( cloud_optics, cloud_area_fraction(i_col,:), & - air_pressure_thickness(i_col,:), & - constituents(i_col,:,index_cloud_liquid_water_content), & - reciprocal_of_gravitational_acceleration, & - errmsg, errcode ) - if (errcode /= 0) return - - call set_aerosol_optics_values( aerosol_optics, errmsg, errcode ) - if (errcode /= 0) return - - ! temporary values until these are available from the host model - solar_zenith_angle = 0.0_kind_phys - earth_sun_distance = 1.0_kind_phys - - ! calculate photolysis rate constants and heating rates - call tuvx%run( solar_zenith_angle, earth_sun_distance, & - photolysis_rate_constants(:,:), heating_rates(:,:), & - error ) - if (has_error_occurred( error, errmsg, errcode )) return - - ! filter out negative photolysis rate constants - photolysis_rate_constants(:,:) = & - max( photolysis_rate_constants(:,:), 0.0_kind_phys ) + if (errcode /= 0) return + + call set_cloud_optics_values( cloud_optics, cloud_area_fraction(i_col,:), & + air_pressure_thickness(i_col,:), & + constituents(i_col,:,index_cloud_liquid_water_content), & + reciprocal_of_gravitational_acceleration, & + errmsg, errcode ) + if (errcode /= 0) return + + call set_aerosol_optics_values( aerosol_optics, errmsg, errcode ) + if (errcode /= 0) return + + ! calculate photolysis rate constants and heating rates + call tuvx%run( solar_zenith_angle(i_col), earth_sun_distance, & + photolysis_rate_constants(:,:), heating_rates(:,:), & + error ) + if (has_error_occurred( error, errmsg, errcode )) return + + ! filter out negative photolysis rate constants + photolysis_rate_constants(:,:) = & + max( photolysis_rate_constants(:,:), 0.0_kind_phys ) + end if ! solar zenith angle check ! map photolysis rate constants to the host model's rate parameters and vertical grid do i_level = 1, size(rate_parameters, dim=2) diff --git a/schemes/musica/tuvx/musica_ccpp_tuvx_extraterrestrial_flux.F90 b/schemes/musica/tuvx/musica_ccpp_tuvx_extraterrestrial_flux.F90 index c6cfddad..568954e9 100644 --- a/schemes/musica/tuvx/musica_ccpp_tuvx_extraterrestrial_flux.F90 +++ b/schemes/musica/tuvx/musica_ccpp_tuvx_extraterrestrial_flux.F90 @@ -57,8 +57,8 @@ end function create_extraterrestrial_flux_profile ! width of the wavelength bins to get the TUV-x units of photon cm-2 s-1 ! ! TUV-x only uses mid-point values for extraterrestrial flux - subroutine set_extraterrestrial_flux_values(profile, num_photolysis_wavelength_grid_sections, & - photolysis_wavelength_grid_interfaces, extraterrestrial_flux, errmsg, errcode) + subroutine set_extraterrestrial_flux_values(profile, photolysis_wavelength_grid_interfaces, & + extraterrestrial_flux, errmsg, errcode) use musica_ccpp_util, only: has_error_occurred use musica_tuvx_profile, only: profile_t use musica_util, only: error_t @@ -66,7 +66,6 @@ subroutine set_extraterrestrial_flux_values(profile, num_photolysis_wavelength_g use ccpp_tuvx_utils, only: rebin type(profile_t), intent(inout) :: profile - integer, intent(in) :: num_photolysis_wavelength_grid_sections ! (count) real(kind_phys), intent(in) :: photolysis_wavelength_grid_interfaces(:) ! nm real(kind_phys), intent(in) :: extraterrestrial_flux(:) ! photons cm-2 s-1 nm-1 character(len=*), intent(out) :: errmsg @@ -90,7 +89,7 @@ subroutine set_extraterrestrial_flux_values(profile, num_photolysis_wavelength_g end if ! Regrid normalized flux to TUV-x wavelength grid - call rebin( num_photolysis_wavelength_grid_sections, num_wavelength_bins_, & + call rebin( size(photolysis_wavelength_grid_interfaces) - 1, num_wavelength_bins_, & photolysis_wavelength_grid_interfaces, wavelength_grid_interfaces_, & extraterrestrial_flux, midpoints ) diff --git a/schemes/tropopause_find/tropopause_find.meta b/schemes/tropopause_find/tropopause_find.meta index e58e81a1..bc0978e1 100644 --- a/schemes/tropopause_find/tropopause_find.meta +++ b/schemes/tropopause_find/tropopause_find.meta @@ -112,16 +112,16 @@ dimensions = () intent = in [ tropp_p_loc ] - standard_name = tropopause_air_pressure_from_climatology_dataset + standard_name = tropopause_air_pressure_from_tropopause_climatology_dataset units = Pa type = real | kind = kind_phys - dimensions = (horizontal_dimension, number_of_months_in_year) + dimensions = (horizontal_dimension, number_of_time_slices_in_tropopause_climatology_dataset) intent = in [ tropp_days ] - standard_name = tropopause_calendar_days_from_climatology + standard_name = tropopause_calendar_days_from_tropopause_climatology units = 1 type = real | kind = kind_phys - dimensions = (number_of_months_in_year) + dimensions = (number_of_time_slices_in_tropopause_climatology_dataset) intent = in [ tropLev ] standard_name = tropopause_vertical_layer_index diff --git a/test/docker/Dockerfile.musica b/test/docker/Dockerfile.musica index aa00a0da..f83ccdfb 100644 --- a/test/docker/Dockerfile.musica +++ b/test/docker/Dockerfile.musica @@ -87,7 +87,7 @@ ENV CCPP_STD_NAMES_PATH="lib/CCPPStandardNames" RUN cd atmospheric_physics/test \ && cmake -S . -B build \ - -D CMAKE_BUILD_TYPE={BUILD_TYPE} \ + -D CMAKE_BUILD_TYPE=${BUILD_TYPE} \ -D CCPP_ENABLE_MUSICA_TESTS=ON \ -D CCPP_ENABLE_MEMCHECK=ON \ && cmake --build ./build diff --git a/test/musica/CMakeLists.txt b/test/musica/CMakeLists.txt index 0d187cf4..fbedfba3 100644 --- a/test/musica/CMakeLists.txt +++ b/test/musica/CMakeLists.txt @@ -81,9 +81,9 @@ add_test( --directory ${CMAKE_BINARY_DIR}/metadata_test ) -# Test metadata against the CCPP standard names +# Test musica scheme metadata against the CCPP standard names add_test( - NAME test_metadata_against_ccpp_standard_names + NAME test_musica_metadata_against_ccpp_standard_names COMMAND ${Python_EXECUTABLE} ${CMAKE_BINARY_DIR}/../$ENV{CCPP_STD_NAMES_PATH}/tools/meta_stdname_check.py --metafile-loc ${CMAKE_BINARY_DIR}/metadata_test/musica_ccpp.meta --stdname-dict ${CMAKE_BINARY_DIR}/../$ENV{CCPP_STD_NAMES_PATH}/standard_names.xml diff --git a/test/musica/musica_ccpp_namelist.F90 b/test/musica/musica_ccpp_namelist.F90 index d27cc754..0dcf3170 100644 --- a/test/musica/musica_ccpp_namelist.F90 +++ b/test/musica/musica_ccpp_namelist.F90 @@ -4,7 +4,8 @@ module musica_ccpp_namelist implicit none private - + + integer, public :: micm_solver_type = 1 character(len=250), public :: filename_of_micm_configuration = 'musica_configurations/chapman/micm/config.json' character(len=250), public :: filename_of_tuvx_configuration = 'musica_configurations/chapman/tuvx/config.json' character(len=250), public :: filename_of_tuvx_micm_mapping_configuration = 'musica_configurations/chapman/tuvx_micm_mapping.json' diff --git a/test/musica/test_musica_api.F90 b/test/musica/test_musica_api.F90 index eb185fbc..6ed8b0e8 100644 --- a/test/musica/test_musica_api.F90 +++ b/test/musica/test_musica_api.F90 @@ -1,5 +1,6 @@ program run_test_musica_ccpp + use ccpp_kinds, only: kind_phys use musica_ccpp implicit none @@ -7,6 +8,8 @@ program run_test_musica_ccpp #define ASSERT(x) if (.not.(x)) then; write(*,*) "Assertion failed[", __FILE__, ":", __LINE__, "]: x"; stop 1; endif #define ASSERT_NEAR( a, b, abs_error ) if( (abs(a - b) >= abs_error) .and. (abs(a - b) /= 0.0) ) then; write(*,*) "Assertion failed[", __FILE__, ":", __LINE__, "]: a, b"; stop 1; endif + real(kind_phys), parameter :: DEGREE_TO_RADIAN = 3.14159265358979323846_kind_phys / 180.0_kind_phys + call test_chapman() call test_terminator() @@ -133,8 +136,6 @@ end subroutine get_wavelength_edges !> Tests the Chapman chemistry scheme subroutine test_chapman() - use musica_micm, only: Rosenbrock, RosenbrockStandardOrder - use ccpp_kinds, only: kind_phys use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t use musica_ccpp_micm, only: micm @@ -153,7 +154,6 @@ subroutine test_chapman() integer, parameter :: NUM_LAYERS = 2 integer, parameter :: NUM_WAVELENGTH_BINS = 102 integer :: NUM_GRID_CELLS = NUM_COLUMNS * NUM_LAYERS - integer :: solver_type = Rosenbrock integer :: errcode character(len=512) :: errmsg real(kind_phys) :: time_step = 60._kind_phys ! s @@ -176,6 +176,8 @@ subroutine test_chapman() NUM_SPECIES+NUM_TUVX_CONSTITUENTS) :: constituents ! kg kg-1 real(kind_phys), dimension(NUM_COLUMNS,NUM_LAYERS, & NUM_SPECIES+NUM_TUVX_CONSTITUENTS) :: initial_constituents ! kg kg-1 + real(kind_phys), dimension(NUM_COLUMNS) :: solar_zenith_angle ! radians + real(kind_phys) :: earth_sun_distance ! AU type(ccpp_constituent_prop_ptr_t), allocatable :: constituent_props_ptr(:) type(ccpp_constituent_properties_t), allocatable, target :: constituent_props(:) type(ccpp_constituent_properties_t), pointer :: const_prop @@ -188,7 +190,6 @@ subroutine test_chapman() real(kind_phys) :: total_O, total_O_init call get_wavelength_edges(photolysis_wavelength_grid_interfaces) - solver_type = Rosenbrock time_step = 60._kind_phys geopotential_height_wrt_surface_at_midpoint(1,:) = (/ 2000.0_kind_phys, 500.0_kind_phys /) geopotential_height_wrt_surface_at_midpoint(2,:) = (/ 2000.0_kind_phys, -500.0_kind_phys /) @@ -214,12 +215,14 @@ subroutine test_chapman() cloud_area_fraction(:,2) = (/ 0.3_kind_phys, 0.4_kind_phys /) air_pressure_thickness(:,1) = (/ 900.0_kind_phys, 905.0_kind_phys /) air_pressure_thickness(:,2) = (/ 910.0_kind_phys, 915.0_kind_phys /) + solar_zenith_angle = (/ 0.0_kind_phys, 2.1_kind_phys /) + earth_sun_distance = 1.04_kind_phys filename_of_micm_configuration = 'musica_configurations/chapman/micm/config.json' filename_of_tuvx_configuration = 'musica_configurations/chapman/tuvx/config.json' filename_of_tuvx_micm_mapping_configuration = 'musica_configurations/chapman/tuvx_micm_mapping.json' - call musica_ccpp_register(solver_type, NUM_GRID_CELLS, constituent_props, errmsg, errcode) + call musica_ccpp_register(constituent_props, errmsg, errcode) if (errcode /= 0) then write(*,*) trim(errmsg) stop 3 @@ -261,7 +264,7 @@ subroutine test_chapman() call constituent_props_ptr(i)%set(const_prop, errcode, errmsg) end do - call musica_ccpp_init(NUM_LAYERS, NUM_LAYERS+1, photolysis_wavelength_grid_interfaces, & + call musica_ccpp_init(NUM_COLUMNS, NUM_LAYERS, NUM_LAYERS+1, photolysis_wavelength_grid_interfaces, & constituent_props_ptr, errmsg, errcode) if (errcode /= 0) then write(*,*) trim(errmsg) @@ -315,9 +318,11 @@ subroutine test_chapman() call musica_ccpp_run( time_step, temperature, pressure, dry_air_density, constituent_props_ptr, & constituents, geopotential_height_wrt_surface_at_midpoint, & geopotential_height_wrt_surface_at_interface, surface_geopotential, & - surface_temperature, surface_albedo, num_photolysis_wavelength_grid_sections, & + surface_temperature, surface_albedo, & flux_data_photolysis_wavelength_interfaces, extraterrestrial_flux, & - standard_gravitational_acceleration, cloud_area_fraction, air_pressure_thickness, errmsg, errcode ) + standard_gravitational_acceleration, cloud_area_fraction, & + air_pressure_thickness, solar_zenith_angle, earth_sun_distance, errmsg, & + errcode ) if (errcode /= 0) then write(*,*) trim(errmsg) stop 3 @@ -354,6 +359,11 @@ subroutine test_chapman() ASSERT_NEAR(total_O, total_O_init, 1.0e-13) end do end do + do j = 1, NUM_LAYERS + ! O and O1D should be lower in the nighttime column + ASSERT(constituents(2,j,O_index) < constituents(1,j,O_index)) + ASSERT(constituents(2,j,O1D_index) < constituents(1,j,O1D_index)) + end do deallocate(constituent_props_ptr) @@ -361,8 +371,6 @@ end subroutine test_chapman !> Tests the simple Terminator chemistry scheme subroutine test_terminator() - use musica_micm, only: Rosenbrock, RosenbrockStandardOrder - use ccpp_kinds, only: kind_phys use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t use musica_ccpp_micm, only: micm @@ -381,7 +389,6 @@ subroutine test_terminator() integer, parameter :: NUM_LAYERS = 2 integer, parameter :: NUM_WAVELENGTH_BINS = 102 integer :: NUM_GRID_CELLS = NUM_COLUMNS * NUM_LAYERS - integer :: solver_type = Rosenbrock integer :: errcode character(len=512) :: errmsg real(kind_phys) :: time_step = 60._kind_phys ! s @@ -404,6 +411,8 @@ subroutine test_terminator() NUM_SPECIES+NUM_TUVX_CONSTITUENTS) :: constituents ! kg kg-1 real(kind_phys), dimension(NUM_COLUMNS,NUM_LAYERS, & NUM_SPECIES+NUM_TUVX_CONSTITUENTS) :: initial_constituents ! kg kg-1 + real(kind_phys), dimension(NUM_COLUMNS) :: solar_zenith_angle ! radians + real(kind_phys) :: earth_sun_distance ! AU type(ccpp_constituent_prop_ptr_t), allocatable :: constituent_props_ptr(:) type(ccpp_constituent_properties_t), allocatable, target :: constituent_props(:) type(ccpp_constituent_properties_t), pointer :: const_prop @@ -416,7 +425,6 @@ subroutine test_terminator() real(kind_phys) :: total_Cl, total_Cl_init call get_wavelength_edges(photolysis_wavelength_grid_interfaces) - solver_type = Rosenbrock time_step = 60._kind_phys geopotential_height_wrt_surface_at_midpoint(1,:) = (/ 2000.0_kind_phys, 500.0_kind_phys /) geopotential_height_wrt_surface_at_midpoint(2,:) = (/ 2000.0_kind_phys, -500.0_kind_phys /) @@ -442,12 +450,14 @@ subroutine test_terminator() cloud_area_fraction(:,2) = (/ 0.3_kind_phys, 0.4_kind_phys /) air_pressure_thickness(:,1) = (/ 900.0_kind_phys, 905.0_kind_phys /) air_pressure_thickness(:,2) = (/ 910.0_kind_phys, 915.0_kind_phys /) + solar_zenith_angle = (/ 0.0_kind_phys, 2.1_kind_phys /) + earth_sun_distance = 1.04_kind_phys filename_of_micm_configuration = 'musica_configurations/terminator/micm/config.json' filename_of_tuvx_configuration = 'musica_configurations/terminator/tuvx/config.json' filename_of_tuvx_micm_mapping_configuration = 'musica_configurations/terminator/tuvx_micm_mapping.json' - call musica_ccpp_register(solver_type, NUM_GRID_CELLS, constituent_props, errmsg, errcode) + call musica_ccpp_register(constituent_props, errmsg, errcode) if (errcode /= 0) then write(*,*) trim(errmsg) stop 3 @@ -486,7 +496,7 @@ subroutine test_terminator() call constituent_props_ptr(i)%set(const_prop, errcode, errmsg) end do - call musica_ccpp_init(NUM_LAYERS, NUM_LAYERS+1, photolysis_wavelength_grid_interfaces, & + call musica_ccpp_init(NUM_COLUMNS, NUM_LAYERS, NUM_LAYERS+1, photolysis_wavelength_grid_interfaces, & constituent_props_ptr, errmsg, errcode) if (errcode /= 0) then write(*,*) trim(errmsg) @@ -531,9 +541,11 @@ subroutine test_terminator() call musica_ccpp_run( time_step, temperature, pressure, dry_air_density, constituent_props_ptr, & constituents, geopotential_height_wrt_surface_at_midpoint, & geopotential_height_wrt_surface_at_interface, surface_geopotential, & - surface_temperature, surface_albedo, num_photolysis_wavelength_grid_sections, & + surface_temperature, surface_albedo, & flux_data_photolysis_wavelength_interfaces, extraterrestrial_flux, & - standard_gravitational_acceleration, cloud_area_fraction, air_pressure_thickness, errmsg, errcode ) + standard_gravitational_acceleration, cloud_area_fraction, & + air_pressure_thickness, solar_zenith_angle, earth_sun_distance, errmsg, & + errcode ) if (errcode /= 0) then write(*,*) trim(errmsg) stop 3 @@ -564,6 +576,12 @@ subroutine test_terminator() ASSERT_NEAR(constituents(i,j,NUM_SPECIES+1), initial_constituents(i,j,NUM_SPECIES+1), 1.0e-13) end do end do + do j = 1, NUM_LAYERS + ! Cl should be lower in the nighttime column + ASSERT(constituents(2,j,Cl_index) < constituents(1,j,Cl_index)) + ! Cl2 should be higher in the nighttime column + ASSERT(constituents(2,j,Cl2_index) > constituents(1,j,Cl2_index)) + end do deallocate(constituent_props_ptr) diff --git a/test/musica/tuvx/CMakeLists.txt b/test/musica/tuvx/CMakeLists.txt index 7e0b782d..a636ec8f 100644 --- a/test/musica/tuvx/CMakeLists.txt +++ b/test/musica/tuvx/CMakeLists.txt @@ -151,6 +151,7 @@ target_sources(test_tuvx_cloud_optics ${MUSICA_SRC_PATH}/tuvx/musica_ccpp_tuvx_wavelength_grid.F90 ${MUSICA_SRC_PATH}/tuvx/musica_ccpp_tuvx_cloud_optics.F90 ${MUSICA_SRC_PATH}/musica_ccpp_util.F90 + ${TO_BE_CCPPIZED_SRC_PATH}/ccpp_tuvx_utils.F90 ${CCPP_TEST_SRC_PATH}/ccpp_kinds.F90 ) diff --git a/test/musica/tuvx/test_tuvx_extraterrestrial_flux.F90 b/test/musica/tuvx/test_tuvx_extraterrestrial_flux.F90 index 8a652027..dcb94696 100644 --- a/test/musica/tuvx/test_tuvx_extraterrestrial_flux.F90 +++ b/test/musica/tuvx/test_tuvx_extraterrestrial_flux.F90 @@ -48,8 +48,7 @@ subroutine test_update_extraterrestrial_flux() ASSERT(errcode == 0) ASSERT(associated(profile)) - call set_extraterrestrial_flux_values( profile, NUM_PHOTOLYSIS_WAVELENGTH_GRID_SECTIONS, & - photolysis_wavelength_grid_interfaces, & + call set_extraterrestrial_flux_values( profile, photolysis_wavelength_grid_interfaces, & extraterrestrial_flux, errmsg, errcode ) ASSERT(errcode == 0)