From 8650ab3bb59705ec99a90a26e5c62d1387fd1121 Mon Sep 17 00:00:00 2001 From: Snehaa Ganesh Kumar Date: Wed, 1 May 2024 02:53:15 -0400 Subject: [PATCH] fixed embed --- final-project/.DS_Store | Bin 6148 -> 6148 bytes final-project/index.html | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/final-project/.DS_Store b/final-project/.DS_Store index 8fc132206d9e17c765b4d7ecc5f03650fd88c788..3486d21be59dd5b5d7819555c445d76a693ef636 100644 GIT binary patch delta 83 zcmZoMXfc=|#>B)qu~2NHo+2aj#DLw4KQJ;fGEe4VJU`i)v681OxF|0tKQEnufq`-J jL&oJSo7p+|Ie=P#obSw&`9&-_7=cniX@<=KB3qaN=N%R9 delta 68 zcmZoMXfc=|#>B`mu~2NHo+2aD#DLwC4MbQb^D~{

2. Temperature Calculation:

Integration into the Simulation Loop

Within ParticleSolverCPUFluid.cpp, these methods are integrated into the particle update loop, ensuring that each particle's behavior is governed by physically accurate, temperature-dependent properties:

By carefully implementing and integrating these advanced computational methods, we have significantly enhanced the realism and scientific accuracy of our supernova simulation. Each method has been tailored to reflect the unique conditions of supernova physics, allowing us to explore this cataclysmic event with unprecedented detail and fidelity.

Shader Improvements

Implementation

Using knowledge from Project 4, we modified the original vertex and fragment shaders to fit our needs. The main features we added were gaseous particles and better color mapping.

For gaseous particles, this mostly involved rendering each individual particle as a blurred sphere based on particle characteristics such as mass, and distance from origin. The mass component was important since each simulation particle represents multiple gaseous particles which would make up the region around that simulation particle. The more mass, the more apparent and brighter the simulation particle should appear. The distance from the origin was used to fix a problem where particles appeared clumpy when they spread apart. The essential idea is for each pixel, we adjust the alpha based on its distance on the distance from the particle and the size of the particle (more spread-out gasses are thinner). The formula we ended up using was (0.25f-abs(dist)) * 4.0f / particleSize.

The particles don’t feel cohesive as they should be.
When adjusting sizes of spread out particles, it resembles a gas more.

We then added back the original particles to make the cloud fuller and less like a random blur in the screen.

Blue initial state
Yellow after explosion

Then, for colors, we essentially used the temperature for the hue, velocity for the value, and a constant float of 1.0f for our saturation. This involved using the OpenGL C++ API to create a new buffer to feed in particle temperatures. We also normalized the temperatures and velocities using this formula (generalized): clamp(characteristic - min_val / max_val, 0.0, 1.0). We then converted this HSV color to RGB.

Side view
Temperatures are a little inaccurate

Debugging

In general, debugging shaders was difficult since there was no way to tell what values were actually being calculated in the shaders, so it involved visual debugging (i.e. using the grey scale to show the alphas, tuning parameters in the render loop). One particular trick that was useful for determining the max and min temperatures was to test values based on printed-out temperatures for thresholds between temperatures (using a simple if statement for the cutoff and playing through the simulation). An ideal cut off would mean that 99% of the particles fall in the same color.

These images show that there was something wrong with the clipping, which was fixed by reading the OpenGL documentation to set up blending properly. They did help with tuning the alpha calculation though.

program-structure

This was a pretty good cut-off, most of the particles were above the temperature threshold except for the portions in red.

Results

Below is a selected demo of our final simulation:

All the demos: google drive

Final Project Video

