Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOM6: +(*)Rescale pressures #1089

Merged
merged 62 commits into from
Apr 21, 2020
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
5a56df7
+Add optional pres_scale arguments to EOS routines
Hallberg-NOAA Apr 4, 2020
63c4510
+Rescaled Boussinesq pressure force calculations
Hallberg-NOAA Apr 4, 2020
7632abe
+Add optional SV_scale arg to int_specific_vol_dp
Hallberg-NOAA Apr 5, 2020
3b3c34a
+Rescaled non-Boussinesq pressure force calcs
Hallberg-NOAA Apr 5, 2020
94f94ed
Rescaled pressure in find_eta routines
Hallberg-NOAA Apr 6, 2020
f29e32a
Rescaled pressure in calc_isoneutral_slopes
Hallberg-NOAA Apr 6, 2020
efbbd31
Rescaled pressures in calculate_vertical_integrals
Hallberg-NOAA Apr 6, 2020
f9b63f3
+Added RL2_T2_to_Pa element to unit_scale_type
Hallberg-NOAA Apr 7, 2020
6d7dde4
Use combined scaling factors
Hallberg-NOAA Apr 7, 2020
6af725f
+Rescaled the units of fluxes%p_surf
Hallberg-NOAA Apr 8, 2020
20ae74d
Merge branch 'dev/gfdl' into rescale_pressure
Hallberg-NOAA Apr 8, 2020
916be3c
Rescaled ice_shelf_CS%g_Earth like GV%g_Earth
Hallberg-NOAA Apr 8, 2020
5e16458
+Add optional pres_scale arg to calculate_TFreeze
Hallberg-NOAA Apr 9, 2020
1252e3b
Pass rescaled pressures to calculate_TFreeze
Hallberg-NOAA Apr 9, 2020
ce0905e
+Add hor_index_type variants of EOS routines
Hallberg-NOAA Apr 10, 2020
2fc1c2e
Use new HI_1d forms of calculate_density calls
Hallberg-NOAA Apr 11, 2020
3223eb6
+Rescaled the units of tv%P_Ref to [R L2 T-2]
Hallberg-NOAA Apr 11, 2020
fb820c1
+Rescaled pressure arguments to multiple routines
Hallberg-NOAA Apr 12, 2020
6948cb7
+Replaced optional pres_scale args with US args
Hallberg-NOAA Apr 12, 2020
1e8c501
Corrected pressure units in comments
Hallberg-NOAA Apr 13, 2020
8df34f4
Rescaled internal MOM_diapyc_energy_req variables
Hallberg-NOAA Apr 13, 2020
500c9e3
Rescaled pressures in 17 calculate_density calls
Hallberg-NOAA Apr 13, 2020
00db8d5
Corrected a bug in calculate_spec_vol_derivs_H1_1d
Hallberg-NOAA Apr 13, 2020
2a951e7
Redirected various EOS interfaces to common code
Hallberg-NOAA Apr 13, 2020
04fcfd4
+Rescaled args to find_depth_of_pressure_in_cell
Hallberg-NOAA Apr 14, 2020
b72afce
+Made arguments to unit_scaling_init optional
Hallberg-NOAA Apr 14, 2020
a7836f0
+Rescaled variables in MOM_neutral_diffusion.F90
Hallberg-NOAA Apr 14, 2020
7643bce
Simpler calculate_density in ISOMIP_initialization
Hallberg-NOAA Apr 14, 2020
030a636
Nullify a pointer in neutral diffusion unit tests
Hallberg-NOAA Apr 15, 2020
ad0c70e
Rescaled three diagnosed densities
Hallberg-NOAA Apr 15, 2020
608d210
Rescaled pressures in wave speed calculations
Hallberg-NOAA Apr 15, 2020
a01dae5
Corrected 3 openMP declarations
Hallberg-NOAA Apr 15, 2020
bb73bb8
+(*)Rescaled pressures used to build coordinates
Hallberg-NOAA Apr 15, 2020
4182ad2
+Add optional US arg to calculate_compress
Hallberg-NOAA Apr 15, 2020
b84b2d3
Rescaled variables in convert_thickness
Hallberg-NOAA Apr 15, 2020
da12012
Minor cleanup related to pressure rescaling
Hallberg-NOAA Apr 15, 2020
ae944c2
Merge branch 'dev/gfdl' into rescale_pressure
Hallberg-NOAA Apr 15, 2020
87054b4
Added an omitted dOxygen comment
Hallberg-NOAA Apr 15, 2020
77b6b74
(*)Set loop bounds in calculate_density calls
Hallberg-NOAA Apr 15, 2020
a00c327
(*)Reordered setting calculate_density loop bounds
Hallberg-NOAA Apr 15, 2020
620a97c
Merge branch 'dev/gfdl' into rescale_pressure
Hallberg-NOAA Apr 16, 2020
ab9d8e9
+Added dom interface to calculate_density
Hallberg-NOAA Apr 17, 2020
415a6bc
Adds unit conversions to EOS type
adcroft Apr 17, 2020
acf23a4
Use the 'dom=' interface to calculate_density
Hallberg-NOAA Apr 17, 2020
18d520e
Remove optional US from most MOM_EOS functions
adcroft Apr 17, 2020
4f42d72
Fixed the spelling in an openMP directive
Hallberg-NOAA Apr 17, 2020
abecf02
Merge branch 'Hallberg-NOAA-rescale_pressure' into rescale_pressure
adcroft Apr 17, 2020
0caf9cc
Missed a conflict resolution
adcroft Apr 17, 2020
371ed85
Initialize scaling params without EOS_init()
adcroft Apr 17, 2020
9b53927
Rescaled internal MOM_CVMix variables
Hallberg-NOAA Apr 17, 2020
760dc39
+Rescaled variables in coord_adapt
Hallberg-NOAA Apr 17, 2020
cdeda16
Switched versions of calculate_density in 22 calls
Hallberg-NOAA Apr 19, 2020
7282956
Merge branch 'rescale_pressure' of git://github.com/adcroft/MOM6 into…
Hallberg-NOAA Apr 19, 2020
f0f894c
Merge branch 'Adcroft_rescale_pressure' into rescale_pressure
Hallberg-NOAA Apr 19, 2020
9c5239e
Corrected MOM_EOS dimensional rescaling problem
Hallberg-NOAA Apr 19, 2020
718c3ab
Removed US argument to find_depth_of_pressure_in_cell
Hallberg-NOAA Apr 19, 2020
e3c434e
Store return values from EOS_domain
Hallberg-NOAA Apr 19, 2020
3a817ef
Fixed a diagnostic halo extent
Hallberg-NOAA Apr 20, 2020
37d30b5
Eliminated the use of GV%mks_g_Earth
Hallberg-NOAA Apr 20, 2020
18b2193
Fixed compile time bugs in mom_surface_forcing_mct
Hallberg-NOAA Apr 20, 2020
f5eb171
Eliminated some US args in MOM_neutral_diffusion
Hallberg-NOAA Apr 20, 2020
8cddc68
Merge branch 'dev/gfdl' into rescale_pressure
marshallward Apr 21, 2020
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
Prev Previous commit
Next Next commit
+Rescaled pressure arguments to multiple routines
  Rescaled the reference pressure arguments to 3 set_coord routines, 5
