示例#1
0
        public Particle(int Dim, double[] startPos = null, double startAngl = 0.0)
        {
            SpatialDim = Dim;

            // Particle history
            // =============================
            for (int i = 0; i < m_HistoryLength; i++)
            {
                Position.Add(new double[Dim]);
                Angle.Add(new double());
                TranslationalVelocity.Add(new double[Dim]);
                TranslationalAcceleration.Add(new double[Dim]);
                RotationalVelocity.Add(new double());
                RotationalAcceleration.Add(new double());
                HydrodynamicForces.Add(new double[Dim]);
                HydrodynamicTorque.Add(new double());
            }

            // =============================
            if (startPos == null)
            {
                startPos = new double[Dim];
            }
            Position[0] = startPos;
            Position[1] = startPos;
            //From degree to radiant
            Angle[0] = StartingAngle = startAngl * 2 * Math.PI / 360;
            Angle[1] = startAngl * 2 * Math.PI / 360;

            //UpdateLevelSetFunction();
        }
示例#2
0
 /// <summary>
 /// The standard description of motion including hydrodynamics.
 /// </summary>
 /// <param name="gravity">
 /// The gravity (volume forces) acting on the particle.
 /// </param>
 /// <param name="density">
 /// The density of the particle.
 /// </param>
 public Motion(Vector gravity, double density)
 {
     if (gravity.IsNullOrEmpty())
     {
         gravity = new Vector(0, 0);
     }
     Gravity = new Vector(gravity);
     Density = density;
     for (int i = 0; i < NumberOfHistoryEntries; i++)
     {
         Position.Add(new Vector(SpatialDim));
         TranslationalVelocity.Add(new Vector(SpatialDim));
         TranslationalAcceleration.Add(new Vector(SpatialDim));
         HydrodynamicForces.Add(new Vector(SpatialDim));
         Angle.Add(new double());
         RotationalVelocity.Add(new double());
         RotationalAcceleration.Add(new double());
         HydrodynamicTorque.Add(new double());
     }
 }