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/)
-   -   Shortest distance between cell and boundary (in parallel) (https://www.cfd-online.com/Forums/openfoam-programming-development/168475-shortest-distance-between-cell-boundary-parallel.html)

ripudaman March 23, 2016 00:26

Shortest distance between cell and boundary (in parallel)
 
Hello FOAMers,

I have a topologically changing mesh where the boundary changes in size by splitting the internal faces and converting them to boundary faces. This is illustrated using the ACP methodology in the solidMechanics solvers.

I want to dynamically refine my mesh based on distance from this growing boundary. So basically I would like to create a volScalarField (or scalarField) that I could use in the dynamicRefinement dictionary.

So, in short, I want a method to calculate the shortest distance between a cell and a boundary patch. I could do this myself but I anticipate parallelization of that procedure to be a difficult detail to handle. Thus, before I dive into it I wanted to ask my dear FOAMers if they have ever done anything like this before. Is there anything out there that could help me?

Thanks.
Cheers,
Ripu

chriss85 March 23, 2016 04:31

See this thread for a function to gather decomposed fields (such as cell or face centres) from all the processors: http://www.cfd-online.com/Forums/ope...processor.html

Once you have all the positions it's simply a matter of searching for nearest distance. I expect this to be quite slow though, of order O(n^1.666), with n being the number of cells, so I would think about doing some kind of nearest neighbour search, starting from the face which was closest last time if possible.

ripudaman March 23, 2016 08:45

That's an interesting idea. I can probably map the global field below sorting to help keep track. The slowness is what bothers me though. I wanted to do this inside a loop that will be called 100s of times in small meshes and 1000s in larger meshes. That'll make it very slow. I was thinking of using a cell-cell approach but I am not sure if it will be easy to go across processor boundaries. Any suggestions or best practices?


All times are GMT -4. The time now is 22:40.