Announcement

Collapse
No announcement yet.

Running Abaqus from Matlab script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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
    Jorgen Bergstrom, Ph.D. PolymerFEM Administrator

    Comment


    • #3
      Running Abaqus from Matlab script

      Thanks Jorgen. Works a treat.

      Cormac

      Comment


      • #4
        Matlab <--> ABAQUS for optimization

        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.

        Comment


        • #5
          You can do that if you perform the post processing using the Abaqus python interface.

          -Jorgen
          Jorgen Bergstrom, Ph.D. PolymerFEM Administrator

          Comment


          • #6
            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

            Comment


            • #7
              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
              Jorgen Bergstrom, Ph.D. PolymerFEM Administrator

              Comment


              • #8
                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.

                Comment


                • #9
                  % 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
                  }
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

                  Comment


                  • #10
                    send email from matlab to gmail

                    Source: http://www.mathworks.com/support/sol...data/1-3PRRDV/

                    PHP Code:
                    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 emailNote that the first input is the address you are sending the email to
                    sendmail
                    ('an.example.email.address@gmail.com','Test from MATLAB','Hello! This is a test from MATLAB!'

                    Comment


                    • #11
                      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



                      Originally posted by Jorgen View Post
                      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

                      Comment


                      • #12
                        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:

                        Code:
                        import os
                        usub_lib_dir = os.getcwd()
                        del os
                        -Jorgen
                        Jorgen Bergstrom, Ph.D. PolymerFEM Administrator

                        Comment


                        • #13
                          it works perfectly.
                          Thanks so much Jorgen.
                          Tim

                          Comment


                          • #14
                            running abaqus input file with matlab

                            Hello Jorden

                            i am doing a project for truss optimization using abaqus and matlab but i dont know how to use abaqus input file in matlab. Please tell me abt the matlab code for the same. If you have any tutorial for this please send me the link for tutorial.

                            Comment


                            • #15
                              Hey, you spelled my name wrong!

                              I have no tutorial to share. If you want to use Abaqus inside Matlab, then you have to use a bunch of system commands.

                              -Jorgen
                              Jorgen Bergstrom, Ph.D. PolymerFEM Administrator

                              Comment

                              Working...
                              X