|
[Sponsors] |
How to find the cell distance from a patch in openfoam? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 23, 2017, 10:26 |
How to find the cell distance from a patch in openfoam?
|
#1 |
Member
Phanindra
Join Date: Jan 2013
Posts: 39
Rep Power: 13 |
Hi foamers,
can any one of tell me how can we find the distance between an internal cell from an inlet in openfoam I need to use it as part of my code not as post processing Regards, Phanindra |
|
September 23, 2017, 17:06 |
|
#2 |
Member
Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 10 |
label patchID = mesh.boundaryMesh().findPatchID("name of your patch");
labelList InternalFieldNextToPatch = mesh.boundaryMesh()[patchID].faceCells(); //// Gives List of cell IDs label next to patch////// DynamicList<vector> Distance(0); /// distace betwen face center of patch and cell center of cell next to patch if ( InternalFieldNextToPatch.size() == mesh.boundaryMesh()[patchID].size() ) // check weather patch size and list of cell ids is same or not/// this code may or may not work after usting refinemesh ///// { forAll(InternalFieldNextToPatch, I) { Distance.append(mesh.C()[InternalFieldNextToPatch[I]] - mesh.Cf().boundaryField()[patchID][I] } } save in some distance.H n include or you can also use OR use scalarField Dis = 1.0/mesh.deltaCoeffs().boundaryField()[patchID]; If you are using 4.z, plus or 5.x version at place of boundaryField() use boundaryFieldRef() I hope I did not do any typing mistake in code |
|
September 24, 2017, 07:00 |
Thank you Wang
|
#3 |
Member
Phanindra
Join Date: Jan 2013
Posts: 39
Rep Power: 13 |
Does the procedure works even for the internal cells and boundary patch distance?
|
|
September 25, 2017, 02:57 |
|
#4 | |
Member
Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 10 |
Quote:
Distance between two internal Fields use [cellIDs] if you do not know cellIDs use the code I wrote. |
||
September 25, 2017, 08:00 |
Hi
|
#5 |
Member
Phanindra
Join Date: Jan 2013
Posts: 39
Rep Power: 13 |
Thanks . I will give it a try
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find distance from a cell to a Boundary patch | oehmu | OpenFOAM Programming & Development | 1 | March 22, 2016 23:47 |
interFoam running blowing up | sandy13 | OpenFOAM Running, Solving & CFD | 2 | May 5, 2015 07:16 |
createPatch Segmentation Fault (CORE DUMPED) | sam.ho | OpenFOAM Pre-Processing | 2 | April 21, 2014 02:01 |
How to find the flux through each cell in a each boundary patch? | Hale | OpenFOAM Pre-Processing | 0 | September 13, 2013 08:52 |
CheckMeshbs errors | ivanyao | OpenFOAM Running, Solving & CFD | 2 | March 11, 2009 02:34 |