Tuesday, May 28, 2013

DPLOT Macros Save Time

Most of us have used DPlot at some point or another. Recently, I had a chance to use the extensive macro capabilities. I had FACET3D dump about 100 per building FN curves for a QRA in DPlot GRF format. Now I needed to add the customer criteria intolerable and acceptable curves, format as log-log, locate a legend, and save a PNG for the appendix. Below is what I came up with. The help file give lots of information on the various commands.

DPlot Macro 1.1a
Criteria
Directory(1)'last open
FileType(1) 'grf
ForFilesIn("*.grf")
  FileType(4) 'csv
  FileAppend("S:\_Projects\PATH to QRA\CLIENTCriteria.csv")
  FileType(1) 'grf
  ManualScale(0.9,,,,)
  Size(1,12,8,1)
  FileSaveAs(1,".grf")
  FileSaveAs("Portable Network Graphics",".png")
  FileClose()
NextFile

Directory(1) sets the working directory to the last file open directory. Just open the first file in the folder and close before running the macro.
ManualScale is nice in that you only need to set the bounds you want to explicitly set. I wanted the Xmin to start at 0.9 since all my data started at 1.

There are many more commands than these, but you can see it is possible to quickly format an folder full of DPlot files and dump images ready for the report. No intern required.

Wednesday, May 15, 2013

Low Reactivity Fuels in BST Method

The Baker-Strehlow-Tang (BST) method uses a low, medium, or high reactivity parameter as part of the flame speed lookup. Reactivity is a function of the laminar burning velocity (LBV) of the fuel. In FACET3D, LBV <= 40 cm/s will be low reactivity and LBV >= 75 cm/s will be high reactivity with values in between being medium reactivity. However, some fuels exhibit low reactivity behavior despite having LBV values above 40 cm/s. These fuels are listed in Woodward's CCPS book "Estimating the Flammable Mass of a Vapor Cloud" and are shown below. FACET3D will (as of 13.5.10) produce a warning if any BST threat references one of these chemicals and the LBV is > 40 cm/s.

Name                        CAS
3-Chloro-1-Propene          107051
Ammonia                     7664417
Bromotrifluoroethylene      598732
Carbon Monoxide             630080
1-Chloro-2,3-EpoxyPropane   106898
Ethanol                     64175
Ethyl Chloride              75003
Methane                     74828
Methanol                    67561
Methyl bromide              74839
Chloromethane               74873
Tetraethyl Lead             78002

Tuesday, May 14, 2013

Archiving CFD Data

Running CFD codes such as FLACS or CEBAM invariably produce a large amount of data files. When the files are ready to be archived, I prefer to compress the files. My requirements are that each file be compressed individually, which makes it easier to uncompress 1 file if you need to look at setup or results. Further, I want the entire process to be done from a command line with options for recursion into subfolders, skip files that have already been compressed, and delete the original after compression. Also, decompression should work via a commandline with the same options.
7Zip is the best out there IMO, but it's command line interface lacks some of the needed features above without resorting to a FOR loop in a batch file. I have been using gzip for windows which supports the requirements. Simply put gzip.exe in your path and use like this.
compress entire folder:  gzip -r *   where -r is recursive into subfolders
decompress entire folder gzip -rd *
Another option is the xz library, which uses LZMA compression (see 7zip) and is about 30% better than gzip compression. It works just like gzip but seems to be missing the -r option.
If you use FreeCommander, you can add either of the above tools to the Favorite Tools menu to get a quick button for archiving/unarchiving folders full of data.