CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS

DO Loop in APDL

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 23, 2017, 13:48
Smile DO Loop in APDL
  #1
New Member
 
Claas
Join Date: May 2017
Posts: 2
Rep Power: 0
keulehans is on a distinguished road
Hey Guys,

I have to do a parametric study in ANSYS, where I have to investigate the influence of the dimensions of a rectangular plate with tensile forces. Therefore I have a couple of hundred working models (as .inp files) of the plate with each of them having slightly different dimensions.
The input files are called:
ANSYS_MODEL_1
ANSYS_MODEL_2
ANSYS_MODEL_3
.... and so on.
My problem now is, that I am not able to write a working Batch Code in APDL, so that ANSYS calculates all models consecutively.
I tried the following code:

*DO,i,1,521,1
valchr(i)
/input,ANSYS_MODEL_i,inp
/solu
outpr,basic,all
irlf,-1
/output,mass_output,txt
psolve,elform
psolve,elprep
/output
finish

ANALYSIS_MODE = 'LINEAR_STATIC'
/solu
allsel,all
/TITLE,ANALYSIS_MODE
ANTYPE,STATIC
PSTRES,ON
SOLVE
fini

/post1
...
...

/EOF

*ENDDO

/EXIT,ALL

With this code however,Ansys always searches for an input file, which is called "ANSYS_MODEL_i" instead of putting the right number of the DO Loop for the i.
Doea anybody know how to do it properly?
And am I using the DO Loop right?

Thanks a lot in advance, I really am desperate by now

Cheers
keulehans is offline   Reply With Quote

Old   May 24, 2017, 03:04
Default
  #2
New Member
 
Tushar
Join Date: Mar 2012
Posts: 6
Rep Power: 14
S.Tushar is on a distinguished road
You are parsing the file name as a character string. I don't think 'i' will iterate with passes of the *DO loop.
when you write /input, filename_i, APDL searches for a file with name filename_i in the current directory.
There are many ways to achieve the parametric iterations that you are aiming at, maybe use the LINE or LABEL parameter of /input to read input lines from same input file.

cheers
S.Tushar is offline   Reply With Quote

Old   May 27, 2017, 08:18
Default
  #3
New Member
 
Claas
Join Date: May 2017
Posts: 2
Rep Power: 0
keulehans is on a distinguished road
Hi,

Thanks for your reply first of all. I asked my supervisor about changing the input files, but I am not allowed to do so.
He made it clear, that my task is, to write a batch code, which consecutively calculates all the models and saves each results file, so he can look at those later.
My current code looks like this:

*DO,i,1,521,1
/input,'ANSYS_MODEL_' chrval(i),inp
/solu
outpr,basic,all
irlf,-1
/output,mass_output,txt
psolve,elform
psolve,elprep
/output
finish

ANALYSIS_MODE = 'LINEAR_STATIC'
/solu
allsel,all
/TITLE,ANALYSIS_MODE
ANTYPE,STATIC
PSTRES,ON
SOLVE
fini

/post1
*DIM,DP_DISPL_ARRAY,ARRAY,5,1
ALLSEL,ALL
Nn = 202876
*GET,Xcord,NODE,Nn,LOC,X
*GET,Ycord,NODE,Nn,LOC,Y
*GET,Zcord,NODE,Nn,LOC,Z
*GET,U_X,NODE,Nn,U,X
*GET,U_Y,NODE,Nn,U,Y
DP_DISPL_ARRAY(1,1)=Xcord
DP_DISPL_ARRAY(2,1)=Ycord
DP_DISPL_ARRAY(3,1)=Zcord
DP_DISPL_ARRAY(4,1)=U_X
DP_DISPL_ARRAY(5,1)=U_Y
! write array to file
RST_DP_U_OUTPUT_ARRAY='DP_DISPL_ARRAY'
RST_DP_U_FILE_NAME=STRCAT('RST_U_DP_',CHRVAL(1))
RST_DP_U_FILE_EXTENSION='dat'
writecsv,RST_DP_U_FILE_NAME,RST_DP_U_FILE_EXTENSIO N,RST_DP_U_OUTPUT_ARRAY
allsel,all
/EOF

*ENDDO

/EXIT,ALL

This however gives me the error. Invalid /INPUT file or too many levels.

Can you help me with this?
Thanks in advance!

Cheers
keulehans is offline   Reply With Quote

Reply

Tags
ansys, apdl, do loop, valchr


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 03:36
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
[CAD formats] my stl surface is seen as just a line rcastilla OpenFOAM Meshing & Mesh Conversion 2 January 6, 2010 02:30
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 16:57


All times are GMT -4. The time now is 14:32.