From 2aef070fd3272fd59ef66e292aaded6b78d22f7a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 23 Apr 2018 14:46:43 -0600 Subject: [PATCH 1/7] First attempt at versioning of XML schemes, delete unused suite definition files, rename 'ipd' to 'group' --- examples/suite.xsd | 8 +- examples/suite_EXAMPLE.xml | 4 +- examples/suite_GFS_operational_2017.xml | 16 ++-- examples/suite_RAP.xml | 20 ----- examples/suite_SCM.xml | 14 ---- examples/suite_scm_GFS_test.xml | 12 +-- schemes/check/check_noop.f90 | 2 +- src/ccpp_fcall.F90 | 34 ++++---- src/ccpp_suite.F90 | 106 ++++++++++++------------ src/ccpp_types.F90 | 32 ++++--- src/ccpp_xml.F90 | 60 +++++++------- src/tests/test_check.f90 | 2 +- 12 files changed, 138 insertions(+), 172 deletions(-) delete mode 100644 examples/suite_RAP.xml delete mode 100644 examples/suite_SCM.xml diff --git a/examples/suite.xsd b/examples/suite.xsd index 54a73688..df7e9c6c 100644 --- a/examples/suite.xsd +++ b/examples/suite.xsd @@ -1,6 +1,8 @@ + xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="https://dtcenter.org/gmtb/users/ccpp/2018/04/23" + xmlns:namens="https://dtcenter.org/gmtb/users/ccpp/2018/04/23"> @@ -22,7 +24,7 @@ - + @@ -35,7 +37,7 @@ - + diff --git a/examples/suite_EXAMPLE.xml b/examples/suite_EXAMPLE.xml index 6f5eeffb..5e45643e 100644 --- a/examples/suite_EXAMPLE.xml +++ b/examples/suite_EXAMPLE.xml @@ -1,10 +1,10 @@ - + test - + diff --git a/examples/suite_GFS_operational_2017.xml b/examples/suite_GFS_operational_2017.xml index 8c54745a..266cb002 100644 --- a/examples/suite_GFS_operational_2017.xml +++ b/examples/suite_GFS_operational_2017.xml @@ -2,12 +2,12 @@ IPD_initialize - + IPD_setup_step - - + + GFS_suite_interstitial_rad_reset_run GFS_rrtmg_pre_run @@ -21,8 +21,8 @@ - - + + GFS_suite_interstitial_phys_reset_run get_prs_fv3_run @@ -92,12 +92,12 @@ - - + + GFS_stochastics_run - + diff --git a/examples/suite_RAP.xml b/examples/suite_RAP.xml deleted file mode 100644 index 388626d2..00000000 --- a/examples/suite_RAP.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - RRTMGLW - RRTMGSW - MYNNSFC - RUCLSM - MYNNPBL - GF - - - - - THOMPSONAERO - - - - diff --git a/examples/suite_SCM.xml b/examples/suite_SCM.xml deleted file mode 100644 index 4506418a..00000000 --- a/examples/suite_SCM.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - run_1 - - - - - run_2 - - - diff --git a/examples/suite_scm_GFS_test.xml b/examples/suite_scm_GFS_test.xml index 5c4b0c46..649f814e 100644 --- a/examples/suite_scm_GFS_test.xml +++ b/examples/suite_scm_GFS_test.xml @@ -2,15 +2,15 @@ GFS_initialize_scm_run - + GFS_phys_time_vary_1_run GFS_rad_time_vary_run GFS_phys_time_vary_2_run - - + + GFS_suite_interstitial_rad_reset_run GFS_rrtmg_pre_run @@ -24,8 +24,8 @@ - - + + GFS_suite_interstitial_phys_reset_run get_prs_fv3_run @@ -95,6 +95,6 @@ - + diff --git a/schemes/check/check_noop.f90 b/schemes/check/check_noop.f90 index e056e1ef..7eb102cf 100644 --- a/schemes/check/check_noop.f90 +++ b/schemes/check/check_noop.f90 @@ -39,7 +39,7 @@ subroutine noop_cap(ptr) bind(c) call c_f_pointer(ptr, cdata) print *, 'In noop_cap' - print *, cdata%suite%ipds(1)%subcycles(1)%schemes(1)%name + print *, cdata%suite%groups(1)%subcycles(1)%schemes(1)%name end subroutine noop_cap diff --git a/src/ccpp_fcall.F90 b/src/ccpp_fcall.F90 index 4335bbcb..8aa2f84d 100644 --- a/src/ccpp_fcall.F90 +++ b/src/ccpp_fcall.F90 @@ -2,14 +2,14 @@ !! @brief The CCPP function call module. !! !! @details The CCPP routines for calling the specified -!! physics ipd/subcyce/scheme. +!! physics group/subcyce/scheme. ! module ccpp_fcall use, intrinsic :: iso_c_binding, & only: c_int32_t, c_char, c_ptr, c_loc, c_funptr use :: ccpp_types, & - only: ccpp_t, ccpp_suite_t, ccpp_ipd_t, & + only: ccpp_t, ccpp_suite_t, ccpp_group_t, & ccpp_subcycle_t, ccpp_scheme_t use :: ccpp_errors, & only: ccpp_error, ccpp_debug @@ -25,7 +25,7 @@ module ccpp_fcall interface ccpp_run module procedure ccpp_run_suite, & - ccpp_run_ipd, & + ccpp_run_group, & ccpp_run_subcycle, & ccpp_run_scheme, & ccpp_run_fptr @@ -35,7 +35,7 @@ module ccpp_fcall !> !! The run subroutine for a suite. This will call - !! the all ipds within a suite. + !! the all groups within a suite. !! !! @param[in ] suite The suite to run !! @param[in,out] cdata The CCPP data of type ccpp_t @@ -53,9 +53,9 @@ subroutine ccpp_run_suite(suite, cdata, ierr) call ccpp_debug('Called ccpp_run_suite') - do i=1,suite%ipds_max - suite%ipd_n = i - call ccpp_run_ipd(suite%ipds(i), cdata, ierr) + do i=1,suite%groups_max + suite%group_n = i + call ccpp_run_group(suite%groups(i), cdata, ierr) if (ierr /= 0) then return end if @@ -64,16 +64,16 @@ subroutine ccpp_run_suite(suite, cdata, ierr) end subroutine ccpp_run_suite !> - !! The run subroutine for an ipd. This will call - !! the all subcycles within an ipd. + !! The run subroutine for a group. This will call + !! the all subcycles within a group. !! - !! @param[in ] ipd The ipd to run + !! @param[in ] group The group to run !! @param[in,out] cdata The CCPP data of type ccpp_t !! @param[ out] ierr Integer error flag ! - subroutine ccpp_run_ipd(ipd, cdata, ierr) + subroutine ccpp_run_group(group, cdata, ierr) - type(ccpp_ipd_t), intent(inout) :: ipd + type(ccpp_group_t), intent(inout) :: group type(ccpp_t), target, intent(inout) :: cdata integer, intent( out) :: ierr @@ -81,17 +81,17 @@ subroutine ccpp_run_ipd(ipd, cdata, ierr) ierr = 0 - call ccpp_debug('Called ccpp_run_ipd') + call ccpp_debug('Called ccpp_run_group') - do i=1,ipd%subcycles_max - ipd%subcycle_n = i - call ccpp_run_subcycle(ipd%subcycles(i), cdata, ierr) + do i=1,group%subcycles_max + group%subcycle_n = i + call ccpp_run_subcycle(group%subcycles(i), cdata, ierr) if (ierr /= 0) then return end if end do - end subroutine ccpp_run_ipd + end subroutine ccpp_run_group !> !! The run subroutine for a subcycle. This will call diff --git a/src/ccpp_suite.F90 b/src/ccpp_suite.F90 index 4dd3b489..8feda185 100644 --- a/src/ccpp_suite.F90 +++ b/src/ccpp_suite.F90 @@ -59,7 +59,7 @@ subroutine ccpp_suite_init(filename, suite, ierr) integer :: k type(c_ptr) :: xml type(c_ptr) :: root - type(c_ptr) :: ipd + type(c_ptr) :: group type(c_ptr) :: subcycle type(c_ptr) :: scheme type(c_ptr), target :: tmp @@ -112,26 +112,26 @@ subroutine ccpp_suite_init(filename, suite, ierr) end if end if - ! Find the first IPD - call ccpp_xml_ele_find(root, CCPP_XML_ELE_IPD, ipd, ierr) + ! Find the first group + call ccpp_xml_ele_find(root, CCPP_XML_ELE_GROUP, group, ierr) if (ierr /= 0) then - call ccpp_error('Unable to find first ipd') + call ccpp_error('Unable to find first group') call ccpp_error(err_msg // trim(filename)) return end if - ! Loop over all IPDs - do i=1, suite%ipds_max + ! Loop over all groups + do i=1, suite%groups_max - ! Parse the IPD - call ccpp_xml_parse(ipd, suite%ipds_max, suite%ipds(i), ierr) + ! Parse the group + call ccpp_xml_parse(group, suite%groups_max, suite%groups(i), ierr) if (ierr /= 0) then call ccpp_error(err_msg // trim(filename)) return end if ! Find the first subcycle - call ccpp_xml_ele_find(ipd, CCPP_XML_ELE_SUBCYCLE, subcycle, ierr) + call ccpp_xml_ele_find(group, CCPP_XML_ELE_SUBCYCLE, subcycle, ierr) if (ierr /= 0) then call ccpp_error('Unable to locate element: ' & // CCPP_XML_ELE_SUBCYCLE) @@ -140,12 +140,12 @@ subroutine ccpp_suite_init(filename, suite, ierr) end if ! Loop over all subcycles - do j=1, suite%ipds(i)%subcycles_max + do j=1, suite%groups(i)%subcycles_max ! Parse the subcycle call ccpp_xml_parse(subcycle, & - suite%ipds(i)%subcycles_max, & - suite%ipds(i)%subcycles(j), & + suite%groups(i)%subcycles_max, & + suite%groups(i)%subcycles(j), & ierr) if (ierr /= 0) then call ccpp_error(err_msg // trim(filename)) @@ -157,10 +157,10 @@ subroutine ccpp_suite_init(filename, suite, ierr) scheme, ierr) ! Loop over all scheme - do k=1, suite%ipds(i)%subcycles(j)%schemes_max + do k=1, suite%groups(i)%subcycles(j)%schemes_max ! Parse the scheme call ccpp_xml_parse(scheme, suite%library, suite%version, & - suite%ipds(i)%subcycles(j)%schemes(k), & + suite%groups(i)%subcycles(j)%schemes(k), & ierr) ! Find the next scheme call ccpp_xml_ele_next(scheme, CCPP_XML_ELE_SCHEME, & @@ -170,8 +170,8 @@ subroutine ccpp_suite_init(filename, suite, ierr) call ccpp_xml_ele_next(subcycle, CCPP_XML_ELE_SUBCYCLE, & subcycle, ierr) end do - ! Find the next IPD - call ccpp_xml_ele_next(ipd, CCPP_XML_ELE_IPD, ipd, ierr) + ! Find the next group + call ccpp_xml_ele_next(group, CCPP_XML_ELE_GROUP, group, ierr) end do #if 0 @@ -184,25 +184,25 @@ subroutine ccpp_suite_init(filename, suite, ierr) '" ver="', trim(suite%version), & '">' - write(6, '(A, I0)') '[suite%ipds_max] = ', suite%ipds_max - do i=1, suite%ipds_max - write(6, '(A, I0, A)') ' ' - write(6, '(A, I0)') ' [suite%ipds(i)%subcycles_max] = ', suite%ipds(i)%subcycles_max - do j=1, suite%ipds(i)%subcycles_max - write(6, '(A, I0, A)') ' ' - write(6, '(A, I0)') ' [suite%ipds(i)%subcycles(j)%schemes_max] = ', suite%ipds(i)%subcycles(j)%schemes_max - do k=1, suite%ipds(i)%subcycles(j)%schemes_max + write(6, '(A, I0)') '[suite%groups_max] = ', suite%groups_max + do i=1, suite%groups_max + write(6, '(A, I0, A)') ' ' + write(6, '(A, I0)') ' [suite%groups(i)%subcycles_max] = ', suite%groups(i)%subcycles_max + do j=1, suite%groups(i)%subcycles_max + write(6, '(A, I0, A)') ' ' + write(6, '(A, I0)') ' [suite%groups(i)%subcycles(j)%schemes_max] = ', suite%groups(i)%subcycles(j)%schemes_max + do k=1, suite%groups(i)%subcycles(j)%schemes_max write(6, '(A, A, A, A, A, A, A)') & ' ', & - trim(suite%ipds(i)%subcycles(j)%schemes(k)%name), & + trim(suite%groups(i)%subcycles(j)%schemes(k)%version), '">', & + trim(suite%groups(i)%subcycles(j)%schemes(k)%name), & '' end do write(6, '(A)') ' ' end do - write(6, '(A)') ' ' + write(6, '(A)') ' ' end do write(6, '(A)') '' write(6, '(A)') '--------------------------------------------------------------------------------' @@ -238,32 +238,32 @@ subroutine ccpp_suite_finalize(suite, ierr) call ccpp_suite_unload(suite, ierr) end if - do i=1, suite%ipds_max - do j=1, suite%ipds(i)%subcycles_max - do k=1, suite%ipds(i)%subcycles(j)%schemes_max - if (allocated(suite%ipds(i)%subcycles(j)%schemes(k)%name)) then - deallocate(suite%ipds(i)%subcycles(j)%schemes(k)%name) + do i=1, suite%groups_max + do j=1, suite%groups(i)%subcycles_max + do k=1, suite%groups(i)%subcycles(j)%schemes_max + if (allocated(suite%groups(i)%subcycles(j)%schemes(k)%name)) then + deallocate(suite%groups(i)%subcycles(j)%schemes(k)%name) end if - if (allocated(suite%ipds(i)%subcycles(j)%schemes(k)%library)) & + if (allocated(suite%groups(i)%subcycles(j)%schemes(k)%library)) & then - deallocate(suite%ipds(i)%subcycles(j)%schemes(k)%library) + deallocate(suite%groups(i)%subcycles(j)%schemes(k)%library) end if - if (allocated(suite%ipds(i)%subcycles(j)%schemes(k)%version)) & + if (allocated(suite%groups(i)%subcycles(j)%schemes(k)%version)) & then - deallocate(suite%ipds(i)%subcycles(j)%schemes(k)%version) + deallocate(suite%groups(i)%subcycles(j)%schemes(k)%version) end if end do - if (allocated(suite%ipds(i)%subcycles(j)%schemes)) then - deallocate(suite%ipds(i)%subcycles(j)%schemes) + if (allocated(suite%groups(i)%subcycles(j)%schemes)) then + deallocate(suite%groups(i)%subcycles(j)%schemes) end if end do - if (allocated(suite%ipds(i)%subcycles)) then - deallocate(suite%ipds(i)%subcycles) + if (allocated(suite%groups(i)%subcycles)) then + deallocate(suite%groups(i)%subcycles) end if end do - if (allocated(suite%ipds)) then - deallocate(suite%ipds) + if (allocated(suite%groups)) then + deallocate(suite%groups) end if ! Clean up the init @@ -305,8 +305,8 @@ subroutine ccpp_suite_finalize(suite, ierr) deallocate(suite%version) end if - suite%ipd_n = 0 - suite%ipds_max = 0 + suite%group_n = 0 + suite%groups_max = 0 end subroutine ccpp_suite_finalize @@ -355,10 +355,10 @@ subroutine ccpp_suite_load(suite, ierr) end if end if - do i=1, suite%ipds_max - do j=1, suite%ipds(i)%subcycles_max - do k=1, suite%ipds(i)%subcycles(j)%schemes_max - associate (s => suite%ipds(i)%subcycles(j)%schemes(k)) + do i=1, suite%groups_max + do j=1, suite%groups(i)%subcycles_max + do k=1, suite%groups(i)%subcycles(j)%schemes_max + associate (s => suite%groups(i)%subcycles(j)%schemes(k)) ierr = ccpp_dl_open(ccpp_cstr(s%name), & ccpp_cstr(s%library), & ccpp_cstr(s%version), & @@ -417,10 +417,10 @@ subroutine ccpp_suite_unload(suite, ierr) end if end if - do i=1, suite%ipds_max - do j=1, suite%ipds(i)%subcycles_max - do k=1, suite%ipds(i)%subcycles(j)%schemes_max - associate (s => suite%ipds(i)%subcycles(j)%schemes(k)) + do i=1, suite%groups_max + do j=1, suite%groups(i)%subcycles_max + do k=1, suite%groups(i)%subcycles(j)%schemes_max + associate (s => suite%groups(i)%subcycles(j)%schemes(k)) ierr = ccpp_dl_close(s%library_hdl) if (ierr /= 0) then call ccpp_error('A problem occured closing ' & diff --git a/src/ccpp_types.F90 b/src/ccpp_types.F90 index 1477fa81..8ea77376 100644 --- a/src/ccpp_types.F90 +++ b/src/ccpp_types.F90 @@ -15,8 +15,7 @@ !! @brief Type definitions module. !! !! @details The types module provides definitions for -!! atmospheic driver to call the IPD and -!! the CCPP. +!! atmospheic driver to call the CCPP. ! module ccpp_types @@ -31,7 +30,7 @@ module ccpp_types ccpp_field_t, & ccpp_scheme_t, & ccpp_suite_t, & - ccpp_ipd_t, & + ccpp_group_t, & ccpp_subcycle_t !> @var CCPP_STR_LEN Parameter defined for string lengths. @@ -69,7 +68,7 @@ module ccpp_types !! @breif CCPP subcycle type !! !! The subcycle type contains all the scheme names and the number of - !! times the subcycle will loop. It is a direct mapping to the IPD + !! times the subcycle will loop. It is a direct mapping to the group !! suite subcycle XML. ! type :: ccpp_subcycle_t @@ -80,25 +79,24 @@ module ccpp_types end type ccpp_subcycle_t !> - !! @breif CCPP IPD type + !! @breif CCPP group type !! - !! The ipd type contains all the subcycles and part number of - !! the ipd call. It is a direct mapping to the IPD suite ipd - !! element in XML. + !! The group type contains all the subcycles and part number of + !! the group call. It is a direct mapping to the group element in XML. ! - type :: ccpp_ipd_t + type :: ccpp_group_t integer :: part integer :: subcycles_max integer :: subcycle_n type(ccpp_subcycle_t), allocatable, dimension(:) :: subcycles - end type ccpp_ipd_t + end type ccpp_group_t !> !! @breif CCPP suite type !! - !! The suite type contains all the ipd parts names and number of + !! The suite type contains all the group parts names and number of !! times the subcycle will loop. It is a direct mapping to the - !! IPD suite subcycle XML. + !! suite element in XML. ! type :: ccpp_suite_t character(:), allocatable :: name @@ -106,18 +104,18 @@ module ccpp_types character(:), allocatable :: version type(ccpp_scheme_t) :: init type(ccpp_scheme_t) :: finalize - integer :: ipds_max - integer :: ipd_n - type(ccpp_ipd_t), allocatable, dimension(:) :: ipds + integer :: groups_max + integer :: group_n + type(ccpp_group_t), allocatable, dimension(:) :: groups logical :: iscopy end type ccpp_suite_t !> - !! @breif CCPP Atmosphere/IPD/Physics type. + !! @breif CCPP physics type. !! !! Generic type that contains all components to run the CCPP. !! - !! - Array of fields to all the atmospheric data needing to go + !! - Array of fields to all the data needing to go !! the physics drivers. !! - The suite definitions in a ccpp_suite_t type. ! diff --git a/src/ccpp_xml.F90 b/src/ccpp_xml.F90 index f36334ff..dbda937b 100644 --- a/src/ccpp_xml.F90 +++ b/src/ccpp_xml.F90 @@ -22,7 +22,7 @@ module ccpp_xml use, intrinsic :: iso_c_binding use :: ccpp_types, & - only: ccpp_suite_t, ccpp_ipd_t, & + only: ccpp_suite_t, ccpp_group_t, & ccpp_subcycle_t, ccpp_scheme_t, & CCPP_STR_LEN use :: ccpp_strings, & @@ -42,13 +42,13 @@ module ccpp_xml CCPP_XML_ELE_SUITE, & CCPP_XML_ELE_INIT, & CCPP_XML_ELE_FINALIZE, & - CCPP_XML_ELE_IPD, & + CCPP_XML_ELE_GROUP, & CCPP_XML_ELE_SUBCYCLE, & CCPP_XML_ELE_SCHEME interface ccpp_xml_parse module procedure ccpp_xml_parse_suite, & - ccpp_xml_parse_ipd, & + ccpp_xml_parse_group, & ccpp_xml_parse_subcycle, & ccpp_xml_parse_fptr end interface ccpp_xml_parse @@ -62,7 +62,7 @@ module ccpp_xml character(len=*), parameter :: CCPP_XML_ELE_SUITE = "suite" character(len=*), parameter :: CCPP_XML_ELE_INIT = "init" character(len=*), parameter :: CCPP_XML_ELE_FINALIZE = "finalize" - character(len=*), parameter :: CCPP_XML_ELE_IPD = "ipd" + character(len=*), parameter :: CCPP_XML_ELE_GROUP = "group" character(len=*), parameter :: CCPP_XML_ELE_SUBCYCLE = "subcycle" character(len=*), parameter :: CCPP_XML_ELE_SCHEME = "scheme" @@ -232,32 +232,32 @@ subroutine ccpp_xml_parse_suite(node, suite, ierr) ierr = 0 end if - ! Count the number of IPDs - ierr = ccpp_xml_ele_count(node, ccpp_cstr(CCPP_XML_ELE_IPD), suite%ipds_max) + ! Count the number of groups + ierr = ccpp_xml_ele_count(node, ccpp_cstr(CCPP_XML_ELE_GROUP), suite%groups_max) if (ierr /= 0) then - call ccpp_error('Unable count the number of ipds') + call ccpp_error('Unable count the number of groups') return end if - allocate(suite%ipds(suite%ipds_max), stat=ierr) + allocate(suite%groups(suite%groups_max), stat=ierr) if (ierr /= 0) then - call ccpp_error('Unable to allocate ipds') + call ccpp_error('Unable to allocate groups') return end if end subroutine ccpp_xml_parse_suite - !! IPD parsing from an XML file. + !! Group parsing from an XML file. !! - !! @param[in ] node The current xml node. - !! @param[in ] max_ipds The maximum number of IPDs. - !! @param[in,out] ipd The ccpp_ipd_t type to parse into. - !! @param[ out] ierr Integer error flag. + !! @param[in ] node The current xml node. + !! @param[in ] max_groups The maximum number of groups. + !! @param[in,out] group The ccpp_group_t type to parse into. + !! @param[ out] ierr Integer error flag. ! - subroutine ccpp_xml_parse_ipd(node, max_ipds, ipd, ierr) + subroutine ccpp_xml_parse_group(node, max_groups, group, ierr) type(c_ptr), intent(in ) :: node - integer, intent(in ) :: max_ipds - type(ccpp_ipd_t), intent(inout) :: ipd + integer, intent(in ) :: max_groups + type(ccpp_group_t), intent(inout) :: group integer, intent( out) :: ierr type(c_ptr), target :: tmp @@ -266,50 +266,50 @@ subroutine ccpp_xml_parse_ipd(node, max_ipds, ipd, ierr) tmp = c_null_ptr - ! Get the ipd part number + ! Get the group part number ierr = ccpp_xml_ele_att(node, ccpp_cstr(CCPP_XML_ATT_PART), tmp) - if (ierr /= 0 .and. max_ipds == 1) then - call ccpp_warn('Unable to find IPD attribute: ' // CCPP_XML_ATT_PART & + if (ierr /= 0 .and. max_groups == 1) then + call ccpp_warn('Unable to find group attribute: ' // CCPP_XML_ATT_PART & // ' (assuming 1)') - ipd%part = 1 - else if (ierr /= 0 .and. max_ipds > 1) then - call ccpp_error('Unable to find IPD attribute: ' // CCPP_XML_ATT_PART) + group%part = 1 + else if (ierr /= 0 .and. max_groups > 1) then + call ccpp_error('Unable to find group attribute: ' // CCPP_XML_ATT_PART) return else stmp = ccpp_fstr(tmp) - read(stmp, *, iostat=ierr) ipd%part + read(stmp, *, iostat=ierr) group%part call ccpp_free(tmp) tmp = c_null_ptr if (ierr /= 0) then - call ccpp_error('Unable to convert IPD attribute "' // & + call ccpp_error('Unable to convert group attribute "' // & CCPP_XML_ATT_PART // '" to an integer') return end if end if - ! Count the number of subcycles in this IPD + ! Count the number of subcycles in this group ierr = ccpp_xml_ele_count(node, ccpp_cstr(CCPP_XML_ELE_SUBCYCLE), & - ipd%subcycles_max) + group%subcycles_max) if (ierr /= 0) then call ccpp_error('Unable to count the number of: ' // & CCPP_XML_ELE_SUBCYCLE) return end if - allocate(ipd%subcycles(ipd%subcycles_max), stat=ierr) + allocate(group%subcycles(group%subcycles_max), stat=ierr) if (ierr /= 0) then call ccpp_error('Unable to allocate subcycles') return end if - end subroutine ccpp_xml_parse_ipd + end subroutine ccpp_xml_parse_group !> !! Subcycle parsing from an XML file. !! !! @param[in ] node The current xml node. !! @param[in ] max_subcycles The maximum number of subcycles. - !! @param[in,out] ipd The ccpp_subcycle_t type to parse into. + !! @param[in,out] subcycle The ccpp_subcycle_t type to parse into. !! @param[ out] ierr Integer error flag. ! subroutine ccpp_xml_parse_subcycle(node, max_subcycles, subcycle, ierr) diff --git a/src/tests/test_check.f90 b/src/tests/test_check.f90 index a07ff639..76762dea 100644 --- a/src/tests/test_check.f90 +++ b/src/tests/test_check.f90 @@ -90,7 +90,7 @@ program test_check call ccpp_field_add(cdata, 'northward_wind', v, ierr, 'm s-1') - call ccpp_run(cdata%suite%ipds(1)%subcycles(1)%schemes(1), cdata, ierr) + call ccpp_run(cdata%suite%groups(1)%subcycles(1)%schemes(1), cdata, ierr) print *, 'In test dummy main' print *, 'gravity: ', gravity From 4a153408c354babce3ec3cd97c2d3734b968c97c Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 23 Apr 2018 15:08:30 -0600 Subject: [PATCH 2/7] Removed unused attributes group_n, subcycle_n, scheme_n from ccpp data types --- src/ccpp_fcall.F90 | 3 --- src/ccpp_suite.F90 | 1 - src/ccpp_types.F90 | 3 --- 3 files changed, 7 deletions(-) diff --git a/src/ccpp_fcall.F90 b/src/ccpp_fcall.F90 index 8aa2f84d..2cb4ecef 100644 --- a/src/ccpp_fcall.F90 +++ b/src/ccpp_fcall.F90 @@ -54,7 +54,6 @@ subroutine ccpp_run_suite(suite, cdata, ierr) call ccpp_debug('Called ccpp_run_suite') do i=1,suite%groups_max - suite%group_n = i call ccpp_run_group(suite%groups(i), cdata, ierr) if (ierr /= 0) then return @@ -84,7 +83,6 @@ subroutine ccpp_run_group(group, cdata, ierr) call ccpp_debug('Called ccpp_run_group') do i=1,group%subcycles_max - group%subcycle_n = i call ccpp_run_subcycle(group%subcycles(i), cdata, ierr) if (ierr /= 0) then return @@ -117,7 +115,6 @@ subroutine ccpp_run_subcycle(subcycle, cdata, ierr) do i=1,subcycle%loop do j=1,subcycle%schemes_max - subcycle%scheme_n = j call ccpp_run_scheme(subcycle%schemes(j), cdata, ierr) if (ierr /= 0) then return diff --git a/src/ccpp_suite.F90 b/src/ccpp_suite.F90 index 8feda185..e122f4ff 100644 --- a/src/ccpp_suite.F90 +++ b/src/ccpp_suite.F90 @@ -305,7 +305,6 @@ subroutine ccpp_suite_finalize(suite, ierr) deallocate(suite%version) end if - suite%group_n = 0 suite%groups_max = 0 end subroutine ccpp_suite_finalize diff --git a/src/ccpp_types.F90 b/src/ccpp_types.F90 index 8ea77376..93d8dff3 100644 --- a/src/ccpp_types.F90 +++ b/src/ccpp_types.F90 @@ -74,7 +74,6 @@ module ccpp_types type :: ccpp_subcycle_t integer :: loop integer :: schemes_max - integer :: scheme_n type(ccpp_scheme_t), allocatable, dimension(:) :: schemes end type ccpp_subcycle_t @@ -87,7 +86,6 @@ module ccpp_types type :: ccpp_group_t integer :: part integer :: subcycles_max - integer :: subcycle_n type(ccpp_subcycle_t), allocatable, dimension(:) :: subcycles end type ccpp_group_t @@ -105,7 +103,6 @@ module ccpp_types type(ccpp_scheme_t) :: init type(ccpp_scheme_t) :: finalize integer :: groups_max - integer :: group_n type(ccpp_group_t), allocatable, dimension(:) :: groups logical :: iscopy end type ccpp_suite_t From cbdffc4e7811c52db1668029630639c4e83049a2 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 24 Apr 2018 10:50:39 -0600 Subject: [PATCH 3/7] New module ccpp_api to use in host models --- src/CMakeLists.txt | 1 + src/ccpp_api.F90 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/ccpp_api.F90 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index deba4a5d..44608420 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,7 @@ set(SOURCES ccpp_xml.F90 ccpp_xml.h ccpp_xml.c + ccpp_api.F90 ) #------------------------------------------------------------------------------ diff --git a/src/ccpp_api.F90 b/src/ccpp_api.F90 new file mode 100644 index 00000000..016f93c8 --- /dev/null +++ b/src/ccpp_api.F90 @@ -0,0 +1,46 @@ +! +! This work (Common Community Physics Package), identified by NOAA, NCAR, +! CU/CIRES, is free of known copyright restrictions and is placed in the +! public domain. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +! THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +! IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +! CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! + +!> +!! @brief CCPP API module. +!! +!! @details This module exposes calls to CCPP routines to the users. +! +module ccpp_api + + use ccpp_types, only: CCPP_STR_LEN, & + ccpp_t + use ccpp_errors, only: ccpp_error, & + ccpp_debug + use ccpp, only: ccpp_init, & + ccpp_finalize + use ccpp_fcall, only: ccpp_physics_init, & + ccpp_physics_run, & + ccpp_physics_finalize + use ccpp_fields, only: ccpp_field_add, & + ccpp_field_get + + implicit none + + public :: CCPP_STR_LEN, & + ccpp_t, & + ccpp_error, & + ccpp_debug, & + ccpp_init, & + ccpp_finalize, & + ccpp_physics_init, & + ccpp_physics_run, & + ccpp_physics_finalize, & + ccpp_field_add + +end module ccpp_api From 234f57967e6542c2a2449eca4024ec67a816cadf Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 24 Apr 2018 11:11:45 -0600 Subject: [PATCH 4/7] Use dummy finalize routines to complete suite definition files for SCM and FV3 --- examples/suite_GFS_operational_2017.xml | 2 +- examples/suite_scm_GFS_test.xml | 2 +- scripts/ccpp_prebuild_config_SCM.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/suite_GFS_operational_2017.xml b/examples/suite_GFS_operational_2017.xml index 266cb002..9f36ecfa 100644 --- a/examples/suite_GFS_operational_2017.xml +++ b/examples/suite_GFS_operational_2017.xml @@ -99,5 +99,5 @@ - + IPD_finalize diff --git a/examples/suite_scm_GFS_test.xml b/examples/suite_scm_GFS_test.xml index 649f814e..0e7864f2 100644 --- a/examples/suite_scm_GFS_test.xml +++ b/examples/suite_scm_GFS_test.xml @@ -96,5 +96,5 @@ - + GFS_finalize_scm_run diff --git a/scripts/ccpp_prebuild_config_SCM.py b/scripts/ccpp_prebuild_config_SCM.py index c3b40709..38bce749 100755 --- a/scripts/ccpp_prebuild_config_SCM.py +++ b/scripts/ccpp_prebuild_config_SCM.py @@ -17,6 +17,7 @@ # Add all physics scheme files relative to basedir SCHEME_FILES = [ 'ccpp-physics/GFS_layer/GFS_initialize_scm.F90', + 'ccpp-physics/GFS_layer/GFS_finalize_scm.F90', 'ccpp-physics/physics/GFS_DCNV_generic.f90', 'ccpp-physics/physics/GFS_MP_generic_post.f90', 'ccpp-physics/physics/GFS_MP_generic_pre.f90', From 89a22d649fe82590ee5e41b8fbe9e09338dbbd7a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 24 Apr 2018 11:18:37 -0600 Subject: [PATCH 5/7] Instead of specifying integer attributes 'part=X' for XML element 'group' (previously called 'ipd'), use strings describing the group. This requires new functionality in ccpp_fcall.F90 to find a group or scheme by its name. The single entry point for running physics is now ccpp_physics_run with mandatory arguments cdata and ierr, and optional arguments describing what to run (a group, a subcycle of a group, a single scheme, or the entire suite). Corresponding updates for the suite definition files of SCM and FV3. --- examples/suite_GFS_operational_2017.xml | 8 +- examples/suite_scm_GFS_test.xml | 6 +- src/ccpp_fcall.F90 | 238 +++++++++++++++++++++++- src/ccpp_suite.F90 | 2 +- src/ccpp_types.F90 | 4 +- src/ccpp_xml.F90 | 38 ++-- 6 files changed, 250 insertions(+), 46 deletions(-) diff --git a/examples/suite_GFS_operational_2017.xml b/examples/suite_GFS_operational_2017.xml index 9f36ecfa..a07c28e6 100644 --- a/examples/suite_GFS_operational_2017.xml +++ b/examples/suite_GFS_operational_2017.xml @@ -2,12 +2,12 @@ IPD_initialize - + IPD_setup_step - + GFS_suite_interstitial_rad_reset_run GFS_rrtmg_pre_run @@ -22,7 +22,7 @@ - + GFS_suite_interstitial_phys_reset_run get_prs_fv3_run @@ -93,7 +93,7 @@ - + GFS_stochastics_run diff --git a/examples/suite_scm_GFS_test.xml b/examples/suite_scm_GFS_test.xml index 0e7864f2..f1fe8a71 100644 --- a/examples/suite_scm_GFS_test.xml +++ b/examples/suite_scm_GFS_test.xml @@ -2,7 +2,7 @@ GFS_initialize_scm_run - + GFS_phys_time_vary_1_run GFS_rad_time_vary_run @@ -10,7 +10,7 @@ - + GFS_suite_interstitial_rad_reset_run GFS_rrtmg_pre_run @@ -25,7 +25,7 @@ - + GFS_suite_interstitial_phys_reset_run get_prs_fv3_run diff --git a/src/ccpp_fcall.F90 b/src/ccpp_fcall.F90 index 2cb4ecef..7387c439 100644 --- a/src/ccpp_fcall.F90 +++ b/src/ccpp_fcall.F90 @@ -21,18 +21,132 @@ module ccpp_fcall implicit none private - public :: ccpp_run - - interface ccpp_run - module procedure ccpp_run_suite, & - ccpp_run_group, & - ccpp_run_subcycle, & - ccpp_run_scheme, & - ccpp_run_fptr - end interface ccpp_run + public :: ccpp_physics_init, ccpp_physics_run, ccpp_physics_finalize contains + !! + !! Public CCPP physics init/run/finalize routines + !! + + !> + !! Single entry point for initializing ccpp physics. + !! + !! @param[in,out] cdata The CCPP data of type ccpp_t + !! @param[ out] ierr Integer error flag + ! + subroutine ccpp_physics_init(cdata, ierr) + + type(ccpp_t), target, intent(inout) :: cdata + integer, intent(out) :: ierr + + ! Local variables + type(ccpp_scheme_t) :: scheme + + ierr = 0 + call ccpp_debug('Called ccpp_physics_init') + + scheme = cdata%suite%init + call ccpp_run_scheme(scheme, cdata, ierr) + + end subroutine ccpp_physics_init + + !> + !! Single entry point for running ccpp physics. + !! Optional arguments specify whether to run one + !! group, subcycle or an individual scheme of the + !! suite. If no optional arguments are provided, + !! the entire suite attached to cdata is run. + !! + !! The optional argument subcycle requires group; + !! group and scheme are mutually exclusive. + !! + !! @param[in,out] cdata The CCPP data of type ccpp_t + !! @param[in ] group The group of physics to run (optional) + !! @param[in ] subcycle The subcycle of a group of physics to run (optional) + !! @param[in ] scheme The name of a single scheme to run (optional) + !! @param[ out] ierr Integer error flag + ! + subroutine ccpp_physics_run(cdata, group_name, subcycle_count, scheme_name, ierr) + + type(ccpp_t), target, intent(inout) :: cdata + character(len=*), optional, intent(in) :: group_name + integer, optional, intent(in) :: subcycle_count + character(len=*), optional, intent(in) :: scheme_name + integer, intent(out) :: ierr + + ! Local variables + type(ccpp_suite_t) , pointer :: suite + type(ccpp_group_t) , pointer :: group + type(ccpp_subcycle_t), pointer :: subcycle + type(ccpp_scheme_t) , pointer :: scheme + + ierr = 0 + call ccpp_debug('Called ccpp_physics_run') + + ! Consistency checks + if (present(group_name) .and. present(scheme_name)) then + call ccpp_error('Logic error in ccpp_physics_run: group_name and scheme_name are mutually exclusive') + ierr = 1 + return + else if (present(subcycle_count) .and. .not. present(group_name)) then + call ccpp_error('Logic error in ccpp_physics_run: subcycle_count requires optional argument group_name') + ierr = 1 + return + end if + + suite => cdata%suite + + if (present(group_name)) then + ! Find the group to run from the suite + group => ccpp_find_group(suite, group_name, ierr) + if (ierr/=0) return + if (present(subcycle_count)) then + ! Find the subcycle to run in the current group + subcycle => ccpp_find_subcycle(group, subcycle_count, ierr) + if (ierr/=0) return + call ccpp_run_subcycle(subcycle, cdata, ierr) + else + call ccpp_run_group(group, cdata, ierr) + end if + else if (present(scheme_name)) then + ! Find the scheme to run from the suite + scheme => ccpp_find_scheme(suite, scheme_name, ierr) + if (ierr/=0) return + call ccpp_run_scheme(scheme, cdata, ierr) + else + ! If none of the optional arguments is present, run the entire suite + call ccpp_run_suite(suite, cdata, ierr) + end if + + end subroutine ccpp_physics_run + + !> + !! Single entry point for finalizing ccpp physics. + !! + !! @param[in,out] cdata The CCPP data of type ccpp_t + !! @param[ out] ierr Integer error flag + ! + subroutine ccpp_physics_finalize(cdata, ierr) + + type(ccpp_t), target, intent(inout) :: cdata + integer, intent(out) :: ierr + + ! Local variables + type(ccpp_scheme_t) :: scheme + + ierr = 0 + call ccpp_debug('Called ccpp_physics_finalize') + + scheme = cdata%suite%finalize + call ccpp_run_scheme(scheme, cdata, ierr) + + end subroutine ccpp_physics_finalize + + !! + !! Private/internal routines for running suites, groups, subcycles and schemes *DH + !! + !> !! The run subroutine for a suite. This will call !! the all groups within a suite. @@ -62,6 +176,40 @@ subroutine ccpp_run_suite(suite, cdata, ierr) end subroutine ccpp_run_suite + !> + !! The find subroutine for a group. This will return + !! the group that matches group_name and ierr=0, + !! or ierr=1 if no such group is found. + !! + !! @param[in ] suite The suite in which to find the group + !! @param[in ] group_name The name of the group to run + !! @param[ out] ierr Integer error flag + ! + function ccpp_find_group(suite, group_name, ierr) result(group) + + type(ccpp_suite_t), target, intent(in ) :: suite + character(len=*), intent(in ) :: group_name + integer, intent( out) :: ierr + type(ccpp_group_t), pointer :: group + + integer :: i + + call ccpp_debug('Called ccpp_find_group') + + ierr = 0 + do i=1, suite%groups_max + if (trim(suite%groups(i)%name) .eq. trim(group_name)) then + call ccpp_debug('Group ' // trim(group_name) // ' found in suite') + group => suite%groups(i) + return + end if + end do + + call ccpp_error('Group ' // trim(group_name) // ' not found in suite') + ierr = 1 + + end function ccpp_find_group + !> !! The run subroutine for a group. This will call !! the all subcycles within a group. @@ -91,6 +239,37 @@ subroutine ccpp_run_group(group, cdata, ierr) end subroutine ccpp_run_group + !> + !! The find subroutine for a subcycle. This will return + !! the subcycle that matches subcycle_count in the group + !! and ierr==0, or ierr==1 if no such subcycle is found. + !! + !! @param[in ] group The group in which to find the subcycle + !! @param[in ] subcycle_count The name of the subcycle to run + !! @param[ out] ierr Integer error flag + ! + function ccpp_find_subcycle(group, subcycle_count, ierr) result(subcycle) + + type(ccpp_group_t), target, intent(in ) :: group + integer, intent(in ) :: subcycle_count + integer, intent( out) :: ierr + type(ccpp_subcycle_t), pointer :: subcycle + + call ccpp_debug('Called ccpp_find_subcycle') + + ierr = 0 + + if (subcycle_count <= group%subcycles_max) then + call ccpp_debug('Subcycle found in group ' // trim(group%name)) + subcycle => group%subcycles(subcycle_count) + return + end if + + call ccpp_error('Subcycle not found in group ' // trim(group%name)) + ierr = 1 + + end function ccpp_find_subcycle + !> !! The run subroutine for a subcycle. This will call !! the all schemes within a subcycle. It will also @@ -124,6 +303,45 @@ subroutine ccpp_run_subcycle(subcycle, cdata, ierr) end subroutine ccpp_run_subcycle + !> + !! The find subroutine for a scheme. This will return + !! the scheme that matches scheme_name and ierr==0, + !! or ierr==1 if no such scheme is found. + !! + !! @param[in ] suite The suite in which to find the scheme + !! @param[in ] scheme_name The name of the scheme to run + !! @param[ out] ierr Integer error flag + ! + function ccpp_find_scheme(suite, scheme_name, ierr) result(scheme) + + type(ccpp_suite_t), target, intent(in ) :: suite + character(len=*), intent(in ) :: scheme_name + integer, intent( out) :: ierr + type(ccpp_scheme_t), pointer :: scheme + + integer :: i, j, k + + call ccpp_debug('Called ccpp_find_scheme') + + ierr = 0 + do i=1, suite%groups_max + do j=1, suite%groups(i)%subcycles_max + do k=1, suite%groups(i)%subcycles(j)%schemes_max + print *, i, j, k, suite%groups(i)%subcycles(j)%schemes(k)%name + if (trim(suite%groups(i)%subcycles(j)%schemes(k)%name) .eq. trim(scheme_name)) then + call ccpp_debug('Scheme ' // trim(scheme_name) // ' found in suite') + scheme => suite%groups(i)%subcycles(j)%schemes(k) + return + end if + end do + end do + end do + + call ccpp_error('Scheme ' // trim(scheme_name) // ' not found in suite') + ierr = 1 + + end function ccpp_find_scheme + !> !! The run subroutine for a scheme. This will call !! the single scheme specified. @@ -150,6 +368,7 @@ subroutine ccpp_run_scheme(scheme, cdata, ierr) end subroutine ccpp_run_scheme +#if 0 !> !! The run subroutine for a function pointer. This !! will call the single function specified. @@ -174,5 +393,6 @@ subroutine ccpp_run_fptr(fptr, cdata, ierr) end if end subroutine ccpp_run_fptr +#endif end module ccpp_fcall diff --git a/src/ccpp_suite.F90 b/src/ccpp_suite.F90 index e122f4ff..b3a96e57 100644 --- a/src/ccpp_suite.F90 +++ b/src/ccpp_suite.F90 @@ -186,7 +186,7 @@ subroutine ccpp_suite_init(filename, suite, ierr) write(6, '(A, I0)') '[suite%groups_max] = ', suite%groups_max do i=1, suite%groups_max - write(6, '(A, I0, A)') ' ' + write(6, '(A, A, A)') ' ' write(6, '(A, I0)') ' [suite%groups(i)%subcycles_max] = ', suite%groups(i)%subcycles_max do j=1, suite%groups(i)%subcycles_max write(6, '(A, I0, A)') ' ' diff --git a/src/ccpp_types.F90 b/src/ccpp_types.F90 index 93d8dff3..9bcfdc94 100644 --- a/src/ccpp_types.F90 +++ b/src/ccpp_types.F90 @@ -80,11 +80,11 @@ module ccpp_types !> !! @breif CCPP group type !! - !! The group type contains all the subcycles and part number of + !! The group type contains all the subcycles and the name of !! the group call. It is a direct mapping to the group element in XML. ! type :: ccpp_group_t - integer :: part + character(:), allocatable :: name integer :: subcycles_max type(ccpp_subcycle_t), allocatable, dimension(:) :: subcycles end type ccpp_group_t diff --git a/src/ccpp_xml.F90 b/src/ccpp_xml.F90 index dbda937b..7deb47ac 100644 --- a/src/ccpp_xml.F90 +++ b/src/ccpp_xml.F90 @@ -67,7 +67,6 @@ module ccpp_xml character(len=*), parameter :: CCPP_XML_ELE_SCHEME = "scheme" character(len=*), parameter :: CCPP_XML_ATT_NAME = "name" - character(len=*), parameter :: CCPP_XML_ATT_PART = "part" character(len=*), parameter :: CCPP_XML_ATT_LOOP = "loop" character(len=*), parameter :: CCPP_XML_ATT_LIB = "lib" character(len=*), parameter :: CCPP_XML_ATT_VER = "ver" @@ -198,12 +197,12 @@ subroutine ccpp_xml_parse_suite(node, suite, ierr) ! Get the suite name ierr = ccpp_xml_ele_att(node, ccpp_cstr(CCPP_XML_ATT_NAME), tmp) if (ierr /= 0) then - call ccpp_error('Unable retrieving suite name') + call ccpp_error('Unable to retrieve suite name') return end if - suite%name = ccpp_fstr(tmp) call ccpp_free(tmp) + tmp = c_null_ptr ! Get the optional library name @@ -263,29 +262,18 @@ subroutine ccpp_xml_parse_group(node, max_groups, group, ierr) type(c_ptr), target :: tmp character(kind=c_char), target :: stmp(CCPP_STR_LEN) - tmp = c_null_ptr - ! Get the group part number - ierr = ccpp_xml_ele_att(node, ccpp_cstr(CCPP_XML_ATT_PART), tmp) - if (ierr /= 0 .and. max_groups == 1) then - call ccpp_warn('Unable to find group attribute: ' // CCPP_XML_ATT_PART & - // ' (assuming 1)') - group%part = 1 - else if (ierr /= 0 .and. max_groups > 1) then - call ccpp_error('Unable to find group attribute: ' // CCPP_XML_ATT_PART) - return - else - stmp = ccpp_fstr(tmp) - read(stmp, *, iostat=ierr) group%part - call ccpp_free(tmp) - tmp = c_null_ptr - if (ierr /= 0) then - call ccpp_error('Unable to convert group attribute "' // & - CCPP_XML_ATT_PART // '" to an integer') + ! Get the group name + ierr = ccpp_xml_ele_att(node, ccpp_cstr(CCPP_XML_ATT_NAME), tmp) + if (ierr /= 0) then + call ccpp_error('Unable to retrieve group name') return - end if end if + group%name = ccpp_fstr(tmp) + call ccpp_free(tmp) + + tmp = c_null_ptr ! Count the number of subcycles in this group ierr = ccpp_xml_ele_count(node, ccpp_cstr(CCPP_XML_ELE_SUBCYCLE), & @@ -326,11 +314,7 @@ subroutine ccpp_xml_parse_subcycle(node, max_subcycles, subcycle, ierr) ! Get the subcycle loop number ierr = ccpp_xml_ele_att(node, ccpp_cstr(CCPP_XML_ATT_LOOP), tmp) - if (ierr /= 0 .and. max_subcycles == 1) then - call ccpp_warn('Unable to find subcycle attribute: ' // CCPP_XML_ATT_LOOP & - // ' (assuming 1)') - subcycle%loop = 1 - else if (ierr /= 0 .and. max_subcycles > 1) then + if (ierr /= 0) then call ccpp_error('Unable to find subcycle attribute: ' // CCPP_XML_ATT_LOOP) return else From 18670c1615a889e8ac60cfc5f5bc2454ec72dd92 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 24 Apr 2018 11:19:23 -0600 Subject: [PATCH 6/7] Update of tests: use ccpp_api, new functionality to name groups instead of using part=X --- src/tests/suite_check_1.xml | 4 ++-- src/tests/suite_check_2.xml | 4 ++-- src/tests/suite_check_3.xml | 4 ++-- src/tests/suite_noop_1.xml | 4 ++-- src/tests/suite_noop_2.xml | 4 ++-- src/tests/suite_noop_3.xml | 4 ++-- src/tests/suite_noop_4.xml | 12 ++++++------ src/tests/suite_noop_5.xml | 4 ++-- src/tests/suite_noop_6.xml | 4 ++-- src/tests/test_check.f90 | 19 +++++++++---------- 10 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/tests/suite_check_1.xml b/src/tests/suite_check_1.xml index a3b250a3..753c2f7d 100644 --- a/src/tests/suite_check_1.xml +++ b/src/tests/suite_check_1.xml @@ -1,10 +1,10 @@ - + test - + diff --git a/src/tests/suite_check_2.xml b/src/tests/suite_check_2.xml index dbaf1eb7..f5144726 100644 --- a/src/tests/suite_check_2.xml +++ b/src/tests/suite_check_2.xml @@ -1,10 +1,10 @@ - + test - + diff --git a/src/tests/suite_check_3.xml b/src/tests/suite_check_3.xml index eab94918..10e1b595 100644 --- a/src/tests/suite_check_3.xml +++ b/src/tests/suite_check_3.xml @@ -1,10 +1,10 @@ - + test - + diff --git a/src/tests/suite_noop_1.xml b/src/tests/suite_noop_1.xml index e290f5af..80e8fc80 100644 --- a/src/tests/suite_noop_1.xml +++ b/src/tests/suite_noop_1.xml @@ -1,10 +1,10 @@ - + noop - + diff --git a/src/tests/suite_noop_2.xml b/src/tests/suite_noop_2.xml index 0947f6f7..1c0a4447 100644 --- a/src/tests/suite_noop_2.xml +++ b/src/tests/suite_noop_2.xml @@ -1,10 +1,10 @@ - + noop - + diff --git a/src/tests/suite_noop_3.xml b/src/tests/suite_noop_3.xml index 0e94ed40..a9e5ec81 100644 --- a/src/tests/suite_noop_3.xml +++ b/src/tests/suite_noop_3.xml @@ -1,10 +1,10 @@ - + noop - + diff --git a/src/tests/suite_noop_4.xml b/src/tests/suite_noop_4.xml index fbe44e9a..9e719072 100644 --- a/src/tests/suite_noop_4.xml +++ b/src/tests/suite_noop_4.xml @@ -1,22 +1,22 @@ - + noop - - + + noop - - + + noop noop noop - + diff --git a/src/tests/suite_noop_5.xml b/src/tests/suite_noop_5.xml index f7ad6346..b854898d 100644 --- a/src/tests/suite_noop_5.xml +++ b/src/tests/suite_noop_5.xml @@ -1,13 +1,13 @@ - + noop noop - + diff --git a/src/tests/suite_noop_6.xml b/src/tests/suite_noop_6.xml index 71eba642..1996517b 100644 --- a/src/tests/suite_noop_6.xml +++ b/src/tests/suite_noop_6.xml @@ -1,10 +1,10 @@ - + noop - + diff --git a/src/tests/test_check.f90 b/src/tests/test_check.f90 index 76762dea..8086298c 100644 --- a/src/tests/test_check.f90 +++ b/src/tests/test_check.f90 @@ -18,14 +18,13 @@ program test_check use, intrinsic :: iso_c_binding, & only: c_loc, c_f_pointer - use :: ccpp_types, & - only: CCPP_STR_LEN, ccpp_t - use :: ccpp, & - only: ccpp_init, ccpp_finalize - use :: ccpp_fcall, & - only: ccpp_run - use :: ccpp_fields, & - only: ccpp_field_add + use :: ccpp_api, & + only: CCPP_STR_LEN, & + ccpp_t, & + ccpp_init, & + ccpp_finalize, & + ccpp_physics_run, & + ccpp_field_add implicit none @@ -75,7 +74,7 @@ program test_check ! Initalize the CCPP (with the filename of the suite to load). call ccpp_init(filename, cdata, ierr) if (ierr /= 0) then - call exit(1) + call exit(1) end if ! Add all the fields we want to expose to the physics driver. @@ -90,7 +89,7 @@ program test_check call ccpp_field_add(cdata, 'northward_wind', v, ierr, 'm s-1') - call ccpp_run(cdata%suite%groups(1)%subcycles(1)%schemes(1), cdata, ierr) + call ccpp_physics_run(cdata, scheme_name="test", ierr=ierr) print *, 'In test dummy main' print *, 'gravity: ', gravity From b2f2df2a6fec92ebf5813346c14adeaebebf0655 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 24 Apr 2018 14:55:49 -0600 Subject: [PATCH 7/7] Print suite after parsing SDF if ccpp-framework is compiled in debug mode --- src/ccpp_suite.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ccpp_suite.F90 b/src/ccpp_suite.F90 index b3a96e57..cb02ac68 100644 --- a/src/ccpp_suite.F90 +++ b/src/ccpp_suite.F90 @@ -174,7 +174,7 @@ subroutine ccpp_suite_init(filename, suite, ierr) call ccpp_xml_ele_next(group, CCPP_XML_ELE_GROUP, group, ierr) end do -#if 0 +#ifdef DEBUG write(6, '(A)') '--------------------------------------------------------------------------------' write(6, '(A)') 'CCPP suite configuration parsed from SDF ' // trim(filename) write(6, '(A)') '--------------------------------------------------------------------------------'