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

Add calls to CCPP-compliant physics, cleanup and optimize 2018/08/17 #144

Merged
66 changes: 56 additions & 10 deletions physics/GFS_suite_interstitial.F90
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,63 @@ end subroutine GFS_suite_interstitial_2_run
end module GFS_suite_interstitial_2


module GFS_suite_update_stateout
module GFS_suite_stateout_reset

contains

subroutine GFS_suite_update_stateout_init ()
end subroutine GFS_suite_update_stateout_init
subroutine GFS_suite_stateout_reset_init ()
end subroutine GFS_suite_stateout_reset_init

subroutine GFS_suite_update_stateout_finalize()
end subroutine GFS_suite_update_stateout_finalize
subroutine GFS_suite_stateout_reset_finalize()
end subroutine GFS_suite_stateout_reset_finalize

!> \section arg_table_GFS_suite_update_stateout_run Argument Table
!> \section arg_table_GFS_suite_stateout_reset_run Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|--------------------------------------------------------------|-----------------------------------------------------------------------|---------------|------|-------------------|-----------|--------|----------|
!! | Statein | FV3-GFS_Statein_type | Fortran DDT containing FV3-GFS prognostic state data in from dycore | DDT | 0 | GFS_statein_type | | in | F |
!! | Stateout | FV3-GFS_Stateout_type | Fortran DDT containing FV3-GFS prognostic state to return to dycore | DDT | 0 | GFS_stateout_type | | inout | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_suite_stateout_reset_run (Statein, Stateout, errmsg, errflg)

use machine, only: kind_phys
use GFS_typedefs, only: GFS_statein_type, GFS_stateout_type

implicit none

! interface variables
type(GFS_statein_type), intent(in) :: Statein
type(GFS_stateout_type), intent(inout) :: Stateout

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

Stateout%gt0(:,:) = Statein%tgrs(:,:)
Stateout%gu0(:,:) = Statein%ugrs(:,:)
Stateout%gv0(:,:) = Statein%vgrs(:,:)
Stateout%gq0(:,:,:) = Statein%qgrs(:,:,:)

end subroutine GFS_suite_stateout_reset_run

end module GFS_suite_stateout_reset


module GFS_suite_stateout_update

contains

subroutine GFS_suite_stateout_update_init ()
end subroutine GFS_suite_stateout_update_init

subroutine GFS_suite_stateout_update_finalize()
end subroutine GFS_suite_stateout_update_finalize

!> \section arg_table_GFS_suite_stateout_update_run Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|--------------------------------------------------------------|-----------------------------------------------------------------------|---------------|------|-------------------|-----------|--------|----------|
!! | Statein | FV3-GFS_Statein_type | Fortran DDT containing FV3-GFS prognostic state data in from dycore | DDT | 0 | GFS_statein_type | | in | F |
Expand All @@ -313,7 +359,7 @@ end subroutine GFS_suite_update_stateout_finalize
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_suite_update_stateout_run (Statein, Model, Grid, dudt, dvdt, dtdt, dqdt, Stateout, errmsg, errflg)
subroutine GFS_suite_stateout_update_run (Statein, Model, Grid, dudt, dvdt, dtdt, dqdt, Stateout, errmsg, errflg)

