Esempio n. 1
0
        protected override double RunSolverOneStep(int TimestepNo, double phystime, double dt)
        {
            using (new FuncTrace()) {
                base.NoOfTimesteps = int.MaxValue;
                base.EndTime       = endTime;

                // Set time step size
                if (dt <= 0)
                {
                    dt = dtFixed;
                }

                Console.Write("Timestep " + TimestepNo + " ...");

                if (phystime >= ChangeMetricTime)
                {
                    CustomTimestepConstraint.FirstMetricActive = false;
                }

                timeStepper.UpdateTimeInfo(new TimeInformation(TimestepNo, phystime, dt));

                timeStepper.Perform(dt);

                Console.WriteLine("finished");

                // Print L2 Norm at the end of the simulation run
                if (EndTime - phystime - dt < 1E-10)
                {
                    energyNorm = c.L2Norm();
                    Console.WriteLine("Energy norm = {0:0.000000000000000E-00}", energyNorm);
                }

                return(dt);
            }
        }
Esempio n. 2
0
        protected override double RunSolverOneStep(int TimestepNo, double phystime, double dt)
        {
            using (new FuncTrace()) {
                if (dt <= 0)
                {
                    NoOfTimesteps = 10000;
                    EndTime       = endTime;
                    dt            = dt_input;
                    //if (TimestepNo < 3)
                    //    dt /= 3;
                    if (EndTime - phystime < dt)
                    {
                        dt = EndTime - phystime;
                    }
                }

                if (TimestepNo % 100 == 0)
                {
                    Console.Write("Timestep " + TimestepNo + " ...");
                }

                timeStepper.UpdateTimeInfo(new TimeInformation(TimestepNo, phystime, dt));
                timeStepper.Perform(dt);

                if (TimestepNo % 100 == 0)
                {
                    Console.WriteLine("finished");
                }

                // Plot and print L2 Error Norm
                if (EndTime - phystime - dt < 1E-10)
                {
                    L2error = u.L2Error(Jump, 30);
                    Console.WriteLine("L2Error:" + L2error);
                }

                // TEST
                //Console.Write("Timestep " + TimestepNo + " ...");

                //timeStepper.Perform(dt);

                //Console.WriteLine("finished");
                //L2error = u.L2Error(Jump, 30);
                //Console.WriteLine("L2Error:" + L2error);

                //if (TimestepNo == NoOfTimesteps)
                //    Console.ReadKey();

                return(dt);
            }
        }