# Boundary condition in Trixi with imported mesh with P4estmesh()

**URL:** <https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528>\
**Category:** Modelling & Simulations\
**Created:** [July 2, 2024, 2:18pm UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528 "2024-07-02T14:18:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelian\_Renoux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kelian_renoux/32/210410_2.png) [@Kelian\_Renoux](https://discourse.julialang.org/u/Kelian_Renoux)\
**Post date:** [July 2, 2024, 2:18pm UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528/1 "2024-07-02T14:18:50Z")

</div>

Hello, i have a special case in Trixi where I want to use boundary conditions with a mesh imported via GMSH, i was wondering if it was possible with a Trixi function ?  
Thanks

---

<div class="post-metadata">

**Author:** ![DanDoe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dandoe/32/52717_2.png) [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Post date:** [July 5, 2024, 9:41am UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528/2 "2024-07-05T09:41:24Z")

</div>

Hi,

So in principle this is possible, yes. See our documentation:  
[Tutorial](https://trixi-framework.github.io/Trixi.jl/stable/tutorials/p4est_from_gmsh/) and detailed [instructions](https://trixi-framework.github.io/Trixi.jl/stable/meshes/p4est_mesh/#Standard-Abaqus-format-boundary-information).

There are a couple things required to make this work, however.

1. We support only linear quad/hex meshes. Support for higher-order elements is desired, see the [corresponding issue](https://github.com/trixi-framework/Trixi.jl/issues/1847). Other element types are yet somewhat further away, as `p4est` supports only quads/hexes.
2. The boundary information is constructed based on the `NSET` information. So when exporting a mesh to `.inp` you need to select the `Export all node` options.
3. To ensure correct export of the `.msh` via `Gmsh` to `.inp` you should set the geometric/elementary element ID to the physical ID (see `number-of-tags` of this [documentation](http://www.manpagez.com/info/gmsh/gmsh-2.2.6/gmsh_63.php))

---

<div class="post-metadata">

**Author:** ![sloede](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sloede/32/44787_2.png) [@sloede](https://discourse.julialang.org/u/sloede)\
**Post date:** [July 5, 2024, 10:23am UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528/3 "2024-07-05T10:23:16Z")

</div>

To briefly expand on @DanDoe’s answer: If you need support for higher-order quad/hex meshes, you could also look at [GitHub - trixi-framework/HOHQMesh.jl: HOHQMesh.jl is a Julia wrapper for the HOHQMesh mesh generator, which allows to produce curved quadrilateral and hexahedral meshes for high-order numerical simulations.](https://github.com/trixi-framework/HOHQMesh.jl). If your mesh needs to be generated in Gmsh, then this is not an option, though.

---

<div class="post-metadata">

**Author:** ![Kelian\_Renoux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kelian_renoux/32/210410_2.png) [@Kelian\_Renoux](https://discourse.julialang.org/u/Kelian_Renoux)\
**Post date:** [July 5, 2024, 1:17pm UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528/4 "2024-07-05T13:17:56Z")

</div>

Thank you ! My case is working but It seems that periodic boundary conditions are not supported ? Is this the case for imported mesh with GMSH ?

---

<div class="post-metadata">

**Author:** ![DanDoe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dandoe/32/52717_2.png) [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Post date:** [July 5, 2024, 1:32pm UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528/5 "2024-07-05T13:32:16Z")

</div>

Yes, that is correct, as periodic conditions for unstructured meshes are not trivially done as the cells at the right end of the domain have no connectivity whatsoever with the cells on the left (for instance).

Outflow/Inflow should work, however. So if you know what your solution looks like, you could try to do this via these boundary conditions.

---

<div class="post-metadata">

**Author:** ![Kelian\_Renoux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kelian_renoux/32/210410_2.png) [@Kelian\_Renoux](https://discourse.julialang.org/u/Kelian_Renoux)\
**Post date:** [July 5, 2024, 1:39pm UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528/6 "2024-07-05T13:39:41Z")

</div>

Alright ! Thanks a lot !

---

<div class="post-metadata">

**Author:** ![DanDoe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dandoe/32/52717_2.png) [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Post date:** [July 5, 2024, 2:29pm UTC](https://discourse.julialang.org/t/boundary-condition-in-trixi-with-imported-mesh-with-p4estmesh/116528/7 "2024-07-05T14:29:35Z")

</div>

Sure, happy to help!
