CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Accessing internal field and mesh from within boundary condition

Register Blogs Community New Posts Updated Threads Search

Rate this Entry

Accessing internal field and mesh from within boundary condition

Posted August 6, 2016 at 08:00 by kaifu

very useful.
Quote:
Originally Posted by mchurchf View Post
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:

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()];
    }
Posted in Uncategorized
Views 1147 Comments 0 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 0

Comments

 

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