Parallel evaluation of expressions in Global Evaluation

Breno Topology optimization and Finite Element specialist

Please login with a confirmed email address before reporting spam

Is it possible for Expressions in a Results->Derived Values->Global Evaluation node to all be computed in parallel?

I'm running view factor calculations, which require surface integrations and the evaluation of the rad.radopu function. The stationary solver (for a Surface-To-Surface Radiation problem) takes only 2 and a half minutes, while the view factor calculations take up to two hours... It seems that the evaluations are performed using only one core of my CPU.

For reference, my setup is similar to this COMSOL tutorial: https://www.comsol.com/model/view-factor-computation-20701. except that I define the surface areas and the view factors in a Variables node.


5 Replies Last Post 2025年9月4日 GMT+8 15:32
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 2 weeks ago 2025年8月22日 GMT+8 01:58

Hi Breno,

I am frequently having similar issues with complex post processing. Defining variables doesn't help because they get evaluated again when called in post processing. One workaround can be to define global state variables and assign the variables to them. State variables are stored in the solution and are available without reevaluation. States do not carry a unit and you must take care of the units by yourself.

Expensive expressions are obviously calculated much faster within the solver code than in post processing code.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Breno, I am frequently having similar issues with complex post processing. Defining variables doesn't help because they get evaluated again when called in post processing. One workaround can be to define global state variables and assign the variables to them. State variables are stored in the solution and are available without reevaluation. States do not carry a unit and you must take care of the units by yourself. Expensive expressions are obviously calculated much faster within the solver code than in post processing code. Cheers Edgar

Breno Topology optimization and Finite Element specialist

Please login with a confirmed email address before reporting spam

Posted: 2 weeks ago 2025年8月22日 GMT+8 19:59

Hello Edgar,

I like the idea. Though, after trying to implement it, after about 3 hours of solution, it stopped with an error, where apparently a variable was not defined (?). This seems difficult to debug. I'd need to start small with, e.g. that view factor tutorial. If you use state variables, COMSOL has to "compile" that in the equations, right? Or maybe I just set them up wrong...

I used "Boundary" geometric entities for my state variables, because they have to be evaluated as boundary surface integrations, but also set an order of 0, since they are scalars. I'm not sure if this is correct. Additionally, I set "Update: Only Initialization". Maybe there's a simplification that can be done in the Study/Solver node to improve performance?

Anyway, in the end I "solved" my problem by using normal variables in one file, running the problem, saving the file with the results, then copying and pasting this file multiple times. Open each of these files, and finally Evaluate different sets of expressions in each of them, in parallel. Definitely far from a pretty solution, but it works.

Cheers, Breno

Hello Edgar, I like the idea. Though, after trying to implement it, after about 3 hours of solution, it stopped with an error, where apparently a variable was not defined (?). This seems difficult to debug. I'd need to start small with, e.g. that view factor tutorial. If you use state variables, COMSOL has to "compile" that in the equations, right? Or maybe I just set them up wrong... I used "Boundary" geometric entities for my state variables, because they have to be evaluated as boundary surface integrations, but also set an order of 0, since they are scalars. I'm not sure if this is correct. Additionally, I set "Update: Only Initialization". Maybe there's a simplification that can be done in the Study/Solver node to improve performance? Anyway, in the end I "solved" my problem by using normal variables in one file, running the problem, saving the file with the results, then copying and pasting this file multiple times. Open each of these files, and finally Evaluate different sets of expressions in each of them, in parallel. Definitely far from a pretty solution, but it works. Cheers, Breno

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 2 weeks ago 2025年8月22日 GMT+8 22:46

Hi Breno,

I understood that you are calculating integrals and the integral is a global value that doesn't need to be tied to a geometric entity. I am only using global states.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Breno, I understood that you are calculating integrals and the integral is a global value that doesn't need to be tied to a geometric entity. I am only using global states. Cheers Edgar

Walter Frei COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 17 hours ago 2025年9月4日 GMT+8 02:45
Updated: 17 hours ago 2025年9月4日 GMT+8 02:58

Hello Breno,

There can be different ways of doing this that can be more efficient, yes. It does also though raise the question as to why you want to compute all of these terms? That is, once you have the terms of the view factor matrix, what do you plan to do with them? I realize that this may be an involved question specific to your workflow, so if you wish to open a support case we can also discuss this more privately.

Best, Walter Frei, PhD COMSOL Support

Hello Breno, There can be different ways of doing this that can be more efficient, yes. It does also though raise the question as to why you want to compute all of these terms? That is, once you have the terms of the view factor matrix, what do you plan to do with them? I realize that this may be an involved question specific to your workflow, so if you wish to open a support case we can also discuss this more privately. Best, Walter Frei, PhD COMSOL Support

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 5 hours ago 2025年9月4日 GMT+8 15:32

Hi Walter,

good to see you kicking in. In some cases there is no way around doing complex operations in the data, such as integrals and averages. In such cases the postprocessing can be more costly than the solution. I successfully worked around in some cases by using the global states.

Can you suggest other more efficient ways?

Thank you, Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Walter, good to see you kicking in. In some cases there is no way around doing complex operations in the data, such as integrals and averages. In such cases the postprocessing can be more costly than the solution. I successfully worked around in some cases by using the global states. Can you suggest other more efficient ways? Thank you, Edgar

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

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.