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

Automating the Named Selctions in WorkBench

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 16, 2011, 21:37
Default Automating the Named Selctions in WorkBench
  #1
New Member
 
Mostapha Sadeghipour
Join Date: Jun 2011
Posts: 8
Rep Power: 14
Mostapha is on a distinguished road
Hi,

I'm trying to automate the process of importing, meshing and running a CFD simulation for a parametric study. In an iterative process, geometry is continuously being updated, re-generated, and re-tested. So far I am able to create the *.sat file, but need to name the inlet and outlet and set the boundary conditions. The whole process must be automated.

The problem is that I cannot name the selections in the right way yet. As far as I understand there is no way to do NamedSelections using the WorkBench commands. I was able to use a .js code to name the surfaces by their area, but this has limitations. I need one more properties such as Face Normal or Face Starting Coordinates to recognize between the inlet and outlet which has the same areas. I've tried Normal, SurfaceNormal, SurfaceAzimuth, etc but Ansys gives me the undefined error!

This is part of the .js file in which I am trying to collect face normals and areas and name them based on these two variables. I don’t know what to use in this line to get the normal: face_normal.push(faces(h).??????);
Here is the part of the java script:




var part = SM.PartMgr.PartById(part_id);
var brep = part.BRep;
body = brep.Cell(topo_id);

var face_ids = new Array();
var faces = body.Faces;
for (var f = 1; f <= faces.Count; f++) {
face_ids.push(faces(f).Id);
}

face_id_map[i - 1] = new Array(2);
face_id_map[i - 1][0] = part_id;
face_id_map[i - 1][1] =
face_ids.slice(0, face_ids.length);

var face_normal = new Array();
var faces = body.Faces;
for (var h = 1; h <= faces.Count; h++) {
face_normal.push(faces(h).?????);
}

var face_area = new Array();
var faces = body.Faces;
for (var j = 1; j <= faces.Count; j++) {
face_area.push(faces(j).Area);
}
}
SM.Clear();
var name = null;
var inletarea = 400
for (var i = 0; i < face_id_map.length; i++) {
var part_id = face_id_map[i][0];
var face_ids = face_id_map[i][1];
for (var j = 0; j < face_ids.length; j++) {
if (Math.abs(inletarea-face_area[j]) < 22)
{
SM.Clear();
name = face_normal[j] + '_' + face_area[j].toString();
SM.AddToSelection(part_id, face_ids[j], false);
SC.addNamedSelection(false, name, SC.id_NS_UnknownMultiCriterion);
}
}

Thanks in advance,

Mostapha
Mostapha is offline   Reply With Quote

Old   June 17, 2011, 04:46
Default
  #2
sac
Member
 
Join Date: Jun 2010
Posts: 44
Rep Power: 16
sac is on a distinguished road
"As far as I understand there is no way to do NamedSelections using the WorkBench commands."

There is a way...

If your using version v13.0 you can do named selections via criteria.

e.g.

  • You can define an x,y,z location of an entity to pick it.
  • You can define a explicit size or a range of sizes to pick the entity (edges, faces, bodies, verts)
As well as many other ways of doing things.

You can also say ok I have this group - please add or take away entities from this group for example.

To try this out when creating a named selection in meshing choose worksheet instead of geometry in the details window.
sac is offline   Reply With Quote

Old   June 17, 2011, 11:18
Default
  #3
New Member
 
Mostapha Sadeghipour
Join Date: Jun 2011
Posts: 8
Rep Power: 14
Mostapha is on a distinguished road
Thank you so much Sac.

I'm using V.12. I want to do all of these using the command line. Is it possible ri work with the worksheet by command line? I'm not sure if I can select work sheets when I import a .sat geometry. It's available when you use design modeler to make your model.

I do like your other suggestion. I removed other entities based on their areas. So the question is how to select between inlet and outlet which are two surfaces with the same area using a java script code? (I gues it should be their coordinates or their normal?)

Mostapha
Mostapha is offline   Reply With Quote

Old   June 17, 2011, 12:38
Default
  #4
sac
Member
 
Join Date: Jun 2010
Posts: 44
Rep Power: 16
sac is on a distinguished road
Quote:
Originally Posted by Mostapha View Post
Thank you so much Sac.

I'm using V.12. I want to do all of these using the command line. Is it possible ri work with the worksheet by command line?
Before we go any further - Where are you generating your initial geometry?

In a CAD system? In Design Modeler?
sac is offline   Reply With Quote

Old   June 17, 2011, 14:39
Default
  #5
New Member
 
Mostapha Sadeghipour
Join Date: Jun 2011
Posts: 8
Rep Power: 14
Mostapha is on a distinguished road
Hi Sac... In a CAD system: Rhino.
Mostapha is offline   Reply With Quote

Old   June 17, 2011, 16:46
Default
  #6
sac
Member
 
Join Date: Jun 2010
Posts: 44
Rep Power: 16
sac is on a distinguished road
OK then there are three ways you could approach this.

The first is to move to v13.0 and use named selections via criteria to do exactly what your doing with the javascript code.

The second is to carry on with the javascript code to replicate what is there by default in v13.0 in v12.0.

In both case I'd be using a range of x,y,z (so basic between a and b) to make up for the change is inlet and outlet size as you "parameterise" your model.

The other way is to buy ANSYS spaceclaim direct Modeler use it to make the modifications. The reason I'd recommend this over Design Modeler in this case is because its good at making changes from "static" cad files (i.e. static files such as .sat or .iges files). DM could also do the job if you let it re-make the parts of that make up your inlet or outlet (or similar methodology).
sac is offline   Reply With Quote

Old   June 17, 2011, 16:56
Default
  #7
New Member
 
Mostapha Sadeghipour
Join Date: Jun 2011
Posts: 8
Rep Power: 14
Mostapha is on a distinguished road
Thanks... The first option is impossible now!

I want to do the second one but I don't know how I should write the .js code to define the range of x,y and z. Lack of knowledge in Javascriptig!! However hopefully I can figure it out if you can guide me to an example.

The third option sounds interesting. I will try it if I cannot solve it with the second strategy... Again thank you so much for your help!
Mostapha is offline   Reply With Quote

Old   June 19, 2011, 18:42
Default Fluid/Solid
  #8
New Member
 
Mostapha Sadeghipour
Join Date: Jun 2011
Posts: 8
Rep Power: 14
Mostapha is on a distinguished road
So the third suggestion was so helpful. The only problem left is to change the body from Solid to Fluid using WB scripting... I looked both in WorkBench Scripting Guide and Scripting API in DesignModeler documents but I couldn't find the command...

Thanks in advance!
Mostapha is offline   Reply With Quote

Old   June 20, 2011, 10:44
Default
  #9
sac
Member
 
Join Date: Jun 2010
Posts: 44
Rep Power: 16
sac is on a distinguished road
Quote:
Originally Posted by Mostapha View Post
So the third suggestion was so helpful. The only problem left is to change the body from Solid to Fluid using WB scripting... I looked both in WorkBench Scripting Guide and Scripting API in DesignModeler documents but I couldn't find the command...

Thanks in advance!
I don't have time currently to look into it for you. Sorry

However...

Read this blog:

http://www.padtinc.com/blog/post/201...TO-Part-1.aspx

There are five parts and this is just the link to the first. If a scripting command exists in the meshing or DM applications this should help you find it.
sac is offline   Reply With Quote

Old   June 20, 2011, 14:06
Default
  #10
New Member
 
Mostapha Sadeghipour
Join Date: Jun 2011
Posts: 8
Rep Power: 14
Mostapha is on a distinguished road
Hi Sac,

I've read this blog when I had the previous problem. Since I haven't administrative account I cannot change anything on the C drive so I couldn't use the cool "debugger" concept. I will try to try other way to implement the idea anyway.

I should add I tried the ID_* and I know it is "ID_Phase" but I couldn't find the do*command for that...

Thanks again for your help. I really appreciate it!

Mostapha

Last edited by Mostapha; June 20, 2011 at 18:32.
Mostapha is offline   Reply With Quote

Old   June 20, 2011, 21:45
Unhappy An update
  #11
New Member
 
Mostapha Sadeghipour
Join Date: Jun 2011
Posts: 8
Rep Power: 14
Mostapha is on a distinguished road
So I've tried ID_Fluid and ID_FluidSolid as well but still I cannot find any "do*" command in any file in all the Ansys folders!!!
Mostapha is offline   Reply With Quote

Old   August 11, 2015, 16:27
Default
  #12
New Member
 
Bing Wang
Join Date: Sep 2014
Posts: 2
Rep Power: 0
icyking06 is on a distinguished road
Hi. Does anyone solve this problem now? I have the same difficulty in naming the surfaces with vertices, hopefully.
icyking06 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
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 11:39
activating field Averages m.maneshi OpenFOAM Running, Solving & CFD 18 September 8, 2010 13:29
Error in recompiling the solver m.maneshi OpenFOAM Running, Solving & CFD 0 August 28, 2010 14:14
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 03:39.