Exporting Array Data into Text or CSV

Follow

To export data arrays into text or csv format, the following code can be used:

read d1 snapshot.flxdato

data cddo d1/1/xdsp 'xdsp.csv'

Note: This code suppose that the array "xdsp" corresponding to the mechanical displacement in the x direction has been calculated and exported in the snapshot.flxdato file

This will generate a file like this one:

csv-exported-data.png

The CDDO command is used to write values contained within a Data Manager array to a disk file in a comma-delimited format that can be imported into EXCEL or some other program. This command is typically used to output a 2D section of a 2D or 3D array. It will also write out a 3D region if an array is requested.

The typical cddo syntax is:

  data 
cddo dataname filename ibegin iend jbegin jend kbegin kend

If the array is 3D, the specified indices should form a 2D section of the array if the data is to be imported into a program such as EXCEL.


If the data being written has a constant I-index, i.e., only the J- and K- indices vary, then each line of data written to the file has a constant K-index and the J-index varies along the line. For a constant J-index section, each line of data is for a constant K-index. For a constant K-index section, each row of data is for a constant J-index.


If a 3D array (or subregion of the array) is written to a file, each line of data has a constant J- and K-index, and the I-index varies along the line. The first line of data will be for J = jbegin, K = kbegin. The second line is for J = jbegin+1, K= kbegin, etc. I.e., the J-index permutates first and then the K-index.

Example:

read d1 snapshot.flxdato

data cddo d1/1/xdsp 'xdsp.csv' 1 5 1 5 1 1

This code exports for example only the results at element center of the elements with 1<i<5 and 1<j<5 of the layer k = 1

This is what you would get:

elements_exported.png

To export ALL the elements of one layer k = 1, you can use the following code:

read d1 snapshot.flxdato

data cddo d1/1/xdsp 'xdsp.csv' * * * * 1 1
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.