getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-users] Implementing a Laplacian Eigenvalue problem


From: Marianne Petersen
Subject: [Getfem-users] Implementing a Laplacian Eigenvalue problem
Date: Thu, 5 Mar 2015 08:47:21 +0100

Dear community,

I am trying to implement the following problem Laplacian eigenvalue problem:
\int Grad(<f,u>) dA = \lambda \int u*f dA
with Dirichlet boundary conditions and a Neumann condition.
Since this problem is observed on a mesh with n Triangles The equation is to be solved on every triangle and the corresponding fem.

Is my idea of using the following _expression_ for the lhs correct?
    getfem::mesh mymesh;

// finite element method
    getfem::mesh_fem mf(mymesh);
    getfem::pfem pf = getfem::fem_descriptor("FEM_PK(2,1)");
    mf.set_finite_element(mymesh.convex_index(), pf);

// integration method
    getfem::mesh_im intm(mymesh);
    getfem::pintegration_method ppi = getfem::int_method_descriptor("IM_TRIANGLE(7)");
    intm.set_integration_method(ppi);

    getfem::ga_workspace workspace;
    getfem::size_type nbdof = mf.nb_dof();
    getfem::base_vector U(nbdof);

    // left hand side: A
    workspace.add_fem_variable("u", mf, gmm::sub_interval(0, nbdof), U);
    workspace.add_fem_variable("f", mf, gmm::sub_interval(0, nbdof), U);
    workspace.add_expression("f.Test_u", intm);
    getfem::base_vector skalprod(nbdof);
    workspace.set_assembled_vector(skalprod);
    workspace.assembly(0);

    workspace.clear_expressions();

    workspace.add_fem_variable("skp", mf, gmm::sub_interval(0, nbdof), skalprod);
    workspace.add_expression("Grad_skp", intm);
    getfem::model_real_sparse_matrix A(nbdof, nbdof);
    workspace.set_assembled_matrix(A);
    workspace.assembly(2);

I am really unsure about how to implement this problem.
Do you have an idea? Or should I use the "bricks"? Although I am not sure either if this would work..

How can I make sure that the problem is for real implemented on each trinagle of the mesh?

Thank you already very much in advance :)

Best regards
Marianne Petersen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]