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.

Sweep a Postprocessing Parameter

Please login with a confirmed email address before reporting spam

Hello,

I am running a stationary magnetic simulation. I have a 3D surface (a disc) over which I am integrating the normal magnetic flux density to get the total magnetic flux through the surface.

With much pain, I created the surface using the "Parameterized Surface" feature. I computed the flux using "Surface Integration," a "Derived Value." The result that I see in the table when I click "Evaluate" seems reasonable.

I would like to achieve two things, and I'm hoping someone can point me in the right direction:

1) I am not only interested in the flux at one point; I need the flux at many points as I vary the (radial) position of the surface. Because I am interested in surface positions along a circle, only a single parameter (angle) need be swept for the surface position. I was hoping that there was some sort of "Postprocessing Parametric Sweep" option, but I don't see one. Being that position of the surface does not alter the solution, re-solving the system for each radial position of the surface (which is what happens if I use the regular "Parametric Sweep" tool) seems unnecessary; this should be limited to postprocessing only. Any advice on how I can compute angle vs flux in this way? See attached image.

2) I would then like to plot / export a table of the values of interest; that is, radial position (the swept parameter) vs total magnetic flux (the derived value). I realize that I can't even plot what I do have (can you not plot a derived value?) so I figured I would ask this question along with my first. How would I plot / export the output of the sweep described above?

Thank you for the help,

Rob


5 Replies Last Post 05.08.2016, 17:31 GMT-4
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 05.08.2016, 08:14 GMT-4
Hi Robert,
I am not sure I understand what exactly you are trying to do - perhaps because I am not an EM guy - but I do get that you are trying to generate many plots off of the same dataset. This leads me to think you may want to use the Application Builder for that, because in an app you can write a method containing a for loop to vary the parameter. The same idea has popped up in a few other Discussion Forum threads, see for instance www.comsol.com/community/forums/general/thread/100121 .
I hope this helps,
Jeff
Hi Robert, I am not sure I understand what exactly you are trying to do - perhaps because I am not an EM guy - but I do get that you are trying to generate many plots off of the same dataset. This leads me to think you may want to use the Application Builder for that, because in an app you can write a method containing a for loop to vary the parameter. The same idea has popped up in a few other Discussion Forum threads, see for instance https://www.comsol.com/community/forums/general/thread/100121 . I hope this helps, Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 05.08.2016, 15:28 GMT-4
Jeff,

Thank you for the information. That is a good lead; I will look into coding a solution.

I'll make my question more clear, in case someone has a better solution:

I have a solution to a static 3D problem. The solution is a vector field in three dimensions. I am interested in finding the flux through an arbitrary surface as that surface moves through the solution domain. The result should be a table of position vs flux. The surface does not affect the solution, so I should be able to perform the integration at multiple surface positions entirely via postprocessing. I assumed that the way to do that would be some sort of "postprocessing parametric sweep," whereby I sweep the position variable(s) and compute the flux at each position. However, such an option does not exist in COMSOL. How would one go about doing this type of computation?
Jeff, Thank you for the information. That is a good lead; I will look into coding a solution. I'll make my question more clear, in case someone has a better solution: I have a solution to a static 3D problem. The solution is a vector field in three dimensions. I am interested in finding the flux through an arbitrary surface as that surface moves through the solution domain. The result should be a table of position vs flux. The surface does not affect the solution, so I should be able to perform the integration at multiple surface positions entirely via postprocessing. I assumed that the way to do that would be some sort of "postprocessing parametric sweep," whereby I sweep the position variable(s) and compute the flux at each position. However, such an option does not exist in COMSOL. How would one go about doing this type of computation?

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 05.08.2016, 16:02 GMT-4
Robert,

a second option might be a second study using the first solution. It would just perform a parametric sweep but without any physics. This parametric sweep would then control the surface integrations.

Just a wild guess, I haven't tried something like that so far.

Cheers
Edgar

--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Robert, a second option might be a second study using the first solution. It would just perform a parametric sweep but without any physics. This parametric sweep would then control the surface integrations. Just a wild guess, I haven't tried something like that so far. Cheers Edgar -- Edgar J. Kaiser emPhys Physical Technology http://www.emphys.com

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 05.08.2016, 16:26 GMT-4
Hi Edgar and Robert,
I believe Edgar's thinking of something like this: www.comsol.com/blogs/maximum-evaluations-on-parallel-sections/ , correct? That's something I had not thought of and does not require programming.
Jeff
PS: Yet another approach would be to perform the post-processing loop in MATLAB, assuming your license includes LiveLink for MATLAB.
Hi Edgar and Robert, I believe Edgar's thinking of something like this: https://www.comsol.com/blogs/maximum-evaluations-on-parallel-sections/ , correct? That's something I had not thought of and does not require programming. Jeff PS: Yet another approach would be to perform the post-processing loop in MATLAB, assuming your license includes LiveLink for MATLAB.

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 05.08.2016, 17:31 GMT-4
Hey guys,

Thank you so much for the help. This is exactly what I needed to accomplish. Nice work!

Rob
Hey guys, Thank you so much for the help. This is exactly what I needed to accomplish. Nice work! Rob

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.