Robert Koslover
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
17 mag 2010, 11:30 GMT-4
First of all, there are no true square waves for most physical quantities (such as voltage, for example).
That said, you can create a step function by combining the sign and trig functions. For example: f = sign(sin(t)). But this is generally a bad idea to actually use, since time-stepping must be done in finite-time steps. Thus, you can never set a small enough time step to capture an infinitely-rapid transition. And the result in any time-stepping model, if using such an expression, is serious numerical errors.
I find that for real-world problems, it is best to model smoothed-out transitions that allows several time steps during the rapid rise (or rapid fall), to prevent numerical anomalies. There exist various ways to synthesize functions with relatively-flat tops, flat bottoms, and relatively-rapid rises and falls, using the available functions. You'll need to decide what time function shape you really need, based on the details of your voltage source, which (as I said earlier) cannot be a true square wave if it represents anything in the real world.
I hope that helps.
First of all, there are no true square waves for most physical quantities (such as voltage, for example).
That said, you can create a step function by combining the sign and trig functions. For example: f = sign(sin(t)). But this is generally a bad idea to actually use, since time-stepping must be done in finite-time steps. Thus, you can never set a small enough time step to capture an infinitely-rapid transition. And the result in any time-stepping model, if using such an expression, is serious numerical errors.
I find that for real-world problems, it is best to model smoothed-out transitions that allows several time steps during the rapid rise (or rapid fall), to prevent numerical anomalies. There exist various ways to synthesize functions with relatively-flat tops, flat bottoms, and relatively-rapid rises and falls, using the available functions. You'll need to decide what time function shape you really need, based on the details of your voltage source, which (as I said earlier) cannot be a true square wave if it represents anything in the real world.
I hope that helps.
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
18 mag 2010, 02:02 GMT-4
Hi
take a look at the flc2hs step functions of COMSOL, do a search of "heaviside" on the command.pdf (p210 in V3.5a), by combining two of these funtions you will get a nice turn on and off, with a smooth transistion that is compatible with the COMSOL solvers.
in V4 this is "precooked" for you
Have fun Comsoling
Ivar
Hi
take a look at the flc2hs step functions of COMSOL, do a search of "heaviside" on the command.pdf (p210 in V3.5a), by combining two of these funtions you will get a nice turn on and off, with a smooth transistion that is compatible with the COMSOL solvers.
in V4 this is "precooked" for you
Have fun Comsoling
Ivar
Please login with a confirmed email address before reporting spam
Posted:
8 years ago
30 mag 2016, 11:45 GMT-4
thank you for your answer! that do help~
thank you for your answer! that do help~