Lagrange-multiplier constraint for collinear beads in 3d?

  • Thread starter Thread starter vputz
  • Start date Start date
  • Tags Tags
    3d Constraint
Click For Summary
SUMMARY

The discussion focuses on implementing a Lagrange-multiplier constraint simulation for three collinear beads in 3D, building on Andrew Witkin's methods. The user successfully developed the simulation in 2D but encounters significant challenges when extending it to 3D, particularly with the collinearity constraint. The user has formulated the Jacobian matrix for both constraints but struggles to maintain stability when introducing a third constraint for the azimuthal angle. The primary issue arises from over-constraining the Cartesian coordinates, leading to instability in the simulation.

PREREQUISITES
  • Understanding of Lagrange multipliers in physics simulations
  • Familiarity with Jacobian matrices and their applications
  • Knowledge of 3D coordinate systems and constraints
  • Experience with iterative computer simulations and matrix mathematics
NEXT STEPS
  • Research "Lagrange multipliers in 3D simulations" for advanced techniques
  • Study "Jacobian matrix applications in constraint systems" for better stability
  • Explore "Rotne-Prager tensor interactions" to understand fluid dynamics in simulations
  • Investigate "constraint stability in iterative simulations" to prevent instability
USEFUL FOR

Physics simulation developers, computational physicists, and anyone working on constraint-based modeling in 3D environments.

vputz
Messages
11
Reaction score
0

Homework Statement



I'm trying to write a Lagrange-multiplier constraint simulation along the lines of those described by Andrew Witkin here.

The basic idea for this simulation is that you have a number of objects represented by three collinear beads joined by massless rods; one of the two rods changes length, and the other has a fixed length (the beads are in liquid interacting via rotne-prager tensor interactions, but the physics is not the gist of this question). The simulation works by calculating the Jacobian matrix of the constraints, using it to calculate Lagrange multipliers, finding constraint forces, and proceeding.

So we have two constraints:

1) the two beads of the fixed-length leg must remain the same distance apart, and
2) the three beads must remain collinear.

Here's the rub: I have the thing working wonderfully in 2d, but cannot for the life of me get it to behave in 3d.

For terminology, we'll label the beads 1-3 and say that leg 1-2 is changing length and 2-3 is remaining fixed.

Homework Equations



In 2d, the first constraint is that [tex]r_23 = \delta[/tex], which we can rewrite as [tex]C=r_{23}^2 - \delta^2 = 0[/tex], or

[tex]C=((x_3-x_2)^2+(y_3-y_2)^2=0[/tex]

[tex]C = x_{3}^{2} - 2x_{2}x_{3} + x_{2}^{2} + y_{3}^2 - 2y_{2}y_{3} + y_2{^2} - \delta^2 = 0[/tex]

So the Jacobian [tex]J_i = \frac{\partial C}{\partial q_{i}}[/tex] is

[tex]J=[ 0, 0, 2x_{2}-2x_{3}, 2y_{2}-2y{3}, 2x_{3}-2x_{2}, 2y_{3}-2y{2} ][/tex]
and we can remove the spurious 2's to get

[tex]J=[ 0, 0, x_{2}-x_{3}, y_{2}-y_{3}, x_{3}-x_{2}, y_{3}-y_{2} ][/tex]


For the second constraint in 2d (collinear), I used equivalent slopes:

[tex]\frac{y_{\alpha}}{x_{\alpha}} = \frac{y_{\beta}}{x_{\beta}}[/tex]

[tex]C=y_{\alpha}x_{\beta}-y_{\beta}x_{\alpha} = 0[/tex]

[tex]C=(y_{3}-y_{2})(x_{2}-x_{1}) - (y_{2}-y_{1})(x_{3}-x_{2})[/tex]

[tex]C=y_{3}x_{2}-y_{3}x_{1}-y_{2}x_{2}+y_{2}x_{1}-y_{2}x_{3}+y_{2}x_{2}+y_{1}x_{3}+y_{1}x_{2}[/tex]

and so the Jacobian is

[tex]J=[y_{2}-y_{3}, x_{3}-x_{2}, y_{3}-y_{1}, x_{1}-x_{3}, y_{1}-y_{2}, x_{2}-x_{1}][/tex]

(hopefully I've transcribed all that correctly). Okay--so far in 2d, all this works beautifully.

...(continued)
 
Physics news on Phys.org

The Attempt at a Solution



In 3d, things start going wrong. We can basically extend constraint (1) fairly trivially:

[tex]J=[ 0, 0, 0, x_{2}-x_{3}, y_{2}-y_{3}, z_{2}-z_{3}, x_{3}-x_2, y_3-y_2, z_3-z_2][/tex]

...but the collinear constraint is trickier (to me). So far my attempts have centred around treating the problem as if we were constraining the spherical coordinates [tex]\theta[/tex] and [tex]\phi[/tex], since we can use the 2d "slope" constraint as our [tex]\theta[/tex] constraint, since it works and doesn't depend on z at all:

[tex]J=[y_{2}-y_{3}, x_{3}-x_{2}, 0, y_{3}-y_{1}, x_{1}-x_{3}, 0, y_{1}-y_{2}, x_{2}-x_{1}, 0][/tex]

Things go wrong when I attempt to add a third constraint for [tex]\phi[/tex]. Attempts to do variations of [tex]z_{23}/r_{23}=z_{12}/r_{12}[/tex] fail--at best merely failing to constrain [tex]\phi[/tex] properly (at which point the two rods begin flexing like mad, which does interesting but nonphysical things to the simulation), and at worst interfering with the other constraints (in one case forcing the rods to elongate beyond the bounds of the simulation).

I'm not certain I understand what's going on. My best guess is that attempting to constrain it with separate constraints for [tex]\theta[/tex] and [tex]\phi[/tex] in cartesian coordinates is overconstraining the cartesian coords and going unstable. I'd like to find a nice way to either phrase it as one constraint equation or as three fairly independent ones. But I can't seem to manage it; I keep thinking in circles. Any good ideas?

Since this is an iterative computer simulation, keeping everything in cartesian is pretty much a must (there's a bunch of matrix math going on). Been hammering at this a while with no good results. The 3d version works just fine as long as everything is coplanar in z, but any variation in z makes it go berserk.

I even briefly tried leveraging [tex]A\cdotB=AB\cos\theta[/tex], setting [tex]\theta=0[/tex] to try and put everything on one constraint, which was almost interesting but since the Jacobian evaluated to zeros during the simulation turned out to be unuseful.
 
Last edited:

Similar threads

Replies
4
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
Replies
1
Views
1K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 0 ·
Replies
0
Views
1K