[SOLVED] AERO4630 Project3- Non-dimensionalization and Weak Form

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Project03-y652y1.zip (2694.1 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
Rate this product

Part 1a: Non-dimensionalization and Weak Form

The governing equation

divΟƒ + f = ρu¨                                                              (1)

can be put in its weak form. By redefining the second derivative and converting to index notation, the governing equation becomes

(2)

which can be rearranged to

(3)

By integrating over the body Ω, the integral becomes

(4)

We can multiply by a perturbation vi and apply the chain rule to the first term.

(5)

Applying the divergence theorem yields

(6)

The governing equation in its weak form becomes

Length terms, traction and stress terms, and time terms in the weak form equation can be nondimensionalized by the beam length L, Young’s modulus E, and characteristic time t˜.

Part 1b: Just Displacement

Deflection was determined at the center of a beam with length L = 1m, width W = 0.2m, height H = 0.2m, Youngs Modulus E = 200GPa, Poisson ratio Ξ½ = 0.3, and density 7800kg mβˆ’3. The beam is clamped at both ends, and a downward force of F = 100N is applied over the area on the top surface near the center, within 0.2 m along the width, and within 0.02 m along the length of the beam.

The deflection was determined to be 3.75 Γ— 10βˆ’8 m downward, and the Paraview output is shown in Fig 1

Figure 1: Paraview output for problem 1b

The code used for part 1b can be seen in Appendix 1b.

Part 1c: Free Vibration

The force was removed, and the calculated deflection was set as an initial condition of the beam. A free vibration was modeled, and a time-plot can be seen in Fig 2.

The period of oscillation was determined to be 0.0011 seconds, and the natural frequency was determined to be 5681 rad/s or 904.2 Hz.

Figure 2: Vertical Deflection vs Time

The code used for Problem 1c is shown in Appendix 1c.

Part 1d: Natural Frequency, Changing Dimensions

Changing Width

Next, the beam width was varied to assess how natural frequency changes with beam width. Widths of 0.2, 0.4, 0.6, 0.8, and 1.0 m were assessed. A plot of natural frequencies over beam width is shown in Fig 3.

The Python code used for part 1d-i is shown in Appendix 1d-i.

Figure 3: Natural Frequency over Beam Width for Problem 1d

Changing Height

Next, the beam height was varied to assess how natural frequency changes with beam height. Heights of 0.2, 0.4, 0.6, 0.8, and 1.0 m were assessed. A plot of natural frequencies over beam Height is shown in Fig 4.

The Python code used for part 1d-ii is shown in Appendix 1d-ii.

Figure 4: Natural Frequency over Beam Height for Problem 1d

Appendix 1b: Code for Problem 1b

”””

PythonΒ Β Β Β Β Β Β  scriptΒ Β Β Β Β  forΒ Β Β Β Β  Part 1bΒ Β Β Β  ofΒ Β Β Β  ProjectΒ Β Β Β  2a

OriginalΒ Β Β Β Β Β Β Β Β  Author :Β Β Β Β Β Β Β Β  Vinamra Agrawal

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  JanuaryΒ Β Β  25 ,Β Β Β  2019

Edited By:Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  Omkar Mulekar

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  FebruaryΒ Β Β Β  10 ,Β Β Β  2019

”””

fromΒ Β  futureΒ Β Β Β Β Β Β Β Β  Β import print function from fenics import βˆ— import matplotlib

matplotlib . use (”Agg”)

import matplotlib . pyplot as plt from ufl import nabla div import math

#============================================================== # DefineΒ Β Β Β Β Β  SystemΒ Β Β Β Β Β Β Β Β Β  Properties

#============================================================== length = 1;

W = 0.2;

H = 0.2;

a = 0.04/ length ; b = 0.4βˆ—H/length ;

area = aβˆ—b; F = βˆ’100

youngs = 200e9 # Youngs nu = 0.3 # Poisson rho = 7800 # Density

# Lame parameters mu = (youngs)/(2βˆ—(1+nu) )

lambdaΒ Β Β Β Β Β Β Β  Β = (nuβˆ—youngs)/((1+nu)βˆ—(1βˆ’2βˆ—nu) )

g = 10

traction applied = F/area

#============================================================== #Β Β Β Β Β  DimensionlessΒ Β Β Β Β Β Β Β Β Β  parameters

#============================================================== l nd = length/length

w nd = W/length h nd = H/length

mu nd = mu/youngs lambda nd = lambda /youngs traction nd = traction applied /youngs

#============================================================ # Boundaries and Geometry

#============================================================ mesh = BoxMesh( Point (0 ,0 ,0) , Point ( l nd , w nd , h nd) ,20 ,6 ,6) V = VectorFunctionSpace (mesh , ’P’ ,1) tol = 1Eβˆ’14

def boundary left (x , on boundary) : return (onboundary and near (x [0] ,0 , tol ) )

def boundary right (x , on boundary) : return on boundary and near (x [0] , l nd , tol )

bcleft = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundaryleft ) bc right = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundary right )

