Skip to content

Commit

Permalink
Merge pull request #23 from NOAA-GFDL/dev/gfdl
Browse files Browse the repository at this point in the history
Merge in latest dev/gfdl updates
  • Loading branch information
wrongkindofdoctor authored Jul 23, 2019
2 parents b5e5c48 + 944a3c7 commit aa11e1f
Show file tree
Hide file tree
Showing 84 changed files with 7,702 additions and 5,747 deletions.
2 changes: 1 addition & 1 deletion .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# e.g. make MEMORY_SHAPE=dynamic_symmetric REPRO=1 OPENMP=1

# Versions to use
FMS_COMMIT ?= xanadu
FMS_COMMIT ?= f2e2c86f6c0eb6d389a20509a8a60fa22924e16b
MKMF_COMMIT ?= master

# Where to clone from
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- stage: check and compile
env: JOB="Code style compliance"
script:
- ./.testing/trailer.py -e TEOS10 src config_src
- ./.testing/trailer.py -e TEOS10 -l 120 src config_src
- stage: check and compile
env: JOB="Doxygen"
script:
Expand Down
128 changes: 75 additions & 53 deletions config_src/coupled_driver/MOM_surface_forcing.F90

Large diffs are not rendered by default.

47 changes: 13 additions & 34 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 @@ -356,11 +352,11 @@ subroutine wind_forcing_zero(sfc_state, forces, day, G, US, CS)

if (CS%read_gust_2d) then
if (associated(forces%ustar)) then ; do j=js,je ; do i=is,ie
forces%ustar(i,j) = US%m_to_Z * sqrt(CS%gust(i,j)/CS%Rho0)
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * sqrt(CS%gust(i,j)/CS%Rho0)
enddo ; enddo ; endif
else
if (associated(forces%ustar)) then ; do j=js,je ; do i=is,ie
forces%ustar(i,j) = US%m_to_Z * sqrt(CS%gust_const/CS%Rho0)
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * sqrt(CS%gust_const/CS%Rho0)
enddo ; enddo ; endif
endif

Expand Down Expand Up @@ -479,7 +475,7 @@ subroutine wind_forcing_gyres(sfc_state, forces, day, G, US, CS)

! set the friction velocity
do j=js,je ; do i=is,ie
forces%ustar(i,j) = US%m_to_Z * sqrt(sqrt(0.5*(forces%tauy(i,j-1)*forces%tauy(i,j-1) + &
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * sqrt(sqrt(0.5*(forces%tauy(i,j-1)*forces%tauy(i,j-1) + &
forces%tauy(i,j)*forces%tauy(i,j) + forces%taux(i-1,j)*forces%taux(i-1,j) + &
forces%taux(i,j)*forces%taux(i,j)))/CS%Rho0 + (CS%gust_const/CS%Rho0))
enddo ; enddo
Expand Down Expand Up @@ -540,12 +536,12 @@ subroutine wind_forcing_from_file(sfc_state, forces, day, G, US, CS)

if (CS%read_gust_2d) then
do j=js,je ; do i=is,ie
forces%ustar(i,j) = US%m_to_Z * sqrt((sqrt(temp_x(i,j)*temp_x(i,j) + &
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * sqrt((sqrt(temp_x(i,j)*temp_x(i,j) + &
temp_y(i,j)*temp_y(i,j)) + CS%gust(i,j)) / CS%Rho0)
enddo ; enddo
else
do j=js,je ; do i=is,ie
forces%ustar(i,j) = US%m_to_Z * sqrt(sqrt(temp_x(i,j)*temp_x(i,j) + &
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * sqrt(sqrt(temp_x(i,j)*temp_x(i,j) + &
temp_y(i,j)*temp_y(i,j))/CS%Rho0 + (CS%gust_const/CS%Rho0))
enddo ; enddo
endif
Expand All @@ -565,13 +561,13 @@ subroutine wind_forcing_from_file(sfc_state, forces, day, G, US, CS)
call pass_vector(forces%taux, forces%tauy, G%Domain, To_All)
if (CS%read_gust_2d) then
do j=js, je ; do i=is, ie
forces%ustar(i,j) = US%m_to_Z * sqrt((sqrt(0.5*((forces%tauy(i,j-1)**2 + &
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * sqrt((sqrt(0.5*((forces%tauy(i,j-1)**2 + &
forces%tauy(i,j)**2) + (forces%taux(i-1,j)**2 + &
forces%taux(i,j)**2))) + CS%gust(i,j)) / CS%Rho0 )
enddo ; enddo
else
do j=js, je ; do i=is, ie
forces%ustar(i,j) = US%m_to_Z * sqrt(sqrt(0.5*((forces%tauy(i,j-1)**2 + &
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * sqrt(sqrt(0.5*((forces%tauy(i,j-1)**2 + &
forces%tauy(i,j)**2) + (forces%taux(i-1,j)**2 + &
forces%taux(i,j)**2)))/CS%Rho0 + (CS%gust_const/CS%Rho0))
enddo ; enddo
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
20 changes: 11 additions & 9 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 All @@ -106,7 +106,7 @@ subroutine USER_wind_forcing(sfc_state, forces, day, G, US, CS)

! This subroutine sets the surface wind stresses, forces%taux and forces%tauy [Pa].
! In addition, this subroutine can be used to set the surface friction velocity,
! forces%ustar [Z s-1 ~> m s-1], which is needed with a bulk mixed layer.
! forces%ustar [Z T-1 ~> m s-1], which is needed with a bulk mixed layer.

integer :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
Expand Down Expand Up @@ -139,7 +139,7 @@ subroutine USER_wind_forcing(sfc_state, forces, day, G, US, CS)
! Set the surface friction velocity [Z s-1 ~> m s-1]. ustar is always positive.
if (associated(forces%ustar)) then ; do j=js,je ; do i=is,ie
! This expression can be changed if desired, but need not be.
forces%ustar(i,j) = US%m_to_Z * G%mask2dT(i,j) * sqrt(CS%gust_const/CS%Rho0 + &
forces%ustar(i,j) = US%m_to_Z*US%T_to_s * G%mask2dT(i,j) * sqrt(CS%gust_const/CS%Rho0 + &
sqrt(0.5*(forces%taux(I-1,j)**2 + forces%taux(I,j)**2) + &
0.5*(forces%tauy(i,J-1)**2 + forces%tauy(i,J)**2))/CS%Rho0)
enddo ; enddo ; endif
Expand All @@ -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
Loading

0 comments on commit aa11e1f

Please sign in to comment.