CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

DDES model OpenFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 27, 2018, 14:12
Question DDES model OpenFoam
  #1
New Member
 
Davide
Join Date: Jun 2017
Posts: 17
Rep Power: 9
Davide95 is on a distinguished road
Dear Fomers,
I am a newbie and I am struggling to understand how to set up a simulation in OpenFoam with a DDES model.
In the tutorials i found motorbike tutorial ($FOAM_TUTORIALS/incompressible/pisoFoam/LES/motorBike/) which uses DDES but still i am ecountering troubles.


In the tutorial folder i can see a bashfile "Allrun" and two folders : "lesfiles" and "motorbike".


The first folder contains only these files set for a LES case :
fvSchemes
turbulenceProperties

controlDict

fvSolution


The second one basically is like a case with a RANS model where only the mesh is missing.


To what I understood the bashfile called "Allrun" both creates the mesh and starts the simulation.
After running the "Allrun" file a new folder appears which is called "motorbikeLES".
After several hours I had to stop the Allrun process so I don't know exactly what was it doing.

I don't get how I can set up my own case with a DDES model, especially which are the folders required and I don't get if the "Allrun" bash file is necessary or I could start my simulation without it.


Thanks a lot in advance for anyone who will help
Best regards
Davide
Davide95 is offline   Reply With Quote

Old   July 28, 2018, 12:58
Default
  #2
Member
 
Robin Kamenicky
Join Date: Mar 2016
Posts: 74
Rep Power: 11
Robin.Kamenicky is on a distinguished road
Hi David,

I have had a look at the bash scripts motorBike/Allrun, motorBike/motorBike/Allrun and also motorBike/lesFiles/Allrun and tried to comment it a bit more. I hope it helps. Have a look.
motorBike/Allrun
Code:
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions


cloneParallelCase()     #Function to clone a case
{
    if [ -d $2 ]        #If directory called by second function parameter exists
    then
        echo "Case already cloned: remove case directory $2 to clone"
    else
        echo "Cloning $2 case from $1 in parallel mode"
        mkdir $2                # Make a directory called by second function parameter
        cpfiles="processor* system constant"    #Following code is to copy directories processor* system/ constant/ from a directory passed to the function by first parameter to the directory passed to the function by second parameter
        for f in $cpfiles
        do
            cp -r $1/$f $2
        done
    fi
}


# Do the Spalart-Allmaras steady-state case
(cd motorBike && foamRunTutorials)              #Command executed in subshell runs the motorBike case using motorBike/motorBike/Allrun

if ! isTest $@          #if isTest is falls. $@ stands for all parameters from $1 passed to the isTest function. isTest is a function from RunFunctions script.
then
    # Clone the steady-state case to the LES case
    cloneParallelCase motorBike motorBikeLES    #Call the function cloneParallelCase where $1 is motorBike and $2 is motorBikeLES

 # Do the LES case
    cp lesFiles/Allrun motorBikeLES/            #The lesFiles/Allrun needs to be checked since it is copied in to motorBikeLES
    (cd motorBikeLES && foamRunTutorials)       #running the motorBikeLES/Allrun in subshell
fi
motorBike/motorBike/Allrun
Code:
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

# copy motorbike surface from resources directory
cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/

# Make dummy 0 directory
mkdir 0                 #blockMesh needs the 0 directory, does not matter what is inside

runApplication blockMesh        #run blockMesh
cp system/decomposeParDict.hierarchical system/decomposeParDict #copy decomposeParDict needed to decomposition and subsequent parallel run
runApplication decomposePar     #decomposition for parallel run

cp system/decomposeParDict.ptscotch system/decomposeParDict
runParallel snappyHexMesh -overwrite            #meshing with snappyHexMesh

find . -type f -iname "*level*" -exec rm {} \;

ls -d processor* | xargs -I {} rm -rf ./{}/0    #remove from processors 0 directory since it is dummy
ls -d processor* | xargs -I {} cp -r 0.orig ./{}/0      #copy to processors 0.orig as 0/

runParallel renumberMesh -overwrite     #renumber the processors after decomposition to make the simulation more efficient

runParallel potentialFoam -initialiseUBCs       #initiate U velocity BCs with potentialFoam in parallel

runParallel `getApplication`    #run pisoFoam in parallel
motorBike/lesFiles/Allrun
Code:
#!/bin/sh

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

# Set-up the LES case
cp ../lesFiles/fvS* ../lesFiles/controlDict system/     #Copy fvSchemes, fvSolution and controlDict to system/ 
cp ../lesFiles/turbulenceProperties constant/           #Copy turbulenceProperties to constant/