Key Takeaways

  1. Challenges in 3D Supernova Simulation:
    • Simulating a supernova explosion in three dimensions presented significant challenges due to the complex interplay of gravitational forces, fluid dynamics, and thermodynamic properties like temperature, velocity, and pressure. We encountered difficulties in realistically modeling these forces simultaneously, which required a deep dive into astrophysical principles and iterative refinement of our simulation parameters.
  1. Learning from Fluid Mechanics Integration:
    • Integrating fluid mechanics into our particle simulation framework was both challenging and enlightening. The process highlighted the critical role of fluid dynamics in simulating the behavior of gaseous elements within a star. We learned to adapt fluid dynamics theories to the discrete nature of particle systems, enhancing our understanding of how gases behave under extreme conditions like those found in supernovas.
  1. Complexities of Temperature Computation and Visualization:
    • Calculating and visualizing temperature within the simulation proved to be one of the most complex aspects of our project. We struggled with the accurate computation of temperature gradients and the dynamic updating of shader parameters to visually represent these changes. This challenge emphasized the necessity for robust computational algorithms and underscored the intricate relationship between physical properties and their visual representation.
  1. Selecting and Implementing Appropriate Physics Equations:
    • Choosing the right physics equations to model the detailed stages of a supernova required extensive research and practical testing. We learned the importance of selecting equations that not only reflect true astrophysical phenomena but also integrate seamlessly into our computational framework, balancing accuracy with computational feasibility.
  1. Lack of References:
    • As mentioned before, a supernova explosion is much more complex than what we initially thought. Papers detailing how the astrophysics of a supernova explosion worked involved numerous complex equations where the correct ones to use vary tremendously across different stages of the explosion. Most of the simulations that are available are rendered on much more capable machines like supercomputers which achieve computational speeds far beyond what we have available. As a result, we could only create a simplified version of the explosion based on the research that we have done into those papers based on our own understanding.

Member Contributions

Manan Bhargava (manan.bhargava@berkeley.edu)

+

2. Temperature Calculation:

Integration into the Simulation Loop

Within ParticleSolverCPUFluid.cpp, these methods are integrated into the particle update loop, ensuring that each particle's behavior is governed by physically accurate, temperature-dependent properties:

By carefully implementing and integrating these advanced computational methods, we have significantly enhanced the realism and scientific accuracy of our supernova simulation. Each method has been tailored to reflect the unique conditions of supernova physics, allowing us to explore this cataclysmic event with unprecedented detail and fidelity.

Shader Improvements

Implementation

Using knowledge from Project 4, we modified the original vertex and fragment shaders to fit our needs. The main features we added were gaseous particles and better color mapping.

For gaseous particles, this mostly involved rendering each individual particle as a blurred sphere based on particle characteristics such as mass, and distance from origin. The mass component was important since each simulation particle represents multiple gaseous particles which would make up the region around that simulation particle. The more mass, the more apparent and brighter the simulation particle should appear. The distance from the origin was used to fix a problem where particles appeared clumpy when they spread apart. The essential idea is for each pixel, we adjust the alpha based on its distance on the distance from the particle and the size of the particle (more spread-out gasses are thinner). The formula we ended up using was (0.25f-abs(dist)) * 4.0f / particleSize.

The particles don’t feel cohesive as they should be.
When adjusting sizes of spread out particles, it resembles a gas more.

We then added back the original particles to make the cloud fuller and less like a random blur in the screen.

Blue initial state
Yellow after explosion

Then, for colors, we essentially used the temperature for the hue, velocity for the value, and a constant float of 1.0f for our saturation. This involved using the OpenGL C++ API to create a new buffer to feed in particle temperatures. We also normalized the temperatures and velocities using this formula (generalized): clamp(characteristic - min_val / max_val, 0.0, 1.0). We then converted this HSV color to RGB.

Side view
Temperatures are a little inaccurate

Debugging

In general, debugging shaders was difficult since there was no way to tell what values were actually being calculated in the shaders, so it involved visual debugging (i.e. using the grey scale to show the alphas, tuning parameters in the render loop). One particular trick that was useful for determining the max and min temperatures was to test values based on printed-out temperatures for thresholds between temperatures (using a simple if statement for the cutoff and playing through the simulation). An ideal cut off would mean that 99% of the particles fall in the same color.

