示例#1
0
        public static void TestBurgers_HighOrder(
            [Values(0, 1, 2, 3, 0, 1)] int PolyOrder,
            [Values(0.08, 0.08, 0.08, 0.08, 0.08, 0.08)] double TimestepSize,
            [Values("bdf", "bdf", "bdf", "bdf", "rk", "rk")] string Timestepper,
            [Values(8, 8, 8, 8, 8, 8)] int NoOfTs
            )
        {
            // set up
            // ------------------------------------------

            XdgTimesteppingTestControl ctrl = HardCodedControl.Burgers(angle: 0, degree: PolyOrder, GridResolutionFactor: 1, tsm: InterfaceMode.MovingInterface);

            if (Timestepper == "bdf")
            {
                switch (PolyOrder)
                {
                case 0: ctrl.TimeSteppingScheme = TimeSteppingScheme.ImplicitEuler; break;

                case 1: ctrl.TimeSteppingScheme = TimeSteppingScheme.CrankNicolson; break;

                case 2: ctrl.TimeSteppingScheme = TimeSteppingScheme.BDF3; break;

                case 3: ctrl.TimeSteppingScheme = TimeSteppingScheme.BDF4; break;

                default: throw new ArgumentOutOfRangeException();
                }
                ctrl.MultiStepInit = true;
            }
            else if (Timestepper == "rk")
            {
                switch (PolyOrder)
                {
                case 0: ctrl.TimeSteppingScheme = TimeSteppingScheme.ImplicitEuler; break;

                case 1: ctrl.TimeSteppingScheme = TimeSteppingScheme.CrankNicolson; break;

                //case 2: ctrl.TimeSteppingScheme = TimeSteppingScheme.RK4; break;
                //case 3: ctrl.TimeSteppingScheme = TimeSteppingScheme.RK4; break;
                default: throw new ArgumentOutOfRangeException();
                }
                ctrl.MultiStepInit = false;
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }

            Console.WriteLine("Polyorder = {0}, timestepper = {1}", PolyOrder, ctrl.TimeSteppingScheme);

            ctrl.NoOfTimesteps = NoOfTs;
            ctrl.dtFixed       = TimestepSize;
            ctrl.Endtime       = ctrl.dtFixed * ctrl.NoOfTimesteps;

            BoSSS.Solution.Application <XdgTimesteppingTestControl> .CommandLineOptions ops = null;
            //Console.WriteLine("Please remove me");
            //ops = new BoSSS.Solution.Application<XdgTimesteppingTestControl>.CommandLineOptions() {
            //    delPlt = true,
            //    ImmediatePlotPeriod = 1,
            //    SuperSampling = 3
            //};

            // run
            // ------------------------------------------

            XdgTimesteppingMain p = new XdgTimesteppingMain();

            p.Init(ctrl, ops);
            p.RunSolverMode();

            // evaluate/check
            // ------------------------------------------

            double thres    = 5.0e-7;
            double uA_Err   = (double)p.QueryHandler.QueryResults["uA_Err"];
            double uB_Err   = (double)p.QueryHandler.QueryResults["uB_Err"];
            double JmpL2Err = (double)p.QueryHandler.QueryResults["uJmp_Err"];

            Console.WriteLine("L2 Error of solution (A/B/jmp): {0}/{1}/{2} (threshold is {3}).", uA_Err, uB_Err, JmpL2Err, thres);
            Assert.LessOrEqual(uA_Err, thres);
            Assert.LessOrEqual(uB_Err, thres);
            Assert.LessOrEqual(JmpL2Err, thres);
        }
