1 subroutine thermcell_dq(ngrid,nlay,impl,ptimestep,fm,entr, &
2 & masse,q,
dq,qa,lev_out)
19 integer ngrid,nlay,impl
22 real masse(ngrid,nlay),fm(ngrid,nlay+1)
28 real qa(ngrid,nlay),detr(ngrid,nlay),wqd(ngrid,nlay+1)
35 real qold(ngrid,nlay),fqa(ngrid,nlay+1)
37 CHARACTER (LEN=20) :: modname=
'thermcell_dq'
38 CHARACTER (LEN=80) :: abort_message
44 & masse,q,dq,qa,lev_out)
52 zzm=masse(ig,k)/ptimestep
53 cfl=max(cfl,fm(ig,k)/zzm)
54 if (entr(ig,k).gt.zzm)
then
55 print*,
'entr*dt>m,1',k,entr(ig,k)*ptimestep,masse(ig,k)
56 abort_message =
'entr dt > m, 1st'
65 if (
prt_level.ge.1) print*,
'Q2 THERMCEL_DQ 0'
70 detr(ig,k)=fm(ig,k)-fm(ig,k+1)+entr(ig,k)
73 if (detr(ig,k).lt.0.)
then
74 entr(ig,k)=entr(ig,k)-detr(ig,k)
79 if (fm(ig,k+1).lt.0.)
then
82 if (entr(ig,k).lt.0.)
then
95 if ((fm(ig,k+1)+detr(ig,k))*ptimestep.gt. &
96 & 1.e-5*masse(ig,k))
then
97 qa(ig,k)=(fm(ig,k)*qa(ig,k-1)+entr(ig,k)*q(ig,k)) &
98 & /(fm(ig,k+1)+detr(ig,k))
102 if (qa(ig,k).lt.0.)
then
105 if (q(ig,k).lt.0.)
then
113 fqa(:,k)=fm(:,k)*qa(:,k-1)
115 fqa(:,1)=0. ; fqa(:,nlay)=0.
121 q(:,k)=q(:,k)+(fqa(:,k)-fqa(:,k+1)-fm(:,k)*q(:,k)+fm(:,k+1)*q(:,k+1)) &
122 & *ptimestep/masse(:,k)
131 q(:,k)=(q(:,k)+ptimestep/masse(:,k)*(fqa(:,k)-fqa(:,k+1)+fm(:,k+1)*q(:,k+1))) &
132 & /(1.+fm(:,k)*ptimestep/masse(:,k))
140 dq(ig,k)=(q(ig,k)-qold(ig,k))/ptimestep
153 & masse,q,
dq,qa,lev_out)
165 integer ngrid,nlay,impl
168 real masse(ngrid,nlay),fm(ngrid,nlay+1)
169 real entr(ngrid,nlay)
174 real qa(ngrid,nlay),detr(ngrid,nlay),wqd(ngrid,nlay+1)
181 real qold(ngrid,nlay)
184 CHARACTER (LEN=20) :: modname=
'thermcell_dq'
185 CHARACTER (LEN=80) :: abort_message
193 zzm=masse(ig,k)/ptimestep
194 cfl=max(cfl,fm(ig,k)/zzm)
195 if (entr(ig,k).gt.zzm)
then
196 print*,
'entr*dt>m,2',k,entr(ig,k)*ptimestep,masse(ig,k)
197 abort_message =
'entr dt > m, 2nd'
213 ztimestep=ptimestep/niter
218 if (
prt_level.ge.1) print*,
'Q2 THERMCEL_DQ 0'
223 detr(ig,k)=fm(ig,k)-fm(ig,k+1)+entr(ig,k)
226 if (detr(ig,k).lt.0.)
then
227 entr(ig,k)=entr(ig,k)-detr(ig,k)
232 if (fm(ig,k+1).lt.0.)
then
235 if (entr(ig,k).lt.0.)
then
248 if ((fm(ig,k+1)+detr(ig,k))*ztimestep.gt. &
249 & 1.e-5*masse(ig,k))
then
250 qa(ig,k)=(fm(ig,k)*qa(ig,k-1)+entr(ig,k)*q(ig,k)) &
251 & /(fm(ig,k+1)+detr(ig,k))
255 if (qa(ig,k).lt.0.)
then
258 if (q(ig,k).lt.0.)
then
270 wqd(ig,k)=fm(ig,k)*0.5*(q(ig,k-1)+q(ig,k))
276 zzm=masse(ig,k)/ztimestep
277 if (fm(ig,k)>zzm)
then
278 wqd(ig,k)=zzm*q(ig,k)+(fm(ig,k)-zzm)*q(ig,k+1)
280 wqd(ig,k)=fm(ig,k)*q(ig,k)
283 wqd(ig,k)=fm(ig,k)*q(ig,k)
287 if (wqd(ig,k).lt.0.)
then
301 q(ig,k)=q(ig,k)+(detr(ig,k)*qa(ig,k)-entr(ig,k)*q(ig,k) &
302 & -wqd(ig,k)+wqd(ig,k+1)) &
303 & *ztimestep/masse(ig,k)
317 dq(ig,k)=(q(ig,k)-qold(ig,k))/ptimestep
do llm!au dessus on relaxe vers profil init!on fait l hypothese que dans ce il n y a plus d eau liq au dessus!donc la relaxation en thetal et qt devient relaxation en tempe et qv l dq1 relax dq(l, 1)
!FH On elimine toutes les clefs physiques dans la dynamique prt_level
subroutine thermcell_dq(ngrid, nlay, impl, ptimestep, fm, entr, masse, q, dq, qa, lev_out)
subroutine abort_physic(modname, message, ierr)
subroutine thermcell_dq_o(ngrid, nlay, impl, ptimestep, fm, entr, masse, q, dq, qa, lev_out)