Skip to main content

Utilities for programming that involves physical properties

Project description

image image image Actions status


Documentation: https://maxcode123.github.io/property-utils/
Source code: https://github.com/Maxcode123/property-utils
PyPI: https://pypi.org/project/property-utils/


property-utils

Utilities for programming that involves physical properties

What is property-utils?

property-utils is a python library that aims at making programming with physical properties easier. It was created to be used by scientists and engineers with little programming experience.

What is provided by property-utils?

Unit arithmetics

You can divide and multiply units to create new units. For example you can create velocity units by dividing length units with time units.

Unit conversions

You can easily convert a property from one unit to another by calling a method.

Property arithmetics

You can add, subtract, divide and multiply properties to create new properties. For example, you can create a density property by dividing a mass property with a volume property.

Installation

pip install property-utils

Quick usage

A simple example:

import math

from property_utils.properties import p
from property_utils.units import (
    BTU,
    FOOT,
    RANKINE,
    HOUR,
    CENTI_METER,
    METER,
    KELVIN,
    KILO_WATT,
)

tube_radius = p(12, CENTI_METER)
tube_length = p(2.3, METER)
heat_exchange_area = 2 * math.pi * tube_length * tube_radius

heat_transfer_coeff = p(150, BTU / RANKINE / FOOT**2 / HOUR)

cold_in = p(273, KELVIN)
cold_out = p(300, KELVIN)
hot_in = p(520, KELVIN)
hot_out = p(472, KELVIN)
diff_in = hot_in - cold_in
diff_out = hot_out - cold_out
temperature_diff = (diff_in - diff_out) / math.log((diff_in / diff_out).value)

print("Heat transfer coefficient =", heat_transfer_coeff)
print("Heat exchange area =", heat_exchange_area)
print("Temperature difference =", temperature_diff)

heat_duty = heat_transfer_coeff * heat_exchange_area * temperature_diff

print("\nHeat duty =", heat_duty)
print("          =", heat_duty.to_si())
print("          =", heat_duty.to_unit(KILO_WATT))

Result:

Heat transfer coefficient = 150 Btu / (ft^2) / hr / °R
Heat exchange area = 1.7341591447815656 (m^2)
Logarithmic mean temperature difference = 207.24308513672648 K

Heat duty = 1044588.4611345044 Btu / hr
          = 306122.45180469507 J / s
          = 306.12245180469506 kW

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

property_utils-0.3.1.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

property_utils-0.3.1-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file property_utils-0.3.1.tar.gz.

File metadata

  • Download URL: property_utils-0.3.1.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for property_utils-0.3.1.tar.gz
Algorithm Hash digest
SHA256 8bbeb8a55bcf9dac948361c54bf35bad153890ce38a6d6864c5f7908fd40d9bc
MD5 7c5952d63cfc6a1deaa37e737dc6b22b
BLAKE2b-256 eae6575a8f4397ae3830eb946b4b6d4db8dbca379a4858a811a00c8fff2fe5b2

See more details on using hashes here.

File details

Details for the file property_utils-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for property_utils-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 779c5ed38bd23662fd81013b23ee3cab0caff989f539e5ea8e92fd737e581db0
MD5 feaec7682e2f6064107137667a8cce26
BLAKE2b-256 a99eaf6a00364767692f8c769785460b0b75e5d41fe7c9eb7730eb57625aaf14

See more details on using hashes here.

Supported by

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