Ignore:
Timestamp:
Aug 17, 2006, 5:41:51 PM (18 years ago)
Author:
Laurent Fairhead
Message:

Inclusion des modifs de Y. Meurdesoif pour la version V3
LF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ4/branches/V3_test/libf/phylmd/oasis.psmile

    r626 r704  
    4545   use mod_prism_proto
    4646   use mod_prism_def_partition_proto
    47 
     47   use dimphy
    4848   implicit none
    4949
     
    9494! Here we go: psmile initialisation
    9595!
    96    call prism_init_comp_proto (comp_id, clmodnam, ierror)
    97 
    98    IF (ierror .ne. PRISM_Ok) THEN
    99       abort_message=' Probleme init dans prism_init_comp '
    100       call abort_gcm(modname,abort_message,1)
    101    ELSE
    102       WRITE(nuout,*) 'inicma : init psmile ok '
    103    ENDIF
    104 
    105 ! PSMILe attribution of local communicator
    106 !
    107    call prism_get_localcomm_proto (il_commlocal, ierror)
     96!ym   call prism_init_comp_proto (comp_id, clmodnam, ierror)
     97!ym
     98!ym   IF (ierror .ne. PRISM_Ok) THEN
     99!ym      abort_message=' Probleme init dans prism_init_comp '
     100!ym      call abort_gcm(modname,abort_message,1)
     101!ym   ELSE
     102!ym      WRITE(nuout,*) 'inicma : init psmile ok '
     103!ym   ENDIF
     104      call prism_get_localcomm_proto (il_commlocal, ierror)
    108105!
    109106! and domain decomposition
     
    111108! monoproc case
    112109!
    113    allocate(ig_paral(5))
    114    ig_paral (1) = 2
    115    ig_paral (2) = 0
    116    ig_paral (3) = im
    117    ig_paral (4) = jm
    118    ig_paral (5) = im
    119 
     110   allocate(ig_paral(3))
     111!ym   ig_paral(1) = 0
     112!ym   ig_paral(2) = 0
     113!ym   ig_paral(3) = im * jm
     114   ig_paral(1) = 1    ! apple partition for //
     115   ig_paral(2) = (jjphy_begin-1)*im+iiphy_begin-1
     116   ig_paral(3) = (jjphy_end*im+iiphy_end)-(jjphy_begin*im+iiphy_begin)+1
     117   if (phy_rank==phy_size-1) ig_paral(3)=ig_paral(3)+im-1
     118   print *,phy_rank,'ig_paral--->',ig_paral(2),ig_paral(3)
     119   
     120   ierror=PRISM_Ok
    120121   call prism_def_partition_proto (il_part_id, ig_paral, ierror)
    121122   deallocate(ig_paral)
     
    140141      cl_writ(5)='COTAUYYV'
    141142      cl_writ(6)='COTAUZZV'
    142 c -- LOOP
     143! -- LOOP
    143144      cl_writ(7)='COWINDSP'
    144 c -- LOOP
     145! -- LOOP
    145146      cl_writ(8)='COSHFICE'
    146147      cl_writ(9)='COSHFOCE'
     
    218219   use mod_prism_proto
    219220   use mod_prism_get_proto
    220 
     221   use dimphy
    221222   IMPLICIT none
    222223
     
    225226!
    226227   integer                 :: im, jm, kt
    227    real, dimension(im, jm)   :: sst            ! sea-surface-temperature
    228    real, dimension(im, jm)   :: gla     ! sea-ice
    229    real, dimension(im, jm)   :: tice    ! temp glace
    230    real, dimension(im, jm)   :: albedo  ! albedo glace
     228   real, dimension(im*jm)   :: sst            ! sea-surface-temperature
     229   real, dimension(im*jm)   :: gla     ! sea-ice
     230   real, dimension(im*jm)   :: tice    ! temp glace
     231   real, dimension(im*jm)   :: albedo  ! albedo glace
    231232!
    232233! local variables
     
    236237   character (len = 20),save  :: modname = 'fromcpl'
    237238   character (len = 80)       :: abort_message
     239   integer :: istart,iend
    238240!
    239241#include "param_cou.h"
     
    245247   CALL flush (nuout)
    246248
    247    call prism_get_proto(in_var_id(1), kt, sst, ierror)
     249   istart=iiphy_begin
     250   if (phy_rank==phy_size-1) then
     251    iend=(jjphy_end-jjphy_begin)*im+im
     252   else
     253    iend=(jjphy_end-jjphy_begin)*im+iiphy_end
     254   endif
     255   
     256   call prism_get_proto(in_var_id(1), kt, sst(istart:iend), ierror)
    248257   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
    249258 &     ierror.ne.PRISM_FromRest &
     
    254263     call abort_gcm(modname,abort_message,1)
    255264   endif
    256    call prism_get_proto(in_var_id(2), kt, gla, ierror)
     265   call prism_get_proto(in_var_id(2), kt, gla(istart:iend), ierror)
    257266   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
    258267 &     ierror.ne.PRISM_FromRest &
     
    263272     call abort_gcm(modname,abort_message,1)
    264273   endif
    265    call prism_get_proto(in_var_id(3), kt, albedo, ierror)
     274   call prism_get_proto(in_var_id(3), kt, albedo(istart:iend), ierror)
    266275   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
    267276 &     ierror.ne.PRISM_FromRest &
     
    272281     call abort_gcm(modname,abort_message,1)
    273282   endif
    274    call prism_get_proto(in_var_id(4), kt, tice, ierror)
     283   call prism_get_proto(in_var_id(4), kt, tice(istart:iend), ierror)
    275284   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Recvd .and. &
    276285 &     ierror.ne.PRISM_FromRest &
     
    288297   SUBROUTINE intocpl(kt, im, jm, fsolice, fsolwat, fnsolice, fnsolwat, &
    289298 &    fnsicedt, evice, evwat, lpre, spre, dirunoff, rivrunoff, &
    290  &    calving, tauxx_u, tauyy_u, tauzz_u, tauxx_v, tauyy_v, tauzz_v &
    291 c -- LOOP
    292      $    windsp,
    293 c -- LOOP
    294  &    , last)
     299 &    calving, tauxx_u, tauyy_u, tauzz_u, tauxx_v, tauyy_v, tauzz_v, &
     300! -- LOOP
     301 &    windsp,                                                       &
     302! -- LOOP
     303 &    last)
    295304! ======================================================================
    296305! L. Fairhead (09/2003) adapted From L.Z.X Li: this subroutine provides the
     
    301310   use mod_prism_proto
    302311   use mod_prism_put_proto
    303 
     312   use dimphy
     313   use write_field_phy
    304314   IMPLICIT NONE
    305315
     
    308318!
    309319   integer               :: kt, im, jm
    310    real, dimension(im, jm) :: fsolice, fsolwat, fnsolwat, fnsolice
    311    real, dimension(im, jm) :: fnsicedt, evice, evwat, lpre, spre
    312    real, dimension(im, jm) :: dirunoff, rivrunoff, calving
    313    real, dimension(im, jm) :: tauxx_u, tauxx_v, tauyy_u
    314    real, dimension(im, jm) :: tauyy_v, tauzz_u, tauzz_v
    315    real, dimension(im, jm) :: windsp
     320   real, dimension(im* jm) :: fsolice, fsolwat, fnsolwat, fnsolice
     321   real, dimension(im* jm) :: fnsicedt, evice, evwat, lpre, spre
     322   real, dimension(im* jm) :: dirunoff, rivrunoff, calving
     323   real, dimension(im* jm) :: tauxx_u, tauxx_v, tauyy_u
     324   real, dimension(im* jm) :: tauyy_v, tauzz_u, tauzz_v
     325   real, dimension(im*jm) :: windsp
    316326   logical               :: last
     327   logical :: checkout=.FALSE.
     328   integer :: istart,iend
     329   integer :: wstart,wend
    317330!
    318331! local
     
    329342      WRITE(nuout,*)
    330343
    331    call prism_put_proto(il_out_var_id(8), kt, fsolice, ierror)
     344   istart=iiphy_begin
     345   if (phy_rank==phy_size-1) then
     346    iend=(jjphy_end-jjphy_begin)*im+im
     347   else
     348    iend=(jjphy_end-jjphy_begin)*im+iiphy_end
     349   endif
     350
     351   IF (checkout) THEN   
     352     wstart=istart
     353     wend=iend
     354     IF (phy_rank==0) wstart=istart+im-1
     355     IF (phy_rank==phy_size-1) wend=iend-im+1
     356   
     357     CALL writeField_phy("fsolice",fsolice(wstart:wend),1)
     358     CALL writeField_phy("fsolwat",fsolwat(wstart:wend),1)
     359     CALL writeField_phy("fnsolice",fnsolice(wstart:wend),1)
     360     CALL writeField_phy("fnsolwat",fnsolwat(wstart:wend),1)
     361     CALL writeField_phy("fnsicedt",fnsicedt(wstart:wend),1)
     362     CALL writeField_phy("evice",evice(wstart:wend),1)
     363     CALL writeField_phy("evwat",evwat(wstart:wend),1)
     364     CALL writeField_phy("lpre",lpre(wstart:wend),1)
     365     CALL writeField_phy("spre",spre(wstart:wend),1)
     366     CALL writeField_phy("dirunoff",dirunoff(wstart:wend),1)
     367     CALL writeField_phy("rivrunoff",rivrunoff(wstart:wend),1)
     368     CALL writeField_phy("calving",calving(wstart:wend),1)
     369     CALL writeField_phy("tauxx_u",tauxx_u(wstart:wend),1)
     370     CALL writeField_phy("tauyy_u",tauyy_u(wstart:wend),1)
     371     CALL writeField_phy("tauzz_u",tauzz_u(wstart:wend),1)
     372     CALL writeField_phy("tauxx_v",tauxx_v(wstart:wend),1)
     373     CALL writeField_phy("tauyy_v",tauyy_v(wstart:wend),1)
     374     CALL writeField_phy("tauzz_v",tauzz_v(wstart:wend),1)
     375     CALL writeField_phy("windsp",windsp(wstart:wend),1)
     376   ENDIF
     377   
     378   call prism_put_proto(il_out_var_id(8), kt, fsolice(istart:iend), ierror)
    332379   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    333380 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    337384     call abort_gcm(modname,abort_message,1)
    338385   endif
    339    call prism_put_proto(il_out_var_id(9), kt, fsolwat, ierror)
     386   call prism_put_proto(il_out_var_id(9), kt, fsolwat(istart:iend), ierror)
    340387   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    341388 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    345392     call abort_gcm(modname,abort_message,1)
    346393   endif
    347    call prism_put_proto(il_out_var_id(10), kt, fnsolice, ierror)
     394   call prism_put_proto(il_out_var_id(10), kt, fnsolice(istart:iend), ierror)
    348395   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    349396 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    353400     call abort_gcm(modname,abort_message,1)
    354401   endif
    355    call prism_put_proto(il_out_var_id(11), kt, fnsolwat, ierror)
     402   call prism_put_proto(il_out_var_id(11), kt, fnsolwat(istart:iend), ierror)
    356403   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    357404 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    361408     call abort_gcm(modname,abort_message,1)
    362409   endif
    363    call prism_put_proto(il_out_var_id(12), kt, fnsicedt, ierror)
     410   call prism_put_proto(il_out_var_id(12), kt, fnsicedt(istart:iend), ierror)
    364411   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    365412 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    369416     call abort_gcm(modname,abort_message,1)
    370417   endif
    371    call prism_put_proto(il_out_var_id(13), kt, evice, ierror)
     418   call prism_put_proto(il_out_var_id(13), kt, evice(istart:iend), ierror)
    372419   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    373420 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    377424     call abort_gcm(modname,abort_message,1)
    378425   endif
    379    call prism_put_proto(il_out_var_id(14), kt, evwat, ierror)
     426   call prism_put_proto(il_out_var_id(14), kt, evwat(istart:iend), ierror)
    380427   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    381428 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    385432     call abort_gcm(modname,abort_message,1)
    386433   endif
    387    call prism_put_proto(il_out_var_id(15), kt, lpre, ierror)
     434   call prism_put_proto(il_out_var_id(15), kt, lpre(istart:iend), ierror)
    388435   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    389436 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    393440     call abort_gcm(modname,abort_message,1)
    394441   endif
    395    call prism_put_proto(il_out_var_id(16), kt, spre, ierror)
     442   call prism_put_proto(il_out_var_id(16), kt, spre(istart:iend), ierror)
    396443   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    397444 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    401448     call abort_gcm(modname,abort_message,1)
    402449   endif
    403    call prism_put_proto(il_out_var_id(17), kt, dirunoff, ierror)
     450   call prism_put_proto(il_out_var_id(17), kt, dirunoff(istart:iend), ierror)
    404451   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    405452 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    409456     call abort_gcm(modname,abort_message,1)
    410457   endif
    411    call prism_put_proto(il_out_var_id(18), kt, rivrunoff, ierror)
     458   call prism_put_proto(il_out_var_id(18), kt, rivrunoff(istart:iend), ierror)
    412459   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    413460 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    417464     call abort_gcm(modname,abort_message,1)
    418465   endif
    419    call prism_put_proto(il_out_var_id(19), kt, calving, ierror)
     466   call prism_put_proto(il_out_var_id(19), kt, calving(istart:iend), ierror)
    420467   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    421468 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    425472     call abort_gcm(modname,abort_message,1)
    426473   endif
    427    call prism_put_proto(il_out_var_id(1), kt, tauxx_u, ierror)
     474   call prism_put_proto(il_out_var_id(1), kt, tauxx_u(istart:iend), ierror)
    428475   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    429476 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    433480     call abort_gcm(modname,abort_message,1)
    434481   endif
    435    call prism_put_proto(il_out_var_id(2), kt, tauyy_u, ierror)
     482   call prism_put_proto(il_out_var_id(2), kt, tauyy_u(istart:iend), ierror)
    436483   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    437484 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    441488     call abort_gcm(modname,abort_message,1)
    442489   endif
    443    call prism_put_proto(il_out_var_id(3), kt, tauzz_u, ierror)
     490   call prism_put_proto(il_out_var_id(3), kt, tauzz_u(istart:iend), ierror)
    444491   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    445492 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    449496     call abort_gcm(modname,abort_message,1)
    450497   endif
    451    call prism_put_proto(il_out_var_id(4), kt, tauxx_v, ierror)
     498   call prism_put_proto(il_out_var_id(4), kt, tauxx_v(istart:iend), ierror)
    452499   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    453500 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    457504     call abort_gcm(modname,abort_message,1)
    458505   endif
    459    call prism_put_proto(il_out_var_id(5), kt, tauyy_v, ierror)
     506   call prism_put_proto(il_out_var_id(5), kt, tauyy_v(istart:iend), ierror)
    460507   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    461508 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    465512     call abort_gcm(modname,abort_message,1)
    466513   endif
    467    call prism_put_proto(il_out_var_id(6), kt, tauzz_v, ierror)
     514   call prism_put_proto(il_out_var_id(6), kt, tauzz_v(istart:iend), ierror)
    468515   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    469516 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    473520     call abort_gcm(modname,abort_message,1)
    474521   endif
    475    call prism_put_proto(il_out_var_id(7), kt, windsp, ierror)
     522   call prism_put_proto(il_out_var_id(7), kt, windsp(istart:iend), ierror)
    476523   IF (ierror .ne. PRISM_Ok .and. ierror.ne.PRISM_Sent .and. ierror.ne.PRISM_ToRest &
    477524 &     .and. ierror.ne.PRISM_LocTrans .and. ierror.ne.PRISM_Output .and. &
     
    483530
    484531   if (last) then
    485      call prism_terminate_proto(ierror)
    486      IF (ierror .ne. PRISM_Ok) THEN
    487        abort_message=' Probleme dans prism_terminate_proto '
    488        call abort_gcm(modname,abort_message,1)
    489      endif
     532     IF (monocpu) THEN
     533       call prism_terminate_proto(ierror)
     534         IF (ierror .ne. PRISM_Ok) THEN
     535         abort_message=' Probleme dans prism_terminate_proto '
     536         call abort_gcm(modname,abort_message,1)
     537       endif
     538     ENDIF
    490539   endif
    491540
Note: See TracChangeset for help on using the changeset viewer.