initialization routines, and kappa_shear_column.  Also removed the unused pres
argument to convert_temp_salt_for_TEOS10 and replaced its ocean_grid_type
argument with a hor_index_type.  All answers are bitwise identical.
Hallberg-NOAA committed Apr 12, 2020
commit fb820c1e757f6b321eea1ff33c9e046c6be4602c
27 changes: 13 additions & 14 deletions src/equation_of_state/MOM_EOS.F90
Original file line number Diff line number Diff line change
@@ -3129,19 +3129,16 @@ subroutine int_spec_vol_dp_generic_plm(T_t, T_b, S_t, S_b, p_t, p_b, alpha_ref,
end subroutine int_spec_vol_dp_generic_plm

!> Convert T&S to Absolute Salinity and Conservative Temperature if using TEOS10
subroutine convert_temp_salt_for_TEOS10(T, S, press, G, kd, mask_z, EOS)
use MOM_grid, only : ocean_grid_type

type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), &
subroutine convert_temp_salt_for_TEOS10(T, S, HI, kd, mask_z, EOS)
integer, intent(in) :: kd !< The number of layers to work on
type(hor_index_type), intent(in) :: HI !< The horizontal index structure
real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed,kd), &
intent(inout) :: T !< Potential temperature referenced to the surface [degC]
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), &
real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed,kd), &
intent(inout) :: S !< Salinity [ppt]
real, dimension(:), intent(in) :: press !< Pressure at the top of the layer [Pa].
type(EOS_type), pointer :: EOS !< Equation of state structure
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), &
real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed,kd), &
intent(in) :: mask_z !< 3d mask regulating which points to convert.
integer, intent(in) :: kd !< The number of layers to work on
type(EOS_type), pointer :: EOS !< Equation of state structure

