Exemple #1
0
        /// <summary>
        /// Control for the testcase according to Smolianksi
        /// </summary>
        /// <param name="p"></param>
        /// <param name="kelem"></param>
        /// <param name="_DbPath"></param>
        /// <returns></returns>
        public static XNSE_Control RT_Smolianski(int p = 2, int kelem = 32, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            // basic database options
            // ======================
            #region db

            //_DbPath = @"D:\local\local_Testcase_databases\Testcase_RTinstability";
            _DbPath = @"\\fdyprime\userspace\smuda\cluster\cluster_db";

            C.DbPath      = _DbPath;
            C.savetodb    = C.DbPath != null;
            C.ProjectName = "XNSE/RT-Instability";
            C.Tags.Add("unstable");
            //C.Tags.Add("smolianski");

            #endregion

            //C.LogValues = XNSE_Control.LoggingValues.Wavelike;
            //C.WriteInterfaceP = true;


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = 4,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = 8,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // grid genration
            // ==============
            #region grid

            double L = 1;
            double H = 4.0 * L;

            C.GridFunc = delegate() {
                // Smolianski
                //double[] Xnodes = GenericBlas.Linspace(0, L, kelem + 1);
                //double[] Ynodes = GenericBlas.Linspace(0, H, (4 * kelem) + 1);
                //var grd = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: false);

                double[] xNodes = GenericBlas.Linspace(0, L, kelem + 1);

                double[] _yNodes1 = GenericBlas.Linspace(0, 2.2, (int)(2.2 * kelem) + 1);
                _yNodes1 = _yNodes1.GetSubVector(0, (_yNodes1.Length - 1));
                var _yNodes2 = Grid1D.TanhSpacing(2.2, 4.0, (kelem / 2) + 1, 1.5, true);

                var yNodes = ArrayTools.Cat(_yNodes1, _yNodes2);


                var grd = Grid2D.Cartesian2DGrid(xNodes, yNodes, periodicX: false);

                grd.EdgeTagNames.Add(1, "wall_lower");
                grd.EdgeTagNames.Add(2, "wall_upper");
                grd.EdgeTagNames.Add(3, "freeslip_left");
                grd.EdgeTagNames.Add(4, "freeslip_right");


                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - H) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - L) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                return(grd);
            };


            //double L = 1; //lambda_instable;
            //double H = 1.0 * L;
            //double H_interf = L / 4.0;

            ////int xkelem = 20;
            //int ykelem_Interface = 1 * kelem / 2;
            //int ykelem_outer = kelem / 2;

            //C.GridFunc = delegate () {
            //    double[] xNodes = GenericBlas.Linspace(0, L, kelem + 1);
            //    //double[] Ynodes_Interface = GenericBlas.Linspace(-(H_interf) / 2.0, (H_interf) / 2.0, ykelem_Interface);
            //    //Ynodes_Interface = Ynodes_Interface.GetSubVector(1, Ynodes_Interface.GetLength(0) - 2);
            //    //double[] Ynodes_lower = GenericBlas.Linspace(-(H + (H_interf / 2.0)), -(H_interf / 2.0), ykelem_outer + 1);
            //    //double[] Ynodes_upper = GenericBlas.Linspace((H_interf / 2.0), H + (H_interf / 2.0), ykelem_outer + 1);
            //    //double[] Ynodes = Ynodes_lower.Concat(Ynodes_Interface).ToArray().Concat(Ynodes_upper).ToArray();
            //    var _yNodes1 = Grid1D.TanhSpacing(-(H + (H_interf / 2.0)), -(H_interf / 2.0), ykelem_outer + 1, 1.5, false);
            //    _yNodes1 = _yNodes1.GetSubVector(0, (_yNodes1.Length - 1));
            //    var _yNodes2 = GenericBlas.Linspace(-H_interf / 2.0, H_interf / 2.0, ykelem_Interface);
            //    _yNodes2 = _yNodes2.GetSubVector(0, (_yNodes2.Length - 1));
            //    var _yNodes3 = Grid1D.TanhSpacing((H_interf / 2.0), H + (H_interf / 2.0), ykelem_outer + 1, 1.5, true);
            //    var yNodes = ArrayTools.Cat(_yNodes1, _yNodes2, _yNodes3);

            //    var grd = Grid2D.Cartesian2DGrid(xNodes, yNodes, periodicX: true);

            //    grd.EdgeTagNames.Add(1, "wall_lower");
            //    grd.EdgeTagNames.Add(2, "wall_upper");


            //    grd.DefineEdgeTags(delegate (double[] X) {
            //        byte et = 0;
            //        if (Math.Abs(X[1] + ((H_interf / 2.0) + H)) <= 1.0e-8)
            //            et = 1;
            //        if (Math.Abs(X[1] - ((H_interf / 2.0) + H)) <= 1.0e-8)
            //            et = 2;
            //        if (Math.Abs(X[0]) <= 1.0e-8)
            //            et = 3;
            //        if (Math.Abs(X[0] - L) <= 1.0e-8)
            //            et = 4;

            //        return et;
            //    });

            //    return grd;
            //};

            #endregion


            // boundary conditions
            // ===================
            #region BC

            C.AddBoundaryCondition("wall_lower");
            C.AddBoundaryCondition("wall_upper");
            C.AddBoundaryCondition("freeslip_left");
            C.AddBoundaryCondition("freeslip_right");

            #endregion


            // Initial Values
            // ==============
            #region init

            int    k  = 1;
            double A0 = 0.05;
            C.InitialValues_Evaluators.Add("Phi", (X => X[1] - (2.0 + A0 * Math.Cos(2.0 * Math.PI * X[0]))));

            C.InitialValues_Evaluators.Add("VelocityY#A", X => 0.0);
            C.InitialValues_Evaluators.Add("VelocityY#B", X => 0.0);

            double g = 1.0;
            C.InitialValues_Evaluators.Add("GravityY#A", X => - g);
            C.InitialValues_Evaluators.Add("GravityY#B", X => - g);

            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("12b8c9f7-504c-40c4-a548-304a2e2aa14f");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, 3420);

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            //C.PhysicalParameters.rho_A = 0.17;
            //C.PhysicalParameters.rho_B = 1.2;
            //C.PhysicalParameters.mu_A = 0.17e-2;
            //C.PhysicalParameters.mu_B = 1.2e-2;
            //C.PhysicalParameters.Sigma = 0.0;

            C.PhysicalParameters.rho_A = 0.17;
            C.PhysicalParameters.rho_B = 1.2;
            C.PhysicalParameters.mu_A  = 0.003;
            C.PhysicalParameters.mu_B  = 0.003;
            C.PhysicalParameters.Sigma = 0.0;   // corresponding dt = 1e-3;
            //C.PhysicalParameters.Sigma = 0.015;   // corresponding dt = 4e-3;

            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion



            // additional parameters
            // =====================

            //double[] param = new double[4];
            //param[0] = k;   // wavenumber
            //param[1] = L;  // wavelength
            //param[2] = A0;      // initial disturbance
            //param[3] = g;      // y-gravity
            //C.AdditionalParameters = param;


            // misc. solver options
            // ====================
            #region solver


            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 40;
            //C.AdvancedDiscretizationOptions.UseGhostPenalties = true;

            C.LSContiProjectionMethod       = ContinuityProjectionOption.SpecFEM;
            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.LinearSolver = new DirectSolver()
            {
                WhichSolver = DirectSolver._whichSolver.MUMPS
            };

            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.Curvature_Projected;
            C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            #endregion


            // Timestepping
            // ============
            #region time

            C.CompMode = AppControl._CompMode.Transient;

            C.Timestepper_Scheme  = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit = TimeStepperInit.SingleInit;
            //C.dt_increment = 20;
            C.Timestepper_LevelSetHandling = LevelSetHandling.LieSplitting;

            double dt = 1e-3;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 4000;

            C.saveperiod = 4;

            #endregion

            return(C);
        }
