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.

Data Analysis in COMSOL

Please login with a confirmed email address before reporting spam

Hi all,

I am simulating an electromagnet, but my question can be extended to any other problem.
Is I want to know the field average, the max and min value along a cenrtain axis I can define a cutline and use the Average, Maximum and Minimum operation in the Derived value node.

Now what I want to do is to evaluate the expression "(Max-Min)/ave" but I can't figure out how to do it.
Could you please give me some advice?

Thanks
Francesco

3 Replies Last Post 16 avr. 2015, 10:39 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: 9 years ago 15 avr. 2015, 14:20 UTC−4
Hi
You can indeed define a cut line and perform operations thereon in the Post processing section, but for some reasons you can not define post-processing variables and refer to them. I have suggested this a couple of times to Support but they have not managed this so far, there must be som programmation reason as most of my suggestion are being implemented rapidly I notice. So pls give Support your ideas documented at best so I'm not alone asking for this, and we will see it arrive in a future version :)

Now you can define variables in the Component section but I do not believe they can be defined on Data Set of "Cut Line" type. What I usually do is to cut my geometry with a Geometry Plane function or in the CAD and define variables thereon and then refer to these in the Post processing section. But changing the geometry means resolving everything. Else you may get around with an "Update Solution"

--
Good luck
Ivar
Hi You can indeed define a cut line and perform operations thereon in the Post processing section, but for some reasons you can not define post-processing variables and refer to them. I have suggested this a couple of times to Support but they have not managed this so far, there must be som programmation reason as most of my suggestion are being implemented rapidly I notice. So pls give Support your ideas documented at best so I'm not alone asking for this, and we will see it arrive in a future version :) Now you can define variables in the Component section but I do not believe they can be defined on Data Set of "Cut Line" type. What I usually do is to cut my geometry with a Geometry Plane function or in the CAD and define variables thereon and then refer to these in the Post processing section. But changing the geometry means resolving everything. Else you may get around with an "Update Solution" -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 15 avr. 2015, 14:55 UTC−4
Thank you Ivar for your response. I will write to the support as you suggest.

Basically I am changing the pole shape using the parametric sweep and I wanted to define the deviation of the field as I wrote before and evaluate it for each different shape.
Probably it will be quicker to copy/paste the tables coming from the Average, Maximum and MInimum and perform the calculation in matlab, excel or whatever.

Ciao
Francesco
Thank you Ivar for your response. I will write to the support as you suggest. Basically I am changing the pole shape using the parametric sweep and I wanted to define the deviation of the field as I wrote before and evaluate it for each different shape. Probably it will be quicker to copy/paste the tables coming from the Average, Maximum and MInimum and perform the calculation in matlab, excel or whatever. Ciao Francesco

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 16 avr. 2015, 10:39 UTC−4

Basically I am changing the pole shape using the parametric sweep and I wanted to define the deviation of the field as I wrote before and evaluate it for each different shape.


If the parametric geometry variables can also be used for the post processing axis, then I can offer another work-around.

When you create a 2D or 3D Plot Group, Comsol takes into account the sub-domains that are available from the Data Set selections. If your selection and the solution enables you to examine the sub-domain or the sub-domains that your axis is crossing, then you can define your axis in an analytical form. Comsol can let you focus over a section of the sub-domain(s) by the help of logical operators. Lets say that your axis is 10[mm] away from the r=0 axis and it is 20[mm] in length, you can write something like:

mf.normB*(r>10[mm])*(r<=10[mm]+e)*(z>-20[mm])*(z<=0[mm])

e: the width of the axis of interest

This enables you to use the post processing options under the 2D or 3D Plot Groups. Needless to say, this calculation will highly be dependent on the mesh around that axis. If you don`t have any geometry there, you can just add a line in your geometry so that you can later on increase the mesh by using Distribution option under Mesh.

More cleaner approach would be to define the axis as an Analytical Function under Global>Definitions>Functions>Analytic. Then define a variable under Component>Variables and use the analytical function to collect and store data during solution. With this option, you can use the built in mathematical functions for additional post processing.

Hope it helps,
Onur
[QUOTE] Basically I am changing the pole shape using the parametric sweep and I wanted to define the deviation of the field as I wrote before and evaluate it for each different shape. [/QUOTE] If the parametric geometry variables can also be used for the post processing axis, then I can offer another work-around. When you create a 2D or 3D Plot Group, Comsol takes into account the sub-domains that are available from the Data Set selections. If your selection and the solution enables you to examine the sub-domain or the sub-domains that your axis is crossing, then you can define your axis in an analytical form. Comsol can let you focus over a section of the sub-domain(s) by the help of logical operators. Lets say that your axis is 10[mm] away from the r=0 axis and it is 20[mm] in length, you can write something like: mf.normB*(r>10[mm])*(r-20[mm])*(zDefinitions>Functions>Analytic. Then define a variable under Component>Variables and use the analytical function to collect and store data during solution. With this option, you can use the built in mathematical functions for additional post processing. Hope it helps, Onur

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.