--- trunk/libf/bibio/inithist.f90 2008/02/27 13:16:39 3 +++ trunk/bibio/inithist.f 2014/03/05 14:57:53 82 @@ -1,184 +1,121 @@ module inithist_m - ! This module is clean: no C preprocessor directive, no include line - implicit none contains - subroutine inithist(day0, anne0, tstep, nq, fileid, filevid, infile, t_ops, & - t_wrt) - - ! From inithist.F,v 1.1.1.1 2004/05/19 12:53:05 + subroutine inithist(day0, anne0, tstep, nq, t_ops, t_wrt) - ! Routine d'initialisation des ecritures des fichiers histoires LMDZ - ! au format IOIPSL + ! From inithist.F, version 1.1.1.1 2004/05/19 12:53:05 + ! L. Fairhead, LMD, 03/99 - ! Appels succesifs des routines: histbeg - ! histhori - ! histver - ! histdef - ! histend - - ! Entree: - ! infile: nom du fichier histoire a creer - ! day0,anne0: date de reference - ! tstep: duree du pas de temps en seconde - ! t_ops: frequence de l'operation pour IOIPSL - ! t_wrt: frequence d'ecriture sur le fichier - ! nq: nombre de traceurs - - ! Sortie: - ! fileid: ID du fichier netcdf cree - ! filevid:ID du fichier netcdf pour la grille v - - ! L. Fairhead, LMD, 03/99 - - USE IOIPSL - use dimens_m - use paramet_m - use comconst - use comvert - use logic - use comgeom - use serre - use temps - use ener - use advtrac_m - - ! Arguments - character(len=*) infile - integer day0, anne0 - real, intent(in):: tstep, t_ops, t_wrt - integer fileid, filevid - integer nq + ! Routine d'initialisation des écritures des fichiers histoires + ! LMDZ au format IOIPSL. - ! Variables locales + USE calendar, ONLY: ymds2ju + USE com_io_dyn, ONLY: histid, histuid, histvid + USE histbeg_totreg_m, ONLY : histbeg_totreg + USE histdef_m, ONLY : histdef + USE histend_m, ONLY : histend + USE histvert_m, ONLY : histvert + USE dimens_m, ONLY: jjm, llm + USE paramet_m, ONLY: iip1, jjp1 + USE disvert_m, ONLY: presnivs + USE comgeom, ONLY: rlatu, rlatv, rlonu, rlonv + USE temps, ONLY: itau_dyn + USE iniadvtrac_m, ONLY: ttext + USE nr_util, ONLY: pi + + integer, intent(in):: day0, anne0 ! date de référence + real, intent(in):: tstep ! durée du pas de temps en secondes + integer, intent(in):: nq ! nombre de traceurs + real, intent(in):: t_ops ! fréquence de l'opération pour IOIPSL + real, intent(in):: t_wrt ! fréquence d'écriture sur le fichier - integer tau0 + ! Variables locales: real zjulian integer iq - real rlong(iip1,jjp1), rlat(iip1,jjp1) + real rlong(iip1, jjp1), rlat(iip1, jjp1) integer uhoriid, vhoriid, thoriid, zvertiid - integer ii,jj + integer ii, jj integer zan, dayref !----------------------------------------------------------------------- - ! Initialisations - - pi = 4. * atan (1.) - - ! Appel a histbeg: creation du fichier netcdf et initialisations diverses - zan = anne0 dayref = day0 CALL ymds2ju(zan, 1, dayref, 0.0, zjulian) - tau0 = itau_dyn do jj = 1, jjp1 do ii = 1, iip1 - rlong(ii,jj) = rlonu(ii) * 180. / pi - rlat(ii,jj) = rlatu(jj) * 180. / pi + rlong(ii, jj) = rlonu(ii) * 180. / pi + rlat(ii, jj) = rlatu(jj) * 180. / pi enddo enddo - call histbeg_totreg(infile, iip1, rlong(:,1), jjp1, rlat(1,:), & - 1, iip1, 1, jjp1, & - tau0, zjulian, tstep, uhoriid, fileid) - ! - ! Creation du fichier histoire pour la grille en V (oblige pour l'instant, - ! IOIPSL ne permet pas de grilles avec des nombres de point differents dans - ! un meme fichier) + call histbeg_totreg("dyn_histu.nc", rlong(:,1), rlat(1,:), 1, iip1, 1, & + jjp1, itau_dyn, zjulian, tstep, uhoriid, histuid) do jj = 1, jjm do ii = 1, iip1 - rlong(ii,jj) = rlonv(ii) * 180. / pi - rlat(ii,jj) = rlatv(jj) * 180. / pi + rlong(ii, jj) = rlonv(ii) * 180. / pi + rlat(ii, jj) = rlatv(jj) * 180. / pi enddo enddo - call histbeg_totreg('dyn_histv.nc', iip1, rlong(:,1), jjm, rlat(1,:jjm), & - 1, iip1, 1, jjm, & - tau0, zjulian, tstep, vhoriid, filevid) - ! - ! Appel a histhori pour rajouter les autres grilles horizontales - ! + ! Creation du fichier histoire pour la grille en V (oblige pour l'instant, + ! IOIPSL ne permet pas de grilles avec des nombres de point differents dans + ! un meme fichier) + + call histbeg_totreg('dyn_histv.nc', rlong(:, 1), rlat(1, :jjm), 1, iip1, & + 1, jjm, itau_dyn, zjulian, tstep, vhoriid, histvid) + do jj = 1, jjp1 do ii = 1, iip1 - rlong(ii,jj) = rlonv(ii) * 180. / pi - rlat(ii,jj) = rlatu(jj) * 180. / pi + rlong(ii, jj) = rlonv(ii) * 180. / pi + rlat(ii, jj) = rlatu(jj) * 180. / pi enddo enddo - call histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar', & - 'Grille points scalaires', thoriid) - ! - ! Appel a histvert pour la grille verticale - ! - call histvert(fileid, 'sig_s', 'Niveaux sigma','-', & - llm, nivsigs, zvertiid) - ! Pour le fichier V - call histvert(filevid, 'sig_s', 'Niveaux sigma','-', & - llm, nivsigs, zvertiid) - ! - ! Appels a histdef pour la definition des variables a sauvegarder - ! - ! Vents U - ! - call histdef(fileid, 'ucov', 'vents u covariants', 'm/s', & - iip1, jjp1, uhoriid, llm, 1, llm, zvertiid, & - 32, 'inst(X)', t_ops, t_wrt) - ! - ! Vents V - ! - call histdef(filevid, 'vcov', 'vents v covariants', 'm/s', & - iip1, jjm, vhoriid, llm, 1, llm, zvertiid, & - 32, 'inst(X)', t_ops, t_wrt) - - ! - ! Temperature potentielle - ! - call histdef(fileid, 'teta', 'temperature potentielle', '-', & - iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & - 32, 'inst(X)', t_ops, t_wrt) - ! - ! Geopotentiel - ! - call histdef(fileid, 'phi', 'geopotentiel instantane', '-', & - iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & - 32, 'inst(X)', t_ops, t_wrt) - ! - ! Traceurs - ! - DO iq=1,nq - call histdef(fileid, ttext(iq), ttext(iq), '-', & - iip1, jjp1, thoriid, llm, 1, llm, zvertiid, & - 32, 'inst(X)', t_ops, t_wrt) + call histbeg_totreg("dyn_hist.nc", rlong(:, 1), rlat(1, :), 1, iip1, 1, & + jjp1, itau_dyn, zjulian, tstep, thoriid, histid) + + ! Appel a histvert pour la grille verticale + + call histvert(histid, 'presnivs', 'Niveaux pression','mb', presnivs/100., & + zvertiid,'down') + call histvert(histvid, 'presnivs', 'Niveaux pression','mb', & + presnivs/100., zvertiid,'down') + call histvert(histuid, 'presnivs', 'Niveaux pression','mb', & + presnivs/100., zvertiid,'down') + + ! Appels a histdef pour la definition des variables a sauvegarder + + call histdef(histuid, 'u', 'vent u', 'm/s', iip1, jjp1, uhoriid, llm, 1, & + llm, zvertiid, 'inst(X)', t_ops, t_wrt) + call histdef(histvid, 'v', 'vent v', 'm/s', iip1, jjm, vhoriid, llm, 1, & + llm, zvertiid, 'inst(X)', t_ops, t_wrt) + call histdef(histid, 'teta', 'temperature potentielle', '-', iip1, jjp1, & + thoriid, llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) + call histdef(histid, 'phi', 'geopotentiel', '-', iip1, jjp1, thoriid, & + llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) + + ! Traceurs + DO iq=1, nq + call histdef(histid, ttext(iq), ttext(iq), '-', iip1, jjp1, thoriid, & + llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) enddo - ! - ! Masse - ! - call histdef(fileid, 'masse', 'masse', 'kg', & - iip1, jjp1, thoriid, 1, 1, 1, -99, & - 32, 'inst(X)', t_ops, t_wrt) - ! - ! Pression au sol - ! - call histdef(fileid, 'ps', 'pression naturelle au sol', 'Pa', & - iip1, jjp1, thoriid, 1, 1, 1, -99, & - 32, 'inst(X)', t_ops, t_wrt) - ! - ! Pression au sol - ! - call histdef(fileid, 'phis', 'geopotentiel au sol', '-', & - iip1, jjp1, thoriid, 1, 1, 1, -99, & - 32, 'inst(X)', t_ops, t_wrt) - ! - ! Fin - ! - call histend(fileid) - call histend(filevid) + + call histdef(histid, 'masse', 'masse', 'kg', iip1, jjp1, thoriid, llm, 1, & + llm, zvertiid, 'inst(X)', t_ops, t_wrt) + call histdef(histid, 'ps', 'pression naturelle au sol', 'Pa', iip1, jjp1, & + thoriid, 1, 1, 1, -99, 'inst(X)', t_ops, t_wrt) + call histdef(histid, 'phis', 'geopotentiel au sol', '-', iip1, jjp1, & + thoriid, 1, 1, 1, -99, 'inst(X)', t_ops, t_wrt) + + call histend(histid) + call histend(histuid) + call histend(histvid) end subroutine inithist