Skip to content

Commit

Permalink
Merge branch 'dev/esmg' into obc_index_error_patch
Browse files Browse the repository at this point in the history
  • Loading branch information
kshedstrom committed Jul 23, 2019
2 parents 94dc2eb + 5358bca commit 9cff98c
Show file tree
Hide file tree
Showing 63 changed files with 1,042 additions and 1,047 deletions.
33 changes: 6 additions & 27 deletions config_src/ice_solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ module MOM_surface_forcing
!* The boundaries always run through q grid points (x). *
!* *
!********+*********+*********+*********+*********+*********+*********+**
!### use MOM_controlled_forcing, only : apply_ctrl_forcing, register_ctrl_forcing_restarts
!### use MOM_controlled_forcing, only : controlled_forcing_init, controlled_forcing_end
!### use MOM_controlled_forcing, only : ctrl_forcing_CS
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
use MOM_cpu_clock, only : CLOCK_MODULE
use MOM_diag_mediator, only : post_data, query_averaging_enabled
Expand Down Expand Up @@ -101,7 +98,7 @@ module MOM_surface_forcing
real :: len_lat ! domain length in latitude

real :: Rho0 ! Boussinesq reference density [kg m-3]
real :: G_Earth ! gravitational acceleration [m s-2]
real :: G_Earth ! gravitational acceleration [L2 Z-1 T-2 ~> m s-2]
real :: Flux_const ! piston velocity for surface restoring [m s-1]

real :: gust_const ! constant unresolved background gustiness for ustar [Pa]
Expand Down Expand Up @@ -131,7 +128,6 @@ module MOM_surface_forcing
character(len=8) :: wind_stagger

type(tracer_flow_control_CS), pointer :: tracer_flow_CSp => NULL()
!### type(ctrl_forcing_CS), pointer :: ctrl_forcing_CSp => NULL()
type(MOM_restart_CS), pointer :: restart_CSp => NULL()

type(diag_ctrl), pointer :: diag ! structure used to regulate timing of diagnostic output
Expand Down Expand Up @@ -706,7 +702,7 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, CS)
enddo ; enddo

! Read the SST and SSS fields for damping.
if (CS%restorebuoy) then !### .or. associated(CS%ctrl_forcing_CSp)) then
if (CS%restorebuoy) then
call MOM_read_data(trim(CS%inputdir)//trim(CS%SSTrestore_file), "TEMP", &
CS%T_Restore(:,:), G%Domain, timelevel=time_lev_monthly)
call MOM_read_data(trim(CS%inputdir)//trim(CS%salinityrestore_file), "SALT", &
Expand Down Expand Up @@ -756,7 +752,7 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, CS)
do j=js,je ; do i=is,ie
if (G%mask2dT(i,j) > 0) then
fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
(CS%G_Earth*CS%Flux_const/CS%Rho0)
(CS%G_Earth * US%m_to_Z*US%T_to_s*CS%Flux_const/CS%Rho0)
else
fluxes%buoy(i,j) = 0.0
endif
Expand All @@ -769,16 +765,6 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, CS)
endif
endif ! end RESTOREBUOY

!### if (associated(CS%ctrl_forcing_CSp)) then
!### do j=js,je ; do i=is,ie
!### SST_anom(i,j) = sfc_state%SST(i,j) - CS%T_Restore(i,j)
!### SSS_anom(i,j) = sfc_state%SSS(i,j) - CS%S_Restore(i,j)
!### SSS_mean(i,j) = 0.5*(sfc_state%SSS(i,j) + CS%S_Restore(i,j))
!### enddo ; enddo
!### call apply_ctrl_forcing(SST_anom, SSS_anom, SSS_mean, fluxes%heat_restore, &
!### fluxes%vprec, day, dt, G, CS%ctrl_forcing_CSp)
!### endif

call callTree_leave("buoyancy_forcing_from_files")
end subroutine buoyancy_forcing_from_files

