<p>An attempt at a partial answer, or perhaps &quot;one possible answer&quot;:</p>
<hr />
<p>If I understand correctly, the problem you describe appears in numerical simulations where you have to choose between simulating a large enough volume, and fine enough details. If so, then the answer is <em>subgrid physics</em>.</p>
<p>As an example, let's say a cosmological hydro-simulation uses <span class="math-container">$10^{11}$</span> particles to simulate a cubic gigalightyear. If I've done my maths right, this would mean that each particle would represent <span class="math-container">$\sim10^7\,M_\odot$</span>. With a minimum of 10 (poor) to 100 (preferred) particles to represent a galaxy, this is acceptable if you're interested in, say, number statistics or clustering statistics of galaxies above <span class="math-container">$10^{8\text{–}9}\,M_\odot$</span>.</p>
<p>But <span class="math-container">$10^7\,M_\odot$</span> is only the upper limit of the mass range of the molecular clouds from which stars are born, so how can you ever simulate star formation, which is important not only if you're interested in stellar populations and galaxy luminosities, but actually also affects the galaxy masses through their feedback which may push gas out of the galaxies?</p>
<p>The answer is that you use results from observations, analytical models, and lower-volume, higher-resolution simulations that teach you how stars are formed and how they affect the gas around them. From these you know for instance that gas needs to be 1) dense and 2) cold, in order to form a star. In your huge simulation you can then say &quot;<em>If the density of gas particles exceeds a certain threshold, and their temperature is below some threshold, and if they have a negative velocity gradient, then (a fraction of) the gas particles should be converted to star particles</em>.&quot;</p>
<p>Subsequently you can say that stars are treated as either 1) low-mass or 2) high-mass. For the purposes of the simulation, given the size of a time step low-mass stars live forever while high-mass stars die instantly, being converted back into gas particles. A gas particle has an associated metallicity (and possibly dust), which has now increased by some yield, and because massive stars die not with a whimper, but with a bang, a certain amount of energy is now dumped into the surrounding gas particles as either heat, or momentum, or a mixture thereof, giving rise to feedback.</p>
<p>The scenario described above uses particles as an example, but the same approach is used for cell-based simulations. In both cases, we're dealing with physics that is not resolved by the particles/cells, and hence is referred to as <em>subgrid physics</em>.</p>
<p>The highest-resolution hydro-simulations of molecular clouds contain individual stars, but the stars themselves are not resolved. So how do we know how much energy they produce when they explode, how much metals they produce, what kind of spectrum they emit, etc.? Yes, by observations, analytical models, and even higher-resolution simulations that tell you how stars evolve.</p>

