<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Dear all,</p>
<p>I am using TS to solve the PDE </p>
<p>u_t + c * u_c = eps * u_xx in 1D i.e. smthg. similar to <a class="moz-txt-link-freetext" href="https://urldefense.us/v3/__https://petsc.org/release/src/ts/tutorials/ex4.c.html__;!!G_uCfscf7eWS!eeErx_FNg50N1eRlD9eyfoEp8I0llTQmVFpPWoz5_LQhL8K6uOId5zbgle0ghE71NJmon8T_vwwfN3LnEbf4cTUXtlkWJRflikU$">https://petsc.org/release/src/ts/tutorials/ex4.c.html</a></p>
<p>except that I am using DMPlex, instead of a structured grid.<br>
</p>
<p>Since the problem is linear, I tried smthg. like:</p>
<blockquote type="cite"><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">
PetscCall(RHSMatrixHeat(ts,</span><span
style="color:#b21818;background-color:#ffffff;">0.0</span><span
style="color:#000000;background-color:#ffffff;">,u,A,A,&appctx));
</span><br>
PetscCall(TSSetRHSFunction(ts,<span
style="color:#b21818;background-color:#ffffff;">NULL</span><span
style="color:#000000;background-color:#ffffff;">,TSComputeRHSFunctionLinear,&appctx));
</span><br>
PetscCall(TSSetRHSJacobian(ts,A,A,TSComputeRHSJacobianConstant,&appctx));<br>
<br>
</span></blockquote>
<p>My problem is that the A matrix (as well as the global vector) is
missing the rows/cols corresponding to the endpoints where
Dirichlet boundary conditions are prescribed;</p>
<p> </p>
<blockquote type="cite">A global vector is missing both the shared
dofs which are not owned by this process, as well as <em>constrained</em>
dofs. These constraints represent essential (Dirichlet) boundary
conditions. They are dofs that have a given fixed value, so they
are present in local vectors for assembly purposes, but absent
from global vectors since they are never solved for during
algebraic solves.</blockquote>
<p>therefore, A*u = f(u) except in the two vertices adjacent to the
endpoints, i.e. first and last entries of the global vector.<br>
</p>
<p>The code is attached; when the flag -use_jacobian is set, f(u) is
computed as A*u, if it is not set, f(u) is computed in
FormRHSFunction.</p>
<p>The latter approach works, the former does not.<br>
</p>
<p>Regards,</p>
<p>Aldo<br>
</p>
<pre class="moz-signature" cols="72">--
Dr. Aldo Bonfiglioli
Associate professor of Fluid Machines
Scuola di Ingegneria
Universita' della Basilicata
V.le dell'Ateneo lucano, 10 85100 Potenza ITALY
tel:+39.0971.205203 fax:+39.0971.205215
web: <a class="moz-txt-link-freetext" href="https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!eeErx_FNg50N1eRlD9eyfoEp8I0llTQmVFpPWoz5_LQhL8K6uOId5zbgle0ghE71NJmon8T_vwwfN3LnEbf4cTUXtlkWzhmq6Yg$">http://docenti.unibas.it/site/home/docente.html?m=002423</a></pre>
</body>
</html>