Page 8 - Demo
P. 8
Planar Truss Example for Comrel Add-on RCP Consult, 2023-2025 Page 8The second set of statements from FLIM(2) to DEFFUNC(2) operate with a procedure,having similar name as above, implemented in FortranPlanarTrussGF90.sao as export function that definition placed in source file PlanarTruss_GF.f90 written in free format. In this source file the values from global vector v_XP_ and global names will be accessed. Note the large 2nd part of source to create various plots after a 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.real*8 function PlanarTruss(ier) bind(C,name='PlanarTruss') implicit real*8 (a-h,o-z)!! Include file with internal STRUREL definitionsinclude 'strurel.hf'!GCC$ ATTRIBUTES DLLEXPORT::PlanarTrussinteger, intent(out) :: ier!# ============================================================================!# Planar Truss - Example for FORTRAN!# ============================================================================!# 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!# ============================================================================real*8 P(6)equivalence(P,v_XP_(5))!! FEM constantsparameter(nfe=23,ned=2,nnp=13,ndof=2*13,nbd=2*2,nc=3)parameter(PI=3.14159265d0)!! 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 ...dimension IEN(ned,nfe)data IEN/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/!! Fixed dofsinteger bc(nc)data bc/1, 2, 14/ !! Internal datareal*8 LM(nbd,nfe),theta(nfe+1),leng(nfe+1),l1,l2,Area(nfe+1),E(nfe+1),ke(nfe),K(ndof,ndof),T(nbd,nbd), && KL(nbd,nbd),TT(nbd,nbd),KT(nbd,nbd),KG(nbd,nbd),fc(ndof),ac(ndof),NN(nfe),ken(nbd),keT(nbd),de(nbd)!! Visualization datareal*8 wo,we,ho,he,XY(ned,nnp),v(2,2),sc,fp(ned,nnp),X(nbd),Y(nbd),XYrot(ned,nbd+1),minA,maxA,ddA,XYten(ned+1,nbd+1)data XY/0.d0,0.d0, 4.d0,0.d0, 8.d0,0.d0, 12.d0,0.d0, 16.d0,0.d0, 20.d0,0.d0, 24.d0,0.d0, && 22.d0,2.d0, 18.d0,2.d0, 14.d0,2.d0, 10.d0,2.d0, 6.d0,2.d0, 2.d0,2.d0/integer nfcharacter*200 title,statecharacter*7 cological Init!!---------------------------------------------------------------------------!! Planar truss model!!---------------------------------------------------------------------------StrurelPlot=.FALSE.!! Vector inputs - order from Stochastic ModelA1=v_XP_(1) ! cross section of horizontal barsA2=v_XP_(2) ! cross section of inclined barsE1=v_XP_(3) ! Youngs modulus of horizontal barsE2=v_XP_(4) ! Youngs modulus of inclined bars!! LM: localization matrix, dof x nfe do n=1,nfe LM(1,n)=IEN(1,n)*ned-1; LM(2,n)=IEN(1,n)*ned LM(3,n)=IEN(2,n)*ned-1; LM(4,n)=IEN(2,n)*nedend do!! Deterministic rod properties! inclination angle of the truss [deg]ang=atan2(200.d0,200.d0)*180.d0/PIdo n=1,6 m=(n-1)*4! inclination angles [deg] theta(m+1)=ang; theta(m+2)=0.d0; theta(m+3)=-ang; theta(m+4)=0.d0end dol1=4.d0/dsqrt(2.d0); l2=4.d0do n=1,12 m=(n-1)*2 leng(m+1)=l1; leng(m+2)=l2 ! bar length [m] Area(m+1)=A2; Area(m+2)=A1 ! bar cross sectional area [m2] E(m+1)=E2; E(m+2)=E1 ! Young's modulus [N/m^2]