A Python library for concrete beam analysis and design
Project description
concrete-beam
A Python library for concrete beam analysis and design.
Installation
From Source (Development)
Clone the repository and install in development mode:
git clone https://github.com/alexiusacademia/concrete-beam.git
cd concrete-beam
pip install -e ".[dev]"
From PyPI (Once Published)
pip install pyrcb
Usage
Basic Example: Calculate Steel Stresses
Calculate stresses in multiple layers of reinforcement steel:
from pyrcb import calculate_steel_stresses
# Beam parameters
neutral_axis_depth = 100 # mm (depth of neutral axis from compression face)
steel_depths = [50, 100, 150] # mm (effective depths of each steel layer)
yield_stress = 400 # MPa (steel yield strength)
# Calculate stresses (far end steel at 150mm will yield)
stresses = calculate_steel_stresses(
neutral_axis_depth=neutral_axis_depth,
steel_depths=steel_depths,
yield_stress=yield_stress
)
print(f"Steel stresses: {stresses} MPa")
# Output: Steel stresses: [elastic_stress_1, elastic_stress_2, 400.0] MPa
Example: Calculate Compression Block Height
Determine the compression block height when far end steel yields:
from pyrcb import calculate_compression_block_height
# Beam parameters
far_end_depth = 500 # mm (effective depth of far end steel)
yield_stress = 400 # MPa
# Calculate compression block height (neutral axis depth)
c = calculate_compression_block_height(
far_end_depth=far_end_depth,
yield_stress=yield_stress
)
print(f"Compression block height (C): {c:.2f} mm")
Complete Example: Beam Analysis
Analyze a reinforced concrete beam with multiple steel layers:
from pyrcb import (
calculate_compression_block_height,
calculate_steel_stresses,
)
# Beam geometry
beam_depth = 600 # mm
cover = 40 # mm
steel_layers = 3
layer_spacing = 50 # mm
# Calculate effective depths for each steel layer
steel_depths = [
cover + i * layer_spacing for i in range(steel_layers)
]
far_end_depth = steel_depths[-1]
# Material properties
yield_stress = 400 # MPa (Grade 60 steel)
elastic_modulus = 200000 # MPa
concrete_strain = 0.003 # Maximum concrete strain
# Step 1: Calculate compression block height assuming far end yields
c = calculate_compression_block_height(
far_end_depth=far_end_depth,
yield_stress=yield_stress,
elastic_modulus=elastic_modulus,
concrete_strain=concrete_strain,
)
print(f"Neutral axis depth (C): {c:.2f} mm")
# Step 2: Calculate stresses in all steel layers
stresses = calculate_steel_stresses(
neutral_axis_depth=c,
steel_depths=steel_depths,
yield_stress=yield_stress,
elastic_modulus=elastic_modulus,
concrete_strain=concrete_strain,
)
# Display results
print("\nSteel Layer Analysis:")
for i, (depth, stress) in enumerate(zip(steel_depths, stresses), 1):
status = "YIELDED" if stress >= yield_stress else "ELASTIC"
print(f" Layer {i} (d={depth}mm): {stress:.2f} MPa - {status}")
Development
Setup
pip install -e ".[dev]"
Running Tests
pytest
Code Formatting
black src/
ruff check src/
Examples
See the examples directory for complete working examples.
First, make sure you've installed the package in development mode (see Installation above), then run:
python examples/basic_usage.py
The examples demonstrate:
- Calculating steel stresses in multiple layers
- Determining compression block height
- Complete beam analysis workflows
Contributing
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrcb-0.1.2.tar.gz.
File metadata
- Download URL: pyrcb-0.1.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bc99b0dbbb31a3a3b7f484f231585cd8a9f90fad75c8a9549d8450524eee560
|
|
| MD5 |
f0aba29f1cb3f41f5a171bf6323b0171
|
|
| BLAKE2b-256 |
8e1784b463360840a0edfc175ef34e59fe3f8c1f6f0fa9a85fda39f847a798b6
|
File details
Details for the file pyrcb-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyrcb-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b0259853d11a0f56dc3749f94f6a7fbbaf5bf8d5b2184bac0133d7f5a27d96d
|
|
| MD5 |
7e9c49445549d9951c615c8b3b49b770
|
|
| BLAKE2b-256 |
91b6491c6ec05aabcc850d0917211444611bef584398fec4789685d3841a2371
|