Skip to content

Commit

Permalink
Expand to test for correct scheme order in caps.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Jan 29, 2025
1 parent ed3c91a commit d73512a
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 10 deletions.
13 changes: 11 additions & 2 deletions test/var_compatibility_test/effr_calc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ module effr_calc
!> \section arg_table_effr_calc_init Argument Table
!! \htmlinclude arg_table_effr_calc_init.html
!!
subroutine effr_calc_init(errmsg, errflg)
subroutine effr_calc_init(scheme_order, errmsg, errflg)
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg

integer, intent(inout) :: scheme_order

errmsg = ''
errflg = 0

if (scheme_order .ne. 2) then
errflg = 1
errmsg = 'ERROR: effr_calc_init() needs to be called second'
return
else
scheme_order = scheme_order + 1
endif

end subroutine effr_calc_init

!> \section arg_table_effr_calc_run Argument Table
Expand Down
7 changes: 7 additions & 0 deletions test/var_compatibility_test/effr_calc.meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
[ccpp-arg-table]
name = effr_calc_init
type = scheme
[ scheme_order ]
standard_name = scheme_order_in_suite
long_name = scheme order in suite definition file
units = None
dimensions = ()
type = integer
intent = inout
[ errmsg ]
standard_name = ccpp_error_message
long_name = Error message for error handling in CCPP
Expand Down
11 changes: 10 additions & 1 deletion test/var_compatibility_test/effr_diag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ module effr_diag
!> \section arg_table_effr_diag_init Argument Table
!! \htmlinclude arg_table_effr_diag_init.html
!!
subroutine effr_diag_init(errmsg, errflg)
subroutine effr_diag_init(scheme_order, errmsg, errflg)
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg
integer, intent(inout) :: scheme_order

errmsg = ''
errflg = 0

if (scheme_order .ne. 4) then
errflg = 1
errmsg = 'ERROR: effr_diag_init() needs to be called fourth'
return
else
scheme_order = scheme_order + 1
endif

end subroutine effr_diag_init

!> \section arg_table_effr_diag_run Argument Table
Expand Down
7 changes: 7 additions & 0 deletions test/var_compatibility_test/effr_diag.meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
[ccpp-arg-table]
name = effr_diag_init
type = scheme
[ scheme_order ]
standard_name = scheme_order_in_suite
long_name = scheme order in suite definition file
units = None
dimensions = ()
type = integer
intent = inout
[ errmsg ]
standard_name = ccpp_error_message
long_name = Error message for error handling in CCPP
Expand Down
11 changes: 10 additions & 1 deletion test/var_compatibility_test/effr_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ module effr_post
!> \section arg_table_effr_post_init Argument Table
!! \htmlinclude arg_table_effr_post_init.html
!!
subroutine effr_post_init(errmsg, errflg)
subroutine effr_post_init(scheme_order, errmsg, errflg)
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg
integer, intent(inout) :: scheme_order

errmsg = ''
errflg = 0

if (scheme_order .ne. 3) then
errflg = 1
errmsg = 'ERROR: effr_post_init() needs to be called third'
return
else
scheme_order = scheme_order + 1
endif

end subroutine effr_post_init

!> \section arg_table_effr_post_run Argument Table
Expand Down
7 changes: 7 additions & 0 deletions test/var_compatibility_test/effr_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
[ccpp-arg-table]
name = effr_post_init
type = scheme
[ scheme_order ]
standard_name = scheme_order_in_suite
long_name = scheme order in suite definition file
units = None
dimensions = ()
type = integer
intent = inout
[ errmsg ]
standard_name = ccpp_error_message
long_name = Error message for error handling in CCPP
Expand Down
11 changes: 10 additions & 1 deletion test/var_compatibility_test/effr_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ module effr_pre
!> \section arg_table_effr_pre_init Argument Table
!! \htmlinclude arg_table_effr_pre_init.html
!!
subroutine effr_pre_init(errmsg, errflg)
subroutine effr_pre_init(scheme_order, errmsg, errflg)
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg
integer, intent(inout) :: scheme_order

errmsg = ''
errflg = 0

if (scheme_order .ne. 1) then
errflg = 1
errmsg = 'ERROR: effr_pre_init() needs to be called first'
return
else
scheme_order = scheme_order + 1
endif

end subroutine effr_pre_init

