SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_gltools_dealloc.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !GLT_LIC The GELATO model is a seaice model used in stand-alone or embedded mode.
6 !GLT_LIC It has been developed by Meteo-France. The holder of GELATO is Meteo-France.
7 !GLT_LIC
8 !GLT_LIC This software is governed by the CeCILL-C license under French law and biding
9 !GLT_LIC by the rules of distribution of free software. See the CeCILL-C_V1-en.txt
10 !GLT_LIC (English) and CeCILL-C_V1-fr.txt (French) for details. The CeCILL is a free
11 !GLT_LIC software license, explicitly compatible with the GNU GPL
12 !GLT_LIC (see http://www.gnu.org/licenses/license-list.en.html#CeCILL)
13 !GLT_LIC
14 !GLT_LIC The CeCILL-C licence agreement grants users the right to modify and re-use the
15 !GLT_LIC software governed by this free software license. The exercising of this right
16 !GLT_LIC is conditional upon the obligation to make available to the community the
17 !GLT_LIC modifications made to the source code of the software so as to contribute to
18 !GLT_LIC its evolution.
19 !GLT_LIC
20 !GLT_LIC In consideration of access to the source code and the rights to copy, modify
21 !GLT_LIC and redistribute granted by the license, users are provided only with a limited
22 !GLT_LIC warranty and the software's author, the holder of the economic rights, and the
23 !GLT_LIC successive licensors only have limited liability. In this respect, the risks
24 !GLT_LIC associated with loading, using, modifying and/or developing or reproducing the
25 !GLT_LIC software by the user are brought to the user's attention, given its Free
26 !GLT_LIC Software status, which may make it complicated to use, with the result that its
27 !GLT_LIC use is reserved for developers and experienced professionals having in-depth
28 !GLT_LIC computer knowledge. Users are therefore encouraged to load and test the
29 !GLT_LIC suitability of the software as regards their requirements in conditions enabling
30 !GLT_LIC the security of their systems and/or data to be ensured and, more generally, to
31 !GLT_LIC use and operate it in the same conditions of security.
32 !GLT_LIC
33 !GLT_LIC The GELATO sofware is cureently distibuted with the SURFEX software, available at
34 !GLT_LIC http://www.cnrm.meteo.fr/surfex. The fact that you download the software deemed that
35 !GLT_LIC you had knowledge of the CeCILL-C license and that you accept its terms.
36 !GLT_LIC Attempts to use this software in a way not complying with CeCILL-C license
37 !GLT_LIC may lead to prosecution.
38 !GLT_LIC
39 ! =======================================================================
40 ! ===================== MODULE modi_gltools_dealloc =======================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! Deallocates glt_gelato main arrays and structures
46 !
47 ! Created : 2004/01 (D. Salas y Melia)
48 ! Modified: 2011/12 (D. Salas y Melia)
49 ! Collect the names of allocated arrays in a linked list, and
50 ! eventually dump this list in an array of strings, in order
51 ! to keep the allocation order in memory. This order will be
52 ! necessary to deallocate the arrays in reverse order.
53 ! Modified: 2012/11 (D. Salas y Melia)
54 ! Inverse order deallocation seems unuseful - simplify.
55 ! Only the main tglt super-structure is deallocated.
56 !
57 ! ------------------- BEGIN MODULE modi_gltools_dealloc -------------------
58 !
59 !THXS_SFX!MODULE modi_gltools_dealloc
60 !THXS_SFX!INTERFACE
61 !THXS_SFX!!
62 !THXS_SFX!SUBROUTINE gltools_dealloc(tpglt)
63 !THXS_SFX!USE modd_types_glt
64 !THXS_SFX!USE modd_glt_param
65 !THXS_SFX!TYPE(t_glt), INTENT(inout) :: &
66 !THXS_SFX! tpglt
67 !THXS_SFX!END SUBROUTINE gltools_dealloc
68 !THXS_SFX!!
69 !THXS_SFX!END INTERFACE
70 !THXS_SFX!END MODULE modi_gltools_dealloc
71 !
72 ! ------------------- END MODULE modi_gltools_dealloc ---------------------
73 !
74 !
75 ! -----------------------------------------------------------------------
76 ! ------------------------- SUBROUTINE gltools_dealloc --------------------------
77 !
78 SUBROUTINE gltools_dealloc(tpglt)
79 !
80 USE modd_types_glt
82 #if ! defined in_surfex
83 USE modd_cb_dynvariables
84 USE modd_cb_dyndim
85 USE modd_cb_const
86 USE modd_cb_mask
87 USE modd_cb_dynforcing
88 #endif
89 !
90 IMPLICIT NONE
91 !
92 TYPE(t_glt), INTENT(inout) :: &
93  tpglt
94 !
95 !
96 ! 1. Initialisations
97 ! ===================
98 !
99 IF (lwg) THEN
100  WRITE(noutlu,*) ' '
101  WRITE(noutlu,*) ' ** LEVEL 3 - SUBROUTINE DEALLOC'
102  WRITE(noutlu,*) ' '
103 ENDIF
104 !
105 !
106 #if ! defined in_surfex
107 !
108 ! 2. Deallocate arrays for McGill's dynamics
109 ! ===========================================
110 !
111 IF ( ndynami==2 ) THEN
112 ! modd_CB_dynvariables.F90
113  DEALLOCATE( h )
114  DEALLOCATE( a )
115  DEALLOCATE( uice )
116  DEALLOCATE( vice )
117  DEALLOCATE( ut1 )
118  DEALLOCATE( vt1 )
119  DEALLOCATE( p )
120  DEALLOCATE( etac )
121  DEALLOCATE( etab )
122  DEALLOCATE( zetac )
123  DEALLOCATE( etacf )
124  DEALLOCATE( etabf )
125  DEALLOCATE( zetacf )
126  DEALLOCATE( tracer )
127 ! modd_CB_Dyndim.F90 )
128  DEALLOCATE( cdwc1 )
129  DEALLOCATE( cdwc2 )
130  DEALLOCATE( cdwc1f )
131  DEALLOCATE( cdwc2f )
132 ! modd_CB_const.F90 )
133  DEALLOCATE( sinlat )
134  DEALLOCATE( coslat )
135 ! modd_CB_mask.F90 )
136  DEALLOCATE( maskb )
137  DEALLOCATE( maskc )
138 ! modd_CB_DynForcing.F90 )
139  DEALLOCATE( uwatnd )
140  DEALLOCATE( vwatnd )
141  DEALLOCATE( speediw )
142  DEALLOCATE( r1 )
143  DEALLOCATE( r2 )
144  DEALLOCATE( r1n )
145  DEALLOCATE( r2n )
146  DEALLOCATE( bu_ind )
147  DEALLOCATE( bv_ind )
148  DEALLOCATE( bu )
149  DEALLOCATE( bv )
150 ENDIF
151 #endif
152 !
153 !
154 !
155 ! 3. Deallocate all tpglt arrays and structures
156 ! =============================================
157 !
158 DEALLOCATE( tpglt%bat )
159 DEALLOCATE( tpglt%dom )
160 !
161 #if ! defined in_surfex
162 IF ( ndynami==1 .OR. nadvect==1 ) THEN
163  DEALLOCATE( tpglt%dxtr )
164  DEALLOCATE( tpglt%dytr )
165  DEALLOCATE( tpglt%dxtr4 )
166  DEALLOCATE( tpglt%dytr4 )
167  DEALLOCATE( tpglt%fcor )
168  DEALLOCATE( tpglt%tarear )
169 !
170  DEALLOCATE( tpglt%HTN )
171  DEALLOCATE( tpglt%HTE )
172  DEALLOCATE( tpglt%HTS )
173  DEALLOCATE( tpglt%HTW )
174  DEALLOCATE( tpglt%hm )
175  DEALLOCATE( tpglt%um )
176  DEALLOCATE( tpglt%dxta )
177  DEALLOCATE( tpglt%dyta )
178  DEALLOCATE( tpglt%dxt2r )
179  DEALLOCATE( tpglt%dyt2r )
180  DEALLOCATE( tpglt%HTNa )
181  DEALLOCATE( tpglt%HTEa )
182  DEALLOCATE( tpglt%cx )
183  DEALLOCATE( tpglt%cy )
184  DEALLOCATE( tpglt%cxx )
185  DEALLOCATE( tpglt%cxy )
186  DEALLOCATE( tpglt%cyy )
187  DEALLOCATE( tpglt%cxxx )
188  DEALLOCATE( tpglt%cxxy )
189  DEALLOCATE( tpglt%cxyy )
190  DEALLOCATE( tpglt%cyyy )
191 !
192  DEALLOCATE( tpglt%mne )
193  DEALLOCATE( tpglt%mnw )
194  DEALLOCATE( tpglt%msw )
195  DEALLOCATE( tpglt%mse )
196 ENDIF
197 !
198 ! Arrays for McGill's dynamics (all other arrays declared in 3. should
199 ! end up in this part !)
200 !
201 IF ( ndynami==2 ) THEN
202  DEALLOCATE( tpglt%index2d )
203  DEALLOCATE( tpglt%mskice )
204 ENDIF
205 #endif
206 !
207 DEALLOCATE( tpglt%oce_all )
208 DEALLOCATE( tpglt%atm_all )
209 DEALLOCATE( tpglt%all_oce )
210 !
211 IF ( nnflxin==0 ) THEN
212  DEALLOCATE( tpglt%atm_mix )
213  DEALLOCATE( tpglt%mix_atm )
214  ELSE
215  DEALLOCATE( tpglt%atm_ice )
216  DEALLOCATE( tpglt%atm_wat )
217  DEALLOCATE( tpglt%ice_atm )
218 ENDIF
219 !
220 IF ( ntd/=0 ) DEALLOCATE( tpglt%sit_d )
221 !
222 #if ! defined in_surfex
223 IF ( ndynami==1 ) THEN
224  DEALLOCATE( tpglt%evp )
225 ELSE IF ( ndynami==2 ) THEN
226  DEALLOCATE( tpglt%jfn )
227 ENDIF
228 #endif
229 !
230 DEALLOCATE( tpglt%sit )
231 DEALLOCATE( tpglt%sil )
232 DEALLOCATE( tpglt%tml )
233 !
234 DEALLOCATE( tpglt%ust )
235 DEALLOCATE( tpglt%cdia0 )
236 DEALLOCATE( tpglt%cdia )
237 DEALLOCATE( tpglt%blkw )
238 DEALLOCATE( tpglt%blki )
239 DEALLOCATE( tpglt%tfl )
240 DEALLOCATE( tpglt%bud )
241 DEALLOCATE( tpglt%dia )
242 !
243 !
244 !
245 ! 4. The end
246 ! ===========
247 !
248 IF (lwg) THEN
249  WRITE(noutlu,*) ' '
250  WRITE(noutlu,*) ' ** LEVEL 3 - END SUBROUTINE DEALLOC'
251  WRITE(noutlu,*) ' '
252 ENDIF
253 !
254 END SUBROUTINE gltools_dealloc
255 !
256 ! ----------------------- END SUBROUTINE gltools_dealloc ------------------------
257 ! -----------------------------------------------------------------------
subroutine gltools_dealloc(tpglt)