Exemple #2
0
        /// <summary>
        /// Control for TestProgramm (not to be changed!!!)
        /// </summary>
        /// <param name="p"></param>
        /// <param name="xkelem"></param>
        /// <param name="dt"></param>
        /// <param name="t_end"></param>
        /// <param name="_DbPath"></param>
        /// <returns></returns>
        public static XNSE_Control RT_Test(int p = 2, int xkelem = 32, double dt = 8e-5, double t_end = 4e-4, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            // basic database options
            // ======================
            #region db

            //_DbPath = @"D:\local\local_test_db";

            C.DbPath      = _DbPath;
            C.savetodb    = C.DbPath != null;
            C.ProjectName = "XNSE/RT-Instability";

            //C.LogValues = XNSE_Control.LoggingValues.Wavelike;

            #endregion

            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = 4,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = 4,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics


            // Capillary wave: Laplace number La = 3e5:
            //C.Tags.Add("La=3e5");
            //double rho_l = 1e-3;
            //double rho_h = 1e-3;
            //double mu_l = 1e-5;
            //double mu_h = 1e-5;
            //double sigma = 3e-2;

            // Capillary wave: Laplace number La = 3000:
            //C.Tags.Add("La3000");
            //double rho_l = 1e-3;
            //double rho_h = 1e-3;
            //double mu_l = 1e-4;
            //double mu_h = 1e-4;
            //double sigma = 3e-2;

            // Capillary wave: Laplace number La = 120:
            //double rho_l = 1e-3;
            //double rho_h = 1e-3;
            //double mu_l = 5e-4;
            //double mu_h = 5e-4;
            //double sigma = 3e-2;

            //double rho_l = 1e-3;
            //double rho_h = 1e-3;
            //double mu_l = 1e-6;
            //double mu_h = 1e-4;
            //double sigma = 3e-2;

            //double rho_l = 1;
            //double rho_h = 1;
            //double mu_l = 1e-3;
            //double mu_h = 1e-3;
            //double sigma = 1;

            // Air(light)-Water(heavy)
            //double rho_h = 1e-3;          // kg / cm^3
            //double rho_l = 1.2e-6;        // kg / cm^3
            //double mu_h = 1e-5;           // kg / cm * s
            //double mu_l = 17.1e-8;        // kg / cm * s
            //double sigma = 72.75e-3;      // kg / s^2         // lambda_crit = 1.7121 ; lambda < lambda_c: stable

            // same kinematic viscosities
            //double rho_l = 1e-5;          // kg / cm^3
            //double mu_l = 1e-8;           // kg / cm * s
            //double rho_h = 1e-3;        // kg / cm^3
            //double mu_h = 1e-6;        // kg / cm * s         // Atwood number = 0.98

            //double rho_l = 7e-4;          // kg / cm^3
            //double mu_l = 7e-5;           // kg / cm * s
            //double rho_h = 1e-3;        // kg / cm^3
            //double mu_h = 1e-4;        // kg / cm * s           // Atwood number = 0.1765

            //double sigma = 72.75e-3;      // kg / s^2


            double rho_l = 1e-1;
            double mu_l  = 1e-2;
            double rho_h = 1;
            double mu_h  = 1e-1;

            double sigma = 100;      // kg / s^2

            // Water-Oil
            //double rho_ = 8.63e-4;
            //double rho_B = 1.2e-6;
            //double mu_A = 2e-4;
            //double mu_B = 17.1e-8;


            // stable configuration
            //C.PhysicalParameters.rho_A = rho_h;
            //C.PhysicalParameters.rho_B = rho_l;
            //C.PhysicalParameters.mu_A = mu_h;
            //C.PhysicalParameters.mu_B = mu_l;
            //C.PhysicalParameters.Sigma = sigma;


            // unstable configuration
            C.PhysicalParameters.rho_A = rho_l;
            C.PhysicalParameters.rho_B = rho_h;
            C.PhysicalParameters.mu_A  = mu_l;
            C.PhysicalParameters.mu_B  = mu_h;
            C.PhysicalParameters.Sigma = sigma;

            //C.PhysicalParameters.Sigma = 0.0;   // free surface boundary condition

            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion


            // Initial displacement
            // ===================

            int    kmode = 1;
            double H0    = 0.01;

            //double lambda_stable = 1;
            //double lambda_instable = 4;
            //Func<double, double> displacement = x => ((lambda_stable / 100) * Math.Sin(x * 2 * Math.PI / lambda_stable )) + ((lambda_instable / 100) * Math.Sin(x * 2 * Math.PI / lambda_instable));
            Func <double, double> displacement = x => (H0 * Math.Sin(x * 2 * Math.PI * (double)kmode));

            // grid genration
            // ==============
            #region grid

            double L        = 1; //lambda_instable;
            double H        = 1.0 * L;
            double H_interf = L / 4.0;

            //int xkelem = 20;
            int ykelem_Interface = 1 * (xkelem / 4);
            int ykelem_outer     = xkelem / 2;

            //C.GridFunc = delegate () {
            //    double[] Xnodes = GenericBlas.Linspace(0, L, xkelem + 1);
            //    double[] Ynodes_Interface = GenericBlas.Linspace(-(H_interf) / 2.0, (H_interf) / 2.0, ykelem_Interface + 1);
            //    Ynodes_Interface = Ynodes_Interface.GetSubVector(1, Ynodes_Interface.GetLength(0) - 2);
            //    double[] Ynodes_lower = GenericBlas.Linspace(-(H + (H_interf / 2.0)), -(H_interf / 2.0), ykelem_outer + 1);
            //    double[] Ynodes_upper = GenericBlas.Linspace((H_interf / 2.0), H + (H_interf / 2.0), ykelem_outer + 1);
            //    double[] Ynodes = Ynodes_lower.Concat(Ynodes_Interface).ToArray().Concat(Ynodes_upper).ToArray();


            //    var grd = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: true);

            //    grd.EdgeTagNames.Add(1, "wall_lower");
            //    grd.EdgeTagNames.Add(2, "wall_upper");


            //    grd.DefineEdgeTags(delegate (double[] X) {
            //        byte et = 0;
            //        if (Math.Abs(X[1] + ((H_interf / 2.0) + H)) <= 1.0e-8)
            //            et = 1;
            //        if (Math.Abs(X[1] - ((H_interf / 2.0) + H)) <= 1.0e-8)
            //            et = 2;
            //        if (Math.Abs(X[0]) <= 1.0e-8)
            //            et = 3;
            //        if (Math.Abs(X[0] - L) <= 1.0e-8)
            //            et = 4;

            //        return et;
            //    });

            //    return grd;
            //};

            // nach Popinet
            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, L, xkelem + 1);
                double[] Ynodes = GenericBlas.Linspace(-3.0 * L / 2.0, 3.0 * L / 2.0, (3 * xkelem) + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: true);

                grd.EdgeTagNames.Add(1, "wall_lower");
                grd.EdgeTagNames.Add(2, "wall_upper");


                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1] + (3.0 * L / 2.0)) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - (3.0 * L / 2.0)) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - L) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                return(grd);
            };


            #endregion


            // boundary conditions
            // ===================
            #region BC

            C.AddBoundaryCondition("wall_lower");
            C.AddBoundaryCondition("wall_upper");

            #endregion


            // Initial Values
            // ==============
            #region init

            Func <double, double> PeriodicFunc = x => displacement(x);

            //superposed higher frequent disturbance
            //double lambda_dist = lambda / (double)(xkelem / 2);
            //if (lambda_dist > 0.0) {
            //    double A0_dist = A0 / 5.0;
            //    Func<double, double> disturbance = x => A0_dist * Math.Sin(x * 2 * Math.PI / lambda_dist);
            //    PeriodicFunc = x => (displacement(x) + disturbance(x));
            //}


            C.InitialValues_Evaluators.Add("Phi", (X => X[1] - (PeriodicFunc(X[0]))));

            C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0);

            double g = 9.81e2;
            C.InitialValues_Evaluators.Add("GravityY#A", X => - g);
            C.InitialValues_Evaluators.Add("GravityY#B", X => - g);

            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("0141eba2-8d7b-4593-8595-bfff12dbfc40");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, null);

            #endregion


            // misc. solver options
            // ====================
            #region solver


            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 40;
            //C.AdvancedDiscretizationOptions.UseGhostPenalties = true;

            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.Option_LevelSetEvolution = LevelSetEvolution.Fourier;
            C.AdvancedDiscretizationOptions.SST_isotropicMode = SurfaceStressTensor_IsotropicMode.Curvature_Fourier;

            //C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;
            //C.AdvancedDiscretizationOptions.surfTensionMode = Solution.XNSECommon.SurfaceTensionMode.Curvature_Projected;
            //C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            #endregion


            // additional parameters
            // =====================

            double[] param = new double[3];
            param[0] = L;  // wavelength
            param[1] = H0; // initial disturbance
            param[2] = g;  // y-gravity
            C.AdditionalParameters = param;

            // specialized Fourier Level-Set
            // =============================

            int numSp = 640;
            C.FourierLevSetControl = new FourierLevSetControl(FourierType.Planar, numSp, L, PeriodicFunc, 1.0 / (double)xkelem)
            {
                FourierEvolve     = Fourier_Evolution.MaterialPoints,
                Timestepper       = FourierLevelSet_Timestepper.RungeKutta1901,
                InterpolationType = Interpolationtype.CubicSplineInterpolation
            };


            // Timestepping
            // ============
            #region time

            C.CompMode = AppControl._CompMode.Transient;

            C.Timestepper_Scheme  = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit = TimeStepperInit.SingleInit;
            //C.dt_increment = 20;
            C.Timestepper_LevelSetHandling = LevelSetHandling.LieSplitting;

            //double dt = Math.Sqrt((rho_h+rho_l)*Math.Pow(1.0/(double)xkelem,3)/(2*Math.PI*sigma));
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = (int)Math.Ceiling(t_end / dt);

            C.saveperiod = 1;

            #endregion


            return(C);
        }
Exemple #3
0
        /// <summary>
        /// control object for various testing
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control ChannelFlow_WithInterface(int p = 2, int kelem = 16, int wallBC = 2)
        {
            XNSE_Control C = new XNSE_Control();

            // basic database options
            // ======================
            #region db

            C.DbPath             = null; //_DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/Channel";
            C.ProjectDescription = "Channel flow with vertical interface";

            #endregion


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("DivergenceVelocity", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            C.PhysicalParameters.rho_A = 1;
            C.PhysicalParameters.rho_B = 1;
            C.PhysicalParameters.mu_A  = 1;
            C.PhysicalParameters.mu_B  = 1;
            double sigma = 1.0;
            C.PhysicalParameters.Sigma = sigma;

            //C.PhysicalParameters.beta_S = 0.05;
            C.PhysicalParameters.Theta_e = Math.PI / 2.0;

            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion


            // grid generation
            // ===============
            #region grid

            double L = 2;
            double H = 1;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, L, 2 * kelem + 1);
                double[] Ynodes = GenericBlas.Linspace(0, H, kelem + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes);

                switch (wallBC)
                {
                case 0:
                    goto default;

                case 1:
                    grd.EdgeTagNames.Add(1, "velocity_inlet_lower");
                    grd.EdgeTagNames.Add(2, "velocity_inlet_upper");
                    break;

                case 2:
                    grd.EdgeTagNames.Add(1, "navierslip_linear_lower");
                    grd.EdgeTagNames.Add(2, "navierslip_linear_upper");
                    break;

                default:
                    grd.EdgeTagNames.Add(1, "wall_lower");
                    grd.EdgeTagNames.Add(2, "wall_upper");
                    break;
                }
                grd.EdgeTagNames.Add(3, "velocity_inlet_left");
                grd.EdgeTagNames.Add(4, "pressure_outlet_right");

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - H) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - L) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                return(grd);
            };

            #endregion


            // Initial Values
            // ==============
            #region init

            //Func<double[], double> PhiFunc = (X => X[0] - L / 2);

            double[] center = new double[] { H / 2.0, H / 2.0 };
            double   radius = 0.25;


            C.InitialValues_Evaluators.Add("Phi",
                                                                                                                          //(X => (X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2() - radius.Pow2())   // quadratic form
                                           (X => ((X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2()).Sqrt() - radius) // signed-distance form
                                           );

            //C.InitialValues_Evaluators.Add("Phi", PhiFunc);

            double U = 1.0;

            C.InitialValues_Evaluators.Add("VelocityX#A", X => U);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => U);

            double Pjump = sigma / radius;
            C.InitialValues_Evaluators.Add("Pressure#A", X => Pjump);

            #endregion


            // boundary conditions
            // ===================
            #region BC

            switch (wallBC)
            {
            case 0:
                goto default;

            case 1:
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityX#A", X => U);
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityX#B", X => U);
                C.AddBoundaryCondition("velocity_inlet_upper", "VelocityX#A", X => U);
                C.AddBoundaryCondition("velocity_inlet_upper", "VelocityX#B", X => U);
                break;

            case 2:
                C.AddBoundaryCondition("navierslip_linear_lower");
                C.AddBoundaryCondition("navierslip_linear_upper");
                break;

            default:
                C.AddBoundaryCondition("wall_lower");
                C.AddBoundaryCondition("wall_upper");
                break;
            }
            C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#A", X => U);
            C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#B", X => U);
            C.AddBoundaryCondition("pressure_outlet_right");

            #endregion


            // misc. solver options
            // ====================
            #region solver

            C.ComputeEnergy = false;

            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.LSContiProjectionMethod = Solution.LevelSetTools.ContinuityProjectionOption.ContinuousDG;

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;
            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_Flux;

            //C.LS_TrackerWidth = 2;
            C.AdaptiveMeshRefinement = true;

            #endregion


            // Timestepping
            // ============
            #region time

            C.Timestepper_Scheme = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            //C.Timestepper_BDFinit = TimestepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.Coupled_Once;

            C.CompMode = AppControl._CompMode.Transient;
            double dt = 2e-4;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 1000;
            C.saveperiod    = 1;

            #endregion


            return(C);
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control CF_LevelSetMovementTest(int boundarySetup        = 2, LevelSetEvolution lsEvo = LevelSetEvolution.FastMarching,
                                                           LevelSetHandling lsHandl = LevelSetHandling.Coupled_Once, XNSE_Control.TimesteppingScheme tsScheme = XNSE_Control.TimesteppingScheme.ImplicitEuler)
        {
            int p     = 2;
            int kelem = 16;

            XNSE_Control C = new XNSE_Control();

            // basic database options
            // ======================
            #region db

            C.DbPath             = null; //_DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/elementalTest";
            C.ProjectDescription = "Two-phase Channel flow for testing the level set movement";

            #endregion


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            C.PhysicalParameters.rho_A = 1;
            C.PhysicalParameters.rho_B = 1;
            C.PhysicalParameters.mu_A  = 1;
            C.PhysicalParameters.mu_B  = 1;
            C.PhysicalParameters.Sigma = 0.0;

            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion


            // grid generation
            // ===============
            #region grid

            double L = 2;
            double H = 1;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, L, 2 * kelem + 1);
                double[] Ynodes = GenericBlas.Linspace(0, H, kelem + 1);

                bool xPeriodic = (boundarySetup == 1) ? true : false;
                var  grd       = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: xPeriodic);

                grd.EdgeTagNames.Add(1, "velocity_inlet_lower");
                grd.EdgeTagNames.Add(2, "velocity_inlet_upper");

                switch (boundarySetup)
                {
                case 1:
                    break;

                case 2:
                    grd.EdgeTagNames.Add(3, "velocity_inlet_left");
                    grd.EdgeTagNames.Add(4, "pressure_outlet_right");
                    break;

                default:
                    throw new ArgumentException("invalid boundary setup");
                }

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - H) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (!xPeriodic)
                    {
                        if (Math.Abs(X[0]) <= 1.0e-8)
                        {
                            et = 3;
                        }
                        if (Math.Abs(X[0] - L) <= 1.0e-8)
                        {
                            et = 4;
                        }
                    }

                    return(et);
                });

                return(grd);
            };

            #endregion


            // Initial Values
            // ==============
            #region init

            Func <double[], double> PhiFunc;

            switch (boundarySetup)
            {
            case 1: {
                // horizontal interface
                PhiFunc = (X => X[0] - L / 4.0);
                break;
            }

            case 2: {
                // radial interface
                double[] center = new double[] { L / 4.0, H / 2.0 };
                double   radius = 0.25;
                PhiFunc = (X => ((X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2()).Sqrt() - radius);
                break;
            }

            default:
                PhiFunc = (X => - 1);
                break;
            }
            C.InitialValues_Evaluators.Add("Phi", PhiFunc);

            double U = 1.0;

            switch (boundarySetup)
            {
            case 1:
                C.InitialValues_Evaluators.Add("VelocityY#A", X => U);
                C.InitialValues_Evaluators.Add("VelocityY#B", X => U);
                break;

            case 2:
                C.InitialValues_Evaluators.Add("VelocityX#A", X => U);
                C.InitialValues_Evaluators.Add("VelocityX#B", X => U);
                break;

            default:
                throw new ArgumentException("invalid boundary setup");
            }


            #endregion


            // boundary conditions
            // ===================
            #region BC

            switch (boundarySetup)
            {
            case 1:
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityY#A", X => U);
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityY#B", X => U);
                C.AddBoundaryCondition("velocity_inlet_upper", "VelocityY#A", X => U);
                C.AddBoundaryCondition("velocity_inlet_upper", "VelocityY#B", X => U);
                break;

            case 2:
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityX#A", X => U);
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityX#B", X => U);
                C.AddBoundaryCondition("velocity_inlet_upper", "VelocityX#A", X => U);
                C.AddBoundaryCondition("velocity_inlet_upper", "VelocityX#B", X => U);
                C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#A", X => U);
                C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#B", X => U);
                C.AddBoundaryCondition("pressure_outlet_right");
                break;

            default:
                break;
            }

            #endregion


            // misc. solver options
            // ====================
            #region solver

            C.ComputeEnergy = false;

            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.LSContiProjectionMethod = Solution.LevelSetTools.ContinuityProjectionOption.ContinuousDG;

            C.Option_LevelSetEvolution = lsEvo;
            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;

            C.AdvancedDiscretizationOptions.SST_isotropicMode = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;

            #endregion


            // Timestepping
            // ============
            #region time

            C.CompMode = AppControl._CompMode.Transient;
            C.Timestepper_LevelSetHandling = lsHandl;
            C.Timestepper_Scheme           = tsScheme;

            double dt = 1e-2;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 10;
            C.saveperiod    = 1;

            #endregion


            return(C);
        }
