35
SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN HOCHSCHULE BADEN-WÜRTTEMBERG RAVENSBURG 2016/01 A Manipulation and Conversion Toolbox for POPINDA- Formatted, Elliptic Hexahedral Meshes for the Use with MegaCads and OpenFOAM Martin Lichtmes

SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN HOCHSCHULE BADEN-WÜRTTEMBERGRAVENSBURG

2016/01

A Manipulation and Conversion Toolbox for POPINDA-Formatted, Elliptic Hexahedral Meshes for the Use with MegaCads and OpenFOAM Martin Lichtmes

Page 2: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware
Page 3: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

SCHRIFTENREIHEDERFAKULTÄTFÜRTECHNIKDERDUALENHOCHSCHULEBADEN-WÜRTTEMBERGRAVENSBURG2016/01

AManipulationandConversionToolboxforPOPINDA-Formatted,EllipticHexahedralMeshesfortheUsewithMegaCadsandOpenFOAMMartinLichtmes

Page 4: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware
Page 5: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

IMPRESSUMSchriftenreihederFakultätfürTechnikderDualenHochschuleBaden-WürttembergRavensburgHerausgeberProf.Dr.MartinFreitagProrektorDualeHochschuleBaden-WürttembergRavensburgBaden-WuerttembergCooperativeStateUniversityMarienplatz288212RavensburgDeutschlandhttp://www.dhbw-ravensburg.de2016/01,Dezember2016ISBN978-3-945557-02-0ISSN2199-238XDOI10.12903/DHBW_RV_FN_01_2016_LICHTMES©Lichtmes,2016AlleRechtevorbehalten.Der Inhalt der Publikation wurde mit größter Sorgfalt erstellt. Für die Richtigkeit, Vollständigkeit undAktualitätdesInhaltsübernimmtderHerausgeberkeineHaftung.DruckundVerarbeitungGestaltungNicoleStueppDHBWRavensburgMarienplatz2,88212RavensburgDruckFrickKreativbüro&Onlinedruckereie.K.Brühlstraße686381Krumbach

Page 6: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware
Page 7: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

AManipulationandConversionToolboxforPOPINDA-Formatted,EllipticHexahedralMeshesfortheUsewithMegaCadsandOpenFOAMMartinLichtmes1

ABSTRACT

A conversion andmanipulation toolbox for POPINDA-formatted hexahedralmeshes, asmay be used in Computational Fluid Dynamics (CFD) is presented. With a focus onongoingresearchactivitiesregardingIC-engineaerodynamicscarriedoutattheFacultyofTechnology of the Baden-Württemberg Cooperative State University Ravensburg, thetoolbox has mainly been developed to make elliptically smoothed hexahedral meshesconveniently available to the OpenFOAM CFD framework. The Software MegaCads iscapableof producingmeshesof elliptic, hexahedral typeeven for complex geometries.Therefore,andbecauseofitsfreeavailability,MegaCadshasbeenchosenasmeshdesignbasis in the given scope. The toolbox in its current version deals with ASCII encodedPOPINDAmesh filesandoffers severalmanipulation routines suchas scaling,extrudingetc. to use in conjunction with MegaCads as well as the intended mesh conversionmechanisms.Thepapergivesanoverview regarding thecurrently implemented toolsetand briefly introduces the reader especially into how to use it as mesh conversioninterfacebetweenMegaCadsandOpenFOAM.

Keywords: Elliptic, Hexahedral, Structured, Mesh, Grid, Manipulation, Conversion,

ComputationalFluidDynamics,CFD,OpenFOAM,MegaCads,POPINDA,FLOWer

1 Research Scientist (Fluid Dynamics), Research Division: „Motorische Verbrennung inhomogener

Gasgemische“ (IHGG; engl.: Internal Combustion of Inhomogeneous Gas Mixtures), Faculty ofTechnology,DHBWRavensburg

Page 8: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

NOMENCLATURE

Symbol SIBaseUnit Description

! Basenodeindex

! Cellindex

! Cartesiandirectionvariable

! Extrusionlength

!, #, $ Directionindices

! mm ∗ Edgelength

!", !$, !% Numberofpointsin!"#-direction

!", !$, !% Numberofcellsin!"#-direction

!

[°] Rotation/Revolutionangle

! Scalingfactor

! Translationvector

!", !$, !% [mm]∗ Cartesiantranslationcomponents

T Transpose

! [mm]∗ Absolutedistancetolerance

! Vertexnodeindex

!, #, $ Cartesiancoordinates

Page 9: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

Abbrevations

DHBW Baden-WürttembergCooperativeStateUniversity(DualeHochschuleBaden-Württemberg)

DLR DeutschesZentrumfürLuft-undRaumfahrt(engl.:GermanAerospaceCenter)

DNS DirectNumericalSimulation

GUI GraphicUserInterface

Hex Hexahedral

IC InternalCombustion

IHGG MotorischeVerbrennunginhomogenerGasgemische(engl.:InternalCombustionofInhomogeneousGasMixtures)

