kill(all);

The rollbar is loaded at the C node by the P and the H forces.

Rollbar intrusion has to be monitored at the point B, as long as the reaction forces at the rollbar
supports A and E.
Lateral and longitudinal displacements are requested at C, and the longitudinal displacement at D.

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.

/home/ebertocchi/_shared/ffcd24/002_rollbar/rollbar_ip_oop_dimensions_and_loads.png

linear shape (or auxiliary...) functions in the [0,1] interval;

f(0)=1, f(1)=0
g(0)=0, g(1)=1

such that the linear interpolation along the xi∈[0,1] domain may be cast as

a*f(xi) + b*g(xi)

playing with function assignments commands

pluto:sqrt(3);
pippo( paperino , clarabella ) := pluto*diff(paperino,clarabella)^clarabella;
define( pippobis(paperino,clarabella)  ,  pluto*diff(paperino,clarabella)^clarabella  );
pippoter : lambda( [paperino,clarabella] ,  pluto*diff(paperino,clarabella)^clarabella   );
pluto:sqrt(5);
pippo( sin(t) , t ) ;
pippobis(sin(t),t);
pippoter(sin(t),t);

f(xi) := 1-xi;
g(xi) :=   xi;

accumulation variable for strain energy

U:0;

## Bending and torsional moments 

both in plane and out of plane

### AB beam segment

Moment components at nodes

M1Ap :  fullratsimp( 0*P + 0*YA + 0*XA     - 1*PsiA + 0*F );
M2Ap :  fullratsimp( 0*H + 0*ZA + 1*ThetaA + 0*PhiA + 0*I );
MtAp :  fullratsimp( 0*H + 0*ZA + 0*ThetaA + 1*PhiA + 0*I );

M1Bm :  fullratsimp( 0*P + 0*YA + h*XA     - 1*PsiA + 0*F );
M2Bm :  fullratsimp( 0*H + h*ZA + 1*ThetaA + 0*PhiA + 0*I );
MtBm :  fullratsimp( 0*H + 0*ZA + 0*ThetaA + 1*PhiA + 0*I );

Moment components along the beam segment

M1 : fullratsimp( M1Ap*f(s/h) + M1Bm*g(s/h));
M2 : fullratsimp( M2Ap*f(s/h) + M2Bm*g(s/h));
Mt : fullratsimp( MtAp*f(s/h) + MtBm*g(s/h));

U : U + integrate(      
    + M1^2/2/E/J
    + M2^2/2/E/J
    + Mt^2/2/G/Kt,
    s,0,h
)$

### BC beam segment

Moment components at nodes

M1Bp : M1Bm;
M2Bp : fullratsimp( 0*H + h*ZA + 1*ThetaA + 0*PhiA + 0*I);
MtBp : fullratsimp( 0*H + 0*ZA + 0*ThetaA + 1*PhiA + 0*I);

M1Cm : fullratsimp( 0*P + 0*YA + a*XA -PsiA - (a-h)*F);
M2Cm : fullratsimp( 0*H + a*ZA + 1*ThetaA + 0*PhiA + 0*I);
MtCm : fullratsimp( 0*H + 0*ZA + 0*ThetaA + 1*PhiA + 0*I);

Moment components along the beam segment

M1 : fullratsimp( M1Bp*f(s/(a-h)) + M1Cm*g(s/(a-h)));
M2 : fullratsimp( M2Bp*f(s/(a-h)) + M2Cm*g(s/(a-h)));
Mt : fullratsimp( MtBp*f(s/(a-h)) + MtCm*g(s/(a-h)));

U : U + integrate(      
    + M1^2/2/E/J
    + M2^2/2/E/J
    + Mt^2/2/G/Kt,
    s,0,(a-h)
)$

### CD beam segment

Moment components at nodes

M1Cp : M1Cm ;
M2Cp : fullratsimp( 0*H + 0*ZA + 0*ThetaA - 1*PhiA + 0*I);
MtCp : fullratsimp( 0*H + a*ZA + 1*ThetaA + 0*PhiA + 0*I);

