Skip to content

Commit

Permalink
Merge pull request #4 from veiguf/main
Browse files Browse the repository at this point in the history
eig
  • Loading branch information
e-dub authored Dec 15, 2020
2 parents ef36afe + d2c4c81 commit 7d2fdb4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions EasyBeam/EasyBeam.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ def EigenvalueAnalysis(self, nEig=2, massMatrixType="consistent"):
self.k = self.Assemble(self.StiffMatElem)
self.m = self.Assemble(self.MassMatElem)
try:
lambdaComplex, self.Phi = npla.eigh(self.k[self.DoF, :][:, self.DoF],
lambdaComplex, self.Phi = spla.eigh(self.k[self.DoF, :][:, self.DoF],
self.m[self.DoF, :][:, self.DoF],
eigvals=(0, nEig-1))
self.EigenvalSolver = "numpy.linalg.eigh"
self.EigenvalSolver = "scipy.linalg.eigh"
except:
lambdaComplex, self.Phi = spla.eig(self.k[self.DoF, :][:, self.DoF],
self.m[self.DoF, :][:, self.DoF])
Expand Down
29 changes: 20 additions & 9 deletions examples/Cantilever.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,30 @@
rho = 7.85e-9
I = b*h**3/12
A = b*h
nEl = 5

# Initialisiern des Problems
Cantilever = Beam2D()

# Setze Elementenbeschreibung
Cantilever.stiffMatType = "Timoshenko-Ehrenfest"
Cantilever.stiffMatType = "Euler-Bernoulli"
Cantilever.massMatType = "lumped"
Cantilever.massMatType = "consistent"

# Knoten [mm]
Cantilever.N = [[0, 0],
[l, 0]]
Cantilever.N = [[]]*(nEl+1)
for i in range(nEl+1):
Cantilever.N[i] = [l*i/nEl, 0.0]

# Elemente: verbindet die Knoten
Cantilever.El = [[0, 1]]
Cantilever.El = [[]]*(nEl)
for i in range(nEl):
Cantilever.El[i] = [i, i+1]

# Randbedingungen und Belastung [N] bzw. [Nmm]
Cantilever.BC = [0, 1, 2]
Cantilever.Load = [[4, F]]
Cantilever.Load = [[3*nEl+1, F]]

# Initialisieren des Modells
Cantilever.Initialize()
Expand All @@ -43,18 +50,19 @@
Cantilever.StaticAnalysis()
Cantilever.Scale = 10
Cantilever.ComputeStress()
Cantilever.EigenvalueAnalysis(nEig=len(Cantilever.DoF))
Cantilever.EigenvalueAnalysis(nEig=4)

# Grafische Darstellung
Cantilever.PlotMesh()
Cantilever.PlotStress()
Cantilever.PlotDisplacement()
Cantilever.ScalePhi = 100
Cantilever.ScalePhi = 10
Cantilever.PlotMode()

# With Timoshenko beams
Cantilever.stiffMatType = "Timoshenko-Ehrenfest"
Cantilever.EigenvalueAnalysis(nEig=len(Cantilever.DoF))
Cantilever.ScalePhi = 100
Cantilever.PlotMode()

# Analytical values, continuous beam theory for eigenfrequencies
Expand All @@ -68,9 +76,12 @@
print(wMax)

print("first three bending modes [Hz]:")
fB1 = 1.875**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
fB2 = 4.694**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
fB3 = 7.855**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
# fB1 = 1.875**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
# fB2 = 4.684**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
# fB3 = 7.069**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
fB1 = 1.87510107**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
fB2 = 4.69409113**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
fB3 = 7.85475744**2/(2*np.pi*l**2)*((E*I)/(rho*A))**0.5
print(fB1)
print(fB2)
print(fB3)
Expand Down

0 comments on commit 7d2fdb4

Please sign in to comment.