public static XdgTimesteppingTestControl Rarefaction(int degree = 2, int NoOfTimesteps = 20, InterfaceMode tsm = InterfaceMode.MovingInterface, int GridResolutionFactor = 2) { XdgTimesteppingTestControl R = new XdgTimesteppingTestControl(); R.ProjectName = "XdgMassMatrixEvolution/Rarefaction"; R.savetodb = false; //R.DbPath = @"\\fdyprime\userspace\kummer\BoSSS-db-XNSE"; R.DbPath = null; // DG config // ========= R.FieldOptions.Add("Phi", new FieldOpts() { Degree = 2, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); R.FieldOptions.Add("u", new FieldOpts() { Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); R.FieldOptions.Add("Vx", new FieldOpts() { Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); R.FieldOptions.Add("Vy", new FieldOpts() { Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); // grid // ==== R.GridFunc = delegate() { double[] nodes = GenericBlas.Linspace(-2.7, 2.7, 18 * GridResolutionFactor + 1); BoundingBox cutOut = new BoundingBox(new double[] { -0.3, -0.3 }, new double[] { 0.3, 0.3 }); var grd = Grid2D.Cartesian2DGrid(nodes, nodes, CutOuts: cutOut); grd.EdgeTagNames.Add(1, "Inflow"); grd.EdgeTagNames.Add(2, "Outflow"); grd.DefineEdgeTags(delegate(double[] X) { byte ret = 2; if (Math.Abs(X[0]) <= 0.31 && Math.Abs(X[1]) <= 0.31) { ret = 1; } return(ret); }); return(grd); }; // exact solution // ============== R.uA_Ex = ((X, t) => 3.0 / Math.Sqrt(X[0].Pow2() + X[1].Pow2())); R.uB_Ex = ((X, t) => 1.0 / Math.Sqrt(X[0].Pow2() + X[1].Pow2())); // boundary condition // ================== R.AddBoundaryCondition("Inflow", "u", R.uA_Ex); R.AddBoundaryCondition("Outflow"); // Initial values // ============== const double S = 1; R.S = ((double[] X, double t) => S); R.Phi = ((double[] X, double t) => X[0].Pow2() + X[1].Pow2() - (1.0 + t).Pow2()); R.CircleRadius = t => (1.0 + t); R.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.ExactCircle; R.InitialValues_Evaluators.Add("Phi", X => R.Phi(X, 0.0)); R.InitialValues_Evaluators.Add("Vx", X => X[0] / Math.Sqrt(X[0].Pow2() + X[1].Pow2())); R.InitialValues_Evaluators.Add("Vy", X => X[1] / Math.Sqrt(X[0].Pow2() + X[1].Pow2())); R.InitialValues_Evaluators.Add("u#A", X => R.uA_Ex(X, 0.0)); R.InitialValues_Evaluators.Add("u#B", X => R.uB_Ex(X, 0.0)); // restart // ======= //R.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(new Guid("aff36e92-1546-4fdf-a7bc-fbeff1e67f49"), 58); //R.InitialValues_Evaluators.Clear(); // anderes zeugs // ============= R.TimeSteppingScheme = TimeSteppingScheme.BDF4; R.InterfaceMode = tsm; //R.Endtime = 0.05; R.Endtime = 0.4; R.NoOfTimesteps = NoOfTimesteps; R.dtFixed = R.Endtime / R.NoOfTimesteps; R.AgglomerationThreshold = 0.1; // return // ====== return(R); }
public static XdgTimesteppingTestControl Gerade( double angle = 5 *Math.PI / 180.0, int degree = 0, int GridResolutionFactor = 1, double t_offset = 0.0) { XdgTimesteppingTestControl R = new XdgTimesteppingTestControl(); R.ProjectName = "XdgMassMatrixEvolution/Gerade"; R.DbPath = null; R.savetodb = false; // DG degree // ========= R.FieldOptions.Add("Phi", new FieldOpts() { Degree = 3, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); R.FieldOptions.Add("u", new FieldOpts() { Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); R.FieldOptions.Add("Vx", new FieldOpts() { Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); R.FieldOptions.Add("Vy", new FieldOpts() { Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE }); // grid // ==== R.GridFunc = delegate() { var grd = Grid2D.Cartesian2DGrid( GenericBlas.Linspace(-7, 7, 7 * GridResolutionFactor + 1), GenericBlas.Linspace(-7, 7, 7 * GridResolutionFactor + 1) ); grd.EdgeTagNames.Add(1, "Inflow"); grd.DefineEdgeTags(X => (byte)1); return(grd); }; // level-set over time // =================== const double S = 0.9; R.S = ((double[] X, double t) => S); double Nx = Math.Cos(angle); double Ny = Math.Sin(angle); R.Phi = ((double[] X, double t) => (X[0] - Nx * S * (t + t_offset)) * Nx + (X[1] - Ny * S * (t + t_offset)) * Ny); // exact solution // ============== R.uA_Ex = ((X, t) => 0.8); R.uB_Ex = ((X, t) => 1.66); // Initial Values // ============== R.InitialValues_Evaluators.Add("Phi", X => R.Phi(X, 0.0)); R.InitialValues_Evaluators.Add("Vx", X => Nx * S); R.InitialValues_Evaluators.Add("Vy", X => Ny * S); R.InitialValues_Evaluators.Add("u#A", X => R.uA_Ex(X, 0.0)); R.InitialValues_Evaluators.Add("u#B", X => R.uB_Ex(X, 0.0)); // Boundary values // =============== R.AddBoundaryCondition("Inflow", "u", (X, t) => 0.8); // Timestepping config // =================== R.NoOfTimesteps = 1; R.Endtime = 2; R.dtFixed = R.Endtime / R.NoOfTimesteps; R.TimeSteppingScheme = TimeSteppingScheme.ExplicitEuler; R.InterfaceMode = InterfaceMode.MovingInterface; R.AgglomerationThreshold = 0.1; // return // ====== return(R); }