# How to create IntervalMesh with variable cell spacing

**URL:** https://fenicsproject.discourse.group/t/how-to-create-intervalmesh-with-variable-cell-spacing/4137
**Category:** mesh
**Created:** [September 22, 2020, 11:41am UTC](https://fenicsproject.discourse.group/t/how-to-create-intervalmesh-with-variable-cell-spacing/4137 "2020-09-22T11:41:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hugo\_sen](https://avatars.discourse-cdn.com/v4/letter/h/9dc877/32.png) [@hugo\_sen](https://fenicsproject.discourse.group/u/hugo_sen)
#### Post date: [September 22, 2020, 11:41am UTC](https://fenicsproject.discourse.group/t/how-to-create-intervalmesh-with-variable-cell-spacing/4137/1 "2020-09-22T11:41:03Z")

</div>

Hello,  
I want to create a UnitIntervalMesh but with two different mesh spacings. Such that from x=0 to 0.1 a smaller mesh spacing (0.0001) is used (1000 cells) and for the rest of 0.9 a larger spacing(0.0009) is used.  
What is the most efficient way for customized cell spacings such as in this case?  
I would really appreciate any guidance!

---

<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: [September 22, 2020, 11:52am UTC](https://fenicsproject.discourse.group/t/how-to-create-intervalmesh-with-variable-cell-spacing/4137/2 "2020-09-22T11:52:47Z")

</div>

See for instance: [Mesh refinement not working?](https://fenicsproject.discourse.group/t/mesh-refinement-not-working/3199/4)  
You could Also use the mesh editor, see: [https://bitbucket.org/fenics-project/dolfin/src/946dbd3e268dc20c64778eb5b734941ca5c343e5/python/test/unit/mesh/test\_mesh\_editor.py?at=master#test\_mesh\_editor.py-1,30](https://bitbucket.org/fenics-project/dolfin/src/946dbd3e268dc20c64778eb5b734941ca5c343e5/python/test/unit/mesh/test_mesh_editor.py?at=master#test_mesh_editor.py-1,30)
