[petsc-users] New to using PETSc, running into issue

Alberto Cattaneo bubu.cattaneo at gmail.com
Wed Jul 19 21:04:25 CDT 2023


Greetings
I hope this email reaches you well. I'm new to using PETSc and so I thought
a good way to familiarize myself with the tools would be to noodle around
with a simple problem and see how different setups of the same problem play
out. I thought it would be prudent to try ex50.c with different linear
solvers to see how they compare on a simple problem that was easy enough to
tweak. However I'm having some trouble, when I try to set the KSP type the
only one that seems to work is KSP_CG_SYMMETRIC, all others throw up an
error like this

/home/cattaneo/petsc-3.19.1/include/petscksp.h:59:23: error: incompatible
type for argument 2 of ‘KSPCGSetType’
   59 | #define KSPTCQMR      "tcqmr"
      |                       ^~~~~~~
      |                       |
      |                       const char *
/home/cattaneo/petsc-3.19.1/include/petscerror.h:473:28: note: in
definition of macro ‘PetscCall’
  473 |       ierr_petsc_call_q_ = __VA_ARGS__; \
      |                            ^~~~~~~~~~~
ex50B.c:56:29: note: in expansion of macro ‘KSPTCQMR’
   56 |  PetscCall(KSPCGSetType(ksp,KSPTCQMR));
      |                             ^~~~~~~~
In file included from ex50B.c:25:
/home/cattaneo/petsc-3.19.1/include/petscksp.h:884:47: note: expected
‘KSPCGType’ but argument is of type ‘const char *’
  884 | PETSC_EXTERN PetscErrorCode KSPCGSetType(KSP, KSPCGType);

When trying to make the file. I suspect I'm missing something fundamental,
but I can't seem to chase whatever it is down. I am using PETSc on WSL2 on
Windows 10 which I know is not the standard, but so far it hasn't seemed to
cause trouble. I'm confused because I'm using the same make that is used
for all the examples, and it doesn't seem to have an issue using
KSPGMRES for ex62 as an example. Sorry if this is a basic question, I'm
just a little unsure where to turn as I don't really know anyone that uses
PETSc. Thank you for your time.
Respectfully:
Alberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230719/4841f581/attachment.html>


More information about the petsc-users mailing list