4 |
|
|
5 |
contains |
contains |
6 |
|
|
7 |
subroutine writehist(time, vcov, ucov, teta, phi, q, masse, ps) |
subroutine writehist(vcov, ucov, teta, pk, phi, q, masse, ps, time) |
8 |
|
|
9 |
! From writehist.F 1403 2010-07-01 09:02:53Z |
! From writehist.F, revision 1403, 2010-07-01 09:02:53 |
10 |
! Écriture du fichier histoire au format IOIPSL |
! Écriture du fichier histoire au format IOIPSL |
|
! Appels successifs des routines histwrite |
|
11 |
! L. Fairhead, LMD, 03/99 |
! L. Fairhead, LMD, 03/99 |
12 |
|
|
13 |
use dimens_m, only: nqmx, llm, jjm |
USE comconst, ONLY: cpp |
|
USE iniadvtrac_m, ONLY: ttext |
|
|
use com_io_dyn, only: histid, histvid, histuid |
|
|
use paramet_m, only: ip1jm, ip1jmp1, iip1, jjp1 |
|
|
use temps, only: itau_dyn |
|
|
use histwrite_m, only: histwrite |
|
|
use histsync_m, only: histsync |
|
14 |
use covnat_m, only: covnat |
use covnat_m, only: covnat |
15 |
|
use dimens_m, only: llm |
16 |
|
use histsync_m, only: histsync |
17 |
|
use histwrite_m, only: histwrite |
18 |
|
use iniadvtrac_m, only: ttext |
19 |
|
use inithist_m, only: histid, histvid, histuid |
20 |
|
use nr_util, only: assert |
21 |
|
use paramet_m, only: ip1jm, ip1jmp1 |
22 |
|
use temps, only: itau_dyn |
23 |
|
|
24 |
|
! Vent covariant : |
25 |
|
REAL, intent(in):: vcov(:, :, :) ! (iim + 1, jjm, llm) |
26 |
|
REAL, intent(in):: ucov(:, :, :) ! (iim + 1, jjm + 1, llm) |
27 |
|
|
28 |
|
REAL, intent(in):: teta(:, :, :) ! (iim + 1, jjm + 1, llm) |
29 |
|
! temperature potentielle |
30 |
|
|
31 |
|
real, intent(in):: pk(:, :, :) ! (iim + 1, jjm + 1, llm) |
32 |
|
real, intent(in):: phi(:, :, :) ! (iim + 1, jjm + 1, llm) ! geopotential |
33 |
|
REAL, intent(in):: q(:, :, :, :) ! (iim + 1, jjm + 1, llm, nqmx) traceurs |
34 |
|
real, intent(in):: masse(:, :, :) ! (iim + 1, jjm + 1, llm) |
35 |
|
REAL, intent(in):: ps(:, :) ! (iim + 1, jjm + 1) pression au sol |
36 |
|
integer, intent(in):: time ! temps de l'ecriture |
37 |
|
|
38 |
! Entree: |
! Local: |
39 |
! time: temps de l'ecriture |
integer iq, itau_w |
|
! vcov: vents v covariants |
|
|
! ucov: vents u covariants |
|
|
! teta: temperature potentielle |
|
|
! phi : geopotentiel instantane |
|
|
! q : traceurs |
|
|
! masse: masse |
|
|
! ps :pression au sol |
|
|
|
|
|
! Arguments |
|
|
|
|
|
REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) |
|
|
REAL teta(ip1jmp1, llm), phi(ip1jmp1, llm) |
|
|
REAL, intent(in):: ps(ip1jmp1), masse(ip1jmp1, llm) |
|
|
REAL q(ip1jmp1, llm, nqmx) |
|
|
integer time |
|
|
|
|
|
! This routine needs IOIPSL to work |
|
|
! Variables locales |
|
|
|
|
|
integer ndexu(ip1jmp1*llm), ndexv(ip1jm*llm), ndex2d(ip1jmp1) |
|
|
logical ok_sync |
|
|
integer itau_w |
|
40 |
REAL vnat(ip1jm, llm), unat(ip1jmp1, llm) |
REAL vnat(ip1jm, llm), unat(ip1jmp1, llm) |
41 |
|
|
42 |
!--------------------------------------------------------------------- |
!--------------------------------------------------------------------- |
43 |
|
|
44 |
! Initialisations |
call assert([size(vcov, 1), size(ucov, 1), size(teta, 1), size(phi, 1), & |
45 |
|
size(pk, 1), size(ps, 1), size(masse, 1)] == size(q, 1), & |
46 |
|
"writedynav iim") |
47 |
|
call assert([size(vcov, 2) + 1, size(ucov, 2), size(teta, 2), & |
48 |
|
size(phi, 2), size(pk, 2), size(ps, 2), size(masse, 2)] & |
49 |
|
== size(q, 2), "writedynav jjm") |
50 |
|
call assert([size(vcov, 3), size(ucov, 3), size(teta, 3), size(phi, 3), & |
51 |
|
size(pk, 3), size(masse, 3), size(q, 3)] == llm, "writedynav llm") |
52 |
|
|
|
ndexu = 0 |
|
|
ndexv = 0 |
|
|
ndex2d = 0 |
|
|
ok_sync =.TRUE. |
|
53 |
itau_w = itau_dyn + time |
itau_w = itau_dyn + time |
|
! Passage aux composantes naturelles du vent |
|
54 |
call covnat(llm, ucov, vcov, unat, vnat) |
call covnat(llm, ucov, vcov, unat, vnat) |
55 |
|
|
|
! Appels a histwrite pour l'ecriture des variables a sauvegarder |
|
|
|
|
|
! Vents U |
|
|
|
|
56 |
call histwrite(histuid, 'u', itau_w, unat) |
call histwrite(histuid, 'u', itau_w, unat) |
|
|
|
|
! Vents V |
|
|
|
|
57 |
call histwrite(histvid, 'v', itau_w, vnat) |
call histwrite(histvid, 'v', itau_w, vnat) |
58 |
|
call histwrite(histid, 'theta', itau_w, teta) |
59 |
! Temperature potentielle |
call histwrite(histid, 'temp', itau_w, teta * pk / cpp) |
|
|
|
|
call histwrite(histid, 'teta', itau_w, teta) |
|
|
|
|
|
! Geopotentiel |
|
|
|
|
60 |
call histwrite(histid, 'phi', itau_w, phi) |
call histwrite(histid, 'phi', itau_w, phi) |
61 |
|
|
62 |
! Traceurs |
DO iq = 1, size(q, 4) |
63 |
|
call histwrite(histid, ttext(iq), itau_w, q(:, :, :, iq)) |
64 |
! DO iq=1, nqmx |
enddo |
|
! call histwrite(histid, ttext(iq), itau_w, q(:, :, iq), |
|
|
! . iip1*jjp1*llm, ndexu) |
|
|
! enddo |
|
|
!C |
|
|
! Masse |
|
65 |
|
|
66 |
call histwrite(histid, 'masse', itau_w, masse) |
call histwrite(histid, 'masse', itau_w, masse) |
|
|
|
|
! Pression au sol |
|
67 |
call histwrite(histid, 'ps', itau_w, ps) |
call histwrite(histid, 'ps', itau_w, ps) |
68 |
|
|
69 |
if (ok_sync) then |
call histsync(histid) |
70 |
call histsync(histid) |
call histsync(histvid) |
71 |
call histsync(histvid) |
call histsync(histuid) |
|
call histsync(histuid) |
|
|
endif |
|
72 |
|
|
73 |
end subroutine writehist |
end subroutine writehist |
74 |
|
|