OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs,...
Transcript of OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs,...
![Page 1: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/1.jpg)
OpenFOAMq OpensourceCFDtoolbox,which
suppliespreconfiguredsolvers,utilities andlibraries.
q FlexiblesetofefficientC++modules---object-oriented.
q UseFinite-VolumeMethod(FVM)tosolvesystemsofPDEsascribedonany3Dunstructured meshofpolyhedralcells.
q Goodparallelization. Overview of OpenFOAM structures
q Resourcefulcommunity (CFDforum,http://www.cfd-online.com/Forums/openfoam/)contribution(user-definedlibraries).
q interFoam,whichisasolverfor2incompressiblefluidswithinterfacetracking,isusedinthepresentstudy.Tutorials:http://cfd.direct/openfoam/user-guide/dambreak/
![Page 2: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/2.jpg)
0whereboundaryconditions aredefinedforalpha.water,B,k,nuSgs,p_rgh,U
constant
system
Meshbuilding -- blockMeshDict
Turbulence closure– turbulenceProperties,LESProperties
Computational timecontrol-- controlDict
Numerical schemes -- fvSchemes
Numerical solvers-- fvSolution
Initialcondition -- setFieldslDict
Domaindecomposition -- decomposeParDict
![Page 3: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/3.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 4: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/4.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 5: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/5.jpg)
x
y
z
0 (00-0.3)
1 (18.200.064)
2 (18.200.3)
Howtochooseanappropriatedomainheight?- Bigenoughtomakesurethebreakingwavewillnottouchthetopboundary;- Nottobig,tosavecomputationalcost.
3 (000.3)
4 (00.6 -0.3)
5 (18.2 0.60.064)
6 (18.20.60.3)
7 (00.60.3)
Howtochooseanappropriatedomainwidth?- Bigenoughtocoverseverallargesteddiesintheexperiment;- Nottobig,tosavecomputationalcost.
Inthiscase,thedomainlengthissettobesmallerthanthatintheexperiment[Ting2006,2008]butlongenoughtocovertheinitialshorelineandswashzone
DomainLayout
![Page 6: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/6.jpg)
Nz=80.Howtodeterminethenumberofgridsintheverticaldirection?-- Determined bythenumberofgridsneededtosolvethewave.
E.g.,inthiscase,H0=0.22m.Using30gridstosolvethewave∆z =7.5mmattheleftboundaryNz =Domainheight/∆z =80
z
Nx=2427.Howtodeterminethenumberofgridsinthestreamwise direction?--Makesuretheratioof∆𝑥/∆𝑧 isnottoobig(<5).
E.g.,inthiscase,Dzmax=7.5mmattheleftboundary;Dzmin=3mmattherightboundary.Tomake∆𝑥/∆𝑧 <5,chooseDxmax=11.5mm(∆𝑥/∆𝑧=3.8)attheleftboundaryandDxmin=4.6mm (∆𝑥/∆𝑧 =1.5)attherightboundary.∆𝑥 isshrinkingfromthelefttotheright.(Sois∆𝑧 )
Buildthegrids
Ny=80.Howtodeterminethenumberofgridsinthespanwisedirection?Makesuretheratiosof∆𝑦/∆𝑧 and∆𝑥/∆𝑦 arenottoobig.E.g.,inthiscase,∆y =7.5mm
x
![Page 7: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/7.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 8: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/8.jpg)
Choose theturbulenceclosure
Large-eddysimulation inthissimulation
DynamicSmagorinsky closure isused,andanimprovedversionofdynamicSmagorinsky closuredeveloped byAlbertoPassalacqua isadopted.
HowtoinstalltheimproveddynamicSmagorinsky closureinOpenFOAM?1. Downloadthesourcecodeusinggit:
git clonegit://github.com/AlbertoPa/dynamicSmagorinsky.git2.Enterthedirectorywherethesourcecodehasbeenextracted,andcompileitbytyping:
wmake libso3.AddthefollowinglinetothecontrolDict ofyourcase:libs("libOpenFOAM.so""libdynamicSmagorinskyModel.so");4.SpecifyLESModel dynamicSmagorinsky;deltacubeRootVol;inLESModel.5.Addthesubdictionary
dynamicSmagorinskyCoeffs{filtersimple;ce 1.048;}
toLESModels.
Filter isdefinedas Δ = Vcell3
https://github.com/AlbertoPa/dynamicSmagorinsky
![Page 9: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/9.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 10: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/10.jpg)
Settheinitial condition
(00-0.3)
(00.6-0.3)
(000) (00.60)
(150.60)(1500)
Offshore
Onshore
![Page 11: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/11.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 12: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/12.jpg)
Definetheboundaries
(Wall function isused)
Sends inthetargetsolitarywavethroughgroovyBC
WhatisgroovyBC?-- Alibrarythatcanbeusedtogeneratearbitraryboundaryconditions basedonexpressions. Itisincluded intheswak4Foamlibrarypackage.
Link:https://openfoamwiki.net/index.php/Contrib/swak4Foam
![Page 13: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/13.jpg)
InstallgroovyBC
1.Downloadswak4Foamlibrarypackagefrom
svn checkoutsvn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/libraries/swak4Foam/ swak4Foam_2.x
2.Inthedirectoryofthesources,type
wmake all
![Page 14: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/14.jpg)
UsegroovyBC tosendinsolitarywave
ExpressionofthetheoreticalsurfaceelevationinLeeetal.[1982]
ExpressionofthetheoreticalvelocityinLeeetal.[1982]
α1 =
1, z ≤ Hcosh2 atp −ct + xs( )( )
0, z > Hcosh2 atp −ct + xs( )( )
#
$
%%
&
%%
c = gh 1+H h( )h = 0.3m H = 0.22m fs = 2.644 g = 0,0,−9.81( ) xs = hfsH h
atp = 0.75Hh3
u =
ghHcosh2 atp −ct + xs( )"# $%h
1− 0.25Hcosh2 atp −ct + xs( )"# $%h
"
#&&
$
%'', z ≤ H
cosh2 atp −ct + xs( )( )
0, z > Hcosh2 atp −ct + xs( )( )
)
*
++
,
++
w =
− ghzh
1− 0.5Hdexcosh2 atp −ct + xs( )"# $%h
"
#&&
$
%'', z ≤ H
cosh2 atp −ct + xs( )( )
0, z > Hcosh2 atp −ct + xs( )( )
)
*
++
,
++
v = 0
![Page 15: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/15.jpg)
Specifytheboundary conditions
p_rgh:dynamicpressure
U:velocity
alpha.water: (percentageofwaterineachcell) intheVOFequationα1
B:subgrid-scale tensor inLES.istheunittensor; isthedeviatoric partofthesubgrid-scale tensorandisparameterizedbysubgrid closure
B = 2 3kI +Beff I
k:subgrid-scale kineticenergyinLES.,,istherateofstrain
k = cIΔ2 D 2 cI ≈ 0.2 D
nuSgs:,sub-gridscale viscosity inLESν sgs
![Page 16: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/16.jpg)
Specifytheboundary conditions
zeroGradient:normalgradientiszero
cyclic:periodic boundarycondition
inletOutlet:≈ zeroGradient.ButswitchtofixedValue (using“inletValue”) ifthevelocityjustoutside theboundaryisflowingintothedomain
pressureInletOutletVelocity: =pressureInletVelocity +inletOutpressureInletVelocity: When𝑝 isknownattheinlet,𝑈 isevaluatedfromthefluxnormaltothepath.
totalPressure: Totalpressure is fixed;whenchanges,pwillbeadjustedaccordingly
p0 = p+1 2ρ U2
U
![Page 17: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/17.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 18: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/18.jpg)
Numerical schemes
ddtSchemes: firsttime derivative 𝜕/𝜕𝑡 .“CrankNicholson 1”isthepure2nd-orderCrank-Nicolson scheme
gradSchemes: Gradient𝛻.“Gausslinear”meansGauss’theoremisusedwhentransformingintegralovervolumeintointegraloversurface;“linear”meanscentraldifferencescheme (CDS)
divSchemes: Divergent𝛻 ..“GausslimitedLinearV 1”and“GaussvanLeer”arebothTVDschemeswithdifferentlimiters. “Gauss interfaceCompression” isusedfortheinterfacecompression term
interpolationSchemes: numericalscheme fortheevaluation offacevaluesfromthecellcentervalues
snGradSchemes: component ofgradientnormaltoacell face
fluxRequired: fieldswhichrequirethegeneration ofaflux
laplacianSchemes: Laplacian .“Gauss linearcorrected”isCDSwithsomecorrectionterms
∇2
![Page 19: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/19.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 20: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/20.jpg)
Numerical solvers
SolvesthePressurePoissonEquation
Setthesolversforp_rgh andU
PIMPLE=SIMPLE+PISO
![Page 21: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/21.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 22: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/22.jpg)
Setthetimecontrol
startFrom
stopAt
deltaT
writeControl
adjustTimeStep
maxCo
maxAlphaCo
maxDeltaT
![Page 23: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/23.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 24: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/24.jpg)
Decompose thedomain
“decomposeParDict”
simpleCoeffs{n(412);…
}
numberOfSubdomains 8;
x
y
z
TypedecomposePar
![Page 25: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/25.jpg)
Buildthedomainandsetthegrids
Choosetheturbulence closure
Setthe initial condition
Settheboundarycondition
Choosethenumericalschemes
Choosethenumericalsolvers
Setthetimecontrol
Decompose thedomain
Runthecase
![Page 26: OpenFOAM - CSDMS€¦ · 0 where boundary conditions are defined for alpha.water, B, k, nuSgs, p_rgh, U constant system Mesh building --blockMeshDictTurbulence closure – turbulenceProperties](https://reader035.fdocuments.us/reader035/viewer/2022081401/5f06f5b47e708231d41a9825/html5/thumbnails/26.jpg)
Runthecase
TypeinterFoam