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.

Evaluate standard deviation of element size h

Magdalena Haaf Certified Consultant

Please login with a confirmed email address before reporting spam

I consider a 3D model with a free tetrahedral mesh. I calculate the average of the element size h via "Derive Values" --> "Volume average". This part works. Now I would like to calculate the standard deviation of the element size, but I couldn't find out how to use the expression correctly. Comsol has already provided the template which I found via "add expressions":

stddev(op, expr) -> Standard deviation of op(expr, ...)

The first argument of stddev() has to be a string due to diverse error messages I got. Does anyone know what I need to write instead of "op"? Thank you for your help.


2 Replies Last Post Oct 28, 2020, 4:56 a.m. EDT
Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 3 years ago Oct 27, 2020, 10:35 a.m. EDT
Updated: 3 years ago Oct 27, 2020, 10:36 a.m. EDT

The first argument to stddev() should be the name of an operator.

Some ways to achieve what you want:

  • Add a Nonlocal Coupling intop1 of type Integration to Component > Definitions, update the solution, and evaluate stddev('comp1.intop1',h) in a Global Evaluation.

  • Add a Nonlocal Coupling aveop1 of type Average to Component > Definitions, update the solution, and evaluate sqrt(aveop1((h-aveop1(h))^2)) in a Global Evaluation.

See https://www.comsol.com/forum/thread/40335/standard-deviation-over-a-data-set for a longer explanation.

The first argument to stddev() should be the name of an operator. Some ways to achieve what you want: * Add a Nonlocal Coupling intop1 of type Integration to Component > Definitions, update the solution, and evaluate stddev('comp1.intop1',h) in a Global Evaluation. * Add a Nonlocal Coupling aveop1 of type Average to Component > Definitions, update the solution, and evaluate sqrt(aveop1((h-aveop1(h))^2)) in a Global Evaluation. See https://www.comsol.com/forum/thread/40335/standard-deviation-over-a-data-set for a longer explanation.

Magdalena Haaf Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 3 years ago Oct 28, 2020, 4:56 a.m. EDT

Thank you for your answer! Both ways work for my problem!

Thank you for your answer! Both ways work for my problem!

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.