# An error while trying to use periodic boundaries

Hi guys,

i have atoruble while trying to use perodic boundries. I am trying to solve the diffusion equation for a rectangle shpae in 2D and now when i try to use the boundry condition I recieve an error which says:

Assertion fail : (hmn > 1.0e-20)
line :1030, in file lgfem.cpp

any idea or suggestion?

for better insight into the problem I post also my simple code:

// Mesh
border a(t=-1, 1){x=t; y=-1; label=1;};
border b(t=-1, 1){x=1; y=t; label=2;};
border c(t=0, 2){x=1-t; y=1; label=3;};
border d(t=0, 2){x=-1; y=1-t; label=4;};

int n = 50;

mesh Th = buildmesh(a(n) + b(n) + c(n) + d(n));
plot(Th, wait=true);

//FE Space
fespace Vh(Th, P2, periodic=[[3,y] , [1,y]]);
Vh u, v, u0;

// Initial condition
u = 0;

//data
real C1 = 1;
real C2 = 0;
real dt = 0.01;
real T = 3;

real D = 1;

// Variational Problem
macro F(u, v) D*( dx(u)*dx(v) + dy(u)*dy(v))//eom

problem diffusion(u, v)
= int2d(Th)(uv / dt)
+ int2d(Th)(F(u, v))
- int2d(Th)(u0
v/dt)
+ on(4, u=C1)
+ on(2, u=C2)
;

// Time loop

int M = int(T / dt) + 1;
for (int i=1; i<M; i++){
u0 = u; // update from previous step time
diffusion; // Solve the linear system

``````plot(u, wait=0, fill=1, value=1, cmm="Solution at Time " + i * dt);  // plot the solution at each time step
``````

}