# How to write a Boundary Condition in Elmer Field Calculation

**URL:** <https://root-forum.cern.ch/t/how-to-write-a-boundary-condition-in-elmer-field-calculation/50879>\
**Category:** Garfield++\
**Created:** [July 20, 2022, 3:16pm UTC](https://root-forum.cern.ch/t/how-to-write-a-boundary-condition-in-elmer-field-calculation/50879 "2022-07-20T15:16:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [July 20, 2022, 3:16pm UTC](https://root-forum.cern.ch/t/how-to-write-a-boundary-condition-in-elmer-field-calculation/50879/1 "2022-07-20T15:16:27Z")

</div>

Dear Experts

I’m not sure if this is related to Garfield++, I got a problem when tried to calculate electric field map for Garfield++ by ElmerSolver. In the `.sif` file, `Boundary Condition` section, I don’t know how to set the boundary properly. I mean, how can I set the specific wire to a potential? I found there are hundreds of boundary elements in `mesh.boundary`…how to find a specific wire’s surface to set the boundary condition?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [July 20, 2022, 3:21pm UTC](https://root-forum.cern.ch/t/how-to-write-a-boundary-condition-in-elmer-field-calculation/50879/2 "2022-07-20T15:21:22Z")

</div>

I think @hschindl can help you.

---

<div class="post-metadata">

**Author:** ![jrenner](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@jrenner](https://root-forum.cern.ch/u/jrenner)\
**Post date:** [July 22, 2022, 9:26am UTC](https://root-forum.cern.ch/t/how-to-write-a-boundary-condition-in-elmer-field-calculation/50879/3 "2022-07-22T09:26:55Z")

</div>

The elements of each boundary should be assigned the same identifier, which is what should be used in the “Boundary Condition” block under “Target Boundaries”. This identifier is the 2nd number in each row in mesh.boundary.

For example, if the mesh was made with Gmsh and then converted to Elmer, this identifier is the ID of the physical surface (or physical curve for a 2D mesh) corresponding to that boundary. If converted to Elmer format using the “-autoclean” flag, these IDs are renumbered starting at 1.

It won’t allow me to place a link in this post, but I have some example code (a Jupyter notebook) that you could use as a guide (if I Google “garfieldfem github” it is the first link for me). The section “1. 2D wire example” shows how to construct a 2D mesh for a single wire using Gmsh and convert it to Elmer format. In the .sif file, a potential of 0V is placed on the enclosing boundary and some chosen voltage (1000V for example) on the wire.

---

<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:** [August 5, 2022, 9:27am UTC](https://root-forum.cern.ch/t/how-to-write-a-boundary-condition-in-elmer-field-calculation/50879/4 "2022-08-05T09:27:30Z")

</div>

Closed on August 5, 2022, 9:27am UTC

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