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

[General] Vector field with 3 different files

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2016, 05:11
Default Vector field with 3 different files
  #1
New Member
 
Join Date: Jul 2016
Posts: 2
Rep Power: 0
Syarko is on a distinguished road
Hello,

I'm quite new in Paraview, and I try to create a vector field using 3 VTK file ( where each of them represent values in each axis : the first is for X axis, the second Y axis and the last Z axis). So the first step is to "combine" these tree files, and I don't know how. I tried Append Attributes and Append Datasets, because I found it on a other forum.
After that, they said to use a Calculator filters, and specify the formula by making iHat*array1+jHat*array2+kHat*array3.
The problem is, that i have only one data array. I think it's because each array of the 3 files have the same name.

So, does anyone know the different steps about how to create a vector field using 3 VTK file ?

Thank you for your help !
Syarko is offline   Reply With Quote

Old   July 5, 2016, 07:24
Default
  #2
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
Hi,

You could first use calculator to rename the arrays and then append the datasets and finally create the vector with calculator.

Regards,
Mikko
Flowkersma is offline   Reply With Quote

Old   July 5, 2016, 08:49
Default
  #3
New Member
 
Join Date: Jul 2016
Posts: 2
Rep Power: 0
Syarko is on a distinguished road
I must create a calculator for each loaded files ? If I do that, which formula do I put ? I tried to do that, I create 3 calculator, I put in the formula just the data array name and in result a specific name. After that, I create a "Append Dataset" filter with each calculator. But when I create another calcultor for the AppenDataset, even if I put the different name I gave, it do nothing. And in the data information of Append DataSet, I only have the default array name that I have before.

Last edited by Syarko; July 11, 2016 at 06:05.
Syarko is offline   Reply With Quote

Old   July 5, 2016, 09:27
Default
  #4
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
Hi,

Sounds right what you were doing. Following script does the same and it is working for me. You can do exactly the same from ParaView GUI.

Just modify the file names and the array names and then launch the script inside ParaView from Tools->Python Shell->Run Script

Code:
import paraview.simple as pv

# The three files which each has the one component of the vector
filenames=['file1.vtk','file2.vtk','file3.vtk']

# The name of the input scalar arrays
scalarArrayName='k'

# The name of the resulting vector array
vectorArrayName='U'

# Read each file separately and change the name of the array 

r1=pv.OpenDataFile(filenames[0])
c1=Calculator(r1)
c1.ResultArrayName='v1'
c1.Function=scalarArrayName

r2=pv.OpenDataFile(filenames[1])
c2=Calculator(r2)
c2.ResultArrayName='v2'
c2.Function=scalarArrayName

r3=pv.OpenDataFile(filenames[2])
c3=Calculator(r3)
c3.ResultArrayName='v3'
c3.Function=scalarArrayName

# Append the arrays and use calculator to create a vector
aa=pv.AppendAttributes(Input=[c1,c2,c3])
c3=Calculator(aa)
c3.ResultArrayName=vectorArrayName
c3.Function='v1*iHat+v2*jHat+v3*kHat'

Show(c3)

# Pass arrays filter could be used to delete the unnecessary arrays.
Regards,
Mikko
Flowkersma is offline   Reply With Quote

Reply


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
problem compiling with header files jreiter164 Fluent UDF and Scheme Programming 2 August 14, 2015 17:31
attaching trn files hossein_sml CFX 1 August 5, 2015 19:17
How to call FORTRAN files as UDF? Ehsan-F Fluent UDF and Scheme Programming 6 September 11, 2012 11:03
Writing Case and Data Files Using Journal/Scheme Files svp Fluent UDF and Scheme Programming 0 April 5, 2011 11:04
Problems with result files Kasper CFX 5 December 14, 2006 02:41


All times are GMT -4. The time now is 12:28.