Script for Ansys meshing
Hi
I am working on the optimization of a heat transfer system. I will couple an optimization code (developed in matlab) with a heat transfer system model (developed in ansys workbench). I have already developed a Workbench journal code to automatically carry out the process of fluid flow simulation with FLUENT. However, the Ansys meshing is not accessible through the Workbench journal code. I have to develop a jScript code to modify the mesh parameters (sizing, inflation), but i didn't find any information in Ansys meshing guide. Could you help me please to develop this JScript code. Could you send me an exemple if you have? Best Regards |
Hi Riadh,
Welcome to forum. You have to create a .JS file for mesh which you can access from the .WBJN file. In that .js file you can make function for sizing or inflation like this... For sizing: Code:
ds.Script.doInsertMeshSize(); // command for adding new Sizing Function the function and its parameters can be accessed my "Listview" once you have the function by which it is called. In this case it was "DoInsertMeshSize()" Similarly For Inflation you have the below function and you can add its parameters by "Listview" just like above depending upon your requirement. Code:
ds.Script.doInsertInflation(); You can search CFDonline and check Ansys Portal as well for such codes. Hope it helps Cheers KAPI |
1 Attachment(s)
Dear Kapi
Thank you for your reply, it is very helpful!! I am looking if there is a command to expand the Sizing group of controls (clicking the “+” sign to the left of the word Sizing) and change for example the Curvature Normal Angle (see attached figure). I tried ListView.ActivateItem("Sizing") but i didn't work. Best Regards! |
Hi Riadh,
What you are asking is global Sizing under mesh. What I told you in previous post is actually Sizing function which you can get by right click mesh and it will open up different functions which you can add to your geometry like Sizing, methods, inflation and things ( Mesh>Insert>Sizing) If you are looking for localized sizing function then please insert sizing function rather than changing the global sizing and use the code which I gave you. ps: to get into Mesh global setting you cannot use Listview, you need different function. Cheers KAPI |
Dear Kapi
I agree with you, actually I am looking for the function which changes the global sizing (not the localized sizing function). Do you know this function, it's the last command i need. Riadh |
Hi Riadh,
Yes I can help you with global function as well. Basically for global changes, you need to function called "meshGroup" It helps in listing all the global properties of mesh. The below code changes global mesh minimum sizing and Maximum sizing. Code:
meshGroup.MinSizeSF = 0.01; Hope it helps complete your project. Have a good one! Cheers KAPI |
I know this thread is over a year old but I did find a way in 16.1 to use ListView for setting global mesh parameters. By searching through various .js files and Ans.Common.ControlsCOM.dll, I found that you need to select the group first and then use the 'Expand' property. Then you can just use ListView.ActivateItem and ListView.ItemValue like usual.
In this example I changed the Physics Preference, Relevance Center, Max Face Size, and Growth Rate options. It looks like ListView.FindGroup(n) returns the groups in the order that they appear ('Display' first, 'Defaults' second, 'Sizing' third, and so on). I hope this can be of help to someone. Code:
//Get DesignSpace object |
mesh a geometry via script sizing and worksheet for multizone
Dear All
Due to your knowledge in anys and scripting I suppose you are the right person to ask this question... I'm trying to automate the meshing of a geometry by using a conformal mesh. To do so manually, I sliced the domain into several blocks. 1)Defined several named selection 'via worksheet options" 2)defined several sizing controls referred to previuos defined named selection. 3)Applied Multizone Method to all bodies 4) Defined a worksheet for meshing in precise order Any suggestion on how to do the same via scripting? Kind regards |
Does anyone know how to get all the functions that can be added after Ds.Script?
|
Quote:
|
Calling Js File from Workbench file
Once you have developed the .JS file for controlling your meshing parameter how do I call it from the workbench file or the ANSYS command window?
Does anyone have an example of there workbench code? |
I know this post is old but did you ever work out this process ?
|
All times are GMT -4. The time now is 06:15. |