CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Information & Useful utilities

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By s1291

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 10, 2023, 15:20
Red face Information & Useful utilities
  #1
New Member
 
Nico
Join Date: Feb 2018
Location: Turin
Posts: 8
Rep Power: 8
Nico994396 is on a distinguished road
Dear All,
i've a relatively simple question for the Openfoam community:


Is it possible to loop over a specified set of faces and cells that have specified coordinates?
I mean:
Suppose i have a rectangular grid and suppose that i want to iterate over specified cells and faces that have specific coordinates :
At my knowledge one should loop over the the cells, over the INTERNAL faces and over the BOUNDARY FACES and then he should check the coordinate singularly.


Now, does someone know if there is a tool more specific for that?
Thank you.
Nico994396 is offline   Reply With Quote

Old   February 11, 2023, 04:20
Default
  #2
Member
 
s1291's Avatar
 
Join Date: Aug 2017
Location: Algeria
Posts: 98
Rep Power: 8
s1291 is on a distinguished road
You may need to use:

Code:
mesh.findCell(position)
to find a cell by its coordinates.

For faces, you probably need to use:

Code:
mesh.findNearestFace(position)

// for boundary faces, use:
mesh.findNearestBoundaryFace(position)
➡️ Another alternative way to select sets of cells and faces is to use the topoSet utility. You can then read those sets within your code.
Nico994396 likes this.
__________________
"When in doubt, use brute force." -- Ken Thompson
s1291 is offline   Reply With Quote

Old   February 11, 2023, 12:41
Default
  #3
New Member
 
Nico
Join Date: Feb 2018
Location: Turin
Posts: 8
Rep Power: 8
Nico994396 is on a distinguished road
Thank you for your answer!
In general i'm looking for a way to get a "slice" of some points of the domain during the solution process: imagine that you have a rectangular mesh and for every ltime-step you must initialize the vertical field in a certain manner:

The problem is that OpenFoam will loop over all the cells and faces with that function and i think that is not so computationally cheap.


Maybe it will be worth to renumber the cells and the faces ( or creating a sort of key-value which maps my indexes to the indexes of openfoam).
Anyway thanks for your reply
Nico994396 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
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 21:00
[General] Acces to information tab data badoumba ParaView 0 August 8, 2017 10:20
script for export particle information archetype CFX 2 August 8, 2017 09:57
OpenFOAM 2D simulation - Freelancer Job- Information will be provided sanjar CFD Freelancers 0 March 7, 2017 09:45
information from saved data files:Unsteady flow Atul FLUENT 5 July 27, 2008 20:05


All times are GMT -4. The time now is 19:45.