Hi guys,

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.

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:

\partial( \phi( p ) \rho_o( p ) S_o )/ \partial t = F_o(p,S)
\partial( \phi( p ) \rho_w( p ) S_w )/ \partial t = F_w(p,S)
S_o + S_w = 1,

where p is the pressure,
\phi( p ) is a porosity function depending on pressure,
\rho_x( p ) is a density function depending on pressure,
S_o is the saturation of oil,
S_g is the saturation of gas,
t is time,
F_x(p,S) is a function containing fluxes and source terms. The primary 
variables are p, S_o and S_w.

We are using a lowest order Finite Volume discretisation.

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).

Any advice you could provide will be highly appreciated.

Many thanks,
Max la Cour Christensen
PhD student, Technical University of Denmark

Reply via email to