ls -d processor* | xargs -I {} rm -rf ./{}/0            #Remove 0/ from processor*
ls -d processor* | xargs -I {} mv ./{}/500 ./{}/0       #Rename 500/ to 0/ in processor*
ls -d processor* | xargs -I {} rm -rf ./{}/0/uniform    #Remove processor*/0/uniform

runParallel pisoFoam                                    #Run pisoFoam in parallel

runApplication reconstructParMesh -constant -mergeTol 1e-6      #Reconstract mesh

runApplication reconstructPar                           #Reconstract fields
Overall, there are a few main steps in the Allruns:
  • copy motorBike surfaceinto the case
  • mesh it with snappyHexMesh
  • initiate U BCs with potentialFoam
  • run the motorBike case with pisoFoam
  • make the motorBikeLES case and initiate it with results of motorBike case

Everything is done in parallel.
Let me know if you have some further questions. It might seems to be quite complex because you run the RANS to initiate LES simulation. You can also make a case without initiating it with LES, if you are able to give good ICs and BCs

Robin
Robin.Kamenicky is offline   Reply With Quote

Old   July 28, 2018, 13:44
Smile
  #3
New Member
 
Davide
Join Date: Jun 2017
Posts: 17
Rep Power: 9
Davide95 is on a distinguished road
Dear Robin


Thanks a lot for your reply, it has been extremely enlightening.


As far as I understand if I want to perform a DDES simulation (presuming I can provide appropiate BC) i just need to replace the files in lesproperties with the ones in motorbike/motorbike, provide a valid mesh and adjust the files in 0 in order to match with the mesh.


Another possible approach would be to perform RANS and then provide the results as a starting point for the LES simulation.


The Allrun bash script automates this process.


Am I right?


Thanks again for your avaibility, you have been extremely useful.
Best regards

Davide
Davide95 is offline   Reply With Quote

Old   July 28, 2018, 14:13
Default
  #4
Member
 
Robin Kamenicky
Join Date: Mar 2016
Posts: 74
Rep Power: 11
Robin.Kamenicky is on a distinguished road
Hi Davide,
I am glad it helps

Quote:
Originally Posted by Davide95 View Post
As far as I understand if I want to perform a DDES simulation (presuming I can provide appropiate BC) i just need to replace the files in lesproperties with the ones in motorbike/motorbike, provide a valid mesh and adjust the files in 0 in order to match with the mesh.
If you want to perform LES simulation with SpalartAllmarasDDES. The main think is the lesFiles/turbulenceProperties.
In this case it has been provided also particular setup in fvSchemes, fvSolution, controlDict, however those files from lesFiles are not inevitable. Despite that I would definitely recommend to use them.
So regarding to your words. You need to do it in opposite way copy files from lesFiles to motoBike/motorBike on they particular place.

Quote:
Originally Posted by Davide95 View Post
Another possible approach would be to perform RANS and then provide the results as a starting point for the LES simulation.
That is right

Kind regards,
Robin
Robin.Kamenicky is offline   Reply With Quote

Old   July 28, 2018, 19:36
Default
  #5
New Member
 
Davide
Join Date: Jun 2017
Posts: 17
Rep Power: 9
Davide95 is on a distinguished road
Quote:
Originally Posted by Robin.Kamenicky View Post
Hi Davide,
I am glad it helps


If you want to perform LES simulation with SpalartAllmarasDDES. The main think is the lesFiles/turbulenceProperties.
In this case it has been provided also particular setup in fvSchemes, fvSolution, controlDict, however those files from lesFiles are not inevitable. Despite that I would definitely recommend to use them.
So regarding to your words. You need to do it in opposite way copy files from lesFiles to motoBike/motorBike on they particular place.



That is right

Kind regards,
Robin
Actually I wrote it the other way round but replacing the les files in the motorbike folder is what i meant! =D
Anyway I managed to start one simulation with the DDES model.
Thanks for all the help provided! Super kind and useful
Davide95 is offline   Reply With Quote

Reply

Tags
ddes, hrl, set up

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using oneEqEddy model in openFoam 4 THohman OpenFOAM Pre-Processing 1 February 11, 2017 09:31
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
about Subgrid-scale model impecca OpenFOAM Running, Solving & CFD 4 December 20, 2013 10:36
New OpenFOAM Forum Structure jola OpenFOAM 2 October 19, 2011 06:55
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 06:25


All times are GMT -4. The time now is 10:26.