-
-
March 17, 2023 at 8:59 am
FAQ
ParticipantI have an array in a text file, and I need to read it into ANSYS. The array is written out in another analysis, and can change length depending on a number of parameters. I can use *VREAD to get the array data, but the *VREAD requires that the array is previously defined, and I do not know in advance how many points will be in the text file. What can I do? If your array data always has the same number of columns, and you only need to know the rows, you can use the /INQUIRE command. /INQUIRE, Parameter, FUNC, Fname, Ext Parameter = scalar variable where resulting line count will be stored (e.g., “rows”) FUNC = use the LINES function in this example Fname = filename where array data is stored (e.g., “myFile”) Ext = extension of filename (e.g., “txt”) Then, you can define and dimension your array using the *DIM command. *DIM, Par, Type, IMAX, JMAX, KMAX, Var1, Var2, Var3, CSYSID Par = array variable where data will be stored (e.g., arr_data) Type = use the ARRAY type in this example IMAX = number of rows in the array; use “rows” from the /INQUIRE command JMAX = number of columns (e.g., “3”) Now, you have an array dimensioned properly, according to the data in “myFile.txt”. Finally, you can fill the variable with *VREAD. *VREAD, ParR, Fname, Ext, –, Label, n1, n2, n3, NSKIP ParR = array variable where array data will be stored; use “arr_data” defined by the *DIM command Fname = filename where array data is stored; use same “myFile” from /INQUIRE command Ext = extension of filename; use same “txt” from /INQUIRE command Label = order in which data are to be read (e.g., for text files containing a 2D array, this is typically “JIK”) n1 = number of “J’s” if you use “JIK” (e.g., “3”) n2 = number of “I’s” if you use “JIK” (e.g., “rows”) This can all be setup using variables to avoid typing errors; for example, filenam = ‘myfile’ fileext = ‘txt’ cols = 3 /INQUIRE,rows,LINES,%filenam%,%fileext% *DIM,arr_data,ARRAY,rows,cols *VREAD,arr_data,%filenam%,%fileext%,,JIK,cols,rows
-

Introducing Ansys Electronics Desktop on Ansys Cloud
The Watch & Learn video article provides an overview of cloud computing from Electronics Desktop and details the product licenses and subscriptions to ANSYS Cloud Service that are...

How to Create a Reflector for a Center High-Mounted Stop Lamp (CHMSL)
This video article demonstrates how to create a reflector for a center high-mounted stop lamp. Optical Part design in Ansys SPEOS enables the design and validation of multiple...

Introducing the GEKO Turbulence Model in Ansys Fluent
The GEKO (GEneralized K-Omega) turbulence model offers a flexible, robust, general-purpose approach to RANS turbulence modeling. Introducing 2 videos: Part 1 provides background information on the model and a...

Postprocessing on Ansys EnSight
This video demonstrates exporting data from Fluent in EnSight Case Gold format, and it reviews the basic postprocessing capabilities of EnSight.
- How do I request ANSYS Mechanical to use more number of cores for solution?
- How to deal with “”Problem terminated — energy error too large””?”
- How to restore the corrupted project in ANSYS Workbench?
- Contact Definitions in ANSYS Workbench Mechanical
- There is a unit systems mismatch between the environments involved in the solution.
- How to transfer a material model(s) from one Analysis system to another within Workbench?
- How can I change the background color, font size settings of the avi animation exported from Mechanical? How can I improve the resolution of the video?
- How to obtain force reaction in a section ?
- How to change color for each body in Mechanical?
- How to resolve “Error: Invalid Geometry”?
© 2025 Copyright ANSYS, Inc. All rights reserved.