aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-07-25 10:08:16 +0000
committerAdam Frisby2007-07-25 10:08:16 +0000
commitcd88a4914dc31779a13d673aaaa6a1327ebeb351 (patch)
tree5626fed7ae06f4f39fb6f837f47b04dc2b642f28 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
parent* Several functions should now be more efficient with sending packets to the ... (diff)
downloadopensim-SC_OLD-cd88a4914dc31779a13d673aaaa6a1327ebeb351.zip
opensim-SC_OLD-cd88a4914dc31779a13d673aaaa6a1327ebeb351.tar.gz
opensim-SC_OLD-cd88a4914dc31779a13d673aaaa6a1327ebeb351.tar.bz2
opensim-SC_OLD-cd88a4914dc31779a13d673aaaa6a1327ebeb351.tar.xz
* Assorted terrain fixes
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs39
1 files changed, 35 insertions, 4 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
index a035098..8a111ed 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
@@ -211,11 +211,11 @@ namespace libTerrain
211 int i; 211 int i;
212 int j; 212 int j;
213 213
214 for (i = 0; i <= N; i++) 214 for (i = 1; i <= N; i++)
215 { 215 {
216 for (j = 0; j <= N; j++) 216 for (j = 1; j <= N; j++)
217 { 217 {
218 doubles[i, j] = dens[nsIX(i, j, N)]; 218 doubles[i - 1, j - 1] = dens[nsIX(i, j, N)];
219 } 219 }
220 } 220 }
221 } 221 }
@@ -229,7 +229,7 @@ namespace libTerrain
229 { 229 {
230 for (j = 1; j <= N; j++) 230 for (j = 1; j <= N; j++)
231 { 231 {
232 dens[nsIX(i, j, N)] = doubles[i, j]; 232 dens[nsIX(i, j, N)] = doubles[i - 1, j - 1];
233 } 233 }
234 } 234 }
235 } 235 }
@@ -272,5 +272,36 @@ namespace libTerrain
272 { 272 {
273 nsSimulate(this.h, rounds, dt, diff, visc); 273 nsSimulate(this.h, rounds, dt, diff, visc);
274 } 274 }
275
276 public void navierStokes(int rounds, double dt, double diff, double visc, ref double[,] uret, ref double[,] vret)
277 {
278 int N = this.h;
279
280 int size = (N * 2) * (N * 2);
281
282 double[] u = new double[size]; // Force, X axis
283 double[] v = new double[size]; // Force, Y axis
284 double[] u_prev = new double[size];
285 double[] v_prev = new double[size];
286 double[] dens = new double[size];
287 double[] dens_prev = new double[size];
288
289 nsDoublesToBuffer(this.map, N, ref dens);
290 nsDoublesToBuffer(this.map, N, ref dens_prev);
291
292 for (int i = 0; i < rounds; i++)
293 {
294 u_prev = u;
295 v_prev = v;
296 dens_prev = dens;
297
298 nsVelStep(N, ref u, ref v, ref u_prev, ref v_prev, visc, dt);
299 nsDensStep(N, ref dens, ref dens_prev, ref u, ref v, diff, dt);
300 }
301
302 nsBufferToDoubles(ref u, N, ref uret);
303 nsBufferToDoubles(ref v, N, ref vret);
304 nsBufferToDoubles(ref dens, N, ref this.map);
305 }
275 } 306 }
276} \ No newline at end of file 307} \ No newline at end of file