230 likes | 364 Views
1. 2. N. AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES. D. Todd Griffith, Andrew J. Sinclair, James D. Turner, John E. Hurtado, and John L. Junkins Texas A&M University Department of Aerospace Engineering College Station, TX 77840.
E N D
1 2 N AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES D. Todd Griffith, Andrew J. Sinclair, James D. Turner, John E. Hurtado, and John L. Junkins Texas A&M University Department of Aerospace Engineering College Station, TX 77840 Texas A&M University, Department of Aerospace Engineering
Presentation Outline • Introduction and previous work • Overview of automatic differentiation by OCEA • Equation of motion formulation using automatic differentiation • A new algorithm for numerical integration • Examples Texas A&M University, Department of Aerospace Engineering
Introduction and previous work • Work on multibody dynamics dates back to around 1960’s • Multibody dynamics is a mature field; many codes and many books have been written in the area • Authors include: Shabana, Scheihlen, Garcia de Jalon • In general, many methods exist for equation of motion generation. Typically, Lagrange’s equations, Kane’s equations, or Newton/Euler Methods employed • The primary question is which method for generation of equations of motion is most suitable for problem complexity, generality desired, computational issues, and computational resources to name a few. Texas A&M University, Department of Aerospace Engineering
Lagrangian: T, V: kinetic and potential energy q: generalized coordinates Q: generalized force C: constraint matrix l: Lagrange multipliers subject to Equation of motion formulation using automatic differentiation • Lagrange’s equations: Of course, many choices for equation of motion formulation exist; however, the utility of automatic differentiation is immediately seen for implementing Lagrange’s Equations………………... Texas A&M University, Department of Aerospace Engineering
Presentation Outline • Introduction and previous work • Overview of automatic differentiation by OCEA • Equation of motion formulation using automatic differentiation • A new algorithm for numerical integration • Examples Texas A&M University, Department of Aerospace Engineering
Overview of automatic differentiation by OCEA(1) • OCEA (Object Oriented Coordinate Embedding Method) • Extension for FORTRAN90 (F90) written by James D. Turner • Automatic Differentiation (AD) equation manipulation package in which new data types are created in order to define independent and dependent variables (functions) • OCEA description • Automatic differentiation enabled by coding rules for differentiation - Chain rule of calculus • Can compute first through fourth-order partial derivatives of scalar, vector, matrix, and higher order tensors • Standard mathematical library functions (e.g. sin, cos, exp) are overloaded • Scalars are replaced by differential n-tuple Texas A&M University, Department of Aerospace Engineering
Overview of automatic differentiation by OCEA(2) • OCEA description (cont’d) • Intrinsic operators such as ( +, - , * , / , = ) are also overloaded to enable, for example, addition and multiplication of OCEA variables: • Partial derivative computation is hidden to the user - takes place in the background without user intervention. • Access to partial derivatives (e.g. Jacobian, Hessian, etc.) made simple by overloading of the “ = “ sign. Texas A&M University, Department of Aerospace Engineering
Overview of automatic differentiation by OCEA(3) • The need for computation of partial derivatives is found in numerous applications • Previous applications include • Root solving and Optimization • Second and higher-order GLSDC algorithms (AAS 04-148) • In this paper, we consider automatic generation of equations of motion for linked mechanical systems Texas A&M University, Department of Aerospace Engineering
Presentation Outline • Introduction and previous work • Overview of automatic differentiation by OCEA • Equation of motion formulation using automatic differentiation • A new algorithm for numerical integration • Examples Texas A&M University, Department of Aerospace Engineering
Automatic Differentiation (AD) Specified AD or specified many methods Approach (1): Direct approach(1)By differentiating the Lagrangian Mass matrix and its time derivative computed by second-order differentiation……….. Texas A&M University, Department of Aerospace Engineering
Approach (1): Direct approach(2)By differentiating the Lagrangian Can also compute constraint matrix, C, automatically for holonomic type constraint. Now forming equations: Accelerations computed after generating or prescribing all terms here. Now, can proceed with numerical integration……. Texas A&M University, Department of Aerospace Engineering
Approach (2): A modified form of Lagrange’s Equations In this approach, we can bypass forming the kinetic energy function. Must still form potential energy (if you want to), but most importantly need an efficient method for computing the mass matrix and partial derivatives of mass matrix………….. Texas A&M University, Department of Aerospace Engineering
KE for system of rigid bodies Approach (2): Identifying the mass matrix (1) For the case of planar rigid bodies, transformation matrices specialize to partials of position of mass center and partials of angular orientations Introduce the following velocity transformation matrices: Additionally, Bi is a constant vector of 1’s and 0’s for a minimal coordinate planar system Texas A&M University, Department of Aerospace Engineering
Approach (2): Identifying the mass matrix (2) Introduce transformations Need not specify T, can get M by forming mass center positions vectors…... Mass matrix and mass matrix partials Texas A&M University, Department of Aerospace Engineering
Presentation Outline • Introduction and previous work • Overview of automatic differentiation by OCEA • Equation of motion formulation using automatic differentiation • A new algorithm for numerical integration • Examples Texas A&M University, Department of Aerospace Engineering
Numerical Integration: Solving Fourth-order Runge-Kutta algorithm Utilizes approximate derivatives through fourth order So called Taylor integration scheme: Can compute through fourth-order time derivatives exactly. Potentially fifth-order method. Texas A&M University, Department of Aerospace Engineering
Presentation Outline • Introduction and previous work • Overview of automatic differentiation by OCEA • Equation of motion formulation using automatic differentiation • A new algorithm for numerical integration • Examples Texas A&M University, Department of Aerospace Engineering
r Spring Pendulum by Direct method (1) Texas A&M University, Department of Aerospace Engineering
Spring Pendulum by Direct method (2) SUBROUTINE SPRING_PEND_EQNS( PASS, TIME, X0, DXDT, FLAG ) USE EB_HANDLING IMPLICIT NONE **************************************** !.....LOCAL VARIABLES TYPE(EB)::L, T, V ! LAGRANGIAN, KINETIC, POTENTIAL REAL(DP):: M, K ! MASS AND STIFFNESS VALUES REAL(DP), DIMENSION(NV):: JAC_L REAL(DP), DIMENSION(NV,NV):: HES_L **************************************** T = 0.5D0*M*(X0(3)**2 + X0(1)**2*X0(4)**2) ! DEFINE KE V = 0.5D0*K*(X0(1)-R0)**2 + M*GRAV*(R0-X0(1)*COS(X0(2))) ! DEFINE PE L = T – V ! DEFINE LAGRANGIAN FUNCTION JAC_L = L ! dL/(dq,dqdot) JAC_L_Q = JAC_L(1:NV/2) ! dL/dq HES_L = L ! EXTRACT SECOND ORDER PARTIALS OF LAGRANGIAN MASS = HES_L(NV/2+1:NV,NV/2+1:NV) ! COMPUTE MASS MATRIX MASSDOT = HES_L(NV/2+1:NV,1:NV/2) !COMPUTE MDOT **************************************** DXDT(1)%E = X0(3)%E ! RDOT DXDT(2)%E = X0(4)%E ! THETADOT DXDT(3)%E = QDOTDOT(1) ! RDOTDOT DXDT(4)%E = QDOTDOT(2) ! THETADOTDOT END SUBROUTINE SPRING_PEND_EQNS Texas A&M University, Department of Aerospace Engineering
1 2 N Open-chain Topology of Rigid Bodies (1) Mass center location can be recursively formulated and utilized to compute velocity transformation matrices and ultimately the mass matrix and its partial derivatives. Generation of Equations of motion for open-chain topologies can be automated to the point of simply specifying the number of bodies and the initial conditions, while for closed chain-topologies we additionally need to prescribe the constraint equations. Texas A&M University, Department of Aerospace Engineering
Open-chain Topology of Rigid Bodies (2) 10 body model for laboratory deployment of inflated aerospace structure. Model easily updated to include joint torques (e.g. damping) Texas A&M University, Department of Aerospace Engineering
Closed-chain Topology Example 5 link manipulator example. Two holonomic constraints specified. Driving torque on link 1. Payload Motion Texas A&M University, Department of Aerospace Engineering
Conclusion • Introduced an automatic differentiation (AD) tool: OCEA • Implemented Lagrange’s equations using AD • Mass matrix and it’s time derivatives computed by direct differentiation of T and by recursive formulation • Suggested a new algorithm for numerical integration • Examples included simulations of a generalized code for planar n-body systems with open and closed-chain topologies • Future work includes computational studies, extension to 3D topologies, and efforts to validate solutions for flexible body systems Texas A&M University, Department of Aerospace Engineering