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.

In laminar flow models, how can the step function be combined with fluid velocity to improve convergence

Please login with a confirmed email address before reporting spam

I noticed that the forms in which the step function is combined with the fluid velocity are *step1(t[1/s]) and *step1(t/1[s]), etc., what are the differences between these forms and when they should be used


1 Reply Last Post Aug 9, 2023, 6:57 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Aug 9, 2023, 6:57 a.m. EDT
Updated: 9 months ago Aug 9, 2023, 6:58 a.m. EDT

Hello, step1(t) is a smoothed step function, you have others available (read the documentation!). You can plot them to visualize them as well. When multiplied by a constant, it makes the result going from 0 (by default) to the constant value. In some cases (but not all!) having a discontinuous function (step, heaviside or the like) is actually very difficult to solve numericaly. Smoothing out the step is then the preferred way to go and COMSOL has preimplemented those functions, which is very convenient. To illustrate this, if you take the Fourier transform of a discontinuous function (of time) you'll end up with a very large frequency spectrum that in practice is impossible to resolve in time if you want to get the high frequencies (it means very small time steps). Making a smooth transition is a way to reduce the frequency content of your varying function so that your time integrator will have a chance to fully resolve the dynamics. This situation is met often when you want to adjust one boundary condition with time. Just note that in the real world you cannot have a velocity field that goes from 0 to a finite value, so this smoothing is consistent with reality. It helps the convergence because the time steps do not need to be too small. As for the notation t[1/s], or equivalently t/1[s], this is to specify the unit so that the variable t of the function is dimensionless, but I think COMSOL has recently removed this constraint, so that you won't have any warning if you don't specify it. Anyhow even with a warning regarding units this won't prevent the computation to run.

Eric Favre
Renaissance Fusion

-------------------
Eric Favre
Renaissance Fusion
Hello, step1(t) is a smoothed step function, you have others available (read the documentation!). You can plot them to visualize them as well. When multiplied by a constant, it makes the result going from 0 (by default) to the constant value. In some cases (but not all!) having a discontinuous function (step, heaviside or the like) is actually very difficult to solve numericaly. Smoothing out the step is then the preferred way to go and COMSOL has preimplemented those functions, which is very convenient. To illustrate this, if you take the Fourier transform of a discontinuous function (of time) you'll end up with a very large frequency spectrum that in practice is impossible to resolve in time if you want to get the high frequencies (it means very small time steps). Making a smooth transition is a way to reduce the frequency content of your varying function so that your time integrator will have a chance to fully resolve the dynamics. This situation is met often when you want to adjust one boundary condition with time. Just note that in the real world you cannot have a velocity field that goes from 0 to a finite value, so this smoothing is consistent with reality. It helps the convergence because the time steps do not need to be too small. As for the notation t[1/s], or equivalently t/1[s], this is to specify the unit so that the variable t of the function is dimensionless, but I think COMSOL has recently removed this constraint, so that you won't have any warning if you don't specify it. Anyhow even with a warning regarding units this won't prevent the computation to run. Eric Favre Renaissance Fusion

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.