aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs33
1 files changed, 32 insertions, 1 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
index df42487..f01b2860 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
@@ -220,9 +220,40 @@ namespace libTerrain
220 } 220 }
221 } 221 }
222 222
223 private void nsSimulate(int N, int rounds, double dt, double diff, double visc, double force, double source) 223 private void nsSimulate(int N, int rounds, double dt, double diff, double visc)
224 { 224 {
225 int size = (N * 2) * (N * 2);
225 226
227 double[] u = new double[size]; // Force, X axis
228 double[] v = new double[size]; // Force, Y axis
229 double[] u_prev = new double[size];
230 double[] v_prev = new double[size];
231 double[] dens = (double[])map.Clone();
232 double[] dens_prev = (double[])map.Clone();
233
234 for (int i = 0; i < rounds; i++)
235 {
236 u_prev = u;
237 v_prev = v;
238 dens_prev = dens;
239
240 nsVelStep(N, ref u, ref v, ref u_prev, ref v_prev, visc, dt);
241 nsDensStep(N, ref dens, ref dens_prev, ref u, ref v, diff, dt);
242 }
243
244 nsBufferToDoubles(ref dens, N, ref this.map);
245 }
246
247 /// <summary>
248 /// Performs computational fluid dynamics on a channel
249 /// </summary>
250 /// <param name="rounds">The number of steps to perform (Recommended: 20)</param>
251 /// <param name="dt">Delta Time - The time between steps</param>
252 /// <param name="diff">Fluid diffusion rate</param>
253 /// <param name="visc">Fluid viscosity</param>
254 public void navierStokes(int rounds, double dt, double diff, double visc)
255 {
256 nsSimulate(this.h, rounds, dt, diff, visc);
226 } 257 }
227 } 258 }
228} \ No newline at end of file 259} \ No newline at end of file