Skip to content

Commit

Permalink
+Rescale forcing arguments and revise ctrl_forcing (#25)
Browse files Browse the repository at this point in the history
* +Rescale forcing arguments and revise ctrl_forcing

  This commit revisits the units of the input arguments to the various ocean-
only surfaces forcing routines, including:
- Rescaled the units of the time intervals passed to the various forcing
  routines to [T ~> s]
- Applied dimensional scaling to MOM_controlled_forcing.F90.  This code is
  not yet in active use, so these changes can not change answers, but it is
  now much closer to compliance with modern MOM6 standards, including improved
  documentation, and could be ready to try without too much more effort.
- Documented the remaining real variables in benchmark_initialization.F90,
  along with their units.

All answers are bitwise identical, but there are changes to the units of some
arguments in public interfaces.
  • Loading branch information
Hallberg-NOAA authored Dec 8, 2021
1 parent 5f21667 commit e2c81e9
Show file tree
Hide file tree
Showing 9 changed files with 281 additions and 191 deletions.
8 changes: 4 additions & 4 deletions config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
delta_sst = data_restore(i,j)- sfc_state%SST(i,j)
delta_sst = sign(1.0,delta_sst)*min(abs(delta_sst),CS%max_delta_trestore)
fluxes%heat_added(i,j) = G%mask2dT(i,j) * CS%trestore_mask(i,j) * &
rhoXcp * delta_sst * CS%Flux_const_temp ! W m-2
rhoXcp * delta_sst * CS%Flux_const_temp ! [Q R Z T-1 ~> W m-2]
enddo ; enddo
endif

Expand Down Expand Up @@ -568,8 +568,8 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
!#CTRL# SSS_anom(i,j) = sfc_state%SSS(i,j) - CS%S_Restore(i,j)
!#CTRL# SSS_mean(i,j) = 0.5*(sfc_state%SSS(i,j) + CS%S_Restore(i,j))
!#CTRL# enddo ; enddo
!#CTRL# call apply_ctrl_forcing(SST_anom, SSS_anom, SSS_mean, fluxes%heat_restore, &
!#CTRL# fluxes%vprec, day, dt, G, CS%ctrl_forcing_CSp)
!#CTRL# call apply_ctrl_forcing(SST_anom, SSS_anom, SSS_mean, fluxes%heat_added, &
!#CTRL# fluxes%vprec, day, US%s_to_T*valid_time, G, US, CS%ctrl_forcing_CSp)
!#CTRL# endif

! adjust the NET fresh-water flux to zero, if flagged
Expand Down Expand Up @@ -1601,7 +1601,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
endif
endif

!#CTRL# call controlled_forcing_init(Time, G, param_file, diag, CS%ctrl_forcing_CSp)
!#CTRL# call controlled_forcing_init(Time, G, US, param_file, diag, CS%ctrl_forcing_CSp)

call user_revise_forcing_init(param_file, CS%urf_CS)

Expand Down
6 changes: 3 additions & 3 deletions config_src/drivers/solo_driver/MESO_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ subroutine MESO_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
type(forcing), intent(inout) :: fluxes !< A structure containing thermodynamic forcing fields
type(time_type), intent(in) :: day !< The time of the fluxes
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(MESO_surface_forcing_CS), pointer :: CS !< A pointer to the control structure returned by
Expand Down Expand Up @@ -215,8 +215,8 @@ subroutine MESO_surface_forcing_init(Time, G, US, param_file, diag, CS)
type(MESO_surface_forcing_CS), pointer :: CS !< A pointer that is set to point to the
!! control structure for this module

! This include declares and sets the variable "version".
#include "version_variable.h"
! This include declares and sets the variable "version".
# include "version_variable.h"
character(len=40) :: mdl = "MESO_surface_forcing" ! This module's name.

if (associated(CS)) then
Expand Down
20 changes: 10 additions & 10 deletions config_src/drivers/solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ subroutine set_forcing(sfc_state, forces, fluxes, day_start, day_interval, G, US
type(surface_forcing_CS), pointer :: CS !< pointer to control structure returned by
!! a previous surface_forcing_init call
! Local variables
real :: dt ! length of time over which fluxes applied [s]
real :: dt ! length of time over which fluxes applied [T ~> s]
type(time_type) :: day_center ! central time of the fluxes.
integer :: isd, ied, jsd, jed
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed
Expand All @@ -242,7 +242,7 @@ subroutine set_forcing(sfc_state, forces, fluxes, day_start, day_interval, G, US
call callTree_enter("set_forcing, MOM_surface_forcing.F90")

day_center = day_start + day_interval/2
dt = time_type_to_real(day_interval)
dt = US%s_to_T * time_type_to_real(day_interval)

if (CS%first_call_set_forcing) then
! Allocate memory for the mechanical and thermodynamic forcing fields.
Expand Down Expand Up @@ -899,7 +899,7 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, US, CS)
type(forcing), intent(inout) :: fluxes !< A structure containing thermodynamic forcing fields
type(time_type), intent(in) :: day !< The time of the fluxes
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(surface_forcing_CS), pointer :: CS !< pointer to control structure returned by
Expand Down Expand Up @@ -1162,7 +1162,7 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, US, CS)
!#CTRL# SSS_mean(i,j) = 0.5*(sfc_state%SSS(i,j) + CS%S_Restore(i,j))
!#CTRL# enddo ; enddo
!#CTRL# call apply_ctrl_forcing(SST_anom, SSS_anom, SSS_mean, fluxes%heat_added, &
!#CTRL# fluxes%vprec, day, dt, G, CS%ctrl_forcing_CSp)
!#CTRL# fluxes%vprec, day, dt, G, US, CS%ctrl_forcing_CSp)
!#CTRL# endif

call callTree_leave("buoyancy_forcing_from_files")
Expand All @@ -1175,7 +1175,7 @@ subroutine buoyancy_forcing_from_data_override(sfc_state, fluxes, day, dt, G, US
type(forcing), intent(inout) :: fluxes !< A structure containing thermodynamic forcing fields
type(time_type), intent(in) :: day !< The time of the fluxes
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(surface_forcing_CS), pointer :: CS !< pointer to control structure returned by
Expand Down Expand Up @@ -1289,7 +1289,7 @@ subroutine buoyancy_forcing_from_data_override(sfc_state, fluxes, day, dt, G, US
!#CTRL# SSS_mean(i,j) = 0.5*(sfc_state%SSS(i,j) + CS%S_Restore(i,j))
!#CTRL# enddo ; enddo
!#CTRL# call apply_ctrl_forcing(SST_anom, SSS_anom, SSS_mean, fluxes%heat_added, &
!#CTRL# fluxes%vprec, day, dt, G, CS%ctrl_forcing_CSp)
!#CTRL# fluxes%vprec, day, US%T_to_s*dt, G, US, CS%ctrl_forcing_CSp)
!#CTRL# endif

call callTree_leave("buoyancy_forcing_from_data_override")
Expand All @@ -1302,7 +1302,7 @@ subroutine buoyancy_forcing_zero(sfc_state, fluxes, day, dt, G, CS)
type(forcing), intent(inout) :: fluxes !< A structure containing thermodynamic forcing fields
type(time_type), intent(in) :: day !< The time of the fluxes
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(surface_forcing_CS), pointer :: CS !< pointer to control structure returned by
!! a previous surface_forcing_init call
Expand Down Expand Up @@ -1345,7 +1345,7 @@ subroutine buoyancy_forcing_const(sfc_state, fluxes, day, dt, G, US, CS)
type(forcing), intent(inout) :: fluxes !< A structure containing thermodynamic forcing fields
type(time_type), intent(in) :: day !< The time of the fluxes
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(surface_forcing_CS), pointer :: CS !< pointer to control structure returned by
Expand Down Expand Up @@ -1388,7 +1388,7 @@ subroutine buoyancy_forcing_linear(sfc_state, fluxes, day, dt, G, US, CS)
type(forcing), intent(inout) :: fluxes !< A structure containing thermodynamic forcing fields
type(time_type), intent(in) :: day !< The time of the fluxes
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(surface_forcing_CS), pointer :: CS !< pointer to control structure returned by
Expand Down Expand Up @@ -1908,7 +1908,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
if (trim(CS%wind_config) == "file") &
CS%wind_nlev = num_timelevels(CS%wind_file, CS%stress_x_var, min_dims=3)

!#CTRL# call controlled_forcing_init(Time, G, param_file, diag, CS%ctrl_forcing_CSp)
!#CTRL# call controlled_forcing_init(Time, G, US, param_file, diag, CS%ctrl_forcing_CSp)

call user_revise_forcing_init(param_file, CS%urf_CS)

Expand Down
6 changes: 3 additions & 3 deletions config_src/drivers/solo_driver/user_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
type(forcing), intent(inout) :: fluxes !< A structure containing thermodynamic forcing fields
type(time_type), intent(in) :: day !< The time of the fluxes
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(user_surface_forcing_CS), pointer :: CS !< A pointer to the control structure returned
Expand Down Expand Up @@ -242,8 +242,8 @@ subroutine USER_surface_forcing_init(Time, G, US, param_file, diag, CS)
type(user_surface_forcing_CS), pointer :: CS !< A pointer that is set to point to
!! the control structure for this module

! This include declares and sets the variable "version".
#include "version_variable.h"
! This include declares and sets the variable "version".
# include "version_variable.h"
character(len=40) :: mdl = "user_surface_forcing" ! This module's name.

if (associated(CS)) then
Expand Down
7 changes: 4 additions & 3 deletions src/user/BFB_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ subroutine BFB_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
!! have NULL ptrs.
type(time_type), intent(in) :: day !< Time of the fluxes.
real, intent(in) :: dt !< The amount of time over which
!! the fluxes apply [s]
!! the fluxes apply [T ~> s]
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(BFB_surface_forcing_CS), pointer :: CS !< A pointer to the control structure
Expand Down Expand Up @@ -177,8 +177,9 @@ subroutine BFB_surface_forcing_init(Time, G, US, param_file, diag, CS)
type(diag_ctrl), target, intent(in) :: diag !< A structure that is used to
!! regulate diagnostic output.
type(BFB_surface_forcing_CS), pointer :: CS !< A pointer to the control structure for this module
! This include declares and sets the variable "version".
#include "version_variable.h"

! This include declares and sets the variable "version".
# include "version_variable.h"
character(len=40) :: mdl = "BFB_surface_forcing" ! This module's name.

if (associated(CS)) then
Expand Down
Loading

0 comments on commit e2c81e9

Please sign in to comment.