From 2f2b7905c08e95a729d3dd3f8b02e0a0bed10602 Mon Sep 17 00:00:00 2001 From: Robert Hallberg Date: Thu, 6 Jun 2024 08:30:53 -0400 Subject: [PATCH] +Add optional unscale arguments to MOM_write_field Added an optional unscale argument to 10 routines under the overloaded MOM_write_field interface, mirroring the recent additions of unscale arguments to the various chksum routines. These new unscale arguments are synonymous with the existing optional scale arguments to these routines, and if both are provided, the new unscale arguments take precedence. A total of 26 MOM_write_field calls in save_restart, write_depth_list, write_Hybgen_coord_file, write_vertgrid_file and write_ocean_geometry_file were modified to replace a scale argument with the new unscale argument. All answers are bitwise identical, but there are new optional arguments to 10 publicly visible routines. --- src/ALE/MOM_hybgen_regrid.F90 | 6 +- src/diagnostics/MOM_sum_output.F90 | 6 +- src/framework/MOM_io.F90 | 181 +++++++++++++----- src/framework/MOM_restart.F90 | 10 +- .../MOM_coord_initialization.F90 | 4 +- .../MOM_shared_initialization.F90 | 42 ++-- .../vertical/MOM_bkgnd_mixing.F90 | 8 +- 7 files changed, 168 insertions(+), 89 deletions(-) diff --git a/src/ALE/MOM_hybgen_regrid.F90 b/src/ALE/MOM_hybgen_regrid.F90 index 491693549f..8c0733be78 100644 --- a/src/ALE/MOM_hybgen_regrid.F90 +++ b/src/ALE/MOM_hybgen_regrid.F90 @@ -258,9 +258,9 @@ subroutine write_Hybgen_coord_file(GV, CS, filepath) call create_MOM_file(IO_handle, trim(filepath), vars, 3, fields, & SINGLE_FILE, GV=GV) - call MOM_write_field(IO_handle, fields(1), CS%dp0k, scale=CS%coord_scale) - call MOM_write_field(IO_handle, fields(2), CS%ds0k, scale=CS%coord_scale) - call MOM_write_field(IO_handle, fields(3), CS%target_density, scale=CS%Rho_coord_scale) + call MOM_write_field(IO_handle, fields(1), CS%dp0k, unscale=CS%coord_scale) + call MOM_write_field(IO_handle, fields(2), CS%ds0k, unscale=CS%coord_scale) + call MOM_write_field(IO_handle, fields(3), CS%target_density, unscale=CS%Rho_coord_scale) call IO_handle%close() end subroutine write_Hybgen_coord_file diff --git a/src/diagnostics/MOM_sum_output.F90 b/src/diagnostics/MOM_sum_output.F90 index fb95b79a91..edb66d225c 100644 --- a/src/diagnostics/MOM_sum_output.F90 +++ b/src/diagnostics/MOM_sum_output.F90 @@ -1269,9 +1269,9 @@ subroutine write_depth_list(G, US, DL, filename) call create_MOM_file(IO_handle, filename, vars, 3, fields, SINGLE_FILE, & extra_axes=extra_axes, global_atts=global_atts) - call MOM_write_field(IO_handle, fields(1), DL%depth, scale=US%Z_to_m) - call MOM_write_field(IO_handle, fields(2), DL%area, scale=US%L_to_m**2) - call MOM_write_field(IO_handle, fields(3), DL%vol_below, scale=US%Z_to_m*US%L_to_m**2) + call MOM_write_field(IO_handle, fields(1), DL%depth, unscale=US%Z_to_m) + call MOM_write_field(IO_handle, fields(2), DL%area, unscale=US%L_to_m**2) + call MOM_write_field(IO_handle, fields(3), DL%vol_below, unscale=US%Z_to_m*US%L_to_m**2) call delete_axis_info(extra_axes) call delete_attribute_info(global_atts) diff --git a/src/framework/MOM_io.F90 b/src/framework/MOM_io.F90 index 27d244b226..8ee192323a 100644 --- a/src/framework/MOM_io.F90 +++ b/src/framework/MOM_io.F90 @@ -2504,7 +2504,7 @@ end subroutine MOM_read_vector_3d !> Write a 4d field to an output file, potentially with rotation subroutine MOM_write_field_legacy_4d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, & - fill_value, turns, scale) + fill_value, turns, scale, unscale) type(file_type), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(fieldtype), intent(in) :: field_md !< Field type with metadata type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition @@ -2516,7 +2516,13 @@ subroutine MOM_write_field_legacy_4d(IO_handle, field_md, MOM_domain, field, tst real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before !! it is written [a A-1 ~> 1], for example to convert it !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. + ! Local variables real, allocatable :: field_rot(:,:,:,:) ! A rotated version of field, with the same units [a] or ! rescaled [A ~> a] then [a] real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] @@ -2524,6 +2530,7 @@ subroutine MOM_write_field_legacy_4d(IO_handle, field_md, MOM_domain, field, tst qturns = 0 ; if (present(turns)) qturns = modulo(turns, 4) scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if ((qturns == 0) .and. (scale_fac == 1.0)) then call write_field(IO_handle, field_md, MOM_domain, field, tstamp=tstamp, & @@ -2541,7 +2548,7 @@ end subroutine MOM_write_field_legacy_4d !> Write a 3d field to an output file, potentially with rotation subroutine MOM_write_field_legacy_3d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, & - fill_value, turns, scale) + fill_value, turns, scale, unscale) type(file_type), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(fieldtype), intent(in) :: field_md !< Field type with metadata type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition @@ -2553,8 +2560,13 @@ subroutine MOM_write_field_legacy_3d(IO_handle, field_md, MOM_domain, field, tst real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before !! it is written [a A-1 ~> 1], for example to convert it !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. - + ! Local variables real, allocatable :: field_rot(:,:,:) ! A rotated version of field, with the same units [a] or ! rescaled [A ~> a] then [a] real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] @@ -2562,6 +2574,7 @@ subroutine MOM_write_field_legacy_3d(IO_handle, field_md, MOM_domain, field, tst qturns = 0 ; if (present(turns)) qturns = modulo(turns, 4) scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if ((qturns == 0) .and. (scale_fac == 1.0)) then call write_field(IO_handle, field_md, MOM_domain, field, tstamp=tstamp, & @@ -2579,7 +2592,7 @@ end subroutine MOM_write_field_legacy_3d !> Write a 2d field to an output file, potentially with rotation subroutine MOM_write_field_legacy_2d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, & - fill_value, turns, scale) + fill_value, turns, scale, unscale) type(file_type), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(fieldtype), intent(in) :: field_md !< Field type with metadata type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition @@ -2591,8 +2604,13 @@ subroutine MOM_write_field_legacy_2d(IO_handle, field_md, MOM_domain, field, tst real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before !! it is written [a A-1 ~> 1], for example to convert it !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. - + ! Local variables real, allocatable :: field_rot(:,:) ! A rotated version of field, with the same units [a] or ! rescaled [A ~> a] then [a] real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] @@ -2600,6 +2618,7 @@ subroutine MOM_write_field_legacy_2d(IO_handle, field_md, MOM_domain, field, tst qturns = 0 ; if (present(turns)) qturns = modulo(turns, 4) scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if ((qturns == 0) .and. (scale_fac == 1.0)) then call write_field(IO_handle, field_md, MOM_domain, field, tstamp=tstamp, & @@ -2616,7 +2635,7 @@ end subroutine MOM_write_field_legacy_2d !> Write a 1d field to an output file -subroutine MOM_write_field_legacy_1d(IO_handle, field_md, field, tstamp, fill_value, scale) +subroutine MOM_write_field_legacy_1d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale) type(file_type), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(fieldtype), intent(in) :: field_md !< Field type with metadata real, dimension(:), intent(in) :: field !< Field to write in arbitrary units [A ~> a] @@ -2625,13 +2644,19 @@ subroutine MOM_write_field_legacy_1d(IO_handle, field_md, field, tstamp, fill_va real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before !! it is written [a A-1 ~> 1], for example to convert it !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. - + ! Local variables real, dimension(:), allocatable :: array ! A rescaled copy of field [a] real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] integer :: i scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if (scale_fac == 1.0) then call write_field(IO_handle, field_md, field, tstamp=tstamp) @@ -2648,7 +2673,7 @@ end subroutine MOM_write_field_legacy_1d !> Write a 0d field to an output file -subroutine MOM_write_field_legacy_0d(IO_handle, field_md, field, tstamp, fill_value, scale) +subroutine MOM_write_field_legacy_0d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale) type(file_type), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(fieldtype), intent(in) :: field_md !< Field type with metadata real, intent(in) :: field !< Field to write in arbitrary units [A ~> a] @@ -2657,11 +2682,21 @@ subroutine MOM_write_field_legacy_0d(IO_handle, field_md, field, tstamp, fill_va real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before !! it is written [a A-1 ~> 1], for example to convert it !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. + ! Local variables + real :: scale_fac ! A scaling factor to use before writing the field [a A-1 ~> 1] real :: scaled_val ! A rescaled copy of field [a] - scaled_val = field - if (present(scale)) scaled_val = scale*field + scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale + + scaled_val = field * scale_fac + if (present(fill_value)) then ; if (field == fill_value) scaled_val = fill_value ; endif call write_field(IO_handle, field_md, scaled_val, tstamp=tstamp) @@ -2670,24 +2705,32 @@ end subroutine MOM_write_field_legacy_0d !> Write a 4d field to an output file, potentially with rotation subroutine MOM_write_field_4d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, & - fill_value, turns, scale) + fill_value, turns, scale, unscale) class(MOM_file), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(MOM_field), intent(in) :: field_md !< Field type with metadata type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition - real, dimension(:,:,:,:), intent(inout) :: field !< Unrotated field to write - real, optional, intent(in) :: tstamp !< Model timestamp + real, dimension(:,:,:,:), intent(inout) :: field !< Unrotated field to write in arbitrary units [A ~> a] + real, optional, intent(in) :: tstamp !< Model timestamp, often in [days] integer, optional, intent(in) :: tile_count !< PEs per tile (default: 1) - real, optional, intent(in) :: fill_value !< Missing data fill value + real, optional, intent(in) :: fill_value !< Missing data fill value [a] integer, optional, intent(in) :: turns !< Number of quarter-turns to rotate the data - real, optional, intent(in) :: scale !< A scaling factor that the field is - !! multiplied by before it is written + real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. - real, allocatable :: field_rot(:,:,:,:) ! A rotated version of field, with the same units or rescaled - real :: scale_fac ! A scaling factor to use before writing the array + ! Local variables + real, allocatable :: field_rot(:,:,:,:) ! A rotated version of field, with the same units or rescaled [a] + real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] integer :: qturns ! The number of quarter turns through which to rotate field qturns = 0 ; if (present(turns)) qturns = modulo(turns, 4) scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if ((qturns == 0) .and. (scale_fac == 1.0)) then call IO_handle%write_field(field_md, MOM_domain, field, tstamp=tstamp, & @@ -2704,24 +2747,32 @@ end subroutine MOM_write_field_4d !> Write a 3d field to an output file, potentially with rotation subroutine MOM_write_field_3d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, & - fill_value, turns, scale) + fill_value, turns, scale, unscale) class(MOM_file), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(MOM_field), intent(in) :: field_md !< Field type with metadata type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition - real, dimension(:,:,:), intent(inout) :: field !< Unrotated field to write - real, optional, intent(in) :: tstamp !< Model timestamp + real, dimension(:,:,:), intent(inout) :: field !< Unrotated field to write in arbitrary units [A ~> a] + real, optional, intent(in) :: tstamp !< Model timestamp, often in [days] integer, optional, intent(in) :: tile_count !< PEs per tile (default: 1) - real, optional, intent(in) :: fill_value !< Missing data fill value + real, optional, intent(in) :: fill_value !< Missing data fill value [a] integer, optional, intent(in) :: turns !< Number of quarter-turns to rotate the data - real, optional, intent(in) :: scale !< A scaling factor that the field is - !! multiplied by before it is written + real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. - real, allocatable :: field_rot(:,:,:) ! A rotated version of field, with the same units or rescaled - real :: scale_fac ! A scaling factor to use before writing the array + ! Local variables + real, allocatable :: field_rot(:,:,:) ! A rotated version of field, with the same units or rescaled [a] + real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] integer :: qturns ! The number of quarter turns through which to rotate field qturns = 0 ; if (present(turns)) qturns = modulo(turns, 4) scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if ((qturns == 0) .and. (scale_fac == 1.0)) then call IO_handle%write_field(field_md, MOM_domain, field, tstamp=tstamp, & @@ -2738,24 +2789,32 @@ end subroutine MOM_write_field_3d !> Write a 2d field to an output file, potentially with rotation subroutine MOM_write_field_2d(IO_handle, field_md, MOM_domain, field, tstamp, tile_count, & - fill_value, turns, scale) + fill_value, turns, scale, unscale) class(MOM_file), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(MOM_field), intent(in) :: field_md !< Field type with metadata type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition - real, dimension(:,:), intent(inout) :: field !< Unrotated field to write - real, optional, intent(in) :: tstamp !< Model timestamp + real, dimension(:,:), intent(inout) :: field !< Unrotated field to write in arbitrary units [A ~> a] + real, optional, intent(in) :: tstamp !< Model timestamp, often in [days] integer, optional, intent(in) :: tile_count !< PEs per tile (default: 1) - real, optional, intent(in) :: fill_value !< Missing data fill value + real, optional, intent(in) :: fill_value !< Missing data fill value [a] integer, optional, intent(in) :: turns !< Number of quarter-turns to rotate the data - real, optional, intent(in) :: scale !< A scaling factor that the field is - !! multiplied by before it is written + real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. - real, allocatable :: field_rot(:,:) ! A rotated version of field, with the same units - real :: scale_fac ! A scaling factor to use before writing the array + ! Local variables + real, allocatable :: field_rot(:,:) ! A rotated version of field, with the same units or rescaled [a] + real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] integer :: qturns ! The number of quarter turns through which to rotate field qturns = 0 ; if (present(turns)) qturns = modulo(turns, 4) scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if ((qturns == 0) .and. (scale_fac == 1.0)) then call IO_handle%write_field(field_md, MOM_domain, field, tstamp=tstamp, & @@ -2771,20 +2830,28 @@ subroutine MOM_write_field_2d(IO_handle, field_md, MOM_domain, field, tstamp, ti end subroutine MOM_write_field_2d !> Write a 1d field to an output file -subroutine MOM_write_field_1d(IO_handle, field_md, field, tstamp, fill_value, scale) +subroutine MOM_write_field_1d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale) class(MOM_file), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(MOM_field), intent(in) :: field_md !< Field type with metadata - real, dimension(:), intent(in) :: field !< Field to write - real, optional, intent(in) :: tstamp !< Model timestamp - real, optional, intent(in) :: fill_value !< Missing data fill value - real, optional, intent(in) :: scale !< A scaling factor that the field is - !! multiplied by before it is written + real, dimension(:), intent(in) :: field !< Field to write in arbitrary units [A ~> a] + real, optional, intent(in) :: tstamp !< Model timestamp, often in [days] + real, optional, intent(in) :: fill_value !< Missing data fill value [a] + real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. - real, dimension(:), allocatable :: array ! A rescaled copy of field - real :: scale_fac ! A scaling factor to use before writing the array + ! Local variables + real, dimension(:), allocatable :: array ! A rescaled copy of field in arbtrary unscaled units [a] + real :: scale_fac ! A scaling factor to use before writing the array [a A-1 ~> 1] integer :: i scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale if (scale_fac == 1.0) then call IO_handle%write_field(field_md, field, tstamp=tstamp) @@ -2800,18 +2867,30 @@ subroutine MOM_write_field_1d(IO_handle, field_md, field, tstamp, fill_value, sc end subroutine MOM_write_field_1d !> Write a 0d field to an output file -subroutine MOM_write_field_0d(IO_handle, field_md, field, tstamp, fill_value, scale) +subroutine MOM_write_field_0d(IO_handle, field_md, field, tstamp, fill_value, scale, unscale) class(MOM_file), intent(inout) :: IO_handle !< Handle for a file that is open for writing type(MOM_field), intent(in) :: field_md !< Field type with metadata - real, intent(in) :: field !< Field to write - real, optional, intent(in) :: tstamp !< Model timestamp - real, optional, intent(in) :: fill_value !< Missing data fill value - real, optional, intent(in) :: scale !< A scaling factor that the field is - !! multiplied by before it is written - real :: scaled_val ! A rescaled copy of field + real, intent(in) :: field !< Field to write in arbitrary units [A ~> a] + real, optional, intent(in) :: tstamp !< Model timestamp, often in [days] + real, optional, intent(in) :: fill_value !< Missing data fill value [a] + real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output + real, optional, intent(in) :: unscale !< A scaling factor that the field is multiplied by before + !! it is written [a A-1 ~> 1], for example to convert it + !! from its internal units to the desired units for output. + !! Here scale and unscale are synonymous, but unscale + !! takes precedence if both are present. + + ! Local variables + real :: scale_fac ! A scaling factor to use before writing the field [a A-1 ~> 1] + real :: scaled_val ! A rescaled copy of field in arbtrary unscaled units [a] + + scale_fac = 1.0 ; if (present(scale)) scale_fac = scale + if (present(unscale)) scale_fac = unscale + + scaled_val = field * scale_fac - scaled_val = field - if (present(scale)) scaled_val = scale*field if (present(fill_value)) then ; if (field == fill_value) scaled_val = fill_value ; endif call IO_handle%write_field(field_md, scaled_val, tstamp=tstamp) diff --git a/src/framework/MOM_restart.F90 b/src/framework/MOM_restart.F90 index 44dee97a76..8152564b4f 100644 --- a/src/framework/MOM_restart.F90 +++ b/src/framework/MOM_restart.F90 @@ -1513,19 +1513,19 @@ subroutine save_restart(directory, time, G, CS, time_stamped, filename, GV, num_ do m=start_var,next_var-1 if (associated(CS%var_ptr3d(m)%p)) then call MOM_write_field(IO_handle, fields(m-start_var+1), G%Domain, CS%var_ptr3d(m)%p, & - restart_time, scale=CS%restart_field(m)%conv, turns=-turns) + restart_time, unscale=CS%restart_field(m)%conv, turns=-turns) elseif (associated(CS%var_ptr2d(m)%p)) then call MOM_write_field(IO_handle, fields(m-start_var+1), G%Domain, CS%var_ptr2d(m)%p, & - restart_time, scale=CS%restart_field(m)%conv, turns=-turns) + restart_time, unscale=CS%restart_field(m)%conv, turns=-turns) elseif (associated(CS%var_ptr4d(m)%p)) then call MOM_write_field(IO_handle, fields(m-start_var+1), G%Domain, CS%var_ptr4d(m)%p, & - restart_time, scale=CS%restart_field(m)%conv, turns=-turns) + restart_time, unscale=CS%restart_field(m)%conv, turns=-turns) elseif (associated(CS%var_ptr1d(m)%p)) then call MOM_write_field(IO_handle, fields(m-start_var+1), CS%var_ptr1d(m)%p, & - restart_time, scale=CS%restart_field(m)%conv) + restart_time, unscale=CS%restart_field(m)%conv) elseif (associated(CS%var_ptr0d(m)%p)) then call MOM_write_field(IO_handle, fields(m-start_var+1), CS%var_ptr0d(m)%p, & - restart_time, scale=CS%restart_field(m)%conv) + restart_time, unscale=CS%restart_field(m)%conv) endif enddo diff --git a/src/initialization/MOM_coord_initialization.F90 b/src/initialization/MOM_coord_initialization.F90 index bb7832525f..9acf693f5f 100644 --- a/src/initialization/MOM_coord_initialization.F90 +++ b/src/initialization/MOM_coord_initialization.F90 @@ -600,8 +600,8 @@ subroutine write_vertgrid_file(GV, US, param_file, directory) call create_MOM_file(IO_handle, trim(filepath), vars, 2, fields, & SINGLE_FILE, GV=GV) - call MOM_write_field(IO_handle, fields(1), GV%Rlay, scale=US%R_to_kg_m3) - call MOM_write_field(IO_handle, fields(2), GV%g_prime, scale=US%L_T_to_m_s**2*US%m_to_Z) + call MOM_write_field(IO_handle, fields(1), GV%Rlay, unscale=US%R_to_kg_m3) + call MOM_write_field(IO_handle, fields(2), GV%g_prime, unscale=US%L_T_to_m_s**2*US%m_to_Z) call IO_handle%close() diff --git a/src/initialization/MOM_shared_initialization.F90 b/src/initialization/MOM_shared_initialization.F90 index 821232b80d..edf08da3aa 100644 --- a/src/initialization/MOM_shared_initialization.F90 +++ b/src/initialization/MOM_shared_initialization.F90 @@ -1424,30 +1424,30 @@ subroutine write_ocean_geometry_file(G, param_file, directory, US, geom_file) call MOM_write_field(IO_handle, fields(3), G%Domain, G%geoLatT) call MOM_write_field(IO_handle, fields(4), G%Domain, G%geoLonT) - call MOM_write_field(IO_handle, fields(5), G%Domain, G%bathyT, scale=US%Z_to_m) - call MOM_write_field(IO_handle, fields(6), G%Domain, G%CoriolisBu, scale=US%s_to_T) - - call MOM_write_field(IO_handle, fields(7), G%Domain, G%dxCv, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(8), G%Domain, G%dyCu, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(9), G%Domain, G%dxCu, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(10), G%Domain, G%dyCv, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(11), G%Domain, G%dxT, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(12), G%Domain, G%dyT, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(13), G%Domain, G%dxBu, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(14), G%Domain, G%dyBu, scale=US%L_to_m) - - call MOM_write_field(IO_handle, fields(15), G%Domain, G%areaT, scale=US%L_to_m**2) - call MOM_write_field(IO_handle, fields(16), G%Domain, G%areaBu, scale=US%L_to_m**2) - - call MOM_write_field(IO_handle, fields(17), G%Domain, G%dx_Cv, scale=US%L_to_m) - call MOM_write_field(IO_handle, fields(18), G%Domain, G%dy_Cu, scale=US%L_to_m) + call MOM_write_field(IO_handle, fields(5), G%Domain, G%bathyT, unscale=US%Z_to_m) + call MOM_write_field(IO_handle, fields(6), G%Domain, G%CoriolisBu, unscale=US%s_to_T) + + call MOM_write_field(IO_handle, fields(7), G%Domain, G%dxCv, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(8), G%Domain, G%dyCu, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(9), G%Domain, G%dxCu, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(10), G%Domain, G%dyCv, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(11), G%Domain, G%dxT, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(12), G%Domain, G%dyT, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(13), G%Domain, G%dxBu, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(14), G%Domain, G%dyBu, unscale=US%L_to_m) + + call MOM_write_field(IO_handle, fields(15), G%Domain, G%areaT, unscale=US%L_to_m**2) + call MOM_write_field(IO_handle, fields(16), G%Domain, G%areaBu, unscale=US%L_to_m**2) + + call MOM_write_field(IO_handle, fields(17), G%Domain, G%dx_Cv, unscale=US%L_to_m) + call MOM_write_field(IO_handle, fields(18), G%Domain, G%dy_Cu, unscale=US%L_to_m) call MOM_write_field(IO_handle, fields(19), G%Domain, G%mask2dT) if (G%bathymetry_at_vel) then - call MOM_write_field(IO_handle, fields(20), G%Domain, G%Dblock_u, scale=US%Z_to_m) - call MOM_write_field(IO_handle, fields(21), G%Domain, G%Dopen_u, scale=US%Z_to_m) - call MOM_write_field(IO_handle, fields(22), G%Domain, G%Dblock_v, scale=US%Z_to_m) - call MOM_write_field(IO_handle, fields(23), G%Domain, G%Dopen_v, scale=US%Z_to_m) + call MOM_write_field(IO_handle, fields(20), G%Domain, G%Dblock_u, unscale=US%Z_to_m) + call MOM_write_field(IO_handle, fields(21), G%Domain, G%Dopen_u, unscale=US%Z_to_m) + call MOM_write_field(IO_handle, fields(22), G%Domain, G%Dblock_v, unscale=US%Z_to_m) + call MOM_write_field(IO_handle, fields(23), G%Domain, G%Dopen_v, unscale=US%Z_to_m) endif call IO_handle%close() diff --git a/src/parameterizations/vertical/MOM_bkgnd_mixing.F90 b/src/parameterizations/vertical/MOM_bkgnd_mixing.F90 index 4c0baf3d26..64e7f17ef2 100644 --- a/src/parameterizations/vertical/MOM_bkgnd_mixing.F90 +++ b/src/parameterizations/vertical/MOM_bkgnd_mixing.F90 @@ -234,19 +234,19 @@ subroutine bkgnd_mixing_init(Time, G, GV, US, param_file, diag, CS, physical_OBL call get_param(param_file, mdl, "BCKGRND_VDC1", CS%bckgrnd_vdc1, & "Background diffusivity (Ledwell) when HORIZ_VARYING_BACKGROUND=True", & - units="m2 s-1",default = 0.16e-04, scale=GV%m2_s_to_HZ_T) + units="m2 s-1", default=0.16e-04, scale=GV%m2_s_to_HZ_T) call get_param(param_file, mdl, "BCKGRND_VDC_EQ", CS%bckgrnd_vdc_eq, & "Equatorial diffusivity (Gregg) when HORIZ_VARYING_BACKGROUND=True", & - units="m2 s-1",default = 0.01e-04, scale=GV%m2_s_to_HZ_T) + units="m2 s-1", default=0.01e-04, scale=GV%m2_s_to_HZ_T) call get_param(param_file, mdl, "BCKGRND_VDC_PSIM", CS%bckgrnd_vdc_psim, & "Max. PSI induced diffusivity (MacKinnon) when HORIZ_VARYING_BACKGROUND=True", & - units="m2 s-1",default = 0.13e-4, scale=GV%m2_s_to_HZ_T) + units="m2 s-1", default=0.13e-4, scale=GV%m2_s_to_HZ_T) call get_param(param_file, mdl, "BCKGRND_VDC_BAN", CS%bckgrnd_vdc_Banda, & "Banda Sea diffusivity (Gordon) when HORIZ_VARYING_BACKGROUND=True", & - units="m2 s-1",default = 1.0e-4, scale=GV%m2_s_to_HZ_T) + units="m2 s-1", default=1.0e-4, scale=GV%m2_s_to_HZ_T) endif call get_param(param_file, mdl, "PRANDTL_BKGND", CS%prandtl_bkgnd, &