Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch processing with ansys classis v10 can anyone help? 2

Status
Not open for further replies.

vinny31

Mechanical
Oct 4, 2005
48
hi All

i have a simple problem with ansys v10 classic interface (mulitphysics). i am a new user to this FE package and i would like to run a series of quick jobs one after another overnight. Basically each job is placed within its own folder and each has it own input file. The OS i am using is windows xp.
Basically i would love if someone could start me off on this problem. I would like if i could read in a simple APDL or txt file (batch file) which would locate each folder, then the .db file within and read into the .db file the corresponding input file. This batch command file would run each individual job in a similar manner.

Can anyone help me, i know it should be straight forward, but im still only learning the package.

 
Replies continue below

Recommended for you

Hi,
I can give you a log file I use to start several jobs exactly in the manner you are describing.
I have no time to comment it for you though, so if there are some points that are unclear please refer to the help file.
Please also note that this strategy is useful for some particular applications, it is not the best way to run several loadcases / loadsteps.
It is also worth having a look on Ansys Batch, without calling for the Classical interface.

Regards

! LOADCASES LAUNCHER ("independent" method)

!**************************************************************************

! 1) Operations relative to loadcase 1:

salta1=1 ! 1=skip this loadcase, 0=operate

*IF,salta1,EQ,1,THEN !doesn't do anything with loadcase 1
*GO,:salto1

*ELSE
! has to deal with lc01, so it changes to the correct workspace:

/cwd,C:\wdir\V2\lc01\ ! changes working
! directory
/filname,csup_lc01,1 ! changes filename

resume,csup_lc01,db,,0, ! resumes the
! database #1

crea1=0 ! 1=create loadstep anew, 0=reuse
esegui1=1 ! 1=solve loadcase, 0=don't solve

*IF,crea1,EQ,1,THEN ! has to create the loadstep anew

/prep7 ! recalls the pre-processor
allsel ! ensures that everything is selected

csys,12
esys,12

! no bearing loads in this case

! recalls routine for applying pressure loads
/input,bc_pg01,log

allsel
lsdele,1 ! deletes any pre-existing file for this loadstep
lswrite,1 ! writes this loadstep file anew
finish ! exits any processor
*ENDIF

*IF,esegui1,EQ,1,THEN ! has to solve the loadcase

/solu ! enters the solver
/nerr,,10000000, ! sets max # of errors to very high

allsel ! ensures that everything is selected

lsclear,all ! clears all pre-existing loads and options
lsread,1 ! reads loadstep file #1

eqslv,pcg,1e-6 ! selects specified solver and options
solve ! runs the solution
finish ! exits any processor

*ENDIF

*ENDIF

:salto1
! 2) Operations relative to loadcase 2:

salta2=0 ! 1=skip this loadcase, 0=operate

*IF,salta2,EQ,1,THEN !doesn't do anything with loadcase 2
*GO,:salto2

*ELSE
! has to deal with lc02, so it changes to the correct workspace:

/cwd,C:\Dir\V2\lc02\ ! changes working
! directory
/filname,csup_lc02,1 ! changes filename

resume,csup_lc02,db,,0, ! resumes the
! database #2

crea2=0 ! 1=create loadstep anew, 0=reuse
esegui2=1 ! 1=solve loadcase, 0=don't solve

*IF,crea2,EQ,1,THEN ! has to create the loadstep anew

/prep7 ! recalls the pre-processor
allsel ! ensures that everything is selected

csys,12
esys,12

! no bearing loads in this case

! recalls routine for applying pressure loads
/input,bc_pg02,log

allsel
lsdele,2 ! deletes any pre-existing file for this loadstep
lswrite,2 ! writes this loadstep file anew
finish ! exits any processor
*ENDIF

*IF,esegui2,EQ,1,THEN ! has to solve the loadcase

/solu ! enters the solver
/nerr,,10000000, ! sets max # of errors to very high

allsel ! ensures that everything is selected

lsclear,all ! clears all pre-existing loads and options
lsread,2 ! reads loadstep file #2

eqslv,pcg,1e-6 ! selects specified solver and options
neqit,25
solve ! runs the solution
finish ! exits any processor

*ENDIF

*ENDIF

:salto2
! 3) Operations relative to loadcase 3:

salta3=0 ! 1=skip this loadcase, 0=operate

*IF,salta3,EQ,1,THEN !doesn't do anything with loadcase 3
*GO,:salto3

