Commit 76e6369e authored by François Trigaux's avatar François Trigaux
Browse files

NREL5MW test case

parent e0f0daf2
[Beam]
analysis_flag = 0
nkp = 21
niter = 1000
nstep = 1
ncond_pt = 2
initFromFile = 0
L=61.5
dt = 0.002
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
# NOTE ON THIS MAKEFILE
# As the library is not installed in a default repo, i.e. /usr/lib or /usr/local/lib, you need to give it the path to the library at runtime. This is the rpath argument.
DIR=$(shell dirname `pwd`)
default:
cp -r ../../lib ./
gcc -g -fPIC -c -o main.o main.c -I../../include
gcc -g -o gebt main.o -lgebt -L./lib
clean:
rm -f main.o
rm -f gebt
This diff is collapsed.
49
0.0000000E+00 1.3308000E+01
1.9987500E-01 1.3308000E+01
1.1998650E+00 1.3308000E+01
2.1998550E+00 1.3308000E+01
3.1998450E+00 1.3308000E+01
4.1998350E+00 1.3308000E+01
5.1998250E+00 1.3308000E+01
6.1998150E+00 1.3308000E+01
7.1998050E+00 1.3308000E+01
8.2010250E+00 1.3308000E+01
9.1997850E+00 1.3308000E+01
1.0199775E+01 1.3308000E+01
1.1199765E+01 1.3181000E+01
1.2199755E+01 1.2848000E+01
1.3200975E+01 1.2192000E+01
1.4199735E+01 1.1561000E+01
1.5199725E+01 1.1072000E+01
1.6199715E+01 1.0792000E+01
1.8200925E+01 1.0232000E+01
2.0200290E+01 9.6720000E+00
2.2200270E+01 9.1100000E+00
2.4200250E+01 8.5340000E+00
2.6200230E+01 7.9320000E+00
2.8200825E+01 7.3210000E+00
3.0200190E+01 6.7110000E+00
3.2200170E+01 6.1220000E+00
3.4200150E+01 5.5460000E+00
3.6200130E+01 4.9710000E+00
3.8200725E+01 4.4010000E+00
4.0200090E+01 3.8340000E+00
4.2200070E+01 3.3320000E+00
4.4200050E+01 2.8900000E+00
4.6200030E+01 2.5030000E+00
4.8201240E+01 2.1160000E+00
5.0199990E+01 1.7300000E+00
5.2199970E+01 1.3420000E+00
5.4199950E+01 9.5400000E-01
5.5199940E+01 7.6000000E-01
5.6199930E+01 5.7400000E-01
5.7199920E+01 4.0400000E-01
5.7699915E+01 3.1900000E-01
5.8201140E+01 2.5300000E-01
5.8699905E+01 2.1600000E-01
5.9199900E+01 1.7800000E-01
5.9699895E+01 1.4000000E-01
6.0199890E+01 1.0100000E-01
6.0699885E+01 6.2000000E-02
6.1199880E+01 2.3000000E-02
6.1500000E+01 0.0000000E+00
\ No newline at end of file
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "beam.h"
int main(int argc, char* argv[])
{
int i;
double load;
// Check the input argument
if(argc<2)
{
printf("Please specify the uniform load value as arguments\n");
printf("Example: ./gebt 100\n");
exit(EXIT_FAILURE);
}
// Initializing the Beam
printf("Initializing the beam...\n");
Beam *bm = malloc(sizeof(Beam));
initBeam(bm);
printf("...Done!\n");
beam_setTwistFromFile(bm,"Twist.dat");
// Creating an array with the uniform load for each member
printf("Creating the loads...\n");
double *loads = malloc(sizeof(double)*bm->nmemb);
for(i=0;i<bm->nmemb;i++)
{
loads[i] = atof(argv[1]);
}
beam_setLoads(bm,loads,2);
printf("...Done!\n");
char fname[32] = "output";
// Performing the analysis
printf("Performing the analysis...\n");
beam_analysis(bm);
beam_writeSolToFile(bm,fname);
printf("... Ok! \n");
freeBeam(bm);
free(bm);
return EXIT_SUCCESS;
}
\ No newline at end of file
# This script will arange the mass and stiffness matrix from the fast input file
# into correctly formatted input files
# Also, the stiffness matrix is inverted by definition of the compliance matrix
import numpy as np
fid = open("ComplianceAndMass.dat","r");
lines = fid.readlines();
nentry = 49;
stiffness = np.zeros((nentry,6,6))
mass = np.zeros((nentry,6,6))
x = np.zeros(nentry);
k=0
for i in np.arange(5,725+1,15):
x[k] = float(lines[i])
k=k+1;
k=0
for i in np.arange(6,726+1,15):
for j in range(6):
stiffness[k,j,:] = np.array(lines[i+j].split()).astype(np.float);
k=k+1;
k=0
for i in np.arange(13,734+1,15):
for j in range(6):
mass[k,j,:] = np.array(lines[i+j].split()).astype(np.float);
k=k+1;
with open("Compliance.dat","w") as fid:
fid.write("%d\n"%(nentry));
for i in range(nentry):
comp = np.linalg.inv(stiffness[i])
fid.write("%1.6f\n"%(x[i]));
for j in range(6):
for k in range(6):
fid.write("% 1.6E "%(comp[j,k]));
fid.write("\n");
fid.write("\n");
with open("Mass.dat","w") as fid:
fid.write("%d\n"%(nentry));
for i in range(nentry):
fid.write("%1.6f\n"%(x[i]));
for j in range(6):
for k in range(6):
fid.write("% 1.6E "%(mass[i,j,k]));
fid.write("\n");
fid.write("\n");
\ No newline at end of file
# 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
ini = IniReader("Beam.ini");
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();
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment