i want to solve a 1d heat equation. how to create 1d mesh?

This does not seem to be highlighted but there is some support.

Search the docs for “Sline” and see “msh3”

I wrote a special gaphics app, “mjmdatascope” that I first tested on Freefem

because I could not find good 1D graphics though.

The attached is an old example from someone on the forum earlier

that contains the use of “Sline” with mjmdatascope but there are

a few examples around .

MWGFEM_1.edp (3.3 KB)

can this work?

int m=500;

Th=square(1,m);

plot(Th,wait=1);

fespace Vh(Th,P2,periodic=[[2,y],[4,y]]);

I guess you can setup the problem and get the matrix and rhs with

FF “varf” and see what you think. As long as there are no derivatives in

the perpendicular direction it might work but probably have extra

elements.

Do you actually want periodicity along the 1D mesh?

.

Actually I am solving for temporal hydrodynamic stability of a 2d parallel base flow. for this i have to solve an eigen value problem in 1d mesh.

i was thinking of using periodicity as a way to convert a 2d mesh into 1d mesh.

is this approach right?

Yes it works.

The following examples may help you: 2d periodic + SLEPc solver or consider this one for true 1d + arpack solver

Is that plot only supported on more recent FF? Mine dies although IIRC

there have been other causes for errors like that. Thanks.

```
FreeFem++ LapEigen1DBeltrami.edp
-- FreeFem++ v4.12 (Sat 20 May 2023 07:29:03 PM EDT - git no git)
file : LapEigen1DBeltrami.edp
Load: lg_fem lg_mesh lg_mesh3 eigenvalue
1 : // test to validate the addition of surfacic finite elements in FreeFEM
2 :
3 : load "msh3"
4 : load "medit"
5 :
6 :
7 : /////variational form
8 :
9 : /////////////////////////////////
10 : // laplacian 2D
11 : real R = 3, r=1;
12 : real h = 0.1; //
13 : int nx = R*2*pi/h;
14 : func torex= (R+r*cos(y*pi*2))*cos(x*pi*2);
15 : func torey= (R+r*cos(y*pi*2))*sin(x*pi*2);
16 : func torez= r*sin(y*pi*2);
17 :
18 :
19 : meshL Th=segment(nx,[torex,torey,torez],removeduplicate=true) ;
20 : fespace Vh(Th,P1);
21 : macro Grad3(uSVar) [dx(uSVar),dy(uSVar),dz(uSVar)] ) // EOM
22 :
23 : //with variational form
24 : real sigma = 1;
25 : varf a(u,v) = int1d(Th)(Grad3(u) [dx(u),dy(u),dz(u)] '*Grad3(v) [dx(v),dy(v),dz(v)] - sigma* u*v);
26 : varf m(u,v) = int1d(Th)( u*v);
27 :
28 : matrix A =a(Vh,Vh);
29 : matrix B =m(Vh,Vh,solver=CG);
30 : int nev=100; // number of computed eigen valeu close to sigma
31 :
32 : real[int] ev(nev); // to store nev eigein value
33 : Vh[int] eV(nev); // to store nev eigen vector
34 :
35 : int k=EigenValue(A,B,sym=true,sigma=sigma,value=ev,vector=eV,tol=1e-10,maxit=0,ncv=0,which="LM"); // which="LM" default
36 :
37 : for (int i=0;i<k;i++)
38 : plot(eV[i],cmm=" (new plot in test) Eigen Vector "+i+" valeur =" + ev[i] ,wait=1,value=1,dim=3,fill=1,CutPlane=0,ShowAxes=1, nbiso=40);
39 :
40 : sizestack + 1024 =1896 ( 872 )
-- FESpace: Nb of Nodes 188 Nb of DoF 188
Real symmetric eigenvalue problem: A*x - B*x*lambda
Plot:: Sorry no ps version for this type of plot 14
Plot:: Sorry no ps version for this type of plot 14
Plot:: Sorry no ps version for this type of plot 14
Plot:: Sorry no ps version for this type of plot 14
Plot:: Sorry no ps version for this type of plot 14
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
```