#============================================================ def epsilon (u) : return 0.5βˆ—( nabla grad (u) + nabla grad (u) .T)

def sigma(u) :

return lambda ndβˆ—nabla div (u)βˆ—Identity (d) + mu ndβˆ—( epsilon (u) + epsilon (u) .T)

#============================================================ # First we solve the problem of a cantelever beam under fixed # load .

#============================================================

u init = TrialFunction (V)

d = u init . geometric dimension () v = TestFunction (V)

f = Constant ((0.0 ,0.0 ,0.0) )

T init = Expression (( ’ 0.0 ’ , ’x [0] >= 0.48βˆ— l && x [0] <= .52βˆ— l && near (x [1] ,w) && x [2] >= 0.3βˆ—h && x [2] <= 0.7βˆ—h? A : 0.0 ’ , ’ 0.0 ’

) , degree=1, l=l nd , w=w nd ,h=h nd , A=traction nd )

F init = inner (sigma( u init ) , epsilon (v) )βˆ—dx βˆ’ dot( f , v)βˆ—dx βˆ’ dot(

T init , v)βˆ—ds a init , L init = lhs ( F init ) , rhs ( F init )

print(”Solving theΒ Β Β  i n i t i a lΒ Β Β Β Β Β Β Β  cantelever problem”) u init = Function (V)

solve ( a init==L init , u init , [ bc left , bc right ])

w nd = u init ( lnd /2.0 ,w nd/2.0 , h nd /2.0)

w = w nd βˆ— length print(w[1])

vtkfile u = File ( ’ deflection . pvd ’ ) vtkfile u << u init

Appendix 1c: Code for Problem 1c

”””

PythonΒ Β Β Β Β Β Β  scriptΒ Β Β Β Β  forΒ Β Β Β Β  Part 1cΒ Β Β Β  ofΒ Β Β Β  ProjectΒ Β Β Β  2a

OriginalΒ Β Β Β Β Β Β Β Β  Author :Β Β Β Β Β Β Β Β  Vinamra Agrawal

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  JanuaryΒ Β Β  25 ,Β Β Β  2019

Edited By:Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  Omkar Mulekar

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  FebruaryΒ Β Β Β  28 ,Β Β Β  2019

”””

fromΒ Β  futureΒ Β Β Β Β Β Β Β Β  Β import print function from fenics import βˆ— import matplotlib

matplotlib . use (”Agg”)

import matplotlib . pyplot as plt from ufl import nabla div import math import numpy as np from scipy . signal import argrelextrema

#============================================================== # DefineΒ Β Β Β Β Β  SystemΒ Β Β Β Β Β Β Β Β Β  Properties

#============================================================== length = 1;

W = 0.2;

H = 0.2;

a = 0.04βˆ— length ; b = 0.4βˆ—H; area = aβˆ—b; F = βˆ’100

youngs = 200e9 # Youngs nu = 0.3 # Poisson rho = 7800 # Density

# Lame parameters mu = (youngs)/(2βˆ—(1+nu) )

lambdaΒ Β Β Β Β Β Β Β  Β = (nuβˆ—youngs)/((1+nu)βˆ—(1βˆ’2βˆ—nu) )

g = 10

traction applied = F/area

#============================================================== #Β Β Β Β Β  DimensionlessΒ Β Β Β Β Β Β Β Β Β  parameters

#============================================================== lnd = length/length

wnd = W/length hnd = H/length

bar speed = math. sqrt (youngs/rho) t char = length/bar speed t = 0 t i = 0.5

