|
[Sponsors] |
April 2, 2024, 15:32 |
Writing slice does not include variables
|
#1 |
New Member
Dave
Join Date: Apr 2024
Posts: 1
Rep Power: 0 |
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. |
|
May 6, 2024, 18:53 |
|
#2 |
Senior Member
Scott Fowler
Join Date: May 2009
Posts: 121
Rep Power: 17 |
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 |
|
May 8, 2024, 16:58 |
|
#3 |
New Member
Kate Clements
Join Date: May 2024
Posts: 2
Rep Power: 0 |
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 |
|
May 8, 2024, 19:24 |
|
#4 |
Senior Member
Scott Fowler
Join Date: May 2009
Posts: 121
Rep Power: 17 |
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") |
|
May 9, 2024, 15:05 |
|
#5 |
New Member
Kate Clements
Join Date: May 2024
Posts: 2
Rep Power: 0 |
Thanks, Scott!
|
|
Tags |
csv, nodal, write |
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |