Changeset 5989 for branches/2014/dev_r4650_UKMO10_Tidally_Meaned_Diagnostics/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
- Timestamp:
- 2015-12-03T09:10:32+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2014/dev_r4650_UKMO10_Tidally_Meaned_Diagnostics/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
r5260 r5989 4 4 !! Coupled O/A : coupled ocean-atmosphere case using OASIS3-MCT 5 5 !!===================================================================== 6 !! History : 7 !! 9.0 ! 04-06 (R. Redler, NEC Laboratories Europe, Germany) Original code 8 !! " " ! 04-11 (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision 9 !! " " ! 04-11 (V. Gayler, MPI M&D) Grid writing 10 !! " " ! 05-08 (R. Redler, W. Park) frld initialization, paral(2) revision 11 !! " " ! 05-09 (R. Redler) extended to allow for communication over root only 12 !! " " ! 06-01 (W. Park) modification of physical part 13 !! " " ! 06-02 (R. Redler, W. Park) buffer array fix for root exchange 14 !! 3.4 ! 11-11 (C. Harris) Changes to allow mutiple category fields 15 !!---------------------------------------------------------------------- 16 !!---------------------------------------------------------------------- 17 !! 'key_oasis3' coupled Ocean/Atmosphere via OASIS3 6 !! History : 1.0 ! 2004-06 (R. Redler, NEC Laboratories Europe, Germany) Original code 7 !! - ! 2004-11 (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision 8 !! - ! 2004-11 (V. Gayler, MPI M&D) Grid writing 9 !! 2.0 ! 2005-08 (R. Redler, W. Park) frld initialization, paral(2) revision 10 !! - ! 2005-09 (R. Redler) extended to allow for communication over root only 11 !! - ! 2006-01 (W. Park) modification of physical part 12 !! - ! 2006-02 (R. Redler, W. Park) buffer array fix for root exchange 13 !! 3.4 ! 2011-11 (C. Harris) Changes to allow mutiple category fields 14 !! 3.6 ! 2014-11 (S. Masson) OASIS3-MCT 15 !!---------------------------------------------------------------------- 16 17 !!---------------------------------------------------------------------- 18 !! 'key_oasis3' coupled Ocean/Atmosphere via OASIS3-MCT 19 !! 'key_oa3mct_v3' to be added for OASIS3-MCT version 3 18 20 !!---------------------------------------------------------------------- 19 21 !! cpl_init : initialization of coupled mode communication 20 22 !! cpl_define : definition of grid and fields 21 !! cpl_snd : snd out fields in coupled mode22 !! cpl_rcv : receive fields in coupled mode23 !! cpl_snd : snd out fields in coupled mode 24 !! cpl_rcv : receive fields in coupled mode 23 25 !! cpl_finalize : finalize the coupled mode communication 24 26 !!---------------------------------------------------------------------- … … 61 63 #endif 62 64 63 INTEGER, PUBLIC, PARAMETER :: nmaxfld=40 ! Maximum number of coupling fields 65 INTEGER :: nrcv ! total number of fields received 66 INTEGER :: nsnd ! total number of fields sent 67 INTEGER :: ncplmodel ! Maximum number of models to/from which NEMO is potentialy sending/receiving data 68 INTEGER, PUBLIC, PARAMETER :: nmaxfld=50 ! Maximum number of coupling fields 64 69 INTEGER, PUBLIC, PARAMETER :: nmaxcat=5 ! Maximum number of coupling fields 65 70 INTEGER, PUBLIC, PARAMETER :: nmaxcpl=5 ! Maximum number of coupling fields … … 86 91 CONTAINS 87 92 88 SUBROUTINE cpl_init( kl_comm )93 SUBROUTINE cpl_init( cd_modname, kl_comm ) 89 94 !!------------------------------------------------------------------- 90 95 !! *** ROUTINE cpl_init *** … … 95 100 !! ** Method : OASIS3 MPI communication 96 101 !!-------------------------------------------------------------------- 97 INTEGER, INTENT(out) :: kl_comm ! local communicator of the model 102 CHARACTER(len = *), INTENT(in ) :: cd_modname ! model name as set in namcouple file 103 INTEGER , INTENT( out) :: kl_comm ! local communicator of the model 98 104 !!-------------------------------------------------------------------- 99 105 … … 104 110 ! 1st Initialize the OASIS system for the application 105 111 !------------------------------------------------------------------ 106 CALL oasis_init_comp ( ncomp_id, 'oceanx', nerror )112 CALL oasis_init_comp ( ncomp_id, TRIM(cd_modname), nerror ) 107 113 IF ( nerror /= OASIS_Ok ) & 108 114 CALL oasis_abort (ncomp_id, 'cpl_init', 'Failure in oasis_init_comp') … … 144 150 IF(lwp) WRITE(numout,*) 145 151 152 ncplmodel = kcplmodel 146 153 IF( kcplmodel > nmaxcpl ) THEN 147 CALL oasis_abort ( ncomp_id, 'cpl_define', 'kcplmodel is larger than nmaxcpl, increase nmaxcpl') ; RETURN 154 CALL oasis_abort ( ncomp_id, 'cpl_define', 'ncplmodel is larger than nmaxcpl, increase nmaxcpl') ; RETURN 155 ENDIF 156 157 nrcv = krcv 158 IF( nrcv > nmaxfld ) THEN 159 CALL oasis_abort ( ncomp_id, 'cpl_define', 'nrcv is larger than nmaxfld, increase nmaxfld') ; RETURN 160 ENDIF 161 162 nsnd = ksnd 163 IF( nsnd > nmaxfld ) THEN 164 CALL oasis_abort ( ncomp_id, 'cpl_define', 'nsnd is larger than nmaxfld, increase nmaxfld') ; RETURN 148 165 ENDIF 149 166 ! … … 400 417 401 418 402 INTEGER FUNCTION cpl_freq( kid)419 INTEGER FUNCTION cpl_freq( cdfieldname ) 403 420 !!--------------------------------------------------------------------- 404 421 !! *** ROUTINE cpl_freq *** … … 406 423 !! ** Purpose : - send back the coupling frequency for a particular field 407 424 !!---------------------------------------------------------------------- 408 INTEGER,INTENT(in) :: kid ! variable index 409 !! 425 CHARACTER(len = *), INTENT(in) :: cdfieldname ! field name as set in namcouple file 426 !! 427 INTEGER :: id 410 428 INTEGER :: info 411 429 INTEGER, DIMENSION(1) :: itmp 430 INTEGER :: ji,jm ! local loop index 431 INTEGER :: mop 412 432 !!---------------------------------------------------------------------- 413 CALL oasis_get_freqs(kid, 1, itmp, info) 414 cpl_freq = itmp(1) 433 cpl_freq = 0 ! defaut definition 434 id = -1 ! defaut definition 435 ! 436 DO ji = 1, nsnd 437 IF (ssnd(ji)%laction ) THEN 438 DO jm = 1, ncplmodel 439 IF( ssnd(ji)%nid(1,jm) /= -1 ) THEN 440 IF( TRIM(cdfieldname) == TRIM(ssnd(ji)%clname) ) THEN 441 id = ssnd(ji)%nid(1,jm) 442 mop = OASIS_Out 443 ENDIF 444 ENDIF 445 ENDDO 446 ENDIF 447 ENDDO 448 DO ji = 1, nrcv 449 IF (srcv(ji)%laction ) THEN 450 DO jm = 1, ncplmodel 451 IF( srcv(ji)%nid(1,jm) /= -1 ) THEN 452 IF( TRIM(cdfieldname) == TRIM(srcv(ji)%clname) ) THEN 453 id = srcv(ji)%nid(1,jm) 454 mop = OASIS_In 455 ENDIF 456 ENDIF 457 ENDDO 458 ENDIF 459 ENDDO 460 ! 461 IF( id /= -1 ) THEN 462 #if defined key_oa3mct_v3 463 CALL oasis_get_freqs(id, mop, 1, itmp, info) 464 #else 465 CALL oasis_get_freqs(id, 1, itmp, info) 466 #endif 467 cpl_freq = itmp(1) 468 ENDIF 415 469 ! 416 470 END FUNCTION cpl_freq
Note: See TracChangeset
for help on using the changeset viewer.