use machine, only: kind_phys
use GFS_typedefs, only: GFS_control_type, GFS_statein_type, GFS_grid_type, GFS_stateout_type
Expand All @@ -330,7 +376,7 @@ subroutine GFS_suite_update_stateout_run (Statein, Model, Grid, dudt, dvdt, dtdt
real(kind=kind_phys), dimension(size(Grid%xlon,1), Model%levs, Model%ntrac), intent(in) :: dqdt

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
integer, intent(out) :: errflg

! Initialize CCPP error handling variables
errmsg = ''
Expand All @@ -341,9 +387,9 @@ subroutine GFS_suite_update_stateout_run (Statein, Model, Grid, dudt, dvdt, dtdt
Stateout%gv0(:,:) = Statein%vgrs(:,:) + dvdt(:,:) * Model%dtp
Stateout%gq0(:,:,:) = Statein%qgrs(:,:,:) + dqdt(:,:,:) * Model%dtp

end subroutine GFS_suite_update_stateout_run
end subroutine GFS_suite_stateout_update_run

end module GFS_suite_update_stateout
end module GFS_suite_stateout_update


module GFS_suite_interstitial_3
Expand Down
4 changes: 2 additions & 2 deletions physics/GFS_surface_generic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ end subroutine GFS_surface_generic_post_finalize
!! | ep1d | surface_upward_potential_latent_heat_flux | surface upward potential latent heat flux | W m-2 | 1 | real | kind_phys | in | F |
!! | gflx | upward_heat_flux_in_soil | upward soil heat flux | W m-2 | 1 | real | kind_phys | in | F |
!! | tgrs_1 | air_temperature_at_lowest_model_layer | mean temperature at lowest model layer | K | 1 | real | kind_phys | in | F |
!! | qgrs_1 | specific_humidity_at_lowest_model_layer | specific humidity at lowest model layer | kg kg-1 | 1 | real | kind_phys | in | F |
!! | qgrs_1 | water_vapor_specific_humidity_at_lowest_model_layer | specific humidity at lowest model layer | kg kg-1 | 1 | real | kind_phys | in | F |
!! | ugrs_1 | x_wind_at_lowest_model_layer | zonal wind at lowest model layer | m s-1 | 1 | real | kind_phys | in | F |
!! | vgrs_1 | y_wind_at_lowest_model_layer | meridional wind at lowest model layer | m s-1 | 1 | real | kind_phys | in | F |
!! | adjsfcdlw | surface_downwelling_longwave_flux | surface downwelling longwave flux at current time | W m-2 | 1 | real | kind_phys | in | F |
Expand Down Expand Up @@ -176,7 +176,7 @@ end subroutine GFS_surface_generic_post_finalize
!! | epi | instantaneous_surface_potential_evaporation | instantaneous sfc potential evaporation | W m-2 | 1 | real | kind_phys | inout | F |
!! | gfluxi | instantaneous_surface_ground_heat_flux | instantaneous sfc ground heat flux | W m-2 | 1 | real | kind_phys | inout | F |
!! | t1 | air_temperature_at_lowest_model_layer_for_diag | layer 1 temperature for diag | K | 1 | real | kind_phys | inout | F |
!! | q1 | specific_humidity_at_lowest_model_layer_for_diag | layer 1 specific humidity for diag | kg kg-1 | 1 | real | kind_phys | inout | F |
!! | q1 | water_vapor_specific_humidity_at_lowest_model_layer_for_diag | layer 1 specific humidity for diag | kg kg-1 | 1 | real | kind_phys | inout | F |
!! | u1 | x_wind_at_lowest_model_layer_for_diag | layer 1 x wind for diag | m s-1 | 1 | real | kind_phys | inout | F |
!! | v1 | y_wind_at_lowest_model_layer_for_diag | layer 1 y wind for diag | m s-1 | 1 | real | kind_phys | inout | F |
!! | dlwsfci_cpl | instantaneous_surface_downwelling_longwave_flux_for_coupling | instantaneous sfc downward lw flux | W m-2 | 1 | real | kind_phys | inout | F |
Expand Down
2 changes: 1 addition & 1 deletion physics/gmtb_scm_sfc_flux_spec.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end subroutine gmtb_scm_sfc_flux_spec_finalize
!! | v1 | y_wind_at_lowest_model_layer | y component of 1st model layer wind | m s-1 | 1 | real | kind_phys | in | F |
!! | z1 | height_above_ground_at_lowest_model_layer | height above ground at 1st model layer | m | 1 | real | kind_phys | in | F |
!! | t1 | air_temperature_at_lowest_model_layer | 1st model layer air temperature | K | 1 | real | kind_phys | in | F |
!! | q1 | specific_humidity_at_lowest_model_layer | 1st model layer specific humidity | kg kg-1 | 1 | real | kind_phys | in | F |
!! | q1 | water_vapor_specific_humidity_at_lowest_model_layer | 1st model layer specific humidity | kg kg-1 | 1 | real | kind_phys | in | F |
!! | p1 | air_pressure_at_lowest_model_layer | Model layer 1 mean pressure | Pa | 1 | real | kind_phys | in | F |
!! | roughness_length | surface_roughness_length | surface roughness length | cm | 1 | real | kind_phys | in | F |
!! | spec_sh_flux | specified_kinematic_surface_upward_sensible_heat_flux | specified kinematic surface upward sensible heat flux | K m s-1 | 1 | real | kind_phys | in | F |
Expand Down
5 changes: 2 additions & 3 deletions physics/h2ophys.f
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ end subroutine h2ophys_init
!! | h2opltc | h2o_forcing | water forcing data | various | 3 | real | kind_phys | in | F |
!! | h2o_coeff | number_of_coefficients_in_h2o_forcing_data | number of coefficients in h2o forcing data | index | 0 | integer | | in | F |
!! | ldiag3d | flag_diagnostics_3D | flag for calculating 3-D diagnostic fields | flag | 0 | logical | | in | F |
!! | h2op | change_in_h2o_concentration | change in h2o concentration | kg kg-1 | 3 | real | kind_phys | inout | F |
!! | me | mpi_rank | rank of the current MPI task | index | 0 | integer | | in | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
!! \section genal_h2ophys GFS H2O Physics Scheme General Algorithm
!> @{
subroutine h2ophys_run(ix, im, levs, kh2o, dt, h2o, ph2o, prsl,
& h2opltc, h2o_coeff, ldiag3d, h2op, me,
& h2opltc, h2o_coeff, ldiag3d, me,
& errmsg, errflg)
!
! May 2015 - Shrinivas Moorthi - Adaptation of NRL H2O physics for
Expand All @@ -57,7 +56,7 @@ subroutine h2ophys_run(ix, im, levs, kh2o, dt, h2o, ph2o, prsl,
real(kind=kind_phys), intent(in) :: prsl(ix,levs)
real(kind=kind_phys), intent(in) :: h2opltc(ix,kh2o,h2o_coeff)
logical , intent(in) :: ldiag3d
real(kind=kind_phys), intent(inout) :: h2op(ix,levs,h2o_coeff)
!real(kind=kind_phys), intent(inout) :: h2op(ix,levs,h2o_coeff)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
! local variables
Expand Down
95 changes: 0 additions & 95 deletions physics/ozphys.f
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
!> \file ozphys.f
!! This file is ozone sources and sinks.

! \defgroup GFS_ozn GFS Ozone Physics
!
module ozphys_pre
contains

!> \section arg_table_ozphys_pre_init Argument Table
!!
subroutine ozphys_pre_init()
end subroutine ozphys_pre_init


!> \section arg_table_ozphys_pre_run Argument Table
!!
subroutine ozphys_pre_run()
end subroutine ozphys_pre_run


!> \section arg_table_ozphys_pre_finalize Argument Table
!!
subroutine ozphys_pre_finalize()
end subroutine ozphys_pre_finalize

end module ozphys_pre


module ozphys

contains
Expand Down Expand Up @@ -213,70 +185,3 @@ subroutine ozphys_finalize()
end subroutine ozphys_finalize

end module ozphys


module ozphys_post

contains

!> \section arg_table_ozphys_post_init Argument Table
!!
subroutine ozphys_post_init()
end subroutine ozphys_post_init


#if 0
! DH* TODO - split dq3dt into individual components? Or replace Interstitial%dq3dt_loc(:,:,1:) / dq3dt_loc(:,:,1:)
! in GFS_physics_driver entirely with Diag%dq3dt(:,:,6:) ? *DH
!! \section arg_table_ozphys_post_run Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|-------------------------------------------------------------------|-------------------------------------------------------------------|---------|------|---------------|-----------|--------|----------|
!! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F |
!! | levs | vertical_dimension | number of vertical layers | count | 0 | integer | | in | F |
!! | oz_coeff | number_of_coefficients_in_ozone_forcing_data | number of coefficients in ozone forcing data | index | 0 | integer | | in | F |
!! | ldiag3d | flag_diagnostics_3D | logical flag for 3D diagnostics | flag | 0 | logical | | in | F |
!! | ozp | change_in_ozone_concentration | change in ozone concentration | kg kg-1 | 3 | real | kind_phys | in | F |
!! | dq3dt | cumulative_change_in_water_vapor_specific_humidity_due_to_physics | cumulative change in water vapor specific humidity due to physics | kg kg-1 | 3 | real | kind_phys | inout | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
#endif
subroutine ozphys_post_run(im, levs, oz_coeff, ldiag3d, ozp, &
& dq3dt, errmsg, errflg)

use GFS_typedefs, only: GFS_diag_type
use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs, oz_coeff
logical, intent(in) :: ldiag3d
real(kind=kind_phys), intent(in) :: ozp(im,levs,oz_coeff)
real(kind=kind_phys), intent(inout) :: dq3dt(im,levs,oz_coeff+5)
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

if (ldiag3d) then
dq3dt(:,:,6) = ozp(:,:,1)
dq3dt(:,:,7) = ozp(:,:,2)
dq3dt(:,:,8) = ozp(:,:,3)
dq3dt(:,:,9) = ozp(:,:,4)
end if

return

end subroutine ozphys_post_run


!> \section arg_table_ozphys_post_finalize Argument Table
!!
subroutine ozphys_post_finalize()
end subroutine ozphys_post_finalize


end module ozphys_post

Loading