Okay here is the process (keep in mind I have done this successfully for
Abaqus version 6.7-1, and 6.8-1. I can't speak for any other versions).
I have also only done this on my 32 bit Windows XP machine. I'm sure
there will be some differences in the overall procedure for different
machines.
First, let me point out that there are several steps to this procedure
so it is probably best to create a batch file that runs them all at
once. If you are unfamiliar with batch files just google "batch
programming" and the results should be sufficient for this exercise.
A quick semantic: I'm going to refer to the Abaqus root directory as
ABA_ROOT. On my machine this is C:\ABAQUS\6.8-1
Let's start - locate your abaqus_v6.env file. This should be under
ABA_ROOT\site. This is a simple text file let's open it with a text
editor. There's a lot of information in this file, and it is essentially
just a python script. We are only concerned with 4 variables in this
file:
1) compile_cpp
2) compile_fortran
3) link_sl
4) usub_lib_dir
Now, a quick explanation of each of the above:
1) A series of commands used to compile the C++ parts of the user
subroutines. This results in object files.
2) A series of commands used to compile the FORTRAN parts of the user
subroutines. This results in object files.
3) A series of commands to link all of the object files into the
standardU.dll used by Abaqus to call the user subroutines.
4) A string specifying the path which holds the standardU.dll file. This
is where Abaqus will look for user subroutines when running a job. When
this used there is no need to specify the location of the user
subroutines with the Abaqus job definition. See section 3.2.2 in the
Abaqus Analysis User's Manual for more info on this.
Okay next let's add our commands to the batch file (I'll distinguish
commands with a blue Courier Font):
The first step I use is to compile my C++ routines. I copy and pasted
the exact commands from compile_cpp:
call cl /nologo /c /MD /DABQ_NTI_NET /DABQ_WIN86_32 /TP /EHa /GS
/DNDEBUG /DWIN32 /DTP_IP /D_CONSOLE /DNTI /DFLT_LIC /DOL_DOC /D__LIB__
/DHKS_NT /DFAR= /D_WINDOWS /O1 <list your .cpp files here without the
brackets>
Note that the "call" command just tells the batch file to return to the
batch file after the "cl" command is done.
Also, there are a lot of compiler commands here. Many of them I do not
know what they do. The most important though is probably "/c" - this
tells the C++ compiler to only compile and not link. Therefore, the only
resulting files are .obj files. Obviously if you don't have any C++
routines this step is not needed.
The next step is to compile the FORTRAN files. Again I copy and pasted
the compile_fortran commands:
call ifort /nologo /c /Gm /recursive <list .for file here without the
brackets>
Again, the "/c" command tells the FORTRAN compiler to only compile and
not link.
We now have all of our object files. The next step is not necessary but
I use it since I'm compiling object files that I release to customers.
This step basically takes all of the object files you have created and
compiles them into one object file. Like I said this is NOT necessary.
call LIB /nologo /out:FINAL_OBJ_FILE.obj <list all .obj files here
without the brackets>
The "/out" command tells the LIB function the name of our resulting
object file. This can be whatever you want.
The final required step is to link the object files into the
standardU.dll. This step is not very straight-forward. If you look in
your abaqus_v6.env file at the link_sl variable. You'll see a few
compiler commands at the end like: %E, %U, %F, etc. These are where some
more files need to be defined. The best way to find the exact location
of these files is to run the abaqus make procedure with verbose on and
pipe the output to a text file such as:
abq681 make -lib MyUserSubroutine.for -verbos 5 > output.txt
Open the resulting output.txt file and look for the line that starts
with "Link command:". Here is an example (the important information is
in bold):
Link command: ['LINK', '/nologo', '/INCREMENTAL:NO',
'/subsystem:console', '/machine:X86', '/NODEFAULTLIB:LIBC.LIB',
'/NODEFAULTLIB:LIBCMT.LIB', '/DEFAULTLIB:OLDNAMES.LIB',
'/DEFAULTLIB:LIBIFCOREMD.LIB', '/DEFAULTLIB:LIBIFPORTMD.LIB',
'/DEFAULTLIB:LIBMMD.LIB', '/DEFAULTLIB:MSVCRT.LIB',
'/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib',
'/DEFAULTLIB:advapi32.lib', '/FIXED:NO', '/dll', '/def:export.def',
'/out:standardU.dll', 'DLOAD.obj',
'C:\\ABAQUS\\6.8-1\\exec\\lbr\\standardU_static.lib',
'C:\\ABAQUS\\6.8-1\\exec\\lbr\\standardB.lib',
'C:\\ABAQUS\\6.8-1\\exec\\lbr\\ABQUTI_CoreUtils_import.lib',
'C:\\ABAQUS\\6.8-1\\exec\\lbr\\ABQUTI_UtiLicensing_import.lib']
You'll see you need an export.def file (I'll explain in a little bit how
to create that), you'll need to tell the Link command you want your
output to be a standardU.dll file. You'll then want to specify your .obj
files. You'll see in the above example mine was DLOAD.obj. You'll then
need to specify the .lib files. These files allow your user subroutine
access to various Abaqus DLL files. Therefore, in your batch file your
LINK command should exactly mimic the above. Here is mine:
call LINK /nologo /INCREMENTAL:NO /subsystem:console /machine:X86
/NODEFAULTLIB:LIBC.LIB /NODEFAULTLIB:LIBCMT.LIB /DEFAULTLIB:OLDNAMES.LIB
/DEFAULTLIB:LIBIFCOREMD.LIB /DEFAULTLIB:LIBIFPORTMD.LIB
/DEFAULTLIB:LIBMMD.LIB /DEFAULTLIB:MSVCRT.LIB /DEFAULTLIB:kernel32.lib
/DEFAULTLIB:user32.lib /DEFAULTLIB:advapi32.lib /FIXED:NO /dll
/def:export.def /out:standardU.dll <list your object file(s) here
without the brackets> C:\ABAQUS\6.8-1\exec\lbr\standardU_static.lib
C:\ABAQUS\6.8-1\exec\lbr\standardB.lib
C:\ABAQUS\6.8-1\exec\lbr\ABQUTI_CoreUtils_import.lib
C:\ABAQUS\6.8-1\exec\lbr\ABQUTI_UtiLicensing_import.lib
Before you can run that command you need to create an export.def file.
This file basically tells the Linker the names of the entry points in
the standardU.dll. Go back to the output.txt file and you'll see a bunch
of lines beginning with "export.sym" - you'll need all of this
information. Now create a new text file called "export.def". Begin this
file with the following line
LIBRARY standardU
now enter a blank line and then on the third line:
EXPORTS
now enter all of those export.sym lines from the output.txt file. But do
NOT include the "export.sym:" text. Therefore, my final export.def file
looks like:
LIBRARY standardU
EXPORTS
***@104
***@44
***@52
***@32
***@48
***@64
***@48
***@168
***@72
***@64
***@48
***@36
***@80
***@48
***@64
***@32
***@44
***@76
***@84
***@88
***@48
***@24
***@240
***@144
***@48
***@24
***@44
***@76
***@96
***@148
***@92
***@56
***@76
***@188
***@28
***@152
***@112
***@64
***@24
***@80
***@12
***@24
***@24
***@24
***@108
***@28
***@48
***@44
***@92
***@104
***@12
This file will change frequently from version to version of Abaqus.
That's pretty much it. Run all of the above commands and if everything
works you'll get out a standardU.dll file containing your user
subroutines. Remember to use it your usub_lib_dir variable needs to
point to the directory which holds this file.
Some more stuff that is NOT necessary:
I also include some cleanup statements in my batch file. After running
all of the above commands you'll be left with some files that you don't
really need to keep around. Such as any old .obj files, .mod files, and
the following three files are not needed:
standardU.dll.manifest
standardU.exp
standardU.lib
You can delete these files in your batch file using the "del" command.
For instance:
del standardU.exp
I hope all of this is helpful. I'm sure this will also generate some
questions - feel free to ask away!
[Non-text portions of this message have been removed]