source: LMDZ.3.3/branches/rel-LF/libf/phylmd/oasis.F @ 98

Last change on this file since 98 was 98, checked in by lmdzadmin, 24 years ago

Interface avec les differentes surface, version de travail.LF

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 24.8 KB
Line 
1c
2C****
3C               *****************
4C               * OASIS ROUTINE *
5C               * ------------- *
6C               *****************
7C
8C**** *INICMA*  - Initialize coupled mode communication for atmosphere
9C
10C     Purpose:
11C     -------
12C     Exchange process identifiers and timestep information
13C     between AGCM, OGCM and COUPLER.
14C
15C     Input:
16C     -----
17C       KASTP  : total number of timesteps in atmospheric model
18C       KEXCH  : frequency of exchange (in time steps)
19C       KSTEP  : timestep value (in seconds)
20C
21C     Method:
22C     ------
23C     Use named pipes(FIFO) to exchange process identifiers
24C     between the programs
25C
26C     Externals:
27C     ---------
28C     GETPID, MKNOD
29C
30C     Reference:
31C     ---------
32C     See Epicoa 0803 (1992)
33C
34C     Author:
35C     -------
36C     Laurent Terray  92-09-01
37C
38C     -----------------------------------------------------------
39C
40      SUBROUTINE inicma(kastp,kexch,kstep)
41c
42      INTEGER kastp, kexch, kstep
43c
44      INTEGER ime
45      PARAMETER (ime = 1)
46
47      INTEGER iparal(3)
48      INTEGER ifcpl, idt, info, imxtag, istep
49c
50#include "dimensions.h"
51#include "dimphy.h"
52#include "oasis.h"
53#include "clim.h"
54c
55c     Addition for SIPC CASE
56#include "param_sipc.h"
57#include "param_cou.h"
58#include "inc_sipc.h"
59#include "inc_cpl.h"
60      CHARACTER*9 clpoolnam
61      INTEGER ipoolhandle, imrc, ipoolsize, index, jf
62      CHARACTER*3 cljobnam      ! experiment name
63      CHARACTER*6 clmodnam      ! model name
64      CHARACTER*5 cloasis       ! coupler name (Oasis)
65      INTEGER imess(4), imesso(4)
66      INTEGER getpid, mknod ! system functions
67      CHARACTER*80 clcmd
68      CHARACTER*8 pipnom, fldnom
69      INTEGER ierror, iretcode
70C
71      INTEGER nuout
72      PARAMETER (nuout = 6)
73c
74C
75c
76
77C     -----------------------------------------------------------
78C
79C*    1. Initializations
80C        ---------------
81C
82      WRITE(nuout,*) ' '
83      WRITE(nuout,*) ' '
84      WRITE(nuout,*) ' ROUTINE INICMA'
85      WRITE(nuout,*) ' **************'
86      WRITE(nuout,*) ' '
87      WRITE(nuout,*) ' '
88c
89c     1.2.1-Define the model name
90c
91      clmodnam = 'lmd.xx'       ! as $NBMODEL in namcouple
92c
93c     1.2.2-Define the coupler name
94c
95      cloasis = 'Oasis'        !  as in coupler
96c
97c
98c     1.3.1-Define symbolic name for fields exchanged from atmos to coupler,
99c         must be the same as (1) of the field  definition in namcouple:
100c
101      cl_writ(1)='CONSFTOT'
102      cl_writ(2)='COSHFTOT'
103      cl_writ(3)='COTOPRSU'
104      cl_writ(4)='COTFSHSU'
105      cl_writ(5)='CORUNCOA'
106      cl_writ(6)='CORIVFLU'
107      cl_writ(7)='COZOTAUX'
108      cl_writ(8)='COZOTAU2'
109      cl_writ(9)='COMETAUY'
110      cl_writ(10)='COMETAU2'
111c
112c     1.3.2-Define files name for fields exchanged from atmos to coupler,
113c         must be the same as (6) of the field  definition in namcouple:
114c
115      cl_f_writ(1)='atmflx'
116      cl_f_writ(2)='atmflx'
117      cl_f_writ(3)='atmflx'
118      cl_f_writ(4)='atmflx'
119      cl_f_writ(5)='atmflx'
120      cl_f_writ(6)='atmflx'
121      cl_f_writ(7)='atmtau'
122      cl_f_writ(8)='atmtau'
123      cl_f_writ(9)='atmtau'
124      cl_f_writ(10)='atmtau'
125c
126c
127c     1.4.1-Define symbolic name for fields exchanged from coupler to atmosphere,
128c         must be the same as (2) of the field  definition in namcouple:
129c
130      cl_read(1)='SISUTESU'
131      cl_read(2)='SIICECOV'
132c
133c     1.4.2-Define files names for fields exchanged from coupler to atmosphere,
134c         must be the same as (7) of the field  definition in namcouple:
135c
136      cl_f_read(1)='atmsst'
137      cl_f_read(2)='atmice'
138c
139c     1.5-Define infos for sending to oasis
140c
141      imess(1) = kastp
142      imess(2) = kexch
143      imess(3) = kstep
144      imess(4) = getpid()
145
146c
147c
148      IF (cchan.eq.'PIPE') THEN
149c
150          ierror=0
151c
152c
153          WRITE(nuout,*) ' '
154          WRITE(nuout,*) 'Making pipes for fields to receive from CPL'
155          WRITE(nuout,*) ' '
156c
157c loop to define pipes (ocean=CPL to atmos)
158c
159          DO jf=1, jpfldo2a
160            CALL PIPE_Model_Define(nuout, cl_read(jf), jpread, iretcode)
161            IF (iretcode.ne.0) ierror=ierror+1
162          END DO
163c
164          WRITE(nuout,*) ' '
165          WRITE(nuout,*) 'Making pipes for fields to send to CPL'
166          WRITE(nuout,*) ' '
167c
168c loop to define pipes (atmos to ocean=CPL)
169c
170          DO jf=1, jpflda2o
171            CALL PIPE_Model_Define(nuout, cl_writ(jf), jpwrit, iretcode)
172            IF (iretcode.ne.0) ierror=ierror+1
173          END DO
174c
175          IF (ierror.ne.0) THEN
176              WRITE (nuout,*) 'Error in pipes definitions'
177              WRITE (nuout,*) 'STOP inicma'
178              CALL abort
179          END IF
180c
181          WRITE(nuout,*) ' '
182          WRITE(nuout,*) 'All pipes have been made'
183          WRITE(nuout,*) ' '
184c
185          WRITE(nuout,*) ' '
186          WRITE(nuout,*) 'Communication test between ATM and CPL'
187          WRITE(nuout,*) ' '
188          CALL flush(nuout)
189c
190          CALL PIPE_Model_Stepi(nuout, imess, ime, imesso, ierror)
191c
192          IF (ierror.ne.0) THEN
193              WRITE (nuout,*)
194     $            'Error in exchange first informations with Oasis'
195              WRITE (nuout,*) 'STOP inicma'
196              CALL abort
197          END IF
198c
199          WRITE(nuout,*) ' '
200          WRITE(nuout,*) 'Communication test between ATM and CPL is OK'
201          WRITE(nuout,*) ' total simulation time in oasis = ', imesso(1)
202          WRITE(nuout,*) ' total number of iterations is  = ', imesso(2)
203          WRITE(nuout,*) ' value of oasis timestep  is    = ', imesso(3)
204          WRITE(nuout,*) ' process id for oasis  is       = ', imesso(4)
205          WRITE(nuout,*) ' '
206          CALL flush(nuout)
207c
208      ELSE  IF (cchan.eq.'SIPC') THEN
209c
210c debug for more information
211c
212c          CALL SVIPC_debug(1)
213
214c
215c     1.1-Define the experiment name :
216c
217          cljobnam = 'IPC'      ! as $JOBNAM in namcouple
218c
219c         3-Attach to shared memory pool used to exchange initial infos
220c
221          imrc = 0
222          CALL SIPC_Init_Model (cljobnam, clmodnam, 1, imrc)
223          IF (imrc .NE. 0) THEN
224            WRITE (nuout,*)'   '
225            WRITE (nuout,*)'WARNING: Problem with attachement to', imrc
226            WRITE (nuout,*)'         initial memory pool(s) in atmos'
227            WRITE (nuout,*)'   '
228            CALL ABORT('STOP in atmos')
229          ENDIF
230c
231c         4-Attach to pools used to exchange fields from atmos to coupler
232c
233          DO jf = 1, jpflda2o
234c
235C
236c           Pool name:
237            clpoolnam = 'P'//cl_writ(jf)
238C
239            CALL SIPC_Attach(clpoolnam, ipoolhandle)
240c     
241c           Resulting pool handle:
242            mpoolwrit(jf) = ipoolhandle 
243C
244            END DO
245C
246c         5-Attach to pools used to exchange fields from coupler to atmos
247c
248          DO jf = 1, jpfldo2a
249c
250c           Pool name:
251            clpoolnam = 'P'//cl_read(jf)
252c
253            CALL SIPC_Attach(clpoolnam, ipoolhandle)
254c
255c           Resulting pool handle:
256            mpoolread(jf) = ipoolhandle 
257c
258          END DO
259c
260c         6-Exchange of initial infos
261c
262c         Write data array isend to pool READ by Oasis
263c
264          imrc = 0
265          ipoolsize = 4*jpbyteint
266          CALL SVIPC_Write(mpoolinitr, imess, ipoolsize, imrc)
267C
268C         Find error if any
269C
270          IF (imrc .LT. 0) THEN
271              WRITE (nuout,*) '   '
272              WRITE (nuout,*) 'Problem in atmos in writing initial'
273              WRITE (nuout,*) 'infos to the shared memory segment(s)'
274              WRITE (nuout,*) '   '
275          ELSE
276              WRITE (nuout,*) '   '
277              WRITE (nuout,*) 'Initial infos written in atmos'           
278              WRITE (nuout,*) 'to the shared memory segment(s)'
279              WRITE (nuout,*) '   '
280          ENDIF
281C
282C         Read data array irecv from pool written by Oasis
283C
284          imrc = 0
285          ipoolsize = 4*jpbyteint
286          CALL SVIPC_Read(mpoolinitw, imesso, ipoolsize, imrc)
287C
288C*        Find error if any
289C
290          IF (imrc .LT. 0) THEN
291              WRITE (nuout,*) '   '
292              WRITE (nuout,*) 'Problem in atmos in reading initial'
293              WRITE (nuout,*) 'infos from the shared memory segment(s)'
294              WRITE (nuout,*) '   '
295          ELSE
296              WRITE (nuout,*) '   '
297              WRITE (nuout,*) 'Initial infos read by atmos'               
298              WRITE (nuout,*) 'from the shared memory segment(s)'
299              WRITE (nuout,*) '   '
300              WRITE(*,*) ' ntime, niter, nstep, Oasis pid:'
301              WRITE(*,*) imesso(1), imesso(2), imesso(3), imesso(4)
302          ENDIF
303C
304C         Detach from shared memory segment(s)
305C
306          imrc = 0
307          CALL SVIPC_close(mpoolinitw, 0, imrc)
308C
309C         Find error if any
310C
311          IF (imrc .LT. 0) THEN
312              WRITE (nuout,*)
313     $          'Problem in detaching from shared memory segment(s)'
314              WRITE (nuout,*)
315     $          'used by atmos to read initial infos'
316          ENDIF
317c
318c
319      ELSE IF (cchan.eq.'CLIM') THEN
320
321c
322c     1.1-Define the experiment name :
323c
324          cljobnam = 'CLI'      ! as $JOBNAM in namcouple
325
326          OPEN ( UNIT = 7, FILE = 'trace', STATUS = 'unknown',
327     $          FORM = 'formatted')
328          CALL CLIM_Init ( cljobnam, clmodnam, 3, 7,
329     *                 kastp, kexch, kstep,
330     *                 5, 3600, 3600, info )
331c
332          IF (info.ne.clim_ok) THEN
333              WRITE ( nuout, *) ' inicma : pb init clim '
334              WRITE ( nuout, *) ' error code is = ', info
335              CALL abort('STOP in inicma')
336            ELSE
337              WRITE(nuout,*) 'inicma : init clim ok '
338          ENDIF
339c
340          iparal ( clim_strategy ) = clim_serial
341          iparal ( clim_length   ) = iim*(jjm+1)
342          iparal ( clim_offset   ) = 0
343c
344c loop to define messages (CPL=ocean to atmos)
345c
346          DO jf=1, jpfldo2a
347            CALL CLIM_Define (cl_read(jf), clim_in , clim_double, iparal
348     $          , info ) 
349          END DO
350
351c
352c loop to define messages (atmos to ocean=CPL)
353c
354          DO jf=1, jpflda2o
355            CALL CLIM_Define (cl_writ(jf), clim_out , clim_double,
356     $          iparal, info )   
357          END DO
358
359          WRITE(nuout,*) 'inicma : clim_define ok '
360          CALL CLIM_Start ( imxtag, info )
361          IF (info.ne.clim_ok) THEN
362              WRITE ( nuout, *) 'inicma : pb start clim '
363              WRITE ( nuout, *) ' error code is = ', info
364              CALL abort('stop in inicma')
365            ELSE
366              WRITE ( nuout, *)  'inicma : start clim ok '
367          ENDIF
368c
369          CALL CLIM_Stepi (cloasis, istep, ifcpl, idt, info)
370          IF (info .NE. clim_ok) THEN
371              WRITE ( UNIT = nuout, FMT = *)
372     $            ' warning : problem in getting step info ',
373     $            'from oasis '
374              WRITE (UNIT = nuout, FMT = *)
375     $            ' =======   error code number = ', info
376            ELSE
377              WRITE (UNIT = nuout, FMT = *)
378     $            ' got step information from oasis '
379          ENDIF
380          WRITE ( nuout, *) ' number of tstep in oasis ', istep
381          WRITE ( nuout, *) ' exchange frequency in oasis ', ifcpl
382          WRITE ( nuout, *) ' length of tstep in oasis ', idt
383      ENDIF
384
385      RETURN
386      END
387
388      SUBROUTINE fromcpl(kt, imjm, sst,sic, alb_sst, alb_sic )
389      IMPLICIT none
390c
391c Laurent Z.X Li (Feb. 10, 1997): It reads the SST and Sea-Ice
392c provided by the coupler. Of course, it waits until it receives
393c the signal from the corresponding pipes.
394c 3 techniques:
395c  - pipes and signals (only on Cray C90 and Cray J90)
396c  - CLIM (PVM exchange messages)
397c  - SVIPC shared memory segments and semaphores
398c
399      INTEGER imjm, kt
400      REAL sst(imjm)          ! sea-surface-temperature
401      REAL alb_sst(imjm)  ! open sea albedo
402      REAL sic(imjm)      ! sea ice cover
403      REAL alb_sic(imjm)  ! sea ice albedo
404
405c
406      INTEGER nuout             ! listing output unit
407      PARAMETER (nuout=6)
408c
409      INTEGER nuread, ios, iflag, icpliter
410      CHARACTER*8 pipnom        ! name for the pipe
411      CHARACTER*8 fldnom        ! name for the field
412      CHARACTER*8 filnom        ! name for the data file
413
414      INTEGER info, jf
415
416c
417#include "oasis.h"
418#include "clim.h"
419c
420#include "param_cou.h"
421c
422#include "inc_sipc.h"
423#include "inc_cpl.h"
424c
425c     Addition for SIPC CASE
426      INTEGER index
427      CHARACTER*3 cmodinf       ! Header or not
428      CHARACTER*3 cljobnam_r    ! Experiment name in the field brick, if any
429      INTEGER infos(3)          ! infos in the field brick, if any
430c
431c
432      WRITE (nuout,*) ' '
433      WRITE (nuout,*) 'Fromcpl: Read fields from CPL, kt=',kt
434      WRITE (nuout,*) ' '
435      CALL flush (nuout)
436
437      IF (cchan.eq.'PIPE') THEN
438c
439c UNIT number for fields
440c
441          nuread = 99
442c
443c exchanges from ocean=CPL to atmosphere
444c
445          DO jf=1,jpfldo2a
446            CALL PIPE_Model_Recv(cl_read(jf), icpliter, nuout)
447            OPEN (nuread, FILE=cl_f_read(jf), FORM='UNFORMATTED')
448            IF (jf.eq.1)
449     $          CALL locread(cl_read(jf), sst, imjm, nuread, iflag,
450     $          nuout)
451            IF (jf.eq.2)
452     $          CALL locread(cl_read(jf), sic, imjm, nuread, iflag,
453     $          nuout)
454            IF (jf.eq.3)
455     $          CALL locread(cl_read(jf), alb_sst, imjm, nuread, iflag,
456     $          nuout)
457            IF (jf.eq.4)
458     $          CALL locread(cl_read(jf), alb_sic, imjm, nuread, iflag,
459     $          nuout)
460            CLOSE (nuread)
461          END DO
462
463c
464      ELSE IF (cchan.eq.'SIPC') THEN
465c
466c         Define IF a header must be encapsulated within the field brick :
467          cmodinf = 'NOT'                 ! as $MODINFO in namcouple 
468c
469c         reading of input field sea-surface-temperature SISUTESU
470c
471c
472c         Index of sst in total number of fields jpfldo2a:
473          index = 1
474c
475          CALL SIPC_Read_Model(index, imjm, cmodinf,
476     $              cljobnam_r,infos, sst)
477c
478c         reading of input field sea-ice SIICECOV
479c
480c
481c         Index of sea-ice in total number of fields jpfldo2a:
482          index = 2
483c
484          CALL SIPC_Read_Model(index, imjm, cmodinf,
485     $              cljobnam_r,infos, sic)
486c         Index of open sea albedo in total number of fields jpfldo2a:
487          index = 3
488c
489          CALL SIPC_Read_Model(index, imjm, cmodinf,
490     $              cljobnam_r,infos, alb_sst)
491c         Index of sea-ice albedo in total number of fields jpfldo2a:
492          index = 4
493c
494          CALL SIPC_Read_Model(index, imjm, cmodinf,
495     $              cljobnam_r,infos, alb_sic)
496c
497c
498      ELSE IF (cchan.eq.'CLIM') THEN
499
500c
501c exchanges from ocean=CPL to atmosphere
502c
503        DO jf=1,jpfldo2a
504          IF (jf.eq.1) CALL CLIM_Import (cl_read(jf) , kt, sst, info)
505          IF (jf.eq.2) CALL CLIM_Import (cl_read(jf) , kt, sic, info)
506         IF (jf.eq.3) CALL CLIM_Import (cl_read(jf) , kt, alb_sst, info)
507         IF (jf.eq.4) CALL CLIM_Import (cl_read(jf) , kt, alb_sic, info)
508          IF ( info .NE. CLIM_Ok) THEN
509                WRITE(nuout,*)'Pb in reading ', cl_read(jf), jf
510                WRITE(nuout,*)'Couplage kt is = ',kt
511                WRITE(nuout,*)'CLIM error code is = ', info
512                WRITE(nuout,*)'STOP in Fromcpl'
513                STOP 'Fromcpl'
514            ENDIF
515          END DO
516
517      ENDIF
518c
519      RETURN
520      END
521
522
523      SUBROUTINE intocpl(kt,imjm,
524     .                   fsol, fnsol,
525     .                   rain, snow, evap, ruisoce, ruisriv,
526     .                   taux, tauy, last)
527      IMPLICIT NONE
528c
529c Laurent Z.X Li (Feb. 10, 1997): It provides several fields to the
530c coupler. Of course, it sends a message to the corresponding pipes
531c after the writting.
532c 3 techniques : pipes
533c                clim
534c                svipc
535c IF last time step WRITE output files anway
536c
537#include "oasis.h"
538
539      INTEGER kt, imjm
540c
541      REAL fsol(imjm)
542      REAL fnsol(imjm)
543      REAL rain(imjm)
544      REAL snow(imjm)
545      REAL evap(imjm)
546      REAL ruisoce(imjm)
547      REAL ruisriv(imjm)
548      REAL taux(imjm)
549      REAL tauy(imjm)
550      LOGICAL last
551c
552      INTEGER nuout
553      PARAMETER (nuout = 6)
554c
555c Additions for SVIPC
556c
557      INTEGER index
558      INTEGER infos(3)
559      CHARACTER*3 cmodinf       ! Header or not
560      CHARACTER*3 cljobnam      ! experiment name
561c
562#include "clim.h"
563c
564#include "param_cou.h"
565c
566#include "inc_sipc.h"
567#include "inc_cpl.h"
568c
569C
570      INTEGER nuwrit, ios
571      CHARACTER*8 pipnom
572      CHARACTER*8 fldnom
573      CHARACTER*6 file_name(jpmaxfld)
574      INTEGER max_file
575      INTEGER file_unit_max, file_unit(jpmaxfld),
576     $    file_unit_field(jpmaxfld)
577
578      INTEGER icstep, info, jn, jf, ierror
579      LOGICAL trouve
580c
581c
582      icstep=kt
583c
584      WRITE(nuout,*) ' '
585      WRITE(nuout,*) 'Intocpl: send fields to CPL, kt= ', kt
586      WRITE(nuout,*) ' '
587
588      IF (last.or.(cchan.eq.'PIPE')) THEN
589c
590c
591c WRITE fields for coupler with pipe technique or for last time step
592c
593c         initialisation
594c
595          max_file=1
596          file_unit_max=99
597c keeps first file name
598          file_name(max_file)=cl_f_writ(max_file)
599c keeps first file unit
600          file_unit(max_file)=file_unit_max
601c decrements file unit maximum
602          file_unit_max=file_unit_max-1
603c keeps file unit for field
604          file_unit_field(1)=file_unit(max_file)
605c
606c different files names counter
607c
608         
609          DO jf= 2, jpflda2o
610            trouve=.false.
611            DO jn= 1, max_file
612              IF (.not.trouve) THEN
613                  IF (cl_f_writ(jf).EQ.file_name(jn)) THEN
614c keep file unit for field
615                      file_unit_field(jf)=file_unit(jn)
616                      trouve=.true.
617                  END IF
618              END IF
619            END DO
620            IF (.not.trouve) then
621c increment the number of different files
622                max_file=max_file+1
623c keep file name
624                file_name(max_file)=cl_f_writ(jf)
625c keep file unit for file
626                file_unit(max_file)=file_unit_max
627c keep file unit for field
628                file_unit_field(jf)=file_unit(max_file)
629c decrement unit maximum number from 99 to 98, ...
630                file_unit_max=file_unit_max-1
631            END IF
632          END DO
633         
634          DO jn=1, max_file
635            OPEN (file_unit(jn), FILE=file_name(jn), FORM='UNFORMATTED')
636          END DO
637         
638          DO jf=1, jpflda2o
639            IF (jf.eq.1)
640     $          CALL locwrite(cl_writ(jf),fnsol, imjm,
641     $          file_unit_field(jf), ierror, nuout)
642            IF (jf.eq.2)
643     $          CALL locwrite(cl_writ(jf),fsol, imjm,
644     $          file_unit_field(jf), ierror, nuout)
645            IF (jf.eq.3)
646     $          CALL locwrite(cl_writ(jf),rain, imjm,
647     $          file_unit_field(jf), ierror, nuout)
648            IF (jf.eq.4)
649     $          CALL locwrite(cl_writ(jf),evap, imjm,
650     $          file_unit_field(jf), ierror, nuout)
651            IF (jf.eq.5)
652     $          CALL locwrite(cl_writ(jf),ruisoce, imjm,
653     $          file_unit_field(jf),ierror, nuout)
654            IF (jf.eq.6)
655     $          CALL locwrite(cl_writ(jf),ruisriv, imjm,
656     $          file_unit_field(jf),ierror, nuout)
657            IF (jf.eq.7)
658     $          CALL locwrite(cl_writ(jf),taux, imjm,
659     $          file_unit_field(jf), ierror, nuout)
660            IF (jf.eq.8)
661     $          CALL locwrite(cl_writ(jf),taux, imjm,
662     $          file_unit_field(jf), ierror, nuout)
663            IF (jf.eq.9)
664     $          CALL locwrite(cl_writ(jf),tauy, imjm,
665     $          file_unit_field(jf), ierror, nuout)
666            IF (jf.eq.10)
667     $          CALL locwrite(cl_writ(jf),tauy, imjm,
668     $          file_unit_field(jf), ierror, nuout)
669          END DO
670C
671C simulate a FLUSH
672C
673          DO jn=1, max_file
674            CLOSE (file_unit(jn))
675          END DO
676c
677c
678c
679          IF(cchan.eq.'CLIM') THEN
680c
681c inform PVM daemon, I have finished
682c
683              CALL CLIM_Quit (CLIM_ContPvm, info)
684              IF (info .NE. CLIM_Ok) THEN
685                  WRITE (6, *)
686     $                'An error occured while leaving CLIM. Error = ',
687     $                info
688              ENDIF
689             
690          END IF
691         
692      END IF
693     
694c
695c IF last we have finished
696c
697      IF (last) RETURN
698     
699      IF (cchan.eq.'PIPE') THEN
700c
701c Send message to pipes for CPL=ocean
702c
703          DO jf=1, jpflda2o
704            CALL PIPE_Model_Send(cl_writ(jf), kt, nuout)
705          END DO
706c
707c
708c
709      ELSE  IF(cchan.eq.'SIPC') THEN
710c
711c         Define IF a header must be encapsulated within the field brick :
712          cmodinf = 'NOT'                 ! as $MODINFO in namcouple 
713c
714c         IF cmodinf = 'YES', define encapsulated infos to be exchanged
715c                 infos(1) = initial date
716c                 infos(2) = timestep
717c                 infos(3) = actual time
718c
719c         Writing of output field non solar heat flux CONSFTOT
720c
721c         Index of non solar heat flux in total number of fields jpflda2o:
722          index = 1
723c   
724          CALL SIPC_Write_Model(index, imjm, cmodinf,
725     $                          cljobnam,infos,fnsol)
726c
727c
728c         Writing of output field solar heat flux COSHFTOT
729c
730c         Index of solar heat flux in total number of fields jpflda2o:
731          index = 2
732c   
733          CALL SIPC_Write_Model(index, imjm, cmodinf,
734     $                          cljobnam,infos,fsol)
735c
736c         Writing of output field rain COTOPRSU
737c
738c         Index of rain in total number of fields jpflda2o:
739          index = 3
740c   
741          CALL SIPC_Write_Model(index, imjm, cmodinf,
742     $                          cljobnam,infos, rain)
743c
744c         Writing of output field evap COTFSHSU
745c
746c         Index of evap in total number of fields jpflda2o:
747          index = 4
748c   
749          CALL SIPC_Write_Model(index, imjm, cmodinf,
750     $                          cljobnam,infos, evap)
751c
752c         Writing of output field ruisoce CORUNCOA
753c
754c         Index of ruisoce in total number of fields jpflda2o:
755          index = 5
756c   
757          CALL SIPC_Write_Model(index, imjm, cmodinf,
758     $                          cljobnam,infos, ruisoce)
759c
760c
761c         Writing of output field ruisriv CORIVFLU
762c
763c         Index of ruisriv in total number of fields jpflda2o:
764          index = 6
765c   
766          CALL SIPC_Write_Model(index, imjm, cmodinf,
767     $                          cljobnam,infos, ruisriv)
768c
769c
770c         Writing of output field zonal wind stress COZOTAUX
771c
772c         Index of runoff in total number of fields jpflda2o:
773          index = 7
774c   
775          CALL SIPC_Write_Model(index, imjm, cmodinf,
776     $                          cljobnam,infos, taux)
777c
778c         Writing of output field meridional wind stress COMETAUY
779c
780c         Index of runoff in total number of fields jpflda2o:
781          index = 8
782c   
783          CALL SIPC_Write_Model(index, imjm, cmodinf,
784     $                          cljobnam,infos, taux)
785c
786c
787c         Writing of output field zonal wind stress COMETAU2 (at v point)
788c
789c         Index of runoff in total number of fields jpflda2o:
790          index = 9
791c   
792          CALL SIPC_Write_Model(index, imjm, cmodinf,
793     $                          cljobnam,infos, tauy)
794c
795c         Writing of output field meridional wind stress COMETAU2
796c
797c         Index of runoff in total number of fields jpflda2o:
798          index = 10
799c   
800          CALL SIPC_Write_Model(index, imjm, cmodinf,
801     $                          cljobnam,infos, tauy)
802c
803c
804      ELSE IF(cchan.eq.'CLIM') THEN
805         
806          DO jn=1, jpflda2o
807           
808            IF (jn.eq.1) CALL CLIM_Export(cl_writ(jn), kt, fnsol, info)
809            IF (jn.eq.2) CALL CLIM_Export(cl_writ(jn), kt, fsol, info)
810            IF (jn.eq.3) CALL CLIM_Export(cl_writ(jn), kt, rain, info)
811            IF (jn.eq.4) CALL CLIM_Export(cl_writ(jn), kt, evap, info)
812            IF (jn.eq.5) CALL CLIM_Export(cl_writ(jn), kt, ruisoce, info
813     $          )
814            IF (jn.eq.6) CALL CLIM_Export(cl_writ(jn), kt, ruisriv, info
815     $          )
816            IF (jn.eq.7) CALL CLIM_Export(cl_writ(jn), kt, taux, info)
817            IF (jn.eq.8) CALL CLIM_Export(cl_writ(jn), kt, taux, info)
818            IF (jn.eq.9) CALL CLIM_Export(cl_writ(jn), kt, tauy, info)
819            IF (jn.eq.10) CALL CLIM_Export(cl_writ(jn), kt, tauy, info)
820           
821            IF (info .NE. CLIM_Ok) THEN
822                WRITE (nuout,*) 'STEP : Pb giving ',cl_writ(jn), ':',jn
823                WRITE (nuout,*) ' at timestep = ', icstep,'kt = ',kt
824                WRITE (nuout,*) 'Clim error code is = ',info
825                WRITE (nuout,*) 'STOP in intocpl '
826                CALL abort(' intocpl ')
827            ENDIF
828           
829          END DO
830         
831      ENDIF
832c
833      RETURN
834      END
835
836      SUBROUTINE locread
837      print *, 'Attention dans oasis.F, locread est non defini'
838      RETURN
839      END
840
841      SUBROUTINE locwrite
842      print *, 'Attention dans oasis.F, locwrite est non defini'
843      RETURN
844      END
845
846      SUBROUTINE pipe_model_define
847      print*,'Attention dans oasis.F, pipe_model_define est non defini'
848      RETURN
849      END
850
851      SUBROUTINE pipe_model_stepi
852      print*,'Attention dans oasis.F, pipe_model_stepi est non defini'
853      RETURN
854      END
855
856      SUBROUTINE pipe_model_recv
857      print *, 'Attention dans oasis.F, pipe_model_recv est non defini'
858      RETURN
859      END
860
861      SUBROUTINE pipe_model_send
862      print *, 'Attention dans oasis.F, pipe_model_send est non defini'
863      RETURN
864      END
865
866
Note: See TracBrowser for help on using the repository browser.