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

Subject: Re: [APDL] *vread with mixed character/number array
Author: Bob Weathers
Date: 2002-08-22 17:50:00

Here's an example of the kind of information I exchange. The text embedded
in the file is to make the file more readable as well as document its
history. The numeric data is what actually gets into ANSYS as boundary
conditions.

We've agreed internally on using '!' as a comment indicator - everything
after '!' is a comment and is ignored. A nice feature might be something
like being able to specify a comment indicator on the *VREad command. Maybe
something like this would work:

*VRE, MyData(1,1), MyDataFile, txt, , JIK, 7, 100, , MySkip, '!'

Perhaps this would tell *VRE that anything after the '!' is a comment and
should be ignored. And, if a '!' is in column 1, ANSYS skips the entire
line. Other users might prefer '&' or '~' or whatever. There's probably a
small set of characters that would be acceptable. Maybe ~!@#$%^&*|/;:

I'm not sure of the usefulness of *VMAsk here. It seems like you need to
know a priori what lines to mask - I usually don't know that. Same can be
said about NSKIP. That seemed to be the problem Joe was having. Using '!'
would sort of let you mask the input file on the fly.

Sometimes, I also receive information about different parts of my FE model.
We adopt the internal practice of using the keyword CATEGORY (8 characters -
a great word) to delineate these different geometric regions. One CATEGORY
might have 1000 lines of data and another 1500 - the CATEGORY keyword
delineates different regions. And, we synchronize coordinate systems to
help with the exchange of data and mapping. I don't see any way to do this
cleanly on *VREad - reading each file tends to be a 'custom' macro albeit
they are always quite similar. They're pretty easy to construct once you
get the hang of it. One way that would help would be -

1. If there's a '!' in column 1, I know that this line contains character
information. I would look for my keywords (CATEGORY, CSYS, and so on) on
these lines. Maybe this command

*VRE, MyData(1,1), MyDataFile, txt, , JIK, 7, 100, , MySkip, '!'

would tell ANSYS to read only lines into MyData that have a '!' in column 1.
And

*VRE, MyData(1,1), MyDataFile, txt, , JIK, 7, 100, , MySkip, '#'

would read only lines with '#' in column 1. I could use '!' for comments,
'~' for CATEGORY, '#' for CSYS, and so on.

2. If a '!' isn't in column 1, I know that the line contains a row of
numeric data. Maybe this command

*VRE, MyData(1,1), MyDataFile, txt, , JIK, 7, 100, , MySkip, '.NOT.!#'

would tell ANSYS to read only lines into MyData that don't have a '!' or '#'
in column 1. And, if a '!' or '#' is found anywhere else on the line, the
remainder of the line is ignored. Starting to get complicated, though.

I read as much data in as I can in one chunk (MyData), toss out the comments
(after first looking for CATEGORY and CSYS info and any other agreed upon
keywords), and write out the numerical data into MyNewDataFile. Then, I
read MyNewDataFile back in and apply these boundary conditions. It would
also be handy if array MyData could be parsed internally - that would
eliminate the step of writing out MyNewDataFile and reading it back in.

In any event, that's why I sometimes have a file that has both numeric and
character data in it.

! CATEGORY: Male Rotor Bore
! CSYS, 17 intercept of male rotor bore centerline and midplane of male
screw rotor
! M1 Male rotor bore 11Aug2002
! Data from A6300 calculation
! 39/134.3 full load 60 hz
! CSYS TYPE X (ins) Y (ins) Z (ins)
! ---- ---- ---------- ---------- ----------
! 17 1 9.0000E-04 -1.4000E-03 8.8771E+00
! HT Coeff
! ******** nodal coordinates ******* Btu/sec- Temp
Pressure
! Node r(ins) theta(deg) z(ins) in2-deg-F deg F
psig
! ------ ---------- ---------- ---------- ---------- ----------

