|
[Sponsors] |
August 10, 2022, 12:32 |
Acess the owner cell
|
#1 |
Member
Peng Liang
Join Date: Mar 2014
Posts: 59
Rep Power: 12 |
Dear Foamers,
I wan to loop over all face values of a surfaceScalar field, and for some faces of them which could fulfill certain condition, I want to apply a value to its owner cell. Is it possible to do so in OpenFOAM? I have found that mesh().faceOwner() could possibly search for this, could anyone tell me a possible way to do it? Thanks. Regards, Peng |
|
August 10, 2022, 13:11 |
|
#2 | |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34 |
Quote:
Code:
// Take a reference to the owner list: this gives the owner cell index for each internal face // As a by the way, "faceOwner" is for all faces (internal and boundary) whereas "owner" is for just internal faces const labelUList& owner = mesh.owner(); // Assuming you have some volScalarField called myField // Take a reference to the internal field of myField, i.e. the raw list of cell values scalarField& myFieldI = myField.primitiveFieldRef(); // Loop over all internal faces forAll(owner, faceI) { // Owner cell index const label ownCellID = owner[faceI]; // Set value of owner cell in myField myFieldI[ownCellID] = 123456.789; // or what ever you want } // What about the boundary face values for myField? You may want to set something there too? // In any case, you should update the processor boundaries: myField.correctBoundaryConditions() |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF in case with DPM modle | POSTHU | Fluent UDF and Scheme Programming | 0 | March 3, 2021 07:21 |
[Other] Is mesh.sf() points from owner cell to neighbor cell? | cfdopenfoam | OpenFOAM Meshing & Mesh Conversion | 0 | November 3, 2017 10:49 |
Partition: cell count = 0 | metmet | FLUENT | 1 | August 31, 2014 19:41 |
Journal file error | magicalmarshmallow | FLUENT | 3 | April 4, 2014 12:25 |
cell to cell relation | CMB | Siemens | 1 | December 4, 2003 04:05 |