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.

COMSOL with MATLAB, Domain number assignment incorrect

Please login with a confirmed email address before reporting spam

Hi all,

I am working on a permanent magnet or Halbach array simulation. I created a 3D model in COMSOL and saved it as MATLAB file. The magnets are rectangular blocks and now I wanted to include discrete rotations and slight motions in order to simulate the different magnetic field configurations in the centre. If I use the MATLAB code, I noticed that for material properties domain numbers are assigned not visible in COMSOL. For instance, as illustration, Magnet 24 in array A has the domain number 135. Again it was assigned by COMSOL and I don't know how it was done. This domain number is used to assign to magnetic properties to this particular magnet 24 in array A. However, if I rearrange the magnets even slightly, Magnet 24 in array A has a different domain number, and the magnetic properties (which is connected to the domain number) is incorrect.
Does anyone have a similar problem, or any idea how to assign a domain number to the object?

Regards
Michael

4 Replies Last Post 21 nov. 2016, 10:31 UTC−5

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 17 nov. 2016, 19:12 UTC−5
Correction,

of course the domain number can be seen in the list. What I meant was, how does COMSOL assign the domain numbers to the different objects? I noticed that the numbers increase from left to right and I have the suspicion that it like a scan with the first object assigned number 1 and so on. This is a huge problem for me since a slight rotation/translation of one of the magnets lead to the wrong domain number. Does anyone know how the number assignment works?

Regards
Michael
Correction, of course the domain number can be seen in the list. What I meant was, how does COMSOL assign the domain numbers to the different objects? I noticed that the numbers increase from left to right and I have the suspicion that it like a scan with the first object assigned number 1 and so on. This is a huge problem for me since a slight rotation/translation of one of the magnets lead to the wrong domain number. Does anyone know how the number assignment works? Regards Michael

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 18 nov. 2016, 08:24 UTC−5
Hi Michael

You should consider the numbering of entities (domains, boundaries, edges and points) to be secret, internal and subject to change. Instead of guessing these number you can get the information in other ways.

I written some blog posts about this topic:
www.comsol.com/blogs/manually-work-entity-numbers-selections/



Correction,

of course the domain number can be seen in the list. What I meant was, how does COMSOL assign the domain numbers to the different objects? I noticed that the numbers increase from left to right and I have the suspicion that it like a scan with the first object assigned number 1 and so on. This is a huge problem for me since a slight rotation/translation of one of the magnets lead to the wrong domain number. Does anyone know how the number assignment works?

Regards
Michael





--
Lars Gregersen
Comsol Denmark
Hi Michael You should consider the numbering of entities (domains, boundaries, edges and points) to be secret, internal and subject to change. Instead of guessing these number you can get the information in other ways. I written some blog posts about this topic: https://www.comsol.com/blogs/manually-work-entity-numbers-selections/ [QUOTE] Correction, of course the domain number can be seen in the list. What I meant was, how does COMSOL assign the domain numbers to the different objects? I noticed that the numbers increase from left to right and I have the suspicion that it like a scan with the first object assigned number 1 and so on. This is a huge problem for me since a slight rotation/translation of one of the magnets lead to the wrong domain number. Does anyone know how the number assignment works? Regards Michael [/QUOTE] -- Lars Gregersen Comsol Denmark

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 20 nov. 2016, 18:47 UTC−5
Hi Lars,

thanks for the reply, however, my problem is not related to the domain numbering as such. My problem is related that the domain (=magnet) number internally allocated by COMSOL changes when I rearrange the domain with respect to other magnets (domains). So the question is whether I can ASSIGN a domain number to a particular object permanently.

Regards
Michael
Hi Lars, thanks for the reply, however, my problem is not related to the domain numbering as such. My problem is related that the domain (=magnet) number internally allocated by COMSOL changes when I rearrange the domain with respect to other magnets (domains). So the question is whether I can ASSIGN a domain number to a particular object permanently. Regards Michael

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 21 nov. 2016, 10:31 UTC−5
Hi Michael

You can't assign domain numbers, but you can use selections as described here:
www.comsol.com/blogs/automatically-handling-selections-comsol-multiphysics/

If you can't make your script work you are welcome to send it to support.


Lars



Hi Lars,

thanks for the reply, however, my problem is not related to the domain numbering as such. My problem is related that the domain (=magnet) number internally allocated by COMSOL changes when I rearrange the domain with respect to other magnets (domains). So the question is whether I can ASSIGN a domain number to a particular object permanently.

Regards
Michael





--
Lars Gregersen
Comsol Denmark
Hi Michael You can't assign domain numbers, but you can use selections as described here: https://www.comsol.com/blogs/automatically-handling-selections-comsol-multiphysics/ If you can't make your script work you are welcome to send it to support. Lars [QUOTE] Hi Lars, thanks for the reply, however, my problem is not related to the domain numbering as such. My problem is related that the domain (=magnet) number internally allocated by COMSOL changes when I rearrange the domain with respect to other magnets (domains). So the question is whether I can ASSIGN a domain number to a particular object permanently. Regards Michael [/QUOTE] -- Lars Gregersen Comsol Denmark

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.