Re: oscillations when solving nonlinear system
- From: Torsten Hennig <Torsten.Hennig@xxxxxxxxxxxxxx>
- Date: Thu, 06 Oct 2005 03:11:14 EDT
>Well, cradau doesn´t work on my machine. Something goes >wrong when I build
>the library. I try the sundials package. I think I have >to use the ida
>package (which is made for DAE). I have to provide the >functional vector
>F. I have a 40 point grid in z-space and 8 Species. So >the vector is
>39x8x2 elemtents long. Is it better to solve the system >for all points
>together or only point by point in z-direction, which >would last into a
>8x2 system for every point.
>
>Andreas
Hi Andreas,
the solution vector in your case should have dimension
8*2 = 16. If you discretize in z-direction in
advance, all the advantages of an adaptive integrator
are lost.
So your system of equation looks like
dphi/dz = b*(psi-phi) , phi(z=0) = phi_0
0 = c*(phi-psi) + omega(psi) , psi(z=0) = psi_0
where psi_0 is such that it (at least approximately)
satisfies the algebraic equation.
Another possibility is to differentiate the algebraic
equation with respect to z.
You get ( if my algebra is correct )
dphi/dz = b*(psi-phi) , phi(z=0) = phi_0
dpsi/dz = b*c*(psi-phi)/(c-domega/dpsi) , psi(z=0) = psi_0
The advantage of this formulation is that you do not
need a DAE solver, but only an ODE solver, and ODE solvers
written in C are not so rare (e.g. RK45).
The disadvantage is that you need
domega/dpsi which can be difficult to obtain if you
do not have an analytic expression for the function
omega.
Best wishes
Torsten.
.
- References:
- Re: oscillations when solving nonlinear system
- From: Andreas Schulze
- Re: oscillations when solving nonlinear system
- Prev by Date: Re: oscillations when solving nonlinear system
- Next by Date: Re: Huge speed difference between sparse A*x and A'*b
- Previous by thread: Re: oscillations when solving nonlinear system
- Next by thread: linear equation problems
- Index(es):