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 creates more domains than that defined in mphtxt

Please login with a confirmed email address before reporting spam

I am trying to select the domains using matlab code.

I create a mphtxt file which has 3 domains from external software but when I import this mphtxt file to COMSOL, I get 4 domains in the selection lists.

Or are there any other methods could select the domians in Comsol consistent with the number of domains in mphtxt?



1 Reply Last Post 30 nov 2017, 06:31 GMT-5
Grigori Grozman COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 30 nov 2017, 06:31 GMT-5

Dear Wenbin.

In Comsol, we require mesh domains to be connected. That means, you must be able to walk between every pair of elements in a domain by passing from one element to another over a shared surface.

In the mesh file that you have attached, domain 2 consists of two connected parts. It is defined as follows:

7 8 9 6 # tetrahedron 4

10 11 8 5 # tetrahedron 5

9 12 6 8 # tetrahedron 6

9 6 12 3 # tetrahedron 7

Tetrahedra 4, 5 and 7 are connected to each other, while tetrahedron 5 is not connected to the others. Hence, Comsol splits domain 2 into two domains, assigning the unconnected tetrahedron 5 to a new domain.

We understand that this might be a problem if you want to use your original domain 2 in e.g. a physics interface. Then you need to select both domain 2 and domain 4. Which is not that complicated in this simple case, but could be hard in a complicated case where the original domain would be split into many domains.

In Comsol Multyphysics 5.3a, there is a possibility to import selections via mesh files. I have attached an edited version of your file to show you an example. The selection is defined by the following lines at the end of the file:

0 0 1

9 Selection # class

0 # Version

10 Explicit 1 # Label

7 sfemesh # Geometry/mesh tag

3 # Dimension

1 # Number of entities

2

This means selection named Explicit 1 is entity 2 of dimension 3 on mesh sfemesh, which is the unconnected domain 2. If you import the file, you will see that, although domain 2 is split by Comsol, the selection contains both of the new domains. You mat then use this selection in your physics interface instead of selecting all the individual domain.

I hope that would help you. Do not hesitate to ask additional questions.

Grigori Grozman

Dear Wenbin. In Comsol, we require mesh domains to be connected. That means, you must be able to walk between every pair of elements in a domain by passing from one element to another over a shared surface. In the mesh file that you have attached, domain 2 consists of two connected parts. It is defined as follows: > 7 8 9 6 # tetrahedron 4 > > 10 11 8 5 # tetrahedron 5 > > 9 12 6 8 # tetrahedron 6 > > 9 6 12 3 # tetrahedron 7 > Tetrahedra 4, 5 and 7 are connected to each other, while tetrahedron 5 is not connected to the others. Hence, Comsol splits domain 2 into two domains, assigning the unconnected tetrahedron 5 to a new domain. We understand that this might be a problem if you want to use your original domain 2 in e.g. a physics interface. Then you need to select both domain 2 and domain 4. Which is not that complicated in this simple case, but could be hard in a complicated case where the original domain would be split into many domains. In Comsol Multyphysics 5.3a, there is a possibility to import selections via mesh files. I have attached an edited version of your file to show you an example. The selection is defined by the following lines at the end of the file: > 0 0 1 > > 9 Selection # class > > 0 # Version > > 10 Explicit 1 # Label > > 7 sfemesh # Geometry/mesh tag > > 3 # Dimension > > 1 # Number of entities > > 2 This means selection named Explicit 1 is entity 2 of dimension 3 on mesh sfemesh, which is the unconnected domain 2. If you import the file, you will see that, although domain 2 is split by Comsol, the selection contains both of the new domains. You mat then use this selection in your physics interface instead of selecting all the individual domain. I hope that would help you. Do not hesitate to ask additional questions. Grigori Grozman

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.