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.
Units problem in functions (switching from COMSOL 4 to 5)
Posted 2018年1月20日 GMT-5 05:06 General, Parameters, Variables, & Functions Version 5.2 1 Reply
Please login with a confirmed email address before reporting spam
I've just switched from 4.2a to 5.2 and a quite complex PDE-based model that used to perfectly work on 4.2a, does not anymore. One first problem is a strange unit behaviour in analytical functions. I've always been very careful with that, and I can't understand what goes wrong in 5.2.
I can reproduce it from scratch very simply. The function, say f, I want to program is :
f(T) = 0.325 - 1e-3*(T-273)
where T is a temperature in K and f is dimensionless I create the analytical function f, setting the argument T in unit K, and the output unit to 1.
If I type the function expression as above, it stays black so no worry. But when using function f in the expression in another analytic function, the latter becomes orange with "Unexpected unit of input"
If I type as the expression of the function (as seems more rigorous)
0.325 - 1e-3[1/K]*(T-273[K])
it appears directly in orange with "Inconsistent unit" !!
I wonder what is inconsistent there...
If I define three parameters A to 1e-3[1/K] and B to 0.325 and T0 to 273[K] and type as expression :
B - A*(T-T0)
again orange with "Inconsistent unit"
Now the funniest thing : if I plot the function in all cases, guess what : the graph is OK in any case ! If someone could explain me the logic behind that, and marginally why did all this change from 4.2 to 5... Thank's very much.