×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Design Optimization in ANSYS

Design Optimization in ANSYS

Design Optimization in ANSYS

(OP)
Hi everyone

I am designing a composite propeller blade in ANSYS and I want to optimize layer angles. As such I want to use ANSYS Design Optimization (I know it is limited but nevertheless I am happy with it).

I have a macro (named MAIN) where I call (using /input) many other files where I: Import Cad model, define real const, define material props, apply loads, etc.. Moreover in this same macro I have issued several solve commands (to solve hydroelastic problem using sequential coupling).

Now I want to use the Design Optimization Tool in ANSYS. So I started by doing single optimization runs (OPTYPE,RUN) just to see what was happening.
So I have created a macro (named OPT) for the optimization which calls the macro MAIN at the star using *USE command. Next I do a single optimization run (using *OPTYPE,RUN and OPEXE).

The result is that I do not get the same results when simply running the macro MAIN (using the *USE command) and the single optimization run (using *OPTYPE,RUN and OPEXE).

The first thing I do not understand is what does ANSYS do when running an optimization loop. It seems to understand that there is no need to import the cad model again for instance nor to generate the mesh. So, what else does it knows it does not have to do again? Could the multiple solves (including several restart solves inside a do loop) be a problem? Anyone has any idea?

Thanks in advance. See the code below.

Regards


P.S.: This it the code:

******   MACRO MAIN   ******



!******   STARTING OPTIONS   ******

/FILENAME,Prop
/TITLE,Prop
/CWD,'C:\MSc_AUX\WD0925'
!/CONF,NPROC,4
/NERR,-5,110000
*AFUN,DEG
/UNITS,SI
/PREP7                                   !ENTER PREPROCESSOR

!General Settings
BOPTN,KEEP,NO                            !Keep entities after boolean operations
DOFSEL,S,                                !Add vs Replace DOF
DCUM,repl,1, ,0,                         
DOFSEL,ALL
DOFSEL,S, ,                              !Add vs Replace Forces
FCUM,ADD,1,
DOFSEL,ALL
SFCUM,PRES,REPL,1,1,                      !Add vs Replace Pressures

!Define Local coordinate system
LOCAL,11,0,0,0,0,30,0,90     
LOCAL,12,0,0,0,0,30,0,0
CSYS,0

*CREATE,PropPD0925


/PREP7


!******   DESIGN VARIABLES   ******

theta_iter1=0
theta_iter2=0
theta_iter3=0
theta_iter4=0

!******   IMPORT CAD MODEL   ******
/INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\ImportCAD', 'txt', ,,


!******   DEFINE ELEMENT TYPE AND MATERIAL PROPERTIES   ******
/INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\ETMAT', 'txt', ,,

!DEFINE REAL CONSTANTS
    /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\REAL', 'txt', ,,

    !MESH MODEL
    /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\Mesh', 'txt', ,,


!*****************************************
!******   START OF ITERATION LOOP   ******
!*****************************************


!******   DECLARE RESULT STORING ARRAYS   ******
*DIM,reactionForces,ARRAY,10,10,300
*DIM,convT,ARRAY,10
*DIM,convQ,ARRAY,10

!******   INITALIZE COUNTERS   ******
r_counter=1


!******   MODIFY REAL CONSTANTS   ******
    !/INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\REAL - ITER', 'txt', ,,


    !******   BOUNDARY CONDITIONS   ******
    /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\BC - MOPER', 'txt', ,,
    !/INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\BC - MOPER - IMPROVED', 'txt', ,,


    !******   DETERMINE RESULTANT FORCE FROM ESPPRO PRESSURE DISTRIBUTION EXPANDED USING SHAPE FUNCTIONS   ******
    /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\ESPRES', 'txt', ,,

c***,First solve
    
    !******   SOLVE   ******
    /SOLU
    ANTYPE, STATIC
    SOLVE

    PARSAV,ALL,'arrayFIRSTSOLVE',' ',' '
    
    !******   GET ANSYS REACTION FORCES X AND Y DIRECTIONS   ******
    /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\REACTION', 'txt', ,,
    
    
    !****** STORE RESULTING FORCES   ******    
    reactionForces(1,1,r_counter)=RX
    reactionForces(1,2,r_counter)=RY
    reactionForces(1,3,r_counter)=XP
    reactionForces(1,4,r_counter)=YP
    
    *DO,t,1,1,1
    
        !******   READ DEFORMED SHAPE   ******
        /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\ANS2ESP', 'txt', ,,


        !******   CALL PROGRAM MAIN (ASSEMBLE .PROP FILE)   ******
        /SYS,C:\MSc_AUX\Main\ASSMBL0925
    

        !******   CALL ESPPRO   ******
        /SYS,C:\MSc_AUX\WD0925\esppro
    

        !******   BOUNDARY CONDITIONS   ******
        /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\BC - MOPER - ITER', 'txt', ,,
        !/INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\BC - MOPER - IMPROVED - ITER', 'txt', ,,

C***,loop solve
        !******   RESTART SOLVE   ******
        /SOLU
        ANTYPE, STATIC, REST
        SOLVE


        !******   DETERMINE RESULTANT FORCE FROM ESPPRO PRESSURE DISTRIBUTION EXPANDED USING SHAPE FUNCTIONS   ******
!        /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\ESPRES - ITER', 'txt', ,,


        !******   GET ANSYS REACTION FORCES X AND Y DIRECTIONS   ******
        /INPUT, 'C:\Ze Pedro\Msc. Thesis\ANSYS\Scripts\Blade Shell v4\SIMPLE\REACTION', 'txt', ,,


        !****** STORE RESULTING FORCES   ******    
        reactionForces(t+1,1,r_counter)=RX
        reactionForces(t+1,2,r_counter)=RY
        reactionForces(t+1,3,r_counter)=XP
        reactionForces(t+1,4,r_counter)=YP

        

        convT1=abs(abs(reactionForces(t+1,1,r_counter))-abs(reactionForces(t,1,r_counter)))
        convT2=abs(reactionForces(t+1,1,r_counter))

        convQ1=abs(abs(reactionForces(t+1,2,r_counter))-abs(reactionForces(t,2,r_counter)))
        convQ2=abs(reactionForces(t+1,2,r_counter))
        
        convT(t)=convT1/convT2*100
        convQ(t)=convQ1/convQ2*100

        !OBJ_FUNC=RX/RY

        *IF,convT(t),LT,1,AND,convQ(t),LT,1,THEN
        !OBJ_FUNC=RX/RY    
        *EXIT
        *ENDIF

        PARSAV,ALL,'arrayLOOP',' ',' '


    *ENDDO

    OBJ_FUNC=RX!/RY

    PARSAV,ALL,'arrayFINAL',' ',' '  

    r_counter=r_counter+1

    *DEL,reactionForces,,,nopr
    
    ALLSEL,ALL

*END


******   OPTIMIZATION MACRO   ******

*USE,PropPD0925
ALLSEL,ALL

/OPT
OPCLR
OPANL,PropPD0925

OPVAR,theta_iter1,DV,0,180
OPVAR,theta_iter2,DV,0,180
OPVAR,theta_iter3,DV,0,180
OPVAR,theta_iter4,DV,0,180

OPVAR,OBJ_FUNC,obj,,,0.1

OPLOOP,PREP , IGNORE, ALL


!ONE RUN
OPKEEP,ON
OPTYPE,RUN
OPSAVE,anfile,opt0
OPEXE


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources