Changeset 1922 for palm


Ignore:
Timestamp:
May 31, 2016 4:36:08 PM (9 years ago)
Author:
boeske
Message:

Bugfix concerning array transposition checks

File:
1 edited

Legend:

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

    r1834 r1922  
    1919! Current revisions:
    2020! ------------------
    21 !
     21! Bugfix: array transposition checks restricted to cases if a fourier
     22! transform is used , removed unused variable nnx_z
    2223!
    2324! Former revisions:
     
    168169
    169170    USE spectra_mod,                                                           &
    170         ONLY:  dt_dosp
     171        ONLY:  calculate_spectra, dt_dosp
    171172
    172173    USE transpose_indices,                                                     &
     
    381382!-- 1. transposition  z --> x
    382383!-- This transposition is not neccessary in case of a 1d-decomposition along x
    383     nys_x = nys
    384     nyn_x = nyn
    385     nny_x = nny
    386     nnz_x = nz / pdims(1)
    387     nzb_x = 1 + myidx * nnz_x
    388     nzt_x = ( myidx + 1 ) * nnz_x
    389     sendrecvcount_zx = nnx * nny * nnz_x
    390 
    391     IF ( pdims(2) /= 1 )  THEN
    392        IF ( MOD( nz , pdims(1) ) /= 0 )  THEN
    393           WRITE( message_string, * ) 'transposition z --> x:',                &
    394                        '&nz=',nz,' is not an integral divisior of pdims(1)=', &
     384    IF ( psolver == 'poisfft'  .OR.  calculate_spectra )  THEN
     385
     386       IF ( pdims(2) /= 1 )  THEN
     387          IF ( MOD( nz , pdims(1) ) /= 0 )  THEN
     388             WRITE( message_string, * ) 'transposition z --> x:',              &
     389                       '&nz=',nz,' is not an integral divisior of pdims(1)=',  &
    395390                                                                   pdims(1)
    396           CALL message( 'init_pegrid', 'PA0230', 1, 2, 0, 6, 0 )
    397        ENDIF
    398     ENDIF
    399 
    400 !
    401 !-- 2. transposition  x --> y
    402     nnz_y = nnz_x
    403     nzb_y = nzb_x
    404     nzt_y = nzt_x
    405     IF ( MOD( nx+1 , pdims(2) ) /= 0 )  THEN
    406        WRITE( message_string, * ) 'transposition x --> y:',                &
    407                          '&nx+1=',nx+1,' is not an integral divisor of ',&
    408                          'pdims(2)=',pdims(2)
    409        CALL message( 'init_pegrid', 'PA0231', 1, 2, 0, 6, 0 )
    410     ENDIF
    411     nnx_y = (nx+1) / pdims(2)
    412     nxl_y = myidy * nnx_y
    413     nxr_y = ( myidy + 1 ) * nnx_y - 1
    414     sendrecvcount_xy = nnx_y * nny_x * nnz_y
    415 
    416 !
    417 !-- 3. transposition  y --> z  (ELSE:  x --> y  in case of 1D-decomposition
    418 !-- along x)
    419     nnx_z = nnx_y
    420     nxl_z = nxl_y
    421     nxr_z = nxr_y
    422     nny_z = (ny+1) / pdims(1)
    423     nys_z = myidx * nny_z
    424     nyn_z = ( myidx + 1 ) * nny_z - 1
    425     sendrecvcount_yz = nnx_y * nny_z * nnz_y
    426 
    427     IF ( pdims(2) /= 1 )  THEN
    428 !
    429 !--    y --> z
    430 !--    This transposition is not neccessary in case of a 1d-decomposition
    431 !--    along x, except that the uptream-spline method is switched on
    432        IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
    433           WRITE( message_string, * ) 'transposition y --> z:',            &
    434                             '& ny+1=',ny+1,' is not an integral divisor of ',&
    435                             'pdims(1)=',pdims(1)
    436           CALL message( 'init_pegrid', 'PA0232', 1, 2, 0, 6, 0 )
    437        ENDIF
    438 
    439     ELSE
    440 !
    441 !--    x --> y. This condition must be fulfilled for a 1D-decomposition along x
    442        IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
    443           WRITE( message_string, * ) 'transposition x --> y:',               &
    444                             '& ny+1=',ny+1,' is not an integral divisor of ',&
    445                             'pdims(1)=',pdims(1)
    446           CALL message( 'init_pegrid', 'PA0233', 1, 2, 0, 6, 0 )
     391             CALL message( 'init_pegrid', 'PA0230', 1, 2, 0, 6, 0 )
     392          ENDIF
     393       ENDIF
     394
     395       nys_x = nys
     396       nyn_x = nyn
     397       nny_x = nny
     398       nnz_x = nz / pdims(1)
     399       nzb_x = 1 + myidx * nnz_x
     400       nzt_x = ( myidx + 1 ) * nnz_x
     401       sendrecvcount_zx = nnx * nny * nnz_x
     402
     403    ENDIF
     404
     405
     406    IF ( psolver == 'poisfft' )  THEN
     407!
     408!--    2. transposition  x --> y
     409       IF ( MOD( nx+1 , pdims(2) ) /= 0 )  THEN
     410          WRITE( message_string, * ) 'transposition x --> y:',                 &
     411                            '&nx+1=',nx+1,' is not an integral divisor of ',   &
     412                            'pdims(2)=',pdims(2)
     413          CALL message( 'init_pegrid', 'PA0231', 1, 2, 0, 6, 0 )
     414       ENDIF
     415
     416       nnz_y = nnz_x
     417       nzb_y = nzb_x
     418       nzt_y = nzt_x
     419       nnx_y = (nx+1) / pdims(2)
     420       nxl_y = myidy * nnx_y
     421       nxr_y = ( myidy + 1 ) * nnx_y - 1
     422       sendrecvcount_xy = nnx_y * nny_x * nnz_y
     423!
     424!--    3. transposition  y --> z 
     425!--    (ELSE:  x --> y  in case of 1D-decomposition along x)
     426       nxl_z = nxl_y
     427       nxr_z = nxr_y
     428       nny_z = (ny+1) / pdims(1)
     429       nys_z = myidx * nny_z
     430       nyn_z = ( myidx + 1 ) * nny_z - 1
     431       sendrecvcount_yz = nnx_y * nny_z * nnz_y
     432
     433       IF ( pdims(2) /= 1 )  THEN
     434!
     435!--       y --> z
     436!--       This transposition is not neccessary in case of a 1d-decomposition
     437!--       along x, except that the uptream-spline method is switched on
     438          IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
     439             WRITE( message_string, * ) 'transposition y --> z:',              &
     440                               '& ny+1=',ny+1,' is not an integral divisor of',&
     441                               ' pdims(1)=',pdims(1)
     442             CALL message( 'init_pegrid', 'PA0232', 1, 2, 0, 6, 0 )
     443          ENDIF
     444
     445       ELSE
     446!
     447!--       x --> y
     448!--       This condition must be fulfilled for a 1D-decomposition along x
     449          IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
     450             WRITE( message_string, * ) 'transposition x --> y:',              &
     451                               '& ny+1=',ny+1,' is not an integral divisor of',&
     452                               ' pdims(1)=',pdims(1)
     453             CALL message( 'init_pegrid', 'PA0233', 1, 2, 0, 6, 0 )
     454          ENDIF
     455
    447456       ENDIF
    448457
     
    451460!
    452461!-- Indices for direct transpositions z --> y (used for calculating spectra)
    453     IF ( dt_dosp /= 9999999.9_wp )  THEN
     462    IF ( calculate_spectra )  THEN
    454463       IF ( MOD( nz, pdims(2) ) /= 0 )  THEN
    455           WRITE( message_string, * ) 'direct transposition z --> y (needed ', &
    456                     'for spectra):& nz=',nz,' is not an integral divisor of ',&
     464          WRITE( message_string, * ) 'direct transposition z --> y (needed ',  &
     465                    'for spectra):& nz=',nz,' is not an integral divisor of ', &
    457466                    'pdims(2)=',pdims(2)
    458467          CALL message( 'init_pegrid', 'PA0234', 1, 2, 0, 6, 0 )
     
    466475    ENDIF
    467476
    468 !
    469 !-- Indices for direct transpositions y --> x (they are only possible in case
    470 !-- of a 1d-decomposition along x)
    471     IF ( pdims(2) == 1 )  THEN
    472        nny_x = nny / pdims(1)
    473        nys_x = myid * nny_x
    474        nyn_x = ( myid + 1 ) * nny_x - 1
    475        nzb_x = 1
    476        nzt_x = nz
    477        sendrecvcount_xy = nnx * nny_x * nz
    478     ENDIF
    479 
    480 !
    481 !-- Indices for direct transpositions x --> y (they are only possible in case
    482 !-- of a 1d-decomposition along y)
    483     IF ( pdims(1) == 1 )  THEN
    484        nnx_y = nnx / pdims(2)
    485        nxl_y = myid * nnx_y
    486        nxr_y = ( myid + 1 ) * nnx_y - 1
    487        nzb_y = 1
    488        nzt_y = nz
    489        sendrecvcount_xy = nnx_y * nny * nz
     477    IF ( psolver == 'poisfft'  .OR.  calculate_spectra )  THEN
     478!
     479!--    Indices for direct transpositions y --> x
     480!--    (they are only possible in case of a 1d-decomposition along x)
     481       IF ( pdims(2) == 1 )  THEN
     482          nny_x = nny / pdims(1)
     483          nys_x = myid * nny_x
     484          nyn_x = ( myid + 1 ) * nny_x - 1
     485          nzb_x = 1
     486          nzt_x = nz
     487          sendrecvcount_xy = nnx * nny_x * nz
     488       ENDIF
     489
     490    ENDIF
     491
     492    IF ( psolver == 'poisfft' )  THEN
     493!
     494!--    Indices for direct transpositions x --> y
     495!--    (they are only possible in case of a 1d-decomposition along y)
     496       IF ( pdims(1) == 1 )  THEN
     497          nnx_y = nnx / pdims(2)
     498          nxl_y = myid * nnx_y
     499          nxr_y = ( myid + 1 ) * nnx_y - 1
     500          nzb_y = 1
     501          nzt_y = nz
     502          sendrecvcount_xy = nnx_y * nny * nz
     503       ENDIF
     504
    490505    ENDIF
    491506
Note: See TracChangeset for help on using the changeset viewer.