Discussion ClosedThis 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.

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 2024年2月19日 GMT+1 19:02
Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 months ago 2024年2月19日 GMT+1 11:07

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: 6 months ago 2024年2月19日 GMT+1 19:02
Updated: 6 months ago 2024年2月19日 GMT+1 19:02

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.

Note that while COMSOL employees may participate in the discussion forum, COMSOL®software users who are on-subscription should submit their questions via theSupport Centerfor a more comprehensive response from the Technical Support team.

Baidu
map