Exemple #1
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.AddBoundaryValue("velocity_inlet_lower", "VelocityY#A", X => U);
                C.AddBoundaryValue("velocity_inlet_lower", "VelocityY#B", X => U);
                C.AddBoundaryValue("velocity_inlet_upper", "VelocityY#A", X => U);
                C.AddBoundaryValue("velocity_inlet_upper", "VelocityY#B", X => U);
                break;

            case 2:
                C.AddBoundaryValue("velocity_inlet_lower", "VelocityX#A", X => U);
                C.AddBoundaryValue("velocity_inlet_lower", "VelocityX#B", X => U);
                C.AddBoundaryValue("velocity_inlet_upper", "VelocityX#A", X => U);
                C.AddBoundaryValue("velocity_inlet_upper", "VelocityX#B", X => U);
                C.AddBoundaryValue("velocity_inlet_left", "VelocityX#A", X => U);
                C.AddBoundaryValue("velocity_inlet_left", "VelocityX#B", X => U);
                C.AddBoundaryValue("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 #2
0
        /// <summary>
        /// control object for various testing
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control ChannelFlow_WithInterface(int p = 2, int kelem = 16, int wallBC = 0)
        {
            XNSE_Control C = new XNSE_Control();

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

            //C.CutCellQuadratureType = Foundation.XDG.XQuadFactoryHelper.MomentFittingVariants.Classic;

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

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

            C.ContinueOnIoError = false;

            #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
            });
            C.FieldOptions.Add("KineticEnergy", new FieldOpts()
            {
                Degree   = 2 * 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 = 0.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 = 4;// 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: false);
                //var grd = Grid2D.UnstructuredTriangleGrid(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(3, "pressure_outlet_left");
                grd.EdgeTagNames.Add(4, "pressure_outlet_right");

                //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] + H) <= 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 => - 1.0); // X[1] - (H / 2.1)); // + (H/20)*Math.Cos(8 * Math.PI * X[0] / L));
            C.InitialValues_Evaluators.Add("Phi", PhiFunc);


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

            //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
            //    );


            double U = 0.125;

            //C.InitialValues_Evaluators.Add("VelocityX#A", X => (-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U);
            //C.InitialValues_Evaluators.Add("VelocityX#B", X => (-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U);

            //C.InitialValues_Evaluators.Add("Pressure#A", X => 2.0 - X[0]);

            //C.InitialValues_Evaluators.Add("KineticEnergy#A", X => 1.0 * ((-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U).Pow2() / 2.0);
            //C.InitialValues_Evaluators.Add("KineticEnergy#B", X => 1.0 * ((-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U).Pow2() / 2.0);

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

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


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

            ////C.InitialValues_Evaluators.Add("Pressure#A", X => 2.0 - X[0]);

            //C.InitialValues_Evaluators.Add("KineticEnergy#A", X => U.Pow2() / 2.0);
            //C.InitialValues_Evaluators.Add("KineticEnergy#B", X => U.Pow2() / 2.0);

            //double Pjump = sigma / radius;
            //C.InitialValues_Evaluators.Add("Pressure#A", X => (2.0 - X[0]) + Pjump);
            //C.InitialValues_Evaluators.Add("Pressure#B", X => 2.0 - X[0]);

            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("cf6bd7bf-a19f-409e-b8c2-0b89388daad6");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, 10);

            #endregion

            // exact solution
            // ==============
            #region exact

            //C.Phi = ((X, t) => PhiFunc(X));

            C.ExactSolutionVelocity = new Dictionary <string, Func <double[], double, double>[]>();
            C.ExactSolutionVelocity.Add("A", new Func <double[], double, double>[] { (X, t) => 1 - X[1] * X[1], (X, t) => 0 });
            C.ExactSolutionVelocity.Add("B", new Func <double[], double, double>[] { (X, t) => 1 - X[1] * X[1], (X, t) => 0 });

            C.ExactSolutionPressure = new Dictionary <string, Func <double[], double, double> >();
            C.ExactSolutionPressure.Add("A", (X, t) => 8 - 2 * X[0]);
            C.ExactSolutionPressure.Add("B", (X, t) => 8 - 2 * X[0]);

            #endregion


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

            switch (wallBC)
            {
            case 0:
                goto default;

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

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

            default:
                C.AddBoundaryValue("wall_lower");
                C.AddBoundaryValue("wall_upper");
                break;
            }

            double T = 10;

            C.AddBoundaryValue("velocity_inlet_left", "VelocityX#A", (X, t) => ((-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U) * Math.Sin(2.0 * Math.PI * (t / T)));
            //C.AddBoundaryValue("velocity_inlet_left", "VelocityX#B", (X, t) => ((-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U) * Math.Sin(2.0 * Math.PI * (t / T)));
            //C.AddBoundaryValue("velocity_inlet_left", "VelocityX#A", X => U);
            //C.AddBoundaryValue("velocity_inlet_left", "VelocityX#B", X => U);

            //C.AddBoundaryValue("velocity_inlet_left", "KineticEnergy#A", X => 1.0 * ((-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U).Pow2() / 2.0);
            ////C.AddBoundaryValue("velocity_inlet_left", "KineticEnergy#B", X => U.Pow2() / 2);
            ////C.AddBoundaryValue("pressure_outlet_left");
            C.AddBoundaryValue("pressure_outlet_right");


            #endregion


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


            C.ComputeEnergyProperties    = true;
            C.solveKineticEnergyEquation = true;
            C.CheckJumpConditions        = true;
            C.kinEViscousDiscretization  = Solution.EnergyCommon.KineticEnergyViscousSourceTerms.laplaceKinE;
            C.kinEPressureDiscretization = Solution.EnergyCommon.KineticEnergyPressureSourceTerms.divergence;
            C.withDissipativePressure    = true;

            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.0;

            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

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

            //C.Phi = (X,t) => ((X[0] - (center[0]+U*t)).Pow2() + (X[1] - center[1]).Pow2()).Sqrt() - radius;

            C.Option_LevelSetEvolution = LevelSetEvolution.None;
            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;
            C.SkipSolveAndEvaluateResidual = true;


            C.AdaptiveMeshRefinement = false;
            C.RefinementLevel        = 1;

            #endregion


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

            C.TimeSteppingScheme           = TimeSteppingScheme.BDF3;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.None;


            C.TimesteppingMode = AppControl._TimesteppingMode.Transient;
            double dt = 1e-3;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 10000;
            C.saveperiod    = 10;

            #endregion


            return(C);
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control HeatedWall_Run(int p = 2, int kelemR = 8, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            bool solveHeat = true;

            //_DbPath = @"\\dc1\userspace\smuda\cluster\CapillaryRise\CapillaryRise_studyDB";

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

            C.DbPath             = _DbPath;
            C.savetodb           = false; // C.DbPath != null;
            C.ProjectName        = "XNSE/HeatedWall";
            C.ProjectDescription = "Leikonfiguration for SFB 1194";

            C.ContinueOnIoError = false;

            C.LogValues = XNSE_Control.LoggingValues.MovingContactLine;
            C.LogPeriod = 100;

            #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("Temperature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


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


            // numerical values for various testing
            C.PhysicalParameters.rho_A = 1.0;
            C.PhysicalParameters.rho_B = 1.0e-1;
            C.PhysicalParameters.mu_A  = 0.5;
            C.PhysicalParameters.mu_B  = 0.25e-1;
            C.PhysicalParameters.Sigma = 7.5e-1;

            C.solveCoupledHeatEquation = solveHeat;
            C.ThermalParameters.rho_A  = C.PhysicalParameters.rho_A;
            C.ThermalParameters.rho_B  = C.PhysicalParameters.rho_B;
            C.ThermalParameters.c_A    = 1.0e+3;
            C.ThermalParameters.c_B    = 1.0e+3;
            C.ThermalParameters.k_A    = 1.0;
            C.ThermalParameters.k_B    = 0.1;

            if (C.solveCoupledHeatEquation)
            {
                C.ThermalParameters.hVap_A = 1.0e6;
                C.ThermalParameters.hVap_B = -1.0e6;
            }
            double Tsat = 329.75;
            C.ThermalParameters.T_sat = Tsat;

            C.ThermalParameters.pc = 0.0;
            C.ThermalParameters.fc = 1.0;
            C.ThermalParameters.Rc = 1e7;

            double Lslip = 1e-2;
            C.PhysicalParameters.betaL   = 1.1 / (2 * Lslip);
            C.PhysicalParameters.theta_e = Math.PI * (1.0 / 3.0);


            // FC-72 (A:liquid and B:vapor state)
            //C.PhysicalParameters.rho_A = 1.6198e-3;     // 1.6198e-3;
            //C.PhysicalParameters.rho_B = 1.336e-5;       // 1.336e-5;
            //C.PhysicalParameters.mu_A = 4.5306e-4;      // 4.5306e-6;
            //C.PhysicalParameters.mu_B = 9.4602e-6;      // 9.4602e-8;
            //C.PhysicalParameters.Sigma = 8.273e-3;

            //C.solveCoupledHeatEquation = solveHeat;
            //C.ThermalParameters.rho_A = C.PhysicalParameters.rho_A;
            //C.ThermalParameters.rho_B = C.PhysicalParameters.rho_B;
            //C.ThermalParameters.c_A = 1.0984e+7;
            //C.ThermalParameters.c_B = 8.8504e+6;
            //C.ThermalParameters.k_A = 5.216;
            //C.ThermalParameters.k_B = 0.864;

            //if(C.solveCoupledHeatEquation) {
            //    C.ThermalParameters.hVap_A = 8.4515e+8;
            //    C.ThermalParameters.hVap_B = -8.4515e+8;
            //}
            //C.ThermalParameters.pc = 0.0;
            //double Tsat = 329.75;    // for pc=0, T_intMin = T_sat
            //C.ThermalParameters.T_sat = Tsat;
            //C.ThermalParameters.p_sat = 1000;   // 1bar
            //C.ThermalParameters.Rc = 2.445e+5;
            //C.ThermalParameters.fc = 0.5;

            //double A = 4.37e-17; //4.37e-17;    // dispersion constant

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

            //C.PhysicalParameters.betaL = 0.0;
            //C.PhysicalParameters.theta_e = Math.PI * (5.0 / 36.0);

            C.PhysicalParameters.IncludeConvection = false;
            C.PhysicalParameters.Material          = false;

            #endregion


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

            double R = 1.0;
            double H = 6.0;

            C.GridFunc = delegate() {
                double[] Xnodes = GenericBlas.Linspace(0, R, kelemR + 1);
                double[] Ynodes = GenericBlas.Linspace(-H / 4.0, H * 3.0 / 4.0, (6 * kelemR) + 1);
                var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes);

                if (solveHeat)
                {
                    grd.EdgeTagNames.Add(1, "wall_ZeroGradient_lower");
                    grd.EdgeTagNames.Add(2, "pressure_outlet_ZeroGradient_upper");
                    grd.EdgeTagNames.Add(3, "slipsymmetry_ConstantTemperature_left");
                    grd.EdgeTagNames.Add(4, "navierslip_linear_ConstantTemperature_right");
                    //grd.EdgeTagNames.Add(4, "navierslip_linear_ConstantHeatFlux_right");
                }
                else
                {
                    grd.EdgeTagNames.Add(1, "wall_lower");
                    //grd.EdgeTagNames.Add(1, "pressure_outlet_lower");
                    grd.EdgeTagNames.Add(2, "pressure_outlet_upper");
                    grd.EdgeTagNames.Add(3, "slipsymmetry_left");
                    //grd.EdgeTagNames.Add(3, "pressure_outlet_left");
                    grd.EdgeTagNames.Add(4, "navierslip_linear_right");
                }

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

                    return(et);
                });

                return(grd);
            };

            #endregion


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

            double h0 = 0.4;

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

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

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

            // disjoining pressure field
            double A     = 1e-2;
            double delta = 1e-2;
            C.DisjoiningPressureFunc = (X => A / (Math.Abs(X[0] - (R + delta))).Pow(3));

            if (C.solveCoupledHeatEquation)
            {
                C.InitialValues_Evaluators.Add("Temperature#A", X => Tsat);
                C.InitialValues_Evaluators.Add("Temperature#B", X => Tsat);
            }

            //C.RestartInfo = new Tuple<Guid, TimestepNumber>(restartID, null);


            #endregion


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

            double U        = 1.0;
            double deltaK   = 5;
            double WallTemp = Tsat + deltaK;
            //double HeatFlux = 10.0;

            if (solveHeat)
            {
                C.AddBoundaryValue("wall_ZeroGradient_lower");
                C.AddBoundaryValue("pressure_outlet_ZeroGradient_upper");

                C.AddBoundaryValue("slipsymmetry_ConstantTemperature_left", "Temperature#A", (X, t) => Tsat);
                C.AddBoundaryValue("slipsymmetry_ConstantTemperature_left", "Temperature#B", (X, t) => Tsat);

                C.AddBoundaryValue("navierslip_linear_ConstantTemperature_right", "VelocityY#A", (X, t) => U);
                C.AddBoundaryValue("navierslip_linear_ConstantTemperature_right", "VelocityY#B", (X, t) => U);
                C.AddBoundaryValue("navierslip_linear_ConstantTemperature_right", "Temperature#A", (X, t) => WallTemp);
                C.AddBoundaryValue("navierslip_linear_ConstantTemperature_right", "Temperature#B", (X, t) => WallTemp);
                //C.AddBoundaryValue("navierslip_linear_ConstantHeatFlux_right", "VelocityY#A", (X, t) => U);
                //C.AddBoundaryValue("navierslip_linear_ConstantHeatFlux_right", "VelocityY#B", (X, t) => U);
                //C.AddBoundaryValue("navierslip_linear_ConstantHeatFlux_right", "HeatFlux#A", (X, t) => HeatFlux);
                //C.AddBoundaryValue("navierslip_linear_ConstantHeatFlux_right", "HeatFlux#B", (X, t) => HeatFlux);
            }
            else
            {
                C.AddBoundaryValue("wall_lower");
                //C.AddBoundaryValue("pressure_outlet_lower");
                C.AddBoundaryValue("pressure_outlet_upper");

                C.AddBoundaryValue("slipsymmetry_left");
                //C.AddBoundaryValue("pressure_outlet_left");

                C.AddBoundaryValue("navierslip_linear_right", "VelocityY#A", (X, t) => U);
                C.AddBoundaryValue("navierslip_linear_right", "VelocityY#B", (X, t) => U);
            }

            C.AdvancedDiscretizationOptions.GNBC_Localization = NavierSlip_Localization.Bulk;
            C.AdvancedDiscretizationOptions.GNBC_SlipLength   = NavierSlip_SlipLength.Prescribed_SlipLength;
            C.PhysicalParameters.sliplength = Lslip;


            #endregion


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

            C.ComputeEnergy = false;

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

            C.VelocityBlockPrecondMode            = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;


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

            C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;
            //C.PhysicalParameters.mu_I = dt * 0.2;
            C.AdvancedDiscretizationOptions.UseLevelSetStabilization = false;

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


            C.AdaptiveMeshRefinement   = true;
            C.RefineStrategy           = XNSE_Control.RefinementStrategy.constantInterface;
            C.RefineNavierSlipBoundary = true;
            C.BaseRefinementLevel      = 2;

            #endregion


            // level-set
            // =========
            #region levelset

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

            #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;
            C.dtMax         = 5e-4;
            C.dtMin         = 5e-4;
            C.Endtime       = 10000;
            C.NoOfTimesteps = 10000;
            C.saveperiod    = 10;

            #endregion


            return(C);
        }
