1 | C====================================================================== |
---|
2 | PROGRAM newstart |
---|
3 | c======================================================================= |
---|
4 | c |
---|
5 | c |
---|
6 | c Auteur: Christophe Hourdin/Francois Forget/Yann Wanherdrick |
---|
7 | c ------ |
---|
8 | c Derniere modif : 12/03 |
---|
9 | c |
---|
10 | c |
---|
11 | c Objet: Create or modify the initial state for the LMD Mars GCM |
---|
12 | c ----- (fichiers NetCDF start et startfi) |
---|
13 | c |
---|
14 | c |
---|
15 | c======================================================================= |
---|
16 | |
---|
17 | use ioipsl_getincom, only: getin |
---|
18 | use infotrac, only: iniadvtrac, nqtot, tname |
---|
19 | use tracer_mod, only: noms, mmol, |
---|
20 | & igcm_dust_number, igcm_dust_mass, |
---|
21 | & igcm_ccn_number, igcm_ccn_mass, |
---|
22 | & igcm_h2o_vap, igcm_h2o_ice, igcm_co2, |
---|
23 | & igcm_n2, igcm_ar, igcm_o2, igcm_co |
---|
24 | use surfdat_h, only: phisfi, z0, zmea, zstd, zsig, zgam, zthe, |
---|
25 | & albedodat, z0_default, qsurf, tsurf, |
---|
26 | & co2ice, emis |
---|
27 | use comsoil_h, only: inertiedat, layer, mlayer, nsoilmx, tsoil |
---|
28 | use control_mod, only: day_step, iphysiq, anneeref |
---|
29 | use phyredem, only: physdem0, physdem1 |
---|
30 | use iostart, only: open_startphy |
---|
31 | use comgeomphy, only: initcomgeomphy |
---|
32 | ! use planete_h |
---|
33 | use dimradmars_mod, only: tauscaling |
---|
34 | use turb_mod, only: q2 |
---|
35 | use comgeomfi_h, only: ini_fillgeom |
---|
36 | use filtreg_mod, only: inifilr |
---|
37 | |
---|
38 | implicit none |
---|
39 | |
---|
40 | #include "dimensions.h" |
---|
41 | integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm) |
---|
42 | #include "paramet.h" |
---|
43 | #include "comconst.h" |
---|
44 | #include "comvert.h" |
---|
45 | #include "comgeom2.h" |
---|
46 | #include "logic.h" |
---|
47 | #include "description.h" |
---|
48 | #include "ener.h" |
---|
49 | #include "temps.h" |
---|
50 | #include "comdissnew.h" |
---|
51 | #include "clesph0.h" |
---|
52 | #include "serre.h" |
---|
53 | #include "netcdf.inc" |
---|
54 | #include "datafile.h" |
---|
55 | c======================================================================= |
---|
56 | c Declarations |
---|
57 | c======================================================================= |
---|
58 | |
---|
59 | c Variables dimension du fichier "start_archive" |
---|
60 | c------------------------------------ |
---|
61 | CHARACTER relief*3 |
---|
62 | |
---|
63 | c et autres: |
---|
64 | c---------- |
---|
65 | |
---|
66 | c Variables pour les lectures NetCDF des fichiers "start_archive" |
---|
67 | c-------------------------------------------------- |
---|
68 | INTEGER nid_dyn, nid_fi,nid,nvarid |
---|
69 | INTEGER tab0 |
---|
70 | |
---|
71 | REAL date |
---|
72 | REAL p_rad,p_omeg,p_g,p_mugaz,p_daysec |
---|
73 | |
---|
74 | c Variable histoire |
---|
75 | c------------------ |
---|
76 | REAL vcov(iip1,jjm,llm),ucov(iip1,jjp1,llm) ! vents covariants |
---|
77 | REAL phis(iip1,jjp1) |
---|
78 | REAL,ALLOCATABLE :: q(:,:,:,:) ! champs advectes |
---|
79 | |
---|
80 | c autre variables dynamique nouvelle grille |
---|
81 | c------------------------------------------ |
---|
82 | REAL pks(iip1,jjp1) |
---|
83 | REAL w(iip1,jjp1,llm+1) |
---|
84 | REAL pbaru(ip1jmp1,llm),pbarv(ip1jm,llm) |
---|
85 | ! REAL dv(ip1jm,llm),du(ip1jmp1,llm) |
---|
86 | ! REAL dh(ip1jmp1,llm),dp(ip1jmp1) |
---|
87 | REAL phi(iip1,jjp1,llm) |
---|
88 | |
---|
89 | integer klatdat,klongdat |
---|
90 | PARAMETER (klatdat=180,klongdat=360) |
---|
91 | |
---|
92 | c Physique sur grille scalaire |
---|
93 | c---------------------------- |
---|
94 | real zmeaS(iip1,jjp1),zstdS(iip1,jjp1) |
---|
95 | real zsigS(iip1,jjp1),zgamS(iip1,jjp1),ztheS(iip1,jjp1) |
---|
96 | real z0S(iip1,jjp1) |
---|
97 | |
---|
98 | c variable physique |
---|
99 | c------------------ |
---|
100 | REAL tauscadyn(iip1,jjp1) ! dust conversion factor on the dynamics grid |
---|
101 | real alb(iip1,jjp1),albfi(ngridmx) ! albedos |
---|
102 | real ith(iip1,jjp1,nsoilmx),ithfi(ngridmx,nsoilmx) ! thermal inertia (3D) |
---|
103 | real surfith(iip1,jjp1),surfithfi(ngridmx) ! surface thermal inertia (2D) |
---|
104 | REAL latfi(ngridmx),lonfi(ngridmx),airefi(ngridmx) |
---|
105 | |
---|
106 | INTEGER i,j,l,isoil,ig,idum |
---|
107 | real mugaz ! molar mass of the atmosphere |
---|
108 | |
---|
109 | integer ierr !, nbetat |
---|
110 | |
---|
111 | c Variables on the new grid along scalar points |
---|
112 | c------------------------------------------------------ |
---|
113 | ! REAL p(iip1,jjp1) |
---|
114 | REAL t(iip1,jjp1,llm) |
---|
115 | real phisold_newgrid(iip1,jjp1) |
---|
116 | REAL :: teta(iip1, jjp1, llm) |
---|
117 | REAL :: pk(iip1,jjp1,llm) |
---|
118 | REAL :: pkf(iip1,jjp1,llm) |
---|
119 | REAL :: ps(iip1, jjp1) |
---|
120 | REAL :: masse(iip1,jjp1,llm) |
---|
121 | REAL :: xpn,xps,xppn(iim),xpps(iim) |
---|
122 | REAL :: p3d(iip1, jjp1, llm+1) |
---|
123 | REAL :: beta(iip1,jjp1,llm) |
---|
124 | ! REAL dteta(ip1jmp1,llm) |
---|
125 | |
---|
126 | c Variable de l'ancienne grille |
---|
127 | c------------------------------ |
---|
128 | real time |
---|
129 | real tab_cntrl(100) |
---|
130 | real tab_cntrl_bis(100) |
---|
131 | |
---|
132 | c variables diverses |
---|
133 | c------------------- |
---|
134 | real choix_1 ! ==0 : read start_archive file ; ==1: read start files |
---|
135 | character*80 fichnom |
---|
136 | integer Lmodif,iq |
---|
137 | integer flagthermo, flagh2o |
---|
138 | character modif*20 |
---|
139 | real tsud,albsud,alb_bb,ith_bb,Tiso |
---|
140 | real ptoto,pcap,patm,airetot,ptotn,patmn |
---|
141 | ! real ssum |
---|
142 | character*1 yes |
---|
143 | logical :: flagiso=.false. , flagps0=.false. |
---|
144 | real val, val2, val3 ! to store temporary variables |
---|
145 | real :: iceith=2000 ! thermal inertia of subterranean ice |
---|
146 | real :: iceithN,iceithS ! values of thermal inertias in N & S hemispheres |
---|
147 | integer iref,jref |
---|
148 | |
---|
149 | INTEGER :: itau |
---|
150 | |
---|
151 | INTEGER :: numvanle |
---|
152 | character(len=50) :: txt ! to store some text |
---|
153 | integer :: count |
---|
154 | real :: profile(llm+1) ! to store an atmospheric profile + surface value |
---|
155 | |
---|
156 | ! MONS data: |
---|
157 | real :: MONS_Hdn(iip1,jjp1) ! Hdn: %WEH=Mass fraction of H2O |
---|
158 | real :: MONS_d21(iip1,jjp1) ! ice table "depth" (in kg/m2) |
---|
159 | ! coefficient to apply to convert d21 to 'true' depth (m) |
---|
160 | real :: MONS_coeff |
---|
161 | real :: MONS_coeffS ! coeff for southern hemisphere |
---|
162 | real :: MONS_coeffN ! coeff for northern hemisphere |
---|
163 | ! real,parameter :: icedepthmin=1.e-3 ! Ice begins at most at that depth |
---|
164 | ! Reference position for composition |
---|
165 | real :: latref,lonref,dlatmin,dlonmin |
---|
166 | ! Variable used to change composition |
---|
167 | real :: Svmr,Smmr,Smmr_old,Smmr_new,Sn |
---|
168 | real :: Mair_old,Mair_new,vmr_old,vmr_new |
---|
169 | real,allocatable :: coefvmr(:) ! Correction coefficient when changing composition |
---|
170 | integer :: iloc(1), iqmax |
---|
171 | |
---|
172 | c sortie visu pour les champs dynamiques |
---|
173 | c--------------------------------------- |
---|
174 | ! INTEGER :: visuid |
---|
175 | ! real :: time_step,t_ops,t_wrt |
---|
176 | ! CHARACTER*80 :: visu_file |
---|
177 | |
---|
178 | cpp = 744.499 ! for Mars, instead of 1004.70885 (Earth) |
---|
179 | preff = 610. ! for Mars, instead of 101325. (Earth) |
---|
180 | pa= 20 ! for Mars, instead of 500 (Earth) |
---|
181 | |
---|
182 | ! initialize "serial/parallel" related stuff |
---|
183 | CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) |
---|
184 | call initcomgeomphy |
---|
185 | |
---|
186 | ! Load tracer number and names: |
---|
187 | call iniadvtrac(nqtot,numvanle) |
---|
188 | ! allocate arrays |
---|
189 | allocate(q(iip1,jjp1,llm,nqtot)) |
---|
190 | allocate(coefvmr(nqtot)) |
---|
191 | |
---|
192 | c======================================================================= |
---|
193 | c Choice of the start file(s) to use |
---|
194 | c======================================================================= |
---|
195 | |
---|
196 | write(*,*) 'From which kind of files do you want to create new', |
---|
197 | . 'start and startfi files' |
---|
198 | write(*,*) ' 0 - from a file start_archive' |
---|
199 | write(*,*) ' 1 - from files start and startfi' |
---|
200 | |
---|
201 | c----------------------------------------------------------------------- |
---|
202 | c Open file(s) to modify (start or start_archive) |
---|
203 | c----------------------------------------------------------------------- |
---|
204 | |
---|
205 | DO |
---|
206 | read(*,*,iostat=ierr) choix_1 |
---|
207 | if ((choix_1 /= 0).OR.(choix_1 /=1)) EXIT |
---|
208 | ENDDO |
---|
209 | |
---|
210 | c Open start_archive |
---|
211 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
212 | if (choix_1.eq.0) then |
---|
213 | |
---|
214 | write(*,*) 'Creating start files from:' |
---|
215 | write(*,*) './start_archive.nc' |
---|
216 | write(*,*) |
---|
217 | fichnom = 'start_archive.nc' |
---|
218 | ierr = NF_OPEN (fichnom, NF_NOWRITE,nid) |
---|
219 | IF (ierr.NE.NF_NOERR) THEN |
---|
220 | write(6,*)' Problem opening file:',fichnom |
---|
221 | write(6,*)' ierr = ', ierr |
---|
222 | CALL ABORT |
---|
223 | ENDIF |
---|
224 | tab0 = 50 |
---|
225 | Lmodif = 1 |
---|
226 | |
---|
227 | c OR open start and startfi files |
---|
228 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
229 | else |
---|
230 | write(*,*) 'Creating start files from:' |
---|
231 | write(*,*) './start.nc and ./startfi.nc' |
---|
232 | write(*,*) |
---|
233 | fichnom = 'start.nc' |
---|
234 | ierr = NF_OPEN (fichnom, NF_NOWRITE,nid_dyn) |
---|
235 | IF (ierr.NE.NF_NOERR) THEN |
---|
236 | write(6,*)' Problem opening file:',fichnom |
---|
237 | write(6,*)' ierr = ', ierr |
---|
238 | CALL ABORT |
---|
239 | ENDIF |
---|
240 | |
---|
241 | fichnom = 'startfi.nc' |
---|
242 | ierr = NF_OPEN (fichnom, NF_NOWRITE,nid_fi) |
---|
243 | IF (ierr.NE.NF_NOERR) THEN |
---|
244 | write(6,*)' Problem opening file:',fichnom |
---|
245 | write(6,*)' ierr = ', ierr |
---|
246 | CALL ABORT |
---|
247 | ENDIF |
---|
248 | |
---|
249 | tab0 = 0 |
---|
250 | Lmodif = 0 |
---|
251 | |
---|
252 | endif |
---|
253 | |
---|
254 | c----------------------------------------------------------------------- |
---|
255 | c Lecture du tableau des parametres du run (pour la dynamique) |
---|
256 | c----------------------------------------------------------------------- |
---|
257 | |
---|
258 | if (choix_1.eq.0) then |
---|
259 | |
---|
260 | write(*,*) 'reading tab_cntrl START_ARCHIVE' |
---|
261 | c |
---|
262 | ierr = NF_INQ_VARID (nid, "controle", nvarid) |
---|
263 | #ifdef NC_DOUBLE |
---|
264 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) |
---|
265 | #else |
---|
266 | ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) |
---|
267 | #endif |
---|
268 | c |
---|
269 | else if (choix_1.eq.1) then |
---|
270 | |
---|
271 | write(*,*) 'reading tab_cntrl START' |
---|
272 | c |
---|
273 | ierr = NF_INQ_VARID (nid_dyn, "controle", nvarid) |
---|
274 | #ifdef NC_DOUBLE |
---|
275 | ierr = NF_GET_VAR_DOUBLE(nid_dyn, nvarid, tab_cntrl) |
---|
276 | #else |
---|
277 | ierr = NF_GET_VAR_REAL(nid_dyn, nvarid, tab_cntrl) |
---|
278 | #endif |
---|
279 | c |
---|
280 | write(*,*) 'reading tab_cntrl STARTFI' |
---|
281 | c |
---|
282 | ierr = NF_INQ_VARID (nid_fi, "controle", nvarid) |
---|
283 | #ifdef NC_DOUBLE |
---|
284 | ierr = NF_GET_VAR_DOUBLE(nid_fi, nvarid, tab_cntrl_bis) |
---|
285 | #else |
---|
286 | ierr = NF_GET_VAR_REAL(nid_fi, nvarid, tab_cntrl_bis) |
---|
287 | #endif |
---|
288 | c |
---|
289 | do i=1,50 |
---|
290 | tab_cntrl(i+50)=tab_cntrl_bis(i) |
---|
291 | enddo |
---|
292 | write(*,*) 'printing tab_cntrl', tab_cntrl |
---|
293 | do i=1,100 |
---|
294 | write(*,*) i,tab_cntrl(i) |
---|
295 | enddo |
---|
296 | |
---|
297 | endif |
---|
298 | c----------------------------------------------------------------------- |
---|
299 | c Initialisation des constantes dynamique |
---|
300 | c----------------------------------------------------------------------- |
---|
301 | |
---|
302 | kappa = tab_cntrl(9) |
---|
303 | etot0 = tab_cntrl(12) |
---|
304 | ptot0 = tab_cntrl(13) |
---|
305 | ztot0 = tab_cntrl(14) |
---|
306 | stot0 = tab_cntrl(15) |
---|
307 | ang0 = tab_cntrl(16) |
---|
308 | write(*,*) "Newstart: kappa,etot0,ptot0,ztot0,stot0,ang0" |
---|
309 | write(*,*) kappa,etot0,ptot0,ztot0,stot0,ang0 |
---|
310 | |
---|
311 | c----------------------------------------------------------------------- |
---|
312 | c Lecture du tab_cntrl et initialisation des constantes physiques |
---|
313 | c - pour start: Lmodif = 0 => pas de modifications possibles |
---|
314 | c (modif dans le tabfi de readfi + loin) |
---|
315 | c - pour start_archive: Lmodif = 1 => modifications possibles |
---|
316 | c----------------------------------------------------------------------- |
---|
317 | if (choix_1.eq.0) then |
---|
318 | ! tabfi requires that input file be first opened by open_startphy(fichnom) |
---|
319 | fichnom = 'start_archive.nc' |
---|
320 | call open_startphy(fichnom) |
---|
321 | call tabfi (nid,Lmodif,tab0,day_ini,lllm,p_rad, |
---|
322 | . p_omeg,p_g,p_mugaz,p_daysec,time) |
---|
323 | else if (choix_1.eq.1) then |
---|
324 | fichnom = 'startfi.nc' |
---|
325 | call open_startphy(fichnom) |
---|
326 | call tabfi (nid_fi,Lmodif,tab0,day_ini,lllm,p_rad, |
---|
327 | . p_omeg,p_g,p_mugaz,p_daysec,time) |
---|
328 | endif |
---|
329 | |
---|
330 | rad = p_rad |
---|
331 | omeg = p_omeg |
---|
332 | g = p_g |
---|
333 | mugaz = p_mugaz |
---|
334 | daysec = p_daysec |
---|
335 | ! write(*,*) 'aire',aire |
---|
336 | |
---|
337 | |
---|
338 | c======================================================================= |
---|
339 | c INITIALISATIONS DIVERSES |
---|
340 | c======================================================================= |
---|
341 | |
---|
342 | day_step=180 !?! Note: day_step is a common in "control.h" |
---|
343 | CALL defrun_new( 99, .TRUE. ) |
---|
344 | CALL iniconst |
---|
345 | CALL inigeom |
---|
346 | idum=-1 |
---|
347 | idum=0 |
---|
348 | |
---|
349 | c Initialisation coordonnees /aires |
---|
350 | c ------------------------------- |
---|
351 | ! Note: rlatu(:) and rlonv(:) are commons defined in "comgeom.h" |
---|
352 | ! rlatu() and rlonv() are given in radians |
---|
353 | latfi(1)=rlatu(1) |
---|
354 | lonfi(1)=0. |
---|
355 | DO j=2,jjm |
---|
356 | DO i=1,iim |
---|
357 | latfi((j-2)*iim+1+i)=rlatu(j) |
---|
358 | lonfi((j-2)*iim+1+i)=rlonv(i) |
---|
359 | ENDDO |
---|
360 | ENDDO |
---|
361 | latfi(ngridmx)=rlatu(jjp1) |
---|
362 | lonfi(ngridmx)=0. |
---|
363 | |
---|
364 | ! build airefi(), mesh area on physics grid |
---|
365 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi) |
---|
366 | ! Poles are single points on physics grid |
---|
367 | airefi(1)=sum(aire(1:iim,1)) |
---|
368 | airefi(ngridmx)=sum(aire(1:iim,jjm+1)) |
---|
369 | |
---|
370 | ! also initialize various physics flags/settings which might be needed |
---|
371 | ! (for instance initracer needs to know about some flags, and/or |
---|
372 | ! 'datafile' path may be changed by user) |
---|
373 | call phys_state_var_init(ngridmx,llm,nqtot, |
---|
374 | . daysec,dtphys,rad,g,r,cpp) |
---|
375 | call ini_fillgeom(ngridmx,latfi,lonfi,airefi) |
---|
376 | call conf_phys(ngridmx,llm,nqtot) |
---|
377 | |
---|
378 | c======================================================================= |
---|
379 | c lecture topographie, albedo, inertie thermique, relief sous-maille |
---|
380 | c======================================================================= |
---|
381 | |
---|
382 | if (choix_1.ne.1) then ! pour ne pas avoir besoin du fichier |
---|
383 | ! surface.dat dans le cas des start |
---|
384 | |
---|
385 | c do while((relief(1:3).ne.'mol').AND.(relief(1:3).ne.'pla')) |
---|
386 | c write(*,*) |
---|
387 | c write(*,*) 'choix du relief (mola,pla)' |
---|
388 | c write(*,*) '(Topographie MGS MOLA, plat)' |
---|
389 | c read(*,fmt='(a3)') relief |
---|
390 | relief="mola" |
---|
391 | c enddo |
---|
392 | |
---|
393 | CALL datareadnc(relief,phis,alb,surfith,z0S, |
---|
394 | & zmeaS,zstdS,zsigS,zgamS,ztheS) |
---|
395 | |
---|
396 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi) |
---|
397 | ! CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,ith,ithfi) |
---|
398 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,surfith,surfithfi) |
---|
399 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) |
---|
400 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,z0S,z0) |
---|
401 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zmeaS,zmea) |
---|
402 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zstdS,zstd) |
---|
403 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zsigS,zsig) |
---|
404 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,zgamS,zgam) |
---|
405 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,ztheS,zthe) |
---|
406 | |
---|
407 | endif ! of if (choix_1.ne.1) |
---|
408 | |
---|
409 | |
---|
410 | c======================================================================= |
---|
411 | c Lecture des fichiers (start ou start_archive) |
---|
412 | c======================================================================= |
---|
413 | |
---|
414 | if (choix_1.eq.0) then |
---|
415 | |
---|
416 | write(*,*) 'Reading file START_ARCHIVE' |
---|
417 | CALL lect_start_archive(ngridmx,llm,nqtot, |
---|
418 | & date,tsurf,tsoil,emis,q2, |
---|
419 | & t,ucov,vcov,ps,co2ice,teta,phisold_newgrid,q,qsurf, |
---|
420 | & tauscaling,surfith,nid) |
---|
421 | write(*,*) "OK, read start_archive file" |
---|
422 | ! copy soil thermal inertia |
---|
423 | ithfi(:,:)=inertiedat(:,:) |
---|
424 | |
---|
425 | ierr= NF_CLOSE(nid) |
---|
426 | |
---|
427 | else if (choix_1.eq.1) then ! c'est l'appel a tabfi de phyeta0 qui |
---|
428 | ! permet de changer les valeurs du |
---|
429 | ! tab_cntrl Lmodif=1 |
---|
430 | tab0=0 |
---|
431 | Lmodif=1 ! Lmodif set to 1 to allow modifications in phyeta0 |
---|
432 | write(*,*) 'Reading file START' |
---|
433 | fichnom = 'start.nc' |
---|
434 | CALL dynetat0(fichnom,nqtot,vcov,ucov,teta,q,masse, |
---|
435 | . ps,phis,time) |
---|
436 | |
---|
437 | write(*,*) 'Reading file STARTFI' |
---|
438 | fichnom = 'startfi.nc' |
---|
439 | CALL phyetat0 (fichnom,tab0,Lmodif,nsoilmx,ngridmx,llm,nqtot, |
---|
440 | . day_ini,time, |
---|
441 | . tsurf,tsoil,emis,q2,qsurf,co2ice,tauscaling) |
---|
442 | |
---|
443 | ! copy albedo and soil thermal inertia |
---|
444 | do i=1,ngridmx |
---|
445 | albfi(i) = albedodat(i) |
---|
446 | do j=1,nsoilmx |
---|
447 | ithfi(i,j) = inertiedat(i,j) |
---|
448 | enddo |
---|
449 | ! build a surfithfi(:) using 1st layer of ithfi(:), which might |
---|
450 | ! be neede later on if reinitializing soil thermal inertia |
---|
451 | surfithfi(i)=ithfi(i,1) |
---|
452 | enddo |
---|
453 | |
---|
454 | else |
---|
455 | CALL exit(1) |
---|
456 | endif |
---|
457 | |
---|
458 | dtvr = daysec/REAL(day_step) |
---|
459 | dtphys = dtvr * REAL(iphysiq) |
---|
460 | |
---|
461 | c======================================================================= |
---|
462 | c |
---|
463 | c======================================================================= |
---|
464 | ! If tracer names follow 'old' convention (q01, q02, ...) then |
---|
465 | ! rename them |
---|
466 | count=0 |
---|
467 | do iq=1,nqtot |
---|
468 | txt=" " |
---|
469 | write(txt,'(a1,i2.2)') 'q',iq |
---|
470 | if (txt.eq.tname(iq)) then |
---|
471 | count=count+1 |
---|
472 | endif |
---|
473 | enddo ! of do iq=1,nqtot |
---|
474 | |
---|
475 | ! initialize tracer names noms(:) and indexes (igcm_co2, igcm_h2o_vap, ...) |
---|
476 | call initracer(ngridmx,nqtot,qsurf) |
---|
477 | |
---|
478 | if (count.eq.nqtot) then |
---|
479 | write(*,*) 'Newstart: updating tracer names' |
---|
480 | ! copy noms(:) to tname(:) to have matching tracer names in physics |
---|
481 | ! and dynamics |
---|
482 | tname(1:nqtot)=noms(1:nqtot) |
---|
483 | endif |
---|
484 | |
---|
485 | c======================================================================= |
---|
486 | c |
---|
487 | c======================================================================= |
---|
488 | |
---|
489 | do ! infinite loop on list of changes |
---|
490 | |
---|
491 | write(*,*) |
---|
492 | write(*,*) |
---|
493 | write(*,*) 'List of possible changes :' |
---|
494 | write(*,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~' |
---|
495 | write(*,*) |
---|
496 | write(*,*) 'flat : no topography ("aquaplanet")' |
---|
497 | write(*,*) 'bilball : uniform albedo and thermal inertia' |
---|
498 | write(*,*) 'z0 : set a uniform surface roughness length' |
---|
499 | write(*,*) 'coldspole : cold subsurface and high albedo at |
---|
500 | $ S.Pole' |
---|
501 | write(*,*) 'qname : change tracer name' |
---|
502 | write(*,*) 'q=0 : ALL tracer =zero' |
---|
503 | write(*,*) 'q=x : give a specific uniform value to one |
---|
504 | $ tracer' |
---|
505 | write(*,*) 'q=profile : specify a profile for a tracer' |
---|
506 | write(*,*) 'freedust : rescale dust to a true value' |
---|
507 | write(*,*) 'ini_q : tracers initialization for chemistry |
---|
508 | $ and water vapour' |
---|
509 | write(*,*) 'ini_q-h2o : tracers initialization for chemistry |
---|
510 | $ only' |
---|
511 | write(*,*) 'composition : change atm main composition: CO2,N2,Ar, |
---|
512 | $ O2,CO' |
---|
513 | write(*,*) 'ini_h2osurf : reinitialize surface water ice ' |
---|
514 | write(*,*) 'noglacier : Remove tropical H2O ice if |lat|<45' |
---|
515 | write(*,*) 'watercapn : H20 ice on permanent N polar cap ' |
---|
516 | write(*,*) 'watercaps : H20 ice on permanent S polar cap ' |
---|
517 | write(*,*) 'wetstart : start with a wet atmosphere' |
---|
518 | write(*,*) 'isotherm : Isothermal Temperatures, wind set to |
---|
519 | $ zero' |
---|
520 | write(*,*) 'co2ice=0 : remove CO2 polar cap' |
---|
521 | write(*,*) 'ptot : change total pressure' |
---|
522 | write(*,*) 'therm_ini_s : set soil thermal inertia to reference |
---|
523 | $ surface values' |
---|
524 | write(*,*) 'subsoilice_n : put deep underground ice layer in |
---|
525 | $ northern hemisphere' |
---|
526 | write(*,*) 'subsoilice_s : put deep underground ice layer in |
---|
527 | $ southern hemisphere' |
---|
528 | write(*,*) 'mons_ice : put underground ice layer according |
---|
529 | $ to MONS derived data' |
---|
530 | |
---|
531 | write(*,*) |
---|
532 | write(*,*) 'Change to perform ?' |
---|
533 | write(*,*) ' (enter keyword or return to end)' |
---|
534 | write(*,*) |
---|
535 | |
---|
536 | read(*,fmt='(a20)') modif |
---|
537 | if (modif(1:1) .eq. ' ') exit ! exit loop on changes |
---|
538 | |
---|
539 | write(*,*) |
---|
540 | write(*,*) trim(modif) , ' : ' |
---|
541 | |
---|
542 | c 'flat : no topography ("aquaplanet")' |
---|
543 | c ------------------------------------- |
---|
544 | if (trim(modif) .eq. 'flat') then |
---|
545 | c set topo to zero |
---|
546 | phis(:,:)=0 |
---|
547 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi) |
---|
548 | write(*,*) 'topography set to zero.' |
---|
549 | write(*,*) 'WARNING : the subgrid topography parameters', |
---|
550 | & ' were not set to zero ! => set calllott to F' |
---|
551 | |
---|
552 | c Choice for surface pressure |
---|
553 | yes=' ' |
---|
554 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
---|
555 | write(*,*) 'Do you wish to choose homogeneous surface', |
---|
556 | & 'pressure (y) or let newstart interpolate ', |
---|
557 | & ' the previous field (n)?' |
---|
558 | read(*,fmt='(a)') yes |
---|
559 | end do |
---|
560 | if (yes.eq.'y') then |
---|
561 | flagps0=.true. |
---|
562 | write(*,*) 'New value for ps (Pa) ?' |
---|
563 | 201 read(*,*,iostat=ierr) patm |
---|
564 | if(ierr.ne.0) goto 201 |
---|
565 | write(*,*) |
---|
566 | write(*,*) ' new ps everywhere (Pa) = ', patm |
---|
567 | write(*,*) |
---|
568 | do j=1,jjp1 |
---|
569 | do i=1,iip1 |
---|
570 | ps(i,j)=patm |
---|
571 | enddo |
---|
572 | enddo |
---|
573 | end if |
---|
574 | |
---|
575 | c bilball : albedo, inertie thermique uniforme |
---|
576 | c -------------------------------------------- |
---|
577 | else if (trim(modif) .eq. 'bilball') then |
---|
578 | write(*,*) 'constante albedo and iner.therm:' |
---|
579 | write(*,*) 'New value for albedo (ex: 0.25) ?' |
---|
580 | 101 read(*,*,iostat=ierr) alb_bb |
---|
581 | if(ierr.ne.0) goto 101 |
---|
582 | write(*,*) |
---|
583 | write(*,*) ' uniform albedo (new value):',alb_bb |
---|
584 | write(*,*) |
---|
585 | |
---|
586 | write(*,*) 'New value for thermal inertia (eg: 247) ?' |
---|
587 | 102 read(*,*,iostat=ierr) ith_bb |
---|
588 | if(ierr.ne.0) goto 102 |
---|
589 | write(*,*) 'uniform thermal inertia (new value):',ith_bb |
---|
590 | DO j=1,jjp1 |
---|
591 | DO i=1,iip1 |
---|
592 | alb(i,j) = alb_bb ! albedo |
---|
593 | do isoil=1,nsoilmx |
---|
594 | ith(i,j,isoil) = ith_bb ! thermal inertia |
---|
595 | enddo |
---|
596 | END DO |
---|
597 | END DO |
---|
598 | ! CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,ith,ithfi) |
---|
599 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
---|
600 | CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) |
---|
601 | |
---|
602 | ! also reset surface roughness length to default value |
---|
603 | write(*,*) 'surface roughness length set to:',z0_default,' m' |
---|
604 | z0(:)=z0_default |
---|
605 | |
---|
606 | ! z0 : set surface roughness length to a constant value |
---|
607 | ! ----------------------------------------------------- |
---|
608 | else if (trim(modif) .eq. 'z0') then |
---|
609 | write(*,*) 'set a uniform surface roughness length' |
---|
610 | write(*,*) ' value for z0_default (ex: ',z0_default,')?' |
---|
611 | ierr=1 |
---|
612 | do while (ierr.ne.0) |
---|
613 | read(*,*,iostat=ierr) z0_default |
---|
614 | enddo |
---|
615 | z0(:)=z0_default |
---|
616 | |
---|
617 | c coldspole : sous-sol de la calotte sud toujours froid |
---|
618 | c ----------------------------------------------------- |
---|
619 | else if (trim(modif) .eq. 'coldspole') then |
---|
620 | write(*,*)'new value for the subsurface temperature', |
---|
621 | & ' beneath the permanent southern polar cap ? (eg: 141 K)' |
---|
622 | 103 read(*,*,iostat=ierr) tsud |
---|
623 | if(ierr.ne.0) goto 103 |
---|
624 | write(*,*) |
---|
625 | write(*,*) ' new value of the subsurface temperature:',tsud |
---|
626 | c nouvelle temperature sous la calotte permanente |
---|
627 | do l=2,nsoilmx |
---|
628 | tsoil(ngridmx,l) = tsud |
---|
629 | end do |
---|
630 | |
---|
631 | |
---|
632 | write(*,*)'new value for the albedo', |
---|
633 | & 'of the permanent southern polar cap ? (eg: 0.75)' |
---|
634 | 104 read(*,*,iostat=ierr) albsud |
---|
635 | if(ierr.ne.0) goto 104 |
---|
636 | write(*,*) |
---|
637 | |
---|
638 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
639 | c Option 1: only the albedo of the pole is modified : |
---|
640 | albfi(ngridmx)=albsud |
---|
641 | write(*,*) 'ig=',ngridmx,' albedo perennial cap ', |
---|
642 | & albfi(ngridmx) |
---|
643 | |
---|
644 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
645 | c Option 2 A haute resolution : coordonnee de la vrai calotte ~ |
---|
646 | c DO j=1,jjp1 |
---|
647 | c DO i=1,iip1 |
---|
648 | c ig=1+(j-2)*iim +i |
---|
649 | c if(j.eq.1) ig=1 |
---|
650 | c if(j.eq.jjp1) ig=ngridmx |
---|
651 | c if ((rlatu(j)*180./pi.lt.-84.).and. |
---|
652 | c & (rlatu(j)*180./pi.gt.-91.).and. |
---|
653 | c & (rlonv(i)*180./pi.gt.-91.).and. |
---|
654 | c & (rlonv(i)*180./pi.lt.0.)) then |
---|
655 | cc albedo de la calotte permanente fixe a albsud |
---|
656 | c alb(i,j)=albsud |
---|
657 | c write(*,*) 'lat=',rlatu(j)*180./pi, |
---|
658 | c & ' lon=',rlonv(i)*180./pi |
---|
659 | cc fin de la condition sur les limites de la calotte permanente |
---|
660 | c end if |
---|
661 | c ENDDO |
---|
662 | c ENDDO |
---|
663 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
664 | |
---|
665 | c CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) |
---|
666 | |
---|
667 | |
---|
668 | c ptot : Modification of the total pressure: ice + current atmosphere |
---|
669 | c ------------------------------------------------------------------- |
---|
670 | else if (trim(modif) .eq. 'ptot') then |
---|
671 | |
---|
672 | c calcul de la pression totale glace + atm actuelle |
---|
673 | patm=0. |
---|
674 | airetot=0. |
---|
675 | pcap=0. |
---|
676 | DO j=1,jjp1 |
---|
677 | DO i=1,iim |
---|
678 | ig=1+(j-2)*iim +i |
---|
679 | if(j.eq.1) ig=1 |
---|
680 | if(j.eq.jjp1) ig=ngridmx |
---|
681 | patm = patm + ps(i,j)*aire(i,j) |
---|
682 | airetot= airetot + aire(i,j) |
---|
683 | pcap = pcap + aire(i,j)*co2ice(ig)*g |
---|
684 | ENDDO |
---|
685 | ENDDO |
---|
686 | ptoto = pcap + patm |
---|
687 | |
---|
688 | print*,'Current total pressure at surface (co2 ice + atm) ', |
---|
689 | & ptoto/airetot |
---|
690 | |
---|
691 | print*,'new value?' |
---|
692 | read(*,*) ptotn |
---|
693 | ptotn=ptotn*airetot |
---|
694 | patmn=ptotn-pcap |
---|
695 | print*,'ptoto,patm,ptotn,patmn' |
---|
696 | print*,ptoto,patm,ptotn,patmn |
---|
697 | print*,'Mult. factor for pressure (atm only)', patmn/patm |
---|
698 | do j=1,jjp1 |
---|
699 | do i=1,iip1 |
---|
700 | ps(i,j)=ps(i,j)*patmn/patm |
---|
701 | enddo |
---|
702 | enddo |
---|
703 | |
---|
704 | c Correction pour la conservation des traceurs |
---|
705 | yes=' ' |
---|
706 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
---|
707 | write(*,*) 'Do you wish to conserve tracer total mass (y)', |
---|
708 | & ' or tracer mixing ratio (n) ?' |
---|
709 | read(*,fmt='(a)') yes |
---|
710 | end do |
---|
711 | |
---|
712 | if (yes.eq.'y') then |
---|
713 | write(*,*) 'OK : conservation of tracer total mass' |
---|
714 | DO iq =1, nqtot |
---|
715 | DO l=1,llm |
---|
716 | DO j=1,jjp1 |
---|
717 | DO i=1,iip1 |
---|
718 | q(i,j,l,iq)=q(i,j,l,iq)*patm/patmn |
---|
719 | ENDDO |
---|
720 | ENDDO |
---|
721 | ENDDO |
---|
722 | ENDDO |
---|
723 | else |
---|
724 | write(*,*) 'OK : conservation of tracer mixing ratio' |
---|
725 | end if |
---|
726 | |
---|
727 | c qname : change tracer name |
---|
728 | c -------------------------- |
---|
729 | else if (trim(modif).eq.'qname') then |
---|
730 | yes='y' |
---|
731 | do while (yes.eq.'y') |
---|
732 | write(*,*) 'Which tracer name do you want to change ?' |
---|
733 | do iq=1,nqtot |
---|
734 | write(*,'(i3,a3,a20)')iq,' : ',trim(tname(iq)) |
---|
735 | enddo |
---|
736 | write(*,'(a35,i3)') |
---|
737 | & '(enter tracer number; between 1 and ',nqtot |
---|
738 | write(*,*)' or any other value to quit this option)' |
---|
739 | read(*,*) iq |
---|
740 | if ((iq.ge.1).and.(iq.le.nqtot)) then |
---|
741 | write(*,*)'Change tracer name ',trim(tname(iq)),' to ?' |
---|
742 | read(*,*) txt |
---|
743 | tname(iq)=txt |
---|
744 | write(*,*)'Do you want to change another tracer name (y/n)?' |
---|
745 | read(*,'(a)') yes |
---|
746 | else |
---|
747 | ! inapropiate value of iq; quit this option |
---|
748 | yes='n' |
---|
749 | endif ! of if ((iq.ge.1).and.(iq.le.nqtot)) |
---|
750 | enddo ! of do while (yes.ne.'y') |
---|
751 | |
---|
752 | c q=0 : set tracers to zero |
---|
753 | c ------------------------- |
---|
754 | else if (trim(modif) .eq. 'q=0') then |
---|
755 | c mise a 0 des q (traceurs) |
---|
756 | write(*,*) 'Tracers set to 0 (1.E-30 in fact)' |
---|
757 | DO iq =1, nqtot |
---|
758 | DO l=1,llm |
---|
759 | DO j=1,jjp1 |
---|
760 | DO i=1,iip1 |
---|
761 | q(i,j,l,iq)=1.e-30 |
---|
762 | ENDDO |
---|
763 | ENDDO |
---|
764 | ENDDO |
---|
765 | ENDDO |
---|
766 | |
---|
767 | c set surface tracers to zero |
---|
768 | DO iq =1, nqtot |
---|
769 | DO ig=1,ngridmx |
---|
770 | qsurf(ig,iq)=0. |
---|
771 | ENDDO |
---|
772 | ENDDO |
---|
773 | |
---|
774 | c q=x : initialise tracer manually |
---|
775 | c -------------------------------- |
---|
776 | else if (trim(modif) .eq. 'q=x') then |
---|
777 | write(*,*) 'Which tracer do you want to modify ?' |
---|
778 | do iq=1,nqtot |
---|
779 | write(*,*)iq,' : ',trim(tname(iq)) |
---|
780 | enddo |
---|
781 | write(*,*) '(choose between 1 and ',nqtot,')' |
---|
782 | read(*,*) iq |
---|
783 | if ((iq.lt.1).or.(iq.gt.nqtot)) then |
---|
784 | ! wrong value for iq, go back to menu |
---|
785 | write(*,*) "wrong input value:",iq |
---|
786 | cycle |
---|
787 | endif |
---|
788 | write(*,*)'mixing ratio of tracer ',trim(tname(iq)), |
---|
789 | & ' ? (kg/kg)' |
---|
790 | read(*,*) val |
---|
791 | DO l=1,llm |
---|
792 | DO j=1,jjp1 |
---|
793 | DO i=1,iip1 |
---|
794 | q(i,j,l,iq)=val |
---|
795 | ENDDO |
---|
796 | ENDDO |
---|
797 | ENDDO |
---|
798 | write(*,*) 'SURFACE value of tracer ',trim(tname(iq)), |
---|
799 | & ' ? (kg/m2)' |
---|
800 | read(*,*) val |
---|
801 | DO ig=1,ngridmx |
---|
802 | qsurf(ig,iq)=val |
---|
803 | ENDDO |
---|
804 | |
---|
805 | c q=profile : initialize tracer with a given profile |
---|
806 | c -------------------------------------------------- |
---|
807 | else if (trim(modif) .eq. 'q=profile') then |
---|
808 | write(*,*) 'Tracer profile will be sought in ASCII file' |
---|
809 | write(*,*) "'profile_tracer' where 'tracer' is tracer name" |
---|
810 | write(*,*) "(one value per line in file; starting with" |
---|
811 | write(*,*) "surface value, the 1st atmospheric layer" |
---|
812 | write(*,*) "followed by 2nd, etc. up to top of atmosphere)" |
---|
813 | write(*,*) 'Which tracer do you want to set?' |
---|
814 | do iq=1,nqtot |
---|
815 | write(*,*)iq,' : ',trim(tname(iq)) |
---|
816 | enddo |
---|
817 | write(*,*) '(choose between 1 and ',nqtot,')' |
---|
818 | read(*,*) iq |
---|
819 | if ((iq.lt.1).or.(iq.gt.nqtot)) then |
---|
820 | ! wrong value for iq, go back to menu |
---|
821 | write(*,*) "wrong input value:",iq |
---|
822 | cycle |
---|
823 | endif |
---|
824 | ! look for input file 'profile_tracer' |
---|
825 | txt="profile_"//trim(tname(iq)) |
---|
826 | open(41,file=trim(txt),status='old',form='formatted', |
---|
827 | & iostat=ierr) |
---|
828 | if (ierr.eq.0) then |
---|
829 | ! OK, found file 'profile_...', load the profile |
---|
830 | do l=1,llm+1 |
---|
831 | read(41,*,iostat=ierr) profile(l) |
---|
832 | if (ierr.ne.0) then ! something went wrong |
---|
833 | exit ! quit loop |
---|
834 | endif |
---|
835 | enddo |
---|
836 | if (ierr.eq.0) then |
---|
837 | ! initialize tracer values |
---|
838 | qsurf(:,iq)=profile(1) |
---|
839 | do l=1,llm |
---|
840 | q(:,:,l,iq)=profile(l+1) |
---|
841 | enddo |
---|
842 | write(*,*)'OK, tracer ',trim(tname(iq)), |
---|
843 | & ' initialized ','using values from file ',trim(txt) |
---|
844 | else |
---|
845 | write(*,*)'problem reading file ',trim(txt),' !' |
---|
846 | write(*,*)'No modifications to tracer ',trim(tname(iq)) |
---|
847 | endif |
---|
848 | else |
---|
849 | write(*,*)'Could not find file ',trim(txt),' !' |
---|
850 | write(*,*)'No modifications to tracer ',trim(tname(iq)) |
---|
851 | endif |
---|
852 | |
---|
853 | c convert dust from virtual to true values |
---|
854 | c -------------------------------------------------- |
---|
855 | else if (trim(modif) .eq. 'freedust') then |
---|
856 | if (minval(tauscaling) .lt. 0) then |
---|
857 | write(*,*) 'WARNING conversion factor negative' |
---|
858 | write(*,*) 'This is probably because it was not present |
---|
859 | &in the file' |
---|
860 | write(*,*) 'A constant conversion is used instead.' |
---|
861 | tauscaling(:) = 1.e-3 |
---|
862 | endif |
---|
863 | CALL gr_fi_dyn(1,ngridmx,iip1,jjp1,tauscaling,tauscadyn) |
---|
864 | do l=1,llm |
---|
865 | do j=1,jjp1 |
---|
866 | do i=1,iip1 |
---|
867 | if (igcm_dust_number .ne. 0) |
---|
868 | & q(i,j,l,igcm_dust_number) = |
---|
869 | & q(i,j,l,igcm_dust_number) * tauscadyn(i,j) |
---|
870 | if (igcm_dust_mass .ne. 0) |
---|
871 | & q(i,j,l,igcm_dust_mass) = |
---|
872 | & q(i,j,l,igcm_dust_mass) * tauscadyn(i,j) |
---|
873 | if (igcm_ccn_number .ne. 0) |
---|
874 | & q(i,j,l,igcm_ccn_number) = |
---|
875 | & q(i,j,l,igcm_ccn_number) * tauscadyn(i,j) |
---|
876 | if (igcm_ccn_mass .ne. 0) |
---|
877 | & q(i,j,l,igcm_ccn_mass) = |
---|
878 | & q(i,j,l,igcm_ccn_mass) * tauscadyn(i,j) |
---|
879 | end do |
---|
880 | end do |
---|
881 | end do |
---|
882 | |
---|
883 | tauscaling(:) = 1. |
---|
884 | |
---|
885 | ! We want to have the very same value at lon -180 and lon 180 |
---|
886 | do l = 1,llm |
---|
887 | do j = 1,jjp1 |
---|
888 | do iq = 1,nqtot |
---|
889 | q(iip1,j,l,iq) = q(1,j,l,iq) |
---|
890 | end do |
---|
891 | end do |
---|
892 | end do |
---|
893 | |
---|
894 | write(*,*) 'done rescaling to true vale' |
---|
895 | |
---|
896 | c ini_q : Initialize tracers for chemistry |
---|
897 | c ----------------------------------------------- |
---|
898 | else if (trim(modif) .eq. 'ini_q') then |
---|
899 | flagh2o = 1 |
---|
900 | flagthermo = 0 |
---|
901 | yes=' ' |
---|
902 | c For more than 32 layers, possible to initiate thermosphere only |
---|
903 | if (llm.gt.32) then |
---|
904 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
---|
905 | write(*,*)'', |
---|
906 | & 'initialisation for thermosphere only? (y/n)' |
---|
907 | read(*,fmt='(a)') yes |
---|
908 | if (yes.eq.'y') then |
---|
909 | flagthermo=1 |
---|
910 | else |
---|
911 | flagthermo=0 |
---|
912 | endif |
---|
913 | enddo |
---|
914 | endif |
---|
915 | |
---|
916 | call inichim_newstart(ngridmx, nqtot, q, qsurf, ps, |
---|
917 | & flagh2o, flagthermo) |
---|
918 | |
---|
919 | ! We want to have the very same value at lon -180 and lon 180 |
---|
920 | do l = 1,llm |
---|
921 | do j = 1,jjp1 |
---|
922 | do iq = 1,nqtot |
---|
923 | q(iip1,j,l,iq) = q(1,j,l,iq) |
---|
924 | end do |
---|
925 | end do |
---|
926 | end do |
---|
927 | |
---|
928 | write(*,*) 'inichim_newstart: chemical species and |
---|
929 | $ water vapour initialised' |
---|
930 | |
---|
931 | c ini_q-h2o : as above except for the water vapour tracer |
---|
932 | c ------------------------------------------------------ |
---|
933 | else if (trim(modif) .eq. 'ini_q-h2o') then |
---|
934 | flagh2o = 0 |
---|
935 | flagthermo = 0 |
---|
936 | yes=' ' |
---|
937 | ! for more than 32 layers, possible to initiate thermosphere only |
---|
938 | if(llm.gt.32) then |
---|
939 | do while ((yes.ne.'y').and.(yes.ne.'n')) |
---|
940 | write(*,*)'', |
---|
941 | & 'initialisation for thermosphere only? (y/n)' |
---|
942 | read(*,fmt='(a)') yes |
---|
943 | if (yes.eq.'y') then |
---|
944 | flagthermo=1 |
---|
945 | else |
---|
946 | flagthermo=0 |
---|
947 | endif |
---|
948 | enddo |
---|
949 | endif |
---|
950 | |
---|
951 | call inichim_newstart(ngridmx, nqtot, q, qsurf, ps, |
---|
952 | & flagh2o, flagthermo) |
---|
953 | |
---|
954 | ! We want to have the very same value at lon -180 and lon 180 |
---|
955 | do l = 1,llm |
---|
956 | do j = 1,jjp1 |
---|
957 | do iq = 1,nqtot |
---|
958 | q(iip1,j,l,iq) = q(1,j,l,iq) |
---|
959 | end do |
---|
960 | end do |
---|
961 | end do |
---|
962 | |
---|
963 | write(*,*) 'inichim_newstart: chemical species initialised |
---|
964 | $ (except water vapour)' |
---|
965 | |
---|
966 | c composition : change main composition: CO2,N2,Ar,O2,CO (FF 03/2014) |
---|
967 | c -------------------------------------------------------- |
---|
968 | else if (trim(modif) .eq. 'composition') then |
---|
969 | write(*,*) "Lat (degN) lon (degE) of the reference site ?" |
---|
970 | write(*,*) "e.g. MSL : -4.5 137. " |
---|
971 | 301 read(*,*,iostat=ierr) latref, lonref |
---|
972 | if(ierr.ne.0) goto 301 |
---|
973 | |
---|
974 | |
---|
975 | ! Select GCM point close to reference site |
---|
976 | dlonmin =90. |
---|
977 | DO i=1,iip1-1 |
---|
978 | if (abs(rlonv(i)*180./pi -lonref).lt.dlonmin)then |
---|
979 | iref=i |
---|
980 | dlonmin=abs(rlonv(i)*180./pi -lonref) |
---|
981 | end if |
---|
982 | ENDDO |
---|
983 | dlatmin =45. |
---|
984 | DO j=1,jjp1 |
---|
985 | if (abs(rlatu(j)*180./pi -latref).lt.dlatmin)then |
---|
986 | jref=j |
---|
987 | dlatmin=abs(rlatu(j)*180./pi -latref) |
---|
988 | end if |
---|
989 | ENDDO |
---|
990 | write(*,*) "In GCM : lat= " , rlatu(jref)*180./pi |
---|
991 | write(*,*) "In GCM : lon= " , rlonv(iref)*180./pi |
---|
992 | write(*,*) |
---|
993 | |
---|
994 | ! Compute air molar mass at reference site |
---|
995 | Smmr=0 |
---|
996 | Sn = 0 |
---|
997 | do iq=1,nqtot |
---|
998 | if ((iq.eq.igcm_co2).or.(iq.eq.igcm_n2) |
---|
999 | & .or. (iq.eq.igcm_ar).or.(iq.eq.igcm_o2) |
---|
1000 | & .or. (iq.eq.igcm_co)) then |
---|
1001 | Smmr=Smmr+q(iref,jref,1,iq) |
---|
1002 | Sn=Sn+q(iref,jref,1,iq)/mmol(iq) |
---|
1003 | end if |
---|
1004 | end do |
---|
1005 | write(*,*) "At reference site : " |
---|
1006 | write(*,*) "Sum of mass mix. ratio (should be about 1)=",Smmr |
---|
1007 | Mair_old =Smmr/Sn |
---|
1008 | write(*,*) |
---|
1009 | & "Air molar mass (g/mol) at reference site= ",Mair_old |
---|
1010 | |
---|
1011 | ! Ask for new volume mixing ratio at reference site |
---|
1012 | Svmr =0. |
---|
1013 | Sn =0. |
---|
1014 | do iq=1,nqtot |
---|
1015 | coefvmr(iq) = 1. |
---|
1016 | if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar) |
---|
1017 | & .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then |
---|
1018 | |
---|
1019 | vmr_old=q(iref,jref,1,iq)*Mair_old/mmol(iq) |
---|
1020 | write(*,*) "Previous vmr("//trim(tname(iq))//")= ", vmr_old |
---|
1021 | |
---|
1022 | if (iq.eq.igcm_n2) then |
---|
1023 | write(*,*) "New vmr(n2)? (MSL: 2.03e-02 at Ls~184)" |
---|
1024 | endif |
---|
1025 | if (iq.eq.igcm_ar) then |
---|
1026 | write(*,*) "New vmr(ar)? (MSL: 2.07e-02 at Ls~184)" |
---|
1027 | endif |
---|
1028 | if (iq.eq.igcm_o2) then |
---|
1029 | write(*,*) "New vmr(o2)? (MSL: 1.73e-03 at Ls~184)" |
---|
1030 | endif |
---|
1031 | if (iq.eq.igcm_co) then |
---|
1032 | write(*,*) "New vmr(co)? (MSL: 7.49e-04 at Ls~184)" |
---|
1033 | endif |
---|
1034 | 302 read(*,*,iostat=ierr) vmr_new |
---|
1035 | if(ierr.ne.0) goto 302 |
---|
1036 | write(*,*) "New vmr("//trim(tname(iq))//")= ",vmr_new |
---|
1037 | write(*,*) |
---|
1038 | coefvmr(iq) = vmr_new/vmr_old |
---|
1039 | Svmr=Svmr+vmr_new |
---|
1040 | Sn=Sn+vmr_new*mmol(iq) |
---|
1041 | end if |
---|
1042 | enddo ! of do iq=1,nqtot |
---|
1043 | ! Estimation of new Air molar mass at reference site (assuming vmr_co2 = 1-Svmr) |
---|
1044 | Mair_new = Sn + (1-Svmr)*mmol(igcm_co2) |
---|
1045 | write(*,*) |
---|
1046 | & "NEW Air molar mass (g/mol) at reference site= ",Mair_new |
---|
1047 | |
---|
1048 | ! Compute mass mixing ratio changes |
---|
1049 | do iq=1,nqtot |
---|
1050 | if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar) |
---|
1051 | & .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then |
---|
1052 | write(*,*) "Everywhere mmr("//trim(tname(iq))// |
---|
1053 | & ") is multiplied by ",coefvmr(iq)*Mair_old/Mair_new |
---|
1054 | end if |
---|
1055 | end do |
---|
1056 | |
---|
1057 | ! Recompute mass mixing ratios everywhere, and adjust mmr of most abundant species |
---|
1058 | ! to keep sum of mmr constant. |
---|
1059 | do l=1,llm |
---|
1060 | do j=1,jjp1 |
---|
1061 | do i=1,iip1 |
---|
1062 | Smmr_old = 0. |
---|
1063 | Smmr_new = 0. |
---|
1064 | do iq=1,nqtot |
---|
1065 | if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar) |
---|
1066 | & .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then |
---|
1067 | Smmr_old = Smmr_old + q(i,j,l,iq) ! sum of old mmr |
---|
1068 | q(i,j,l,iq)=q(i,j,l,iq)*coefvmr(iq)*Mair_old/Mair_new |
---|
1069 | Smmr_new = Smmr_new + q(i,j,l,iq) ! sum of new mmr |
---|
1070 | end if |
---|
1071 | enddo |
---|
1072 | iloc = maxloc(q(i,j,l,:)) |
---|
1073 | iqmax = iloc(1) |
---|
1074 | q(i,j,l,iqmax) = q(i,j,l,iqmax) + Smmr_old - Smmr_new |
---|
1075 | enddo |
---|
1076 | enddo |
---|
1077 | enddo |
---|
1078 | |
---|
1079 | write(*,*) |
---|
1080 | & "The most abundant species is modified everywhere to keep "// |
---|
1081 | & "sum of mmr constant" |
---|
1082 | write(*,*) 'At reference site vmr(CO2)=', |
---|
1083 | & q(iref,jref,1,igcm_co2)*Mair_new/mmol(igcm_co2) |
---|
1084 | write(*,*) "Compared to MSL observation: vmr(CO2)= 0.957 "// |
---|
1085 | & "at Ls=184" |
---|
1086 | |
---|
1087 | c wetstart : wet atmosphere with a north to south gradient |
---|
1088 | c -------------------------------------------------------- |
---|
1089 | else if (trim(modif) .eq. 'wetstart') then |
---|
1090 | ! check that there is indeed a water vapor tracer |
---|
1091 | if (igcm_h2o_vap.eq.0) then |
---|
1092 | write(*,*) "No water vapour tracer! Can't use this option" |
---|
1093 | stop |
---|
1094 | endif |
---|
1095 | DO l=1,llm |
---|
1096 | DO j=1,jjp1 |
---|
1097 | DO i=1,iip1-1 |
---|
1098 | q(i,j,l,igcm_h2o_vap)=150.e-6 * (rlatu(j)+pi/2.) / pi |
---|
1099 | ENDDO |
---|
1100 | ! We want to have the very same value at lon -180 and lon 180 |
---|
1101 | q(iip1,j,l,igcm_h2o_vap) = q(1,j,l,igcm_h2o_vap) |
---|
1102 | ENDDO |
---|
1103 | ENDDO |
---|
1104 | |
---|
1105 | write(*,*) 'Water mass mixing ratio at north pole=' |
---|
1106 | * ,q(1,1,1,igcm_h2o_vap) |
---|
1107 | write(*,*) '---------------------------south pole=' |
---|
1108 | * ,q(1,jjp1,1,igcm_h2o_vap) |
---|
1109 | |
---|
1110 | c ini_h2osurf : reinitialize surface water ice |
---|
1111 | c -------------------------------------------------- |
---|
1112 | else if (trim(modif) .eq. 'ini_h2osurf') then |
---|
1113 | write(*,*)'max surface ice left?(e.g. 0.2 kg/m2=200microns)' |
---|
1114 | 207 read(*,*,iostat=ierr) val |
---|
1115 | if(ierr.ne.0) goto 207 |
---|
1116 | write(*,*)'also set negative values of surf ice to 0' |
---|
1117 | do ig=1,ngridmx |
---|
1118 | qsurf(ig,igcm_h2o_ice)=min(val,qsurf(ig,igcm_h2o_ice)) |
---|
1119 | qsurf(ig,igcm_h2o_ice)=max(0.,qsurf(ig,igcm_h2o_ice)) |
---|
1120 | end do |
---|
1121 | |
---|
1122 | c noglacier : remove tropical water ice (to initialize high res sim) |
---|
1123 | c -------------------------------------------------- |
---|
1124 | else if (trim(modif) .eq. 'noglacier') then |
---|
1125 | do ig=1,ngridmx |
---|
1126 | j=(ig-2)/iim +2 |
---|
1127 | if(ig.eq.1) j=1 |
---|
1128 | write(*,*) 'OK: remove surface ice for |lat|<45' |
---|
1129 | if (abs(rlatu(j)*180./pi).lt.45.) then |
---|
1130 | qsurf(ig,igcm_h2o_ice)=0. |
---|
1131 | end if |
---|
1132 | end do |
---|
1133 | |
---|
1134 | |
---|
1135 | c watercapn : H20 ice on permanent northern cap |
---|
1136 | c -------------------------------------------------- |
---|
1137 | else if (trim(modif) .eq. 'watercapn') then |
---|
1138 | do ig=1,ngridmx |
---|
1139 | j=(ig-2)/iim +2 |
---|
1140 | if(ig.eq.1) j=1 |
---|
1141 | if (rlatu(j)*180./pi.gt.80.) then |
---|
1142 | qsurf(ig,igcm_h2o_ice)=1.e5 |
---|
1143 | write(*,*) 'ig=',ig,' H2O ice mass (kg/m2)= ', |
---|
1144 | & qsurf(ig,igcm_h2o_ice) |
---|
1145 | write(*,*)' ==> Ice mesh South boundary (deg)= ', |
---|
1146 | & rlatv(j)*180./pi |
---|
1147 | end if |
---|
1148 | enddo |
---|
1149 | |
---|
1150 | c watercaps : H20 ice on permanent southern cap |
---|
1151 | c ------------------------------------------------- |
---|
1152 | else if (trim(modif) .eq. 'watercaps') then |
---|
1153 | do ig=1,ngridmx |
---|
1154 | j=(ig-2)/iim +2 |
---|
1155 | if(ig.eq.1) j=1 |
---|
1156 | if (rlatu(j)*180./pi.lt.-80.) then |
---|
1157 | qsurf(ig,igcm_h2o_ice)=1.e5 |
---|
1158 | write(*,*) 'ig=',ig,' H2O ice mass (kg/m2)= ', |
---|
1159 | & qsurf(ig,igcm_h2o_ice) |
---|
1160 | write(*,*)' ==> Ice mesh North boundary (deg)= ', |
---|
1161 | & rlatv(j-1)*180./pi |
---|
1162 | end if |
---|
1163 | enddo |
---|
1164 | |
---|
1165 | c isotherm : Isothermal temperatures and no winds |
---|
1166 | c ------------------------------------------------ |
---|
1167 | else if (trim(modif) .eq. 'isotherm') then |
---|
1168 | |
---|
1169 | write(*,*)'Isothermal temperature of the atmosphere, |
---|
1170 | & surface and subsurface' |
---|
1171 | write(*,*) 'Value of this temperature ? :' |
---|
1172 | 203 read(*,*,iostat=ierr) Tiso |
---|
1173 | if(ierr.ne.0) goto 203 |
---|
1174 | |
---|
1175 | do ig=1, ngridmx |
---|
1176 | tsurf(ig) = Tiso |
---|
1177 | end do |
---|
1178 | do l=2,nsoilmx |
---|
1179 | do ig=1, ngridmx |
---|
1180 | tsoil(ig,l) = Tiso |
---|
1181 | end do |
---|
1182 | end do |
---|
1183 | flagiso=.true. |
---|
1184 | call initial0(llm*ip1jmp1,ucov) |
---|
1185 | call initial0(llm*ip1jm,vcov) |
---|
1186 | call initial0(ngridmx*(llm+1),q2) |
---|
1187 | |
---|
1188 | c co2ice=0 : remove CO2 polar ice caps' |
---|
1189 | c ------------------------------------------------ |
---|
1190 | else if (trim(modif) .eq. 'co2ice=0') then |
---|
1191 | do ig=1,ngridmx |
---|
1192 | co2ice(ig)=0 |
---|
1193 | emis(ig)=emis(ngridmx/2) |
---|
1194 | end do |
---|
1195 | |
---|
1196 | ! therm_ini_s: (re)-set soil thermal inertia to reference surface values |
---|
1197 | ! ---------------------------------------------------------------------- |
---|
1198 | |
---|
1199 | else if (trim(modif).eq.'therm_ini_s') then |
---|
1200 | ! write(*,*)"surfithfi(1):",surfithfi(1) |
---|
1201 | do isoil=1,nsoilmx |
---|
1202 | inertiedat(1:ngridmx,isoil)=surfithfi(1:ngridmx) |
---|
1203 | enddo |
---|
1204 | write(*,*)'OK: Soil thermal inertia has been reset to referenc |
---|
1205 | &e surface values' |
---|
1206 | ! write(*,*)"inertiedat(1,1):",inertiedat(1,1) |
---|
1207 | ithfi(:,:)=inertiedat(:,:) |
---|
1208 | ! recast ithfi() onto ith() |
---|
1209 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
---|
1210 | ! Check: |
---|
1211 | ! do i=1,iip1 |
---|
1212 | ! do j=1,jjp1 |
---|
1213 | ! do isoil=1,nsoilmx |
---|
1214 | ! write(77,*) i,j,isoil," ",ith(i,j,isoil) |
---|
1215 | ! enddo |
---|
1216 | ! enddo |
---|
1217 | ! enddo |
---|
1218 | |
---|
1219 | ! subsoilice_n: Put deep ice layer in northern hemisphere soil |
---|
1220 | ! ------------------------------------------------------------ |
---|
1221 | |
---|
1222 | else if (trim(modif).eq.'subsoilice_n') then |
---|
1223 | |
---|
1224 | write(*,*)'From which latitude (in deg.), up to the north pole, |
---|
1225 | &should we put subterranean ice?' |
---|
1226 | ierr=1 |
---|
1227 | do while (ierr.ne.0) |
---|
1228 | read(*,*,iostat=ierr) val |
---|
1229 | if (ierr.eq.0) then ! got a value |
---|
1230 | ! do a sanity check |
---|
1231 | if((val.lt.0.).or.(val.gt.90)) then |
---|
1232 | write(*,*)'Latitude should be between 0 and 90 deg. !!!' |
---|
1233 | ierr=1 |
---|
1234 | else ! find corresponding jref (nearest latitude) |
---|
1235 | ! note: rlatu(:) contains decreasing values of latitude |
---|
1236 | ! starting from PI/2 to -PI/2 |
---|
1237 | do j=1,jjp1 |
---|
1238 | if ((rlatu(j)*180./pi.ge.val).and. |
---|
1239 | & (rlatu(j+1)*180./pi.le.val)) then |
---|
1240 | ! find which grid point is nearest to val: |
---|
1241 | if (abs(rlatu(j)*180./pi-val).le. |
---|
1242 | & abs((rlatu(j+1)*180./pi-val))) then |
---|
1243 | jref=j |
---|
1244 | else |
---|
1245 | jref=j+1 |
---|
1246 | endif |
---|
1247 | |
---|
1248 | write(*,*)'Will use nearest grid latitude which is:', |
---|
1249 | & rlatu(jref)*180./pi |
---|
1250 | endif |
---|
1251 | enddo ! of do j=1,jjp1 |
---|
1252 | endif ! of if((val.lt.0.).or.(val.gt.90)) |
---|
1253 | endif !of if (ierr.eq.0) |
---|
1254 | enddo ! of do while |
---|
1255 | |
---|
1256 | ! Build layers() (as in soil_settings.F) |
---|
1257 | val2=sqrt(mlayer(0)*mlayer(1)) |
---|
1258 | val3=mlayer(1)/mlayer(0) |
---|
1259 | do isoil=1,nsoilmx |
---|
1260 | layer(isoil)=val2*(val3**(isoil-1)) |
---|
1261 | enddo |
---|
1262 | |
---|
1263 | write(*,*)'At which depth (in m.) does the ice layer begin?' |
---|
1264 | write(*,*)'(currently, the deepest soil layer extends down to:' |
---|
1265 | & ,layer(nsoilmx),')' |
---|
1266 | ierr=1 |
---|
1267 | do while (ierr.ne.0) |
---|
1268 | read(*,*,iostat=ierr) val2 |
---|
1269 | ! write(*,*)'val2:',val2,'ierr=',ierr |
---|
1270 | if (ierr.eq.0) then ! got a value, but do a sanity check |
---|
1271 | if(val2.gt.layer(nsoilmx)) then |
---|
1272 | write(*,*)'Depth should be less than ',layer(nsoilmx) |
---|
1273 | ierr=1 |
---|
1274 | endif |
---|
1275 | if(val2.lt.layer(1)) then |
---|
1276 | write(*,*)'Depth should be more than ',layer(1) |
---|
1277 | ierr=1 |
---|
1278 | endif |
---|
1279 | endif |
---|
1280 | enddo ! of do while |
---|
1281 | |
---|
1282 | ! find the reference index iref the depth corresponds to |
---|
1283 | ! if (val2.lt.layer(1)) then |
---|
1284 | ! iref=1 |
---|
1285 | ! else |
---|
1286 | do isoil=1,nsoilmx-1 |
---|
1287 | if((val2.gt.layer(isoil)).and.(val2.lt.layer(isoil+1))) |
---|
1288 | & then |
---|
1289 | iref=isoil |
---|
1290 | exit |
---|
1291 | endif |
---|
1292 | enddo |
---|
1293 | ! endif |
---|
1294 | |
---|
1295 | ! write(*,*)'iref:',iref,' jref:',jref |
---|
1296 | ! write(*,*)'layer',layer |
---|
1297 | ! write(*,*)'mlayer',mlayer |
---|
1298 | |
---|
1299 | ! thermal inertia of the ice: |
---|
1300 | ierr=1 |
---|
1301 | do while (ierr.ne.0) |
---|
1302 | write(*,*)'What is the value of subterranean ice thermal inert |
---|
1303 | &ia? (e.g.: 2000)' |
---|
1304 | read(*,*,iostat=ierr)iceith |
---|
1305 | enddo ! of do while |
---|
1306 | |
---|
1307 | ! recast ithfi() onto ith() |
---|
1308 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
---|
1309 | |
---|
1310 | do j=1,jref |
---|
1311 | ! write(*,*)'j:',j,'rlatu(j)*180./pi:',rlatu(j)*180./pi |
---|
1312 | do i=1,iip1 ! loop on longitudes |
---|
1313 | ! Build "equivalent" thermal inertia for the mixed layer |
---|
1314 | ith(i,j,iref+1)=sqrt((layer(iref+1)-layer(iref))/ |
---|
1315 | & (((val2-layer(iref))/(ith(i,j,iref)**2))+ |
---|
1316 | & ((layer(iref+1)-val2)/(iceith)**2))) |
---|
1317 | ! Set thermal inertia of lower layers |
---|
1318 | do isoil=iref+2,nsoilmx |
---|
1319 | ith(i,j,isoil)=iceith ! ice |
---|
1320 | enddo |
---|
1321 | enddo ! of do i=1,iip1 |
---|
1322 | enddo ! of do j=1,jjp1 |
---|
1323 | |
---|
1324 | |
---|
1325 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
---|
1326 | |
---|
1327 | ! do i=1,nsoilmx |
---|
1328 | ! write(*,*)'i:',i,'ithfi(1,i):',ithfi(1,i) |
---|
1329 | ! enddo |
---|
1330 | |
---|
1331 | |
---|
1332 | ! subsoilice_s: Put deep ice layer in southern hemisphere soil |
---|
1333 | ! ------------------------------------------------------------ |
---|
1334 | |
---|
1335 | else if (trim(modif).eq.'subsoilice_s') then |
---|
1336 | |
---|
1337 | write(*,*)'From which latitude (in deg.), down to the south pol |
---|
1338 | &e, should we put subterranean ice?' |
---|
1339 | ierr=1 |
---|
1340 | do while (ierr.ne.0) |
---|
1341 | read(*,*,iostat=ierr) val |
---|
1342 | if (ierr.eq.0) then ! got a value |
---|
1343 | ! do a sanity check |
---|
1344 | if((val.gt.0.).or.(val.lt.-90)) then |
---|
1345 | write(*,*)'Latitude should be between 0 and -90 deg. !!!' |
---|
1346 | ierr=1 |
---|
1347 | else ! find corresponding jref (nearest latitude) |
---|
1348 | ! note: rlatu(:) contains decreasing values of latitude |
---|
1349 | ! starting from PI/2 to -PI/2 |
---|
1350 | do j=1,jjp1 |
---|
1351 | if ((rlatu(j)*180./pi.ge.val).and. |
---|
1352 | & (rlatu(j+1)*180./pi.le.val)) then |
---|
1353 | ! find which grid point is nearest to val: |
---|
1354 | if (abs(rlatu(j)*180./pi-val).le. |
---|
1355 | & abs((rlatu(j+1)*180./pi-val))) then |
---|
1356 | jref=j |
---|
1357 | else |
---|
1358 | jref=j+1 |
---|
1359 | endif |
---|
1360 | |
---|
1361 | write(*,*)'Will use nearest grid latitude which is:', |
---|
1362 | & rlatu(jref)*180./pi |
---|
1363 | endif |
---|
1364 | enddo ! of do j=1,jjp1 |
---|
1365 | endif ! of if((val.lt.0.).or.(val.gt.90)) |
---|
1366 | endif !of if (ierr.eq.0) |
---|
1367 | enddo ! of do while |
---|
1368 | |
---|
1369 | ! Build layers() (as in soil_settings.F) |
---|
1370 | val2=sqrt(mlayer(0)*mlayer(1)) |
---|
1371 | val3=mlayer(1)/mlayer(0) |
---|
1372 | do isoil=1,nsoilmx |
---|
1373 | layer(isoil)=val2*(val3**(isoil-1)) |
---|
1374 | enddo |
---|
1375 | |
---|
1376 | write(*,*)'At which depth (in m.) does the ice layer begin?' |
---|
1377 | write(*,*)'(currently, the deepest soil layer extends down to:' |
---|
1378 | & ,layer(nsoilmx),')' |
---|
1379 | ierr=1 |
---|
1380 | do while (ierr.ne.0) |
---|
1381 | read(*,*,iostat=ierr) val2 |
---|
1382 | ! write(*,*)'val2:',val2,'ierr=',ierr |
---|
1383 | if (ierr.eq.0) then ! got a value, but do a sanity check |
---|
1384 | if(val2.gt.layer(nsoilmx)) then |
---|
1385 | write(*,*)'Depth should be less than ',layer(nsoilmx) |
---|
1386 | ierr=1 |
---|
1387 | endif |
---|
1388 | if(val2.lt.layer(1)) then |
---|
1389 | write(*,*)'Depth should be more than ',layer(1) |
---|
1390 | ierr=1 |
---|
1391 | endif |
---|
1392 | endif |
---|
1393 | enddo ! of do while |
---|
1394 | |
---|
1395 | ! find the reference index iref the depth corresponds to |
---|
1396 | do isoil=1,nsoilmx-1 |
---|
1397 | if((val2.gt.layer(isoil)).and.(val2.lt.layer(isoil+1))) |
---|
1398 | & then |
---|
1399 | iref=isoil |
---|
1400 | exit |
---|
1401 | endif |
---|
1402 | enddo |
---|
1403 | |
---|
1404 | ! write(*,*)'iref:',iref,' jref:',jref |
---|
1405 | |
---|
1406 | ! thermal inertia of the ice: |
---|
1407 | ierr=1 |
---|
1408 | do while (ierr.ne.0) |
---|
1409 | write(*,*)'What is the value of subterranean ice thermal inert |
---|
1410 | &ia? (e.g.: 2000)' |
---|
1411 | read(*,*,iostat=ierr)iceith |
---|
1412 | enddo ! of do while |
---|
1413 | |
---|
1414 | ! recast ithfi() onto ith() |
---|
1415 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
---|
1416 | |
---|
1417 | do j=jref,jjp1 |
---|
1418 | ! write(*,*)'j:',j,'rlatu(j)*180./pi:',rlatu(j)*180./pi |
---|
1419 | do i=1,iip1 ! loop on longitudes |
---|
1420 | ! Build "equivalent" thermal inertia for the mixed layer |
---|
1421 | ith(i,j,iref+1)=sqrt((layer(iref+1)-layer(iref))/ |
---|
1422 | & (((val2-layer(iref))/(ith(i,j,iref)**2))+ |
---|
1423 | & ((layer(iref+1)-val2)/(iceith)**2))) |
---|
1424 | ! Set thermal inertia of lower layers |
---|
1425 | do isoil=iref+2,nsoilmx |
---|
1426 | ith(i,j,isoil)=iceith ! ice |
---|
1427 | enddo |
---|
1428 | enddo ! of do i=1,iip1 |
---|
1429 | enddo ! of do j=jref,jjp1 |
---|
1430 | |
---|
1431 | |
---|
1432 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
---|
1433 | |
---|
1434 | c 'mons_ice' : use MONS data to build subsurface ice table |
---|
1435 | c -------------------------------------------------------- |
---|
1436 | else if (trim(modif).eq.'mons_ice') then |
---|
1437 | |
---|
1438 | ! 1. Load MONS data |
---|
1439 | call load_MONS_data(MONS_Hdn,MONS_d21) |
---|
1440 | |
---|
1441 | ! 2. Get parameters from user |
---|
1442 | ierr=1 |
---|
1443 | do while (ierr.ne.0) |
---|
1444 | write(*,*) "Coefficient to apply to MONS 'depth' in Northern", |
---|
1445 | & " Hemisphere?" |
---|
1446 | write(*,*) " (should be somewhere between 3.2e-4 and 1.3e-3)" |
---|
1447 | read(*,*,iostat=ierr) MONS_coeffN |
---|
1448 | enddo |
---|
1449 | ierr=1 |
---|
1450 | do while (ierr.ne.0) |
---|
1451 | write(*,*) "Coefficient to apply to MONS 'depth' in Southern", |
---|
1452 | & " Hemisphere?" |
---|
1453 | write(*,*) " (should be somewhere between 3.2e-4 and 1.3e-3)" |
---|
1454 | read(*,*,iostat=ierr) MONS_coeffS |
---|
1455 | enddo |
---|
1456 | ierr=1 |
---|
1457 | do while (ierr.ne.0) |
---|
1458 | write(*,*) "Value of subterranean ice thermal inertia ", |
---|
1459 | & " in Northern hemisphere?" |
---|
1460 | write(*,*) " (e.g.: 2000, or perhaps 2290)" |
---|
1461 | ! read(*,*,iostat=ierr) iceith |
---|
1462 | read(*,*,iostat=ierr) iceithN |
---|
1463 | enddo |
---|
1464 | ierr=1 |
---|
1465 | do while (ierr.ne.0) |
---|
1466 | write(*,*) "Value of subterranean ice thermal inertia ", |
---|
1467 | & " in Southern hemisphere?" |
---|
1468 | write(*,*) " (e.g.: 2000, or perhaps 2290)" |
---|
1469 | ! read(*,*,iostat=ierr) iceith |
---|
1470 | read(*,*,iostat=ierr) iceithS |
---|
1471 | enddo |
---|
1472 | |
---|
1473 | ! 3. Build subterranean thermal inertia |
---|
1474 | |
---|
1475 | ! initialise subsurface inertia with reference surface values |
---|
1476 | do isoil=1,nsoilmx |
---|
1477 | ithfi(1:ngridmx,isoil)=surfithfi(1:ngridmx) |
---|
1478 | enddo |
---|
1479 | ! recast ithfi() onto ith() |
---|
1480 | call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith) |
---|
1481 | |
---|
1482 | do i=1,iip1 ! loop on longitudes |
---|
1483 | do j=1,jjp1 ! loop on latitudes |
---|
1484 | ! set MONS_coeff |
---|
1485 | if (rlatu(j).ge.0) then ! northern hemisphere |
---|
1486 | ! N.B: rlatu(:) contains decreasing values of latitude |
---|
1487 | ! starting from PI/2 to -PI/2 |
---|
1488 | MONS_coeff=MONS_coeffN |
---|
1489 | iceith=iceithN |
---|
1490 | else ! southern hemisphere |
---|
1491 | MONS_coeff=MONS_coeffS |
---|
1492 | iceith=iceithS |
---|
1493 | endif |
---|
1494 | ! check if we should put subterranean ice |
---|
1495 | if (MONS_Hdn(i,j).ge.14.0) then ! no ice if Hdn<14% |
---|
1496 | ! compute depth at which ice lies: |
---|
1497 | val=MONS_d21(i,j)*MONS_coeff |
---|
1498 | ! compute val2= the diurnal skin depth of surface inertia |
---|
1499 | ! assuming a volumetric heat cap. of C=1.e6 J.m-3.K-1 |
---|
1500 | val2=ith(i,j,1)*1.e-6*sqrt(88775./3.14159) |
---|
1501 | if (val.lt.val2) then |
---|
1502 | ! ice must be below the (surface inertia) diurnal skin depth |
---|
1503 | val=val2 |
---|
1504 | endif |
---|
1505 | if (val.lt.layer(nsoilmx)) then ! subterranean ice |
---|
1506 | ! find the reference index iref that depth corresponds to |
---|
1507 | iref=0 |
---|
1508 | do isoil=1,nsoilmx-1 |
---|
1509 | if ((val.ge.layer(isoil)).and.(val.lt.layer(isoil+1))) |
---|
1510 | & then |
---|
1511 | iref=isoil |
---|
1512 | exit |
---|
1513 | endif |
---|
1514 | enddo |
---|
1515 | ! Build "equivalent" thermal inertia for the mixed layer |
---|
1516 | ith(i,j,iref+1)=sqrt((layer(iref+1)-layer(iref))/ |
---|
1517 | & (((val-layer(iref))/(ith(i,j,iref+1)**2))+ |
---|
1518 | & ((layer(iref+1)-val)/(iceith)**2))) |
---|
1519 | ! Set thermal inertia of lower layers |
---|
1520 | do isoil=iref+2,nsoilmx |
---|
1521 | ith(i,j,isoil)=iceith |
---|
1522 | enddo |
---|
1523 | endif ! of if (val.lt.layer(nsoilmx)) |
---|
1524 | endif ! of if (MONS_Hdn(i,j).lt.14.0) |
---|
1525 | enddo ! do j=1,jjp1 |
---|
1526 | enddo ! do i=1,iip1 |
---|
1527 | |
---|
1528 | ! Check: |
---|
1529 | ! do i=1,iip1 |
---|
1530 | ! do j=1,jjp1 |
---|
1531 | ! do isoil=1,nsoilmx |
---|
1532 | ! write(77,*) i,j,isoil," ",ith(i,j,isoil) |
---|
1533 | ! enddo |
---|
1534 | ! enddo |
---|
1535 | ! enddo |
---|
1536 | |
---|
1537 | ! recast ith() into ithfi() |
---|
1538 | CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) |
---|
1539 | |
---|
1540 | else |
---|
1541 | write(*,*) ' Unknown (misspelled?) option!!!' |
---|
1542 | end if ! of if (trim(modif) .eq. '...') elseif ... |
---|
1543 | |
---|
1544 | enddo ! of do ! infinite loop on liste of changes |
---|
1545 | |
---|
1546 | 999 continue |
---|
1547 | |
---|
1548 | |
---|
1549 | c======================================================================= |
---|
1550 | c Correct pressure on the new grid (menu 0) |
---|
1551 | c======================================================================= |
---|
1552 | |
---|
1553 | if (choix_1.eq.0) then |
---|
1554 | r = 1000.*8.31/mugaz |
---|
1555 | |
---|
1556 | do j=1,jjp1 |
---|
1557 | do i=1,iip1 |
---|
1558 | ps(i,j) = ps(i,j) * |
---|
1559 | . exp((phisold_newgrid(i,j)-phis(i,j)) / |
---|
1560 | . (t(i,j,1) * r)) |
---|
1561 | end do |
---|
1562 | end do |
---|
1563 | |
---|
1564 | c periodicity of surface ps in longitude |
---|
1565 | do j=1,jjp1 |
---|
1566 | ps(1,j) = ps(iip1,j) |
---|
1567 | end do |
---|
1568 | end if |
---|
1569 | |
---|
1570 | c======================================================================= |
---|
1571 | c======================================================================= |
---|
1572 | |
---|
1573 | c======================================================================= |
---|
1574 | c Initialisation de la physique / ecriture de newstartfi : |
---|
1575 | c======================================================================= |
---|
1576 | |
---|
1577 | |
---|
1578 | CALL inifilr |
---|
1579 | CALL pression(ip1jmp1, ap, bp, ps, p3d) |
---|
1580 | |
---|
1581 | c----------------------------------------------------------------------- |
---|
1582 | c Initialisation pks: |
---|
1583 | c----------------------------------------------------------------------- |
---|
1584 | |
---|
1585 | CALL exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf) |
---|
1586 | ! Calcul de la temperature potentielle teta |
---|
1587 | |
---|
1588 | if (flagiso) then |
---|
1589 | DO l=1,llm |
---|
1590 | DO j=1,jjp1 |
---|
1591 | DO i=1,iim |
---|
1592 | teta(i,j,l) = Tiso * cpp/pk(i,j,l) |
---|
1593 | ENDDO |
---|
1594 | teta (iip1,j,l)= teta (1,j,l) |
---|
1595 | ENDDO |
---|
1596 | ENDDO |
---|
1597 | else if (choix_1.eq.0) then |
---|
1598 | DO l=1,llm |
---|
1599 | DO j=1,jjp1 |
---|
1600 | DO i=1,iim |
---|
1601 | teta(i,j,l) = t(i,j,l) * cpp/pk(i,j,l) |
---|
1602 | ENDDO |
---|
1603 | teta (iip1,j,l)= teta (1,j,l) |
---|
1604 | ENDDO |
---|
1605 | ENDDO |
---|
1606 | endif |
---|
1607 | |
---|
1608 | C Calcul intermediaire |
---|
1609 | c |
---|
1610 | if (choix_1.eq.0) then |
---|
1611 | CALL massdair( p3d, masse ) |
---|
1612 | c |
---|
1613 | print *,' ALPHAX ',alphax |
---|
1614 | |
---|
1615 | DO l = 1, llm |
---|
1616 | DO i = 1, iim |
---|
1617 | xppn(i) = aire( i, 1 ) * masse( i , 1 , l ) |
---|
1618 | xpps(i) = aire( i,jjp1 ) * masse( i , jjp1 , l ) |
---|
1619 | ENDDO |
---|
1620 | xpn = SUM(xppn)/apoln |
---|
1621 | xps = SUM(xpps)/apols |
---|
1622 | DO i = 1, iip1 |
---|
1623 | masse( i , 1 , l ) = xpn |
---|
1624 | masse( i , jjp1 , l ) = xps |
---|
1625 | ENDDO |
---|
1626 | ENDDO |
---|
1627 | endif |
---|
1628 | phis(iip1,:) = phis(1,:) |
---|
1629 | |
---|
1630 | CALL inidissip ( lstardis, nitergdiv, nitergrot, niterh, |
---|
1631 | * tetagdiv, tetagrot , tetatemp ) |
---|
1632 | itau=0 |
---|
1633 | if (choix_1.eq.0) then |
---|
1634 | day_ini=int(date) |
---|
1635 | hour_ini=date-int(date) |
---|
1636 | endif |
---|
1637 | c |
---|
1638 | CALL geopot ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
1639 | |
---|
1640 | CALL caldyn0( itau,ucov,vcov,teta,ps,masse,pk,phis , |
---|
1641 | * phi,w, pbaru,pbarv,day_ini+time ) |
---|
1642 | c CALL caldyn |
---|
1643 | c $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , |
---|
1644 | c $ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, day_ini ) |
---|
1645 | |
---|
1646 | CALL dynredem0("restart.nc",day_ini,anneeref,phis,nqtot) |
---|
1647 | CALL dynredem1("restart.nc",hour_ini,vcov,ucov,teta,q, |
---|
1648 | . nqtot,masse,ps) |
---|
1649 | C |
---|
1650 | C Ecriture etat initial physique |
---|
1651 | C |
---|
1652 | |
---|
1653 | call physdem0("restartfi.nc",lonfi,latfi,nsoilmx,ngridmx,llm, |
---|
1654 | . nqtot,dtphys,real(day_ini),0.0, |
---|
1655 | . airefi,albfi,ithfi,zmea,zstd,zsig,zgam,zthe) |
---|
1656 | call physdem1("restartfi.nc",nsoilmx,ngridmx,llm,nqtot, |
---|
1657 | . dtphys,hour_ini, |
---|
1658 | . tsurf,tsoil,co2ice,emis,q2,qsurf,tauscaling) |
---|
1659 | |
---|
1660 | c======================================================================= |
---|
1661 | c Formats |
---|
1662 | c======================================================================= |
---|
1663 | |
---|
1664 | 1 FORMAT(//10x,'la valeur de im =',i4,2x,'lue sur le fichier de dema |
---|
1665 | *rrage est differente de la valeur parametree iim =',i4//) |
---|
1666 | 2 FORMAT(//10x,'la valeur de jm =',i4,2x,'lue sur le fichier de dema |
---|
1667 | *rrage est differente de la valeur parametree jjm =',i4//) |
---|
1668 | 3 FORMAT(//10x,'la valeur de lllm =',i4,2x,'lue sur le fichier demar |
---|
1669 | *rage est differente de la valeur parametree llm =',i4//) |
---|
1670 | |
---|
1671 | write(*,*) "newstart: All is well that ends well." |
---|
1672 | |
---|
1673 | end |
---|
1674 | |
---|
1675 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
1676 | subroutine load_MONS_data(MONS_Hdn,MONS_d21) |
---|
1677 | implicit none |
---|
1678 | ! routine to load Benedicte Diez MONS dataset, fill in date in southern |
---|
1679 | ! polar region, and interpolate the result onto the GCM grid |
---|
1680 | #include"dimensions.h" |
---|
1681 | #include"paramet.h" |
---|
1682 | #include"datafile.h" |
---|
1683 | #include"comgeom.h" |
---|
1684 | ! arguments: |
---|
1685 | real,intent(out) :: MONS_Hdn(iip1,jjp1) ! Hdn: %WEH=Mass fraction of H2O |
---|
1686 | real,intent(out) :: MONS_d21(iip1,jjp1) ! ice table "depth" (in kg/m2) |
---|
1687 | ! N.B MONS datasets should be of dimension (iip1,jjp1) |
---|
1688 | ! local variables: |
---|
1689 | character(len=88) :: filename="results_MONS_lat_lon_H_depth.txt" |
---|
1690 | character(len=88) :: txt ! to store some text |
---|
1691 | integer :: ierr,i,j |
---|
1692 | integer,parameter :: nblon=180 ! number of longitudes of MONS datasets |
---|
1693 | integer,parameter :: nblat=90 ! number of latitudes of MONS datasets |
---|
1694 | real :: pi |
---|
1695 | real :: longitudes(nblon) ! MONS dataset longitudes |
---|
1696 | real :: latitudes(nblat) ! MONS dataset latitudes |
---|
1697 | ! MONS dataset: mass fraction of H2O where H is assumed to be in H2O |
---|
1698 | real :: Hdn(nblon,nblat) |
---|
1699 | real :: d21(nblon,nblat)! MONS dataset "depth" (g/cm2) |
---|
1700 | |
---|
1701 | ! Extended MONS dataset (for interp_horiz) |
---|
1702 | real :: Hdnx(nblon+1,nblat) |
---|
1703 | real :: d21x(nblon+1,nblat) |
---|
1704 | real :: lon_bound(nblon+1) ! longitude boundaries |
---|
1705 | real :: lat_bound(nblat-1) ! latitude boundaries |
---|
1706 | |
---|
1707 | ! 1. Initializations: |
---|
1708 | |
---|
1709 | write(*,*) "Loading MONS data" |
---|
1710 | |
---|
1711 | ! Open MONS datafile: |
---|
1712 | open(42,file=trim(datafile)//"/"//trim(filename), |
---|
1713 | & status="old",iostat=ierr) |
---|
1714 | if (ierr/=0) then |
---|
1715 | write(*,*) "Error in load_MONS_data:" |
---|
1716 | write(*,*) "Failed opening file ", |
---|
1717 | & trim(datafile)//"/"//trim(filename) |
---|
1718 | write(*,*)'1) You can change the path to the file in ' |
---|
1719 | write(*,*)' file phymars/datafile.h' |
---|
1720 | write(*,*)'2) If necessary ',trim(filename), |
---|
1721 | & ' (and other datafiles)' |
---|
1722 | write(*,*)' can be obtained online at:' |
---|
1723 | write(*,*)'http://www.lmd.jussieu.fr/~lmdz/planets/mars/datadir' |
---|
1724 | CALL ABORT |
---|
1725 | else ! skip first line of file (dummy read) |
---|
1726 | read(42,*) txt |
---|
1727 | endif |
---|
1728 | |
---|
1729 | pi=2.*asin(1.) |
---|
1730 | |
---|
1731 | !2. Load MONS data (on MONS grid) |
---|
1732 | do j=1,nblat |
---|
1733 | do i=1,nblon |
---|
1734 | ! swap latitude index so latitudes go from north pole to south pole: |
---|
1735 | read(42,*) latitudes(nblat-j+1),longitudes(i), |
---|
1736 | & Hdn(i,nblat-j+1),d21(i,nblat-j+1) |
---|
1737 | ! multiply d21 by 10 to convert from g/cm2 to kg/m2 |
---|
1738 | d21(i,nblat-j+1)=d21(i,nblat-j+1)*10.0 |
---|
1739 | enddo |
---|
1740 | enddo |
---|
1741 | close(42) |
---|
1742 | |
---|
1743 | ! there is unfortunately no d21 data for latitudes -77 to -90 |
---|
1744 | ! so we build some by linear interpolation between values at -75 |
---|
1745 | ! and assuming d21=0 at the pole |
---|
1746 | do j=84,90 ! latitudes(84)=-77 ; latitudes(83)=-75 |
---|
1747 | do i=1,nblon |
---|
1748 | d21(i,j)=d21(i,83)*((latitudes(j)+90)/15.0) |
---|
1749 | enddo |
---|
1750 | enddo |
---|
1751 | |
---|
1752 | ! 3. Build extended MONS dataset & boundaries (for interp_horiz) |
---|
1753 | ! longitude boundaries (in radians): |
---|
1754 | do i=1,nblon |
---|
1755 | ! NB: MONS data is every 2 degrees in longitude |
---|
1756 | lon_bound(i)=(longitudes(i)+1.0)*pi/180.0 |
---|
1757 | enddo |
---|
1758 | ! extra 'modulo' value |
---|
1759 | lon_bound(nblon+1)=lon_bound(1)+2.0*pi |
---|
1760 | |
---|
1761 | ! latitude boundaries (in radians): |
---|
1762 | do j=1,nblat-1 |
---|
1763 | ! NB: Mons data is every 2 degrees in latitude |
---|
1764 | lat_bound(j)=(latitudes(j)-1.0)*pi/180.0 |
---|
1765 | enddo |
---|
1766 | |
---|
1767 | ! MONS datasets: |
---|
1768 | do j=1,nblat |
---|
1769 | Hdnx(1:nblon,j)=Hdn(1:nblon,j) |
---|
1770 | Hdnx(nblon+1,j)=Hdnx(1,j) |
---|
1771 | d21x(1:nblon,j)=d21(1:nblon,j) |
---|
1772 | d21x(nblon+1,j)=d21x(1,j) |
---|
1773 | enddo |
---|
1774 | |
---|
1775 | ! Interpolate onto GCM grid |
---|
1776 | call interp_horiz(Hdnx,MONS_Hdn,nblon,nblat-1,iim,jjm,1, |
---|
1777 | & lon_bound,lat_bound,rlonu,rlatv) |
---|
1778 | call interp_horiz(d21x,MONS_d21,nblon,nblat-1,iim,jjm,1, |
---|
1779 | & lon_bound,lat_bound,rlonu,rlatv) |
---|
1780 | |
---|
1781 | end subroutine |
---|