Expand Down Expand Up @@ -900,8 +886,8 @@ subroutine buoyancy_forcing_linear(sfc_state, fluxes, day, dt, G, CS)
"RESTOREBUOY to linear not written yet.")
!do j=js,je ; do i=is,ie
! if (G%mask2dT(i,j) > 0) then
! fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
! (CS%G_Earth*CS%Flux_const/CS%Rho0)
! fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
! (CS%G_Earth * US%m_to_Z*US%T_to_s*CS%Flux_const/CS%Rho0)
! else
! fluxes%buoy(i,j) = 0.0
! endif
Expand Down Expand Up @@ -1123,7 +1109,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
endif
call get_param(param_file, mdl, "G_EARTH", CS%G_Earth, &
"The gravitational acceleration of the Earth.", &
units="m s-2", default = 9.80)
units="m s-2", default = 9.80, scale=US%m_to_L**2*US%Z_to_m*US%T_to_s**2)

call get_param(param_file, mdl, "GUST_CONST", CS%gust_const, &
"The background gustiness in the winds.", units="Pa", &
Expand All @@ -1149,15 +1135,12 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
elseif (trim(CS%wind_config) == "MESO" .or. trim(CS%buoy_config) == "MESO" ) then
call MOM_error(FATAL, "MESO forcing is not available with the ice-shelf"//&
"version of MOM_surface_forcing.")
! call MESO_surface_forcing_init(Time, G, param_file, diag, CS%MESO_forcing_CSp)
endif

call register_forcing_type_diags(Time, diag, US, CS%use_temperature, CS%handles)

! Set up any restart fields associated with the forcing.
call restart_init(G, param_file, CS%restart_CSp, "MOM_forcing.res")
!### call register_ctrl_forcing_restarts(G, param_file, CS%ctrl_forcing_CSp, &
!### CS%restart_CSp)
call restart_init_end(CS%restart_CSp)

if (associated(CS%restart_CSp)) then
Expand All @@ -1172,8 +1155,6 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
endif
endif

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

call user_revise_forcing_init(param_file, CS%urf_CS)

call cpu_clock_end(id_clock_forcing)
Expand All @@ -1189,8 +1170,6 @@ subroutine surface_forcing_end(CS, fluxes)

if (present(fluxes)) call deallocate_forcing_type(fluxes)

!### call controlled_forcing_end(CS%ctrl_forcing_CSp)

if (associated(CS)) deallocate(CS)
CS => NULL()

Expand Down
2 changes: 1 addition & 1 deletion config_src/ice_solo_driver/ice_shelf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ program SHELF_main

namelist /ice_solo_nml/ date_init, calendar, months, days, hours, minutes, seconds

!#######################################################################
!=======================================================================

call write_cputime_start_clock(write_CPU_CSp)

Expand Down
16 changes: 9 additions & 7 deletions config_src/ice_solo_driver/user_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module user_surface_forcing
logical :: restorebuoy ! If true, use restoring surface buoyancy forcing.
real :: Rho0 ! The density used in the Boussinesq
! approximation [kg m-3].
real :: G_Earth ! The gravitational acceleration [m s-2].
real :: G_Earth ! The gravitational acceleration [L2 Z-1 T-2 ~> m s-2].
real :: Flux_const ! The restoring rate at the surface [m s-1].
real :: gust_const ! A constant unresolved background gustiness
! that contributes to ustar [Pa].
Expand Down Expand Up @@ -149,14 +149,15 @@ end subroutine USER_wind_forcing
!> This subroutine specifies the current surface fluxes of buoyancy or
!! temperature and fresh water. It may also be modified to add
!! surface fluxes of user provided tracers.
subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, CS)
subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
type(surface), intent(inout) :: sfc_state !< A structure containing fields that
!! describe the surface state of the ocean.
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]
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
!! by a previous call to user_surface_forcing_init

