Skip to content

Commit

Permalink
change all 'write(*,..' to 'write(stdout,...'
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Oct 27, 2020
1 parent cc82d11 commit 1269874
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 41 deletions.
37 changes: 18 additions & 19 deletions src/ALE/MOM_remapping.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ module MOM_remapping
use PLM_functions, only : PLM_reconstruction, PLM_boundary_extrapolation
use PPM_functions, only : PPM_reconstruction, PPM_boundary_extrapolation
use PQM_functions, only : PQM_reconstruction, PQM_boundary_extrapolation_v1

use iso_fortran_env, only : stdout=>output_unit, stderr=>error_unit
use MOM_io, only : stdout, stderr

implicit none ; private

Expand Down Expand Up @@ -1636,7 +1635,7 @@ logical function remapping_unit_tests(verbose)
h_neglect = hNeglect_dflt
h_neglect_edge = hNeglect_dflt ; if (answers_2018) h_neglect_edge = 1.0e-10

write(*,*) '==== MOM_remapping: remapping_unit_tests ================='
write(stdout,*) '==== MOM_remapping: remapping_unit_tests ================='
remapping_unit_tests = .false. ! Normally return false

thisTest = .false.
Expand All @@ -1645,19 +1644,19 @@ logical function remapping_unit_tests(verbose)
err=x0(i)-0.75*real(i-1)
if (abs(err)>real(i-1)*epsilon(err)) thisTest = .true.
enddo
if (thisTest) write(*,*) 'remapping_unit_tests: Failed buildGridFromH() 1'
if (thisTest) write(stdout,*) 'remapping_unit_tests: Failed buildGridFromH() 1'
remapping_unit_tests = remapping_unit_tests .or. thisTest
call buildGridFromH(n1, h1, x1)
do i=1,n1+1
err=x1(i)-real(i-1)
if (abs(err)>real(i-1)*epsilon(err)) thisTest = .true.
enddo
if (thisTest) write(*,*) 'remapping_unit_tests: Failed buildGridFromH() 2'
if (thisTest) write(stdout,*) 'remapping_unit_tests: Failed buildGridFromH() 2'
remapping_unit_tests = remapping_unit_tests .or. thisTest

thisTest = .false.
call initialize_remapping(CS, 'PPM_H4', answers_2018=answers_2018)
if (verbose) write(*,*) 'h0 (test data)'
if (verbose) write(stdout,*) 'h0 (test data)'
if (verbose) call dumpGrid(n0,h0,x0,u0)

call dzFromH1H2( n0, h0, n1, h1, dx1 )
Expand All @@ -1666,9 +1665,9 @@ logical function remapping_unit_tests(verbose)
err=u1(i)-8.*(0.5*real(1+n1)-real(i))
if (abs(err)>real(n1-1)*epsilon(err)) thisTest = .true.
enddo
if (verbose) write(*,*) 'h1 (by projection)'
if (verbose) write(stdout,*) 'h1 (by projection)'
if (verbose) call dumpGrid(n1,h1,x1,u1)
if (thisTest) write(*,*) 'remapping_unit_tests: Failed remapping_core_w()'
if (thisTest) write(stdout,*) 'remapping_unit_tests: Failed remapping_core_w()'
remapping_unit_tests = remapping_unit_tests .or. thisTest

thisTest = .false.
Expand All @@ -1690,22 +1689,22 @@ logical function remapping_unit_tests(verbose)
err=u1(i)-8.*(0.5*real(1+n1)-real(i))
if (abs(err)>2.*epsilon(err)) thisTest = .true.
enddo
if (thisTest) write(*,*) 'remapping_unit_tests: Failed remapByProjection()'
if (thisTest) write(stdout,*) 'remapping_unit_tests: Failed remapByProjection()'
remapping_unit_tests = remapping_unit_tests .or. thisTest

thisTest = .false.
u1(:) = 0.
call remapByDeltaZ( n0, h0, u0, ppoly0_E, ppoly0_coefs, &
n1, x1-x0(1:n1+1), &
INTEGRATION_PPM, u1, hn1, h_neglect )
if (verbose) write(*,*) 'h1 (by delta)'
if (verbose) write(stdout,*) 'h1 (by delta)'
if (verbose) call dumpGrid(n1,h1,x1,u1)
hn1=hn1-h1
do i=1,n1
err=u1(i)-8.*(0.5*real(1+n1)-real(i))
if (abs(err)>2.*epsilon(err)) thisTest = .true.
enddo
if (thisTest) write(*,*) 'remapping_unit_tests: Failed remapByDeltaZ() 1'
if (thisTest) write(stdout,*) 'remapping_unit_tests: Failed remapByDeltaZ() 1'
remapping_unit_tests = remapping_unit_tests .or. thisTest

