public static void CheckOneRveSerial()
        {
            (double[] stressesCheck3, double[] stressesCheck4, double[,] consCheck1, IVector uInitialFreeDOFs_state1, IVector uInitialFreeDOFs_state2) = OneRveExample.Check_Graphene_rve_serial();

            string results_file1 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationOneRveMultipleGrSh\\uInitialFreeDOFs_state1.txt";
            string results_file2 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationOneRveMultipleGrSh\\uInitialFreeDOFs_state2.txt";
            //string results_file3 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationTestsB\\consCheck1.txt";
            string results_file4 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationOneRveMultipleGrSh\\stressesCheck3.txt";
            string results_file5 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationOneRveMultipleGrSh\\stressesCheck4.txt";

            double[] displacements1sIncrement  = PrintUtilities.ReadVector(results_file1);
            double[] displacements2ndIncrement = PrintUtilities.ReadVector(results_file2);

            double[,] consCheck1Expected = new double[6, 6]
            {
                { 8.247794441602281, 5.040483382644040, 5.045179342838760, -0.034573545680066, 0.012873618640199, 0.067413461733790 },
                { 5.040483382644040, 7.758675250745090, 5.083447516662590, -0.017660393516958, 0.086264761000810, -0.001886483315119 },
                { 5.045179342838760, 5.083447516662600, 7.889514025249530, 0.014993568822868, 0.174547712576532, 0.013639601528685 },
                { -0.034573545680067, -0.017660393516956, 0.014993568822868, 1.404689076704550, 0.023343385610862, 0.099337624448147 },
                { 0.012873618640199, 0.086264761000810, 0.174547712576533, 0.023343385610861, 1.347276707954930, -0.002212957880199 },
                { 0.067413461733791, -0.001886483315119, 0.013639601528686, 0.099337624448147, -0.002212957880199, 1.454060010268960 }
            };

            double[] stressesCheck3Expected = PrintUtilities.ReadVector(results_file4);
            double[] stressesCheck4Expected = PrintUtilities.ReadVector(results_file5);

            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(displacements1sIncrement, uInitialFreeDOFs_state1.CopyToArray()));
            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(displacements2ndIncrement, uInitialFreeDOFs_state2.CopyToArray()));
            Assert.True(BondSlipTest.AreDisplacementsSame(consCheck1, consCheck1Expected));
            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(stressesCheck3, stressesCheck3Expected));
            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(stressesCheck4, stressesCheck4Expected));
        }
        public static void CheckGrapheneMicrostructure()
        {
            (double[] stressesCheck3, double[] stressesCheck4, double[,] consCheck1, IVector uInitialFreeDOFs_state1, IVector uInitialFreeDOFs_state2) = SeparateCodeCheckingClass4.Check_Graphene_rve_Obje_Integration();

            string results_file1 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationTestsB\\uInitialFreeDOFs_state1.txt";
            string results_file2 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationTestsB\\uInitialFreeDOFs_state2.txt";
            //string results_file3 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationTestsB\\consCheck1.txt";
            string results_file4 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationTestsB\\stressesCheck3.txt";
            string results_file5 = "..\\..\\..\\InputFiles\\MicroStructureAndIntegrationTestsB\\stressesCheck4.txt";

            double[] displacements1sIncrement  = PrintUtilities.ReadVector(results_file1);
            double[] displacements2ndIncrement = PrintUtilities.ReadVector(results_file2);

            double[,] consCheck1Expected = new double[6, 6] {
                { 7.586076977452720, 5.002676833389410, 5.002022820741120, -0.013645880596011, -0.000827683355376, 0.009516079959912 },
                { 5.002676833389410, 7.512154809921630, 5.019436489046710, -0.004684943090660, 0.015322738052621, -0.005624423827287 },
                { 5.002022820741120, 5.019436489046710, 7.541834561367190, 0.004377190727383, 0.028459910927874, 0.006755413641553 },
                { -0.013645880596012, -0.004684943090660, 0.004377190727383, 1.266215688675580, -0.001138059373760, 0.018013447177758 },
                { -0.000827683355376, 0.015322738052620, 0.028459910927874, -0.001138059373760, 1.270911173682930, -0.001860391453226 },
                { 0.009516079959912, -0.005624423827287, 0.006755413641553, 0.018013447177758, -0.001860391453226, 1.278204450851190 },
            };

            double[] stressesCheck3Expected = PrintUtilities.ReadVector(results_file4);
            double[] stressesCheck4Expected = PrintUtilities.ReadVector(results_file5);

            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(displacements1sIncrement, uInitialFreeDOFs_state1.CopyToArray()));
            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(displacements2ndIncrement, uInitialFreeDOFs_state2.CopyToArray()));
            Assert.True(BondSlipTest.AreDisplacementsSame(consCheck1, consCheck1Expected));
            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(stressesCheck3, stressesCheck3Expected));
            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(stressesCheck4, stressesCheck4Expected));
        }
