SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_gltools_alloc.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_alloc ========================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! Allocates 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 allocated.
56 !
57 ! -------------------- BEGIN MODULE modi_gltools_alloc --------------------
58 !
59 !THXS_SFX!MODULE modi_gltools_alloc
60 !THXS_SFX!INTERFACE
61 !THXS_SFX!!
62 !THXS_SFX!SUBROUTINE gltools_alloc (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_alloc
68 !THXS_SFX!!
69 !THXS_SFX!END INTERFACE
70 !THXS_SFX!END MODULE modi_gltools_alloc
71 !
72 ! -------------------- END MODULE modi_gltools_alloc ----------------------
73 !
74 !
75 ! -----------------------------------------------------------------------
76 ! -------------------------- SUBROUTINE gltools_alloc ---------------------------
77 !
78 SUBROUTINE gltools_alloc(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 !USE modd_CB_ThermoVariables
89 #endif
90 !
91 IMPLICIT NONE
92 !
93 TYPE(t_glt), INTENT(inout) :: &
94  tpglt
95 !
96 !
97 ! 1. Initialisations
98 ! ===================
99 !
100 IF (lp1) THEN
101  WRITE(noutlu,*) ' '
102  WRITE(noutlu,*) ' ** LEVEL 3 - SUBROUTINE ALLOC'
103  WRITE(noutlu,*) ' '
104 ENDIF
105 !
106 !
107 #if ! defined in_surfex
108 !
109 ! 2. Allocate arrays for McGill's dynamics
110 ! =========================================
111 !
112 IF ( ndynami==2 ) THEN
113 ! modd_CB_dynvariables.F90
114  ALLOCATE( h(0:nxd+2,0:nyd+2) )
115  ALLOCATE( a(0:nxd+2,0:nyd+2) )
116  ALLOCATE( uice(0:nxd+2,0:nyd+2) )
117  ALLOCATE( vice(0:nxd+2,0:nyd+2) )
118  ALLOCATE( ut1(0:nxd+2,0:nyd+2) )
119  ALLOCATE( vt1(0:nxd+2,0:nyd+2) )
120  ALLOCATE( p(0:nxd+2,0:nyd+2) )
121  ALLOCATE( etac(0:nxd+2,0:nyd+2) )
122  ALLOCATE( etab(0:nxd+2,0:nyd+2) )
123  ALLOCATE( zetac(0:nxd+2,0:nyd+2) )
124  ALLOCATE( etacf(0:nxd+2,0:nyd+2) )
125  ALLOCATE( etabf(0:nxd+2,0:nyd+2) )
126  ALLOCATE( zetacf(0:nxd+2,0:nyd+2) )
127  ALLOCATE( tracer(0:nxd+2,0:nyd+2,2) )
128 ! modd_CB_Dyndim.F90
129  ALLOCATE( cdwc1(0:nxd+2,0:nyd+2) )
130  ALLOCATE( cdwc2(0:nxd+2,0:nyd+2) )
131  ALLOCATE( cdwc1f(0:nxd+2,0:nyd+2) )
132  ALLOCATE( cdwc2f(0:nxd+2,0:nyd+2) )
133 ! modd_CB_const.F90
134  ALLOCATE( sinlat(0:nxd+2,0:nyd+2) ) ! ok
135  ALLOCATE( coslat(0:nxd+2,0:nyd+2) ) ! ok
136 ! modd_CB_mask.F90
137  ALLOCATE( maskb( 0:nxd+2, 0:nyd+2 ) ) ! ok
138  ALLOCATE( maskc( 0:nxd+2, 0:nyd+2 ) ) ! ok
139 ! modd_CB_DynForcing.F90
140  ALLOCATE( uwatnd(0:nxd+2,0:nyd+2) )
141  ALLOCATE( vwatnd(0:nxd+2,0:nyd+2) )
142  ALLOCATE( speediw(0:nxd+2,0:nyd+2) )
143  ALLOCATE( r1(0:nxd+2,0:nyd+2) )
144  ALLOCATE( r2(0:nxd+2,0:nyd+2) )
145  ALLOCATE( r1n(0:nxd+2,0:nyd+2) )
146  ALLOCATE( r2n(0:nxd+2,0:nyd+2) )
147  ALLOCATE( bu_ind(0:nxd+2,0:nyd+2) )
148  ALLOCATE( bv_ind(0:nxd+2,0:nyd+2) )
149  ALLOCATE( bu(0:nxd+2,0:nyd+2) )
150  ALLOCATE( bv(0:nxd+2,0:nyd+2) )
151 ENDIF
152 #endif
153 !
154 !
155 !
156 ! 3. Allocate all tpglt arrays and structures
157 ! ============================================
158 !
159 ALLOCATE( tpglt%bat(nx,ny) )
160 ALLOCATE( tpglt%dom(nx,ny) )
161 !
162 #if ! defined in_surfex
163 ! Dans ce qui suit, les champs marqués 'adv' sont nécessaires à l'advection
164 ! Les autres ne le sont pas, mais il faut voir s'ils ne sont pas définis
165 ! en même temps...
166 ! (possibilité d'économiser de la mémoire si on utilise l'advection après
167 ! le traitement de la dynamique par la méthode du McGill)
168 ! Même traitement dans 'dealloc'
169 !
170 IF ( ndynami==1 .OR. nadvect==1 ) THEN
171  ALLOCATE( tpglt%dxtr(ilo:ihi,jlo:jhi) )
172  ALLOCATE( tpglt%dytr(ilo:ihi,jlo:jhi) )
173  ALLOCATE( tpglt%dxtr4(ilo:ihi,jlo:jhi) )
174  ALLOCATE( tpglt%dytr4(ilo:ihi,jlo:jhi) )
175  ALLOCATE( tpglt%fcor(ilo:ihi,jlo:jhi) )
176  ALLOCATE( tpglt%tarear(ilo:ihi,jlo:jhi) ) ! adv
177 !
178  ALLOCATE( tpglt%HTN(nx,ny) )
179  ALLOCATE( tpglt%HTE(nx,ny) )
180  ALLOCATE( tpglt%HTS(nx,ny) ) ! adv
181  ALLOCATE( tpglt%HTW(nx,ny) ) ! adv
182  ALLOCATE( tpglt%hm(nx,ny) ) ! adv
183  ALLOCATE( tpglt%um(nx,ny) )
184  ALLOCATE( tpglt%dxta(nx,ny) ) ! adv
185  ALLOCATE( tpglt%dyta(nx,ny) ) ! adv
186  ALLOCATE( tpglt%dxt2r(nx,ny) ) ! adv
187  ALLOCATE( tpglt%dyt2r(nx,ny) ) ! adv
188  ALLOCATE( tpglt%HTNa(nx,ny) ) ! adv
189  ALLOCATE( tpglt%HTEa(nx,ny) ) ! adv
190  ALLOCATE( tpglt%cx(nx,ny) ) ! adv
191  ALLOCATE( tpglt%cy(nx,ny) ) ! adv
192  ALLOCATE( tpglt%cxx(nx,ny) ) ! adv
193  ALLOCATE( tpglt%cxy(nx,ny) ) ! adv
194  ALLOCATE( tpglt%cyy(nx,ny) ) ! adv
195  ALLOCATE( tpglt%cxxx(nx,ny) ) ! adv
196  ALLOCATE( tpglt%cxxy(nx,ny) ) ! adv
197  ALLOCATE( tpglt%cxyy(nx,ny) ) ! adv
198  ALLOCATE( tpglt%cyyy(nx,ny) ) ! adv
199 !
200  ALLOCATE( tpglt%mne(2,2,nx,ny) )! adv
201  ALLOCATE( tpglt%mnw(2,2,nx,ny) )! adv
202  ALLOCATE( tpglt%msw(2,2,nx,ny) )! adv
203  ALLOCATE( tpglt%mse(2,2,nx,ny) )! adv
204 ENDIF
205 !
206 ! Arrays for McGill's dynamics (all other arrays declared in 3. should
207 ! end up in this part !)
208 !
209 IF ( ndynami==2 ) THEN
210  ALLOCATE( tpglt%index2d(2,0:nxd+2,0:nyd+2) )
211  ALLOCATE( tpglt%mskice(2,0:nxd+2,0:nyd+2) )
212 ENDIF
213 #endif
214 !
215 ALLOCATE( tpglt%oce_all(nx,ny) )
216 ALLOCATE( tpglt%atm_all(nx,ny) )
217 ALLOCATE( tpglt%all_oce(nx,ny) )
218 !
219 IF ( nnflxin==0 ) THEN
220  ALLOCATE( tpglt%atm_mix(1,nx,ny) )
221  ALLOCATE( tpglt%mix_atm(1,nx,ny) )
222  ELSE
223  ALLOCATE( tpglt%atm_ice(nnflxin,nx,ny) )
224  ALLOCATE( tpglt%atm_wat(nx,ny) )
225  ALLOCATE( tpglt%ice_atm(nnflxin,nx,ny) )
226 ENDIF
227 !
228 IF ( ntd/=0 ) ALLOCATE( tpglt%sit_d(ntd,nx,ny) )
229 !
230 IF ( ndynami==1 ) THEN
231  ALLOCATE( tpglt%evp(nx,ny) )
232 ELSE IF ( ndynami==2 ) THEN
233  ALLOCATE( tpglt%jfn(nx,ny) )
234 ENDIF
235 !
236 ALLOCATE( tpglt%sit(nt,nx,ny) )
237 ALLOCATE( tpglt%sil(nl,nt,nx,ny) )
238 ALLOCATE( tpglt%tml(nx,ny) )
239 !
240 ALLOCATE( tpglt%ust(nx,ny) )
241 ALLOCATE( tpglt%cdia0(ndiamax,1,1) )
242 ALLOCATE( tpglt%cdia(ndiamax,nx,ny) )
243 ALLOCATE( tpglt%blkw(nx,ny) )
244 ALLOCATE( tpglt%blki(nt,nx,ny) )
245 ALLOCATE( tpglt%tfl(nx,ny) )
246 ALLOCATE( tpglt%bud(nx,ny) )
247 ALLOCATE( tpglt%dia(nx,ny) )
248 !
249 !
250 !
251 ! 4. The end
252 ! ===========
253 !
254 IF (lp1) THEN
255  WRITE(noutlu,*) ' '
256  WRITE(noutlu,*) ' ** LEVEL 3 - END SUBROUTINE ALLOC'
257  WRITE(noutlu,*) ' '
258 ENDIF
259 !
260 END SUBROUTINE gltools_alloc
261 !
262 ! ------------------------ END SUBROUTINE gltools_alloc -------------------------
263 ! -----------------------------------------------------------------------
subroutine gltools_alloc(tpglt)