Exemple #4
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.AddBoundaryValue("wall_lower");
            C.AddBoundaryValue("wall_upper");
            C.AddBoundaryValue("freeslip_left");
            C.AddBoundaryValue("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.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //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 #5
0
        /// <summary>
        /// control object for various testing
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control ChannelFlow_WithInterface(int p = 2, int kelem = 8, int wallBC = 0)
        {
            XNSE_Control C = new XNSE_Control();

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

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

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

            C.ContinueOnIoError = false;

            #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
            });
            C.FieldOptions.Add("KineticEnergy", new FieldOpts()
            {
                Degree   = 2 * 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 = 0.0;
            C.PhysicalParameters.Sigma = sigma;

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

            C.PhysicalParameters.IncludeConvection = false;
            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: true);

                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(3, "pressure_outlet_left");
                //grd.EdgeTagNames.Add(4, "pressure_outlet_right");

                //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);
            };

            #endregion


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

            Func <double[], double> PhiFunc = (X => - 1); // X[0] - (H / 2.0)); // + (H/20)*Math.Cos(8 * Math.PI * X[0] / L));

            //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 = 0.125;

            //C.InitialValues_Evaluators.Add("VelocityX#A", X => (-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U);
            //C.InitialValues_Evaluators.Add("VelocityX#B", X => (4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U);

            //C.InitialValues_Evaluators.Add("Pressure#A", X => 2.0 - X[0]);

            //C.InitialValues_Evaluators.Add("KineticEnergy#A", X => 1.0 * ((-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U).Pow2() / 2.0);

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

            C.InitialValues_Evaluators.Add("GravityX#A", X => 5.0);

            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("cf6bd7bf-a19f-409e-b8c2-0b89388daad6");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, 10);

            #endregion


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

            switch (wallBC)
            {
            case 0:
                goto default;

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

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

            default:
                C.AddBoundaryValue("wall_lower");
                C.AddBoundaryValue("wall_upper");
                break;
            }

            //C.AddBoundaryValue("velocity_inlet_left", "VelocityX#A", X => (- 4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U);
            ////C.AddBoundaryValue("velocity_inlet_left", "VelocityX#B", X => U);
            //C.AddBoundaryValue("velocity_inlet_left", "KineticEnergy#A", X => 1.0 * ((-4.0 * U / H.Pow2()) * (X[1] - H / 2.0).Pow2() + U).Pow2() / 2.0);
            ////C.AddBoundaryValue("velocity_inlet_left", "KineticEnergy#B", X => U.Pow2() / 2);
            ////C.AddBoundaryValue("pressure_outlet_left");
            //C.AddBoundaryValue("pressure_outlet_right");


            #endregion


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

            C.ComputeEnergy = true;

            C.VelocityBlockPrecondMode            = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

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

            C.Option_LevelSetEvolution = LevelSetEvolution.None;
            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;
            C.AdvancedDiscretizationOptions.SST_isotropicMode   = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;


            C.AdaptiveMeshRefinement = false;
            C.RefinementLevel        = 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.Transient;
            double dt = 1e-2;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 300;
            C.saveperiod    = 10;

            #endregion


            return(C);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control Couette_GNBC(int tc = 1, int p = 2, int kelem = 16, double dt = 0.2, 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.ContinueOnIoError = false;

            //C.LogValues = XNSE_Control.LoggingValues.MovingContactLine;
            //C.LogPeriod = 10;

            #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;
            }

            case 3: {
                C.PhysicalParameters.rho_A = 8.1;
                C.PhysicalParameters.rho_B = 8.1;
                C.PhysicalParameters.mu_A  = 1.95;
                C.PhysicalParameters.mu_B  = 1.95;
                C.PhysicalParameters.Sigma = 0.55;

                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;
            }
            }

            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 + 1);
                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);
            };

            //C.GridFunc = delegate () {
            //    double[] Xnodes = GenericBlas.Linspace(0, 2, 9 + 1);
            //    double[] Ynodes = GenericBlas.Linspace(0, 1, 5 + 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] - 1) <= 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);
            //Func<double[], double> PhiFunc = (X => Math.Abs(X[0] - 1) - 0.5);

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

            //double U_slip = 0.16;

            C.InitialValues_Evaluators.Add("VelocityX#A", X => 0.0); // -U_slip + 2 * U_slip * X[1] / H);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => 0.0); // -U_slip + 2 * U_slip * X[1] / H);

            #endregion


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

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

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

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

            C.AdvancedDiscretizationOptions.GNBC_Localization = NavierSlip_Localization.Bulk;
            C.AdvancedDiscretizationOptions.GNBC_SlipLength   = NavierSlip_SlipLength.Prescribed_Beta;


            #endregion


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

            C.ComputeEnergy = false;

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

            C.VelocityBlockPrecondMode            = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.LinearSolver.NoOfMultigridLevels    = 2;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.NonLinearSolver.SolverCode = NonLinearSolverCode.Picard;

            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.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;


            //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-1;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 200;
            C.NoOfTimesteps = (int)(200.0 / (dt));
            C.saveperiod    = 2;

            #endregion


            return(C);
        }
