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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Programming with an iterative formula - Area Spill Function Example

CD_9999850
6-Contributor

Programming with an iterative formula - Area Spill Function Example

Mathcad Prime 9

 

Hello Mathcad experts,

 

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.

 

CD_9999850_1-1692025446160.png

 

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. 

 

CD_9999850_2-1692025467981.png

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

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

Werner_E_0-1692115772915.png

 

There is no need for a rational fitting function!

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

Werner_E_1-1692115810717.png

 

View solution in original post

6 REPLIES 6

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

CD_9999850
6-Contributor
(To:Werner_E)

Thanks for the reply.  

 

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.

CD_9999850_0-1692112352779.png

 

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.

 

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

Werner_E_0-1692115772915.png

 

There is no need for a rational fitting function!

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

Werner_E_1-1692115810717.png

 

CD_9999850
6-Contributor
(To:Werner_E)

I completely missed the fact that you posted a modified Mathcad File in your reply!  Let me study your solution.

ttokoro
20-Turquoise
(To:CD_9999850)

image.pngimage.pngimage.png

CD_9999850
6-Contributor
(To:Werner_E)

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

 

Colin

Top Tags