cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

6-Contributor

## Programming with an iterative formula - Area Spill Function Example

I want to create a spill area as a function of time for transient evaporation calculations.  I currently use a formula developed by Dow Chemicals from the late 70's to calculate in the radius of a spill for a given time with an assumed rate and volume.  This formula is iterative.  See Yellow highlighted for manual manipulation.

I am currently manually changing the time intervals and entering the resulting radius and time into a matrix and then curve fitting to make an area function.

Once the volume has been spilled, I assume the area no longer grows.  This seems possible to automate with programming.  I'm a novice programmer and have been working diligently without much success.  I mostly am having trouble with the iterative formula.

See attached Prime 9 excerpt of my calculations.

Help would be greatly appreciated.

Regards,

Colin

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:CD_9999850)

So the last function r2 in the sheet I posted is doing what you demand. We just have to slightly change it to

There is no need for a rational fitting function!

You may evaluate it at any time positions and create a table

6 REPLIES 6
24-Ruby V
(To:CD_9999850)

I am not sure if I understand the "iteration" to find the radius r based on the time t.s.

As I see it this "iteration" calculates the value for r at max two times (not an interation IMHO).

First you use C=2 and calculate r. Then you use this value of r to determine, if C should be 2 or 5. In the latter case r is recalculated with C=5 and thats it?

But I don't get the (constant) values in your manually entered data table for t>=8s that way.

So how do you calculate the radius 40.179 in  for all t.s>=8s?

See if the attached file can be of any help

6-Contributor
(To:Werner_E)

To solve for the "Wu and Schroy" equation you must first start with a guess of "r".  The radius is in fact within the equation, it's in there twice to the power of 4.  The solve block works well for this.

Here is how I see the program running in plain English:  Start with time = 1 s (at 0 s the r = 0) assume C=2, guess a radius of say 1 in and loop until the guess value is equal to the result value of r (or reasonably equal), calculate C and check to make sure the initial C = 2 is correct, if not, re-run with C = 5.  Record the time and the radius values into a matrix (first row of matrix is always t = 0, r = 0).  Loop to start this process again incrementing t by 1 s until t = Vs/Qs.  After this time is met, record the last value of r repeatedly for say out to 100 s (adjustable) or so.

24-Ruby V
(To:CD_9999850)

So the last function r2 in the sheet I posted is doing what you demand. We just have to slightly change it to

There is no need for a rational fitting function!

You may evaluate it at any time positions and create a table

6-Contributor
(To:Werner_E)

20-Turquoise
(To:CD_9999850)

6-Contributor
(To:Werner_E)

You presented a very elegant solution.  Thank you for saving me a lot of effort.

Colin

Announcements
Top Tags