CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > EnSight

Variable from point query (scripting)

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 18, 2013, 08:08
Question Variable from point query (scripting)
  #1
New Member
 
James
Join Date: Jan 2013
Posts: 3
Rep Power: 13
jamesm is on a distinguished road
Hi- wondering if anyone can help me with a simple problem but couldn't find anything from a search. I'm using Ensight 9.2

I'm looking to save the result of a query on a cursor position as a variable in a python script. So what I'd like is to set:
pref = Value of pressure on part 1 at position (x,y,z)

Many thanks in advance.

James
jamesm is offline   Reply With Quote

Old   January 19, 2013, 11:05
Default Query Variable from Script
  #2
Senior Member
 
kevincolburn's Avatar
 
Kevin Colburn
Join Date: Mar 2009
Location: The Woodlands, TX
Posts: 131
Rep Power: 17
kevincolburn is on a distinguished road
James,

That is fairly straight forward to extract out of EnSight. The main python function you want to use is :
ensight.query(ensight.QUERY_PROBE_DATA)

I've provided below a few other items in terms of setup and use of the xyz query. You may or may not need this additional information, but should provide further context for your inquiry. So, the following example I set the xyz location with the "xloc, yloc, zloc" variables, the variable name and part to query from. The next block is the creation of the query, while the final block is the extraction of the query variable, and do with it what I want.

# Setup first the xyz location, the variable of interest, the parent part.
xloc = 0.94095
yloc = 0.22981
zloc = 0.03521
varname = "Energy"
partid = 1

# Standard EnSight commands to create a probe at this XYZ location
ensight.variables.activate(varname)
ensight.query_interact.select_varname_begin(varnam e)
ensight.query_interact.query("xyz")
ensight.part.select_begin(partid)
ensight.query_interact.create(xloc,yloc,zloc)

# Ask EnSight for the value at that probe location
a = ensight.query(ensight.QUERY_PROBE_DATA)

# Print the whole information
print a

# alternative, print out the first variable
vname = a[0][0][0]
pref = a[1][0][0]
print "Value of ", vname," is ",pref


Let me know if that addresses your question or not... or it inspires more.

-Kevin Colburn
(kevin@ceisoftware.com)
__________________
Kevin Colburn
Computational Engineering International, Inc.
www.ceisoftware.com
kevin@ensight.com
kevincolburn is offline   Reply With Quote

Old   January 22, 2013, 14:15
Default
  #3
New Member
 
James
Join Date: Jan 2013
Posts: 3
Rep Power: 13
jamesm is on a distinguished road
Hi Kevin

Thanks for your information works exactly as I wanted.

Is there documentation / resource of functions such as these on-line anywhere?

Thanks again,

James
jamesm is offline   Reply With Quote

Old   January 22, 2013, 18:12
Default
  #4
Senior Member
 
kevincolburn's Avatar
 
Kevin Colburn
Join Date: Mar 2009
Location: The Woodlands, TX
Posts: 131
Rep Power: 17
kevincolburn is on a distinguished road
James,

The "Interface Manual", chapter 6 has the majority of what you are looking for in terms of Python-EnSight. In the User Defined Tools area for EnSight 10, there are some links to our Google Docs which has a bit more low-level Python operation which may help.

-Kevin
__________________
Kevin Colburn
Computational Engineering International, Inc.
www.ceisoftware.com
kevin@ensight.com
kevincolburn is offline   Reply With Quote

Old   January 24, 2013, 04:15
Default
  #5
New Member
 
James
Join Date: Jan 2013
Posts: 3
Rep Power: 13
jamesm is on a distinguished road
Hi Kevin,

Thanks for the info I wasn't aware of this document but I am now!

James
jamesm is offline   Reply With Quote

Old   March 28, 2013, 03:18
Default
  #6
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 15
JimKnopf is on a distinguished road
You can also find many examples on

http://pythonexchange.com/

In these tools you find many hints how to script ensight

Greets
Jim
JimKnopf is offline   Reply With Quote

Old   July 19, 2018, 06:47
Default
  #7
New Member
 
Viswanathan
Join Date: Jul 2018
Posts: 9
Rep Power: 7
Viswa is on a distinguished road
Hi kevin,

in query show info i could get required scalar value for particular node/ Element.
how to get the same by Script.
i want to use that scalar value

x=getinfo('element 123')
or
x=get scalar value(node 1)
Viswa is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] error EOF in blockMesh Ahmed Khattab OpenFOAM Meshing & Mesh Conversion 7 May 17, 2012 01:37
Instalation on ubuntu 710 basilwatson OpenFOAM Installation 17 March 16, 2012 21:16
Question about making a variable function of proprities of onother variable ? rafiktharwat CFX 0 March 26, 2011 15:23
How to limit a variable ash OpenFOAM Running, Solving & CFD 1 June 26, 2008 21:32
[Gmsh] Gmsh and samplesurface touf OpenFOAM Meshing & Mesh Conversion 2 December 10, 2007 03:27


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