-
-
Save darthcoder/667552 to your computer and use it in GitHub Desktop.
similar to u.py but working
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/python2 | |
| """This is a module that returns the induction | |
| Once u_i(y) and cos(l_i*z) are known. The variables might be renamed | |
| this is just a guide. | |
| m&b refers to text. | |
| """ | |
| from math import fabs, cos, sin, cosh, sinh, hypot, pi | |
| TOL_MIN = 1e-6 | |
| #TOL_MAX = 1e6 | |
| def induction(h, a, y, z): | |
| """Return final velocity at some point in domain. | |
| From the fourier modes of y and z contributions. | |
| """ | |
| i = 1 | |
| b = 0.0 | |
| #uiy = u_y(h, a, i, y) | |
| #uiz = u_z(a, z, i) | |
| while 1: | |
| biy = b_y(h, a, y, i) | |
| biz = b_z(a, z, i) | |
| if fabs(biy*biz) <= TOL_MIN: | |
| break | |
| b += biy*biz | |
| print b, i | |
| i += 2 | |
| return b | |
| def b_z(a, z, i): | |
| """The z contribution to velocity from formulae in m&b | |
| Oneliner form is better. Lambda form is complicated to use? | |
| """ | |
| temp = cos(0.5*i*pi*a*z) | |
| return temp | |
| def f(p1, p2): | |
| """intermediary function for u_y computation | |
| """ | |
| temp = sinh(p1)*cosh(p2)-sinh(p2)*cosh(p1) | |
| print temp | |
| return temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment