Skip to content

Commit

Permalink
Use %id in all print statements
Browse files Browse the repository at this point in the history
- To reduce amount of code that needs to edited when deprecating $iceberg_num
  I've uniformly updated every print statement that uses %iceberg_num.
  • Loading branch information
adcroft committed Jun 16, 2017
1 parent bbde6c2 commit 1efcdaf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
30 changes: 15 additions & 15 deletions icebergs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ subroutine interactive_force(bergs, berg, IA_x, IA_y, u0, v0, u1, v1,&
enddo
endif

!print *,'IA_x=',IA_x,'IA_y',IA_y, berg%iceberg_num
!print *,'IA_x=',IA_x,'IA_y',IA_y, berg%id
!print *,'P_ia_11',P_ia_11,'P_ia_12',P_ia_12, 'P_ia_21',P_ia_21,'P_ia_22', P_ia_22
!print *, 'P_ia_times_u_x', P_ia_times_u_x, 'P_ia_times_u_y', P_ia_times_u_y

Expand Down Expand Up @@ -570,7 +570,7 @@ subroutine calculate_force(bergs, berg, other_berg, IA_x, IA_y, u0, v0, u1, v1,
! if (berg%iceberg_num .eq. 1) then
! print *, 'Comparing longitudes: ', lon1, lon2, r_dist_x, dlon
! print *, 'Comparing latitudes: ', lat1, lat2, r_dist_y, dlat
! print *, 'Outside, iceberg_num, r_dist', berg%iceberg_num, r_dist,bonded
! print *, 'Outside, id, r_dist', berg%id, r_dist,bonded
! print *, 'Halo_status', berg%halo_berg,other_berg%halo_berg
! endif
! print *, 'outside the loop',R1, R2,r_dist, bonded
Expand All @@ -595,10 +595,10 @@ subroutine calculate_force(bergs, berg, other_berg, IA_x, IA_y, u0, v0, u1, v1,
!MP1
!if (berg%iceberg_num .eq. 1) then
! !print *, '************************************************************'
! print *, 'INSIDE, r_dist', berg%iceberg_num, other_berg%iceberg_num, r_dist, bonded
! print *, 'INSIDE, r_dist', berg%id, other_berg%id, r_dist, bonded
!endif
!print *, 'in the loop1', spring_coef, (M_min/M1), accel_spring,(R1+R2-r_dist)
!print *, 'in the loop2', IA_x, IA_y, R1, R2,r_dist, berg%iceberg_num,other_berg%iceberg_num
!print *, 'in the loop2', IA_x, IA_y, R1, R2,r_dist, berg%id,other_berg%id
! Damping force:
! Paralel velocity
P_11=(r_dist_x*r_dist_x)/(r_dist**2)
Expand All @@ -616,7 +616,7 @@ subroutine calculate_force(bergs, berg, other_berg, IA_x, IA_y, u0, v0, u1, v1,
P_ia_22=P_ia_22+p_ia_coef*P_22
P_ia_times_u_x=P_ia_times_u_x+ (p_ia_coef* ((P_11*u2) +(P_12*v2)))
P_ia_times_u_y=P_ia_times_u_y+ (p_ia_coef* ((P_12*u2) +(P_22*v2)))
!print *, 'Paralel: ',berg%iceberg_num, p_ia_coef, IA_x, P_ia_11, P_ia_21,P_ia_12, P_ia_22
!print *, 'Paralel: ',berg%id, p_ia_coef, IA_x, P_ia_11, P_ia_21,P_ia_12, P_ia_22

! Normal velocities
P_11=1-P_11 ; P_12=-P_12 ; P_21= -P_21 ; P_22=1-P_22
Expand All @@ -630,7 +630,7 @@ subroutine calculate_force(bergs, berg, other_berg, IA_x, IA_y, u0, v0, u1, v1,
P_ia_22=P_ia_22+p_ia_coef*P_22
P_ia_times_u_x=P_ia_times_u_x+ (p_ia_coef* ((P_11*u2) +(P_12*v2)))
P_ia_times_u_y=P_ia_times_u_y+ (p_ia_coef* ((P_12*u2) +(P_22*v2)))
!print *, 'Perp: ',berg%iceberg_num, p_ia_coef, IA_x, P_ia_11, P_ia_21,P_ia_12, P_ia_22
!print *, 'Perp: ',berg%id, p_ia_coef, IA_x, P_ia_11, P_ia_21,P_ia_12, P_ia_22
!print *, 'P_11',P_11
!print *, 'P_21',P_21
!print *, 'P_12',P_12
Expand Down Expand Up @@ -887,7 +887,7 @@ subroutine accel(bergs, berg, i, j, xi, yj, lat, uvel, vvel, uvel0, vvel0, dt, a
RHS_x=RHS_x - (((P_ia_11*uvel)+(P_ia_12*vvel))-P_ia_times_u_x)
RHS_y=RHS_y - (((P_ia_21*uvel)+(P_ia_22*vvel))-P_ia_times_u_y)
endif
!print *,'Before calculation:', berg%iceberg_num, IA_x, IA_y, P_ia_11, P_ia_12, P_ia_21, P_ia_22, P_ia_times_u_x, P_ia_times_u_y
!print *,'Before calculation:', berg%id, IA_x, IA_y, P_ia_11, P_ia_12, P_ia_21, P_ia_22, P_ia_times_u_x, P_ia_times_u_y
endif

! Solve for implicit accelerations
Expand Down Expand Up @@ -938,7 +938,7 @@ subroutine accel(bergs, berg, i, j, xi, yj, lat, uvel, vvel, uvel0, vvel0, dt, a
!MP4
! if (berg%iceberg_num .eq. 1) then
! print *, '***************************************************'
! print *,'Iceberg_num, itloop', berg%iceberg_num, itloop
! print *,'id, itloop', berg%id, itloop
! print *, 'P matrix:', P_ia_11, P_ia_12,P_ia_21,P_ia_22,P_ia_times_u_x, P_ia_times_u_x
! print *,'A_matrix', A11, A12, A21, A22
! print *,'IA_x IA_y', IA_x, IA_y
Expand Down Expand Up @@ -985,7 +985,7 @@ subroutine accel(bergs, berg, i, j, xi, yj, lat, uvel, vvel, uvel0, vvel0, dt, a
bergs%nspeeding_tickets=bergs%nspeeding_tickets+1
else
call error_mesg('diamonds, Speeding icebergs', 'Faster than the CFL!', WARNING)
write(stderrunit,*) 'diamonds, Speeding berg1! =',mpp_pe(), berg%iceberg_num
write(stderrunit,*) 'diamonds, Speeding berg1! =',mpp_pe(), berg%id
write(stderrunit,*) 'diamonds, Speeding berg2, speed =',speed, loc_dx/dt
write(stderrunit,*) 'diamonds, Speeding berg3, lat, lon =',lat,xi,yj
endif
Expand All @@ -1012,7 +1012,7 @@ subroutine accel(bergs, berg, i, j, xi, yj, lat, uvel, vvel, uvel0, vvel0, dt, a
write(stderrunit,200) mpp_pe(),'Starting pars:', &
'yr0=',berg%start_year, 'day0=',berg%start_day, &
'lon0=',berg%start_lon, 'lat0=',berg%start_lat, 'mass0=',berg%start_mass, &
'sclng=',berg%mass_scaling, 'num0=',berg%iceberg_num
'sclng=',berg%mass_scaling, 'id0=',berg%id
write(stderrunit,100) mpp_pe(),'Geometry:', &
'M=',M, 'T=',T, 'D=',D, 'F=',F, 'W=',W, 'L=',L
write(stderrunit,100) mpp_pe(),'delta U:', &
Expand Down Expand Up @@ -1790,7 +1790,7 @@ subroutine find_basal_melt(bergs, dvo, lat, salt, temp, Use_three_equation_model
if (Sb_max_set .and. (Sbdry > Sb_max)) then
if (debug) then
call error_mesg('diamonds,Find basal melt', 'shelf_calc_flux: Irregular iteration for Sbdry (max).' ,WARNING)
print *, 'Sbdry error: iceberg_num,dvo,temp,salt,lat,thickness :',iceberg_num,dvo,temp,salt,lat,thickness
print *, 'Sbdry error: id,dvo,temp,salt,lat,thickness :',iceberg_num,dvo,temp,salt,lat,thickness
endif
out_of_bounds=.true.
exit
Expand All @@ -1800,7 +1800,7 @@ subroutine find_basal_melt(bergs, dvo, lat, salt, temp, Use_three_equation_model
if (Sb_min_set .and. (Sbdry < Sb_min)) then
if (debug) then
call error_mesg('diamonds,Find basal melt', 'shelf_calc_flux: Irregular iteration for Sbdry (min).' ,WARNING)
print *, 'Sbdry error: iceberg_num,dvo,temp,salt,lat,thickness :',iceberg_num,dvo,temp,salt,lat,thickness
print *, 'Sbdry error: id,dvo,temp,salt,lat,thickness :',iceberg_num,dvo,temp,salt,lat,thickness
endif
out_of_bounds=.true.
exit
Expand Down Expand Up @@ -1911,7 +1911,7 @@ subroutine find_orientation_using_iceberg_bonds(grd, berg, orientation)
other_berg=>current_bond%other_berg
if (.not. associated(other_berg)) then !good place for debugging
!One valid option: current iceberg is on the edge of halo, with other berg on the next pe (not influencing mass spreading)
!print *, 'Iceberg bond details:',berg%iceberg_num, current_bond%other_berg_num,berg%halo_berg, mpp_pe()
!print *, 'Iceberg bond details:',berg%id, current_bond%other_berg_num,berg%halo_berg, mpp_pe()
!print *, 'Iceberg bond details2:',berg%ine, berg%jne, current_bond%other_berg_ine, current_bond%other_berg_jne
!print *, 'Iceberg isd,ied,jsd,jed:',grd%isd, grd%ied, grd%jsd, grd%jed
!print *, 'Iceberg isc,iec,jsc,jec:',grd%isc, grd%iec, grd%jsc, grd%jec
Expand Down Expand Up @@ -4282,7 +4282,7 @@ subroutine verlet_stepping(bergs,berg, axn, ayn, bxn, byn, uveln, vveln)
write(stderrunit,'(a,6es9.3)') 'diamonds, evolve_iceberg: latn=',latn,berg%lat
write(stderrunit,'(a,6es9.3)') 'diamonds, evolve_iceberg: u3,un,u0=',uvel3,uveln,berg%uvel
write(stderrunit,'(a,6es9.3)') 'diamonds, evolve_iceberg: v3,vn,v0=',vvel3,vveln,berg%vvel
write(stderrunit,'(a,6es9.3)') 'diamonds, evolve_iceberg: iceberg_num=',berg%iceberg_num
write(stderrunit,'(a,6es9.3)') 'diamonds, evolve_iceberg: id=',berg%id
write(stderrunit,'(a,6es9.3)') 'diamonds, evolve_iceberg: dt* ax1=',&
& dt*ax1
write(stderrunit,'(a,6es9.3)') 'diamonds, evolve_iceberg: dt* ay1=',&
Expand Down Expand Up @@ -4730,7 +4730,7 @@ subroutine update_verlet_position(bergs, berg)
call adjust_index_and_ground(grd, lonn, latn, uvel3, vvel3, i, j, xi, yj, bounced, error_flag, berg%iceberg_num) !Alon:"unclear which velocity to use here?"

!if (bounced) then
! print *, 'you have been bounce: big time!',mpp_pe(),berg%iceberg_num,lonn, latn, uvel3, vvel3, i, j, xi, yj, bounced, error_flag
! print *, 'you have been bounce: big time!',mpp_pe(),berg%id,lonn, latn, uvel3, vvel3, i, j, xi, yj, bounced, error_flag
! berg%axn=0.0 ; berg%ayn=0.0
! berg%bxn=0.0 ; berg%byn=0.0
! berg%uvel=0.0 ; berg%vvel=0.0
Expand Down
46 changes: 23 additions & 23 deletions icebergs_framework.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ subroutine update_halo_icebergs(bergs)
do grdj = grd%jsd,grd%jed ; do grdi = grd%isd,grd%ied
this=>bergs%list(grdi,grdj)%first
do while (associated(this))
write(stderrunit,*) 'A', this%iceberg_num, mpp_pe(), this%halo_berg, grdi, grdj
write(stderrunit,*) 'A', this%id, mpp_pe(), this%halo_berg, grdi, grdj
this=>this%next
enddo
enddo; enddo
Expand Down Expand Up @@ -1281,7 +1281,7 @@ subroutine update_halo_icebergs(bergs)
do grdj = grd%jsd,grd%jed ; do grdi = grd%isd,grd%ied
this=>bergs%list(grdi,grdj)%first
do while (associated(this))
write(stderrunit,*) 'B', this%iceberg_num, mpp_pe(), this%halo_berg, grdi, grdj
write(stderrunit,*) 'B', this%id, mpp_pe(), this%halo_berg, grdi, grdj
this=>this%next
enddo
enddo; enddo
Expand All @@ -1301,7 +1301,7 @@ subroutine update_halo_icebergs(bergs)
do grdj = grd%jsc,grd%jec ; do grdi = grd%iec-halo_width+2,grd%iec
this=>bergs%list(grdi,grdj)%first
do while (associated(this))
!write(stderrunit,*) 'sending east', this%iceberg_num, this%ine, this%jne, mpp_pe()
!write(stderrunit,*) 'sending east', this%id, this%ine, this%jne, mpp_pe()
kick_the_bucket=>this
this=>this%next
nbergs_to_send_e=nbergs_to_send_e+1
Expand Down Expand Up @@ -1484,7 +1484,7 @@ subroutine update_halo_icebergs(bergs)
do grdj = grd%jsd,grd%jed ; do grdi = grd%isd,grd%ied
this=>bergs%list(grdi,grdj)%first
do while (associated(this))
write(stderrunit,*) 'C', this%iceberg_num, mpp_pe(), this%halo_berg, grdi, grdj
write(stderrunit,*) 'C', this%id, mpp_pe(), this%halo_berg, grdi, grdj
this=>this%next
enddo
enddo; enddo
Expand Down Expand Up @@ -1942,11 +1942,11 @@ subroutine clear_berg_from_partners_bonds(berg)
do while (associated(current_bond)) !Looping over bonds
other_berg=>current_bond%other_berg
if (associated(other_berg)) then
!write(stderrunit,*) , 'Other berg', berg%iceberg_num, other_berg%iceberg_num, mpp_pe()
!write(stderrunit,*) , 'Other berg', berg%id, other_berg%id, mpp_pe()
matching_bond=>other_berg%first_bond
do while (associated(matching_bond)) ! Looping over possible matching bonds in other_berg
if (matching_bond%other_berg_num .eq. berg%iceberg_num) then
!write(stderrunit,*) , 'Clearing', berg%iceberg_num, matching_bond%other_berg_num,other_berg%iceberg_num, mpp_pe()
!write(stderrunit,*) , 'Clearing', berg%id, matching_bond%other_berg_num,other_berg%id, mpp_pe()
matching_bond%other_berg=>null()
matching_bond=>null()
else
Expand Down Expand Up @@ -2702,31 +2702,31 @@ subroutine print_berg(iochan, berg, label, il, jl)
! Local variables

write(iochan,'("diamonds, print_berg: ",2a,i5,a,i12,a,2f10.4,i5,f7.2,es12.4,f5.1)') &
label, 'pe=(', mpp_pe(), ') #=', berg%iceberg_num, ' start lon,lat,yr,day,mass,hb=', &
label, 'pe=(', mpp_pe(), ') #=', berg%id, ' start lon,lat,yr,day,mass,hb=', &
berg%start_lon, berg%start_lat, berg%start_year, berg%start_day, berg%start_mass, berg%halo_berg
if (present(il).and.present(jl)) then
write(iochan,'("diamonds, print_berg: ",2a,i5,a,i12,a,2i5)') &
label, 'pe=(', mpp_pe(), ') #=', berg%iceberg_num, ' List i,j=',il,jl
label, 'pe=(', mpp_pe(), ') #=', berg%id, ' List i,j=',il,jl
endif
write(iochan,'("diamonds, print_berg: ",2a,i5,a,i12,a,2i5,a,2l2)') &
label, 'pe=(', mpp_pe(), ') #=', berg%iceberg_num, &
label, 'pe=(', mpp_pe(), ') #=', berg%id, &
' i,j=', berg%ine, berg%jne, &
' p,n=', associated(berg%prev), associated(berg%next)
write(iochan,'("diamonds, print_berg: ",2a,i5,a,i12,3(a,2f14.8))') &
label, 'pe=(', mpp_pe(), ') #=', berg%iceberg_num, &
label, 'pe=(', mpp_pe(), ') #=', berg%id, &
' xi,yj=', berg%xi, berg%yj, &
' lon,lat=', berg%lon, berg%lat, &
' lon_old,lat_old=', berg%lon_old, berg%lat_old
write(iochan,'("diamonds, print_berg: ",2a,i5,a,i12,2(a,2f14.8))') &
label, 'pe=(', mpp_pe(), ') #=', berg%iceberg_num, &
label, 'pe=(', mpp_pe(), ') #=', berg%id, &
' u,v=', berg%uvel, berg%vvel, &
' uvel_old,vvel_old=', berg%uvel_old, berg%vvel_old
write(iochan,'("diamonds, print_berg: ",2a,i5,a,i12,2(a,2f14.8))') &
label, 'pe=(', mpp_pe(), ') #=', berg%iceberg_num, &
label, 'pe=(', mpp_pe(), ') #=', berg%id, &
' axn,ayn=', berg%axn, berg%ayn, &
' bxn,byn=', berg%bxn, berg%byn
write(iochan,'("diamonds, print_berg: ",2a,i5,a,i12,3(a,2f14.8))') &
label, 'pe=(', mpp_pe(), ') #=', berg%iceberg_num, &
label, 'pe=(', mpp_pe(), ') #=', berg%id, &
' uo,vo=', berg%uo, berg%vo, &
' ua,va=', berg%ua, berg%va, &
' ui,vi=', berg%ui, berg%vi
Expand Down Expand Up @@ -2860,16 +2860,16 @@ subroutine show_all_bonds(bergs)
do while (associated(berg)) ! loop over all bergs
current_bond=>berg%first_bond
do while (associated(current_bond)) ! loop over all bonds
print *, 'Show Bond1 :', berg%iceberg_num, current_bond%other_berg_num, current_bond%other_berg_ine, current_bond%other_berg_jne, mpp_pe()
!print *, 'Current:', berg%iceberg_num, berg%ine, berg%jne,berg%halo_berg, mpp_pe()
print *, 'Show Bond1 :', berg%id, current_bond%other_berg_num, current_bond%other_berg_ine, current_bond%other_berg_jne, mpp_pe()
!print *, 'Current:', berg%id, berg%ine, berg%jne,berg%halo_berg, mpp_pe()
if (associated(current_bond%other_berg)) then
if (current_bond%other_berg%iceberg_num .ne. current_bond%other_berg_num) then
print *, 'Bond matching', berg%iceberg_num,current_bond%other_berg%iceberg_num, current_bond%other_berg_num,&
print *, 'Bond matching', berg%id,current_bond%other_berg%id, current_bond%other_berg_num,&
berg%halo_berg,current_bond%other_berg%halo_berg ,mpp_pe()
call error_mesg('diamonds, show all bonds:', 'The bonds are not matching properly!', FATAL)
endif
else
print *, 'This bond has an non-assosiated other berg :', berg%iceberg_num, current_bond%other_berg_num,&
print *, 'This bond has an non-assosiated other berg :', berg%id, current_bond%other_berg_num,&
current_bond%other_berg_ine, current_bond%other_berg_jne, berg%halo_berg, mpp_pe()
endif
current_bond=>current_bond%next_bond
Expand Down Expand Up @@ -2943,12 +2943,12 @@ subroutine connect_all_bonds(bergs)
if (.not.bond_matched) then
if (berg%halo_berg .lt. 0.5) then
missing_bond=.true.
print * ,'non-halo berg unmatched: ', berg%iceberg_num, mpp_pe(), current_bond%other_berg_num, current_bond%other_berg_ine
print * ,'non-halo berg unmatched: ', berg%id, mpp_pe(), current_bond%other_berg_num, current_bond%other_berg_ine
call error_mesg('diamonds, connect_all_bonds', 'A non-halo bond is missing!!!', FATAL)
else ! This is not a problem if the partner berg is not yet in the halo
!if ( (current_bond%other_berg_ine .gt.grd%isd-1) .and. (current_bond%other_berg_ine .lt.grd%ied+1) &
!.and. (current_bond%other_berg_jne .gt.grd%jsd-1) .and. (current_bond%other_berg_jne .lt.grd%jed+1) ) then
!print * ,'halo berg unmatched: ',mpp_pe(), berg%iceberg_num, current_bond%other_berg_num, current_bond%other_berg_ine,current_bond%other_berg_jne
!print * ,'halo berg unmatched: ',mpp_pe(), berg%id, current_bond%other_berg_num, current_bond%other_berg_ine,current_bond%other_berg_jne
!call error_mesg('diamonds, connect_all_bonds', 'A halo bond is missing!!!', WARNING)
!endif
endif
Expand Down Expand Up @@ -3005,7 +3005,7 @@ subroutine count_bonds(bergs, number_of_bonds, check_bond_quality)
number_of_bonds=number_of_bonds+1

! ##### Beginning Quality Check on Bonds ######
! print *, 'Quality check', mpp_pe(), berg%iceberg_num
! print *, 'Quality check', mpp_pe(), berg%id
if (quality_check) then
num_unmatched_bonds=0
num_unassosiated_bond_pairs=0
Expand All @@ -3027,13 +3027,13 @@ subroutine count_bonds(bergs, number_of_bonds, check_bond_quality)
enddo ! End of loop over the other berg's bonds.

if (bond_is_good) then
if (debug) write(stderrunit,*) 'Perfect quality Bond:', berg%iceberg_num, current_bond%other_berg_num
if (debug) write(stderrunit,*) 'Perfect quality Bond:', berg%id, current_bond%other_berg_num
else
if (debug) write(stderrunit,*) 'Non-matching bond...:', berg%iceberg_num, current_bond%other_berg_num
if (debug) write(stderrunit,*) 'Non-matching bond...:', berg%id, current_bond%other_berg_num
num_unmatched_bonds=num_unmatched_bonds+1
endif
else
if (debug) write(stderrunit,*) 'Opposite berg is not assosiated:', berg%iceberg_num, current_bond%other_berg%iceberg_num
if (debug) write(stderrunit,*) 'Opposite berg is not assosiated:', berg%id, current_bond%other_berg%id
num_unassosiated_bond_pairs=0
endif
endif
Expand Down

0 comments on commit 1efcdaf

Please sign in to comment.