# About the interface to petsc

**URL:** <https://community.freefem.org/t/about-the-interface-to-petsc/37>\
**Category:** Feature Request\
**Created:** [April 29, 2019, 11:44am UTC](https://community.freefem.org/t/about-the-interface-to-petsc/37 "2019-04-29T11:44:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guoliang](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@guoliang](https://community.freefem.org/u/guoliang)\
**Post date:** [April 29, 2019, 11:44am UTC](https://community.freefem.org/t/about-the-interface-to-petsc/37/1 "2019-04-29T11:44:31Z")

</div>

I want to learn more about how to use the interface of PETSc to solve a problem using domain decomposition. From the file hpddm of Freefem Source, I don’t know how to use the preconditioner designed by ourself and how to use the two-level method. Who can tell me, thanks a lot.

---

<div class="post-metadata">

**Author:** ![simon.garnotel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/simon.garnotel/32/11_2.png) [@simon.garnotel](https://community.freefem.org/u/simon.garnotel)\
**Post date:** [May 7, 2019, 2:06pm UTC](https://community.freefem.org/t/about-the-interface-to-petsc/37/2 "2019-05-07T14:06:02Z")

</div>

I don’t know if you can use a custom preconditioner (I think no).

For other parameter of PETSc, you have to directly write your parameters in the `sparams` parameter of the `set` function. For exemple if you want to use ASM, you have to write:

```auto
set(A, sparams="-pc_type asm -ksp_view -sub_ksp_type gmres -ksp_type fgmres");

```

The PETSc [SNES non linear solver](https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/index.html) is equally interfaced

---

<div class="post-metadata">

**Author:** ![guoliang](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@guoliang](https://community.freefem.org/u/guoliang)\
**Post date:** [May 8, 2019, 2:32am UTC](https://community.freefem.org/t/about-the-interface-to-petsc/37/3 "2019-05-08T02:32:03Z")

</div>

Thanks for your answer.

And if I have a new preconditioner, how to use it by “set”? is there any reference?
