Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Flow Model

Status
Not open for further replies.

jaytelle

Civil/Environmental
Dec 15, 2021
23
0
0
US
Does anyone know of a method for estimating a polynomial function with a combination of sin/cos? Taylor/Maclaurin estimations work the opposite way unless there is a way to go backwards with those.

Background: I programmed a dynamic simulator in vba for wastewater treatment using the activated sludge model 3 and bioP kinetics. Basically this program is solving a system of 60 coupled non-linear differential equations using eulers method. 15 constituents tracked per CSTR and 4 series CSTRs with a couple recycle streams. In this program I can either model constant or diurnal influent flow. The issue is modeling diurnal flow. Most of the time this is given as a high degree polynomial, normally degree = 6. But to run eulers method, vba loop with 20,000 steps, I need the diurnal model to be a wave function of period 1 day or else the loop will get overly complex. The simulation occurs over 40 days with 20,000 steps. Since the polynomial model is only accurate for the first day I would have to reset the flow values somehow in the loop. I'm currently modeling using a sin/cos function but it is not accurate to the polynomial/true diurnal flow model.

Any help would be greatly appreciated - I'm new to this and not sure this is the best forum to post this question.

JL
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top