XANSYS Message: 93053 [Go back to message list]
[bookmark on del.icio.us]
No rating yet
Rate item:

Subject: Re: APDL] How to write/append a data to a file inapdl
Author: Mrugesh Dhorje
Date: 2008-04-28 01:45:48


Hello,

Below is a simple code I frequently use for writing data to a text file,

I perform *do operations to repeatedly select different nodes based on
their location.
One can modify these *do loops to suite their requirement.
Original code is also from XANSYS forum.

/POST1

CSYS,12
RSYS,0

*DO,I,0,16,1

Xloc=I*0.01

NSEL,R,LOC,X,Xloc
NSEL,R,LOC,Y,3.7,4.000001

*GET,NNUMMAX,NODE,,NUM,MAX
*DEL,NMASK
*DEL,NARRAY

*DIM,NMASK,array,NNUMMAX
*DIM,NARRAY,array,NNUMMAX,9

/POST1

NSLE,R,CORNER
*VGET,NMASK(1),NODE,1,NSEL

*VMASK,NMASK(1)
*VGET,NARRAY(1,1),node,1,LOC,x

*VMASK,NMASK(1)
*VGET,NARRAY(1,2),node,1,LOC,y

*VFIL,NARRAY(1,4),ramp,1,1

/GRAPHICS,POWER
/EFACET,2

NSLE,R,CORNER
*VMASK,NMASK(1)
*VGET,NARRAY(1,5),node,1,s,x

NSLE,R,CORNER
*VMASK,NMASK(1)
*VGET,NARRAY(1,6),node,1,s,y

NSLE,R,CORNER
*VMASK,NMASK(1)
*VGET,NARRAY(1,3),node,1,s,xy


*CFOPEN,SHEAR_STRESS_L1,TXT,,APPEND

*IF,I,EQ,0,THEN
*VWRITE
(' NODE',4x,' X',10x,' Y',10x,' Sxx',10x,' Syy',10x,'
Sxy')
*ENDIF


*VMASK,NMASK(1)

*VWRITE,NARRAY(1,4),NARRAY(1,1),NARRAY(1,2),NARRAY(1,5),NARRAY(1,6),NARR
AY(1,3)
(F10.0,2x,E13.5,2x,E13.5,2x,E13.5,2x,E13.5,2x,E13.5)

*CFCLOSE

NSEL,ALL

*ENDDO

FINISH



Regards,
Mrugesh Dhorje,

Graduate Student,
Mechanical Engineering Dept,
Texas Tech University
Lubbock, Texas 79409


-----Original Message-----
From: xansys-bounces_at_xansys.org [mailto:xansys-bounces_at_xansys.org] On
Behalf Of Martin Liddle
Sent: Sunday, April 27, 2008 6:15 AM
To: xansys_at_xansys.org
Subject: Re: [Xansys] APDL] How to write/append a data to a file inapdl
environment

In message <31974.10.10.10.1.1209228043.squirrel_at_10.10.10.11>,
mshebbal_at_becbgk.edu writes
>
>
>I tried using *CFOPEN
>*VWRITE
>and could not succeed as *VWRITE can not be used in programming
>environment( i.e. it cannot be typed in command prompt)
>
That is the correct way. Type the commands into an ASCII text file and
use /INP to read them.
--
Martin Liddle, Tynemouth Computer Services, 3 Kentmere Way,
Staveley, Chesterfield, Derbyshire, S43 3TW.
Web site: .
^--------------------------------------------------------
| XANSYS - www.xansys.org |
| The Discussion List for users of ANSYS, Inc. Software |
| Hosted by PADT - www.padtinc.com |
^--------------------------------------------------------
^--------------------------------------------------------
| XANSYS - www.xansys.org |
| The Discussion List for users of ANSYS, Inc. Software |
| Hosted by PADT - www.padtinc.com |
^--------------------------------------------------------