# Defining electrical properties for different regions from gmsh

**URL:** <https://community.freefem.org/t/defining-electrical-properties-for-different-regions-from-gmsh/807>\
**Category:** General Discussion\
**Created:** [February 15, 2021, 1:56pm UTC](https://community.freefem.org/t/defining-electrical-properties-for-different-regions-from-gmsh/807 "2021-02-15T13:56:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nia](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@nia](https://community.freefem.org/u/nia)\
**Post date:** [February 15, 2021, 1:56pm UTC](https://community.freefem.org/t/defining-electrical-properties-for-different-regions-from-gmsh/807/1 "2021-02-15T13:56:59Z")

</div>

Hello colleagues

I have imported a 3D mesh from gmsh with different physical volumes inside it in freefem, all are imported in one mesh.  
I need to define different epsilon on each region. I can get my physical volumes tages by command

`fespace Ph(Th, P1); Ph reg = region; plot(reg); real[int] tags; Unique(reg[], tags); cout << "tags"<<tags << endl;`

May you suggest me a command so to define epsilons for each region based on physical volumes tags?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![henkel](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@henkel](https://community.freefem.org/u/henkel)\
**Post date:** [February 21, 2021, 10:40pm UTC](https://community.freefem.org/t/defining-electrical-properties-for-different-regions-from-gmsh/807/2 "2021-02-21T22:40:37Z")

</div>

You’ve probably already figured it out, but if you’re still looking for an answer (untested code):

```
fespace V0(Th, P0);

// region tags
int air1 = 3;
int porcelain1 = 4;
int air2 = 5;

real eps0 = 8.8541878128e-12;
real epsr_air = 1.00059;
real epsr_porcelain = 4;

V0 eps = eps0 * ( epsr_air *(region == air1 || region == air2) +
                epsr_porcelain * (region == porcelain1) );
```

---

<div class="post-metadata">

**Author:** ![nia](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@nia](https://community.freefem.org/u/nia)\
**Post date:** [February 23, 2021, 10:33am UTC](https://community.freefem.org/t/defining-electrical-properties-for-different-regions-from-gmsh/807/3 "2021-02-23T10:33:04Z")

</div>

> [@henkel](#):
>
> `8.8541878128e-12`

Thanks alot for your response,

So eps considers separate permittivity of each region?