Exemple #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control Couette_GNBC(int tc = 1, int p = 2, int kelem = 16, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            //_DbPath = @"D:\local\local_Testcase_databases\Testcase_ContactLine";
            //_DbPath = @"\\fdyprime\userspace\smuda\cluster\cluster_db";

            // basic database options
            // ======================
            #region db

            C.DbPath             = _DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/Couette";
            C.ProjectDescription = "Couette flow by Gerbeau";

            C.LogValues = XNSE_Control.LoggingValues.MovingContactLine;

            #endregion


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            switch (tc)
            {
            case 1: {
                C.PhysicalParameters.rho_A = 0.81;
                C.PhysicalParameters.rho_B = 0.81;
                C.PhysicalParameters.mu_A  = 1.95;
                C.PhysicalParameters.mu_B  = 1.95;
                C.PhysicalParameters.Sigma = 5.5;

                C.PhysicalParameters.betaS_A = 1.5;
                C.PhysicalParameters.betaS_B = 1.5;

                C.PhysicalParameters.betaL   = 0.0;
                C.PhysicalParameters.Theta_e = Math.PI / 2.0;
                break;
            }

            case 2: {
                C.PhysicalParameters.rho_A = 0.81;
                C.PhysicalParameters.rho_B = 0.81;
                C.PhysicalParameters.mu_A  = 1.95;
                C.PhysicalParameters.mu_B  = 1.95;
                C.PhysicalParameters.Sigma = 5.5;

                C.PhysicalParameters.betaS_A = 0.591;
                C.PhysicalParameters.betaS_B = 1.5;

                C.PhysicalParameters.betaL   = 0.0;
                C.PhysicalParameters.Theta_e = Math.Acos(0.38);
                break;
            }
            }

            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion


            // grid generation
            // ===============
            #region grid

            double L = 27.2;
            double H = 13.6;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, 4 * L, 8 * kelem);
                double[] Ynodes = GenericBlas.Linspace(0, H, kelem + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: true);

                grd.EdgeTagNames.Add(1, "navierslip_linear_lower");
                grd.EdgeTagNames.Add(2, "navierslip_linear_upper");

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - H) <= 1.0e-8)
                    {
                        et = 2;
                    }

                    return(et);
                });

                return(grd);
            };

            #endregion


            // Initial Values
            // ==============
            #region init

            Func <double[], double> PhiFunc = (X => Math.Abs(X[0] - 2 * L) - L);

            C.InitialValues_Evaluators.Add("Phi", PhiFunc);


            C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0);

            #endregion


            // boundary conditions
            // ===================
            #region BC

            double U_wall = 0.0;
            switch (tc)
            {
            case 1: {
                U_wall = 0.25;
                break;
            }

            case 2: {
                U_wall = 0.2;
                break;
            }
            }

            C.AddBoundaryCondition("navierslip_linear_lower", "VelocityX#A", X => - U_wall);
            C.AddBoundaryCondition("navierslip_linear_lower", "VelocityX#B", X => - U_wall);
            C.AddBoundaryCondition("navierslip_linear_upper", "VelocityX#A", X => U_wall);
            C.AddBoundaryCondition("navierslip_linear_upper", "VelocityX#B", X => U_wall);


            #endregion


            // misc. solver options
            // ====================
            #region solver

            C.ComputeEnergy = false;

            C.LSContiProjectionMethod = Solution.LevelSetTools.ContinuityProjectionOption.ContinuousDG;

            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;
            //C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            //C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.FullBoussinesqScriven;

            C.AdvancedDiscretizationOptions.SST_isotropicMode = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;


            C.AdaptiveMeshRefinement = true;
            C.RefinementLevel        = 1;

            //C.LS_TrackerWidth = 2;

            #endregion


            // Timestepping
            // ============
            #region time

            C.Timestepper_Scheme           = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.Coupled_Once;

            C.CompMode = AppControl._CompMode.Transient;
            double dt = 1e-2;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 16000;
            C.saveperiod    = 10;

            #endregion


            return(C);
        }
