Live data from Hacker News

Fluid Simulation for Dummies (2006)

mikeash.com

21–23 of 23 posts

Re: Fluid Simulation for Dummies (2006)

#21
post #14

Earlier quoted context omitted.

Atmospheric circulation. hadley cell, polar cell, and mid-latitude cells. It would also be interesting to see how new bands would occur if we increased the rotational speed of the earth, thus increasing the strength of the coriolis effect. It would also be neat to draw your own continents and orography and see how that impacts climate. which places become more wet/dry, etc. Change how much long wave radiation is abso…

Interestingly, most large-scale atmospheric models I know of use a (mostly) incompressble fluid approximation, even though air is obviously compressible at human scales. It just isn't at the flow speeds and length scales of global-scale fluid models. Where compressibility is important for those models is where density changes due to temperature. Look into the Boussinesq and anelastic approximations if you're interest…

that's interesting because my understanding was that a lot of models used pressure as the vertical (height) coordinate and with tracking temperature at any given coordinate lets you know the density of the air at any point.

Re: Fluid Simulation for Dummies (2006)

#22
post #21

Earlier quoted context omitted.

Interestingly, most large-scale atmospheric models I know of use a (mostly) incompressble fluid approximation, even though air is obviously compressible at human scales. It just isn't at the flow speeds and length scales of global-scale fluid models. Where compressibility is important for those models is where density changes due to temperature. Look into the Boussinesq and anelastic approximations if you're interest…

that's interesting because my understanding was that a lot of models used pressure as the vertical (height) coordinate and with tracking temperature at any given coordinate lets you know the density of the air at any point.

That's typical of models that use the anelastic approximation, where it's useful for a number of reasons to rewrite the equations replacing the true vertical with a vertically stratified variable. I've seen density, pressure and temperature used.

That's less of a different model and more a different way to rewrite the equations to make them easier to analyse or simulate.

We might be talking at slightly different angles here. There's a strong difference in the equations between compressibity of the fluid due to compression and changes in density due to temperature, chemical concentration, etc. The term compressibility usually refers to the first usage, and modelling it leads to sound waves in the system and has major implications for how the system is simulated, I mean it's an entirely different class of algorithms. The second, where density still changes but not due to compression, so no sound waves, that can be easily modelled without including full compressibility. This allows (generally simpler) incompressible models to still incorporate useful thermal physics where important, like in climate and weather. Also, the smaller the scale of the system the more compressibility matters so I wouldn't be surprised if compressibility starts to matter for e.g. Tornados. But I'm not certain on that...

Re: Fluid Simulation for Dummies (2006)

#23
Nice.

The earliest jaw-dropping water effect I saw (and somewhat understood at 14) was the awesome credits scene from the Iguana's Earthquake demo[0].

The code[1] contains the following explanation (ancient DOS chars fixed with chatGPT)

  ; // UpdateTable : performs one integration step on U[CT]
  ; Differential equation is:  u  = a²( u  + u  )
  ;                             tt       xx   yy
  ;
  ; Where a² = tension * gravity / surface_density.
  ;
  ; Approximating second derivatives by central differences:
  ;
  ;  [ u(t+1)-2u(t)+u(t-1) ] / Δt² = a² (u(x+1)+u(x-1)+u(y+1)+u(y-1)-4u) / h²
  ;
  ; (where Δt = time step, h=Δx=Δy = mesh resolution)
  ;
  ; From where u(t+1) may be calculated as:
  ;                   ┌   1   ┐
  ; u(t+1) = a²Δt²/h² │ 1 0 1 │u - u(t-1) + (2-4a²Δt²/h²)u
  ;                   └   1   ┘
  ;
  ; When a²Δt²/h² = ½ last term vanishes, giving:
  ;                   ┌   1   ┐
  ;        u(t+1) = ½ │ 1 0 1 │u - u(t-1)
  ;                   └   1   ┘
  ;
  ; This needs only 4 ADD/SUB and one SAR operation per mesh point!

[0] https://www.pouet.net/prod.php?which=364

[1] https://hornet.org/code/demosrc/demos/hq_water.zip

Post reply on HN