CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSYS Meshing & Geometry (https://www.cfd-online.com/Forums/ansys-meshing/)
-   -   [ANSYS Meshing] Automatic mesh generation by batch file (https://www.cfd-online.com/Forums/ansys-meshing/123743-automatic-mesh-generation-batch-file.html)

nealrm September 19, 2013 17:36

Automatic mesh generation by batch file
 
I currently have a parameterized geometry and mesh file in work bench that I change the parameters on to run multiple cases. I would like to instead have a batch file that generates the geometry and mesh for me with named selections that can be imported by another batch file into a CFX Pre and run by command lines in a third batch file.

I have a starting point to look at the coding for the Pre and solver batch files because i can use the command line editor in Pre. I am somewhat lost as to where to find information on generating geometry and mesh from a batch command. Any suggestions where to look or directions to some appropriate guides would be appreciated.

Nigirim September 20, 2013 02:28

Hello Neal,

I don't know if you have found this site, that describes how to work with workbench and excel. http://www.padtinc.com/blog/the-focu...el-with-python

You can use the same technique using batch files. But working with parameterized geometry and mesh i prefer using excel.

If you want to automatize the generation of Mesh and Geometry from the scratch you will have to use JScript for Designmodeler and Mesher, which is barely documented.
Regardless if you just want to change your parameters, update your geometry and mesh, export it as .meshdat and start the simulation you can use the IronPython from Workbench, which is documented in the ANSYS help.
If you want to export it in the mesh in another format please take a look here http://www.cfd-online.com/Forums/ans...ia-script.html

Greets
Nigirim

Vidyanand Kesti September 20, 2013 08:11

paramtrci model is easy Design model becuase it directly linked with excel or you can make parmetric model easily,if its prameter in CAD geometry then A complier is require to transfer the parameter from CAD to Design modeler,Even ANSYS mesh also content the parametric mesh (like size fuction ),even you can parmeter in FLUENT for BC

nealrm September 23, 2013 13:28

The way i understand the link you provided it requires workbench already being open and i start doing things in workbench. This will not work for what i need. I need to have a third program start workbench or the individual components and pass information to them to update to a new geometry and mesh file. Using excel shouldnt be an issue but im not sure how to have my third program start the journal file/script execution in workbench.

(the third party software is called Isight by 3DS and is being used for optimization)

Nigirim September 24, 2013 12:15

Hi nealm,

you can start Workbench via batch file, load a workbenchproject and run a script.
Code:


  retval = Shell(“C:\Program Files\Ansys Inc\V130\Framework\bin\win64\runwb2 \
           
-X -R updateWB2.py -F ExcelTower1.wbpj”, vbNormalFocus)
  End Sub

This is from Visualbasic but I think it should work for batchfiles too.

-F PATH should open a workbenchprojectfile,
-R PATH should run a journal or pythonscript after workbench is started
-X closes Workbench and all other Workbenchapplications if the journal or pythonscript is done.

The pythonscript can open and close every Workbenchapplication, update the project and all the other stuff Workbench is able to do.
Regarding Python or journals, this is documented in ANSYS Help.

If you want to change something in Designmodeler or the Mesher you need to use JScript macros for those two, this is not documented by ANSYS.

Hope this helps
Greets
Nigirim

Kapi April 1, 2014 18:59

Hi Nealrm,

You can create a batch file and run the following code

"C:\Program Files\ANSYS Inc\v130\Framework\bin\Win64\RunWB2.exe" -I -R file_name.wbjn

Once you run this .bat file, it will open up a new project, go into your directory and run the specified .wbjn file you want.

Hope this helps
Cheers
Kapi


All times are GMT -4. The time now is 00:02.