1 subroutine da_wrfvar_finalize
3 !-------------------------------------------------------------------------
4 ! Purpose: Tidy up at the end
5 !-------------------------------------------------------------------------
10 type(domain), pointer :: grid
12 if (trace_use) call da_trace_entry ("da_wrfvar_finalize")
16 if (ALLOCATED(u6_2)) deallocate (u6_2)
17 if (ALLOCATED(v6_2)) deallocate (v6_2)
18 if (ALLOCATED(w6_2)) deallocate (w6_2)
19 if (ALLOCATED(t6_2)) deallocate (t6_2)
20 if (ALLOCATED(ph6_2)) deallocate (ph6_2)
21 if (ALLOCATED(mu6_2)) deallocate (mu6_2)
22 if (ALLOCATED(moist6)) deallocate (moist6)
23 if (ALLOCATED(p6)) deallocate (p6)
24 if (ALLOCATED(psfc6)) deallocate (psfc6)
31 if ( .not. anal_type_hybrid_dual_res ) then
32 call dealloc_space_domain(grid%id)
34 !=== deallocate fine grid
35 ! subroutine dealloc_space_domain checks for head_grid
36 ! when anal_type_hybrid_dual_res, input_grid is another_grid
37 ! dealloc_space_domain does not work in this case
38 call domain_destroy(grid)
39 !=== deallocate coarse grid
41 call dealloc_space_domain(grid%id)
46 if (ALLOCATED(u6_2)) deallocate (u6_2)
47 if (ALLOCATED(v6_2)) deallocate (v6_2)
48 if (ALLOCATED(w6_2)) deallocate (w6_2)
49 if (ALLOCATED(t6_2)) deallocate (t6_2)
50 if (ALLOCATED(ph6_2)) deallocate (ph6_2)
51 if (ALLOCATED(mu6_2)) deallocate (mu6_2)
52 if (ALLOCATED(moist6)) deallocate (moist6)
53 if (ALLOCATED(p6)) deallocate (p6)
54 if (ALLOCATED(psfc6)) deallocate (psfc6)
58 #if defined(RTTOV) || defined(CRTM)
59 if (allocated(num_tovs_before)) deallocate (num_tovs_before)
60 if (allocated(num_tovs_after)) deallocate (num_tovs_after)
61 if (allocated(tovs_copy_count)) deallocate (tovs_copy_count)
62 if (allocated(tovs_send_pe)) deallocate (tovs_send_pe)
63 if (allocated(tovs_recv_pe)) deallocate (tovs_recv_pe)
64 if (allocated(tovs_send_start)) deallocate (tovs_send_start)
65 if (allocated(tovs_send_count)) deallocate (tovs_send_count)
66 if (allocated(tovs_recv_start)) deallocate (tovs_recv_start)
72 if (.not. print_detail_outerloop) then
74 call da_free_unit (stats_unit)
77 close (check_max_iv_unit)
78 close (check_buddy_unit)
79 call da_free_unit (cost_unit)
80 call da_free_unit (grad_unit)
81 call da_free_unit (jo_unit)
82 call da_free_unit (check_max_iv_unit)
83 call da_free_unit (check_buddy_unit )
84 if (use_varbc_tamdar) then
85 close (varbc_tamdar_unit)
86 call da_free_unit (varbc_tamdar_unit)
91 if (use_rad .and. rtm_option == rtm_option_crtm) then
92 ierr = CRTM_Destroy(ChannelInfo)
93 deallocate(Sensor_Descriptor)
97 if ( use_gpsephobs ) then
98 call da_gpseph_final ( )
101 do i=unit_start,unit_end
102 if (unit_used(i)) then
103 write(unit=stderr,FMT=*) "unit",i,"still used"
107 if (trace_use) call da_trace_exit ("da_wrfvar_finalize")
109 end subroutine da_wrfvar_finalize