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.

Unable to call the local function defined when defining material properties

Please login with a confirmed email address before reporting spam

Hello,

I am new to COMSOL, and I ran into problems when I am defining material properties. I defined analytic functions and piecewise functions under Component 1 ==> Definitions, and then while I am trying to define the properties, I put the name of the function that I have already defined in the Expression box, but a floating box with "Unknow variable" appears everytime. And I also tried right click on Basic ==> Funcitions to define the variable that I would like to use as the property expression but the same thing happens.

I really would like to know why all the variable that I defined as functions cannot be called later on. But I have to define them as functions because they are temperature dependent and I have to put "if" condition for them because the expression is different under different temperatures.

I would appreciate any help! Thank you very much!

Best regards, Shengyue Shan


2 Replies Last Post 27 lug 2018, 11:43 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 27 lug 2018, 04:48 GMT-4

Hi Shengyue,

When you use the function you define in the material properties are you specifying the dependent variable?

If your density is a function that you previously defined and is temperature depedent you have to use the_name_of_your_function(T) instead of just the_name_of_your_function

Hope this helps.

Best, Nichal

Hi Shengyue, When you use the function you define in the material properties are you specifying the dependent variable? If your density is a function that you previously defined and is temperature depedent you have to use the_name_of_your_function(T) instead of just the_name_of_your_function Hope this helps. Best, Nichal

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 27 lug 2018, 11:43 GMT-4

Hi Shengyue,

When you use the function you define in the material properties are you specifying the dependent variable?

If your density is a function that you previously defined and is temperature depedent you have to use the_name_of_your_function(T) instead of just the_name_of_your_function

Hope this helps.

Best, Nichal

Hi Nichal,

I know that you mentioned it in the last answer you gave to me, and I tried but it did not work. But today I tried it again and I figured out why! Because some of the functions that I used to define my material properties are also defined by another variables, so I have to add all the variables in the parentheses.

Thank you very much for your help!!!

Best regards, Shengyue Shan

>Hi Shengyue, > >When you use the function you define in the material properties are you specifying the dependent variable? > >If your density is a function that you previously defined and is temperature depedent you have to use the_name_of_your_function(T) instead of just the_name_of_your_function > >Hope this helps. > >Best, >Nichal Hi Nichal, I know that you mentioned it in the last answer you gave to me, and I tried but it did not work. But today I tried it again and I figured out why! Because some of the functions that I used to define my material properties are also defined by another variables, so I have to add all the variables in the parentheses. Thank you very much for your help!!! Best regards, Shengyue Shan

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.