CC BY-SA 4.0
2023-11-01T19:13:44.507Z
*Thanks!* You definitely understand the question correctly, and "subgrid physics" is the concept I needed to hear about. It also seems that no matter what the scale, simulations are generally better described as hydrodynamic than as n-body-like, i.e. there's a grid (though it may or may not be fixed). I wonder if there are a few well-defined scales that characterize most modern work (e.g. my class I through class V example) or not.
uhoh
CC BY-SA 4.0
2023-11-02T11:13:57.917Z
@uhoh It's true that hydro-sims are more realistic than pure N-body (given that the real world is not composed of dark matter only), but on the largest scales it's a rather minor error to not include it, so N-body codes definitely still are important. I don't think there's a scale that characterize most modern work, but to be honest I don't pay so much attention to scales that are significantly smaller than a galaxy.
pela
CC BY-SA 4.0
2023-11-02T11:14:47.420Z
In my work, that is. In my normal life I do occasionally pay attention to things that are smaller than galaxies.
pela
CC BY-SA 4.0
2023-11-01T14:23:47.867Z
2023-11-01T14:23:47.867Z
pela
<p>If we just model our solar system's dynamics, one could use a straightforward numerical integrator with all n(n-1)/2 gravitational interactions along with some torques and non-gravitational forces. However it was found to be no less accurate (limited by the availability of measured data with with to fit) to treat certain tightly bound systems as somewhat isolated. For example, forces between the smallest moons of two widely separated planets don't need to be treated explicitly, and using the Jovian system's barycenter is sufficient to perturb Mercury's orbit.</p>
<p>Similarly, in the dynamics within a single galaxy numerical models don't treat all n(n-1) two-body forces when n=10<sup>11</sup>. Instead models can use some hybrid techniques - treating each of a large number of small volumes of the galaxy as having an average density, while at the same time using different models that operate on what's put inside each of those volumes.</p>
<p>Those are just examples of my meagre understanding of the topic.</p>
<p>But I'd like to ask, and this is a hard question to formulate and may be hard to answer - how do various astrophysical models deal with so many orders of magnitude in scale? Have they sort-of settled on some standard ways of chopping things up?</p>
<p>Just for a hypothetical example &quot;class I&quot; for solar systems, class II for stellar clusters or groups (IIa and IIb might be with or without a black hole) class III for entire galaxies, class IV for galactic clusters and class V for bigger/biggest?</p>
<p>You might embed one class in another, a galactic model might also contain say 100,000 stars with randomly initiated solar systems as sort of &quot;test particles&quot; within a fluid representing the rest of the matter.</p>
<p>Or is it better to characterize the current state of the art as still in the process of trying out all kinds of ways of dealing with scale?</p>
<hr />
<p>For a nice illustration of how many orders of magnitude are involved, have a nice experience zooming out at <a href="https://htwins.net/scale2/" rel="nofollow noreferrer">https://htwins.net/scale2/</a></p>
<ul>
<li>distance from Earth to Moon at 10<sup>8.8</sup> meters</li>
<li>distance from Voyager to Earth at 10<sup>13.5</sup> meters</li>
<li>observable universe at 10<sup>26.5</sup> meters</li>
</ul>

CC BY-SA 4.0
2023-10-27T22:30:38.853Z
There are some interesting ideas for dealing with stuff at cosmological scales in this article from 2007: https://astronomy.swin.edu.au/sao/guest/knebe/ There's more recent info (also primarily about cosmological scales) in the article I linked here: https://astronomy.stackexchange.com/questions/55010/are-there-some-simple-mathematical-models-which-can-simulate-the-cellular-web/55035#comment124332_55010
PM 2Ring
CC BY-SA 4.0
2023-10-28T02:42:02.770Z
Most of that is just built in to how floating point numbers work.  A 64 bit floating point number stores about 15 digits of precision, then varies the mantissa for scale, anywhere from about $10^{-308} $ to $ 10^{308} $.  When it comes time to add them together, they are added together starting with the smallest absolute values, ending with the largest.
Greg Miller
CC BY-SA 4.0
2023-10-28T02:46:39.303Z
@GregMiller The issue isn't as much the mix of large and small distances as it is the vast numerical *quantity of individual sources of gravity* that has to be managed by grouping them. For n object the number of pairs is n(n-1)/2. When n = $10^{11}$ that's a lot of objects to store in memory and a lot of pair-wise forces to evaluate every cycle, no matter what precision you choose.
uhoh
CC BY-SA 4.0
2023-10-28T02:55:25.377Z
@uhoh but then your question is not about dealing with orders of magnitude, but simply about the size of number of nodes of the simulations. That is not so different than elsewhere.
planetmaker
CC BY-SA 4.0
2023-10-28T02:58:21.557Z
@Greg I think the gist of your comment captures the question asked in the title... But let's see whether that's the actual question which the op wants to ask
planetmaker
CC BY-SA 4.0
2023-10-28T03:04:27.617Z
@uhoh sing the question again, I think your title asks about something else than the body. Imho the title is interesting while the body cannot have an answer and qualifies in this generality as to broad. Seems you might want to specify n-body simulations concerning gravitational interaction
planetmaker
CC BY-SA 4.0
2023-10-28T03:06:12.980Z
@planetmaker this is Astronomy SE - when we deal with gravity at various scales the issue related to the quantity of sources is baked right into the problem, therefore goes without saying, especially in a title.
uhoh
CC BY-SA 4.0
2023-10-28T15:29:00.280Z
@uhoh What aspect of processing $10^{11}$ numbers are you interested in?  There is no need to store them directly in memory, they can be stored on disk.  But it's not really that big of a number.  The NVidia RTX 3080 can do that many 64 bit floating operations in less than .25 seconds.
Greg Miller
CC BY-SA 4.0
2023-10-28T17:58:33.457Z
@Greg It's not $10^{11}$ numbers. It's $10^{11}$ bodies in a n-body gravity integration, with each body having a mass, and 3D position & velocity vectors. And then you want to compute the forces at each step, preferably without having to consider each of the $10^{22}/2$ pairs of bodies separately.
PM 2Ring
<astrophysics><n-body-simulations><modeling>
How do various astrophysical models deal with so many orders of magnitude in scale? Are there completely different models for different scales?
uhoh
# How do various astrophysical models deal with so many orders of magnitude in scale? Are there completely different models for different scales?

