#! /usr/bin/env python import matplotlib as mpl import matplotlib.pyplot as plt from pyFlowStat.PointProbe import PointProbe path=r'Data/10/U' pt = PointProbe() pt.readFromOpenFoam([0.3,-0.3,0.05],path) plt.figure('Time resolved velocity') ax=plt.plot(pt.data['t'],pt.data['U']) plt.title('Time resolved velocity') plt.grid(True) plt.xlabel('Time $[s]$') plt.ylabel('Velocity $[m/s]$') plt.legend(['$U_x$','$U_y$','$U_z$']) # In the "pt" object of class "PointProbe", the data are stored in python ditionnary. # Therefore, all the methods of a python dictonnary can be used. All single data # (like U, Umag or the time) are stored in a numpy.array. The following lines # show some examples. # get a list of all the keys print('data in pt:') print(pt.data.keys()) #print Ux like this print(pt.data['U'][:,0]) # or like this print(pt['U'][:,0])
#! /usr/bin/env python import matplotlib as mpl import matplotlib.pyplot as plt from pyFlowStat.PointProbe import PointProbe path = r"Data/10/U" pt = PointProbe() pt.readFromOpenFoam([0.3, -0.3, 0.05], path) plt.figure("Time resolved velocity") ax = plt.plot(pt.data["t"], pt.data["U"]) plt.title("Time resolved velocity") plt.grid(True) plt.xlabel("Time $[s]$") plt.ylabel("Velocity $[m/s]$") plt.legend(["$U_x$", "$U_y$", "$U_z$"]) # In the "pt" object of class "PointProbe", the data are stored in python ditionnary. # Therefore, all the methods of a python dictonnary can be used. All single data # (like U, Umag or the time) are stored in a numpy.array. The following lines # show some examples. # get a list of all the keys print("data in pt:") print(pt.data.keys()) # print Ux like this print(pt.data["U"][:, 0]) # or like this print(pt["U"][:, 0])
#! /usr/bin/env python import matplotlib as mpl import matplotlib.pyplot as plt from pyFlowStat.PointProbe import PointProbe path=r'Data/10/U' pt = PointProbe() pt.readFromOpenFoam([0.3,-0.3,0.05],path) plt.figure() ax=plt.plot(pt.data['t'],pt.data['U']) plt.title('Time resolved velocity') plt.grid(True) plt.xlabel('Time $[s]$') plt.ylabel('Velocity $[m/s]$') plt.legend(['$U_x$','$U_y$','$U_z$']) plt.show()