Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29283 Discussions

Creating user subroutines in LS-DYNA using Intel Visual Fortran and nmake

billglowacki
Beginner
3,984 Views
I need to create a user subroutine for LS-Dyna (a finite element analysis code). The subroutines are written in fortran but apparently have some files to be included that are writtenand compiledin C++. When everything works right, the process basically involves editing a fortran fileand then using nmake with a makefile (and a bunch of .lib and .inc files) to create anexecutable version of the LS-Dyna software.However, I've never done it before, and it hasn't been done on the computer I'm using either so the configuration may not be set up correctly, though I believe I have the correct stuff (Intel Visual Fortran and MS Visual Studio) to do this.

My latestproblem with this isthatI'm getting a fatal error U1077 on NMAKE, basically saying it cannot open LIBC. I'm guessing this has something to do with the way fortran and visual C++ were setup on this PC.

The instructions I have fordoing this stuff gives a link (http://softwareforums.intel.com/ids/board/message?board.id=5&message.id=8846) to address problems with this process. It is no longer valid butI think it references a previous version of this forum. Thus, I figured I'd post a question here to see if anybody can assist me.I guess my question is what am I doing wrong, and what things do I need to check or change to get this to work. The instructions say you might have issues if the fortran compiler is installed beforeVisual C++, but that you can make it work. I'm not sure which one was installed first on this pc, but given the dates on the program folders, it looks like the fortran compiler was installed first.

Thanks for your help.

Bill Glowacki
0 Kudos
8 Replies
TimP
Honored Contributor III
3,984 Views
If there's an installation problem due to Visual Studio being updated after the Fortran installation, it should be possible to fix by running the Fortran install repair option (either from Add/Remove Programs or from the setup in the downloads folder in the Intel Fortran installation). If it's so bad the repair doesn't work, you can remove and install Fortran again. Your Fortran installation must be of at least the version used to build LS-DYNA (e.g. 9.1 or newer if the build was done with ifort 9.1). The nmake script would be run in the Fortran command prompt window on the Windows Start menu under Intel compilers.
0 Kudos
anthonyrichards
New Contributor III
3,984 Views
Your user subroutine can be written in Fortran, but must be linked with objects (.OBJ) written in C++ compiled seperately? What does your NMAKE create?
Does it create a .DLL (containing your userroutine and C++ code that calls it) that LS_DYNA can load?
How does LS_DYNA access your user-subroutine?

0 Kudos
billglowacki
Beginner
3,984 Views
Quoting - anthonyrichards
Your user subroutine can be written in Fortran, but must be linked with objects (.OBJ) written in C++ compiled seperately? What does your NMAKE create?
Does it create a .DLL (containing your userroutine and C++ code that calls it) that LS_DYNA can load?
How does LS_DYNA access your user-subroutine?


I'm using Fortran 9.1 and Visual Studio 2005. Thenmake will create an exe. The user subroutine is part of that exe. Its not like other FEA codes where its a separate file. For dyna you have to edit the dyn21.F file, then put it in a folder with all the dyna objects (several .inc and .lib files) and then run nmake to make an executable version of the dyna software. I don't believe any dlls are created in this process, but there are several in my existing dyna directory, so maybe it does create several of them too. The point is that it isn't justan addon file, the entire code gets recreated when you put a user subroutine in. Thus any access to the subroutine is internal to the dynaprogram itself.
0 Kudos
TimP
Honored Contributor III
3,984 Views
As Bill indicates, the nmake file uses ifort to re-link vendor supplied object files, made by both ifort and MSVC, so the MSVC installation must be visible so as to link libc et al. In a correctly installed ifort command window, the ifortvars.bat script sets up ifort paths and in turn calls the appropriate vcvars script to set up MSVC compile and link paths. By typing "CL" you would see that Microsoft C is set up.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
3,984 Views
Quoting - billglowacki

I'm using Fortran 9.1 and Visual Studio 2005.

I admit I didn't read the rest of this thread carefully, but you should know that Microsoft ceased shipping "static single-threaded" library -- LIBC.lib with VS 2005. Instead, both your C++ and Fortran codes should reference "static multi-threaded" library. If I recall correctly, the Fortran switches for that are

/libs:static /threads

while C++ switch is

/MT

(I think it's C++ default).
0 Kudos
TimP
Honored Contributor III
3,984 Views
Jugoslav makes a good point. Presence of a reference to libc may mean the package was set up for VS2003, so you may want to ask the vendor if this is so, and whether they can recommend how to modify the build for VS2005. If you do ask, be sure to specify which VS2005 you are using, as VS Express doesn't include all the libraries of the standard VS.
I would expect a version set up for VS2005 to include /Qopenmp in the Fortran options, clearly implying a multi-threaded library, but also linking libguide. The reference to libc from VS2003 might be over-ruled by /link /nodefaultlib:libc.lib so as to permit linking with libcmt, if that is your choice.
0 Kudos
azadeh2000
Beginner
3,984 Views

I want to use a user-defined material with lsdyna. I send them an email they reply me by this

For the user defined material:

You can log in at

http://ftp.lstc.com/objects/

the username is and the psw is

Here you then select the file that matches the hardware and OS that you
have, for the version that you want to use.

But I am wasting my time looking for the file contains object code, source code in a file called dyn21.f, and a Makefile to compile my custom version of LS-DYNA. I do not know which of them is the one I am looking for. They are many folders that looks the same after extracting them and some of them have lib files some do not have. I am confused. My computer is using windows 32bit, and I am using ls-dyna971.

Thanks in advance!
Azadeh




Quoting - tim18
Jugoslav makes a good point. Presence of a reference to libc may mean the package was set up for VS2003, so you may want to ask the vendor if this is so, and whether they can recommend how to modify the build for VS2005. If you do ask, be sure to specify which VS2005 you are using, as VS Express doesn't include all the libraries of the standard VS.
I would expect a version set up for VS2005 to include /Qopenmp in the Fortran options, clearly implying a multi-threaded library, but also linking libguide. The reference to libc from VS2003 might be over-ruled by /link /nodefaultlib:libc.lib so as to permit linking with libcmt, if that is your choice.

0 Kudos
TimP
Honored Contributor III
3,984 Views
Well, it's really not possible for this forum to substitute for a software vendor's support organization, and not acceptable to publicize their passwords. Under that directory, in pc-dyna folder, there are text files explaining some of the options, and over 30MB of materials for each of more than a dozen versions, including yours. If you're wasting your time, what of the time of the people reading this forum?
This is really an expert user option, no one on this forum is such an expert, and there are reasonable priced training sessions for those who intend to become experts.
0 Kudos
Reply