tips and tricks
quick file search:
    home » tips & tricks » tips from xansys
 
 
*VWRITE an Integer
  Download an example WRITEME macro

"TL1" means "tab left 1 space". You can use this to 'erase' a decimal point as follows:
*VWRITE,parameter
(F9.0,TL1,' ')

You can use CHRVAL() to change an integer to a char as follows:
*VWRITE,chrval(parameter)
(A9)

"T10" means "tab to the 10th column". You can use ' ' to put a single space to overwrite a decimal point which may exist in the 10th column as follows:
*VWRITE,parameter
(F10.0,T10,' ')
  Posted by anonymous on 03.07.2002
 
*VWRITE long lines
  Use $ at the end of the Fortran format statement to prevent a carraige return
Useful to write more than 10 parameters per line using *VWRITE.
*VWRITE,parameter
(F12.5,$)

At 5.7, string arrays are introduced. You can write a long string with C syntax.
*VWRITE,MYSTRING(1)
%c

However, at 5.7/5.7.1, more than 8 characters are not directly supported with Fortran syntax formatting. You can use "$" to get around this as follows:
*do,ICOUNT,1,10
    *vwrite,MYSTRING(8*(ICOUNT-1)+1)
    (a$)
*enddo

Since ANSYS Input is limited to 130 columns per line, if your formatting is long, it may be truncated. You can use the & symbol to get around this:
*VWRITE, parameter1, parameter2, etc.
(2A,'Hello there',F7.5,&
'Pretend that this is a long line', F10.7)
  Posted by anonymous on 03.07.2002
 
General Fortran Statements
  General fortran format statements (some not supported or 'officially' supported by ansys as noted in the documentation for *VWRITE):

A[w] characters
Dw.d real values w/ D exponential delimiter
Ew.d[Ee] real values w/ E exponential delimiter
Fw.d real values w/o scientific notation (decimal format)
Gw.d any format type
Iw integer format
Tn tab n position
TLn tab left n position
TRn tab right n position

While integer format is not supported by ANSYS, you can use something like:
(F5.0,TL1,' ')
to print out integers with *VWRITE

note that you should be able to use C-style statements at 5.7.
%w.dx
where w is # of char, d is # of decimal, x is the following:
d: integer
f: decimal
e: expoential
g: general (decimal or exponent)
c: char
s: string
%/ is newline (return)

I'm sorta going by memory, so you may want to double-check this, but I think the above for fortran and c statements are correct. There are some other options which I haven't mentioned, but they are less commonly used.

w = width
d = # of decimal
[] = optional statement
n = # of spaces
  Posted by anonymous on 03.07.2002
 
*VWRITE in Scientific Format with Leading Integer
  Download an example WRITEME macro

ANSYS writes numbers with a leading "0" as follows
EX: Number 123451
Result: E12.5 => 0.12345E+06 Desired: 1.23451E+05

Use
*VWRITE,parameter
(1PE12.5)
  Posted by anonymous on 03.07.2002