public static int GetArrayLength(this IArrayOperation arrayOperation)
    {
        int len = 0;

        while (arrayOperation.IndexCheck(len))
        {
            ++len;
        }
        return(len);
    }
Пример #2
0
        public CalculateRectangularBeamWithPiezoelectricVibrationTest()
        {
            this._precision = 1e-16;

            this._beamProfile = new RectangularProfile
            {
                Height = 3e-3,
                Width  = 25e-3
            };

            this._piezoelectricProfile = new RectangularProfile
            {
                Height = 0.267e-3,
                Width  = 25e-3
            };

            this._numberOfPiezoelectricsPerElement = 2;
            // Area and Moment of Inertia to piezoelectric were calculate manualy.
            this._piezoelectricArea            = this._numberOfPiezoelectricsPerElement * 6.675E-6;
            this._piezoelectricMomentOfInertia = 3.5701411E-11;

            this._arrayOperation    = new ArrayOperation();
            this._auxiliarOperation = new AuxiliarOperation();

            this._newmarkMethod = new NewmarkMethod(
                this._arrayOperation,
                this._auxiliarOperation);

            this._mappingResolver  = new MappingResolver();
            this._profileValidator = new RectangularProfileValidator();

            this._calculateGeometricProperty = new GeometricProperty();

            this._piezoelectricProfileMapper = new PiezoelectricRectangularProfileMapper(
                this._arrayOperation,
                this._calculateGeometricProperty);

            this._profileMapper = new RectangularProfileMapper(
                this._arrayOperation,
                this._calculateGeometricProperty);

            this._mainMatrix = new RectangularBeamWithPiezoelectricMainMatrix(this._arrayOperation);

            this._operation = new CalculateRectangularBeamWithPiezoelectricVibration(
                this._newmarkMethod,
                this._mappingResolver,
                this._profileValidator,
                this._auxiliarOperation,
                this._profileMapper,
                this._piezoelectricProfileMapper,
                this._mainMatrix,
                this._arrayOperation);

            this._methodParameter = new NewmarkMethodParameter
            {
                InitialTime             = 0,
                PeriodDivision          = 100,
                NumberOfPeriods         = 30,
                InitialAngularFrequency = 0.5
            };

            this._request = new BeamWithPiezoelectricRequest <RectangularProfile>
            {
                Author   = "Teste",
                BeamData = new PiezoelectricRequestData <RectangularProfile>
                {
                    DielectricConstant        = 7.33e-9,
                    DielectricPermissiveness  = 30.705,
                    ElasticityConstant        = 1.076e11,
                    ElectricalCharges         = new List <ElectricalCharge>(),
                    ElementsWithPiezoelectric = new uint[] { 2 },
                    FirstFastening            = "Pinned",
                    Forces = new List <Force> {
                        new Force
                        {
                            NodePosition = 1,
                            Value        = 100
                        }
                    },
                    LastFastening             = "Pinned",
                    Length                    = elementLength * numberOfElements,
                    Material                  = "Steel4130",
                    NumberOfElements          = numberOfElements,
                    PiezoelectricConstant     = 190e-12,
                    PiezoelectricPosition     = "Up and down",
                    PiezoelectricProfile      = this._piezoelectricProfile,
                    PiezoelectricSpecificMass = 7650,
                    PiezoelectricYoungModulus = 63e9,
                    Profile                   = this._beamProfile
                },
                MethodParameterData = this._methodParameter
            };

            this._beamWithPiezoelectic = new BeamWithPiezoelectric <RectangularProfile>()
            {
                DielectricConstant       = 7.33e-9,
                DielectricPermissiveness = 30.705,
                ElasticityConstant       = 1.076e11,
                ElectricalCharge         = new double[piezoelectricDegreesFreedomMaximum] {
                    0, 0, 0
                },
                ElementsWithPiezoelectric = new uint[numberOfElementsWithPiezoelectrics] {
                    2
                },
                FirstFastening = new Pinned(),
                Forces         = new double[degreesFreedomMaximum] {
                    0, 0, 100, 0, 0, 0
                },
                GeometricProperty = new GeometricProperty
                {
                    // Beam profile: height = 3e-3, width = 25e-3.
                    Area = new double[numberOfElements] {
                        7.5E-05, 7.5E-05
                    },
                    MomentOfInertia = new double[numberOfElements] {
                        5.625E-11, 5.625E-11
                    }
                },
                LastFastening    = new Pinned(),
                Length           = elementLength * numberOfElements,
                Material         = new Steel4130(),
                NumberOfElements = numberOfElements,
                NumberOfPiezoelectricPerElements = this._numberOfPiezoelectricsPerElement,
                PiezoelectricConstant            = 190e-12,
                PiezoelectricGeometricProperty   = new GeometricProperty
                {
                    // Piezoelectric profile:  height = 0.267e-3, width = 25e-3.
                    Area = new double[numberOfElements] {
                        0, this._piezoelectricArea
                    },
                    MomentOfInertia = new double[numberOfElements] {
                        0, this._piezoelectricMomentOfInertia
                    }
                },
                PiezoelectricProfile      = this._piezoelectricProfile,
                PiezoelectricSpecificMass = 7650,
                Profile = this._beamProfile,
                PiezoelectricYoungModulus = 63e9
            };

            this._equivalentForce = new double[numberOfBoundaryConditionsTrue] {
                0, 100, 0, 0, 0, 0
            };

            this._mass = new double[numberOfBoundaryConditionsTrue, numberOfBoundaryConditionsTrue]
            {
                { 0.000700893, 0.0045558, -0.00052567, 0, 0, 0 },
                { 0.0045558, 0.237645, 0.00133738, -0.00534608, 0, 0 },
                { -0.00052567, 0.00133738, 0.00152337, -0.000616855, 0, 0 },
                { 0, -0.00534608, -0.000616855, 0.000822473, 0, 0 },
                { 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0 }
            };

            this._stiffness = new double[numberOfBoundaryConditionsTrue, numberOfBoundaryConditionsTrue]
            {
                { 90, -270, 45, 0, 0, 0 },
                { -270, 2528.78, 92.1953, 362.195, 0, 0 },
                { 45, 92.1953, 210.732, 60.3659, 1.60557e-07, -1.60557e-07 },
                { 0, 362.195, 60.3659, 120.732, -1.60557e-07, 1.60557e-07 },
                { 0, 0, 1.60557e-07, -1.60557e-07, -6.8633e-07, 6.8633e-07 },
                { 0, 0, -1.60557e-07, 1.60557e-07, 6.8633e-07, -6.8633e-07 }
            };

            this._damping = new double[numberOfBoundaryConditionsTrue, numberOfBoundaryConditionsTrue]
            {
                { 9e-05, -0.00027, 4.5e-05, 0, 0, 0 },
                { -0.00027, 0.00252878, 9.21953e-05, 0.000362195, 0, 0 },
                { 4.5e-05, 9.21953e-05, 0.000210732, 6.03659e-05, 1.60557e-13, -1.60557e-13 },
                { 0, 0.000362195, 6.03659e-05, 0.000120732, -1.60557e-13, 1.60557e-13 },
                { 0, 0, 1.60557e-13, -1.60557e-13, -6.8633e-13, 6.8633e-13 },
                { 0, 0, -1.60557e-13, 1.60557e-13, 6.8633e-13, -6.8633e-13 }
            };

            this._newmarkMethodInput = new NewmarkMethodInput
            {
                Parameter = this._methodParameter,
                NumberOfTrueBoundaryConditions = numberOfBoundaryConditionsTrue,
                Force     = this._equivalentForce,
                Mass      = this._mass,
                Stiffness = this._stiffness,
                Damping   = this._damping
            };
        }
