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.

square wave

Please login with a confirmed email address before reporting spam


Hi Everybody

Any one who knows how to apply a square wave voltage as boundary conditions?

best regards.

3 Replies Last Post May 30, 2016, 11:45 a.m. EDT
Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 17, 2010, 11:30 a.m. EDT
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 May 18, 2010, 2:02 a.m. EDT
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: 9 years ago May 30, 2016, 11:45 a.m. EDT
thank you for your answer! that do help~
thank you for your answer! that do 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.