March 17, 2023 at 8:59 amFAQParticipant
I 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.
- The warning message is: “The maximum contact stiffness is too big. This may affect the accuracy of the results.” Why does large contact stiffness affect results accuracy?
- After Workbench crashes, how can I recover the project from a .mechdb file?
- Contact Definitions in ANSYS Workbench Mechanical
- Model has a large number of contacts – how to reduce them?
- How to resolve “Error: Invalid Geometry”?
- How to display the color of each body based on the material in Mechanical?
- How to locate an element of a particular ID number in Mechanical?
- Please explain the warning message “coefficient ratio exceeds 10e8” ?
- How to Connect Excel to Workbench
- How can I plot bodies colored by material property in Workbench?
© 2023 Copyright ANSYS, Inc. All rights reserved.