<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class="">
<blockquote type="cite" class="">
<div dir="ltr" class="" style="caret-color: rgb(0, 0, 0);">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
See for example snes/examples/tutorials/ex12.c this is a way over complicated with lots of options, but it is one of the most basic for use DMPLEX for a PDE. See SetupDiscretization() for how it creates the FE and DS objects.</blockquote>
</div>
</div>
</blockquote>
</div>
<div class=""><br class="">
</div>
Yes I ended up getting the problem to work with snes instead, using ex12 as a template. I think it is a useful example for making laplacians, but a bit tough to follow from the code at first.
<div class=""><br class="">
<div class="">
<div>Best,</div>
<div><br class="">
</div>
<div>Jacob</div>
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Nov 17, 2019, at 5:59 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div dir="ltr" class="">On Sun, Nov 17, 2019 at 12:15 PM Smith, Barry F. via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> wrote:<br class="">
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<br class="">
<br class="">
> On Nov 14, 2019, at 12:30 PM, Faibussowitsch, Jacob via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank" class="">petsc-dev@mcs.anl.gov</a>> wrote:<br class="">
><span class="Apple-converted-space"> </span><br class="">
> Hello,<br class="">
><span class="Apple-converted-space"> </span><br class="">
> So I am trying to make a simple 5 pt stencil finite difference laplacian operator (<a href="https://akmitra.public.iastate.edu/aero361/design_web/Laplace.pdf" rel="noreferrer" target="_blank" class="">https://akmitra.public.iastate.edu/aero361/design_web/Laplace.pdf</a>)
work on a dmplex mesh, but all of the examples that I have found in ksp/examples/tutorials all use DMDA. The only way that I have managed to get the KSP to even run is by creating the operator matrix myself by hand. The workflow for the working implementation
is as follows:<br class="">
><span class="Apple-converted-space"> </span><br class="">
> DMPlexMakeBoxMesh -> KSPCreate -> KSPsetDM -> KSPDeactiveDM -> Make the matrix by hand -> KSPSetOperator(matrix) -> KSPSetComputeRHS -> Solve<br class="">
><span class="Apple-converted-space"> </span><br class="">
> Given that I tether KSP to the DM by KSPSetDM, but then immediately deactivate it (because then it complains about mallocs), this doesn’t work when reading in an actual unstructured mesh. Does KSP just not support dmplex?<br class="">
<br class="">
Nothing to do with KSP supporting DMPLEX.<span class="Apple-converted-space"> </span><br class="">
<br class="">
For a given DMDA the matrix structure is completely determined when using finite differences, thus DMDA can always create an empty sparse matrix ready for KSP. Then one can either fill in the sparse matrix (as do many of the examples) with values for a particular
PDE or have the MatFDColoring code compute the matrix entries from the provided RHS function.<br class="">
<br class="">
For DMPLEX the flex object itself does not have enough information to create a sparse matrix; it would be ill-defined since the matrix depends on the finite element space, boundary conditions etc. So it would really be DMPLEX + PETSCFE and a bunch of stuff
to fully define the matrix.<span class="Apple-converted-space"> </span><br class="">
<br class="">
See for example snes/examples/tutorials/ex12.c this is a way over complicated with lots of options, but it is one of the most basic for use DMPLEX for a PDE. See SetupDiscretization() for how it creates the FE and DS objects.<br class="">
</blockquote>
<div class=""><br class="">
</div>
<div class="">Barry is right, also about ex12 being too complicated for this kind of a question. So I made ex13, which is the same thing, but</div>
<div class="">with far fewer variants, so its easier to see what is happening.</div>
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
><span class="Apple-converted-space"> </span><br class="">
> Best,<br class="">
><span class="Apple-converted-space"> </span><br class="">
> Jacob<br class="">
><span class="Apple-converted-space"> </span><br class="">
<br class="">
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
--<span class="Apple-converted-space"> </span><br class="">
<div dir="ltr" class="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>