LES LargeEddySimulation

POPINDA PortableParallelisationofIndustrialAerodynamicApplications

RANS Reynolds-AveragedNavier-Stokes

STL Stereolithography

Page 10: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware
Page 11: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

1

1 INTRODUCTION

Elliptic hexahedralmeshes (or grids) are of great use in Computational Fluid Dynamics(CFD), since they are known for being eminently suited for the numerical, discretesolution of the Navier-Stokes equationswhich represent a nonlinear system of secondorderpartial differential equations [1]. Besides their goodnumerical fitness, structuredhexahedral meshes can be stored in a very simple and compact ‘nested-points’ (cf.chapter 3) arrangement, what makes it easy to store, manipulate or convert them inmanifoldways.Whilsttheopen-sourceCFDframeworkOpenFOAM(OpenFieldOperationandManipulation) isbeing shippedwithadvancedmeshgenerationutilitiesBlockMeshand SnappyHexMesh it doesnotoffer thedesirable elliptical smoothing for hexahedralmeshes [2,3]. In contrast, creating this type ofmeshes on complex geometries iswhatMegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) iscapableof[4,5,6].MegaCadsisfreewareandcomeswithanintuitiveGUI(GraphicUserInterface).Themeshescanbeparametrisedextensivelyand forexperiencedorat leastambitious users, there is practically no hard limitation in geometric or topologicalcomplexity of the resultingmesh.MegaCads has been developed by the DLR (German

Aerospace Centre) andmay be acquired via their website http://www.megacads.dlr.de

[5].Forthebelowpresentedwork,MegaCadshasbeenusedinversion2.5.2.Atpresent,MegaCads is not undergoing any major development [5] but it is highly usable in itscurrent stage2. It offers manifold basic geometric operations to create parametricpolygons,splines,vectors,curvesorsurfacesaswellasnonlinear(e.g.Poisson-type)pointdistributions on curves, surfaces and volumes. The herein presented toolbox has beengiventhenameBLoOMYBOXXwhichlooselyrelatestotheCFDcodeFLOWeroftheDLR–withinMegaCads, the POPINDAmesh format is referred to as ‘FLOWer format’ – thatutilisesPOPINDA-formatted,structuredmeshesandtothebox-likeshapeofhexahedralcells.POPINDAstandsforPortableParallelisationof IndustrialAerodynamicApplications

[7].

2Notallperipheryfunctionalitiesarefullyfunctionaloroperatingstable(i.e.ANSYSoutput,IGESconversionetc.).But toourknowledgeallmeshinganddesign features (geometricandmathematicaloperators)areworkingasintended/expected.

Page 12: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

2

OpenFOAM is property of the OpenFOAM Foundation Ltd. and released under GNUGeneralPublicLicense [2].Herein,OpenFOAMhasbeenused inversion3.0.1.BLoOMY-BOXX is a Linux executablewritten in C++ and is in its current version 0.2 released asfreeware. It has beendeveloped and testedunderUbuntu 15.10 (64bit). To acquire acopy of BLoOMYBOXX please contact the Baden-Württemberg Cooperative StateUniversity (DHBW) Ravensburg using the author’s Email address (lichtmes@dhbw-

ravensburg.de)orvisitthewebsitehttp://www.ravensburg.dhbw.de.

2 MOTIVATIONANDRELATEDRESEARCH

Nowadays,semi-orfully-automaticmeshgeneration(e.g.triangular,tetra-orpolyhedral)hasbecomemoreimportantingeneralindustrialCFDthantherathermanualhexahedralmeshingbecauseof flexibility andperformance speed (cf. figure 1). But among severalknowndrawbacks,unstructuredorhybrid(partiallyunstructuredandstructured)meshesmayintroduceasignificantlackofcomputationalaccuracyandstabilityalongsidehighercomputational efforts compared to more uniform and ‘cleaner’ fully-structuredhexahedral(hex)meshes.Hexmeshesthereforestillreceivegreatappreciationespeciallyin applicationswhere, for instance,highaccuracyor solution smoothness ismandatory(i.e. fundamental research topics etc.). Since manually generated meshes can becontrolledmorepreciselybytheuser,thenumericalqualitymaybedriventoamaximumevenregardingsingleselectedgridcellseasily. InCFDsuchhighqualitymeshesarenotonly well suited for smooth and accurate RANS (Reynolds-Averaged Navier-Stokes)simulations but also for LES (Large Eddy Simulations) and even DNS (Direct Numerical

Simulation). Of course, manual hex mesh generation often appears to be very timeconsuming. One must therefore be aware whether the manual or a rather automatic(unstructured)approachisthemostsuitablefortheirintendedpurposes.

Figure1: Onunstructuredandstructuredmeshing.a)Aphysical2Ddomain(e.g.airaroundacylinder)

b)Anunstructuredapproximationof‘a)’byunorderedtrianglesandquadrilateralsc)A

structuredapproximationof‘a)’byorderedquadrilateralsonly

a)

Page 13: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

