Ejemplo n.º 1
0
        // 4:1 Contraction Flow
        static public RheologyControl Contraction(string path = @"\\dc1\userspace\kikker\cluster\cluster_db\ContractionNYC", int degree = 1, int GridLevel = 3)   //int kelem = 4
        {
            RheologyControl C = new RheologyControl();

            //Path für cluster
            //\\dc1\userspace\kikker\cluster\cluster_db\ContractionNYC

            //Path für lokale DB
            //C:\AnnesBoSSSdb\Contraction

            //Solver Options
            C.NoOfTimesteps      = 15;
            C.savetodb           = true;
            C.DbPath             = path;
            C.ProjectName        = "Contration";
            C.MaxIter            = 50;
            C.MinIter            = 1;
            C.ConvCrit           = 1E-7;
            C.dt                 = 1E20;
            C.dtMax              = C.dt;
            C.dtMin              = C.dt;
            C.Timestepper_Scheme = RheologyControl.TimesteppingScheme.ImplicitEuler;
            C.NonlinearMethod    = NonlinearSolverMethod.NewtonGMRES;
            C.ObjectiveParam     = 1.0;

            //Debugging and Solver Analysis
            C.OperatorMatrixAnalysis       = false;
            C.SkipSolveAndEvaluateResidual = false;
            C.SetInitialConditions         = true;
            C.SetInitialPressure           = false;
            C.SetParamsAnalyticalSol       = false;
            C.ComputeL2Error = false;

            //Physical Params
            C.Stokes = false;
            C.FixedStreamwisePeriodicBC = false;
            C.beta             = 0.11;
            C.Reynolds         = 1;
            C.Weissenberg      = 0.1;
            C.RaiseWeissenberg = true;

            //Grid Params
            //double GridLevel = 5;
            double h      = Math.Pow(2, -GridLevel + 1);
            double cells  = 1 / h;
            int    cells2 = (int)cells;

            //Penalties
            C.ViscousPenaltyScaling = 1;
            C.Penalty2        = 1;
            C.Penalty1[0]     = 0.0;
            C.Penalty1[1]     = 0.0;
            C.PresPenalty2    = 1;
            C.PresPenalty1[0] = 0.0;
            C.PresPenalty1[1] = 0.0;


            //Exact Solution Contraction

            // Set Initial Conditions
            Func <double[], double, double> VelocityXfunction = (X, t) => ((3 / 2) * 4 * (1 - (X[1] * X[1]) / 4)); //(4 - X[1] * X[1]);
            Func <double[], double, double> VelocityYfunction = (X, t) => (0.0);
            Func <double[], double, double> Pressurefunction  = (X, t) => 2 / C.Reynolds * (20 - X[0]);
            Func <double[], double, double> StressXXfunction  = (X, t) => 2 * C.Weissenberg * (1 - C.beta) * (((-2 * X[1])) * ((-2 * X[1])));
            Func <double[], double, double> StressXYfunction  = (X, t) => (1 - C.beta) * ((-2 * X[1]));
            Func <double[], double, double> StressYYfunction  = (X, t) => (0.0);

            // Insert Exact Solution
            C.ExSol_Velocity = new Func <double[], double, double>[] { VelocityXfunction, VelocityYfunction };
            C.ExSol_Pressure = Pressurefunction;
            C.ExSol_Stress   = new Func <double[], double, double>[] { StressXXfunction, StressXYfunction, StressYYfunction };

            // Create Fields
            //int degree = 2;
            C.FieldOptions.Add("VelocityX", new FieldOpts()
            {
                Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("VelocityY", new FieldOpts()
            {
                Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Pressure", new FieldOpts()
            {
                Degree = degree - 1, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            C.FieldOptions.Add("StressXX", new FieldOpts()
            {
                Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("StressXY", new FieldOpts()
            {
                Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("StressYY", new FieldOpts()
            {
                Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("PhiDG", new FieldOpts()
            {
                Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });
            C.FieldOptions.Add("Phi", new FieldOpts()
            {
                Degree = degree, SaveToDB = FieldOpts.SaveToDBOpt.TRUE
            });

            // Create Grid

            double[] pt1a = new double[] { 10, 0.5 };
            double[] pt1b = new double[] { 20, 2 };

            BoundingBox boundingBox1;

            boundingBox1 = new BoundingBox(pt1a, pt1b);

            double[] pt2a = new double[] { 10, -0.5 };
            double[] pt2b = new double[] { 20, -2 };

            BoundingBox boundingBox2;

            boundingBox2 = new BoundingBox(pt2a, pt2b);

            C.GridFunc = delegate
            {
                // UNIFORM CARTESIAN GRID
                //var _xNodes = GenericBlas.Linspace(0, 20, cells2 + 1);// 10 * GridLevel + 1); //(10 * kelem + 1));
                //var _yNodes = GenericBlas.Linspace(-2, 2, (cells2 / 4) + 1);// (int)(2 * 1.5 * GridLevel) + GridLevel + 1); //(int)((2 * 1.5 * kelem) + kelem + 1));

                // NON_UNIFORM CARTESIAN GRID
                //var _xNodes1 = Grid1D.TanhSpacing(0, 10, (cells2 / 4) + 1, 2, false);
                //_xNodes1 = _xNodes1.GetSubVector(0, (_xNodes1.Length - 1));
                //var _xNodes2 = Grid1D.TanhSpacing(10, 20, (cells2 / 4) + 1, 2, true);
                //var _xNodes = ArrayTools.Cat(_xNodes1, _xNodes2);

                //var _yNodes1 = Grid1D.TanhSpacing(0, 0.5, (cells2 / 6) + 1, 1.5, false);
                //_yNodes1 = _yNodes1.GetSubVector(0, (_yNodes1.Length - 1));
                //var _yNodes2 = Grid1D.TanhSpacing(0.5, 2, (6 * cells2 / 16) + 1, 1.5, true);
                ////var _yNodes = ArrayTools.Cat(_yNodes1, _yNodes2);

                //var _yNodes3 = Grid1D.TanhSpacing(-0.5, 0, (cells2 / 6) + 1, 1.5, true);
                //_yNodes3 = _yNodes3.GetSubVector(0, (_yNodes3.Length - 1));
                //var _yNodes4 = Grid1D.TanhSpacing(-2, -0.5, (6 * cells2 / 16) + 1, 1.5, false);
                //_yNodes4 = _yNodes4.GetSubVector(0, (_yNodes4.Length - 1));
                //var _yNodes = ArrayTools.Cat(_yNodes4, _yNodes3, _yNodes1, _yNodes2);

                //var grd = Grid2D.Cartesian2DGrid(_xNodes, _yNodes, CellType.Square_Linear, C.FixedStreamwisePeriodicBC, false, boundingBox1, boundingBox2);

                //// CARTESIAN GRID WITH HANGING NODES REFINEMENT
                double[] ecke = new double[] { 10, 0.5 };

                var boxA1_p1 = new double[2] {
                    0, -2
                };
                var boxA1_p2 = new double[2] {
                    10, 2
                };
                var boxA1 = new GridCommons.GridBox(boxA1_p1, boxA1_p2, 2 * 40, 2 * 16);

                var boxA2_p1 = new double[2] {
                    9, -1
                };
                var boxA2_p2 = new double[2] {
                    10, 1
                };
                //var boxA2_p1 = new double[2] { ecke[0] - 0.5, ecke[1] - 0.25 };
                //var boxA2_p2 = new double[2] { ecke[0], ecke[1] + 0.25 };
                var boxA2 = new GridCommons.GridBox(boxA2_p1, boxA2_p2, 2 * 8, 2 * 16);

                var boxA3_p1 = new double[2] {
                    9.5, -0.75
                };
                var boxA3_p2 = new double[2] {
                    10, 0.75
                };
                var boxA3 = new GridCommons.GridBox(boxA3_p1, boxA3_p2, 2 * 8, 2 * 24);

                var grdA = Grid2D.HangingNodes2D(boxA1, boxA2, boxA3);

                var boxB1_p1 = new double[2] {
                    10, -0.5
                };
                var boxB1_p2 = new double[2] {
                    20, 0.5
                };
                var boxB1 = new GridCommons.GridBox(boxB1_p1, boxB1_p2, 2 * 40, 2 * 4);

                var boxB2_p1 = new double[2] {
                    10, -0.5
                };
                var boxB2_p2 = new double[2] {
                    11, 0.5
                };
                var boxB2 = new GridCommons.GridBox(boxB2_p1, boxB2_p2, 2 * 8, 2 * 8);

                var boxB3_p1 = new double[2] {
                    10, -0.5
                };
                var boxB3_p2 = new double[2] {
                    10.5, 0.5
                };
                var boxB3 = new GridCommons.GridBox(boxB3_p1, boxB3_p2, 2 * 8, 2 * 16);

                var grdB = Grid2D.HangingNodes2D(boxB1, boxB2, boxB3);

                var grdM = GridCommons.MergeLogically(grdA, grdB);
                var grd  = GridCommons.Seal(grdM);

                // COARSE CARTESIAN GRID WITH HANGING NODES REFINEMENT - FOR DEBUGGING!
                //double[] ecke = new double[] { 10, 0.5 };

                //var boxA1_p1 = new double[2] { 0, -2 };
                //var boxA1_p2 = new double[2] { 10, 2 };
                //var boxA1 = new GridCommons.GridBox(boxA1_p1, boxA1_p2, 2 * 10, 2 * 4);

                //var boxA2_p1 = new double[2] { 9, -1 };
                //var boxA2_p2 = new double[2] { 10, 1 };
                ////var boxA2_p1 = new double[2] { ecke[0] - 0.5, ecke[1] - 0.25 };
                ////var boxA2_p2 = new double[2] { ecke[0], ecke[1] + 0.25 };
                //var boxA2 = new GridCommons.GridBox(boxA2_p1, boxA2_p2, 2 * 2, 2 * 4);

                ////var boxA3_p1 = new double[2] { 9.5, -0.75 };
                ////var boxA3_p2 = new double[2] { 10, 0.75 };
                ////var boxA3 = new GridCommons.GridBox(boxA3_p1, boxA3_p2, 2 * 4, 2 * 12);

                //var grdA = Grid2D.HangingNodes2D(boxA1, boxA2);

                //var boxB1_p1 = new double[2] { 10, -0.5 };
                //var boxB1_p2 = new double[2] { 20, 0.5 };
                //var boxB1 = new GridCommons.GridBox(boxB1_p1, boxB1_p2, 2 * 10, 2 * 1);

                //var boxB2_p1 = new double[2] { 10, -0.5 };
                //var boxB2_p2 = new double[2] { 11, 0.5 };
                //var boxB2 = new GridCommons.GridBox(boxB2_p1, boxB2_p2, 2 * 2, 2 * 2);

                ////var boxB3_p1 = new double[2] { 10, -0.5 };
                ////var boxB3_p2 = new double[2] { 10.5, 0.5 };
                ////var boxB3 = new GridCommons.GridBox(boxB3_p1, boxB3_p2, 2 * 4, 2 * 8);

                //var grdB = Grid2D.HangingNodes2D(boxB1, boxB2);

                //var grdM = GridCommons.MergeLogically(grdA, grdB);
                //var grd = GridCommons.Seal(grdM);

                if (!C.FixedStreamwisePeriodicBC)
                {
                    grd.EdgeTagNames.Add(1, "Velocity_inlet");
                    grd.EdgeTagNames.Add(4, "Pressure_Outlet");
                }

                //grd.EdgeTagNames.Add(2, "FreeSlip");
                grd.EdgeTagNames.Add(2, "Wall_bottom");
                grd.EdgeTagNames.Add(3, "Wall_top");


                grd.EdgeTagNames.Add(5, "Wall_Contraction_bottom");
                grd.EdgeTagNames.Add(6, "Wall_Contraction_top");

                grd.DefineEdgeTags(delegate(double[] _X)
                {
                    var X    = _X;
                    double x = X[0];
                    double y = X[1];

                    if (!C.FixedStreamwisePeriodicBC)
                    {
                        if (Math.Abs(x - (0)) < 1.0e-6)
                        {
                            //left
                            return(1);
                        }

                        if (Math.Abs(x - (20)) < 1.0e-6)
                        {
                            //right
                            return(4);
                        }
                    }

                    if (Math.Abs(y - (-2)) < 1.0e-6 && x < 10 + 1.0e-6)
                    {
                        //bottom front
                        return(2);
                    }

                    //if (Math.Abs(y - (0)) < 1.0e-6)
                    //{
                    //    //symmetry line
                    //    return 2;
                    //}

                    if (Math.Abs(y - (+2)) < 1.0e-6 && x < 10 + 1.0e-6)
                    {
                        //top front
                        return(3);
                    }

                    if (Math.Abs(y - (-0.5)) < 1.0e-6 && x > 10 - 1.0e-6)
                    {
                        // bottom back
                        return(2);
                    }

                    if (Math.Abs(y - (+0.5)) < 1.0e-6 && x > 10 - 1.0e-6)
                    {
                        // top back
                        return(3);
                    }

                    if (Math.Abs(x - (10)) < 1.0e-6 && y < -0.5 - 1.0e-6)
                    {
                        // bottom contraction
                        return(5);
                    }

                    if (Math.Abs(x - (10)) < 1.0e-6 && y > 0.5 - 1.0e-6)
                    {
                        //top contraction
                        return(6);
                    }

                    throw new ArgumentOutOfRangeException("at x = " + x + "and y = " + y);
                });


                return(grd);
            };


            // Analytical Sol for Params
            if (C.SetParamsAnalyticalSol == true)
            {
                C.VelFunctionU = X => VelocityXfunction(X, 0);
                C.VelFunctionV = X => VelocityYfunction(X, 0);
                C.PresFunction = X => Pressurefunction(X, 0);
            }

            // Set Initial Conditions
            if (C.SetInitialConditions == true)
            {
                C.InitialValues_Evaluators.Add("VelocityX", X => VelocityXfunction(X, 0));
                C.InitialValues_Evaluators.Add("VelocityY", X => VelocityYfunction(X, 0));
                C.InitialValues_Evaluators.Add("StressXX", X => StressXXfunction(X, 0));
                C.InitialValues_Evaluators.Add("StressXY", X => StressXYfunction(X, 0));
                C.InitialValues_Evaluators.Add("StressYY", X => StressYYfunction(X, 0));

                if (C.SetInitialPressure == true || C.SkipSolveAndEvaluateResidual == true)
                {
                    C.InitialValues_Evaluators.Add("Pressure", X => Pressurefunction(X, 0));
                }
            }

            C.InitialValues_Evaluators.Add("Phi", X => - 1);

            // Set Boundary Conditions
            C.AddBoundaryValue("Wall_bottom");
            C.AddBoundaryValue("Wall_top");
            C.AddBoundaryValue("Wall_Contraction_bottom");
            C.AddBoundaryValue("Wall_Contraction_top");
            //C.AddBoundaryCondition("FreeSlip");


            if (!C.FixedStreamwisePeriodicBC)
            {
                C.AddBoundaryValue("Velocity_inlet", "VelocityX", VelocityXfunction);
                C.AddBoundaryValue("Velocity_inlet", "VelocityY", VelocityYfunction);
                C.AddBoundaryValue("Velocity_inlet", "StressXX", StressXXfunction);
                C.AddBoundaryValue("Velocity_inlet", "StressXY", StressXYfunction);
                C.AddBoundaryValue("Velocity_inlet", "StressYY", StressYYfunction);
                //C.AddBoundaryCondition("Velocity_inlet", "Pressure", Pressurefunction);
                C.AddBoundaryValue("Pressure_Outlet");
            }
            return(C);
        }
Ejemplo n.º 2
0
        public static FSI_Control IBMCylinderFlowUhlmann(string _DbPath = null, int k = 2, bool xPeriodic = false, double VelXBase = 0.0, bool movingMesh = true)
        {
            FSI_Control C = new FSI_Control();

            //const double BaseSize = 1.0;
            //const double MeshFactor = 0.43;

            // basic database options
            // ======================



            C.DbPath     = _DbPath;
            C.savetodb   = true;
            C.saveperiod = 300;

            C.Tags.Add("OscillatingCylinder");
            C.Tags.Add("k" + k);

            if (movingMesh)
            {
                C.ProjectDescription = "OscillatingCylinder_k" + k + "_MM";
                C.ProjectName        = "OscillatingCylinder_k" + k + "_MM";
                C.SessionName        = "OscillatingCylinder_k" + k + "_MM";
                C.Tags.Add("MM");
            }
            else
            {
                C.ProjectDescription = "OscillatingCylinder_k" + k + "_SP";
                C.ProjectName        = "OscillatingCylinder_k" + k + "_SP";
                C.SessionName        = "OscillatingCylinder_k" + k + "_SP";
                C.Tags.Add("SP");
            }

            // DG degrees
            // ==========

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

            // grid and boundary conditions
            // ============================

            //C.GridFunc = delegate {



            //    var _xNodes1 = Grid1D.TanhSpacing(-6.17, -1, Convert.ToInt32(15 * MeshFactor), 2.1, false); //15
            //    _xNodes1 = _xNodes1.GetSubVector(0, (_xNodes1.Length - 1));
            //    var _xNodes2 = GenericBlas.Linspace(-1, 1.5, Convert.ToInt32(50 * MeshFactor)); //50
            //    _xNodes2 = _xNodes2.GetSubVector(0, (_xNodes2.Length - 1));
            //    var _xNodes3 = Grid1D.TanhSpacing(1.5, 20.5, Convert.ToInt32(50 * MeshFactor), 2, true); //50

            //    var xNodes = ArrayTools.Cat(_xNodes1, _xNodes2, _xNodes3);


            //    var _yNodes1 = Grid1D.TanhSpacing(-13.3, -1.2, Convert.ToInt32(15 * MeshFactor), 2.5, false); //15
            //    _yNodes1 = _yNodes1.GetSubVector(0, (_yNodes1.Length - 1));
            //    var _yNodes2 = GenericBlas.Linspace(-1.2, 1.2, Convert.ToInt32(40 * MeshFactor)); //40
            //    _yNodes2 = _yNodes2.GetSubVector(0, (_yNodes2.Length - 1));
            //    var _yNodes3 = Grid1D.TanhSpacing(1.2, 13.3, Convert.ToInt32(15 * MeshFactor), 2.5, true); //15

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

            //    //double[] xNodes = GenericBlas.Linspace(-6.17, 20.5, 50);
            //    //double[] yNodes = GenericBlas.Linspace(-13.3, 13.3, 50);
            //    var grd = Grid2D.Cartesian2DGrid(xNodes, yNodes, periodicX: xPeriodic);
            //    grd.EdgeTagNames.Add(1, "Velocity_Inlet_lower");
            //    grd.EdgeTagNames.Add(2, "Velocity_Inlet_upper");
            //    if (!xPeriodic) {
            //        grd.EdgeTagNames.Add(3, "Velocity_Inlet_left");
            //        grd.EdgeTagNames.Add(4, "Pressure_Outlet_right");
            //    }
            //    //grd.EdgeTagNames.Add(1, "Outflow_lower");
            //    //grd.EdgeTagNames.Add(2, "Outflow_upper");
            //    //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] - (-13.3)) <= 1.0e-8)
            //            et = 1;
            //        if (Math.Abs(X[1] + (-13.3)) <= 1.0e-8)
            //            et = 2;
            //        if (!xPeriodic && Math.Abs(X[0] - (-6.17)) <= 1.0e-8)
            //            et = 3;
            //        if (!xPeriodic && Math.Abs(X[0] + (-20.5)) <= 1.0e-8)
            //            et = 4;


            //        Debug.Assert(et != 0);
            //        return et;
            //    });

            //    Console.WriteLine("Cells:    {0}", grd.NumberOfCells);

            //    return grd;
            //};

            C.GridFunc = delegate
            {
                int q2 = new int();
                int r2 = new int();
                int q3 = new int();
                int r3 = new int();

                switch (k)
                {
                case 1:
                    q2 = 35;
                    r2 = 25;
                    q3 = 105;
                    r3 = 75;
                    break;

                case 2:
                    q2 = 28;
                    r2 = 20;
                    q3 = 64;
                    r3 = 48;
                    break;

                case 3:
                    q2 = 21;
                    r2 = 15;
                    q3 = 39;
                    r3 = 36;
                    break;

                default:

                    throw new ApplicationException();
                }

                // Box1
                var box1_p1 = new double[2] {
                    -6.17, -13.3
                };
                var box1_p2 = new double[2] {
                    20.5, 13.3
                };
                var box1 = new GridCommons.GridBox(box1_p1, box1_p2, 15, 15); //k1: ; k2: 15,15; k3: 15,15

                // Box2
                var box2_p1 = new double[2] {
                    -2, -4
                };
                var box2_p2 = new double[2] {
                    10, 4
                };
                var box2 = new GridCommons.GridBox(box2_p1, box2_p2, q2, r2); //k1: 35,25 ; k2: 28,20; k3: 21, 15


                // Box3
                var box3_p1 = new double[2] {
                    -1.5, -2.5
                };
                var box3_p2 = new double[2] {
                    6, 2.5
                };
                var box3 = new GridCommons.GridBox(box3_p1, box3_p2, q3, r3); //k1: 105, 75 ; k2: 64,48; k3: 39, 36

                var grd = Grid2D.HangingNodes2D(box1, box2, box3);

                grd.EdgeTagNames.Add(1, "Pressure_Outlet_lower");
                grd.EdgeTagNames.Add(2, "Pressure_Outlet_upper");
                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] - (-13.3)) <= 1.0e-8)
                    {
                        et = 1;
                    }
                    if (Math.Abs(X[1] + (-13.3)) <= 1.0e-8)
                    {
                        et = 2;
                    }
                    if (!xPeriodic && Math.Abs(X[0] - (-6.17)) <= 1.0e-8)
                    {
                        et = 3;
                    }
                    if (!xPeriodic && Math.Abs(X[0] + (-20.5)) <= 1.0e-8)
                    {
                        et = 4;
                    }


                    // Debug.Assert(et != 0);
                    return(et);
                });

                Console.WriteLine("Cells:    {0}", grd.NumberOfCells);

                return(grd);
            };


            C.AddBoundaryValue("Pressure_Outlet_lower");
            C.AddBoundaryValue("Pressure_Outlet_upper");
            if (!xPeriodic)
            {
                C.AddBoundaryValue("Velocity_Inlet_left", "VelocityX", X => 1);
            }
            C.AddBoundaryValue("Pressure_Outlet_right");

            //C.AddBoundaryCondition("Outflow_lower");
            //C.AddBoundaryCondition("Outflow_upper");
            //if (!xPeriodic)
            //{
            //    C.AddBoundaryCondition("Velocity_Inlet_left", "VelocityX#A", X => 1);
            //}
            //C.AddBoundaryCondition("Pressure_Outlet_right");

            // Level-Set Movement
            // ===================

            double radius = 0.5;

            C.includeRotation              = false;
            C.includeTranslation           = false;
            C.Timestepper_LevelSetHandling = LevelSetHandling.None;
            C.PhysicalParameters.rho_A     = 1;
            C.PhysicalParameters.mu_A      = 1.0 / 185;


            //C.BoundaryFunc = new Func<double, double>[] { (t) => 0, (t) =>0 };

            //C.BoundaryFunc = new Func<double, double>[] { (t) => 0, (t) => 0.25 * Math.PI * 2 * 0.166 * -Math.Sin(Math.PI * 2 * 0.195 * t) };

            Func <double, double>           yLevSet = t => (0.2 * Math.Cos(Math.PI * 2 * 0.156 * t));
            Func <double[], double, double> phi     = (X, t) => - (X[0]).Pow2() + -(X[1] - yLevSet(t)).Pow2() + radius.Pow2();

            //Func<double[], double, double> phi = (X, t) => -(X[0]).Pow2() + -(X[1]-1).Pow2() + radius.Pow2();
            C.MovementFunc = phi;

            Func <double, double> xVelocity = t => 0;
            Func <double, double> yVelocity = t => (0.2 * Math.PI * 2 * 0.156 * -Math.Sin(Math.PI * 2 * 0.156 * t));

            Func <double, double>[] particleTransVelocity = { xVelocity, yVelocity };
            Func <double, double>[] particleAnglVelocity  = { xVelocity, xVelocity };

            C.transVelocityFunc = particleTransVelocity;
            C.anglVelocityFunc  = particleAnglVelocity;

            // Initial Values
            // ==============

            C.InitialValues_Evaluators.Add("Phi", X => phi(X, 0));
            ////C.InitialValues.Add("Phi", X => -1);

            C.InitialValues_Evaluators.Add("VelocityX", X => 1);
            //C.InitialValues_Evaluators.Add("VelocityX#B", X => 0);
            ////C.InitialValues.Add("VelocityY#A", X => osciVelocity(X, 0));
            //C.InitialValues.Add("VelocityX", delegate (double[] X) {
            //    double x = X[0];
            //    double y = X[1];

            //    double R = Math.Sqrt((x + 1).Pow2() + y.Pow2());

            //    double xVel = 1;

            //    if (R < 0.75) {
            //        xVel = 1;
            //    }
            //    return xVel;
            //});

            ////C.InitialValues.Add("VelocityY", delegate (double[] X)
            ////{
            ////    double x = X[0];
            ////    double y = X[1];

            ////    double R = Math.Sqrt((x + 2).Pow2() + y.Pow2());

            ////    double yVel = 0;

            ////    if (R < 0.75)
            ////    {
            ////        yVel = 1;
            ////    }
            ////    return yVel;
            ////});

            // For restart
            //C.RestartInfo = new Tuple<Guid, TimestepNumber>(new Guid("8bef674a-7e37-45a0-9ee2-81a7f0cd02eb"), 1500);
            //C.GridGuid = new Guid("be76c5d5-010c-41a5-b342-e87b42d9734e");

            // Physical Parameters
            // ===================
            C.PhysicalParameters.IncludeConvection = true;

            // misc. solver options
            // ====================

            C.AdvancedDiscretizationOptions.PenaltySafety = 4;
            C.AdvancedDiscretizationOptions.CellAgglomerationThreshold = 0.2;
            C.LevelSetSmoothing        = false;
            C.MaxKrylovDim             = 20;
            C.MaxSolverIterations      = 100;
            C.VelocityBlockPrecondMode = MultigridOperator.Mode.SymPart_DiagBlockEquilib_DropIndefinite;
            C.NoOfMultigridLevels      = 0;

            // Timestepping
            // ============

            if (movingMesh)
            {
                C.Timestepper_Mode = FSI_Control.TimesteppingMode.MovingMesh;
            }
            else
            {
                C.Timestepper_Mode = FSI_Control.TimesteppingMode.Splitting;
            }
            C.Timestepper_Scheme = IBM_Solver.IBM_Control.TimesteppingScheme.BDF2;
            double dt = 0.1;

            C.dtFixed       = dt;
            C.dtMax         = dt;
            C.dtMin         = dt;
            C.Endtime       = 300;
            C.NoOfTimesteps = 1000000000;

            // haben fertig...
            // ===============

            return(C);
        }