Skip to content

Commit

Permalink
Merge branch 'rescale_lengths' of https://github.com/Hallberg-NOAA/SIS2
Browse files Browse the repository at this point in the history
… into rescale_lengths
  • Loading branch information
Hallberg-NOAA committed Dec 2, 2019
2 parents 29e266d + f803d26 commit 6d99ded
Show file tree
Hide file tree
Showing 22 changed files with 1,377 additions and 1,060 deletions.
139 changes: 73 additions & 66 deletions src/SIS_continuity.F90

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions src/SIS_ctrl_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module SIS_ctrl_types
use MOM_file_parser, only : param_file_type
use MOM_hor_index, only : hor_index_type
use MOM_time_manager, only : time_type, time_type_to_real
use MOM_unit_scaling, only : unit_scale_type
use SIS_diag_mediator, only : SIS_diag_ctrl, post_data=>post_SIS_data
use SIS_diag_mediator, only : register_SIS_diag_field, register_static_field
use SIS_sum_output, only : SIS_sum_out_CS
Expand Down Expand Up @@ -74,6 +75,7 @@ module SIS_ctrl_types
!! shortwave radiation.

type(SIS_hor_grid_type), pointer :: G => NULL() !< A structure containing metrics and grid info.
type(unit_scale_type), pointer :: US => NULL() !< A structure containing various unit conversion factors.
type(ice_grid_type), pointer :: IG => NULL() !< A structure containing sea-ice specific grid info.
type(simple_OSS_type), pointer :: sOSS => NULL() !< A structure containing the arrays
!! that describe the ocean's surface state, as it is revealed
Expand Down Expand Up @@ -148,6 +150,7 @@ module SIS_ctrl_types
type(SIS_diag_ctrl) :: diag !< A structure that regulates diagnostics.

type(SIS_hor_grid_type), pointer :: G => NULL() !< A structure containing metrics and grid info.
type(unit_scale_type), pointer :: US => NULL() !< A structure containing various unit conversion factors.
type(ice_grid_type), pointer :: IG => NULL() !< A structure containing sea-ice specific grid info.
type(ocean_sfc_state_type), pointer :: OSS => NULL() !< A structure containing the arrays
!! that describe the ocean's surface state, as it is revealed
Expand Down Expand Up @@ -175,14 +178,15 @@ module SIS_ctrl_types

!> ice_diagnostics_init does the registration for a variety of sea-ice model
!! diagnostics and saves several static diagnotic fields.
subroutine ice_diagnostics_init(IOF, OSS, FIA, G, IG, diag, Time, Cgrid)
subroutine ice_diagnostics_init(IOF, OSS, FIA, G, US, IG, diag, Time, Cgrid)
type(ice_ocean_flux_type), intent(inout) :: IOF !< A structure containing fluxes from the ice to
!! the ocean that are calculated by the ice model.
type(ocean_sfc_state_type), intent(inout) :: OSS !< A structure containing the arrays that describe
!! the ocean's surface state for the ice model.
type(fast_ice_avg_type), intent(inout) :: FIA !< A type containing averages of fields
!! (mostly fluxes) over the fast updates
type(SIS_hor_grid_type), intent(inout) :: G !< The horizontal grid type
type(unit_scale_type), intent(in) :: US !< A structure with unit conversion factors
type(ice_grid_type), intent(in) :: IG !< The sea-ice specific grid type
type(SIS_diag_ctrl), intent(in) :: diag !< A structure that is used to regulate diagnostic output
type(time_type), intent(inout) :: Time !< The sea-ice model's clock,
Expand Down Expand Up @@ -320,18 +324,18 @@ subroutine ice_diagnostics_init(IOF, OSS, FIA, G, IG, diag, Time, Cgrid)