Exemple #6
0
        // ==========================================
        // Control-objects for elementalTestProgramm
        // ==========================================


        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control CF_BoundaryTest(int bc = 3, bool Xperiodic = true, bool init_exact = false, bool slip = false)
        {
            int p     = 2;
            int kelem = 16;


            XNSE_Control C = new XNSE_Control();

            // basic database options
            // ======================
            #region db

            C.DbPath             = null; //_DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/elementalTest";
            C.ProjectDescription = "Channel flow for BC testing";

            #endregion


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            C.PhysicalParameters.rho_A = 1;
            C.PhysicalParameters.rho_B = 1;
            C.PhysicalParameters.mu_A  = 1;
            C.PhysicalParameters.mu_B  = 1;
            C.PhysicalParameters.Sigma = 0.0;

            C.PhysicalParameters.betaS_A = 0.0;
            C.PhysicalParameters.betaS_B = 0.0;

            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion


            // grid generation
            // ===============
            #region grid

            double L = 2;
            double H = 1;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, L, 2 * kelem + 1);
                double[] Ynodes = GenericBlas.Linspace(0, H, kelem + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: Xperiodic);

                switch (bc)
                {
                case 1: {
                    grd.EdgeTagNames.Add(1, "freeslip_lower");
                    grd.EdgeTagNames.Add(2, "freeslip_upper");
                    break;
                }

                case 2: {
                    grd.EdgeTagNames.Add(1, "navierslip_linear_lower");
                    grd.EdgeTagNames.Add(2, "navierslip_linear_upper");
                    break;
                }

                case 3: {
                    grd.EdgeTagNames.Add(1, "velocity_inlet_lower");
                    grd.EdgeTagNames.Add(2, "freeslip_upper");
                    break;
                }

                case 4: {
                    grd.EdgeTagNames.Add(1, "velocity_inlet_lower");
                    grd.EdgeTagNames.Add(2, "navierslip_linear_upper");
                    break;
                }

                default: {
                    throw new NotImplementedException("No such testcase available");
                }
                }

                if (!Xperiodic)
                {
                    grd.EdgeTagNames.Add(3, "velocity_inlet_left");
                    grd.EdgeTagNames.Add(4, "pressure_outlet_right");
                }

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - H) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (!Xperiodic)
                    {
                        if (Math.Abs(X[0]) <= 1.0e-8)
                        {
                            et = 3;
                        }
                        if (Math.Abs(X[0] - L) <= 1.0e-8)
                        {
                            et = 4;
                        }
                    }

                    return(et);
                });

                return(grd);
            };

            #endregion


            // Initial Values
            // ==============
            #region init

            Func <double[], double> PhiFunc = (X => - 1);

            C.InitialValues_Evaluators.Add("Phi", PhiFunc);

            double U = 1.0;

            if (init_exact)
            {
                C.InitialValues_Evaluators.Add("VelocityX#A", X => U);
            }

            #endregion


            // boundary conditions
            // ===================
            #region BC

            switch (bc)
            {
            case 1: {
                C.AddBoundaryCondition("freeslip_lower");
                if (slip)
                {
                    C.AddBoundaryCondition("freeslip_upper", "VelocityX#A", X => - U);
                }
                else
                {
                    C.AddBoundaryCondition("freeslip_upper");
                }

                if (!Xperiodic)
                {
                    C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#A", X => U);
                    C.AddBoundaryCondition("pressure_outlet_right");
                }
                break;
            }

            case 2: {
                //C.AddBoundaryCondition("navierslip_linear_lower");
                //if (slip)
                //    C.AddBoundaryCondition("navierslip_linear_upper", "VelocityX#A", X => -U);
                //else
                //    C.AddBoundaryCondition("navierslip_linear_upper");

                C.AddBoundaryCondition("navierslip_linear_lower", "VelocityX#A", X => - U);
                C.AddBoundaryCondition("navierslip_linear_upper", "VelocityX#A", X => U);

                if (!Xperiodic)
                {
                    C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#A", X => U);
                    C.AddBoundaryCondition("pressure_outlet_right");
                }
                break;
            }

            case 3: {
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityX#A", X => U);
                C.AddBoundaryCondition("freeslip_upper");
                if (!Xperiodic)
                {
                    C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#A", X => U);
                    C.AddBoundaryCondition("pressure_outlet_right");
                }
                break;
            }

            case 4: {
                C.AddBoundaryCondition("velocity_inlet_lower", "VelocityX#A", X => U);
                C.AddBoundaryCondition("navierslip_linear_upper");
                if (!Xperiodic)
                {
                    C.AddBoundaryCondition("velocity_inlet_left", "VelocityX#A", X => U);
                    C.AddBoundaryCondition("pressure_outlet_right");
                }
                break;
            }

            default: {
                break;
            }
            }

            #endregion


            // misc. solver options
            // ====================
            #region solver

            C.ComputeEnergy = false;

            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.Option_LevelSetEvolution = LevelSetEvolution.None;
            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;
            C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            #endregion


            // Timestepping
            // ============
            #region time

            C.Timestepper_Scheme           = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.None;

            C.CompMode = AppControl._CompMode.Steady;

            double dt = 1e-1;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 100;
            C.saveperiod    = 1;

            #endregion


            return(C);
        }
Exemple #7
0
        /// <summary>
        /// Control for TestProgramm (not to be changed!!!)
        /// </summary>
        /// <param name="p"></param>
        /// <param name="xkelem"></param>
        /// <param name="_DbPath"></param>
        /// <returns></returns>
        public static XNSE_Control CW_Test(int p = 2, int xkelem = 32, string _DbPath = null)
        {
            //int p = 2;
            //int xkelem = 32;

            XNSE_Control C = new XNSE_Control();

            // basic database options
            // ======================
            #region db

            //_DbPath = @"\\dc1\userspace\smuda\cluster\CWp3_spatialConv";
            //_DbPath = @"D:\local\local_Testcase_databases\Testcase_CapillaryWave";

            C.DbPath      = _DbPath;
            C.savetodb    = C.DbPath != null;
            C.ProjectName = "XNSE/CapillaryWave";
            C.Tags.Add("Popinet");
            C.Tags.Add("Testcase1");

            C.LogValues = XNSE_Control.LoggingValues.Wavelike;

            #endregion

            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = 4,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = 4,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics


            // Testcase1:
            double rho_l = 1e-3;
            double rho_h = 1e-3;
            double mu_l  = 1e-4;
            double mu_h  = 1e-4;
            double sigma = 3e-2;

            // for spatial convergence
            //double rho_l = 1e-2;
            //double rho_h = 1e-2;
            //double mu_l = 1e-3;
            //double mu_h = 1e-3;
            //double sigma = 3e-4;


            // unstable configuration
            C.PhysicalParameters.rho_A = rho_l;
            C.PhysicalParameters.rho_B = rho_h;
            C.PhysicalParameters.mu_A  = mu_l;
            C.PhysicalParameters.mu_B  = mu_h;
            C.PhysicalParameters.Sigma = sigma;


            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion


            // Initial disturbance
            // ===================

            double lambda = 1;
            double A0     = lambda / 100;
            Func <double, double> PeriodicFunc = x => A0 *Math.Sin(x * 2 *Math.PI / lambda);


            // grid genration
            // ==============
            #region grid

            double L = lambda;

            //int xkelem = 16;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, L, xkelem + 1);
                double[] Ynodes = GenericBlas.Linspace(-3.0 * L / 2.0, 3.0 * L / 2.0, (3 * xkelem) + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: true);

                grd.EdgeTagNames.Add(1, "wall_lower");
                grd.EdgeTagNames.Add(2, "wall_upper");


                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1] + (3.0 * L / 2.0)) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - (3.0 * L / 2.0)) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - L) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                return(grd);
            };


            #endregion


            // boundary conditions
            // ===================
            #region BC

            C.AddBoundaryCondition("wall_lower", "VelocityX#A", X => 0.0);
            C.AddBoundaryCondition("wall_upper", "VelocityX#B", X => 0.0);

            #endregion


            // Initial Values
            // ==============
            #region init

            C.InitialValues_Evaluators.Add("Phi", (X => X[1] - PeriodicFunc(X[0])));

            C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0);


            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid(restartSession);
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, null);

            #endregion

            // additional parameters
            // =====================

            double[] param = new double[3];
            param[0] = lambda;  // wavelength
            param[1] = A0;      // initial disturbance
            param[2] = 0.0;     // y-gravity
            C.AdditionalParameters = param;

            // misc. solver options
            // ====================
            #region solver


            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 40;
            //C.AdvancedDiscretizationOptions.UseGhostPenalties = true;

            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 100;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            //C.Option_LevelSetEvolution = LevelSetEvolution.Fourier;
            //C.AdvancedDiscretizationOptions.surfTensionMode = SurfaceTensionMode.Curvature_Fourier;

            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.Curvature_Projected;
            C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            #endregion


            // specialized Fourier Level-Set
            // =============================


            int numSp = 640;
            C.FourierLevSetControl = new FourierLevSetControl(FourierType.Planar, numSp, L, PeriodicFunc, 1.0 / (double)xkelem)
            {
                FourierEvolve     = Fourier_Evolution.MaterialPoints,
                Timestepper       = FourierLevelSet_Timestepper.ExplicitEuler,
                InterpolationType = Interpolationtype.CubicSplineInterpolation,
            };


            // Timestepping
            // ============
            #region time

            C.CompMode = AppControl._CompMode.Transient;

            C.Timestepper_Scheme  = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit = TimeStepperInit.SingleInit;
            //C.dt_increment = 20;
            C.Timestepper_LevelSetHandling = LevelSetHandling.LieSplitting;

            double rho = rho_l;                                                                  // Testcase1
            double dt  = Math.Sqrt(rho * Math.Pow((1 / (double)xkelem), 3) / (Math.PI * sigma)); // !!!
            C.dtMax   = dt;
            C.dtMin   = dt;
            C.Endtime = 1000;
            double omega0 = Math.Sqrt(sigma * Math.Pow((2 * Math.PI / lambda), 3) / (2.0 * rho));
            C.NoOfTimesteps = 10; // (int)Math.Ceiling((25 / omega0) / dt);                                        // !!!
            //C.NoOfTimesteps = (int)Math.Ceiling(t_end / dt);                                     // !!!

            C.saveperiod = 1;

            #endregion


            return(C);
        }
