1 | SUBROUTINE thermcell_env(ngrid,nlay,po,pt,pu,pv,pplay, & |
---|
2 | & pplev,zo,zh,zl,ztv,zthl,zu,zv,zpspsk,pqsat,lev_out) |
---|
3 | |
---|
4 | !-------------------------------------------------------------- |
---|
5 | !thermcell_env: calcule les caracteristiques de l environnement |
---|
6 | !necessaires au calcul des proprietes dans le thermique |
---|
7 | !-------------------------------------------------------------- |
---|
8 | |
---|
9 | |
---|
10 | USE thermcell_ini_mod, ONLY : prt_level,RLvCp,RKAPPA,RETV |
---|
11 | IMPLICIT NONE |
---|
12 | |
---|
13 | ! arguments |
---|
14 | |
---|
15 | integer,intent(in) :: ngrid,nlay,lev_out |
---|
16 | real,intent(in), dimension(ngrid,nlay) :: po,pt,pu,pv,pplay |
---|
17 | real,intent(in), dimension(ngrid,nlay+1) :: pplev |
---|
18 | real,intent(out), dimension(ngrid,nlay) :: zo,zl,zh,ztv,zthl |
---|
19 | real,intent(out), dimension(ngrid,nlay) :: zpspsk,zu,zv,pqsat |
---|
20 | |
---|
21 | ! Local |
---|
22 | |
---|
23 | integer ig,ll |
---|
24 | real dqsat_dT |
---|
25 | logical mask(ngrid,nlay) |
---|
26 | |
---|
27 | !$acc data create (mask) & |
---|
28 | !$acc & copyin (po, pt, pu, pv, pplay, pplev) & |
---|
29 | !$acc & copyout (zo, zl, zh, ztv, zthl) & |
---|
30 | !$acc & copyout (zpspsk, zu, zv, pqsat) & |
---|
31 | !$acc & |
---|
32 | |
---|
33 | |
---|
34 | !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
35 | ! Initialisations : |
---|
36 | !------------------ |
---|
37 | !!! temporary for GPU port write(81) ngrid,nlay,lev_out,po,pt,pu,pv,pplay,pplev |
---|
38 | |
---|
39 | |
---|
40 | !$acc kernels default(none) async |
---|
41 | mask(:,:)=.true. |
---|
42 | !$acc end kernels |
---|
43 | |
---|
44 | ! |
---|
45 | ! calcul des caracteristiques de l environnement |
---|
46 | !$acc kernels default(none) async |
---|
47 | DO ll=1,nlay |
---|
48 | DO ig=1,ngrid |
---|
49 | zo(ig,ll)=po(ig,ll) |
---|
50 | zl(ig,ll)=0. |
---|
51 | zh(ig,ll)=pt(ig,ll) |
---|
52 | enddo |
---|
53 | enddo |
---|
54 | !$acc end kernels |
---|
55 | |
---|
56 | ! Condensation : |
---|
57 | !--------------- |
---|
58 | ! Calcul de l'humidite a saturation et de la condensation |
---|
59 | |
---|
60 | call thermcell_qsat(ngrid*nlay,mask,pplev,pt,po,pqsat) |
---|
61 | !$acc kernels default(none) async |
---|
62 | do ll=1,nlay |
---|
63 | do ig=1,ngrid |
---|
64 | zl(ig,ll) = max(0.,po(ig,ll)-pqsat(ig,ll)) |
---|
65 | zh(ig,ll) = pt(ig,ll)+RLvCp*zl(ig,ll) ! T = Tl + Lv/Cp ql |
---|
66 | zo(ig,ll) = po(ig,ll)-zl(ig,ll) |
---|
67 | enddo |
---|
68 | enddo |
---|
69 | !$acc end kernels |
---|
70 | !----------------------------------------------------------------------- |
---|
71 | if (prt_level.ge.1) print*,'0 OK convect8' |
---|
72 | |
---|
73 | !$acc kernels default(none) async |
---|
74 | do ll=1,nlay |
---|
75 | do ig=1,ngrid |
---|
76 | zpspsk(ig,ll)=(pplay(ig,ll)/100000.)**RKAPPA |
---|
77 | zu(ig,ll)=pu(ig,ll) |
---|
78 | zv(ig,ll)=pv(ig,ll) |
---|
79 | !attention zh est maintenant le profil de T et plus le profil de theta ! |
---|
80 | ! Quelle horreur ! A eviter. |
---|
81 | ! T-> Theta |
---|
82 | ztv(ig,ll)=zh(ig,ll)/zpspsk(ig,ll) |
---|
83 | !Theta_v |
---|
84 | ztv(ig,ll)=ztv(ig,ll)*(1.+RETV*(zo(ig,ll))-zl(ig,ll)) |
---|
85 | !Thetal |
---|
86 | zthl(ig,ll)=pt(ig,ll)/zpspsk(ig,ll) |
---|
87 | ! |
---|
88 | enddo |
---|
89 | enddo |
---|
90 | !$acc end kernels |
---|
91 | |
---|
92 | !!! temporary for GPU port !!!$acc update self(zo, zl, zh, ztv, zthl,zpspsk, zu, zv, pqsat) |
---|
93 | !!! temporary for GPU port include "dump_param.h" ! replay automatic include |
---|
94 | !$acc end data |
---|
95 | RETURN |
---|
96 | END |
---|