We all started working with Abaqus through the interface: Abaqus/CAE. Clicking on the icons and menus to create our beloved finite element models, to run them and to look at the results. However, sooner or later we realized that what Abaqus was actually solving is not the cae file itself, but a plain text file known as the input file (*.inp).
The FE model is completely described by this file: nodes, elements, materials, sections, assembly, interactions, initial conditions, steps, boundary conditions, output requests… So, as you may imagine, we can edit it to make modifications in the model very quickly: changing material properties, boundary conditions, etc.
To open and edit the input file I strongly recommend using Vim.
1. Why edit the input file?
2. Why use Vim?
Although the input file can be read and modified with any text editor, there are some good reasons to choose Vim instead:
3. First time in Vim?
Come on! Install Vim and lets get started!
The first time that you open an input file with Vim, you will realize that you cannot modify it straight away!
This is because you are not in “insert mode” just yet. To be able to write into the file, you have to click ‘i‘ to enable insert mode.
To fold and unfold groups of lines, first you have to exit insert mode by clicking ‘Esc‘ (now you are in ‘command mode‘):
- To unfold a group of lines type ‘zo’ while the cursor is on that line.
- To fold it again type ‘zc’ with the cursor inside of these lines.
- To unfold everything: ‘zR’
- To fold everything: ‘zM’
Unfold (zo) and fold (zc) a group of lines in command mode
Some final and mandatory commands that you need to know (in command mode):
- Save the file: ‘:w’
- Close the file: ‘:q’
- Save and close (very handy!): ‘:wq’
- Force save and close: ‘:wq!’
In command mode save and close the file with ‘:wq’
4. Customizing the view
To customize the view we need to edit the _vimrc file. In Windows this file is usually found into the installation directory (e.g. “C:\Program Files (x86)\Vim“) or in the home directory (e.g. “C:\Users\Miguel“).
"-------------------------------------------------------------------------- " CUSTOM OPTIONS - TecnoDigital School (2022) " Comments are preceded by double quotes " Add line number set number " Highlight cursor line underneath the cursor horizontally. set cursorline " Change font set guifont=Consolas:h15 " Set color scheme to torte colorscheme torte " Change line number color highlight LineNr term=bold guifg=#555555 guibg=#000000 highlight CursorLineNr guifg=#777777 " Width of the line number column (adds some space in most cases) set nuw=7
Reopen any Abaqus input file and you will see the new formatting options.
5. Endless possibilities
Although Vim seems a bit old-school, it is one of the most widely used text editors by programmers and web developers all over the world. The customization level and efficiency that you can achieve through shortcuts and with hundreds of plugins has no rival in free open source text editors.
And if you want to get started in Abaqus Scripting with Python check out this post to learn how to create your own scripts.
I hope that you find these tips useful!