<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Mar 12, 2016 at 5:41 AM, Max la Cour Christensen <span dir="ltr"><<a href="mailto:mlcch@dtu.dk" target="_blank">mlcch@dtu.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi guys,<br>
<br>
We are making preparations to implement adjoint based optimisation in our in-house oil and gas reservoir simulator. Currently our code uses PETSc's DMPlex, Vec, Mat, KSP and PC. We are still not using SNES and TS, but instead we have our own backward Euler and Newton-Raphson implementation. Due to the upcoming implementation of adjoints, we are considering changing the code and begin using TS and SNES.<br>
<br>
After examining the PETSc manual and examples, we are still not completely clear on how to apply TS to our system of PDEs. In a simplified formulation, it can be written as:<br>
<br>
\partial( \phi( p ) \rho_o( p ) S_o )/ \partial t = F_o(p,S)<br>
\partial( \phi( p ) \rho_w( p ) S_w )/ \partial t = F_w(p,S)<br>
S_o + S_w = 1,<br>
<br>
where p is the pressure,<br>
\phi( p ) is a porosity function depending on pressure,<br>
\rho_x( p ) is a density function depending on pressure,<br>
S_o is the saturation of oil,<br>
S_g is the saturation of gas,<br>
t is time,<br>
F_x(p,S) is a function containing fluxes and source terms. The primary variables are p, S_o and S_w.<br>
<br>
We are using a lowest order Finite Volume discretisation.<br>
<br>
Now for implementing this in TS (with the prospect of later using TSAdjoint), we are not sure if we need all of the functions: TSSetIFunction, TSSetRHSFunction, TSSetIJacobian and TSSetRHSJacobian and what parts of the equations go where. Especially we are unsure of how to use the concept of a shifted jacobian (TSSetIJacobian).<br>
<br>
Any advice you could provide will be highly appreciated.<br></blockquote><div><br></div><div>Barry and Emil,</div><div><br></div><div>I am also interested in this, since I don't know how to do it.</div><div><br></div><div>  Thanks,</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">
Many thanks,<br>
Max la Cour Christensen<br>
PhD student, Technical University of Denmark<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>