Modal Analisys #821
-
I've been wondering whether it is possible to solve the eigenvalue problem (modal analysis) with the current tools available in Gridap. I tried exploring the docs and messing around with the library, but since I'm reasonably new to this world, I couldn't figure it out. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Here's a simple example that solves for eigenmodes of the Laplace equation on a rectangular domain with zero Dirichlet boundary conditions. Because we don't care about the right hand side vector and only need the assembled matrix, I set using Gridap
N = 20
model = CartesianDiscreteModel((0, π, 0, π / 2), (N, N / 2))
reffe = ReferenceFE(lagrangian, Float64, 1)
V = FESpace(model, reffe; conformity=:H1, dirichlet_tags="boundary")
U = V
x = Triangulation(model)
dx = Measure(x, 2)
a(u, v) = ∫(∇(u) ⋅ ∇(v))dx
b(v) = 0.0
A = AffineFEOperator(a, b, U, V).op.matrix
using Arpack
nev = 10
λ, ϕ = eigs(A; nev=nev, which=:SM)
writevtk(
x,
"modes";
cellfields=["mode$i" => FEFunction(U, real(ϕ[:, i])) for i in 1:nev],
)
λ[1:nev] |
Beta Was this translation helpful? Give feedback.
-
Just a minor syntax improvement: you can replace A = AffineFEOperator(a, b, U, V).op.matrix with feop = AffineFEOperator(a, b, U, V)
A = get_matrix(feop) or using Gridap.FESpaces
A = assemble_matrix(a,U,V) |
Beta Was this translation helpful? Give feedback.
Here's a simple example that solves for eigenmodes of the Laplace equation on a rectangular domain with zero Dirichlet boundary conditions. Because we don't care about the right hand side vector and only need the assembled matrix, I set
b(v) = 0
.