|
[Sponsors] |
March 31, 2020, 04:49 |
Search adjacent cells and assign
|
#1 |
New Member
Join Date: Mar 2020
Posts: 23
Rep Power: 6 |
Hello, my dears.
I want to loop over all the cell in the computational domain, search the four or eight neighbor cells and assign at each timestep. It can be implemented in Fluent via the macros of c_face_loop and C_F0. How about on OpenFOAM? |
|
March 31, 2020, 13:06 |
|
#2 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
Neighbour cells can be accessed via cellCells(). So off the top of my head it would be something like :
Code:
forAll(mesh.C(), celli) //outer, all cell loop { label curCell = mesh.C()[celli]; labelList curNeiCells = mesh.cellCells()[curCell]; forAll(curNeiCells, cellj) //inner, neighbor cell loop { do something here... } } Caelan |
|
April 14, 2020, 05:21 |
reply to Caelan
|
#3 |
New Member
Join Date: Mar 2020
Posts: 23
Rep Power: 6 |
Dear Caelan,
Appreciate for your relpy! Your reply help me learn more on OpenFOAM. I will try the method on my program and share the result with you. Best wishes! |
|
Tags |
cell, openfoam, programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mass source term to boundary cells adjacent to a wall | Kimia | Fluent UDF and Scheme Programming | 7 | November 15, 2020 11:53 |
decomposePar: how to distribute cells unevenly? | floquation | OpenFOAM Pre-Processing | 4 | February 25, 2017 05:15 |
How to assign different values for every cells in a part of the domain | clktp | OpenFOAM Pre-Processing | 0 | April 1, 2016 12:45 |
assign values to selected cells | zxj160 | OpenFOAM Pre-Processing | 4 | June 29, 2012 13:17 |
How to Reference an Adjacent Cell in a UDF ? | jeff8541 | FLUENT | 0 | March 8, 2011 11:33 |