How to create Python scripts automatically using

Поделиться
HTML-код
  • Опубликовано: 10 окт 2024
  • ХоббиХобби

Комментарии • 47

  • @Potentflowconsult
    @Potentflowconsult 2 года назад +4

    Thanks again. Just to add, shift+tab will remove the indentation when editing the script...7:30, also you can write
    from abaqus import *
    from abaqusConstants import *
    from caeModules import *
    to get rid of all the import statements and reduce the line of codes. You could also initialize all the dimensions and mesh sizes to parameterize them. Thanks always for your videos

    • @MichaelOkereke
      @MichaelOkereke  2 года назад +3

      Hello @Jide Williams, thanks for the comments. You are absolutely right. I didn't want to go into anything complex but your comments are correct. Thanks.

  • @niyomukizajohnbosco1108
    @niyomukizajohnbosco1108 Год назад +1

    Dear Dr. Okereke, thanks a lot for sharing your knowledge. This tutorial is helpful to me.

    • @MichaelOkereke
      @MichaelOkereke  Год назад

      Glad you liked it.

    • @nabilbounou1663
      @nabilbounou1663 Год назад

      @@MichaelOkereke Hello, can you help me how draw a lot of holes on the plate by script python

  • @amrounesalah8706
    @amrounesalah8706 2 года назад +1

    Thanks a lot for sharing the video.thanks from Algeria.

  • @marel7119
    @marel7119 4 месяца назад +1

    Hello Dr. Michael, thank you for the very good content on your youtube channel.
    I was automating a model on Abaqus, and when I reached the part of reading the results from the .odb file, I encountered the following error message:
    ```
    from odbAccess import openOdb
    ModuleNotFoundError: No module named 'odbAccess'
    ```
    Is there a possibility to analyze the .odb file directly from Python? I am running Abaqus jobs in batches and do not want to open every .odb file in an Abaqus CAE window and run the Python script there.
    Thank you in advance, and I look forward to your response.

    • @MichaelOkereke
      @MichaelOkereke  4 месяца назад +1

      Hello,
      This is certainly possible. In fact ABAQUS documentation has an example which you can adapt for your case. Here is the link to the example: classes.engineering.wustl.edu/2009/spring/mase5513/abaqus/docs/v6.5/books/cmd/default.htm?startat=pt01.html
      You may have to consider this:
      from odbAccess import openOdb
      odb = openOdb('job_name.odb')
      I think it is possible to analyze .odb file directly from the ABAQUS command window. I am not sure about running it directly inside Python - but if so, then you do need to import the right object files, which it seems to me this is what is happening with your error.
      I suggest you run it inside the ABAQUS command window or the ABAQUS kernal window (located foot of ABAQUS CAE page). This way, ABAQUS already has the object files like the odbAccess, so you do not have to worry about them. If you run inside Python, you will have to worry about where they are and bring them in.
      I hope you are able to do it.

    • @marel7119
      @marel7119 4 месяца назад +1

      @@MichaelOkereke Thank you for your response Sir. Actually, I was able to extract the results and complete the entire process outside of Abaqus using just the external Python interpreter. I used the following command:
      command = sprintf('abaqus python extract_results.py %s', odbFile);
      [status, cmdout] = system(command);
      Instead of just "python extract_results.py", and everything worked perfectly

    • @MichaelOkereke
      @MichaelOkereke  3 месяца назад

      I am happy to see that it all worked out well. Well done and keep it up.

  • @amrmasoud5580
    @amrmasoud5580 7 месяцев назад +1

    Dear Dr>>Thanks >>great Video>> Please tell me how to use this concept(modify the python file ) to define the bond slippage between steel bars and concrete (embedded in concrete), suppose the existing interaction between both is fixed?

  • @alisayadi2511
    @alisayadi2511 Год назад

    Thanks alot for your great video.👏👏👏

  • @davidgonzaleznino5914
    @davidgonzaleznino5914 2 года назад +1

    Hi Dr. Okereke.
    Thanks for these amazing and helpful videos! I have a question related to creating Sets (Type: Node) using python script. I want to create sets (Type:node) for specific nodes. I have their label and coordinate. How can I create these Sets using either the node coordinate or label via script? I tried to use Macros, but I don't understand it. This is what the Macros shows:
    nodes1 = n1.getSequenceFromMask(mask=('[#0:2 #2 ]', ), )
    a.Set(nodes=nodes1, name='left_3')
    Is there any way that I could use the coordinate or label to create these sets?
    Thanks and good luck!

    • @MichaelOkereke
      @MichaelOkereke  2 года назад

      Hello David, I think this is possible. It is about understanding the right commands to use in Python to extract the mesh array that will help you assign the required coordinates to the nodal set you mentioned. The use of macros in this instance will simply help you understand the sequence of Python instructions that can lead to a possible solution but the key problem is 'getSequenceFromMask'. It is a user-intervention command rather that truly being automated as you would. I will not go with that. I will rather investigate this further. I have not given much thoughts to it but I cannot see why this is not possible. Good luck with your research into this problem, does sound interesting.

    • @davidgonzaleznino5914
      @davidgonzaleznino5914 2 года назад +1

      @@MichaelOkereke Thanks for your help and comment. I rally appreciate it! Have a great day.

  • @rakshithbdgowda5048
    @rakshithbdgowda5048 2 года назад +1

    Nice video, I am a new joiner. Can you share any info. on how to create a parametric study in a loop. And how to take a stress and strain of a specific node without manual interruption in GUI.
    THanks in advance.

    • @MichaelOkereke
      @MichaelOkereke  2 года назад +1

      Hello @Rakshith B D Gowda, thanks for joining. Welcome to the CM Videos family. Please see other videos on the channel as you may find them helpful too.
      1. On Parametric study within ABAQUS, this will be added to my to-do ABAQUS tips and tricks video. I think it will definitely be helpful to many so I will consider making such a video in future.
      2. For the second query on a non-GUI based interpolation of ABAQUS data (I suppose you mean based an output databas file), this is something I have thought about in the past. I have a few videos on my ABAQUS Tips and tricks playlist which address plotting stress versus strain plots from simulations but all of them are GUI-based. I have always wanted to make one more video with a non-GUI base which will be probably done using a Python script. I will note this request and see if I can do such a video in future.

    • @rakshithbdgowda5048
      @rakshithbdgowda5048 2 года назад +1

      @@MichaelOkereke Thank you for your reply sir. Have a nice day..

  • @MuhammadAbdullah-mf7ul
    @MuhammadAbdullah-mf7ul 2 года назад +1

    Thankyou
    Dr. Michael. Could you help me in writing script for .step file from solidworks which is to be imported into Abaqus so that I could perform Parametric optimization in Isight Module? Would be really thankful to you for this

    • @MichaelOkereke
      @MichaelOkereke  2 года назад

      Hello Muhammad, this sounds like a lot to do I a single video. I am not be able to help with the query. Can you simplify what is requested here so I can consider if there is any merit in doing a video about it?

  • @김성현-m5n
    @김성현-m5n Год назад +1

    당신은 대학원생들의 신이야

    • @MichaelOkereke
      @MichaelOkereke  Год назад

      I do not understand... seems this is Korean! Whatever it is, thanks for the comment.

  • @davidgonzaleznino5914
    @davidgonzaleznino5914 2 года назад +1

    Hi Dr. Okereke;
    How do I obtain a triangular mesh by scripting?
    Thanks in advance.

    • @MichaelOkereke
      @MichaelOkereke  2 года назад

      Hello @David, I think you can do so by following the strategy of this video. Setup up a macro and create a triangular mesh on a model. Then from the resulting macro-created python script, you can see the commands for automatic creation of a triangular mesh. Then repeat this in your code. I hope this helps.

  • @sothunchhaer
    @sothunchhaer Год назад

    Hello Dr. Michael Okereke
    Thanks for the video. And I want to know how can we export or convert from the existing ABAQUS file to the Python scripting file?

    • @MichaelOkereke
      @MichaelOkereke  Год назад

      Hello @Sothun, normally it is the other way round. You get a python script to create an ABAQUS file. If you already have an ABAQUS file, you might not easily create a python script with that. What I tried to show in this video is that you can record a macro file when carrying out an ABAQUS model setup which you can subsequently use to recreate the model. Also, if you did not do so, then check in the folder where your job is saved and you will see a Journal file (*.jnl) which you can use to recreate the model. This is a feature of ABAQUS but not available with a student license ABAQUS.

    • @sothunchhaer
      @sothunchhaer Год назад +1

      @@MichaelOkereke So could I get the Python scripting file after if I use the Journal file (.jnl) to recreate the model?

    • @MichaelOkereke
      @MichaelOkereke  Год назад

      Yes indeed, the *.jnl file is essentially a python script.

    • @sothunchhaer
      @sothunchhaer Год назад

      @@MichaelOkereke And when I use *.jnl file to recreate the model then do I have to record the Macro as what you have done in the video right? By the way, how can I run the *.jnl file in the ABAQUS?

    • @MichaelOkereke
      @MichaelOkereke  Год назад

      Hello @sothun, you run the *.jnl file by opening ABAQUS CAE and then File > Run script ... and from the pop up window, navigate to where the *.jnl file is and select it and click Ok.

  • @muhammadawaismalik-x4m
    @muhammadawaismalik-x4m 10 месяцев назад +1

    HELLO DOCTOR HOPE YOU ARE DOING GREAT . DOCTOR CAN YOU MAKE A 6 STORY BUILDING WITH STEEL PLATE SHEAR WALL ON IT AND PERFORM TIME HISTORY ANALYSIS.

    • @MichaelOkereke
      @MichaelOkereke  10 месяцев назад +1

      Hi, I do not make this sort of videos. It looks like a project (complete) in itself. Good luck with the research.

  • @JimCramer-h8b
    @JimCramer-h8b Месяц назад

    hi, can i use a hyperfoam material in the python script which is based on 2000 test data? it seems like it is not possible to link the json file into .py-data and run in abaqus. do i have to dump the test data in the .py data to run in abaqus? or is running the script with noGUI-Task directly in python an option as well? How would you define the hyperfoam material? Do you have any documentation i can take a look into?
    greetings!

    • @MichaelOkereke
      @MichaelOkereke  Месяц назад

      I do not have much experience to be able to offer any help.

  • @khelladidouaa1017
    @khelladidouaa1017 10 месяцев назад +1

    Hi Pr I didn`t understand what we need to do in 7:09 to delete that space

    • @MichaelOkereke
      @MichaelOkereke  10 месяцев назад

      Please see the Pinned comment (at the top of the comments section) where a commenter on this video stated how to removed the spaces different from my method.
      It involves (on Windows) using the Shift+Tab option. Just put your cursor where the space is and press Shift+Tab and it will delete the space automatically. Of course, if you want to select all the spaces at once, then use the method I showed but with deleting, you can use the Shift+Tab option. Please try that!

  • @miguelangelcastilloheras8389
    @miguelangelcastilloheras8389 2 года назад +1

    hello
    i have an inp file
    what I am looking for is with a Python command, the abaqus open the file and simulate it
    how can I do this?

    • @MichaelOkereke
      @MichaelOkereke  2 года назад

      hELLO @Miguel, I am not sure if I understand your query correctly. Python is used to command ABAQUS to do things for you, so it seems to me you will have to get a Python code to determine what you intend to do.

    • @miguelangelcastilloheras8389
      @miguelangelcastilloheras8389 2 года назад +1

      I have a Python script with everything needed to simulate a theoretical scenario. What I am looking for is to automate the process with Python, so that it does different simulations for me by varying some parameters. That's why my question is: having the python script already complete, how can I program in Python in such a way that when executing the code, the script is simulated. I understand that the code to call abaqus in Python is abq2019 job=name.inp -double -int

    • @MichaelOkereke
      @MichaelOkereke  2 года назад

      Hi @Miguel, now I understand. It sounds like you need to do a nested script with your main complete script called by another script. It is possible you make the first script a function which will be called by the running/simulation script.
      Alternatively, since what you really want to do is to automate the process, if you are running it on say a UNIX platform, you can use a shell script to batch the running operation. I have done this in the past.
      If this will help, here is the snippet of code that you can put at the end of your script for submitting the job to run automatically. I have done this with a model of mine called: "HexagonalModelUpdated_UniaxialX", just replace it with your model name:
      #-------- Submit job for running --------
      mdb.Job(name='HexagonalModelUpdated_UniaxialX', model='HexagonalModelUpdated',
      description='', type=ANALYSIS, atTime=None, waitMinutes=0, waitHours=0,
      queue=None, memory=50, memoryUnits=PERCENTAGE,
      getMemoryFromAnalysis=True, explicitPrecision=SINGLE,
      nodalOutputPrecision=SINGLE, echoPrint=OFF, modelPrint=OFF,
      contactPrint=OFF, historyPrint=OFF, userSubroutine='', scratch='')
      mdb.jobs['HexagonalModelUpdated_UniaxialX'].submit(consistencyChecking=OFF)

  • @ميكانيك-ف5ت
    @ميكانيك-ف5ت 2 года назад +1

    Thanks but how to convert inp file ton cae file

    • @MichaelOkereke
      @MichaelOkereke  2 года назад +1

      Hello @Benmeddour Amor, thanks for your interest in the channel. I do not think it is possible to create a **.CAE* file from a **.inp* file. The INP file is just a list of instructions for the FEA solver to use in creating the solution. It does not have the capacity to genate CAE files. You can however, open the INP file in ABAQUS by importing it as a Model. This will create an orphan mesh which you really cannot edit.
      However, here is a video by another excellent Computational mechanics guy which shows how you can change orphan mesh into a model. YOu can then take the model and re-mesh it into what you want. Here is the link: ruclips.net/video/y5U_Xa_yMlQ/видео.html

    • @ميكانيك-ف5ت
      @ميكانيك-ف5ت 2 года назад

      Thanks very much