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.

CREATING A PERIODIC WAVE WITH flc2hs(x,scale) AND mod(a,b)

Please login with a confirmed email address before reporting spam

Hello,

I'm trying to build a periodical wave. I want it to be linear, with its first semiperiod as an ascendent linear function, and the second semiperiod as a descendent linear function. Just like in the attached image.

I am using the function flc2hs(x,scale) to define the steps that will build the wave. I have defined two diferent parts:

Increasing part:
flc2hs(t+1e-2, 1e-2) - flc2hs(t, 1e-2)

decreasing part:
flc2hs(t, 1e-2) - flc2hs(t,2e-2)

What i have in mind is to repeat this two steps along t with the mod(a,b) function, and to multiply them with the linear function that will define the wave form(it'll be something linearly time depending).

Could anyone help me doing this two last steps? I've been searching for the mod(a,b) function on the program guide, but there is no explanation about it.

thank you very much


5 Replies Last Post 23 mars 2011, 02:30 UTC−4
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 mars 2010, 17:08 UTC−4
Hi

but you will not really get a "linear function" with the heaviside smooth step functions, however it will be derivable.

When I have a problem with a mathematical function in COMSOL, my way around is to plot it as a "function" see below

Good luck
Ivar
Hi but you will not really get a "linear function" with the heaviside smooth step functions, however it will be derivable. When I have a problem with a mathematical function in COMSOL, my way around is to plot it as a "function" see below Good luck Ivar


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 3 avr. 2010, 11:34 UTC−4
Hi Ivar,

I've been working on creating this wave, and i ve decided to define it this way:

(t*H0)*(t<0.01)+((0.02-t)*H0)*(t>0.01)

I've realised that what i was trying to do at the beginning was a bit complex. The result is on the attached image. I only need one period of this wave. If i need the wave to be periodic in time, i'll have problems, because this description is not ok, the resultant wave is permanently decreasing from t=0.01. I'll investigate more.

Thanks for the help!

Tomàs
Hi Ivar, I've been working on creating this wave, and i ve decided to define it this way: (t*H0)*(t0.01) I've realised that what i was trying to do at the beginning was a bit complex. The result is on the attached image. I only need one period of this wave. If i need the wave to be periodic in time, i'll have problems, because this description is not ok, the resultant wave is permanently decreasing from t=0.01. I'll investigate more. Thanks for the help! Tomàs


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 4 avr. 2010, 02:48 UTC−4
Hi

indeed it would most probabay work, if not try to step in a concetrated way at your slope changes. You still have the modulo to make it periodic.

If you still have convergence problems, you could fit a smoother sin function just around your slope change. I mostly use Maple to help me formulate my math for such piecewise continuous functions

Good luck
Ivar
Hi indeed it would most probabay work, if not try to step in a concetrated way at your slope changes. You still have the modulo to make it periodic. If you still have convergence problems, you could fit a smoother sin function just around your slope change. I mostly use Maple to help me formulate my math for such piecewise continuous functions Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 22 mars 2011, 18:20 UTC−4
I too am trying to create a periodic wave with flc2hs in 3.5a.

I applied the following: flc2hs(mod(t,365.2)-120),1)-flc2hs(mod(t,365.2)-150,1))

My t is measured in days so it should be "on" from day 120 to 150, and "off" otherwise, for each 365.2 day cycles. But it only happens the one time.

Is there something I am doing incorrectly?

Thanks!

Mattie
I too am trying to create a periodic wave with flc2hs in 3.5a. I applied the following: flc2hs(mod(t,365.2)-120),1)-flc2hs(mod(t,365.2)-150,1)) My t is measured in days so it should be "on" from day 120 to 150, and "off" otherwise, for each 365.2 day cycles. But it only happens the one time. Is there something I am doing incorrectly? Thanks! Mattie

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 23 mars 2011, 02:30 UTC−4
Hi

normally t is expressed by default in seconds, so I would use a "t[1/day]" (this works in v4, probably also in 3.5) in your call

Define a function with your expression, that helps to test it, as you can plot it out

and you should check your balance of "()"

--
Good luck
Ivar
Hi normally t is expressed by default in seconds, so I would use a "t[1/day]" (this works in v4, probably also in 3.5) in your call Define a function with your expression, that helps to test it, as you can plot it out and you should check your balance of "()" -- Good luck Ivar

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.