Follow

Phi-T Scatter Plots

output_0039.png

In the In Cylinder combustion investigation, it is common to inspect the fuel/air ratio (equivalence ratio) versus the temperature throughout the domain at each timestep, to quantify the likelihood of NOx or Soot generation. This type of information is typically plotted as a scatter plot, with the X-axis being Temperature, and the Y-axis being equivalence ratio (or phi).

EnSight can do scatter plots, but really only for 1D parts. What is required here is to take the whole domain (perhaps all of the volume elements within the cylinder), and plot each as a point on this Phi-T scatter plot. EnSight can't do that directly, but can be used in the process to obtain that Phi-T scatter plot. Here is the process I used to obtain a Phi-T animation over the cycle:

1. Load the result into EnSight.

2. Because I wanted just the cylinder domain, and this solve marks the elements in different regions with a variable (idreg), I used the Filter Elements feature in EnSight to filter out elements with idreg > 0.9, so that I was left with only the Cylinder Elements.

3. I activated the 'equivalence ratio (phi)', and the temperature variable which were exported from the solver (you could compute phi if your solver did not export it, but you do have the constituent variables). I activated these variables, because that export process (below) writes out all active variables.

4. With the Cylinder volume selected (because the routine will export selected parts), I went to File -- > Export -- > Geometric Entities -- > Flatfile. As I had elemental variables, I specified the parameter 'CELLID' in the parameter field; I turned OFF the binary flag (to get ASCII files), and I gave it a filename (phi_t_volume_KEC for example); and opted to write these files. A file for each timestep is written (phi_t_volume_KEC000, phi_t_volume_KEC001, phi_t_volume_KEC002, etc). Each file is basic output, with each cell listed on each line, along with its phi (in column 0), idreg in column 1 (because it was active), and temperature in column 2. Rows 0-2 are header information. Rows 3-N are each element (1M in my case).

5. At this point, I have a series of files which list each element, along with its variable value. I now turn to python and matplotlib to read in the file, grab out the appropriate columns of data, and pass to matplotlib to create a scatter plot image. For me, each file only takes ~10-15 seconds to process.

Attached to this article is the starter Python script you can use as a starting point for this process (it is not generic enough to apply to any dataset blindly. It can only be used by someone willing to edit/customize it for their own use).

6. I end up with a series of PNG images, which I then use EnVe to sew back into an AVI file.

 

Caveats:

Since the grid is far from uniform, but each dot is uniformly presented, the cluster of dots should not be construed as a higher probability or higher occurrence of a value. It simply means there are more elements with those values.

 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments