OpenFOAM의 경계 영역 계산하기

1050 단어 OpenFOAM
OpenFOAM에서 다음과 같은 경계의 면적을 계산합니다.
//   inlet  patch ID
label patchID = mesh.boundaryMesh().findPatchID("inlet"); 

//   inlet polyPatch     
const polyPatch& cPatch = mesh.boundaryMesh()[patchID]; 

//       magSf,               
const surfaceScalarField& magSf = mesh.magSf(); 

//     ,     0.0
scalar patchArea = 0.0; 

//   inlet       ,            
forAll(cPatch,faceI) 
{ 
    patchArea += magSf.boundaryField()[patchID][faceI]; 
} 

//   inlet        
Info << "Patch Area " << patchArea << endl; 

또는
label patchID = mesh.boundaryMesh().findPatchID("inlet");


const polyPatch& cPatch = mesh.boundaryMesh()[patchID];


const surfaceScalarField& magSf = mesh.magSf();


//     gSum    inlet   
scalar AREA = gSum(magSf.boundaryField()[patchID]);


Info << "AREA = " << nl << AREA << endl;

참조 자료:
https://www.cfd-online.com/Forums/openfoam-solving/59251-how-access-faces-patch.html 
 

좋은 웹페이지 즐겨찾기