Ansys Products

Ansys Products

Discuss installation & licensing of our Ansys Teaching and Research products.

ansys rocky prepost

    • user deleted
      Subscriber

      I want to do the following:

      Through Rocky PrePost, start a simulation for 20 seconds.
      total_time = 20, but pause the simulation every 4 seconds and perform a certain operation.
      stop_time = 4

      # Describing the study
      study = project.GetStudy()
      study.SetName('My Simulation')
      study.SetDescription('My DEM Simulation')
      study.SetCustomerName('My Customer')
      study.DeleteResults()

      # Solver.
      solver = study.GetSimulatorRun()
      solver.SetSimulationDuration(total_time, 's')
      solver.SetTimeInterval(0.25, 's')
      solver.SetUseCompressedFiles(True)
      solver.SetSimulationTarget('CPU')
      solver.SetNumberOfProcessors(20)

      study.StartSimulation(skip_summary=False, delete_results=True)

      While True:
          current_time_step = GetTimeStep('current').GetTime()
          if current_time_step % stop_time == 0:
              StopSimulation()
              print("stop.")
              break
              study.StartSimulation(skip_summary=False, delete_results=False)

      I understand that there are many errors here, but the main idea is as follows: there is a simulation - a total of 20 seconds. Every 4 seconds, it needs to be paused, perform 'block 1', and then resume the simulation. Can you advise how to implement this?

    • Rob
      Forum Moderator

      It'll be an API operation, so check that part of the documentation (in with the Ansys DOC as of 2024R1). Not sure why you want to delete the data every 4 seconds? 

    • user deleted
      Subscriber

      Not certainly in that way

      I want to run the calculation for 20 seconds

      but stop the calculation every 4 seconds
      (upload some data)
      continue calculation

      and so on

      I actually can't solve the problem

      how to put  in "t_1" variable
      current calculation time value

      and check if necessary (multiples of 4) then stop the calculation, perform the action, continue the calculation

      if you can tell me how to implement something like this, or where there might be an example
      I will be very grateful
      I looked at the Rocky prepost manual until I found answers to my questions in it.

      thank you in advance for your help

    • Rob
      Forum Moderator

      I can't cover APIs on the public forum as they're generally very specific. I'll check for examples, but suspect there won't be much we can do. 

    • Rob
      Forum Moderator

      And having heard back. It's not available via the API at present, but pyRocky may work if you use threads. Check the Ansys GitHub for examples/ideas - we can't offer much assistance here. 

Viewing 4 reply threads
  • The topic ‘ansys rocky prepost’ is closed to new replies.