예제 #1
0
        public static void HexaCantileverBuilder_copyMS_222(Model model, double load_value)
        {
            //Origin: ParadeigmataElegxwnBuilder.HexaCantileverBuilder_copyMS_222(Model model, double load_value)

            IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderNonLinear();

            IContinuumMaterial3DDefGrad material1 = new MicrostructureDefGrad3D(homogeneousRveBuilder1,
                                                                                m => (new SkylineSolver.Builder()).BuildSolver(m), false, 1);

            double[,] nodeData = new double[, ] {
                { -0.250000, -0.250000, -1.000000 },
                { 0.250000, -0.250000, -1.000000 },
                { -0.250000, 0.250000, -1.000000 },
                { 0.250000, 0.250000, -1.000000 },
                { -0.250000, -0.250000, -0.500000 },
                { 0.250000, -0.250000, -0.500000 },
                { -0.250000, 0.250000, -0.500000 },
                { 0.250000, 0.250000, -0.500000 },
                { -0.250000, -0.250000, 0.000000 },
                { 0.250000, -0.250000, 0.000000 },
                { -0.250000, 0.250000, 0.000000 },
                { 0.250000, 0.250000, 0.000000 },
                { -0.250000, -0.250000, 0.500000 },
                { 0.250000, -0.250000, 0.500000 },
                { -0.250000, 0.250000, 0.500000 },
                { 0.250000, 0.250000, 0.500000 },
                { -0.250000, -0.250000, 1.000000 },
                { 0.250000, -0.250000, 1.000000 },
                { -0.250000, 0.250000, 1.000000 },
                { 0.250000, 0.250000, 1.000000 }
            };

            int[,] elementData = new int[, ] {
                { 1, 8, 7, 5, 6, 4, 3, 1, 2 },
                { 2, 12, 11, 9, 10, 8, 7, 5, 6 },
                { 3, 16, 15, 13, 14, 12, 11, 9, 10 },
                { 4, 20, 19, 17, 18, 16, 15, 13, 14 },
            };

            // orismos shmeiwn
            for (int nNode = 0; nNode < nodeData.GetLength(0); nNode++)
            {
                model.NodesDictionary.Add(nNode + 1, new Node(id: nNode + 1, x: nodeData[nNode, 0], y:  nodeData[nNode, 1], z: nodeData[nNode, 2]));
            }

            // orismos elements
            Element e1;
            int     subdomainID = 1;

            for (int nElement = 0; nElement < elementData.GetLength(0); nElement++)
            {
                e1 = new Element()
                {
                    ID          = nElement + 1,
                    ElementType = new Hexa8NonLinearDefGrad(material1, GaussLegendre3D.GetQuadratureWithOrder(2, 2, 2)) // dixws to e. exoume sfalma enw sto beambuilding oxi//edw kaleitai me ena orisma to Hexa8
                };
                for (int j = 0; j < 8; j++)
                {
                    e1.NodesDictionary.Add(elementData[nElement, j + 1], model.NodesDictionary[elementData[nElement, j + 1]]);
                }
                model.ElementsDictionary.Add(e1.ID, e1);
                model.SubdomainsDictionary[subdomainID].Elements.Add(e1);
            }

            // constraint vashh opou z=-1
            for (int k = 1; k < 5; k++)
            {
                model.NodesDictionary[k].Constraints.Add(new Constraint {
                    DOF = StructuralDof.TranslationX
                });
                model.NodesDictionary[k].Constraints.Add(new Constraint {
                    DOF = StructuralDof.TranslationY
                });
                model.NodesDictionary[k].Constraints.Add(new Constraint {
                    DOF = StructuralDof.TranslationZ
                });
            }

            // fortish korufhs
            Load load1;

            for (int k = 17; k < 21; k++)
            {
                load1 = new Load()
                {
                    Node   = model.NodesDictionary[k],
                    DOF    = StructuralDof.TranslationX,
                    Amount = 1 * load_value
                };
                model.Loads.Add(load1);
            }
        }
        public static (double[], double[], double[], double[], IVector, IVector) Check05bStressIntegrationObje_Integration()
        {
            //Origin: SeparateCodeCheckingClass.Check05bStressIntegration
            //modifications: tha xrhsimopoithei h nea microstructure me obje kapoia subdomainCalculations

            double E_disp = 3.5; /*Gpa*/ double ni_disp = 0.4; // stather Poisson
            var    material1 = new ElasticMaterial3D()
            {
                YoungModulus = E_disp, PoissonRatio = ni_disp,
            };

            double[,] DGtr = new double[3, 3] {
                { 1.10, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }
            };
            double[] GLVec = Transform_DGtr_to_GLvec(DGtr);
            material1.UpdateMaterial(GLVec);
            //double[] stressesCheck1 = material1.Stresses;
            double[] stressesCheck1 = new double[6] {
                material1.Stresses[0], material1.Stresses[1], material1.Stresses[2],
                material1.Stresses[3], material1.Stresses[4], material1.Stresses[5]
            };
            DGtr = new double[3, 3] {
                { 1.20, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }
            };
            GLVec = Transform_DGtr_to_GLvec(DGtr);
            material1.UpdateMaterial(GLVec);
            material1.SaveState();
            double[] stressesCheck2 = material1.Stresses;

            //VectorExtensions.AssignTotalAffinityCount();
            IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderNonLinear();
            //IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderCheckEnaHexa();

            //IContinuumMaterial3DDefGrad
            var microstructure3 = new MicrostructureDefGrad3D(homogeneousRveBuilder1,
                                                              model => (new SkylineSolver.Builder()).BuildSolver(model), false, 1);

            //IContinuumMaterial3DDefGrad microstructure3copyConsCheck = new Microstructure3copyConsCheckEna(homogeneousRveBuilder1);
            double[,] consCheck1 = new double[6, 6];
            for (int i1 = 0; i1 < 6; i1++)
            {
                for (int i2 = 0; i2 < 6; i2++)
                {
                    consCheck1[i1, i2] = microstructure3.ConstitutiveMatrix[i1, i2];
                }
            }

            microstructure3.UpdateMaterial(new double[9] {
                1.10, 1, 1, 0, 0, 0, 0, 0, 0
            });
            double[] stressesCheck3 = microstructure3.Stresses;
            microstructure3.SaveState();
            IVector uInitialFreeDOFs_state1 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy();

            microstructure3.UpdateMaterial(new double[9] {
                1.20, 1, 1, 0, 0, 0, 0, 0, 0
            });
            double[] stressesCheck4          = microstructure3.Stresses;
            IVector  uInitialFreeDOFs_state2 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy();

            //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state1.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state1.txt");
            //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state2.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state2.txt");

            return(stressesCheck1, stressesCheck2, stressesCheck3, stressesCheck4, uInitialFreeDOFs_state1, uInitialFreeDOFs_state2);
        }