Пример #3
0
        public NewmarkMethodTest()
        {
            this._precision = 1e-15;

            this._arrayOperation    = new ArrayOperation();
            this._auxiliarOperation = new AuxiliarOperation();

            this._operation = new NewmarkMethod(
                this._arrayOperation,
                this._auxiliarOperation);

            this._methodParameter = new NewmarkMethodParameter
            {
                InitialTime             = 0,
                PeriodDivision          = 100,
                NumberOfPeriods         = 30,
                InitialAngularFrequency = 0.5
            };

            this._force = new double[numberOfrueBoundaryConditions] {
                0, 100, 0, 0, 0, 0
            };

            this._mass = new double[numberOfrueBoundaryConditions, numberOfrueBoundaryConditions]
            {
                { 0.000700893, 0.0045558, -0.00052567, 0, 0, 0 },
                { 0.0045558, 0.237645, 0.00133738, -0.00534608, 0, 0 },
                { -0.00052567, 0.00133738, 0.00152337, -0.000616855, 0, 0 },
                { 0, -0.00534608, -0.000616855, 0.000822473, 0, 0 },
                { 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0 }
            };

            this._stiffness = new double[numberOfrueBoundaryConditions, numberOfrueBoundaryConditions]
            {
                { 90, -270, 45, 0, 0, 0 },
                { -270, 2528.78, 92.1953, 362.195, 0, 0 },
                { 45, 92.1953, 210.732, 60.3659, 1.60557e-07, -1.60557e-07 },
                { 0, 362.195, 60.3659, 120.732, -1.60557e-07, 1.60557e-07 },
                { 0, 0, 1.60557e-07, -1.60557e-07, -6.8633e-07, 6.8633e-07 },
                { 0, 0, -1.60557e-07, 1.60557e-07, 6.8633e-07, -6.8633e-07 }
            };

            this._damping = new double[numberOfrueBoundaryConditions, numberOfrueBoundaryConditions]
            {
                { 9e-05, -0.00027, 4.5e-05, 0, 0, 0 },
                { -0.00027, 0.00252878, 9.21953e-05, 0.000362195, 0, 0 },
                { 4.5e-05, 9.21953e-05, 0.000210732, 6.03659e-05, 1.60557e-13, -1.60557e-13 },
                { 0, 0.000362195, 6.03659e-05, 0.000120732, -1.60557e-13, 1.60557e-13 },
                { 0, 0, 1.60557e-13, -1.60557e-13, -6.8633e-13, 6.8633e-13 },
                { 0, 0, -1.60557e-13, 1.60557e-13, 6.8633e-13, -6.8633e-13 }
            };

            this._newmarkMethodInput = new NewmarkMethodInput
            {
                Parameter        = this._methodParameter,
                AngularFrequency = this._methodParameter.InitialAngularFrequency,
                NumberOfTrueBoundaryConditions = numberOfrueBoundaryConditions,
                Force     = this._force,
                Mass      = this._mass,
                Stiffness = this._stiffness,
                Damping   = this._damping
            };

            this._previousDisplacement = new double[numberOfrueBoundaryConditions];
            this._previousVelocity     = new double[numberOfrueBoundaryConditions];
            this._previousAcceleration = new double[numberOfrueBoundaryConditions];

            this._displacement = new double[numberOfrueBoundaryConditions];
            this._velocity     = new double[numberOfrueBoundaryConditions];
            this._acceleration = new double[numberOfrueBoundaryConditions];

            this._equivalentStiffness = new double[numberOfrueBoundaryConditions, numberOfrueBoundaryConditions]
            {
                { 90.179, -268.85, 44.8676, 0, 0, 0 },
                { -268.85, 2589.02, 92.5356, 360.847, 0, 0 },
                { 44.8676, 92.5356, 211.121, 60.2106, 1.6056e-07, -1.6056e-07 },
                { 0, 360.847, 60.2106, 120.942, -1.6056e-07, 1.6056e-07 },
                { 0, 0, 1.6056e-07, -1.6056e-07, -6.86341e-07, 6.86341e-07 },
                { 0, 0, -1.6056e-07, 1.6056e-07, 6.86341e-07, -6.86341e-07 }
            };

            this._equivalentForce = new double[numberOfrueBoundaryConditions] {
                0, 100, 0, 0, 0, 0,
            };
        }
        public RectangularBeamWithPiezoelectricMainMatrixTest()
        {
            this._numberOfPiezoelectricsPerElement = 2;
            // Area and Moment of Inertia to piezoelectric were calculate manualy.
            this._piezoelectricArea            = this._numberOfPiezoelectricsPerElement * 6.675E-6;
            this._piezoelectricMomentOfInertia = 3.5701411E-11;
            this._precision = 1e-6;

            this._arrayOperation = new ArrayOperation();

            this._operation = new RectangularBeamWithPiezoelectricMainMatrix(this._arrayOperation);

            this._elementLength = 0.5;

            this._beamWithPiezoelectric = new BeamWithPiezoelectric <RectangularProfile>
            {
                DielectricConstant       = 7.33e-9,
                DielectricPermissiveness = 30.705,
                ElasticityConstant       = 1.076e11,
                ElectricalCharge         = new double[numberOfPiezoelectrics] {
                    0
                },
                ElementsWithPiezoelectric = new uint[numberOfPiezoelectrics] {
                    2
                },
                FirstFastening = new Pinned(),
                Forces         = new double[degreesFreedomMaximum] {
                    0, 0, 100, 0, 0, 0
                },
                GeometricProperty = new GeometricProperty
                {
                    // Beam profile: height = 3e-3, width = 25e-3.
                    Area = new double[numberOfElements] {
                        7.5E-05, 7.5E-05
                    },
                    MomentOfInertia = new double[numberOfElements] {
                        5.625E-11, 5.625E-11
                    }
                },
                LastFastening    = new Pinned(),
                Length           = this._elementLength * numberOfElements,
                Material         = new Steel4130(),
                NumberOfElements = numberOfElements,
                NumberOfPiezoelectricPerElements = 2,
                PiezoelectricConstant            = 190e-12,
                PiezoelectricGeometricProperty   = new GeometricProperty
                {
                    // Piezoelectric profile:  height = 0.267e-3, width = 25e-3.
                    Area = new double[numberOfElements] {
                        0, this._piezoelectricArea
                    },
                    MomentOfInertia = new double[numberOfElements] {
                        0, this._piezoelectricMomentOfInertia
                    }
                },
                PiezoelectricProfile = new RectangularProfile
                {
                    Height = 0.267e-3,
                    Width  = 25e-3
                },
                PiezoelectricSpecificMass = 7650,
                Profile = new RectangularProfile
                {
                    Height = 3e-3,
                    Width  = 25e-3
                },
                PiezoelectricYoungModulus = 63e9
            };

            this._piezoelectricElementMassMatrix = new double[Constant.DegreesFreedomElement, Constant.DegreesFreedomElement]
            {
                { 0.018967, 0.001337, 0.006565, -0.000790 },
                { 0.001337, 0.000122, 0.000790, -0.000091 },
                { 0.006565, 0.000790, 0.018967, -0.001337 },
                { -0.000790, -0.000091, -0.001337, 0.000122 }
            };

            this._massMatrix = new double[degreesFreedomMaximum, degreesFreedomMaximum]
            {
                { 0.109339, 0.007710, 0.037848, -0.004556, 0.000000, 0.000000 },
                { 0.007710, 0.000701, 0.004556, -0.000526, 0.000000, 0.000000 },
                { 0.037848, 0.004556, 0.237645, 0.001337, 0.044414, -0.005346 },
                { -0.004556, -0.000526, 0.001337, 0.001523, 0.005346, -0.000617 },
                { 0.000000, 0.000000, 0.044414, 0.005346, 0.128306, -0.009047 },
                { 0.000000, 0.000000, -0.005346, -0.000617, -0.009047, 0.000822 }
            };

            this._piezoelectricElementStiffnessMatrix = new double[Constant.DegreesFreedomElement, Constant.DegreesFreedomElement]
            {
                { 368.781296, 92.195324, -368.781296, 92.195324 },
                { 92.195324, 30.731775, -92.195324, 15.365887 },
                { -368.781296, -92.195324, 368.781296, -92.195324 },
                { 92.195324, 15.365887, -92.195324, 30.731775 }
            };

            this._stiffnessMatrix = new double[degreesFreedomMaximum, degreesFreedomMaximum]
            {
                { 1080.000000, 270.000000, -1080.000000, 270.000000, 0.000000, 0.000000 },
                { 270.000000, 90.000000, -270.000000, 45.000000, 0.000000, 0.000000 },
                { -1080.000000, -270.000000, 2528.781296, 92.195324, -1448.781296, 362.195324 },
                { 270.000000, 45.000000, 92.195324, 210.731775, -362.195324, 60.365887 },
                { 0.000000, 0.000000, -1448.781296, -362.195324, 1448.781296, -362.195324 },
                { 0.000000, 0.000000, 362.195324, 60.365887, -362.195324, 120.731775 }
            };

            this._piezoelectricElementElectromechanicalCouplingMatrix = new double[Constant.DegreesFreedomElement, Constant.PiezoelectricDegreesFreedomElement]
            {
                { 0, 0 },
                { 1.60557e-07, -1.60557e-07 },
                { 0, -1.60557e-07 },
                { -1.60557e-07, 1.60557e-07 }
            };

            this._piezoelectricElectromechanicalCouplingMatrix = new double[degreesFreedomMaximum, piezoelectricDegreesFreedomMaximum]
            {
                { 0, 0, 0 },
                { 0, 0, 0 },
                { 0, 0, 0 },
                { 0, 1.60557e-07, -1.60557e-07 },
                { 0, 0, -1.60557e-07 },
                { 0, -1.60557e-07, 1.60557e-07 }
            };

            this._elementPiezoelectricCapacitanceMatrix = new double[Constant.PiezoelectricDegreesFreedomElement, Constant.PiezoelectricDegreesFreedomElement]
            {
                { -6.8633e-07, 6.8633e-07 },
                { 6.8633e-07, -6.8633e-07 }
            };

            this._piezoelectricCapacitanceMatrix = new double[piezoelectricDegreesFreedomMaximum, piezoelectricDegreesFreedomMaximum]
            {
                { 0, 0, 0 },
                { 0, -6.8633e-07, 6.8633e-07 },
                { 0, 6.8633e-07, -6.8633e-07 }
            };

            this._equivalentMassMatrix = new double[degreesFreedomMaximum + piezoelectricDegreesFreedomMaximum, degreesFreedomMaximum + piezoelectricDegreesFreedomMaximum]
            {
                { 0.109339, 0.00770982, 0.0378482, -0.0045558, 0, 0, 0, 0, 0 },
                { 0.00770982, 0.000700893, 0.0045558, -0.00052567, 0, 0, 0, 0, 0 },
                { 0.0378482, 0.0045558, 0.237645, 0.00133738, 0.0444136, -0.00534608, 0, 0, 0 },
                { -0.0045558, -0.00052567, 0.00133738, 0.00152337, 0.00534608, -0.000616855, 0, 0, 0 },
                { 0, 0, 0.0444136, 0.00534608, 0.128306, -0.00904721, 0, 0, 0 },
                { 0, 0, -0.00534608, -0.000616855, -0.00904721, 0.000822473, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
            };

            this._equivalentStiffnessMatrix = new double[degreesFreedomMaximum + piezoelectricDegreesFreedomMaximum, degreesFreedomMaximum + piezoelectricDegreesFreedomMaximum]
            {
                { 1080, 270, -1080, 270, 0, 0, 0, 0, 0 },
                { 270, 90, -270, 45, 0, 0, 0, 0, 0 },
                { -1080, -270, 2528.78, 92.1953, -1448.78, 362.195, 0, 0, 0 },
                { 270, 45, 92.1953, 210.732, -362.195, 60.3659, 0, 1.60557e-07, -1.60557e-07 },
                { 0, 0, -1448.78, -362.195, 1448.78, -362.195, 0, 0, -1.60557e-07 },
                { 0, 0, 362.195, 60.3659, -362.195, 120.732, 0, -1.60557e-07, 1.60557e-07 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 1.60557e-07, 0, -1.60557e-07, 0, -6.8633e-07, 6.8633e-07 },
                { 0, 0, 0, -1.60557e-07, -1.60557e-07, 1.60557e-07, 0, 6.8633e-07, -6.8633e-07 }
            };

            this._damping = new double[degreesFreedomMaximum + piezoelectricDegreesFreedomMaximum, degreesFreedomMaximum + piezoelectricDegreesFreedomMaximum]
            {
                { 0.00108, 0.00027, -0.00108, 0.00027, 0, 0, 0, 0, 0 },
                { 0.00027, 9e-05, -0.00027, 4.5e-05, 0, 0, 0, 0, 0 },
                { -0.00108, -0.00027, 0.00252878, 9.21953e-05, -0.00144878, 0.000362195, 0, 0, 0 },
                { 0.00027, 4.5e-05, 9.21953e-05, 0.000210732, -0.000362195, 6.03659e-05, 0, 1.60557e-13, -1.60557e-13 },
                { 0, 0, -0.00144878, -0.000362195, 0.00144878, -0.000362195, 0, 0, -1.60557e-13 },
                { 0, 0, 0.000362195, 6.03659e-05, -0.000362195, 0.000120732, 0, -1.60557e-13, 1.60557e-13 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 1.60557e-13, 0, -1.60557e-13, 0, -6.8633e-13, 6.8633e-13 },
                { 0, 0, 0, -1.60557e-13, -1.60557e-13, 1.60557e-13, 0, 6.8633e-13, -6.8633e-13 }
            };

            this._piezoelectricBoundaryConditions = new bool[degreesFreedomMaximum / 2] {
                false, true, true
            };
        }
Пример #5
0
 public static bool IndexCheck(this IArrayOperation arrayOperation, int index)
 {
     return(index >= 0 && index < arrayOperation.GetArrayLength());
 }