Exemple #7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control HeatedWall_test(int p = 2, int kelemR = 8, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            bool solveHeat = true;

            //_DbPath = @"\\dc1\userspace\smuda\cluster\CapillaryRise\CapillaryRise_studyDB";

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

            C.DbPath             = _DbPath;
            C.savetodb           = false; // C.DbPath != null;
            C.ProjectName        = "XNSE/HeatedWall";
            C.ProjectDescription = "leikonfiguration for SFB 1194";

            C.ContinueOnIoError = false;

            C.LogValues = XNSE_Control.LoggingValues.MovingContactLine;
            C.LogPeriod = 100;

            #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("Temperature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


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

            C.PhysicalParameters.rho_A = 1.0;
            C.PhysicalParameters.rho_B = 0.1;
            C.PhysicalParameters.mu_A  = 1.0;
            C.PhysicalParameters.mu_B  = 1.0;
            C.PhysicalParameters.Sigma = 1.0;

            C.solveCoupledHeatSolver  = solveHeat;
            C.ThermalParameters.rho_A = C.PhysicalParameters.rho_A;
            C.ThermalParameters.rho_B = C.PhysicalParameters.rho_B;
            C.ThermalParameters.c_A   = 1.0;
            C.ThermalParameters.c_B   = 1.0;
            C.ThermalParameters.k_A   = 4.0;
            C.ThermalParameters.k_B   = 1.0;

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

            C.PhysicalParameters.betaL   = 0.0;
            C.PhysicalParameters.theta_e = Math.PI / 2.0;

            C.PhysicalParameters.IncludeConvection = false;
            C.PhysicalParameters.Material          = false;

            #endregion


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

            double R = 1.0;
            double H = 3.0;

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

                if (solveHeat)
                {
                    grd.EdgeTagNames.Add(1, "wall_Dirichlet_lower");
                    grd.EdgeTagNames.Add(2, "pressure_outlet_ZeroGradient_upper");
                    grd.EdgeTagNames.Add(3, "slipsymmetry_ZeroGradient_left");
                    grd.EdgeTagNames.Add(4, "navierslip_linear_ZeroGradient_right");
                }
                else
                {
                    grd.EdgeTagNames.Add(1, "wall_lower");
                    grd.EdgeTagNames.Add(2, "pressure_outlet_upper");
                    grd.EdgeTagNames.Add(3, "slipsymmetry_left");
                    grd.EdgeTagNames.Add(4, "navierslip_linear_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] - R) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                return(grd);
            };

            #endregion


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

            double h0 = 1.0;

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

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

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

            C.InitialValues_Evaluators.Add("Temperature#B", X => 10);

            //C.RestartInfo = new Tuple<Guid, TimestepNumber>(restartID, null);


            #endregion


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

            if (solveHeat)
            {
                C.AddBoundaryValue("wall_Dirichlet_lower", "Temperature#A", (X, t) => 0.0);
                C.AddBoundaryValue("wall_Dirichlet_lower", "Temperature#B", (X, t) => 0.0);
                C.AddBoundaryValue("pressure_outlet_ZeroGradient_upper");

                C.AddBoundaryValue("slipsymmetry_ZeroGradient_left");
                C.AddBoundaryValue("navierslip_linear_ZeroGradient_right");
            }
            else
            {
                C.AddBoundaryValue("wall_lower");
                C.AddBoundaryValue("pressure_outlet_upper");

                C.AddBoundaryValue("slipsymmetry_left");
                C.AddBoundaryValue("navierslip_linear_right");
            }

            C.AdvancedDiscretizationOptions.GNBC_Localization = NavierSlip_Localization.Bulk;
            C.AdvancedDiscretizationOptions.GNBC_SlipLength   = NavierSlip_SlipLength.hmin_Grid;


            #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.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;

            C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;
            //C.PhysicalParameters.mu_I = dt * 0.2;
            C.AdvancedDiscretizationOptions.UseLevelSetStabilization = false;

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


            C.AdaptiveMeshRefinement   = false;
            C.RefineStrategy           = XNSE_Control.RefinementStrategy.constantInterface;
            C.RefineNavierSlipBoundary = false;
            C.RefinementLevel          = 1;

            #endregion


            // level-set
            // =========
            #region levelset

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

            #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;
            C.dtMax         = 1e-1;
            C.dtMin         = 1e-1;
            C.Endtime       = 10000;
            C.NoOfTimesteps = 100;
            C.saveperiod    = 1;

            #endregion


            return(C);
        }
        /// <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.AddBoundaryValue("wall_lower");
            C.AddBoundaryValue("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 #9
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 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control CapillaryRise_Tube_SFB1194(int p = 2, int kelemR = 8, int omegaTc = 3, bool startUp = true, bool symmetry = true, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            _DbPath = @"\\dc1\userspace\smuda\cluster\CapillaryRise\CapillaryRise_studyDB";
            //_DbPath = @"\\HPCCLUSTER\hpccluster-scratch\smuda\CapillaryRise_studyDB";

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

            C.DbPath             = _DbPath;
            C.savetodb           = false; // C.DbPath != null;
            C.ProjectName        = "XNSE/CapillaryRise";
            C.ProjectDescription = "A comparative study for SFB 1194";

            C.ContinueOnIoError = false;

            C.LogValues = XNSE_Control.LoggingValues.MovingContactLine;
            C.LogPeriod = 100;

            #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

            // the gaseous phase should be close to air
            C.PhysicalParameters.rho_B = 1.204e-6;  // kg / cm^3
            C.PhysicalParameters.mu_B  = 17.1e-8;   // kg / cm s

            double g          = 0;
            double R          = 0;
            double H          = 0;
            double t_end      = 0;
            double dt         = 0;
            double t_startUp  = 0;
            double dt_startUp = 0;
            Guid   restartID  = new Guid();
            switch (omegaTc)
            {
            case 1: {
                C.Tags.Add("omega = 0.1");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 1663.8;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.2;               // kg / s^2

                C.PhysicalParameters.betaS_A = 1e-3 / Math.Min(R / kelemR, H / (5 * kelemR));
                C.PhysicalParameters.betaS_B = 1e-5 / Math.Min(R / kelemR, H / (5 * kelemR));

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 1.04;                 // cm / s^2

                t_end      = 13.86;
                t_startUp  = 0.49032;
                dt         = 4e-5;
                dt_startUp = 4e-5;

                //restartID = new Guid("07ca4397-8eed-4769-b795-9725fe7d3cd7");
                //restartID = new Guid("fa8454ce-c05a-4dea-a308-663b6be04ff7");
                restartID = new Guid("6380b408-e043-4ed3-8ae5-819d7566e241");

                break;
            }

            case 2: {
                C.Tags.Add("omega = 0.5");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 133.0;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.1;               // kg / s^2

                C.PhysicalParameters.betaS_A = 1e-3 / Math.Min(R / kelemR, H / (5 * kelemR));
                C.PhysicalParameters.betaS_B = 1e-5 / Math.Min(R / kelemR, H / (5 * kelemR));

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 6.51;                 // cm / s^2

                t_end      = 1.11;
                t_startUp  = 0.15;
                dt         = 2e-5;
                dt_startUp = 4e-5;

                restartID = new Guid("59e43164-1c32-4ece-b5ab-257844198fa4");

                break;
            }

            case 3: {
                C.Tags.Add("omega = 1");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 83.1;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.04;               // kg / s^2

                C.PhysicalParameters.betaS_A = 8;
                C.PhysicalParameters.betaS_B = 0.008;

                C.PhysicalParameters.betaL   = 0;       // 0.04; // 4.004;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 4.17;                 // cm / s^2

                t_end      = 0.7;
                t_startUp  = 0.098;
                dt         = 3.5e-5;
                dt_startUp = 4e-5;

                restartID = new Guid("e2a38f38-bcdb-4588-bd87-9914dc2989e4");           //startUp
                //restartID = new Guid("3a1136f2-5363-43b0-8084-5c2ee6ce9d06");   //restart

                //restartID = new Guid("f37c9194-1bfb-4250-8dc6-a4d1bbe01ed9");

                break;
            }

            case 4: {
                C.Tags.Add("omega = 10");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 3.3255;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.01;               // kg / s^2

                C.PhysicalParameters.betaS_A = 1e-3 / Math.Min(R / kelemR, H / (5 * kelemR));
                C.PhysicalParameters.betaS_B = 1e-5 / Math.Min(R / kelemR, H / (5 * kelemR));

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 26.042;                 // cm / s^2

                t_end      = 2.7713;
                t_startUp  = 0.098;
                dt         = 1e-4;
                dt_startUp = 1e-4;

                restartID = new Guid("26a16f96-a657-4834-8216-89d30a04c938");
                break;
            }

            case 5: {
                C.Tags.Add("omega = 100");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 0.33255;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.001;               // kg / s^2

                C.PhysicalParameters.betaS_A = 1e-3 / Math.Min(R / kelemR, H / (5 * kelemR));
                C.PhysicalParameters.betaS_B = 1e-5 / Math.Min(R / kelemR, H / (5 * kelemR));

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 26.042;                 // cm / s^2

                t_end      = 27.713;
                t_startUp  = 0.098;
                dt         = 1e-3;
                dt_startUp = 1e-3;

                restartID = new Guid("b59abf15-1358-48c1-8b79-6b10e1c1d729");
                break;
            }
            }

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

            #endregion


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

            if (startUp)
            {
                C.GridFunc = delegate() {
                    double[] Xnodes;
                    if (symmetry)
                    {
                        Xnodes = GenericBlas.Linspace(0, R, kelemR + 1);
                    }
                    else
                    {
                        Xnodes = GenericBlas.Linspace(-R, R, 2 * kelemR + 1);
                    }
                    double[] Ynodes = GenericBlas.Linspace(0, H, 6 * kelemR + 1);
                    var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes);

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

                    if (symmetry)
                    {
                        grd.EdgeTagNames.Add(3, "slipsymmetry_left");
                    }
                    else
                    {
                        grd.EdgeTagNames.Add(3, "navierslip_linear_left");
                    }

                    grd.EdgeTagNames.Add(4, "navierslip_linear_right");
                    //grd.EdgeTagNames.Add(4, "navierslip_localized_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 (symmetry)
                        {
                            if (Math.Abs(X[0]) <= 1.0e-8)
                            {
                                et = 3;
                            }
                        }
                        else
                        {
                            if (Math.Abs(X[0] + R) <= 1.0e-8)
                            {
                                et = 3;
                            }
                        }
                        if (Math.Abs(X[0] - R) <= 1.0e-8)
                        {
                            et = 4;
                        }

                        return(et);
                    });

                    return(grd);
                };
            }

            #endregion


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

            double h0 = 1e-2;

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

            if (startUp)
            {
                C.InitialValues_Evaluators.Add("Phi", PhiFunc);

                C.InitialValues_Evaluators.Add("GravityY#A", X => - g);
                C.InitialValues_Evaluators.Add("GravityY#B", X => - g);
            }
            else
            {
                C.RestartInfo = new Tuple <Guid, TimestepNumber>(restartID, null);
            }

            #endregion


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

            if (startUp)
            {
                C.AddBoundaryValue("wall_lower");
            }
            else
            {
                //C.AddBoundaryCondition("wall_lower");
                C.ChangeBoundaryCondition("wall_lower", "pressure_outlet_lower");
                C.AddBoundaryValue("pressure_outlet_lower");
            }
            C.AddBoundaryValue("pressure_outlet_upper");

            if (symmetry)
            {
                C.AddBoundaryValue("slipsymmetry_left");
            }
            else
            {
                C.AddBoundaryValue("navierslip_linear_left");
            }

            //C.ChangeBoundaryCondition("navierslip_localized_right", "navierslip_linear_right");
            C.AddBoundaryValue("navierslip_linear_right");

            C.AdvancedDiscretizationOptions.GNBC_Localization = NavierSlip_Localization.Nearband;
            C.AdvancedDiscretizationOptions.GNBC_SlipLength   = NavierSlip_SlipLength.hmin_Grid;


            #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.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.NoFilter;

            C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;
            //C.PhysicalParameters.mu_I = dt * 0.2;
            C.AdvancedDiscretizationOptions.UseLevelSetStabilization = false;

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


            C.AdaptiveMeshRefinement   = false;
            C.RefineStrategy           = XNSE_Control.RefinementStrategy.constantInterface;
            C.RefineNavierSlipBoundary = false;
            C.RefinementLevel          = 1;

            #endregion


            // level-set
            // =========
            #region levelset

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

            //int Nsp = 256;
            //C.FourierLevSetControl = new FourierLevSetControl(FourierType.Planar, Nsp, R, X => h0, R/(double)Nsp);
            //C.FourierLevSetControl.Timestepper = FourierLevelSet_Timestepper.RungeKutta1901;

            #endregion


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

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

            C.CompMode      = AppControl._CompMode.Transient;
            C.dtMax         = (startUp) ? dt_startUp : dt;
            C.dtMin         = (startUp) ? dt_startUp : dt;
            C.Endtime       = (startUp) ? Math.Sqrt(2 * R / g) * 5.0 : (t_startUp + t_end);
            C.NoOfTimesteps = (int)(C.Endtime / C.dtMin);
            C.saveperiod    = 100;

            #endregion


            return(C);
        }