!> \section arg_table_effr_pre_run Argument Table
Expand Down
7 changes: 7 additions & 0 deletions test/var_compatibility_test/effr_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
[ccpp-arg-table]
name = effr_pre_init
type = scheme
[ scheme_order ]
standard_name = scheme_order_in_suite
long_name = scheme order in suite definition file
units = None
dimensions = ()
type = integer
intent = inout
[ errmsg ]
standard_name = ccpp_error_message
long_name = Error message for error handling in CCPP
Expand Down
3 changes: 3 additions & 0 deletions test/var_compatibility_test/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ required_vars_var_compatibility="${required_vars_var_compatibility},horizontal_d
required_vars_var_compatibility="${required_vars_var_compatibility},horizontal_loop_begin"
required_vars_var_compatibility="${required_vars_var_compatibility},horizontal_loop_end"
required_vars_var_compatibility="${required_vars_var_compatibility},scalar_variable_for_testing"
required_vars_var_compatibility="${required_vars_var_compatibility},scheme_order_in_suite"
required_vars_var_compatibility="${required_vars_var_compatibility},vertical_layer_dimension"
input_vars_var_compatibility="cloud_graupel_number_concentration"
#input_vars_var_compatibility="${input_vars_var_compatibility},cloud_ice_number_concentration"
Expand All @@ -157,6 +158,7 @@ input_vars_var_compatibility="${input_vars_var_compatibility},horizontal_dimensi
input_vars_var_compatibility="${input_vars_var_compatibility},horizontal_loop_begin"
input_vars_var_compatibility="${input_vars_var_compatibility},horizontal_loop_end"
input_vars_var_compatibility="${input_vars_var_compatibility},scalar_variable_for_testing"
input_vars_var_compatibility="${input_vars_var_compatibility},scheme_order_in_suite"
input_vars_var_compatibility="${input_vars_var_compatibility},vertical_layer_dimension"
output_vars_var_compatibility="ccpp_error_code,ccpp_error_message"
output_vars_var_compatibility="${output_vars_var_compatibility},cloud_ice_number_concentration"
Expand All @@ -165,6 +167,7 @@ output_vars_var_compatibility="${output_vars_var_compatibility},effective_radius
output_vars_var_compatibility="${output_vars_var_compatibility},effective_radius_of_stratiform_cloud_rain_particle"
output_vars_var_compatibility="${output_vars_var_compatibility},effective_radius_of_stratiform_cloud_snow_particle"
output_vars_var_compatibility="${output_vars_var_compatibility},scalar_variable_for_testing"
output_vars_var_compatibility="${output_vars_var_compatibility},scheme_order_in_suite"

##
## Run a database report and check the return string
Expand Down
12 changes: 8 additions & 4 deletions test/var_compatibility_test/test_host.F90
Original file line number Diff line number Diff line change
Expand Up @@ -351,27 +351,30 @@ program test

character(len=cs), target :: test_parts1(1) = (/ 'radiation ' /)

character(len=cm), target :: test_invars1(8) = (/ &
character(len=cm), target :: test_invars1(9) = (/ &
'effective_radius_of_stratiform_cloud_rain_particle ', &
'effective_radius_of_stratiform_cloud_liquid_water_particle', &
'effective_radius_of_stratiform_cloud_snow_particle ', &
'effective_radius_of_stratiform_cloud_graupel ', &
'cloud_graupel_number_concentration ', &
'scalar_variable_for_testing ', &
'scheme_order_in_suite ', &
'flag_indicating_cloud_microphysics_has_graupel ', &
'flag_indicating_cloud_microphysics_has_ice '/)

character(len=cm), target :: test_outvars1(8) = (/ &
character(len=cm), target :: test_outvars1(9) = (/ &
'ccpp_error_code ', &
'ccpp_error_message ', &
'effective_radius_of_stratiform_cloud_ice_particle ', &
'effective_radius_of_stratiform_cloud_liquid_water_particle', &
'effective_radius_of_stratiform_cloud_rain_particle ', &
'effective_radius_of_stratiform_cloud_snow_particle ', &
'cloud_ice_number_concentration ', &
'scalar_variable_for_testing ' /)
'scalar_variable_for_testing ', &
'scheme_order_in_suite '/)


character(len=cm), target :: test_reqvars1(12) = (/ &
character(len=cm), target :: test_reqvars1(13) = (/ &
'ccpp_error_code ', &
'ccpp_error_message ', &
'effective_radius_of_stratiform_cloud_rain_particle ', &
Expand All @@ -382,6 +385,7 @@ program test
'cloud_graupel_number_concentration ', &
'cloud_ice_number_concentration ', &
'scalar_variable_for_testing ', &
'scheme_order_in_suite ', &
'flag_indicating_cloud_microphysics_has_graupel ', &
'flag_indicating_cloud_microphysics_has_ice '/)

Expand Down
4 changes: 4 additions & 0 deletions test/var_compatibility_test/test_host_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module test_host_data
ncg, & ! number concentration of cloud graupel
nci ! number concentration of cloud ice
real(kind_phys) :: scalar_var
integer :: scheme_order
end type physics_state

public allocate_physics_state
Expand Down Expand Up @@ -62,6 +63,9 @@ subroutine allocate_physics_state(cols, levels, state, has_graupel, has_ice)
allocate(state%nci(cols, levels))
endif

! Initialize scheme counter.
state%scheme_order = 1

end subroutine allocate_physics_state

end module test_host_data
6 changes: 6 additions & 0 deletions test/var_compatibility_test/test_host_data.meta
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@
dimensions = ()
type = real
kind = kind_phys
[scheme_order]
standard_name = scheme_order_in_suite
long_name = scheme order in suite definition file
units = None
dimensions = ()
type = integer
4 changes: 3 additions & 1 deletion test/var_compatibility_test/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def usage(errmsg=None):
"effective_radius_of_stratiform_cloud_graupel",
"cloud_graupel_number_concentration",
"scalar_variable_for_testing",
"scheme_order_in_suite",
"flag_indicating_cloud_microphysics_has_graupel",
"flag_indicating_cloud_microphysics_has_ice"]
_OUTPUT_VARS_VAR_ACTION = ["ccpp_error_code", "ccpp_error_message",
Expand All @@ -82,7 +83,8 @@ def usage(errmsg=None):
"effective_radius_of_stratiform_cloud_snow_particle",
"cloud_ice_number_concentration",
"effective_radius_of_stratiform_cloud_rain_particle",
"scalar_variable_for_testing"]
"scalar_variable_for_testing",
"scheme_order_in_suite"]
_REQUIRED_VARS_VAR_ACTION = _INPUT_VARS_VAR_ACTION + _OUTPUT_VARS_VAR_ACTION

def fields_string(field_type, field_list, sep):
Expand Down

0 comments on commit d73512a

Please sign in to comment.