000002 3.1694E+00 2.5309E-02 0.0000E+00 2.4345E-04 1.0022E+02
6.2593E+01
000003 3.1694E+00 2.5309E-02 -3.0985E+00 1.6039E-04 6.7960E+01
3.4017E+01
000004 3.1694E+00 -3.8007E+01 -1.8000E+00 1.6129E-04 6.8438E+01
3.4326E+01 ! test point 1
000005 3.1694E+00 -2.0654E+01 -2.9276E+00 1.5860E-04 6.6798E+01
3.3405E+01
000009 3.1694E+00 -1.4765E+02 0.0000E+00 1.5672E-04 6.5507E+01
3.2757E+01
000010 3.1694E+00 -1.4765E+02 -1.8000E+00 1.5627E-04 6.5216E+01
3.2603E+01
! lots more data and then ....
! CATEGORY: Female Rotor Bore
! CSYS, 18 intercept of female rotor bore centerline and midplane of
female screw rotor
! M1 Female rotor bore 11Aug2002
! lots more data and then ....
/EOF

Bob Weathers
bweathers@t...
(608)787-2729

From: John Swanson
Date: Thu Aug 22, 2002 1:54 pm
Subject: RE: [xansys] Re: [APDL] *vread with mixed character/number array.

My immediate thought was "Nope, can't do that because ansys uses the system
read with the user supplied format statement". However, the clever
suggestions contained here might offer some hope, especially with the c
formats.

Can someone help me understand better what is desired. Is it as simple as
ignoring any lines which contain characters? Or do we need to ignore lines
which contain characters in columns which are supposed to contain numbers?
If we were to read the entire line as a character string, then decode it
internally, what would the maximum line length be? Would a fixed limit like
128 of 640 (slower) be acceptable?

Comments, anyone?

John Swanson
Swanson Analysis Services, Inc.

Posts possibly associated with message #41014AuthorDateScore
40991[APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
40992Re: [APDL] *vread with mixed character/number array.Dave Conover2002/08/22 
40993Re: [APDL] *vread with mixed character/number array.Peter Frei2002/08/22 
40994Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
40995Re: [APDL] *vread with mixed character/number array.Ashok2002/08/22 
40996Re: [APDL] *vread with mixed character/number array.Gordon May2002/08/22 
40997Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/22 
40998Re: [APDL] *vread with mixed character/number array.Peter Frei2002/08/22 
40999Re: [APDL] *vread with mixed character/number array.Ian Prentice2002/08/22 
41002Re: [APDL] *vread with mixed character/number array.Don Shaffer2002/08/22 
41011Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
41013Re: [APDL] *vread with mixed character/number array.John Swanson2002/08/22 
41014Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/22 
41077Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/26 
41079Re: [APDL] *vread with mixed character/number array.John Swanson2002/08/26 
41080Re: [APDL] *vread with mixed character/number array.Ashok2002/08/26 
41083Re: [APDL] *vread with mixed character/number array.John Crawford2002/08/26 
41084Re: [APDL] *vread with mixed character/number array.Bob Weathers2002/08/26 
41086Re: [APDL] *vread with mixed character/number array.Ashok2002/08/26 
41093Re: [APDL] *vread with mixed character/number array.John Crawford2002/08/26 
41101Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/26 
41103Re: [APDL] *vread with mixed character/number array.Eric Miller2002/08/265
41106Re: [APDL] *vread with mixed character/number array.Fernand Thomassy2002/08/26 
41110Re: [APDL] *vread with mixed character/number array.Eric Miller2002/08/26 
41112Re: [APDL] *vread with mixed character/number array.Dan Bohlen2002/08/26 
41126Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/26 
41161Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/27 
41162Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/27 
41178Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/27 
41213Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/28 
41216Re: [APDL] *vread with mixed character/number arrayMartin Liddle2002/08/28 
41237Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/28 
41239Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/28 
41242Re: [APDL] *vread with mixed character/number arrayJoe Metrisin2002/08/28 
41271Re: [APDL] *vread with mixed character/number arrayFernand Thomassy2002/08/29 
41273Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/29