Exemple #8
0
        /// <summary>
        /// Control for TestProgramm (not to be changed!!!)
        /// </summary>
        /// <param name="p"></param>
        /// <param name="kelem"></param>
        /// <param name="_DbPath"></param>
        /// <returns></returns>
        public static XNSE_Control RB_Test(int p = 2, int kelem = 20, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            //_DbPath = @"D:\local\local_Testcase_databases\Testcase_RisingBubble";
            //_DbPath = @"\\fdyprime\userspace\smuda\cluster\cluster_db";


            // basic database options
            // ======================
            #region db

            C.DbPath             = _DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/Bubble";
            C.ProjectDescription = "rising bubble";

            C.LogValues = XNSE_Control.LoggingValues.RisingBubble;

            #endregion


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("DivergenceVelocity", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            C.Tags.Add("Testcase 1");
            C.PhysicalParameters.rho_A = 100;
            C.PhysicalParameters.rho_B = 1000;
            C.PhysicalParameters.mu_A  = 1;
            C.PhysicalParameters.mu_B  = 10;
            C.PhysicalParameters.Sigma = 24.5;


            //C.Tags.Add("Testcase 1 - higher parameters");
            //C.PhysicalParameters.rho_A = 1000;
            //C.PhysicalParameters.rho_B = 10000;
            //C.PhysicalParameters.mu_A = 10;
            //C.PhysicalParameters.mu_B = 100;
            //C.PhysicalParameters.Sigma = 245;

            //C.Tags.Add("Testcase 2");
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 0.1;
            //C.PhysicalParameters.mu_B = 10;
            //C.PhysicalParameters.Sigma = 1.96;

            // Re = 3.5 ; Bo(Eo) = 1
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 1;
            //C.PhysicalParameters.mu_B = 100;
            //C.PhysicalParameters.Sigma = 245;

            //// Re = 35 ; Bo(Eo) = 100
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 0.1;
            //C.PhysicalParameters.mu_B = 10;
            //C.PhysicalParameters.Sigma = 2.45;

            //// Re = 70 ; Bo(Eo) = 10
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 0.05;
            //C.PhysicalParameters.mu_B = 5;
            //C.PhysicalParameters.Sigma = 24.5;


            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion

            // grid generation
            // ===============
            #region grid


            double xSize = 1.0;
            double ySize = 2.0;

            //int kelem = 160;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, xSize, kelem + 1);
                double[] Ynodes = GenericBlas.Linspace(0, ySize, 2 * kelem + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: false);


                grd.EdgeTagNames.Add(1, "wall_lower");
                grd.EdgeTagNames.Add(2, "wall_upper");
                grd.EdgeTagNames.Add(3, "freeslip_left");
                grd.EdgeTagNames.Add(4, "freeslip_right");

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - ySize) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - xSize) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                grd.AddPredefinedPartitioning("ZwoProcSplit", delegate(double[] X) {
                    int rank;
                    double x = X[0];
                    if (x < 0.5)
                    {
                        rank = 0;
                    }
                    else
                    {
                        rank = 1;
                    }

                    return(rank);
                });

                grd.AddPredefinedPartitioning("VierProcSplit", delegate(double[] X) {
                    int rank;
                    double x = X[0];
                    if (x < 0.35)
                    {
                        rank = 0;
                    }
                    else if (x < 0.5)
                    {
                        rank = 1;
                    }
                    else if (x < 0.75)
                    {
                        rank = 2;
                    }
                    else
                    {
                        rank = 3;
                    }

                    return(rank);
                });


                return(grd);
            };

            C.GridPartType    = GridPartType.Predefined;
            C.GridPartOptions = "VierProcSplit";


            #endregion


            // Initial Values
            // ==============
            #region init

            double[] center = new double[] { 0.5, 0.5 }; //0.5,0.5
            double   radius = 0.25;

            //Func<double[], double> PhiFunc = (X => (X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2() - radius.Pow2()); // quadratic form
            Func <double[], double> PhiFunc = (X => ((X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2()).Sqrt() - radius); // signed-distance form

            C.InitialValues_Evaluators.Add("Phi", PhiFunc);

            Func <double, double> PeriodicFunc = x => radius;

            C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0);

            C.InitialValues_Evaluators.Add("GravityY#A", X => - 9.81e-1);
            C.InitialValues_Evaluators.Add("GravityY#B", X => - 9.81e-1);


            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("58745416-3320-4e0c-a5fa-fc3a2c5203c7");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, null);

            #endregion

            // boundary conditions
            // ===================
            #region BC

            C.AddBoundaryCondition("wall_lower");
            C.AddBoundaryCondition("wall_upper");
            C.AddBoundaryCondition("freeslip_left");
            C.AddBoundaryCondition("freeslip_right");

            //C.AddBoundaryCondition("wall_lower", VariableNames.LevelSet, PhiFunc);

            #endregion

            // Level-Set
            // =================
            #region Fourier

            int      numSp    = 640;
            double[] FourierP = new double[numSp];
            double[] samplP   = new double[numSp];
            for (int sp = 0; sp < numSp; sp++)
            {
                FourierP[sp] = sp * (2 * Math.PI / (double)numSp);
                samplP[sp]   = radius;
            }

            //double circum = 2.0 * Math.PI * radius;
            //double filter = (circum * 20.0) / ((double)numSp / 2.0);
            C.FourierLevSetControl = new FourierLevSetControl(FourierType.Polar, 2 * Math.PI, FourierP, samplP, 1.0 / (double)kelem)
            {
                //C.FourierLevSetControl = new FourierLevSetControl(FourierType.Polar, 2.0*Math.PI, PeriodicFunc, radius, 1.0/(double)kelem) {
                center        = center,
                FourierEvolve = Fourier_Evolution.MaterialPoints,
                centerMove    = CenterMovement.Reconstructed,
                //curvComp_extended = false
            };

            C.Option_LevelSetEvolution = LevelSetEvolution.Fourier;
            C.AdvancedDiscretizationOptions.SST_isotropicMode = SurfaceStressTensor_IsotropicMode.Curvature_Fourier;
            C.FourierLevSetControl.Timestepper = FourierLevelSet_Timestepper.RungeKutta1901;

            #endregion


            // misc. solver options
            // ====================
            #region solver


            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 4;
            //C.AdvancedDiscretizationOptions.UseGhostPenalties = true;


            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.AdvancedDiscretizationOptions.ViscosityMode = ViscosityMode.Standard;


            //C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;
            //C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;
            //C.AdvancedDiscretizationOptions.surfTensionMode = Solution.XNSECommon.SurfaceTensionMode.Curvature_Projected;
            //C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            #endregion


            // Timestepping
            // ============
            #region time

            C.Timestepper_Scheme  = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit = TimeStepperInit.SingleInit;
            //C.dt_increment = 20;
            C.Timestepper_LevelSetHandling = LevelSetHandling.LieSplitting;

            C.CompMode = AppControl._CompMode.Transient;
            //C.TimeStepper = XNSE_Control._Timestepper.BDF2;
            double dt = 3e-3; // (1.0 / (double)kelem) / 16.0;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 3; // (int)(3 / dt);
            C.saveperiod    = 10;

            #endregion

            return(C);
        }
