Solving Poisson Equation on 1D mesh with Dirichlet BC


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

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. :slight_smile:

Please have a look at LaplacianCurve.edp.
Very little adjustements are needed, see below.

load "msh3"

meshL ThL3=Sline(6,[x,0,0]);
real[int] bb(6);
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);