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

Writing slice does not include variables

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By wsfowler

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2024, 15:32
Default Writing slice does not include variables
  #1
New Member
 
Dave
Join Date: Apr 2024
Posts: 1
Rep Power: 0
drigby is on a distinguished road
I am reading in Cell Centered surface data.

I then take a slice and want to write out a comma separated file using:
Tools -> Write Data as Formatted Text

The data set info for the slice shows all of the variables, and the Var. Location is nodal. However, when I go to write out the csv file, only x, y, and z are available.

The only workaround I have found is to create a new variable (using specify equation) before taking the slice. For the new variable I choose nodal for the New var location.

Am I missing something? This seems like a bug. If data info reports nodal data, for ALL variables, on the slice, why can they not be written?

Thanks for any advice.
drigby is offline   Reply With Quote

Old   May 6, 2024, 18:53
Default
  #2
Senior Member
 
Scott Fowler
Join Date: May 2009
Posts: 123
Rep Power: 17
wsfowler is on a distinguished road
This appears to be a bug in that dialog. Write Data as Formatted Text only allows exporting node-located data (by design). But it appears that the dialog currently only evaluates the first zone in the dataset for the set of node-located variables (it must have been assuming that all zones would have the same value location).

It sounds like you've found a workaround, and we'll consider fixing this in a future release.

Thanks,
Scott
abubaker mohamed likes this.
wsfowler is offline   Reply With Quote

Old   May 8, 2024, 16:58
Default
  #3
New Member
 
Kate Clements
Join Date: May 2024
Posts: 2
Rep Power: 0
kclements is on a distinguished road
I'm having a similar problem, but the variable I'm trying to write to a CSV is cell-centered. Any recommended work-arounds for this? I want the values for this variable over a whole surface, so I can't use a slice for it.

Thanks,
Kate
kclements is offline   Reply With Quote

Old   May 8, 2024, 19:24
Default
  #4
Senior Member
 
Scott Fowler
Join Date: May 2009
Posts: 123
Rep Power: 17
wsfowler is on a distinguished road
Kate,

It depends on what you want. If you want to write the XYZ values in addition to the cell-centered variable, then you're going to have to create a node-located version of the cell-centered variable. This is most easily done using the Data>Specify Equations dialog. Use an equation like this:

{myvariable_nodal} = {myvariable}, And be sure to specify "Cell Centered" as the "New Var Location". You can then use Write Data As Formatted Text to export the new variable.


If you want to write out the actual cell-centered values to a CSV file you could use our Python API in conjunction with pandas:

Code:
import pandas as pd
import tecplot as tp
from tecplot.constant import *
# Connect to a live running version of Tecplot 360
tp.session.connect()

dataset = tp.active_frame().dataset

df = pd.DataFrame()
zone = dataset.zone(0) # Looking at the first zone only
for v in dataset.variables(): # Looping over all variables
	var_array = zone.values(v)
        # Only write the cell centered variables which have allocated data
        # This ensures that all arrays in this DataFrame are the same length
	if var_array.location == ValueLocation.CellCentered and not var_array.passive:
		df[v.name] = var_array[:]
		
df.to_csv("mycellcentereddata.csv", index=False)
print("Done")
wsfowler is offline   Reply With Quote

Old   May 9, 2024, 15:05
Default
  #5
New Member
 
Kate Clements
Join Date: May 2024
Posts: 2
Rep Power: 0
kclements is on a distinguished road
Thanks, Scott!
kclements is offline   Reply With Quote

Reply

Tags
csv, nodal, write


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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
[General] How to plot other variables on a slice? ansys_matt ParaView 1 April 2, 2020 19:26
Mapping of pointFields with topology changes mturcios777 OpenFOAM Programming & Development 16 August 8, 2016 12:34
How to include additional variables in a LESdelta? Jane L OpenFOAM Programming & Development 7 November 1, 2012 07:50


All times are GMT -4. The time now is 16:02.