Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Defining a parameter in 2 intervals

Please login with a confirmed email address before reporting spam

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?

1 Reply Last Post Mar 19, 2010, 5:26 p.m. EDT
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 19, 2010, 5:26 p.m. EDT
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
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)*(t

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.