Exemple #9
0
        /// <summary>
        /// Control for various testing
        /// </summary>
        /// <param name="p"></param>
        /// <param name="kelem"></param>
        /// <param name="_DbPath"></param>
        /// <param name="dt">
        /// Timestepsize, should be chosen as (1.0 / (double)kelem) / 16.0;
        /// </param>
        /// <returns></returns>
        public static XNSE_Control RB(int p = 2, int kelem = 20, double dt = 3.125e-3, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            //_DbPath = @"D:\local\local_Testcase_databases\Testcase_RisingBubble";
            //_DbPath = @"\\fdyprime\userspace\smuda\cluster\cluster_db";


            // basic database options
            // ======================
            #region db

            C.DbPath             = _DbPath;
            C.savetodb           = C.DbPath != null;
            C.SessionName        = "RisingBubbleHeimann";
            C.ProjectDescription = "rising bubble";

            C.LogValues = XNSE_Control.LoggingValues.RisingBubble;

            #endregion


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("DivergenceVelocity", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            C.Tags.Add("Testcase 1");
            C.PhysicalParameters.rho_A = 100;
            C.PhysicalParameters.rho_B = 1000;
            C.PhysicalParameters.mu_A  = 1;
            C.PhysicalParameters.mu_B  = 10;
            C.PhysicalParameters.Sigma = 24.5;


            //C.Tags.Add("Testcase 1 - higher parameters");
            //C.PhysicalParameters.rho_A = 1000;
            //C.PhysicalParameters.rho_B = 10000;
            //C.PhysicalParameters.mu_A = 10;
            //C.PhysicalParameters.mu_B = 100;
            //C.PhysicalParameters.Sigma = 245;

            //C.Tags.Add("Testcase 2");
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 0.1;
            //C.PhysicalParameters.mu_B = 10;
            //C.PhysicalParameters.Sigma = 1.96;

            // Re = 3.5 ; Bo(Eo) = 1
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 1;
            //C.PhysicalParameters.mu_B = 100;
            //C.PhysicalParameters.Sigma = 245;

            //// Re = 35 ; Bo(Eo) = 100
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 0.1;
            //C.PhysicalParameters.mu_B = 10;
            //C.PhysicalParameters.Sigma = 2.45;

            //// Re = 70 ; Bo(Eo) = 10
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 0.05;
            //C.PhysicalParameters.mu_B = 5;
            //C.PhysicalParameters.Sigma = 24.5;


            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion

            // grid generation
            // ===============
            #region grid


            double xSize = 1.0;
            double ySize = 2.0;

            //int kelem = 160;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, xSize, kelem + 1);
                double[] Ynodes = GenericBlas.Linspace(0, ySize, 2 * kelem + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: false);


                grd.EdgeTagNames.Add(1, "wall_lower");
                grd.EdgeTagNames.Add(2, "wall_upper");
                grd.EdgeTagNames.Add(3, "freeslip_left");
                grd.EdgeTagNames.Add(4, "freeslip_right");

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - ySize) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - xSize) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                grd.AddPredefinedPartitioning("ZwoProcSplit", delegate(double[] X) {
                    int rank;
                    double x = X[0];
                    if (x < 0.5)
                    {
                        rank = 0;
                    }
                    else
                    {
                        rank = 1;
                    }

                    return(rank);
                });

                grd.AddPredefinedPartitioning("VierProcSplit", delegate(double[] X) {
                    int rank;
                    double x = X[0];
                    if (x < 0.35)
                    {
                        rank = 0;
                    }
                    else if (x < 0.5)
                    {
                        rank = 1;
                    }
                    else if (x < 0.75)
                    {
                        rank = 2;
                    }
                    else
                    {
                        rank = 3;
                    }

                    return(rank);
                });


                return(grd);
            };

            C.GridPartType    = GridPartType.Predefined;
            C.GridPartOptions = "VierProcSplit";


            #endregion


            // Initial Values
            // ==============
            #region init

            double[] center = new double[] { 0.5, 0.5 }; //0.5,0.5
            double   radius = 0.25;

            //Func<double[], double> PhiFunc = (X => (X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2() - radius.Pow2()); // quadratic form
            Func <double[], double> PhiFunc = (X => ((X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2()).Sqrt() - radius); // signed-distance form

            C.InitialValues_Evaluators.Add("Phi", PhiFunc);

            Func <double, double> PeriodicFunc = x => radius;

            C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0);

            C.InitialValues_Evaluators.Add("GravityY#A", X => - 9.81e-1);
            C.InitialValues_Evaluators.Add("GravityY#B", X => - 9.81e-1);


            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("58745416-3320-4e0c-a5fa-fc3a2c5203c7");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, null);

            #endregion

            // boundary conditions
            // ===================
            #region BC

            C.AddBoundaryCondition("wall_lower");
            C.AddBoundaryCondition("wall_upper");
            C.AddBoundaryCondition("freeslip_left");
            C.AddBoundaryCondition("freeslip_right");

            //C.AddBoundaryCondition("wall_lower", VariableNames.LevelSet, PhiFunc);

            #endregion


            // misc. solver options
            // ====================
            #region solver


            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 1;
            //C.AdvancedDiscretizationOptions.UseGhostPenalties = true;


            //C.EnforceLevelSetConservation = true;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_MinIterations          = 1;
            C.Solver_ConvergenceCriterion   = 1e-7;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            //C.AdvancedDiscretizationOptions.ViscosityMode = ViscosityMode.Standard;


            C.Option_LevelSetEvolution = LevelSetEvolution.ExtensionVelocity;
            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_Flux;
            //C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;
            C.LSContiProjectionMethod = ContinuityProjectionOption.ContinuousDG;
            #endregion


            // Timestepping
            // ============
            #region time

            C.Timestepper_Scheme  = XNSE_Control.TimesteppingScheme.BDF2;
            C.Timestepper_BDFinit = TimeStepperInit.SingleInit;
            //C.dt_increment = 20;
            C.Timestepper_LevelSetHandling = LevelSetHandling.Coupled_Once;

            C.CompMode      = AppControl._CompMode.Transient;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 3;
            C.NoOfTimesteps = 10000; // (int)(3 / dt);
            C.saveperiod    = 10;

            #endregion

            return(C);
        }
