CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Pointwise & Gridgen

Farfield Script

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 6, 2016, 13:55
Default Farfield Script
  #1
New Member
 
Join Date: Jan 2016
Posts: 18
Rep Power: 2
weigl is on a distinguished road
I want to automate the process of creating a rectangular farfield around an airfoil with a baffle.

For example if the length of the airfoil is 1 unit then the baffle goes 20*airfoil length and similarly all the way around until it completes the square/rectangle for the farfield.

And I want it to start from the trailing edge of the airfoil. I have attached a pic of the kind of farfield I am looking for.

But I can't seem to generate one that starts from the trailing edge.
Attached Images
File Type: png eh.png (70.5 KB, 12 views)
weigl is offline   Reply With Quote

Old   January 7, 2016, 11:47
Default
  #2
Senior Member
 
David Garlisch
Join Date: Jan 2013
Location: Pointwise HQ
Posts: 144
Rep Power: 5
dgarlisch is on a distinguished road
Pointwise has a full scripting language called Glyph.

You can create the automation you want using Glyph.

There are many example scripts on the Pointwise Github Repository.

Also see:
dgarlisch is offline   Reply With Quote

Old   January 7, 2016, 13:27
Default
  #3
New Member
 
Join Date: Jan 2016
Posts: 18
Rep Power: 2
weigl is on a distinguished road
Quote:
Originally Posted by dgarlisch View Post
Pointwise has a full scripting language called Glyph.

You can create the automation you want using Glyph.

There are many example scripts on the Pointwise Github Repository.

Also see:
Hi. I have looked at the shape wizard glyph. I have been able to create a farfield using that method, but i cant seem to create a baffle line from the trailing edge to the farfield
weigl is offline   Reply With Quote

Old   January 8, 2016, 11:50
Default
  #4
Senior Member
 
David Garlisch
Join Date: Jan 2013
Location: Pointwise HQ
Posts: 144
Rep Power: 5
dgarlisch is on a distinguished road
After creating the farfield domain, you will need to:
  1. Delete the farfield domain (only the connectors remain)
  2. Split the trailing farfield connector at the appropriate location (Edit, Split...)
  3. Create the connector from the trailing edge of the airfoil to the split
  4. Assemble a new domain (Create, Assemble Special, Domain...)
    • You will need to select the baffle connector twice during assembly
Technically, this is not a baffle because it is part of the outer loop of the domain.
I have attached an image that shows the topology of the domain's outer loop.

This assembly procedure is the same you will be using in your automation script.

To see the commands you will need, I suggest creating a journal file while assembling the domain (Script, Begin Journaling...).
Attached Images
File Type: png dom-topo.png (2.4 KB, 6 views)
dgarlisch is offline   Reply With Quote

Old   January 11, 2016, 10:19
Default
  #5
New Member
 
Join Date: Jan 2016
Posts: 18
Rep Power: 2
weigl is on a distinguished road
Quote:
Originally Posted by dgarlisch View Post
After creating the farfield domain, you will need to:
  1. Delete the farfield domain (only the connectors remain)
  2. Split the trailing farfield connector at the appropriate location (Edit, Split...)
  3. Create the connector from the trailing edge of the airfoil to the split
  4. Assemble a new domain (Create, Assemble Special, Domain...)
    • You will need to select the baffle connector twice during assembly
Technically, this is not a baffle because it is part of the outer loop of the domain.
I have attached an image that shows the topology of the domain's outer loop.

This assembly procedure is the same you will be using in your automation script.

To see the commands you will need, I suggest creating a journal file while assembling the domain (Script, Begin Journaling...).
Ok, I tried that.

But when I try to create a line, instead of starting from the trailing edge it starts from the 0,0,0 point.

I want the script to be able to find the end of the curve automatically.
weigl is offline   Reply With Quote

Old   January 11, 2016, 12:36
Default
  #6
Senior Member
 
David Garlisch
Join Date: Jan 2013
Location: Pointwise HQ
Posts: 144
Rep Power: 5
dgarlisch is on a distinguished road
Not much more I can do to help without seeing your starting airfoil data and the glyph script.

There are glyph calls to extract XYZ locations on curves and connectors.
See docs for:
pw::Curve
pw::Connector

You can also attend a Pointwise Glyph scripting class.
dgarlisch is offline   Reply With Quote

Old   January 11, 2016, 12:50
Default
  #7
New Member
 
Join Date: Jan 2016
Posts: 18
Rep Power: 2
weigl is on a distinguished road
Quote:
Originally Posted by dgarlisch View Post
Not much more I can do to help without seeing your starting airfoil data and the glyph script.

There are glyph calls to extract XYZ locations on curves and connectors.
See docs for:
pw::Curve
pw::Connector

You can also attend a Pointwise Glyph scripting class.
I have attached the aerofoil and the script.

I also can't seem to apply a value to the script to define a basic distance

I will try those other things out
Attached Files
File Type: zip Viscous Mesh.zip (2.8 KB, 1 views)
weigl is offline   Reply With Quote

Old   January 11, 2016, 20:53
Default
  #8
Senior Member
 
David Garlisch
Join Date: Jan 2013
Location: Pointwise HQ
Posts: 144
Rep Power: 5
dgarlisch is on a distinguished road
I have looked at the dat file and the script file.

You are very close. Unfortunately, I am not sure exactly what you are trying to accomplish. It would be helpful to post a PW file that contains an example of what you want the final grid to look like. Build this grid by hand while journaling.
  1. Turn on journaling (Script, Begin Journaling...)
  2. Manually do the entire process of importing the dat file, adding airfoil connectors, adding far field connectors, assembling the domain.
  3. Stop journaling (Script, End Journaling).

Examine the journal to find the relevant commands you will need in your script.

Please take a look at AirfoilMesh Script for an example.

Good luck.
dgarlisch is offline   Reply With Quote

Old   January 12, 2016, 08:51
Default
  #9
New Member
 
Join Date: Jan 2016
Posts: 18
Rep Power: 2
weigl is on a distinguished road
Quote:
Originally Posted by dgarlisch View Post
I have looked at the dat file and the script file.

You are very close. Unfortunately, I am not sure exactly what you are trying to accomplish. It would be helpful to post a PW file that contains an example of what you want the final grid to look like. Build this grid by hand while journaling.
  1. Turn on journaling (Script, Begin Journaling...)
  2. Manually do the entire process of importing the dat file, adding airfoil connectors, adding far field connectors, assembling the domain.
  3. Stop journaling (Script, End Journaling).

Examine the journal to find the relevant commands you will need in your script.

Please take a look at AirfoilMesh Script for an example.

Good luck.
Hi. Thank you so much for all your help.

I am not having issues with the grid generation or dimensioning etc.

I only seem to be having issues automatically generating that line from the trailing edge that works as a baffle as described by the T-Rex tutorial.

I tried the journaling way. In the journal itself it has this command:

Quote:
set _DB(1) [pw:atabaseEntity getByName "curve-1"]
$_TMP(PW_1) addPoint[list 1 0 $_DB(1)]
$_TMP(PW_3) addPoint [pwu::Vector3 add [pw::Application getXYZ[list 1 0 $_DB(1)]] {20 0 0}]
I want to generalise this part. Get the script to find the trailing edge for the first point and then use the "farfield" value inputted by the user to generate the second point.

Like for example when i journal it I get a line that says:

Quote:
addPoint [pwu::Vector3 add {11 0 0} {0 10 0}]
I want to replace the X & Y coordinates with $farfield so it reads the value provided by user-input

Last edited by weigl; January 12, 2016 at 10:57.
weigl is offline   Reply With Quote

Old   January 12, 2016, 13:24
Default
  #10
Senior Member
 
David Garlisch
Join Date: Jan 2013
Location: Pointwise HQ
Posts: 144
Rep Power: 5
dgarlisch is on a distinguished road
If I understand correctly, the $farfield value is the distance from the trailing edge point to the rear farfield.

Code:
# Get one of the airfoil curves
set airfoilCrv [pw::DatabaseEntity getByName "curve-1"]

# Get a curve point using parametric position: [list u v crv].
# This assumes that the curve's direction goes from LEdge (u=0) to TEdge (u=1).
# Since this is a curve, the v parameter is ignored.
set trailingEdgePt [pw::Application getXYZ [list 1 0 $airfoilCrv]]

# compute the xyz at the rear farfield.
set rearFarFieldPt [pwu::Vector3 add $trailingEdgePt [list $farfield 0 0]]

# You can now create the "baffle" curve using $trailingEdgePt and $rearFarFieldPt
You can compute the other 4 farfield corner points using similar logic:

