/home/runner/work/amr-wind/amr-wind/amr-wind/boundary_conditions/wall_models/LogLaw.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/boundary_conditions/wall_models/LogLaw.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
LogLaw.H
Go to the documentation of this file.
1#ifndef LogLaw_H
2#define LogLaw_H
3
4#include "AMReX_AmrCore.H"
5#include "AMReX.H"
6#include "AMReX_REAL.H"
7
8using namespace amrex::literals;
9namespace amr_wind {
10struct LogLaw
11{
12 /*
13 * A simple wall model that sets the wall-shear stress
14 * based on computing u_tau given the horizontal velocity
15 * magnitude at a zref. This is akin to an explicit non-linear
16 * Robin boundary condition at the wall.
17 */
18
19 // Log law constants from Lee & Moser 2015
20 // https://doi.org/10.1017/jfm.2015.268.
21 amrex::Real B{4.27_rt};
22 amrex::Real kappa{0.384_rt};
23 int max_iters = 25; // Max iterations for u_tau Newton-Raphson solve
24 // Reference height for log law
25 amrex::Real zref;
26 int ref_index{0};
27 amrex::Real nu; // molecular viscosity
28 // u_tau state variable, gets updated in update_utau depending on
29 // the type of wall model used
30 amrex::Real utau_mean{1.0_rt};
31 amrex::Real wspd_mean; // mean horizontal velocity magnitude
32
34
35 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real
36 get_utau(amrex::Real wspd) const
37 {
38 amrex::Real utau_iter = -1.0_rt;
39 amrex::Real wspd_pred;
40 amrex::Real wspd_deriv;
41 amrex::Real zplus;
42 amrex::Real utau = utau_mean;
43 int iter = 0;
44 while ((std::abs(utau_iter - utau) > 1.0e-5_rt) && iter <= max_iters) {
45 utau_iter = utau;
46 zplus = zref * utau / nu;
47 // Get wspd for a given utau from log-law
48 wspd_pred = utau * (std::log(zplus) / kappa + B);
49 wspd_deriv =
50 (1.0_rt + std::log(zplus)) / kappa + B; // d(wspd)/d(utau)
51 utau =
52 utau - (wspd_pred - wspd) / wspd_deriv; // Newton-Raphson update
53 ++iter;
54 }
55 if (iter == max_iters) {
56 amrex::Abort();
57 }
58 return utau;
59 }
60};
61} /* namespace amr_wind */
62
63#endif /* LogLaw_H */
This test case is intended as an evaluation of the momentum advection scheme.
Definition BCInterface.cpp:10
Definition LogLaw.H:11
amrex::Real kappa
Definition LogLaw.H:22
int max_iters
Definition LogLaw.H:23
amrex::Real wspd_mean
Definition LogLaw.H:31
amrex::Real B
Definition LogLaw.H:21
amrex::Real nu
Definition LogLaw.H:27
amrex::Real zref
Definition LogLaw.H:25
amrex::Real utau_mean
Definition LogLaw.H:30
int ref_index
Definition LogLaw.H:26
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real get_utau(amrex::Real wspd) const
Definition LogLaw.H:36
void update_utau_mean()
Definition LogLaw.H:33