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

Loop over faces of cell

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 24, 2021, 10:12
Default Loop over faces of cell
  #1
Member
 
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 5
Pyrokrates is on a distinguished road
Hey,


I have a surfaceScalarField phi2 which is kind of same like flux phi from U.


Now I would like to combine phi and phi2 in another field phiFinal.
To decide, which value of phi/phi2 needs to be added, I loop over all cells and check the value of my volScalarField A inside this cell.


How can I change the values?


At the moment I just know how to get the faces of my cell like this
Code:
forAll(A,celli)
{
    const labelList& faces = mesh.cells()[celli]; // returns "6(a b c d e f)"
    if(A[celli] < 0)
    {
        // Now I would like to add phi_face_value to phi3_face_value
    }
    else
    {
        // Now I would like to add phi2_face_value to phi3_face_value

    }
}
Another problem for me is the difference between internal and boundary faces... phi shows a list of internalField and the calculated boundary... How can I achieve this, if I assign phi3 like I want to.


Thanks in advance


Chris.
Pyrokrates is offline   Reply With Quote

Old   August 27, 2021, 14:59
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
A face has always two cells which it is bounding. On which cell owner or neighbor you want to base your I else statement?
mAlletto 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
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface Kryo OpenFOAM Meshing & Mesh Conversion 13 February 17, 2022 07:34
[snappyHexMesh] Help with Snappy: no layers growing GianF OpenFOAM Meshing & Mesh Conversion 2 September 23, 2020 08:26
[snappyHexMesh] layer not added Rasmusiwersen OpenFOAM Meshing & Mesh Conversion 1 January 2, 2020 09:43
Need help setting up chtMultiRegion OskarT OpenFOAM Pre-Processing 1 September 25, 2019 15:51
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops avinashjagdale OpenFOAM Meshing & Mesh Conversion 53 March 8, 2019 09:42


All times are GMT -4. The time now is 08:42.