View Full Version : Running Abaqus from Matlab script
I'm trying to run an abaqus model from within a matlab script in order to do a material parameter optimisation. My model has a user-defined material. I can run it outside of matlab with no problems. However, when running it within matlab, the user-subroutine fails to link:
Begin Linking Single Precision Abaqus/Explicit User Subroutines
2/25/2009 1:24:59 PM
LINK : fatal error LNK1104: cannot open file 'LIBIFCOREMD.LIB'
Abaqus Error: Problem during linking - Single Precision Abaqus/Explicit 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 version of Abaqus may need to be adjusted.
Abaqus/Analysis exited with errors
Suspecting something is up with the environment variables, I've tried running the IFortVars.bat within the matlab script prior to executing abaqus. The batch file runs ok but the subroutine still fails to link.
Any help in this matter would be greatly appreciated.
Regards,
Cormac
I suggest that you create a compiled shared library version of your user subroutine using, for example:
abaqus make library=[fortran-file-name]
That way you don't have to worry about environmental variables.
-Jorgen
Thanks Jorgen. Works a treat.
Cormac
ali_me84
2009-05-04, 15:38
I want to link Matlab and ABAQUS for optimization, I want to creat input and output file for use in matlab az an optimizer.Could you help me.
You can do that if you perform the post processing using the Abaqus python interface.
-Jorgen
biofriend
2009-05-14, 07:51
Hi Cormac
I want to do exactly the same. I have linked Matlab with Abaqus and it works but I dont know which Optimization algorithm I must use. Because the function is unknown and I just have a couple of experimental points versus the FEM result points. I have heard that Genetic algorithm is suitable for such conditions but I really have no idea about it.
How do you do that?
Regards,
Bio
I have used both genetic algorihms and some of the standard minimization algorithms.
I often use the Nelder-Mead Simplex algorithm since it is easy to use and robust.
-Jorgen
I want to integrate matlab and abaqus to solve an optimization problem which needs a no. of iterations. I want to run this in batch mode. Has anyone tried similar thing before. Can anyone please give me some direction on this. I am new to both matlab and abaqus.
IceBreaker
2011-02-14, 00:18
% Running regular jobs from within Matlab
% Note: These commands worked on a Windows Vista 64-bit PC.
% Running simple INPs - one after the other (2 here) - in batch mode:
clear all; clc;
dos('cd "DIR1" & "DIR\temp1.bat" && "C:\WINDOWS\system32\cmd.exe" /k exit')
dos('cd "DIR2" & "DIR\temp2.bat" && "C:\WINDOWS\system32\cmd.exe" /k exit')
% ..
% ..
% DIR1, DIR2 .. are the locations of the directories in which your INPs, temp1.bat,
% temp2.bat .. files respectively are placed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Running simple INPs - simultaneously - with command prompt enabled:
clear all; clc;
dos('cd "DIR1" & "DIR\temp1.bat" && "C:\WINDOWS\system32\cmd.exe" &')
dos('cd "DIR2" & "DIR\temp2.bat" && "C:\WINDOWS\system32\cmd.exe" &')
% ..
% ..
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Running an INP with a subroutine:
clear all; clc;
dos('cd "DIR1" && "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat" & "C:\Program Files (x86)\Intel\Compiler\11.0\061\fortran\Bin\intel64\ ifortvars_intel64.bat" & "DIR\temp.bat" && "C:\WINDOWS\system32\cmd.exe" /k exit')
dos('cd "DIR2" && "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat" & "C:\Program Files (x86)\Intel\Compiler\11.0\061\fortran\Bin\intel64\ ifortvars_intel64.bat" & "DIR2\temp.bat" && "C:\WINDOWS\system32\cmd.exe" /k exit')
% ..
% ..
% Locations of vcvars??.bat and ifortvar?????.bat will depend on your own configuration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents of temp.bat:
{
abaqus job=JOBNAME user=SUBROUTINE.for interactive
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IceBreaker
2011-02-14, 01:56
Source: http://www.mathworks.com/support/solutions/en/data/1-3PRRDV/
% Define these variables appropriately:
mail = 'an.example.email.address@gmail.com'; %Your GMail email address
password = 'testing1234'; %Your GMail password
% Then this code will set up the preferences properly:
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Server','smtp.gmail.com') ;
setpref('Internet','SMTP_Username',mail);
setpref('Internet','SMTP_Password',password);
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port',' 465');
% Send the email. Note that the first input is the address you are sending the email to
sendmail('an.example.email.address@gmail.com','Tes t from MATLAB','Hello! This is a test from MATLAB!')
timotran
2011-05-20, 12:13
Hi Jorden,
Could you instruct me how to use the compiled shared library? I could make the library but could not find the way use the library. Is there any link to the instruction for that?
Timo
I suggest that you create a compiled shared library version of your user subroutine using, for example:
abaqus make library=[fortran-file-name]
That way you don't have to worry about environmental variables.
-Jorgen
That is easy, all you need to do is to is to create a file named "abaqus_v6.env" and put it in your simulation directory or home directory.
The abaqus_v6.env file should contain the following 3 lines:
import os
usub_lib_dir = os.getcwd()
del os
-Jorgen
timotran
2011-05-23, 16:21
it works perfectly.
Thanks so much Jorgen.
Tim
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.