Ejemplo n.º 1
0
        public static WBSolver GetNewSolver2(WBProjectOptions options)
        {
            var layerOpts2 = StandartOpts;
            var geom       = new GunShape();

            geom.AddPoint(layerOpts2.X_left - 0.2, 0.132);
            geom.AddPoint(layerOpts2.X_right + 5, 0.132);
            var initLayer = new OvLayer();

            initLayer.Geom = geom;
            GunPowder powder = new GunPowder();

            powder = powder_AGARD();
            List <GunPowder> powder_list = new List <GunPowder>()
            {
                powder
            };
            List <double> conc_list = new List <double>()
            {
                1
            };
            MixtureGunPowder mixture = new MixtureGunPowder(powder_list, conc_list);

            initLayer.InitLayer(0d, layerOpts2, MySuoerFunc(mixture), InitOvBound);
            var grid   = new OvGridRK("OvGrid_tst1", initLayer);
            var solver = new WBSolver(grid, options);

            initLayer.SynchNodes_X_V();
            return(solver);
        }
Ejemplo n.º 2
0
        public void GetWTest2()
        {
            var g = new GunShape();

            g.AddPoint(0, 3);
            g.AddPoint(3, 0);
            Assert.AreEqual(7.0685834705770345, g.GetW(0, 3), 0.0000001);
            Assert.AreEqual(7.0685834705770345, g.GetW(-10, 30), 0.0000001);
            Assert.AreEqual(1.8326, g.GetW(1, 2), 0.0001);
        }
Ejemplo n.º 3
0
        public void GetWTest()
        {
            var g = new GunShape();

            g.AddPoint(0, 3);
            g.AddPoint(3, 0);
            Assert.AreEqual(0d, g.GetW(-3, -1));
            Assert.AreEqual(0d, g.GetW(4, 17));
            Assert.AreEqual(0d, g.GetW(-3, -0.00001));
            Assert.AreEqual(0d, g.GetW(-3, 0));
        }
        public static WBSolver GetNewSolver(WBProjectOptions options)
        {
            var layerOpts = StandartOpts;
            var geom      = new GunShape();

            geom.AddPoint(layerOpts.X_left - 10, 0.2);
            geom.AddPoint(layerOpts.X_right + 10, 0.2);
            var initLayer = new GasLayer();

            initLayer.Geom = geom;
            initLayer.InitLayer(0d, layerOpts, InitGasCell, InitGasBound);
            var grid   = new GasGrid("GasGrid_tst1", initLayer);
            var solver = new WBSolver(grid, options);

            return(solver);
        }
Ejemplo n.º 5
0
        public void GetWTest4()
        {
            var g = new GunShape();

            g.AddPoint(0, 2);
            g.AddPoint(1, 2);
            g.AddPoint(2, 1);
            g.AddPoint(3, 1);
            Assert.AreEqual(1.8326 + 3.1415926535897931 + 0.78539816339744828, g.GetW(-10, 10), 0.0001);
            Assert.AreEqual(1.8326 + 3.1415926535897931 * 0.5 + 0.78539816339744828 * 0.5, g.GetW(0.5, 2.5), 0.0001);
            Assert.AreEqual(1.8326 + 3.1415926535897931 * 0 + 0.78539816339744828 * 0.5, g.GetW(1, 2.5), 0.0001);
            Assert.AreEqual(1.8326 + 3.1415926535897931 * 0 + 0.78539816339744828 * 0, g.GetW(1, 2), 0.0001);
            Assert.AreEqual(1.8326 + 3.1415926535897931 * 0.5 + 0.78539816339744828 * 0, g.GetW(0.5, 2), 0.0001);
            //Assert.AreEqual(7.0685834705770345, g.GetW(0, 3), 0.0000001);
            //Assert.AreEqual(1.8326, g.GetW(1, 2), 0.0001);
        }
        public void InvalidDataTest()
        {
            var gs = new GunShape();

            gs.AddPoint(2, 3);
            gs.AddPoint(1, 3);
            gs.AddPoint(3, 2);
            gs.AddPoint(-2, 1);
            gs.AddPoint(7, 2);
            gs.AddPoint(3 + gs.x_delta * 0.7, 2);
            gs.AddPoint(-2, 1);
            gs.AddPoint(-2, 1);
            var s = gs.InvalidData();

            Assert.AreNotEqual("", s);
        }
        public static WBSolver GetNewSolver2(WBProjectOptions options)
        {
            var layerOpts1 = StandartOpts1;
            var geom       = new GunShape();

            geom.AddPoint(layerOpts1.X_left - 0.2, 0.2);
            geom.AddPoint(layerOpts1.X_right * 100, 0.2);
            var initLayer = new GasLayer();

            initLayer.Geom = geom;
            initLayer.InitLayer(0d, layerOpts1, InitGasCell1, InitGasBound);
            var grid   = new PnGrid("GasGrid_tst1", initLayer);
            var solver = new WBSolver(grid, options);

            initLayer.SynchNodes_X_V();
            return(solver);
        }
        public static WBSolver GetNewSolver(WBProjectOptions options)
        {
            var    layerOpts = StandartOpts;
            var    geom = new GunShape();
            double d0 = 0.023, d1 = 0.016, l0 = 0.1, l1 = 0.1;

            geom.AddPoint(layerOpts.X_left - 10, d0);
            geom.AddPoint(l0, d0);
            geom.AddPoint(l0 + l1, d1);
            geom.AddPoint(l0 + l1 + 1000, d1);
            var initLayer = new GasLayer();

            initLayer.Geom = geom;
            initLayer.InitLayer(0d, layerOpts, InitIdealPCell, InitElasticPBound);
            var grid   = new IdealPiston.PistonGrid("ElasticP_tst1", initLayer);
            var solver = new WBSolver(grid, options);

            return(solver);
        }
        public static WBSolver GetNewSolver1(WBProjectOptions options)
        {
            var layerOpts = StandartOpts;
            var geom      = new GunShape();

            geom.AddPoint(layerOpts.X_left - 10, 0.2);
            geom.AddPoint(layerOpts.X_right + 10, 0.2);
            var initLayer = new GasLayer();

            initLayer.Geom = geom;
            initLayer.InitLayer(0d, layerOpts, InitGasCell, InitGasBound);
            var grid   = new GasGrid("GasGrid_tst1", initLayer);
            var solver = new WBSolver(grid, options);

            initLayer.RealBoundsRev[0].V = 0;
            initLayer.RealBounds[0].V    = 0.5;
            // initLayer.RealCells.ForEach(n => n.u = 0.5);
            initLayer.SynchNodes_X_V();
            return(solver);
        }
        public void STest()
        {
            var gs = new GunShape();

            gs.AddPoint(2, 3);
            gs.AddPoint(1, 3);
            gs.AddPoint(3, 2);
            gs.AddPoint(-2, 1);
            gs.AddPoint(7, 2);

            Assert.AreEqual(0d, gs.GetV(-10));
            Assert.AreEqual(0d, gs.GetV(10));
            Assert.AreEqual(1d, gs.GetV(-2));
            Assert.AreEqual(2d, gs.GetV(3));
            Assert.AreEqual(3d, gs.GetV(1));
            Assert.AreEqual(2d, gs.GetV(7));
            Assert.AreEqual(3d, gs.GetV(2));
            Assert.AreEqual(2d, gs.GetV(5));
            Assert.AreEqual(2.5, gs.GetV(2.5));
            Assert.AreEqual(2d, gs.GetV(-0.5), 0.00000001);
            Assert.AreEqual(2.25, gs.GetV(2.75), 0.00000001);
        }