dt = 0.1 num steps = 150

mu nd = mu/youngs lambda nd = lambda /youngs traction nd = traction applied /youngs

#============================================================ # Boundaries and Geometry

#============================================================ mesh = BoxMesh( Point (0 ,0 ,0) , Point ( l nd , w nd , h nd) ,20 ,6 ,6) V = VectorFunctionSpace (mesh , ’P’ ,1) tol = 1Eβˆ’14

def boundary left (x , on boundary) : return (onboundary and near (x [0] ,0 , tol ) )

def boundary right (x , on boundary) : return on boundary and near (x [0] , l nd , tol )

bcleft = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundaryleft ) bc right = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundary right )

#============================================================ def epsilon (u) :

return 0.5βˆ—( nabla grad (u) + nabla grad (u) .T)

def sigma(u) :

return lambda ndβˆ—nabla div (u)βˆ—Identity (d) + mu ndβˆ—( epsilon (u) + epsilon (u) .T)

#============================================================ # First we solve the problem of a cantelever beam under fixed # load .

#============================================================ u init = TrialFunction (V)

d = u init . geometric dimension () v = TestFunction (V)

f = Constant ((0.0 ,0.0 ,0.0) )

T init = Expression (( ’ 0.0 ’ , ’x [0] >= 0.48βˆ— l && x [0] <= .52βˆ— l && near (x [1] ,w) && x [2] >= 0.3βˆ—h && x [2] <= 0.7βˆ—h? A : 0.0 ’ , ’ 0.0 ’

) , degree=1, l=l nd , w=w nd ,h=h nd , A=traction nd )

F init = inner (sigma( u init ) , epsilon (v) )βˆ—dx βˆ’ dot( f , v)βˆ—dx βˆ’ dot(

T init , v)βˆ—ds a init , L init = lhs ( F init ) , rhs ( F init )

print(”Solving the i n i t i a l cantelever problem”) u init = Function (V) solve ( a init==L init , u init , [ bc left , bc right ])

w nd = u init ( lnd /2.0 ,w nd/2.0 , h nd /2.0)

w = w nd βˆ— length print(w[1])

#============================================================

# Next we useΒ Β Β Β Β Β Β Β Β Β Β  thisΒ Β Β Β  asΒ Β  i n i t i a lΒ Β Β Β Β  condition ,Β Β Β Β Β  l e tΒ Β Β  theΒ Β Β Β  forceΒ Β Β Β Β  go and

# studyΒ Β Β Β Β Β Β  theΒ Β Β Β Β  verticalΒ Β Β Β Β Β Β Β  vibrationsΒ Β Β Β Β  ofΒ Β Β Β  the beam

#============================================================ u n = interpolate (Constant ((0.0 ,0.0 ,0.0) ) ,V) u n 1 = interpolate (Constant ((0.0 ,0.0 ,0.0) ) ,V) u n . assign ( u init ) u n 1 . assign ( u init ) T n = Constant ((0.0 ,0.0 ,0.0) )

u = TrialFunction (V) d = u. geometric dimension () v = TestFunction (V)

F = (dtβˆ—dt)βˆ—inner (sigma(u) , epsilon (v) )βˆ—dx + dot(u, v)βˆ—dx βˆ’ (dtβˆ—dt)βˆ— dot( f , v)βˆ—dx βˆ’ (dtβˆ—dt)βˆ—dot (T n , v)βˆ—ds βˆ’ 2.0βˆ— dot(u n , v)βˆ—dx + dot( u n 1 , v)βˆ—dx

a ,L = lhs (F) , rhs (F)

xdmffileu = XDMFFile( ’ results / solution . xdmf ’ ) xdmffiles = XDMFFile( ’ results / stress . xdmf ’ ) u = Function (V)

u store = [0] βˆ— num steps time = [0] βˆ— num steps

index = 0 for n in range( num steps ) : print(”time = %.2f ” % t ) Tn . t = t

solve (a == L, u, [ bc left , bc right ]) ugrab = u(0.5 ,0.1 ,0.1) u store [n] = u grab [1]

if (abs(tβˆ’index ) <0.01) :

print(”Writing outputΒ Β Β Β Β Β Β Β Β  f i l e s . . . ”)

