Skip to content

Commit

Permalink
Reverted the reverse_list changes
Browse files Browse the repository at this point in the history
- The reverse_list option creates files that we cannot read with the
  current analysis tools. I'm reverting this before implementing an
  alternative solution.
- No answer changes (for normal order mode).
  • Loading branch information
adcroft committed Jul 17, 2015
1 parent 8368e69 commit 314713b
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 202 deletions.
34 changes: 3 additions & 31 deletions icebergs_framework.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ module ice_bergs_framework
logical :: fix_restart_dates=.true. ! After a restart, check that bergs were created before the current model date
logical :: do_unit_tests=.false. ! Conduct some unit tests
logical :: force_all_pes_traj=.false. ! Force all pes write trajectory files regardless of io_layout
logical :: reverse_traj=.false. ! Force trajectories to be written in reverse order into files to save time

!Public params !Niki: write a subroutine to expose these
public nclasses,buffer_width,buffer_width_traj
public verbose, really_debug, debug, restart_input_dir,make_calving_reproduce,old_bug_bilin,use_roundoff_fix
public ignore_ij_restart, use_slow_find,generate_test_icebergs,old_bug_rotated_weights,budget
public orig_read, force_all_pes_traj, reverse_traj
public orig_read, force_all_pes_traj


!Public types
Expand All @@ -67,7 +66,6 @@ module ice_bergs_framework
public checksum_gridded
public grd_chksum2,grd_chksum3
public fix_restart_dates, offset_berg_dates
public reverse_list

type :: icebergs_gridded
type(domain2D), pointer :: domain ! MPP domain
Expand Down Expand Up @@ -281,7 +279,7 @@ subroutine ice_bergs_framework_init(bergs, &
parallel_reprod, use_slow_find, sicn_shift, add_weight_to_ocean, passive_mode, ignore_ij_restart, &
time_average_weight, generate_test_icebergs, speed_limit, fix_restart_dates, use_roundoff_fix, &
old_bug_rotated_weights, make_calving_reproduce,restart_input_dir, orig_read, old_bug_bilin,do_unit_tests,grounding_fraction, &
input_freq_distribution, force_all_pes_traj, reverse_traj
input_freq_distribution, force_all_pes_traj

! Local variables
integer :: ierr, iunit, i, j, id_class, axes3d(3), is,ie,js,je,np
Expand Down Expand Up @@ -1226,9 +1224,7 @@ subroutine unpack_traj_from_buffer2(first, buff, n)
traj%cn=buff%data(22,n)
traj%hi=buff%data(23,n)

! call append_posn(first, traj) !This call could take a very long time (as if the run hangs) if there are millions of nodes in the list. Use push_posn instead and reverse the list later before writing the file.
!
call push_posn(first, traj)
call append_posn(first, traj)

end subroutine unpack_traj_from_buffer2

Expand Down Expand Up @@ -1650,30 +1646,6 @@ end subroutine record_posn

! ##############################################################################

subroutine reverse_list(list)
! Arguments
type(xyt), pointer :: list

! Local variables
type(xyt), pointer :: head,tail,node
integer :: i

i=0
head=>list
tail=>list
node=>list%next
list%next=>null()
do while (associated(node))
head=>node
node=>node%next
head%next=>tail
tail=>head
i=i+1
enddo
list=>head
print*,'reverse_list number of nodes= ',i
end subroutine reverse_list

subroutine push_posn(trajectory, posn_vals)
! Arguments
type(xyt), pointer :: trajectory
Expand Down
Loading

0 comments on commit 314713b

Please sign in to comment.