Note
Go to the end to download the full example code
Tie Rod with Lateral Loading#
- Problem description:
A tie rod is subjected to the action of a tensile force F and a uniform lateral load p. Determine the maximum deflection \(z_{max}\), the slope \(\theta\) at the left-hand end, and the maximum bending moment \(M_{max}\). In addition, determine the same three quantities for the unstiffened tie rod (F = 0).
- Reference:
S. Timoshenko, Strength of Materials, Part II, Elementary Theory and Problems, 3rd Edition, D. Van Nostrand Co., Inc., New York, NY, 1956, pg. 42, article 6.
- Analysis type(s):
Static, Stress Stiffening Analysis
ANTYPE=0
- Element type(s):
3-D 2 node beam (BEAM188)
- Material properties:
\(E = 30 \cdot 10^6 psi\)
- Geometric properties:
\(l = 200 in\)
\(b = h = 2.5 in\)
- Loading:
\(F = 21,972.6 lb\)
\(p = 1.79253 lb/in\)
- Analysis Assumptions and Modeling Notes:
Due to symmetry, only one-half of the beam is modeled. The full load is applied for each iteration. The first solution represents the unstiffened case. The second solution represents the stiffened case.
# sphinx_gallery_thumbnail_path = '_static/vm21_setup.png'
# Importing the `launch_mapdl` function from the `ansys.mapdl.core` module
from ansys.mapdl.core import launch_mapdl
import numpy as np
import pandas as pd
# Launch MAPDL with specified options
mapdl = launch_mapdl(loglevel="WARNING", print_com=True, remove_temp_dir_on_exit=True)
# Clear the current database
mapdl.clear()
# Run the FINISH command to exists normally from a processor
mapdl.finish()
# Set the ANSYS version
mapdl.com("ANSYS MEDIA REL. 2022R2 (05/13/2022) REF. VERIF. MANUAL: REL. 2022R2")
# Run the /VERIFY command for VM21
mapdl.run("/VERIFY,VM21")
# Set the title of the analysis
mapdl.title("VM21 TIE ROD WITH LATERAL LOADING NO STREES STIFFENING")
# Enter the model creation /Prep7 preprocessor
mapdl.prep7()
*****MAPDL VERIFICATION RUN ONLY*****
DO NOT USE RESULTS FOR PRODUCTION
***** MAPDL ANALYSIS DEFINITION (PREP7) *****
Define element type and section properties#
Use 3-D 2-Node Beam Element and specify cubic shape function via setting Keyopt(3)=3.
mapdl.et(1, "BEAM188")
mapdl.keyopt(1, 3, 3) # Set KEYOPT(3) to 3 cubic shape function
mapdl.sectype(1, "BEAM", "RECT") # Specify section properties for the beam element
mapdl.secdata(2.5, 2.5) # Define section data
SECTION ID NUMBER IS: 1
BEAM SECTION TYPE IS: Rectangle
BEAM SECTION NAME IS:
COMPUTED BEAM SECTION DATA SUMMARY:
Area = 6.2500
Iyy = 3.2552
Iyz = 0.41633E-16
Izz = 3.2552
Warping Constant = 0.23513E-01
Torsion Constant = 5.5714
Centroid Y = 0.88818E-17
Centroid Z = 0.17764E-16
Shear Center Y = 0.27711E-16
Shear Center Z =-0.14282E-15
Shear Correction-xy = 0.84211
Shear Correction-yz =-0.95989E-15
Shear Correction-xz = 0.84211
Beam Section is offset to CENTROID of cross section
Define material#
Set up the material and its type (a single material), Young’s modulus of 30e6 and Poisson’s ratio PRXY of 0.3 is specified.
mapdl.mp("EX", 1, 30e6)
mapdl.mp("PRXY", "", 0.3)
MATERIAL 1 PRXY = 0.3000000
Define geometry#
Set up the nodes and elements. This creates a mesh just like in the problem setup.
mapdl.n(1) # define nodes
mapdl.n(5, 100)
# Generate additional nodes
mapdl.fill()
# Define elements
mapdl.e(1, 2)
# Generate additional elements from an existing pattern
mapdl.egen(4, 1, 1)
GENERATE 4 TOTAL SETS OF ELEMENTS WITH NODE INCREMENT OF 1
SET IS SELECTED ELEMENTS IN RANGE 1 TO 1 IN STEPS OF 1
MAXIMUM ELEMENT NUMBER= 4
Define boundary conditions and loading#
Apply a displacement boundary condition in the UY, ROTX and ROTZ directions to all nodes. Specify symmetry degree-of-freedom constraints on nodes, surface normal to X-dir (default). Apply a tensile force in X-dir, F = -21972.6 lb and a uniform lateral load, p = 1.79253 lb/in. Then exit prep7 processor.
mapdl.d("ALL", "UY", "", "", "", "", "ROTX", "ROTZ")
mapdl.d(1, "UZ")
# Select nodes for symmetry boundary
mapdl.nsel("S", "", "", 5)
mapdl.dsym("SYMM", "X")
# Select all nodes
mapdl.nsel("ALL")
# Apply nodal force along x-direction
mapdl.f(1, "FX", -21972.6)
# Specifies surface loads on beam and pipe elements.
mapdl.sfbeam("ALL", 1, "PRES", 1.79253)
# Selects all entities
mapdl.allsel()
# Element plot
mapdl.eplot()
# Finish pre-processing processor
mapdl.finish()
***** ROUTINE COMPLETED ***** CP = 0.000
Solve#
Enter solution mode and solve the system.
mapdl.slashsolu()
# Set the analysis type to STATIC
mapdl.antype("STATIC")
# Perform the solution
mapdl.solve()
# exists solution processor
mapdl.finish()
FINISH SOLUTION PROCESSING
***** ROUTINE COMPLETED ***** CP = 0.000
Post-processing#
Enter post-processing. Compute displacement and rotation quantities.
mapdl.post1()
# Select nodes for results output
mapdl.nsel("S", "", "", 1, 5, 4)
# Print displacement quantities in Z direction
mapdl.prnsol("U", "Z")
# Print rotation quantities in Y direction
mapdl.prnsol("ROT", "Y")
# Select all nodes
mapdl.nsel("ALL")
# Print results solution
mapdl.prrsol()
'PRINT REACTION SOLUTIONS PER NODE\n *****MAPDL VERIFICATION RUN ONLY*****\n DO NOT USE RESULTS FOR PRODUCTION\n \n ***** POST1 TOTAL REACTION SOLUTION LISTING ***** \n \n LOAD STEP= 1 SUBSTEP= 1 \n TIME= 1.0000 LOAD CASE= 0 \n \n THE FOLLOWING X,Y,Z SOLUTIONS ARE IN THE GLOBAL COORDINATE SYSTEM \n \n NODE FX FY FZ MX MY MZ \n 1 0.0000 179.25 0.32697E-014 -0.69256E-014\n 2 0.0000 -0.21095E-015 -0.10747E-013\n 3 0.0000 -0.21095E-015 -0.71644E-014\n 4 0.0000 -0.21095E-015 -0.35822E-014\n 5 21973. 0.0000 -0.10548E-015 -8962.7 0.11439E-012\n\n TOTAL VALUES\n VALUE 21973. 0.0000 179.25 0.25314E-014 -8962.7 0.85973E-013'
Inline functions in PyMAPDL to query node#
Retrieve nodal deflection and rotation#
EXIT THE MAPDL POST1 DATABASE PROCESSOR
***** ROUTINE COMPLETED ***** CP = 0.000
Post-processing#
Enter /post26 time-history post-processing processor.
mapdl.post26()
# Specifies the total reaction force data to be stored at nodes associated to RGHT_END
mapdl.rforce(2, RGHT_END, "M", "Y")
# Store results
mapdl.store()
# Get maximum moment at node RGHT_END
m_mx_c2 = mapdl.get("M_MX_C2", "VARI", 2, "EXTREM", "VMAX")
# exists post-processing processor
mapdl.finish()
***** ROUTINE COMPLETED ***** CP = 0.000
Set a new title for the analysis#
mapdl.title("VM21 TIE ROD WITH LATERAL LOADING STRESS STIFFENING PRESENT")
TITLE=
VM21 TIE ROD WITH LATERAL LOADING STRESS STIFFENING PRESENT
Solve#
Enter new solution mode and solve the nonlinear system including stress stiffening.
mapdl.slashsolu()
# Set number of substeps to 5
mapdl.nsubst(5)
# Activate auto time stepping
mapdl.autots("ON")
# Activate nonlinear geometry
mapdl.nlgeom("ON")
# Set a smaller convergence tolerance
mapdl.cnvtol("F", "", 0.0001, "", 1)
# Perform the solution
mapdl.solve()
# exists solution processor
mapdl.finish()
FINISH SOLUTION PROCESSING
***** ROUTINE COMPLETED ***** CP = 0.000
Post-processing#
Enter post-processing. Compute displacement and rotation quantities.
mapdl.post1()
# Select nodes for results output
mapdl.nsel("S", "", "", 1, 5, 4)
# Print displacement quantities in Z direction
mapdl.prnsol("U", "Z")
# Print rotation quantities in Y direction
mapdl.prnsol("ROT", "Y")
# Print results solution
mapdl.prrsol()
# Get results at node RGHT_END
uz_mx_c1 = mapdl.get("UZ_MX_C1", "NODE", RGHT_END, "U", "Z")
# Get results at node LFT_END
slope_c1 = mapdl.get("SLOPE_C1", "NODE", LFT_END, "ROT", "Y")
# exists post-processing processor
mapdl.finish()
EXIT THE MAPDL POST1 DATABASE PROCESSOR
***** ROUTINE COMPLETED ***** CP = 0.000
Post-processing#
Enter /post26 time-history post-processing processor.
Verify the results.#
# Set target values
target_res = [-0.19945, 0.0032352, -4580.1]
target_res_strss = [-0.38241, 0.0061185, -8962.7]
# Fill result values
sim_res = [uz_mx_c1, slope_c1, m_mx_c1]
sim_res_strss = [uz_mx_c2, slope_c2, m_mx_c2]
title = f"""
------------------- VM21 RESULTS COMPARISON ---------------------
F neq 0 (stiffened):
--------------------
"""
col_headers = ["TARGET", "Mechanical APDL", "RATIO"]
row_headers = ["Z_max, in", "Slope, rad", "M_max , in-lb"]
data = [target_res, sim_res, np.abs(target_res) / np.abs(sim_res)]
print(title)
print(pd.DataFrame(np.transpose(data), row_headers, col_headers))
title = f"""
F = 0 (unstiffened):
--------------------
"""
row_headers = ["Z_max, in", "Slope, rad", "M_max , in-lb"]
data = [
target_res_strss,
sim_res_strss,
np.abs(target_res_strss) / np.abs(sim_res_strss),
]
print(title)
print(pd.DataFrame(np.transpose(data), row_headers, col_headers))
------------------- VM21 RESULTS COMPARISON ---------------------
F neq 0 (stiffened):
--------------------
TARGET Mechanical APDL RATIO
Z_max, in -0.199450 -0.199560 0.999449
Slope, rad 0.003235 0.003235 0.999957
M_max , in-lb -4580.100000 -4579.818510 1.000061
F = 0 (unstiffened):
--------------------
TARGET Mechanical APDL RATIO
Z_max, in -0.382410 -0.382554 0.999623
Slope, rad 0.006118 0.006119 1.000000
M_max , in-lb -8962.700000 -8962.650000 1.000006
Finish the post-processing processor.#
mapdl.finish()
***** ROUTINE COMPLETED ***** CP = 0.000
Stop MAPDL.#
mapdl.exit()
Total running time of the script: (0 minutes 0.715 seconds)