# Laplace-Beltrami on surfaces

**URL:** <https://community.freefem.org/t/laplace-beltrami-on-surfaces/202>\
**Category:** General Discussion\
**Created:** [December 17, 2019, 11:27am UTC](https://community.freefem.org/t/laplace-beltrami-on-surfaces/202 "2019-12-17T11:27:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [December 17, 2019, 11:27am UTC](https://community.freefem.org/t/laplace-beltrami-on-surfaces/202/1 "2019-12-17T11:27:08Z")

</div>

Hello.

I tried to solve the Laplace Beltrami eigenvalue problem on the sphere. The usual syntax for storing the eigenfunction does not seem to work. The eigenvalues are captured correctly, but when using vector=eV I get some error.

The code is below. Removing “vector=eV” gives a code which runs and returns the eigenvalues. I am interested to see the eigenvectors also.

Best regards,  
Beni

* * *

load “msh3”  
load “medit”  
load “tetgen”

verbosity = 0;  
int K = 10;

real hh = 0.05;

// Mesh 2D  
mesh Th = square(10, 20, [x_pi-pi/2, 2_y\*pi]); // ]-pi/2, pi/2[X]0, 2pi[  
// A parametrization of a sphere  
func f1 = cos(x)\*cos(y);  
func f2 = cos(x)\*sin(y);  
func f3 = sin(x);  
// Partial derivative of the parametrization DF  
func f1x = sin(x)\*cos(y);  
func f1y = -cos(x)_sin(y);  
func f2x = -sin(x)sin(y);  
func f2y = cos(x)cos(y);  
func f3x = cos(x);  
func f3y = 0;  
//M = DF^t DF  
func m11 = f1x^2 + f2x^2 + f3x^2;  
func m21 = f1xf1y + f2xf2y + f3x_f3y;  
func m22 = f1y^2 + f2y^2 + f3y^2;

// Periodic condition  
func perio = [[4, y], [2, y], [1, x], [3, x]];

// Mesh adaptation  
real vv = 1/square(hh);  
Th = adaptmesh(Th, m11_vv, m21_vv, m22_vv, IsMetric=1, inquire=1, periodic=perio);  
Th = adaptmesh(Th, m11_vv, m21_vv, m22_vv, IsMetric=1, periodic=perio);  
Th = adaptmesh(Th, m11_vv, m21_vv, m22_vv, IsMetric=1, periodic=perio);  
Th = adaptmesh(Th, m11_vv, m21_vv, m22_vv, IsMetric=1, periodic=perio);

// Sphere  
meshS ThS = movemesh23(Th, transfo=[f1, f2, f3]);  
plot(ThS);

fespace VhS(ThS,P1);

VhS u,v;

varf a(u,v) =  
int2d(ThS)(dx(u)\*dx(v) + dy(u)\*dy(v)+dz(u)_dz(v));  
varf b(u,v) = int2d(ThS)( u_v );

matrix A= a(VhS,VhS);  
matrix B= b(VhS,VhS);

real[int] ev(K+1);  
VhS[int] eV(K+1);

real[int,int] eVect(VhS.ndof,K+1);

cout \<\< VhS.ndof \<\< endl;  
cout \<\< ThS.nv \<\< endl;

int k = EigenValue(A,B,value=ev,vector=eV,tol=1e-10);  
cout \<\< k \<\< endl;

cout \<\< ev \<\< endl;

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [December 17, 2019, 12:29pm UTC](https://community.freefem.org/t/laplace-beltrami-on-surfaces/202/2 "2019-12-17T12:29:03Z")

</div>

I managed to make the code run with “rawvector=(real[int,int])” instead of “vector=(FE vector)”, but I would still want to know, if possible how to make the code run with “vector=”.  
Best regards,  
Beniamin

---

<div class="post-metadata">

**Author:** ![AFourmont](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/afourmont/32/56_2.png) [@AFourmont](https://community.freefem.org/u/AFourmont)\
**Post date:** [December 17, 2019, 4:45pm UTC](https://community.freefem.org/t/laplace-beltrami-on-surfaces/202/3 "2019-12-17T16:45:16Z")

</div>

Hello,  
it’s available in the current branch or last release 4.4-3.  
You can look this ex. [examples/eigen/LapEigenBeltrami.edp](https://github.com/FreeFem/FreeFem-sources#diff-899e31245185008bea0ee5802bd3ad81)  
Axel
