10.014 CTD
  • Overview
  • Schedule
  • Administrative
    • Accessing Rhino remotely
    • Rhino for Mac
  • ASSIGNMENTS
    • Dates and rubrics
    • Generative design
      • Generative design
    • Parametric design
      • Parametric design
    • Simulated design
      • Simulated design
      • Simulated design
  • SESSION 1B
    • Computer Aided Design
    • Ranges and expressions 1
      • Ranges and expressions 2
      • Ranges and expressions 3
      • Ranges and expressions 4
      • Ranges and expressions 5
      • Ranges and expressions 6
  • SESSION 2A
    • Visual programming 1
      • Visual programming 2
      • Visual programming 3
      • Visual programming 4
    • Associative modelling 1
      • Associative modelling 2
      • Associative modelling 3
  • SESSION 2B
    • Logical Patterns 1
      • Logical patterns 2
      • Logical patterns 3
  • SESSION 3A
    • Spatial geometry 1
      • Spatial geometry 2
      • Spatial geometry 3
      • Spatial geometry 4
      • Spatial geometry 5
      • Spatial geometry 6
      • Spatial geometry 7
    • Curve geometry 1
      • Curve geometry 2
      • Curve geometry 3
      • Curve geometry 4
  • SESSION 3B
    • Surface geometry
    • Parametric modelling 1
      • Parametric modelling 2
      • Parametric modelling 3
      • Parametric modelling 4
  • SESSION 4A
    • Information nesting 1
      • Information nesting 2
      • Information nesting 3
    • Data landscapes 1
      • Data landscapes 2
      • Data Landscapes 3
      • Data landscapes 4
  • SESSION 4B
    • Mesh geometry 1
      • Mesh geometry 2
      • Mesh geometry 3
  • SESSION 5A
    • Space and time 1
      • Space and time 2
    • Modelling entities 1
      • Modelling entities 2
      • Modelling entities 3
  • SESSION 5B
    • Multibody dynamics 1
      • Multibody dynamics 2
    • Material elasticity 1
      • Material elasticity 2
      • Material elasticity 3
  • SESSION 6A
    • Form-finding 1
      • Form-finding 2
      • Form-finding 3
      • Form-finding 4
  • SESSION 6B
    • AI Image generation 1
      • AI Image generation 2
      • AI Image generation 3
  • APPENDIX
    • Spirograph 1
      • Spirograph 2
    • Curves
    • Swarm Intelligence 1
      • Swarm Intelligence 2
    • Hybrid programming 1
      • Hybrid programming 2
Powered by GitBook
On this page
  • N-Body Simulation
  • Conclusions
  1. SESSION 5B
  2. Multibody dynamics 1

Multibody dynamics 2

N-bodies

PreviousMultibody dynamics 1NextMaterial elasticity 1

Last updated 9 months ago

N-Body Simulation

Let’s now create a multi-body simulation using a number of randomly positioned particles. The animation below shows an example of using four particles and their trajectories. The way they entangle with one another is remarkable.

The setup for this kind of simulation is relatively simple: We generate a random set of points within a bounding volume using the “populate 3d” component. Note that the number of particles created is exposed as an input parameter. Particle velocities are initially all set to zero, by just multiplying their positions with zero and interpreting the result as vectors. Masses are also randomly sampled within a preset range.

Practice

  • Experiment with different sizes of particles systems. You may adjust the random sampling ranges and/or include initial velocities.

  • Observe how the simulation slows down significantly with the increase of the number of particles. How can we express or measure this relationship?

  • Experiment with different sizes of particles systems. You may adjust the random sampling ranges and/or include initial velocities.

  • Observe how the simulation slows down significantly with the increase of the number of particles. How can we express or measure this relationship?

Bounding the Universe

One problem with the setup is that particles attract one another and once they come too close with one another, the forces excreted are so large, because of the inverse square relationship, that they tend to explode. To convert from an open universe to a bounded version thereof we will develop a new constraints system.

The approach is based on multiple cluster components that organize the logic quite succinctly. We will import the state of the particle system, namely positions, velocities and masses, as well as an “enable” parameter for toggling between open and closed universe types.

We will constraint particles within a bounding box with +/- “limit” size dimensions. Particles will bounce off the virtual world boundaries. We will implement an internal cluster such that when the world is bounded, the bounding box will be conditionally visualized on screen.

The “bounds” cluster component contains the conditional display logic. When enable is set, we construct and display a transparent bounding box such that we can visually observe where the particles are supposed to bounce against. We use the “stream gate” component’s “1” i.e. activated output for this construction and leave the “0” i.e. deactivated completely blank.

The “world” cluster component contains the bounding box bouncing logic. Here we use “stream filter” components to select either the original particle positions and velocities or the constrained versions thereof coming from the “bounce” cluster.

The “bounce” component implements the “ground plane” constraint we used in the projectile experiment only three times; once for each point coordinate and velocity direction. In summary, we deconstruct the particles’ positions and velocities, perform clamping and bounding and reassemble the points and vectors.

The “clamp” component is merely a python script using the code below. We use the “if” expression twice to clamp the point’s coordinate in +/- a limiting value sense. For a vector, we invert its component only if the position has exceeded the limiting value.

NewCoordinate = -Limit if(Coordinate < -Limit) else Limit if(Coordinate > Limit) else Coordinate

NewComponent = -Component if( ( Coordinate < -Limit ) or ( Coordinate > Limit ) ) else Component

The degree of nesting cluster components may seem excessive. It has nothing to do with making the logic faster or modular but primarily to keep the concepts clear. This approach is highly recommended as it simplifies the legibility of the constructs. What may seem self-evident now, may not so much some months or years down the line; or a person who has not developed this logic at all.

Practice

  • Since we can detect the presence of collisions, we may implement an energy dissipation constraint, where the particle’s velocity is reduced by a percent of its original value i.e. instead of +/- 1.0 use +/- 0.9 for the new component multiplier.

  • Experiment with other positional constraints such as you may constraint particles’ positions on a surface using the “surface closest point” component or a sphere by just normalizing their positions.

Conclusions

In this session we looked at creating relationships between particles expressed using forces. If we step back from the direct physics analogy and forget about molecules and planets, this is actually quite a powerful way of creating associations between entities in general! This is because forces may casually contradict, as in oppose, one another. The sum of forces expresses the aggregate compromise or feasible direction among all different requirements; and time is the mechanisms that allows those to find an eventual balance. In this sense, forces express “desires” rather than “laws” set in stone or uncompromising arithmetic / geometric rules.

The definition of those relationship establish here were however implicit. We applied the same force to all entities; or equivalently there were no explicit information for which pairs to apply them. In order to explore more interesting scenarios we need to expand the scope of force definitions a bit more in the next session.

For those interested in exploring Python programming, you may refer to Projectile Physics and N-bodies to see how we can combine visual and text programming to recreate these examples.

As an advanced challenge try to implement a Brownian motion [] inter-particle collision constraint using the Cartesian product ideas used for force analysis. Hint: Use the idea of sphere-sphere intersection to determine particle bounces.

>
62KB
5B_N-body.gh
World cluster