How to start a static analysis with element density data?
Hello,
I am working on density-based method topology optimization. The compliance optimization is defined as:
- find X = [x_1, x_2, ... ]^T
- min u^T * K(X) * u
- such that K(X)*u = F and sum of all x_j * dV - V <=0
- (X: element density, u: displacement vector, K: global stiffness matrix, F: external force vector, V: constraint volume)
I want to start a linear static analysis with X = [x_1, x_2, ... ]^T initial element density as an input. Optistruct can optimize this process itself but I want to try novel filters, penalty algorithms, other optimization algorithms etc. without using optistruct topology optimization.
To try this, I can modify the optistruct FEM file, for example defining different material and property for every mesh element. But this method takes a long time.
Optistruct has already suitable to optimize like that. How I can do easily what I explained?
Thanks.
Best Answer
-
Hi
Attached file is a sample script.
Tested on HM2019:
proc changeE args { set inputX [tk_getOpenFile -title "Select file of input X:"] if {[file exists $inputX]} { set fpt [open $inputX r] set elemId_Ef [read -nonewline $fpt] close $fpt *setoption mixed_property_warning=0 *createmarkpanel elems 1 "Select elements to be assigned new E:" foreach elemId [hm_getmark elems 1] { #get current material infos: set elemMatName [hm_getentityvalue elems $elemId material.name 1] set elemE [hm_getentityvalue elems $elemId material.\$E 0] if {![dict exists $elemId_Ef $elemId]} continue set elemEf [dict get $elemId_Ef $elemId] set elemNewE [expr {$elemE * $elemEf}] #create new material: set newMatName [hm_getincrementalname mats NEWMAT_] *collectorcreatesameas materials $newMatName $elemMatName "" 11 #assign new E: set newMatId [hm_latestentityid mats] *attributeupdatedouble materials $newMatId 1 1 1 0 $elemNewE #get current property infos: set elemPropName [hm_getentityvalue elems $elemId property.name 1] #create new property: set newPropName [hm_getincrementalname props NEWPROP_] *collectorcreatesameas properties $newPropName $elemPropName "" 11 #assign new material: *createmark props 1 -1 *materialupdate props 1 $newMatName #assign new property: *createmark elems 1 $elemId *propertyupdate elements 1 $newPropName } *setoption mixed_property_warning=1 *setelementcolormode 3 *EntityPreviewUnused materials 1 *deletemark mats 1 *createmark mats 1 all *autocolorwithmark mats 1 *createmark props 1 all *autocolorwithmark props 1 } } changeE
1
Answers
-
Topology Optiimization solvers are very efficient in calculating these changes as they have some semi-analytical calculations already available for the optimization solver, such as sensitivities calculation for each element, for a given response, such as compliance.
If you try to perform this on your own, you would probably need to perform these calculations using finite differences or other more costly method, and therefore your external code wouldn't be so efficient. For some cases you could output design sensitivities from OS and try to use these.
Also depends on the scale that you want to go with your optimizer, as the larger the number of design variables, the larger will be computation time. Commercial solvers had developed many different algorithms for dealing with such large problems.
I'm not sure how familiar you are with Topology Optimization, but maybe starting from the well know 99 lines topology optimization and then evolve to more sofisticated solutions.
0 -
Hi @Faik Fatih Korkmaz ,
could you give a sample *.fem file, and a sample [x_1, x_2,...]^T data?
I think it will not take a lot of time, by a short tcl script.
If it is an unique way now, it's worth to try!
0 -
tinh said:
Hi @Faik Fatih Korkmaz ,
could you give a sample *.fem file, and a sample [x_1, x_2,...]^T data?
I think it will not take a lot of time, by a short tcl script.
If it is an unique way now, it's worth to try!
Thanks for your answer.
I have quoted an optistruct fem model below. This is a simple cantilever beam bending model:SUBCASE 1 LABEL solve1 ANALYSIS STATICS SPC = 1 LOAD = 2 BEGIN BULK GRID 1 0.0 0.0 0.0 GRID 2 0.0 0.0 0.0 GRID 3 10.0 0.0 0.0 GRID 4 20.0 0.0 0.0 GRID 5 30.0 0.0 0.0 GRID 6 40.0 0.0 0.0 GRID 7 50.0 0.0 0.0 ... (total GRID number is 67) CQUAD4 1 1 40 41 36 37 CQUAD4 2 1 41 32 33 36 CQUAD4 3 1 20 21 41 40 CQUAD4 4 1 21 22 32 41 CQUAD4 5 1 37 38 42 40 CQUAD4 6 1 40 42 19 20 CQUAD4 7 1 16 43 39 15 ... (total MESH element number 50) PSHELL 1 13.0 1 1 0.0 MAT1 1210000.0 0.3 SPC 1 1 123456 0.0 SPC 1 2 123456 0.0 ... FORCE 2 12 01.0 0.0 -10.0 0.0 FORCE 2 13 01.0 0.0 -10.0 0.0 ... ENDDATA
I want to start an analysis by using element density. This mean:
E_new = E_now * X, and X in [0, 1]
My X data for all mesh element:1 0.5 2 0.5 3 0.5 ... 50 0.5
I had tried to change every mesh property:
CQUAD4 ID NEWPROP NODE1 NODE2 NODE3 NODE4
by adding new properties:
PSHELL NEWPROP NEWMAT3.0 1 1 0.0 MAT1 NEWMAT E_NEW 0.3
But I am not sure this is practical and working.
0 -
Adriano Koga_20259 said:
Topology Optiimization solvers are very efficient in calculating these changes as they have some semi-analytical calculations already available for the optimization solver, such as sensitivities calculation for each element, for a given response, such as compliance.
If you try to perform this on your own, you would probably need to perform these calculations using finite differences or other more costly method, and therefore your external code wouldn't be so efficient. For some cases you could output design sensitivities from OS and try to use these.
Also depends on the scale that you want to go with your optimizer, as the larger the number of design variables, the larger will be computation time. Commercial solvers had developed many different algorithms for dealing with such large problems.
I'm not sure how familiar you are with Topology Optimization, but maybe starting from the well know 99 lines topology optimization and then evolve to more sofisticated solutions.
Thanks for your answer.
I agree with your opinions. Especially, design sensitivities and other algorithms used by optimizer software. Maybe, this reference (and similar) can help with details that you try to explain to me [1]. Besides, I am not trying this process to large scale components.
99 Lines T.O. caught my attention. Thank you.[1] Sigmund, O., & Petersson, J. (1998). Numerical instabilities in topology optimization: A survey on procedures dealing with checkerboards, mesh-dependencies and local minima. Structural Optimization, 16(1), 68–75. https://doi.org/10.1007/BF01214002
0 -
Hi
Attached file is a sample script.
Tested on HM2019:
proc changeE args { set inputX [tk_getOpenFile -title "Select file of input X:"] if {[file exists $inputX]} { set fpt [open $inputX r] set elemId_Ef [read -nonewline $fpt] close $fpt *setoption mixed_property_warning=0 *createmarkpanel elems 1 "Select elements to be assigned new E:" foreach elemId [hm_getmark elems 1] { #get current material infos: set elemMatName [hm_getentityvalue elems $elemId material.name 1] set elemE [hm_getentityvalue elems $elemId material.\$E 0] if {![dict exists $elemId_Ef $elemId]} continue set elemEf [dict get $elemId_Ef $elemId] set elemNewE [expr {$elemE * $elemEf}] #create new material: set newMatName [hm_getincrementalname mats NEWMAT_] *collectorcreatesameas materials $newMatName $elemMatName "" 11 #assign new E: set newMatId [hm_latestentityid mats] *attributeupdatedouble materials $newMatId 1 1 1 0 $elemNewE #get current property infos: set elemPropName [hm_getentityvalue elems $elemId property.name 1] #create new property: set newPropName [hm_getincrementalname props NEWPROP_] *collectorcreatesameas properties $newPropName $elemPropName "" 11 #assign new material: *createmark props 1 -1 *materialupdate props 1 $newMatName #assign new property: *createmark elems 1 $elemId *propertyupdate elements 1 $newPropName } *setoption mixed_property_warning=1 *setelementcolormode 3 *EntityPreviewUnused materials 1 *deletemark mats 1 *createmark mats 1 all *autocolorwithmark mats 1 *createmark props 1 all *autocolorwithmark props 1 } } changeE
1 -
tinh said:
Hi
Attached file is a sample script.
Tested on HM2019:
proc changeE args { set inputX [tk_getOpenFile -title "Select file of input X:"] if {[file exists $inputX]} { set fpt [open $inputX r] set elemId_Ef [read -nonewline $fpt] close $fpt *setoption mixed_property_warning=0 *createmarkpanel elems 1 "Select elements to be assigned new E:" foreach elemId [hm_getmark elems 1] { #get current material infos: set elemMatName [hm_getentityvalue elems $elemId material.name 1] set elemE [hm_getentityvalue elems $elemId material.\$E 0] if {![dict exists $elemId_Ef $elemId]} continue set elemEf [dict get $elemId_Ef $elemId] set elemNewE [expr {$elemE * $elemEf}] #create new material: set newMatName [hm_getincrementalname mats NEWMAT_] *collectorcreatesameas materials $newMatName $elemMatName "" 11 #assign new E: set newMatId [hm_latestentityid mats] *attributeupdatedouble materials $newMatId 1 1 1 0 $elemNewE #get current property infos: set elemPropName [hm_getentityvalue elems $elemId property.name 1] #create new property: set newPropName [hm_getincrementalname props NEWPROP_] *collectorcreatesameas properties $newPropName $elemPropName "" 11 #assign new material: *createmark props 1 -1 *materialupdate props 1 $newMatName #assign new property: *createmark elems 1 $elemId *propertyupdate elements 1 $newPropName } *setoption mixed_property_warning=1 *setelementcolormode 3 *EntityPreviewUnused materials 1 *deletemark mats 1 *createmark mats 1 all *autocolorwithmark mats 1 *createmark props 1 all *autocolorwithmark props 1 } } changeE
Thank you. It is working.
0