Changeset 13bb187
- Timestamp:
- 12/14/10 11:08:56 (2 years ago)
- Branches:
- master, external, fix-prolong, refactor, refactor-subsolvers
- Children:
- d69332b
- Parents:
- 8a2eebe
- git-author:
- Oleg Batrashev <ogbash@…> (12/14/10 11:08:56)
- git-committer:
- Oleg Batrashev <ogbash@…> (12/14/10 11:08:56)
- File:
-
- 1 edited
-
src/solvers/pcg.F90 (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/solvers/pcg.F90
r8a2eebe r13bb187 429 429 ! First iteration - send matrix 430 430 call prec2Level_exchangeMatrix(CoarseMtx_) 431 432 ! factorise coarse matrix 433 write (stream,*) & 434 'factorising coarse matrix of size',CoarseMtx_%nrows, & 435 ' and nnz:',CoarseMtx_%nnz 436 call free_spmtx_subsolves(CoarseMtx_) 437 allocate(CoarseMtx_%subsolve_ids(1)) 438 CoarseMtx_%subsolve_ids=0 439 CoarseMtx_%nsubsolves=1 440 441 ! Factorise the matrix 442 if (sctls%verbose>2) then 443 write(stream,*)'Global coarse matrix is:---------' 444 do i=1,CoarseMtx_%nnz 445 write(stream,*) CoarseMtx_%indi(i),& 446 CoarseMtx_%indj(i),CoarseMtx_%val(i) 447 enddo 448 write(stream,*)'---------------------------------' 431 end if 432 433 ! after coarse matrix is received allocate coarse vectors 434 if (isFirstIter.and.sctls%levels>1) then 435 if (associated(crhs)) then 436 if (size(crhs)/=CoarseMtx_%ncols) then 437 deallocate(csol) 438 deallocate(crhs) 439 allocate(crhs(CoarseMtx_%ncols)) 440 allocate(csol(CoarseMtx_%nrows)) 441 endif 442 else 443 allocate(crhs(CoarseMtx_%ncols)) 444 allocate(csol(CoarseMtx_%nrows)) 449 445 endif 450 call factorise(CoarseMtx_%subsolve_ids(1), & 451 nfreds=CoarseMtx_%nrows, & 452 nnz=CoarseMtx_%nnz, & 453 indi=CoarseMtx_%indi, & 454 indj=CoarseMtx_%indj, & 455 val=CoarseMtx_%val) 456 CoarseMtx_%indi=CoarseMtx_%indi+1 457 CoarseMtx_%indj=CoarseMtx_%indj+1 458 end if 459 460 ! after coarse matrix is received allocate coarse vectors 461 if (isFirstIter.and.sctls%levels>1) then 462 if (associated(crhs)) then 463 if (size(crhs)/=CoarseMtx_%ncols) then 464 deallocate(csol) 465 deallocate(crhs) 466 allocate(crhs(CoarseMtx_%ncols)) 467 allocate(csol(CoarseMtx_%nrows)) 468 endif 469 else 470 allocate(crhs(CoarseMtx_%ncols)) 471 allocate(csol(CoarseMtx_%nrows)) 472 endif 473 allocate(clrhs(Restrict%nrows)) ! allocate memory for vector 474 end if 475 if (.not.associated(tmpsol)) then 476 !allocate(tmpsol(A%nrows)) 477 allocate(tmpsol(size(rhs))) 478 endif 479 480 if (cdat%active) then 446 allocate(clrhs(Restrict%nrows)) ! allocate memory for vector 447 end if 448 if (.not.associated(tmpsol)) then 449 !allocate(tmpsol(A%nrows)) 450 allocate(tmpsol(size(rhs))) 451 endif 452 453 if (cdat%active) then 481 454 ! Send coarse vector 482 455 call SpMtx_Ax(clrhs,Restrict,rhs,dozero=.true.) ! restrict <RA> … … 503 476 if (sctls%levels>1) then 504 477 ol=max(sctls%overlap,sctls%smoothers) 505 if (isFirstIter) then 506 if (.not.cdat%active) then ! 1 processor case 507 if (sctls%smoothers==-1) then 508 allocate(tmpsol2(A%nrows)) 509 tmpsol2=0.0_rk 510 call exact_sparse_multismoother(tmpsol2,A,rhs) 511 call SpMtx_Ax(crhs,Restrict,tmpsol2,dozero=.true.) ! restriction 478 if (isFirstIter.and..not.cdat%active) then ! 1 processor case 479 if (sctls%smoothers==-1) then 480 allocate(tmpsol2(A%nrows)) 481 tmpsol2=0.0_rk 482 call exact_sparse_multismoother(tmpsol2,A,rhs) 483 call SpMtx_Ax(crhs,Restrict,tmpsol2,dozero=.true.) ! restriction 484 else 485 if (sctls%method>1.and.sctls%method/=5) then ! multiplicative Schwarz 486 call SpMtx_Ax(crhs,Restrict,res,dozero=.true.) ! restriction 512 487 else 513 if (sctls%method>1.and.sctls%method/=5) then ! multiplicative Schwarz 514 call SpMtx_Ax(crhs,Restrict,res,dozero=.true.) ! restriction 515 else 516 call SpMtx_Ax(crhs,Restrict,rhs,dozero=.true.) ! restriction 517 endif 488 call SpMtx_Ax(crhs,Restrict,rhs,dozero=.true.) ! restriction 518 489 endif 519 490 endif 520 end if491 endif 521 492 end if 522 493 523 !csol=0.0_rk494 !csol=0.0_rk 524 495 if (cdat%active) then 525 496 ! Recieve the vector for solve … … 533 504 !write(stream,*) "Got coarse vector!" 534 505 !call MPI_BARRIER(MPI_COMM_WORLD,i) 535 536 call sparse_singlesolve(CoarseMtx_%subsolve_ids(1),csol,crhs,nfreds=CoarseMtx_%nrows) 537 write (stream,*) 'coarse factorisation done!',CoarseMtx_%subsolve_ids(1) 506 end if 507 508 if (sctls%levels>1) then 509 if (isFirstIter) then 510 write (stream,*) & 511 'factorising coarse matrix of size',CoarseMtx_%nrows, & 512 ' and nnz:',CoarseMtx_%nnz 513 call free_spmtx_subsolves(CoarseMtx_) 514 allocate(CoarseMtx_%subsolve_ids(1)) 515 CoarseMtx_%subsolve_ids=0 516 CoarseMtx_%nsubsolves=1 517 end if 518 519 ! Coarse solve 520 call sparse_singlesolve(CoarseMtx_%subsolve_ids(1),csol,crhs,& 521 nfreds=CoarseMtx_%nrows, & 522 nnz=CoarseMtx_%nnz, & 523 indi=CoarseMtx_%indi, & 524 indj=CoarseMtx_%indj, & 525 val=CoarseMtx_%val) 538 526 if (bugtrack)write(stream,*) "(f) Coarse SOL is:",csol 539 end if 540 541 if (sctls%levels>1) then 527 542 528 if (cdat_vec%active) then 543 529 call Vect_remap(csol,clrhs,cdat_vec%gl_cfmap,dozero=.true.)
Note: See TracChangeset
for help on using the changeset viewer.
