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.

In what order does comsol evalulate expressions?

Andrew Prudil Nuclear Materials

Please login with a confirmed email address before reporting spam

Hi,
I'm working on a model with material properties that very complicated expression (summations of 7 terms, each divided by 7 different terms, each of which is dependent on multiple exponents and logarithms which are dependent on the temperature in my model). I'm concerned that depending on how I implement it, COMSOL might end up running really slow because it is constantly recalculating stuff it doesn't need to.

If I were writing this as standalone code, many parts of the expression would only need to be evaluated once per iteration instead of at each temperature point.

I don't know how comsol handles the expressions well enough to understand if it will evaluate all expressions which are independent of the spatially dependent variables before it tries to evaluate the spatially dependent ones, OR if it will substitute all the expressions to produce one large expression which is evaluated at each point.

If it is the first case, the execution would be very efficient. But the second case, then my code will execute slowly. Does anyone know? Would I be better off trying to code this in MatLab or C so I can control the execution order?

0 Replies Last Post 2010年11月30日 GMT-5 11:19
COMSOL Moderator

Hello Andrew Prudil

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.