Why does COMSOL consistently enforce smoothing in 2D surface rendering?

Please login with a confirmed email address before reporting spam

Lately, I've been utilizing the atan2 function to represent the azimuthal angle of a vector. I've noticed that the atan2(Y,X) function performs well even when Y is close to zero. However, when employing a cyclic color table to visualize the azimuthal angle ranging from -180 degrees to +180 degrees, the 2D surface tool renders the abrupt transition from -180 degrees to +180 degrees as a gradual transition in between. To elaborate further, originally, it should display as a single red color according to the cyclic color table, but it consistently appears as a rainbow color in the transition zone. How can I address this issue? An example file is also provided.



2 Replies Last Post Feb 19, 2024, 1:02 p.m. EST
Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 months ago Feb 19, 2024, 5:07 a.m. EST

The problem is that when you evaluate in the mesh nodes that are exactly at Y=0, the result must be either +180 or -180. Inside one of the adjacent elements (either up or down) there will then be an apparent gradient of almost 360 degrees.

You can avoid this artefact by evaluating inside the elements, for example by using an expression like gpeval(4,atan2(Y,X)/pi*180)

-------------------
Henrik Sönnerlind
COMSOL
The problem is that when you evaluate in the mesh nodes that are exactly at Y=0, the result must be either +180 or -180. Inside one of the adjacent elements (either up or down) there will then be an apparent gradient of almost 360 degrees. You can avoid this artefact by evaluating inside the elements, for example by using an expression like gpeval(4,atan2(Y,X)/pi\*180)

Please login with a confirmed email address before reporting spam

Posted: 2 months ago Feb 19, 2024, 1:02 p.m. EST
Updated: 2 months ago Feb 19, 2024, 1:02 p.m. EST

Dear Henrik,

Thank you for your valuable professional input regarding the gpeval function.

Dear Henrik, Thank you for your valuable professional input regarding the gpeval function.

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

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.