main.c 1.38 KB
Newer Older
1
2
3
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
François Trigaux's avatar
François Trigaux committed
4
#include <time.h>
5

6
#include "gebt.h"
7
8
9
10
11
12
13
14
15


int main(int argc, char* argv[])
{
    int i;
    double load;

    // Initializing the Beam
    printf("Initializing the beam...\n");
16
17
    Gebt *bm = malloc(sizeof(Gebt));
    initGebt(bm);
18
19
    printf("...Done!\n");

François Trigaux's avatar
François Trigaux committed
20
    gebt_setTwistFromFile(bm,"Twist.dat");
21
22
23
24
25
26

    // 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++)
    {
François Trigaux's avatar
François Trigaux committed
27
28
        loads[i] = 5e3;
    }
François Trigaux's avatar
François Trigaux committed
29
    gebt_setLoads(bm,loads,1);   // 1 -> Fy (flapwise)
François Trigaux's avatar
François Trigaux committed
30
31
32
    for(i=0;i<bm->nmemb;i++)
    {
        loads[i] = 10e3;
33
    }
François Trigaux's avatar
François Trigaux committed
34
    gebt_setLoads(bm,loads,2);   // 2 -> Fz (edgewise)
35
36
37
    printf("...Done!\n");

    char fname[32] = "output";
François Trigaux's avatar
François Trigaux committed
38
39
    double meanTime = 0.0;
    clock_t start;
40
41
    
    printf("Performing the analysis...\n");
François Trigaux's avatar
François Trigaux committed
42
43
    int ntot=  100;
    for (i=0;i<ntot;i++)
44
    {
François Trigaux's avatar
François Trigaux committed
45
        sprintf(fname,"output_%d_",i);
46
        printf("Global Step = %d...\n",i);
François Trigaux's avatar
François Trigaux committed
47
        start = clock();
François Trigaux's avatar
François Trigaux committed
48
        gebt_analysis(bm);
François Trigaux's avatar
François Trigaux committed
49
        meanTime += ((double) (clock() - start))/CLOCKS_PER_SEC;
François Trigaux's avatar
François Trigaux committed
50
        gebt_writeSolToFile(bm,fname);
51
52
        printf("... Ok! \n");
    }
François Trigaux's avatar
François Trigaux committed
53

54
    gebt_writeGebtToFile(bm,"beamFile.out");
55
    
56
    free(loads);
57
    freeGebt(bm);
58
    free(bm);
François Trigaux's avatar
François Trigaux committed
59

François Trigaux's avatar
François Trigaux committed
60
    printf("Mean time: %e",meanTime/((double)ntot));
61
62
63
    
    return EXIT_SUCCESS;
}