code is irrevelant
look at the title and read that pdf
/*
* A Method for Modeling Clouds based on Atmospheric Fluid Dynamics
* Ryo Miyazaki Satoru Yoshida Yoshinori Dobashi† Tomoyuki Nishita
* University of Tokyo †Hokkaido University
* 7-3-1, Hongo, Bunkyo-ku Kita 13, Nishi 8, Kita-ku,
* Tokyo, 113-0033, Japan Sapporo, 060-8628, Japan
* {ryomiya, yoshida, nis}@nis-lab.is.s.u-tokyo.ac.jp doba@nis-ei.eng.hokudai.ac.jp
*
*
* Coded by me ;]
*
*
*/
//deltaV / deltaT = -(grad(pressure) / density) + visc_coeff*grad(V) ---- velocity
// grad(div) is the flow caused by the gradient of the mass flow around lattices
// Let vx be the x component of the velocity v for the current time step and vx* be the x component of v for the next time step.
/*
Velocity field update / Viscosity and Pressure Effect
vx is of course the x part of velocity vector
//vx*[x][y][z] = vx[x][y][z] + kv * grad(vx)[x][y][z] + kp * grad(diw)x //for the same cell
//kv is the viscosity ratio
//kp is the coefficient of the pressure effect
grad(vx)[x][y][z] = divBy6 * ( cell[x+1][y][z].v.x + cell[x-1][y][z].v.x + cell[x][y+1][z].v.x +
cell[x][y-1][z].v.x + cell[x][y][z+1].v.x + cell[x][y][z-1].v.x - 6.0f * cell[x][y][x].v.x );
grad(diw)x = divBy2 * ( cell[x+1][y][z].v.x + cell[x-1][y][z].v.x - 2.0f * cell[x][y][z].v.x ) +
divBy4 * ( cell[x+1][y+1][z].v.y + cell[x-1][y-1][z] - cell[x-1][y+1][z].v.y - cell[x+1][y-1][z].v.y +
cell[x+1][y][z+1].v.z + cell[x-1][y][z-1].v.z - cell[x-1][y][z+1].v.z - cell[x+1][y][z-1].v.z );
*/
/*
WATER VAPOR DIFFUSION
Wv*[x][y][z] = Wv[x][y][z] + temperature_coeff * grad(Wv)[x][y][z];
grad(Wv) = divBy6 * ( cell[x+1][y][z].w + cell[x-1][y][z].w + cell[x][y+1][z].w +
cell[x][y-1][z].w + cell[x][y][z+1].w + cell[x][y][z-1].w - 6.0f * cell[x][y][x].w );
*/
/*
Thermal Diffusion
E*[x][y][z] = E[x][y][z] + temp_diff_coeff * grad(E)[x][y][z];
grad(E) = divBy6 * ( cell[x+1][y][z].temp + cell[x-1][y][z].temp + cell[x][y+1][z].temp +
cell[x][y-1][z].temp + cell[x][y][z+1].temp + cell[x][y][z-1].temp - 6.0f * cell[x][y][x].temp );
*/
/*
Buoyancy AD NOTE 2.: since in paper we have z versor pointing upward we need to convert it to y component since we have lefthanded(or righthanded ;p) system
kb is the coefficient affecting the strength of the
buoyancy force.
Vz*(x,y,z) = Vz(x,y,z) + kb * divBy4 * ( 4.0f * E[x][y][z] - E[x+1][y][z] - E[x-1][y][z] - E[x][y+1][z] - E[x][y-1][z] );
so the code seems to be like this: (rewritten to y as up vector)
cell[x][y][z].v.y* = cell[x][y][z].y + kb * divBy4 * ( 4.0f * cell[x][y][z].temp - cell[x+1][y][z].temp - cell[x-1][y][z].temp -
cell[x][y][z+1] - cell [x][y][z-1] );
*/
/*
PHASE TRANSMISSION
(6) Phase Transition
The amount of water droplets generated by the phase
transition is determined in proportion to the difference
between the maximum amount of water vapor and the
amount of water vapor in each lattice. The maximum
amount of water vapor for a unit volume of air is a
function of its temperature (see appendix for details ).
APPENDIX
The amount of water droplets is proportional to the
difference between the maximum amount, 'wmax', of water
vapor 'wv' and the amount of water droplets 'wl' of each
lattice. That is, the amount of water droplets created at
each time step is computed by the following equation.
(A.1)
where alpha is the phase transition rate. Q is the latent heat.
wmax is a function of the temperature T[K] and is given by
the following equation:
( ) 217.0 exp[19.482 4303.4 /( 29.5)] / . max w T = - T - T (A.2)
*/
const long double viscosity_coeff = 0.9670;
const long double waterVapor_coeff = 0.9670;
const long double temperature_coeff = 0.9670;
const long double divBy6 = 0.16670; //1.(6)
const long double divBy4 = 0.250;
const long double divBy2 = 0.50;
/* Deleted bullcrap not even worth watching */
#endif
The problem with this is I really need to work out an ambient temperature value for each location on the map.
There are many topogrpahic temperature maps, by studying them you could create your own initial value map
Has anyone come across a way of calculating an ambient temperature for a location based on date/time/location data?
Thats almost impossible to achieve, unless your run fullscale simulation, and learn your program, how things change. (still it will be far from ideal due to external forces)
And the wind that causes temperature to move (cool down heat up).
I believe there are heat maps on nasa page, so you could make some kind of one year peroid temperature map (with maybe data from each month, or only for winter, spring, summer, autsomething , you wont be able to get acutal day, time, hour weather without running some simple simulation. or lerping <- which is bad as f
still code is wrong there, (didint have time to fix it) but the pdf is really good.
vital is to add third dimension. gravity, coriolis force or whatever its called
i am a bit to late with that post but was searchign for that code and pdf name.
but now i dont know if this is answered or what, still i could write an essay about weather