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.

Implementing signed-distance function code directly inside Comsol

Please login with a confirmed email address before reporting spam

Good day,

Please, I need help:

I have this signed-distance function code and I need to implement it directly inside Comsol (please, note that I do not want to couple Comsol with Matlab), but I am having difficulty. How can I go about it? Thank you so much.

W=2;

H=1;

cx2 = W / 200 * [ 40 160 1 0 1 0 200 29 57.5 86 114.5 143 171.5 199 29 57.5 86 114.5 143 171.5 199 200 200 0 200 40 160];

cy2 = H / 100 * [ 0 0 25 50 75 100 25 25 25 25 25 25 25 25 75 75 75 75 75 75 75 50 100 80 80 100 100];

for i = 1 : length( cx2 )

tp( :, i ) = - sqrt ( ( x - cx2 ( i ) ) .^2 + ( y  - cy2 ( i ) ) .^2 ) +H/7.6;

end;

Phi2 = -(max(tp.')).';


1 Reply Last Post Jul 30, 2018, 9:11 a.m. EDT
Walter Frei COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago Jul 30, 2018, 9:11 a.m. EDT

Hello Samuel,

You may find this helpful: https://www.comsol.com/blogs/how-to-compute-distances-between-objects-in-comsol-multiphysics/

Hello Samuel, You may find this helpful: https://www.comsol.com/blogs/how-to-compute-distances-between-objects-in-comsol-multiphysics/

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.