Shell geometry

Init symbols for sympy


In [31]:
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 [32]:
# 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')
# SMALL_SIZE = 42
# MEDIUM_SIZE = 42
# BIGGER_SIZE = 42
    
# plt.rc('font', size=SMALL_SIZE)          # controls default text sizes
# plt.rc('axes', titlesize=SMALL_SIZE)     # fontsize of the axes title
# plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels
# plt.rc('xtick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
# plt.rc('ytick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
# plt.rc('legend', fontsize=SMALL_SIZE)    # legend fontsize
# plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title

init_printing()

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

Cylindrical coordinates


In [34]:
R, L = symbols("R L", real = True, positive=True)

In [35]:
a1 = pi / 2 + (L / 2 - alpha1)/R

x = (R + alpha3)* cos(a1)
y = alpha2
z = (R + alpha3) * sin(a1)

r = x*N.i + y*N.j + z*N.k

In [36]:
R1=r.diff(alpha1)
R2=r.diff(alpha2)
R3=r.diff(alpha3)

In [37]:
R1


Out[37]:
$$(\frac{1}{R} \left(R + \alpha_{3}\right) \cos{\left (\frac{1}{R} \left(\frac{L}{2} - \alpha_{1}\right) \right )})\mathbf{\hat{i}_{N}} + (\frac{1}{R} \left(R + \alpha_{3}\right) \sin{\left (\frac{1}{R} \left(\frac{L}{2} - \alpha_{1}\right) \right )})\mathbf{\hat{k}_{N}}$$

In [38]:
R2


Out[38]:
$$\mathbf{\hat{j}_{N}}$$

In [39]:
R3


Out[39]:
$$(- \sin{\left (\frac{1}{R} \left(\frac{L}{2} - \alpha_{1}\right) \right )})\mathbf{\hat{i}_{N}} + (\cos{\left (\frac{1}{R} \left(\frac{L}{2} - \alpha_{1}\right) \right )})\mathbf{\hat{k}_{N}}$$

Draw


In [43]:
import plot

%aimport plot

alpha1_x = lambdify([R, L, alpha1, alpha3], x, "numpy")
alpha3_z = lambdify([R, L, alpha1, alpha3], z, "numpy")

R_num = 1/0.8
L_num = 2
h_num = 0.1

x1_start = 0
x1_end = L_num
x3_start = -h_num/2
x3_end = h_num/2

def alpha_to_x(a1, a2, a3):
    x=alpha1_x(R_num, L_num, a1, a3)
    z=alpha3_z(R_num, L_num, a1, a3)
    return x, 0, z
    

plot.plot_init_geometry_2(x1_start, x1_end, x3_start, x3_end, alpha_to_x)



In [61]:
%aimport plot

R3_1=R3.dot(N.i)
R3_3=R3.dot(N.k)

R3_1_x = lambdify([R, L, alpha1, alpha3], R3_1, "numpy")
R3_3_z = lambdify([R, L, alpha1, alpha3], R3_3, "numpy")

def R3_to_x(a1, a2, a3):
    x=R3_1_x(R_num, L_num, a1, a3)
    z=R3_3_z(R_num, L_num, a1, a3)
    return x, 0, z

plot.plot_vectors(x1_start, x1_end, 0, alpha_to_x, R3_to_x)



In [60]:
%aimport plot

R1_1=R1.dot(N.i)
R1_3=R1.dot(N.k)

R1_1_x = lambdify([R, L, alpha1, alpha3], R1_1, "numpy")
R1_3_z = lambdify([R, L, alpha1, alpha3], R1_3, "numpy")

def R1_to_x(a1, a2, a3):
    x=R1_1_x(R_num, L_num, a1, a3)
    z=R1_3_z(R_num, L_num, a1, a3)
    return x, 0, z

plot.plot_vectors(x1_start, x1_end, 0, alpha_to_x, R1_to_x)


Lame params


In [11]:
H1 = 1+alpha3/R
H2=S(1)
H3=S(1)

H=[H1, H2, H3]
DIM=3
dH = zeros(DIM,DIM)
for i in range(DIM):
    dH[i,0]=H[i].diff(alpha1)
    dH[i,1]=H[i].diff(alpha2)
    dH[i,2]=H[i].diff(alpha3)

dH


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