CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2

Way to get node index from solution file?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 12, 2023, 13:41
Default Way to get node index from solution file?
  #1
New Member
 
A Roy
Join Date: Sep 2022
Posts: 15
Rep Power: 4
A.Roy is on a distinguished road
Hello SU2 community,

I am looking to construct TargetCp files for some inverse design pressure cases by interpolating from a target solution to the mesh being optimized.

However, at the moment I am interpolating using the surface solution output files, from which I don't think I can find any global index.
I am writing a python script to scrape the x and y coordinates from the interpolated solution file, and scraping the node indices and their corresponding x and y coords from the mesh file, then searching the latter to match to the former...but with my limited algorithms knowledge, this doesn't seem to be very fast (especially for 3D meshes with much larger element counts).

Would anyone know if there is a way to directly get the actual node indices from the solution file in some way? Or is this boundary information lost when creating the solution file or extracting the surface solution subset?

Thank you!
A.Roy is offline   Reply With Quote

Old   December 19, 2023, 17:16
Default Python script to prepend indices to interpolated solution boundary - 2D
  #2
New Member
 
A Roy
Join Date: Sep 2022
Posts: 15
Rep Power: 4
A.Roy is on a distinguished road
Absent a better solution, I am posting my python script below if it may help any readers that come across this in the future.

The script is fairly barebones and inflexible at the moment (and currently only has 2D functionality, although adding 3D functionality is not a particularly involved extension so I might update this at some point, or if anyone wants to have at it for their own work); it takes as input:
- CSV data file containing x, y, Pressure, Mach, Cp headers and fields in that column order
- Name of the boundary marker that the indices need to be scraped from (currently 1 boundary at a time)
- Mesh file that the solution is interpolated to, must be in SU2 format
- Name of the output file that the inverse design style output is written to; it is written mimicking the TargetCp.dat format in the SU2 Inverse Design test cases such that the fields are Index, x, y, Pressure, Cp, Mach in that order
Attached Files
File Type: txt write_targetCP_indices-2D.py.txt (3.5 KB, 2 views)
A.Roy is offline   Reply With Quote

Old   December 20, 2023, 07:26
Default
  #3
Senior Member
 
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 596
Rep Power: 17
bigfootedrockmidget is on a distinguished road
The indices in the SU2 mesh and the indices in the restart file are the same. I think even the indices in the paraview file are the same as the su2 mesh.


The pressure coefficient is saved in the restart file, so you could go to the mesh, grab the global indices of the marker there and then go to the restart file with that information. You can even save the restart file in ASCII format with OUTPUT_FILES=RESTART_ASCII.
bigfootedrockmidget 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
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 11:46


All times are GMT -4. The time now is 20:35.