private static IBMControl ControlCutNextToCut(bool agglomeration) { IBMControl c = new IBMControl(); c.savetodb = false; int dgDegree = 2; double vortexSpeed = 1.0; // IBM Settings c.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.Classic; c.LevelSetQuadratureOrder = 5; c.AgglomerationThreshold = agglomeration ? 0.3 : 0.0; c.DomainType = DomainTypes.StaticImmersedBoundary; c.ActiveOperators = Operators.Convection; c.ConvectiveFluxType = ConvectiveFluxTypes.Rusanov; c.ExplicitScheme = ExplicitSchemes.RungeKutta; c.ExplicitOrder = 1; c.EquationOfState = IdealGas.Air; c.MachNumber = 1 / Math.Sqrt(c.EquationOfState.HeatCapacityRatio); c.AddVariable(Variables.Density, dgDegree); c.AddVariable(Variables.Momentum.xComponent, dgDegree); c.AddVariable(Variables.Momentum.yComponent, dgDegree); c.AddVariable(Variables.Energy, dgDegree); c.AddVariable(IBMVariables.LevelSet, 2); c.GridFunc = delegate { GridCommons grid = Grid2D.Cartesian2DGrid( GenericBlas.Linspace(-5.0, 5.0, 21), GenericBlas.Linspace(-0.5, 0.5, 3)); grid.EdgeTagNames.Add(1, "supersonicInlet"); grid.DefineEdgeTags(X => 1); return(grid); }; c.LevelSetBoundaryTag = "supersonicInlet"; IsentropicVortexExactSolution solution = new IsentropicVortexExactSolution(c, vortexSpeed); c.InitialValues_Evaluators.Add(Variables.Density, X => solution.rho()(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Velocity.xComponent, X => solution.u()(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Velocity.yComponent, X => solution.v()(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Pressure, X => solution.p()(X, 0.0)); if (agglomeration) { c.LevelSetFunction = (X, t) => - ((X[1] - 0.17) * (X[1] - 0.17) - 0.1); } else { c.LevelSetFunction = (X, t) => - (X[1] * X[1] - 0.2); } c.AddBoundaryValue("supersonicInlet", Variables.Density, solution.rho()); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[0], solution.u()); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[1], solution.v()); c.AddBoundaryValue("supersonicInlet", Variables.Pressure, solution.p()); c.Queries.Add("L2ErrorDensity", IBMQueries.L2Error(Variables.Density, solution.rho())); c.Queries.Add("L2ErrorPressure", IBMQueries.L2Error(state => state.Pressure, solution.p())); c.Queries.Add("L2ErrorEntropy", IBMQueries.L2Error(state => state.Entropy, (X, t) => 1.0)); c.dtMin = 0.0; c.dtMax = 1.0; c.CFLFraction = 0.2; c.Endtime = double.MaxValue; c.NoOfTimesteps = 100; return(c); }
public static IBMControl PistonControl(int dgDegree, int rkDegree, ConvectiveFluxTypes convectiveFlux, TimesteppingStrategies timeSteppingStrategy, double agglomerationThreshold) { double pistonVelocity = 1.0; double initialLevelSetPosition = 0.1; //double initialLevelSetPosition = 0.5; IBMControl c = new IBMControl(); c.DbPath = null; c.savetodb = false; c.ProjectName = "Piston"; c.ProjectDescription = "Vertical moving at flow velocity through constant flow field"; c.DomainType = DomainTypes.MovingImmersedBoundary; c.ActiveOperators = Operators.Convection; c.ConvectiveFluxType = convectiveFlux; c.EquationOfState = IdealGas.Air; c.MachNumber = 1.0 / Math.Sqrt(c.EquationOfState.HeatCapacityRatio); c.TimesteppingStrategy = timeSteppingStrategy; c.ExplicitScheme = ExplicitSchemes.RungeKutta; c.ExplicitOrder = rkDegree; c.AddVariable(Variables.Density, dgDegree); c.AddVariable(Variables.Momentum.xComponent, dgDegree); c.AddVariable(Variables.Momentum.yComponent, dgDegree); c.AddVariable(Variables.Energy, dgDegree); c.AddVariable(IBMVariables.LevelSet, 1); c.GridFunc = delegate { double[] xNodes = GenericBlas.Linspace(0.0, 2.0, 4); double[] yNodes = GenericBlas.Linspace(-1.0, 1.0, 4); var grid = Grid2D.Cartesian2DGrid(xNodes, yNodes, periodicX: false, periodicY: true); grid.EdgeTagNames.Add(1, "adiabaticSlipWall"); grid.EdgeTagNames.Add(2, "supersonicInlet"); grid.DefineEdgeTags(X => 2); return(grid); }; c.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.Classic; c.LevelSetQuadratureOrder = 10; c.LevelSetBoundaryTag = "adiabaticSlipWall"; c.AgglomerationThreshold = agglomerationThreshold; c.InitialValues_Evaluators.Add(Variables.Density, X => 1.0); c.InitialValues_Evaluators.Add(Variables.Velocity.xComponent, X => pistonVelocity); c.InitialValues_Evaluators.Add(Variables.Velocity.yComponent, X => 0.0); c.InitialValues_Evaluators.Add(Variables.Pressure, X => 1.0); c.LevelSetFunction = delegate(double[] X, double time) { double newLevelSetPosition = initialLevelSetPosition + pistonVelocity * time; return(X[0] - newLevelSetPosition); }; c.LevelSetVelocity = (X, t) => new Vector(pistonVelocity, 0.0); c.AddBoundaryValue("adiabaticSlipWall", Variables.Velocity.xComponent, X => pistonVelocity); c.AddBoundaryValue("adiabaticSlipWall", Variables.Velocity.yComponent, X => 0.0); c.AddBoundaryValue("supersonicInlet", Variables.Density, X => 1.0); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[0], X => pistonVelocity); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[1], X => 0.0); c.AddBoundaryValue("supersonicInlet", Variables.Pressure, X => 1.0); c.Queries.Add("L2ErrorDensity", IBMQueries.L2Error(Variables.Density, (X, t) => 1.0)); c.Queries.Add("L2ErrorXMomentum", IBMQueries.L2Error(Variables.Momentum.xComponent, (X, t) => 1.0)); c.Queries.Add("L2ErrorYMomentum", IBMQueries.L2Error(Variables.Momentum.yComponent, (X, t) => 0.0)); c.Queries.Add("L2ErrorPressure", IBMQueries.L2Error(state => state.Pressure, (X, t) => 1.0)); c.dtMin = 0.0; c.dtMax = 1.0; c.CFLFraction = 0.1; c.Endtime = 0.75; c.NoOfTimesteps = int.MaxValue; return(c); }
private static IBMControl ControlTemplate(int dgDegree, int divisions, double levelSetPosition) { IBMControl c = new IBMControl(); c.savetodb = false; double vortexSpeed = 1.0; c.DomainType = DomainTypes.StaticImmersedBoundary; c.ActiveOperators = Operators.Convection; c.ConvectiveFluxType = ConvectiveFluxTypes.Rusanov; c.ExplicitScheme = ExplicitSchemes.RungeKutta; c.ExplicitOrder = 1; c.EquationOfState = IdealGas.Air; c.MachNumber = 1.0 / Math.Sqrt(c.EquationOfState.HeatCapacityRatio); c.AddVariable(Variables.Density, dgDegree); c.AddVariable(Variables.Momentum.xComponent, dgDegree); c.AddVariable(Variables.Momentum.yComponent, dgDegree); c.AddVariable(Variables.Energy, dgDegree); c.AddVariable(IBMVariables.LevelSet, 1); c.GridFunc = delegate { int noOfCellsPerDirection = (2 << divisions) * 10; GridCommons grid = Grid2D.Cartesian2DGrid( GenericBlas.Linspace(-10.0, 10.0, noOfCellsPerDirection + 1), GenericBlas.Linspace(-10.0, 10.0, noOfCellsPerDirection + 1)); grid.EdgeTagNames.Add(1, "supersonicInlet"); grid.DefineEdgeTags(X => 1); return(grid); }; c.LevelSetBoundaryTag = "supersonicInlet"; IsentropicVortexExactSolution solution = new IsentropicVortexExactSolution(c, vortexSpeed); c.InitialValues_Evaluators.Add(Variables.Density, X => solution.rho()(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Velocity.xComponent, X => solution.u()(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Velocity.yComponent, X => solution.v()(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Pressure, X => solution.p()(X, 0.0)); c.LevelSetFunction = (X, t) => X[1] - levelSetPosition; c.AddBoundaryValue("supersonicInlet", Variables.Density, solution.rho()); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[0], solution.u()); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[1], solution.v()); c.AddBoundaryValue("supersonicInlet", Variables.Pressure, solution.p()); c.Queries.Add("L2ErrorDensity", IBMQueries.L2Error(Variables.Density, solution.rho())); c.Queries.Add("L2ErrorPressure", IBMQueries.L2Error(state => state.Pressure, solution.p())); c.Queries.Add("L2ErrorEntropy", IBMQueries.L2Error(state => state.Entropy, (X, t) => 1.0)); c.dtMin = 0.0; c.dtMax = 1.0; c.CFLFraction = 0.2; c.Endtime = 0.5; c.NoOfTimesteps = 100; return(c); }
public static IBMControl IBMNACA0012(int MeshPara, int dgDegree, double CFL, double agglomeration, double alpha) { IBMControl c = new IBMControl(); c.savetodb = true; // Solver Settings c.dtMin = 0.0; c.dtMax = 1.0; c.Endtime = 1000.0; c.CFLFraction = CFL; c.NoOfTimesteps = 200000; c.PrintInterval = 10; c.ResidualInterval = 100; c.ResidualLoggerType = ResidualLoggerTypes.ChangeRate | ResidualLoggerTypes.Query; c.ResidualBasedTerminationCriteria.Add("changeRate_L2_abs_rhoE", 1E-8); //IBM Settings c.LevelSetBoundaryTag = "adiabaticSlipWall"; c.LevelSetQuadratureOrder = 2 * dgDegree + 2; c.AgglomerationThreshold = agglomeration; // NEXT STEP: SET THIS BOOL TO FALSE AND JUST USE IN POSITIVE SUB_VOLUME; // THEN TRY BOUNDING BOX APPROACH? // WHY THE HELL DOES THIS CONFIGURATION FAIL!??!?!?!? c.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.Classic; c.SurfaceHMF_ProjectNodesToLevelSet = false; c.SurfaceHMF_RestrictNodes = true; c.SurfaceHMF_UseGaussNodes = false; c.VolumeHMF_NodeCountSafetyFactor = 3.0; c.VolumeHMF_RestrictNodes = true; c.VolumeHMF_UseGaussNodes = false; //Guid restart = new Guid("cd061fe3-3215-483a-8790-f6fd686d6676"); //c.RestartInfo = new Tuple<Guid, BoSSS.Foundation.IO.TimestepNumber>(restart, -1); // Session Settings c.DbPath = @"\\fdyprime\userspace\kraemer-eis\FDY-Cluster\dbe_NACA\"; //c.DbPath = @"C:\bosss_dbv2\NACA0012"; c.savetodb = true; c.saveperiod = 10000; c.ProjectName = "MeshPara:" + MeshPara + "_CFL=" + c.CFLFraction + "_p=" + dgDegree + "_agg=" + c.AgglomerationThreshold + "_alpha=" + alpha + "_HMF=" + c.CutCellQuadratureType; c.ProjectDescription = "NACA0012 Steady Test with Ma=0.5"; c.Tags.Add("NACA0012"); c.Tags.Add("IBM Test"); c.Tags.Add("steady"); // Solver Type c.DomainType = DomainTypes.StaticImmersedBoundary; c.ActiveOperators = Operators.Convection; c.ConvectiveFluxType = ConvectiveFluxTypes.OptimizedHLLC; // Time-Stepping Settings c.ExplicitScheme = ExplicitSchemes.RungeKutta; c.ExplicitOrder = 1; //Material Settings c.EquationOfState = IdealGas.Air; // Primary Variables c.AddVariable(Variables.Density, dgDegree); c.AddVariable(Variables.Momentum.xComponent, dgDegree); c.AddVariable(Variables.Momentum.yComponent, dgDegree); c.AddVariable(Variables.Energy, dgDegree); c.AddVariable(IBMVariables.LevelSet, 8); // Refined Region double xBegin = -0.012; double xEnd = 1.01; c.GridFunc = delegate { int chords = 100; int xleft = -chords; int xRight = chords; int yBottom = -chords; int yTop = chords; double spacingFactor = 3.95; double[] xnodes1 = Grid1D.TanhSpacing(xleft, xBegin, MeshPara + 1, spacingFactor, false); double[] xnodes2 = Grid1D.TanhSpacing_DoubleSided(xBegin, xEnd, MeshPara + 1, 2.0); double[] xnodes3 = Grid1D.TanhSpacing(xEnd, xRight, MeshPara + 1, spacingFactor, true); double[] xComplete = new double[xnodes1.Length + xnodes2.Length + xnodes3.Length - 2]; for (int i = 0; i < xnodes1.Length; i++) { xComplete[i] = xnodes1[i]; } for (int i = 1; i < xnodes2.Length; i++) { xComplete[i + xnodes1.Length - 1] = xnodes2[i]; } for (int i = 1; i < xnodes3.Length; i++) { xComplete[i + xnodes1.Length + xnodes2.Length - 2] = xnodes3[i]; } double yrefinedTop = 0.2; double yrefinedBottom = -0.2; double[] ynodes1 = Grid1D.TanhSpacing(yBottom, yrefinedBottom, MeshPara + 1, spacingFactor, false); double[] ynodes2 = GenericBlas.Linspace(yrefinedBottom, yrefinedTop, (int)(0.75 * MeshPara) + 1); double[] ynodes3 = Grid1D.TanhSpacing(yrefinedTop, yTop, MeshPara + 1, spacingFactor, true); double[] yComplete = new double[ynodes1.Length + ynodes2.Length + ynodes3.Length - 2]; for (int i = 0; i < ynodes1.Length; i++) { yComplete[i] = ynodes1[i]; } for (int i = 1; i < ynodes2.Length; i++) { yComplete[i + ynodes1.Length - 1] = ynodes2[i]; } for (int i = 1; i < ynodes3.Length; i++) { yComplete[i + ynodes1.Length + ynodes2.Length - 2] = ynodes3[i]; } int numOfCellsX = (xRight - xleft) * MeshPara; int numOfCellsY = (yTop - yBottom) * MeshPara; GridCommons grid = Grid2D.Cartesian2DGrid( xComplete, yComplete ); grid.EdgeTagNames.Add(1, "supersonicinlet"); grid.DefineEdgeTags(x => 1); grid.Name = "[" + xleft + "," + xRight + "]x[" + yBottom + "," + yTop + "]_Cells:(" + (xComplete.Length - 1) + "x" + (yComplete.Length - 1) + ")"; return(grid); }; // Functions Func <double[], double, double> rho = (X, t) => 1.0; Func <double[], double, double> u0 = (X, t) => 1.0; Func <double[], double, double> u1 = (X, t) => 0.0; Func <double[], double, double> pressure = (X, t) => 2.8571428571428; Func <double[], double> test = X => 1 - 0.05 * 0.4 / 1.4 * Math.Pow(Math.Exp(1 - X[0] * X[0] - X[1] * X[1]), (1 / 0.4)); Func <double[], double, double> levelSet = delegate(double[] X, double t) { double value = 0.0; double radian = alpha * Math.PI / 180; double xRotated = 1 + Math.Cos(radian) * (X[0] - 1) - Math.Sin(radian) * (X[1]); double yRotated = Math.Sin(radian) * (X[0] - 1) + Math.Cos(radian) * (X[1]); double a = 0.6; //double b = 0.2969; double c1 = 0.126; double d = 0.3516; double e = 0.2843; double f = 0.1036; if (yRotated >= 0.0 || (X[0] > 0.562875 && X[1] > 0)) { //if (yRotated >= 0.0 ){ value = Math.Pow((yRotated + a * (c1 * xRotated + d * Math.Pow(xRotated, 2) - e * Math.Pow(xRotated, 3) + f * Math.Pow(xRotated, 4))), 2) - 0.0317338596 * xRotated; } else { value = Math.Pow((-yRotated + a * (c1 * xRotated + d * Math.Pow(xRotated, 2) - e * Math.Pow(xRotated, 3) + f * Math.Pow(xRotated, 4))), 2) - 0.0317338596 * xRotated; } //value = yRotated - Math.Tan(radian)*xRotated; return(value); }; c.LevelSetFunction = levelSet; //Initial Values c.InitialValues_Evaluators.Add(Variables.Density, X => rho(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Velocity.xComponent, X => u0(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Velocity.yComponent, X => u1(X, 0.0)); c.InitialValues_Evaluators.Add(Variables.Pressure, X => pressure(X, 0.0)); //BoundaryConditions c.AddBoundaryValue("adiabaticSlipWall"); c.AddBoundaryValue("supersonicInlet", Variables.Density, rho); c.AddBoundaryValue("supersonicInlet", Variables.Velocity.xComponent, u0); c.AddBoundaryValue("supersonicInlet", Variables.Velocity.yComponent, u1); c.AddBoundaryValue("supersonicInlet", Variables.Pressure, pressure); // Queries c.Queries.Add("L2ErrorEntropy", IBMQueries.L2Error(state => state.Entropy, (X, t) => 2.8571428571428)); c.Queries.Add("IBMDragForce", IBMQueries.IBMDragForce()); c.Queries.Add("IBMLiftForce", IBMQueries.IBMLiftForce()); return(c); }
private static IBMControl CylinderControl(int dgDegree, double endTime) { string dbPath = @"..\..\Tests\IBMTests\IBMCylinderTests.zip"; double Mach = 0.2; double agglomerationThreshold = 0.3; int gridSize = 64; var restartData = new Dictionary <int, Tuple <Guid, Guid, Guid> >() { { 0, Tuple.Create(new Guid("ae64096b-bab4-4f63-a2cd-99f5920a11e3"), new Guid("486113d4-e700-4bdb-9f92-38a15bac5388"), new Guid("6adec616-275a-444d-86ad-1b2bc8b8cd65")) }, { 1, Tuple.Create(new Guid("083a99ee-af0b-4948-bd0f-1f972b551b99"), new Guid("4f4e6e60-953a-43c3-b062-c4750ab0ab71"), new Guid("d0615daf-6980-4ecf-af3f-e803877fc29b")) }, { 2, Tuple.Create(new Guid("d102c10a-0ef2-417e-af1b-4ffad5ea4fe3"), new Guid("f67d08be-3ede-4d74-9a40-829071b44e6b"), new Guid("dfe950aa-9a6b-43d4-b046-e5dd61cc67f3")) }, { 3, Tuple.Create(new Guid("f45e8802-4e78-45b5-9aac-c155c532b6a3"), new Guid("e670a74f-efb7-41d6-959c-28289e66904e"), new Guid("02e3f737-3f03-4b5a-9387-109dd0f4ec06")) } }; IBMControl c = new IBMControl(); c.DbPath = dbPath; c.savetodb = false; int levelSetQuadratureOrder = 2 * dgDegree + 2; // kind-of-fix c.ProjectName = String.Format("IBM cylinder: {0} cells, order {1}", gridSize, dgDegree); c.ProjectDescription = String.Format( "Flow around cylinder represented by a level set at Mach {0}" + " with cell agglomeration threshold {1} and {2}th order" + " HMF quadrature (classic variant)", Mach, agglomerationThreshold, levelSetQuadratureOrder); c.Tags.Add("Cylinder"); c.Tags.Add("IBM"); c.Tags.Add("Agglomeration"); c.DomainType = DomainTypes.StaticImmersedBoundary; c.ActiveOperators = Operators.Convection; c.ConvectiveFluxType = ConvectiveFluxTypes.OptimizedHLLC; c.ExplicitScheme = ExplicitSchemes.RungeKutta; c.ExplicitOrder = 1; c.EquationOfState = IdealGas.Air; c.MachNumber = 1.0 / Math.Sqrt(c.EquationOfState.HeatCapacityRatio); c.AddVariable(Variables.Density, dgDegree); c.AddVariable(Variables.Momentum.xComponent, dgDegree); c.AddVariable(Variables.Momentum.yComponent, dgDegree); c.AddVariable(Variables.Energy, dgDegree); c.AddVariable(IBMVariables.LevelSet, 2); var sessionAndGridGuid = restartData[dgDegree]; c.RestartInfo = new Tuple <Guid, TimestepNumber>(sessionAndGridGuid.Item1, -1); c.GridGuid = sessionAndGridGuid.Item2; c.GridPartType = GridPartType.METIS; c.GridPartOptions = "5"; double gamma = c.EquationOfState.HeatCapacityRatio; c.AddBoundaryValue("supersonicInlet", Variables.Density, (X, t) => 1.0); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[0], (X, t) => Mach * Math.Sqrt(gamma)); c.AddBoundaryValue("supersonicInlet", Variables.Velocity[1], (X, t) => 0.0); c.AddBoundaryValue("supersonicInlet", Variables.Pressure, (X, t) => 1.0); c.AddBoundaryValue("adiabaticSlipWall"); c.LevelSetBoundaryTag = "adiabaticSlipWall"; c.Queries.Add("L2ErrorEntropy", IBMQueries.L2Error(state => state.Entropy, (X, t) => 1.0)); c.Queries.Add("L2ErrorDensity", QueryLibrary.L2Error(Variables.Density, sessionAndGridGuid.Item3)); c.Queries.Add("L2ErrorXMomentum", QueryLibrary.L2Error(Variables.Momentum[0], sessionAndGridGuid.Item3)); c.Queries.Add("L2ErrorYMomentum", QueryLibrary.L2Error(Variables.Momentum[1], sessionAndGridGuid.Item3)); c.Queries.Add("L2ErrorEnergy", QueryLibrary.L2Error(Variables.Energy, sessionAndGridGuid.Item3)); c.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.OneStepGaussAndStokes; c.SurfaceHMF_ProjectNodesToLevelSet = false; c.SurfaceHMF_RestrictNodes = true; c.SurfaceHMF_UseGaussNodes = false; c.VolumeHMF_NodeCountSafetyFactor = 5.0; c.VolumeHMF_RestrictNodes = true; c.VolumeHMF_UseGaussNodes = false; c.LevelSetQuadratureOrder = levelSetQuadratureOrder; c.AgglomerationThreshold = agglomerationThreshold; c.dtMin = 0.0; c.dtMax = 1.0; c.CFLFraction = 0.3; c.Endtime = endTime; c.NoOfTimesteps = int.MaxValue; c.PrintInterval = 1; c.ResidualLoggerType = ResidualLoggerTypes.None; c.Paramstudy_CaseIdentification = new Tuple <string, object>[] { new Tuple <string, object>("dgDegree", dgDegree), }; return(c); }
public static IBMControl IBMBump(int noOfCells, int dgDegree, int lsDegree, double CFL, double epsilonX = 0.0, double epsilonY = 0.0) { IBMControl c = new IBMControl(); // Solver Settings c.dtMin = 0.0; c.dtMax = 1.0; c.Endtime = 1000.0; c.CFLFraction = CFL; c.NoOfTimesteps = 200000; c.PrintInterval = 100; c.ResidualInterval = 100; c.ResidualLoggerType = ResidualLoggerTypes.ChangeRate | ResidualLoggerTypes.Query; c.ResidualBasedTerminationCriteria.Add("changeRate_L2_abs_rhoE", 1E-8); //IBM Settings c.LevelSetBoundaryTag = "adiabaticSlipWall"; c.LevelSetQuadratureOrder = 2 * dgDegree; c.AgglomerationThreshold = 0.3; // NEXT STEP: SET THIS BOOL TO FALSE AND JUST USE IN POSITIVE SUB_VOLUME; // THEN TRY BOUNDING BOX APPROACH? // WHY THE HELL DOES THIS CONFIGURATION FAIL!??!?!?!? c.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.Classic; c.SurfaceHMF_ProjectNodesToLevelSet = false; c.SurfaceHMF_RestrictNodes = true; c.SurfaceHMF_UseGaussNodes = false; c.VolumeHMF_NodeCountSafetyFactor = 3.0; c.VolumeHMF_RestrictNodes = true; c.VolumeHMF_UseGaussNodes = false; //Guid restart = new Guid(" 60688cbc-707d-4777-98e6-d237796ec14c"); //c.RestartInfo = new Tuple<Guid, BoSSS.Foundation.IO.TimestepNumber>(restart, -1); // Session Settings c.DbPath = @"\\fdyprime\userspace\kraemer-eis\FDY-Cluster\dbe_bump\"; //c.DbPath = @"/home/kraemer/GaussianBump/dbev2/"; c.savetodb = true; c.saveperiod = 20000; c.ProjectName = "BoxHMF=" + c.CutCellQuadratureType + "_Ma=0.5_(" + 2 * noOfCells + "x" + noOfCells + ")_CFL=" + c.CFLFraction + "_lsQuadOrder=" + c.LevelSetQuadratureOrder + "_p=" + dgDegree + "_agg=" + c.AgglomerationThreshold + "_epsX=" + epsilonX + "_epsY=" + epsilonY; c.ProjectDescription = "GaussianBump with Ma=0.5"; c.Tags.Add("Gaussian Bump"); c.Tags.Add("IBM Test"); // Solver Type c.DomainType = DomainTypes.StaticImmersedBoundary; c.ActiveOperators = Operators.Convection; c.ConvectiveFluxType = ConvectiveFluxTypes.OptimizedHLLC; // Time-Stepping Settings c.ExplicitScheme = ExplicitSchemes.RungeKutta; c.ExplicitOrder = 1; //Material Settings c.EquationOfState = IdealGas.Air; // Primary CNSVariables c.AddVariable(CompressibleVariables.Density, dgDegree); c.AddVariable(CompressibleVariables.Momentum.xComponent, dgDegree); c.AddVariable(CompressibleVariables.Momentum.yComponent, dgDegree); c.AddVariable(CompressibleVariables.Energy, dgDegree); c.AddVariable(IBMVariables.LevelSet, lsDegree); // Grid //switch (noOfCells) { // case 8: // c.GridGuid = new Guid("7337e273-542f-4b97-b592-895ac3422621"); // break; // case 16: // c.GridGuid = new Guid("32e5a779-2aef-4ea2-bdef-b158ae785f01"); // break; // case 32: // c.GridGuid = new Guid("e96c9f83-3486-4e45-aa3b-9a436445a059"); // break; // case 64: // c.GridGuid = new Guid("a86f1b67-4fa3-48ed-b6df-dcea370eb2c0"); // break; // default: // throw new ArgumentException("Wrong Grid Input"); //} c.GridFunc = delegate { double xBoundary = 12.0; double yBoundary = 12.0; double yBottom = 0.0; double[] xnodes = GenericBlas.Linspace(-xBoundary, xBoundary, 2 * noOfCells + 1); //double ySplit = 6.0; //int ySplitNoOfCells = (int) (0.5*noOfCells); //double[] ynodes1 = GenericBlas.Linspace(yBottom, ySplit, ySplitNoOfCells + 1); //double[] ynodes2 = GenericBlas.Linspace(ySplit, yBoundary, noOfCells-ySplitNoOfCells + 1); //ynodes1 = ynodes1.GetSubVector(0, ynodes1.Length - 1); //double[] ynodes = ArrayTools.Cat(ynodes1, ynodes2); double[] ynodes = GenericBlas.Linspace(yBottom, yBoundary, noOfCells + 1); GridCommons grid = Grid2D.Cartesian2DGrid( xnodes, ynodes ); grid.EdgeTagNames.Add(1, "supersonicinlet"); grid.EdgeTagNames.Add(2, "adiabaticSlipWall"); Func <double[], byte> func = delegate(double[] x) { if (Math.Abs(x[0] + xBoundary) < 1e-5) // Inflow { return(1); } else if (Math.Abs(x[0] - xBoundary) < 1e-5) // Outflow { return(1); } else if (Math.Abs(x[1] - yBoundary) < 1e-5) // Top { return(1); } else // Bottom { return(2); } }; grid.DefineEdgeTags(func); grid.Name = "IBM-[" + -xBoundary + "," + xBoundary + "]x[" + yBottom + "," + yBoundary + "]_Cells:(" + 2 * noOfCells + "x" + noOfCells + ")"; return(grid); }; // Functions Func <double[], double, double> rho = (X, t) => 1.0; Func <double[], double, double> u0 = (X, t) => 1.0; Func <double[], double, double> u1 = (X, t) => 0.0; Func <double[], double, double> pressure = (X, t) => 2.8571428571428; //Initial Values c.InitialValues_Evaluators.Add(CompressibleVariables.Density, X => rho(X, 0.0)); c.InitialValues_Evaluators.Add(CNSVariables.Velocity.xComponent, X => u0(X, 0.0)); c.InitialValues_Evaluators.Add(CNSVariables.Velocity.yComponent, X => u1(X, 0.0)); c.InitialValues_Evaluators.Add(CNSVariables.Pressure, X => pressure(X, 0.0)); c.LevelSetFunction = (X, t) => X[1] - epsilonY - 0.01 - 0.3939 * Math.Exp(-0.5 * (X[0] - epsilonX) * (X[0] - epsilonX)); //BoundaryConditions c.AddBoundaryValue("adiabaticSlipWall"); c.AddBoundaryValue("supersonicInlet", CompressibleVariables.Density, rho); c.AddBoundaryValue("supersonicInlet", CNSVariables.Velocity.xComponent, u0); c.AddBoundaryValue("supersonicInlet", CNSVariables.Velocity.yComponent, u1); c.AddBoundaryValue("supersonicInlet", CNSVariables.Pressure, pressure); // Queries c.Queries.Add("L2ErrorEntropy", IBMQueries.L2Error(state => state.Entropy, (X, t) => 2.8571428571428)); return(c); }
public static IBMControl IBMBumpTest(int noOfCells, int dgDegree, int lsDegree, double CFL) { IBMControl c = new IBMControl(); // Solver Settings c.dtMin = 0.0; c.dtMax = 1.0; c.Endtime = 1000.0; c.CFLFraction = CFL; c.NoOfTimesteps = 250000; c.PrintInterval = 100; c.ResidualInterval = 100; c.ResidualLoggerType = ResidualLoggerTypes.ChangeRate | ResidualLoggerTypes.Query; c.ResidualBasedTerminationCriteria.Add("changeRate_L2_abs_rhoE", 1E-8); //Guid restart = new Guid(" 60688cbc-707d-4777-98e6-d237796ec14c"); //c.RestartInfo = new Tuple<Guid, BoSSS.Foundation.IO.TimestepNumber>(restart, -1); // Session Settings c.DbPath = @"C:\bosss_dbv2\GaussianBump_hhlr"; //c.DbPath = @"\\fdyprime\userspace\kraemer-eis\FDY-Cluster\dbe_bump\"; //c.DbPath = @"/home/kraemer/GaussianBump/dbev2/"; c.savetodb = true; c.saveperiod = 100; c.ProjectName = "TestsCutCells_(" + 2 * noOfCells + "x" + noOfCells + ")_CFL=" + c.CFLFraction + "_ls=" + lsDegree + "_p=" + dgDegree + "_agg=" + 0.53; c.ProjectDescription = "GaussianBump with Ma=0.5"; c.Tags.Add("Gaussian Bump"); c.Tags.Add("IBM Test"); // Solver Type c.DomainType = DomainTypes.StaticImmersedBoundary; c.ActiveOperators = Operators.Convection; c.ConvectiveFluxType = ConvectiveFluxTypes.OptimizedHLLC; // Time-Stepping Settings c.ExplicitScheme = ExplicitSchemes.RungeKutta; c.ExplicitOrder = 1; //Material Settings c.EquationOfState = IdealGas.Air; //IBM Settings c.LevelSetBoundaryTag = "adiabaticSlipWall"; c.LevelSetQuadratureOrder = 2 * lsDegree; c.CutCellQuadratureType = XQuadFactoryHelper.MomentFittingVariants.Classic; c.AgglomerationThreshold = 0.3; // Primary CNSVariables c.AddVariable(CompressibleVariables.Density, dgDegree); c.AddVariable(CompressibleVariables.Momentum.xComponent, dgDegree); c.AddVariable(CompressibleVariables.Momentum.yComponent, dgDegree); c.AddVariable(CompressibleVariables.Energy, dgDegree); c.AddVariable(IBMVariables.LevelSet, lsDegree); c.GridFunc = delegate { double xBoundary = 2.0625; double yBoundary = 2.0525; double yBottom = -0.01; double[] xnodes = GenericBlas.Linspace(-xBoundary, xBoundary, 2 * noOfCells + 1); double[] ynodes = GenericBlas.Linspace(yBottom, yBoundary, noOfCells + 1); GridCommons grid = Grid2D.Cartesian2DGrid( xnodes, ynodes ); grid.EdgeTagNames.Add(1, "supersonicinlet"); grid.EdgeTagNames.Add(2, "adiabaticSlipWall"); Func <double[], byte> func = delegate(double[] x) { if (Math.Abs(x[0] + xBoundary) < 1e-5) // Inflow { return(1); } else if (Math.Abs(x[0] - xBoundary) < 1e-5) // Outflow { return(1); } else if (Math.Abs(x[1] - yBoundary) < 1e-5) // Top { return(1); } else // Bottom { return(2); } }; grid.DefineEdgeTags(func); grid.Name = "IBM-[" + -xBoundary + "," + xBoundary + "]x[" + yBottom + "," + yBoundary + "]_Cells:(" + 2 * noOfCells + "x" + noOfCells + ")"; return(grid); }; // Functions Func <double[], double, double> rho = (X, t) => 1.0; Func <double[], double, double> u0 = (X, t) => 1.0; Func <double[], double, double> u1 = (X, t) => 0.0; Func <double[], double, double> pressure = (X, t) => 2.8571428571428; //Initial Values c.InitialValues_Evaluators.Add(CompressibleVariables.Density, X => rho(X, 0.0)); c.InitialValues_Evaluators.Add(CNSVariables.Velocity.xComponent, X => u0(X, 0.0)); c.InitialValues_Evaluators.Add(CNSVariables.Velocity.yComponent, X => u1(X, 0.0)); c.InitialValues_Evaluators.Add(CNSVariables.Pressure, X => pressure(X, 0.0)); c.LevelSetFunction = (X, t) => X[1] - 0.3939 * Math.Exp(-0.5 * X[0] * X[0]); //BoundaryConditions c.AddBoundaryValue("adiabaticSlipWall"); c.AddBoundaryValue("supersonicInlet", CompressibleVariables.Density, rho); c.AddBoundaryValue("supersonicInlet", CNSVariables.Velocity.xComponent, u0); c.AddBoundaryValue("supersonicInlet", CNSVariables.Velocity.yComponent, u1); c.AddBoundaryValue("supersonicInlet", CNSVariables.Pressure, pressure); // Queries c.Queries.Add("L2ErrorEntropy", IBMQueries.L2Error(state => state.Entropy, (X, t) => 2.8571428571428)); return(c); }