43 INTEGER,
SAVE :: nexca
47 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_sols, cpl_nsol, cpl_rain
49 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_snow, cpl_evap, cpl_tsol
51 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_fder, cpl_albe, cpl_taux, cpl_tauy
53 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_windsp
55 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_taumod
57 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_atm_co2
59 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_rriv2D, cpl_rcoa2D, cpl_rlic2D
63 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: read_sst
65 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: read_sit
67 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: read_sic
69 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: read_alb_sic
71 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: read_u0, read_v0
73 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: read_co2
75 INTEGER,
ALLOCATABLE,
DIMENSION(:),
SAVE :: unity
77 INTEGER,
SAVE :: nidct, nidcs
81 REAL,
ALLOCATABLE,
DIMENSION(:,:,:),
SAVE :: cpl_sols2D, cpl_nsol2D, cpl_rain2D
83 REAL,
ALLOCATABLE,
DIMENSION(:,:,:),
SAVE :: cpl_snow2D, cpl_evap2D, cpl_tsol2D
85 REAL,
ALLOCATABLE,
DIMENSION(:,:,:),
SAVE :: cpl_fder2D, cpl_albe2D
87 REAL,
ALLOCATABLE,
DIMENSION(:,:,:),
SAVE :: cpl_taux2D, cpl_tauy2D
89 REAL,
ALLOCATABLE,
DIMENSION(:,:,:),
SAVE :: cpl_taumod2D
91 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_windsp2D
93 REAL,
ALLOCATABLE,
DIMENSION(:,:),
SAVE :: cpl_atm_co22D
104 include
"dimensions.h"
105 include
"indicesol.h"
111 REAL,
INTENT(IN) ::
dtime
112 REAL,
DIMENSION(klon),
INTENT(IN) ::
rlon,
rlat
116 INTEGER :: error, sum_error, ig,
i
117 INTEGER :: jf, nhoridct
124 CHARACTER(len = 20) :: modname =
'cpl_init'
125 CHARACTER(len = 80) :: abort_message
126 CHARACTER(len=80) :: clintocplnam, clfromcplnam
134 nexca = 86400 /
dtime
135 WRITE(
lunout,*)
' ##### Ocean couple #####'
136 WRITE(
lunout,*)
' Valeurs des pas de temps'
137 WRITE(
lunout,*)
' npas = ', npas
138 WRITE(
lunout,*)
' nexca = ', nexca
147 ALLOCATE(unity(klon), stat = error)
148 sum_error = sum_error + error
149 ALLOCATE(cpl_sols(klon,2), stat = error)
150 sum_error = sum_error + error
151 ALLOCATE(cpl_nsol(klon,2), stat = error)
152 sum_error = sum_error + error
153 ALLOCATE(cpl_rain(klon,2), stat = error)
154 sum_error = sum_error + error
155 ALLOCATE(cpl_snow(klon,2), stat = error)
156 sum_error = sum_error + error
157 ALLOCATE(cpl_evap(klon,2), stat = error)
158 sum_error = sum_error + error
159 ALLOCATE(cpl_tsol(klon,2), stat = error)
160 sum_error = sum_error + error
161 ALLOCATE(cpl_fder(klon,2), stat = error)
162 sum_error = sum_error + error
163 ALLOCATE(cpl_albe(klon,2), stat = error)
164 sum_error = sum_error + error
165 ALLOCATE(cpl_taux(klon,2), stat = error)
166 sum_error = sum_error + error
167 ALLOCATE(cpl_tauy(klon,2), stat = error)
168 sum_error = sum_error + error
169 ALLOCATE(cpl_windsp(klon,2), stat = error)
170 sum_error = sum_error + error
171 ALLOCATE(cpl_taumod(klon,2), stat = error)
172 sum_error = sum_error + error
173 ALLOCATE(cpl_rriv2d(
iim,
jj_nb), stat=error)
174 sum_error = sum_error + error
175 ALLOCATE(cpl_rcoa2d(
iim,
jj_nb), stat=error)
176 sum_error = sum_error + error
177 ALLOCATE(cpl_rlic2d(
iim,
jj_nb), stat=error)
178 sum_error = sum_error + error
179 ALLOCATE(read_sst(
iim,
jj_nb), stat = error)
180 sum_error = sum_error + error
181 ALLOCATE(read_sic(
iim,
jj_nb), stat = error)
182 sum_error = sum_error + error
183 ALLOCATE(read_sit(
iim,
jj_nb), stat = error)
184 sum_error = sum_error + error
185 ALLOCATE(read_alb_sic(
iim,
jj_nb), stat = error)
186 sum_error = sum_error + error
187 ALLOCATE(read_u0(
iim,
jj_nb), stat = error)
188 sum_error = sum_error + error
189 ALLOCATE(read_v0(
iim,
jj_nb), stat = error)
190 sum_error = sum_error + error
192 IF (carbon_cycle_cpl)
THEN
193 ALLOCATE(read_co2(
iim,
jj_nb), stat = error)
194 sum_error = sum_error + error
195 ALLOCATE(cpl_atm_co2(klon,2), stat = error)
196 sum_error = sum_error + error
199 ALLOCATE(fco2_ocn_day(klon), stat = error)
200 sum_error = sum_error + error
203 IF (sum_error /= 0)
THEN
204 abort_message=
'Pb allocation variables couplees'
228 IF (is_sequential)
THEN
237 clintocplnam=
"cpl_atm_tauflx"
241 CALL
histdef(nidct,
'tauxe',
'tauxe', &
242 "-",
iim, jjm+1, nhoridct, 1, 1, 1, -99, 32,
"inst",
dtime,
dtime)
243 CALL
histdef(nidct,
'tauyn',
'tauyn', &
244 "-",
iim, jjm+1, nhoridct, 1, 1, 1, -99, 32,
"inst",
dtime,
dtime)
245 CALL
histdef(nidct,
'tmp_lon',
'tmp_lon', &
246 "-",
iim, jjm+1, nhoridct, 1, 1, 1, -99, 32,
"inst",
dtime,
dtime)
247 CALL
histdef(nidct,
'tmp_lat',
'tmp_lat', &
248 "-",
iim, jjm+1, nhoridct, 1, 1, 1, -99, 32,
"inst",
dtime,
dtime)
250 IF (infosend(
i)%action)
THEN
251 CALL
histdef(nidct, infosend(
i)%name ,infosend(
i)%name , &
252 "-",
iim, jjm+1, nhoridct, 1, 1, 1, -99, 32,
"inst",
dtime,
dtime)
258 clfromcplnam=
"cpl_atm_sst"
259 CALL
histbeg(clfromcplnam,
iim,
zx_lon(:,1),jjm+1,
zx_lat(1,:),1,
iim,1,jjm+1, &
263 IF (inforecv(
i)%action)
THEN
264 CALL
histdef(nidcs,inforecv(
i)%name ,inforecv(
i)%name , &
265 "-",
iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32,
"inst",
dtime,
dtime)
278 IF (carbon_cycle_cpl .AND. version_ocean==
'opa8')
THEN
279 abort_message=
'carbon_cycle_cpl does not work with opa8'
298 include
"indicesol.h"
302 include
"dimensions.h"
306 INTEGER,
INTENT(IN) ::
itime
307 REAL,
INTENT(IN) ::
dtime
308 REAL,
DIMENSION(klon,nbsrf),
INTENT(INOUT) :: pctsrf
309 LOGICAL,
INTENT(OUT) :: is_modified
313 INTEGER ::
j,
i, time_sec
315 INTEGER,
DIMENSION(iim*(jjm+1)) :: ndexcs
316 CHARACTER(len = 20) :: modname =
'cpl_receive_frac'
317 CHARACTER(len = 80) :: abort_message
318 REAL,
DIMENSION(klon) :: read_sic1d
319 REAL,
DIMENSION(iim,jj_nb,maxrecv) :: tab_read_flds
320 REAL,
DIMENSION(klon,nbsrf) :: pctsrf_old
321 REAL,
DIMENSION(klon_mpi) :: rlon_mpi, rlat_mpi
322 REAL,
DIMENSION(iim, jj_nb) :: tmp_lon, tmp_lat
323 REAL,
DIMENSION(iim, jj_nb) :: tmp_r0
334 IF (mod(
itime, nexca) == 1)
THEN
340 CALL fromcpl(time_sec, tab_read_flds)
345 IF (is_sequential)
THEN
349 IF (inforecv(
i)%action)
THEN
350 CALL histwrite(nidcs,inforecv(
i)%name,
itau_w,tab_read_flds(:,:,
i),
iim*(jjm+1),ndexcs)
358 read_sst(:,:) = tab_read_flds(:,:,idr_sisutw)
359 read_sic(:,:) = tab_read_flds(:,:,idr_icecov)
360 read_alb_sic(:,:) = tab_read_flds(:,:,idr_icealw)
361 read_sit(:,:) = tab_read_flds(:,:,idr_icetem)
364 IF (cpl_current)
THEN
367 CALL gather_omp(
rlon,rlon_mpi)
368 CALL gather_omp(
rlat,rlat_mpi)
370 CALL grid1dto2d_mpi(rlon_mpi,tmp_lon)
371 CALL grid1dto2d_mpi(rlat_mpi,tmp_lat)
376 tab_read_flds(:,:,idr_cureny), tab_read_flds(:,:,idr_curenz), &
378 read_u0(:,:), read_v0(:,:), tmp_r0(:,:))
386 IF (carbon_cycle_cpl)
THEN
388 read_co2(:,:) = tab_read_flds(:,:,idr_oceco2)
397 CALL
cpl2gath(read_sic, read_sic1d, klon, unity)
399 pctsrf_old(:,:) = pctsrf(:,:)
403 IF (pctsrf_old(
i,is_oce) + pctsrf_old(
i,is_sic) > 0.)
THEN
404 pctsrf(
i,is_sic) = (pctsrf_old(
i,is_oce) + pctsrf_old(
i,is_sic)) &
406 pctsrf(
i,is_oce) = (pctsrf_old(
i,is_oce) + pctsrf_old(
i,is_sic)) &
426 include
"indicesol.h"
430 INTEGER,
INTENT(IN) :: knon
431 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
435 REAL,
DIMENSION(klon),
INTENT(OUT) :: tsurf_new
436 REAL,
DIMENSION(klon),
INTENT(OUT) :: u0_new
437 REAL,
DIMENSION(klon),
INTENT(OUT) :: v0_new
442 INTEGER,
DIMENSION(klon) :: index
443 REAL,
DIMENSION(klon) :: sic_new
449 CALL
cpl2gath(read_sst, tsurf_new, knon, knindex)
450 CALL
cpl2gath(read_sic, sic_new, knon, knindex)
451 CALL
cpl2gath(read_u0, u0_new, knon, knindex)
452 CALL
cpl2gath(read_v0, v0_new, knon, knindex)
459 IF (carbon_cycle_cpl)
THEN
463 CALL
cpl2gath(read_co2, fco2_ocn_day, klon, index)
472 tsurf_new(
i) = tsurf_new(
i)/(1. - sic_new(
i))
482 tsurf_new, alb_new, u0_new, v0_new)
492 INTEGER,
INTENT(IN) :: knon
493 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
497 REAL,
DIMENSION(klon),
INTENT(OUT) :: tsurf_new
498 REAL,
DIMENSION(klon),
INTENT(OUT) :: alb_new
499 REAL,
DIMENSION(klon),
INTENT(OUT) :: u0_new
500 REAL,
DIMENSION(klon),
INTENT(OUT) :: v0_new
505 REAL,
DIMENSION(klon) :: sic_new
511 CALL
cpl2gath(read_sit, tsurf_new, knon, knindex)
512 CALL
cpl2gath(read_alb_sic, alb_new, knon, knindex)
513 CALL
cpl2gath(read_sic, sic_new, knon, knindex)
514 CALL
cpl2gath(read_u0, u0_new, knon, knindex)
515 CALL
cpl2gath(read_v0, v0_new, knon, knindex)
523 tsurf_new(
i) = tsurf_new(
i) / sic_new(
i)
524 alb_new(
i) = alb_new(
i) / sic_new(
i)
534 swdown, lwdown, fluxlat, fluxsens, &
535 precip_rain, precip_snow, evap,
tsurf, fder, albsol,
taux, tauy, windsp)
543 include
"indicesol.h"
544 include
"dimensions.h"
548 INTEGER,
INTENT(IN) ::
itime
549 INTEGER,
INTENT(IN) :: knon
550 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
551 REAL,
DIMENSION(klon),
INTENT(IN) :: swdown, lwdown
552 REAL,
DIMENSION(klon),
INTENT(IN) :: fluxlat, fluxsens
553 REAL,
DIMENSION(klon),
INTENT(IN) :: precip_rain, precip_snow
554 REAL,
DIMENSION(klon),
INTENT(IN) :: evap,
tsurf, fder, albsol
555 REAL,
DIMENSION(klon),
INTENT(IN) ::
taux, tauy, windsp
559 INTEGER :: cpl_index, ig
560 INTEGER :: error, sum_error
561 CHARACTER(len = 25) :: modname =
'cpl_send_ocean_fields'
562 CHARACTER(len = 80) :: abort_message
575 IF (mod(
itime, nexca) == 1)
THEN
576 cpl_sols(1:knon,cpl_index) = 0.0
577 cpl_nsol(1:knon,cpl_index) = 0.0
578 cpl_rain(1:knon,cpl_index) = 0.0
579 cpl_snow(1:knon,cpl_index) = 0.0
580 cpl_evap(1:knon,cpl_index) = 0.0
581 cpl_tsol(1:knon,cpl_index) = 0.0
582 cpl_fder(1:knon,cpl_index) = 0.0
583 cpl_albe(1:knon,cpl_index) = 0.0
584 cpl_taux(1:knon,cpl_index) = 0.0
585 cpl_tauy(1:knon,cpl_index) = 0.0
586 cpl_windsp(1:knon,cpl_index) = 0.0
587 cpl_taumod(1:knon,cpl_index) = 0.0
588 IF (carbon_cycle_cpl) cpl_atm_co2(1:knon,cpl_index) = 0.0
596 cpl_sols(ig,cpl_index) = cpl_sols(ig,cpl_index) + &
597 swdown(ig) /
REAL(nexca)
598 cpl_nsol(ig,cpl_index) = cpl_nsol(ig,cpl_index) + &
599 (lwdown(ig) + fluxlat(ig) +fluxsens(ig)) /
REAL(nexca)
600 cpl_rain(ig,cpl_index) = cpl_rain(ig,cpl_index) + &
601 precip_rain(ig) /
REAL(nexca)
602 cpl_snow(ig,cpl_index) = cpl_snow(ig,cpl_index) + &
603 precip_snow(ig) /
REAL(nexca)
604 cpl_evap(ig,cpl_index) = cpl_evap(ig,cpl_index) + &
605 evap(ig) /
REAL(nexca)
606 cpl_tsol(ig,cpl_index) = cpl_tsol(ig,cpl_index) + &
607 tsurf(ig) /
REAL(nexca)
608 cpl_fder(ig,cpl_index) = cpl_fder(ig,cpl_index) + &
609 fder(ig) /
REAL(nexca)
610 cpl_albe(ig,cpl_index) = cpl_albe(ig,cpl_index) + &
611 albsol(ig) /
REAL(nexca)
612 cpl_taux(ig,cpl_index) = cpl_taux(ig,cpl_index) + &
613 taux(ig) /
REAL(nexca)
614 cpl_tauy(ig,cpl_index) = cpl_tauy(ig,cpl_index) + &
615 tauy(ig) /
REAL(nexca)
616 cpl_windsp(ig,cpl_index) = cpl_windsp(ig,cpl_index) + &
617 windsp(ig) /
REAL(nexca)
618 cpl_taumod(ig,cpl_index) = cpl_taumod(ig,cpl_index) + &
619 sqrt(
taux(ig)*
taux(ig)+tauy(ig)*tauy(ig) ) /
real(nexca)
621 IF (carbon_cycle_cpl)
THEN
622 cpl_atm_co2(ig,cpl_index) = cpl_atm_co2(ig,cpl_index) + &
623 co2_send(knindex(ig))/
REAL(nexca)
633 IF (mod(
itime, nexca) == 0)
THEN
635 IF (.NOT.
ALLOCATED(cpl_sols2d))
THEN
637 ALLOCATE(cpl_sols2d(
iim,
jj_nb,2), stat=error)
638 sum_error = sum_error + error
639 ALLOCATE(cpl_nsol2d(
iim,
jj_nb,2), stat=error)
640 sum_error = sum_error + error
641 ALLOCATE(cpl_rain2d(
iim,
jj_nb,2), stat=error)
642 sum_error = sum_error + error
643 ALLOCATE(cpl_snow2d(
iim,
jj_nb,2), stat=error)
644 sum_error = sum_error + error
645 ALLOCATE(cpl_evap2d(
iim,
jj_nb,2), stat=error)
646 sum_error = sum_error + error
647 ALLOCATE(cpl_tsol2d(
iim,
jj_nb,2), stat=error)
648 sum_error = sum_error + error
649 ALLOCATE(cpl_fder2d(
iim,
jj_nb,2), stat=error)
650 sum_error = sum_error + error
651 ALLOCATE(cpl_albe2d(
iim,
jj_nb,2), stat=error)
652 sum_error = sum_error + error
653 ALLOCATE(cpl_taux2d(
iim,
jj_nb,2), stat=error)
654 sum_error = sum_error + error
655 ALLOCATE(cpl_tauy2d(
iim,
jj_nb,2), stat=error)
656 sum_error = sum_error + error
657 ALLOCATE(cpl_windsp2d(
iim,
jj_nb), stat=error)
658 sum_error = sum_error + error
659 ALLOCATE(cpl_taumod2d(
iim,
jj_nb,2), stat=error)
660 sum_error = sum_error + error
662 IF (carbon_cycle_cpl)
THEN
663 ALLOCATE(cpl_atm_co22d(
iim,
jj_nb), stat=error)
664 sum_error = sum_error + error
667 IF (sum_error /= 0)
THEN
668 abort_message=
'Pb allocation variables couplees pour l''ecriture'
674 CALL
gath2cpl(cpl_sols(:,cpl_index), cpl_sols2d(:,:,cpl_index), &
677 CALL
gath2cpl(cpl_nsol(:,cpl_index), cpl_nsol2d(:,:,cpl_index), &
680 CALL
gath2cpl(cpl_rain(:,cpl_index), cpl_rain2d(:,:,cpl_index), &
683 CALL
gath2cpl(cpl_snow(:,cpl_index), cpl_snow2d(:,:,cpl_index), &
686 CALL
gath2cpl(cpl_evap(:,cpl_index), cpl_evap2d(:,:,cpl_index), &
690 CALL
gath2cpl(cpl_tsol(:,cpl_index), cpl_tsol2d(:,:, cpl_index), &
694 CALL
gath2cpl(cpl_fder(:,cpl_index), cpl_fder2d(:,:,cpl_index), &
698 CALL
gath2cpl(cpl_albe(:,cpl_index), cpl_albe2d(:,:,cpl_index), &
701 CALL
gath2cpl(cpl_taux(:,cpl_index), cpl_taux2d(:,:,cpl_index), &
704 CALL
gath2cpl(cpl_tauy(:,cpl_index), cpl_tauy2d(:,:,cpl_index), &
707 CALL
gath2cpl(cpl_windsp(:,cpl_index), cpl_windsp2d(:,:), &
710 CALL
gath2cpl(cpl_taumod(:,cpl_index), cpl_taumod2d(:,:,cpl_index), &
713 IF (carbon_cycle_cpl) &
714 CALL
gath2cpl(cpl_atm_co2(:,cpl_index), cpl_atm_co22d(:,:), knon, knindex)
725 swdown, lwdown, fluxlat, fluxsens, &
726 precip_rain, precip_snow, evap,
tsurf, fder, albsol,
taux, tauy)
734 include
"indicesol.h"
735 include
"dimensions.h"
739 INTEGER,
INTENT(IN) ::
itime
740 INTEGER,
INTENT(IN) :: knon
741 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
742 REAL,
INTENT(IN) ::
dtime
743 REAL,
DIMENSION(klon),
INTENT(IN) ::
rlon,
rlat
744 REAL,
DIMENSION(klon),
INTENT(IN) :: swdown, lwdown
745 REAL,
DIMENSION(klon),
INTENT(IN) :: fluxlat, fluxsens
746 REAL,
DIMENSION(klon),
INTENT(IN) :: precip_rain, precip_snow
747 REAL,
DIMENSION(klon),
INTENT(IN) :: evap,
tsurf, fder
748 REAL,
DIMENSION(klon),
INTENT(IN) :: albsol,
taux, tauy
749 REAL,
DIMENSION(klon,nbsrf),
INTENT(IN) :: pctsrf
750 LOGICAL,
INTENT(IN) :: lafin
754 INTEGER :: cpl_index, ig
755 INTEGER :: error, sum_error
756 CHARACTER(len = 25) :: modname =
'cpl_send_seaice_fields'
757 CHARACTER(len = 80) :: abort_message
758 REAL,
DIMENSION(klon) :: cpl_fder_tmp
771 IF (mod(
itime, nexca) == 1)
THEN
772 cpl_sols(1:knon,cpl_index) = 0.0
773 cpl_nsol(1:knon,cpl_index) = 0.0
774 cpl_rain(1:knon,cpl_index) = 0.0
775 cpl_snow(1:knon,cpl_index) = 0.0
776 cpl_evap(1:knon,cpl_index) = 0.0
777 cpl_tsol(1:knon,cpl_index) = 0.0
778 cpl_fder(1:knon,cpl_index) = 0.0
779 cpl_albe(1:knon,cpl_index) = 0.0
780 cpl_taux(1:knon,cpl_index) = 0.0
781 cpl_tauy(1:knon,cpl_index) = 0.0
782 cpl_taumod(1:knon,cpl_index) = 0.0
790 cpl_sols(ig,cpl_index) = cpl_sols(ig,cpl_index) + &
791 swdown(ig) /
REAL(nexca)
792 cpl_nsol(ig,cpl_index) = cpl_nsol(ig,cpl_index) + &
793 (lwdown(ig) + fluxlat(ig) +fluxsens(ig)) /
REAL(nexca)
794 cpl_rain(ig,cpl_index) = cpl_rain(ig,cpl_index) + &
795 precip_rain(ig) /
REAL(nexca)
796 cpl_snow(ig,cpl_index) = cpl_snow(ig,cpl_index) + &
797 precip_snow(ig) /
REAL(nexca)
798 cpl_evap(ig,cpl_index) = cpl_evap(ig,cpl_index) + &
799 evap(ig) /
REAL(nexca)
800 cpl_tsol(ig,cpl_index) = cpl_tsol(ig,cpl_index) + &
801 tsurf(ig) /
REAL(nexca)
802 cpl_fder(ig,cpl_index) = cpl_fder(ig,cpl_index) + &
803 fder(ig) /
REAL(nexca)
804 cpl_albe(ig,cpl_index) = cpl_albe(ig,cpl_index) + &
805 albsol(ig) /
REAL(nexca)
806 cpl_taux(ig,cpl_index) = cpl_taux(ig,cpl_index) + &
807 taux(ig) /
REAL(nexca)
808 cpl_tauy(ig,cpl_index) = cpl_tauy(ig,cpl_index) + &
809 tauy(ig) /
REAL(nexca)
810 cpl_taumod(ig,cpl_index) = cpl_taumod(ig,cpl_index) + &
811 sqrt(
taux(ig)*
taux(ig)+tauy(ig)*tauy(ig) ) /
REAL(nexca)
819 IF (mod(
itime, nexca) == 0)
THEN
820 IF (.NOT.
ALLOCATED(cpl_sols2d))
THEN
822 ALLOCATE(cpl_sols2d(
iim,
jj_nb,2), stat=error)
823 sum_error = sum_error + error
824 ALLOCATE(cpl_nsol2d(
iim,
jj_nb,2), stat=error)
825 sum_error = sum_error + error
826 ALLOCATE(cpl_rain2d(
iim,
jj_nb,2), stat=error)
827 sum_error = sum_error + error
828 ALLOCATE(cpl_snow2d(
iim,
jj_nb,2), stat=error)
829 sum_error = sum_error + error
830 ALLOCATE(cpl_evap2d(
iim,
jj_nb,2), stat=error)
831 sum_error = sum_error + error
832 ALLOCATE(cpl_tsol2d(
iim,
jj_nb,2), stat=error)
833 sum_error = sum_error + error
834 ALLOCATE(cpl_fder2d(
iim,
jj_nb,2), stat=error)
835 sum_error = sum_error + error
836 ALLOCATE(cpl_albe2d(
iim,
jj_nb,2), stat=error)
837 sum_error = sum_error + error
838 ALLOCATE(cpl_taux2d(
iim,
jj_nb,2), stat=error)
839 sum_error = sum_error + error
840 ALLOCATE(cpl_tauy2d(
iim,
jj_nb,2), stat=error)
841 sum_error = sum_error + error
842 ALLOCATE(cpl_windsp2d(
iim,
jj_nb), stat=error)
843 sum_error = sum_error + error
844 ALLOCATE(cpl_taumod2d(
iim,
jj_nb,2), stat=error)
845 sum_error = sum_error + error
847 IF (carbon_cycle_cpl)
THEN
848 ALLOCATE(cpl_atm_co22d(
iim,
jj_nb), stat=error)
849 sum_error = sum_error + error
852 IF (sum_error /= 0)
THEN
853 abort_message=
'Pb allocation variables couplees pour l''ecriture'
858 CALL
gath2cpl(cpl_sols(:,cpl_index), cpl_sols2d(:,:,cpl_index), &
861 CALL
gath2cpl(cpl_nsol(:,cpl_index), cpl_nsol2d(:,:,cpl_index), &
864 CALL
gath2cpl(cpl_rain(:,cpl_index), cpl_rain2d(:,:,cpl_index), &
867 CALL
gath2cpl(cpl_snow(:,cpl_index), cpl_snow2d(:,:,cpl_index), &
870 CALL
gath2cpl(cpl_evap(:,cpl_index), cpl_evap2d(:,:,cpl_index), &
874 CALL
gath2cpl(cpl_tsol(:,cpl_index), cpl_tsol2d(:,:, cpl_index), &
878 cpl_fder_tmp(:) = -20.
880 cpl_fder_tmp(knindex(ig))=cpl_fder(ig,cpl_index)
882 CALL
gath2cpl(cpl_fder_tmp(:), cpl_fder2d(:,:,cpl_index), &
886 CALL
gath2cpl(cpl_albe(:,cpl_index), cpl_albe2d(:,:,cpl_index), &
889 CALL
gath2cpl(cpl_taux(:,cpl_index), cpl_taux2d(:,:,cpl_index), &
892 CALL
gath2cpl(cpl_tauy(:,cpl_index), cpl_tauy2d(:,:,cpl_index), &
895 CALL
gath2cpl(cpl_taumod(:,cpl_index), cpl_taumod2d(:,:,cpl_index), &
915 include
"dimensions.h"
919 INTEGER,
INTENT(IN) ::
itime
920 INTEGER,
INTENT(IN) :: knon
921 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
922 REAL,
DIMENSION(klon),
INTENT(IN) :: rriv_in
923 REAL,
DIMENSION(klon),
INTENT(IN) :: rcoa_in
927 REAL,
DIMENSION(iim,jj_nb) :: rriv2d
928 REAL,
DIMENSION(iim,jj_nb) :: rcoa2d
939 CALL
gath2cpl(rriv_in, rriv2d, knon, knindex)
940 CALL
gath2cpl(rcoa_in, rcoa2d, knon, knindex)
946 IF (mod(
itime, nexca) == 1)
THEN
948 cpl_rriv2d(:,:) = 0.0
949 cpl_rcoa2d(:,:) = 0.0
958 cpl_rriv2d(:,:) = cpl_rriv2d(:,:) + rriv2d(:,:) /
REAL(nexca)
959 cpl_rcoa2d(:,:) = cpl_rcoa2d(:,:) + rcoa2d(:,:) /
REAL(nexca)
974 include
"dimensions.h"
978 INTEGER,
INTENT(IN) ::
itime
979 INTEGER,
INTENT(IN) :: knon
980 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
981 REAL,
DIMENSION(klon),
INTENT(IN) :: rlic_in
985 REAL,
DIMENSION(iim,jj_nb) :: rlic2d
995 CALL
gath2cpl(rlic_in, rlic2d, knon, knindex)
1001 IF (mod(
itime, nexca) == 1)
THEN
1003 cpl_rlic2d(:,:) = 0.0
1012 cpl_rlic2d(:,:) = cpl_rlic2d(:,:) + rlic2d(:,:) /
REAL(nexca)
1030 include
"indicesol.h"
1032 include
"dimensions.h"
1036 INTEGER,
INTENT(IN) ::
itime
1037 REAL,
INTENT(IN) ::
dtime
1038 REAL,
DIMENSION(klon),
INTENT(IN) ::
rlon,
rlat
1039 REAL,
DIMENSION(klon,nbsrf),
INTENT(IN) :: pctsrf
1040 LOGICAL,
INTENT(IN) :: lafin
1044 INTEGER :: error, sum_error,
j
1047 INTEGER,
DIMENSION(iim*(jjm+1)) :: ndexct
1049 REAL,
DIMENSION(iim, jj_nb) :: tmp_lon, tmp_lat
1050 REAL,
DIMENSION(iim, jj_nb, 4) :: pctsrf2d
1051 REAL,
DIMENSION(iim, jj_nb) :: deno
1052 CHARACTER(len = 20) :: modname =
'cpl_send_all'
1053 CHARACTER(len = 80) :: abort_message
1056 REAL,
DIMENSION(iim, jj_nb) :: tmp_taux
1057 REAL,
DIMENSION(iim, jj_nb) :: tmp_tauy
1058 REAL,
DIMENSION(iim, jj_nb) :: tmp_calv
1060 REAL,
DIMENSION(iim, jj_nb, maxsend) :: tab_flds
1061 REAL,
DIMENSION(klon_mpi) :: rlon_mpi, rlat_mpi
1065 INTEGER,
DIMENSION(MPI_STATUS_SIZE) :: status
1079 tab_flds(:,:,ids_windsp) = cpl_windsp2d(:,:)
1080 tab_flds(:,:,ids_shfice) = cpl_sols2d(:,:,2)
1081 tab_flds(:,:,ids_nsfice) = cpl_nsol2d(:,:,2)
1082 tab_flds(:,:,ids_dflxdt) = cpl_fder2d(:,:,2)
1084 IF (version_ocean==
'nemo')
THEN
1085 tab_flds(:,:,ids_liqrun) = cpl_rriv2d(:,:) + cpl_rcoa2d(:,:)
1086 IF (carbon_cycle_cpl) tab_flds(:,:,ids_atmco2)=cpl_atm_co22d(:,:)
1087 ELSE IF (version_ocean==
'opa8')
THEN
1088 tab_flds(:,:,ids_shfoce) = cpl_sols2d(:,:,1)
1089 tab_flds(:,:,ids_nsfoce) = cpl_nsol2d(:,:,1)
1090 tab_flds(:,:,ids_icevap) = cpl_evap2d(:,:,2)
1091 tab_flds(:,:,ids_ocevap) = cpl_evap2d(:,:,1)
1092 tab_flds(:,:,ids_runcoa) = cpl_rcoa2d(:,:)
1093 tab_flds(:,:,ids_rivflu) = cpl_rriv2d(:,:)
1100 pctsrf2d(:,:,:) = 0.
1102 CALL
gath2cpl(pctsrf(:,is_oce), pctsrf2d(:,:,is_oce), klon, unity)
1103 CALL
gath2cpl(pctsrf(:,is_sic), pctsrf2d(:,:,is_sic), klon, unity)
1104 CALL
gath2cpl(pctsrf(:,is_lic), pctsrf2d(:,:,is_lic), klon, unity)
1111 IF (is_omp_root)
THEN
1114 tmp_calv(:,
j) = dot_product(cpl_rlic2d(1:
iim,
j), &
1115 pctsrf2d(1:
iim,
j,is_lic)) /
REAL(
iim)
1119 IF (is_parallel)
THEN
1120 IF (.NOT. is_north_pole)
THEN
1122 CALL mpi_recv(up,1,mpi_real_lmdz,mpi_rank-1,1234,comm_lmdz_phy,status,error)
1123 CALL mpi_send(tmp_calv(1,1),1,mpi_real_lmdz,mpi_rank-1,1234,comm_lmdz_phy,error)
1127 IF (.NOT. is_south_pole)
THEN
1129 CALL mpi_send(tmp_calv(1,
jj_nb),1,mpi_real_lmdz,mpi_rank+1,1234,comm_lmdz_phy,error)
1130 CALL mpi_recv(down,1,mpi_real_lmdz,mpi_rank+1,1234,comm_lmdz_phy,status,error)
1134 IF (.NOT. is_north_pole .AND. ii_begin /=1)
THEN
1135 up=up+tmp_calv(
iim,1)
1139 IF (.NOT. is_south_pole .AND. ii_end /=
iim)
THEN
1140 down=down+tmp_calv(1,
jj_nb)
1141 tmp_calv(:,
jj_nb)=down
1145 tab_flds(:,:,ids_calvin) = tmp_calv(:,:)
1153 deno = pctsrf2d(:,:,is_oce) + pctsrf2d(:,:,is_sic)
1155 IF (version_ocean==
'nemo')
THEN
1156 tab_flds(:,:,ids_shftot) = 0.0
1157 tab_flds(:,:,ids_nsftot) = 0.0
1158 tab_flds(:,:,ids_totrai) = 0.0
1159 tab_flds(:,:,ids_totsno) = 0.0
1160 tab_flds(:,:,ids_toteva) = 0.0
1161 tab_flds(:,:,ids_taumod) = 0.0
1166 WHERE ( deno(:,:) /= 0 )
1167 tmp_taux = cpl_taux2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1168 cpl_taux2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1169 tmp_tauy = cpl_tauy2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1170 cpl_tauy2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1172 tab_flds(:,:,ids_shftot) = cpl_sols2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1173 cpl_sols2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1174 tab_flds(:,:,ids_nsftot) = cpl_nsol2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1175 cpl_nsol2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1176 tab_flds(:,:,ids_totrai) = cpl_rain2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1177 cpl_rain2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1178 tab_flds(:,:,ids_totsno) = cpl_snow2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1179 cpl_snow2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1180 tab_flds(:,:,ids_toteva) = cpl_evap2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1181 cpl_evap2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1182 tab_flds(:,:,ids_taumod) = cpl_taumod2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1183 cpl_taumod2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1187 tab_flds(:,:,ids_icevap) = cpl_evap2d(:,:,2)
1189 ELSE IF (version_ocean==
'opa8')
THEN
1191 tab_flds(:,:,ids_totrai) = 0.0
1192 tab_flds(:,:,ids_totsno) = 0.0
1196 WHERE ( deno(:,:) /= 0 )
1197 tab_flds(:,:,ids_totrai) = cpl_rain2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1198 cpl_rain2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1199 tab_flds(:,:,ids_totsno) = cpl_snow2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1200 cpl_snow2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1202 tmp_taux = cpl_taux2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1203 cpl_taux2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1204 tmp_tauy = cpl_tauy2d(:,:,1) * pctsrf2d(:,:,is_oce) / deno(:,:) + &
1205 cpl_tauy2d(:,:,2) * pctsrf2d(:,:,is_sic) / deno(:,:)
1219 CALL gather_omp(
rlon,rlon_mpi)
1220 CALL gather_omp(
rlat,rlat_mpi)
1222 CALL grid1dto2d_mpi(rlon_mpi,tmp_lon)
1223 CALL grid1dto2d_mpi(rlat_mpi,tmp_lat)
1226 IF (is_sequential)
THEN
1227 IF (is_north_pole) tmp_lon(:,1) = tmp_lon(:,2)
1228 IF (is_south_pole) tmp_lon(:,jjm+1) = tmp_lon(:,jjm)
1232 IF (is_sequential)
THEN
1235 CALL histwrite(nidct,
'tauxe',
itau_w,tmp_taux,
iim*(jjm+1),ndexct)
1236 CALL histwrite(nidct,
'tauyn',
itau_w,tmp_tauy,
iim*(jjm+1),ndexct)
1237 CALL histwrite(nidct,
'tmp_lon',
itau_w,tmp_lon,
iim*(jjm+1),ndexct)
1238 CALL histwrite(nidct,
'tmp_lat',
itau_w,tmp_lat,
iim*(jjm+1),ndexct)
1245 tab_flds(:,:,ids_tauxxu), tab_flds(:,:,ids_tauyyu), tab_flds(:,:,ids_tauzzu) )
1247 tab_flds(:,:,ids_tauxxv) = tab_flds(:,:,ids_tauxxu)
1248 tab_flds(:,:,ids_tauyyv) = tab_flds(:,:,ids_tauyyu)
1249 tab_flds(:,:,ids_tauzzv) = tab_flds(:,:,ids_tauzzu)
1256 IF (is_sequential)
THEN
1258 IF (infosend(
j)%action) CALL histwrite(nidct,infosend(
j)%name,
itau_w, &
1259 tab_flds(:,:,
j),
iim*(jjm+1),ndexct)
1269 CALL intocpl(time_sec, lafin, tab_flds(:,:,:))
1278 DEALLOCATE(cpl_sols2d, cpl_nsol2d, cpl_rain2d, cpl_snow2d, stat=error )
1279 sum_error = sum_error + error
1280 DEALLOCATE(cpl_evap2d, cpl_tsol2d, cpl_fder2d, cpl_albe2d, stat=error )
1281 sum_error = sum_error + error
1282 DEALLOCATE(cpl_taux2d, cpl_tauy2d, cpl_windsp2d, cpl_taumod2d, stat=error )
1283 sum_error = sum_error + error
1285 IF (carbon_cycle_cpl)
THEN
1286 DEALLOCATE(cpl_atm_co22d, stat=error )
1287 sum_error = sum_error + error
1290 IF (sum_error /= 0)
THEN
1291 abort_message=
'Pb in deallocation of cpl_xxxx2D coupling variables'
1299 SUBROUTINE cpl2gath(champ_in, champ_out, knon, knindex)
1313 include
"dimensions.h"
1316 INTEGER,
INTENT(IN) :: knon
1317 REAL,
DIMENSION(iim,jj_nb),
INTENT(IN) :: champ_in
1318 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
1321 REAL,
DIMENSION(klon_mpi),
INTENT(OUT) :: champ_out
1325 REAL,
DIMENSION(klon_mpi) :: temp_mpi
1326 REAL,
DIMENSION(klon) :: temp_omp
1334 CALL grid2dto1d_mpi(champ_in,temp_mpi)
1337 CALL scatter_omp(temp_mpi,temp_omp)
1342 champ_out(
i) = temp_omp(ig)
1349 SUBROUTINE gath2cpl(champ_in, champ_out, knon, knindex)
1362 include
"dimensions.h"
1366 INTEGER,
INTENT(IN) :: knon
1367 REAL,
DIMENSION(klon),
INTENT(IN) :: champ_in
1368 INTEGER,
DIMENSION(klon),
INTENT(IN) :: knindex
1372 REAL,
DIMENSION(iim,jj_nb),
INTENT(OUT) :: champ_out
1377 REAL,
DIMENSION(klon) :: temp_omp
1378 REAL,
DIMENSION(klon_mpi) :: temp_mpi
1385 temp_omp(ig) = champ_in(
i)
1389 CALL gather_omp(temp_omp,temp_mpi)
1392 CALL grid1dto2d_mpi(temp_mpi,champ_out)
1394 IF (is_north_pole) champ_out(:,1)=temp_mpi(1)
1395 IF (is_south_pole) champ_out(:,
jj_nb)=temp_mpi(klon)