-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with Paraview and CGNS files generated with Cassiopee #77
Comments
Hi Ricardo, Concerning the contour option, is your field located in centers or nodes in your cgns file? Concerning iterative data, your cgns seems correct. I ll try to get more information. Have a nice day |
Hi Benoit, Thanks for your time, I updated my subroutines to move the outpost data to nodes, and it didn't change anything in ParaView. def extract_vars(t: Any, vars: List[str]) -> Any:
new_vars = ["centers:" + var for var in vars] + ["CoordinateX", "CoordinateY", "CoordinateZ"]
t_outpost = C.extractVars(t, new_vars) # extract variables
t_outpost = Cmpi.center2Node(t_outpost, new_vars) # convert centers to nodes
return C.rmGhostCells(t_outpost, t_outpost, hlo_rhs - 1, adaptBCs=1, modified=[]) # remove ghost cells
def write_snapshot(file_number: int, t: Any, mpi: bool, timestamp: float = 0.0, iteration: int = 0, restart_vars: List[str] = None):
fname = f"snapshot{file_number:06d}.cgns" if file_number != 0 else "initial_condition.cgns"
t_export_disk = extract_vars(t, restart_vars) if restart_vars else t # full tree if initial condition
print0(f"Writing file: {fname} at time: {timestamp:.6f}")
# Update the time and iteration values
BaseIterativeData = Int.getNodeFromName(t, "BaseIterativeData")
IterationValues = Int.getNodeFromName(BaseIterativeData, "IterationValues")
TimeValues = Int.getNodeFromName(BaseIterativeData, "TimeValues")
Int.setValue(node=IterationValues, value=iteration)
Int.setValue(node=TimeValues, value=round(timestamp, 8))
if mpi:
Cmpi.convertPyTree2File(t_export_disk, fname)
else:
C.convertPyTree2File(t_export_disk, fname) Cordialement, |
Hard to say, but if you provide a small cgns file containing your t_outpost, i can try to look at it. |
Hello, After further inspection, I can now select Point Arrays alongside Cell Arrays in ParaView. Still, isocontours appear quite erratic, and I am unable to view the time stamps. Here is a snapshot000008.cgns.zip](https://github.com/user-attachments/files/16128849/snapshot000008.cgns.zip) generated by the routines I shared previously. Hopefully, your expert eyes can find any inconsistencies. Thanks for your time, |
Hi Ricardo, Here is a short example of BaseIterativeData for 2 zones with 2 times that load in paraview: import Converter.PyTree as C
import Generator.PyTree as G
import Converter.Internal as Internal
a1 = G.cart((0,0,0), (1,1,1), (10,10,10)); a1[0] = 'cart1'
a2 = G.cart((9,0,0), (1,1,1), (10,10,10)); a2[0] = 'cart2'
t = C.newPyTree(['Base', a1, a2])
# instant must be in differents FlowSolutions
Internal.__FlowSolutionNodes__ = 'FlowSolution#001'
C._initVars(t, '{F}={CoordinateX}')
Internal.__FlowSolutionNodes__ = 'FlowSolution#002'
C._initVars(t, '{F}={CoordinateX}+1')
# add to base
b = Internal.getNodeFromName1(t, 'Base')
it = Internal.newBaseIterativeData(nsteps=2, parent=b)
Internal.createChild(it, 'TimeValues', 'DataArray_t', [0.1, 0.2])
Internal.createChild(it, 'NumberOfZones', 'DataArray_t', 2)
Internal.createChild(it, 'ZonePointers', 'DataArray_t', [['cart1'.ljust(65), 'cart2'.ljust(65)], ['cart1'.ljust(65), 'cart2'.ljust(65)]])
# add to zones
for a in [a1,a2]:
zt = Internal.newZoneIterativeData(parent=a)
Internal.createChild(zt, 'FlowSolutionPointers', 'DataArray_t', ['FlowSolution#001'.ljust(32), 'FlowSolution#002'.ljust(32)])
Internal.printTree(t)
C.convertPyTree2File(t, 'out.cgns') |
Hello, Thank you very much for your help. Indeed, it works as I expected. However, I believe it would be better to have each snapshot in a separate file rather than in a single file, especially for moving data around. Currently, I am unable to load the files as a group, such as a series of 100 snapshots each with a timestamp. Best regards, |
Hi, # - HDF write with links -
import Generator.PyTree as G
import Converter.PyTree as C
import Converter.Internal as Internal
a = G.cart((0,0,0),(1,1,1),(50,50,50))
C._initVars(a, 'Density=1.')
t = C.newPyTree(['Base',a])
# Save file with links
links=[['.','coord.hdf','/Base/cart/GridCoordinates','/Base/cart/GridCoordinates']]
C.convertPyTree2File(t, 'main.hdf', links=links)
# Write pointed file
Internal._rmNodeByPath(t, '/Base/cart/FlowSolution')
C.convertPyTree2File(t, 'coord.hdf') |
Hi @ricardofrantz , Isn't your cgns file broken?
while the mesh connectivity displayed in |
Hi,
I'm experiencing an issue, and I'm not sure where to post this question, so I'm trying here in the GitHub issues.
We are running simulations with Cassiopee, and I need to export snapshots to open them in ParaView for visualization, such as creating videos.
Issue 1: The contour option in ParaView is not available after opening the CGNS file. Is this a known issue? Are there additional steps or information we need to add to the file to support contour visualization?
Issue 2: How can I open a series of files and add time stamps to them in ParaView?
I am attempting the following, but ParaView does not recognize the time stamps:
This is what I am doing: initialize the time nodes on the tree...
and then upon runtime:
Any assistance or guidance on these issues would be greatly appreciated.
Thank you!
The text was updated successfully, but these errors were encountered: