<div dir="ltr">On Wed, Sep 25, 2013 at 4:40 AM, Christophe Ortiz <span dir="ltr"><<a href="mailto:christophe.ortiz@ciemat.es" target="_blank">christophe.ortiz@ciemat.es</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Matt,<div>Thanks for your prompt reply.<br><div class="gmail_extra"><br><div class="gmail_quote">
On Wed, Sep 25, 2013 at 1:34 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>On Wed, Sep 25, 2013 at 4:31 AM, Christophe Ortiz <span dir="ltr"><<a href="mailto:christophe.ortiz@ciemat.es" target="_blank">christophe.ortiz@ciemat.es</a>></span> wrote:<br>
</div><div class="gmail_extra">
<div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
Hi guys,</div>
<div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
Please apologize if this question has already been raised in previous posts.</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
I am developing a code in fortran 90 to solve a 1D multicomponent problem.</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><div class="gmail_extra">For instance, something like</div><div class="gmail_extra">
<br></div><div class="gmail_extra">u_t = u_xx + R(u,v)</div><div class="gmail_extra">v_t = v_xx + R(u,v)</div></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
I have already implemented this for one component (u) and using DMDA. So far no problem. It works fine.<br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><div class="gmail_extra"><br></div>
<div class="gmail_extra">Now I am trying to implement several components per node. Following example ex22f.F, for the residual function I would have for node i (1D)</div><div class="gmail_extra"><br></div><div class="gmail_extra">
F(1,i) = ....</div><div class="gmail_extra">F(2,i) = ....</div><div class="gmail_extra"><br></div><div class="gmail_extra">Now, I am not quite sure to understand how to construct the Jacobian when there are various components. In this case, how is the vector in PETSc ?</div>
</div></div></blockquote><div><br></div></div><div>The Jacobian is a matrix, and the rows are ordered in the same way as in the residual function. The columns are the same as the rows.</div></div></div></div></blockquote>
<div><br></div><div>Yes, I understand this for one component. My question is when you have dof > 1. For a multicomponent problem you can write the residual function as an array:</div><div><br></div><div>F(1,i) =... (component 1)</div>
<div>F(2,i) = ... (component 2)</div><div><br></div><div>Since there is only one Jacobian for the whole system, how are the components of the Jacobian ordered in that case ? Is it first the components of u, then the components of v ?</div>
</div></div></div></div></blockquote><div><br></div><div>The ordering of the rows (and columns) of the Jacobian match the rows of the residual EVEN in the multicomponent case.</div><div><br></div><div> Matt</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="gmail_extra"><div class="gmail_quote"><div>Christophe</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br>
</div><div> Thanks,</div><div>
<br></div><div> Matt</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
<div class="gmail_extra">Is it a long vector like (u0, u1, ..., umx-1 , v0, v1, ..., vmx-1) ?</div><div class="gmail_extra">Or is it (u0, v0, u1, v1, u2, v2, ....., umx-1, vmx-1) ?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I don't understand the order of the components of the Jacobian and how to fill the matrix in that case.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
For instance, for the first row of the Jacobian, should I calculate</div><div class="gmail_extra">dFu0/du0, dFu0/dFu1, ...., dFu0/dumx-1, dFu0/dv0, dFu0/dv1.....</div><div class="gmail_extra"><br></div><div class="gmail_extra">
or</div><div class="gmail_extra"><br></div><div class="gmail_extra">dFu0/du0, dFu0/dv0, dFu0/du1, dFu0/dv1, ....</div><div class="gmail_extra"><br></div><div class="gmail_extra">And then, which subroutine should I use to fill in the Matrix ? Simply MatSetValues ?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Many thanks in advance for your help.</div><span><font color="#888888"><div class="gmail_extra"><br></div><div class="gmail_extra">Christophe</div>
</font></span></div>
</div>
</blockquote></div></div><span><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</font></span></font></span></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>