*ELSE
! has to deal with lc03, so it changes to the correct workspace:

/cwd,C:\Dir\V2\lc03\ ! changes working
! directory
/filname,csup_lc03,1 ! changes filename

resume,csup_lc03,db,,0, ! resumes the
! database #3

crea3=0 ! 1=create loadstep anew, 0=reuse
esegui3=1 ! 1=solve loadcase, 0=don't solve


*IF,crea3,EQ,1,THEN ! has to create the loadstep anew

/prep7 ! recalls the pre-processor
allsel ! ensures that everything is selected

csys,12
esys,12

! bearing loads already applied by Workbench.
!/input,bc_bp03,log !routine not executed

! recalls routine for applying pressure gradients
/input,bc_pg03,log

allsel
lsdele,3 ! deletes any pre-existing file for this loadstep
lswrite,3 ! writes this loadstep file anew
finish ! exits any processor
*ENDIF

*IF,esegui3,EQ,1,THEN ! has to solve the loadcase

/solu ! enters the solver
/nerr,,10000000, ! sets max # of errors to very high

allsel ! ensures that everything is selected

lsclear,all ! clears all pre-existing loads and options
lsread,3 ! reads loadstep file #3

eqslv,pcg,1e-6 ! selects specified solver and options
neqit,25
solve ! runs the solution
finish ! exits any processor

*ENDIF

*ENDIF

:salto3
! 4) Operations relative to loadcase 4:

salta4=0 ! 1=skip this loadcase, 0=operate

*IF,salta4,EQ,1,THEN !doesn't do anything with loadcase 4
*GO,:salto4

*ELSE
! has to deal with lc04, so it changes to the correct workspace:

/cwd,C:\Dir\V2\lc04\ ! changes working
! directory
/filname,csup_lc04,1 ! changes filename

resume,csup_lc04,db,,0, ! resumes the
! database #4

crea4=0 ! 1=create loadstep anew, 0=reuse
esegui4=1 ! 1=solve loadcase, 0=don't solve

*IF,crea4,EQ,1,THEN ! has to create the loadstep anew

/prep7 ! recalls the pre-processor
allsel ! ensures that everything is selected

csys,12
esys,12

! bearing loads already applied by Workbench.
!/input,bc_bp04,log !routine not executed

! recalls routine for applying pressure loads
/input,bc_pg04,log

allsel
lsdele,4 ! deletes any pre-existing file for this loadstep
lswrite,4 ! writes this loadstep file anew
finish ! exits any processor
*ENDIF

*IF,esegui4,EQ,1,THEN ! has to solve the loadcase

/solu ! enters the solver
/nerr,,10000000, ! sets max # of errors to very high

allsel ! ensures that everything is selected

lsclear,all ! clears all pre-existing loads and options
lsread,4 ! reads loadstep file #4

eqslv,pcg,1e-6 ! selects specified solver and options
neqit,25
solve ! runs the solution
finish ! exits any processor

*ENDIF

*ENDIF

:salto4 ! end of routine
 
Hi thanks for the reply.
However it seems a little complicated for what i need, i only need a file which can
1. open a selected folder,
2. select the .db file within
3. start/run the analysis within this folder by selecting
the appropiate input file within.
4. Run and Complete ths analysis and job and save results
within.
5. exit this folder and move to the next folder and start
the same process again using the corresponding input
and .db files within.

I tried to use ansys batch option but i am having no luck.

Any ideas, can you help
 
Hi,
well, you can adapt my log file by eliminating all the conditionals (IF... THEN...), the jumps (GOTO...), and the routine calls (/inp,...). The log file should resemble something like:

/cwd,...
/filname,...
resume,...
allsel
/solu
eqslv,...
solve
finish

Repeat this block of commands for each file you want to launch.
Btw, the log file would be launched from within the interface, using "File -> read input from...".

Regards
 
My solution is similar, but for completely self contained input files...

Code:
/CLEAR,NOSTART  
!*
/INPUT,'Input_Filename.txt',,'C:\File_Directory',, 0
!*
/INPUT,'Input_Filename2.txt',,'C:\Other_Directory',, 0

Within the input files, you must be careful not to overwrite you results, so make sure you have different file names, and change the directory if necessary. Like so:

Code:
/output,%root_filename%%use_this_to_append_things_to_the_filename_programmatically%,txt,C:\Dir\Subdir,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor