OpenFOAM Tips & Tricks

- 1 OpenFOAM Korea Users’ Community Conference
st

2012. 10. 18 ( 주 ) 넥스트폼

목차 .

utilities, boundary conditions, functions, etc...

Pre­processing Solver setup & solving post­processing

Pre-processing

Mesh generation

BlockMesh SnappyHexMesh

BlockMesh → SnappyHexMesh BlockMeshDict, snappyHexMeshDict Stl file Feature line (OF­2.x)

/constant/triSurface/stator.stl .SnappyHexMesh featureline  feature line extract  surfaceFeatureExtract [options] <surface> <output set> surfaceFeatureExtract ­includedAngle 150 ­writeObj  .obj   feature line convert    ***.eMesh stator.obj  파일은 paraview 에서 확인 가능 ***./stator surfaceFeatureConvert [options] <input file> <output file> surfaceFeatureConvert stator.eMesh  파일은 snappyHexMesh 에서 feature line 으 로 사용  .

001 ­writeZones . cas file ­ ascii type only fluentMeshToFoam ­scale 0./test.Mesh file convert  fluentMeshToFoam [options] <mesh file> Options   ­scale. ­writeSets 2d or 3d msh.msh  Mesh file   Example   fluent3DMeshToFoam . ­writeZones..

Mesh file convert  StarCCM+  ccm26ToFoam <ccm file> plot3dToFoam [options] <plot3d geom file> Options   Plot3d   ­2D <thickness>.grd  Example  .001 test. ­noBlank. ­scale Plot3dToFoam ­noBlank ­scale 0.

001 0. ­rotateFields.Scale. ­rollPitchYaw <vector>. ­region <name>. ­scale  <vector>. translate.001 0.001)’ transformPoints ­translate ’(1 0 0)’ transformPoints ­rotate ’( (1 0 0) (0 0 1) )’  Example    . rotate  transformPoints [options] Options   ­parallel.  ­rotate <(vectorA vectorB)>. ­translate <vector> transformPoints ­scale ’(0.

cell handling  checkMesh   constant/polyMesh 의 구성  checkMesh >  checkMeshResults & tail ­f checkMeshResults sets of points. cells zones of points. faces. cells regions of meshes boundary points  faces neighbour owner pointZones faceZones cellZones sets(directory)    sets     zones     regions     .face.Point. faces.

 clear. add  <source>.Point. invert.face. new <source>.cell handling  setSet  Interactive or batch job Batch job : setSet ­batch <batch file name> cellSet | faceSet | pointSet <setName> <action>  <source> list. remove. subset <source>   set command   action  . delete <source>.

face. cellZones  등의 파일이 수정됨  .cell handling  setSet example  Wrong oriented face 와 high skew face 들과 인접한 cell 들의 set 의 설정 SetSet ­batch batchFileExample batchFileExample  파일의 내용 cellSet test new cellSet test add faceToCell wrongOrientedFaces any cellSet test add faceToCell skewFaces any quit    Make zones from sets  setsToZones ­noFlipMap pointsZones. faceZones.Point.

5 0... ­time. .5 0.       p2 (0. ­noZero. } } ). //boxToCell. ­region <name>.       radius 0..5 0.1.Point.cell handling  topoSet [options] set  을 만드는 다른 방법 options   topoSetDict example actions ( {    name     type    action    source cell1.5).  ­parallel. //pointSet. // any name cellSet. faceSet new.   ­latestTime.6 0.face. cylinderToCell.5). …  system/topoSetdict  파일에서 방 법 지정    sourceInfo    { p1 (0.. // add. delete.

 stator . ­overwrite  subsetMesh   splitMeshRegions [options]   regionCellsets : of16ext only. cellZones 를 만들기 위해 constant/polyMesh/sets 에 cell region 을 써 준다 .Mesh handling  mergeMeshes  mergeMeshes <master case> <case to add> [options] Example   mergeMeshes stator rotor (OF21) mergeMeshes . . ­cellZonesFileOnly. rotor (OF16ext)   system/controlDict  파일에 functionObjects 가 없어야 한다 subsetMesh [options] <cellSet> Options : ­cellZones. ­cellZonesOnly.

 zeroVolumeCells. skewFaces.  zeroAreaFaces  등의 파일이 constant/polyMesh/sets/  폴더에 생성 setSet ­batch batchFile batchFile  파일의 내용 cellSet zeroVolumeCells invert cellSet zeroVolumeCells subset quit  setSet  유틸리티를 사용하여 삭제할 cell  지정    subsetMesh zeroVolumeCells ­overwrite oldInternalFaces 라는 patch 가 생성 ­  type 을 symmetryPlane 으로 수 정  . nonOrthoFaces.Bad cell remove  checkMesh  실행  wrongOrientedFaces.

