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

[ANSYS Meshing] Script for Ansys meshing

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By Kapi
  • 1 Post By Kapi
  • 4 Post By samiam

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2015, 03:30
Default Script for Ansys meshing
  #1
New Member
 
Riadh
Join Date: Feb 2015
Posts: 3
Rep Power: 11
Riadh is on a distinguished road
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
Riadh is offline   Reply With Quote

Old   February 22, 2015, 20:00
Default
  #2
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
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
	ListView.ActivateItem("Scoping Method");
	ListView.ItemValue = "Named Selection";
	ListView.ActivateItem("Named Selection");
	ListView.ItemValue = "All_EDGE_Name";
	ListView.ActivateItem("Type");
	ListView.ItemValue = "Element Size";
	ListView.ActivateItem("Element Size");
	ListView.ItemValue = "0.0003";
	ListView.ActivateItem("Behavior");
	ListView.ItemValue = "Hard";
	ListView.ActivateItem("Bias Type");
	ListView.ItemValue = "No Bias";
This is for edge sizing, you can modify to suit your need for body or face sizing as well.
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
Riadh likes this.
Kapi is offline   Reply With Quote

Old   February 23, 2015, 07:54
Default
  #3
New Member
 
Riadh
Join Date: Feb 2015
Posts: 3
Rep Power: 11
Riadh is on a distinguished road
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!
Attached Images
File Type: jpg Ansys meshing.jpg (63.5 KB, 94 views)
Riadh is offline   Reply With Quote

Old   February 23, 2015, 17:58
Default
  #4
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
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
Riadh likes this.
Kapi is offline   Reply With Quote

Old   February 23, 2015, 19:00
Default
  #5
New Member
 
Riadh
Join Date: Feb 2015
Posts: 3
Rep Power: 11
Riadh is on a distinguished road
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
Riadh is offline   Reply With Quote

Old   February 24, 2015, 17:12
Default
  #6
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
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;
meshGroup.MaxSizeSF = 0.25;
You can use "meshGroup...." and specify what you want to change in the global settings according to your geometry/Mesh

Hope it helps complete your project.

Have a good one!

Cheers
KAPI
Kapi is offline   Reply With Quote

Old   April 4, 2016, 11:17
Default
  #7
New Member
 
Join Date: Apr 2016
Posts: 1
Rep Power: 0
samiam is on a distinguished road
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
var DS = WB.AppletList.Applet("DSApplet").App;

//Get 'Mesh' control group
var Mesh_Mod = DS.Tree.FirstActiveBranch.MeshControlGroup;

//Get the ListView object so we can change the setting for the mesh sizing
var ListView = DS.Script.lv;

//Select 'Mesh' from the tree
DS.Script.SelectItems(""+Mesh_Mod.ID);

//Set global mesh options
//Set options in 'Defaults' group
var lGroupDefaults = ListView.FindGroup(2); //Get the 'Defaults' group
lGroupDefaults.Expand = 1; //Expand group
ListView.ActivateItem("Physics Preference"); //Set 'Physics Preference' option to 'CFD'
ListView.ItemValue = "CFD";
lGroupDefaults.Expand = 0; //Collapse group

//Set options in 'Sizing' group
var lGroupSizing = ListView.FindGroup(3);
lGroupSizing.Expand = 1; //Expand
//Set sizing options
ListView.ActivateItem("Relevance Center");
ListView.ItemValue = "Fine";
ListView.ActivateItem("Max Face Size");
ListView.ItemValue = "1e-04";
ListView.ActivateItem("Growth Rate");
ListView.ItemValue = "1.05";
lGroupSizing.Expand = 0; //Collapse
~Sam
samiam is offline   Reply With Quote

Old   November 30, 2016, 03:40
Default mesh a geometry via script sizing and worksheet for multizone
  #8
New Member
 
giosue giacoppo
Join Date: Sep 2012
Posts: 9
Rep Power: 13
giacoppo is on a distinguished road
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
giacoppo is offline   Reply With Quote

Old   January 4, 2018, 10:43
Default
  #9
Member
 
Join Date: Jan 2018
Posts: 31
Rep Power: 8
UchihaMadara is on a distinguished road
Does anyone know how to get all the functions that can be added after Ds.Script?
UchihaMadara is offline   Reply With Quote

Old   March 21, 2018, 11:03
Default
  #10
New Member
 
Krishna praveen
Join Date: Mar 2018
Posts: 6
Rep Power: 8
kirakbabu is on a distinguished road
Quote:
Originally Posted by UchihaMadara View Post
Does anyone know how to get all the functions that can be added after Ds.Script?
You can use debugger like Visual studio to get all the functions that are loaded.Usually all the functions are located in DSPages/Scripts folder.
kirakbabu is offline   Reply With Quote

Old   September 11, 2018, 12:06
Default Calling Js File from Workbench file
  #11
New Member
 
Andrew M
Join Date: Apr 2018
Location: Toronto
Posts: 18
Rep Power: 8
michal28 is on a distinguished road
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?
michal28 is offline   Reply With Quote

Old   January 9, 2019, 17:06
Default
  #12
New Member
 
Andrew M
Join Date: Apr 2018
Location: Toronto
Posts: 18
Rep Power: 8
michal28 is on a distinguished road
I know this post is old but did you ever work out this process ?
michal28 is offline   Reply With Quote

Reply


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
[Workbench] SCRIPT for geometry / meshing Kapi ANSYS Meshing & Geometry 12 April 16, 2015 18:48
[ICEM] Problem with ICEM Script Meshing asal ANSYS Meshing & Geometry 2 March 23, 2013 19:11
[ICEM] script for cylinder hexa meshing in ICEM Far ANSYS Meshing & Geometry 0 May 25, 2012 07:55
Volume Meshing & Face Meshing? singularity of grid ken FLUENT 0 September 4, 2003 11:08


All times are GMT -4. The time now is 22:58.