回 帖 发 新 帖 刷新版面

主题:BICGSTAB测试问题


帮忙测试下下面我写的bicgstab子程序吧,为什么我自己测试的线性方程组老是求解出错
哪位达人能提供下可以用的权威测试例子?
我自己测试的结果是
第1次迭代后的残差为:    0.2677087229D+02
第2次迭代后的残差为:    0.2234323081D+02
第3次迭代后的残差为:    0.1579755198D+02
第4次迭代后的残差为:    0.1342154479D+02
第5次迭代后的残差为:    0.1605011227D+02
第6次迭代后的残差为:    0.2511729052D-03
第7次迭代后的残差为:    0.5275236190D-06
第8次迭代后的残差为:    0.1909758431D-08
 one of the scalar quantities calculated during BICGSTAB became too small!
 BICGSTAB is failed!
Press any key to continue


!main.f90
program SOR_BICGSTAB_CSR_test
implicit none
integer, parameter :: N=8,NNZ=28,ITMAX = 100
complex(8) :: rhs(n),X(N),expected_sol(N)
real(8) :: reg_err(ITMAX)
integer :: jcol(N+1)
integer :: irw(NNZ)
complex(8) :: A(NNZ)
real(8) :: W,EPS
INTEGER :: IT
      DATA jcol /1,5,8,12,14,18,22,26,29/
      DATA irw      /1,    3,       6, 7,        &
                        2, 3,    5,              &
                     1, 2, 3,             8,     &
                              4,       7,        &
                        2,       5, 6, 7,        &
                        2,       5, 6,    8,      &
                     1,       4, 5,    7,        &
                           3,       6,    8/ 
      DATA A      /7.D0,      1.D0,           2.D0, 7.D0,         &    
                        -4.D0,8.D0,     2.D0,                     &
                   6.D0, 8.D0,1.D0,                      3.D0,    &
                                   7.D0,            9.D0,               &
                         2.D0,          5.D0, 1.D0, 3.D0,         &
                         2.D0,          1.D0,-1.D0,      5.D0,    &
                   7.D0,           9.D0,5.D0,      11.D0,         &
                              2.D0,           5.D0,      5.D0/

    X=(1.0D0,0.0D0)
    call MatMulVec_US_CSR(N,NNZ,A,X,rhs,irw,jcol)
    X = (0.0D0,0.0D0)
    EPS = 1.0D-10                      
    W = 1
    call SOR_BICGSTAB_CSR(N,NNZ,A,rhs,X,irw,jcol,EPS,ITMAX,W,IT,reg_err)

    write(*,*) X,IT,REG_ERR(IT)
    stop
    end program
!bicgstab子程序在代码包里面,包括bicgstab的理论公式,采用按行非零压缩存储格式(CSR)

回复列表 (共2个回复)

沙发

晕,自己顶下~

板凳

第1次迭代后的残差为:    0.2271489274D+02
第2次迭代后的残差为:    0.1487400374D+02
第3次迭代后的残差为:    0.6260700913D+01
第4次迭代后的残差为:    0.1370947852D-01
第5次迭代后的残差为:    0.3543739458D-05
第6次迭代后的残差为:    0.3848020988D-06
第7次迭代后的残差为:    0.1748063348D-07
 BICGSTAB converged to the desired tolerance TOL within MAXIT iterations!
 (1.00000000000000,0.000000000000000E+000)
 (0.999999999999999,0.000000000000000E+000)
 (0.999999999999999,0.000000000000000E+000)
 (1.00000000000000,0.000000000000000E+000)
 (1.00000000000000,0.000000000000000E+000)
 (1.00000000000000,0.000000000000000E+000)
 (1.00000000000000,0.000000000000000E+000)
 (1.00000000000000,0.000000000000000E+000)           7  1.748063348013518E-008
Press any key to continue

我来回复

您尚未登录,请登录后再回复。点此登录或注册