Exemple #10
0
        /// <summary>
        /// specified control for benchmark testing
        /// </summary>
        /// <param name="p"></param>
        /// <param name="kelem"></param>
        /// <param name="_DbPath"></param>
        /// <returns></returns>
        public static XNSE_Control RB_BenchmarkTest(int p = 2, int kelem = 40, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();


            //_DbPath = @"D:\local\local_Testcase_databases\Testcase_RisingBubble";
            //_DbPath = @"\\fdyprime\userspace\smuda\cluster\cluster_db";


            // basic database options
            // ======================
            #region db

            C.DbPath             = _DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/Bubble";
            C.ProjectDescription = "rising bubble";
            C.Tags.Add("benchmark setup");

            C.LogValues = XNSE_Control.LoggingValues.RisingBubble;

            #endregion


            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("DivergenceVelocity", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


            // Physical Parameters
            // ===================
            #region physics

            C.Tags.Add("Testcase 1");
            C.PhysicalParameters.rho_A = 100;
            C.PhysicalParameters.rho_B = 1000;
            C.PhysicalParameters.mu_A  = 1;
            C.PhysicalParameters.mu_B  = 10;
            C.PhysicalParameters.Sigma = 24.5;

            //C.Tags.Add("Testcase 2");
            //C.PhysicalParameters.rho_A = 1;
            //C.PhysicalParameters.rho_B = 1000;
            //C.PhysicalParameters.mu_A = 0.1;
            //C.PhysicalParameters.mu_B = 10;
            //C.PhysicalParameters.Sigma = 1.96;


            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion

            // grid generation
            // ===============
            #region grid

            double h = 1.0 / (double)kelem;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, 1.0, kelem + 1);
                double[] Ynodes = GenericBlas.Linspace(0, 2.0, 2 * kelem + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: false);

                grd.EdgeTagNames.Add(1, "wall_lower");
                grd.EdgeTagNames.Add(2, "wall_upper");
                grd.EdgeTagNames.Add(3, "freeslip_left");
                grd.EdgeTagNames.Add(4, "freeslip_right");

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - 2.0) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - 1.0) <= 1.0e-8)
                    {
                        et = 4;
                    }
                    return(et);
                });

                grd.AddPredefinedPartitioning("ZwoProcSplit", delegate(double[] X) {
                    int rank;
                    double x = X[0];
                    if (x < 0.5)
                    {
                        rank = 0;
                    }
                    else
                    {
                        rank = 1;
                    }

                    return(rank);
                });

                grd.AddPredefinedPartitioning("VierProcSplit", delegate(double[] X) {
                    int rank;
                    double x = X[0];
                    if (x < 0.35)
                    {
                        rank = 0;
                    }
                    else if (x < 0.5)
                    {
                        rank = 1;
                    }
                    else if (x < 0.75)
                    {
                        rank = 2;
                    }
                    else
                    {
                        rank = 3;
                    }

                    return(rank);
                });


                return(grd);
            };

            C.GridPartType    = GridPartType.Predefined;
            C.GridPartOptions = "VierProcSplit";

            #endregion


            // Initial Values
            // ==============
            #region init

            double[] center = new double[] { 0.5, 0.5 };
            double   radius = 0.25;

            //Func<double[], double> PhiFunc = (X => (X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2() - radius.Pow2()); // quadratic form
            Func <double[], double> PhiFunc = (X => ((X[0] - center[0]).Pow2() + (X[1] - center[1]).Pow2()).Sqrt() - radius); // signed-distance form

            C.InitialValues_Evaluators.Add("Phi", PhiFunc);

            Func <double, double> PeriodicFunc = x => radius;

            C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0);

            C.InitialValues_Evaluators.Add("GravityY#A", X => - 9.81e-1);
            C.InitialValues_Evaluators.Add("GravityY#B", X => - 9.81e-1);


            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("977338d3-6840-43ab-a4b5-1983aa10b735");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, null);

            #endregion

            // boundary conditions
            // ===================
            #region BC

            C.AddBoundaryCondition("wall_lower");
            C.AddBoundaryCondition("wall_upper");
            C.AddBoundaryCondition("freeslip_left");
            C.AddBoundaryCondition("freeslip_right");

            #endregion

            // Level-Set
            // =================
            #region Fourier

            int      numSp    = 1024;
            double[] FourierP = new double[numSp];
            double[] samplP   = new double[numSp];
            for (int sp = 0; sp < numSp; sp++)
            {
                FourierP[sp] = sp * (2 * Math.PI / (double)numSp);
                samplP[sp]   = radius;
            }

            //double circum = 2.0 * Math.PI * radius;
            //double filter = (circum * 20.0) / ((double)numSp / 2.0);
            //C.FourierLevSetControl = new FourierLevSetControl(FourierType.Polar, 2 * Math.PI, FourierP, samplP, 1.0 / (double)kelem) {
            //    center = center,
            //    FourierEvolve = Fourier_Evolution.MaterialPoints,
            //    centerMove = CenterMovement.Reconstructed,
            //};


            #endregion


            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;


            // misc. solver options
            // ====================
            #region solver


            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 40;
            //C.AdvancedDiscretizationOptions.UseGhostPenalties = true;


            C.LSContiProjectionMethod       = ContinuityProjectionOption.SpecFEM;
            C.option_solver                 = C.PhysicalParameters.IncludeConvection ? "fixpoint+levelset" : "direct";
            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.LinearSolver = new DirectSolver()
            {
                WhichSolver = DirectSolver._whichSolver.MUMPS
            };

            C.AdvancedDiscretizationOptions.ViscosityMode = ViscosityMode.FullySymmetric;

            //C.Option_LevelSetEvolution = LevelSetEvolution.Fourier;
            //C.AdvancedDiscretizationOptions.surfTensionMode = SurfaceTensionMode.Curvature_Fourier;
            //C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_Flux;
            C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            #endregion


            // Timestepping
            // ============
            #region time

            C.Timestepper_Scheme           = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.LieSplitting;
            //C.Timestepper_MassMatrix = MassMatrixShapeandDependence.IsTimeAndSolutionDependent;

            C.CompMode = AppControl._CompMode.Transient;
            //C.TimeStepper = XNSE_Control._Timestepper.BDF2;


            double dt = 3e-3;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.NoOfTimesteps = 1000;
            C.saveperiod    = 1;


            #endregion

            return(C);
        }
Exemple #11
0
        /// <summary>
        /// Control for two Rising Bubble
        /// </summary>
        /// <param name="p"></param>
        /// <param name="kelem"></param>
        /// <param name="_DbPath"></param>
        /// <returns></returns>
        public static XNSE_Control BubbleMerger(int p = 2, int kelem = 40, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            _DbPath = @"D:\local\local_test_db";

            // basic database options
            // ======================
            #region db

            C.DbPath             = _DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/Bubble";
            C.ProjectDescription = "bubble merger";
            C.Tags.Add("smolianski");

            #endregion

            // DG degrees
            // ==========
            #region degrees

            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("GravityY", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree   = p - 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });


            #endregion

            // grid generation
            // ===============
            #region grid

            double h = 1.0 / (double)kelem;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, 1.0, kelem + 1);
                double[] Ynodes = GenericBlas.Linspace(0, 2.0, 2 * kelem + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes, periodicX: false);

                grd.EdgeTagNames.Add(1, "wall_lower");
                grd.EdgeTagNames.Add(2, "wall_upper");
                grd.EdgeTagNames.Add(3, "freeslip_left");
                grd.EdgeTagNames.Add(4, "freeslip_right");

                grd.DefineEdgeTags(delegate(double[] X) {
                    byte et = 0;
                    if (Math.Abs(X[1]) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] - 2.0) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (Math.Abs(X[0]) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - 1.0) <= 1.0e-8)
                    {
                        et = 4;
                    }
                    return(et);
                });

                return(grd);
            };

            #endregion

            // Physical Parameters
            // ===================
            #region physics

            // Bo = 250, Re = 35
            C.PhysicalParameters.rho_A = 1;
            C.PhysicalParameters.rho_B = 100;
            C.PhysicalParameters.mu_A  = 0.01;
            C.PhysicalParameters.mu_B  = 0.1;
            C.PhysicalParameters.Sigma = 0.097;

            C.PhysicalParameters.IncludeConvection = true;
            C.PhysicalParameters.Material          = true;

            #endregion

            // Initial Values
            // ==============
            #region init

            // large bubble above
            double[] center_l = new double[] { 0.5, 1.0 };
            double   radius_l = 0.25;
            Func <double[], double> bubble_l = (X => ((X[0] - center_l[0]).Pow2() + (X[1] - center_l[1]).Pow2()).Sqrt() - radius_l); // signed-distance form

            // small bubble under
            double[] center_s = new double[] { 0.5, 0.5 };
            double   radius_s = 0.2;
            Func <double[], double> bubble_s = (X => ((X[0] - center_s[0]).Pow2() + (X[1] - center_s[1]).Pow2()).Sqrt() - radius_s); // signed-distance form

            Func <double[], double> PhiFunc = (X => Math.Min(bubble_l(X), bubble_s(X)));

            //C.InitialValues_Evaluators.Add("Phi", PhiFunc);

            //C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0);
            //C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0);

            //C.InitialValues_Evaluators.Add("GravityY#A", X => -0.981);
            //C.InitialValues_Evaluators.Add("GravityY#B", X => -0.981);

            var  database  = new DatabaseInfo(_DbPath);
            Guid restartID = new Guid("9d1bbcd2-38d0-43d3-90d4-7ac7f535079c");
            C.RestartInfo = new Tuple <Guid, Foundation.IO.TimestepNumber>(restartID, null);


            #endregion

            // boundary conditions
            // ===================
            #region BC

            C.AddBoundaryCondition("wall_lower");
            C.AddBoundaryCondition("wall_upper");
            C.AddBoundaryCondition("freeslip_left");
            C.AddBoundaryCondition("freeslip_right");

            #endregion

            // misc. solver options
            // ====================
            #region solver

            C.LinearSolver = new DirectSolver()
            {
                WhichSolver = DirectSolver._whichSolver.MUMPS
            };

            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 40;
            //C.AdvancedDiscretizationOptions.UseGhostPenalties = true;

            C.LSContiProjectionMethod = ContinuityProjectionOption.SpecFEM;
            //C.option_solver = C.PhysicalParameters.IncludeConvection ? "fixpoint+levelset" : "direct";
            C.VelocityBlockPrecondMode      = MultigridOperator.Mode.SymPart_DiagBlockEquilib_DropIndefinite;
            C.NoOfMultigridLevels           = 1;
            C.Solver_MaxIterations          = 50;
            C.Solver_ConvergenceCriterion   = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.Curvature_Projected;
            C.AdvancedDiscretizationOptions.FilterConfiguration.FilterCurvatureCycles = 1;

            #endregion


            // Timestepping
            // ============
            #region time

            C.Timestepper_Scheme           = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.LieSplitting;

            C.CompMode = AppControl._CompMode.Transient;

            double dt = 2e-4;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.NoOfTimesteps = 1500;
            C.saveperiod    = 10;

            #endregion


            return(C);
        }