Exemplo n.º 1
0
 static void Main(string[] args)
 {
     _Main(args, false, delegate() {
         NSE_SIMPLEMain p = new NSE_SIMPLEMain();
         return(p);
     });
 }
Exemplo n.º 2
0
        public static void IncompressibleSteadyPoiseuilleFlowTest()
        {
            NSE_SIMPLEMain p = null;

            Application <SIMPLEControl> ._Main(new string[] { "-c cs:NSE_SIMPLE.Incompressible.ControlExamples.PoiseuilleFlow()" }, false, delegate() {
                p = new NSE_SIMPLEMain();
                return(p);
            });

            double err_u   = (double)p.QueryHandler.QueryResults["SolL2err_u"];
            double err_v   = (double)p.QueryHandler.QueryResults["SolL2err_v"];
            double err_p   = (double)p.QueryHandler.QueryResults["SolL2err_p"];
            double thres_u = 5.1e-6;
            double thres_v = 2.8e-6;
            double thres_p = 1.6e-5;


            Console.WriteLine("Number of SIMPLE iterations: " + p.SIMPLEStatus.SIMPLEStepNo + ". Expected number of iterations is less than 133.");
            Assert.IsTrue(p.SIMPLEStatus.SIMPLEStepNo < 133);

            Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_u + ")");
            Assert.IsTrue(err_u < thres_u);
            Console.WriteLine("L2 Error of solution v: " + err_v + " (threshold is " + thres_v + ")");
            Assert.IsTrue(err_v < thres_v);
            Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
            Assert.IsTrue(err_p < thres_p);
        }
Exemplo n.º 3
0
        public static void IncompressibleUnsteadyTaylorVortexTest()
        {
            NSE_SIMPLEMain p = null;

            Application <SIMPLEControl> ._Main(new string[] { "-c cs:NSE_SIMPLE.Incompressible.ControlExamples.UnsteadyTaylorVortex()" }, false, delegate() {
                p = new NSE_SIMPLEMain();
                return(p);
            });

            double err_u     = (double)p.QueryHandler.QueryResults["SolL2err_u"];
            double err_v     = (double)p.QueryHandler.QueryResults["SolL2err_v"];
            double err_p     = (double)p.QueryHandler.QueryResults["SolL2err_p"];
            double thres_vel = 8.2e-3;
            double thres_p   = 1.5e-2;

            if (p.SIMPLEStatus.CntMaxNoSIMPLEsteps > 0)
            {
                Console.WriteLine("WARNING: For this NUnitTest all time steps are expected to converge!");
            }
            Assert.IsTrue(p.SIMPLEStatus.CntMaxNoSIMPLEsteps == 0);

            Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_vel + ")");
            Assert.IsTrue(err_u < thres_vel);
            Console.WriteLine("L2 Error of solution v: " + err_v + " (threshold is " + thres_vel + ")");
            Assert.IsTrue(err_v < thres_vel);
            Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
            Assert.IsTrue(err_p < thres_p);
        }
Exemplo n.º 4
0
        public static void MultiphaseUnsteadyWaveTest()
        {
            NSE_SIMPLEMain p = null;

            Application <SIMPLEControl> ._Main(new string[] { "-c cs:NSE_SIMPLE.Multiphase.ControlExamples.UnsteadyMultiphaseWave()" }, false, delegate() {
                p = new NSE_SIMPLEMain();
                return(p);
            });

            double err_u     = (double)p.QueryHandler.QueryResults["SolL2err_u"];
            double err_p     = (double)p.QueryHandler.QueryResults["SolL2err_p"];
            double err_phi   = (double)p.QueryHandler.QueryResults["SolL2err_phi"];
            double err_rho   = (double)p.QueryHandler.QueryResults["SolL2err_Rho"];
            double thres_u   = 6.1e-6;
            double thres_p   = 4.6e-3;
            double thres_phi = 2.0e-3;
            double thres_rho = 2.0;

            if (p.SIMPLEStatus.CntMaxNoSIMPLEsteps > 0)
            {
                Console.WriteLine("WARNING: For this NUnitTest all time steps are expected to converge!");
            }
            Assert.IsTrue(p.SIMPLEStatus.CntMaxNoSIMPLEsteps == 0);

            Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_u + ")");
            Assert.IsTrue(err_u < thres_u);
            Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
            Assert.IsTrue(err_p < thres_p);
            Console.WriteLine("L2 Error of solution phi: " + err_phi + " (threshold is " + thres_phi + ")");
            Assert.IsTrue(err_phi < thres_phi);
            Console.WriteLine("L2 Error of solution rho: " + err_rho + " (threshold is " + thres_rho + ")");
            Assert.IsTrue(err_rho < thres_rho);
        }
