Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Step Function as BC

Please login with a confirmed email address before reporting spam

I want to implement a change in the velocity/flow in a laminar flow problem. I added the step function (tag: step1) but I am wondering what the correct syntax is when adding this in the velocity boundary condition for the inlet condition to the laminar flow problem...ie: under Uo what exactly do I need to enter?

The step function parameters are: Location: 0.5, From: 0, To: 1
Goal: flow of 0.1m/s for the first 5 seconds then add 0.1m/s of flow from 5--> 10 seconds.

9 Replies Last Post Dec 4, 2013, 12:04 p.m. EST
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 Aug 15, 2011, 1:26 a.m. EDT
Hi Mélanie

Well again, either you need to observe something changing during the first 5 seconds and you need a full transient analysis for the full time interval, or you can call it a steady state case and you just calculate the steady state flow at t=5[s], as a stationary case and then use it as the initial conditions for the transient flow t=5 to 10 sec. There you need to use the step function and adapt the slope and transition time for this built-in function

--
Good luck
Ivar
Hi Mélanie Well again, either you need to observe something changing during the first 5 seconds and you need a full transient analysis for the full time interval, or you can call it a steady state case and you just calculate the steady state flow at t=5[s], as a stationary case and then use it as the initial conditions for the transient flow t=5 to 10 sec. There you need to use the step function and adapt the slope and transition time for this built-in function -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 15, 2011, 9:26 a.m. EDT
Hi Ivar,

So if I understand this correctly,
Step 1: Stationary Solver for the initial steady state conditions
Step 2: Transient Solver from steady state to end of injection

How do I make the Step 2 use the values from Step 1 as initial conditions?

Also, I will ask once again, what exactly is the command I need to enter in the BC slot to refer to the step function. I tried using 0.1+0.1*step1(t) but I get an error saying that it cannot evaluate t. What am I doing wrong?
Hi Ivar, So if I understand this correctly, Step 1: Stationary Solver for the initial steady state conditions Step 2: Transient Solver from steady state to end of injection How do I make the Step 2 use the values from Step 1 as initial conditions? Also, I will ask once again, what exactly is the command I need to enter in the BC slot to refer to the step function. I tried using 0.1+0.1*step1(t) but I get an error saying that it cannot evaluate t. What am I doing wrong?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 16, 2011, 12:52 p.m. EDT

I want to implement a change in the velocity/flow in a laminar flow problem. I added the step function (tag: step1) but I am wondering what the correct syntax is when adding this in the velocity boundary condition for the inlet condition to the laminar flow problem...ie: under Uo what exactly do I need to enter?

The step function parameters are: Location: 0.5, From: 0, To: 1
Goal: flow of 0.1m/s for the first 5 seconds then add 0.1m/s of flow from 5--> 10 seconds.


Hi,

With your problem, I have a solution to do like this:
You choose Global Definitions/ Interpolation --> a window appear with a function name: INT1.
With "t" column you type 0 to 5 and in the next column you type 0.1.
and more, with "t" column you type 6 to 10 and in the next column you type 0.2.

And, in the velocity boundary condition for the inlet condition, you type: "int1(t[1/s])" in the field what you want to implement a change in the velocity/flow in a laminar flow problem.

It seems as a simpleton way but I did like that with my model.

Hope you can improve your ideas.
[QUOTE] I want to implement a change in the velocity/flow in a laminar flow problem. I added the step function (tag: step1) but I am wondering what the correct syntax is when adding this in the velocity boundary condition for the inlet condition to the laminar flow problem...ie: under Uo what exactly do I need to enter? The step function parameters are: Location: 0.5, From: 0, To: 1 Goal: flow of 0.1m/s for the first 5 seconds then add 0.1m/s of flow from 5--> 10 seconds. [/QUOTE] Hi, With your problem, I have a solution to do like this: You choose Global Definitions/ Interpolation --> a window appear with a function name: INT1. With "t" column you type 0 to 5 and in the next column you type 0.1. and more, with "t" column you type 6 to 10 and in the next column you type 0.2. And, in the velocity boundary condition for the inlet condition, you type: "int1(t[1/s])" in the field what you want to implement a change in the velocity/flow in a laminar flow problem. It seems as a simpleton way but I did like that with my model. Hope you can improve your ideas.

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 Aug 17, 2011, 2:34 a.m. EDT
Hi

I forgot that one if you have a "t" referring to the default time and you run a stationary solver, COMSOL flgs an error (it was so in 3.5, and in 4.2 just checked it ;) because by default "t" is only defined for transient solvers. In that case you define a Definition Parameter t = 0[s] to define your value "t" as for the default. COMSOL will redefine t when the transient solver starts and as you and COMSOL have defined t in seconds it should work OK.

then a second thing, a call to step(t) gives a unit error as COMSOL expects unit less values try "step(t[1/s])"

--
Good luck
Ivar
Hi I forgot that one if you have a "t" referring to the default time and you run a stationary solver, COMSOL flgs an error (it was so in 3.5, and in 4.2 just checked it ;) because by default "t" is only defined for transient solvers. In that case you define a Definition Parameter t = 0[s] to define your value "t" as for the default. COMSOL will redefine t when the transient solver starts and as you and COMSOL have defined t in seconds it should work OK. then a second thing, a call to step(t) gives a unit error as COMSOL expects unit less values try "step(t[1/s])" -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 28, 2011, 7:22 p.m. EDT
I have a question about Step function with a "condition" of another parameter (not time):

joule heating equation with 2 independent variables: T & V.
I want to make a rule for the electrical conductivity sigma:
if T<135 then sigma=2000
else sigma = 100

How can i explain this rule in comsol 4.2 ? Because if i use: sigma=if (T<135,2000,100) it doesn't work

Do you think we can realize this by using "step" function in COMSOL 4.2

Many thanks in advance

Dinh An
I have a question about Step function with a "condition" of another parameter (not time): joule heating equation with 2 independent variables: T & V. I want to make a rule for the electrical conductivity sigma: if T

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 28, 2011, 9:45 p.m. EDT
Hi Dinh:

I think you should use step function with smooth to represent conductivity change with temperature. As said in the user's guide :"Use smoothing to improve the behavior of the model by avoiding
discontinuities that are difficult to handle numerically. "
Hi Dinh: I think you should use step function with smooth to represent conductivity change with temperature. As said in the user's guide :"Use smoothing to improve the behavior of the model by avoiding discontinuities that are difficult to handle numerically. "

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 4, 2011, 8:57 a.m. EDT

Hi Dinh:

I think you should use step function with smooth to represent conductivity change with temperature. As said in the user's guide :"Use smoothing to improve the behavior of the model by avoiding
discontinuities that are difficult to handle numerically. "


Many thanks, it works well
[QUOTE] Hi Dinh: I think you should use step function with smooth to represent conductivity change with temperature. As said in the user's guide :"Use smoothing to improve the behavior of the model by avoiding discontinuities that are difficult to handle numerically. " [/QUOTE] Many thanks, it works well

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 15, 2013, 7:20 p.m. EDT
Hi Dinh,
I have a problem like yours, Would you please explain how you have used step function?
Thank you,
Giti
Hi Dinh, I have a problem like yours, Would you please explain how you have used step function? Thank you, Giti

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 4, 2013, 12:04 p.m. EST
Hi Dinh,

I also would like to know how did you implement your step function!
Thanks a lot for the help...
Hi Dinh, I also would like to know how did you implement your step function! Thanks a lot for the help...

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.