VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
wallModelMoninObukhov.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
30//=======================================================================================
31#ifndef WallModel_MoninObukhov_H_
32#define WallModel_MoninObukhov_H_
33
34#include <algorithm>
35#include <cmath>
36
37#include <basics/DataTypes.h>
41#include <lbm/constants/D3Q27.h>
42
43namespace vf::gpu {
44
45static constexpr real stabilityFactorMomentum = 4.8F;
46static constexpr real stabilityFactorTemperature = 7.8F;
47
49{
50 const real smoothed = filterFrequency * instantaneous + (vf::basics::constant::c1o1 - filterFrequency) * mean;
51 mean = smoothed;
52 return smoothed;
53}
54
56{
57 return quantity - normal * dot(quantity, normal);
58}
59
61{
62 return std::sqrt(square(vector));
63}
64
65inline __device__ real computeFrictionVelocity(const real velocity, const real vonKarmanConstant, const real samplingDistance,
66 const real roughnessLength, const real stabilityCorrection)
67{
68 return velocity * vonKarmanConstant / (std::log(samplingDistance / roughnessLength) - stabilityCorrection);
69}
70
72 const real vonKarmanConstant, const real samplingDistance, const real roughnessLength,
74{
75 return -temperatureDifference * frictionVelocity * vonKarmanConstant /
76 (std::log(samplingDistance / roughnessLength) - stabilityCorrection);
77}
78
79constexpr real3 computeWallShearStress(const real frictionVelocity, const real3 velocityTangential,
80 const real velocityTangentialMeanMagnitude, const real density)
81{
82 // Scale wall shear stress with near wall velocity, i.e., Schumann-Grötzbach
83 // (SG) approach
84 const real wallShearStress = frictionVelocity * frictionVelocity * density;
86}
87
88constexpr real computeStabilityParameter(const real height, const real gravity, const real surfaceHeatFlux,
89 const real frictionVelocity, const real referenceTemperature,
90 const real vonKarmanConstant)
91{
92 using namespace vf::basics::constant;
93 if (surfaceHeatFlux == c0o1)
94 return c0o1;
95 const real limit = c1o1;
96 const real numerator = -vonKarmanConstant * gravity * surfaceHeatFlux * height;
97 const real denominator = frictionVelocity * frictionVelocity * frictionVelocity * referenceTemperature;
98 return std::clamp(numerator / denominator, -limit, limit);
99}
100
101// Compute stability parameters according to <a
102// href="https://shop.elsevier.com/books/introduction-to-micrometeorology/holton/978-0-12-059354-5"><b>[p. 223, Arya 2001,
105{
106 using namespace vf::basics::constant;
107 if (stabilityParameter >= c0o1)
108 return -stabilityFactorTemperature * stabilityParameter;
109 return c2o1 * std::log(c1o2 * (c1o1 + std::sqrt(c1o1 - c15o1 * stabilityParameter)));
110}
112{
113 using namespace vf::basics::constant;
114 if (stabilityParameter >= c0o1)
115 return -stabilityFactorMomentum * stabilityParameter;
116 const real tmp = std::sqrt(std::sqrt(c1o1 - c15o1 * stabilityParameter));
117 return std::log(c1o2 * (c1o1 + tmp * tmp) * c1o2 * (c1o1 + tmp) * c1o2 * (c1o1 + tmp)) - c2o1 * std::atan(tmp) +
118 cPi * c1o2;
119}
120
121}
122
123#endif // WallModel_MoninObukhov_H_
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
constexpr real dot(const real3 &a, const real3 &b)
Definition DataTypes.h:97
constexpr real square(const real3 &a)
Definition DataTypes.h:102
#define __host__
#define __device__
__device__ real computeMagnitude(real3 vector)
constexpr real smoothAndSaveMean(real instantaneous, real filterFrequency, real &mean)
__device__ real computeFrictionVelocity(const real velocity, const real vonKarmanConstant, const real samplingDistance, const real roughnessLength, const real stabilityCorrection)
constexpr real3 computeTangentialVector(real3 quantity, real3 normal)
__device__ real computeSurfaceHeatFlux(const real temperatureDifference, const real frictionVelocity, const real vonKarmanConstant, const real samplingDistance, const real roughnessLength, const real stabilityCorrection)
__device__ __host__ real computeStabilityCorrectionTemperature(const real stabilityParameter)
ISBN:9780120593545 ]
__device__ real computeStabilityCorrectionMomentum(const real stabilityParameter)
constexpr real3 computeWallShearStress(const real frictionVelocity, const real3 velocityTangential, const real velocityTangentialMeanMagnitude, const real density)
constexpr real computeStabilityParameter(const real height, const real gravity, const real surfaceHeatFlux, const real frictionVelocity, const real referenceTemperature, const real vonKarmanConstant)