<html><head><base href="x-msg://121/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 5, 2010, at 8:46 PM, Li, Zhisong (lizs) wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div ocsi="0" fpstyle="1"><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 13px; "><div>Hello, PETSc Team,<br><br>&gt;From previous discussion with you on DAE solver, for some 2D/3D PDE equations (such as N-S equation), we can first discretized them before computing the Jacobian, if my understanding is correct.<span class="Apple-converted-space">&nbsp;</span><br><br>Suppose we can derive the 3x3 Jacobian matrix elements: ddF1/ddU, ddF2/ddV, ...... as<br><br>J[0][0] = 0.5*(x[j][i+1].u-x[j][i-1].u)+...;...&nbsp; J[0][1] = 0.5*(x[j+1][i].v-x[j-1][i].v)+..., J[0][2]=..., ..., J[2][2] = .....<br><br>The resulting Jacobian matrix A depends on the discretized variables x[][].u, x[][].v, ...or say, the location index [j][i]. That's A=A[j][i]. In the function of TSSetIJacobian(), the FormJacobian routine can only return one matrix, rather than an array of matrices (one for each grid point) as we need. My question is that how to construct the correct Jacobian in this case?<span class="Apple-converted-space">&nbsp;</span><br></div></div></div></span></blockquote><div><br></div>&nbsp;&nbsp;You need to assemble the Jacobian in the usual finite element way. That assembled Jacobian is what is passed to the set Jacobian routines. (see any finite element book on assembling the global stiffness matrix from element stiffness matrices).</div><div><br></div><div><br></div><div>&nbsp;&nbsp; Barry</div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div ocsi="0" fpstyle="1"><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 13px; "><div><br>Thank you very much.<br><br><br>Regards,<br><br><br>Zhisong Li<br><br><br></div></div></div></span></blockquote></div><br></body></html>