|
[Sponsors] |
March 23, 2009, 04:19 |
How to get the face numbers of a boundary?
|
#1 |
New Member
Shui Pei
Join Date: Mar 2009
Posts: 27
Rep Power: 17 |
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 |
|
March 24, 2009, 02:01 |
face number for boundary mesh
|
#2 |
Member
|
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"; } } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commercial meshers] Face ordering problem for nonrectangular cyclic boundary conditions | cfdmarkus | OpenFOAM Meshing & Mesh Conversion | 3 | August 17, 2011 16:07 |
[Commercial meshers] Internal boundary problem | stefanke | OpenFOAM Meshing & Mesh Conversion | 2 | May 24, 2011 03:21 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 15:11 |
Boundary condition vector field gradient from two sides of patch face | quba | OpenFOAM | 0 | December 12, 2007 06:26 |
Gambit: face mesh starts at edge, not boundary lr | Chris Bailey | FLUENT | 0 | December 5, 2005 14:50 |