1 | ! |
---|
2 | ! $Id: phystokenc_mod.F90 5131 2024-07-26 07:43:31Z abarral $ |
---|
3 | ! |
---|
4 | MODULE phystokenc_mod |
---|
5 | |
---|
6 | IMPLICIT NONE |
---|
7 | |
---|
8 | LOGICAL,SAVE :: offline |
---|
9 | !$OMP THREADPRIVATE(offline) |
---|
10 | INTEGER,SAVE :: istphy |
---|
11 | !$OMP THREADPRIVATE(istphy) |
---|
12 | |
---|
13 | |
---|
14 | CONTAINS |
---|
15 | |
---|
16 | SUBROUTINE init_phystokenc(offline_dyn,istphy_dyn) |
---|
17 | IMPLICIT NONE |
---|
18 | LOGICAL,INTENT(IN) :: offline_dyn |
---|
19 | INTEGER,INTENT(IN) :: istphy_dyn |
---|
20 | |
---|
21 | offline=offline_dyn |
---|
22 | istphy=istphy_dyn |
---|
23 | |
---|
24 | END SUBROUTINE init_phystokenc |
---|
25 | |
---|
26 | SUBROUTINE phystokenc (nlon,nlev,pdtphys,rlon,rlat, & |
---|
27 | pt,pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, & |
---|
28 | pfm_therm,pentr_therm, & |
---|
29 | cdragh, pcoefh,pyu1,pyv1,pftsol,pctsrf, & |
---|
30 | frac_impa,frac_nucl, & |
---|
31 | pphis,paire,dtime,itap, & |
---|
32 | psh, pda, pphi, pmp, pupwd, pdnwd,pwght) |
---|
33 | |
---|
34 | USE ioipsl |
---|
35 | USE dimphy |
---|
36 | USE infotrac_phy, ONLY : nqtot |
---|
37 | USE iophy |
---|
38 | USE indice_sol_mod |
---|
39 | USE print_control_mod, ONLY: lunout |
---|
40 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat |
---|
41 | USE phys_local_var_mod, ONLY : t_stok, mfu_stok, mfd_stok, de_u_stok,de_d_stok, en_d_stok, & |
---|
42 | yu1_stok,yv1_stok, en_u_stok,coefh_stok, fm_therm_stok,sh_stok,& |
---|
43 | da_stok, phi_stok, mp_stok, upwd_stok, dnwd_stok, wght_stok,entr_therm_stok, pctsrf_stok,ftsol_stok,write_offline |
---|
44 | USE write_field_phy |
---|
45 | |
---|
46 | IMPLICIT NONE |
---|
47 | |
---|
48 | !====================================================================== |
---|
49 | ! Auteur(s) FH |
---|
50 | ! Objet: Ecriture des variables pour transport offline |
---|
51 | ! |
---|
52 | !====================================================================== |
---|
53 | |
---|
54 | ! Arguments: |
---|
55 | ! |
---|
56 | REAL,DIMENSION(klon,klev), INTENT(IN) :: psh ! humidite specifique |
---|
57 | REAL, DIMENSION(klon,klev), INTENT(in) :: pt ! temperature |
---|
58 | !Variables convectives KE |
---|
59 | REAL,DIMENSION(klon,klev), INTENT(IN) :: pda |
---|
60 | REAL,DIMENSION(klon,klev,klev), INTENT(IN):: pphi |
---|
61 | REAL,DIMENSION(klon,klev), INTENT(IN) :: pmp |
---|
62 | REAL,DIMENSION(klon,klev), INTENT(IN) :: pupwd ! saturated updraft mass flux |
---|
63 | REAL,DIMENSION(klon,klev), INTENT(IN) :: pdnwd ! saturated downdraft mass flux |
---|
64 | REAL,DIMENSION(klon,klev), INTENT(IN) :: pwght |
---|
65 | !Variables TIE |
---|
66 | REAL, DIMENSION(klon,klev), INTENT(in) :: pmfu ! flux de masse dans le panache montant |
---|
67 | REAL, DIMENSION(klon,klev), INTENT(in) :: pmfd ! flux de masse dans le panache descendant |
---|
68 | REAL, DIMENSION(klon,klev), INTENT(in) :: pen_u ! flux entraine dans le panache montant |
---|
69 | REAL, DIMENSION(klon,klev), INTENT(in) :: pde_u ! flux detraine dans le panache montant |
---|
70 | REAL, DIMENSION(klon,klev), INTENT(in) :: pen_d ! flux entraine dans le panache descendant |
---|
71 | REAL, DIMENSION(klon,klev), INTENT(in) :: pde_d ! flux detraine dans le panache descendant |
---|
72 | !Couche limite |
---|
73 | REAL, DIMENSION(klon), INTENT(in) :: pyv1,pyu1 |
---|
74 | REAL, DIMENSION(klon), INTENT(in) :: pphis,paire |
---|
75 | REAL, DIMENSION(klon,klev), INTENT(in) :: pcoefh ! coeff melange CL |
---|
76 | REAL, DIMENSION(klon), INTENT(in) :: cdragh ! cdragi |
---|
77 | REAL, INTENT(in) :: pftsol(klon,nbsrf) ! Temperature du sol (surf)(Kelvin) |
---|
78 | REAL, INTENT(in) :: pctsrf(klon,nbsrf) ! Pourcentage de sol f(nature du sol) |
---|
79 | !Thermiques |
---|
80 | REAL,DIMENSION(klon,klev+1), INTENT(IN) :: pfm_therm |
---|
81 | REAL, DIMENSION(klon,klev), INTENT(in) :: pentr_therm |
---|
82 | !Divers |
---|
83 | INTEGER, INTENT(in) :: nlon,nlev |
---|
84 | REAL,INTENT(in) :: pdtphys,dtime |
---|
85 | INTEGER,INTENT(in) :: itap |
---|
86 | REAL, INTENT(in) :: frac_impa(klon,klev) ! Lessivage |
---|
87 | REAL, INTENT(in) :: frac_nucl(klon,klev) ! Lessivage |
---|
88 | INTEGER, SAVE :: physid |
---|
89 | REAL pcoefh_buf(klon,klev) ! coeff melange CL + cdrag |
---|
90 | REAL rlon(klon), rlat(klon) |
---|
91 | ! |
---|
92 | ! Arguments necessaires pour les sources et puits de traceur |
---|
93 | ! |
---|
94 | !====================================================================== |
---|
95 | INTEGER i, k, kk |
---|
96 | REAL, SAVE :: dtcum |
---|
97 | INTEGER, SAVE:: iadvtr=0 |
---|
98 | !$OMP THREADPRIVATE(dtcum,iadvtr) |
---|
99 | REAL zmin,zmax |
---|
100 | !====================================================================== |
---|
101 | write_offline=.true. |
---|
102 | ! Dans le meme vecteur on recombine le drag et les coeff d'echange |
---|
103 | pcoefh_buf(:,1) = cdragh(:) |
---|
104 | pcoefh_buf(:,2:klev) = pcoefh(:,2:klev) |
---|
105 | |
---|
106 | iadvtr=iadvtr+1 |
---|
107 | |
---|
108 | ! Set to zero cumulating fields |
---|
109 | !====================================================================== |
---|
110 | IF (MOD(iadvtr,istphy)==1.OR.istphy==1) THEN |
---|
111 | WRITE(lunout,*)'reinitialisation des champs cumules a iadvtr=',iadvtr |
---|
112 | mfu_stok(:,:)=0. |
---|
113 | mfd_stok(:,:)=0. |
---|
114 | de_u_stok(:,:)=0. |
---|
115 | en_d_stok(:,:)=0. |
---|
116 | de_d_stok(:,:)=0. |
---|
117 | en_u_stok(:,:)=0. |
---|
118 | coefh_stok(:,:)=0. |
---|
119 | t_stok(:,:)=0. |
---|
120 | fm_therm_stok(:,:)=0. |
---|
121 | entr_therm_stok(:,:)=0. |
---|
122 | da_stok(:,:)=0. |
---|
123 | phi_stok(:,:,:)=0. |
---|
124 | mp_stok(:,:)=0. |
---|
125 | upwd_stok(:,:)=0. |
---|
126 | dnwd_stok(:,:)=0. |
---|
127 | wght_stok(:,:)=0. |
---|
128 | sh_stok(:,:)=0. |
---|
129 | yu1_stok(:)=0 |
---|
130 | yv1_stok(:)=0 |
---|
131 | ftsol_stok(:,:)=0 |
---|
132 | pctsrf_stok(:,:)=0 |
---|
133 | |
---|
134 | dtcum=0. |
---|
135 | ENDIF |
---|
136 | |
---|
137 | |
---|
138 | ! Cumulate fields at each time step |
---|
139 | !====================================================================== |
---|
140 | DO k=1,klev |
---|
141 | DO i=1,klon |
---|
142 | mfu_stok(i,k)=mfu_stok(i,k)+pmfu(i,k)*pdtphys |
---|
143 | mfd_stok(i,k)=mfd_stok(i,k)+pmfd(i,k)*pdtphys |
---|
144 | de_u_stok(i,k)=de_u_stok(i,k)+pde_u(i,k)*pdtphys |
---|
145 | en_d_stok(i,k)=en_d_stok(i,k)+pen_d(i,k)*pdtphys |
---|
146 | coefh_stok(i,k)=coefh_stok(i,k)+pcoefh_buf(i,k)*pdtphys |
---|
147 | t_stok(i,k)=t_stok(i,k)+pt(i,k)*pdtphys |
---|
148 | fm_therm_stok(i,k)=fm_therm_stok(i,k)+pfm_therm(i,k)*pdtphys |
---|
149 | entr_therm_stok(i,k)=entr_therm_stok(i,k)+pentr_therm(i,k)*pdtphys |
---|
150 | da_stok(i,k) = da_stok(i,k) + pda(i,k)*pdtphys |
---|
151 | mp_stok(i,k) = mp_stok(i,k) + pmp(i,k)*pdtphys |
---|
152 | upwd_stok(i,k) = upwd_stok(i,k) + pupwd(i,k)*pdtphys |
---|
153 | dnwd_stok(i,k) = dnwd_stok(i,k) + pdnwd(i,k)*pdtphys |
---|
154 | wght_stok(i,k) = wght_stok(i,k) + pwght(i,k)*pdtphys |
---|
155 | ENDDO |
---|
156 | ENDDO |
---|
157 | DO k=1,nbsrf |
---|
158 | DO i=1,klon |
---|
159 | ftsol_stok(i,k)=ftsol_stok(i,k)+pftsol(i,k)*pdtphys |
---|
160 | pctsrf_stok(i,k)=pctsrf_stok(i,k)+pctsrf(i,k)*pdtphys |
---|
161 | ENDDO |
---|
162 | END DO |
---|
163 | DO i=1,klon |
---|
164 | yu1_stok(i)=yu1_stok(i)+pyu1(i)*pdtphys |
---|
165 | yv1_stok(i)=yv1_stok(i)+pyv1(i)*pdtphys |
---|
166 | ENDDO |
---|
167 | DO kk=1,klev |
---|
168 | DO k=1,klev |
---|
169 | DO i=1,klon |
---|
170 | phi_stok(i,k,kk) = phi_stok(i,k,kk) + pphi(i,k,kk)*pdtphys |
---|
171 | END DO |
---|
172 | END DO |
---|
173 | END DO |
---|
174 | |
---|
175 | ! Add time step to cumulated time |
---|
176 | dtcum=dtcum+pdtphys |
---|
177 | |
---|
178 | ! Write fields to file, if it is time to do so |
---|
179 | !====================================================================== |
---|
180 | IF(MOD(iadvtr,istphy)==0) THEN |
---|
181 | |
---|
182 | mfu_stok(:,:)=mfu_stok(:,:)/dtcum |
---|
183 | mfd_stok(:,:)=mfd_stok/dtcum |
---|
184 | de_u_stok(:,:)=de_u_stok/dtcum |
---|
185 | en_d_stok(:,:)=en_d_stok/dtcum |
---|
186 | de_d_stok(:,:)=de_d_stok/dtcum |
---|
187 | en_u_stok(:,:)=en_u_stok/dtcum |
---|
188 | coefh_stok(:,:)=coefh_stok/dtcum |
---|
189 | t_stok(:,:)=t_stok/dtcum |
---|
190 | fm_therm_stok(:,:)=fm_therm_stok/dtcum |
---|
191 | entr_therm_stok(:,:)=entr_therm_stok/dtcum |
---|
192 | da_stok(:,:)=da_stok/dtcum |
---|
193 | phi_stok(:,:,:)=phi_stok/dtcum |
---|
194 | mp_stok(:,:)=mp_stok/dtcum |
---|
195 | upwd_stok(:,:)=upwd_stok/dtcum |
---|
196 | dnwd_stok(:,:)=dnwd_stok/dtcum |
---|
197 | wght_stok(:,:)=wght_stok/dtcum |
---|
198 | sh_stok(:,:)=sh_stok/dtcum |
---|
199 | yu1_stok(:)=yu1_stok/dtcum |
---|
200 | yv1_stok(:)=yv1_stok/dtcum |
---|
201 | ftsol_stok(:,:)=ftsol_stok/dtcum |
---|
202 | pctsrf_stok(:,:)=pctsrf_stok/dtcum |
---|
203 | |
---|
204 | write_offline=.true. |
---|
205 | |
---|
206 | ENDIF |
---|
207 | |
---|
208 | |
---|
209 | END SUBROUTINE phystokenc |
---|
210 | |
---|
211 | END MODULE phystokenc_mod |
---|
212 | |
---|