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.
running integration of variable in time domain
Posted 8 dic 2014, 08:45 GMT-5 Parameters, Variables, & Functions 8 Replies
Please login with a confirmed email address before reporting spam
Hi everybody
Short version: How to do a running integration/averaging of a time-dependent variable on a fixed length time interval? E.g. from time-dependent variable v I want to calculate a new variable vhat given by: vhat(t) = integral of v(t) from t-T0 to t, where T0 is a fixed time period
Long version: I have a solution from a time dependent study, Comsol 4.4. It is a driven non-linear acoustic system. The driving force has frequency f0 and thus oscillation period T0=1/f0. The result for some variable "v" is varying in time. I want to extract the "slowly-varying" component of v, that being variations on time scales larger than T0. To do that I want to do a running averaging of v, which is stored in a new variable vhat defined by vhat(t) = integral of v(t) from t-T0 to t. Thus vhat is the averaged of v over the last oscillation period.
Now it seems that this can be done in the postprocessing by use of the "timeavg"
function, e.g. timeavg(t-T0,t,v). However, this is very slow and only work in postprocessing.
Is there a way to calculate vhat as part of the model, such as through a mathematics physics? (i.e. not as postprocessing)
Kind regards,
Peter Muller
ps. there is a simple way to calculate the integral from start, t=0, to the current time t, linked here www.comsol.com/support/knowledgebase/913/ . However this is not exactly what I want to do.
pps. Ivar if you are out there, you referred to doing this in a post several years ago, if you have a smart way to implement it I would be very glad to hear about it.
link: www.comsol.dk/community/forums/general/thread/4706/
Quote by Ivar in linked discussion: "Clearly if you know the periode, you can take a running integration of one periode and plot that, then you get rid of the main oscillations".
Short version: How to do a running integration/averaging of a time-dependent variable on a fixed length time interval? E.g. from time-dependent variable v I want to calculate a new variable vhat given by: vhat(t) = integral of v(t) from t-T0 to t, where T0 is a fixed time period
Long version: I have a solution from a time dependent study, Comsol 4.4. It is a driven non-linear acoustic system. The driving force has frequency f0 and thus oscillation period T0=1/f0. The result for some variable "v" is varying in time. I want to extract the "slowly-varying" component of v, that being variations on time scales larger than T0. To do that I want to do a running averaging of v, which is stored in a new variable vhat defined by vhat(t) = integral of v(t) from t-T0 to t. Thus vhat is the averaged of v over the last oscillation period.
Now it seems that this can be done in the postprocessing by use of the "timeavg"
function, e.g. timeavg(t-T0,t,v). However, this is very slow and only work in postprocessing.
Is there a way to calculate vhat as part of the model, such as through a mathematics physics? (i.e. not as postprocessing)
Kind regards,
Peter Muller
ps. there is a simple way to calculate the integral from start, t=0, to the current time t, linked here www.comsol.com/support/knowledgebase/913/ . However this is not exactly what I want to do.
pps. Ivar if you are out there, you referred to doing this in a post several years ago, if you have a smart way to implement it I would be very glad to hear about it.
link: www.comsol.dk/community/forums/general/thread/4706/
Quote by Ivar in linked discussion: "Clearly if you know the periode, you can take a running integration of one periode and plot that, then you get rid of the main oscillations".
8 Replies Last Post 22 lug 2015, 02:48 GMT-4