Skip to content

Commit

Permalink
Merge pull request #105 from marshallward/pedantic
Browse files Browse the repository at this point in the history
A very pedantic pull request
  • Loading branch information
Hallberg-NOAA authored Apr 10, 2022
2 parents c150f37 + d3d0c8e commit 7f6dac2
Show file tree
Hide file tree
Showing 22 changed files with 316 additions and 306 deletions.
4 changes: 2 additions & 2 deletions config_src/external/GFDL_ocean_BGC/FMS_coupler_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ module FMS_coupler_util
!> Get element and index of a boundary condition
subroutine extract_coupler_values(BC_struc, BC_index, BC_element, array_out, ilb, jlb, &
is, ie, js, je, conversion)
real, dimension(ilb:,jlb:),intent(out) :: array_out !< The array being filled with the input values
integer, intent(in) :: ilb !< Lower bounds
integer, intent(in) :: jlb !< Lower bounds
real, dimension(ilb:,jlb:),intent(out) :: array_out !< The array being filled with the input values
type(coupler_2d_bc_type), intent(in) :: BC_struc !< The type from which the data is being extracted
integer, intent(in) :: BC_index !< The boundary condition number being extracted
integer, intent(in) :: BC_element !< The element of the boundary condition being extracted
Expand All @@ -27,9 +27,9 @@ end subroutine extract_coupler_values
!> Set element and index of a boundary condition
subroutine set_coupler_values(array_in, BC_struc, BC_index, BC_element, ilb, jlb,&
is, ie, js, je, conversion)
real, dimension(ilb:,jlb:), intent(in) :: array_in !< The array containing the values to load into the BC
integer, intent(in) :: ilb !< Lower bounds
integer, intent(in) :: jlb !< Lower bounds
real, dimension(ilb:,jlb:), intent(in) :: array_in !< The array containing the values to load into the BC
type(coupler_2d_bc_type), intent(inout) :: BC_struc !< The type into which the data is being loaded
integer, intent(in) :: BC_index !< The boundary condition number being set
integer, intent(in) :: BC_element !< The element of the boundary condition being set
Expand Down
4 changes: 2 additions & 2 deletions config_src/external/GFDL_ocean_BGC/generic_tracer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ end subroutine generic_tracer_coupler_accumulate
subroutine generic_tracer_source(Temp,Salt,rho_dzt,dzt,hblt_depth,ilb,jlb,tau,dtts,&
grid_dat,model_time,nbands,max_wavelength_band,sw_pen_band,opacity_band,internal_heat,&
frunoff,grid_ht, current_wave_stress, sosga)
integer, intent(in) :: ilb !< Lower bounds of x extent of input arrays on data domain
integer, intent(in) :: jlb !< Lower bounds of y extent of input arrays on data domain
real, dimension(ilb:,jlb:,:), intent(in) :: Temp !< Potential temperature [deg C]
real, dimension(ilb:,jlb:,:), intent(in) :: Salt !< Salinity [psu]
real, dimension(ilb:,jlb:,:), intent(in) :: rho_dzt !< Mass per unit area of each layer [kg m-2]
real, dimension(ilb:,jlb:,:), intent(in) :: dzt !< Ocean layer thickness [m]
real, dimension(ilb:,jlb:), intent(in) :: hblt_depth !< Boundary layer depth [m]
integer, intent(in) :: ilb !< Lower bounds of x extent of input arrays on data domain
integer, intent(in) :: jlb !< Lower bounds of y extent of input arrays on data domain
integer, intent(in) :: tau !< Time step index of %field
real, intent(in) :: dtts !< The time step for this call [s]
real, dimension(ilb:,jlb:), intent(in) :: grid_dat !< Grid cell areas [m2]
Expand Down
26 changes: 13 additions & 13 deletions src/ALE/MOM_remapping.F90
Original file line number Diff line number Diff line change
Expand Up @@ -516,41 +516,41 @@ subroutine check_reconstructions_1d(n0, h0, u0, deg, boundary_extrapolation, &
u_min = min(u_l, u_c)
u_max = max(u_l, u_c)
if (ppoly_r_E(i0,1) < u_min) then
write(0,'(a,i4,5(x,a,1pe24.16))') 'Left edge undershoot at',i0,'u(i0-1)=',u_l,'u(i0)=',u_c, &
'edge=',ppoly_r_E(i0,1),'err=',ppoly_r_E(i0,1)-u_min
write(0,'(a,i4,5(1x,a,1pe24.16))') 'Left edge undershoot at',i0,'u(i0-1)=',u_l,'u(i0)=',u_c, &
'edge=',ppoly_r_E(i0,1),'err=',ppoly_r_E(i0,1)-u_min
problem_detected = .true.
endif
if (ppoly_r_E(i0,1) > u_max) then
write(0,'(a,i4,5(x,a,1pe24.16))') 'Left edge overshoot at',i0,'u(i0-1)=',u_l,'u(i0)=',u_c, &
'edge=',ppoly_r_E(i0,1),'err=',ppoly_r_E(i0,1)-u_max
write(0,'(a,i4,5(1x,a,1pe24.16))') 'Left edge overshoot at',i0,'u(i0-1)=',u_l,'u(i0)=',u_c, &
'edge=',ppoly_r_E(i0,1),'err=',ppoly_r_E(i0,1)-u_max
problem_detected = .true.
endif
endif
if (i0 < n0 .or. .not. boundary_extrapolation) then
u_min = min(u_c, u_r)
u_max = max(u_c, u_r)
if (ppoly_r_E(i0,2) < u_min) then
write(0,'(a,i4,5(x,a,1pe24.16))') 'Right edge undershoot at',i0,'u(i0)=',u_c,'u(i0+1)=',u_r, &
'edge=',ppoly_r_E(i0,2),'err=',ppoly_r_E(i0,2)-u_min
write(0,'(a,i4,5(1x,a,1pe24.16))') 'Right edge undershoot at',i0,'u(i0)=',u_c,'u(i0+1)=',u_r, &
'edge=',ppoly_r_E(i0,2),'err=',ppoly_r_E(i0,2)-u_min
problem_detected = .true.
endif
if (ppoly_r_E(i0,2) > u_max) then
write(0,'(a,i4,5(x,a,1pe24.16))') 'Right edge overshoot at',i0,'u(i0)=',u_c,'u(i0+1)=',u_r, &
'edge=',ppoly_r_E(i0,2),'err=',ppoly_r_E(i0,2)-u_max
write(0,'(a,i4,5(1x,a,1pe24.16))') 'Right edge overshoot at',i0,'u(i0)=',u_c,'u(i0+1)=',u_r, &
'edge=',ppoly_r_E(i0,2),'err=',ppoly_r_E(i0,2)-u_max
problem_detected = .true.
endif
endif
if (i0 > 1) then
if ( (u_c-u_l)*(ppoly_r_E(i0,1)-ppoly_r_E(i0-1,2)) < 0.) then
write(0,'(a,i4,5(x,a,1pe24.16))') 'Non-monotonic edges at',i0,'u(i0-1)=',u_l,'u(i0)=',u_c, &
'right edge=',ppoly_r_E(i0-1,2),'left edge=',ppoly_r_E(i0,1)
write(0,'(5(a,1pe24.16,x))') 'u(i0)-u(i0-1)',u_c-u_l,'edge diff=',ppoly_r_E(i0,1)-ppoly_r_E(i0-1,2)
write(0,'(a,i4,5(1x,a,1pe24.16))') 'Non-monotonic edges at',i0,'u(i0-1)=',u_l,'u(i0)=',u_c, &
'right edge=',ppoly_r_E(i0-1,2),'left edge=',ppoly_r_E(i0,1)
write(0,'(5(a,1pe24.16,1x))') 'u(i0)-u(i0-1)',u_c-u_l,'edge diff=',ppoly_r_E(i0,1)-ppoly_r_E(i0-1,2)
problem_detected = .true.
endif
endif
if (problem_detected) then
write(0,'(a,1p9e24.16)') 'Polynomial coeffs:',ppoly_r_coefs(i0,:)
write(0,'(3(a,1pe24.16,x))') 'u_l=',u_l,'u_c=',u_c,'u_r=',u_r
write(0,'(3(a,1pe24.16,1x))') 'u_l=',u_l,'u_c=',u_c,'u_r=',u_r
write(0,'(a4,10a24)') 'i0','h0(i0)','u0(i0)','left edge','right edge','Polynomial coefficients'
do n = 1, n0
write(0,'(i4,1p10e24.16)') n,h0(n),u0(n),ppoly_r_E(n,1),ppoly_r_E(n,2),ppoly_r_coefs(n,:)
Expand Down Expand Up @@ -1960,7 +1960,7 @@ logical function test_answer(verbose, n, u, u_true, label, tol)
if (abs(u(k) - u_true(k)) > tolerance) test_answer = .true.
enddo
if (test_answer .or. verbose) then
write(stdout,'(a4,2a24,x,a)') 'k','Calculated value','Correct value',label
write(stdout,'(a4,2a24,1x,a)') 'k','Calculated value','Correct value',label
do k = 1, n
if (abs(u(k) - u_true(k)) > tolerance) then
write(stdout,'(i4,1p2e24.16,a,1pe24.16,a)') k,u(k),u_true(k),' err=',u(k)-u_true(k),' < wrong'
Expand Down
6 changes: 3 additions & 3 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3551,7 +3551,7 @@ subroutine extract_surface_state(CS, sfc_state_in)
ig = i + G%HI%idg_offset ! Global i-index
jg = j + G%HI%jdg_offset ! Global j-index
if (use_temperature) then
write(msg(1:240),'(2(a,i4,x),4(a,f8.3,x),8(a,es11.4,x))') &
write(msg(1:240),'(2(a,i4,1x),4(a,f8.3,1x),8(a,es11.4,1x))') &
'Extreme surface sfc_state detected: i=',ig,'j=',jg, &
'lon=',G%geoLonT(i,j), 'lat=',G%geoLatT(i,j), &
'x=',G%gridLonT(ig), 'y=',G%gridLatT(jg), &
Expand All @@ -3560,7 +3560,7 @@ subroutine extract_surface_state(CS, sfc_state_in)
'U-=',US%L_T_to_m_s*sfc_state%u(I-1,j), 'U+=',US%L_T_to_m_s*sfc_state%u(I,j), &
'V-=',US%L_T_to_m_s*sfc_state%v(i,J-1), 'V+=',US%L_T_to_m_s*sfc_state%v(i,J)
else
write(msg(1:240),'(2(a,i4,x),4(a,f8.3,x),6(a,es11.4))') &
write(msg(1:240),'(2(a,i4,1x),4(a,f8.3,1x),6(a,es11.4))') &
'Extreme surface sfc_state detected: i=',ig,'j=',jg, &
'lon=',G%geoLonT(i,j), 'lat=',G%geoLatT(i,j), &
'x=',G%gridLonT(i), 'y=',G%gridLatT(j), &
Expand All @@ -3577,7 +3577,7 @@ subroutine extract_surface_state(CS, sfc_state_in)
enddo ; enddo
call sum_across_PEs(numberOfErrors)
if (numberOfErrors>0) then
write(msg(1:240),'(3(a,i9,x))') 'There were a total of ',numberOfErrors, &
write(msg(1:240),'(3(a,i9,1x))') 'There were a total of ',numberOfErrors, &
'locations detected with extreme surface values!'
call MOM_error(FATAL, trim(msg))
endif
Expand Down
4 changes: 2 additions & 2 deletions src/core/MOM_forcing_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ subroutine extractFluxes1d(G, GV, US, fluxes, optics, nsw, j, dt, &
fluxes%num_msg = fluxes%num_msg + 1
write(mesg,'("Penetrating shortwave of ",1pe17.10, &
&" exceeds total shortwave of ",1pe17.10,&
&" at ",1pg11.4,"E, "1pg11.4,"N.")') &
&" at ",1pg11.4,",E,",1pg11.4,"N.")') &
Pen_SW_tot(i), I_Cp_Hconvert*scale*dt * fluxes%sw(i,j), &
G%geoLonT(i,j), G%geoLatT(i,j)
call MOM_error(WARNING,mesg)
Expand Down Expand Up @@ -3125,7 +3125,7 @@ subroutine allocate_mech_forcing_by_group(G, forces, stress, ustar, shelf, &
if (present(waves)) then; if (waves) then;
if (.not. present(num_stk_bands)) then
call MOM_error(FATAL,"Requested to &
initialize with waves, but no waves are present.")
&initialize with waves, but no waves are present.")
endif
if (num_stk_bands > 0) then
if (.not.associated(forces%ustkb)) then
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4777,7 +4777,7 @@ subroutine mask_outside_OBCs(G, US, param_file, OBC)
if (color(i,j) /= color2(i,j)) then
fatal_error = .True.
write(mesg,'("MOM_open_boundary: problem with OBC segments specification at ",I5,",",I5," during\n", &
"the masking of the outside grid points.")') i, j
&"the masking of the outside grid points.")') i, j
call MOM_error(WARNING,"MOM register_tracer: "//mesg, all_print=.true.)
endif
if (color(i,j) == cout) G%bathyT(i,j) = min_depth
Expand Down
Loading

0 comments on commit 7f6dac2

Please sign in to comment.