/[lmdze]/trunk/Sources/dyn3d/writedynav.f
ViewVC logotype

Diff of /trunk/Sources/dyn3d/writedynav.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.45  
changed lines
  Added in v.67

  ViewVC Help
Powered by ViewVC 1.1.21