(Asked by: username_0 on 2023-10-27)

If we just model our solar system's dynamics, one could use a straightforward numerical integrator with all n(n-1)/2 gravitational interactions along with some torques and non-gravitational forces. However it was found to be no less accurate (limited by the availability of measured data with with to fit) to treat certain tightly bound systems as somewhat isolated. For example, forces between the smallest moons of two widely separated planets don't need to be treated explicitly, and using the Jovian system's barycenter is sufficient to perturb Mercury's orbit.

Similarly, in the dynamics within a single galaxy numerical models don't treat all n(n-1) two-body forces when n=1011. Instead models can use some hybrid techniques - treating each of a large number of small volumes of the galaxy as having an average density, while at the same time using different models that operate on what's put inside each of those volumes.

Those are just examples of my meagre understanding of the topic.

But I'd like to ask, and this is a hard question to formulate and may be hard to answer - how do various astrophysical models deal with so many orders of magnitude in scale? Have they sort-of settled on some standard ways of chopping things up?

Just for a hypothetical example "class I" for solar systems, class II for stellar clusters or groups (IIa and IIb might be with or without a black hole) class III for entire galaxies, class IV for galactic clusters and class V for bigger/biggest?

You might embed one class in another, a galactic model might also contain say 100,000 stars with randomly initiated solar systems as sort of "test particles" within a fluid representing the rest of the matter.

Or is it better to characterize the current state of the art as still in the process of trying out all kinds of ways of dealing with scale?

---

For a nice illustration of how many orders of magnitude are involved, have a nice experience zooming out at <https://htwins.net/scale2/>

* distance from Earth to Moon at 108.8 meters
* distance from Voyager to Earth at 1013.5 meters
* observable universe at 1026.5 meters

**Tags:** astrophysics, n-body-simulations, modeling

> **Comments:**
> **username_1**: There are some interesting ideas for dealing with stuff at cosmological scales in this article from 2007: https://astronomy.swin.edu.au/sao/guest/knebe/ There's more recent info (also primarily about cosmological scales) in the article I linked here: https://astronomy.stackexchange.com/questions/55010/are-there-some-simple-mathematical-models-which-can-simulate-the-cellular-web/55035#comment124332_55010  
> **username_2**: Most of that is just built in to how floating point numbers work.  A 64 bit floating point number stores about 15 digits of precision, then varies the mantissa for scale, anywhere from about $10^{-308} $ to $ 10^{308} $.  When it comes time to add them together, they are added together starting with the smallest absolute values, ending with the largest.  
> **username_0**: @GregMiller The issue isn't as much the mix of large and small distances as it is the vast numerical *quantity of individual sources of gravity* that has to be managed by grouping them. For n object the number of pairs is n(n-1)/2. When n = $10^{11}$ that's a lot of objects to store in memory and a lot of pair-wise forces to evaluate every cycle, no matter what precision you choose.  
> **username_3**: @username_0 but then your question is not about dealing with orders of magnitude, but simply about the size of number of nodes of the simulations. That is not so different than elsewhere.  
> **username_3**: @Greg I think the gist of your comment captures the question asked in the title... But let's see whether that's the actual question which the op wants to ask  
> **username_3**: @username_0 sing the question again, I think your title asks about something else than the body. Imho the title is interesting while the body cannot have an answer and qualifies in this generality as to broad. Seems you might want to specify n-body simulations concerning gravitational interaction  
> **username_0**: @username_3 this is Astronomy SE - when we deal with gravity at various scales the issue related to the quantity of sources is baked right into the problem, therefore goes without saying, especially in a title.  
> **username_2**: @username_0 What aspect of processing $10^{11}$ numbers are you interested in?  There is no need to store them directly in memory, they can be stored on disk.  But it's not really that big of a number.  The NVidia RTX 3080 can do that many 64 bit floating operations in less than .25 seconds.  
> **username_1**: @Greg It's not $10^{11}$ numbers. It's $10^{11}$ bodies in a n-body gravity integration, with each body having a mass, and 3D position & velocity vectors. And then you want to compute the forces at each step, preferably without having to consider each of the $10^{22}/2$ pairs of bodies separately.  

