<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> David,<div class=""><br class=""></div><div class=""> I don't think you can do it directly, you need to know how to adjust the matrix entry and make the entry. The reason is that when you put a value in the ghost location nothing knows that you have done this and thus nothing has the information to help with the Jacobian. </div><div class=""><br class=""></div><div class=""> Here is how you can do it with a contrived example</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> Ghost location First location second location</div><div class=""><br class=""></div><div class=""> NULL x_0 x_1</div><div class=""><br class=""></div><div class=""> .2*x_0 x_0 x_1</div><div class=""><br class=""></div><div class=""> f(ghost,x_0) f(x_0,x_1)</div><div class=""><br class=""></div><div class=""> Now the derivative of f() with respect to x_0 is partial f/partial ghost * partial ghost /partial x_0 + partial f /partial x_0</div><div class=""><div><br class=""></div><div>partial f/partial ghost * .2 + partial f /partial x_0</div><div><br class=""></div><div><br class=""></div><div> Barry</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 9, 2020, at 10:53 AM, David Scott <<a href="mailto:d.scott@epcc.ed.ac.uk" class="">d.scott@epcc.ed.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
<div class="">
Hello Matt,<br class="">
<br class="">
I am sorry that I have not replied before now.<br class="">
<br class="">
I think that the reason you did not understand the question was that
the question was silly but I'll try to explain my thought process
anyway.<br class="">
<br class="">
If you have a periodic boundary condition then when you construct a
matrix to be used by a KSP it can address the ghost points
corresponding to the periodic boundaries. So, I wondered if when you
have ghosted boundary conditions you could refer to those ghosted
points too when constructing the matrix. This led on to the question
of how those values would be obtained when the linear solver came to
be executed.<br class="">
<br class="">
At this point I expect you are asking why on earth I would want to
do that and I do not have an adequate response.<br class="">
<br class="">
I am sorry I wasted your time and thanks for your help,<br class="">
<br class="">
David<br class="">
<br class="">
<div class="moz-cite-prefix">On 18/02/2020 20:23, Matthew Knepley
wrote:<br class="">
</div>
<blockquote type="cite" cite="mid:CAMYG4G=ifm4dE1mtHadmWkO7vFb1Ucp5MeCMm9ubyyGeX8Oa1Q@mail.gmail.com" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">On Tue, Feb 18, 2020 at 10:23 AM SCOTT David <<a href="mailto:d.scott@epcc.ed.ac.uk" moz-do-not-send="true" class="">d.scott@epcc.ed.ac.uk</a>>
wrote:<br class="">
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div class="">
<tt class="">Hello Matt,<br class="">
<br class="">
Thanks for the quick response.<br class="">
<br class="">
Sorry to be dense but I want the ghost(ed) values to be
used by KSPSolve where the KSP has an associated DM. I
can, of course create a local vector using
DMGetLocalVector and then populate the ghosted locations
but I do not know how to get the KSPSolve to use these
values in the way that automatically generated periodic,
ghost values would be.<br class="">
</tt></div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Let me try and understand. We normally distinguish
between global vectors and local vectors. Global vectors,
used in the solver, describe the entire space. Local
vectors, used in assembly, describe overlapping patches of
the space. The ghost values would only be used in assembly,
not in the solver, since they help make the correct value,
but have no equation associated with themselves. Am I
misunderstanding something?</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:1px solid
rgb(204,204,204);padding-left:1ex">
<div class=""><tt class="">
Thanks,<br class="">
<br class="">
David<br class="">
</tt><br class="">
<div class="">On 18/02/2020 12:42, Matthew Knepley wrote:<br class="">
</div>
<blockquote type="cite" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">On Tue, Feb 18, 2020 at 6:03 AM David
Scott <<a href="mailto:d.scott@epcc.ed.ac.uk" target="_blank" moz-do-not-send="true" class="">d.scott@epcc.ed.ac.uk</a>>
wrote:<br class="">
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
Hello,<br class="">
<br class="">
I wish to solve a channel flow problem with
different boundary<br class="">
conditions. In the streamwise direction I may have
periodic or<br class="">
inlet/outlet BCs. I would like to make my code for
the two cases as<br class="">
similar as possible. If I use DM_BOUNDARY_PERIODIC
then when performing<br class="">
a linear solve the ghost values will be set
automatically. For the<br class="">
inlet/outlet case can I use DM_BOUNDARY_GHOSTED
instead and somehow<br class="">
arrange for values that I specify to be placed in
the ghost locations?<br class="">
</blockquote>
<div class=""><br class="">
</div>
<div class="">Yes, that is the intent.</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:1px solid
rgb(204,204,204);padding-left:1ex">
Thanks,<br class="">
<br class="">
David<br class="">
<br class="">
The University of Edinburgh is a charitable body,
registered in Scotland, with registration number
SC005336.<br class="">
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="">
<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" moz-do-not-send="true" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br class="">
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <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" moz-do-not-send="true" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br class="">
</div>
</div></blockquote></div><br class=""></div></body></html>