/home/runner/work/amr-wind/amr-wind/amr-wind/turbulence/LES/AMDNoTherm.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/turbulence/LES/AMDNoTherm.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
AMDNoTherm.H
Go to the documentation of this file.
1#ifndef AMDNOTHERM_H
2#define AMDNOTHERM_H
3
4#include <AMReX_Config.H>
5#include <AMReX_AmrCore.H>
6#include <string>
11
12namespace amr_wind::turbulence {
16template <typename Transport>
17class AMDNoTherm : public TurbModelBase<Transport>
18{
19public:
20 static std::string identifier()
21 {
22 return "AMDNoTherm-" + Transport::identifier();
23 }
24
25 explicit AMDNoTherm(CFDSim& sim);
26
28 std::string model_name() const override { return "AMDNoTherm"; }
29
32 const FieldState fstate, const DiffusionType /*unused*/) override;
33
36
38 void parse_model_coeffs() override;
39
41 void post_advance_work() override {};
42
43private:
46 amrex::Real m_C{0.333333333333333};
47 const Field& m_vel;
48 const Field& m_rho;
49};
50
51AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real amd_base_muvel(
52 int i,
53 int j,
54 int k,
55 const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dx, // Grid spacing
56 amrex::Real C, // Poincare const
57 amrex::Array4<amrex::Real const> const& gradVel) noexcept
58{
59
60 amrex::Real num_shear = 0;
61 amrex::Real denom = 0;
62 for (int ii = 0; ii < AMREX_SPACEDIM; ++ii) {
63 for (int jj = 0; jj < AMREX_SPACEDIM; ++jj) {
64 denom = denom + gradVel(i, j, k, ii * AMREX_SPACEDIM + jj) *
65 gradVel(i, j, k, ii * AMREX_SPACEDIM + jj);
66 amrex::Real sij =
67 0.5 * (gradVel(i, j, k, ii * AMREX_SPACEDIM + jj) +
68 gradVel(i, j, k, jj * AMREX_SPACEDIM + ii));
69 for (int kk = 0; kk < AMREX_SPACEDIM; ++kk) {
70 amrex::Real dkui = gradVel(i, j, k, ii * AMREX_SPACEDIM + kk);
71 amrex::Real dkuj = gradVel(i, j, k, jj * AMREX_SPACEDIM + kk);
72 num_shear = num_shear + dkui * dkuj * dx[kk] * dx[kk] * sij;
73 }
74 }
75 }
76 denom = std::max(1e-15, denom);
77 num_shear = -C * num_shear;
78
79 return std::max(1e-15, num_shear / denom);
80}
81
82} // namespace amr_wind::turbulence
83
84#endif /* AMDNoTherm_H */
Definition CFDSim.H:47
Definition Field.H:116
Definition AMDNoTherm.H:18
const Field & m_rho
Definition AMDNoTherm.H:48
void parse_model_coeffs() override
Parse turbulence model coefficients for this model.
Definition AMDNoTherm.cpp:24
TurbulenceModel::CoeffsDictType model_coeffs() const override
Return model coefficients dictionary.
Definition AMDNoTherm.cpp:72
amrex::Real m_C
Definition AMDNoTherm.H:46
void update_turbulent_viscosity(const FieldState fstate, const DiffusionType) override
Update the turbulent viscosity field.
Definition AMDNoTherm.cpp:32
void post_advance_work() override
No post advance work for this model.
Definition AMDNoTherm.H:41
std::string model_name() const override
Model name for debugging purposes.
Definition AMDNoTherm.H:28
const Field & m_vel
Definition AMDNoTherm.H:47
AMDNoTherm(CFDSim &sim)
Definition AMDNoTherm.cpp:17
static std::string identifier()
Definition AMDNoTherm.H:20
Definition TurbModelBase.H:96
std::unordered_map< std::string, amrex::Real > CoeffsDictType
Default identifier used by factor methods.
Definition TurbulenceModel.H:35
FieldState
Definition FieldDescTypes.H:14
DiffusionType
Definition incflo_enums.H:4
Definition CFDSim.H:23
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real amd_base_muvel(int i, int j, int k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > dx, amrex::Real C, amrex::Array4< amrex::Real const > const &gradVel) noexcept
Definition AMDNoTherm.H:51
Second-order finite volume discretization stencil coefficients.