Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling Abaqus within a C++ app 1

Status
Not open for further replies.

Tshatlanin

Mechanical
Jul 21, 2011
2
Is it possible to control the Abaqus kernel directly from within a C++ application? The idea it to generate the object topology using a user-defined set of rules (whatever they might be) on the C++ side, then feed that topology into Abaqus, perform an FE analysis (whatever it might be), then feed the results back to C++ application for interrogation and display, preferably without ever seeing any Abaqus-related user interfaces.

I know it is possible to write custom scripts for Abaqus using Python. I also know that Python scripts can be executed from within a C++ application with some code ‘massaging’. Therefore, in theory, one can generate Python scripts on the fly in C++ and have them executed. However, the sticking point seems to be the following statement from the Abaqus Scripting User’s Manual: “If your script accesses the functionality of any of the Abaqus/CAE modules, the statements must be interpreted by the Abaqus/CAE kernel; you cannot run the script from the Python interpreter invoked from the system prompt. You must execute the script in Abaqus/CAE by selecting File Run Script from the main menu bar and selecting the file to execute”. That seems to imply that there is no way to directly control Abaqus from one’s C++ code. Is that correct?

Any feedback will be highly appreciated. Also, perhaps someone can suggest an alternative FEA package that would allow one to implement the aforementioned activity.

Thank you.
 
Replies continue below

Recommended for you

I'm sure it is feasible to do with C++. I wrote a set of Matlab functions and a calling program that generates input files. The structures of interests were hexapod designs. The user was able to enter in a set of inputs to define the basic geometry of the structure, the code generates an abq .inp file (with a node and element matrix), the code also generates a .bat file for multi-job submission, and finally the code executes the batch file using the python driven abaqus kernel. If you want to know more of the details let me know, but if you are doing this with C++ I cannot help you.
 
In actuality, the code actually read a text file that had columns for different variables and each row represented 1 particular structure.
 
*The code actually read a text file that had columns for different input variables and each row represented 1 particular structure.
 
Thank you for your response.

That sounds precisely like the answer I was looking for. Despite the fact that your .inp and .bat files (and the custom .py script, I am guessing) were generated in Matlab, rather than C++, it sounds like you were able to do the thing I was mostly concerned with - starting the Abaqus kernel and submitting jobs to it directly from within your custom application (and retrieving the results, I am assuming), without using any Abaqus GUIs.

Any additional details on your approach will be very much appreciated (e.g., you were able to simply execute an "abaqus python some_scriptname.py" command prompt statement somewhere in your Matlab code, and that started the Abq kernel for you? In that case, I severely misunderstood the original statement in the scripting tutorial).

Thank you in advance.
 
The basic theme of this approach plays with the fact that all information describing a particular FEA job is stored in the .inp file prior to submission. After the job is submitted and completed, all important information about the results is stored in the .dat file. In my particular case, I was looking at mass and natural frequency, which I post-processed (or as you say "retrieved the results") by a function from matlab that located the correct directory and searched withing the .dat file for that info. Basically you'll be using string searches, if you know what i mean.
 
Hey mechfeeney,

I've been working on a simulation for a while now within .CAE and I have it working nearly 100% as I would like. I was just wondering do you think it would be handier for me to run batches of jobs (optimization) using an external Matlab script or some sort of python Abaqus kernal? Bearing in mind I have no knowledge of python and I am familiar with Matlab.
Your paper sounds interesting and I'd be interested in having a look if thats not a problem?

Thanks
 
It's largely a function of how many parameters you are optimizing. For instance, if you are just changing a material parameter...say modulus of elasticity, it doesn't make sense to write a code to explore the behavior. On the other hand, if you are looking at many parameters (especially geometric variables), I found it helpful to write a MATLAB script to generate models with a given set of inputs. The inputs are received in through a text file (which can be easily created from an excel spreadsheet) and the code interprets the text file...in turn generating the .inp. The issue with MATLAB ...and SolidWorks for that matter, is that often times changing the geometry of individual instances or parts effects the structure assembly at large. ABAQUS is a pretty bad CAD utility, but it's FEA is great. I experienced many problems when trying to change the geometry of a particular instance (it would corrupt my constraints and bc's).

So the questions you need to ask:
1. Is it worth the time to make the code?
2. What type of structure am I analyzing? (wireframe, solid, shell?)
3. How many parameters are involved?
etc. etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor