4 |
|
|
5 |
contains |
contains |
6 |
|
|
7 |
subroutine writehist(time, vcov, ucov, teta, phi, 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 comconst, ONLY: cpp |
14 |
|
use covnat_m, only: covnat |
15 |
use dimens_m, only: llm |
use dimens_m, only: llm |
16 |
use com_io_dyn, only: histid, histvid, histuid |
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 |
use paramet_m, only: ip1jm, ip1jmp1 |
22 |
use temps, only: itau_dyn |
use temps, only: itau_dyn |
|
use histwrite_m, only: histwrite |
|
|
use histsync_m, only: histsync |
|
|
use covnat_m, only: covnat |
|
23 |
|
|
24 |
! Entree: |
! Vent covariant : |
25 |
! time: temps de l'ecriture |
REAL, intent(in):: vcov(:, :, :) ! (iim + 1, jjm, llm) |
26 |
! vcov: vents v covariants |
REAL, intent(in):: ucov(:, :, :) ! (iim + 1, jjm + 1, llm) |
27 |
! ucov: vents u covariants |
|
28 |
! teta: temperature potentielle |
REAL, intent(in):: teta(:, :, :) ! (iim + 1, jjm + 1, llm) |
29 |
! phi : geopotentiel instantane |
! temperature potentielle |
30 |
! masse: masse |
|
31 |
! ps :pression au sol |
real, intent(in):: pk(:, :, :) ! (iim + 1, jjm + 1, llm) |
32 |
|
real, intent(in):: phi(:, :, :) ! (iim + 1, jjm + 1, llm) ! geopotential |
33 |
! Arguments |
REAL, intent(in):: q(:, :, :, :) ! (iim + 1, jjm + 1, llm, nqmx) traceurs |
34 |
|
real, intent(in):: masse(:, :, :) ! (iim + 1, jjm + 1, llm) |
35 |
REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) |
REAL, intent(in):: ps(:, :) ! (iim + 1, jjm + 1) pression au sol |
36 |
REAL teta(ip1jmp1, llm), phi(ip1jmp1, llm) |
integer, intent(in):: time ! temps de l'ecriture |
|
REAL, intent(in):: ps(ip1jmp1), masse(ip1jmp1, llm) |
|
|
integer time |
|
37 |
|
|
38 |
! This routine needs IOIPSL to work |
! Local: |
39 |
! Variables locales |
integer iq, itau_w |
|
|
|
|
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 |
|
"writehist 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), "writehist 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, "writehist llm") |
52 |
|
|
|
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 |
! Masse |
DO iq = 1, size(q, 4) |
63 |
|
call histwrite(histid, ttext(iq), itau_w, q(:, :, :, iq)) |
64 |
|
enddo |
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 |
|
|