CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Cell number from UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 21, 2017, 11:21
Default Cell number from UDF
  #1
New Member
 
Rakesh
Join Date: Jan 2014
Location: Delft
Posts: 13
Rep Power: 5
rsarma is on a distinguished road
Hello,

I am writing a parallel UDF code for a deforming mesh problem. Basically I want to update the cells of a boundary at every time step. This update is based on a matrix which I read into my code. Each element of this matrix corresponds to a cell centre in the boundary that needs to be updated.

My problem is since the mesh is updating at each time step, it's coordinates change. As such, I cannot identify the cells and read the matrix values for a particular cell.

I was wondering if it possible to write the cell ID to a file? Or could you kindly give me any other suggestions?

Best,
R
rsarma is offline   Reply With Quote

Old   March 23, 2017, 09:33
Default
  #2
New Member
 
KirMaks
Join Date: Aug 2016
Posts: 27
Rep Power: 2
kirmaks is on a distinguished road
Hallo,

I've recently thought about similar problem. You may use UDM to store the cell's ID and then use it to get the required element of the matrix. Several steps are required:

1. store the cell's number and its coordinates (if required) in UDM, you may also save these data in a text for analysis how to order the elements in the matrix (DEFINE_ON_DEMAND).

2. use the stored ID's from UDM to access the matrix elements during iterations.

That's it, good luck and have a nice day.
Regards, Maks
kirmaks is offline   Reply With Quote

Old   March 23, 2017, 10:00
Default
  #3
New Member
 
Rakesh
Join Date: Jan 2014
Location: Delft
Posts: 13
Rep Power: 5
rsarma is on a distinguished road
Hi Maks,

Thank you for the reply. I will implement it. What is actually the macro for extracting the cell ID. I saw somewhere there is C_ID(cell_t c,Thread*t), but I am not quite sure if this exists as I could not locate it in the fluent udf manual. Could you kindly let me know?

Best,
R
rsarma is offline   Reply With Quote

Old   March 23, 2017, 10:12
Default
  #4
New Member
 
KirMaks
Join Date: Aug 2016
Posts: 27
Rep Power: 2
kirmaks is on a distinguished road
I'm not sure, You may define Your own indexing based for example on the coordinates. May be looping is also always done in the same order. You may check it. It also states in the help that
Quote:
face_t is an integer data type that identifies a particular face within a face thread.
cell_t is an integer data type that identifies a particular cell within a cell thread.
so You may check what value has the appropriate variable when You are looping throug the cells or faces.
Regards, Maks
kirmaks is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error snappyhexmesh - Multiple outside loops avinashjagdale OpenFOAM Native Meshers: snappyHexMesh and Others 50 March 7, 2016 03:35
foam-extend_3.1 decompose and pyfoam warning shipman OpenFOAM 3 July 24, 2014 08:14
decomposePar no field transfert Jeanp OpenFOAM Pre-Processing 0 June 20, 2014 05:59
Cluster ID's not contiguous in compute-nodes domain. ??? Shogan FLUENT 1 May 28, 2014 15:03
FvMatrix coefficients shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 14:38


All times are GMT -4. The time now is 15:01.