private static void SolveBuildingInNoSoilSmall() { VectorExtensions.AssignTotalAffinityCount(); Model model = new Model(); model.SubdomainsDictionary.Add(1, new Subdomain() { ID = 1 }); BeamBuildingBuilder.MakeBeamBuilding(model, 20, 20, 20, 5, 4, model.NodesDictionary.Count + 1, model.ElementsDictionary.Count + 1, 1, 4, false, false); model.Loads.Add(new Load() { Amount = -100, Node = model.Nodes[21], DOF = DOFType.X }); model.ConnectDataStructures(); SolverSkyline solver = new SolverSkyline(model); ProblemStructural provider = new ProblemStructural(model, solver.SubdomainsDictionary); LinearAnalyzer analyzer = new LinearAnalyzer(solver, solver.SubdomainsDictionary); StaticAnalyzer parentAnalyzer = new StaticAnalyzer(provider, analyzer, solver.SubdomainsDictionary); analyzer.LogFactories[1] = new LinearAnalyzerLogFactory(new int[] { 420 }); parentAnalyzer.BuildMatrices(); parentAnalyzer.Initialize(); parentAnalyzer.Solve(); }
private static void SolveBuildingInNoSoilSmallVRFStochastic() { VectorExtensions.AssignTotalAffinityCount(); Model model = new Model(); model.SubdomainsDictionary.Add(1, new Subdomain() { ID = 1 }); BeamBuildingBuilder.MakeBeamBuilding(model, 20, 20, 20, 5, 4, model.NodesDictionary.Count + 1, model.ElementsDictionary.Count + 1, 1, 4, false, false); model.Loads.Add(new Load() { Amount = -100, Node = model.Nodes[21], DOF = DOFType.X }); model.ConnectDataStructures(); PowerSpectrumTargetEvaluatorCoefficientsProvider stochasticProvider = new PowerSpectrumTargetEvaluatorCoefficientsProvider(10, 0.1, 1.2, 20, 200, DOFType.X, 0.1, 200, 1e-10); SolverSkyline solver = new SolverSkyline(model); ProblemStructural provider = new ProblemStructural(model, solver.SubdomainsDictionary); LinearAnalyzer analyzer = new LinearAnalyzer(solver, solver.SubdomainsDictionary); StaticAnalyzer childAnalyzer = new StaticAnalyzer(provider, analyzer, solver.SubdomainsDictionary); VRFMonteCarloAnalyzerWithStochasticMaterial stochasticAnalyzer = new VRFMonteCarloAnalyzerWithStochasticMaterial(model, provider, childAnalyzer, solver.SubdomainsDictionary, stochasticProvider, stochasticProvider, 1, 20, "monteCarlo"); analyzer.LogFactories[1] = new LinearAnalyzerLogFactory(new int[] { 420 }); //stochasticAnalyzer.BuildMatrices(); //childAnalyzer.Initialize(); stochasticAnalyzer.Solve(); }
static void Main(string[] args) { VectorExtensions.AssignTotalAffinityCount(); double youngModulus = 200.0e06; double poissonRatio = 0.3; double nodalLoad = 25.0; // Create a new elastic 3D material ElasticMaterial3D material = new ElasticMaterial3D() { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Node creation IList <Node> nodes = CreateNodes(); // Model creation Model model = new Model(); // Add a single subdomain to the model model.SubdomainsDictionary.Add(1, new Subdomain() { ID = 1 }); // Add nodes to the nodes dictonary of the model for (int i = 0; i < nodes.Count; ++i) { model.NodesDictionary.Add(i + 1, nodes[i]); } // Constraint bottom nodes of the model model.NodesDictionary[1].Constraints.Add(DOFType.X); model.NodesDictionary[1].Constraints.Add(DOFType.Y); model.NodesDictionary[1].Constraints.Add(DOFType.Z); model.NodesDictionary[2].Constraints.Add(DOFType.X); model.NodesDictionary[2].Constraints.Add(DOFType.Y); model.NodesDictionary[2].Constraints.Add(DOFType.Z); model.NodesDictionary[3].Constraints.Add(DOFType.X); model.NodesDictionary[3].Constraints.Add(DOFType.Y); model.NodesDictionary[3].Constraints.Add(DOFType.Z); model.NodesDictionary[4].Constraints.Add(DOFType.X); model.NodesDictionary[4].Constraints.Add(DOFType.Y); model.NodesDictionary[4].Constraints.Add(DOFType.Z); // Create a new Hexa8 element var element = new Element() { ID = 1, ElementType = new Hexa8(material) }; // Add nodes to the created element element.AddNode(model.NodesDictionary[1]); element.AddNode(model.NodesDictionary[2]); element.AddNode(model.NodesDictionary[3]); element.AddNode(model.NodesDictionary[4]); element.AddNode(model.NodesDictionary[5]); element.AddNode(model.NodesDictionary[6]); element.AddNode(model.NodesDictionary[7]); element.AddNode(model.NodesDictionary[8]); // Add Hexa element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(element.ID, element); model.SubdomainsDictionary[1].ElementsDictionary.Add(element.ID, element); // Add nodal load values at the top nodes of the model model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[5], DOF = DOFType.Z }); model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[6], DOF = DOFType.Z }); model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[7], DOF = DOFType.Z }); model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[8], DOF = DOFType.Z }); // Needed in order to make all the required data structures model.ConnectDataStructures(); // Choose linear equation system solver SolverSkyline solver = new SolverSkyline(model); // Choose the provider of the problem -> here a structural problem ProblemStructural provider = new ProblemStructural(model, solver.SubdomainsDictionary); // Choose parent and child analyzers -> Parent: Static, Child: Linear Analyzers.LinearAnalyzer childAnalyzer = new LinearAnalyzer(solver, solver.SubdomainsDictionary); StaticAnalyzer parentAnalyzer = new StaticAnalyzer(provider, childAnalyzer, solver.SubdomainsDictionary); // Choose dof types X, Y, Z to log for node 5 childAnalyzer.LogFactories[1] = new LinearAnalyzerLogFactory(new int[] { model.NodalDOFsDictionary[5][DOFType.X], model.NodalDOFsDictionary[5][DOFType.Y], model.NodalDOFsDictionary[5][DOFType.Z] }); // Analyze the problem parentAnalyzer.BuildMatrices(); parentAnalyzer.Initialize(); parentAnalyzer.Solve(); // Write results to console Console.WriteLine("Writing results for node 5"); Console.WriteLine("Dof and Values for Displacement X, Y, Z"); Console.WriteLine(childAnalyzer.Logs[1][0]); }