CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS

Run Ansys Journal Files in an opened Workbench from an external Python Script

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2022, 06:38
Default Run Ansys Journal Files in an opened Workbench from an external Python Script
  #1
New Member
 
Join Date: Dec 2022
Posts: 2
Rep Power: 0
LStar is on a distinguished road
I am trying to run multiple Journal (.wbjn) Files in an opened, already prepared workbench project from an external Python script.

In my Python script i can open the workbench project with the following commands:

ANSYS_exe_path = r'[Ansys Path]/runwb2.exe'
Project_path = ' -I -F [Project Path]/Project.wbpj'
subprocess.Popen("%s %s" % (ANSYS_exe_path, Project_path))

I tried to open the Journal with the following commands:

Journal1_path = '-I -R [Journal Path]/Journal1.wbjn'
subprocess.Popen("%s %s" % (ANSYS_exe_path, Journal1_path))

but with this command it will open a new empty workbench and tries to run the journal there, which results in a error because the journal is specific to the prepared workbench file.

I can also add the commands to open the specific workbench to the journal file. Then it opens the workbench and runs the journal.
This works but because i want to run multiple Journals and can not open the workbench everytime i can not use this way.

So my question is how to open a journal file from python in a specific already opened workbench?
LStar is offline   Reply With Quote

Old   March 24, 2023, 14:10
Default
  #2
New Member
 
Nesvik
Join Date: Mar 2023
Posts: 1
Rep Power: 0
Nesvik is on a distinguished road
Hi Lstar, did you have any luck regarding this? I am stuck at the same stage.
Nesvik is offline   Reply With Quote

Old   March 27, 2023, 03:42
Default
  #3
New Member
 
Join Date: Dec 2022
Posts: 2
Rep Power: 0
LStar is on a distinguished road
unfortunally not exactly, i have found one way that works for my problem though.

The way i did it was with the following python commands:

ANSYS_exe_path = r'<ANSYS PATH>/runwb2.exe'

Update_path = '-X -R ' + <PATH TO THE JOURNAL>/runUpdate.wbjn'

p = subprocess.Popen("%s %s" % (ANSYS_exe_path, Update_path))
p.wait() #waiting for the process to conclude

This subprocess will run the workbench journal "runUpdate.wbjn".


The Journal "runUpdate.wbjn" will do two things:

1. Open the desired Workbench Project that i want to change, with the following command:

Open(FilePath="<FilePath>/Design.wbpj")
...

2. Run a Journal that is specified for this Workbench Project with the following command:

RunScript(FilePath="<FilePath>/FullUpdate.wbjn")


When the Journals are finished the Ansys Workbench will close itself again so make sure that you include a save command at the end.
LStar is offline   Reply With Quote

Reply

Tags
ansys workbench, journal file, python


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ANSYS Workbench on "Uncertified" Linux Distros hsr CFX 289 April 20, 2023 10:23
Export GLTF/GLB files via python script claudio standteiner EnSight 0 September 21, 2022 10:32
A CFX-POST error (ver 14.5.7) wangyflp88 CFX 2 July 22, 2017 01:17
FLUENT installation on UBUNTU 12.04 (LTS) teymourj FLUENT 2 March 1, 2017 23:24
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 04:01


All times are GMT -4. The time now is 15:05.