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.

how to truncate a decimal number??

Please login with a confirmed email address before reporting spam

Hello,

I have a heat source that follows a circular path. When the angle alfa (alfa=omega*t, being "omega" the angular velocity and "t" the time in seconds) is greater than 360degrees (2*pi radians), I am having problems.
So I want to limit "alfa" between 0 and 360 degrees.
I have thought to create a new variable "n" which defines the number of turns that the heat source has already complete.

n=TRUNC((omega*t)/(2*pi))
alfa=(omega*t)*(n<1)+(omega*t-n*2*pi)*(n>=1)

But I can't find a function like "TRUNC" to get the whole part of a number. Is there any way to obtain the integer part of a decimal number in COMSOL??

Thanks,

Itxaso

2 Replies Last Post 12 juil. 2011, 07:35 UTC−4
Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 juil. 2011, 07:00 UTC−4
Hi,

Look for mathematical functions in the documentation: round, ceil, and floor functions are available to round to the closest integer, round up, and round down, respectively.

Best regards,
Magnus Ringh, COMSOL
Hi, Look for mathematical functions in the documentation: round, ceil, and floor functions are available to round to the closest integer, round up, and round down, respectively. Best regards, Magnus Ringh, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 juil. 2011, 07:35 UTC−4
than you very much!! "floor" was what I was looking for!!!
than you very much!! "floor" was what I was looking for!!!

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.