thisTest = .false.
Expand All @@ -1715,19 +1714,19 @@ logical function remapping_unit_tests(verbose)
call remapByDeltaZ( n0, h0, u0, ppoly0_E, ppoly0_coefs, &
n2, dx2, &
INTEGRATION_PPM, u2, hn2, h_neglect )
if (verbose) write(*,*) 'h2'
if (verbose) write(stdout,*) 'h2'
if (verbose) call dumpGrid(n2,h2,x2,u2)
if (verbose) write(*,*) 'hn2'
if (verbose) write(stdout,*) 'hn2'
if (verbose) call dumpGrid(n2,hn2,x2,u2)

do i=1,n2
err=u2(i)-8./2.*(0.5*real(1+n2)-real(i))
if (abs(err)>2.*epsilon(err)) thisTest = .true.
enddo
if (thisTest) write(*,*) 'remapping_unit_tests: Failed remapByDeltaZ() 2'
if (thisTest) write(stdout,*) 'remapping_unit_tests: Failed remapByDeltaZ() 2'
remapping_unit_tests = remapping_unit_tests .or. thisTest

if (verbose) write(*,*) 'Via sub-cells'
if (verbose) write(stdout,*) 'Via sub-cells'
thisTest = .false.
call remap_via_sub_cells( n0, h0, u0, ppoly0_E, ppoly0_coefs, &
n2, h2, INTEGRATION_PPM, .false., u2, err )
Expand All @@ -1737,7 +1736,7 @@ logical function remapping_unit_tests(verbose)
err=u2(i)-8./2.*(0.5*real(1+n2)-real(i))
if (abs(err)>2.*epsilon(err)) thisTest = .true.
enddo
if (thisTest) write(*,*) 'remapping_unit_tests: Failed remap_via_sub_cells() 2'
if (thisTest) write(stdout,*) 'remapping_unit_tests: Failed remap_via_sub_cells() 2'
remapping_unit_tests = remapping_unit_tests .or. thisTest

call remap_via_sub_cells( n0, h0, u0, ppoly0_E, ppoly0_coefs, &
Expand All @@ -1748,9 +1747,9 @@ logical function remapping_unit_tests(verbose)
3, (/2.25,1.5,1./), INTEGRATION_PPM, .false., u2, err )
if (verbose) call dumpGrid(3,h2,x2,u2)

if (.not. remapping_unit_tests) write(*,*) 'Pass'
if (.not. remapping_unit_tests) write(stdout,*) 'Pass'

write(*,*) '===== MOM_remapping: new remapping_unit_tests =================='
write(stdout,*) '===== MOM_remapping: new remapping_unit_tests =================='

deallocate(ppoly0_E, ppoly0_S, ppoly0_coefs)
allocate(ppoly0_coefs(5,6))
Expand Down Expand Up @@ -1879,7 +1878,7 @@ logical function remapping_unit_tests(verbose)

deallocate(ppoly0_E, ppoly0_S, ppoly0_coefs)

if (.not. remapping_unit_tests) write(*,*) 'Pass'
if (.not. remapping_unit_tests) write(stdout,*) 'Pass'

end function remapping_unit_tests

