Attached is previous abaqus response to this query:
Question
Is it possible to write user subroutines for ABAQUS/Standard in C++?
Answer
(The following applies to versions 6.3-1 and higher.)
It is possible to write user subroutines for ABAQUS/Standard in C++,
but it is generally recommended that user subroutines be written in
Fortran. The interface for each of the user subroutines in
ABAQUS/Standard is in Fortran, and the use of another programming
language adds an additional layer of complexity to the programming
task.
The procedure for calling a C++ function from a Fortran application
is machine dependent, and requires an expert knowledge of compilers
and operating system conventions. Among the items that must be
understood are:
Mapping external C++ names to external Fortran names
Mapping C++ data types to Fortran data types
Conventions for inter-language procedure calls
In the example outlined below, a simple user subroutine in C++ will
be used in an ABAQUS/Standard analysis. To avoid platform
dependencies, certain macros in the C++ subroutine have been defined.
A function to transfer character arrays between Fortran and C++ has
also been defined. Please note that this approach is not supported-
ABAQUS, Inc will not provide technical support for this approach and
associated bugs, if any, will not necessarily be fixed.
To illustrate this procedure we provide a variation of the analysis
in Section 2.2.7 of the Version 6.3 ABAQUS Verification
Manual, "Transient internal pressure loading of a viscoelastic
cylinder." The files visco_dload.inp, viscocylinder.for and visco.C
are attached to this answer and available for download.
To run the analysis with the C++ subroutine, complete the following
steps:
Obtain the C++ compile command used by ABAQUS. On the command line
type:
abaqus info=env > env.txt
In the file env.txt look for the string 'compile_cpp'. Some examples
of the output on different platforms include:
Windows
compile_cpp='cl /c /nologo /W0 /MD /TP /DNDEBUG
/DWIN32 /DTP_IP /D_CONSOLE /DNTI /DFLT_LIC /DOL_DOC /D__LIB__ /DHKS_NT
/DFAR= /D_WINDOWS /O1 /I%I'
IBM AIX
compile_cpp='xlC -c -qsrcmsg -q64 -qarch=pwr3 -qtune=pwr3 -DRS6000 -
DCPLUS_IMPLEMENTED -D_LARGE_FILES -D_LARGE_FILES_API -DHAS_INT64 -
DBIT64 -DMULTI_THREADING_ENABLED -DTHREADED_SOLVER -DIBM -
DSPIN_YIELD -O3 -qstrict'
SGI
compile_cpp='CC -mips4 -64 -avoid_gp_overflow -c -DORIGIN2000 -
DSGI8000 -DSGI -DBIT64 -DFOR_TRAIL -DCPLUS_IMPLEMENTED -DNATIVE64 -
TARG:processor=r10000 -O3 -TENV:X=0 -I%I'
HP
compile_cpp='aCC +DA2.0W +DS2.0a -c -DHP -DHP11 -DFOR_TRAIL -
DCPLUS_IMPLEMENTED -DSWAPPED -ext -DBIT64 +O2 +Olibcalls -I%I'
Compaq
compile_cpp='cxx -c -std arm +inst_none -nopt -
distinguish_nested_enums -nodemangle -assume noaligned_objects -DDEC -
DHKS_DEC -DFOR_TRAIL -DDEC_ALPHA -DHKS_OPEN_GL -DCPLUS_IMPLEMENTED -
D_OSF_SOURCE -I/usr/include/X11R6 -I/opt/graphics/OpenGL/include -
DTYPENAME= -D_POSIX_SOURCE -D_XOPEN_SOURCE -DSPECIALIZE -I%I'
Compile the C++ user subroutine with the command found in Step 1.
Run the analysis with the C++ object file.
Windows
abaqus -j visco_dload -user visco.obj
UNIX
abaqus -j visco_dload -user visco.o
On certain UNIX platforms you will need to specify the correct flag
to link in the C++ libraries. First, obtain the applicable link
command used by ABAQUS by typing:
abaqus info=env | grep link_sl
Modify the commands as follows, with the new flag shown in red:
IBM AIX
link_sl='xlf_r -q64 -bM:SRE -bE:export.def -bnolibpath -bnoentry -o %
U %F %A %B -lxlsmp -lxlf -lxlf90 -lm -lC'
Compaq
link_sl='cxx -shared -Wl,-error_unresolved -Wl,-soname,%U -o %U %F -
Wl,-input,%E %A %B -lUfor -lfor -lm -lc'
The modification must be made to the link_sl command shown in your
environment file.
For additional information see:
'User Subroutines,' Section 24.1.1 of the Version 6.3 ABAQUS/Standard
User's Manual
Post by D'Arconte, RichWill ABAQUS run with a user subroutine written in C++ rather than FORTRAN?
If so, are there any special requirements for linking or for
passing data
Post by D'Arconte, Richback to ABAQUS, etc.? I have not found anything in the manuals covering
this issue. Thanks in advance.
0000
Rich D'Arconte
Assistant Principal Engineer
Aerojet
703-754-5083 (voice mail)
703-754-5638 (fax)
0000
DISCLAIMER: This email message and any attachments are for the sole use of
the intended recipient and may contain proprietary and/or
confidential
Post by D'Arconte, Richinformation which may be privileged or otherwise protected from disclosure.
Any unauthorized review, use, disclosure or distribution is
prohibited. If
Post by D'Arconte, Richyou are not the intended recipient, please destroy the original message and
any copies of the message as well as any attachments to the original
message.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/PMYolB/TM
---------------------------------------------------------------------~->