Modal Analysis of the beam structure

Hi,
I am currently working on a modal analysis of beam structure. In the postprocessing part, I am able to save my results in XDMF file format. Once I import the xdmf file format into ParaView, am only able to see the first eigenvector, am not able to visualize the other 5 eigenvectors. Can anyone guide me with this?. I have also attached my code below.

from dolfin import *

import numpy as np
import matplotlib.pyplot as plt

L, B, H = 20., 0.5, 1.
Nx = 200
Ny = int(B/LNx)+1
Nz = int(H/L
Nx)+1
mesh = BoxMesh(Point(0.,0.,0.),Point(L,B,H), Nx, Ny, Nz)

Material parameters and elastic constitutive relations

E, nu = Constant(1e5), Constant(0.)
rho = Constant(1e-3)

Lame coefficient for constitutive relation

mu = E/2./(1+nu)
lmbda = Enu/(1+nu)/(1-2nu)

def eps(v):

return sym(grad(v))

def sigma(v):

dim = v.geometric_dimension()

return 2.0*mu*eps(v) + lmbda*tr(eps(v))*Identity(dim)

Standard FunctionSpace is defined and boundary conditions correspond to a fully clamped support at :math:x=0::

V = VectorFunctionSpace(mesh, ‘Lagrange’, degree=1)
u_ = TrialFunction(V)
du = TestFunction(V)

def left(x, on_boundary):

return near(x[0],0.)

bc = DirichletBC(V, Constant((0.,0.,0.)), left)

The system stiffness matrix :math:[K] and mass matrix :math:[M] are respectively obtained from assembling the corresponding variational forms::

k_form = inner(sigma(du),eps(u_))*dx
l_form = Constant(1.)*u_[0]dx
K = PETScMatrix()
b = PETScVector()
assemble_system(k_form, l_form, bc, A_tensor=K, b_tensor=b)
m_form = rho
dot(du,u_)*dx
M = PETScMatrix()
assemble(m_form, tensor=M)

Matrices :math:[K] and :math:[M] are first defined as PETSc Matrix and forms are assembled into it to ensure that they have the right type.

eigensolver = SLEPcEigenSolver(K, M)
eigensolver.parameters[‘problem_type’] = ‘gen_hermitian’
eigensolver.parameters[‘spectral_transform’] = ‘shift-and-invert’
eigensolver.parameters[‘spectral_shift’] = 0.
N_eig = 6 # number of eigenvalues
#print(“Computing {} first eigenvalues…”.format(N_eig))
eigensolver.solve(N_eig)

Post-process

Set up file for exporting results

file_results = XDMFFile(“MA.xdmf”)
file_results.parameters[“flush_output”] = True
file_results.parameters[“functions_share_mesh”] = True

Eigenfrequencies

for i in range(N_eig):
r, c, rx, cx = eigensolver.get_eigenpair(i)

# Calculation of eigenfrequency from real part of eigenvalue

freq_3D = sqrt(r)/2/pi

print("Eigenfrequency: {0:8.5f} [Hz]".format(freq_3D))

# Initialize function and assign eigenvector

eigenmode = Function(V, name="Eigenvector " + str(i))
eigenmode.vector()[:] = rx

# Write i-th eigenfunction to xdmf file

file_results.write(eigenmode, i)

Hi,
using

file_results.write(eigenmode, i)

will output each vector to a different time step with time t=i. Replace i with 0 to have all eigenvectors at a single time step.