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

Added test for end-moment

parent 01a0eb0d
[Beam]
analysis_flag = 0
nkp = 51
niter = 200
nstep = 1
ncond_pt = 2
nframe = 0
ncurv = 0
initFromFile = 0
L=10.0
\ No newline at end of file
5.64971751e-07 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 5.64971751e-07 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 5.64971751e-07 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 1.22549020e-04 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.15074799e-05 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 4.65116279e-06
\ No newline at end of file
# 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
#include <stdlib.h>
#include <stdio.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");
// Creating an array with the uniform load for each member
printf("Creating the loads...\n");
load = atof(argv[1]);
beam_setEndLoad(bm,load,4); // 4 -> My
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");
return EXIT_SUCCESS;
}
# 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
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();
\ No newline at end of file
......@@ -607,6 +607,22 @@ void beam_setLoads(Beam *bm, double *loads, int load_no)
}
}
void beam_setEndLoad(Beam *bm, double loads, int load_no)
{
int i;
for(i=0;i<bm->ncond_mb;i++)
{
bm->pt_condition[1].dof[load_no+NSTRN] = i+1;
bm->pt_condition[1].value[load_no] = loads;
bm->pt_condition[1].value_current[load_no] = loads;
}
for(i=0;i<bm->ndistrfun;i++)
{
bm->distr_fun[i][0] = 1.0; //Constant chebyshev polynomial
}
}
void beam_analysis(Beam *bm)
{
......
......@@ -151,10 +151,14 @@ typedef struct
void initBeam(Beam *bm);
void beam_setLoads(Beam *bm, double *loads, int load_no);
void beam_writeSolToFile(Beam *bm, char *fileName);
void beam_setEndLoad(Beam *bm, double loads, int load_no);
void beam_analysis(Beam *bm);
//void beam_updateInitialConditions(Beam *bm);
void beam_writeSolToFile(Beam *bm, char *fileName);
void freeBeam(Beam *bm);
......
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