NaxToPy.Modules.Fasteners package#
Submodules#
NaxToPy.Modules.Fasteners.N2PGetFasteners module#
- class NaxToPy.Modules.Fasteners.N2PGetFasteners.N2PGetFasteners[source]#
Bases:
object
Class used to obtain all necessary geometrical information of a model’s N2PJoints, N2PBolts and N2PPlates.
The instance of this class must be prepared using its properties before calling it method calculate.
- property GetAttachmentsBool: bool#
Sets if the get_attachments() method will be used inside method calculate().
- property GlobalIDList: list[int]#
List of the internal/global IDs of the 1D elements that make up the bolts to be loaded.
- property ListAttachments: list[N2PAttachment]#
List of all N2PAttachments.
- property Model: N2PModelContent#
Model to be analyzed. It is a compulsory input and an error will occur if it is not present.
- property PartID: str#
Part ID of the 1D elements to be loaded. If this is present, solver_id_list must also be present.
- property SolverIDList: list[int]#
List of the Solver IDs of the 1D elements that make up the bolts to be loaded. If this is present, part_id must also be present.
- property SolverIDsAndParts: str#
Solver ID1, SolverID2, …” of the part ID and solver IDs of the 1D elements that make up the bolts to be loaded. Note that the part ID number is an integer, not a string.
- Type:
String in the form “Part ID number
- property Thresh: float#
Tolerance used in the obtention of the N2Joints in C#. 2.0 by default.
- __init__()[source]#
The constructor creates an empty N2PGetFasteners instance. Its attributes must be added as properties.
- Calling example:
>>> import NaxToPy as n2p >>> from NaxToPy.Modules.Fasteners.N2PGetFasteners import N2PGetFasteners >>> model1 = n2p.load_model("route.fem") # model loaded from N2PModelContent >>> fasteners = N2PGetFasteners() >>> # Compulsory input >>> fasteners.Model = model1 >>> # Custom threshold is selected (optional) >>> fasteners.Thresh = 1.5 >>> # Only some joints are to be analyzed (optional) >>> fasteners.GlobalIDList = [10, 11, 12, 13, 14] >>> # attachments will not be obtained >>> fasteners.GetAttachmentsBool = False # True by default >>> # fasteners are obtained >>> fasteners.calculate()
- calculate() None [source]#
Method used to do all the previous calculations.
- Calling example:
>>> fasteners.calculate()
- get_attachments() None [source]#
Method used to obtain the list of N2PAttachments and calculate their pitch. The get_joints() method must be used before this one. Otherwise, an error will occur.
- Calling example:
>>> fasteners.get_attachments()
- get_distance() None [source]#
Method used to obtain the distance from every N2PPlate’s edge to its N2PJoint, the intersection between an N2PPlate and its N2PJoint and the perpendicular direction to the N2PPlates. The get_joints() method must be used before this one. Otherwise, an error will occur.
- Calling example:
>>> fasteners.get_distance()
- get_joints() None [source]#
This method is used to create all N2PJoints, N2PPlates and N2PBolts and assign them certain useful attributes. In order to work, the n2joints and model attributes must have been previously filled. If they have not, an error will occur.
- The following steps are followed:
1. All N2Joints are created differently depending on the user’s inputs. 1. All N2PJoints are created. Inside this, all N2PBolts and N2PPlates associated to each N2PJoint are also created. 2. All N2PBolts, N2PPlates are assigned its corresponding N2PElements and N2PNodes. Also, N2PJoints are assigned its bolt’s N2PElements and N2PNodes, as well as its plates’ N2PElements and N2PNodes.
- Calling example:
>>> fasteners.get_joints()
NaxToPy.Modules.Fasteners.N2PGetLoadFasteners module#
- class NaxToPy.Modules.Fasteners.N2PGetLoadFasteners.N2PGetLoadFasteners[source]#
Bases:
object
Class used to calculate joints’ forces and bypass loads.
The instance of this class must be prepared using its properties before calling it method calculate.
- property AdjacencyLevel: int#
Number of adjacent elements that are loaded into the model. 4 by default.
- property AnalysisName: Literal['NAXTOPY', 'ALTAIR']#
Name of the CSV file where the results are to be exported.
- property BypassParameters: dict#
Dictionary with the parameters used in the bypass loads calculation. Even though the user may change any of these parameters, it is not recomended.
- property CornerData: bool#
Whether there is data on the corners or not to extract the results. False by default.
- property DefaultDiameter: float#
Diameter to be applied to joints with no previously assigned diameter.
- property ExportLocation: str#
Path where the results are to be exported.
- property GetFasteners: N2PGetFasteners#
N2PGetFasteners model. Either this, or both _list_joints and _model, is a compulsory input and an error will occur if this is not present.
- property ListJoints: list[N2PJoint]#
List of N2PJoints to be analyzed. Either both this and _model, or get_fasteners, are compulsory inputs and an error will occur if they are not present.
- property LoadCases: list[int]#
List of the IDs of the load cases to be analyzed. If no list is given, it is assumed that all load cases should be analyzed.
- property Model: N2PModelContent#
Model to be analyzed. Either both this and _list_joints, or _get_fasteners, are compulsory inputs and an error will occur if they are not present.
- property Results: dict#
Results obtained in get_results_joints().
- property ResultsFiles: list[str]#
List of paths of OP2 results files. It is a compulsory input unless the model loaded in model or in get_fasteners has results loaded in.
- property TypeExport: str#
Whether the results are exported in the NaxToPy style or in the Altair style.
- __init__()[source]#
The constructor creates an empty N2PGetLoadFasteners instance. Its attributes must be added as properties.
- Calling example:
>>> import NaxToPy as n2p >>> from NaxToPy.Modules.Fasteners.N2PGetFasteners import N2PGetFasteners >>> from NaxToPy.Modules.Fasteners.N2PGetLoadFasteners import N2PGetLoadFasteners >>> model1 = n2p.get_model(route.fem) # model loaded >>> fasteners = N2PGetFasteners() >>> fasteners.Model = model1 # compulsory input >>> fasteners.Thresh = 1.5 # a custom threshold is selected (optional) >>> fasteners.GlobalIDList = [10, 11, 12, 13, 14] # Only some joints are to be analyzed (optional) >>> fasteners.GetAttachmentsBool = False # attachments will not be obtained (optional) >>> fasteners.calculate() # fasteners are obtained >>> fasteners.ListJoints[0].Diameter = 6.0 # this joint is assigned a certain diameter >>> loads = N2PGetLoadFasteners() >>> loads.GetFasteners = fasteners # compulsory input >>> loads.ResultsFiles = [r"route1.op2", r"route2.op2", r"route3.op2"] # the desired results files are loaded >>> loads.AdjacencyLevel = 3 # a custom adjacency level is selected (optional) >>> loads.LoadCases = [1, 2, 133986] # list of load cases' ID to be analyzed (optional) >>> loads.CornerData = True # the previous load cases have corner data (optional) >>> # some bypass parameters are changed (optional and not recommended) >>> loads.BypassParameters = {"max iterations" = 50, "PROJECTION TOLERANCE" = 1e-6} >>> loads.DefaultDiameter = 3.6 # joints with no previously assigned diameter will get this diameter (optional) >>> loads.AnalysisName = "Analysis_1" # name of the CSV file where the results will be exported (optional) >>> loads.ExportLocation = r"path" # results are to be exported to a certain path (optional) >>> loads.TypeExport = "Altair" # results will be exported in the Altair style (optional) >>> loads.calculate() # calculations will be made and results will be exported
- Instead of using loads.GetFasteners, the user could also set these attributes:
>>> loads.Model = model1 # the same model is loaded, compulsory input >>> loads.ListJoints = fasteners.ListJoints[0:10] # only a certain amount of joints is loaded, compulsory input >>> loadFasteners.calculate() # calculations will be made with all of the default parameters and, therefore, results will not be exported.
- calculate()[source]#
Method used to do all the previous calculations and, optionally, export the results.
- Calling example:
>>> loads.calculate()
- export_results()[source]#
Method used to export the obtained results to a CSV file.
- Calling example:
>>> loads.export_results()
- get_analysis_joints()[source]#
Method used to do the previous analysis and, optionally, export the results.
- Calling example:
>>> loads.get_analysis_joints()
- get_bypass_joints()[source]#
Method used to obtain the bypass loads of each joint. If an N2PJoint has no diameter, the default diameter is assigned (in case it has been defined by the user). In order to work, the results attribute must have been previously filled (by having called get_results_joints()). If it has not, an error will occur.
The following steps are followed:
If there are joints with no diameter, the default one is assigned.
2. If there are still joints with no diameter or negative diameter (which could happen if some joints did not have a diameter and no default diameter was given), these joints are removed from the list of joints, as well as their associated N2PBolts and N2PPlates, and an error is displayed. 3. The bypass loads of each (remaining) N2PJoint is calculated.
- Calling example:
>>> loads.get_bypass_joints(defaultDiameter = 4.8)
- get_forces_joints()[source]#
Method used to obtain the 1D forces of each joint. In order to work, the results attribute must have been previously filled (by having called get_results_joints()). If it has not, an error will occur.
- Calling example:
>>> loads.get_forces_joints()
- get_model()[source]#
Method used to load a new model with all of the results files and only certain elements.
The following steps are followed:
1. A new model is created that includes only the elements that make up the joints, as well as all elements adjacent to them in a certain radius as defined by the user. 2. Results files are imported to this new model. 3. Elements and their internal IDs are updated so that they correspond to the values of the new model.
- Calling example:
>>> loads.get_model()
- get_results_joints()[source]#
Method used to obtain the results of the model. If no load cases have been selected, then it is assumed that all load cases are to be analyzed. In order to work, the list_joints and model attributes must have been previously filled. If they have not, an error will occur.
The following steps are followed:
If no load cases have been selected by the user, all load cases in the model will be analyzed.
2. Results are obtained with the get_results() function. Its outputs are, (a), the results per se, and (b), the list of broken load cases, that is, the list of load cases that lack an important result. 3. If there are some broken load cases, they are removed from the _load_cases attribute and. If all load cases were broken (meaning that the current _load_cases attribute is empty), an error is displayed.
- Calling example:
>>> loads.get_results_joints()
NaxToPy.Modules.Fasteners.N2PUpdateFastener module#
- class NaxToPy.Modules.Fasteners.N2PUpdateFastener.N2PUpdateFastener(model: N2PModelContent, information: dict | list, id_list: list = None, stiffness_method: str = 'HUTH')[source]#
Bases:
object
This class stores information about fasteners and provides methods to update their stiffness and generate a new FEM Input File (.bdf, .fem, .dat, etc.) file with the updated data.
Fastener information can be input either as a dictionary (for a single type of fastener) or as a list of dictionaries (for multiple types). Each dictionary must include at least the keys for diameter [“D”] and elastic modulus [“E”]. Optional keys include head height [“h_head”], nut height [“h_nut”], Poisson ratio [“nu”], shear modulus [“G”], connection type (“bolt” or “rivet”) [“connection_type”], shear type (“simple” or “double”) [“shear_type”], and the beta value for Nelson method [“beta”].
IDs of fasteners to be updated can be provided as either a single list (for a single type of fastener) or as a list of lists (for multiple types). If no list of IDs is provided, all fasteners in the model will be updated.
When multiple types of fasteners are used, the order of the list of dictionaries must match the order of the list of ID lists to ensure proper mapping of variables.
Supported methods for stiffness calculation include HUTH, TATE_ROSENFELD, SWIFT, BOEING, GRUMMAN, and NELSON.
Example
Example 1:
>>> import NaxToPy as n2p >>> model = n2p.load_model("model.dat") >>> info1 = {"D": 4.8, ... "E": 110000} >>> info2 = {"D": 7.2, ... "E": 70000, ... "connection_type": "rivet", ... "shear_type": "double"} >>> ele1 = [1000, 1001, 1002] >>> ele2 = [2000, 2001, 2002] >>> update1 = N2PUpdateFastener(model, [info1, info2], [ele1, ele2], "BOEING") >>> update1.calculate() # This will update the model in memory with the information of the object. >>> model.ModelInputData.rebuild_file() # With the model updated, the model is rewritten
Example 2:
>>> model = n2p.load_model("model.dat") >>> update2 = N2PUpdateFastener(model, {}) # Create the object without information >>> update2.IDList = [3000, 3001, 3002] # Add the information using it properties >>> update2.StiffnessMethod = "GRUMMAN" >>> update2.FastenerInformation = {3000: {"D": 4.8, "E": 70000, "connection_type": "rivet"}, ... 3001: {"D": 6.8, "E": 70000, "connection_type": "bolt"}, ... 3002: {"D": 7.2, "E": 70000, "shear_type": "double"}} >>> update2.calculate() # This will update the model in memory with the information of the object. >>> model.ModelInputData.rebuild_file() # With the model updated, the model is rewritten
- property FastenerInformation: dict#
Returns the dictionary mapping each fastener with its properties
- property IDList: list | list[list]#
Returns the list of fasteners to be updated
- property InfoDicts: dict | list[dict]#
Returns the list of dictionaries containing the fastener information
- property StiffnessMethod: str#
Returns the name of the method used to calculate the fastener stiffness
Module contents#
Subpackages#
- NaxToPy.Modules.Fasteners.Joints package
- Submodules
- NaxToPy.Modules.Fasteners.Joints.N2PAttachment module
- NaxToPy.Modules.Fasteners.Joints.N2PBolt module
N2PBolt
N2PBolt.id
N2PBolt.one_dim_elems_id_list
N2PBolt.cards
N2PBolt.type
N2PBolt.joint
N2PBolt.elements
N2PBolt.element_local_system_force
N2PBolt.axial_force
N2PBolt.shear_force
N2PBolt.max_axial_force
N2PBolt.load_angle
N2PBolt.AxialForce
N2PBolt.Cards
N2PBolt.ElementLocalSystemForce
N2PBolt.Elements
N2PBolt.ElementsID
N2PBolt.ElementsInternalID
N2PBolt.ID
N2PBolt.Joint
N2PBolt.LoadAngle
N2PBolt.MaxAxialForce
N2PBolt.Nodes
N2PBolt.OneDimElemsIDList
N2PBolt.PartID
N2PBolt.ShearForce
N2PBolt.Type
- NaxToPy.Modules.Fasteners.Joints.N2PJoint module
N2PJoint
N2PJoint.diameter
N2PJoint.bolt
N2PJoint.plates
N2PJoint.attachment
N2PJoint.pitch
N2PJoint.Attachment
N2PJoint.Bolt
N2PJoint.BoltElements
N2PJoint.BoltElementsID
N2PJoint.BoltElementsInternalID
N2PJoint.BoltNodes
N2PJoint.Diameter
N2PJoint.ID
N2PJoint.PartID
N2PJoint.Pitch
N2PJoint.PlateElements
N2PJoint.PlateElementsID
N2PJoint.PlateElementsInternalID
N2PJoint.PlateNodes
N2PJoint.PlatePartID
N2PJoint.Plates
N2PJoint.TypeFastener
N2PJoint.export_forces()
N2PJoint.get_bypass_loads()
N2PJoint.get_distance()
N2PJoint.get_forces()
- NaxToPy.Modules.Fasteners.Joints.N2PPlate module
N2PPlate
N2PPlate.id
N2PPlate.global_id
N2PPlate.solver_id
N2PPlate.plate_central_cell_solver_id
N2PPlate.cards
N2PPlate.joint
N2PPlate.elements
N2PPlate.attachment_id
N2PPlate.intersection
N2PPlate.distance
N2PPlate.normal
N2PPlate.altair_force
N2PPlate.plates_force
N2PPlate.nx_bypass
N2PPlate.nx_total
N2PPlate.ny_bypass
N2PPlate.ny_total
N2PPlate.nxy_bypass
N2PPlate.nxy_total
N2PPlate.mx_total
N2PPlate.my_total
N2PPlate.mxy_total
N2PPlate.bypass_max
N2PPlate.bypass_min
N2PPlate.box_dimension
N2PPlate.box_system
N2PPlate.box_points
N2PPlate.box_fluxes
N2PPlate.AltairForce
N2PPlate.AttachmentID
N2PPlate.Bolt
N2PPlate.BoxDimension
N2PPlate.BoxFluxes
N2PPlate.BoxPoints
N2PPlate.BoxSystem
N2PPlate.BypassMax
N2PPlate.BypassMin
N2PPlate.Cards
N2PPlate.Distance
N2PPlate.Elements
N2PPlate.ElementsID
N2PPlate.ElementsInternalID
N2PPlate.GlobalID
N2PPlate.ID
N2PPlate.Intersection
N2PPlate.Joint
N2PPlate.MxTotal
N2PPlate.MxyTotal
N2PPlate.MyTotal
N2PPlate.Nodes
N2PPlate.Normal
N2PPlate.NxBypass
N2PPlate.NxTotal
N2PPlate.NxyBypass
N2PPlate.NxyTotal
N2PPlate.NyBypass
N2PPlate.NyTotal
N2PPlate.PartID
N2PPlate.PlateCentralCellSolverID
N2PPlate.PlatesForce
N2PPlate.SolverID
- Module contents