Reading In All Data and Writing Out Time-Dependent Fields


Reading In All Data and Writing Out Time-Dependent Fields

Previous versions of the Read_Field and Read_UCD modules treated data in all input files as single-step data; that is, they read in and then wrote out the data one step at a time. The enhanced versions of these modules, available in the current release of AVS/Express, can read in files containing either standard (single-step) data or time-dependent (multistep) data.

 

When either of these modules reads in a file that contains time-dependent data, it can optionally read in all of the data at one time and store it in memory. (A toggle button called Store All Steps enables this mode of reading data.) In store-all-steps mode, Read_Field and Read_UCD do not access the input file for each step and can, therefore, write the step data to their output ports in a fast and continuous manner.

 

As a further enhancement, the Read_Field and Read_UCD modules output step data that was read in in store-all-steps mode as a time-dependent field. Each module now contains an output port that can handle time-dependent fields, resulting in two field output ports for each module:

 

 

Note that Read_Field and Read_UCD output a time-dependent field only if the Store All Steps button has been turned on and the step data has, therefore, been read in all at once.

 

Note that while processing time-dependent data in store-all-steps mode saves time, it uses more memory. This may be a problem when you process files that contain large quantities of time-dependent data and/or many steps. To determine whether you should use store-all-steps mode, proceed as described in the following process:

 

  1. Input to Read_xxx the file that contains time-dependent data. The module adds to its user interface a set of objects that include the Store All Steps button and a Total Steps field, with the Store All Steps button turned off. The module now reads in the data corresponding to the first step and outputs it to the field port as the appropriate Fld structure.
  2.  

  3. Check the number of steps (displayed in Total Steps) and determine whether there is enough memory to store all of them. If there is, turn on Store All Steps, otherwise leave it turned off.
  4.  

    If you turn on Store All Steps, all of the data (including the first step) is read in and stored in memory, then written to the time_field port as a time-dependent Fld structure, otherwise it is processed one step at a time and written to the field port as the appropriate Fld structure.

  5. If the amount of memory used to store the data read in with Store All Steps is so large that it affects other operations, turn it off.
  6. If you turn off Store All Steps:

Additional considerations in the use of this module are as follows:

 

The following example illustrates a network that outputs time-dependent data to the time_field output port.

GENERATE/TIMEDEP.gif

Formatting Changes in Time-Dependent Files

In previous AVS/Express releases, when you used the time-dependent (multistep) format for field files, you were required to include in the ASCII file header a file keyword that specified the name of the file containing the data. As of the current release, you can opt to omit this keyword, to indicate that the ASCII file header and data are in the same field file. In this case, you must press Ctrl-L (^L) twice after the ASCII file header and start the data portion of the file on the next line.

The following example of a field file that contains time-dependent data uses this new feature. Please note the absence of the file keyword, and please also observe the specification of the skip keyword.

# AVS field file
#
     nstep=3
     ndim=2
     dim1=4
     dim2=2
     nspace=3
     veclen=1
     data=float
     field=irregular
     time filetype=ascii skip=1 close=0
     variable 1 filetype=ascii skip=2 offset=0 stride=4 close=0
     coord    1 filetype=ascii skip=2 offset=1 stride=4 close=0
     coord    2 filetype=ascii skip=2 offset=2 stride=4 close=0
     coord    3 filetype=ascii skip=2 offset=3 stride=4 close=0
     EOT
     DO
     time filetype=ascii skip=8 close=0
     variable 1 filetype=ascii skip=1 offset=0 stride=4 close=0
     coord    1 filetype=ascii skip=1 offset=1 stride=4 close=0
     coord    2 filetype=ascii skip=1 offset=2 stride=4 close=0
     coord    3 filetype=ascii skip=1 offset=3 stride=4 close=0
     EOT
     ENDDO
     ^L^L
     data    X   Y   Z
     1
     5.0   -2.0 -1.0 0.0
     10.0  -1.0 -1.0 0.0
     20.0   0.0 -1.0 0.0
     25.0   1.0 -1.0 0.0
     30.0  -2.0 0.0 0.0
     40.0  -1.0  0.0 0.0
     50.0   0.0  0.0 0.0
     60.0   2.0  0.0 0.0
     2
     5.0   -2.0 -1.0 0.0
     10.0  -1.0 -1.0 0.0
     20.0   0.0 -1.0 0.0
     25.0   1.0 -1.0 0.0
     30.0  -2.0 0.0 0.0
     40.0  -1.0 0.0 0.0
     50.0   0.0 0.0 0.0
     60.0   2.0 0.0 0.0
     3
     5.0   -2.0 -1.0 0.0
     10.0  -1.0 -1.0 0.0
     20.0   0.0 -1.0 0.0
     50.0   2.0 -1.0 0.0
     35.0  -2.0 0.0 0.0
     45.0  -1.0 0.0 0.0
     55.0   0.0 0.0 0.0
     95.0   3.0 0.0 0.0