OpenFoam Tutorial Basico
OpenFoam Tutorial Basico
> foamCleanPolyMesh >> blockMesh J >> snappyllexMesh -overwrite 3) View final mesh (see above) Copyright © 2015-2016 CFD Direct Ltd CFD DirectsnappyHexMesh: mesh refinement | Tri-surface manipulation 58/102 Task: mesh vehicle geometry for external aerodynamics, max 600k cells m Create a new estateMesh case from inflowOutflow template case >> run >> ep -r $FOAM_ETC/templates/inflow0utflow estateMesh m Copy the estate. obj geometry >> cp $FOAM_RUI/resources/geometry/estate.obj . Find its location, orientation and size ™ Create CAD. obj: front axle at « = 0, vertical z-axis, metre dimensions 2 (0,0, 1) >> surfaceTransformPoints -translate '(1445 32 0)' -rotate '((0 0 1) (0 -1 0))! <+-scale ‘(0.001 0,001 0.001)! estate.obj estateMesh/constant/triSurface/CAD.obj SurgaceTwonsgurmRends - hranelehe *C (Ws 726)' ~ roll Pda Yau 1(G0 oe)! ~Kale CFD Direct Copyright © 2015-2016 CFD Direct LtdsnappyHexMesh: mesh refinement | External patches 59/102 = Set the external patches (inlet, outlet, etc.) in background mesh @ Use alternative blockMeshDict .extPatches file in template case >> ep system/blockMeshDict.extPatches systen/blockMeshDict ground: type wall back, front, top: type symmetry a InblockMeshDict, set backgroundMesh according to diagram (si. 35) m Change patch names, e.g. left —> inlet, etc. Set patch types, see diagram = Run blockMesh CFD Direct Copyright © 2015-2016 CFD Direct LtdsnappyHexMesh: mesh refinement | Initial mesh refinement 60/102 = In snappyHexMeshDict, delete region sub-dictionaries (in CAD. obj geometry and refinementSurfaces) Initial cell length = 2/3 m; level 5 refinement — (2/3)/2° = 21 mm oy) = Run snappyHexMesh ‘ Jed tro Zerbiea (aoe and mort) frommelannhe pe dtbe puroy (5 5) teal -£ log \ gree “Time. Copyright © 2015-2016 CFD Direct LtdsnappyHexMesh: mesh refinement | Review of the initial mesh 61/102 Refinement box A ——— Refinement interfaces separated by 3 cells Y Vehicle surface quite well resolved = Insufficient refinement in the wake; refinement along ground? underbody? = Final Step: add 1 layer of cells to vehicle = ...for more uniform near wall cell size/shape Copyright © 2015-2016 CFD Direct Ltd CFD DirectsnappyHexMesh: mesh refinement | Additional refinement 62/102 = In your own time: add refinement boxes (copy/paste boxA) Box min max level _ Region boxA (3-10) (511.6) 4 Wake boxB (3-10) (811.6) 3 Wake boxC (3-10) (1511.6) 2 Wake boxD (-8 -10) (5 1 0.16) 4 Upstream/underbody m Increase nCel1sBetweenLevels from 3 (default) to 4, 5, ...to extend refinement Upstream/underbody Cell tayer: refinement (cut, purple) ond Copyright © 2015-2026 CFD Direct Ltd CFD DirectObjective data | Probes 63/102 = Aim: to set up estate case to output objective data . Monitored during a simulation = Create an estate case by cloning estateMesh and ; fle dds setting Uinlet to (40 0 0) in0/U Alee grrs ™ Add pressure probes at select locations m Copy packaged probes function object into system directory >> cp $FOAM_ETC/caseDicts/postProcessing/probee/probes systen = Set the fields and probeLocations in probes —\ ™ Include probes from the controlDict file | Foam CloneCure See Sone ln gent wu oo Caer \w Como chs \uor wo FAY Wu softens Hema gee WN gee HY a perdi (92 4 “cael © S a 0): 25 yaw aubrd yer Unies (40 00); 22 ype ves \ 4 (us Suthetweo- due Um f Viale’ 4 copyright © 2015-2016.cRD Direct cd ! CFD DirectObjective data | Force coefficients 64/102 ™ Packaged function objects for force calculation are listed by >> 1s SFOAM_ETC/caseDicts/postProcessing/forces Files ending . cfg contain configuration settings 1 Other files are function objects for copying to system directory 1 Copy the forceCoef fsIncompressible file to system 1m #include this file in functions in controlDict Name of patch over which forces are integrated |U.0| for coefficient calculation Tres for moment coefficient Crm Aves for lift/drag coefficients C\, C: Estimate of frontal area } lift and drag directions } moment pitch axis and centre of rotation — midpoint between wheel axles [ogk /oorgsoeo] ere /cedrchs /seh Conan! Fen edt a (2 Andie pavrtune ica eee eae her FAME Ym catcos de am poeko ayers ~ pre el pot Prercmmads k Pam ve te Célelen ey wuvehl ne coai tie ane polar callow cous chr oee foo nope. CFD Direct Copyright © 2015-2016 CFD Direct LtdObjective data | Monitoring data 65/102 = Run simpleFoam m= foamMonitor: displays data graphically; for usage type >> foamMonitor -h m= Execute it on a time-data file, e.g. probe data >> foamMonitor postProcessing/probes/0/p & m Data refreshes every 10s; stops refreshing if data unchanged for 60s = Monitor drag coefficient, setting y—range from 0.3 to 0.4 >> foamMonitor -y "[0.3:0.4]" postProcessing/forceCoeffs/0/forceCoefts.dat & copay vendedo lea Visyelrahen, rr a a a Tie As bok foparceom30/ere Jcare Dict Joat Receosng/ ¥ de age & puede enhbev a prubes ey corpiguacer de, r poremeéhey Inclow ef archive eo el cembel cuhd Diet pile . FUL 29 ; frobtg yy ge auade Gr el curhel Dich che ve Ge x Callen Al yerlear- e poe Copyright © 2015-2016 CFD Direct Ltd CFD DirectObjective data | Residuals. 66/102 Residuals are printed to terminal / log file . but residuals function object writes to file for monitoring Set up residuals to write residuals for U, p and k . . ™ Copy packaged residuals function object into system directory . = #include residuals in functions in the controlDict = Monitor residuals, setting logarithmic y—scale (-1 or -logscale option) >> foamMonitor -1 postProcessing/residuals/0/residuals.dat & os oor oie 10 200 aso a0 35000 Coplar Yenduls en conbdlOict ge yrolle prow stop At wellenow 5 CFD Direct Copyright © 2015-2016 CFD Direct LtdObjective data | Other objective function objects 67/102 f m In $FOAM_ETC/caseDicts/postProcessing = flowRatePatch: flow rate between 2 patches owRateSurface: volume flow rate between 2 tri-surfaces vo. minMax directory: several function objects to write min/max values m .. especially fieldMinMax; useful to check boundedness, e.g. a, T', k, 6, w staticPressure: converts kinematic pressure to pressure (force/area) totalPressure: calculates total pressure pr = Pret + p + p|U|?/2 u pressureDifferencePatch: difference in mean pressure on 2 patches oh tan wenite Corba hone ste} yunbbne } ( Copyright © 2015-2016 CFD Direct Ltd CFD DirectGraphs | Quick graphs 68/102 1m Task: plot pressure downstream of tallest building in windAroundBuildings 1m ParaView has graphs plotting = Load case into ParaView, t = 400 = Extract building patches = Filter + Data Analysis mu... Plot Over Line = Limited format control 204 Pressure 10} Pp im*/s*] 0 20 40 60 80 100 120 140 Height z [m] CFD Direct Copyright © 2015-2016 CFD Direct LtdGraphs | Graphs with the sample utility 69/102 m sample utility: samples data from a sampleDict configuration file = Copy the template sampleDict file to system >> op SFOAM_ETC/caseDicts/postProcessing/graphe/sampleDict system = Edit the file; set same sample line as before = Run sample >> sample m Files in postProcessing/sets/