3

The research divisionMotorische Verbrennung inhomogenerGasgemische (IHGG, engl.:InternalCombustionofInhomogeneousGasMixtures)attheFacultyofTechnologyoftheDHBWareundertakingRANSandLESsimulationsregardingmediumscalefour-valvegasengines(cylindervolumeapprox.4.8litres).Thequalityrequirementsofthesimulations,the exceptional geometric and topologic complexity3 of IC-engine (IC: internalcombustion) models as well as the need to model moving and morphing meshes atcomparativelylowcosts,ledtothedecisionofharnessingfullyhexahedralmeshesastheycanbegeneratedusingMegaCads.SinceallCFDsimulationswithinthatscopearetobeperformed usingOpenFOAM and there is no native connection or transfermechanismbetween MegaCads and OpenFOAM, it was obviously necessary to create such aninterface.Anotherreasonfordevelopingcertain‘tooltips’(suchasextrusionorrotation)isthefundamentalneedofsimplemanipulationroutinesforthequickcreationofregularbut high quality mesh regions (e.g. straight inlet pipes, valve wakes, piston bowls). Itturnedout, thatcorresponding taskswithinMegaCadsorOpenFOAMoftensuffer from‘clumsiness’ or less handy feasibility. Basically, all of these actionsmight also either betakendirectlywithinMegaCadsandOpenFOAMorviadedicatedworkarounds.However,as amatter of convenience and processing speed, it is desirable to have such tooltipsavailablealongsidethemeshconversionutilitieswhenpreparingameshfortheintendedpurposes.Initially, (at least for the use in RANS simulations) the unstructured/hybrid meshgeneratorsGMSH[8],NETGEN[9]andEnGrid4[10]havebeenutilisedforbenchmarkingpurposesbutdidnotperformsufficientlyintheabovementionedusecase,aseitherthelocalqualityoftheresultingmeshwasnotsatisfactoryorthegeneratorscrashed,whilecreatingthebasemeshincriticalregionsofthehighlyirregularsurfacegeometry.Itmustbe noted, that these issues occurredmainly due to ill-conditioned or faulty underlyingsurface geometry (disjoint or duplicate surfaces etc.) which originates from reverse-engineering data. TheOpenFOAMutilitySnappyHexMesh has also been tried out formeshingtheabove-mentionedIC-enginegeometry. Itsucceededtocreateanautomaticmeshfortheprovidedgeometrybutunfortunatelyfailed intermsofusabilityregardingcontrolof the localmeshqualitydue to thegeometric complexity. For instance,duringflow computations based on SnappyHexMesh grids, numerical stability issues occurredthathavebeentracedbacktoaregionwithintheflowdomainwherelargegradientsofvelocity,pressureanddensityalongsidestronggeometricnon-uniformityandcurvature

3Geometriccomplexityisgivenbystrongandalternatinglocalsurfacecurvatureaswellasthepresenceofmanyverysmallandhighlynon-uniformsurfaceregions.4GMSHandEnGridinternallymakeuseofNETGENandTETGEN[11].

Page 14: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

4

occurred. Hence, SnappyHexMesh was found not being flexible enough in the desiredlocations to obtain sufficient mesh quality under acceptable efforts. BlockMesh isconsiderednottobeofpractical relevanceasmesh-designutilitywithinthementionedscope due to its intrinsic methodologic limitations (cf. [2]). Table 1 summarises theconsideredmeshgenerators/utilities.Theterm‘polymorph’meansthatthemeshesmayconsistofdifferenttypesofelements,i.e.tetrahedrals,pyramids,hexahedralsandmore.

Generator MeshType Observation

GMSH unstructured(polymorph) crashedNETGEN unstructured(polymorph) crashedEnGrid unstructured(polymorph) crashed

SnappyHexMesh unstructured(polymorph)success(longprocessingtime),

localqualityinsufficientBlockMesh unstructured(polymorph) methodnotsuited

MegaCadsstructured(quadrilateraland

hexahedral)success,highquality,elaborate

Table1: Meshgenerators/utilitiesthathavebeenconsideredformeshing

3 ELLIPTIC,STRUCTUREDMESHESINMEGACADS

As already mentioned, elliptic meshes are well suited for the use in many CFDapplications. The term ‘elliptic’ denotes the type of system of governing partialdifferentialequationsthatissolvedtodistributethegridpoints.Thereaderisreferredtoe.g.[1]formoredetailedinformation.Acommontechnique–asharnessedbyMegaCads– is to generate an algebraic base grid from boundary point-distributions and toredistribute the resulting off-boundary (internal) points in an ‘elliptic manner’. Theunderlyingalgebraicgridsingeneralshowarather‘unruled’distributionofpointswithatbestweakrespecttosmoothnessorcellqualityrequirements,whereasthegridpointsofelliptic meshes are arranged much smoother and the grid lines tend to be moreorthogonalresultinginhigherqualitycells,asisdepictedinfigure2.

Page 15: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

5

Figure2: Comparisonbetweenalgebraic(black)andelliptic(red)2Dsamplegrids.

Left:Algebraicgrid.Middle:Ellipticgrid.Right:Bothgridsoverlaidwithclose-upsection.

Amesh is called ‘structured’whenall cells arearranged in a countableorder,whereas‘unstructured’meshes ingeneralhaveahighly irregularcellordering. Instructuredhexmeshes the ‘countability’ isestablishedby introducing !"#-directionswhich refer to thenormals of the three pairs of opposing faces of a hex cell. Hence, the indices of allneighbouringcellsareknownaprioribyknowingtheindexofthecell inthecentreandthetotalnumberofcells!", !$, !% in!"#-directionofagridblock.Figure3describesthatrelationfor2Dcells(extensionto3Disstraight-forward).Thisisobviouslynotthecaseforunstructuredmeshes. Any off-boundary hex cell in a fully hexahedralmesh always hasexactly six adjacent, neighbouring cells with regularly assigned indices. Structured hexcellscanthereforebedenotedbyasinglelistindexthatreferstoitspositioninthegrid.Thesameistrueforthecell’svertices(nodes).Becauseanyfirstorder5hexcellasshowninfigure4canbedescribedbythecoordinatesof itseightvertexnodes (3Dpoints), thestructuredcellarrangementallows for storingthe cells simply by means of ordered node lists. These lists implicitly contain all cellconnectivityinformationthatisneededforfurtherprocessing(e.g.cellboundarycouplingfor flux computation). The block connectivity of multi-block meshes is also included.Except for ‘hanging nodes’6 block boundaries can be considered connected,when twocells of separate block boundaries share exactly four identical nodes. Block boundariesmayeitherbelongtotwodistinctblocksoroneandthesameblock.

5 ‘Firstorder’means that therearenoadditionalnodesplacedon thecell’sboundary facesorboundaryedgesandthenodesareconnectedbystraightlinesonly.6‘Hangingnodes’donotperfectlymatchacounter-partnodeontheopposingblockboundaryorevenhavenone.

Page 16: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

6

Figure3:Ontheorderingofcells Figure4:Ahexahedralcelldefinedbyorderedvertexnodes

As mentioned above, MegaCads is capable of producing elliptic meshes in 2D(quadrilateral cells) and3D (hexahedral cells) space.ThePOPINDAoutputofMegaCadsalsoshowsthefavourablepointsordering.Furthermore,withafocusonOpenFOAMtheintuitive GUI (cf. figure 5) makes the mesh design process a lot more vivid andtransparent compared to the command-line based solutions BlockMesh or Snappy-HexMesh.

Figure5: TheMegaCadsGUI[5]

Page 17: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

7

4 THEPOPINDAMESHFORMAT

The mesh output of MegaCads that is harnessed by the herein presented toolbox isshaped inPOPINDA-format.ThePOPINDA formatutilises the ideaofpointsorderingasdescribed above. A typical POPINDA hex mesh file is illustrated in figure 6. The ‘$$’symbolmarkscommentarylines.Thefirstintegerinthefirstnon-commentarylineisthetotal number of blocks in themesh file. The second and the third integer are at leastwithin the named focus of no importance7 and always set to ‘1’. The next non-

commentary linecontainsthenumberofpoints!", !$, !% ofthefirstblockandafourth

integerwhichishereagainofnoimportance8andalwayssetto‘0’.Anyblockconsistsof

! = !#×!%×!&

(1)

points,whichformatotalof! = ($%-1)

)*× ($,-1)

)-

× ($.-1))/

(2)

hexahedralcellssimplybytheirknownordering.Givenanycellinaccordancetofigure4,

theindicesoftheeightvertexnodes!" …!$ofeachcellofameshblockarecomputedas

describedin(3)and(4).Whileloopingover!, #

and!,thelistindicesofeachnodeofany

cellcanbederivedfromthelistindexofthecell’sbasenode!(node1inaccordanceto

figure4):

! = # + %-1 () + *-1 ()(+ (3)

!"($) = $

(4)

!"($) = $ + 1 !"($) = $ + ()

