--- trunk/libf/dyn3d/gcm.f90 2008/03/03 16:32:04 5 +++ trunk/libf/dyn3d/gcm.f90 2010/03/25 14:29:07 27 @@ -15,34 +15,32 @@ ! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4 ! Pour Van-Leer : iadv=10 - USE IOIPSL, only: ioconf_calendar - 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 comdissnew, only: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & - tetagrot, tetatemp - + use abort_gcm_m, only: abort_gcm + use clesphys2, only: read_clesphys2 + use com_io_dyn, only: histid, histvid, histaveid + use comconst, only: daysec, cpp, dtvr, g, rad, r, initialize + use comgeom, only: rlatu, aire_2d, cu_2d, cv_2d, rlonv 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 com_io_dyn, only: histid, histvid, histaveid - use tracstoke, only: istdyn, istphy - use abort_gcm_m, only: abort_gcm - use inithist_m, only: inithist - use initdynav_m, only: initdynav - use dynetat0_m, only: dynetat0 + use dimens_m, only: iim, jjm, llm, nqmx + use dimphy, only: klon + use dynetat0_m, only: dynetat0, day_ini + use dynredem0_m, only: dynredem0 use grid_change, only: dyn_phy, init_dyn_phy - use advtrac_m, only: iniadvtrac + use iniadvtrac_m, only: iniadvtrac + use inidissip_m, only: inidissip + use inigeom_m, only: inigeom + use initdynav_m, only: initdynav + use inithist_m, only: inithist + USE IOIPSL, only: ioconf_calendar, histclo use leapfrog_m, only: leapfrog + use logic, only: iflag_phys + use paramet_m, only: ip1jm, ip1jmp1 + use temps, only: day_ref, annee_ref, day_end, itau_dyn + use tracstoke, only: istdyn, istphy IMPLICIT NONE - REAL clesphy0(20) REAL zdtvr ! time step for dynamics, in s ! Variables dynamiques : @@ -52,18 +50,15 @@ 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 - - !!INTEGER i + REAL time_0 ! time in day, as a fraction of day, in [0, 1[ ! Calendrier : 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 +86,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 +114,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 : @@ -165,10 +146,7 @@ ! Initialisation du filtre : CALL inifilr - ! Initialisation de la dissipation : - CALL inidissip(lstardis, nitergdiv, nitergrot, niterh, tetagdiv, tetagrot, & - tetatemp) - + CALL inidissip call init_dyn_phy ! Initialisation de la physique : @@ -194,11 +172,10 @@ 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 - ! Numéro de stockage pour les fichiers de redémarrage : ! Initialisation des entrées-sorties : day_end = day_ini + nday print *, "day_ini = ", day_ini @@ -206,16 +183,19 @@ 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) + t_ops = iecri * daysec, t_wrt = iecri * daysec) CALL initdynav(day_ref, annee_ref, zdtvr, nqmx, histaveid, & - infile='dyn_hist_ave.nc', t_ops = iperiod * zdtvr, & - t_wrt = periodav * daysec) + t_ops = iperiod * zdtvr, t_wrt = periodav * daysec) ! Choix des fréquences de stockage pour le hors-ligne : istdyn = day_step / 4 ! stockage toutes les 6 h = 1 jour / 4 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