nodes are numbered as 1234 departing from the clamped end at which unknown reactions are parametrically defined.

kill(all);

To define linear functions along segments, I use a normalized curvilinear abscissa xi, which
it is 0 at the first point of the segment (A), and 1 at the final point (B).

NA : xi;

NB : 1-xi;

Both the external loads and the constraint reactions act in-plane with respect to the plane the structure segments lay in, hence torsional moment is zero, and the out-of-plane component of the bending moment is also zero.

The in-plane component of Mf is assumed positive if the frame inner beam fibers are stretched

segment 12, 1=A, 2=B

Mf : S * ( 0*NA +b*NB) +
     R * ( 0*NA +0*NB) +
     T * (-1*NA -1*NB) +
     F * ( 0*NA +0*NB);

here we have

dl = b*dxi

U12 : integrate( Mf^2/2/E/J * b ,xi,0,1);

segment 23, 2=A, 3=B

Mf : S * ( b*NA +b*NB) +
     R * ( 0*NA -a*NB) +
     T * (-1*NA -1*NB) +
     F * ( 0*NA +0*NB);

here we have
dl = a*dxi

U23 : integrate( Mf^2/2/E/J * a ,xi,0,1);

segment 34, 3=A, 4=B

Mf : S * ( b*NA +0*NB) +
     R * (-a*NA -a*NB) +
     T * (-1*NA -1*NB) +
     F * ( 0*NA +b*NB);

here we have
dl = b*dxi

U34 : integrate( Mf^2/2/E/J * b ,xi,0,1);

elastic strain energy

U : fullratsimp(U12+U23+U34);

I evaluate the [generalized] deflections associated to the three constraint reactions

eq : [
diff(U,S)=0,
diff(U,R)=0,
diff(U,T)=0
];

and I set them to zero

sols:linsolve(eq,[S,R,T]);

I proceed with a numerical evaluation

dim:	[a=800,b=1000,c=600,F=1000,C=500000,
	 E=210000,G=210000/2/(1+3/10),
	 J=(40^4-36^4)*%pi/64,Kt=(40^4-36^4)*%pi/32];

ev(sols,dim,numer,infeval);