|
[Sponsors] |
July 6, 2010, 23:29 |
Mesh macro
|
#1 |
New Member
Hannow
Join Date: Nov 2009
Posts: 6
Rep Power: 17 |
Hi there,
I want to create JScript macro for Ansys Meshing [Fluid Flow] V12.1. So, does anyone knows any meshing scripting guidline? I've already generated Workbench journal code to automatically carry out the process of fluid flow simulation with FLUENT. However, this journal coding in Workbench won't record the operations in geometry creation and mesh generation. So, I had to generate JScript code for the geometry and embedded into the journal code. The only code left is for the meshing and have no idea of how to generate the code. So, if anybody have experience on this matter, please share it with us! Thank you very much for your help Hannow |
|
July 15, 2010, 22:53 |
Parametric and Persistent
|
#2 |
Senior Member
Simon Pereira
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,663
Blog Entries: 1
Rep Power: 47 |
You can't really script the ANSYS Meshing section... Rather, it is parametric and persistent. If you make a change to the geometry, the mesher will just generate a mesh with the same (persistent) settings on that new geometry and then pass the mesh to the solver.
The question is "what do you want to script?" If you are making changes to the geometry and want the meshing script to give you a mesh on that, parametric persistence will automatically update without a script. Most gambit users who want to script meshing are better off once they see the benefits of parametric persistence. At 13.0, the mesh parameters are also parametric and can be changed from the parameter set bar. This means you could use DX to run a refinement study, all without scripting. There are some things that require mesh scripting, although I can't really think of any right now (maybe if you want to specify the order of meshing steps?), so we are planning to add that sooner or later. |
|
July 16, 2010, 01:32 |
|
#3 | |
New Member
Hannow
Join Date: Nov 2009
Posts: 6
Rep Power: 17 |
Hi PSYMN,
Thank you very much for you reply, really appreciated Actually there is an option for the meshing application that allows to read macros from outside files like JScript files, which mean that it's possible to run the meshing process using scripts. My model is very simple, it's a duct with water flowing inside it. The geometrical parameters that need to be tested is the inlet and the outlet diameters. I don't want to go through the whole CFD process to run every single simulation for different diameters which time consuming, and that why I want to use journaling / scripting so that it can be run automatically by running the script after changing the parameters inside the script. I already manged to code the whole process with some help from ansys documentation except for the meshing. The meshing process I want to script is just renaming boundaries, assigning meshing parameters and then run the mesher. Till now, I'm still stuck at coding the mesh process, so if you have any idea of how to do it, let us know. Thank you very much for your sharing Hannow Quote:
|
||
July 16, 2010, 01:55 |
|
#4 |
New Member
Karan Anand
Join Date: Feb 2010
Posts: 23
Rep Power: 16 |
I don't know much about the workbench mesh-er and creating a macro for that. ICEM CFD can handle meshing with such parametric changes and meshing using replay scripts that you can record and play in batch mode if you want to do design optimization or implement other such routines. BTW macros in ICEM are called replay scripts.. if you go to help file, search for replay script and not macros, otherwise you will waste time just like me!!
|
|
July 16, 2010, 02:19 |
Ahead of the curve.
|
#5 |
Senior Member
Simon Pereira
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,663
Blog Entries: 1
Rep Power: 47 |
Yea, I am pretty familiar with ICEM CFD scripting, but you are already ahead of me (and most people) if you can script ANSYS Meshing.
The SDK (Software Development Kit) for workbench is due out soon after the R13.0 release. Until then, you are ahead of the curve. If you have access to tech support (techsupp@ansys.com), they may be able to ask development about your question. Simon |
|
July 16, 2010, 03:50 |
Thanks
|
#6 |
New Member
Hannow
Join Date: Nov 2009
Posts: 6
Rep Power: 17 |
Thanks guys for the info
|
|
March 19, 2011, 06:37 |
@Hannow
|
#7 |
New Member
Rohit Vasudevan
Join Date: Feb 2011
Location: Southampton
Posts: 9
Rep Power: 15 |
Hey I'm trying to write a script for workbench... I embedded the JScript into the journal.. But I'm having trouble creating surfaces and body operations on the geometry via the script... Could you help me out on that? And did you manage to get the mesher to run using the script?
Thanks for your help... |
|
August 17, 2013, 18:18 |
|
#8 |
New Member
Join Date: Aug 2013
Posts: 12
Rep Power: 13 |
Hi everybody...
I'm facing the same problem. I'm using WB to generate several meshes for Fluent. I've already created a journal file for WB that actualizes the geometry and calls a JScript for DM that selects the bodies and forms a single part. Now I just have to create a JScript for Meshing (or send a command through the WB journal) that exports the .msh file with the name I want... Any ideas of how could I do that?? |
|
August 18, 2013, 12:58 |
|
#9 |
New Member
Rohit Vasudevan
Join Date: Feb 2011
Location: Southampton
Posts: 9
Rep Power: 15 |
Hey ICS,
I did manage to get it working in the end. Its been a while since I've worked on ansys. I could take a look and see if I find the scripts. I could PM them to you if I do find them. Cheers. Good luck ! |
|
August 18, 2013, 14:18 |
|
#10 |
New Member
Join Date: Aug 2013
Posts: 12
Rep Power: 13 |
Thanks a lot rohit_8481.. If you can find the command that exports the .msh file from the Meshing it'll be very helpfull... it's the last command i need...
Here is the WB scripting code I wrote... It opens the DM and the Meshing in the begining, sends the JScript commands to DM (making it change the geometry file, select all bodies and form a single part), and updates the meshing... now I just have to sent the command to Meshing so that it exports the .msh file with the name I want... (the last two blocks of commands will be repeated for each mesh I have to generate) [CODE] system1 = GetSystem(Name="FFF") geometry1 = system1.GetContainer(ComponentName="Geometry") mesh1 = system1.GetContainer(ComponentName="Mesh") component1 = system1.GetComponent(Name="Mesh") geometry1.Edit() mesh1.Edit() geometry1.SendCommand(Command="""ag.m.NewSession (1); ag.gui.CreateImport ("C:............x_t"); agb.regen(); ag.gui.PickFilter(5, true); ag.gui.SelectAll(); ag.m.FormBodyGroup();""") component1.Update(AllDependencies=True) |
|
August 19, 2013, 08:15 |
|
#11 |
New Member
Join Date: Aug 2013
Posts: 12
Rep Power: 13 |
Finaly I managed to solve my problem... I couldn't find the command "export" for Meshing, but I'm using the phython command "os.rename()" to change the name of the FFF.msh file generated automaticaly when I update the meshing... The final WB script code became:
system1 = GetSystem(Name="FFF") geometry1 = system1.GetContainer(ComponentName="Geometry") mesh1 = system1.GetContainer(ComponentName="Mesh") component1 = system1.GetComponent(Name="Mesh") import os geometry1.Edit() mesh1.Edit() geometry1.SendCommand(Command="""ag.m.NewSession (1); ag.gui.CreateImport ("C:/...................x_t"); agb.regen(); ag.gui.PickFilter(5, true); ag.gui.SelectAll(); ag.m.FormBodyGroup();""") component1.Update(AllDependencies=True) os.rename("C:/................/dp0/FFF/MECH/FFF.msh","C:/............msh") |
|
August 29, 2013, 08:29 |
|
#12 |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Hello ICS and others,
I have found a way to export the mesh per script in any given format ansys meshing can export. You can take a look here to see what i have found http://www.cfd-online.com/Forums/ans...ia-script.html Greets Nigirim |
|
September 8, 2013, 20:40 |
|
#13 |
New Member
Join Date: Aug 2013
Posts: 12
Rep Power: 13 |
Thanks for your help Nigirim !!!
|
|
September 30, 2014, 15:23 |
New to ansys meshing
|
#14 |
New Member
Bing Wang
Join Date: Sep 2014
Posts: 2
Rep Power: 0 |
Hi everyone
I have a similar problem that seems already solved by you guys. Does anyone want to share some clues? My problem is how to operate meshing by script. Basically I wonder how can I select faces and set sizing number and mesh in the end. It seems that we can do it with JScript instead of journal. If so, where can I find documentation about JScript for Meshing? Thank you all. |
|
November 6, 2014, 23:56 |
|
#15 | |||
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi IcyKing06,
You have to first find out Partid and topoid and then use forceselect to select faces Quote:
Quote:
Quote:
Cheers Kapi |
||||
November 10, 2014, 15:52 |
AutoMeshing in ANSYS WorkBench
|
#16 |
New Member
Alex Horlock
Join Date: Nov 2014
Posts: 1
Rep Power: 0 |
Dear All,
We are a pair of university students who have spent a bit of time on this subject and also found the lack of documentation disappointing. The good news is it is certainly possible and easy(ish) once you know how, but just difficult to get the syntax right... A good starting point is this Thesis by Bhanoday Reddy and Rainel González Brioso http://liu.diva-portal.org/smash/get...162/FULLTEXT01 Their Appendix 2 pretty much covers the process. Watch out for the semi-colons which we don't think do anything/ stop the program running. Thanks for all the help from above, hope this adds to the knowledge. Cheers |
|
October 8, 2015, 14:33 |
|
#17 |
Member
Max
Join Date: May 2015
Posts: 48
Rep Power: 11 |
Hi,
does anybody know how to change the transiition in Workbench mechanical/Mesh into "slow"? I tried this one, but I think the problem is the name of the "transition" feature: Code:
var SelMesh = DS.Tree.FirstActiveBranch.MeshControlGroup; DS.Script.changeActiveObject(SelMesh.ID); SelMesh.TransitionSF.ItemValue = "Slow"; Code:
DS.Script.doInsertMeshSize(); ListView.ActivateItem("Bias Type"); ListView.ItemValue = "3"; I hope somebody can help me out! Best regards Max |
|
November 15, 2015, 20:50 |
|
#18 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Max,
this will work! in quotes it means the value, without quotes pick the (listno - 1) to get desired list number. Code:
DS.Script.doInsertMeshSize(); ListView.ActivateItem("Bias Type"); ListView.ItemValue = 2; Kapi |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
engrid -> save as .stl with boundarie codes | Zymon | enGrid | 31 | August 29, 2011 14:40 |
[ICEM] Hexa Mesh Smoothing | Jules | ANSYS Meshing & Geometry | 6 | December 4, 2010 19:00 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |
basic of mesh refinement | arya | CFX | 4 | June 19, 2007 13:21 |
Y - pipe mesh gene. macro? | Anne Rasmussen | Main CFD Forum | 0 | June 14, 2002 09:21 |