# Error importing weight field file

**URL:** <https://root-forum.cern.ch/t/error-importing-weight-field-file/47896>\
**Category:** Garfield++\
**Created:** [December 1, 2021, 7:57am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896 "2021-12-01T07:57:53Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [December 1, 2021, 7:57am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/1 "2021-12-01T07:57:53Z")

</div>

hello , When I try to import the weight field file obtained from comsol, the error message in the figure below always appears. I did it again many times, the result is still like this.!

 ![error message](https://root-forum.cern.ch/uploads/default/original/3X/a/9/a9a774c29cf446a0481a6b1870c5c83861bb1119.jpeg)  
WPOT.txt is the electric potential (V) distribution file  
WPOT1.txt is the electric field (V/m) distribution file  
The file is relatively large, so it is compressed using compression software (360zip)  
[WPOT.zip](https://root-forum.cern.ch/uploads/short-url/y6x020sLMCSxUDBRNAC0ACDBAhC.zip) (501.2 KB)  
[WPOT1.zip](https://root-forum.cern.ch/uploads/short-url/sE0PIVtbDkBMhgczKMJgQGZce45.zip) (674.6 KB)

---

<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:** [December 1, 2021, 8:29am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/2 "2021-12-01T08:29:34Z")

</div>

Can you attach the file (WPOT1.txt)?

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [December 1, 2021, 9:58am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/3 "2021-12-01T09:58:38Z")

</div>

hello, I just uploaded the WPOT.txt file.

---

<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:** [December 1, 2021, 6:33pm UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/4 "2021-12-01T18:33:09Z")

</div>

Dear changjh12,

A change of the SetWeightingField function has been pushed to the repository. I would be curious to know if this solves your problem. If not, please let me know.

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [December 3, 2021, 8:14am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/5 "2021-12-03T08:14:50Z")

</div>

Dear djjansse  
Unfortunately, the same error message still appears.

---

<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:** [December 3, 2021, 8:27am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/6 "2021-12-03T08:27:48Z")

</div>

Dear Changjh12,

Thank you for coming back to me. In that case could you provide me with the files containing the code, mesh information and dielectric constants? This will allow me to run it in full.

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [December 3, 2021, 10:30am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/7 "2021-12-03T10:30:05Z")

</div>

[dielectrics.zip](https://root-forum.cern.ch/uploads/short-url/svZ0J0xuS3ylEu6iG89yspVVWgu.zip) (191 Bytes)  
[mesh.zip](https://root-forum.cern.ch/uploads/short-url/rFB2i2tRpZFKU0wZydNYyojxj8q.zip) (1.5 MB)  
[field.zip](https://root-forum.cern.ch/uploads/short-url/i0ALcMnrPrYrpuOuiaLpGpwFvPe.zip) (501.2 KB)  
[sdj.C](https://root-forum.cern.ch/uploads/short-url/1S4qM8EqAqNDQzOpbscZ8voyEBp.C) (7.6 KB)  
[WPOT1.zip](https://root-forum.cern.ch/uploads/short-url/12KsaiZ7y7lXDKEIiBwO1WPaKP8.zip) (674.6 KB this is WeightingField file）  
[WPOT.zip](https://root-forum.cern.ch/uploads/short-url/4COj6fqgktuwGcztv9z4Lar3G1A.zip) (501.2 KB This is a weight potential file)

Hello ，Here are all the documents, thank you

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [December 13, 2021, 2:52am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/8 "2021-12-13T02:52:04Z")

</div>

Hello ,Dear djjansse.  
Have you found the cause of the error? I tried to make changes, but the same error message is still displayed so far. I really don’t know what to do.  
If you find the reason, please tell me, thank you!

---

<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:** [December 13, 2021, 7:52am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/9 "2021-12-13T07:52:26Z")

</div>

Dear changjh12,

My apologies for my late reply. I have run your code and everything seems to be working as intended on my end. That is, the ComponentComsol error message has disappeared, the weighting field is imported and the code runs until the end. Do you still have the “Error parsing WPOT1.txt” message?

Kind regards,

Djunes Janssens

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [December 14, 2021, 2:08am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/10 "2021-12-14T02:08:51Z")

</div>

Thank you for your reply. Yes, the error message still exists. Maybe it’s because of the software version? I think I may need to reinstall the software?

---

<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:** [December 14, 2021, 7:24am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/11 "2021-12-14T07:24:32Z")

</div>

Dear changjh12,

Yes, you should pull the newest version from git (execute “git pull” in the Garfield++ folder) and then rebuild the code as instructed in the installation guide. Let me know if this solves it.

Kind regards,

Djunes

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [December 16, 2021, 6:46am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/12 "2021-12-16T06:46:36Z")

</div>

Dear djjansse

I reinstalled the software and the files can be imported normally.  
Thank you very much for your help.

---

<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:** [December 30, 2021, 6:47am UTC](https://root-forum.cern.ch/t/error-importing-weight-field-file/47896/13 "2021-12-30T06:47:31Z")

</div>

Closed on December 30, 2021, 6:47am UTC

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