Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for TEMPO in CCPP #6

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions drivers/ccpp/mp_tempo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ subroutine mp_tempo_init(ncol, nlev, con_g, con_rd, con_eps, &
nc, nwfa2d, nifa2d, &
nwfa, nifa, tgrs, prsl, phil, area, &
aerfld, mpicomm, mpirank, mpiroot, &
threads, ext_diag, diag3d, &
threads, diag3d, &
errmsg, errflg)

implicit none
Expand Down Expand Up @@ -92,8 +92,7 @@ subroutine mp_tempo_init(ncol, nlev, con_g, con_rd, con_eps, &
! Threading/blocking information
integer, intent(in ) :: threads
! Extended diagnostics
logical, intent(in ) :: ext_diag
real(kind_phys), intent(in ) :: diag3d(:,:,:)
real(kind_phys), intent(in ),optional :: diag3d(:,:,:)
! CCPP error handling
character(len=*), intent( out) :: errmsg
integer, intent( out) :: errflg
Expand Down Expand Up @@ -121,7 +120,7 @@ subroutine mp_tempo_init(ncol, nlev, con_g, con_rd, con_eps, &
return
end if

if (ext_diag) then
if (present(diag3d)) then
if (size(diag3d,dim=3) /= ext_ndiag3d) then
write(errmsg,'(*(a))') "Logic error: number of diagnostic 3d arrays from model does not match requirements"
errflg = 1
Expand Down Expand Up @@ -351,7 +350,7 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
max_hail_diam_sfc, &
do_radar_ref, aerfld, &
mpicomm, mpirank, mpiroot, blkno, &
ext_diag, diag3d, reset_diag3d, &
diag3d, reset_diag3d, &
spp_wts_mp, spp_mp, n_var_spp, &
spp_prt_list, spp_var_list, &
spp_stddev_cutoff, &
Expand Down Expand Up @@ -419,8 +418,7 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
integer, intent(in) :: mpirank
integer, intent(in) :: mpiroot
! Extended diagnostic output
logical, intent(in) :: ext_diag
real(kind_phys), target, intent(inout) :: diag3d(:,:,:)
real(kind_phys), target, intent(inout), optional :: diag3d(:,:,:)
logical, intent(in) :: reset_diag3d

! CCPP error handling
Expand Down Expand Up @@ -667,7 +665,7 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
end if

! Set pointers for extended diagnostics
set_extended_diagnostic_pointers: if (ext_diag) then
set_extended_diagnostic_pointers: if (present(diag3d)) then
if (reset_diag3d) then
diag3d = 0.0
end if
Expand Down Expand Up @@ -738,7 +736,7 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
fullradar_diag=fullradar_diag, istep=istep, nsteps=nsteps, &
first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, &
! Extended diagnostics
ext_diag=ext_diag, &
ext_diag=present(diag3d), &
! vts1=vts1, txri=txri, txrc=txrc, &
prw_vcdc=prw_vcdc, &
prw_vcde=prw_vcde, tpri_inu=tpri_inu, tpri_ide_d=tpri_ide_d, &
Expand Down Expand Up @@ -780,7 +778,7 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
fullradar_diag=fullradar_diag, istep=istep, nsteps=nsteps, &
first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, &
! Extended diagnostics
ext_diag=ext_diag, &
ext_diag=present(diag3d), &
! vts1=vts1, txri=txri, txrc=txrc, &
prw_vcdc=prw_vcdc, &
prw_vcde=prw_vcde, tpri_inu=tpri_inu, tpri_ide_d=tpri_ide_d, &
Expand Down Expand Up @@ -821,7 +819,7 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
fullradar_diag=fullradar_diag, istep=istep, nsteps=nsteps, &
first_time_step=first_time_step, errmsg=errmsg, errflg=errflg, &
! Extended diagnostics
ext_diag=ext_diag, &
ext_diag=present(diag3d), &
! vts1=vts1, txri=txri, txrc=txrc, &
prw_vcdc=prw_vcdc, &
prw_vcde=prw_vcde, tpri_inu=tpri_inu, tpri_ide_d=tpri_ide_d, &
Expand Down Expand Up @@ -888,7 +886,7 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
pfl_lsan(:,:) = pflls(:,:,1)
end if

unset_extended_diagnostic_pointers: if (ext_diag) then
unset_extended_diagnostic_pointers: if (present(diag3d)) then
!vts1 => null()
!txri => null()
!txrc => null()
Expand Down
39 changes: 25 additions & 14 deletions drivers/ccpp/mp_tempo.meta
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[ni]
standard_name = mass_number_concentration_of_cloud_ice_water_crystals_in_air
long_name = ice number concentration
Expand Down Expand Up @@ -187,6 +188,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[nwfa2d]
standard_name = tendency_of_hygroscopic_aerosols_at_surface_adjacent_layer
long_name = instantaneous fake water-friendly surface aerosol source
Expand All @@ -195,6 +197,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[nifa2d]
standard_name = tendency_of_nonhygroscopic_ice_nucleating_aerosols_at_surface_adjacent_layer
long_name = instantaneous fake ice-friendly surface aerosol source
Expand All @@ -203,6 +206,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[nwfa]
standard_name = mass_number_concentration_of_hygroscopic_aerosols
long_name = number concentration of water-friendly aerosols
Expand All @@ -211,6 +215,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[nifa]
standard_name = mass_number_concentration_of_nonhygroscopic_ice_nucleating_aerosols
long_name = number concentration of ice-friendly aerosols
Expand All @@ -219,6 +224,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[tgrs]
standard_name = air_temperature
long_name = model layer mean temperature
Expand Down Expand Up @@ -287,13 +293,6 @@
dimensions = ()
type = integer
intent = in
[ext_diag]
standard_name = flag_for_extended_diagnostic_output_from_thompson_microphysics
long_name = flag for extended diagnostic output from thompson microphysics
units = flag
dimensions = ()
type = logical
intent = in
[diag3d]
standard_name = extended_diagnostics_output_from_thompson_microphysics
long_name = set of 3d arrays for extended diagnostics output from thompson microphysics
Expand All @@ -302,6 +301,7 @@
type = real
kind = kind_phys
intent = in
optional = True
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down Expand Up @@ -431,6 +431,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[ni]
standard_name = mass_number_concentration_of_cloud_ice_water_crystals_in_air_of_new_state
long_name = ice number concentration
Expand Down Expand Up @@ -476,6 +477,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[nwfa]
standard_name = mass_number_concentration_of_hygroscopic_aerosols_of_new_state
long_name = number concentration of water-friendly aerosols
Expand All @@ -484,6 +486,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[nifa]
standard_name = mass_number_concentration_of_nonhygroscopic_ice_nucleating_aerosols_of_new_state
long_name = number concentration of ice-friendly aerosols
Expand All @@ -492,6 +495,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[nwfa2d]
standard_name = tendency_of_hygroscopic_aerosols_at_surface_adjacent_layer
long_name = instantaneous fake water-friendly surface aerosol source
Expand All @@ -500,6 +504,7 @@
type = real
kind = kind_phys
intent = in
optional = True
[nifa2d]
standard_name = tendency_of_nonhygroscopic_ice_nucleating_aerosols_at_surface_adjacent_layer
long_name = instantaneous fake ice-friendly surface aerosol source
Expand All @@ -508,13 +513,15 @@
type = real
kind = kind_phys
intent = in
optional = True
[aero_ind_fdb]
standard_name = do_smoke_aerosol_indirect_feedback
long_name = flag for wfa ifa emission indirect feedback
units = flag
dimensions = ()
type = logical
intent = in
optional = True
[tgrs]
standard_name = air_temperature_of_new_state
long_name = model layer mean temperature
Expand Down Expand Up @@ -621,6 +628,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[graupel]
standard_name = lwe_thickness_of_graupel_amount
long_name = graupel fall on physics timestep
Expand All @@ -629,6 +637,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[ice]
standard_name = lwe_thickness_of_ice_amount
long_name = ice fall on physics timestep
Expand All @@ -637,6 +646,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[snow]
standard_name = lwe_thickness_of_snow_amount
long_name = snow fall on physics timestep
Expand All @@ -645,6 +655,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[sr]
standard_name = ratio_of_snowfall_to_rainfall
long_name = ratio of snowfall to large-scale rainfall
Expand Down Expand Up @@ -719,13 +730,6 @@
dimensions = ()
type = integer
intent = in
[ext_diag]
standard_name = flag_for_extended_diagnostic_output_from_thompson_microphysics
long_name = flag for extended diagnostic output from thompson microphysics
units = flag
dimensions = ()
type = logical
intent = in
[diag3d]
standard_name = extended_diagnostics_output_from_thompson_microphysics
long_name = set of 3d arrays for extended diagnostics output from thompson microphysics
Expand All @@ -734,6 +738,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[reset_diag3d]
standard_name = flag_reset_extended_diagnostics_output_arrays_from_thompson_microphysics
long_name = flag for resetting extended diagnostics output arrays from thompson microphysics
Expand All @@ -748,6 +753,7 @@
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
intent = in
optional = True
[spp_mp]
standard_name = control_for_microphysics_spp_perturbations
long_name = control for microphysics spp perturbations
Expand All @@ -770,6 +776,7 @@
type = real
kind = kind_phys
intent = in
optional = True
[spp_stddev_cutoff]
standard_name = magnitude_of_spp_standard_deviation_cutoff
long_name = magnitude of spp standard deviation cutoff
Expand All @@ -778,6 +785,7 @@
type = real
kind = kind_phys
intent = in
optional = True
[spp_var_list]
standard_name = perturbed_spp_schemes
long_name = perturbed spp schemes
Expand All @@ -786,6 +794,7 @@
type = character
kind = len=10
intent = in
optional = True
[cplchm]
standard_name = flag_for_chemistry_coupling
long_name = flag controlling cplchm collection (default off)
Expand All @@ -801,6 +810,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[pfl_lsan]
standard_name = liquid_flux_due_to_large_scale_precipitation
long_name = instantaneous 3D flux of liquid water from nonconvective precipitation
Expand All @@ -809,6 +819,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
2 changes: 1 addition & 1 deletion module_mp_thompson_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ subroutine mp_thompson_main(qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, qb1d, ni1d, nr1d
! Extended diagnostics, most arrays only allocated if ext_diag is true
logical, intent(in) :: ext_diag
logical, intent(in) :: sedi_semi
real(wp), dimension(:), intent(out) :: &
real(wp), optional, dimension(:), intent(out) :: &
prw_vcdc1, &
prw_vcde1, tpri_inu1, tpri_ide1_d, &
tpri_ide1_s, tprs_ide1, &
Expand Down
8 changes: 4 additions & 4 deletions module_mp_thompson_params.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module module_mp_thompson_params
!=================================================================================================================
! Parameters needed first by thompson_init()

#if defined(original_mp)
#if defined(OLD_MPTBLS)
logical, parameter :: original_thompson = .true.
#else
logical, parameter :: original_thompson = .false.
Expand Down Expand Up @@ -165,7 +165,7 @@ module module_mp_thompson_params
integer, parameter :: ntb_t = 9
integer, parameter :: ntb_g1 = 37

#if defined(ccpp_default) && defined(original_mp)
#if defined(ccpp_default) && defined(OLD_MPTBLS)
integer, parameter :: ntb_s = 28
integer, parameter :: ntb_g = 28
#else
Expand Down Expand Up @@ -228,7 +228,7 @@ module module_mp_thompson_params
1.e5,2.e5,3.e5,4.e5,5.e5,6.e5,7.e5,8.e5,9.e5, &
1.e6/)

#if defined(ccpp_default) && defined(original_mp)
#if defined(ccpp_default) && defined(OLD_MPTBLS)
! Lookup tables for graupel content (kg/m**3).
real(wp), dimension(ntb_g), parameter :: &
r_g = (/1.e-5,2.e-5,3.e-5,4.e-5,5.e-5,6.e-5,7.e-5,8.e-5,9.e-5, &
Expand Down Expand Up @@ -314,7 +314,7 @@ module module_mp_thompson_params
real(wp) :: oams, obms, ocms
real(wp), dimension(12,NRHG) :: cge, cgg
real(wp), dimension(NRHG) :: oamg, ocmg
#if defined(ccpp_default) && defined(original_mp)
#if defined(ccpp_default) && defined(OLD_MPTBLS)
real, dimension(18) :: cse, csg
#else
real(wp), dimension(17) :: cse, csg
Expand Down
Loading