public static void RunExample() { IAssembly elementsAssembly = CreateAssembly(); elementsAssembly.CreateElementsAssembly(); elementsAssembly.ActivateBoundaryConditions = true; InitialConditions initialValues = new InitialConditions(); initialValues.InitialAccelerationVector = new double[1]; initialValues.InitialDisplacementVector = new double[1]; initialValues.InitialDisplacementVector[0] = 0.2146; initialValues.InitialVelocityVector = new double[1]; initialValues.InitialTime = 0.0; ExplicitSolver newSolver = new ExplicitSolver(1.0, 10); newSolver.Assembler = elementsAssembly; newSolver.InitialValues = initialValues; newSolver.ExternalForcesVector = new double[] { 0.0 }; newSolver.LinearSolver = new LUFactorization(); newSolver.ActivateNonLinearSolution = true; newSolver.SolveExplicit(); newSolver.PrintExplicitSolution(); }
public static void SolveNewmarkExample() { double[,] M = new double[, ] { { 2.0, 0.0 }, { 0.0, 1.0 } }; double[,] K = new double[, ] { { 6.0, -2.0 }, { -2.0, 4.0 } }; double[] F = new double[] { 0.0, 10.0 }; InitialConditions initialValues = new InitialConditions(); initialValues.InitialAccelerationVector = new double[] { 0.0, 10.0 }; initialValues.InitialDisplacementVector = new double[] { 0.0, 0.0 }; initialValues.InitialVelocityVector = new double[] { 0.0, 0.0 }; initialValues.InitialTime = 0.0; ExplicitSolver solver = new ExplicitSolver(2.8, 10); solver.InitialValues = initialValues; solver.CustomMassMatrix = M; solver.CustomStiffnessMatrix = K; solver.CustomDampingMatrix = new double[2, 2]; solver.ExternalForcesVector = F; solver.ActivateNonLinearSolution = false; solver.LinearSolver = new LUFactorization(); solver.SolveNewmark(); solver.PrintExplicitSolution(); }
public static void RunExample() { IAssembly elementsAssembly = CreateAssembly(); elementsAssembly.CreateElementsAssembly(); elementsAssembly.ActivateBoundaryConditions = true; InitialConditions initialValues = new InitialConditions(); initialValues.InitialAccelerationVector = new double[40]; initialValues.InitialDisplacementVector = new double[40]; initialValues.InitialVelocityVector = new double[40]; initialValues.InitialTime = 0.0; ExplicitSolver newSolver = new ExplicitSolver(1.0, 100); newSolver.Assembler = elementsAssembly; Dictionary <int, double> externalLoads = new Dictionary <int, double>() { { 34, -50000.0 }, { 39, 500000.0 } }; newSolver.InitialValues = initialValues; newSolver.ExternalForcesVector = CreateExternalForcesVector(externalLoads); newSolver.LinearSolver = new LUFactorization(); newSolver.ActivateNonLinearSolution = false; newSolver.SolveExplicit(); newSolver.PrintExplicitSolution(); }
public static Results RunExample() { IAssembly elementsAssembly = CreateAssembly(); elementsAssembly.CreateElementsAssembly(); elementsAssembly.ActivateBoundaryConditions = true; InitialConditions initialValues = new InitialConditions(); initialValues.InitialAccelerationVector = new double[] { 0.0, 10.0 }; initialValues.InitialDisplacementVector = new double[] { 0.0, 0.0 }; initialValues.InitialVelocityVector = new double[] { 0.0, 0.0 }; initialValues.InitialTime = 0.0; ExplicitSolver newSolver = new ExplicitSolver(1.0, 10); newSolver.Assembler = elementsAssembly; newSolver.InitialValues = initialValues; newSolver.ExternalForcesVector = new double[] { 50.0, 0 }; newSolver.LinearSolver = new LUFactorization(); newSolver.ActivateNonLinearSolution = true; newSolver.SolveExplicit(); newSolver.PrintExplicitSolution(); Results finalResults = new Results() { DynamicSolution = newSolver.explicitSolution, TimeSteps = newSolver.TimeAtEachStep, SelectedDOF = 1, SelectedInterval = 1, SolutionType = "Dynamic" }; return(finalResults); }
public static void RunDynamicExample() { IAssembly elementsAssembly = CreateAssembly(); InitialConditions initialValues = new InitialConditions(); initialValues.InitialAccelerationVector = new double[60]; initialValues.InitialDisplacementVector = new double[60]; initialValues.InitialVelocityVector = new double[60]; initialValues.InitialTime = 0.0; ExplicitSolver newSolver = new ExplicitSolver(1.0, 100); newSolver.Assembler = elementsAssembly; double[] externalForces = new double[60]; externalForces[28] = -5000.0; newSolver.InitialValues = initialValues; newSolver.ExternalForcesVector = externalForces; newSolver.LinearSolver = new LUFactorization(); newSolver.ActivateNonLinearSolution = true; newSolver.SolveExplicit(); newSolver.PrintExplicitSolution(); }