1 |
MODULE interface_surf |
MODULE interface_surf |
2 |
|
|
3 |
! From phylmd/interface_surf.F90,v 1.8 2005/05/25 13:10:09 |
! From phylmd/interface_surf.F90, version 1.8 2005/05/25 13:10:09 |
4 |
|
|
5 |
! Ce module regroupe toutes les routines gérant l'interface entre le modèle |
! Ce module regroupe toutes les routines gérant l'interface entre le modèle |
6 |
! atmosphérique et les modèles de surface (sols continentaux, |
! atmosphérique et les modèles de surface (sols continentaux, |
18 |
PUBLIC :: interfsurf_hq |
PUBLIC :: interfsurf_hq |
19 |
|
|
20 |
! run_off ruissellement total |
! run_off ruissellement total |
21 |
REAL, ALLOCATABLE, DIMENSION(:),SAVE :: run_off, run_off_lic |
REAL, ALLOCATABLE, DIMENSION(:), SAVE :: run_off, run_off_lic |
22 |
real, allocatable, dimension(:),save :: coastalflow, riverflow |
real, allocatable, dimension(:), save :: coastalflow, riverflow |
23 |
|
|
24 |
REAL, ALLOCATABLE, DIMENSION(:,:), SAVE :: tmp_rriv, tmp_rcoa,tmp_rlic |
REAL, ALLOCATABLE, DIMENSION(:, :), SAVE :: tmp_rriv, tmp_rcoa, tmp_rlic |
25 |
!! pour simuler la fonte des glaciers antarctiques |
!! pour simuler la fonte des glaciers antarctiques |
26 |
REAL, ALLOCATABLE, DIMENSION(:,:), SAVE :: coeff_iceberg |
REAL, ALLOCATABLE, DIMENSION(:, :), SAVE :: coeff_iceberg |
27 |
real, save :: surf_maille |
real, save :: surf_maille |
28 |
real, save :: cte_flux_iceberg = 6.3e7 |
real, save :: cte_flux_iceberg = 6.3e7 |
29 |
integer, save :: num_antarctic = 1 |
integer, save :: num_antarctic = 1 |
33 |
|
|
34 |
SUBROUTINE interfsurf_hq(itime, dtime, date0, jour, rmu0, & |
SUBROUTINE interfsurf_hq(itime, dtime, date0, jour, rmu0, & |
35 |
& klon, iim, jjm, nisurf, knon, knindex, pctsrf, & |
& klon, iim, jjm, nisurf, knon, knindex, pctsrf, & |
36 |
& rlon, rlat, cufi, cvfi,& |
& rlon, rlat, cufi, cvfi, & |
37 |
& debut, lafin, ok_veget, soil_model, nsoilmx, tsoil, qsol,& |
& debut, lafin, ok_veget, soil_model, nsoilmx, tsoil, qsol, & |
38 |
& zlev, u1_lay, v1_lay, temp_air, spechum, epot_air, ccanopy, & |
& zlev, u1_lay, v1_lay, temp_air, spechum, epot_air, ccanopy, & |
39 |
& tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, & |
& tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, & |
40 |
& precip_rain, precip_snow, sollw, sollwdown, swnet, swdown, & |
& precip_rain, precip_snow, sollw, sollwdown, swnet, swdown, & |
46 |
& ocean, npas, nexca, zmasq, & |
& ocean, npas, nexca, zmasq, & |
47 |
& evap, fluxsens, fluxlat, dflux_l, dflux_s, & |
& evap, fluxsens, fluxlat, dflux_l, dflux_s, & |
48 |
& tsol_rad, tsurf_new, alb_new, alblw, emis_new, & |
& tsol_rad, tsurf_new, alb_new, alblw, emis_new, & |
49 |
& z0_new, pctsrf_new, agesno,fqcalving,ffonte, run_off_lic_0,& |
& z0_new, pctsrf_new, agesno, fqcalving, ffonte, run_off_lic_0, & |
50 |
!IM "slab" ocean |
!IM "slab" ocean |
51 |
& flux_o, flux_g, tslab, seaice) |
& flux_o, flux_g, tslab, seaice) |
52 |
|
|
53 |
! Cette routine sert d'aiguillage entre l'atmosphère et la surface |
! Cette routine sert d'aiguillage entre l'atmosphère et la surface |
54 |
! en général (sols continentaux, océans, glaces) pour les fluxs de |
! en général (sols continentaux, océans, glaces) pour les flux de |
55 |
! chaleur et d'humidité. |
! chaleur et d'humidité. |
56 |
! En pratique l'interface se fait entre la couche limite du modèle |
! En pratique l'interface se fait entre la couche limite du modèle |
57 |
! atmosphérique ("clmain.F") et les routines de surface |
! atmosphérique ("clmain.F") et les routines de surface |
59 |
|
|
60 |
! L.Fairhead 02/2000 |
! L.Fairhead 02/2000 |
61 |
|
|
62 |
|
use abort_gcm_m, only: abort_gcm |
63 |
|
use gath_cpl, only: gath2cpl |
64 |
|
use indicesol |
65 |
|
use YOMCST |
66 |
|
use albsno_m, only: albsno |
67 |
|
|
68 |
|
! Parametres d'entree |
69 |
! input: |
! input: |
70 |
! klon nombre total de points de grille |
! klon nombre total de points de grille |
71 |
! iim, jjm nbres de pts de grille |
! iim, jjm nbres de pts de grille |
80 |
! pctsrf tableau des pourcentages de surface de chaque maille |
! pctsrf tableau des pourcentages de surface de chaque maille |
81 |
! rlon longitudes |
! rlon longitudes |
82 |
! rlat latitudes |
! rlat latitudes |
83 |
! cufi,cvfi resolution des mailles en x et y (m) |
! cufi, cvfi resolution des mailles en x et y (m) |
84 |
! debut logical: 1er appel a la physique |
! debut logical: 1er appel a la physique |
85 |
! lafin logical: dernier appel a la physique |
! lafin logical: dernier appel a la physique |
86 |
! ok_veget logical: appel ou non au schema de surface continental |
! ok_veget logical: appel ou non au schema de surface continental |
111 |
! p1lay pression 1er niveau (milieu de couche) |
! p1lay pression 1er niveau (milieu de couche) |
112 |
! ps pression au sol |
! ps pression au sol |
113 |
! radsol rayonnement net aus sol (LW + SW) |
! radsol rayonnement net aus sol (LW + SW) |
114 |
! ocean type d'ocean utilise (force, slab, couple) |
! ocean type d'ocean utilise ("force" ou "slab" mais pas "couple") |
115 |
! fder derivee des flux (pour le couplage) |
! fder derivee des flux (pour le couplage) |
116 |
! taux, tauy tension de vents |
! taux, tauy tension de vents |
117 |
! windsp module du vent a 10m |
! windsp module du vent a 10m |
119 |
! zmasq masque terre/ocean |
! zmasq masque terre/ocean |
120 |
! rugoro rugosite orographique |
! rugoro rugosite orographique |
121 |
! run_off_lic_0 runoff glacier du pas de temps precedent |
! run_off_lic_0 runoff glacier du pas de temps precedent |
|
|
|
|
! output: |
|
|
! evap evaporation totale |
|
|
! fluxsens flux de chaleur sensible |
|
|
! fluxlat flux de chaleur latente |
|
|
! tsol_rad |
|
|
! tsurf_new temperature au sol |
|
|
! alb_new albedo |
|
|
! emis_new emissivite |
|
|
! z0_new surface roughness |
|
|
! pctsrf_new nouvelle repartition des surfaces |
|
|
|
|
|
use abort_gcm_m, only: abort_gcm |
|
|
use gath_cpl, only: gath2cpl |
|
|
use indicesol |
|
|
use YOMCST |
|
|
use albsno_m, only: albsno |
|
|
|
|
|
! Parametres d'entree |
|
122 |
integer, intent(IN) :: itime ! numero du pas de temps |
integer, intent(IN) :: itime ! numero du pas de temps |
123 |
integer, intent(IN) :: iim, jjm |
integer, intent(IN) :: iim, jjm |
124 |
integer, intent(IN) :: klon |
integer, intent(IN) :: klon |
129 |
integer, intent(IN) :: nisurf |
integer, intent(IN) :: nisurf |
130 |
integer, intent(IN) :: knon |
integer, intent(IN) :: knon |
131 |
integer, dimension(klon), intent(in) :: knindex |
integer, dimension(klon), intent(in) :: knindex |
132 |
real, dimension(klon,nbsrf), intent(IN) :: pctsrf |
real, dimension(klon, nbsrf), intent(IN) :: pctsrf |
133 |
logical, intent(IN) :: debut, lafin, ok_veget |
logical, intent(IN) :: debut, lafin, ok_veget |
134 |
real, dimension(klon), intent(IN) :: rlon, rlat |
real, dimension(klon), intent(IN) :: rlon, rlat |
135 |
real, dimension(klon), intent(IN) :: cufi, cvfi |
real, dimension(klon), intent(IN) :: cufi, cvfi |
149 |
real, allocatable, dimension(:), save :: tmp_tslab |
real, allocatable, dimension(:), save :: tmp_tslab |
150 |
real, dimension(klon), intent(OUT) :: flux_o, flux_g |
real, dimension(klon), intent(OUT) :: flux_o, flux_g |
151 |
real, dimension(klon), intent(INOUT) :: seaice ! glace de mer (kg/m2) |
real, dimension(klon), intent(INOUT) :: seaice ! glace de mer (kg/m2) |
152 |
REAL, DIMENSION(klon), INTENT(INOUT) :: radsol,fder |
REAL, DIMENSION(klon), INTENT(INOUT) :: radsol, fder |
153 |
real, dimension(klon), intent(IN) :: zmasq |
real, dimension(klon), intent(IN) :: zmasq |
154 |
real, dimension(klon), intent(IN) :: taux, tauy, rugos, rugoro |
real, dimension(klon), intent(IN) :: taux, tauy, rugos, rugoro |
155 |
real, dimension(klon), intent(IN) :: windsp |
real, dimension(klon), intent(IN) :: windsp |
156 |
character (len = 6) :: ocean |
character(len=*), intent(IN):: ocean |
157 |
integer :: npas, nexca ! nombre et pas de temps couplage |
integer :: npas, nexca ! nombre et pas de temps couplage |
158 |
real, dimension(klon), intent(INOUT) :: evap, snow, qsurf |
real, dimension(klon), intent(INOUT) :: evap, snow, qsurf |
159 |
!! PB ajout pour soil |
!! PB ajout pour soil |
160 |
logical :: soil_model |
logical, intent(in):: soil_model |
161 |
integer :: nsoilmx |
integer :: nsoilmx |
162 |
REAL, DIMENSION(klon, nsoilmx) :: tsoil |
REAL, DIMENSION(klon, nsoilmx) :: tsoil |
163 |
REAL, dimension(klon), intent(INOUT) :: qsol |
REAL, dimension(klon), intent(INOUT) :: qsol |
164 |
REAL, dimension(klon) :: soilcap |
REAL, dimension(klon) :: soilcap |
165 |
REAL, dimension(klon) :: soilflux |
REAL, dimension(klon) :: soilflux |
166 |
|
|
167 |
! Parametres de sortie |
! Parametres de sortie |
168 |
|
! output: |
169 |
|
! evap evaporation totale |
170 |
|
! fluxsens flux de chaleur sensible |
171 |
|
! fluxlat flux de chaleur latente |
172 |
|
! tsol_rad |
173 |
|
! tsurf_new temperature au sol |
174 |
|
! alb_new albedo |
175 |
|
! emis_new emissivite |
176 |
|
! z0_new surface roughness |
177 |
|
! pctsrf_new nouvelle repartition des surfaces |
178 |
real, dimension(klon), intent(OUT):: fluxsens, fluxlat |
real, dimension(klon), intent(OUT):: fluxsens, fluxlat |
179 |
real, dimension(klon), intent(OUT):: tsol_rad, tsurf_new, alb_new |
real, dimension(klon), intent(OUT):: tsol_rad, tsurf_new, alb_new |
180 |
real, dimension(klon), intent(OUT):: alblw |
real, dimension(klon), intent(OUT):: alblw |
181 |
real, dimension(klon), intent(OUT):: emis_new, z0_new |
real, dimension(klon), intent(OUT):: emis_new, z0_new |
182 |
real, dimension(klon), intent(OUT):: dflux_l, dflux_s |
real, dimension(klon), intent(OUT):: dflux_l, dflux_s |
183 |
real, dimension(klon,nbsrf), intent(OUT) :: pctsrf_new |
real, dimension(klon, nbsrf), intent(OUT) :: pctsrf_new |
184 |
real, dimension(klon), intent(INOUT):: agesno |
real, dimension(klon), intent(INOUT):: agesno |
185 |
real, dimension(klon), intent(INOUT):: run_off_lic_0 |
real, dimension(klon), intent(INOUT):: run_off_lic_0 |
186 |
|
|
197 |
integer i |
integer i |
198 |
real, allocatable, dimension(:), save :: tmp_flux_o, tmp_flux_g |
real, allocatable, dimension(:), save :: tmp_flux_o, tmp_flux_g |
199 |
real, allocatable, dimension(:), save :: tmp_radsol |
real, allocatable, dimension(:), save :: tmp_radsol |
200 |
real, allocatable, dimension(:,:), save :: tmp_pctsrf_slab |
real, allocatable, dimension(:, :), save :: tmp_pctsrf_slab |
201 |
real, allocatable, dimension(:), save :: tmp_seaice |
real, allocatable, dimension(:), save :: tmp_seaice |
202 |
|
|
203 |
! Local |
! Local |
204 |
character (len = 20),save :: modname = 'interfsurf_hq' |
character (len = 20), save :: modname = 'interfsurf_hq' |
205 |
character (len = 80) :: abort_message |
character (len = 80) :: abort_message |
206 |
logical, save :: first_call = .true. |
logical, save :: first_call = .true. |
207 |
integer, save :: error |
integer, save :: error |
208 |
integer :: ii |
integer :: ii |
209 |
logical,save :: check = .false. |
logical, save :: check = .false. |
210 |
real, dimension(klon):: cal, beta, dif_grnd, capsol |
real, dimension(klon):: cal, beta, dif_grnd, capsol |
|
!!$PB real, parameter :: calice=1.0/(5.1444e+06*0.15), tau_gl=86400.*5. |
|
211 |
real, parameter :: calice=1.0/(5.1444e+06*0.15), tau_gl=86400.*5. |
real, parameter :: calice=1.0/(5.1444e+06*0.15), tau_gl=86400.*5. |
212 |
real, parameter :: calsno=1./(2.3867e+06*.15) |
real, parameter :: calsno=1./(2.3867e+06*.15) |
213 |
real, dimension(klon):: tsurf_temp |
real, dimension(klon):: tsurf_temp |
214 |
real, dimension(klon):: alb_neig, alb_eau |
real, dimension(klon):: alb_neig, alb_eau |
215 |
real, DIMENSION(klon):: zfra |
real, DIMENSION(klon):: zfra |
216 |
logical :: cumul = .false. |
logical :: cumul = .false. |
217 |
INTEGER,dimension(1) :: iloc |
INTEGER, dimension(1) :: iloc |
218 |
real, dimension(klon):: fder_prev |
real, dimension(klon):: fder_prev |
219 |
REAL, dimension(klon) :: bidule |
REAL, dimension(klon) :: bidule |
220 |
|
|
221 |
!------------------------------------------------------------- |
!------------------------------------------------------------- |
222 |
|
|
223 |
if (check) write(*,*) 'Entree ', modname |
if (check) write(*, *) 'Entree ', modname |
224 |
|
|
225 |
! On doit commencer par appeler les schemas de surfaces continentales |
! On doit commencer par appeler les schemas de surfaces continentales |
226 |
! car l'ocean a besoin du ruissellement qui est y calcule |
! car l'ocean a besoin du ruissellement qui est y calcule |
228 |
if (first_call) then |
if (first_call) then |
229 |
call conf_interface(tau_calv) |
call conf_interface(tau_calv) |
230 |
if (nisurf /= is_ter .and. klon > 1) then |
if (nisurf /= is_ter .and. klon > 1) then |
231 |
write(*,*)' *** Warning ***' |
write(*, *)' *** Warning ***' |
232 |
write(*,*)' nisurf = ',nisurf,' /= is_ter = ',is_ter |
write(*, *)' nisurf = ', nisurf, ' /= is_ter = ', is_ter |
233 |
write(*,*)'or on doit commencer par les surfaces continentales' |
write(*, *)'or on doit commencer par les surfaces continentales' |
234 |
abort_message='voir ci-dessus' |
abort_message='voir ci-dessus' |
235 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
236 |
endif |
endif |
237 |
if (ocean /= 'slab' .and. ocean /= 'force' .and. ocean /= 'couple') then |
if (ocean /= 'slab' .and. ocean /= 'force') then |
238 |
write(*,*)' *** Warning ***' |
write(*, *)' *** Warning ***' |
239 |
write(*,*)'Option couplage pour l''ocean = ', ocean |
write(*, *)'Option couplage pour l''ocean = ', ocean |
240 |
abort_message='option pour l''ocean non valable' |
abort_message='option pour l''ocean non valable' |
241 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
242 |
endif |
endif |
243 |
if ( is_oce > is_sic ) then |
if ( is_oce > is_sic ) then |
244 |
write(*,*)' *** Warning ***' |
write(*, *)' *** Warning ***' |
245 |
write(*,*)' Pour des raisons de sequencement dans le code' |
write(*, *)' Pour des raisons de sequencement dans le code' |
246 |
write(*,*)' l''ocean doit etre traite avant la banquise' |
write(*, *)' l''ocean doit etre traite avant la banquise' |
247 |
write(*,*)' or is_oce = ',is_oce, '> is_sic = ',is_sic |
write(*, *)' or is_oce = ', is_oce, '> is_sic = ', is_sic |
248 |
abort_message='voir ci-dessus' |
abort_message='voir ci-dessus' |
249 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
250 |
endif |
endif |
251 |
endif |
endif |
252 |
first_call = .false. |
first_call = .false. |
253 |
|
|
254 |
! Initialisations diverses |
! Initialisations diverses |
255 |
! |
|
256 |
ffonte(1:knon)=0. |
ffonte(1:knon)=0. |
257 |
fqcalving(1:knon)=0. |
fqcalving(1:knon)=0. |
258 |
|
|
264 |
!IM: "slab" ocean; initialisations |
!IM: "slab" ocean; initialisations |
265 |
flux_o = 0. |
flux_o = 0. |
266 |
flux_g = 0. |
flux_g = 0. |
267 |
! |
|
268 |
if (.not. allocated(tmp_flux_o)) then |
if (.not. allocated(tmp_flux_o)) then |
269 |
allocate(tmp_flux_o(klon), stat = error) |
allocate(tmp_flux_o(klon), stat = error) |
270 |
DO i=1, knon |
DO i=1, knon |
272 |
ENDDO |
ENDDO |
273 |
if (error /= 0) then |
if (error /= 0) then |
274 |
abort_message='Pb allocation tmp_flux_o' |
abort_message='Pb allocation tmp_flux_o' |
275 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
276 |
endif |
endif |
277 |
endif |
endif |
278 |
if (.not. allocated(tmp_flux_g)) then |
if (.not. allocated(tmp_flux_g)) then |
282 |
ENDDO |
ENDDO |
283 |
if (error /= 0) then |
if (error /= 0) then |
284 |
abort_message='Pb allocation tmp_flux_g' |
abort_message='Pb allocation tmp_flux_g' |
285 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
286 |
endif |
endif |
287 |
endif |
endif |
288 |
if (.not. allocated(tmp_radsol)) then |
if (.not. allocated(tmp_radsol)) then |
289 |
allocate(tmp_radsol(klon), stat = error) |
allocate(tmp_radsol(klon), stat = error) |
290 |
if (error /= 0) then |
if (error /= 0) then |
291 |
abort_message='Pb allocation tmp_radsol' |
abort_message='Pb allocation tmp_radsol' |
292 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
293 |
endif |
endif |
294 |
endif |
endif |
295 |
DO i=1, knon |
DO i=1, knon |
296 |
tmp_radsol(knindex(i))=radsol(i) |
tmp_radsol(knindex(i))=radsol(i) |
297 |
ENDDO |
ENDDO |
298 |
if (.not. allocated(tmp_pctsrf_slab)) then |
if (.not. allocated(tmp_pctsrf_slab)) then |
299 |
allocate(tmp_pctsrf_slab(klon,nbsrf), stat = error) |
allocate(tmp_pctsrf_slab(klon, nbsrf), stat = error) |
300 |
if (error /= 0) then |
if (error /= 0) then |
301 |
abort_message='Pb allocation tmp_pctsrf_slab' |
abort_message='Pb allocation tmp_pctsrf_slab' |
302 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
303 |
endif |
endif |
304 |
DO i=1, klon |
DO i=1, klon |
305 |
tmp_pctsrf_slab(i,1:nbsrf)=pctsrf(i,1:nbsrf) |
tmp_pctsrf_slab(i, 1:nbsrf)=pctsrf(i, 1:nbsrf) |
306 |
ENDDO |
ENDDO |
307 |
endif |
endif |
308 |
! |
|
309 |
if (.not. allocated(tmp_seaice)) then |
if (.not. allocated(tmp_seaice)) then |
310 |
allocate(tmp_seaice(klon), stat = error) |
allocate(tmp_seaice(klon), stat = error) |
311 |
if (error /= 0) then |
if (error /= 0) then |
312 |
abort_message='Pb allocation tmp_seaice' |
abort_message='Pb allocation tmp_seaice' |
313 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
314 |
endif |
endif |
315 |
DO i=1, klon |
DO i=1, klon |
316 |
tmp_seaice(i)=seaice(i) |
tmp_seaice(i)=seaice(i) |
317 |
ENDDO |
ENDDO |
318 |
endif |
endif |
319 |
! |
|
320 |
if (.not. allocated(tmp_tslab)) then |
if (.not. allocated(tmp_tslab)) then |
321 |
allocate(tmp_tslab(klon), stat = error) |
allocate(tmp_tslab(klon), stat = error) |
322 |
if (error /= 0) then |
if (error /= 0) then |
323 |
abort_message='Pb allocation tmp_tslab' |
abort_message='Pb allocation tmp_tslab' |
324 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
325 |
endif |
endif |
326 |
endif |
endif |
327 |
DO i=1, klon |
DO i=1, klon |
328 |
tmp_tslab(i)=tslab(i) |
tmp_tslab(i)=tslab(i) |
329 |
ENDDO |
ENDDO |
330 |
! |
|
331 |
! Aiguillage vers les differents schemas de surface |
! Aiguillage vers les differents schemas de surface |
332 |
|
|
333 |
if (nisurf == is_ter) then |
if (nisurf == is_ter) then |
334 |
! |
|
335 |
! Surface "terre" appel a l'interface avec les sols continentaux |
! Surface "terre" appel a l'interface avec les sols continentaux |
336 |
! |
|
337 |
! allocation du run-off |
! allocation du run-off |
338 |
if (.not. allocated(coastalflow)) then |
if (.not. allocated(coastalflow)) then |
339 |
allocate(coastalflow(knon), stat = error) |
allocate(coastalflow(knon), stat = error) |
340 |
if (error /= 0) then |
if (error /= 0) then |
341 |
abort_message='Pb allocation coastalflow' |
abort_message='Pb allocation coastalflow' |
342 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
343 |
endif |
endif |
344 |
allocate(riverflow(knon), stat = error) |
allocate(riverflow(knon), stat = error) |
345 |
if (error /= 0) then |
if (error /= 0) then |
346 |
abort_message='Pb allocation riverflow' |
abort_message='Pb allocation riverflow' |
347 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
348 |
endif |
endif |
349 |
allocate(run_off(knon), stat = error) |
allocate(run_off(knon), stat = error) |
350 |
if (error /= 0) then |
if (error /= 0) then |
351 |
abort_message='Pb allocation run_off' |
abort_message='Pb allocation run_off' |
352 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
353 |
endif |
endif |
354 |
!cym |
!cym |
355 |
run_off=0.0 |
run_off=0.0 |
356 |
!cym |
!cym |
357 |
|
|
358 |
!!$PB |
!!$PB |
359 |
ALLOCATE (tmp_rriv(iim,jjm+1), stat=error) |
ALLOCATE (tmp_rriv(iim, jjm+1), stat=error) |
360 |
if (error /= 0) then |
if (error /= 0) then |
361 |
abort_message='Pb allocation tmp_rriv' |
abort_message='Pb allocation tmp_rriv' |
362 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
363 |
endif |
endif |
364 |
ALLOCATE (tmp_rcoa(iim,jjm+1), stat=error) |
ALLOCATE (tmp_rcoa(iim, jjm+1), stat=error) |
365 |
if (error /= 0) then |
if (error /= 0) then |
366 |
abort_message='Pb allocation tmp_rcoa' |
abort_message='Pb allocation tmp_rcoa' |
367 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
368 |
endif |
endif |
369 |
ALLOCATE (tmp_rlic(iim,jjm+1), stat=error) |
ALLOCATE (tmp_rlic(iim, jjm+1), stat=error) |
370 |
if (error /= 0) then |
if (error /= 0) then |
371 |
abort_message='Pb allocation tmp_rlic' |
abort_message='Pb allocation tmp_rlic' |
372 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
373 |
endif |
endif |
374 |
tmp_rriv = 0.0 |
tmp_rriv = 0.0 |
375 |
tmp_rcoa = 0.0 |
tmp_rcoa = 0.0 |
377 |
|
|
378 |
!!$ |
!!$ |
379 |
else if (size(coastalflow) /= knon) then |
else if (size(coastalflow) /= knon) then |
380 |
write(*,*)'Bizarre, le nombre de points continentaux' |
write(*, *)'Bizarre, le nombre de points continentaux' |
381 |
write(*,*)'a change entre deux appels. J''arrete ...' |
write(*, *)'a change entre deux appels. J''arrete ...' |
382 |
abort_message='voir ci-dessus' |
abort_message='voir ci-dessus' |
383 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
384 |
endif |
endif |
385 |
coastalflow = 0. |
coastalflow = 0. |
386 |
riverflow = 0. |
riverflow = 0. |
387 |
! |
|
388 |
! Calcul age de la neige |
! Calcul age de la neige |
389 |
|
|
390 |
if (.not. ok_veget) then |
if (.not. ok_veget) then |
391 |
! |
! calcul albedo: lecture albedo fichier boundary conditions |
392 |
! calcul albedo: lecture albedo fichier CL puis ajout albedo neige |
! puis ajout albedo neige |
393 |
! |
call interfsur_lim(itime, dtime, jour, klon, nisurf, knon, knindex, & |
394 |
call interfsur_lim(itime, dtime, jour, & |
debut, alb_new, z0_new) |
395 |
& klon, nisurf, knon, knindex, debut, & |
|
|
& alb_new, z0_new) |
|
|
! |
|
396 |
! calcul snow et qsurf, hydrol adapté |
! calcul snow et qsurf, hydrol adapté |
|
! |
|
397 |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
398 |
|
|
399 |
IF (soil_model) THEN |
IF (soil_model) THEN |
400 |
CALL soil(dtime, nisurf, knon,snow, tsurf, tsoil,soilcap, soilflux) |
CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, & |
401 |
|
soilflux) |
402 |
cal(1:knon) = RCPD / soilcap(1:knon) |
cal(1:knon) = RCPD / soilcap(1:knon) |
403 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
404 |
ELSE |
ELSE |
405 |
cal = RCPD * capsol |
cal = RCPD * capsol |
|
!!$ cal = capsol |
|
406 |
ENDIF |
ENDIF |
407 |
CALL calcul_fluxs( klon, knon, nisurf, dtime, & |
CALL calcul_fluxs( klon, knon, nisurf, dtime, & |
408 |
& tsurf, p1lay, cal, beta, tq_cdrag, ps, & |
& tsurf, p1lay, cal, beta, tq_cdrag, ps, & |
417 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
418 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
419 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
420 |
& fqcalving,ffonte, run_off_lic_0) |
& fqcalving, ffonte, run_off_lic_0) |
421 |
|
|
422 |
call albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:)) |
call albsno(klon, knon, dtime, agesno, alb_neig, precip_snow) |
423 |
where (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
where (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
424 |
zfra(1:knon) = max(0.0,min(1.0,snow(1:knon)/(snow(1:knon)+10.0))) |
zfra(1:knon) = max(0.0, min(1.0, snow(1:knon)/(snow(1:knon)+10.0))) |
425 |
alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + & |
alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + & |
426 |
& alb_new(1 : knon)*(1.0-zfra(1:knon)) |
alb_new(1 : knon)*(1.0-zfra(1:knon)) |
427 |
z0_new = sqrt(z0_new**2+rugoro**2) |
z0_new = sqrt(z0_new**2+rugoro**2) |
428 |
alblw(1 : knon) = alb_new(1 : knon) |
alblw(1 : knon) = alb_new(1 : knon) |
|
|
|
|
else |
|
429 |
endif |
endif |
|
! |
|
|
! Remplissage des pourcentages de surface |
|
|
! |
|
|
pctsrf_new(:,nisurf) = pctsrf(:,nisurf) |
|
430 |
|
|
431 |
|
! Remplissage des pourcentages de surface |
432 |
|
pctsrf_new(:, nisurf) = pctsrf(:, nisurf) |
433 |
else if (nisurf == is_oce) then |
else if (nisurf == is_oce) then |
|
|
|
|
if (check) write(*,*)'ocean, nisurf = ',nisurf |
|
|
|
|
|
! |
|
434 |
! Surface "ocean" appel a l'interface avec l'ocean |
! Surface "ocean" appel a l'interface avec l'ocean |
435 |
! |
if (ocean == 'slab') then |
|
if (ocean == 'couple') then |
|
|
if (nexca == 0) then |
|
|
abort_message='nexca = 0 dans interfoce_cpl' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
|
|
|
cumul = .false. |
|
|
|
|
|
iloc = maxloc(fder(1:klon)) |
|
|
if (check) then |
|
|
if (fder(iloc(1))> 0.) then |
|
|
WRITE(*,*)'**** Debug fder ****' |
|
|
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
|
|
endif |
|
|
endif |
|
|
!!$ |
|
|
!!$ where(fder.gt.0.) |
|
|
!!$ fder = 0. |
|
|
!!$ endwhere |
|
|
|
|
|
call interfoce_cpl(itime, dtime, cumul, & |
|
|
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
|
|
& ocean, npas, nexca, debut, lafin, & |
|
|
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
|
|
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
|
|
& windsp, & |
|
|
& zmasq, & |
|
|
& tsurf_new, alb_new, & |
|
|
& pctsrf_new) |
|
|
|
|
|
!IM: "slab" ocean |
|
|
else if (ocean == 'slab ') then |
|
436 |
tsurf_new = tsurf |
tsurf_new = tsurf |
437 |
pctsrf_new = tmp_pctsrf_slab |
pctsrf_new = tmp_pctsrf_slab |
438 |
! |
else |
439 |
else ! lecture conditions limites |
! lecture conditions limites |
440 |
call interfoce_lim(itime, dtime, jour, & |
call interfoce_lim(itime, dtime, jour, klon, nisurf, knon, knindex, & |
441 |
& klon, nisurf, knon, knindex, & |
debut, tsurf_new, pctsrf_new) |
|
& debut, & |
|
|
& tsurf_new, pctsrf_new) |
|
|
|
|
442 |
endif |
endif |
443 |
|
|
444 |
tsurf_temp = tsurf_new |
tsurf_temp = tsurf_new |
445 |
cal = 0. |
cal = 0. |
446 |
beta = 1. |
beta = 1. |
447 |
dif_grnd = 0. |
dif_grnd = 0. |
448 |
alb_neig(:) = 0. |
alb_neig = 0. |
449 |
agesno(:) = 0. |
agesno = 0. |
450 |
|
|
451 |
call calcul_fluxs( klon, knon, nisurf, dtime, & |
call calcul_fluxs( klon, knon, nisurf, dtime, & |
452 |
& tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, & |
& tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, & |
460 |
|
|
461 |
iloc = maxloc(fder(1:klon)) |
iloc = maxloc(fder(1:klon)) |
462 |
if (check.and.fder(iloc(1))> 0.) then |
if (check.and.fder(iloc(1))> 0.) then |
463 |
WRITE(*,*)'**** Debug fder****' |
WRITE(*, *)'**** Debug fder****' |
464 |
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
WRITE(*, *)'max fder(', iloc(1), ') = ', fder(iloc(1)) |
465 |
WRITE(*,*)'fder_prev, dflux_s, dflux_l',fder_prev(iloc(1)), & |
WRITE(*, *)'fder_prev, dflux_s, dflux_l', fder_prev(iloc(1)), & |
466 |
& dflux_s(iloc(1)), dflux_l(iloc(1)) |
& dflux_s(iloc(1)), dflux_l(iloc(1)) |
467 |
endif |
endif |
|
!!$ |
|
|
!!$ where(fder.gt.0.) |
|
|
!!$ fder = 0. |
|
|
!!$ endwhere |
|
468 |
|
|
469 |
!IM: flux ocean-atmosphere utile pour le "slab" ocean |
!IM: flux ocean-atmosphere utile pour le "slab" ocean |
470 |
DO i=1, knon |
DO i=1, knon |
474 |
tmp_flux_o(knindex(i)) = flux_o(i) |
tmp_flux_o(knindex(i)) = flux_o(i) |
475 |
tmp_radsol(knindex(i))=radsol(i) |
tmp_radsol(knindex(i))=radsol(i) |
476 |
ENDDO |
ENDDO |
477 |
! |
|
478 |
! 2eme appel a interfoce pour le cumul des champs (en particulier |
! 2eme appel a interfoce pour le cumul des champs (en particulier |
479 |
! fluxsens et fluxlat calcules dans calcul_fluxs) |
! fluxsens et fluxlat calcules dans calcul_fluxs) |
|
! |
|
|
if (ocean == 'couple') then |
|
|
|
|
|
cumul = .true. |
|
480 |
|
|
481 |
call interfoce_cpl(itime, dtime, cumul, & |
if (ocean == 'slab ') then |
|
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
|
|
& ocean, npas, nexca, debut, lafin, & |
|
|
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
|
|
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
|
|
& windsp, & |
|
|
& zmasq, & |
|
|
& tsurf_new, alb_new, & |
|
|
& pctsrf_new) |
|
|
|
|
|
!IM: "slab" ocean |
|
|
else if (ocean == 'slab ') then |
|
|
! |
|
482 |
seaice=tmp_seaice |
seaice=tmp_seaice |
483 |
cumul = .true. |
cumul = .true. |
484 |
call interfoce_slab(klon, debut, itime, dtime, jour, & |
call interfoce_slab(klon, debut, itime, dtime, jour, & |
485 |
& tmp_radsol, tmp_flux_o, tmp_flux_g, pctsrf, & |
& tmp_radsol, tmp_flux_o, tmp_flux_g, pctsrf, & |
486 |
& tslab, seaice, pctsrf_new) |
& tslab, seaice, pctsrf_new) |
487 |
! |
|
488 |
tmp_pctsrf_slab=pctsrf_new |
tmp_pctsrf_slab=pctsrf_new |
489 |
DO i=1, knon |
DO i=1, knon |
490 |
tsurf_new(i)=tslab(knindex(i)) |
tsurf_new(i)=tslab(knindex(i)) |
491 |
ENDDO !i |
ENDDO |
|
! |
|
492 |
endif |
endif |
493 |
|
|
|
! |
|
494 |
! calcul albedo |
! calcul albedo |
|
! |
|
|
|
|
495 |
if ( minval(rmu0) == maxval(rmu0) .and. minval(rmu0) == -999.999 ) then |
if ( minval(rmu0) == maxval(rmu0) .and. minval(rmu0) == -999.999 ) then |
496 |
CALL alboc(FLOAT(jour),rlat,alb_eau) |
CALL alboc(FLOAT(jour), rlat, alb_eau) |
497 |
else ! cycle diurne |
else ! cycle diurne |
498 |
CALL alboc_cd(rmu0,alb_eau) |
CALL alboc_cd(rmu0, alb_eau) |
499 |
endif |
endif |
500 |
DO ii =1, knon |
DO ii =1, knon |
501 |
alb_new(ii) = alb_eau(knindex(ii)) |
alb_new(ii) = alb_eau(knindex(ii)) |
503 |
|
|
504 |
z0_new = sqrt(rugos**2 + rugoro**2) |
z0_new = sqrt(rugos**2 + rugoro**2) |
505 |
alblw(1:knon) = alb_new(1:knon) |
alblw(1:knon) = alb_new(1:knon) |
|
|
|
|
! |
|
506 |
else if (nisurf == is_sic) then |
else if (nisurf == is_sic) then |
507 |
|
if (check) write(*, *)'sea ice, nisurf = ', nisurf |
508 |
|
|
|
if (check) write(*,*)'sea ice, nisurf = ',nisurf |
|
|
|
|
|
! |
|
509 |
! Surface "glace de mer" appel a l'interface avec l'ocean |
! Surface "glace de mer" appel a l'interface avec l'ocean |
|
! |
|
|
! |
|
|
if (ocean == 'couple') then |
|
|
|
|
|
cumul =.false. |
|
|
|
|
|
iloc = maxloc(fder(1:klon)) |
|
|
if (check.and.fder(iloc(1))> 0.) then |
|
|
WRITE(*,*)'**** Debug fder ****' |
|
|
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
|
|
endif |
|
|
!!$ |
|
|
!!$ where(fder.gt.0.) |
|
|
!!$ fder = 0. |
|
|
!!$ endwhere |
|
|
|
|
|
call interfoce_cpl(itime, dtime, cumul, & |
|
|
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
|
|
& ocean, npas, nexca, debut, lafin, & |
|
|
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
|
|
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
|
|
& windsp, & |
|
|
& zmasq, & |
|
|
& tsurf_new, alb_new, & |
|
|
& pctsrf_new) |
|
510 |
|
|
|
tsurf_temp = tsurf_new |
|
|
cal = 0. |
|
|
dif_grnd = 0. |
|
|
beta = 1.0 |
|
511 |
|
|
512 |
!IM: "slab" ocean |
if (ocean == 'slab ') then |
|
else if (ocean == 'slab ') then |
|
513 |
pctsrf_new=tmp_pctsrf_slab |
pctsrf_new=tmp_pctsrf_slab |
514 |
! |
|
515 |
DO ii = 1, knon |
DO ii = 1, knon |
516 |
tsurf_new(ii) = tsurf(ii) |
tsurf_new(ii) = tsurf(ii) |
517 |
IF (pctsrf_new(knindex(ii),nisurf) < EPSFRA) then |
IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then |
518 |
snow(ii) = 0.0 |
snow(ii) = 0.0 |
519 |
tsurf_new(ii) = RTT - 1.8 |
tsurf_new(ii) = RTT - 1.8 |
520 |
IF (soil_model) tsoil(ii,:) = RTT -1.8 |
IF (soil_model) tsoil(ii, :) = RTT -1.8 |
521 |
ENDIF |
ENDIF |
522 |
ENDDO |
ENDDO |
523 |
|
|
524 |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
525 |
|
|
526 |
IF (soil_model) THEN |
IF (soil_model) THEN |
527 |
CALL soil(dtime, nisurf, knon,snow, tsurf_new, tsoil,soilcap, soilflux) |
CALL soil(dtime, nisurf, knon, snow, tsurf_new, tsoil, soilcap, soilflux) |
528 |
cal(1:knon) = RCPD / soilcap(1:knon) |
cal(1:knon) = RCPD / soilcap(1:knon) |
529 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
530 |
ELSE |
ELSE |
534 |
ENDIF |
ENDIF |
535 |
tsurf_temp = tsurf_new |
tsurf_temp = tsurf_new |
536 |
beta = 1.0 |
beta = 1.0 |
537 |
! |
|
538 |
ELSE |
ELSE |
539 |
! ! lecture conditions limites |
! ! lecture conditions limites |
540 |
CALL interfoce_lim(itime, dtime, jour, & |
CALL interfoce_lim(itime, dtime, jour, & |
545 |
!IM cf LF |
!IM cf LF |
546 |
DO ii = 1, knon |
DO ii = 1, knon |
547 |
tsurf_new(ii) = tsurf(ii) |
tsurf_new(ii) = tsurf(ii) |
548 |
!IMbad IF (pctsrf_new(ii,nisurf) < EPSFRA) then |
!IMbad IF (pctsrf_new(ii, nisurf) < EPSFRA) then |
549 |
IF (pctsrf_new(knindex(ii),nisurf) < EPSFRA) then |
IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then |
550 |
snow(ii) = 0.0 |
snow(ii) = 0.0 |
551 |
!IM cf LF/JLD tsurf(ii) = RTT - 1.8 |
!IM cf LF/JLD tsurf(ii) = RTT - 1.8 |
552 |
tsurf_new(ii) = RTT - 1.8 |
tsurf_new(ii) = RTT - 1.8 |
553 |
IF (soil_model) tsoil(ii,:) = RTT -1.8 |
IF (soil_model) tsoil(ii, :) = RTT -1.8 |
554 |
endif |
endif |
555 |
enddo |
enddo |
556 |
|
|
557 |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
558 |
|
|
559 |
IF (soil_model) THEN |
IF (soil_model) THEN |
560 |
!IM cf LF/JLD CALL soil(dtime, nisurf, knon,snow, tsurf, tsoil,soilcap, soilflux) |
!IM cf LF/JLD CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux) |
561 |
CALL soil(dtime, nisurf, knon,snow, tsurf_new, tsoil,soilcap, soilflux) |
CALL soil(dtime, nisurf, knon, snow, tsurf_new, tsoil, soilcap, soilflux) |
562 |
cal(1:knon) = RCPD / soilcap(1:knon) |
cal(1:knon) = RCPD / soilcap(1:knon) |
563 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
564 |
dif_grnd = 0. |
dif_grnd = 0. |
578 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
579 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
580 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
581 |
! |
|
582 |
!IM: flux entre l'ocean et la glace de mer pour le "slab" ocean |
!IM: flux entre l'ocean et la glace de mer pour le "slab" ocean |
583 |
DO i = 1, knon |
DO i = 1, knon |
584 |
flux_g(i) = 0.0 |
flux_g(i) = 0.0 |
585 |
! |
|
586 |
!IM: faire dependre le coefficient de conduction de la glace de mer |
!IM: faire dependre le coefficient de conduction de la glace de mer |
587 |
! de l'epaisseur de la glace de mer, dans l'hypothese ou le coeff. |
! de l'epaisseur de la glace de mer, dans l'hypothese ou le coeff. |
588 |
! actuel correspond a 3m de glace de mer, cf. L.Li |
! actuel correspond a 3m de glace de mer, cf. L.Li |
589 |
! |
|
590 |
! IF(1.EQ.0) THEN |
! IF(1.EQ.0) THEN |
591 |
! IF(siceh(i).GT.0.) THEN |
! IF(siceh(i).GT.0.) THEN |
592 |
! new_dif_grnd(i) = dif_grnd(i)*3./siceh(i) |
! new_dif_grnd(i) = dif_grnd(i)*3./siceh(i) |
594 |
! new_dif_grnd(i) = 0. |
! new_dif_grnd(i) = 0. |
595 |
! ENDIF |
! ENDIF |
596 |
! ENDIF !(1.EQ.0) THEN |
! ENDIF !(1.EQ.0) THEN |
597 |
! |
|
598 |
IF (cal(i).GT.1.0e-15) flux_g(i)=(tsurf_new(i)-t_grnd) & |
IF (cal(i).GT.1.0e-15) flux_g(i)=(tsurf_new(i)-t_grnd) & |
599 |
& * dif_grnd(i) *RCPD/cal(i) |
& * dif_grnd(i) *RCPD/cal(i) |
600 |
! & * new_dif_grnd(i) *RCPD/cal(i) |
! & * new_dif_grnd(i) *RCPD/cal(i) |
602 |
tmp_radsol(knindex(i))=radsol(i) |
tmp_radsol(knindex(i))=radsol(i) |
603 |
ENDDO |
ENDDO |
604 |
|
|
605 |
IF (ocean /= 'couple') THEN |
CALL fonte_neige( klon, knon, nisurf, dtime, & |
606 |
CALL fonte_neige( klon, knon, nisurf, dtime, & |
& tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, & |
607 |
& tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, & |
& precip_rain, precip_snow, snow, qsol, & |
608 |
& precip_rain, precip_snow, snow, qsol, & |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
609 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
610 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
611 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
& fqcalving, ffonte, run_off_lic_0) |
|
& fqcalving,ffonte, run_off_lic_0) |
|
612 |
|
|
613 |
! calcul albedo |
! calcul albedo |
614 |
|
|
615 |
CALL albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:)) |
CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow) |
616 |
WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
617 |
zfra(1:knon) = MAX(0.0,MIN(1.0,snow(1:knon)/(snow(1:knon)+10.0))) |
zfra(1:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon)+10.0))) |
618 |
alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + & |
alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + & |
619 |
& 0.6 * (1.0-zfra(1:knon)) |
0.6 * (1.0-zfra(1:knon)) |
|
!! alb_new(1 : knon) = 0.6 |
|
|
ENDIF |
|
620 |
|
|
621 |
fder_prev = fder |
fder_prev = fder |
622 |
fder = fder_prev + dflux_s + dflux_l |
fder = fder_prev + dflux_s + dflux_l |
623 |
|
|
624 |
iloc = maxloc(fder(1:klon)) |
iloc = maxloc(fder(1:klon)) |
625 |
if (check.and.fder(iloc(1))> 0.) then |
if (check.and.fder(iloc(1))> 0.) then |
626 |
WRITE(*,*)'**** Debug fder ****' |
WRITE(*, *)'**** Debug fder ****' |
627 |
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
WRITE(*, *)'max fder(', iloc(1), ') = ', fder(iloc(1)) |
628 |
WRITE(*,*)'fder_prev, dflux_s, dflux_l',fder_prev(iloc(1)), & |
WRITE(*, *)'fder_prev, dflux_s, dflux_l', fder_prev(iloc(1)), & |
629 |
& dflux_s(iloc(1)), dflux_l(iloc(1)) |
& dflux_s(iloc(1)), dflux_l(iloc(1)) |
630 |
endif |
endif |
|
!!$ where(fder.gt.0.) |
|
|
!!$ fder = 0. |
|
|
!!$ endwhere |
|
631 |
|
|
|
! |
|
|
! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean |
|
|
! |
|
|
if (ocean == 'couple') then |
|
632 |
|
|
633 |
cumul =.true. |
! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean |
|
|
|
|
call interfoce_cpl(itime, dtime, cumul, & |
|
|
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
|
|
& ocean, npas, nexca, debut, lafin, & |
|
|
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
|
|
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
|
|
& windsp, & |
|
|
& zmasq, & |
|
|
& tsurf_new, alb_new, & |
|
|
& pctsrf_new) |
|
|
endif |
|
634 |
|
|
635 |
z0_new = 0.002 |
z0_new = 0.002 |
636 |
z0_new = SQRT(z0_new**2+rugoro**2) |
z0_new = SQRT(z0_new**2+rugoro**2) |
638 |
|
|
639 |
else if (nisurf == is_lic) then |
else if (nisurf == is_lic) then |
640 |
|
|
641 |
if (check) write(*,*)'glacier, nisurf = ',nisurf |
if (check) write(*, *)'glacier, nisurf = ', nisurf |
642 |
|
|
643 |
if (.not. allocated(run_off_lic)) then |
if (.not. allocated(run_off_lic)) then |
644 |
allocate(run_off_lic(knon), stat = error) |
allocate(run_off_lic(knon), stat = error) |
645 |
if (error /= 0) then |
if (error /= 0) then |
646 |
abort_message='Pb allocation run_off_lic' |
abort_message='Pb allocation run_off_lic' |
647 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
648 |
endif |
endif |
649 |
run_off_lic = 0. |
run_off_lic = 0. |
650 |
endif |
endif |
651 |
! |
|
652 |
! Surface "glacier continentaux" appel a l'interface avec le sol |
! Surface "glacier continentaux" appel a l'interface avec le sol |
653 |
! |
|
654 |
IF (soil_model) THEN |
IF (soil_model) THEN |
655 |
CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil,soilcap, soilflux) |
CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux) |
656 |
cal(1:knon) = RCPD / soilcap(1:knon) |
cal(1:knon) = RCPD / soilcap(1:knon) |
657 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
658 |
ELSE |
ELSE |
675 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
676 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
677 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
678 |
& fqcalving,ffonte, run_off_lic_0) |
& fqcalving, ffonte, run_off_lic_0) |
679 |
|
|
680 |
! passage du run-off des glaciers calcule dans fonte_neige au coupleur |
! passage du run-off des glaciers calcule dans fonte_neige au coupleur |
681 |
bidule=0. |
bidule=0. |
682 |
bidule(1:knon)= run_off_lic(1:knon) |
bidule(1:knon)= run_off_lic(1:knon) |
683 |
call gath2cpl(bidule, tmp_rlic, klon, knon,iim,jjm,knindex) |
call gath2cpl(bidule, tmp_rlic, klon, knon, iim, jjm, knindex) |
684 |
! |
|
685 |
! calcul albedo |
! calcul albedo |
686 |
! |
|
687 |
CALL albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:)) |
CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow) |
688 |
WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
689 |
zfra(1:knon) = MAX(0.0,MIN(1.0,snow(1:knon)/(snow(1:knon)+10.0))) |
zfra(1:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon)+10.0))) |
690 |
alb_new(1 : knon) = alb_neig(1 : knon)*zfra(1:knon) + & |
alb_new(1 : knon) = alb_neig(1 : knon)*zfra(1:knon) + & |
691 |
& 0.6 * (1.0-zfra(1:knon)) |
& 0.6 * (1.0-zfra(1:knon)) |
692 |
! |
|
693 |
!IM: plusieurs choix/tests sur l'albedo des "glaciers continentaux" |
!IM: plusieurs choix/tests sur l'albedo des "glaciers continentaux" |
694 |
! alb_new(1 : knon) = 0.6 !IM cf FH/GK |
! alb_new(1 : knon) = 0.6 !IM cf FH/GK |
695 |
! alb_new(1 : knon) = 0.82 |
! alb_new(1 : knon) = 0.82 |
698 |
!IM: KstaTER0.77 & LMD_ARMIP6 |
!IM: KstaTER0.77 & LMD_ARMIP6 |
699 |
alb_new(1 : knon) = 0.77 |
alb_new(1 : knon) = 0.77 |
700 |
|
|
701 |
! |
|
702 |
! Rugosite |
! Rugosite |
703 |
! |
|
704 |
z0_new = rugoro |
z0_new = rugoro |
705 |
! |
|
706 |
! Remplissage des pourcentages de surface |
! Remplissage des pourcentages de surface |
707 |
! |
|
708 |
pctsrf_new(:,nisurf) = pctsrf(:,nisurf) |
pctsrf_new(:, nisurf) = pctsrf(:, nisurf) |
709 |
|
|
710 |
alblw(1:knon) = alb_new(1:knon) |
alblw(1:knon) = alb_new(1:knon) |
711 |
else |
else |
712 |
write(*,*)'Index surface = ',nisurf |
write(*, *)'Index surface = ', nisurf |
713 |
abort_message = 'Index surface non valable' |
abort_message = 'Index surface non valable' |
714 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
715 |
endif |
endif |
716 |
|
|
717 |
END SUBROUTINE interfsurf_hq |
END SUBROUTINE interfsurf_hq |
718 |
|
|
719 |
!************************ |
!************************ |
720 |
|
|
|
SUBROUTINE interfoce_cpl(itime, dtime, cumul, & |
|
|
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
|
|
& ocean, npas, nexca, debut, lafin, & |
|
|
& swdown, lwdown, precip_rain, precip_snow, evap, tsurf, & |
|
|
& fluxlat, fluxsens, fder, albsol, taux, tauy, & |
|
|
& windsp, & |
|
|
& zmasq, & |
|
|
& tsurf_new, alb_new, & |
|
|
& pctsrf_new) |
|
|
|
|
|
! Cette routine sert d'interface entre le modele atmospherique et un |
|
|
! coupleur avec un modele d'ocean 'complet' derriere |
|
|
! |
|
|
! Le modele de glace qu'il est prevu d'utiliser etant couple directement a |
|
|
! l'ocean presentement, on va passer deux fois dans cette routine par pas de |
|
|
! temps physique, une fois avec les points oceans et l'autre avec les points |
|
|
! glace. A chaque pas de temps de couplage, la lecture des champs provenant |
|
|
! du coupleur se fera "dans" l'ocean et l'ecriture des champs a envoyer |
|
|
! au coupleur "dans" la glace. Il faut donc des tableaux de travail "tampons" |
|
|
! dimensionnes sur toute la grille qui remplissent les champs sur les |
|
|
! domaines ocean/glace quand il le faut. Il est aussi necessaire que l'index |
|
|
! ocean soit traiter avant l'index glace (sinon tout intervertir) |
|
|
! |
|
|
! |
|
|
! L. Fairhead 02/2000 |
|
|
! |
|
|
! input: |
|
|
! itime numero du pas de temps |
|
|
! iim, jjm nbres de pts de grille |
|
|
! dtime pas de temps de la physique |
|
|
! klon nombre total de points de grille |
|
|
! nisurf index de la surface a traiter (1 = sol continental) |
|
|
! pctsrf tableau des fractions de surface de chaque maille |
|
|
! knon nombre de points de la surface a traiter |
|
|
! knindex index des points de la surface a traiter |
|
|
! rlon longitudes |
|
|
! rlat latitudes |
|
|
! debut logical: 1er appel a la physique |
|
|
! lafin logical: dernier appel a la physique |
|
|
! ocean type d'ocean |
|
|
! nexca frequence de couplage |
|
|
! swdown flux solaire entrant a la surface |
|
|
! lwdown flux IR net a la surface |
|
|
! precip_rain precipitation liquide |
|
|
! precip_snow precipitation solide |
|
|
! evap evaporation |
|
|
! tsurf temperature de surface |
|
|
! fder derivee dF/dT |
|
|
! albsol albedo du sol (coherent avec swdown) |
|
|
! taux tension de vent en x |
|
|
! tauy tension de vent en y |
|
|
! windsp module du vent a 10m |
|
|
! nexca frequence de couplage |
|
|
! zmasq masque terre/ocean |
|
|
! |
|
|
! |
|
|
! output: |
|
|
! tsurf_new temperature au sol |
|
|
! alb_new albedo |
|
|
! pctsrf_new nouvelle repartition des surfaces |
|
|
! alb_ice albedo de la glace |
|
|
! |
|
|
use temps |
|
|
use iniprint |
|
|
use abort_gcm_m, only: abort_gcm |
|
|
use gath_cpl, only: gath2cpl, cpl2gath |
|
|
use ioipsl |
|
|
use indicesol |
|
|
use YOMCST |
|
|
|
|
|
! Parametres d'entree |
|
|
integer, intent(IN) :: itime |
|
|
integer, intent(IN) :: iim, jjm |
|
|
real, intent(IN) :: dtime |
|
|
integer, intent(IN) :: klon |
|
|
integer, intent(IN) :: nisurf |
|
|
integer, intent(IN) :: knon |
|
|
real, dimension(klon,nbsrf), intent(IN) :: pctsrf |
|
|
integer, dimension(klon), intent(in) :: knindex |
|
|
logical, intent(IN) :: debut, lafin |
|
|
real, dimension(klon), intent(IN) :: rlon, rlat |
|
|
character (len = 6) :: ocean |
|
|
real, dimension(klon), intent(IN) :: lwdown, swdown |
|
|
real, dimension(klon), intent(IN) :: precip_rain, precip_snow |
|
|
real, dimension(klon), intent(IN) :: tsurf, fder, albsol, taux, tauy |
|
|
real, dimension(klon), intent(IN) :: windsp |
|
|
INTEGER :: nexca, npas |
|
|
real, dimension(klon), intent(IN) :: zmasq |
|
|
real, dimension(klon), intent(IN) :: fluxlat, fluxsens |
|
|
logical, intent(IN) :: cumul |
|
|
real, dimension(klon), intent(INOUT) :: evap |
|
|
|
|
|
! Parametres de sortie |
|
|
real, dimension(klon), intent(OUT):: tsurf_new, alb_new |
|
|
real, dimension(klon,nbsrf), intent(OUT) :: pctsrf_new |
|
|
|
|
|
! Variables locales |
|
|
integer :: j, error, sum_error, ig, cpl_index,i |
|
|
INTEGER :: nsrf |
|
|
character (len = 20) :: modname = 'interfoce_cpl' |
|
|
character (len = 80) :: abort_message |
|
|
logical,save :: check = .FALSE. |
|
|
! variables pour moyenner les variables de couplage |
|
|
real, allocatable, dimension(:,:),save :: cpl_sols, cpl_nsol, cpl_rain |
|
|
real, allocatable, dimension(:,:),save :: cpl_snow, cpl_evap, cpl_tsol |
|
|
real, allocatable, dimension(:,:),save :: cpl_fder, cpl_albe, cpl_taux |
|
|
real, allocatable, dimension(:,:),save :: cpl_windsp |
|
|
real, allocatable, dimension(:,:),save :: cpl_tauy |
|
|
REAL, ALLOCATABLE, DIMENSION(:,:),SAVE :: cpl_rriv, cpl_rcoa, cpl_rlic |
|
|
!!$ |
|
|
! variables tampons avant le passage au coupleur |
|
|
real, allocatable, dimension(:,:,:),save :: tmp_sols, tmp_nsol, tmp_rain |
|
|
real, allocatable, dimension(:,:,:),save :: tmp_snow, tmp_evap, tmp_tsol |
|
|
real, allocatable, dimension(:,:,:),save :: tmp_fder, tmp_albe, tmp_taux |
|
|
real, allocatable, dimension(:,:,:),save :: tmp_windsp |
|
|
REAL, ALLOCATABLE, DIMENSION(:,:,:),SAVE :: tmp_tauy |
|
|
! variables a passer au coupleur |
|
|
real, dimension(iim, jjm+1) :: wri_sol_ice, wri_sol_sea, wri_nsol_ice |
|
|
real, dimension(iim, jjm+1) :: wri_nsol_sea, wri_fder_ice, wri_evap_ice |
|
|
REAL, DIMENSION(iim, jjm+1) :: wri_evap_sea, wri_rcoa, wri_rriv |
|
|
REAL, DIMENSION(iim, jjm+1) :: wri_rain, wri_snow, wri_taux, wri_tauy |
|
|
REAL, DIMENSION(iim, jjm+1) :: wri_windsp |
|
|
REAL, DIMENSION(iim, jjm+1) :: wri_calv |
|
|
REAL, DIMENSION(iim, jjm+1) :: wri_tauxx, wri_tauyy, wri_tauzz |
|
|
REAL, DIMENSION(iim, jjm+1) :: tmp_lon, tmp_lat |
|
|
! variables relues par le coupleur |
|
|
! read_sic = fraction de glace |
|
|
! read_sit = temperature de glace |
|
|
real, allocatable, dimension(:,:),save :: read_sst, read_sic, read_sit |
|
|
real, allocatable, dimension(:,:),save :: read_alb_sic |
|
|
! variable tampon |
|
|
real, dimension(klon) :: tamp_sic |
|
|
! sauvegarde des fractions de surface d'un pas de temps a l'autre apres |
|
|
! l'avoir lu |
|
|
real, allocatable,dimension(:,:),save :: pctsrf_sav |
|
|
real, dimension(iim, jjm+1, 2) :: tamp_srf |
|
|
integer, allocatable, dimension(:), save :: tamp_ind |
|
|
real, allocatable, dimension(:,:),save :: tamp_zmasq |
|
|
real, dimension(iim, jjm+1) :: deno |
|
|
integer :: idtime |
|
|
integer, allocatable,dimension(:),save :: unity |
|
|
! |
|
|
logical, save :: first_appel = .true. |
|
|
logical,save :: print |
|
|
!maf |
|
|
! variables pour avoir une sortie IOIPSL des champs echanges |
|
|
CHARACTER(len=80),SAVE :: clintocplnam, clfromcplnam |
|
|
INTEGER, SAVE :: jf,nhoridct,nidct |
|
|
INTEGER, SAVE :: nhoridcs,nidcs |
|
|
INTEGER :: ndexct(iim*(jjm+1)),ndexcs(iim*(jjm+1)) |
|
|
REAL :: zx_lon(iim,jjm+1), zx_lat(iim,jjm+1), zjulian |
|
|
INTEGER,save :: idayref |
|
|
!med integer :: itau_w |
|
|
integer,save :: itau_w |
|
|
integer :: nb_interf_cpl |
|
|
include "param_cou.h" |
|
|
include "inc_cpl.h" |
|
|
! |
|
|
! Initialisation |
|
|
! |
|
|
if (check) write(*,*)'Entree ',modname,'nisurf = ',nisurf |
|
|
|
|
|
if (first_appel) then |
|
|
error = 0 |
|
|
allocate(unity(klon), stat = error) |
|
|
if ( error /=0) then |
|
|
abort_message='Pb allocation variable unity' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
allocate(pctsrf_sav(klon,nbsrf), stat = error) |
|
|
if ( error /=0) then |
|
|
abort_message='Pb allocation variable pctsrf_sav' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
pctsrf_sav = 0. |
|
|
|
|
|
do ig = 1, klon |
|
|
unity(ig) = ig |
|
|
enddo |
|
|
sum_error = 0 |
|
|
allocate(cpl_sols(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_nsol(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_rain(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_snow(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_evap(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_tsol(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_fder(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_albe(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_taux(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_windsp(klon,2), stat = error); sum_error = sum_error + error |
|
|
allocate(cpl_tauy(klon,2), stat = error); sum_error = sum_error + error |
|
|
ALLOCATE(cpl_rriv(iim,jjm+1), stat=error); sum_error = sum_error + error |
|
|
ALLOCATE(cpl_rcoa(iim,jjm+1), stat=error); sum_error = sum_error + error |
|
|
ALLOCATE(cpl_rlic(iim,jjm+1), stat=error); sum_error = sum_error + error |
|
|
!! |
|
|
allocate(read_sst(iim, jjm+1), stat = error); sum_error = sum_error + error |
|
|
allocate(read_sic(iim, jjm+1), stat = error); sum_error = sum_error + error |
|
|
allocate(read_sit(iim, jjm+1), stat = error); sum_error = sum_error + error |
|
|
allocate(read_alb_sic(iim, jjm+1), stat = error); sum_error = sum_error + error |
|
|
|
|
|
if (sum_error /= 0) then |
|
|
abort_message='Pb allocation variables couplees' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
cpl_sols = 0.; cpl_nsol = 0.; cpl_rain = 0.; cpl_snow = 0. |
|
|
cpl_evap = 0.; cpl_tsol = 0.; cpl_fder = 0.; cpl_albe = 0. |
|
|
cpl_taux = 0.; cpl_tauy = 0.; cpl_rriv = 0.; cpl_rcoa = 0.; cpl_rlic = 0. |
|
|
cpl_windsp = 0. |
|
|
|
|
|
sum_error = 0 |
|
|
allocate(tamp_ind(klon), stat = error); sum_error = sum_error + error |
|
|
allocate(tamp_zmasq(iim, jjm+1), stat = error); sum_error = sum_error + error |
|
|
do ig = 1, klon |
|
|
tamp_ind(ig) = ig |
|
|
enddo |
|
|
call gath2cpl(zmasq, tamp_zmasq, klon, klon, iim, jjm, tamp_ind) |
|
|
! |
|
|
! initialisation couplage |
|
|
! |
|
|
idtime = int(dtime) |
|
|
! |
|
|
! initialisation sorties netcdf |
|
|
! |
|
|
idayref = day_ini |
|
|
CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian) |
|
|
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,zx_lon) |
|
|
DO i = 1, iim |
|
|
zx_lon(i,1) = rlon(i+1) |
|
|
zx_lon(i,jjm+1) = rlon(i+1) |
|
|
ENDDO |
|
|
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,zx_lat) |
|
|
clintocplnam="cpl_atm_tauflx" |
|
|
CALL histbeg_totreg(clintocplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),1,iim,1,jjm+1, & |
|
|
& itau_phy,zjulian,dtime,nhoridct,nidct) |
|
|
! no vertical axis |
|
|
CALL histdef(nidct, 'tauxe','tauxe', & |
|
|
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
|
|
CALL histdef(nidct, 'tauyn','tauyn', & |
|
|
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
|
|
CALL histdef(nidct, 'tmp_lon','tmp_lon', & |
|
|
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
|
|
CALL histdef(nidct, 'tmp_lat','tmp_lat', & |
|
|
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
|
|
DO jf=1,jpflda2o1 + jpflda2o2 |
|
|
CALL histdef(nidct, cl_writ(jf),cl_writ(jf), & |
|
|
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
|
|
END DO |
|
|
CALL histend(nidct) |
|
|
CALL histsync(nidct) |
|
|
|
|
|
clfromcplnam="cpl_atm_sst" |
|
|
CALL histbeg_totreg(clfromcplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),1,iim,1,jjm+1, & |
|
|
& 0,zjulian,dtime,nhoridcs,nidcs) |
|
|
! no vertical axis |
|
|
DO jf=1,jpfldo2a |
|
|
CALL histdef(nidcs, cl_read(jf),cl_read(jf), & |
|
|
& "-",iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
|
|
END DO |
|
|
CALL histend(nidcs) |
|
|
CALL histsync(nidcs) |
|
|
|
|
|
! pour simuler la fonte des glaciers antarctiques |
|
|
! |
|
|
surf_maille = (4. * rpi * ra**2) / (iim * (jjm +1)) |
|
|
ALLOCATE(coeff_iceberg(iim,jjm+1), stat=error) |
|
|
if (error /= 0) then |
|
|
abort_message='Pb allocation variable coeff_iceberg' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
open (12,file='flux_iceberg',form='formatted',status='old') |
|
|
read (12,*) coeff_iceberg |
|
|
close (12) |
|
|
num_antarctic = max(1, count(coeff_iceberg > 0)) |
|
|
|
|
|
first_appel = .false. |
|
|
endif ! fin if (first_appel) |
|
|
|
|
|
! Initialisations |
|
|
|
|
|
! calcul des fluxs a passer |
|
|
nb_interf_cpl = nb_interf_cpl + 1 |
|
|
if (check) write(lunout,*)'passage dans interface_surf.F90 : ',nb_interf_cpl |
|
|
cpl_index = 1 |
|
|
if (nisurf == is_sic) cpl_index = 2 |
|
|
if (cumul) then |
|
|
if (check) write(lunout,*)'passage dans cumul ' |
|
|
if (check) write(lunout,*)'valeur de cpl_index ', cpl_index |
|
|
! -- LOOP |
|
|
if (check) write(*,*) modname, 'cumul des champs' |
|
|
do ig = 1, knon |
|
|
cpl_sols(ig,cpl_index) = cpl_sols(ig,cpl_index) & |
|
|
& + swdown(ig) / FLOAT(nexca) |
|
|
cpl_nsol(ig,cpl_index) = cpl_nsol(ig,cpl_index) & |
|
|
& + (lwdown(ig) + fluxlat(ig) +fluxsens(ig))& |
|
|
& / FLOAT(nexca) |
|
|
cpl_rain(ig,cpl_index) = cpl_rain(ig,cpl_index) & |
|
|
& + precip_rain(ig) / FLOAT(nexca) |
|
|
cpl_snow(ig,cpl_index) = cpl_snow(ig,cpl_index) & |
|
|
& + precip_snow(ig) / FLOAT(nexca) |
|
|
cpl_evap(ig,cpl_index) = cpl_evap(ig,cpl_index) & |
|
|
& + evap(ig) / FLOAT(nexca) |
|
|
cpl_tsol(ig,cpl_index) = cpl_tsol(ig,cpl_index) & |
|
|
& + tsurf(ig) / FLOAT(nexca) |
|
|
cpl_fder(ig,cpl_index) = cpl_fder(ig,cpl_index) & |
|
|
& + fder(ig) / FLOAT(nexca) |
|
|
cpl_albe(ig,cpl_index) = cpl_albe(ig,cpl_index) & |
|
|
& + albsol(ig) / FLOAT(nexca) |
|
|
cpl_taux(ig,cpl_index) = cpl_taux(ig,cpl_index) & |
|
|
& + taux(ig) / FLOAT(nexca) |
|
|
cpl_tauy(ig,cpl_index) = cpl_tauy(ig,cpl_index) & |
|
|
& + tauy(ig) / FLOAT(nexca) |
|
|
IF (cpl_index .EQ. 1) THEN |
|
|
cpl_windsp(ig,cpl_index) = cpl_windsp(ig,cpl_index) & |
|
|
& + windsp(ig) / FLOAT(nexca) |
|
|
ENDIF |
|
|
enddo |
|
|
IF (cpl_index .EQ. 1) THEN |
|
|
cpl_rriv(:,:) = cpl_rriv(:,:) + tmp_rriv(:,:) / FLOAT(nexca) |
|
|
cpl_rcoa(:,:) = cpl_rcoa(:,:) + tmp_rcoa(:,:) / FLOAT(nexca) |
|
|
cpl_rlic(:,:) = cpl_rlic(:,:) + tmp_rlic(:,:) / FLOAT(nexca) |
|
|
ENDIF |
|
|
endif |
|
|
|
|
|
if (mod(itime, nexca) == 1) then |
|
|
! |
|
|
! Demande des champs au coupleur |
|
|
! |
|
|
! Si le domaine considere est l'ocean, on lit les champs venant du coupleur |
|
|
! |
|
|
if (nisurf == is_oce .and. .not. cumul) then |
|
|
if (check) write(*,*)'rentree fromcpl, itime-1 = ',itime-1 |
|
|
! |
|
|
! sorties NETCDF des champs recus |
|
|
! |
|
|
ndexcs(:)=0 |
|
|
itau_w = itau_phy + itime |
|
|
CALL histwrite(nidcs,cl_read(1),itau_w,read_sst,iim*(jjm+1),ndexcs) |
|
|
CALL histwrite(nidcs,cl_read(2),itau_w,read_sic,iim*(jjm+1),ndexcs) |
|
|
CALL histwrite(nidcs,cl_read(3),itau_w,read_alb_sic,iim*(jjm+1),ndexcs) |
|
|
CALL histwrite(nidcs,cl_read(4),itau_w,read_sit,iim*(jjm+1),ndexcs) |
|
|
CALL histsync(nidcs) |
|
|
! pas utile IF (npas-itime.LT.nexca )CALL histclo(nidcs) |
|
|
|
|
|
do j = 1, jjm + 1 |
|
|
do ig = 1, iim |
|
|
if (abs(1. - read_sic(ig,j)) < 0.00001) then |
|
|
read_sst(ig,j) = RTT - 1.8 |
|
|
read_sit(ig,j) = read_sit(ig,j) / read_sic(ig,j) |
|
|
read_alb_sic(ig,j) = read_alb_sic(ig,j) / read_sic(ig,j) |
|
|
else if (abs(read_sic(ig,j)) < 0.00001) then |
|
|
read_sst(ig,j) = read_sst(ig,j) / (1. - read_sic(ig,j)) |
|
|
read_sit(ig,j) = read_sst(ig,j) |
|
|
read_alb_sic(ig,j) = 0.6 |
|
|
else |
|
|
read_sst(ig,j) = read_sst(ig,j) / (1. - read_sic(ig,j)) |
|
|
read_sit(ig,j) = read_sit(ig,j) / read_sic(ig,j) |
|
|
read_alb_sic(ig,j) = read_alb_sic(ig,j) / read_sic(ig,j) |
|
|
endif |
|
|
enddo |
|
|
enddo |
|
|
! |
|
|
! transformer read_sic en pctsrf_sav |
|
|
! |
|
|
call cpl2gath(read_sic, tamp_sic , klon, klon,iim,jjm, unity) |
|
|
do ig = 1, klon |
|
|
IF (pctsrf(ig,is_oce) > epsfra .OR. & |
|
|
& pctsrf(ig,is_sic) > epsfra) THEN |
|
|
pctsrf_sav(ig,is_sic) = (pctsrf(ig,is_oce) + pctsrf(ig,is_sic)) & |
|
|
& * tamp_sic(ig) |
|
|
pctsrf_sav(ig,is_oce) = (pctsrf(ig,is_oce) + pctsrf(ig,is_sic)) & |
|
|
& - pctsrf_sav(ig,is_sic) |
|
|
endif |
|
|
enddo |
|
|
! |
|
|
! Pour rattraper des erreurs d'arrondis |
|
|
! |
|
|
where (abs(pctsrf_sav(:,is_sic)) .le. 2.*epsilon(pctsrf_sav(1,is_sic))) |
|
|
pctsrf_sav(:,is_sic) = 0. |
|
|
pctsrf_sav(:,is_oce) = pctsrf(:,is_oce) + pctsrf(:,is_sic) |
|
|
endwhere |
|
|
where (abs(pctsrf_sav(:,is_oce)) .le. 2.*epsilon(pctsrf_sav(1,is_oce))) |
|
|
pctsrf_sav(:,is_sic) = pctsrf(:,is_oce) + pctsrf(:,is_sic) |
|
|
pctsrf_sav(:,is_oce) = 0. |
|
|
endwhere |
|
|
if (minval(pctsrf_sav(:,is_oce)) < 0.) then |
|
|
write(*,*)'Pb fraction ocean inferieure a 0' |
|
|
write(*,*)'au point ',minloc(pctsrf_sav(:,is_oce)) |
|
|
write(*,*)'valeur = ',minval(pctsrf_sav(:,is_oce)) |
|
|
abort_message = 'voir ci-dessus' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
if (minval(pctsrf_sav(:,is_sic)) < 0.) then |
|
|
write(*,*)'Pb fraction glace inferieure a 0' |
|
|
write(*,*)'au point ',minloc(pctsrf_sav(:,is_sic)) |
|
|
write(*,*)'valeur = ',minval(pctsrf_sav(:,is_sic)) |
|
|
abort_message = 'voir ci-dessus' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
endif |
|
|
endif ! fin mod(itime, nexca) == 1 |
|
|
|
|
|
if (mod(itime, nexca) == 0) then |
|
|
! |
|
|
! allocation memoire |
|
|
if (nisurf == is_oce .and. (.not. cumul) ) then |
|
|
sum_error = 0 |
|
|
allocate(tmp_sols(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_nsol(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_rain(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_snow(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_evap(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_tsol(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_fder(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_albe(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_taux(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_tauy(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
allocate(tmp_windsp(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
!!$ allocate(tmp_rriv(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
!!$ allocate(tmp_rcoa(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
|
|
if (sum_error /= 0) then |
|
|
abort_message='Pb allocation variables couplees pour l''ecriture' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
endif |
|
|
|
|
|
! |
|
|
! Mise sur la bonne grille des champs a passer au coupleur |
|
|
! |
|
|
cpl_index = 1 |
|
|
if (nisurf == is_sic) cpl_index = 2 |
|
|
call gath2cpl(cpl_sols(1,cpl_index), tmp_sols(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_nsol(1,cpl_index), tmp_nsol(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_rain(1,cpl_index), tmp_rain(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_snow(1,cpl_index), tmp_snow(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_evap(1,cpl_index), tmp_evap(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_tsol(1,cpl_index), tmp_tsol(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_fder(1,cpl_index), tmp_fder(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_albe(1,cpl_index), tmp_albe(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_taux(1,cpl_index), tmp_taux(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_windsp(1,cpl_index), tmp_windsp(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
call gath2cpl(cpl_tauy(1,cpl_index), tmp_tauy(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
|
|
|
|
|
! |
|
|
! Si le domaine considere est la banquise, on envoie les champs au coupleur |
|
|
! |
|
|
if (nisurf == is_sic .and. cumul) then |
|
|
wri_rain = 0.; wri_snow = 0.; wri_rcoa = 0.; wri_rriv = 0. |
|
|
wri_taux = 0.; wri_tauy = 0. |
|
|
wri_windsp = 0. |
|
|
! -- LOOP |
|
|
call gath2cpl(pctsrf(1,is_oce), tamp_srf(1,1,1), klon, klon, iim, jjm, tamp_ind) |
|
|
call gath2cpl(pctsrf(1,is_sic), tamp_srf(1,1,2), klon, klon, iim, jjm, tamp_ind) |
|
|
|
|
|
wri_sol_ice = tmp_sols(:,:,2) |
|
|
wri_sol_sea = tmp_sols(:,:,1) |
|
|
wri_nsol_ice = tmp_nsol(:,:,2) |
|
|
wri_nsol_sea = tmp_nsol(:,:,1) |
|
|
wri_fder_ice = tmp_fder(:,:,2) |
|
|
wri_evap_ice = tmp_evap(:,:,2) |
|
|
wri_evap_sea = tmp_evap(:,:,1) |
|
|
wri_windsp = tmp_windsp(:,:,1) |
|
|
|
|
|
!!$PB |
|
|
wri_rriv = cpl_rriv(:,:) |
|
|
wri_rcoa = cpl_rcoa(:,:) |
|
|
DO j = 1, jjm + 1 |
|
|
wri_calv(:,j) = sum(cpl_rlic(:,j)) / iim |
|
|
enddo |
|
|
|
|
|
where (tamp_zmasq /= 1.) |
|
|
deno = tamp_srf(:,:,1) + tamp_srf(:,:,2) |
|
|
wri_rain = tmp_rain(:,:,1) * tamp_srf(:,:,1) / deno + & |
|
|
& tmp_rain(:,:,2) * tamp_srf(:,:,2) / deno |
|
|
wri_snow = tmp_snow(:,:,1) * tamp_srf(:,:,1) / deno + & |
|
|
& tmp_snow(:,:,2) * tamp_srf(:,:,2) / deno |
|
|
wri_taux = tmp_taux(:,:,1) * tamp_srf(:,:,1) / deno + & |
|
|
& tmp_taux(:,:,2) * tamp_srf(:,:,2) / deno |
|
|
wri_tauy = tmp_tauy(:,:,1) * tamp_srf(:,:,1) / deno + & |
|
|
& tmp_tauy(:,:,2) * tamp_srf(:,:,2) / deno |
|
|
endwhere |
|
|
! |
|
|
! pour simuler la fonte des glaciers antarctiques |
|
|
! |
|
|
!$$$ wri_rain = wri_rain & |
|
|
!$$$ & + coeff_iceberg * cte_flux_iceberg / (num_antarctic * surf_maille) |
|
|
! wri_calv = coeff_iceberg * cte_flux_iceberg / (num_antarctic * surf_maille) |
|
|
! |
|
|
! on passe les coordonnées de la grille |
|
|
! |
|
|
|
|
|
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,tmp_lon) |
|
|
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,tmp_lat) |
|
|
|
|
|
DO i = 1, iim |
|
|
tmp_lon(i,1) = rlon(i+1) |
|
|
tmp_lon(i,jjm + 1) = rlon(i+1) |
|
|
ENDDO |
|
|
! |
|
|
! sortie netcdf des champs pour le changement de repere |
|
|
! |
|
|
ndexct(:)=0 |
|
|
CALL histwrite(nidct,'tauxe',itau_w,wri_taux,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,'tauyn',itau_w,wri_tauy,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,'tmp_lon',itau_w,tmp_lon,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,'tmp_lat',itau_w,tmp_lat,iim*(jjm+1),ndexct) |
|
|
|
|
|
! |
|
|
! calcul 3 coordonnées du vent |
|
|
! |
|
|
CALL atm2geo (iim , jjm + 1, wri_taux, wri_tauy, tmp_lon, tmp_lat, & |
|
|
& wri_tauxx, wri_tauyy, wri_tauzz ) |
|
|
! |
|
|
! sortie netcdf des champs apres changement de repere et juste avant |
|
|
! envoi au coupleur |
|
|
! |
|
|
CALL histwrite(nidct,cl_writ(8),itau_w,wri_sol_ice,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(9),itau_w,wri_sol_sea,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(10),itau_w,wri_nsol_ice,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(11),itau_w,wri_nsol_sea,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(12),itau_w,wri_fder_ice,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(13),itau_w,wri_evap_ice,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(14),itau_w,wri_evap_sea,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(15),itau_w,wri_rain,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(16),itau_w,wri_snow,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(17),itau_w,wri_rcoa,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(18),itau_w,wri_rriv,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(19),itau_w,wri_calv,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(1),itau_w,wri_tauxx,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(2),itau_w,wri_tauyy,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(3),itau_w,wri_tauzz,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(4),itau_w,wri_tauxx,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(5),itau_w,wri_tauyy,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(6),itau_w,wri_tauzz,iim*(jjm+1),ndexct) |
|
|
CALL histwrite(nidct,cl_writ(7),itau_w,wri_windsp,iim*(jjm+1),ndexct) |
|
|
CALL histsync(nidct) |
|
|
! pas utile IF (lafin) CALL histclo(nidct) |
|
|
! |
|
|
cpl_sols = 0.; cpl_nsol = 0.; cpl_rain = 0.; cpl_snow = 0. |
|
|
cpl_evap = 0.; cpl_tsol = 0.; cpl_fder = 0.; cpl_albe = 0. |
|
|
cpl_taux = 0.; cpl_tauy = 0.; cpl_rriv = 0.; cpl_rcoa = 0.; cpl_rlic = 0. |
|
|
cpl_windsp = 0. |
|
|
! |
|
|
! deallocation memoire variables temporaires |
|
|
! |
|
|
sum_error = 0 |
|
|
deallocate(tmp_sols, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_nsol, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_rain, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_snow, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_evap, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_fder, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_tsol, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_albe, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_taux, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_tauy, stat=error); sum_error = sum_error + error |
|
|
deallocate(tmp_windsp, stat=error); sum_error = sum_error + error |
|
|
if (sum_error /= 0) then |
|
|
abort_message='Pb deallocation variables couplees' |
|
|
call abort_gcm(modname,abort_message,1) |
|
|
endif |
|
|
|
|
|
endif |
|
|
|
|
|
endif ! fin (mod(itime, nexca) == 0) |
|
|
! |
|
|
! on range les variables lues/sauvegardees dans les bonnes variables de sortie |
|
|
! |
|
|
if (nisurf == is_oce) then |
|
|
call cpl2gath(read_sst, tsurf_new, klon, knon,iim,jjm, knindex) |
|
|
else if (nisurf == is_sic) then |
|
|
call cpl2gath(read_sit, tsurf_new, klon, knon,iim,jjm, knindex) |
|
|
call cpl2gath(read_alb_sic, alb_new, klon, knon,iim,jjm, knindex) |
|
|
endif |
|
|
pctsrf_new(:,nisurf) = pctsrf_sav(:,nisurf) |
|
|
|
|
|
! if (lafin) call quitcpl |
|
|
|
|
|
END SUBROUTINE interfoce_cpl |
|
|
|
|
|
!************************ |
|
|
|
|
721 |
SUBROUTINE interfoce_slab(klon, debut, itap, dtime, ijour, & |
SUBROUTINE interfoce_slab(klon, debut, itap, dtime, ijour, & |
722 |
& radsol, fluxo, fluxg, pctsrf, & |
& radsol, fluxo, fluxg, pctsrf, & |
723 |
& tslab, seaice, pctsrf_slab) |
& tslab, seaice, pctsrf_slab) |
724 |
! |
|
725 |
! Cette routine calcule la temperature d'un slab ocean, la glace de mer |
! Cette routine calcule la temperature d'un slab ocean, la glace de mer |
726 |
! et les pourcentages de la maille couverte par l'ocean libre et/ou |
! et les pourcentages de la maille couverte par l'ocean libre et/ou |
727 |
! la glace de mer pour un "slab" ocean de 50m |
! la glace de mer pour un "slab" ocean de 50m |
728 |
! |
|
729 |
! I. Musat 04.02.2005 |
! I. Musat 04.02.2005 |
730 |
! |
|
731 |
! input: |
! input: |
732 |
! klon nombre total de points de grille |
! klon nombre total de points de grille |
733 |
! debut logical: 1er appel a la physique |
! debut logical: 1er appel a la physique |
742 |
! tslab temperature de l'ocean libre |
! tslab temperature de l'ocean libre |
743 |
! seaice glace de mer (kg/m2) |
! seaice glace de mer (kg/m2) |
744 |
! pctsrf_slab "pourcentages" (valeurs entre 0. et 1.) surfaces issus du slab |
! pctsrf_slab "pourcentages" (valeurs entre 0. et 1.) surfaces issus du slab |
745 |
! |
|
746 |
use indicesol |
use indicesol |
747 |
use clesphys |
use clesphys |
748 |
use abort_gcm_m, only: abort_gcm |
use abort_gcm_m, only: abort_gcm |
762 |
real, dimension(klon), intent(INOUT) :: tslab |
real, dimension(klon), intent(INOUT) :: tslab |
763 |
real, dimension(klon), intent(INOUT) :: seaice ! glace de mer (kg/m2) |
real, dimension(klon), intent(INOUT) :: seaice ! glace de mer (kg/m2) |
764 |
real, dimension(klon, nbsrf), intent(OUT) :: pctsrf_slab |
real, dimension(klon, nbsrf), intent(OUT) :: pctsrf_slab |
765 |
! |
|
766 |
! Variables locales : |
! Variables locales : |
767 |
INTEGER, save :: lmt_pas, julien, idayvrai |
INTEGER, save :: lmt_pas, julien, idayvrai |
768 |
REAL, parameter :: unjour=86400. |
REAL, parameter :: unjour=86400. |
769 |
real, allocatable, dimension(:), save :: tmp_tslab, tmp_seaice |
real, allocatable, dimension(:), save :: tmp_tslab, tmp_seaice |
770 |
REAL, allocatable, dimension(:), save :: slab_bils |
REAL, allocatable, dimension(:), save :: slab_bils |
771 |
REAL, allocatable, dimension(:), save :: lmt_bils |
REAL, allocatable, dimension(:), save :: lmt_bils |
772 |
logical,save :: check = .false. |
logical, save :: check = .false. |
773 |
! |
|
774 |
REAL, parameter :: cyang=50.0 * 4.228e+06 ! capacite calorifique volumetrique de l'eau J/(m2 K) |
REAL, parameter :: cyang=50.0 * 4.228e+06 ! capacite calorifique volumetrique de l'eau J/(m2 K) |
775 |
REAL, parameter :: cbing=0.334e+05 ! J/kg |
REAL, parameter :: cbing=0.334e+05 ! J/kg |
776 |
real, dimension(klon) :: siceh !hauteur de la glace de mer (m) |
real, dimension(klon) :: siceh !hauteur de la glace de mer (m) |
777 |
INTEGER :: i |
INTEGER :: i |
778 |
integer :: sum_error, error |
integer :: sum_error, error |
779 |
REAL :: zz, za, zb |
REAL :: zz, za, zb |
780 |
! |
|
781 |
character (len = 80) :: abort_message |
character (len = 80) :: abort_message |
782 |
character (len = 20) :: modname = 'interfoce_slab' |
character (len = 20) :: modname = 'interfoce_slab' |
783 |
! |
|
784 |
julien = MOD(ijour,360) |
julien = MOD(ijour, 360) |
785 |
sum_error = 0 |
sum_error = 0 |
786 |
IF (debut) THEN |
IF (debut) THEN |
787 |
allocate(slab_bils(klon), stat = error); sum_error = sum_error + error |
allocate(slab_bils(klon), stat = error); sum_error = sum_error + error |
789 |
allocate(tmp_tslab(klon), stat = error); sum_error = sum_error + error |
allocate(tmp_tslab(klon), stat = error); sum_error = sum_error + error |
790 |
allocate(tmp_seaice(klon), stat = error); sum_error = sum_error + error |
allocate(tmp_seaice(klon), stat = error); sum_error = sum_error + error |
791 |
if (sum_error /= 0) then |
if (sum_error /= 0) then |
792 |
abort_message='Pb allocation var. slab_bils,lmt_bils,tmp_tslab,tmp_seaice' |
abort_message='Pb allocation var. slab_bils, lmt_bils, tmp_tslab, tmp_seaice' |
793 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
794 |
endif |
endif |
795 |
tmp_tslab=tslab |
tmp_tslab=tslab |
796 |
tmp_seaice=seaice |
tmp_seaice=seaice |
797 |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
798 |
! |
|
799 |
IF (check) THEN |
IF (check) THEN |
800 |
PRINT*,'interfoce_slab klon, debut, itap, dtime, ijour, & |
PRINT*, 'interfoce_slab klon, debut, itap, dtime, ijour, & |
801 |
& lmt_pas ', klon, debut, itap, dtime, ijour, & |
& lmt_pas ', klon, debut, itap, dtime, ijour, & |
802 |
& lmt_pas |
& lmt_pas |
803 |
ENDIF !check |
ENDIF !check |
804 |
! |
|
805 |
PRINT*, '************************' |
PRINT*, '************************' |
806 |
PRINT*, 'SLAB OCEAN est actif, prenez precautions !' |
PRINT*, 'SLAB OCEAN est actif, prenez precautions !' |
807 |
PRINT*, '************************' |
PRINT*, '************************' |
808 |
! |
|
809 |
! a mettre un slab_bils aussi en force !!! |
! a mettre un slab_bils aussi en force !!! |
810 |
! |
|
811 |
DO i = 1, klon |
DO i = 1, klon |
812 |
slab_bils(i) = 0.0 |
slab_bils(i) = 0.0 |
813 |
ENDDO |
ENDDO |
814 |
! |
|
815 |
ENDIF !debut |
ENDIF !debut |
816 |
pctsrf_slab(1:klon,1:nbsrf) = pctsrf(1:klon,1:nbsrf) |
pctsrf_slab(1:klon, 1:nbsrf) = pctsrf(1:klon, 1:nbsrf) |
817 |
! |
|
818 |
! lecture du bilan au sol lmt_bils issu d'une simulation forcee en debut de journee |
! lecture du bilan au sol lmt_bils issu d'une simulation forcee en debut de journee |
819 |
! |
|
820 |
IF (MOD(itap,lmt_pas) .EQ. 1) THEN !1er pas de temps de la journee |
IF (MOD(itap, lmt_pas) .EQ. 1) THEN !1er pas de temps de la journee |
821 |
idayvrai = ijour |
idayvrai = ijour |
822 |
CALL condsurf(julien,idayvrai, lmt_bils) |
CALL condsurf(julien, idayvrai, lmt_bils) |
823 |
ENDIF !(MOD(itap-1,lmt_pas) .EQ. 0) THEN |
ENDIF !(MOD(itap-1, lmt_pas) .EQ. 0) THEN |
824 |
|
|
825 |
DO i = 1, klon |
DO i = 1, klon |
826 |
IF((pctsrf_slab(i,is_oce).GT.epsfra).OR. & |
IF((pctsrf_slab(i, is_oce).GT.epsfra).OR. & |
827 |
& (pctsrf_slab(i,is_sic).GT.epsfra)) THEN |
& (pctsrf_slab(i, is_sic).GT.epsfra)) THEN |
828 |
! |
|
829 |
! fabriquer de la glace si congelation atteinte: |
! fabriquer de la glace si congelation atteinte: |
830 |
! |
|
831 |
IF (tmp_tslab(i).LT.(RTT-1.8)) THEN |
IF (tmp_tslab(i).LT.(RTT-1.8)) THEN |
832 |
zz = (RTT-1.8)-tmp_tslab(i) |
zz = (RTT-1.8)-tmp_tslab(i) |
833 |
tmp_seaice(i) = tmp_seaice(i) + cyang/cbing * zz |
tmp_seaice(i) = tmp_seaice(i) + cyang/cbing * zz |
834 |
seaice(i) = tmp_seaice(i) |
seaice(i) = tmp_seaice(i) |
835 |
tmp_tslab(i) = RTT-1.8 |
tmp_tslab(i) = RTT-1.8 |
836 |
ENDIF |
ENDIF |
837 |
! |
|
838 |
! faire fondre de la glace si temperature est superieure a 0: |
! faire fondre de la glace si temperature est superieure a 0: |
839 |
! |
|
840 |
IF ((tmp_tslab(i).GT.RTT) .AND. (tmp_seaice(i).GT.0.0)) THEN |
IF ((tmp_tslab(i).GT.RTT) .AND. (tmp_seaice(i).GT.0.0)) THEN |
841 |
zz = cyang/cbing * (tmp_tslab(i)-RTT) |
zz = cyang/cbing * (tmp_tslab(i)-RTT) |
842 |
zz = MIN(zz,tmp_seaice(i)) |
zz = MIN(zz, tmp_seaice(i)) |
843 |
tmp_seaice(i) = tmp_seaice(i) - zz |
tmp_seaice(i) = tmp_seaice(i) - zz |
844 |
seaice(i) = tmp_seaice(i) |
seaice(i) = tmp_seaice(i) |
845 |
tmp_tslab(i) = tmp_tslab(i) - zz*cbing/cyang |
tmp_tslab(i) = tmp_tslab(i) - zz*cbing/cyang |
846 |
ENDIF |
ENDIF |
847 |
! |
|
848 |
! limiter la glace de mer a 10 metres (10000 kg/m2) |
! limiter la glace de mer a 10 metres (10000 kg/m2) |
849 |
! |
|
850 |
IF(tmp_seaice(i).GT.45.) THEN |
IF(tmp_seaice(i).GT.45.) THEN |
851 |
tmp_seaice(i) = MIN(tmp_seaice(i),10000.0) |
tmp_seaice(i) = MIN(tmp_seaice(i), 10000.0) |
852 |
ELSE |
ELSE |
853 |
tmp_seaice(i) = 0. |
tmp_seaice(i) = 0. |
854 |
ENDIF |
ENDIF |
855 |
seaice(i) = tmp_seaice(i) |
seaice(i) = tmp_seaice(i) |
856 |
siceh(i)=tmp_seaice(i)/1000. !en metres |
siceh(i)=tmp_seaice(i)/1000. !en metres |
857 |
! |
|
858 |
! determiner la nature du sol (glace de mer ou ocean libre): |
! determiner la nature du sol (glace de mer ou ocean libre): |
859 |
! |
|
860 |
! on fait dependre la fraction de seaice "pctsrf(i,is_sic)" |
! on fait dependre la fraction de seaice "pctsrf(i, is_sic)" |
861 |
! de l'epaisseur de seaice : |
! de l'epaisseur de seaice : |
862 |
! pctsrf(i,is_sic)=1. si l'epaisseur de la glace de mer est >= a 20cm |
! pctsrf(i, is_sic)=1. si l'epaisseur de la glace de mer est >= a 20cm |
863 |
! et pctsrf(i,is_sic) croit lineairement avec seaice de 0. a 20cm d'epaisseur |
! et pctsrf(i, is_sic) croit lineairement avec seaice de 0. a 20cm d'epaisseur |
864 |
! |
|
865 |
pctsrf_slab(i,is_sic)=MIN(siceh(i)/0.20, & |
pctsrf_slab(i, is_sic)=MIN(siceh(i)/0.20, & |
866 |
& 1.-(pctsrf_slab(i,is_ter)+pctsrf_slab(i,is_lic))) |
& 1.-(pctsrf_slab(i, is_ter)+pctsrf_slab(i, is_lic))) |
867 |
pctsrf_slab(i,is_oce)=1.0 - & |
pctsrf_slab(i, is_oce)=1.0 - & |
868 |
& (pctsrf_slab(i,is_ter)+pctsrf_slab(i,is_lic)+pctsrf_slab(i,is_sic)) |
& (pctsrf_slab(i, is_ter)+pctsrf_slab(i, is_lic)+pctsrf_slab(i, is_sic)) |
869 |
ENDIF !pctsrf |
ENDIF !pctsrf |
870 |
ENDDO |
ENDDO |
871 |
! |
|
872 |
! Calculer le bilan du flux de chaleur au sol : |
! Calculer le bilan du flux de chaleur au sol : |
873 |
! |
|
874 |
DO i = 1, klon |
DO i = 1, klon |
875 |
za = radsol(i) + fluxo(i) |
za = radsol(i) + fluxo(i) |
876 |
zb = fluxg(i) |
zb = fluxg(i) |
877 |
IF((pctsrf_slab(i,is_oce).GT.epsfra).OR. & |
IF((pctsrf_slab(i, is_oce).GT.epsfra).OR. & |
878 |
& (pctsrf_slab(i,is_sic).GT.epsfra)) THEN |
& (pctsrf_slab(i, is_sic).GT.epsfra)) THEN |
879 |
slab_bils(i)=slab_bils(i)+(za*pctsrf_slab(i,is_oce) & |
slab_bils(i)=slab_bils(i)+(za*pctsrf_slab(i, is_oce) & |
880 |
& +zb*pctsrf_slab(i,is_sic))/ FLOAT(lmt_pas) |
& +zb*pctsrf_slab(i, is_sic))/ FLOAT(lmt_pas) |
881 |
ENDIF |
ENDIF |
882 |
ENDDO !klon |
ENDDO !klon |
883 |
! |
|
884 |
! calcul tslab |
! calcul tslab |
885 |
! |
|
886 |
IF (MOD(itap,lmt_pas).EQ.0) THEN !fin de journee |
IF (MOD(itap, lmt_pas).EQ.0) THEN !fin de journee |
887 |
DO i = 1, klon |
DO i = 1, klon |
888 |
IF ((pctsrf_slab(i,is_oce).GT.epsfra).OR. & |
IF ((pctsrf_slab(i, is_oce).GT.epsfra).OR. & |
889 |
& (pctsrf_slab(i,is_sic).GT.epsfra)) THEN |
& (pctsrf_slab(i, is_sic).GT.epsfra)) THEN |
890 |
tmp_tslab(i) = tmp_tslab(i) + & |
tmp_tslab(i) = tmp_tslab(i) + & |
891 |
& (slab_bils(i)-lmt_bils(i)) & |
& (slab_bils(i)-lmt_bils(i)) & |
892 |
& /cyang*unjour |
& /cyang*unjour |
894 |
slab_bils(i) = 0. |
slab_bils(i) = 0. |
895 |
ENDIF !pctsrf |
ENDIF !pctsrf |
896 |
ENDDO !klon |
ENDDO !klon |
897 |
ENDIF !(MOD(itap,lmt_pas).EQ.0) THEN |
ENDIF !(MOD(itap, lmt_pas).EQ.0) THEN |
898 |
! |
|
899 |
tslab = tmp_tslab |
tslab = tmp_tslab |
900 |
seaice = tmp_seaice |
seaice = tmp_seaice |
901 |
END SUBROUTINE interfoce_slab |
END SUBROUTINE interfoce_slab |
907 |
& debut, & |
& debut, & |
908 |
& lmt_sst, pctsrf_new) |
& lmt_sst, pctsrf_new) |
909 |
|
|
910 |
! Cette routine sert d'interface entre le modele atmospherique et un fichier |
! Cette routine sert d'interface entre le modele atmospherique et |
911 |
! de conditions aux limites |
! un fichier de conditions aux limites |
912 |
! |
|
913 |
! L. Fairhead 02/2000 |
! L. Fairhead 02/2000 |
|
! |
|
|
! input: |
|
|
! itime numero du pas de temps courant |
|
|
! dtime pas de temps de la physique (en s) |
|
|
! jour jour a lire dans l'annee |
|
|
! nisurf index de la surface a traiter (1 = sol continental) |
|
|
! knon nombre de points dans le domaine a traiter |
|
|
! knindex index des points de la surface a traiter |
|
|
! klon taille de la grille |
|
|
! debut logical: 1er appel a la physique (initialisation) |
|
|
! |
|
|
! output: |
|
|
! lmt_sst SST lues dans le fichier de CL |
|
|
! pctsrf_new sous-maille fractionnelle |
|
|
! |
|
914 |
|
|
915 |
use abort_gcm_m, only: abort_gcm |
use abort_gcm_m, only: abort_gcm |
916 |
use indicesol |
use indicesol |
917 |
|
|
918 |
! Parametres d'entree |
integer, intent(IN) :: itime ! numero du pas de temps courant |
919 |
integer, intent(IN) :: itime |
real , intent(IN) :: dtime ! pas de temps de la physique (en s) |
920 |
real , intent(IN) :: dtime |
integer, intent(IN) :: jour ! jour a lire dans l'annee |
921 |
integer, intent(IN) :: jour |
integer, intent(IN) :: nisurf ! index de la surface a traiter (1 = sol continental) |
922 |
integer, intent(IN) :: nisurf |
integer, intent(IN) :: knon ! nombre de points dans le domaine a traiter |
923 |
integer, intent(IN) :: knon |
integer, intent(IN) :: klon ! taille de la grille |
924 |
integer, intent(IN) :: klon |
integer, dimension(klon), intent(in) :: knindex ! index des points de la surface a traiter |
925 |
integer, dimension(klon), intent(in) :: knindex |
logical, intent(IN) :: debut ! logical: 1er appel a la physique (initialisation) |
|
logical, intent(IN) :: debut |
|
926 |
|
|
927 |
! Parametres de sortie |
! Parametres de sortie |
928 |
|
! output: |
929 |
|
! lmt_sst SST lues dans le fichier de CL |
930 |
|
! pctsrf_new sous-maille fractionnelle |
931 |
real, intent(out), dimension(klon) :: lmt_sst |
real, intent(out), dimension(klon) :: lmt_sst |
932 |
real, intent(out), dimension(klon,nbsrf) :: pctsrf_new |
real, intent(out), dimension(klon, nbsrf) :: pctsrf_new |
933 |
|
|
934 |
! Variables locales |
! Variables locales |
935 |
integer :: ii |
integer :: ii |
936 |
INTEGER,save :: lmt_pas ! frequence de lecture des conditions limites |
INTEGER, save :: lmt_pas ! frequence de lecture des conditions limites |
937 |
! (en pas de physique) |
! (en pas de physique) |
938 |
logical,save :: deja_lu ! pour indiquer que le jour a lire a deja |
logical, save :: deja_lu ! pour indiquer que le jour a lire a deja |
939 |
! lu pour une surface precedente |
! lu pour une surface precedente |
940 |
integer,save :: jour_lu |
integer, save :: jour_lu |
941 |
integer :: ierr |
integer :: ierr |
942 |
character (len = 20) :: modname = 'interfoce_lim' |
character (len = 20) :: modname = 'interfoce_lim' |
943 |
character (len = 80) :: abort_message |
character (len = 80) :: abort_message |
945 |
logical, save :: check = .FALSE. |
logical, save :: check = .FALSE. |
946 |
! Champs lus dans le fichier de CL |
! Champs lus dans le fichier de CL |
947 |
real, allocatable , save, dimension(:) :: sst_lu, rug_lu, nat_lu |
real, allocatable , save, dimension(:) :: sst_lu, rug_lu, nat_lu |
948 |
real, allocatable , save, dimension(:,:) :: pct_tmp |
real, allocatable , save, dimension(:, :) :: pct_tmp |
949 |
! |
|
950 |
! quelques variables pour netcdf |
! quelques variables pour netcdf |
951 |
! |
|
952 |
include "netcdf.inc" |
include "netcdf.inc" |
953 |
integer :: nid, nvarid |
integer :: nid, nvarid |
954 |
integer, dimension(2) :: start, epais |
integer, dimension(2) :: start, epais |
955 |
! |
|
956 |
! Fin déclaration |
! -------------------------------------------------- |
|
! |
|
957 |
|
|
958 |
if (debut .and. .not. allocated(sst_lu)) then |
if (debut .and. .not. allocated(sst_lu)) then |
959 |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
960 |
jour_lu = jour - 1 |
jour_lu = jour - 1 |
961 |
allocate(sst_lu(klon)) |
allocate(sst_lu(klon)) |
962 |
allocate(nat_lu(klon)) |
allocate(nat_lu(klon)) |
963 |
allocate(pct_tmp(klon,nbsrf)) |
allocate(pct_tmp(klon, nbsrf)) |
964 |
endif |
endif |
965 |
|
|
966 |
if ((jour - jour_lu) /= 0) deja_lu = .false. |
if ((jour - jour_lu) /= 0) deja_lu = .false. |
967 |
|
|
968 |
if (check) write(*,*)modname,' :: jour, jour_lu, deja_lu', jour, jour_lu, & |
if (check) write(*, *)modname, ' :: jour, jour_lu, deja_lu', jour, jour_lu, & |
969 |
deja_lu |
deja_lu |
970 |
if (check) write(*,*)modname,' :: itime, lmt_pas ', itime, lmt_pas,dtime |
if (check) write(*, *)modname, ' :: itime, lmt_pas ', itime, lmt_pas, dtime |
971 |
|
|
972 |
! Tester d'abord si c'est le moment de lire le fichier |
! Tester d'abord si c'est le moment de lire le fichier |
973 |
if (mod(itime-1, lmt_pas) == 0 .and. .not. deja_lu) then |
if (mod(itime-1, lmt_pas) == 0 .and. .not. deja_lu) then |
974 |
! |
|
975 |
! Ouverture du fichier |
! Ouverture du fichier |
976 |
! |
|
977 |
ierr = NF_OPEN ('limit.nc', NF_NOWRITE,nid) |
ierr = NF_OPEN ('limit.nc', NF_NOWRITE, nid) |
978 |
if (ierr.NE.NF_NOERR) then |
if (ierr.NE.NF_NOERR) then |
979 |
abort_message & |
abort_message & |
980 |
= 'Pb d''ouverture du fichier de conditions aux limites' |
= 'Pb d''ouverture du fichier de conditions aux limites' |
981 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
982 |
endif |
endif |
983 |
! |
|
984 |
! La tranche de donnees a lire: |
! La tranche de donnees a lire: |
985 |
! |
|
986 |
start(1) = 1 |
start(1) = 1 |
987 |
start(2) = jour |
start(2) = jour |
988 |
epais(1) = klon |
epais(1) = klon |
989 |
epais(2) = 1 |
epais(2) = 1 |
990 |
! |
|
991 |
if (newlmt) then |
if (newlmt) then |
992 |
! |
|
993 |
! Fraction "ocean" |
! Fraction "ocean" |
994 |
! |
|
995 |
ierr = NF_INQ_VARID(nid, 'FOCE', nvarid) |
ierr = NF_INQ_VARID(nid, 'FOCE', nvarid) |
996 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
997 |
abort_message = 'Le champ <FOCE> est absent' |
abort_message = 'Le champ <FOCE> est absent' |
998 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
999 |
endif |
endif |
1000 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_oce)) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, pct_tmp(1, is_oce)) |
1001 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1002 |
abort_message = 'Lecture echouee pour <FOCE>' |
abort_message = 'Lecture echouee pour <FOCE>' |
1003 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1004 |
endif |
endif |
1005 |
! |
|
1006 |
! Fraction "glace de mer" |
! Fraction "glace de mer" |
1007 |
! |
|
1008 |
ierr = NF_INQ_VARID(nid, 'FSIC', nvarid) |
ierr = NF_INQ_VARID(nid, 'FSIC', nvarid) |
1009 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1010 |
abort_message = 'Le champ <FSIC> est absent' |
abort_message = 'Le champ <FSIC> est absent' |
1011 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1012 |
endif |
endif |
1013 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_sic)) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, pct_tmp(1, is_sic)) |
1014 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1015 |
abort_message = 'Lecture echouee pour <FSIC>' |
abort_message = 'Lecture echouee pour <FSIC>' |
1016 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1017 |
endif |
endif |
1018 |
! |
|
1019 |
! Fraction "terre" |
! Fraction "terre" |
1020 |
! |
|
1021 |
ierr = NF_INQ_VARID(nid, 'FTER', nvarid) |
ierr = NF_INQ_VARID(nid, 'FTER', nvarid) |
1022 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1023 |
abort_message = 'Le champ <FTER> est absent' |
abort_message = 'Le champ <FTER> est absent' |
1024 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1025 |
endif |
endif |
1026 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_ter)) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, pct_tmp(1, is_ter)) |
1027 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1028 |
abort_message = 'Lecture echouee pour <FTER>' |
abort_message = 'Lecture echouee pour <FTER>' |
1029 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1030 |
endif |
endif |
1031 |
! |
|
1032 |
! Fraction "glacier terre" |
! Fraction "glacier terre" |
1033 |
! |
|
1034 |
ierr = NF_INQ_VARID(nid, 'FLIC', nvarid) |
ierr = NF_INQ_VARID(nid, 'FLIC', nvarid) |
1035 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1036 |
abort_message = 'Le champ <FLIC> est absent' |
abort_message = 'Le champ <FLIC> est absent' |
1037 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1038 |
endif |
endif |
1039 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_lic)) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, pct_tmp(1, is_lic)) |
1040 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1041 |
abort_message = 'Lecture echouee pour <FLIC>' |
abort_message = 'Lecture echouee pour <FLIC>' |
1042 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1043 |
endif |
endif |
1044 |
! |
|
1045 |
else ! on en est toujours a rnatur |
else ! on en est toujours a rnatur |
1046 |
! |
|
1047 |
ierr = NF_INQ_VARID(nid, 'NAT', nvarid) |
ierr = NF_INQ_VARID(nid, 'NAT', nvarid) |
1048 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1049 |
abort_message = 'Le champ <NAT> est absent' |
abort_message = 'Le champ <NAT> est absent' |
1050 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1051 |
endif |
endif |
1052 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, nat_lu) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, nat_lu) |
1053 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1054 |
abort_message = 'Lecture echouee pour <NAT>' |
abort_message = 'Lecture echouee pour <NAT>' |
1055 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1056 |
endif |
endif |
1057 |
! |
|
1058 |
! Remplissage des fractions de surface |
! Remplissage des fractions de surface |
1059 |
! nat = 0, 1, 2, 3 pour ocean, terre, glacier, seaice |
! nat = 0, 1, 2, 3 pour ocean, terre, glacier, seaice |
1060 |
! |
|
1061 |
pct_tmp = 0.0 |
pct_tmp = 0.0 |
1062 |
do ii = 1, klon |
do ii = 1, klon |
1063 |
pct_tmp(ii,nint(nat_lu(ii)) + 1) = 1. |
pct_tmp(ii, nint(nat_lu(ii)) + 1) = 1. |
1064 |
enddo |
enddo |
1065 |
|
|
1066 |
! |
|
1067 |
! On se retrouve avec ocean en 1 et terre en 2 alors qu'on veut le contraire |
! On se retrouve avec ocean en 1 et terre en 2 alors qu'on veut le contraire |
1068 |
! |
|
1069 |
pctsrf_new = pct_tmp |
pctsrf_new = pct_tmp |
1070 |
pctsrf_new (:,2)= pct_tmp (:,1) |
pctsrf_new (:, 2)= pct_tmp (:, 1) |
1071 |
pctsrf_new (:,1)= pct_tmp (:,2) |
pctsrf_new (:, 1)= pct_tmp (:, 2) |
1072 |
pct_tmp = pctsrf_new |
pct_tmp = pctsrf_new |
1073 |
endif ! fin test sur newlmt |
endif ! fin test sur newlmt |
1074 |
! |
|
1075 |
! Lecture SST |
! Lecture SST |
1076 |
! |
|
1077 |
ierr = NF_INQ_VARID(nid, 'SST', nvarid) |
ierr = NF_INQ_VARID(nid, 'SST', nvarid) |
1078 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1079 |
abort_message = 'Le champ <SST> est absent' |
abort_message = 'Le champ <SST> est absent' |
1080 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1081 |
endif |
endif |
1082 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, sst_lu) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, sst_lu) |
1083 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1084 |
abort_message = 'Lecture echouee pour <SST>' |
abort_message = 'Lecture echouee pour <SST>' |
1085 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1086 |
endif |
endif |
1087 |
|
|
1088 |
! |
|
1089 |
! Fin de lecture |
! Fin de lecture |
1090 |
! |
|
1091 |
ierr = NF_CLOSE(nid) |
ierr = NF_CLOSE(nid) |
1092 |
deja_lu = .true. |
deja_lu = .true. |
1093 |
jour_lu = jour |
jour_lu = jour |
1094 |
endif |
endif |
1095 |
! |
|
1096 |
! Recopie des variables dans les champs de sortie |
! Recopie des variables dans les champs de sortie |
1097 |
! |
|
1098 |
lmt_sst = 999999999. |
lmt_sst = 999999999. |
1099 |
do ii = 1, knon |
do ii = 1, knon |
1100 |
lmt_sst(ii) = sst_lu(knindex(ii)) |
lmt_sst(ii) = sst_lu(knindex(ii)) |
1101 |
enddo |
enddo |
1102 |
|
|
1103 |
pctsrf_new(:,is_oce) = pct_tmp(:,is_oce) |
pctsrf_new(:, is_oce) = pct_tmp(:, is_oce) |
1104 |
pctsrf_new(:,is_sic) = pct_tmp(:,is_sic) |
pctsrf_new(:, is_sic) = pct_tmp(:, is_sic) |
1105 |
|
|
1106 |
END SUBROUTINE interfoce_lim |
END SUBROUTINE interfoce_lim |
1107 |
|
|
1114 |
|
|
1115 |
! Cette routine sert d'interface entre le modèle atmosphérique et |
! Cette routine sert d'interface entre le modèle atmosphérique et |
1116 |
! un fichier de conditions aux limites. |
! un fichier de conditions aux limites. |
1117 |
! |
|
1118 |
! L. Fairhead 02/2000 |
! L. Fairhead 02/2000 |
1119 |
! |
|
1120 |
|
use abort_gcm_m, only: abort_gcm |
1121 |
|
|
1122 |
|
! Parametres d'entree |
1123 |
! input: |
! input: |
1124 |
! itime numero du pas de temps courant |
! itime numero du pas de temps courant |
1125 |
! dtime pas de temps de la physique (en s) |
! dtime pas de temps de la physique (en s) |
1129 |
! knindex index des points de la surface a traiter |
! knindex index des points de la surface a traiter |
1130 |
! klon taille de la grille |
! klon taille de la grille |
1131 |
! debut logical: 1er appel a la physique (initialisation) |
! debut logical: 1er appel a la physique (initialisation) |
|
! |
|
|
! output: |
|
|
! lmt_sst SST lues dans le fichier de CL |
|
|
! lmt_alb Albedo lu |
|
|
! lmt_rug longueur de rugosité lue |
|
|
! pctsrf_new sous-maille fractionnelle |
|
|
! |
|
|
|
|
|
use abort_gcm_m, only: abort_gcm |
|
|
|
|
|
! Parametres d'entree |
|
1132 |
integer, intent(IN) :: itime |
integer, intent(IN) :: itime |
1133 |
real , intent(IN) :: dtime |
real , intent(IN) :: dtime |
1134 |
integer, intent(IN) :: jour |
integer, intent(IN) :: jour |
1139 |
logical, intent(IN) :: debut |
logical, intent(IN) :: debut |
1140 |
|
|
1141 |
! Parametres de sortie |
! Parametres de sortie |
1142 |
|
! output: |
1143 |
|
! lmt_sst SST lues dans le fichier de CL |
1144 |
|
! lmt_alb Albedo lu |
1145 |
|
! lmt_rug longueur de rugosité lue |
1146 |
|
! pctsrf_new sous-maille fractionnelle |
1147 |
real, intent(out), dimension(klon) :: lmt_alb |
real, intent(out), dimension(klon) :: lmt_alb |
1148 |
real, intent(out), dimension(klon) :: lmt_rug |
real, intent(out), dimension(klon) :: lmt_rug |
1149 |
|
|
1150 |
! Variables locales |
! Variables locales |
1151 |
integer :: ii |
integer :: ii |
1152 |
integer,save :: lmt_pas ! frequence de lecture des conditions limites |
integer, save :: lmt_pas ! frequence de lecture des conditions limites |
1153 |
! (en pas de physique) |
! (en pas de physique) |
1154 |
logical,save :: deja_lu_sur! pour indiquer que le jour a lire a deja |
logical, save :: deja_lu_sur! pour indiquer que le jour a lire a deja |
1155 |
! lu pour une surface precedente |
! lu pour une surface precedente |
1156 |
integer,save :: jour_lu_sur |
integer, save :: jour_lu_sur |
1157 |
integer :: ierr |
integer :: ierr |
1158 |
character (len = 20) :: modname = 'interfsur_lim' |
character (len = 20) :: modname = 'interfsur_lim' |
1159 |
character (len = 80) :: abort_message |
character (len = 80) :: abort_message |
1160 |
logical,save :: newlmt = .false. |
logical, save :: newlmt = .false. |
1161 |
logical,save :: check = .false. |
logical, save :: check = .false. |
1162 |
! Champs lus dans le fichier de CL |
! Champs lus dans le fichier de CL |
1163 |
real, allocatable , save, dimension(:) :: alb_lu, rug_lu |
real, allocatable , save, dimension(:) :: alb_lu, rug_lu |
1164 |
! |
|
1165 |
! quelques variables pour netcdf |
! quelques variables pour netcdf |
1166 |
! |
|
1167 |
include "netcdf.inc" |
include "netcdf.inc" |
1168 |
integer ,save :: nid, nvarid |
integer , save :: nid, nvarid |
1169 |
integer, dimension(2),save :: start, epais |
integer, dimension(2), save :: start, epais |
1170 |
! |
|
1171 |
! Fin déclaration |
!------------------------------------------------------------ |
|
! |
|
1172 |
|
|
1173 |
if (debut) then |
if (debut) then |
1174 |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
1179 |
|
|
1180 |
if ((jour - jour_lu_sur) /= 0) deja_lu_sur = .false. |
if ((jour - jour_lu_sur) /= 0) deja_lu_sur = .false. |
1181 |
|
|
1182 |
if (check) write(*,*)modname,':: jour_lu_sur, deja_lu_sur', jour_lu_sur, & |
if (check) write(*, *)modname, ':: jour_lu_sur, deja_lu_sur', jour_lu_sur, & |
1183 |
deja_lu_sur |
deja_lu_sur |
1184 |
if (check) write(*,*)modname,':: itime, lmt_pas', itime, lmt_pas |
if (check) write(*, *)modname, ':: itime, lmt_pas', itime, lmt_pas |
1185 |
|
|
1186 |
! Tester d'abord si c'est le moment de lire le fichier |
! Tester d'abord si c'est le moment de lire le fichier |
1187 |
if (mod(itime-1, lmt_pas) == 0 .and. .not. deja_lu_sur) then |
if (mod(itime-1, lmt_pas) == 0 .and. .not. deja_lu_sur) then |
1188 |
! |
|
1189 |
! Ouverture du fichier |
! Ouverture du fichier |
1190 |
! |
|
1191 |
ierr = NF_OPEN ('limit.nc', NF_NOWRITE,nid) |
ierr = NF_OPEN ('limit.nc', NF_NOWRITE, nid) |
1192 |
if (ierr.NE.NF_NOERR) then |
if (ierr.NE.NF_NOERR) then |
1193 |
abort_message & |
abort_message & |
1194 |
= 'Pb d''ouverture du fichier de conditions aux limites' |
= 'Pb d''ouverture du fichier de conditions aux limites' |
1195 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1196 |
endif |
endif |
1197 |
! |
|
1198 |
! La tranche de donnees a lire: |
! La tranche de donnees a lire: |
1199 |
|
|
1200 |
start(1) = 1 |
start(1) = 1 |
1201 |
start(2) = jour |
start(2) = jour |
1202 |
epais(1) = klon |
epais(1) = klon |
1203 |
epais(2) = 1 |
epais(2) = 1 |
1204 |
! |
|
1205 |
! Lecture Albedo |
! Lecture Albedo |
1206 |
! |
|
1207 |
ierr = NF_INQ_VARID(nid, 'ALB', nvarid) |
ierr = NF_INQ_VARID(nid, 'ALB', nvarid) |
1208 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1209 |
abort_message = 'Le champ <ALB> est absent' |
abort_message = 'Le champ <ALB> est absent' |
1210 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1211 |
endif |
endif |
1212 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, alb_lu) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, alb_lu) |
1213 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1214 |
abort_message = 'Lecture echouee pour <ALB>' |
abort_message = 'Lecture echouee pour <ALB>' |
1215 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1216 |
endif |
endif |
1217 |
! |
|
1218 |
! Lecture rugosité |
! Lecture rugosité |
1219 |
! |
|
1220 |
ierr = NF_INQ_VARID(nid, 'RUG', nvarid) |
ierr = NF_INQ_VARID(nid, 'RUG', nvarid) |
1221 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1222 |
abort_message = 'Le champ <RUG> est absent' |
abort_message = 'Le champ <RUG> est absent' |
1223 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1224 |
endif |
endif |
1225 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, rug_lu) |
ierr = NF_GET_VARA_REAL(nid, nvarid, start, epais, rug_lu) |
1226 |
if (ierr /= NF_NOERR) then |
if (ierr /= NF_NOERR) then |
1227 |
abort_message = 'Lecture echouee pour <RUG>' |
abort_message = 'Lecture echouee pour <RUG>' |
1228 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1229 |
endif |
endif |
1230 |
|
|
1231 |
! |
|
1232 |
! Fin de lecture |
! Fin de lecture |
1233 |
! |
|
1234 |
ierr = NF_CLOSE(nid) |
ierr = NF_CLOSE(nid) |
1235 |
deja_lu_sur = .true. |
deja_lu_sur = .true. |
1236 |
jour_lu_sur = jour |
jour_lu_sur = jour |
1237 |
endif |
endif |
1238 |
! |
|
1239 |
! Recopie des variables dans les champs de sortie |
! Recopie des variables dans les champs de sortie |
1240 |
! |
|
1241 |
!!$ lmt_alb(:) = 0.0 |
!!$ lmt_alb = 0.0 |
1242 |
!!$ lmt_rug(:) = 0.0 |
!!$ lmt_rug = 0.0 |
1243 |
lmt_alb(:) = 999999. |
lmt_alb = 999999. |
1244 |
lmt_rug(:) = 999999. |
lmt_rug = 999999. |
1245 |
DO ii = 1, knon |
DO ii = 1, knon |
1246 |
lmt_alb(ii) = alb_lu(knindex(ii)) |
lmt_alb(ii) = alb_lu(knindex(ii)) |
1247 |
lmt_rug(ii) = rug_lu(knindex(ii)) |
lmt_rug(ii) = rug_lu(knindex(ii)) |
1260 |
|
|
1261 |
! Cette routine calcule les fluxs en h et q a l'interface et eventuellement |
! Cette routine calcule les fluxs en h et q a l'interface et eventuellement |
1262 |
! une temperature de surface (au cas ou ok_veget = false) |
! une temperature de surface (au cas ou ok_veget = false) |
1263 |
! |
|
1264 |
! L. Fairhead 4/2000 |
! L. Fairhead 4/2000 |
1265 |
! |
|
1266 |
! input: |
! input: |
1267 |
! knon nombre de points a traiter |
! knon nombre de points a traiter |
1268 |
! nisurf surface a traiter |
! nisurf surface a traiter |
1282 |
! peqBcoef coeff. B de la resolution de la CL pour q |
! peqBcoef coeff. B de la resolution de la CL pour q |
1283 |
! radsol rayonnement net aus sol (LW + SW) |
! radsol rayonnement net aus sol (LW + SW) |
1284 |
! dif_grnd coeff. diffusion vers le sol profond |
! dif_grnd coeff. diffusion vers le sol profond |
1285 |
! |
|
1286 |
! output: |
! output: |
1287 |
! tsurf_new temperature au sol |
! tsurf_new temperature au sol |
1288 |
! qsurf humidite de l'air au dessus du sol |
! qsurf humidite de l'air au dessus du sol |
1290 |
! fluxlat flux de chaleur latente |
! fluxlat flux de chaleur latente |
1291 |
! dflux_s derivee du flux de chaleur sensible / Ts |
! dflux_s derivee du flux de chaleur sensible / Ts |
1292 |
! dflux_l derivee du flux de chaleur latente / Ts |
! dflux_l derivee du flux de chaleur latente / Ts |
1293 |
! |
|
1294 |
|
|
1295 |
use indicesol |
use indicesol |
1296 |
use abort_gcm_m, only: abort_gcm |
use abort_gcm_m, only: abort_gcm |
1328 |
real, parameter :: t_grnd = 271.35, t_coup = 273.15 |
real, parameter :: t_grnd = 271.35, t_coup = 273.15 |
1329 |
!! PB temporaire en attendant mieux pour le modele de neige |
!! PB temporaire en attendant mieux pour le modele de neige |
1330 |
REAL, parameter :: chasno = 3.334E+05/(2.3867E+06*0.15) |
REAL, parameter :: chasno = 3.334E+05/(2.3867E+06*0.15) |
1331 |
! |
|
1332 |
logical, save :: check = .false. |
logical, save :: check = .false. |
1333 |
character (len = 20) :: modname = 'calcul_fluxs' |
character (len = 20) :: modname = 'calcul_fluxs' |
1334 |
logical, save :: fonte_neige = .false. |
logical, save :: fonte_neige = .false. |
1335 |
real, save :: max_eau_sol = 150.0 |
real, save :: max_eau_sol = 150.0 |
1336 |
character (len = 80) :: abort_message |
character (len = 80) :: abort_message |
1337 |
logical,save :: first = .true.,second=.false. |
logical, save :: first = .true., second=.false. |
1338 |
|
|
1339 |
if (check) write(*,*)'Entree ', modname,' surface = ',nisurf |
if (check) write(*, *)'Entree ', modname, ' surface = ', nisurf |
1340 |
|
|
1341 |
IF (check) THEN |
IF (check) THEN |
1342 |
WRITE(*,*)' radsol (min, max)' & |
WRITE(*, *)' radsol (min, max)' & |
1343 |
& , MINVAL(radsol(1:knon)), MAXVAL(radsol(1:knon)) |
& , MINVAL(radsol(1:knon)), MAXVAL(radsol(1:knon)) |
1344 |
!!CALL flush(6) |
!!CALL flush(6) |
1345 |
ENDIF |
ENDIF |
1346 |
|
|
1347 |
if (size(coastalflow) /= knon .AND. nisurf == is_ter) then |
if (size(coastalflow) /= knon .AND. nisurf == is_ter) then |
1348 |
write(*,*)'Bizarre, le nombre de points continentaux' |
write(*, *)'Bizarre, le nombre de points continentaux' |
1349 |
write(*,*)'a change entre deux appels. J''arrete ...' |
write(*, *)'a change entre deux appels. J''arrete ...' |
1350 |
abort_message='Pb run_off' |
abort_message='Pb run_off' |
1351 |
call abort_gcm(modname,abort_message,1) |
call abort_gcm(modname, abort_message, 1) |
1352 |
endif |
endif |
1353 |
! |
|
1354 |
! Traitement neige et humidite du sol |
! Traitement neige et humidite du sol |
1355 |
! |
|
1356 |
!!$ WRITE(*,*)'test calcul_flux, surface ', nisurf |
!!$ WRITE(*, *)'test calcul_flux, surface ', nisurf |
1357 |
!!PB test |
!!PB test |
1358 |
!!$ if (nisurf == is_oce) then |
!!$ if (nisurf == is_oce) then |
1359 |
!!$ snow = 0. |
!!$ snow = 0. |
1366 |
!!$ endif |
!!$ endif |
1367 |
!!$ IF (nisurf /= is_ter) qsol = max_eau_sol |
!!$ IF (nisurf /= is_ter) qsol = max_eau_sol |
1368 |
|
|
1369 |
! |
|
1370 |
! Initialisation |
! Initialisation |
1371 |
! |
|
1372 |
evap = 0. |
evap = 0. |
1373 |
fluxsens=0. |
fluxsens=0. |
1374 |
fluxlat=0. |
fluxlat=0. |
1375 |
dflux_s = 0. |
dflux_s = 0. |
1376 |
dflux_l = 0. |
dflux_l = 0. |
1377 |
! |
|
1378 |
! zx_qs = qsat en kg/kg |
! zx_qs = qsat en kg/kg |
1379 |
! |
|
1380 |
DO i = 1, knon |
DO i = 1, knon |
1381 |
zx_pkh(i) = (ps(i)/ps(i))**RKAPPA |
zx_pkh(i) = (ps(i)/ps(i))**RKAPPA |
1382 |
IF (thermcep) THEN |
IF (thermcep) THEN |
1383 |
zdelta=MAX(0.,SIGN(1.,rtt-tsurf(i))) |
zdelta=MAX(0., SIGN(1., rtt-tsurf(i))) |
1384 |
zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta |
zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta |
1385 |
zcvm5 = zcvm5 / RCPD / (1.0+RVTMP2*q1lay(i)) |
zcvm5 = zcvm5 / RCPD / (1.0+RVTMP2*q1lay(i)) |
1386 |
zx_qs= r2es * FOEEW(tsurf(i),zdelta)/ps(i) |
zx_qs= r2es * FOEEW(tsurf(i), zdelta)/ps(i) |
1387 |
zx_qs=MIN(0.5,zx_qs) |
zx_qs=MIN(0.5, zx_qs) |
1388 |
zcor=1./(1.-retv*zx_qs) |
zcor=1./(1.-retv*zx_qs) |
1389 |
zx_qs=zx_qs*zcor |
zx_qs=zx_qs*zcor |
1390 |
zx_dq_s_dh = FOEDE(tsurf(i),zdelta,zcvm5,zx_qs,zcor) & |
zx_dq_s_dh = FOEDE(tsurf(i), zdelta, zcvm5, zx_qs, zcor) & |
1391 |
& /RLVTT / zx_pkh(i) |
& /RLVTT / zx_pkh(i) |
1392 |
ELSE |
ELSE |
1393 |
IF (tsurf(i).LT.t_coup) THEN |
IF (tsurf(i).LT.t_coup) THEN |
1394 |
zx_qs = qsats(tsurf(i)) / ps(i) |
zx_qs = qsats(tsurf(i)) / ps(i) |
1395 |
zx_dq_s_dh = dqsats(tsurf(i),zx_qs)/RLVTT & |
zx_dq_s_dh = dqsats(tsurf(i), zx_qs)/RLVTT & |
1396 |
& / zx_pkh(i) |
& / zx_pkh(i) |
1397 |
ELSE |
ELSE |
1398 |
zx_qs = qsatl(tsurf(i)) / ps(i) |
zx_qs = qsatl(tsurf(i)) / ps(i) |
1399 |
zx_dq_s_dh = dqsatl(tsurf(i),zx_qs)/RLVTT & |
zx_dq_s_dh = dqsatl(tsurf(i), zx_qs)/RLVTT & |
1400 |
& / zx_pkh(i) |
& / zx_pkh(i) |
1401 |
ENDIF |
ENDIF |
1402 |
ENDIF |
ENDIF |
1409 |
ENDDO |
ENDDO |
1410 |
|
|
1411 |
! === Calcul de la temperature de surface === |
! === Calcul de la temperature de surface === |
1412 |
! |
|
1413 |
! zx_sl = chaleur latente d'evaporation ou de sublimation |
! zx_sl = chaleur latente d'evaporation ou de sublimation |
1414 |
! |
|
1415 |
do i = 1, knon |
do i = 1, knon |
1416 |
zx_sl(i) = RLVTT |
zx_sl(i) = RLVTT |
1417 |
if (tsurf(i) .LT. RTT) zx_sl(i) = RLSTT |
if (tsurf(i) .LT. RTT) zx_sl(i) = RLSTT |
1441 |
& zx_nh(i) + zx_sl(i) * zx_nq(i)) & |
& zx_nh(i) + zx_sl(i) * zx_nq(i)) & |
1442 |
& + dtime * dif_grnd(i)) |
& + dtime * dif_grnd(i)) |
1443 |
|
|
1444 |
! |
|
1445 |
! Y'a-t-il fonte de neige? |
! Y'a-t-il fonte de neige? |
1446 |
! |
|
1447 |
! fonte_neige = (nisurf /= is_oce) .AND. & |
! fonte_neige = (nisurf /= is_oce) .AND. & |
1448 |
! & (snow(i) > epsfra .OR. nisurf == is_sic .OR. nisurf == is_lic) & |
! & (snow(i) > epsfra .OR. nisurf == is_sic .OR. nisurf == is_lic) & |
1449 |
! & .AND. (tsurf_new(i) >= RTT) |
! & .AND. (tsurf_new(i) >= RTT) |
1475 |
& radsol, dif_grnd, t1lay, q1lay, u1lay, v1lay, & |
& radsol, dif_grnd, t1lay, q1lay, u1lay, v1lay, & |
1476 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
1477 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
1478 |
& fqcalving,ffonte,run_off_lic_0) |
& fqcalving, ffonte, run_off_lic_0) |
1479 |
|
|
1480 |
! Routine de traitement de la fonte de la neige dans le cas du traitement |
! Routine de traitement de la fonte de la neige dans le cas du traitement |
1481 |
! de sol simplifié |
! de sol simplifié |
1482 |
! |
|
1483 |
! LF 03/2001 |
! LF 03/2001 |
1484 |
! input: |
! input: |
1485 |
! knon nombre de points a traiter |
! knon nombre de points a traiter |
1501 |
! peqBcoef coeff. B de la resolution de la CL pour q |
! peqBcoef coeff. B de la resolution de la CL pour q |
1502 |
! radsol rayonnement net aus sol (LW + SW) |
! radsol rayonnement net aus sol (LW + SW) |
1503 |
! dif_grnd coeff. diffusion vers le sol profond |
! dif_grnd coeff. diffusion vers le sol profond |
1504 |
! |
|
1505 |
! output: |
! output: |
1506 |
! tsurf_new temperature au sol |
! tsurf_new temperature au sol |
1507 |
! fluxsens flux de chaleur sensible |
! fluxsens flux de chaleur sensible |
1510 |
! dflux_l derivee du flux de chaleur latente / Ts |
! dflux_l derivee du flux de chaleur latente / Ts |
1511 |
! in/out: |
! in/out: |
1512 |
! run_off_lic_0 run off glacier du pas de temps précedent |
! run_off_lic_0 run off glacier du pas de temps précedent |
1513 |
! |
|
1514 |
|
|
1515 |
use indicesol |
use indicesol |
1516 |
use YOMCST |
use YOMCST |
1562 |
!IM cf JLD/ GKtest |
!IM cf JLD/ GKtest |
1563 |
REAL, parameter :: chaice = 3.334E+05/(2.3867E+06*0.15) |
REAL, parameter :: chaice = 3.334E+05/(2.3867E+06*0.15) |
1564 |
! fin GKtest |
! fin GKtest |
1565 |
! |
|
1566 |
logical, save :: check = .FALSE. |
logical, save :: check = .FALSE. |
1567 |
character (len = 20) :: modname = 'fonte_neige' |
character (len = 20) :: modname = 'fonte_neige' |
1568 |
logical, save :: neige_fond = .false. |
logical, save :: neige_fond = .false. |
1569 |
real, save :: max_eau_sol = 150.0 |
real, save :: max_eau_sol = 150.0 |
1570 |
character (len = 80) :: abort_message |
character (len = 80) :: abort_message |
1571 |
logical,save :: first = .true.,second=.false. |
logical, save :: first = .true., second=.false. |
1572 |
real :: coeff_rel |
real :: coeff_rel |
1573 |
|
|
1574 |
if (check) write(*,*)'Entree ', modname,' surface = ',nisurf |
if (check) write(*, *)'Entree ', modname, ' surface = ', nisurf |
1575 |
|
|
1576 |
! Initialisations |
! Initialisations |
1577 |
coeff_rel = dtime/(tau_calv * rday) |
coeff_rel = dtime/(tau_calv * rday) |
1578 |
bil_eau_s(:) = 0. |
bil_eau_s = 0. |
1579 |
DO i = 1, knon |
DO i = 1, knon |
1580 |
zx_pkh(i) = (ps(i)/ps(i))**RKAPPA |
zx_pkh(i) = (ps(i)/ps(i))**RKAPPA |
1581 |
IF (thermcep) THEN |
IF (thermcep) THEN |
1582 |
zdelta=MAX(0.,SIGN(1.,rtt-tsurf(i))) |
zdelta=MAX(0., SIGN(1., rtt-tsurf(i))) |
1583 |
zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta |
zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta |
1584 |
zcvm5 = zcvm5 / RCPD / (1.0+RVTMP2*q1lay(i)) |
zcvm5 = zcvm5 / RCPD / (1.0+RVTMP2*q1lay(i)) |
1585 |
zx_qs= r2es * FOEEW(tsurf(i),zdelta)/ps(i) |
zx_qs= r2es * FOEEW(tsurf(i), zdelta)/ps(i) |
1586 |
zx_qs=MIN(0.5,zx_qs) |
zx_qs=MIN(0.5, zx_qs) |
1587 |
zcor=1./(1.-retv*zx_qs) |
zcor=1./(1.-retv*zx_qs) |
1588 |
zx_qs=zx_qs*zcor |
zx_qs=zx_qs*zcor |
1589 |
zx_dq_s_dh = FOEDE(tsurf(i),zdelta,zcvm5,zx_qs,zcor) & |
zx_dq_s_dh = FOEDE(tsurf(i), zdelta, zcvm5, zx_qs, zcor) & |
1590 |
& /RLVTT / zx_pkh(i) |
& /RLVTT / zx_pkh(i) |
1591 |
ELSE |
ELSE |
1592 |
IF (tsurf(i).LT.t_coup) THEN |
IF (tsurf(i).LT.t_coup) THEN |
1593 |
zx_qs = qsats(tsurf(i)) / ps(i) |
zx_qs = qsats(tsurf(i)) / ps(i) |
1594 |
zx_dq_s_dh = dqsats(tsurf(i),zx_qs)/RLVTT & |
zx_dq_s_dh = dqsats(tsurf(i), zx_qs)/RLVTT & |
1595 |
& / zx_pkh(i) |
& / zx_pkh(i) |
1596 |
ELSE |
ELSE |
1597 |
zx_qs = qsatl(tsurf(i)) / ps(i) |
zx_qs = qsatl(tsurf(i)) / ps(i) |
1598 |
zx_dq_s_dh = dqsatl(tsurf(i),zx_qs)/RLVTT & |
zx_dq_s_dh = dqsatl(tsurf(i), zx_qs)/RLVTT & |
1599 |
& / zx_pkh(i) |
& / zx_pkh(i) |
1600 |
ENDIF |
ENDIF |
1601 |
ENDIF |
ENDIF |
1607 |
ENDDO |
ENDDO |
1608 |
|
|
1609 |
! === Calcul de la temperature de surface === |
! === Calcul de la temperature de surface === |
1610 |
! |
|
1611 |
! zx_sl = chaleur latente d'evaporation ou de sublimation |
! zx_sl = chaleur latente d'evaporation ou de sublimation |
1612 |
! |
|
1613 |
do i = 1, knon |
do i = 1, knon |
1614 |
zx_sl(i) = RLVTT |
zx_sl(i) = RLVTT |
1615 |
if (tsurf(i) .LT. RTT) zx_sl(i) = RLSTT |
if (tsurf(i) .LT. RTT) zx_sl(i) = RLSTT |
1643 |
! bil_eau_s = bil_eau_s + (precip_rain * dtime) - (evap - snow_evap) * dtime |
! bil_eau_s = bil_eau_s + (precip_rain * dtime) - (evap - snow_evap) * dtime |
1644 |
bil_eau_s = (precip_rain * dtime) - (evap - snow_evap) * dtime |
bil_eau_s = (precip_rain * dtime) - (evap - snow_evap) * dtime |
1645 |
|
|
1646 |
! |
|
1647 |
! Y'a-t-il fonte de neige? |
! Y'a-t-il fonte de neige? |
1648 |
! |
|
1649 |
ffonte=0. |
ffonte=0. |
1650 |
do i = 1, knon |
do i = 1, knon |
1651 |
neige_fond = ((snow(i) > epsfra .OR. nisurf == is_sic .OR. nisurf == is_lic) & |
neige_fond = ((snow(i) > epsfra .OR. nisurf == is_sic .OR. nisurf == is_lic) & |
1652 |
& .AND. tsurf_new(i) >= RTT) |
& .AND. tsurf_new(i) >= RTT) |
1653 |
if (neige_fond) then |
if (neige_fond) then |
1654 |
fq_fonte = MIN( MAX((tsurf_new(i)-RTT )/chasno,0.0),snow(i)) |
fq_fonte = MIN( MAX((tsurf_new(i)-RTT )/chasno, 0.0), snow(i)) |
1655 |
ffonte(i) = fq_fonte * RLMLT/dtime |
ffonte(i) = fq_fonte * RLMLT/dtime |
1656 |
snow(i) = max(0., snow(i) - fq_fonte) |
snow(i) = max(0., snow(i) - fq_fonte) |
1657 |
bil_eau_s(i) = bil_eau_s(i) + fq_fonte |
bil_eau_s(i) = bil_eau_s(i) + fq_fonte |
1659 |
!IM cf JLD OK |
!IM cf JLD OK |
1660 |
!IM cf JLD/ GKtest fonte aussi pour la glace |
!IM cf JLD/ GKtest fonte aussi pour la glace |
1661 |
IF (nisurf == is_sic .OR. nisurf == is_lic ) THEN |
IF (nisurf == is_sic .OR. nisurf == is_lic ) THEN |
1662 |
fq_fonte = MAX((tsurf_new(i)-RTT )/chaice,0.0) |
fq_fonte = MAX((tsurf_new(i)-RTT )/chaice, 0.0) |
1663 |
ffonte(i) = ffonte(i) + fq_fonte * RLMLT/dtime |
ffonte(i) = ffonte(i) + fq_fonte * RLMLT/dtime |
1664 |
bil_eau_s(i) = bil_eau_s(i) + fq_fonte |
bil_eau_s(i) = bil_eau_s(i) + fq_fonte |
1665 |
tsurf_new(i) = RTT |
tsurf_new(i) = RTT |
1666 |
ENDIF |
ENDIF |
1667 |
d_ts(i) = tsurf_new(i) - tsurf(i) |
d_ts(i) = tsurf_new(i) - tsurf(i) |
1668 |
endif |
endif |
1669 |
! |
|
1670 |
! s'il y a une hauteur trop importante de neige, elle s'coule |
! s'il y a une hauteur trop importante de neige, elle s'coule |
1671 |
fqcalving(i) = max(0., snow(i) - snow_max)/dtime |
fqcalving(i) = max(0., snow(i) - snow_max)/dtime |
1672 |
snow(i)=min(snow(i),snow_max) |
snow(i)=min(snow(i), snow_max) |
1673 |
! |
|
1674 |
IF (nisurf == is_ter) then |
IF (nisurf == is_ter) then |
1675 |
qsol(i) = qsol(i) + bil_eau_s(i) |
qsol(i) = qsol(i) + bil_eau_s(i) |
1676 |
run_off(i) = run_off(i) + MAX(qsol(i) - max_eau_sol, 0.0) |
run_off(i) = run_off(i) + MAX(qsol(i) - max_eau_sol, 0.0) |