!"($) = $ + () + 1 !"($) = $ + ()(*

7Thesecond integerdenotes thenumberofmultigrid levelsof themesh.The third integer indicates thetypeofcoordinatesystemused[5].8Thefourthintegerdenotesthenumberof‘ghostcells’,Ghostcellsare‘hypothetical’cellsthataretypicallyusedforquantityextrapolationsthatreachbeyondthemeshboundaries[5].

Page 18: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

8

!"($) = $ + ()(* + 1 !"($) = $ + ()(* + ()

!"($) = $ + ()(* + () + 1Thus,theentirehexmeshcanimmediatelybeconstructedfromthePOPINDApointslistpurely. Because OpenFOAM only ‘knows’ unstructured meshes, the memory or linearsolver related advantages of structuredmeshing are not accessible to it. However, themanipulation and conversion procedures of the herein presented software makeintensiveuseofthenesteddataarrangement.

Figure6: AsnippetofanASCIIencodedPOPINDA/FLOWermeshfile.

Page 19: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

9

5 MESHMANIPULATIONTOOLTIPS

BLoOMYBOXXcomeswithatext-basedinteractivemenuwhichenablestheusertoselectthe wished manipulation or conversion procedure to be performed on the user-prescribed mesh. The interface displays some basic mesh properties, i.e. meshdevelopment information as well as the number of points, blocks, cells and someadditional data thatmight be helpful for further processing. It interactively guides theuser throughmeshmanipulation or conversion as illustrated in figure 7. The availablemanipulationtooltipsatthecurrentstageofdevelopmentare: Cleanupmesh

Scalemesh

Translatemesh

Extrude2Dmeshalongcartesianaxis

Rotatemesh

Revolve2Dmesharoundcartesianaxis

Make2Dmeshaxisymmetric

Mirrormeshoverxy-plane

The meshes are kept in POPINDA format during all manipulation procedures, whichmeans they can be manipulated and reread into the MegaCads environment as fullyprocessiblegrids.Toperformanysortofmanipulationorconversion,onemustspecifyaPOPINDAshapedASCIImeshfile.Thesoftwareissimplyrunbytyping9

$ bloomyboxx_alias <mesh-file>

ina terminalwindowfromtheworkingdirectorywhere<mesh-file>refers tothemeshfile’s path. BLoOMYBOXX handlesmulti-block grids in 2D and 3D. It is clear that sometooltipsexclusivelyapplyto2Dor3Dmeshes(e.g.‘extrusion’).

9Thealias‘bloomyboxx_alias’mustpointtothelocationoftheexecutablefile.

Page 20: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

10

Figure7a: AsampleBloOMYBOXXrun(terminalviewpart1).Themeshreadingsequence.

Page 21: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

11

Figure7b: AsampleBloOMYBOXXrun(terminalviewpart2).Theprocessingsequence.A2Dmeshis

beingextrudedin!-directionatanewtotalof4!-layersandanextrusionlength! = 10mm.

Page 22: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

12

CleanupmeshThe ‘clean up mesh’ manipulator corrects slight non-zero inaccuracies of grid pointcoordinates in themesh. For instance, such inaccuraciesoccuroftenwhenpoints havebeen rotationally shifted or revolved, since those displacements cannot be calculatedexactly due to numerical error. But also allegedly cleanmeshes dumped byMegaCadsmay contain very small but unwanted offsets that were introduced during mesh

generation. The user can then prescribe an absolute correction tolerance! (e.g.

!:= 10-'mm), which the software will use to check whether a point’s (P) coordinate

component!", $", %" istobesettozeroorkeptasitis.Thetooltipisapplicabletoboth,

2D and 3D meshes. Consequently, it may also be utilised to project slightly unevensurfacesontocartesianplanes.

Figure8:Meshcleanedup.Originalmesh:Red.Thebasemesh

showsslightinaccuraciesinthebottomregion(seeclose-up).The

cartesianpointsthatliewithintheuser-prescribeddistance

tolerance!fromanyaxisareshiftedtowardsthecorresponding

one.

ScaleMeshAsthenamesuggests,thistooltipsimplyscales2Dand3Dmeshesbyauserprescribedscalingfactor!.Scalingcanyetonlybeachieveduniformly,whichmeansthegridisbeing

stretchedorshrunkinallthreecartesiandirectionsbythesamefactor.

Figure9:Meshscaling.Originalmesh:Red.Thebasemeshhas

beenuniformlyscaledbyafactorof! = 1.2.

Page 23: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

13

TranslateMesh2D and 3D meshes will be translated along a user prescribed 3D Cartesian vector

! = #$, #&, #'( .

Figure10:Meshtranslation.Originalmesh:

Red.Thebasemeshhasbeentranslatedbya

vector! = #/2, #/2, #/2 ' ,where! istheedgelengthofthequadraticboundingboxof

the2Dbasegrid.

Extrude2Dmeshalongcartesianaxis

When generating 2D meshes with MegaCads there will only be one !-layer (!" = 1).BLoOMYBOXXoffersthepossibilitytoextrudea2Dmeshinthe!-direction.Theusercanprescribe the new number of resulting !-layers, the length of extrusion ! and thecartesiandirection! = #, %, &ofextrusion.

Figure11:Meshextrusion.Originalmesh:Red.The2D

basegridhasbeenextrudedby30!-layersatanegativeextrusionlengthmatchingtwicetheedge

lengthofthequadraticboundingbox(! = −2%)ofthebasegrid.Thedirectionofextrusionis! = #.

Page 24: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

14

RotatemeshSimilarlytothetranslationtooltip,itispossibletorotatea2Dor3Dmesh.Theuserhastochooseanaxis! = #, %, &ofrotationandarotationangle!indegrees.

Figure12:Meshrotation.Originalmesh:Red.The

meshhasbeenrotatedby! = 25°aroundthecartesian!-axis(! = #).

Revolve2DmesharoundcartesianaxisAnalogous to extrusion additional !-layers are introduced to create a rotational 3Dextrusion of a 2D base mesh. The user must specify a new number of !-layers !" , arevolutionangle!indegreesandthecartesianaxis!ofrevolution!, #, $.

Figure13:Meshrevolution.Originalmesh:Red.Volume

meshcreatedbyrevolutionofthe2Dbasegridby

! = −270°aroundthe!-axis(! = #).

Page 25: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

15

Make2DmeshaxisymmetricBasically,thismanipulatorworks inthesamewayasrevolutionexceptthefactthatthenew number of !-layers is restricted to being !":= 2 and the revolution angle ! islimited to a maximum value of 5 ° for computational quality of the CFD solution.Additionally,thistransformationisboundedtothe!-axisascentreofrevolution.

Figure14:Meshmadeaxisymmetric.Original

mesh:Red.Themeshhasinverselybeenrevolved

byasingleadditional!-layer.

Sincedifferentsolvershandleaxisymmetry indifferentways,onemustbeawareofthehereadoptedmethod:Whenrevolved,theoriginal2Dmeshpointsareexpectedtolieperfectlyinthe!"-plane(!" = 0;onemaywanttorun‘Cleanupmesh’inadvance).Thenew!-coordinatesofthe3Dgridpointsarecomputedbyduplicatingthe2Dpointsandsymmetricallyshiftingthemat an angle of ±"/2 around the !-axis. To address the requirements of the below

describedconversiontoOpenFOAM[3]theduplicatepointsat!" ≡ 0(pointsontheaxisof symmetry) collapse perfectly10, resulting inwedge or prism elements instead of hexcells(cf.figure15and[3]).Wedgeorprismelementsarealsocreatedwhenrevolutionisappliedandpointsarelocatedattheaxisofrevolution.

10Somesolversexpectasmallnon-zerodistancebetweenthose‘axispoints’.

Page 26: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

16

Figure15:Prismtypecellsattheaxisofrevolution.

Mirrormeshover!"-planeWhen mirrored, a 2D or 3D mesh’s points are being inversely duplicated. Yet, onlymirroringoverthe!"-planeisimplementedwhichmeanstherearenoparameterstobe

specified by the user. The mirror image and the base mesh are not being block-wiseunified.Thismeans,withrespecttotheoriginalmesh,themirrorimageisrepresentedbyoneormoreadditionalblock(s).

Figure16:Meshmirroring.

Originalmesh:Red.Themirror

imagerepresentsanadditional

meshblock.Thearrowmarks

the!"-plane’snormalvector.

Theoriginal2Dmeshhasbeen

rotatedby90°aroundthe!-axisbeforemirroring.

6 MESHCONVERSIONTOOLTIPS

ThefollowingmeshconversiontooltipsarecurrentlyimplementedinBLoOMYBOXX:• Tecplot®DATformat• OpenFOAMBlockMeshDict• GMSH2.0format(yetexperimental)

TheTecplot®DATsupport ismainly intendedtoserve formeshviewingpurposesusingestablished software, i.e. Tecplot®, ParaView or others. The two other formatsimmediatelyserveasinputforCFDsolversoralternativepreprocessingsoftware.

Page 27: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

17

Asmentioned above, one of themain purposes of the toolbox initiallywas to convertPOPINDAmeshesintoagridformatreadableforOpenFOAM.SincealsoalternativemeshformatssuchasTecplot®[12],VTK(VisualToolkit)[13]orGMSHareexpectedtobeusefulwithin thementioned research scope, a rather ‘common’ arrangement of the resultingmeshdatahasbeenchosen:For instance,plainordered(structured)Tecplot®filescaneasilybegeneratedsimplybyadapting file andblockheader sequencesof thePOPINDA files, because thepoints arearrangedinidenticalmanner[14].Instead,thepolymorphunordered(unstructured)VTK,GMSHorOpenFOAMmeshes cannotbe created in the samewaybutexplicitly requirepreassemblingofthecellsfrompointdata.OpenFOAMitselfutilisesthe‘face-addressing’PolyMeshformat[3].ButBlockMeshfiles(BlockMeshDict)areapparentlyeasiertoderivefromplainpointdatathanPolyMeshgrids,astheyshowstrongsimilaritytotheusual,cellbasedunstructuredgridformats,suchasVTKorGMSH.Furthermore,MegaCadsmeshesare purely hexahedral in 3D and because of their known ordering, it is reasonable toadoptasimpler,cellbasedconversionmechanismclosertocommonformats.ThiscanbeachievedbycreatingaBlockMeshDictshaped‘gridfile’11,consistingpurelyofhexahedralblocks with each block consisting of a single cell only. One can then simply commandBlockMesh to takeon thehardworkof creating the face-addressingPolyMeshgrid forOpenFOAM.BlockMeshwilltransformtheone-cellhexblocksbackintoordinaryhexcellsthat– in termsof their geometry–perfectly represent the formerPOPINDA formattedmesh.Thechosenmethodmeaningsimplicityanddevelopmentspeed,BLoOMYBOXXhasbeengiventheabilitytoconstructBlockMeshDictsfrompointsinsteadofPolyMeshgrids.A snippet of a sample BlockMeshDict created from a POPINDA mesh file usingBLoOMYBOXXisdepictedinfigure16.Theterm‘hex’inthe‘blocks(…)’sectionstandsforhexahedralblocks.Theeight integers in thesubsequentparenthesesdenotethe listindicesoftheblockdefiningverticesthatarestoredinthe‘vertices’section.Thesecondparenthesesrepresentsthenumbersofcellswithinthecorrespondingblock inall three!"#-directionsandisaccordingtotheabove-mentionedsingle-cell-blockapproachalways

setto‘(1 1 1)’.Theinstruction‘simpleGrading (1 1 1)’commandsBlockMeshto use constant cell sizes across the correspondingblock. The latter part of eachblockdefinition line is mandatory but obviously meaningless since the mesh will result in asinglecellperblockanyway.

11ForBlockMeshaBlockMeshDictisnota‘grid’filebutratheragridgenerationscript.

Page 28: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

18

Figure16: AsnippetofasampleBlockMeshDictfiledonewithBLoOMYBOXX.Thesectionwherethe

single-cell-hex-blocksaredefinedishighlightedbyadashedbox.

Atthecurrentstageofdevelopmentboundarypatchesattheouterblockboundariesofthe mesh are not created automatically, when converting the mesh into any otherformat.But regardingOpenFOAM, there isageneralworkaroundavailable todoso,asshowninthefollowingchapter.

Page 29: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

19

7 MESHUSEINOPENFOAM

When an OpenFOAM mesh is to be created based on the described POPINDA-to-BlockMeshDict interface, one will have to specify boundary conditions on the meshboundariesmanually.AsBLoOMYBOXXinitscurrentversiondoesnotsupportautomaticboundary patching, the following procedure is recommended to create boundarypatches:

1. CreatethedesiredBlockMeshDictfileusingBLoOMYBOXX.

2. Move theBlockMeshDict file into a properly set upOpenFOAMcase directory’s‘system’folder.

3. Run

$ blockMesh from the top level of the case directory andmonitor the output. If BlockMeshcomplainsaboutnegativecellvolumes–whichislikelytooccurincasesofformerextrusionorrevolution– it isrecommendedtorerunextrusion/revolution intheopposite direction (extrusion: negative extrusion length !, revolution: negativerevolution angle !). BlockMesh will dump the new mesh in OpenFOAM’s

PolyMeshformatinthecase’s‘constant/polyMesh’directory.

4. Now run OpenFOAM’s automatic patching utility ‘AutoPatch’ using a sufficientpatchdetectionangle<angle>indegrees:$ autoPatch –overwrite <angle> As thename implies, thiswill createpatches (named ‘auto0’, ‘auto1’ ...) on thenewPolyMesh’sblockboundaries.

5. ParaFOAM – OpenFOAM’s software adaptation of the third-party resourceParaView[2,3,15]–maythenbeusedtodeterminewhichofthegeneratedpatchnames belongs to a specific block boundary. Either make sure, the workingdirectorydoesnotcontainatime-stepdirectory(i.e.‘0’etc.)with‘U’and‘p’filein it or, after ParaFOAM has launched, uncheck the corresponding fields in theloadoptionsofthecasebeforehitting‘Apply’.Otherwise,ParaFOAMwillhappento crash because it cannot find the matching patch fields as they are not yetdefined.ParaFOAMislaunchedfromthecasedirectorybytyping:$ paraFoam

Page 30: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

20

6. Resultingunwantedandduplicateinternalblockboundariescanbeeliminatedbyapplying the ‘StitchMesh’utility tagged ‘–perfect’oncoincidingpatches<1>and<2>:$ stitchMesh <1> <2> -perfect

7. The ‘CreatePatch’ utilitymay then be harnessed to round up patchmapping byconcatenating disjoint but coherent patches, creating patch groups, renamingthemorevenassigningadequateboundary-conditions(cf.[2]).

Since OpenFOAM also offers several backwards directedmesh conversion utilities onecanafterwards(atleastintermediately)transfertheformerPOPINDAmeshesintoalmostanywishedCFDormeshingenvironment(see[2]forfurtherinformation).

8 CLOSINGREMARKSANDOUTLOOK

Thetoolbox,asdescribedherein,isbeingintensivelyusedwithintheframeoftheabovenamedresearchregardingIC-engineCFD.Alltooltipsformanipulationandconversionarethus being steadily tested, improved and even extended. The software provides handyopportunities and shortcuts regarding multi-block based mesh generation andconversion.Yet,therehasnotbeenobservedanyhardlimitationconcerningtheuseformanipulationor conversion, although it turned out that BlockMesh takes quite awhile (up to somehours)toprocesslargergridsofe.g.severalmillioncells.Theremightbeaslightincreaseinperformancespeedwhenusingbinaryencodedfilesbutuntilnow,thatassumptionhasnotbeentestedorverified.Furthermoreitisclear,thatadirect‘POPINDA-to-PolyMesh’approach will result in faster conversion. The implementation of such a routine isthereforeplannedtotakeplaceinupcomingreleasesofBLoOMYBOXX.Although MegaCads is older software, there is still a justified interest in highlycontrollable, customisable and high quality hex meshes. Thus, it meets many currenttechnicalneeds justasgoodasany ‘up-to-date’commercial structuredmeshgeneratordoes. At least within the intended high quality CFD on IC-engines, the benefits ofharnessingMegaCads in conjunctionwithOpenFOAMmeanamassive research relatedrelevance of both software products. BLoOMYBOXX will thus undergo furtherdevelopment to extend its capabilities and flexibility. Upcoming manipulation tooltipsmay include mesh-merging and mesh-decomposition, non-uniform extrusion, mesh-morphing(e.g.tomodelenginemotion)ortheconstructionofregularmeshpatters(i.e.groupsofturbinebladesetc.),whilefutureconversionutilitiesaremostlikelyaimingon

Page 31: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

21

implementation of a direct PolyMesh (to speed up mesh conversion) or VTK export,boundary patching as well as boundary patch based triangulation to derive STL(Stereolithography)surfacerepresentationsandmore.Some functionalities of the toolbox are dedicated explicitly to OpenFOAM-specifictopologicrequirementssuchasthewedge/prism-approachforaxisymmetricsimulations.However,thetoolboxisnotrestrictedtobeonlyofusewhenworkingwithOpenFOAMbutmightalsobehelpfulinconjunctionwithMegaCadsmeshingitself,FLOWeror–forinstance,viaOpenFOAM’smeshconversionutilities–anyotherCFDcode.

Page 32: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

22

ACKNOWLEDGEMENTS

TheauthorgratefullyacknowledgesprovisionofthesoftwareMegaCadsforteachingandresearchpurposesbytheDLR.

Page 33: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

23

REFERENCE

[1] Thompson J. F., SoniB. K.,WeatherillN. P.; „HandbookofGridGeneration“ (1999);CRCPress,ISBN0-8493-2687-7[2]OpenFOAMonlinepresence;OpenCFDLtd.atOpenFOAMFoundationLtd.;Dateofaccess:27.06.2015;URL:http://www.openfoam.com

[3] OpenFOAM Foundation Ltd.; “OpenFOAM – The Open Source CFD Toolbox; User

Guide”(2015)[4]GermanAerospaceCentre(DLR)onlinepresence;Dateofaccess:13.10.2015;URL:http://www.dlr.de[5] MegaCads online presence; German Aerospace Centre (DLR); Date of access:13.10.2015;URL:http://www.megacads.de

[6]HepperleM.,BrodersenO.RonzheimerA.SchöningB.,RossowC.C.;„TheParametric

Grid Generation System MegaCads“ (1996); Proceedings of the 5th InternationalConferenceonNumericalGridGenerationinComputationalFieldSimulations;Mississippi(USA)[7]ERCIMNEWSOnlineEditiononlinepresence;EuropeanResearchConsortiumfor

InformaticsandMathematics;Dateofaccess:01.07.2016;URL:http://www.ercim.eu/publicaton/Ercim_News/enw32/schueller.html[8]GMSHonlinepresence;GeuzaineC.,RemacleJ.F.;Dateofaccess:01.07.2016;URL:http://www.gmsh.info[9]NETGENonlinepresence;Dateofaccess:01.07.2016;URL:http://www.hpfem.jku.at/netgen/

[10]EnGridonlinepresence;EnGitsGmbH;Dateofaccess:01.07.2016;URL:http://www.engits.eu[11]TETGENonlinepresence;SiH.;Dateofaccess:01.07.2016;URL:http://www.wias-berlin.de/software/tetgen/[12]Tecplot®onlinepresence;TecplotInc.;Dateofaccess:13.10.2015;URL:http://www.tecplot.com[13]VTKonlinepresence;KitwareInc.;Dateofaccess:13.10.2015;URL:http://www.vtk.org[14]TecplotInc.;“Tecplot360–DataFormatGuide”(2008)[15]ParaViewonlinepresence;KitwareInc.;Dateofaccess:13.10.2015;URL:http://www.paraview.org

Page 34: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware
Page 35: SCHRIFTENREIHE DER FAKULTÄT FÜR TECHNIK DER DUALEN ... · MegaCads (Multiblock Elliptic Grid-Generation and Computer Aided Design System) is capable of [4,5,6]. MegaCads is freeware

Herausgeber

Prof. Dr.-Ing. Martin FreitagDekan der Fakultät für Technik

Duale Hochschule Baden-Württemberg RavensburgBaden-Wuerttemberg Cooperative State UniversityMarienplatz 288212 Ravensburg

ISBN: 978-3-945557-02-0

ISSN: 2199-238X

DOI: 10.12903/DHBW_RV_FN_01_2016_Lichtmes