| 1 | ! |
|---|
| 2 | ! $Id: writehist.F 1403 2010-07-01 09:02:53Z fairhead $ |
|---|
| 3 | ! |
|---|
| 4 | subroutine writehist(time,vcov,ucov,teta,phi,q,masse,ps,phis) |
|---|
| 5 | |
|---|
| 6 | #ifdef CPP_IOIPSL |
|---|
| 7 | USE ioipsl |
|---|
| 8 | #endif |
|---|
| 9 | USE infotrac, ONLY : nqtot, ttext |
|---|
| 10 | use com_io_dyn_mod, only : histid,histvid,histuid |
|---|
| 11 | USE temps_mod, ONLY: itau_dyn |
|---|
| 12 | implicit none |
|---|
| 13 | |
|---|
| 14 | C |
|---|
| 15 | C Ecriture du fichier histoire au format IOIPSL |
|---|
| 16 | C |
|---|
| 17 | C Appels succesifs des routines: histwrite |
|---|
| 18 | C |
|---|
| 19 | C Entree: |
|---|
| 20 | C time: temps de l'ecriture |
|---|
| 21 | C vcov: vents v covariants |
|---|
| 22 | C ucov: vents u covariants |
|---|
| 23 | C teta: temperature potentielle |
|---|
| 24 | C phi : geopotentiel instantane |
|---|
| 25 | C q : traceurs |
|---|
| 26 | C masse: masse |
|---|
| 27 | C ps :pression au sol |
|---|
| 28 | C phis : geopotentiel au sol |
|---|
| 29 | C |
|---|
| 30 | C |
|---|
| 31 | C L. Fairhead, LMD, 03/99 |
|---|
| 32 | C |
|---|
| 33 | C ===================================================================== |
|---|
| 34 | C |
|---|
| 35 | C Declarations |
|---|
| 36 | #include "dimensions.h" |
|---|
| 37 | #include "paramet.h" |
|---|
| 38 | #include "comgeom.h" |
|---|
| 39 | #include "iniprint.h" |
|---|
| 40 | |
|---|
| 41 | C |
|---|
| 42 | C Arguments |
|---|
| 43 | C |
|---|
| 44 | |
|---|
| 45 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) |
|---|
| 46 | REAL teta(ip1jmp1,llm),phi(ip1jmp1,llm) |
|---|
| 47 | REAL ps(ip1jmp1),masse(ip1jmp1,llm) |
|---|
| 48 | REAL phis(ip1jmp1) |
|---|
| 49 | REAL q(ip1jmp1,llm,nqtot) |
|---|
| 50 | integer time |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | #ifdef CPP_IOIPSL |
|---|
| 54 | ! This routine needs IOIPSL to work |
|---|
| 55 | C Variables locales |
|---|
| 56 | C |
|---|
| 57 | integer iq, ii, ll |
|---|
| 58 | integer ndexu(ip1jmp1*llm),ndexv(ip1jm*llm),ndex2d(ip1jmp1) |
|---|
| 59 | logical ok_sync |
|---|
| 60 | integer itau_w |
|---|
| 61 | REAL vnat(ip1jm,llm),unat(ip1jmp1,llm) |
|---|
| 62 | |
|---|
| 63 | C |
|---|
| 64 | C Initialisations |
|---|
| 65 | C |
|---|
| 66 | ndexu = 0 |
|---|
| 67 | ndexv = 0 |
|---|
| 68 | ndex2d = 0 |
|---|
| 69 | ok_sync =.TRUE. |
|---|
| 70 | itau_w = itau_dyn + time |
|---|
| 71 | ! Passage aux composantes naturelles du vent |
|---|
| 72 | call covnat(llm, ucov, vcov, unat, vnat) |
|---|
| 73 | C |
|---|
| 74 | C Appels a histwrite pour l'ecriture des variables a sauvegarder |
|---|
| 75 | C |
|---|
| 76 | C Vents U |
|---|
| 77 | C |
|---|
| 78 | call histwrite(histuid, 'u', itau_w, unat, |
|---|
| 79 | . iip1*jjp1*llm, ndexu) |
|---|
| 80 | C |
|---|
| 81 | C Vents V |
|---|
| 82 | C |
|---|
| 83 | call histwrite(histvid, 'v', itau_w, vnat, |
|---|
| 84 | . iip1*jjm*llm, ndexv) |
|---|
| 85 | |
|---|
| 86 | C |
|---|
| 87 | C Temperature potentielle |
|---|
| 88 | C |
|---|
| 89 | call histwrite(histid, 'teta', itau_w, teta, |
|---|
| 90 | . iip1*jjp1*llm, ndexu) |
|---|
| 91 | C |
|---|
| 92 | C Geopotentiel |
|---|
| 93 | C |
|---|
| 94 | call histwrite(histid, 'phi', itau_w, phi, |
|---|
| 95 | . iip1*jjp1*llm, ndexu) |
|---|
| 96 | C |
|---|
| 97 | C Traceurs |
|---|
| 98 | C |
|---|
| 99 | ! DO iq=1,nqtot |
|---|
| 100 | ! call histwrite(histid, ttext(iq), itau_w, q(:,:,iq), |
|---|
| 101 | ! . iip1*jjp1*llm, ndexu) |
|---|
| 102 | ! enddo |
|---|
| 103 | !C |
|---|
| 104 | C Masse |
|---|
| 105 | C |
|---|
| 106 | call histwrite(histid,'masse',itau_w, masse,iip1*jjp1*llm,ndexu) |
|---|
| 107 | C |
|---|
| 108 | C Pression au sol |
|---|
| 109 | C |
|---|
| 110 | call histwrite(histid, 'ps', itau_w, ps, iip1*jjp1, ndex2d) |
|---|
| 111 | C |
|---|
| 112 | C Geopotentiel au sol |
|---|
| 113 | C |
|---|
| 114 | ! call histwrite(histid, 'phis', itau_w, phis, iip1*jjp1, ndex2d) |
|---|
| 115 | C |
|---|
| 116 | C Fin |
|---|
| 117 | C |
|---|
| 118 | if (ok_sync) then |
|---|
| 119 | call histsync(histid) |
|---|
| 120 | call histsync(histvid) |
|---|
| 121 | call histsync(histuid) |
|---|
| 122 | endif |
|---|
| 123 | #else |
|---|
| 124 | ! tell the user this routine should be run with ioipsl |
|---|
| 125 | write(lunout,*)"writehist: Warning this routine should not be", |
|---|
| 126 | & " used without ioipsl" |
|---|
| 127 | #endif |
|---|
| 128 | ! of #ifdef CPP_IOIPSL |
|---|
| 129 | return |
|---|
| 130 | end |
|---|