Changeset 1682 for palm/trunk/SOURCE/tridia_solver.f90
 Timestamp:
 Oct 7, 2015 11:56:08 PM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE/tridia_solver.f90
r1407 r1682 1 MODULE tridia_solver 2 1 !> @file tridia_solver.f90 3 2 !! 4 3 ! This file is part of PALM. … … 20 19 ! Current revisions: 21 20 !  22 ! 21 ! Code annotations made doxygen readable 23 22 ! 24 23 ! Former revisions: … … 64 63 ! Description: 65 64 !  66 ! solves the linear system of equations: 67 ! 68 ! (4 pi^2(i^2/(dx^2*nnx^2)+j^2/(dy^2*nny^2))+ 69 ! 1/(dzu(k)*dzw(k))+1/(dzu(k1)*dzw(k)))*p(i,j,k)+ 70 ! 1/(dzu(k)*dzw(k))*p(i,j,k+1)+1/(dzu(k1)*dzw(k))*p(i,j,k1)=d(i,j,k) 71 ! 72 ! by using the Thomas algorithm 73 !! 65 !> solves the linear system of equations: 66 !> 67 !> (4 pi^2(i^2/(dx^2*nnx^2)+j^2/(dy^2*nny^2))+ 68 !> 1/(dzu(k)*dzw(k))+1/(dzu(k1)*dzw(k)))*p(i,j,k)+ 69 !> 1/(dzu(k)*dzw(k))*p(i,j,k+1)+1/(dzu(k1)*dzw(k))*p(i,j,k1)=d(i,j,k) 70 !> 71 !> by using the Thomas algorithm 72 !! 73 MODULE tridia_solver 74 74 75 75 76 USE indices, & … … 83 84 IMPLICIT NONE 84 85 85 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: ddzuw ! :86 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: ddzuw !< 86 87 87 88 PRIVATE … … 100 101 101 102 103 !! 104 ! Description: 105 !  106 !> @todo Missing subroutine description. 107 !! 102 108 SUBROUTINE tridia_init 103 109 … … 109 115 IMPLICIT NONE 110 116 111 INTEGER(iwp) :: k ! :117 INTEGER(iwp) :: k !< 112 118 113 119 ALLOCATE( ddzuw(0:nz1,3) ) … … 129 135 130 136 137 !! 138 ! Description: 139 !  140 !> Computes the i and jdependent component of the matrix 141 !> Provide the constant coefficients of the tridiagonal matrix for solution 142 !> of the Poisson equation in Fourier space. 143 !> The coefficients are computed following the method of 144 !> Schmidt et al. (DFVLRMitteilung 8415), which departs from Stephan 145 !> Siano's original version by discretizing the Poisson equation, 146 !> before it is Fouriertransformed. 147 !! 131 148 SUBROUTINE maketri 132 149 133 !!134 ! Computes the i and jdependent component of the matrix135 !!136 150 137 151 USE arrays_3d, & … … 152 166 IMPLICIT NONE 153 167 154 INTEGER(iwp) :: i ! :155 INTEGER(iwp) :: j ! :156 INTEGER(iwp) :: k ! :157 INTEGER(iwp) :: nnxh ! :158 INTEGER(iwp) :: nnyh ! :159 160 REAL(wp) :: ll(nxl_z:nxr_z,nys_z:nyn_z) ! :168 INTEGER(iwp) :: i !< 169 INTEGER(iwp) :: j !< 170 INTEGER(iwp) :: k !< 171 INTEGER(iwp) :: nnxh !< 172 INTEGER(iwp) :: nnyh !< 173 174 REAL(wp) :: ll(nxl_z:nxr_z,nys_z:nyn_z) !< 161 175 !$acc declare create( ll ) 162 176 … … 164 178 nnxh = ( nx + 1 ) / 2 165 179 nnyh = ( ny + 1 ) / 2 166 167 !168 ! Provide the constant coefficients of the tridiagonal matrix for solution169 ! of the Poisson equation in Fourier space.170 ! The coefficients are computed following the method of171 ! Schmidt et al. (DFVLRMitteilung 8415), which departs from Stephan172 ! Siano's original version by discretizing the Poisson equation,173 ! before it is Fouriertransformed.174 180 175 181 !$acc kernels present( tric ) … … 235 241 236 242 243 !! 244 ! Description: 245 !  246 !> Substitution (Forward and Backward) (Thomas algorithm) 247 !! 237 248 SUBROUTINE tridia_substi( ar ) 238 249 239 !!240 ! Substitution (Forward and Backward) (Thomas algorithm)241 !!242 250 243 251 USE arrays_3d, & … … 251 259 IMPLICIT NONE 252 260 253 INTEGER(iwp) :: i ! :254 INTEGER(iwp) :: j ! :255 INTEGER(iwp) :: k ! :256 257 REAL(wp) :: ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz) ! :258 259 REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz1) :: ar1 ! :261 INTEGER(iwp) :: i !< 262 INTEGER(iwp) :: j !< 263 INTEGER(iwp) :: k !< 264 265 REAL(wp) :: ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz) !< 266 267 REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz1) :: ar1 !< 260 268 !$acc declare create( ar1 ) 261 269 … … 316 324 317 325 326 !! 327 ! Description: 328 !  329 !> Substitution (Forward and Backward) (Thomas algorithm) 330 !! 318 331 SUBROUTINE tridia_substi_overlap( ar, jj ) 319 332 320 !!321 ! Substitution (Forward and Backward) (Thomas algorithm)322 !!323 333 324 334 USE arrays_3d, & … … 332 342 IMPLICIT NONE 333 343 334 INTEGER(iwp) :: i ! :335 INTEGER(iwp) :: j ! :336 INTEGER(iwp) :: jj ! :337 INTEGER(iwp) :: k ! :338 339 REAL(wp) :: ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz) ! :340 341 REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz1) :: ar1 ! :344 INTEGER(iwp) :: i !< 345 INTEGER(iwp) :: j !< 346 INTEGER(iwp) :: jj !< 347 INTEGER(iwp) :: k !< 348 349 REAL(wp) :: ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz) !< 350 351 REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz1) :: ar1 !< 342 352 !$acc declare create( ar1 ) 343 353 … … 399 409 400 410 411 !! 412 ! Description: 413 !  414 !> Splitting of the tridiagonal matrix (Thomas algorithm) 415 !! 401 416 SUBROUTINE split 402 417 403 !!404 ! Splitting of the tridiagonal matrix (Thomas algorithm)405 !!406 418 407 419 USE arrays_3d, & … … 412 424 IMPLICIT NONE 413 425 414 INTEGER(iwp) :: i ! :415 INTEGER(iwp) :: j ! :416 INTEGER(iwp) :: k ! :426 INTEGER(iwp) :: i !< 427 INTEGER(iwp) :: j !< 428 INTEGER(iwp) :: k !< 417 429 ! 418 430 ! Splitting … … 443 455 444 456 457 !! 458 ! Description: 459 !  460 !> Solves the linear system of equations for a 1ddecomposition along x (see 461 !> tridia) 462 !> 463 !> @attention when using the intel compilers older than 12.0, array tri must 464 !> be passed as an argument to the contained subroutines. Otherwise 465 !> addres faults will occur. This feature can be activated with 466 !> cppswitch __intel11 467 !> On NEC, tri should not be passed (except for routine substi_1dd) 468 !> because this causes very bad performance. 469 !! 470 445 471 SUBROUTINE tridia_1dd( ddx2, ddy2, nx, ny, j, ar, tri_for_1d ) 446 472 447 !!448 ! Solves the linear system of equations for a 1ddecomposition along x (see449 ! tridia)450 !451 ! Attention: when using the intel compilers older than 12.0, array tri must452 ! be passed as an argument to the contained subroutines. Otherwise453 ! addres faults will occur. This feature can be activated with454 ! cppswitch __intel11455 ! On NEC, tri should not be passed (except for routine substi_1dd)456 ! because this causes very bad performance.457 !!458 473 459 474 USE arrays_3d, & … … 467 482 IMPLICIT NONE 468 483 469 INTEGER(iwp) :: i ! :470 INTEGER(iwp) :: j ! :471 INTEGER(iwp) :: k ! :472 INTEGER(iwp) :: nnyh ! :473 INTEGER(iwp) :: nx ! :474 INTEGER(iwp) :: ny ! :475 INTEGER(iwp) :: omp_get_thread_num ! :476 INTEGER(iwp) :: tn ! :477 478 REAL(wp) :: ddx2 ! :479 REAL(wp) :: ddy2 ! :480 481 REAL(wp), DIMENSION(0:nx,1:nz) :: ar ! :482 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d ! :484 INTEGER(iwp) :: i !< 485 INTEGER(iwp) :: j !< 486 INTEGER(iwp) :: k !< 487 INTEGER(iwp) :: nnyh !< 488 INTEGER(iwp) :: nx !< 489 INTEGER(iwp) :: ny !< 490 INTEGER(iwp) :: omp_get_thread_num !< 491 INTEGER(iwp) :: tn !< 492 493 REAL(wp) :: ddx2 !< 494 REAL(wp) :: ddy2 !< 495 496 REAL(wp), DIMENSION(0:nx,1:nz) :: ar !< 497 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d !< 483 498 484 499 … … 525 540 CONTAINS 526 541 542 543 !! 544 ! Description: 545 !  546 !> computes the i and jdependent component of the matrix 547 !! 527 548 #if defined( __intel11 ) 528 549 SUBROUTINE maketri_1dd( j, tri_for_1d ) … … 531 552 #endif 532 553 533 !!534 ! computes the i and jdependent component of the matrix535 !!536 537 554 USE constants, & 538 555 ONLY: pi … … 542 559 IMPLICIT NONE 543 560 544 INTEGER(iwp) :: i ! :545 INTEGER(iwp) :: j ! :546 INTEGER(iwp) :: k ! :547 INTEGER(iwp) :: nnxh ! :548 549 REAL(wp) :: a ! :550 REAL(wp) :: c ! :551 552 REAL(wp), DIMENSION(0:nx) :: l ! :561 INTEGER(iwp) :: i !< 562 INTEGER(iwp) :: j !< 563 INTEGER(iwp) :: k !< 564 INTEGER(iwp) :: nnxh !< 565 566 REAL(wp) :: a !< 567 REAL(wp) :: c !< 568 569 REAL(wp), DIMENSION(0:nx) :: l !< 553 570 554 571 #if defined( __intel11 ) 555 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d ! :572 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d !< 556 573 #endif 557 574 … … 599 616 600 617 618 !! 619 ! Description: 620 !  621 !> Splitting of the tridiagonal matrix (Thomas algorithm) 622 !! 601 623 #if defined( __intel11 ) 602 624 SUBROUTINE split_1dd( tri_for_1d ) … … 605 627 #endif 606 628 607 !!608 ! Splitting of the tridiagonal matrix (Thomas algorithm)609 !!610 629 611 630 IMPLICIT NONE 612 631 613 INTEGER(iwp) :: i ! :614 INTEGER(iwp) :: k ! :632 INTEGER(iwp) :: i !< 633 INTEGER(iwp) :: k !< 615 634 616 635 #if defined( __intel11 ) 617 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d ! :636 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d !< 618 637 #endif 619 638 … … 634 653 635 654 655 !! 656 ! Description: 657 !  658 !> Substitution (Forward and Backward) (Thomas algorithm) 659 !! 636 660 SUBROUTINE substi_1dd( ar, tri_for_1d ) 637 661 638 !!639 ! Substitution (Forward and Backward) (Thomas algorithm)640 !!641 662 642 663 IMPLICIT NONE 643 664 644 INTEGER(iwp) :: i ! :645 INTEGER(iwp) :: k ! :646 647 REAL(wp), DIMENSION(0:nx,nz) :: ar ! :648 REAL(wp), DIMENSION(0:nx,0:nz1) :: ar1 ! :649 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d ! :665 INTEGER(iwp) :: i !< 666 INTEGER(iwp) :: k !< 667 668 REAL(wp), DIMENSION(0:nx,nz) :: ar !< 669 REAL(wp), DIMENSION(0:nx,0:nz1) :: ar1 !< 670 REAL(wp), DIMENSION(5,0:nx,0:nz1) :: tri_for_1d !< 650 671 651 672 !
Note: See TracChangeset
for help on using the changeset viewer.