Create a plane part

This is a simple tool but it may come in handy. Sometimes you just want to create some simple geometry, and probably the most common geometry to make is a plane. EnSight has the capability to create points and mesh them in various ways. This capability is called point parts, but it is cumbersome to specify each point manually.

This tool uses the location of the plane tool to create a point part and mesh the points to create a surface. The resulting part is a plane at the exact size and location of the plane tool. The new part can be colored and textured as desired, but it will have no variable information.

Example: This tool used to create a road for the guard rail demo model.

Just plug and chug with this tool. Don’t try to modify a created plane, just delete it and make a new one. Use the tool repeatedly to create multiple planes.

Download tool and icon. (updated 2012-09-28)

create_plane_part.zip

LAMMPS DEM Particles into EnSight

Recently, a user inquired about the ability to read in Discrete Element Model (DEM) data from the LAMMPS program. EnSight has many features used to visualize and analyze DEM particles from other solvers. With a quick look at their format, along with the ability to utilize Python to write a small translation routine, there is a new translation script available here to work with LAMMPS datasets.

This Python routine takes a particular LAMMPS output file containing DEM particles, denoted with a “.dat” extension, and converts this dataset into EnSight Format. The single part in EnSight contains only points (and point elements) representing the DEM particles. The routine will also convert the variable information provided within the .dat file into nodal variables. This routine does not have a lot of testing, but seems to work fairly straight forward.
Assumptions:
(1) The provided .dat file is ASCII
(2) Variable names used within the .dat file are provided at the top of the file
(3) Columns 1,2,3 contain the X,Y,Z positions of the particles.
(4) Timestep information is provided in the “Zone” field.

After using the tool to convert the dataset, the user will have an “ensight_files” directory containing the converted information. The user can subsequently just load the “lammps.case” file within the “ensight_files” directory directly to read the data in (there is no need to convert the data each time). The Tool writes command language back into the Journal File, so that recovery and utilization of the Journal File for scripting is still valid.

Help for this tool is provided from the “Help” button straight in the tool’s GUI, or via the Tool Help in the User Defined Tool Window. Help can b found here : https://sites.google.com/a/ensight.com/user_defined_tools/lammps-translation

The current version of the Tool is version 2.0 from September 18, 2012

Any issues or problems should be reported back here, to CEI, or the author (Kevin Colburn:  kevin@ceisoftware.com).

Download LAMMPS Conversion Tool here

Droplet Claculation Tool

In addition to the Droplet Histogram Tool I was asked for a routine that calculates the penetration depth and the injection cone angle of droplets. The attached tool does these two things. When launched a small GUI pops up which asks the user for the measured particle data, the time step for calculation and the percentage of droplets within the calculated cone angle. The default value here is 80%. With this value the routine tends to stop at a cone angle which comes close to the groplet injection geometry.

 

This routine is written as a user defined tool. If you have an existing directory for your own tools just put it together with the image into that directory. Otherwise it can be used as a standalone tool as well if line 360 is activated. Please contact me if you have any problems (david@ceisoftware.com).

 

download

 

Transform a vector or tensor

This tool transforms an existing vector or tensor variable into another reference frame which is specified by the user. Another way to describe it is that the tool rotates the variable. This was requested by a customer because they were interested in the components of vectors and tensors in arbitrary reference frames.

Note that the tool (as-is) does not rotate the variable along with the reference frame (the way EnSight frame mode will rotate objects attached to the frame). The variable is left unchanged, but it’s components are transformed to be in the basis of the new reference frame. For a vector, this is equivalent to taking the dot product of the vector with each of the 3 axes of the new coordinate system. This is also equivalent to rotating the vector in the opposite direction, which is how the vector will look if you visualize it in EnSight. If you would like the tool to rotate the vector WITH the reference frame then you can simply add “.transpose()” to the end of line 216, which transposes the rotation matrix and reverses the direction of rotation.