示例#2
0
        public static void TestConvection_MovingInterface_SingleInitLowOrder(
            [Values(TimeSteppingScheme.ExplicitEuler, TimeSteppingScheme.CrankNicolson, TimeSteppingScheme.ImplicitEuler,
                    TimeSteppingScheme.BDF2, TimeSteppingScheme.BDF3, TimeSteppingScheme.BDF4,
                    TimeSteppingScheme.RK1, TimeSteppingScheme.RK1u1, TimeSteppingScheme.RK3, TimeSteppingScheme.RK4,
                    TimeSteppingScheme.RK_ImplicitEuler, TimeSteppingScheme.RK_CrankNic, TimeSteppingScheme.RK_IMEX3)] TimeSteppingScheme tsc,
            [Values(0.2, 0.23)] double TimestepSize,
            [Values(8)] int NoOfTs
            )
        {
            // set up
            // ------------------------------------------

            XdgTimesteppingTestControl ctrl = HardCodedControl.Gerade(angle: 0, degree: 0, GridResolutionFactor: 1);

            ctrl.NoOfTimesteps      = NoOfTs;
            ctrl.dtFixed            = TimestepSize;
            ctrl.Endtime            = ctrl.dtFixed * ctrl.NoOfTimesteps;
            ctrl.MultiStepInit      = false;
            ctrl.TimeSteppingScheme = tsc;
            ctrl.InterfaceMode      = InterfaceMode.MovingInterface;

            BoSSS.Solution.Application <XdgTimesteppingTestControl> .CommandLineOptions ops = null;
            //Console.WriteLine("remove me VVVV");
            //ops = new BoSSS.Solution.Application<XdgTimesteppingTestControl>.CommandLineOptions() {
            //    delPlt = true,
            //    ImmediatePlotPeriod = 1,
            //    SuperSampling = 5
            //};

            // run
            // ------------------------------------------

            XdgTimesteppingMain p = new XdgTimesteppingMain();

            p.Init(ctrl, ops);
            p.RunSolverMode();

            // evaluate/check
            // ------------------------------------------
            double thres    = 5.0e-13;
            double uA_Err   = (double)p.QueryHandler.QueryResults["uA_Err"];
            double uB_Err   = (double)p.QueryHandler.QueryResults["uB_Err"];
            double JmpL2Err = (double)p.QueryHandler.QueryResults["uJmp_Err"];

            Console.WriteLine("L2 Error of solution (A/B/jmp): {0}/{1}/{2} (threshold is {3}).", uA_Err, uB_Err, JmpL2Err, thres);
            Assert.LessOrEqual(uA_Err, thres);
            Assert.LessOrEqual(uB_Err, thres);
            Assert.LessOrEqual(JmpL2Err, thres);
        }
示例#3
0
        public static void TestConvection_MovingInterface_MultiinitHighOrder(
            [Values(1, 2, 3)] int PolyOrder,
            [Values(0.2, 0.23)] double TimestepSize
            )
        {
            // set up
            // ------------------------------------------

            TimeSteppingScheme tsc;

            switch (PolyOrder)
            {
            case 0: tsc = TimeSteppingScheme.ImplicitEuler; break;

            case 1: tsc = TimeSteppingScheme.BDF2; break;

            case 2: tsc = TimeSteppingScheme.BDF3; break;

            case 3: tsc = TimeSteppingScheme.BDF4; break;

            default: throw new ArgumentOutOfRangeException();
            }


            XdgTimesteppingTestControl ctrl = HardCodedControl.Gerade(angle: 0, degree: PolyOrder, GridResolutionFactor: 1);

            ctrl.NoOfTimesteps      = 8;
            ctrl.dtFixed            = TimestepSize;
            ctrl.Endtime            = ctrl.dtFixed * ctrl.NoOfTimesteps;
            ctrl.MultiStepInit      = true;
            ctrl.TimeSteppingScheme = tsc;
            ctrl.InterfaceMode      = InterfaceMode.MovingInterface;

            BoSSS.Solution.Application <XdgTimesteppingTestControl> .CommandLineOptions ops = null;
            //ops = new BoSSS.Solution.Application<XdgTimesteppingTestControl>.CommandLineOptions() {
            //    delPlt = true,
            //    ImmediatePlotPeriod = 1,
            //    SuperSampling = 3
            //};

            // */

            // run
            // ------------------------------------------

            XdgTimesteppingMain p = new XdgTimesteppingMain();

            p.Init(ctrl, ops);
            p.RunSolverMode();

            // evaluate/check
            // ------------------------------------------

            double thres    = 5.0e-11;
            double uA_Err   = (double)p.QueryHandler.QueryResults["uA_Err"];
            double uB_Err   = (double)p.QueryHandler.QueryResults["uB_Err"];
            double JmpL2Err = (double)p.QueryHandler.QueryResults["uJmp_Err"];

            Console.WriteLine("L2 Error of solution (A/B/jmp): {0}/{1}/{2} (threshold is {3}).", uA_Err, uB_Err, JmpL2Err, thres);
            Assert.LessOrEqual(uA_Err, thres);
            Assert.LessOrEqual(uB_Err, thres);
            Assert.LessOrEqual(JmpL2Err, thres);
        }