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.

Operators not allowed in user-defined functions

Please login with a confirmed email address before reporting spam

Dear all,

I am trying to generate a pulse train using a step function in combination with an analytic function using a summation but it seems like the operator "sum" is not allowed and it generates the error "Operators not allowed in user-defined functions". Does anyone know how can I use the sum operator in comsol or how to define sigma notation for summation? I have used sum(expr,index,lower,upper).

STEP Location: tp from: 1 to: 0

ANALYTIC Expression: sum( S( t-(Np*(1/fr)) ) - S( t-(Np+tp) ), Np, 0, Np-1 ) arguments: t

sum(expr,index,lower,upper); operator sum as defined in comsol

Np: number of pulses fr: repetition rate tp: pulse duration


1 Reply Last Post 28 feb 2022, 10:03 GMT-5
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 3 years ago 28 feb 2022, 10:03 GMT-5

Gabriel,

operators like sum() are only available in post processing. I am not completely sure but your question sound like you want to build a sum in a time dependent model along time while it solves. This can be done with an additional equation and the previous solution. This blog contribution may be useful: https://www.comsol.de/blogs/using-the-previous-solution-operator-in-transient-modeling/

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Gabriel, operators like sum() are only available in post processing. I am not completely sure but your question sound like you want to build a sum in a time dependent model along time while it solves. This can be done with an additional equation and the previous solution. This blog contribution may be useful: https://www.comsol.de/blogs/using-the-previous-solution-operator-in-transient-modeling/ Cheers Edgar

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.