# How to define boundary conditions on an irregular geometry?

**URL:** <https://fenicsproject.discourse.group/t/how-to-define-boundary-conditions-on-an-irregular-geometry/2240>\
**Category:** Uncategorized\
**Created:** [January 18, 2020, 1:31am UTC](https://fenicsproject.discourse.group/t/how-to-define-boundary-conditions-on-an-irregular-geometry/2240 "2020-01-18T01:31:29Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [January 18, 2020, 8:25am UTC](https://fenicsproject.discourse.group/t/how-to-define-boundary-conditions-on-an-irregular-geometry/2240/2 "2020-01-18T08:25:28Z")

</div>

For more complicated geometries , its common to use external software, like [gmsh](http://gmsh.info/)/[pygmsh](https://pypi.org/project/pygmsh/). With these softwares, you can set physical markers for cells snd facets, Which can be loaded into dolfin as described here:

> [@Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio](https://fenicsproject.discourse.group/t/transitioning-from-mesh-xml-to-mesh-xdmf-from-dolfin-convert-to-meshio/412/3):
>
> This can be done using meshio and writing the explicit data to xdmf file. import meshio msh = meshio.read("test.msh") meshio.write("mesh.xdmf", meshio.Mesh(points=msh.points, cells={"tetra": msh.cells["tetra"]})) meshio.write("mf.xdmf", meshio.Mesh(points=msh.points, cells={"triangle": msh.cells["triangle"]}, cell\_data={"triangle": {"name\_to\_read": msh.cell\_data["triangle"]["gmsh:physical"]}})) from dolfin import \* mesh = Mesh() with XDMFFile("mesh.xdmf") …

---

_[View the full topic](https://fenicsproject.discourse.group/t/how-to-define-boundary-conditions-on-an-irregular-geometry/2240)._
