Skip to content

Commit 145c0eb

Browse files
author
Andrew Shao
committed
Fix conflict due to changed MOM_EOS.F90 interfaces
1 parent 854980e commit 145c0eb

1 file changed

Lines changed: 16 additions & 30 deletions

File tree

src/tracer/MOM_neutral_diffusion.F90

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module MOM_neutral_diffusion
88
use MOM_diag_mediator, only : diag_ctrl, time_type
99
use MOM_diag_mediator, only : post_data, register_diag_field
1010
use MOM_EOS, only : EOS_type, EOS_manual_init, calculate_compress, calculate_density_derivs
11-
use MOM_EOS, only : calculate_density_derivs_scalar, calculate_density_second_derivs_scalar
11+
use MOM_EOS, only : calculate_density_second_derivs
1212
use MOM_EOS, only : extract_member_EOS, EOS_LINEAR, EOS_TEOS10, EOS_WRIGHT
1313
use MOM_error_handler, only : MOM_error, FATAL, WARNING, MOM_mesg, is_root_pe
1414
use MOM_file_parser, only : get_param, log_version, param_file_type
@@ -1333,19 +1333,14 @@ subroutine search_other_column_discontinuous(dRhoTopm1, dRhoTop, dRhoBot, Ptop,
13331333
out_P = 0. ; out_K = kl
13341334
search_layer = .false.
13351335
! Deal with the case where reconstruction is continuous
1336-
elseif ( (kl>1) .and. (dRhoTopm1==dRhoTop) ) then
1337-
if (dRhoTopm1 < dRhoTop) then
1338-
if (.not. bot_connected(kl-1)) then
1339-
out_P = 1. ; out_K = kl-1
1340-
search_layer = .false.
1341-
endif
1342-
elseif ( (dRhoTopm1 == 0.) .and. (.not. bot_connected(kl-1))) then
1343-
out_P = 1 ; out_K = kl-1
1336+
elseif ( kl>1 ) then
1337+
if (dRhoTopm1==dRhoTop .and. dRhoTopm1 == 0. .and. (.not.bot_connected(kl-1)) ) then
1338+
out_P = 1 ; out_K = kl-1;
1339+
search_layer = .false.
1340+
elseif ( (dRhoTopm1<dRhoTop .and. dRhoTop > 0.) ) then
1341+
out_P = 1. ; out_K = kl-1
13441342
search_layer = .false.
13451343
endif
1346-
elseif ( (kl>1) .and. (dRhoTopm1<dRhoTop .and. dRhoTop > 0.) ) then
1347-
out_P = 1. ; out_K = kl-1
1348-
search_layer = .false.
13491344
endif
13501345

13511346
if (search_layer) then
@@ -1536,7 +1531,7 @@ real function refine_nondim_position(max_iter, tolerance, T_ref, S_ref, alpha_re
15361531
endif
15371532
! Evaluate total derivative of delta_rho
15381533
if (ref_pres<0.) P_ref = P_int
1539-
call calculate_density_second_derivs_scalar( T, S, P_ref, dbeta_dS, dbeta_dT, dalpha_dT, dbeta_dP, dalpha_dP, EOS )
1534+
call calculate_density_second_derivs( T, S, P_ref, dbeta_dS, dbeta_dT, dalpha_dT, dbeta_dP, dalpha_dP, EOS )
15401535
! In the case of a constant reference pressure, no dependence on neutral direction with pressure
15411536
if (ref_pres>=0.) then
15421537
dalpha_dP = 0. ; dbeta_dP = 0.
@@ -1749,13 +1744,12 @@ subroutine calc_delta_rho(deg, T_ref, S_ref, alpha_ref, beta_ref, P_top, P_bot,
17491744
S = evaluation_polynomial( ppoly_S, deg+1, x0 )
17501745
! Interpolated pressure if using locally referenced neutral density
17511746
if (ref_pres<0.) then
1752-
call calculate_density_derivs_scalar( T, S, P_int, alpha, beta, EOS )
1747+
call calculate_density_derivs( T, S, P_int, alpha, beta, EOS )
17531748
else
17541749
! Constant reference pressure (isopycnal)
1755-
call calculate_density_derivs_scalar( T, S, ref_pres, alpha, beta, EOS )
1750+
call calculate_density_derivs( T, S, ref_pres, alpha, beta, EOS )
17561751
endif
17571752

1758-
17591753
! Calculate the f(P) term for Newton's method
17601754
alpha_avg = 0.5*( alpha + alpha_ref )
17611755
beta_avg = 0.5*( beta + beta_ref )
@@ -1819,16 +1813,6 @@ subroutine neutral_surface_flux(nk, nsurf, deg, hl, hr, Tl, Tr, PiL, PiR, KoL, K
18191813
call interface_scalar(nk, hr, Tr, Tir, 2)
18201814
call ppm_left_right_edge_values(nk, Tl, Til, aL_l, aR_l)
18211815
call ppm_left_right_edge_values(nk, Tr, Tir, aL_r, aR_r)
1822-
1823-
do k=1,nk
1824-
ppoly_r_coeffs_l(k,1) = aL_l(k)
1825-
ppoly_r_coeffs_l(k,2) = 4.0 * ( Tl(k) - aL_l(k) ) + 2.0 * ( Tl(k) - aR_l(k) )
1826-
ppoly_r_coeffs_l(k,3) = 3.0 * ( ( aR_l(k) - Tl(k) ) + ( aL_l(k) - Tl(k) ) )
1827-
ppoly_r_coeffs_r(k,1) = aL_r(k)
1828-
ppoly_r_coeffs_r(k,2) = 4.0 * ( Tr(k) - aL_r(k) ) + 2.0 * ( Tr(k) - aR_r(k) )
1829-
ppoly_r_coeffs_r(k,3) = 3.0 * ( ( aR_r(k) - Tr(k) ) + ( aL_r(k) - Tr(k) ) )
1830-
enddo
1831-
18321816
else
18331817
ppoly_r_coeffs_l(:,:) = 0.
18341818
ppoly_r_coeffs_r(:,:) = 0.
@@ -1845,14 +1829,16 @@ subroutine neutral_surface_flux(nk, nsurf, deg, hl, hr, Tl, Tr, PiL, PiR, KoL, K
18451829
else
18461830
if (continuous) then
18471831
klb = KoL(k_sublayer+1)
1848-
T_left_bottom = evaluation_polynomial( ppoly_r_coeffs_l(klb,:), deg+1, PiL(k_sublayer+1))
1832+
T_left_bottom = ( 1. - PiL(k_sublayer+1) ) * Til(klb) + PiL(k_sublayer+1) * Til(klb+1)
18491833
klt = KoL(k_sublayer)
1850-
T_left_top = evaluation_polynomial( ppoly_r_coeffs_l(klt,:), deg+1, PiL(k_sublayer))
1834+
T_left_top = ( 1. - PiL(k_sublayer) ) * Til(klt) + PiL(k_sublayer) * Til(klt+1)
18511835
T_left_layer = ppm_ave(PiL(k_sublayer), PiL(k_sublayer+1) + real(klb-klt), &
18521836
aL_l(klt), aR_l(klt), Tl(klt))
1837+
18531838
krb = KoR(k_sublayer+1)
1839+
T_right_bottom = ( 1. - PiR(k_sublayer+1) ) * Tir(krb) + PiR(k_sublayer+1) * Tir(krb+1)
18541840
krt = KoR(k_sublayer)
1855-
T_right_top = evaluation_polynomial( ppoly_r_coeffs_r(krt,:), deg+1, PiR(k_sublayer))
1841+
T_right_top = ( 1. - PiR(k_sublayer) ) * Tir(krt) + PiR(k_sublayer) * Tir(krt+1)
18561842
T_right_layer = ppm_ave(PiR(k_sublayer), PiR(k_sublayer+1) + real(krb-krt), &
18571843
aL_r(krt), aR_r(krt), Tr(krt))
18581844
else ! Discontinuous reconstruction
@@ -1883,7 +1869,7 @@ subroutine neutral_surface_flux(nk, nsurf, deg, hl, hr, Tl, Tr, PiL, PiR, KoL, K
18831869
dT_bottom = T_right_bottom - T_left_bottom
18841870
dT_ave = 0.5 * ( dT_top + dT_bottom )
18851871
dT_layer = T_right_layer - T_left_layer
1886-
if (signum(1.,dT_top) * signum(1.,dT_bottom) < 0. .or. signum(1.,dT_ave) * signum(1.,dT_layer) <= 0. ) then
1872+
if (signum(1.,dT_top) * signum(1.,dT_bottom) <= 0. .or. signum(1.,dT_ave) * signum(1.,dT_layer) <= 0. ) then
18871873
dT_ave = 0.
18881874
else
18891875
dT_ave = dT_layer

0 commit comments

Comments
 (0)