General Mechanical

General Mechanical

Workbench execution failure from Jupyter notebook

    • josemishael
      Subscriber

      Hi,

      I have a workbench project which is executed from a Jupyter notebook. The input parameters for the workbench file is written by the notebook and call to the workbench project is made using the python function subprocess.run(). The entire process is placed in a 'for' loop. The simulation was running without any issues until one of the FE simulations ran out of memory and I had to force stop it. I restarted the simulation from avoiding the particular input which created memory shortage. Now the simulation is not entering the solving phase (At least this is what I understood from looking at the time frame) and exiting before producing the output. I am using ANSYS 2022 R2 Academic version. Things I did to rectify the problem:

      1. Opened Workbench and removed the "file locked" condition.
      2. Try to run the workbench project from windows command prompt with the input file (created by Jupyter notebook) - Successful simulation
      3. Reduced the number of cores from 10 to 8 to see the influence of memory. I have maximum 64GB availabile for the simulation - No change if I run from Jupyter notebook. But successful from windows command prompt.
      4. Changed solver from distributed to iterative - No change with Jupyter notebook
      5. Checked ANSYS license manager - It is running without any problem. No logs of license lose during simulation.

      I am using Python 3.8.8 to run my Jupyter notebook. The python function from my Jupyter code is

      def simulation():
          # Location of file containg ANSYS workbench executable
          cmd = ".../Framework/bin/Win64/RunWB2.exe"
          # Location of file containg ANSYS workbench journal
          input_file = ".../Plate.wbjn"
          start = time.time()
          # Run the simulation in batch mode
          subprocess.run([cmd,'-B','-R',input_file], shell=True)
          end = time.time()
          print(end-start)
       
      I was successfully completed approximately 1500 simulations with my code. The problem started as soon as I force stopped my simulation and restarted. My understanding is that python is failing to open MAPDL solver. 
       
      Can you shed some light on potential solutions for the problem?
       

       

    • mjmiddle
      Ansys Employee

       

      Ansys doesn’t support Jupyter Notebook, and I’m not sure what it is. It looks like a web based operating system emulator.

      On Windows I would suggest resetting the Ansys cache back to default. This would mean deleting or renaming %APPDATA%\Ansys\v222 while workbench is closed. The next time you launch it will recreate the cache with all defaults. I don’t know where this would be located through Jupyter Notebook, but %APPDATA% locates the user login directory in Windows:

      C:\Users\{login}\AppData\Roaming

      You can also delete the file.lock in the workbench project’s solution directory for the system being solved, if you think the APDL solver is not launching due to the previous crash. This really shouldn’t exist in the workbench solution directory. It would be in a temporary solution directory, such as _ProjectScratch in a parallel location with the workbench project. But even this folder has subdirectories created new for each solution so a file.lock would not limit the APDL solver from running.

      I assume your Plate.wbjn loads or creates a workbench project and does the update command to start the solution?

       

Viewing 1 reply thread
  • You must be logged in to reply to this topic.