Академический Документы
Профессиональный Документы
Культура Документы
From here I continue with an example from Abaqus itself and try to run it in a modern way.
I took this example from Abaqus Verification Manual, 4.1.14_UEL. Suppose my working directory is
"/home/hosseinuser/test/MY-uel/abq-example". I need 3 files in this directory.
1) uelnonli.inp : which is my input file
2) uelnonli.f : which is contains my user subroutine
3) abaqus_v6.env: which contains the environment variables that Abaqus uses to compile and link
the user subroutines. Later I will have to change this file. I also make a folder called "lib" inside this working
directory. Then I created a CB::F Static library project inside this "lib" folder. Then, when I push the compile
button, it will create me
/home/hosseinuser/test/MY-uel/abq-example/lib/home/qiju9410/test/MY-uel/abq-example/lib/libabq-uelCB.a
which is an static library. The example from Abaqus manual defines "IMPLICIT" definitions which is bad
programming practice. What I did was that I created a subroutine named "myuel" inside my static project library.
Then, I defined "implicit none" and carefully defined all the variables inside this routine. Finally, inside the
actual user subroutine "uelnonli.f " I call "myuel". This way, Abaqus will call the new user subroutine from the
old one but everything is fully defined. You can find the project files and source files attached to this page.
Step 5: Modify the "abaqus_v6.env" file
abaqus_v6.env contains information about how Abaqus compiles and links you user subroutines to it. One can
do pretty complicated stuff in here. However, we only like to tell Abaqus to link our Static library while
compiling the user subroutine "uelnonli.f ". abaqus_v6.env can be normally found in /<Abaqus installation
dir>/abaqus/6.11-2/site/ . However this might be different for you. You can search inside you Abaqus installation
directory though. After finding this file copy it to our working directory above.
Open the abaqus_v6.env and in two places you need to add PATH to our static library where it says "link_sl"
and "link_exe".
link_sl = (fortCmd +
" -cxxlib -fPIC -threads -shared "
+
"%E -Wl,-soname,%U -o %U %F %A %L %B -parallel -Wl,-Bdynamic " +
"-i-dynamic -lifport -lifcoremt /home/hosseinuser/test/MY-uel/abq-example
/lib/libabq-uelCB.a")
link_exe = (cppCmd + " -cxxlib -fPIC " +
"-Wl,-Bdynamic -i-dynamic -o %J %F %M %L %B %O -lpthread
/home/hosseinuser/test/MY-uel/abq-example/lib/libabq-uelCB.a ")
As you see I just added "/home/hosseinuser/test/MY-uel/abq-example/lib/libabq-uelCB.a" to
the end of the commands.
Step 6: Call Abaqus with idb
Now, everything is ready to call Abaqus. To you need to enter the command below to invoke Abaqus and the
Intel Debugger.
user=uelnonli.f -debug
You can put a pause command in your user subroutines or simply push the "play" and quickly "pause" button up
there and your source files will appear. The you can debug, watch and change the variables.
Step 7: Debugging with variable chacking without Abaqus
One problem that I encountered was that when I changed my source files, and stopped and executed idb again, I
could not find the source files again. This is because Abaqus uses some scratch directories which change.
Therefore, every time you change something in your source files, you need to close and run again with the
debugger. To make things faster, you can simply make another Fortran console project with a main file. This can
be compiled and run independent of Abaqus. Then, you can simulate what Abaqus gives to your user-subroutine
with the main file. This way you can quickly run and debug your routine for programming mistakes.
There are also some compiler options for the intel compiler and it will do all the variable, pointer, allocation,
initialization etc. checks. You can add the following options to your Codeblocks project:
-O0 -debug -traceback -check all -ftrapuv
I have already activated some of these in the sample project file. So, finally you can add many subroutines,
Fortran modules and even C/C++ files to your Fortran project and link it to Abaqus.