|
[Sponsors] |
Importing multiple P3D grid files into Pointwise |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 24, 2017, 12:28 |
Importing multiple P3D grid files into Pointwise
|
#1 |
New Member
Greg
Join Date: Aug 2015
Posts: 4
Rep Power: 11 |
Hello All,
I have separated a single domain into 48 blocks for parallel processing and I want to bring them back into Pointwise for grid refinement. I was wondering if there is a built-in means of importing multiple P3D grid files at a single time so that all of the grids are imported (rather than having to manually import each file). Or if there is no built-in function in Pointwise how do i go about writing a code to do so? Thank you for the assistance with this issue, gsh |
|
January 24, 2017, 20:45 |
|
#2 |
Senior Member
David Garlisch
Join Date: Jan 2013
Location: Fidelity Pointwise, Cadence Design Systems (Fort Worth, Texas Office)
Posts: 307
Rep Power: 14 |
Nope. A script is your best bet.
|
|
January 27, 2017, 17:56 |
|
#3 |
New Member
Greg
Join Date: Aug 2015
Posts: 4
Rep Power: 11 |
Well I tried to do the journal file route: make a journal file, change the journal file code so it fits my purpose (hard coded), use re-appropriated journal/glyph file. However, since I have not found an explicit set of pointwise instructions on importing any file type; I have not been able to get the glyph to work. I put the code that I have been trying to use below.
Any insight would be appreciated. ---- package require PWI_Glyph # X is the number of multi-blocks to import # ----------------------------------------------- set x 48 set i 1 while {$i <= $x} { # grid is the location and file set grid_file "/home/split-on-hub/ast.b$i.x" set _TMP(mode_1) [pw::Application begin GridImport] $_TMP(mode_1) initialize -type Automatic {$grid_file} $_TMP(mode_1) read $_TMP(mode_1) convert $_TMP(mode_1) end unset _TMP(mode_1) incr i } ---- |
|
January 27, 2017, 18:28 |
|
#4 |
Senior Member
David Garlisch
Join Date: Jan 2013
Location: Fidelity Pointwise, Cadence Design Systems (Fort Worth, Texas Office)
Posts: 307
Rep Power: 14 |
Since you changed the literal file name in the journal from {/path/to/the/filename.x} to a variable, you don't want the {} any more.
So change: $_TMP(mode_1) initialize -type Automatic {$grid_file} to $_TMP(mode_1) initialize -type Automatic $grid_file Also, since you know the actual file type, you can change Automatic to PLOT3D. FINAL SCRIPT: Code:
package require PWI_Glyph # $numFiles is the number of multi-blocks to import # ------------------------------------------------- set numFiles 48 # Only need to create mode once and reuse it set ioGrid [pw::Application begin GridImport] for {set i 1} {$i <= $numFiles} {incr i} { # use ${i} embedded inside string to make variable name explicit. # otherwise parser might think the var name is $i.x $ioGrid initialize -type PLOT3D "/home/split-on-hub/ast.b${i}.x" $ioGrid read $ioGrid convert } # Now we are done with mode. # Using "end" will make all changes permanent. # Using "abort" will throw away all changes made since mode was created. $ioGrid end unset ioGrid Why? In Glyph (Tcl) anything inside {} is NOT expanded with variable substitution. So your code was trying to import a file actually named {$grid_file}. A little trick: Code:
# capture the script folder set scriptDir [file dirname [info script]] # construct full path and filename set fullFileName [file join $scriptDir "filename.x"] # $fullFileName is something like: # /path/to/script/folder/filename.x |
|
January 27, 2017, 18:58 |
|
#5 |
New Member
Greg
Join Date: Aug 2015
Posts: 4
Rep Power: 11 |
Thank you I very much appreciate the help, that worked perfectly!
Now that i have a working example I think I will try to write a script to export blocks into Plot3D files after manipulating the number of blocks. Thanks again! |
|
January 27, 2017, 19:13 |
|
#6 |
Senior Member
David Garlisch
Join Date: Jan 2013
Location: Fidelity Pointwise, Cadence Design Systems (Fort Worth, Texas Office)
Posts: 307
Rep Power: 14 |
Slightly more advanced script with error checking and progress output...
Code:
package require PWI_Glyph # $numFiles is the number of multi-blocks to import # ------------------------------------------------- set numFiles 48 # Only need to create mode once and reuse it set ioGrid [pw::Application begin GridImport] for {set i 1} {$i <= $numFiles} {incr i} { # use ${i} embedded inside string to make variable name explicit. # otherwise parser might think the var name is $i.x set xFile "/home/split-on-hub/ast.b${i}.x" puts "loading $i of $numFiles: $xFile" if { [catch {$ioGrid initialize -type PLOT3D $xFile} err] } { puts " Could not initialize $xFile" puts " $err" continue } $ioGrid read $ioGrid convert } # Now we are done with mode. # Using "end" will make all changes permanent. # Using "abort" will throw away all changes made since mode was created. $ioGrid end unset ioGrid puts "grid: [pw::Grid getAll -type pw::Block]" |
|
January 27, 2017, 19:34 |
|
#7 |
Senior Member
David Garlisch
Join Date: Jan 2013
Location: Fidelity Pointwise, Cadence Design Systems (Fort Worth, Texas Office)
Posts: 307
Rep Power: 14 |
And another version that uses pattern matching...
See Full Glyph script documentation. See Full Tcl documentation. Code:
package require PWI_Glyph set xFileDir "/home/split-on-hub" set pattern "ast.b*.x" # find all files in $xFileDir matching $pattern set xFiles [glob -nocomplain -directory $xFileDir -- $pattern] # Only need to create mode once and reuse it set ioGrid [pw::Application begin GridImport] set i 0 set numFiles [llength $xFiles] foreach xFile $xFiles { puts [format "Loading file %3d of %d: %s" [incr i] $numFiles $xFile] if { [catch {$ioGrid initialize -type PLOT3D $xFile} err] } { puts " Could not initialize $xFile" puts " $err" continue } $ioGrid read $ioGrid convert } # Now we are done with mode. # Using "end" will make all changes permanent. # Using "abort" will throw away all changes made since mode was created. $ioGrid end unset ioGrid set blks [pw::Grid getAll -type pw::Block] puts {} puts "[llength $blks] blocks imported:" foreach blk $blks { puts " [$blk getName] ($blk)" } |
|
Tags |
grid, multi blocks, pointwise |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 07:09 |
17.3 Pointwise can NOT import CGNS mesh with Multiple nodes | swm | Pointwise & Gridgen | 3 | January 24, 2017 11:48 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13:21 |
critical error during installation of openfoam | Fabio88 | OpenFOAM Installation | 21 | June 2, 2010 04:01 |
Grid Independent Solution | Chuck Leakeas | Main CFD Forum | 2 | May 26, 2000 12:18 |