| 1 | ! |
|---|
| 2 | ! $Header$ |
|---|
| 3 | ! |
|---|
| 4 | C**** |
|---|
| 5 | C |
|---|
| 6 | C**** *INICMA* - Initialize coupled mode communication for atmosphere |
|---|
| 7 | C and exchange some initial information with Oasis |
|---|
| 8 | C |
|---|
| 9 | C Input: |
|---|
| 10 | C ----- |
|---|
| 11 | C KASTP : total number of timesteps in atmospheric model |
|---|
| 12 | C KEXCH : frequency of exchange (in time steps) |
|---|
| 13 | C KSTEP : length of timestep (in seconds) |
|---|
| 14 | C |
|---|
| 15 | C ----------------------------------------------------------- |
|---|
| 16 | C |
|---|
| 17 | SUBROUTINE inicma(kastp,kexch,kstep,imjm) |
|---|
| 18 | c |
|---|
| 19 | c INCLUDE "param.h" |
|---|
| 20 | c |
|---|
| 21 | INTEGER kastp, kexch, kstep,imjm,klon |
|---|
| 22 | INTEGER iparal(3) |
|---|
| 23 | INTEGER ifcpl, idt, info, imxtag, istep, jf |
|---|
| 24 | |
|---|
| 25 | c -- LOOP |
|---|
| 26 | c |
|---|
| 27 | #include "dimensions.h" |
|---|
| 28 | INTEGER jjmp1 |
|---|
| 29 | PARAMETER (jjmp1=jjm+1-1/jjm) |
|---|
| 30 | #include "dimphy.h" |
|---|
| 31 | c REAL zu10m(klon), zv10m(klon) |
|---|
| 32 | REAL zwindsp(klon) |
|---|
| 33 | c |
|---|
| 34 | c -- LOOP |
|---|
| 35 | c |
|---|
| 36 | #include "param_cou.h" |
|---|
| 37 | #include "inc_cpl.h" |
|---|
| 38 | CHARACTER*3 cljobnam ! experiment name |
|---|
| 39 | CHARACTER*6 clmodnam ! model name |
|---|
| 40 | c EM: not used by Oasis2.4 |
|---|
| 41 | CEM CHARACTER*6 clbid(2) ! for CLIM_Init call (not used) |
|---|
| 42 | CEM ! must be dimensioned by the number of models |
|---|
| 43 | CEM INTEGER nbid(2) ! for CLIM_Init call (not used) |
|---|
| 44 | CEM ! must be dimensioned by the number of models |
|---|
| 45 | CHARACTER*5 cloasis ! coupler name (Oasis) |
|---|
| 46 | INTEGER imess(4) |
|---|
| 47 | INTEGER getpid ! system functions |
|---|
| 48 | INTEGER nuout |
|---|
| 49 | CEM LOGICAL llmodel |
|---|
| 50 | PARAMETER (nuout = 6) |
|---|
| 51 | c |
|---|
| 52 | #include "clim.h" |
|---|
| 53 | #include "mpiclim.h" |
|---|
| 54 | c |
|---|
| 55 | #include "oasis.h" |
|---|
| 56 | ! contains the name of communication technique. Here |
|---|
| 57 | ! cchan=CLIM only is possible. |
|---|
| 58 | c ! ctype=MPI2 |
|---|
| 59 | c |
|---|
| 60 | C ----------------------------------------------------------- |
|---|
| 61 | C |
|---|
| 62 | C* 1. Initializations |
|---|
| 63 | C --------------- |
|---|
| 64 | C |
|---|
| 65 | WRITE(nuout,*) ' ' |
|---|
| 66 | WRITE(nuout,*) ' ' |
|---|
| 67 | WRITE(nuout,*) ' ROUTINE INICMA' |
|---|
| 68 | WRITE(nuout,*) ' **************' |
|---|
| 69 | WRITE(nuout,*) ' ' |
|---|
| 70 | WRITE(nuout,*) ' ' |
|---|
| 71 | c |
|---|
| 72 | c Define the model name |
|---|
| 73 | c |
|---|
| 74 | clmodnam = 'lmdz.x' ! as in $NBMODEL in Cpl/Nam/namcouple.tmp |
|---|
| 75 | c |
|---|
| 76 | c Define the coupler name |
|---|
| 77 | c |
|---|
| 78 | cloasis = 'Oasis' ! always 'Oasis' as in the coupler |
|---|
| 79 | c |
|---|
| 80 | c |
|---|
| 81 | c Define symbolic name for fields exchanged from atmos to coupler, |
|---|
| 82 | c must be the same as (1) of the field definition in namcouple: |
|---|
| 83 | c |
|---|
| 84 | cl_writ(8)='COSHFICE' |
|---|
| 85 | cl_writ(9)='COSHFOCE' |
|---|
| 86 | cl_writ(10)='CONSFICE' |
|---|
| 87 | cl_writ(11)='CONSFOCE' |
|---|
| 88 | cl_writ(12)='CODFLXDT' |
|---|
| 89 | c cl_writ(6)='COICTEMP' |
|---|
| 90 | cl_writ(13)='COTFSICE' |
|---|
| 91 | cl_writ(14)='COTFSOCE' |
|---|
| 92 | cl_writ(15)='COTOLPSU' |
|---|
| 93 | cl_writ(16)='COTOSPSU' |
|---|
| 94 | cl_writ(17)='CORUNCOA' |
|---|
| 95 | cl_writ(18)='CORIVFLU' |
|---|
| 96 | cl_writ(19)='COCALVIN' |
|---|
| 97 | c$$$ cl_writ(13)='COZOTAUX' |
|---|
| 98 | c$$$ cl_writ(14)='COZOTAUV' |
|---|
| 99 | c$$$ cl_writ(15)='COMETAUY' |
|---|
| 100 | c$$$ cl_writ(16)='COMETAUU' |
|---|
| 101 | cl_writ(1)='COTAUXXU' |
|---|
| 102 | cl_writ(2)='COTAUYYU' |
|---|
| 103 | cl_writ(3)='COTAUZZU' |
|---|
| 104 | cl_writ(4)='COTAUXXV' |
|---|
| 105 | cl_writ(5)='COTAUYYV' |
|---|
| 106 | cl_writ(6)='COTAUZZV' |
|---|
| 107 | c -- LOOP |
|---|
| 108 | cl_writ(7)='COWINDSP' |
|---|
| 109 | c -- LOOP |
|---|
| 110 | c |
|---|
| 111 | c Define files name for fields exchanged from atmos to coupler, |
|---|
| 112 | c must be the same as (6) of the field definition in namcouple: |
|---|
| 113 | c |
|---|
| 114 | cl_f_writ(1)='flxatmos' |
|---|
| 115 | cl_f_writ(2)='flxatmos' |
|---|
| 116 | cl_f_writ(3)='flxatmos' |
|---|
| 117 | cl_f_writ(4)='flxatmos' |
|---|
| 118 | cl_f_writ(5)='flxatmos' |
|---|
| 119 | cl_f_writ(6)='flxatmos' |
|---|
| 120 | cl_f_writ(7)='flxatmos' |
|---|
| 121 | cl_f_writ(8)='flxatmos' |
|---|
| 122 | cl_f_writ(9)='flxatmos' |
|---|
| 123 | cl_f_writ(10)='flxatmos' |
|---|
| 124 | cl_f_writ(11)='flxatmos' |
|---|
| 125 | cl_f_writ(12)='flxatmos' |
|---|
| 126 | cl_f_writ(13)='flxatmos' |
|---|
| 127 | cl_f_writ(14)='flxatmos' |
|---|
| 128 | cl_f_writ(15)='flxatmos' |
|---|
| 129 | cl_f_writ(16)='flxatmos' |
|---|
| 130 | cl_f_writ(17)='flxatmos' |
|---|
| 131 | cl_f_writ(18)='flxatmos' |
|---|
| 132 | c -- LOOP |
|---|
| 133 | cl_f_writ(19)='flxatmos' |
|---|
| 134 | c -- LOOP |
|---|
| 135 | |
|---|
| 136 | c |
|---|
| 137 | c |
|---|
| 138 | c Define symbolic name for fields exchanged from coupler to atmosphere, |
|---|
| 139 | c must be the same as (2) of the field definition in namcouple: |
|---|
| 140 | c |
|---|
| 141 | cl_read(1)='SISUTESW' |
|---|
| 142 | cl_read(2)='SIICECOV' |
|---|
| 143 | cl_read(3)='SIICEALW' |
|---|
| 144 | cl_read(4)='SIICTEMW' |
|---|
| 145 | c |
|---|
| 146 | c Define files names for fields exchanged from coupler to atmosphere, |
|---|
| 147 | c must be the same as (7) of the field definition in namcouple: |
|---|
| 148 | c |
|---|
| 149 | cl_f_read(1)='sstatmos' |
|---|
| 150 | cl_f_read(2)='sstatmos' |
|---|
| 151 | cl_f_read(3)='sstatmos' |
|---|
| 152 | cl_f_read(4)='sstatmos' |
|---|
| 153 | c |
|---|
| 154 | c |
|---|
| 155 | c Define the number of processors involved in the coupling for |
|---|
| 156 | c Oasis (=1) and each model (as last two INTEGER on $CHATYPE line |
|---|
| 157 | c in the namcouple); they will be stored in a COMMON in mpiclim.h |
|---|
| 158 | c (used for CLIM/MPI2 only) |
|---|
| 159 | mpi_nproc(0)=1 |
|---|
| 160 | mpi_nproc(1)=1 |
|---|
| 161 | mpi_nproc(2)=1 |
|---|
| 162 | c |
|---|
| 163 | c Define infos to be sent initially to oasis |
|---|
| 164 | c |
|---|
| 165 | imess(1) = kastp ! total number of timesteps in atmospheric model |
|---|
| 166 | imess(2) = kexch ! period of exchange (in time steps) |
|---|
| 167 | imess(3) = kstep ! length of atmospheric timestep (in seconds) |
|---|
| 168 | imess(4) = getpid() ! PID of atmospheric model |
|---|
| 169 | c |
|---|
| 170 | c Initialization and exchange of initial info in the CLIM technique |
|---|
| 171 | c |
|---|
| 172 | IF (cchan.eq.'CLIM') THEN |
|---|
| 173 | c |
|---|
| 174 | c Define the experiment name : |
|---|
| 175 | c |
|---|
| 176 | cljobnam = 'CLI' ! as $JOBNAM in namcouple |
|---|
| 177 | c |
|---|
| 178 | c Start the coupling |
|---|
| 179 | c (see lib/clim/src/CLIM_Init for the definition of input parameters) |
|---|
| 180 | c |
|---|
| 181 | cEM clbid(1)=' ' |
|---|
| 182 | cEM clbid(2)=' ' |
|---|
| 183 | cEM nbid(1)=0 |
|---|
| 184 | cEM nbid(2)=0 |
|---|
| 185 | CEM llmodel=.true. |
|---|
| 186 | c |
|---|
| 187 | c Define the number of processors used by each model as in |
|---|
| 188 | c $CHATYPE line of namcouple (used for CLIM/MPI2 only) |
|---|
| 189 | mpi_totproc(1)=1 |
|---|
| 190 | mpi_totproc(2)=1 |
|---|
| 191 | c |
|---|
| 192 | c Define names of each model as in $NBMODEL line of namcouple |
|---|
| 193 | c (used for CLIM/MPI2 only) |
|---|
| 194 | cmpi_modnam(1)='lmdz.x' |
|---|
| 195 | cmpi_modnam(2)='opa.xx' |
|---|
| 196 | c Start the coupling |
|---|
| 197 | c |
|---|
| 198 | CALL CLIM_Init ( cljobnam, clmodnam, 3, 7, |
|---|
| 199 | * kastp, kexch, kstep, |
|---|
| 200 | * 5, 3600, 3600, info ) |
|---|
| 201 | c |
|---|
| 202 | IF (info.ne.CLIM_Ok) THEN |
|---|
| 203 | WRITE ( nuout, *) ' inicma : pb init clim ' |
|---|
| 204 | WRITE ( nuout, *) ' error code is = ', info |
|---|
| 205 | CALL halte('STOP in inicma') |
|---|
| 206 | ELSE |
|---|
| 207 | WRITE(nuout,*) 'inicma : init clim ok ' |
|---|
| 208 | ENDIF |
|---|
| 209 | c |
|---|
| 210 | c For each coupling field, association of a port to its symbolic name |
|---|
| 211 | c |
|---|
| 212 | c -Define the parallel decomposition associated to the port of each |
|---|
| 213 | c field; here no decomposition for all ports. |
|---|
| 214 | iparal ( clim_strategy ) = clim_serial |
|---|
| 215 | iparal ( clim_length ) = imjm |
|---|
| 216 | iparal ( clim_offset ) = 0 |
|---|
| 217 | c |
|---|
| 218 | c -Loop on total number of coupler-to-atmosphere fields |
|---|
| 219 | c (see lib/clim/src/CLIM_Define for the definition of input parameters) |
|---|
| 220 | DO jf=1, jpfldo2a |
|---|
| 221 | CALL CLIM_Define (cl_read(jf), clim_in , clim_double, iparal |
|---|
| 222 | $ , info ) |
|---|
| 223 | WRITE(nuout,*) 'inicma : clim define done for ',jf |
|---|
| 224 | $ ,cl_read(jf) |
|---|
| 225 | END DO |
|---|
| 226 | c |
|---|
| 227 | c -Loop on total number of atmosphere-to-coupler fields |
|---|
| 228 | c (see lib/clim/src/CLIM_Define for the definition of input parameters) |
|---|
| 229 | DO jf=1, jpflda2o1+jpflda2o2 |
|---|
| 230 | CALL CLIM_Define (cl_writ(jf), clim_out , clim_double, |
|---|
| 231 | $ iparal, info ) |
|---|
| 232 | WRITE(nuout,*) 'inicma : clim define done for ',jf |
|---|
| 233 | $ ,cl_writ(jf) |
|---|
| 234 | END DO |
|---|
| 235 | c |
|---|
| 236 | WRITE(nuout,*) 'inicma : clim_define ok ' |
|---|
| 237 | c |
|---|
| 238 | c -Join a pvm group, wait for other programs and broadcast usefull |
|---|
| 239 | c informations to Oasis and to the ocean (see lib/clim/src/CLIM_Start) |
|---|
| 240 | CALL CLIM_Start ( imxtag, info ) |
|---|
| 241 | IF (info.ne.clim_ok) THEN |
|---|
| 242 | WRITE ( nuout, *) 'inicma : pb start clim ' |
|---|
| 243 | WRITE ( nuout, *) ' error code is = ', info |
|---|
| 244 | CALL halte('stop in inicma') |
|---|
| 245 | ELSE |
|---|
| 246 | WRITE ( nuout, *) 'inicma : start clim ok ' |
|---|
| 247 | ENDIF |
|---|
| 248 | c |
|---|
| 249 | c -Get initial information from Oasis |
|---|
| 250 | c (see lib/clim/src/CLIM_Stepi) |
|---|
| 251 | CALL CLIM_Stepi (cloasis, istep, ifcpl, idt, info) |
|---|
| 252 | IF (info .NE. clim_ok) THEN |
|---|
| 253 | WRITE ( UNIT = nuout, FMT = *) |
|---|
| 254 | $ ' warning : problem in getting step info ', |
|---|
| 255 | $ 'from oasis ' |
|---|
| 256 | WRITE (UNIT = nuout, FMT = *) |
|---|
| 257 | $ ' ======= error code number = ', info |
|---|
| 258 | ELSE |
|---|
| 259 | WRITE (UNIT = nuout, FMT = *) |
|---|
| 260 | $ ' got step information from oasis ' |
|---|
| 261 | ENDIF |
|---|
| 262 | WRITE ( nuout, *) ' number of tstep in oasis ', istep |
|---|
| 263 | WRITE ( nuout, *) ' exchange frequency in oasis ', ifcpl |
|---|
| 264 | WRITE ( nuout, *) ' length of tstep in oasis ', idt |
|---|
| 265 | ENDIF |
|---|
| 266 | |
|---|
| 267 | RETURN |
|---|
| 268 | END |
|---|
| 269 | |
|---|
| 270 | c $Id: oasis.true 590 2005-02-07 16:41:35Z lmdzadmin $ |
|---|
| 271 | SUBROUTINE fromcpl(kt, imjm, sst, gla, tice, albedo) |
|---|
| 272 | c ====================================================================== |
|---|
| 273 | c S. Valcke (02/99) adapted From L.Z.X Li: this subroutine reads the SST |
|---|
| 274 | c and Sea-Ice provided by the coupler with the CLIM (PVM exchange messages) |
|---|
| 275 | c technique. |
|---|
| 276 | c====================================================================== |
|---|
| 277 | IMPLICIT none |
|---|
| 278 | INTEGER imjm, kt |
|---|
| 279 | REAL sst(imjm) ! sea-surface-temperature |
|---|
| 280 | REAL gla(imjm) ! sea-ice |
|---|
| 281 | REAL tice(imjm) ! temp glace |
|---|
| 282 | REAL albedo(imjm) ! albedo glace |
|---|
| 283 | c |
|---|
| 284 | INTEGER nuout ! listing output unit |
|---|
| 285 | PARAMETER (nuout=6) |
|---|
| 286 | c |
|---|
| 287 | INTEGER nuread, ios, iflag, icpliter |
|---|
| 288 | INTEGER info, jf |
|---|
| 289 | c |
|---|
| 290 | #include "clim.h" |
|---|
| 291 | c |
|---|
| 292 | #include "oasis.h" |
|---|
| 293 | #include "param_cou.h" |
|---|
| 294 | c |
|---|
| 295 | #include "inc_cpl.h" |
|---|
| 296 | c |
|---|
| 297 | c |
|---|
| 298 | WRITE (nuout,*) ' ' |
|---|
| 299 | WRITE (nuout,*) 'Fromcpl: Reading fields from CPL, kt=',kt |
|---|
| 300 | WRITE (nuout,*) ' ' |
|---|
| 301 | CALL flush (nuout) |
|---|
| 302 | |
|---|
| 303 | |
|---|
| 304 | IF (cchan.eq.'CLIM') THEN |
|---|
| 305 | |
|---|
| 306 | c |
|---|
| 307 | c -Get interpolated oceanic fields from Oasis |
|---|
| 308 | c |
|---|
| 309 | DO jf=1,jpfldo2a |
|---|
| 310 | IF (jf.eq.1) CALL CLIM_Import (cl_read(jf) , kt, sst, info) |
|---|
| 311 | IF (jf.eq.2) CALL CLIM_Import (cl_read(jf) , kt, gla, info) |
|---|
| 312 | IF (jf.eq.3) CALL CLIM_Import (cl_read(jf), kt,albedo, info) |
|---|
| 313 | IF (jf.eq.4) CALL CLIM_Import (cl_read(jf) , kt, tice, info) |
|---|
| 314 | IF ( info .NE. CLIM_Ok) THEN |
|---|
| 315 | WRITE(nuout,*)'Pb in reading ', cl_read(jf), jf |
|---|
| 316 | WRITE(nuout,*)'Couplage kt is = ',kt |
|---|
| 317 | WRITE(nuout,*)'CLIM error code is = ', info |
|---|
| 318 | CALL halte('STOP in fromcpl.F') |
|---|
| 319 | ENDIF |
|---|
| 320 | END DO |
|---|
| 321 | |
|---|
| 322 | ENDIF |
|---|
| 323 | c |
|---|
| 324 | RETURN |
|---|
| 325 | END |
|---|
| 326 | |
|---|
| 327 | c $Id: oasis.true 590 2005-02-07 16:41:35Z lmdzadmin $ |
|---|
| 328 | SUBROUTINE intocpl(kt, imjm, fsolice, fsolwat, fnsolice, fnsolwat, |
|---|
| 329 | $ fnsicedt, evice, evwat, lpre, spre, dirunoff, rivrunoff, |
|---|
| 330 | $ calving, tauxx_u, tauyy_u, tauzz_u, tauxx_v, tauyy_v, tauzz_v, |
|---|
| 331 | c -- LOOP |
|---|
| 332 | $ windsp, last) |
|---|
| 333 | c -- LOOP |
|---|
| 334 | c ====================================================================== |
|---|
| 335 | c S. Valcke (02/99) adapted From L.Z.X Li: this subroutine provides the |
|---|
| 336 | c atmospheric coupling fields to the coupler with the CLIM (PVM exchange |
|---|
| 337 | c messages) technique. |
|---|
| 338 | c IF last time step, writes output fields to binary files. |
|---|
| 339 | c ====================================================================== |
|---|
| 340 | IMPLICIT NONE |
|---|
| 341 | c -- LOOP |
|---|
| 342 | c |
|---|
| 343 | #include "dimensions.h" |
|---|
| 344 | INTEGER jjmp1 |
|---|
| 345 | PARAMETER (jjmp1=jjm+1-1/jjm) |
|---|
| 346 | #include "dimphy.h" |
|---|
| 347 | c REAL zu10m(klon), zv10m(klon) |
|---|
| 348 | REAL zwindsp(klon) |
|---|
| 349 | c |
|---|
| 350 | c -- LOOP |
|---|
| 351 | c |
|---|
| 352 | |
|---|
| 353 | INTEGER kt, imjm |
|---|
| 354 | c |
|---|
| 355 | REAL fsolice(imjm) |
|---|
| 356 | REAL fsolwat(imjm) |
|---|
| 357 | REAL fnsolwat(imjm) |
|---|
| 358 | REAL fnsolice(imjm) |
|---|
| 359 | REAL fnsicedt(imjm) |
|---|
| 360 | REAL evice(imjm) |
|---|
| 361 | REAL evwat(imjm) |
|---|
| 362 | REAL lpre(imjm) |
|---|
| 363 | REAL spre(imjm) |
|---|
| 364 | REAL dirunoff(imjm) |
|---|
| 365 | REAL rivrunoff(imjm) |
|---|
| 366 | REAL calving(imjm) |
|---|
| 367 | c$$$ REAL tauxu(imjm) |
|---|
| 368 | c$$$ REAL tauxv(imjm) |
|---|
| 369 | c$$$ REAL tauyu(imjm) |
|---|
| 370 | c$$$ REAL tauyv(imjm) |
|---|
| 371 | REAL tauxx_u(imjm) |
|---|
| 372 | REAL tauxx_v(imjm) |
|---|
| 373 | REAL tauyy_u(imjm) |
|---|
| 374 | REAL tauyy_v(imjm) |
|---|
| 375 | REAL tauzz_u(imjm) |
|---|
| 376 | REAL tauzz_v(imjm) |
|---|
| 377 | c -- LOOP |
|---|
| 378 | REAL windsp(imjm) |
|---|
| 379 | c -- LOOP |
|---|
| 380 | LOGICAL last |
|---|
| 381 | c |
|---|
| 382 | INTEGER nuout |
|---|
| 383 | PARAMETER (nuout = 6) |
|---|
| 384 | c |
|---|
| 385 | #include "clim.h" |
|---|
| 386 | #include "param_cou.h" |
|---|
| 387 | #include "inc_cpl.h" |
|---|
| 388 | c |
|---|
| 389 | CHARACTER*8 file_name(jpmaxfld) |
|---|
| 390 | INTEGER max_file |
|---|
| 391 | INTEGER file_unit_max, file_unit(jpmaxfld), |
|---|
| 392 | $ file_unit_field(jpmaxfld) |
|---|
| 393 | |
|---|
| 394 | INTEGER icstep, info, jn, jf, ierror |
|---|
| 395 | LOGICAL trouve |
|---|
| 396 | c |
|---|
| 397 | #include "oasis.h" |
|---|
| 398 | c |
|---|
| 399 | icstep=kt |
|---|
| 400 | c |
|---|
| 401 | WRITE(nuout,*) ' ' |
|---|
| 402 | WRITE(nuout,*) 'Intocpl: sending fields to CPL, kt= ', kt |
|---|
| 403 | WRITE(nuout,*) 'last ', last |
|---|
| 404 | WRITE(nuout,*) |
|---|
| 405 | |
|---|
| 406 | IF (last) THEN |
|---|
| 407 | c |
|---|
| 408 | c -WRITE fields to binary files for coupler restart at last time step |
|---|
| 409 | c |
|---|
| 410 | c -initialisation and files opening |
|---|
| 411 | c |
|---|
| 412 | max_file=1 |
|---|
| 413 | file_unit_max=99 |
|---|
| 414 | c -keeps first file name |
|---|
| 415 | file_name(max_file)=cl_f_writ(max_file) |
|---|
| 416 | c -keeps first file unit |
|---|
| 417 | file_unit(max_file)=file_unit_max |
|---|
| 418 | c -decrements file unit maximum |
|---|
| 419 | file_unit_max=file_unit_max-1 |
|---|
| 420 | c -keeps file unit for field |
|---|
| 421 | file_unit_field(1)=file_unit(max_file) |
|---|
| 422 | c |
|---|
| 423 | c -different files names counter |
|---|
| 424 | c |
|---|
| 425 | DO jf= 2, jpflda2o1 + jpflda2o2 |
|---|
| 426 | trouve=.false. |
|---|
| 427 | DO jn= 1, max_file |
|---|
| 428 | IF (.not.trouve) THEN |
|---|
| 429 | IF (cl_f_writ(jf).EQ.file_name(jn)) THEN |
|---|
| 430 | c -keep file unit for field |
|---|
| 431 | file_unit_field(jf)=file_unit(jn) |
|---|
| 432 | trouve=.true. |
|---|
| 433 | END IF |
|---|
| 434 | END IF |
|---|
| 435 | END DO |
|---|
| 436 | IF (.not.trouve) then |
|---|
| 437 | c -increment the number of different files |
|---|
| 438 | max_file=max_file+1 |
|---|
| 439 | c -keep file name |
|---|
| 440 | file_name(max_file)=cl_f_writ(jf) |
|---|
| 441 | c -keep file unit for file |
|---|
| 442 | file_unit(max_file)=file_unit_max |
|---|
| 443 | c -keep file unit for field |
|---|
| 444 | file_unit_field(jf)=file_unit(max_file) |
|---|
| 445 | c -decrement unit maximum number from 99 to 98, ... |
|---|
| 446 | file_unit_max=file_unit_max-1 |
|---|
| 447 | END IF |
|---|
| 448 | END DO |
|---|
| 449 | c |
|---|
| 450 | DO jn=1, max_file |
|---|
| 451 | OPEN (file_unit(jn), FILE=file_name(jn), FORM='UNFORMATTED') |
|---|
| 452 | WRITE(*,*) 'Opening FILE ', file_unit(jn), ' ' |
|---|
| 453 | $ , file_name(jn) |
|---|
| 454 | REWIND(file_unit(jn)) |
|---|
| 455 | END DO |
|---|
| 456 | c |
|---|
| 457 | c WRITE fields to files |
|---|
| 458 | DO jf=1, jpflda2o1 + jpflda2o2 |
|---|
| 459 | IF (jf.eq.8) |
|---|
| 460 | $ CALL locwrite(cl_writ(jf),fsolice, imjm, |
|---|
| 461 | $ file_unit_field(jf), ierror) |
|---|
| 462 | IF (jf.eq.9) |
|---|
| 463 | $ CALL locwrite(cl_writ(jf),fsolwat, imjm, |
|---|
| 464 | $ file_unit_field(jf), ierror) |
|---|
| 465 | IF (jf.eq.10) |
|---|
| 466 | $ CALL locwrite(cl_writ(jf),fnsolice, imjm, |
|---|
| 467 | $ file_unit_field(jf), ierror) |
|---|
| 468 | IF (jf.eq.11) |
|---|
| 469 | $ CALL locwrite(cl_writ(jf),fnsolwat, imjm, |
|---|
| 470 | $ file_unit_field(jf), ierror) |
|---|
| 471 | IF (jf.eq.12) |
|---|
| 472 | $ CALL locwrite(cl_writ(jf),fnsicedt, imjm, |
|---|
| 473 | $ file_unit_field(jf), ierror) |
|---|
| 474 | c IF (jf.eq.13) |
|---|
| 475 | c $ CALL locwrite(cl_writ(jf),ictemp, imjm, |
|---|
| 476 | c $ file_unit_field(jf), ierror) |
|---|
| 477 | IF (jf.eq.13) |
|---|
| 478 | $ CALL locwrite(cl_writ(jf),evice, imjm, |
|---|
| 479 | $ file_unit_field(jf), ierror) |
|---|
| 480 | IF (jf.eq.14) |
|---|
| 481 | $ CALL locwrite(cl_writ(jf),evwat, imjm, |
|---|
| 482 | $ file_unit_field(jf), ierror) |
|---|
| 483 | IF (jf.eq.15) |
|---|
| 484 | $ CALL locwrite(cl_writ(jf),lpre, imjm, |
|---|
| 485 | $ file_unit_field(jf), ierror) |
|---|
| 486 | IF (jf.eq.16) |
|---|
| 487 | $ CALL locwrite(cl_writ(jf),spre, imjm, |
|---|
| 488 | $ file_unit_field(jf), ierror) |
|---|
| 489 | IF (jf.eq.17) |
|---|
| 490 | $ CALL locwrite(cl_writ(jf),dirunoff, imjm, |
|---|
| 491 | $ file_unit_field(jf), ierror) |
|---|
| 492 | IF (jf.eq.18) |
|---|
| 493 | $ CALL locwrite(cl_writ(jf),rivrunoff, imjm, |
|---|
| 494 | $ file_unit_field(jf), ierror) |
|---|
| 495 | IF (jf.eq.19) |
|---|
| 496 | $ CALL locwrite(cl_writ(jf),calving, imjm, |
|---|
| 497 | $ file_unit_field(jf), ierror) |
|---|
| 498 | c$$$ IF (jf.eq.13) |
|---|
| 499 | c$$$ $ CALL locwrite(cl_writ(jf),tauxu, imjm, |
|---|
| 500 | c$$$ $ file_unit_field(jf),ierror) |
|---|
| 501 | c$$$ IF (jf.eq.1') |
|---|
| 502 | c$$$ $ CALL locwrite(cl_writ(jf),tauxv, imjm, |
|---|
| 503 | c$$$ $ file_unit_field(jf),ierror) |
|---|
| 504 | c$$$ IF (jf.eq.15) |
|---|
| 505 | c$$$ $ CALL locwrite(cl_writ(jf),tauyv, imjm, |
|---|
| 506 | c$$$ $ file_unit_field(jf),ierror) |
|---|
| 507 | c$$$ IF (jf.eq.16) |
|---|
| 508 | c$$$ $ CALL locwrite(cl_writ(jf),tauyu, imjm, |
|---|
| 509 | c$$$ $ file_unit_field(jf), ierror) |
|---|
| 510 | IF (jf.eq.1) |
|---|
| 511 | $ CALL locwrite(cl_writ(jf),tauxx_u, imjm, |
|---|
| 512 | $ file_unit_field(jf),ierror) |
|---|
| 513 | IF (jf.eq.2) |
|---|
| 514 | $ CALL locwrite(cl_writ(jf),tauyy_u, imjm, |
|---|
| 515 | $ file_unit_field(jf),ierror) |
|---|
| 516 | IF (jf.eq.3) |
|---|
| 517 | $ CALL locwrite(cl_writ(jf),tauzz_u, imjm, |
|---|
| 518 | $ file_unit_field(jf),ierror) |
|---|
| 519 | IF (jf.eq.4) |
|---|
| 520 | $ CALL locwrite(cl_writ(jf),tauxx_v, imjm, |
|---|
| 521 | $ file_unit_field(jf),ierror) |
|---|
| 522 | IF (jf.eq.5) |
|---|
| 523 | $ CALL locwrite(cl_writ(jf),tauyy_v, imjm, |
|---|
| 524 | $ file_unit_field(jf),ierror) |
|---|
| 525 | IF (jf.eq.6) |
|---|
| 526 | $ CALL locwrite(cl_writ(jf),tauzz_v, imjm, |
|---|
| 527 | $ file_unit_field(jf),ierror) |
|---|
| 528 | c -- LOOP |
|---|
| 529 | IF (jf.eq.7) |
|---|
| 530 | $ CALL locwrite(cl_writ(jf),windsp, imjm, |
|---|
| 531 | $ file_unit_field(jf),ierror) |
|---|
| 532 | c -- LOOP |
|---|
| 533 | |
|---|
| 534 | END DO |
|---|
| 535 | C |
|---|
| 536 | C -simulate a FLUSH |
|---|
| 537 | C |
|---|
| 538 | DO jn=1, max_file |
|---|
| 539 | CLOSE (file_unit(jn)) |
|---|
| 540 | END DO |
|---|
| 541 | C |
|---|
| 542 | C |
|---|
| 543 | IF(cchan.eq.'CLIM') THEN |
|---|
| 544 | C |
|---|
| 545 | C -inform PVM daemon that message exchange is finished |
|---|
| 546 | C |
|---|
| 547 | CALL CLIM_Quit (CLIM_ContPvm, info) |
|---|
| 548 | IF (info .NE. CLIM_Ok) THEN |
|---|
| 549 | WRITE (6, *) |
|---|
| 550 | $ 'An error occured while leaving CLIM. Error = ', |
|---|
| 551 | $ info |
|---|
| 552 | ENDIF |
|---|
| 553 | END IF |
|---|
| 554 | RETURN |
|---|
| 555 | END IF |
|---|
| 556 | C |
|---|
| 557 | IF(cchan.eq.'CLIM') THEN |
|---|
| 558 | C |
|---|
| 559 | C -Give atmospheric fields to Oasis |
|---|
| 560 | C |
|---|
| 561 | DO jn=1, jpflda2o1 + jpflda2o2 |
|---|
| 562 | C |
|---|
| 563 | IF (jn.eq.8) CALL CLIM_Export(cl_writ(jn), kt, fsolice, info) |
|---|
| 564 | IF (jn.eq.9) CALL CLIM_Export(cl_writ(jn), kt, fsolwat, info) |
|---|
| 565 | IF (jn.eq.10) CALL CLIM_Export(cl_writ(jn), kt, fnsolice, info) |
|---|
| 566 | IF (jn.eq.11) CALL CLIM_Export(cl_writ(jn), kt, fnsolwat, info) |
|---|
| 567 | IF (jn.eq.12) CALL CLIM_Export(cl_writ(jn), kt, fnsicedt, info) |
|---|
| 568 | c IF (jn.eq.6) CALL CLIM_Export(cl_writ(jn), kt, ictemp, info) |
|---|
| 569 | IF (jn.eq.13) CALL CLIM_Export(cl_writ(jn), kt, evice, info) |
|---|
| 570 | IF (jn.eq.14) CALL CLIM_Export(cl_writ(jn), kt, evwat, info) |
|---|
| 571 | IF (jn.eq.15) CALL CLIM_Export(cl_writ(jn), kt, lpre, info) |
|---|
| 572 | IF (jn.eq.16) CALL CLIM_Export(cl_writ(jn), kt, spre, info) |
|---|
| 573 | IF (jn.eq.17) CALL CLIM_Export(cl_writ(jn),kt,dirunoff, info) |
|---|
| 574 | IF (jn.eq.18) CALL CLIM_Export(cl_writ(jn),kt,rivrunoff,info) |
|---|
| 575 | IF (jn.eq.19) CALL CLIM_Export(cl_writ(jn),kt,calving,info) |
|---|
| 576 | c$$$ IF (jn.eq.13) CALL CLIM_Export(cl_writ(jn), kt, tauxu, info) |
|---|
| 577 | c$$$ IF (jn.eq.14) CALL CLIM_Export(cl_writ(jn), kt, tauxv, info) |
|---|
| 578 | c$$$ IF (jn.eq.15) CALL CLIM_Export(cl_writ(jn), kt, tauyv, info) |
|---|
| 579 | c$$$ IF (jn.eq.16) CALL CLIM_Export(cl_writ(jn), kt, tauyu, info) |
|---|
| 580 | IF (jn.eq.1) CALL CLIM_Export(cl_writ(jn), kt, tauxx_u, info) |
|---|
| 581 | IF (jn.eq.2) CALL CLIM_Export(cl_writ(jn), kt, tauyy_u, info) |
|---|
| 582 | IF (jn.eq.3) CALL CLIM_Export(cl_writ(jn), kt, tauzz_u, info) |
|---|
| 583 | IF (jn.eq.4) CALL CLIM_Export(cl_writ(jn), kt, tauxx_v, info) |
|---|
| 584 | IF (jn.eq.5) CALL CLIM_Export(cl_writ(jn), kt, tauyy_v, info) |
|---|
| 585 | IF (jn.eq.6) CALL CLIM_Export(cl_writ(jn), kt, tauzz_v, info) |
|---|
| 586 | c -- LOOP |
|---|
| 587 | IF (jn.eq.7) CALL CLIM_Export(cl_writ(jn), kt, windsp, info) |
|---|
| 588 | c -- LOOP |
|---|
| 589 | IF (info .NE. CLIM_Ok) THEN |
|---|
| 590 | WRITE (nuout,*) 'STEP : Pb giving ',cl_writ(jn), ':',jn |
|---|
| 591 | WRITE (nuout,*) ' at timestep = ', icstep,'kt = ',kt |
|---|
| 592 | WRITE (nuout,*) 'Clim error code is = ',info |
|---|
| 593 | CALL halte('STOP in intocpl ') |
|---|
| 594 | ENDIF |
|---|
| 595 | END DO |
|---|
| 596 | ENDIF |
|---|
| 597 | C |
|---|
| 598 | RETURN |
|---|
| 599 | END |
|---|
| 600 | |
|---|
| 601 | SUBROUTINE pipe_model_define |
|---|
| 602 | print*,'Attention dans oasis.F, pipe_model_define est non defini' |
|---|
| 603 | RETURN |
|---|
| 604 | END |
|---|
| 605 | |
|---|
| 606 | SUBROUTINE pipe_model_stepi |
|---|
| 607 | print*,'Attention dans oasis.F, pipe_model_stepi est non defini' |
|---|
| 608 | RETURN |
|---|
| 609 | END |
|---|
| 610 | |
|---|
| 611 | SUBROUTINE pipe_model_recv |
|---|
| 612 | print *, 'Attention dans oasis.F, pipe_model_recv est non defini' |
|---|
| 613 | RETURN |
|---|
| 614 | END |
|---|
| 615 | |
|---|
| 616 | SUBROUTINE pipe_model_send |
|---|
| 617 | print *, 'Attention dans oasis.F, pipe_model_send est non defini' |
|---|
| 618 | RETURN |
|---|
| 619 | END |
|---|
| 620 | |
|---|
| 621 | SUBROUTINE quitcpl |
|---|
| 622 | print *, 'Attention dans oasis.F, quitcpl est non defini' |
|---|
| 623 | RETURN |
|---|
| 624 | END |
|---|
| 625 | |
|---|
| 626 | SUBROUTINE sipc_write_model |
|---|
| 627 | print *, 'Attention dans oasis.F, sipc_write_model est non defini' |
|---|
| 628 | RETURN |
|---|
| 629 | END |
|---|
| 630 | |
|---|
| 631 | SUBROUTINE sipc_attach |
|---|
| 632 | print *, 'Attention dans oasis.F, sipc_attach est non defini' |
|---|
| 633 | RETURN |
|---|
| 634 | END |
|---|
| 635 | |
|---|
| 636 | SUBROUTINE sipc_init_model |
|---|
| 637 | print *, 'Attention dans oasis.F, sipc_init_model est non defini' |
|---|
| 638 | RETURN |
|---|
| 639 | END |
|---|
| 640 | |
|---|
| 641 | SUBROUTINE sipc_read_model |
|---|
| 642 | print *, 'Attention dans oasis.F, sipc_read_model est non defini' |
|---|
| 643 | RETURN |
|---|
| 644 | END |
|---|