×
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

ANSYS APDL

ANSYS APDL

ANSYS APDL

(OP)
Hi All,

I am new to ansys apdl and am not familiar with the coding. I know I am not doing this right.
Can someone help me with this code. I am trying to write x, y and z displacements to arrays dx, dy and dz
I appreciate your help!
Thank you,
Dipak

/post1
*cfopen,D:\documents\crank3.txt !Open output text file in a directory
*vwrite
CRANK,dx,dy,dz,ncount

! Selects a subset of components and assemblies (a new set, whose name is crank)
!set,3,1
cmsel,s,crank
nsle,s ! Select a set
*GET,nmax,NODE,0,num,max ! get highest node number in selected body
*GET,nmin,NODE,0,num,min ! get lowest node number in selected body
ncount=nmax-nmin+1
*DIM,dx,ARRAY,nmax
*DIM,dy,ARRAY,nmax
*DIM,dz,ARRAY,nmax

!Loop for all nodes (nmin to nmax with increment of 1000) in selected set
*do,i,nmin,nmax,1000

set,3,1
dx(i)=ux(i)
dy(i)=uy(i)
dz(i)=uz(i)

*vwrite
CRANK1,dx,dy,dz,ncount
*vwrite,dx(i),dy(i),dz(i),ncount
%15.5e,%15.5e,%15.5e,%8.0f

!*enddo

RE: ANSYS APDL

Dont use loops for something like this. They are slow, boring, unsophisticated, and people will think you are an amateur. Use vector commands instead. Also, what you are doing will only work if the selected nodes are continuously numbered. Try something more like this:

nsele=ndinqr(0,13)
*dim,ddata,,nsele,4

ncount=ndinqr(0,14)
*dim,ndata,,ncount,10

cmsel,s,crank
nsle,s
*vget,ndata(1,10),node,0,nsel

*vfill,ndata(1,1),ramp,1,1
*vget,ndata(1,2),node,1,u,x
*vget,ndata(1,3),node,1,u,y
*vget,ndata(1,4),node,1,u,z

*do,j,1,3
*vmask,ndata(1,10)
*vfun,ddata(1,j),compress,ndata(1,j)
*enddo

*cfopen....
*write,ddata(1,1),ddata(1,2),ddata(1,3),ddata(1,4)
%15.5e......

Rick Fischer
Principal Engineer
Argonne National Laboratory

RE: ANSYS APDL

(OP)
Rick,

That was quick.

I struggled for few days to get info on ANSYS APDL which is scarce (except for the help in mechanical) more particularly on sample examples/tutorials. Coding and syntax is little different than FORTRAN....I think.

I will implement your suggestions in my bigger program where I use displacements and velocities for further computations.

Today I learned few things from you.
I really appreciate your timely help.

With Best Regards,

- Dipak

RE: ANSYS APDL

APDL is considered archaic by the new guard at Ansys Inc. Power users embrace it because it is immensely powerful. Good sources for APDL tips and macros are the websites of the various Ansys distributors, and Sheldon's Ansys.net.

Rick Fischer
Principal Engineer
Argonne National Laboratory

RE: ANSYS APDL

Hi,

I wrote the following code based on the previous posts.

node_count = ndinqr(0,14)

*dim,node_id,array,node_count,2

*vget,node_id(1,1),node,1,nlist

cmsel,s,face1

*vget,node_id(1,2),node,0,nsel

*cfopen,nodes.txt

*vmask,node_id(1,2)

*vwrite,node_id(1,1)

%15.5e

*cfclose

face1 is a face named selection. This code writes a text file containing the selected nodes on a column. I would like to modify it
so that the node ids are written in this format:

1,2,3,...

Any tips?

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


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close