Black hole dynamic

Final Project: Dynamic of 2 supermassive blackhole

Inspiration
This project delves into the intricacies of simulating black holes’ gravitational influence on particles in a 2D space. Inspired by coding train and supermassive black hole and chaos behavior in astronophysic. With the music from rock band supermassive black hole, I would like to make an art with colorful trajectory created by the photons passing black holes

Techniques from decoding nature course
In this project, I use the knowledge I learnt from particle system, force and autonomous agent, as well as object orient programming. And the interaction part lies in the mouseclick and the operation of blackhole class and particle release and music start as the key board press.

Basic Setup
The setup() function initializes the canvas and GUI interface, allowing users to manipulate parameters such as black hole types, gravitational constant, particle count, and reset functionality.

let easycam;
let particles = [];
let blackHoles = [];
let controls = {
  type: 'Cylinder',
  c: 30,
  G: 6,
  m: 5000,
  Reset: function () {
    particles = [];
    blackHoles = [];
    initSketch();
  },
};

let pCount = 4000;
let lastTapTime = 0;
let lastTapPos;
let bgMusic;

Class of blackholes

Utilizing the Blackhole class, we represent black holes on the canvas based on their mass and Schwarzschild radius. The visualization showcases their gravitational influence by affecting the trajectories of nearby particles.

class Blackhole {
  constructor(x, y, m) {
    this.pos = createVector(x, y);
    this.mass = m;
    this.rs = (2 * controls.G * this.mass) / (controls.c * controls.c);
  }

  pull(photon) {
    const force = p5.Vector.sub(this.pos, photon.pos);
    const r = force.mag();
    const fg = (controls.G * this.mass) / (r * r);
    force.setMag(fg);
    photon.vel.add(force);
    photon.vel.setMag(controls.c);

    if (r < this.rs) {
      photon.stop();
    }
  }

 

Particle Behavior:
The Particle class defines particle behavior, including position, velocity, history of movement, and their interaction with black holes. Each particle’s trajectory is influenced by gravitational forces exerted by the black holes, leading to dynamic and visually engaging movements.

class Particle {
  constructor(pos, particleColor) {
    this.pos = pos;
    this.vel = p5.Vector.random2D();
    this.vel.setMag(controls.c);
    this.history = [];
    this.stopped = false;
    this.particleColor = particleColor; // Store the color of the particle
  }

  stop() {
    this.stopped = true;
  }

  update() {
    if (!this.stopped) {
      this.pos.add(this.vel);
      let v = createVector(this.pos.x, this.pos.y);
      this.history.push(v);
      if (this.history.length > 100) {
        this.history.splice(0, 1);
      }
    }
  }

 

Interactive Controls and Rendering:
Our project features an intuitive GUI interface allowing users to dynamically modify parameters, alter particle behavior, and manipulate black hole properties in real-time. This interactivity enhances user engagement and facilitates a deeper understanding of black hole dynamics.

  
  canvas.mouseClicked(addBlackHole);
}
function addBlackHole() {
  const currentTime = millis();
  const mousePos = createVector(mouseX - width / 2, mouseY - height / 2); if (currentTime - lastTapTime < 300 && dist(mousePos.x, mousePos.y, lastTapPos.x, lastTapPos.y) < 50) {
    // Double tap detected within 300ms and close proximity
    particles.push(new Particle(mousePos, color(random(255), random(255), random(255))));
  } else {
    
    blackHoles.push(new Blackhole(mouseX, mouseY, random(5000, 10000)));
  }

  lastTapTime = currentTime;
  lastTapPos = mousePos;
}

 

Physic logic behind particle and blackhole setup
newton second law and relativity

Blackhole Dynamic Exploration

Project


Introduction:

Embark on a fascinating journey into the enigmatic realm of black holes through our interactive simulation project. This walkthrough delves into the intricacies of simulating black holes’ gravitational influence on particles in a 2D space.

Simulation Dynamics:

Our simulation is designed to emulate the gravitational pull of black holes on particles. The setup() function initializes the canvas and GUI interface, allowing users to manipulate parameters such as black hole types, gravitational constant, particle count, and reset functionality.
Particle Behavior:
The Particle class defines particle behavior, including position, velocity, history of movement, and their interaction with black holes. Each particle’s trajectory is influenced by gravitational forces exerted by the black holes, leading to dynamic and visually engaging movements.
Black Hole Representation:
Utilizing the Blackhole class, we represent black holes on the canvas based on their mass and Schwarzschild radius. The visualization showcases their gravitational influence by affecting the trajectories of nearby particles.
Interactive Controls and Rendering:
Our project features an intuitive GUI interface allowing users to dynamically modify parameters, alter particle behavior, and manipulate black hole properties in real-time. This interactivity enhances user engagement and facilitates a deeper understanding of black hole dynamics.
Code Mechanics and Principles:
The core mechanics of our simulation are based on Newtonian gravitational principles, where each particle’s velocity is adjusted according to the gravitational force exerted by nearby black holes. We implement rules to halt particle movement when they enter the event horizon of a black hole, replicating the physics around these cosmic phenomena.
Conclusion:
This code walkthrough provides insight into the simulation of black hole dynamics, illustrating gravitational interactions between particles and black holes. Through this project, users can explore and visualize the captivating behavior surrounding these astronomical entities.

Inspiration:

Papers to be used:
https://digitalcommons.usu.edu/phys_capstoneproject/75/

Final Project Progress: blackhole band

Inspiration:
https://editor.p5js.org/mberger75/sketches/f_8oKzndG
https://www.saatchiart.com/art/Painting-Black-Hole/1014988/3765274/view

Interaction:
I use second idea, make variance on black hole idea. I learnt the coding of blackhole on nature of code. And want to make a picture with the traces created by the protons approaching blackholes.

It begins with the foundations of gravitational theory, symbolized through the visualization of black holes. In this code, we simulate the interaction of particles with these black holes using principles derived from Newton’s law of universal gravitation and Einstein’s theory of general relativity.

The code comprises several key components. The setup() function initializes our simulation environment, including the creation of a graphical user interface (GUI) powered by the dat.GUI library, allowing for real-time adjustments of simulation parameters. Through the draw() function, we depict the motion of particles under the influence of gravity from black holes. The simulation incorporates visualizations, such as the trails left by moving particles and the representations of black holes as massive gravitational entities.

To enhance our exploration, modifications were made to the code. Additional black holes were introduced, enriching the simulation by showcasing the dynamics between multiple gravitational centers. Moreover, the number and size of the black holes dynamically change upon mouse clicks, offering an interactive and engaging experience.

This project serves as an educational and immersive tool, providing a visual understanding of complex gravitational interactions. It merges science, mathematics, and programming to present a captivating visualization of celestial phenomena.

In conclusion, this project invites us to explore the wonders of space-time curvature and gravitational forces through a captivating visual representation. It stands as an embodiment of curiosity, knowledge, and the fusion of science with technology, allowing us to immerse ourselves in the fascinating world of astrophysics and gravitational dynamics.

Blog Post Reflection

In Professor Neil Leach’s enlightening lecture, ‘Alien Intelligence – Intro to AI for Designers,’ the fusion of AI and architectural design unfolds. Exploring AI’s impact in architecture, Leach highlights its potential through cases. He introduces the visionary of. Spiral Neural Network, envisioning a revolutionary neural architecture. Leach’s discourse evokes the transformative influence of AI, igniting a curiosity to harness its power for innovative, sustainable, and efficient architectural solutions, echoing a future where technology and creativity converge in unprecedented ways.

Week 11: Cellular Automata

Inspiration


This is the variation of the coding train’s project in 3D grid. Users engage by placing live cells via mouse click, adjusting speed with a slider, and observing evolving patterns. It combines interactivity, 3D visualization, and computational rules, fostering an immersive exploration.”
Let’s dive into this 3D cellular automaton project and check out its unique block design. Imagine a virtual world made up of tiny cubes – that’s our grid! Each cube, or ‘block,’ represents a cell in this three-dimensional space.

When you click your mouse on the canvas! You’re activating certain blocks within the grid. These activated blocks turn white and become part of the evolving pattern. It’s like you’re playing a creative role in shaping this digital world!

// This function draws an active block as a white cube
function drawActiveBlock(x, y, z) {
push();
translate(x * resolution - width / 2, y * resolution - height / 2, z * resolution - stacks / 2 * resolution);
fill(255, 150);
box(resolution);
pop();
}

The 'computeNext' function does all the behind-the-scenes work. It's like the brains of our project! This function uses the rules of Conway's Game of Life to decide the fate of each block based on its neighbors. If a block has too few or too many active neighbors, it 'dies' and becomes inactive. But if it has just the right number of neighbors, it 'lives' and becomes active.

Final Project update: Chaos or supermassive black hole

First Choice: Chaos in nature
Inspiration:


https://www.google.com/search?q=chaos+behaviour+in+nature&sca_esv=586549689&tbm=vid&source=lnms&sa=X&ved=2ahUKEwiwudv_kOuCAxWDaUEAHUlFDYsQ_AUoAnoECAEQBA&biw=1440&bih=737&dpr=2#fpstate=ive&vld=cid:b7cc7a50,vid:r_5shyQGIeA,st:0
Implementation plan:
1.Uncover the plan for chaos behavior
2.Try to make variance on chaotic behavior.

Concept:
Chaos behavior refers to the phenomenon observed in certain deterministic systems where even small variations in initial conditions can lead to vastly different outcomes over time. It emerges from non-linear dynamical systems, often characterized by simple rules or equations but exhibiting highly complex and seemingly random behavior. Within chaotic systems, there is a sensitive dependence on initial conditions, known as the “butterfly effect,” where a small change in the starting parameters can result in significant differences in the system’s evolution. Despite being deterministic and governed by precise mathematical rules, chaotic systems appear unpredictable and exhibit a lack of long-term predictability due to their extreme sensitivity to initial states. Chaotic behavior is often visualized through patterns like strange attractors, bifurcation diagrams, or fractals, showcasing intricate structures arising from deterministic chaos. This concept has applications across various fields, including physics, biology, economics, and even the behavior of complex systems like weather patterns or financial markets.

Second Choice: Supermassive black hole
Concept:
The motion of objects around a black hole can be described mathematically using Einstein’s theory of General Relativity. One of the key concepts related to black hole motion is the behavior of objects in the vicinity of the black hole within what is known as the event horizon.

The mathematics behind black hole motion involves understanding the geometry of spacetime as described by Einstein’s field equations. These equations relate the curvature of spacetime to the distribution of matter and energy within it.
The motion of objects around a black hole can involve various phenomena, such as orbits around the black hole, accretion disks formed by matter spiraling into the black hole, and gravitational lensing effects caused by the bending of light around the black hole.

Describing the precise mathematical motion of objects near a black hole requires solving Einstein’s equations, which can be complex and involve differential geometry. Numerical simulations and mathematical models based on these equations are used to understand and predict the behavior of objects around black holes.
Inspiration:
https://www.google.com/search?q=super+massive+black+hole+coding&sca_esv=586549689&tbm=vid&source=lnms&sa=X&ved=2ahUKEwigv-jfk-uCAxW_lP0HHegQDj4Q_AUoAnoECAEQBA#fpstate=ive&vld=cid:26179adf,vid:Iaz9TqYWUmA,st:0
Concept:
Implementation plan:
1.Uncover the simulation of blackhole
2.try to multiply the black hole and sea the variation in patterns
3.Make a painting using the code and touch interation made by player.
4.Do music interaction on the work.
5. Try to interpret the logic behind to viewers

A combination idea: paint your chaos with blackholes
Integrating chaos theory with the concept of black holes to create a visualization of chaos near black holes involves combining mathematical models representing chaotic behavior with the gravitational effects described by General Relativity. While creating a direct visualization of chaos near black holes might be challenging due to the complexity of both chaotic systems and black hole physics, you can develop a conceptual representation or simulation by following these steps:

Choose a Chaotic System: Select a simple chaotic system, like the logistic map or the Lorenz system, and simulate its behavior. Use mathematical equations representing chaos to generate data points or trajectories that showcase chaotic behavior.

Understand Black Hole Physics: Study the basic concepts of black holes in General Relativity, focusing on the Schwarzschild metric or other relevant metrics describing the geometry of spacetime around black holes. Understand how gravity affects the motion of objects and distorts spacetime.

Combine Models: Conceptually integrate the chaotic system’s behavior into the gravitational field of a black hole. You might represent this by considering trajectories or orbits influenced by both chaotic behavior and the gravitational pull of the black hole.

Develop a Visualization: Use a programming language or software that allows for 3D visualizations and simulations. You can use libraries like Three.js or WebGL for web-based visualizations or programming languages like Python with libraries such as Matplotlib or Mayavi for 3D visualizations.

Simulate and Render: Create a simulation where objects (representing the chaotic system) move or follow trajectories influenced by chaotic behavior while being affected by the gravitational field of the black hole. Visualize these trajectories, their interactions, and the distortion of space caused by the black hole’s gravity.

Add Contextual Elements: Include visual cues such as distortion of light paths, gravitational lensing effects, or the visualization of an accretion disk around the black hole to enhance the realism of the simulation.

Iterate and Refine: Adjust parameters, refine your simulation, and test different scenarios to create a compelling visualization that showcases chaotic behavior in the presence of a black hole’s gravitational field.

Week Assignment 10: Embracing Chaos

Inspiration

In the realm of creative coding, chaos often leads to awe-inspiring discoveries. Inspired by the unpredictable beauty of chaotic systems, we embarked on a journey to explore and visualize chaos using the p5.js library, particularly its physics engine. This endeavor aimed not only to unravel the mysteries of chaos but also to appreciate its inherent allure in creative expression.

Challenge





These script tags import p5.js and its addon libraries from the CDN, allowing the code to access functions and utilities provided by these libraries to create interactive visual elements and simulate physics behaviors.

Week 9: Flock System


Inspiration

The allure of motion and interaction in coding has always captivated creative minds. Inspired by the elegance of pursuing entities within a simulated environment, I embarked on a journey to create a scenario where two ships engage in a chase, using the p5.js library to bring this dynamic scenario to life.

Description

In my canvas, I introduce two protagonists: the main ship and the chasing ship. The main ship, stationed at the center, exudes confidence with its robust speed capabilities. On the other hand, the chasing ship, eager and agile, strives to emulate the movements of the main ship.

The code orchestrates this chase by employing principles of physics and steering behaviors. The main ship moves freely while the chasing ship dynamically adjusts its course to follow the main ship’s trajectory. It utilizes the update() method, considering the position of the main ship, and then employs acceleration and steering vectors to mimic its movements.

Challenges

The core challenge was harmonizing the pursuit behavior of the chasing ship. Calculating the optimal steering force to smoothly follow the main ship without overshooting or lagging required precision and fine-tuning. Managing the ship’s speed and acceleration while ensuring a balanced chase added complexity to the code.

Additionally, synchronizing the rotation of the ships to simulate their heading accurately while maintaining a sleek and responsive visual representation demanded meticulous handling of angles and shapes.

Week 8: Flock System

Inspiration:
This project aims to simulate a dynamic flocking system where agents (boids) exhibit cohesive, aligning, and separating behaviors within a visual environment. Inspired by nature and emergent patterns found in flocks of birds or schools of fish, this project integrates code with artistic composition to create an evolving narrative through visual and behavioral changes.

Description:
The project utilizes the p5.js library in JavaScript to implement a flocking simulation. Boids, represented as small circular shapes, demonstrate collective behavior influenced by separation, alignment, and cohesion. These behaviors are controlled by specific rules that affect how boids interact with their neighbors within a defined radius.

The code initializes a canvas and generates a flock consisting of individual boids. Each boid possesses properties such as position, velocity, and acceleration. Through the flock() function, boids respond to nearby neighbors within certain radii (separation, alignment, and cohesion) and adjust their behavior accordingly.

The separate(), align(), and cohere() functions within the Boid class determine how each boid interacts with others. Separation ensures that boids maintain a minimum distance from neighbors, alignment aims to match velocities with nearby boids, and cohesion encourages boids to move towards the average position of neighboring boids.

The update() function governs the boid’s movement, calculating its new position based on velocity and acceleration. The display() function visually represents each boid as a small white circle on the canvas.

The project also allows for potential narrative development or visual changes over time. For instance, altering the background or introducing new behaviors at specific frame counts could represent the evolving story or tension and release dynamics within the simulation.

// Flocking behaviors (separation, alignment, cohesion)
flock(others) {
let separationForce = this.separate(others);
let alignmentForce = this.align(others);
let cohesionForce = this.cohere(others);

separationForce.mult(1.5);
alignmentForce.mult(1.0);
cohesionForce.mult(1.0);

this.acceleration.add(separationForce);
this.acceleration.add(alignmentForce);
this.acceleration.add(cohesionForce);
}