Пример #3
0
        public static void CheckShellScaleTransitionsAndMicrostructure()
        {
            //Origin: Check05fStressIntegration
            //alllages: use of updated v2 classes


            double E_disp = 3.5; /*Gpa*/ double ni_disp = 0.4; // stather Poisson
            //var material1 = new ElasticMaterial2D(StressState2D.PlaneStress)
            //{ YoungModulus = E_disp, PoissonRatio = ni_disp, };
            //double[] GLVec = new double[3] { 0.01, 0, 0 };
            //material1.UpdateMaterial(new StressStrainVectorContinuum2D(GLVec));
            //double[] stressesCheck1 = new double[3] { material1.Stresses[0], material1.Stresses[1], material1.Stresses[2] };

            var Vec1 = Vector.CreateFromArray(new double[3] {
                1, 0, 0
            });
            var Vec2 = Vector.CreateFromArray(new double[3] {
                0.5, 2, 0
            });
            var strain = new double[3] {
                0.01, 0, 0
            };

            //var material2 = new ShellElasticMaterial2D() { YoungModulus = E_disp, PoissonRatio = ni_disp, TangentVectorV1 = new double[3] { Vec1[0], Vec1[1], Vec1[2] }, TangentVectorV2 = new double[3] { Vec2[0], Vec2[1], Vec2[2] } };
            //material2.UpdateMaterial(strain);
            //double[] stressesCheck2 = new double[3] { material2.Stresses[0], material2.Stresses[1], material2.Stresses[2] };

            var material3 = new ShellElasticMaterial2Dtransformationb()
            {
                YoungModulus = E_disp, PoissonRatio = ni_disp, TangentVectorV1 = new double[3] {
                    Vec1[0], Vec1[1], Vec1[2]
                }, TangentVectorV2 = new double[3] {
                    Vec2[0], Vec2[1], Vec2[2]
                }
            };
            var Matrix1 = Matrix.CreateZero(3, 3); for (int i1 = 0; i1 < 3; i1++)

            {
                for (int i2 = 0; i2 < 3; i2++)
                {
                    Matrix1[i1, i2] = material3.ConstitutiveMatrix[i1, i2];
                }
            }

            material3.UpdateMaterial(strain);
            double[] stressesCheck3 = new double[3] {
                material3.Stresses[0], material3.Stresses[1], material3.Stresses[2]
            };

            //VectorExtensions.AssignTotalAffinityCount();
            IdegenerateRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderLinearAndDegenerate();

            //IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderCheckEnaHexa();

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

            var material4 = new MicrostructureShell2D(homogeneousRveBuilder1,
                                                      model => (new SkylineSolver.Builder()).BuildSolver(model), false, 1)
            {
                TangentVectorV1 = new double[3] {
                    Vec1[0], Vec1[1], Vec1[2]
                },
                TangentVectorV2 = new double[3] {
                    Vec2[0], Vec2[1], Vec2[2]
                }
            };
            var Matrix2 = Matrix.CreateZero(3, 3); for (int i1 = 0; i1 < 3; i1++)

            {
                for (int i2 = 0; i2 < 3; i2++)
                {
                    Matrix2[i1, i2] = material4.ConstitutiveMatrix[i1, i2];
                }
            }

            material4.UpdateMaterial(strain);
            double[] stressesCheck4 = new double[3] {
                material4.Stresses[0], material4.Stresses[1], material4.Stresses[2]
            };


            //-------------Check 2 steps savestate etc---------------
            material4.SaveState();
            material4.UpdateMaterial(new double[3] {
                2 * strain[0], 2 * strain[1], 2 * strain[2]
            });
            double[] stressesCheck5 = new double[3] {
                material4.Stresses[0], material4.Stresses[1], material4.Stresses[2]
            };

            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(stressesCheck3, stressesCheck4));
            Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(new double[3] {
                2 * stressesCheck3[0], 2 * stressesCheck3[1], 2 * stressesCheck3[2]
            },
                                                                     stressesCheck5));
            Assert.True(BondSlipTest.AreDisplacementsSame(Matrix1.CopyToArray2D(), consCheck1));
            Assert.True(AreDisplacementsSame(Matrix1.CopyToArray2D(), material4.ConstitutiveMatrix));
        }