Code:
set farfieldX2 [expr {$farfield * 2}]
set topRightFarFieldPt [pwu::Vector3 add $rearFarFieldPt  [list 0 $farfield 0]]
set topLeftFarFieldPt [pwu::Vector3 add $topRightFarFieldPt  [list -$farfieldX2 0 0]]
set bottomLeftFarFieldPt [pwu::Vector3 add $topLeftFarFieldPt  [list 0 -$farfieldX2 0]]
set bottomRightFarFieldPt [pwu::Vector3 add $bottomLeftFarFieldPt  [list $farfieldX2 0 0]]
I hope this helps.

You can find all the documentation for these glyph calls on the Pointwise website.

Last edited by dgarlisch; January 12, 2016 at 14:25. Reason: typo
dgarlisch is offline   Reply With Quote

Old   January 12, 2016, 14:17
Default
  #11
New Member
 
Join Date: Jan 2016
Posts: 18
Rep Power: 2
weigl is on a distinguished road
Quote:
Originally Posted by dgarlisch View Post
If I understand correctly, the $farfield value is the distance from the trailing edge point to the rear farfield.

Code:
# Get one of the airfoil curves
set airfoilCrv [pw:DatabaseEntity getByName "curve-1"]

# Get a curve point using parametric position: [list u v crv].
# This assumes that the curve's direction goes from LEdge (u=0) to TEdge (u=1).
# Since this is a curve, the v parameter is ignored.
set trailingEdgePt [pw::Application getXYZ [list 1 0 $airfoilCrv]]

# compute the xyz at the rear farfield.
set rearFarFieldPt [pwu::Vector3 add $trailingEdgePt [list $farfield 0 0]]

# You can now create the "baffle" curve using $trailingEdgePt and $rearFarFieldPt
You can compute the other 4 farfield corner points using similar logic:

Code:
set farfieldX2 [expr {$farfield * 2}]
set topRightFarFieldPt [pwu::Vector3 add $rearFarFieldPt  [list 0 $farfield 0]]
set topLeftFarFieldPt [pwu::Vector3 add $topRightFarFieldPt  [list -$farfieldX2 0 0]]
set bottomLeftFarFieldPt [pwu::Vector3 add $topLeftFarFieldPt  [list 0 -$farfieldX2 0]]
set bottomRightFarFieldPt [pwu::Vector3 add $bottomLeftFarFieldPt  [list $farfieldX2 0 0]]
I hope this helps.

You can find all the documentation for these glyph calls on the Pointwise website.
yea even that is not working. i keep getting the same error as I do with my script:

Code:
invalid command name "pw:DatabaseEntity"
invalid command name "pw:DatabaseEntity"
    while executing
"pw:DatabaseEntity getByName "curve-1""
    (procedure "afMesh" line 25)
    invoked from within
"afMesh"
    invoked from within
".mesh.af2.dbb invoke "
    invoked from within
".mesh.af2.dbb instate {pressed !disabled} { .mesh.af2.dbb state !pressed; .mesh.af2.dbb invoke } "
    (command bound to event)
weigl is offline   Reply With Quote

Old   January 12, 2016, 14:27
Default
  #12
Senior Member
 
David Garlisch
Join Date: Jan 2013
Location: Pointwise HQ
Posts: 144
Rep Power: 5
dgarlisch is on a distinguished road
Sorry. There was a typo in my script!

pw:DatabaseEntity should be pw::DatabaseEntity
dgarlisch is offline   Reply With Quote

Old   January 12, 2016, 14:51
Default
  #13
New Member
 
Join Date: Jan 2016
Posts: 18
Rep Power: 2
weigl is on a distinguished road
Quote:
Originally Posted by dgarlisch View Post
Sorry. There was a typo in my script!

pw:DatabaseEntity should be pw::DatabaseEntity
thank you soo much. it works perfectly.

sorry to be such a bugger.

Unfortunately I have very less time to finish this script so I don't have the luxury of learning it from beginning to end.

Thank you very very much.
weigl is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Workbench] Run ICEM Script in Workbench Script MIZOR ANSYS Meshing & Geometry 3 October 7, 2016 02:16
Farfield Size and Shape tcarrigan Pointwise & Gridgen 1 April 15, 2016 19:29
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 09:36
Pressure farfield vs Velocity Inlet BC DarrenC FLUENT 1 September 16, 2009 02:23
Perl script for intialisation pratik mehta CFX 2 September 10, 2008 03:09


All times are GMT -4. The time now is 12:44.