### Prolegomena

We need 

- a short list of `sympy` functions, 
- the ability to pretty-print `sympy`'s objects,
- some additional display functions from `IPython`.
- some names for some symbols to be used in symbolic expressions.


```
from sympy import symbols, Rational as rat, Eq, latex
%load_ext sympyprinting
from IPython.core.display import Image, display, Math, Latex
m, k, p, L, u, a, delta = symbols('m k p_0 L u_G a_G delta')
d = delta*u
```

# Rigid Bodies


```
Image(filename='figures/rigid.png')
```

### Centres of Instantaneous Rotation

The CIR of left body, $\Omega_1$, is at the intersection of an horizontal line in A and a vertical line
in C, hence the coordinates of $\Omega_1$ are $(L,L)$ if we put the origin in B.

The CIR of the right body, $\Omega_2$, is at the intersection of an horizontal line in G and a $135^o$ line
going from D, internal hinge, to $\Omega_1$, hence the coordinates of $\Omega_2$ are $(0,2L)$.

The rotation $\theta_2$ is given in terms of $u_G$ by $\theta_2\\,3L=u_G$, the rotation $\theta_1$ is
$\theta_1=2\theta_2$.

### Objects

In our problem, we have two type of objects, 1) the rotation of a rigid body characterized by the coordinates
of the centre of rotation and the angle of rotation and 2) the significant points on a rigid body,
characterized by the rotation, the attached mass, the attached spring etc.

We define two simple classes that model the behaviour of our objects.


```
class Centre:
    def __init__(self, x, y, rot):
        self.x = x ; self.y = y ; self.r = rot
        
class Point:
    def __init__(self, x, y, centre, mass=0, kx=0, ky=0, px=0, py=0, length=0):
        if kx*ky: raise NameError('Only one stiffness can be different from zero.')
        j_r = mass*length**2/12
        ux = -(y-centre.y)*centre.r
        uy = +(x-centre.x)*centre.r
        self.mvw = -a*d*(mass*(ux*ux+uy*uy)+j_r*centre.r**2)
        self.kvw = -u*d*(kx*ux**2+ky*uy**2)
        self.pvw = +d*(px*ux+py*uy)
```

#### Specifying the centres of rotation

The centres of rotation and the rotations, for the left and the right rigid body, are
defined as follows (the origin of coordinates is in B, note that the rotations are divided
by the unit displacement):


```
w1 = Centre( L, L,   rat(2,3)/L)
w2 = Centre( 0, 2*L, rat(1,3)/L)
```

#### Specifying the relevant points of the rigid bodies

The significant points are A (external force), B (point mass), D (spring),
F (both spring and center of mass of the vertical segment of DEFG bar) and
GDE (centre of mass of the horizontal segment).

A Point object is initialized for each significant point, with the relevant
quantities explicited.


```
A = Point( 0, L, w1, py=-p)
B = Point( 0, 0, w1, mass=3*m)
D = Point( 2*L, 0, w1, ky=k)
F = Point( 3*L, L, w2, kx=k, mass=2*m, length=2*L)
GDE = Point( rat(5,2)*L, 0, w2, mass=m, length=L)
```

### Computing the work of different forces for a virtual displacement

We need the sum of virtual works for the different types of forces in the equation of the virtual
displacements, here it is an handy function to do it...


```
def sum_vw(which):
    return sum([getattr(point,which) for point in (A,B,D,F,GDE)])
```

We use our handy function to compute the individual contributions to the virtual work.


```
vw_inertial_f = sum_vw('mvw')
display(Math(r'\delta W_I = '+latex(vw_inertial_f/d)+'\\,'+latex(d)+','))
vw_elastic_f  = sum_vw('kvw')
display(Math(r'\delta W_S = '+latex(vw_elastic_f/d)+'\\,'+latex(d)+','))
vw_external_f = sum_vw('pvw')
display(Math(r'\delta W_E = '+latex(vw_external_f/d)+'\\,'+latex(d)+'.'))
```


$$\delta W_I = - \frac{55}{9} a_{G} m\,\delta u_{G},$$



$$\delta W_S = - \frac{5}{9} k u_{G}\,\delta u_{G},$$



$$\delta W_E = \frac{2}{3} p_{0}\,\delta u_{G}.$$


### The equation of dynamic equilibrium

The sum of the individual contribution to the virtual work, i.e., the total virtual work, is zero for a rigid body in equilibrium or, equivalently,

<center>$-\delta W_I -\delta W_S = \delta W_E$</center>

Simplyfing $\delta u_g$ we have


```
display(Eq( -vw_inertial_f/d - vw_elastic_f/d, vw_external_f/d))
```

#### The generalized parameters


```
display(Latex(r'The generalized mass is $m^* = %s$, '%latex(-vw_inertial_f/d/a) +
              r'the generalized stiffness is $k^* = %s$, '%latex(-vw_elastic_f/d/u) +
              r'the generalized load is $p^* = %s\,\mathrm{f}(t)$.'%latex(vw_external_f/d)))
```


The generalized mass is $m^* = \frac{55}{9} m$, the generalized stiffness is $k^* = \frac{5}{9} k$, the generalized load is $p^* = \frac{2}{3} p_{0}\,\mathrm{f}(t)$.


e71a4539cff5b9ecfb0a250a586771e0d544602a
ipynb
Jupyter Notebook
nb/04_Rigid_Bodies.ipynb
shishitao/boffi_dynamics
365f16d047fb2dbfc21a2874790f8bef563e0947
MIT
nb/04_Rigid_Bodies.ipynb
shishitao/boffi_dynamics
365f16d047fb2dbfc21a2874790f8bef563e0947
MIT
nb/04_Rigid_Bodies.ipynb
shishitao/boffi_dynamics
365f16d047fb2dbfc21a2874790f8bef563e0947
MIT
2019-06-23T12:32:39.000Z
2021-08-15T18:33:55.000Z
Qwen/Qwen-72B
1. YES
2. YES