Notes Reduced Coordinates � Constraint methods from last class involved � Final Project adding forces, variables etc. to remove degrees • Please contact me this week with ideas, so of freedom we can work out a good topic � Inevitably have to deal with drift, error, … � Instead can (sometimes) formulate problem to directly eliminate degrees of freedom • Give up some flexibility in exchange for eliminating drift, possibly running a lot faster � “Holonomic constraints”: if we have n true degrees of freedom, can express current position of system with n variables • Rigid bodies: centre of mass and Euler angles • Articulated rigid bodies: base link and joint angles cs533d-winter-2005 1 cs533d-winter-2005 2 Finding the equations of motion Principle of virtual work v = � x q ˙ � Unconstrained system state is x, but holonomic � Differentiate x=x(q): � q constraints mean x=x(q) • The vector q is the “generalized” or “reduced” � That is, legal velocities are some linear coordinates of the system � x • dim(q) < dim(x) combination of the columns of • (coefficients of that combination � Suppose our unconstrained dynamics are � q are just dq/dt) d ( ) = F dt Mv � Principle of virtual work: constraint force • Could include rigid bodies if M includes inertia tensors must be orthogonal to this space as well as standard mass matrices T � x � What will the dynamics be in terms of q? F constraint = 0 � q cs533d-winter-2005 3 cs533d-winter-2005 4 Equation of motion Generalized Forces � Putting it together, just like rigid bodies, � Sometimes the force is known on the T � T � � � x � t M � x � = � x system, and so the generalized force just ˙ q F � needs to be calculated � q � q � q � � • E.g. gravity � � T T T T � x M � x q + � x M � x q + � x M � v q = � x ˙ ˙ ˙ ˙ ˙ F � � � But often we don’t care what the true force � q � q � q � q � q � q � q � � is, just what its effect is: directly specify the generalized forces • Note we get a matrix times second derivatives, which we can invert at any point for second order time • E.g. joint torques integration • Generalized forces on right hand side • Other terms are pseudo-forces (e.g. Coriolis, centrifugal force, …) cs533d-winter-2005 5 cs533d-winter-2005 6
Cleaning things up Setting up Lagrangian Equations � For simplicity, assume we model our system � Equations are rather messy still with N point masses, positions controlled by � Classical mechanics has spent a long time generalized coordinates playing with the equations to make them � We’ll work out equations via kinetic energy nicer � As before F constraint + F = Ma • And extend to include non-holonomic � Using principle of virtual work, can eliminate constraint forces: constraints for example T T � x F = � x Ma � Let’s look at one of the traditional � q � q approaches: Lagrangian mechanics � Equation j is just � v i � � v N � v N x v x � i � i F m i a i = � q j � q j i = 1 i = 1 cs533d-winter-2005 7 cs533d-winter-2005 8 Introducing Kinetic Energy Lagrangian Equations of Motion i � � v i � � v � v � � � � N N � Label the j’th generalized force v x d v x � � v i � d x i � � v � � m i a i m i � v i v i � = � � v � � � x N � q j dt � q j dt � q j � � � i � � f j = F i = 1 i = 1 i � � v i � � v i = 1 � q j � � � � N d v v � � v v � m i � v i v i � = � � � � � dt � ˙ q � q j � Then the Lagrangian equations of motion � � � � i = 1 j � � are (for j=1, 2, …): � � N d � � 2 2 � = m i � 1 v i � � 1 v i � � � � � � 2 2 f j = d � T � � T dt � ˙ q � q j � � � � i = 1 j � ˙ � � dt q � q j = d � � � � N N j 2 2 � � 1 2 m i v i 1 2 m i v i � � � dt � ˙ q � q j i = 1 i = 1 � � j = d � T � � T dt � ˙ q � q j j cs533d-winter-2005 9 cs533d-winter-2005 10 Potential Forces Implementation � If force on system is the negative gradient of a � For any kind of reasonably interesting articulated figure, potential W (e.g. gravity, undamped springs, …) expressions are truly horrific to work out by hand then further simplification: � Use computer: symbolic computing, automatic i � � v � v v x � � W x = � � W differentiation N N � � i i f j = F = � v � Input a description of the figure � q j x � q j � q j i = 1 i = 1 i � Program outputs code that can evaluate terms of � Plugging this in: differential equation = � T � W ( ) � � W = d � T � � T d � T � � Use whatever numerical solver you want (e.g. Runge- � q j dt � ˙ q � q j dt � ˙ q � q j Kutta) j j � Defining the Lagrangian L=T-W, � Need to invert matrix every time step in a numerical integrator d � L = � L • Gimbal lock… dt � ˙ q � q j j cs533d-winter-2005 11 cs533d-winter-2005 12
Fluid mechanics Fluid mechanics � We already figured out the equations of motion for continuum mechanics � ˙ ˙ x = � � � + � g � Just need a constitutive model � = � x , t , � ,˙ ( ) � � We’ll look at the constitutive model for “Newtonian” fluids today • Remarkably good model for water, air, and many other simple fluids • Only starts to break down in extreme situations, or more complex fluids (e.g. viscoelastic substances) cs533d-winter-2005 13 cs533d-winter-2005 14 Inviscid Euler model Lagrangian viewpoint � Inviscid=no viscosity � We’ve been working with Lagrangian methods so far � Great model for most situations • Numerical methods end up with viscosity-like error terms • Identify chunks of material, anyways… track their motion in time, � ij = � p � ij � Constitutive law is very simple: differentiate world-space position or velocity w.r.t. material coordinates to get forces • New scalar unknown: pressure p • In particular, use a mesh connecting particles to • Barotropic flows: p is just a function of density approximate derivatives (with FVM or FEM) (e.g. perfect gas law p=k( � - � 0 )+p 0 perhaps) � Bad idea for most fluids • For more complex flows need heavy-duty thermodynamics: an equation of state for pressure, equation for evolution of internal • [vortices, turbulence] energy (heat), … • At least with a fixed mesh… cs533d-winter-2005 15 cs533d-winter-2005 16 Eulerian viewpoint Conservation laws � Take a fixed grid in world space, track how � Identify any fixed volume of space velocity changes at a point � Integrate some conserved quantity in it � Even for the craziest of flows, our grid is always (e.g. mass, momentum, energy, …) nice � Integral changes in time only according to � (Usually) forget about object space and where a how fast it is being transferred from/to chunk of material originally came from surrounding space • Irrelevant for extreme inelasticity � � � ( ) � n q = � f q • Called the flux • Just keep track of velocity, density, and whatever else � t � � � is needed • [divergence form] q t + � � f = 0 cs533d-winter-2005 17 cs533d-winter-2005 18
Conservation of Mass Material derivative � Also called the continuity equation � A lot of physics just naturally happens in the Lagrangian viewpoint (makes sure matter is continuous) • E.g. the acceleration of a material point results from � Let’s look at the total mass of a volume the sum of forces on it (integral of density) • How do we relate that to rate of change of velocity measured at a fixed point in space? � Mass can only be transferred by moving it: • Can’t directly: need to get at Lagrangian stuff flux must be � u somehow � The material derivative of a property q of the � � � � = � � u � n material (i.e. a quantity that gets carried along � t � � � with the fluid) is Dq ( ) = 0 � t + � � � u Dt cs533d-winter-2005 19 cs533d-winter-2005 20 Finding the material derivative Compressible Flow � Using object-space coordinates p and map x=X(p) to � In general, density changes as fluid compresses world-space, then material derivative is just or expands Dt q ( t , x ) = d D � When is this important? dt q t , X ( t , p ) ( ) • Sound waves (and/or high speed flow where motion is getting close to speed of sound - Mach numbers = � q � t + � q � � x above 0.3?) � t • Shock waves = q t + u � � q � Often not important scientifically, almost never visually significant � Notation: u is velocity (in fluids, usually use u but • Though the effect of e.g. a blast wave is visible! But occasionally v or V, and components of the velocity the shock dynamics usually can be hugely simplified vector are sometimes u,v,w) for graphics cs533d-winter-2005 21 cs533d-winter-2005 22 Incompressible flow Simplifying � So we’ll just look at incompressible flow, � Incompressibility: D � Dt = � t + u � � � = 0 where density of a chunk of fluid never � Conservation of mass: changes ( ) = 0 � t + � � � u • Note: fluid density may not be constant � t + � � � u + � � � u = 0 throughout space - different fluids mixed � Subtract the two equations, divide by � : together… � That is, D � /Dt=0 � � u = 0 � Incompressible == divergence-free velocity • Even if density isn’t uniform! cs533d-winter-2005 23 cs533d-winter-2005 24
Recommend
More recommend