Jonathan,
You need to switch to PETSc-dev
http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html to access the DAE
solvers that Jed Brown has developed.
For that you use TSSetIFunction() and TSSetIJacobian() .
Examples in src/ts/examples/tutorials
ex14.c: ierr = TSSetIFunction(ts,THIFunction,thi);CHKERRQ(ierr);
ex15.c: ierr = TSSetIFunction(ts,FormIFunction,&user);CHKERRQ(ierr);
ex17.c: ierr = TSSetIFunction(ts,FormIFunction,&user);CHKERRQ(ierr);
ex18.c: ierr = TSSetIFunction(ts,FormResidual,&user);CHKERRQ(ierr);
ex8.c: ierr = TSSetIFunction(ts,problem->function,problem->data);CHKERRQ(ierr);
all use this functionality.
Good luck and feel free to send more questions once you are going, but I
suspect it will be easy for you with this hint.
Barry
On Jun 29, 2011, at 6:23 PM, Jonathan Backs wrote:
> Hi,
>
> I am developing my first application with PETSc in an attempt to solve two
> coupled non-linear PDEs: (1) Poisson's equation for electric potential with a
> temperature-dependent electrical conductivity, and (2) the heat diffusion
> equation with a voltage-dependent thermal conductivity and a
> voltage-and-temperature-dependent source term (ohmic heating from the
> electric potential and the temperature-dependent electrical conductivity).
>
> So far I have solved the two problems separately without problems: Poisson's
> equation with a voltage-dependent electric conductivity (no timestepping),
> and the heat equation with a temperature-dependent thermal conductivity
> (timestepping, but no source term; the heat came from the boundary conditions
> in this case). However, I am not sure how to set up PETSc for solving these
> non-linear equations simultaneously. For example, when setting up a
> non-linear problem with time stepping, I understand I have to set the
> RHSFunction and RHSJacobian, assuming the left hand side provided by PETSc is
> the time-derivative of the independent variable; When setting up a non-linear
> problem without time stepping, I understand I have to set the Function
> assuming a zero left hand side (and then set the Jacobian according to the
> Function).
>
> I have tried to implement the coupled problem using a three-dimensional DA
> with two degrees of freedom (V and T). While PETSc seems to facilitate the
> use of multiple degrees of freedom in the same RHSFunction (and RHSJacobian),
> I cannot assign an RHSFunction for the Poisson's equation since the Poisson's
> equation does not include a time derivative. I have not been able to find any
> examples in the documentation or on this mailing list that illustrated this
> particular type of problem.
>
> Could anyone offer a hint as to the proper strategy for implementing this
> coupled system of PDEs?
>
> Thank you for your time,
>
> Jon