!=============================================================================== ! PROGRAM: MMSM 1 Lab No 9 (Ansys Exercise 7) ! PROJEKT: REMODELING: Iterative adaptation of local material ! properties to local mechanical environment. ! TASK: 2D model of a plate with hole (compare to Exercise 5) ! with initially constant material properties undergoes an ! iterative change of element material properties similar ! to bone remodeling or growth of wood. The changing rate ! is modeled dependent on the local mechanical stress state. ! AUTHOR: Simon ! LAST CHANGES: 13.01.2011 ! ! COMPUTER: ! OPERATING SYSTEM: ! ANSYS Version: License: Teaching Advanced: 15.0 ! ! CALL: /input,Remodeling-Template.inp ! !=============================================================================== !=== Beginning finish ! Stops all modules (preprocessor, solution, postprocessor) /clear ! Start a new analysis, delete the old database (file.db) /PLOPTS, INFO, AUTO ! Good old contour labeling style !=============================================================================== ! Parameters (lenght in mm, forces in N => stiffnesses and stresses in N/mm) !=============================================================================== !--- Zur Programmsteuerung nIter = 10 ! Anzahl der Iterationen zum Materialumbau !--- Zur Geometrie Length = 500.0 ! Length (x) of plate Height = 500.0 ! Height (y) of plate Thickn = 20.0 ! Thickness of plate Diameter = 400.0 ! Diameter of the hole x_hole = 250.0 ! Verticale position of the holes center (from left) y_hole = 250.0 ! Horizontale position of the holes center (from bottom) !--- Zur Last Force = -100000.0 ! Load (Force, vertical) !--- Zum initialen Werkstoff Young_ini = 210000.0 ! Initial Young's modulus of the plates material (steel) Poiss_ini = 0.3 ! Initial Poisson's ratio of the plates material (steel) !--- Zur Remodelling-Funktion SollWert = 250.0 ! Z.B. gewünschte Spannung im Material Epsilon = 50.0 ! Schaltbreite, (threshold) FaktorAbb = 100.0 ! Steigung der Umbaufunktion Abbau FaktorAuf = 100.0 ! Steigung der Umbaufunktion Aufbau Limit_U = SollWert - Epsilon ! Untere Schaltgrenze Limit_O = SollWert + Epsilon ! Obere Schaltgrenze EMod_min = Young_ini/100 ! Minimal zugelassene Werkstoffsteifigkeit EMod_max = Young_ini*2 ! Minimal zugelassene Werkstoffsteifigkeit !=============================================================================== ! A. Preprocessor (Setting up the model) !=============================================================================== /prep7 ! Switch to the preprocessor modul !=== Build the geometry by means of bottom-up method !--- Create keypoints k,1, 0.0, 0.0, 0.0 k,2, Length, 0.0, 0.0 k,3, Length, Height, 0.0 k,4, 0.0, Height, 0.0 !--- Create lines 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 !--- Create area al,all ! Create area by all selected lines (1, 2, 3, 4) !--- Create circular area lsel,none ! Unselect all previous defined lines k, 5, x_hole, y_hole, 0.0 ! Create keypoint at circle center circle, 5, Diameter/2 ! Create circle lines al,all ! Create area by all selected lines allsel ! Select everything !--- Loch ausschneiden (Boolsche Operation) asba,1,2,,delete,delete ! cut out hole (2) from plate (1) and get plate with hole (3) /pnum,area,1 ! Switch numbering of lines on aplot ! Plot areas !=== Meshing et,1,plane42 ! Define the local element type 1 as a PLANE42 element keyopt,1,3,3 ! Sets key option 3 (of elem type 1) to 3 (plane stress with thickn) smrtsize, 4 ! Globale Netzfeinheit 1(fein)..10(grob) amesh, 3 ! Meshing areas with this number eplot ! Plot elements !=== Arrays (fuer elementbez. Daten) anlegen *GET, nElem, ELEM, 0, COUNT ! Get number of elements *dim,IstWert,array,nElem ! Ein Feld (Vektor) anlegen *dim,EMod,array,nElem ! Ein Feld (Vektor) anlegen *dim,DeltaE,array,nElem ! Ein Feld (Vektor) anlegen !=== Initial definition of material properties, one for each of the FE allsel *do,el,1,nElem ! Schleife ueber alle Elemente mp,ex,el,Young_ini ! E-Modul zuweisen mp,prxy,el,Poiss_ini ! Querkontraktionszahl zuweisen emodif,el,mat,el ! Element el Mat.typ el zuweisen *enddo !=== Define real constants r,1,Thickn ! Define thickness of the plate into real set number 1 !=== Apply Load and Boundary Conditions !--- Displacement boundary conditions nsel,s,loc,x,0.0 ! Select all nodes at x = 0 (left side) d,all,ux,0.0 ! Set displacement ux to zero for selected nodes d,all,uy,0.0 ! Set displacement uy to zero for selected nodes allsel ! Select all entities !--- Applying the load as a single force nn = node(Length,Height,0.0) ! Get node number at location x, y, z (bottom right corner) f,nn,fy,Force ! Apply load at node with number nn !=============================================================================== ! START REMODELING LOOP !=============================================================================== *do,iter,1,nIter ! Schleife ueber Umbauschritte !====== Solution /solu ! Switch to the solution module antype,0 ! Select the static analysis type solve ! Solve current load step !====== Postprocessor /post1 ! Switch to the postprocessor module !=== Ein lokales Elementergebnis auslesen und in einem Vektor abspeichern etable,MisSp,s,eqv ! Ein Element-Erg. in der "E-Table" fuer alle Elemente (vektoriell) zur Verfueg. stellen *do,el,1,nElem ! Schleife ueber alle Elemente *GET,IstWert(el),ELEM,el,etab,MisSp ! ... und dann Element-Erg auslesen *enddo !=== Zwischenergebnisse zur Kontrolle ausdrucken /title,'Von-Mises-Vergleichsspannung Schritt = %iter%' /dscale,1,1.0 /contour,,,0,,350 plesol, s, eqv !--- Pause einlegen und evtl. abbrechen ! *ask,aa,'= Continue! 0 = Stop',1 ! *if,aa,eq,0,:ENDE !=== Remodeling-Funktion *do,el,1,nElem ! Schleife ueber alle Elemente *if,IstWert(el),lt,Limit_U,then DeltaE(el) = FaktorAbb*(IstWert(el) - Limit_U) *elseif,IstWert(el),gt,Limit_O,then DeltaE(el) = FaktorAuf*(IstWert(el) - Limit_O) *else DeltaE(el) = 0.0 *endif *enddo !=== Do the remodeling, Werkstoff aendern /prep7 ! Switch to Preprocor *do,el,1,nElem ! Schleife ueber alle Elemente *get,mat_no,mat,el ! Get material number of each elem *get,EMod(el),ex,mat_no ! Get E modulus of that material number EMod(el) = EMod(el) + DeltaE(el) ! E-Modul aendern *if,EMod(el),le,EMod_min,then ! Abbau begrenzen EMod(el) = EMod_min *elseif,EMod(el),ge,EMod_max,then ! Aufbau begrenzen EMod(el) = EMod_max *endif mp,ex,el,EMod(el) ! E-Modul zuweisen *enddo !=============================================================================== ! END OF LOOP !=============================================================================== *enddo /post1 ! Switch to Postprocesser !=== Plot des E-Moduls !--- El.-Table-Platzhalter anlegen; zunaechst willk. mit epto,x; spaeter ueberschreiben etable,emodet,epto,x ! nur zur Visualisierung der E-Module !--- ElemTable mit tatsaechlichen Sondergroessen füllen *vput,emod(1),elem,1,etab,emodet,0 ! E-Modul !--- Plot /contour /title,E-Modul pletab,emodet,noavg !=============================================================================== ! END LABLE !=============================================================================== :ENDE