Manav Bhatia manav at u.washington.edu
Wed Feb 21 13:04:50 CST 2007


	In my case, my LHS matrix is also dependent on the primary variable

>> [C(t,{T})] d{T}/dt = {F(t,{T})}

Would this case be handled by CN? or does it handle only a constant  
or time dependent LHS matrix?
For a constant/time-dependent LHS matrix, the jacobian of the RHS is  
same as the steady-state nonlinear analysis. Otherwise, I need to  
change the jacobian definition too, I think.

My main concern is:
If I use the restated problem (from my previous mail)
>> d{T}/dt = [C(t,{T})]^(-1) ({F(t,{T})} - [K(t,{T})] {T})

I know how to calculate the jacobian of the RHS, even though it  
requires inversion. With this, I can use any of the explicit/implicit  
But if I do not state the problem like this, what do I do about the  
LHS matrix that is dependent on the primary variable?

I would be happy to contribute an example. But it will have to wait a  
about 2 weeks till I can start working on it.


On Feb 21, 2007, at 7:24 AM, Hong Zhang wrote:

> Manav,
> Since you have to solve equation at each time-step,
> I would suggest using Crank-Nicholson method, which combines
> implicit and explicit methods and gives
> higher order of approximation than Euler and Backward Euler
> methods that petsc supports.
> However, Crank-Nicholson method is not supported by the
> petsc release. You must use petsc-dev
> (see
> http://www-unix.mcs.anl.gov/petsc/petsc-as/developers/ 
> index.html#Obtaining
> on how to get it).
> Additional note: in petsc-dev, the interface functions
> TSSetRHSMatrix() and TSSetLHSMatrix() are replaced by TSSetMatrices().
> An example of using cn method is petsc-dev/src/ts/examples/tests/ex1.c
> See the targets of
> "runex1_cn_*" in petsc-dev/src/ts/examples/tests/makefile
> on how to run this example.
> Use of LHS matrices in petsc is not well tested yet.
> I've been looking for examples that involve LHS matrix.
> Would you like contribute your application, or a simplified version
> of it to us as a test example? We'll put your name
> in the contributed example.
> Thanks,
> Hong
>> [C(t,{T})] d{T}/dt = {F(t,{T})} - [K(t,{T})] {T}
>> with initial conditions
>> {T(0)} = {T0}
>> So, I have a problem which has a LHS matrix, which is also dependent
>> on the primary variable (which is temperature {T}).
>> In the simple case, ofcourse, we can neglect this dependence on
>> temperature (for [C]), but that has limited applicability for my
>> problem, since the [C] matrix has non-negligible nonlinearities.
>> So, I am looking for ways to formulate my problem to use the Petsc
>> solvers. The best option that I can think  of is to restate the
>> problem as:
>> d{T}/dt = [C(t,{T})]^(-1) ({F(t,{T})} - [K(t,{T})] {T})
>> where I can now specify the RHS function and its jacobian (I will
>> provide the jacobian, so no need to use finite differencing), and use
>> an explicit / implicit solver.
>> However, if I assume a linear problem, then I am left with a case of
>> [C] d{T}/dt = {F(t)} - [K]{T}
>> Here, I could either restate the problem in the same way as I did
>> above, or I could specify a LHS matrix (in this case [C]), and ask
>> the solver to handle it. But, from our previous email exchanges, it
>> seems like I will have to use an implicit solver for the same, since
>> an explicit solver will not handle a LHS matrix.
>> Kindly correct me if I am wrong.
>> Thanks,
>> Manav

More information about the petsc-users mailing list