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.

Functions vs Variables

Please login with a confirmed email address before reporting spam

Many calculation tasks can be handled either with a variable or a function. Are the calculations handled differently in the code? Are there advantages of one over the other, or are they just different ways of organization?

For example, a model might have a source term R that depends on many things. One could define R as R: myVariable and in a variables node: myVariable = thing1 * thing2^2 / sqrt(thing3)

Alternatively, one could use a function: R: myFunction(thing1, thing2, thing3) and then define the analytical function myFunction(a,b,c) = a * b^2 / sqrt(c)

Once the model is run, are these approaches different in efficiency or stability?

-------------------
Steve Spielman
Aerosol Dynamics Inc.

0 Replies Last Post 17 avr. 2020, 17:05 UTC−4
COMSOL Moderator

Hello Steve S

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.