1 | !> \file output_anta_mod-0.4.f90 |
---|
2 | !> \namespace output_antarcti_mod |
---|
3 | |
---|
4 | !! Module de sortie temporelle Antarctique avec regions |
---|
5 | !! \author Cat |
---|
6 | !! \date ... |
---|
7 | !! @note Used module |
---|
8 | !! @note - use module3D_phy |
---|
9 | !! @note - use param_phy_mod |
---|
10 | !< |
---|
11 | |
---|
12 | |
---|
13 | module output_antarcti_mod |
---|
14 | |
---|
15 | USE module3D_phy |
---|
16 | USE param_phy_mod |
---|
17 | use io_netcdf_grisli |
---|
18 | |
---|
19 | implicit none |
---|
20 | |
---|
21 | !real :: vol ; !integer :: np |
---|
22 | real :: bmean !< |
---|
23 | real :: accmean !< accumulation moyenne |
---|
24 | real :: ablmean !< ablation moyenne |
---|
25 | real :: calvmean !< moyenne calving |
---|
26 | real :: ablbordmean !< |
---|
27 | real :: bmeltmean !< moyenne fusion basale |
---|
28 | real :: tbmean !< temperature basale moyenne |
---|
29 | real :: tbdotmean !< moyenne variation / temps temperature basale |
---|
30 | real :: vsmean !< vitesse de surface moyenne |
---|
31 | real :: uzsdotmean !< moyenne variation / temps vitesse verticale de surface |
---|
32 | real :: uzkmean !< moyenne vitesse verticale de surface |
---|
33 | real :: hdotmean !< moyenne derivee / temps de h |
---|
34 | real :: bdotmean !< moyenne bedrock derive / temps |
---|
35 | real :: volf !< volume au dessus de la flottaison |
---|
36 | |
---|
37 | |
---|
38 | ! dimensionnement pour les bassins ou regions |
---|
39 | |
---|
40 | integer,parameter :: nbreg_max=20 !< nombre maxi de regions |
---|
41 | integer :: nbregions !< nombre de region |
---|
42 | integer :: i_region !< index des regions |
---|
43 | integer :: scal_np !< nombre de points grounded par region |
---|
44 | integer, dimension(nbreg_max) :: np_reg !< nombre de points grounded par region |
---|
45 | integer, dimension(nx,ny) :: mask_region !< carte des region |
---|
46 | integer, dimension(nbreg_max) :: nbpoint_reg !< nb de points par region |
---|
47 | |
---|
48 | real, dimension(nbreg_max) :: vol_reg !< volumes par region (points grounded) |
---|
49 | real, dimension(nbreg_max) :: volbuoy_reg !< volumes au dessus flottaison par region |
---|
50 | real, dimension(nbreg_max) :: meanhdot_reg !< hdot moyens par region |
---|
51 | real, dimension(nbreg_max) :: sigma_hdot_reg !< sigma hdot par region |
---|
52 | |
---|
53 | real :: scal_vol !< volumes par region (points grounded) |
---|
54 | real :: scal_volbuoy !< volumes au dessus flottaison par region |
---|
55 | real :: scal_meanhdot !< hdot moyens par region |
---|
56 | real :: scal_sigma_hdot !< sigma hdot par region |
---|
57 | |
---|
58 | |
---|
59 | integer :: nvol = 250 !< numero du fichier volume |
---|
60 | integer :: nvolbuoy = 251 !< numero du fichier volume au dessus flottaison |
---|
61 | integer :: nhdot = 252 !< numero du fichier hdot mean |
---|
62 | integer :: nsigma_hdot = 253 !< numero du fichier hdot sigma |
---|
63 | integer :: npoints = 254 !< numero du fichier nb de points |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | contains |
---|
68 | |
---|
69 | !_______________________________________________________________________________ |
---|
70 | !< initialise les sorties |
---|
71 | |
---|
72 | subroutine init_outshort |
---|
73 | |
---|
74 | implicit none |
---|
75 | |
---|
76 | real*8, dimension(:,:), pointer :: work_tab !< tableau 2d real ecrit dans le fichier |
---|
77 | character(len=100) :: file_ncdf !< fichier netcdf issue des fichiers .dat |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | character(len=100) :: region_file ! Fichier dans lequel sont les regions |
---|
83 | character(len=100) :: filout ! Pour fichier ecriture |
---|
84 | namelist/output_regions/nbregions,region_file |
---|
85 | |
---|
86 | if (itracebug.eq.1) call tracebug('output_antarcti_mod subroutine init_out_short') |
---|
87 | |
---|
88 | |
---|
89 | ndisp = 1 ! ndisp sortie courte tous les ndisp |
---|
90 | |
---|
91 | |
---|
92 | ! lecture des regions ----------------------------------------------------- |
---|
93 | |
---|
94 | rewind(num_param) ! pour revenir au debut du fichier param_list.dat |
---|
95 | 428 format(A) |
---|
96 | read(num_param,output_regions) |
---|
97 | |
---|
98 | write(num_rep_42,428) '!___________________________________________________________' |
---|
99 | write(num_rep_42,428) '! sorties temporelles par regions' |
---|
100 | write(num_rep_42,output_regions) |
---|
101 | write(num_rep_42,428) '! nbregions = nombre de regions' |
---|
102 | write(num_rep_42,428) '! region_file = carte des regions ' |
---|
103 | write(num_rep_42,428) '!___________________________________________________________' |
---|
104 | |
---|
105 | |
---|
106 | ! lecture du masque region |
---|
107 | file_ncdf = trim(dirnameinp)//'test_map_region'//'.nc' |
---|
108 | region_file = trim(dirnameinp)//region_file |
---|
109 | write(6,*) file_ncdf |
---|
110 | write(6,*) region_file |
---|
111 | ! call lect_input(1,'mask_region',1,work_tab,region_file,file_ncdf) |
---|
112 | call Read_Ncdf_var('z',region_file,work_tab) |
---|
113 | |
---|
114 | |
---|
115 | mask_region(:,:) = work_tab(:,:) |
---|
116 | if (mask_region((nx-1)/2,(ny-1)/2).eq.0) then |
---|
117 | write(6,*) 'mauvaise lecture du fichier region' |
---|
118 | STOP |
---|
119 | end if |
---|
120 | |
---|
121 | |
---|
122 | ! ouverture des fichiers par type de variable, toutes les regions dans le meme fichier |
---|
123 | |
---|
124 | filout = runname//'_vol_regions.dat' |
---|
125 | filout = TRIM(DIRNAMEOUT)//TRIM(filout) |
---|
126 | open(nvol,file=filout) |
---|
127 | |
---|
128 | filout = runname// '_volbuoy_regions.dat' |
---|
129 | filout = TRIM(DIRNAMEOUT)//TRIM(filout) |
---|
130 | open(nvolbuoy,file=filout) |
---|
131 | |
---|
132 | filout = runname//'_meanhdot_regions.dat' |
---|
133 | filout = TRIM(DIRNAMEOUT)//TRIM(filout) |
---|
134 | open(nhdot,file=filout) |
---|
135 | |
---|
136 | filout = runname//'_sigmahdot_regions.dat' |
---|
137 | filout = TRIM(DIRNAMEOUT)//TRIM(filout) |
---|
138 | open(nsigma_hdot,file=filout) |
---|
139 | |
---|
140 | filout = runname//'_nbpoints_regions.dat' |
---|
141 | filout = TRIM(DIRNAMEOUT)//TRIM(filout) |
---|
142 | open(npoints,file=filout) |
---|
143 | |
---|
144 | |
---|
145 | |
---|
146 | end subroutine init_outshort |
---|
147 | |
---|
148 | |
---|
149 | |
---|
150 | !_________________________________________________________________________ |
---|
151 | subroutine shortoutput |
---|
152 | |
---|
153 | implicit none |
---|
154 | real :: smax |
---|
155 | |
---|
156 | |
---|
157 | if (itracebug.eq.1) call tracebug('output_antarcti_mod subroutine shortoutput') |
---|
158 | |
---|
159 | |
---|
160 | ! Sorties pour toute la calotte (ancienne version) |
---|
161 | |
---|
162 | ! 1_initialization |
---|
163 | !------------------ |
---|
164 | |
---|
165 | vol=0. |
---|
166 | np=0 |
---|
167 | hmax=0. |
---|
168 | smax=0. |
---|
169 | bmean=0. |
---|
170 | accmean=0. |
---|
171 | ablmean=0. |
---|
172 | calvmean=0. |
---|
173 | ablbordmean=0. |
---|
174 | bmeltmean=0. |
---|
175 | tbmean=0. |
---|
176 | tbdotmean=0. |
---|
177 | vsmean=0. |
---|
178 | uzsdotmean=0. |
---|
179 | uzkmean=0. |
---|
180 | hdotmean=0. |
---|
181 | bdotmean=0. |
---|
182 | volf=0. |
---|
183 | |
---|
184 | ! 2_preparing outputs |
---|
185 | !-------------------- |
---|
186 | do i=1,nx |
---|
187 | do j=1,ny |
---|
188 | if (.not.flot(i,j)) then |
---|
189 | ! if (h(i,j).gt.1.) then |
---|
190 | np=np+1 |
---|
191 | vol=vol+h(i,j) |
---|
192 | |
---|
193 | ! calcul de la hauteur au dessus de la flottaison |
---|
194 | if (sealevel_2d(i,j)-B(i,j).le.0.) then ! socle au dessus du niveau des mers |
---|
195 | volf=volf+h(i,j) |
---|
196 | else |
---|
197 | volf=volf+h(i,j)-row/ro*(sealevel_2d(i,j)-b(i,j)) |
---|
198 | endif |
---|
199 | |
---|
200 | |
---|
201 | if (h(i,j).gt.hmax) hmax=h(i,j) |
---|
202 | if (s(i,j).gt.smax) smax=s(i,j) |
---|
203 | bmean=bm(i,j)+bmean |
---|
204 | accmean=acc(i,j)+accmean |
---|
205 | tbmean=tbmean+t(i,j,nz) |
---|
206 | tbdotmean=tbdotmean+tbdot(i,j) |
---|
207 | vsmean=vsmean+sqrt(ux(i,j,1)**2+uy(i,j,1)**2) |
---|
208 | uzsdotmean=uzsdotmean+uzsdot(i,j) |
---|
209 | uzkmean=uzkmean+uzk(i,j) |
---|
210 | hdotmean=hdotmean+abs(hdot(i,j)) |
---|
211 | bdotmean=bdotmean+abs(bdot(i,j)) |
---|
212 | bmeltmean=bmeltmean+bmelt(i,j) |
---|
213 | endif |
---|
214 | calvmean=calvmean+calv(i,j) |
---|
215 | ablbordmean=ablbordmean+ablbord(i,j) |
---|
216 | end do |
---|
217 | end do |
---|
218 | |
---|
219 | |
---|
220 | if (np.ne.0) then |
---|
221 | hmean=vol/np |
---|
222 | vol=vol*dx*dy |
---|
223 | volf=volf*dx*dy |
---|
224 | bmean=bmean/np |
---|
225 | accmean=accmean/np |
---|
226 | ablmean=bmean-accmean |
---|
227 | calvmean=calvmean/np |
---|
228 | bmeltmean=bmeltmean/np |
---|
229 | ablbordmean=ablbordmean/np |
---|
230 | tbmean=tbmean/np |
---|
231 | tbdotmean=tbdotmean/np |
---|
232 | vsmean=vsmean/np |
---|
233 | ! vsdotmean=vsdotmean/np |
---|
234 | ! uzsmean=uzsmean/np |
---|
235 | uzsdotmean=uzsdotmean/np |
---|
236 | uzkmean=uzkmean/np |
---|
237 | hdotmean=hdotmean/np |
---|
238 | endif |
---|
239 | |
---|
240 | bdotmean=bdotmean/nx/ny |
---|
241 | |
---|
242 | |
---|
243 | ! 2_writing outputs |
---|
244 | !------------------ |
---|
245 | ! **** short display **** |
---|
246 | |
---|
247 | write(num_ritz,903) nt,time,tafor,sealevel,vol,volf,np, & |
---|
248 | nint(hmean),nint(smax), & |
---|
249 | bmean,tbmean,nint(vsmean), & |
---|
250 | ! tbdotmean,vsdotmean,hdotmean,bdotmean, & |
---|
251 | ! tbdotmean,hdotmean,dt,bmeltmean,accmean |
---|
252 | |
---|
253 | tbdotmean,hdotmean,dt,bmelt(3,3),accmean |
---|
254 | |
---|
255 | |
---|
256 | 903 format(i8,1x,f0.2,1x,f0.4,1x,f0.2,1x,2(e15.8,1x),i0,1x,i0,1x,i0,1x, & |
---|
257 | f0.4,1x,f0.3,1x,i0,4(1x,e11.4),1x,f0.4,1x,f0.4) |
---|
258 | !940 format('%%%% ',a,' time=',f8.0,' %%%%') |
---|
259 | |
---|
260 | |
---|
261 | call output_regions |
---|
262 | |
---|
263 | |
---|
264 | end subroutine shortoutput |
---|
265 | |
---|
266 | !---------------------------------------------------------------------------- |
---|
267 | subroutine output_regions |
---|
268 | |
---|
269 | implicit none |
---|
270 | character(len=100) :: fmt1,fmt2,fmt3 |
---|
271 | character(len=2) :: string_region |
---|
272 | if (itracebug.eq.1) call tracebug('output_antarcti_mod subroutine output_regions') |
---|
273 | |
---|
274 | |
---|
275 | region: do i_region = 1, nbregions |
---|
276 | |
---|
277 | ! initialisation |
---|
278 | scal_vol = 0. |
---|
279 | scal_volbuoy = 0. |
---|
280 | scal_meanhdot = 0. |
---|
281 | scal_sigma_hdot = 0. |
---|
282 | scal_np = 0 |
---|
283 | |
---|
284 | do i=1,nx |
---|
285 | do j=1,ny |
---|
286 | ! write(165,*) i_region,i,j,mask_region(i,j),flot(i,j) |
---|
287 | if ((mask_region(i,j).eq.i_region).and.(.not.flot(i,j))) then |
---|
288 | |
---|
289 | scal_np = scal_np + 1 |
---|
290 | scal_vol = scal_vol + H(i,j) |
---|
291 | scal_volbuoy = scal_volbuoy + H(i,j) - row/ro * max(0.,sealevel_2d(i,j)-b(i,j)) |
---|
292 | scal_meanhdot = scal_meanhdot + Hdot(i,j) |
---|
293 | scal_sigma_hdot = scal_sigma_hdot + Hdot(i,j)**2 |
---|
294 | end if |
---|
295 | end do |
---|
296 | end do |
---|
297 | |
---|
298 | np_reg (i_region) = scal_np |
---|
299 | vol_reg(i_region) = scal_vol*dx*dx |
---|
300 | volbuoy_reg(i_region) = scal_volbuoy*dx*dx |
---|
301 | |
---|
302 | if (scal_np.ne.0) then |
---|
303 | meanhdot_reg(i_region) = scal_meanhdot/scal_np |
---|
304 | sigma_hdot_reg(i_region) = (scal_sigma_hdot/scal_np)**0.5 |
---|
305 | else |
---|
306 | write(6,*) 'region',i_region,' n a aucun point grounded' |
---|
307 | end if |
---|
308 | end do region |
---|
309 | |
---|
310 | |
---|
311 | ! ecriture dans les fichiers |
---|
312 | write(string_region,"(i0)") nbregions+1 |
---|
313 | fmt1 = '(f10.1,4x,'//string_region//'(es17.10,1x))' |
---|
314 | fmt2 = '(f10.1,4x,'//string_region//'(i8,1x))' |
---|
315 | |
---|
316 | write(string_region,"(i0)") nbregions |
---|
317 | fmt3 = '(f10.1,4x,'//string_region//'(es15.8,1x))' |
---|
318 | ! write(6,*) fmt1 |
---|
319 | ! write(6,*) fmt2 |
---|
320 | |
---|
321 | |
---|
322 | write(nvol,fmt1) time, sum(vol_reg(1:nbregions)), & |
---|
323 | (vol_reg(i_region) , i_region = 1,nbregions) |
---|
324 | write(nvolbuoy,fmt1) time, sum(volbuoy_reg(1:nbregions)), & |
---|
325 | (volbuoy_reg(i_region) , i_region = 1,nbregions) |
---|
326 | write(nhdot,fmt1) time, sum(meanhdot_reg(1:nbregions)), & |
---|
327 | (meanhdot_reg(i_region) , i_region = 1,nbregions) |
---|
328 | write(npoints,fmt2) time, sum(np_reg(1:nbregions)), & |
---|
329 | (np_reg(i_region) , i_region = 1,nbregions) |
---|
330 | |
---|
331 | write(nsigma_hdot,fmt3) time, (sigma_hdot_reg(i_region), i_region = 1,nbregions) |
---|
332 | |
---|
333 | |
---|
334 | end subroutine output_regions |
---|
335 | |
---|
336 | end module output_antarcti_mod |
---|