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.

Plotting of a single curve from the average result of all parameters

Please login with a confirmed email address before reporting spam

Greetings,

Is COMSOL 5.2a capable of computing an expression based on the results of each parameter considered in the Parametric Sweep?

For example, a set of results is obtained from each parameter. Hence, 5 set of results for 5 parameters considered.

Now, am I able to define a variable or function in the software to calculate the average of these 5 sets of results? (instead of extracting each data set and doing the average myself in Excel)

Thank you.

3 Replies Last Post 2016年12月9日 GMT-5 22:19
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2016年12月8日 GMT-5 08:10
Hi Linus,
Yes, you can compute such an average by making use of the sum and with operators.
The expression in your example would look something like sum(with(n,Thing_to_average),n,1,5)/5.
See Reference Manual for COMSOL Multiphysics, version 5.2a, page 231 and following) for information on these operators.
Best regards,
Jeff
Hi Linus, Yes, you can compute such an average by making use of the sum and with operators. The expression in your example would look something like sum(with(n,Thing_to_average),n,1,5)/5. See Reference Manual for COMSOL Multiphysics, version 5.2a, page 231 and following) for information on these operators. Best regards, Jeff

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2016年12月9日 GMT-5 21:42

Hi Linus,
Yes, you can compute such an average by making use of the sum and with operators.
The expression in your example would look something like sum(with(n,Thing_to_average),n,1,5)/5.
See Reference Manual for COMSOL Multiphysics, version 5.2a, page 231 and following) for information on these operators.
Best regards,
Jeff


Is it available for COMSOL version 5.0?
[QUOTE] Hi Linus, Yes, you can compute such an average by making use of the sum and with operators. The expression in your example would look something like sum(with(n,Thing_to_average),n,1,5)/5. See Reference Manual for COMSOL Multiphysics, version 5.2a, page 231 and following) for information on these operators. Best regards, Jeff [/QUOTE] Is it available for COMSOL version 5.0?

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2016年12月9日 GMT-5 22:19

Hi Linus,
Yes, you can compute such an average by making use of the sum and with operators.
The expression in your example would look something like sum(with(n,Thing_to_average),n,1,5)/5.
See Reference Manual for COMSOL Multiphysics, version 5.2a, page 231 and following) for information on these operators.
Best regards,
Jeff


Greetings Jeff,

Your advise is very helpful! I found the operator at the given page number.

As for integration, the manual states "integrate(expr,var,lower,upper)". But where do I key in this exactly?

For example:
expr = pressure*sin (theta)*cos (theta) -> Definition>Analytic?
var = pressure, theta -> Definition>Variable (from what I understand)
lower = 0 rad; upper = pi/2 rad

I am trying to compute the pressure at every prescribed interval of angle from 0 to pi/2 rad (by parametric sweep). Hence, I will have a set of results for each angle interval.

This is the part where I face difficulty in understanding how to integrate these sets of results together by the above expression. I believe there must be a way for this to be done during the study.

Thank you.
[QUOTE] Hi Linus, Yes, you can compute such an average by making use of the sum and with operators. The expression in your example would look something like sum(with(n,Thing_to_average),n,1,5)/5. See Reference Manual for COMSOL Multiphysics, version 5.2a, page 231 and following) for information on these operators. Best regards, Jeff [/QUOTE] Greetings Jeff, Your advise is very helpful! I found the operator at the given page number. As for integration, the manual states "integrate(expr,var,lower,upper)". But where do I key in this exactly? For example: expr = pressure*sin (theta)*cos (theta) -> Definition>Analytic? var = pressure, theta -> Definition>Variable (from what I understand) lower = 0 rad; upper = pi/2 rad I am trying to compute the pressure at every prescribed interval of angle from 0 to pi/2 rad (by parametric sweep). Hence, I will have a set of results for each angle interval. This is the part where I face difficulty in understanding how to integrate these sets of results together by the above expression. I believe there must be a way for this to be done during the study. Thank you.

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.