xdmffile u . write (uβˆ—length , t )

W = TensorFunctionSpace (mesh , ”Lagrange” , 1) stress = lambda βˆ—nabla div (u)βˆ—Identity (d) + muβˆ—( epsilon (u)

+ epsilon (u) .T) xdmffile s . write ( project ( stress ,W) , t ) index += 1

time [n] = t t+=dt

u n 1 . assign (u n) u n . assign (u)

# Get period of o s c i l l a t i o n u np = np. array ( u store ) min args = argrelextrema (u np ,np. less ) period = ( time [ min args [ 0 ] [ 1 ] ] βˆ’ time [ min args [ 0 ] [ 0 ] ] ) βˆ—t char nat freq = 2βˆ—math. pi /period

print(”Period of Oscillation ” , period , ” seconds”) print(”Natural Frequency : ” , nat freq , ” rad/s”)

plt . figure (1) plt . plot (time , u store ) plt . xlabel ( ’ timeΒ Β Β Β Β Β Β Β Β Β  [ s ] ’ ) plt . ylabel ( ’ Vertical DeflectionΒ Β Β Β Β Β  [m] ’ ) plt . savefig ( ’1 cfig . png ’ )

Appendix 1d-i: Code for Problem 1d-i

”””

PythonΒ Β Β Β Β Β Β  scriptΒ Β Β Β Β  forΒ Β Β Β Β  Part 1d . iΒ Β Β Β Β  ofΒ Β Β Β  ProjectΒ Β Β Β  2a

OriginalΒ Β Β Β Β Β Β Β Β  Author :Β Β Β Β Β Β Β Β  Vinamra Agrawal

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  JanuaryΒ Β Β  25 ,Β Β Β  2019

Edited By:Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  Omkar Mulekar

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  FebruaryΒ Β Β Β  28 ,Β Β Β  2019

”””

fromΒ Β  futureΒ Β Β Β Β Β Β Β Β  Β import print function from fenics import βˆ— import matplotlib

matplotlib . use (”Agg”)

import matplotlib . pyplot as plt from ufl import nabla div import math import numpy as np from scipy . signal import argrelextrema

#============================================================== # DefineΒ Β Β Β Β Β  SystemΒ Β Β Β Β Β Β Β Β Β  Properties

#============================================================== length = 1;

W1 = 0.2; H = 0.2;

alpha = np. linspace (0.2 ,1 ,num=5) print(”alpha = ” , alpha )

W = alpha βˆ— W1

a = 0.04βˆ— length ; b = 0.4βˆ—H; area = aβˆ—b; F = βˆ’100

youngs = 200e9 # Youngs nu = 0.3 # Poisson rho = 7800 # Density

# Lame parameters mu = (youngs)/(2βˆ—(1+nu) )

lambdaΒ Β Β Β Β Β Β Β  Β = (nuβˆ—youngs)/((1+nu)βˆ—(1βˆ’2βˆ—nu) )

g = 10

traction applied = F/area

nat freq = [0] βˆ— len( alpha )

print(”Beginning Loop . . . ”) for i in range(len( alpha ) ) : print(”alpha = ” , alpha [ i ])

#============================================================== #Β Β Β Β  Dimensionless parameters

#============================================================== lnd = length/length

wnd = W[ i ]/ length hnd = H/length

bar speed = math. sqrt (youngs/rho) t char = length/bar speed t = 0 t i = 0.5

dt = 0.1 num steps = 275

mu nd = mu/youngs lambda nd = lambda /youngs traction nd = traction applied /youngs

#============================================================ # Boundaries and Geometry

#============================================================ mesh = BoxMesh( Point (0 ,0 ,0) , Point ( l nd , w nd , h nd) ,20 ,6 ,6) V = VectorFunctionSpace (mesh , ’P’ ,1) tol = 1Eβˆ’14

def boundaryleft (x , on boundary) :

return (onboundary and near (x [0] ,0 , tol ) )

def boundary right (x , on boundary) : return on boundary and near (x [0] , l nd , tol )

bcleft = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundaryleft ) bc right = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundary right )

#============================================================ def epsilon (u) : return 0.5βˆ—( nabla grad (u) + nabla grad (u) .T)

def sigma(u) :

