Linear 2D solution

Init symbols for sympy


In [2]:
from sympy import *
from geom_util import *
from sympy.vector import CoordSys3D
import matplotlib.pyplot as plt
import sys
sys.path.append("../")

%matplotlib inline

%reload_ext autoreload
%autoreload 2
%aimport geom_util

In [3]:
# Any tweaks that normally go in .matplotlibrc, etc., should explicitly go here
%config InlineBackend.figure_format='retina'
plt.rcParams['figure.figsize'] = (12, 12)

plt.rc('text', usetex=True)
    
plt.rc('font', family='serif')

init_printing()

In [4]:
N = CoordSys3D('N')
alpha1, alpha2, alpha3 = symbols("alpha_1 alpha_2 alpha_3", real = True, positive=True)
A,K,rho = symbols("A K rho")

In [5]:
B=Matrix([[0, 1/(A*(K*alpha3 + 1)), 0, 0, 0, 0, 0, 0, K/(K*alpha3 + 1), 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1/(A*(K*alpha3 + 1)), 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [-K/(K*alpha3 + 1), 0, 0, 0, 0, 0, 0, 0, 0, 1/(A*(K*alpha3 + 1)), 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]])
B


Out[5]:
$$\left[\begin{array}{cccccccccccc}0 & \frac{1}{A \left(K \alpha_{3} + 1\right)} & 0 & 0 & 0 & 0 & 0 & 0 & \frac{K}{K \alpha_{3} + 1} & 0 & 0 & 0\\0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & \frac{1}{A \left(K \alpha_{3} + 1\right)} & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\- \frac{K}{K \alpha_{3} + 1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{A \left(K \alpha_{3} + 1\right)} & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1\end{array}\right]$$

In [6]:
E=zeros(6,9)
E[0,0]=1
E[1,4]=1
E[2,8]=1
E[3,1]=1
E[3,3]=1
E[4,2]=1
E[4,6]=1
E[5,5]=1
E[5,7]=1
E


Out[6]:
$$\left[\begin{matrix}1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0\end{matrix}\right]$$

In [7]:
mu = Symbol('mu')
la = Symbol('lambda')
C_tensor = getIsotropicStiffnessTensor(mu, la)
C = convertStiffnessTensorToMatrix(C_tensor)
C


Out[7]:
$$\left[\begin{matrix}\lambda + 2 \mu & \lambda & \lambda & 0 & 0 & 0\\\lambda & \lambda + 2 \mu & \lambda & 0 & 0 & 0\\\lambda & \lambda & \lambda + 2 \mu & 0 & 0 & 0\\0 & 0 & 0 & \mu & 0 & 0\\0 & 0 & 0 & 0 & \mu & 0\\0 & 0 & 0 & 0 & 0 & \mu\end{matrix}\right]$$

In [8]:
S=B.T*E.T*C*E*B*A*(1+alpha3*K)
S


Out[8]:
$$\left[\begin{array}{cccccccccccc}\frac{A K^{2} \mu}{K \alpha_{3} + 1} & 0 & 0 & - A K \mu & 0 & 0 & 0 & 0 & 0 & - \frac{K \mu}{K \alpha_{3} + 1} & 0 & 0\\0 & \frac{\lambda + 2 \mu}{A \left(K \alpha_{3} + 1\right)} & 0 & 0 & 0 & 0 & \lambda & 0 & \frac{K \left(\lambda + 2 \mu\right)}{K \alpha_{3} + 1} & 0 & 0 & \lambda\\0 & 0 & A \mu \left(K \alpha_{3} + 1\right) & 0 & 0 & \mu & 0 & 0 & 0 & 0 & 0 & 0\\- A K \mu & 0 & 0 & A \mu \left(K \alpha_{3} + 1\right) & 0 & 0 & 0 & 0 & 0 & \mu & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & \mu & 0 & 0 & \frac{\mu}{A \left(K \alpha_{3} + 1\right)} & 0 & 0 & 0 & 0 & 0 & 0\\0 & \lambda & 0 & 0 & 0 & 0 & A \left(\lambda + 2 \mu\right) \left(K \alpha_{3} + 1\right) & 0 & A K \lambda & 0 & 0 & A \lambda \left(K \alpha_{3} + 1\right)\\0 & 0 & 0 & 0 & 0 & 0 & 0 & A \mu \left(K \alpha_{3} + 1\right) & 0 & 0 & A \mu \left(K \alpha_{3} + 1\right) & 0\\0 & \frac{K \left(\lambda + 2 \mu\right)}{K \alpha_{3} + 1} & 0 & 0 & 0 & 0 & A K \lambda & 0 & \frac{A K^{2} \left(\lambda + 2 \mu\right)}{K \alpha_{3} + 1} & 0 & 0 & A K \lambda\\- \frac{K \mu}{K \alpha_{3} + 1} & 0 & 0 & \mu & 0 & 0 & 0 & 0 & 0 & \frac{\mu}{A \left(K \alpha_{3} + 1\right)} & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & A \mu \left(K \alpha_{3} + 1\right) & 0 & 0 & A \mu \left(K \alpha_{3} + 1\right) & 0\\0 & \lambda & 0 & 0 & 0 & 0 & A \lambda \left(K \alpha_{3} + 1\right) & 0 & A K \lambda & 0 & 0 & A \left(\lambda + 2 \mu\right) \left(K \alpha_{3} + 1\right)\end{array}\right]$$

In [9]:
M=Matrix([[rho, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, rho, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, rho, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
M=M*A*(1+alpha3*K)
M


Out[9]:
$$\left[\begin{array}{cccccccccccc}A \rho \left(K \alpha_{3} + 1\right) & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & A \rho \left(K \alpha_{3} + 1\right) & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & A \rho \left(K \alpha_{3} + 1\right) & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\end{array}\right]$$

Cartesian coordinates


In [25]:
import fem.geometry as g
import fem.model as m
import fem.material as mat
import fem.solver as s
import fem.mesh as me
import plot

stiffness_matrix_func = lambdify([A, K, mu, la, alpha3], S, "numpy")
mass_matrix_func = lambdify([A, K, rho, alpha3], M, "numpy")


def stiffness_matrix(material, geometry, x1, x2, x3):
    A,K = geometry.get_A_and_K(x1,x2,x3)
    return stiffness_matrix_func(A, K, material.mu(), material.lam(), x3)

def mass_matrix(material, geometry, x1, x2, x3):
    A,K = geometry.get_A_and_K(x1,x2,x3)
    return mass_matrix_func(A, K, material.rho, x3)



def generate_layers(thickness, layers_count, material):
    layer_top = thickness / 2
    layer_thickness = thickness / layers_count
    layers = set()
    for i in range(layers_count):
        layer = m.Layer(layer_top - layer_thickness, layer_top, material, i)
        layers.add(layer)
        layer_top -= layer_thickness
    return layers


def solve(geometry, thickness, linear, N_width, N_height):
    layers_count = 1
    layers = generate_layers(thickness, layers_count, mat.IsotropicMaterial.steel())
    model = m.Model(geometry, layers, m.Model.FIXED_BOTTOM_LEFT_RIGHT_POINTS)
    mesh = me.Mesh.generate(width, layers, N_width, N_height, m.Model.FIXED_BOTTOM_LEFT_RIGHT_POINTS)
    lam, vec = s.solve(model, mesh, stiffness_matrix, mass_matrix)
    return lam, vec, mesh, geometry


width = 2
curvature = 0.8
thickness = 0.05

corrugation_amplitude = 0.05
corrugation_frequency = 20

geometry = g.General(width, curvature, corrugation_amplitude, corrugation_frequency)

N_width = 50
N_height = 4


lam, vec, mesh, geometry = solve(geometry, thickness, False, N_width, N_height)
results = s.convert_to_results(lam, vec, mesh, geometry)

results_index = 0
    
plot.plot_init_and_deformed_geometry_in_cartesian(results[results_index], 0, width, -thickness / 2, thickness / 2, 0, geometry.to_cartesian_coordinates)    
    
to_print = 20
if (len(results) < to_print):
    to_print = len(results)
    
for i in range(to_print):
    print(results[i].rad_per_sec_to_Hz(results[i].freq))


[  5.22867320e+05   2.41000089e+06   9.46314037e+06   1.39684569e+07
   3.39403688e+07   4.13833545e+07   8.64595554e+07   9.91365537e+07
   1.84211856e+08   2.07238678e+08   3.20580339e+08   3.77551198e+08
   5.53146721e+08   5.83139752e+08   8.42012048e+08   8.97675668e+08
   1.17800300e+09   1.32194444e+09   1.63061687e+09   1.79520567e+09
   2.23777577e+09   2.32487262e+09   2.92979827e+09   2.99831885e+09
   3.62585624e+09   3.89303547e+09   4.43288463e+09   4.88949342e+09
   5.38751130e+09   5.94436503e+09   6.53937724e+09   7.05224664e+09
   7.90075191e+09   8.23746439e+09   9.45431236e+09   9.51754050e+09
   1.09034035e+10   1.11897363e+10   1.24055344e+10   1.31030937e+10
   1.40380545e+10   1.51858313e+10   1.58253400e+10   1.73900543e+10
   1.78333585e+10   1.96057054e+10   2.01897197e+10   2.18855901e+10
   2.28565253e+10   2.43108960e+10   2.57633920e+10   2.69021053e+10
   2.88953022e+10   2.96613816e+10   3.22482399e+10   3.25835574e+10
   3.56585025e+10   3.58133108e+10   3.88705428e+10   3.95579407e+10
   4.20313585e+10   4.21847193e+10   4.23257497e+10   4.28454421e+10
   4.32015891e+10   4.36086987e+10   4.42584041e+10   4.51188895e+10
   4.59692147e+10   4.62396322e+10   4.74261749e+10   4.78013111e+10
   4.91791298e+10   5.00296720e+10   5.04255503e+10   5.17803119e+10
   5.27118684e+10   5.40575797e+10   5.49410043e+10   5.50364020e+10
   5.74579634e+10   5.80927020e+10   5.87746116e+10   6.02452746e+10
   6.11760950e+10   6.32319959e+10   6.33334947e+10   6.45381343e+10
   6.64008258e+10   6.66989439e+10   6.86173361e+10   6.95125487e+10
   7.02313188e+10   7.19769224e+10   7.20529027e+10   7.35195614e+10
   7.45470112e+10   7.54451517e+10   7.57677588e+10   7.61810024e+10
   7.92064013e+10   8.18573794e+10   8.32473527e+10   8.67164177e+10
   8.88925447e+10   9.11516302e+10   9.55819463e+10   9.57915639e+10
   1.00710349e+11   1.02650353e+11   1.05949080e+11   1.09931073e+11
   1.11617534e+11   1.16784531e+11   1.18338911e+11   1.23117627e+11
   1.26179529e+11   1.29573601e+11   1.34424605e+11   1.35976594e+11
   1.36902407e+11   1.36912190e+11   1.37186587e+11   1.37204072e+11
   1.37580037e+11   1.37637844e+11   1.38238486e+11   1.38312429e+11
   1.38941796e+11   1.38975869e+11   1.39767592e+11   1.40080788e+11
   1.40823931e+11   1.41010384e+11   1.41509968e+11   1.42145366e+11
   1.42915667e+11   1.43030172e+11   1.43419764e+11   1.43618846e+11
   1.44119836e+11   1.44654925e+11   1.45428679e+11   1.45935927e+11
   1.46449470e+11   1.46588788e+11   1.46764209e+11   1.47631848e+11
   1.51096653e+11   1.51596736e+11   1.51606205e+11   1.55342461e+11
   1.57092068e+11   1.60351084e+11   1.61335529e+11   1.62140697e+11
   1.67442924e+11   1.68705820e+11   1.69136970e+11   1.73287663e+11
   1.76384038e+11   1.77787288e+11   1.79733819e+11   1.83657626e+11
   1.86132150e+11   1.86834162e+11   1.89620760e+11   1.92871807e+11
   1.94119069e+11   1.94129304e+11   1.94919060e+11   1.95001148e+11
   1.96268299e+11   1.97037985e+11   1.98880238e+11   1.99342225e+11
   2.01746590e+11   2.02338767e+11   2.02761351e+11   2.04410012e+11
   2.06120911e+11   2.06946879e+11   2.08891633e+11   2.10748653e+11
   2.11092554e+11   2.13152061e+11   2.14368294e+11   2.15192109e+11
   2.16388662e+11   2.18932204e+11   2.20510279e+11   2.20753961e+11
   2.21721752e+11   2.22158029e+11   2.25404713e+11   2.26807528e+11
   2.29425177e+11   2.32288350e+11   2.32443790e+11   2.35449889e+11
   2.37547231e+11   2.40531551e+11   2.41411545e+11   2.44087443e+11
   2.46459339e+11   2.47046509e+11   2.51149065e+11   2.51875478e+11
   2.53928953e+11   2.55639364e+11   2.57199337e+11   2.59480675e+11
   2.60308072e+11   2.62634680e+11   2.62928352e+11   2.63808573e+11
   2.65158857e+11   2.68944275e+11   2.74057122e+11   2.74963772e+11
   2.81269232e+11   2.82851712e+11   2.87855318e+11   2.90821590e+11
   2.94604153e+11   2.97828003e+11   3.01211209e+11   3.03436909e+11
   3.06892054e+11   3.07668039e+11   3.14276440e+11   3.21020112e+11
   3.27759758e+11   3.34506064e+11   3.41376901e+11   3.48530649e+11
   3.56069344e+11   3.63999312e+11   3.72258342e+11   3.80753096e+11
   3.89376490e+11   3.98006950e+11   4.06493028e+11   4.14605240e+11
   4.21858349e+11   4.27192844e+11   4.30690779e+11   4.34782260e+11
   4.40360185e+11   4.46101944e+11   4.51199134e+11   4.55292873e+11
   4.58089682e+11   4.63604925e+11   4.63614322e+11   5.11946433e+11
   5.11972650e+11   5.12018452e+11   5.12086974e+11   5.12182562e+11
   5.12310738e+11   5.12478178e+11   5.12692691e+11   5.12963210e+11
   5.13299789e+11   5.13713611e+11   5.14217003e+11   5.14823459e+11
   5.15547666e+11   5.16405537e+11   5.17414248e+11   5.18592274e+11
   5.19959415e+11   5.21536827e+11   5.23347035e+11   5.25413923e+11
   5.27762715e+11   5.30419906e+11   5.33413167e+11   5.36771186e+11
   5.40523450e+11   5.44699939e+11   5.49330728e+11   5.54445462e+11
   5.60072693e+11   5.66239060e+11   5.72968274e+11   5.80279907e+11
   5.88187958e+11   5.96699191e+11   6.05811233e+11   6.15510426e+11
   6.25769378e+11   6.36544054e+11   6.47769789e+11   6.59353778e+11
   6.71147945e+11   6.78591425e+11   6.78938848e+11   6.79544260e+11
   6.80318479e+11   6.81439401e+11   6.82300662e+11   6.83376081e+11
   6.84257859e+11   6.86198797e+11   6.87960783e+11   6.90341319e+11
   6.92346661e+11   6.95215842e+11   6.95388478e+11   6.98717699e+11
   7.01184337e+11   7.04866530e+11   7.06320393e+11   7.09427051e+11
   7.11832022e+11   7.16281034e+11   7.17790298e+11   7.21620359e+11
   7.24106367e+11   7.29362751e+11   7.29522962e+11   7.35027162e+11
   7.36954223e+11   7.41508909e+11   7.43299576e+11   7.47860498e+11
   7.49472546e+11   7.52766000e+11   7.55784213e+11   7.60955999e+11
   7.66168310e+11   7.71515238e+11   7.75460391e+11   7.75708270e+11
   7.75810224e+11   7.76482625e+11   7.76536849e+11   7.76795731e+11
   7.77808745e+11   7.78074431e+11   7.79554702e+11   7.80065457e+11
   7.81604929e+11   7.82357370e+11   7.82437927e+11   7.84853548e+11
   7.85211257e+11   7.87216459e+11   7.88051871e+11   7.88610834e+11
   7.91554661e+11   7.92079914e+11   7.92772986e+11   7.95581025e+11
   7.95695280e+11   7.97932880e+11   7.99611329e+11   7.99937160e+11
   8.02159564e+11   8.04115787e+11   8.04208620e+11   8.06034212e+11
   8.08103429e+11   8.08439805e+11   8.09741388e+11   8.11466630e+11
   8.11898799e+11   8.13294841e+11   8.13873285e+11   8.14654264e+11
   8.15306109e+11   8.15334430e+11   8.18305108e+11   8.22848121e+11
   8.27825786e+11   8.33192859e+11   8.38945610e+11   8.45089192e+11
   8.51631039e+11   8.58578315e+11   8.65936405e+11   8.73707670e+11
   8.81890227e+11   8.90476640e+11   8.99452496e+11   9.08794851e+11
   9.18470576e+11   9.28434641e+11   9.38628443e+11   9.48978294e+11
   9.59394252e+11   9.69769524e+11   9.79980711e+11   9.89889169e+11
   9.99343755e+11   1.00818509e+12   1.01625130e+12   1.02338481e+12
   1.02943970e+12   1.03428850e+12   1.03782780e+12   1.03998196e+12
   1.22261243e+12   1.22261243e+12   1.79167980e+12   1.79182122e+12
   1.79205726e+12   1.79238847e+12   1.79281555e+12   1.79333944e+12
   1.79396125e+12   1.79468226e+12   1.79550391e+12   1.79642780e+12
   1.79745561e+12   1.79858913e+12   1.79983018e+12   1.80118056e+12
   1.80264205e+12   1.80421626e+12   1.80590461e+12   1.80770820e+12
   1.80962768e+12   1.81166314e+12   1.81381395e+12   1.81607854e+12
   1.81845420e+12   1.82093684e+12   1.82352073e+12   1.82619819e+12
   1.82895930e+12   1.83179156e+12   1.83467963e+12   1.83760500e+12
   1.84054586e+12   1.84347693e+12   1.84636961e+12   1.84919222e+12
   1.85191061e+12   1.85448907e+12   1.85689175e+12   1.85908440e+12
   1.86103658e+12   1.86272418e+12   1.86413202e+12   1.86525626e+12
   1.86610610e+12   1.86670446e+12   1.86708698e+12   1.86729918e+12
   1.86739178e+12   1.86740931e+12   1.86741451e+12   2.47581732e+12
   2.47581732e+12   2.71390910e+12   2.71400810e+12   2.71417345e+12
   2.71440563e+12   2.71470536e+12   2.71507354e+12   2.71551125e+12
   2.71601981e+12   2.71660068e+12   2.71725555e+12   2.71798626e+12
   2.71879484e+12   2.71968345e+12   2.72065442e+12   2.72171019e+12
   2.72285327e+12   2.72408626e+12   2.72541175e+12   2.72683228e+12
   2.72835031e+12   2.72996808e+12   2.73168755e+12   2.73351029e+12
   2.73543731e+12   2.73746892e+12   2.73960455e+12   2.74184252e+12
   2.74417985e+12   2.74661197e+12   2.74913250e+12   2.75173294e+12
   2.75440247e+12   2.75712768e+12   2.75989244e+12   2.76267778e+12
   2.76546195e+12   2.76822056e+12   2.77092693e+12   2.77355261e+12
   2.77606808e+12   2.77844361e+12   2.78065021e+12   2.78266061e+12
   2.78445018e+12   2.78599760e+12   2.78728534e+12   2.78829972e+12
   2.78903079e+12   2.78947192e+12]
115.084247095
247.074959773
489.595900613
594.83203262
927.210646954
1023.84208466
1479.8804424
1584.66344723
2160.12518438
2291.16062873
2849.63065226
3092.48824904
3743.17647377
3843.31919877
4618.26962709
4768.47882394
5462.52363411
5786.64357333
6426.81941557
6743.37384638