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