kill(all);

List of symbols
delta_B  =   d

rollbar intrusion has to be monitored at the point B, as long as the reaction forces at the rollbar supports A and E.
=> d=?, XA=?, YA=?, TA=?

s is a curvilinear abscissa that spans the beam axis from point to point, 
e.g. from A to B, from B to C, etc.

C:\Users\manto\Desktop\20190225_lezione_AAE\fig0.png

l : a - h;

Reaction forces at E may be retrieved based on equilibrium equations

equilibrium equations of the statically determinate structure

eq_tx : + XA + XE - P - F = 0 ;

eq_ty : +YA + YE = 0 ;

eq_rEz : + CA + CE + 0*YE + 0*XE + b*YA + 0*XA - h*F - a*P = 0;

eq_sols : linsolve( [ eq_tx , eq_ty , eq_rEz ] , [ XE , YE , CE ] );

XE : ev(XE , eq_sols )  ;

[ YE , CE ] : ev( [ YE , CE  ] , eq_sols ) ;

sign convention for the bending moment: 
- bending moment is assumed positive if it causes traction at the beam fibers at the frame intrados;
- bending moment is assumed negative if it causes compression at the beam fibers at the frame intrados 
(and traction at the extrados);

linear shape functions in the [0,1] interval;

N0(0)=1, N0(1)=0
N1(0)=0, N1(1)=1

define( N0(pippo)     , 1 - pippo );

define( N1(clarabella) , clarabella );

C:\Users\manto\Desktop\20190225_lezione_AAE\fig1.png

Bending moment definitions

MfAB :
  ( bending moment contributions at the first  extreme A) * N0(xi)
+ ( bending moment contributions at the second extreme B) * N1(xi)

bending moment contributions inserted in the following order
. force P alone
. reaction force YA alone
. reaction force XA alone
. reaction moment CA alone
. fictitious force F alone

here, a monospaced font is required
|i| Courier New
|m|
           |------- first extreme ------|        |------- second extreme -----|
           |                            |        |                            |
           |  P .   YA .   XA . CA .   F|        |  P .   YA .   XA . CA .   F|

MfAB:(                   -CA      )*N0(xi)+(             +h*XA -CA      )*N1(xi);

in order to simplify the expression, I redefine the bending moment based 
on its "expanded" expression.

MfAB : expand(MfAB);

           |------- first extreme ------|        |------- second extreme -----|
           |                            |        |                            |
           |  P .   YA .   XA . CA .   F|        |  F .   YA .   XA . CA .   F|

MfBC:expand(
     (             +h*XA -CA      )*N0(xi)+(            +a*XA  -CA  -F*l)*N1(xi)
);

MfCD:expand(
     (            +a*XA  -CA  -F*l)*N0(xi)+(      -YA*b  +a*XA -CA  -F*l)*N1(xi)
);

MfDE:expand(
     (      -YA*b  +a*XA -CA  -F*l)*N0(xi)+(+a*P -YA*b         -CA  +F*h)*N1(xi)
);

I check the continuity of MfDE with the reaction moment CE

ev(MfDE,xi=1) - (+CE);

OK.

elastic internal energy on the various beam segments

in the following integral, ds = len_AB dxi = h * dxi

UAB : integrate( MfAB^2/2/E/J  * h, xi, 0, 1)$

ds = len_BC * dxi = l*dxi

UBC : integrate( MfBC^2/2/E/J  * l, xi, 0, 1)$

ds = len_CD * dxi = b*dxi

UCD : integrate( MfCD^2/2/E/J  * b, xi, 0, 1)$

ds = len_DE * dxi = a*dxi

UDE : integrate( MfDE^2/2/E/J  * a, xi, 0, 1)$

total elastic internal energy

U : ratsimp ( UAB + UBC + UCD + UDE );

Application of the Castigliano's theorem for obtaining the displacements and the rotation at A, 
in particular:
. displacement x at A : uA
. displacement y at A : vA
. rotation (outward z) at A : rA
displacements and rotations are positive if oriented as the associated force/moment, 
see Figure above.

coordinates:    x     y    z
displacements:  u     v    w
rotations:                 r
                psi  phi  theta

forces:         X     Y    Z
                U     V    W
moments:                   C
                Psi  Phi  Theta  

uA : diff( U , XA);

vA : diff( U , YA);

rA : diff( U , CA);

Kinematic congruence with respect to the clamp constraint in A is to be enforced, 
by the mean of a system of (linear) equations. 

A system of equations in maxima is expressed in the form of list of equations.

kineq : [ uA = 0 , vA = 0 , rA ];

The third element of the list is an expression missing the equality symbol. 
In this case, such expression is implicitly assumed to be nullified 
(implicit "=0" if "=" is missing).  

sols : linsolve( kineq , [ XA,YA,CA ] );

I redefine U as a function of P and F alone, by evaluating U under the "sols" hypotheses 
which bond the XA,YA,CA reactions to their values that nullify 
the deflections at the constraint in A. 

U : ratsimp( ev( U , sols) );

now, all the P and F contributions to the internal energy U are made explicit;
before the passage above, some of the contributions were hidden within 
the reaction forces and moments XA,YA,CA, that WERE NOT declared functions of P and F.

then, the displacement at the B point is evaluated through the Castigliano Theorem

dB : diff( U , F );

an expression that varies proportionally with P and F is returned; 
the "fictitios" nature of F may now be enforced

dB : ratsimp ( ev (dB , F=0)  );

Reactions at A and E can then be defined as a function of F alone

[CA,XA,YA] : 
    ev( 
        ev( 
            [CA,XA,YA] , 
            sols , F=0 
        ),
    sols,F=0
)
;

[CE,XE,YE] : ev( [CE,XE,YE] , sols, F=0 , infeval);

deflection at the C point

dC : fullratsimp( ev(dB,h=a) );

reference structure: single upright member

Mfref:P*s$

Uref:integrate(Mfref^2/2/E/J,s,0,a)$

dCref : diff(Uref,P);

stiffness ratio between the rollbar and the reference structure

kratio : fullratsimp ( dCref/dC );

kratio : fullratsimp( ev (kratio, b=ba_ratio*a) );

wxplot2d( kratio, [ba_ratio,0.01,100],[logx]);