modeling of bed roughness using a geometry function and
play

Modeling of bed roughness using a geometry function and forcing - PowerPoint PPT Presentation

Introduction Solver set-up Case set-up Post-Processing Modeling of bed roughness using a geometry function and forcing terms in the momentum equations Jonatan Margalit A project work in the course CFD with OpenSource software, taught by H


  1. Introduction Solver set-up Case set-up Post-Processing Modeling of bed roughness using a geometry function and forcing terms in the momentum equations Jonatan Margalit A project work in the course CFD with OpenSource software, taught by H˚ akan Nilsson at Chalmers University of Technology, Gothenburg, Sweden 01-12-2014 Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 1 / 28

  2. Introduction Solver set-up Case set-up Post-Processing Background A tutorial of how to set up an OpenFOAM case with a rough bed using porosity to define the bed elements. Wall functions have quite limited success with LES. Good for simulating near bed dynamics. Use of structured mesh with porous bed elements Bed elements - normal distribution. Method based on Stoesser, T. (2010). ”Physically Realistic Roughness Closure Scheme to Simulate Turbulent Channel Flow over Rough Beds within the Framework of LES.” J. Hydraul. Eng. , 136(10), 812-819. Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 2 / 28

  3. Introduction Solver set-up Case set-up Post-Processing Shear stress in open-channel flow Force balance in time averaged pressure driven channel flow: ∂ � µ∂u � = ∂p ∂y − ρu ′ v ′ ∂x, ∂y Denoting the shear with τ : ∂τ ∂y = ∂p ∂x, Solution for the mean shear stress: τ = − ∂p 1 − y � � ∂xh . h Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 3 / 28

  4. Introduction Solver set-up Case set-up Post-Processing Velocity profiles Log law over a smooth bed: u = 1 � y + � κ ln + 5 . 5 , U f Log law over a rough wall: u � 30 y � = 1 , κ ln U f k s � with friction velocity U f = τ b /ρ . From wikipedia Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 4 / 28

  5. Introduction Solver set-up Case set-up Post-Processing Getting started Start by sourcing your OpenFOAM-2.2.x: source $HOME/OpenFOAM/OpenFOAM-2.2.x/etc/bashrc Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 5 / 28

  6. Introduction Solver set-up Case set-up Post-Processing Configuring the solver Make a copy of the pimpleFoam solver in the user directory: cd $FOAM_APP cp -r --parents solvers/incompressible/pimpleFoam $WM_PROJECT_USER_DIR cd $WM_PROJECT_USER_DIR/solvers/incompressible Rename the copied pimpleFoam solver: mv pimpleFoam pimpleFoam_mod cd pimpleFoam_mod mv pimpleFoam.C pimpleFoam_mod.C Cleanup the directory and delete the unnecessary folders and files: wclean rm -rf SRFPimpleFoam/ pimpleDyMFoam/ Allwmake Make/linux* Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 6 / 28

  7. Introduction Solver set-up Case set-up Post-Processing Write out sgs and viscous stresses Add the following before the runtime.write() in pimpleFoam_mod.C . nuGradU = laminarTransport.nu()*-2*dev(symm(fvc::grad(U))); B = turbulence->R(); Add to createFields.H volSymmTensorField nuGradU ( IOobject ( "nuGradU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), laminarTransport.nu()*-2*dev(symm(fvc::grad(U))) ); Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 7 / 28

  8. Introduction Solver set-up Case set-up Post-Processing Write out sgs and viscous stresses Add to createFields.H volSymmTensorField B ( IOobject ( "B", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), laminarTransport.nu()*-2*dev(symm(fvc::grad(U))) ); Modify Make/files and compile with wmake Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 8 / 28

  9. Introduction Solver set-up Case set-up Post-Processing Copying a case from the tutorials Copy the tutorial case channel395 : cp -r $FOAM_TUTORIALS/incompressible/pimpleFoam/channel395 $FOAM_RUN run In the run folder make another copy of channel395 and call it roughChannel : cp -r channel395 roughChannel Now run the channel395 case while you configure the roughChannel : blockMesh -case channel395 pimpleFoam -case channel395 > channel395/log.run & We will use the results for comparison. Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 9 / 28

  10. Introduction Solver set-up Case set-up Post-Processing Edit the mesh Open constant/polyMesh/blockMeshDict and edit the vertices section to the following: vertices ( (0 0 0) (4 0 0) (0 0.2 0) (4 0.2 0) (0 1 0) (4 1 0) (0 0 2) (4 0 2) (0 0.2 2) (4 0.2 2) (0 1 2) (4 1 2) ); Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 10 / 28

  11. Introduction Solver set-up Case set-up Post-Processing Edit the mesh Then edit the blocks section in the following way: blocks ( hex (0 1 3 2 6 7 9 8) (60 25 40) simpleGrading (1 1 1) hex (2 3 5 4 8 9 11 10) (60 35 40) simpleGrading (1 6 1) ); Finally, change the boundary type of the topWall into a patch : topWall { type patch; faces ((4 10 11 5)); } Run blockMesh Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 11 / 28

  12. Introduction Solver set-up Case set-up Post-Processing Boundary and internal conditions of the fields Set all internalFields to 0 in the 0 folder files. For the velocity set the boundary condition at the topWall to be of the type slip , in order to have a rigid lid surface: topWall { type slip; } In the turbulence energy file k set a Neumann boundary condition at the top wall by modifying it into: topWall { type zeroGradient; } Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 12 / 28

  13. Introduction Solver set-up Case set-up Post-Processing Mapping fields Map the fields of the lower half of the channel in channel395 into your rough channel. This is done by first copying the mapFieldsDict into the system folder: cp -r $FOAM_APP/utilities/preProcessing/mapFields/mapFieldsDict system/ Modify mapFieldsDict : patchMap ( bottomWall bottomWall sides1_half0 sides1_half0 sides2_half0 sides2_half0 inout1_half0 inout1_half0 inout2_half0 inout2_half0 ); cuttingPatches ( topWall ); Map the fields: mapFields ../channel395/ Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 13 / 28

  14. Introduction Solver set-up Case set-up Post-Processing Generating the rough bed zone Download the file boxes.C from pingpong and place it in the system folder. Compile the file with g++ -std=c++11 boxes.C -o boxes Run the file boxes : ./boxes > log.boxes Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 14 / 28

  15. Introduction Solver set-up Case set-up Post-Processing Generating the rough bed zone Copy the topoSetDict file into the system folder: cp -r $FOAM_APP/utilities/mesh/manipulation/topoSet/topoSetDict . Edit topoSetDict to the following: actions ( { name bed; type cellSet; action new; source boxToCell; sourceInfo { boxes ( #include "boxes.txt" ); } } ); Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 15 / 28

  16. Introduction Solver set-up Case set-up Post-Processing Adding sources with fvOptions Run topoSet followed by setsToZones Now open up system/fvOptions momentumSource { type pressureGradientExplicitSource; active off; //on/off switch selectionMode all; //cellSet // points //cellZone pressureGradientExplicitSourceCoeffs { fieldNames (U); Ubar ( 0.1335 0 0 ); } } Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 16 / 28

  17. Introduction Solver set-up Case set-up Post-Processing Adding sources with fvOptions porosity { type explicitPorositySource; active true; selectionMode cellZone; cellZone bed; explicitPorositySourceCoeffs { type DarcyForchheimer; DarcyForchheimerCoeffs { d d [0 -2 0 0 0 0 0] (1e12 1e12 1e12); f f [0 -1 0 0 0 0 0] (1e12 1e12 1e12); coordinateSystem { e1 (1 0 0); e2 (0 1 0); } } } } Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 17 / 28

  18. Introduction Solver set-up Case set-up Post-Processing Configuring controlDict Run with adjusting the time step to a Courant number: writeControl adjustableRunTime; adjustTimeStep yes; maxCo 0.5; Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 18 / 28

  19. Introduction Solver set-up Case set-up Post-Processing Average the stresses in controlDict Add to fieldAverage: nuGradU { mean on; prime2Mean on; base time; window 125; } B { mean on; prime2Mean on; base time; window 125; } Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 19 / 28

  20. Introduction Solver set-up Case set-up Post-Processing Set PIMPLE parameters Set the pressure reference in fvSolution : PIMPLE { nOuterCorrectors 1; nCorrectors 2; nNonOrthogonalCorrectors 0; pRefPoint (0 1 0); pRefValue 0; } Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 20 / 28

  21. Introduction Solver set-up Case set-up Post-Processing Define LES properties In constant/LESProperties use delta cubeRootVol Van Driest delta not suitable as it is intended for wall patches. Jonatan Margalit Modeling of bed roughness in OpenFOAM 01-12-2014 21 / 28

Recommend


More recommend