Expand All @@ -180,7 +181,7 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, CS)
! toward [kg m-3].
real :: rhoXcp ! The mean density times the heat capacity [J m-3 degC-1].
real :: buoy_rest_const ! A constant relating density anomalies to the
! restoring buoyancy flux [m5 s-3 kg-1].
! restoring buoyancy flux [L2 m3 T-3 kg-1 ~> m5 s-3 kg-1].

integer :: i, j, is, ie, js, je
integer :: isd, ied, jsd, jed
Expand Down Expand Up @@ -234,7 +235,7 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, CS)
enddo ; enddo
else ! This is the buoyancy only mode.
do j=js,je ; do i=is,ie
! fluxes%buoy is the buoyancy flux into the ocean [m2 s-3]. A positive
! fluxes%buoy is the buoyancy flux into the ocean [L2 T-3 ~> m2 s-3]. A positive
! buoyancy flux is of the same sign as heating the ocean.
fluxes%buoy(i,j) = 0.0 * G%mask2dT(i,j)
enddo ; enddo
Expand Down Expand Up @@ -268,7 +269,7 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, CS)
"Buoyancy restoring used without modification." )

! The -1 is because density has the opposite sign to buoyancy.
buoy_rest_const = -1.0 * (CS%G_Earth * CS%Flux_const) / CS%Rho0
buoy_rest_const = -1.0 * (CS%G_Earth * US%m_to_Z*US%T_to_s*CS%Flux_const) / CS%Rho0
do j=js,je ; do i=is,ie
! Set density_restore to an expression for the surface potential
! density [kg m-3] that is being restored toward.
Expand All @@ -283,9 +284,10 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, CS)
end subroutine USER_buoyancy_forcing

