Menu

Can't retrieve bicgstab.error() nor bicgstab.iters() from the iterative solvers:

tario
2017-09-06
2017-09-06
  • tario

    tario - 2017-09-06

    Hello,

    I want to retrieve some information from the iterative solver cg and bicgstab to monitor overall convergence of the simulation, but they are "uninitialized" hence last error and #iters are not available.

    test code:

        solverPerf.initialResidual() = 0.03; // works, test    
        solverPerf.finalResidual() = (ScalarType)bicgstab.error(); // wrong value, test
        solverPerf.nIterations() = (ScalarType)bicgstab.iters(); 
    

    warning:
    clPBiCGStab_solve.C:75:62: warning: ‘((void)& bicgstab +40)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    solverPerf.finalResidual() = (ScalarType)bicgstab.error();
    ^
    clPBiCGStab_solve.C:76:60: warning: ‘((void)& bicgstab +32)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    solverPerf.nIterations() = (ScalarType)bicgstab.iters();

    How can I initialize the functions?

    T.

     
  • Karl Rupp

    Karl Rupp - 2017-09-06

    Hi Tario,
    how do you initialize the bicgstab object? Do you pass it to the solve() call? I can't say what's going on based on your description.
    Best regards,
    Karli

     
  • tario

    tario - 2017-09-06

    This is the bicgstab related section:

    viennacl::linalg::bicgstab_tag bicgstab(tolerance_, maxIter_); // Set solver tolerance and maximum iterations

    // BLOCK PRECONDITIONER SETUP --------------------------------------------------------------------

    viennacl::linalg::block_ilu_precond< viennacl::compressed_matrix<ScalarType>,
    viennacl::linalg::ilu0_tag> vcl_block_ilu0(vcl_matrix, viennacl::linalg::ilu0_tag());

    // ---------------------------------------------------------------------------------------------------------------

    //solverPerf.initialResidual() = (ScalarType)cg_tag.error();

    // Solve the linear system
    vcl_psi = solve(vcl_matrix,
    vcl_source,
    viennacl::linalg::bicgstab_tag(),
    vcl_block_ilu0);

     
  • Karl Rupp

    Karl Rupp - 2017-09-06

    Hi,

    please use

    vcl_psi = solve(vcl_matrix,
    vcl_source,
    bicgstab,   // pass the previously created object here
    vcl_block_ilu0); 
    

    for the solver call.

    Best regards,
    Karli

     

Log in to post a comment.