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

Simplify deallocation of multiple objects associated with the TUV-x #156

Draft
wants to merge 17 commits into
base: development
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion schemes/musica/micm/musica_ccpp_micm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ subroutine micm_run(time_step, temperature, pressure, dry_air_density, &
type(string_t) :: solver_state
type(solver_stats_t) :: solver_stats
type(error_t) :: error
integer :: i_elem

call micm%solve(real(time_step, kind=c_double), &
c_loc(temperature), &
Expand Down
34 changes: 21 additions & 13 deletions schemes/musica/musica_ccpp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ end subroutine musica_ccpp_init
!! The standard name for the variable 'surface_temperature' is
!! 'blackbody_temperature_at_surface' because this is what we have as
!! the standard name for 'cam_in%ts', whcih represents the same quantity.
subroutine musica_ccpp_run(time_step, temperature, pressure, dry_air_density, constituent_props, &
constituents, geopotential_height_wrt_surface_at_midpoint, &
geopotential_height_wrt_surface_at_interface, surface_temperature, &
surface_geopotential, surface_albedo, &
subroutine musica_ccpp_run(time_step, temperature, pressure, dry_air_density, constituent_props, &
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, errmsg, errcode)
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
use ccpp_kinds, only: kind_phys
Expand All @@ -74,9 +76,12 @@ subroutine musica_ccpp_run(time_step, temperature, pressure, dry_air_density, co
real(kind_phys), target, intent(inout) :: constituents(:,:,:) ! kg kg-1
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_temperature(:) ! K
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
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errcode
Expand All @@ -89,13 +94,16 @@ subroutine musica_ccpp_run(time_step, temperature, pressure, dry_air_density, co
integer :: i_elem

! Calculate photolysis rate constants using TUV-x
call tuvx_run(temperature, dry_air_density, &
geopotential_height_wrt_surface_at_midpoint, &
geopotential_height_wrt_surface_at_interface, &
surface_temperature, surface_geopotential, &
surface_albedo, &
standard_gravitational_acceleration, &
rate_parameters, &
call tuvx_run(temperature, dry_air_density, &
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, &
rate_parameters, &
errmsg, errcode)

! Get the molar mass that is set in the call to instantiate()
Expand Down Expand Up @@ -140,4 +148,4 @@ subroutine musica_ccpp_final(errmsg, errcode)

end subroutine musica_ccpp_final

end module musica_ccpp
end module musica_ccpp
30 changes: 24 additions & 6 deletions schemes/musica/musica_ccpp.meta
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,42 @@
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent,vertical_interface_dimension)
intent = in
[ surface_temperature ]
standard_name = blackbody_temperature_at_surface
type = real | kind = kind_phys
units = K
dimensions = (horizontal_loop_extent)
intent = in
[ surface_geopotential ]
standard_name = surface_geopotential
type = real | kind = kind_phys
units = m2 s-2
dimensions = (horizontal_loop_extent)
intent = in
[ surface_temperature ]
standard_name = blackbody_temperature_at_surface
type = real | kind = kind_phys
units = K
dimensions = (horizontal_loop_extent)
intent = in
[ 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
dimensions = ()
intent = in
[ photolysis_wavelength_grid_interfaces ]
standard_name = photolysis_wavelength_grid_interfaces
type = real | kind = kind_phys
units = nm
dimensions = (horizontal_loop_extent)
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)
intent = in
[ standard_gravitational_acceleration ]
standard_name = standard_gravitational_acceleration
units = m s-2
Expand Down
Loading