ODE wrong? Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » ODE wrong? « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

quantum (noorbit)
New member
Username: noorbit

Post Number: 1
Registered: 05-2007
Posted on Monday, May 07, 2007 - 02:23 am:   

I want to solve lorenz system,but the following code works correctly only t<40,when>40 the solution is wrong,why? ==================================
select
ngrid=1 { Since no spatial information is required, use the minimum grid }
errlim = 1e-3

variables
A
V
Z

initial values
A = 1.0
V = 2.0
Z = 3.0

equations
A: dt(A)=-10.0*(A-V)
V: dt(V) = 28.0*A-V-A*Z
Z: dt(Z)=-2.8*Z+A*V

boundaries
region 1
start (0,0)line to (1,0) to (1,1) to (0,1) to close
time 0 to 50

plots
for t = 0 by 1 to 50
history(A) versus Z

end
====================================
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 842
Registered: 06-2003
Posted on Monday, May 07, 2007 - 02:34 pm:   

It is unusual for FlexPDE ptoblems to run 40,000 timesteps, and we try to compress the history data list when the number of stored points exceeds 16000 (Based on the assumption that it is a history list, not a circulating path, and that a display can resolve at best a few thousand points). In your case, this destroys the A,Z relationship and garbles the plot.

SELECT HISTORY_LIMIT=100000
will expand the size of the stored history list and preserve all your data.

You should also include a diffusion term in each equation, to lock the nodal values together and prevent oscillations (since FlexPDE always thinks that a problem has a spatial component.)

Turning off the regrid is a good idea, too.

The resulting script is:
-----------------------------------------
select
ngrid=1 { Since no spatial information is required, use the minimum grid }
REGRID=OFF
errlim = 1e-3
history_limit=100000

variables
A
V
Z

initial values
A = 1.0
V = 2.0
Z = 3.0

equations
A: dt(A)=-10.0*(A-V) + del2(A)
V: dt(V) = 28.0*A-V-A*Z + del2(V)
Z: dt(Z)=-2.8*Z+A*V + del2(Z)

boundaries
region 1
start (0,0)line to (1,0) to (1,1) to (0,1) to close
time 0 to 50

plots
for t = 0 by 1 to 50
contour(a)
contour(v)
contour(z)
history(A) versus Z

end

Top of pagePrevious messageNext messageBottom of page Link to this message

quantum (noorbit)
New member
Username: noorbit

Post Number: 2
Registered: 05-2007
Posted on Monday, May 07, 2007 - 06:49 pm:   

thank you very much
flexpde is indeed a wonderful work

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration