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

How to extract variables at boundary and internal cells !!

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

Like Tree2Likes
  • 1 Post By Jagan G
  • 1 Post By random_ran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 14, 2020, 08:07
Question How to extract variables at boundary and internal cells !!
  #1
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Foamers, Hope everyone doing good. Here in the attachment, the image contains nodal points at boundary and internal cells for 1D problem.
POINT 0 - Boundary node
POINTS 1,2,3 - Internal nodes

In order to extract variables at the boundary node (@ POINT 0), the below code was implemented, compiled good and end with reasonable results.
Quote:
forAll (regionMesh().boundaryMesh(), patchI)
{
forAll(T_.boundaryField()[patchI], faceI)
{
scalar tK_ = K_.boundaryField()[patchI][faceI]; //VARIABLE K_ extracted from boundary POINT 0
scalar tT_ = T_.boundaryField()[patchI][faceI]; //VARIABLE T_ extracted from boundary POINT 0
QB_[cellI] = tK_* (tT_ - Tliq) / DX.value(); //Heat evaluation based on K_ & T_
}
}
However, I would like to have some clue as how to extract the variables at the internal nodes (POINTS 1,2,3). Correct me if I'm wrong anywhere please.
Kindly someone share some ideas.
Thank you
Attached Images
File Type: png Boundary and Internal nodes.PNG (16.6 KB, 23 views)
Kummi is offline   Reply With Quote

Old   August 14, 2020, 13:52
Default
  #2
New Member
 
Jaganathan
Join Date: Sep 2019
Posts: 2
Rep Power: 0
Jagan G is on a distinguished road
I have similar issues with 3D model.
Cell-centred calculation for internal cells is optable in my case.
Kummi likes this.
Jagan G is offline   Reply With Quote

Old   August 14, 2020, 22:30
Default
  #3
Member
 
Ran
Join Date: Aug 2016
Posts: 69
Rep Power: 9
random_ran is on a distinguished road
Quote:
Originally Posted by Kummi View Post
Hello Foamers, Hope everyone doing good. Here in the attachment, the image contains nodal points at boundary and internal cells for 1D problem.
POINT 0 - Boundary node
POINTS 1,2,3 - Internal nodes

In order to extract variables at the boundary node (@ POINT 0), the below code was implemented, compiled good and end with reasonable results.However, I would like to have some clue as how to extract the variables at the internal nodes (POINTS 1,2,3). Correct me if I'm wrong anywhere please.
Kindly someone share some ideas.
Thank you
Not sure this can help you or not.

You can access the `k` value by referencing the cellId`

`scalar k = turbulence->k()()[cellId];`

Then interpolated it to the patch face. After that, interpolated it to
the node of your interest. I never did this before, but I speculate
there's mature functions to let you do this within native OpenFOAM.
Kummi likes this.
__________________
Yours in CFD,

Ran
random_ran is offline   Reply With Quote

Old   August 15, 2020, 11:49
Default
  #4
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Thank you for your response, Jaganathan and Ran.

Accessing the cellId may be required for specific purpose (for example, to imply the source term). Near the boundary, the cell ids are accessed through the boundary condition. So, I have created a patch based on boundaryMesh and obtained the values at the boundary.

For obtaining values at internal cells, I tried accessing neighbor cells, as in code below.
Quote:
const Foam::List<int> neigbhorcellI = regionMesh().cellCells(cellI);//gives the neighbours of cell cellI
forAll(neigbhorcellI, I) //Loop inside internal cells
{
QB_[cellI] = K_[I]* ((T_[I] - Tliq) /DX.value());
break ;
}
But the problem here is, the code doesn't loop over all the cells and as a result, the results are not good as expected.
Kindly share your thoughts.

Thank you
Kummi is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
SimpleFoam & Theater jipai OpenFOAM Running, Solving & CFD 3 June 18, 2019 10:11
[blockMesh] Create internal faces as patch in blockMesh m.delta68 OpenFOAM Meshing & Mesh Conversion 14 July 12, 2018 14:43
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 03:21
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50


All times are GMT -4. The time now is 00:46.