The new reference frame is determined using 3 points which are specified by the user. Point 1 is the origin of the new frame (the absolute location of this origin is irrelevant as no translations are performed). Point 2 is in the direction of X’, meaning the X’ axis is in the direction of a line from point 1 to point 2. Point 3 is the direction of Y’ (normal to the X’ axis). The image below shows a 2D representation. Points 1 and 2 determine the X’ axis, and point 3 determines the X’-Y’ plane, but Y’ does not necessarily pass through point 3.

These three points can be specified in two ways:

  1. If 3 or more query probes exist, the first 3 probes will be taken as the 3 points.
  2. If 2 or fewer probes exist, then a window will appear for the user to specify the XYZ locations of all 3 points.

The next step is to choose a variable to transform, and which parts to calculate the new variables on. All existing vectors and tensors will appear in the list of variables to select.

The script then runs. The user should see these results:

  • A new axis triad will be displayed (centered at (0,0,0)). The triad consists of three “3D arrow” annotations and they can be edited if desired.
  • Intermediate scalar variables will be created and placed in the group “p_scalars”. 3 scalars will be created for vectors, 18 for tensors. The scalars are needed for the calculation, and removing them (deactivating them) will also remove the final variable.
  • A new vector or tensor will be created with “_p” tagged to the end of the variable name. “p” here stands for “prime” meaning the primed coordinate system. When this variable is created the script is finished (there is no pop-up window indicating the script has completed running).

This tool was designed to meet the specifications of a single customer. Many aspects of how the script operates could be easily changed to make it more suitable for other users. For example, there could be a different way to define the rotation, or the tool could be made to rotate more than one variable at a time.

Limitations and warnings

  • By running the tool repeatedly, any number of vectors can be transformed but rotating a tensor will deactivate the previous tensor.
  • The accuracy of the transformation has not been extensively tested. If errors exist in the calculation they could occur for vectors only, or tensors only, or for both types.
  • EnSight 10 only. It could be adapted to EnSight 9 with little effort, if requested.

Download the tool and icon: (updated 2012-09-18)

transform_variable.zip

Remove Vector Component

Last week a customer complained about the necessary steps to remove a component from any vector variable. In his case he wanted to project streamlines on the midplane in Y direction around a car surface. The standard way in EnSight is to get the X and Z components of the velocity vector and add those to the MaceVect Calculator function with zero as Y components. This new variable should be renamed and can be used for the desired streamlines. Too unhandy for the user.

 

This routine does all steps automatically. It launches a small GUI which offers a combo list with all vector variables in the loaded data. The user has to select the component that has to be removed and click OK. The routine will create a new variable on all parts which als called original_variable_name_component-0 (e.g. velocity_Y-0).

 

This routine is written as a user defined tool. If you have an existing directory for your own tools just put it together with the image into that directory. Otherwise it can be used as a standalone tool as well if line 66 is activated. Please contact me if you have any problems (david@ceisoftware.com).

download

 

 

Droplet Histogram Tool

I was asked by two customers at the same time if we have a histogram function for droplets or measured parts. In EnSight we can create histograms by looping an isovolume over a 3D part and query the attributes of that isovolume in every loop step. As droplets don’t have a volume this approach will fail.

For droplets we can use EnSight’s capability of exporting geometries. This new routine does that and gets all information from the exported files. The geometry will be exported to the temp file of the operating system. After finishing the script removes all temporary data.

One thing that is typical for droplets is the fact that they usually appear in transient files. Thus this code enables the user to select the time steps to export. By default histogram results for all time steps will be exported. Furthermore the user has to select the desired variable for the histogram. Also the number of value steps has to be selected. This number will define the refinement of the results.

As we usually handle transient files, this routine does not create a x-y plot. This would be unhandy fo several time steps. The results will be written to a text file in two columns. By default this file will be in the working directory and is called histogram_data_pairs.txt.

This routine is written as a user defined tool. If you have an existing directory for your own tools just put it together with the image into that directory. Otherwise it can be used as a standalone tool as well if line 270 is activated. Please contact me if you have any problems (david@ceisoftware.com).

download