[petsc-users] DMPlex adding boundary without PETSc discretization

Matthew Knepley knepley at gmail.com
Thu Oct 20 08:47:47 CDT 2022


On Thu, Oct 20, 2022 at 9:42 AM Gong Yujie <yc17470 at connect.um.edu.mo>
wrote:

> Dear development team,
>
> I'm trying to write a code to solve a partial differential equation. I
> didn't use PETSc's discretization. I have a question about the
> implementation of the boundary condition (Dirichlet boundary condition).
> When implementing the Dirichlet boundary condition. I need to set the
> corresponding rows in the Jacobian matrix diagonal 1 and others 0. I
> created the matrix use DMCreateMatrix.
>

For this, you can use

  https://petsc.org/main/docs/manualpages/Mat/MatZeroRows/
  https://petsc.org/main/docs/manualpages/Mat/MatZeroRowsColumns/


> Can I add the Dirichlet boundary condition to the DMPlex mesh so that the
> Jacobian matrix won't contain these Dirichlet boundary rows? If yes, is
> there a function that can set the Dirichlet boundary points' value?
>

If you are not using the PETSc discretization, that means you gave a
PetscSection to the DMPlex so that it could make the Mat. You can add
constraints to that Section in order to eliminate some unknowns.

  Thanks,

     Matt


> Best Regards,
> Jerry
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221020/504bbafc/attachment.html>


More information about the petsc-users mailing list