Theory OpenFOAM implementation Airfoil simulation with mesh refinement Implementation and run-time mesh refinement for the k − ω SST DES turbulence model when applied to airfoils Daniel Lindblad 2013-12-10,11 Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 1 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Turbulence model The k − ω SST DES turbulence model Governing transport equations � ∂k �� � ∂k ∂t + ∂ (¯ u i k ) P k + ∂ ν + ν t ˜ − β ∗ kωF DES = ∂x i ∂x i σ k ∂x i � ∂ω ∂ω ∂t + ∂ (¯ u i ω ) P ω + ∂ �� ν + ν t � − βω 2 = ∂x i ∂x i σ ω ∂x i 1 ∂k ∂ω +2(1 − F 1 ) σ ω 2 ω ∂x i ∂x i ε ω = β ∗ k Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 2 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Turbulence model The k − ω SST DES turbulence model Turbulent viscosity, used in Boussinesq assumption a 1 k = ν t max( a 1 ω, SF 2 ) s ij − 2 − v ′ i v ′ = 2 ν t ¯ 3 δ ij k j � = 2¯ s ij ¯ S s ij � ∂ ¯ 1 + ∂ ¯ u j � u i s ij ¯ = 2 ∂x j ∂x i Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 3 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Turbulence model The k − ω SST DES turbulence model The DES (Detached Eddy Simulation) and DDES (Delayed Detached Eddy Simulation) terms � � L t F DES = max C DES ∆ , 1 � L t � = max C DES ∆(1 − F S ) , 1 F DDES √ k L t = β ∗ ω DDES = Boundary later protection through the blending function F S = F 1 , F 2 . Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 4 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Mesh refinement Idea behind run time mesh refinement Unresolved turbulence + Finer mesh = Resolution of turbulence through DES features Mesh should be fine in turbulent regions and coarse in other regions Question: When is the mesh fine enough? Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 5 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Mesh refinement Idea behind run time mesh refinement Unresolved turbulence + Finer mesh = Resolution of turbulence through DES features Mesh should be fine in turbulent regions and coarse in other regions Question: When is the mesh fine enough? Answer: The F DES F DDES terms are larger than 1 Only known after simulation has been performed Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 5 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Mesh refinement Controlling mesh refinement OpenFOAM refines the mesh based on a governing field Use a part of the F DES or F DDES term √ k L DES = C DES β ∗ ω ∆ √ k = C DES β ∗ ω ∆(1 − F S ) L DDES Refine the mesh if this field lies in a specific region. Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 6 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement k − ω SST DES for Refinement Overview, Implementation procedure Modification of the LES-class turbulence model k − ω SST SAS (Scale Adaptive Simulation) Remove the SAS features and add the DES features Go through implementation to make sure the terms that are kept are correctly implemented Add separate computation of the L DES or L DDES field to govern mesh refinement. Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 7 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement k − ω SST DES for Refinement Copying and compiling the new turbulence model We will not have a look at the implementation of the new turbulence model, called kOmegaSSTDESRefine . Start by copying and compiling the turbulence model. Copy the supplied turbulence model into the user directory, go to the place where the downloaded files are situated cp -r --parents src/turbulenceModels/incompressible/\ LES/kOmegaSSTDESRefine/ $WM_PROJECT_USER_DIR/ cd $WM_PROJECT_USER_DIR/src/turbulenceModels/\ incompressible/LES/ If you have not got a Make/ directory, create one mkdir Make cd Make Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 8 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement k − ω SST DES for Refinement Copying and compiling the new turbulence model Add two new files, called files and options , if you don’t already have them. gedit files gedit options In the file files , add the following kOmegaSSTDESRefine/kOmegaSSTDESRefine.C LIB = $(FOAM_USER_LIBBIN)/libmyIncompressibleLESModels Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 9 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement k − ω SST DES for Refinement Copying and compiling the new turbulence model In the file options , add the following EXE_INC = \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ -I$(LIB_SRC)/turbulenceModels/LES/LESfilters/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/LES/lnInclude LIB_LIBS = Compile the dynamic library for the turbulence model cd .. wmake libso Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 10 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement k − ω SST DES for Refinement Looking inside the new turbulence model Now we will look inside the new turbulence model Look inside the file kOmegaSSTDESRefine.H gedit kOmegaSSTDESRefine/kOmegaSSTDESRefine.H Look inside the file kOmegaSSTDESRefine.C gedit kOmegaSSTDESRefine/kOmegaSSTDESRefine.C Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 11 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Mesh refinement in OpenFOAM Overview, Mesh refinement Mesh needs to be a subclass to the class dynamicFvMesh In cases of mesh refinement, the sub class is called dynamicRefineFvMesh Dynamic meshes are handled by solvers named ...DyMFoam instead of ...Foam ...DyMFoam -solvers does not automatically support all types of subclasses to dynamicFvMesh For incompressible, transient flow, the solver is called pimpleDyMFoam To specify the sub class that should be used, and how it should be used, a special dictionary called dynamicMeshDict is needed in the case directory Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 12 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Mesh refinement in OpenFOAM The pimpleDyMFoam solver We will have a brief look at the pimpleDyMFoam solver to see how it handles dynamic meshes. It is located at $FOAM_APP/solvers/incompressible/pimpleFoam/pimpleDyMFoam/ The following important differences for mesh refinement exist between pimpleFoam.C and pimpleDyMFoam.C The inclusion of dynamicFvMesh.H Change from including createMesh.H to createDynamicFvMesh.H Change from including readTimeControls.H to readControls.H The operation mesh.update() is performed The inclusion of correctPhi.H under some circumstances Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 13 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Mesh refinement in OpenFOAM The refinement in mesh.update() The function update() is defined differently depending on which type of dynamicFvMesh that is used. For refinement it is defined in $FOAM_SRC/dynamicFvMesh/\ dynamicRefineFvMesh/\ dynamicRefineFvMesh.C Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 14 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Setting up and running the case Overview, Airfoil simulation with refinement We will only do the final part of applying mesh refinement to the simulation after the flow has developed The case is 2D to save time The airfoil is a NACA 4412 that is 1m long The fluid is air hitting the airfoil at 1m/s The mesh is far from perfect, which affect the result Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 15 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Setting up and running the case Copying the case files Copy the case Airfoil4412 2D into the run directory, go to the place where the downloaded files are situated cp -r --parents Airfoil4412_2D/ $FOAM_RUN/ cd $FOAM_RUN/Airfoil4412_2D/ Create the mesh blockMesh Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 16 / 23
Theory OpenFOAM implementation Airfoil simulation with mesh refinement Setting up and running the case Setting up the case to run with refinement Enable mesh refinement by changing a parameter in constant/dynamicMeshDict "refineInterval 0" to "refineInterval 10" To avoid having to wait too long, change the write interval in system/controlDict "writeInterval 0.2" to "writeInterval 0.05" Also change the start time and end time in system/controlDict "startFrom startTime" to "startFrom latestTime" "endTime 3" to "endTime 3.05" Start simulation pimpleDyMFoam > logRefine & Daniel Lindblad k − ω SST DES with mesh refinement 2013-12-10,11 17 / 23
Recommend
More recommend