Ignore:
Timestamp:
Feb 29, 2016 8:37:15 AM (8 years ago)
Author:
raasch
Message:

pmc now runs with pointer version too

File:
1 edited

Legend:

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

    r1765 r1766  
    2020! Current revisions:
    2121! ------------------
    22 !
     22! modifications to allow for using PALM's pointer version,
     23! +new routine pmci_set_swaplevel
    2324!
    2425! Former revisions:
     
    4243!------------------------------------------------------------------------------!
    4344
     45#if defined( __nopointer )
     46!-- TO_DO: is it really required to use arrays te_m, tu_m, etc. and to set them
     47!--        to zero withi buildings?
    4448    USE arrays_3d,                                                             &
    4549        ONLY:  dzu, dzw, e, e_p, pt, pt_p, q, q_p, te_m, tu_m, tv_m, tw_m, u,  &
    4650               u_p, v, v_p, w, w_p, zu, zw, z0
     51#else
     52   USE arrays_3d,                                                              &
     53        ONLY:  dzu, dzw, e, e_p, e_1, e_2, pt, pt_p, pt_1, pt_2, q, q_p, q_1, q_2, te_m, tu_m, &
     54               tv_m, tw_m, u, u_p, u_1, u_2, v, v_p, v_1, v_2, w, w_p, w_1, w_2, zu, zw, z0
     55#endif
    4756
    4857    USE control_parameters,                                                    &
     
    94103        ONLY:  pmc_serverinit, pmc_s_fillbuffer, pmc_s_getdata_from_buffer,    &
    95104               pmc_s_getnextarray, pmc_s_setind_and_allocmem,                  &
    96                pmc_s_set_dataarray, pmc_s_set_2d_index_list
     105               pmc_s_set_active_data_array, pmc_s_set_dataarray,               &
     106               pmc_s_set_2d_index_list
    97107
    98108#endif
     
    309319    END INTERFACE
    310320
     321    INTERFACE pmci_set_swaplevel
     322       MODULE PROCEDURE pmci_set_swaplevel
     323    END INTERFACE pmci_set_swaplevel
     324
    311325    INTERFACE pmci_update_new
    312326       MODULE PROCEDURE pmci_update_new
     
    322336    PUBLIC pmci_server_initialize
    323337    PUBLIC pmci_server_synchronize
     338    PUBLIC pmci_set_swaplevel
    324339    PUBLIC pmci_update_new
    325340
     
    22142229 END SUBROUTINE pmci_client_synchronize
    22152230               
     2231
     2232
     2233 SUBROUTINE pmci_set_swaplevel( swaplevel )
     2234
     2235    IMPLICIT NONE
     2236
     2237    INTEGER(iwp),INTENT(IN) ::  swaplevel  !: swaplevel (1 or 2) of PALM's timestep
     2238
     2239    INTEGER(iwp)            ::  client_id  !:
     2240    INTEGER(iwp)            ::  m          !:
     2241
     2242!
     2243!-- After each timestep, alternately set buffer one or buffer two active
     2244    DO  m = 1, SIZE( pmc_server_for_client )-1
     2245       client_id = pmc_server_for_client(m)
     2246       CALL pmc_s_set_active_data_array( client_id, swaplevel )
     2247    ENDDO
     2248
     2249 END SUBROUTINE pmci_set_swaplevel
     2250
    22162251
    22172252
     
    33203355    w(nzt+1,:,:) = w(nzt,:,:)
    33213356
    3322 #if defined( __nopointer )
    3323 
    33243357    u_p  = u
    33253358    v_p  = v
     
    33313364    ENDIF
    33323365
    3333 #endif
    3334 
    33353366!
    33363367!-- TO_DO: Find out later if nesting would work without __nopointer.
     
    33513382#if defined( __parallel )
    33523383    REAL(wp), POINTER, DIMENSION(:,:)    ::  p_2d        !:
     3384    REAL(wp), POINTER, DIMENSION(:,:)    ::  p_2d_sec    !:
    33533385    REAL(wp), POINTER, DIMENSION(:,:,:)  ::  p_3d        !:
     3386    REAL(wp), POINTER, DIMENSION(:,:,:)  ::  p_3d_sec    !:
    33543387    INTEGER(iwp)                         ::  ierr        !:
    33553388    INTEGER(iwp)                         ::  istat       !:
     
    33693402    !IF ( TRIM(name) == "z0" )    p_2d => z0
    33703403
     3404#if defined( __nopointer )
    33713405    IF ( ASSOCIATED( p_3d ) )  THEN
    33723406       CALL pmc_s_set_dataarray( client_id, p_3d, nz_cl, nz )
     
    33873421       ENDIF
    33883422    ENDIF
     3423#else
     3424!-- TO_DO: Why aren't the other pointers (p_3d) not set to u_1, v_1, etc.??
     3425    IF ( TRIM(name) == "u" )     p_3d_sec => u_2
     3426    IF ( TRIM(name) == "v" )     p_3d_sec => v_2
     3427    IF ( TRIM(name) == "w" )     p_3d_sec => w_2
     3428    IF ( TRIM(name) == "e" )     p_3d_sec => e_2
     3429    IF ( TRIM(name) == "pt" )    p_3d_sec => pt_2
     3430    !IF ( TRIM(name) == "z0" )    p_2d_sec => z0_2
     3431
     3432    IF ( ASSOCIATED( p_3d ) )  THEN
     3433       CALL pmc_s_set_dataarray( client_id, p_3d, nz_cl, nz, &
     3434                                 array_2 = p_3d_sec )
     3435    ELSEIF ( ASSOCIATED( p_2d ) )  THEN
     3436       CALL pmc_s_set_dataarray( client_id, p_2d, array_2 = p_2d_sec )
     3437    ELSE
     3438!
     3439!--    Give only one message for the root domain
     3440       IF ( myid == 0  .AND.  cpl_id == 1 )  THEN
     3441
     3442          message_string = 'pointer for array "' // TRIM( name ) //            &
     3443                           '" can''t be associated'
     3444          CALL message( 'pmci_set_array_pointer', 'PA0117', 3, 2, 0, 6, 0 )
     3445       ELSE
     3446!
     3447!--       Avoid others to continue
     3448          CALL MPI_BARRIER( comm2d, ierr )
     3449       ENDIF
     3450
     3451   ENDIF
     3452#endif
    33893453
    33903454#endif
Note: See TracChangeset for help on using the changeset viewer.