Difference between revisions of "Collection file"

From FEAP Wiki
Jump to navigation Jump to search
Line 35: Line 35:


So for example if your problem was called <code>Itest</code> and you executed a two processor run, then you would run
So for example if your problem was called <code>Itest</code> and you executed a two processor run, then you would run
<code>awk -v nproc=2 -v filn=Ptest_ -f coll_parallel.awk Ltest_0001 > Ptest.pvd</code>.  You can then use paraview on
<code>awk -v nproc=2 -v filn=Ptest_ -f coll_parallel.awk Ltest_0001 > Ptest.pvd</code>.  You can then use paraview to open
<code>Ptest_pvd</code> and it will read in your <code>Ptest_00001YYYYY</code> and <code>Ptest_00002YYYYY</code> files, merge them and let you time
<code>Ptest.pvd</code> and it will read in your <code>Ptest_00001YYYYY</code> and <code>Ptest_00002YYYYY</code> files, merge them and let you time
step through them if you have multiple time steps.  The example assumes you saved the awk script as <code>coll_parallel.awk</code>.
step through them if you have multiple time steps.  The example assumes you saved the awk script as <code>coll_parallel.awk</code>.

Revision as of 08:41, 12 June 2018

When making parallel runs output files for merged paraview viewing can be generated (at each time step) using the Macro command PVIEw,time. This will generate output files in the format PxxxxYYYYY.vtu, where xxxx is your problem name and YYYYY is the step number within your analysis. These files can be easily assembled into a paraview collection file for making paraview movies etc.

Here is an awk script that will do that for you

#
# Awk script for generating Paraview collection file for time history simulations
# in parallel FEAP runs
#
# Usage awk -v nproc=Y -v filn=PXXXX_ -f coll_parallel.awk LXXXX_0001 > PXXXX.pvd
#
# Where Y          -- number for processors used for simulation
#       PXXXX      -- Plot file base name (include underscore)
#       LXXXX_0001 -- Any of the log files

BEGIN { i = 0 
        k = 0 
        print "<?xml version=\"1.0\"?>"
        print "<VTKFile type=\"Collection\" version=\"0.1\">"
        print "<Collection>"
}

{ if ($1 == "Step") { k = 1 }
  if (k != 0) {i = i + 1}
  if (i > 2 && $8 != "") {
    for(j=0;j<nproc;j++) { printf("<DataSet timestep=\"%f\" part=\"%d\" file=\"%s%04d%05d.vtu\"/>\n",$4,j,filn,j+1,$1); }
  }
}

END {
  print "</Collection>"
  print "</VTKFile>"
}

So for example if your problem was called Itest and you executed a two processor run, then you would run awk -v nproc=2 -v filn=Ptest_ -f coll_parallel.awk Ltest_0001 > Ptest.pvd. You can then use paraview to open Ptest.pvd and it will read in your Ptest_00001YYYYY and Ptest_00002YYYYY files, merge them and let you time step through them if you have multiple time steps. The example assumes you saved the awk script as coll_parallel.awk.