Documentation 6b54b78464
Loading...
Searching...
No Matches
CPolynomialViscosity.hpp
Go to the documentation of this file.
1/*!
2 * \file CPolynomialViscosity.hpp
3 * \brief Defines a laminar viscosity model as a polynomial function of temperature.
4 * \author T. Economon
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include <array>
31
32#include "CViscosityModel.hpp"
33
34/*!
35 * \class CPolynomialViscosity
36 * \brief Defines laminar viscosity as a polynomial function of temperature.
37 * \author T. Economon
38 */
39template <int N>
41 public:
42 /*!
43 * \brief Constructor of the class.
44 */
45 CPolynomialViscosity(const su2double* val_coeffs) {
46 for (int i = 0; i < N; ++i) {
47 coeffs_[i] = val_coeffs[i];
48 }
49 }
50
51 /*!
52 * \brief Set Viscosity.
53 */
54 void SetViscosity(su2double t, su2double rho) override {
55 /* Evaluate the new mu from the coefficients and temperature. */
56 mu_ = coeffs_[0];
57 su2double t_i = 1.0;
58 for (int i = 1; i < N; ++i) {
59 t_i *= t;
60 mu_ += coeffs_[i] * t_i;
61 }
62 }
63
64 private:
65 array<su2double, N> coeffs_; /*!< \brief Polynomial coefficients for viscosity as a function of temperature. */
66};
Interface class for defining laminar viscosity models.
Defines laminar viscosity as a polynomial function of temperature.
Definition CPolynomialViscosity.hpp:40
void SetViscosity(su2double t, su2double rho) override
Set Viscosity.
Definition CPolynomialViscosity.hpp:54
CPolynomialViscosity(const su2double *val_coeffs)
Constructor of the class.
Definition CPolynomialViscosity.hpp:45
Interface class for defining the laminar viscosity model.
Definition CViscosityModel.hpp:39
su2double mu_
Dynamic viscosity.
Definition CViscosityModel.hpp:67
passivedouble su2double
Definition code_config.hpp:181