1 |
subroutine writedynav(histid, nq, time, vcov, ucov, teta, ppk, phi, q, masse, & |
module writedynav_m |
|
ps, phis) |
|
2 |
|
|
3 |
! From LMDZ4/libf/bibio/writedynav.F, version 1.1.1.1 2004/05/19 12:53:05 |
implicit none |
|
! Ecriture du fichier histoire au format IOIPSL |
|
4 |
|
|
5 |
! Appels successifs des routines histwrite |
contains |
6 |
|
|
7 |
! Entree: |
subroutine writedynav(vcov, ucov, teta, ppk, phi, q, masse, ps, phis, time) |
|
! histid: ID du fichier histoire |
|
|
! time: temps de l'ecriture |
|
|
! vcov: vents v covariants |
|
|
! ucov: vents u covariants |
|
|
! phi : geopotentiel instantane |
|
|
! q : traceurs |
|
|
! ps :pression au sol |
|
|
! phis : geopotentiel au sol |
|
|
|
|
|
! L. Fairhead, LMD, 03/99 |
|
|
|
|
|
USE histwrite_m, ONLY : histwrite |
|
|
USE histcom, ONLY : histsync |
|
|
USE dimens_m, ONLY : llm |
|
|
USE paramet_m, ONLY : iip1, ijp1llm, ip1jm, ip1jmp1, jjp1 |
|
|
USE comconst, ONLY : cpp |
|
|
USE temps, ONLY : itau_dyn |
|
|
USE iniadvtrac_m, ONLY : ttext |
|
8 |
|
|
9 |
implicit none |
! From LMDZ4/libf/bibio/writedynav.F, version 1.1.1.1 2004/05/19 12:53:05 |
10 |
|
! Ecriture du fichier histoire au format IOIPSL |
11 |
|
|
12 |
|
! Appels successifs des routines histwrite |
13 |
|
|
14 |
|
! Entree: |
15 |
|
! vcov: vents v covariants |
16 |
|
! ucov: vents u covariants |
17 |
|
! phi : geopotentiel instantane |
18 |
|
! q : traceurs |
19 |
|
! ps :pression au sol |
20 |
|
! phis : geopotentiel au sol |
21 |
|
|
22 |
|
! L. Fairhead, LMD, 03/99 |
23 |
|
|
24 |
|
use covnat_m, only: covnat |
25 |
|
USE histwrite_m, ONLY: histwrite |
26 |
|
USE histsync_m, ONLY: histsync |
27 |
|
USE dimens_m, ONLY: llm |
28 |
|
USE paramet_m, ONLY: iip1, ijp1llm, ip1jm, ip1jmp1, jjp1 |
29 |
|
USE comconst, ONLY: cpp |
30 |
|
USE temps, ONLY: itau_dyn |
31 |
|
USE iniadvtrac_m, ONLY: ttext |
32 |
|
use initdynav_m, only: histaveid |
33 |
|
|
34 |
|
REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) |
35 |
|
REAL, intent(in):: teta(ip1jmp1*llm) ! temperature potentielle |
36 |
|
real phi(ip1jmp1, llm), ppk(ip1jmp1*llm) |
37 |
|
REAL ps(ip1jmp1) |
38 |
|
real, intent(in):: masse(ip1jmp1, llm) |
39 |
|
REAL phis(ip1jmp1) |
40 |
|
REAL, intent(in):: q(:, :, :, :) ! (iim + 1, jjm + 1, llm, nqmx) |
41 |
|
integer, intent(in):: time ! temps de l'ecriture |
42 |
|
|
43 |
|
! Variables locales |
44 |
|
integer ndex2d(iip1*jjp1), ndex3d(iip1*jjp1*llm), iq, ii, ll |
45 |
|
real us(ip1jmp1*llm), vs(ip1jmp1*llm) |
46 |
|
real tm(ip1jmp1*llm) |
47 |
|
REAL vnat(ip1jm, llm), unat(ip1jmp1, llm) |
48 |
|
logical ok_sync |
49 |
|
integer itau_w |
50 |
|
|
51 |
|
!--------------------------------------------------------------- |
52 |
|
|
53 |
|
! Initialisations |
54 |
|
ndex3d = 0 |
55 |
|
ndex2d = 0 |
56 |
|
ok_sync = .TRUE. |
57 |
|
us = 999.999 |
58 |
|
vs = 999.999 |
59 |
|
tm = 999.999 |
60 |
|
vnat = 999.999 |
61 |
|
unat = 999.999 |
62 |
|
itau_w = itau_dyn + time |
63 |
|
|
64 |
|
! Passage aux composantes naturelles du vent |
65 |
|
call covnat(llm, ucov, vcov, unat, vnat) |
66 |
|
|
67 |
|
! Appels a histwrite pour l'ecriture des variables a sauvegarder |
68 |
|
|
69 |
|
! Vents U scalaire |
70 |
|
call gr_u_scal(llm, unat, us) |
71 |
|
call histwrite(histaveid, 'u', itau_w, us) |
72 |
|
|
73 |
|
! Vents V scalaire |
74 |
|
call gr_v_scal(llm, vnat, vs) |
75 |
|
call histwrite(histaveid, 'v', itau_w, vs) |
76 |
|
|
77 |
|
! Temperature potentielle moyennee |
78 |
|
call histwrite(histaveid, 'theta', itau_w, teta) |
79 |
|
|
80 |
|
! Temperature moyennee |
81 |
|
do ii = 1, ijp1llm |
82 |
|
tm(ii) = teta(ii) * ppk(ii)/cpp |
83 |
|
enddo |
84 |
|
call histwrite(histaveid, 'temp', itau_w, tm) |
85 |
|
|
86 |
|
! Geopotentiel |
87 |
|
call histwrite(histaveid, 'phi', itau_w, phi) |
88 |
|
|
89 |
|
! Traceurs |
90 |
|
DO iq = 1, size(q, 4) |
91 |
|
call histwrite(histaveid, ttext(iq), itau_w, q(:, :, :, iq)) |
92 |
|
enddo |
93 |
|
|
94 |
|
! Masse |
95 |
|
call histwrite(histaveid, 'masse', itau_w, masse) |
96 |
|
|
97 |
|
! Pression au sol |
98 |
|
call histwrite(histaveid, 'ps', itau_w, ps) |
99 |
|
|
100 |
INTEGER histid, nq |
! Geopotentiel au sol |
101 |
REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) |
call histwrite(histaveid, 'phis', itau_w, phis) |
|
REAL, intent(in):: teta(ip1jmp1*llm) ! temperature potentielle |
|
|
real phi(ip1jmp1, llm), ppk(ip1jmp1*llm) |
|
|
REAL ps(ip1jmp1) |
|
|
real, intent(in):: masse(ip1jmp1, llm) |
|
|
REAL phis(ip1jmp1) |
|
|
REAL q(ip1jmp1, llm, nq) |
|
|
integer, intent(in):: time |
|
|
|
|
|
! Variables locales |
|
|
integer ndex2d(iip1*jjp1), ndex3d(iip1*jjp1*llm), iq, ii, ll |
|
|
real us(ip1jmp1*llm), vs(ip1jmp1*llm) |
|
|
real tm(ip1jmp1*llm) |
|
|
REAL vnat(ip1jm, llm), unat(ip1jmp1, llm) |
|
|
logical ok_sync |
|
|
integer itau_w |
|
|
|
|
|
!--------------------------------------------------------------- |
|
|
|
|
|
! Initialisations |
|
|
ndex3d = 0 |
|
|
ndex2d = 0 |
|
|
ok_sync = .TRUE. |
|
|
us = 999.999 |
|
|
vs = 999.999 |
|
|
tm = 999.999 |
|
|
vnat = 999.999 |
|
|
unat = 999.999 |
|
|
itau_w = itau_dyn + time |
|
|
|
|
|
! Passage aux composantes naturelles du vent |
|
|
call covnat(llm, ucov, vcov, unat, vnat) |
|
|
|
|
|
! Appels a histwrite pour l'ecriture des variables a sauvegarder |
|
|
|
|
|
! Vents U scalaire |
|
|
call gr_u_scal(llm, unat, us) |
|
|
call histwrite(histid, 'u', itau_w, us) |
|
|
|
|
|
! Vents V scalaire |
|
|
call gr_v_scal(llm, vnat, vs) |
|
|
call histwrite(histid, 'v', itau_w, vs) |
|
|
|
|
|
! Temperature potentielle moyennee |
|
|
call histwrite(histid, 'theta', itau_w, teta) |
|
|
|
|
|
! Temperature moyennee |
|
|
do ii = 1, ijp1llm |
|
|
tm(ii) = teta(ii) * ppk(ii)/cpp |
|
|
enddo |
|
|
call histwrite(histid, 'temp', itau_w, tm) |
|
|
|
|
|
! Geopotentiel |
|
|
call histwrite(histid, 'phi', itau_w, phi) |
|
|
|
|
|
! Traceurs |
|
|
DO iq=1, nq |
|
|
call histwrite(histid, ttext(iq), itau_w, q(:, :, iq)) |
|
|
enddo |
|
|
|
|
|
! Masse |
|
|
call histwrite(histid, 'masse', itau_w, masse) |
|
|
|
|
|
! Pression au sol |
|
|
call histwrite(histid, 'ps', itau_w, ps) |
|
102 |
|
|
103 |
! Geopotentiel au sol |
if (ok_sync) call histsync(histaveid) |
|
call histwrite(histid, 'phis', itau_w, phis) |
|
104 |
|
|
105 |
if (ok_sync) call histsync(histid) |
end subroutine writedynav |
106 |
|
|
107 |
end subroutine writedynav |
end module writedynav_m |