return lambda ndβˆ—nabla div (u)βˆ—Identity (d) + mu ndβˆ—( epsilon (u

) + epsilon (u) .T)

#============================================================ # First we solve the problem of a cantelever beam under fixed # load .

#============================================================ u init = TrialFunction (V)

d = u init . geometric dimension () v = TestFunction (V)

f = Constant ((0.0 ,0.0 ,0.0) )

T init = Expression (( ’ 0.0 ’ , ’x [0] >= 0.48βˆ— l && x [0] <= .52βˆ— l && near (x [1] ,w) && x [2] >= 0.3βˆ—h && x [2] <= 0.7βˆ—h? A : 0.0 ’ , ’

0.0 ’ ) , degree=1, l=l nd , w=w nd ,h=h nd , A=traction nd )

F init = inner (sigma( uinit ) , epsilon (v) )βˆ—dx βˆ’ dot( f , v)βˆ—dx βˆ’ dot

( T init , v)βˆ—ds a init , L init = lhs ( F init ) , rhs ( F init )

print(”Solving the i n i t i a l cantelever problem”) u init = Function (V) solve ( a init==L init , u init , [ bc left , bc right ])

down nd = u init ( l nd /2.0 ,w nd/2.0 , h nd /2.0)

w = down nd βˆ— length

print(” I n i t i a lΒ Β Β Β Β Β Β Β Β  Displacement : ” ,w[1])

#============================================================

# Next we useΒ Β Β Β Β Β Β  thisΒ Β Β Β  asΒ Β  i n i t i a lΒ Β Β Β Β  condition ,Β Β Β Β Β  l e tΒ Β Β  theΒ Β Β Β  forceΒ Β Β Β Β  go and

# studyΒ Β Β Β Β  theΒ Β Β Β Β  verticalΒ Β Β Β Β Β Β Β  vibrationsΒ Β Β Β Β  ofΒ Β Β Β  the beam

#============================================================ u n = interpolate (Constant ((0.0 ,0.0 ,0.0) ) ,V) u n 1 = interpolate (Constant ((0.0 ,0.0 ,0.0) ) ,V) u n . assign ( u init ) u n 1 . assign ( u init )

T n = Constant ((0.0 ,0.0 ,0.0) )

u = TrialFunction (V) d = u. geometric dimension () v = TestFunction (V)

F = (dtβˆ—dt)βˆ—inner (sigma(u) , epsilon (v) )βˆ—dx + dot(u, v)βˆ—dx βˆ’ (dtβˆ— dt)βˆ—dot( f , v)βˆ—dx βˆ’ (dtβˆ—dt)βˆ—dot (T n , v)βˆ—ds βˆ’ 2.0βˆ— dot(u n , v)βˆ—dx

+ dot( u n 1 , v)βˆ—dx a ,L = lhs (F) , rhs (F)

u store = [0] βˆ— num steps time = [0] βˆ— num steps

index = 0 for n in range( num steps ) : print(”time = %.2f ” % t ) T n . t = t

u = Function (V)

solve (a == L, u, [ bcleft , bc right ]) ugrab = u( l nd /2.0 ,wnd/2.0 , h nd /2.0) ustore [n] = u grab [1]

if (abs(tβˆ’index ) <0.01) :

# print (” WritingΒ Β Β Β Β Β Β  outputΒ Β Β Β  f i l e s . . . ” )

W = TensorFunctionSpace (mesh , ”Lagrange” , 1) stress = lambda βˆ—nabla div (u)βˆ—Identity (d) + muβˆ—( epsilon (

  1. u) + epsilon (u) .T)

index += 1

time [n] = t t+=dt

u n 1 . assign (u n) u n . assign (u)

plt . figure (1) plt . plot (time , u store ) plt . xlabel ( ’ time [ s ] ’ ) plt . ylabel ( ’ VerticalΒ Β Β Β Β Β Β Β  DeflectionΒ Β Β Β Β Β  [m] ’ ) plt . savefig ( ’1 dfig test . png ’ )

# Get period of o s c i l l a t i o n u np = np. array ( u store )

Β 

min args = argrelextrema (u np ,np. greater ) print(”min args” , min args [0]) period = ( time [ min args [ 0 ] [ 1 ] ] βˆ’ time [ min args [ 0 ] [ 0 ] ] ) βˆ—t char nat freq [ i ] = 2βˆ—math. pi /period

