Merging Multiple Time Periods of a Converge Result into One

Are you a ConvergeCFD user with EnSight?

Do you have a Single Dataset, but multiple time periods which you translated to Case Format? Ie you export results from Time T = 0 to T1 in one operation, then later exported from Time T2 to Time T3, and then again exported reults from Time T4 to T5?

If so, then currently you have multiple different time ‘sets’ or ‘periods’, which can’t easily read into a single session of EnSight (other than using Multiple Cases, but that is not what Cases are meant for).

Would you then like to be able to operate on this solution as though it were one complete time period from T = 0 to T5? Well, I think we have a little tool for you. This tool should provide you back with a single coherent time period (From T = 0 to T = T5) as a single case.

This little python tool takes a look at all of the .case files in your current directory, and gathers up a list of all of the files that are referenced, constants written, and time values. In then creates a internal global list of all of that infomation, and sorts it in ascending time order. It then renames all of the associated files so that they fall into a single progression in time order, and generates a NEW case file, referencing the global total time, global total constants, and the newly renamed set of variable and geometry files. The routine takes only a second to run (renames are quick), and you should be able to load up the NEW case file into EnSight.

As renaming files is perhaps a dangerous thing, the routine also writes an “undo” file as well. You can run the “undo”, and you will get back to your original set of files (if you need to for some reason).

As with any routine, there are some assumptions, limitations, and caveats. They shouldn’t be too restrictive, but here they are, so you have a better idea about what the routine is expecting:

a. All of the case files are in the same directory (the routine doesn’t go rooting around in sub directories looking for .case files to merge).

b. All the .case files in the current directory are meant to be “merged” into one. If there are some which aren’t meant to be merged, just move them temporarily to somewhere else.

c. When you exported the results (using post_convert), you ALWAYS exported the same variables. No exceptions allowed, no if’s, but’s, no coconuts. (EnSight can’t deal with some variables existing at some times, and not others…. rules are rules).

d. The time values can overlap, and be of varying delta T. The routine should handle that okay.

e. The routine assumes you have measured data (default for converge post_convert us).

f. Due to internal coding assumptions/methods, this routine is for CONVERGE users only. If you have results from OpenFOAM, or Fluent, CFx, or other solvers, please contact CEI (support@ceisoftware.com) separately. We have some prototypes for other solvers.

To run the routine, simply download the python file, and place it into the directory you want to merge Converge .case files together. Then, type :

cpython31 merge_time_case.py

After running, should you need to undo, there will be a new python file created in your directory, and that can be run via:

cpython31 merge_time_UNDO.py

This works for MAC/Linux/Win. Use a cmd shell in Windows to run the python routine.

As always, please contact if you have questions, comments, requests. We’d love to hear from you, and work with you to provide you with the best post processing experience.

-Kevin

Download Link for file:

merge_time_case

Once downloaded, simply unzip the file to find the python .py routine.

In-Cylinder Tools

In-Cylinder Engine (ICE) simulations often contain specialized requirements for analysis. EnSight’s Python tool capability allows users to develop their own custom operations to fulfill the requirements of the analysis. I have written an initial set of tools here called “In-Cylinder Tools”, which can be installed as UserDefinedTools in EnSight 10

In this set of tools, we have the following:

1. Calculate Swirl. This routine takes the currently selected parent part(s) (typically the fluid domain of the cylinder), and calculates Swirl Velocity based about the Z axis. Using the parent part, it also calculates an Constant Variable which is the Spatial Mean of Swirl, so that you could easily create a plot vs. time for the average swirl.

 

 

 

2. Calculate Tumble. This routine takes the currently selected parent part(s) (typically the fluid domain of the cylinder), and calculates a tumble velocity, using the current average height of the parent part. The routine automatically works through time to determine this tumble velocity using the new center reference point at each timestep, and creates a graph of tumble vs time.

 

 

 

3. Crank Angle Conversion tool. This converts an EnSight .case file which has been setup with Analysis_Time specified as degrees crank angle, and converts this to Analysis_Time in seconds (user provides RPM). This allows EnSight to compute Pathlines correctly, as all of the constituent variables have consistent units.

4. Spray.out reader. For users of Converge, this tool will read in the Spray.out file information into a series of queries that you can then automatically plot. This reader will also read other Converge .out files which confirm to the save format.

 

 

 

 

 

5. Particle Distribution Function. This routine operates on the Measured Data within EnSight, to determine a mass-based distribution of any measured data variable (like radius or temperature) within the time domain. Please refer to this previous Python Exchange article for further information on the intended uses and application of this routine. Previous article.

 

 

 

Please download these tools from the link below. Unzip the file, and place the directory into your .ensight100/extensions/user_defined/Tools/ directory, and restart EnSight. You should then see a new tool folder in your UserDefinedTools area with the above tools.

Should you require any assistance with the tools or modification of them to suit your particular needs, please do not hesitate to contact CEI.

Click here to download In_Cylinder_Tools

 

Importing Converge .out files

The Converge Solver exports out additional quantitative information into various “*.out” files. The information contained within these .out files can be very useful in visualizing along with the fluid domain in EnSight, to quantify against other extracted values in EnSight, qualitative comparison, or just to easily visualize versus time in EnSight.

This very small/short routine was developed to work on the spray.out file which contains information regarding the spray computed by the solver (injection pressure, injected mass, spray penetration, etc). The routine reads the .out file, along with the user specified engine RPM (to calculate time in seconds), and places all of the values from the .out file into EnSight Queries.

The User Defined Tool should appear as :

The user simply needs to specify the Converge .out file, along with the Engine RPM, so that the routine can correctly tie the query with time.

Once executed, you should see a number of additional queries within EnSight. The name of the Query is taken from the .out file, along with the units. Each query is associated with “Time” in seconds, and should therefore play correctly and appropriately within EnSight, as well as¬†synchronizing¬†with the timesteps of the main dataset.

The resulting Queries can easily be plotted with the Right Mouse Button, or drag/drop onto current plotters. Query-on-query operations can also be performed to further inspect rate of change, comparisons (differences between queries).

You can download the current User Defined Tool here. Once downloaded, unzip the file, and place the contents into your .ensight100/extensions/user_defined/Tools/ directory, and restart EnSight.

Click here to download Converge .out file reader