These images show that there was something wrong with the clipping, which was fixed by reading the OpenGL documentation to set up blending properly. They did help with tuning the alpha calculation though.

program-structure

This was a pretty good cut-off, most of the particles were above the temperature threshold except for the portions in red.

Results

Below is a selected demo of our final simulation:

All the demos: google drive

Final Project Video

+ +

Key Takeaways

  1. Challenges in 3D Supernova Simulation:
    • Simulating a supernova explosion in three dimensions presented significant challenges due to the complex interplay of gravitational forces, fluid dynamics, and thermodynamic properties like temperature, velocity, and pressure. We encountered difficulties in realistically modeling these forces simultaneously, which required a deep dive into astrophysical principles and iterative refinement of our simulation parameters.
  1. Learning from Fluid Mechanics Integration:
    • Integrating fluid mechanics into our particle simulation framework was both challenging and enlightening. The process highlighted the critical role of fluid dynamics in simulating the behavior of gaseous elements within a star. We learned to adapt fluid dynamics theories to the discrete nature of particle systems, enhancing our understanding of how gases behave under extreme conditions like those found in supernovas.
  1. Complexities of Temperature Computation and Visualization:
    • Calculating and visualizing temperature within the simulation proved to be one of the most complex aspects of our project. We struggled with the accurate computation of temperature gradients and the dynamic updating of shader parameters to visually represent these changes. This challenge emphasized the necessity for robust computational algorithms and underscored the intricate relationship between physical properties and their visual representation.
  1. Selecting and Implementing Appropriate Physics Equations:
    • Choosing the right physics equations to model the detailed stages of a supernova required extensive research and practical testing. We learned the importance of selecting equations that not only reflect true astrophysical phenomena but also integrate seamlessly into our computational framework, balancing accuracy with computational feasibility.
  1. Lack of References:
    • As mentioned before, a supernova explosion is much more complex than what we initially thought. Papers detailing how the astrophysics of a supernova explosion worked involved numerous complex equations where the correct ones to use vary tremendously across different stages of the explosion. Most of the simulations that are available are rendered on much more capable machines like supercomputers which achieve computational speeds far beyond what we have available. As a result, we could only create a simplified version of the explosion based on the research that we have done into those papers based on our own understanding.

Member Contributions

Manan Bhargava (manan.bhargava@berkeley.edu)

Snehaa Ganesh Kumar (snehaa@berkeley.edu)

Nak Vong (kiriratanakvong@berkeley.edu)

Brandon Wong (bwong928@berkeley.edu)

References

  1. Murphy, Jeremiah W., and Adam Burrows. "An Analytic Model of the Ray-by-Ray Approximation for Rotating Core Collapse." Accepted for publication in ApJ. arXiv preprint arXiv:0805.3345 (2008).
  1. Bethe, Hans A. "Supernova Mechanisms." Reviews of Modern Physics 62, no. 4 (1990): 801.
  1. Koschier, Dan, Jan Bender, Barbara Solenthaler, and Matthias Teschner. "Smoothed Particle Hydrodynamics Techniques for the Physics Based Simulation of Fluids and Solids." arXiv preprint arXiv:2010.11254 (2020).
  1. Pan, Kuo-Chuan, Matthias Liebendörfer, Matthias Hempel, and Friedrich-Karl Thielemann. "Two-Dimensional Core-Collapse Supernova Simulations with the Isotropic Diffusion Source Approximation for Neutrino Transport." Accepted for publication in ApJ. arXiv preprint arXiv:1505.02513 (2015).
  1. Vivas, Marc. "N-body Simulation GitHub Repository." Accessed April 30, 2024. https://github.com/MarcVivas/N-body/tree/main.