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