[petsc-users] PetscOptionsSetValue syntax

Karthikeyan Chockalingam - STFC UKRI karthikeyan.chockalingam at stfc.ac.uk
Fri Nov 18 07:31:57 CST 2022


Hello,

I would like to move from code to using options.

   KSP           ksp;
    PC            pc;
    KSPCreate(PETSC_COMM_WORLD, &ksp);
    KSPSetOperators(ksp, A, A);

I tried using PetscOptionsSetValue as below


    ierr = PetscOptionsSetValue(NULL,"-ksp_type", "cg"); CHKERRQ(ierr);

    ierr = PetscOptionsSetValue(NULL,"-pc_type", "jacobi"); CHKERRQ(ierr);

    ierr = PetscOptionsSetValue(NULL, "-ksp_monitor", NULL);CHKERRQ(ierr);

    ierr = PetscOptionsSetValue(NULL, "-ksp_view", NULL);CHKERRQ(ierr);

    ierr = PetscOptionsSetValue(NULL, "-ksp_monitor_true_residual", NULL);CHKERRQ(ierr);

    ierr = PetscOptionsSetValue(NULL, "-ksp_converged_reason", NULL);CHKERRQ(ierr);



    KSPSolve(ksp, b, x);

But I believe none of the string flags where picked up by PETSc. What am I missing?

Thank you for your help.

Kind regards,
Karthik.

This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221118/d086b188/attachment.html>


More information about the petsc-users mailing list