Skip to content

Non-dimensionalization of physical equations using sympy.

License

Notifications You must be signed in to change notification settings

cheind/sympy-nondim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

sympy-nondim

This Python package addresses physical dimensional analysis. In particular, sympy-nondim calculates from an unknown relation of (dimensional) variables, a new relation of (usually fewer) dimensionless variables.

See nondim-sympy.pdf for a detailed introduction.

import sympy
from sympy.physics import units

import nondim

# Potentially relevent variables
t, m, l, g, theta = sympy.symbols('t m l g theta')
# and associated dimensions
dimmap = {
    t:units.time, 
    m:units.mass, 
    l:units.length, 
    g:units.acceleration, 
    theta:units.Dimension(1)
}

# Setup an general equation, informing dimensional analysis
# of dependent and independent variables.
eq = sympy.Eq(t, sympy.Function('f')(m,l,g,theta))

# Perform dimensional analysis which returns a new (reduced) 
# expr. of dimensionless variables
r = nondim.nondim(eq, dimmap)

print(sympy.latex(r))
# \frac{\sqrt{g} t}{\sqrt{l}} = F{\left(\theta \right)}

The method implemented in this library is based on the Buckingham-Pi theorem and the Rayleigh algorithm as explained in (Szirtes 2007). The method implemented here frames the problem in linear algebra terms, see buckpi.py for details.

In case you are interested in solving for particular dimensions you might be interested in py-dimensional-analysis.

References

Lemons, Don S. 2017. A Student’s Guide to Dimensional Analysis. Cambridge University Press.

Santiago, Juan G. 2019. A First Course in Dimensional Analysis: Simplifying Complex Phenomena Using Physical Insight. MIT Press.

Schetz, Joseph A, and Allen E Fuhs. 1999. Fundamentals of Fluid Mechanics. John Wiley & Sons.

Sonin, Ain A. 2001. “Dimensional Analysis.” Technical report, Massachusetts Institute of Technology. http://web.mit.edu/2.25/www/pdf/DA_unified.pdf.

Szirtes, Thomas. 2007. Applied Dimensional Analysis and Modeling. Butterworth-Heinemann.

About

Non-dimensionalization of physical equations using sympy.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages