Changeset dc3a733
- Timestamp:
- 01/05/11 12:34:26 (2 years ago)
- Branches:
- master, external, fix-prolong, refactor-subsolvers
- Children:
- 197fc72
- Parents:
- 0842cf5
- git-author:
- Oleg Batrashev <ogbash@…> (01/05/11 12:34:26)
- git-committer:
- Oleg Batrashev <ogbash@…> (01/05/11 12:34:26)
- File:
-
- 1 edited
-
src/solvers/pcg.F90 (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/solvers/pcg.F90
r0842cf5 rdc3a733 245 245 end subroutine pcg 246 246 247 subroutine prec onditioner_1level(sol,A,rhs,M,res,A_interf_,refactor_)247 subroutine prec1Level(sol,A,rhs,M,res,A_interf_,CoarseMtx_,Restrict,refactor_) 248 248 implicit none 249 249 real(kind=rk),dimension(:),pointer :: sol !< solution … … 254 254 !! here for multiplicative Schwarz 255 255 type(SpMtx),optional :: A_interf_ !< matr@interf. 256 logical,intent(inout),optional :: refactor_ 256 type(SpMtx),optional :: CoarseMtx_ !< Coarse matrix 257 type(SpMtx),optional :: Restrict !< Restriction matrix 258 logical,intent(inout),optional :: refactor_ 257 259 258 260 type(SpMtx) :: A_tmp 259 261 260 if (refactor_) then!{ 261 if (sctls%verbose>9) then 262 !call SpMtx_printMat(A) 263 call SpMtx_printRaw(A) 264 !call SpMtx_printMat(A_interf_) 265 call SpMtx_printRaw(A_interf_) 266 !stop 267 endif 268 call Factorise_subdomains(A,A_interf_) 269 refactor_=.false. 270 end if 271 call solve_subdomains(sol,A,rhs) 272 273 if (sctls%method>1) then ! For multiplicative Schwarz method...: 262 if(sctls%method==1) then 263 if (refactor_) then!{ 264 if (.not.present(CoarseMtx_).or.sctls%input_type==DCTL_INPUT_TYPE_ELEMENTAL.or.numprocs>1) then 265 call Factorise_subdomains(A,A_interf_) 266 else 267 if (.not.present(Restrict)) call DOUG_abort("Restriction matrix needs to be passed along with the coarse matrix!") 268 call Factorise_subdomains(A,AC=CoarseMtx_) 269 end if 270 refactor_=.false. 271 end if 272 call solve_subdomains(sol,A,rhs) 273 274 else if (sctls%method>1) then ! For multiplicative Schwarz method...: 274 275 if (numprocs>1) call DOUG_abort('multiplicative Schwarz only for numprocs==1 so far',-1) 275 call multiplicative_sparse_multisolve(sol,A,M,rhs,res,A_interf_,refactor=refactor_) 276 if (.not.present(CoarseMtx_).or.sctls%input_type==DCTL_INPUT_TYPE_ELEMENTAL) then 277 call multiplicative_sparse_multisolve(sol=sol,A=A,M=M,rhs=rhs,res=res, & 278 A_interf_=A_interf_, & 279 refactor=refactor_) !fine solves 280 else 281 if (.not.present(Restrict)) call DOUG_abort("Restriction matrix needs to be passed along with the coarse matrix!") 282 call multiplicative_sparse_multisolve(sol=sol,A=A,M=M,rhs=rhs,res=res, & 283 A_interf_=A_interf_,AC=CoarseMtx_, & 284 refactor=refactor_,Restrict=Restrict) !fine solves 285 end if 276 286 refactor_=.false. 277 call multiplicative_sparse_multisolve(sol,A,M,rhs,res,A_interf_,refactor=refactor_) !fine solves278 287 endif 279 280 end subroutine preconditioner_1level 288 end subroutine prec1Level 281 289 282 290 subroutine prec2Level(prepare,A,sol,rhs,res,CoarseMtx_,Restrict,isFirstIter) … … 494 502 return 495 503 endif 504 496 505 sol=0.0_rk 497 506 if (sctls%method>1) then ! For multiplicative Schwarz method...: 498 507 allocate(res(size(rhs))) 499 508 endif 500 if (present(CoarseMtx_)) then !{501 write(stream,*) "Coarse matrix is present in preconditioner"502 if (.not.present(Restrict)) call DOUG_abort("Restriction matrix needs to be passed along with the coarse matrix!")503 509 504 if (sctls%levels>1) then 505 call prec2Level(.true.,A,sol,rhs,res,CoarseMtx_,Restrict,isFirstIter) 506 end if 507 508 ! first level prec 509 if (sctls%method>1) then 510 if (numprocs>1) call DOUG_abort('multiplicative Schwarz only for numprocs==1 so far',-1) 511 if (sctls%input_type==DCTL_INPUT_TYPE_ELEMENTAL.or.numprocs>1) then 512 call multiplicative_sparse_multisolve(sol,A,M,rhs,res,A_interf_,refactor=refactor_) 513 else 514 call multiplicative_sparse_multisolve(sol,A,M,rhs,res,A_interf_,CoarseMtx_,refactor_,Restrict) 515 end if 516 else 517 if (isFirstIter) then 518 if (sctls%input_type==DCTL_INPUT_TYPE_ELEMENTAL.or.numprocs>1) then 519 call Factorise_subdomains(A,A_interf_) 520 else 521 call Factorise_subdomains(A,AC=CoarseMtx_) 522 end if 523 end if 524 call solve_subdomains(sol,A,rhs) 525 endif 526 527 if (sctls%levels>1) then 528 call prec2Level(.false.,A,sol,rhs,res,CoarseMtx_,Restrict,isFirstIter) 529 end if 530 531 if (sctls%method>1) then ! For multiplicative Schwarz method...: 532 refactor_=.false. 533 if (numprocs>1) call DOUG_abort('multiplicative Schwarz only for numprocs==1 so far',-1) 534 535 if (sctls%input_type==DCTL_INPUT_TYPE_ELEMENTAL) then 536 call multiplicative_sparse_multisolve(sol=sol,A=A,M=M,rhs=rhs,res=res, & 537 A_interf_=A_interf_, & 538 refactor=refactor_) !fine solves 539 else 540 call multiplicative_sparse_multisolve(sol=sol,A=A,M=M,rhs=rhs,res=res, & 541 A_interf_=A_interf_,AC=CoarseMtx_, & 542 refactor=refactor_,Restrict=Restrict) !fine solves 543 endif 544 endif 545 else !}{ 546 write(stream,*) "Coarse matrix is not present in preconditioner" 547 call preconditioner_1level(sol,A,rhs,M,res,A_interf_,refactor_) 548 endif !} 510 if (sctls%levels>1) then 511 call prec2Level(.true.,A,sol,rhs,res,CoarseMtx_,Restrict,isFirstIter) 512 end if 513 514 ! first level prec 515 call prec1Level(sol,A,rhs,M,res,A_interf_,CoarseMtx_,Restrict,refactor_) 516 517 if (sctls%levels>1) then 518 call prec2Level(.false.,A,sol,rhs,res,CoarseMtx_,Restrict,isFirstIter) 519 end if 520 549 521 if (sctls%method>1) then ! For multiplicative Schwarz method...: 522 call prec1Level(sol,A,rhs,M,res,A_interf_,CoarseMtx_,Restrict,refactor_) 550 523 if (associated(res)) deallocate(res) 551 524 endif
Note: See TracChangeset
for help on using the changeset viewer.
