Skip to main content

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 concrete_beam 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 concrete_beam 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 concrete_beam 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrcb-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrcb-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pyrcb-0.1.0.tar.gz.

File metadata

  • Download URL: pyrcb-0.1.0.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

Hashes for pyrcb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18723555bddb381528c8c8d5733b36d7d1772a9949c28c3bbc269ac387c5cb43
MD5 2ae5a00ae34bdf756a86c6fc899bfda7
BLAKE2b-256 12e1332e3f049c58cc8991a6c57f521ba02eca9f140751eeb213d874397d7345

See more details on using hashes here.

File details

Details for the file pyrcb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyrcb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for pyrcb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 992760e92e9709b06582d207a9b287174b262b9c82f86e5e2a90ee3b39fee49d
MD5 20b055161a6824245990529466b3cdd4
BLAKE2b-256 e1f75e697ffcded25926e67b416d78c2e37a7d5ab275e1bdc76225de50f991a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page