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?
#1 Faster
If we are analyzing the influence of some parameters in our FE model, such as material properties, boundary conditions… editing the input file is a lot faster than opening the cae file and making such modifications through Abaqus/CAE.
#2 No other way
There are some options, such as material types (e.g. LaRC05 damage initiation criterion, user elements), that are not available on Abaqus/CAE and can only be defined manually in the input file. For instance, subroutines are the best example to work with 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:
#1 Lines folding
Most of the lines of the input files contain nodes, elements and other mesh data (sets, surfaces…). In many cases these are thousands or even millions of lines, which we don’t want to look at 99% of the time. By defult, in Vim all these lines are collapsed so we can skip them making the edition a lot easier!
#2 Heavy lifter
Although Vim is a very light software (latest release is 40 MB), it is able to handle huge text files very efficiently. You can open files containing a few millions of lines, edit it and save it almost instantly.
#3 Customization
Not only the visualization of the files, but also shortcuts and hundreds of other options are available in Vim through configuration files (e.g. vimrc). If it is your first time with Vim, keep calm and don’t feel overwhelmed. I will show you the basics next.
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“).
- vimrc
"--------------------------------------------------------------------------
" 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!