User login

Navigation

You are here

How to compile an UMAT wrote in C/C++?

Weijie Liu's picture

Hi,

Does anyone know how to compiler an umat in c/c++ for abaqus under windows system?

The Umat wrote in fortran works well, but I do prefer using c/c++ to make program.

I have installed visual studio 2010 c++, intel fortran.

 

Or is it possible to use c/c++ for umat?

 

Thanks in advance.

Comments

Frank Richter's picture

 

Hello

I do have some information on that but I cannot find the button to upload attachments.
Contact me directly

Frank

Weijie Liu's picture

Hello,

Thank you very much for the sent documents!

Especially, the 'Answer ID 737.txt' is very helpful, and it helps me fix the problem of the compiler's parameters.

Have a good week-end.

Dear Professor,

Could you also send me the documents? If there is an example for the head of the subroutine, it will be more helpful. Thank you in advance!

Ni

genet's picture

Hi,

Few years ago I also decided to write my Abaqus user subroutines in C++. Basically, in the C++ code the function must be called for instance:

extern "C" void umat_(double *stress, double *statev, double *ddsdde, double *sse, double *spd, double *scd, double *rpl, double *ddsddt, double *drplde, double *drpldt, double *stran, double *dstran, double *time, double *dtime, double *temp, double *dtemp, double *predef, double *dpred, char *cmname, int *ndi, int *nshr, int *ntens, int *nstatv, double *props, int *nprops, double *coords, double *drot, double *pnewdt, double *celent, double *dfgrd0, double *dfgrd1, int *noel, int *npt, int *layer, int *kspt, int *kstep, int *kinc, short cmname_len)

Then, under linux, I use gcc and the following options to compile the C++ code:

gcc -c -O3 -fPIC -o usub.o usub.cpp

Before 6.13, Abaqus was configured to compile/link with icc, so one also had to modify the compiling/linking instructions in abaqus_v6.env in order to use gcc, but now it seems that gcc is the default compiler/linker. Note however that if you use shared libraries you will still have to modify the linking instructions in abaqus_v6.en. Anyway, finally you provide the compiled object to abaqus:

abaqus user=usub.o job=job

At the end, for new developments I now use fortran—that's what most people use, so it makes collaborations and code sharing much more straightforward. Anyway, I hope that helps.

Martin

Weijie Liu's picture

Thanks for sharing the solution of compiling umat under gcc. In the future, maybe I would also transfer to program in fortran, for now I prefer c/c++, just to be more familiar for me.

For win_64 os, I use the following options under ms visual studio:

cl /c /nologo /W0 /MD /TP /EHsc /DNDEBUG /DWIN32 /DTP_IP /D_CONSOLE /DNTI /DFLT_LIC /DOL_DOC /D__LIB__ /DHKS_NT /DABQ_NTI_NET /DFAR= /D_WINDOWS /DABQ_WIN86_64 /O1 /I%I

Please could you share the documents about programming UMAT in C++??

Thanks for all

Weijie Liu's picture

Hi,

You can find the definition and compiler commands of uel under linux in Mr. genet's comment.

Under win os, the same declaration is used and I also have posted the compiler command.

 

If you want to know how to write the uel, you may find some help in here:  http://imechanica.org/node/7576

Weijie

genet's picture

Dear everyone,

I just cleaned my framework to write Abaqus User Subroutines in C++. It's on GitHub: https://github.com/maaaaaaaaaaaaaaaaaaaaaartin/AbaqusUsub.cpp. Let me know if you find it useful.

Martin

 

genet's picture

Thank you Martin. This is exactly what i need at present.

have a nice day.

Subscribe to Comments for "How to compile an UMAT wrote in C/C++?"

Recent comments

More comments

Syndicate

Subscribe to Syndicate