Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
219 changes: 90 additions & 129 deletions src/initialization/MOM_state_initialization.F90

Large diffs are not rendered by default.

22 changes: 8 additions & 14 deletions src/user/DOME2d_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ 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, depth_tot, G, GV, US, param_file, just_read_params )
subroutine DOME2d_initialize_thickness ( h, depth_tot, G, GV, US, param_file, just_read )
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(out) :: h !< The thickness that is being initialized [H ~> m or kg m-2].
real, dimension(SZI_(G),SZJ_(G)), &
intent(in) :: depth_tot !< The nominal total depth of the ocean [Z ~> m]
intent(in) :: depth_tot !< The nominal total depth of the ocean [Z ~> 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.
logical, intent(in) :: just_read !< If true, this call will only read
!! parameters without changing h.

! Local variables
real :: e0(SZK_(GV)) ! The resting interface heights, in depth units [Z ~> m], usually
Expand All @@ -113,13 +113,10 @@ subroutine DOME2d_initialize_thickness ( h, depth_tot, G, GV, US, param_file, ju
real :: delta_h
real :: min_thickness
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 = GV%ke

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")

Expand Down Expand Up @@ -224,33 +221,30 @@ end subroutine DOME2d_initialize_thickness

!> Initialize temperature and salinity in the 2d DOME configuration
subroutine DOME2d_initialize_temperature_salinity ( T, S, h, G, GV, param_file, &
eqn_of_state, just_read_params)
eqn_of_state, just_read)
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(out) :: T !< Potential temperature [degC]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(out) :: S !< Salinity [ppt]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h !< Layer thickness [H ~> m or kg m-2]
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
logical, intent(in) :: just_read !< If true, this call will
!! only read parameters without changing T & S.

! Local variables
integer :: i, j, k, is, ie, js, je, nz
real :: x
integer :: index_bay_z
real :: delta_S, delta_T
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 :: 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 = GV%ke

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

call get_param(param_file, mdl,"REGRIDDING_COORDINATE_MODE", verticalCoordinate, &
default=DEFAULT_COORDINATE_MODE, do_not_log=.true.)
call get_param(param_file, mdl, "DOME2D_SHELF_WIDTH", dome2d_width_bay, &
Expand Down
15 changes: 6 additions & 9 deletions src/user/DOME_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ end subroutine DOME_initialize_topography

! -----------------------------------------------------------------------------
!> This subroutine initializes layer thicknesses for the DOME experiment
subroutine DOME_initialize_thickness(h, depth_tot, G, GV, param_file, just_read_params)
subroutine DOME_initialize_thickness(h, depth_tot, G, GV, param_file, just_read)
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)), &
Expand All @@ -96,21 +96,18 @@ subroutine DOME_initialize_thickness(h, depth_tot, G, GV, param_file, just_read_
intent(in) :: depth_tot !< The nominal total depth of the ocean [Z ~> 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.
logical, intent(in) :: just_read !< If true, this call will only read
!! parameters without changing h.

real :: e0(SZK_(GV)+1) ! The resting interface heights [Z ~> m], usually
! negative because it is positive upward [Z ~> m].
real :: eta1D(SZK_(GV)+1) ! Interface height relative to the sea surface
! positive upward [Z ~> m].
logical :: just_read ! If true, just read parameters but set nothing.
character(len=40) :: mdl = "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 = GV%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)
Expand Down Expand Up @@ -149,8 +146,8 @@ end subroutine DOME_initialize_thickness
!! the first registered field. !
subroutine DOME_initialize_sponges(G, GV, US, tv, depth_tot, PF, CSp)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(thermo_var_ptrs), intent(in) :: tv !< A structure containing pointers to any available
!! thermodynamic fields, including potential temperature and
!! salinity or mixed layer density. Absent fields have NULL ptrs.
Expand Down Expand Up @@ -250,7 +247,7 @@ end subroutine DOME_initialize_sponges
subroutine register_DOME_OBC(param_file, US, OBC, tr_Reg)
type(param_file_type), intent(in) :: param_file !< parameter file.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(ocean_OBC_type), pointer :: OBC !< OBC registry.
type(ocean_OBC_type), pointer :: OBC !< OBC registry.
type(tracer_registry_type), pointer :: tr_Reg !< Tracer registry.

if (OBC%number_of_segments /= 1) then
Expand Down
22 changes: 8 additions & 14 deletions src/user/ISOMIP_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ subroutine ISOMIP_initialize_topography(D, G, param_file, max_depth, US)
real :: min_depth ! The minimum and maximum depths [Z ~> m].
real :: m_to_Z ! A dimensional rescaling factor.
! The following variables are used to set up the bathymetry in the ISOMIP example.
real :: bmax ! max depth of bedrock topography
real :: b0,b2,b4,b6 ! first, second, third and fourth bedrock topography coeff
real :: xbar ! characteristic along-flow lenght scale of the bedrock
real :: bmax ! max depth of bedrock topography [Z ~> m]
real :: b0,b2,b4,b6 ! first, second, third and fourth bedrock topography coeffs [Z ~> m]
real :: xbar ! characteristic along-flow length scale of the bedrock
real :: dc ! depth of the trough compared with side walls [Z ~> m].
real :: fc ! characteristic width of the side walls of the channel
real :: wc ! half-width of the trough
Expand Down Expand Up @@ -128,7 +128,7 @@ subroutine ISOMIP_initialize_topography(D, G, param_file, max_depth, US)
end subroutine ISOMIP_initialize_topography

!> Initialization of thicknesses
subroutine ISOMIP_initialize_thickness ( h, depth_tot, G, GV, US, param_file, tv, just_read_params)
subroutine ISOMIP_initialize_thickness ( h, depth_tot, G, GV, US, param_file, tv, just_read)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
Expand All @@ -141,8 +141,8 @@ subroutine ISOMIP_initialize_thickness ( h, depth_tot, G, GV, US, param_file, tv
type(thermo_var_ptrs), intent(in) :: tv !< A structure containing pointers to any
!! available thermodynamic fields, including
!! the eqn. of state.
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.
logical, intent(in) :: just_read !< If true, this call will only read
!! parameters without changing h.
! Local variables
real :: e0(SZK_(GV)+1) ! The resting interface heights, in depth units [Z ~> m],
! usually negative because it is positive upward.
Expand All @@ -153,14 +153,11 @@ subroutine ISOMIP_initialize_thickness ( h, depth_tot, G, GV, US, param_file, tv
real :: min_thickness, s_sur, s_bot, t_sur, t_bot
real :: rho_sur, rho_bot ! Surface and bottom densities [R ~> kg m-3]
real :: rho_range ! The range of densities [R ~> kg m-3]
logical :: just_read ! If true, just read parameters but set nothing.
character(len=256) :: mesg ! The text of an error message
character(len=40) :: verticalCoordinate

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

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

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

Expand Down Expand Up @@ -251,7 +248,7 @@ end subroutine ISOMIP_initialize_thickness

!> Initial values for temperature and salinity
subroutine ISOMIP_initialize_temperature_salinity ( T, S, h, depth_tot, G, GV, US, param_file, &
eqn_of_state, just_read_params)
eqn_of_state, just_read)
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
Expand All @@ -262,7 +259,7 @@ subroutine ISOMIP_initialize_temperature_salinity ( T, S, h, depth_tot, G, GV, U
!! depth of the ocean [Z ~> m]
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
logical, intent(in) :: just_read !< If true, this call will
!! only read parameters without changing T & S.
! Local variables
integer :: i, j, k, is, ie, js, je, nz, itt
Expand All @@ -277,7 +274,6 @@ subroutine ISOMIP_initialize_temperature_salinity ( T, S, h, depth_tot, G, GV, U
character(len=256) :: mesg ! The text of an error message
character(len=40) :: verticalCoordinate, density_profile
real :: rho_tmp
logical :: just_read ! If true, just read parameters but set nothing.
logical :: fit_salin ! If true, accept the prescribed temperature and fit the salinity.
real :: T0(SZK_(GV)) ! A profile of temperatures [degC]
real :: S0(SZK_(GV)) ! A profile of salinities [ppt]
Expand All @@ -291,8 +287,6 @@ subroutine ISOMIP_initialize_temperature_salinity ( T, S, h, depth_tot, G, GV, U
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
pres(:) = 0.0

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

call get_param(param_file, mdl, "REGRIDDING_COORDINATE_MODE", verticalCoordinate, &
default=DEFAULT_COORDINATE_MODE, do_not_log=just_read)
call get_param(param_file, mdl, "ISOMIP_T_SUR",t_sur, &
Expand Down
18 changes: 6 additions & 12 deletions src/user/Phillips_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Phillips_initialization
contains

!> Initialize the thickness field for the Phillips model test case.
subroutine Phillips_initialize_thickness(h, depth_tot, G, GV, US, param_file, just_read_params)
subroutine Phillips_initialize_thickness(h, depth_tot, G, GV, US, param_file, just_read)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
Expand All @@ -45,8 +45,8 @@ subroutine Phillips_initialize_thickness(h, depth_tot, G, GV, US, param_file, ju
intent(in) :: depth_tot !< The nominal total depth of the ocean [Z ~> 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.
logical, intent(in) :: just_read !< If true, this call will only read
!! parameters without changing h.

real :: eta0(SZK_(GV)+1) ! The 1-d nominal positions of the interfaces [Z ~> m]
real :: eta_im(SZJ_(G),SZK_(GV)+1) ! A temporary array for zonal-mean eta [Z ~> m]
Expand All @@ -56,7 +56,6 @@ subroutine Phillips_initialize_thickness(h, depth_tot, G, GV, US, param_file, ju
real :: y_2 ! The y-position relative to the center of the domain [km]
real :: half_strat ! The fractional depth where the stratification is centered [nondim]
real :: half_depth ! The depth where the stratification is centered [Z ~> m]
logical :: just_read ! If true, just read parameters but set nothing.
logical :: reentrant_y ! If true, model is re-entrant in the y direction
character(len=40) :: mdl = "Phillips_initialize_thickness" ! This subroutine's name.
integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
Expand All @@ -67,8 +66,6 @@ subroutine Phillips_initialize_thickness(h, depth_tot, G, GV, US, param_file, ju

eta_im(:,:) = 0.0

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

if (.not.just_read) call log_version(param_file, mdl, version)
call get_param(param_file, mdl, "HALF_STRAT_DEPTH", half_strat, &
"The fractional depth where the stratification is centered.", &
Expand Down Expand Up @@ -130,7 +127,7 @@ subroutine Phillips_initialize_thickness(h, depth_tot, G, GV, US, param_file, ju
end subroutine Phillips_initialize_thickness

!> Initialize the velocity fields for the Phillips model test case
subroutine Phillips_initialize_velocity(u, v, G, GV, US, param_file, just_read_params)
subroutine Phillips_initialize_velocity(u, v, G, GV, US, param_file, just_read)
type(ocean_grid_type), intent(in) :: G !< Grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), &
Expand All @@ -140,8 +137,8 @@ subroutine Phillips_initialize_velocity(u, v, G, GV, US, param_file, just_read_p
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(param_file_type), intent(in) :: param_file !< A structure indicating the open file to
!! parse for modelparameter values.
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.
logical, intent(in) :: just_read !< If true, this call will only read
!! parameters without changing u & v.

real :: jet_width ! The width of the zonal-mean jet [km]
real :: jet_height ! The interface height scale associated with the zonal-mean jet [Z ~> m]
Expand All @@ -150,13 +147,10 @@ subroutine Phillips_initialize_velocity(u, v, G, GV, US, param_file, just_read_p
real :: velocity_amplitude ! The amplitude of velocity perturbations [L T-1 ~> m s-1]
real :: pi ! The ratio of the circumference of a circle to its diameter [nondim]
integer :: i, j, k, is, ie, js, je, nz, m
logical :: just_read ! If true, just read parameters but set nothing.
logical :: reentrant_y ! If true, model is re-entrant in the y direction
character(len=40) :: mdl = "Phillips_initialize_velocity" ! This subroutine's name.
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke

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

if (.not.just_read) call log_version(param_file, mdl, version)
call get_param(param_file, mdl, "VELOCITY_IC_PERTURB_AMP", velocity_amplitude, &
"The magnitude of the initial velocity perturbation.", &
Expand Down
Loading