Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Need help in writing a function.

Please login with a confirmed email address before reporting spam

Hi, i am very new to comsol and i need help in writing a funtion

I have a phase change model and i need variable dynamic viscosity.

The variable dynamic viscosity is input as a piecewise, continuous, second derivative function as follows:
V=10^8 for T<303K
V=0.008 for t > 306K

How do i input as a function?
I would be glad if there is other place where i can learn how to write a function.
Thanks

Tim

3 Replies Last Post 05.11.2015, 21:58 GMT-5
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.12.2011, 10:21 GMT-5
Hi

I would propose to use an analytical function with a step function and use the "transition zone to go from one level to the next.

But another issue I see is the step size 10^8 to 10-2 which is 10 orders of magnitude change over 3 K temperature difference, I'm afraid you are demanding too much for the binary representation of numbers there, a regular slope of 3E9 : 1 is very tough.

Nevertheless try it, but I suspect some solver issues in view

--
Good luck
Ivar
Hi I would propose to use an analytical function with a step function and use the "transition zone to go from one level to the next. But another issue I see is the step size 10^8 to 10-2 which is 10 orders of magnitude change over 3 K temperature difference, I'm afraid you are demanding too much for the binary representation of numbers there, a regular slope of 3E9 : 1 is very tough. Nevertheless try it, but I suspect some solver issues in view -- Good luck Ivar

Lechoslaw Krolikowski

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.12.2011, 10:24 GMT-5
Hi,

You can use step function. See documentation, for instance, Introduction to Comsol Multiphysics v.4.1, pp. 30-32.

BR
Andrzej
Hi, You can use step function. See documentation, for instance, Introduction to Comsol Multiphysics v.4.1, pp. 30-32. BR Andrzej

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 05.11.2015, 21:58 GMT-5
Hi, Tim
Have you solved the problem? I come with the same problem with you.
I am a newer in comsol, I don't know how to deal with it.
Could you give me some help?
Howie,
Thanks!
Hi, Tim Have you solved the problem? I come with the same problem with you. I am a newer in comsol, I don't know how to deal with it. Could you give me some help? Howie, Thanks!

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.