CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Loop over faces of cell (https://www.cfd-online.com/Forums/openfoam-programming-development/238116-loop-over-faces-cell.html)

Pyrokrates August 24, 2021 10:12

Loop over faces of cell
 
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.

mAlletto August 27, 2021 14:59

A face has always two cells which it is bounding. On which cell owner or neighbor you want to base your I else statement?


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