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.

Material property (viscosity) function of two variables

Please login with a confirmed email address before reporting spam

Hi,

I am trying to create an interpolation function for my material for viscosity as a function of concentration and temperature. I have sucessfully made an excel file with three columns for concentration, temperature and viscosity (from actual experimental measurments) which I have imported into comsol. I plot it and it shows a correct surface plot. In the function name field I just write "mu". Under arguments it says column 1 and column 2. I write mol/m^3 under unit for column 1 and K under column 2. Under basic for the variable mu I then under exprssion write mu(c,T). It says "unexpected unit of input". I plot the value for mu by calling on the function under variables as root.comp1.mat6.def.mu and then plot this variable to look at viscosity changes in the domain, but it is not affected by the actual values I give for c and T. This worked fine for viscosity as a function of only c.

Please help, thanks.


4 Replies Last Post Apr 6, 2023, 5:02 a.m. EDT
Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 year ago Apr 5, 2023, 10:22 a.m. EDT

Hi Peter,

This should work. Have you defined the unit for mu as Pa*s? I guess so, so my other guess would be that the temperature T is not defined correctly. It is perhaps not a dependent variable in the simulation but could then be defined as a constant or variable with K as its unit. It would be easier to say what's going on if you posted a model file in this forum.

Best regards,

Magnus

Hi Peter, This should work. Have you defined the unit for mu as `Pa*s`? I guess so, so my other guess would be that the temperature T is not defined correctly. It is perhaps not a dependent variable in the simulation but could then be defined as a constant or variable with K as its unit. It would be easier to say what's going on if you posted a model file in this forum. Best regards, Magnus

Please login with a confirmed email address before reporting spam

Posted: 1 year ago Apr 5, 2023, 10:49 a.m. EDT
Updated: 1 year ago Apr 6, 2023, 6:11 a.m. EDT

Hi Magnus,

Thank you for your answer. I have defined the unit for mu as Pa * s, and as far as I can tell I have defined T correctly. I did the input in Kelvin and checked that it is indeed the right temperature in the domain by plotting it.

I posted the files now.

Hi Magnus, Thank you for your answer. I have defined the unit for mu as Pa * s, and as far as I can tell I have defined T correctly. I did the input in Kelvin and checked that it is indeed the right temperature in the domain by plotting it. I posted the files now.

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 year ago Apr 6, 2023, 2:38 a.m. EDT

Hi Peter,

The reason for this unit warning is that the model also includes a "speed of sound" material property c, which uses the same name as the dependent variable for the species concentration c. This property means that the c that you use as an input argument for the viscosity gets the unit m/s instead of the expected mol/m^3. In your case, you should be able to remove the speed of sound property, which I don't think is used in your model.

Best regards,

Magnus

Hi Peter, The reason for this unit warning is that the model also includes a "speed of sound" material property `c`, which uses the same name as the dependent variable for the species concentration `c`. This property means that the `c` that you use as an input argument for the viscosity gets the unit `m/s` instead of the expected `mol/m^3`. In your case, you should be able to remove the speed of sound property, which I don't think is used in your model. Best regards, Magnus

Please login with a confirmed email address before reporting spam

Posted: 1 year ago Apr 6, 2023, 5:02 a.m. EDT
Updated: 1 year ago Apr 6, 2023, 6:05 a.m. EDT

Hi Magnus,

Thank you so much for your answer. That seems to have been part of the problem as it now no longer says "unexpected unit of input". It now changes the viscosity correctly according to T, however it does not accept c as an argument, that is it always calculates mu as if c was set to 0, no matter what I give as input in the inflow under transport of diluted species. Any more advice?

Edit: Nevermind, it seems to work now. If anyone else has a similar problem the solution was to clear the section called "model input" under the basic tab under material.

Thanks again Magnus.

Hi Magnus, Thank you so much for your answer. That seems to have been part of the problem as it now no longer says "unexpected unit of input". It now changes the viscosity correctly according to T, however it does not accept c as an argument, that is it always calculates mu as if c was set to 0, no matter what I give as input in the inflow under transport of diluted species. Any more advice? Edit: Nevermind, it seems to work now. If anyone else has a similar problem the solution was to clear the section called "model input" under the basic tab under material. Thanks again Magnus.

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.