Discussion Forum

Defining a parameter in 2 intervals

Topics: no topics

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   1 Reply   Last post: March 19, 2010 9:26pm UTC
Vishal Rajpurohit

Vishal Rajpurohit

March 19, 2010 7:30pm UTC

Defining a parameter in 2 intervals

I have the equations of input pressure as following

Pin = a*t^3+ b*t^2 + c*t + d for t<900 s and
Pin = e*t +f for 900<=t<12000

how and where do i define Pin in Comsol?

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

March 19, 2010 9:26pm UTC in response to Vishal Rajpurohit

Re: Defining a parameter in 2 intervals

Hi

Well you do not tell us much of what you are modelling, but I will assume it's a fluid flow case, with probably an input pressure that you call Pin, applied to one boundary, then some walls along the tube (with normally I assume noslip boundary conditions), and an outlet with perhaps no pressure (free flow out)

In which case, if you do a transient analysis (time domain) and you define a time variable from 0 to say 12000 [s] in steps perhaps by 50 [s] that you define in the solver pane, it should be solvable.

Now to get your input pressure to change with time you must define on the "input" boundary the presure Pin.

You can either define
a) a "function" depending on the time, with your constants defined in the "constant " section and then you use this function name as input; or
b) you define directly your time dependent equation in the boundary condition field for input pressure.

as you have written:
Pin = (a*t^3+ b*t^2 + c*t + d)*(t<900)+ (e*t +f)*(t>=900)*(t<12000)

The last *(t<12000) is not required if you stop anyhow at 1200[s]

For the units you chould use:
0) none, COMSOL will say inconsitent units in red, but assume they are anyhow OK and ignore the warning
1) correct units in the definition of your constants a,b,... (I assume t is by default defined as [s]) and add something as *(t[1/s]<900) which makes "t[1/s]" dimensionless and would give correct results even if t is defined in minutes, or *(t<900[s]) (that should be equzivalent (pls correct COMSOL might not appreciate units in Bolean expressions and still say "warning")

finally if the two functions are not really adjacent, with a steep step at the transition time, your could get into solver stability problems, you might need to make small steps at the border around 900[s], of you change slightly the function to make it "smooth" with a heaviside function (search for heavisie in th guide.pdf and command.pdf

Hope this helps on the way
Have fun
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines