TS

Hong Zhang hzhang at mcs.anl.gov
Wed Feb 21 14:13:42 CST 2007


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

The current code should be able to handle
[C(t_n,{T_n})] {T_(n+1) - T_n}/dt = {F(t,{T})},
i.e., the LHS matrix uses explicit scheme.
As I mentioned, the codes for cn and LHS matrix
are buggy and not sufficiently tested.
Additional coding is likely needed.

How about start from the formulation
>
> >> d{T}/dt = [C(t,{T})]^(-1) ({F(t,{T})} - [K(t,{T})] {T})

and get a working code. Then pass it to me.
I'll use it to test the above LHS matrix formulation
and improve petsc cn method.

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

Fine with us. We can help to optimize it.

Hong
>
>
> 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