* Aerobic erosion now uses Navier Stokes algorithms for wind calculations.

afrisby
Adam Frisby 2007-07-22 02:48:53 +00:00
parent 0d7af9bbf0
commit 98b4701647
3 changed files with 27 additions and 10 deletions

View File

@ -409,7 +409,7 @@ namespace OpenSim.Region.Terrain
{ {
case "aerobic": case "aerobic":
// WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest
heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7])); heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), true);
break; break;
case "thermal": case "thermal":
heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4]));

View File

@ -74,7 +74,7 @@ namespace libTerrain
/// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param> /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param>
/// <param name="rounds">The number of erosion rounds (recommended: 25+)</param> /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param>
/// <param name="lowest">Drop sediment at the lowest point?</param> /// <param name="lowest">Drop sediment at the lowest point?</param>
public void AerobicErosion(double windspeed, double pickup_talus_minimum, double drop_talus_minimum, double carry, int rounds, bool lowest) public void AerobicErosion(double windspeed, double pickup_talus_minimum, double drop_talus_minimum, double carry, int rounds, bool lowest, bool usingFluidDynamics)
{ {
Channel wind = new Channel(w, h) ; Channel wind = new Channel(w, h) ;
Channel sediment = new Channel(w, h); Channel sediment = new Channel(w, h);
@ -83,7 +83,15 @@ namespace libTerrain
wind = this.copy(); wind = this.copy();
wind.normalise(); // Cheap wind calculations wind.normalise(); // Cheap wind calculations
wind *= windspeed; wind *= windspeed;
if (usingFluidDynamics)
{
wind.navierStokes(20, 0.1, 0.0, 0.0);
}
else
{
wind.pertubation(30); // Can do better later wind.pertubation(30); // Can do better later
}
for (i = 0; i < rounds; i++) for (i = 0; i < rounds; i++)
{ {
@ -115,10 +123,19 @@ namespace libTerrain
} }
} }
} }
if (usingFluidDynamics)
{
sediment.navierStokes(7, 0.1, 0.0, 0.1);
wind.navierStokes(10, 0.1, 0.0, 0.0);
}
else
{
wind.pertubation(15); // Can do better later
wind.seed++;
sediment.pertubation(10); // Sediment is blown around a bit sediment.pertubation(10); // Sediment is blown around a bit
sediment.seed++; sediment.seed++;
wind.pertubation(15); // So is the wind }
wind.seed++;
// Convert some sand to rock // Convert some sand to rock
for (x = 1; x < w - 1; x++) for (x = 1; x < w - 1; x++)

View File

@ -248,9 +248,9 @@ namespace libTerrain
/// Performs computational fluid dynamics on a channel /// Performs computational fluid dynamics on a channel
/// </summary> /// </summary>
/// <param name="rounds">The number of steps to perform (Recommended: 20)</param> /// <param name="rounds">The number of steps to perform (Recommended: 20)</param>
/// <param name="dt">Delta Time - The time between steps</param> /// <param name="dt">Delta Time - The time between steps (Recommended: 0.1)</param>
/// <param name="diff">Fluid diffusion rate</param> /// <param name="diff">Fluid diffusion rate (Recommended: 0.0)</param>
/// <param name="visc">Fluid viscosity</param> /// <param name="visc">Fluid viscosity (Recommended: 0.0)</param>
public void navierStokes(int rounds, double dt, double diff, double visc) public void navierStokes(int rounds, double dt, double diff, double visc)
{ {
nsSimulate(this.h, rounds, dt, diff, visc); nsSimulate(this.h, rounds, dt, diff, visc);