Documentation 6b54b78464
Loading...
Searching...
No Matches
CScalarVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CScalarVariable.hpp
3 * \brief Base class for defining the shared variables of scalar solvers.
4 * \author F. Palacios, 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 "CVariable.hpp"
31
32/*!
33 * \class CScalarVariable
34 * \brief Base class for defining the shared variables of scalar solvers.
35 */
36class CScalarVariable : public CVariable {
37 protected:
38 MatrixType HB_Source; /*!< \brief Harmonic Balance source term. */
39
40 CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL
41 reconstruction for the convective term */
43 Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */
44
45 public:
46 /*!
47 * \brief Constructor of the class.
48 * \param[in] npoint - Number of points/nodes/vertices in the domain.
49 * \param[in] ndim - Number of dimensions of the problem.
50 * \param[in] nvar - Number of variables of the problem.
51 * \param[in] config - Definition of the particular problem.
52 */
53 CScalarVariable(unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig* config);
54
55 /*!
56 * \brief Get the array of the reconstruction variables gradient at a node.
57 * \param[in] iPoint - Index of the current node.
58 * \return Array of the reconstruction variables gradient at a node.
59 */
60 inline CMatrixView<su2double> GetGradient_Reconstruction(unsigned long iPoint) final {
61 return Gradient_Reconstruction[iPoint];
62 }
63
64 /*!
65 * \brief Get the reconstruction gradient for primitive variable at all points.
66 * \return Reference to variable reconstruction gradient.
67 */
70
71 /*!
72 * \brief Set the harmonic balance source term.
73 * \param[in] iPoint - Point index.
74 * \param[in] iVar - Index of the variable.
75 * \param[in] source - Value of the harmonic balance source term. for the index <i>iVar</i>.
76 */
77 inline void SetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar, su2double source) final {
78 HB_Source(iPoint, iVar) = source;
79 }
80
81 /*!
82 * \brief Get the harmonic balance source term.
83 * \param[in] iPoint - Point index.
84 * \param[in] iVar - Index of the variable.
85 * \return Value of the harmonic balance source term for the index <i>val_var</i>.
86 */
87 inline su2double GetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar) const final {
88 return HB_Source(iPoint, iVar);
89 }
90
91 /*!
92 * \brief Get the value of the mass diffusivity
93 * \param[in] iPoint - Point index.
94 * \param[in] val_ivar - eqn. index to the mass diffusivity.
95 * \return Value of the mass diffusivity
96 */
97 inline virtual su2double GetDiffusivity(unsigned long iPoint, unsigned short val_ivar) const { return 0.0; }
98};
Declaration and inlines of the parent class for defining problem variables, function definitions in f...
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Class to represent a matrix (without owning the data, this just wraps a pointer).
Definition container_decorators.hpp:40
Base class for defining the shared variables of scalar solvers.
Definition CScalarVariable.hpp:36
CMatrixView< su2double > GetGradient_Reconstruction(unsigned long iPoint) final
Get the array of the reconstruction variables gradient at a node.
Definition CScalarVariable.hpp:60
su2double GetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar) const final
Get the harmonic balance source term.
Definition CScalarVariable.hpp:87
CVectorOfMatrix & Gradient_Reconstruction
Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term...
Definition CScalarVariable.hpp:40
CVectorOfMatrix & GetGradient_Reconstruction() final
Get the reconstruction gradient for primitive variable at all points.
Definition CScalarVariable.hpp:68
const CVectorOfMatrix & GetGradient_Reconstruction() const final
Definition CScalarVariable.hpp:69
void SetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar, su2double source) final
Set the harmonic balance source term.
Definition CScalarVariable.hpp:77
MatrixType HB_Source
Harmonic Balance source term.
Definition CScalarVariable.hpp:38
CVectorOfMatrix Gradient_Aux
Auxiliary structure to store a second gradient for reconstruction, if required.
Definition CScalarVariable.hpp:43
virtual su2double GetDiffusivity(unsigned long iPoint, unsigned short val_ivar) const
Get the value of the mass diffusivity.
Definition CScalarVariable.hpp:97
Main class for defining the variables.
Definition CVariable.hpp:50
passivedouble su2double
Definition code_config.hpp:181