A.11. Example of a Process Template XML Definition

Let’s take an example to explain how a process template XML file can be generated. This is a completely made up scenario and may not be directly applicable to your needs. However, it helps to explain some fundamental concepts in process modeling. You can use this example as a template, and modify it to match your specific needs.

Suppose a company wants to model the simulation process for a design engineer. The design engineers are involved in creating new designs of a component. Once the CAD model of the component is ready, various CAE simulations are performed on it to validate the model. The simulations are performed by an analyst who is an expert in the particular CAE discipline such as: Stress, Flow, Thermal, or Electromagnetic. But before the simulations can be performed, a mesh must be generated from the CAD model. The company already has an automated script for cleaning up the CAD model and generating a mesh. The design engineer runs that script by providing some initial values. The resultant mesh is first checked by the design engineer and then sent for verification by a mesh expert to check whether the mesh is suitable for performing CAE simulations. If the mesh is unacceptable, the process for generating the mesh is executed again. Once a mesh is approved, it is sent to analysts for performing CAE simulations. The simulations that should be performed are decided by the design engineer at the start of the process. When all the required simulations have been performed, the design engineer prepares a final report about the performance of the component. Figure 7: Graph for Example Process shows a graphical view of the process.

Figure 7:  Graph for Example Process

Graph for Example Process

The process consists of the following nodes:

To model this process we will assume that the following groups have been defined:

Figure 8: Partial XML Listing for Process Template Example shows a partial XML file listing for process shown above. The complete file listing is provided in run-simulation.pt.xml, located in the built-in remote folder /Data/Shared Data/Sample Files/process-templates.

See Accessing Sample Files for more details on the Sample Files folder.

Figure 8:  Partial XML Listing for Process Template Example

<?xml version="1.0" encoding="UTF-8"?><ekmWorkflow:workflow
xmlns:ekmWorkflow="http://www.ansys.com/ekm/workflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
name="Run Simulation" description="Perform CAE Simulation">
height="450" width="600"
  <ekmVersion>18.2</ekmVersion>
  <script lang="py"><![CDATA[
def hasDiscipline(discipline):
    for d in Disciplines:
        if d == discipline:
            return True
    return False
    ]]</script>
  <variables>
    <variable name="Stress Simulation" id="stress" description="Folder for stress simulation"
    type="Reference" default="" multivalued="false">
      <constraint name="baseType" value="Folder" />
    </variable>
    <variable name="Comments" id="comments" description="Comments for mesh approval" type="String"
    default="" multivalued="false" />
    <variable name="Report" id="reportFile" description="Final Report File" type="Reference" default=""
    multivalued="false">
      <constraint name="baseType" value="File" />
    </variable>
    <variable name="Thermal Simulation" id="thermal" description="Folder for thermal simulation" 
    type="Reference" default="" multivalued="false">
      <constraint name="baseType" value="Folder" />
    </variable>
    <variable name="Mesh Quality" id="quality" description="Quality of mesh desired" type="String"
    default="" multivalued="false">
      <enumeration>Medium</enumeration>
      <enumeration>Fine</enumeration>
      <enumeration>Coarse</enumeration>
    </variable>
    <variable name="Is Mesh Approved?" id="isMeshApproved" description="Check whether mesh is valid
    for simulation" type="Boolean" default="false" multivalued="false" />
    <variable name="Dimension 1" id="dim1" description="Dimension 1 of the component" type="Double"
    default="6.5" multivalued="false">
      <constraint name="min" value="2.0" />
      <constraint name="max" value="10.0" />
    </variable>

When the process is started, the design engineer is prompted to enter the simulation disciplines and a Project folder. The simulation disciplines are used to determine the types of simulations performed in the process. The batch processing is done by launching an external application defined in your EKM Workspace whose key is preprocessor. This application takes four command line parameters (Geometry File, Dimension, Dimension 2, Mesh Quality) and generates a file called mesh.msh which is imported into EKM. To test this process you can use the following python file (Figure 9: Python Script Example) as a mocked-up preprocessor.

Figure 9:  Python Script Example

import sys
import time

def solve(geomFileName, dim1, dim2, quality):
    geomFile = open(geomFileName, "r")
    meshFile = open("mesh.msh", "w")
    print("********** generating mesh file")
    time.sleep(10)
    meshFile.write("Generated mesh from geom file = " + geomFileName + " dim1 = " +
                   dim1 + " dim2 = " + dim2 + " and quality = " + quality + "\n\n")
    meshFile.write("Contents of the geom file:\n")
    eof = False
    while (eof == False):
        line = geomFile.readline()
        if (line == ""):
            eof = True
            break
        else:
            meshFile.write(line)
    geomFile.close()
    meshFile.close()

if __name__ == "__main__":
    geomFileName = sys.argv[1]
    dim1 = sys.argv[2]
    dim2 = sys.argv[3]
    quality = sys.argv[4]
    solve(geomFileName, dim1, dim2, quality)

This Python script will just echo the contents of the geometry file to the mesh file. To simulate a small delay the script will sleep for 10 seconds before writing any line to the output file. See the chapter on Defining EKM Servers, Queues and External Applications in the Administration Guide for details on defining external applications.


Release 18.2 - © ANSYS, Inc. All rights reserved.