--- trunk/libf/dyn3d/gcm.f90 2008/02/27 13:16:39 3 +++ trunk/libf/dyn3d/gcm.f90 2009/12/14 15:25:16 23 @@ -15,21 +15,18 @@ ! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4 ! Pour Van-Leer : iadv=10 - USE IOIPSL, only: ioconf_calendar + USE IOIPSL, only: ioconf_calendar, histclo use dimens_m, only: iim, jjm, llm, nqmx use dimphy, only: klon use paramet_m, only: ip1jm, ip1jmp1 - use comconst, only: daysec, cpp, dtvr, dtphys, g, rad, r, initialize - + use comconst, only: daysec, cpp, dtvr, g, rad, r, initialize use comdissnew, only: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & tetagrot, tetatemp - use conf_gcm_m, only: day_step, iperiod, anneeref, dayref, iecri, iphysiq, & nday, raz_date, periodav, conf_gcm - use logic, only: iflag_phys use comgeom, only: rlatu, aire_2d, cu_2d, cv_2d, rlonv - use temps, only: day_ref, annee_ref, day_ini, day_end, itau_phy, itau_dyn + use temps, only: day_ref, annee_ref, day_ini, day_end, itau_dyn use com_io_dyn, only: histid, histvid, histaveid use tracstoke, only: istdyn, istphy use abort_gcm_m, only: abort_gcm @@ -37,12 +34,13 @@ use initdynav_m, only: initdynav use dynetat0_m, only: dynetat0 use grid_change, only: dyn_phy, init_dyn_phy - use advtrac_m, only: iniadvtrac + use iniadvtrac_m, only: iniadvtrac use leapfrog_m, only: leapfrog + use dynredem0_m, only: dynredem0 + use clesphys2, only: read_clesphys2 IMPLICIT NONE - REAL clesphy0(20) REAL zdtvr ! time step for dynamics, in s ! Variables dynamiques : @@ -52,7 +50,7 @@ REAL ps(ip1jmp1) ! pression au sol (Pa) REAL masse(ip1jmp1, llm) ! masse d'air - REAL phis(ip1jmp1) ! géopotentiel au sol + REAL phis(iim + 1, jjm + 1) ! géopotentiel au sol ! Variables pour le fichier histoire : REAL time_0 @@ -63,7 +61,6 @@ LOGICAL:: true_calendar = .false. ! default value ! Variables pour l'initialisation de la physique : - integer nq REAL zcufi(klon), zcvfi(klon) ! "cu" and "cv" values on the scalar grid REAL latfi(klon), lonfi(klon) REAL airefi(klon) @@ -91,28 +88,15 @@ endif ! Lecture des fichiers "gcm.def" ou "run.def" : - CALL conf_gcm(clesphy0) + call read_clesphys2 + CALL conf_gcm ! Initialisation des traceurs ! Choix du schéma pour l'advection dans le fichier "traceur.def" ou via INCA - call iniadvtrac(nq) + call iniadvtrac ! Lecture du fichier "start.nc" : CALL dynetat0(vcov, ucov, teta, q, masse, ps, phis, time_0) - ! Begin special experiment -!!$ print *, "This is a special experiment." -!!$ print *, "We are setting:" -!!$ print *, "ucov = vcov = 0, q = 0, ps = 101325" -!!$ print *, "We are averaging 'teta' horizontally." -!!$ ucov = 0. -!!$ vcov = 0. -!!$ q = 0. -!!$ ps = 101325. - ! Average teta over all longitudes and latitudes: -!!$ forall(i = 1:llm) teta(:,i) = sum(teta(:,i)) / ip1jmp1 - ! (it would be better to weight each element with an associated - ! surface area) - ! End special experiment ! Lecture des paramètres de contrôle pour la simulation : ! on recalcule éventuellement le pas de temps @@ -132,19 +116,18 @@ if (annee_ref /= anneeref .or. day_ref /= dayref) then print *, 'Attention : les dates initiales lues dans le fichier ' // & '"start" ne correspondent pas à celles lues dans "gcm.def".' - if (raz_date /= 1) then - print *, 'On garde les dates du fichier "start".' - else + if (raz_date) then print *, 'On réinitialise à la date lue dans "gcm.def".' annee_ref = anneeref day_ref = dayref day_ini = dayref itau_dyn = 0 - itau_phy = 0 time_0 = 0. + else + print *, 'On garde les dates du fichier "start".' endif ELSE - raz_date = 0 + raz_date = .false. endif ! Initialisation des constantes dynamiques : @@ -194,7 +177,7 @@ airefi = pack(aire_2d, dyn_phy) print *, 'Attention : vitesse verticale nulle dans la physique.' - CALL iniphysiq(klon, llm, daysec, day_ini, dtphys, latfi, lonfi, airefi, & + CALL iniphysiq(klon, llm, latfi, lonfi, airefi, & zcufi, zcvfi, rad, g, r, cpp) ENDIF @@ -204,7 +187,7 @@ print *, "day_ini = ", day_ini print *, "day_end = ", day_end - CALL dynredem0("restart.nc", day_end, phis, nqmx) + CALL dynredem0("restart.nc", day_end, phis) CALL inithist(day_ref, annee_ref, zdtvr, nqmx, histid, histvid, & infile="dyn_hist.nc", t_ops = iecri * daysec, t_wrt = iecri * daysec) CALL initdynav(day_ref, annee_ref, zdtvr, nqmx, histaveid, & @@ -216,6 +199,10 @@ istphy = istdyn / iphysiq ! Intégration temporelle du modèle : - CALL leapfrog(ucov, vcov, teta, ps, masse, phis, nq, q, clesphy0, time_0) + CALL leapfrog(ucov, vcov, teta, ps, masse, phis, q, time_0) + + call histclo + print *, 'Simulation finished' + print *, 'Everything is cool' END PROGRAM gcm