Expand Down
26 changes: 13 additions & 13 deletions src/diagnostics/MOM_sum_output.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module MOM_sum_output
use MOM_forcing_type, only : forcing
use MOM_grid, only : ocean_grid_type
use MOM_interface_heights, only : find_eta
use MOM_io, only : create_file, fieldtype, flush_file, open_file, reopen_file
use MOM_io, only : create_file, fieldtype, flush_file, open_file, reopen_file, stdout
use MOM_io, only : file_exists, slasher, vardesc, var_desc, write_field, get_filename_appendix
use MOM_io, only : APPEND_FILE, ASCII_FILE, SINGLE_FILE, WRITEONLY_FILE
use MOM_open_boundary, only : ocean_OBC_type, OBC_segment_type
Expand Down Expand Up @@ -827,11 +827,11 @@ subroutine write_energy(u, v, h, tv, day, n, G, GV, US, CS, tracer_CSp, OBC, dt_

if (is_root_pe()) then
if (CS%use_temperature) then
write(*,'(A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
write(stdout,'(A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
& ES18.12, ", Salt ", F15.11,", Temp ", F15.11)') &
trim(date_str), trim(n_str), En_mass, max_CFL(1), mass_tot, salin, temp
else
write(*,'(A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
write(stdout,'(A," ",A,": En ",ES12.6, ", MaxCFL ", F8.5, ", Mass ", &
& ES18.12)') &
trim(date_str), trim(n_str), En_mass, max_CFL(1), mass_tot
endif
Expand All @@ -853,39 +853,39 @@ subroutine write_energy(u, v, h, tv, day, n, G, GV, US, CS, tracer_CSp, OBC, dt_
endif

if (CS%ntrunc > 0) then
write(*,'(A," Energy/Mass:",ES12.5," Truncations ",I0)') &
write(stdout,'(A," Energy/Mass:",ES12.5," Truncations ",I0)') &
trim(date_str), En_mass, CS%ntrunc
endif

if (CS%write_stocks) then
write(*,'(" Total Energy: ",Z16.16,ES24.16)') toten, toten
write(*,'(" Total Mass: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5," (",ES8.1,")")') &
write(stdout,'(" Total Energy: ",Z16.16,ES24.16)') toten, toten
write(stdout,'(" Total Mass: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5," (",ES8.1,")")') &
mass_tot, mass_chg, mass_anom, mass_anom/mass_tot
if (CS%use_temperature) then
if (Salt == 0.) then
write(*,'(" Total Salt: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5)') &
write(stdout,'(" Total Salt: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5)') &
Salt*0.001, Salt_chg*0.001, Salt_anom*0.001
else
write(*,'(" Total Salt: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5," (",ES8.1,")")') &
write(stdout,'(" Total Salt: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5," (",ES8.1,")")') &
Salt*0.001, Salt_chg*0.001, Salt_anom*0.001, Salt_anom/Salt
endif
if (Heat == 0.) then
write(*,'(" Total Heat: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5)') &
write(stdout,'(" Total Heat: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5)') &
Heat, Heat_chg, Heat_anom
else
write(*,'(" Total Heat: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5," (",ES8.1,")")') &
write(stdout,'(" Total Heat: ",ES24.16,", Change: ",ES24.16," Error: ",ES12.5," (",ES8.1,")")') &
Heat, Heat_chg, Heat_anom, Heat_anom/Heat
endif
endif
do m=1,nTr_stocks

write(*,'(" Total ",a,": ",ES24.16,X,a)') &
write(stdout,'(" Total ",a,": ",ES24.16,X,a)') &
trim(Tr_names(m)), Tr_stocks(m), trim(Tr_units(m))

if (Tr_minmax_got(m)) then
write(*,'(64X,"Global Min:",ES24.16,X,"at: (", f7.2,","f7.2,","f8.2,")" )') &
write(stdout,'(64X,"Global Min:",ES24.16,X,"at: (", f7.2,","f7.2,","f8.2,")" )') &
Tr_min(m),Tr_min_x(m),Tr_min_y(m),Tr_min_z(m)
write(*,'(64X,"Global Max:",ES24.16,X,"at: (", f7.2,","f7.2,","f8.2,")" )') &
write(stdout,'(64X,"Global Max:",ES24.16,X,"at: (", f7.2,","f7.2,","f8.2,")" )') &
Tr_max(m),Tr_max_x(m),Tr_max_y(m),Tr_max_z(m)
endif

Expand Down
6 changes: 3 additions & 3 deletions src/initialization/MOM_grid_initialize.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module MOM_grid_initialize
use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, is_root_pe
use MOM_error_handler, only : callTree_enter, callTree_leave
use MOM_file_parser, only : get_param, log_param, log_version, param_file_type
use MOM_io, only : MOM_read_data, read_data, slasher, file_exists
use MOM_io, only : MOM_read_data, read_data, slasher, file_exists, stdout
use MOM_io, only : CORNER, NORTH_FACE, EAST_FACE
use MOM_unit_scaling, only : unit_scale_type

Expand Down Expand Up @@ -806,14 +806,14 @@ subroutine set_grid_metrics_mercator(G, param_file, US)
y_q = find_root(Int_dj_dy, dy_dj, GP, jd, 0.0, -1.0*PI_2, PI_2, itt2)
G%gridLatB(J) = y_q*180.0/PI
! if (is_root_pe()) &
! write(*, '("J, y_q = ",I4,ES14.4," itts = ",I4)') j, y_q, itt2
! write(stdout, '("J, y_q = ",I4,ES14.4," itts = ",I4)') j, y_q, itt2
enddo
do j=G%jsg,G%jeg
jd = fnRef + (j - jRef) - 0.5
y_h = find_root(Int_dj_dy, dy_dj, GP, jd, 0.0, -1.0*PI_2, PI_2, itt1)
G%gridLatT(j) = y_h*180.0/PI
! if (is_root_pe()) &
! write(*, '("j, y_h = ",I4,ES14.4," itts = ",I4)') j, y_h, itt1
! write(stdout, '("j, y_h = ",I4,ES14.4," itts = ",I4)') j, y_h, itt1
enddo
do J=JsdB+J_off,JedB+J_off
jd = fnRef + (J - jRef)
Expand Down
12 changes: 6 additions & 6 deletions src/initialization/MOM_shared_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module MOM_shared_initialization
use MOM_error_handler, only : MOM_mesg, MOM_error, FATAL, WARNING, is_root_pe
use MOM_error_handler, only : callTree_enter, callTree_leave, callTree_waypoint
use MOM_file_parser, only : get_param, log_param, param_file_type, log_version
use MOM_io, only : close_file, create_file, fieldtype, file_exists
use MOM_io, only : close_file, create_file, fieldtype, file_exists, stdout
use MOM_io, only : MOM_read_data, MOM_read_vector, SINGLE_FILE, MULTIPLE
use MOM_io, only : slasher, vardesc, write_field, var_desc
use MOM_string_functions, only : uppercase
Expand Down Expand Up @@ -282,7 +282,7 @@ subroutine apply_topography_edits_from_file(D, G, param_file, US)
j = jg(n) - G%jsd_global + 2
if (i>=G%isc .and. i<=G%iec .and. j>=G%jsc .and. j<=G%jec) then
if (new_depth(n)/=0.) then
write(*,'(a,3i5,f8.2,a,f8.2,2i4)') &
write(stdout,'(a,3i5,f8.2,a,f8.2,2i4)') &
'Ocean topography edit: ',n,ig(n),jg(n),D(i,j)/m_to_Z,'->',abs(new_depth(n)),i,j
D(i,j) = abs(m_to_Z*new_depth(n)) ! Allows for height-file edits (i.e. converts negatives)
else
Expand Down Expand Up @@ -995,10 +995,10 @@ subroutine reset_face_lengths_list(G, param_file, US)
G%dy_Cu(I,j) = G%mask2dCu(I,j) * m_to_L*min(L_to_m*G%dyCu(I,j), max(u_width(npt), 0.0))
if (j>=G%jsc .and. j<=G%jec .and. I>=G%isc .and. I<=G%iec) then ! Limit messages/checking to compute domain
if ( G%mask2dCu(I,j) == 0.0 ) then
write(*,'(A,2F8.2,A,4F8.2,A)') "read_face_lengths_list : G%mask2dCu=0 at ",lat,lon," (",&
write(stdout,'(A,2F8.2,A,4F8.2,A)') "read_face_lengths_list : G%mask2dCu=0 at ",lat,lon," (",&
u_lat(1,npt), u_lat(2,npt), u_lon(1,npt), u_lon(2,npt),") so grid metric is unmodified."
else
write(*,'(A,2F8.2,A,4F8.2,A5,F9.2,A1)') &
write(stdout,'(A,2F8.2,A,4F8.2,A5,F9.2,A1)') &
"read_face_lengths_list : Modifying dy_Cu gridpoint at ",lat,lon," (",&
u_lat(1,npt), u_lat(2,npt), u_lon(1,npt), u_lon(2,npt),") to ",L_to_m*G%dy_Cu(I,j),"m"
endif
Expand All @@ -1024,10 +1024,10 @@ subroutine reset_face_lengths_list(G, param_file, US)
G%dx_Cv(i,J) = G%mask2dCv(i,J) * m_to_L*min(L_to_m*G%dxCv(i,J), max(v_width(npt), 0.0))
if (i>=G%isc .and. i<=G%iec .and. J>=G%jsc .and. J<=G%jec) then ! Limit messages/checking to compute domain
if ( G%mask2dCv(i,J) == 0.0 ) then
write(*,'(A,2F8.2,A,4F8.2,A)') "read_face_lengths_list : G%mask2dCv=0 at ",lat,lon," (",&
write(stdout,'(A,2F8.2,A,4F8.2,A)') "read_face_lengths_list : G%mask2dCv=0 at ",lat,lon," (",&
v_lat(1,npt), v_lat(2,npt), v_lon(1,npt), v_lon(2,npt),") so grid metric is unmodified."
else
write(*,'(A,2F8.2,A,4F8.2,A5,F9.2,A1)') &
write(stdout,'(A,2F8.2,A,4F8.2,A5,F9.2,A1)') &
"read_face_lengths_list : Modifying dx_Cv gridpoint at ",lat,lon," (",&
v_lat(1,npt), v_lat(2,npt), v_lon(1,npt), v_lon(2,npt),") to ",L_to_m*G%dx_Cv(I,j),"m"
endif
Expand Down

0 comments on commit 1269874

Please sign in to comment.