# Problems about loading comsol files

**URL:** <https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944>\
**Category:** Garfield++\
**Created:** [May 19, 2023, 6:57am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944 "2023-05-19T06:57:21Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 6:57am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/1 "2023-05-19T06:57:21Z")

</div>

I want to import the mesh file solved by comsol, but encountered the following problems  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/1/d/1db14064c3beeebba5cb4fa0c34bbbee9b3f4106.png)  
This is my code

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/0/c/0cb8a3584cbf9135ada969e3ba926a0f6b5e375d.png)

This is my model

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/3/c/3c87bfc060ff55e1425a33384b55b3c5372cfa99.png)  
I have tried to reinstall Garfield + +, but it still doesn 't work.  
Can you give me some advice？

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 7:02am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/2 "2023-05-19T07:02:48Z")

</div>

These are the files solved by comsol  
[mesh\_CZT\_anode0cathode-600.zip](https://root-forum.cern.ch/uploads/short-url/n396QvIoan0H4GQ5hoDlS9dQx1e.zip) (1.1 MB)  
[mplist.txt](https://root-forum.cern.ch/uploads/short-url/4jKo7Z1FQSIbCM4syP0U8cy7Fro.txt) (12 Bytes)  
[potential\_CZT\_anode0cathode-600.txt](https://root-forum.cern.ch/uploads/short-url/vhmPyfAlBa1GYABy6aRyf3rxOuR.txt) (1.8 MB)

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [May 19, 2023, 8:01am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/3 "2023-05-19T08:01:40Z")

</div>

Dear @zql21 ,

Maybe @hschindl can help you here.

Cheers,  
Vincenzo

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 9:02am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/4 "2023-05-19T09:02:36Z")

</div>

I located the mistake here, but I still don 't know how to solve it

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/3/d/3d9ad252a86fad3f434d3785aaf17de4f447683b.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 19, 2023, 9:05am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/5 "2023-05-19T09:05:36Z")

</div>

@djjansse could you take a look?

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [May 19, 2023, 10:49am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/6 "2023-05-19T10:49:38Z")

</div>

Dear @zql21,

Can it be that the mesh elements of the exported tetrahedral mesh are not second? Currently, the _ComponentComsol_ class only accepts second order tetrahedral meshes.

Kind regards,

Djunes

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 11:22am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/7 "2023-05-19T11:22:23Z")

</div>

Thank you for your reply！  
Could you tell me where to set the order of the tetrahedral meshes in comsol?  
I don’t know the order of the tetrahedron meshes in my programme

> [@djjansse](#):
>
> Dear @zql21,
> 
> Can it be that the mesh elements of the exported tetrahedral mesh are not second? Currently, the _ComponentComsol_ class only accepts second order tetrahedral meshes.
> 
> Kind regards,
> 
> Djunes

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 11:29am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/8 "2023-05-19T11:29:04Z")

</div>

![image](https://root-forum.cern.ch/uploads/default/original/3X/7/0/70f8c5ad2cec4d6e68e2a1bba3a9b386ec6cfbb7.jpeg)

the mesh setting of comsol is shown in the figure.

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [May 19, 2023, 12:01pm UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/9 "2023-05-19T12:01:24Z")

</div>

Dear @zql21,

You will find it under the settings of the physics interface (most likely the Electrostatic module in your case), called _Discretization_ which should be on _Quadratic_. Then, for the exporting of the mesh and data, the _Select resolution_ option should be set to _Custom_ while _Select Lagrange order_ ought to be on _2_, as laid out in [this Garfield++ example](https://garfieldpp.web.cern.ch/garfieldpp/examples/comsol/).

Kind regard,

Djunes

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 12:32pm UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/10 "2023-05-19T12:32:38Z")

</div>

The Discretization setting is originally on Quadratic.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/1/b/1bfea5c648378704c4efacfe136f3bd3735dfe74.png)  
I change the export setting,but still can’t load the mesh file.  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/a/6/a6d99f243d065e643e302e74dae318293521f8b4.png)

![image](https://root-forum.cern.ch/uploads/default/original/3X/f/4/f49b82f66b8e561373d648dfd2778813419ff3ab.png)

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [May 19, 2023, 12:50pm UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/11 "2023-05-19T12:50:56Z")

</div>

Dear @zql21,

Interesting. Could you send me the newly exported files and code so I can take a closer look?

Kind regards,

Djunes

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 1:11pm UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/13 "2023-05-19T13:11:05Z")

</div>

> [@djjansse](#):
>
> Dear @zql21,
> 
> Interesting. Could you send me the newly exported files and code so I can take a closer look?
> 
> Kind regards,
> 
> Djunes

Here are my codes and solution data  
[CZT01.zip](https://root-forum.cern.ch/uploads/short-url/5rD5DdoMDpndDH9YjsFH9V9KOjp.zip) (2.1 MB)  
[mesh\_CZT\_anode0cathode-600.zip](https://root-forum.cern.ch/uploads/short-url/4GDMmAHIiU9dTwRzLNY0bHZdt3L.zip) (191.5 KB)  
[mplist.txt](https://root-forum.cern.ch/uploads/short-url/b5WSYZARfF9zHh3RnHjbIscEjnA.txt) (13 Bytes)  
[potential\_CZT\_anode0cathode-600.zip](https://root-forum.cern.ch/uploads/short-url/etDdMfV4p4THsQDRkY9SV9keD4N.zip) (735.2 KB)

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 19, 2023, 3:01pm UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/14 "2023-05-19T15:01:09Z")

</div>

I checked the code and found something that puzzled me.  
The mesh file I exported contains ‘3 tet # type name’ ,

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/5/e/5effeb128d6b7faf4b11ea8875699f8efa555d76.png)

However, in ComponentComsol.cc is “4 tet2 # type name”

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/7/e/7ecb3afc946e7ec40c4553db606b6c67f2fb4dea.png)  
I don 't know the difference between ‘3 tet # type name’ and “4 tet2 # type name”  
Run the code, get the following result  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/2/c/2cdf49b07cfb628ed5a9a4ef06e3ca6398fde067.png)

In addition, if I change ‘3 tet # type name’ to “4 tet2 # type name” in my mesh file.Then run the code,  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/7/f/7fd2484838e89f17989a84382762a0bcd28b94c6.png)

I did a simple test and found that the bug seems to be happening here, but I don 't know how to fix it.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/3/e/3e8cf805eeefe0e322a749e6c496ec98a511a1ba.png)

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [May 20, 2023, 5:57am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/15 "2023-05-20T05:57:08Z")

</div>

Dear @djjansse  
Can you load mesh file correctly? Have you found what caused this bug?  
Looking forward to your reply.  
Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [June 3, 2023, 9:10am UTC](https://root-forum.cern.ch/t/problems-about-loading-comsol-files/54944/17 "2023-06-03T09:10:43Z")

</div>

Closed on June 3, 2023, 9:10am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
