Documentation 6b54b78464
Loading...
Searching...
No Matches
heat_edge_flux.hpp
Go to the documentation of this file.
1/*!
2 * \file heat_edge_flux.hpp
3 * \brief Heat transport as a third-layer scalar flux, see numerics/scalar/scalar_edge_flux.hpp.
4 * \author P. Gomes
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
31
32/*!
33 * \class CScalarFlux_Heat
34 * \ingroup ViscDiscr
35 * \brief Convection and diffusion of temperature, non-conservative, with a diagonal
36 * (single-equation) diffusion coefficient.
37 * \note The temperature has no notion of density weighting, so Conservative is false and the
38 * inherited CUpwScalarFlux::finalizeFlux, flux(0) = a0*phi_i(0) + a1*phi_j(0), is exactly
39 * the model's whole convective term; no override is needed.
40 * \note The solver runs in two modes, weakly-coupled energy equation on a fluid zone or standalone
41 * conduction on a solid one (CHeatSolver::flow); the diffusion coefficient is the flow's
42 * thermal conductivity over specific heat, plus a turbulent contribution, in the former, and
43 * the configured constant thermal diffusivity in the latter. EdgeSide::flowNodes is null in
44 * the solid case, so this is the only place that may read it, and only when flow is set.
45 */
46template <class Double, class FlowIndices, int nDim, size_t nVar = 1>
48 : public CUpwScalarBase<Double, CScalarFlux_Heat<Double, FlowIndices, nDim, nVar>, FlowIndices, nDim, nVar> {
49 public:
50 static constexpr bool Conservative = false;
51 static constexpr bool DiagonalDiffusion = true;
52
54 using Int = typename Base::Int;
55
56 explicit CScalarFlux_Heat(const CConfig& config)
57 : Base(config),
58 flow(config.GetFluidProblem()),
59 prandtlTurb(config.GetPrandtl_Turb()),
60 constDiffusivity(config.GetThermalDiffusivity()) {}
61
62 /*!
63 * \brief Thermal diffusivity, an i/j average, identical for both edge sides (TSL Jacobian).
64 */
65 template <class VariableType>
67 const EdgeSide<VariableType>& side_i, Int jPoint,
68 const EdgeSide<VariableType>& side_j,
69 const CPair<Double>&) const {
71 if (flow) {
72 const Double k_i = gatherVariables(iPoint, side_i.flowNodes->GetPrimitive(), idx.ThermalConductivity());
73 const Double cp_i = gatherVariables(iPoint, side_i.flowNodes->GetPrimitive(), idx.CpTotal());
74 const Double muT_i = gatherVariables(iPoint, side_i.flowNodes->GetPrimitive(), idx.EddyViscosity());
75 const Double k_j = gatherVariables(jPoint, side_j.flowNodes->GetPrimitive(), idx.ThermalConductivity());
76 const Double cp_j = gatherVariables(jPoint, side_j.flowNodes->GetPrimitive(), idx.CpTotal());
77 const Double muT_j = gatherVariables(jPoint, side_j.flowNodes->GetPrimitive(), idx.EddyViscosity());
78 D(0) = 0.5 * (k_i / cp_i + muT_i / prandtlTurb + k_j / cp_j + muT_j / prandtlTurb);
79 } else {
80 D(0) = constDiffusivity;
81 }
82 return {D, D};
83 }
84
85 private:
86 const bool flow;
87 const su2double prandtlTurb;
88 const su2double constDiffusivity;
89};
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
su2double GetPrimitive(unsigned long iPoint, unsigned long iVar) const final
Get a primitive variable.
Definition CFlowVariable.hpp:95
Convection and diffusion of temperature, non-conservative, with a diagonal (single-equation) diffusio...
Definition heat_edge_flux.hpp:48
typename Base::Int Int
Definition heat_edge_flux.hpp:54
static constexpr bool DiagonalDiffusion
Definition heat_edge_flux.hpp:51
CScalarFlux_Heat(const CConfig &config)
Definition heat_edge_flux.hpp:56
static constexpr bool Conservative
Definition heat_edge_flux.hpp:50
CPair< Vector< Double, nVar > > coefficients(const FlowIndices &idx, Int iPoint, const EdgeSide< VariableType > &side_i, Int jPoint, const EdgeSide< VariableType > &side_j, const CPair< Double > &) const
Thermal diffusivity, an i/j average, identical for both edge sides (TSL Jacobian).
Definition heat_edge_flux.hpp:66
Upwind convection and diffusion of a transported scalar, accumulated into one residual,...
Definition scalar_edge_flux.hpp:316
typename CLaneTraits< Double_ >::Int Int
Definition scalar_edge_flux.hpp:319
Double_ Double
Definition scalar_edge_flux.hpp:318
const FlowIndices idx
Definition scalar_edge_flux.hpp:338
#define FORCEINLINE
Definition code_config.hpp:44
passivedouble su2double
Definition code_config.hpp:181
Double gatherVariables(Int iPoint, const Container &vars, size_t iVar=0)
Gather a single variable, from column iVar (0 by default) of row iPoint of a 2D container,...
Definition util.hpp:277
Model-agnostic convection and diffusion of a transported scalar, shared by every scalar solver (turbu...
Simple pair type for i/j variables.
Definition util.hpp:130
Locates the data of one endpoint of an edge.
Definition scalar_edge_flux.hpp:42
const CFlowVariable * flowNodes
Flow variables, null for solid heat transfer.
Definition scalar_edge_flux.hpp:44