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/)
-   -   get edge points for inlet boundary condition (https://www.cfd-online.com/Forums/openfoam-programming-development/117276-get-edge-points-inlet-boundary-condition.html)

pastilha May 6, 2013 03:55

get edge points for inlet boundary condition
 
Hi,

I am trying to implement an inlet boundary condition in which the velocity changes accordingly to the distance to the wall. Ideally I would like to have it change differentely with each of the edges of my inlet condition (assuming a square inlet face).

The approach I had in mind was to collect all the points corresponding to the edge of my boundary condition, and then loop through each internal point of the face, finding its distance to the edges by intersecting a normal vector with the edge point list.

And this is where I have hit a wall, I cannot seem to get the edge point list for my boundary condition, I thought it would be something along the lines of:

Code:

    const vectorField& c = patch().Cf(); // boundary face's cell centers
    const vectorField& e1 = patch().edges(); // Idea 1 for the boundary edge points
    const vectorField& e2 = patch().Sf(); // Idea 2 - saw somewhere that this would give cell centers and edge points...but to no avail.

Perhaps I am not considering the right approach, any help on the matter would be very welcome.

Thanks in advance,

Pedro

niklas May 6, 2013 04:15

Code:

    const polyBoundaryMesh& patches = mesh.boundaryMesh();
    label id = mesh.boundaryMesh().findPatchID(name);

    const labelList& addr = patches[id].meshPoints();
    const vectorField& bSf = patches[id].faceNormals();
    const edgeList& edges = patches[id].edges();
    const labelListList& ef = patches[id].edgeFaces();


pastilha May 7, 2013 03:05

Thanks Niklas,

I ended up implementing a slight variation of what you suggested, I found my boundary mesh through my BC's fvPatch patch() as I did not have the mesh explicitly defined in my boundary condition. It does seem to work ok for what I need.

Code:

    label id = patch().boundaryMesh().findPatchID("terrain_patch0");
    const polyPatch& b = patch().boundaryMesh()[id].patch();
    const vectorField& bc = b.faceCentres();

Thanks once again for the help.

Cheers,

Pedro


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