source: LMDZ4/tags/LMDZ4_V3_2/libf/phylmd/calltherm.F @ 1636

Last change on this file since 1636 was 766, checked in by Laurent Fairhead, 17 years ago

Merge entre la version V3_conv et le HEAD
YM, JG, LF

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1!
2! $Header$
3!
4      subroutine calltherm(dtime
5     s      ,pplay,paprs,pphi
6     s      ,u_seri,v_seri,t_seri,q_seri
7     s      ,d_u_ajs,d_v_ajs,d_t_ajs,d_q_ajs
8     s      ,fm_therm,entr_therm)
9
10      USE dimphy
11      implicit none
12cym#include "dimensions.h"
13cym#include "dimphy.h"
14#include "thermcell.h"
15
16c  A inclure eventuellement dans les fichiers de configuration
17      data r_aspect_thermals,l_mix_thermals,tho_thermals/4.,10.,0./
18      data w2di_thermals/0/
19
20      REAL dtime
21
22      REAL u_seri(klon,klev),v_seri(klon,klev)
23      REAL t_seri(klon,klev),q_seri(klon,klev)
24      REAL paprs(klon,klev+1)
25      REAL pplay(klon,klev)
26      REAL pphi(klon,klev)
27
28CFH Update Thermiques
29      REAL d_t_ajs(klon,klev), d_q_ajs(klon,klev)
30      REAL d_u_ajs(klon,klev),d_v_ajs(klon,klev)
31      real fm_therm(klon,klev+1),entr_therm(klon,klev)
32
33
34c variables locales
35      REAL d_t_the(klon,klev), d_q_the(klon,klev)
36      REAL d_u_the(klon,klev),d_v_the(klon,klev)
37c
38cym      real zfm_therm(klon,klev+1),zentr_therm(klon,klev),zdt
39cym      save zentr_therm,zfm_therm
40      real,allocatable,dimension(:,:),save :: zfm_therm,zentr_therm
41c$OMP THREADPRIVATE(zfm_therm,zentr_therm)
42      real :: zdt
43      logical,save :: first=.true.
44c$OMP THREADPRIVATE(first)
45      integer i,k
46
47*********************************************************
48
49c  Modele du thermique
50c  ===================
51c         print*,'thermiques: WARNING on passe t au lieu de t_seri'
52       print*,'avant isplit ',nsplit_thermals
53
54cym initialisation dynamique
55         if (first) then
56           allocate(zfm_therm(klon,klev+1),zentr_therm(klon,klev))
57           zfm_therm(:,:)=0.
58           zentr_therm(:,:)=0.
59           first=.false.
60         endif
61         
62         fm_therm(:,:)=0.
63         entr_therm(:,:)=0.
64
65c   tests sur les valeurs negatives de l'eau
66         do k=1,klev
67            do i=1,klon
68               if (.not.q_seri(i,k).ge.0.) then
69                   print*,'WARN eau<0 avant therm i=',i,'  k=',k
70     s         ,' dq,q',d_q_the(i,k),q_seri(i,k)
71                  q_seri(i,k)=1.e-15
72               endif
73            enddo
74         enddo
75
76
77         zdt=dtime/float(nsplit_thermals)
78         do isplit=1,nsplit_thermals
79
80cym            CALL thermcell(klon,klev,zdt
81cym     s      ,pplay,paprs,pphi
82cym     s      ,u_seri,v_seri,t_seri,q_seri
83cym     s      ,d_u_the,d_v_the,d_t_the,d_q_the
84cym     s      ,zfm_therm,zentr_therm
85cym     s      ,r_aspect_thermals,l_mix_thermals,w2di_thermals
86cym     s      ,tho_thermals,3)
87
88            CALL thermcell(klon,klev,zdt
89     s      ,pplay,paprs,pphi
90     s      ,u_seri,v_seri,t_seri,q_seri
91     s      ,d_u_the,d_v_the,d_t_the,d_q_the
92     s      ,zfm_therm,zentr_therm
93     s      ,r_aspect_thermals,l_mix_thermals,w2di_thermals
94     s      ,tho_thermals)
95
96c  transformation de la derivee en tendance
97            d_t_the(:,:)=d_t_the(:,:)*dtime/float(nsplit_thermals)
98            d_u_the(:,:)=d_u_the(:,:)*dtime/float(nsplit_thermals)
99            d_v_the(:,:)=d_v_the(:,:)*dtime/float(nsplit_thermals)
100            d_q_the(:,:)=d_q_the(:,:)*dtime/float(nsplit_thermals)
101            fm_therm(:,:)=fm_therm(:,:)
102     s      +zfm_therm(:,:)/float(nsplit_thermals)
103            entr_therm(:,:)=entr_therm(:,:)
104     s       +zentr_therm(:,:)/float(nsplit_thermals)
105            fm_therm(:,klev+1)=0.
106
107
108
109c  accumulation de la tendance
110            d_t_ajs(:,:)=d_t_ajs(:,:)+d_t_the(:,:)
111            d_u_ajs(:,:)=d_u_ajs(:,:)+d_u_the(:,:)
112            d_v_ajs(:,:)=d_v_ajs(:,:)+d_v_the(:,:)
113            d_q_ajs(:,:)=d_q_ajs(:,:)+d_q_the(:,:)
114
115c  incrementation des variables meteo
116            t_seri(:,:) = t_seri(:,:) + d_t_the(:,:)
117            u_seri(:,:) = u_seri(:,:) + d_u_the(:,:)
118            v_seri(:,:) = v_seri(:,:) + d_v_the(:,:)
119            q_seri(:,:) = q_seri(:,:) + d_q_the(:,:)
120
121c   tests sur les valeurs negatives de l'eau
122            DO k = 1, klev
123            DO i = 1, klon
124               if (.not.q_seri(i,k).ge.0.) then
125                   print*,'WARN eau<0 apres therm i=',i,'  k=',k
126     s         ,' dq,q',d_q_the(i,k),q_seri(i,k)
127                  q_seri(i,k)=1.e-15
128               endif
129            ENDDO
130            ENDDO
131
132         enddo ! isplit
133
134      return
135
136      end
Note: See TracBrowser for help on using the repository browser.