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
Posted Dec 13, 2011, 5:08 a.m. EST Heat Transfer & Phase Change Version 4.3 18 Replies
Please login with a confirmed email address before reporting spam
I have a external temperature, "Temperature 1", which is 100 C. After 330 seconds I would like it to drop 80 degrees to 20 degrees. I should be able to use a step funtion, but can't figure out how to. An easier approach is also very welcome. Thanks in advance!
Please login with a confirmed email address before reporting spam
I would try to define a function
an1(x) as 100-(100-20)*step1(x)
with step1() defined as: location: 330, from: 0 to: 1
then plot an1() from 0-400 to check
calling with
an1(t[1/s])
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
just in resonse to this link. I have a similar problem. I have two magnets, one which i want to start at a certain magnetization M and the other to start at 0. I want to then decrease the first magnet from M to 0 over time and increase the magnetization of the other magnet from 0 to M at the same time. Would you suggest using a step function or a ramp function? And should i have one for each? Thanks for you help.
Phil
Please login with a confirmed email address before reporting spam
That sounds like a ramp function, no ?
from 0-1 and then 1-ramp(t[1/s]) from 1 to 0
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Thanks for your quick response. Do you have to specify a time range to evaluate that over or use a parametric sweep? Or does that automatically link in with the time you run the model for? Apologies for the inconvenience.
Cheers,
Phil
Please login with a confirmed email address before reporting spam
you need to be "slow" to be in the ACDC regime but then the solver will adapt the time steps to the slope (if it will not ignore them by skipping over them), some time stepping values to give a good sampling of the slopes would be required, and a strict or intermediate (and not free-automatic) time stepping
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
See the COMSOL Multiphysics User's Guide and Reference Guide, or search the COMSOL Documentation to also find model examples where step functions and ramp functions are used.
In this particular model's documentation, an explanation of the expression "U_mean*6*s*(s-1)*step1(t[1/s])" is missing. The expression defines a parabolic velocity profile at the inlet boundary using the curve parameter "s", which is a predefined curve parameter on boundaries in 2D models and runs from 0 to 1 along the direction of the boundary. The smoothed step function ramps up the velocity at the start of the simulation. The step function's input "t[1/s]" is the predefined variable "t" for the time (unit: s) and the "unit multiplication" using "[1/s]" is done to make the step function's input dimensionless.
Best regards,
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
I am trying to specify the material property as a function of y. My geometry is a rectangle divided in the middle into two domains. I would like to define the young's modulus as a single variable that changes from E1 in domain 1 to E2 in domain 2 smoothly. Is that possible with step function?
Thanks.
Lakshmi.
Please login with a confirmed email address before reporting spam
you can define your material properties with the user defined option to any function related to x,y,z ... at will, it must "just" be more or less derivable (smooth) to allow COMSOL to extract the Jacobian for the solving process
You can define your Young modulus for both domain as the same function E0+E1*step1(y-Y0) at will ;)
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Best regards
Lakshmi
Please login with a confirmed email address before reporting spam
I am working on a thermomagnetic convection problem using AC-DC and non-isothermal flow modules. I have a heat source in the magnetic fluid field. I want to use a function for magnetization of my magnetic fluid up to the temperature of fluid is less than a defined quantity as Tc, and after this temperature I want to use zero for the magnetization function, I was wondering if you could let me know how I can use step function here?
Thank you so much in advance,
Giti
Please login with a confirmed email address before reporting spam
there are probably several ways, but I would suggest to change your material data accordingly so that it is sensitive to B below Tc and not above, that is make some analyitical or interpolation function of what ever magnetic property of the material that in giving a heat source.
You could take a look at the examples of the BH curve for soft iron with saturation, that is B dependent, you do something similat for T dependence.
Then whe you solve, think about the order of the segregated steps if you cannot use a direct solver
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
I was hoping somebody here could help me with my problem related to the step function as well.
In my model I have as a boundary condition a partial pressure dependent current function such as j = pH2O^0.5*exp(...) for example. When I vary the current to higher values (stationary simulation), more of the gas spezies is consument at the boundary by a current dependent reactions term and will eventually reach zero at the boundary due to diffusion limitations.
At that point, the simulation stopps because of non converging solution, which should be related to numerical problems with the low partial pressure, right? I found in the COMSOL user guide the step function as a possible aid for converging problems due to over or undershots of the solution...
However, I have no idea how to make use of the smoothing capabilities since I don't know in what way to apply the step function to my model equations. I tried a boolian expression like pH2O=if(chcs.x_wH2O>0.001, chcs.x_wH2O,0.001), but wihout any success. Should I declare a variable with relation to the partial pressure where the step function is involved somehow? How do I make use of the step function since I have a stationary simulation, where the last solution is the intial value for the next stationary simulation?
I would really appriciate any help related to this problem, I been stuck now for some time!!!
Thanks a lot in advance!
Cheers Helge
Please login with a confirmed email address before reporting spam
if its an issue with the pH2O = "0" or getting into negastive values, sometimes it can be solve by adding a small value, such as "eps" sqrt(eps) or a multiple thereof to your equation.
The boolean equations adds discontinuitites that often make the solver fail
I have noticved one are often having trouble with negative values in electrochemistry, but there must be other with greater experience than me that have some tricks to propose
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
I am trying to model laser photothermal therapy on cancer tumors. In the bioheat model, the
omega is the blood perfusion of tumor which varies depending on temperature range .
For T<37 omega= 0.833
For 37<T<42 omega=0.833-((T-37)^4.8)/5.438e3
For T>42 omega= 0.416
I defined two step functions under global definitions (step1) Location:37 from 0.833 to 0.833-((T-37)^4.8)/5.438e3
(step2) Location:42 From:0.833-((T-37)^4.8)/5.438e3 to:0.416
Bioheat :
step1*step2*rou*Cp*(Ta-T)+Qt...
Do you think this is a right approach?
Thanks
Please login with a confirmed email address before reporting spam
I want to define step function for my boundary like this:
For y<0.78 , Hp=0.5
For y>=0.78, Hp=0
How should I write it with flc2hs function?
Thanks in advance for your help,
Sepideh
Please login with a confirmed email address before reporting spam
Hi,
See the COMSOL Multiphysics User's Guide and Reference Guide, or search the COMSOL Documentation to also find model examples where step functions and ramp functions are used.
In this particular model's documentation, an explanation of the expression "U_mean*6*s*(s-1)*step1(t[1/s])" is missing. The expression defines a parabolic velocity profile at the inlet boundary using the curve parameter "s", which is a predefined curve parameter on boundaries in 2D models and runs from 0 to 1 along the direction of the boundary. The smoothed step function ramps up the velocity at the start of the simulation. The step function's input "t[1/s]" is the predefined variable "t" for the time (unit: s) and the "unit multiplication" using "[1/s]" is done to make the step function's input dimensionless.
Best regards,
Magnus Ringh, COMSOL
Hi,
what is a parabolic velocity profile in 3D models?
Regards
Ahmed Atrah
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.