if (Cgrid_dyn) then
OSS%id_uo = register_SIS_diag_field('ice_model', 'UO', diag%axesCu1, Time, &
'surface current - x component', 'm/s', missing_value=missing, &
interp_method='none')
'surface current - x component', 'm/s', conversion=US%L_T_to_m_s, &
missing_value=missing, interp_method='none')
OSS%id_vo = register_SIS_diag_field('ice_model', 'VO', diag%axesCv1, Time, &
'surface current - y component', 'm/s', missing_value=missing, &
interp_method='none')
'surface current - y component', 'm/s', conversion=US%L_T_to_m_s, &
missing_value=missing, interp_method='none')
else
OSS%id_uo = register_SIS_diag_field('ice_model', 'UO', diag%axesB1, Time, &
'surface current - x component', 'm/s', missing_value=missing, &
interp_method='none')
'surface current - x component', 'm/s', conversion=US%L_T_to_m_s, &
missing_value=missing, interp_method='none')
OSS%id_vo = register_SIS_diag_field('ice_model', 'VO', diag%axesB1, Time, &
'surface current - y component', 'm/s', missing_value=missing, &
interp_method='none')
'surface current - y component', 'm/s', conversion=US%L_T_to_m_s, &
missing_value=missing, interp_method='none')
endif

OSS%id_frazil = register_SIS_diag_field('ice_model', 'FRAZIL', diag%axesT1, Time, &
Expand Down Expand Up @@ -366,7 +370,7 @@ subroutine ice_diagnostics_init(IOF, OSS, FIA, G, IG, diag, Time, Cgrid)
I_area_Earth = 1.0 / (16.0*atan(1.0)*G%Rad_Earth**2)
!$OMP parallel do default(none) shared(isc,iec,jsc,jec,G,I_area_Earth,tmp_diag)
do j=jsc,jec ; do i=isc,iec
tmp_diag(i,j) = (G%areaT(i,j) * G%mask2dT(i,j)) * I_area_Earth
tmp_diag(i,j) = (US%L_to_m**2*G%areaT(i,j) * G%mask2dT(i,j)) * I_area_Earth
enddo ; enddo
call post_data(id_cell_area, tmp_diag, diag, is_static=.true.)
endif
Expand Down
40 changes: 24 additions & 16 deletions src/SIS_debugging.F90
Original file line number Diff line number Diff line change
Expand Up @@ -554,20 +554,21 @@ end subroutine check_redundant_vT2d
! =====================================================================

!> 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)
subroutine uvchksum_3d(mesg, u_comp, v_comp, G, halos, scalars, scale)
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
integer, optional, intent(in) :: halos !< The width of halos to check (default 0)
logical, optional, intent(in) :: scalars !< If true this is a pair of
!! scalars that are being checked.
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

logical :: are_scalars
are_scalars = .false. ; if (present(scalars)) are_scalars = scalars

if (debug_chksums) then
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos)
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos, scale=scale)
endif
if (debug_redundant) then
if (are_scalars) then
Expand All @@ -580,20 +581,21 @@ subroutine uvchksum_3d(mesg, u_comp, v_comp, G, halos, scalars)
end subroutine uvchksum_3d

!> 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)
subroutine uvchksum_2d(mesg, u_comp, v_comp, G, halos, scalars, scale)
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
integer, optional, intent(in) :: halos !< The width of halos to check (default 0)
logical, optional, intent(in) :: scalars !< If true this is a pair of
!! scalars that are being checked.
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

logical :: are_scalars
are_scalars = .false. ; if (present(scalars)) are_scalars = scalars

if (debug_chksums) then
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos)
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos, scale=scale)
endif
if (debug_redundant) then
if (are_scalars) then
Expand All @@ -606,48 +608,51 @@ subroutine uvchksum_2d(mesg, u_comp, v_comp, G, halos, scalars)
end subroutine uvchksum_2d

!> 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)
subroutine uvchksum_3d_dG(mesg, u_comp, v_comp, G, halos, scale)
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
integer, optional, intent(in) :: halos !< The width of halos to check (default 0)
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

if (debug_chksums) then
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos)
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos, scale=scale)
endif

end subroutine uvchksum_3d_dG

!> 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)
subroutine uvchksum_2d_dG(mesg, u_comp, v_comp, G, halos, scale)
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
integer, optional, intent(in) :: halos !< The width of halos to check (default 0)
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

if (debug_chksums) then
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos)
call mom_uvchksum(mesg, u_comp, v_comp, G%HI, halos, scale=scale)
endif

end subroutine uvchksum_2d_dG

