|
[Sponsors] |
September 12, 2016, 10:29 |
Plot streamlines with Python
|
#1 |
Senior Member
Join Date: Mar 2015
Posts: 250
Rep Power: 12 |
Hello all,
currently I am trying to plot streamlines with python. It is working so far and following is a kind of minimal example: Code:
import numpy as np import matplotlib.pyplot as plt Y, X = np.mgrid[-2:2:4j, -2:2:4j] U = np.array([[-77., -3.4, -3.4, -14.], [-5.6, -2.1,-2.1,-5.6], [-4.3,-0.7,-0.7,-4.3], [-3.,0.5,0.5,13.]]) V = np.array([[-500., 5, -5., 5.], [-1.4, 500,1.2,2.5], [-1.4,-0.1,1.2,2.5], [-5.,-3.6,-2.3,-1.]]) speed = np.sqrt(U*U +V*V) fig0, ax0 = plt.subplots() strm = ax0.streamplot(X, Y, U, V, density = 3, color = speed, arrowsize = 1, arrowstyle = '->', minlength = 0.2, linewidth = 1, transform = None, cmap=plt.cm.autumn) fig0.colorbar(strm.lines) plt.show() I would really appreciate if someone could point me in the right direction. Best regards, Kate |
|
September 12, 2016, 22:06 |
|
#2 |
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 |
Hi Kate,
I guess that is the standard, the first row starting from the bottom. What you are looking for is this: U = np.flipud(U) V = np.flipud(V) Best, Pablo |
|
September 13, 2016, 03:15 |
|
#3 |
Senior Member
Join Date: Mar 2015
Posts: 250
Rep Power: 12 |
Hello Pablo,
thank you! This flipud utility is exactly what I need then. But can you explain what the thinking is behind plotting the data upside down in standard mode? All the best, Kate |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Foam warnings - related to swak4Foam | Salam-H | OpenFOAM Community Contributions | 20 | August 2, 2015 15:40 |
Plot Streamlines | R_21 | OpenFOAM Post-Processing | 0 | June 26, 2015 17:32 |
[OpenFOAM] Paraview: how to plot streamlines and surface mesh together | serena | ParaView | 3 | September 9, 2012 22:13 |
CFD-Post how to plot stress and streamlines? | Airone | CFX | 3 | July 9, 2010 11:56 |
plot streamlines | JJ | Main CFD Forum | 2 | December 20, 1999 12:21 |