How to receive automatic notifications when your FE simulations are done
If you are a regular Abaqus user, I am sure that eventually you will need to run models for long periods of time. It can be quite annoying to go back to the office just to check if the simulation has finished to then find out that it is still running. For that reason, I’ve coded a simple python script that sends an automatic e-mail to the user once the simulation is completed or aborts due to errors.
While you run FE models that take a huge amount of computational time to finish, it is likely that you will be working on other things, such as experimental tests, reports, meetings and so on. Obviously, we want to check our results as soon as they are ready, but in order to do so we need to be checking our computer every now and then. This can be particularly annoying when you leave a simulation running for a few days and you are doing things out of the office. Hence you need to go and check if the model is done… and then you realise it’s still there, calculating more stresses and strains and that your trip to the office was a waste of time. To overcome this problem, I decided to create a python script to send a notification directly to my e-mail every time my analyses finish. I will try to explain you the basics so you can use this code on your computer.
First of all, you need to install Python on your workstation. You shouldn’t have any problem with this, since it is quite easy to find online. Once it is installed you can check that your computer recognises it by typing the following commands:
- Press the “Start” button.
- Type: cmd
- Type: python
Then you should see something like this:
After that, you will need to create the python script using a text editor, such as Notepad++. The code is illustrated below with colours, so it is easier for you to follow. Basically the things that you need to modify are the name of your input file and your e-mail address.
The log file is a simple text document where Abaqus writes when the simulation starts and finishes. If it finishes without any problem, the last line of the file will have the word COMPLETE in it. On the other hand, if it aborts, it will contain the word ERRORS. Therefore, the code basically reads the files over and over again until the simulation stops. Then, based on the last line of the file, it will generate an email stating if the analysis was completed successfully or not.
It is more than probable that this script is not the best written, but I did it myself in a couple hours and it does the trick. Hope you find this post useful and have a great time while waiting for your simulations to finish!