How to get the face numbers of a boundary?
I knew I can check the polyMesh directory, however now I am tyring to modify boundary in the solver, and it will deal with different meshes, so which function should I use?
By the way, is their any documents to introduce some common function used in Openfoam, I really don't want to trouble someone... With regards. Pei |
face number for boundary mesh
Hi,
try to go through the below code maybe you can learn something for your question. label patchInletWaterID = mesh.boundaryMesh().findPatchID("outletWater"); const polyPatch& cInletWaterPatch = mesh.boundaryMesh()[patchInletWaterID]; vectorField inletWaterFaceCentres(mesh.C().boundaryField()[patchInletWaterID]); scalarField inletWaterY(inletWaterFaceCentres.component(vector ::Y)); scalarField inletWaterX(inletWaterFaceCentres.component(vector ::X)); forAll(cInletWaterPatch, faceI) { scalar YWaterpos(inletWaterY[faceI]); scalar XWaterpos(inletWaterX[faceI]); vector faceWaterU(vector::zero); if (YWaterpos<=0.2) { faceWaterU.x()=0.1; // U.boundaryField()[patchInletWaterID][faceI] = faceWaterU; // pd.boundaryField()[patchInletWaterID][faceI] = rho.boundaryField()[patchInletWaterID][faceI] *-gh.boundaryField()[patchInletWaterID][faceI]; pd.boundaryField()[patchInletWaterID][faceI] = 0.5*rho.boundaryField()[patchInletWaterID][faceI]*faceWaterU.x()*faceWaterU.x(); // p.boundaryField()[patchInletWaterID][faceI] = 2*pd.boundaryField()[patchInletWaterID][faceI]; cout<< "I am here to change pd value x,y"<<XWaterpos<<"\t"<<YWaterpos<<"\n"; cout<< "gh:="<<gh.boundaryField()[patchInletWaterID][faceI]<<"\n"; cout<< "gamma:="<< gamma.boundaryField()[patchInletWaterID][faceI]<<"\n"; cout<< "rho:="<< rho.boundaryField()[patchInletWaterID][faceI]<<"\n"; cout<<"pd="<<pd.boundaryField()[patchInletWaterID][faceI]<<" P="<<p.boundaryField()[patchInletWaterID][faceI]<<"\n"; } } |
All times are GMT -4. The time now is 01:10. |