Exemplo n.º 5
0
        public static void LowMachSteadyCouetteWithTemperatureGradientTest()
        {
            NSE_SIMPLEMain p = null;

            Application <SIMPLEControl> ._Main(new string[] { "-c cs:NSE_SIMPLE.LowMach.ControlExamples.SteadyCouetteFlowWithTemperatureGradient()" }, false, delegate() {
                p = new NSE_SIMPLEMain();
                return(p);
            });

            double err_u   = (double)p.QueryHandler.QueryResults["SolL2err_u"];
            double err_v   = (double)p.QueryHandler.QueryResults["SolL2err_v"];
            double err_p   = (double)p.QueryHandler.QueryResults["SolL2err_p"];
            double err_T   = (double)p.QueryHandler.QueryResults["SolL2err_T"];
            double thres_u = 3.7e-5;
            double thres_v = 2.3e-5;
            double thres_p = 5.1e-4;
            double thres_T = 2.0e-5;

            Console.WriteLine("Number of SIMPLE iterations: " + p.SIMPLEStatus.SIMPLEStepNo + ". Expected number of iterations is less than 430.");
            Assert.IsTrue(p.SIMPLEStatus.SIMPLEStepNo < 430);

            Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_u + ")");
            Assert.IsTrue(err_u < thres_u);
            Console.WriteLine("L2 Error of solution v: " + err_v + " (threshold is " + thres_v + ")");
            Assert.IsTrue(err_v < thres_v);
            Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
            Assert.IsTrue(err_p < thres_p);
            Console.WriteLine("L2 Error of solution T: " + err_T + " (threshold is " + thres_T + ")");
            Assert.IsTrue(err_T < thres_T);
        }
Exemplo n.º 6
0
        public static void MultiphaseUnsteadyWaveTest()
        {
            var C = NSE_SIMPLE.Multiphase.ControlExamples.UnsteadyMultiphaseWave();

            using (NSE_SIMPLEMain p = new NSE_SIMPLEMain()) {
                p.Init(C);
                p.RunSolverMode();

                double err_u     = (double)p.QueryHandler.QueryResults["SolL2err_u"];
                double err_p     = (double)p.QueryHandler.QueryResults["SolL2err_p"];
                double err_phi   = (double)p.QueryHandler.QueryResults["SolL2err_phi"];
                double err_rho   = (double)p.QueryHandler.QueryResults["SolL2err_Rho"];
                double thres_u   = 6.1e-6;
                double thres_p   = 4.6e-3;
                double thres_phi = 2.0e-3;
                double thres_rho = 2.0;

                if (p.SIMPLEStatus.CntMaxNoSIMPLEsteps > 0)
                {
                    Console.WriteLine("WARNING: For this NUnitTest all time steps are expected to converge!");
                }
                Assert.IsTrue(p.SIMPLEStatus.CntMaxNoSIMPLEsteps == 0);

                Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_u + ")");
                Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
                Console.WriteLine("L2 Error of solution phi: " + err_phi + " (threshold is " + thres_phi + ")");
                Console.WriteLine("L2 Error of solution rho: " + err_rho + " (threshold is " + thres_rho + ")");
                Assert.Less(err_u, thres_u, "L2 Error in velocity to high.");
                Assert.Less(err_p, thres_p, "L2 Error in pressure to high.");
                Assert.Less(err_phi, thres_phi, "L2 Error in level set to high.");
                Assert.Less(err_rho, thres_rho, "L2 Error in density to high.");
            }
        }
Exemplo n.º 7
0
        public static void IncompressibleUnsteadyTaylorVortexTest()
        {
            var C = NSE_SIMPLE.Incompressible.ControlExamples.UnsteadyTaylorVortex();

            using (NSE_SIMPLEMain p = new NSE_SIMPLEMain()) {
                p.Init(C);
                p.RunSolverMode();

                double err_u     = (double)p.QueryHandler.QueryResults["SolL2err_u"];
                double err_v     = (double)p.QueryHandler.QueryResults["SolL2err_v"];
                double err_p     = (double)p.QueryHandler.QueryResults["SolL2err_p"];
                double thres_vel = 8.2e-3;
                double thres_p   = 1.5e-2;

                if (p.SIMPLEStatus.CntMaxNoSIMPLEsteps > 0)
                {
                    Console.WriteLine("WARNING: For this NUnitTest all time steps are expected to converge!");
                }
                Assert.IsTrue(p.SIMPLEStatus.CntMaxNoSIMPLEsteps == 0);

                Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_vel + ")");
                Console.WriteLine("L2 Error of solution v: " + err_v + " (threshold is " + thres_vel + ")");
                Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
                Assert.Less(err_u, thres_vel);
                Assert.Less(err_v, thres_vel);
                Assert.Less(err_p, thres_p);
            }
        }
