-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathwire.fee
More file actions
75 lines (62 loc) · 2.45 KB
/
Copy pathwire.fee
File metadata and controls
75 lines (62 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
DEFAULT_ARGUMENT_VALUE 1 hex # mesh, either hex or unstruct
DEFAULT_ARGUMENT_VALUE 2 copper # material, either copper or aluminum
l = 0.5*303e-3 # cantilever wire length [ m ]
d = 1.948e-3 # wire diameter [ m ]
# material properties for copper
m_copper = 0.5*8.02e-3 # total mass (half the measured because of the experimental disposition) [ kg ]
E_copper = 2*66.2e9 # [ Pa ] Young modulus (twice because the factor-two error)
# material properties for aluminum
m_aluminum = 0.5*2.67e-3
E_aluminum = 2*40.2e9
# problem’s properties
E = E_$2 # [ MPa ]
rho = m_$2/(pi*(0.5*d)^2*l) # [ kg / m^3 ] density = mass (measured) / volume
nu = 0 # Poisson’s ratio (does not appear in Euler-Bernoulli)
# analytical solution
VECTOR kl[5]
VECTOR f_euler[5]
# first compute the first five roots ok cosh(kl)*cos(kl)+1
kl[i] = root(cosh(t)*cos(t)+1, t, 3*i-2,3*i+1)
# then compute the frequencies according to Euler-Bernoulli
# note that we need to use SI inside the square root
A = pi * (d/2)^2
I = pi/4 * (d/2)^4
f_euler[i] = 1/(2*pi) * kl(i)^2 * sqrt((E * I)/(rho * A * l^4))
# now compute the modes numerically with FEM
# note that each mode is duplicated as it is degenerated
READ_MESH wire-$1.msh DIMENSIONS 3
PROBLEM modal MODES 10
BC fixed fixed
SOLVE_PROBLEM
# github-formatted markdown table
# compare the frequencies
PRINT " \$n\$ | FEM [Hz] | Euler [Hz] | Relative difference [%]"
PRINT ":------:|:-------------:|:-------------:|:--------------:"
PRINT_VECTOR SEP "\t|\t" i %.4g f(2*i-1) f_euler %.2f 100*(f_euler(i)-f(2*i-1))/f_euler(i)
PRINT
PRINT ": $2 wire over $1 mesh"
# commonmark table
PRINT
PRINT " \$n\$ | \$L\$ | \$\\Gamma\$ | \$\\mu\$ | \$M\$"
PRINT ":------:+:---------------------:+:---------------------:+:-------------:+:--------------:"
PRINT_VECTOR SEP "\t|\t" i "%+.1e" L Gamma "%.4f" mu Mu
PRINT
PRINT ": $2 wire over $1 mesh, participation and excitation factors \$L\$ and \$\\Gamma\$, effective per-mode and cumulative mass fractions \$\\mu\$ and \$M\$"
# write the modes into a vtu file
WRITE_MESH wire-$1-$2.vtu \
VECTOR u1 v1 w1 VECTOR u2 v2 w2 VECTOR u3 v3 w3 \
VECTOR u4 v4 w4 VECTOR u5 v5 w5 VECTOR u6 v6 w6 \
VECTOR u7 v7 w7 VECTOR u8 v8 w8 VECTOR u9 v9 w9 VECTOR u10 v10 w10
# and into a msh file
WRITE_MESH wire-$1-$2.msh {
u1 v1 w1
u2 v2 w2
u3 v3 w3
u4 v4 w4
u5 v5 w5
u6 v6 w6
u7 v7 w7
u8 v8 w8
u9 v9 w9
u10 v10 w10
}