@@ -389,6 +389,9 @@ subroutine neutral_diffusion_calc_coeffs(G, GV, h, T, S, CS)
389
389
integer :: iMethod
390
390
real , dimension (SZI_(G)) :: ref_pres ! Reference pressure used to calculate alpha/beta
391
391
real :: h_neglect, h_neglect_edge
392
+ real :: pa_to_H
393
+
394
+ pa_to_H = 1 . / GV% H_to_pa
392
395
393
396
! ### Try replacing both of these with GV%H_subroundoff
394
397
if (GV% Boussinesq) then
@@ -444,15 +447,13 @@ subroutine neutral_diffusion_calc_coeffs(G, GV, h, T, S, CS)
444
447
else ! Discontinuous reconstruction
445
448
do k = 1 , G% ke
446
449
if (CS% ref_pres< 0 ) ref_pres(:) = CS% Pint(:,j,k)
447
- if (CS% stable_cell(i,j,k)) &
448
- call calculate_density_derivs(CS% T_i(:,j,k,1 ), CS% S_i(:,j,k,1 ), ref_pres, &
449
- CS% dRdT_i(:,j,k,1 ), CS% dRdS_i(:,j,k,1 ), G% isc-1 , G% iec- G% isc+3 , CS% EOS)
450
+ call calculate_density_derivs(CS% T_i(:,j,k,1 ), CS% S_i(:,j,k,1 ), ref_pres, &
451
+ CS% dRdT_i(:,j,k,1 ), CS% dRdS_i(:,j,k,1 ), G% isc-1 , G% iec- G% isc+3 , CS% EOS)
450
452
if (CS% ref_pres< 0 ) then
451
453
ref_pres(:) = CS% Pint(:,j,k+1 )
452
454
endif
453
- if (CS% stable_cell(i,j,k)) &
454
- call calculate_density_derivs(CS% T_i(:,j,k,2 ), CS% S_i(:,j,k,2 ), ref_pres, &
455
- CS% dRdT_i(:,j,k,2 ), CS% dRdS_i(:,j,k,2 ), G% isc-1 , G% iec- G% isc+3 , CS% EOS)
455
+ call calculate_density_derivs(CS% T_i(:,j,k,2 ), CS% S_i(:,j,k,2 ), ref_pres, &
456
+ CS% dRdT_i(:,j,k,2 ), CS% dRdS_i(:,j,k,2 ), G% isc-1 , G% iec- G% isc+3 , CS% EOS)
456
457
enddo
457
458
endif
458
459
enddo
@@ -518,9 +519,16 @@ subroutine neutral_diffusion_calc_coeffs(G, GV, h, T, S, CS)
518
519
endif
519
520
enddo ; enddo
520
521
522
+ ! Continuous reconstructions calculate hEff as the difference between the pressures of the neutral surfaces which
523
+ ! need to be reconverted to thickness units. The discontinuous version calculates hEff from the fraction of the
524
+ ! nondimensional fraction of the layer occupied by the
521
525
if (CS% continuous_reconstruction) then
522
- CS% uhEff(:,:,:) = CS% uhEff(:,:,:) / GV% H_to_pa
523
- CS% vhEff(:,:,:) = CS% vhEff(:,:,:) / GV% H_to_pa
526
+ do k = 1 , CS% nsurf-1 ; do j = G% jsc, G% jec ; do I = G% isc-1 , G% iec
527
+ if (G% mask2dCu(I,j) > 0 .) CS% uhEff(I,j,k) = CS% uhEff(I,j,k) * pa_to_H
528
+ enddo ; enddo ; enddo
529
+ do k = 1 , CS% nsurf-1 ; do J = G% jsc-1 , G% jec ; do i = G% isc, G% iec
530
+ if (G% mask2dCv(i,J) > 0 .) CS% vhEff(i,J,k) = CS% vhEff(i,J,k) * pa_to_H
531
+ enddo ; enddo ; enddo
524
532
endif
525
533
526
534
if (CS% id_uhEff_2d> 0 ) then
0 commit comments