readData.py 976 Bytes
Newer Older
1
2
3
4
5
6
7
# Launch the Euler-Bernoulli comparison for the beam

import numpy as np
import matplotlib.pyplot as plt
from readIni import IniReader
import subprocess as sp

8
ini = IniReader("Gebt.ini");
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
nkp = ini.getValue("Beam","nkp",typeCast=int);
L   = ini.getValue("Beam","L"  ,typeCast=float);
nmemb = nkp-1
display = 1

F = 1e4;

out = sp.run(["./gebt", "-%e"%(F)],check=True);

for k in range(1):
    data_pts = np.loadtxt("output%03d.dat"%(k),max_rows=nkp);
    data_mem = np.loadtxt("output%03d.dat"%(k),skiprows=nkp);

    pts = data_pts;
    mem = data_mem;

    if(display):
        #plt.plot(mem[:,0]+mem[:,3],mem[:,4]+mem[:,1]);
        plt.plot(pts[:,0]+pts[:,3],pts[:,5]+pts[:,2],'.-k');
        #plt.plot(mem[:,0]+mem[:,3],mem[:,5]+mem[:,2],'.r');

        plt.xlabel('x');
        plt.ylabel('w(x)');
        plt.axis('scaled');

        plt.pause(0.01);


    print("u2 = %f m"%(pts[-1,4]))
    print("u3 = %f m"%(pts[-1,5]))

print("Done!");
if(display):
    plt.show();