Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' of https://github.com/Hallberg-NOAA/MOM6 into…
Browse files Browse the repository at this point in the history
… Hallberg-NOAA-dev/gfdl
  • Loading branch information
adcroft committed Jun 29, 2017
2 parents 83f606a + 5f0fec7 commit 74bcc77
Show file tree
Hide file tree
Showing 19 changed files with 1,122 additions and 709 deletions.
15 changes: 9 additions & 6 deletions config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -877,25 +877,28 @@ end subroutine ocean_model_init_sfc
!WGA

subroutine ocean_model_flux_init(OS)
type(ocean_state_type), pointer :: OS
type(ocean_state_type), optional, pointer :: OS

integer :: dummy
character(len=128) :: default_ice_restart_file, default_ocean_restart_file
character(len=40) :: mod = "ocean_model_flux_init" ! This module's name.

type(param_file_type) :: param_file !< A structure to parse for run-time parameters
type(directories) :: dirs_tmp ! A structure containing several relevant directory paths.
logical :: use_OCMIP_CFCs, use_MOM_generic_tracer
logical :: OS_is_set

OS_is_set = .false. ; if (present(OS)) OS_is_set = associated(OS)

call get_MOM_Input(param_file, dirs_tmp, check_params=.false.)

call get_param(param_file, mod, "USE_OCMIP2_CFC", use_OCMIP_CFCs, &
default=.false.)
default=.false., do_not_log=.true.)
call get_param(param_file, mod, "USE_generic_tracer", use_MOM_generic_tracer,&
default=.false.)
default=.false., do_not_log=.true.)

call close_param_file(param_file, quiet_close=.true.)

if(.not.associated(OS)) then
if(.not.OS_is_set) then
if (use_OCMIP_CFCs)then
default_ice_restart_file = 'ice_ocmip2_cfc.res.nc'
default_ocean_restart_file = 'ocmip2_cfc.res.nc'
Expand All @@ -917,7 +920,7 @@ subroutine ocean_model_flux_init(OS)

if (use_MOM_generic_tracer) then
#ifdef _USE_GENERIC_TRACER
call MOM_generic_flux_init
call MOM_generic_flux_init()
#else
call MOM_error(FATAL, &
"call_tracer_register: use_MOM_generic_tracer=.true. BUT not compiled with _USE_GENERIC_TRACER")
Expand Down
875 changes: 511 additions & 364 deletions src/initialization/MOM_state_initialization.F90

Large diffs are not rendered by default.

61 changes: 44 additions & 17 deletions src/user/DOME2d_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module DOME2d_initialization
public DOME2d_initialize_temperature_salinity
public DOME2d_initialize_sponges

character(len=40) :: mod = "DOEM2D_initialization" !< This module's name.
character(len=40) :: mod = "DOME2D_initialization" !< This module's name.

contains

Expand All @@ -43,7 +43,10 @@ subroutine DOME2d_initialize_topography ( D, G, param_file, max_depth )
integer :: i, j
real :: x, bay_depth, l1, l2
real :: dome2d_width_bay, dome2d_width_bottom, dome2d_depth_bay
! This include declares and sets the variable "version".
#include "version_variable.h"

call log_version(param_file, mod, version, "")
call get_param(param_file, mod, "DOME2D_SHELF_WIDTH", dome2d_width_bay, &
'Width of shelf, as fraction of domain, in 2d DOME configuration.', &
units='nondim',default=0.1)
Expand Down Expand Up @@ -82,26 +85,35 @@ subroutine DOME2d_initialize_topography ( D, G, param_file, max_depth )
end subroutine DOME2d_initialize_topography

!> Initialize thicknesses according to coordinate mode
subroutine DOME2d_initialize_thickness ( h, G, GV, param_file )
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(out) :: h !< Layer thicknesses
type(param_file_type), intent(in) :: param_file !< Parameter file structure
subroutine DOME2d_initialize_thickness ( h, G, GV, param_file, just_read_params )
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(out) :: h !< The thickness that is being initialized, in m.
type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
!! to parse for model parameter values.
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.

! Local variables
real :: e0(SZK_(G)) ! The resting interface heights, in m, usually !
! negative because it is positive upward. !
real :: eta1D(SZK_(G)+1)! Interface height relative to the sea surface !
! positive upward, in m. !
real :: e0(SZK_(GV)) ! The resting interface heights, in m, usually !
! negative because it is positive upward. !
real :: eta1D(SZK_(GV)+1)! Interface height relative to the sea surface !
! positive upward, in m. !
integer :: i, j, k, is, ie, js, je, nz
real :: x
real :: delta_h
real :: min_thickness
character(len=40) :: verticalCoordinate
real :: dome2d_width_bay, dome2d_width_bottom, dome2d_depth_bay
logical :: just_read ! If true, just read parameters but set nothing.
character(len=40) :: verticalCoordinate

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = G%ke

call MOM_mesg("MOM_initialization.F90, DOME2d_initialize_thickness: setting thickness")
just_read = .false. ; if (present(just_read_params)) just_read = just_read_params

if (.not.just_read) &
call MOM_mesg("MOM_initialization.F90, DOME2d_initialize_thickness: setting thickness")

call get_param(param_file,mod,"MIN_THICKNESS",min_thickness, &
default=1.e-3, do_not_log=.true.)
Expand All @@ -114,6 +126,8 @@ subroutine DOME2d_initialize_thickness ( h, G, GV, param_file )
call get_param(param_file, mod, "DOME2D_SHELF_DEPTH", dome2d_depth_bay, &
default=0.2, do_not_log=.true.)

if (just_read) return ! All run-time parameters have been read, so return.

! WARNING: this routine specifies the interface heights so that the last layer
! is vanished, even at maximum depth. In order to have a uniform
! layer distribution, use this line of code within the loop:
Expand Down Expand Up @@ -202,13 +216,17 @@ end subroutine DOME2d_initialize_thickness


!> Initialize temperature and salinity in the 2d DOME configuration
subroutine DOME2d_initialize_temperature_salinity ( T, S, h, G, param_file, eqn_of_state)
subroutine DOME2d_initialize_temperature_salinity ( T, S, h, G, param_file, &
eqn_of_state, just_read_params)
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), intent(out) :: T !< Potential temperature (degC)
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), intent(out) :: S !< Salinity (ppt)
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), intent(in) :: h !< Layer thickness (m or Pa)
type(param_file_type), intent(in) :: param_file !< Parameter file structure
type(EOS_type), pointer :: eqn_of_state !< Equation of state structure
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.

! Local variables
integer :: i, j, k, is, ie, js, je, nz
real :: x;
Expand All @@ -217,11 +235,14 @@ subroutine DOME2d_initialize_temperature_salinity ( T, S, h, G, param_file, eqn_
real :: S_ref, T_ref; ! Reference salinity and temperature within surface layer
real :: S_range, T_range; ! Range of salinities and temperatures over the vertical
real :: xi0, xi1;
logical :: just_read ! If true, just read parameters but set nothing.
character(len=40) :: verticalCoordinate
real :: dome2d_width_bay, dome2d_width_bottom, dome2d_depth_bay

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = G%ke

just_read = .false. ; if (present(just_read_params)) just_read = just_read_params

call get_param(param_file,mod,"REGRIDDING_COORDINATE_MODE", verticalCoordinate, &
default=DEFAULT_COORDINATE_MODE, do_not_log=.true.)
call get_param(param_file, mod, "DOME2D_SHELF_WIDTH", dome2d_width_bay, &
Expand All @@ -230,10 +251,16 @@ subroutine DOME2d_initialize_temperature_salinity ( T, S, h, G, param_file, eqn_
default=0.3, do_not_log=.true.)
call get_param(param_file, mod, "DOME2D_SHELF_DEPTH", dome2d_depth_bay, &
default=0.2, do_not_log=.true.)
call get_param(param_file,mod,"S_REF",S_ref,'Reference salinity',units='1e-3',fail_if_missing=.true.)
call get_param(param_file,mod,"T_REF",T_ref,'Refernce temperature',units='C',fail_if_missing=.true.)
call get_param(param_file,mod,"S_RANGE",S_range,'Initial salinity range',units='1e-3',default=2.0)
call get_param(param_file,mod,"T_RANGE",T_range,'Initial temperature range',units='1e-3',default=0.0)
call get_param(param_file,mod,"S_REF",S_ref,'Reference salinity',units='1e-3', &
fail_if_missing=.not.just_read, do_not_log=just_read)
call get_param(param_file,mod,"T_REF",T_ref,'Refernce temperature',units='C', &
fail_if_missing=.not.just_read, do_not_log=just_read)
call get_param(param_file,mod,"S_RANGE",S_range,'Initial salinity range', &
units='1e-3', default=2.0, do_not_log=just_read)
call get_param(param_file,mod,"T_RANGE",T_range,'Initial temperature range', &
units='1e-3', default=0.0, do_not_log=just_read)

if (just_read) return ! All run-time parameters have been read, so return.

T(:,:,:) = 0.0
S(:,:,:) = 0.0
Expand Down
26 changes: 17 additions & 9 deletions src/user/DOME_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,30 @@ end subroutine DOME_initialize_topography

! -----------------------------------------------------------------------------
!> This subroutine initializes layer thicknesses for the DOME experiment
subroutine DOME_initialize_thickness(h, G, GV, param_file)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
real, intent(out), dimension(SZI_(G),SZJ_(G),SZK_(GV)) :: h !< The thickness that is being initialized.
type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
!! to parse for model parameter values.

real :: e0(SZK_(G)+1) ! The resting interface heights, in m, usually !
subroutine DOME_initialize_thickness(h, G, GV, param_file, just_read_params)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(out) :: h !< The thickness that is being initialized, in m.
type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
!! to parse for model parameter values.
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.

real :: e0(SZK_(GV)+1) ! The resting interface heights, in m, usually !
! negative because it is positive upward. !
real :: eta1D(SZK_(G)+1) ! Interface height relative to the sea surface !
real :: eta1D(SZK_(GV)+1) ! Interface height relative to the sea surface !
! positive upward, in m. !
logical :: just_read ! If true, just read parameters but set nothing.
character(len=40) :: mod = "DOME_initialize_thickness" ! This subroutine's name.
integer :: i, j, k, is, ie, js, je, nz

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = G%ke

just_read = .false. ; if (present(just_read_params)) just_read = just_read_params

if (just_read) return ! This subroutine has no run-time parameters.

call MOM_mesg(" DOME_initialization.F90, DOME_initialize_thickness: setting thickness", 5)

e0(1)=0.0
Expand Down
Loading

0 comments on commit 74bcc77

Please sign in to comment.