diff --git a/src/SIS_debugging.F90 b/src/SIS_debugging.F90 index 8ae82b8a..37a01055 100644 --- a/src/SIS_debugging.F90 +++ b/src/SIS_debugging.F90 @@ -53,16 +53,16 @@ module SIS_debugging public :: hchksum_pair, Bchksum_pair, uvchksum interface hchksum_pair - module procedure hchksum_pair_3d, hchksum_pair_2d + module procedure hchksum_pair_3d, hchksum_pair_2d end interface hchksum_pair interface Bchksum_pair - module procedure Bchksum_pair_3d, Bchksum_pair_2d + module procedure Bchksum_pair_3d, Bchksum_pair_2d end interface Bchksum_pair interface uvchksum - module procedure uvchksum_3d, uvchksum_2d - module procedure uvchksum_3d_dG, uvchksum_2d_dG + module procedure uvchksum_3d, uvchksum_2d + module procedure uvchksum_3d_dG, uvchksum_2d_dG end interface uvchksum interface check_redundant_C @@ -90,7 +90,7 @@ module SIS_debugging !> SIS_debugging_init initializes the SIS_debugging module, and sets !! the parameterts that control which checks are active for SIS2. subroutine SIS_debugging_init(param_file) - type(param_file_type), intent(in) :: param_file + type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters ! This include declares and sets the variable "version". #include "version_variable.h" character(len=40) :: mdl = "SIS_debugging" ! This module's name. @@ -112,14 +112,19 @@ subroutine SIS_debugging_init(param_file) end subroutine SIS_debugging_init +!> Check duplicated points of 3-d C-grid vectors for consistency and +!! document offending points subroutine check_redundant_vC3d(mesg, u_comp, v_comp, G, is, ie, js, je, & direction) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%IsdB:,G%jsd:,:), intent(in) :: u_comp - real, dimension(G%isd:,G%JsdB:,:), intent(in) :: v_comp - integer, optional, intent(in) :: is, ie, js, je - integer, optional, intent(in) :: direction + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%IsdB:,G%jsd:,:), intent(in) :: u_comp !< The u-component of the vector being checked + real, dimension(G%isd:,G%JsdB:,:), intent(in) :: v_comp !< The v-component of the vector being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on + integer, optional, intent(in) :: direction !< The direction flag to pass to pass_vector ! Arguments: u_comp - The u-component of the vector being checked. ! (in) v_comp - The v-component of the vector being checked. ! (in) mesg - A message indicating what is being checked. @@ -141,20 +146,19 @@ subroutine check_redundant_vC3d(mesg, u_comp, v_comp, G, is, ie, js, je, & enddo end subroutine check_redundant_vC3d +!> Check duplicated points of 2-d C-grid vectors for consistency and +!! document offending points subroutine check_redundant_vC2d(mesg, u_comp, v_comp, G, is, ie, js, je, & direction) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%IsdB:,G%jsd:), intent(in) :: u_comp - real, dimension(G%isd:,G%JsdB:), intent(in) :: v_comp - integer, optional, intent(in) :: is, ie, js, je - integer, optional, intent(in) :: direction -! Arguments: u_comp - The u-component of the vector being checked. -! (in) v_comp - The v-component of the vector being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. -! (in/opt) direction - the direction flag to be passed to pass_vector. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%IsdB:,G%jsd:), intent(in) :: u_comp !< The u-component of the vector being checked + real, dimension(G%isd:,G%JsdB:), intent(in) :: v_comp !< The v-component of the vector being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on + integer, optional, intent(in) :: direction !< The direction flag to pass to pass_vector real :: u_nonsym(G%isd:G%ied,G%jsd:G%jed) real :: v_nonsym(G%isd:G%ied,G%jsd:G%jed) @@ -216,15 +220,16 @@ subroutine check_redundant_vC2d(mesg, u_comp, v_comp, G, is, ie, js, je, & end subroutine check_redundant_vC2d +!> Check duplicated points of 3-d B-grid scalars for consistency and +!! document offending points subroutine check_redundant_sB3d(mesg, array, G, is, ie, js, je) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%IsdB:,G%JsdB:,:), intent(in) :: array - integer, optional, intent(in) :: is, ie, js, je -! Arguments: array - The array being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%IsdB:,G%JsdB:,:), intent(in) :: array !< The array being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on character(len=24) :: mesg_k integer :: k @@ -240,16 +245,16 @@ subroutine check_redundant_sB3d(mesg, array, G, is, ie, js, je) enddo end subroutine check_redundant_sB3d - +!> Check duplicated points of 2-d B-grid scalars for consistency and +!! document offending points subroutine check_redundant_sB2d(mesg, array, G, is, ie, js, je) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%IsdB:,G%JsdB:), intent(in) :: array - integer, optional, intent(in) :: is, ie, js, je -! Arguments: array - The array being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%IsdB:,G%JsdB:), intent(in) :: array !< The array being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on real :: a_nonsym(G%isd:G%ied,G%jsd:G%jed) real :: a_resym(G%IsdB:G%IedB,G%JsdB:G%JedB) @@ -299,21 +304,19 @@ subroutine check_redundant_sB2d(mesg, array, G, is, ie, js, je) end subroutine check_redundant_sB2d - +!> Check duplicated points of 3-d B-grid vectors for consistency and +!! document offending points subroutine check_redundant_vB3d(mesg, u_comp, v_comp, G, is, ie, js, je, & direction) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%IsdB:,G%JsdB:,:), intent(in) :: u_comp - real, dimension(G%IsdB:,G%JsdB:,:), intent(in) :: v_comp - integer, optional, intent(in) :: is, ie, js, je - integer, optional, intent(in) :: direction -! Arguments: u_comp - The u-component of the vector being checked. -! (in) v_comp - The v-component of the vector being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. -! (in/opt) direction - the direction flag to be passed to pass_vector. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%IsdB:,G%JsdB:,:), intent(in) :: u_comp !< The u-component of the vector being checked + real, dimension(G%IsdB:,G%JsdB:,:), intent(in) :: v_comp !< The v-component of the vector being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on + integer, optional, intent(in) :: direction !< The direction flag to pass to pass_vector character(len=24) :: mesg_k integer :: k @@ -329,20 +332,19 @@ subroutine check_redundant_vB3d(mesg, u_comp, v_comp, G, is, ie, js, je, & enddo end subroutine check_redundant_vB3d +!> Check duplicated points of 2-d B-grid vectors for consistency and +!! document offending points subroutine check_redundant_vB2d(mesg, u_comp, v_comp, G, is, ie, js, je, & direction) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%IsdB:,G%JsdB:), intent(in) :: u_comp - real, dimension(G%IsdB:,G%JsdB:), intent(in) :: v_comp - integer, optional, intent(in) :: is, ie, js, je - integer, optional, intent(in) :: direction -! Arguments: u_comp - The u-component of the vector being checked. -! (in) v_comp - The v-component of the vector being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. -! (in/opt) direction - the direction flag to be passed to pass_vector. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%IsdB:,G%JsdB:), intent(in) :: u_comp !< The u-component of the vector being checked + real, dimension(G%IsdB:,G%JsdB:), intent(in) :: v_comp !< The v-component of the vector being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on + integer, optional, intent(in) :: direction !< The direction flag to pass to pass_vector real :: u_nonsym(G%isd:G%ied,G%jsd:G%jed) real :: v_nonsym(G%isd:G%ied,G%jsd:G%jed) @@ -405,15 +407,16 @@ subroutine check_redundant_vB2d(mesg, u_comp, v_comp, G, is, ie, js, je, & end subroutine check_redundant_vB2d +!> Check duplicated points of 3-d cell-centered scalars for consistency and +!! document offending points subroutine check_redundant_sT3d(mesg, array, G, is, ie, js, je) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%isd:,G%jsd:,:), intent(in) :: array - integer, optional, intent(in) :: is, ie, js, je -! Arguments: array - The array being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%isd:,G%jsd:,:), intent(in) :: array !< The array being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on character(len=24) :: mesg_k integer :: k @@ -429,16 +432,16 @@ subroutine check_redundant_sT3d(mesg, array, G, is, ie, js, je) enddo end subroutine check_redundant_sT3d - +!> Check duplicated points of 2-d cell-centered scalars for consistency and +!! document offending points subroutine check_redundant_sT2d(mesg, array, G, is, ie, js, je) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%isd:,G%jsd:), intent(in) :: array - integer, optional, intent(in) :: is, ie, js, je -! Arguments: array - The array being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%isd:,G%jsd:), intent(in) :: array !< The array being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on real :: a_nonsym(G%isd:G%ied,G%jsd:G%jed) character(len=128) :: mesg2 @@ -474,21 +477,19 @@ subroutine check_redundant_sT2d(mesg, array, G, is, ie, js, je) end subroutine check_redundant_sT2d - +!> Check duplicated points of 3-d A-grid vectors for consistency and +!! document offending points subroutine check_redundant_vT3d(mesg, u_comp, v_comp, G, is, ie, js, je, & direction) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%isd:,G%jsd:,:), intent(in) :: u_comp - real, dimension(G%isd:,G%jsd:,:), intent(in) :: v_comp - integer, optional, intent(in) :: is, ie, js, je - integer, optional, intent(in) :: direction -! Arguments: u_comp - The u-component of the vector being checked. -! (in) v_comp - The v-component of the vector being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. -! (in/opt) direction - the direction flag to be passed to pass_vector. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%isd:,G%jsd:,:), intent(in) :: u_comp !< The u-component of the vector being checked + real, dimension(G%isd:,G%jsd:,:), intent(in) :: v_comp !< The v-component of the vector being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on + integer, optional, intent(in) :: direction !< The direction flag to pass to pass_vector character(len=24) :: mesg_k integer :: k @@ -504,20 +505,19 @@ subroutine check_redundant_vT3d(mesg, u_comp, v_comp, G, is, ie, js, je, & enddo end subroutine check_redundant_vT3d +!> Check duplicated points of 2-d A-grid vectors for consistency and +!! document offending points subroutine check_redundant_vT2d(mesg, u_comp, v_comp, G, is, ie, js, je, & direction) - character(len=*), intent(in) :: mesg - type(SIS_hor_grid_type), intent(inout) :: G - real, dimension(G%isd:,G%jsd:), intent(in) :: u_comp - real, dimension(G%isd:,G%jsd:), intent(in) :: v_comp - integer, optional, intent(in) :: is, ie, js, je - integer, optional, intent(in) :: direction -! Arguments: u_comp - The u-component of the vector being checked. -! (in) v_comp - The v-component of the vector being checked. -! (in) mesg - A message indicating what is being checked. -! (in) G - The ocean's grid structure. -! (in/opt) is, ie, js, je - the i- and j- range of indices to check. -! (in/opt) direction - the direction flag to be passed to pass_vector. + character(len=*), intent(in) :: mesg !< An identifying message + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + real, dimension(G%isd:,G%jsd:), intent(in) :: u_comp !< The u-component of the vector being checked + real, dimension(G%isd:,G%jsd:), intent(in) :: v_comp !< The v-component of the vector being checked + integer, optional, intent(in) :: is !< The starting i-index to work on + integer, optional, intent(in) :: ie !< The ending i-index to work on + integer, optional, intent(in) :: js !< The starting j-index to work on + integer, optional, intent(in) :: je !< The ending j-index to work on + integer, optional, intent(in) :: direction !< The direction flag to pass to pass_vector real :: u_nonsym(G%isd:G%ied,G%jsd:G%jed) real :: v_nonsym(G%isd:G%ied,G%jsd:G%jed) @@ -569,7 +569,7 @@ end subroutine check_redundant_vT2d ! ===================================================================== -! This function does a checksum and redundant point check on a 3d C-grid vector. +!> This subroutine does a checksum and redundant point check on a 3d C-grid vector. subroutine uvchksum_3d(mesg, u_comp, v_comp, G, halos, scalars) character(len=*), intent(in) :: mesg !< An identifying message type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure @@ -595,9 +595,9 @@ subroutine uvchksum_3d(mesg, u_comp, v_comp, G, halos, scalars) end subroutine uvchksum_3d -! This function does a checksum and redundant point check on a 2d C-grid vector. +!> This subroutine does a checksum and redundant point check on a 2d C-grid vector. subroutine uvchksum_2d(mesg, u_comp, v_comp, G, halos, scalars) - character(len=*), intent(in) :: mesg !< An identifying message + character(len=*), intent(in) :: mesg !< An identifying message type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure real, dimension(G%IsdB:,G%jsd:), intent(in) :: u_comp !< The u-component of the vector real, dimension(G%isd:,G%JsdB:), intent(in) :: v_comp !< The v-component of the vector @@ -621,10 +621,10 @@ subroutine uvchksum_2d(mesg, u_comp, v_comp, G, halos, scalars) end subroutine uvchksum_2d -! This function does a checksum and redundant point check on a 3d C-grid vector. +!> This subroutine does a checksum and redundant point check on a 3d C-grid vector. subroutine uvchksum_3d_dG(mesg, u_comp, v_comp, G, halos) character(len=*), intent(in) :: mesg !< An identifying message - type(dyn_horgrid_type), intent(inout) :: G !< The ocean's grid structure + type(dyn_horgrid_type), intent(inout) :: G !< The ocean's grid structure real, dimension(G%IsdB:,G%jsd:,:), intent(in) :: u_comp !< The u-component of the vector real, dimension(G%isd:,G%JsdB:,:), intent(in) :: v_comp !< The v-component of the vector integer, optional, intent(in) :: halos !< The width of halos to check (default 0) @@ -635,9 +635,9 @@ subroutine uvchksum_3d_dG(mesg, u_comp, v_comp, G, halos) end subroutine uvchksum_3d_dG -! This function does a checksum and redundant point check on a 2d C-grid vector. +!> This subroutine does a checksum and redundant point check on a 2d C-grid vector. subroutine uvchksum_2d_dG(mesg, u_comp, v_comp, G, halos) - character(len=*), intent(in) :: mesg !< An identifying message + character(len=*), intent(in) :: mesg !< An identifying message type(dyn_horgrid_type), intent(inout) :: G !< The ocean's grid structure real, dimension(G%IsdB:,G%jsd:), intent(in) :: u_comp !< The u-component of the vector real, dimension(G%isd:,G%JsdB:), intent(in) :: v_comp !< The v-component of the vector @@ -649,7 +649,7 @@ subroutine uvchksum_2d_dG(mesg, u_comp, v_comp, G, halos) end subroutine uvchksum_2d_dG -! This function does a checksum and redundant point check on a 3d B-grid vector. +!> This subroutine does a checksum and redundant point check on a 3d B-grid vector. subroutine Bchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars) character(len=*), intent(in) :: mesg !< An identifying message type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure @@ -675,7 +675,7 @@ subroutine Bchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars) end subroutine Bchksum_pair_3d -! This function does a checksum and redundant point check on a 2d B-grid vector. +!> This subroutine does a checksum and redundant point check on a 2d B-grid vector. subroutine Bchksum_pair_2d(mesg, u_comp, v_comp, G, halos, scalars, symmetric) character(len=*), intent(in) :: mesg !< An identifying message type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure @@ -703,7 +703,7 @@ subroutine Bchksum_pair_2d(mesg, u_comp, v_comp, G, halos, scalars, symmetric) end subroutine Bchksum_pair_2d -! This function does a checksum and redundant point check on a 3d C-grid vector. +!> This subroutine does a checksum and redundant point check on a 3d C-grid vector. subroutine hchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars) character(len=*), intent(in) :: mesg !< An identifying message type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure @@ -729,7 +729,7 @@ subroutine hchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars) end subroutine hchksum_pair_3d -! This function does a checksum and redundant point check on a 2d C-grid vector. +!> This subroutine does a checksum and redundant point check on a 2d C-grid vector. subroutine hchksum_pair_2d(mesg, u_comp, v_comp, G, halos, scalars) character(len=*), intent(in) :: mesg !< An identifying message type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure diff --git a/src/SIS_sum_output.F90 b/src/SIS_sum_output.F90 index 6b1a18a8..76690280 100644 --- a/src/SIS_sum_output.F90 +++ b/src/SIS_sum_output.F90 @@ -103,23 +103,19 @@ module SIS_sum_output contains -subroutine SIS_sum_output_init(G, param_file, directory, Input_start_time, CS, & - ntrunc) - type(SIS_hor_grid_type), intent(in) :: G - type(param_file_type), intent(in) :: param_file - character(len=*), intent(in) :: directory - type(time_type), intent(in) :: Input_start_time - type(SIS_sum_out_CS), pointer :: CS - integer, target, optional,intent(inout) :: ntrunc -! Arguments: G - The sea ice model's grid structure. -! (in) param_file - A structure indicating the open file to parse for -! model parameter values. -! (in) directory - The directory where the statistics file goes. -! (in) Input_start_time - The start time of the simulation. -! (in/out) CS - A pointer that is set to point to the control structure -! for this module -! (in/out,opt) ntrunc - The integer that stores the number of times the velocity -! has been truncated since the last call to write_ice_statistics. +!> Initialize the SIS_sum_output control structure, allocate memory and store runtime parameters. +subroutine SIS_sum_output_init(G, param_file, directory, Input_start_time, CS, ntrunc) + type(SIS_hor_grid_type), intent(in) :: G !< The horizontal grid type + type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters + character(len=*), intent(in) :: directory !< The directory where the statistics file goes + type(time_type), intent(in) :: Input_start_time !< The start time of the simulation + type(SIS_sum_out_CS), pointer :: CS !< A pointer that is set to point to the control + !! structure for this module + integer, target, optional,intent(inout) :: ntrunc !< The integer that stores the number of times + !! the velocity has been truncated since the + !! last call to write_ice_statistics + + ! Local variables real :: Rho_0, maxvel ! This include declares and sets the variable "version". #include "version_variable.h" @@ -191,46 +187,39 @@ subroutine SIS_sum_output_init(G, param_file, directory, Input_start_time, CS, & end subroutine SIS_sum_output_init +!> Deallocate memory associated with the SIS_sum_out control structure subroutine SIS_sum_output_end(CS) - type(SIS_sum_out_CS), pointer :: CS + type(SIS_sum_out_CS), pointer :: CS !< The control structure returned by a previous call to + !! SIS_sum_output_init that is deallocated here ! This subroutine deallocates the memory owned by this module. -! Argument: CS - The control structure returned by a previous call to -! SIS_sum_output_init. if (associated(CS)) then deallocate(CS) endif end subroutine SIS_sum_output_end +!> Write out the sea ice statistics of the total sea-ice mass, heat and salt by +!! hemisphere and other globally integrated quantities. subroutine write_ice_statistics(IST, day, n, G, IG, CS, message, check_column, tracer_CSp) - type(ice_state_type), intent(inout) :: IST - - type(time_type), intent(inout) :: day - integer, intent(in) :: n - type(SIS_hor_grid_type), intent(inout) :: G - type(ice_grid_type), intent(inout) :: IG - type(SIS_sum_out_CS), pointer :: CS - character(len=*), optional, intent(in) :: message - logical, optional, intent(in) :: check_column - type(SIS_tracer_flow_control_CS), optional, pointer :: tracer_CSp + type(ice_state_type), intent(inout) :: IST !< A type describing the state of the sea ice + type(time_type), intent(inout) :: day !< The current model time. + integer, intent(in) :: n !< The time step number of the current execution + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + type(ice_grid_type), intent(inout) :: IG !< The sea-ice specific grid type + type(SIS_sum_out_CS), pointer :: CS !< The control structure returned by a previous + !! call to SIS_sum_output_init + character(len=*), optional, intent(in) :: message !< A text message to use with this output + logical, optional, intent(in) :: check_column !< If true, check for column-wise heat and + !! mass conservation. + type(SIS_tracer_flow_control_CS), & + optional, pointer :: tracer_CSp !< A pointer to the tracer package flow + !! control module to enable the writing of + !! the passive tracer statistics. ! This subroutine calculates and writes the total sea-ice mass by ! hemisphere, heat, salt, and other globally integrated quantities. -! Arguments: u - Zonal velocity, in m s-1. -! (in) v - Meridional velocity, in m s-1. -! (in) h - Layer thickness, in m. -! (in) tv - A structure containing pointers to any available -! thermodynamic fields, including potential temperature and -! salinity or mixed layer density. Absent fields have NULL ptrs. -! (in/out) day - The current model time. -! (in) n - The time step number of the current execution. -! (in) G - The sea ice model's grid structure. -! (in) CS - The control structure returned by a previous call to -! SIS_sum_output_init. -! (in,opt) message - A text message to use with this output. -! (in,opt) check_column - If true, check for column-wise heat and mass conservation. - + ! Local variables real, dimension(SZI_(G),SZJ_(G), 2) :: & ice_area, & ! The area of ice in each cell and hemisphere, in m2. ice_extent, & ! The extent (cells with >10% coverage) of ice in each @@ -361,10 +350,10 @@ subroutine write_ice_statistics(IST, day, n, G, IG, CS, message, check_column, t ! nTr_stocks = 0 ! if (present(tracer_CSp)) then -! call call_tracer_stocks(h, Tr_stocks, G, tracer_CSp, stock_names=Tr_names, stock_units=Tr_units, num_stocks=nTr_stocks,& -! got_min_max=Tr_minmax_got, global_min=Tr_min, global_max=Tr_max, & -! xgmin=Tr_min_x, ygmin=Tr_min_y, zgmin=Tr_min_z,& -! xgmax=Tr_max_x, ygmax=Tr_max_y, zgmax=Tr_max_z) +! call call_tracer_stocks(h, Tr_stocks, G, tracer_CSp, stock_names=Tr_names, stock_units=Tr_units, & +! num_stocks=nTr_stocks, got_min_max=Tr_minmax_got, global_min=Tr_min, global_max=Tr_max, & +! xgmin=Tr_min_x, ygmin=Tr_min_y, zgmin=Tr_min_z,& +! xgmax=Tr_max_x, ygmax=Tr_max_y, zgmax=Tr_max_z) ! if (nTr_stocks > 0) then ! do m=1,nTr_stocks ! vars(num_nc_fields+m) = & @@ -713,24 +702,23 @@ subroutine write_ice_statistics(IST, day, n, G, IG, CS, message, check_column, t end subroutine write_ice_statistics +!> Accumulate the net input of fresh water and heat through the bottom of the +!! sea-ice for conservation checks. subroutine accumulate_bottom_input(IST, OSS, FIA, IOF, dt, G, IG, CS) -! This subroutine accumulates the net input of fresh water and heat through -! the bottom of the sea-ice for conservation checks. -! Arguments: IST - The internal sea ice state type. -! (in) dt - The amount of time over which to average. -! (in) G - The sea ice model's grid structure. -! (in) IG - The sea-ice-specific grid structure. -! (in) CS - The control structure returned by a previous call to -! SIS_sum_output_init. - type(SIS_hor_grid_type), intent(in) :: G - type(ice_grid_type), intent(in) :: IG - type(ice_state_type), intent(in) :: IST - type(ocean_sfc_state_type), intent(in) :: OSS - type(fast_ice_avg_type), intent(in) :: FIA - type(ice_ocean_flux_type), intent(in) :: IOF - real, intent(in) :: dt - type(SIS_sum_out_CS), pointer :: CS - + type(SIS_hor_grid_type), intent(in) :: G !< The horizontal grid type + type(ice_grid_type), intent(in) :: IG !< The sea-ice specific grid type + type(ice_state_type), intent(in) :: IST !< A type describing the state of the sea ice + type(ocean_sfc_state_type), intent(in) :: OSS !< A structure containing the arrays that describe + !! the ocean's surface state for the ice model. + type(fast_ice_avg_type), intent(in) :: FIA !< A type containing averages of fields + !! (mostly fluxes) over the fast updates + type(ice_ocean_flux_type), intent(in) :: IOF !< A structure containing fluxes from the ice to + !! the ocean that are calculated by the ice model. + real, intent(in) :: dt !< The amount of time over which to average. + type(SIS_sum_out_CS), pointer :: CS !< The control structure returned by a previous call + !! to SIS_sum_output_init. + + ! Local variables real :: Flux_SW, enth_units, LI integer :: i, j, k, isc, iec, jsc, jec, ncat, b, nb @@ -764,24 +752,21 @@ subroutine accumulate_bottom_input(IST, OSS, FIA, IOF, dt, G, IG, CS) end subroutine accumulate_bottom_input +!> Accumulate the net input of fresh water and heat through the top of the +!! sea-ice for conservation checks with the first phase of the updates subroutine accumulate_input_1(IST, FIA, OSS, dt, G, IG, CS) -! This subroutine accumulates the net input of fresh water and heat through -! the top of the sea-ice for conservation checks. - -! Arguments: IST - The internal sea ice state type. -! (in) dt - The amount of time over which to average. -! (in) IG - The sea-ice-specific grid structure. -! (in) G - The sea ice model's grid structure. -! (in) CS - The control structure returned by a previous call to -! SIS_sum_output_init. - type(ice_state_type), intent(in) :: IST - type(fast_ice_avg_type), intent(in) :: FIA - type(ocean_sfc_state_type), intent(in) :: OSS - real, intent(in) :: dt - type(SIS_hor_grid_type), intent(in) :: G - type(ice_grid_type), intent(in) :: IG - type(SIS_sum_out_CS), pointer :: CS - + type(ice_state_type), intent(in) :: IST !< A type describing the state of the sea ice + type(fast_ice_avg_type), intent(in) :: FIA !< A type containing averages of fields + !! (mostly fluxes) over the fast updates + type(ocean_sfc_state_type), intent(in) :: OSS !< A structure containing the arrays that describe + !! the ocean's surface state for the ice model. + real, intent(in) :: dt !< The amount of time over which to average. + type(SIS_hor_grid_type), intent(in) :: G !< The horizontal grid type + type(ice_grid_type), intent(in) :: IG !< The sea-ice specific grid type + type(SIS_sum_out_CS), pointer :: CS !< The control structure returned by a previous call + !! to SIS_sum_output_init. + + ! Local variables real, dimension(SZI_(G),SZJ_(G)) :: & FW_in, & ! The net fresh water input, integrated over a timestep in kg. salt_in, & ! The total salt added by surface fluxes, integrated @@ -826,29 +811,26 @@ subroutine accumulate_input_1(IST, FIA, OSS, dt, G, IG, CS) end subroutine accumulate_input_1 +!> Accumulate the net input of fresh water and heat through the top of the +!! sea-ice for conservation checks, with a second phase of the updates subroutine accumulate_input_2(IST, FIA, IOF, OSS, part_size, dt, G, IG, CS) -! This subroutine accumulates the net input of fresh water and heat through -! the top of the sea-ice for conservation checks. - -! Arguments: IST - The internal sea ice state type. -! (in) part_size - The fractional ice concentration within a cell in each -! thickness category, nondimensional, 0-1. -! (in) dt - The amount of time over which to average. -! (in) G - The sea ice model's grid structure. -! (in) IG - The sea-ice-specific grid structure. -! (in) CS - The control structure returned by a previous call to -! SIS_sum_output_init. - type(SIS_hor_grid_type), intent(inout) :: G - type(ice_grid_type), intent(inout) :: IG - type(ice_state_type), intent(inout) :: IST - type(fast_ice_avg_type), intent(in) :: FIA - type(ice_ocean_flux_type), intent(in) :: IOF - type(ocean_sfc_state_type), intent(in) :: OSS + type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type + type(ice_grid_type), intent(inout) :: IG !< The sea-ice specific grid type + type(ice_state_type), intent(inout) :: IST !< A type describing the state of the sea ice + type(fast_ice_avg_type), intent(in) :: FIA !< A type containing averages of fields + !! (mostly fluxes) over the fast updates + type(ice_ocean_flux_type), intent(in) :: IOF !< A structure containing fluxes from the ice to + !! the ocean that are calculated by the ice model. + type(ocean_sfc_state_type), intent(in) :: OSS !< A structure containing the arrays that describe + !! the ocean's surface state for the ice model. real, dimension(SZI_(G),SZJ_(G),SZCAT0_(IG)), & - intent(in) :: part_size - real, intent(in) :: dt - type(SIS_sum_out_CS), pointer :: CS + intent(in) :: part_size !< The fractional ice concentration within a + !! cell in each thickness category, nondimensional, 0-1. + real, intent(in) :: dt !< The amount of time over which to average. + type(SIS_sum_out_CS), pointer :: CS !< The control structure returned by a previous call + !! to SIS_sum_output_init. + ! Local variables real :: area_pt, Flux_SW, pen_frac real :: enth_units, LI integer :: i, j, k, m, isc, iec, jsc, jec, ncat, b, nb