1 | ! |
---|
2 | ! $Header: /home/cvsroot/LMDZ4/libf/phylmd/ocean_slab_mod.F90,v 1.3 2008-02-04 16:24:28 fairhead Exp $ |
---|
3 | ! |
---|
4 | MODULE surf_heat_transp_mod |
---|
5 | |
---|
6 | |
---|
7 | CONTAINS |
---|
8 | |
---|
9 | SUBROUTINE divgrad_phy(ngrid,nlevs,temp,delta) |
---|
10 | |
---|
11 | USE comhdiff_mod, ONLY: zmasqu,zmasqv |
---|
12 | |
---|
13 | IMPLICIT NONE |
---|
14 | |
---|
15 | #include "dimensions.h" |
---|
16 | !#include "dimphys.h" |
---|
17 | #include "paramet.h" |
---|
18 | #include "comgeom.h" |
---|
19 | |
---|
20 | INTEGER,INTENT(IN) :: ngrid, nlevs |
---|
21 | REAL,INTENT(IN) :: temp(ngrid,nlevs) |
---|
22 | REAL,INTENT(OUT) :: delta(ngrid,nlevs) |
---|
23 | REAL delta_2d(ip1jmp1,nlevs) |
---|
24 | INTEGER :: ll |
---|
25 | REAL ghx(ip1jmp1,nlevs), ghy(ip1jm,nlevs) |
---|
26 | |
---|
27 | |
---|
28 | CALL gr_fi_dyn(nlevs,ngrid,iip1,jjp1,temp,delta_2d) |
---|
29 | CALL grad(nlevs,delta_2d,ghx,ghy) |
---|
30 | DO ll=1,nlevs |
---|
31 | ghx(:,ll)=ghx(:,ll)*zmasqu |
---|
32 | ! pas de diffusion zonale |
---|
33 | ! ghx(:,ll)=0. |
---|
34 | ghy(:,ll)=ghy(:,ll)*zmasqv |
---|
35 | END DO |
---|
36 | CALL diverg(nlevs,ghx,ghy,delta_2d) |
---|
37 | CALL gr_dyn_fi(nlevs,iip1,jjp1,ngrid,delta_2d,delta) |
---|
38 | |
---|
39 | |
---|
40 | END SUBROUTINE divgrad_phy |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | SUBROUTINE init_masquv(ngrid,zmasq) |
---|
45 | |
---|
46 | USE comhdiff_mod, ONLY: zmasqu,zmasqv,unsfu,unsfv,unseu,unsev |
---|
47 | |
---|
48 | IMPLICIT NONE |
---|
49 | |
---|
50 | #include "dimensions.h" |
---|
51 | !#include "dimphys.h" |
---|
52 | #include "paramet.h" |
---|
53 | #include "comgeom.h" |
---|
54 | |
---|
55 | |
---|
56 | INTEGER,INTENT(IN) :: ngrid |
---|
57 | REAL zmasq(ngrid) |
---|
58 | REAL zmasq_2d(ip1jmp1) |
---|
59 | REAL ff(ip1jm) |
---|
60 | REAL eps |
---|
61 | INTEGER i |
---|
62 | |
---|
63 | |
---|
64 | ! Masques u,v |
---|
65 | zmasqu=1. |
---|
66 | zmasqv=1. |
---|
67 | |
---|
68 | CALL gr_fi_dyn(1,ngrid,iip1,jjp1,zmasq,zmasq_2d) |
---|
69 | |
---|
70 | DO i=1,ip1jmp1-1 |
---|
71 | IF (zmasq_2d(i).GT.1e-5 .OR. zmasq_2d(i+1).GT.1e-5) THEN |
---|
72 | zmasqu(i)=0. |
---|
73 | ENDIF |
---|
74 | END DO |
---|
75 | DO i=iip1,ip1jmp1,iip1 |
---|
76 | zmasqu(i)=zmasqu(i-iim) |
---|
77 | END DO |
---|
78 | DO i=1,ip1jm |
---|
79 | IF (zmasq_2d(i).GT.1e-5 .OR. zmasq_2d(i+iip1).GT.1e-5) THEN |
---|
80 | zmasqv(i)=0. |
---|
81 | END IF |
---|
82 | END DO |
---|
83 | |
---|
84 | |
---|
85 | ! Coriolis (pour Ekman transp.) |
---|
86 | eps=1e-5 |
---|
87 | ! CALL getin('slab_eps',eps) |
---|
88 | ! print *,'epsilon=',eps |
---|
89 | ff=fext*unsairez |
---|
90 | DO i=1,ip1jm |
---|
91 | unsev(i)=eps/(ff(i)*ff(i)+eps**2) |
---|
92 | unsfv(i)=ff(i)/(ff(i)*ff(i)+eps**2) |
---|
93 | ENDDO |
---|
94 | CALL gr_v_scal(1,unsfv,unsfu) |
---|
95 | CALL gr_v_scal(1,unsev,unseu) |
---|
96 | ! Alpha variable? |
---|
97 | ! alpha_var=.FALSE. |
---|
98 | ! CALL getin('slab_alphav',alpha_var) |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | END SUBROUTINE init_masquv |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | SUBROUTINE slab_ekman2(ngrid,tx_phy,ty_phy,ts_phy,dt_phy) |
---|
107 | |
---|
108 | use slab_ice_h |
---|
109 | USE comhdiff_mod, ONLY: zmasqu,zmasqv,unsfu,unsfv,unseu,unsev |
---|
110 | |
---|
111 | IMPLICIT NONE |
---|
112 | |
---|
113 | #include "dimensions.h" |
---|
114 | !#include "dimphys.h" |
---|
115 | #include "paramet.h" |
---|
116 | #include "comgeom.h" |
---|
117 | |
---|
118 | INTEGER,INTENT(IN) :: ngrid |
---|
119 | INTEGER ij |
---|
120 | REAL txv(ip1jm),fluxm(ip1jm),tyv(ip1jm) |
---|
121 | REAL fluxtm(ip1jm,noceanmx),fluxtz(ip1jmp1,noceanmx) |
---|
122 | REAL tyu(ip1jmp1),txu(ip1jmp1),fluxz(ip1jmp1),fluxv(ip1jmp1) |
---|
123 | REAL dt(ip1jmp1,noceanmx),ts(ip1jmp1,noceanmx) |
---|
124 | REAL tx_phy(ngrid),ty_phy(ngrid) |
---|
125 | REAL dt_phy(ngrid,noceanmx),ts_phy(ngrid,noceanmx) |
---|
126 | |
---|
127 | |
---|
128 | |
---|
129 | |
---|
130 | ! Passage taux,y sur grilles 2d |
---|
131 | CALL gr_fi_dyn(1,ngrid,iip1,jjp1,tx_phy,txu) |
---|
132 | CALL gr_fi_dyn(1,ngrid,iip1,jjp1,ty_phy,tyu) |
---|
133 | ! Passage grille u,v |
---|
134 | ! Multiplication par f ou eps. |
---|
135 | CALL gr_v_scal(1,txu,txv) |
---|
136 | CALL gr_v_scal(1,tyu,tyv) |
---|
137 | fluxm=tyv*unsev-txv*unsfv |
---|
138 | ! fluxm=-txv*unsfv |
---|
139 | CALL gr_u_scal(1,txu,txu) |
---|
140 | CALL gr_u_scal(1,tyu,tyu) |
---|
141 | fluxz=tyu*unsfu+txu*unseu |
---|
142 | ! fluxz=tyu*unsfu |
---|
143 | |
---|
144 | ! Calcul de T, Tdeep |
---|
145 | CALL gr_fi_dyn(2,ngrid,iip1,jjp1,ts_phy,ts) |
---|
146 | |
---|
147 | ! Flux de masse |
---|
148 | fluxm=fluxm*cv*cuvsurcv*zmasqv |
---|
149 | fluxz=fluxz*cu*cvusurcu*zmasqu |
---|
150 | ! Flux de masse vertical |
---|
151 | DO ij=iip2,ip1jm |
---|
152 | fluxv(ij)=fluxz(ij)-fluxz(ij-1)-fluxm(ij)+fluxm(ij-iip1) |
---|
153 | ENDDO |
---|
154 | DO ij=iip1,ip1jmi1,iip1 |
---|
155 | fluxv(ij+1)=fluxv(ij+iip1) |
---|
156 | END DO |
---|
157 | ! Poles |
---|
158 | fluxv(1)=-SUM(fluxm(1:iim)) |
---|
159 | fluxv(ip1jmp1)=SUM(fluxm(ip1jm-iim:ip1jm-1)) |
---|
160 | fluxv=fluxv |
---|
161 | |
---|
162 | !Calcul flux de chaleur méridiens |
---|
163 | DO ij=1,ip1jm |
---|
164 | fluxtm(ij,1)=fluxm(ij)*(ts(ij+iip1,1)+ts(ij,1))/2. |
---|
165 | fluxtm(ij,2)=-fluxm(ij)*(ts(ij+iip1,2)+ts(ij,2))/2. |
---|
166 | END DO |
---|
167 | |
---|
168 | !Calcul flux chaleur zonaux |
---|
169 | DO ij=iip2,ip1jm |
---|
170 | IF (fluxz(ij).GE.0.) THEN |
---|
171 | fluxtz(ij,1)=fluxz(ij)*ts(ij,1) |
---|
172 | fluxtz(ij,2)=-fluxz(ij)*ts(ij+1,2) |
---|
173 | ELSE |
---|
174 | fluxtz(ij,1)=fluxz(ij)*ts(ij+1,1) |
---|
175 | fluxtz(ij,2)=-fluxz(ij)*ts(ij,2) |
---|
176 | ENDIF |
---|
177 | END DO |
---|
178 | DO ij=iip1*2,ip1jmp1,iip1 |
---|
179 | fluxtz(ij,:)=fluxtz(ij-iim,:) |
---|
180 | END DO |
---|
181 | |
---|
182 | ! Calcul de dT |
---|
183 | DO ij=iip2,ip1jm |
---|
184 | dt(ij,:)=fluxtz(ij-1,:)-fluxtz(ij,:) & |
---|
185 | +fluxtm(ij,:)-fluxtm(ij-iip1,:) |
---|
186 | IF (fluxv(ij).GT.0.) THEN |
---|
187 | dt(ij,1)=dt(ij,1)+fluxv(ij)*ts(ij,2) |
---|
188 | dt(ij,2)=dt(ij,2)-fluxv(ij)*ts(ij,2) |
---|
189 | ELSE |
---|
190 | dt(ij,1)=dt(ij,1)+fluxv(ij)*ts(ij,1) |
---|
191 | dt(ij,2)=dt(ij,2)-fluxv(ij)*ts(ij,1) |
---|
192 | ENDIF |
---|
193 | dt(ij,:)=dt(ij,:)/aire(ij) |
---|
194 | END DO |
---|
195 | DO ij=iip1,ip1jmi1,iip1 |
---|
196 | dt(ij+1,:)=dt(ij+iip1,:) |
---|
197 | END DO |
---|
198 | ! Pôles |
---|
199 | dt(1,:)=SUM(fluxtm(1:iim,:),dim=1) |
---|
200 | IF (fluxv(1).GT.0.) THEN |
---|
201 | dt(1,1)=dt(1,1)+fluxv(1)*ts(1,2) |
---|
202 | dt(1,2)=dt(1,2)-fluxv(1)*ts(1,2) |
---|
203 | ELSE |
---|
204 | dt(1,1)=dt(1,1)+fluxv(1)*ts(1,1) |
---|
205 | dt(1,2)=dt(1,2)-fluxv(1)*ts(1,1) |
---|
206 | ENDIF |
---|
207 | dt(1,:)=dt(1,:)/apoln |
---|
208 | dt(ip1jmp1,:)=-SUM(fluxtm(ip1jm-iim:ip1jm-1,:),dim=1) |
---|
209 | IF (fluxv(ip1jmp1).GT.0.) THEN |
---|
210 | dt(ip1jmp1,1)=dt(ip1jmp1,1)+fluxv(ip1jmp1)*ts(ip1jmp1,2) |
---|
211 | dt(ip1jmp1,2)=dt(ip1jmp1,2)-fluxv(ip1jmp1)*ts(ip1jmp1,2) |
---|
212 | ELSE |
---|
213 | dt(ip1jmp1,1)=dt(ip1jmp1,1)+fluxv(ip1jmp1)*ts(ip1jmp1,1) |
---|
214 | dt(ip1jmp1,2)=dt(ip1jmp1,2)-fluxv(ip1jmp1)*ts(ip1jmp1,1) |
---|
215 | ENDIF |
---|
216 | dt(ip1jmp1,:)=dt(ip1jmp1,:)/apols |
---|
217 | dt(2:iip1,1)=dt(1,1) |
---|
218 | dt(2:iip1,2)=dt(1,2) |
---|
219 | dt(ip1jm+1:ip1jmp1,1)=dt(ip1jmp1,1) |
---|
220 | dt(ip1jm+1:ip1jmp1,2)=dt(ip1jmp1,2) |
---|
221 | |
---|
222 | ! Retour grille physique |
---|
223 | CALL gr_dyn_fi(2,iip1,jjp1,ngrid,dt,dt_phy) |
---|
224 | |
---|
225 | |
---|
226 | END SUBROUTINE slab_ekman2 |
---|
227 | |
---|
228 | |
---|
229 | END MODULE surf_heat_transp_mod |
---|
230 | |
---|
231 | |
---|
232 | |
---|