Learn how NXOpen can be used to combine and envelop load cases in Simcenter 3D. Take advantage of this capability to achieve quicker analysis turnaround and architect a more seamless multi-disciplinary optimization workflow.
Challenges:
- Large number of load case combinations
- Frequent design iterations
- Manual process is time-consuming with slow turnaround
- Majority of time spent performing analysis
Values:
- Easily scale number of load cases considered
- Automated process results in quicker turnaround
- Process can be leveraged as part of optimization framework
- Spend more time exploring design alternatives
Overview of NXOpen
NXOpen is an Application Programming Interface (API) that gives the user access to the NX/Simcenter 3D model and tool commands, allowing the user to customize and extend the baseline software capabilities. For example, applications might include:
- Creation and manipulation of part geometry and/or drawings
- Data importing or parsing of model geometry information and analysis results
- Scripts for automating of repetitive tasks
The NXOpen Getting Started Guide and NXOpen Programmer’s Guide are useful starting points for further understanding the tools capabilities. NXOpen can be used with multiple well-known programming languages, including C#, C++, Java, Python, and Visual Basic. In our case, we will leverage NXOpen using Python. The NXOpen Python Reference Guide is a useful resource for understanding the package-class-method structure.
For hands-on learners, the NX/Simcenter 3D software supports auto-generation of NXOpen code corresponding to interactions with the Graphical User Interface (GUI). A walk-through of the steps required to auto-generate NXOpen code is as follows:
- Set the preferred programming language by going to File -> Preferences -> User Interface. Next, select Tools -> Journal from the available options and click on the radio button corresponding to programming language that should be used when auto-generating NXOpen code.
- Select the Record button in the Developer tab and specify the file path to where the auto-generated NXOpen code will be written.
- Each interaction with the GUI will then be recorded until the Stop Recording button in the Developer tab is selected
Example Geometry and Problem Description
To further explore the use of NXOpen, imagine a cylindrical pressure vessel with a flange extending outward from the dome center on one end, as shown below.
The flange connects the fuel in the tank to the propulsion system via a pipe routing network. The propulsion forces at the engine generates loads back on the flange. A conservative bound on the induced limit forces and moments in each direction is determined and taken to be ±9000 N in X, ±2000 N in Y, ±2000 N in Z, ±100 Nm about X, ±5000 Nm about Y, and ±5000 Nm about Z. To determine if the current design will yield under limit loading conditions, all possible linear combinations of the forces and moments must be analyzed. To do so, the limit force and moment in each axis direction is analyzed separately using the Nastran Static Structural solver, and load combination and enveloping is used to determine the maximum stress across all potential load combinations. Since we expect the stress concentrations to occur near the flange-dome connection, only the components near that connection are considered in the following work, as seen below.
The loads are applied through a point rigidly connected to the flange lip nodes and a fixed boundary constraint is applied to the circumferential dome nodes that connect to the pressure vessel cylindrical body.
Source Code
The source code is available for download via link at the end of the post. Use the source code to follow along. Only portions of the source code will be referenced in the following sections.
Step 1: Define Script Workflow
Firstly, we will assume that the geometry model, finite-element model, and the limit load cases in each axis direction have been setup and the limit load cases have run without error. The script begins by importing the required NXOpen packages. Refer to the NXOpen Python Reference Guide to determine which packages you can import. If using the journaling feature to auto-generate NXOpen code, all necessary imports will be generated automatically. The NXOpen package contains the basic tools to get started and should always be included as an import. In our case, we are interested in automating result post-processing, so we also import the NXOpen.CAE package to get access to tools available in Simcenter Pre/Post.
The next step is to instantiate the working session reference parameters. First, we use the NXOpen package to grab the active session object. Second, we use the session object to access the active work part object. Third, we use the active work part object to access the associated simulation object.
When opening a fresh session, the limit load cases will not have the results loaded. The same is true when creating a combined or enveloped load case. The result is generated, but not loaded into the active session by default. Consequently, we will need a function for automating the loading of result data by load case name. Below, we use the load_solution_results function (to be discussed in Step 2) to load the limit load cases in each axis direction. The function to load the solution results returns a pointer to the solution instance. The solution instances can have multiple subcases, and each subcase can have multiple iterations (e.g. transient solution). Since we are performing a static structural analysis with a single subcase, we can access the first subcase and iteration entry to get a direct pointer to the solution data of interest.
After loading and setting up pointers to the load cases we wish to combine, the array of load combination multipliers is generated using a Python list comprehension. This is also where we get a glimpse into the power at our fingertips when using the NXOpen + Python utility. We are not just confined to using NXOpen API commands, but are free to leverage the extensive Python third-party libraries and integrate them with existing NX/Simcenter 3D workflows to dramatically customize and extend current tool capabilities.
The list of load combination multipliers is iterated over and the create_load_combination function (to be discussed in Step 3) is used to combine the load case elemental stresses. After creating the combined load case, the load_solution_results function is used to load the result file into the active session. Lastly, the load combination information is stored into a running list that will be used during the enveloping step.
After all combined load cases have been generated and loaded into the active session, the create_load_envelope function (to be discussed in Step 4) is used to envelope the maximum Von-Mises stress across all load combinations. Lastly, the load_solution_results function is used to load the result file into the active session.
Step 2: Automate Result Loading
To automate result loading, we interrogate the simulation object for a solution instance that matches a name key. The name key is simply the name assigned to the solution instance in Simcenter 3D. Once we have the solution instance, we can then interrogate it for results of type Structural and then use the session object to load in results that match the solution instance name.
Step 3: Automate Load Case Combination
To automate load case combinations, the session object is used to create a ResultsCombinationBuilder object. The first step requires passing in the result data that will be used in the load combination, a name label, and the unit system assigned to the result data. In our case, the result_name and result_type parameters are set to Stress and Elemental, respectively. Alternatively, if we were interested in combining nodal reaction forces, we would instead set result_name to Reaction Force and result_type to Nodal. After identifying the load case result data to use, the load combination is defined as a linear superposition of all the limit load cases with load case multipliers unique to each load case combination.
Next, the combined solution creation parameters are specified such that the combined load case is generated as its own solution instance, rather than being lumped into an existing solution instance as an additional subcase or iteration. The output quantity of interest is set to Stress and the path to an output file is provided, in order to generate an ASCII version of the result data for post-processing outside of Simcenter 3D or for re-reading the result data into another Simcenter 3D session.
The unit system associated with the combined solution output is setup to be read in from an existing file, ensuring unit consistency. The unit_ref_solution variable can be any of the solution objects associated with the limit load cases. Error handling conditions are skipped in our case, but logic can be added for customizing program behavior when running into these types of errors. Lastly the ResultsCombinationBuilder object data is committed to the active session and thereafter removed from memory.
Stress contours for selected combined load cases, and the corresponding load case combination equations, are shown below:
Step 4: Automate Load Case Enveloping
The automation of load case enveloping is very similar to load case combination. To begin, the session object is used to create a ResultsEnvelopeBuilder object. The first step requires passing in the result data that will be used in the load enveloping, an ID label, and the result parameters defining the data and operations used to envelope across the input load cases.
Next, the enveloped solution creation parameters are specified such that the enveloped load case is generated as its own solution instance, rather than being lumped into an existing solution instance as an additional subcase or iteration. The output quantity of interest is set to Stress and the path to an output file is provided, in order to generate an ASCII version of the result data for post-processing outside of Simcenter 3D or for re-reading the result data into another Simcenter 3D session.
The unit system associated with the enveloped solution output is setup to be read in from an existing file, ensuring unit consistency. The unit_ref_solution variable can be any of the solution objects associated with the limit load cases. Error handling conditions are skipped in our case, but logic can be added for customizing program behavior when running into these types of errors. Lastly the ResultsEnvelopeBuilder object data is committed to the active session and thereafter removed from memory.
Step 5: Run Script and Review Results
To run the script, simply navigate to the Developer tab and select the Play button, as seen below. Then browse to your script and run when ready.
The enveloped Von-Mises stresses and associated critical load case ID by element are shown below. The peak stresses are concentrated in the transition region between the flange and the tank dome, as expected. The peak stress across all load cases is 62ksi. The tank and flange materials are assumed to be made from an Aluminum-Lithium alloy with a yield strength of 59ksi. The current design will thus yield under the limit loading conditions. So what now? We will still have to iterate through the design-analyze cycle, but thanks to the automated post-processing procedure, more time can be spent exploring alternative design choices with less time spent executing the analysis steps. Furthermore, the automated tool developed using NXOpen + Python can even be leveraged by optimization frameworks, such as Simcenter HEEDS, for performing automated design exploration that is tied to the geometry model. Alas, we will leave that topic for another time.
Summary:
In brief, we looked at the utility of leveraging NXOpen + Python as part of our analysis workflow. In particular, we looked at speeding up our analysis turnaround by focusing on a reduced set of foundational load cases and automating a full survey study via load combination and enveloping. If design go-backs are needed to ensure positive operational margins, the time otherwise spent performing the analysis survey manually can instead be spent on exploring more design alternatives for an equal allotment of time, thereby increasing opportunities to design a better performing product or even an equally well-performing product of lower weight. Furthermore, by having an automated post-processing procedure, the engineer is also given the opportunity of wrapping the automated process into an integrated multi-disciplinary optimization framework, such as Simcenter HEEDS, in order to automate the design exploration process as well.
Download Simcenter 3D Load Case Combination Materials Here
Written by José Márquez
José Márquez is an Aerospace Engineer with a background in loads analysis, multi-disciplinary optimization, and software development. Outside of work, he enjoys gardening and rock climbing.