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.
Expression, Function and how it must work correctly?
Posted 31 gen 2023, 05:32 GMT-5 Modeling Tools & Definitions, Modeling Workflow, User Interface Version 6.1 8 Replies
Please login with a confirmed email address before reporting spam
Dear Colleauges now I in the process of transfer from Ansys to Comsol and i have 20 years expirience for numerical simulations because now Comsol is really friendly and powerfull instrument.
I see the big possibilities for using Expression and Function for flexible define BC, matherial properties and etc, but with my huge expirience i have strange problem for my works with Espression in the Comsol. For example i want to define Piecewise function for radiative emisivity BC for walls, and i define hrad function with argument T is 0.1*sigma_const*(T^4 - 293^4) and interval for T. But Comsol not calculated the part of expression "-293^4" and results the same for "-293[K]^4" and etc, for example 0.1*sigma_const*(T^4)- 0.1*sigma_const*(293^4). The plot graph for this function calculated only for T argement and absolutely ignored all other. Where i can see the principles (algorithm) for correct defining of expresions? Please help me. As well, becasue Expression field absolutely don't has contects help (For example Ansys CFX preprocessor has a prefect help for all variables and etc in the field for formula), I'm as a user not understand what i may to do in the Expression field. The help of Comsol in laptop version is too small and i want to find the all list of operations, variables and etc (include from results solutions) which i can to use in the expression field. Please help me. Give me please the links to webinars,papers and other Comsol web helps, where i can see it clear.
My big respect for Comsol team, Evgeny
Please login with a confirmed email address before reporting spam
Hi, Evgeny!
But Comsol not calculated the part of expression...
You can see on the screenshot (Screenshot_1.png) that Peicewise function works correctly.
Expression field absolutely don't has contects help...
It's not exactly the case. With CTRL+Space shortcut you can open the list of parameters, variables, functions and operators that you can use in Expressions (see the Screenshot_2.png).
The help of Comsol in laptop version is too small...
Please check that help files are installed. Online version of the help system is available here: https://doc.comsol.com/6.1/docserver/#!/com.comsol.help.comsol/helpdesk/helpdesk.html
-------------------Best regards,
Dmitry Lazarev
Attachments:
Please login with a confirmed email address before reporting spam
Hello Dmitry
Thank you for you quick reply 1. Yes, context help is working by CTRL+SHIFT, but only for Expression field not for Function. 2. Please see the results of calculation fuction on my laptop... The both function gives a equal results. It is too strange, may be it my error and i'm a stupid. 3. Please help me and show (give) the direct link to paragraphs in your link ( https://doc.comsol.com/6.1/docserver/#!/com.comsol.help.comsol/helpdesk/helpdesk.html), where i can find the complete list of all variables, operators and etc which i can to implement in Expression and Function field.
Best regards, Evgeny
Attachments:
Please login with a confirmed email address before reporting spam
Evgeny,
In the "with" screenshot, the plot is of a function called Myrad, not hrad. Could that be the issue?
Jeff
-------------------Jeff Hiller
Please login with a confirmed email address before reporting spam
Hello Jeff
"Myrad" it was previous function name before correction. I have change the name and at any case results the same - not correct. After your message i repeated few time to calculate - negave. I'm confused, the my version of Comsol is last - 6.1.0.282. This is a error of system i think, because the d(Enth(T),T) not working as well (my other forum topic). I'll thinking...
Best regards, Evgeny
Please login with a confirmed email address before reporting spam
Hello Evgeny,
If I change the function definition to include 293[K]
in the piecewise function and click the Plot button, the values of the plotted function change as expected in the Function Plot window. I cannot really see any other reason than that you have not updated the function plot.
For lists of available mathematical and logical functions, user-defined functions, physical and mathematical constants, operators, and variables that you can use in expressions in your COMSOL Multiphysics models, see the Global and Local Definitions chapter in the COMSOL Multiphysics Reference Manual (also available in the Help and Documentation windows in the COMSOL Desktop where you can search for topics).
Note that some variables, such as the spatial coordinates, depend on the chosen space dimension in the model component, and that variables have a "scope" (that is, some of them are only available in a model component and depending on which physics interfaces you have added). There is also a "scope syntax" for accessing, for example, material properties during results evaluation. In the settings for plot nodes, for example, you can also use Ctrl+Space
or the Insert Expression and Replace Expression buttons to choose from all available and applicable variables.
Best regards,
Magnus
Please login with a confirmed email address before reporting spam
Hello Evgeny,
If I change the function definition to include
293[K]
in the piecewise function and click the Plot button, the values of the plotted function change as expected in the Function Plot window. I cannot really see any other reason than that you have not updated the function plot.For lists of available mathematical and logical functions, user-defined functions, physical and mathematical constants, operators, and variables that you can use in expressions in your COMSOL Multiphysics models, see the Global and Local Definitions chapter in the COMSOL Multiphysics Reference Manual (also available in the Help and Documentation windows in the COMSOL Desktop where you can search for topics).
Note that some variables, such as the spatial coordinates, depend on the chosen space dimension in the model component, and that variables have a "scope" (that is, some of them are only available in a model component and depending on which physics interfaces you have added). There is also a "scope syntax" for accessing, for example, material properties during results evaluation. In the settings for plot nodes, for example, you can also use
Ctrl+Space
or the Insert Expression and Replace Expression buttons to choose from all available and applicable variables.Best regards,
Magnus
Hello Magnus Please see the record of screen. I'm reinstall the COMSOL 6.1.0.282, but the result the same. This is a system bag i think
Attachments:
Please login with a confirmed email address before reporting spam
Evgeny,
I see the plot change, albeit subtly, at 0:40 in your video.
Note that T^4-293^4 is not very different from T^4 when T>300 (T^4 grows very quickly and dominates 293^4). When T<300, the 0.1*sigma_const multiplying factor causes both expressions you're plotting to be essentially zero and therefore visually indistinguishable.
Jeff
-------------------Jeff Hiller
Please login with a confirmed email address before reporting spam
Thank you Jeff
It is correct. The values is too big and "covered" the small "-293^4" addition. This issue is closed "d" operator not working on Win7, and I'm update to Win 10. Now all working.
Best regards, Evgeny
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.