dynamicRefineFvMesh - Protect cells from refinement (boundary)
Hello Forum
In my AMR case, I want to protect wall-cells from refinement. This basically because the y+ size is well defined there and because of other reasons (I have found issues in OpenFOAM 2012 and older versions when tracking a particle with a containing near-wall cell which is being refined / unrefined). The protection of wall boundaries has to be done in dynamicRefineFvMesh.C, however, it has given me issues as mesh() is not defined there. I can assign a SMALL value to the field used for refinement criteria in near-wall cells (already implemented in other thread), but dynamicRefineFvMesh does at least 1-buffer cell refinement, therefore, in many cases, the wall-cells get refined. I don't honestly want to remove the 1-buffer refinement as it would bring many issues. A possible solution would be extending this set value to neighbour cells, but it would hamper the solution accuracy in some regions, so protecting the cells seems a better solution. I've tried something like this (among many other things) : forAll(cells(), celli) { const cell& cFaces = cells()[celli]; // if (cFaces.nFaces() - cFaces.nInternalFaces() > 0) if (cFaces.nFaces() - cFaces.nInternalFaces() > 0) { protectedCell_.set(celli); } } but, of course, it does not work as nInternalFaces() is not defined for cells() (as nFaces is). I am running out of ideas. I would be very happy to receive feedback on this. Naturally, using topoSet to selected all boundaryCells and then saving those to a protectedCells file does not work as the cell-protection decision is performed each refining step inside dynamicRefineFvMesh Thank you for your support |
What if you looped over patches and checked if they're walls? Something like :
Code:
//Protect walls Caelan |
Dear Caelan, thank you very much, it worked just fine!. I was looking at the code because I expected OF to write the protected cells, but anyway, it does not matter. I owe you part of the last objective of my PhD thesis :).
I remember I tried something similar to what you posted, but my mistake was not defining the fvMesh& using "(*this)". I suppose it is possible to include below "if(isA<wallFvPatch>(patches[patchi]))", a specific walll patch name (for example walls1, or walls2?), right? By the way, nice github contributions. Best regards from Bogota, J.A. Gutiérrez. Quote:
|
I'm sure there's a nicer way to do it, but a quick hard code would be something like :
Code:
if (patches[patchi].name() == "wall1") Code:
//Protect some walls Caelan |
Thank you again, I'm going to test it soon and let you know how it works.
|
Hi,
I guess this only works for the first cell at the wall, right? I mean, it prevent just the first cell layer not to be refined right? Not the entire boundary layer mesh. The loop is done over the cells adjacent to the wall if I'm not wrong Can you just confirm if so? Regards Benedetto |
One could use the wall distance field ( see the spalart allmaras model how to create it https://www.openfoam.com/documentati...s.html#details ) the shield the cells from refinement. Maybe this helps
Best Michael |
All times are GMT -4. The time now is 14:52. |