- Timestamp:
- Aug 2, 2024, 2:12:03 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/phylmd/ecrad.v1.5.1/radiation_matrix.F90
r4489 r5158 90 90 mat_x_vec(1:iend,1) = A(1:iend,1,1)*b(1:iend,1) 91 91 else 92 doj1 = 1,m93 doj2 = 1,m92 DO j1 = 1,m 93 DO j2 = 1,m 94 94 mat_x_vec(1:iend,j1) = mat_x_vec(1:iend,j1) & 95 95 & + A(1:iend,j1,j2)*b(1:iend,j2) … … 124 124 singlemat_x_vec = 0.0_jprb 125 125 126 doj1 = 1,m127 doj2 = 1,m126 DO j1 = 1,m 127 DO j2 = 1,m 128 128 singlemat_x_vec(1:iend,j1) = singlemat_x_vec(1:iend,j1) & 129 129 & + A(j1,j2)*b(1:iend,j2) … … 175 175 m2block = 2*mblock 176 176 ! Do the top-left (C, D, F, G) 177 doj2 = 1,m2block178 doj1 = 1,m2block179 doj3 = 1,m2block177 DO j2 = 1,m2block 178 DO j1 = 1,m2block 179 DO j3 = 1,m2block 180 180 mat_x_mat(1:iend,j1,j2) = mat_x_mat(1:iend,j1,j2) & 181 181 & + A(1:iend,j1,j3)*B(1:iend,j3,j2) … … 183 183 end do 184 184 end do 185 doj2 = m2block+1,m185 DO j2 = m2block+1,m 186 186 ! Do the top-right (E & H) 187 doj1 = 1,m2block188 doj3 = 1,m187 DO j1 = 1,m2block 188 DO j3 = 1,m 189 189 mat_x_mat(1:iend,j1,j2) = mat_x_mat(1:iend,j1,j2) & 190 190 & + A(1:iend,j1,j3)*B(1:iend,j3,j2) … … 192 192 end do 193 193 ! Do the bottom-right (I) 194 doj1 = m2block+1,m195 doj3 = m2block+1,m194 DO j1 = m2block+1,m 195 DO j3 = m2block+1,m 196 196 mat_x_mat(1:iend,j1,j2) = mat_x_mat(1:iend,j1,j2) & 197 197 & + A(1:iend,j1,j3)*B(1:iend,j3,j2) … … 201 201 else 202 202 ! Ordinary dense matrix 203 doj2 = 1,m204 doj1 = 1,m205 doj3 = 1,m203 DO j2 = 1,m 204 DO j1 = 1,m 205 DO j3 = 1,m 206 206 mat_x_mat(1:iend,j1,j2) = mat_x_mat(1:iend,j1,j2) & 207 207 & + A(1:iend,j1,j3)*B(1:iend,j3,j2) … … 237 237 singlemat_x_mat = 0.0_jprb 238 238 239 doj2 = 1,m240 doj1 = 1,m241 doj3 = 1,m239 DO j2 = 1,m 240 DO j1 = 1,m 241 DO j3 = 1,m 242 242 singlemat_x_mat(1:iend,j1,j2) = singlemat_x_mat(1:iend,j1,j2) & 243 243 & + A(j1,j3)*B(1:iend,j3,j2) … … 272 272 mat_x_singlemat = 0.0_jprb 273 273 274 doj2 = 1,m275 doj1 = 1,m276 doj3 = 1,m274 DO j2 = 1,m 275 DO j1 = 1,m 276 DO j3 = 1,m 277 277 mat_x_singlemat(1:iend,j1,j2) = mat_x_singlemat(1:iend,j1,j2) & 278 278 & + A(1:iend,j1,j3)*B(j3,j2) … … 310 310 311 311 identity_minus_mat_x_mat = - identity_minus_mat_x_mat 312 doj = 1,m312 DO j = 1,m 313 313 identity_minus_mat_x_mat(1:iend,j,j) & 314 314 & = 1.0_jprb + identity_minus_mat_x_mat(1:iend,j,j) … … 348 348 mblock = m/3 349 349 m2block = 2*mblock 350 doj4 = 1,nrepeat350 DO j4 = 1,nrepeat 351 351 repeated_square = 0.0_jprb 352 352 ! Do the top-left (C, D, F & G) 353 doj2 = 1,m2block354 doj1 = 1,m2block355 doj3 = 1,m2block353 DO j2 = 1,m2block 354 DO j1 = 1,m2block 355 DO j3 = 1,m2block 356 356 repeated_square(j1,j2) = repeated_square(j1,j2) & 357 357 & + A(j1,j3)*A(j3,j2) … … 359 359 end do 360 360 end do 361 doj2 = m2block+1, m361 DO j2 = m2block+1, m 362 362 ! Do the top-right (E & H) 363 doj1 = 1,m2block364 doj3 = 1,m363 DO j1 = 1,m2block 364 DO j3 = 1,m 365 365 repeated_square(j1,j2) = repeated_square(j1,j2) & 366 366 & + A(j1,j3)*A(j3,j2) … … 368 368 end do 369 369 ! Do the bottom-right (I) 370 doj1 = m2block+1, m371 doj3 = m2block+1,m370 DO j1 = m2block+1, m 371 DO j3 = m2block+1,m 372 372 repeated_square(j1,j2) = repeated_square(j1,j2) & 373 373 & + A(j1,j3)*A(j3,j2) … … 381 381 else 382 382 ! Ordinary dense matrix 383 doj4 = 1,nrepeat383 DO j4 = 1,nrepeat 384 384 repeated_square = 0.0_jprb 385 doj2 = 1,m386 doj1 = 1,m387 doj3 = 1,m385 DO j2 = 1,m 386 DO j1 = 1,m 387 DO j3 = 1,m 388 388 repeated_square(j1,j2) = repeated_square(j1,j2) & 389 389 & + A(j1,j3)*A(j3,j2) … … 521 521 U33 = A(1:iend,3,3) - L31*A(1:iend,1,3) - L32*U23 522 522 523 doj = 1,3523 DO j = 1,3 524 524 ! Solve Ly = B(:,:,j) by forward substitution 525 525 ! y1 = B(:,1,j) … … 621 621 LU(1:iend,1:m,1:m) = A(1:iend,1:m,1:m) 622 622 623 doj2 = 1, m624 doj1 = 1, j2-1623 DO j2 = 1, m 624 DO j1 = 1, j2-1 625 625 s = LU(1:iend,j1,j2) 626 doj3 = 1, j1-1626 DO j3 = 1, j1-1 627 627 s = s - LU(1:iend,j1,j3) * LU(1:iend,j3,j2) 628 628 end do 629 629 LU(1:iend,j1,j2) = s 630 630 end do 631 doj1 = j2, m631 DO j1 = j2, m 632 632 s = LU(1:iend,j1,j2) 633 doj3 = 1, j2-1633 DO j3 = 1, j2-1 634 634 s = s - LU(1:iend,j1,j3) * LU(1:iend,j3,j2) 635 635 end do … … 638 638 if (j2 /= m) then 639 639 s = 1.0_jprb / LU(1:iend,j2,j2) 640 doj1 = j2+1, m640 DO j1 = j2+1, m 641 641 LU(1:iend,j1,j2) = LU(1:iend,j1,j2) * s 642 642 end do … … 663 663 664 664 ! First solve Ly=b 665 doj2 = 2, m666 doj1 = 1, j2-1665 DO j2 = 2, m 666 DO j1 = 1, j2-1 667 667 x(1:iend,j2) = x(1:iend,j2) - x(1:iend,j1)*LU(1:iend,j2,j1) 668 668 end do 669 669 end do 670 670 ! Now solve Ux=y 671 doj2 = m, 1, -1672 doj1 = j2+1, m671 DO j2 = m, 1, -1 672 DO j1 = j2+1, m 673 673 x(1:iend,j2) = x(1:iend,j2) - x(1:iend,j1)*LU(1:iend,j2,j1) 674 674 end do … … 694 694 call lu_factorization(n,iend,m,A,LU) 695 695 696 doj = 1, m696 DO j = 1, m 697 697 call lu_substitution(n,iend,m,LU,B(1:,1:m,j),X(1:iend,1:m,j)) 698 698 ! call lu_substitution(n,iend,m,LU,B(1:n,1:m,j),X(1:iend,1:m,j)) … … 807 807 808 808 ! Compute the 1-norms of A 809 doj3 = 1,m809 DO j3 = 1,m 810 810 sum_column(:) = 0.0_jprb 811 doj2 = 1,m812 doj1 = 1,iend811 DO j2 = 1,m 812 DO j1 = 1,iend 813 813 sum_column(j1) = sum_column(j1) + abs(A(j1,j2,j3)) 814 814 end do 815 815 end do 816 doj1 = 1,iend816 DO j1 = 1,iend 817 817 if (sum_column(j1) > normA(j1)) then 818 818 normA(j1) = sum_column(j1) … … 833 833 ! Scale the input matrices by a power of 2 834 834 scaling = 2.0_jprb**(-expo) 835 doj3 = 1,m836 doj2 = 1,m835 DO j3 = 1,m 836 DO j2 = 1,m 837 837 A(1:iend,j2,j3) = A(1:iend,j2,j3) * scaling 838 838 end do … … 844 844 845 845 V = c(8)*A6 + c(6)*A4 + c(4)*A2 846 doj3 = 1,m846 DO j3 = 1,m 847 847 V(:,j3,j3) = V(:,j3,j3) + c(2) 848 848 end do … … 850 850 V = c(7)*A6 + c(5)*A4 + c(3)*A2 851 851 ! Add a multiple of the identity matrix 852 doj3 = 1,m852 DO j3 = 1,m 853 853 V(:,j3,j3) = V(:,j3,j3) + c(1) 854 854 end do … … 859 859 860 860 ! Add the identity matrix 861 doj3 = 1,m861 DO j3 = 1,m 862 862 A(1:iend,j3,j3) = A(1:iend,j3,j3) + 1.0_jprb 863 863 end do 864 864 865 865 ! Loop through the matrices 866 doj1 = 1,iend866 DO j1 = 1,iend 867 867 if (expo(j1) > 0) then 868 868 ! Square matrix j1 expo(j1) times … … 983 983 984 984 ! Compute V * diag_rdivide_V 985 doj1 = 1,3986 doj2 = 1,3985 DO j1 = 1,3 986 DO j2 = 1,3 987 987 R(1:iend,j2,j1) = V(1:iend,j2,1)*diag_rdivide_V(1:iend,1,j1) & 988 988 & + V(1:iend,j2,2)*diag_rdivide_V(1:iend,2,j1) &
Note: See TracChangeset
for help on using the changeset viewer.