299. } setsToZones ­noFlipMap  constant/polyMesh/boundary  파일 편집 0/<boundary file>  편집 int­1 { type   ggi. int­2.GGI interface  int­1. }    bridgeOverlap  false.     ggi. int­2  두 개의 면을 ggi 로 설정하는 방법 setSet  유틸리티를 이용하여 각 면에 해 당하는 faceSet 을 만든다 . 988976.   constant/polyMesh/boundary  파일 편집 int­1 {type    nfaces     startFace    shadowPatch   zone  int­2 { type   nfaces   startFace   shadowPatch   zone    ggi. int­1.  setSet ­batch <batch file name> batch file 의 내용 예 faceSet leftZone new patchToFace int­1 faceSet rightZone new patchToFace int­2   faceSet 을 zone 으로 만든다 .    bridgeOverlap  false. 989000. rightZone. } . 333. leftZone.

bridgeOverlap   off. shadowPatch stator_out. nface       2344. separationOffset off.      234666.Cyclic ggi / overlap ggi  rotor1 과 rotor2 가 쌍을 이루고 있다면 rotor1 { type nface   startFace   zone         cyclicGgi. rotationAxis     ( 0 0 1).   234666.      2344.        rotor1Zone.  rotor_in 과 stator_out 이 쌍을 이루고 있다면 rotor_in { type      startFace   zone overlapGgi. } . ncopies     6. rotationAngle   60. rotationAxis   (0 0 1).       rotor_in_zone. } shadowPatch   rotor2.

. neighbourPatch transform   }   noOrdering.   22416.0001. AMI2 nfaces     startFace   matchTolerance 0.AMI interface  constant/polyMesh/boundary AMI1 { type      cyclicAMI.   177343.

Patch handling  autoPatch [options] <feature angle[0­180]>  feature angle 을 이용하여 여러개의 면으로 나누기 Example   autoPatch ­overwrite 90  createPatch [options]   createPatchDict 를 이용하여 patch  생성 Example   createPatch ­overwrite .

1e­3.  createPatchDict matchTolerance patches ( {    name     patchInfo { type patch. waterin. } } ).6 1.Patch handling  createPatch example topoSet  유틸리티를 이용하여 faceSet 을 만든 다음 createPatch 를 사용 topoSet → createPatch topoSetDict  파일 actions ( {     name    type    action    source waterin. waterInlet. }    constructFrom set.0 0. boxToFace. new. . faceSet.34). pointSync      true.    set } ).       sourceInfo { box (­15 ­11 ­10) (­ 14.

Solver setup & solving .

uniform (0 0 0). uniform (0 0 0). 1.Boundary conditions  fixedValue type   value fixedValue. inletOutlet.  fixedMeanValue type    fixedMeanValue. uniform (0 0 0).  surfaceNormalFixedValue type value  inletOutlet type   value inletValue uniform (0 0 0). meanValue   zeroGradient type   zeroGradient. uniform 1.  surfaceNormalFixedValue.  pressureInletOutletVelocity type   value pressureInletOutletVelocity. refValue . uniform (0 0 0).

out. uniform 101325.1. outletMappedUniformInlet. (0 0 1). (1 0 0).2 Href   n z z0       300. uniform 0. uniform (1 0 0).Boundary conditions  flowRateInletVelocity   AtmboundaryLayerInletVelocity type atmBoundaryLayerInletVelocity.    totalPressure  type totalPressure. uniform 323.03. flowRate 0.                outletMappedUniformInlet  value type   field   value zGround  outletPatchName     . value uniform (0 0 0). CH4 uniform 0. gamma p0   1. type flowRateInletVelocity.4. Uref 1.1.

heatSource flux. none. uniform 300.    heatflux type compressible::turbulentHeatFluxTe mperature. uniform 5. basicThermo. type    Tinf    value wallHeatTransfer. // power q K uniform 10.      value KName  .  mixed fixedEnthalpy fixedInternalEnergy gradientEnthalpy gradientInternalEnergy mixedEnthalpy mixedInternalEnergy totalTemperature externalWallHeatFluxTemperature compressible::turbulentTemperatureCou pledBaffle compressible::turbulentTemperatureRad CoupledMixed   alphaWall uniform 1e­5. uniform 300.Boundary conditions  Heat transfer coeff.

Example3 type uniformTotalPressure..0) (1 3. uniformValue table ( (0  0..0)  Example2 type (  (0 1.0 UniformFixedValue FlowRateInletVelocity UniformTotalPressure oscillating.  .C. Example1 type   uniformFixedValue. uniform 40.   From 2. U phi 1.  flowRate table    ). 10. p0 U phi gamma value 40.1) (100 ).1.Time dependent B. pressure table ( (0 10) (1 40) ).4.0)   flowRateInletVelocity.

  변수선언은 ”” valueExpression : C++  수식 입력 방식 type   variables valueExpression  value                groovyBC.1.". uniform 0.".Boundary conditions  groovyBC  swak4Foam keyword     type : groobyBC variable :  변수 선언 . groovyBC. "con".  Example1  Example2 type   variables     valueExpression  value              . "ccc=time()*0. "ccc"..  변수 구분은 . uniform 0. "con{out}=sum(CH4*mag(Sf()))/sum(mag(Sf())).1.

  #} }. Boundary condition.      scalar  bb=10.1.      os<<(aa+bb). } }   . source.  controlDict  등에서 사용 가능 Value 가 들어갈 자리에 #codeStream 이라고 입력 후 그 아래 코드 작성 코드 작성은 #{     #}  사이에  Example scalarExplicitSourceCoeffs { volumeMode specific. injectionRate { S #codeStream { code   #{ scalar  aa=100.codeStream  OF­2.

3.   0  폴더에 필요한 파일들  k. mut. 9.turbulence  Constant   wall function  사용하지 않을 때 k : fixedValue 0 omega :  compressible::omegaWallFunction mut  turbulenceProperties   laminar RASModel. epsilon. LES   RASProperties  kepsilon.. uniform 0. SpalartAllmaras. . 0. omega nuTilda (SA) nut. alphat  mutLowReWallFunction zeroGradient (OF16ext) alphatJayatillekeWallFunction zeroGradient (OF16ext)     roughWallFunction  사용  alphat   nut  파일 type   Ks   Cs   value nutRoughWallFunction.. kOmega.

} }  . residualControl { p 1e­5. U 1e­5.Convergence criteria  FvSolution  파일의 SIMPLE dictionary 에서 정의 Example SIMPLE { nNonOrthogonalCorrectors 1. epsilon 1e­5. k 1e­5.

. patchConstraints ( (rotorInlet 1)  (statorOutlet 1) ). simple.  hostfile node1 cpu=12 node2 cpu=12 node3 cpu=12    mpirun ­np 6 simpleFoam ­parallel Mpirun ­ ­hostfile hosts ­np 36  simpleFoam ­parallel reconstructPar   patchContrained example type { method metis..parallel  decomposePar Type : scotch. ggi decompose : decomposeParDict 에 ggi  면들을 globalFaceZones 에 등록 globalFaceZones ( leftZone rightZone ).  patchConstrained. patchConstrainedCoeffs   reconstructPar ­latestTime ReconstructPar ­time ***  . metis. } patchConstrained. numberOfSubDomains 6.

py mpirun ­­hostfile hosts ­np 36  simpleFoam ­parallel .py mpirun ­­hostfile <host file  name> hosts ­np <# of core> <solver>  ­parallel  pyFoamPlotRunner.계산과정 monitoring  pyFoam  pyFoamPlotRunner.py simpleFoam   pyFoamPlotRunner.py <solver>  pyFoamPlotRunner.

 forceCoeffs. patchMassFlowAverage. expression.  swakExpression.   type 의 value  . autoWrite. keyword   type. valueType. fields. type 의 value 에 의해 결정 patchMassFlow. fieldName.Function  controlDict 에 추가 function 이 필요로하는 library  지정   libs ( ”< library name>. expressionField. patches... probes.  accumulation.. patchAverage.  forces. verbose.so” ).  function 은 dictionary 로 지정한다 . faceSource. volumeIntegrate. patchExpression..

(faceA faceB). 1. .so”) verbose fields  patches factor true. (p T U rho).so”) verbose fields  patches factor } true. (p T U rho). }  mass­weighed average massAverage { type   patchMassflowAverage functionObjectLibs (”libsimpleFunctionObjects.Function  면에서의 평균값 구하기  area­weighed average areaAverage { type patchAverage functionObjectLibs (”libsimpleFunctionObjects. (faceA faceB). 1.

factor   ­1. fileds } (alpha1).  . verbose true. totalLiquid { type    volumeIntegrate. verbose true.so”).Function  유량 구하기 inletMassFlow { type    patchMassFlow. patches  (faceA).so”). }  Volume integral  구하기 libs (”libsimpleFunctionObjects. functionObjectLibs (”libsimpleFunctionObjects .

        true.so”). true. enable region log source          true. fluidA. outputControl outputTime. . patch. ( p U T ). areaIntegrate. minX.Function  Area integral  구하기 faceA { type      faceSource. functionObjectLibs (”libfieldFunctionObjects. true. point. operation   fields } areaAverage. false. false. outputControl timeStep. valueOutput probeLocations valueOutput sourceName operation   fields }   ( ( 1 1 1)  (2 2 2)  (3 3 3) ).     ( U ).so”). functionObjectLibs (”libsampling. solidA.  Point value  구하기 pointValues { type  enable region log   source       probes.

Function  force 구하기 force { type    forces.         p. outputInterval 1. functionObjectLibs (”libforces.  Force coefficient 구하기 forceCoeffs { type     forceCoeffs. functionObjectLibs (”libforces. outputControl outputInterval patches rhoName pName UName  rhoInf CofR liftDir  dragDir pitchAxis lRef  Aref    }   .2. timeStep. 1. patches rhoInf nuInf CofR }         (faceA faceB). U. (faceA faceB). (0 0 0). rhoInf. 1e­6. (0 0 1). 1. 1.so”). (0 1 0). outputControl timeStep.so”). 1.   1. (1 0 0). (0 0 0).2.

} theTitle ”forec coefficient”. . type  slave. master DragCoeff. CdHistory.  LiftCoeff { expr  ”Cl = (%f%)”. (”drag coefficient”). regular.customRegexp  계산중 물리량 변화 모니터링 작업 폴더 아래 customRegexp  파일 에서 지정 DragCoeff { expr  name titles type  } ”Cd = (%f%)”. titles (”lift coefficient”).

ETC  setFields  setFieldsDict mapFieldsDict  mapFields  .

Post-processing .

utilities  yPlusRAS vorticity wallShearStress Mach    .

Sign up to vote on this title
UsefulNot useful