From 41e264f27de10ccfe9fdfb4e5d9167b157c2bc99 Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Tue, 5 May 2020 14:20:45 +0100 Subject: [PATCH] ENH: New atmospheric boundary layer (ABL) model suite (Part 1) Please refer to the header file documentation for complete set of details. ENH: add new fvOptions for ABL modelling - atmAmbientTurbSource - atmBuoyancyTurbSource - atmCoriolisUSource - atmLengthScaleTurbSource - atmPlantCanopyTurbSource - atmPlantCanopyUSource - atmPlantCanopyTSource - atmNutSource ENH: add new boundary conditions for ABL modelling with PatchFunction1 and TimeFunction1 support - atmAlphatkWallFunction - atmEpsilonWallFunction - atmNutkWallFunction - atmNutUWallFunction - atmNutWallFunction - atmOmegaWallFunction - atmTurbulentHeatFluxTemperature STYLE: change names of nutkAtmRoughWallFunction -> atmNutkWallFunction by ensuring the bitwise backward compatibility ENH: add new variable-scaling force computation method to actuationDiskSource ENH: review actuationDiskSource and radialActuationDiskSource ENH: add new function object, ObukhovLength ENH: add new ABL tutorials/verifications - verificationAndValidation/atmosphericModels/atmFlatTerrain - verification with the Leipzig field experiment - illustration of precursor/successor field mapping - verificationAndValidation/atmosphericModels/atmForestStability - verification with the Sweden field experiment - update incompressible/simpleFoam/turbineSiting --- .../postProcessing/fields/ObukhovLength | 23 + src/atmosphericModels/Make/files | 25 +- src/atmosphericModels/Make/options | 15 +- ...entHeatFluxTemperatureFvPatchScalarField.C | 255 +++++++++++ ...entHeatFluxTemperatureFvPatchScalarField.H | 247 +++++++++++ ...atmAlphatkWallFunctionFvPatchScalarField.C | 309 ++++++++++++++ ...atmAlphatkWallFunctionFvPatchScalarField.H | 249 +++++++++++ ...atmEpsilonWallFunctionFvPatchScalarField.C | 230 ++++++++++ ...atmEpsilonWallFunctionFvPatchScalarField.H | 234 +++++++++++ .../atmNutUWallFunctionFvPatchScalarField.C | 212 ++++++++++ .../atmNutUWallFunctionFvPatchScalarField.H} | 138 +++--- .../atmNutWallFunctionFvPatchScalarField.C | 233 +++++++++++ .../atmNutWallFunctionFvPatchScalarField.H | 270 ++++++++++++ .../atmNutkWallFunctionFvPatchScalarField.C} | 113 ++--- .../atmNutkWallFunctionFvPatchScalarField.H | 248 +++++++++++ .../atmOmegaWallFunctionFvPatchScalarField.C | 217 ++++++++++ .../atmOmegaWallFunctionFvPatchScalarField.H | 232 ++++++++++ .../ObukhovLength/ObukhovLength.C | 266 ++++++++++++ .../ObukhovLength/ObukhovLength.H | 271 ++++++++++++ .../atmAmbientTurbSource.C | 243 +++++++++++ .../atmAmbientTurbSource.H | 266 ++++++++++++ .../atmAmbientTurbSourceTemplates.C | 111 +++++ .../atmBuoyancyTurbSource.C | 354 ++++++++++++++++ .../atmBuoyancyTurbSource.H | 314 ++++++++++++++ .../atmBuoyancyTurbSourceTemplates.C | 130 ++++++ .../atmCoriolisUSource/atmCoriolisUSource.C | 170 ++++++++ .../atmCoriolisUSource/atmCoriolisUSource.H | 238 +++++++++++ .../atmLengthScaleTurbSource.C | 243 +++++++++++ .../atmLengthScaleTurbSource.H | 274 ++++++++++++ .../atmLengthScaleTurbSourceTemplates.C | 100 +++++ .../fvOptions/atmNutSource/atmNutSource.C | 125 ++++++ .../fvOptions/atmNutSource/atmNutSource.H | 165 ++++++++ .../atmPlantCanopyTSource.C | 134 ++++++ .../atmPlantCanopyTSource.H | 194 +++++++++ .../atmPlantCanopyTurbSource.C | 216 ++++++++++ .../atmPlantCanopyTurbSource.H | 247 +++++++++++ .../atmPlantCanopyTurbSourceTemplates.C | 86 ++++ .../atmPlantCanopyUSource.C | 140 +++++++ .../atmPlantCanopyUSource.H | 200 +++++++++ .../actuationDiskSource/actuationDiskSource.C | 259 ++++++++---- .../actuationDiskSource/actuationDiskSource.H | 329 ++++++++++++--- .../actuationDiskSourceTemplates.C | 227 +++++++++- .../radialActuationDiskSource.C | 8 +- .../radialActuationDiskSource.H | 106 +++-- .../radialActuationDiskSourceTemplates.C | 81 +++- .../0.orig/include/initialConditions | 2 +- .../simpleFoam/turbineSiting/0.orig/nut | 3 +- .../turbineSiting/constant/fvOptions | 41 +- .../dataset/atm-Arnqvist-2015/kNorm-zNorm.dat | 48 +++ .../dataset/atm-Arnqvist-2015/uNorm-zNorm.dat | 48 +++ .../dataset/atm-Arnqvist-2015/veer-zNorm.dat | 47 +++ .../dataset/atm-Koblitz-2013/u-z-Leipzig.dat | 48 +++ .../atmosphericModels/atmFlatTerrain/Allclean | 10 + .../atmosphericModels/atmFlatTerrain/Allrun | 10 + .../atmFlatTerrain/precursor/0.orig/T | 46 ++ .../atmFlatTerrain/precursor/0.orig/U | 41 ++ .../atmFlatTerrain/precursor/0.orig/alphat | 47 +++ .../atmFlatTerrain/precursor/0.orig/epsilon | 44 ++ .../atmFlatTerrain/precursor/0.orig/k | 41 ++ .../precursor/0.orig/leafAreaDensity | 36 ++ .../atmFlatTerrain/precursor/0.orig/nut | 45 ++ .../atmFlatTerrain/precursor/0.orig/omega | 44 ++ .../atmFlatTerrain/precursor/0.orig/p_rgh | 37 ++ .../atmFlatTerrain/precursor/0.orig/plantCd | 36 ++ .../precursor/0.orig/qPlant.temp | 36 ++ .../atmFlatTerrain/precursor/Allclean | 13 + .../atmFlatTerrain/precursor/Allrun | 34 ++ .../atmFlatTerrain/precursor/Allrun.pre | 10 + .../precursor/constant/fvOptions.temp | 110 +++++ .../atmFlatTerrain/precursor/constant/g | 23 + .../precursor/constant/transportProperties | 34 ++ .../constant/turbulenceProperties.temp | 38 ++ .../atmFlatTerrain/precursor/plot | 110 +++++ .../precursor/system/blockMeshDict | 101 +++++ .../precursor/system/controlDict | 55 +++ .../atmFlatTerrain/precursor/system/fvSchemes | 68 +++ .../precursor/system/fvSolution | 76 ++++ .../atmFlatTerrain/precursor/system/samples | 25 ++ .../atmFlatTerrain/successor/0.orig/T | 60 +++ .../atmFlatTerrain/successor/0.orig/U | 56 +++ .../atmFlatTerrain/successor/0.orig/alphat | 61 +++ .../atmFlatTerrain/successor/0.orig/epsilon | 59 +++ .../atmFlatTerrain/successor/0.orig/k | 56 +++ .../atmFlatTerrain/successor/0.orig/nut | 59 +++ .../atmFlatTerrain/successor/0.orig/omega | 51 +++ .../atmFlatTerrain/successor/0.orig/p_rgh | 49 +++ .../atmFlatTerrain/successor/Allclean | 11 + .../atmFlatTerrain/successor/Allrun | 25 ++ .../successor/constant/boundaryData/p1/0/T | 162 +++++++ .../successor/constant/boundaryData/p1/0/U | 162 +++++++ .../constant/boundaryData/p1/0/alphat | 162 +++++++ .../constant/boundaryData/p1/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p1/0/k | 162 +++++++ .../successor/constant/boundaryData/p1/0/nut | 162 +++++++ .../constant/boundaryData/p1/0/p_rgh | 162 +++++++ .../successor/constant/boundaryData/p1/points | 162 +++++++ .../successor/constant/boundaryData/p10/0/T | 162 +++++++ .../successor/constant/boundaryData/p10/0/U | 162 +++++++ .../constant/boundaryData/p10/0/alphat | 162 +++++++ .../constant/boundaryData/p10/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p10/0/k | 162 +++++++ .../successor/constant/boundaryData/p10/0/nut | 162 +++++++ .../constant/boundaryData/p10/points | 162 +++++++ .../successor/constant/boundaryData/p11/0/T | 162 +++++++ .../successor/constant/boundaryData/p11/0/U | 162 +++++++ .../constant/boundaryData/p11/0/alphat | 162 +++++++ .../constant/boundaryData/p11/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p11/0/k | 162 +++++++ .../successor/constant/boundaryData/p11/0/nut | 162 +++++++ .../constant/boundaryData/p11/points | 162 +++++++ .../successor/constant/boundaryData/p12/0/T | 162 +++++++ .../successor/constant/boundaryData/p12/0/U | 162 +++++++ .../constant/boundaryData/p12/0/alphat | 162 +++++++ .../constant/boundaryData/p12/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p12/0/k | 162 +++++++ .../successor/constant/boundaryData/p12/0/nut | 162 +++++++ .../constant/boundaryData/p12/points | 162 +++++++ .../successor/constant/boundaryData/p13/0/T | 162 +++++++ .../successor/constant/boundaryData/p13/0/U | 162 +++++++ .../constant/boundaryData/p13/0/alphat | 162 +++++++ .../constant/boundaryData/p13/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p13/0/k | 162 +++++++ .../successor/constant/boundaryData/p13/0/nut | 162 +++++++ .../constant/boundaryData/p13/points | 162 +++++++ .../successor/constant/boundaryData/p14/0/T | 162 +++++++ .../successor/constant/boundaryData/p14/0/U | 162 +++++++ .../constant/boundaryData/p14/0/alphat | 162 +++++++ .../constant/boundaryData/p14/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p14/0/k | 162 +++++++ .../successor/constant/boundaryData/p14/0/nut | 162 +++++++ .../constant/boundaryData/p14/points | 162 +++++++ .../successor/constant/boundaryData/p15/0/T | 162 +++++++ .../successor/constant/boundaryData/p15/0/U | 162 +++++++ .../constant/boundaryData/p15/0/alphat | 162 +++++++ .../constant/boundaryData/p15/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p15/0/k | 162 +++++++ .../successor/constant/boundaryData/p15/0/nut | 162 +++++++ .../constant/boundaryData/p15/points | 162 +++++++ .../successor/constant/boundaryData/p16/0/T | 162 +++++++ .../successor/constant/boundaryData/p16/0/U | 162 +++++++ .../constant/boundaryData/p16/0/alphat | 162 +++++++ .../constant/boundaryData/p16/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p16/0/k | 162 +++++++ .../successor/constant/boundaryData/p16/0/nut | 162 +++++++ .../constant/boundaryData/p16/points | 162 +++++++ .../successor/constant/boundaryData/p17/0/T | 162 +++++++ .../successor/constant/boundaryData/p17/0/U | 162 +++++++ .../constant/boundaryData/p17/0/alphat | 162 +++++++ .../constant/boundaryData/p17/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p17/0/k | 162 +++++++ .../successor/constant/boundaryData/p17/0/nut | 162 +++++++ .../constant/boundaryData/p17/points | 162 +++++++ .../successor/constant/boundaryData/p18/0/T | 162 +++++++ .../successor/constant/boundaryData/p18/0/U | 162 +++++++ .../constant/boundaryData/p18/0/alphat | 162 +++++++ .../constant/boundaryData/p18/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p18/0/k | 162 +++++++ .../successor/constant/boundaryData/p18/0/nut | 162 +++++++ .../constant/boundaryData/p18/points | 162 +++++++ .../successor/constant/boundaryData/p19/0/T | 162 +++++++ .../successor/constant/boundaryData/p19/0/U | 162 +++++++ .../constant/boundaryData/p19/0/alphat | 162 +++++++ .../constant/boundaryData/p19/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p19/0/k | 162 +++++++ .../successor/constant/boundaryData/p19/0/nut | 162 +++++++ .../constant/boundaryData/p19/points | 162 +++++++ .../successor/constant/boundaryData/p2/0/T | 162 +++++++ .../successor/constant/boundaryData/p2/0/U | 162 +++++++ .../constant/boundaryData/p2/0/alphat | 162 +++++++ .../constant/boundaryData/p2/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p2/0/k | 162 +++++++ .../successor/constant/boundaryData/p2/0/nut | 162 +++++++ .../successor/constant/boundaryData/p2/points | 162 +++++++ .../successor/constant/boundaryData/p20/0/T | 162 +++++++ .../successor/constant/boundaryData/p20/0/U | 162 +++++++ .../constant/boundaryData/p20/0/alphat | 162 +++++++ .../constant/boundaryData/p20/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p20/0/k | 162 +++++++ .../successor/constant/boundaryData/p20/0/nut | 162 +++++++ .../constant/boundaryData/p20/points | 162 +++++++ .../successor/constant/boundaryData/p21/0/T | 162 +++++++ .../successor/constant/boundaryData/p21/0/U | 162 +++++++ .../constant/boundaryData/p21/0/alphat | 162 +++++++ .../constant/boundaryData/p21/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p21/0/k | 162 +++++++ .../successor/constant/boundaryData/p21/0/nut | 162 +++++++ .../constant/boundaryData/p21/points | 162 +++++++ .../successor/constant/boundaryData/p22/0/T | 162 +++++++ .../successor/constant/boundaryData/p22/0/U | 162 +++++++ .../constant/boundaryData/p22/0/alphat | 162 +++++++ .../constant/boundaryData/p22/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p22/0/k | 162 +++++++ .../successor/constant/boundaryData/p22/0/nut | 162 +++++++ .../constant/boundaryData/p22/points | 162 +++++++ .../successor/constant/boundaryData/p23/0/T | 162 +++++++ .../successor/constant/boundaryData/p23/0/U | 162 +++++++ .../constant/boundaryData/p23/0/alphat | 162 +++++++ .../constant/boundaryData/p23/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p23/0/k | 162 +++++++ .../successor/constant/boundaryData/p23/0/nut | 162 +++++++ .../constant/boundaryData/p23/points | 162 +++++++ .../successor/constant/boundaryData/p24/0/T | 162 +++++++ .../successor/constant/boundaryData/p24/0/U | 162 +++++++ .../constant/boundaryData/p24/0/alphat | 162 +++++++ .../constant/boundaryData/p24/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p24/0/k | 162 +++++++ .../successor/constant/boundaryData/p24/0/nut | 162 +++++++ .../constant/boundaryData/p24/points | 162 +++++++ .../successor/constant/boundaryData/p25/0/T | 162 +++++++ .../successor/constant/boundaryData/p25/0/U | 162 +++++++ .../constant/boundaryData/p25/0/alphat | 162 +++++++ .../constant/boundaryData/p25/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p25/0/k | 162 +++++++ .../successor/constant/boundaryData/p25/0/nut | 162 +++++++ .../constant/boundaryData/p25/points | 162 +++++++ .../successor/constant/boundaryData/p26/0/T | 162 +++++++ .../successor/constant/boundaryData/p26/0/U | 162 +++++++ .../constant/boundaryData/p26/0/alphat | 162 +++++++ .../constant/boundaryData/p26/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p26/0/k | 162 +++++++ .../successor/constant/boundaryData/p26/0/nut | 162 +++++++ .../constant/boundaryData/p26/points | 162 +++++++ .../successor/constant/boundaryData/p27/0/T | 162 +++++++ .../successor/constant/boundaryData/p27/0/U | 162 +++++++ .../constant/boundaryData/p27/0/alphat | 162 +++++++ .../constant/boundaryData/p27/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p27/0/k | 162 +++++++ .../successor/constant/boundaryData/p27/0/nut | 162 +++++++ .../constant/boundaryData/p27/points | 162 +++++++ .../successor/constant/boundaryData/p28/0/T | 162 +++++++ .../successor/constant/boundaryData/p28/0/U | 162 +++++++ .../constant/boundaryData/p28/0/alphat | 162 +++++++ .../constant/boundaryData/p28/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p28/0/k | 162 +++++++ .../successor/constant/boundaryData/p28/0/nut | 162 +++++++ .../constant/boundaryData/p28/points | 162 +++++++ .../successor/constant/boundaryData/p29/0/T | 162 +++++++ .../successor/constant/boundaryData/p29/0/U | 162 +++++++ .../constant/boundaryData/p29/0/alphat | 162 +++++++ .../constant/boundaryData/p29/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p29/0/k | 162 +++++++ .../successor/constant/boundaryData/p29/0/nut | 162 +++++++ .../constant/boundaryData/p29/points | 162 +++++++ .../successor/constant/boundaryData/p3/0/T | 162 +++++++ .../successor/constant/boundaryData/p3/0/U | 162 +++++++ .../constant/boundaryData/p3/0/alphat | 162 +++++++ .../constant/boundaryData/p3/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p3/0/k | 162 +++++++ .../successor/constant/boundaryData/p3/0/nut | 162 +++++++ .../successor/constant/boundaryData/p3/points | 162 +++++++ .../successor/constant/boundaryData/p30/0/T | 162 +++++++ .../successor/constant/boundaryData/p30/0/U | 162 +++++++ .../constant/boundaryData/p30/0/alphat | 162 +++++++ .../constant/boundaryData/p30/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p30/0/k | 162 +++++++ .../successor/constant/boundaryData/p30/0/nut | 162 +++++++ .../constant/boundaryData/p30/points | 162 +++++++ .../successor/constant/boundaryData/p31/0/T | 162 +++++++ .../successor/constant/boundaryData/p31/0/U | 162 +++++++ .../constant/boundaryData/p31/0/alphat | 162 +++++++ .../constant/boundaryData/p31/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p31/0/k | 162 +++++++ .../successor/constant/boundaryData/p31/0/nut | 162 +++++++ .../constant/boundaryData/p31/points | 162 +++++++ .../successor/constant/boundaryData/p32/0/T | 162 +++++++ .../successor/constant/boundaryData/p32/0/U | 162 +++++++ .../constant/boundaryData/p32/0/alphat | 162 +++++++ .../constant/boundaryData/p32/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p32/0/k | 162 +++++++ .../successor/constant/boundaryData/p32/0/nut | 162 +++++++ .../constant/boundaryData/p32/points | 162 +++++++ .../successor/constant/boundaryData/p33/0/T | 162 +++++++ .../successor/constant/boundaryData/p33/0/U | 162 +++++++ .../constant/boundaryData/p33/0/alphat | 162 +++++++ .../constant/boundaryData/p33/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p33/0/k | 162 +++++++ .../successor/constant/boundaryData/p33/0/nut | 162 +++++++ .../constant/boundaryData/p33/points | 162 +++++++ .../successor/constant/boundaryData/p34/0/T | 162 +++++++ .../successor/constant/boundaryData/p34/0/U | 162 +++++++ .../constant/boundaryData/p34/0/alphat | 162 +++++++ .../constant/boundaryData/p34/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p34/0/k | 162 +++++++ .../successor/constant/boundaryData/p34/0/nut | 162 +++++++ .../constant/boundaryData/p34/points | 162 +++++++ .../successor/constant/boundaryData/p35/0/T | 162 +++++++ .../successor/constant/boundaryData/p35/0/U | 162 +++++++ .../constant/boundaryData/p35/0/alphat | 162 +++++++ .../constant/boundaryData/p35/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p35/0/k | 162 +++++++ .../successor/constant/boundaryData/p35/0/nut | 162 +++++++ .../constant/boundaryData/p35/points | 162 +++++++ .../successor/constant/boundaryData/p36/0/T | 162 +++++++ .../successor/constant/boundaryData/p36/0/U | 162 +++++++ .../constant/boundaryData/p36/0/alphat | 162 +++++++ .../constant/boundaryData/p36/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p36/0/k | 162 +++++++ .../successor/constant/boundaryData/p36/0/nut | 162 +++++++ .../constant/boundaryData/p36/points | 163 +++++++ .../successor/constant/boundaryData/p4/0/T | 162 +++++++ .../successor/constant/boundaryData/p4/0/U | 162 +++++++ .../constant/boundaryData/p4/0/alphat | 162 +++++++ .../constant/boundaryData/p4/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p4/0/k | 162 +++++++ .../successor/constant/boundaryData/p4/0/nut | 162 +++++++ .../successor/constant/boundaryData/p4/points | 162 +++++++ .../successor/constant/boundaryData/p5/0/T | 162 +++++++ .../successor/constant/boundaryData/p5/0/U | 162 +++++++ .../constant/boundaryData/p5/0/alphat | 162 +++++++ .../constant/boundaryData/p5/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p5/0/k | 162 +++++++ .../successor/constant/boundaryData/p5/0/nut | 162 +++++++ .../successor/constant/boundaryData/p5/points | 162 +++++++ .../successor/constant/boundaryData/p6/0/T | 162 +++++++ .../successor/constant/boundaryData/p6/0/U | 162 +++++++ .../constant/boundaryData/p6/0/alphat | 162 +++++++ .../constant/boundaryData/p6/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p6/0/k | 162 +++++++ .../successor/constant/boundaryData/p6/0/nut | 162 +++++++ .../successor/constant/boundaryData/p6/points | 162 +++++++ .../successor/constant/boundaryData/p7/0/T | 162 +++++++ .../successor/constant/boundaryData/p7/0/U | 162 +++++++ .../constant/boundaryData/p7/0/alphat | 162 +++++++ .../constant/boundaryData/p7/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p7/0/k | 162 +++++++ .../successor/constant/boundaryData/p7/0/nut | 162 +++++++ .../successor/constant/boundaryData/p7/points | 162 +++++++ .../successor/constant/boundaryData/p8/0/T | 162 +++++++ .../successor/constant/boundaryData/p8/0/U | 162 +++++++ .../constant/boundaryData/p8/0/alphat | 162 +++++++ .../constant/boundaryData/p8/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p8/0/k | 162 +++++++ .../successor/constant/boundaryData/p8/0/nut | 162 +++++++ .../successor/constant/boundaryData/p8/points | 162 +++++++ .../successor/constant/boundaryData/p9/0/T | 162 +++++++ .../successor/constant/boundaryData/p9/0/U | 162 +++++++ .../constant/boundaryData/p9/0/alphat | 162 +++++++ .../constant/boundaryData/p9/0/epsilon | 162 +++++++ .../successor/constant/boundaryData/p9/0/k | 162 +++++++ .../successor/constant/boundaryData/p9/0/nut | 162 +++++++ .../successor/constant/boundaryData/p9/points | 162 +++++++ .../successor/constant/fvOptions | 75 ++++ .../atmFlatTerrain/successor/constant/g | 22 + .../constant/polyMesh.orig/boundary.gz | Bin 0 -> 789 bytes .../constant/polyMesh.orig/cellZones.gz | Bin 0 -> 312 bytes .../constant/polyMesh.orig/faceZones.gz | Bin 0 -> 312 bytes .../successor/constant/polyMesh.orig/faces.gz | Bin 0 -> 9873273 bytes .../constant/polyMesh.orig/neighbour.gz | Bin 0 -> 1489510 bytes .../successor/constant/polyMesh.orig/owner.gz | Bin 0 -> 683394 bytes .../constant/polyMesh.orig/pointZones.gz | Bin 0 -> 314 bytes .../constant/polyMesh.orig/points.gz | Bin 0 -> 6253070 bytes .../successor/constant/transportProperties | 35 ++ .../constant/turbulenceProperties.temp | 37 ++ .../successor/system/controlDict | 71 ++++ .../successor/system/decomposeParDict | 27 ++ .../atmFlatTerrain/successor/system/fvSchemes | 68 +++ .../successor/system/fvSolution | 77 ++++ .../successor/system/mapFieldsDict | 24 ++ .../atmFlatTerrain/successor/system/samples | 159 +++++++ .../atmForestStability/0.orig/T | 46 ++ .../atmForestStability/0.orig/U | 41 ++ .../atmForestStability/0.orig/alphat | 47 +++ .../atmForestStability/0.orig/epsilon | 44 ++ .../atmForestStability/0.orig/k | 41 ++ .../atmForestStability/0.orig/leafAreaDensity | 42 ++ .../atmForestStability/0.orig/nut | 46 ++ .../atmForestStability/0.orig/omega | 44 ++ .../atmForestStability/0.orig/p_rgh | 38 ++ .../atmForestStability/0.orig/plantCd | 36 ++ .../atmForestStability/0.orig/qPlant.temp | 36 ++ .../atmForestStability/Allclean | 15 + .../atmForestStability/Allrun | 75 ++++ .../atmForestStability/Allrun.pre | 14 + .../constant/fvOptions.temp | 106 +++++ .../atmForestStability/constant/g | 23 + .../constant/transportProperties | 34 ++ .../constant/turbulenceProperties.temp | 38 ++ .../atmosphericModels/atmForestStability/plot | 396 ++++++++++++++++++ .../atmForestStability/system/blockMeshDict | 101 +++++ .../atmForestStability/system/controlDict | 104 +++++ .../system/decomposeParDict | 27 ++ .../atmForestStability/system/fvSchemes | 68 +++ .../atmForestStability/system/fvSolution | 76 ++++ .../atmForestStability/system/samples | 34 ++ .../system/setFieldsDict.temp | 58 +++ .../system/turbulenceFields | 9 + 386 files changed, 53513 insertions(+), 349 deletions(-) create mode 100644 etc/caseDicts/postProcessing/fields/ObukhovLength create mode 100644 src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C create mode 100644 src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.H create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.C create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.H create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.C rename src/atmosphericModels/derivedFvPatchFields/{nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H => wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.H} (55%) create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.H rename src/atmosphericModels/derivedFvPatchFields/{nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C => wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C} (59%) create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.H create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.C create mode 100644 src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.H create mode 100644 src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C create mode 100644 src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.H create mode 100644 src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.C create mode 100644 src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.H create mode 100644 src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSourceTemplates.C create mode 100644 src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.C create mode 100644 src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.H create mode 100644 src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSourceTemplates.C create mode 100644 src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.C create mode 100644 src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.H create mode 100644 src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.C create mode 100644 src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.H create mode 100644 src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSourceTemplates.C create mode 100644 src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.C create mode 100644 src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.H create mode 100644 src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.C create mode 100644 src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.H create mode 100644 src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C create mode 100644 src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.H create mode 100644 src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSourceTemplates.C create mode 100644 src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C create mode 100644 src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.H create mode 100644 tutorials/resources/dataset/atm-Arnqvist-2015/kNorm-zNorm.dat create mode 100644 tutorials/resources/dataset/atm-Arnqvist-2015/uNorm-zNorm.dat create mode 100644 tutorials/resources/dataset/atm-Arnqvist-2015/veer-zNorm.dat create mode 100644 tutorials/resources/dataset/atm-Koblitz-2013/u-z-Leipzig.dat create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/Allclean create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/Allrun create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/leafAreaDensity create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/omega create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/p_rgh create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/plantCd create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/0.orig/qPlant.temp create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/Allclean create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/Allrun create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/Allrun.pre create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/constant/fvOptions.temp create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/constant/g create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/constant/transportProperties create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/constant/turbulenceProperties.temp create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/plot create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/system/blockMeshDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/system/controlDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/system/fvSchemes create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/system/fvSolution create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/precursor/system/samples create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/omega create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/0.orig/p_rgh create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/Allclean create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/Allrun create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/0/p_rgh create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p1/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p10/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p10/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p10/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p10/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p10/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p10/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p10/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p11/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p11/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p11/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p11/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p11/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p11/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p11/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p12/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p12/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p12/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p12/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p12/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p12/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p12/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p13/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p13/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p13/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p13/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p13/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p13/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p13/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p14/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p14/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p14/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p14/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p14/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p14/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p14/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p15/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p15/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p15/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p15/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p15/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p15/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p15/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p16/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p16/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p16/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p16/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p16/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p16/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p16/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p17/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p17/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p17/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p17/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p17/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p17/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p17/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p18/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p18/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p18/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p18/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p18/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p18/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p18/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p19/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p19/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p19/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p19/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p19/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p19/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p19/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p2/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p2/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p2/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p2/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p2/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p2/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p2/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p20/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p20/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p20/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p20/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p20/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p20/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p20/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p21/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p21/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p21/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p21/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p21/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p21/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p21/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p22/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p22/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p22/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p22/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p22/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p22/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p22/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p23/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p23/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p23/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p23/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p23/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p23/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p23/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p24/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p24/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p24/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p24/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p24/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p24/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p24/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p25/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p25/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p25/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p25/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p25/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p25/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p25/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p26/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p26/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p26/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p26/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p26/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p26/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p26/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p27/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p27/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p27/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p27/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p27/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p27/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p27/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p28/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p28/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p28/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p28/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p28/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p28/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p28/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p29/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p29/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p29/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p29/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p29/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p29/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p29/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p3/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p3/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p3/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p3/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p3/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p3/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p3/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p30/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p30/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p30/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p30/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p30/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p30/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p30/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p31/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p31/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p31/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p31/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p31/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p31/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p31/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p32/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p32/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p32/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p32/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p32/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p32/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p32/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p33/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p33/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p33/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p33/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p33/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p33/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p33/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p34/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p34/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p34/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p34/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p34/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p34/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p34/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p35/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p35/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p35/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p35/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p35/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p35/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p35/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p36/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p36/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p36/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p36/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p36/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p36/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p36/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p4/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p4/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p4/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p4/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p4/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p4/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p4/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p5/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p5/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p5/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p5/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p5/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p5/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p5/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p6/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p6/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p6/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p6/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p6/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p6/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p6/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p7/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p7/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p7/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p7/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p7/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p7/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p7/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p8/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p8/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p8/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p8/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p8/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p8/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p8/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p9/0/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p9/0/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p9/0/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p9/0/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p9/0/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p9/0/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/boundaryData/p9/points create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/fvOptions create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/g create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/boundary.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/cellZones.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/faceZones.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/faces.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/neighbour.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/owner.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/pointZones.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/polyMesh.orig/points.gz create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/transportProperties create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/constant/turbulenceProperties.temp create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/system/controlDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/system/decomposeParDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/system/fvSchemes create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/system/fvSolution create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/system/mapFieldsDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmFlatTerrain/successor/system/samples create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/T create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/U create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/alphat create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/epsilon create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/k create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/leafAreaDensity create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/nut create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/omega create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/p_rgh create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/plantCd create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/0.orig/qPlant.temp create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/Allclean create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/Allrun create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/Allrun.pre create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/constant/fvOptions.temp create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/constant/g create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/constant/transportProperties create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/constant/turbulenceProperties.temp create mode 100755 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/plot create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/blockMeshDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/controlDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/decomposeParDict create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/fvSchemes create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/fvSolution create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/samples create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/setFieldsDict.temp create mode 100644 tutorials/verificationAndValidation/atmosphericModels/atmForestStability/system/turbulenceFields diff --git a/etc/caseDicts/postProcessing/fields/ObukhovLength b/etc/caseDicts/postProcessing/fields/ObukhovLength new file mode 100644 index 0000000000..1c105f6bc4 --- /dev/null +++ b/etc/caseDicts/postProcessing/fields/ObukhovLength @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Version: v1912 + \\ / A nd | Website: www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- +Description + Computes the Obukhov length field and associated friction velocity field. + +\*---------------------------------------------------------------------------*/ + +type ObukhovLength; +libs (fieldFunctionObjects); + +U ; +kappa 0.4; +beta 3e-3; + +executeControl writeTime; +writeControl writeTime; + +// ************************************************************************* // diff --git a/src/atmosphericModels/Make/files b/src/atmosphericModels/Make/files index 887e1e6059..b68f5c7b7e 100644 --- a/src/atmosphericModels/Make/files +++ b/src/atmosphericModels/Make/files @@ -1,22 +1,41 @@ /* Models */ - atmosphericTurbulentTransportModels.C porosityModels/powerLawLopesdaCosta/powerLawLopesdaCosta.C /* Boundary conditions */ - derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C derivedFvPatchFields/atmBoundaryLayerInletOmega/atmBoundaryLayerInletOmegaFvPatchScalarField.C -derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C /* Wall function BCs */ +wallFunctions = derivedFvPatchFields/wallFunctions + +$(wallFunctions)/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C +$(wallFunctions)/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.C +$(wallFunctions)/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C +$(wallFunctions)/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.C +$(wallFunctions)/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C +$(wallFunctions)/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.C /* fvOptions */ +fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.C +fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.C +fvOptions/atmCoriolisUSource/atmCoriolisUSource.C +fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.C +fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C +fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C +fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.C +fvOptions/atmNutSource/atmNutSource.C + + +/* functionObjects */ +functionObjects/ObukhovLength/ObukhovLength.C + LIB = $(FOAM_LIBBIN)/libatmosphericModels diff --git a/src/atmosphericModels/Make/options b/src/atmosphericModels/Make/options index 644c909621..d2af502b1a 100644 --- a/src/atmosphericModels/Make/options +++ b/src/atmosphericModels/Make/options @@ -2,10 +2,15 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels \ - -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude LIB_LIBS = \ @@ -13,6 +18,8 @@ LIB_LIBS = \ -lfvOptions \ -lmeshTools \ -lsurfMesh \ + -lfluidThermophysicalModels \ + -lsolidThermo \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ - -lincompressibleTransportModels + -lcompressibleTurbulenceModels diff --git a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C new file mode 100644 index 0000000000..9f2729a0a7 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C @@ -0,0 +1,255 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmTurbulentHeatFluxTemperatureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const Foam::Enum +< + Foam::atmTurbulentHeatFluxTemperatureFvPatchScalarField::heatSourceType +> +Foam::atmTurbulentHeatFluxTemperatureFvPatchScalarField::heatSourceTypeNames +({ + { heatSourceType::POWER , "power" }, + { heatSourceType::FLUX , "flux" } +}); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +atmTurbulentHeatFluxTemperatureFvPatchScalarField:: +atmTurbulentHeatFluxTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedGradientFvPatchScalarField(p, iF), + heatSource_(heatSourceType::POWER), + alphaEffName_("undefinedAlphaEff"), + Cp0_(db().time(), "Cp0"), + q_(nullptr) +{} + + +atmTurbulentHeatFluxTemperatureFvPatchScalarField:: +atmTurbulentHeatFluxTemperatureFvPatchScalarField +( + const atmTurbulentHeatFluxTemperatureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedGradientFvPatchScalarField(ptf, p, iF, mapper), + heatSource_(ptf.heatSource_), + alphaEffName_(ptf.alphaEffName_), + Cp0_(ptf.Cp0_), + q_(ptf.q_.clone(p.patch())) +{} + + +atmTurbulentHeatFluxTemperatureFvPatchScalarField:: +atmTurbulentHeatFluxTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedGradientFvPatchScalarField(p, iF), + heatSource_ + ( + heatSourceTypeNames.getOrDefault + ( + "heatSource", + dict, + heatSourceType::POWER + ) + ), + alphaEffName_(dict.get("alphaEff")), + Cp0_(TimeFunction1(db().time(), "Cp0", dict)), + q_(PatchFunction1::New(p.patch(), "q", dict)) +{ + if (dict.found("value") && dict.found("gradient")) + { + fvPatchField::operator = + ( + Field("value", dict, p.size()) + ); + gradient() = Field("gradient", dict, p.size()); + } + else + { + fvPatchField::operator=(patchInternalField()); + gradient() = 0.0; + } +} + + +atmTurbulentHeatFluxTemperatureFvPatchScalarField:: +atmTurbulentHeatFluxTemperatureFvPatchScalarField +( + const atmTurbulentHeatFluxTemperatureFvPatchScalarField& atmpsf +) +: + fixedGradientFvPatchScalarField(atmpsf), + heatSource_(atmpsf.heatSource_), + alphaEffName_(atmpsf.alphaEffName_), + Cp0_(atmpsf.Cp0_), + q_(atmpsf.q_.clone(this->patch().patch())) +{} + + +atmTurbulentHeatFluxTemperatureFvPatchScalarField:: +atmTurbulentHeatFluxTemperatureFvPatchScalarField +( + const atmTurbulentHeatFluxTemperatureFvPatchScalarField& atmpsf, + const DimensionedField& iF +) +: + fixedGradientFvPatchScalarField(atmpsf, iF), + heatSource_(atmpsf.heatSource_), + alphaEffName_(atmpsf.alphaEffName_), + Cp0_(atmpsf.Cp0_), + q_(atmpsf.q_.clone(this->patch().patch())) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void atmTurbulentHeatFluxTemperatureFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + scalarField::autoMap(m); + q_->autoMap(m); +} + + +void atmTurbulentHeatFluxTemperatureFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedGradientFvPatchScalarField::rmap(ptf, addr); + + const atmTurbulentHeatFluxTemperatureFvPatchScalarField& atmptf = + refCast(ptf); + + q_->rmap(atmptf.q_(), addr); +} + + +void atmTurbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const scalarField& alphaEffp = + patch().lookupPatchField(alphaEffName_); + + const scalar t = db().time().timeOutputValue(); + const scalar Cp0 = Cp0_.value(t); + + if (Cp0 < SMALL) + { + FatalErrorInFunction + << "Cp0 = " << Cp0 << " must be positive." + << exit(FatalIOError); + } + + const scalarField q(q_->value(t)); + + switch (heatSource_) + { + case heatSourceType::POWER: + { + const scalar Ap = gSum(patch().magSf()); + gradient() = q/(Ap*Cp0*alphaEffp + SMALL); + break; + } + + case heatSourceType::FLUX: + { + gradient() = q/(Cp0*alphaEffp + SMALL); + break; + } + + default: + { + FatalErrorInFunction + << "Unknown heat source type. Valid types are: " + << heatSourceTypeNames << nl + << exit(FatalIOError); + } + } + + fixedGradientFvPatchScalarField::updateCoeffs(); +} + + +void atmTurbulentHeatFluxTemperatureFvPatchScalarField::write(Ostream& os) const +{ + fixedGradientFvPatchScalarField::write(os); + os.writeEntry("heatSource", heatSourceTypeNames[heatSource_]); + os.writeEntry("alphaEff", alphaEffName_); + Cp0_.writeData(os); + q_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + atmTurbulentHeatFluxTemperatureFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.H new file mode 100644 index 0000000000..c2f6a645a0 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.H @@ -0,0 +1,247 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::atmTurbulentHeatFluxTemperatureFvPatchScalarField + +Group + grpAtmWallFunctions + +Description + This boundary condition provides a fixed heat constraint on temperature, + i.e. \c T, to specify temperature gradient. Input heat source either + specified in terms of an absolute power [W], or as a flux [W/m2]. + + Required fields: + \verbatim + nut | Turbulent viscosity [m2/s] + k | Turbulent kinetic energy [m2/s2] + \endverbatim + +Usage + Example of the boundary condition specification: + \verbatim + + { + // Mandatory entries (unmodifiable) + type atmTurbulentHeatFluxTemperature; + heatSource flux; + alphaEff alphaEff; + + // Mandatory entries (runtime modifiable) + Cp0 0.001; + q uniform 10; + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + heatSource | Heat source type | word | yes | - + alphaEff | Name of turbulent thermal diff. field [kg/m/s] | word | yes | - + Cp0 | Specific heat capacity | TimeFunction1 | yes | - + q | Heat source value | PatchFunction1 | yes | - + \endtable + + Options for the \c heatSource entry: + \verbatim + power | Absolute power heat source [W] + flux | Flux heat source [W/m^2] + \endverbatim + + The inherited entries are elaborated in: + - \link fixedGradientFvPatchScalarField.H \endlink + - \link TimeFunction1.H \endlink + - \link PatchFunction1.H \endlink + +SourceFiles + atmTurbulentHeatFluxTemperatureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmTurbulentHeatFluxTemperatureFvPatchScalarFields_H +#define atmTurbulentHeatFluxTemperatureFvPatchScalarFields_H + +#include "fvPatchFields.H" +#include "fixedGradientFvPatchFields.H" +#include "TimeFunction1.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class atmTurbulentHeatFluxTemperatureFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class atmTurbulentHeatFluxTemperatureFvPatchScalarField +: + public fixedGradientFvPatchScalarField +{ + // Private Enumerations + + //- Options for the heat source input modes + enum heatSourceType + { + POWER, //!< "Absolute power heat source" + FLUX //!< "Flux heat source" + }; + + //- Names for heatSourceType + static const Enum heatSourceTypeNames; + + + // Private Data + + //- Heat source type + const enum heatSourceType heatSource_; + + //- Name of effective thermal diffusivity field [kg/m/s] + word alphaEffName_; + + //- Specific heat capacity [-] + TimeFunction1 Cp0_; + + //- Heat power [W] or flux [W/m2] + // Divided by density, rho, if used in kinematic form + autoPtr> q_; + +public: + + //- Runtime type information + TypeName("atmTurbulentHeatFluxTemperature"); + + + // Constructors + + //- Construct from patch and internal field + atmTurbulentHeatFluxTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmTurbulentHeatFluxTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + //- atmTurbulentHeatFluxTemperatureFvPatchScalarField onto + //- a new patch + atmTurbulentHeatFluxTemperatureFvPatchScalarField + ( + const atmTurbulentHeatFluxTemperatureFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + atmTurbulentHeatFluxTemperatureFvPatchScalarField + ( + const atmTurbulentHeatFluxTemperatureFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmTurbulentHeatFluxTemperatureFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmTurbulentHeatFluxTemperatureFvPatchScalarField + ( + const atmTurbulentHeatFluxTemperatureFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmTurbulentHeatFluxTemperatureFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member Functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..2633d9ada4 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C @@ -0,0 +1,309 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmAlphatkWallFunctionFvPatchScalarField.H" +#include "turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "wallFvPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +scalar atmAlphatkWallFunctionFvPatchScalarField::tolerance_ = 0.01; + +label atmAlphatkWallFunctionFvPatchScalarField::maxIters_ = 10; + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void atmAlphatkWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorInFunction + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +atmAlphatkWallFunctionFvPatchScalarField:: +atmAlphatkWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + Cmu_(0.09), + kappa_(0.41), + Pr_(db().time(), "Pr"), + Prt_(nullptr), + z0_(nullptr) +{ + checkType(); +} + + +atmAlphatkWallFunctionFvPatchScalarField:: +atmAlphatkWallFunctionFvPatchScalarField +( + const atmAlphatkWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + Pr_(ptf.Pr_), + Prt_(ptf.Prt_.clone(p.patch())), + z0_(ptf.z0_.clone(p.patch())) +{ + checkType(); +} + + +atmAlphatkWallFunctionFvPatchScalarField:: +atmAlphatkWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + Cmu_ + ( + dict.getCheckOrDefault + ( + "Cmu", + 0.09, + scalarMinMax::ge(0) + ) + ), + kappa_ + ( + dict.getCheckOrDefault + ( + "kappa", + 0.41, + scalarMinMax::ge(0) + ) + ), + Pr_(TimeFunction1(db().time(), "Pr", dict)), + Prt_(PatchFunction1::New(p.patch(), "Prt", dict)), + z0_(PatchFunction1::New(p.patch(), "z0", dict)) +{ + checkType(); +} + + +atmAlphatkWallFunctionFvPatchScalarField:: +atmAlphatkWallFunctionFvPatchScalarField +( + const atmAlphatkWallFunctionFvPatchScalarField& wfpsf +) +: + fixedValueFvPatchScalarField(wfpsf), + Cmu_(wfpsf.Cmu_), + kappa_(wfpsf.kappa_), + Pr_(wfpsf.Pr_), + Prt_(wfpsf.Prt_.clone(this->patch().patch())), + z0_(wfpsf.z0_.clone(this->patch().patch())) +{ + checkType(); +} + + +atmAlphatkWallFunctionFvPatchScalarField:: +atmAlphatkWallFunctionFvPatchScalarField +( + const atmAlphatkWallFunctionFvPatchScalarField& wfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(wfpsf, iF), + Cmu_(wfpsf.Cmu_), + kappa_(wfpsf.kappa_), + Pr_(wfpsf.Pr_), + Prt_(wfpsf.Prt_.clone(this->patch().patch())), + z0_(wfpsf.z0_.clone(this->patch().patch())) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void atmAlphatkWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchi = patch().index(); + + // Retrieve turbulence properties from model + const turbulenceModel& turbModel = db().lookupObject + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + internalField().group() + ) + ); + + const scalarField& y = turbModel.y()[patchi]; + + const tmp tnuw = turbModel.nu(patchi); + const scalarField& nuw = tnuw(); + + const tmp tk = turbModel.k(); + const volScalarField& k = tk(); + + const scalar Cmu25 = pow025(Cmu_); + + const scalar t = db().time().timeOutputValue(); + const scalar Pr = Pr_.value(t); + + #ifdef FULLDEBUG + if (Pr < VSMALL) + { + FatalErrorInFunction + << "Pr cannot be negative or zero. " + << "Please check input Pr = " << Pr + << exit(FatalIOError); + } + #endif + + const scalarField Prt(Prt_->value(t)); + const scalarField z0(z0_->value(t)); + + #ifdef FULLDEBUG + forAll(Prt, i) + { + if (Prt[i] < VSMALL || z0[i] < VSMALL) + { + FatalErrorInFunction + << "Elements of input surface fields can only be positive. " + << "Please check input fields z0 and Prt." + << exit(FatalIOError); + } + } + #endif + + const labelUList& faceCells = patch().faceCells(); + + scalarField& alphatw = *this; + + forAll(alphatw, facei) + { + const label celli = faceCells[facei]; + + const scalar uStar = Cmu25*Foam::sqrt(k[celli]); + const scalar Edash = (y[facei] + z0[facei])/(z0[facei] + 1e-4); + + // Update turbulent thermal conductivity + alphatw[facei] = + uStar*kappa_*y[facei]/(Prt[facei]*log(max(Edash, 1 + 1e-4))) + + nuw[facei]/Pr; + } + + // lower bound values to avoid unrealistic + // negative temperatures on the ground + alphatw = max(alphatw, 0.01); + + fixedValueFvPatchField::updateCoeffs(); +} + + +void atmAlphatkWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + Prt_->autoMap(m); + z0_->autoMap(m); +} + + +void atmAlphatkWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const atmAlphatkWallFunctionFvPatchScalarField& nrwfpsf = + refCast(ptf); + + z0_->rmap(nrwfpsf.z0_(), addr); + Prt_->rmap(nrwfpsf.Prt_(), addr); +} + + +void atmAlphatkWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField::write(os); + os.writeEntry("Cmu", Cmu_); + os.writeEntry("kappa", kappa_); + Pr_.writeData(os); + Prt_->writeData(os); + z0_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + atmAlphatkWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..fd54915265 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H @@ -0,0 +1,249 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::atmAlphatkWallFunctionFvPatchScalarField + +Group + grpAtmWallFunctions + +Description + This boundary condition provides a wall constraint on kinematic turbulent + thermal conductivity, \c alphat, for atmospheric boundary layer modelling. + It assumes a logarithmic distribution of the potential temperature within + the first cell. + + Required fields: + \verbatim + alphat | Kinematic turbulent thermal conductivity [m2/s] + \endverbatim + +Usage + Example of the boundary condition specification: + \verbatim + + { + // Mandatory entries (unmodifiable) + type alphatkAtmWallFunction; + + // Mandatory entries (runtime modifiable) + Pr 0.90; + Prt uniform 0.85; + z0 uniform 0.001; + + // Optional entries (unmodifiable) + Cmu 0.09; + kappa 0.41; + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: alphatAtmWallFunction | word | yes | - + Pr | Molecular Prandtl number | TimeFunction1 | yes | - + Prt | Turbulent Prandtl number | PatchFunction1 | yes | - + z0 | Surface roughness length [m] | PatchFunction1 | yes | - + Cmu | Empirical model constant | scalar | no | 0.09 + kappa | von Kármán constant | scalar | no | 0.41 + \endtable + + The inherited entries are elaborated in: + - \link fixedValueFvPatchField.H \endlink + - \link TimeFunction1.H \endlink + - \link PatchFunction1.H \endlink + +See also + - Foam::fixedValueFvPatchField + +SourceFiles + atmAlphatkWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmAlphatkWallFunctionFvPatchScalarField_H +#define atmAlphatkWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" +#include "TimeFunction1.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class turbulenceModel; + +/*---------------------------------------------------------------------------*\ + Class atmAlphatkWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class atmAlphatkWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ +protected: + + // Protected Data + + //- Empirical model constant + const scalar Cmu_; + + //- von Kármán constant + const scalar kappa_; + + //- Molecular Prandtl number + TimeFunction1 Pr_; + + //- Turbulent Prandtl number field + autoPtr> Prt_; + + //- Surface roughness length [m] + autoPtr> z0_; + + + //- Solution parameters + + static scalar tolerance_; + static label maxIters_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + +public: + + //- Runtime type information + TypeName("atmAlphatkWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + atmAlphatkWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmAlphatkWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + //- atmAlphatkWallFunctionFvPatchScalarField + //- onto a new patch + atmAlphatkWallFunctionFvPatchScalarField + ( + const atmAlphatkWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + atmAlphatkWallFunctionFvPatchScalarField + ( + const atmAlphatkWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmAlphatkWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmAlphatkWallFunctionFvPatchScalarField + ( + const atmAlphatkWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmAlphatkWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..16177e1a89 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.C @@ -0,0 +1,230 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmEpsilonWallFunctionFvPatchScalarField.H" +#include "nutWallFunctionFvPatchScalarField.H" +#include "turbulenceModel.H" +#include "fvMatrix.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::atmEpsilonWallFunctionFvPatchScalarField::calculate +( + const turbulenceModel& turbModel, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G0, + scalarField& epsilon0 +) +{ + const label patchi = patch.index(); + + const nutWallFunctionFvPatchScalarField& nutw = + nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); + + const scalarField& y = turbModel.y()[patchi]; + + const tmp tnuw = turbModel.nu(patchi); + const scalarField& nuw = tnuw(); + + const tmp tk = turbModel.k(); + const volScalarField& k = tk(); + + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + + const scalarField magGradUw(mag(Uw.snGrad())); + + const scalar Cmu25 = pow025(nutw.Cmu()); + const scalar Cmu75 = pow(nutw.Cmu(), 0.75); + + const scalar t = db().time().timeOutputValue(); + const scalarField z0(z0_->value(t)); + + #ifdef FULLDEBUG + for (const auto& z : z0) + { + if (z < VSMALL) + { + FatalErrorInFunction + << "z0 field can only contain positive values. " + << "Please check input field z0." + << exit(FatalIOError); + } + } + #endif + + const labelUList& faceCells = patch.faceCells(); + + // Set epsilon and G + forAll(nutw, facei) + { + const label celli = faceCells[facei]; + + const scalar yPlus = Cmu25*y[facei]*sqrt(k[celli])/nuw[facei]; + + const scalar w = cornerWeights[facei]; + + // (PGVB:Eq. 7, RH:Eq. 8) + scalar epsilonc = + w*Cmu75*pow(k[celli], 1.5)/(nutw.kappa()*(y[facei] + z0[facei])); + + scalar Gc = + w + *(nutw[facei] + nuw[facei]) + *magGradUw[facei] + *Cmu25*sqrt(k[celli]) + /(nutw.kappa()*(y[facei] + z0[facei])); + + if (lowReCorrection_ && yPlus < nutw.yPlusLam()) + { + epsilonc = w*2.0*k[celli]*nuw[facei]/sqr(y[facei] + z0[facei]); + Gc = 0; + } + + epsilon0[celli] += epsilonc; + + G0[celli] += Gc; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::atmEpsilonWallFunctionFvPatchScalarField:: +atmEpsilonWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), + z0_(nullptr) +{} + + +Foam::atmEpsilonWallFunctionFvPatchScalarField:: +atmEpsilonWallFunctionFvPatchScalarField +( + const atmEpsilonWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + z0_(ptf.z0_.clone(p.patch())) +{} + + +Foam::atmEpsilonWallFunctionFvPatchScalarField:: +atmEpsilonWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + epsilonWallFunctionFvPatchScalarField(p, iF, dict), + z0_(PatchFunction1::New(p.patch(), "z0", dict)) +{} + + +Foam::atmEpsilonWallFunctionFvPatchScalarField:: +atmEpsilonWallFunctionFvPatchScalarField +( + const atmEpsilonWallFunctionFvPatchScalarField& ewfpsf +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf), + z0_(ewfpsf.z0_.clone(this->patch().patch())) +{} + + +Foam::atmEpsilonWallFunctionFvPatchScalarField:: +atmEpsilonWallFunctionFvPatchScalarField +( + const atmEpsilonWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf, iF), + z0_(ewfpsf.z0_.clone(this->patch().patch())) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::atmEpsilonWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + epsilonWallFunctionFvPatchScalarField::autoMap(m); + z0_->autoMap(m); +} + + +void Foam::atmEpsilonWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + epsilonWallFunctionFvPatchScalarField::rmap(ptf, addr); + + const atmEpsilonWallFunctionFvPatchScalarField& atmpsf = + refCast(ptf); + + z0_->rmap(atmpsf.z0_(), addr); +} + + +void Foam::atmEpsilonWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + epsilonWallFunctionFvPatchScalarField::write(os); + z0_->writeData(os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + atmEpsilonWallFunctionFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..16db3aae49 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmEpsilonWallFunction/atmEpsilonWallFunctionFvPatchScalarField.H @@ -0,0 +1,234 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::atmEpsilonWallFunctionFvPatchScalarField + +Group + grpAtmWallFunctions + +Description + This boundary condition provides a wall constraint on turbulent kinetic + energy dissipation rate, i.e. \c epsilon, for atmospheric boundary layer + flows in neutral stratification conditions. + + Required fields: + \verbatim + epsilon | Turbulent kinetic energy dissipation rate [m2/s3] + \endverbatim + + References: + \verbatim + Theoretical expressions (tags:PGVB, RH): + Parente, A., Gorlé, C., Van Beeck, J., & Benocci, C. (2011). + Improved k–ε model and wall function formulation + for the RANS simulation of ABL flows. + J. of wind engineering and industrial aerodynamics, 99(4), 267-278. + DOI:10.1016/j.jweia.2010.12.017 + + Richards, P. J., & Hoxey, R. P. (1993). + Appropriate boundary conditions for computational wind + engineering models using the k-ε turbulence model. + In Computational Wind Engineering 1 (pp. 145-153). + DOI:10.1016/B978-0-444-81688-7.50018-8 + \endverbatim + +Usage + Example of the boundary condition specification: + \verbatim + + { + // Mandatory entries (unmodifiable) + type atmEpsilonWallFunction; + + // Mandatory entries (runtime modifiable) + z0 uniform 0.001; + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmEpsilonWallFunction | word | yes | - + z0 | Surface roughness length [m] | PatchFunction1 | yes | - + \endtable + + The inherited entries are elaborated in: + - \link epsilonWallFunctionFvPatchScalarField.H \endlink + - \link nutWallFunctionFvPatchScalarField.H \endlink + - \link PatchFunction1 \endlink + +See also + - Foam::epsilonWallFunctionFvPatchScalarField + +SourceFiles + atmEpsilonWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmEpsilonWallFunctionFvPatchScalarField_H +#define atmEpsilonWallFunctionFvPatchScalarField_H + +#include "epsilonWallFunctionFvPatchScalarField.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class atmEpsilonWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class atmEpsilonWallFunctionFvPatchScalarField +: + public epsilonWallFunctionFvPatchScalarField +{ +protected: + + // Protected Data + + //- Surface roughness length field [m] + autoPtr> z0_; + + + // Protected Member Functions + + //- Calculate the epsilon and G + virtual void calculate + ( + const turbulenceModel& turbulence, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G, + scalarField& epsilon + ) override final; + + +public: + + //- Runtime type information + TypeName("atmEpsilonWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + atmEpsilonWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmEpsilonWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + //- atmEpsilonWallFunctionFvPatchScalarField + //- onto a new patch + atmEpsilonWallFunctionFvPatchScalarField + ( + const atmEpsilonWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + atmEpsilonWallFunctionFvPatchScalarField + ( + const atmEpsilonWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmEpsilonWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmEpsilonWallFunctionFvPatchScalarField + ( + const atmEpsilonWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmEpsilonWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..9715f8db8a --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.C @@ -0,0 +1,212 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmNutUWallFunctionFvPatchScalarField.H" +#include "turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +tmp atmNutUWallFunctionFvPatchScalarField::calcNut() const +{ + const label patchi = patch().index(); + + const turbulenceModel& turbModel = db().lookupObject + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + internalField().group() + ) + ); + + const scalarField& y = turbModel.y()[patchi]; + + const fvPatchVectorField& Uw = U(turbModel).boundaryField()[patchi]; + const vectorField Up(Uw.patchInternalField() - Uw); + const scalarField magUpn(mag(Up - (Up & patch().nf())*patch().nf())); + + const tmp tnuw = turbModel.nu(patchi); + const scalarField& nuw = tnuw(); + + const scalar t = db().time().timeOutputValue(); + const scalarField z0(z0_->value(t)); + + #ifdef FULLDEBUG + for (const auto& z : z0) + { + if (z < VSMALL) + { + FatalErrorInFunction + << "z0 field can only contain positive values. " + << "Please check input field z0." + << exit(FatalIOError); + } + } + #endif + + tmp tnutw(new scalarField(*this)); + scalarField& nutw = tnutw.ref(); + + forAll(nutw, facei) + { + const scalar Edash = (y[facei] + z0[facei])/(z0[facei] + 1e-4); + const scalar uStar = magUpn[facei]*kappa_/log(max(Edash, 1.0 + 1e-4)); + + nutw[facei] = sqr(uStar)/max(magUpn[facei], 1e-6)*y[facei] - nuw[facei]; + } + + if (boundNut_) + { + nutw = max(nutw, 0.0); + } + + return tnutw; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +atmNutUWallFunctionFvPatchScalarField::atmNutUWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + nutUWallFunctionFvPatchScalarField(p, iF), + boundNut_(true), + z0_(nullptr) +{} + + +atmNutUWallFunctionFvPatchScalarField::atmNutUWallFunctionFvPatchScalarField +( + const atmNutUWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + nutUWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + boundNut_(ptf.boundNut_), + z0_(ptf.z0_.clone(p.patch())) +{} + + +atmNutUWallFunctionFvPatchScalarField::atmNutUWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + nutUWallFunctionFvPatchScalarField(p, iF, dict), + boundNut_(dict.getOrDefault("boundNut", true)), + z0_(PatchFunction1::New(p.patch(), "z0", dict)) +{} + + +atmNutUWallFunctionFvPatchScalarField::atmNutUWallFunctionFvPatchScalarField +( + const atmNutUWallFunctionFvPatchScalarField& rwfpsf +) +: + nutUWallFunctionFvPatchScalarField(rwfpsf), + boundNut_(rwfpsf.boundNut_), + z0_(rwfpsf.z0_.clone(this->patch().patch())) +{} + + +atmNutUWallFunctionFvPatchScalarField::atmNutUWallFunctionFvPatchScalarField +( + const atmNutUWallFunctionFvPatchScalarField& rwfpsf, + const DimensionedField& iF +) +: + nutUWallFunctionFvPatchScalarField(rwfpsf, iF), + boundNut_(rwfpsf.boundNut_), + z0_(rwfpsf.z0_.clone(this->patch().patch())) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void atmNutUWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + nutUWallFunctionFvPatchScalarField::autoMap(m); + z0_->autoMap(m); +} + + +void atmNutUWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + nutUWallFunctionFvPatchScalarField::rmap(ptf, addr); + + const atmNutUWallFunctionFvPatchScalarField& nrwfpsf = + refCast(ptf); + + z0_->rmap(nrwfpsf.z0_(), addr); +} + + +void atmNutUWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + nutUWallFunctionFvPatchScalarField::write(os); + os.writeEntry("boundNut", boundNut_); + z0_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + atmNutUWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.H similarity index 55% rename from src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H rename to src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.H index ee626bd9e8..4f0998013c 100644 --- a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutUWallFunction/atmNutUWallFunctionFvPatchScalarField.H @@ -5,7 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,57 +25,82 @@ License along with OpenFOAM. If not, see . Class - Foam::nutkAtmRoughWallFunctionFvPatchScalarField + Foam::atmNutUWallFunctionFvPatchScalarField Group - grpWallFunctions + grpAtmWallFunctions Description - This boundary condition provides a turbulent kinematic viscosity for - atmospheric velocity profiles. It is designed to be used in conjunction - with the atmBoundaryLayerInletVelocity boundary condition. The values - are calculated using: + This boundary condition provides a wall constraint on the turbulent + viscosity, i.e. \c nut, based on velocity, \c U, for atmospheric boundary + layer modelling. It is designed to be used in conjunction with the + \c atmBoundaryLayerInletVelocity boundary condition. + + The governing equation of the boundary condition: \f[ - U = \frac{U_f}{K} ln \left(\frac{z + z_0}{z_0}\right) + \u = \frac{\u^*}{\kappa} ln \left(\frac{z + z_0}{z_0}\right) \f] where - \vartable - U_f | frictional velocity - K | Von Karman's constant - z_0 | surface roughness length - z | vertical coordinate + \u^* | Friction velocity + \kappa | von Kármán constant + z_0 | Surface roughness length [m] + z | Ground-normal coordinate \endvartable -Usage - \table - Property | Description | Required | Default value - z0 | surface roughness length| yes | - \endtable + Required fields: + \verbatim + nut | Turbulent viscosity [m2/s] + U | Velocity [m/s] + \endverbatim +Usage Example of the boundary condition specification: \verbatim { - type nutkAtmRoughWallFunction; - z0 uniform 0; + // Mandatory entries (unmodifiable) + type atmNutUWallFunction; + + // Mandatory entries (runtime modifiable) + z0 uniform 0.001; + + // Optional entries (unmodifiable) + boundNut true; + + // Optional (inherited) entries + ... } \endverbatim + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmNutUWallFunction | word | yes | - + z0 | Surface roughness length [m] | PatchFunction1 | yes | - + boundNut | Flag: zero-bound nut at the wall | bool | no | true + \endtable + + The inherited entries are elaborated in: + - \link nutUWallFunctionFvPatchScalarField.H \endlink + - \link PatchFunction1.H \endlink + See also - Foam::nutkWallFunctionFvPatchField + - Foam::nutUWallFunctionFvPatchScalarField + - Foam::atmNutkWallFunctionFvPatchScalarField SourceFiles - nutkAtmRoughWallFunctionFvPatchScalarField.C + atmNutUWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef nutkAtmRoughWallFunctionFvPatchScalarField_H -#define nutkAtmRoughWallFunctionFvPatchScalarField_H +#ifndef atmNutUWallFunctionFvPatchScalarField_H +#define atmNutUWallFunctionFvPatchScalarField_H -#include "nutkWallFunctionFvPatchScalarField.H" +#include "nutUWallFunctionFvPatchScalarField.H" +#include "PatchFunction1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -82,45 +108,48 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class nutkAtmRoughWallFunctionFvPatchScalarField Declaration + Class atmNutUWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class nutkAtmRoughWallFunctionFvPatchScalarField +class atmNutUWallFunctionFvPatchScalarField : - public nutkWallFunctionFvPatchScalarField + public nutUWallFunctionFvPatchScalarField { + // Private Data + + //- Flag to zero-bound nut to prevent negative nut + //- at the wall arising from negative heat fluxes + const Switch boundNut_; + + //- Surface roughness length field [m] + autoPtr> z0_; + + protected: - // Protected data - - //- Surface roughness length - scalarField z0_; - - // Protected Member Functions - - //- Calculate the turbulence viscosity + //- Calculate the turbulent viscosity virtual tmp calcNut() const; public: //- Runtime type information - TypeName("nutkAtmRoughWallFunction"); + TypeName("atmNutUWallFunction"); // Constructors //- Construct from patch and internal field - nutkAtmRoughWallFunctionFvPatchScalarField + atmNutUWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and dictionary - nutkAtmRoughWallFunctionFvPatchScalarField + atmNutUWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField&, @@ -128,20 +157,20 @@ public: ); //- Construct by mapping given - // nutkAtmRoughWallFunctionFvPatchScalarField - // onto a new patch - nutkAtmRoughWallFunctionFvPatchScalarField + //- atmNutUWallFunctionFvPatchScalarField + //- onto a new patch + atmNutUWallFunctionFvPatchScalarField ( - const nutkAtmRoughWallFunctionFvPatchScalarField&, + const atmNutUWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Construct as copy - nutkAtmRoughWallFunctionFvPatchScalarField + atmNutUWallFunctionFvPatchScalarField ( - const nutkAtmRoughWallFunctionFvPatchScalarField& + const atmNutUWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -149,14 +178,14 @@ public: { return tmp ( - new nutkAtmRoughWallFunctionFvPatchScalarField(*this) + new atmNutUWallFunctionFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - nutkAtmRoughWallFunctionFvPatchScalarField + atmNutUWallFunctionFvPatchScalarField ( - const nutkAtmRoughWallFunctionFvPatchScalarField&, + const atmNutUWallFunctionFvPatchScalarField&, const DimensionedField& ); @@ -168,21 +197,12 @@ public: { return tmp ( - new nutkAtmRoughWallFunctionFvPatchScalarField(*this, iF) + new atmNutUWallFunctionFvPatchScalarField(*this, iF) ); } - // Member functions - - // Access functions - - // Return z0 - scalarField& z0() - { - return z0_; - } - + // Member Functions // Mapping functions diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..e9e31e756f --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C @@ -0,0 +1,233 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 CENER + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmNutWallFunctionFvPatchScalarField.H" +#include "turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "bound.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +tmp atmNutWallFunctionFvPatchScalarField::calcNut() const +{ + const label patchi = patch().index(); + + const turbulenceModel& turbModel = db().lookupObject + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + internalField().group() + ) + ); + const scalarField& y = turbModel.y()[patchi]; + + const tmp tk = turbModel.k(); + const volScalarField& k = tk(); + + const tmp tnuw = turbModel.nu(patchi); + const scalarField& nuw = tnuw(); + + tmp tnutw(new scalarField(*this)); + scalarField& nutw = tnutw.ref(); + + const scalar Cmu25 = pow025(Cmu_); + + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + const scalarField magUp(mag(Uw.patchInternalField() - Uw)); + + const scalar t = db().time().timeOutputValue(); + const scalarField z0(z0_->value(t)); + + #ifdef FULLDEBUG + for (const auto& z : z0) + { + if (z < VSMALL) + { + FatalErrorInFunction + << "z0 field can only contain positive values. " + << "Please check input field z0." + << exit(FatalIOError); + } + } + #endif + + const labelList& faceCells = patch().faceCells(); + + forAll(nutw, facei) + { + const label celli = faceCells[facei]; + + // (RH:Eq. 6) + const scalar Edash = (y[facei] + z0[facei])/(z0[facei] + z0Min_); + + // (RH:Eq. 6) + const scalar uStarU = magUp[facei]*kappa_/log(max(Edash, 1 + SMALL)); + + // (RH:Eq. 7) + const scalar uStarK = Cmu25*Foam::sqrt(k[celli]); + + // (SBJM:Eq. 7; SM:Eq. 25) + const scalar tauw = uStarU*uStarK; + + nutw[facei] = + max(tauw*y[facei]/(max(magUp[facei], SMALL)) - nuw[facei], 0.0); + } + + return tnutw; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +atmNutWallFunctionFvPatchScalarField::atmNutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + nutkWallFunctionFvPatchScalarField(p, iF), + z0Min_(SMALL), + z0_(nullptr) +{} + + +atmNutWallFunctionFvPatchScalarField::atmNutWallFunctionFvPatchScalarField +( + const atmNutWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + z0Min_(ptf.z0Min_), + z0_(ptf.z0_.clone(p.patch())) +{} + + +atmNutWallFunctionFvPatchScalarField::atmNutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + nutkWallFunctionFvPatchScalarField(p, iF, dict), + z0Min_ + ( + dict.getCheckOrDefault + ( + "z0Min", + SMALL, + scalarMinMax::ge(0) + ) + ), + z0_(PatchFunction1::New(p.patch(), "z0", dict)) +{} + + +atmNutWallFunctionFvPatchScalarField::atmNutWallFunctionFvPatchScalarField +( + const atmNutWallFunctionFvPatchScalarField& rwfpsf +) +: + nutkWallFunctionFvPatchScalarField(rwfpsf), + z0Min_(rwfpsf.z0Min_), + z0_(rwfpsf.z0_.clone(this->patch().patch())) +{} + + +atmNutWallFunctionFvPatchScalarField::atmNutWallFunctionFvPatchScalarField +( + const atmNutWallFunctionFvPatchScalarField& rwfpsf, + const DimensionedField& iF +) +: + nutkWallFunctionFvPatchScalarField(rwfpsf, iF), + z0Min_(rwfpsf.z0Min_), + z0_(rwfpsf.z0_.clone(this->patch().patch())) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void atmNutWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + nutkWallFunctionFvPatchScalarField::autoMap(m); + z0_->autoMap(m); +} + + +void atmNutWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + nutkWallFunctionFvPatchScalarField::rmap(ptf, addr); + + const atmNutWallFunctionFvPatchScalarField& nrwfpsf = + refCast(ptf); + + z0_->rmap(nrwfpsf.z0_(), addr); +} + + +void atmNutWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + nutkWallFunctionFvPatchScalarField::write(os); + os.writeEntry("z0Min", z0Min_); + z0_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + atmNutWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..e4cca662ed --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.H @@ -0,0 +1,270 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 CENER + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::atmNutWallFunctionFvPatchScalarField + +Group + grpAtmWallFunctions + +Description + This boundary condition provides a wall constraint on the turbulent + viscosity, i.e. \c nut, based on turbulent kinetic energy, \c k, and + velocity, i.e. \c U, for atmospheric boundary layer modelling. + + The governing equation of the boundary condition: + + \f[ + \tau_w = {U^*_u} {U^*_k} + \f] + + with + + \f[ + {U^*_u} = \frac{\kappa U_w}{ln(z_p / z_0)} + \f] + + \f[ + {U^*_k} = C_{\mu}^{1/4} \sqrt{k} + \f] + + where + \vartable + \tau_w | wall shear stress + U^*_u | local friction velocity based on near-ground velocity + U^*_k | local friction velocity based on near-ground k + \kappa | von Kármán constant + U_w | near-ground velocity + z_p | vertical coordinate + z_0 | surface roughness length [m] + C_mu | empirical model constant + k | turbulent kinetic energy + \endvartable + + Required fields: + \verbatim + nut | Turbulent viscosity [m2/s] + k | Turbulent kinetic energy [m2/s2] + \endverbatim + + References: + \verbatim + Richards, P. J., & Hoxey, R. P. (1993). + Appropriate boundary conditions for computational wind + engineering models using the k-ε turbulence model. + In Computational Wind Engineering 1 (pp. 145-153). + DOI:10.1016/B978-0-444-81688-7.50018-8 + + Sørensen, N. N., Bechmann, A., Johansen, J., Myllerup, L., + Botha, P., Vinther, S., & Nielsen, B. S. (2007). + Identification of severe wind conditions using + a Reynolds Averaged Navier-Stokes solver. + In Journal of Physics: Conference series (Vol. 75, No. 1, p. 012053). + DOI:10.1088/1742-6596/75/1/012053 + + Sumner, J., & Masson, C. (2012). + k− ε simulations of the neutral atmospheric boundary layer: + analysis and correction of discretization errors on practical grids. + International journal for numerical methods in fluids, 70(6), 724-741. + DOI:10.1002/fld.2709 + \endverbatim + +Usage + Example of the boundary condition specification: + \verbatim + + { + // Mandatory entries (unmodifiable) + type atmNutWallFunction; + z0Min 0.001; + + // Mandatory entries (runtime modifiable) + z0 uniform 0.001; + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: nutAtmWallFunction | word | yes | - + z0Min | Minimum surface roughness length [m] | scalar | yes | - + z0 | Surface roughness length [m] | PatchFunction1 | yes | - + \endtable + + The inherited entries are elaborated in: + - \link nutkWallFunctionFvPatchScalarField.H \endlink + - \link PatchFunction1.H \endlink + +See also + - Foam::nutkWallFunctionFvPatchScalarField + - Foam::atmNutkWallFunctionFvPatchScalarField + - Foam::atmNutUWallFunctionFvPatchScalarField + +SourceFiles + atmNutWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmNutWallFunctionFvPatchScalarField_H +#define atmNutWallFunctionFvPatchScalarField_H + +#include "nutkWallFunctionFvPatchScalarField.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class atmNutWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class atmNutWallFunctionFvPatchScalarField +: + public nutkWallFunctionFvPatchScalarField +{ + + // Private Data + + //- Minimum surface roughness length [m] + const scalar z0Min_; + + //- Surface roughness length field [m] + autoPtr> z0_; + + +protected: + + // Protected Member Functions + + //- Calculate the turbulent viscosity + virtual tmp calcNut() const; + + +public: + + //- Runtime type information + TypeName("atmNutWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + atmNutWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmNutWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + //- atmNutWallFunctionFvPatchScalarField + //- onto a new patch + atmNutWallFunctionFvPatchScalarField + ( + const atmNutWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + atmNutWallFunctionFvPatchScalarField + ( + const atmNutWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmNutWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmNutWallFunctionFvPatchScalarField + ( + const atmNutWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmNutWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C similarity index 59% rename from src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C rename to src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C index 5b43cb5807..45c8f4614e 100644 --- a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C @@ -6,6 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2018 OpenFOAM Foundation + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,10 +27,11 @@ License \*---------------------------------------------------------------------------*/ -#include "nutkAtmRoughWallFunctionFvPatchScalarField.H" +#include "atmNutkWallFunctionFvPatchScalarField.H" #include "turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" +#include "bound.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +41,7 @@ namespace Foam // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -tmp nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const +tmp atmNutkWallFunctionFvPatchScalarField::calcNut() const { const label patchi = patch().index(); @@ -51,35 +54,51 @@ tmp nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const ) ); const scalarField& y = turbModel.y()[patchi]; + const tmp tk = turbModel.k(); const volScalarField& k = tk(); + const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); - const scalar Cmu25 = pow025(Cmu_); - tmp tnutw(new scalarField(*this)); scalarField& nutw = tnutw.ref(); + const scalar Cmu25 = pow025(Cmu_); + + const scalar t = db().time().timeOutputValue(); + const scalarField z0(z0_->value(t)); + + #ifdef FULLDEBUG + for (const auto& z : z0) + { + if (z < VSMALL) + { + FatalErrorInFunction + << "z0 field can only contain positive values. " + << "Please check input field z0." + << exit(FatalIOError); + } + } + #endif + + const labelList& faceCells = patch().faceCells(); + + // (HW:Eq. 5) forAll(nutw, facei) { - label celli = patch().faceCells()[facei]; + const label celli = faceCells[facei]; - scalar uStar = Cmu25*sqrt(k[celli]); - scalar yPlus = uStar*y[facei]/nuw[facei]; + const scalar uStar = Cmu25*sqrt(k[celli]); + const scalar yPlus = uStar*y[facei]/nuw[facei]; + const scalar Edash = (y[facei] + z0[facei])/z0[facei]; - scalar Edash = (y[facei] + z0_[facei])/z0_[facei]; + nutw[facei] = nuw[facei]*(yPlus*kappa_/log(max(Edash, 1 + 1e-4)) - 1); + } - nutw[facei] = - nuw[facei]*(yPlus*kappa_/log(max(Edash, 1+1e-4)) - 1); - - if (debug) - { - Info<< "yPlus = " << yPlus - << ", Edash = " << Edash - << ", nutw = " << nutw[facei] - << endl; - } + if (boundNut_) + { + nutw = max(nutw, 0.0); } return tnutw; @@ -88,34 +107,33 @@ tmp nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -nutkAtmRoughWallFunctionFvPatchScalarField:: -nutkAtmRoughWallFunctionFvPatchScalarField +atmNutkWallFunctionFvPatchScalarField::atmNutkWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF ) : nutkWallFunctionFvPatchScalarField(p, iF), - z0_(p.size(), Zero) + boundNut_(true), + z0_(nullptr) {} -nutkAtmRoughWallFunctionFvPatchScalarField:: -nutkAtmRoughWallFunctionFvPatchScalarField +atmNutkWallFunctionFvPatchScalarField::atmNutkWallFunctionFvPatchScalarField ( - const nutkAtmRoughWallFunctionFvPatchScalarField& ptf, + const atmNutkWallFunctionFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper ) : nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), - z0_(ptf.z0_, mapper) + boundNut_(ptf.boundNut_), + z0_(ptf.z0_.clone(p.patch())) {} -nutkAtmRoughWallFunctionFvPatchScalarField:: -nutkAtmRoughWallFunctionFvPatchScalarField +atmNutkWallFunctionFvPatchScalarField::atmNutkWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -123,46 +141,47 @@ nutkAtmRoughWallFunctionFvPatchScalarField ) : nutkWallFunctionFvPatchScalarField(p, iF, dict), - z0_("z0", dict, p.size()) + boundNut_(dict.getOrDefault("boundNut", false)), + z0_(PatchFunction1::New(p.patch(), "z0", dict)) {} -nutkAtmRoughWallFunctionFvPatchScalarField:: -nutkAtmRoughWallFunctionFvPatchScalarField +atmNutkWallFunctionFvPatchScalarField::atmNutkWallFunctionFvPatchScalarField ( - const nutkAtmRoughWallFunctionFvPatchScalarField& rwfpsf + const atmNutkWallFunctionFvPatchScalarField& rwfpsf ) : nutkWallFunctionFvPatchScalarField(rwfpsf), - z0_(rwfpsf.z0_) + boundNut_(rwfpsf.boundNut_), + z0_(rwfpsf.z0_.clone(this->patch().patch())) {} -nutkAtmRoughWallFunctionFvPatchScalarField:: -nutkAtmRoughWallFunctionFvPatchScalarField +atmNutkWallFunctionFvPatchScalarField::atmNutkWallFunctionFvPatchScalarField ( - const nutkAtmRoughWallFunctionFvPatchScalarField& rwfpsf, + const atmNutkWallFunctionFvPatchScalarField& rwfpsf, const DimensionedField& iF ) : nutkWallFunctionFvPatchScalarField(rwfpsf, iF), - z0_(rwfpsf.z0_) + boundNut_(rwfpsf.boundNut_), + z0_(rwfpsf.z0_.clone(this->patch().patch())) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void nutkAtmRoughWallFunctionFvPatchScalarField::autoMap +void atmNutkWallFunctionFvPatchScalarField::autoMap ( const fvPatchFieldMapper& m ) { nutkWallFunctionFvPatchScalarField::autoMap(m); - z0_.autoMap(m); + z0_->autoMap(m); } -void nutkAtmRoughWallFunctionFvPatchScalarField::rmap +void atmNutkWallFunctionFvPatchScalarField::rmap ( const fvPatchScalarField& ptf, const labelList& addr @@ -170,18 +189,18 @@ void nutkAtmRoughWallFunctionFvPatchScalarField::rmap { nutkWallFunctionFvPatchScalarField::rmap(ptf, addr); - const nutkAtmRoughWallFunctionFvPatchScalarField& nrwfpsf = - refCast(ptf); + const atmNutkWallFunctionFvPatchScalarField& nrwfpsf = + refCast(ptf); - z0_.rmap(nrwfpsf.z0_, addr); + z0_->rmap(nrwfpsf.z0_(), addr); } -void nutkAtmRoughWallFunctionFvPatchScalarField::write(Ostream& os) const +void atmNutkWallFunctionFvPatchScalarField::write(Ostream& os) const { - fvPatchField::write(os); - writeLocalEntries(os); - z0_.writeEntry("z0", os); + nutkWallFunctionFvPatchScalarField::write(os); + os.writeEntry("boundNut", boundNut_); + z0_->writeData(os); writeEntry("value", os); } @@ -191,7 +210,7 @@ void nutkAtmRoughWallFunctionFvPatchScalarField::write(Ostream& os) const makePatchTypeField ( fvPatchScalarField, - nutkAtmRoughWallFunctionFvPatchScalarField + atmNutkWallFunctionFvPatchScalarField ); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..7f85358a35 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.H @@ -0,0 +1,248 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::atmNutkWallFunctionFvPatchScalarField + +Group + grpAtmWallFunctions + +Description + This boundary condition provides a wall constraint on turbulent + viscosity, i.e. \c nut, based on turbulent kinetic energy, \c k + for atmospheric boundary layer modelling. It is designed to be used in + conjunction with the \c atmBoundaryLayerInletVelocity boundary condition. + + The governing equation of the boundary condition: + + \f[ + \u = \frac{\u^*}{\kappa} ln \left(\frac{z + z_0}{z_0}\right) + \f] + + where + \vartable + \u^* | Friction velocity + \kappa | von Kármán constant + z_0 | Surface roughness length [m] + z | Ground-normal coordinate + \endvartable + + Required fields: + \verbatim + nut | Turbulent viscosity [m2/s] + k | Turbulent kinetic energy [m2/s2] + \endverbatim + + References: + \verbatim + Theoretical expressions (tag:HW): + Hargreaves, D. M., & Wright, N. G. (2007). + On the use of the k–ε model in commercial CFD software to model + the neutral atmospheric boundary layer. + J. of wind engineering and industrial aerodynamics, 95(5), 355-369. + DOI:10.1016/j.jweia.2006.08.002 + \endverbatim + +Usage + Example of the boundary condition specification: + \verbatim + + { + // Mandatory entries (unmodifiable) + type atmNutkWallFunction; + + // Mandatory entries (runtime modifiable) + z0 uniform 0.001; + + // Optional entries (unmodifiable) + boundNut false; + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmNutkWallFunction | word | yes | - + z0 | Surface roughness length [m] | PatchFunction1 | yes | - + boundNut | Flag: zero-bound nut at the wall | bool | no | false + \endtable + + The inherited entries are elaborated in: + - \link nutkWallFunctionFvPatchScalarField.H \endlink + - \link PatchFunction1.H \endlink + +Note + - \c boundNut entry is set \c false for backward compatibility reasons. + +See also + - Foam::nutkWallFunctionFvPatchField + +SourceFiles + atmNutkWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmNutkWallFunctionFvPatchScalarField_H +#define atmNutkWallFunctionFvPatchScalarField_H + +#include "nutkWallFunctionFvPatchScalarField.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class atmNutkWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class atmNutkWallFunctionFvPatchScalarField +: + public nutkWallFunctionFvPatchScalarField +{ + // Private Data + + //- Flag to zero-bound nut to prevent negative nut + //- at the wall arising from negative heat fluxes + const Switch boundNut_; + + //- Surface roughness length field [m] + autoPtr> z0_; + + +protected: + + // Protected Member Functions + + //- Calculate the turbulent viscosity + virtual tmp calcNut() const; + + +public: + + //- Runtime type information + TypeName("atmNutkWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + atmNutkWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmNutkWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + //- atmNutkWallFunctionFvPatchScalarField + //- onto a new patch + atmNutkWallFunctionFvPatchScalarField + ( + const atmNutkWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + atmNutkWallFunctionFvPatchScalarField + ( + const atmNutkWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmNutkWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmNutkWallFunctionFvPatchScalarField + ( + const atmNutkWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmNutkWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..5a2d8409a4 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.C @@ -0,0 +1,217 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmOmegaWallFunctionFvPatchScalarField.H" +#include "nutWallFunctionFvPatchScalarField.H" +#include "turbulenceModel.H" +#include "fvMatrix.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::atmOmegaWallFunctionFvPatchScalarField::calculate +( + const turbulenceModel& turbModel, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G0, + scalarField& omega0 +) +{ + const label patchi = patch.index(); + + const nutWallFunctionFvPatchScalarField& nutw = + nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); + + const scalarField& y = turbModel.y()[patchi]; + + const tmp tnuw = turbModel.nu(patchi); + const scalarField& nuw = tnuw(); + + const tmp tk = turbModel.k(); + const volScalarField& k = tk(); + + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + + const scalarField magGradUw(mag(Uw.snGrad())); + + const scalar Cmu25 = pow025(nutw.Cmu()); + + const scalar t = db().time().timeOutputValue(); + const scalarField z0(z0_->value(t)); + + #ifdef FULLDEBUG + for (const auto& z : z0) + { + if (z < VSMALL) + { + FatalErrorInFunction + << "z0 field can only contain positive values. " + << "Please check input field z0." + << exit(FatalIOError); + } + } + #endif + + const labelUList& faceCells = patch.faceCells(); + + // Set omega and G + forAll(nutw, facei) + { + const label celli = faceCells[facei]; + + const scalar w = cornerWeights[facei]; + + omega0[celli] += + w*sqrt(k[celli])/(Cmu25*nutw.kappa()*(y[facei] + z0[facei])); + + G0[celli] += + w + *(nutw[facei] + nuw[facei]) + *magGradUw[facei] + *Cmu25*sqrt(k[celli]) + /(nutw.kappa()*(y[facei] + z0[facei])); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::atmOmegaWallFunctionFvPatchScalarField:: +atmOmegaWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + omegaWallFunctionFvPatchScalarField(p, iF), + z0_(nullptr) +{} + + +Foam::atmOmegaWallFunctionFvPatchScalarField:: +atmOmegaWallFunctionFvPatchScalarField +( + const atmOmegaWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + omegaWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + z0_(ptf.z0_.clone(p.patch())) +{} + + +Foam::atmOmegaWallFunctionFvPatchScalarField:: +atmOmegaWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + omegaWallFunctionFvPatchScalarField(p, iF, dict), + z0_(PatchFunction1::New(p.patch(), "z0", dict)) +{} + + +Foam::atmOmegaWallFunctionFvPatchScalarField:: +atmOmegaWallFunctionFvPatchScalarField +( + const atmOmegaWallFunctionFvPatchScalarField& owfpsf +) +: + omegaWallFunctionFvPatchScalarField(owfpsf), + z0_(owfpsf.z0_.clone(this->patch().patch())) +{} + + +Foam::atmOmegaWallFunctionFvPatchScalarField:: +atmOmegaWallFunctionFvPatchScalarField +( + const atmOmegaWallFunctionFvPatchScalarField& owfpsf, + const DimensionedField& iF +) +: + omegaWallFunctionFvPatchScalarField(owfpsf, iF), + z0_(owfpsf.z0_.clone(this->patch().patch())) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::atmOmegaWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + omegaWallFunctionFvPatchScalarField::autoMap(m); + z0_->autoMap(m); +} + + +void Foam::atmOmegaWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + omegaWallFunctionFvPatchScalarField::rmap(ptf, addr); + + const atmOmegaWallFunctionFvPatchScalarField& atmpsf = + refCast(ptf); + + z0_->rmap(atmpsf.z0_(), addr); +} + + +void Foam::atmOmegaWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + omegaWallFunctionFvPatchScalarField::write(os); + z0_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + atmOmegaWallFunctionFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..67b95f60e8 --- /dev/null +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmOmegaWallFunction/atmOmegaWallFunctionFvPatchScalarField.H @@ -0,0 +1,232 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::atmOmegaWallFunctionFvPatchScalarField + +Group + grpAtmWallFunctions + +Description + This boundary condition provides a wall constraint on specific dissipation + rate, i.e. \c omega, for atmospheric boundary layer modelling. + + Required fields: + \verbatim + omega | Specific dissipation rate [1/s] + \endverbatim + + References: + \verbatim + Theoretical expressions (tags:PGVB, B): + Parente, A., Gorlé, C., Van Beeck, J., & Benocci, C. (2011). + Improved k–ε model and wall function formulation + for the RANS simulation of ABL flows. + J. of wind engineering and industrial aerodynamics, 99(4), 267-278. + DOI:10.1016/j.jweia.2010.12.017 + + Bredberg, J. (2000). + On the wall boundary condition for turbulence models. + Chalmers University of Technology, Depart. of Thermo and Fluid Dyn. + Internal Report 00/4. Sweden: Göteborg. + \endverbatim + +Usage + Example of the boundary condition specification: + \verbatim + + { + // Mandatory entries (unmodifiable) + type atmOmegaWallFunction; + + // Mandatory entries (runtime modifiable) + z0 uniform 0.001; + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmOmegaWallFunction | word | yes | - + z0 | Surface roughness length [m] | PatchFunction1 | yes | - + \endtable + + The inherited entries are elaborated in: + - \link omegaWallFunctionFvPatchScalarField.H \endlink + - \link nutWallFunctionFvPatchScalarField.H \endlink + - \link PatchFunction1.H \endlink + +See also + - Foam::omegaWallFunctionFvPatchScalarField + +SourceFiles + atmOmegaWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmOmegaWallFunctionFvPatchScalarField_H +#define atmOmegaWallFunctionFvPatchScalarField_H + +#include "omegaWallFunctionFvPatchScalarField.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class atmOmegaWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class atmOmegaWallFunctionFvPatchScalarField +: + public omegaWallFunctionFvPatchScalarField +{ +protected: + + // Protected Data + + //- Surface roughness length field [m] + autoPtr> z0_; + + + // Protected Member Functions + + //- Calculate the omega and G + virtual void calculate + ( + const turbulenceModel& turbulence, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G, + scalarField& omega + ) override final; + + +public: + + //- Runtime type information + TypeName("atmOmegaWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + atmOmegaWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + atmOmegaWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + //- atmOmegaWallFunctionFvPatchScalarField + //- onto a new patch + atmOmegaWallFunctionFvPatchScalarField + ( + const atmOmegaWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + atmOmegaWallFunctionFvPatchScalarField + ( + const atmOmegaWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new atmOmegaWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + atmOmegaWallFunctionFvPatchScalarField + ( + const atmOmegaWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new atmOmegaWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const override; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C b/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C new file mode 100644 index 0000000000..247e787620 --- /dev/null +++ b/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C @@ -0,0 +1,266 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ObukhovLength.H" +#include "volFields.H" +#include "dictionary.H" +#include "Time.H" +#include "mapPolyMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "zeroGradientFvPatchField.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + defineTypeNameAndDebug(ObukhovLength, 0); + addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary); +} +} + + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +bool Foam::functionObjects::ObukhovLength::calcOL() +{ + const auto* rhoPtr = mesh_.findObject("rho"); + const volScalarField& nut = mesh_.lookupObject("nut"); + const volVectorField& U = mesh_.lookupObject(UName_); + const volScalarField& alphat = mesh_.lookupObject("alphat"); + const volScalarField& T = mesh_.lookupObject("T"); + + volScalarField* result1 = mesh_.getObjectPtr(resultName1_); + volScalarField* result2 = mesh_.getObjectPtr(resultName2_); + + const bool isNew = !result1; + + if (!result1) + { + result1 = new volScalarField + ( + IOobject + ( + resultName1_, + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + mesh_, + dimLength, + zeroGradientFvPatchField::typeName + ); + + result1->store(); + + result2 = new volScalarField + ( + IOobject + ( + resultName2_, + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + mesh_, + dimVelocity, + zeroGradientFvPatchField::typeName + ); + + result2->store(); + } + + volScalarField B(alphat*beta_*(fvc::grad(T) & g_)); + if (rhoPtr) + { + const auto& rho = *rhoPtr; + B /= rho; + } + else + { + const dimensionedScalar rho(dimless, rhoRef_); + B /= rho; + } + + *result2 = // Ustar + sqrt + ( + max + ( + nut*sqrt(2*magSqr(symm(fvc::grad(U)))), + dimensionedScalar(sqr(U.dimensions()), VSMALL) + ) + ); + + // (O:Eq. 26) + *result1 = // ObukhovLength + -min + ( + dimensionedScalar(dimLength, ROOTVGREAT), // neutral stratification + pow3(*result2)/ + ( + sign(B)*kappa_ + *max(mag(B), dimensionedScalar(B.dimensions(), VSMALL)) + ) + ); + + return isNew; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::functionObjects::ObukhovLength::ObukhovLength +( + const word& name, + const Time& runTime, + const dictionary& dict +) +: + fvMeshFunctionObject(name, runTime, dict), + UName_("U"), + resultName1_("ObukhovLength"), + resultName2_("Ustar"), + rhoRef_(1.0), + kappa_(0.40), + beta_ + ( + dimensionedScalar + ( + dimless/dimTemperature, + dict.getCheckOrDefault + ( + "beta", + 3e-3, + [&](const scalar x){ return x > SMALL; } + ) + ) + ), + g_ + ( + "g", + dimLength/sqr(dimTime), + meshObjects::gravity::New(mesh_.time()).value() + ) +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::functionObjects::ObukhovLength::read(const dictionary& dict) +{ + fvMeshFunctionObject::read(dict), + + UName_ = dict.getOrDefault("U", "U"); + resultName1_ = dict.getOrDefault("ObukhovLength", "ObukhovLength"); + resultName2_ = dict.getOrDefault("Ustar", "Ustar"); + + if (UName_ != "U" && resultName1_ == "ObukhovLength") + { + resultName1_ += '(' + UName_ + ')'; + } + + if (UName_ != "U" && resultName1_ == "Ustar") + { + resultName2_ += '(' + UName_ + ')'; + } + + rhoRef_ = dict.getOrDefault("rhoRef", 1.0); + kappa_ = dict.getOrDefault("kappa", 0.4); + beta_.value() = dict.getOrDefault("beta", 3e-3); + + return true; +} + + +bool Foam::functionObjects::ObukhovLength::execute() +{ + Log << type() << " " << name() << " execute:" << endl; + + bool isNew = false; + + isNew = calcOL(); + + if (isNew) Log << " (new)" << nl << endl; + + return true; +} + + +bool Foam::functionObjects::ObukhovLength::write() +{ + const auto* ioptr1 = mesh_.cfindObject(resultName1_); + const auto* ioptr2 = mesh_.cfindObject(resultName2_); + + if (ioptr1) + { + Log << type() << " " << name() << " write:" << nl + << " writing field " << ioptr1->name() << nl + << " writing field " << ioptr2->name() << endl; + + ioptr1->write(); + ioptr2->write(); + } + + return true; +} + + +void Foam::functionObjects::ObukhovLength::removeObukhovLength() +{ + mesh_.thisDb().checkOut(resultName1_); + mesh_.thisDb().checkOut(resultName2_); +} + + +void Foam::functionObjects::ObukhovLength::updateMesh(const mapPolyMesh& mpm) +{ + if (&mpm.mesh() == &mesh_) + { + removeObukhovLength(); + } +} + + +void Foam::functionObjects::ObukhovLength::movePoints(const polyMesh& m) +{ + if (&m == &mesh_) + { + removeObukhovLength(); + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.H b/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.H new file mode 100644 index 0000000000..948bd238db --- /dev/null +++ b/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.H @@ -0,0 +1,271 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::functionObjects::ObukhovLength + +Group + grpFieldFunctionObjects + +Description + Computes the Obukhov length field and associated friction velocity field. + + When scaled by the ground-normal height, i.e. z, the Obukhov length becomes + a dimensionless stability parameter, i.e. z/L, for atmospheric boundary + layer modelling, expressing the relative roles of buoyancy and shear in the + production and dissipation of turbulent kinetic energy. + + \f[ + u^* = \sqrt{\max (\nu_t \sqrt{2 |\symm{\grad{\u}}|^2}, VSMALL)} + \f] + + \f[ + L_o = - \frac{(u^*)^3}{sign(B) \kappa \max (|B|, VSMALL)} + \f] + + with + \f[ + B = \alpha_t \beta \frac{\grad{T} \cdot \vec{g}}{\rho} + \f] + + where + \vartable + u^* | Friction velocity [m/s] + \nu_t | Turbulent viscosity [m2/s] + \u | Velocity [m/s] + L_o | Obukhov length [m] + B | Buoyancy production term [m2/s3] + \alpha_t | Kinematic turbulent thermal conductivity [m2/s]/[kg/m/s] + \rho | Density of fluid [-]/[kg/m3] + \beta | Thermal expansion coefficient [1/K] + T | Temperature [K] + g | Gravitational acceleration [m/s2] + VSMALL | A very small number to avoid floating point exceptions + \endvartable + + References: + \verbatim + Definition of the Obukhov length (tag:O): + Obukhov, A. M. (1946). + Turbulentnost'v temperaturnoj-neodnorodnoj atmosfere. + Trudy Inst. Theor. Geofiz. AN SSSR, 1, 95-115. + + Obukhov, A. M. (1971). + Turbulence in an atmosphere with a non-uniform temperature. + Boundary-layer meteorology, 2(1), 7-29. + DOI:10.1007/BF00718085 + + Obukhov length. (2016). + In American Meteorological Society - Glossary of meteorology. + Retrieved Apr 1, 2020, from glossary.ametsoc.org/wiki/Obukhov_length + \endverbatim + + Required fields: + \verbatim + U | Velocity [m/s] + T | Temperature [K] + nut | Turbulent viscosity [m2/s] + alphat | Kinematic turbulent thermal conductivity [m2/s]/[kg/m/s] + g | Gravitational acceleration [m/s2] + \endverbatim + + \table + Operand | Type | Location + input | - | - + output file | - | - + output field 1 | volScalarField | $FOAM_CASE/\/\ + output field 2 | volScalarField | $FOAM_CASE/\/\ + \endtable + +Usage + Minimal example by using \c system/controlDict.functions: + \verbatim + ObukhovLength1 + { + // Mandatory entries (unmodifiable) + type ObukhovLength; + libs (fieldFunctionObjects); + + // Optional entries (runtime modifiable) + U U; + result1 ObukhovLength; + result2 Ustar; + rhoRef 1.0; + kappa 0.4; + beta 3e-3; + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: ObukhovLength | word | yes | - + libs | Library name: fieldFunctionObjects | word | yes | - + U | Name of the velocity field | word | no | U + result1 | Name of the output field for ObukhovLength | word | no | ObukhovLength + result2 | Name of the output field for Ustar | word | no | Ustar + rhoRef | Reference density (to convert from kinematic to static pressure) | scalar | no | 1.0 + kappa | von Kármán constant | scalar | no | 0.40 + beta | Thermal expansion coefficient [1/K] | scalar | no | 3e-3 + \endtable + + The inherited entries are elaborated in: + - \link functionObject.H \endlink + + Minimal example by using the \c postProcess utility: + \verbatim + postProcess -func "ObukhovLength()" + \endverbatim + +See also + - Foam::functionObjects::fvMeshFunctionObject + - ExtendedCodeGuide::atmosphericModels::functionObjects::ObukhovLength + +SourceFiles + ObukhovLength.C + +\*---------------------------------------------------------------------------*/ + +#ifndef functionObjects_ObukhovLength_H +#define functionObjects_ObukhovLength_H + +#include "fvMeshFunctionObject.H" +#include "turbulentTransportModel.H" +#include "gravityMeshObject.H" +#include "Enum.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + +/*---------------------------------------------------------------------------*\ + Class ObukhovLength Declaration +\*---------------------------------------------------------------------------*/ + +class ObukhovLength +: + public fvMeshFunctionObject +{ +protected: + + // Protected Data + + //- Name of velocity field + word UName_; + + //- Name of the output field for ObukhovLength + word resultName1_; + + //- Name of the output field for Ustar + word resultName2_; + + //- Reference density (to convert from kinematic to static pressure) + scalar rhoRef_; + + //- von Kármán constant [-] + scalar kappa_; + + //- Thermal expansion coefficient [1/K] + dimensionedScalar beta_; + + //- Gravitational acceleration vector [m/s2] + const dimensionedVector g_; + + + // Protected Member Functions + + //- Hard-coded Obukhov length field and friction velocity + // \return true if fields did not previously exist + bool calcOL(); + + +public: + + //- Run-time type information + TypeName("ObukhovLength"); + + + // Constructors + + //- Construct from Time and dictionary + ObukhovLength + ( + const word& name, + const Time& runTime, + const dictionary& dict + ); + + //- No copy construct + ObukhovLength(const ObukhovLength&) = delete; + + //- No copy assignment + void operator=(const ObukhovLength&) = delete; + + + //- Destructor + virtual ~ObukhovLength() = default; + + + // Member Functions + + //- Remove (checkOut) the output fields from the object registry + void removeObukhovLength(); + + //- Read the data + virtual bool read(const dictionary& dict); + + //- Calculate the output fields + virtual bool execute(); + + //- Write the output fields + virtual bool write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh& mpm); + + //- Update for mesh point-motion + virtual void movePoints(const polyMesh& m); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace functionObjects +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.C b/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.C new file mode 100644 index 0000000000..932942adc7 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.C @@ -0,0 +1,243 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmAmbientTurbSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmAmbientTurbSource, 0); + addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmAmbientTurbSource::atmAmbientTurbSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + isEpsilon_(true), + rhoName_(coeffs_.getOrDefault("rho", "rho")), + kAmb_ + ( + dimensionedScalar + ( + sqr(dimLength)/sqr(dimTime), + coeffs_.getCheckOrDefault + ( + "kAmb", + SMALL, + [&](const scalar k){ return k > -VSMALL; } + ) + ) + ), + epsilonAmb_ + ( + dimensionedScalar + ( + sqr(dimLength)/pow3(dimTime), + coeffs_.getOrDefault + ( + "epsilonAmb", + Zero + ) + ) + ), + omegaAmb_ + ( + dimensionedScalar + ( + dimless/dimTime, + coeffs_.getOrDefault + ( + "omegaAmb", + Zero + ) + ) + ), + Cmu_(Zero), + C2_(Zero) +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + if (!turbPtr) + { + FatalErrorInFunction + << "Unable to find a turbulence model." + << abort(FatalError); + } + + fieldNames_.setSize(2, "undefined"); + + tmp tepsilon = turbPtr->epsilon(); + tmp tomega = turbPtr->omega(); + + if (!tepsilon.isTmp()) + { + fieldNames_[0] = tepsilon().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + + C2_.read("C2", turbDict); + } + else if (!tomega.isTmp()) + { + isEpsilon_ = false; + fieldNames_[0] = tomega().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + + Cmu_.read("betaStar", turbDict); + C2_.read("C2", turbDict); + } + else + { + FatalErrorInFunction + << "Unable to find neither epsilon nor omega field." << nl + << "atmAmbientTurbSource needs either epsilon or omega field." + << abort(FatalError); + } + + fieldNames_[1] = turbPtr->k()().name(); + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmAmbientTurbSource to: " + << fieldNames_[0] << " and " << fieldNames_[1] + << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmAmbientTurbSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldi == 1) + { + atmAmbientTurbSourceK + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + return; + } + + if (isEpsilon_) + { + atmAmbientTurbSourceEpsilon + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } + else + { + atmAmbientTurbSourceOmega + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } +} + + +void Foam::fv::atmAmbientTurbSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldi == 1) + { + atmAmbientTurbSourceK(geometricOneField(), rho, eqn, fieldi); + return; + } + + if (isEpsilon_) + { + atmAmbientTurbSourceEpsilon(geometricOneField(), rho, eqn, fieldi); + } + else + { + atmAmbientTurbSourceOmega(geometricOneField(), rho, eqn, fieldi); + } +} + + +void Foam::fv::atmAmbientTurbSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldi == 1) + { + atmAmbientTurbSourceK(alpha, rho, eqn, fieldi); + return; + } + + if (isEpsilon_) + { + atmAmbientTurbSourceEpsilon(alpha, rho, eqn, fieldi); + } + else + { + atmAmbientTurbSourceOmega(alpha, rho, eqn, fieldi); + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.H b/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.H new file mode 100644 index 0000000000..de1261fded --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSource.H @@ -0,0 +1,266 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmAmbientTurbSource + +Group + grpFvOptionsSources + +Description + Applies sources on \c k and either \c epsilon or \c omega to prevent them + droping below a specified ambient value for atmospheric boundary + layer modelling. Such adjustment reportedly increases numerical + stability for very stable atmospheric conditions, and prevents + nonphysical oscillations in regions of low shear at higher altitudes. + + Corrections applied to: + \verbatim + k | Turbulent kinetic energy [m2/s2] + \endverbatim + + Corrections applied to either of the below, if exist: + \verbatim + epsilon | Turbulent kinetic energy dissipation rate [m2/s3] + omega | Specific dissipation rate [1/s] + \endverbatim + + Required fields: + \verbatim + k | Turbulent kinetic energy [m2/s2] + epsilon/omega | Dissipation rate OR Specific dissipation rate [m2/s3]/[1/s] + \endverbatim + + References: + \verbatim + Background turbulence (tag:RS): + Rumsey, C. L., & Spalart, P. R. (2009). + Turbulence model behavior in low Reynolds number + regions of aerodynamic flowfields. + AIAA journal, 47(4), 982-993. + DOI:10.2514/1.39947 + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmAmbientTurbSource1 + { + // Mandatory entries (unmodifiable) + type atmAmbientTurbSource; + + atmAmbientTurbSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Mandatory entries (unmodifiable) + kAmb 0.0; + + // Optional entries (unmodifiable) + rho rho; + epsilonAmb 0.0; + omegaAmb 0.0; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmAmbientTurbSource | word | yes | - + kAmb | Ambient value for k | scalar | yes | - + rho | Name of density field | word | no | rho + epsilonAmb | Ambient value for epsilon | scalar | no | 0.0 + omegaAmb | Ambient value for omega | scalar | no | 0.0 + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +SourceFiles + atmAmbientTurbSource.C + atmAmbientTurbSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fv_atmAmbientTurbSource_H +#define fv_atmAmbientTurbSource_H + +#include "cellSetOption.H" +#include "turbulentTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmAmbientTurbSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmAmbientTurbSource +: + public cellSetOption +{ + // Private Data + + //- Internal flag to determine the working field is epsilon or omega + Switch isEpsilon_; + + //- Name of density field + const word rhoName_; + + //- Ambient turbulent kinetic energy value [m2/s2] + const dimensionedScalar kAmb_; + + //- Ambient turbulent kinetic energy dissipation rate value [m2/s3] + const dimensionedScalar epsilonAmb_; + + //- Ambient specific dissipation rate value [1/s] + const dimensionedScalar omegaAmb_; + + //- Required turbulence model coefficients (copied from turb model) + dimensionedScalar Cmu_; + dimensionedScalar C2_; + + + // Private Member Functions + + //- Apply atmAmbientTurbSource to epsilon field + template + void atmAmbientTurbSourceEpsilon + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + //- Apply atmAmbientTurbSource to omega field + template + void atmAmbientTurbSourceOmega + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + //- Apply atmAmbientTurbSource to k field + template + void atmAmbientTurbSourceK + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + +public: + + //- Runtime type information + TypeName("atmAmbientTurbSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmAmbientTurbSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmAmbientTurbSource(const atmAmbientTurbSource&) = delete; + + //- No copy assignment + void operator=(const atmAmbientTurbSource&) = delete; + + + // Member Functions + + //- Add explicit contribution to epsilon or omega equation + //- for incompressible flow computations + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for compressible flow computations + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for multiphase flow computations + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Read source dictionary (effectively no-op) + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "atmAmbientTurbSourceTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSourceTemplates.C b/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSourceTemplates.C new file mode 100644 index 0000000000..600e411a15 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmAmbientTurbSource/atmAmbientTurbSourceTemplates.C @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmAmbientTurbSource.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::fv::atmAmbientTurbSource::atmAmbientTurbSourceEpsilon +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + const volScalarField& epsilon = turbPtr->epsilon(); + + // (Heuristically derived from RS:Eq. 4, rhs-term:5) + eqn += + fvm::Sp(alpha()*rho()*C2_*sqr(epsilonAmb_)/(kAmb_*epsilon()), epsilon); +} + + +template +void Foam::fv::atmAmbientTurbSource::atmAmbientTurbSourceOmega +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + const volScalarField& omega = turbPtr->omega(); + const volScalarField::Internal& beta = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":beta") + ); + + // (RS:Eq. 4, rhs-term:5) + eqn += fvm::Sp(alpha()*rho()*Cmu_*beta*sqr(omegaAmb_)/omega(), omega); +} + + +template +void Foam::fv::atmAmbientTurbSource::atmAmbientTurbSourceK +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + const volScalarField& k = turbPtr->k(); + + if (isEpsilon_) + { + // (Heuristically derived from RS:Eq. 3, rhs-term:4) + eqn += fvm::Sp(alpha()*rho()*epsilonAmb_/k(), k); + } + else + { + // (RS:Eq. 3, rhs-term:4) + eqn += fvm::Sp(alpha()*rho()*Cmu_*omegaAmb_*kAmb_/k(), k); + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.C b/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.C new file mode 100644 index 0000000000..afa1a1da72 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.C @@ -0,0 +1,354 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmBuoyancyTurbSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmBuoyancyTurbSource, 0); + addToRunTimeSelectionTable(option, atmBuoyancyTurbSource, dictionary); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::fv::atmBuoyancyTurbSource::calcB() +{ + //- Temperature field [K] + const volScalarField& T = mesh_.lookupObjectRef("T"); + + //- Turbulent heat transfer coefficient field [m2/s] + const volScalarField& alphat = + mesh_.lookupObjectRef("alphat"); + + // (ARAL:Eq. 7) + B_ = beta_*alphat()*(fvc::grad(T) & g_)(); +} + + +Foam::tmp +Foam::fv::atmBuoyancyTurbSource::calcC3 +( + const volScalarField::Internal& k, + const volScalarField::Internal& epsilon, + const volScalarField::Internal& G +) const +{ + // Gradient Richardson number (ARAL:p. 4) + const volScalarField::Internal Rig + ( + -B_/(G + dimensionedScalar(G.dimensions(), SMALL)) + ); + + // Mixing-length scale estimation (P:Eq. 10.37 & p. 374) normalised by Lmax_ + const volScalarField::Internal LbyLmax + ( + (pow(Cmu_, 0.75)/Lmax_)*pow(k, 1.5)/epsilon + ); + + // (ARAL:Eq. 10), with a typo of (C2_) instead of using (C2_ - 1.0) + volScalarField::Internal alphaB(1.0 - LbyLmax); + + alphaB == + neg0(Rig)*(1.0 - (1.0 + (C2_ - 1.0)/(C2_ - C1_))*LbyLmax) + + pos(Rig)*(1.0 - LbyLmax); + + // (SKL:Eq. 18, rhs-term:3); (ARAL:Eq. 5, rhs-term:3) has a typo + return (C1_ - C2_)*alphaB + 1.0; +} + + +Foam::tmp +Foam::fv::atmBuoyancyTurbSource::calcC3 +( + const volScalarField::Internal& k, + const volScalarField::Internal& omega, + const volScalarField::Internal& G, + const volScalarField::Internal& gamma, + const volScalarField::Internal& beta +) const +{ + // Gradient Richardson number (ARAL:p. 4) + const volScalarField::Internal Rig + ( + -B_/(G + dimensionedScalar(G.dimensions(), SMALL)) + ); + + // Mixing-length scale estimation (L:Eq. 3.20) normalised by Lmax_ + const volScalarField::Internal LbyLmax + ( + (1.0/(pow025(Cmu_)*Lmax_))*sqrt(k)/omega + ); + + // (ARAL:Eq. 10) + volScalarField::Internal alphaB(1.0 - LbyLmax); + + alphaB == + neg0(Rig)*(1.0 - (1.0 + beta/(beta - gamma))*LbyLmax) + + pos(Rig)*(1.0 - LbyLmax); + + // (SKL:Eq. 19, rhs-term:3); (ARAL:Eq. 5, rhs-term:3) has a typo + return (gamma - beta)*alphaB; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmBuoyancyTurbSource::atmBuoyancyTurbSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + isEpsilon_(true), + rhoName_(coeffs_.getOrDefault("rho", "rho")), + Lmax_ + ( + dimensionedScalar + ( + dimLength, + coeffs_.getCheckOrDefault + ( + "Lmax", + 41.575, + [&](const scalar Lmax){ return Lmax > SMALL; } + ) + ) + ), + n_ + ( + dimensionedScalar + ( + dimless, + coeffs_.getCheckOrDefault + ( + "n", + 3.0, + [&](const scalar n){ return n > SMALL; } + ) + ) + ), + beta_ + ( + dimensionedScalar + ( + dimless/dimTemperature, + coeffs_.getCheckOrDefault + ( + "beta", + 3.3e-3, + [&](const scalar x){ return x > SMALL; } + ) + ) + ), + Cmu_(Zero), + C1_(Zero), + C2_(Zero), + g_ + ( + "g", + dimLength/sqr(dimTime), + meshObjects::gravity::New(mesh_.time()).value() + ), + B_ + ( + IOobject + ( + "B", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar(sqr(dimLength)/pow3(dimTime), Zero) + ) +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + if (!turbPtr) + { + FatalErrorInFunction + << "Unable to find a turbulence model." + << abort(FatalError); + } + + fieldNames_.setSize(2, "undefined"); + + tmp tepsilon = turbPtr->epsilon(); + tmp tomega = turbPtr->omega(); + + if (!tepsilon.isTmp()) + { + fieldNames_[0] = tepsilon().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + + Cmu_.read("Cmu", turbDict); + C1_.read("C1", turbDict); + C2_.read("C2", turbDict); + } + else if (!tomega.isTmp()) + { + isEpsilon_ = false; + fieldNames_[0] = tomega().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + + Cmu_.read("betaStar", turbDict); + } + else + { + FatalErrorInFunction + << "Unable to find neither epsilon nor omega field." << nl + << "atmBuoyancyTurbSource needs either epsilon or omega field." + << abort(FatalError); + } + + fieldNames_[1] = turbPtr->k()().name(); + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmBuoyancyTurbSource to: " + << fieldNames_[0] << " and " << fieldNames_[1] + << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmBuoyancyTurbSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldi == 1) + { + atmBuoyancyTurbSourceK + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + return; + } + + calcB(); + + if (isEpsilon_) + { + atmBuoyancyTurbSourceEpsilon + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } + else + { + atmBuoyancyTurbSourceOmega + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } +} + + +void Foam::fv::atmBuoyancyTurbSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldi == 1) + { + atmBuoyancyTurbSourceK(geometricOneField(), rho, eqn, fieldi); + return; + } + + calcB(); + + if (isEpsilon_) + { + atmBuoyancyTurbSourceEpsilon(geometricOneField(), rho, eqn, fieldi); + } + else + { + atmBuoyancyTurbSourceOmega(geometricOneField(), rho, eqn, fieldi); + } +} + + +void Foam::fv::atmBuoyancyTurbSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldi == 1) + { + atmBuoyancyTurbSourceK(alpha, rho, eqn, fieldi); + return; + } + + calcB(); + + if (isEpsilon_) + { + atmBuoyancyTurbSourceEpsilon(alpha, rho, eqn, fieldi); + } + else + { + atmBuoyancyTurbSourceOmega(alpha, rho, eqn, fieldi); + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.H b/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.H new file mode 100644 index 0000000000..c34f05e23b --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.H @@ -0,0 +1,314 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmBuoyancyTurbSource + +Group + grpFvOptionsSources + +Description + Applies sources on \c k and either \c epsilon or \c omega to incorporate + effects of buoyancy for atmospheric boundary layer modelling. + + Corrections applied to: + \verbatim + k | Turbulent kinetic energy [m2/s2] + \endverbatim + + Corrections applied to either of the below, if exist: + \verbatim + epsilon | Turbulent kinetic energy dissipation rate [m2/s3] + omega | Specific dissipation rate [1/s] + \endverbatim + + Required fields: + \verbatim + k | Turbulent kinetic energy [m2/s2] + epsilon/omega | Dissipation rate OR Specific dissipation rate [m2/s3]/[1/s] + T | Temperature [K] + alphat | Turbulent heat tranfer coefficient [m2/s] + \endverbatim + + References: + \verbatim + Buoyancy effects (tags:SKL, ARAL): + Sogachev, A., Kelly, M., & Leclerc, M. Y. (2012). + Consistent two-equation closure modelling for atmospheric + research: buoyancy and vegetation implementations. + Boundary-layer meteorology, 145(2), 307-327. + DOI: 10.1007/s10546-012-9726-5 + + Alletto, M., Radi, A., Adib, J., Langner, J., + Peralta, C., Altmikus, A., & Letzel, M. (2018). + E-Wind: Steady state CFD approach for stratified flows + used for site assessment at Enercon. + In Journal of Physics: Conference Series, 1037(7). + DOI:10.1088/1742-6596/1037/7/072020 + + Mixing-length scale limiter for omega (tag:L): + Langner, J. (2016). + Implementierung und validierung von RANS-modellen der + thermisch geschichteten, atmosphärischen grenzschicht. + Masterarbeit zum thema, Technische Universität Berlin. + + Mixing-length scale estimation (tag:P): + Pope, S. B. (2000). + Turbulent flows. + Cambridge, UK: Cambridge Univ. Press + DOI:10.1017/CBO9780511840531 + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmBuoyancyTurbSource1 + { + // Mandatory entries (unmodifiable) + type atmBuoyancyTurbSource; + + atmBuoyancyTurbSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Optional (unmodifiable) + rho rho; + Lmax 41.575; + n 3.0; + beta 3.3e-03; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmBuoyancyTurbSource | word | yes | - + rho | Name of density field | word | no | rho + Lmax | Maximum mixing-length scale | scalar | no | 41.575 + n | Mixing-length scale exponent | scalar | no | 3.0 + beta | Thermal expansion coefficient | scalar | no | 3.3e-03 + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +SourceFiles + atmBuoyancyTurbSource.C + atmBuoyancyTurbSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fv_atmBuoyancyTurbSource_H +#define fv_atmBuoyancyTurbSource_H + +#include "cellSetOption.H" +#include "turbulentTransportModel.H" +#include "gravityMeshObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmBuoyancyTurbSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmBuoyancyTurbSource +: + public cellSetOption +{ + // Private Data + + //- Internal flag to determine the working field is epsilon or omega + Switch isEpsilon_; + + //- Name of density field + const word rhoName_; + + //- Maximum mixing-length scale [m] + const dimensionedScalar Lmax_; + + //- Mixing-length scale exponent + const dimensionedScalar n_; + + //- Thermal expansion coefficient [1/K] + const dimensionedScalar beta_; + + //- Required turbulence model coefficients (copied from turb model) + dimensionedScalar Cmu_; + dimensionedScalar C1_; + dimensionedScalar C2_; + + //- Gravitational acceleration vector [m/s2] + const dimensionedVector g_; + + + // Fields + + //- Buoyancy production term [m2/s3] + volScalarField::Internal B_; + + + // Private Member Functions + + //- Compute the buoyancy production term B_ + void calcB(); + + //- Return the buoyancy-effect modifier for epsilon-based models + tmp calcC3 + ( + const volScalarField::Internal& k, + const volScalarField::Internal& epsilon, + const volScalarField::Internal& G + ) const; + + //- Return the buoyancy-effect modifier for omega-based models + tmp calcC3 + ( + const volScalarField::Internal& k, + const volScalarField::Internal& omega, + const volScalarField::Internal& G, + const volScalarField::Internal& gamma, + const volScalarField::Internal& beta + ) const; + + //- Apply atmBuoyancyTurbSource to epsilon field + template + void atmBuoyancyTurbSourceEpsilon + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + //- Apply atmBuoyancyTurbSource to omega field + template + void atmBuoyancyTurbSourceOmega + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + //- Apply atmBuoyancyTurbSource to k field + template + void atmBuoyancyTurbSourceK + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + +public: + + //- Runtime type information + TypeName("atmBuoyancyTurbSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmBuoyancyTurbSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmBuoyancyTurbSource(const atmBuoyancyTurbSource&) = delete; + + //- No copy assignment + void operator=(const atmBuoyancyTurbSource&) = delete; + + + // Member Functions + + //- Add explicit contribution to epsilon or omega equation + //- for incompressible flow computations + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for compressible flow computations + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for multiphase flow computations + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Read source dictionary (effectively no-op) + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "atmBuoyancyTurbSourceTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSourceTemplates.C b/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSourceTemplates.C new file mode 100644 index 0000000000..054d2ec09c --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSourceTemplates.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmBuoyancyTurbSource.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::fv::atmBuoyancyTurbSource::atmBuoyancyTurbSourceEpsilon +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + // Fetch required fields from the epsilon-based model + const volScalarField& k = turbPtr->k(); + const volScalarField& epsilon = turbPtr->epsilon(); + const volScalarField::Internal& GbyNu = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":GbyNu") + ); + const volScalarField::Internal G(GbyNu*Cmu_*sqr(k())/epsilon()); + + // (ARAL:Eq. 5, rhs-term:3) + eqn += fvm::Sp(alpha()*rho()*calcC3(k(), epsilon(), G)*B_/k(), epsilon); +} + + +template +void Foam::fv::atmBuoyancyTurbSource::atmBuoyancyTurbSourceOmega +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + // Fetch required fields from the omega-based model + const volScalarField& k = turbPtr->k(); + const volScalarField& omega = turbPtr->omega(); + const volScalarField::Internal& GbyNu = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":GbyNu") + ); + const volScalarField::Internal G(GbyNu*Cmu_*k()/omega()); + const volScalarField::Internal& gamma = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":gamma") + ); + const volScalarField::Internal& beta = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":beta") + ); + + // (ARAL:Eq. 5, rhs-term:3) + eqn += + fvm::Sp + ( + alpha()*rho()*calcC3(k(), omega(), G, gamma, beta)*B_/k(), + omega + ); +} + + +template +void Foam::fv::atmBuoyancyTurbSource::atmBuoyancyTurbSourceK +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + const volScalarField& k = turbPtr->k(); + + eqn += fvm::Sp(alpha()*rho()*B_/k(), k); +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.C b/src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.C new file mode 100644 index 0000000000..04e6c1cf3b --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.C @@ -0,0 +1,170 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 CENER + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmCoriolisUSource.H" +#include "fvMatrices.H" +#include "unitConversion.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmCoriolisUSource, 0); + addToRunTimeSelectionTable(option, atmCoriolisUSource, dictionary); +} +} + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::vector Foam::fv::atmCoriolisUSource::planetaryRotationVector() const +{ + return vector + ( + Zero, + twoPi/(planetaryRotationPeriod_*3600.0)*cos(degToRad(latitude_)), + twoPi/(planetaryRotationPeriod_*3600.0)*sin(degToRad(latitude_)) + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmCoriolisUSource::atmCoriolisUSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + latitude_ + ( + coeffs_.getCheckOrDefault + ( + "latitude", + 0.0, + [&](const scalar x){ return (90 >= mag(x)) && (mag(x) >= 0); } + ) + ), + planetaryRotationPeriod_ + ( + coeffs_.getCheckOrDefault + ( + "planetaryRotationPeriod", + 23.9344694, + [&](const scalar x){ return x > SMALL; } + ) + ), + Omega_ + ( + dimensionedVector + ( + dimless/dimTime, + coeffs_.getOrDefault + ( + "Omega", + planetaryRotationVector() + ) + ) + ) +{ + if (mag(Omega_.value()) < SMALL) + { + WarningInFunction + << "The magnitude of the rotation vector in atmCoriolisUSource is " + << "effectively zero, mag(Omega) = " << mag(Omega_.value()) << nl + << "Please check input values in atmCoriolisUSource settings." + << endl; + } + + fieldNames_.setSize(1, "U"); + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmCoriolisUSource to: " << fieldNames_[0] << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmCoriolisUSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + const volVectorField& U = eqn.psi(); + + if (V_ > VSMALL) + { + eqn -= (2.0*Omega_)^U; + } +} + + +void Foam::fv::atmCoriolisUSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + const volVectorField& U = eqn.psi(); + + if (V_ > VSMALL) + { + eqn -= rho*((2.0*Omega_)^U); + } +} + + +void Foam::fv::atmCoriolisUSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + const volVectorField& U = eqn.psi(); + + if (V_ > VSMALL) + { + eqn -= alpha*rho*((2.0*Omega_)^U); + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.H b/src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.H new file mode 100644 index 0000000000..707fa79acb --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmCoriolisUSource/atmCoriolisUSource.H @@ -0,0 +1,238 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 CENER + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmCoriolisUSource + +Group + grpAtmFvOptions + +Description + Applies corrections to incorporate the horizontal and vertical components + of the Coriolis force for which the rotating frame is Earth. + + Corrections applied on: + \verbatim + U | Velocity [m/s] + \endverbatim + + Required fields: + \verbatim + U | Velocity [m/s] + \endverbatim + + The Coriolis force is an inertial or fictitious force that acts on + objects that are in motion within a frame of reference that rotates with + respect to an inertial frame. + + In the atmospheric boundary layer context, for the "Coriolis effect", + the rotating reference frame implied is almost always Earth. + Because Earth spins, Earth-bound observers need to account for the + Coriolis force to correctly analyze the motion of objects. Earth + completes one rotation per day, so for motions of everyday objects the + Coriolis force is usually quite small compared with other forces; its + effects generally become noticeable only for motions occurring over large + distances and long periods of time, such as large-scale movement of air in + the atmosphere or water in the ocean. Such motions are constrained by the + surface of Earth, so only the horizontal component of the Coriolis + force is generally important. + + References: + \verbatim + Coriolis force. (n.d.). + In Wikipedia. Retrieved Feb 26, 2020, from https://w.wiki/JE5 + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmCoriolisUSource1 + { + // Mandatory entries (unmodifiable) + type atmCoriolisUSource; + + atmCoriolisUSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Conditional mandatory entries (unmodifiable) + // Option-1: to directly input rotation vector + Omega (0 0 5.65156e-5); + + // Option-2: to indirectly input rotation vector + // by a latitude-period pair + latitude 51.971; + planetaryRotationPeriod 23.9344694; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmCoriolisUSource | word | yes | - + latitude | Geographic coordinate specifying the north–south position of a point on the surface of a planetary body [degree] | scalar | conditional | 0.0 + planetaryRotationPeriod | Rotation period of the planetary body [h] | scalar | conditional | 23.9344694 + Omega | Rotation vector of the rotating reference frame relative to the inertial frame [rad/s] | vector | conditional | (0 0 0) + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +Note + - Dimensional consistencies are hard-coded; therefore, no internal + check is performed for potential dimension inconsistencies. + - The magnitude of the \c latitude is limited to [0, 90], yet its value + is allowed to be negative for the southern hemisphere. + - The Coriolis force for cell whose volume is less than \c VSMALL is + equated to zero. + +SourceFiles + atmCoriolisUSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef atmCoriolisUSource_H +#define atmCoriolisUSource_H + +#include "cellSetOption.H" +#include "dimensionedVector.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmCoriolisUSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmCoriolisUSource +: + public cellSetOption +{ + // Private Data + + //- Latitude on the planetary body + const scalar latitude_; + + //- Rotation period of the planetary body + const scalar planetaryRotationPeriod_; + + //- Planetary rotation vector + const dimensionedVector Omega_; + + + // Private Member Functions + + //- Rotation vector of the planetary body + vector planetaryRotationVector() const; + + +public: + + //- Runtime type information + TypeName("atmCoriolisUSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmCoriolisUSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmCoriolisUSource(const atmCoriolisUSource&) = delete; + + //- No copy assignment + void operator=(const atmCoriolisUSource&) = delete; + + + //- Destructor + virtual ~atmCoriolisUSource() = default; + + + // Member Functions + + //- Add explicit contribution to incompressible momentum equation + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to phase momentum equation + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Read source dictionary + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.C b/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.C new file mode 100644 index 0000000000..f22c8886f2 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.C @@ -0,0 +1,243 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmLengthScaleTurbSource.H" +#include "geometricOneField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmLengthScaleTurbSource, 0); + addToRunTimeSelectionTable(option, atmLengthScaleTurbSource, dictionary); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::tmpFoam::fv::atmLengthScaleTurbSource:: +calcC1Star +( + const volScalarField::Internal& k, + const volScalarField::Internal& epsilon +) const +{ + // Mixing-length scale estimation (P:Eq. 10.37 & p. 374) + tmp L_(pow(Cmu_, 0.75)*pow(k, 1.5)/epsilon); + + // (AC:Eq. 16) wherein the exponentiation "n_" is not present. + // "n_" is an ad-hoc implementation. + return (C2_ - C1_)*pow(L_/Lmax_, n_); +} + + +Foam::tmp Foam::fv::atmLengthScaleTurbSource:: +calcGammaStar +( + const volScalarField::Internal& k, + const volScalarField::Internal& omega, + const volScalarField::Internal& gamma, + const volScalarField::Internal& beta +) const +{ + // (L:Eq. 3.20) + tmp L_(sqrt(k)/(pow025(Cmu_)*omega)); + + // (L:Eq. 3.34) + return (gamma - beta)*pow(L_/Lmax_, n_); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmLengthScaleTurbSource::atmLengthScaleTurbSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + isEpsilon_(true), + rhoName_(coeffs_.getOrDefault("rho", "rho")), + Lmax_ + ( + dimensionedScalar + ( + dimLength, + coeffs_.getCheckOrDefault + ( + "Lmax", + 41.575, + [&](const scalar Lmax){ return Lmax > SMALL; } + ) + ) + ), + n_ + ( + dimensionedScalar + ( + dimless, + coeffs_.getCheckOrDefault + ( + "n", + 3.0, + [&](const scalar n){ return n > SMALL; } + ) + ) + ), + Cmu_(Zero), + C1_(Zero), + C2_(Zero), + C3_(Zero) +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + if (!turbPtr) + { + FatalErrorInFunction + << "Unable to find a turbulence model." + << abort(FatalError); + } + + fieldNames_.setSize(1, "undefined"); + + tmp tepsilon = turbPtr->epsilon(); + tmp tomega = turbPtr->omega(); + + if (!tepsilon.isTmp()) + { + fieldNames_[0] = tepsilon().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + Cmu_.read("Cmu", turbDict); + C1_.read("C1", turbDict); + C2_.read("C2", turbDict); + C3_.read("C3", turbDict); + } + else if (!tomega.isTmp()) + { + isEpsilon_ = false; + fieldNames_[0] = tomega().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + Cmu_.read("betaStar", turbDict); + } + else + { + FatalErrorInFunction + << "Unable to find neither epsilon nor omega field." << nl + << "atmLengthScaleTurbSource needs either epsilon or omega field." + << abort(FatalError); + } + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmLengthScaleTurbSource to: " << fieldNames_[0] + << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmLengthScaleTurbSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + if (isEpsilon_) + { + atmLengthScaleTurbSourceEpsilon + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } + else + { + atmLengthScaleTurbSourceOmega + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } +} + + +void Foam::fv::atmLengthScaleTurbSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (isEpsilon_) + { + atmLengthScaleTurbSourceEpsilon(geometricOneField(), rho, eqn, fieldi); + } + else + { + atmLengthScaleTurbSourceOmega(geometricOneField(), rho, eqn, fieldi); + } +} + + +void Foam::fv::atmLengthScaleTurbSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (isEpsilon_) + { + atmLengthScaleTurbSourceEpsilon(alpha, rho, eqn, fieldi); + } + else + { + atmLengthScaleTurbSourceOmega(alpha, rho, eqn, fieldi); + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.H b/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.H new file mode 100644 index 0000000000..4a164887f8 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSource.H @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmLengthScaleTurbSource + +Group + grpFvOptionsSources + +Description + Applies sources on either \c epsilon or \c omega to correct + mixing-length scale estimations for atmospheric boundary layer modelling. + + Corrections applied to either of the below, if exist: + \verbatim + epsilon | Turbulent kinetic energy dissipation rate [m2/s3] + omega | Specific dissipation rate [1/s] + \endverbatim + + Required fields, either of the below: + \verbatim + epsilon | Turbulent kinetic energy dissipation rate [m2/s3] + omega | Specific dissipation rate [1/s] + \endverbatim + + References: + \verbatim + Mixing-length scale limiter for epsilon (tag:AC): + Apsley, D. D., & Castro, I. P. (1997). + A limited-length-scale k-ε model for the neutral and + stably-stratified atmospheric boundary layer. + Boundary-layer meteorology, 83(1), 75-98. + DOI:10.1023/A:100025221 + + Mixing-length scale limiter for omega (tag:L): + Langner, J. (2016). + Implementierung und validierung von RANS-modellen der + thermisch geschichteten, atmosphärischen grenzschicht. + Masterarbeit zum thema, Technische Universität Berlin. + + Mixing-length scale estimation (tag:P): + Pope, S. B. (2000). + Turbulent flows. + Cambridge, UK: Cambridge Univ. Press + DOI:10.1017/CBO9780511840531 + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmLengthScaleTurbSource1 + { + // Mandatory entries (unmodifiable) + type atmLengthScaleTurbSource; + + atmLengthScaleTurbSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Optional entries (unmodifiable) + rho rho; + Lmax 41.575; + n 3.0; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmLengthScaleTurbSource | word | yes | - + rho | Name of density field | word | no | rho + Lmax | Maximum mixing-length scale [m] | scalar | no | 41.575 + n | Mixing-length scale exponent | scalar | no | 3.0 + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +See also + - cellSetOption.H + +SourceFiles + atmLengthScaleTurbSource.C + atmLengthScaleTurbSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fv_atmLengthScaleTurbSource_H +#define fv_atmLengthScaleTurbSource_H + +#include "cellSetOption.H" +#include "turbulentTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmLengthScaleTurbSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmLengthScaleTurbSource +: + public cellSetOption +{ + // Private Data + + //- Internal flag to determine the working field is epsilon or omega + bool isEpsilon_; + + //- Name of density field + const word rhoName_; + + //- Maximum mixing-length scale [m] + const dimensionedScalar Lmax_; + + //- Mixing-length scale exponent + const dimensionedScalar n_; + + //- Required turbulence model coefficients (copied from turb model) + dimensionedScalar Cmu_; + dimensionedScalar C1_; + dimensionedScalar C2_; + dimensionedScalar C3_; + + + // Private Member Functions + + //- Return mixing-length scale modifier for epsilon-based models + tmp calcC1Star + ( + const volScalarField::Internal& k, + const volScalarField::Internal& epsilon + ) const; + + //- Return mixing-length scale modifier for omega-based models + tmp calcGammaStar + ( + const volScalarField::Internal& k, + const volScalarField::Internal& omega, + const volScalarField::Internal& gamma, + const volScalarField::Internal& beta + ) const; + + //- Apply atmLengthScaleTurbSource to epsilon + template + void atmLengthScaleTurbSourceEpsilon + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + //- Apply atmLengthScaleTurbSource to omega + template + void atmLengthScaleTurbSourceOmega + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + +public: + + //- Runtime type information + TypeName("atmLengthScaleTurbSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmLengthScaleTurbSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmLengthScaleTurbSource(const atmLengthScaleTurbSource&) = delete; + + //- No copy assignment + void operator=(const atmLengthScaleTurbSource&) = delete; + + + // Member Functions + + //- Add explicit contribution to epsilon or omega equation + //- for incompressible flow computations + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for compressible flow computations + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for multiphase flow computations + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Read source dictionary (effectively no-op) + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "atmLengthScaleTurbSourceTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSourceTemplates.C b/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSourceTemplates.C new file mode 100644 index 0000000000..507bbd3578 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmLengthScaleTurbSource/atmLengthScaleTurbSourceTemplates.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmLengthScaleTurbSource.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::fv::atmLengthScaleTurbSource::atmLengthScaleTurbSourceEpsilon +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + // Fetch required fields from the epsilon-based model + const volScalarField::Internal& k = turbPtr->k()(); + const volScalarField::Internal& epsilon = turbPtr->epsilon()(); + const volScalarField::Internal& GbyNu = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":GbyNu") + ); + + eqn += alpha()*rho()*calcC1Star(k, epsilon)*GbyNu*Cmu_*k; +} + + +template +void Foam::fv::atmLengthScaleTurbSource::atmLengthScaleTurbSourceOmega +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + // Fetch required fields from the omega-based model + const volScalarField::Internal& k = turbPtr->k()(); + const volScalarField::Internal& omega = turbPtr->omega()(); + const volScalarField::Internal& GbyNu = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":GbyNu") + ); + const volScalarField::Internal& gamma = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":gamma") + ); + const volScalarField::Internal& beta = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":beta") + ); + + eqn += alpha()*rho()*calcGammaStar(k, omega, gamma, beta)*GbyNu; +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.C b/src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.C new file mode 100644 index 0000000000..4a558d9678 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmNutSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmNutSource, 0); + addToRunTimeSelectionTable(option, atmNutSource, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmNutSource::atmNutSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + artNutName_(dict.getOrDefault("nut", "artNut")), + artNut_ + ( + IOobject + ( + artNutName_, + mesh.time().timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(sqr(dimLength)/dimTime, Zero) + ) +{ + if (!(artNut_.headerOk())) + { + FatalErrorInFunction + << "Unable to find artificial turbulent viscosity field." << nl + << "atmNutSource requires an artificial nut field." + << abort(FatalError); + } + + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + if (!turbPtr) + { + FatalErrorInFunction + << "Unable to find a turbulence model." + << abort(FatalError); + } + + fieldNames_.setSize(1, "undefined"); + + const tmp& tnut = turbPtr->nut(); + + if (!tnut.isTmp()) + { + fieldNames_[0] = tnut().name(); + } + else + { + FatalErrorInFunction + << "Unable to find nut field." << nl + << "atmNutSource requires nut field." + << abort(FatalError); + } + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmNutSource to: " << fieldNames_[0] << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmNutSource::correct(volScalarField& field) +{ + Log << this->name() << ": correcting " << field.name() << endl; + + field += artNut_; + + field.correctBoundaryConditions(); +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.H b/src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.H new file mode 100644 index 0000000000..60b562a966 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmNutSource/atmNutSource.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmNutSource + +Group + grpFvOptionsSources + +Description + Adds/subtracts a given artificial turbulent viscosity field to/from \c nut + for atmospheric boundary layer modelling. + + Corrections applied to: + \verbatim + nut | Turbulent viscosity [m2/s] + \endverbatim + + Required fields: + \verbatim + nut | Turbulent viscosity [m2/s] + artNut | Artificial turbulent viscosity [m2/s] + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmNutSource1 + { + // Mandatory entries (unmodifiable) + type atmNutSource; + + atmNutSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Optional entries (unmodifiable) + nut artNut; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmNutSource | word | yes | - + nut | Field name of artificial nut | word | no | artNut + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +SourceFiles + atmNutSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fv_atmNutSource_H +#define fv_atmNutSource_H + +#include "cellSetOption.H" +#include "turbulentTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmNutSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmNutSource +: + public cellSetOption +{ + // Private Data + + //- Name of the artificial turbulent viscosity field + const word artNutName_; + + + // Fields + + //- Artificial turbulent viscosity field [m2/s] + volScalarField artNut_; + + +public: + + //- Runtime type information + TypeName("atmNutSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmNutSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmNutSource(const atmNutSource&) = delete; + + //- No copy assignment + void operator=(const atmNutSource&) = delete; + + + // Member Functions + + //- Correct the turbulent viscosity + virtual void correct(volScalarField& field); + + //- Read source dictionary (effectively no-op) + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.C b/src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.C new file mode 100644 index 0000000000..ae907dc9bd --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.C @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmPlantCanopyTSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmPlantCanopyTSource, 0); + addToRunTimeSelectionTable(option, atmPlantCanopyTSource, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmPlantCanopyTSource::atmPlantCanopyTSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + rhoName_(coeffs_.getOrDefault("rho", "rho")), + Cp0_ + ( + dimensionedScalar + ( + sqr(dimLength)/sqr(dimTime)/dimTemperature, + coeffs_.getCheckOrDefault + ( + "Cp0", + 1005.0, + scalarMinMax::ge(SMALL) + ) + ) + ), + qPlant_ + ( + IOobject + ( + "qPlant", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) +{ + fieldNames_.setSize(1, "T"); + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmPlantCanopyTSource to: " << fieldNames_[0] << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmPlantCanopyTSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + if (V_ > VSMALL) + { + eqn -= -qPlant_/Cp0_; + } +} + + +void Foam::fv::atmPlantCanopyTSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (V_ > VSMALL) + { + eqn -= -rho*qPlant_/Cp0_; + } +} + + +void Foam::fv::atmPlantCanopyTSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (V_ > VSMALL) + { + eqn -= -alpha*rho*qPlant_/Cp0_; + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.H b/src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.H new file mode 100644 index 0000000000..5305ab41e1 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyTSource/atmPlantCanopyTSource.H @@ -0,0 +1,194 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmPlantCanopyTSource + +Group + grpFvOptionsSources + +Description + Applies sources on temperature \c T to incorporate effects + of plant canopy for atmospheric boundary layer modelling. + + Corrections applied to: + \verbatim + T | Temperature [K] + \endverbatim + + Required fields: + \verbatim + T | Temperature [K] + qPlant | Heat flux [m2/s3] + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmPlantCanopyTSource1 + { + // Mandatory entries (unmodifiable) + type atmPlantCanopyTSource; + + atmPlantCanopyTSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Optional entries (unmodifiable) + rho rho; + Cp0 1005.0; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmPlantCanopyTSource | word | yes | - + rho | Name of density field | word | no | rho + Cp0 | Specific heat capacity [m2/s2/K] | scalar | no | 1005.0 + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +SourceFiles + atmPlantCanopyTSource.C + atmPlantCanopyTSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fv_atmPlantCanopyTSource_H +#define fv_atmPlantCanopyTSource_H + +#include "cellSetOption.H" +#include "fvMatrices.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmPlantCanopyTSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmPlantCanopyTSource +: + public cellSetOption +{ + // Private Data + + //- Name of density field + const word rhoName_; + + //- Specific heat capacity + const dimensionedScalar Cp0_; + + // Fields + + //- Heat flux + volScalarField qPlant_; + + +public: + + //- Runtime type information + TypeName("atmPlantCanopyTSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmPlantCanopyTSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmPlantCanopyTSource(const atmPlantCanopyTSource&) = delete; + + //- No copy assignment + void operator=(const atmPlantCanopyTSource&) = delete; + + + // Member Functions + + //- Add explicit contribution to temperature equation + //- for incompressible flow computations + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to temperature equation + //- for compressible flow computations + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to temperature equation + //- for multiphase flow computations + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Read source dictionary (effectively no-op) + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C new file mode 100644 index 0000000000..548b4dff83 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C @@ -0,0 +1,216 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmPlantCanopyTurbSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmPlantCanopyTurbSource, 0); + addToRunTimeSelectionTable(option, atmPlantCanopyTurbSource, dictionary); +} +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::tmp +Foam::fv::atmPlantCanopyTurbSource::calcPlantCanopyTerm +( + const volVectorField::Internal& U +) const +{ + // (SP:Eq. 42) + return 12.0*Foam::sqrt(Cmu_)*plantCd_()*leafAreaDensity_()*mag(U); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmPlantCanopyTurbSource::atmPlantCanopyTurbSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + isEpsilon_(true), + rhoName_(coeffs_.getOrDefault("rho", "rho")), + Cmu_(Zero), + C1_(Zero), + C2_(Zero), + plantCd_ + ( + IOobject + ( + "plantCd", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ), + leafAreaDensity_ + ( + IOobject + ( + "leafAreaDensity", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + + if (!turbPtr) + { + FatalErrorInFunction + << "Unable to find a turbulence model." + << abort(FatalError); + } + + fieldNames_.setSize(1, "undefined"); + + tmp tepsilon = turbPtr->epsilon(); + tmp tomega = turbPtr->omega(); + + if (!tepsilon.isTmp()) + { + fieldNames_[0] = tepsilon().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + Cmu_.read("Cmu", turbDict); + C1_.read("C1", turbDict); + C2_.read("C2", turbDict); + } + else if (!tomega.isTmp()) + { + isEpsilon_ = false; + fieldNames_[0] = tomega().name(); + + const dictionary& turbDict = turbPtr->coeffDict(); + Cmu_.read("betaStar", turbDict); + } + else + { + FatalErrorInFunction + << "Unable to find neither epsilon nor omega field." << nl + << "atmPlantCanopyTurbSource needs either epsilon or omega field." + << abort(FatalError); + } + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmPlantCanopyTurbSource to: " << fieldNames_[0] + << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmPlantCanopyTurbSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + if (isEpsilon_) + { + atmPlantCanopyTurbSourceEpsilon + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } + else + { + atmPlantCanopyTurbSourceOmega + ( + geometricOneField(), + geometricOneField(), + eqn, + fieldi + ); + } +} + + +void Foam::fv::atmPlantCanopyTurbSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (isEpsilon_) + { + atmPlantCanopyTurbSourceEpsilon(geometricOneField(), rho, eqn, fieldi); + } + else + { + atmPlantCanopyTurbSourceOmega(geometricOneField(), rho, eqn, fieldi); + } +} + + +void Foam::fv::atmPlantCanopyTurbSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (isEpsilon_) + { + atmPlantCanopyTurbSourceEpsilon(alpha, rho, eqn, fieldi); + } + else + { + atmPlantCanopyTurbSourceOmega(alpha, rho, eqn, fieldi); + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.H b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.H new file mode 100644 index 0000000000..432289c088 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.H @@ -0,0 +1,247 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmPlantCanopyTurbSource + +Group + grpFvOptionsSources + +Description + Applies sources on either \c epsilon or \c omega to incorporate effects + of plant canopy for atmospheric boundary layer modelling. + + Corrections applied to either of the below, if exist: + \verbatim + epsilon | Turbulent kinetic energy dissipation rate [m2/s3] + omega | Specific dissipation rate [1/s] + \endverbatim + + Required fields: + \verbatim + epsilon/omega | Dissipation rate OR specific dissipation rate [m2/s3]/[1/s] + plantCd | Plant canopy drag coefficient [-] + leafAreaDensity | Leaf area density [1/m] + \endverbatim + + References: + \verbatim + Influence of forest (tag:SP): + Sogachev, A., & Panferov, O. (2006). + Modification of two-equation models to account for plant drag. + Boundary-Layer Meteorology, 121(2), 229-266. + DOI:10.1007/s10546-006-9073-5 + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmPlantCanopyTurbSource1 + { + // Mandatory entries (unmodifiable) + type atmPlantCanopyTurbSource; + + atmPlantCanopyTurbSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Optional entries (unmodifiable) + rho rho; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmPlantCanopyTurbSource | word | yes | - + rho | Name of density field | word | no | rho + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +SourceFiles + atmPlantCanopyTurbSource.C + atmPlantCanopyTurbSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fv_atmPlantCanopyTurbSource_H +#define fv_atmPlantCanopyTurbSource_H + +#include "cellSetOption.H" +#include "turbulentTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmPlantCanopyTurbSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmPlantCanopyTurbSource +: + public cellSetOption +{ + // Private Data + + //- Internal flag to determine the working field is epsilon or omega + Switch isEpsilon_; + + //- Name of density field + const word rhoName_; + + //- Required turbulence model coefficients (copied from turb model) + dimensionedScalar Cmu_; + dimensionedScalar C1_; + dimensionedScalar C2_; + + + // Fields + + //- Plant canopy drag coefficient field [-] + volScalarField plantCd_; + + //- Leaf area density field [1/m] + volScalarField leafAreaDensity_; + + + // Private Member Functions + + //- Return the modifier for plant canopy effects + tmp calcPlantCanopyTerm + ( + const volVectorField::Internal& U + ) const; + + //- Apply atmPlantCanopyTurbSource to epsilon + template + void atmPlantCanopyTurbSourceEpsilon + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + //- Apply atmPlantCanopyTurbSource to omega + template + void atmPlantCanopyTurbSourceOmega + ( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi + ) const; + + +public: + + //- Runtime type information + TypeName("atmPlantCanopyTurbSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmPlantCanopyTurbSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmPlantCanopyTurbSource(const atmPlantCanopyTurbSource&) = delete; + + //- No copy assignment + void operator=(const atmPlantCanopyTurbSource&) = delete; + + + // Member Functions + + //- Add explicit contribution to epsilon or omega equation + //- for incompressible flow computations + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for compressible flow computations + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to epsilon or omega equation + //- for multiphase flow computations + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Read source dictionary (effectively no-op) + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "atmPlantCanopyTurbSourceTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSourceTemplates.C b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSourceTemplates.C new file mode 100644 index 0000000000..0f95c35536 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSourceTemplates.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmPlantCanopyTurbSource.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::fv::atmPlantCanopyTurbSource::atmPlantCanopyTurbSourceEpsilon +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + const volScalarField& epsilon = turbPtr->epsilon(); + const volVectorField::Internal& U = turbPtr->U()(); + + eqn -= fvm::Sp(alpha()*rho()*(C1_ - C2_)*calcPlantCanopyTerm(U), epsilon); +} + + +template +void Foam::fv::atmPlantCanopyTurbSource::atmPlantCanopyTurbSourceOmega +( + const AlphaFieldType& alpha, + const RhoFieldType& rho, + fvMatrix& eqn, + const label fieldi +) const +{ + const auto* turbPtr = + mesh_.findObject + ( + turbulenceModel::propertiesName + ); + const volScalarField& omega = turbPtr->omega(); + const volVectorField::Internal& U = turbPtr->U()(); + const volScalarField::Internal& gamma = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":gamma") + ); + const volScalarField::Internal& beta = + mesh_.lookupObjectRef + ( + word(turbPtr->type() + ":beta") + ); + + eqn -= fvm::Sp(alpha()*rho()*(gamma - beta)*calcPlantCanopyTerm(U), omega); +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C b/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C new file mode 100644 index 0000000000..4ad1fdc3c6 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "atmPlantCanopyUSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(atmPlantCanopyUSource, 0); + addToRunTimeSelectionTable(option, atmPlantCanopyUSource, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::atmPlantCanopyUSource::atmPlantCanopyUSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + rhoName_(coeffs_.getOrDefault("rho", "rho")), + plantCd_ + ( + IOobject + ( + "plantCd", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ), + leafAreaDensity_ + ( + IOobject + ( + "leafAreaDensity", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) +{ + fieldNames_.setSize(1, "U"); + + applied_.setSize(fieldNames_.size(), false); + + Log << " Applying atmPlantCanopyUSource to: " << fieldNames_[0] << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::atmPlantCanopyUSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + const volVectorField& U = eqn.psi(); + + if (V_ > VSMALL) + { + // (SP:Eq. 42) + eqn -= (plantCd_*leafAreaDensity_*mag(U))*U; + } +} + + +void Foam::fv::atmPlantCanopyUSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + const volVectorField& U = eqn.psi(); + + if (V_ > VSMALL) + { + eqn -= rho*(plantCd_*leafAreaDensity_*mag(U))*U; + } +} + + +void Foam::fv::atmPlantCanopyUSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + const volVectorField& U = eqn.psi(); + + if (V_ > VSMALL) + { + eqn -= alpha*rho*(plantCd_*leafAreaDensity_*mag(U))*U; + } +} + + +// ************************************************************************* // diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.H b/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.H new file mode 100644 index 0000000000..db247f1c44 --- /dev/null +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.H @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::atmPlantCanopyUSource + +Group + grpFvOptionsSources + +Description + Applies sources on velocity \c U to incorporate effects + of plant canopy for atmospheric boundary layer modelling. + + Corrections applied to: + \verbatim + U | Velocity [m/s] + \endverbatim + + Required fields: + \verbatim + U | Velocity [m/s] + plantCd | Plant canopy drag coefficient [-] + leafAreaDensity | Leaf area density [1/m] + \endverbatim + + References: + \verbatim + Influence of forest (tag:SP): + Sogachev, A., & Panferov, O. (2006). + Modification of two-equation models to account for plant drag. + Boundary-Layer Meteorology, 121(2), 229-266. + DOI:10.1007/s10546-006-9073-5 + \endverbatim + +Usage + Example by using \c constant/fvOptions: + \verbatim + atmPlantCanopyUSource1 + { + // Mandatory entries (unmodifiable) + type atmPlantCanopyUSource; + + atmPlantCanopyUSourceCoeffs + { + // Mandatory (inherited) entries (unmodifiable) + selectionMode all; + + // Optional entries (unmodifiable) + rho rho; + } + + // Optional (inherited) entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Req'd | Dflt + type | Type name: atmPlantCanopyUSource | word | yes | - + rho | Name of density field | word | no | rho + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link cellSetOption.H \endlink + +SourceFiles + atmPlantCanopyUSource.C + atmPlantCanopyUSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fv_atmPlantCanopyUSource_H +#define fv_atmPlantCanopyUSource_H + +#include "cellSetOption.H" +#include "fvMatrices.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class atmPlantCanopyUSource Declaration +\*---------------------------------------------------------------------------*/ + +class atmPlantCanopyUSource +: + public cellSetOption +{ + // Private Data + + //- Name of density field + const word rhoName_; + + + // Fields + + //- Plant canopy drag coefficient field [-] + volScalarField plantCd_; + + //- Leaf area density field [1/m] + volScalarField leafAreaDensity_; + + +public: + + //- Runtime type information + TypeName("atmPlantCanopyUSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + atmPlantCanopyUSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- No copy construct + atmPlantCanopyUSource(const atmPlantCanopyUSource&) = delete; + + //- No copy assignment + void operator=(const atmPlantCanopyUSource&) = delete; + + + // Member Functions + + //- Add explicit contribution to momentum equation + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Add explicit contribution to phase momentum equation + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + + //- Read source dictionary (effectively no-op) + virtual bool read(const dictionary& dict) + { + return true; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C index 41573a47fc..5a76d847bc 100644 --- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C +++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C @@ -5,7 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 ENERCON GmbH + Copyright (C) 2018-2020 OpenCFD Ltd ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,8 +27,6 @@ License \*---------------------------------------------------------------------------*/ #include "actuationDiskSource.H" -#include "fvMesh.H" -#include "fvMatrix.H" #include "geometricOneField.H" #include "addToRunTimeSelectionTable.H" @@ -38,43 +37,113 @@ namespace Foam namespace fv { defineTypeNameAndDebug(actuationDiskSource, 0); - addToRunTimeSelectionTable - ( - option, - actuationDiskSource, - dictionary - ); + addToRunTimeSelectionTable(option, actuationDiskSource, dictionary); } } -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +const Foam::Enum +< + Foam::fv::actuationDiskSource::forceMethodType +> +Foam::fv::actuationDiskSource::forceMethodTypeNames +({ + { forceMethodType::FROUDE, "Froude" }, + { forceMethodType::VARIABLE_SCALING, "variableScaling" }, +}); -void Foam::fv::actuationDiskSource::checkData() const + +const Foam::Enum +< + Foam::fv::actuationDiskSource::monitorMethodType +> +Foam::fv::actuationDiskSource::monitorMethodTypeNames +({ + { monitorMethodType::POINTS, "points" }, + { monitorMethodType::CELLSET, "cellSet" }, +}); + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::fv::actuationDiskSource::writeFileHeader(Ostream& os) { - if (magSqr(diskArea_) <= VSMALL) + writeFile::writeHeader(os, "Actuation disk source"); + writeFile::writeCommented(os, "Time"); + writeFile::writeCommented(os, "Uref"); + writeFile::writeCommented(os, "Cp"); + writeFile::writeCommented(os, "Ct"); + + if (forceMethod_ == forceMethodType::FROUDE) { - FatalErrorInFunction - << "diskArea is approximately zero" - << exit(FatalIOError); + writeFile::writeCommented(os, "a"); + writeFile::writeCommented(os, "T"); } - if (Cp_ <= VSMALL || Ct_ <= VSMALL) + else if (forceMethod_ == forceMethodType::VARIABLE_SCALING) { - FatalErrorInFunction - << "Cp and Ct must be greater than zero" - << exit(FatalIOError); + writeFile::writeCommented(os, "Udisk"); + writeFile::writeCommented(os, "CpStar"); + writeFile::writeCommented(os, "CtStar"); + writeFile::writeCommented(os, "T"); + writeFile::writeCommented(os, "P"); } - if (mag(diskDir_) < VSMALL) + + os << endl; +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::fv::actuationDiskSource::setMonitorCells(const dictionary& subDict) +{ + switch (monitorMethod_) { - FatalErrorInFunction - << "disk direction vector is approximately zero" - << exit(FatalIOError); - } - if (returnReduce(upstreamCellId_, maxOp