Accessing all cells that are next to a wall
Hi,
I am stuck on a combustion model. I have implemented a source term (a volScalarField). I need to recalculate the source term in every timestep but force it to be zero in all cells that are next to a wall. Can anybody help me how to get the information which cells are next to a wall? |
Quote:
Then loop over those faces - the face owner() is the cell ID that you are looking for. |
Alternatively, you can specify:
mesh.boundaryMesh()[patchI].faceCells(); to obtain a list of cells adjacent to patchI. |
Hi Florian,
I have implemented this, for switching off some force coefficients near to walls. Simply use (as already described): Code:
const fvPatchList& patches = mesh.boundary(); Hope that helps :) best, |
Thanks!
Thanks to all of you, that really helped!
Based on Holger's suggestion I make a list of all cells at the beginning of a run Code:
const fvPatchList& patches = mesh.boundary(); I'm not much of a C++ crack, but I suppose that the adding of elements to wallList could be done in a nicer way (append() only works for appending lists, not elements to a list). Then I can refer to this list in every time step to set the source term to zero: Code:
forAll(wallList,i) omegaC[wallList[i]] = 0.0; |
Just to add a little kibitzing ...
Your approach is OK, but it might be faster and more efficient to use a DynamicList of labels instead. This gives you an append() method and should be faster since it avoids too many small resizing operations. For example, Code:
const fvPatchList& patches = mesh.boundary(); Another alternative would be to first note which cells are addressed and then build the label list afterwards. For example, Code:
const fvPatchList& patches = mesh.boundary(); Code:
const fvPatchList& patches = mesh.boundary(); |
Quote:
best, |
Quote:
Initially it may appear somewhat less convenient to use the face owners directly, but you only need to add in the patch start as an offset. Here is what I think would be a useful, and more general implementation: Code:
#ifndef setWallCells_H Code:
const scalar omegaWallValue = SMALL; |
Hello,
Holger, you're writing that it's possible to change patch name in a convenient way via dictionary lookup. Could you please give an example since I can't get it? I would need it both for vol<type>fields and for the fvMesh. Thanks /NW |
Quote:
no, not to change. I was talking just about reading them in. This simply might be accomplished by a word or wordlist (for multiple patches) and an dictionary lookup: For example: Provide this in a dictionary (say in arbitraryNameDict) Code:
wallPatches (wallName1 wallName2); Code:
IOdictionary arbitraryNameDict Hope that helps. best regards, |
Ok, Thanks anyway! I realized however that it's possible via fvMeshSubset to write faces into a user supplied patch which solves my problem.
All the Best /NW |
Dear all,
Neat stuff, thanks for that! :D I would like to do a routine over only internal cells. Is there a function to retrieve the internal cells only? Thank you in advance! |
All times are GMT -4. The time now is 13:18. |