integer :: i,j,k
real :: gsw_sr_from_sp, gsw_ct_from_pt, gsw_sa_from_sp
@@ -3152,12 +3149,14 @@ subroutine convert_temp_salt_for_TEOS10(T, S, press, G, kd, mask_z, EOS)

if ((EOS%form_of_EOS /= EOS_TEOS10) .and. (EOS%form_of_EOS /= EOS_NEMO)) return

do k=1,kd ; do j=G%jsc,G%jec ; do i=G%isc,G%iec
do k=1,kd ; do j=HI%jsc,HI%jec ; do i=HI%isc,HI%iec
if (mask_z(i,j,k) >= 1.0) then
S(i,j,k) = gsw_sr_from_sp(S(i,j,k))
! p=press(k)/10000. !convert pascal to dbar
! S(i,j,k) = gsw_sa_from_sp(S(i,j,k),p,G%geoLonT(i,j),G%geoLatT(i,j))
T(i,j,k) = gsw_ct_from_pt(S(i,j,k),T(i,j,k))
! Get absolute salnity from practical salinity, converting pressures from Pascal to dbar.
! If this option is activated, pressure will need to be added as an argument, and it should be
! moved out into module that is not shared between components, where the ocean_grid can be used.
! S(i,j,k) = gsw_sa_from_sp(S(i,j,k),pres(i,j,k)*1.0e-4,G%geoLonT(i,j),G%geoLatT(i,j))
T(i,j,k) = gsw_ct_from_pt(S(i,j,k), T(i,j,k))
endif
enddo ; enddo ; enddo
end subroutine convert_temp_salt_for_TEOS10
37 changes: 20 additions & 17 deletions src/initialization/MOM_coord_initialization.F90
Original file line number Diff line number Diff line change
@@ -89,11 +89,11 @@ subroutine MOM_initialize_coord(GV, US, PF, write_geom, output_dir, tv, max_dept
case ("linear")
call set_coord_linear(GV%Rlay, GV%g_prime, GV, US, PF)
case ("ts_ref")
call set_coord_from_ts_ref(GV%Rlay, GV%g_prime, GV, US, PF, eos, US%RL2_T2_to_Pa*tv%P_Ref)
call set_coord_from_TS_ref(GV%Rlay, GV%g_prime, GV, US, PF, eos, tv%P_Ref)
case ("ts_profile")
call set_coord_from_TS_profile(GV%Rlay, GV%g_prime, GV, US, PF, eos, US%RL2_T2_to_Pa*tv%P_Ref)
call set_coord_from_TS_profile(GV%Rlay, GV%g_prime, GV, US, PF, eos, tv%P_Ref)
case ("ts_range")
call set_coord_from_TS_range(GV%Rlay, GV%g_prime, GV, US, PF, eos, US%RL2_T2_to_Pa*tv%P_Ref)
call set_coord_from_TS_range(GV%Rlay, GV%g_prime, GV, US, PF, eos, tv%P_Ref)
case ("file")
call set_coord_from_file(GV%Rlay, GV%g_prime, GV, US, PF)
case ("USER")
@@ -198,8 +198,7 @@ subroutine set_coord_from_layer_density(Rlay, g_prime, GV, US, param_file)
end subroutine set_coord_from_layer_density

!> Sets the layer densities (Rlay) and the interface reduced gravities (g) from a profile of g'.
subroutine set_coord_from_TS_ref(Rlay, g_prime, GV, US, param_file, eqn_of_state, &
P_Ref)
subroutine set_coord_from_TS_ref(Rlay, g_prime, GV, US, param_file, eqn_of_state, P_Ref)
real, dimension(:), intent(out) :: Rlay !< The layers' target coordinate values
!! (potential density) [R ~> kg m-3].
real, dimension(:), intent(out) :: g_prime !< The reduced gravity across the interfaces
@@ -209,7 +208,8 @@ subroutine set_coord_from_TS_ref(Rlay, g_prime, GV, US, param_file, eqn_of_state
type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time
!! parameters
type(EOS_type), pointer :: eqn_of_state !< integer selecting the equation of state.
real, intent(in) :: P_Ref !< The coordinate-density reference pressure [Pa].
real, intent(in) :: P_Ref !< The coordinate-density reference pressure
!! [R L2 T-2 ~> Pa].
! Local variables
real :: T_ref ! Reference temperature
real :: S_ref ! Reference salinity
@@ -240,7 +240,8 @@ subroutine set_coord_from_TS_ref(Rlay, g_prime, GV, US, param_file, eqn_of_state
! The uppermost layer's density is set here. Subsequent layers' !
! densities are determined from this value and the g values. !
! T0 = 28.228 ; S0 = 34.5848 ; Pref = P_Ref
call calculate_density(T_ref, S_ref, P_ref, Rlay(1), eqn_of_state, scale=US%kg_m3_to_R)
call calculate_density(T_ref, S_ref, P_ref, Rlay(1), eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)

! These statements set the layer densities. !
do k=2,nz ; Rlay(k) = Rlay(k-1) + g_prime(k)*(GV%Rho0/GV%g_Earth) ; enddo
@@ -249,8 +250,7 @@ subroutine set_coord_from_TS_ref(Rlay, g_prime, GV, US, param_file, eqn_of_state
end subroutine set_coord_from_TS_ref

!> Sets the layer densities (Rlay) and the interface reduced gravities (g) from a T-S profile.
subroutine set_coord_from_TS_profile(Rlay, g_prime, GV, US, param_file, &
eqn_of_state, P_Ref)
subroutine set_coord_from_TS_profile(Rlay, g_prime, GV, US, param_file, eqn_of_state, P_Ref)
real, dimension(:), intent(out) :: Rlay !< The layers' target coordinate values
!! (potential density) [R ~> kg m-3].
real, dimension(:), intent(out) :: g_prime !< The reduced gravity across the interfaces
@@ -260,7 +260,9 @@ subroutine set_coord_from_TS_profile(Rlay, g_prime, GV, US, param_file, &
type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time
!! parameters
type(EOS_type), pointer :: eqn_of_state !< integer that selects equation of state.
real, intent(in) :: P_Ref !< The coordinate-density reference pressure [Pa].
real, intent(in) :: P_Ref !< The coordinate-density reference pressure
!! [R L2 T-2 ~> Pa].

! Local variables
real, dimension(GV%ke) :: T0, S0, Pref
real :: g_fs ! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].
@@ -289,16 +291,15 @@ subroutine set_coord_from_TS_profile(Rlay, g_prime, GV, US, param_file, &
" set_coord_from_TS_profile: Unable to open " //trim(filename))
! These statements set the interface reduced gravities. !
g_prime(1) = g_fs
do k=1,nz ; Pref(k) = P_ref ; enddo
call calculate_density(T0, S0, Pref, Rlay, 1, nz, eqn_of_state, scale=US%kg_m3_to_R)
do k=1,nz ; Pref(k) = P_Ref ; enddo
call calculate_density(T0, S0, Pref, Rlay, 1, nz, eqn_of_state, scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)
do k=2,nz; g_prime(k) = (GV%g_Earth/(GV%Rho0)) * (Rlay(k) - Rlay(k-1)) ; enddo

call callTree_leave(trim(mdl)//'()')
end subroutine set_coord_from_TS_profile

!> Sets the layer densities (Rlay) and the interface reduced gravities (g) from a linear T-S profile.
subroutine set_coord_from_TS_range(Rlay, g_prime, GV, US, param_file, &
eqn_of_state, P_Ref)
subroutine set_coord_from_TS_range(Rlay, g_prime, GV, US, param_file, eqn_of_state, P_Ref)
real, dimension(:), intent(out) :: Rlay !< The layers' target coordinate values
!! (potential density) [R ~> kg m-3].
real, dimension(:), intent(out) :: g_prime !< The reduced gravity across the interfaces
@@ -308,7 +309,8 @@ subroutine set_coord_from_TS_range(Rlay, g_prime, GV, US, param_file, &
type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time
!! parameters
type(EOS_type), pointer :: eqn_of_state !< integer that selects equation of state
real, intent(in) :: P_Ref !< The coordinate-density reference pressure [Pa]
real, intent(in) :: P_Ref !< The coordinate-density reference pressure
!! [R L2 T-2 ~> Pa].

! Local variables
real, dimension(GV%ke) :: T0, S0, Pref
@@ -369,8 +371,9 @@ subroutine set_coord_from_TS_range(Rlay, g_prime, GV, US, param_file, &
enddo

g_prime(1) = g_fs
do k=1,nz ; Pref(k) = P_ref ; enddo
call calculate_density(T0, S0, Pref, Rlay, k_light, nz-k_light+1, eqn_of_state, scale=US%kg_m3_to_R)
do k=1,nz ; Pref(k) = P_Ref ; enddo
call calculate_density(T0, S0, Pref, Rlay, k_light, nz-k_light+1, eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)
! Extrapolate target densities for the variable density mixed and buffer layers.
do k=k_light-1,1,-1
Rlay(k) = 2.0*Rlay(k+1) - Rlay(k+2)
35 changes: 20 additions & 15 deletions src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
@@ -291,9 +291,9 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, US, PF, dirs, &
case ("ISOMIP"); call ISOMIP_initialize_thickness(h, G, GV, US, PF, tv, &
just_read_params=just_read)
case ("benchmark"); call benchmark_initialize_thickness(h, G, GV, US, PF, &
tv%eqn_of_state, US%RL2_T2_to_Pa*tv%P_Ref, just_read_params=just_read)
tv%eqn_of_state, tv%P_Ref, just_read_params=just_read)
case ("Neverland"); call Neverland_initialize_thickness(h, G, GV, US, PF, &
tv%eqn_of_state, US%RL2_T2_to_Pa*tv%P_Ref)
tv%eqn_of_state, tv%P_Ref)
case ("search"); call initialize_thickness_search
case ("circle_obcs"); call circle_obcs_initialize_thickness(h, G, GV, PF, &
just_read_params=just_read)
@@ -348,11 +348,11 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, US, PF, dirs, &
! " \t baroclinic_zone - an analytic baroclinic zone. \n"//&
select case (trim(config))
case ("fit"); call initialize_temp_salt_fit(tv%T, tv%S, G, GV, US, PF, &
eos, US%RL2_T2_to_Pa*tv%P_Ref, just_read_params=just_read)
eos, tv%P_Ref, just_read_params=just_read)
case ("file"); call initialize_temp_salt_from_file(tv%T, tv%S, G, &
PF, just_read_params=just_read)
case ("benchmark"); call benchmark_init_temperature_salinity(tv%T, tv%S, &
G, GV, US, PF, eos, US%RL2_T2_to_Pa*tv%P_Ref, just_read_params=just_read)
G, GV, US, PF, eos, tv%P_Ref, just_read_params=just_read)
case ("TS_profile") ; call initialize_temp_salt_from_profile(tv%T, tv%S, &
G, PF, just_read_params=just_read)
case ("linear"); call initialize_temp_salt_linear(tv%T, tv%S, G, PF, &
@@ -1561,15 +1561,15 @@ subroutine initialize_temp_salt_fit(T, S, G, GV, US, param_file, eqn_of_state, P
!! parameters.
type(EOS_type), pointer :: eqn_of_state !< Integer that selects the equatio of state.
real, intent(in) :: P_Ref !< The coordinate-density reference pressure
!! [Pa].
!! [R L2 T-2 ~> Pa].
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.
! Local variables
real :: T0(SZK_(G)) ! Layer potential temperatures [degC]
real :: S0(SZK_(G)) ! Layer salinities [degC]
real :: T_Ref ! Reference Temperature [degC]
real :: S_Ref ! Reference Salinity [ppt]
real :: pres(SZK_(G)) ! An array of the reference pressure [Pa].
real :: pres(SZK_(G)) ! An array of the reference pressure [R L2 T-2 ~> Pa].
real :: drho_dT(SZK_(G)) ! Derivative of density with temperature [R degC-1 ~> kg m-3 degC-1].
real :: drho_dS(SZK_(G)) ! Derivative of density with salinity [R ppt-1 ~> kg m-3 ppt-1].
real :: rho_guess(SZK_(G)) ! Potential density at T0 & S0 [R ~> kg m-3].
@@ -1601,8 +1601,10 @@ subroutine initialize_temp_salt_fit(T, S, G, GV, US, param_file, eqn_of_state, P
T0(k) = T_Ref
enddo

call calculate_density(T0(1),S0(1),pres(1),rho_guess(1),eqn_of_state, scale=US%kg_m3_to_R)
call calculate_density_derivs(T0,S0,pres,drho_dT,drho_dS,1,1,eqn_of_state, scale=US%kg_m3_to_R)
call calculate_density(T0(1), S0(1), pres(1), rho_guess(1), eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)
call calculate_density_derivs(T0, S0, pres, drho_dT, drho_dS, 1, 1, eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)

if (fit_salin) then
! A first guess of the layers' temperatures.
@@ -1611,8 +1613,10 @@ subroutine initialize_temp_salt_fit(T, S, G, GV, US, param_file, eqn_of_state, P
enddo
! Refine the guesses for each layer.
do itt=1,6
call calculate_density(T0,S0,pres,rho_guess,1,nz,eqn_of_state, scale=US%kg_m3_to_R)
call calculate_density_derivs(T0,S0,pres,drho_dT,drho_dS,1,nz,eqn_of_state, scale=US%kg_m3_to_R)
call calculate_density(T0, S0, pres, rho_guess, 1, nz, eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)
call calculate_density_derivs(T0, S0, pres, drho_dT, drho_dS, 1, nz, eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)
do k=1,nz
S0(k) = max(0.0, S0(k) + (GV%Rlay(k) - rho_guess(k)) / drho_dS(k))
enddo
@@ -1623,8 +1627,10 @@ subroutine initialize_temp_salt_fit(T, S, G, GV, US, param_file, eqn_of_state, P
T0(k) = T0(1) + (GV%Rlay(k) - rho_guess(1)) / drho_dT(1)
enddo
do itt=1,6
call calculate_density(T0,S0,pres,rho_guess,1,nz,eqn_of_state, scale=US%kg_m3_to_R)
call calculate_density_derivs(T0,S0,pres,drho_dT,drho_dS,1,nz,eqn_of_state, scale=US%kg_m3_to_R)
call calculate_density(T0, S0, pres, rho_guess, 1, nz, eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)
call calculate_density_derivs(T0, S0, pres, drho_dT, drho_dS, 1, nz, eqn_of_state, &
scale=US%kg_m3_to_R, pres_scale=US%RL2_T2_to_Pa)
do k=1,nz
T0(k) = T0(k) + (GV%Rlay(k) - rho_guess(k)) / drho_dT(k)
enddo
@@ -2185,8 +2191,7 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, G, GV, US, PF, just_read_param
allocate(frac_shelf_h(isd:ied,jsd:jed))

! Convert T&S to Absolute Salinity and Conservative Temperature if using TEOS10 or NEMO
press(:) = US%RL2_T2_to_Pa*tv%P_Ref
call convert_temp_salt_for_TEOS10(temp_z, salt_z, press, G, kd, mask_z, eos)
call convert_temp_salt_for_TEOS10(temp_z, salt_z, G%HI, kd, mask_z, eos)

press(:) = tv%P_Ref
do k=1,kd ; do j=js,je
@@ -2397,7 +2402,7 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, G, GV, US, PF, just_read_param

if (adjust_temperature .and. .not. useALEremapping) then
call determine_temperature(tv%T(is:ie,js:je,:), tv%S(is:ie,js:je,:), &
GV%Rlay(1:nz), US%RL2_T2_to_Pa*tv%P_Ref, niter, missing_value, h(is:ie,js:je,:), ks, US, eos)
GV%Rlay(1:nz), tv%P_Ref, niter, missing_value, h(is:ie,js:je,:), ks, US, eos)
endif

deallocate(z_in, z_edges_in, temp_z, salt_z, mask_z)
Loading