!> This subroutine initializes the USER_surface_forcing module
subroutine USER_surface_forcing_init(Time, G, param_file, diag, CS)
subroutine USER_surface_forcing_init(Time, G, US, param_file, diag, CS)
type(time_type), intent(in) :: Time !< The current model time
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(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters
type(diag_ctrl), target, intent(in) :: diag !< A structure that is used to regulate diagnostic output.
type(user_surface_forcing_CS), pointer :: CS !< A pointer that is set to point to
Expand All @@ -311,7 +313,7 @@ subroutine USER_surface_forcing_init(Time, G, param_file, diag, CS)

call get_param(param_file, mdl, "G_EARTH", CS%G_Earth, &
"The gravitational acceleration of the Earth.", &
units="m s-2", default = 9.80)
units="m s-2", default = 9.80, scale=US%m_to_L**2*US%Z_to_m*US%T_to_s**2)
call get_param(param_file, mdl, "RHO_0", CS%Rho0, &
"The mean ocean density used with BOUSSINESQ true to "//&
"calculate accelerations and the mass for conservation "//&
Expand Down
10 changes: 0 additions & 10 deletions config_src/mct_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ module MOM_surface_forcing

! This file is part of MOM6. See LICENSE.md for the license.

!### use MOM_controlled_forcing, only : apply_ctrl_forcing, register_ctrl_forcing_restarts
!### use MOM_controlled_forcing, only : controlled_forcing_init, controlled_forcing_end
!### use MOM_controlled_forcing, only : ctrl_forcing_CS
use MOM_coms, only : reproducing_sum
use MOM_constants, only : hlv, hlf
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
Expand Down Expand Up @@ -144,7 +141,6 @@ module MOM_surface_forcing
integer :: id_srestore = -1 !< id number for time_interp_external.
integer :: id_trestore = -1 !< id number for time_interp_external.
type(forcing_diags), public :: handles !< diagnostics handles
!### type(ctrl_forcing_CS), pointer :: ctrl_forcing_CSp => NULL()
type(MOM_restart_CS), pointer :: restart_CSp => NULL() !< restart pointer
type(user_revise_forcing_CS), pointer :: urf_CS => NULL()!< user revise pointer
end type surface_forcing_CS
Expand Down Expand Up @@ -1302,8 +1298,6 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,

! Set up any restart fields associated with the forcing.
call restart_init(param_file, CS%restart_CSp, "MOM_forcing.res")
!### call register_ctrl_forcing_restarts(G, param_file, CS%ctrl_forcing_CSp, &
!### CS%restart_CSp)
call restart_init_end(CS%restart_CSp)

if (associated(CS%restart_CSp)) then
Expand All @@ -1318,8 +1312,6 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
endif
endif

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

call user_revise_forcing_init(param_file, CS%urf_CS)

call cpu_clock_end(id_clock_forcing)
Expand All @@ -1338,8 +1330,6 @@ subroutine surface_forcing_end(CS, fluxes)

if (present(fluxes)) call deallocate_forcing_type(fluxes)

!### call controlled_forcing_end(CS%ctrl_forcing_CSp)

if (associated(CS)) deallocate(CS)
CS => NULL()

Expand Down
20 changes: 0 additions & 20 deletions config_src/nuopc_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ module MOM_surface_forcing

! This file is part of MOM6. See LICENSE.md for the license.

!### use MOM_controlled_forcing, only : apply_ctrl_forcing, register_ctrl_forcing_restarts
!### use MOM_controlled_forcing, only : controlled_forcing_init, controlled_forcing_end
!### use MOM_controlled_forcing, only : ctrl_forcing_CS
use MOM_coms, only : reproducing_sum
use MOM_constants, only : hlv, hlf
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
Expand Down Expand Up @@ -148,7 +145,6 @@ module MOM_surface_forcing
! Diagnostics handles
type(forcing_diags), public :: handles

!### type(ctrl_forcing_CS), pointer :: ctrl_forcing_CSp => NULL()
type(MOM_restart_CS), pointer :: restart_CSp => NULL()
type(user_revise_forcing_CS), pointer :: urf_CS => NULL()
end type surface_forcing_CS
Expand Down Expand Up @@ -526,16 +522,6 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, &
enddo ; enddo
endif

!### if (associated(CS%ctrl_forcing_CSp)) then
!### do j=js,je ; do i=is,ie
!### SST_anom(i,j) = sfc_state%SST(i,j) - CS%T_Restore(i,j)
!### SSS_anom(i,j) = sfc_state%SSS(i,j) - CS%S_Restore(i,j)
!### SSS_mean(i,j) = 0.5*(sfc_state%SSS(i,j) + CS%S_Restore(i,j))
!### enddo ; enddo
!### call apply_ctrl_forcing(SST_anom, SSS_anom, SSS_mean, fluxes%heat_restore, &
!### fluxes%vprec, day, dt, G, CS%ctrl_forcing_CSp)
!### endif

! adjust the NET fresh-water flux to zero, if flagged
if (CS%adjust_net_fresh_water_to_zero) then
sign_for_net_FW_bug = 1.
Expand Down Expand Up @@ -1310,8 +1296,6 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,

! Set up any restart fields associated with the forcing.
call restart_init(param_file, CS%restart_CSp, "MOM_forcing.res")
!### call register_ctrl_forcing_restarts(G, param_file, CS%ctrl_forcing_CSp, &
!### CS%restart_CSp)
call restart_init_end(CS%restart_CSp)

if (associated(CS%restart_CSp)) then
Expand All @@ -1326,8 +1310,6 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
endif
endif

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

call user_revise_forcing_init(param_file, CS%urf_CS)

call cpu_clock_end(id_clock_forcing)
Expand All @@ -1344,8 +1326,6 @@ subroutine surface_forcing_end(CS, fluxes)

if (present(fluxes)) call deallocate_forcing_type(fluxes)

!### call controlled_forcing_end(CS%ctrl_forcing_CSp)

if (associated(CS)) deallocate(CS)
CS => NULL()

Expand Down
Loading

0 comments on commit 9cff98c

Please sign in to comment.