|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
Join Date: May 2017
Posts: 3
Rep Power: 10 ![]() |
Hello,
I need to export each domain in my mesh as a PLOT3D file separately. With many domains this can be a really cumbersome task. Is there a script I could run for this? |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
David Garlisch
Join Date: Jan 2013
Location: Fidelity Pointwise, Cadence Design Systems (Fort Worth, Texas Office)
Posts: 307
Rep Power: 15 ![]() |
you can create your own script.
As a guide, export one or two domains by hand with journaling. Script, Begin Journaling... Export one or two domains to Plot3D by hand. Script, End Journaling Using this journal as a guide, you can write a script that will grab all domains in model and then export them one by one. See Glyph docs here. Example Glyph scripts here. See also pw::Grid getAll -type pw::DomainStructured to capture structured domains. |
|
|
|
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2017
Posts: 3
Rep Power: 10 ![]() |
Thank you. I have consulted those sources and created a script based on the journal. Is there a for loop or something similar so that I can loop through all structured domains instead of changing the domain name every time? Also, is there a way to set a variable so that I can save a file based on the domain name?
|
|
|
|
|
|
|
|
|
#4 |
|
Senior Member
David Garlisch
Join Date: Jan 2013
Location: Fidelity Pointwise, Cadence Design Systems (Fort Worth, Texas Office)
Posts: 307
Rep Power: 15 ![]() |
I have attached a skeleton script that you can edit. It loops over all the structured domains in a grid.
I also added a few personal "best practices" to the script for your consideration. Good luck. Code:
# Load the Pointwise Glyph library
package require PWI_Glyph
#============================================================================
# Set up the global environment
#============================================================================
# Capture the directory in which the is located
set scriptDir [file dirname [info script]]
if { ![info exists argv] } {
# must be running from the Pointwise GUI
set argc 0
set argv[list]
}
#============================================================================
# Define procs
#============================================================================
#-----------------------------------------------------------------------------
proc main { argv } {
# if run from the command line, you can pass arguments
processArgs $argv
# Capture a list of all structured domains in the current grid
set allStrDoms [pw::Grid getAll -type pw::DomainStructured]
# loop through domains and export one at a time
foreach strDom $allStrDoms {
doExport $strDom
}
}
#-----------------------------------------------------------------------------
proc processArgs { argv } {
# Add command line processing here if needed
# for now, just print all args to console
if { 0 == [llength $argv] } {
puts "No command line arguments found."
} else {
puts "argv:"
foreach arg $argv {
puts " '$arg'"
}
}
}
#-----------------------------------------------------------------------------
proc doExport { strDom } {
set domName [$strDom getName]
# Be careful. The domain name MUST be only contain valid filename chars or the
# export will fail!
# The filename is in the same folder as the script.
set filename [file join $::scriptDir "$domName.x"]
puts "Exporting $filename ..."
#####
##### put grid export code here
#####
}
#============================================================================
# Invoke main AFTER all data and procs have been defined.
#============================================================================
main $argv
#============================================================================
# NOTE:
# Calling main as the starting point of a script is a personal preference.
# It is not required by Glyph or Tcl. You could also just put the code from main
# here at the end. I just like having main as the first proc in a script.
#============================================================================
|
|
|
|
|
|
![]() |
| Tags |
| domain, export, pointwise, script, separately |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script for export particle information | archetype | CFX | 2 | August 8, 2017 10:57 |
| Periodic Pressure drop | cfd_begin | CFX | 10 | May 25, 2017 08:09 |
| Export Solid Domain Autogrid5 | karwendel | Fidelity CFD | 2 | March 29, 2017 04:52 |
| Closed Domain Buoyancy Flow Problem | Madhatter92 | CFX | 6 | June 20, 2016 22:05 |
| Monte Carlo Simulation: H-Energy is not convergating & high Incident Radiation | volleyHC | CFX | 5 | April 3, 2016 06:41 |