CFX-POST -BATCH

This method is useful when need to process cfx post  in batch.

For example,  in transient simulations, you could export information on an user-defined polyline at every timestep to .csv files automatically by using this method.

Procedures:

1. Open CFX-POST

2. CREATE A NEW SESSION and save it as postbatch.cse

3. START recoding the session (Session>Start Recording).

 4. Load the result file *.res

5. produce a polyline (plane, isosurface …. anything you want)

6. Export a csv file .

7. STOP recording the session.

8. Now open the session file postbatch.cse. 

9 .INSERT the following code in the body of the cse file. (the code are written in perl, which can be recognized by cfx. Every sentence should start with a symbol ‘!’, so that cfx knows it’s a implemented perl line.)

(1, code for updating input file’s name after loading the res file.

! $List=getValue(“DATA READER”,”Timestep List”); #this looks for all trn.files
! print “$List \n”; #shows the result of the search
! @Wert=split(/, /,$List); #makes it accessible for further tasks
! $lastFrame=$List[$#timestepList]; # very nice, this gives you the number of the last frame, nice for animations
! foreach $List(@Wert){ #the MAINTASK, do the line and graph and export for every trn.file, see below
> load timestep = $List #load the timestep
! print “calculating for TIMESTEP $List \n”;
! ($time, $timeunits) = evaluate(“Time”);

2, update export file’s name to $List.csv;

3,’ !}’ in the very end of the file).

10. command line:  cfx5post -batch postbatch.cse

The final *.cse file should be like this: (Don’t miss any thing in the compensated code, even a space)

http://codepad.org/ZDBsRjxh

This entry was posted in CFX. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *