January 24, 2023, 02:51
|
minimum particle wall distance
|
#1
|
New Member
NewtonianGuy
Join Date: Jun 2020
Posts: 10
Rep Power: 6
|
I have the following method using the wallDist Class to compute the minimum distance to a wall from a particle position with a correction factor based on particle position within a cell. However, I want to know which PatchID is the closest ? There is a member function of the WallDist Class named PatchIDLists but it has all wall patchIDs...
Code:
//Minimum distance to wall from cell position
const scalar yw_cell = wallDist::New(this->owner().mesh()).y()[p.cell()];
//Cell position
const vector cell_pos = this->owner().mesh().C()[p.cell()];
// Particle position
const vector p_pos = p.position();
// Wall normal in
const vector normal_wall = -wallDist::New(this->owner().mesh()).n()[p.cell()];
const scalar projection = (p_pos - cell_pos) & normal_wall;
scalar distanceWall = 0;
if (projection >0)
{
distanceWall = yw_cell + projection;
}
else
{
distanceWall = yw_cell - mag(projection);
}
Thank you
|
|
|