readData.py 1.07 KB
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
43
44
45
46
47
48
49
50
51
nkp = ini.getValue("Beam","nkp",typeCast=int);
L   = ini.getValue("Beam","L"  ,typeCast=float);
nmemb = nkp-1
display = 1

x = np.linspace(0,1);
xcheck = np.linspace(0,1,nkp);

#a = np.diag(10**3 * np.array([1770,  1770,  1770, 8.16, 86.9, 215]));
#print(a);
#print(np.linalg.inv(a));

EI = 86.9e3
lam = 1.95;
M = lam * np.pi * EI / L
print(M);

sp.run(["./gebt", "-%e"%(M)]);


data_pts = np.loadtxt("output000.dat",max_rows=nkp);
data_mem = np.loadtxt("output000.dat",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');


print("u_1 = %f"%(L-(pts[-1,0]+pts[-1,3])));
print("u_3 = %f"%(L-(pts[-1,2]+pts[-1,5])));


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