### Installing BJSFM Python Library Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Command to install the BJSFM library using pip, the Python package installer. This is the standard way to get the library from PyPI. ```shell pip install bjsfm ``` -------------------------------- ### Starting BJSFM Command-Line Interface - Shell Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Command to launch the interactive command-line interface (CLI) for the BJSFM library. This provides an alternative way to interact with the library's functionalities without writing Python scripts. ```shell python bjsfm ``` -------------------------------- ### Compile Fortran with f2py (Shell) Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/dev.rst This command compiles the lekhnitskii.f Fortran file into a Python module named lekhnitskii_f using numpy.f2py. It should be executed in a console after navigating to the /tests/fortran directory within the project. A Fortran compiler like GFortran is required. ```Shell python -m numpy.f2py -c -m lekhnitskii_f lekhnitskii.f ``` -------------------------------- ### Installing BJSFM Python Package via Pip Source: https://github.com/benjaminetaylor/bjsfm/blob/master/README.md This command uses the pip package installer to download and install the latest version of the `bjsfm` library from the Python Package Index (PyPI). This is the standard method for installing Python packages. ```shell pip install bjsfm ``` -------------------------------- ### Initializing Max Strain Analysis Object - Python Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Imports the MaxStrain class and creates an instance for performing a Max Strain failure analysis. It requires the material A-matrix, thickness, diameter, and dictionaries of strain allowables for tension (et), compression (ec), and shear (es) at different angles. ```python from bjsfm.analysis import MaxStrain # create analysis with fake strain allowables analysis = MaxStrain( a_matrix, thickness, diameter, # allowables dictionary format {: } et={0:0.004, 90:0.004, 45:0.004, -45:0.004}, ec={0:0.005, 90:0.005, 45:0.005, -45:0.005}, es={0:0.003, 90:0.003, 45:0.003, -45:0.003}, ) ``` -------------------------------- ### Running Max Strain Analysis - Python Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Executes the Max Strain analysis using the analyze method of the MaxStrain object. It takes bearing loads (bearing), bypass loads (bypass), characteristic distance (rc), number of points (num), and plate width (w) as input. Returns an array containing analysis results. ```python bearing = [100, 0] #[Px, Py] bypass = [300, 0, 0] #[Nx, Ny, Nxy] # w=0 for infinite plate analysis.analyze(bearing, bypass, rc=step, num=num_pnts, w=0.) ``` -------------------------------- ### Creating Lekhnitskii's Solution Objects - Python Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Imports UnloadedHole and LoadedHole classes from bjsfm.lekhnitskii to model infinite plates with holes under bypass and bearing loads, respectively. Requires the inverse A-matrix, diameter, thickness, and load values. The bearing load requires an angle. ```python from bjsfm.lekhnitskii import UnloadedHole, LoadedHole a_inv = np.linalg.inv(a_matrix) bypass = [100., 50., 25.] # [Nx, Ny, Nxy] lb/in bearing = 100. # bearing force [lb] alpha = 25. # bearing angle [deg] byp = UnloadedHole(bypass, diameter, thickness, a_inv) brg = LoadedHole(bearing, diameter, thickness, a_inv, theta=np.deg2rad(alpha)) ``` -------------------------------- ### Defining Common Inputs for BJSFM Analysis - Python Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Defines common input parameters required for BJSFM analyses, such as the material A-matrix, laminate thickness, hole diameter, characteristic distance, and number of points around the hole. Uses the NumPy library for array handling. ```python import numpy as np # A-matrix from CLPT a_matrix = np.array( [[988374.5, 316116.9, 0.], [316116.9, 988374.5, 0.], [0., 0., 336128.8]] ) thickness = 0.0072*16 # laminate thickness [in] diameter = 0.25 # diameter [in] step = 0.015 # characteristic distance [in] num_pnts = 100 # number of points around hole ``` -------------------------------- ### Performing Max Strain Analysis with BJSFM in Python Source: https://github.com/benjaminetaylor/bjsfm/blob/master/README.md This snippet demonstrates the basic usage of the `MaxStrain` class from the `bjsfm` library. It initializes an analysis object with material properties and geometry, then calculates stresses, strains, and displacements at points around a hole under combined bearing and bypass loads. Finally, it shows how to generate a stress plot. ```python from bjsfm.analysis import MaxStrain a_matrix = [[988374.5, 316116.9, 0.], [316116.9, 988374.5, 0.], [0., 0., 336128.8]] thickness = 0.1152 diameter = 0.25 analysis = MaxStrain(a_matrix, thickness, diameter) # get stresses, strains and displacements at four points around hole bearing = [100, 0] #[Px, Py] bypass = [100, 0, 0] #[Nx, Ny, Nxy] analysis.stresses(bearing, bypass, num=4) analysis.strains(bearing, bypass, num=4) analysis.displacements(bearing, bypass, num=4) # plot stresses analysis.plot_stress(bearing, bypass) ``` -------------------------------- ### Plotting Lekhnitskii Stress Fields - Python Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Imports the plotting module from bjsfm and uses the plot_stress function to visualize the stress fields calculated by the Lekhnitskii solution objects (brg and byp). ```python from bjsfm import plotting plotting.plot_stress(brg, byp) ``` -------------------------------- ### Performing Max Strain Analysis with BJSFM Source: https://github.com/benjaminetaylor/bjsfm/blob/master/README_pypi.rst This snippet demonstrates how to initialize a MaxStrain analysis object with material properties (a_matrix, thickness, diameter) and then calculate stresses, strains, and displacements at specified points around a hole under combined bearing and bypass loads. It also shows how to plot the stress distribution. Required inputs include the anisotropic stiffness matrix, material thickness, hole diameter, and bearing/bypass load vectors. ```python from bjsfm.analysis import MaxStrain a_matrix = [[988374.5, 316116.9, 0.], [316116.9, 988374.5, 0.], [0., 0., 336128.8]] thickness = 0.1152 diameter = 0.25 analysis = MaxStrain(a_matrix, thickness, diameter) # get stresses, strains and displacements at four points around hole bearing = [100, 0] #[Px, Py] bypass = [100, 0, 0] #[Nx, Ny, Nxy] analysis.stresses(bearing, bypass, num=4) analysis.strains(bearing, bypass, num=4) analysis.displacements(bearing, bypass, num=4) # plot stresses analysis.plot_stress(bearing, bypass) ``` -------------------------------- ### Calculating and Combining Stresses from Lekhnitskii Solutions - Python Source: https://github.com/benjaminetaylor/bjsfm/blob/master/docs/source/index.rst Calculates stress fields around the hole for both bypass and bearing load cases using the stress method of the respective objects. It defines points in polar coordinates (r, theta) and converts them to Cartesian (x, y) before obtaining stresses. The total stress is the sum of the two components. ```python r = np.array([diameter/2 + step] * num_pnts) theta = np.linspace(0, 2 * np.pi, num=num_pnts, endpoint=False) x = r * np.cos(theta) y = r * np.sin(theta) byp_stress = byp.stress(x, y) brg_stress = brg.stress(x, y) total_stress = byp_stress + brg_stress # use total stress for failure calculations ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.