General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Running the system sequentially

    • pavankonchada123
      Subscriber

      Hi Ansys Team,

               I am able to run the ansys static structural with journal commands, but I want to run 2 to 3 systems in a sequential manner. So how can I modify my journal file so that one system is run will be followed by next system run.

      SetScriptVersion(Version="22.2.192")
      template1=GetTemplate(TemplateName="Static Structural",Solver="ANSYS")
      system1=template1.CreateSystem()
      geometry1=system1.GetContainer(ComponentName="Geometry")
      geometry1.SetFile(FilePath="C:/Users/cadfem/Downloads/Geom.agdb")

      modelComponent1 = system1.GetComponent(Name="Model")
      modelComponent1.Refresh()
      model1 = system1.GetContainer(ComponentName="Model")
      model1.Edit(Interactive=False)
      DSscript = open("D:scrt.py", "r")
      DSscriptcommand=DSscript.read()
      DSscript.close()
      model1.SendCommand(Language='Python', Command = DSscriptcommand)
      ######
      system2=template1.CreateSystem()
      geometry2=system2.GetContainer(ComponentName="Geometry")
      geometry2.SetFile(FilePath="C:/Users/cadfem/Downloads/Geom.agdb")

      modelComponent2 = system2.GetComponent(Name="Model")
      modelComponent2.Refresh()
      model2 = system2.GetContainer(ComponentName="Model")
      model2.Edit(Interactive=False)
      DSscript = open("D:scrt.py", "r")
      DSscriptcommand=DSscript.read()
      DSscript.close()
      model2.SendCommand(Language='Python', Command = DSscriptcommand)

       

      On executing the above journal both system are running at a time, Please help

      Can the GetSimulationResultFile() helps the journal file to wait until one system run is done

    • Aniket
      Forum Moderator

      Hi,

      I am not sure what are the contents of the D:\script.py but you can remove all the solve commands from it, and update the system one by one in the Workbench page to achieve what you want.

      You can also record this operation in journal file.

      -Aniket

      How to access Ansys help links

      Guidelines for Posting on Ansys Learning Forum

    • pavankonchada123
      Subscriber

      Script file includes procedure such as imorting,assigning boundaries and post processing. And if I record the journal file and read it all the systems will try to run at same time right. I want to get them updated in sequential format (like update all design points) in workbench.

    • pavankonchada123
      Subscriber

      So any advice that how I can achieve this with reading script file for each system and runing the systems sequentially

    • Aniket
      Forum Moderator

      Hi like I mentioned, exclude all the commands that update or solve the project. You can add all the BCs and post-processing objects only (do not solve or evaluate anything in the DSscript)

      i.e. after model1.SendCommand(Language='Python', Command = DSscriptcommand)

      you may need something on the lines of:

      resultsComponent1 = system1.GetComponent(Name="Results")
      resultsComponent1.Update(AllDependencies=True)

      and then you will continue with second system in similar fashion. So the first system will update first and then second will be updated later from workbench page.

      -Aniket

      How to access Ansys help links

      Guidelines for Posting on Ansys Learning Forum

    • pavankonchada123
      Subscriber

      HI Aniket,

      With out manual intervention I want all the systems through single journal file. But wnen I do this all the system are running at same time. Is there any method to stop workbench from going to second system until first system is completed (automatically)

    • Aniket
      Forum Moderator

      The code in the journal is executed line by line. So until

      resultsComponent1.Update(AllDependencies=True)

      is executed fully, it will NOT go to 

      resultsComponent2.Update(AllDependencies=True)

      for a better understanding of this, remove the sendcommand from your code and try updating the model. You will see the mesh of the first system is generated first (obviously it won't solve after that due to lack of BCs) and the mesh of the second system is generated AFTER the generation of the first system. You can add print() messages in your code to verify that.

      -Aniket

      How to access Ansys help links

      Guidelines for Posting on Ansys Learning Forum

       

Viewing 6 reply threads
  • The topic ‘Running the system sequentially’ is closed to new replies.