Exemple #11
0
        /// <summary>
        /// predefined Control settings for the Rising Bubble Benchmark
        /// </summary>
        /// <param name="setup"></param>
        /// <returns></returns>
        public static XNSE_Control RB_ForWorksheet(int setup)
        {
            XNSE_Control C = new XNSE_Control();

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

            //C.DbPath = set by workflowMgm during job creation
            C.savetodb          = true;
            C.ContinueOnIoError = false;

            C.LogValues = XNSE_Control.LoggingValues.RisingBubble;

            #endregion

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

            int p = 2;

            // need to be set by user via setDGdegree() in worksheet
            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()
            {
                Degree   = p + 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree   = p + 1,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Curvature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            #endregion


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


            // Physical Parameters
            // ===================

            switch (setup)
            {
            case 1:
                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;
                break;

            case 2:
                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;
                break;

            default:
                throw new NotImplementedException();
            }

            // need to be set during job creation

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

            #endregion


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

            // need to be set by user via setGrid() in worksheet

            #endregion


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

            // need to be set during job creation

            #endregion


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

            // need to be set during job creation

            #endregion


            // additional parameters (evaluation)
            // ==================================

            // need to be set during job creation


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

            C.NonLinearSolver.MaxSolverIterations = 100;
            C.LinearSolver.MaxSolverIterations    = 100;

            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;

            C.LevelSet_ConvergenceCriterion = 1e-6;

            #endregion


            // Level-Set options (AMR)
            // =======================
            #region levset

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

            C.Option_LevelSetEvolution = LevelSetEvolution.Phasefield;

            C.AdvancedDiscretizationOptions.SST_isotropicMode = SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;

            #endregion

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

            C.TimesteppingMode = AppControl._TimesteppingMode.Transient;

            C.TimeSteppingScheme           = TimeSteppingScheme.BDF3;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.Coupled_Once;


            //C.dtMax = dt; // need to be set according to grid and DG degree
            //C.dtMin = dt;
            C.Endtime = 1000;
            //C.NoOfTimesteps = 0;

            C.saveperiod = 1;
            C.LogPeriod  = 1;

            #endregion


            return(C);
        }
Exemple #12
0
        /// <summary>
        /// Some Settings for the CW Test to read from Worksheet
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control CW_ForWorksheet()
        {
            XNSE_Control C = new XNSE_Control();

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

            //C.DbPath = set by workflowMgm during job creation
            C.savetodb          = true;
            C.ContinueOnIoError = false;

            C.LogValues = XNSE_Control.LoggingValues.Wavelike;

            #endregion

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

            // need to be set by user via setDGdegree() in worksheet

            #endregion


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

            // need to be set during job creation

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

            #endregion


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

            // need to be set by user via setGrid() in worksheet

            #endregion


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

            // need to be set during job creation

            #endregion


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

            // need to be set during job creation

            #endregion


            // additional parameters (evaluation)
            // ==================================

            // need to be set during job creation


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

            C.NonLinearSolver.MaxSolverIterations = 100;
            C.LinearSolver.MaxSolverIterations    = 100;

            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;

            C.LevelSet_ConvergenceCriterion = 1e-6;

            #endregion


            // Level-Set options (AMR)
            // =======================
            #region levset

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

            C.Option_LevelSetEvolution = LevelSetEvolution.Phasefield;

            C.AdvancedDiscretizationOptions.SST_isotropicMode = SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;

            #endregion


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

            C.TimesteppingMode = AppControl._TimesteppingMode.Transient;

            C.TimeSteppingScheme           = TimeSteppingScheme.BDF3;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.Coupled_Once;


            //C.dtMax = dt; // need to be set according to grid and DG degree
            //C.dtMin = dt;
            C.Endtime = 1000;
            //C.NoOfTimesteps = 0;

            C.saveperiod = 1;
            C.LogPeriod  = 1;

            #endregion


            return(C);
        }
Exemple #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p"></param>
        /// <param name="kelemR"></param>
        /// <param name="_DbPath"></param>
        /// <returns></returns>
        public static XNSE_Control ThermodynamicEquilibrium_Test(int p = 2, int kelemR = 16, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            C.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.Classic;

            bool steady = true;

            //_DbPath = @"\\dc1\userspace\smuda\cluster\CapillaryRise\CapillaryRise_studyDB";

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

            C.DbPath      = _DbPath;
            C.savetodb    = false; // C.DbPath != null;
            C.ProjectName = "XNSE/HeatedWall";
            //C.ProjectDescription = "Leikonfiguration for SFB 1194";

            C.ContinueOnIoError = false;

            #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
            });
            C.FieldOptions.Add("Temperature", new FieldOpts()
            {
                Degree   = p,
                SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            #endregion


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


            // Water (A: liquid, B: gaseous)
            C.PhysicalParameters.rho_A = 1.0;
            C.PhysicalParameters.rho_B = 0.1;
            C.PhysicalParameters.mu_A  = 1.0;
            C.PhysicalParameters.mu_B  = 1.0;
            C.PhysicalParameters.Sigma = 0.0;

            C.solveCoupledHeatEquation = true;
            C.ThermalParameters.rho_A  = C.PhysicalParameters.rho_A;
            C.ThermalParameters.rho_B  = C.PhysicalParameters.rho_B;
            C.ThermalParameters.c_A    = 1.0;
            C.ThermalParameters.c_B    = 0.001;
            C.ThermalParameters.k_A    = 1.0;
            double kv = 0.1;
            C.ThermalParameters.k_B = kv;

            if (C.solveCoupledHeatEquation)
            {
                C.ThermalParameters.hVap_A = 100.0;
                C.ThermalParameters.hVap_B = -100.0;
            }

            double Tsat = 100.0;
            C.ThermalParameters.T_sat = Tsat;
            double pSat = 10;
            C.ThermalParameters.p_sat = pSat;


            bool includeConv = true;
            C.PhysicalParameters.IncludeConvection = includeConv;
            C.ThermalParameters.IncludeConvection  = true;
            C.PhysicalParameters.Material          = false;

            #endregion


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

            double L = 0.1;

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

                if (!steady)
                {
                    grd.EdgeTagNames.Add(1, "wall_ConstantHeatFlux_lower");
                    grd.EdgeTagNames.Add(2, "pressure_Dirichlet_ZeroGradient_upper");
                }
                else
                {
                    grd.EdgeTagNames.Add(1, "pressure_outlet_ConstantTemperature_lower");
                    grd.EdgeTagNames.Add(2, "velocity_inlet_ZeroGradient_upper");
                }


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

                    return(et);
                });

                return(grd);
            };

            #endregion


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

            double zi0 = 0.01;

            Func <double[], double> PhiFunc = (X => zi0 - X[1]);     // A: vapor ; B: liquid

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

            double qv = 10.0;
            C.InitialValues_Evaluators.Add("Temperature#A", X => Tsat);
            C.InitialValues_Evaluators.Add("Temperature#B", X => Tsat + (qv / kv) * (zi0 - X[1]));

            if (!steady)
            {
                C.InitialValues_Evaluators.Add("Pressure#A", X => pSat);
                C.InitialValues_Evaluators.Add("Pressure#B", X => pSat - (0.01) * (10 - 1));

                C.InitialValues_Evaluators.Add("VelocityY#A", X => 0.9);
            }
            else
            {
                C.InitialValues_Evaluators.Add("VelocityY#A", X => - 0.1);
                C.InitialValues_Evaluators.Add("VelocityY#B", X => - 1.0);
            }


            //C.RestartInfo = new Tuple<Guid, TimestepNumber>(restartID, null);


            #endregion


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

            if (!steady)
            {
                //C.AddBoundaryValue("wall_ConstantHeatFlux_lower", "HeatFlux#A", (X, t) => HeatFlux);
                C.AddBoundaryValue("wall_ConstantHeatFlux_lower", "HeatFlux#B", (X, t) => - qv);

                C.AddBoundaryValue("pressure_Dirichlet_ZeroGradient_upper", "Pressure#A", (X, t) => pSat);
            }
            else
            {
                C.AddBoundaryValue("pressure_outlet_ConstantTemperature_lower", "Temperature#B", (X, t) => Tsat + (qv / kv) * (zi0 - X[1]));
                C.AddBoundaryValue("velocity_inlet_ZeroGradient_upper", "VelocityY#A", (X, t) => - 0.1);
            }



            #endregion


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

            C.ComputeEnergy = false;

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

            C.VelocityBlockPrecondMode            = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;


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

            C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;
            //C.PhysicalParameters.mu_I = dt * 0.2;
            C.AdvancedDiscretizationOptions.UseLevelSetStabilization = false;

            C.AdvancedDiscretizationOptions.SST_isotropicMode = Solution.XNSECommon.SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;
            //C.AdvancedDiscretizationOptions.CurvatureNeeded = true;


            C.AdaptiveMeshRefinement   = false;
            C.RefineStrategy           = XNSE_Control.RefinementStrategy.constantInterface;
            C.RefineNavierSlipBoundary = false;
            C.BaseRefinementLevel      = 1;

            #endregion


            // level-set
            // =========
            #region levelset

            C.Option_LevelSetEvolution = steady? LevelSetEvolution.None : LevelSetEvolution.FastMarching;

            #endregion


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

            C.Timestepper_Scheme           = XNSE_Control.TimesteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = steady ? LevelSetHandling.None : LevelSetHandling.LieSplitting;

            C.CompMode      = AppControl._CompMode.Transient;
            C.dtMax         = 1e-3;
            C.dtMin         = 1e-3;
            C.Endtime       = 10000;
            C.NoOfTimesteps = 1000;
            C.saveperiod    = 1;

            #endregion


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

            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:
                    grd.EdgeTagNames.Add(3, "velocity_inlet_left");
                    grd.EdgeTagNames.Add(4, "pressure_outlet_right");
                    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] - cLength).Pow2()).Sqrt() - cLength / 2);
                break;
            }

            case 2: {
                // radial interface
                double[] center = new double[] { L / 4.0, H / 2.0 };
                double   radius = cLength;
                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);
                C.InitialValues_Evaluators.Add("VelocityX#A", X => U);
                C.InitialValues_Evaluators.Add("VelocityX#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.AddBoundaryValue("velocity_inlet_lower", "VelocityY#A", X => U);
                //C.AddBoundaryValue("velocity_inlet_lower", "VelocityY#B", X => U);
                //C.AddBoundaryValue("velocity_inlet_upper", "VelocityY#A", X => U);
                //C.AddBoundaryValue("velocity_inlet_upper", "VelocityY#B", X => U);
                C.AddBoundaryValue("velocity_inlet_lower", "VelocityX#A", X => U);
                C.AddBoundaryValue("velocity_inlet_lower", "VelocityX#B", X => U);
                C.AddBoundaryValue("velocity_inlet_upper", "VelocityX#A", X => U);
                C.AddBoundaryValue("velocity_inlet_upper", "VelocityX#B", X => U);
                C.AddBoundaryValue("velocity_inlet_left", "VelocityX#A", X => U);
                C.AddBoundaryValue("velocity_inlet_left", "VelocityX#B", X => U);
                C.AddBoundaryValue("pressure_outlet_right");
                break;

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

            default:
                break;
            }

            #endregion

            // advanced settings for Fourier-Level-Set
            // ======================
            #region Fourier level-set

            switch (lsEvo)
            {
            case LevelSetEvolution.Fourier:
            {
                switch (boundarySetup)
                {
                case 1:
                {
                    throw new ArgumentException("Fourier Level-Set not implemented in Line Movement Test");
                    break;
                }

                case 2:
                {
                    int      numSp    = 640;
                    double[] FourierP = new double[numSp];
                    double[] samplP   = new double[numSp];
                    double[] center   = new double[] { L / 4.0, H / 2.0 };
                    double   radius   = cLength;
                    for (int sp = 0; sp < numSp; sp++)
                    {
                        FourierP[sp] = sp * (2 * Math.PI / (double)numSp);
                        samplP[sp]   = radius;
                    }

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

                    C.AdvancedDiscretizationOptions.SST_isotropicMode = SurfaceStressTensor_IsotropicMode.Curvature_Fourier;
                    break;
                }

                default:
                    break;
                }
                break;
            }

            default:
                break;
            }

            #endregion

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

            C.ComputeEnergyProperties = false;

            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            C.NonLinearSolver.MinSolverIterations = 4;
            C.LinearSolver.MinSolverIterations    = 4;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

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

            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.TimesteppingMode             = AppControl._TimesteppingMode.Transient;
            C.Timestepper_LevelSetHandling = lsHandl;
            C.TimeSteppingScheme           = tsScheme;

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

            #endregion


            return(C);
        }