Exemplo n.º 8
0
        public static void IncompressibleSteadyPoiseuilleFlowTest()
        {
            var C = NSE_SIMPLE.Incompressible.ControlExamples.PoiseuilleFlow();

            using (NSE_SIMPLEMain p = new NSE_SIMPLEMain()) {
                p.Init(C);
                p.RunSolverMode();

                double err_u   = (double)p.QueryHandler.QueryResults["SolL2err_u"];
                double err_v   = (double)p.QueryHandler.QueryResults["SolL2err_v"];
                double err_p   = (double)p.QueryHandler.QueryResults["SolL2err_p"];
                double thres_u = 5.1e-6;
                double thres_v = 2.8e-6;
                double thres_p = 1.6e-5;

                Console.WriteLine("Number of SIMPLE iterations: " + p.SIMPLEStatus.SIMPLEStepNo + ". Expected number of iterations is less than 133.");
                Assert.IsTrue(p.SIMPLEStatus.SIMPLEStepNo < 133);

                Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_u + ")");
                Console.WriteLine("L2 Error of solution v: " + err_v + " (threshold is " + thres_v + ")");
                Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
                Assert.Less(err_u, thres_u);
                Assert.Less(err_v, thres_v);
                Assert.Less(err_p, thres_p);
            }
        }
Exemplo n.º 9
0
        public static void LowMachSteadyCouetteWithTemperatureGradientTest()
        {
            var C = NSE_SIMPLE.LowMach.ControlExamples.SteadyCouetteFlowWithTemperatureGradient();

            using (NSE_SIMPLEMain p = new NSE_SIMPLEMain()) {
                p.Init(C);
                p.RunSolverMode();


                double err_u   = (double)p.QueryHandler.QueryResults["SolL2err_u"];
                double err_v   = (double)p.QueryHandler.QueryResults["SolL2err_v"];
                double err_p   = (double)p.QueryHandler.QueryResults["SolL2err_p"];
                double err_T   = (double)p.QueryHandler.QueryResults["SolL2err_T"];
                double thres_u = 3.7e-5;
                double thres_v = 2.3e-5;
                double thres_p = 5.1e-4;
                double thres_T = 2.0e-5;

                Console.WriteLine("Number of SIMPLE iterations: " + p.SIMPLEStatus.SIMPLEStepNo + ". Expected number of iterations is less than 430.");
                Console.WriteLine("L2 Error of solution u: " + err_u + " (threshold is " + thres_u + ")");
                Console.WriteLine("L2 Error of solution v: " + err_v + " (threshold is " + thres_v + ")");
                Console.WriteLine("L2 Error of solution p: " + err_p + " (threshold is " + thres_p + ")");
                Console.WriteLine("L2 Error of solution T: " + err_T + " (threshold is " + thres_T + ")");

                Assert.IsTrue(p.SIMPLEStatus.SIMPLEStepNo < 430);

                Assert.Less(err_u, thres_u);
                Assert.Less(err_v, thres_v);
                Assert.Less(err_p, thres_p);
                Assert.Less(err_T, thres_T);
            }
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            //NSE_SIMPLE.NUnitTest.Init();
            //NSE_SIMPLE.NUnitTest.IncompressibleSteadyPoiseuilleFlowTest();
            //Assert.AreEqual(true, false, "remove me");

            _Main(args, false, delegate() {
                NSE_SIMPLEMain p = new NSE_SIMPLEMain();
                return(p);
            });
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            NSE_SIMPLE.NUnitTest.Init();
            NSE_SIMPLE.NUnitTest.LowMachSteadyCouetteWithTemperatureGradientTest();
            Assert.AreEqual(true, false, "remove me");

            _Main(args, false, delegate() {
                NSE_SIMPLEMain p = new NSE_SIMPLEMain();
                return(p);
            });
        }
Exemplo n.º 12
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="_app"></param>
        /// <param name="_edgeTagNames">
        /// Edgetags, which should be considered for calculating the forces.
        /// </param>
        public Force(NSE_SIMPLEMain _app, string[] _edgeTagNames)
        {
            m_app = _app;
            CreateFields();

            NoOfEdges    = _edgeTagNames.Length;
            edgeTagNames = _edgeTagNames;

            XForceIntegral  = new EdgeIntegral[NoOfEdges];
            YForceIntegral  = new EdgeIntegral[NoOfEdges];
            ZMomentIntegral = new EdgeIntegral[NoOfEdges];


            if (m_app.GridData.SpatialDimension == 3)
            {
                ZForceIntegral  = new EdgeIntegral[NoOfEdges];
                XMomentIntegral = new EdgeIntegral[NoOfEdges];
                YMomentIntegral = new EdgeIntegral[NoOfEdges];
            }

            InitEdgeIntegrals();
        }
Exemplo n.º 13
0
 public MomentFlux3D(int _Component, NSE_SIMPLEMain _app)
 {
     m_app       = _app;
     m_Component = _Component;
     m_Reynolds  = m_app.SolverConf.Control.Reynolds;
 }
Exemplo n.º 14
0
 public MomentFlux2D(NSE_SIMPLEMain _app)
 {
     m_app      = _app;
     m_Reynolds = m_app.SolverConf.Control.Reynolds;
 }