1 module debug_dump_variable
10 ! output a land surface dimensioned array to a test file for comparison
12 subroutine dump_float_2d(target_array, filepath)
14 ! the array to be written to file
15 real, allocatable, dimension(:,:), intent(in) :: target_array
17 ! the location to write the file
18 character(len=*), intent(in) :: filepath
21 real, dimension(global_rt_nx,global_rt_ny) :: out_buffer
23 ! if we are in an mpi enviorment what needs to be done depends of if
24 ! this process is the IO process
25 ! if we are not the IO process write_IO_real will send data to the IO process
26 ! if we are the IO process write_IO_RT_real will return the global array for this
29 call write_IO_RT_real(target_array,out_buffer)
30 if ( my_id .eq. IO_id ) then
31 call debug_write_float_to_file(out_buffer,filepath)
34 call debug_write_float_to_file(target_array, filepath)
37 end subroutine dump_float_2d
39 ! output a routing dimensioned array to a test file for comparison
41 subroutine dump_float_2d_rt(target_array, filepath)
43 ! the array to be written to file
44 real, allocatable, dimension(:,:), intent(in) :: target_array
46 ! the location to write the file
47 character(len=*), intent(in) :: filepath
50 real, dimension(global_rt_nx,global_rt_ny) :: out_buffer
52 ! if we are in an mpi enviorment what needs to be done depends of if
53 ! this process is the IO process
54 ! if we are not the IO process write_IO_RT_real will send data to the IO process
55 ! if we are the IO process write_IO_RT_real will return the global array for this
58 call write_IO_real(target_array,out_buffer)
59 if ( my_id .eq. IO_id ) then
60 call debug_write_float_to_file(out_buffer,filepath)
63 call debug_write_float_to_file(target_array, filepath)
66 end subroutine dump_float_2d_rt
68 subroutine debug_write_float_to_file(target_array, filepath)
70 real, dimension(:,:) :: target_array
71 character(len=*) :: filepath
77 integer :: x_pos, y_pos
79 nx = size(target_array,1)
80 ny = size(target_array,2)
82 ! open the file for writing
83 open(unit=237, file=filepath, form='formatted', status="replace", action="write")
85 ! write the array to the file
88 write(237,'(F12.5,4X)',advance='no') target_array(x_pos,y_pos)
90 write(237,*) '' ! write the end line
99 end module debug_dump_variable