1 | PROGRAM testphys1d |
---|
2 | |
---|
3 | use radcommon_h, only: tauvis |
---|
4 | ! to use 'getin' |
---|
5 | USE ioipsl_getincom |
---|
6 | |
---|
7 | IMPLICIT NONE |
---|
8 | |
---|
9 | !================================================================== |
---|
10 | ! |
---|
11 | ! Purpose |
---|
12 | ! ------- |
---|
13 | ! Run the physics package of the universal model in a 1D column. |
---|
14 | ! |
---|
15 | ! It can be compiled with a command like (e.g. for 25 layers): |
---|
16 | ! "makegcm -p mars -d 25 testphys1d" |
---|
17 | ! It requires the files "callphys.def", "z2sig.def", |
---|
18 | ! "traceur.def", and "run1d.def" with a line "INCLUDEDEF=callphys.def" |
---|
19 | ! |
---|
20 | ! Authors |
---|
21 | ! ------- |
---|
22 | ! Frederic Hourdin |
---|
23 | ! R. Fournier |
---|
24 | ! F. Forget |
---|
25 | ! F. Montmessin (water ice added) |
---|
26 | |
---|
27 | !================================================================== |
---|
28 | |
---|
29 | #include "dimensions.h" |
---|
30 | #include "dimphys.h" |
---|
31 | #include "comgeomfi.h" |
---|
32 | #include "surfdat.h" |
---|
33 | #include "comsoil.h" |
---|
34 | #include "comdiurn.h" |
---|
35 | #include "callkeys.h" |
---|
36 | #include "comcstfi.h" |
---|
37 | #include "planete.h" |
---|
38 | #include "comsaison.h" |
---|
39 | #include "control.h" |
---|
40 | #include "comvert.h" |
---|
41 | #include "netcdf.inc" |
---|
42 | #include "comg1d.h" |
---|
43 | #include "watercap.h" |
---|
44 | #include "fisice.h" |
---|
45 | #include "logic.h" |
---|
46 | #include "advtrac.h" |
---|
47 | |
---|
48 | c -------------------------------------------------------------- |
---|
49 | c Declarations |
---|
50 | c -------------------------------------------------------------- |
---|
51 | c |
---|
52 | INTEGER unitstart ! unite d'ecriture de "startfi" |
---|
53 | INTEGER nlayer,nlevel,nsoil,ndt |
---|
54 | INTEGER ilayer,ilevel,isoil,idt,iq |
---|
55 | LOGICAl firstcall,lastcall |
---|
56 | c |
---|
57 | INTEGER day0 ! date initial (sol ; =0 a Ls=0) |
---|
58 | REAL day ! date durant le run |
---|
59 | REAL time ! time (0<time<1 ; time=0.5 a midi) |
---|
60 | REAL play(nlayermx) ! Pressure at the middle of the layers (Pa) |
---|
61 | REAL plev(nlayermx+1) ! intermediate pressure levels (pa) |
---|
62 | REAL psurf,tsurf |
---|
63 | REAL u(nlayermx),v(nlayermx) ! zonal, meridional wind |
---|
64 | REAL gru,grv ! prescribed "geostrophic" background wind |
---|
65 | REAL temp(nlayermx) ! temperature at the middle of the layers |
---|
66 | REAL q(nlayermx,nqmx) ! tracer mixing ratio (e.g. kg/kg) |
---|
67 | REAL qsurf(nqmx) ! tracer surface budget (e.g. kg.m-2) |
---|
68 | REAL tsoil(nsoilmx) ! subsurface soik temperature (K) |
---|
69 | ! REAL co2ice ! co2ice layer (kg.m-2) !not used anymore |
---|
70 | integer :: i_co2_ice=0 ! tracer index of co2 ice |
---|
71 | integer :: i_h2o_ice=0 ! tracer index of co2 ice |
---|
72 | REAL emis ! surface layer |
---|
73 | REAL q2(nlayermx+1) ! Turbulent Kinetic Energy |
---|
74 | REAL zlay(nlayermx) ! altitude estimee dans les couches (km) |
---|
75 | |
---|
76 | c Physical and dynamical tandencies (e.g. m.s-2, K/s, Pa/s) |
---|
77 | REAL du(nlayermx),dv(nlayermx),dtemp(nlayermx) |
---|
78 | REAL dudyn(nlayermx),dvdyn(nlayermx),dtempdyn(nlayermx) |
---|
79 | REAL dpsurf |
---|
80 | REAL dq(nlayermx,nqmx) |
---|
81 | REAL dqdyn(nlayermx,nqmx) |
---|
82 | |
---|
83 | c Various intermediate variables |
---|
84 | ! INTEGER thermo |
---|
85 | REAL zls |
---|
86 | REAL phi(nlayermx),h(nlayermx),s(nlayermx) |
---|
87 | REAL pks, ptif, w(nlayermx) |
---|
88 | REAL qtotinit, mqtot(nqmx),qtot |
---|
89 | INTEGER ierr, aslun |
---|
90 | REAL tmp1(0:nlayermx),tmp2(0:nlayermx) |
---|
91 | Logical tracerdyn |
---|
92 | integer :: nq=1 ! number of tracers |
---|
93 | |
---|
94 | character*2 str2 |
---|
95 | character (len=7) :: str7 |
---|
96 | |
---|
97 | logical oldcompare, earthhack,saveprofile |
---|
98 | |
---|
99 | ! added by RW for zlay computation |
---|
100 | real Hscale, rho, dz |
---|
101 | |
---|
102 | |
---|
103 | ! added by RDW to allow variations in cp with location |
---|
104 | REAL cpp3D(ngridmx,nlayermx) ! specific heat capacity at const. pressure |
---|
105 | REAL rcp3D(ngridmx,nlayermx) ! R / specific heat capacity |
---|
106 | |
---|
107 | c======================================================================= |
---|
108 | |
---|
109 | c======================================================================= |
---|
110 | c INITIALISATION |
---|
111 | c======================================================================= |
---|
112 | |
---|
113 | saveprofile=.true. |
---|
114 | |
---|
115 | c ------------------------------------------------------ |
---|
116 | c Default values for constants (corresponding to Mars) |
---|
117 | c ------------------------------------------------------ |
---|
118 | |
---|
119 | pi=2.E+0*asin(1.E+0) |
---|
120 | |
---|
121 | c Constante de la Planete Mars |
---|
122 | c ---------------------------- |
---|
123 | rad=3397200. ! rayon de mars (m) ~3397200 m |
---|
124 | daysec=88775. ! duree du sol (s) ~88775 s |
---|
125 | omeg=4.*asin(1.)/(daysec) ! vitesse de rotation (rad.s-1) |
---|
126 | g=3.72 ! gravite (m.s-2) ~3.72 |
---|
127 | mugaz=43.49 ! Masse molaire de l'atm (g.mol-1) ~43.49 |
---|
128 | rcp=.256793 ! = r/cp ~0.256793 |
---|
129 | r= 8.314511E+0 *1000.E+0/mugaz |
---|
130 | cpp= r/rcp |
---|
131 | year_day = 669 ! duree de l'annee (sols) ~668.6 |
---|
132 | periheli = 206.66 ! dist.min. soleil-mars (Mkm) ~206.66 |
---|
133 | aphelie = 249.22 ! dist.max. soleil-mars (Mkm) ~249.22 |
---|
134 | peri_day = 485. ! date du perihelie (sols depuis printemps) |
---|
135 | obliquit = 25.2 ! Obliquite de la planete (deg) ~25.2 |
---|
136 | |
---|
137 | c Parametres Couche limite et Turbulence |
---|
138 | c -------------------------------------- |
---|
139 | z0 = 1.e-2 ! surface roughness (m) ~0.01 |
---|
140 | emin_turb = 1.e-6 ! energie minimale ~1.e-8 |
---|
141 | lmixmin = 30 ! longueur de melange ~100 |
---|
142 | |
---|
143 | c propriete optiques des calottes et emissivite du sol |
---|
144 | c ---------------------------------------------------- |
---|
145 | emissiv= 0.95 ! Emissivite du sol martien ~.95 |
---|
146 | emisice(1)=0.95 ! Emissivite calotte nord |
---|
147 | emisice(2)=0.95 ! Emissivite calotte sud |
---|
148 | |
---|
149 | albedice(1)=0.5 ! Albedo calotte nord |
---|
150 | albedice(2)=0.5 ! Albedo calotte sud |
---|
151 | iceradius(1) = 100.e-6 ! mean scat radius of CO2 snow (north) |
---|
152 | iceradius(2) = 100.e-6 ! mean scat radius of CO2 snow (south) |
---|
153 | dtemisice(1) = 2. ! time scale for snow metamorphism (north) |
---|
154 | dtemisice(2) = 2. ! time scale for snow metamorphism (south |
---|
155 | hybrid=.false. |
---|
156 | |
---|
157 | ! Constants for stokes.F90 |
---|
158 | molrad=2.2e-10 ! CO2 only!!! |
---|
159 | visc=1.e-5 ! CO2 only!!! |
---|
160 | |
---|
161 | print*,'Warning, stokes.F constants are defined for pure CO2.' |
---|
162 | |
---|
163 | |
---|
164 | |
---|
165 | c ------------------------------------------------------ |
---|
166 | c Load parameters from "run.def" |
---|
167 | c ------------------------------------------------------ |
---|
168 | |
---|
169 | ! also check if 'run1d.def' file is around (otherwise reading parameters |
---|
170 | ! from callphys.def via getin() routine won't work. |
---|
171 | open(90,file='run.def',status='old',form='formatted', |
---|
172 | & iostat=ierr) |
---|
173 | if (ierr.ne.0) then |
---|
174 | write(*,*) 'Cannot find required file "run.def"' |
---|
175 | write(*,*) ' (which should contain some input parameters' |
---|
176 | write(*,*) ' along with the following line:' |
---|
177 | write(*,*) ' INCLUDEDEF=callphys.def' |
---|
178 | write(*,*) ' )' |
---|
179 | write(*,*) ' ... might as well stop here ...' |
---|
180 | stop |
---|
181 | else |
---|
182 | close(90) |
---|
183 | endif |
---|
184 | |
---|
185 | ! check if we are going to run with or without tracers |
---|
186 | write(*,*) "Run with or without tracer transport ?" |
---|
187 | tracer=.false. ! default value |
---|
188 | call getin("tracer",tracer) |
---|
189 | write(*,*) " tracer = ",tracer |
---|
190 | |
---|
191 | ! while we're at it, check if there is a 'traceur.def' file |
---|
192 | ! and preocess it, if necessary. Otherwise initialize tracer names |
---|
193 | if (tracer) then |
---|
194 | ! load tracer names from file 'traceur.def' |
---|
195 | open(90,file='traceur.def',status='old',form='formatted', |
---|
196 | & iostat=ierr) |
---|
197 | if (ierr.eq.0) then |
---|
198 | write(*,*) "testphys1d: Reading file traceur.def" |
---|
199 | ! read number of tracers: |
---|
200 | read(90,*,iostat=ierr) nq |
---|
201 | if (ierr.ne.0) then |
---|
202 | write(*,*) "testphys1d: error reading number of tracers" |
---|
203 | write(*,*) " (first line of traceur.def) " |
---|
204 | stop |
---|
205 | else |
---|
206 | ! check that the number of tracers is indeed nqmx |
---|
207 | if (nq.ne.nqmx) then |
---|
208 | write(*,*) "testphys1d: error, wrong number of tracers:" |
---|
209 | write(*,*) "nq=",nq," whereas nqmx=",nqmx |
---|
210 | stop |
---|
211 | endif |
---|
212 | endif |
---|
213 | |
---|
214 | ! initialize advection schemes to Van-Leer for all tracers |
---|
215 | do iq=1,nq |
---|
216 | iadv(iq)=3 ! Van-Leer |
---|
217 | enddo |
---|
218 | |
---|
219 | do iq=1,nq |
---|
220 | ! minimal version, just read in the tracer names, 1 per line |
---|
221 | read(90,*,iostat=ierr) tnom(iq) |
---|
222 | if (ierr.ne.0) then |
---|
223 | write(*,*) 'testphys1d: error reading tracer names...' |
---|
224 | stop |
---|
225 | endif |
---|
226 | enddo !of do iq=1,nq |
---|
227 | ! check for co2_ice / h2o_ice tracers: |
---|
228 | i_co2_ice=0 |
---|
229 | i_h2o_ice=0 |
---|
230 | do iq=1,nq |
---|
231 | if (tnom(iq)=="co2_ice") then |
---|
232 | i_co2_ice=iq |
---|
233 | elseif (tnom(iq)=="h2o_ice") then |
---|
234 | i_h2o_ice=iq |
---|
235 | endif |
---|
236 | enddo |
---|
237 | !if (i_co2_ice==0) then |
---|
238 | ! write(*,*) "testphys1d: error, we need a 'co2_ice' tracer" |
---|
239 | ! write(*,*) " (add one to traceur.def)" |
---|
240 | ! stop |
---|
241 | !endif |
---|
242 | else |
---|
243 | write(*,*) 'Cannot find required file "traceur.def"' |
---|
244 | write(*,*) ' If you want to run with tracers, I need it' |
---|
245 | write(*,*) ' ... might as well stop here ...' |
---|
246 | stop |
---|
247 | endif |
---|
248 | close(90) |
---|
249 | |
---|
250 | else |
---|
251 | ! we still need to set (dummy) tracer names for physdem1 |
---|
252 | nq=nqmx |
---|
253 | do iq=1,nq |
---|
254 | write(str7,'(a1,i2.2)')'q',iq |
---|
255 | tnom(iq)=str7 |
---|
256 | enddo |
---|
257 | ! actually, we'll need at least one "co2_ice" tracer |
---|
258 | ! (for surface CO2 ice) |
---|
259 | tnom(1)="co2_ice" |
---|
260 | i_co2_ice=1 |
---|
261 | endif ! of if (tracer) |
---|
262 | |
---|
263 | c Date et heure locale du debut du run |
---|
264 | c ------------------------------------ |
---|
265 | c Date (en sols depuis le solstice de printemps) du debut du run |
---|
266 | day0 = 0 ! default value for day0 |
---|
267 | write(*,*) 'Initial date (in martian sols ; =0 at Ls=0)?' |
---|
268 | call getin("day0",day0) |
---|
269 | day=float(day0) |
---|
270 | write(*,*) " day0 = ",day0 |
---|
271 | c Heure de demarrage |
---|
272 | time=0 ! default value for time |
---|
273 | write(*,*)'Initial local time (in hours, between 0 and 24)?' |
---|
274 | call getin("time",time) |
---|
275 | write(*,*)" time = ",time |
---|
276 | time=time/24.E+0 ! convert time (hours) to fraction of sol |
---|
277 | |
---|
278 | c Discretisation (Definition de la grille et des pas de temps) |
---|
279 | c -------------- |
---|
280 | c |
---|
281 | nlayer=nlayermx |
---|
282 | nlevel=nlayer+1 |
---|
283 | nsoil=nsoilmx |
---|
284 | |
---|
285 | day_step=48 ! default value for day_step |
---|
286 | PRINT *,'Number of time steps per sol ?' |
---|
287 | call getin("day_step",day_step) |
---|
288 | write(*,*) " day_step = ",day_step |
---|
289 | |
---|
290 | ndt=10 ! default value for ndt |
---|
291 | PRINT *,'Number of sols to run ?' |
---|
292 | call getin("ndt",ndt) |
---|
293 | write(*,*) " ndt = ",ndt |
---|
294 | |
---|
295 | ndt=ndt*day_step |
---|
296 | dtphys=daysec/day_step |
---|
297 | c Pression de surface sur la planete |
---|
298 | c ------------------------------------ |
---|
299 | c |
---|
300 | psurf=610. ! default value for psurf |
---|
301 | PRINT *,'Surface pressure (Pa) ?' |
---|
302 | call getin("psurf",psurf) |
---|
303 | write(*,*) " psurf = ",psurf |
---|
304 | c Pression de reference |
---|
305 | ! pa=20. |
---|
306 | ! preff=610. ! these values are not needed in 1D |
---|
307 | |
---|
308 | c Gravity of planet |
---|
309 | c ----------------- |
---|
310 | g=3.72 ! default value for g |
---|
311 | PRINT *,'Gravity ?' |
---|
312 | call getin("g",g) |
---|
313 | write(*,*) " g = ",g |
---|
314 | |
---|
315 | c Molar mass of atmosphere |
---|
316 | c ------------------------ |
---|
317 | mugaz=44.01 ! default value = for CO2 |
---|
318 | PRINT *,'Molar mass of atmosphere ?' |
---|
319 | call getin("mugaz",mugaz) |
---|
320 | write(*,*) " mugaz = ",mugaz |
---|
321 | |
---|
322 | c Specific heat capacity of atmosphere |
---|
323 | c ------------------------------------ |
---|
324 | cpp=744.0 ! default value = for CO2 |
---|
325 | PRINT *,'Specific heat capacity of atmosphere ?' |
---|
326 | call getin("cpp",cpp) |
---|
327 | write(*,*) " cpp = ",cpp |
---|
328 | |
---|
329 | r= 8.314511E+0 *1000.E+0/mugaz |
---|
330 | rcp=r/cpp |
---|
331 | |
---|
332 | c Proprietes des poussiere aerosol |
---|
333 | c -------------------------------- |
---|
334 | tauvis=0.2 ! default value for tauvis |
---|
335 | print *,'Reference dust opacity at 700 Pa ?' |
---|
336 | call getin("tauvis",tauvis) |
---|
337 | write(*,*) " tauvis = ",tauvis |
---|
338 | |
---|
339 | c latitude/longitude |
---|
340 | c ------------------ |
---|
341 | lati(1)=0 ! default value for lati(1) |
---|
342 | PRINT *,'latitude (in degrees) ?' |
---|
343 | call getin("latitude",lati(1)) |
---|
344 | write(*,*) " latitude = ",lati(1) |
---|
345 | lati(1)=lati(1)*pi/180.E+0 |
---|
346 | long(1)=0.E+0 |
---|
347 | long(1)=long(1)*pi/180.E+0 |
---|
348 | |
---|
349 | c periastron/apoastron |
---|
350 | c -------------------- |
---|
351 | periheli=227.94 |
---|
352 | aphelie=227.94 ! default=mean martian values |
---|
353 | PRINT *,'periastron (in AU) ?' |
---|
354 | call getin("periheli",periheli) |
---|
355 | write(*,*) "periastron = ",periheli |
---|
356 | periheli=periheli*149.598 ! AU to Mkm |
---|
357 | PRINT *,'apoastron (in AU) ?' |
---|
358 | call getin("aphelie",aphelie) |
---|
359 | write(*,*) "apoastron = ",aphelie |
---|
360 | aphelie=aphelie*149.598 ! AU to Mkm |
---|
361 | |
---|
362 | c obliquity |
---|
363 | c --------- |
---|
364 | obliquit=0.0! default=zero in 1d |
---|
365 | PRINT *,'obliquity (in AU) ?' |
---|
366 | call getin("obliquit",obliquit) |
---|
367 | write(*,*) "obliquity = ",obliquit |
---|
368 | |
---|
369 | c Initialisation albedo / inertie du sol |
---|
370 | c -------------------------------------- |
---|
371 | albedodat(1)=0.2 ! default value for albedodat |
---|
372 | PRINT *,'Albedo of bare ground ?' |
---|
373 | call getin("albedo",albedodat(1)) |
---|
374 | write(*,*) " albedo = ",albedodat(1) |
---|
375 | |
---|
376 | inertiedat(1,1)=400 ! default value for inertiedat |
---|
377 | PRINT *,'Soil thermal inertia (SI) ?' |
---|
378 | call getin("inertia",inertiedat(1,1)) |
---|
379 | write(*,*) " inertia = ",inertiedat(1,1) |
---|
380 | c |
---|
381 | c pour le schema d'ondes de gravite |
---|
382 | c --------------------------------- |
---|
383 | c |
---|
384 | zmea(1)=0.E+0 |
---|
385 | zstd(1)=0.E+0 |
---|
386 | zsig(1)=0.E+0 |
---|
387 | zgam(1)=0.E+0 |
---|
388 | zthe(1)=0.E+0 |
---|
389 | |
---|
390 | c Initialisation des traceurs |
---|
391 | c --------------------------- |
---|
392 | |
---|
393 | DO iq=1,nqmx |
---|
394 | DO ilayer=1,nlayer |
---|
395 | q(ilayer,iq) = 0. |
---|
396 | ENDDO |
---|
397 | ENDDO |
---|
398 | |
---|
399 | DO iq=1,nqmx |
---|
400 | qsurf(iq) = 0. |
---|
401 | ENDDO |
---|
402 | |
---|
403 | c Initialisation speciales "physiq" |
---|
404 | c --------------------------------- |
---|
405 | c la surface de chaque maille est inutile en 1D ---> |
---|
406 | area(1)=1.E+0 |
---|
407 | |
---|
408 | c le geopotentiel au sol est inutile en 1D car tout est controle |
---|
409 | c par la pression de surface ---> |
---|
410 | phisfi(1)=0.E+0 |
---|
411 | |
---|
412 | c "inifis" reproduit un certain nombre d'initialisations deja faites |
---|
413 | c + lecture des clefs de callphys.def |
---|
414 | c + calcul de la frequence d'appel au rayonnement |
---|
415 | c + calcul des sinus et cosinus des longitude latitude |
---|
416 | |
---|
417 | !Mars possible issue with dtphys in input and include!!! |
---|
418 | CALL inifis(1,llm,day0,daysec,dtphys, |
---|
419 | . lati,long,area,rad,g,r,cpp) |
---|
420 | c Initialisation pour prendre en compte les vents en 1-D |
---|
421 | c ------------------------------------------------------ |
---|
422 | ptif=2.E+0*omeg*sinlat(1) |
---|
423 | |
---|
424 | |
---|
425 | c vent geostrophique |
---|
426 | gru=10. ! default value for gru |
---|
427 | PRINT *,'zonal eastward component of the geostrophic wind (m/s) ?' |
---|
428 | call getin("u",gru) |
---|
429 | write(*,*) " u = ",gru |
---|
430 | grv=0. !default value for grv |
---|
431 | PRINT *,'meridional northward component of the geostrophic', |
---|
432 | &' wind (m/s) ?' |
---|
433 | call getin("v",grv) |
---|
434 | write(*,*) " v = ",grv |
---|
435 | |
---|
436 | c Initialisation des vents au premier pas de temps |
---|
437 | DO ilayer=1,nlayer |
---|
438 | u(ilayer)=gru |
---|
439 | v(ilayer)=grv |
---|
440 | ENDDO |
---|
441 | |
---|
442 | c energie cinetique turbulente |
---|
443 | DO ilevel=1,nlevel |
---|
444 | q2(ilevel)=0.E+0 |
---|
445 | ENDDO |
---|
446 | |
---|
447 | c emissivity / surface co2 ice ( + h2o ice??) |
---|
448 | c ------------------------------------------- |
---|
449 | emis=emissiv ! default value for emissivity |
---|
450 | PRINT *,'Emissivity of bare ground ?' |
---|
451 | call getin("emis",emis) |
---|
452 | write(*,*) " emis = ",emis |
---|
453 | emissiv=emis ! we do this so that condense_co2 sets things to the right |
---|
454 | ! value if there is no snow |
---|
455 | |
---|
456 | if(i_co2_ice.gt.0)then |
---|
457 | qsurf(i_co2_ice)=0 ! default value for co2ice |
---|
458 | print*,'Initial CO2 ice on the surface (kg.m-2)' |
---|
459 | call getin("co2ice",qsurf(i_co2_ice)) |
---|
460 | write(*,*) " co2ice = ",qsurf(i_co2_ice) |
---|
461 | IF (qsurf(i_co2_ice).ge.1.E+0) THEN |
---|
462 | ! if we have some CO2 ice on the surface, change emissivity |
---|
463 | if (lati(1).ge.0) then ! northern hemisphere |
---|
464 | emis=emisice(1) |
---|
465 | else ! southern hemisphere |
---|
466 | emis=emisice(2) |
---|
467 | endif |
---|
468 | ENDIF |
---|
469 | endif |
---|
470 | |
---|
471 | c calcul des pressions et altitudes en utilisant les niveaux sigma |
---|
472 | c ---------------------------------------------------------------- |
---|
473 | |
---|
474 | c Vertical Coordinates |
---|
475 | c """""""""""""""""""" |
---|
476 | hybrid=.true. |
---|
477 | PRINT *,'Hybrid coordinates ?' |
---|
478 | call getin("hybrid",hybrid) |
---|
479 | write(*,*) " hybrid = ", hybrid |
---|
480 | |
---|
481 | CALL disvert |
---|
482 | |
---|
483 | ! we want only the scale height from z2sig, in order to compute zlay |
---|
484 | open(91,file="z2sig.def",form='formatted') |
---|
485 | read(91,*) Hscale |
---|
486 | close(91) |
---|
487 | |
---|
488 | DO ilevel=1,nlevel |
---|
489 | plev(ilevel)=ap(ilevel)+psurf*bp(ilevel) |
---|
490 | ENDDO |
---|
491 | |
---|
492 | DO ilayer=1,nlayer |
---|
493 | play(ilayer)=aps(ilayer)+psurf*bps(ilayer) |
---|
494 | ENDDO |
---|
495 | |
---|
496 | DO ilayer=1,nlayer |
---|
497 | ! zlay(ilayer)=-300.E+0 *r*log(play(ilayer)/plev(1)) |
---|
498 | ! & /g |
---|
499 | zlay(ilayer)=-1000.0*Hscale*log(play(ilayer)/plev(1)) |
---|
500 | ENDDO |
---|
501 | |
---|
502 | |
---|
503 | c profil de temperature au premier appel |
---|
504 | c -------------------------------------- |
---|
505 | pks=psurf**rcp |
---|
506 | |
---|
507 | c altitude en km dans profile: on divise zlay par 1000 |
---|
508 | tmp1(0)=0.E+0 |
---|
509 | DO ilayer=1,nlayer |
---|
510 | tmp1(ilayer)=zlay(ilayer)/1000.E+0 |
---|
511 | ENDDO |
---|
512 | call profile(nlayer+1,tmp1,tmp2) |
---|
513 | |
---|
514 | tsurf=tmp2(0) |
---|
515 | DO ilayer=1,nlayer |
---|
516 | temp(ilayer)=tmp2(ilayer) |
---|
517 | ENDDO |
---|
518 | |
---|
519 | |
---|
520 | |
---|
521 | ! Initialize soil properties and temperature |
---|
522 | ! ------------------------------------------ |
---|
523 | volcapa=1.e6 ! volumetric heat capacity |
---|
524 | DO isoil=1,nsoil |
---|
525 | inertiedat(1,isoil)=inertiedat(1,1) ! soil thermal inertia |
---|
526 | tsoil(isoil)=tsurf ! soil temperature |
---|
527 | ENDDO |
---|
528 | |
---|
529 | ! Initialize depths |
---|
530 | ! ----------------- |
---|
531 | do isoil=0,nsoil-1 |
---|
532 | mlayer(isoil)=2.e-4*(2.**(isoil-0.5)) ! mid-layer depth |
---|
533 | enddo |
---|
534 | do isoil=1,nsoil |
---|
535 | layer(isoil)=2.e-4*(2.**(isoil-1)) ! layer depth |
---|
536 | enddo |
---|
537 | |
---|
538 | c Initialisation pour les sorties GRADS dans "g1d.dat" et "g1d.ctl" |
---|
539 | c ---------------------------------------------------------------- |
---|
540 | c (effectuee avec "writeg1d" a partir de "physiq.F" |
---|
541 | c ou tout autre subroutine physique, y compris celle ci). |
---|
542 | |
---|
543 | g1d_nlayer=nlayer |
---|
544 | g1d_nomfich='g1d.dat' |
---|
545 | g1d_unitfich=40 |
---|
546 | g1d_nomctl='g1d.ctl' |
---|
547 | g1d_unitctl=41 |
---|
548 | g1d_premier=.true. |
---|
549 | g2d_premier=.true. |
---|
550 | |
---|
551 | c Ecriture de "startfi" |
---|
552 | c -------------------- |
---|
553 | c (Ce fichier sera aussitot relu au premier |
---|
554 | c appel de "physiq", mais il est necessaire pour passer |
---|
555 | c les variables purement physiques a "physiq"... |
---|
556 | |
---|
557 | call physdem1("startfi.nc",long,lati,nsoilmx,nqmx, |
---|
558 | . dtphys,float(day0), |
---|
559 | . time,tsurf,tsoil,emis,q2,qsurf, |
---|
560 | . area,albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe) |
---|
561 | c======================================================================= |
---|
562 | c BOUCLE TEMPORELLE DU MODELE 1D |
---|
563 | c======================================================================= |
---|
564 | |
---|
565 | firstcall=.true. |
---|
566 | lastcall=.false. |
---|
567 | |
---|
568 | DO idt=1,ndt |
---|
569 | IF (idt.eq.ndt-day_step-1) then !test |
---|
570 | lastcall=.true. |
---|
571 | call solarlong(day*1.0,zls) |
---|
572 | write(103,*) 'Ls=',zls*180./pi |
---|
573 | write(103,*) 'Lat=', lati(1)*180./pi |
---|
574 | write(103,*) 'Tau=', tauvis/700*psurf |
---|
575 | write(103,*) 'RunEnd - Atmos. Temp. File' |
---|
576 | write(103,*) 'RunEnd - Atmos. Temp. File' |
---|
577 | write(104,*) 'Ls=',zls*180./pi |
---|
578 | write(104,*) 'Lat=', lati(1) |
---|
579 | write(104,*) 'Tau=', tauvis/700*psurf |
---|
580 | write(104,*) 'RunEnd - Atmos. Temp. File' |
---|
581 | ENDIF |
---|
582 | |
---|
583 | c calcul du geopotentiel |
---|
584 | c ~~~~~~~~~~~~~~~~~~~~~ |
---|
585 | |
---|
586 | if(nonideal)then |
---|
587 | |
---|
588 | DO ilayer=1,nlayer |
---|
589 | call calc_cpp3d(cpp3D(1,ilayer), |
---|
590 | $ rcp3D(1,ilayer),temp(ilayer),play(ilayer)) |
---|
591 | ENDDO |
---|
592 | |
---|
593 | DO ilayer=1,nlayer |
---|
594 | s(ilayer)=(aps(ilayer)/psurf+bps(ilayer))**rcp3D(1,ilayer) |
---|
595 | h(ilayer)=cpp3D(1,ilayer)*temp(ilayer)/(pks*s(ilayer)) |
---|
596 | ENDDO |
---|
597 | |
---|
598 | else |
---|
599 | DO ilayer=1,nlayer |
---|
600 | s(ilayer)=(aps(ilayer)/psurf+bps(ilayer))**rcp |
---|
601 | h(ilayer)=cpp*temp(ilayer)/(pks*s(ilayer)) |
---|
602 | ENDDO |
---|
603 | endif |
---|
604 | ! DO ilayer=1,nlayer |
---|
605 | ! s(ilayer)=(aps(ilayer)/psurf+bps(ilayer))**rcp |
---|
606 | ! h(ilayer)=cpp*temp(ilayer)/(pks*s(ilayer)) |
---|
607 | ! ENDDO |
---|
608 | phi(1)=pks*h(1)*(1.E+0-s(1)) |
---|
609 | DO ilayer=2,nlayer |
---|
610 | phi(ilayer)=phi(ilayer-1)+ |
---|
611 | & pks*(h(ilayer-1)+h(ilayer))*.5E+0 |
---|
612 | & *(s(ilayer-1)-s(ilayer)) |
---|
613 | |
---|
614 | ENDDO |
---|
615 | |
---|
616 | c appel de la physique |
---|
617 | c -------------------- |
---|
618 | |
---|
619 | CALL physiq (1,llm,nqmx, |
---|
620 | , firstcall,lastcall, |
---|
621 | , day,time,dtphys, |
---|
622 | , plev,play,phi, |
---|
623 | , u, v,temp, q, |
---|
624 | , w, |
---|
625 | C - sorties |
---|
626 | s du, dv, dtemp, dq,dpsurf,tracerdyn) |
---|
627 | |
---|
628 | |
---|
629 | c evolution du vent : modele 1D |
---|
630 | c ----------------------------- |
---|
631 | |
---|
632 | c la physique calcule les derivees temporelles de u et v. |
---|
633 | c on y rajoute betement un effet Coriolis. |
---|
634 | c |
---|
635 | c DO ilayer=1,nlayer |
---|
636 | c du(ilayer)=du(ilayer)+ptif*(v(ilayer)-grv) |
---|
637 | c dv(ilayer)=dv(ilayer)+ptif*(-u(ilayer)+gru) |
---|
638 | c ENDDO |
---|
639 | |
---|
640 | c Pour certain test : pas de coriolis a l'equateur |
---|
641 | c if(lati(1).eq.0.) then |
---|
642 | DO ilayer=1,nlayer |
---|
643 | du(ilayer)=du(ilayer)+ (gru-u(ilayer))/1.e4 |
---|
644 | dv(ilayer)=dv(ilayer)+ (grv-v(ilayer))/1.e4 |
---|
645 | ENDDO |
---|
646 | c end if |
---|
647 | c |
---|
648 | c |
---|
649 | c Calcul du temps au pas de temps suivant |
---|
650 | c --------------------------------------- |
---|
651 | firstcall=.false. |
---|
652 | time=time+dtphys/daysec |
---|
653 | IF (time.gt.1.E+0) then |
---|
654 | time=time-1.E+0 |
---|
655 | day=day+1 |
---|
656 | ENDIF |
---|
657 | |
---|
658 | c calcul des vitesses et temperature au pas de temps suivant |
---|
659 | c ---------------------------------------------------------- |
---|
660 | |
---|
661 | DO ilayer=1,nlayer |
---|
662 | u(ilayer)=u(ilayer)+dtphys*du(ilayer) |
---|
663 | v(ilayer)=v(ilayer)+dtphys*dv(ilayer) |
---|
664 | temp(ilayer)=temp(ilayer)+dtphys*dtemp(ilayer) |
---|
665 | ENDDO |
---|
666 | |
---|
667 | c calcul des pressions au pas de temps suivant |
---|
668 | c ---------------------------------------------------------- |
---|
669 | |
---|
670 | psurf=psurf+dtphys*dpsurf ! evolution de la pression de surface |
---|
671 | DO ilevel=1,nlevel |
---|
672 | plev(ilevel)=ap(ilevel)+psurf*bp(ilevel) |
---|
673 | ENDDO |
---|
674 | DO ilayer=1,nlayer |
---|
675 | play(ilayer)=aps(ilayer)+psurf*bps(ilayer) |
---|
676 | ENDDO |
---|
677 | |
---|
678 | c calcul traceur au pas de temps suivant |
---|
679 | c -------------------------------------- |
---|
680 | |
---|
681 | !print*,'dq in testphys1d=',dq*dtphys |
---|
682 | !print*,'q in testphys1d=',q |
---|
683 | |
---|
684 | DO iq = 1, nqmx |
---|
685 | DO ilayer=1,nlayer |
---|
686 | q(ilayer,iq)=q(ilayer,iq)+dtphys*dq(ilayer,iq) |
---|
687 | ENDDO |
---|
688 | END DO |
---|
689 | |
---|
690 | ENDDO ! fin de la boucle temporelle |
---|
691 | |
---|
692 | c ======================================================== |
---|
693 | c GESTION DES SORTIE |
---|
694 | c ======================================================== |
---|
695 | |
---|
696 | c fermeture pour conclure les sorties format grads dans "g1d.dat" |
---|
697 | c et "g1d.ctl" (effectuee avec "writeg1d" a partir de "physiq.F" |
---|
698 | c ou tout autre subroutine physique, y compris celle ci). |
---|
699 | |
---|
700 | |
---|
701 | ! save temperature profile |
---|
702 | if(saveprofile)then |
---|
703 | OPEN(12,file='profile.out',form='formatted') |
---|
704 | write(12,*) tsurf |
---|
705 | DO ilayer=1,nlayermx |
---|
706 | write(12,*) temp(ilayer) |
---|
707 | ENDDO |
---|
708 | CLOSE(12) |
---|
709 | endif |
---|
710 | |
---|
711 | ! here we compute altitude CORRECTLY!!! |
---|
712 | |
---|
713 | ! print*,'zlay=',zlay/1000. |
---|
714 | ! rho = play(1)/(R*tsurf) |
---|
715 | ! zlay(1)=(plev(1)-plev(2))/(g*rho) |
---|
716 | ! do ilayer=2,nlayer |
---|
717 | ! rho = play(ilayer)/(R*temp(ilayer)) |
---|
718 | ! rho = play(ilayer)/(R*230.0) |
---|
719 | ! dz = (plev(ilayer-1)-plev(ilayer))/(g*rho) |
---|
720 | ! zlay(ilayer)=zlay(ilayer-1)+dz |
---|
721 | ! enddo |
---|
722 | ! print*,'zlay=',zlay/1000. |
---|
723 | ! stop |
---|
724 | |
---|
725 | c CALL endg1d(1,nlayer,zphi/(g*1000.),ndt) |
---|
726 | CALL endg1d(1,nlayer,zlay/1000.,ndt) |
---|
727 | |
---|
728 | c ======================================================== |
---|
729 | END |
---|
730 | |
---|
731 | c*********************************************************************** |
---|
732 | c*********************************************************************** |
---|
733 | c Subroutines Bidons utilise seulement en 3D, mais |
---|
734 | c necessaire a la compilation de testphys1d en 1-D |
---|
735 | |
---|
736 | subroutine gr_fi_dyn |
---|
737 | RETURN |
---|
738 | END |
---|
739 | |
---|
740 | c*********************************************************************** |
---|
741 | c*********************************************************************** |
---|
742 | |
---|
743 | #include "../dyn3d/disvert.F" |
---|