Notifications
Clear all

Problem with running an ABAQUS UEL written in C

2 Posts
2 Users
0 Likes
597 Views
Posts: 2
Topic starter
(@Pickwick)
New Member
Joined: 8 years ago

Hello all,

I have written a UEL in C which is called from Fortran. I use: abaqus job=myjob.inp user=myuelf.f

Fortran file, myuelf.f, is like:

-----------------------------------------------------------------

SUBROUTINE UEL(RHS,AMATRX,SVARS,ENERGY,NDOFEL,NRHS,NSVARS,

1 PROPS,NPROPS,COORDS,MCRD,NNODE,U,DU,V,A,JTYPE,TIME,DTIME,

2 KSTEP,KINC,JELEM,PARAMS,NDLOAD,JDLTYP,ADLMAG,PREDEF,NPREDF,

3 LFLAGS,MLVARX,DDLMAG,MDLOAD,PNEWDT,JPROPS,NJPROP,PERIOD)

INCLUDE ABA_PARAM.INC

DIMENSION ...

...

EXTERNAL BldGenerateStaticElement

CALL BldGenerateStaticElement(NNODE, MCRD, NDOFEL, NRHS,

1 RHS, AMATRX, SVARS, PROPS, U, DU, V, A, COORDS)

RETURN

END

-----------------------------------------------------------------

and the function in the C file, myuelc.c, is like:

extern void bldgeneratestaticelement_ (...){...}

Therefore before the simulation I have created a static library (e.g. libmyuelc.a) using CodeBlocks and put it in my working directory

and added the path to the library (F:\myfolder\libmyuelc.a) to the end of link_sl and link_exe inside abaqus_v6_env, as:

---------------------------------------------------------------------------------------------------

link_sl=[LINK,

/nologo, /NOENTRY, /INCREMENTAL:NO, /subsystem:console, /machine:AMD64,

/NODEFAULTLIB:LIBC.LIB, /NODEFAULTLIB:LIBCMT.LIB,

/DEFAULTLIB:OLDNAMES.LIB, /DEFAULTLIB:LIBIFCOREMD.LIB, /DEFAULTLIB:LIBIFPORTMD, /DEFAULTLIB:LIBMMD.LIB,

/DEFAULTLIB:kernel32.lib, /DEFAULTLIB:user32.lib, /DEFAULTLIB:advapi32.lib,

/FIXED:NO, /dll,

/def:%E, /out:%U, %F, %A, %L, %B,

oldnames.lib, user32.lib, ws2_32.lib, netapi32.lib, advapi32.lib,

F:\myfolder\libmyuelc.a]

link_exe=[LINK,/nologo, /INCREMENTAL:NO, /subsystem:console, /machine:AMD64, /STACK:20000000,

/NODEFAULTLIB:LIBC.LIB, /NODEFAULTLIB:LIBCMT.LIB, /DEFAULTLIB:OLDNAMES.LIB, /DEFAULTLIB:LIBIFCOREMD.LIB,

/DEFAULTLIB:LIBIFPORTMD, /DEFAULTLIB:LIBMMD.LIB, /DEFAULTLIB:kernel32.lib,

/DEFAULTLIB:user32.lib, /DEFAULTLIB:advapi32.lib,

/FIXED:NO, /LARGEADDRESSAWARE,

/out:%J, %F, %M, %L, %B, %O,

oldnames.lib, user32.lib, ws2_32.lib, netapi32.lib, advapi32.lib,

F:\myfolder\libmyuelc.a]

---------------------------------------------------------------------------------------------------------

However when I run the simulation I get the following error:

---------------------------------------------------------------------------------

End Compiling Abaqus/Standard User Subroutines

Begin Linking Abaqus/Standard User Subroutines

LINK : fatal error LNK1104: cannot open file F:\myfolder\libmyuelc.a

Abaqus Error: Problem during linking - Abaqus/Standard User Subroutines.

This error may be due to a mismatch in the Abaqus user subroutine arguments.

These arguments sometimes change from release to release, so user subroutines

used with a previous release of Abaqus may need to be adjusted.

Abaqus/Analysis exited with errors

-----------------------------------------------------------------------------------

I have included aba_for_c.h in my C library. Ive checked it and the function can be called and run outside of ABAQUS, but it cannot be linked in ABAQUS.

Im using ABAQUS 6.13, Fortran Composer XE 2011, and VS 2010, on a Win7 machine.

I was wondering if anybody is familiar with this issue or know any alternative way of doing that. Any help on this would be greatly appreciated.

Thanks,

Hanif

1 Reply
Posts: 3982
(@jorgen)
Member
Joined: 4 years ago

I often combine C and Fortran code to create user subroutines. I compile each source file to object code, and then link them into a shared library file.

-Jorgen

1 Reply
Share: