/// <summary> /// This method creates a new instance of class <see cref="Beam{TProfile}"/>. /// This is a step to create the input fot finite element analysis. /// </summary> /// <param name="request"></param> /// <param name="degreesOfFreedom"></param> /// <returns>A new instance of class <see cref="Beam{TProfile}"/>.</returns> public override async Task <Beam <TProfile> > BuildBeam(BeamRequest <TProfile> request, uint degreesOfFreedom) { GeometricProperty geometricProperty = new GeometricProperty(); if (request.Profile.Area != null && request.Profile.MomentOfInertia != null) { geometricProperty.Area = await ArrayFactory.CreateVectorAsync(request.Profile.Area.Value, request.NumberOfElements).ConfigureAwait(false); geometricProperty.MomentOfInertia = await ArrayFactory.CreateVectorAsync(request.Profile.MomentOfInertia.Value, request.NumberOfElements).ConfigureAwait(false); } else { geometricProperty.Area = await this._geometricProperty.CalculateArea(request.Profile, request.NumberOfElements).ConfigureAwait(false); geometricProperty.MomentOfInertia = await this._geometricProperty.CalculateMomentOfInertia(request.Profile, request.NumberOfElements).ConfigureAwait(false); } var beam = new Beam <TProfile>() { Fastenings = await this._mappingResolver.BuildFastenings(request.Fastenings).ConfigureAwait(false), Forces = await this._mappingResolver.BuildForceVector(request.Forces, degreesOfFreedom).ConfigureAwait(false), GeometricProperty = geometricProperty, Length = request.Length, Material = MaterialFactory.Create(request.Material), NumberOfElements = request.NumberOfElements, Profile = request.Profile }; return(beam); }
/// <summary> /// This method calculates the vector with the beam area. /// </summary> /// <param name="profile"></param> /// <param name="numberOfElements"></param> /// <returns></returns> public override async Task <double[]> CalculateArea(CircularProfile profile, uint numberOfElements) { double area; if (profile.Thickness == null) { area = Math.PI * Math.Pow(profile.Diameter, 2) / 4; } else { area = (Math.PI / 4) * (Math.Pow(profile.Diameter, 2) - Math.Pow(profile.Diameter - 2 * profile.Thickness.Value, 2)); } return(await ArrayFactory.CreateVectorAsync(area, numberOfElements).ConfigureAwait(false)); }
/// <summary> /// This method calculates the vector with the beam moment of inertia. /// </summary> /// <param name="profile"></param> /// <param name="numberOfElements"></param> /// <returns></returns> public override async Task <double[]> CalculateMomentOfInertia(CircularProfile profile, uint numberOfElements) { double momentOfInertia; if (profile.Thickness == null) { momentOfInertia = Math.PI * Math.Pow(profile.Diameter, 4) / 64; } else { momentOfInertia = (Math.PI / 64) * (Math.Pow(profile.Diameter, 4) - Math.Pow(profile.Diameter - 2 * profile.Thickness.Value, 4)); } return(await ArrayFactory.CreateVectorAsync(momentOfInertia, numberOfElements).ConfigureAwait(false)); }
/// <summary> /// This method calculates the vector with the piezoelectric moment of inertia. /// </summary> /// <param name="piezoelectricProfile"></param> /// <param name="numberOfElements"></param> /// <param name="elementsWithPiezoelectric"></param> /// <param name="numberOfPiezoelectricsPerElement"></param> /// <returns></returns> public override async Task <double[]> CalculatePiezoelectricMomentOfInertia(RectangularProfile piezoelectricProfile, RectangularProfile beamProfile, uint numberOfElements, uint[] elementsWithPiezoelectric, uint numberOfPiezoelectricsPerElement) { double momentOfInertia; if (numberOfPiezoelectricsPerElement <= 2 || numberOfPiezoelectricsPerElement > 0) { momentOfInertia = numberOfPiezoelectricsPerElement * ((Math.Pow(piezoelectricProfile.Height, 3) * piezoelectricProfile.Width / 12) + (piezoelectricProfile.Height * piezoelectricProfile.Width * Math.Pow((beamProfile.Height + piezoelectricProfile.Height) / 2, 2))); } else { throw new NotImplementedException($"Not implemented moment of inertia calculation to number of piezoelectric:{numberOfPiezoelectricsPerElement}."); } return(await ArrayFactory.CreateVectorAsync(momentOfInertia, numberOfElements, elementsWithPiezoelectric).ConfigureAwait(false)); }
/// <summary> /// This method calculates the vector with the beam moment of inertia. /// </summary> /// <param name="profile"></param> /// <param name="numberOfElements"></param> /// <returns></returns> public override async Task <double[]> CalculateMomentOfInertia(RectangularProfile profile, uint numberOfElements) { double momentOfInertia; if (profile.Thickness == null) { momentOfInertia = Math.Pow(profile.Height, 3) * profile.Width / 12; } else { momentOfInertia = (Math.Pow(profile.Height, 3) * profile.Width - (Math.Pow(profile.Height - 2 * profile.Thickness.Value, 3) * (profile.Width - 2 * profile.Thickness.Value))) / 12; } return(await ArrayFactory.CreateVectorAsync(momentOfInertia, numberOfElements).ConfigureAwait(false)); }
/// <summary> /// This method calculates the vector with the beam or piezoelectric area. /// </summary> /// <param name="profile"></param> /// <param name="numberOfElements"></param> /// <returns></returns> public override async Task <double[]> CalculateArea(RectangularProfile profile, uint numberOfElements) { double area; if (profile.Thickness == null) { area = profile.Height * profile.Width; } else { area = (profile.Height * profile.Width) - ((profile.Height - 2 * profile.Thickness.Value) * (profile.Width - 2 * profile.Thickness.Value)); } return(await ArrayFactory.CreateVectorAsync(area, numberOfElements).ConfigureAwait(false)); }
/// <summary> /// This method creates a new instance of class <see cref="BeamWithDva{TProfile}"/>. /// This is a step to create the input fot finite element analysis. /// </summary> /// <param name="request"></param> /// <param name="degreesOfFreedom"></param> /// <returns>A new instance of class <see cref="Beam{TProfile}"/>.</returns> public override async Task <BeamWithDva <TProfile> > BuildBeam(BeamWithDvaRequest <TProfile> request, uint degreesOfFreedom) { double[] dvaMasses = new double[request.Dvas.Count]; double[] dvaStiffnesses = new double[request.Dvas.Count]; uint[] dvaNodePositions = new uint[request.Dvas.Count]; int i = 0; foreach (DynamicVibrationAbsorber dva in request.Dvas) { dvaMasses[i] = dva.Mass; dvaStiffnesses[i] = dva.Stiffness; dvaNodePositions[i] = dva.NodePosition; i += 1; } GeometricProperty geometricProperty = new GeometricProperty(); if (request.Profile.Area != 0 && request.Profile.MomentOfInertia != 0) { geometricProperty.Area = await ArrayFactory.CreateVectorAsync(request.Profile.Area.Value, request.NumberOfElements).ConfigureAwait(false); geometricProperty.MomentOfInertia = await ArrayFactory.CreateVectorAsync(request.Profile.MomentOfInertia.Value, request.NumberOfElements).ConfigureAwait(false); } else { geometricProperty.Area = await this._geometricProperty.CalculateArea(request.Profile, request.NumberOfElements).ConfigureAwait(false); geometricProperty.MomentOfInertia = await this._geometricProperty.CalculateMomentOfInertia(request.Profile, request.NumberOfElements).ConfigureAwait(false); } var beam = new BeamWithDva <TProfile>() { DvaMasses = dvaMasses, DvaNodePositions = dvaNodePositions, DvaStiffnesses = dvaStiffnesses, Fastenings = await this._mappingResolver.BuildFastenings(request.Fastenings).ConfigureAwait(false), Forces = await this._mappingResolver.BuildForceVector(request.Forces, degreesOfFreedom + (uint)request.Dvas.Count).ConfigureAwait(false), GeometricProperty = geometricProperty, Length = request.Length, Material = MaterialFactory.Create(request.Material), NumberOfElements = request.NumberOfElements, Profile = request.Profile }; return(beam); }
/// <summary> /// This method calculates the vector with the piezoelectric area. /// </summary> /// <param name="profile"></param> /// <param name="numberOfElements"></param> /// <param name="numberOfPiezoelectricPerElement"></param> /// <returns></returns> public override async Task <double[]> CalculatePiezoelectricArea(RectangularProfile profile, uint numberOfElements, uint[] elementsWithPiezoelectric, uint numberOfPiezoelectricPerElement) { double area; if (profile.Thickness == null) { area = profile.Height * profile.Width; } else { area = (profile.Height * profile.Width) - ((profile.Height - 2 * profile.Thickness.Value) * (profile.Width - 2 * profile.Thickness.Value)); } area *= numberOfPiezoelectricPerElement; return(await ArrayFactory.CreateVectorAsync(area, numberOfElements, elementsWithPiezoelectric).ConfigureAwait(false)); }
/// <summary> /// This method creates a new instance of class <see cref="BeamWithPiezoelectric{TProfile}"/>. /// This is a step to create the input fot finite element analysis. /// </summary> /// <param name="request"></param> /// <param name="degreesOfFreedom"></param> /// <returns>A new instance of class <see cref="BeamWithPiezoelectric{TProfile}"/>.</returns> public override async Task <BeamWithPiezoelectric <TProfile> > BuildBeam(BeamWithPiezoelectricRequest <TProfile> request, uint degreesOfFreedom) { GeometricProperty geometricProperty = new GeometricProperty(); GeometricProperty piezoelectricGeometricProperty = new GeometricProperty(); uint numberOfPiezoelectricPerElements = PiezoelectricPositionFactory.Create(request.PiezoelectricPosition); uint[] elementsWithPiezoelectric = request.ElementsWithPiezoelectric ?? this.CreateVectorWithAllElements(request.NumberOfElements); // Calculating beam geometric properties. if (request.Profile.Area != null && request.Profile.MomentOfInertia != null) { geometricProperty.Area = await ArrayFactory.CreateVectorAsync(request.Profile.Area.Value, request.NumberOfElements).ConfigureAwait(false); geometricProperty.MomentOfInertia = await ArrayFactory.CreateVectorAsync(request.Profile.MomentOfInertia.Value, request.NumberOfElements).ConfigureAwait(false); } else { geometricProperty.Area = await this._geometricProperty.CalculateArea(request.Profile, request.NumberOfElements).ConfigureAwait(false); geometricProperty.MomentOfInertia = await this._geometricProperty.CalculateMomentOfInertia(request.Profile, request.NumberOfElements).ConfigureAwait(false); } // Calculating piezoelectric geometric properties. if (request.PiezoelectricProfile.Area != null && request.PiezoelectricProfile.MomentOfInertia != null) { double area = request.PiezoelectricProfile.Area.Value * numberOfPiezoelectricPerElements; double momentOfInertia = request.PiezoelectricProfile.MomentOfInertia.Value * numberOfPiezoelectricPerElements; piezoelectricGeometricProperty.Area = await ArrayFactory.CreateVectorAsync(area, request.NumberOfElements, elementsWithPiezoelectric).ConfigureAwait(false); piezoelectricGeometricProperty.MomentOfInertia = await ArrayFactory.CreateVectorAsync(momentOfInertia, request.NumberOfElements, elementsWithPiezoelectric).ConfigureAwait(false); } else { piezoelectricGeometricProperty.Area = await this._geometricProperty.CalculatePiezoelectricArea(request.PiezoelectricProfile, request.NumberOfElements, elementsWithPiezoelectric, numberOfPiezoelectricPerElements).ConfigureAwait(false); piezoelectricGeometricProperty.MomentOfInertia = await this._geometricProperty.CalculatePiezoelectricMomentOfInertia(request.PiezoelectricProfile, request.Profile, request.NumberOfElements, elementsWithPiezoelectric, numberOfPiezoelectricPerElements).ConfigureAwait(false); } var beam = new BeamWithPiezoelectric <TProfile>() { DielectricConstant = request.DielectricConstant, DielectricPermissiveness = request.DielectricPermissiveness, ElasticityConstant = request.ElasticityConstant, ElectricalCharge = new double[request.NumberOfElements + 1], ElementsWithPiezoelectric = elementsWithPiezoelectric, Fastenings = await this._mappingResolver.BuildFastenings(request.Fastenings).ConfigureAwait(false), Forces = await this._mappingResolver.BuildForceVector(request.Forces, degreesOfFreedom).ConfigureAwait(false), GeometricProperty = geometricProperty, Length = request.Length, Material = MaterialFactory.Create(request.Material), NumberOfElements = request.NumberOfElements, NumberOfPiezoelectricPerElements = numberOfPiezoelectricPerElements, PiezoelectricConstant = request.PiezoelectricConstant, PiezoelectricDegreesOfFreedom = request.NumberOfElements + 1, PiezoelectricGeometricProperty = piezoelectricGeometricProperty, PiezoelectricProfile = request.PiezoelectricProfile, PiezoelectricSpecificMass = request.PiezoelectricSpecificMass, PiezoelectricYoungModulus = request.PiezoelectricYoungModulus, Profile = request.Profile }; return(beam); }