Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

*TREAD command problem

Status
Not open for further replies.

hexa2016

Mechanical
Sep 19, 2016
26
Hi,

I tried to run transient analysis using table with *tread command. However i received error;

2018-08-17_11h38_51_laokac.png


solution script

Code:
/solu
antype,4
trnopt,full
nlgeom,1
outres,all,all

to_skip=0
*dim,mytable,table,1289,2,
*tread,mytable,disptime,csv,,to_skip

tmstart=0.1
tmend=10
tminc=1

da,1,all

allsel

asel,s,area,,122
nsla,s,1
sf,all,pres,0.1

allsel
*do,tm,tmstart,tmend,tminc
time,tm
da,122,ux,%disptime%
solve
*enddo

allsel
finish

the table has 2 column and 1289 rows. first column is displacement and second column is time.

how to solve this?


Thanks
 
Replies continue below

Recommended for you

There is a nice example from Simutech group: Link

The following is from there, and reads an Amp.csv file (first column time and second amplitude) that exists in the working directory of Ansys APDL, into a table called mytable.

to_skip=0
/INQUIRE,numlines,LINES,Amp,csv
to_read=numlines-to_skip

*DEL,mytable,,NOPR
*DIM,mytable,TABLE,to_read
*TREAD,mytable,Amp,csv,,to_skip

Then to apply this table to a time varying force (load) one gives for instance the table name:
F,P51X,FX, %MYTABLE%
 
Thanks Erik for replying,

I do refer the article from simultech group, however, i do not quite understand the purpose of some part of the proposed script;

Code:
/INQUIRE,numlines,LINES,Amp,csv
to_read=numlines-to_skip

*DEL,mytable,,NOPR

i do not understand this part.....thats why skipped it in my own script. I fixed the error in first post by using the filename with .txt extension.

One more question, I have data for displacement vs time, is it possible to use it instead load vs time?

Thanks
AM
 
I am not really good with APDL, but as far as my understanding goes without looking into it too much, the /INQUIRE finds out how many lines the csv file has, and that is then input when creating the table, which will have the same lines as the csv file (if to_skip = 0). As for *DEL, I suppose it deletes any previous tables created, before a new one is defined.

Yes, that works for enforced displacements which would be for say node 2 with the MYTABLE defining the UX amplitude as a function of time table (2 columns, TIME and amplitude) :

D,2, , %MYTABLE% , , , ,UX, , , , ,
or
D,2,UX , %MYTABLE%

 
i try to follow exactly what has been proposed by simultech group, the error i got in my first post is because of this part;

Code:
/INQUIRE,numlines,LINES,disptime,csv

in ansys manual;

Code:
 /INQUIRE,Parameter,FUNC,Fname, Ext, --.

my script;

Code:
to_skip=1								!number of line to skip
/INQUIRE,numlines,LINES,disptime,csv
to_read=numlines-to_skip
!
*DEL,mytable,,NOPR

*dim,mytable,TABLE,to_read
*tread,mytable,disptime,csv,,to_skip

but i still got error if using /inquire to capture the lines in the csv file.
it seems something not right in /inquire command..where it was unable identify the data in the file.

the one proposed by simultech group.

Code:
to_skip=0       ! enter number of lines to skip--NONE in this example
/INQUIRE,numlines,LINES,data_example,csv
to_read=numlines-to_skip
!
*DEL,mytable,,NOPR
*DIM,mytable,TABLE,to_read                 ! table array to hold data
*TREAD,mytable,data_example,csv,,to_skip

the advantages of the proposed code is where user does not need to check for number of lines in external csv files....

otherwise need to enter manually in *dim command


 
just to update,

actually the script is working, just my mistake, i need to place .csv files in the working directory.

 
Great, what did I say:)

Quoting myself from above:):"The following is from there, and reads an Amp.csv file (first column time and second amplitude) that exists in the working directory of Ansys APDL, into a table called mytable."
 
Continue above discussion,

the script below is for only displacement at line 3 in x direction.

Code:
to_skip=1								!number of line to skip
/INQUIRE,numlines,LINES,disptime,csv
to_read=numlines-to_skip
!
*DEL,mytable,,NOPR

*dim,mytable,TABLE,to_read
*tread,mytable,disptime,csv,,to_skip

in my case , i have few other nodes which need to be assigned with reaction force in opposite direction;

my first draft;

Code:
! creating node and respective element

n,1e3,30,0,0				!node1
e,1e3
cm,node1,node

n,2e3,-30,50,0				!node2
e,2e3
cm,node2,node

n,3e3,-30,-50,0				!node3
e,3e3
cm,node3,node


to_skip=1											!number of line to skip-identical for all cases

/INQUIRE,numlines2,LINES,node1,csv					!return system info to parameter at node1
/INQUIRE,numlines3,LINES,node2,csv					!return system info to parameter at node2
/INQUIRE,numlines4,LINES,node3,csv					!return system info to parameter at node3


			
to_read1=numlines2-to_skip	
to_read2=numlines3-to_skip	
to_read3=numlines4-to_skip	
											
*DIM,tbnode1,TABLE,to_read2							!define array parameter and its dimension at node1
*DIM,tbnode2,TABLE,to_read3							!define array parameter and its dimension at node2
*DIM,tbnode3,TABLE,to_read4							!define array parameter and its dimension at node3


					
*TREAD,tbnode1,node1,csv,,to_skip  					!read table for node1
*TREAD,tbnode2,node2,csv,,to_skip  					!read table for node2
*TREAD,tbnode3,node3,csv,,to_skip  					!read table for node3


lsel,s,line,,3
nsll,s,1
d,3,ux,%mytable%							!apply displacement on line 3

allsel

f,node1,fx,%tbnode1%								!ext force at node1
f,node2,fx,%tbnode2%								!ext force at node2
f,node3,fx,%tbnode3%								!ext force at node3

as each node also read csv file with time,reaction force. All tables in csv file have similar time.


not sure if running multiple *tread command is ok or not...also really appreciate for advice if there any better solution.

attached the graphical image..

2018-10-19_22h05_42_owne7u.png
 
That looks OK I think.

Of course the way to check is to check the reactions and see that they are equal to the applied loads.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor