# Add a spatial parameter field

**URL:** <https://community.freefem.org/t/add-a-spatial-parameter-field/1997>\
**Category:** General Discussion\
**Created:** [September 9, 2022, 3:27pm UTC](https://community.freefem.org/t/add-a-spatial-parameter-field/1997 "2022-09-09T15:27:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mchetoui](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mchetoui](https://community.freefem.org/u/mchetoui)\
**Post date:** [September 9, 2022, 3:27pm UTC](https://community.freefem.org/t/add-a-spatial-parameter-field/1997/1 "2022-09-09T15:27:54Z")

</div>

Hello everyone,

I have to use a spatial distribution to define a parameter of my equation. For example for a 2D Darcy equation, the permeability is not constant, it is defined in a text file according to the spatial coordinates X and Y.  
Is it possible to import this file and use it as a permeability in the equation weak form? If it is possible, the X Y coordinates of the file and the mesh nodes coordinates should be mixed up or we can use any X Y grid and Freefem will interpolate it?

Thank you.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [September 9, 2022, 3:35pm UTC](https://community.freefem.org/t/add-a-spatial-parameter-field/1997/2 "2022-09-09T15:35:33Z")

</div>

Yes Thérese is an exemple to build this see of this example

> <https://github.com/FreeFem/FreeFem-sources/blob/master/examples/tutorial/dumptable.edp>

To buil a mesh and thé function.

---

<div class="post-metadata">

**Author:** ![mchetoui](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mchetoui](https://community.freefem.org/u/mchetoui)\
**Post date:** [September 9, 2022, 3:52pm UTC](https://community.freefem.org/t/add-a-spatial-parameter-field/1997/3 "2022-09-09T15:52:32Z")

</div>

Thank you Mr Hecht, I will try to do so.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [September 10, 2022, 4:10pm UTC](https://community.freefem.org/t/add-a-spatial-parameter-field/1997/4 "2022-09-10T16:10:43Z")

</div>

I sorry I make a mistake in the name the function it is:  
to build a 2d mesh form a set of point,

> <https://github.com/FreeFem/FreeFem-sources/blob/master/examples/tutorial/tablefunction.edp>

and the file xyf is:

> <https://github.com/FreeFem/FreeFem-sources/blob/master/examples/tutorial/xyf>

and contening at each ile x,y,f(x,y)

---

<div class="post-metadata">

**Author:** ![mchetoui](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mchetoui](https://community.freefem.org/u/mchetoui)\
**Post date:** [September 21, 2022, 3:38pm UTC](https://community.freefem.org/t/add-a-spatial-parameter-field/1997/5 "2022-09-21T15:38:36Z")

</div>

Thank you M. Hecht, it works correctly in 2D. However, I didn’t find in the documentation any other function that can do the same job as “triangulate()” but in 3D. Is there a trick or another method to do it ?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [September 23, 2022, 8:39am UTC](https://community.freefem.org/t/add-a-spatial-parameter-field/1997/6 "2022-09-23T08:39:37Z")

</div>

the corresponding code in 3d is in exemples/plugin (convex hull)

> <https://github.com/FreeFem/FreeFem-sources/blob/master/examples/plugin/convexehull3d.edp>