Exemple #15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control CapillaryRise_Tube_SFB1194(int p = 2, int kelemR = 8, int omegaTc = 1, bool startUp = false, bool symmetry = true, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            C.CutCellQuadratureType = Foundation.XDG.XQuadFactoryHelper.MomentFittingVariants.Classic;

            //_DbPath = @"\\dc1\userspace\smuda\cluster\CapillaryRise\CapillaryRise_studyDB";
            _DbPath = @"\\HPCCLUSTER\hpccluster-scratch\smuda\CapillaryRise_studyDB";

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

            C.DbPath             = _DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/CapillaryRise";
            C.ProjectDescription = "A comparative study for SFB 1194";

            C.ContinueOnIoError = false;

            C.LogValues = XNSE_Control.LoggingValues.MovingContactLine;
            C.LogPeriod = 100;

            #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

            // the gaseous phase should be close to air
            //C.PhysicalParameters.rho_B = 1.204e-6;  // kg / cm^3
            //C.PhysicalParameters.mu_B = 17.1e-8;    // kg / cm s

            double g          = 0;
            double R          = 0;
            double H          = 0;
            double t_end      = 0;
            double dt         = 0;
            double t_startUp  = 0;
            double dt_startUp = 0;
            Guid   restartID  = new Guid();
            int    ts_restart = 0;
            switch (omegaTc)
            {
            case 1: {
                C.Tags.Add("omega = 0.1");
                R = 5e-3;                   // cm
                H = 4e-2;

                C.PhysicalParameters.rho_A = 1663.8;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.2;               // kg / s^2

                C.PhysicalParameters.rho_B = 1663.8 / 1000;
                C.PhysicalParameters.mu_B  = 0.01 / 1000;

                C.PhysicalParameters.betaS_A = 0;
                C.PhysicalParameters.betaS_B = 0;

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 1.04;                 // cm / s^2

                t_end      = 13.86;
                t_startUp  = 0.432; // 0.49032;
                dt         = 2e-5;  // dt = 1e-4; // dt = 2e-5;
                dt_startUp = 3e-5;

                //restartID = new Guid("07ca4397-8eed-4769-b795-9725fe7d3cd7");
                //restartID = new Guid("fa8454ce-c05a-4dea-a308-663b6be04ff7");
                //restartID = new Guid("6380b408-e043-4ed3-8ae5-819d7566e241");
                //restartID = new Guid("32d62e31-2b42-4a2c-850a-038befc43072");
                //ts_restart = 13010;

                //restartID = new Guid("868a08d9-5b44-4462-9a2c-121cfc07e5db");
                //restartID = new Guid("c3cef42c-f9e5-4757-a618-e9a4002e445f"); // restart with ReInit
                //restartID = new Guid("a191b8d0-1cca-431a-bf00-a1231c61dee6"); // restart2 with ReInit

                //restartID = new Guid("02f7d2b1-7546-45b3-808f-d2b6f89d68bf"); // restart with Reinit highdt (1e-4)
                //ts_restart = 186000;
                //restartID = new Guid("34c3ee0e-9244-497b-9382-58b458f7b873");   // restart with Reinit highdt (5e-5)
                //restartID = new Guid("1d31b648-d19f-4a5a-b374-cde08f8106a9");

                //restartID = new Guid("a32df5ae-393d-416a-bdd0-24a4437136fb");   //restart with sigma dt (2.5E-5)

                //ts_restart = 235300;
                //restartID = new Guid("5046ba97-36a6-4369-8e1e-670a71d1914f");
                //restartID = new Guid("55cce159-23cd-4598-b30b-b8f097dd2272");
                //restartID = new Guid("2a8e7b3d-bf81-48fe-b26d-6a2e6d22e5c1");
                //restartID = new Guid("244774e6-5ef1-4e3f-a9b1-d6158d865731");

                //restartID = new Guid("d801a5bd-35e7-4ef1-a150-4a93227f12cd");   //restart2


                //restartID = new Guid("1d679e3c-03f3-41ee-8f1e-7e80ec497926"); // restart with Reinit semi implicit
                //ts_restart = 270100;


                //restartID = new Guid("2f9deaa6-fab9-48ac-9279-319a1efa5547");

                //C.ClearVelocitiesOnRestart = true;
                C.ReInitPeriod = 400;

                break;
            }

            case 2: {
                C.Tags.Add("omega = 0.5");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 133.0;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.1;               // kg / s^2

                C.PhysicalParameters.betaS_A = 1e-3 / Math.Min(R / kelemR, H / (5 * kelemR));
                C.PhysicalParameters.betaS_B = 1e-5 / Math.Min(R / kelemR, H / (5 * kelemR));

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 6.51;                 // cm / s^2

                t_end      = 1.11;
                t_startUp  = 0.15;
                dt         = 2e-5;
                dt_startUp = 4e-5;

                restartID = new Guid("59e43164-1c32-4ece-b5ab-257844198fa4");

                break;
            }

            case 3: {
                C.Tags.Add("omega = 1");
                R = 5e-3;                   // cm
                H = 4e-2;

                C.PhysicalParameters.rho_A = 83.1;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.04;               // kg / s^2

                C.PhysicalParameters.rho_B = 83.1 / 1000;
                C.PhysicalParameters.mu_B  = 0.01 / 1000;

                C.PhysicalParameters.betaS_A = 0;       // 8;
                C.PhysicalParameters.betaS_B = 0;       // 0.008;

                C.PhysicalParameters.betaL   = 0;       // 0.04; // 4.004;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 4.17;                 // cm / s^2

                t_end      = 0.7;
                t_startUp  = 0.1955;
                dt         = 1e-5;
                dt_startUp = 5e-4;

                //restartID = new Guid("e2a38f38-bcdb-4588-bd87-9914dc2989e4");   //startUp
                //restartID = new Guid("3a1136f2-5363-43b0-8084-5c2ee6ce9d06");   //restart

                //restartID = new Guid("f37c9194-1bfb-4250-8dc6-a4d1bbe01ed9");

                restartID = new Guid("c572378f-edd9-4b96-9917-bb037ae4fdac");           //startUp2
                //C.ClearVelocitiesOnRestart = true;

                break;
            }

            case 4: {
                C.Tags.Add("omega = 10");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 3.3255;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.01;               // kg / s^2

                C.PhysicalParameters.betaS_A = 1e-3 / Math.Min(R / kelemR, H / (5 * kelemR));
                C.PhysicalParameters.betaS_B = 1e-5 / Math.Min(R / kelemR, H / (5 * kelemR));

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 26.042;                 // cm / s^2

                t_end      = 2.7713;
                t_startUp  = 0.098;
                dt         = 4e-4;
                dt_startUp = 1e-5;

                restartID = new Guid("26a16f96-a657-4834-8216-89d30a04c938");
                break;
            }

            case 5: {
                C.Tags.Add("omega = 100");
                R = 5e-3;                   // cm
                H = 3e-2;

                C.PhysicalParameters.rho_A = 0.33255;
                C.PhysicalParameters.mu_A  = 0.01;
                C.PhysicalParameters.Sigma = 0.001;               // kg / s^2

                C.PhysicalParameters.betaS_A = 1e-3 / Math.Min(R / kelemR, H / (5 * kelemR));
                C.PhysicalParameters.betaS_B = 1e-5 / Math.Min(R / kelemR, H / (5 * kelemR));

                C.PhysicalParameters.betaL   = 0;
                C.PhysicalParameters.theta_e = 3.0 * Math.PI / 18.0;

                g = 26.042;                 // cm / s^2

                t_end      = 27.713;
                t_startUp  = 0.098;
                dt         = 1e-3;
                dt_startUp = 1e-3;

                restartID = new Guid("b59abf15-1358-48c1-8b79-6b10e1c1d729");
                break;
            }
            }

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

            #endregion


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

            if (startUp)
            {
                C.GridFunc = delegate() {
                    double[] Xnodes;
                    if (symmetry)
                    {
                        Xnodes = GenericBlas.Linspace(0, R, kelemR + 1);
                    }
                    else
                    {
                        Xnodes = GenericBlas.Linspace(-R, R, 2 * kelemR + 1);
                    }
                    double[] Ynodes = GenericBlas.Linspace(0, H, 8 * kelemR + 1);
                    var      grd    = Grid2D.Cartesian2DGrid(Xnodes, Ynodes);

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

                    if (symmetry)
                    {
                        grd.EdgeTagNames.Add(3, "slipsymmetry_left");
                    }
                    else
                    {
                        grd.EdgeTagNames.Add(3, "navierslip_linear_left");
                    }

                    grd.EdgeTagNames.Add(4, "navierslip_linear_right");
                    //grd.EdgeTagNames.Add(4, "navierslip_localized_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 (symmetry)
                        {
                            if (Math.Abs(X[0]) <= 1.0e-8)
                            {
                                et = 3;
                            }
                        }
                        else
                        {
                            if (Math.Abs(X[0] + R) <= 1.0e-8)
                            {
                                et = 3;
                            }
                        }
                        if (Math.Abs(X[0] - R) <= 1.0e-8)
                        {
                            et = 4;
                        }

                        return(et);
                    });

                    return(grd);
                };
            }

            #endregion


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

            double h0 = 1e-2;

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

            if (startUp)
            {
                C.InitialValues_Evaluators.Add("Phi", PhiFunc);

                C.InitialValues_Evaluators.Add("GravityY#A", X => - g);
                C.InitialValues_Evaluators.Add("GravityY#B", X => - g);
            }
            else
            {
                if (ts_restart > 0)
                {
                    C.RestartInfo = new Tuple <Guid, BoSSS.Foundation.IO.TimestepNumber>(restartID, ts_restart);
                }
                else
                {
                    C.RestartInfo = new Tuple <Guid, BoSSS.Foundation.IO.TimestepNumber>(restartID, null);
                }
            }

            #endregion


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

            if (startUp)
            {
                C.AddBoundaryValue("wall_lower");
            }
            else
            {
                //C.AddBoundaryValue("wall_lower");
                //C.ChangeBoundaryCondition("wall_lower", "pressure_outlet_lower");
                C.AddBoundaryValue("pressure_outlet_lower");
            }
            C.AddBoundaryValue("pressure_outlet_upper");

            if (symmetry)
            {
                C.AddBoundaryValue("slipsymmetry_left");
            }
            else
            {
                C.AddBoundaryValue("navierslip_linear_left");
            }

            //C.ChangeBoundaryCondition("navierslip_localized_right", "navierslip_linear_right");
            C.AddBoundaryValue("navierslip_linear_right");

            C.AdvancedDiscretizationOptions.GNBC_Localization = NavierSlip_Localization.Bulk;
            C.AdvancedDiscretizationOptions.GNBC_SlipLength   = NavierSlip_SlipLength.Prescribed_SlipLength;
            C.PhysicalParameters.sliplength = 1e-3;


            #endregion


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

            C.ComputeEnergyProperties = false;

            //C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            //C.AdvancedDiscretizationOptions.PenaltySafety = 20;

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

            C.LinearSolver.NoOfMultigridLevels     = 1;
            C.NonLinearSolver.MaxSolverIterations  = 50;
            C.LinearSolver.MaxSolverIterations     = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            C.LevelSet_ConvergenceCriterion        = 1e-6;


            C.AdvancedDiscretizationOptions.FilterConfiguration = CurvatureAlgorithms.FilterConfiguration.Default;

            C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;
            //C.PhysicalParameters.mu_I = 1 * C.PhysicalParameters.Sigma;
            //C.PhysicalParameters.lambda_I = 2 * C.PhysicalParameters.Sigma;
            C.AdvancedDiscretizationOptions.UseLevelSetStabilization = false;

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


            C.AdaptiveMeshRefinement   = true;
            C.RefineStrategy           = XNSE_Control.RefinementStrategy.constantInterface;
            C.RefineNavierSlipBoundary = false;
            C.BaseRefinementLevel      = 1;

            #endregion


            // level-set
            // =========
            #region levelset

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

            //int Nsp = 256;
            //C.FourierLevSetControl = new FourierLevSetControl(FourierType.Planar, Nsp, R, X => h0, R/(double)Nsp);
            //C.FourierLevSetControl.Timestepper = FourierLevelSet_Timestepper.RungeKutta1901;

            #endregion


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

            C.TimeSteppingScheme           = TimeSteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.Coupled_Once;

            C.TimesteppingMode = AppControl._TimesteppingMode.Transient;
            C.dtMax            = (startUp) ? dt_startUp : dt;
            C.dtMin            = (startUp) ? dt_startUp : dt;
            C.Endtime          = (startUp) ? Math.Max(Math.Sqrt(2 * R / g), 2 * R * C.PhysicalParameters.mu_A / C.PhysicalParameters.Sigma) * 4.0 : (t_startUp + t_end);
            C.NoOfTimesteps    = (int)(C.Endtime / C.dtMin);
            C.saveperiod       = 100;

            #endregion


            return(C);
        }
        /// <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.AddBoundaryValue("wall_lower");
            C.AddBoundaryValue("wall_upper");
            C.AddBoundaryValue("freeslip_left");
            C.AddBoundaryValue("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 = 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 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static XNSE_Control CapillaryRise_Tube(int p = 2, int kelem = 16, string _DbPath = null)
        {
            XNSE_Control C = new XNSE_Control();

            _DbPath = @"\\fdyprime\userspace\smuda\cluster\CapillaryRise\CapillaryRise_db";

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

            C.DbPath             = _DbPath;
            C.savetodb           = C.DbPath != null;
            C.ProjectName        = "XNSE/CapillaryRise";
            C.ProjectDescription = "Capillary rise in tube";

            C.ContinueOnIoError = false;

            C.LogValues = XNSE_Control.LoggingValues.CapillaryHeight;
            C.LogPeriod = 10;

            #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

            C.PhysicalParameters.rho_A = 9.97e-4;
            C.PhysicalParameters.rho_B = 1.204e-6;
            C.PhysicalParameters.mu_A  = 1e-5;
            C.PhysicalParameters.mu_B  = 17.1e-8;
            C.PhysicalParameters.Sigma = 72.75e-3;

            C.PhysicalParameters.betaS_A = 1e-3;
            C.PhysicalParameters.betaS_B = 1e-5;

            C.PhysicalParameters.betaL   = 1e-4;
            C.PhysicalParameters.theta_e = Math.PI / 3.0;

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

            #endregion


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

            double R = 0.75e-1;
            double H = 10 * R;

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

                grd.EdgeTagNames.Add(1, "pressure_outlet_lower");
                grd.EdgeTagNames.Add(2, "pressure_outlet_upper");
                grd.EdgeTagNames.Add(3, "navierslip_linear_left");
                grd.EdgeTagNames.Add(4, "navierslip_linear_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] + R) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (Math.Abs(X[0] - R) <= 1.0e-8)
                    {
                        et = 4;
                    }

                    return(et);
                });

                return(grd);
            };

            #endregion


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

            double h0 = 1.0e-1;

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

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

            C.InitialValues_Evaluators.Add("GravityY", X => - 9.81e2);

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


            //var database = new DatabaseInfo(_DbPath);
            //Guid restartID = new Guid("ae0490a8-7ae3-474d-978e-ccdd1ed8726a");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, null);

            #endregion


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

            C.AddBoundaryValue("pressure_outlet_lower");
            C.AddBoundaryValue("pressure_outlet_upper");
            C.AddBoundaryValue("navierslip_linear_left");
            C.AddBoundaryValue("navierslip_linear_right");


            #endregion


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

            C.ComputeEnergyProperties = false;

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

            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.Option_LevelSetEvolution = LevelSetEvolution.FastMarching;

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

            C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;

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


            C.AdaptiveMeshRefinement = true;
            C.RefineStrategy         = XNSE_Control.RefinementStrategy.constantInterface;
            C.RefinementLevel        = 1;

            #endregion


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

            C.TimeSteppingScheme           = TimeSteppingScheme.BDF2;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.Coupled_Once;

            C.TimesteppingMode = AppControl._TimesteppingMode.Transient;
            double dt = 1e-6;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 1000;
            C.NoOfTimesteps = 50000;
            C.saveperiod    = 10;

            #endregion


            return(C);
        }