---

## 1 answers

### Answer by username_4 on 2023-11-01. Score: 4 | Accepted answer

An attempt at a partial answer, or perhaps "one possible answer":

---

If I understand correctly, the problem you describe appears in numerical simulations where you have to choose between simulating a large enough volume, and fine enough details. If so, then the answer is *subgrid physics*.

As an example, let's say a cosmological hydro-simulation uses $10^{11}$ particles to simulate a cubic gigalightyear. If I've done my maths right, this would mean that each particle would represent $\sim10^7\,M\_\odot$. With a minimum of 10 (poor) to 100 (preferred) particles to represent a galaxy, this is acceptable if you're interested in, say, number statistics or clustering statistics of galaxies above $10^{8\text{–}9}\,M\_\odot$.

But $10^7\,M\_\odot$ is only the upper limit of the mass range of the molecular clouds from which stars are born, so how can you ever simulate star formation, which is important not only if you're interested in stellar populations and galaxy luminosities, but actually also affects the galaxy masses through their feedback which may push gas out of the galaxies?

The answer is that you use results from observations, analytical models, and lower-volume, higher-resolution simulations that teach you how stars are formed and how they affect the gas around them. From these you know for instance that gas needs to be 1) dense and 2) cold, in order to form a star. In your huge simulation you can then say "*If the density of gas particles exceeds a certain threshold, and their temperature is below some threshold, and if they have a negative velocity gradient, then (a fraction of) the gas particles should be converted to star particles*."

Subsequently you can say that stars are treated as either 1) low-mass or 2) high-mass. For the purposes of the simulation, given the size of a time step low-mass stars live forever while high-mass stars die instantly, being converted back into gas particles. A gas particle has an associated metallicity (and possibly dust), which has now increased by some yield, and because massive stars die not with a whimper, but with a bang, a certain amount of energy is now dumped into the surrounding gas particles as either heat, or momentum, or a mixture thereof, giving rise to feedback.

The scenario described above uses particles as an example, but the same approach is used for cell-based simulations. In both cases, we're dealing with physics that is not resolved by the particles/cells, and hence is referred to as *subgrid physics*.

The highest-resolution hydro-simulations of molecular clouds contain individual stars, but the stars themselves are not resolved. So how do we know how much energy they produce when they explode, how much metals they produce, what kind of spectrum they emit, etc.? Yes, by observations, analytical models, and even higher-resolution simulations that tell you how stars evolve.

> **Comments:**
> **username_0**: *Thanks!* You definitely understand the question correctly, and "subgrid physics" is the concept I needed to hear about. It also seems that no matter what the scale, simulations are generally better described as hydrodynamic than as n-body-like, i.e. there's a grid (though it may or may not be fixed). I wonder if there are a few well-defined scales that characterize most modern work (e.g. my class I through class V example) or not.  
> **username_4**: @username_0 It's true that hydro-sims are more realistic than pure N-body (given that the real world is not composed of dark matter only), but on the largest scales it's a rather minor error to not include it, so N-body codes definitely still are important. I don't think there's a scale that characterize most modern work, but to be honest I don't pay so much attention to scales that are significantly smaller than a galaxy.  
> **username_4**: In my work, that is. In my normal life I do occasionally pay attention to things that are smaller than galaxies.  

---

