コード例 #1
0
ファイル: SupersonicInlet.cs プロジェクト: rohitvuppala/BoSSS
 /// <summary>
 /// Constructs a new supersonic inlet using the values defined by
 /// <paramref name="densityFunction"/>,
 /// <paramref name="velocityFunctions"/> and
 /// <paramref name="pressureFunction"/> as values at the boundary.
 /// </summary>
 /// <param name="config"><see cref="BoundaryCondition"/></param>
 /// <param name="densityFunction">
 /// The prescribed density at the inlet
 /// </param>
 /// <param name="velocityFunctions">
 /// The prescribed velocity components at the inlet
 /// </param>
 /// <param name="pressureFunction">
 /// The prescribed pressure at the inlet
 /// </param>
 public SupersonicInlet(MaterialProperty.Material config, Func <double[], double, double> densityFunction, Func <double[], double, double>[] velocityFunctions, Func <double[], double, double> pressureFunction)
     : base(config)
 {
     this.DensityFunction   = densityFunction;
     this.VelocityFunctions = velocityFunctions;
     this.PressureFunction  = pressureFunction;
 }
コード例 #2
0
        /// <summary>
        /// <see cref="BoundaryCondition"/>
        /// </summary>
        /// <param name="config"><see cref="BoundaryCondition"/></param>
        /// <param name="temperatureFunction">
        /// The predefined temperature
        /// </param>
        /// <param name="wallVelocities">
        /// Optional wall velocity (individual formula for each direction)
        /// </param>
        public IsothermalWall(MaterialProperty.Material config, Func <double[], double, double> temperatureFunction, Func <double[], double, double>[] wallVelocities = null)
            : base(config)
        {
            this.TemperatureFunction = temperatureFunction;
            this.WallVelocities      = wallVelocities;

            if (wallVelocities != null)
            {
                for (int d = 0; d < wallVelocities.Length; d++)
                {
                    if (wallVelocities[d] == null)
                    {
                        throw new Exception();
                    }
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Sets <see cref="pressureFunction"/>
 /// </summary>
 /// <param name="config"><see cref="BoundaryCondition"/></param>
 /// <param name="pressureFunction">
 /// The function for the prescribed (dimensionless) pressure in the
 /// free stream.
 /// </param>
 public SubsonicOutlet(MaterialProperty.Material config, Func <double[], double, double> pressureFunction)
     : base(config)
 {
     this.pressureFunction = pressureFunction;
 }
コード例 #4
0
 /// <summary>
 /// <see cref="BoundaryCondition"/>
 /// </summary>
 /// <param name="config"><see cref="BoundaryCondition"/></param>
 /// <param name="wallVelocities"></param>
 public AdiabaticSlipWall(MaterialProperty.Material config, Func <double[], double, double>[] wallVelocities = null)
     : base(config)
 {
     this.WallVelocities = wallVelocities;
 }
コード例 #5
0
        /// <summary>
        /// Mapping between edge tag names an the corresponding implementations
        /// of <see cref="BoundaryCondition"/>
        /// </summary>
        private BoundaryCondition BoundaryConditionFactory(CompressibleBcType bcType, MaterialProperty.Material material, byte EdgeTag)
        {
            //private static
            //Dictionary<string, Func<MaterialProperty.Material, AppControl.BoundaryValueCollection, BoundaryCondition>> boundaryValueMap =
            //new Dictionary<string, Func<MaterialProperty.Material, AppControl.BoundaryValueCollection, BoundaryCondition>>() {

            switch (bcType)
            {
            case CompressibleBcType.adiabaticSlipWall:
                return(new AdiabaticSlipWall(
                           material,
                           GetOptionalVelocityBoundaryValueFunction(EdgeTag)));

            case CompressibleBcType.symmetryPlane:
                return(new AdiabaticSlipWall(material));

            case CompressibleBcType.adiabaticWall:
                return(new AdiabaticWall(material));

            case CompressibleBcType.isothermalWall:
                return(new IsothermalWall(
                           material,
                           GetBoundaryValueFunction(EdgeTag, "T"),
                           GetOptionalVelocityBoundaryValueFunction(EdgeTag)));

            case CompressibleBcType.subsonicInlet:
                return(new SubsonicInlet(
                           material,
                           GetBoundaryValueFunction(EdgeTag, "rho"),
                           GetVelocityBoundaryValueFunction(EdgeTag)));

            case CompressibleBcType.subsonicPressureInlet:
                return(new SubsonicPressureInlet(
                           material,
                           GetBoundaryValueFunction(EdgeTag, "p0"),
                           GetBoundaryValueFunction(EdgeTag, "T0")));

            case CompressibleBcType.subsonicOutlet:
                return(new SubsonicOutlet(
                           material,
                           GetBoundaryValueFunction(EdgeTag, "p")));

            case CompressibleBcType.supersonicInlet:
                return(new SupersonicInlet(
                           material,
                           GetBoundaryValueFunction(EdgeTag, "rho"),
                           GetVelocityBoundaryValueFunction(EdgeTag),
                           GetBoundaryValueFunction(EdgeTag, "p")));

            case CompressibleBcType.supersonicOutlet:
                return(new SupersonicOutlet(material));

            case CompressibleBcType.ringleb:
                return(new ExactRinglebBoundaryState(material));

            default:
                throw new ArgumentException("unknown boundary type: " + bcType);
            }
        }
コード例 #6
0
 /// <summary>
 /// Constructs a new map by searching through all the edge tags
 /// (<see cref="GridData.EdgeData.EdgeTags"/> and instantiating sub classes
 /// of <see cref="BoundaryConditionMap"/> specific for the compressible
 /// Navier-Stokes solver depending on their edge tag names.
 /// </summary>
 /// <param name="gridData">The omnipresent grid data</param>
 /// <param name="control">Configuration options</param>
 public BoundaryConditionMap(IGridData gridData, AppControl control, MaterialProperty.Material __material) : base(gridData, control.BoundaryValues, bndFuncNames)
 {
     this.gridData = gridData;
     this.Material = __material;
     InitConditionMap();
 }
コード例 #7
0
        /// <summary>
        /// Vectorized version of <see cref="GetBoundaryState(double, Vector, Vector, StateVector)"/>
        /// </summary>
        public virtual void GetBoundaryState(MultidimensionalArray[] StateOut, double time, MultidimensionalArray X, MultidimensionalArray Normals, MultidimensionalArray[] StateIn, int Offset, int NoOfEdges, bool normalFlipped, MaterialProperty.Material material)
        {
            if (X.Dimension != 3)
            {
                throw new ArgumentException();
            }
            int    D         = X.GetLength(2);
            int    NoOfNodes = X.GetLength(1);
            double sign      = normalFlipped ? -1.0 : 1.0;

            if (StateIn.Length != D + 2)
            {
                throw new ArgumentException();
            }
            if (StateOut.Length != D + 2)
            {
                throw new ArgumentException();
            }
            bool is2D = D >= 2;
            bool is3D = D >= 3;

            if (D < 1 || D > 3)
            {
                throw new NotSupportedException();
            }

            var Density   = StateOut[0];
            var Energy    = StateOut[D + 1];
            var MomentumX = StateOut[1];
            var MomentumY = is2D ? StateOut[2] : null;
            var MomentumZ = is3D ? StateOut[3] : null;

            Vector xLocal      = new Vector(D);
            Vector normalLocal = new Vector(D);

            for (int e = 0; e < NoOfEdges; e++)
            {
                int edge = e + Offset;

                // Loop over nodes
                for (int n = 0; n < NoOfNodes; n++)
                {
                    xLocal.x      = X[edge, n, 0];
                    normalLocal.x = Normals[edge, n, 0] * sign;
                    if (is2D)
                    {
                        xLocal.y      = X[edge, n, 1];
                        normalLocal.y = Normals[edge, n, 1] * sign;
                    }
                    if (is3D)
                    {
                        xLocal.z      = X[edge, n, 2];
                        normalLocal.z = Normals[edge, n, 2] * sign;
                    }

                    StateVector stateIn = new StateVector(material, StateIn, edge, n, D);
                    //OptimizedHLLCFlux.State.Start();
                    StateVector stateBoundary = GetBoundaryState(time, xLocal, normalLocal, stateIn);
                    //OptimizedHLLCFlux.State.Stop();

                    Density[edge, n]   = stateBoundary.Density;
                    MomentumX[edge, n] = stateBoundary.Momentum.x;
                    if (is2D)
                    {
                        MomentumY[edge, n] = stateBoundary.Momentum.y;
                    }
                    if (is3D)
                    {
                        MomentumZ[edge, n] = stateBoundary.Momentum.z;
                    }
                    Energy[edge, n] = stateBoundary.Energy;
                }
            }
        }
コード例 #8
0
 /// <summary>
 /// Constructs a new boundary condition
 /// </summary>
 /// <param name="config">Configuration options</param>
 protected BoundaryCondition(MaterialProperty.Material config)
 {
     this.config = config;
 }
コード例 #9
0
 /// <summary>
 /// <see cref="BoundaryCondition"/>
 /// </summary>
 /// <param name="config"><see cref="BoundaryCondition"/></param>
 /// <param name="pressureFunction">
 /// The prescribed (stagnation) pressure
 /// </param>
 /// <param name="temperatureFunction">
 /// The prescribed (stagnation) temperature
 /// </param>
 public SubsonicPressureInlet(MaterialProperty.Material config, Func <double[], double, double> pressureFunction, Func <double[], double, double> temperatureFunction)
     : base(config)
 {
     this.TotalPressureFunction    = pressureFunction;
     this.TotalTemperatureFunction = temperatureFunction;
 }
コード例 #10
0
 /// <summary>
 /// <see cref="BoundaryCondition"/>
 /// </summary>
 /// <param name="config"><see cref="BoundaryCondition"/></param>
 public SupersonicOutlet(MaterialProperty.Material config)
     : base(config)
 {
 }
コード例 #11
0
 /// <summary>
 /// <see cref="BoundaryCondition"/>
 /// </summary>
 /// <param name="config"><see cref="BoundaryCondition"/></param>
 public AdiabaticWall(MaterialProperty.Material config)
     : base(config)
 {
 }
コード例 #12
0
 /// <summary>
 /// Constructs a new subsonic inlet using the values defined by
 /// <paramref name="densityFunction"/> and
 /// <paramref name="velocityFunctions"/> as values at the boundary.
 /// </summary>
 /// <param name="config"><see cref="BoundaryCondition"/></param>
 /// <param name="densityFunction">
 /// A function specifying the density at the boundary.
 /// </param>
 /// <param name="velocityFunctions">
 /// A function specifying the momentum at the boundary.
 /// </param>
 public SubsonicInlet(MaterialProperty.Material config, Func <double[], double, double> densityFunction, Func <double[], double, double>[] velocityFunctions)
     : base(config)
 {
     this.densityFunction   = densityFunction;
     this.velocityFunctions = velocityFunctions;
 }