Exemple #18
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.AddBoundaryValue("freeslip_lower");
                if (slip)
                {
                    C.AddBoundaryValue("freeslip_upper", "VelocityX#A", X => - U);
                }
                else
                {
                    C.AddBoundaryValue("freeslip_upper");
                }

                if (!Xperiodic)
                {
                    C.AddBoundaryValue("velocity_inlet_left", "VelocityX#A", X => U);
                    C.AddBoundaryValue("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.AddBoundaryValue("navierslip_linear_lower", "VelocityX#A", X => - U);
                C.AddBoundaryValue("navierslip_linear_upper", "VelocityX#A", X => U);

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

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

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

            default: {
                break;
            }
            }

            #endregion


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

            C.ComputeEnergy = false;

            C.VelocityBlockPrecondMode            = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //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 #19
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 = 10, 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;
            C.LogPeriod = 30;

            #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

            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;
            double sigma = 24.5;
            C.PhysicalParameters.Sigma = sigma;

            //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;
            //double sigma = 1.96;
            //C.PhysicalParameters.Sigma = sigma;


            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("b90c5f79-9b82-47cd-b400-e9abbbd83e19");  //new Guid("2953cd96-ea27-4989-abd3-07e99d35de5f");
            //C.RestartInfo = new Tuple<Guid, Foundation.IO.TimestepNumber>(restartID, 1140);

            #endregion

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

            C.AddBoundaryValue("wall_lower");
            C.AddBoundaryValue("wall_upper");
            C.AddBoundaryValue("freeslip_left");
            C.AddBoundaryValue("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.ContinuousDG;

            C.VelocityBlockPrecondMode            = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 80;
            C.LinearSolver.MaxSolverIterations    = 80;
            //C.Solver_MaxIterations = 80;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //C.Solver_ConvergenceCriterion = 1e-8;
            C.LevelSet_ConvergenceCriterion = 1e-6;

            C.LinearSolver.SolverCode = LinearSolverCode.classic_mumps;

            C.AdvancedDiscretizationOptions.ViscosityMode = ViscosityMode.FullySymmetric;


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


            C.AdvancedDiscretizationOptions.SurfStressTensor = SurfaceSressTensor.Isotropic;
            C.PhysicalParameters.mu_I     = 1 * sigma;
            C.PhysicalParameters.lambda_I = 2 * sigma;

            C.AdvancedDiscretizationOptions.SST_isotropicMode = SurfaceStressTensor_IsotropicMode.LaplaceBeltrami_ContactLine;

            //C.LS_TrackerWidth = 2;
            C.AdaptiveMeshRefinement = true;
            C.RefineStrategy         = XNSE_Control.RefinementStrategy.constantInterface;
            C.RefinementLevel        = 1;


            #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.NoOfTimesteps = 3000;
            C.saveperiod    = 3;


            #endregion

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

            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 flow for testing the level set movement in solid body rotation";

            #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 = 1;
            double H = 1;

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

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

                grd.EdgeTagNames.Add(1, "velocity_inlet_lower");
                grd.EdgeTagNames.Add(2, "velocity_inlet_upper");
                grd.EdgeTagNames.Add(3, "velocity_inlet_left");
                grd.EdgeTagNames.Add(4, "velocity_inlet_right");

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

                    return(et);
                });

                return(grd);
            };

            #endregion


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

            Func <double[], double> PhiFunc;

            switch (boundarySetup)
            {
            case 1:
            {
                // elliptoid
                double[] center = new double[] { 0.15, 0.0 };
                double[] shape  = new double[] { 1, 0.36 };
                double   radius = cLength;
                PhiFunc = (X => ((X[0] - center[0]).Pow2() / shape[0] + (X[1] - center[1]).Pow2() / shape[1]).Sqrt() - radius);
                break;
            }

            case 2:
            {
                // slotted disk
                double[]     xCutout = new double[] { -0.1, 0.1 };
                double       yCutout = -0.1;
                double       radius  = cLength;
                ZalesaksDisk disk    = new ZalesaksDisk(xCutout, yCutout, radius);
                PhiFunc = (X => disk.SignedDistanceLevelSet(X));
                break;
            }

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

            C.InitialValues_Evaluators.Add("VelocityX#A", X => - X[1]);
            C.InitialValues_Evaluators.Add("VelocityX#B", X => - X[1]);
            C.InitialValues_Evaluators.Add("VelocityY#A", X => X[0]);
            C.InitialValues_Evaluators.Add("VelocityY#B", X => X[0]);


            #endregion


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

            C.AddBoundaryValue("velocity_inlet_lower", "VelocityX#A", X => - X[1]);
            C.AddBoundaryValue("velocity_inlet_lower", "VelocityX#B", X => - X[1]);
            C.AddBoundaryValue("velocity_inlet_upper", "VelocityX#A", X => - X[1]);
            C.AddBoundaryValue("velocity_inlet_upper", "VelocityX#B", X => - X[1]);
            C.AddBoundaryValue("velocity_inlet_left", "VelocityX#A", X => - X[1]);
            C.AddBoundaryValue("velocity_inlet_left", "VelocityX#B", X => - X[1]);
            C.AddBoundaryValue("velocity_inlet_right", "VelocityX#A", X => - X[1]);
            C.AddBoundaryValue("velocity_inlet_right", "VelocityX#B", X => - X[1]);

            C.AddBoundaryValue("velocity_inlet_lower", "VelocityY#A", X => X[0]);
            C.AddBoundaryValue("velocity_inlet_lower", "VelocityY#B", X => X[0]);
            C.AddBoundaryValue("velocity_inlet_upper", "VelocityY#A", X => X[0]);
            C.AddBoundaryValue("velocity_inlet_upper", "VelocityY#B", X => X[0]);
            C.AddBoundaryValue("velocity_inlet_left", "VelocityY#A", X => X[0]);
            C.AddBoundaryValue("velocity_inlet_left", "VelocityY#B", X => X[0]);
            C.AddBoundaryValue("velocity_inlet_right", "VelocityY#A", X => X[0]);
            C.AddBoundaryValue("velocity_inlet_right", "VelocityY#B", X => X[0]);

            #endregion

            // advanced settings for Fourier-Level-Set
            // ======================
            #region Fourier level-set

            switch (lsEvo)
            {
            case LevelSetEvolution.Fourier:
            {
                switch (boundarySetup)
                {
                case 1:
                {
                    int      numSp    = 640;
                    double[] FourierP = new double[numSp];
                    double[] samplP   = new double[numSp];
                    double[] center   = new double[] { 0.15, 0.0 };
                    double   radius   = cLength;
                    for (int sp = 0; sp < numSp; sp++)
                    {
                        FourierP[sp] = sp * (2 * Math.PI / (double)numSp);
                        samplP[sp]   = radius / (Math.Cos(FourierP[sp]).Pow2() + Math.Sin(FourierP[sp]).Pow2() / 0.36).Sqrt();
                    }

                    C.FourierLevSetControl = new FourierLevSetControl(FourierType.Polar, 2 * Math.PI, FourierP, samplP, 1.0 / (double)kelem)
                    {
                        center        = center,
                        FourierEvolve = Fourier_Evolution.MaterialPoints,
                        centerMove    = CenterMovement.Reconstructed,
                        PeriodicFunc  = (X => radius / (Math.Cos(X).Pow2() + Math.Sin(X).Pow2() / 0.36).Sqrt())
                    };

                    C.AdvancedDiscretizationOptions.SST_isotropicMode = SurfaceStressTensor_IsotropicMode.Curvature_Fourier;
                    break;
                }

                case 2:
                {
                    throw new ArgumentException("Fourier Level-Set is not suitable for Slotted Disk");
                }

                default:
                    break;
                }
                break;
            }

            default:
                break;
            }

            #endregion

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

            C.ComputeEnergy = false;

            C.VelocityBlockPrecondMode            = MultigridOperator.Mode.SymPart_DiagBlockEquilib;
            C.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            C.NonLinearSolver.MinSolverIterations = 4;
            C.LinearSolver.MinSolverIterations    = 4;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //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 #21
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 = @"\\dc1\userspace\yotov\bosss-db\RisingBubble"";


            // 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.AddBoundaryValue("wall_lower");
            C.AddBoundaryValue("wall_upper");
            C.AddBoundaryValue("freeslip_left");
            C.AddBoundaryValue("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.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.MinSolverIterations = 1;
            C.LinearSolver.MinSolverIterations    = 1;
            //C.Solver_MinIterations = 1;
            C.NonLinearSolver.ConvergenceCriterion = 1e-7;
            C.LinearSolver.ConvergenceCriterion    = 1e-7;
            //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 #22
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.AddBoundaryValue("wall_lower");
            C.AddBoundaryValue("wall_upper");
            C.AddBoundaryValue("freeslip_left");
            C.AddBoundaryValue("freeslip_right");

            #endregion

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

            C.LinearSolver.SolverCode = LinearSolverCode.classic_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.LinearSolver.NoOfMultigridLevels    = 1;
            C.NonLinearSolver.MaxSolverIterations = 50;
            C.LinearSolver.MaxSolverIterations    = 50;
            //C.Solver_MaxIterations = 50;
            C.NonLinearSolver.ConvergenceCriterion = 1e-8;
            C.LinearSolver.ConvergenceCriterion    = 1e-8;
            //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.TimeSteppingScheme           = TimeSteppingScheme.ImplicitEuler;
            C.Timestepper_BDFinit          = TimeStepperInit.SingleInit;
            C.Timestepper_LevelSetHandling = LevelSetHandling.LieSplitting;

            C.TimesteppingMode = AppControl._TimesteppingMode.Transient;

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

            #endregion


            return(C);
        }
Exemple #23
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);
        }