M1Dm : fullratsimp( 0*P - b*YA + a*XA -PsiA - (a-h)*F);
M2Dm : fullratsimp(-b*H + b*ZA + 0*ThetaA - 1*PhiA + 0*I);
MtDm : fullratsimp( 0*H + a*ZA + 1*ThetaA + 0*PhiA + 0*I);

Moment components along the beam segment

M1 : fullratsimp( M1Cp*f(s/b) + M1Dm*g(s/b));
M2 : fullratsimp( M2Cp*f(s/b) + M2Dm*g(s/b));
Mt : fullratsimp( MtCp*f(s/b) + MtDm*g(s/b));

U : U + integrate(      
    + M1^2/2/E/J
    + M2^2/2/E/J
    + Mt^2/2/G/Kt,
    s,0,b
)$

### DE beam segment

Moment components at nodes

M1Dp : M1Dm;
M2Dp : fullratsimp( 0*H - a*ZA - 1*ThetaA + 0*PhiA + 0*I);
MtDp : fullratsimp(-b*H + b*ZA + 0*ThetaA - 1*PhiA + 0*I);

M1Em : fullratsimp( a*P - b*YA + 0*XA -PsiA + h*F);
M2Em : fullratsimp(-a*H + 0*ZA - 1*ThetaA + 0*PhiA - a*I);
MtEm : fullratsimp(-b*H + b*ZA + 0*ThetaA - 1*PhiA + 0*I);

Moment components along the beam segment

M1 : fullratsimp( M1Dp*f(s/a) + M1Em*g(s/a));
M2 : fullratsimp( M2Dp*f(s/a) + M2Em*g(s/a));
Mt : fullratsimp( MtDp*f(s/a) + MtEm*g(s/a));

U : U + integrate(      
    + M1^2/2/E/J
    + M2^2/2/E/J
    + Mt^2/2/G/Kt,
    s,0,a
)$

U : expand(U);

In the following way I may point out the uncoupled nature of in-plane (symm. with respect to the plane
the structure lies on) and out-of-plane (skew-symm. with respect to the plane the structure lies on)
applied loads, fictitious loads and reactions

factor(hessian(U,[P,F,XA,YA,PsiA,H,I,ZA,ThetaA,PhiA]));

## Deflection evaluation at notable points

Let's start evaluating notable deflections

deflections at the A clamped frame end

    uA : diff(U,    XA)$
    vA : diff(U,    YA)$
    wA : diff(U,    ZA)$
thetaA : diff(U,ThetaA)$
  phiA : diff(U,  PhiA)$
  psiA : diff(U,  PsiA)$

deflections to be monitored elsewhere

utB : diff(U,F)$
utC : diff(U,P)$
wtC : diff(U,H)$
wtD : diff(U,I)$

solve the statically indeterminate problem by evaluating the parametrically defined reactions at A

sols : linsolve(
    [
            uA=0,
            vA=0,
            wA=0,
        thetaA=0,
          phiA=0,
          psiA=0
    ],
    [XA,YA,ZA,ThetaA,PhiA,PsiA]
);

first I substitute within the notable displacements expressions the actual value of the reactions at A

[uA,vA,wA,thetaA,phiA,psiA,utB,utC,wtC,wtD] :
ratsimp(
    ev(
        [uA,vA,wA,thetaA,phiA,psiA,utB,utC,wtC,wtD],
        sols
    )
);

second I substitute within the notable displacements expressions the null value of the fictitious loads

[utB,utC,wtC,wtD] : ev( [utB,utC,wtC,wtD] , F=0, I=0 );

[utB,utC,wtC,wtD]$
ratsubst(  r*b,   a,%)$
ratsubst(  q*b,   h,%)$
ratsubst(t*E*J,G*Kt,%)$
factor(%);
[utB,utC,wtC,wtD]:%$

utB;