Page 3 - Demo
P. 3
Planar Truss Example for Comrel Add-on RCP Consult, 2023-2025 Page 3The first set of statements from FLIM(1) to DEFFUNC(1) operate with procedure PlanarTruss implemented in CppPlanarTrussGC.sao as export function that definition placed in source file PlanarTruss_GC.cpp. In this source file the values from global vector v_XP_ and global names will be accessed. Note the large 2nd part of the source to create various plots after the line //* Visualization.//* Code based on Max Ehre work - https://github.com/maxehre/polynomial_surrogates//* Used with his kind permission as version from 2017 that adapted to Strurel.//* Include file with internal STRUREL definitions#include \#include \#include \#include \extern \{//* Export function definition for usage in STRUREL DllExport double PlanarTruss(long *);}// Support functionsvoid MATRAN(double *, double *, long, long);void MATMLT(double *, double *, double *, long, long, long);double PlanarTruss(long *ier){/*============================================================================ Planar Truss - Example for C/C++============================================================================ Inputs: X = [A1, A2, E1, E2, P1, P2, P3, P4, P5, P6, u_y] E1,E2: Youngs modulus of horizontal and inclined bars resp. - log-normally distributed A1,A2: cross section of horizontal and inclined bars resp. - log-normally distributed P1-P6: negative vertical forces attacking in nodes 8-13. - Gumbel distributed u_y: maximal allowed vertical deflection in node 4. - constant Output: uout: vertical truss deflection at bottom center (N04)============================================================================ Truss description taken from Lee, S.H., Kwak, B.M. (2006). Response surface augmented moment method for efficient reliability analysis. Structural Safety 28(3), 261 - 272. https://www.sciencedirect.com/science/article/abs/pii/S0167473005000421 Based on Diego Andr%u00e9s Alvarez Mar%u00edn work - https://github.com/diegoandresalvarez/elementosfinitos/tree/master/codigo/repaso_matricial/cercha_2d N: Nodes R: Rods============================================================================ N13__R4___N12__R8___N11__R12__N10__R16__N09__R20__N08 /\\ /\\ /\\ /\\ /\\ /\\ / \\ / \\ / \\ / \\ / \\ / \\ R1 R3 R5 R7 R9 R11 R13 R15 R17 R19 R21 R23 / \\ / \\ / \\ / \\ / \\ / \\ /___R2___\\/___R6___\\/__R10___\\/__R14___\\/__R18___\\/__R22___\\ N01 N02 N03 N04 N05 N06 N07 ||\\/ uout => u_y @ N04============================================================================*/ StrurelPlot=false;//*---------------------------------------------------------------------------//* Planar truss model//*---------------------------------------------------------------------------//* Vector inputs - order from Stochastic Model A1=v_XP_[0]; // cross section of horizontal bars A2=v_XP_[1]; // cross section of inclined bars E1=v_XP_[2]; // Youngs modulus of horizontal bars E2=v_XP_[3]; // Youngs modulus of inclined bars double *P=v_XP_+4; // negative vertical forces attacking in nodes 8-13. (1x6 vector)//* FEM constants #define nfe 23 #define ned 2 #define nnp 13 #define ndof 2*13 #define nbd 2*2//* Element, nodes and dofs association//* IEN: connectivity matrix, nfe x nodes - bar 1 has nodes 1 and 13, bar 2 has nodes 1 and 2 ... long IEN[nfe][ned]={{1, 13}, {1, 2}, {13, 2}, {13, 12}, {2, 12}, {2, 3}, {12, 3}, {12, 11}, {3, 11}, {3, 4}, {11, 4}, {11, 10}, {4, 10}, {4, 5}, {10, 5}, {10, 9}, {5, 9}, {5, 6}, {9, 6}, {9, 8}, {6, 8}, {6, 7}, {8, 7}};//* LM: localization matrix, nfe x dof long LM[nfe][nbd]; for(int n=0; n