# Solving Poisson Equation on 1D mesh with Dirichlet BC

**URL:** <https://community.freefem.org/t/solving-poisson-equation-on-1d-mesh-with-dirichlet-bc/507>\
**Category:** General Discussion\
**Created:** [July 15, 2020, 5:43pm UTC](https://community.freefem.org/t/solving-poisson-equation-on-1d-mesh-with-dirichlet-bc/507 "2020-07-15T17:43:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![balance](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@balance](https://community.freefem.org/u/balance)\
**Post date:** [July 15, 2020, 5:43pm UTC](https://community.freefem.org/t/solving-poisson-equation-on-1d-mesh-with-dirichlet-bc/507/1 "2020-07-15T17:43:58Z")

</div>

Hello,

so assume you want to solve:

int\_0^1 grad(u)grad(v) dx = int\_0^1 v dx

on [0,1] mesh with let’s say N=5 cells (i.e. 6 nodes). For the basis, we want to use tent functions. I.e. something like this [Tent functions](https://www.researchgate.net/profile/Sam_Pallister/publication/287686805/figure/fig1/AS:349734641389568@1460394644127/A-basis-set-of-tent-functions-dotted-blue-lines-for-piecewise-linear-functions.png)

The cells are of width h=1/N, so they are equidistant.

I somehow fail to find out how I can use such a simple 1D mesh. 🙂

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [July 15, 2020, 5:48pm UTC](https://community.freefem.org/t/solving-poisson-equation-on-1d-mesh-with-dirichlet-bc/507/2 "2020-07-15T17:48:21Z")

</div>

Please have a look at [LaplacianCurve.edp](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/3dCurve/LaplacianCurve.edp).  
Very little adjustements are needed, see below.

```auto
load "msh3"

meshL ThL3=Sline(6,[x,0,0]);
real[int] bb(6);
boundingbox(ThL3,bb);
fespace Vh(ThL3,P1);
func f = 1 ;
macro Grad3(uh) dx(uh) // EOM

Vh uLPb,vLPb;

// with problem
problem Lap3dL(uLPb,vLPb) = int1d(ThL3)(Grad3(uLPb)'*Grad3(vLPb))
 - int1d ( ThL3 ) ( f * vLPb )
  + on(1,2,uLPb=0);
Lap3dL;

plot(ThL3,uLPb);

```
