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.

Geometry definitions

Please login with a confirmed email address before reporting spam

Hi,

I have been having a funny issue lately.

I have defined a variable called 'angle' as the arcsin of the ratio of y over the radius of a circle: angle=asin(y/radius)

Whenever I ask to plot sin(angle) everything works fine but when I ask to plot cos(angle) I get a funny result.

I did find a workaround but I suspect this may be due to a bug in the way Comsol handles geometry definitions.

Any idea? Especially mr Ivar who seems to be quite deep into geometry modifications and such?

Cheers

7 Replies Last Post 6 mai 2011, 14:52 UTC−4
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 6 mai 2011, 09:16 UTC−4
Hi

I do not see why it does not work so long radius is different from "0". Perhaps you could use atan2(y,x) instead of the asin() (OK so long x is different from "0").

Again it depends where you apply your variable/equation as if you define it on an edge or surface passing by x=y=radius=0 you might have an issue

--
Good luck
Ivar
Hi I do not see why it does not work so long radius is different from "0". Perhaps you could use atan2(y,x) instead of the asin() (OK so long x is different from "0"). Again it depends where you apply your variable/equation as if you define it on an edge or surface passing by x=y=radius=0 you might have an issue -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 6 mai 2011, 09:24 UTC−4
Hi,

Thanks for the reply. But no I do not define the variable anywhere close the origin. Actually, the circle is centered in (0,0) so that guarantees no singularity.

I am afraid what you said just confirmed my suspicions: it does seem to be a bug.

Please look at the picture I attached and you will see what I mean by funny behaviour!

Thanks again for the reply.

Cheers
Hi, Thanks for the reply. But no I do not define the variable anywhere close the origin. Actually, the circle is centered in (0,0) so that guarantees no singularity. I am afraid what you said just confirmed my suspicions: it does seem to be a bug. Please look at the picture I attached and you will see what I mean by funny behaviour! Thanks again for the reply. Cheers


Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 6 mai 2011, 10:51 UTC−4
Asin returns a value between -pi/2 and +pi/2, so the cos of that is always positive. What's so surprising?
Asin returns a value between -pi/2 and +pi/2, so the cos of that is always positive. What's so surprising?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 6 mai 2011, 11:11 UTC−4
Hi,

Thanks! So that was the rub! Well, I would say that is surprising that you don't get that mentioned in the definition of asin in the Comsol Local help, where they state:

asin inverse sine asin(x)

under 'Mathematical functions'

So a little more explaining would be in order for the next edition of the Local help, because it is definitely counter-intuitive to have to imagine that you asin is limited between -pi and +pi...

One more question then, what are the boundaries for atan? (Again it is not explicitly stated) 0 and pi? -pi and 0?

Hi, Thanks! So that was the rub! Well, I would say that is surprising that you don't get that mentioned in the definition of asin in the Comsol Local help, where they state: asin inverse sine asin(x) under 'Mathematical functions' So a little more explaining would be in order for the next edition of the Local help, because it is definitely counter-intuitive to have to imagine that you asin is limited between -pi and +pi... One more question then, what are the boundaries for atan? (Again it is not explicitly stated) 0 and pi? -pi and 0?

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 6 mai 2011, 11:27 UTC−4
That's the usual definition of arcsin, see for instance Wikipedia: en.wikipedia.org/wiki/Inverse_trigonometric_functions
That's the usual definition of arcsin, see for instance Wikipedia: http://en.wikipedia.org/wiki/Inverse_trigonometric_functions

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 6 mai 2011, 11:31 UTC−4
Awesome, but we purchased Comsol and not Wikipedia.

I am curious why standard? I am sorry but as a mathematician-engineer such a definition does not make much sense, whenever I solve for an ODE or a PDE I don't think an inverse trigonometric function is usually defined between two angles.

At any rate atan is then limtied between -pi/2 and pi/2?
Awesome, but we purchased Comsol and not Wikipedia. I am curious why standard? I am sorry but as a mathematician-engineer such a definition does not make much sense, whenever I solve for an ODE or a PDE I don't think an inverse trigonometric function is usually defined between two angles. At any rate atan is then limtied between -pi/2 and pi/2?

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 6 mai 2011, 14:52 UTC−4
Hi

the easiest is to test it out with the analytical function functionality (and plot otion) og V4.

test also atan2(,) I believe its defined for a "full turn"

again this is ususal math definitions. In the function definitions you have ways to make them periodic again

--
Good luck
Ivar
Hi the easiest is to test it out with the analytical function functionality (and plot otion) og V4. test also atan2(,) I believe its defined for a "full turn" again this is ususal math definitions. In the function definitions you have ways to make them periodic again -- Good luck Ivar

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.