|
[Sponsors] |
[General] Read multiple solution of a cgns file with paraview |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 13, 2012, 10:54 |
Read multiple solution of a cgns file with paraview
|
#1 |
New Member
Christos
Join Date: May 2012
Posts: 6
Rep Power: 14 |
Dear All,
I am trying to read a cgns file which has multiple solutions. Tecplot can read it with no problems by simply selecting the relevant zone. But both paraview and VisIt can only read the first solution set. Is there any way to read all the solution fields of the cgns file? Regards, Christos |
|
February 4, 2014, 13:28 |
|
#2 | |
Member
Felipe Alves Portela
Join Date: Dec 2012
Location: FR
Posts: 70
Rep Power: 13 |
Quote:
Did you find a solution to this problem? I bumped into the same problem and can't seem to find the solution... Cheers, Felipe |
||
February 7, 2014, 16:33 |
|
#3 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
@Felipe: If you can provide a small example file, I can have a look into this. And knowing what application was used to generate the CGNS data, would also make it easier to diagnose what can be done. Nonetheless, I'm guessing that with ParaView, it's best to export each time snapshot into independent files, and then open the group. For example, export the CGNS data into these files: Code:
data_001.cgns data_002.cgns data_003.cgns data_004.cgns It could also be something like this: Code:
data_000.cgns data_010.cgns data_020.cgns data_030.cgns Bruno |
|
February 20, 2014, 10:22 |
|
#4 | |
Senior Member
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 211
Rep Power: 16 |
Quote:
I am working together with Felipe on that problem, we created one master cgns file that contains the grid coordinates and connectivity array (unstructured, hexa-8 mesh) and then we have created several flow solutions which link to the master cgns file (since it is an unsteady DNS simulation, we wanted to split the files to make them handable). this is all done in fortran. you can have a look here: www.siteless.de/CGNS.tar.gz it contains the master cgns file, 3 example flow solutions and the fortran subroutine how it is created (master and flow solution). the idea is to link from the master file to the flow solution (not the other way around since the timesteps are also stored in the master cgns file and everything should be available in that file) we would be glad if you have any ideas to what the problem could be kind regards, tom |
||
February 22, 2014, 14:35 |
|
#5 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi Tom,
I've done some research on the code that ParaView uses and the critical class is "avtCGNSFileFormat", which is part of the VistIt-Bridge, located in the folder "Utilities/VisItBridge/databases/CGNS" in ParaView's source code. The code is maintained outside of ParaView, for which there is a mirror here: https://github.com/robertmaynard/Vis...databases/CGNS This VisIt Bridge is roughly explained here: http://www.paraview.org/Wiki/VisIt_Database_Bridge The most recent version of this source code is at VisIt's repository: http://portal.nersc.gov/svn/visit/tr...atabases/CGNS/ - but it didn't change much. The problem is that this class (whichever version) cannot open more than one file at a time and it does not have a way to interconnect between several instances of the same class. The way I see it, you've got a few ways to address this issue:
Best regards, Bruno |
|
February 22, 2014, 14:50 |
|
#6 |
Senior Member
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 211
Rep Power: 16 |
Thanks for looking into that! However, we failed one step before that, when actually creating the links inside the file. Linking from the flow solution data to the geometry works fine but linking from the geometry to the flow solution failed. Since paraview seems to support cgns links (when flow solution links to geometry, i.e. the flow solution file contains only the flow solution and the geometry is in the linked, separate, file) I suspected that the other way around shouldn't give any problems, but as i've said, we've failed at creating the actual links. And since this is all done for DNS simulation, writing the grid at every time step (we are talking about ~10^8 cells) is not feasible.
But your information are non the less very valuable, I was running into some VisIt compatibility problems before, seems to be because of what you just mentioned. |
|
February 22, 2014, 15:41 |
|
#7 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi Tom,
Mmm... then I suggest that you have a look into XDMF (XML + HDF5): http://en.wikipedia.org/wiki/XDMF Of course you could also try and create a new XDMF format that relies on CGNS for heavy data, but... someone did try this back in 2006, where CGNS was using HDF5: http://www.paraview.org/pipermail/pa...ry/002445.html but this is waaaay too messy... Best regards, Bruno |
|
March 3, 2014, 18:15 |
CGNS and Paraview
|
#8 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 |
Hi all,
I'm having the same problem reading the data with Paraview. I have several cgns files which were created using CGNS 3.2.1 cgns_1.cgns cgns_2.cgns cgns_3.cgns ... cgns_500.cgns When I try to load them as a group, Paraview only loads the first time, and is not able to advance in time using the time controls. I get the following message from PV: *** Warning:The file being read is more recent that the CGNS library used *** Has anyone found a way to fix this issue? Thanks, Tony |
|
March 4, 2014, 05:44 |
|
#9 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi Tony,
From my investigation into the source code, that I reported in post #5, the conclusion was that the plug-in is hard-coded to load CGNS data only from a single file. In your case, a few questions:
Best regards, Bruno |
|
March 4, 2014, 15:29 |
|
#10 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 |
Hi Bruno,
Thanks for your reply. 1. Each file has both mesh and data. 2. Each file has one time frame. I'm trying now to write the time history onto the CGNS file and have only one file with all the time history. I'll report back soon. Thanks, Tony |
|
March 4, 2014, 15:49 |
|
#11 | |
Senior Member
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 211
Rep Power: 16 |
Quote:
Code:
c--write time dependence c--t is the number of timesteps call cg_biter_write_f(index_file,index_base, # 'TimeIterValues',t,ier) call cg_goto_f(index_file,index_base,ier, # 'BaseIterativeData_t',1,'end') c--create array that stores the total time (well obviously that is case dependend) do time=1,t ta(time) = 0.5*real(time)-0.5 enddo c--write time array to cgns call cg_array_write_f('TimeValues',RealSingle, # 1,t,ta,ier) c--write zone for transient solution call cg_ziter_write_f(index_file,index_base, # index_zone,'ZoneIterData',ier) c--goto zone iterative data call cg_goto_f(index_file,index_base,ier, # 'Zone_t',1,'ZoneIterativeData_t',1,'end') c--link flowsolutions to timesteps c--flowarray (from 1:t) holds the name of the flow solutions, i.e. c--flowsolution001, flowsolution002, flowsolution003 etc. c--these will be the names for your flow solution nodes idata(1) = 32 idata(2) = t call cg_array_write_f('FlowSolutionPointers',Character, # 2,idata,flowarray,ier) c--tell cgns that it is a transient solution call cg_simulation_type_write_f(index_file,index_base, # TimeAccurate,ier) |
||
March 18, 2014, 15:45 |
cgns_to_vtk
|
#12 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 |
Hi all,
So after spending too much time on this I've decided the best way to go is the following. I use the utility cgns_to_vtk to convert the files to VTK and that should load them into paraview without too much trouble. I use the following bash script to go through all the files and convert them. Code:
for file in ./*.cgns do filename="${file//.cgns/}.vtk" /usr/local/cgns/bin/cgnstools/cgns_to_vtk $file mv Zone.vtk $filename done Cheers, Tony Last edited by tonyuprm; March 20, 2014 at 21:57. |
|
November 21, 2016, 02:55 |
Seeking help with similar issue
|
#13 |
New Member
Chaitanya Raj Goyal
Join Date: Nov 2016
Posts: 4
Rep Power: 10 |
Hey Guys,
I observed that the discussion here seemed relevant to my problem. So sharing it here. I am solving a 2D hyperbolic PDE, which gives me a solution in 'x' and 'y' direction for each node on the mesh, for each time step. Therefore, if I freeze the time step, I have a solution vector in 'x', and 'y', for the whole mesh, i.e., a single value in both 'x' and 'y' direction, for each node on mesh. It looks like this when the solution is initially viewed in Paraview at a certain time step. Observe any one frame of the below. You can notice the 'x' and 'y' solution for all points (nodes). The no. of rows is the total no. of nodes on mesh. Then, I convert this vtk file to .csv, and import it to MATLAB, where I run some post processing on the 'x' and 'y' solution vectors. Now, I have replaced the originally imported solution vectors 'x' and 'y', with some new values. I wanted to take back these new solutions to Paraview again for plotting. So I used a tool called vtktrisurf in MATLAB. The problem was that this tool only takes 1 solution vector, i.e., I can either give the 'x' solution vector or 'y'. So, I used pythagoras theorem on respective elements of 'x' and 'y' solutions, to generate a single vector. The vtk was created, and the simulation in PARAVIEW was exactly what I was hoping to see. However, when I use pythagoras theorem, I convert all negative components of the solution to positive. It will show me what I want to see when there is no scalar warping. However, when I warp it with scalar in Paraview, it shows the entire profile in positive values. That is not actually true, because there were negative values in the solution. Long story short, how can I view the correct simulation. Maybe the answer goes back to the point where I convert my matrix in MATLAB to vtk. I also have the option of creating a separate vtk for 'x' solution and separate for 'y'. In that case, is there a way to superpose them in Paraview to view the correct profile? How to join them to get a single datum? If you look at the image below (also attached), you see the 'group solution', 'x - solution, 'y - solution', and the original solution. So, now from here, how can I join the 'x' and 'y' solution and view something like the original solution? I would really appreciate your time and help! Thanks a lot! Chaitanya |
|
November 21, 2016, 05:46 |
|
#14 |
Senior Member
Tom-Robin Teschner
Join Date: Dec 2011
Location: Cranfield, UK
Posts: 211
Rep Power: 16 |
I think the paraview mailing list (http://www.paraview.org/mailing-lists/) is a better place to ask for a solution. Are you using this script here: https://uk.mathworks.com/matlabcentr...t/vtktrisurf.m ? I'm not familiar with the VTK format but wouldn't it be easiest to simply modify this file to suit your needs (i.e. output the vector/scalars you want in the first place)?
|
|
November 21, 2016, 10:16 |
RE
|
#15 |
New Member
Chaitanya Raj Goyal
Join Date: Nov 2016
Posts: 4
Rep Power: 10 |
Thanks for your reply Tom! Yes, that is exactly the tool I m using. As I described the problem in my question, could you kindly suggest how would you modify the file? I can send you a sample .csv, if you could spare some time.
Thanks a lot for your time! Chaitanya |
|
December 7, 2017, 05:09 |
|
#16 |
New Member
Join Date: Feb 2016
Posts: 21
Rep Power: 10 |
In the most recent version 5.4.1, Paraview supports loading of multiple CGNS files at a time. Paraview "groups" cgns files with the same prefix but different numbering. By Clicking File > Open... you are able to open the whole group or single files. In my case, I have cgns files from a transient run of Ansys CFX. It was not necessary to also import the *_mesh.cgns file from Ansys.
|
|
Tags |
cgns, paraview, visit |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Installation Problem with OF 6 version | Aurel | OpenFOAM Community Contributions | 14 | November 18, 2020 17:18 |
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 | towanda | OpenFOAM Community Contributions | 6 | September 5, 2015 22:03 |
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 | Seroga | OpenFOAM Community Contributions | 9 | June 12, 2015 18:18 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 13:41 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 06:18 |