public static void SingleDryParticleAgainstWall([Values(false, true)] bool MeshRefine) { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.Test_SingleDryParticleAgainstWall(MeshRefine: MeshRefine); p.Init(ctrl); p.RunSolverMode(); Vector Dest_Should; if (MeshRefine) { Dest_Should = new Vector(0.0867851149899939, -0.709888525146848); } else { Dest_Should = new Vector(-0.0505473360771058, 0.751747291863557); } Vector Dest_Is = new Vector((double[])p.GetParticles()[0].Motion.GetPosition(0)); double dist = (Dest_Should - Dest_Is).L2Norm(); Console.WriteLine("Particle reached position " + Dest_Is + ", expected at " + Dest_Should + ", distance is " + dist); Assert.Less(dist, 0.1, "Particle to far from expected position"); } }
public static void StickyTrap() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.Test_StickyTrap(); p.Init(ctrl); p.RunSolverMode(); Vector Dest_Should; Dest_Should = new Vector(0.0, 0.0761459999999999); double VelY_Should = 0; Vector Dest_Is = new Vector((double[])p.GetParticles()[0].Motion.GetPosition(0)); double VelY_Is = p.GetParticles()[0].Motion.GetTranslationalVelocity(0)[0]; double dist = (Dest_Should - Dest_Is).L2Norm(); double Vel_Div = Math.Abs(VelY_Should - VelY_Is); Console.WriteLine("Particle reached position " + Dest_Is + ", expected at " + Dest_Should + ", distance is " + dist); Console.WriteLine("Particle end velocitiy " + VelY_Is + ", expected velocity: " + VelY_Should + ", difference is " + Vel_Div); Assert.Less(dist, 0.1, "Particle to far from expected position."); Assert.Less(Vel_Div, 0.05, "Particle is moving."); } }
public static void TestSingleDryParticleAgainstWall([Values(false, true)] bool MeshRefine) { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.TestSingleDryParticleAgainstWall(MeshRefine); p.Init(ctrl); p.RunSolverMode(); Vector Dest_Should; if (MeshRefine) { Dest_Should = new Vector(0.131345340345127, -0.666402224072296); } else { Dest_Should = new Vector(-0.227966686971282, 0.570983623897469); } Vector Dest_Is = new Vector((double[])p.Particles[0].Motion.GetPosition(0)); double dist = (Dest_Should - Dest_Is).L2Norm(); Console.WriteLine("Particle reached position " + Dest_Is + ", expected at " + Dest_Should + ", distance is " + dist); Assert.Less(dist, 0.1, "Particle to far from expected position"); } }
public static void SingleDryParticleAgainstWall([Values(false, true)] bool MeshRefine) { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.SingleDryParticleAgainstWall(MeshRefine: MeshRefine); p.Init(ctrl); p.RunSolverMode(); Vector Dest_Should; if (MeshRefine) { Dest_Should = new Vector(0.0899494548876698, -0.711922806999655); } else { Dest_Should = new Vector(-0.0552265430761048, 0.751640173282737); } Vector Dest_Is = new Vector(p.Particles[0].Position[0]); double dist = (Dest_Should - Dest_Is).L2Norm(); Console.WriteLine("Particle reached position " + Dest_Is + ", expected at " + Dest_Should + ", distance is " + dist); Assert.Less(dist, 0.1, "Particle to far from expected position"); } }
public static void TestFlowRotationalCoupling() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.ParticleInShearFlow(k: 1); p.Init(ctrl); p.RunSolverMode(); double angularVelocity_Sol = 0.00487; double angularVelocity = (double)p.QueryHandler.QueryResults["Angular_Velocity"]; double diff_Velocity = Math.Abs(angularVelocity - angularVelocity_Sol); Assert.LessOrEqual(diff_Velocity, 0.00025); } }
public static void Test_HydrodynamicForces() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = HardcodedTestExamples.Test_HydrodynamicForces(); p.Init(ctrl); p.RunSolverMode(); double ForcesSoll = 5.53747893542498; double Forces = p.GetParticles()[0].Motion.GetHydrodynamicForces(0)[0]; double DiffForces = Math.Abs(ForcesSoll - Forces); Assert.LessOrEqual(DiffForces, 1e-3); } }
public static void Test_HydrodynamicForces() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = HardcodedTestExamples.Test_HydrodynamicForces(); p.Init(ctrl); p.RunSolverMode(); double ForcesSoll = 12.471222692466; double Forces = p.Particles[0].HydrodynamicForces[0][0]; double DiffForces = Math.Abs(ForcesSoll - Forces); Assert.LessOrEqual(DiffForces, 1e-3); } }
public static void Test_ActiveForce() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = HardcodedTestExamples.Test_ActiveForce(); p.Init(ctrl); p.RunSolverMode(); double ForcesSoll = 11129.7411681657; double Forces = p.Particles[0].HydrodynamicForces[0][0]; double DiffForces = Math.Abs(ForcesSoll - Forces); Assert.LessOrEqual(DiffForces, 20); } }
public static void TestParticleInShearFlow() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = HardcodedTestExamples.TestParticleInShearFlow(k: 2); p.Init(ctrl); p.RunSolverMode(); double angularVelocitySol = -0.00732081626486242; double angularVelocityIs = p.Particles[0].Motion.GetRotationalVelocity(0); double diff_Velocity = Math.Abs(angularVelocityIs - angularVelocitySol); Console.WriteLine(" angular velocity is " + angularVelocityIs); Console.WriteLine(" should be " + angularVelocitySol); Console.WriteLine(" difference is " + diff_Velocity); Assert.LessOrEqual(diff_Velocity, 0.00025, "Error in expected angular velocity is to high"); } }
public static void DryParticleBounce() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.Test_DryParticleBounce(); p.Init(ctrl); p.RunSolverMode(); Vector Dest_Should; Dest_Should = new Vector(0.0, 0.865886176125762); Vector Dest_Is = new Vector((double[])p.GetParticles()[0].Motion.GetPosition(0)); double dist = (Dest_Should - Dest_Is).L2Norm(); Console.WriteLine("Particle reached position " + Dest_Is + ", expected at " + Dest_Should + ", distance is " + dist); Assert.Less(dist, 0.1, "Particle to far from expected position"); } }
public static void PeriodicTest() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = HardcodedTestExamples.TestPeriodicBoundaries(); p.Init(ctrl); p.RunSolverMode(); Vector[] expectedPosition = new Vector[4]; expectedPosition[0] = new Vector(0.8, -0.8); expectedPosition[1] = new Vector(-1.2, -0.8); expectedPosition[2] = new Vector(-1.2, 1.2); expectedPosition[3] = new Vector(0.8, 1.2); double distanceL2 = 0; for (int i = 0; i < 4; i++) { distanceL2 += (expectedPosition[i] - p.Particles[i].Motion.GetPosition(0)).L2Norm(); } Assert.Less(distanceL2, 0.1, "Particle to far from expected position."); } }
public static void DryParticleBounce() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.DryParticleBounce(); p.Init(ctrl); p.RunSolverMode(); Vector Dest_Should; Dest_Should = new Vector(0.0, 0.7995941200205); Vector Dest_Is = new Vector(p.Particles[0].Position[0]); double dist = (Dest_Should - Dest_Is).L2Norm(); Console.WriteLine("Particle reached position " + Dest_Is + ", expected at " + Dest_Should + ", distance is " + dist); Assert.Less(dist, 0.1, "Particle to far from expected position"); } }
public static void TestFlowRotationalCoupling() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.Test_ParticleInShearFlow(k: 1); //ctrl.ImmediatePlotPeriod = 1; //ctrl.SuperSampling = 2; p.Init(ctrl); p.RunSolverMode(); double angularVelocity_Sol = 0.00487; double angularVelocity = (double)p.QueryHandler.QueryResults["Angular_Velocity"]; double diff_Velocity = Math.Abs(angularVelocity - angularVelocity_Sol); Console.WriteLine(" angular velocity is " + angularVelocity); Console.WriteLine(" should be " + angularVelocity_Sol); Console.WriteLine(" difference is " + diff_Velocity); Assert.LessOrEqual(diff_Velocity, 0.00025, "Error in expected angular velocity is to high"); } }
public static void Test_ParticleParameter() { using (FSI_SolverMain p = new FSI_SolverMain()) { var ctrl = BoSSS.Application.FSI_Solver.HardcodedTestExamples.Test_ParticleParameter(); //ctrl.ImmediatePlotPeriod = 1; //ctrl.SuperSampling = 2; p.Init(ctrl); p.RunSolverMode(); double p0_area = p.GetParticles()[0].Area; double p0_area_soll = Math.PI; double p0_Mass = p.GetParticles()[0].Motion.Mass_P; double p1_area = p.GetParticles()[1].Area; double diff_Area1 = Math.Abs(p0_area - p0_area_soll); double diff_Area2 = Math.Abs(p0_area - p1_area); double diff_Mass = Math.Abs(2 * p0_area - p0_Mass); Assert.LessOrEqual(diff_Area1, 1e-12, "Error in calculation of particle area"); Assert.LessOrEqual(diff_Area2, 1e-12, "Error in calculation of particle area"); Assert.LessOrEqual(diff_Mass, 1e-12, "Error in calculation of particle mass"); } }