3D Quiver

Laminar Pipe Flow (Poiseuille)

Poiseuille flow in a cylindrical pipe showing parabolic velocity profile - fastest at center.

Output
Laminar Pipe Flow (Poiseuille)
Python
import matplotlib.pyplot as plt
import numpy as np

# Poiseuille flow in a pipe
n_r = 4
n_theta = 8
n_z = 5

r = np.linspace(0.2, 1, n_r)
theta = np.linspace(0, 2*np.pi, n_theta, endpoint=False)
z = np.linspace(0, 3, n_z)

R, THETA, Z_cyl = np.meshgrid(r, theta, z)
X = R * np.cos(THETA)
Y = R * np.sin(THETA)
Z = Z_cyl

# Parabolic velocity profile (fastest at center)
R_max = 1
velocity = 1 - (R / R_max)**2

U = np.zeros_like(X)
V = np.zeros_like(Y)
W = velocity

fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')

ax.quiver(X, Y, Z, U, V, W, length=0.5, normalize=False,
          color='#14b8a6', alpha=0.85, arrow_length_ratio=0.3)

ax.set_xlim(-1.5, 1.5)
ax.set_ylim(-1.5, 1.5)
ax.set_zlim(-0.5, 3.5)

ax.set_xlabel('X', color='white', fontsize=10)
ax.set_ylabel('Y', color='white', fontsize=10)
ax.set_zlabel('Z (flow)', color='white', fontsize=10)
ax.set_title('Laminar Pipe Flow (Poiseuille)', color='white', fontsize=14, fontweight='bold', pad=20)

ax.tick_params(colors='#64748b', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#1e293b')
ax.yaxis.pane.set_edgecolor('#1e293b')
ax.zaxis.pane.set_edgecolor('#1e293b')

ax.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support