print(”Period of Oscillation ” , period , ” seconds”) print(”Natural Frequency : ” , nat freq , ” rad/s”)

plt . figure (2) plt . plot (W, nat freq , ’bβˆ’x ’ ) plt . xlabel ( ’Beam Width [m] ’ ) plt . ylabel ( ’ Natural FrequencyΒ Β Β Β Β  [ rad/s ] ’ ) plt . savefig ( ’1 dfig alpha . png ’ )

Appendix 1d-ii: Code for Problem 1d-ii

”””

PythonΒ Β Β Β Β Β Β  scriptΒ Β Β Β Β  forΒ Β Β Β Β  Part 1d . i iΒ Β Β Β Β  ofΒ Β Β Β  ProjectΒ Β Β Β  2a

OriginalΒ Β Β Β Β Β Β Β Β  Author :Β Β Β Β Β Β Β Β  Vinamra Agrawal

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  JanuaryΒ Β Β  25 ,Β Β Β  2019

Edited By:Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  Omkar Mulekar

Date :Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  FebruaryΒ Β Β Β  28 ,Β Β Β  2019

”””

fromΒ Β  futureΒ Β Β Β Β Β Β Β Β  Β import print function from fenics import βˆ— import matplotlib

matplotlib . use (”Agg”)

import matplotlib . pyplot as plt from ufl import nabla div import math import numpy as np from scipy . signal import argrelextrema

#============================================================== # DefineΒ Β Β Β Β Β  SystemΒ Β Β Β Β Β Β Β Β Β  Properties

#============================================================== length = 1;

W = 0.2; H1 = 0.2; beta = np. linspace (0.2 ,1 ,num=5) print(”beta = ” , beta )

H = beta βˆ— H1

print(”H = ” , H) youngs = 200e9 # Youngs nu = 0.3 # Poisson rho = 7800 # Density

# Lame parameters mu = (youngs)/(2βˆ—(1+nu) ) lambdaΒ Β Β Β Β Β Β  = (nuβˆ—youngs)/((1+nu)βˆ—(1βˆ’2βˆ—nu) )

g = 10

nat freq = [0] βˆ— len( beta )

print(”Beginning Loop . . . ”) for i in range(len( beta ) ) : print(”beta = ” , beta [ i ])

#============================================================== #Β Β Β Β  Dimensionless parameters

#============================================================== lnd = length/length

wnd = W/length hnd = H[ i ]/ length

bar speed = math. sqrt (youngs/rho) t char = length/bar speed t = 0 t i = 0.5

dt = 0.1 num steps = 275

mu nd = mu/youngs lambda nd = lambda /youngs

F = βˆ’100 a = 0.04βˆ— length ; b = 0.4βˆ—H[ i ] ;

tractionapplied = F/(aβˆ—b) traction ndΒ Β Β Β Β Β Β Β Β  = traction applied /youngs

#============================================================ # Boundaries and Geometry

#============================================================ mesh = BoxMesh( Point (0 ,0 ,0) , Point ( l nd , w nd , h nd) ,20 ,6 ,6) V = VectorFunctionSpace (mesh , ’P’ ,1) tol = 1Eβˆ’14

def boundaryleft (x , on boundary) :

return (onboundary and near (x [0] ,0 , tol ) )

def boundary right (x , on boundary) : return on boundary and near (x [0] , l nd , tol )

bcleft = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundaryleft ) bc right = DirichletBC (V, Constant ((0 ,0 ,0) ) , boundary right )

#============================================================ def epsilon (u) : return 0.5βˆ—( nabla grad (u) + nabla grad (u) .T)

def sigma(u) :

return lambda ndβˆ—nabla div (u)βˆ—Identity (d) + mu ndβˆ—( epsilon (u

) + epsilon (u) .T)

#============================================================ # First we solve the problem of a cantelever beam under fixed # load .

#============================================================ u init = TrialFunction (V)

d = u init . geometric dimension () v = TestFunction (V)

f = Constant ((0.0 ,0.0 ,0.0) )

T init = Expression (( ’ 0.0 ’ , ’x [0] >= 0.48βˆ— l && x [0] <= .52βˆ— l && near (x [1] ,w) && x [2] >= 0.3βˆ—h && x [2] <= 0.7βˆ—h? A : 0.0 ’ , ’

0.0 ’ ) , degree=1, l=l nd , w=w nd ,h=h nd , A=traction nd )

F init = inner (sigma( uinit ) , epsilon (v) )βˆ—dx βˆ’ dot( f , v)βˆ—dx βˆ’ dot

( T init , v)βˆ—ds a init , L init = lhs ( F init ) , rhs ( F init )

print(”Solving the i n i t i a l cantelever problem”) u init = Function (V) solve ( a init==L init , u init , [ bc left , bc right ])

down nd = u init ( l nd /2.0 ,w nd/2.0 , h nd /2.0)

w = down nd βˆ— length

print(” I n i t i a lΒ Β Β Β Β Β Β Β Β  Displacement : ” ,w[1])

#============================================================

# Next we useΒ Β Β Β Β Β Β  thisΒ Β Β Β  asΒ Β  i n i t i a lΒ Β Β Β Β  condition ,Β Β Β Β Β  l e tΒ Β Β  theΒ Β Β Β  forceΒ Β Β Β Β  go and

# studyΒ Β Β Β Β  theΒ Β Β Β Β  verticalΒ Β Β Β Β Β Β Β  vibrationsΒ Β Β Β Β  ofΒ Β Β Β  the beam

#============================================================ u n = interpolate (Constant ((0.0 ,0.0 ,0.0) ) ,V) u n 1 = interpolate (Constant ((0.0 ,0.0 ,0.0) ) ,V) u n . assign ( u init )

un 1 . assign ( u init ) Tn = Constant ((0.0 ,0.0 ,0.0) )

u = TrialFunction (V) d = u. geometric dimension () v = TestFunction (V)

F = (dtβˆ—dt)βˆ—inner (sigma(u) , epsilon (v) )βˆ—dx + dot(u, v)βˆ—dx βˆ’ (dtβˆ— dt)βˆ—dot( f , v)βˆ—dx βˆ’ (dtβˆ—dt)βˆ—dot (T n , v)βˆ—ds βˆ’ 2.0βˆ— dot(u n , v)βˆ—dx

+ dot( u n 1 , v)βˆ—dx a ,L = lhs (F) , rhs (F)

u store = [0] βˆ— num steps time = [0] βˆ— num steps

index = 0 for n in range( num steps ) : print(”time = %.2f ” % t ) T n . t = t

u = Function (V)

solve (a == L, u, [ bcleft , bc right ]) ugrab = u( l nd /2.0 ,wnd/2.0 , h nd /2.0) ustore [n] = u grab [1]

if (abs(tβˆ’index ) <0.01) :

W = TensorFunctionSpace (mesh , ”Lagrange” , 1) stress = lambda βˆ—nabla div (u)βˆ—Identity (d) + muβˆ—( epsilon (

  1. u) + epsilon (u) .T)

index += 1

time [n] = t t+=dt

u n 1 . assign (u n) u n . assign (u)

plt . figure (1) plt . plot (time , u store ) plt . xlabel ( ’ time [ s ] ’ ) plt . ylabel ( ’ VerticalΒ Β Β Β Β Β Β Β Β Β Β  DeflectionΒ Β Β Β Β Β  [m] ’ ) plt . savefig ( ’1 dfig test2 . png ’ )

# Get period of o s c i l l a t i o n u np = np. array ( u store )

min args = argrelextrema (u np ,np. greater ) print(”min args” , min args [0]) period = ( time [ min args [ 0 ] [ 1 ] ] βˆ’ time [ min args [ 0 ] [ 0 ] ] ) βˆ—t char nat freq [ i ] = 2βˆ—math. pi /period

print(”Period of Oscillation ” , period , ” seconds”) print(”Natural Frequency : ” , nat freq , ” rad/s”)

plt . figure (2) plt . plot (H, nat freq , ’bβˆ’x ’ ) plt . xlabel ( ’Beam HeightΒ Β Β Β Β Β Β Β Β Β Β  [m] ’ ) plt . ylabel ( ’ Natural FrequencyΒ Β Β Β Β  [ rad/s ] ’ ) plt . savefig ( ’1 dfig beta . png ’ )

  • Project03-y652y1.zip