getfem-users
[Top][All Lists]
Advanced

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

Computation on regions


From: Eloi Martinet
Subject: Computation on regions
Date: Thu, 30 Jun 2022 16:56:56 +0200 (CEST)

Hello,
I'm using the python interface of GetFEM. My goal is to compute the laplace eigenvalues on a region of a spherical mesh, as follows (suppose the mesh, integration method IM and meshfem V is already declared):

   # Assemble the stiffness and mass matrices
    md = gf.Model("real")
    md.add_fem_variable("u", V)
    Kg = gf.asm_generic(IM, 2, "Grad_Test2_u.Grad_Test_u", region, md)
    Mg = gf.asm_generic(IM, 2, "Test2_u*Test_u", region, md)

    # Convert to scipy sparse
    K = getfem_to_scipy_sparse(Kg)
    M = getfem_to_scipy_sparse(Mg)

    # Compute the eigenvalues
    eVal, eVec = scipy.linalg.sparse.eigsh(K, k+max_multiplicity+1, M, sigma=0, which='LM', v0=v0)

however, the size of the matrices K and M are the same as V.nbdof() whereas it should have less since the region isn't the whole mesh. Moreover, when I try to use the function "basic_dof_on_region", I get the following error :

   NameError: name 'basic_dof_on_region' is not defined

I saw the things about the extension matrices but this is not clear to me how to construct it from the label of the region. So my question is what is the best way to compute eigenvalues on a region ?

Thank you for your help and have a good day.
Eloi MARTINET.

reply via email to

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