!=============================================================================== ! ANSYS CLASSIC !=============================================================================== ! PROJEKT: MMSM 1 (B. Wieland, U. Simon, www.uni-ulm.de/uzwr) ! SEMESTERPROJEKT "Bridge with Remodeling Algorithm" ! PROGRAM: Projekt.txt ! DATE: 24.01.2013 ! AUTHORS: F. Bergmann, S. Lenz, S. Weber (based on B. Wieland, U. Simon) ! ANSYS Version: License: Academic Teaching Advanced, Version: 14.0 ! ! CALL: /input,Projekt.txt !=============================================================================== !=============================================================================== ! BEGINNING !=============================================================================== FINISH ! Stops all modules (preprocessor, solution, postprocessor) /CLEAR ! Clears an existing database to start a new analysis !=============================================================================== ! PARAMETER AND CONSTANTS ! lengths in mm ! forces in N ! stiffnesses in N/mm = MPa ! stresses in N/mm = MPa !=============================================================================== !--- Type of simulation simType = 'a' ! a = styropor, b = schaumstoff !--- Define material dependant properties *IF,simType,EQ,'b',THEN !--- Geometry length = 400.0 ! Length (x) of plate, schaumstoff height = 50.0 ! Height (y) of plate, schaumstoff thickini = 50.0 ! Initial thickness of plate, schaumstoff auflage = 10 ! determines resting surface of bridge !--- Material properties e_modul_ini = 0.07 ! Initial Young's modulus of the plates material (schaumstoff) p_ratio = 0.3 ! Initial Poisson's ratio of the plates material (schaumstoff) !--- Define loads force = -1 ! Load (Force, vertical), schaumstoff !--- Properties of remodelling algorithm sollWert = 0.0000005 ! Target for strain energy density faktorAbb = 800000 ! Slope of remodelling algorithm faktorAuf = faktorAbb ! Slope of remodelling algorithm thick_min = thickini/3 ! Minimal thickness thick_max = thickini*3 ! Maximal thickness *ELSEIF,simType,EQ,'a',THEN !--- Geometry length = 400.0 ! Length (x) of plate, styropor height = 50.0 ! Height (y) of plate, styropor thickini = 50.0 ! Initial thickness of plate, styropor auflage = 10 ! determines resting surface of bridge !--- Material properties e_modul_ini = 7.0 ! Initial Young's modulus of the plates material (styropor) p_ratio = 0.1 ! Initial Poisson's ratio of the plates material (styropor) !--- Define loads force = -15 ! Load (Force, vertical). styropor !--- Properties of remodelling algorithm sollWert = 0.000001 ! Target for strain energy density faktorAbb = 150000 ! Slope of remodelling algorithm faktorAuf = faktorAbb ! Slope of remodelling algorithm thick_min = thickini/3 ! Minimal thickness thick_max = thickini*3 ! Maximal thickness *ELSE /eof *ENDIF !--- Global program properties nIter = 80 ! Number of remodelling iterations fineness = 1 ! Global mesh fineness (1 - good... 10 - poor) !nofel_horizontal = 200 ! No of elements for meshing !nofel_vertical = 25 !--- Properties of remodelling algorithm epsilon = sollWert/10 ! Threshold/tolerance for SED lower_limit = sollWert-epsilon ! Lower threshold upper_limit = sollWert+epsilon ! Upper threshold !=============================================================================== ! A. Preprocessor (Setting up the model) !=============================================================================== /PREP7 ! Switch to the preprocessor modul !=============================================================================== ! A.1 BUILD THE GEOMETRY !=============================================================================== !===== A.1.1 CREATE PLATE ====================================================== K,1, 0.0, 0.0, 0.0 ! Define keypoint via its coordinates x, y, z K,2, length, 0.0, 0.0 ! Define keypoint via its coordinates x, y, z K,3, length, height, 0.0 ! Define keypoint via its coordinates x, y, z K,4, 0.0, height, 0.0 ! Define keypoint via its coordinates x, y, z LSTR,1,2 ! Connect keypoints 1 and 2 to craete line 1 LSTR,2,3 ! Connect keypoints to craete a line LSTR,3,4 ! Connect keypoints to craete a line LSTR,4,1 ! Connect keypoints to craete a line AL,ALL ! Create area by all selected lines (1, 2, 3, 4) !===== A.1.4 VISUALIZATION OF THE CREATED ELEMENTS ============================= /PNUM, KP, 1 ! Switch numbering of keypoints on /PNUM, AREA, 1 ! Switch numbering of areas on /PBC,U,,1 ! Plot displacement BC symbol /PBC,F,,2 ! Plot force symbol with value KPLOT ! Plot keypoints APLOT ! Plot areas !=============================================================================== ! A.2 MESHING !=============================================================================== !===== A.2.1 ASSIGN THE ELEMENT TYPE =========================================== ET,1,plane182 ! Define the local element type 1 as a PLANE42 element KEYOPT, 1, 3, 3 ! Sets for element type 1 the key option 3 to 3 ! (plane stress with thickini) SMRTSIZE, fineness ! Mesh fineness !===== Better mesh size controll !MSHKEY, 1 ! Mapped meshing (1) or free meshing (0) !LESIZE, 1,,,nofel_horizontal ! Horizontal: Element devisions on line 1 !LESIZE, 4,,,nofel_vertical ! Vertical: Element devisions on line 4 !AMESH, 1 ! Mesh area number 1 !EPLOT !===== A.2.2 GENERATE SUBSET OF ELEMENTS OF MATERIAL NO. 1 ===================== TYPE,1 ! FE type of subseq. generated elements MAT,1 ! Material number of subseq. generated elements REAL,1 ! Real set number of subseq. generated elements AMESH, ALL ! Mesh areas -> elements of material no. 1 *GET, nElem, ELEM, 0, COUNT ! Get number of elements !===== A.2.3 VISUALIZATION OF THE CREATED ELEMENTS ============================= /PNUM,MAT,1 ! Switch numbering & color of material types on /NUMBER,1 ! Color items, do not show numbers /COLOR,NUM, 5,1 ! Assigns color 5 to Material 1 EPLOT ! Plot elements !=============================================================================== ! A.3 INITIAL MATERIAL PROPERTIES -- !!! ELEMENTWISE !!! !=============================================================================== !===== A.3.1 DEFINE REAL CONSTANTS ============================================= *DO,n,1,nElem ! For each element... REAL,n ! ... define a new real set... EMODIF, n, REAL, n ! ... assign that real set to a corresponding element... R,n,thickini ! and set the thickness value of the realset as defined *ENDDO !===== A.3.2 DEFINE MATERIAL PROPERTIES OF ELEMENTS ============================ ALLSEL MP, EX , 1, e_modul_ini ! Set e-module (global) MP, PRXY, 1, p_ratio ! Set poisson's ratio (global) !=============================================================================== ! A.4 APPLY LOAD AND BOUNDARY CONDITIONS !=============================================================================== !===== A.4.1 DISPLACEMENT BOUNDARY CONDITION =================================== NSEL,S,LOC,X,0.0,auflage ! Select a node at x = 0 (left side) NSEL,R,LOC,Y,0.0 D,all,UX,0.0 ! Set displacement ux to zero for selected node D,all,UY,0.0 ! Set displacement uy to zero for selected node NSEL,S,LOC,X,length-auflage,length ! Select a node at x = length (right side) NSEL,R,LOC,Y,0 D,all,UY, 0.0 ! Set displacement uy to zero for selected node ALLSEL ! Select all entities !===== A.4.2 APPLYING THE LOADS ================================================ !nodenum=NODE(length/2,0.0,0.0) ! Get node number at bottom middle nodenum=NODE(length/2,height,0.0) ! Get node number at top middle !nodenum=NODE(length/3,height,0.0) ! Get node number at top 1/3 !nodenum=NODE(2*length/3,height,0.0) ! Get node number at top 2/3 !F, nodenum0, FY, force/2 ! Apply load at node with number nn !F, nodenum, FY, force/2 ! Apply load at node with number nn F, nodenum, FY, force ALLSEL ! Select all entities !===== A.4.3 ARRAYS ANLEGEN (fuer elementbez. Daten) =========================== *DIM, thick_curr, ARRAY, nElem ! Create vector: current thickness *VFILL, thick_curr, DATA, thickini ! Initialize array with thickini *DIM, sed_val, ARRAY, nElem ! Create vector: SED value at element !=============================================================================== ! A.4 CREATE VECTOR PLOT OF STRAIN !=============================================================================== !===== A.4.4 Spannungsplot vor Optimierung ===================================== /SOLU ! Switch to the solution module ANTYPE,0 ! Select the static analysis type NLGEOM,ON SOLVE /POST1 ! Switch to Postprocesser /NUMBER,0 ! Swich back to normal coloring ESEL,S,LIVE /TITLE, Hauptspannungs-Richtungen vor Optimierung /VSCALE, ALL, 1.0, 0 PLVECT, S,,,,RAST,ELEM,OFF,1 /IMAGE,CAPTURE !===== A.4.5 Auslenkung vor Optimierung ======================================== /TITLE,Displacements u_y in mm PLNSOL, U, Y, 2 /PBC,F,,2 ! Plot boundary conditions with force /IMAGE, CAPTURE !=============================================================================== ! B. START REMODELING LOOP !=============================================================================== *DO,iter,1,nIter ! Optimization loop - more iter -> greater optimization !=========================================================================== !===== B.1 Solution ======================================================== !=========================================================================== /SOLU ! Switch to the solution module ANTYPE,0 ! Select the static analysis type NLGEOM,ON SOLVE ! Solve current load step !=========================================================================== !===== B.2 Postprocessor =================================================== !=========================================================================== /POST1 ! Switch to the postprocessor module !===== B.2.1 READ SED ====================================================== ETABLE,et_sed,SEND,ELASTIC ! Save SED to "et_sed" *DO,el,1,nElem ! Loop over all elements *GET,sed_val(el),ELEM,el,ETAB,et_sed ! ... and save value into array *ENDDO !===== B.2.2 Plot SED for each step ======================================== /TITLE,'Strain-Energy-Density (SED) Schritt = %iter%' /DSCALE,1,1.0 /CONTOUR,,,0,,2*upper_limit !ESEL,S,LIVE PLESOL, SEND, ELASTIC *IF,mod(iter,20),EQ,0,THEN ! Capture every 20th image /IMAGE, CAPTURE *ENDIF !=========================================================================== !===== B.3 Preprocessor (Setting up the model) ============================= !=========================================================================== /PREP7 ! Switch to Preprocor !!===== B.3.1 Remodeling, change properties of material ==================== *DO,el,1,nElem ! Loop over all elements !====== Determine delta thickness delta = 0 *IF,sed_val(el),LT,lower_limit,THEN ! modify thickness if SED value is outside of boundary constraints delta = FaktorAbb*(sed_val(el) - lower_limit) *ELSEIF,sed_val(el),GT,upper_limit,THEN delta = FaktorAuf*(sed_val(el) - upper_limit) *ELSE delta = 0.0 *ENDIF !====== Determine if element has previously reached a minimum is_already_min = 0 *IF,thick_curr(el),EQ,thick_min,THEN is_already_min = 1 *ENDIF !====== Change thickness of element thick_curr(el) = thick_curr(el) + delta ! Calculate thickness *IF,thick_curr(el),LE,thick_min,THEN ! Ensure modification is within boundary *IF,is_already_min,EQ,1,AND,thick_curr(el),NE,0,THEN EKILL,el thick_curr(el) = 0 *ELSE thick_curr(el) = thick_min *ENDIF *ELSEIF,thick_curr(el),GE,thick_max,THEN ! Limit modification to boundaries thick_curr(el) = thick_max *ENDIF R,el,thick_curr(el) ! Set new thickness *ENDDO *ENDDO !=============================================================================== ! Scale Thickness !=============================================================================== base_thick = thickini*nElem new_thick = 0 *DO,el,1,nElem new_thick = new_thick + thick_curr(el) *ENDDO scaling = base_thick/new_thick ! determines scaling factor for each element, to retain initial volume *DO,el,1,nElem thick_curr(el) = scaling*thick_curr(el) R,el,thick_curr(el) ! assign new thickness to element *ENDDO !=============================================================================== ! END OF LOOP !=============================================================================== /SOLU ! Switch to the solution module ANTYPE,0 ! Select the static analysis type NLGEOM,ON SOLVE ! Solve current load step !=============================================================================== ! C. POSTPROCESSOR !=============================================================================== /POST1 ! Switch to Postprocesser !===== C.0.1 SED =============================================================== ESEL,S,LIVE /TITLE,'Strain-Energy-Density (SED) Schritt = %iter%' /DSCALE,1,1.0 /CONTOUR,,,0,,2*upper_limit PLESOL, SEND, ELASTIC !===== C.1.1 Element-Table anlegen ============================================= ETABLE, et_res_thickn, VOLU, ! Volume etable !===== C.1.2 Element-Table mit E-Modeul fuellen ================================ *VPUT, thick_curr, ELEM, 1, ETAB, et_res_thickn, 0 ! Replace etable with element thickness !===== C.1.3 Dicke plotten ===================================================== /CONTOUR,,,AUTO /DSCALE,1,1 ! show displacement for material /TITLE,'Dicken-Verteilung nach Schritt = %iter%' PLETAB, et_res_thickn /IMAGE,CAPTURE !===== C.1.4 Haupspannungsplot nach Optimierung ================================= /NUMBER,0 /TITLE, Hauptspannungs-Richtungen nach Optimierung /VSCALE, ALL, 1.0, 0 PLVECT, S,,,,RAST,ELEM,OFF,1 /IMAGE,CAPTURE !===== C.1.5 Auslenkung nach Optimierung ======================================== /TITLE,Displacements u_y in mm PLNSOL, U, Y, 1 /PBC,F,,2 ! Plot boundary conditions with force /IMAGE, CAPTURE