-
Notifications
You must be signed in to change notification settings - Fork 919
[WIP] Stochastic Backscatter Model for Grey Area Mitigation in Hybrid RANS-LES Simulations #2572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
AngPass
wants to merge
51
commits into
su2code:develop
Choose a base branch
from
AngPass:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,611
−51
Draft
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
36b6f7a
Preliminary implementation: uncorrelated stochastic variables
AngPass d6d6e39
Merge branch 'su2code:develop' into develop
AngPass cfa0cd8
Add solution of Langevin equations
AngPass fd800d3
Merge branch 'develop' into develop
AngPass 34f676f
Fix sanitizer warnings and regression failures
AngPass 66293fd
Minor fixes
AngPass 4a11c8b
Merge branch 'develop' into develop
AngPass 3481df3
Ensure consistency with DES
AngPass 26bcfda
Merge branch 'develop' into develop
AngPass 85b8aac
Boundary conditions for Langevin equations
AngPass 6293042
Use symmetry-preserving scheme for Langevin equations
AngPass b03f630
Merge branch 'develop' into develop
AngPass 1e8e4e1
Add option for simulating DIHT
AngPass 67c133c
Fix options for DIHT
AngPass 25a32f7
Merge branch 'develop' into develop
AngPass 9657bfb
Consistent estimation of turb. kinetic energy (for SA)
AngPass e1181d3
Merge branch 'develop' into develop
AngPass 968d8f9
Add Laplacian smoothing (Langevin equations)
AngPass 2f8245e
Fix redundancy in CTurbSAVariable.hpp
AngPass bdbfa05
Add stochastic source to turbulence model equation
AngPass 7457d95
Merge branch 'develop' into develop
AngPass 3272a1b
SOR algorithm for Laplacian smoothing
AngPass ddb99bf
Merge branch 'su2code:develop' into develop
AngPass 15dbff3
Correct scaling of stochastic source terms in Langevin eqs.
AngPass 4dd0f90
Merge branch 'su2code:develop' into develop
AngPass d93ed49
Merge branch 'su2code:develop' into develop
AngPass 420e44a
Add LD2 scheme for the incompressible solver
AngPass 02dbb54
Merge branch 'develop' of https://github.com/AngPass/SU2 into develop
AngPass 2f654c6
Merge branch 'develop' into develop
AngPass 65e531e
Merge branch 'develop' into develop
AngPass 5c3e35c
Fix LD2 for periodic boundaries
AngPass 71dca9c
Merge branch 'develop' into develop
AngPass 6389023
Include stochastic source term in turb. equation
AngPass d382a2d
Minor fixes
d1a1ae8
Add time-averaged skin friction coefficient
babfb58
Minor fix
AngPass 562f311
Minor fix
AngPass 14323bb
Merge branch 'develop' into develop
AngPass 92a016b
Merge branch 'develop' into develop
AngPass 90ede00
Add fields to VOLUME_OUTPUT
a5b3aa0
Fix LD2 option in config file
ebb6806
Merge branch 'develop' into develop
AngPass 3e44cd6
Merge branch 'develop' into develop
AngPass 3530ea8
Merge branch 'develop' into develop
AngPass 0df34ac
Enhance numerical robustness
343ed9b
Merge branch 'develop' into develop
AngPass f539511
Merge branch 'develop' into develop
AngPass 443838f
Enhance numerical efficiency
86ba8d8
Merge branch 'develop' into develop
AngPass fb3f8ec
Fix bug in viscous flux computation
241fbcb
Merge branch 'develop' into develop
AngPass File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| /*! | ||
| * \file random_toolbox.hpp | ||
| * \brief Collection of utility functions for random number generation. | ||
| * \version 8.3.0 "Harrier" | ||
| * | ||
| * SU2 Project Website: https://su2code.github.io | ||
| * | ||
| * The SU2 Project is maintained by the SU2 Foundation | ||
| * (http://su2foundation.org) | ||
| * | ||
| * Copyright 2012-2025, SU2 Contributors (cf. AUTHORS.md) | ||
| * | ||
| * SU2 is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public | ||
| * License as published by the Free Software Foundation; either | ||
| * version 2.1 of the License, or (at your option) any later version. | ||
| * | ||
| * SU2 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 | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with SU2. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <random> | ||
| #include <functional> | ||
|
|
||
| namespace RandomToolbox { | ||
| /// \addtogroup RandomToolbox | ||
| /// @{ | ||
|
|
||
| /*! | ||
| * \brief Combine two 64-bit integers into a single hash value. | ||
| * \param[in] v1 Current hash value. | ||
| * \param[in] v2 Value to mix in. | ||
| * \return Combined hash value. | ||
| */ | ||
| inline unsigned long HashCombine(unsigned long v1, unsigned long v2) { | ||
| const unsigned long prime = 1099511628211ULL; | ||
| v1 ^= v2; | ||
| v1 *= prime; | ||
| return v1; | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Convert a double to a 64-bit integer suitable for hashing. | ||
| * \param[in] x Double to integer. | ||
| * \return Hash value of the double (not portable). | ||
| */ | ||
| inline unsigned long ToUInt64(double x) { return std::hash<double>{}(x); } | ||
|
|
||
| /*! | ||
| * \brief Build a deterministic seed from physical time. | ||
| * \param[in] x First integer value. | ||
| * \param[in] y Second integer value. | ||
| * \param[in] z Third integer value. | ||
| * \return 64-bit seed value. | ||
| */ | ||
| inline unsigned long GetSeed(unsigned long x, unsigned long y, unsigned long z) { | ||
| return HashCombine(HashCombine(x, y), z); | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Generate a standard normally-distributed random number. | ||
| * \param[in] gen Pseudo-random number generator. | ||
| * \param[in] mean Mean of the normal distribution (default 0). | ||
| * \param[in] stddev Standard deviation of the normal distribution (default 1). | ||
| * \return Normally-distributed random number. | ||
| */ | ||
| inline double GetRandomNormal(std::mt19937& gen, double mean = 0.0, double stddev = 1.0) { | ||
| std::normal_distribution<double> rnd(mean, stddev); | ||
| return rnd(gen); | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Generate a uniformly-distributed random number. | ||
| * \param[in] gen Pseudo-random number generator. | ||
| * \param[in] xmin Lower boundary of the interval (default 0). | ||
| * \param[in] xmax Upper bounary of the interval (default 1). | ||
| * \return Uniformly-distributed random number. | ||
| */ | ||
| inline double GetRandomUniform(std::mt19937& gen, double xmin = 0.0, double xmax = 1.0) { | ||
| std::uniform_real_distribution<double> rnd(xmin, xmax); | ||
| return rnd(gen); | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Compute modified bessel function of first kind (order 0). | ||
| * \param[in] x Argument of Bessel funtion. | ||
| * \return Value of Bessel function. | ||
| */ | ||
| inline double GetBesselZero(double x) { | ||
| double abx = fabs(x); | ||
|
|
||
| if (abx < 3.75) { | ||
| double t = x / 3.75; | ||
| double p = | ||
| 1.0 + | ||
| t * t * | ||
| (3.5156229 + | ||
| t * t * (3.0899424 + t * t * (1.2067492 + t * t * (0.2659732 + t * t * (0.0360768 + t * t * 0.0045813))))); | ||
| return log(p); | ||
| } else { | ||
| double t = 3.75 / abx; | ||
| double poly = | ||
| 0.39894228 + | ||
| t * (0.01328592 + | ||
| t * (0.00225319 + | ||
| t * (-0.00157565 + | ||
| t * (0.00916281 + t * (-0.02057706 + t * (0.02635537 + t * (-0.01647633 + t * 0.00392377))))))); | ||
| return abx - 0.5 * log(abx) + log(poly); | ||
| } | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Compute integral involving product of three modified Bessel functions. | ||
| * \param[in] beta_x Argument in x-direction. | ||
| * \param[in] beta_y Argument in y-direction. | ||
| * \param[in] beta_z Argument in z-direction. | ||
| * \return Value of the integral. | ||
| */ | ||
| inline double GetBesselIntegral(double beta_x, double beta_y, double beta_z) { | ||
| const double A = 1.0 + 2.0 * (beta_x + beta_y + beta_z); | ||
| const double Bx = 2.0 * beta_x; | ||
| const double By = 2.0 * beta_y; | ||
| const double Bz = 2.0 * beta_z; | ||
|
|
||
| const int N = 4000; | ||
| const double t_max = 40.0; | ||
| const double dt = t_max / N; | ||
|
|
||
| double sum = 0.0; | ||
|
|
||
| for (int i = 1; i < N; i++) { | ||
| double t = i * dt; | ||
|
|
||
| double lx = GetBesselZero(Bx * t); | ||
| double ly = GetBesselZero(By * t); | ||
| double lz = GetBesselZero(Bz * t); | ||
|
|
||
| double lin = log(t) - A * t + lx + ly + lz; | ||
|
|
||
| double integrand = exp(lin); | ||
| sum += integrand; | ||
| } | ||
|
|
||
| return sum * dt; | ||
| } | ||
|
|
||
| /// @} | ||
| } // namespace RandomToolbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this part of CONV_NUM_METHOD enum, ok to still re-use JST in the code, but the option to use the scheme should be consistent with all other schemes.