Base linear accelerator subroutine that scales and reorders the system of equations, if necessary, updates the preconditioner, and calls the appropriate linear accelerator.
673
675
676 CLASS(ImsLinearDataType), INTENT(INOUT) :: this
677 integer(I4B), INTENT(INOUT) :: ICNVG
678 integer(I4B), INTENT(IN) :: KSTP
679 integer(I4B), INTENT(IN) :: KITER
680 integer(I4B), INTENT(INOUT) :: IN_ITER
681
682 integer(I4B), INTENT(IN) :: NCONV
683 integer(I4B), INTENT(IN) :: CONVNMOD
684 integer(I4B), DIMENSION(CONVNMOD + 1), INTENT(INOUT) :: CONVMODSTART
685 character(len=31), DIMENSION(NCONV), INTENT(INOUT) :: CACCEL
686 type(ConvergenceSummaryType), pointer, intent(in) :: summary
687
688 integer(I4B) :: n
689 integer(I4B) :: innerit
690 integer(I4B) :: irc
691 integer(I4B) :: itmax
692 real(DP) :: dnrm2
693
694
695 this%EPFACT = ims_base_epfact(this%ICNVGOPT, kstp)
696
697
698 IF (this%ISCL .NE. 0) THEN
699 CALL ims_base_scale(0, this%ISCL, &
700 this%NEQ, this%NJA, this%IA, this%JA, &
701 this%AMAT, this%X, this%RHS, &
702 this%DSCALE, this%DSCALE2)
703 END IF
704
705
706 IF (this%IORD /= 0) THEN
707 CALL dperm(this%NEQ, this%AMAT, this%JA, this%IA, &
708 this%ARO, this%JARO, this%IARO, &
709 this%LORDER, this%ID, 1)
710 CALL dvperm(this%NEQ, this%X, this%LORDER)
711 CALL dvperm(this%NEQ, this%RHS, this%LORDER)
712 this%IA0 => this%IARO
713 this%JA0 => this%JARO
714 this%A0 => this%ARO
715 ELSE
716 this%IA0 => this%IA
717 this%JA0 => this%JA
718 this%A0 => this%AMAT
719 END IF
720
721
722 IF (this%ISCL /= 0) THEN
723 CALL ims_base_cnvg_scale(this%NEQ, this%IORD, this%DSCALE, &
724 this%DSCALE2, this%LORDER, &
725 this%RSCALE, this%HSCALE)
726 END IF
727
728
729 CALL ims_base_pcu(this%iout, this%NJA, this%NEQ, this%NIAPC, this%NJAPC, &
730 this%IPC, this%RELAX, this%A0, this%IA0, this%JA0, &
731 this%APC, this%IAPC, this%JAPC, this%IW, this%W, &
732 this%LEVEL, this%DROPTOL, this%NJLU, this%NJW, &
733 this%NWLU, this%JLU, this%JW, this%WLU)
734
735
736 IF (kiter == 1) then
737 this%NITERC = 0
738 summary%iter_cnt = 0
739 end if
740 irc = 1
741 icnvg = 0
742 DO n = 1, this%NEQ
743 this%D(n) = dzero
744 this%P(n) = dzero
745 this%Q(n) = dzero
746 this%Z(n) = dzero
747 END DO
748
749
750 call ims_base_residual(this%NEQ, this%NJA, this%X, this%RHS, this%D, &
751 this%A0, this%IA0, this%JA0)
752 IF (this%ISCL /= 0) THEN
753 this%L2NORM0 = dzero
754 DO n = 1, this%NEQ
755 this%L2NORM0 = this%L2NORM0 + (this%D(n) * this%RSCALE(n))**2
756 END DO
757 this%L2NORM0 = sqrt(this%L2NORM0)
758 ELSE
759 this%L2NORM0 =
dnrm2(this%NEQ, this%D, 1)
760 END IF
761
762
763 itmax = this%ITER1
764 IF (this%L2NORM0 == dzero) THEN
765 itmax = 0
766 icnvg = 1
767 END IF
768
769
770 IF (this%ILINMETH == 1) THEN
771 CALL ims_base_cg(icnvg, itmax, innerit, &
772 this%NEQ, this%NJA, this%NIAPC, this%NJAPC, &
773 this%IPC, this%ICNVGOPT, this%NORTH, &
774 this%ISCL, this%RSCALE, this%HSCALE, &
775 this%DVCLOSE, this%RCLOSE, this%L2NORM0, &
776 this%EPFACT, this%IA0, this%JA0, this%A0, &
777 this%IAPC, this%JAPC, this%APC, &
778 this%X, this%RHS, this%D, this%P, this%Q, this%Z, &
779 this%NJLU, this%IW, this%JLU, &
780 nconv, convnmod, convmodstart, &
781 caccel, summary)
782
783
784 ELSE IF (this%ILINMETH == 2) THEN
785 CALL ims_base_bcgs(icnvg, itmax, innerit, &
786 this%NEQ, this%NJA, this%NIAPC, this%NJAPC, &
787 this%IPC, this%ICNVGOPT, this%NORTH, &
788 this%ISCL, this%RSCALE, this%HSCALE, &
789 this%DVCLOSE, this%RCLOSE, this%L2NORM0, &
790 this%EPFACT, this%IA0, this%JA0, this%A0, &
791 this%IAPC, this%JAPC, this%APC, &
792 this%X, this%RHS, this%D, this%P, this%Q, &
793 this%T, this%V, this%DHAT, this%PHAT, this%QHAT, &
794 this%NJLU, this%IW, this%JLU, &
795 nconv, convnmod, convmodstart, &
796 caccel, summary)
797 END IF
798
799
800 IF (this%IORD /= 0) THEN
801 CALL dperm(this%NEQ, this%A0, this%JA0, this%IA0, &
802 this%AMAT, this%JA, this%IA, &
803 this%IORDER, this%ID, 1)
804 CALL dvperm(this%NEQ, this%X, this%IORDER)
805 CALL dvperm(this%NEQ, this%RHS, this%IORDER)
806 END IF
807
808
809 IF (this%ISCL .NE. 0) THEN
810 CALL ims_base_scale(1, this%ISCL, &
811 this%NEQ, this%NJA, this%IA, this%JA, &
812 this%AMAT, this%X, this%RHS, &
813 this%DSCALE, this%DSCALE2)
814 END IF
815
816
817
818 in_iter = innerit
real(kind=8) function dnrm2(n, x, incx)
This module contains simulation methods.
subroutine dvperm(n, x, perm)
subroutine dperm(nrow, a, ja, ia, ao, jao, iao, perm, qperm, job)