Ignore:
Timestamp:
Oct 13, 2008 2:59:11 PM (13 years ago)
Author:
raasch
Message:

ocean-atmosphere coupling realized with MPI-1, adjustments in mrun, mbuild, subjob for lcxt4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/palm.f90

    r198 r206  
    44! Actual revisions:
    55! -----------------
    6 !
     6! Initialization of coupled runs modified for MPI-1 and moved to external
     7! subroutine init_coupling
    78!
    89! Former revisions:
     
    7778    CALL MPI_INIT( ierr )
    7879    CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
     80    CALL MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
    7981    comm_palm = MPI_COMM_WORLD
    8082    comm2d    = MPI_COMM_WORLD
    81 #endif
    82 
    83 #if defined( __mpi2 )
    84 !
    85 !-- Get information about the coupling mode from the environment variable
    86 !-- which has been set by the mpiexec command.
    87 !-- This method is currently not used because the mpiexec command is not
    88 !-- available on some machines
    89 !    CALL local_getenv( 'coupling_mode', 13, coupling_mode, i )
    90 !    IF ( i == 0 )  coupling_mode = 'uncoupled'
    91 !    IF ( coupling_mode == 'ocean_to_atmosphere' )  coupling_char = '_O'
    92 
    93 !
    94 !-- Get information about the coupling mode from standard input (PE0 only) and
    95 !-- distribute it to the other PEs
    96     CALL MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
    97     IF ( myid == 0 )  THEN
    98        READ (*,*,ERR=10,END=10)  coupling_mode
    99 10     IF ( TRIM( coupling_mode ) == 'atmosphere_to_ocean' )  THEN
    100           i = 1
    101        ELSEIF ( TRIM( coupling_mode ) ==  'ocean_to_atmosphere' )  THEN
    102           i = 2
    103        ELSE
    104           i = 0
    105        ENDIF
    106     ENDIF
    107     CALL MPI_BCAST( i, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr )
    108     IF ( i == 0 )  THEN
    109        coupling_mode = 'uncoupled'
    110     ELSEIF ( i == 1 )  THEN
    111        coupling_mode = 'atmosphere_to_ocean'
    112     ELSEIF ( i == 2 )  THEN
    113        coupling_mode = 'ocean_to_atmosphere'
    114     ENDIF
    115     IF ( coupling_mode == 'ocean_to_atmosphere' )  coupling_char = '_O'
     83
     84!
     85!-- Initialize PE topology in case of coupled runs
     86    CALL init_coupling
    11687#endif
    11788
     
    12495    CALL cpu_log( log_point(1), 'total', 'start' )
    12596    CALL cpu_log( log_point(2), 'initialisation', 'start' )
     97
     98!
     99!-- Open a file for debug output
     100    WRITE (myid_char,'(''_'',I4.4)')  myid
     101    OPEN( 9, FILE='DEBUG'//TRIM( coupling_char )//myid_char, FORM='FORMATTED' )
    126102
    127103!
     
    132108#if defined( __parallel )
    133109    CALL MPI_COMM_RANK( comm_palm, myid, ierr )
    134 #endif
    135 
    136 !
    137 !-- Open a file for debug output
    138     WRITE (myid_char,'(''_'',I4.4)')  myid
    139     OPEN( 9, FILE='DEBUG'//TRIM( coupling_char )//myid_char, FORM='FORMATTED' )
    140 
    141 #if defined( __mpi2 )
    142110!
    143111!-- TEST OUTPUT (TO BE REMOVED)
    144112    WRITE(9,*) '*** coupling_mode = "', TRIM( coupling_mode ), '"'
    145113    CALL LOCAL_FLUSH( 9 )
    146     print*, '*** PE', myid, '  ', TRIM( coupling_mode )
     114    PRINT*, '*** PE', myid, ' Global target PE:', target_id, &
     115            TRIM( coupling_mode )
    147116#endif
    148117
     
    220189#if defined( __mpi2 )
    221190!
    222 !-- Test exchange via intercommunicator
     191!-- Test exchange via intercommunicator in case of a MPI-2 coupling
    223192    IF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
    224193       i = 12345 + myid
     
    240209
    241210 END PROGRAM palm
    242 
Note: See TracChangeset for help on using the changeset viewer.