Accessing internal field and mesh from within boundary condition
Posted August 6, 2016 at 08:00 by kaifu
very useful.
Quote:
Thank you all for your help,
I was able to implement my boundary condition as well. I used the following code to access the internal velocity field and the mesh two layers of cells inward from the boundary:
I was able to implement my boundary condition as well. I used the following code to access the internal velocity field and the mesh two layers of cells inward from the boundary:
Code:
// Set up access to the internal velocity field and mesh
const volVectorField& U =
db().objectRegistry::lookupObject<volVectorField>(UName_);
const fvMesh& mesh = patch().boundaryMesh().mesh();
forAll(patch(), facei)
{
// get global cell indices for cells adjacent to patch
label celli = patch().faceCells()[facei];
// get global face indices for faces opposite patch face
label oppFacei = mesh.cells()[celli].opposingFaceLabel(facei+patch().patch().start(),mesh.faces());
// get coordinates of center of cell adjacent to patch (patch cells)
vector cellCentreO = mesh.cellCentres()[mesh.owner()[oppFacei]];
// get coordinates of center of cell on the side opposite the patch of
// the patch cell
vector cellCentreN = mesh.cellCentres()[mesh.neighbour()[oppFacei]];
// get coordinates of center of face opposite the patch boundary face
vector faceCentre = mesh.faceCentres()[oppFacei];
// get coordinates of center of patch boundary face;
vector patchFaceCentre = mesh.faceCentres()[facei+patch().patch().start()];
}
Total Comments 0