!> 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)
subroutine Bchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars, scale)
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%JsdB:,:), intent(in) :: u_comp !< The u-component of the vector
real, dimension(G%IsdB:,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)
logical, optional, intent(in) :: scalars !< If true this is a pair of
!! scalars that are being checked.
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

logical :: are_scalars
are_scalars = .false. ; if (present(scalars)) are_scalars = scalars

if (debug_chksums) then
call mom_Bchksum_pair(mesg, u_comp, v_comp, G%HI, halos)
call mom_Bchksum_pair(mesg, u_comp, v_comp, G%HI, halos, scale=scale)
endif
if (debug_redundant) then
if (are_scalars) then
Expand All @@ -660,7 +665,7 @@ subroutine Bchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars)
end subroutine Bchksum_pair_3d

!> 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)
subroutine Bchksum_pair_2d(mesg, u_comp, v_comp, G, halos, scalars, symmetric, scale)
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%JsdB:), intent(in) :: u_comp !< The u-component of the vector
Expand All @@ -670,12 +675,13 @@ subroutine Bchksum_pair_2d(mesg, u_comp, v_comp, G, halos, scalars, symmetric)
!! scalars that are being checked.
logical, optional, intent(in) :: symmetric !< If true, do the checksums on the
!! full symmetric computational domain.
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

logical :: are_scalars
are_scalars = .false. ; if (present(scalars)) are_scalars = scalars

if (debug_chksums) then
call mom_Bchksum_pair(mesg, u_comp, v_comp, G%HI, symmetric=symmetric, haloshift=halos)
call mom_Bchksum_pair(mesg, u_comp, v_comp, G%HI, symmetric=symmetric, haloshift=halos, scale=scale)
endif
if (debug_redundant) then
if (are_scalars) then
Expand All @@ -688,20 +694,21 @@ subroutine Bchksum_pair_2d(mesg, u_comp, v_comp, G, halos, scalars, symmetric)
end subroutine Bchksum_pair_2d

!> 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)
subroutine hchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars, scale)
character(len=*), intent(in) :: mesg !< An identifying message
type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure
real, dimension(G%isd:,G%jsd:,:), intent(in) :: u_comp !< The u-component of the vector
real, dimension(G%isd:,G%jsd:,:), intent(in) :: v_comp !< The v-component of the vector
integer, optional, intent(in) :: halos !< The width of halos to check (default 0)
logical, optional, intent(in) :: scalars !< If true this is a pair of
!! scalars that are being checked.
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

logical :: are_scalars
are_scalars = .false. ; if (present(scalars)) are_scalars = scalars

if (debug_chksums) then
call mom_hchksum_pair(mesg, u_comp, v_comp, G%HI, halos)
call mom_hchksum_pair(mesg, u_comp, v_comp, G%HI, halos, scale=scale)
endif
if (debug_redundant) then
if (are_scalars) then
Expand All @@ -714,20 +721,21 @@ subroutine hchksum_pair_3d(mesg, u_comp, v_comp, G, halos, scalars)
end subroutine hchksum_pair_3d

!> 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)
subroutine hchksum_pair_2d(mesg, u_comp, v_comp, G, halos, scalars, scale)
character(len=*), intent(in) :: mesg !< An identifying message
type(SIS_hor_grid_type), intent(inout) :: G !< The ocean's grid structure
real, dimension(G%isd:,G%jsd:), intent(in) :: u_comp !< The u-component of the vector
real, dimension(G%isd:,G%jsd:), intent(in) :: v_comp !< The v-component of the vector
integer, optional, intent(in) :: halos !< The width of halos to check (default 0)
logical, optional, intent(in) :: scalars !< If true this is a pair of
!! scalars that are being checked.
real, optional, intent(in) :: scale !< A scaling factor for these arrays.

logical :: are_scalars
are_scalars = .false. ; if (present(scalars)) are_scalars = scalars

if (debug_chksums) then
call mom_hchksum_pair(mesg, u_comp, v_comp, G%HI, halos)
call mom_hchksum_pair(mesg, u_comp, v_comp, G%HI, halos, scale=scale)
endif
if (debug_redundant) then
if (are_scalars) then
Expand Down
Loading

0 comments on commit 6d99ded

Please sign in to comment.