Example #1
0
        /// <summary>
        /// Constructs a new state vector using data given in primitive
        /// variables
        /// </summary>
        /// <param name="material">
        /// The material/fluid associated with the represented state.
        /// </param>
        /// <param name="density"><see cref="Density"/></param>
        /// <param name="velocity"><see cref="Velocity"/></param>
        /// <param name="pressure"><see cref="Pressure"/></param>
        /// <returns></returns>
        public static StateVector FromPrimitiveQuantities(Material material, double density, Vector3D velocity, double pressure)
        {
            double      MachScaling = material.EquationOfState.HeatCapacityRatio * material.Control.MachNumber * material.Control.MachNumber;
            StateVector state       = new StateVector(
                material,
                density,
                density * velocity,
                material.EquationOfState.GetInnerEnergy(density, pressure) + 0.5 * MachScaling * density * velocity.AbsSquare());

            return(state);
        }