### Install Pynite with all features Source: https://github.com/jwock82/pynite/blob/main/docs/source/installation.md Use this command to install Pynite with all built-in visualization and reporting features. Omit '[all]' for a lighter installation. ```bash $ pip install PyniteFEA[all] ``` -------------------------------- ### Quick Start: Define and Analyze a Rectangular Plate Source: https://github.com/jwock82/pynite/blob/main/docs/source/plate.md This example demonstrates setting up a basic FE model with a rectangular plate, applying supports and loads, performing a linear analysis, and accessing results at the plate's center. Ensure materials and nodes are defined before adding plates. ```python from Pynite import FEModel3D model = FEModel3D() model.add_material('Conc', E=3_600_000.0, G=1_500_000.0, nu=0.2, rho=0.150) # Define rectangle corners in the XY plane n1 = model.add_node('N1', 0, 0, 0) n2 = model.add_node('N2', 10, 0, 0) n3 = model.add_node('N3', 10, 8, 0) n4 = model.add_node('N4', 0, 8, 0) # Add a rectangular plate (thickness = 0.5) p1 = model.add_plate('P1', n1, n2, n3, n4, t=0.5, material_name='Conc', kx_mod=1.0, ky_mod=1.0) # Edge supports along the west edge model.def_support('N1', support_DZ=True) model.def_support('N4', support_DZ=True) # Uniform surface pressure (downward) model.add_plate_surface_pressure('P1', pressure=-0.05, case='D') model.add_load_combo('D', {'D': 1.0}) model.analyze_linear() # Sample results at plate center (local coordinates x=width/2, y=height/2) mx, my, mxy = model.plates['P1'].moment(x=5.0, y=4.0, local=True, combo_name='D').flatten() qx, qy = model.plates['P1'].shear(x=5.0, y=4.0, local=True, combo_name='D').flatten() sx, sy, txy = model.plates['P1'].membrane(x=5.0, y=4.0, local=True, combo_name='D').flatten() ``` -------------------------------- ### Interactive Workflow Example Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md An example demonstrating a typical interactive workflow: creating a renderer, viewing the undeformed shape, adding deformation, updating the display, switching diagram types, and saving a screenshot. ```python from Pynite.Rendering import Renderer # or Pynite.Visualization # Create renderer my_rndr = Renderer(my_model) # View undeformed shape my_rndr.render_model() # Add deformation and quickly refresh my_rndr.deformed_shape = True my_rndr.deformed_scale = 20 my_rndr.update() # Switch diagram type my_rndr.member_diagrams = 'Mz' my_rndr.update() # Save result my_rndr.screenshot('mz_diagram.png') ``` -------------------------------- ### Install optional dependencies for Pynite Source: https://github.com/jwock82/pynite/blob/main/docs/source/installation.md These commands install individual optional dependencies that are included when using the '[all]' flag during Pynite installation. ```bash $ pip install matplotlib ``` ```bash $ pip install scipy ``` ```bash $ pip install pdfkit ``` ```bash $ pip install jinja2 ``` ```bash $ pip install vtk ``` ```bash $ pip install pyvista[all,trame] ``` ```bash $ pip install ipywidgets ``` ```bash $ pip install trame_jupyter_extension ``` -------------------------------- ### Install Sympy for derivation viewing Source: https://github.com/jwock82/pynite/blob/main/docs/source/installation.md Install Sympy if you wish to view the mathematical derivations used in Pynite's development. ```bash $ pip install sympy ``` -------------------------------- ### Install VTK for visualization Source: https://github.com/jwock82/pynite/wiki/1.-Getting-Started Install VTK if you plan to use PyNite's visualization tools. Note that VTK requires a 64-bit Python version, and compatibility with the latest Python releases may lag. ```bash pip install vtk ``` -------------------------------- ### Install SciPy dependency Source: https://github.com/jwock82/pynite/wiki/1.-Getting-Started Install SciPy to enable PyNite's sparse matrix solver for improved performance and memory usage. This is recommended for most users. ```bash pip install scipy ``` -------------------------------- ### Worked Example: Cantilever Beam Analysis Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md A complete example demonstrating the creation of a cantilever beam, applying material and section properties, defining supports, applying loads, performing linear analysis, and querying/plotting results. ```python from Pynite import FEModel3D # Simple cantilever beam example model = FEModel3D() model.add_material('Steel', E=29_000_000.0, G=11_200_000.0, nu=0.3, rho=0.283) model.add_section('W12x26', A=7.65, Iy=17.3, Iz=204.0, J=0.300) n1 = model.add_node('N1', 0, 0, 0) n2 = model.add_node('N2', 10, 0, 0) # 10 units long m1 = model.add_member('M1', n1, n2, 'Steel', 'W12x26') # Fix the base model.def_support('N1', support_DX=True, support_DY=True, support_DZ=True, support_RX=True, support_RY=True, support_RZ=True) # Apply a downward tip load at the free end model.add_node_load('N2', 'FZ', -5.0, case='D') model.add_load_combo('D', {'D': 1.0}) model.analyze_linear() # Query common results Vmax = model.members['M1'].max_shear('Fz', 'D') Mmax = model.members['M1'].max_moment('Mz', 'D') dtip = model.members['M1'].deflection('dz', x=model.members['M1'].L(), combo_name='D') # Plot diagrams (requires matplotlib) # model.members['M1'].plot_shear('Fz', 'D', n_points=50) # model.members['M1'].plot_moment('Mz', 'D', n_points=50) # model.members['M1'].plot_deflection('dz', 'D', n_points=50) ``` -------------------------------- ### Import Libraries and Initialize Printing Source: https://github.com/jwock82/pynite/blob/main/Derivations/Beam Segment Equations (y-Axis Bending).ipynb Imports necessary SymPy and IPython display modules for symbolic mathematics and formatted output. Ensure SymPy is installed. ```python import sympy from sympy import * init_printing() from IPython.display import display ``` -------------------------------- ### Install PyNite using pip Source: https://github.com/jwock82/pynite/wiki/1.-Getting-Started Use this command to install the latest stable version of PyNite from PyPI. Ensure you include the 'FEA' suffix. ```bash pip install PyNiteFEA ``` -------------------------------- ### Worked Example: Model Creation and Analysis Source: https://github.com/jwock82/pynite/blob/main/docs/source/node.md Demonstrates creating a model, adding nodes, defining supports and enforced displacements, adding loads, performing linear analysis, and accessing results. ```python from Pynite import FEModel3D model = FEModel3D() n1 = model.add_node('N1', 0, 0, 0) n2 = model.add_node('N2', 0, 10, 0) # Pinned base and vertical settlement at the top model.def_support('N1', support_DX=True, support_DY=True, support_DZ=True) model.def_node_disp('N2', 'DY', -0.25) # Add a small horizontal force model.add_node_load('N2', 'FX', 2.0, case='S') model.add_load_combo('S', {'S': 1.0}) model.analyze_linear() print(model.nodes['N2'].DX['S']) # horizontal drift print(model.nodes['N1'].RxnFY['S']) # base vertical reaction ``` -------------------------------- ### Quick Start: Build and Analyze a 3D Model Source: https://github.com/jwock82/pynite/blob/main/docs/source/FEModel3D.md This snippet demonstrates the basic workflow for creating a 3D structural model, defining geometry, materials, sections, supports, loads, and performing a linear analysis. It also shows how to access results. ```python # Import the modeling class from Pynite import FEModel3D # Create a new model model = FEModel3D() # Geometry model.add_node('N1', 0.0, 0.0, 0.0) model.add_node('N2', 3.0, 0.0, 0.0) model.add_material('A36', E=29_000_000.0, G=11_200_000.0, nu=0.3, rho=0.283) model.add_section('Wsect', A=10.0, Iy=100.0, Iz=200.0, J=5.0) m1 = model.add_member('M1', i_node='N1', j_node='N2', material_name='A36', section_name='Wsect') # Supports and loads model.def_support('N1', support_DX=True, support_DY=True, support_DZ=True, support_RY=True, support_RZ=True) model.add_node_load('N2', direction='FZ', P=-5.0, case='D') # Load combinations and analysis model.add_load_combo('1.0D', {'D': 1.0}) model.analyze_linear(log=False) # Results uz = model.nodes['N2'].DZ['1.0D'] rxn = model.nodes['N1'].RxnFZ['1.0D'] ``` -------------------------------- ### Generate a PDF Report with Pynite Source: https://github.com/jwock82/pynite/blob/main/docs/source/reporting.md Example of how to import the Reporting module and create a PDF report using the `create_report` method. Ensure `my_model` is defined and wkhtmltopdf is correctly configured. ```python # Import the reporting module from Pynite import Reporting # Create the report Reporting.create_report(my_model, output_filepath='./My Report.pdf', format='pdf') ``` -------------------------------- ### Import FEModel3D class Source: https://github.com/jwock82/pynite/wiki/1.-Getting-Started Import the main FEModel3D class from the PyNite library after installation. This class is central to creating finite element models. ```python from PyNite import FEModel3D ``` -------------------------------- ### Member Load Application Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Examples of how to add various types of loads to members, including point loads, distributed loads, and self-weight. It also explains the coordinate system conventions for loads. ```APIDOC ## Member Load Application ### Description This section details how to apply different types of loads to members within the Pynite model. It covers point loads, distributed loads (full or partial length, linearly varying), and self-weight. The distinction between local and global coordinate systems for load application is also explained. ### Methods #### `add_member_pt_load(member_label, direction, magnitude, location, load_type)` - **member_label** (str) - The label of the member to apply the load to. - **direction** (str) - The direction of the load. Use 'My' for local y-direction, 'FY' for global Y-direction, etc. - **magnitude** (float) - The magnitude of the point load. - **location** (float) - The distance from the start of the member where the load is applied. - **load_type** (str) - The classification of the load (e.g., 'SL' for snow load). ### Request Example ```python my_model.add_member_pt_load('M2', 'My', 15, 4, 'SL') ``` #### `add_member_dist_load(member_label, direction, magnitude1, magnitude2, location1, location2, load_type)` - **member_label** (str) - The label of the member to apply the load to. - **direction** (str) - The direction of the distributed load. Use 'Fy' for local y-direction, 'FY' for global Y-direction, etc. - **magnitude1** (float) - The magnitude of the load at `location1`. - **magnitude2** (float) - The magnitude of the load at `location2`. - **location1** (float) - The distance from the start of the member where the load starts. - **location2** (float) - The distance from the start of the member where the load ends. - **load_type** (str) - The classification of the load (e.g., 'DL' for dead load). ### Request Example ```python my_model.add_member_dist_load('M1', 'Fy', -0.100, -0.200, 2, 5, 'DL') ``` #### `add_member_self_weight(direction, multiplier, load_type)` - **direction** (str) - The direction of the self-weight. Use 'FY' for global Y-direction, etc. - **multiplier** (float) - A multiplier to adjust the self-weight (e.g., 1.10 for 10% additional weight). - **load_type** (str) - The classification of the load (e.g., 'DL' for dead load). ### Request Example ```python my_model.add_member_self_weight('FY', 1.10, 'DL') ``` ### Coordinate Systems Loads can be applied in member local directions ('Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz') or model global directions ('FX', 'FY', 'FZ', 'MX', 'MY', 'MZ'). Capitalization distinguishes between local and global systems. ``` -------------------------------- ### Access Analysis Results Source: https://github.com/jwock82/pynite/blob/main/docs/source/FEModel3D.md Retrieves results from the performed analysis. This example accesses the Z-displacement (DZ) of node 'N2' and the reaction force (RxnFZ) at node 'N1' for the '1.0D' load combination. ```python uz = model.nodes['N2'].DZ['1.0D'] rxn = model.nodes['N1'].RxnFZ['1.0D'] ``` -------------------------------- ### Define Nodal Support Source: https://github.com/jwock82/pynite/blob/main/docs/source/FEModel3D.md Defines boundary conditions for a node, restricting its translational and rotational degrees of freedom. This example fixes all degrees of freedom for node 'N1'. ```python model.def_support('N1', support_DX=True, support_DY=True, support_DZ=True, support_RY=True, support_RZ=True) ``` -------------------------------- ### Display Moment Diagram in Z-Direction Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Visualize internal forces and moments on members. This example displays a moment diagram in the z-direction. Adjust `diagram_scale` to control the size of the diagram. ```python # Display a moment diagram in the z-direction my_rndr.member_diagrams = 'Mz' my_rndr.diagram_scale = 30 # Adjust diagram size (default: 30) my_rndr.render_model() ``` -------------------------------- ### Display Axial Force Diagrams with Custom Scale Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Example of displaying axial force diagrams with a custom scale. Larger values for `diagram_scale` result in more prominent diagrams and labels. ```python # Example: Display axial force diagrams with custom scale my_rndr.member_diagrams = 'Fx' my_rndr.diagram_scale = 50 # Larger diagrams with larger labels my_rndr.render_model() ``` -------------------------------- ### Define End Releases for Member (Simplified Integer) Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md An alternative simplified method for defining end releases using integer values (0 for released, 1 for fixed). This example simulates a pin-ended member. ```python # This next line is yet another simple way to do the same thing my_model.def_releases('M1', 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1) ``` -------------------------------- ### Add Load Combination Source: https://github.com/jwock82/pynite/blob/main/docs/source/FEModel3D.md Defines a load combination by specifying factors for different load cases. This example creates a combination named '1.0D' with a factor of 1.0 for load case 'D'. ```python model.add_load_combo('1.0D', {'D': 1.0}) ``` -------------------------------- ### Define End Releases for Member (Full Specification) Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Apply end releases to a member to simulate pinned connections or other end conditions. This example shows the full specification for releasing all degrees of freedom at both ends. ```python # The following line turns member M1 into a pin-ended member my_model.def_releases('M1', Dxi=False, Dyi=False, Dzi=False, Rxi=False, Ryi=True, Rzi=True, Dxj=False, Dyj=False, Dzj=False, Rxj=False, Ryj=True, Rzj=True) ``` -------------------------------- ### Define End Releases for Member (Simplified Boolean) Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md A simplified way to define end releases using boolean values for degrees of freedom. This example simulates a pin-ended member. ```python # This next line does the same thing as the previous line - just simplified my_model.def_releases('M1', False, False, False, False, True, True, False, False, False, False, True, True) ``` -------------------------------- ### Get Deflection at a Specific Point on Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Calculates the deflection value at a specific distance from the start of a member for a given load combination. ```python my_model.members['M2'].deflection('dy', 5, 'D+S') ``` -------------------------------- ### Renderer Initialization Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Demonstrates how to initialize both the recommended PyVista renderer and the alternative VTK renderer. ```APIDOC ## Renderer Initialization ### Description Initialize the Pynite `Renderer` object. You can choose between the recommended PyVista renderer or the alternative VTK renderer. ### PyVista Renderer (Recommended) ```python from Pynite.Rendering import Renderer my_rndr = Renderer(my_model) ``` ### VTK Renderer (Alternative) ```python from Pynite.Visualization import Renderer my_rndr = Renderer(my_model) ``` ``` -------------------------------- ### Get Moment at a Specific Point on Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Calculates the moment value at a specific distance from the start of a member for a given load combination. ```python my_model.members['M2'].moment('Mz', 5, '1.2D+1.6S') ``` -------------------------------- ### Get Shear at a Specific Point on Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Calculates the shear value at a specific distance from the start of a member for a given load combination. ```python my_model.members['M2'].shear('Fy', 5, '1.2D+1.6S') ``` -------------------------------- ### Run Basic Pushover Analysis Source: https://github.com/jwock82/pynite/blob/main/docs/source/pushover.md Executes a pushover analysis with specified parameters. Use this for a standard analysis run. ```python my_model.analyze_pushover(log=False, check_stability=True, push_combo='Push Combo', max_iter=30, tol=0.01, sparse=True, combo_tags=None) ``` -------------------------------- ### Import Libraries and Initialize Pretty Printing Source: https://github.com/jwock82/pynite/blob/main/Derivations/Rectangular Plate Element.ipynb Imports necessary Sympy and IPython display modules for symbolic math and formatted output. Call init_printing() to enable pretty printing of mathematical expressions. ```python from sympy import symbols, Matrix, diff, integrate, simplify, factor, latex, init_printing from IPython.display import display, Math init_printing() ``` -------------------------------- ### Model Visualization with VTK Source: https://github.com/jwock82/pynite/wiki/7.-Visualization PyNite utilizes the Visualization Toolkit (VTK) for 3D model visualization. Ensure you have a compatible VTK package installed (`pip install vtk`) and are using a 64-bit version of Python (3.7 is supported, 3.8 has no wrappers). ```APIDOC ## Model Visualization Setup ### VTK Installation To use PyNite's visualization tools, install the VTK package: ```bash pip install vtk ``` **Note:** VTK requires a 64-bit Python installation. Python 3.7 is supported; Python 3.8 currently lacks wrappers. ``` -------------------------------- ### Initialize PyVista Renderer Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Use this to initialize the PyVista renderer for most users. It requires a Pynite model object. ```python from Pynite.Rendering import Renderer my_renderer = Renderer(my_model) ``` -------------------------------- ### Getting Node Results Source: https://github.com/jwock82/pynite/blob/main/docs/source/node.md Retrieves analysis results for a specific node after an analysis has been run. ```APIDOC ## GET /api/nodes/{node_name}/results ### Description Retrieves various analysis results for a specified node, including displacements, rotations, and reactions. Results are keyed by load combination name. ### Method GET ### Endpoint `/api/nodes/{node_name}/results` ### Parameters #### Path Parameters - **node_name** (string) - Required - The name of the node to retrieve results for. #### Query Parameters - **load_combination** (string) - Required - The name of the load combination for which to retrieve results. ### Response #### Success Response (200) - **DX** (float) - Global displacement in the X direction for the specified load combination. - **DY** (float) - Global displacement in the Y direction for the specified load combination. - **DZ** (float) - Global displacement in the Z direction for the specified load combination. - **RX** (float) - Global rotation about the X axis for the specified load combination. - **RY** (float) - Global rotation about the Y axis for the specified load combination. - **RZ** (float) - Global rotation about the Z axis for the specified load combination. - **RxnFX** (float) - Global reaction force in the X direction for the specified load combination. - **RxnFY** (float) - Global reaction force in the Y direction for the specified load combination. - **RxnFZ** (float) - Global reaction force in the Z direction for the specified load combination. - **RxnMX** (float) - Global reaction moment about the X axis for the specified load combination. - **RxnMY** (float) - Global reaction moment about the Y axis for the specified load combination. - **RxnMZ** (float) - Global reaction moment about the Z axis for the specified load combination. ### Response Example ```json { "DX": 0.123, "DY": -0.456, "DZ": 0.789, "RX": 0.001, "RY": -0.002, "RZ": 0.003, "RxnFX": 10.5, "RxnFY": -20.2, "RxnFZ": 5.0, "RxnMX": 1.2, "RxnMY": -2.3, "RxnMZ": 3.4 } ``` ``` -------------------------------- ### Upgrade PyNite using pip Source: https://github.com/jwock82/pynite/wiki/1.-Getting-Started If PyNite is already installed, use this command to upgrade to the latest version. ```bash pip install --upgrade PyNiteFEA ``` -------------------------------- ### Tips and Common Patterns Source: https://github.com/jwock82/pynite/blob/main/docs/source/FEModel3D.md Provides guidance and common usage patterns for the Pynite library. ```APIDOC ## Tips and Common Patterns - **Load Directions:** Prefer global load directions (`FX`, `FY`, `FZ`) for self-weight and simple vertical/gravity loads. Use local directions (`Fx`, `Fy`, `Fz`) for member-centric loading. - **Load Combination Filtering:** Use `combo_tags` to select subsets of load combinations when calling analysis functions. - **Tension/Compression-Only Models:** For models with tension-only or compression-only elements, use the `analyze(...)` function with multiple `num_steps` to improve convergence. - **Sparse Solvers:** `sparse=True` generally leads to faster solutions for larger models. ``` -------------------------------- ### Get Node Results Source: https://github.com/jwock82/pynite/wiki/2.-Nodes Retrieves reaction forces and moments at a specified node for a given load combination. ```APIDOC ## GET /api/nodes/{node_name}/results ### Description Retrieves reaction forces and moments at a specified node for a given load combination. ### Method GET ### Endpoint /api/nodes/{node_name}/results ### Parameters #### Path Parameters - **node_name** (string) - Required - The name of the node for which to retrieve results. #### Query Parameters - **load_combination** (string) - Required - The name of the load combination (e.g., '1.2D+1.0W'). ### Response #### Success Response (200) - **RxnFY** (number) - The reaction force in the Y direction. - **RxnMZ** (number) - The reaction moment about the Z axis. #### Response Example ```json { "RxnFY": -123.45, "RxnMZ": 678.90 } ``` ``` -------------------------------- ### Access Member Geometry Properties Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Retrieve the length of a member or access its start ('i_node') and end ('j_node') node objects. ```python model.members['M'].L() ``` ```python model.members['M'].i_node ``` ```python model.members['M'].j_node ``` -------------------------------- ### Analyze a Simply Supported Beam with Uniform Load Source: https://github.com/jwock82/pynite/blob/main/docs/source/quickstart.md This snippet demonstrates how to model a simply supported beam, apply a uniform distributed load, and analyze its shear, moment, and deflection diagrams. It also shows how to retrieve reactions and visualize the deformed shape. ```python # Example of a simply supported beam with a uniform distributed load. # Units used in this example are inches and kips # This example does not use load combinations. The program will create a # default load combindation called 'Combo 1' # Import `FEModel3D` from `Pynite` from Pynite import FEModel3D # Create a new finite element model beam = FEModel3D() # Add nodes (14 ft = 168 inches apart) beam.add_node('N1', 0, 0, 0) beam.add_node('N2', 168, 0, 0) # Define a material E = 29000 # Modulus of elasticity (ksi) G = 11200 # Shear modulus of elasticity (ksi) nu = 0.3 # Poisson's ratio rho = 2.836e-4 # Density (kci) beam.add_material('Steel', E, G, nu, rho) # Add a section with the following properties: # Iy = 100 in^4, Iz = 150 in^4, J = 250 in^4, A = 20 in^2 beam.add_section('MySection', 20, 100, 150, 250) #Add a member beam.add_member('M1', 'N1', 'N2', 'Steel', 'MySection') # Provide simple supports beam.def_support('N1', True, True, True, False, False, False) beam.def_support('N2', True, True, True, True, False, False) # Add a uniform load of 200 lbs/ft to the beam (from 0 in to 168 in) beam.add_member_dist_load('M1', 'Fy', -200/1000/12, -200/1000/12, 0, 168) # Alternatively the following line would do apply the load to the full # length of the member as well # beam.add_member_dist_load('M1', 'Fy', -200/1000/12, -200/1000/12) # Analyze the beam beam.analyze() # Print the shear, moment, and deflection diagrams beam.members['M1'].plot_shear('Fy') beam.members['M1'].plot_moment('Mz') beam.members['M1'].plot_deflection('dy') # Print reactions at each end of the beam print(f"Left Support Reaction: { {k: float(v) for k, v in beam.nodes['N1'].RxnFY.items()} }") print(f"Right Support Reaction: { {k: float(v) for k, v in beam.nodes['N2'].RxnFY.items()} }") # Render the deformed shape of the beam magnified 100 times, with a text # height of 5 inches from Pynite.Visualization import Renderer renderer = Renderer(beam) renderer.annotation_size = 6 renderer.deformed_shape = True renderer.deformed_scale = 100 renderer.render_loads = True renderer.render_model() ``` -------------------------------- ### Add Member Moment Load Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Apply a moment load to a member about its weak axis at a specified distance from the start of the member. ```python # Add a moment load of 15 to member 'M2' about its weak axis at 4 units ``` -------------------------------- ### Initialize VTK Renderer Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Use this to initialize the VTK renderer for lightweight environments or specific VTK customization needs. It requires a Pynite model object. ```python from Pynite.Visualization import Renderer my_renderer = Renderer(my_model) ``` -------------------------------- ### Add Distributed Load to a Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Apply a distributed load along a portion of a member. Specify the starting and ending points and intensities. ```python FEModel3D.add_member_dist_load(member_name, direction, w1, w2, x1=None, x2=None, case='Case 1') ``` -------------------------------- ### Create Rectangular Quad Mesh and Add Openings Source: https://github.com/jwock82/pynite/blob/main/docs/source/meshes.md Demonstrates creating a rectangular quad mesh on the XZ plane, adding a rectangular opening, and then generating the mesh with supports and analysis. ```python from Pynite.FEModel3D import FEModel3D from Pynite.Mesh import RectangleMesh model = FEModel3D() model.add_material('Conc', E=3600*144, nu=0.2, rho=0.0) # example units # Add a rectangular mesh to the model model.add_rectangle_mesh( name='Slab', mesh_size = 2.0, width = 20.0, height = 25.0, thickness = 0.5, material_name = 'Conc', kx_mod = 1.0, ky_mod = 1.0, origin = [0, 0, 0], plane = 'XZ' ) # Rectangular meshes are unique, in that you can add openings to them model.meshes['Slab'].add_rect_opening( name = 'Opening 1', x_left = 5.0, # The mesh's local x-y coordinate system y_bott = 6.0, width = 5.0, height = 7.0 ) # Once all openings are defined the mesh can be generated model.meshes['Slab'].generate() # builds nodes/elements and adds them to the model # Now that the nodes and elements in the mesh have been generated, we can add supports. # Let's add fixed supports to the perimeter for node in model.meshes['Slab'].nodes.values(): # Check if the node lies on the perimeter if node.X == 0.0 or node.X == 20.0 or node.Z == 0.0 or node.Z == 25.0: # The mesh was generated in the XZ plane model.def_support(node.name, True, True, True, True, True, True) # Fix all degrees of freedom at the node # Solve the model model.analyze() # Solve the model, then query peak values by combo/tag slab = model.meshes['Slab']; mx_max = slab.max_moment('Mx', combo_tags=['service', 'strength']) # Check tagged combinations qy_min = slab.min_shear('Qy', combo_tags='Combo 1') # Check just one combination ``` -------------------------------- ### Get Maximum Torque from Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Retrieves the maximum torque value for a specified load combination from a member. Useful for checking torsional effects. ```python Tmax = my_model.members['M1'].max_torque('D+L') ``` -------------------------------- ### Get Node Results Source: https://github.com/jwock82/pynite/wiki/2.-Nodes Access node results like reactions and displacements from the `FEModel3D.Nodes` dictionary. Results are stored by load combination name. ```python print(myModel.Nodes['N2'].RxnFY['1.2D+1.0W']) print(myModel.Nodes['N3'].RxnMZ['1.2D+1.0W']) ``` -------------------------------- ### Create a new FEModel3D instance Source: https://github.com/jwock82/pynite/wiki/1.-Getting-Started Instantiate the FEModel3D class to begin creating a new finite element model. ```python myModel = FEModel3D() ``` -------------------------------- ### Node Creation and Access Source: https://github.com/jwock82/pynite/blob/main/docs/source/node.md Demonstrates how to add a new node to the model and access existing nodes. ```APIDOC ## FEModel3D.add_node ### Description Adds a new node to the FEModel3D with specified coordinates. ### Method `FEModel3D.add_node(name, X, Y, Z) -> str` ### Parameters - **name** (str) - Required - The unique name for the node. - **X** (float) - Required - The X-coordinate of the node. - **Y** (float) - Required - The Y-coordinate of the node. - **Z** (float) - Required - The Z-coordinate of the node. ### Returns - **str** - The name of the added node. ## Accessing Nodes ### Description Nodes are stored in a dictionary within the FEModel3D object and can be accessed by their name. ### Syntax `FEModel3D.nodes['node_name']` ``` -------------------------------- ### Get Axial Force at Midspan Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Calculates the axial force at the midspan of a member for a given load combination. Requires member length to determine midspan. ```python N_mid = my_model.members['M1'].axial(x=0.5*my_model.members['M1'].L(), combo_name='D') ``` -------------------------------- ### Analyze a 3D Portal Frame with Load Combinations Source: https://github.com/jwock82/pynite/blob/main/docs/source/quickstart.md This snippet models a 3D portal frame, applying dead and wind loads, and defining load combinations according to ASCE 7 LRFD. It demonstrates how to extract base reactions and member forces for a specific load combination. ```python from Pynite import FEModel3D # Create the model frame = FEModel3D() # Nodes: two column bases and two column tops (units: inches, kips) # N1 ---M3--- N2 (beam at top, 20 ft span) # | | # M1 M2 (columns, 12 ft tall) # | | # N3 N4 (fixed bases) frame.add_node('N1', 0, 12*12, 0) frame.add_node('N2', 20*12, 12*12, 0) frame.add_node('N3', 0, 0, 0) frame.add_node('N4', 20*12, 0, 0) # Material: structural steel frame.add_material('Steel', 29000, 11200, 0.3, 2.836e-4) # Section: W10x33 (approximate properties) # A=9.71 in^2, Iy=36.6 in^4, Iz=171 in^4, J=0.583 in^4 frame.add_section('W10x33', 9.71, 36.6, 171, 0.583) # Members: two columns and one beam frame.add_member('M1', 'N3', 'N1', 'Steel', 'W10x33') frame.add_member('M2', 'N4', 'N2', 'Steel', 'W10x33') frame.add_member('M3', 'N1', 'N2', 'Steel', 'W10x33') # Fixed supports at column bases frame.def_support('N3', True, True, True, True, True, True) frame.def_support('N4', True, True, True, True, True, True) # Loads # Dead load: uniform gravity on beam (500 plf = 0.0417 kip/in) frame.add_member_dist_load('M3', 'Fy', -0.5/12, -0.5/12, case='D') # Wind load: lateral point load at top-left node frame.add_node_load('N1', 'FX', 10, case='W') # Load combinations (ASCE 7 LRFD) frame.add_load_combo('1.4D', {'D': 1.4}) frame.add_load_combo('1.2D+1.0W', {'D': 1.2, 'W': 1.0}) # Run analysis frame.analyze(check_statics=True) # Print base reactions for the wind combination print('--- Base reactions (1.2D+1.0W) ---') for node_name in ['N3', 'N4']: node = frame.nodes[node_name] Rx = node.RxnFX['1.2D+1.0W'] Ry = node.RxnFY['1.2D+1.0W'] Mz = node.RxnMZ['1.2D+1.0W'] print(f'{node_name}: Rx={Rx:.2f} k, Ry={Ry:.2f} k, Mz={Mz:.1f} k-in') # Print peak beam forces beam = frame.members['M3'] print(f'\nBeam max moment: {beam.max_moment("Mz", "1.2D+1.0W")/12:.1f} k-ft') print(f'Beam max shear: {beam.max_shear("Fy", "1.2D+1.0W"):.2f} k') print(f'Beam max defl: {beam.min_deflection("dy", "1.2D+1.0W"):.4f} in') # Render the deformed shape from Pynite.Visualization import Renderer rndr = Renderer(frame) rndr.deformed_shape = True rndr.deformed_scale = 50 rndr.render_loads = True rndr.combo_name = '1.2D+1.0W' rndr.render_model() ``` -------------------------------- ### Get Minimum Deflection from Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Retrieves the minimum deflection value for a specified axis and load combination from a member. Useful for checking minimum displacement. ```python my_model.members['M3'].min_deflection('dz', 'D+L') ``` -------------------------------- ### Capture Render Window as Screenshot Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Captures the current render window as an image and saves it to the specified file path. ```python my_rndr.screenshot('path/to/output.png') ``` ```python my_rndr.screenshot('C:\\Users\\username\\Desktop\\model.png') ``` -------------------------------- ### Get Maximum Deflection from Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Retrieves the maximum deflection value for a specified axis and load combination from a member. Useful for checking serviceability limits. ```python my_model.members['M1'].max_deflection('dy', 'D') ``` -------------------------------- ### Coordinate Systems and Releases Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Information on using local vs. global coordinate systems and best practices for member releases. ```APIDOC ## Tips and Patterns ### Coordinate Systems - **Local Directions**: Lower-case abbreviations like `Fx`, `Fy`, `Fz` for forces and `Mx`, `My`, `Mz` for moments refer to the member's local axes. - **Global Directions**: Upper-case abbreviations like `FX`, `FY`, `FZ` for forces and `MX`, `MY`, `MZ` for moments refer to the global axes of the model. ### Member Releases - **Recommended Practice**: For pin-like ends, it is generally recommended to release only `Ry` and/or `Rz` (rotations about the local y and z axes). - **Caution**: Avoid releasing both axial degrees of freedom (`Dx`) and torsional degrees of freedom (`Rx`) at the same end unless you fully understand the implications for structural stability. ### Non-linear Analysis - For members exhibiting tension/compression-only behavior, it is advisable to use `FEModel3D.analyze(...)` with `num_steps > 1` instead of `analyze_linear()` to achieve better convergence. ``` -------------------------------- ### Get Minimum Moment from Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Retrieves the minimum moment value for a specified axis and load combination from a member. Useful for identifying minimum bending. ```python my_model.members['M3'].min_moment('My', '1.2D+1.6L') ``` -------------------------------- ### Get Maximum Moment from Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Retrieves the maximum moment value for a specified axis and load combination from a member. Useful for identifying peak bending. ```python my_model.members['M1'].max_moment('Mz', '1.4D') ``` -------------------------------- ### Switch Visual Theme Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Change the rendering theme to adjust the background and line colors. 'print' theme is suitable for publications. ```python my_rndr.theme = 'default' # Dark background (default) ``` ```python my_rndr.theme = 'print' # White background (better for publications) ``` -------------------------------- ### Define Custom Traces for Pushover Analysis Source: https://github.com/jwock82/pynite/blob/main/docs/source/pushover.md Sets up custom traces to monitor specific values during the pushover analysis. Traces are defined as callables that accept the combo_name. ```python traces = { 'M1 Moment': lambda combo_name: my_model.members['M1'].moment('Mz', x=96.0, combo_name=combo_name), 'Story Drift': lambda combo_name: my_model.nodes['N3'].DX[combo_name] - my_model.nodes['N1'].DX[combo_name], } my_model.analyze_pushover( push_combo='Push Combo', traces=traces, ) ``` -------------------------------- ### Get Minimum Shear from Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Retrieves the minimum shear value for a specified axis and load combination from a member. Use this to find the most negative shear. ```python my_model.members['M3'].min_shear('Fz', '1.2D+1.6L') ``` -------------------------------- ### Define Beam Variables and Equations Source: https://github.com/jwock82/pynite/blob/main/Derivations/Fixed End Reactions - Linear Distributed Load.ipynb Initializes symbolic variables for beam analysis and defines the slope-deflection equations for M1 and M2. Requires SymPy. ```python M1, M2, E, I, L, theta1, theta2, Delta1, Delta2 = symbols('M_1, M_2, E, I, L, theta_1, theta_2, Delta_1, Delta_2') FEM1, FEM2 = symbols('FEM_1, FEM_2') M1 = 2*E*I/L*(2*theta1 + theta2 - 3*(Delta2-Delta1)/L) + FEM1 M2 = 2*E*I/L*(2*theta2 + theta1 - 3*(Delta2-Delta1)/L) + FEM2 display(Eq(symbols('M_1'), M1)) display(Eq(symbols('M_2'), M2)) ``` -------------------------------- ### Define Member End Releases Source: https://github.com/jwock82/pynite/blob/main/docs/source/FEModel3D.md Specifies releases (e.g., moment, shear) at the ends of a member. This example shows how to define releases for both ends (i and j) of a member. ```python model.def_releases(member_name, Dxi=False, Dyi=False, Dzi=False, Rxi=False, Ryi=False, Rzi=False, Dxj=False, Dyj=False, Dzj=False, Rxj=False, Ryj=False, Rzj=False) ``` -------------------------------- ### Find Max/Min Moment Points Source: https://github.com/jwock82/pynite/blob/main/Derivations/Beam Segment Equations (y-Axis Bending).ipynb Calculate the derivative of the moment equation with respect to x and solve for x to find points of maximum or minimum moment. This may yield multiple solutions. ```python display(Eq(Derivative(symbols('M'), x), diff(M, x))) display(Eq(symbols('x_1'), solve(diff(M, x), symbols('x'))[0])) display(Eq(symbols('x_2'), solve(diff(M, x), symbols('x'))[1])) print(solve(diff(M, x), symbols('x'))[0]) print(solve(diff(M, x), symbols('x'))[1]) ``` -------------------------------- ### Load Combination Handling Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Explanation of how load combinations are handled, distinguishing between specific names and tags. ```APIDOC ## Load Combination Handling ### Description This section clarifies how load combinations are interpreted when passed to analysis and plotting methods. ### Interpretation of `combo_tags` Parameter - **Single String**: When a single string is provided (e.g., `'1.4D'`), it is treated as the exact name of a specific load combination. - **List of Strings**: When a list of strings is provided (e.g., `['Strength']`), each string is treated as a tag. The analysis or plot will then encompass all load combinations that are tagged with *any* of the tags in the list. ### Example ```python # Using a specific load combination name result = my_model.members['M1'].max_shear('Fy', '1.4D') # Using tags to envelope results across multiple combinations results_enveloped, governing_combo = my_model.members['M1'].max_shear('Fy', ['Strength', 'Service']) ``` ``` -------------------------------- ### Query Deflection Results Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Get deflection values (dx, dy, dz) at a specific location or the maximum/minimum deflection across load combinations. Supports enveloping. ```python deflection(Direction, x, combo_name='Combo 1') ``` ```python max_deflection(Direction, combo_tags='Combo 1') ``` ```python min_deflection(Direction, combo_tags='Combo 1') ``` ```python deflection_array(Direction, n_points, combo_name='Combo 1', x_array=None) ``` -------------------------------- ### Add Point Load to Member Source: https://github.com/jwock82/pynite/blob/main/docs/source/member.md Adds a point load to a specific member. Specify the member name, direction, magnitude, distance from the start, and load classification. ```python my_model.add_member_pt_load('M2', 'My', 15, 4, 'SL') ``` -------------------------------- ### Compare Multiple Load Cases Source: https://github.com/jwock82/pynite/blob/main/docs/source/rendering.md Iterate through a list of load cases, setting the `case` attribute for each. Render the model with the desired `member_diagrams` and save a screenshot for each case. ```python load_cases = ['Dead Load', 'Live Load', 'Wind Load'] for case_name in load_cases: my_rndr.case = case_name my_rndr.member_diagrams = 'Fx' my_rndr.render_model() my_rndr.screenshot(f'{case_name}.png') ``` -------------------------------- ### Run General Analysis in Pynite Source: https://github.com/jwock82/pynite/blob/main/docs/source/analysis.md Use the `FEModel3D.analyze()` method for general analysis. This method is iterative if tension-only or compression-only elements/supports are present. ```python model.analyze() ```