From ceef25e54fef841d4add4365cb6978ede730ed33 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 29 Jun 2019 10:04:03 +0100 Subject: [PATCH 1/6] remove old unused variable classes --- SU2_CFD/include/variable_structure.hpp | 88 -------------------------- SU2_CFD/include/variable_structure.inl | 8 --- 2 files changed, 96 deletions(-) diff --git a/SU2_CFD/include/variable_structure.hpp b/SU2_CFD/include/variable_structure.hpp index 84cea6d6c865..4f3f7e5dd310 100644 --- a/SU2_CFD/include/variable_structure.hpp +++ b/SU2_CFD/include/variable_structure.hpp @@ -2410,94 +2410,6 @@ class CBaselineVariable : public CVariable { }; -/*! - * \class CPotentialVariable - * \brief Main class for defining the variables of the potential solver. - * \ingroup Potential_Flow_Equation - * \author F. Palacios - */ -class CPotentialVariable : public CVariable { - su2double *Charge_Density; -public: - - /*! - * \brief Constructor of the class. - */ - CPotentialVariable(void); - - /*! - * \overload - * \param[in] val_potential - Value of the potential solution (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CPotentialVariable(su2double val_potential, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CPotentialVariable(void); - - /*! - * \brief A virtual member. - */ - su2double* GetChargeDensity(); - - /*! - * \brief A virtual member. - * \param[in] positive_charge - Mass density of positive charge. - * \param[in] negative_charge - Mass density of negative charge. - */ - void SetChargeDensity(su2double positive_charge, su2double negative_charge); - -}; - -/*! - * \class CWaveVariable - * \brief Main class for defining the variables of the wave equation solver. - * \ingroup Potential_Flow_Equation - * \author F. Palacios - */ -class CWaveVariable : public CVariable { -protected: - su2double *Solution_Direct; /*!< \brief Direct solution container for use in the adjoint wave solver. */ - -public: - - /*! - * \brief Constructor of the class. - */ - CWaveVariable(void); - - /*! - * \overload - * \param[in] val_wave - Values of the wave solution (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CWaveVariable(su2double *val_wave, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CWaveVariable(void); - - /*! - * \brief Set the direct solution for the adjoint solver. - * \param[in] val_solution_direct - Value of the direct solution. - */ - void SetSolution_Direct(su2double *val_solution_direct); - - /*! - * \brief Get the direct solution for the adjoint solver. - * \return Pointer to the direct solution vector. - */ - su2double *GetSolution_Direct(void); - -}; - /*! * \class CHeatFVMVariable * \brief Main class for defining the variables of the finite-volume heat equation solver. diff --git a/SU2_CFD/include/variable_structure.inl b/SU2_CFD/include/variable_structure.inl index 4d4460932aa8..f6b03baf2500 100644 --- a/SU2_CFD/include/variable_structure.inl +++ b/SU2_CFD/include/variable_structure.inl @@ -1250,14 +1250,6 @@ inline su2double *CFEAVariable::GetPrestretch(void) { return Prestretch; } inline su2double CFEAVariable::GetPrestretch(unsigned short iVar) { return Prestretch[iVar]; } -inline su2double* CWaveVariable::GetSolution_Direct() { return Solution_Direct;} - -inline void CWaveVariable::SetSolution_Direct(su2double *val_solution_direct) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Direct[iVar] += val_solution_direct[iVar];} - -inline su2double* CPotentialVariable::GetChargeDensity() { return Charge_Density;} - -inline void CPotentialVariable::SetChargeDensity(su2double positive_charge, su2double negative_charge) {Charge_Density[0] = positive_charge; Charge_Density[1] = negative_charge;} - inline void CTurbSAVariable::SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) { HB_Source[val_var] = val_source; } inline su2double CTurbSAVariable::GetHarmonicBalance_Source(unsigned short val_var) { return HB_Source[val_var]; } From cba1da1429980a81880f2708868064942022a5cf Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 29 Jun 2019 22:44:40 +0100 Subject: [PATCH 2/6] restructured CVariable into separate files --- SU2_CFD/include/numerics_structure.hpp | 47 +- SU2_CFD/include/solver_structure.hpp | 2 +- SU2_CFD/include/variable_structure.hpp | 4951 ----------------- SU2_CFD/include/variable_structure.inl | 1608 ------ .../include/variables/CAdjEulerVariable.hpp | 150 + SU2_CFD/include/variables/CAdjNSVariable.hpp | 111 + .../include/variables/CAdjTurbVariable.hpp | 91 + .../include/variables/CBaselineVariable.hpp | 68 + .../include/variables/CDiscAdjFEAVariable.hpp | 303 + .../include/variables/CDiscAdjVariable.hpp | 250 + SU2_CFD/include/variables/CEulerVariable.hpp | 532 ++ .../include/variables/CFEABoundVariable.hpp | 158 + SU2_CFD/include/variables/CFEAVariable.hpp | 533 ++ .../include/variables/CHeatFVMVariable.hpp | 74 + .../include/variables/CIncEulerVariable.hpp | 332 ++ SU2_CFD/include/variables/CIncNSVariable.hpp | 161 + SU2_CFD/include/variables/CNSVariable.hpp | 256 + .../include/variables/CTransLMVariable.hpp | 91 + SU2_CFD/include/variables/CTurbSAVariable.hpp | 125 + .../include/variables/CTurbSSTVariable.hpp | 103 + SU2_CFD/include/variables/CTurbVariable.hpp | 84 + SU2_CFD/include/variables/CVariable.hpp | 2413 ++++++++ SU2_CFD/obj/Makefile.am | 50 +- SU2_CFD/src/solver_adjoint_discrete.cpp | 1 + SU2_CFD/src/solver_adjoint_elasticity.cpp | 1 + SU2_CFD/src/solver_adjoint_mean.cpp | 2 + SU2_CFD/src/solver_adjoint_turbulent.cpp | 1 + SU2_CFD/src/solver_direct_elasticity.cpp | 2 + SU2_CFD/src/solver_direct_heat.cpp | 1 + SU2_CFD/src/solver_direct_mean.cpp | 2 + SU2_CFD/src/solver_direct_mean_inc.cpp | 2 + SU2_CFD/src/solver_direct_transition.cpp | 2 + SU2_CFD/src/solver_direct_turbulent.cpp | 2 + SU2_CFD/src/solver_structure.cpp | 1 + .../CAdjEulerVariable.cpp} | 29 +- SU2_CFD/src/variables/CAdjNSVariable.cpp | 52 + .../CAdjTurbVariable.cpp} | 6 +- .../CBaselineVariable.cpp} | 19 +- .../CDiscAdjFEAVariable.cpp} | 18 +- .../CDiscAdjVariable.cpp} | 8 +- .../CEulerVariable.cpp} | 282 +- SU2_CFD/src/variables/CFEABoundVariable.cpp | 99 + .../CFEAVariable.cpp} | 66 +- .../CHeatFVMVariable.cpp} | 8 +- .../CIncEulerVariable.cpp} | 167 +- SU2_CFD/src/variables/CIncNSVariable.cpp | 187 + SU2_CFD/src/variables/CNSVariable.cpp | 317 ++ .../CTransLMVariable.cpp} | 17 +- .../CTurbSAVariable.cpp} | 128 +- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 115 + SU2_CFD/src/variables/CTurbVariable.cpp | 81 + .../CVariable.cpp} | 15 +- SU2_DEF/obj/Makefile.am | 25 +- SU2_DOT/obj/Makefile.am | 18 +- SU2_SOL/obj/Makefile.am | 9 +- 55 files changed, 6837 insertions(+), 7339 deletions(-) delete mode 100644 SU2_CFD/include/variable_structure.hpp delete mode 100644 SU2_CFD/include/variable_structure.inl create mode 100644 SU2_CFD/include/variables/CAdjEulerVariable.hpp create mode 100644 SU2_CFD/include/variables/CAdjNSVariable.hpp create mode 100644 SU2_CFD/include/variables/CAdjTurbVariable.hpp create mode 100644 SU2_CFD/include/variables/CBaselineVariable.hpp create mode 100644 SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp create mode 100644 SU2_CFD/include/variables/CDiscAdjVariable.hpp create mode 100644 SU2_CFD/include/variables/CEulerVariable.hpp create mode 100644 SU2_CFD/include/variables/CFEABoundVariable.hpp create mode 100644 SU2_CFD/include/variables/CFEAVariable.hpp create mode 100644 SU2_CFD/include/variables/CHeatFVMVariable.hpp create mode 100644 SU2_CFD/include/variables/CIncEulerVariable.hpp create mode 100644 SU2_CFD/include/variables/CIncNSVariable.hpp create mode 100644 SU2_CFD/include/variables/CNSVariable.hpp create mode 100644 SU2_CFD/include/variables/CTransLMVariable.hpp create mode 100644 SU2_CFD/include/variables/CTurbSAVariable.hpp create mode 100644 SU2_CFD/include/variables/CTurbSSTVariable.hpp create mode 100644 SU2_CFD/include/variables/CTurbVariable.hpp create mode 100644 SU2_CFD/include/variables/CVariable.hpp rename SU2_CFD/src/{variable_adjoint_mean.cpp => variables/CAdjEulerVariable.cpp} (89%) create mode 100644 SU2_CFD/src/variables/CAdjNSVariable.cpp rename SU2_CFD/src/{variable_adjoint_turbulent.cpp => variables/CAdjTurbVariable.cpp} (93%) rename SU2_CFD/src/{variable_template.cpp => variables/CBaselineVariable.cpp} (77%) rename SU2_CFD/src/{variable_adjoint_elasticity.cpp => variables/CDiscAdjFEAVariable.cpp} (93%) rename SU2_CFD/src/{variable_adjoint_discrete.cpp => variables/CDiscAdjVariable.cpp} (95%) rename SU2_CFD/src/{variable_direct_mean.cpp => variables/CEulerVariable.cpp} (67%) create mode 100644 SU2_CFD/src/variables/CFEABoundVariable.cpp rename SU2_CFD/src/{variable_direct_elasticity.cpp => variables/CFEAVariable.cpp} (75%) rename SU2_CFD/src/{variable_direct_heat.cpp => variables/CHeatFVMVariable.cpp} (93%) rename SU2_CFD/src/{variable_direct_mean_inc.cpp => variables/CIncEulerVariable.cpp} (73%) create mode 100644 SU2_CFD/src/variables/CIncNSVariable.cpp create mode 100644 SU2_CFD/src/variables/CNSVariable.cpp rename SU2_CFD/src/{variable_direct_transition.cpp => variables/CTransLMVariable.cpp} (83%) rename SU2_CFD/src/{variable_direct_turbulent.cpp => variables/CTurbSAVariable.cpp} (56%) create mode 100644 SU2_CFD/src/variables/CTurbSSTVariable.cpp create mode 100644 SU2_CFD/src/variables/CTurbVariable.cpp rename SU2_CFD/src/{variable_structure.cpp => variables/CVariable.cpp} (96%) diff --git a/SU2_CFD/include/numerics_structure.hpp b/SU2_CFD/include/numerics_structure.hpp index 214a23dee93e..f793517fd30d 100644 --- a/SU2_CFD/include/numerics_structure.hpp +++ b/SU2_CFD/include/numerics_structure.hpp @@ -50,7 +50,7 @@ #include "../../Common/include/config_structure.hpp" #include "../../Common/include/gauss_structure.hpp" #include "../../Common/include/element_structure.hpp" -#include "variable_structure.hpp" +#include "fluid_model.hpp" using namespace std; @@ -960,28 +960,29 @@ class CNumerics { */ void GetLMatrix(su2double val_soundspeed, su2double val_density, su2double **L_Matrix); - /*! - * \brief Computation of the flow Residual Jacoboan Matrix for Non Reflecting BC. - * \param[in] val_soundspeed - value of the sound speed. - * \param[in] val_density - value of the density. - * \param[out] R_c - Residual Jacoboan Matrix - * \param[out] R_c_inv- inverse of the Residual Jacoboan Matrix . - */ - void ComputeResJacobianGiles(CFluidModel *FluidModel, su2double pressure, su2double density, su2double *turboVel, su2double alphaInBC, su2double gammaInBC, su2double **R_c, su2double **R_c_inv); - - /*! - * \brief Computate the inverse of a 3x3 matrix - * \param[in] matrix - the matrix to invert - * \param[out] invMatrix - inverse matrix. - */ - void InvMatrix3D(su2double **matrix, su2double **invMatrix); - - /*! - * \brief Computate the inverse of a 4x4 matrix - * \param[in] matrix - the matrix to invert - * \param[out] invMatrix - inverse matrix. - */ - void InvMatrix4D(su2double **matrix, su2double **invMatrix); + /*! + * \brief Computation of the flow Residual Jacoboan Matrix for Non Reflecting BC. + * \param[in] val_soundspeed - value of the sound speed. + * \param[in] val_density - value of the density. + * \param[out] R_c - Residual Jacoboan Matrix + * \param[out] R_c_inv- inverse of the Residual Jacoboan Matrix . + */ + void ComputeResJacobianGiles(CFluidModel *FluidModel, su2double pressure, su2double density, su2double *turboVel, + su2double alphaInBC, su2double gammaInBC, su2double **R_c, su2double **R_c_inv); + + /*! + * \brief Computate the inverse of a 3x3 matrix + * \param[in] matrix - the matrix to invert + * \param[out] invMatrix - inverse matrix. + */ + void InvMatrix3D(su2double **matrix, su2double **invMatrix); + + /*! + * \brief Computate the inverse of a 4x4 matrix + * \param[in] matrix - the matrix to invert + * \param[out] invMatrix - inverse matrix. + */ + void InvMatrix4D(su2double **matrix, su2double **invMatrix); /*! * \brief Computation of the matrix R. diff --git a/SU2_CFD/include/solver_structure.hpp b/SU2_CFD/include/solver_structure.hpp index ccfe9ff8c59c..f3db4b646879 100644 --- a/SU2_CFD/include/solver_structure.hpp +++ b/SU2_CFD/include/solver_structure.hpp @@ -56,7 +56,7 @@ #include "task_definition.hpp" #include "numerics_structure.hpp" #include "sgs_model.hpp" -#include "variable_structure.hpp" +#include "variables/CVariable.hpp" #include "../../Common/include/gauss_structure.hpp" #include "../../Common/include/element_structure.hpp" #include "../../Common/include/fem_geometry_structure.hpp" diff --git a/SU2_CFD/include/variable_structure.hpp b/SU2_CFD/include/variable_structure.hpp deleted file mode 100644 index 4f3f7e5dd310..000000000000 --- a/SU2_CFD/include/variable_structure.hpp +++ /dev/null @@ -1,4951 +0,0 @@ -/*! - * \file variable_structure.hpp - * \brief Headers of the main subroutines for storing all the variables for - * each kind of governing equation (direct, adjoint and linearized). - * The subroutines and functions are in the variable_structure.cpp file. - * \author F. Palacios, T. Economon - * \version 6.2.0 "Falcon" - * - * The current SU2 release has been coordinated by the - * SU2 International Developers Society - * with selected contributions from the open-source community. - * - * The main research teams contributing to the current release are: - * - Prof. Juan J. Alonso's group at Stanford University. - * - Prof. Piero Colonna's group at Delft University of Technology. - * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. - * - Prof. Alberto Guardone's group at Polytechnic University of Milan. - * - Prof. Rafael Palacios' group at Imperial College London. - * - Prof. Vincent Terrapon's group at the University of Liege. - * - Prof. Edwin van der Weide's group at the University of Twente. - * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. - * - * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, - * Tim Albring, and the SU2 contributors. - * - * SU2 is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * SU2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with SU2. If not, see . - */ - -#pragma once - -#include "../../Common/include/mpi_structure.hpp" - -#include -#include -#include - -#include "../../Common/include/config_structure.hpp" -#include "fluid_model.hpp" - - -using namespace std; - -/*! - * \class CVariable - * \brief Main class for defining the variables. - * \author F. Palacios - */ -class CVariable { -protected: - - su2double *Solution, /*!< \brief Solution of the problem. */ - *Solution_Old; /*!< \brief Old solution of the problem R-K. */ - bool Non_Physical; /*!< \brief Non-physical points in the solution (force first order). */ - su2double *Solution_time_n, /*!< \brief Solution of the problem at time n for dual-time stepping technique. */ - *Solution_time_n1; /*!< \brief Solution of the problem at time n-1 for dual-time stepping technique. */ - su2double **Gradient; /*!< \brief Gradient of the solution of the problem. */ - su2double **Rmatrix; /*!< \brief Geometry-based matrix for weighted least squares gradient calculations. */ - su2double *Limiter; /*!< \brief Limiter of the solution of the problem. */ - su2double *Solution_Max; /*!< \brief Max solution for limiter computation. */ - su2double *Solution_Min; /*!< \brief Min solution for limiter computation. */ - su2double AuxVar; /*!< \brief Auxiliar variable for gradient computation. */ - su2double *Grad_AuxVar; /*!< \brief Gradient of the auxiliar variable. */ - su2double Delta_Time; /*!< \brief Time step. */ - su2double Max_Lambda, /*!< \brief Maximun eingenvalue. */ - Max_Lambda_Inv, /*!< \brief Maximun inviscid eingenvalue. */ - Max_Lambda_Visc, /*!< \brief Maximun viscous eingenvalue. */ - Lambda; /*!< \brief Value of the eingenvalue. */ - su2double Sensor; /*!< \brief Pressure sensor for high order central scheme and Roe dissipation. */ - su2double *Undivided_Laplacian; /*!< \brief Undivided laplacian of the solution. */ - su2double *Res_TruncError, /*!< \brief Truncation error for multigrid cycle. */ - *Residual_Old, /*!< \brief Auxiliar structure for residual smoothing. */ - *Residual_Sum; /*!< \brief Auxiliar structure for residual smoothing. */ - static unsigned short nDim; /*!< \brief Number of dimension of the problem. */ - unsigned short nVar; /*!< \brief Number of variables of the problem, - note that this variable cannnot be static, it is possible to - have different number of nVar in the same problem. */ - unsigned short nPrimVar, nPrimVarGrad; /*!< \brief Number of variables of the problem, - note that this variable cannnot be static, it is possible to - have different number of nVar in the same problem. */ - unsigned short nSecondaryVar, nSecondaryVarGrad; /*!< \brief Number of variables of the problem, - note that this variable cannnot be static, it is possible to - have different number of nVar in the same problem. */ - su2double *Solution_Adj_Old; /*!< \brief Solution of the problem in the previous AD-BGS iteration. */ - -public: - - /*! - * \brief Constructor of the class. - */ - CVariable(void); - - /*! - * \overload - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CVariable(unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - virtual ~CVariable(void); - - /*! - * \brief Set the value of the solution. - * \param[in] val_solution - Solution of the problem. - */ - void SetSolution(su2double *val_solution); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the solution for the index val_var. - */ - void SetSolution(unsigned short val_var, su2double val_solution); - - /*! - * \brief Add the value of the solution vector to the previous solution (incremental approach). - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the solution for the index val_var. - */ - void Add_DeltaSolution(unsigned short val_var, su2double val_solution); - - /*! - * \brief Set the value of the non-physical point. - * \param[in] val_value - identification of the non-physical point. - */ - void SetNon_Physical(bool val_value); - - /*! - * \brief Get the value of the non-physical point. - * \return Value of the Non-physical point. - */ - su2double GetNon_Physical(void); - - /*! - * \brief Get the solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetSolution(unsigned short val_var); - - /*! - * \brief Get the old solution of the problem (Runge-Kutta method) - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Old(unsigned short val_var); - - /*! - * \brief Get the old solution of the discrete adjoint problem (for multiphysics subiterations= - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Old_Adj(unsigned short val_var); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_Old(su2double *val_solution_old); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_old - Value of the old solution for the index val_var. - */ - void SetSolution_Old(unsigned short val_var, su2double val_solution_old); - - /*! - * \brief Set old variables to the value of the current variables. - */ - void Set_OldSolution(void); - - /*! - * \brief Set variables to the value of the old variables. - */ - void Set_Solution(void); - - /*! - * \brief Set old discrete adjoint variables to the current value of the adjoint variables. - */ - void Set_OldSolution_Adj(void); - - /*! - * \brief Set the variable solution at time n. - */ - void Set_Solution_time_n(void); - - /*! - * \brief Set the variable solution at time n-1. - */ - void Set_Solution_time_n1(void); - - /*! - * \brief Set the variable solution at time n. - */ - void Set_Solution_time_n(su2double* val_sol); - - /*! - * \brief Set the variable solution at time n-1. - */ - void Set_Solution_time_n1(su2double* val_sol); - - /*! - * \brief Set to zero the velocity components of the solution. - */ - void SetVelSolutionZero(void); - - /*! - * \brief Specify a vector to set the velocity components of the solution. - * \param[in] val_vector - Pointer to the vector. - */ - void SetVelSolutionVector(su2double *val_vector); - - /*! - * \brief Set to zero velocity components of the solution. - */ - void SetVelSolutionOldZero(void); - - /*! - * \brief Specify a vector to set the velocity components of the old solution. - * \param[in] val_vector - Pointer to the vector. - */ - void SetVelSolutionOldVector(su2double *val_vector); - - /*! - * \brief Set to zero the solution. - */ - void SetSolutionZero(void); - - /*! - * \brief Set to zero a particular solution. - */ - void SetSolutionZero(unsigned short val_var); - - /*! - * \brief Add a value to the solution. - * \param[in] val_var - Number of the variable. - * \param[in] val_solution - Value that we want to add to the solution. - */ - void AddSolution(unsigned short val_var, su2double val_solution); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - virtual su2double GetSolution_New(unsigned short val_var); - - /*! - * \brief A virtual member. - */ - virtual su2double GetRoe_Dissipation(void); - - /*! - * \brief A virtual member. - */ - virtual void SetRoe_Dissipation(su2double val_dissipation); - - /*! - * \brief A virtual member. - */ - virtual void SetRoe_Dissipation_FD(su2double val_wall_dist); - - /*! - * \brief A virtual member. - * \param[in] val_delta - A scalar measure of the grid size - * \param[in] val_const_DES - The DES constant (C_DES) - */ - virtual void SetRoe_Dissipation_NTS(su2double val_delta, - su2double val_const_DES); - - /*! - * \brief A virtual member. - */ - virtual su2double GetDES_LengthScale(void); - - /*! - * \brief A virtual member. - */ - virtual void SetDES_LengthScale(su2double val_des_lengthscale); - - /*! - * \brief A virtual member. - */ - virtual void SetSolution_New(void); - - /*! - * \brief A virtual member. - * \param[in] val_var - Number of the variable. - * \param[in] val_solution - Value that we want to add to the solution. - */ - virtual void AddSolution_New(unsigned short val_var, su2double val_solution); - - /*! - * \brief Add a value to the solution, clipping the values. - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the solution change. - * \param[in] lowerlimit - Lower value. - * \param[in] upperlimit - Upper value. - */ - void AddClippedSolution(unsigned short val_var, su2double val_solution, - su2double lowerlimit, su2double upperlimit); - - /*! - * \brief Update the variables using a conservative format. - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the solution change. - * \param[in] val_density - Value of the density. - * \param[in] val_density_old - Value of the old density. - * \param[in] lowerlimit - Lower value. - * \param[in] upperlimit - Upper value. - */ - void AddConservativeSolution(unsigned short val_var, su2double val_solution, - su2double val_density, su2double val_density_old, su2double lowerlimit, - su2double upperlimit); - - /*! - * \brief Get the solution of the problem. - * \return Pointer to the solution vector. - */ - su2double *GetSolution(void); - - /*! - * \brief Get the old solution of the problem (Runge-Kutta method) - * \return Pointer to the old solution vector. - */ - su2double *GetSolution_Old(void); - - /*! - * \brief Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - su2double *GetSolution_time_n(void); - - /*! - * \brief Get the solution at time n-1. - * \return Pointer to the solution (at time n-1) vector. - */ - su2double *GetSolution_time_n1(void); - - /*! - * \brief Set the value of the old residual. - * \param[in] val_residual_old - Pointer to the residual vector. - */ - void SetResidual_Old(su2double *val_residual_old); - - /*! - * \brief Add a value to the summed residual vector. - * \param[in] val_residual - Pointer to the residual vector. - */ - void AddResidual_Sum(su2double *val_residual); - - /*! - * \brief Set summed residual vector to zero value. - */ - void SetResidualSumZero(void); - - /*! - * \brief Set the velocity of the truncation error to zero. - */ - virtual void SetVel_ResTruncError_Zero(unsigned short iSpecies); - - /*! - * \brief Get the value of the summed residual. - * \return Pointer to the summed residual. - */ - su2double *GetResidual_Sum(void); - - /*! - * \brief Get the value of the old residual. - * \return Pointer to the old residual. - */ - su2double *GetResidual_Old(void); - - /*! - * \brief Get the value of the summed residual. - * \param[in] val_residual - Pointer to the summed residual. - */ - void GetResidual_Sum(su2double *val_residual); - - /*! - * \brief Set auxiliar variables, we are looking for the gradient of that variable. - * \param[in] val_auxvar - Value of the auxiliar variable. - */ - void SetAuxVar(su2double val_auxvar); - - /*! - * \brief Get the value of the auxiliary variable. - * \return Value of the auxiliary variable. - */ - su2double GetAuxVar(void); - - /*! - * \brief Set the auxiliary variable gradient to zero value. - */ - void SetAuxVarGradientZero(void); - - /*! - * \brief Set the value of the auxiliary variable gradient. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_gradient - Value of the gradient for the index val_dim. - */ - void SetAuxVarGradient(unsigned short val_dim, su2double val_gradient); - - /*! - * \brief Add a value to the auxiliary variable gradient. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient to be added for the index val_dim. - */ - void AddAuxVarGradient(unsigned short val_dim, su2double val_value); - - /*! - * \brief Subtract a value to the auxiliary variable gradient. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient to be subtracted for the index val_dim. - */ - void SubtractAuxVarGradient(unsigned short val_dim, su2double val_value); - - /*! - * \brief Get the gradient of the auxiliary variable. - * \return Value of the gradient of the auxiliary variable. - */ - su2double *GetAuxVarGradient(void); - - /*! - * \brief Get the gradient of the auxiliary variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the gradient of the auxiliary variable for the dimension val_dim. - */ - su2double GetAuxVarGradient(unsigned short val_dim); - - /*! - * \brief Add a value to the truncation error. - * \param[in] val_truncation_error - Value that we want to add to the truncation error. - */ - void AddRes_TruncError(su2double *val_truncation_error); - - /*! - * \brief Subtract a value to the truncation error. - * \param[in] val_truncation_error - Value that we want to subtract to the truncation error. - */ - void SubtractRes_TruncError(su2double *val_truncation_error); - - /*! - * \brief Set the truncation error to zero. - */ - void SetRes_TruncErrorZero(void); - - /*! - * \brief Set the truncation error to zero. - */ - void SetVal_ResTruncError_Zero(unsigned short val_var); - - /*! - * \brief Set the velocity of the truncation error to zero. - */ - void SetVel_ResTruncError_Zero(void); - - /*! - * \brief Set the velocity of the truncation error to zero. - */ - void SetEnergy_ResTruncError_Zero(void); - - /*! - * \brief Get the truncation error. - * \return Pointer to the truncation error. - */ - su2double *GetResTruncError(void); - - /*! - * \brief Get the truncation error. - * \param[in] val_trunc_error - Pointer to the truncation error. - */ - void GetResTruncError(su2double *val_trunc_error); - - /*! - * \brief Set the gradient of the solution. - * \param[in] val_gradient - Gradient of the solution. - */ - void SetGradient(su2double **val_gradient); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient. - */ - void SetGradient(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Set to zero the gradient of the solution. - */ - void SetGradientZero(void); - - /*! - * \brief Add val_value to the solution gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to add to the solution gradient. - */ - void AddGradient(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Subtract val_value to the solution gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to subtract to the solution gradient. - */ - void SubtractGradient(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Get the value of the solution gradient. - * \return Value of the gradient solution. - */ - su2double **GetGradient(void); - - /*! - * \brief Get the value of the solution gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the solution gradient. - */ - su2double GetGradient(unsigned short val_var, unsigned short val_dim); - - /*! - * \brief Set the value of an entry in the Rmatrix for least squares gradient calculations. - * \param[in] val_iDim - Index of the dimension. - * \param[in] val_jDim - Index of the dimension. - * \param[in] val_value - Value of the Rmatrix entry. - */ - void SetRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value); - - /*! - * \brief Set to zero the Rmatrix for least squares gradient calculations. - */ - void SetRmatrixZero(void); - - /*! - * \brief Add val_value to the Rmatrix for least squares gradient calculations. - * \param[in] val_iDim - Index of the dimension. - * \param[in] val_jDim - Index of the dimension. - * \param[in] val_value - Value to add to the Rmatrix entry. - */ - void AddRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value); - - /*! - * \brief Get the value of the Rmatrix entry for least squares gradient calculations. - * \param[in] val_iDim - Index of the dimension. - * \param[in] val_jDim - Index of the dimension. - * \return Value of the Rmatrix entry. - */ - su2double GetRmatrix(unsigned short val_iDim, unsigned short val_jDim); - - /*! - * \brief Set the value of the limiter. - * \param[in] val_var - Index of the variable. - * \param[in] val_limiter - Value of the limiter for the index val_var. - */ - void SetLimiter(unsigned short val_var, su2double val_limiter); - - /*! - * \brief Set the value of the limiter. - * \param[in] val_species - Index of the species . - * \param[in] val_var - Index of the variable. - * \param[in] val_limiter - Value of the limiter for the index val_var. - */ - virtual void SetLimiterPrimitive(unsigned short val_species, unsigned short val_var, su2double val_limiter); - - /*! - * \brief Set the value of the limiter. - * \param[in] val_species - Index of the species . - * \param[in] val_var - Index of the variable. - */ - virtual su2double GetLimiterPrimitive(unsigned short val_species, unsigned short val_var); - - /*! - * \brief Set the value of the max solution. - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the max solution for the index val_var. - */ - void SetSolution_Max(unsigned short val_var, su2double val_solution); - - /*! - * \brief Set the value of the min solution. - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the min solution for the index val_var. - */ - void SetSolution_Min(unsigned short val_var, su2double val_solution); - - /*! - * \brief Get the value of the slope limiter. - * \return Pointer to the limiters vector. - */ - su2double *GetLimiter(void); - - /*! - * \brief Get the value of the slope limiter. - * \param[in] val_var - Index of the variable. - * \return Value of the limiter vector for the variable val_var. - */ - su2double GetLimiter(unsigned short val_var); - - /*! - * \brief Get the value of the min solution. - * \param[in] val_var - Index of the variable. - * \return Value of the min solution for the variable val_var. - */ - su2double GetSolution_Max(unsigned short val_var); - - /*! - * \brief Get the value of the min solution. - * \param[in] val_var - Index of the variable. - * \return Value of the min solution for the variable val_var. - */ - su2double GetSolution_Min(unsigned short val_var); - - /*! - * \brief Get the value of the preconditioner Beta. - * \return Value of the low Mach preconditioner variable Beta - */ - virtual su2double GetPreconditioner_Beta(); - - /*! - * \brief Set the value of the preconditioner Beta. - * \param[in] val_Beta - Value of the low Mach preconditioner variable Beta - */ - virtual void SetPreconditioner_Beta(su2double val_Beta); - - /*! - * \brief Get the value of the wind gust - * \return Value of the wind gust - */ - virtual su2double* GetWindGust(); - - /*! - * \brief Set the value of the wind gust - * \param[in] val_WindGust - Value of the wind gust - */ - virtual void SetWindGust(su2double* val_WindGust); - - /*! - * \brief Get the value of the derivatives of the wind gust - * \return Value of the derivatives of the wind gust - */ - virtual su2double* GetWindGustDer(); - - /*! - * \brief Set the value of the derivatives of the wind gust - * \param[in] val_WindGust - Value of the derivatives of the wind gust - */ - virtual void SetWindGustDer(su2double* val_WindGust); - - /*! - * \brief Set the value of the time step. - * \param[in] val_delta_time - Value of the time step. - */ - void SetDelta_Time(su2double val_delta_time); - - /*! - * \brief Set the value of the time step. - * \param[in] val_delta_time - Value of the time step. - * \param[in] iSpecies - Index of the Species . - */ - virtual void SetDelta_Time(su2double val_delta_time, unsigned short iSpecies); - - /*! - * \brief Get the value of the time step. - * \return Value of the time step. - */ - su2double GetDelta_Time(void); - - /*! - * \brief Get the value of the time step. - * \param[in] iSpecies - Index of the Species - * \return Value of the time step. - */ - virtual su2double GetDelta_Time(unsigned short iSpecies); - - /*! - * \brief Set the value of the maximum eigenvalue. - * \param[in] val_max_lambda - Value of the maximum eigenvalue. - */ - void SetMax_Lambda(su2double val_max_lambda); - - /*! - * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. - */ - void SetMax_Lambda_Inv(su2double val_max_lambda); - - /*! - * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. - * \param[in] val_species - Value of the species index to set the maximum eigenvalue. - */ - virtual void SetMax_Lambda_Inv(su2double val_max_lambda, unsigned short val_species); - - /*! - * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. - */ - void SetMax_Lambda_Visc(su2double val_max_lambda); - - /*! - * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. - * \param[in] val_species - Index of the species to set the maximum eigenvalue of the viscous terms. - */ - virtual void SetMax_Lambda_Visc(su2double val_max_lambda, unsigned short val_species); - - /*! - * \brief Add a value to the maximum eigenvalue. - * \param[in] val_max_lambda - Value of the maximum eigenvalue. - */ - void AddMax_Lambda(su2double val_max_lambda); - - /*! - * \brief Add a value to the maximum eigenvalue for the inviscid terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. - */ - void AddMax_Lambda_Inv(su2double val_max_lambda); - - /*! - * \brief Add a value to the maximum eigenvalue for the viscous terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. - */ - void AddMax_Lambda_Visc(su2double val_max_lambda); - - /*! - * \brief Get the value of the maximum eigenvalue. - * \return the value of the maximum eigenvalue. - */ - su2double GetMax_Lambda(void); - - /*! - * \brief Get the value of the maximum eigenvalue for the inviscid terms of the PDE. - * \return the value of the maximum eigenvalue for the inviscid terms of the PDE. - */ - su2double GetMax_Lambda_Inv(void); - - /*! - * \brief Get the value of the maximum eigenvalue for the viscous terms of the PDE. - * \return the value of the maximum eigenvalue for the viscous terms of the PDE. - */ - su2double GetMax_Lambda_Visc(void); - - /*! - * \brief Set the value of the spectral radius. - * \param[in] val_lambda - Value of the spectral radius. - */ - void SetLambda(su2double val_lambda); - - /*! - * \brief Set the value of the spectral radius. - * \param[in] val_lambda - Value of the spectral radius. - * \param[in] val_iSpecies -Index of species - */ - virtual void SetLambda(su2double val_lambda, unsigned short val_iSpecies); - - /*! - * \brief Add the value of the spectral radius. - * \param[in] val_lambda - Value of the spectral radius. - */ - void AddLambda(su2double val_lambda); - - /*! - * \brief Add the value of the spectral radius. - * \param[in] val_iSpecies -Index of species - * \param[in] val_lambda - Value of the spectral radius. - */ - virtual void AddLambda(su2double val_lambda, unsigned short val_iSpecies); - - /*! - * \brief Get the value of the spectral radius. - * \return Value of the spectral radius. - */ - su2double GetLambda(void); - - /*! - * \brief Get the value of the spectral radius. - * \param[in] val_iSpecies -Index of species - * \return Value of the spectral radius. - */ - virtual su2double GetLambda(unsigned short val_iSpecies); - - /*! - * \brief Set pressure sensor. - * \param[in] val_sensor - Value of the pressure sensor. - */ - void SetSensor(su2double val_sensor); - - /*! - * \brief Set pressure sensor. - * \param[in] val_sensor - Value of the pressure sensor. - * \param[in] iSpecies - Index of the species. - */ - virtual void SetSensor(su2double val_sensor, unsigned short iSpecies); - - /*! - * \brief Get the pressure sensor. - * \return Value of the pressure sensor. - */ - su2double GetSensor(void); - - /*! - * \brief Get the pressure sensor. - * \param[in] iSpecies - index of species - * \return Value of the pressure sensor. - */ - virtual su2double GetSensor(unsigned short iSpecies); - - /*! - * \brief Set the value of the undivided laplacian of the solution. - * \param[in] val_var - Index of the variable. - * \param[in] val_undivided_laplacian - Value of the undivided solution for the index val_var. - */ - void SetUndivided_Laplacian(unsigned short val_var, su2double val_undivided_laplacian); - - /*! - * \brief Add the value of the undivided laplacian of the solution. - * \param[in] val_und_lapl - Value of the undivided solution. - */ - void AddUnd_Lapl(su2double *val_und_lapl); - - /*! - * \brief Subtract the value of the undivided laplacian of the solution. - * \param[in] val_und_lapl - Value of the undivided solution. - */ - void SubtractUnd_Lapl(su2double *val_und_lapl); - - /*! - * \brief Subtract the value of the undivided laplacian of the solution. - * \param[in] val_var - Variable of the undivided laplacian. - * \param[in] val_und_lapl - Value of the undivided solution. - */ - void SubtractUnd_Lapl(unsigned short val_var, su2double val_und_lapl); - - /*! - * \brief Set the undivided laplacian of the solution to zero. - */ - void SetUnd_LaplZero(void); - - /*! - * \brief Set a value to the undivided laplacian. - * \param[in] val_var - Variable of the undivided laplacian. - * \param[in] val_und_lapl - Value of the undivided laplacian. - */ - void SetUnd_Lapl(unsigned short val_var, su2double val_und_lapl); - - /*! - * \brief Get the undivided laplacian of the solution. - * \return Pointer to the undivided laplacian vector. - */ - su2double *GetUndivided_Laplacian(void); - - /*! - * \brief Get the undivided laplacian of the solution. - * \param[in] val_var - Variable of the undivided laplacian. - * \return Value of the undivided laplacian vector. - */ - su2double GetUndivided_Laplacian(unsigned short val_var); - - /*! - * \brief A virtual member. - * \return Value of the flow density. - */ - virtual su2double GetDensity(void); - - /*! - * \brief A virtual member. - * \return Old value of the flow density. - */ - virtual su2double GetDensity_Old(void); - - /*! - * \brief A virtual member. - * \return Value of the flow density. - */ - virtual su2double GetDensity(unsigned short val_iSpecies); - - /*! - * \brief A virtual member. - * \param[in] val_Species - Index of species s. - * \return Value of the mass fraction of species s. - */ - virtual su2double GetMassFraction(unsigned short val_Species); - - /*! - * \brief A virtual member. - * \return Value of the flow energy. - */ - virtual su2double GetEnergy(void); - - /*! - * \brief A virtual member. - * \return Pointer to the force projection vector. - */ - virtual su2double *GetForceProj_Vector(void); - - /*! - * \brief A virtual member. - * \return Pointer to the objective function source. - */ - virtual su2double *GetObjFuncSource(void); - - /*! - * \brief A virtual member. - * \return Pointer to the internal boundary vector. - */ - virtual su2double *GetIntBoundary_Jump(void); - - /*! - * \brief A virtual member. - * \return Value of the eddy viscosity. - */ - virtual su2double GetEddyViscosity(void); - - /*! - * \brief A virtual member. - * \return Value of the flow enthalpy. - */ - virtual su2double GetEnthalpy(void); - - /*! - * \brief A virtual member. - * \return Value of the flow pressure. - */ - virtual su2double GetPressure(void); - - /*! - * \brief A virtual member. - * \param[in] val_vector - Direction of projection. - * \return Value of the projected velocity. - */ - virtual su2double GetProjVel(su2double *val_vector); - - /*! - * \brief A virtual member. - * \param[in] val_vector - Direction of projection. - * \param[in] val_species - Index of the desired species. - * \return Value of the projected velocity. - */ - virtual su2double GetProjVel(su2double *val_vector, unsigned short val_species); - - /*! - * \brief A virtual member. - * \return Value of the sound speed. - */ - virtual su2double GetSoundSpeed(void); - - /*! - * \brief A virtual member. - * \return Value of the beta for the incompressible flow. - */ - virtual su2double GetBetaInc2(void); - - /*! - * \brief A virtual member. - * \return Value of the temperature. - */ - virtual su2double GetTemperature(void); - - /*! - * \brief A virtual member. - * \return Value of the vibrational-electronic temperature. - */ - virtual su2double GetTemperature_ve(void); - - /*! - * \brief A virtual member -- Get the mixture specific heat at constant volume (trans.-rot.). - * \return \f$\rho C^{t-r}_{v} \f$ - */ - virtual su2double GetRhoCv_tr(void); - - /*! - * \brief A virtual member -- Get the mixture specific heat at constant volume (vib.-el.). - * \return \f$\rho C^{v-e}_{v} \f$ - */ - virtual su2double GetRhoCv_ve(void); - - /*! - * \brief A virtual member. - * \param[in] val_dim - Index of the dimension. - * \return Value of the velocity for the dimension val_dim. - */ - virtual su2double GetVelocity(unsigned short val_dim); - - /*! - * \brief A virtual member. - * \return Norm 2 of the velocity vector. - */ - virtual su2double GetVelocity2(void); - - /*! - * \brief A virtual member. - * \return Norm 2 of the velocity vector of Fluid val_species. - */ - virtual su2double GetVelocity2(unsigned short val_species); - - /*! - * \brief A virtual member. - * \return The laminar viscosity of the flow. - */ - virtual su2double GetLaminarViscosity(void); - - - /*! - * \brief A virtual member. - * \return The laminar viscosity of the flow. - */ - virtual su2double GetLaminarViscosity(unsigned short iSpecies); - - /*! - * \brief A virtual member. - * \return Value of the species diffusion coefficient. - */ - virtual su2double* GetDiffusionCoeff(void); - - /*! - * \brief A virtual member. - * \return Value of the thermal conductivity (translational/rotational) - */ - virtual su2double GetThermalConductivity(void); - - /*! - * \brief A virtual member. - * \return Value of the specific heat at constant P - */ - virtual su2double GetSpecificHeatCp(void); - - /*! - * \brief A virtual member. - * \return Value of the specific heat at constant V - */ - virtual su2double GetSpecificHeatCv(void); - - /*! - * \brief A virtual member. - * \return Value of the thermal conductivity (vibrational) - */ - virtual su2double GetThermalConductivity_ve(void); - - /*! - * \brief A virtual member. - * \return Sets separation intermittency - */ - virtual void SetGammaSep(su2double gamma_sep); - - /*! - * \brief A virtual member. - * \return Sets separation intermittency - */ - virtual void SetGammaEff(void); - - /*! - * \brief A virtual member. - * \return Returns intermittency - */ - virtual su2double GetIntermittency(); - - /*! - * \brief A virtual member. - * \return Value of the vorticity. - */ - virtual su2double *GetVorticity(void); - - /*! - * \brief A virtual member. - * \return Value of the rate of strain magnitude. - */ - virtual su2double GetStrainMag(void); - - /*! - * \brief A virtual member. - * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. - */ - virtual void SetForceProj_Vector(su2double *val_ForceProj_Vector); - - /*! - * \brief A virtual member. - * \param[in] val_SetObjFuncSource - Pointer to the objective function source. - */ - virtual void SetObjFuncSource(su2double *val_SetObjFuncSource); - - /*! - * \brief A virtual member. - * \param[in] val_IntBoundary_Jump - Pointer to the interior boundary jump. - */ - virtual void SetIntBoundary_Jump(su2double *val_IntBoundary_Jump); - - /*! - * \brief A virtual member. - * \return Value of the gamma_BC of B-C transition model. - */ - virtual su2double GetGammaBC(void); - - /*! - * \brief A virtual member. - */ - virtual void SetGammaBC(su2double val_gamma); - - /*! - * \brief A virtual member. - * \param[in] eddy_visc - Value of the eddy viscosity. - */ - virtual void SetEddyViscosity(su2double eddy_visc); - - /*! - * \brief A virtual member. - */ - virtual void SetEnthalpy(void); - - /*! - * \brief A virtual member. - */ - virtual bool SetPrimVar(CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual bool SetPrimVar(CFluidModel *FluidModel); - - /*! - * \brief A virtual member. - */ - virtual void SetSecondaryVar(CFluidModel *FluidModel); - - /*! - * \brief A virtual member. - */ - virtual bool Cons2PrimVar(CConfig *config, su2double *U, su2double *V, - su2double *dPdU, su2double *dTdU, - su2double *dTvedU); - /*! - * \brief A virtual member. - */ - virtual void Prim2ConsVar(CConfig *config, su2double *V, su2double *U); - - /*! - * \brief A virtual member. - */ - virtual bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); - - /*! - * \brief A virtual member. - */ - virtual bool SetPrimVar(su2double Density_Inf, CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual bool SetPrimVar(su2double Density_Inf, su2double Viscosity_Inf, su2double eddy_visc, su2double turb_ke, CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual su2double GetPrimitive(unsigned short val_var); - - /*! - * \brief A virtual member. - */ - virtual void SetPrimitive(unsigned short val_var, su2double val_prim); - - /*! - * \brief A virtual member. - */ - virtual void SetPrimitive(su2double *val_prim); - - /*! - * \brief A virtual member. - */ - virtual su2double *GetPrimitive(void); - - /*! - * \brief A virtual member. - */ - virtual su2double GetSecondary(unsigned short val_var); - - /*! - * \brief A virtual member. - */ - virtual void SetSecondary(unsigned short val_var, su2double val_secondary); - - /*! - * \brief A virtual member. - */ - virtual void SetSecondary(su2double *val_secondary); - - /*! - * \brief A virtual member. - */ - virtual void SetdPdrho_e(su2double dPdrho_e); - - /*! - * \brief A virtual member. - */ - virtual void SetdPde_rho(su2double dPde_rho); - - /*! - * \brief A virtual member. - */ - virtual void SetdTdrho_e(su2double dTdrho_e); - - /*! - * \brief A virtual member. - */ - virtual void SetdTde_rho(su2double dTde_rho); - - /*! - * \brief A virtual member. - */ - virtual void Setdmudrho_T(su2double dmudrho_T); - - /*! - * \brief A virtual member. - */ - virtual void SetdmudT_rho(su2double dmudT_rho); - - /*! - * \brief A virtual member. - */ - virtual void Setdktdrho_T(su2double dktdrho_T); - - /*! - * \brief A virtual member. - */ - virtual void SetdktdT_rho(su2double dktdT_rho); - - /*! - * \brief A virtual member. - */ - virtual su2double *GetSecondary(void); - - /*! - * \brief A virtual member. - */ - virtual bool SetDensity(su2double val_density); - - /*! - * \brief A virtual member. - */ - virtual void SetPressure(void); - - /*! - * \brief A virtual member. - */ - virtual void SetVelocity(void); - - /*! - * \brief A virtual member. - */ - virtual void SetBetaInc2(su2double val_betainc2); - - /*! - * \brief A virtual member. - * \param[in] val_phi - Value of the adjoint velocity. - */ - virtual void SetPhi_Old(su2double *val_phi); - - /*! - * \brief A virtual member. - * \param[in] Gamma - Ratio of Specific heats - */ - virtual bool SetPressure(su2double Gamma); - - /*! - * \brief A virtual member. - * \param[in] config - */ - virtual bool SetPressure(CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual bool SetPressure(su2double Gamma, su2double turb_ke); - - /*! - * \brief Calculates vib.-el. energy per mass, \f$e^{vib-el}_s\f$, for input species (not including KE) - */ - virtual su2double CalcEve(su2double *V, CConfig *config, unsigned short val_Species); - - /*! - * \brief Calculates enthalpy per mass, \f$h_s\f$, for input species (not including KE) - */ - virtual su2double CalcHs(su2double *V, CConfig *config, unsigned short val_Species); - - /*! - * \brief Calculates enthalpy per mass, \f$Cv_s\f$, for input species (not including KE) - */ - virtual su2double CalcCvve(su2double val_Tve, CConfig *config, unsigned short val_Species); - - /*! - * \brief A virtual member. - * \param[in] V - * \param[in] config - Configuration settings - * \param[in] dPdU - */ - virtual void CalcdPdU(su2double *V, CConfig *config, su2double *dPdU); - - /*! - * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ - * \param[in] V - * \param[in] config - Configuration settings - * \param[in] dTdU - */ - virtual void CalcdTdU(su2double *V, CConfig *config, su2double *dTdU); - - /*! - * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ - * \param[in] V - * \param[in] config - Configuration settings - * \param[in] dTdU - */ - virtual void CalcdTvedU(su2double *V, CConfig *config, su2double *dTdU); - - /*! - * \brief A virtual member. - */ - virtual su2double *GetdPdU(void); - - /*! - * \brief A virtual member. - */ - virtual su2double *GetdTdU(void); - - /*! - * \brief A virtual member. - */ - virtual su2double *GetdTvedU(void); - - /*! - * \brief A virtual member. - */ - virtual bool SetDensity(void); - - /*! - * \brief A virtual member. - * \param[in] val_velocity - Value of the velocity. - * \param[in] Gamma - Ratio of Specific heats - */ - virtual void SetDeltaPressure(su2double *val_velocity, su2double Gamma); - - /*! - * \brief A virtual member. - * \param[in] Gamma - Ratio of specific heats. - */ - virtual bool SetSoundSpeed(su2double Gamma); - - /*! - * \brief A virtual member. - * \param[in] config - Configuration parameters. - */ - virtual bool SetSoundSpeed(CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual bool SetSoundSpeed(void); - - /*! - * \brief A virtual member. - * \param[in] Gas_Constant - Value of the Gas Constant - */ - virtual bool SetTemperature(su2double Gas_Constant); - - /*! - * \brief Sets the vibrational electronic temperature of the flow. - * \return Value of the temperature of the flow. - */ - virtual bool SetTemperature_ve(su2double val_Tve); - - /*! - * \brief A virtual member. - * \param[in] config - Configuration parameters. - */ - virtual bool SetTemperature(CConfig *config); - - /*! - * \brief A virtual member. - * \param[in] config - Configuration parameters. - */ - virtual void SetPrimitive(CConfig *config); - - /*! - * \brief A virtual member. - * \param[in] config - Configuration parameters. - * \param[in] Coord - Physical coordinates. - */ - virtual void SetPrimitive(CConfig *config, su2double *Coord); - - /*! - * \brief A virtual member. - * \param[in] Temperature_Wall - Value of the Temperature at the wall - */ - virtual void SetWallTemperature(su2double Temperature_Wall); - - /*! - * \brief A virtual member. - * \param[in] Temperature_Wall - Value of the Temperature at the wall - */ - virtual void SetWallTemperature(su2double* Temperature_Wall); - - /*! - * \brief Set the thermal coefficient. - * \param[in] config - Configuration parameters. - */ - virtual void SetThermalCoeff(CConfig *config); - - /*! - * \brief A virtual member. - */ - virtual void SetStress_FEM(unsigned short iVar, su2double val_stress); - - /*! - * \brief A virtual member. - */ - virtual void AddStress_FEM(unsigned short iVar, su2double val_stress); - - /*! - * \brief A virtual member. - - */ - virtual su2double *GetStress_FEM(void); - - /*! - * \brief A virtual member. - */ - virtual void SetVonMises_Stress(su2double val_stress); - - /*! - * \brief A virtual member. - - */ - virtual su2double GetVonMises_Stress(void); - - /*! - * \brief A virtual member. - */ - virtual void Add_SurfaceLoad_Res(su2double *val_surfForce); - - /*! - * \brief A virtual member. - */ - virtual void Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce); - - /*! - * \brief A virtual member. - */ - virtual su2double Get_SurfaceLoad_Res(unsigned short iVar); - - /*! - * \brief A virtual member. - */ - virtual void Clear_SurfaceLoad_Res(void); - - /*! - * \brief A virtual member. - */ - virtual void Set_SurfaceLoad_Res_n(void); - - /*! - * \brief A virtual member. - */ - virtual su2double Get_SurfaceLoad_Res_n(unsigned short iVar); - - /*! - * \brief A virtual member. - */ - virtual void Add_BodyForces_Res(su2double *val_bodyForce); - - /*! - * \brief A virtual member. - */ - virtual su2double Get_BodyForces_Res(unsigned short iVar); - - /*! - * \brief A virtual member. - */ - virtual void Clear_BodyForces_Res(void); - - /*! - * \brief A virtual member. - */ - virtual void Set_FlowTraction(su2double *val_flowTraction); - - /*! - * \brief A virtual member. - */ - virtual void Add_FlowTraction(su2double *val_flowTraction); - - /*! - * \brief A virtual member. - */ - virtual su2double Get_FlowTraction(unsigned short iVar); - - /*! - * \brief A virtual member. - */ - virtual void Set_FlowTraction_n(void); - - /*! - * \brief A virtual member. - */ - virtual su2double Get_FlowTraction_n(unsigned short iVar); - - /*! - * \brief A virtual member. - */ - virtual void Clear_FlowTraction(void); - - /*! - * \brief A virtual member. - */ - virtual bool Get_isVertex(void); - - /*! - * \brief A virtual member. - */ - virtual void SetVelocity2(void); - - /*! - * \brief A virtual member. - * \param[in] val_velocity - Pointer to the velocity. - */ - virtual void SetVelocity_Old(su2double *val_velocity); - - /*! - * \brief A virtual member. - * \param[in] laminarViscosity - */ - virtual void SetLaminarViscosity(su2double laminarViscosity); - - /*! - * \brief A virtual member. - * \param[in] config - Definition of the particular problem. - */ - virtual void SetLaminarViscosity(CConfig *config); - - /*! - * \brief A virtual member. - * \param[in] thermalConductivity - */ - virtual void SetThermalConductivity(su2double thermalConductivity); - - /*! - * \brief A virtual member. - * \param[in] config - Definition of the particular problem. - */ - virtual void SetThermalConductivity(CConfig *config); - - /*! - * \brief A virtual member. - * \param[in] Cp - Constant pressure specific heat. - */ - virtual void SetSpecificHeatCp(su2double Cp); - - /*! - * \brief A virtual member. - * \param[in] Cv - Constant volume specific heat. - */ - virtual void SetSpecificHeatCv(su2double Cv); - - /*! - * \brief A virtual member. - */ - virtual bool SetVorticity(void); - - /*! - * \brief A virtual member. - */ - virtual bool SetStrainMag(void); - - /*! - * \brief A virtual member. - */ - virtual void SetVelSolutionOldDVector(void); - - /*! - * \brief A virtual member. - */ - virtual void SetVelSolutionDVector(void); - - /*! - * \brief A virtual member. - */ - virtual void SetGradient_PrimitiveZero(unsigned short val_primvar); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to add to the gradient of the primitive variables. - */ - virtual void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to subtract to the gradient of the primitive variables. - */ - virtual void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the primitive variables gradient. - */ - virtual su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \return Value of the primitive variables gradient. - */ - virtual su2double GetLimiter_Primitive(unsigned short val_var); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient. - */ - virtual void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_value - Value of the gradient. - */ - virtual void SetLimiter_Primitive(unsigned short val_var, su2double val_value); - - /*! - * \brief A virtual member. - * \return Value of the primitive variables gradient. - */ - virtual su2double **GetGradient_Primitive(void); - - /*! - * \brief A virtual member. - * \return Value of the primitive variables gradient. - */ - virtual su2double *GetLimiter_Primitive(void); - - /*! - * \brief A virtual member. - */ - virtual void SetGradient_SecondaryZero(unsigned short val_secondaryvar); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to add to the gradient of the Secondary variables. - */ - virtual void AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to subtract to the gradient of the Secondary variables. - */ - virtual void SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the Secondary variables gradient. - */ - virtual su2double GetGradient_Secondary(unsigned short val_var, unsigned short val_dim); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \return Value of the Secondary variables gradient. - */ - virtual su2double GetLimiter_Secondary(unsigned short val_var); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient. - */ - virtual void SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_value - Value of the gradient. - */ - virtual void SetLimiter_Secondary(unsigned short val_var, su2double val_value); - - /*! - * \brief A virtual member. - * \return Value of the Secondary variables gradient. - */ - virtual su2double **GetGradient_Secondary(void); - - /*! - * \brief A virtual member. - * \return Value of the Secondary variables gradient. - */ - virtual su2double *GetLimiter_Secondary(void); - - /*! - * \brief Set the blending function for the blending of k-w and k-eps. - * \param[in] val_viscosity - Value of the vicosity. - * \param[in] val_density - Value of the density. - * \param[in] val_dist - Value of the distance to the wall. - */ - virtual void SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density); - - /*! - * \brief Get the first blending function of the SST model. - */ - virtual su2double GetF1blending(void); - - /*! - * \brief Get the second blending function of the SST model. - */ - virtual su2double GetF2blending(void); - - /*! - * \brief Get the value of the cross diffusion of tke and omega. - */ - virtual su2double GetCrossDiff(void) { return 0.0; }; - - /*! - * \brief Get the value of the eddy viscosity. - * \return the value of the eddy viscosity. - */ - virtual su2double GetmuT(void); - - /*! - * \brief Set the value of the eddy viscosity. - * \param[in] val_muT - */ - virtual void SetmuT(su2double val_muT); - - /*! - * \brief Add a value to the maximum eigenvalue for the inviscid terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. - * \param[in] iSpecies - Value of iSpecies to which the eigenvalue belongs - */ - virtual void AddMax_Lambda_Inv(su2double val_max_lambda, unsigned short iSpecies); - - /*! - * \brief Add a value to the maximum eigenvalue for the viscous terms of the PDE. - * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. - * \param[in] iSpecies - Value of iSpecies to which the eigenvalue belongs - */ - virtual void AddMax_Lambda_Visc(su2double val_max_lambda, unsigned short iSpecies); - - /*! - * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_source - Value of the harmonic balance source. - */ - virtual void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source); - - /*! - * \brief A virtual member. - */ - virtual su2double GetHarmonicBalance_Source(unsigned short val_var); - - /*! - * \brief Set the Eddy Viscosity Sensitivity of the problem. - * \param[in] val_EddyViscSens - Eddy Viscosity Sensitivity. - * \param[in] numTotalVar - Number of variables. - */ - virtual void SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar); - - /*! - * \brief Get the Eddy Viscosity Sensitivity of the problem. - * \return Pointer to the Eddy Viscosity Sensitivity. - */ - virtual su2double *GetEddyViscSens(void); - - /*! - * \brief A virtual member. Set the direct solution for the adjoint solver. - * \param[in] val_solution_direct - Value of the direct solution. - */ - virtual void SetSolution_Direct(su2double *val_solution_direct); - - /*! - * \brief A virtual member. Get the direct solution for the adjoint solver. - * \return Pointer to the direct solution vector. - */ - virtual su2double *GetSolution_Direct(void); - - /*! - * \brief A virtual member. Set the restart geometry (coordinate of the converged solution) - * \param[in] val_coordinate_direct - Value of the restart coordinate. - */ - virtual void SetGeometry_Direct(su2double *val_coordinate_direct); - - /*! - * \brief A virtual member. Get the restart geometry (coordinate of the converged solution). - * \return Pointer to the restart coordinate vector. - */ - virtual su2double *GetGeometry_Direct(void); - - /*! - * \brief A virtual member. Get the restart geometry (coordinate of the converged solution). - * \return Coordinate of the direct solver restart for . - */ - virtual su2double GetGeometry_Direct(unsigned short val_dim); - - /*! - * \brief A virtual member. Get the geometry solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - virtual su2double GetSolution_Geometry(unsigned short val_var); - - /*! - * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - virtual void SetSolution_Geometry(su2double *val_solution_geometry); - - /*! - * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - virtual void SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry); - - /*! - * \brief A virtual member. Get the geometry solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - virtual su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var); - - /*! - * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - virtual void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der); - - /*! - * \brief A virtual member. Get the geometry solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - virtual su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var); - - /*! - * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - virtual void SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der); - - /*! - * \brief A virtual member. Set the value of the old geometry solution (adjoint). - */ - virtual void Set_OldSolution_Geometry(void); - - /*! - * \brief A virtual member. Get the value of the old geometry solution (adjoint). - * \param[out] val_solution - old adjoint solution for coordinate iDim - */ - virtual su2double Get_OldSolution_Geometry(unsigned short iDim); - - /*! - * \brief A virtual member. Set the value of the old geometry solution (adjoint). - */ - virtual void Set_BGSSolution(unsigned short iDim, su2double val_solution); - - /*! - * \brief A virtual member. Set the value of the old geometry solution (adjoint). - */ - virtual void Set_BGSSolution_k(void); - - /*! - * \brief A virtual member. Get the value of the old geometry solution (adjoint). - * \param[out] val_solution - old adjoint solution for coordinate iDim - */ - virtual su2double Get_BGSSolution(unsigned short iDim); - - /*! - * \brief A virtual member. Get the value of the old geometry solution (adjoint). - * \param[out] val_solution - old adjoint solution for coordinate iDim - */ - virtual su2double Get_BGSSolution_k(unsigned short iDim); - - /*! - * \brief A virtual member. Set the value of the old geometry solution (adjoint). - */ - virtual void Set_BGSSolution_Geometry(void); - - /*! - * \brief A virtual member. Get the value of the old geometry solution (adjoint). - * \param[out] val_solution - old adjoint solution for coordinate iDim - */ - virtual su2double Get_BGSSolution_Geometry(unsigned short iDim); - - /*! - * \brief A virtual member. Set the contribution of crossed terms into the derivative. - */ - virtual void SetCross_Term_Derivative(unsigned short iVar, su2double der); - - /*! - * \brief A virtual member. Get the contribution of crossed terms into the derivative. - * \return The contribution of crossed terms into the derivative. - */ - virtual su2double GetCross_Term_Derivative(unsigned short iVar); - - /*! - * \brief A virtual member. Set the direct velocity solution for the adjoint solver. - * \param[in] val_solution_direct - Value of the direct velocity solution. - */ - virtual void SetSolution_Vel_Direct(su2double *sol); - - /*! - * \brief A virtual member. Set the direct acceleration solution for the adjoint solver. - * \param[in] val_solution_direct - Value of the direct acceleration solution. - */ - virtual void SetSolution_Accel_Direct(su2double *sol); - - /*! - * \brief A virtual member. Get the direct velocity solution for the adjoint solver. - * \return Pointer to the direct velocity solution vector. - */ - virtual su2double* GetSolution_Vel_Direct(); - - /*! - * \brief A virtual member. Get the direct acceleraction solution for the adjoint solver. - * \return Pointer to the direct acceleraction solution vector. - */ - virtual su2double* GetSolution_Accel_Direct(); - - /*! - * \brief Set the value of the old solution. - */ - virtual void SetSolution_time_n(void); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_time_n - Pointer to the residual vector. - */ - virtual void SetSolution_time_n(unsigned short val_var, su2double val_solution); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - virtual void SetSolution_time_n(su2double *val_solution_time_n); - - - /*! - * \brief Set the value of the velocity (Structural Analysis). - * \param[in] val_solution - Solution of the problem (velocity). - */ - virtual void SetSolution_Vel(su2double *val_solution); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_vel - Value of the solution for the index val_var. - */ - virtual void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel); - - /*! - * \brief Set the value of the velocity (Structural Analysis) at time n. - * \param[in] val_solution_vel_time_n - Value of the old solution. - */ - virtual void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n); - - /*! - * \brief Set the value of the velocity (Structural Analysis) at time n. - */ - virtual void SetSolution_Vel_time_n(void); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_vel_time_n - Value of the old solution for the index val_var. - */ - virtual void SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n); - - /*! - * \brief Get the solution at time n. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetSolution_time_n(unsigned short val_var); - - /*! - * \brief Get the velocity (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - virtual su2double GetSolution_Vel(unsigned short val_var); - - /*! - * \brief Get the solution of the problem. - * \return Pointer to the solution vector. - */ - virtual su2double *GetSolution_Vel(void); - - /*! - * \brief Get the velocity of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - virtual su2double GetSolution_Vel_time_n(unsigned short val_var); - - /*! - * \brief Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - virtual su2double *GetSolution_Vel_time_n(void); - - - /*! - * \brief Set the value of the acceleration (Structural Analysis). - * \param[in] val_solution_accel - Solution of the problem (acceleration). - */ - virtual void SetSolution_Accel(su2double *val_solution_accel); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_accel - Value of the solution for the index val_var. - */ - virtual void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel); - - /*! - * \brief Set the value of the acceleration (Structural Analysis) at time n. - * \param[in] val_solution_accel_time_n - Pointer to the residual vector. - */ - virtual void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n); - - /*! - * \brief Set the value of the acceleration (Structural Analysis) at time n. - */ - virtual void SetSolution_Accel_time_n(void); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_accel_time_n - Value of the old solution for the index val_var. - */ - virtual void SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n); - - /*! - * \brief Get the acceleration (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - virtual su2double GetSolution_Accel(unsigned short val_var); - - /*! - * \brief Get the solution of the problem. - * \return Pointer to the solution vector. - */ - virtual su2double *GetSolution_Accel(void); - - /*! - * \brief Get the acceleration of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - virtual su2double GetSolution_Accel_time_n(unsigned short val_var); - - /*! - * \brief Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - virtual su2double *GetSolution_Accel_time_n(void); - - /*! - * \brief A virtual member. - */ - virtual void Set_OldSolution_Vel(void); - - /*! - * \brief A virtual member. - */ - virtual void Set_OldSolution_Accel(void); - - /*! - * \brief A virtual member. Set the value of the solution predictor. - */ - virtual void SetSolution_Pred(void); - - /*! - * \brief A virtual member. Set the value of the old solution. - * \param[in] val_solution_pred - Pointer to the residual vector. - */ - virtual void SetSolution_Pred(su2double *val_solution_pred); - - /*! - * \brief A virtual member. Set the value of the solution predicted. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - virtual void SetSolution_Pred(unsigned short val_var, su2double val_solution_pred); - - /*! - * \brief A virtual member. Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - virtual su2double GetSolution_Pred(unsigned short val_var); - - /*! - * \brief A virtual member. Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - virtual su2double *GetSolution_Pred(void); - - /*! - * \brief A virtual member. Set the value of the solution predictor. - */ - virtual void SetSolution_Pred_Old(void); - - /*! - * \brief A virtual member. Set the value of the old solution. - * \param[in] val_solution_pred_Old - Pointer to the residual vector. - */ - virtual void SetSolution_Pred_Old(su2double *val_solution_pred_Old); - - /*! - * \brief A virtual member. Set the value of the old solution predicted. - * \param[in] val_solution_pred_old - Pointer to the residual vector. - */ - virtual void SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old); - - /*! - * \brief A virtual member. Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - virtual su2double GetSolution_Pred_Old(unsigned short val_var); - - /*! - * \brief A virtual member. Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - virtual su2double *GetSolution_Pred_Old(void); - - /*! - * \brief A virtual member. - */ - virtual void SetReference_Geometry(unsigned short iVar, su2double ref_geometry); - - /*! - * \brief A virtual member. - */ - virtual su2double *GetReference_Geometry(void); - - /*! - * \brief A virtual member. - */ - virtual void SetPrestretch(unsigned short iVar, su2double val_prestretch); - - /*! - * \brief A virtual member. - */ - virtual su2double *GetPrestretch(void); - - /*! - * \brief A virtual member. - */ - virtual su2double GetPrestretch(unsigned short iVar); - - /*! - * \brief A virtual member. - */ - virtual su2double GetReference_Geometry(unsigned short iVar); - - /*! - * \brief A virtual member. - */ - virtual void Register_femSolution_time_n(); - - /*! - * \brief A virtual member. - */ - virtual void RegisterSolution_Vel(bool input); - - /*! - * \brief A virtual member. - */ - virtual void RegisterSolution_Vel_time_n(); - - /*! - * \brief A virtual member. - */ - virtual void RegisterSolution_Accel(bool input); - - /*! - * \brief A virtual member. - */ - virtual void RegisterSolution_Accel_time_n(); - - /*! - * \brief A virtual member. - */ - virtual void SetAdjointSolution_Vel(su2double *adj_sol); - - /*! - * \brief A virtual member. - */ - virtual void GetAdjointSolution_Vel(su2double *adj_sol); - - /*! - * \brief A virtual member. - */ - virtual void SetAdjointSolution_Vel_time_n(su2double *adj_sol); - - /*! - * \brief A virtual member. - */ - virtual void GetAdjointSolution_Vel_time_n(su2double *adj_sol); - - /*! - * \brief A virtual member. - */ - virtual void SetAdjointSolution_Accel(su2double *adj_sol); - - /*! - * \brief A virtual member. - */ - virtual void GetAdjointSolution_Accel(su2double *adj_sol); - - /*! - * \brief A virtual member. - */ - virtual void SetAdjointSolution_Accel_time_n(su2double *adj_sol); - - /*! - * \brief A virtual member. - */ - virtual void GetAdjointSolution_Accel_time_n(su2double *adj_sol); - - /*! - * \brief Register the variables in the solution array as input/output variable. - * \param[in] input - input or output variables. - */ - void RegisterSolution(bool input); - - /*! - * \brief Register the variables in the solution_time_n array as input/output variable. - */ - void RegisterSolution_time_n(); - - /*! - * \brief Register the variables in the solution_time_n1 array as input/output variable. - */ - void RegisterSolution_time_n1(); - - /*! - * \brief Set the adjoint values of the solution. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void SetAdjointSolution(su2double *adj_sol); - - /*! - * \brief Get the adjoint values of the solution. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void GetAdjointSolution(su2double *adj_sol); - - /*! - * \brief Set the adjoint values of the solution at time n. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void SetAdjointSolution_time_n(su2double *adj_sol); - - /*! - * \brief Get the adjoint values of the solution at time n. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void GetAdjointSolution_time_n(su2double *adj_sol); - - /*! - * \brief Set the adjoint values of the solution at time n-1. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void SetAdjointSolution_time_n1(su2double *adj_sol); - - /*! - * \brief Get the adjoint values of the solution at time n-1. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void GetAdjointSolution_time_n1(su2double *adj_sol); - - /*! - * \brief Set the sensitivity at the node - * \param[in] iDim - spacial component - * \param[in] val - value of the Sensitivity - */ - virtual void SetSensitivity(unsigned short iDim, su2double val); - - /*! - * \brief Get the Sensitivity at the node - * \param[in] iDim - spacial component - * \return value of the Sensitivity - */ - virtual su2double GetSensitivity(unsigned short iDim); - - virtual void SetDual_Time_Derivative(unsigned short iVar, su2double der); - - virtual void SetDual_Time_Derivative_n(unsigned short iVar, su2double der); - - virtual su2double GetDual_Time_Derivative(unsigned short iVar); - - virtual su2double GetDual_Time_Derivative_n(unsigned short iVar); - - virtual void SetTauWall(su2double val_tau_wall); - - virtual su2double GetTauWall(); - - virtual void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity); - - virtual su2double GetVortex_Tilting(); - - virtual void SetDynamic_Derivative(unsigned short iVar, su2double der); - - virtual void SetDynamic_Derivative_n(unsigned short iVar, su2double der); - - virtual su2double GetDynamic_Derivative(unsigned short iVar); - - virtual su2double GetDynamic_Derivative_n(unsigned short iVar); - - virtual void SetDynamic_Derivative_Vel(unsigned short iVar, su2double der); - - virtual void SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der); - - virtual su2double GetDynamic_Derivative_Vel(unsigned short iVar); - - virtual su2double GetDynamic_Derivative_Vel_n(unsigned short iVar); - - virtual void SetDynamic_Derivative_Accel(unsigned short iVar, su2double der); - - virtual void SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der); - - virtual su2double GetDynamic_Derivative_Accel(unsigned short iVar); - - virtual su2double GetDynamic_Derivative_Accel_n(unsigned short iVar); - - virtual su2double GetSolution_Old_Vel(unsigned short iVar); - - virtual su2double GetSolution_Old_Accel(unsigned short iVar); - -}; - -/*! - * \class CBaselineVariable - * \brief Main class for defining the variables of a baseline solution from a restart file (for output). - * \author F. Palacios, T. Economon. - */ -class CBaselineVariable : public CVariable { -public: - - /*! - * \brief Constructor of the class. - */ - CBaselineVariable(void); - - /*! - * \overload - * \param[in] val_solution - Pointer to the flow value (initialization value). - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CBaselineVariable(su2double *val_solution, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - virtual ~CBaselineVariable(void); - -}; - -/*! - * \class CHeatFVMVariable - * \brief Main class for defining the variables of the finite-volume heat equation solver. - * \author O. Burghardt - * \version 6.2.0 "Falcon" - */ -class CHeatFVMVariable : public CVariable { -protected: - su2double *Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */ - su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ - -public: - - /*! - * \brief Constructor of the class. - */ - CHeatFVMVariable(void); - - /*! - * \overload - * \param[in] val_Heat - Values of the Heat solution (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CHeatFVMVariable(void); - -}; - -/*! - * \class CFEAVariable - * \brief Main class for defining the variables of the FEM Linear Elastic structural problem. - * \ingroup Structural Finite Element Analysis Variables - * \author F. Palacios, R. Sanchez. - * \version 6.2.0 "Falcon" - */ -class CFEAVariable : public CVariable { -protected: - - su2double *Stress; /*!< \brief Stress tensor. */ - - su2double *Residual_Ext_Body; /*!< \brief Term of the residual due to body forces */ - - su2double VonMises_Stress; /*!< \brief Von Mises stress. */ - - su2double *Solution_Vel, /*!< \brief Velocity of the nodes. */ - *Solution_Vel_time_n; /*!< \brief Velocity of the nodes at time n. */ - - su2double *Solution_Accel, /*!< \brief Acceleration of the nodes. */ - *Solution_Accel_time_n; /*!< \brief Acceleration of the nodes at time n. */ - - su2double *Solution_Pred, /*!< \brief Predictor of the solution for FSI purposes */ - *Solution_Pred_Old; /*!< \brief Predictor of the solution at time n for FSI purposes */ - - su2double *Reference_Geometry; /*!< \brief Reference solution for optimization problems */ - - su2double *Prestretch; /*!< \brief Prestretch geometry */ - - su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ - - -public: - - /*! - * \brief Constructor of the class. - */ - CFEAVariable(void); - - /*! - * \overload - * \param[in] val_fea - Values of the fea solution (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CFEAVariable(void); - - /*! - * \brief Get the value of the stress. - * \return Value of the stress. - */ - su2double *GetStress_FEM(void); - - /*! - * \brief Set the value of the stress at the node - * \param[in] iVar - index of the stress term - * \param[in] val_stress - value of the stress - */ - void SetStress_FEM(unsigned short iVar, su2double val_stress); - - /*! - * \brief Add a certain value to the value of the stress at the node - * \param[in] iVar - index of the stress term - * \param[in] val_stress - value of the stress - */ - void AddStress_FEM(unsigned short iVar, su2double val_stress); - - /*! - * \brief Add body forces to the residual term. - */ - void Add_BodyForces_Res(su2double *val_bodyForce); - - /*! - * \brief Clear the surface load residual - */ - void Clear_BodyForces_Res(void); - - /*! - * \brief Get the body forces. - */ - su2double Get_BodyForces_Res(unsigned short iVar); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_time_n(void); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_time_n(su2double *val_solution_time_n); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_time_n(unsigned short val_var, su2double val_solution); - - /*! - * \brief Set the value of the velocity (Structural Analysis). - * \param[in] val_solution - Solution of the problem (velocity). - */ - void SetSolution_Vel(su2double *val_solution_vel); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the solution for the index val_var. - */ - void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel); - - /*! - * \brief Set the value of the velocity (Structural Analysis) at time n. - * \param[in] val_solution - Solution of the problem (acceleration). - */ - void SetSolution_Vel_time_n(void); - - /*! - * \brief Set the value of the velocity (Structural Analysis) at time n. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_old - Value of the old solution for the index val_var. - */ - void SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n); - - /*! - * \brief Get the velocity (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetSolution_Vel(unsigned short val_var); - - /*! - * \brief Get the solution of the problem. - * \return Pointer to the solution vector. - */ - su2double *GetSolution_Vel(void); - - /*! - * \brief Get the velocity of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Vel_time_n(unsigned short val_var); - - /*! - * \brief Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - su2double *GetSolution_Vel_time_n(void); - - /*! - * \brief Set the value of the acceleration (Structural Analysis). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - void SetSolution_Accel(su2double *val_solution_accel); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the solution for the index val_var. - */ - void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel); - - /*! - * \brief Set the value of the acceleration (Structural Analysis) at time n. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n); - - /*! - * \brief Set the value of the acceleration (Structural Analysis) at time n. - * \param[in] val_solution - Solution of the problem (acceleration). - */ - void SetSolution_Accel_time_n(void); - - /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_old - Value of the old solution for the index val_var. - */ - void SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n); - - /*! - * \brief Get the acceleration (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetSolution_Accel(unsigned short val_var); - - /*! - * \brief Get the solution of the problem. - * \return Pointer to the solution vector. - */ - su2double *GetSolution_Accel(void); - - /*! - * \brief Get the acceleration of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Accel_time_n(unsigned short val_var); - - /*! - * \brief Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - su2double *GetSolution_Accel_time_n(void); - - /*! - * \brief Set the value of the solution predictor. - */ - void SetSolution_Pred(void); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_Pred(su2double *val_solution_pred); - - /*! - * \brief Set the value of the predicted solution. - * \param[in] val_var - Index of the variable - * \param[in] val_solution_pred - Value of the predicted solution. - */ - void SetSolution_Pred(unsigned short val_var, su2double val_solution_pred); - - /*! - * \brief Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Pred(unsigned short val_var); - - /*! - * \brief Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - su2double *GetSolution_Pred(void); - - /*! - * \brief Set the value of the solution predictor. - */ - void SetSolution_Pred_Old(void); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_Pred_Old(su2double *val_solution_pred_Old); - - /*! - * \brief A virtual member. Set the value of the old solution predicted. - * \param[in] val_var - Index of the variable - * \param[in] val_solution_pred_old - Value of the old predicted solution. - */ - void SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old); - - /*! - * \brief Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Pred_Old(unsigned short val_var); - - /*! - * \brief Get the solution at time n. - * \return Pointer to the solution (at time n) vector. - */ - su2double *GetSolution_Pred_Old(void); - - /*! - * \brief A virtual member. - */ - void SetPrestretch(unsigned short iVar, su2double val_prestretch); - - /*! - * \brief A virtual member. - */ - su2double *GetPrestretch(void); - - /*! - * \brief A virtual member. - */ - su2double GetPrestretch(unsigned short iVar); - - /*! - * \brief Set the value of the Von Mises stress. - * \param[in] val_stress - Value of the Von Mises stress. - */ - void SetVonMises_Stress(su2double val_stress); - - /*! - * \brief Get the value of the Von Mises stress. - * \return Value of the Von Mises stress. - */ - su2double GetVonMises_Stress(void); - - /*! - * \brief Set the reference geometry. - * \return Pointer to the solution (at time n) vector. - */ - void SetReference_Geometry(unsigned short iVar, su2double ref_geometry); - - /*! - * \brief Get the pointer to the reference geometry - */ - su2double *GetReference_Geometry(void); - - /*! - * \brief Get the value of the reference geometry for the coordinate iVar - */ - su2double GetReference_Geometry(unsigned short iVar); - - /*! - * \brief Register the variables in the solution time_n array as input/output variable. - * \param[in] input - input or output variables. - */ - void Register_femSolution_time_n(); - - /*! - * \brief Register the variables in the velocity array as input/output variable. - * \param[in] input - input or output variables. - */ - void RegisterSolution_Vel(bool input); - - /*! - * \brief Register the variables in the velocity time_n array as input/output variable. - */ - void RegisterSolution_Vel_time_n(); - - /*! - * \brief Register the variables in the acceleration array as input/output variable. - * \param[in] input - input or output variables. - */ - void RegisterSolution_Accel(bool input); - - /*! - * \brief Register the variables in the acceleration time_n array as input/output variable. - */ - void RegisterSolution_Accel_time_n(); - - /*! - * \brief Set the velocity adjoint values of the solution. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void SetAdjointSolution_Vel(su2double *adj_sol); - - /*! - * \brief Get the velocity adjoint values of the solution. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void GetAdjointSolution_Vel(su2double *adj_sol); - - /*! - * \brief Set the velocity adjoint values of the solution at time n. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void SetAdjointSolution_Vel_time_n(su2double *adj_sol); - - /*! - * \brief Get the velocity adjoint values of the solution at time n. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void GetAdjointSolution_Vel_time_n(su2double *adj_sol); - - /*! - * \brief Set the acceleration adjoint values of the solution. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void SetAdjointSolution_Accel(su2double *adj_sol); - - /*! - * \brief Get the acceleration adjoint values of the solution. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void GetAdjointSolution_Accel(su2double *adj_sol); - - /*! - * \brief Set the acceleration adjoint values of the solution at time n. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void SetAdjointSolution_Accel_time_n(su2double *adj_sol); - - /*! - * \brief Get the acceleration adjoint values of the solution at time n. - * \param[in] adj_sol - The adjoint values of the solution. - */ - void GetAdjointSolution_Accel_time_n(su2double *adj_sol); - - /*! - * \brief Set the value of the solution in the previous BGS subiteration. - */ - void Set_BGSSolution_k(void); - - /*! - * \brief Get the value of the solution in the previous BGS subiteration. - * \param[out] val_solution - solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution_k(unsigned short iDim); - -}; - -/*! - * \class CFEABoundVariable - * \brief Main class for defining the variables on the FEA boundaries for FSI applications. - * \ingroup Structural Finite Element Analysis Variables - * \author R. Sanchez. - * \version 6.2.0 "Falcon" - */ -class CFEABoundVariable : public CFEAVariable { -protected: - - su2double *FlowTraction; /*!< \brief Traction from the fluid field. */ - su2double *FlowTraction_n; /*!< \brief Traction from the fluid field at time n. */ - - su2double *Residual_Ext_Surf; /*!< \brief Term of the residual due to external forces */ - su2double *Residual_Ext_Surf_n; /*!< \brief Term of the residual due to external forces at time n */ - -public: - - /*! - * \brief Constructor of the class. - */ - CFEABoundVariable(void); - - /*! - * \overload - * \param[in] val_fea - Values of the fea solution (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CFEABoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CFEABoundVariable(void); - - /*! - * \brief Add surface load to the residual term - */ - void Add_SurfaceLoad_Res(su2double *val_surfForce); - - /*! - * \brief Set surface load of the residual term (for dampers - deletes all the other loads) - */ - void Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce); - - /*! - * \brief Get the residual term due to surface load - */ - su2double Get_SurfaceLoad_Res(unsigned short iVar); - - /*! - * \brief Clear the surface load residual - */ - void Clear_SurfaceLoad_Res(void); - - /*! - * \brief Store the surface load as the load for the previous time step. - */ - void Set_SurfaceLoad_Res_n(void); - - /*! - * \brief Get the surface load from the previous time step. - */ - su2double Get_SurfaceLoad_Res_n(unsigned short iVar); - - /*! - * \brief Set the flow traction at a node on the structural side - */ - void Set_FlowTraction(su2double *val_flowTraction); - - /*! - * \brief Add a value to the flow traction at a node on the structural side - */ - void Add_FlowTraction(su2double *val_flowTraction); - - /*! - * \brief Get the residual term due to the flow traction - */ - su2double Get_FlowTraction(unsigned short iVar); - - /*! - * \brief Set the value of the flow traction at the previous time step. - */ - void Set_FlowTraction_n(void); - - /*! - * \brief Retrieve the value of the flow traction from the previous time step. - */ - su2double Get_FlowTraction_n(unsigned short iVar); - - /*! - * \brief Clear the flow traction residual - */ - void Clear_FlowTraction(void); - - /*! - * \brief Get whether this node is on the boundary - */ - bool Get_isVertex(void); - -}; - -/*! - * \class CEulerVariable - * \brief Main class for defining the variables of the compressible Euler solver. - * \ingroup Euler_Equations - * \author F. Palacios, T. Economon - */ -class CEulerVariable : public CVariable { -protected: - su2double Velocity2; /*!< \brief Square of the velocity vector. */ - su2double *HB_Source; /*!< \brief harmonic balance source term. */ - su2double Precond_Beta; /*!< \brief Low Mach number preconditioner value, Beta. */ - su2double *WindGust; /*! < \brief Wind gust value */ - su2double *WindGustDer; /*! < \brief Wind gust derivatives value */ - - /*--- Primitive variable definition ---*/ - - su2double *Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ - su2double **Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ - su2double *Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ - - /*--- Secondary variable definition ---*/ - - su2double *Secondary; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ - su2double **Gradient_Secondary; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ - su2double *Limiter_Secondary; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ - - /*--- New solution container for Classical RK4 ---*/ - - su2double *Solution_New; - - /*--- Old solution container for BGS iterations ---*/ - su2double* Solution_BGS_k; - -public: - - /*! - * \brief Constructor of the class. - */ - CEulerVariable(void); - - /*! - * \overload - * \param[in] val_density - Value of the flow density (initialization value). - * \param[in] val_velocity - Value of the flow velocity (initialization value). - * \param[in] val_energy - Value of the flow energy (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CEulerVariable(su2double val_density, su2double *val_velocity, su2double val_energy, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_solution - Pointer to the flow value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - virtual ~CEulerVariable(void); - - /*! - * \brief Get the new solution of the problem (Classical RK4). - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_New(unsigned short val_var); - - /*! - * \brief Set the new solution container for Classical RK4. - */ - void SetSolution_New(void); - - /*! - * \brief Add a value to the new solution container for Classical RK4. - * \param[in] val_var - Number of the variable. - * \param[in] val_solution - Value that we want to add to the solution. - */ - void AddSolution_New(unsigned short val_var, su2double val_solution); - - /*! - * \brief Set to zero the gradient of the primitive variables. - */ - void SetGradient_PrimitiveZero(unsigned short val_primvar); - - /*! - * \brief Add val_value to the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to add to the gradient of the primitive variables. - */ - void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Subtract val_value to the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to subtract to the gradient of the primitive variables. - */ - void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Get the value of the primitive variables gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the primitive variables gradient. - */ - su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim); - - /*! - * \brief Get the value of the primitive variables gradient. - * \param[in] val_var - Index of the variable. - * \return Value of the primitive variables gradient. - */ - su2double GetLimiter_Primitive(unsigned short val_var); - - /*! - * \brief Set the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient. - */ - void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Set the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_value - Value of the gradient. - */ - void SetLimiter_Primitive(unsigned short val_var, su2double val_value); - - /*! - * \brief Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - su2double **GetGradient_Primitive(void); - - /*! - * \brief Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - su2double *GetLimiter_Primitive(void); - - /*! - * \brief Set to zero the gradient of the primitive variables. - */ - void SetGradient_SecondaryZero(unsigned short val_secondaryvar); - - /*! - * \brief Add val_value to the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to add to the gradient of the primitive variables. - */ - void AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Subtract val_value to the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to subtract to the gradient of the primitive variables. - */ - void SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Get the value of the primitive variables gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the primitive variables gradient. - */ - su2double GetGradient_Secondary(unsigned short val_var, unsigned short val_dim); - - /*! - * \brief Get the value of the primitive variables gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the primitive variables gradient. - */ - su2double GetLimiter_Secondary(unsigned short val_var); - - /*! - * \brief Set the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient. - */ - void SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Set the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient. - */ - void SetLimiter_Secondary(unsigned short val_var, su2double val_value); - - /*! - * \brief Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - su2double **GetGradient_Secondary(void); - - /*! - * \brief Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - su2double *GetLimiter_Secondary(void); - - /*! - * \brief A virtual member. - */ - void SetdPdrho_e(su2double dPdrho_e); - - /*! - * \brief A virtual member. - */ - void SetdPde_rho(su2double dPde_rho); - - /*! - * \brief Set the value of the pressure. - */ - bool SetPressure(su2double Gamma); - - /*! - * \brief Set the value of the speed of the sound. - * \param[in] Gamma - Value of Gamma. - */ - bool SetSoundSpeed(su2double Gamma); - - /*! - * \brief Set the value of the enthalpy. - */ - void SetEnthalpy(void); - - /*! - * \brief Set all the primitive variables for compressible flows. - */ - bool SetPrimVar(CFluidModel *FluidModel); - - /*! - * \brief A virtual member. - */ - void SetSecondaryVar(CFluidModel *FluidModel); - - /*! - * \brief Get the primitive variables. - * \param[in] val_var - Index of the variable. - * \return Value of the primitive variable for the index val_var. - */ - su2double GetPrimitive(unsigned short val_var); - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_var - Index of the variable. - * \return Set the value of the primitive variable for the index val_var. - */ - void SetPrimitive(unsigned short val_var, su2double val_prim); - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_prim - Primitive variables. - * \return Set the value of the primitive variable for the index val_var. - */ - void SetPrimitive(su2double *val_prim); - - /*! - * \brief Get the primitive variables of the problem. - * \return Pointer to the primitive variable vector. - */ - su2double *GetPrimitive(void); - - /*! - * \brief Get the primitive variables. - * \param[in] val_var - Index of the variable. - * \return Value of the primitive variable for the index val_var. - */ - su2double GetSecondary(unsigned short val_var); - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_var - Index of the variable. - * \return Set the value of the primitive variable for the index val_var. - */ - void SetSecondary(unsigned short val_var, su2double val_secondary); - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_prim - Primitive variables. - * \return Set the value of the primitive variable for the index val_var. - */ - void SetSecondary(su2double *val_secondary); - - /*! - * \brief Get the primitive variables of the problem. - * \return Pointer to the primitive variable vector. - */ - su2double *GetSecondary(void); - - /*! - * \brief Set the value of the density for the incompressible flows. - */ - bool SetDensity(void); - - /*! - * \brief Set the value of the temperature. - * \param[in] Gas_Constant - Value of Gas Constant - */ - bool SetTemperature(su2double Gas_Constant); - - /*! - * \brief Get the norm 2 of the velocity. - * \return Norm 2 of the velocity vector. - */ - su2double GetVelocity2(void); - - /*! - * \brief Get the flow pressure. - * \return Value of the flow pressure. - */ - su2double GetPressure(void); - - /*! - * \brief Get the speed of the sound. - * \return Value of speed of the sound. - */ - su2double GetSoundSpeed(void); - - /*! - * \brief Get the enthalpy of the flow. - * \return Value of the enthalpy of the flow. - */ - su2double GetEnthalpy(void); - - /*! - * \brief Get the density of the flow. - * \return Value of the density of the flow. - */ - su2double GetDensity(void); - - /*! - * \brief Get the energy of the flow. - * \return Value of the energy of the flow. - */ - su2double GetEnergy(void); - - /*! - * \brief Get the temperature of the flow. - * \return Value of the temperature of the flow. - */ - su2double GetTemperature(void); - - /*! - * \brief Get the velocity of the flow. - * \param[in] val_dim - Index of the dimension. - * \return Value of the velocity for the dimension val_dim. - */ - su2double GetVelocity(unsigned short val_dim); - - /*! - * \brief Get the projected velocity in a unitary vector direction (compressible solver). - * \param[in] val_vector - Direction of projection. - * \return Value of the projected velocity. - */ - su2double GetProjVel(su2double *val_vector); - - /*! - * \brief Set the velocity vector from the solution. - * \param[in] val_velocity - Pointer to the velocity. - */ - void SetVelocity(void); - - /*! - * \brief Set the velocity vector from the old solution. - * \param[in] val_velocity - Pointer to the velocity. - */ - void SetVelocity_Old(su2double *val_velocity); - - /*! - * \brief Set the harmonic balance source term. - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the harmonic balance source term. for the index val_var. - */ - void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source); - - /*! - * \brief Get the harmonic balance source term. - * \param[in] val_var - Index of the variable. - * \return Value of the harmonic balance source term for the index val_var. - */ - su2double GetHarmonicBalance_Source(unsigned short val_var); - - /*! - * \brief Get the value of the preconditioner Beta. - * \return Value of the low Mach preconditioner variable Beta - */ - su2double GetPreconditioner_Beta(); - - /*! - * \brief Set the value of the preconditioner Beta. - * \param[in] Value of the low Mach preconditioner variable Beta - */ - void SetPreconditioner_Beta(su2double val_Beta); - - /*! - * \brief Get the value of the wind gust - * \return Value of the wind gust - */ - su2double* GetWindGust(); - - /*! - * \brief Set the value of the wind gust - * \param[in] Value of the wind gust - */ - void SetWindGust(su2double* val_WindGust); - - /*! - * \brief Get the value of the derivatives of the wind gust - * \return Value of the derivatives of the wind gust - */ - su2double* GetWindGustDer(); - - /*! - * \brief Set the value of the derivatives of the wind gust - * \param[in] Value of the derivatives of the wind gust - */ - void SetWindGustDer(su2double* val_WindGust); - - /*! - * \brief Set the value of the solution in the previous BGS subiteration. - */ - void Set_BGSSolution_k(void); - - /*! - * \brief Get the value of the solution in the previous BGS subiteration. - * \param[out] val_solution - solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution_k(unsigned short iDim); -}; - -/*! - * \class CIncEulerVariable - * \brief Main class for defining the variables of the incompressible Euler solver. - * \ingroup Euler_Equations - * \author F. Palacios, T. Economon, T. Albring - */ -class CIncEulerVariable : public CVariable { -protected: - su2double Velocity2; /*!< \brief Square of the velocity vector. */ - - /*--- Primitive variable definition ---*/ - - su2double *Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ - su2double **Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ - su2double *Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ - - /*--- Old solution container for BGS iterations ---*/ - - su2double* Solution_BGS_k; - - /*--- Old density for variable density turbulent flows (SST). ---*/ - - su2double Density_Old; - -public: - - /*! - * \brief Constructor of the class. - */ - CIncEulerVariable(void); - - /*! - * \overload - * \param[in] val_pressure - value of the pressure. - * \param[in] val_velocity - Value of the flow velocity (initialization value). - * \param[in] val_temperature - Value of the temperature (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CIncEulerVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_solution - Pointer to the flow value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CIncEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - virtual ~CIncEulerVariable(void); - - /*! - * \brief Set to zero the gradient of the primitive variables. - */ - void SetGradient_PrimitiveZero(unsigned short val_primvar); - - /*! - * \brief Add val_value to the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to add to the gradient of the primitive variables. - */ - void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Subtract val_value to the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value to subtract to the gradient of the primitive variables. - */ - void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Get the value of the primitive variables gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \return Value of the primitive variables gradient. - */ - su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim); - - /*! - * \brief Get the value of the primitive variables gradient. - * \param[in] val_var - Index of the variable. - * \return Value of the primitive variables gradient. - */ - su2double GetLimiter_Primitive(unsigned short val_var); - - /*! - * \brief Set the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. - * \param[in] val_value - Value of the gradient. - */ - void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value); - - /*! - * \brief Set the gradient of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_value - Value of the gradient. - */ - void SetLimiter_Primitive(unsigned short val_var, su2double val_value); - - /*! - * \brief Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - su2double **GetGradient_Primitive(void); - - /*! - * \brief Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - su2double *GetLimiter_Primitive(void); - - /*! - * \brief Set the value of the pressure. - */ - void SetPressure(); - - /*! - * \brief Get the primitive variables. - * \param[in] val_var - Index of the variable. - * \return Value of the primitive variable for the index val_var. - */ - su2double GetPrimitive(unsigned short val_var); - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_var - Index of the variable. - * \param[in] val_var - Index of the variable. - * \return Set the value of the primitive variable for the index val_var. - */ - void SetPrimitive(unsigned short val_var, su2double val_prim); - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_prim - Primitive variables. - * \return Set the value of the primitive variable for the index val_var. - */ - void SetPrimitive(su2double *val_prim); - - /*! - * \brief Get the primitive variables of the problem. - * \return Pointer to the primitive variable vector. - */ - su2double *GetPrimitive(void); - - /*! - * \brief Set the value of the density for the incompressible flows. - */ - bool SetDensity(su2double val_density); - - /*! - * \brief Set the value of the density for the incompressible flows. - */ - void SetVelocity(void); - - /*! - * \brief Set the value of the temperature for incompressible flows with energy equation. - */ - bool SetTemperature(su2double val_temperature); - - /*! - * \brief Set the value of the beta coeffient for incompressible flows. - */ - void SetBetaInc2(su2double val_betainc2); - - /*! - * \brief Get the norm 2 of the velocity. - * \return Norm 2 of the velocity vector. - */ - su2double GetVelocity2(void); - - /*! - * \brief Get the flow pressure. - * \return Value of the flow pressure. - */ - su2double GetPressure(void); - - /*! - * \brief Get the value of beta squared for the incompressible flow - * \return Value of beta squared. - */ - su2double GetBetaInc2(void); - - /*! - * \brief Get the density of the flow. - * \return Value of the density of the flow. - */ - su2double GetDensity(void); - - /*! - * \brief Get the density of the flow from the previous iteration. - * \return Old value of the density of the flow. - */ - su2double GetDensity_Old(void); - - /*! - * \brief Get the temperature of the flow. - * \return Value of the temperature of the flow. - */ - su2double GetTemperature(void); - - /*! - * \brief Get the velocity of the flow. - * \param[in] val_dim - Index of the dimension. - * \return Value of the velocity for the dimension val_dim. - */ - su2double GetVelocity(unsigned short val_dim); - - /*! - * \brief Get the projected velocity in a unitary vector direction (compressible solver). - * \param[in] val_vector - Direction of projection. - * \return Value of the projected velocity. - */ - su2double GetProjVel(su2double *val_vector); - - /*! - * \brief Set the velocity vector from the old solution. - * \param[in] val_velocity - Pointer to the velocity. - */ - void SetVelocity_Old(su2double *val_velocity); - - /*! - * \brief Set all the primitive variables for incompressible flows. - */ - bool SetPrimVar(CFluidModel *FluidModel); - - /*! - * \brief Set the specific heat Cp. - */ - void SetSpecificHeatCp(su2double Cp); - - /*! - * \brief Set the specific heat Cv. - */ - void SetSpecificHeatCv(su2double Cv); - - /*! - * \brief Get the specific heat at constant P of the flow. - * \return Value of the specific heat at constant P of the flow. - */ - su2double GetSpecificHeatCp(void); - - /*! - * \brief Get the specific heat at constant V of the flow. - * \return Value of the specific heat at constant V of the flow. - */ - su2double GetSpecificHeatCv(void); - - /*! - * \brief Set the value of the solution in the previous BGS subiteration. - */ - void Set_BGSSolution_k(void); - - /*! - * \brief Get the value of the solution in the previous BGS subiteration. - * \param[out] val_solution - solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution_k(unsigned short iDim); - -}; - -/*! - * \class CNSVariable - * \brief Main class for defining the variables of the compressible Navier-Stokes solver. - * \ingroup Navier_Stokes_Equations - * \author F. Palacios, T. Economon - */ -class CNSVariable : public CEulerVariable { -private: - su2double Prandtl_Lam; /*!< \brief Laminar Prandtl number. */ - su2double Prandtl_Turb; /*!< \brief Turbulent Prandtl number. */ - su2double Temperature_Ref; /*!< \brief Reference temperature of the fluid. */ - su2double Viscosity_Ref; /*!< \brief Reference viscosity of the fluid. */ - su2double Viscosity_Inf; /*!< \brief Viscosity of the fluid at the infinity. */ - su2double Vorticity[3]; /*!< \brief Vorticity of the fluid. */ - su2double StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ - su2double Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ - su2double DES_LengthScale; /*!< \brief DES Length Scale. */ - su2double inv_TimeScale; /*!< \brief Inverse of the reference time scale. */ - su2double Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */ - su2double Vortex_Tilting; /*!< \brief Value of the vortex tilting variable for DES length scale computation. */ - -public: - - /*! - * \brief Constructor of the class. - */ - CNSVariable(void); - - /*! - * \overload - * \param[in] val_density - Value of the flow density (initialization value). - * \param[in] val_velocity - Value of the flow velocity (initialization value). - * \param[in] val_energy - Value of the flow energy (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CNSVariable(su2double val_density, su2double *val_velocity, - su2double val_energy, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_solution - Pointer to the flow value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CNSVariable(void); - - /*! - * \brief Set the laminar viscosity. - */ - void SetLaminarViscosity(su2double laminarViscosity); - - /*! - * \brief Set the laminar viscosity. - */ - void SetThermalConductivity(su2double thermalConductivity); - - /*! - * \brief Set the specific heat Cp. - */ - void SetSpecificHeatCp(su2double Cp); - - /*! - * \brief Set the vorticity value. - */ - bool SetVorticity(void); - - /*! - * \brief Set the rate of strain magnitude. - */ - bool SetStrainMag(void); - - /*! - * \overload - * \param[in] eddy_visc - Value of the eddy viscosity. - */ - void SetEddyViscosity(su2double eddy_visc); - - /*! - * \brief Get the laminar viscosity of the flow. - * \return Value of the laminar viscosity of the flow. - */ - su2double GetLaminarViscosity(void); - - /*! - * \brief Get the thermal conductivity of the flow. - * \return Value of the laminar viscosity of the flow. - */ - su2double GetThermalConductivity(void); - - /*! - * \brief Get the eddy viscosity of the flow. - * \return The eddy viscosity of the flow. - */ - su2double GetEddyViscosity(void); - - /*! - * \brief Get the specific heat at constant P of the flow. - * \return Value of the specific heat at constant P of the flow. - */ - su2double GetSpecificHeatCp(void); - - /*! - * \brief Set the temperature at the wall - */ - void SetWallTemperature(su2double temperature_wall); - - /*! - * \brief Get the value of the vorticity. - * \param[in] val_dim - Index of the dimension. - * \return Value of the vorticity. - */ - su2double *GetVorticity(void); - - /*! - * \brief Get the value of the magnitude of rate of strain. - * \return Value of the rate of strain magnitude. - */ - su2double GetStrainMag(void); - - /*! - * \brief Set the derivative of temperature with respect to density (at constant internal energy). - */ - void SetdTdrho_e(su2double dTdrho_e); - - /*! - * \brief Set the derivative of temperature with respect to internal energy (at constant density). - */ - void SetdTde_rho(su2double dTde_rho); - - /*! - * \brief Set the derivative of laminar viscosity with respect to density (at constant temperature). - */ - void Setdmudrho_T(su2double dmudrho_T); - - /*! - * \brief Set the derivative of laminar viscosity with respect to temperature (at constant density). - */ - void SetdmudT_rho(su2double dmudT_rho); - - /*! - * \brief Set the derivative of thermal conductivity with respect to density (at constant temperature). - */ - void Setdktdrho_T(su2double dktdrho_T); - - /*! - * \brief Set the derivative of thermal conductivity with respect to temperature (at constant density). - */ - void SetdktdT_rho(su2double dktdT_rho); - - /*! - * \brief Set all the primitive variables for compressible flows - */ - bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); - using CVariable::SetPrimVar; - - /*! - * \brief Set all the secondary variables (partial derivatives) for compressible flows - */ - void SetSecondaryVar(CFluidModel *FluidModel); - - /*! - * \brief Set the value of the wall shear stress computed by a wall function. - */ - void SetTauWall(su2double val_tau_wall); - - /*! - * \brief Get the value of the wall shear stress computed by a wall function. - * \return Value of the wall shear stress computed by a wall function. - */ - su2double GetTauWall(void); - - /*! - * \brief Get the DES length scale - * \return Value of the DES length Scale. - */ - su2double GetDES_LengthScale(void); - - /*! - * \brief Set the DES Length Scale. - */ - void SetDES_LengthScale(su2double val_des_lengthscale); - - /*! - * \brief Set the new solution for Roe Dissipation. - * \param[in] val_delta - A scalar measure of the grid size - * \param[in] val_const_DES - The DES constant (C_DES) - */ - void SetRoe_Dissipation_NTS(su2double val_delta, su2double val_const_DES); - - /*! - * \brief Set the new solution for Roe Dissipation. - */ - void SetRoe_Dissipation_FD(su2double wall_distance); - - /*! - * \brief Get the Roe Dissipation Coefficient. - * \return Value of the Roe Dissipation. - */ - su2double GetRoe_Dissipation(void); - - /*! - * \brief Set the Roe Dissipation Coefficient. - * \param[in] val_dissipation - Value of the Roe dissipation factor. - */ - void SetRoe_Dissipation(su2double val_dissipation); - -}; - -/*! - * \class CIncNSVariable - * \brief Main class for defining the variables of the incompressible Navier-Stokes solver. - * \ingroup Navier_Stokes_Equations - * \author F. Palacios, T. Economon, T. Albring - */ -class CIncNSVariable : public CIncEulerVariable { -private: - su2double Vorticity[3]; /*!< \brief Vorticity of the fluid. */ - su2double StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ - - su2double DES_LengthScale; -public: - - /*! - * \brief Constructor of the class. - */ - CIncNSVariable(void); - - /*! - * \overload - * \param[in] val_pressure - value of the pressure. - * \param[in] val_velocity - Value of the flow velocity (initialization value). - * \param[in] val_temperature - Value of the temperature (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CIncNSVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_solution - Pointer to the flow value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CIncNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CIncNSVariable(void); - - /*! - * \brief Set the laminar viscosity. - */ - void SetLaminarViscosity(su2double laminarViscosity); - - /*! - * \brief Set the vorticity value. - */ - bool SetVorticity(void); - - /*! - * \brief Set the rate of strain magnitude. - */ - bool SetStrainMag(void); - - /*! - * \overload - * \param[in] eddy_visc - Value of the eddy viscosity. - */ - void SetEddyViscosity(su2double eddy_visc); - - /*! - * \brief Get the laminar viscosity of the flow. - * \return Value of the laminar viscosity of the flow. - */ - su2double GetLaminarViscosity(void); - - /*! - * \brief Get the eddy viscosity of the flow. - * \return The eddy viscosity of the flow. - */ - su2double GetEddyViscosity(void); - - /*! - * \brief Set the thermal conductivity. - */ - void SetThermalConductivity(su2double thermalConductivity); - - /*! - * \brief Get the thermal conductivity of the flow. - * \return Value of the laminar viscosity of the flow. - */ - su2double GetThermalConductivity(void); - - /*! - * \brief Get the value of the vorticity. - * \param[in] val_dim - Index of the dimension. - * \return Value of the vorticity. - */ - su2double *GetVorticity(void); - - /*! - * \brief Get the value of the magnitude of rate of strain. - * \return Value of the rate of strain magnitude. - */ - su2double GetStrainMag(void); - - /*! - * \brief Set all the primitive variables for incompressible flows - */ - bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); - using CVariable::SetPrimVar; - - /*! - * \brief Set the DES Length Scale. - */ - void SetDES_LengthScale(su2double val_des_lengthscale); - - /*! - * \brief Get the DES length scale - * \return Value of the DES length Scale. - */ - su2double GetDES_LengthScale(void); - -}; - -/*! - * \class CTurbVariable - * \brief Main class for defining the variables of the turbulence model. - * \ingroup Turbulence_Model - * \author A. Bueno. - */ -class CTurbVariable : public CVariable { -protected: - su2double muT; /*!< \brief Eddy viscosity. */ - su2double *HB_Source; /*!< \brief Harmonic Balance source term. */ - -public: - /*! - * \brief Constructor of the class. - */ - CTurbVariable(void); - - /*! - * \overload - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CTurbVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - virtual ~CTurbVariable(void); - - /*! - * \brief Get the value of the eddy viscosity. - * \return the value of the eddy viscosity. - */ - su2double GetmuT(); - - /*! - * \brief Set the value of the eddy viscosity. - * \param[in] val_muT - Value of the eddy viscosity. - */ - void SetmuT(su2double val_muT); -}; - -/*! - * \class CTurbSAVariable - * \brief Main class for defining the variables of the turbulence model. - * \ingroup Turbulence_Model - * \author A. Bueno. - */ - -class CTurbSAVariable : public CTurbVariable { - -private: - su2double gamma_BC; /*!< \brief Value of the intermittency for the BC trans. model. */ - su2double DES_LengthScale; - su2double Vortex_Tilting; - -public: - /*! - * \brief Constructor of the class. - */ - CTurbSAVariable(void); - - /*! - * \overload - * \param[in] val_nu_tilde - Turbulent variable value (initialization value). - * \param[in] val_muT - The eddy viscosity - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CTurbSAVariable(void); - - /*! - * \brief Set the harmonic balance source term. - * \param[in] val_var - Index of the variable. - * \param[in] val_source - Value of the harmonic balance source term. for the index val_var. - */ - void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source); - - /*! - * \brief Get the harmonic balance source term. - * \param[in] val_var - Index of the variable. - * \return Value of the harmonic balance source term for the index val_var. - */ - su2double GetHarmonicBalance_Source(unsigned short val_var); - - /*! - * \brief Get the intermittency of the BC transition model. - * \return Value of the intermittency of the BC transition model. - */ - su2double GetGammaBC(void); - - /*! - * \brief Set the intermittency of the BC transition model. - * \param[in] val_gamma - New value of the intermittency. - */ - void SetGammaBC(su2double val_gamma); - - /*! - * \brief Get the DES length scale - * \return Value of the DES length Scale. - */ - su2double GetDES_LengthScale(void); - - /*! - * \brief Set the DES Length Scale. - */ - void SetDES_LengthScale(su2double val_des_lengthscale); - - /*! - * \brief Set the vortex tilting measure for computation of the EDDES length scale - */ - void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity); - - /*! - * \brief Get the vortex tilting measure for computation of the EDDES length scale - * \return Value of the DES length Scale - */ - su2double GetVortex_Tilting(); - -}; - -/*! - * \class CTransLMVariable - * \brief Main class for defining the variables of the turbulence model. - * \ingroup Turbulence_Model - * \author A. Bueno. - */ - -class CTransLMVariable : public CTurbVariable { -protected: - su2double gamma_sep; - -public: - - /*! - * \brief Constructor of the class. - */ - CTransLMVariable(void); - - /*! - * \overload - * \param[in] val_nu_tilde - Turbulent variable value (initialization value). - * \param[in] val_intermittency - * \param[in] val_REth - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CTransLMVariable(su2double val_nu_tilde, su2double val_intermittency, su2double val_REth, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CTransLMVariable(void); - - /*! - * \brief ________________. - */ - su2double GetIntermittency(void); - - /*! - * \brief ________________. - * \param[in] gamma_sep_in - */ - void SetGammaSep(su2double gamma_sep_in); - - /*! - * \brief ________________. - */ - void SetGammaEff(void); - -}; - -/*! - * \class CTurbSSTVariable - * \brief Main class for defining the variables of the turbulence model. - * \ingroup Turbulence_Model - * \author A. Bueno. - */ - -class CTurbSSTVariable : public CTurbVariable { -protected: - su2double sigma_om2, - beta_star; - su2double F1, /*!< \brief Menter blending function for blending of k-w and k-eps. */ - F2, /*!< \brief Menter blending function for stress limiter. */ - CDkw; /*!< \brief Cross-diffusion. */ - -public: - /*! - * \brief Constructor of the class. - */ - CTurbSSTVariable(void); - - /*! - * \overload - * \param[in] val_rho_kine - Turbulent variable value (initialization value). - * \param[in] val_rho_omega - Turbulent variable value (initialization value). - * \param[in] val_muT - Turbulent variable value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] constants - - * \param[in] config - Definition of the particular problem. - */ - CTurbSSTVariable(su2double val_rho_kine, su2double val_rho_omega, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, - su2double *constants, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CTurbSSTVariable(void); - - /*! - * \brief Set the blending function for the blending of k-w and k-eps. - * \param[in] val_viscosity - Value of the vicosity. - * \param[in] val_dist - Value of the distance to the wall. - * \param[in] val_density - Value of the density. - */ - void SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density); - - /*! - * \brief Get the first blending function. - */ - su2double GetF1blending(void); - - /*! - * \brief Get the second blending function. - */ - su2double GetF2blending(void); - - /*! - * \brief Get the value of the cross diffusion of tke and omega. - */ - su2double GetCrossDiff(void); -}; - - -/*! - * \class CAdjEulerVariable - * \brief Main class for defining the variables of the adjoint Euler solver. - * \ingroup Euler_Equations - * \author F. Palacios, T. Economon - */ -class CAdjEulerVariable : public CVariable { -protected: - su2double *Psi; /*!< \brief Vector of the adjoint variables. */ - su2double *ForceProj_Vector; /*!< \brief Vector d. */ - su2double *ObjFuncSource; /*!< \brief Vector containing objective function sensitivity for discrete adjoint. */ - su2double *IntBoundary_Jump; /*!< \brief Interior boundary jump vector. */ - su2double *HB_Source; /*!< \brief Harmonic balance source term. */ - bool incompressible; -public: - - /*! - * \brief Constructor of the class. - */ - CAdjEulerVariable(void); - - /*! - * \overload - * \param[in] val_psirho - Value of the adjoint density (initialization value). - * \param[in] val_phi - Value of the adjoint velocity (initialization value). - * \param[in] val_psie - Value of the adjoint energy (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CAdjEulerVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_solution - Pointer to the adjoint value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CAdjEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - virtual ~CAdjEulerVariable(void); - - /*! - * \brief Set all the primitive variables for compressible flows. - */ - bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config); - - /*! - * \brief Set the value of the adjoint velocity. - * \param[in] val_phi - Value of the adjoint velocity. - */ - void SetPhi_Old(su2double *val_phi); - - /*! - * \brief Set the value of the force projection vector. - * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. - */ - void SetForceProj_Vector(su2double *val_ForceProj_Vector); - - /*! - * \brief Set the value of the objective function source. - * \param[in] val_SetObjFuncSource - Pointer to the objective function source. - */ - void SetObjFuncSource(su2double *val_SetObjFuncSource); - - /*! - * \brief Set the value of the interior boundary jump vector vector. - * \param[in] val_IntBoundary_Jump - Pointer to the interior boundary jump vector. - */ - void SetIntBoundary_Jump(su2double *val_IntBoundary_Jump); - - /*! - * \brief Get the value of the force projection vector. - * \return Pointer to the force projection vector. - */ - su2double *GetForceProj_Vector(void); - - /*! - * \brief Get the value of the objective function source. - * \param[in] val_SetObjFuncSource - Pointer to the objective function source. - */ - su2double *GetObjFuncSource(void); - - /*! - * \brief Get the value of the force projection vector. - * \return Pointer to the force projection vector. - */ - su2double *GetIntBoundary_Jump(void); - - /*! - * \brief Set the harmonic balance source term. - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the harmonic balance source term. for the index val_var. - */ - void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source); - - /*! - * \brief Get the harmonic balance source term. - * \param[in] val_var - Index of the variable. - * \return Value of the harmonic balance source term for the index val_var. - */ - su2double GetHarmonicBalance_Source(unsigned short val_var); -}; - -/*! - * \class CAdjNSVariable - * \brief Main class for defining the variables of the adjoint Navier-Stokes solver. - * \ingroup Navier_Stokes_Equations - * \author F. Palacios - */ -class CAdjNSVariable : public CAdjEulerVariable { -private: - -public: - - /*! - * \brief Constructor of the class. - */ - CAdjNSVariable(void); - - /*! - * \overload - * \param[in] val_psirho - Value of the adjoint density (initialization value). - * \param[in] val_phi - Value of the adjoint velocity (initialization value). - * \param[in] val_psie - Value of the adjoint energy (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CAdjNSVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_solution - Pointer to the adjoint value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CAdjNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CAdjNSVariable(void); - - /*! - * \brief Set the value of the adjoint velocity. - * \param[in] val_phi - Value of the adjoint velocity. - */ - void SetPhi_Old(su2double *val_phi); - - /*! - * \brief Set the value of the force projection vector. - * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. - */ - void SetForceProj_Vector(su2double *val_ForceProj_Vector); - - /*! - * \brief Get the value of the force projection vector. - * \return Pointer to the force projection vector. - */ - su2double *GetForceProj_Vector(void); - - /*! - * \brief Set the value of the force projection vector on the solution vector. - */ - void SetVelSolutionOldDVector(void); - - /*! - * \brief Set the value of the force projection vector on the old solution vector. - */ - void SetVelSolutionDVector(void); - -}; - -/*! - * \class CAdjTurbVariable - * \brief Main class for defining the variables of the adjoint turbulence model. - * \ingroup Turbulence_Model - * \author A. Bueno. - */ -class CAdjTurbVariable : public CVariable { -protected: - su2double *dmuT_dUTvar; /*!< \brief Sensitivity of eddy viscosity to mean flow and turbulence vars. */ - su2double **dRTstar_dUTvar; /*!< \brief Sensitivity of modified turbulence residual (no boundary flux) - to mean flow and turbulence vars. */ - su2double **dFT_dUTvar; /*!< \brief Sensitivity of boundary flux - to mean flow and turbulence vars. */ - su2double *EddyViscSens; /*!< \brief Eddy Viscosity Sensitivity. */ - -public: - - /*! - * \brief Constructor of the class. - */ - CAdjTurbVariable(void); - - /*! - * \overload - * \param[in] val_psinu_inf - Value of the adjoint turbulence variable at the infinity (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CAdjTurbVariable(void); - - /*! - * \brief Set the Eddy Viscosity Sensitivity of the problem. - * \param[in] val_EddyViscSens - Eddy Viscosity Sensitivity. - */ - void SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar); - - /*! - * \brief Get the Eddy Viscosity Sensitivity of the problem. - * \return Pointer to the Eddy Viscosity Sensitivity. - */ - su2double *GetEddyViscSens(void); -}; - -/*! - * \class CTemplateVariable - * \brief Main class for defining the variables of the potential solver. - * \ingroup Potential_Flow_Equation - * \author F. Palacios - */ -class CTemplateVariable : public CVariable { -public: - - /*! - * \brief Constructor of the class. - */ - CTemplateVariable(void); - - /*! - * \overload - * \param[in] val_potential - Value of the potential solution (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CTemplateVariable(su2double val_potential, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CTemplateVariable(void); -}; - -/*! - * \class CDiscAdjVariable - * \brief Main class for defining the variables of the adjoint solver. - * \ingroup Discrete_Adjoint - * \author T. Albring. - */ -class CDiscAdjVariable : public CVariable { -private: - su2double* Sensitivity; /* Vector holding the derivative of target functional with respect to the coordinates at this node*/ - su2double* Solution_Direct; - su2double* DualTime_Derivative; - su2double* DualTime_Derivative_n; - - su2double* Cross_Term_Derivative; - su2double* Geometry_CrossTerm_Derivative; - su2double* Geometry_CrossTerm_Derivative_Flow; - - su2double* Solution_Geometry; - su2double* Solution_Geometry_Old; - su2double* Geometry_Direct; - - su2double* Solution_BGS; - su2double* Solution_BGS_k; - su2double* Solution_Geometry_BGS_k; - -public: - /*! - * \brief Constructor of the class. - */ - CDiscAdjVariable(void); - - /*! - * \brief Destructor of the class. - */ - ~CDiscAdjVariable(void); - - /*! - * \overload - * \param[in] val_solution - Pointer to the adjoint value (initialization value). - * \param[in] val_ndim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CDiscAdjVariable(su2double *val_solution, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Set the sensitivity at the node - * \param[in] iDim - spacial component - * \param[in] val - value of the Sensitivity - */ - void SetSensitivity(unsigned short iDim, su2double val); - - /*! - * \brief Get the Sensitivity at the node - * \param[in] iDim - spacial component - * \return value of the Sensitivity - */ - su2double GetSensitivity(unsigned short iDim); - - void SetDual_Time_Derivative(unsigned short iVar, su2double der); - - void SetDual_Time_Derivative_n(unsigned short iVar, su2double der); - - su2double GetDual_Time_Derivative(unsigned short iVar); - - su2double GetDual_Time_Derivative_n(unsigned short iVar); - - void SetSolution_Direct(su2double *sol); - - su2double* GetSolution_Direct(); - - /*! - * \brief Set the restart geometry (coordinate of the converged solution) - * \param[in] val_coordinate_direct - Value of the restart coordinate. - */ - void SetGeometry_Direct(su2double *val_coordinate_direct); - - /*! - * \brief Get the restart geometry (coordinate of the converged solution). - * \return Pointer to the restart coordinate vector. - */ - su2double *GetGeometry_Direct(void); - - /*! - * \brief Get the restart geometry (coordinate of the converged solution). - * \return Coordinate val_dim of the geometry_direct vector. - */ - su2double GetGeometry_Direct(unsigned short val_dim); - - /*! - * \brief Get the geometry solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetSolution_Geometry(unsigned short val_var); - - /*! - * \brief Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - void SetSolution_Geometry(su2double *val_solution_geometry); - - /*! - * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - void SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry); - - /*! - * \brief A virtual member. Get the geometry solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var); - - /*! - * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] der - cross term derivative. - */ - void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der); - - /*! - * \brief Get the mesh cross term derivative from the flow solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var); - - /*! - * \brief Set the value of the mesh cross term derivative from the flow solution (adjoint). - * \param[in] der - cross term derivative. - */ - void SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der); - - /*! - * \brief Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - void Set_OldSolution_Geometry(void); - - /*! - * \brief Get the value of the old geometry solution (adjoint). - * \param[out] val_solution - old adjoint solution for coordinate iDim - */ - su2double Get_OldSolution_Geometry(unsigned short iDim); - - /*! - * \brief Set the value of the adjoint solution in the current BGS subiteration. - */ - void Set_BGSSolution(unsigned short iDim, su2double val_solution); - - /*! - * \brief Set the value of the adjoint solution in the previous BGS subiteration. - */ - void Set_BGSSolution_k(void); - - /*! - * \brief Get the value of the adjoint solution in the previous BGS subiteration. - * \param[out] val_solution - adjoint solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution(unsigned short iDim); - - /*! - * \brief Get the value of the adjoint solution in the previous BGS subiteration. - * \param[out] val_solution - adjoint solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution_k(unsigned short iDim); - - /*! - * \brief Set the value of the adjoint geometry solution in the previous BGS subiteration. - */ - void Set_BGSSolution_Geometry(void); - - /*! - * \brief Get the value of the adjoint geometry solution in the previous BGS subiteration. - * \param[out] val_solution - geometrical adjoint solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution_Geometry(unsigned short iDim); - - /*! - * \brief Set the contribution of crossed terms into the derivative. - */ - void SetCross_Term_Derivative(unsigned short iVar, su2double der); - - /*! - * \brief Get the contribution of crossed terms into the derivative. - */ - su2double GetCross_Term_Derivative(unsigned short iVar); - -}; - -/*! - * \class CDiscAdjFEAVariable - * \brief Main class for defining the variables of the adjoint solver. - * \ingroup Discrete_Adjoint - * \author T. Albring, R. Sanchez. - * \version 6.2.0 "Falcon" - */ -class CDiscAdjFEAVariable : public CVariable { -private: - su2double* Sensitivity; /* Vector holding the derivative of target functional with respect to the coordinates at this node*/ - su2double* Solution_Direct; - - su2double* Dynamic_Derivative; - su2double* Dynamic_Derivative_n; - su2double* Dynamic_Derivative_Vel; - su2double* Dynamic_Derivative_Vel_n; - su2double* Dynamic_Derivative_Accel; - su2double* Dynamic_Derivative_Accel_n; - - su2double* Solution_Vel; - su2double* Solution_Accel; - - su2double* Solution_Vel_time_n; - su2double* Solution_Accel_time_n; - - su2double* Solution_Old_Vel; - su2double* Solution_Old_Accel; - - su2double* Solution_Direct_Vel; - su2double* Solution_Direct_Accel; - - su2double* Cross_Term_Derivative; - su2double* Geometry_CrossTerm_Derivative; - - su2double* Solution_BGS; - su2double* Solution_BGS_k; - -public: - /*! - * \brief Constructor of the class. - */ - CDiscAdjFEAVariable(void); - - /*! - * \brief Destructor of the class. - */ - ~CDiscAdjFEAVariable(void); - - /*! - * \overload - * \param[in] val_solution - Pointer to the adjoint value (initialization value). - * \param[in] val_ndim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CDiscAdjFEAVariable(su2double *val_solution, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); - - /*! - * \overload - * \param[in] val_solution - Pointer to the adjoint value (initialization value). - * \param[in] val_solution_accel - Pointer to the adjoint value (initialization value). - * \param[in] val_solution_vel - Pointer to the adjoint value (initialization value). - * \param[in] val_ndim - Number of dimensions of the problem. - * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ - CDiscAdjFEAVariable(su2double *val_solution, su2double *val_solution_accel, su2double *val_solution_vel, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); - - /*! - * \brief Set the sensitivity at the node - * \param[in] iDim - spacial component - * \param[in] val - value of the Sensitivity - */ - void SetSensitivity(unsigned short iDim, su2double val); - - /*! - * \brief Get the Sensitivity at the node - * \param[in] iDim - spacial component - * \return value of the Sensitivity - */ - su2double GetSensitivity(unsigned short iDim); - - void SetDynamic_Derivative(unsigned short iVar, su2double der); - - void SetDynamic_Derivative_n(unsigned short iVar, su2double der); - - su2double GetDynamic_Derivative(unsigned short iVar); - - su2double GetDynamic_Derivative_n(unsigned short iVar); - - void SetDynamic_Derivative_Vel(unsigned short iVar, su2double der); - - void SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der); - - su2double GetDynamic_Derivative_Vel(unsigned short iVar); - - su2double GetDynamic_Derivative_Vel_n(unsigned short iVar); - - void SetDynamic_Derivative_Accel(unsigned short iVar, su2double der); - - void SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der); - - su2double GetDynamic_Derivative_Accel(unsigned short iVar); - - su2double GetDynamic_Derivative_Accel_n(unsigned short iVar); - - void SetSolution_Direct(su2double *sol); - - void SetSolution_Vel_Direct(su2double *sol); - - void SetSolution_Accel_Direct(su2double *sol); - - su2double* GetSolution_Direct(); - - su2double* GetSolution_Vel_Direct(); - - su2double* GetSolution_Accel_Direct(); - - su2double GetSolution_Old_Vel(unsigned short iVar); - - su2double GetSolution_Old_Accel(unsigned short iVar); - - /*! - * \brief Get the acceleration (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetSolution_Accel(unsigned short val_var); - - /*! - * \brief Get the acceleration of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Accel_time_n(unsigned short val_var); - - /*! - * \brief Get the velocity (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetSolution_Vel(unsigned short val_var); - - /*! - * \brief Get the velocity of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. - * \return Pointer to the old solution vector. - */ - su2double GetSolution_Vel_time_n(unsigned short val_var); - - /*! - * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_time_n(void); - - /*! - * \brief Set the value of the acceleration (Structural Analysis - adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). - */ - void SetSolution_Accel(su2double *val_solution_accel); - - /*! - * \brief Set the value of the velocity (Structural Analysis - adjoint). - * \param[in] val_solution - Solution of the problem (velocity). - */ - void SetSolution_Vel(su2double *val_solution_vel); - - /*! - * \brief Set the value of the adjoint acceleration (Structural Analysis) at time n. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n); - - /*! - * \brief Set the value of the adjoint velocity (Structural Analysis) at time n. - * \param[in] val_solution_old - Pointer to the residual vector. - */ - void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n); - - /*! - * \brief Set the value of the old acceleration (Structural Analysis - adjoint). - * \param[in] val_solution - Old solution of the problem (acceleration). - */ - void Set_OldSolution_Accel(void); - - /*! - * \brief Set the value of the old velocity (Structural Analysis - adjoint). - * \param[in] val_solution - Old solution of the problem (velocity). - */ - void Set_OldSolution_Vel(void); - - /*! - * \brief Set the contribution of crossed terms into the derivative. - */ - void SetCross_Term_Derivative(unsigned short iVar, su2double der); - - /*! - * \brief Get the contribution of crossed terms into the derivative. - */ - su2double GetCross_Term_Derivative(unsigned short iVar); - - /*! - * \brief A virtual member. Get the geometry solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. - */ - su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var); - - /*! - * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] der - cross term derivative. - */ - void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der); - - - /*! - * \brief Set the value of the adjoint solution in the current BGS subiteration. - */ - void Set_BGSSolution(unsigned short iDim, su2double val_solution); - - /*! - * \brief Set the value of the adjoint solution in the previous BGS subiteration. - */ - void Set_BGSSolution_k(void); - - /*! - * \brief Get the value of the adjoint solution in the previous BGS subiteration. - * \param[out] val_solution - adjoint solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution(unsigned short iDim); - - /*! - * \brief Get the value of the adjoint solution in the previous BGS subiteration. - * \param[out] val_solution - adjoint solution in the previous BGS subiteration. - */ - su2double Get_BGSSolution_k(unsigned short iDim); - -}; - - -#include "variable_structure.inl" diff --git a/SU2_CFD/include/variable_structure.inl b/SU2_CFD/include/variable_structure.inl deleted file mode 100644 index f6b03baf2500..000000000000 --- a/SU2_CFD/include/variable_structure.inl +++ /dev/null @@ -1,1608 +0,0 @@ -/*! - * \file variable_structure.inl - * \brief In-Line subroutines of the variable_structure.hpp file. - * \author F. Palacios, T. Economon - * \version 6.2.0 "Falcon" - * - * The current SU2 release has been coordinated by the - * SU2 International Developers Society - * with selected contributions from the open-source community. - * - * The main research teams contributing to the current release are: - * - Prof. Juan J. Alonso's group at Stanford University. - * - Prof. Piero Colonna's group at Delft University of Technology. - * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. - * - Prof. Alberto Guardone's group at Polytechnic University of Milan. - * - Prof. Rafael Palacios' group at Imperial College London. - * - Prof. Vincent Terrapon's group at the University of Liege. - * - Prof. Edwin van der Weide's group at the University of Twente. - * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. - * - * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, - * Tim Albring, and the SU2 contributors. - * - * SU2 is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * SU2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with SU2. If not, see . - */ - -#pragma once - -inline bool CVariable::SetDensity(void) { return 0; } - -inline bool CVariable::SetDensity(su2double val_density){ return 0; } - -inline void CVariable::SetVelSolutionOldDVector(void) { } - -inline void CVariable::SetVelSolutionDVector(void) { } - -inline void CVariable::SetStress_FEM(unsigned short iVar, su2double val_stress) { } - -inline void CVariable::AddStress_FEM(unsigned short iVar, su2double val_stress) { } - -inline su2double *CVariable::GetStress_FEM(void) { return NULL; } - -inline void CVariable::SetVonMises_Stress(su2double val_stress) { } - -inline su2double CVariable::GetVonMises_Stress(void) { return 0; } - -inline void CVariable::Add_SurfaceLoad_Res(su2double *val_surfForce) { } - -inline void CVariable::Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce) { } - -inline su2double CVariable::Get_SurfaceLoad_Res(unsigned short iVar) { return 0.0;} - -inline void CVariable::Clear_SurfaceLoad_Res(void) { } - -inline void CVariable::Set_SurfaceLoad_Res_n(void) { } - -inline su2double CVariable::Get_SurfaceLoad_Res_n(unsigned short iVar) { return 0.0;} - -inline void CVariable::Add_BodyForces_Res(su2double *val_bodyForce) { } - -inline su2double CVariable::Get_BodyForces_Res(unsigned short iVar) { return 0.0;} - -inline void CVariable::Clear_BodyForces_Res(void) { } - -inline void CVariable::Set_FlowTraction(su2double *val_flowTraction) { } - -inline void CVariable::Add_FlowTraction(su2double *val_flowTraction) { } - -inline su2double CVariable::Get_FlowTraction(unsigned short iVar) { return 0.0;} - -inline void CVariable::Clear_FlowTraction(void) { } - -inline void CVariable::Set_FlowTraction_n(void) { } - -inline su2double CVariable::Get_FlowTraction_n(unsigned short iVar) { return 0.0; } - -inline bool CVariable::Get_isVertex(void) { return false; } - -inline su2double CVariable::GetBetaInc2(void) { return 0; } - -inline su2double CVariable::GetMassFraction(unsigned short val_Species) { return 0; } - -inline void CVariable::SetNon_Physical(bool val_value) { Non_Physical = !val_value; } - -inline su2double CVariable::GetNon_Physical(void) { return su2double(Non_Physical); } - -inline void CVariable::SetSolution(unsigned short val_var, su2double val_solution) { Solution[val_var] = val_solution; } - -inline void CVariable::Add_DeltaSolution(unsigned short val_var, su2double val_solution) { Solution[val_var] += val_solution; } - -inline void CVariable::SetUndivided_Laplacian(unsigned short val_var, su2double val_undivided_laplacian) { Undivided_Laplacian[val_var] = val_undivided_laplacian; } - -inline void CVariable::SetAuxVar(su2double val_auxvar) { AuxVar = val_auxvar; } - -inline void CVariable::SetSolution_Old(unsigned short val_var, su2double val_solution_old) { Solution_Old[val_var] = val_solution_old; } - -inline void CVariable::SetLimiter(unsigned short val_var, su2double val_limiter) { Limiter[val_var] = val_limiter; } - -inline void CVariable::SetLimiterPrimitive(unsigned short val_species, unsigned short val_var, su2double val_limiter) { } - -inline su2double CVariable::GetLimiterPrimitive(unsigned short val_species, unsigned short val_var) { return 0.0; } - -inline void CVariable::SetSolution_Max(unsigned short val_var, su2double val_solution) { Solution_Max[val_var] = val_solution; } - -inline void CVariable::SetSolution_Min(unsigned short val_var, su2double val_solution) { Solution_Min[val_var] = val_solution; } - -inline void CVariable::SetAuxVarGradient(unsigned short iDim, su2double val_gradient) { Grad_AuxVar[iDim] = val_gradient; } - -inline su2double *CVariable::GetSolution(void) { return Solution; } - -inline su2double *CVariable::GetSolution_Old(void) { return Solution_Old; } - -inline su2double *CVariable::GetSolution_time_n(void) { return Solution_time_n; } - -inline su2double *CVariable::GetSolution_time_n1(void) { return Solution_time_n1; } - -inline su2double CVariable::GetAuxVar(void) { return AuxVar; } - -inline su2double *CVariable::GetUndivided_Laplacian(void) { return Undivided_Laplacian; } - -inline su2double CVariable::GetUndivided_Laplacian(unsigned short val_var) { return Undivided_Laplacian[val_var]; } - -inline su2double CVariable::GetSolution(unsigned short val_var) { return Solution[val_var]; } - -inline su2double CVariable::GetSolution_Old(unsigned short val_var) { return Solution_Old[val_var]; } - -inline su2double CVariable::GetSolution_Old_Adj(unsigned short val_var) { return Solution_Adj_Old[val_var]; } - -inline su2double *CVariable::GetResidual_Sum(void) { return Residual_Sum; } - -inline su2double *CVariable::GetResidual_Old(void) { return Residual_Old; } - -inline void CVariable::SetGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient[val_var][val_dim] = val_value; } - -inline void CVariable::AddGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient[val_var][val_dim] += val_value; } - -inline void CVariable::SubtractGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient[val_var][val_dim] -= val_value; } - -inline void CVariable::AddAuxVarGradient(unsigned short val_dim, su2double val_value) { Grad_AuxVar[val_dim] += val_value; } - -inline void CVariable::SubtractAuxVarGradient(unsigned short val_dim, su2double val_value) { Grad_AuxVar[val_dim] -= val_value; } - -inline su2double CVariable::GetGradient(unsigned short val_var, unsigned short val_dim) { return Gradient[val_var][val_dim]; } - -inline void CVariable::SetRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value) { Rmatrix[val_iDim][val_jDim] = val_value; } - -inline void CVariable::AddRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value) { Rmatrix[val_iDim][val_jDim] += val_value; } - -inline su2double CVariable::GetRmatrix(unsigned short val_iDim, unsigned short val_jDim) { return Rmatrix[val_iDim][val_jDim]; } - -inline su2double CVariable::GetLimiter(unsigned short val_var) { return Limiter[val_var]; } - -inline su2double CVariable::GetSolution_Max(unsigned short val_var) { return Solution_Max[val_var]; } - -inline su2double CVariable::GetSolution_Min(unsigned short val_var) { return Solution_Min[val_var]; } - -inline su2double CVariable::GetPreconditioner_Beta() { return 0; } - -inline void CVariable::SetPreconditioner_Beta( su2double val_Beta) { } - -inline su2double* CVariable::GetWindGust() { return 0; } - -inline void CVariable::SetWindGust( su2double* val_WindGust) {} - -inline su2double* CVariable::GetWindGustDer() { return 0; } - -inline void CVariable::SetWindGustDer( su2double* val_WindGustDer) {} - -inline su2double **CVariable::GetGradient(void) { return Gradient; } - -inline su2double *CVariable::GetLimiter(void) { return Limiter; } - -inline su2double *CVariable::GetAuxVarGradient(void) { return Grad_AuxVar; } - -inline su2double CVariable::GetAuxVarGradient(unsigned short val_dim) { return Grad_AuxVar[val_dim]; } - -inline su2double *CVariable::GetResTruncError(void) { return Res_TruncError; } - -inline void CVariable::SetDelta_Time(su2double val_delta_time) { Delta_Time = val_delta_time; } - -inline void CVariable::SetDelta_Time(su2double val_delta_time, unsigned short iSpecies) { } - -inline su2double CVariable::GetDelta_Time(void) { return Delta_Time; } - -inline su2double CVariable::GetDelta_Time(unsigned short iSpecies) { return 0;} - -inline void CVariable::SetMax_Lambda(su2double val_max_lambda) { Max_Lambda = val_max_lambda; } - -inline void CVariable::SetMax_Lambda_Inv(su2double val_max_lambda) { Max_Lambda_Inv = val_max_lambda; } - -inline void CVariable::SetMax_Lambda_Inv(su2double val_max_lambda, unsigned short val_species) { } - -inline void CVariable::SetMax_Lambda_Visc(su2double val_max_lambda) { Max_Lambda_Visc = val_max_lambda; } - -inline void CVariable::SetMax_Lambda_Visc(su2double val_max_lambda, unsigned short val_species) { } - -inline void CVariable::SetLambda(su2double val_lambda) { Lambda = val_lambda; } - -inline void CVariable::SetLambda(su2double val_lambda, unsigned short iSpecies) {} - -inline void CVariable::AddMax_Lambda(su2double val_max_lambda) { Max_Lambda += val_max_lambda; } - -inline void CVariable::AddMax_Lambda_Inv(su2double val_max_lambda) { Max_Lambda_Inv += val_max_lambda; } - -inline void CVariable::AddMax_Lambda_Visc(su2double val_max_lambda) { Max_Lambda_Visc += val_max_lambda; } - -inline void CVariable::AddLambda(su2double val_lambda) { Lambda += val_lambda; } - -inline void CVariable::AddLambda(su2double val_lambda, unsigned short iSpecies) {} - -inline su2double CVariable::GetMax_Lambda(void) { return Max_Lambda; } - -inline su2double CVariable::GetMax_Lambda_Inv(void) { return Max_Lambda_Inv; } - -inline su2double CVariable::GetMax_Lambda_Visc(void) { return Max_Lambda_Visc; } - -inline su2double CVariable::GetLambda(void) { return Lambda; } - -inline su2double CVariable::GetLambda(unsigned short iSpecies) { return 0; } - -inline su2double CVariable::GetSensor(void) { return Sensor; } - -inline su2double CVariable::GetSensor(unsigned short iSpecies) { return 0;} - -inline void CVariable::AddMax_Lambda_Inv(su2double val_max_lambda, unsigned short iSpecies) { } - -inline void CVariable::AddMax_Lambda_Visc(su2double val_max_lambda, unsigned short iSpecies) { } - -inline void CVariable::SetSensor(su2double val_sensor) { Sensor = val_sensor; } - -inline void CVariable::SetSensor(su2double val_sensor, unsigned short val_iSpecies) {} - -inline su2double CVariable::GetDensity(void) { return 0; } - -inline su2double CVariable::GetDensity_Old(void) { return 0; } - -inline su2double CVariable::GetDensity(unsigned short val_iSpecies) { return 0; } - -inline su2double CVariable::GetEnergy(void) { return 0; } - -inline su2double *CVariable::GetForceProj_Vector(void) { return NULL; } - -inline su2double *CVariable::GetObjFuncSource(void) { return NULL; } - -inline su2double *CVariable::GetIntBoundary_Jump(void) { return NULL; } - -inline su2double CVariable::GetEddyViscosity(void) { return 0; } - -inline void CVariable::SetGammaEff(void) { } - -inline void CVariable::SetGammaSep(su2double gamma_sep) { } - -inline su2double CVariable::GetIntermittency(void) { return 0; } - -inline su2double CVariable::GetEnthalpy(void) { return 0; } - -inline su2double CVariable::GetPressure(void) { return 0; } - -inline su2double CVariable::GetProjVel(su2double *val_vector) { return 0; } - -inline su2double CVariable::GetProjVel(su2double *val_vector, unsigned short val_species) { return 0; } - -inline su2double CVariable::GetSoundSpeed(void) { return 0; } - -inline su2double CVariable::GetTemperature(void) { return 0; } - -inline su2double CVariable::GetTemperature_ve(void) { return 0; } - -inline su2double CVariable::GetRhoCv_tr(void) { return 0; } - -inline su2double CVariable::GetRhoCv_ve(void) { return 0; } - -inline su2double CVariable::GetVelocity(unsigned short val_dim) { return 0; } - -inline su2double CVariable::GetVelocity2(void) { return 0; } - -inline su2double CVariable::GetVelocity2(unsigned short val_species) { return 0;} - -inline su2double CVariable::GetLaminarViscosity(void) { return 0; } - -inline su2double CVariable::GetLaminarViscosity(unsigned short iSpecies) { return 0; } - -inline su2double* CVariable::GetDiffusionCoeff(void) { return NULL; } - -inline su2double CVariable::GetThermalConductivity(void) { return 0; } - -inline su2double CVariable::GetSpecificHeatCp(void) { return 0; } - -inline su2double CVariable::GetSpecificHeatCv(void) { return 0; } - -inline su2double CVariable::GetThermalConductivity_ve(void) { return 0; } - -inline su2double* CVariable::GetVorticity(void) { return 0; } - -inline su2double CVariable::GetStrainMag(void) { return 0; } - -inline void CVariable::SetForceProj_Vector(su2double *val_ForceProj_Vector) { } - -inline void CVariable::SetObjFuncSource(su2double *val_ObjFuncSource) { } - -inline void CVariable::SetIntBoundary_Jump(su2double *val_IntBoundary_Jump) { } - -inline su2double CVariable::GetGammaBC(void) { return 0; } - -inline void CVariable::SetGammaBC(su2double val_gamma) { } - -inline void CVariable::SetEnthalpy(void) { } - -inline bool CVariable::SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config) { return true; } - -inline bool CVariable::SetPrimVar(CConfig *config) { return true; } - -inline bool CVariable::SetPrimVar(CFluidModel *FluidModel) { return true; } - -inline void CVariable::SetSecondaryVar(CFluidModel *FluidModel) { } - -inline bool CVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CConfig *config) { return true; } - -inline bool CVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) { return true; } - -inline bool CVariable::SetPrimVar(su2double Density_Inf, CConfig *config) { return true; } - -inline bool CVariable::SetPrimVar(su2double Density_Inf, su2double Viscosity_Inf, su2double eddy_visc, su2double turb_ke, CConfig *config) { return true; } - -inline su2double CVariable::GetPrimitive(unsigned short val_var) { return 0; } - -inline su2double *CVariable::GetPrimitive(void) { return NULL; } - -inline void CVariable::SetPrimitive(unsigned short val_var, su2double val_prim) { } - -inline void CVariable::SetPrimitive(su2double *val_prim) { } - -inline su2double CVariable::GetSecondary(unsigned short val_var) { return 0; } - -inline su2double *CVariable::GetSecondary(void) { return NULL; } - -inline void CVariable::SetSecondary(unsigned short val_var, su2double val_secondary) { } - -inline void CVariable::SetSecondary(su2double *val_prim) { } - -inline bool CVariable::Cons2PrimVar(CConfig *config, su2double *U, su2double *V, - su2double *val_dPdU, su2double *val_dTdU, - su2double *val_dTvedU) { return false; } - -inline void CVariable::Prim2ConsVar(CConfig *config, su2double *V, su2double *U) { return; } - -inline void CVariable::SetBetaInc2(su2double val_betainc2) { } - -inline void CVariable::SetPhi_Old(su2double *val_phi) { } - -inline void CVariable::SetdPdrho_e(su2double dPdrho_e) { } - -inline void CVariable::SetdPde_rho(su2double dPde_rho) { } - -inline void CVariable::SetdTdrho_e(su2double dTdrho_e) { } - -inline void CVariable::SetdTde_rho(su2double dTde_rho) { } - -inline void CVariable::Setdmudrho_T(su2double dmudrho_T) { } - -inline void CVariable::SetdmudT_rho(su2double dmudT_rho) { } - -inline void CVariable::Setdktdrho_T(su2double dktdrho_T) { } - -inline void CVariable::SetdktdT_rho(su2double dktdT_rho) { } - -inline bool CVariable::SetPressure(su2double Gamma) { return false; } - -inline bool CVariable::SetPressure(CConfig *config) { return false; } - -inline bool CVariable::SetPressure(su2double Gamma, su2double turb_ke) { return false; } - -inline void CVariable::SetPressure() { } - -inline su2double *CVariable::GetdPdU() { return NULL; } - -inline su2double *CVariable::GetdTdU() { return NULL; } - -inline su2double *CVariable::GetdTvedU() { return NULL; } - -inline su2double CVariable::CalcEve(su2double *V, CConfig *config, unsigned short val_Species) { return 0; } - -inline su2double CVariable::CalcHs(su2double *V, CConfig *config, unsigned short val_Species) { return 0; } - -inline su2double CVariable::CalcCvve(su2double val_Tve, CConfig *config, unsigned short val_Species) { return 0; } - -inline void CVariable::CalcdPdU(su2double *V, CConfig *config, su2double *dPdU) { } - -inline void CVariable::CalcdTdU(su2double *V, CConfig *config, su2double *dTdU) { } - -inline void CVariable::CalcdTvedU(su2double *V, CConfig *config, su2double *dTvedU) { } - -inline void CVariable::SetDeltaPressure(su2double *val_velocity, su2double Gamma) { } - -inline bool CVariable::SetSoundSpeed(CConfig *config) { return false; } - -inline bool CVariable::SetSoundSpeed() { return false; } - -inline bool CVariable::SetSoundSpeed(su2double Gamma) { return false; } - -inline bool CVariable::SetTemperature(su2double Gas_Constant) { return false; } - -inline bool CVariable::SetTemperature_ve(su2double val_Tve) { return false; } - -inline bool CVariable::SetTemperature(CConfig *config) { return false; } - -inline void CVariable::SetPrimitive(CConfig *config) { } - -inline void CVariable::SetPrimitive(CConfig *config, su2double *Coord) { } - -inline void CVariable::SetWallTemperature(su2double Temperature_Wall) { } - -inline void CVariable::SetWallTemperature(su2double* Temperature_Wall) { } - -inline void CVariable::SetThermalCoeff(CConfig *config) { } - -inline void CVariable::SetVelocity(void) { } - -inline void CVariable::SetVelocity2(void) { } - -inline void CVariable::SetVelocity_Old(su2double *val_velocity) { } - -inline void CVariable::SetVel_ResTruncError_Zero(unsigned short iSpecies) { } - -inline void CVariable::SetLaminarViscosity(su2double laminarViscosity) { } - -inline void CVariable::SetLaminarViscosity(CConfig *config) { } - -inline void CVariable::SetEddyViscosity(su2double eddy_visc) { } - -inline void CVariable::SetThermalConductivity(su2double thermalConductivity) { } - -inline void CVariable::SetThermalConductivity(CConfig *config) { } - -inline void CVariable::SetSpecificHeatCp(su2double Cp) { } - -inline void CVariable::SetSpecificHeatCv(su2double Cv) { } - -inline bool CVariable::SetVorticity(void) { return false; } - -inline bool CVariable::SetStrainMag(void) { return false; } - -inline void CVariable::SetTauWall(su2double val_tau_wall) { } - -inline su2double CVariable::GetTauWall(void) { return 0; } - -inline void CVariable::SetGradient_PrimitiveZero(unsigned short val_primvar) { } - -inline void CVariable::AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { } - -inline void CVariable::SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { } - -inline su2double CVariable::GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) { return 0; } - -inline su2double CVariable::GetLimiter_Primitive(unsigned short val_var) { return 0; } - -inline void CVariable::SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { } - -inline void CVariable::SetLimiter_Primitive(unsigned short val_var, su2double val_value) { } - -inline su2double **CVariable::GetGradient_Primitive(void) { return NULL; } - -inline su2double *CVariable::GetLimiter_Primitive(void) { return NULL; } - -inline void CVariable::SetGradient_SecondaryZero(unsigned short val_secondaryvar) { } - -inline void CVariable::AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) { } - -inline void CVariable::SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) { } - -inline su2double CVariable::GetGradient_Secondary(unsigned short val_var, unsigned short val_dim) { return 0; } - -inline su2double CVariable::GetLimiter_Secondary(unsigned short val_var) { return 0; } - -inline void CVariable::SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) { } - -inline void CVariable::SetLimiter_Secondary(unsigned short val_var, su2double val_value) { } - -inline su2double **CVariable::GetGradient_Secondary(void) { return NULL; } - -inline su2double *CVariable::GetLimiter_Secondary(void) { return NULL; } - -inline void CVariable::SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density) { } - -inline su2double CVariable::GetF1blending(void) { return 0; } - -inline su2double CVariable::GetF2blending(void) { return 0; } - -inline su2double CVariable::GetmuT() { return 0;} - -inline void CVariable::SetmuT(su2double val_muT) { } - -inline su2double* CVariable::GetSolution_Direct() { return NULL; } - -inline void CVariable::SetSolution_Direct(su2double *val_solution_direct) { } - -inline su2double* CVariable::GetGeometry_Direct() { return NULL; } - -inline su2double CVariable::GetGeometry_Direct(unsigned short val_dim) { return 0.0; } - -inline void CVariable::SetGeometry_Direct(su2double *val_geometry_direct) { } - -inline su2double CVariable::GetSolution_Geometry(unsigned short val_var) { return 0.0;} - -inline void CVariable::SetSolution_Geometry(su2double *val_solution_geometry) { } - -inline void CVariable::SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry) { } - -inline su2double CVariable::GetGeometry_CrossTerm_Derivative(unsigned short val_var) { return 0.0;} - -inline void CVariable::SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) { } - -inline su2double CVariable::GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) { return 0.0;} - -inline void CVariable::SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der) { } - -inline void CVariable::Set_OldSolution_Geometry(void) { } - -inline su2double CVariable::Get_OldSolution_Geometry(unsigned short iDim) { return 0.0;} - -inline su2double CVariable::GetCross_Term_Derivative(unsigned short iVar) { return 0.0; } - -inline void CVariable::SetCross_Term_Derivative(unsigned short iVar, su2double der) { } - -inline void CVariable::Set_BGSSolution(unsigned short iDim, su2double val_solution) { } - -inline void CVariable::Set_BGSSolution_k(void) { } - -inline su2double CVariable::Get_BGSSolution(unsigned short iDim) { return 0.0;} - -inline su2double CVariable::Get_BGSSolution_k(unsigned short iDim) { return 0.0;} - -inline void CVariable::Set_BGSSolution_Geometry(void) { } - -inline su2double CVariable::Get_BGSSolution_Geometry(unsigned short iDim) { return 0.0;} - -inline su2double* CVariable::GetSolution_Vel_Direct() { return NULL; } - -inline void CVariable::SetSolution_Vel_Direct(su2double *val_solution_direct) { } - -inline su2double* CVariable::GetSolution_Accel_Direct() { return NULL; } - -inline void CVariable::SetSolution_Accel_Direct(su2double *val_solution_direct) { } - -inline void CVariable::SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) { } - -inline su2double CVariable::GetHarmonicBalance_Source(unsigned short val_var) { return 0; } - -inline void CVariable::SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar) { } - -inline su2double *CVariable::GetEddyViscSens(void) { return NULL; } - -inline void CVariable::SetSolution_time_n(void) { } - -inline void CVariable::SetSolution_time_n(unsigned short val_var, su2double val_solution_time_n) { } - -inline void CVariable::SetSolution_Vel(su2double *val_solution_vel) { } - -inline void CVariable::SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) { } - -inline void CVariable::SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) { } - -inline void CVariable::SetSolution_Vel_time_n(void) { } - -inline void CVariable::SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n) { } - -inline void CVariable::Set_OldSolution_Accel(void) { } - -inline void CVariable::Set_OldSolution_Vel(void) { } - -inline su2double CVariable::GetSolution_time_n(unsigned short val_var) { return Solution_time_n[val_var]; } - -inline su2double CVariable::GetSolution_Vel(unsigned short val_var) { return 0; } - -inline su2double *CVariable::GetSolution_Vel(void) { return NULL; } - -inline su2double CVariable::GetSolution_Vel_time_n(unsigned short val_var) { return 0; } - -inline su2double *CVariable::GetSolution_Vel_time_n(void) { return NULL; } - -inline void CVariable::SetSolution_Accel(su2double *val_solution_accel) { } - -inline void CVariable::SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) { } - -inline void CVariable::SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) { } - -inline void CVariable::SetSolution_Accel_time_n(void) { } - -inline void CVariable::SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n) { } - -inline su2double CVariable::GetSolution_Accel(unsigned short val_var) { return 0; } - -inline su2double *CVariable::GetSolution_Accel(void) { return NULL; } - -inline su2double CVariable::GetSolution_Accel_time_n(unsigned short val_var) { return 0; } - -inline su2double *CVariable::GetSolution_Accel_time_n(void) { return NULL; } - -inline void CVariable::SetSolution_Pred(unsigned short val_var, su2double val_solution_pred) { } - -inline void CVariable::SetSolution_Pred(su2double *val_solution_pred) { } - -inline void CVariable::SetSolution_Pred(void) { } - -inline su2double CVariable::GetSolution_Pred(unsigned short val_var) { return 0.0; } - -inline su2double *CVariable::GetSolution_Pred(void) { return NULL; } - -inline void CVariable::SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old) { } - -inline void CVariable::SetSolution_Pred_Old(su2double *val_solution_pred_Old) { } - -inline void CVariable::SetSolution_Pred_Old(void) { } - -inline su2double CVariable::GetSolution_Pred_Old(unsigned short val_var) { return 0.0; } - -inline su2double *CVariable::GetSolution_Pred_Old(void) { return NULL; } - -inline void CVariable::SetReference_Geometry(unsigned short iVar, su2double ref_geometry){ } - -inline su2double *CVariable::GetReference_Geometry(void){ return NULL; } - -inline su2double CVariable::GetReference_Geometry(unsigned short iVar){ return 0.0; } - -inline void CVariable::SetPrestretch(unsigned short iVar, su2double val_prestretch) { } - -inline su2double *CVariable::GetPrestretch(void) { return NULL; } - -inline su2double CVariable::GetPrestretch(unsigned short iVar) { return 0.0; } - -inline void CVariable::Register_femSolution_time_n() { } - -inline void CVariable::RegisterSolution_Vel(bool input) { } - -inline void CVariable::RegisterSolution_Vel_time_n() { } - -inline void CVariable::RegisterSolution_Accel(bool input) { } - -inline void CVariable::RegisterSolution_Accel_time_n() { } - -inline void CVariable::SetAdjointSolution_Vel(su2double *adj_sol) { } - -inline void CVariable::GetAdjointSolution_Vel(su2double *adj_sol) { } - -inline void CVariable::SetAdjointSolution_Vel_time_n(su2double *adj_sol) { } - -inline void CVariable::GetAdjointSolution_Vel_time_n(su2double *adj_sol) { } - -inline void CVariable::SetAdjointSolution_Accel(su2double *adj_sol) { } - -inline void CVariable::GetAdjointSolution_Accel(su2double *adj_sol) { } - -inline void CVariable::SetAdjointSolution_Accel_time_n(su2double *adj_sol) { } - -inline void CVariable::GetAdjointSolution_Accel_time_n(su2double *adj_sol) { } - -inline su2double CVariable::GetSolution_New(unsigned short val_var) { return 0.0; } - - -inline su2double CVariable::GetRoe_Dissipation(void) { return 0.0; } - -inline void CVariable::SetRoe_Dissipation_FD(su2double val_wall_dist) { } - -inline void CVariable::SetRoe_Dissipation_NTS(su2double val_delta, su2double val_const_DES) { } - -inline su2double CVariable::GetDES_LengthScale(void) { return 0.0; } - -inline void CVariable::SetDES_LengthScale(su2double val_des_lengthscale) { } - -inline void CVariable::SetSolution_New(void) { } - -inline void CVariable::AddSolution_New(unsigned short val_var, su2double val_solution) { } - -inline void CVariable::SetRoe_Dissipation(su2double val_dissipation) { } - -inline void CVariable::SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity) { } - -inline su2double CVariable::GetVortex_Tilting() { return 0.0; } - -inline su2double CEulerVariable::GetSolution_New(unsigned short val_var) { return Solution_New[val_var]; } - -inline su2double CNSVariable::GetRoe_Dissipation(void) { return Roe_Dissipation; } - -inline su2double CNSVariable::GetDES_LengthScale(void) { return DES_LengthScale; } - -inline void CNSVariable::SetDES_LengthScale(su2double val_des_lengthscale) { DES_LengthScale = val_des_lengthscale; } - -inline void CIncNSVariable::SetDES_LengthScale(su2double val_des_lengthscale) { DES_LengthScale = val_des_lengthscale; } - -inline su2double CIncNSVariable::GetDES_LengthScale(void) { return DES_LengthScale; } - -inline void CEulerVariable::SetSolution_New(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_New[iVar] = Solution[iVar]; -} - -inline void CEulerVariable::AddSolution_New(unsigned short val_var, su2double val_solution) { - Solution_New[val_var] += val_solution; -} - -inline su2double CEulerVariable::GetDensity(void) { return Solution[0]; } - -inline su2double CEulerVariable::GetEnergy(void) { return Solution[nVar-1]/Solution[0]; }; - -inline su2double CEulerVariable::GetEnthalpy(void) { return Primitive[nDim+3]; } - -inline su2double CEulerVariable::GetPressure(void) { return Primitive[nDim+1]; } - -inline su2double CEulerVariable::GetSoundSpeed(void) { return Primitive[nDim+4]; } - -inline su2double CEulerVariable::GetTemperature(void) { return Primitive[0]; } - -inline su2double CEulerVariable::GetVelocity(unsigned short val_dim) { return Primitive[val_dim+1]; } - -inline su2double CEulerVariable::GetVelocity2(void) { return Velocity2; } - -inline bool CEulerVariable::SetDensity(void) { - Primitive[nDim+2] = Solution[0]; - if (Primitive[nDim+2] > 0.0) return false; - else return true; -} - -inline bool CEulerVariable::SetPressure(su2double pressure) { - Primitive[nDim+1] = pressure; - if (Primitive[nDim+1] > 0.0) return false; - else return true; -} - -inline void CEulerVariable::SetVelocity(void) { - Velocity2 = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Primitive[iDim+1] = Solution[iDim+1] / Solution[0]; - Velocity2 += Primitive[iDim+1]*Primitive[iDim+1]; - } -} - -inline void CEulerVariable::SetEnthalpy(void) { Primitive[nDim+3] = (Solution[nVar-1] + Primitive[nDim+1]) / Solution[0]; } - -inline bool CEulerVariable::SetSoundSpeed(su2double soundspeed2) { - su2double radical = soundspeed2; - if (radical < 0.0) return true; - else { - Primitive[nDim+4] = sqrt(radical); - return false; - } -} - -inline bool CEulerVariable::SetTemperature(su2double temperature) { - Primitive[0] = temperature; - if (Primitive[0] > 0.0) return false; - else return true; -} - -inline void CEulerVariable::SetdPdrho_e(su2double dPdrho_e) { - Secondary[0] = dPdrho_e; -} - -inline void CEulerVariable::SetdPde_rho(su2double dPde_rho) { - Secondary[1] = dPde_rho; -} - -inline su2double CEulerVariable::GetPrimitive(unsigned short val_var) { return Primitive[val_var]; } - -inline void CEulerVariable::SetPrimitive(unsigned short val_var, su2double val_prim) { Primitive[val_var] = val_prim; } - -inline void CEulerVariable::SetPrimitive(su2double *val_prim) { - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Primitive[iVar] = val_prim[iVar]; -} - -inline su2double *CEulerVariable::GetPrimitive(void) { return Primitive; } - -inline su2double CEulerVariable::GetSecondary(unsigned short val_var) { return Secondary[val_var]; } - -inline void CEulerVariable::SetSecondary(unsigned short val_var, su2double val_secondary) { Secondary[val_var] = val_secondary; } - -inline void CEulerVariable::SetSecondary(su2double *val_secondary) { - for (unsigned short iVar = 0; iVar < nSecondaryVar; iVar++) - Secondary[iVar] = val_secondary[iVar]; -} - -inline su2double *CEulerVariable::GetSecondary(void) { return Secondary; } - -inline void CEulerVariable::SetVelocity_Old(su2double *val_velocity) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution_Old[iDim+1] = val_velocity[iDim]*Solution[0]; -} - -inline void CEulerVariable::AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Primitive[val_var][val_dim] += val_value; } - -inline void CEulerVariable::SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Primitive[val_var][val_dim] -= val_value; } - -inline su2double CEulerVariable::GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) { return Gradient_Primitive[val_var][val_dim]; } - -inline su2double CEulerVariable::GetLimiter_Primitive(unsigned short val_var) { return Limiter_Primitive[val_var]; } - -inline void CEulerVariable::SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Primitive[val_var][val_dim] = val_value; } - -inline void CEulerVariable::SetLimiter_Primitive(unsigned short val_var, su2double val_value) { Limiter_Primitive[val_var] = val_value; } - -inline su2double **CEulerVariable::GetGradient_Primitive(void) { return Gradient_Primitive; } - -inline su2double *CEulerVariable::GetLimiter_Primitive(void) { return Limiter_Primitive; } - -inline void CEulerVariable::AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Secondary[val_var][val_dim] += val_value; } - -inline void CEulerVariable::SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Secondary[val_var][val_dim] -= val_value; } - -inline su2double CEulerVariable::GetGradient_Secondary(unsigned short val_var, unsigned short val_dim) { return Gradient_Secondary[val_var][val_dim]; } - -inline su2double CEulerVariable::GetLimiter_Secondary(unsigned short val_var) { return Limiter_Secondary[val_var]; } - -inline void CEulerVariable::SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Secondary[val_var][val_dim] = val_value; } - -inline void CEulerVariable::SetLimiter_Secondary(unsigned short val_var, su2double val_value) { Limiter_Secondary[val_var] = val_value; } - -inline su2double **CEulerVariable::GetGradient_Secondary(void) { return Gradient_Secondary; } - -inline su2double *CEulerVariable::GetLimiter_Secondary(void) { return Limiter_Secondary; } - -inline void CEulerVariable::SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) { HB_Source[val_var] = val_source; } - -inline su2double CEulerVariable::GetHarmonicBalance_Source(unsigned short val_var) { return HB_Source[val_var]; } - -inline su2double CEulerVariable::GetPreconditioner_Beta() { return Precond_Beta; } - -inline void CEulerVariable::SetPreconditioner_Beta(su2double val_Beta) { Precond_Beta = val_Beta; } - -inline void CEulerVariable::SetWindGust( su2double* val_WindGust) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - WindGust[iDim] = val_WindGust[iDim];} - -inline su2double* CEulerVariable::GetWindGust() { return WindGust;} - -inline void CEulerVariable::SetWindGustDer( su2double* val_WindGustDer) { - for (unsigned short iDim = 0; iDim < nDim+1; iDim++) - WindGustDer[iDim] = val_WindGustDer[iDim];} - -inline su2double* CEulerVariable::GetWindGustDer() { return WindGustDer;} - -inline su2double CEulerVariable::Get_BGSSolution_k(unsigned short iDim) { return Solution_BGS_k[iDim];} - -inline void CEulerVariable::Set_BGSSolution_k(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_BGS_k[iVar] = Solution[iVar]; -} - -inline su2double CNSVariable::GetEddyViscosity(void) { return Primitive[nDim+6]; } - -inline su2double CNSVariable::GetLaminarViscosity(void) { return Primitive[nDim+5]; } - -inline su2double CNSVariable::GetThermalConductivity(void) { return Primitive[nDim+7]; } - -inline su2double CNSVariable::GetSpecificHeatCp(void) { return Primitive[nDim+8]; } - -inline su2double* CNSVariable::GetVorticity(void) { return Vorticity; } - -inline su2double CNSVariable::GetStrainMag(void) { return StrainMag; } - -inline void CNSVariable::SetLaminarViscosity(su2double laminarViscosity) { - Primitive[nDim+5] = laminarViscosity; -} - -inline void CNSVariable::SetThermalConductivity(su2double thermalConductivity) { - Primitive[nDim+7] = thermalConductivity; -} - -inline void CNSVariable::SetSpecificHeatCp(su2double Cp) { - Primitive[nDim+8] = Cp; -} - -inline void CNSVariable::SetdTdrho_e(su2double dTdrho_e) { - Secondary[2] = dTdrho_e; -} - -inline void CNSVariable::SetdTde_rho(su2double dTde_rho) { - Secondary[3] = dTde_rho; -} - -inline void CNSVariable::Setdmudrho_T(su2double dmudrho_T) { - Secondary[4] = dmudrho_T; -} - -inline void CNSVariable::SetdmudT_rho(su2double dmudT_rho) { - Secondary[5] = dmudT_rho; -} - -inline void CNSVariable::Setdktdrho_T(su2double dktdrho_T) { - Secondary[6] = dktdrho_T; -} - -inline void CNSVariable::SetdktdT_rho(su2double dktdT_rho) { - Secondary[7] = dktdT_rho; -} -inline void CNSVariable::SetTauWall(su2double val_tau_wall) { Tau_Wall = val_tau_wall; } - -inline su2double CNSVariable::GetTauWall(void) { return Tau_Wall; } - -inline void CNSVariable::SetEddyViscosity(su2double eddy_visc) { Primitive[nDim+6] = eddy_visc; } - -inline void CNSVariable::SetWallTemperature(su2double Temperature_Wall ) { Primitive[0] = Temperature_Wall; } - -inline void CNSVariable::SetRoe_Dissipation(su2double val_dissipation) { Roe_Dissipation = val_dissipation; } - -inline su2double CTurbSAVariable::GetVortex_Tilting() { return Vortex_Tilting; } - -inline su2double *CAdjEulerVariable::GetForceProj_Vector(void) { return ForceProj_Vector; } - -inline su2double *CAdjEulerVariable::GetObjFuncSource(void) { return ObjFuncSource; } - -inline su2double *CAdjEulerVariable::GetIntBoundary_Jump(void) { return IntBoundary_Jump; } - -inline void CAdjEulerVariable::SetForceProj_Vector(su2double *val_ForceProj_Vector) { for (unsigned short iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = val_ForceProj_Vector[iDim]; } - -inline void CAdjEulerVariable::SetObjFuncSource(su2double *val_ObjFuncSource) { for (unsigned short iVar = 0; iVar < nVar; iVar++) ObjFuncSource[iVar] = val_ObjFuncSource[iVar]; } - -inline void CAdjEulerVariable::SetIntBoundary_Jump(su2double *val_IntBoundary_Jump) { for (unsigned short iVar = 0; iVar < nVar; iVar++) IntBoundary_Jump[iVar] = val_IntBoundary_Jump[iVar]; } - -inline void CAdjEulerVariable::SetPhi_Old(su2double *val_phi) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1]=val_phi[iDim]; }; - -inline void CAdjEulerVariable::SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) { HB_Source[val_var] = val_source; } - -inline su2double CAdjEulerVariable::GetHarmonicBalance_Source(unsigned short val_var) { return HB_Source[val_var]; } - -inline su2double *CAdjNSVariable::GetForceProj_Vector(void) { return ForceProj_Vector; } - -inline void CAdjNSVariable::SetForceProj_Vector(su2double *val_ForceProj_Vector) { for (unsigned short iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = val_ForceProj_Vector[iDim]; } - -inline void CAdjNSVariable::SetPhi_Old(su2double *val_phi) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = val_phi[iDim]; }; - -inline void CAdjNSVariable::SetVelSolutionOldDVector(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = ForceProj_Vector[iDim]; }; - -inline void CAdjNSVariable::SetVelSolutionDVector(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = ForceProj_Vector[iDim]; }; - -inline su2double CIncEulerVariable::GetDensity(void) { return Primitive[nDim+2]; } - -inline su2double CIncEulerVariable::GetDensity_Old(void) { return Density_Old; } - -inline su2double CIncEulerVariable::GetBetaInc2(void) { return Primitive[nDim+3]; } - -inline su2double CIncEulerVariable::GetPressure(void) { return Primitive[0]; } - -inline su2double CIncEulerVariable::GetTemperature(void) { return Primitive[nDim+1]; } - -inline su2double CIncEulerVariable::GetVelocity(unsigned short val_dim) { return Primitive[val_dim+1]; } - -inline su2double CIncEulerVariable::GetVelocity2(void) { return Velocity2; } - -inline bool CIncEulerVariable::SetDensity(su2double val_density) { - Primitive[nDim+2] = val_density; - if (Primitive[nDim+2] > 0.0) return false; - else return true; -} - -inline void CIncEulerVariable::SetPressure(void) { Primitive[0] = Solution[0]; } - -inline bool CIncEulerVariable::SetTemperature(su2double val_temperature) { - Primitive[nDim+1] = val_temperature; - if (Primitive[nDim+1] > 0.0) return false; - else return true; -} - -inline void CIncEulerVariable::SetVelocity(void) { - Velocity2 = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Primitive[iDim+1] = Solution[iDim+1]; - Velocity2 += Primitive[iDim+1]*Primitive[iDim+1]; - } -} - -inline void CIncEulerVariable::SetBetaInc2(su2double val_betainc2) { Primitive[nDim+3] = val_betainc2; } - -inline su2double CIncEulerVariable::GetPrimitive(unsigned short val_var) { return Primitive[val_var]; } - -inline void CIncEulerVariable::SetPrimitive(unsigned short val_var, su2double val_prim) { Primitive[val_var] = val_prim; } - -inline void CIncEulerVariable::SetPrimitive(su2double *val_prim) { - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Primitive[iVar] = val_prim[iVar]; -} - -inline su2double *CIncEulerVariable::GetPrimitive(void) { return Primitive; } - -inline void CIncEulerVariable::SetVelocity_Old(su2double *val_velocity) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution_Old[iDim+1] = val_velocity[iDim]; -} - -inline void CIncEulerVariable::AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Primitive[val_var][val_dim] += val_value; } - -inline void CIncEulerVariable::SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Primitive[val_var][val_dim] -= val_value; } - -inline su2double CIncEulerVariable::GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) { return Gradient_Primitive[val_var][val_dim]; } - -inline su2double CIncEulerVariable::GetLimiter_Primitive(unsigned short val_var) { return Limiter_Primitive[val_var]; } - -inline void CIncEulerVariable::SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) { Gradient_Primitive[val_var][val_dim] = val_value; } - -inline void CIncEulerVariable::SetLimiter_Primitive(unsigned short val_var, su2double val_value) { Limiter_Primitive[val_var] = val_value; } - -inline su2double **CIncEulerVariable::GetGradient_Primitive(void) { return Gradient_Primitive; } - -inline su2double *CIncEulerVariable::GetLimiter_Primitive(void) { return Limiter_Primitive; } - -inline void CIncEulerVariable::SetSpecificHeatCp(su2double val_Cp) { - Primitive[nDim+7] = val_Cp; -} - -inline void CIncEulerVariable::SetSpecificHeatCv(su2double val_Cv) { - Primitive[nDim+8] = val_Cv; -} - -inline su2double CIncEulerVariable::GetSpecificHeatCp(void) { return Primitive[nDim+7]; } - -inline su2double CIncEulerVariable::GetSpecificHeatCv(void) { return Primitive[nDim+8]; } - -inline su2double CIncEulerVariable::Get_BGSSolution_k(unsigned short iDim) { return Solution_BGS_k[iDim];} - -inline void CIncEulerVariable::Set_BGSSolution_k(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_BGS_k[iVar] = Solution[iVar]; -} - -inline su2double CIncNSVariable::GetEddyViscosity(void) { return Primitive[nDim+5]; } - -inline su2double CIncNSVariable::GetLaminarViscosity(void) { return Primitive[nDim+4]; } - -inline su2double CIncNSVariable::GetThermalConductivity(void) { return Primitive[nDim+6]; } - -inline su2double* CIncNSVariable::GetVorticity(void) { return Vorticity; } - -inline su2double CIncNSVariable::GetStrainMag(void) { return StrainMag; } - -inline void CIncNSVariable::SetLaminarViscosity(su2double val_laminar_viscosity_inc) { Primitive[nDim+4] = val_laminar_viscosity_inc; } - -inline void CIncNSVariable::SetEddyViscosity(su2double eddy_visc) { Primitive[nDim+5] = eddy_visc; } - -inline void CIncNSVariable::SetThermalConductivity(su2double val_thermal_conductivity) { - Primitive[nDim+6] = val_thermal_conductivity; -} - -inline su2double CTransLMVariable::GetIntermittency() { return Solution[0]; } - -inline void CTransLMVariable::SetGammaSep(su2double gamma_sep_in) {gamma_sep = gamma_sep_in;} - -inline void CFEAVariable::SetStress_FEM(unsigned short iVar, su2double val_stress) { Stress[iVar] = val_stress; } - -inline void CFEAVariable::AddStress_FEM(unsigned short iVar, su2double val_stress) { Stress[iVar] += val_stress; } - -inline su2double *CFEAVariable::GetStress_FEM(void) { return Stress; } - -inline void CFEABoundVariable::Add_SurfaceLoad_Res(su2double *val_surfForce) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf[iVar] += val_surfForce[iVar]; -} - -inline void CFEABoundVariable::Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce) {Residual_Ext_Surf[iVar] = val_surfForce;} - -inline su2double CFEABoundVariable::Get_SurfaceLoad_Res(unsigned short iVar) {return Residual_Ext_Surf[iVar];} - -inline void CFEABoundVariable::Clear_SurfaceLoad_Res(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf[iVar] = 0.0; -} - -inline void CFEABoundVariable::Set_SurfaceLoad_Res_n(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf_n[iVar] = Residual_Ext_Surf[iVar]; -} - -inline su2double CFEABoundVariable::Get_SurfaceLoad_Res_n(unsigned short iVar) { return Residual_Ext_Surf_n[iVar]; } - -inline void CFEAVariable::Add_BodyForces_Res(su2double *val_bodyForce) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Residual_Ext_Body[iVar] += val_bodyForce[iVar]; -} - -inline su2double CFEAVariable::Get_BodyForces_Res(unsigned short iVar) { return Residual_Ext_Body[iVar];} - -inline void CFEAVariable::Clear_BodyForces_Res(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Body[iVar] = 0.0; -} - -inline void CFEABoundVariable::Set_FlowTraction(su2double *val_flowTraction) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction[iVar] = val_flowTraction[iVar]; -} - -inline void CFEABoundVariable::Add_FlowTraction(su2double *val_flowTraction) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction[iVar] += val_flowTraction[iVar]; -} - - -inline su2double CFEABoundVariable::Get_FlowTraction(unsigned short iVar) { return FlowTraction[iVar]; } - -inline void CFEABoundVariable::Clear_FlowTraction(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction[iVar] = 0.0; -} - -inline void CFEABoundVariable::Set_FlowTraction_n(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction_n[iVar] = FlowTraction[iVar]; -} - -inline su2double CFEABoundVariable::Get_FlowTraction_n(unsigned short iVar) { return FlowTraction_n[iVar]; } - -inline bool CFEABoundVariable::Get_isVertex(void) { return true; } - -inline void CFEAVariable::SetSolution_time_n(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = Solution[iVar]; -} - -inline void CFEAVariable::SetSolution_time_n(su2double *val_solution_time_n) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = val_solution_time_n[iVar]; -} - -inline void CFEAVariable::SetSolution_time_n(unsigned short val_var, su2double val_solution_time_n) { Solution_time_n[val_var] = val_solution_time_n; } - -inline void CFEAVariable::SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) { Solution_Vel[val_var] = val_solution_vel; } - -inline void CFEAVariable::SetSolution_Vel(su2double *val_solution_vel) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel[iVar] = val_solution_vel[iVar]; -} - -inline void CFEAVariable::SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n) { Solution_Vel_time_n[val_var] = val_solution_vel_time_n; } - -inline void CFEAVariable::SetSolution_Vel_time_n(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = Solution_Vel[iVar]; -} - -inline void CFEAVariable::SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = val_solution_vel_time_n[iVar]; -} - -inline void CFEAVariable::SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) { Solution_Accel[val_var] = val_solution_accel; } - -inline void CFEAVariable::SetSolution_Accel(su2double *val_solution_accel) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel[iVar] = val_solution_accel[iVar]; -} - -inline void CFEAVariable::SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n) { Solution_Accel_time_n[val_var] = val_solution_accel_time_n; } - -inline void CFEAVariable::SetSolution_Accel_time_n(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = Solution_Accel[iVar]; -} - -inline void CFEAVariable::SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = val_solution_accel_time_n[iVar]; -} - -inline void CFEAVariable::SetSolution_Pred(unsigned short val_var, su2double val_solution_pred) { Solution_Pred[val_var] = val_solution_pred; } - -inline void CFEAVariable::SetSolution_Pred(su2double *val_solution_pred) { Solution_Pred = val_solution_pred; } - -inline void CFEAVariable::SetSolution_Pred(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Pred[iVar] = Solution[iVar]; -} - -inline void CFEAVariable::SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old) { Solution_Pred_Old[val_var] = val_solution_pred_old; } - -inline void CFEAVariable::SetSolution_Pred_Old(su2double *val_solution_pred_Old) { Solution_Pred_Old = val_solution_pred_Old; } - -inline void CFEAVariable::SetSolution_Pred_Old(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Pred_Old[iVar] = Solution_Pred[iVar]; -} - -inline su2double *CFEAVariable::GetSolution_Vel(void) { return Solution_Vel; } - -inline su2double CFEAVariable::GetSolution_Vel(unsigned short val_var) { return Solution_Vel[val_var]; } - -inline su2double *CFEAVariable::GetSolution_Vel_time_n(void) { return Solution_Vel_time_n; } - -inline su2double CFEAVariable::GetSolution_Vel_time_n(unsigned short val_var) { return Solution_Vel_time_n[val_var]; } - -inline su2double *CFEAVariable::GetSolution_Accel(void) { return Solution_Accel; } - -inline su2double CFEAVariable::GetSolution_Accel(unsigned short val_var) { return Solution_Accel[val_var]; } - -inline su2double *CFEAVariable::GetSolution_Accel_time_n(void) { return Solution_Accel_time_n; } - -inline su2double CFEAVariable::GetSolution_Accel_time_n(unsigned short val_var) { return Solution_Accel_time_n[val_var]; } - -inline su2double *CFEAVariable::GetSolution_Pred(void) { return Solution_Pred; } - -inline su2double CFEAVariable::GetSolution_Pred(unsigned short val_var) { return Solution_Pred[val_var]; } - -inline su2double *CFEAVariable::GetSolution_Pred_Old(void) { return Solution_Pred_Old; } - -inline su2double CFEAVariable::GetSolution_Pred_Old(unsigned short val_var) { return Solution_Pred_Old[val_var]; } - -inline void CFEAVariable::SetVonMises_Stress(su2double val_stress) { VonMises_Stress = val_stress; } - -inline su2double CFEAVariable::GetVonMises_Stress(void) { return VonMises_Stress; } - -inline void CFEAVariable::SetReference_Geometry(unsigned short iVar, su2double ref_geometry){ Reference_Geometry[iVar] = ref_geometry;} - -inline su2double *CFEAVariable::GetReference_Geometry(void){ return Reference_Geometry; } - -inline su2double CFEAVariable::GetReference_Geometry(unsigned short iVar){ return Reference_Geometry[iVar]; } - -inline void CFEAVariable::Register_femSolution_time_n() { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution_time_n[iVar]); -} - -inline void CFEAVariable::RegisterSolution_Vel(bool input) { - if (input) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution_Vel[iVar]); - } - else { for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterOutput(Solution_Vel[iVar]);} -} - -inline void CFEAVariable::RegisterSolution_Vel_time_n() { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution_Vel_time_n[iVar]); -} - -inline void CFEAVariable::RegisterSolution_Accel(bool input) { - if (input) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution_Accel[iVar]); - } - else { for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterOutput(Solution_Accel[iVar]);} -} - -inline void CFEAVariable::RegisterSolution_Accel_time_n() { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution_Accel_time_n[iVar]); -} - -inline su2double CFEAVariable::Get_BGSSolution_k(unsigned short iDim) { return Solution_BGS_k[iDim];} - -inline void CFEAVariable::Set_BGSSolution_k(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_BGS_k[iVar] = Solution[iVar]; -} - -inline void CFEAVariable::SetPrestretch(unsigned short iVar, su2double val_prestretch) { Prestretch[iVar] = val_prestretch;} - -inline su2double *CFEAVariable::GetPrestretch(void) { return Prestretch; } - -inline su2double CFEAVariable::GetPrestretch(unsigned short iVar) { return Prestretch[iVar]; } - -inline void CTurbSAVariable::SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) { HB_Source[val_var] = val_source; } - -inline su2double CTurbSAVariable::GetHarmonicBalance_Source(unsigned short val_var) { return HB_Source[val_var]; } - -inline su2double CTurbSAVariable::GetGammaBC(void) { return gamma_BC; } - -inline void CTurbSAVariable::SetGammaBC(su2double val_gamma) { gamma_BC = val_gamma; } - -inline su2double CTurbSAVariable::GetDES_LengthScale(void) { return DES_LengthScale; } - -inline void CTurbSAVariable::SetDES_LengthScale(su2double val_des_lengthscale) { DES_LengthScale = val_des_lengthscale; } - -inline su2double CTurbSSTVariable::GetF1blending() { return F1; } - -inline su2double CTurbSSTVariable::GetF2blending() { return F2; } - -inline su2double CTurbSSTVariable::GetCrossDiff() { return CDkw; } - -inline void CAdjTurbVariable::SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar) { - for (unsigned short iVar = 0; iVar < numTotalVar; iVar++) { - EddyViscSens[iVar] = val_EddyViscSens[iVar];} -} - -inline su2double *CAdjTurbVariable::GetEddyViscSens(void) { return EddyViscSens; } - -inline void CVariable::RegisterSolution(bool input) { - if (input) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution[iVar]); - } - else { for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterOutput(Solution[iVar]);} -} - -inline void CVariable::RegisterSolution_time_n() { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution_time_n[iVar]); -} - -inline void CVariable::RegisterSolution_time_n1() { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Solution_time_n1[iVar]); -} - -inline void CVariable::SetAdjointSolution(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - SU2_TYPE::SetDerivative(Solution[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); -} - - -inline void CVariable::GetAdjointSolution(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution[iVar]); - } -} - -inline void CVariable::SetAdjointSolution_time_n(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - SU2_TYPE::SetDerivative(Solution_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); -} - - -inline void CVariable::GetAdjointSolution_time_n(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n[iVar]); - } -} - -inline void CVariable::SetAdjointSolution_time_n1(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - SU2_TYPE::SetDerivative(Solution_time_n1[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); -} - - -inline void CVariable::GetAdjointSolution_time_n1(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n1[iVar]); - } -} -inline void CVariable::SetDual_Time_Derivative(unsigned short iVar, su2double der) {} - -inline void CDiscAdjVariable::SetDual_Time_Derivative(unsigned short iVar, su2double der) {DualTime_Derivative[iVar] = der;} - -inline void CVariable::SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {} - -inline void CDiscAdjVariable::SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {DualTime_Derivative_n[iVar] = der;} - -inline su2double CVariable::GetDual_Time_Derivative(unsigned short iVar) { return 0.0;} - -inline su2double CDiscAdjVariable::GetDual_Time_Derivative(unsigned short iVar) { return DualTime_Derivative[iVar];} - -inline su2double CVariable::GetDual_Time_Derivative_n(unsigned short iVar) { return 0.0;} - -inline su2double CDiscAdjVariable::GetDual_Time_Derivative_n(unsigned short iVar) { return DualTime_Derivative_n[iVar];} - -inline void CVariable::SetSensitivity(unsigned short iDim, su2double val) {} - -inline su2double CVariable::GetSensitivity(unsigned short iDim) { return 0.0; } - -inline void CDiscAdjVariable::SetSensitivity(unsigned short iDim, su2double val) {Sensitivity[iDim] = val;} - -inline su2double CDiscAdjVariable::GetSensitivity(unsigned short iDim) { return Sensitivity[iDim];} - -inline su2double* CDiscAdjVariable::GetSolution_Direct() { return Solution_Direct; } - -inline void CDiscAdjVariable::SetSolution_Direct(su2double *val_solution_direct) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - Solution_Direct[iVar] = val_solution_direct[iVar]; - } -} - -inline su2double* CDiscAdjVariable::GetGeometry_Direct() { return Geometry_Direct; } - -inline su2double CDiscAdjVariable::GetGeometry_Direct(unsigned short val_dim) { return Geometry_Direct[val_dim]; } - -inline void CDiscAdjVariable::SetGeometry_Direct(su2double *val_geometry_direct) { - for (unsigned short iDim = 0; iDim < nDim; iDim++){ - Geometry_Direct[iDim] = val_geometry_direct[iDim]; - } -} - -inline su2double CDiscAdjVariable::GetSolution_Geometry(unsigned short val_var) { return Solution_Geometry[val_var];} - -inline void CDiscAdjVariable::SetSolution_Geometry(su2double *val_solution_geometry) { - for (unsigned short iDim = 0; iDim < nDim; iDim++){ - Solution_Geometry[iDim] = val_solution_geometry[iDim]; - } -} - -inline void CDiscAdjVariable::SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry) { - Solution_Geometry[val_var] = val_solution_geometry; -} - -inline void CDiscAdjVariable::Set_OldSolution_Geometry(void) { - for (unsigned short iDim = 0; iDim < nDim; iDim++){ - Solution_Geometry_Old[iDim] = Solution_Geometry[iDim]; - } -} - -inline su2double CDiscAdjVariable::GetGeometry_CrossTerm_Derivative(unsigned short val_var) { return Geometry_CrossTerm_Derivative[val_var];} - -inline void CDiscAdjVariable::SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) { Geometry_CrossTerm_Derivative[iDim] = der;} - -inline su2double CDiscAdjVariable::GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) { return Geometry_CrossTerm_Derivative_Flow[val_var];} - -inline void CDiscAdjVariable::SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der) { Geometry_CrossTerm_Derivative_Flow[iDim] = der;} - -inline su2double CDiscAdjFEAVariable::GetGeometry_CrossTerm_Derivative(unsigned short val_var) { return Geometry_CrossTerm_Derivative[val_var];} - -inline void CDiscAdjFEAVariable::SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) { Geometry_CrossTerm_Derivative[iDim] = der;} - -inline su2double CDiscAdjVariable::Get_OldSolution_Geometry(unsigned short iDim) { return Solution_Geometry_Old[iDim];} - -inline void CVariable::SetDynamic_Derivative(unsigned short iVar, su2double der) { } - -inline void CVariable::SetDynamic_Derivative_n(unsigned short iVar, su2double der) { } - -inline su2double CVariable::GetDynamic_Derivative(unsigned short iVar) { return 0.0; } - -inline su2double CVariable::GetDynamic_Derivative_n(unsigned short iVar) { return 0.0; } - -inline void CVariable::SetDynamic_Derivative_Vel(unsigned short iVar, su2double der) { } - -inline void CVariable::SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der) { } - -inline su2double CVariable::GetDynamic_Derivative_Vel(unsigned short iVar) { return 0.0; } - -inline su2double CVariable::GetDynamic_Derivative_Vel_n(unsigned short iVar) { return 0.0; } - -inline void CVariable::SetDynamic_Derivative_Accel(unsigned short iVar, su2double der) { } - -inline void CVariable::SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der) { } - -inline su2double CVariable::GetDynamic_Derivative_Accel(unsigned short iVar) { return 0.0; } - -inline su2double CVariable::GetDynamic_Derivative_Accel_n(unsigned short iVar) { return 0.0; } - -inline su2double CVariable::GetSolution_Old_Vel(unsigned short iVar){ return 0.0; } - -inline su2double CVariable::GetSolution_Old_Accel(unsigned short iVar){ return 0.0; } - -inline void CDiscAdjFEAVariable::SetDynamic_Derivative(unsigned short iVar, su2double der) { Dynamic_Derivative[iVar] = der; } - -inline void CDiscAdjFEAVariable::SetDynamic_Derivative_n(unsigned short iVar, su2double der) { Dynamic_Derivative_n[iVar] = der; } - -inline su2double CDiscAdjFEAVariable::GetDynamic_Derivative(unsigned short iVar) { return Dynamic_Derivative[iVar]; } - -inline su2double CDiscAdjFEAVariable::GetDynamic_Derivative_n(unsigned short iVar) { return Dynamic_Derivative_n[iVar]; } - -inline void CDiscAdjFEAVariable::SetDynamic_Derivative_Vel(unsigned short iVar, su2double der) { Dynamic_Derivative_Vel[iVar] = der; } - -inline void CDiscAdjFEAVariable::SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der) { Dynamic_Derivative_Vel_n[iVar] = der; } - -inline su2double CDiscAdjFEAVariable::GetDynamic_Derivative_Vel(unsigned short iVar) { return Dynamic_Derivative_Vel[iVar]; } - -inline su2double CDiscAdjFEAVariable::GetDynamic_Derivative_Vel_n(unsigned short iVar) { return Dynamic_Derivative_Vel_n[iVar]; } - -inline void CDiscAdjFEAVariable::SetDynamic_Derivative_Accel(unsigned short iVar, su2double der) { Dynamic_Derivative_Accel[iVar] = der; } - -inline void CDiscAdjFEAVariable::SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der) { Dynamic_Derivative_Accel_n[iVar] = der; } - -inline su2double CDiscAdjFEAVariable::GetDynamic_Derivative_Accel(unsigned short iVar) { return Dynamic_Derivative_Accel[iVar]; } - -inline su2double CDiscAdjFEAVariable::GetDynamic_Derivative_Accel_n(unsigned short iVar) { return Dynamic_Derivative_Accel_n[iVar]; } - -inline su2double CDiscAdjFEAVariable::GetSolution_Old_Vel(unsigned short iVar){ return Solution_Old_Vel[iVar]; } - -inline su2double CDiscAdjFEAVariable::GetSolution_Old_Accel(unsigned short iVar){ return Solution_Old_Accel[iVar]; } - - -inline void CDiscAdjFEAVariable::SetSolution_Accel(su2double *val_solution_accel) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel[iVar] = val_solution_accel[iVar]; -} - -inline void CDiscAdjFEAVariable::SetSolution_Vel(su2double *val_solution_vel) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel[iVar] = val_solution_vel[iVar]; -} - -inline void CDiscAdjFEAVariable::Set_OldSolution_Accel(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Old_Accel[iVar] = Solution_Accel[iVar]; - } - -inline void CDiscAdjFEAVariable::Set_OldSolution_Vel(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Old_Vel[iVar] = Solution_Vel[iVar]; -} - -inline void CDiscAdjFEAVariable::SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = val_solution_accel_time_n[iVar]; -} - -inline void CDiscAdjFEAVariable::SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = val_solution_vel_time_n[iVar]; -} - -inline void CDiscAdjFEAVariable::SetSolution_Direct(su2double *val_solution_direct) { - for (unsigned short iVar = 0; iVar < nVar; iVar++){ - Solution_Direct[iVar] = val_solution_direct[iVar]; - } -} - -inline void CDiscAdjFEAVariable::SetSensitivity(unsigned short iDim, su2double val){Sensitivity[iDim] = val;} - -inline su2double CDiscAdjFEAVariable::GetSensitivity(unsigned short iDim){return Sensitivity[iDim];} - -inline su2double* CDiscAdjFEAVariable::GetSolution_Direct() { return Solution_Direct; } - -inline su2double* CDiscAdjFEAVariable::GetSolution_Vel_Direct() { return Solution_Direct_Vel; } - -inline void CDiscAdjFEAVariable::SetSolution_Vel_Direct(su2double *val_solution_direct) { - for (unsigned short iVar = 0; iVar < nVar; iVar++){ - Solution_Direct_Vel[iVar] = val_solution_direct[iVar]; - } - } - -inline su2double* CDiscAdjFEAVariable::GetSolution_Accel_Direct() { return Solution_Direct_Accel; } - -inline void CDiscAdjFEAVariable::SetSolution_Accel_Direct(su2double *val_solution_direct) { - for (unsigned short iVar = 0; iVar < nVar; iVar++){ - Solution_Direct_Accel[iVar] = val_solution_direct[iVar]; - } -} - -inline void CDiscAdjFEAVariable::SetSolution_time_n(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = Solution[iVar]; -} - -inline su2double CDiscAdjFEAVariable::GetSolution_Accel(unsigned short val_var) { return Solution_Accel[val_var]; } -inline su2double CDiscAdjFEAVariable::GetSolution_Accel_time_n(unsigned short val_var) { return Solution_Accel_time_n[val_var]; } -inline su2double CDiscAdjFEAVariable::GetSolution_Vel_time_n(unsigned short val_var) { return Solution_Vel_time_n[val_var]; } -inline su2double CDiscAdjFEAVariable::GetSolution_Vel(unsigned short val_var) { return Solution_Vel[val_var]; } - -inline void CFEAVariable::SetAdjointSolution_Vel(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - SU2_TYPE::SetDerivative(Solution_Vel[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); -} - -inline void CFEAVariable::GetAdjointSolution_Vel(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++){ - adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel[iVar]); - } -} - -inline void CFEAVariable::SetAdjointSolution_Vel_time_n(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - SU2_TYPE::SetDerivative(Solution_Vel_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); -} - -inline void CFEAVariable::GetAdjointSolution_Vel_time_n(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++){ - adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel_time_n[iVar]); - } -} - -inline void CFEAVariable::SetAdjointSolution_Accel(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - SU2_TYPE::SetDerivative(Solution_Accel[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); -} - -inline void CFEAVariable::GetAdjointSolution_Accel(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++){ - adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel[iVar]); - } -} - -inline void CFEAVariable::SetAdjointSolution_Accel_time_n(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - SU2_TYPE::SetDerivative(Solution_Accel_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); -} - -inline void CFEAVariable::GetAdjointSolution_Accel_time_n(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++){ - adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel_time_n[iVar]); - } -} - -inline su2double CDiscAdjVariable::GetCross_Term_Derivative(unsigned short iVar) { return Cross_Term_Derivative[iVar]; } - -inline void CDiscAdjVariable::SetCross_Term_Derivative(unsigned short iVar, su2double der) { Cross_Term_Derivative[iVar] = der; } - -inline su2double CDiscAdjFEAVariable::GetCross_Term_Derivative(unsigned short iVar) { return Cross_Term_Derivative[iVar]; } - -inline void CDiscAdjFEAVariable::SetCross_Term_Derivative(unsigned short iVar, su2double der) { Cross_Term_Derivative[iVar] = der; } - -inline void CDiscAdjVariable::Set_BGSSolution_k(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_BGS_k[iVar] = Solution_BGS[iVar]; -} - -inline void CDiscAdjVariable::Set_BGSSolution(unsigned short iDim, su2double val_solution) { - Solution_BGS[iDim] = val_solution; -} - -inline su2double CDiscAdjVariable::Get_BGSSolution(unsigned short iDim) { return Solution_BGS[iDim];} - -inline su2double CDiscAdjVariable::Get_BGSSolution_k(unsigned short iDim) { return Solution_BGS_k[iDim];} - -inline void CDiscAdjVariable::Set_BGSSolution_Geometry(void) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution_Geometry_BGS_k[iDim] = Solution_Geometry[iDim]; -} - -inline su2double CDiscAdjVariable::Get_BGSSolution_Geometry(unsigned short iDim) { return Solution_Geometry_BGS_k[iDim];} - -inline void CDiscAdjFEAVariable::Set_BGSSolution(unsigned short iDim, su2double val_solution) { - Solution_BGS[iDim] = val_solution; -} - -inline void CDiscAdjFEAVariable::Set_BGSSolution_k(void) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution_BGS_k[iDim] = Solution_BGS[iDim]; -} - -inline su2double CDiscAdjFEAVariable::Get_BGSSolution(unsigned short iDim) { return Solution_BGS[iDim];} - -inline su2double CDiscAdjFEAVariable::Get_BGSSolution_k(unsigned short iDim) { return Solution_BGS_k[iDim];} - diff --git a/SU2_CFD/include/variables/CAdjEulerVariable.hpp b/SU2_CFD/include/variables/CAdjEulerVariable.hpp new file mode 100644 index 000000000000..2669e6c6e01b --- /dev/null +++ b/SU2_CFD/include/variables/CAdjEulerVariable.hpp @@ -0,0 +1,150 @@ +/*! + * \file CAdjEulerVariable.hpp + * \brief Main class for defining the variables of the adjoint Euler solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CAdjEulerVariable + * \brief Main class for defining the variables of the adjoint Euler solver. + * \ingroup Euler_Equations + * \author F. Palacios, T. Economon + */ +class CAdjEulerVariable : public CVariable { +protected: + su2double *Psi; /*!< \brief Vector of the adjoint variables. */ + su2double *ForceProj_Vector; /*!< \brief Vector d. */ + su2double *ObjFuncSource; /*!< \brief Vector containing objective function sensitivity for discrete adjoint. */ + su2double *IntBoundary_Jump; /*!< \brief Interior boundary jump vector. */ + su2double *HB_Source; /*!< \brief Harmonic balance source term. */ + bool incompressible; +public: + + /*! + * \brief Constructor of the class. + */ + CAdjEulerVariable(void); + + /*! + * \overload + * \param[in] val_psirho - Value of the adjoint density (initialization value). + * \param[in] val_phi - Value of the adjoint velocity (initialization value). + * \param[in] val_psie - Value of the adjoint energy (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAdjEulerVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_solution - Pointer to the adjoint value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAdjEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CAdjEulerVariable(void); + + /*! + * \brief Set all the primitive variables for compressible flows. + */ + bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config); + + /*! + * \brief Set the value of the adjoint velocity. + * \param[in] val_phi - Value of the adjoint velocity. + */ + inline void SetPhi_Old(su2double *val_phi) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1]=val_phi[iDim]; }; + + /*! + * \brief Set the value of the force projection vector. + * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. + */ + inline void SetForceProj_Vector(su2double *val_ForceProj_Vector) {for (unsigned short iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = val_ForceProj_Vector[iDim]; } + + /*! + * \brief Set the value of the objective function source. + * \param[in] val_ObjFuncSource - Pointer to the objective function source. + */ + inline void SetObjFuncSource(su2double *val_ObjFuncSource) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) ObjFuncSource[iVar] = val_ObjFuncSource[iVar]; + } + + /*! + * \brief Set the value of the interior boundary jump vector vector. + * \param[in] val_IntBoundary_Jump - Pointer to the interior boundary jump vector. + */ + inline void SetIntBoundary_Jump(su2double *val_IntBoundary_Jump) {for (unsigned short iVar = 0; iVar < nVar; iVar++) IntBoundary_Jump[iVar] = val_IntBoundary_Jump[iVar]; } + + /*! + * \brief Get the value of the force projection vector. + * \return Pointer to the force projection vector. + */ + inline su2double *GetForceProj_Vector(void) {return ForceProj_Vector; } + + /*! + * \brief Get the value of the objective function source. + * \param[in] val_SetObjFuncSource - Pointer to the objective function source. + */ + inline su2double *GetObjFuncSource(void) {return ObjFuncSource; } + + /*! + * \brief Get the value of the force projection vector. + * \return Pointer to the force projection vector. + */ + inline su2double *GetIntBoundary_Jump(void) {return IntBoundary_Jump; } + + /*! + * \brief Set the harmonic balance source term. + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the harmonic balance source term. for the index val_var. + */ + inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } + + /*! + * \brief Get the harmonic balance source term. + * \param[in] val_var - Index of the variable. + * \return Value of the harmonic balance source term for the index val_var. + */ + inline su2double GetHarmonicBalance_Source(unsigned short val_var) {return HB_Source[val_var]; } +}; diff --git a/SU2_CFD/include/variables/CAdjNSVariable.hpp b/SU2_CFD/include/variables/CAdjNSVariable.hpp new file mode 100644 index 000000000000..3fa469a1b1b9 --- /dev/null +++ b/SU2_CFD/include/variables/CAdjNSVariable.hpp @@ -0,0 +1,111 @@ +/*! + * \file CAdjNSVariable.hpp + * \brief Main class for defining the variables of the adjoint Navier-Stokes solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CAdjEulerVariable.hpp" + +/*! + * \class CAdjNSVariable + * \brief Main class for defining the variables of the adjoint Navier-Stokes solver. + * \ingroup Navier_Stokes_Equations + * \author F. Palacios + */ +class CAdjNSVariable : public CAdjEulerVariable { +private: + +public: + + /*! + * \brief Constructor of the class. + */ + CAdjNSVariable(void); + + /*! + * \overload + * \param[in] val_psirho - Value of the adjoint density (initialization value). + * \param[in] val_phi - Value of the adjoint velocity (initialization value). + * \param[in] val_psie - Value of the adjoint energy (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAdjNSVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_solution - Pointer to the adjoint value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAdjNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CAdjNSVariable(void); + + /*! + * \brief Set the value of the adjoint velocity. + * \param[in] val_phi - Value of the adjoint velocity. + */ + inline void SetPhi_Old(su2double *val_phi) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = val_phi[iDim]; }; + + /*! + * \brief Set the value of the force projection vector. + * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. + */ + inline void SetForceProj_Vector(su2double *val_ForceProj_Vector) {for (unsigned short iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = val_ForceProj_Vector[iDim]; } + + /*! + * \brief Get the value of the force projection vector. + * \return Pointer to the force projection vector. + */ + inline su2double *GetForceProj_Vector(void) {return ForceProj_Vector; } + + /*! + * \brief Set the value of the force projection vector on the solution vector. + */ + inline void SetVelSolutionOldDVector(void) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = ForceProj_Vector[iDim]; }; + + /*! + * \brief Set the value of the force projection vector on the old solution vector. + */ + inline void SetVelSolutionDVector(void) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = ForceProj_Vector[iDim]; }; + +}; diff --git a/SU2_CFD/include/variables/CAdjTurbVariable.hpp b/SU2_CFD/include/variables/CAdjTurbVariable.hpp new file mode 100644 index 000000000000..d16264763870 --- /dev/null +++ b/SU2_CFD/include/variables/CAdjTurbVariable.hpp @@ -0,0 +1,91 @@ +/*! + * \file CAdjTurbVariable.hpp + * \brief Main class for defining the variables of the adjoint turbulence model. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CAdjTurbVariable + * \brief Main class for defining the variables of the adjoint turbulence model. + * \ingroup Turbulence_Model + * \author A. Bueno. + */ +class CAdjTurbVariable : public CVariable { +protected: + su2double *dmuT_dUTvar; /*!< \brief Sensitivity of eddy viscosity to mean flow and turbulence vars. */ + su2double **dRTstar_dUTvar; /*!< \brief Sensitivity of modified turbulence residual (no boundary flux) + to mean flow and turbulence vars. */ + su2double **dFT_dUTvar; /*!< \brief Sensitivity of boundary flux + to mean flow and turbulence vars. */ + su2double *EddyViscSens; /*!< \brief Eddy Viscosity Sensitivity. */ + +public: + + /*! + * \brief Constructor of the class. + */ + CAdjTurbVariable(void); + + /*! + * \overload + * \param[in] val_psinu_inf - Value of the adjoint turbulence variable at the infinity (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CAdjTurbVariable(void); + + /*! + * \brief Set the Eddy Viscosity Sensitivity of the problem. + * \param[in] val_EddyViscSens - Eddy Viscosity Sensitivity. + */ + inline void SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar) { + for (unsigned short iVar = 0; iVar < numTotalVar; iVar++) EddyViscSens[iVar] = val_EddyViscSens[iVar]; + } + + /*! + * \brief Get the Eddy Viscosity Sensitivity of the problem. + * \return Pointer to the Eddy Viscosity Sensitivity. + */ + inline su2double *GetEddyViscSens(void) {return EddyViscSens; } +}; diff --git a/SU2_CFD/include/variables/CBaselineVariable.hpp b/SU2_CFD/include/variables/CBaselineVariable.hpp new file mode 100644 index 000000000000..6ae54ed24b3c --- /dev/null +++ b/SU2_CFD/include/variables/CBaselineVariable.hpp @@ -0,0 +1,68 @@ +/*! + * \file CBaselineVariable.hpp + * \brief Main class for defining the variables of a baseline solution from a restart file (for output). + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CBaselineVariable + * \brief Main class for defining the variables of a baseline solution from a restart file (for output). + * \author F. Palacios, T. Economon. + */ +class CBaselineVariable : public CVariable { +public: + + /*! + * \brief Constructor of the class. + */ + CBaselineVariable(void); + + /*! + * \overload + * \param[in] val_solution - Pointer to the flow value (initialization value). + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CBaselineVariable(su2double *val_solution, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CBaselineVariable(void); + +}; diff --git a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp new file mode 100644 index 000000000000..7cd9504026e4 --- /dev/null +++ b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp @@ -0,0 +1,303 @@ +/*! + * \file CDiscAdjFEAVariable.hpp + * \brief Main class for defining the variables of the adjoint solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CDiscAdjFEAVariable + * \brief Main class for defining the variables of the adjoint solver. + * \ingroup Discrete_Adjoint + * \author T. Albring, R. Sanchez. + * \version 6.2.0 "Falcon" + */ +class CDiscAdjFEAVariable : public CVariable { +private: + su2double* Sensitivity; /* Vector holding the derivative of target functional with respect to the coordinates at this node*/ + su2double* Solution_Direct; + + su2double* Dynamic_Derivative; + su2double* Dynamic_Derivative_n; + su2double* Dynamic_Derivative_Vel; + su2double* Dynamic_Derivative_Vel_n; + su2double* Dynamic_Derivative_Accel; + su2double* Dynamic_Derivative_Accel_n; + + su2double* Solution_Vel; + su2double* Solution_Accel; + + su2double* Solution_Vel_time_n; + su2double* Solution_Accel_time_n; + + su2double* Solution_Old_Vel; + su2double* Solution_Old_Accel; + + su2double* Solution_Direct_Vel; + su2double* Solution_Direct_Accel; + + su2double* Cross_Term_Derivative; + su2double* Geometry_CrossTerm_Derivative; + + su2double* Solution_BGS; + su2double* Solution_BGS_k; + +public: + /*! + * \brief Constructor of the class. + */ + CDiscAdjFEAVariable(void); + + /*! + * \brief Destructor of the class. + */ + ~CDiscAdjFEAVariable(void); + + /*! + * \overload + * \param[in] val_solution - Pointer to the adjoint value (initialization value). + * \param[in] val_ndim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CDiscAdjFEAVariable(su2double *val_solution, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_solution - Pointer to the adjoint value (initialization value). + * \param[in] val_solution_accel - Pointer to the adjoint value (initialization value). + * \param[in] val_solution_vel - Pointer to the adjoint value (initialization value). + * \param[in] val_ndim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CDiscAdjFEAVariable(su2double *val_solution, su2double *val_solution_accel, su2double *val_solution_vel, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Set the sensitivity at the node + * \param[in] iDim - spacial component + * \param[in] val - value of the Sensitivity + */ + inline void SetSensitivity(unsigned short iDim, su2double val) {Sensitivity[iDim] = val;} + + /*! + * \brief Get the Sensitivity at the node + * \param[in] iDim - spacial component + * \return value of the Sensitivity + */ + inline su2double GetSensitivity(unsigned short iDim) {return Sensitivity[iDim];} + + inline void SetDynamic_Derivative(unsigned short iVar, su2double der) {Dynamic_Derivative[iVar] = der; } + + inline void SetDynamic_Derivative_n(unsigned short iVar, su2double der) {Dynamic_Derivative_n[iVar] = der; } + + inline su2double GetDynamic_Derivative(unsigned short iVar) {return Dynamic_Derivative[iVar]; } + + inline su2double GetDynamic_Derivative_n(unsigned short iVar) {return Dynamic_Derivative_n[iVar]; } + + inline void SetDynamic_Derivative_Vel(unsigned short iVar, su2double der) {Dynamic_Derivative_Vel[iVar] = der; } + + inline void SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der) {Dynamic_Derivative_Vel_n[iVar] = der; } + + inline su2double GetDynamic_Derivative_Vel(unsigned short iVar) {return Dynamic_Derivative_Vel[iVar]; } + + inline su2double GetDynamic_Derivative_Vel_n(unsigned short iVar) {return Dynamic_Derivative_Vel_n[iVar]; } + + inline void SetDynamic_Derivative_Accel(unsigned short iVar, su2double der) {Dynamic_Derivative_Accel[iVar] = der; } + + inline void SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der) {Dynamic_Derivative_Accel_n[iVar] = der; } + + inline su2double GetDynamic_Derivative_Accel(unsigned short iVar) {return Dynamic_Derivative_Accel[iVar]; } + + inline su2double GetDynamic_Derivative_Accel_n(unsigned short iVar) {return Dynamic_Derivative_Accel_n[iVar]; } + + inline void SetSolution_Direct(su2double *val_solution_direct) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Direct[iVar] = val_solution_direct[iVar]; + } + + inline void SetSolution_Vel_Direct(su2double *val_solution_direct) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Direct_Vel[iVar] = val_solution_direct[iVar]; + } + + inline void SetSolution_Accel_Direct(su2double *val_solution_direct) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Direct_Accel[iVar] = val_solution_direct[iVar]; + } + + inline su2double* GetSolution_Direct() {return Solution_Direct; } + + inline su2double* GetSolution_Vel_Direct() {return Solution_Direct_Vel; } + + inline su2double* GetSolution_Accel_Direct() {return Solution_Direct_Accel; } + + inline su2double GetSolution_Old_Vel(unsigned short iVar) {return Solution_Old_Vel[iVar]; } + + inline su2double GetSolution_Old_Accel(unsigned short iVar) {return Solution_Old_Accel[iVar]; } + + /*! + * \brief Get the acceleration (Structural Analysis). + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetSolution_Accel(unsigned short val_var) {return Solution_Accel[val_var]; } + + /*! + * \brief Get the acceleration of the nodes (Structural Analysis) at time n. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Accel_time_n(unsigned short val_var) {return Solution_Accel_time_n[val_var]; } + + /*! + * \brief Get the velocity (Structural Analysis). + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetSolution_Vel(unsigned short val_var) {return Solution_Vel[val_var]; } + + /*! + * \brief Get the velocity of the nodes (Structural Analysis) at time n. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Vel_time_n(unsigned short val_var) {return Solution_Vel_time_n[val_var]; } + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = Solution[iVar]; + } + + /*! + * \brief Set the value of the acceleration (Structural Analysis - adjoint). + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline void SetSolution_Accel(su2double *val_solution_accel) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_Accel[iVar] = val_solution_accel[iVar]; + } + + /*! + * \brief Set the value of the velocity (Structural Analysis - adjoint). + * \param[in] val_solution - Solution of the problem (velocity). + */ + inline void SetSolution_Vel(su2double *val_solution_vel) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel[iVar] = val_solution_vel[iVar]; + } + + /*! + * \brief Set the value of the adjoint acceleration (Structural Analysis) at time n. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = val_solution_accel_time_n[iVar]; + } + + /*! + * \brief Set the value of the adjoint velocity (Structural Analysis) at time n. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = val_solution_vel_time_n[iVar]; + } + + /*! + * \brief Set the value of the old acceleration (Structural Analysis - adjoint). + * \param[in] val_solution - Old solution of the problem (acceleration). + */ + inline void Set_OldSolution_Accel(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Old_Accel[iVar] = Solution_Accel[iVar]; + } + + /*! + * \brief Set the value of the old velocity (Structural Analysis - adjoint). + * \param[in] val_solution - Old solution of the problem (velocity). + */ + inline void Set_OldSolution_Vel(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Old_Vel[iVar] = Solution_Vel[iVar]; + } + + /*! + * \brief Set the contribution of crossed terms into the derivative. + */ + inline void SetCross_Term_Derivative(unsigned short iVar, su2double der) {Cross_Term_Derivative[iVar] = der; } + + /*! + * \brief Get the contribution of crossed terms into the derivative. + */ + inline su2double GetCross_Term_Derivative(unsigned short iVar) {return Cross_Term_Derivative[iVar]; } + + /*! + * \brief A virtual member. Get the geometry solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return Geometry_CrossTerm_Derivative[val_var];} + + /*! + * \brief A virtual member. Set the value of the mesh solution (adjoint). + * \param[in] der - cross term derivative. + */ + inline void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) {Geometry_CrossTerm_Derivative[iDim] = der;} + + /*! + * \brief Set the value of the adjoint solution in the current BGS subiteration. + */ + inline void Set_BGSSolution(unsigned short iDim, su2double val_solution) {Solution_BGS[iDim] = val_solution;} + + /*! + * \brief Set the value of the adjoint solution in the previous BGS subiteration. + */ + inline void Set_BGSSolution_k(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution_BGS_k[iDim] = Solution_BGS[iDim]; + } + + /*! + * \brief Get the value of the adjoint solution in the previous BGS subiteration. + * \param[out] val_solution - adjoint solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution(unsigned short iDim) {return Solution_BGS[iDim];} + + /*! + * \brief Get the value of the adjoint solution in the previous BGS subiteration. + * \param[out] val_solution - adjoint solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution_k(unsigned short iDim) {return Solution_BGS_k[iDim];} + +}; diff --git a/SU2_CFD/include/variables/CDiscAdjVariable.hpp b/SU2_CFD/include/variables/CDiscAdjVariable.hpp new file mode 100644 index 000000000000..d63354c0791d --- /dev/null +++ b/SU2_CFD/include/variables/CDiscAdjVariable.hpp @@ -0,0 +1,250 @@ +/*! + * \file CDiscAdjVariable.hpp + * \brief Main class for defining the variables of the adjoint solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CDiscAdjVariable + * \brief Main class for defining the variables of the adjoint solver. + * \ingroup Discrete_Adjoint + * \author T. Albring. + */ +class CDiscAdjVariable : public CVariable { +private: + su2double* Sensitivity; /* Vector holding the derivative of target functional with respect to the coordinates at this node*/ + su2double* Solution_Direct; + su2double* DualTime_Derivative; + su2double* DualTime_Derivative_n; + + su2double* Cross_Term_Derivative; + su2double* Geometry_CrossTerm_Derivative; + su2double* Geometry_CrossTerm_Derivative_Flow; + + su2double* Solution_Geometry; + su2double* Solution_Geometry_Old; + su2double* Geometry_Direct; + + su2double* Solution_BGS; + su2double* Solution_BGS_k; + su2double* Solution_Geometry_BGS_k; + +public: + /*! + * \brief Constructor of the class. + */ + CDiscAdjVariable(void); + + /*! + * \brief Destructor of the class. + */ + ~CDiscAdjVariable(void); + + /*! + * \overload + * \param[in] val_solution - Pointer to the adjoint value (initialization value). + * \param[in] val_ndim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CDiscAdjVariable(su2double *val_solution, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Set the sensitivity at the node + * \param[in] iDim - spacial component + * \param[in] val - value of the Sensitivity + */ + inline void SetSensitivity(unsigned short iDim, su2double val) {Sensitivity[iDim] = val;} + + /*! + * \brief Get the Sensitivity at the node + * \param[in] iDim - spacial component + * \return value of the Sensitivity + */ + inline su2double GetSensitivity(unsigned short iDim) {return Sensitivity[iDim];} + + inline void SetDual_Time_Derivative(unsigned short iVar, su2double der) {DualTime_Derivative[iVar] = der;} + + inline void SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {DualTime_Derivative_n[iVar] = der;} + + inline su2double GetDual_Time_Derivative(unsigned short iVar) {return DualTime_Derivative[iVar];} + + inline su2double GetDual_Time_Derivative_n(unsigned short iVar) {return DualTime_Derivative_n[iVar];} + + inline void SetSolution_Direct(su2double *val_solution_direct) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_Direct[iVar] = val_solution_direct[iVar]; + } + + inline su2double* GetSolution_Direct() {return Solution_Direct; } + + /*! + * \brief Set the restart geometry (coordinate of the converged solution) + * \param[in] val_geometry_direct - Value of the restart coordinate. + */ + inline void SetGeometry_Direct(su2double *val_geometry_direct) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Geometry_Direct[iDim] = val_geometry_direct[iDim]; + } + + /*! + * \brief Get the restart geometry (coordinate of the converged solution). + * \return Pointer to the restart coordinate vector. + */ + inline su2double *GetGeometry_Direct(void) {return Geometry_Direct;} + + /*! + * \brief Get the restart geometry (coordinate of the converged solution). + * \return Coordinate val_dim of the geometry_direct vector. + */ + inline su2double GetGeometry_Direct(unsigned short val_dim) {return Geometry_Direct[val_dim]; } + + /*! + * \brief Get the geometry solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetSolution_Geometry(unsigned short val_var) {return Solution_Geometry[val_var];} + + /*! + * \brief Set the value of the mesh solution (adjoint). + * \param[in] val_solution_geometry - Solution of the problem (acceleration). + */ + inline void SetSolution_Geometry(su2double *val_solution_geometry) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution_Geometry[iDim] = val_solution_geometry[iDim]; + } + + /*! + * \brief A virtual member. Set the value of the mesh solution (adjoint). + * \param[in] val_solution_geometry - Solution of the problem (acceleration). + */ + inline void SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry) { + Solution_Geometry[val_var] = val_solution_geometry; + } + + /*! + * \brief A virtual member. Get the geometry solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return Geometry_CrossTerm_Derivative[val_var];} + + /*! + * \brief A virtual member. Set the value of the mesh solution (adjoint). + * \param[in] der - cross term derivative. + */ + inline void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) {Geometry_CrossTerm_Derivative[iDim] = der;} + + /*! + * \brief Get the mesh cross term derivative from the flow solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) {return Geometry_CrossTerm_Derivative_Flow[val_var];} + + /*! + * \brief Set the value of the mesh cross term derivative from the flow solution (adjoint). + * \param[in] der - cross term derivative. + */ + inline void SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der) {Geometry_CrossTerm_Derivative_Flow[iDim] = der;} + + /*! + * \brief Set the value of the mesh solution (adjoint). + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline void Set_OldSolution_Geometry(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution_Geometry_Old[iDim] = Solution_Geometry[iDim]; + } + + /*! + * \brief Get the value of the old geometry solution (adjoint). + * \param[out] val_solution - old adjoint solution for coordinate iDim + */ + inline su2double Get_OldSolution_Geometry(unsigned short iDim) {return Solution_Geometry_Old[iDim];} + + /*! + * \brief Set the value of the adjoint solution in the current BGS subiteration. + */ + inline void Set_BGSSolution(unsigned short iDim, su2double val_solution) {Solution_BGS[iDim] = val_solution;} + + /*! + * \brief Set the value of the adjoint solution in the previous BGS subiteration. + */ + inline void Set_BGSSolution_k(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_BGS_k[iVar] = Solution_BGS[iVar]; + } + + /*! + * \brief Get the value of the adjoint solution in the previous BGS subiteration. + * \param[out] val_solution - adjoint solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution(unsigned short iDim) {return Solution_BGS[iDim];} + + /*! + * \brief Get the value of the adjoint solution in the previous BGS subiteration. + * \param[out] val_solution - adjoint solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution_k(unsigned short iDim) {return Solution_BGS_k[iDim];} + + /*! + * \brief Set the value of the adjoint geometry solution in the previous BGS subiteration. + */ + inline void Set_BGSSolution_Geometry(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution_Geometry_BGS_k[iDim] = Solution_Geometry[iDim]; + } + + /*! + * \brief Get the value of the adjoint geometry solution in the previous BGS subiteration. + * \param[out] val_solution - geometrical adjoint solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution_Geometry(unsigned short iDim) {return Solution_Geometry_BGS_k[iDim];} + + /*! + * \brief Set the contribution of crossed terms into the derivative. + */ + inline void SetCross_Term_Derivative(unsigned short iVar, su2double der) {Cross_Term_Derivative[iVar] = der; } + + /*! + * \brief Get the contribution of crossed terms into the derivative. + */ + inline su2double GetCross_Term_Derivative(unsigned short iVar) {return Cross_Term_Derivative[iVar]; } + +}; diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp new file mode 100644 index 000000000000..badf79975c08 --- /dev/null +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -0,0 +1,532 @@ +/*! + * \file CEulerVariable.hpp + * \brief Class for defining the variables of the compressible Euler solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CEulerVariable + * \brief Class for defining the variables of the compressible Euler solver. + * \ingroup Euler_Equations + * \author F. Palacios, T. Economon + */ +class CEulerVariable : public CVariable { +protected: + su2double Velocity2; /*!< \brief Square of the velocity vector. */ + su2double *HB_Source; /*!< \brief harmonic balance source term. */ + su2double Precond_Beta; /*!< \brief Low Mach number preconditioner value, Beta. */ + su2double *WindGust; /*! < \brief Wind gust value */ + su2double *WindGustDer; /*! < \brief Wind gust derivatives value */ + + /*--- Primitive variable definition ---*/ + + su2double *Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ + su2double **Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ + su2double *Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ + + /*--- Secondary variable definition ---*/ + + su2double *Secondary; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ + su2double **Gradient_Secondary; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ + su2double *Limiter_Secondary; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ + + /*--- New solution container for Classical RK4 ---*/ + + su2double *Solution_New; + + /*--- Old solution container for BGS iterations ---*/ + su2double* Solution_BGS_k; + +public: + + /*! + * \brief Constructor of the class. + */ + CEulerVariable(void); + + /*! + * \overload + * \param[in] val_density - Value of the flow density (initialization value). + * \param[in] val_velocity - Value of the flow velocity (initialization value). + * \param[in] val_energy - Value of the flow energy (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CEulerVariable(su2double val_density, su2double *val_velocity, su2double val_energy, unsigned short val_nDim, + unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_solution - Pointer to the flow value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CEulerVariable(void); + + /*! + * \brief Get the new solution of the problem (Classical RK4). + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_New(unsigned short val_var) {return Solution_New[val_var]; } + + /*! + * \brief Set the new solution container for Classical RK4. + */ + inline void SetSolution_New(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_New[iVar] = Solution[iVar]; + } + + /*! + * \brief Add a value to the new solution container for Classical RK4. + * \param[in] val_var - Number of the variable. + * \param[in] val_solution - Value that we want to add to the solution. + */ + inline void AddSolution_New(unsigned short val_var, su2double val_solution) {Solution_New[val_var] += val_solution;} + + /*! + * \brief Set to zero the gradient of the primitive variables. + */ + void SetGradient_PrimitiveZero(unsigned short val_primvar); + + /*! + * \brief Add val_value to the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to add to the gradient of the primitive variables. + */ + inline void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] += val_value; } + + /*! + * \brief Subtract val_value to the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to subtract to the gradient of the primitive variables. + */ + inline void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] -= val_value; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the primitive variables gradient. + */ + inline su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) {return Gradient_Primitive[val_var][val_dim]; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] val_var - Index of the variable. + * \return Value of the primitive variables gradient. + */ + inline su2double GetLimiter_Primitive(unsigned short val_var) {return Limiter_Primitive[val_var]; } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient. + */ + inline void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] = val_value; } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_value - Value of the gradient. + */ + inline void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {Limiter_Primitive[val_var] = val_value; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double **GetGradient_Primitive(void) {return Gradient_Primitive; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double *GetLimiter_Primitive(void) {return Limiter_Primitive; } + + /*! + * \brief Set to zero the gradient of the primitive variables. + */ + void SetGradient_SecondaryZero(unsigned short val_secondaryvar); + + /*! + * \brief Add val_value to the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to add to the gradient of the primitive variables. + */ + inline void AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Secondary[val_var][val_dim] += val_value; } + + /*! + * \brief Subtract val_value to the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to subtract to the gradient of the primitive variables. + */ + inline void SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Secondary[val_var][val_dim] -= val_value; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the primitive variables gradient. + */ + inline su2double GetGradient_Secondary(unsigned short val_var, unsigned short val_dim) {return Gradient_Secondary[val_var][val_dim]; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the primitive variables gradient. + */ + inline su2double GetLimiter_Secondary(unsigned short val_var) {return Limiter_Secondary[val_var]; } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient. + */ + inline void SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Secondary[val_var][val_dim] = val_value; } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient. + */ + inline void SetLimiter_Secondary(unsigned short val_var, su2double val_value) {Limiter_Secondary[val_var] = val_value; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double **GetGradient_Secondary(void) {return Gradient_Secondary; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double *GetLimiter_Secondary(void) {return Limiter_Secondary; } + + /*! + * \brief A virtual member. + */ + inline void SetdPdrho_e(su2double dPdrho_e) {Secondary[0] = dPdrho_e;} + + /*! + * \brief A virtual member. + */ + inline void SetdPde_rho(su2double dPde_rho) {Secondary[1] = dPde_rho;} + + /*! + * \brief Set the value of the pressure. + */ + inline bool SetPressure(su2double pressure) { + Primitive[nDim+1] = pressure; + if (Primitive[nDim+1] > 0.0) return false; + else return true; + } + + /*! + * \brief Set the value of the speed of the sound. + * \param[in] soundspeed2 - Value of soundspeed^2. + */ + bool SetSoundSpeed(su2double soundspeed2) { + su2double radical = soundspeed2; + if (radical < 0.0) return true; + else { + Primitive[nDim+4] = sqrt(radical); + return false; + } + } + + /*! + * \brief Set the value of the enthalpy. + */ + inline void SetEnthalpy(void) {Primitive[nDim+3] = (Solution[nVar-1] + Primitive[nDim+1]) / Solution[0]; } + + /*! + * \brief Set all the primitive variables for compressible flows. + */ + bool SetPrimVar(CFluidModel *FluidModel); + + /*! + * \brief A virtual member. + */ + void SetSecondaryVar(CFluidModel *FluidModel); + + /*! + * \brief Get the primitive variables. + * \param[in] val_var - Index of the variable. + * \return Value of the primitive variable for the index val_var. + */ + inline su2double GetPrimitive(unsigned short val_var) {return Primitive[val_var]; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_var - Index of the variable. + * \return Set the value of the primitive variable for the index val_var. + */ + inline void SetPrimitive(unsigned short val_var, su2double val_prim) {Primitive[val_var] = val_prim; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] val_prim - Primitive variables. + * \return Set the value of the primitive variable for the index val_var. + */ + inline void SetPrimitive(su2double *val_prim) { + for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) + Primitive[iVar] = val_prim[iVar]; + } + + /*! + * \brief Get the primitive variables of the problem. + * \return Pointer to the primitive variable vector. + */ + inline su2double *GetPrimitive(void) {return Primitive; } + + /*! + * \brief Get the primitive variables. + * \param[in] val_var - Index of the variable. + * \return Value of the primitive variable for the index val_var. + */ + inline su2double GetSecondary(unsigned short val_var) {return Secondary[val_var]; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_var - Index of the variable. + * \return Set the value of the primitive variable for the index val_var. + */ + inline void SetSecondary(unsigned short val_var, su2double val_secondary) {Secondary[val_var] = val_secondary; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] val_prim - Primitive variables. + * \return Set the value of the primitive variable for the index val_var. + */ + inline void SetSecondary(su2double *val_secondary) { + for (unsigned short iVar = 0; iVar < nSecondaryVar; iVar++) + Secondary[iVar] = val_secondary[iVar]; + } + + /*! + * \brief Get the primitive variables of the problem. + * \return Pointer to the primitive variable vector. + */ + inline su2double *GetSecondary(void) {return Secondary; } + + /*! + * \brief Set the value of the density for the incompressible flows. + */ + inline bool SetDensity(void) { + Primitive[nDim+2] = Solution[0]; + if (Primitive[nDim+2] > 0.0) return false; + else return true; + } + + /*! + * \brief Set the value of the temperature. + * \param[in] temperature - how agitated the particles are :) + */ + inline bool SetTemperature(su2double temperature) { + Primitive[0] = temperature; + if (Primitive[0] > 0.0) return false; + else return true; + } + + /*! + * \brief Get the norm 2 of the velocity. + * \return Norm 2 of the velocity vector. + */ + inline su2double GetVelocity2(void) {return Velocity2; } + + /*! + * \brief Get the flow pressure. + * \return Value of the flow pressure. + */ + inline su2double GetPressure(void) {return Primitive[nDim+1]; } + + /*! + * \brief Get the speed of the sound. + * \return Value of speed of the sound. + */ + inline su2double GetSoundSpeed(void) {return Primitive[nDim+4]; } + + /*! + * \brief Get the enthalpy of the flow. + * \return Value of the enthalpy of the flow. + */ + inline su2double GetEnthalpy(void) {return Primitive[nDim+3]; } + + /*! + * \brief Get the density of the flow. + * \return Value of the density of the flow. + */ + inline su2double GetDensity(void) {return Solution[0]; } + + /*! + * \brief Get the energy of the flow. + * \return Value of the energy of the flow. + */ + inline su2double GetEnergy(void) {return Solution[nVar-1]/Solution[0]; }; + + /*! + * \brief Get the temperature of the flow. + * \return Value of the temperature of the flow. + */ + inline su2double GetTemperature(void) {return Primitive[0]; } + + /*! + * \brief Get the velocity of the flow. + * \param[in] val_dim - Index of the dimension. + * \return Value of the velocity for the dimension val_dim. + */ + inline su2double GetVelocity(unsigned short val_dim) {return Primitive[val_dim+1]; } + + /*! + * \brief Get the projected velocity in a unitary vector direction (compressible solver). + * \param[in] val_vector - Direction of projection. + * \return Value of the projected velocity. + */ + su2double GetProjVel(su2double *val_vector); + + /*! + * \brief Set the velocity vector from the solution. + * \param[in] val_velocity - Pointer to the velocity. + */ + inline void SetVelocity(void) { + Velocity2 = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Primitive[iDim+1] = Solution[iDim+1] / Solution[0]; + Velocity2 += Primitive[iDim+1]*Primitive[iDim+1]; + } + } + + /*! + * \brief Set the velocity vector from the old solution. + * \param[in] val_velocity - Pointer to the velocity. + */ + inline void SetVelocity_Old(su2double *val_velocity) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution_Old[iDim+1] = val_velocity[iDim]*Solution[0]; + } + + /*! + * \brief Set the harmonic balance source term. + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the harmonic balance source term. for the index val_var. + */ + inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } + + /*! + * \brief Get the harmonic balance source term. + * \param[in] val_var - Index of the variable. + * \return Value of the harmonic balance source term for the index val_var. + */ + inline su2double GetHarmonicBalance_Source(unsigned short val_var) {return HB_Source[val_var]; } + + /*! + * \brief Get the value of the preconditioner Beta. + * \return Value of the low Mach preconditioner variable Beta + */ + inline su2double GetPreconditioner_Beta() {return Precond_Beta; } + + /*! + * \brief Set the value of the preconditioner Beta. + * \param[in] Value of the low Mach preconditioner variable Beta + */ + inline void SetPreconditioner_Beta(su2double val_Beta) {Precond_Beta = val_Beta; } + + /*! + * \brief Get the value of the wind gust + * \return Value of the wind gust + */ + inline su2double* GetWindGust() {return WindGust;} + + /*! + * \brief Set the value of the wind gust + * \param[in] Value of the wind gust + */ + inline void SetWindGust(su2double* val_WindGust) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + WindGust[iDim] = val_WindGust[iDim]; + } + + /*! + * \brief Get the value of the derivatives of the wind gust + * \return Value of the derivatives of the wind gust + */ + inline su2double* GetWindGustDer() {return WindGustDer;} + + /*! + * \brief Set the value of the derivatives of the wind gust + * \param[in] Value of the derivatives of the wind gust + */ + inline void SetWindGustDer(su2double* val_WindGustDer) { + for (unsigned short iDim = 0; iDim < nDim+1; iDim++) + WindGustDer[iDim] = val_WindGustDer[iDim]; + } + + /*! + * \brief Set the value of the solution in the previous BGS subiteration. + */ + inline void Set_BGSSolution_k(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_BGS_k[iVar] = Solution[iVar]; + } + + /*! + * \brief Get the value of the solution in the previous BGS subiteration. + * \param[out] val_solution - solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution_k(unsigned short iDim) {return Solution_BGS_k[iDim];} +}; diff --git a/SU2_CFD/include/variables/CFEABoundVariable.hpp b/SU2_CFD/include/variables/CFEABoundVariable.hpp new file mode 100644 index 000000000000..43364187970d --- /dev/null +++ b/SU2_CFD/include/variables/CFEABoundVariable.hpp @@ -0,0 +1,158 @@ +/*! + * \file CFEABoundVariable.hpp + * \brief Class for defining the variables on the FEA boundaries for FSI applications. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CFEAVariable.hpp" + +/*! + * \class CFEABoundVariable + * \brief Class for defining the variables on the FEA boundaries for FSI applications. + * \ingroup Structural Finite Element Analysis Variables + * \author R. Sanchez. + * \version 6.2.0 "Falcon" + */ +class CFEABoundVariable : public CFEAVariable { +protected: + + su2double *FlowTraction; /*!< \brief Traction from the fluid field. */ + su2double *FlowTraction_n; /*!< \brief Traction from the fluid field at time n. */ + + su2double *Residual_Ext_Surf; /*!< \brief Term of the residual due to external forces */ + su2double *Residual_Ext_Surf_n; /*!< \brief Term of the residual due to external forces at time n */ + +public: + + /*! + * \brief Constructor of the class. + */ + CFEABoundVariable(void); + + /*! + * \overload + * \param[in] val_fea - Values of the fea solution (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CFEABoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CFEABoundVariable(void); + + /*! + * \brief Add surface load to the residual term + */ + inline void Add_SurfaceLoad_Res(su2double *val_surfForce) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf[iVar] += val_surfForce[iVar]; + } + + /*! + * \brief Set surface load of the residual term (for dampers - deletes all the other loads) + */ + inline void Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce) {Residual_Ext_Surf[iVar] = val_surfForce;} + + /*! + * \brief Get the residual term due to surface load + */ + inline su2double Get_SurfaceLoad_Res(unsigned short iVar) {return Residual_Ext_Surf[iVar];} + + /*! + * \brief Clear the surface load residual + */ + inline void Clear_SurfaceLoad_Res(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf[iVar] = 0.0; + } + + /*! + * \brief Store the surface load as the load for the previous time step. + */ + inline void Set_SurfaceLoad_Res_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf_n[iVar] = Residual_Ext_Surf[iVar]; + } + + /*! + * \brief Get the surface load from the previous time step. + */ + inline su2double Get_SurfaceLoad_Res_n(unsigned short iVar) {return Residual_Ext_Surf_n[iVar]; } + + /*! + * \brief Set the flow traction at a node on the structural side + */ + inline void Set_FlowTraction(su2double *val_flowTraction) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction[iVar] = val_flowTraction[iVar]; + } + + /*! + * \brief Add a value to the flow traction at a node on the structural side + */ + inline void Add_FlowTraction(su2double *val_flowTraction) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction[iVar] += val_flowTraction[iVar]; + } + + /*! + * \brief Get the residual term due to the flow traction + */ + inline su2double Get_FlowTraction(unsigned short iVar) {return FlowTraction[iVar]; } + + /*! + * \brief Set the value of the flow traction at the previous time step. + */ + void Set_FlowTraction_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction_n[iVar] = FlowTraction[iVar]; + } + + /*! + * \brief Retrieve the value of the flow traction from the previous time step. + */ + inline su2double Get_FlowTraction_n(unsigned short iVar) {return FlowTraction_n[iVar]; } + + /*! + * \brief Clear the flow traction residual + */ + inline void Clear_FlowTraction(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) FlowTraction[iVar] = 0.0; + } + + /*! + * \brief Get whether this node is on the boundary + */ + inline bool Get_isVertex(void) {return true; } + +}; diff --git a/SU2_CFD/include/variables/CFEAVariable.hpp b/SU2_CFD/include/variables/CFEAVariable.hpp new file mode 100644 index 000000000000..88be789dce66 --- /dev/null +++ b/SU2_CFD/include/variables/CFEAVariable.hpp @@ -0,0 +1,533 @@ +/*! + * \file CFEAVariable.hpp + * \brief Class for defining the variables of the FEM structural problem. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CFEAVariable + * \brief Class for defining the variables of the FEM structural problem. + * \ingroup Structural Finite Element Analysis Variables + * \author F. Palacios, R. Sanchez. + * \version 6.2.0 "Falcon" + */ +class CFEAVariable : public CVariable { +protected: + + su2double *Stress; /*!< \brief Stress tensor. */ + + su2double *Residual_Ext_Body; /*!< \brief Term of the residual due to body forces */ + + su2double VonMises_Stress; /*!< \brief Von Mises stress. */ + + su2double *Solution_Vel, /*!< \brief Velocity of the nodes. */ + *Solution_Vel_time_n; /*!< \brief Velocity of the nodes at time n. */ + + su2double *Solution_Accel, /*!< \brief Acceleration of the nodes. */ + *Solution_Accel_time_n; /*!< \brief Acceleration of the nodes at time n. */ + + su2double *Solution_Pred, /*!< \brief Predictor of the solution for FSI purposes */ + *Solution_Pred_Old; /*!< \brief Predictor of the solution at time n for FSI purposes */ + + su2double *Reference_Geometry; /*!< \brief Reference solution for optimization problems */ + + su2double *Prestretch; /*!< \brief Prestretch geometry */ + + su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ + + +public: + + /*! + * \brief Constructor of the class. + */ + CFEAVariable(void); + + /*! + * \overload + * \param[in] val_fea - Values of the fea solution (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CFEAVariable(void); + + /*! + * \brief Get the value of the stress. + * \return Value of the stress. + */ + inline su2double *GetStress_FEM(void) {return Stress; } + + /*! + * \brief Set the value of the stress at the node + * \param[in] iVar - index of the stress term + * \param[in] val_stress - value of the stress + */ + inline void SetStress_FEM(unsigned short iVar, su2double val_stress) {Stress[iVar] = val_stress; } + + /*! + * \brief Add a certain value to the value of the stress at the node + * \param[in] iVar - index of the stress term + * \param[in] val_stress - value of the stress + */ + inline void AddStress_FEM(unsigned short iVar, su2double val_stress) {Stress[iVar] += val_stress; } + + /*! + * \brief Add body forces to the residual term. + */ + inline void Add_BodyForces_Res(su2double *val_bodyForce) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Residual_Ext_Body[iVar] += val_bodyForce[iVar]; + } + + /*! + * \brief Clear the surface load residual + */ + inline void Clear_BodyForces_Res(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Body[iVar] = 0.0; + } + + /*! + * \brief Get the body forces. + */ + inline su2double Get_BodyForces_Res(unsigned short iVar) {return Residual_Ext_Body[iVar];} + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = Solution[iVar]; + } + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_time_n(su2double *val_solution_time_n) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = val_solution_time_n[iVar]; + } + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_time_n(unsigned short val_var, su2double val_solution) { + Solution_time_n[val_var] = val_solution; + } + + /*! + * \brief Set the value of the velocity (Structural Analysis). + * \param[in] val_solution - Solution of the problem (velocity). + */ + void SetSolution_Vel(su2double *val_solution_vel) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel[iVar] = val_solution_vel[iVar]; + } + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the solution for the index val_var. + */ + inline void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) {Solution_Vel[val_var] = val_solution_vel; } + + /*! + * \brief Set the value of the velocity (Structural Analysis) at time n. + * \param[in] val_solution - Solution of the problem (acceleration). + */ + void SetSolution_Vel_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = Solution_Vel[iVar]; + } + + /*! + * \brief Set the value of the velocity (Structural Analysis) at time n. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = val_solution_vel_time_n[iVar]; + } + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution_old - Value of the old solution for the index val_var. + */ + inline void SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n) {Solution_Vel_time_n[val_var] = val_solution_vel_time_n; } + + /*! + * \brief Get the velocity (Structural Analysis). + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetSolution_Vel(unsigned short val_var) {return Solution_Vel[val_var]; } + + /*! + * \brief Get the solution of the problem. + * \return Pointer to the solution vector. + */ + inline su2double *GetSolution_Vel(void) {return Solution_Vel; } + + /*! + * \brief Get the velocity of the nodes (Structural Analysis) at time n. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Vel_time_n(unsigned short val_var) {return Solution_Vel_time_n[val_var]; } + + /*! + * \brief Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline su2double *GetSolution_Vel_time_n(void) {return Solution_Vel_time_n; } + + /*! + * \brief Set the value of the acceleration (Structural Analysis). + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline void SetSolution_Accel(su2double *val_solution_accel) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel[iVar] = val_solution_accel[iVar]; + } + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the solution for the index val_var. + */ + inline void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) {Solution_Accel[val_var] = val_solution_accel;} + + /*! + * \brief Set the value of the acceleration (Structural Analysis) at time n. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = val_solution_accel_time_n[iVar]; + } + + /*! + * \brief Set the value of the acceleration (Structural Analysis) at time n. + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline void SetSolution_Accel_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = Solution_Accel[iVar]; + } + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution_old - Value of the old solution for the index val_var. + */ + inline void SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n) {Solution_Accel_time_n[val_var] = val_solution_accel_time_n; } + + /*! + * \brief Get the acceleration (Structural Analysis). + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetSolution_Accel(unsigned short val_var) {return Solution_Accel[val_var]; } + + /*! + * \brief Get the solution of the problem. + * \return Pointer to the solution vector. + */ + inline su2double *GetSolution_Accel(void) {return Solution_Accel; } + + /*! + * \brief Get the acceleration of the nodes (Structural Analysis) at time n. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Accel_time_n(unsigned short val_var) {return Solution_Accel_time_n[val_var]; } + + /*! + * \brief Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline su2double *GetSolution_Accel_time_n(void) {return Solution_Accel_time_n; } + + /*! + * \brief Set the value of the solution predictor. + */ + inline void SetSolution_Pred(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Pred[iVar] = Solution[iVar]; + } + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_Pred(su2double *val_solution_pred) {Solution_Pred = val_solution_pred; } + + /*! + * \brief Set the value of the predicted solution. + * \param[in] val_var - Index of the variable + * \param[in] val_solution_pred - Value of the predicted solution. + */ + inline void SetSolution_Pred(unsigned short val_var, su2double val_solution_pred) {Solution_Pred[val_var] = val_solution_pred; } + + /*! + * \brief Get the value of the solution predictor. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Pred(unsigned short val_var) {return Solution_Pred[val_var]; } + + /*! + * \brief Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline su2double *GetSolution_Pred(void) {return Solution_Pred; } + + /*! + * \brief Set the value of the solution predictor. + */ + inline void SetSolution_Pred_Old(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Pred_Old[iVar] = Solution_Pred[iVar]; + } + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline void SetSolution_Pred_Old(su2double *val_solution_pred_Old) {Solution_Pred_Old = val_solution_pred_Old; } + + /*! + * \brief A virtual member. Set the value of the old solution predicted. + * \param[in] val_var - Index of the variable + * \param[in] val_solution_pred_old - Value of the old predicted solution. + */ + inline void SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old) {Solution_Pred_Old[val_var] = val_solution_pred_old; } + + /*! + * \brief Get the value of the solution predictor. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Pred_Old(unsigned short val_var) {return Solution_Pred_Old[val_var]; } + + /*! + * \brief Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline su2double *GetSolution_Pred_Old(void) {return Solution_Pred_Old; } + + /*! + * \brief A virtual member. + */ + inline void SetPrestretch(unsigned short iVar, su2double val_prestretch) {Prestretch[iVar] = val_prestretch;} + + /*! + * \brief A virtual member. + */ + inline su2double *GetPrestretch(void) {return Prestretch; } + + /*! + * \brief A virtual member. + */ + inline su2double GetPrestretch(unsigned short iVar) {return Prestretch[iVar]; } + + /*! + * \brief Set the value of the Von Mises stress. + * \param[in] val_stress - Value of the Von Mises stress. + */ + inline void SetVonMises_Stress(su2double val_stress) {VonMises_Stress = val_stress; } + + /*! + * \brief Get the value of the Von Mises stress. + * \return Value of the Von Mises stress. + */ + inline su2double GetVonMises_Stress(void) {return VonMises_Stress; } + + /*! + * \brief Set the reference geometry. + * \return Pointer to the solution (at time n) vector. + */ + inline void SetReference_Geometry(unsigned short iVar, su2double ref_geometry) {Reference_Geometry[iVar] = ref_geometry;} + + /*! + * \brief Get the pointer to the reference geometry + */ + inline su2double *GetReference_Geometry(void) {return Reference_Geometry; } + + /*! + * \brief Get the value of the reference geometry for the coordinate iVar + */ + inline su2double GetReference_Geometry(unsigned short iVar) {return Reference_Geometry[iVar]; } + + /*! + * \brief Register the variables in the solution time_n array as input/output variable. + * \param[in] input - input or output variables. + */ + inline void Register_femSolution_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_time_n[iVar]); + } + + /*! + * \brief Register the variables in the velocity array as input/output variable. + * \param[in] input - input or output variables. + */ + inline void RegisterSolution_Vel(bool input) { + if (input) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Vel[iVar]); + } + else { for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterOutput(Solution_Vel[iVar]);} + } + + /*! + * \brief Register the variables in the velocity time_n array as input/output variable. + */ + inline void RegisterSolution_Vel_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Vel_time_n[iVar]); + } + + /*! + * \brief Register the variables in the acceleration array as input/output variable. + * \param[in] input - input or output variables. + */ + inline void RegisterSolution_Accel(bool input) { + if (input) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Accel[iVar]); + } + else { for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterOutput(Solution_Accel[iVar]);} + } + + /*! + * \brief Register the variables in the acceleration time_n array as input/output variable. + */ + inline void RegisterSolution_Accel_time_n(void){ + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Accel_time_n[iVar]); + } + + /*! + * \brief Set the velocity adjoint values of the solution. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void SetAdjointSolution_Vel(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Vel[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); + } + + /*! + * \brief Get the velocity adjoint values of the solution. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void GetAdjointSolution_Vel(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel[iVar]); + } + + /*! + * \brief Set the velocity adjoint values of the solution at time n. + * \param[in] adj_sol - The adjoint values of the solution. + */ + void SetAdjointSolution_Vel_time_n(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Vel_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); + } + + /*! + * \brief Get the velocity adjoint values of the solution at time n. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void GetAdjointSolution_Vel_time_n(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel_time_n[iVar]); + } + + /*! + * \brief Set the acceleration adjoint values of the solution. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void SetAdjointSolution_Accel(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Accel[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); + } + + /*! + * \brief Get the acceleration adjoint values of the solution. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void GetAdjointSolution_Accel(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel[iVar]); + } + + /*! + * \brief Set the acceleration adjoint values of the solution at time n. + * \param[in] adj_sol - The adjoint values of the solution. + */ + void SetAdjointSolution_Accel_time_n(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Accel_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); + } + + /*! + * \brief Get the acceleration adjoint values of the solution at time n. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void GetAdjointSolution_Accel_time_n(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel_time_n[iVar]); + } + + /*! + * \brief Set the value of the solution in the previous BGS subiteration. + */ + inline void Set_BGSSolution_k(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_BGS_k[iVar] = Solution[iVar]; + } + + /*! + * \brief Get the value of the solution in the previous BGS subiteration. + * \param[out] val_solution - solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution_k(unsigned short iDim) {return Solution_BGS_k[iDim];} + +}; diff --git a/SU2_CFD/include/variables/CHeatFVMVariable.hpp b/SU2_CFD/include/variables/CHeatFVMVariable.hpp new file mode 100644 index 000000000000..cd25361614b0 --- /dev/null +++ b/SU2_CFD/include/variables/CHeatFVMVariable.hpp @@ -0,0 +1,74 @@ +/*! + * \file CHeatFVMVariable.hpp + * \brief Class for defining the variables of the finite-volume heat equation solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CHeatFVMVariable + * \brief Class for defining the variables of the finite-volume heat equation solver. + * \author O. Burghardt + * \version 6.2.0 "Falcon" + */ +class CHeatFVMVariable : public CVariable { +protected: + su2double *Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */ + su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ + +public: + + /*! + * \brief Constructor of the class. + */ + CHeatFVMVariable(void); + + /*! + * \overload + * \param[in] val_Heat - Values of the Heat solution (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CHeatFVMVariable(void); + +}; diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp new file mode 100644 index 000000000000..6721709b44f1 --- /dev/null +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -0,0 +1,332 @@ +/*! + * \file CIncEulerVariable.hpp + * \brief Class for defining the variables of the incompressible Euler solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CIncEulerVariable + * \brief Class for defining the variables of the incompressible Euler solver. + * \ingroup Euler_Equations + * \author F. Palacios, T. Economon, T. Albring + */ +class CIncEulerVariable : public CVariable { +protected: + su2double Velocity2; /*!< \brief Square of the velocity vector. */ + + /*--- Primitive variable definition ---*/ + + su2double *Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ + su2double **Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ + su2double *Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ + + /*--- Old solution container for BGS iterations ---*/ + + su2double* Solution_BGS_k; + + /*--- Old density for variable density turbulent flows (SST). ---*/ + + su2double Density_Old; + +public: + + /*! + * \brief Constructor of the class. + */ + CIncEulerVariable(void); + + /*! + * \overload + * \param[in] val_pressure - value of the pressure. + * \param[in] val_velocity - Value of the flow velocity (initialization value). + * \param[in] val_temperature - Value of the temperature (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CIncEulerVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, unsigned short val_nDim, + unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_solution - Pointer to the flow value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CIncEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CIncEulerVariable(void); + + /*! + * \brief Set to zero the gradient of the primitive variables. + */ + void SetGradient_PrimitiveZero(unsigned short val_primvar); + + /*! + * \brief Add val_value to the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to add to the gradient of the primitive variables. + */ + inline void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] += val_value; } + + /*! + * \brief Subtract val_value to the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to subtract to the gradient of the primitive variables. + */ + inline void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] -= val_value; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the primitive variables gradient. + */ + inline su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) {return Gradient_Primitive[val_var][val_dim]; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] val_var - Index of the variable. + * \return Value of the primitive variables gradient. + */ + inline su2double GetLimiter_Primitive(unsigned short val_var) {return Limiter_Primitive[val_var]; } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient. + */ + inline void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] = val_value; } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_value - Value of the gradient. + */ + inline void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {Limiter_Primitive[val_var] = val_value; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double **GetGradient_Primitive(void) {return Gradient_Primitive; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double *GetLimiter_Primitive(void) {return Limiter_Primitive; } + + /*! + * \brief Set the value of the pressure. + */ + inline void SetPressure(void) {Primitive[0] = Solution[0];} + + /*! + * \brief Get the primitive variables. + * \param[in] val_var - Index of the variable. + * \return Value of the primitive variable for the index val_var. + */ + inline su2double GetPrimitive(unsigned short val_var) {return Primitive[val_var]; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] val_var - Index of the variable. + * \param[in] val_var - Index of the variable. + * \return Set the value of the primitive variable for the index val_var. + */ + inline void SetPrimitive(unsigned short val_var, su2double val_prim) {Primitive[val_var] = val_prim; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] val_prim - Primitive variables. + * \return Set the value of the primitive variable for the index val_var. + */ + inline void SetPrimitive(su2double *val_prim) { + for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) + Primitive[iVar] = val_prim[iVar]; + } + + /*! + * \brief Get the primitive variables of the problem. + * \return Pointer to the primitive variable vector. + */ + inline su2double *GetPrimitive(void) {return Primitive; } + + /*! + * \brief Set the value of the density for the incompressible flows. + */ + inline bool SetDensity(su2double val_density) { + Primitive[nDim+2] = val_density; + if (Primitive[nDim+2] > 0.0) return false; + else return true; + } + + /*! + * \brief Set the value of the density for the incompressible flows. + */ + inline void SetVelocity(void) { + Velocity2 = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Primitive[iDim+1] = Solution[iDim+1]; + Velocity2 += Primitive[iDim+1]*Primitive[iDim+1]; + } + } + + /*! + * \brief Set the value of the temperature for incompressible flows with energy equation. + */ + inline bool SetTemperature(su2double val_temperature) { + Primitive[nDim+1] = val_temperature; + if (Primitive[nDim+1] > 0.0) return false; + else return true; + } + + /*! + * \brief Set the value of the beta coeffient for incompressible flows. + */ + inline void SetBetaInc2(su2double val_betainc2) {Primitive[nDim+3] = val_betainc2; } + + /*! + * \brief Get the norm 2 of the velocity. + * \return Norm 2 of the velocity vector. + */ + inline su2double GetVelocity2(void) {return Velocity2; } + + /*! + * \brief Get the flow pressure. + * \return Value of the flow pressure. + */ + inline su2double GetPressure(void) {return Primitive[0]; } + + /*! + * \brief Get the value of beta squared for the incompressible flow + * \return Value of beta squared. + */ + inline su2double GetBetaInc2(void) {return Primitive[nDim+3]; } + + /*! + * \brief Get the density of the flow. + * \return Value of the density of the flow. + */ + inline su2double GetDensity(void) {return Primitive[nDim+2]; } + + /*! + * \brief Get the density of the flow from the previous iteration. + * \return Old value of the density of the flow. + */ + inline su2double GetDensity_Old(void) {return Density_Old; } + + /*! + * \brief Get the temperature of the flow. + * \return Value of the temperature of the flow. + */ + inline su2double GetTemperature(void) {return Primitive[nDim+1]; } + + /*! + * \brief Get the velocity of the flow. + * \param[in] val_dim - Index of the dimension. + * \return Value of the velocity for the dimension val_dim. + */ + inline su2double GetVelocity(unsigned short val_dim) {return Primitive[val_dim+1]; } + + /*! + * \brief Get the projected velocity in a unitary vector direction (compressible solver). + * \param[in] val_vector - Direction of projection. + * \return Value of the projected velocity. + */ + su2double GetProjVel(su2double *val_vector); + + /*! + * \brief Set the velocity vector from the old solution. + * \param[in] val_velocity - Pointer to the velocity. + */ + inline void SetVelocity_Old(su2double *val_velocity) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution_Old[iDim+1] = val_velocity[iDim]; + } + + /*! + * \brief Set all the primitive variables for incompressible flows. + */ + bool SetPrimVar(CFluidModel *FluidModel); + + /*! + * \brief Set the specific heat Cp. + */ + inline void SetSpecificHeatCp(su2double val_Cp) {Primitive[nDim+7] = val_Cp;} + + /*! + * \brief Set the specific heat Cv. + */ + inline void SetSpecificHeatCv(su2double val_Cv) {Primitive[nDim+8] = val_Cv;} + + /*! + * \brief Get the specific heat at constant P of the flow. + * \return Value of the specific heat at constant P of the flow. + */ + inline su2double GetSpecificHeatCp(void) {return Primitive[nDim+7]; } + + /*! + * \brief Get the specific heat at constant V of the flow. + * \return Value of the specific heat at constant V of the flow. + */ + inline su2double GetSpecificHeatCv(void) {return Primitive[nDim+8]; } + + /*! + * \brief Set the value of the solution in the previous BGS subiteration. + */ + inline void Set_BGSSolution_k(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_BGS_k[iVar] = Solution[iVar]; + } + + /*! + * \brief Get the value of the solution in the previous BGS subiteration. + * \param[out] val_solution - solution in the previous BGS subiteration. + */ + inline su2double Get_BGSSolution_k(unsigned short iDim) {return Solution_BGS_k[iDim];} + +}; diff --git a/SU2_CFD/include/variables/CIncNSVariable.hpp b/SU2_CFD/include/variables/CIncNSVariable.hpp new file mode 100644 index 000000000000..18087f204e3b --- /dev/null +++ b/SU2_CFD/include/variables/CIncNSVariable.hpp @@ -0,0 +1,161 @@ +/*! + * \file CIncNSVariable.hpp + * \brief Class for defining the variables of the incompressible + Navier-Stokes solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CIncEulerVariable.hpp" + +/*! + * \class CIncNSVariable + * \brief Class for defining the variables of the incompressible Navier-Stokes solver. + * \ingroup Navier_Stokes_Equations + * \author F. Palacios, T. Economon, T. Albring + */ +class CIncNSVariable : public CIncEulerVariable { +private: + su2double Vorticity[3]; /*!< \brief Vorticity of the fluid. */ + su2double StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + + su2double DES_LengthScale; +public: + + /*! + * \brief Constructor of the class. + */ + CIncNSVariable(void); + + /*! + * \overload + * \param[in] val_pressure - value of the pressure. + * \param[in] val_velocity - Value of the flow velocity (initialization value). + * \param[in] val_temperature - Value of the temperature (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CIncNSVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_solution - Pointer to the flow value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CIncNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CIncNSVariable(void); + + /*! + * \brief Set the laminar viscosity. + */ + inline void SetLaminarViscosity(su2double laminarViscosity) {Primitive[nDim+4] = laminarViscosity;} + + /*! + * \brief Set the vorticity value. + */ + bool SetVorticity(void); + + /*! + * \brief Set the rate of strain magnitude. + */ + bool SetStrainMag(void); + + /*! + * \overload + * \param[in] eddy_visc - Value of the eddy viscosity. + */ + inline void SetEddyViscosity(su2double eddy_visc) {Primitive[nDim+5] = eddy_visc; } + + /*! + * \brief Get the laminar viscosity of the flow. + * \return Value of the laminar viscosity of the flow. + */ + inline su2double GetLaminarViscosity(void) {return Primitive[nDim+4]; } + + /*! + * \brief Get the eddy viscosity of the flow. + * \return The eddy viscosity of the flow. + */ + inline su2double GetEddyViscosity(void) {return Primitive[nDim+5]; } + + /*! + * \brief Set the thermal conductivity. + */ + inline void SetThermalConductivity(su2double thermalConductivity) {Primitive[nDim+6] = thermalConductivity;} + + /*! + * \brief Get the thermal conductivity of the flow. + * \return Value of the laminar viscosity of the flow. + */ + inline su2double GetThermalConductivity(void) {return Primitive[nDim+6]; } + + /*! + * \brief Get the value of the vorticity. + * \param[in] val_dim - Index of the dimension. + * \return Value of the vorticity. + */ + inline su2double *GetVorticity(void) {return Vorticity; } + + /*! + * \brief Get the value of the magnitude of rate of strain. + * \return Value of the rate of strain magnitude. + */ + inline su2double GetStrainMag(void) {return StrainMag; } + + /*! + * \brief Set all the primitive variables for incompressible flows + */ + bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); + using CVariable::SetPrimVar; + + /*! + * \brief Set the DES Length Scale. + */ + inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } + + /*! + * \brief Get the DES length scale + * \return Value of the DES length Scale. + */ + inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } + +}; diff --git a/SU2_CFD/include/variables/CNSVariable.hpp b/SU2_CFD/include/variables/CNSVariable.hpp new file mode 100644 index 000000000000..a982dff2cd9a --- /dev/null +++ b/SU2_CFD/include/variables/CNSVariable.hpp @@ -0,0 +1,256 @@ +/*! + * \file CNSVariable.hpp + * \brief Class for defining the variables of the compressible Navier-Stokes solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CEulerVariable.hpp" + +/*! + * \class CNSVariable + * \brief Class for defining the variables of the compressible Navier-Stokes solver. + * \ingroup Navier_Stokes_Equations + * \author F. Palacios, T. Economon + */ +class CNSVariable : public CEulerVariable { +private: + su2double Prandtl_Lam; /*!< \brief Laminar Prandtl number. */ + su2double Prandtl_Turb; /*!< \brief Turbulent Prandtl number. */ + su2double Temperature_Ref; /*!< \brief Reference temperature of the fluid. */ + su2double Viscosity_Ref; /*!< \brief Reference viscosity of the fluid. */ + su2double Viscosity_Inf; /*!< \brief Viscosity of the fluid at the infinity. */ + su2double Vorticity[3]; /*!< \brief Vorticity of the fluid. */ + su2double StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + su2double Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ + su2double DES_LengthScale; /*!< \brief DES Length Scale. */ + su2double inv_TimeScale; /*!< \brief Inverse of the reference time scale. */ + su2double Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */ + su2double Vortex_Tilting; /*!< \brief Value of the vortex tilting variable for DES length scale computation. */ + +public: + + /*! + * \brief Constructor of the class. + */ + CNSVariable(void); + + /*! + * \overload + * \param[in] val_density - Value of the flow density (initialization value). + * \param[in] val_velocity - Value of the flow velocity (initialization value). + * \param[in] val_energy - Value of the flow energy (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CNSVariable(su2double val_density, su2double *val_velocity, + su2double val_energy, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_solution - Pointer to the flow value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CNSVariable(void); + + /*! + * \brief Set the laminar viscosity. + */ + inline void SetLaminarViscosity(su2double laminarViscosity) {Primitive[nDim+5] = laminarViscosity;} + + /*! + * \brief Set the laminar viscosity. + */ + inline void SetThermalConductivity(su2double thermalConductivity) {Primitive[nDim+7] = thermalConductivity;} + + /*! + * \brief Set the specific heat Cp. + */ + inline void SetSpecificHeatCp(su2double val_Cp) {Primitive[nDim+8] = val_Cp;} + + /*! + * \brief Set the vorticity value. + */ + bool SetVorticity(void); + + /*! + * \brief Set the rate of strain magnitude. + */ + bool SetStrainMag(void); + + /*! + * \overload + * \param[in] eddy_visc - Value of the eddy viscosity. + */ + inline void SetEddyViscosity(su2double eddy_visc) {Primitive[nDim+6] = eddy_visc; } + + /*! + * \brief Get the laminar viscosity of the flow. + * \return Value of the laminar viscosity of the flow. + */ + inline su2double GetLaminarViscosity(void) {return Primitive[nDim+5]; } + + /*! + * \brief Get the thermal conductivity of the flow. + * \return Value of the laminar viscosity of the flow. + */ + inline su2double GetThermalConductivity(void) {return Primitive[nDim+7]; } + + /*! + * \brief Get the eddy viscosity of the flow. + * \return The eddy viscosity of the flow. + */ + inline su2double GetEddyViscosity(void) {return Primitive[nDim+6]; } + + /*! + * \brief Get the specific heat at constant P of the flow. + * \return Value of the specific heat at constant P of the flow. + */ + inline su2double GetSpecificHeatCp(void) {return Primitive[nDim+8]; } + + /*! + * \brief Set the temperature at the wall + */ + inline void SetWallTemperature(su2double temperature_wall) { Primitive[0] = temperature_wall; } + + /*! + * \brief Get the value of the vorticity. + * \param[in] val_dim - Index of the dimension. + * \return Value of the vorticity. + */ + inline su2double *GetVorticity(void) {return Vorticity; } + + /*! + * \brief Get the value of the magnitude of rate of strain. + * \return Value of the rate of strain magnitude. + */ + inline su2double GetStrainMag(void) {return StrainMag; } + + /*! + * \brief Set the derivative of temperature with respect to density (at constant internal energy). + */ + inline void SetdTdrho_e(su2double dTdrho_e) {Secondary[2] = dTdrho_e;} + + /*! + * \brief Set the derivative of temperature with respect to internal energy (at constant density). + */ + inline void SetdTde_rho(su2double dTde_rho) {Secondary[3] = dTde_rho;} + + /*! + * \brief Set the derivative of laminar viscosity with respect to density (at constant temperature). + */ + inline void Setdmudrho_T(su2double dmudrho_T) {Secondary[4] = dmudrho_T;} + + /*! + * \brief Set the derivative of laminar viscosity with respect to temperature (at constant density). + */ + inline void SetdmudT_rho(su2double dmudT_rho) {Secondary[5] = dmudT_rho;} + + /*! + * \brief Set the derivative of thermal conductivity with respect to density (at constant temperature). + */ + inline void Setdktdrho_T(su2double dktdrho_T) {Secondary[6] = dktdrho_T;} + + /*! + * \brief Set the derivative of thermal conductivity with respect to temperature (at constant density). + */ + inline void SetdktdT_rho(su2double dktdT_rho) {Secondary[7] = dktdT_rho;} + + /*! + * \brief Set all the primitive variables for compressible flows + */ + bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); + using CVariable::SetPrimVar; + + /*! + * \brief Set all the secondary variables (partial derivatives) for compressible flows + */ + void SetSecondaryVar(CFluidModel *FluidModel); + + /*! + * \brief Set the value of the wall shear stress computed by a wall function. + */ + inline void SetTauWall(su2double val_tau_wall) {Tau_Wall = val_tau_wall; } + + /*! + * \brief Get the value of the wall shear stress computed by a wall function. + * \return Value of the wall shear stress computed by a wall function. + */ + inline su2double GetTauWall(void) {return Tau_Wall; } + + /*! + * \brief Get the DES length scale + * \return Value of the DES length Scale. + */ + inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } + + /*! + * \brief Set the DES Length Scale. + */ + inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } + + /*! + * \brief Set the new solution for Roe Dissipation. + * \param[in] val_delta - A scalar measure of the grid size + * \param[in] val_const_DES - The DES constant (C_DES) + */ + void SetRoe_Dissipation_NTS(su2double val_delta, su2double val_const_DES); + + /*! + * \brief Set the new solution for Roe Dissipation. + */ + void SetRoe_Dissipation_FD(su2double wall_distance); + + /*! + * \brief Get the Roe Dissipation Coefficient. + * \return Value of the Roe Dissipation. + */ + inline su2double GetRoe_Dissipation(void) {return Roe_Dissipation; } + + /*! + * \brief Set the Roe Dissipation Coefficient. + * \param[in] val_dissipation - Value of the Roe dissipation factor. + */ + inline void SetRoe_Dissipation(su2double val_dissipation) {Roe_Dissipation = val_dissipation; } + +}; diff --git a/SU2_CFD/include/variables/CTransLMVariable.hpp b/SU2_CFD/include/variables/CTransLMVariable.hpp new file mode 100644 index 000000000000..d9446dcfcb6b --- /dev/null +++ b/SU2_CFD/include/variables/CTransLMVariable.hpp @@ -0,0 +1,91 @@ +/*! + * \file CTransLMVariable.hpp + * \brief Declaration of the variables of the transition model. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CTurbVariable.hpp" + +/*! + * \class CTransLMVariable + * \brief Transition model variables. + * \ingroup Turbulence_Model + * \author A. Bueno. + */ + +class CTransLMVariable : public CTurbVariable { +protected: + su2double gamma_sep; + +public: + + /*! + * \brief Constructor of the class. + */ + CTransLMVariable(void); + + /*! + * \overload + * \param[in] val_nu_tilde - Turbulent variable value (initialization value). + * \param[in] val_intermittency + * \param[in] val_REth + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CTransLMVariable(su2double val_nu_tilde, su2double val_intermittency, su2double val_REth, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CTransLMVariable(void); + + /*! + * \brief ________________. + */ + inline su2double GetIntermittency(void) { return Solution[0]; } + + /*! + * \brief ________________. + * \param[in] gamma_sep_in + */ + inline void SetGammaSep(su2double gamma_sep_in) {gamma_sep = gamma_sep_in;} + + /*! + * \brief Correction for separation-induced transition. + */ + inline void SetGammaEff(void) {Solution[0] = max(Solution[0], gamma_sep);} +}; diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp new file mode 100644 index 000000000000..6c005da6a3bf --- /dev/null +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -0,0 +1,125 @@ +/*! + * \file CTurbSAVariable.hpp + * \brief Declaration of the variables of the SA turbulence model. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CTurbVariable.hpp" + +/*! + * \class CTurbSAVariable + * \brief Main class for defining the variables of the turbulence model. + * \ingroup Turbulence_Model + * \author A. Bueno. + */ + +class CTurbSAVariable : public CTurbVariable { + +private: + su2double gamma_BC; /*!< \brief Value of the intermittency for the BC trans. model. */ + su2double DES_LengthScale; + su2double Vortex_Tilting; + +public: + /*! + * \brief Constructor of the class. + */ + CTurbSAVariable(void); + + /*! + * \overload + * \param[in] val_nu_tilde - Turbulent variable value (initialization value). + * \param[in] val_muT - The eddy viscosity + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CTurbSAVariable(void); + + /*! + * \brief Set the harmonic balance source term. + * \param[in] val_var - Index of the variable. + * \param[in] val_source - Value of the harmonic balance source term. for the index val_var. + */ + inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } + + /*! + * \brief Get the harmonic balance source term. + * \param[in] val_var - Index of the variable. + * \return Value of the harmonic balance source term for the index val_var. + */ + inline su2double GetHarmonicBalance_Source(unsigned short val_var) {return HB_Source[val_var]; } + + /*! + * \brief Get the intermittency of the BC transition model. + * \return Value of the intermittency of the BC transition model. + */ + inline su2double GetGammaBC(void) {return gamma_BC; } + + /*! + * \brief Set the intermittency of the BC transition model. + * \param[in] val_gamma - New value of the intermittency. + */ + inline void SetGammaBC(su2double val_gamma) {gamma_BC = val_gamma; } + + /*! + * \brief Get the DES length scale + * \return Value of the DES length Scale. + */ + inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } + + /*! + * \brief Set the DES Length Scale. + */ + inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } + + /*! + * \brief Set the vortex tilting measure for computation of the EDDES length scale + */ + void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity); + + /*! + * \brief Get the vortex tilting measure for computation of the EDDES length scale + * \return Value of the DES length Scale + */ + inline su2double GetVortex_Tilting() {return Vortex_Tilting; } + +}; diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp new file mode 100644 index 000000000000..53479a82a001 --- /dev/null +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -0,0 +1,103 @@ +/*! + * \file CTurbSSTVariable.hpp + * \brief Declaration of the variables of the SST turbulence model. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CTurbVariable.hpp" + +/*! + * \class CTurbSSTVariable + * \brief Main class for defining the variables of the turbulence model. + * \ingroup Turbulence_Model + * \author A. Bueno. + */ + +class CTurbSSTVariable : public CTurbVariable { +protected: + su2double sigma_om2, + beta_star; + su2double F1, /*!< \brief Menter blending function for blending of k-w and k-eps. */ + F2, /*!< \brief Menter blending function for stress limiter. */ + CDkw; /*!< \brief Cross-diffusion. */ + +public: + /*! + * \brief Constructor of the class. + */ + CTurbSSTVariable(void); + + /*! + * \overload + * \param[in] val_rho_kine - Turbulent variable value (initialization value). + * \param[in] val_rho_omega - Turbulent variable value (initialization value). + * \param[in] val_muT - Turbulent variable value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] constants - + * \param[in] config - Definition of the particular problem. + */ + CTurbSSTVariable(su2double val_rho_kine, su2double val_rho_omega, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, + su2double *constants, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CTurbSSTVariable(void); + + /*! + * \brief Set the blending function for the blending of k-w and k-eps. + * \param[in] val_viscosity - Value of the vicosity. + * \param[in] val_dist - Value of the distance to the wall. + * \param[in] val_density - Value of the density. + */ + void SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density); + + /*! + * \brief Get the first blending function. + */ + inline su2double GetF1blending(void) { return F1; } + + /*! + * \brief Get the second blending function. + */ + inline su2double GetF2blending(void) { return F2; } + + /*! + * \brief Get the value of the cross diffusion of tke and omega. + */ + inline su2double GetCrossDiff(void) { return CDkw; } +}; diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp new file mode 100644 index 000000000000..1b4b9f5650c7 --- /dev/null +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -0,0 +1,84 @@ +/*! + * \file CTurbVariable.hpp + * \brief Base class for defining the variables of the turbulence model. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CTurbVariable + * \brief Base class for defining the variables of the turbulence model. + * \ingroup Turbulence_Model + * \author A. Bueno. + */ +class CTurbVariable : public CVariable { +protected: + su2double muT; /*!< \brief Eddy viscosity. */ + su2double *HB_Source; /*!< \brief Harmonic Balance source term. */ + +public: + /*! + * \brief Constructor of the class. + */ + CTurbVariable(void); + + /*! + * \overload + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CTurbVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CTurbVariable(void); + + /*! + * \brief Get the value of the eddy viscosity. + * \return the value of the eddy viscosity. + */ + inline su2double GetmuT() { return muT; } + + /*! + * \brief Set the value of the eddy viscosity. + * \param[in] val_muT - Value of the eddy viscosity. + */ + inline void SetmuT(su2double val_muT) { muT = val_muT; } +}; + diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp new file mode 100644 index 000000000000..e195e4d2c031 --- /dev/null +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -0,0 +1,2413 @@ +/*! + * \file CVariable.hpp + * \brief Declaration and inlines of the parent class for defining problem + variables, function definitions in file CVariable.cpp. + All variables are children of at least this class. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "../../../Common/include/mpi_structure.hpp" + +#include +#include +#include + +#include "../../../Common/include/config_structure.hpp" +#include "../fluid_model.hpp" + + +using namespace std; + +/*! + * \class CVariable + * \brief Main class for defining the variables. + * \author F. Palacios + */ +class CVariable { +protected: + + su2double *Solution, /*!< \brief Solution of the problem. */ + *Solution_Old; /*!< \brief Old solution of the problem R-K. */ + bool Non_Physical; /*!< \brief Non-physical points in the solution (force first order). */ + su2double *Solution_time_n, /*!< \brief Solution of the problem at time n for dual-time stepping technique. */ + *Solution_time_n1; /*!< \brief Solution of the problem at time n-1 for dual-time stepping technique. */ + su2double **Gradient; /*!< \brief Gradient of the solution of the problem. */ + su2double **Rmatrix; /*!< \brief Geometry-based matrix for weighted least squares gradient calculations. */ + su2double *Limiter; /*!< \brief Limiter of the solution of the problem. */ + su2double *Solution_Max; /*!< \brief Max solution for limiter computation. */ + su2double *Solution_Min; /*!< \brief Min solution for limiter computation. */ + su2double AuxVar; /*!< \brief Auxiliar variable for gradient computation. */ + su2double *Grad_AuxVar; /*!< \brief Gradient of the auxiliar variable. */ + su2double Delta_Time; /*!< \brief Time step. */ + su2double Max_Lambda, /*!< \brief Maximun eingenvalue. */ + Max_Lambda_Inv, /*!< \brief Maximun inviscid eingenvalue. */ + Max_Lambda_Visc, /*!< \brief Maximun viscous eingenvalue. */ + Lambda; /*!< \brief Value of the eingenvalue. */ + su2double Sensor; /*!< \brief Pressure sensor for high order central scheme and Roe dissipation. */ + su2double *Undivided_Laplacian; /*!< \brief Undivided laplacian of the solution. */ + su2double *Res_TruncError, /*!< \brief Truncation error for multigrid cycle. */ + *Residual_Old, /*!< \brief Auxiliar structure for residual smoothing. */ + *Residual_Sum; /*!< \brief Auxiliar structure for residual smoothing. */ + static unsigned short nDim; /*!< \brief Number of dimension of the problem. */ + unsigned short nVar; /*!< \brief Number of variables of the problem, + note that this variable cannnot be static, it is possible to + have different number of nVar in the same problem. */ + unsigned short nPrimVar, nPrimVarGrad; /*!< \brief Number of variables of the problem, + note that this variable cannnot be static, it is possible to + have different number of nVar in the same problem. */ + unsigned short nSecondaryVar, nSecondaryVarGrad; /*!< \brief Number of variables of the problem, + note that this variable cannnot be static, it is possible to + have different number of nVar in the same problem. */ + su2double *Solution_Adj_Old; /*!< \brief Solution of the problem in the previous AD-BGS iteration. */ + +public: + + /*! + * \brief Constructor of the class. + */ + CVariable(void); + + /*! + * \overload + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CVariable(unsigned short val_nvar, CConfig *config); + + /*! + * \overload + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CVariable(void); + + /*! + * \brief Set the value of the solution. + * \param[in] val_solution - Solution of the problem. + */ + void SetSolution(su2double *val_solution); + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the solution for the index val_var. + */ + inline void SetSolution(unsigned short val_var, su2double val_solution) {Solution[val_var] = val_solution;} + + /*! + * \brief Add the value of the solution vector to the previous solution (incremental approach). + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the solution for the index val_var. + */ + inline void Add_DeltaSolution(unsigned short val_var, su2double val_solution) {Solution[val_var] += val_solution;} + + /*! + * \brief Set the value of the non-physical point. + * \param[in] val_value - identification of the non-physical point. + */ + inline void SetNon_Physical(bool val_value) { Non_Physical = !val_value; } + + /*! + * \brief Get the value of the non-physical point. + * \return Value of the Non-physical point. + */ + inline su2double GetNon_Physical(void) { return su2double(Non_Physical); } + + /*! + * \brief Get the solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetSolution(unsigned short val_var) {return Solution[val_var]; } + + /*! + * \brief Get the old solution of the problem (Runge-Kutta method) + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Old(unsigned short val_var) {return Solution_Old[val_var]; } + + /*! + * \brief Get the old solution of the discrete adjoint problem (for multiphysics subiterations= + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_Old_Adj(unsigned short val_var) {return Solution_Adj_Old[val_var]; } + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + void SetSolution_Old(su2double *val_solution_old); + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution_old - Value of the old solution for the index val_var. + */ + inline void SetSolution_Old(unsigned short val_var, su2double val_solution_old) {Solution_Old[val_var] = val_solution_old; } + + /*! + * \brief Set old variables to the value of the current variables. + */ + void Set_OldSolution(void); + + /*! + * \brief Set variables to the value of the old variables. + */ + void Set_Solution(void); + + /*! + * \brief Set old discrete adjoint variables to the current value of the adjoint variables. + */ + void Set_OldSolution_Adj(void); + + /*! + * \brief Set the variable solution at time n. + */ + void Set_Solution_time_n(void); + + /*! + * \brief Set the variable solution at time n-1. + */ + void Set_Solution_time_n1(void); + + /*! + * \brief Set the variable solution at time n. + */ + void Set_Solution_time_n(su2double* val_sol); + + /*! + * \brief Set the variable solution at time n-1. + */ + void Set_Solution_time_n1(su2double* val_sol); + + /*! + * \brief Set to zero the velocity components of the solution. + */ + void SetVelSolutionZero(void); + + /*! + * \brief Specify a vector to set the velocity components of the solution. + * \param[in] val_vector - Pointer to the vector. + */ + void SetVelSolutionVector(su2double *val_vector); + + /*! + * \brief Set to zero velocity components of the solution. + */ + void SetVelSolutionOldZero(void); + + /*! + * \brief Specify a vector to set the velocity components of the old solution. + * \param[in] val_vector - Pointer to the vector. + */ + void SetVelSolutionOldVector(su2double *val_vector); + + /*! + * \brief Set to zero the solution. + */ + void SetSolutionZero(void); + + /*! + * \brief Set to zero a particular solution. + */ + void SetSolutionZero(unsigned short val_var); + + /*! + * \brief Add a value to the solution. + * \param[in] val_var - Number of the variable. + * \param[in] val_solution - Value that we want to add to the solution. + */ + void AddSolution(unsigned short val_var, su2double val_solution); + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline virtual su2double GetSolution_New(unsigned short val_var) {return 0.0; } + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetRoe_Dissipation(void) {return 0.0; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetRoe_Dissipation(su2double val_dissipation) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetRoe_Dissipation_FD(su2double val_wall_dist) {} + + /*! + * \brief A virtual member. + * \param[in] val_delta - A scalar measure of the grid size + * \param[in] val_const_DES - The DES constant (C_DES) + */ + inline virtual void SetRoe_Dissipation_NTS(su2double val_delta, su2double val_const_DES) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetDES_LengthScale(void) {return 0.0; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetDES_LengthScale(su2double val_des_lengthscale) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetSolution_New(void) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Number of the variable. + * \param[in] val_solution - Value that we want to add to the solution. + */ + inline virtual void AddSolution_New(unsigned short val_var, su2double val_solution) {} + + /*! + * \brief Add a value to the solution, clipping the values. + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the solution change. + * \param[in] lowerlimit - Lower value. + * \param[in] upperlimit - Upper value. + */ + void AddClippedSolution(unsigned short val_var, su2double val_solution, + su2double lowerlimit, su2double upperlimit); + + /*! + * \brief Update the variables using a conservative format. + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the solution change. + * \param[in] val_density - Value of the density. + * \param[in] val_density_old - Value of the old density. + * \param[in] lowerlimit - Lower value. + * \param[in] upperlimit - Upper value. + */ + void AddConservativeSolution(unsigned short val_var, su2double val_solution, + su2double val_density, su2double val_density_old, su2double lowerlimit, + su2double upperlimit); + + /*! + * \brief Get the solution of the problem. + * \return Pointer to the solution vector. + */ + inline su2double *GetSolution(void) {return Solution; } + + /*! + * \brief Get the old solution of the problem (Runge-Kutta method) + * \return Pointer to the old solution vector. + */ + inline su2double *GetSolution_Old(void) {return Solution_Old; } + + /*! + * \brief Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline su2double *GetSolution_time_n(void) {return Solution_time_n; } + + /*! + * \brief Get the solution at time n-1. + * \return Pointer to the solution (at time n-1) vector. + */ + inline su2double *GetSolution_time_n1(void) {return Solution_time_n1; } + + /*! + * \brief Set the value of the old residual. + * \param[in] val_residual_old - Pointer to the residual vector. + */ + void SetResidual_Old(su2double *val_residual_old); + + /*! + * \brief Add a value to the summed residual vector. + * \param[in] val_residual - Pointer to the residual vector. + */ + void AddResidual_Sum(su2double *val_residual); + + /*! + * \brief Set summed residual vector to zero value. + */ + void SetResidualSumZero(void); + + /*! + * \brief Set the velocity of the truncation error to zero. + */ + inline virtual void SetVel_ResTruncError_Zero(unsigned short iSpecies) {} + + /*! + * \brief Get the value of the summed residual. + * \return Pointer to the summed residual. + */ + inline su2double *GetResidual_Sum(void) {return Residual_Sum; } + + /*! + * \brief Get the value of the old residual. + * \return Pointer to the old residual. + */ + inline su2double *GetResidual_Old(void) {return Residual_Old; } + + /*! + * \brief Get the value of the summed residual. + * \param[in] val_residual - Pointer to the summed residual. + */ + void GetResidual_Sum(su2double *val_residual); + + /*! + * \brief Set auxiliar variables, we are looking for the gradient of that variable. + * \param[in] val_auxvar - Value of the auxiliar variable. + */ + inline void SetAuxVar(su2double val_auxvar) {AuxVar = val_auxvar; } + + /*! + * \brief Get the value of the auxiliary variable. + * \return Value of the auxiliary variable. + */ + inline su2double GetAuxVar(void) {return AuxVar; } + + /*! + * \brief Set the auxiliary variable gradient to zero value. + */ + void SetAuxVarGradientZero(void); + + /*! + * \brief Set the value of the auxiliary variable gradient. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_gradient - Value of the gradient for the index val_dim. + */ + inline void SetAuxVarGradient(unsigned short val_dim, su2double val_gradient) {Grad_AuxVar[val_dim] = val_gradient;} + + /*! + * \brief Add a value to the auxiliary variable gradient. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient to be added for the index val_dim. + */ + inline void AddAuxVarGradient(unsigned short val_dim, su2double val_value) {Grad_AuxVar[val_dim] += val_value;} + + /*! + * \brief Subtract a value to the auxiliary variable gradient. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient to be subtracted for the index val_dim. + */ + inline void SubtractAuxVarGradient(unsigned short val_dim, su2double val_value) {Grad_AuxVar[val_dim] -= val_value; } + + /*! + * \brief Get the gradient of the auxiliary variable. + * \return Value of the gradient of the auxiliary variable. + */ + inline su2double *GetAuxVarGradient(void) {return Grad_AuxVar; } + + /*! + * \brief Get the gradient of the auxiliary variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the gradient of the auxiliary variable for the dimension val_dim. + */ + inline su2double GetAuxVarGradient(unsigned short val_dim) {return Grad_AuxVar[val_dim]; } + + /*! + * \brief Add a value to the truncation error. + * \param[in] val_truncation_error - Value that we want to add to the truncation error. + */ + void AddRes_TruncError(su2double *val_truncation_error); + + /*! + * \brief Subtract a value to the truncation error. + * \param[in] val_truncation_error - Value that we want to subtract to the truncation error. + */ + void SubtractRes_TruncError(su2double *val_truncation_error); + + /*! + * \brief Set the truncation error to zero. + */ + void SetRes_TruncErrorZero(void); + + /*! + * \brief Set the truncation error to zero. + */ + void SetVal_ResTruncError_Zero(unsigned short val_var); + + /*! + * \brief Set the velocity of the truncation error to zero. + */ + void SetVel_ResTruncError_Zero(void); + + /*! + * \brief Set the velocity of the truncation error to zero. + */ + void SetEnergy_ResTruncError_Zero(void); + + /*! + * \brief Get the truncation error. + * \return Pointer to the truncation error. + */ + inline su2double *GetResTruncError(void) {return Res_TruncError; } + + /*! + * \brief Get the truncation error. + * \param[in] val_trunc_error - Pointer to the truncation error. + */ + void GetResTruncError(su2double *val_trunc_error); + + /*! + * \brief Set the gradient of the solution. + * \param[in] val_gradient - Gradient of the solution. + */ + void SetGradient(su2double **val_gradient); + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient. + */ + inline void SetGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient[val_var][val_dim] = val_value; } + + /*! + * \brief Set to zero the gradient of the solution. + */ + void SetGradientZero(void); + + /*! + * \brief Add val_value to the solution gradient. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to add to the solution gradient. + */ + inline void AddGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient[val_var][val_dim] += val_value; } + + /*! + * \brief Subtract val_value to the solution gradient. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to subtract to the solution gradient. + */ + inline void SubtractGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient[val_var][val_dim] -= val_value; } + + /*! + * \brief Get the value of the solution gradient. + * \return Value of the gradient solution. + */ + inline su2double **GetGradient(void) {return Gradient; } + + /*! + * \brief Get the value of the solution gradient. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the solution gradient. + */ + inline su2double GetGradient(unsigned short val_var, unsigned short val_dim) {return Gradient[val_var][val_dim]; } + + /*! + * \brief Set the value of an entry in the Rmatrix for least squares gradient calculations. + * \param[in] val_iDim - Index of the dimension. + * \param[in] val_jDim - Index of the dimension. + * \param[in] val_value - Value of the Rmatrix entry. + */ + inline void SetRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value) {Rmatrix[val_iDim][val_jDim] = val_value; } + + /*! + * \brief Set to zero the Rmatrix for least squares gradient calculations. + */ + void SetRmatrixZero(void); + + /*! + * \brief Add val_value to the Rmatrix for least squares gradient calculations. + * \param[in] val_iDim - Index of the dimension. + * \param[in] val_jDim - Index of the dimension. + * \param[in] val_value - Value to add to the Rmatrix entry. + */ + inline void AddRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value) {Rmatrix[val_iDim][val_jDim] += val_value; } + + /*! + * \brief Get the value of the Rmatrix entry for least squares gradient calculations. + * \param[in] val_iDim - Index of the dimension. + * \param[in] val_jDim - Index of the dimension. + * \return Value of the Rmatrix entry. + */ + inline su2double GetRmatrix(unsigned short val_iDim, unsigned short val_jDim) {return Rmatrix[val_iDim][val_jDim]; } + + /*! + * \brief Set the value of the limiter. + * \param[in] val_var - Index of the variable. + * \param[in] val_limiter - Value of the limiter for the index val_var. + */ + inline void SetLimiter(unsigned short val_var, su2double val_limiter) {Limiter[val_var] = val_limiter; } + + /*! + * \brief Set the value of the limiter. + * \param[in] val_species - Index of the species . + * \param[in] val_var - Index of the variable. + * \param[in] val_limiter - Value of the limiter for the index val_var. + */ + inline virtual void SetLimiterPrimitive(unsigned short val_species, unsigned short val_var, su2double val_limiter) {} + + /*! + * \brief Set the value of the limiter. + * \param[in] val_species - Index of the species . + * \param[in] val_var - Index of the variable. + */ + inline virtual su2double GetLimiterPrimitive(unsigned short val_species, unsigned short val_var) {return 0.0; } + + /*! + * \brief Set the value of the max solution. + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the max solution for the index val_var. + */ + inline void SetSolution_Max(unsigned short val_var, su2double val_solution) {Solution_Max[val_var] = val_solution; } + + /*! + * \brief Set the value of the min solution. + * \param[in] val_var - Index of the variable. + * \param[in] val_solution - Value of the min solution for the index val_var. + */ + inline void SetSolution_Min(unsigned short val_var, su2double val_solution) {Solution_Min[val_var] = val_solution; } + + /*! + * \brief Get the value of the slope limiter. + * \return Pointer to the limiters vector. + */ + inline su2double *GetLimiter(void) {return Limiter; } + + /*! + * \brief Get the value of the slope limiter. + * \param[in] val_var - Index of the variable. + * \return Value of the limiter vector for the variable val_var. + */ + inline su2double GetLimiter(unsigned short val_var) {return Limiter[val_var]; } + + /*! + * \brief Get the value of the min solution. + * \param[in] val_var - Index of the variable. + * \return Value of the min solution for the variable val_var. + */ + inline su2double GetSolution_Max(unsigned short val_var) {return Solution_Max[val_var]; } + + /*! + * \brief Get the value of the min solution. + * \param[in] val_var - Index of the variable. + * \return Value of the min solution for the variable val_var. + */ + inline su2double GetSolution_Min(unsigned short val_var) {return Solution_Min[val_var]; } + + /*! + * \brief Get the value of the preconditioner Beta. + * \return Value of the low Mach preconditioner variable Beta + */ + inline virtual su2double GetPreconditioner_Beta() {return 0; } + + /*! + * \brief Set the value of the preconditioner Beta. + * \param[in] val_Beta - Value of the low Mach preconditioner variable Beta + */ + inline virtual void SetPreconditioner_Beta(su2double val_Beta) {} + + /*! + * \brief Get the value of the wind gust + * \return Value of the wind gust + */ + inline virtual su2double* GetWindGust() {return 0; } + + /*! + * \brief Set the value of the wind gust + * \param[in] val_WindGust - Value of the wind gust + */ + inline virtual void SetWindGust(su2double* val_WindGust) {} + + /*! + * \brief Get the value of the derivatives of the wind gust + * \return Value of the derivatives of the wind gust + */ + inline virtual su2double* GetWindGustDer() {return NULL;} + + /*! + * \brief Set the value of the derivatives of the wind gust + * \param[in] val_WindGust - Value of the derivatives of the wind gust + */ + inline virtual void SetWindGustDer(su2double* val_WindGust) {} + + /*! + * \brief Set the value of the time step. + * \param[in] val_delta_time - Value of the time step. + */ + inline void SetDelta_Time(su2double val_delta_time) {Delta_Time = val_delta_time; } + + /*! + * \brief Set the value of the time step. + * \param[in] val_delta_time - Value of the time step. + * \param[in] iSpecies - Index of the Species . + */ + inline virtual void SetDelta_Time(su2double val_delta_time, unsigned short iSpecies) {} + + /*! + * \brief Get the value of the time step. + * \return Value of the time step. + */ + inline su2double GetDelta_Time(void) {return Delta_Time; } + + /*! + * \brief Get the value of the time step. + * \param[in] iSpecies - Index of the Species + * \return Value of the time step. + */ + inline virtual su2double GetDelta_Time(unsigned short iSpecies) {return 0;} + + /*! + * \brief Set the value of the maximum eigenvalue. + * \param[in] val_max_lambda - Value of the maximum eigenvalue. + */ + inline void SetMax_Lambda(su2double val_max_lambda) {Max_Lambda = val_max_lambda; } + + /*! + * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. + */ + inline void SetMax_Lambda_Inv(su2double val_max_lambda) {Max_Lambda_Inv = val_max_lambda; } + + /*! + * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] val_species - Value of the species index to set the maximum eigenvalue. + */ + inline virtual void SetMax_Lambda_Inv(su2double val_max_lambda, unsigned short val_species) {} + + /*! + * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. + */ + inline void SetMax_Lambda_Visc(su2double val_max_lambda) {Max_Lambda_Visc = val_max_lambda; } + + /*! + * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] val_species - Index of the species to set the maximum eigenvalue of the viscous terms. + */ + inline virtual void SetMax_Lambda_Visc(su2double val_max_lambda, unsigned short val_species) {} + + /*! + * \brief Add a value to the maximum eigenvalue. + * \param[in] val_max_lambda - Value of the maximum eigenvalue. + */ + inline void AddMax_Lambda(su2double val_max_lambda) {Max_Lambda += val_max_lambda; } + + /*! + * \brief Add a value to the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. + */ + inline void AddMax_Lambda_Inv(su2double val_max_lambda) {Max_Lambda_Inv += val_max_lambda; } + + /*! + * \brief Add a value to the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. + */ + inline void AddMax_Lambda_Visc(su2double val_max_lambda) {Max_Lambda_Visc += val_max_lambda; } + + /*! + * \brief Get the value of the maximum eigenvalue. + * \return the value of the maximum eigenvalue. + */ + inline su2double GetMax_Lambda(void) {return Max_Lambda; } + + /*! + * \brief Get the value of the maximum eigenvalue for the inviscid terms of the PDE. + * \return the value of the maximum eigenvalue for the inviscid terms of the PDE. + */ + inline su2double GetMax_Lambda_Inv(void) {return Max_Lambda_Inv; } + + /*! + * \brief Get the value of the maximum eigenvalue for the viscous terms of the PDE. + * \return the value of the maximum eigenvalue for the viscous terms of the PDE. + */ + inline su2double GetMax_Lambda_Visc(void) {return Max_Lambda_Visc; } + + /*! + * \brief Set the value of the spectral radius. + * \param[in] val_lambda - Value of the spectral radius. + */ + inline void SetLambda(su2double val_lambda) {Lambda = val_lambda; } + + /*! + * \brief Set the value of the spectral radius. + * \param[in] val_lambda - Value of the spectral radius. + * \param[in] val_iSpecies -Index of species + */ + inline virtual void SetLambda(su2double val_lambda, unsigned short val_iSpecies) {} + + /*! + * \brief Add the value of the spectral radius. + * \param[in] val_lambda - Value of the spectral radius. + */ + inline void AddLambda(su2double val_lambda) {Lambda += val_lambda; } + + /*! + * \brief Add the value of the spectral radius. + * \param[in] val_iSpecies -Index of species + * \param[in] val_lambda - Value of the spectral radius. + */ + inline virtual void AddLambda(su2double val_lambda, unsigned short val_iSpecies) {} + + /*! + * \brief Get the value of the spectral radius. + * \return Value of the spectral radius. + */ + inline su2double GetLambda(void) {return Lambda; } + + /*! + * \brief Get the value of the spectral radius. + * \param[in] val_iSpecies -Index of species + * \return Value of the spectral radius. + */ + inline virtual su2double GetLambda(unsigned short val_iSpecies) {return 0.0;} + + /*! + * \brief Set pressure sensor. + * \param[in] val_sensor - Value of the pressure sensor. + */ + inline void SetSensor(su2double val_sensor) {Sensor = val_sensor; } + + /*! + * \brief Set pressure sensor. + * \param[in] val_sensor - Value of the pressure sensor. + * \param[in] iSpecies - Index of the species. + */ + inline virtual void SetSensor(su2double val_sensor, unsigned short iSpecies) {} + + /*! + * \brief Get the pressure sensor. + * \return Value of the pressure sensor. + */ + inline su2double GetSensor(void) {return Sensor; } + + /*! + * \brief Get the pressure sensor. + * \param[in] iSpecies - index of species + * \return Value of the pressure sensor. + */ + inline virtual su2double GetSensor(unsigned short iSpecies) {return 0;} + + /*! + * \brief Set the value of the undivided laplacian of the solution. + * \param[in] val_var - Index of the variable. + * \param[in] val_undivided_laplacian - Value of the undivided solution for the index val_var. + */ + inline void SetUndivided_Laplacian(unsigned short val_var, su2double val_undivided_laplacian) { + Undivided_Laplacian[val_var] = val_undivided_laplacian; + } + + /*! + * \brief Add the value of the undivided laplacian of the solution. + * \param[in] val_und_lapl - Value of the undivided solution. + */ + void AddUnd_Lapl(su2double *val_und_lapl); + + /*! + * \brief Subtract the value of the undivided laplacian of the solution. + * \param[in] val_und_lapl - Value of the undivided solution. + */ + void SubtractUnd_Lapl(su2double *val_und_lapl); + + /*! + * \brief Subtract the value of the undivided laplacian of the solution. + * \param[in] val_var - Variable of the undivided laplacian. + * \param[in] val_und_lapl - Value of the undivided solution. + */ + void SubtractUnd_Lapl(unsigned short val_var, su2double val_und_lapl); + + /*! + * \brief Set the undivided laplacian of the solution to zero. + */ + void SetUnd_LaplZero(void); + + /*! + * \brief Set a value to the undivided laplacian. + * \param[in] val_var - Variable of the undivided laplacian. + * \param[in] val_und_lapl - Value of the undivided laplacian. + */ + void SetUnd_Lapl(unsigned short val_var, su2double val_und_lapl); + + /*! + * \brief Get the undivided laplacian of the solution. + * \return Pointer to the undivided laplacian vector. + */ + inline su2double *GetUndivided_Laplacian(void) {return Undivided_Laplacian; } + + /*! + * \brief Get the undivided laplacian of the solution. + * \param[in] val_var - Variable of the undivided laplacian. + * \return Value of the undivided laplacian vector. + */ + inline su2double GetUndivided_Laplacian(unsigned short val_var) {return Undivided_Laplacian[val_var]; } + + /*! + * \brief A virtual member. + * \return Value of the flow density. + */ + inline virtual su2double GetDensity(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Old value of the flow density. + */ + inline virtual su2double GetDensity_Old(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the flow density. + */ + inline virtual su2double GetDensity(unsigned short val_iSpecies) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_Species - Index of species s. + * \return Value of the mass fraction of species s. + */ + inline virtual su2double GetMassFraction(unsigned short val_Species) {return 0.0;} + + /*! + * \brief A virtual member. + * \return Value of the flow energy. + */ + inline virtual su2double GetEnergy(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Pointer to the force projection vector. + */ + inline virtual su2double *GetForceProj_Vector(void) {return NULL; } + + /*! + * \brief A virtual member. + * \return Pointer to the objective function source. + */ + inline virtual su2double *GetObjFuncSource(void) {return NULL; } + + /*! + * \brief A virtual member. + * \return Pointer to the internal boundary vector. + */ + inline virtual su2double *GetIntBoundary_Jump(void) {return NULL; } + + /*! + * \brief A virtual member. + * \return Value of the eddy viscosity. + */ + inline virtual su2double GetEddyViscosity(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the flow enthalpy. + */ + inline virtual su2double GetEnthalpy(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the flow pressure. + */ + inline virtual su2double GetPressure(void) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_vector - Direction of projection. + * \return Value of the projected velocity. + */ + inline virtual su2double GetProjVel(su2double *val_vector) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_vector - Direction of projection. + * \param[in] val_species - Index of the desired species. + * \return Value of the projected velocity. + */ + inline virtual su2double GetProjVel(su2double *val_vector, unsigned short val_species) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the sound speed. + */ + inline virtual su2double GetSoundSpeed(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the beta for the incompressible flow. + */ + inline virtual su2double GetBetaInc2(void) { return 0.0; } + + /*! + * \brief A virtual member. + * \return Value of the temperature. + */ + inline virtual su2double GetTemperature(void) {return 0.0; } + + /*! + * \brief A virtual member. + * \return Value of the vibrational-electronic temperature. + */ + inline virtual su2double GetTemperature_ve(void) {return 0; } + + /*! + * \brief A virtual member -- Get the mixture specific heat at constant volume (trans.-rot.). + * \return \f$\rho C^{t-r}_{v} \f$ + */ + inline virtual su2double GetRhoCv_tr(void) {return 0; } + + /*! + * \brief A virtual member -- Get the mixture specific heat at constant volume (vib.-el.). + * \return \f$\rho C^{v-e}_{v} \f$ + */ + inline virtual su2double GetRhoCv_ve(void) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_dim - Index of the dimension. + * \return Value of the velocity for the dimension val_dim. + */ + inline virtual su2double GetVelocity(unsigned short val_dim) {return 0; } + + /*! + * \brief A virtual member. + * \return Norm 2 of the velocity vector. + */ + inline virtual su2double GetVelocity2(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Norm 2 of the velocity vector of Fluid val_species. + */ + inline virtual su2double GetVelocity2(unsigned short val_species) {return 0;} + + /*! + * \brief A virtual member. + * \return The laminar viscosity of the flow. + */ + inline virtual su2double GetLaminarViscosity(void) {return 0; } + + + /*! + * \brief A virtual member. + * \return The laminar viscosity of the flow. + */ + inline virtual su2double GetLaminarViscosity(unsigned short iSpecies) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the species diffusion coefficient. + */ + inline virtual su2double* GetDiffusionCoeff(void) {return NULL; } + + /*! + * \brief A virtual member. + * \return Value of the thermal conductivity (translational/rotational) + */ + inline virtual su2double GetThermalConductivity(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the specific heat at constant P + */ + inline virtual su2double GetSpecificHeatCp(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the specific heat at constant V + */ + inline virtual su2double GetSpecificHeatCv(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the thermal conductivity (vibrational) + */ + inline virtual su2double GetThermalConductivity_ve(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Sets separation intermittency + */ + inline virtual void SetGammaSep(su2double gamma_sep) {} + + /*! + * \brief A virtual member. + * \return Sets separation intermittency + */ + inline virtual void SetGammaEff(void) {} + + /*! + * \brief A virtual member. + * \return Returns intermittency + */ + inline virtual su2double GetIntermittency() { return 0.0; } + + /*! + * \brief A virtual member. + * \return Value of the vorticity. + */ + inline virtual su2double *GetVorticity(void) {return 0; } + + /*! + * \brief A virtual member. + * \return Value of the rate of strain magnitude. + */ + inline virtual su2double GetStrainMag(void) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. + */ + inline virtual void SetForceProj_Vector(su2double *val_ForceProj_Vector) {} + + /*! + * \brief A virtual member. + * \param[in] val_SetObjFuncSource - Pointer to the objective function source. + */ + inline virtual void SetObjFuncSource(su2double *val_SetObjFuncSource) {} + + /*! + * \brief A virtual member. + * \param[in] val_IntBoundary_Jump - Pointer to the interior boundary jump. + */ + inline virtual void SetIntBoundary_Jump(su2double *val_IntBoundary_Jump) {} + + /*! + * \brief A virtual member. + * \return Value of the gamma_BC of B-C transition model. + */ + inline virtual su2double GetGammaBC(void) {return 0; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetGammaBC(su2double val_gamma) {} + + /*! + * \brief A virtual member. + * \param[in] eddy_visc - Value of the eddy viscosity. + */ + inline virtual void SetEddyViscosity(su2double eddy_visc) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetEnthalpy(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPrimVar(CConfig *config) {return true; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPrimVar(CFluidModel *FluidModel) {return true; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetSecondaryVar(CFluidModel *FluidModel) {} + + /*! + * \brief A virtual member. + */ + inline virtual bool Cons2PrimVar(CConfig *config, su2double *U, su2double *V, su2double *dPdU, + su2double *dTdU, su2double *dTvedU) { return false; } + /*! + * \brief A virtual member. + */ + inline virtual void Prim2ConsVar(CConfig *config, su2double *V, su2double *U) {return; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config) {return true; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CConfig *config) {return true; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) {return true; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPrimVar(su2double Density_Inf, CConfig *config) {return true; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPrimVar(su2double Density_Inf, su2double Viscosity_Inf, su2double eddy_visc, su2double turb_ke, CConfig *config) {return true; } + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetPrimitive(unsigned short val_var) {return 0; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetPrimitive(unsigned short val_var, su2double val_prim) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetPrimitive(su2double *val_prim) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double *GetPrimitive(void) {return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetSecondary(unsigned short val_var) {return 0; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetSecondary(unsigned short val_var, su2double val_secondary) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetSecondary(su2double *val_secondary) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetdPdrho_e(su2double dPdrho_e) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetdPde_rho(su2double dPde_rho) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetdTdrho_e(su2double dTdrho_e) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetdTde_rho(su2double dTde_rho) {} + + /*! + * \brief A virtual member. + */ + inline virtual void Setdmudrho_T(su2double dmudrho_T) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetdmudT_rho(su2double dmudT_rho) {} + + /*! + * \brief A virtual member. + */ + inline virtual void Setdktdrho_T(su2double dktdrho_T) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetdktdT_rho(su2double dktdT_rho) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double *GetSecondary(void) {return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetDensity(su2double val_density) { return false; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetDensity(void) { return false; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetPressure(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetVelocity(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetBetaInc2(su2double val_betainc2) {} + + /*! + * \brief A virtual member. + * \param[in] val_phi - Value of the adjoint velocity. + */ + inline virtual void SetPhi_Old(su2double *val_phi) {} + + /*! + * \brief A virtual member. + * \param[in] Gamma - Ratio of Specific heats + */ + inline virtual bool SetPressure(su2double Gamma) {return false; } + + /*! + * \brief A virtual member. + * \param[in] config + */ + inline virtual bool SetPressure(CConfig *config) {return false; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetPressure(su2double Gamma, su2double turb_ke) {return false; } + + /*! + * \brief Calculates vib.-el. energy per mass, \f$e^{vib-el}_s\f$, for input species (not including KE) + */ + inline virtual su2double CalcEve(su2double *V, CConfig *config, unsigned short val_Species) {return 0; } + + /*! + * \brief Calculates enthalpy per mass, \f$h_s\f$, for input species (not including KE) + */ + inline virtual su2double CalcHs(su2double *V, CConfig *config, unsigned short val_Species) {return 0; } + + /*! + * \brief Calculates enthalpy per mass, \f$Cv_s\f$, for input species (not including KE) + */ + inline virtual su2double CalcCvve(su2double val_Tve, CConfig *config, unsigned short val_Species) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] V + * \param[in] config - Configuration settings + * \param[in] dPdU + */ + inline virtual void CalcdPdU(su2double *V, CConfig *config, su2double *dPdU) {} + + /*! + * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ + * \param[in] V + * \param[in] config - Configuration settings + * \param[in] dTdU + */ + inline virtual void CalcdTdU(su2double *V, CConfig *config, su2double *dTdU) {} + + /*! + * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ + * \param[in] V + * \param[in] config - Configuration settings + * \param[in] dTdU + */ + inline virtual void CalcdTvedU(su2double *V, CConfig *config, su2double *dTdU) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double *GetdPdU(void) { return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual su2double *GetdTdU(void) { return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual su2double *GetdTvedU(void) { return NULL; } + + /*! + * \brief A virtual member. + * \param[in] val_velocity - Value of the velocity. + * \param[in] Gamma - Ratio of Specific heats + */ + inline virtual void SetDeltaPressure(su2double *val_velocity, su2double Gamma) {} + + /*! + * \brief A virtual member. + * \param[in] Gamma - Ratio of specific heats. + */ + inline virtual bool SetSoundSpeed(su2double Gamma) {return false; } + + /*! + * \brief A virtual member. + * \param[in] config - Configuration parameters. + */ + inline virtual bool SetSoundSpeed(CConfig *config) {return false; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetSoundSpeed(void) { return false; } + + /*! + * \brief A virtual member. + * \param[in] Gas_Constant - Value of the Gas Constant + */ + inline virtual bool SetTemperature(su2double Gas_Constant) {return false; } + + /*! + * \brief Sets the vibrational electronic temperature of the flow. + * \return Value of the temperature of the flow. + */ + inline virtual bool SetTemperature_ve(su2double val_Tve) {return false; } + + /*! + * \brief A virtual member. + * \param[in] config - Configuration parameters. + */ + inline virtual bool SetTemperature(CConfig *config) {return false; } + + /*! + * \brief A virtual member. + * \param[in] config - Configuration parameters. + */ + inline virtual void SetPrimitive(CConfig *config) {} + + /*! + * \brief A virtual member. + * \param[in] config - Configuration parameters. + * \param[in] Coord - Physical coordinates. + */ + inline virtual void SetPrimitive(CConfig *config, su2double *Coord) {} + + /*! + * \brief A virtual member. + * \param[in] Temperature_Wall - Value of the Temperature at the wall + */ + inline virtual void SetWallTemperature(su2double Temperature_Wall) {} + + /*! + * \brief A virtual member. + * \param[in] Temperature_Wall - Value of the Temperature at the wall + */ + inline virtual void SetWallTemperature(su2double* Temperature_Wall) {} + + /*! + * \brief Set the thermal coefficient. + * \param[in] config - Configuration parameters. + */ + inline virtual void SetThermalCoeff(CConfig *config) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetStress_FEM(unsigned short iVar, su2double val_stress) {} + + /*! + * \brief A virtual member. + */ + inline virtual void AddStress_FEM(unsigned short iVar, su2double val_stress) {} + + /*! + * \brief A virtual member. + + */ + inline virtual su2double *GetStress_FEM(void) {return NULL;} + + /*! + * \brief A virtual member. + */ + inline virtual void SetVonMises_Stress(su2double val_stress) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetVonMises_Stress(void) {return 0.0;} + + /*! + * \brief A virtual member. + */ + inline virtual void Add_SurfaceLoad_Res(su2double *val_surfForce) {} + + /*! + * \brief A virtual member. + */ + inline virtual void Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double Get_SurfaceLoad_Res(unsigned short iVar) {return 0.0;} + + /*! + * \brief A virtual member. + */ + inline virtual void Clear_SurfaceLoad_Res(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual void Set_SurfaceLoad_Res_n(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double Get_SurfaceLoad_Res_n(unsigned short iVar) {return 0.0;} + + /*! + * \brief A virtual member. + */ + inline virtual void Add_BodyForces_Res(su2double *val_bodyForce) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double Get_BodyForces_Res(unsigned short iVar) {return 0.0;} + + /*! + * \brief A virtual member. + */ + inline virtual void Clear_BodyForces_Res(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual void Set_FlowTraction(su2double *val_flowTraction) {} + + /*! + * \brief A virtual member. + */ + inline virtual void Add_FlowTraction(su2double *val_flowTraction) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double Get_FlowTraction(unsigned short iVar) {return 0.0;} + + /*! + * \brief A virtual member. + */ + inline virtual void Set_FlowTraction_n(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double Get_FlowTraction_n(unsigned short iVar) {return 0.0;} + + /*! + * \brief A virtual member. + */ + inline virtual void Clear_FlowTraction(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual bool Get_isVertex(void) {return false;} + + /*! + * \brief A virtual member. + */ + inline virtual void SetVelocity2(void) {} + + /*! + * \brief A virtual member. + * \param[in] val_velocity - Pointer to the velocity. + */ + inline virtual void SetVelocity_Old(su2double *val_velocity) {} + + /*! + * \brief A virtual member. + * \param[in] laminarViscosity + */ + inline virtual void SetLaminarViscosity(su2double laminarViscosity) {} + + /*! + * \brief A virtual member. + * \param[in] config - Definition of the particular problem. + */ + inline virtual void SetLaminarViscosity(CConfig *config) {} + + /*! + * \brief A virtual member. + * \param[in] thermalConductivity + */ + inline virtual void SetThermalConductivity(su2double thermalConductivity) {} + + /*! + * \brief A virtual member. + * \param[in] config - Definition of the particular problem. + */ + inline virtual void SetThermalConductivity(CConfig *config) {} + + /*! + * \brief A virtual member. + * \param[in] Cp - Constant pressure specific heat. + */ + inline virtual void SetSpecificHeatCp(su2double Cp) {} + + /*! + * \brief A virtual member. + * \param[in] Cv - Constant volume specific heat. + */ + inline virtual void SetSpecificHeatCv(su2double Cv) {} + + /*! + * \brief A virtual member. + */ + inline virtual bool SetVorticity(void) {return false; } + + /*! + * \brief A virtual member. + */ + inline virtual bool SetStrainMag(void) {return false; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetVelSolutionOldDVector(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetVelSolutionDVector(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetGradient_PrimitiveZero(unsigned short val_primvar) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to add to the gradient of the primitive variables. + */ + inline virtual void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to subtract to the gradient of the primitive variables. + */ + inline virtual void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the primitive variables gradient. + */ + inline virtual su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \return Value of the primitive variables gradient. + */ + inline virtual su2double GetLimiter_Primitive(unsigned short val_var) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient. + */ + inline virtual void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_value - Value of the gradient. + */ + inline virtual void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {} + + /*! + * \brief A virtual member. + * \return Value of the primitive variables gradient. + */ + inline virtual su2double **GetGradient_Primitive(void) {return NULL; } + + /*! + * \brief A virtual member. + * \return Value of the primitive variables gradient. + */ + inline virtual su2double *GetLimiter_Primitive(void) {return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetGradient_SecondaryZero(unsigned short val_secondaryvar) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to add to the gradient of the Secondary variables. + */ + inline virtual void AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value to subtract to the gradient of the Secondary variables. + */ + inline virtual void SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \return Value of the Secondary variables gradient. + */ + inline virtual su2double GetGradient_Secondary(unsigned short val_var, unsigned short val_dim) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \return Value of the Secondary variables gradient. + */ + inline virtual su2double GetLimiter_Secondary(unsigned short val_var) {return 0; } + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_dim - Index of the dimension. + * \param[in] val_value - Value of the gradient. + */ + inline virtual void SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_value - Value of the gradient. + */ + inline virtual void SetLimiter_Secondary(unsigned short val_var, su2double val_value) {} + + /*! + * \brief A virtual member. + * \return Value of the Secondary variables gradient. + */ + inline virtual su2double **GetGradient_Secondary(void) {return NULL; } + + /*! + * \brief A virtual member. + * \return Value of the Secondary variables gradient. + */ + inline virtual su2double *GetLimiter_Secondary(void) {return NULL; } + + /*! + * \brief Set the blending function for the blending of k-w and k-eps. + * \param[in] val_viscosity - Value of the vicosity. + * \param[in] val_density - Value of the density. + * \param[in] val_dist - Value of the distance to the wall. + */ + inline virtual void SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density) {} + + /*! + * \brief Get the first blending function of the SST model. + */ + inline virtual su2double GetF1blending(void) {return 0; } + + /*! + * \brief Get the second blending function of the SST model. + */ + inline virtual su2double GetF2blending(void) {return 0; } + + /*! + * \brief Get the value of the cross diffusion of tke and omega. + */ + inline virtual su2double GetCrossDiff(void) { return 0.0; } + + /*! + * \brief Get the value of the eddy viscosity. + * \return the value of the eddy viscosity. + */ + inline virtual su2double GetmuT(void) { return 0.0; } + + /*! + * \brief Set the value of the eddy viscosity. + * \param[in] val_muT + */ + inline virtual void SetmuT(su2double val_muT) {} + + /*! + * \brief Add a value to the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] iSpecies - Value of iSpecies to which the eigenvalue belongs + */ + inline virtual void AddMax_Lambda_Inv(su2double val_max_lambda, unsigned short iSpecies) {} + + /*! + * \brief Add a value to the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] iSpecies - Value of iSpecies to which the eigenvalue belongs + */ + inline virtual void AddMax_Lambda_Visc(su2double val_max_lambda, unsigned short iSpecies) {} + + /*! + * \brief A virtual member. + * \param[in] val_var - Index of the variable. + * \param[in] val_source - Value of the harmonic balance source. + */ + inline virtual void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetHarmonicBalance_Source(unsigned short val_var) {return 0; } + + /*! + * \brief Set the Eddy Viscosity Sensitivity of the problem. + * \param[in] val_EddyViscSens - Eddy Viscosity Sensitivity. + * \param[in] numTotalVar - Number of variables. + */ + inline virtual void SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar) {} + + /*! + * \brief Get the Eddy Viscosity Sensitivity of the problem. + * \return Pointer to the Eddy Viscosity Sensitivity. + */ + inline virtual su2double *GetEddyViscSens(void) {return NULL; } + + /*! + * \brief A virtual member. Set the direct solution for the adjoint solver. + * \param[in] val_solution_direct - Value of the direct solution. + */ + inline virtual void SetSolution_Direct(su2double *val_solution_direct) {} + + /*! + * \brief A virtual member. Get the direct solution for the adjoint solver. + * \return Pointer to the direct solution vector. + */ + inline virtual su2double *GetSolution_Direct(void) { return NULL; } + + /*! + * \brief A virtual member. Set the restart geometry (coordinate of the converged solution) + * \param[in] val_coordinate_direct - Value of the restart coordinate. + */ + inline virtual void SetGeometry_Direct(su2double *val_coordinate_direct) {} + + /*! + * \brief A virtual member. Get the restart geometry (coordinate of the converged solution). + * \return Pointer to the restart coordinate vector. + */ + inline virtual su2double *GetGeometry_Direct(void) { return NULL; } + + /*! + * \brief A virtual member. Get the restart geometry (coordinate of the converged solution). + * \return Coordinate of the direct solver restart for . + */ + inline virtual su2double GetGeometry_Direct(unsigned short val_dim) {return 0.0; } + + /*! + * \brief A virtual member. Get the geometry solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline virtual su2double GetSolution_Geometry(unsigned short val_var) {return 0.0;} + + /*! + * \brief A virtual member. Set the value of the mesh solution (adjoint). + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline virtual void SetSolution_Geometry(su2double *val_solution_geometry) {} + + /*! + * \brief A virtual member. Set the value of the mesh solution (adjoint). + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline virtual void SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry) {} + + /*! + * \brief A virtual member. Get the geometry solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline virtual su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return 0.0;} + + /*! + * \brief A virtual member. Set the value of the mesh solution (adjoint). + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline virtual void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) {} + + /*! + * \brief A virtual member. Get the geometry solution. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline virtual su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) {return 0.0;} + + /*! + * \brief A virtual member. Set the value of the mesh solution (adjoint). + * \param[in] val_solution - Solution of the problem (acceleration). + */ + inline virtual void SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der) {} + + /*! + * \brief A virtual member. Set the value of the old geometry solution (adjoint). + */ + inline virtual void Set_OldSolution_Geometry(void) {} + + /*! + * \brief A virtual member. Get the value of the old geometry solution (adjoint). + * \param[out] val_solution - old adjoint solution for coordinate iDim + */ + inline virtual su2double Get_OldSolution_Geometry(unsigned short iDim) {return 0.0;} + + /*! + * \brief A virtual member. Set the value of the old geometry solution (adjoint). + */ + inline virtual void Set_BGSSolution(unsigned short iDim, su2double val_solution) {} + + /*! + * \brief A virtual member. Set the value of the old geometry solution (adjoint). + */ + inline virtual void Set_BGSSolution_k(void) {} + + /*! + * \brief A virtual member. Get the value of the old geometry solution (adjoint). + * \param[out] val_solution - old adjoint solution for coordinate iDim + */ + inline virtual su2double Get_BGSSolution(unsigned short iDim) {return 0.0;} + + /*! + * \brief A virtual member. Get the value of the old geometry solution (adjoint). + * \param[out] val_solution - old adjoint solution for coordinate iDim + */ + inline virtual su2double Get_BGSSolution_k(unsigned short iDim) {return 0.0;} + + /*! + * \brief A virtual member. Set the value of the old geometry solution (adjoint). + */ + inline virtual void Set_BGSSolution_Geometry(void) {} + + /*! + * \brief A virtual member. Get the value of the old geometry solution (adjoint). + * \param[out] val_solution - old adjoint solution for coordinate iDim + */ + inline virtual su2double Get_BGSSolution_Geometry(unsigned short iDim) {return 0.0;} + + /*! + * \brief A virtual member. Set the contribution of crossed terms into the derivative. + */ + inline virtual void SetCross_Term_Derivative(unsigned short iVar, su2double der) {} + + /*! + * \brief A virtual member. Get the contribution of crossed terms into the derivative. + * \return The contribution of crossed terms into the derivative. + */ + inline virtual su2double GetCross_Term_Derivative(unsigned short iVar) {return 0.0; } + + /*! + * \brief A virtual member. Set the direct velocity solution for the adjoint solver. + * \param[in] val_solution_direct - Value of the direct velocity solution. + */ + inline virtual void SetSolution_Vel_Direct(su2double *sol) {} + + /*! + * \brief A virtual member. Set the direct acceleration solution for the adjoint solver. + * \param[in] val_solution_direct - Value of the direct acceleration solution. + */ + inline virtual void SetSolution_Accel_Direct(su2double *sol) {} + + /*! + * \brief A virtual member. Get the direct velocity solution for the adjoint solver. + * \return Pointer to the direct velocity solution vector. + */ + inline virtual su2double* GetSolution_Vel_Direct() {return NULL; } + + /*! + * \brief A virtual member. Get the direct acceleraction solution for the adjoint solver. + * \return Pointer to the direct acceleraction solution vector. + */ + inline virtual su2double* GetSolution_Accel_Direct() {return NULL; } + + /*! + * \brief Set the value of the old solution. + */ + inline virtual void SetSolution_time_n(void) {} + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_time_n - Pointer to the residual vector. + */ + inline virtual void SetSolution_time_n(unsigned short val_var, su2double val_solution) {} + + /*! + * \brief Set the value of the old solution. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + virtual void SetSolution_time_n(su2double *val_solution_time_n); + + + /*! + * \brief Set the value of the velocity (Structural Analysis). + * \param[in] val_solution - Solution of the problem (velocity). + */ + inline virtual void SetSolution_Vel(su2double *val_solution) {} + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution_vel - Value of the solution for the index val_var. + */ + inline virtual void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) {} + + /*! + * \brief Set the value of the velocity (Structural Analysis) at time n. + * \param[in] val_solution_vel_time_n - Value of the old solution. + */ + inline virtual void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) {} + + /*! + * \brief Set the value of the velocity (Structural Analysis) at time n. + */ + inline virtual void SetSolution_Vel_time_n(void) {} + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution_vel_time_n - Value of the old solution for the index val_var. + */ + inline virtual void SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n) {} + + /*! + * \brief Get the solution at time n. + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline su2double GetSolution_time_n(unsigned short val_var) {return Solution_time_n[val_var]; } + + /*! + * \brief Get the velocity (Structural Analysis). + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline virtual su2double GetSolution_Vel(unsigned short val_var) {return 0; } + + /*! + * \brief Get the solution of the problem. + * \return Pointer to the solution vector. + */ + inline virtual su2double *GetSolution_Vel(void) {return NULL; } + + /*! + * \brief Get the velocity of the nodes (Structural Analysis) at time n. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline virtual su2double GetSolution_Vel_time_n(unsigned short val_var) {return 0; } + + /*! + * \brief Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline virtual su2double *GetSolution_Vel_time_n(void) {return NULL; } + + + /*! + * \brief Set the value of the acceleration (Structural Analysis). + * \param[in] val_solution_accel - Solution of the problem (acceleration). + */ + inline virtual void SetSolution_Accel(su2double *val_solution_accel) {} + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution_accel - Value of the solution for the index val_var. + */ + inline virtual void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) {} + + /*! + * \brief Set the value of the acceleration (Structural Analysis) at time n. + * \param[in] val_solution_accel_time_n - Pointer to the residual vector. + */ + inline virtual void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) {} + + /*! + * \brief Set the value of the acceleration (Structural Analysis) at time n. + */ + inline virtual void SetSolution_Accel_time_n(void) {} + + /*! + * \overload + * \param[in] val_var - Index of the variable. + * \param[in] val_solution_accel_time_n - Value of the old solution for the index val_var. + */ + inline virtual void SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n) {} + + /*! + * \brief Get the acceleration (Structural Analysis). + * \param[in] val_var - Index of the variable. + * \return Value of the solution for the index val_var. + */ + inline virtual su2double GetSolution_Accel(unsigned short val_var) {return 0; } + + /*! + * \brief Get the solution of the problem. + * \return Pointer to the solution vector. + */ + inline virtual su2double *GetSolution_Accel(void) {return NULL; } + + /*! + * \brief Get the acceleration of the nodes (Structural Analysis) at time n. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline virtual su2double GetSolution_Accel_time_n(unsigned short val_var) {return 0; } + + /*! + * \brief Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline virtual su2double *GetSolution_Accel_time_n(void) {return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual void Set_OldSolution_Vel(void) {} + + /*! + * \brief A virtual member. + */ + inline virtual void Set_OldSolution_Accel(void) {} + + /*! + * \brief A virtual member. Set the value of the solution predictor. + */ + inline virtual void SetSolution_Pred(void) {} + + /*! + * \brief A virtual member. Set the value of the old solution. + * \param[in] val_solution_pred - Pointer to the residual vector. + */ + inline virtual void SetSolution_Pred(su2double *val_solution_pred) {} + + /*! + * \brief A virtual member. Set the value of the solution predicted. + * \param[in] val_solution_old - Pointer to the residual vector. + */ + inline virtual void SetSolution_Pred(unsigned short val_var, su2double val_solution_pred) {} + + /*! + * \brief A virtual member. Get the value of the solution predictor. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline virtual su2double GetSolution_Pred(unsigned short val_var) {return 0.0; } + + /*! + * \brief A virtual member. Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline virtual su2double *GetSolution_Pred(void) {return NULL; } + + /*! + * \brief A virtual member. Set the value of the solution predictor. + */ + inline virtual void SetSolution_Pred_Old(void) {} + + /*! + * \brief A virtual member. Set the value of the old solution. + * \param[in] val_solution_pred_Old - Pointer to the residual vector. + */ + inline virtual void SetSolution_Pred_Old(su2double *val_solution_pred_Old) {} + + /*! + * \brief A virtual member. Set the value of the old solution predicted. + * \param[in] val_solution_pred_old - Pointer to the residual vector. + */ + inline virtual void SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old) {} + + /*! + * \brief A virtual member. Get the value of the solution predictor. + * \param[in] val_var - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline virtual su2double GetSolution_Pred_Old(unsigned short val_var) {return 0.0; } + + /*! + * \brief A virtual member. Get the solution at time n. + * \return Pointer to the solution (at time n) vector. + */ + inline virtual su2double *GetSolution_Pred_Old(void) {return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetReference_Geometry(unsigned short iVar, su2double ref_geometry) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double *GetReference_Geometry(void) {return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetPrestretch(unsigned short iVar, su2double val_prestretch) {} + + /*! + * \brief A virtual member. + */ + inline virtual su2double *GetPrestretch(void) {return NULL; } + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetPrestretch(unsigned short iVar) {return 0.0; } + + /*! + * \brief A virtual member. + */ + inline virtual su2double GetReference_Geometry(unsigned short iVar) {return 0.0; } + + /*! + * \brief A virtual member. + */ + inline virtual void Register_femSolution_time_n() {} + + /*! + * \brief A virtual member. + */ + inline virtual void RegisterSolution_Vel(bool input) {} + + /*! + * \brief A virtual member. + */ + inline virtual void RegisterSolution_Vel_time_n() {} + + /*! + * \brief A virtual member. + */ + inline virtual void RegisterSolution_Accel(bool input) {} + + /*! + * \brief A virtual member. + */ + inline virtual void RegisterSolution_Accel_time_n() {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetAdjointSolution_Vel(su2double *adj_sol) {} + + /*! + * \brief A virtual member. + */ + inline virtual void GetAdjointSolution_Vel(su2double *adj_sol) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetAdjointSolution_Vel_time_n(su2double *adj_sol) {} + + /*! + * \brief A virtual member. + */ + inline virtual void GetAdjointSolution_Vel_time_n(su2double *adj_sol) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetAdjointSolution_Accel(su2double *adj_sol) {} + + /*! + * \brief A virtual member. + */ + inline virtual void GetAdjointSolution_Accel(su2double *adj_sol) {} + + /*! + * \brief A virtual member. + */ + inline virtual void SetAdjointSolution_Accel_time_n(su2double *adj_sol) {} + + /*! + * \brief A virtual member. + */ + inline virtual void GetAdjointSolution_Accel_time_n(su2double *adj_sol) {} + + /*! + * \brief Register the variables in the solution array as input/output variable. + * \param[in] input - input or output variables. + */ + inline void RegisterSolution(bool input) { + if (input) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution[iVar]); + } + else { for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterOutput(Solution[iVar]);} + } + + /*! + * \brief Register the variables in the solution_time_n array as input/output variable. + */ + inline void RegisterSolution_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_time_n[iVar]); + } + + /*! + * \brief Register the variables in the solution_time_n1 array as input/output variable. + */ + inline void RegisterSolution_time_n1(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_time_n1[iVar]); + } + + /*! + * \brief Set the adjoint values of the solution. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void SetAdjointSolution(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); + } + + /*! + * \brief Get the adjoint values of the solution. + * \param[out] adj_sol - The adjoint values of the solution. + */ + inline void GetAdjointSolution(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution[iVar]); + } + + /*! + * \brief Set the adjoint values of the solution at time n. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void SetAdjointSolution_time_n(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); + } + + /*! + * \brief Get the adjoint values of the solution at time n. + * \param[out] adj_sol - The adjoint values of the solution. + */ + inline void GetAdjointSolution_time_n(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n[iVar]); + } + + /*! + * \brief Set the adjoint values of the solution at time n-1. + * \param[in] adj_sol - The adjoint values of the solution. + */ + inline void SetAdjointSolution_time_n1(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_time_n1[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); + } + + /*! + * \brief Get the adjoint values of the solution at time n-1. + * \param[out] adj_sol - The adjoint values of the solution. + */ + inline void GetAdjointSolution_time_n1(su2double *adj_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n1[iVar]); + } + + /*! + * \brief Set the sensitivity at the node + * \param[in] iDim - spacial component + * \param[in] val - value of the Sensitivity + */ + inline virtual void SetSensitivity(unsigned short iDim, su2double val) {} + + /*! + * \brief Get the Sensitivity at the node + * \param[in] iDim - spacial component + * \return value of the Sensitivity + */ + inline virtual su2double GetSensitivity(unsigned short iDim) {return 0.0; } + + inline virtual void SetDual_Time_Derivative(unsigned short iVar, su2double der) {} + + inline virtual void SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {} + + inline virtual su2double GetDual_Time_Derivative(unsigned short iVar) {return 0.0;} + + inline virtual su2double GetDual_Time_Derivative_n(unsigned short iVar) {return 0.0;} + + inline virtual void SetTauWall(su2double val_tau_wall) {} + + inline virtual su2double GetTauWall() {return 0.0; } + + inline virtual void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity) {} + + inline virtual su2double GetVortex_Tilting() {return 0.0; } + + inline virtual void SetDynamic_Derivative(unsigned short iVar, su2double der) {} + + inline virtual void SetDynamic_Derivative_n(unsigned short iVar, su2double der) {} + + inline virtual su2double GetDynamic_Derivative(unsigned short iVar) {return 0.0; } + + inline virtual su2double GetDynamic_Derivative_n(unsigned short iVar) {return 0.0; } + + inline virtual void SetDynamic_Derivative_Vel(unsigned short iVar, su2double der) {} + + inline virtual void SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der) {} + + inline virtual su2double GetDynamic_Derivative_Vel(unsigned short iVar) {return 0.0; } + + inline virtual su2double GetDynamic_Derivative_Vel_n(unsigned short iVar) {return 0.0; } + + inline virtual void SetDynamic_Derivative_Accel(unsigned short iVar, su2double der) {} + + inline virtual void SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der) {} + + inline virtual su2double GetDynamic_Derivative_Accel(unsigned short iVar) {return 0.0; } + + inline virtual su2double GetDynamic_Derivative_Accel_n(unsigned short iVar) {return 0.0; } + + inline virtual su2double GetSolution_Old_Vel(unsigned short iVar) {return 0.0; } + + inline virtual su2double GetSolution_Old_Accel(unsigned short iVar) {return 0.0; } + +}; diff --git a/SU2_CFD/obj/Makefile.am b/SU2_CFD/obj/Makefile.am index d63cbade0b2d..c04ac5d1d482 100644 --- a/SU2_CFD/obj/Makefile.am +++ b/SU2_CFD/obj/Makefile.am @@ -79,8 +79,24 @@ libSU2Core_sources = \ ../include/task_definition.inl \ ../include/transport_model.hpp \ ../include/transport_model.inl \ - ../include/variable_structure.hpp \ - ../include/variable_structure.inl \ + ../src/variables/CFEABoundVariable.hpp \ + ../src/variables/CHeatFVMVariable.hpp \ + ../src/variables/CVariable.hpp \ + ../src/variables/CAdjNSVariable.hpp \ + ../src/variables/CTurbSSTVariable.hpp \ + ../src/variables/CAdjTurbVariable.hpp \ + ../src/variables/CTransLMVariable.hpp \ + ../src/variables/CDiscAdjFEAVariable.hpp \ + ../src/variables/CIncEulerVariable.hpp \ + ../src/variables/CTurbVariable.hpp \ + ../src/variables/CNSVariable.hpp \ + ../src/variables/CBaselineVariable.hpp \ + ../src/variables/CTurbSAVariable.hpp \ + ../src/variables/CFEAVariable.hpp \ + ../src/variables/CAdjEulerVariable.hpp \ + ../src/variables/CDiscAdjVariable.hpp \ + ../src/variables/CIncNSVariable.hpp \ + ../src/variables/CEulerVariable.hpp \ ../include/transfer_structure.hpp \ ../include/transfer_structure.inl \ ../src/definition_structure.cpp \ @@ -132,18 +148,24 @@ libSU2Core_sources = \ ../src/transfer_physics.cpp \ ../src/transfer_structure.cpp \ ../src/transport_model.cpp \ - ../src/variable_adjoint_mean.cpp \ - ../src/variable_adjoint_turbulent.cpp \ - ../src/variable_adjoint_discrete.cpp \ - ../src/variable_adjoint_elasticity.cpp \ - ../src/variable_direct_heat.cpp \ - ../src/variable_direct_mean.cpp \ - ../src/variable_direct_mean_inc.cpp \ - ../src/variable_direct_transition.cpp \ - ../src/variable_direct_turbulent.cpp \ - ../src/variable_direct_elasticity.cpp \ - ../src/variable_structure.cpp \ - ../src/variable_template.cpp + ../src/variables/CFEABoundVariable.cpp \ + ../src/variables/CHeatFVMVariable.cpp \ + ../src/variables/CVariable.cpp \ + ../src/variables/CAdjNSVariable.cpp \ + ../src/variables/CTurbSSTVariable.cpp \ + ../src/variables/CAdjTurbVariable.cpp \ + ../src/variables/CTransLMVariable.cpp \ + ../src/variables/CDiscAdjFEAVariable.cpp \ + ../src/variables/CIncEulerVariable.cpp \ + ../src/variables/CTurbVariable.cpp \ + ../src/variables/CNSVariable.cpp \ + ../src/variables/CBaselineVariable.cpp \ + ../src/variables/CTurbSAVariable.cpp \ + ../src/variables/CFEAVariable.cpp \ + ../src/variables/CAdjEulerVariable.cpp \ + ../src/variables/CDiscAdjVariable.cpp \ + ../src/variables/CIncNSVariable.cpp \ + ../src/variables/CEulerVariable.cpp su2_cfd_sources = \ ../include/SU2_CFD.hpp \ diff --git a/SU2_CFD/src/solver_adjoint_discrete.cpp b/SU2_CFD/src/solver_adjoint_discrete.cpp index ca7c728b79b4..c2ce98e632b0 100644 --- a/SU2_CFD/src/solver_adjoint_discrete.cpp +++ b/SU2_CFD/src/solver_adjoint_discrete.cpp @@ -36,6 +36,7 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CDiscAdjVariable.hpp" CDiscAdjSolver::CDiscAdjSolver(void) : CSolver () { diff --git a/SU2_CFD/src/solver_adjoint_elasticity.cpp b/SU2_CFD/src/solver_adjoint_elasticity.cpp index aea81afaaf95..87641562a43f 100644 --- a/SU2_CFD/src/solver_adjoint_elasticity.cpp +++ b/SU2_CFD/src/solver_adjoint_elasticity.cpp @@ -36,6 +36,7 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CDiscAdjFEAVariable.hpp" CDiscAdjFEASolver::CDiscAdjFEASolver(void) : CSolver (){ diff --git a/SU2_CFD/src/solver_adjoint_mean.cpp b/SU2_CFD/src/solver_adjoint_mean.cpp index e014f9e71e37..d7b63dfcedc8 100644 --- a/SU2_CFD/src/solver_adjoint_mean.cpp +++ b/SU2_CFD/src/solver_adjoint_mean.cpp @@ -36,6 +36,8 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CAdjEulerVariable.hpp" +#include "../include/variables/CAdjNSVariable.hpp" CAdjEulerSolver::CAdjEulerSolver(void) : CSolver() { diff --git a/SU2_CFD/src/solver_adjoint_turbulent.cpp b/SU2_CFD/src/solver_adjoint_turbulent.cpp index 35dc7a8ec946..1b58346e3b26 100644 --- a/SU2_CFD/src/solver_adjoint_turbulent.cpp +++ b/SU2_CFD/src/solver_adjoint_turbulent.cpp @@ -36,6 +36,7 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CAdjTurbVariable.hpp" CAdjTurbSolver::CAdjTurbSolver(void) : CSolver() {} diff --git a/SU2_CFD/src/solver_direct_elasticity.cpp b/SU2_CFD/src/solver_direct_elasticity.cpp index 7a7200bb3b76..f01c228332b0 100644 --- a/SU2_CFD/src/solver_direct_elasticity.cpp +++ b/SU2_CFD/src/solver_direct_elasticity.cpp @@ -36,6 +36,8 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CFEABoundVariable.hpp" +#include "../include/variables/CFEAVariable.hpp" #include CFEASolver::CFEASolver(void) : CSolver() { diff --git a/SU2_CFD/src/solver_direct_heat.cpp b/SU2_CFD/src/solver_direct_heat.cpp index 7fd7bbb448db..917b468d7fd7 100644 --- a/SU2_CFD/src/solver_direct_heat.cpp +++ b/SU2_CFD/src/solver_direct_heat.cpp @@ -36,6 +36,7 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CHeatFVMVariable.hpp" CHeatSolverFVM::CHeatSolverFVM(void) : CSolver() { diff --git a/SU2_CFD/src/solver_direct_mean.cpp b/SU2_CFD/src/solver_direct_mean.cpp index 701c517f8b9f..cc52d8ccbca2 100644 --- a/SU2_CFD/src/solver_direct_mean.cpp +++ b/SU2_CFD/src/solver_direct_mean.cpp @@ -37,6 +37,8 @@ #include "../include/solver_structure.hpp" #include "../../Common/include/toolboxes/printing_toolbox.hpp" +#include "../include/variables/CEulerVariable.hpp" +#include "../include/variables/CNSVariable.hpp" CEulerSolver::CEulerSolver(void) : CSolver() { diff --git a/SU2_CFD/src/solver_direct_mean_inc.cpp b/SU2_CFD/src/solver_direct_mean_inc.cpp index 9494a3d699ec..b213f997db0e 100644 --- a/SU2_CFD/src/solver_direct_mean_inc.cpp +++ b/SU2_CFD/src/solver_direct_mean_inc.cpp @@ -37,6 +37,8 @@ #include "../include/solver_structure.hpp" #include "../../Common/include/toolboxes/printing_toolbox.hpp" +#include "../include/variables/CIncEulerVariable.hpp" +#include "../include/variables/CIncNSVariable.hpp" CIncEulerSolver::CIncEulerSolver(void) : CSolver() { /*--- Basic array initialization ---*/ diff --git a/SU2_CFD/src/solver_direct_transition.cpp b/SU2_CFD/src/solver_direct_transition.cpp index 88d7c00fd830..231dacf4eb6f 100644 --- a/SU2_CFD/src/solver_direct_transition.cpp +++ b/SU2_CFD/src/solver_direct_transition.cpp @@ -36,6 +36,8 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CTransLMVariable.hpp" +#include "../include/variables/CTurbSAVariable.hpp" CTransLMSolver::CTransLMSolver(void) : CTurbSolver() {} diff --git a/SU2_CFD/src/solver_direct_turbulent.cpp b/SU2_CFD/src/solver_direct_turbulent.cpp index 68891f3937ce..33d310d7dbd7 100644 --- a/SU2_CFD/src/solver_direct_turbulent.cpp +++ b/SU2_CFD/src/solver_direct_turbulent.cpp @@ -36,6 +36,8 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CTurbSAVariable.hpp" +#include "../include/variables/CTurbSSTVariable.hpp" CTurbSolver::CTurbSolver(void) : CSolver() { diff --git a/SU2_CFD/src/solver_structure.cpp b/SU2_CFD/src/solver_structure.cpp index 2a17d1524e4b..cdc752f65884 100644 --- a/SU2_CFD/src/solver_structure.cpp +++ b/SU2_CFD/src/solver_structure.cpp @@ -36,6 +36,7 @@ */ #include "../include/solver_structure.hpp" +#include "../include/variables/CBaselineVariable.hpp" #include "../../Common/include/toolboxes/MMS/CIncTGVSolution.hpp" #include "../../Common/include/toolboxes/MMS/CInviscidVortexSolution.hpp" #include "../../Common/include/toolboxes/MMS/CMMSIncEulerSolution.hpp" diff --git a/SU2_CFD/src/variable_adjoint_mean.cpp b/SU2_CFD/src/variables/CAdjEulerVariable.cpp similarity index 89% rename from SU2_CFD/src/variable_adjoint_mean.cpp rename to SU2_CFD/src/variables/CAdjEulerVariable.cpp index 43f33b81d95a..0abc67417c8a 100644 --- a/SU2_CFD/src/variable_adjoint_mean.cpp +++ b/SU2_CFD/src/variables/CAdjEulerVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_adjoint_mean.cpp + * \file CAdjEulerVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CAdjEulerVariable.hpp" CAdjEulerVariable::CAdjEulerVariable(void) : CVariable() { @@ -48,8 +48,10 @@ CAdjEulerVariable::CAdjEulerVariable(void) : CVariable() { } -CAdjEulerVariable::CAdjEulerVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { +CAdjEulerVariable::CAdjEulerVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, + unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : + CVariable(val_nDim, val_nvar, config) { + unsigned short iVar, iDim, iMesh, nMGSmooth = 0; bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || @@ -137,8 +139,9 @@ CAdjEulerVariable::CAdjEulerVariable(su2double val_psirho, su2double *val_phi, s } -CAdjEulerVariable::CAdjEulerVariable(su2double *val_solution, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { +CAdjEulerVariable::CAdjEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CVariable(val_nDim, val_nvar, config) { + unsigned short iVar, iDim, iMesh, nMGSmooth = 0; bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || @@ -255,17 +258,3 @@ bool CAdjEulerVariable::SetPrimVar(su2double SharpEdge_Distance, bool check, CCo return RightVol; } - -CAdjNSVariable::CAdjNSVariable(void) : CAdjEulerVariable() { } - -CAdjNSVariable::CAdjNSVariable(su2double *val_solution, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config) : CAdjEulerVariable(val_solution, val_nDim, val_nvar, config) { - -} - -CAdjNSVariable::CAdjNSVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, - unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CAdjEulerVariable(val_psirho, val_phi, val_psie, val_nDim, val_nvar, config) { - -} - -CAdjNSVariable::~CAdjNSVariable(void) { } diff --git a/SU2_CFD/src/variables/CAdjNSVariable.cpp b/SU2_CFD/src/variables/CAdjNSVariable.cpp new file mode 100644 index 000000000000..b83accf92a18 --- /dev/null +++ b/SU2_CFD/src/variables/CAdjNSVariable.cpp @@ -0,0 +1,52 @@ +/*! + * \file CAdjNSVariable.cpp + * \brief Definition of the solution fields. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CAdjNSVariable.hpp" + + +CAdjNSVariable::CAdjNSVariable(void) : CAdjEulerVariable() { } + +CAdjNSVariable::CAdjNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CAdjEulerVariable(val_solution, val_nDim, val_nvar, config) { +} + +CAdjNSVariable::CAdjNSVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, + unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : + CAdjEulerVariable(val_psirho, val_phi, val_psie, val_nDim, val_nvar, config) { +} + +CAdjNSVariable::~CAdjNSVariable(void) { } diff --git a/SU2_CFD/src/variable_adjoint_turbulent.cpp b/SU2_CFD/src/variables/CAdjTurbVariable.cpp similarity index 93% rename from SU2_CFD/src/variable_adjoint_turbulent.cpp rename to SU2_CFD/src/variables/CAdjTurbVariable.cpp index cad0cfde38e2..06f9c7fe6d83 100644 --- a/SU2_CFD/src/variable_adjoint_turbulent.cpp +++ b/SU2_CFD/src/variables/CAdjTurbVariable.cpp @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CAdjTurbVariable.hpp" CAdjTurbVariable::CAdjTurbVariable(void) : CVariable() { @@ -48,8 +48,8 @@ CAdjTurbVariable::CAdjTurbVariable(void) : CVariable() { } -CAdjTurbVariable::CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { - +CAdjTurbVariable::CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CVariable(val_nDim, val_nvar, config) { unsigned short iVar; /*--- Array initialization ---*/ diff --git a/SU2_CFD/src/variable_template.cpp b/SU2_CFD/src/variables/CBaselineVariable.cpp similarity index 77% rename from SU2_CFD/src/variable_template.cpp rename to SU2_CFD/src/variables/CBaselineVariable.cpp index 973aed82d937..d292b0c9d712 100644 --- a/SU2_CFD/src/variable_template.cpp +++ b/SU2_CFD/src/variables/CBaselineVariable.cpp @@ -1,7 +1,7 @@ /*! - * \file variable_template.cpp + * \file CBaselineVariable.cpp * \brief Definition of the solution fields. - * \author F. Palacios + * \author F. Palacios, T. Economon * \version 6.2.0 "Falcon" * * The current SU2 release has been coordinated by the @@ -35,11 +35,16 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CBaselineVariable.hpp" -CTemplateVariable::CTemplateVariable(void) : CVariable() { } +CBaselineVariable::CBaselineVariable(void) : CVariable() { } -CTemplateVariable::CTemplateVariable(su2double val_Template, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { } +CBaselineVariable::CBaselineVariable(su2double *val_solution, unsigned short val_nvar, CConfig *config) : CVariable(val_nvar, config) { + + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution[iVar] = val_solution[iVar]; + +} + +CBaselineVariable::~CBaselineVariable(void) { } -CTemplateVariable::~CTemplateVariable(void) { } diff --git a/SU2_CFD/src/variable_adjoint_elasticity.cpp b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp similarity index 93% rename from SU2_CFD/src/variable_adjoint_elasticity.cpp rename to SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp index 95bbd3487659..c21c7f382c85 100644 --- a/SU2_CFD/src/variable_adjoint_elasticity.cpp +++ b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_adjoint_elasticity.cpp + * \file CDiscAdjFEAVariable.cpp * \brief Definition of the variables for FEM adjoint elastic structural problems. * \author R. Sanchez * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CDiscAdjFEAVariable.hpp" CDiscAdjFEAVariable::CDiscAdjFEAVariable() : CVariable(){ @@ -69,10 +69,10 @@ CDiscAdjFEAVariable::CDiscAdjFEAVariable() : CVariable(){ } -CDiscAdjFEAVariable::CDiscAdjFEAVariable(su2double* val_solution, unsigned short val_ndim, - unsigned short val_nvar, CConfig *config) : CVariable(val_ndim, val_nvar, config){ +CDiscAdjFEAVariable::CDiscAdjFEAVariable(su2double* val_solution, unsigned short val_ndim, unsigned short val_nvar, + CConfig *config) : CVariable(val_ndim, val_nvar, config){ - bool fsi = config->GetFSI_Simulation(); + bool fsi = config->GetFSI_Simulation(); Dynamic_Derivative = NULL; Dynamic_Derivative_n = NULL; @@ -126,10 +126,11 @@ CDiscAdjFEAVariable::CDiscAdjFEAVariable(su2double* val_solution, unsigned short } -CDiscAdjFEAVariable::CDiscAdjFEAVariable(su2double* val_solution, su2double* val_solution_accel, su2double* val_solution_vel, unsigned short val_ndim, - unsigned short val_nvar, CConfig *config) : CVariable(val_ndim, val_nvar, config){ +CDiscAdjFEAVariable::CDiscAdjFEAVariable(su2double* val_solution, su2double* val_solution_accel, su2double* val_solution_vel, + unsigned short val_ndim, unsigned short val_nvar, CConfig *config) : + CVariable(val_ndim, val_nvar, config){ - bool fsi = config->GetFSI_Simulation(); + bool fsi = config->GetFSI_Simulation(); Dynamic_Derivative = new su2double[nVar]; Dynamic_Derivative_n = new su2double[nVar]; @@ -243,4 +244,3 @@ CDiscAdjFEAVariable::~CDiscAdjFEAVariable(){ if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; } - diff --git a/SU2_CFD/src/variable_adjoint_discrete.cpp b/SU2_CFD/src/variables/CDiscAdjVariable.cpp similarity index 95% rename from SU2_CFD/src/variable_adjoint_discrete.cpp rename to SU2_CFD/src/variables/CDiscAdjVariable.cpp index 05899a2ab169..aab54d19e93c 100644 --- a/SU2_CFD/src/variable_adjoint_discrete.cpp +++ b/SU2_CFD/src/variables/CDiscAdjVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_adjoint_discrete.cpp + * \file CDiscAdjVariable.cpp * \brief Main subroutines for the discrete adjoint variable structure. * \author T. Albring * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CDiscAdjVariable.hpp" CDiscAdjVariable::CDiscAdjVariable() : CVariable() { @@ -49,8 +49,8 @@ CDiscAdjVariable::CDiscAdjVariable() : CVariable() { } -CDiscAdjVariable::CDiscAdjVariable(su2double* val_solution, unsigned short val_ndim, - unsigned short val_nvar, CConfig *config) : CVariable(val_ndim, val_nvar, config) { +CDiscAdjVariable::CDiscAdjVariable(su2double* val_solution, unsigned short val_ndim, unsigned short val_nvar, + CConfig *config) : CVariable(val_ndim, val_nvar, config) { bool dual_time = (config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND); diff --git a/SU2_CFD/src/variable_direct_mean.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp similarity index 67% rename from SU2_CFD/src/variable_direct_mean.cpp rename to SU2_CFD/src/variables/CEulerVariable.cpp index dff237bdedc0..d06207a860c7 100644 --- a/SU2_CFD/src/variable_direct_mean.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_direct_mean.cpp + * \file CEulerVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CEulerVariable.hpp" CEulerVariable::CEulerVariable(void) : CVariable() { @@ -527,281 +527,3 @@ void CEulerVariable::SetSecondaryVar(CFluidModel *FluidModel) { } -CNSVariable::CNSVariable(void) : CEulerVariable() { } - -CNSVariable::CNSVariable(su2double val_density, su2double *val_velocity, su2double val_energy, - unsigned short val_nDim, unsigned short val_nvar, - CConfig *config) : CEulerVariable(val_density, val_velocity, val_energy, val_nDim, val_nvar, config) { - - Temperature_Ref = config->GetTemperature_Ref(); - Viscosity_Ref = config->GetViscosity_Ref(); - Viscosity_Inf = config->GetViscosity_FreeStreamND(); - Prandtl_Lam = config->GetPrandtl_Lam(); - Prandtl_Turb = config->GetPrandtl_Turb(); - - inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); - Roe_Dissipation = 0.0; - Vortex_Tilting = 0.0; - Tau_Wall = -1.0; - -} - -CNSVariable::CNSVariable(su2double *val_solution, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config) : CEulerVariable(val_solution, val_nDim, val_nvar, config) { - - Temperature_Ref = config->GetTemperature_Ref(); - Viscosity_Ref = config->GetViscosity_Ref(); - Viscosity_Inf = config->GetViscosity_FreeStreamND(); - Prandtl_Lam = config->GetPrandtl_Lam(); - Prandtl_Turb = config->GetPrandtl_Turb(); - - inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); - Roe_Dissipation = 0.0; - Vortex_Tilting = 0.0; - Tau_Wall = -1.0; - -} - -CNSVariable::~CNSVariable(void) { } - -bool CNSVariable::SetVorticity(void) { - - Vorticity[0] = 0.0; Vorticity[1] = 0.0; - - Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; - - if (nDim == 3) { - Vorticity[0] = Gradient_Primitive[3][1]-Gradient_Primitive[2][2]; - Vorticity[1] = -(Gradient_Primitive[3][0]-Gradient_Primitive[1][2]); - } - - return false; - -} - -bool CNSVariable::SetStrainMag(void) { - - su2double Div; - unsigned short iDim; - - AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); - - Div = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Div += Gradient_Primitive[iDim+1][iDim]; - } - - StrainMag = 0.0; - - /*--- Add diagonal part ---*/ - - for (iDim = 0; iDim < nDim; iDim++) { - StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); - } - - /*--- Add off diagonals ---*/ - - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); - - if (nDim == 3) { - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][2] + Gradient_Primitive[3][0]), 2.0); - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[2][2] + Gradient_Primitive[3][1]), 2.0); - } - - StrainMag = sqrt(2.0*StrainMag); - - AD::SetPreaccOut(StrainMag); - AD::EndPreacc(); - - return false; - -} - -void CNSVariable::SetRoe_Dissipation_NTS(su2double val_delta, - su2double val_const_DES){ - - static const su2double cnu = pow(0.09, 1.5), - ch1 = 3.0, - ch2 = 1.0, - ch3 = 2.0, - sigma_max = 1.0; - - unsigned short iDim; - su2double Omega, Omega_2 = 0, Baux, Gaux, Lturb, Kaux, Aaux; - - AD::StartPreacc(); - AD::SetPreaccIn(Vorticity, 3); - AD::SetPreaccIn(StrainMag); - AD::SetPreaccIn(val_delta); - AD::SetPreaccIn(val_const_DES); - /*--- Density ---*/ - AD::SetPreaccIn(Solution[0]); - /*--- Laminar viscosity --- */ - AD::SetPreaccIn(Primitive[nDim+5]); - /*--- Eddy viscosity ---*/ - AD::SetPreaccIn(Primitive[nDim+6]); - - /*--- Central/upwind blending based on: - * Zhixiang Xiao, Jian Liu, Jingbo Huang, and Song Fu. "Numerical - * Dissipation Effects on Massive Separation Around Tandem Cylinders", - * AIAA Journal, Vol. 50, No. 5 (2012), pp. 1119-1136. - * https://doi.org/10.2514/1.J051299 - * ---*/ - - for (iDim = 0; iDim < 3; iDim++){ - Omega_2 += Vorticity[iDim]*Vorticity[iDim]; - } - Omega = sqrt(Omega_2); - - Baux = (ch3 * Omega * max(StrainMag, Omega)) / - max((pow(StrainMag,2)+Omega_2)*0.5, 1E-20); - Gaux = tanh(pow(Baux,4.0)); - - Kaux = max(sqrt((Omega_2 + pow(StrainMag, 2))*0.5), 0.1 * inv_TimeScale); - - const su2double nu = GetLaminarViscosity()/GetDensity(); - const su2double nu_t = GetEddyViscosity()/GetDensity(); - Lturb = sqrt((nu + nu_t)/(cnu*Kaux)); - - Aaux = ch2*max((val_const_DES*val_delta/Lturb)/Gaux - 0.5, 0.0); - - Roe_Dissipation = sigma_max * tanh(pow(Aaux, ch1)); - - AD::SetPreaccOut(Roe_Dissipation); - AD::EndPreacc(); - -} - -void CNSVariable::SetRoe_Dissipation_FD(su2double val_wall_dist){ - - /*--- Constants for Roe Dissipation ---*/ - - static const su2double k2 = pow(0.41,2.0); - - su2double uijuij = 0; - unsigned short iDim, jDim; - - AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive, nVar, nDim); - AD::SetPreaccIn(val_wall_dist); - /*--- Eddy viscosity ---*/ - AD::SetPreaccIn(Primitive[nDim+5]); - /*--- Laminar viscosity --- */ - AD::SetPreaccIn(Primitive[nDim+6]); - - for(iDim=0;iDimSetTDState_rhoe(density, staticEnergy); - - check_dens = SetDensity(); - check_press = SetPressure(FluidModel->GetPressure()); - check_sos = SetSoundSpeed(FluidModel->GetSoundSpeed2()); - check_temp = SetTemperature(FluidModel->GetTemperature()); - - /*--- Check that the solution has a physical meaning ---*/ - - if (check_dens || check_press || check_sos || check_temp) { - - /*--- Copy the old solution ---*/ - - for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; - - /*--- Recompute the primitive variables ---*/ - - SetVelocity(); // Computes velocity and velocity^2 - density = GetDensity(); - staticEnergy = GetEnergy()-0.5*Velocity2 - turb_ke; - - /*--- Check will be moved inside fluid model plus error description strings ---*/ - - FluidModel->SetTDState_rhoe(density, staticEnergy); - - SetDensity(); - SetPressure(FluidModel->GetPressure()); - SetSoundSpeed(FluidModel->GetSoundSpeed2()); - SetTemperature(FluidModel->GetTemperature()); - - RightVol = false; - - } - - /*--- Set enthalpy ---*/ - - SetEnthalpy(); // Requires pressure computation. - - /*--- Set laminar viscosity ---*/ - - SetLaminarViscosity(FluidModel->GetLaminarViscosity()); - - /*--- Set eddy viscosity ---*/ - - SetEddyViscosity(eddy_visc); - - /*--- Set thermal conductivity ---*/ - - SetThermalConductivity(FluidModel->GetThermalConductivity()); - - /*--- Set specific heat ---*/ - - SetSpecificHeatCp(FluidModel->GetCp()); - - return RightVol; - -} - -void CNSVariable::SetSecondaryVar(CFluidModel *FluidModel) { - - /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/ - - SetdPdrho_e( FluidModel->GetdPdrho_e() ); - SetdPde_rho( FluidModel->GetdPde_rho() ); - - SetdTdrho_e( FluidModel->GetdTdrho_e() ); - SetdTde_rho( FluidModel->GetdTde_rho() ); - - /*--- Compute secondary thermo-physical properties (partial derivatives...) ---*/ - - Setdmudrho_T( FluidModel->Getdmudrho_T() ); - SetdmudT_rho( FluidModel->GetdmudT_rho() ); - - Setdktdrho_T( FluidModel->Getdktdrho_T() ); - SetdktdT_rho( FluidModel->GetdktdT_rho() ); - -} - - - diff --git a/SU2_CFD/src/variables/CFEABoundVariable.cpp b/SU2_CFD/src/variables/CFEABoundVariable.cpp new file mode 100644 index 000000000000..fc2f98a29079 --- /dev/null +++ b/SU2_CFD/src/variables/CFEABoundVariable.cpp @@ -0,0 +1,99 @@ +/*! + * \file CFEABoundVariable.cpp + * \brief Definition of the variables for FEM elastic structural problems. + * \author R. Sanchez + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CFEABoundVariable.hpp" + + +CFEABoundVariable::CFEABoundVariable(void) : CFEAVariable() { + + FlowTraction = NULL; // Nodal traction due to the fluid (fsi) + Residual_Ext_Surf = NULL; // Residual component due to external surface forces + + FlowTraction_n = NULL; // Nodal traction due to the fluid (fsi) at time n (for gen-alpha methods) + Residual_Ext_Surf_n = NULL; // Residual component due to external surface forces at time n (for gen-alpha methods) + +} + +CFEABoundVariable::CFEABoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CFEAVariable(val_fea, val_nDim, val_nvar, config) { + + unsigned short iVar; + bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); + bool fsi_analysis = config->GetFSI_Simulation(); + + /*--- Surface residual ---*/ + Residual_Ext_Surf = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + Residual_Ext_Surf[iVar] = 0.0; + } + + /*--- Flow traction ---*/ + FlowTraction = NULL; + if (fsi_analysis){ + FlowTraction = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + FlowTraction[iVar] = 0.0; + } + } + + /*--- Generalized alpha integration method requires storing the old residuals ---*/ + Residual_Ext_Surf_n = NULL; + FlowTraction_n = NULL; + if (gen_alpha) { + Residual_Ext_Surf_n = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + Residual_Ext_Surf_n[iVar] = 0.0; + } + if (fsi_analysis){ + FlowTraction_n = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + FlowTraction_n[iVar] = 0.0; + } + } + } + +} + +CFEABoundVariable::~CFEABoundVariable(void) { + + if (FlowTraction != NULL) delete [] FlowTraction; + if (Residual_Ext_Surf != NULL) delete [] Residual_Ext_Surf; + + if (FlowTraction_n != NULL) delete [] FlowTraction_n; + if (Residual_Ext_Surf_n != NULL) delete [] Residual_Ext_Surf_n; + +} diff --git a/SU2_CFD/src/variable_direct_elasticity.cpp b/SU2_CFD/src/variables/CFEAVariable.cpp similarity index 75% rename from SU2_CFD/src/variable_direct_elasticity.cpp rename to SU2_CFD/src/variables/CFEAVariable.cpp index c1e5a0bcc5da..3ca5afcb8607 100644 --- a/SU2_CFD/src/variable_direct_elasticity.cpp +++ b/SU2_CFD/src/variables/CFEAVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_direct_elasticity.cpp + * \file CFEAVariable.cpp * \brief Definition of the variables for FEM elastic structural problems. * \author R. Sanchez * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CFEAVariable.hpp" CFEAVariable::CFEAVariable(void) : CVariable() { @@ -62,7 +62,8 @@ CFEAVariable::CFEAVariable(void) : CVariable() { } -CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { +CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CVariable(val_nDim, val_nvar, config) { unsigned short iVar; bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); // Nonlinear analysis. @@ -169,62 +170,3 @@ CFEAVariable::~CFEAVariable(void) { } - -CFEABoundVariable::CFEABoundVariable(void) : CFEAVariable() { - - FlowTraction = NULL; // Nodal traction due to the fluid (fsi) - Residual_Ext_Surf = NULL; // Residual component due to external surface forces - - FlowTraction_n = NULL; // Nodal traction due to the fluid (fsi) at time n (for gen-alpha methods) - Residual_Ext_Surf_n = NULL; // Residual component due to external surface forces at time n (for gen-alpha methods) - -} - -CFEABoundVariable::CFEABoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CFEAVariable(val_fea, val_nDim, val_nvar, config) { - - unsigned short iVar; - bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); - bool fsi_analysis = config->GetFSI_Simulation(); - - /*--- Surface residual ---*/ - Residual_Ext_Surf = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Residual_Ext_Surf[iVar] = 0.0; - } - - /*--- Flow traction ---*/ - FlowTraction = NULL; - if (fsi_analysis){ - FlowTraction = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - FlowTraction[iVar] = 0.0; - } - } - - /*--- Generalized alpha integration method requires storing the old residuals ---*/ - Residual_Ext_Surf_n = NULL; - FlowTraction_n = NULL; - if (gen_alpha) { - Residual_Ext_Surf_n = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Residual_Ext_Surf_n[iVar] = 0.0; - } - if (fsi_analysis){ - FlowTraction_n = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - FlowTraction_n[iVar] = 0.0; - } - } - } - -} - -CFEABoundVariable::~CFEABoundVariable(void) { - - if (FlowTraction != NULL) delete [] FlowTraction; - if (Residual_Ext_Surf != NULL) delete [] Residual_Ext_Surf; - - if (FlowTraction_n != NULL) delete [] FlowTraction_n; - if (Residual_Ext_Surf_n != NULL) delete [] Residual_Ext_Surf_n; - -} diff --git a/SU2_CFD/src/variable_direct_heat.cpp b/SU2_CFD/src/variables/CHeatFVMVariable.cpp similarity index 93% rename from SU2_CFD/src/variable_direct_heat.cpp rename to SU2_CFD/src/variables/CHeatFVMVariable.cpp index 8f98b454f32f..7e594c1bc722 100644 --- a/SU2_CFD/src/variable_direct_heat.cpp +++ b/SU2_CFD/src/variables/CHeatFVMVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_direct_heat.cpp + * \file CHeatFVMVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CHeatFVMVariable.hpp" CHeatFVMVariable::CHeatFVMVariable(void) : CVariable() { @@ -46,8 +46,8 @@ CHeatFVMVariable::CHeatFVMVariable(void) : CVariable() { } -CHeatFVMVariable::CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) -: CVariable(val_nDim, val_nvar, config) { +CHeatFVMVariable::CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CVariable(val_nDim, val_nvar, config) { unsigned short iVar, iMesh, nMGSmooth = 0; bool low_fidelity = false; diff --git a/SU2_CFD/src/variable_direct_mean_inc.cpp b/SU2_CFD/src/variables/CIncEulerVariable.cpp similarity index 73% rename from SU2_CFD/src/variable_direct_mean_inc.cpp rename to SU2_CFD/src/variables/CIncEulerVariable.cpp index ae68233aa28a..5a4463e1dc72 100644 --- a/SU2_CFD/src/variable_direct_mean_inc.cpp +++ b/SU2_CFD/src/variables/CIncEulerVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_direct_mean_inc.cpp + * \file CIncEulerVariable.cpp * \brief Definition of the variable classes for incompressible flow. * \author F. Palacios, T. Economon * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CIncEulerVariable.hpp" CIncEulerVariable::CIncEulerVariable(void) : CVariable() { @@ -59,8 +59,10 @@ CIncEulerVariable::CIncEulerVariable(void) : CVariable() { } -CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { +CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, + unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : + CVariable(val_nDim, val_nvar, config) { + unsigned short iVar, iDim, iMesh, nMGSmooth = 0; bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || @@ -188,7 +190,9 @@ CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velo } -CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { +CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CVariable(val_nDim, val_nvar, config) { + unsigned short iVar, iDim, iMesh, nMGSmooth = 0; bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || @@ -409,156 +413,3 @@ bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { return physical; } - -CIncNSVariable::CIncNSVariable(void) : CIncEulerVariable() { } - -CIncNSVariable::CIncNSVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, - unsigned short val_nDim, unsigned short val_nvar, - CConfig *config) : CIncEulerVariable(val_pressure, val_velocity, val_temperature, val_nDim, val_nvar, config) { - - DES_LengthScale = 0.0; - -} - -CIncNSVariable::CIncNSVariable(su2double *val_solution, unsigned short val_nDim, - unsigned short val_nvar, CConfig *config) : CIncEulerVariable(val_solution, val_nDim, val_nvar, config) { - - DES_LengthScale = 0.0; - -} - -CIncNSVariable::~CIncNSVariable(void) { } - -bool CIncNSVariable::SetVorticity(void) { - - Vorticity[0] = 0.0; Vorticity[1] = 0.0; - - Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; - - if (nDim == 3) { - Vorticity[0] = Gradient_Primitive[3][1]-Gradient_Primitive[2][2]; - Vorticity[1] = -(Gradient_Primitive[3][0]-Gradient_Primitive[1][2]); - } - - return false; - -} - -bool CIncNSVariable::SetStrainMag(void) { - - su2double Div; - unsigned short iDim; - - AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); - - Div = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Div += Gradient_Primitive[iDim+1][iDim]; - } - - StrainMag = 0.0; - - /*--- Add diagonal part ---*/ - - for (iDim = 0; iDim < nDim; iDim++) { - StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); - } - - /*--- Add off diagonals ---*/ - - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); - - if (nDim == 3) { - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][2] + Gradient_Primitive[3][0]), 2.0); - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[2][2] + Gradient_Primitive[3][1]), 2.0); - } - - StrainMag = sqrt(2.0*StrainMag); - - AD::SetPreaccOut(StrainMag); - AD::EndPreacc(); - - return false; - -} - - -bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) { - - unsigned short iVar; - bool check_dens = false, check_temp = false, physical = true; - - /*--- Store the density from the previous iteration. ---*/ - - Density_Old = GetDensity(); - - /*--- Set the value of the pressure ---*/ - - SetPressure(); - - /*--- Set the value of the temperature directly ---*/ - - su2double Temperature = Solution[nDim+1]; - check_temp = SetTemperature(Temperature); - - /*--- Use the fluid model to compute the new value of density. - Note that the thermodynamic pressure is constant and decoupled - from the dynamic pressure being iterated. ---*/ - - /*--- Use the fluid model to compute the new value of density. ---*/ - - FluidModel->SetTDState_T(Temperature); - - /*--- Set the value of the density ---*/ - - check_dens = SetDensity(FluidModel->GetDensity()); - - /*--- Non-physical solution found. Revert to old values. ---*/ - - if (check_dens || check_temp) { - - /*--- Copy the old solution ---*/ - - for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; - - /*--- Recompute the primitive variables ---*/ - - Temperature = Solution[nDim+1]; - SetTemperature(Temperature); - FluidModel->SetTDState_T(Temperature); - SetDensity(FluidModel->GetDensity()); - - /*--- Flag this point as non-physical. ---*/ - - physical = false; - - } - - /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ - - SetVelocity(); - - /*--- Set laminar viscosity ---*/ - - SetLaminarViscosity(FluidModel->GetLaminarViscosity()); - - /*--- Set eddy viscosity locally and in the fluid model. ---*/ - - SetEddyViscosity(eddy_visc); - FluidModel->SetEddyViscosity(eddy_visc); - - /*--- Set thermal conductivity (effective value if RANS). ---*/ - - SetThermalConductivity(FluidModel->GetThermalConductivity()); - - /*--- Set specific heats ---*/ - - SetSpecificHeatCp(FluidModel->GetCp()); - SetSpecificHeatCv(FluidModel->GetCv()); - - return physical; - -} - diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp new file mode 100644 index 000000000000..41b4e3fd198f --- /dev/null +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -0,0 +1,187 @@ +/*! + * \file CIncNSVariable.cpp + * \brief Definition of the variable classes for incompressible flow. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CIncNSVariable.hpp" + + +CIncNSVariable::CIncNSVariable(void) : CIncEulerVariable() { } + +CIncNSVariable::CIncNSVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, + unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : + CIncEulerVariable(val_pressure, val_velocity, val_temperature, val_nDim, val_nvar, config) { + DES_LengthScale = 0.0; +} + +CIncNSVariable::CIncNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, + CConfig *config) : CIncEulerVariable(val_solution, val_nDim, val_nvar, config) { + DES_LengthScale = 0.0; +} + +CIncNSVariable::~CIncNSVariable(void) { } + +bool CIncNSVariable::SetVorticity(void) { + + Vorticity[0] = 0.0; Vorticity[1] = 0.0; + + Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; + + if (nDim == 3) { + Vorticity[0] = Gradient_Primitive[3][1]-Gradient_Primitive[2][2]; + Vorticity[1] = -(Gradient_Primitive[3][0]-Gradient_Primitive[1][2]); + } + + return false; + +} + +bool CIncNSVariable::SetStrainMag(void) { + + su2double Div; + unsigned short iDim; + + AD::StartPreacc(); + AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); + + Div = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Div += Gradient_Primitive[iDim+1][iDim]; + } + + StrainMag = 0.0; + + /*--- Add diagonal part ---*/ + + for (iDim = 0; iDim < nDim; iDim++) { + StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); + } + + /*--- Add off diagonals ---*/ + + StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); + + if (nDim == 3) { + StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][2] + Gradient_Primitive[3][0]), 2.0); + StrainMag += 2.0*pow(0.5*(Gradient_Primitive[2][2] + Gradient_Primitive[3][1]), 2.0); + } + + StrainMag = sqrt(2.0*StrainMag); + + AD::SetPreaccOut(StrainMag); + AD::EndPreacc(); + + return false; + +} + + +bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) { + + unsigned short iVar; + bool check_dens = false, check_temp = false, physical = true; + + /*--- Store the density from the previous iteration. ---*/ + + Density_Old = GetDensity(); + + /*--- Set the value of the pressure ---*/ + + SetPressure(); + + /*--- Set the value of the temperature directly ---*/ + + su2double Temperature = Solution[nDim+1]; + check_temp = SetTemperature(Temperature); + + /*--- Use the fluid model to compute the new value of density. + Note that the thermodynamic pressure is constant and decoupled + from the dynamic pressure being iterated. ---*/ + + /*--- Use the fluid model to compute the new value of density. ---*/ + + FluidModel->SetTDState_T(Temperature); + + /*--- Set the value of the density ---*/ + + check_dens = SetDensity(FluidModel->GetDensity()); + + /*--- Non-physical solution found. Revert to old values. ---*/ + + if (check_dens || check_temp) { + + /*--- Copy the old solution ---*/ + + for (iVar = 0; iVar < nVar; iVar++) + Solution[iVar] = Solution_Old[iVar]; + + /*--- Recompute the primitive variables ---*/ + + Temperature = Solution[nDim+1]; + SetTemperature(Temperature); + FluidModel->SetTDState_T(Temperature); + SetDensity(FluidModel->GetDensity()); + + /*--- Flag this point as non-physical. ---*/ + + physical = false; + + } + + /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ + + SetVelocity(); + + /*--- Set laminar viscosity ---*/ + + SetLaminarViscosity(FluidModel->GetLaminarViscosity()); + + /*--- Set eddy viscosity locally and in the fluid model. ---*/ + + SetEddyViscosity(eddy_visc); + FluidModel->SetEddyViscosity(eddy_visc); + + /*--- Set thermal conductivity (effective value if RANS). ---*/ + + SetThermalConductivity(FluidModel->GetThermalConductivity()); + + /*--- Set specific heats ---*/ + + SetSpecificHeatCp(FluidModel->GetCp()); + SetSpecificHeatCv(FluidModel->GetCv()); + + return physical; + +} diff --git a/SU2_CFD/src/variables/CNSVariable.cpp b/SU2_CFD/src/variables/CNSVariable.cpp new file mode 100644 index 000000000000..38ea36f2d77a --- /dev/null +++ b/SU2_CFD/src/variables/CNSVariable.cpp @@ -0,0 +1,317 @@ +/*! + * \file CNSVariable.cpp + * \brief Definition of the solution fields. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CNSVariable.hpp" + + +CNSVariable::CNSVariable(void) : CEulerVariable() { } + +CNSVariable::CNSVariable(su2double val_density, su2double *val_velocity, su2double val_energy, + unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : + CEulerVariable(val_density, val_velocity, val_energy, val_nDim, val_nvar, config) { + + Temperature_Ref = config->GetTemperature_Ref(); + Viscosity_Ref = config->GetViscosity_Ref(); + Viscosity_Inf = config->GetViscosity_FreeStreamND(); + Prandtl_Lam = config->GetPrandtl_Lam(); + Prandtl_Turb = config->GetPrandtl_Turb(); + + inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); + Roe_Dissipation = 0.0; + Vortex_Tilting = 0.0; + Tau_Wall = -1.0; + +} + +CNSVariable::CNSVariable(su2double *val_solution, unsigned short val_nDim, + unsigned short val_nvar, CConfig *config) : + CEulerVariable(val_solution, val_nDim, val_nvar, config) { + + Temperature_Ref = config->GetTemperature_Ref(); + Viscosity_Ref = config->GetViscosity_Ref(); + Viscosity_Inf = config->GetViscosity_FreeStreamND(); + Prandtl_Lam = config->GetPrandtl_Lam(); + Prandtl_Turb = config->GetPrandtl_Turb(); + + inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); + Roe_Dissipation = 0.0; + Vortex_Tilting = 0.0; + Tau_Wall = -1.0; + +} + +CNSVariable::~CNSVariable(void) { } + +bool CNSVariable::SetVorticity(void) { + + Vorticity[0] = 0.0; Vorticity[1] = 0.0; + + Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; + + if (nDim == 3) { + Vorticity[0] = Gradient_Primitive[3][1]-Gradient_Primitive[2][2]; + Vorticity[1] = -(Gradient_Primitive[3][0]-Gradient_Primitive[1][2]); + } + + return false; + +} + +bool CNSVariable::SetStrainMag(void) { + + su2double Div; + unsigned short iDim; + + AD::StartPreacc(); + AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); + + Div = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Div += Gradient_Primitive[iDim+1][iDim]; + } + + StrainMag = 0.0; + + /*--- Add diagonal part ---*/ + + for (iDim = 0; iDim < nDim; iDim++) { + StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); + } + + /*--- Add off diagonals ---*/ + + StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); + + if (nDim == 3) { + StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][2] + Gradient_Primitive[3][0]), 2.0); + StrainMag += 2.0*pow(0.5*(Gradient_Primitive[2][2] + Gradient_Primitive[3][1]), 2.0); + } + + StrainMag = sqrt(2.0*StrainMag); + + AD::SetPreaccOut(StrainMag); + AD::EndPreacc(); + + return false; + +} + +void CNSVariable::SetRoe_Dissipation_NTS(su2double val_delta, + su2double val_const_DES){ + + static const su2double cnu = pow(0.09, 1.5), + ch1 = 3.0, + ch2 = 1.0, + ch3 = 2.0, + sigma_max = 1.0; + + unsigned short iDim; + su2double Omega, Omega_2 = 0, Baux, Gaux, Lturb, Kaux, Aaux; + + AD::StartPreacc(); + AD::SetPreaccIn(Vorticity, 3); + AD::SetPreaccIn(StrainMag); + AD::SetPreaccIn(val_delta); + AD::SetPreaccIn(val_const_DES); + /*--- Density ---*/ + AD::SetPreaccIn(Solution[0]); + /*--- Laminar viscosity --- */ + AD::SetPreaccIn(Primitive[nDim+5]); + /*--- Eddy viscosity ---*/ + AD::SetPreaccIn(Primitive[nDim+6]); + + /*--- Central/upwind blending based on: + * Zhixiang Xiao, Jian Liu, Jingbo Huang, and Song Fu. "Numerical + * Dissipation Effects on Massive Separation Around Tandem Cylinders", + * AIAA Journal, Vol. 50, No. 5 (2012), pp. 1119-1136. + * https://doi.org/10.2514/1.J051299 + * ---*/ + + for (iDim = 0; iDim < 3; iDim++){ + Omega_2 += Vorticity[iDim]*Vorticity[iDim]; + } + Omega = sqrt(Omega_2); + + Baux = (ch3 * Omega * max(StrainMag, Omega)) / + max((pow(StrainMag,2)+Omega_2)*0.5, 1E-20); + Gaux = tanh(pow(Baux,4.0)); + + Kaux = max(sqrt((Omega_2 + pow(StrainMag, 2))*0.5), 0.1 * inv_TimeScale); + + const su2double nu = GetLaminarViscosity()/GetDensity(); + const su2double nu_t = GetEddyViscosity()/GetDensity(); + Lturb = sqrt((nu + nu_t)/(cnu*Kaux)); + + Aaux = ch2*max((val_const_DES*val_delta/Lturb)/Gaux - 0.5, 0.0); + + Roe_Dissipation = sigma_max * tanh(pow(Aaux, ch1)); + + AD::SetPreaccOut(Roe_Dissipation); + AD::EndPreacc(); + +} + +void CNSVariable::SetRoe_Dissipation_FD(su2double val_wall_dist){ + + /*--- Constants for Roe Dissipation ---*/ + + static const su2double k2 = pow(0.41,2.0); + + su2double uijuij = 0; + unsigned short iDim, jDim; + + AD::StartPreacc(); + AD::SetPreaccIn(Gradient_Primitive, nVar, nDim); + AD::SetPreaccIn(val_wall_dist); + /*--- Eddy viscosity ---*/ + AD::SetPreaccIn(Primitive[nDim+5]); + /*--- Laminar viscosity --- */ + AD::SetPreaccIn(Primitive[nDim+6]); + + for(iDim=0;iDimSetTDState_rhoe(density, staticEnergy); + + check_dens = SetDensity(); + check_press = SetPressure(FluidModel->GetPressure()); + check_sos = SetSoundSpeed(FluidModel->GetSoundSpeed2()); + check_temp = SetTemperature(FluidModel->GetTemperature()); + + /*--- Check that the solution has a physical meaning ---*/ + + if (check_dens || check_press || check_sos || check_temp) { + + /*--- Copy the old solution ---*/ + + for (iVar = 0; iVar < nVar; iVar++) + Solution[iVar] = Solution_Old[iVar]; + + /*--- Recompute the primitive variables ---*/ + + SetVelocity(); // Computes velocity and velocity^2 + density = GetDensity(); + staticEnergy = GetEnergy()-0.5*Velocity2 - turb_ke; + + /*--- Check will be moved inside fluid model plus error description strings ---*/ + + FluidModel->SetTDState_rhoe(density, staticEnergy); + + SetDensity(); + SetPressure(FluidModel->GetPressure()); + SetSoundSpeed(FluidModel->GetSoundSpeed2()); + SetTemperature(FluidModel->GetTemperature()); + + RightVol = false; + + } + + /*--- Set enthalpy ---*/ + + SetEnthalpy(); // Requires pressure computation. + + /*--- Set laminar viscosity ---*/ + + SetLaminarViscosity(FluidModel->GetLaminarViscosity()); + + /*--- Set eddy viscosity ---*/ + + SetEddyViscosity(eddy_visc); + + /*--- Set thermal conductivity ---*/ + + SetThermalConductivity(FluidModel->GetThermalConductivity()); + + /*--- Set specific heat ---*/ + + SetSpecificHeatCp(FluidModel->GetCp()); + + return RightVol; + +} + +void CNSVariable::SetSecondaryVar(CFluidModel *FluidModel) { + + /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/ + + SetdPdrho_e( FluidModel->GetdPdrho_e() ); + SetdPde_rho( FluidModel->GetdPde_rho() ); + + SetdTdrho_e( FluidModel->GetdTdrho_e() ); + SetdTde_rho( FluidModel->GetdTde_rho() ); + + /*--- Compute secondary thermo-physical properties (partial derivatives...) ---*/ + + Setdmudrho_T( FluidModel->Getdmudrho_T() ); + SetdmudT_rho( FluidModel->GetdmudT_rho() ); + + Setdktdrho_T( FluidModel->Getdktdrho_T() ); + SetdktdT_rho( FluidModel->GetdktdT_rho() ); + +} + diff --git a/SU2_CFD/src/variable_direct_transition.cpp b/SU2_CFD/src/variables/CTransLMVariable.cpp similarity index 83% rename from SU2_CFD/src/variable_direct_transition.cpp rename to SU2_CFD/src/variables/CTransLMVariable.cpp index 702fd48f299e..1fc104d55837 100644 --- a/SU2_CFD/src/variable_direct_transition.cpp +++ b/SU2_CFD/src/variables/CTransLMVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_direct_transition.cpp + * \file CTransLMVariable.cpp * \brief Definition of the solution fields. * \author A. Aranake * \version 6.2.0 "Falcon" @@ -35,13 +35,13 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CTransLMVariable.hpp" CTransLMVariable::CTransLMVariable(void) : CTurbVariable() {} -CTransLMVariable::CTransLMVariable(su2double val_nu_tilde, su2double val_intermittency, su2double val_REth, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) -: CTurbVariable(val_nDim, val_nvar, config) { - +CTransLMVariable::CTransLMVariable(su2double val_nu_tilde, su2double val_intermittency, su2double val_REth, + unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : + CTurbVariable(val_nDim, val_nvar, config) { // Initialization of variables Solution[0] = val_intermittency; Solution_Old[0] = val_intermittency; Solution[1] = val_REth; Solution_Old[1] = val_REth; @@ -49,10 +49,3 @@ CTransLMVariable::CTransLMVariable(su2double val_nu_tilde, su2double val_intermi } CTransLMVariable::~CTransLMVariable(void) { } - -void CTransLMVariable::SetGammaEff() { - - /* -- Correction for separation-induced transition -- */ - Solution[0] = max(Solution[0], gamma_sep); - -} diff --git a/SU2_CFD/src/variable_direct_turbulent.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp similarity index 56% rename from SU2_CFD/src/variable_direct_turbulent.cpp rename to SU2_CFD/src/variables/CTurbSAVariable.cpp index 689e7ac57924..f8a15e2b403a 100644 --- a/SU2_CFD/src/variable_direct_turbulent.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_direct_turbulent.cpp + * \file CTurbSAVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, A. Bueno * \version 6.2.0 "Falcon" @@ -35,58 +35,13 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CTurbSAVariable.hpp" -CTurbVariable::CTurbVariable(void) : CVariable() { - - /*--- Array initialization ---*/ - HB_Source = NULL; - -} - -CTurbVariable::CTurbVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config) -: CVariable(val_nDim, val_nvar, config) { - - unsigned short iVar; - - /*--- Array initialization ---*/ - - HB_Source = NULL; - - /*--- Allocate space for the harmonic balance source terms ---*/ - - if (config->GetUnsteady_Simulation() == HARMONIC_BALANCE) { - HB_Source = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) - HB_Source[iVar] = 0.0; - } - - /*--- Always allocate the slope limiter, - and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ - - Limiter = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) - Limiter[iVar] = 0.0; - - Solution_Max = new su2double [nVar]; - Solution_Min = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Solution_Max[iVar] = 0.0; - Solution_Min[iVar] = 0.0; - } - -} - -CTurbVariable::~CTurbVariable(void) { } - -su2double CTurbVariable::GetmuT() { return muT; } - -void CTurbVariable::SetmuT(su2double val_muT) { muT = val_muT; } CTurbSAVariable::CTurbSAVariable(void) : CTurbVariable() { } -CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) -: CTurbVariable(val_nDim, val_nvar, config) { +CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned short val_nDim, + unsigned short val_nvar, CConfig *config) : CTurbVariable(val_nDim, val_nvar, config) { bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); @@ -159,78 +114,3 @@ CTurbSAVariable::~CTurbSAVariable(void) { } -CTurbSSTVariable::CTurbSSTVariable(void) : CTurbVariable() { } - -CTurbSSTVariable::CTurbSSTVariable(su2double val_kine, su2double val_omega, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, - su2double *constants, CConfig *config) -: CTurbVariable(val_nDim, val_nvar, config) { - - bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || - (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); - - /*--- Initialization of variables ---*/ - - Solution[0] = val_kine; Solution_Old[0] = val_kine; - Solution[1] = val_omega; Solution_Old[1] = val_omega; - - sigma_om2 = constants[3]; - beta_star = constants[6]; - - F1 = 1.0; - F2 = 0.0; - CDkw = 0.0; - - /*--- Initialization of eddy viscosity ---*/ - - muT = val_muT; - - /*--- Allocate and initialize solution for the dual time strategy ---*/ - - if (dual_time) { - Solution_time_n[0] = val_kine; Solution_time_n[1] = val_omega; - Solution_time_n1[0] = val_kine; Solution_time_n1[1] = val_omega; - } - -} - -CTurbSSTVariable::~CTurbSSTVariable(void) { - - if (HB_Source != NULL) delete [] HB_Source; - -} - -void CTurbSSTVariable::SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density) { - unsigned short iDim; - su2double arg2, arg2A, arg2B, arg1; - - AD::StartPreacc(); - AD::SetPreaccIn(val_viscosity); AD::SetPreaccIn(val_dist); - AD::SetPreaccIn(val_density); - AD::SetPreaccIn(Solution, nVar); - AD::SetPreaccIn(Gradient, nVar, nDim); - - /*--- Cross diffusion ---*/ - - CDkw = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - CDkw += Gradient[0][iDim]*Gradient[1][iDim]; - CDkw *= 2.0*val_density*sigma_om2/Solution[1]; - CDkw = max(CDkw, pow(10.0, -20.0)); - - /*--- F1 ---*/ - - arg2A = sqrt(Solution[0])/(beta_star*Solution[1]*val_dist+EPS*EPS); - arg2B = 500.0*val_viscosity / (val_density*val_dist*val_dist*Solution[1]+EPS*EPS); - arg2 = max(arg2A, arg2B); - arg1 = min(arg2, 4.0*val_density*sigma_om2*Solution[0] / (CDkw*val_dist*val_dist+EPS*EPS)); - F1 = tanh(pow(arg1, 4.0)); - - /*--- F2 ---*/ - - arg2 = max(2.0*arg2A, arg2B); - F2 = tanh(pow(arg2, 2.0)); - - AD::SetPreaccOut(F1); AD::SetPreaccOut(F2); AD::SetPreaccOut(CDkw); - AD::EndPreacc(); - -} diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp new file mode 100644 index 000000000000..f6dc6171e311 --- /dev/null +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -0,0 +1,115 @@ +/*! + * \file CTurbSSTVariable.cpp + * \brief Definition of the solution fields. + * \author F. Palacios, A. Bueno + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CTurbSSTVariable.hpp" + + +CTurbSSTVariable::CTurbSSTVariable(void) : CTurbVariable() { } + +CTurbSSTVariable::CTurbSSTVariable(su2double val_kine, su2double val_omega, su2double val_muT, + unsigned short val_nDim, unsigned short val_nvar, su2double *constants, + CConfig *config) : CTurbVariable(val_nDim, val_nvar, config) { + + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || + (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); + + /*--- Initialization of variables ---*/ + + Solution[0] = val_kine; Solution_Old[0] = val_kine; + Solution[1] = val_omega; Solution_Old[1] = val_omega; + + sigma_om2 = constants[3]; + beta_star = constants[6]; + + F1 = 1.0; + F2 = 0.0; + CDkw = 0.0; + + /*--- Initialization of eddy viscosity ---*/ + + muT = val_muT; + + /*--- Allocate and initialize solution for the dual time strategy ---*/ + + if (dual_time) { + Solution_time_n[0] = val_kine; Solution_time_n[1] = val_omega; + Solution_time_n1[0] = val_kine; Solution_time_n1[1] = val_omega; + } + +} + +CTurbSSTVariable::~CTurbSSTVariable(void) { + + if (HB_Source != NULL) delete [] HB_Source; + +} + +void CTurbSSTVariable::SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density) { + unsigned short iDim; + su2double arg2, arg2A, arg2B, arg1; + + AD::StartPreacc(); + AD::SetPreaccIn(val_viscosity); AD::SetPreaccIn(val_dist); + AD::SetPreaccIn(val_density); + AD::SetPreaccIn(Solution, nVar); + AD::SetPreaccIn(Gradient, nVar, nDim); + + /*--- Cross diffusion ---*/ + + CDkw = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + CDkw += Gradient[0][iDim]*Gradient[1][iDim]; + CDkw *= 2.0*val_density*sigma_om2/Solution[1]; + CDkw = max(CDkw, pow(10.0, -20.0)); + + /*--- F1 ---*/ + + arg2A = sqrt(Solution[0])/(beta_star*Solution[1]*val_dist+EPS*EPS); + arg2B = 500.0*val_viscosity / (val_density*val_dist*val_dist*Solution[1]+EPS*EPS); + arg2 = max(arg2A, arg2B); + arg1 = min(arg2, 4.0*val_density*sigma_om2*Solution[0] / (CDkw*val_dist*val_dist+EPS*EPS)); + F1 = tanh(pow(arg1, 4.0)); + + /*--- F2 ---*/ + + arg2 = max(2.0*arg2A, arg2B); + F2 = tanh(pow(arg2, 2.0)); + + AD::SetPreaccOut(F1); AD::SetPreaccOut(F2); AD::SetPreaccOut(CDkw); + AD::EndPreacc(); + +} diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp new file mode 100644 index 000000000000..452f7b7aaa40 --- /dev/null +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -0,0 +1,81 @@ +/*! + * \file CTurbVariable.cpp + * \brief Definition of the solution fields. + * \author F. Palacios, A. Bueno + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CTurbVariable.hpp" + +CTurbVariable::CTurbVariable(void) : CVariable() { + + /*--- Array initialization ---*/ + HB_Source = NULL; + +} + +CTurbVariable::CTurbVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config) +: CVariable(val_nDim, val_nvar, config) { + + unsigned short iVar; + + /*--- Array initialization ---*/ + + HB_Source = NULL; + + /*--- Allocate space for the harmonic balance source terms ---*/ + + if (config->GetUnsteady_Simulation() == HARMONIC_BALANCE) { + HB_Source = new su2double[nVar]; + for (iVar = 0; iVar < nVar; iVar++) + HB_Source[iVar] = 0.0; + } + + /*--- Always allocate the slope limiter, + and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ + + Limiter = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) + Limiter[iVar] = 0.0; + + Solution_Max = new su2double [nVar]; + Solution_Min = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + Solution_Max[iVar] = 0.0; + Solution_Min[iVar] = 0.0; + } + +} + +CTurbVariable::~CTurbVariable(void) { } + diff --git a/SU2_CFD/src/variable_structure.cpp b/SU2_CFD/src/variables/CVariable.cpp similarity index 96% rename from SU2_CFD/src/variable_structure.cpp rename to SU2_CFD/src/variables/CVariable.cpp index 16692d613a0e..b492a3822ced 100644 --- a/SU2_CFD/src/variable_structure.cpp +++ b/SU2_CFD/src/variables/CVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_structure.cpp + * \file CVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon * \version 6.2.0 "Falcon" @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/variable_structure.hpp" +#include "../../include/variables/CVariable.hpp" unsigned short CVariable::nDim = 0; @@ -455,14 +455,3 @@ void CVariable::GetResTruncError(su2double *val_trunc_error) { val_trunc_error[iVar] = Res_TruncError[iVar]; } - -CBaselineVariable::CBaselineVariable(void) : CVariable() { } - -CBaselineVariable::CBaselineVariable(su2double *val_solution, unsigned short val_nvar, CConfig *config) : CVariable(val_nvar, config) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = val_solution[iVar]; - -} - -CBaselineVariable::~CBaselineVariable(void) { } diff --git a/SU2_DEF/obj/Makefile.am b/SU2_DEF/obj/Makefile.am index 054725e43ac7..433e22006a2d 100644 --- a/SU2_DEF/obj/Makefile.am +++ b/SU2_DEF/obj/Makefile.am @@ -48,28 +48,9 @@ ___bin_SU2_DEF_SOURCES = \ ___bin_SU2_DEF_CXXFLAGS = -___bin_SU2_DEF_LDADD = ../../Common/lib/libSU2.a \ - ../../SU2_CFD/src/libSU2Core_a-output_structure.o \ - ../../SU2_CFD/src/libSU2Core_a-output_cgns.o \ - ../../SU2_CFD/src/libSU2Core_a-output_tecplot.o \ - ../../SU2_CFD/src/libSU2Core_a-output_fieldview.o \ - ../../SU2_CFD/src/libSU2Core_a-output_su2.o \ - ../../SU2_CFD/src/libSU2Core_a-output_paraview.o \ - ../../SU2_CFD/src/libSU2Core_a-solver_structure.o \ - ../../SU2_CFD/src/libSU2Core_a-variable_structure.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CVerificationSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CIncTGVSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CInviscidVortexSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CMMSIncEulerSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CMMSIncNSSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CMMSNSTwoHalfCirclesSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CMMSNSTwoHalfSpheresSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CMMSNSUnitQuadSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CMMSNSUnitQuadSolutionWallBC.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CNSUnitQuadSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CRinglebSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CTGVSolution.o \ - ../../Common/src/toolboxes/MMS/libSU2_a-CUserDefinedSolution.o +___bin_SU2_DEF_LDADD = \ + ../../SU2_CFD/obj/libSU2Core.a \ + ../../Common/lib/libSU2.a # always link to built dependencies from ./externals ___bin_SU2_DEF_CXXFLAGS += @su2_externals_INCLUDES@ diff --git a/SU2_DOT/obj/Makefile.am b/SU2_DOT/obj/Makefile.am index 0662fdfed583..5b20ae1565d5 100644 --- a/SU2_DOT/obj/Makefile.am +++ b/SU2_DOT/obj/Makefile.am @@ -58,27 +58,13 @@ su2_dot_cxx_flags = if BUILD_NORMAL su2_dot_ldadd += \ - ../../SU2_CFD/src/libSU2Core_a-solver_structure.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_a-output_structure.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_a-output_cgns.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_a-output_tecplot.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_a-output_fieldview.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_a-output_su2.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_a-output_paraview.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_a-variable_structure.$(OBJEXT) \ + ../../SU2_CFD/obj/libSU2Core.a \ ../../Common/lib/libSU2.a endif if BUILD_REVERSE su2_dot_ldadd += \ - ../../SU2_CFD/src/libSU2Core_AD_a-solver_structure.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_AD_a-output_structure.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_AD_a-output_cgns.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_AD_a-output_tecplot.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_AD_a-output_fieldview.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_AD_a-output_su2.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_AD_a-output_paraview.$(OBJEXT) \ - ../../SU2_CFD/src/libSU2Core_AD_a-variable_structure.$(OBJEXT) \ + ../../SU2_CFD/obj/libSU2Core_AD.a \ ../../Common/lib/libSU2_AD.a endif diff --git a/SU2_SOL/obj/Makefile.am b/SU2_SOL/obj/Makefile.am index 2f86186542c4..e6d5d6434679 100644 --- a/SU2_SOL/obj/Makefile.am +++ b/SU2_SOL/obj/Makefile.am @@ -48,14 +48,7 @@ ___bin_SU2_SOL_SOURCES = \ ___bin_SU2_SOL_CXXFLAGS = ___bin_SU2_SOL_LDADD = \ - ../../SU2_CFD/src/libSU2Core_a-solver_structure.o \ - ../../SU2_CFD/src/libSU2Core_a-output_structure.o \ - ../../SU2_CFD/src/libSU2Core_a-output_cgns.o \ - ../../SU2_CFD/src/libSU2Core_a-output_tecplot.o \ - ../../SU2_CFD/src/libSU2Core_a-output_fieldview.o \ - ../../SU2_CFD/src/libSU2Core_a-output_su2.o \ - ../../SU2_CFD/src/libSU2Core_a-output_paraview.o \ - ../../SU2_CFD/src/libSU2Core_a-variable_structure.o \ + ../../SU2_CFD/obj/libSU2Core.a \ ../../Common/lib/libSU2.a # always link to built dependencies from ./externals From 89722257148c4a84b7ec6827e24c3cec46d17ffb Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 30 Jun 2019 11:54:19 +0100 Subject: [PATCH 3/6] inline small non-virtual methods of CVariable --- SU2_CFD/include/variables/CVariable.hpp | 188 +++++++++++++---- SU2_CFD/src/variables/CVariable.cpp | 266 ------------------------ 2 files changed, 145 insertions(+), 309 deletions(-) diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index e195e4d2c031..a7386bafe21d 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -124,7 +124,10 @@ class CVariable { * \brief Set the value of the solution. * \param[in] val_solution - Solution of the problem. */ - void SetSolution(su2double *val_solution); + inline void SetSolution(su2double *val_solution) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution[iVar] = val_solution[iVar]; + } /*! * \overload @@ -177,7 +180,10 @@ class CVariable { * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. */ - void SetSolution_Old(su2double *val_solution_old); + inline void SetSolution_Old(su2double *val_solution_old) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_Old[iVar] = val_solution_old[iVar]; + } /*! * \overload @@ -189,76 +195,111 @@ class CVariable { /*! * \brief Set old variables to the value of the current variables. */ - void Set_OldSolution(void); + inline void Set_OldSolution(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_Old[iVar] = Solution[iVar]; + } /*! * \brief Set variables to the value of the old variables. */ - void Set_Solution(void); + inline void Set_Solution(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution[iVar] = Solution_Old[iVar]; + } /*! * \brief Set old discrete adjoint variables to the current value of the adjoint variables. */ - void Set_OldSolution_Adj(void); + inline void Set_OldSolution_Adj(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_Adj_Old[iVar] = Solution[iVar]; + } /*! * \brief Set the variable solution at time n. */ - void Set_Solution_time_n(void); + inline void Set_Solution_time_n(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_time_n[iVar] = Solution[iVar]; + } /*! * \brief Set the variable solution at time n-1. */ - void Set_Solution_time_n1(void); + inline void Set_Solution_time_n1(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_time_n1[iVar] = Solution_time_n[iVar]; + } /*! * \brief Set the variable solution at time n. */ - void Set_Solution_time_n(su2double* val_sol); + inline void Set_Solution_time_n(su2double* val_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_time_n[iVar] = val_sol[iVar]; + } /*! * \brief Set the variable solution at time n-1. */ - void Set_Solution_time_n1(su2double* val_sol); + inline void Set_Solution_time_n1(su2double* val_sol) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_time_n1[iVar] = val_sol[iVar]; + } /*! * \brief Set to zero the velocity components of the solution. */ - void SetVelSolutionZero(void); + inline void SetVelSolutionZero(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = 0.0; + } /*! * \brief Specify a vector to set the velocity components of the solution. * \param[in] val_vector - Pointer to the vector. */ - void SetVelSolutionVector(su2double *val_vector); + inline void SetVelSolutionVector(su2double *val_vector) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution[iDim+1] = val_vector[iDim]; + } /*! * \brief Set to zero velocity components of the solution. */ - void SetVelSolutionOldZero(void); + inline void SetVelSolutionOldZero(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = 0.0; + } /*! * \brief Specify a vector to set the velocity components of the old solution. * \param[in] val_vector - Pointer to the vector. */ - void SetVelSolutionOldVector(su2double *val_vector); + inline void SetVelSolutionOldVector(su2double *val_vector) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Solution_Old[iDim+1] = val_vector[iDim]; + } /*! * \brief Set to zero the solution. */ - void SetSolutionZero(void); + inline void SetSolutionZero(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; + } /*! * \brief Set to zero a particular solution. */ - void SetSolutionZero(unsigned short val_var); + inline void SetSolutionZero(unsigned short val_var) {Solution[val_var] = 0.0;} /*! * \brief Add a value to the solution. * \param[in] val_var - Number of the variable. * \param[in] val_solution - Value that we want to add to the solution. */ - void AddSolution(unsigned short val_var, su2double val_solution); + inline void AddSolution(unsigned short val_var, su2double val_solution) { + Solution[val_var] = Solution_Old[val_var] + val_solution; + } /*! * \brief A virtual member. @@ -318,8 +359,12 @@ class CVariable { * \param[in] lowerlimit - Lower value. * \param[in] upperlimit - Upper value. */ - void AddClippedSolution(unsigned short val_var, su2double val_solution, - su2double lowerlimit, su2double upperlimit); + inline void AddClippedSolution(unsigned short val_var, su2double val_solution, + su2double lowerlimit, su2double upperlimit) { + + su2double val_new = Solution_Old[val_var] + val_solution; + Solution[val_var] = min(max(val_new, lowerlimit), upperlimit); + } /*! * \brief Update the variables using a conservative format. @@ -330,9 +375,13 @@ class CVariable { * \param[in] lowerlimit - Lower value. * \param[in] upperlimit - Upper value. */ - void AddConservativeSolution(unsigned short val_var, su2double val_solution, - su2double val_density, su2double val_density_old, su2double lowerlimit, - su2double upperlimit); + inline void AddConservativeSolution(unsigned short val_var, su2double val_solution, + su2double val_density, su2double val_density_old, + su2double lowerlimit, su2double upperlimit) { + + su2double val_new = (Solution_Old[val_var]*val_density_old + val_solution)/val_density; + Solution[val_var] = min(max(val_new, lowerlimit), upperlimit); + } /*! * \brief Get the solution of the problem. @@ -362,18 +411,26 @@ class CVariable { * \brief Set the value of the old residual. * \param[in] val_residual_old - Pointer to the residual vector. */ - void SetResidual_Old(su2double *val_residual_old); + inline void SetResidual_Old(su2double *val_residual_old) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Residual_Old[iVar] = val_residual_old[iVar]; + } /*! * \brief Add a value to the summed residual vector. * \param[in] val_residual - Pointer to the residual vector. */ - void AddResidual_Sum(su2double *val_residual); + inline void AddResidual_Sum(su2double *val_residual) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Residual_Sum[iVar] += val_residual[iVar]; + } /*! * \brief Set summed residual vector to zero value. */ - void SetResidualSumZero(void); + inline void SetResidualSumZero(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Sum[iVar] = 0.0; + } /*! * \brief Set the velocity of the truncation error to zero. @@ -396,7 +453,10 @@ class CVariable { * \brief Get the value of the summed residual. * \param[in] val_residual - Pointer to the summed residual. */ - void GetResidual_Sum(su2double *val_residual); + inline void GetResidual_Sum(su2double *val_residual) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + val_residual[iVar] = Residual_Sum[iVar]; + } /*! * \brief Set auxiliar variables, we are looking for the gradient of that variable. @@ -413,7 +473,9 @@ class CVariable { /*! * \brief Set the auxiliary variable gradient to zero value. */ - void SetAuxVarGradientZero(void); + inline void SetAuxVarGradientZero(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) Grad_AuxVar[iDim] = 0.0; + } /*! * \brief Set the value of the auxiliary variable gradient. @@ -453,33 +515,43 @@ class CVariable { * \brief Add a value to the truncation error. * \param[in] val_truncation_error - Value that we want to add to the truncation error. */ - void AddRes_TruncError(su2double *val_truncation_error); + inline void AddRes_TruncError(su2double *val_truncation_error) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Res_TruncError[iVar] += val_truncation_error[iVar]; + } /*! * \brief Subtract a value to the truncation error. * \param[in] val_truncation_error - Value that we want to subtract to the truncation error. */ - void SubtractRes_TruncError(su2double *val_truncation_error); + inline void SubtractRes_TruncError(su2double *val_truncation_error) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Res_TruncError[iVar] -= val_truncation_error[iVar]; + } /*! * \brief Set the truncation error to zero. */ - void SetRes_TruncErrorZero(void); + inline void SetRes_TruncErrorZero(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) Res_TruncError[iVar] = 0.0; + } /*! * \brief Set the truncation error to zero. */ - void SetVal_ResTruncError_Zero(unsigned short val_var); + inline void SetVal_ResTruncError_Zero(unsigned short val_var) {Res_TruncError[val_var] = 0.0;} /*! * \brief Set the velocity of the truncation error to zero. */ - void SetVel_ResTruncError_Zero(void); + inline void SetVel_ResTruncError_Zero(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) Res_TruncError[iDim+1] = 0.0; + } /*! * \brief Set the velocity of the truncation error to zero. */ - void SetEnergy_ResTruncError_Zero(void); + inline void SetEnergy_ResTruncError_Zero(void) {Res_TruncError[nDim+1] = 0.0;} /*! * \brief Get the truncation error. @@ -491,13 +563,20 @@ class CVariable { * \brief Get the truncation error. * \param[in] val_trunc_error - Pointer to the truncation error. */ - void GetResTruncError(su2double *val_trunc_error); + inline void GetResTruncError(su2double *val_trunc_error) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + val_trunc_error[iVar] = Res_TruncError[iVar]; + } /*! * \brief Set the gradient of the solution. * \param[in] val_gradient - Gradient of the solution. */ - void SetGradient(su2double **val_gradient); + inline void SetGradient(su2double **val_gradient) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Gradient[iVar][iDim] = val_gradient[iVar][iDim]; + } /*! * \overload @@ -510,7 +589,11 @@ class CVariable { /*! * \brief Set to zero the gradient of the solution. */ - void SetGradientZero(void); + inline void SetGradientZero(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Gradient[iVar][iDim] = 0.0; + } /*! * \brief Add val_value to the solution gradient. @@ -553,7 +636,11 @@ class CVariable { /*! * \brief Set to zero the Rmatrix for least squares gradient calculations. */ - void SetRmatrixZero(void); + inline void SetRmatrixZero(void) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + for (unsigned short jDim = 0; jDim < nDim; jDim++) + Rmatrix[iDim][jDim] = 0.0; + } /*! * \brief Add val_value to the Rmatrix for least squares gradient calculations. @@ -842,32 +929,45 @@ class CVariable { * \brief Add the value of the undivided laplacian of the solution. * \param[in] val_und_lapl - Value of the undivided solution. */ - void AddUnd_Lapl(su2double *val_und_lapl); + inline void AddUnd_Lapl(su2double *val_und_lapl) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Undivided_Laplacian[iVar] += val_und_lapl[iVar]; + } /*! * \brief Subtract the value of the undivided laplacian of the solution. * \param[in] val_und_lapl - Value of the undivided solution. */ - void SubtractUnd_Lapl(su2double *val_und_lapl); + inline void SubtractUnd_Lapl(su2double *val_und_lapl) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Undivided_Laplacian[iVar] -= val_und_lapl[iVar]; + } /*! * \brief Subtract the value of the undivided laplacian of the solution. * \param[in] val_var - Variable of the undivided laplacian. * \param[in] val_und_lapl - Value of the undivided solution. */ - void SubtractUnd_Lapl(unsigned short val_var, su2double val_und_lapl); + inline void SubtractUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { + Undivided_Laplacian[val_var] -= val_und_lapl; + } /*! * \brief Set the undivided laplacian of the solution to zero. */ - void SetUnd_LaplZero(void); + inline void SetUnd_LaplZero(void) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Undivided_Laplacian[iVar] = 0.0; + } /*! * \brief Set a value to the undivided laplacian. * \param[in] val_var - Variable of the undivided laplacian. * \param[in] val_und_lapl - Value of the undivided laplacian. */ - void SetUnd_Lapl(unsigned short val_var, su2double val_und_lapl); + inline void SetUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { + Undivided_Laplacian[val_var] = val_und_lapl; + } /*! * \brief Get the undivided laplacian of the solution. @@ -1979,8 +2079,10 @@ class CVariable { * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. */ - virtual void SetSolution_time_n(su2double *val_solution_time_n); - + inline virtual void SetSolution_time_n(su2double *val_solution_time_n) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) + Solution_time_n[iVar] = val_solution_time_n[iVar]; + } /*! * \brief Set the value of the velocity (Structural Analysis). diff --git a/SU2_CFD/src/variables/CVariable.cpp b/SU2_CFD/src/variables/CVariable.cpp index b492a3822ced..9b147fb6799a 100644 --- a/SU2_CFD/src/variables/CVariable.cpp +++ b/SU2_CFD/src/variables/CVariable.cpp @@ -189,269 +189,3 @@ CVariable::~CVariable(void) { } } - -void CVariable::AddUnd_Lapl(su2double *val_und_lapl) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian[iVar] += val_und_lapl[iVar]; -} - -void CVariable::SubtractUnd_Lapl(su2double *val_und_lapl) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian[iVar] -= val_und_lapl[iVar]; -} - -void CVariable::SubtractUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { - Undivided_Laplacian[val_var] -= val_und_lapl; -} - -void CVariable::SetUnd_LaplZero(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian[iVar] = 0.0; - -} - -void CVariable::SetUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { - - Undivided_Laplacian[val_var] = val_und_lapl; - -} - -void CVariable::SetSolution(su2double *val_solution) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = val_solution[iVar]; - -} - -void CVariable::Set_OldSolution(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_Old[iVar] = Solution[iVar]; - -} - -void CVariable::Set_OldSolution_Adj(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_Adj_Old[iVar] = Solution[iVar]; - -} - - -void CVariable::AddSolution(unsigned short val_var, su2double val_solution) { - - Solution[val_var] = Solution_Old[val_var] + val_solution; - -} - -void CVariable::AddClippedSolution(unsigned short val_var, su2double val_solution, - su2double lowerlimit, su2double upperlimit) { - - Solution[val_var] = min(max((Solution_Old[val_var] + val_solution), lowerlimit), upperlimit); - -} - -void CVariable::AddConservativeSolution(unsigned short val_var, su2double val_solution, - su2double val_density, su2double val_density_old, su2double lowerlimit, su2double upperlimit) { - - Solution[val_var] = min(max((Solution_Old[val_var]*val_density_old + val_solution)/val_density, - lowerlimit), upperlimit); - -} - -void CVariable::Set_Solution(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; - -} - -void CVariable::Set_Solution_time_n(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n[iVar] = Solution[iVar]; - -} - -void CVariable::Set_Solution_time_n1(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n1[iVar] = Solution_time_n[iVar]; - -} - -void CVariable::Set_Solution_time_n(su2double *val_sol) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n[iVar] = val_sol[iVar]; - -} - -void CVariable::Set_Solution_time_n1(su2double *val_sol) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n1[iVar] = val_sol[iVar]; - -} - -void CVariable::AddRes_TruncError(su2double *val_truncation_error) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Res_TruncError[iVar] += val_truncation_error[iVar]; - -} - -void CVariable::SubtractRes_TruncError(su2double *val_truncation_error) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Res_TruncError[iVar] -= val_truncation_error[iVar]; - -} - -void CVariable::SetResidual_Old(su2double *val_residual_old) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Residual_Old[iVar] = val_residual_old[iVar]; - -} - -void CVariable::SetSolution_Old(su2double *val_solution_old) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_Old[iVar] = val_solution_old[iVar]; - -} - -void CVariable::SetSolution_time_n(su2double *val_solution_time_n) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n[iVar] = val_solution_time_n[iVar]; - -} - -void CVariable::AddResidual_Sum(su2double *val_residual) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Residual_Sum[iVar] += val_residual[iVar]; - -} - -void CVariable::SetVel_ResTruncError_Zero(void) { - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Res_TruncError[iDim+1] = 0.0; - -} - -void CVariable::SetEnergy_ResTruncError_Zero(void) { - - Res_TruncError[nDim+1] = 0.0; - -} - -void CVariable::SetVelSolutionZero(void) { - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iDim+1] = 0.0; - -} - -void CVariable::SetVelSolutionVector(su2double *val_vector) { - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iDim+1] = val_vector[iDim]; - -} - -void CVariable::SetVelSolutionOldZero(void) { - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution_Old[iDim+1] = 0.0; - -} - -void CVariable::SetVelSolutionOldVector(su2double *val_vector) { - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution_Old[iDim+1] = val_vector[iDim]; - -} - -void CVariable::SetSolutionZero(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = 0.0; - -} - -void CVariable::SetSolutionZero(unsigned short val_var) { - - Solution[val_var] = 0.0; - -} - -void CVariable::SetResidualSumZero(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Residual_Sum[iVar] = 0.0; - -} - -void CVariable::SetGradientZero(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Gradient[iVar][iDim] = 0.0; - -} - -void CVariable::SetAuxVarGradientZero(void) { - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Grad_AuxVar[iDim] = 0.0; - -} - -void CVariable::SetGradient(su2double **val_gradient) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Gradient[iVar][iDim] = val_gradient[iVar][iDim]; - -} - -void CVariable::SetRmatrixZero(void) { - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - for (unsigned short jDim = 0; jDim < nDim; jDim++) - Rmatrix[iDim][jDim] = 0.0; - -} - -void CVariable::SetRes_TruncErrorZero(void) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Res_TruncError[iVar] = 0.0; - -} - -void CVariable::SetVal_ResTruncError_Zero(unsigned short val_var) { - - Res_TruncError[val_var] = 0.0; - -} - -void CVariable::GetResidual_Sum(su2double *val_residual) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - val_residual[iVar] = Residual_Sum[iVar]; - -} - -void CVariable::GetResTruncError(su2double *val_trunc_error) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) - val_trunc_error[iVar] = Res_TruncError[iVar]; - -} From ce83886848fa8dece2d8dcb8ba63a7528fa1cd55 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Tue, 2 Jul 2019 09:12:05 +0100 Subject: [PATCH 4/6] strip trailing white spaces --- .../include/variables/CAdjEulerVariable.hpp | 26 +- SU2_CFD/include/variables/CAdjNSVariable.hpp | 44 +- .../include/variables/CAdjTurbVariable.hpp | 26 +- .../include/variables/CBaselineVariable.hpp | 8 +- .../include/variables/CDiscAdjFEAVariable.hpp | 10 +- .../include/variables/CDiscAdjVariable.hpp | 66 +- SU2_CFD/include/variables/CEulerVariable.hpp | 126 ++-- .../include/variables/CFEABoundVariable.hpp | 8 +- SU2_CFD/include/variables/CFEAVariable.hpp | 146 ++-- .../include/variables/CHeatFVMVariable.hpp | 8 +- .../include/variables/CIncEulerVariable.hpp | 82 +- SU2_CFD/include/variables/CIncNSVariable.hpp | 34 +- SU2_CFD/include/variables/CNSVariable.hpp | 68 +- .../include/variables/CTransLMVariable.hpp | 14 +- SU2_CFD/include/variables/CTurbSAVariable.hpp | 20 +- .../include/variables/CTurbSSTVariable.hpp | 14 +- SU2_CFD/include/variables/CTurbVariable.hpp | 10 +- SU2_CFD/include/variables/CVariable.hpp | 714 +++++++++--------- SU2_CFD/src/variables/CAdjEulerVariable.cpp | 92 +-- SU2_CFD/src/variables/CAdjTurbVariable.cpp | 20 +- SU2_CFD/src/variables/CBaselineVariable.cpp | 4 +- SU2_CFD/src/variables/CDiscAdjVariable.cpp | 2 +- SU2_CFD/src/variables/CEulerVariable.cpp | 178 ++--- SU2_CFD/src/variables/CFEAVariable.cpp | 50 +- SU2_CFD/src/variables/CHeatFVMVariable.cpp | 4 +- SU2_CFD/src/variables/CIncEulerVariable.cpp | 114 +-- SU2_CFD/src/variables/CIncNSVariable.cpp | 56 +- SU2_CFD/src/variables/CNSVariable.cpp | 124 +-- SU2_CFD/src/variables/CTransLMVariable.cpp | 2 +- SU2_CFD/src/variables/CTurbSAVariable.cpp | 36 +- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 34 +- SU2_CFD/src/variables/CTurbVariable.cpp | 18 +- SU2_CFD/src/variables/CVariable.cpp | 36 +- 33 files changed, 1097 insertions(+), 1097 deletions(-) diff --git a/SU2_CFD/include/variables/CAdjEulerVariable.hpp b/SU2_CFD/include/variables/CAdjEulerVariable.hpp index 2669e6c6e01b..c03a070d4965 100644 --- a/SU2_CFD/include/variables/CAdjEulerVariable.hpp +++ b/SU2_CFD/include/variables/CAdjEulerVariable.hpp @@ -54,12 +54,12 @@ class CAdjEulerVariable : public CVariable { su2double *HB_Source; /*!< \brief Harmonic balance source term. */ bool incompressible; public: - + /*! * \brief Constructor of the class. */ CAdjEulerVariable(void); - + /*! * \overload * \param[in] val_psirho - Value of the adjoint density (initialization value). @@ -70,7 +70,7 @@ class CAdjEulerVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CAdjEulerVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \overload * \param[in] val_solution - Pointer to the adjoint value (initialization value). @@ -79,29 +79,29 @@ class CAdjEulerVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CAdjEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ virtual ~CAdjEulerVariable(void); - + /*! * \brief Set all the primitive variables for compressible flows. */ bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config); - + /*! * \brief Set the value of the adjoint velocity. * \param[in] val_phi - Value of the adjoint velocity. */ inline void SetPhi_Old(su2double *val_phi) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1]=val_phi[iDim]; }; - + /*! * \brief Set the value of the force projection vector. * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. */ inline void SetForceProj_Vector(su2double *val_ForceProj_Vector) {for (unsigned short iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = val_ForceProj_Vector[iDim]; } - + /*! * \brief Set the value of the objective function source. * \param[in] val_ObjFuncSource - Pointer to the objective function source. @@ -115,32 +115,32 @@ class CAdjEulerVariable : public CVariable { * \param[in] val_IntBoundary_Jump - Pointer to the interior boundary jump vector. */ inline void SetIntBoundary_Jump(su2double *val_IntBoundary_Jump) {for (unsigned short iVar = 0; iVar < nVar; iVar++) IntBoundary_Jump[iVar] = val_IntBoundary_Jump[iVar]; } - + /*! * \brief Get the value of the force projection vector. * \return Pointer to the force projection vector. */ inline su2double *GetForceProj_Vector(void) {return ForceProj_Vector; } - + /*! * \brief Get the value of the objective function source. * \param[in] val_SetObjFuncSource - Pointer to the objective function source. */ inline su2double *GetObjFuncSource(void) {return ObjFuncSource; } - + /*! * \brief Get the value of the force projection vector. * \return Pointer to the force projection vector. */ inline su2double *GetIntBoundary_Jump(void) {return IntBoundary_Jump; } - + /*! * \brief Set the harmonic balance source term. * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the harmonic balance source term. for the index val_var. */ inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } - + /*! * \brief Get the harmonic balance source term. * \param[in] val_var - Index of the variable. diff --git a/SU2_CFD/include/variables/CAdjNSVariable.hpp b/SU2_CFD/include/variables/CAdjNSVariable.hpp index 3fa469a1b1b9..aaad126197e5 100644 --- a/SU2_CFD/include/variables/CAdjNSVariable.hpp +++ b/SU2_CFD/include/variables/CAdjNSVariable.hpp @@ -39,73 +39,73 @@ #include "CAdjEulerVariable.hpp" -/*! +/*! * \class CAdjNSVariable * \brief Main class for defining the variables of the adjoint Navier-Stokes solver. * \ingroup Navier_Stokes_Equations * \author F. Palacios */ -class CAdjNSVariable : public CAdjEulerVariable { +class CAdjNSVariable : public CAdjEulerVariable { private: - + public: - + /*! - * \brief Constructor of the class. - */ + * \brief Constructor of the class. + */ CAdjNSVariable(void); - + /*! * \overload * \param[in] val_psirho - Value of the adjoint density (initialization value). * \param[in] val_phi - Value of the adjoint velocity (initialization value). * \param[in] val_psie - Value of the adjoint energy (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nDim - Number of dimensions of the problem. * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ + * \param[in] config - Definition of the particular problem. + */ CAdjNSVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \overload * \param[in] val_solution - Pointer to the adjoint value (initialization value). * \param[in] val_nDim - Number of dimensions of the problem. * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. + * \param[in] config - Definition of the particular problem. */ CAdjNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! - * \brief Destructor of the class. - */ + * \brief Destructor of the class. + */ ~CAdjNSVariable(void); - + /*! * \brief Set the value of the adjoint velocity. * \param[in] val_phi - Value of the adjoint velocity. - */ + */ inline void SetPhi_Old(su2double *val_phi) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = val_phi[iDim]; }; - + /*! * \brief Set the value of the force projection vector. * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. */ inline void SetForceProj_Vector(su2double *val_ForceProj_Vector) {for (unsigned short iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = val_ForceProj_Vector[iDim]; } - + /*! * \brief Get the value of the force projection vector. * \return Pointer to the force projection vector. */ inline su2double *GetForceProj_Vector(void) {return ForceProj_Vector; } - + /*! * \brief Set the value of the force projection vector on the solution vector. */ inline void SetVelSolutionOldDVector(void) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = ForceProj_Vector[iDim]; }; - + /*! * \brief Set the value of the force projection vector on the old solution vector. */ inline void SetVelSolutionDVector(void) {for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = ForceProj_Vector[iDim]; }; - + }; diff --git a/SU2_CFD/include/variables/CAdjTurbVariable.hpp b/SU2_CFD/include/variables/CAdjTurbVariable.hpp index d16264763870..9aae546b341f 100644 --- a/SU2_CFD/include/variables/CAdjTurbVariable.hpp +++ b/SU2_CFD/include/variables/CAdjTurbVariable.hpp @@ -39,7 +39,7 @@ #include "CVariable.hpp" -/*! +/*! * \class CAdjTurbVariable * \brief Main class for defining the variables of the adjoint turbulence model. * \ingroup Turbulence_Model @@ -53,28 +53,28 @@ class CAdjTurbVariable : public CVariable { su2double **dFT_dUTvar; /*!< \brief Sensitivity of boundary flux to mean flow and turbulence vars. */ su2double *EddyViscSens; /*!< \brief Eddy Viscosity Sensitivity. */ - + public: - + /*! - * \brief Constructor of the class. - */ + * \brief Constructor of the class. + */ CAdjTurbVariable(void); - + /*! * \overload * \param[in] val_psinu_inf - Value of the adjoint turbulence variable at the infinity (initialization value). * \param[in] val_nDim - Number of dimensions of the problem. * \param[in] val_nvar - Number of variables of the problem. - * \param[in] config - Definition of the particular problem. - */ + * \param[in] config - Definition of the particular problem. + */ CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! - * \brief Destructor of the class. - */ + * \brief Destructor of the class. + */ ~CAdjTurbVariable(void); - + /*! * \brief Set the Eddy Viscosity Sensitivity of the problem. * \param[in] val_EddyViscSens - Eddy Viscosity Sensitivity. @@ -82,7 +82,7 @@ class CAdjTurbVariable : public CVariable { inline void SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar) { for (unsigned short iVar = 0; iVar < numTotalVar; iVar++) EddyViscSens[iVar] = val_EddyViscSens[iVar]; } - + /*! * \brief Get the Eddy Viscosity Sensitivity of the problem. * \return Pointer to the Eddy Viscosity Sensitivity. diff --git a/SU2_CFD/include/variables/CBaselineVariable.hpp b/SU2_CFD/include/variables/CBaselineVariable.hpp index 6ae54ed24b3c..9f52d8c23e0b 100644 --- a/SU2_CFD/include/variables/CBaselineVariable.hpp +++ b/SU2_CFD/include/variables/CBaselineVariable.hpp @@ -46,12 +46,12 @@ */ class CBaselineVariable : public CVariable { public: - + /*! * \brief Constructor of the class. */ CBaselineVariable(void); - + /*! * \overload * \param[in] val_solution - Pointer to the flow value (initialization value). @@ -59,10 +59,10 @@ class CBaselineVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CBaselineVariable(su2double *val_solution, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ virtual ~CBaselineVariable(void); - + }; diff --git a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp index 7cd9504026e4..f43f22c645df 100644 --- a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp @@ -152,11 +152,11 @@ class CDiscAdjFEAVariable : public CVariable { inline void SetSolution_Vel_Direct(su2double *val_solution_direct) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Direct_Vel[iVar] = val_solution_direct[iVar]; } - + inline void SetSolution_Accel_Direct(su2double *val_solution_direct) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Direct_Accel[iVar] = val_solution_direct[iVar]; } - + inline su2double* GetSolution_Direct() {return Solution_Direct; } inline su2double* GetSolution_Vel_Direct() {return Solution_Direct_Vel; } @@ -227,7 +227,7 @@ class CDiscAdjFEAVariable : public CVariable { inline void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = val_solution_accel_time_n[iVar]; } - + /*! * \brief Set the value of the adjoint velocity (Structural Analysis) at time n. * \param[in] val_solution_old - Pointer to the residual vector. @@ -235,7 +235,7 @@ class CDiscAdjFEAVariable : public CVariable { inline void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = val_solution_vel_time_n[iVar]; } - + /*! * \brief Set the value of the old acceleration (Structural Analysis - adjoint). * \param[in] val_solution - Old solution of the problem (acceleration). @@ -283,7 +283,7 @@ class CDiscAdjFEAVariable : public CVariable { /*! * \brief Set the value of the adjoint solution in the previous BGS subiteration. */ - inline void Set_BGSSolution_k(void) { + inline void Set_BGSSolution_k(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_BGS_k[iDim] = Solution_BGS[iDim]; } diff --git a/SU2_CFD/include/variables/CDiscAdjVariable.hpp b/SU2_CFD/include/variables/CDiscAdjVariable.hpp index d63354c0791d..a99d40f77696 100644 --- a/SU2_CFD/include/variables/CDiscAdjVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjVariable.hpp @@ -51,30 +51,30 @@ class CDiscAdjVariable : public CVariable { su2double* Solution_Direct; su2double* DualTime_Derivative; su2double* DualTime_Derivative_n; - + su2double* Cross_Term_Derivative; su2double* Geometry_CrossTerm_Derivative; su2double* Geometry_CrossTerm_Derivative_Flow; - + su2double* Solution_Geometry; su2double* Solution_Geometry_Old; su2double* Geometry_Direct; - + su2double* Solution_BGS; su2double* Solution_BGS_k; su2double* Solution_Geometry_BGS_k; - + public: /*! * \brief Constructor of the class. */ CDiscAdjVariable(void); - + /*! * \brief Destructor of the class. */ ~CDiscAdjVariable(void); - + /*! * \overload * \param[in] val_solution - Pointer to the adjoint value (initialization value). @@ -83,36 +83,36 @@ class CDiscAdjVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CDiscAdjVariable(su2double *val_solution, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Set the sensitivity at the node * \param[in] iDim - spacial component * \param[in] val - value of the Sensitivity */ inline void SetSensitivity(unsigned short iDim, su2double val) {Sensitivity[iDim] = val;} - + /*! * \brief Get the Sensitivity at the node * \param[in] iDim - spacial component * \return value of the Sensitivity */ inline su2double GetSensitivity(unsigned short iDim) {return Sensitivity[iDim];} - + inline void SetDual_Time_Derivative(unsigned short iVar, su2double der) {DualTime_Derivative[iVar] = der;} - + inline void SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {DualTime_Derivative_n[iVar] = der;} - + inline su2double GetDual_Time_Derivative(unsigned short iVar) {return DualTime_Derivative[iVar];} - + inline su2double GetDual_Time_Derivative_n(unsigned short iVar) {return DualTime_Derivative_n[iVar];} - + inline void SetSolution_Direct(su2double *val_solution_direct) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Direct[iVar] = val_solution_direct[iVar]; } - + inline su2double* GetSolution_Direct() {return Solution_Direct; } - + /*! * \brief Set the restart geometry (coordinate of the converged solution) * \param[in] val_geometry_direct - Value of the restart coordinate. @@ -121,26 +121,26 @@ class CDiscAdjVariable : public CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Geometry_Direct[iDim] = val_geometry_direct[iDim]; } - + /*! * \brief Get the restart geometry (coordinate of the converged solution). * \return Pointer to the restart coordinate vector. */ inline su2double *GetGeometry_Direct(void) {return Geometry_Direct;} - + /*! * \brief Get the restart geometry (coordinate of the converged solution). * \return Coordinate val_dim of the geometry_direct vector. */ inline su2double GetGeometry_Direct(unsigned short val_dim) {return Geometry_Direct[val_dim]; } - + /*! * \brief Get the geometry solution. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline su2double GetSolution_Geometry(unsigned short val_var) {return Solution_Geometry[val_var];} - + /*! * \brief Set the value of the mesh solution (adjoint). * \param[in] val_solution_geometry - Solution of the problem (acceleration). @@ -149,7 +149,7 @@ class CDiscAdjVariable : public CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Geometry[iDim] = val_solution_geometry[iDim]; } - + /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). * \param[in] val_solution_geometry - Solution of the problem (acceleration). @@ -157,33 +157,33 @@ class CDiscAdjVariable : public CVariable { inline void SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry) { Solution_Geometry[val_var] = val_solution_geometry; } - + /*! * \brief A virtual member. Get the geometry solution. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return Geometry_CrossTerm_Derivative[val_var];} - + /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). * \param[in] der - cross term derivative. */ inline void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) {Geometry_CrossTerm_Derivative[iDim] = der;} - + /*! * \brief Get the mesh cross term derivative from the flow solution. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) {return Geometry_CrossTerm_Derivative_Flow[val_var];} - + /*! * \brief Set the value of the mesh cross term derivative from the flow solution (adjoint). * \param[in] der - cross term derivative. */ inline void SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der) {Geometry_CrossTerm_Derivative_Flow[iDim] = der;} - + /*! * \brief Set the value of the mesh solution (adjoint). * \param[in] val_solution - Solution of the problem (acceleration). @@ -192,31 +192,31 @@ class CDiscAdjVariable : public CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Geometry_Old[iDim] = Solution_Geometry[iDim]; } - + /*! * \brief Get the value of the old geometry solution (adjoint). * \param[out] val_solution - old adjoint solution for coordinate iDim */ inline su2double Get_OldSolution_Geometry(unsigned short iDim) {return Solution_Geometry_Old[iDim];} - + /*! * \brief Set the value of the adjoint solution in the current BGS subiteration. */ inline void Set_BGSSolution(unsigned short iDim, su2double val_solution) {Solution_BGS[iDim] = val_solution;} - + /*! * \brief Set the value of the adjoint solution in the previous BGS subiteration. */ - inline void Set_BGSSolution_k(void) { + inline void Set_BGSSolution_k(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_BGS_k[iVar] = Solution_BGS[iVar]; } - + /*! * \brief Get the value of the adjoint solution in the previous BGS subiteration. * \param[out] val_solution - adjoint solution in the previous BGS subiteration. */ inline su2double Get_BGSSolution(unsigned short iDim) {return Solution_BGS[iDim];} - + /*! * \brief Get the value of the adjoint solution in the previous BGS subiteration. * \param[out] val_solution - adjoint solution in the previous BGS subiteration. @@ -226,7 +226,7 @@ class CDiscAdjVariable : public CVariable { /*! * \brief Set the value of the adjoint geometry solution in the previous BGS subiteration. */ - inline void Set_BGSSolution_Geometry(void) { + inline void Set_BGSSolution_Geometry(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Geometry_BGS_k[iDim] = Solution_Geometry[iDim]; } @@ -241,7 +241,7 @@ class CDiscAdjVariable : public CVariable { * \brief Set the contribution of crossed terms into the derivative. */ inline void SetCross_Term_Derivative(unsigned short iVar, su2double der) {Cross_Term_Derivative[iVar] = der; } - + /*! * \brief Get the contribution of crossed terms into the derivative. */ diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index badf79975c08..cf23d4b39007 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -52,15 +52,15 @@ class CEulerVariable : public CVariable { su2double Precond_Beta; /*!< \brief Low Mach number preconditioner value, Beta. */ su2double *WindGust; /*! < \brief Wind gust value */ su2double *WindGustDer; /*! < \brief Wind gust derivatives value */ - + /*--- Primitive variable definition ---*/ - + su2double *Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ su2double **Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ su2double *Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ - + /*--- Secondary variable definition ---*/ - + su2double *Secondary; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ su2double **Gradient_Secondary; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ su2double *Limiter_Secondary; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ @@ -71,14 +71,14 @@ class CEulerVariable : public CVariable { /*--- Old solution container for BGS iterations ---*/ su2double* Solution_BGS_k; - + public: - + /*! * \brief Constructor of the class. */ CEulerVariable(void); - + /*! * \overload * \param[in] val_density - Value of the flow density (initialization value). @@ -90,7 +90,7 @@ class CEulerVariable : public CVariable { */ CEulerVariable(su2double val_density, su2double *val_velocity, su2double val_energy, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \overload * \param[in] val_solution - Pointer to the flow value (initialization value). @@ -99,7 +99,7 @@ class CEulerVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ @@ -131,7 +131,7 @@ class CEulerVariable : public CVariable { * \brief Set to zero the gradient of the primitive variables. */ void SetGradient_PrimitiveZero(unsigned short val_primvar); - + /*! * \brief Add val_value to the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -139,7 +139,7 @@ class CEulerVariable : public CVariable { * \param[in] val_value - Value to add to the gradient of the primitive variables. */ inline void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] += val_value; } - + /*! * \brief Subtract val_value to the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -147,7 +147,7 @@ class CEulerVariable : public CVariable { * \param[in] val_value - Value to subtract to the gradient of the primitive variables. */ inline void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] -= val_value; } - + /*! * \brief Get the value of the primitive variables gradient. * \param[in] val_var - Index of the variable. @@ -155,14 +155,14 @@ class CEulerVariable : public CVariable { * \return Value of the primitive variables gradient. */ inline su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) {return Gradient_Primitive[val_var][val_dim]; } - + /*! * \brief Get the value of the primitive variables gradient. * \param[in] val_var - Index of the variable. * \return Value of the primitive variables gradient. */ inline su2double GetLimiter_Primitive(unsigned short val_var) {return Limiter_Primitive[val_var]; } - + /*! * \brief Set the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -170,31 +170,31 @@ class CEulerVariable : public CVariable { * \param[in] val_value - Value of the gradient. */ inline void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] = val_value; } - + /*! * \brief Set the gradient of the primitive variables. * \param[in] val_var - Index of the variable. * \param[in] val_value - Value of the gradient. */ inline void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {Limiter_Primitive[val_var] = val_value; } - + /*! * \brief Get the value of the primitive variables gradient. * \return Value of the primitive variables gradient. */ inline su2double **GetGradient_Primitive(void) {return Gradient_Primitive; } - + /*! * \brief Get the value of the primitive variables gradient. * \return Value of the primitive variables gradient. */ inline su2double *GetLimiter_Primitive(void) {return Limiter_Primitive; } - + /*! * \brief Set to zero the gradient of the primitive variables. */ void SetGradient_SecondaryZero(unsigned short val_secondaryvar); - + /*! * \brief Add val_value to the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -202,7 +202,7 @@ class CEulerVariable : public CVariable { * \param[in] val_value - Value to add to the gradient of the primitive variables. */ inline void AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Secondary[val_var][val_dim] += val_value; } - + /*! * \brief Subtract val_value to the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -210,7 +210,7 @@ class CEulerVariable : public CVariable { * \param[in] val_value - Value to subtract to the gradient of the primitive variables. */ inline void SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Secondary[val_var][val_dim] -= val_value; } - + /*! * \brief Get the value of the primitive variables gradient. * \param[in] val_var - Index of the variable. @@ -218,7 +218,7 @@ class CEulerVariable : public CVariable { * \return Value of the primitive variables gradient. */ inline su2double GetGradient_Secondary(unsigned short val_var, unsigned short val_dim) {return Gradient_Secondary[val_var][val_dim]; } - + /*! * \brief Get the value of the primitive variables gradient. * \param[in] val_var - Index of the variable. @@ -226,7 +226,7 @@ class CEulerVariable : public CVariable { * \return Value of the primitive variables gradient. */ inline su2double GetLimiter_Secondary(unsigned short val_var) {return Limiter_Secondary[val_var]; } - + /*! * \brief Set the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -234,7 +234,7 @@ class CEulerVariable : public CVariable { * \param[in] val_value - Value of the gradient. */ inline void SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Secondary[val_var][val_dim] = val_value; } - + /*! * \brief Set the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -242,29 +242,29 @@ class CEulerVariable : public CVariable { * \param[in] val_value - Value of the gradient. */ inline void SetLimiter_Secondary(unsigned short val_var, su2double val_value) {Limiter_Secondary[val_var] = val_value; } - + /*! * \brief Get the value of the primitive variables gradient. * \return Value of the primitive variables gradient. */ inline su2double **GetGradient_Secondary(void) {return Gradient_Secondary; } - + /*! * \brief Get the value of the primitive variables gradient. * \return Value of the primitive variables gradient. */ inline su2double *GetLimiter_Secondary(void) {return Limiter_Secondary; } - + /*! * \brief A virtual member. */ inline void SetdPdrho_e(su2double dPdrho_e) {Secondary[0] = dPdrho_e;} - + /*! * \brief A virtual member. */ inline void SetdPde_rho(su2double dPde_rho) {Secondary[1] = dPde_rho;} - + /*! * \brief Set the value of the pressure. */ @@ -273,7 +273,7 @@ class CEulerVariable : public CVariable { if (Primitive[nDim+1] > 0.0) return false; else return true; } - + /*! * \brief Set the value of the speed of the sound. * \param[in] soundspeed2 - Value of soundspeed^2. @@ -286,29 +286,29 @@ class CEulerVariable : public CVariable { return false; } } - + /*! * \brief Set the value of the enthalpy. */ inline void SetEnthalpy(void) {Primitive[nDim+3] = (Solution[nVar-1] + Primitive[nDim+1]) / Solution[0]; } - + /*! * \brief Set all the primitive variables for compressible flows. */ bool SetPrimVar(CFluidModel *FluidModel); - + /*! * \brief A virtual member. */ void SetSecondaryVar(CFluidModel *FluidModel); - + /*! * \brief Get the primitive variables. * \param[in] val_var - Index of the variable. * \return Value of the primitive variable for the index val_var. */ inline su2double GetPrimitive(unsigned short val_var) {return Primitive[val_var]; } - + /*! * \brief Set the value of the primitive variables. * \param[in] val_var - Index of the variable. @@ -316,7 +316,7 @@ class CEulerVariable : public CVariable { * \return Set the value of the primitive variable for the index val_var. */ inline void SetPrimitive(unsigned short val_var, su2double val_prim) {Primitive[val_var] = val_prim; } - + /*! * \brief Set the value of the primitive variables. * \param[in] val_prim - Primitive variables. @@ -326,20 +326,20 @@ class CEulerVariable : public CVariable { for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) Primitive[iVar] = val_prim[iVar]; } - + /*! * \brief Get the primitive variables of the problem. * \return Pointer to the primitive variable vector. */ inline su2double *GetPrimitive(void) {return Primitive; } - + /*! * \brief Get the primitive variables. * \param[in] val_var - Index of the variable. * \return Value of the primitive variable for the index val_var. */ inline su2double GetSecondary(unsigned short val_var) {return Secondary[val_var]; } - + /*! * \brief Set the value of the primitive variables. * \param[in] val_var - Index of the variable. @@ -347,7 +347,7 @@ class CEulerVariable : public CVariable { * \return Set the value of the primitive variable for the index val_var. */ inline void SetSecondary(unsigned short val_var, su2double val_secondary) {Secondary[val_var] = val_secondary; } - + /*! * \brief Set the value of the primitive variables. * \param[in] val_prim - Primitive variables. @@ -357,13 +357,13 @@ class CEulerVariable : public CVariable { for (unsigned short iVar = 0; iVar < nSecondaryVar; iVar++) Secondary[iVar] = val_secondary[iVar]; } - + /*! * \brief Get the primitive variables of the problem. * \return Pointer to the primitive variable vector. */ inline su2double *GetSecondary(void) {return Secondary; } - + /*! * \brief Set the value of the density for the incompressible flows. */ @@ -372,7 +372,7 @@ class CEulerVariable : public CVariable { if (Primitive[nDim+2] > 0.0) return false; else return true; } - + /*! * \brief Set the value of the temperature. * \param[in] temperature - how agitated the particles are :) @@ -382,63 +382,63 @@ class CEulerVariable : public CVariable { if (Primitive[0] > 0.0) return false; else return true; } - + /*! * \brief Get the norm 2 of the velocity. * \return Norm 2 of the velocity vector. */ inline su2double GetVelocity2(void) {return Velocity2; } - + /*! * \brief Get the flow pressure. * \return Value of the flow pressure. */ inline su2double GetPressure(void) {return Primitive[nDim+1]; } - + /*! * \brief Get the speed of the sound. * \return Value of speed of the sound. */ inline su2double GetSoundSpeed(void) {return Primitive[nDim+4]; } - + /*! * \brief Get the enthalpy of the flow. * \return Value of the enthalpy of the flow. */ inline su2double GetEnthalpy(void) {return Primitive[nDim+3]; } - + /*! * \brief Get the density of the flow. * \return Value of the density of the flow. */ inline su2double GetDensity(void) {return Solution[0]; } - + /*! * \brief Get the energy of the flow. * \return Value of the energy of the flow. */ inline su2double GetEnergy(void) {return Solution[nVar-1]/Solution[0]; }; - + /*! * \brief Get the temperature of the flow. * \return Value of the temperature of the flow. */ inline su2double GetTemperature(void) {return Primitive[0]; } - + /*! * \brief Get the velocity of the flow. * \param[in] val_dim - Index of the dimension. * \return Value of the velocity for the dimension val_dim. */ inline su2double GetVelocity(unsigned short val_dim) {return Primitive[val_dim+1]; } - + /*! * \brief Get the projected velocity in a unitary vector direction (compressible solver). * \param[in] val_vector - Direction of projection. * \return Value of the projected velocity. */ su2double GetProjVel(su2double *val_vector); - + /*! * \brief Set the velocity vector from the solution. * \param[in] val_velocity - Pointer to the velocity. @@ -450,7 +450,7 @@ class CEulerVariable : public CVariable { Velocity2 += Primitive[iDim+1]*Primitive[iDim+1]; } } - + /*! * \brief Set the velocity vector from the old solution. * \param[in] val_velocity - Pointer to the velocity. @@ -459,39 +459,39 @@ class CEulerVariable : public CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = val_velocity[iDim]*Solution[0]; } - + /*! * \brief Set the harmonic balance source term. * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the harmonic balance source term. for the index val_var. */ inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } - + /*! * \brief Get the harmonic balance source term. * \param[in] val_var - Index of the variable. * \return Value of the harmonic balance source term for the index val_var. */ inline su2double GetHarmonicBalance_Source(unsigned short val_var) {return HB_Source[val_var]; } - + /*! * \brief Get the value of the preconditioner Beta. * \return Value of the low Mach preconditioner variable Beta */ inline su2double GetPreconditioner_Beta() {return Precond_Beta; } - + /*! * \brief Set the value of the preconditioner Beta. * \param[in] Value of the low Mach preconditioner variable Beta */ inline void SetPreconditioner_Beta(su2double val_Beta) {Precond_Beta = val_Beta; } - + /*! * \brief Get the value of the wind gust * \return Value of the wind gust */ inline su2double* GetWindGust() {return WindGust;} - + /*! * \brief Set the value of the wind gust * \param[in] Value of the wind gust @@ -500,13 +500,13 @@ class CEulerVariable : public CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) WindGust[iDim] = val_WindGust[iDim]; } - + /*! * \brief Get the value of the derivatives of the wind gust * \return Value of the derivatives of the wind gust */ inline su2double* GetWindGustDer() {return WindGustDer;} - + /*! * \brief Set the value of the derivatives of the wind gust * \param[in] Value of the derivatives of the wind gust @@ -519,7 +519,7 @@ class CEulerVariable : public CVariable { /*! * \brief Set the value of the solution in the previous BGS subiteration. */ - inline void Set_BGSSolution_k(void) { + inline void Set_BGSSolution_k(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_BGS_k[iVar] = Solution[iVar]; } diff --git a/SU2_CFD/include/variables/CFEABoundVariable.hpp b/SU2_CFD/include/variables/CFEABoundVariable.hpp index 43364187970d..80d7f0dbd439 100644 --- a/SU2_CFD/include/variables/CFEABoundVariable.hpp +++ b/SU2_CFD/include/variables/CFEABoundVariable.hpp @@ -54,14 +54,14 @@ class CFEABoundVariable : public CFEAVariable { su2double *Residual_Ext_Surf; /*!< \brief Term of the residual due to external forces */ su2double *Residual_Ext_Surf_n; /*!< \brief Term of the residual due to external forces at time n */ - + public: - + /*! * \brief Constructor of the class. */ CFEABoundVariable(void); - + /*! * \overload * \param[in] val_fea - Values of the fea solution (initialization value). @@ -70,7 +70,7 @@ class CFEABoundVariable : public CFEAVariable { * \param[in] config - Definition of the particular problem. */ CFEABoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ diff --git a/SU2_CFD/include/variables/CFEAVariable.hpp b/SU2_CFD/include/variables/CFEAVariable.hpp index 88be789dce66..b40951e395de 100644 --- a/SU2_CFD/include/variables/CFEAVariable.hpp +++ b/SU2_CFD/include/variables/CFEAVariable.hpp @@ -48,36 +48,36 @@ */ class CFEAVariable : public CVariable { protected: - + su2double *Stress; /*!< \brief Stress tensor. */ su2double *Residual_Ext_Body; /*!< \brief Term of the residual due to body forces */ - + su2double VonMises_Stress; /*!< \brief Von Mises stress. */ - + su2double *Solution_Vel, /*!< \brief Velocity of the nodes. */ *Solution_Vel_time_n; /*!< \brief Velocity of the nodes at time n. */ - + su2double *Solution_Accel, /*!< \brief Acceleration of the nodes. */ *Solution_Accel_time_n; /*!< \brief Acceleration of the nodes at time n. */ - + su2double *Solution_Pred, /*!< \brief Predictor of the solution for FSI purposes */ *Solution_Pred_Old; /*!< \brief Predictor of the solution at time n for FSI purposes */ - + su2double *Reference_Geometry; /*!< \brief Reference solution for optimization problems */ - + su2double *Prestretch; /*!< \brief Prestretch geometry */ - + su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ - - + + public: - + /*! * \brief Constructor of the class. */ CFEAVariable(void); - + /*! * \overload * \param[in] val_fea - Values of the fea solution (initialization value). @@ -86,32 +86,32 @@ class CFEAVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ ~CFEAVariable(void); - + /*! * \brief Get the value of the stress. * \return Value of the stress. */ inline su2double *GetStress_FEM(void) {return Stress; } - + /*! * \brief Set the value of the stress at the node * \param[in] iVar - index of the stress term * \param[in] val_stress - value of the stress */ inline void SetStress_FEM(unsigned short iVar, su2double val_stress) {Stress[iVar] = val_stress; } - + /*! * \brief Add a certain value to the value of the stress at the node * \param[in] iVar - index of the stress term * \param[in] val_stress - value of the stress */ inline void AddStress_FEM(unsigned short iVar, su2double val_stress) {Stress[iVar] += val_stress; } - + /*! * \brief Add body forces to the residual term. */ @@ -119,19 +119,19 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Body[iVar] += val_bodyForce[iVar]; } - + /*! * \brief Clear the surface load residual */ inline void Clear_BodyForces_Res(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Ext_Body[iVar] = 0.0; } - + /*! * \brief Get the body forces. */ inline su2double Get_BodyForces_Res(unsigned short iVar) {return Residual_Ext_Body[iVar];} - + /*! * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. @@ -139,7 +139,7 @@ class CFEAVariable : public CVariable { inline void SetSolution_time_n(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = Solution[iVar]; } - + /*! * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. @@ -147,7 +147,7 @@ class CFEAVariable : public CVariable { inline void SetSolution_time_n(su2double *val_solution_time_n) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = val_solution_time_n[iVar]; } - + /*! * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. @@ -155,7 +155,7 @@ class CFEAVariable : public CVariable { inline void SetSolution_time_n(unsigned short val_var, su2double val_solution) { Solution_time_n[val_var] = val_solution; } - + /*! * \brief Set the value of the velocity (Structural Analysis). * \param[in] val_solution - Solution of the problem (velocity). @@ -163,14 +163,14 @@ class CFEAVariable : public CVariable { void SetSolution_Vel(su2double *val_solution_vel) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel[iVar] = val_solution_vel[iVar]; } - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the solution for the index val_var. */ inline void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) {Solution_Vel[val_var] = val_solution_vel; } - + /*! * \brief Set the value of the velocity (Structural Analysis) at time n. * \param[in] val_solution - Solution of the problem (acceleration). @@ -178,7 +178,7 @@ class CFEAVariable : public CVariable { void SetSolution_Vel_time_n(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = Solution_Vel[iVar]; } - + /*! * \brief Set the value of the velocity (Structural Analysis) at time n. * \param[in] val_solution_old - Pointer to the residual vector. @@ -186,40 +186,40 @@ class CFEAVariable : public CVariable { void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n[iVar] = val_solution_vel_time_n[iVar]; } - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution_old - Value of the old solution for the index val_var. */ inline void SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n) {Solution_Vel_time_n[val_var] = val_solution_vel_time_n; } - + /*! * \brief Get the velocity (Structural Analysis). * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline su2double GetSolution_Vel(unsigned short val_var) {return Solution_Vel[val_var]; } - + /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ inline su2double *GetSolution_Vel(void) {return Solution_Vel; } - + /*! * \brief Get the velocity of the nodes (Structural Analysis) at time n. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline su2double GetSolution_Vel_time_n(unsigned short val_var) {return Solution_Vel_time_n[val_var]; } - + /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline su2double *GetSolution_Vel_time_n(void) {return Solution_Vel_time_n; } - + /*! * \brief Set the value of the acceleration (Structural Analysis). * \param[in] val_solution - Solution of the problem (acceleration). @@ -227,14 +227,14 @@ class CFEAVariable : public CVariable { inline void SetSolution_Accel(su2double *val_solution_accel) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel[iVar] = val_solution_accel[iVar]; } - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the solution for the index val_var. */ inline void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) {Solution_Accel[val_var] = val_solution_accel;} - + /*! * \brief Set the value of the acceleration (Structural Analysis) at time n. * \param[in] val_solution_old - Pointer to the residual vector. @@ -242,7 +242,7 @@ class CFEAVariable : public CVariable { inline void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = val_solution_accel_time_n[iVar]; } - + /*! * \brief Set the value of the acceleration (Structural Analysis) at time n. * \param[in] val_solution - Solution of the problem (acceleration). @@ -250,149 +250,149 @@ class CFEAVariable : public CVariable { inline void SetSolution_Accel_time_n(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n[iVar] = Solution_Accel[iVar]; } - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution_old - Value of the old solution for the index val_var. */ inline void SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n) {Solution_Accel_time_n[val_var] = val_solution_accel_time_n; } - + /*! * \brief Get the acceleration (Structural Analysis). * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline su2double GetSolution_Accel(unsigned short val_var) {return Solution_Accel[val_var]; } - + /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ inline su2double *GetSolution_Accel(void) {return Solution_Accel; } - + /*! * \brief Get the acceleration of the nodes (Structural Analysis) at time n. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline su2double GetSolution_Accel_time_n(unsigned short val_var) {return Solution_Accel_time_n[val_var]; } - + /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline su2double *GetSolution_Accel_time_n(void) {return Solution_Accel_time_n; } - + /*! * \brief Set the value of the solution predictor. */ inline void SetSolution_Pred(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Pred[iVar] = Solution[iVar]; } - + /*! * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. */ inline void SetSolution_Pred(su2double *val_solution_pred) {Solution_Pred = val_solution_pred; } - + /*! * \brief Set the value of the predicted solution. * \param[in] val_var - Index of the variable * \param[in] val_solution_pred - Value of the predicted solution. */ inline void SetSolution_Pred(unsigned short val_var, su2double val_solution_pred) {Solution_Pred[val_var] = val_solution_pred; } - + /*! * \brief Get the value of the solution predictor. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline su2double GetSolution_Pred(unsigned short val_var) {return Solution_Pred[val_var]; } - + /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline su2double *GetSolution_Pred(void) {return Solution_Pred; } - + /*! * \brief Set the value of the solution predictor. */ inline void SetSolution_Pred_Old(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_Pred_Old[iVar] = Solution_Pred[iVar]; } - + /*! * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. */ inline void SetSolution_Pred_Old(su2double *val_solution_pred_Old) {Solution_Pred_Old = val_solution_pred_Old; } - + /*! * \brief A virtual member. Set the value of the old solution predicted. * \param[in] val_var - Index of the variable * \param[in] val_solution_pred_old - Value of the old predicted solution. */ inline void SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old) {Solution_Pred_Old[val_var] = val_solution_pred_old; } - + /*! * \brief Get the value of the solution predictor. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline su2double GetSolution_Pred_Old(unsigned short val_var) {return Solution_Pred_Old[val_var]; } - + /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline su2double *GetSolution_Pred_Old(void) {return Solution_Pred_Old; } - + /*! * \brief A virtual member. */ inline void SetPrestretch(unsigned short iVar, su2double val_prestretch) {Prestretch[iVar] = val_prestretch;} - + /*! * \brief A virtual member. */ inline su2double *GetPrestretch(void) {return Prestretch; } - + /*! * \brief A virtual member. */ inline su2double GetPrestretch(unsigned short iVar) {return Prestretch[iVar]; } - + /*! * \brief Set the value of the Von Mises stress. * \param[in] val_stress - Value of the Von Mises stress. */ inline void SetVonMises_Stress(su2double val_stress) {VonMises_Stress = val_stress; } - + /*! * \brief Get the value of the Von Mises stress. * \return Value of the Von Mises stress. */ inline su2double GetVonMises_Stress(void) {return VonMises_Stress; } - + /*! * \brief Set the reference geometry. * \return Pointer to the solution (at time n) vector. */ inline void SetReference_Geometry(unsigned short iVar, su2double ref_geometry) {Reference_Geometry[iVar] = ref_geometry;} - + /*! * \brief Get the pointer to the reference geometry */ inline su2double *GetReference_Geometry(void) {return Reference_Geometry; } - + /*! * \brief Get the value of the reference geometry for the coordinate iVar */ inline su2double GetReference_Geometry(unsigned short iVar) {return Reference_Geometry[iVar]; } - + /*! * \brief Register the variables in the solution time_n array as input/output variable. * \param[in] input - input or output variables. @@ -401,7 +401,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterInput(Solution_time_n[iVar]); } - + /*! * \brief Register the variables in the velocity array as input/output variable. * \param[in] input - input or output variables. @@ -414,7 +414,7 @@ class CFEAVariable : public CVariable { else { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterOutput(Solution_Vel[iVar]);} } - + /*! * \brief Register the variables in the velocity time_n array as input/output variable. */ @@ -422,7 +422,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterInput(Solution_Vel_time_n[iVar]); } - + /*! * \brief Register the variables in the acceleration array as input/output variable. * \param[in] input - input or output variables. @@ -435,7 +435,7 @@ class CFEAVariable : public CVariable { else { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterOutput(Solution_Accel[iVar]);} } - + /*! * \brief Register the variables in the acceleration time_n array as input/output variable. */ @@ -443,7 +443,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterInput(Solution_Accel_time_n[iVar]); } - + /*! * \brief Set the velocity adjoint values of the solution. * \param[in] adj_sol - The adjoint values of the solution. @@ -452,7 +452,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_Vel[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); } - + /*! * \brief Get the velocity adjoint values of the solution. * \param[in] adj_sol - The adjoint values of the solution. @@ -461,7 +461,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel[iVar]); } - + /*! * \brief Set the velocity adjoint values of the solution at time n. * \param[in] adj_sol - The adjoint values of the solution. @@ -470,7 +470,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_Vel_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); } - + /*! * \brief Get the velocity adjoint values of the solution at time n. * \param[in] adj_sol - The adjoint values of the solution. @@ -479,7 +479,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel_time_n[iVar]); } - + /*! * \brief Set the acceleration adjoint values of the solution. * \param[in] adj_sol - The adjoint values of the solution. @@ -488,7 +488,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_Accel[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); } - + /*! * \brief Get the acceleration adjoint values of the solution. * \param[in] adj_sol - The adjoint values of the solution. @@ -497,7 +497,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel[iVar]); } - + /*! * \brief Set the acceleration adjoint values of the solution at time n. * \param[in] adj_sol - The adjoint values of the solution. @@ -506,7 +506,7 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_Accel_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); } - + /*! * \brief Get the acceleration adjoint values of the solution at time n. * \param[in] adj_sol - The adjoint values of the solution. @@ -515,11 +515,11 @@ class CFEAVariable : public CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel_time_n[iVar]); } - + /*! * \brief Set the value of the solution in the previous BGS subiteration. */ - inline void Set_BGSSolution_k(void) { + inline void Set_BGSSolution_k(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_BGS_k[iVar] = Solution[iVar]; } diff --git a/SU2_CFD/include/variables/CHeatFVMVariable.hpp b/SU2_CFD/include/variables/CHeatFVMVariable.hpp index cd25361614b0..e40d49b91610 100644 --- a/SU2_CFD/include/variables/CHeatFVMVariable.hpp +++ b/SU2_CFD/include/variables/CHeatFVMVariable.hpp @@ -49,14 +49,14 @@ class CHeatFVMVariable : public CVariable { protected: su2double *Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */ su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ - + public: - + /*! * \brief Constructor of the class. */ CHeatFVMVariable(void); - + /*! * \overload * \param[in] val_Heat - Values of the Heat solution (initialization value). @@ -65,7 +65,7 @@ class CHeatFVMVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index 6721709b44f1..11f77fa8a026 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -48,28 +48,28 @@ class CIncEulerVariable : public CVariable { protected: su2double Velocity2; /*!< \brief Square of the velocity vector. */ - + /*--- Primitive variable definition ---*/ - + su2double *Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ su2double **Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ su2double *Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ - + /*--- Old solution container for BGS iterations ---*/ - + su2double* Solution_BGS_k; - + /*--- Old density for variable density turbulent flows (SST). ---*/ - + su2double Density_Old; public: - + /*! * \brief Constructor of the class. */ CIncEulerVariable(void); - + /*! * \overload * \param[in] val_pressure - value of the pressure. @@ -81,7 +81,7 @@ class CIncEulerVariable : public CVariable { */ CIncEulerVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \overload * \param[in] val_solution - Pointer to the flow value (initialization value). @@ -90,17 +90,17 @@ class CIncEulerVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CIncEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ virtual ~CIncEulerVariable(void); - + /*! * \brief Set to zero the gradient of the primitive variables. */ void SetGradient_PrimitiveZero(unsigned short val_primvar); - + /*! * \brief Add val_value to the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -108,7 +108,7 @@ class CIncEulerVariable : public CVariable { * \param[in] val_value - Value to add to the gradient of the primitive variables. */ inline void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] += val_value; } - + /*! * \brief Subtract val_value to the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -116,7 +116,7 @@ class CIncEulerVariable : public CVariable { * \param[in] val_value - Value to subtract to the gradient of the primitive variables. */ inline void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] -= val_value; } - + /*! * \brief Get the value of the primitive variables gradient. * \param[in] val_var - Index of the variable. @@ -124,14 +124,14 @@ class CIncEulerVariable : public CVariable { * \return Value of the primitive variables gradient. */ inline su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) {return Gradient_Primitive[val_var][val_dim]; } - + /*! * \brief Get the value of the primitive variables gradient. * \param[in] val_var - Index of the variable. * \return Value of the primitive variables gradient. */ inline su2double GetLimiter_Primitive(unsigned short val_var) {return Limiter_Primitive[val_var]; } - + /*! * \brief Set the gradient of the primitive variables. * \param[in] val_var - Index of the variable. @@ -139,38 +139,38 @@ class CIncEulerVariable : public CVariable { * \param[in] val_value - Value of the gradient. */ inline void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient_Primitive[val_var][val_dim] = val_value; } - + /*! * \brief Set the gradient of the primitive variables. * \param[in] val_var - Index of the variable. * \param[in] val_value - Value of the gradient. */ inline void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {Limiter_Primitive[val_var] = val_value; } - + /*! * \brief Get the value of the primitive variables gradient. * \return Value of the primitive variables gradient. */ inline su2double **GetGradient_Primitive(void) {return Gradient_Primitive; } - + /*! * \brief Get the value of the primitive variables gradient. * \return Value of the primitive variables gradient. */ inline su2double *GetLimiter_Primitive(void) {return Limiter_Primitive; } - + /*! * \brief Set the value of the pressure. */ inline void SetPressure(void) {Primitive[0] = Solution[0];} - + /*! * \brief Get the primitive variables. * \param[in] val_var - Index of the variable. * \return Value of the primitive variable for the index val_var. */ inline su2double GetPrimitive(unsigned short val_var) {return Primitive[val_var]; } - + /*! * \brief Set the value of the primitive variables. * \param[in] val_var - Index of the variable. @@ -178,7 +178,7 @@ class CIncEulerVariable : public CVariable { * \return Set the value of the primitive variable for the index val_var. */ inline void SetPrimitive(unsigned short val_var, su2double val_prim) {Primitive[val_var] = val_prim; } - + /*! * \brief Set the value of the primitive variables. * \param[in] val_prim - Primitive variables. @@ -188,22 +188,22 @@ class CIncEulerVariable : public CVariable { for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) Primitive[iVar] = val_prim[iVar]; } - + /*! * \brief Get the primitive variables of the problem. * \return Pointer to the primitive variable vector. */ inline su2double *GetPrimitive(void) {return Primitive; } - + /*! * \brief Set the value of the density for the incompressible flows. */ - inline bool SetDensity(su2double val_density) { - Primitive[nDim+2] = val_density; + inline bool SetDensity(su2double val_density) { + Primitive[nDim+2] = val_density; if (Primitive[nDim+2] > 0.0) return false; else return true; } - + /*! * \brief Set the value of the density for the incompressible flows. */ @@ -218,47 +218,47 @@ class CIncEulerVariable : public CVariable { /*! * \brief Set the value of the temperature for incompressible flows with energy equation. */ - inline bool SetTemperature(su2double val_temperature) { + inline bool SetTemperature(su2double val_temperature) { Primitive[nDim+1] = val_temperature; if (Primitive[nDim+1] > 0.0) return false; - else return true; + else return true; } - + /*! * \brief Set the value of the beta coeffient for incompressible flows. */ inline void SetBetaInc2(su2double val_betainc2) {Primitive[nDim+3] = val_betainc2; } - + /*! * \brief Get the norm 2 of the velocity. * \return Norm 2 of the velocity vector. */ inline su2double GetVelocity2(void) {return Velocity2; } - + /*! * \brief Get the flow pressure. * \return Value of the flow pressure. */ inline su2double GetPressure(void) {return Primitive[0]; } - + /*! * \brief Get the value of beta squared for the incompressible flow * \return Value of beta squared. */ inline su2double GetBetaInc2(void) {return Primitive[nDim+3]; } - + /*! * \brief Get the density of the flow. * \return Value of the density of the flow. */ inline su2double GetDensity(void) {return Primitive[nDim+2]; } - + /*! * \brief Get the density of the flow from the previous iteration. * \return Old value of the density of the flow. */ inline su2double GetDensity_Old(void) {return Density_Old; } - + /*! * \brief Get the temperature of the flow. * \return Value of the temperature of the flow. @@ -271,14 +271,14 @@ class CIncEulerVariable : public CVariable { * \return Value of the velocity for the dimension val_dim. */ inline su2double GetVelocity(unsigned short val_dim) {return Primitive[val_dim+1]; } - + /*! * \brief Get the projected velocity in a unitary vector direction (compressible solver). * \param[in] val_vector - Direction of projection. * \return Value of the projected velocity. */ su2double GetProjVel(su2double *val_vector); - + /*! * \brief Set the velocity vector from the old solution. * \param[in] val_velocity - Pointer to the velocity. @@ -287,7 +287,7 @@ class CIncEulerVariable : public CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = val_velocity[iDim]; } - + /*! * \brief Set all the primitive variables for incompressible flows. */ @@ -314,7 +314,7 @@ class CIncEulerVariable : public CVariable { * \return Value of the specific heat at constant V of the flow. */ inline su2double GetSpecificHeatCv(void) {return Primitive[nDim+8]; } - + /*! * \brief Set the value of the solution in the previous BGS subiteration. */ diff --git a/SU2_CFD/include/variables/CIncNSVariable.hpp b/SU2_CFD/include/variables/CIncNSVariable.hpp index 18087f204e3b..7f89a5e024da 100644 --- a/SU2_CFD/include/variables/CIncNSVariable.hpp +++ b/SU2_CFD/include/variables/CIncNSVariable.hpp @@ -50,15 +50,15 @@ class CIncNSVariable : public CIncEulerVariable { private: su2double Vorticity[3]; /*!< \brief Vorticity of the fluid. */ su2double StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ - + su2double DES_LengthScale; public: - + /*! * \brief Constructor of the class. */ CIncNSVariable(void); - + /*! * \overload * \param[in] val_pressure - value of the pressure. @@ -69,7 +69,7 @@ class CIncNSVariable : public CIncEulerVariable { * \param[in] config - Definition of the particular problem. */ CIncNSVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \overload * \param[in] val_solution - Pointer to the flow value (initialization value). @@ -78,45 +78,45 @@ class CIncNSVariable : public CIncEulerVariable { * \param[in] config - Definition of the particular problem. */ CIncNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ ~CIncNSVariable(void); - + /*! * \brief Set the laminar viscosity. */ inline void SetLaminarViscosity(su2double laminarViscosity) {Primitive[nDim+4] = laminarViscosity;} - + /*! * \brief Set the vorticity value. */ bool SetVorticity(void); - + /*! * \brief Set the rate of strain magnitude. */ bool SetStrainMag(void); - + /*! * \overload * \param[in] eddy_visc - Value of the eddy viscosity. */ inline void SetEddyViscosity(su2double eddy_visc) {Primitive[nDim+5] = eddy_visc; } - + /*! * \brief Get the laminar viscosity of the flow. * \return Value of the laminar viscosity of the flow. */ inline su2double GetLaminarViscosity(void) {return Primitive[nDim+4]; } - + /*! * \brief Get the eddy viscosity of the flow. * \return The eddy viscosity of the flow. */ inline su2double GetEddyViscosity(void) {return Primitive[nDim+5]; } - + /*! * \brief Set the thermal conductivity. */ @@ -134,28 +134,28 @@ class CIncNSVariable : public CIncEulerVariable { * \return Value of the vorticity. */ inline su2double *GetVorticity(void) {return Vorticity; } - + /*! * \brief Get the value of the magnitude of rate of strain. * \return Value of the rate of strain magnitude. */ inline su2double GetStrainMag(void) {return StrainMag; } - + /*! * \brief Set all the primitive variables for incompressible flows */ bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); using CVariable::SetPrimVar; - + /*! * \brief Set the DES Length Scale. */ inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } - + /*! * \brief Get the DES length scale * \return Value of the DES length Scale. */ inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } - + }; diff --git a/SU2_CFD/include/variables/CNSVariable.hpp b/SU2_CFD/include/variables/CNSVariable.hpp index a982dff2cd9a..692f5acea912 100644 --- a/SU2_CFD/include/variables/CNSVariable.hpp +++ b/SU2_CFD/include/variables/CNSVariable.hpp @@ -59,14 +59,14 @@ class CNSVariable : public CEulerVariable { su2double inv_TimeScale; /*!< \brief Inverse of the reference time scale. */ su2double Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */ su2double Vortex_Tilting; /*!< \brief Value of the vortex tilting variable for DES length scale computation. */ - + public: - + /*! * \brief Constructor of the class. */ CNSVariable(void); - + /*! * \overload * \param[in] val_density - Value of the flow density (initialization value). @@ -78,7 +78,7 @@ class CNSVariable : public CEulerVariable { */ CNSVariable(su2double val_density, su2double *val_velocity, su2double val_energy, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \overload * \param[in] val_solution - Pointer to the flow value (initialization value). @@ -87,148 +87,148 @@ class CNSVariable : public CEulerVariable { * \param[in] config - Definition of the particular problem. */ CNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ ~CNSVariable(void); - + /*! * \brief Set the laminar viscosity. */ inline void SetLaminarViscosity(su2double laminarViscosity) {Primitive[nDim+5] = laminarViscosity;} - + /*! * \brief Set the laminar viscosity. */ inline void SetThermalConductivity(su2double thermalConductivity) {Primitive[nDim+7] = thermalConductivity;} - + /*! * \brief Set the specific heat Cp. */ inline void SetSpecificHeatCp(su2double val_Cp) {Primitive[nDim+8] = val_Cp;} - + /*! * \brief Set the vorticity value. */ bool SetVorticity(void); - + /*! * \brief Set the rate of strain magnitude. */ bool SetStrainMag(void); - + /*! * \overload * \param[in] eddy_visc - Value of the eddy viscosity. */ inline void SetEddyViscosity(su2double eddy_visc) {Primitive[nDim+6] = eddy_visc; } - + /*! * \brief Get the laminar viscosity of the flow. * \return Value of the laminar viscosity of the flow. */ inline su2double GetLaminarViscosity(void) {return Primitive[nDim+5]; } - + /*! * \brief Get the thermal conductivity of the flow. * \return Value of the laminar viscosity of the flow. */ inline su2double GetThermalConductivity(void) {return Primitive[nDim+7]; } - + /*! * \brief Get the eddy viscosity of the flow. * \return The eddy viscosity of the flow. */ inline su2double GetEddyViscosity(void) {return Primitive[nDim+6]; } - + /*! * \brief Get the specific heat at constant P of the flow. * \return Value of the specific heat at constant P of the flow. */ inline su2double GetSpecificHeatCp(void) {return Primitive[nDim+8]; } - + /*! * \brief Set the temperature at the wall */ inline void SetWallTemperature(su2double temperature_wall) { Primitive[0] = temperature_wall; } - + /*! * \brief Get the value of the vorticity. * \param[in] val_dim - Index of the dimension. * \return Value of the vorticity. */ inline su2double *GetVorticity(void) {return Vorticity; } - + /*! * \brief Get the value of the magnitude of rate of strain. * \return Value of the rate of strain magnitude. */ inline su2double GetStrainMag(void) {return StrainMag; } - + /*! * \brief Set the derivative of temperature with respect to density (at constant internal energy). */ inline void SetdTdrho_e(su2double dTdrho_e) {Secondary[2] = dTdrho_e;} - + /*! * \brief Set the derivative of temperature with respect to internal energy (at constant density). */ inline void SetdTde_rho(su2double dTde_rho) {Secondary[3] = dTde_rho;} - + /*! * \brief Set the derivative of laminar viscosity with respect to density (at constant temperature). */ inline void Setdmudrho_T(su2double dmudrho_T) {Secondary[4] = dmudrho_T;} - + /*! * \brief Set the derivative of laminar viscosity with respect to temperature (at constant density). */ inline void SetdmudT_rho(su2double dmudT_rho) {Secondary[5] = dmudT_rho;} - + /*! * \brief Set the derivative of thermal conductivity with respect to density (at constant temperature). */ inline void Setdktdrho_T(su2double dktdrho_T) {Secondary[6] = dktdrho_T;} - + /*! * \brief Set the derivative of thermal conductivity with respect to temperature (at constant density). */ inline void SetdktdT_rho(su2double dktdT_rho) {Secondary[7] = dktdT_rho;} - + /*! * \brief Set all the primitive variables for compressible flows */ bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); using CVariable::SetPrimVar; - + /*! * \brief Set all the secondary variables (partial derivatives) for compressible flows */ void SetSecondaryVar(CFluidModel *FluidModel); - /*! + /*! * \brief Set the value of the wall shear stress computed by a wall function. */ inline void SetTauWall(su2double val_tau_wall) {Tau_Wall = val_tau_wall; } - + /*! * \brief Get the value of the wall shear stress computed by a wall function. * \return Value of the wall shear stress computed by a wall function. */ inline su2double GetTauWall(void) {return Tau_Wall; } - + /*! * \brief Get the DES length scale * \return Value of the DES length Scale. */ inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } - + /*! * \brief Set the DES Length Scale. */ inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } - + /*! * \brief Set the new solution for Roe Dissipation. * \param[in] val_delta - A scalar measure of the grid size @@ -240,17 +240,17 @@ class CNSVariable : public CEulerVariable { * \brief Set the new solution for Roe Dissipation. */ void SetRoe_Dissipation_FD(su2double wall_distance); - + /*! * \brief Get the Roe Dissipation Coefficient. * \return Value of the Roe Dissipation. */ inline su2double GetRoe_Dissipation(void) {return Roe_Dissipation; } - + /*! * \brief Set the Roe Dissipation Coefficient. * \param[in] val_dissipation - Value of the Roe dissipation factor. */ inline void SetRoe_Dissipation(su2double val_dissipation) {Roe_Dissipation = val_dissipation; } - + }; diff --git a/SU2_CFD/include/variables/CTransLMVariable.hpp b/SU2_CFD/include/variables/CTransLMVariable.hpp index d9446dcfcb6b..a90141f9adc6 100644 --- a/SU2_CFD/include/variables/CTransLMVariable.hpp +++ b/SU2_CFD/include/variables/CTransLMVariable.hpp @@ -49,14 +49,14 @@ class CTransLMVariable : public CTurbVariable { protected: su2double gamma_sep; - + public: - + /*! * \brief Constructor of the class. */ CTransLMVariable(void); - + /*! * \overload * \param[in] val_nu_tilde - Turbulent variable value (initialization value). @@ -67,23 +67,23 @@ class CTransLMVariable : public CTurbVariable { * \param[in] config - Definition of the particular problem. */ CTransLMVariable(su2double val_nu_tilde, su2double val_intermittency, su2double val_REth, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ ~CTransLMVariable(void); - + /*! * \brief ________________. */ inline su2double GetIntermittency(void) { return Solution[0]; } - + /*! * \brief ________________. * \param[in] gamma_sep_in */ inline void SetGammaSep(su2double gamma_sep_in) {gamma_sep = gamma_sep_in;} - + /*! * \brief Correction for separation-induced transition. */ diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index 6c005da6a3bf..b65178f24f78 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -52,13 +52,13 @@ class CTurbSAVariable : public CTurbVariable { su2double gamma_BC; /*!< \brief Value of the intermittency for the BC trans. model. */ su2double DES_LengthScale; su2double Vortex_Tilting; - + public: /*! * \brief Constructor of the class. */ CTurbSAVariable(void); - + /*! * \overload * \param[in] val_nu_tilde - Turbulent variable value (initialization value). @@ -68,19 +68,19 @@ class CTurbSAVariable : public CTurbVariable { * \param[in] config - Definition of the particular problem. */ CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ ~CTurbSAVariable(void); - + /*! * \brief Set the harmonic balance source term. * \param[in] val_var - Index of the variable. * \param[in] val_source - Value of the harmonic balance source term. for the index val_var. */ inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } - + /*! * \brief Get the harmonic balance source term. * \param[in] val_var - Index of the variable. @@ -99,27 +99,27 @@ class CTurbSAVariable : public CTurbVariable { * \param[in] val_gamma - New value of the intermittency. */ inline void SetGammaBC(su2double val_gamma) {gamma_BC = val_gamma; } - + /*! * \brief Get the DES length scale * \return Value of the DES length Scale. */ inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } - + /*! * \brief Set the DES Length Scale. */ inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } - + /*! * \brief Set the vortex tilting measure for computation of the EDDES length scale */ void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity); - + /*! * \brief Get the vortex tilting measure for computation of the EDDES length scale * \return Value of the DES length Scale */ inline su2double GetVortex_Tilting() {return Vortex_Tilting; } - + }; diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 53479a82a001..9168414b8657 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -53,13 +53,13 @@ class CTurbSSTVariable : public CTurbVariable { su2double F1, /*!< \brief Menter blending function for blending of k-w and k-eps. */ F2, /*!< \brief Menter blending function for stress limiter. */ CDkw; /*!< \brief Cross-diffusion. */ - + public: /*! * \brief Constructor of the class. */ CTurbSSTVariable(void); - + /*! * \overload * \param[in] val_rho_kine - Turbulent variable value (initialization value). @@ -72,12 +72,12 @@ class CTurbSSTVariable : public CTurbVariable { */ CTurbSSTVariable(su2double val_rho_kine, su2double val_rho_omega, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, su2double *constants, CConfig *config); - + /*! * \brief Destructor of the class. */ ~CTurbSSTVariable(void); - + /*! * \brief Set the blending function for the blending of k-w and k-eps. * \param[in] val_viscosity - Value of the vicosity. @@ -85,17 +85,17 @@ class CTurbSSTVariable : public CTurbVariable { * \param[in] val_density - Value of the density. */ void SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density); - + /*! * \brief Get the first blending function. */ inline su2double GetF1blending(void) { return F1; } - + /*! * \brief Get the second blending function. */ inline su2double GetF2blending(void) { return F2; } - + /*! * \brief Get the value of the cross diffusion of tke and omega. */ diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 1b4b9f5650c7..10eeefedc8f4 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -49,13 +49,13 @@ class CTurbVariable : public CVariable { protected: su2double muT; /*!< \brief Eddy viscosity. */ su2double *HB_Source; /*!< \brief Harmonic Balance source term. */ - + public: /*! * \brief Constructor of the class. */ CTurbVariable(void); - + /*! * \overload * \param[in] val_nDim - Number of dimensions of the problem. @@ -63,18 +63,18 @@ class CTurbVariable : public CVariable { * \param[in] config - Definition of the particular problem. */ CTurbVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ virtual ~CTurbVariable(void); - + /*! * \brief Get the value of the eddy viscosity. * \return the value of the eddy viscosity. */ inline su2double GetmuT() { return muT; } - + /*! * \brief Set the value of the eddy viscosity. * \param[in] val_muT - Value of the eddy viscosity. diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index a7386bafe21d..ab8834b56c49 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -58,7 +58,7 @@ using namespace std; */ class CVariable { protected: - + su2double *Solution, /*!< \brief Solution of the problem. */ *Solution_Old; /*!< \brief Old solution of the problem R-K. */ bool Non_Physical; /*!< \brief Non-physical points in the solution (force first order). */ @@ -92,21 +92,21 @@ class CVariable { note that this variable cannnot be static, it is possible to have different number of nVar in the same problem. */ su2double *Solution_Adj_Old; /*!< \brief Solution of the problem in the previous AD-BGS iteration. */ - + public: - + /*! * \brief Constructor of the class. */ CVariable(void); - + /*! * \overload * \param[in] val_nvar - Number of variables of the problem. * \param[in] config - Definition of the particular problem. */ CVariable(unsigned short val_nvar, CConfig *config); - + /*! * \overload * \param[in] val_nDim - Number of dimensions of the problem. @@ -114,12 +114,12 @@ class CVariable { * \param[in] config - Definition of the particular problem. */ CVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ virtual ~CVariable(void); - + /*! * \brief Set the value of the solution. * \param[in] val_solution - Solution of the problem. @@ -128,40 +128,40 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = val_solution[iVar]; } - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the solution for the index val_var. */ inline void SetSolution(unsigned short val_var, su2double val_solution) {Solution[val_var] = val_solution;} - + /*! * \brief Add the value of the solution vector to the previous solution (incremental approach). * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the solution for the index val_var. */ inline void Add_DeltaSolution(unsigned short val_var, su2double val_solution) {Solution[val_var] += val_solution;} - + /*! * \brief Set the value of the non-physical point. * \param[in] val_value - identification of the non-physical point. */ inline void SetNon_Physical(bool val_value) { Non_Physical = !val_value; } - + /*! * \brief Get the value of the non-physical point. * \return Value of the Non-physical point. */ inline su2double GetNon_Physical(void) { return su2double(Non_Physical); } - + /*! * \brief Get the solution. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline su2double GetSolution(unsigned short val_var) {return Solution[val_var]; } - + /*! * \brief Get the old solution of the problem (Runge-Kutta method) * \param[in] val_var - Index of the variable. @@ -191,7 +191,7 @@ class CVariable { * \param[in] val_solution_old - Value of the old solution for the index val_var. */ inline void SetSolution_Old(unsigned short val_var, su2double val_solution_old) {Solution_Old[val_var] = val_solution_old; } - + /*! * \brief Set old variables to the value of the current variables. */ @@ -218,12 +218,12 @@ class CVariable { /*! * \brief Set the variable solution at time n. - */ + */ inline void Set_Solution_time_n(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = Solution[iVar]; } - + /*! * \brief Set the variable solution at time n-1. */ @@ -231,7 +231,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n1[iVar] = Solution_time_n[iVar]; } - + /*! * \brief Set the variable solution at time n. */ @@ -239,7 +239,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = val_sol[iVar]; } - + /*! * \brief Set the variable solution at time n-1. */ @@ -247,14 +247,14 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n1[iVar] = val_sol[iVar]; } - + /*! * \brief Set to zero the velocity components of the solution. */ inline void SetVelSolutionZero(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = 0.0; } - + /*! * \brief Specify a vector to set the velocity components of the solution. * \param[in] val_vector - Pointer to the vector. @@ -263,14 +263,14 @@ class CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = val_vector[iDim]; } - + /*! * \brief Set to zero velocity components of the solution. */ inline void SetVelSolutionOldZero(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = 0.0; } - + /*! * \brief Specify a vector to set the velocity components of the old solution. * \param[in] val_vector - Pointer to the vector. @@ -279,19 +279,19 @@ class CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution_Old[iDim+1] = val_vector[iDim]; } - + /*! * \brief Set to zero the solution. */ inline void SetSolutionZero(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; } - + /*! * \brief Set to zero a particular solution. */ inline void SetSolutionZero(unsigned short val_var) {Solution[val_var] = 0.0;} - + /*! * \brief Add a value to the solution. * \param[in] val_var - Number of the variable. @@ -307,34 +307,34 @@ class CVariable { * \return Pointer to the old solution vector. */ inline virtual su2double GetSolution_New(unsigned short val_var) {return 0.0; } - + /*! * \brief A virtual member. */ inline virtual su2double GetRoe_Dissipation(void) {return 0.0; } - + /*! * \brief A virtual member. */ inline virtual void SetRoe_Dissipation(su2double val_dissipation) {} - + /*! * \brief A virtual member. */ inline virtual void SetRoe_Dissipation_FD(su2double val_wall_dist) {} - + /*! * \brief A virtual member. * \param[in] val_delta - A scalar measure of the grid size * \param[in] val_const_DES - The DES constant (C_DES) */ inline virtual void SetRoe_Dissipation_NTS(su2double val_delta, su2double val_const_DES) {} - + /*! * \brief A virtual member. */ inline virtual su2double GetDES_LengthScale(void) {return 0.0; } - + /*! * \brief A virtual member. */ @@ -361,11 +361,11 @@ class CVariable { */ inline void AddClippedSolution(unsigned short val_var, su2double val_solution, su2double lowerlimit, su2double upperlimit) { - + su2double val_new = Solution_Old[val_var] + val_solution; Solution[val_var] = min(max(val_new, lowerlimit), upperlimit); } - + /*! * \brief Update the variables using a conservative format. * \param[in] val_var - Index of the variable. @@ -378,29 +378,29 @@ class CVariable { inline void AddConservativeSolution(unsigned short val_var, su2double val_solution, su2double val_density, su2double val_density_old, su2double lowerlimit, su2double upperlimit) { - + su2double val_new = (Solution_Old[val_var]*val_density_old + val_solution)/val_density; Solution[val_var] = min(max(val_new, lowerlimit), upperlimit); } - + /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ inline su2double *GetSolution(void) {return Solution; } - + /*! * \brief Get the old solution of the problem (Runge-Kutta method) * \return Pointer to the old solution vector. */ inline su2double *GetSolution_Old(void) {return Solution_Old; } - + /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline su2double *GetSolution_time_n(void) {return Solution_time_n; } - + /*! * \brief Get the solution at time n-1. * \return Pointer to the solution (at time n-1) vector. @@ -415,7 +415,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Old[iVar] = val_residual_old[iVar]; } - + /*! * \brief Add a value to the summed residual vector. * \param[in] val_residual - Pointer to the residual vector. @@ -424,31 +424,31 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Sum[iVar] += val_residual[iVar]; } - + /*! * \brief Set summed residual vector to zero value. */ inline void SetResidualSumZero(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Residual_Sum[iVar] = 0.0; } - + /*! * \brief Set the velocity of the truncation error to zero. */ inline virtual void SetVel_ResTruncError_Zero(unsigned short iSpecies) {} - + /*! * \brief Get the value of the summed residual. * \return Pointer to the summed residual. */ inline su2double *GetResidual_Sum(void) {return Residual_Sum; } - + /*! * \brief Get the value of the old residual. * \return Pointer to the old residual. */ inline su2double *GetResidual_Old(void) {return Residual_Old; } - + /*! * \brief Get the value of the summed residual. * \param[in] val_residual - Pointer to the summed residual. @@ -457,60 +457,60 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) val_residual[iVar] = Residual_Sum[iVar]; } - + /*! * \brief Set auxiliar variables, we are looking for the gradient of that variable. * \param[in] val_auxvar - Value of the auxiliar variable. */ inline void SetAuxVar(su2double val_auxvar) {AuxVar = val_auxvar; } - + /*! * \brief Get the value of the auxiliary variable. * \return Value of the auxiliary variable. */ inline su2double GetAuxVar(void) {return AuxVar; } - + /*! * \brief Set the auxiliary variable gradient to zero value. */ inline void SetAuxVarGradientZero(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Grad_AuxVar[iDim] = 0.0; } - + /*! * \brief Set the value of the auxiliary variable gradient. * \param[in] val_dim - Index of the dimension. * \param[in] val_gradient - Value of the gradient for the index val_dim. */ inline void SetAuxVarGradient(unsigned short val_dim, su2double val_gradient) {Grad_AuxVar[val_dim] = val_gradient;} - + /*! * \brief Add a value to the auxiliary variable gradient. * \param[in] val_dim - Index of the dimension. * \param[in] val_value - Value of the gradient to be added for the index val_dim. */ inline void AddAuxVarGradient(unsigned short val_dim, su2double val_value) {Grad_AuxVar[val_dim] += val_value;} - + /*! * \brief Subtract a value to the auxiliary variable gradient. * \param[in] val_dim - Index of the dimension. * \param[in] val_value - Value of the gradient to be subtracted for the index val_dim. */ inline void SubtractAuxVarGradient(unsigned short val_dim, su2double val_value) {Grad_AuxVar[val_dim] -= val_value; } - + /*! * \brief Get the gradient of the auxiliary variable. * \return Value of the gradient of the auxiliary variable. */ inline su2double *GetAuxVarGradient(void) {return Grad_AuxVar; } - + /*! * \brief Get the gradient of the auxiliary variable. * \param[in] val_dim - Index of the dimension. * \return Value of the gradient of the auxiliary variable for the dimension val_dim. */ inline su2double GetAuxVarGradient(unsigned short val_dim) {return Grad_AuxVar[val_dim]; } - + /*! * \brief Add a value to the truncation error. * \param[in] val_truncation_error - Value that we want to add to the truncation error. @@ -519,7 +519,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Res_TruncError[iVar] += val_truncation_error[iVar]; } - + /*! * \brief Subtract a value to the truncation error. * \param[in] val_truncation_error - Value that we want to subtract to the truncation error. @@ -528,37 +528,37 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Res_TruncError[iVar] -= val_truncation_error[iVar]; } - + /*! * \brief Set the truncation error to zero. */ inline void SetRes_TruncErrorZero(void) { for (unsigned short iVar = 0; iVar < nVar; iVar++) Res_TruncError[iVar] = 0.0; } - + /*! * \brief Set the truncation error to zero. */ inline void SetVal_ResTruncError_Zero(unsigned short val_var) {Res_TruncError[val_var] = 0.0;} - + /*! * \brief Set the velocity of the truncation error to zero. */ inline void SetVel_ResTruncError_Zero(void) { for (unsigned short iDim = 0; iDim < nDim; iDim++) Res_TruncError[iDim+1] = 0.0; } - + /*! * \brief Set the velocity of the truncation error to zero. */ inline void SetEnergy_ResTruncError_Zero(void) {Res_TruncError[nDim+1] = 0.0;} - + /*! * \brief Get the truncation error. * \return Pointer to the truncation error. */ inline su2double *GetResTruncError(void) {return Res_TruncError; } - + /*! * \brief Get the truncation error. * \param[in] val_trunc_error - Pointer to the truncation error. @@ -567,7 +567,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) val_trunc_error[iVar] = Res_TruncError[iVar]; } - + /*! * \brief Set the gradient of the solution. * \param[in] val_gradient - Gradient of the solution. @@ -577,7 +577,7 @@ class CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Gradient[iVar][iDim] = val_gradient[iVar][iDim]; } - + /*! * \overload * \param[in] val_var - Index of the variable. @@ -585,7 +585,7 @@ class CVariable { * \param[in] val_value - Value of the gradient. */ inline void SetGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient[val_var][val_dim] = val_value; } - + /*! * \brief Set to zero the gradient of the solution. */ @@ -594,7 +594,7 @@ class CVariable { for (unsigned short iDim = 0; iDim < nDim; iDim++) Gradient[iVar][iDim] = 0.0; } - + /*! * \brief Add val_value to the solution gradient. * \param[in] val_var - Index of the variable. @@ -602,7 +602,7 @@ class CVariable { * \param[in] val_value - Value to add to the solution gradient. */ inline void AddGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient[val_var][val_dim] += val_value; } - + /*! * \brief Subtract val_value to the solution gradient. * \param[in] val_var - Index of the variable. @@ -610,13 +610,13 @@ class CVariable { * \param[in] val_value - Value to subtract to the solution gradient. */ inline void SubtractGradient(unsigned short val_var, unsigned short val_dim, su2double val_value) {Gradient[val_var][val_dim] -= val_value; } - + /*! * \brief Get the value of the solution gradient. * \return Value of the gradient solution. */ inline su2double **GetGradient(void) {return Gradient; } - + /*! * \brief Get the value of the solution gradient. * \param[in] val_var - Index of the variable. @@ -624,7 +624,7 @@ class CVariable { * \return Value of the solution gradient. */ inline su2double GetGradient(unsigned short val_var, unsigned short val_dim) {return Gradient[val_var][val_dim]; } - + /*! * \brief Set the value of an entry in the Rmatrix for least squares gradient calculations. * \param[in] val_iDim - Index of the dimension. @@ -632,7 +632,7 @@ class CVariable { * \param[in] val_value - Value of the Rmatrix entry. */ inline void SetRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value) {Rmatrix[val_iDim][val_jDim] = val_value; } - + /*! * \brief Set to zero the Rmatrix for least squares gradient calculations. */ @@ -641,7 +641,7 @@ class CVariable { for (unsigned short jDim = 0; jDim < nDim; jDim++) Rmatrix[iDim][jDim] = 0.0; } - + /*! * \brief Add val_value to the Rmatrix for least squares gradient calculations. * \param[in] val_iDim - Index of the dimension. @@ -649,7 +649,7 @@ class CVariable { * \param[in] val_value - Value to add to the Rmatrix entry. */ inline void AddRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value) {Rmatrix[val_iDim][val_jDim] += val_value; } - + /*! * \brief Get the value of the Rmatrix entry for least squares gradient calculations. * \param[in] val_iDim - Index of the dimension. @@ -657,14 +657,14 @@ class CVariable { * \return Value of the Rmatrix entry. */ inline su2double GetRmatrix(unsigned short val_iDim, unsigned short val_jDim) {return Rmatrix[val_iDim][val_jDim]; } - + /*! * \brief Set the value of the limiter. * \param[in] val_var - Index of the variable. * \param[in] val_limiter - Value of the limiter for the index val_var. */ inline void SetLimiter(unsigned short val_var, su2double val_limiter) {Limiter[val_var] = val_limiter; } - + /*! * \brief Set the value of the limiter. * \param[in] val_species - Index of the species . @@ -672,250 +672,250 @@ class CVariable { * \param[in] val_limiter - Value of the limiter for the index val_var. */ inline virtual void SetLimiterPrimitive(unsigned short val_species, unsigned short val_var, su2double val_limiter) {} - + /*! * \brief Set the value of the limiter. * \param[in] val_species - Index of the species . * \param[in] val_var - Index of the variable. */ inline virtual su2double GetLimiterPrimitive(unsigned short val_species, unsigned short val_var) {return 0.0; } - + /*! * \brief Set the value of the max solution. * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the max solution for the index val_var. */ inline void SetSolution_Max(unsigned short val_var, su2double val_solution) {Solution_Max[val_var] = val_solution; } - + /*! * \brief Set the value of the min solution. * \param[in] val_var - Index of the variable. * \param[in] val_solution - Value of the min solution for the index val_var. */ inline void SetSolution_Min(unsigned short val_var, su2double val_solution) {Solution_Min[val_var] = val_solution; } - + /*! * \brief Get the value of the slope limiter. * \return Pointer to the limiters vector. */ inline su2double *GetLimiter(void) {return Limiter; } - + /*! * \brief Get the value of the slope limiter. * \param[in] val_var - Index of the variable. * \return Value of the limiter vector for the variable val_var. */ inline su2double GetLimiter(unsigned short val_var) {return Limiter[val_var]; } - + /*! * \brief Get the value of the min solution. * \param[in] val_var - Index of the variable. * \return Value of the min solution for the variable val_var. */ inline su2double GetSolution_Max(unsigned short val_var) {return Solution_Max[val_var]; } - + /*! * \brief Get the value of the min solution. * \param[in] val_var - Index of the variable. * \return Value of the min solution for the variable val_var. */ inline su2double GetSolution_Min(unsigned short val_var) {return Solution_Min[val_var]; } - + /*! * \brief Get the value of the preconditioner Beta. * \return Value of the low Mach preconditioner variable Beta */ inline virtual su2double GetPreconditioner_Beta() {return 0; } - + /*! * \brief Set the value of the preconditioner Beta. * \param[in] val_Beta - Value of the low Mach preconditioner variable Beta */ inline virtual void SetPreconditioner_Beta(su2double val_Beta) {} - + /*! * \brief Get the value of the wind gust * \return Value of the wind gust */ inline virtual su2double* GetWindGust() {return 0; } - + /*! * \brief Set the value of the wind gust * \param[in] val_WindGust - Value of the wind gust */ inline virtual void SetWindGust(su2double* val_WindGust) {} - + /*! * \brief Get the value of the derivatives of the wind gust * \return Value of the derivatives of the wind gust */ inline virtual su2double* GetWindGustDer() {return NULL;} - + /*! * \brief Set the value of the derivatives of the wind gust * \param[in] val_WindGust - Value of the derivatives of the wind gust */ inline virtual void SetWindGustDer(su2double* val_WindGust) {} - + /*! * \brief Set the value of the time step. * \param[in] val_delta_time - Value of the time step. */ inline void SetDelta_Time(su2double val_delta_time) {Delta_Time = val_delta_time; } - + /*! * \brief Set the value of the time step. * \param[in] val_delta_time - Value of the time step. * \param[in] iSpecies - Index of the Species . */ inline virtual void SetDelta_Time(su2double val_delta_time, unsigned short iSpecies) {} - + /*! * \brief Get the value of the time step. * \return Value of the time step. */ inline su2double GetDelta_Time(void) {return Delta_Time; } - + /*! * \brief Get the value of the time step. * \param[in] iSpecies - Index of the Species * \return Value of the time step. */ inline virtual su2double GetDelta_Time(unsigned short iSpecies) {return 0;} - + /*! * \brief Set the value of the maximum eigenvalue. * \param[in] val_max_lambda - Value of the maximum eigenvalue. */ inline void SetMax_Lambda(su2double val_max_lambda) {Max_Lambda = val_max_lambda; } - + /*! * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. */ inline void SetMax_Lambda_Inv(su2double val_max_lambda) {Max_Lambda_Inv = val_max_lambda; } - + /*! * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. * \param[in] val_species - Value of the species index to set the maximum eigenvalue. */ inline virtual void SetMax_Lambda_Inv(su2double val_max_lambda, unsigned short val_species) {} - + /*! * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. */ inline void SetMax_Lambda_Visc(su2double val_max_lambda) {Max_Lambda_Visc = val_max_lambda; } - + /*! * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. * \param[in] val_species - Index of the species to set the maximum eigenvalue of the viscous terms. */ inline virtual void SetMax_Lambda_Visc(su2double val_max_lambda, unsigned short val_species) {} - + /*! * \brief Add a value to the maximum eigenvalue. * \param[in] val_max_lambda - Value of the maximum eigenvalue. */ inline void AddMax_Lambda(su2double val_max_lambda) {Max_Lambda += val_max_lambda; } - + /*! * \brief Add a value to the maximum eigenvalue for the inviscid terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. */ inline void AddMax_Lambda_Inv(su2double val_max_lambda) {Max_Lambda_Inv += val_max_lambda; } - + /*! * \brief Add a value to the maximum eigenvalue for the viscous terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. */ inline void AddMax_Lambda_Visc(su2double val_max_lambda) {Max_Lambda_Visc += val_max_lambda; } - + /*! * \brief Get the value of the maximum eigenvalue. * \return the value of the maximum eigenvalue. */ inline su2double GetMax_Lambda(void) {return Max_Lambda; } - + /*! * \brief Get the value of the maximum eigenvalue for the inviscid terms of the PDE. * \return the value of the maximum eigenvalue for the inviscid terms of the PDE. */ inline su2double GetMax_Lambda_Inv(void) {return Max_Lambda_Inv; } - + /*! * \brief Get the value of the maximum eigenvalue for the viscous terms of the PDE. * \return the value of the maximum eigenvalue for the viscous terms of the PDE. */ inline su2double GetMax_Lambda_Visc(void) {return Max_Lambda_Visc; } - + /*! * \brief Set the value of the spectral radius. * \param[in] val_lambda - Value of the spectral radius. */ inline void SetLambda(su2double val_lambda) {Lambda = val_lambda; } - + /*! * \brief Set the value of the spectral radius. * \param[in] val_lambda - Value of the spectral radius. * \param[in] val_iSpecies -Index of species */ inline virtual void SetLambda(su2double val_lambda, unsigned short val_iSpecies) {} - + /*! * \brief Add the value of the spectral radius. * \param[in] val_lambda - Value of the spectral radius. */ inline void AddLambda(su2double val_lambda) {Lambda += val_lambda; } - + /*! * \brief Add the value of the spectral radius. * \param[in] val_iSpecies -Index of species * \param[in] val_lambda - Value of the spectral radius. */ inline virtual void AddLambda(su2double val_lambda, unsigned short val_iSpecies) {} - + /*! * \brief Get the value of the spectral radius. * \return Value of the spectral radius. */ inline su2double GetLambda(void) {return Lambda; } - + /*! * \brief Get the value of the spectral radius. * \param[in] val_iSpecies -Index of species * \return Value of the spectral radius. */ inline virtual su2double GetLambda(unsigned short val_iSpecies) {return 0.0;} - + /*! * \brief Set pressure sensor. * \param[in] val_sensor - Value of the pressure sensor. */ inline void SetSensor(su2double val_sensor) {Sensor = val_sensor; } - + /*! * \brief Set pressure sensor. * \param[in] val_sensor - Value of the pressure sensor. * \param[in] iSpecies - Index of the species. */ inline virtual void SetSensor(su2double val_sensor, unsigned short iSpecies) {} - + /*! * \brief Get the pressure sensor. * \return Value of the pressure sensor. */ inline su2double GetSensor(void) {return Sensor; } - + /*! * \brief Get the pressure sensor. * \param[in] iSpecies - index of species * \return Value of the pressure sensor. */ inline virtual su2double GetSensor(unsigned short iSpecies) {return 0;} - + /*! * \brief Set the value of the undivided laplacian of the solution. * \param[in] val_var - Index of the variable. @@ -924,7 +924,7 @@ class CVariable { inline void SetUndivided_Laplacian(unsigned short val_var, su2double val_undivided_laplacian) { Undivided_Laplacian[val_var] = val_undivided_laplacian; } - + /*! * \brief Add the value of the undivided laplacian of the solution. * \param[in] val_und_lapl - Value of the undivided solution. @@ -933,7 +933,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Undivided_Laplacian[iVar] += val_und_lapl[iVar]; } - + /*! * \brief Subtract the value of the undivided laplacian of the solution. * \param[in] val_und_lapl - Value of the undivided solution. @@ -942,7 +942,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Undivided_Laplacian[iVar] -= val_und_lapl[iVar]; } - + /*! * \brief Subtract the value of the undivided laplacian of the solution. * \param[in] val_var - Variable of the undivided laplacian. @@ -951,7 +951,7 @@ class CVariable { inline void SubtractUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { Undivided_Laplacian[val_var] -= val_und_lapl; } - + /*! * \brief Set the undivided laplacian of the solution to zero. */ @@ -959,7 +959,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Undivided_Laplacian[iVar] = 0.0; } - + /*! * \brief Set a value to the undivided laplacian. * \param[in] val_var - Variable of the undivided laplacian. @@ -968,94 +968,94 @@ class CVariable { inline void SetUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { Undivided_Laplacian[val_var] = val_und_lapl; } - + /*! * \brief Get the undivided laplacian of the solution. * \return Pointer to the undivided laplacian vector. */ inline su2double *GetUndivided_Laplacian(void) {return Undivided_Laplacian; } - + /*! * \brief Get the undivided laplacian of the solution. * \param[in] val_var - Variable of the undivided laplacian. * \return Value of the undivided laplacian vector. */ inline su2double GetUndivided_Laplacian(unsigned short val_var) {return Undivided_Laplacian[val_var]; } - + /*! * \brief A virtual member. * \return Value of the flow density. */ inline virtual su2double GetDensity(void) {return 0; } - + /*! * \brief A virtual member. * \return Old value of the flow density. */ inline virtual su2double GetDensity_Old(void) {return 0; } - + /*! * \brief A virtual member. * \return Value of the flow density. */ inline virtual su2double GetDensity(unsigned short val_iSpecies) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_Species - Index of species s. * \return Value of the mass fraction of species s. */ inline virtual su2double GetMassFraction(unsigned short val_Species) {return 0.0;} - + /*! * \brief A virtual member. * \return Value of the flow energy. */ inline virtual su2double GetEnergy(void) {return 0; } - + /*! * \brief A virtual member. * \return Pointer to the force projection vector. */ inline virtual su2double *GetForceProj_Vector(void) {return NULL; } - + /*! * \brief A virtual member. * \return Pointer to the objective function source. */ inline virtual su2double *GetObjFuncSource(void) {return NULL; } - + /*! * \brief A virtual member. * \return Pointer to the internal boundary vector. */ inline virtual su2double *GetIntBoundary_Jump(void) {return NULL; } - + /*! * \brief A virtual member. * \return Value of the eddy viscosity. */ inline virtual su2double GetEddyViscosity(void) {return 0; } - + /*! * \brief A virtual member. * \return Value of the flow enthalpy. */ inline virtual su2double GetEnthalpy(void) {return 0; } - + /*! * \brief A virtual member. * \return Value of the flow pressure. */ inline virtual su2double GetPressure(void) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_vector - Direction of projection. * \return Value of the projected velocity. */ inline virtual su2double GetProjVel(su2double *val_vector) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_vector - Direction of projection. @@ -1063,93 +1063,93 @@ class CVariable { * \return Value of the projected velocity. */ inline virtual su2double GetProjVel(su2double *val_vector, unsigned short val_species) {return 0; } - + /*! * \brief A virtual member. * \return Value of the sound speed. */ inline virtual su2double GetSoundSpeed(void) {return 0; } - + /*! * \brief A virtual member. * \return Value of the beta for the incompressible flow. */ inline virtual su2double GetBetaInc2(void) { return 0.0; } - + /*! * \brief A virtual member. * \return Value of the temperature. */ inline virtual su2double GetTemperature(void) {return 0.0; } - + /*! * \brief A virtual member. * \return Value of the vibrational-electronic temperature. */ inline virtual su2double GetTemperature_ve(void) {return 0; } - + /*! * \brief A virtual member -- Get the mixture specific heat at constant volume (trans.-rot.). * \return \f$\rho C^{t-r}_{v} \f$ */ inline virtual su2double GetRhoCv_tr(void) {return 0; } - + /*! * \brief A virtual member -- Get the mixture specific heat at constant volume (vib.-el.). * \return \f$\rho C^{v-e}_{v} \f$ */ inline virtual su2double GetRhoCv_ve(void) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_dim - Index of the dimension. * \return Value of the velocity for the dimension val_dim. */ inline virtual su2double GetVelocity(unsigned short val_dim) {return 0; } - + /*! * \brief A virtual member. * \return Norm 2 of the velocity vector. */ inline virtual su2double GetVelocity2(void) {return 0; } - + /*! * \brief A virtual member. * \return Norm 2 of the velocity vector of Fluid val_species. */ inline virtual su2double GetVelocity2(unsigned short val_species) {return 0;} - + /*! * \brief A virtual member. * \return The laminar viscosity of the flow. */ inline virtual su2double GetLaminarViscosity(void) {return 0; } - - + + /*! * \brief A virtual member. * \return The laminar viscosity of the flow. */ inline virtual su2double GetLaminarViscosity(unsigned short iSpecies) {return 0; } - + /*! * \brief A virtual member. * \return Value of the species diffusion coefficient. */ inline virtual su2double* GetDiffusionCoeff(void) {return NULL; } - + /*! * \brief A virtual member. * \return Value of the thermal conductivity (translational/rotational) */ inline virtual su2double GetThermalConductivity(void) {return 0; } - + /*! * \brief A virtual member. * \return Value of the specific heat at constant P */ inline virtual su2double GetSpecificHeatCp(void) {return 0; } - + /*! * \brief A virtual member. * \return Value of the specific heat at constant V @@ -1161,55 +1161,55 @@ class CVariable { * \return Value of the thermal conductivity (vibrational) */ inline virtual su2double GetThermalConductivity_ve(void) {return 0; } - + /*! * \brief A virtual member. * \return Sets separation intermittency */ inline virtual void SetGammaSep(su2double gamma_sep) {} - + /*! * \brief A virtual member. * \return Sets separation intermittency */ inline virtual void SetGammaEff(void) {} - + /*! * \brief A virtual member. * \return Returns intermittency */ inline virtual su2double GetIntermittency() { return 0.0; } - + /*! * \brief A virtual member. * \return Value of the vorticity. */ inline virtual su2double *GetVorticity(void) {return 0; } - + /*! * \brief A virtual member. * \return Value of the rate of strain magnitude. */ inline virtual su2double GetStrainMag(void) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. */ inline virtual void SetForceProj_Vector(su2double *val_ForceProj_Vector) {} - + /*! * \brief A virtual member. * \param[in] val_SetObjFuncSource - Pointer to the objective function source. */ inline virtual void SetObjFuncSource(su2double *val_SetObjFuncSource) {} - + /*! * \brief A virtual member. * \param[in] val_IntBoundary_Jump - Pointer to the interior boundary jump. */ inline virtual void SetIntBoundary_Jump(su2double *val_IntBoundary_Jump) {} - + /*! * \brief A virtual member. * \return Value of the gamma_BC of B-C transition model. @@ -1226,27 +1226,27 @@ class CVariable { * \param[in] eddy_visc - Value of the eddy viscosity. */ inline virtual void SetEddyViscosity(su2double eddy_visc) {} - + /*! * \brief A virtual member. */ inline virtual void SetEnthalpy(void) {} - + /*! * \brief A virtual member. */ inline virtual bool SetPrimVar(CConfig *config) {return true; } - + /*! * \brief A virtual member. */ inline virtual bool SetPrimVar(CFluidModel *FluidModel) {return true; } - + /*! * \brief A virtual member. */ inline virtual void SetSecondaryVar(CFluidModel *FluidModel) {} - + /*! * \brief A virtual member. */ @@ -1256,175 +1256,175 @@ class CVariable { * \brief A virtual member. */ inline virtual void Prim2ConsVar(CConfig *config, su2double *V, su2double *U) {return; } - + /*! * \brief A virtual member. */ inline virtual bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config) {return true; } - + /*! * \brief A virtual member. */ inline virtual bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CConfig *config) {return true; } - + /*! * \brief A virtual member. */ inline virtual bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) {return true; } - + /*! * \brief A virtual member. */ inline virtual bool SetPrimVar(su2double Density_Inf, CConfig *config) {return true; } - + /*! * \brief A virtual member. */ inline virtual bool SetPrimVar(su2double Density_Inf, su2double Viscosity_Inf, su2double eddy_visc, su2double turb_ke, CConfig *config) {return true; } - + /*! * \brief A virtual member. */ inline virtual su2double GetPrimitive(unsigned short val_var) {return 0; } - + /*! * \brief A virtual member. */ inline virtual void SetPrimitive(unsigned short val_var, su2double val_prim) {} - + /*! * \brief A virtual member. */ inline virtual void SetPrimitive(su2double *val_prim) {} - + /*! * \brief A virtual member. */ inline virtual su2double *GetPrimitive(void) {return NULL; } - + /*! * \brief A virtual member. */ inline virtual su2double GetSecondary(unsigned short val_var) {return 0; } - + /*! * \brief A virtual member. */ inline virtual void SetSecondary(unsigned short val_var, su2double val_secondary) {} - + /*! * \brief A virtual member. */ inline virtual void SetSecondary(su2double *val_secondary) {} - + /*! * \brief A virtual member. */ inline virtual void SetdPdrho_e(su2double dPdrho_e) {} - + /*! * \brief A virtual member. */ inline virtual void SetdPde_rho(su2double dPde_rho) {} - + /*! * \brief A virtual member. */ inline virtual void SetdTdrho_e(su2double dTdrho_e) {} - + /*! * \brief A virtual member. */ inline virtual void SetdTde_rho(su2double dTde_rho) {} - + /*! * \brief A virtual member. */ inline virtual void Setdmudrho_T(su2double dmudrho_T) {} - + /*! * \brief A virtual member. */ inline virtual void SetdmudT_rho(su2double dmudT_rho) {} - + /*! * \brief A virtual member. */ inline virtual void Setdktdrho_T(su2double dktdrho_T) {} - + /*! * \brief A virtual member. */ inline virtual void SetdktdT_rho(su2double dktdT_rho) {} - + /*! * \brief A virtual member. */ inline virtual su2double *GetSecondary(void) {return NULL; } - + /*! * \brief A virtual member. */ inline virtual bool SetDensity(su2double val_density) { return false; } - + /*! * \brief A virtual member. */ inline virtual bool SetDensity(void) { return false; } - + /*! * \brief A virtual member. */ inline virtual void SetPressure(void) {} - + /*! * \brief A virtual member. */ inline virtual void SetVelocity(void) {} - + /*! * \brief A virtual member. */ inline virtual void SetBetaInc2(su2double val_betainc2) {} - + /*! * \brief A virtual member. * \param[in] val_phi - Value of the adjoint velocity. */ inline virtual void SetPhi_Old(su2double *val_phi) {} - + /*! * \brief A virtual member. * \param[in] Gamma - Ratio of Specific heats */ inline virtual bool SetPressure(su2double Gamma) {return false; } - + /*! * \brief A virtual member. * \param[in] config */ inline virtual bool SetPressure(CConfig *config) {return false; } - + /*! * \brief A virtual member. */ inline virtual bool SetPressure(su2double Gamma, su2double turb_ke) {return false; } - + /*! * \brief Calculates vib.-el. energy per mass, \f$e^{vib-el}_s\f$, for input species (not including KE) */ inline virtual su2double CalcEve(su2double *V, CConfig *config, unsigned short val_Species) {return 0; } - + /*! * \brief Calculates enthalpy per mass, \f$h_s\f$, for input species (not including KE) */ inline virtual su2double CalcHs(su2double *V, CConfig *config, unsigned short val_Species) {return 0; } - + /*! * \brief Calculates enthalpy per mass, \f$Cv_s\f$, for input species (not including KE) */ inline virtual su2double CalcCvve(su2double val_Tve, CConfig *config, unsigned short val_Species) {return 0; } - + /*! * \brief A virtual member. * \param[in] V @@ -1432,7 +1432,7 @@ class CVariable { * \param[in] dPdU */ inline virtual void CalcdPdU(su2double *V, CConfig *config, su2double *dPdU) {} - + /*! * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ * \param[in] V @@ -1440,7 +1440,7 @@ class CVariable { * \param[in] dTdU */ inline virtual void CalcdTdU(su2double *V, CConfig *config, su2double *dTdU) {} - + /*! * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ * \param[in] V @@ -1448,191 +1448,191 @@ class CVariable { * \param[in] dTdU */ inline virtual void CalcdTvedU(su2double *V, CConfig *config, su2double *dTdU) {} - + /*! * \brief A virtual member. */ inline virtual su2double *GetdPdU(void) { return NULL; } - + /*! * \brief A virtual member. */ inline virtual su2double *GetdTdU(void) { return NULL; } - + /*! * \brief A virtual member. */ inline virtual su2double *GetdTvedU(void) { return NULL; } - + /*! * \brief A virtual member. * \param[in] val_velocity - Value of the velocity. * \param[in] Gamma - Ratio of Specific heats */ inline virtual void SetDeltaPressure(su2double *val_velocity, su2double Gamma) {} - + /*! * \brief A virtual member. * \param[in] Gamma - Ratio of specific heats. */ inline virtual bool SetSoundSpeed(su2double Gamma) {return false; } - + /*! * \brief A virtual member. * \param[in] config - Configuration parameters. */ inline virtual bool SetSoundSpeed(CConfig *config) {return false; } - + /*! * \brief A virtual member. */ inline virtual bool SetSoundSpeed(void) { return false; } - + /*! * \brief A virtual member. * \param[in] Gas_Constant - Value of the Gas Constant */ inline virtual bool SetTemperature(su2double Gas_Constant) {return false; } - + /*! * \brief Sets the vibrational electronic temperature of the flow. * \return Value of the temperature of the flow. */ inline virtual bool SetTemperature_ve(su2double val_Tve) {return false; } - + /*! * \brief A virtual member. * \param[in] config - Configuration parameters. */ inline virtual bool SetTemperature(CConfig *config) {return false; } - + /*! * \brief A virtual member. * \param[in] config - Configuration parameters. */ inline virtual void SetPrimitive(CConfig *config) {} - + /*! * \brief A virtual member. * \param[in] config - Configuration parameters. * \param[in] Coord - Physical coordinates. */ inline virtual void SetPrimitive(CConfig *config, su2double *Coord) {} - + /*! * \brief A virtual member. * \param[in] Temperature_Wall - Value of the Temperature at the wall */ inline virtual void SetWallTemperature(su2double Temperature_Wall) {} - + /*! * \brief A virtual member. * \param[in] Temperature_Wall - Value of the Temperature at the wall */ inline virtual void SetWallTemperature(su2double* Temperature_Wall) {} - + /*! * \brief Set the thermal coefficient. * \param[in] config - Configuration parameters. */ inline virtual void SetThermalCoeff(CConfig *config) {} - + /*! * \brief A virtual member. */ inline virtual void SetStress_FEM(unsigned short iVar, su2double val_stress) {} - + /*! * \brief A virtual member. */ inline virtual void AddStress_FEM(unsigned short iVar, su2double val_stress) {} - + /*! * \brief A virtual member. - + */ inline virtual su2double *GetStress_FEM(void) {return NULL;} - + /*! * \brief A virtual member. */ inline virtual void SetVonMises_Stress(su2double val_stress) {} - + /*! * \brief A virtual member. */ inline virtual su2double GetVonMises_Stress(void) {return 0.0;} - + /*! * \brief A virtual member. */ inline virtual void Add_SurfaceLoad_Res(su2double *val_surfForce) {} - + /*! * \brief A virtual member. */ inline virtual void Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce) {} - + /*! * \brief A virtual member. */ inline virtual su2double Get_SurfaceLoad_Res(unsigned short iVar) {return 0.0;} - + /*! * \brief A virtual member. */ inline virtual void Clear_SurfaceLoad_Res(void) {} - + /*! * \brief A virtual member. */ inline virtual void Set_SurfaceLoad_Res_n(void) {} - + /*! * \brief A virtual member. */ inline virtual su2double Get_SurfaceLoad_Res_n(unsigned short iVar) {return 0.0;} - + /*! * \brief A virtual member. */ inline virtual void Add_BodyForces_Res(su2double *val_bodyForce) {} - + /*! * \brief A virtual member. */ inline virtual su2double Get_BodyForces_Res(unsigned short iVar) {return 0.0;} - + /*! * \brief A virtual member. */ inline virtual void Clear_BodyForces_Res(void) {} - + /*! * \brief A virtual member. */ inline virtual void Set_FlowTraction(su2double *val_flowTraction) {} - + /*! * \brief A virtual member. */ inline virtual void Add_FlowTraction(su2double *val_flowTraction) {} - + /*! * \brief A virtual member. */ inline virtual su2double Get_FlowTraction(unsigned short iVar) {return 0.0;} - + /*! * \brief A virtual member. */ inline virtual void Set_FlowTraction_n(void) {} - + /*! * \brief A virtual member. */ inline virtual su2double Get_FlowTraction_n(unsigned short iVar) {return 0.0;} - + /*! * \brief A virtual member. */ @@ -1642,48 +1642,48 @@ class CVariable { * \brief A virtual member. */ inline virtual bool Get_isVertex(void) {return false;} - + /*! * \brief A virtual member. */ inline virtual void SetVelocity2(void) {} - + /*! * \brief A virtual member. * \param[in] val_velocity - Pointer to the velocity. */ inline virtual void SetVelocity_Old(su2double *val_velocity) {} - + /*! * \brief A virtual member. * \param[in] laminarViscosity */ inline virtual void SetLaminarViscosity(su2double laminarViscosity) {} - + /*! * \brief A virtual member. * \param[in] config - Definition of the particular problem. */ inline virtual void SetLaminarViscosity(CConfig *config) {} - + /*! * \brief A virtual member. * \param[in] thermalConductivity */ inline virtual void SetThermalConductivity(su2double thermalConductivity) {} - + /*! * \brief A virtual member. * \param[in] config - Definition of the particular problem. */ inline virtual void SetThermalConductivity(CConfig *config) {} - + /*! * \brief A virtual member. * \param[in] Cp - Constant pressure specific heat. */ inline virtual void SetSpecificHeatCp(su2double Cp) {} - + /*! * \brief A virtual member. * \param[in] Cv - Constant volume specific heat. @@ -1694,27 +1694,27 @@ class CVariable { * \brief A virtual member. */ inline virtual bool SetVorticity(void) {return false; } - + /*! * \brief A virtual member. */ inline virtual bool SetStrainMag(void) {return false; } - + /*! * \brief A virtual member. */ inline virtual void SetVelSolutionOldDVector(void) {} - + /*! * \brief A virtual member. */ inline virtual void SetVelSolutionDVector(void) {} - + /*! * \brief A virtual member. */ inline virtual void SetGradient_PrimitiveZero(unsigned short val_primvar) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1722,7 +1722,7 @@ class CVariable { * \param[in] val_value - Value to add to the gradient of the primitive variables. */ inline virtual void AddGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1730,7 +1730,7 @@ class CVariable { * \param[in] val_value - Value to subtract to the gradient of the primitive variables. */ inline virtual void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1738,14 +1738,14 @@ class CVariable { * \return Value of the primitive variables gradient. */ inline virtual su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. * \return Value of the primitive variables gradient. */ inline virtual su2double GetLimiter_Primitive(unsigned short val_var) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1753,31 +1753,31 @@ class CVariable { * \param[in] val_value - Value of the gradient. */ inline virtual void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. * \param[in] val_value - Value of the gradient. */ inline virtual void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {} - + /*! * \brief A virtual member. * \return Value of the primitive variables gradient. */ inline virtual su2double **GetGradient_Primitive(void) {return NULL; } - + /*! * \brief A virtual member. * \return Value of the primitive variables gradient. */ inline virtual su2double *GetLimiter_Primitive(void) {return NULL; } - + /*! * \brief A virtual member. */ inline virtual void SetGradient_SecondaryZero(unsigned short val_secondaryvar) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1785,7 +1785,7 @@ class CVariable { * \param[in] val_value - Value to add to the gradient of the Secondary variables. */ inline virtual void AddGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1793,7 +1793,7 @@ class CVariable { * \param[in] val_value - Value to subtract to the gradient of the Secondary variables. */ inline virtual void SubtractGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1801,14 +1801,14 @@ class CVariable { * \return Value of the Secondary variables gradient. */ inline virtual su2double GetGradient_Secondary(unsigned short val_var, unsigned short val_dim) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. * \return Value of the Secondary variables gradient. */ inline virtual su2double GetLimiter_Secondary(unsigned short val_var) {return 0; } - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. @@ -1816,26 +1816,26 @@ class CVariable { * \param[in] val_value - Value of the gradient. */ inline virtual void SetGradient_Secondary(unsigned short val_var, unsigned short val_dim, su2double val_value) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. * \param[in] val_value - Value of the gradient. */ inline virtual void SetLimiter_Secondary(unsigned short val_var, su2double val_value) {} - + /*! * \brief A virtual member. * \return Value of the Secondary variables gradient. */ inline virtual su2double **GetGradient_Secondary(void) {return NULL; } - + /*! * \brief A virtual member. * \return Value of the Secondary variables gradient. */ inline virtual su2double *GetLimiter_Secondary(void) {return NULL; } - + /*! * \brief Set the blending function for the blending of k-w and k-eps. * \param[in] val_viscosity - Value of the vicosity. @@ -1843,238 +1843,238 @@ class CVariable { * \param[in] val_dist - Value of the distance to the wall. */ inline virtual void SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density) {} - + /*! * \brief Get the first blending function of the SST model. */ inline virtual su2double GetF1blending(void) {return 0; } - + /*! * \brief Get the second blending function of the SST model. */ inline virtual su2double GetF2blending(void) {return 0; } - + /*! * \brief Get the value of the cross diffusion of tke and omega. */ inline virtual su2double GetCrossDiff(void) { return 0.0; } - + /*! * \brief Get the value of the eddy viscosity. * \return the value of the eddy viscosity. */ inline virtual su2double GetmuT(void) { return 0.0; } - + /*! * \brief Set the value of the eddy viscosity. * \param[in] val_muT */ inline virtual void SetmuT(su2double val_muT) {} - + /*! * \brief Add a value to the maximum eigenvalue for the inviscid terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the inviscid terms of the PDE. * \param[in] iSpecies - Value of iSpecies to which the eigenvalue belongs */ inline virtual void AddMax_Lambda_Inv(su2double val_max_lambda, unsigned short iSpecies) {} - + /*! * \brief Add a value to the maximum eigenvalue for the viscous terms of the PDE. * \param[in] val_max_lambda - Value of the maximum eigenvalue for the viscous terms of the PDE. * \param[in] iSpecies - Value of iSpecies to which the eigenvalue belongs */ inline virtual void AddMax_Lambda_Visc(su2double val_max_lambda, unsigned short iSpecies) {} - + /*! * \brief A virtual member. * \param[in] val_var - Index of the variable. * \param[in] val_source - Value of the harmonic balance source. */ inline virtual void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {} - + /*! * \brief A virtual member. */ inline virtual su2double GetHarmonicBalance_Source(unsigned short val_var) {return 0; } - + /*! * \brief Set the Eddy Viscosity Sensitivity of the problem. * \param[in] val_EddyViscSens - Eddy Viscosity Sensitivity. * \param[in] numTotalVar - Number of variables. */ inline virtual void SetEddyViscSens(su2double *val_EddyViscSens, unsigned short numTotalVar) {} - + /*! * \brief Get the Eddy Viscosity Sensitivity of the problem. * \return Pointer to the Eddy Viscosity Sensitivity. */ inline virtual su2double *GetEddyViscSens(void) {return NULL; } - + /*! * \brief A virtual member. Set the direct solution for the adjoint solver. * \param[in] val_solution_direct - Value of the direct solution. */ inline virtual void SetSolution_Direct(su2double *val_solution_direct) {} - + /*! * \brief A virtual member. Get the direct solution for the adjoint solver. * \return Pointer to the direct solution vector. */ inline virtual su2double *GetSolution_Direct(void) { return NULL; } - + /*! * \brief A virtual member. Set the restart geometry (coordinate of the converged solution) * \param[in] val_coordinate_direct - Value of the restart coordinate. */ inline virtual void SetGeometry_Direct(su2double *val_coordinate_direct) {} - + /*! * \brief A virtual member. Get the restart geometry (coordinate of the converged solution). * \return Pointer to the restart coordinate vector. */ inline virtual su2double *GetGeometry_Direct(void) { return NULL; } - + /*! * \brief A virtual member. Get the restart geometry (coordinate of the converged solution). * \return Coordinate of the direct solver restart for . */ inline virtual su2double GetGeometry_Direct(unsigned short val_dim) {return 0.0; } - + /*! * \brief A virtual member. Get the geometry solution. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline virtual su2double GetSolution_Geometry(unsigned short val_var) {return 0.0;} - + /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). * \param[in] val_solution - Solution of the problem (acceleration). */ inline virtual void SetSolution_Geometry(su2double *val_solution_geometry) {} - + /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). * \param[in] val_solution - Solution of the problem (acceleration). */ inline virtual void SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry) {} - + /*! * \brief A virtual member. Get the geometry solution. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline virtual su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return 0.0;} - + /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). * \param[in] val_solution - Solution of the problem (acceleration). */ inline virtual void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) {} - + /*! * \brief A virtual member. Get the geometry solution. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline virtual su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) {return 0.0;} - + /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). * \param[in] val_solution - Solution of the problem (acceleration). */ inline virtual void SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der) {} - + /*! * \brief A virtual member. Set the value of the old geometry solution (adjoint). */ inline virtual void Set_OldSolution_Geometry(void) {} - + /*! * \brief A virtual member. Get the value of the old geometry solution (adjoint). * \param[out] val_solution - old adjoint solution for coordinate iDim */ inline virtual su2double Get_OldSolution_Geometry(unsigned short iDim) {return 0.0;} - + /*! * \brief A virtual member. Set the value of the old geometry solution (adjoint). */ inline virtual void Set_BGSSolution(unsigned short iDim, su2double val_solution) {} - + /*! * \brief A virtual member. Set the value of the old geometry solution (adjoint). */ inline virtual void Set_BGSSolution_k(void) {} - + /*! * \brief A virtual member. Get the value of the old geometry solution (adjoint). * \param[out] val_solution - old adjoint solution for coordinate iDim */ inline virtual su2double Get_BGSSolution(unsigned short iDim) {return 0.0;} - + /*! * \brief A virtual member. Get the value of the old geometry solution (adjoint). * \param[out] val_solution - old adjoint solution for coordinate iDim */ inline virtual su2double Get_BGSSolution_k(unsigned short iDim) {return 0.0;} - + /*! * \brief A virtual member. Set the value of the old geometry solution (adjoint). */ inline virtual void Set_BGSSolution_Geometry(void) {} - + /*! * \brief A virtual member. Get the value of the old geometry solution (adjoint). * \param[out] val_solution - old adjoint solution for coordinate iDim */ inline virtual su2double Get_BGSSolution_Geometry(unsigned short iDim) {return 0.0;} - + /*! * \brief A virtual member. Set the contribution of crossed terms into the derivative. */ inline virtual void SetCross_Term_Derivative(unsigned short iVar, su2double der) {} - + /*! * \brief A virtual member. Get the contribution of crossed terms into the derivative. * \return The contribution of crossed terms into the derivative. */ inline virtual su2double GetCross_Term_Derivative(unsigned short iVar) {return 0.0; } - + /*! * \brief A virtual member. Set the direct velocity solution for the adjoint solver. * \param[in] val_solution_direct - Value of the direct velocity solution. */ inline virtual void SetSolution_Vel_Direct(su2double *sol) {} - + /*! * \brief A virtual member. Set the direct acceleration solution for the adjoint solver. * \param[in] val_solution_direct - Value of the direct acceleration solution. */ inline virtual void SetSolution_Accel_Direct(su2double *sol) {} - + /*! * \brief A virtual member. Get the direct velocity solution for the adjoint solver. * \return Pointer to the direct velocity solution vector. */ inline virtual su2double* GetSolution_Vel_Direct() {return NULL; } - + /*! * \brief A virtual member. Get the direct acceleraction solution for the adjoint solver. * \return Pointer to the direct acceleraction solution vector. */ inline virtual su2double* GetSolution_Accel_Direct() {return NULL; } - + /*! * \brief Set the value of the old solution. */ inline virtual void SetSolution_time_n(void) {} - + /*! * \brief Set the value of the old solution. * \param[in] val_solution_time_n - Pointer to the residual vector. */ inline virtual void SetSolution_time_n(unsigned short val_var, su2double val_solution) {} - + /*! * \brief Set the value of the old solution. * \param[in] val_solution_old - Pointer to the residual vector. @@ -2083,224 +2083,224 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = val_solution_time_n[iVar]; } - + /*! * \brief Set the value of the velocity (Structural Analysis). * \param[in] val_solution - Solution of the problem (velocity). */ inline virtual void SetSolution_Vel(su2double *val_solution) {} - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution_vel - Value of the solution for the index val_var. */ inline virtual void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) {} - + /*! * \brief Set the value of the velocity (Structural Analysis) at time n. * \param[in] val_solution_vel_time_n - Value of the old solution. */ inline virtual void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) {} - + /*! * \brief Set the value of the velocity (Structural Analysis) at time n. */ inline virtual void SetSolution_Vel_time_n(void) {} - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution_vel_time_n - Value of the old solution for the index val_var. */ inline virtual void SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n) {} - + /*! * \brief Get the solution at time n. * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline su2double GetSolution_time_n(unsigned short val_var) {return Solution_time_n[val_var]; } - + /*! * \brief Get the velocity (Structural Analysis). * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline virtual su2double GetSolution_Vel(unsigned short val_var) {return 0; } - + /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ inline virtual su2double *GetSolution_Vel(void) {return NULL; } - + /*! * \brief Get the velocity of the nodes (Structural Analysis) at time n. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline virtual su2double GetSolution_Vel_time_n(unsigned short val_var) {return 0; } - + /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline virtual su2double *GetSolution_Vel_time_n(void) {return NULL; } - - + + /*! * \brief Set the value of the acceleration (Structural Analysis). * \param[in] val_solution_accel - Solution of the problem (acceleration). */ inline virtual void SetSolution_Accel(su2double *val_solution_accel) {} - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution_accel - Value of the solution for the index val_var. */ inline virtual void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) {} - + /*! * \brief Set the value of the acceleration (Structural Analysis) at time n. * \param[in] val_solution_accel_time_n - Pointer to the residual vector. */ inline virtual void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) {} - + /*! * \brief Set the value of the acceleration (Structural Analysis) at time n. */ inline virtual void SetSolution_Accel_time_n(void) {} - + /*! * \overload * \param[in] val_var - Index of the variable. * \param[in] val_solution_accel_time_n - Value of the old solution for the index val_var. */ inline virtual void SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n) {} - + /*! * \brief Get the acceleration (Structural Analysis). * \param[in] val_var - Index of the variable. * \return Value of the solution for the index val_var. */ inline virtual su2double GetSolution_Accel(unsigned short val_var) {return 0; } - + /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ inline virtual su2double *GetSolution_Accel(void) {return NULL; } - + /*! * \brief Get the acceleration of the nodes (Structural Analysis) at time n. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline virtual su2double GetSolution_Accel_time_n(unsigned short val_var) {return 0; } - + /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline virtual su2double *GetSolution_Accel_time_n(void) {return NULL; } - + /*! * \brief A virtual member. */ inline virtual void Set_OldSolution_Vel(void) {} - + /*! * \brief A virtual member. */ inline virtual void Set_OldSolution_Accel(void) {} - + /*! * \brief A virtual member. Set the value of the solution predictor. */ inline virtual void SetSolution_Pred(void) {} - + /*! * \brief A virtual member. Set the value of the old solution. * \param[in] val_solution_pred - Pointer to the residual vector. */ inline virtual void SetSolution_Pred(su2double *val_solution_pred) {} - + /*! * \brief A virtual member. Set the value of the solution predicted. * \param[in] val_solution_old - Pointer to the residual vector. */ inline virtual void SetSolution_Pred(unsigned short val_var, su2double val_solution_pred) {} - + /*! * \brief A virtual member. Get the value of the solution predictor. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline virtual su2double GetSolution_Pred(unsigned short val_var) {return 0.0; } - + /*! * \brief A virtual member. Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline virtual su2double *GetSolution_Pred(void) {return NULL; } - + /*! * \brief A virtual member. Set the value of the solution predictor. */ inline virtual void SetSolution_Pred_Old(void) {} - + /*! * \brief A virtual member. Set the value of the old solution. * \param[in] val_solution_pred_Old - Pointer to the residual vector. */ inline virtual void SetSolution_Pred_Old(su2double *val_solution_pred_Old) {} - + /*! * \brief A virtual member. Set the value of the old solution predicted. * \param[in] val_solution_pred_old - Pointer to the residual vector. */ inline virtual void SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old) {} - + /*! * \brief A virtual member. Get the value of the solution predictor. * \param[in] val_var - Index of the variable. * \return Pointer to the old solution vector. */ inline virtual su2double GetSolution_Pred_Old(unsigned short val_var) {return 0.0; } - + /*! * \brief A virtual member. Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ inline virtual su2double *GetSolution_Pred_Old(void) {return NULL; } - + /*! * \brief A virtual member. */ inline virtual void SetReference_Geometry(unsigned short iVar, su2double ref_geometry) {} - + /*! * \brief A virtual member. */ inline virtual su2double *GetReference_Geometry(void) {return NULL; } - + /*! * \brief A virtual member. */ inline virtual void SetPrestretch(unsigned short iVar, su2double val_prestretch) {} - + /*! * \brief A virtual member. */ inline virtual su2double *GetPrestretch(void) {return NULL; } - + /*! * \brief A virtual member. */ inline virtual su2double GetPrestretch(unsigned short iVar) {return 0.0; } - + /*! * \brief A virtual member. */ @@ -2383,7 +2383,7 @@ class CVariable { else { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterOutput(Solution[iVar]);} } - + /*! * \brief Register the variables in the solution_time_n array as input/output variable. */ @@ -2391,7 +2391,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterInput(Solution_time_n[iVar]); } - + /*! * \brief Register the variables in the solution_time_n1 array as input/output variable. */ @@ -2399,7 +2399,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) AD::RegisterInput(Solution_time_n1[iVar]); } - + /*! * \brief Set the adjoint values of the solution. * \param[in] adj_sol - The adjoint values of the solution. @@ -2408,7 +2408,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); } - + /*! * \brief Get the adjoint values of the solution. * \param[out] adj_sol - The adjoint values of the solution. @@ -2417,7 +2417,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution[iVar]); } - + /*! * \brief Set the adjoint values of the solution at time n. * \param[in] adj_sol - The adjoint values of the solution. @@ -2426,7 +2426,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_time_n[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); } - + /*! * \brief Get the adjoint values of the solution at time n. * \param[out] adj_sol - The adjoint values of the solution. @@ -2435,7 +2435,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n[iVar]); } - + /*! * \brief Set the adjoint values of the solution at time n-1. * \param[in] adj_sol - The adjoint values of the solution. @@ -2444,7 +2444,7 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_time_n1[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); } - + /*! * \brief Get the adjoint values of the solution at time n-1. * \param[out] adj_sol - The adjoint values of the solution. @@ -2453,27 +2453,27 @@ class CVariable { for (unsigned short iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n1[iVar]); } - + /*! * \brief Set the sensitivity at the node * \param[in] iDim - spacial component * \param[in] val - value of the Sensitivity */ inline virtual void SetSensitivity(unsigned short iDim, su2double val) {} - + /*! * \brief Get the Sensitivity at the node * \param[in] iDim - spacial component * \return value of the Sensitivity */ inline virtual su2double GetSensitivity(unsigned short iDim) {return 0.0; } - + inline virtual void SetDual_Time_Derivative(unsigned short iVar, su2double der) {} - + inline virtual void SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {} - + inline virtual su2double GetDual_Time_Derivative(unsigned short iVar) {return 0.0;} - + inline virtual su2double GetDual_Time_Derivative_n(unsigned short iVar) {return 0.0;} inline virtual void SetTauWall(su2double val_tau_wall) {} @@ -2483,7 +2483,7 @@ class CVariable { inline virtual void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity) {} inline virtual su2double GetVortex_Tilting() {return 0.0; } - + inline virtual void SetDynamic_Derivative(unsigned short iVar, su2double der) {} inline virtual void SetDynamic_Derivative_n(unsigned short iVar, su2double der) {} diff --git a/SU2_CFD/src/variables/CAdjEulerVariable.cpp b/SU2_CFD/src/variables/CAdjEulerVariable.cpp index 0abc67417c8a..bca84cd6548f 100644 --- a/SU2_CFD/src/variables/CAdjEulerVariable.cpp +++ b/SU2_CFD/src/variables/CAdjEulerVariable.cpp @@ -38,52 +38,52 @@ #include "../../include/variables/CAdjEulerVariable.hpp" CAdjEulerVariable::CAdjEulerVariable(void) : CVariable() { - + /*--- Array initialization ---*/ Psi = NULL; ForceProj_Vector = NULL; ObjFuncSource = NULL; IntBoundary_Jump = NULL; HB_Source = NULL; - + } CAdjEulerVariable::CAdjEulerVariable(su2double val_psirho, su2double *val_phi, su2double val_psie, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { - + unsigned short iVar, iDim, iMesh, nMGSmooth = 0; - + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); - + /*--- Array initialization ---*/ Psi = NULL; ForceProj_Vector = NULL; ObjFuncSource = NULL; IntBoundary_Jump = NULL; HB_Source = NULL; - + /*--- Allocate residual structures ---*/ Res_TruncError = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Res_TruncError[iVar] = 0.0; } - + /*--- Only for residual smoothing (multigrid) ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) nMGSmooth += config->GetMG_CorrecSmooth(iMesh); - + if (nMGSmooth > 0) { Residual_Sum = new su2double [nVar]; Residual_Old = new su2double [nVar]; } - + /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ if (config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED) Undivided_Laplacian = new su2double [nVar]; - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ Limiter = new su2double [nVar]; @@ -94,7 +94,7 @@ CAdjEulerVariable::CAdjEulerVariable(su2double val_psirho, su2double *val_phi, s Solution_Max[iVar] = 0.0; Solution_Min[iVar] = 0.0; } - + /*--- Allocate and initialize solution ---*/ Solution[0] = val_psirho; Solution_Old[0] = val_psirho; Solution[nVar-1] = val_psie; Solution_Old[nVar-1] = val_psie; @@ -116,64 +116,64 @@ CAdjEulerVariable::CAdjEulerVariable(su2double val_psirho, su2double *val_phi, s } - + /*--- Allocate auxiliar vector for sensitivity computation ---*/ Grad_AuxVar = new su2double [nDim]; - + /*--- Allocate and initialize projection vector for wall boundary condition ---*/ ForceProj_Vector = new su2double [nDim]; for (iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = 0.0; - + /*--- Allocate and initialize interior boundary jump vector for near field boundary condition ---*/ IntBoundary_Jump = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) IntBoundary_Jump[iVar] = 0.0; - + /*--- Allocate space for the harmonic balance source terms ---*/ if (config->GetUnsteady_Simulation() == HARMONIC_BALANCE) { HB_Source = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) HB_Source[iVar] = 0.0; } - + } CAdjEulerVariable::CAdjEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { - + unsigned short iVar, iDim, iMesh, nMGSmooth = 0; - + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); - + /*--- Array initialization ---*/ Psi = NULL; ForceProj_Vector = NULL; ObjFuncSource = NULL; IntBoundary_Jump = NULL; HB_Source = NULL; - + /*--- Allocate residual structures ---*/ Res_TruncError = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Res_TruncError[iVar] = 0.0; } - + /*--- Only for residual smoothing (multigrid) ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) nMGSmooth += config->GetMG_CorrecSmooth(iMesh); - + if (nMGSmooth > 0) { Residual_Sum = new su2double [nVar]; Residual_Old = new su2double [nVar]; } - + /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ if (config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED) Undivided_Laplacian = new su2double [nVar]; - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ Limiter = new su2double [nVar]; @@ -184,77 +184,77 @@ CAdjEulerVariable::CAdjEulerVariable(su2double *val_solution, unsigned short val Solution_Max[iVar] = 0.0; Solution_Min[iVar] = 0.0; } - + /*--- Solution initialization ---*/ for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] = val_solution[iVar]; Solution_Old[iVar] = val_solution[iVar]; } - + /*--- Allocate and initializate solution for dual time strategy ---*/ if (dual_time) { Solution_time_n = new su2double [nVar]; Solution_time_n1 = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Solution_time_n[iVar] = val_solution[iVar]; Solution_time_n1[iVar] = val_solution[iVar]; } } - + /*--- Allocate auxiliar vector for sensitivity computation ---*/ Grad_AuxVar = new su2double [nDim]; - + /*--- Allocate and initializate projection vector for wall boundary condition ---*/ ForceProj_Vector = new su2double [nDim]; for (iDim = 0; iDim < nDim; iDim++) ForceProj_Vector[iDim] = 0.0; - + /*--- Allocate and initializate interior boundary jump vector for near field boundary condition ---*/ IntBoundary_Jump = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) IntBoundary_Jump[iVar] = 0.0; - + /*--- Allocate space for the harmonic balance source terms ---*/ if (config->GetUnsteady_Simulation() == HARMONIC_BALANCE) { HB_Source = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) HB_Source[iVar] = 0.0; } - + } CAdjEulerVariable::~CAdjEulerVariable(void) { - + if (Psi != NULL) delete [] Psi; if (ForceProj_Vector != NULL) delete [] ForceProj_Vector; if (ObjFuncSource != NULL) delete [] ObjFuncSource; if (IntBoundary_Jump != NULL) delete [] IntBoundary_Jump; if (HB_Source != NULL) delete [] HB_Source; - + } bool CAdjEulerVariable::SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config) { unsigned short iVar; bool check_dens = false, RightVol = true; - + su2double adj_limit = config->GetAdjointLimit(); - + check_dens = (fabs(Solution[0]) > adj_limit); - + /*--- Check that the adjoint solution is bounded ---*/ - + if (check_dens) { - + /*--- Copy the old solution ---*/ - + for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Solution_Old[iVar]; - + RightVol = false; - + } - + return RightVol; - + } diff --git a/SU2_CFD/src/variables/CAdjTurbVariable.cpp b/SU2_CFD/src/variables/CAdjTurbVariable.cpp index 06f9c7fe6d83..fa827c46fafe 100644 --- a/SU2_CFD/src/variables/CAdjTurbVariable.cpp +++ b/SU2_CFD/src/variables/CAdjTurbVariable.cpp @@ -38,14 +38,14 @@ #include "../../include/variables/CAdjTurbVariable.hpp" CAdjTurbVariable::CAdjTurbVariable(void) : CVariable() { - + /*--- Array initialization ---*/ - + dmuT_dUTvar = NULL; dRTstar_dUTvar = NULL; dFT_dUTvar = NULL; EddyViscSens = NULL; - + } CAdjTurbVariable::CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_nDim, unsigned short val_nvar, @@ -53,21 +53,21 @@ CAdjTurbVariable::CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_n unsigned short iVar; /*--- Array initialization ---*/ - + dmuT_dUTvar = NULL; dRTstar_dUTvar = NULL; dFT_dUTvar = NULL; EddyViscSens = NULL; - + /*--- Initialization of variables ---*/ - + for (unsigned short iVar = 0; iVar < nVar; iVar++) { Solution[iVar] = val_psinu_inf; Solution_Old[iVar] = val_psinu_inf; } - + Residual_Old = new su2double [nVar]; - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ @@ -78,8 +78,8 @@ CAdjTurbVariable::CAdjTurbVariable(su2double val_psinu_inf, unsigned short val_n } CAdjTurbVariable::~CAdjTurbVariable(void) { - + if (dmuT_dUTvar != NULL) delete [] dmuT_dUTvar; if (EddyViscSens != NULL) delete [] EddyViscSens; - + } diff --git a/SU2_CFD/src/variables/CBaselineVariable.cpp b/SU2_CFD/src/variables/CBaselineVariable.cpp index d292b0c9d712..31aaf5c47eaf 100644 --- a/SU2_CFD/src/variables/CBaselineVariable.cpp +++ b/SU2_CFD/src/variables/CBaselineVariable.cpp @@ -40,10 +40,10 @@ CBaselineVariable::CBaselineVariable(void) : CVariable() { } CBaselineVariable::CBaselineVariable(su2double *val_solution, unsigned short val_nvar, CConfig *config) : CVariable(val_nvar, config) { - + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = val_solution[iVar]; - + } CBaselineVariable::~CBaselineVariable(void) { } diff --git a/SU2_CFD/src/variables/CDiscAdjVariable.cpp b/SU2_CFD/src/variables/CDiscAdjVariable.cpp index aab54d19e93c..a9a783eac4a7 100644 --- a/SU2_CFD/src/variables/CDiscAdjVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjVariable.cpp @@ -45,7 +45,7 @@ CDiscAdjVariable::CDiscAdjVariable() : CVariable() { Sensitivity = NULL; DualTime_Derivative = NULL; - DualTime_Derivative_n = NULL; + DualTime_Derivative_n = NULL; } diff --git a/SU2_CFD/src/variables/CEulerVariable.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp index d06207a860c7..9245d99ec8dc 100644 --- a/SU2_CFD/src/variables/CEulerVariable.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -38,30 +38,30 @@ #include "../../include/variables/CEulerVariable.hpp" CEulerVariable::CEulerVariable(void) : CVariable() { - + /*--- Array initialization ---*/ - + HB_Source = NULL; Primitive = NULL; Secondary = NULL; - + Gradient_Primitive = NULL; Gradient_Secondary = NULL; - + Limiter_Primitive = NULL; Limiter_Secondary = NULL; - + WindGust = NULL; WindGustDer = NULL; - + nPrimVar = 0; nPrimVarGrad = 0; - + nSecondaryVar = 0; nSecondaryVarGrad = 0; - + Undivided_Laplacian = NULL; - + Solution_New = NULL; Solution_BGS_k = NULL; @@ -70,7 +70,7 @@ CEulerVariable::CEulerVariable(void) : CVariable() { CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, su2double val_energy, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { unsigned short iVar, iDim, iMesh, nMGSmooth = 0; - + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); bool viscous = config->GetViscous(); @@ -80,23 +80,23 @@ CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, s bool multizone = config->GetMultizone_Problem(); /*--- Array initialization ---*/ - + HB_Source = NULL; Primitive = NULL; Secondary = NULL; - + Gradient_Primitive = NULL; Gradient_Secondary = NULL; - + Limiter_Primitive = NULL; Limiter_Secondary = NULL; - + WindGust = NULL; WindGustDer = NULL; - + nPrimVar = 0; nPrimVarGrad = 0; - + nSecondaryVar = 0; nSecondaryVarGrad = 0; @@ -111,36 +111,36 @@ CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, s /*--- Allocate residual structures ---*/ - + Res_TruncError = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Res_TruncError[iVar] = 0.0; } - + /*--- Only for residual smoothing (multigrid) ---*/ - + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) nMGSmooth += config->GetMG_CorrecSmooth(iMesh); - + if (nMGSmooth > 0) { Residual_Sum = new su2double [nVar]; Residual_Old = new su2double [nVar]; } - + /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ - + if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) { Undivided_Laplacian = new su2double [nVar]; } - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ - + Limiter_Primitive = new su2double [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) Limiter_Primitive[iVar] = 0.0; - + Limiter_Secondary = new su2double [nSecondaryVarGrad]; for (iVar = 0; iVar < nSecondaryVarGrad; iVar++) Limiter_Secondary[iVar] = 0.0; @@ -148,14 +148,14 @@ CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, s Limiter = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) Limiter[iVar] = 0.0; - + Solution_Max = new su2double [nPrimVarGrad]; Solution_Min = new su2double [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Solution_Max[iVar] = 0.0; Solution_Min[iVar] = 0.0; } - + /*--- Solution and old solution initialization ---*/ Solution[0] = val_density; @@ -179,7 +179,7 @@ CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, s } /*--- Allocate and initialize solution for dual time strategy ---*/ - + if (dual_time) { Solution_time_n[0] = val_density; Solution_time_n1[0] = val_density; @@ -191,32 +191,32 @@ CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, s Solution_time_n1[nVar-1] = val_density*val_energy; } - + /*--- Allocate space for the harmonic balance source terms ---*/ - + if (config->GetUnsteady_Simulation() == HARMONIC_BALANCE) { HB_Source = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) HB_Source[iVar] = 0.0; } /*--- Allocate vector for wind gust and wind gust derivative field ---*/ - + if (windgust) { WindGust = new su2double [nDim]; WindGustDer = new su2double [nDim+1]; } - + /*--- Incompressible flow, primitive variables nDim+3, (P, vx, vy, vz, rho, beta) ---*/ - + Primitive = new su2double [nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive[iVar] = 0.0; - + Secondary = new su2double [nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary[iVar] = 0.0; /*--- Compressible flow, gradients primitive variables nDim+4, (T, vx, vy, vz, P, rho, h) We need P, and rho for running the adjoint problem ---*/ - + Gradient_Primitive = new su2double* [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Gradient_Primitive[iVar] = new su2double [nDim]; @@ -245,7 +245,7 @@ CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, s CEulerVariable::CEulerVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { unsigned short iVar, iDim, iMesh, nMGSmooth = 0; - + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); bool viscous = config->GetViscous(); @@ -255,60 +255,60 @@ CEulerVariable::CEulerVariable(su2double *val_solution, unsigned short val_nDim, bool multizone = config->GetMultizone_Problem(); /*--- Array initialization ---*/ - + HB_Source = NULL; Primitive = NULL; Secondary = NULL; - + Gradient_Primitive = NULL; Gradient_Secondary = NULL; - + Limiter_Primitive = NULL; Limiter_Secondary = NULL; - + WindGust = NULL; WindGustDer = NULL; - + nPrimVar = 0; nPrimVarGrad = 0; - + nSecondaryVar = 0; nSecondaryVarGrad = 0; - + Undivided_Laplacian = NULL; Solution_New = NULL; - + /*--- Allocate and initialize the primitive variables and gradients ---*/ - + nPrimVar = nDim+9; nPrimVarGrad = nDim+4; if (viscous) { nSecondaryVar = 8; nSecondaryVarGrad = 2; } else { nSecondaryVar = 2; nSecondaryVarGrad = 2; } - + /*--- Allocate residual structures ---*/ - + Res_TruncError = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Res_TruncError[iVar] = 0.0; } - + /*--- Only for residual smoothing (multigrid) ---*/ - + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) nMGSmooth += config->GetMG_CorrecSmooth(iMesh); - + if (nMGSmooth > 0) { Residual_Sum = new su2double [nVar]; Residual_Old = new su2double [nVar]; } - + /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ - + if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) Undivided_Laplacian = new su2double [nVar]; - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ @@ -323,16 +323,16 @@ CEulerVariable::CEulerVariable(su2double *val_solution, unsigned short val_nDim, Limiter = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) Limiter[iVar] = 0.0; - + Solution_Max = new su2double [nPrimVarGrad]; Solution_Min = new su2double [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Solution_Max[iVar] = 0.0; Solution_Min[iVar] = 0.0; } - + /*--- Solution initialization ---*/ - + for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] = val_solution[iVar]; Solution_Old[iVar] = val_solution[iVar]; @@ -348,43 +348,43 @@ CEulerVariable::CEulerVariable(su2double *val_solution, unsigned short val_nDim, } /*--- Allocate and initializate solution for dual time strategy ---*/ - + if (dual_time) { Solution_time_n = new su2double [nVar]; Solution_time_n1 = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Solution_time_n[iVar] = val_solution[iVar]; Solution_time_n1[iVar] = val_solution[iVar]; } } - + /*--- Allocate space for the harmonic balance source terms ---*/ - + if (config->GetUnsteady_Simulation() == HARMONIC_BALANCE) { HB_Source = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) HB_Source[iVar] = 0.0; } /*--- Allocate vector for wind gust and wind gust derivative field ---*/ - + if (windgust) { WindGust = new su2double [nDim]; WindGustDer = new su2double [nDim+1]; } - + /*--- Compressible flow, primitive variables nDim+5, (T, vx, vy, vz, P, rho, h, c) ---*/ - + Primitive = new su2double [nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive[iVar] = 0.0; - + Secondary = new su2double [nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary[iVar] = 0.0; /*--- Compressible flow, gradients primitive variables nDim+4, (T, vx, vy, vz, P, rho, h) We need P, and rho for running the adjoint problem ---*/ - + Gradient_Primitive = new su2double* [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Gradient_Primitive[iVar] = new su2double [nDim]; @@ -398,7 +398,7 @@ CEulerVariable::CEulerVariable(su2double *val_solution, unsigned short val_nDim, for (iDim = 0; iDim < nDim; iDim++) Gradient_Secondary[iVar][iDim] = 0.0; } - + Solution_BGS_k = NULL; if (fsi || multizone){ Solution_BGS_k = new su2double [nVar]; @@ -434,14 +434,14 @@ CEulerVariable::~CEulerVariable(void) { if (Undivided_Laplacian != NULL) delete [] Undivided_Laplacian; if (Solution_New != NULL) delete [] Solution_New; - + if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; } void CEulerVariable::SetGradient_PrimitiveZero(unsigned short val_primvar) { unsigned short iVar, iDim; - + for (iVar = 0; iVar < val_primvar; iVar++) for (iDim = 0; iDim < nDim; iDim++) Gradient_Primitive[iVar][iDim] = 0.0; @@ -449,7 +449,7 @@ void CEulerVariable::SetGradient_PrimitiveZero(unsigned short val_primvar) { void CEulerVariable::SetGradient_SecondaryZero(unsigned short val_secondaryvar) { unsigned short iVar, iDim; - + for (iVar = 0; iVar < val_secondaryvar; iVar++) for (iDim = 0; iDim < nDim; iDim++) Gradient_Secondary[iVar][iDim] = 0.0; @@ -458,43 +458,43 @@ void CEulerVariable::SetGradient_SecondaryZero(unsigned short val_secondaryvar) su2double CEulerVariable::GetProjVel(su2double *val_vector) { su2double ProjVel; unsigned short iDim; - + ProjVel = 0.0; for (iDim = 0; iDim < nDim; iDim++) ProjVel += Primitive[iDim+1]*val_vector[iDim]; - + return ProjVel; } bool CEulerVariable::SetPrimVar(CFluidModel *FluidModel) { unsigned short iVar; bool check_dens = false, check_press = false, check_sos = false, check_temp = false, RightVol = true; - + SetVelocity(); // Computes velocity and velocity^2 su2double density = GetDensity(); su2double staticEnergy = GetEnergy()-0.5*Velocity2; - + /*--- Check will be moved inside fluid model plus error description strings ---*/ - + FluidModel->SetTDState_rhoe(density, staticEnergy); - + check_dens = SetDensity(); check_press = SetPressure(FluidModel->GetPressure()); check_sos = SetSoundSpeed(FluidModel->GetSoundSpeed2()); check_temp = SetTemperature(FluidModel->GetTemperature()); - + /*--- Check that the solution has a physical meaning ---*/ - + if (check_dens || check_press || check_sos || check_temp) { - + /*--- Copy the old solution ---*/ - + for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Solution_Old[iVar]; - + /*--- Recompute the primitive variables ---*/ - + SetVelocity(); // Computes velocity and velocity^2 su2double density = GetDensity(); su2double staticEnergy = GetEnergy()-0.5*Velocity2; @@ -505,17 +505,17 @@ bool CEulerVariable::SetPrimVar(CFluidModel *FluidModel) { SetPressure(FluidModel->GetPressure()); SetSoundSpeed(FluidModel->GetSoundSpeed2()); SetTemperature(FluidModel->GetTemperature()); - + RightVol = false; - + } - + /*--- Set enthalpy ---*/ - + SetEnthalpy(); // Requires pressure computation. - + return RightVol; - + } void CEulerVariable::SetSecondaryVar(CFluidModel *FluidModel) { diff --git a/SU2_CFD/src/variables/CFEAVariable.cpp b/SU2_CFD/src/variables/CFEAVariable.cpp index 3ca5afcb8607..8a6028cd0d49 100644 --- a/SU2_CFD/src/variables/CFEAVariable.cpp +++ b/SU2_CFD/src/variables/CFEAVariable.cpp @@ -40,31 +40,31 @@ CFEAVariable::CFEAVariable(void) : CVariable() { VonMises_Stress = 0.0; - + Stress = NULL; // Nodal stress (for output purposes) Residual_Ext_Body = NULL; // Residual component due to body forces - + Solution_time_n = NULL; // Solution at the node at the previous subiteration Solution_Vel = NULL; // Velocity at the node at time t+dt Solution_Vel_time_n = NULL; // Velocity at the node at time t - + Solution_Accel = NULL; // Acceleration at the node at time t+dt Solution_Accel_time_n = NULL; // Acceleration at the node at time t - + Solution_Pred = NULL; // Predictor of the solution at the current subiteration Solution_Pred_Old = NULL; // Predictor of the solution at the previous subiteration - + Prestretch = NULL; // Prestretch geometry Reference_Geometry = NULL; // Reference geometry for optimization purposes - + Solution_BGS_k = NULL; // Old solution stored to check convergence in the BGS loop } CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { - + unsigned short iVar; bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); // Nonlinear analysis. bool body_forces = config->GetDeadLoad(); // Body forces (dead loads). @@ -72,22 +72,22 @@ CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned bool prestretch_fem = config->GetPrestretch(); // Structure is prestretched bool discrete_adjoint = config->GetDiscrete_Adjoint(); - + bool refgeom = config->GetRefGeom(); // Reference geometry needs to be stored - + bool dynamic_analysis = (config->GetDynamic_Analysis() == DYNAMIC); bool fsi_analysis = config->GetFSI_Simulation(); VonMises_Stress = 0.0; - + if (nDim == 2) Stress = new su2double [3]; else if (nDim == 3) Stress = new su2double [6]; - + /*--- Initialization of variables ---*/ for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] = val_fea[iVar]; } - + Solution_Vel = NULL; Solution_Vel_time_n = NULL; Solution_Accel = NULL; @@ -104,7 +104,7 @@ CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned Solution_Accel_time_n[iVar] = val_fea[iVar+2*nVar]; } } - + Solution_Pred = NULL; Solution_Pred_Old = NULL; Solution_Pred_Old = NULL; @@ -119,7 +119,7 @@ CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned Solution_BGS_k[iVar] = 0.0; } } - + /*--- If we are going to use incremental analysis, we need a way to store the old solution ---*/ if (incremental_load && nonlinear_analysis) { Solution_Old = new su2double [nVar]; @@ -131,7 +131,7 @@ CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned Solution_Old[iVar] = val_fea[iVar]; } } - + /*--- Body residual ---*/ Residual_Ext_Body = NULL; if (body_forces) {Residual_Ext_Body = new su2double [nVar]; @@ -139,33 +139,33 @@ CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned Residual_Ext_Body[iVar] = 0.0; } } - + Reference_Geometry = NULL; if (refgeom) Reference_Geometry = new su2double [nVar]; - + Prestretch = NULL; if (prestretch_fem) Prestretch = new su2double [nVar]; - - + + } CFEAVariable::~CFEAVariable(void) { - + if (Stress != NULL) delete [] Stress; if (Residual_Ext_Body != NULL) delete [] Residual_Ext_Body; - + if (Solution_Vel != NULL) delete [] Solution_Vel; if (Solution_Vel_time_n != NULL) delete [] Solution_Vel_time_n; - + if (Solution_Accel != NULL) delete [] Solution_Accel; if (Solution_Accel_time_n != NULL) delete [] Solution_Accel_time_n; - + if (Solution_Pred != NULL) delete [] Solution_Pred; if (Solution_Pred_Old != NULL) delete [] Solution_Pred_Old; - + if (Reference_Geometry != NULL) delete [] Reference_Geometry; if (Prestretch != NULL) delete [] Prestretch; - + if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; } diff --git a/SU2_CFD/src/variables/CHeatFVMVariable.cpp b/SU2_CFD/src/variables/CHeatFVMVariable.cpp index 7e594c1bc722..5b7f679f82c0 100644 --- a/SU2_CFD/src/variables/CHeatFVMVariable.cpp +++ b/SU2_CFD/src/variables/CHeatFVMVariable.cpp @@ -38,12 +38,12 @@ #include "../../include/variables/CHeatFVMVariable.hpp" CHeatFVMVariable::CHeatFVMVariable(void) : CVariable() { - + /*--- Array initialization ---*/ Solution_Direct = NULL; Undivided_Laplacian = NULL; - + } CHeatFVMVariable::CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, unsigned short val_nvar, diff --git a/SU2_CFD/src/variables/CIncEulerVariable.cpp b/SU2_CFD/src/variables/CIncEulerVariable.cpp index 5a4463e1dc72..11488f5e03ae 100644 --- a/SU2_CFD/src/variables/CIncEulerVariable.cpp +++ b/SU2_CFD/src/variables/CIncEulerVariable.cpp @@ -38,9 +38,9 @@ #include "../../include/variables/CIncEulerVariable.hpp" CIncEulerVariable::CIncEulerVariable(void) : CVariable() { - + /*--- Array initialization ---*/ - + Primitive = NULL; Gradient_Primitive = NULL; Limiter_Primitive = NULL; @@ -52,11 +52,11 @@ CIncEulerVariable::CIncEulerVariable(void) : CVariable() { nSecondaryVar = 0; nSecondaryVarGrad = 0; - + Undivided_Laplacian = NULL; Solution_BGS_k = NULL; - + } CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velocity, su2double val_temperature, @@ -64,7 +64,7 @@ CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velo CVariable(val_nDim, val_nvar, config) { unsigned short iVar, iDim, iMesh, nMGSmooth = 0; - + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); bool viscous = config->GetViscous(); @@ -73,49 +73,49 @@ CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velo bool multizone = config->GetMultizone_Problem(); /*--- Array initialization ---*/ - + Primitive = NULL; Gradient_Primitive = NULL; Limiter_Primitive = NULL; Grad_AuxVar = NULL; - + nPrimVar = 0; nPrimVarGrad = 0; - + nSecondaryVar = 0; nSecondaryVarGrad = 0; Undivided_Laplacian = NULL; /*--- Allocate and initialize the primitive variables and gradients ---*/ - + nPrimVar = nDim+9; nPrimVarGrad = nDim+4; /*--- Allocate residual structures ---*/ - + Res_TruncError = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Res_TruncError[iVar] = 0.0; } - + /*--- Only for residual smoothing (multigrid) ---*/ - + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) nMGSmooth += config->GetMG_CorrecSmooth(iMesh); - + if (nMGSmooth > 0) { Residual_Sum = new su2double [nVar]; Residual_Old = new su2double [nVar]; } - + /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ - + if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) { Undivided_Laplacian = new su2double [nVar]; } - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ @@ -126,14 +126,14 @@ CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velo Limiter = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) Limiter[iVar] = 0.0; - + Solution_Max = new su2double [nPrimVarGrad]; Solution_Min = new su2double [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Solution_Max[iVar] = 0.0; Solution_Min[iVar] = 0.0; } - + /*--- Solution and old solution initialization ---*/ Solution[0] = val_pressure; @@ -146,7 +146,7 @@ CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velo Solution_Old[nDim+1] = val_temperature; /*--- Allocate and initialize solution for dual time strategy ---*/ - + if (dual_time) { Solution_time_n[0] = val_pressure; Solution_time_n1[0] = val_pressure; @@ -159,13 +159,13 @@ CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velo } /*--- Incompressible flow, primitive variables nDim+9, (P, vx, vy, vz, T, rho, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) ---*/ - + Primitive = new su2double [nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive[iVar] = 0.0; /*--- Incompressible flow, gradients primitive variables nDim+4, (P, vx, vy, vz, T, rho, beta) * We need P, and rho for running the adjoint problem ---*/ - + Gradient_Primitive = new su2double* [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Gradient_Primitive[iVar] = new su2double [nDim]; @@ -194,7 +194,7 @@ CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val CConfig *config) : CVariable(val_nDim, val_nvar, config) { unsigned short iVar, iDim, iMesh, nMGSmooth = 0; - + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); bool viscous = config->GetViscous(); @@ -203,50 +203,50 @@ CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val bool multizone = config->GetMultizone_Problem(); /*--- Array initialization ---*/ - + Primitive = NULL; Gradient_Primitive = NULL; Limiter_Primitive = NULL; Grad_AuxVar = NULL; - + nPrimVar = 0; nPrimVarGrad = 0; - + nSecondaryVar = 0; nSecondaryVarGrad = 0; - + Undivided_Laplacian = NULL; - + /*--- Allocate and initialize the primitive variables and gradients ---*/ nPrimVar = nDim+9; nPrimVarGrad = nDim+4; - + /*--- Allocate residual structures ---*/ Res_TruncError = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) { Res_TruncError[iVar] = 0.0; } - + /*--- Only for residual smoothing (multigrid) ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) nMGSmooth += config->GetMG_CorrecSmooth(iMesh); - + if (nMGSmooth > 0) { Residual_Sum = new su2double [nVar]; Residual_Old = new su2double [nVar]; } - + /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) Undivided_Laplacian = new su2double [nVar]; - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ - + Limiter_Primitive = new su2double [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) Limiter_Primitive[iVar] = 0.0; @@ -254,33 +254,33 @@ CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val Limiter = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) Limiter[iVar] = 0.0; - + Solution_Max = new su2double [nPrimVarGrad]; Solution_Min = new su2double [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Solution_Max[iVar] = 0.0; Solution_Min[iVar] = 0.0; } - + /*--- Solution initialization ---*/ - + for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] = val_solution[iVar]; Solution_Old[iVar] = val_solution[iVar]; } - + /*--- Allocate and initialize solution for dual time strategy ---*/ - + if (dual_time) { Solution_time_n = new su2double [nVar]; Solution_time_n1 = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) { Solution_time_n[iVar] = val_solution[iVar]; Solution_time_n1[iVar] = val_solution[iVar]; } } - + /*--- Incompressible flow, primitive variables nDim+9, (P, vx, vy, vz, T, rho, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) ---*/ Primitive = new su2double [nPrimVar]; @@ -288,7 +288,7 @@ CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val /*--- Incompressible flow, gradients primitive variables nDim+4, (P, vx, vy, vz, T, rho, beta), We need P, and rho for running the adjoint problem ---*/ - + Gradient_Primitive = new su2double* [nPrimVarGrad]; for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Gradient_Primitive[iVar] = new su2double [nDim]; @@ -300,7 +300,7 @@ CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val if (axisymmetric && viscous) Grad_AuxVar = new su2double[nDim]; - + Solution_BGS_k = NULL; if (fsi || multizone){ Solution_BGS_k = new su2double [nVar]; @@ -324,14 +324,14 @@ CIncEulerVariable::~CIncEulerVariable(void) { } if (Undivided_Laplacian != NULL) delete [] Undivided_Laplacian; - + if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; } void CIncEulerVariable::SetGradient_PrimitiveZero(unsigned short val_primvar) { unsigned short iVar, iDim; - + for (iVar = 0; iVar < val_primvar; iVar++) for (iDim = 0; iDim < nDim; iDim++) Gradient_Primitive[iVar][iDim] = 0.0; @@ -341,23 +341,23 @@ void CIncEulerVariable::SetGradient_PrimitiveZero(unsigned short val_primvar) { su2double CIncEulerVariable::GetProjVel(su2double *val_vector) { su2double ProjVel; unsigned short iDim; - + ProjVel = 0.0; for (iDim = 0; iDim < nDim; iDim++) ProjVel += Primitive[iDim+1]*val_vector[iDim]; - + return ProjVel; } bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { - + unsigned short iVar; bool check_dens = false, check_temp = false, physical = true; /*--- Store the density from the previous iteration. ---*/ - + Density_Old = GetDensity(); - + /*--- Set the value of the pressure ---*/ SetPressure(); @@ -376,18 +376,18 @@ bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { FluidModel->SetTDState_T(Temperature); /*--- Set the value of the density ---*/ - + check_dens = SetDensity(FluidModel->GetDensity()); /*--- Non-physical solution found. Revert to old values. ---*/ - + if (check_dens || check_temp) { - + /*--- Copy the old solution ---*/ - + for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Solution_Old[iVar]; - + /*--- Recompute the primitive variables ---*/ Temperature = Solution[nDim+1]; @@ -402,7 +402,7 @@ bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { } /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ - + SetVelocity(); /*--- Set specific heats (only necessary for consistency with preconditioning). ---*/ @@ -411,5 +411,5 @@ bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { SetSpecificHeatCv(FluidModel->GetCv()); return physical; - + } diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index 41b4e3fd198f..8f1fbc004fee 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -54,25 +54,25 @@ CIncNSVariable::CIncNSVariable(su2double *val_solution, unsigned short val_nDim, CIncNSVariable::~CIncNSVariable(void) { } bool CIncNSVariable::SetVorticity(void) { - + Vorticity[0] = 0.0; Vorticity[1] = 0.0; - + Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; - + if (nDim == 3) { Vorticity[0] = Gradient_Primitive[3][1]-Gradient_Primitive[2][2]; Vorticity[1] = -(Gradient_Primitive[3][0]-Gradient_Primitive[1][2]); } - + return false; - + } bool CIncNSVariable::SetStrainMag(void) { - + su2double Div; unsigned short iDim; - + AD::StartPreacc(); AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); @@ -80,15 +80,15 @@ bool CIncNSVariable::SetStrainMag(void) { for (iDim = 0; iDim < nDim; iDim++) { Div += Gradient_Primitive[iDim+1][iDim]; } - + StrainMag = 0.0; - + /*--- Add diagonal part ---*/ - + for (iDim = 0; iDim < nDim; iDim++) { StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); } - + /*--- Add off diagonals ---*/ StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); @@ -97,28 +97,28 @@ bool CIncNSVariable::SetStrainMag(void) { StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][2] + Gradient_Primitive[3][0]), 2.0); StrainMag += 2.0*pow(0.5*(Gradient_Primitive[2][2] + Gradient_Primitive[3][1]), 2.0); } - + StrainMag = sqrt(2.0*StrainMag); AD::SetPreaccOut(StrainMag); AD::EndPreacc(); return false; - + } bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) { - + unsigned short iVar; bool check_dens = false, check_temp = false, physical = true; /*--- Store the density from the previous iteration. ---*/ - + Density_Old = GetDensity(); - + /*--- Set the value of the pressure ---*/ - + SetPressure(); /*--- Set the value of the temperature directly ---*/ @@ -135,18 +135,18 @@ bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidMo FluidModel->SetTDState_T(Temperature); /*--- Set the value of the density ---*/ - + check_dens = SetDensity(FluidModel->GetDensity()); /*--- Non-physical solution found. Revert to old values. ---*/ - + if (check_dens || check_temp) { - + /*--- Copy the old solution ---*/ - + for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Solution_Old[iVar]; - + /*--- Recompute the primitive variables ---*/ Temperature = Solution[nDim+1]; @@ -161,20 +161,20 @@ bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidMo } /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ - + SetVelocity(); /*--- Set laminar viscosity ---*/ - + SetLaminarViscosity(FluidModel->GetLaminarViscosity()); - + /*--- Set eddy viscosity locally and in the fluid model. ---*/ - + SetEddyViscosity(eddy_visc); FluidModel->SetEddyViscosity(eddy_visc); /*--- Set thermal conductivity (effective value if RANS). ---*/ - + SetThermalConductivity(FluidModel->GetThermalConductivity()); /*--- Set specific heats ---*/ @@ -183,5 +183,5 @@ bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidMo SetSpecificHeatCv(FluidModel->GetCv()); return physical; - + } diff --git a/SU2_CFD/src/variables/CNSVariable.cpp b/SU2_CFD/src/variables/CNSVariable.cpp index 38ea36f2d77a..8612dd6a272d 100644 --- a/SU2_CFD/src/variables/CNSVariable.cpp +++ b/SU2_CFD/src/variables/CNSVariable.cpp @@ -43,30 +43,30 @@ CNSVariable::CNSVariable(void) : CEulerVariable() { } CNSVariable::CNSVariable(su2double val_density, su2double *val_velocity, su2double val_energy, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CEulerVariable(val_density, val_velocity, val_energy, val_nDim, val_nvar, config) { - + Temperature_Ref = config->GetTemperature_Ref(); Viscosity_Ref = config->GetViscosity_Ref(); Viscosity_Inf = config->GetViscosity_FreeStreamND(); Prandtl_Lam = config->GetPrandtl_Lam(); Prandtl_Turb = config->GetPrandtl_Turb(); - + inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); Roe_Dissipation = 0.0; Vortex_Tilting = 0.0; Tau_Wall = -1.0; - + } CNSVariable::CNSVariable(su2double *val_solution, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CEulerVariable(val_solution, val_nDim, val_nvar, config) { - + Temperature_Ref = config->GetTemperature_Ref(); Viscosity_Ref = config->GetViscosity_Ref(); Viscosity_Inf = config->GetViscosity_FreeStreamND(); Prandtl_Lam = config->GetPrandtl_Lam(); Prandtl_Turb = config->GetPrandtl_Turb(); - + inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); Roe_Dissipation = 0.0; Vortex_Tilting = 0.0; @@ -77,25 +77,25 @@ CNSVariable::CNSVariable(su2double *val_solution, unsigned short val_nDim, CNSVariable::~CNSVariable(void) { } bool CNSVariable::SetVorticity(void) { - + Vorticity[0] = 0.0; Vorticity[1] = 0.0; - + Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; - + if (nDim == 3) { Vorticity[0] = Gradient_Primitive[3][1]-Gradient_Primitive[2][2]; Vorticity[1] = -(Gradient_Primitive[3][0]-Gradient_Primitive[1][2]); } - + return false; - + } bool CNSVariable::SetStrainMag(void) { - + su2double Div; unsigned short iDim; - + AD::StartPreacc(); AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); @@ -103,15 +103,15 @@ bool CNSVariable::SetStrainMag(void) { for (iDim = 0; iDim < nDim; iDim++) { Div += Gradient_Primitive[iDim+1][iDim]; } - + StrainMag = 0.0; - + /*--- Add diagonal part ---*/ - + for (iDim = 0; iDim < nDim; iDim++) { StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); } - + /*--- Add off diagonals ---*/ StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); @@ -120,28 +120,28 @@ bool CNSVariable::SetStrainMag(void) { StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][2] + Gradient_Primitive[3][0]), 2.0); StrainMag += 2.0*pow(0.5*(Gradient_Primitive[2][2] + Gradient_Primitive[3][1]), 2.0); } - + StrainMag = sqrt(2.0*StrainMag); AD::SetPreaccOut(StrainMag); AD::EndPreacc(); return false; - + } void CNSVariable::SetRoe_Dissipation_NTS(su2double val_delta, su2double val_const_DES){ - + static const su2double cnu = pow(0.09, 1.5), ch1 = 3.0, ch2 = 1.0, ch3 = 2.0, sigma_max = 1.0; - + unsigned short iDim; su2double Omega, Omega_2 = 0, Baux, Gaux, Lturb, Kaux, Aaux; - + AD::StartPreacc(); AD::SetPreaccIn(Vorticity, 3); AD::SetPreaccIn(StrainMag); @@ -165,134 +165,134 @@ void CNSVariable::SetRoe_Dissipation_NTS(su2double val_delta, Omega_2 += Vorticity[iDim]*Vorticity[iDim]; } Omega = sqrt(Omega_2); - + Baux = (ch3 * Omega * max(StrainMag, Omega)) / max((pow(StrainMag,2)+Omega_2)*0.5, 1E-20); Gaux = tanh(pow(Baux,4.0)); - + Kaux = max(sqrt((Omega_2 + pow(StrainMag, 2))*0.5), 0.1 * inv_TimeScale); - + const su2double nu = GetLaminarViscosity()/GetDensity(); const su2double nu_t = GetEddyViscosity()/GetDensity(); Lturb = sqrt((nu + nu_t)/(cnu*Kaux)); - + Aaux = ch2*max((val_const_DES*val_delta/Lturb)/Gaux - 0.5, 0.0); - - Roe_Dissipation = sigma_max * tanh(pow(Aaux, ch1)); - + + Roe_Dissipation = sigma_max * tanh(pow(Aaux, ch1)); + AD::SetPreaccOut(Roe_Dissipation); AD::EndPreacc(); } void CNSVariable::SetRoe_Dissipation_FD(su2double val_wall_dist){ - + /*--- Constants for Roe Dissipation ---*/ - + static const su2double k2 = pow(0.41,2.0); - + su2double uijuij = 0; unsigned short iDim, jDim; - + AD::StartPreacc(); AD::SetPreaccIn(Gradient_Primitive, nVar, nDim); AD::SetPreaccIn(val_wall_dist); /*--- Eddy viscosity ---*/ - AD::SetPreaccIn(Primitive[nDim+5]); + AD::SetPreaccIn(Primitive[nDim+5]); /*--- Laminar viscosity --- */ AD::SetPreaccIn(Primitive[nDim+6]); - + for(iDim=0;iDimSetTDState_rhoe(density, staticEnergy); check_dens = SetDensity(); check_press = SetPressure(FluidModel->GetPressure()); check_sos = SetSoundSpeed(FluidModel->GetSoundSpeed2()); check_temp = SetTemperature(FluidModel->GetTemperature()); - + /*--- Check that the solution has a physical meaning ---*/ - + if (check_dens || check_press || check_sos || check_temp) { - + /*--- Copy the old solution ---*/ - + for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Solution_Old[iVar]; - + /*--- Recompute the primitive variables ---*/ - + SetVelocity(); // Computes velocity and velocity^2 density = GetDensity(); staticEnergy = GetEnergy()-0.5*Velocity2 - turb_ke; - + /*--- Check will be moved inside fluid model plus error description strings ---*/ - + FluidModel->SetTDState_rhoe(density, staticEnergy); - + SetDensity(); SetPressure(FluidModel->GetPressure()); SetSoundSpeed(FluidModel->GetSoundSpeed2()); SetTemperature(FluidModel->GetTemperature()); - + RightVol = false; - + } - + /*--- Set enthalpy ---*/ - + SetEnthalpy(); // Requires pressure computation. - + /*--- Set laminar viscosity ---*/ - + SetLaminarViscosity(FluidModel->GetLaminarViscosity()); - + /*--- Set eddy viscosity ---*/ - + SetEddyViscosity(eddy_visc); /*--- Set thermal conductivity ---*/ - + SetThermalConductivity(FluidModel->GetThermalConductivity()); /*--- Set specific heat ---*/ SetSpecificHeatCp(FluidModel->GetCp()); - + return RightVol; - + } void CNSVariable::SetSecondaryVar(CFluidModel *FluidModel) { diff --git a/SU2_CFD/src/variables/CTransLMVariable.cpp b/SU2_CFD/src/variables/CTransLMVariable.cpp index 1fc104d55837..bfcd3f928617 100644 --- a/SU2_CFD/src/variables/CTransLMVariable.cpp +++ b/SU2_CFD/src/variables/CTransLMVariable.cpp @@ -45,7 +45,7 @@ CTransLMVariable::CTransLMVariable(su2double val_nu_tilde, su2double val_intermi // Initialization of variables Solution[0] = val_intermittency; Solution_Old[0] = val_intermittency; Solution[1] = val_REth; Solution_Old[1] = val_REth; - + } CTransLMVariable::~CTransLMVariable(void) { } diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index f8a15e2b403a..5302b467766a 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -42,28 +42,28 @@ CTurbSAVariable::CTurbSAVariable(void) : CTurbVariable() { } CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CTurbVariable(val_nDim, val_nvar, config) { - + bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); - + /*--- Initialization of S-A variables ---*/ Solution[0] = val_nu_tilde; Solution_Old[0] = val_nu_tilde; - + /*--- Initialization of the eddy viscosity ---*/ muT = val_muT; - + /*--- Allocate and initialize solution for the dual time strategy ---*/ if (dual_time) { Solution_time_n[0] = val_nu_tilde; Solution_time_n1[0] = val_nu_tilde; } - + DES_LengthScale = 0.0; } void CTurbSAVariable::SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity){ - + su2double Strain[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}, Omega, StrainDotVort[3], numVecVort[3]; su2double numerator, trace0, trace1, denominator; @@ -71,10 +71,10 @@ void CTurbSAVariable::SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vo AD::SetPreaccIn(PrimGrad_Flow, nDim+1, nDim); AD::SetPreaccIn(Vorticity, 3); /*--- Eddy viscosity ---*/ - AD::SetPreaccIn(muT); + AD::SetPreaccIn(muT); /*--- Laminar viscosity --- */ AD::SetPreaccIn(LaminarViscosity); - + Strain[0][0] = PrimGrad_Flow[1][0]; Strain[1][0] = 0.5*(PrimGrad_Flow[2][0] + PrimGrad_Flow[1][1]); Strain[0][1] = 0.5*(PrimGrad_Flow[1][1] + PrimGrad_Flow[2][0]); @@ -86,31 +86,31 @@ void CTurbSAVariable::SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vo Strain[2][1] = 0.5*(PrimGrad_Flow[2][2] + PrimGrad_Flow[3][1]); Strain[2][2] = PrimGrad_Flow[3][2]; } - - Omega = sqrt(Vorticity[0]*Vorticity[0] + Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); - + + Omega = sqrt(Vorticity[0]*Vorticity[0] + Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); + StrainDotVort[0] = Strain[0][0]*Vorticity[0]+Strain[0][1]*Vorticity[1]+Strain[0][2]*Vorticity[2]; StrainDotVort[1] = Strain[1][0]*Vorticity[0]+Strain[1][1]*Vorticity[1]+Strain[1][2]*Vorticity[2]; StrainDotVort[2] = Strain[2][0]*Vorticity[0]+Strain[2][1]*Vorticity[1]+Strain[2][2]*Vorticity[2]; - + numVecVort[0] = StrainDotVort[1]*Vorticity[2] - StrainDotVort[2]*Vorticity[1]; numVecVort[1] = StrainDotVort[2]*Vorticity[0] - StrainDotVort[0]*Vorticity[2]; numVecVort[2] = StrainDotVort[0]*Vorticity[1] - StrainDotVort[1]*Vorticity[0]; - + numerator = sqrt(6.0) * sqrt(numVecVort[0]*numVecVort[0] + numVecVort[1]*numVecVort[1] + numVecVort[2]*numVecVort[2]); trace0 = 3.0*(pow(Strain[0][0],2.0) + pow(Strain[1][1],2.0) + pow(Strain[2][2],2.0)); trace1 = pow(Strain[0][0] + Strain[1][1] + Strain[2][2],2.0); denominator = pow(Omega, 2.0) * sqrt(trace0-trace1); - - Vortex_Tilting = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/muT); - + + Vortex_Tilting = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/muT); + AD::SetPreaccOut(Vortex_Tilting); AD::EndPreacc(); } CTurbSAVariable::~CTurbSAVariable(void) { - + if (HB_Source != NULL) delete [] HB_Source; - + } diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index f6dc6171e311..70bffa225d5b 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -46,36 +46,36 @@ CTurbSSTVariable::CTurbSSTVariable(su2double val_kine, su2double val_omega, su2d bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); - + /*--- Initialization of variables ---*/ - + Solution[0] = val_kine; Solution_Old[0] = val_kine; Solution[1] = val_omega; Solution_Old[1] = val_omega; - + sigma_om2 = constants[3]; beta_star = constants[6]; - + F1 = 1.0; F2 = 0.0; CDkw = 0.0; - + /*--- Initialization of eddy viscosity ---*/ - + muT = val_muT; - + /*--- Allocate and initialize solution for the dual time strategy ---*/ - + if (dual_time) { Solution_time_n[0] = val_kine; Solution_time_n[1] = val_omega; Solution_time_n1[0] = val_kine; Solution_time_n1[1] = val_omega; } - + } CTurbSSTVariable::~CTurbSSTVariable(void) { if (HB_Source != NULL) delete [] HB_Source; - + } void CTurbSSTVariable::SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density) { @@ -87,29 +87,29 @@ void CTurbSSTVariable::SetBlendingFunc(su2double val_viscosity, su2double val_di AD::SetPreaccIn(val_density); AD::SetPreaccIn(Solution, nVar); AD::SetPreaccIn(Gradient, nVar, nDim); - + /*--- Cross diffusion ---*/ - + CDkw = 0.0; for (iDim = 0; iDim < nDim; iDim++) CDkw += Gradient[0][iDim]*Gradient[1][iDim]; CDkw *= 2.0*val_density*sigma_om2/Solution[1]; CDkw = max(CDkw, pow(10.0, -20.0)); - + /*--- F1 ---*/ - + arg2A = sqrt(Solution[0])/(beta_star*Solution[1]*val_dist+EPS*EPS); arg2B = 500.0*val_viscosity / (val_density*val_dist*val_dist*Solution[1]+EPS*EPS); arg2 = max(arg2A, arg2B); arg1 = min(arg2, 4.0*val_density*sigma_om2*Solution[0] / (CDkw*val_dist*val_dist+EPS*EPS)); F1 = tanh(pow(arg1, 4.0)); - + /*--- F2 ---*/ - + arg2 = max(2.0*arg2A, arg2B); F2 = tanh(pow(arg2, 2.0)); AD::SetPreaccOut(F1); AD::SetPreaccOut(F2); AD::SetPreaccOut(CDkw); AD::EndPreacc(); - + } diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index 452f7b7aaa40..b1877c1ea41b 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -38,43 +38,43 @@ #include "../../include/variables/CTurbVariable.hpp" CTurbVariable::CTurbVariable(void) : CVariable() { - + /*--- Array initialization ---*/ HB_Source = NULL; - + } CTurbVariable::CTurbVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config) : CVariable(val_nDim, val_nvar, config) { - + unsigned short iVar; /*--- Array initialization ---*/ - + HB_Source = NULL; - + /*--- Allocate space for the harmonic balance source terms ---*/ - + if (config->GetUnsteady_Simulation() == HARMONIC_BALANCE) { HB_Source = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) HB_Source[iVar] = 0.0; } - + /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ Limiter = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) Limiter[iVar] = 0.0; - + Solution_Max = new su2double [nVar]; Solution_Min = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) { Solution_Max[iVar] = 0.0; Solution_Min[iVar] = 0.0; } - + } CTurbVariable::~CTurbVariable(void) { } diff --git a/SU2_CFD/src/variables/CVariable.cpp b/SU2_CFD/src/variables/CVariable.cpp index 9b147fb6799a..7dcc8fa062da 100644 --- a/SU2_CFD/src/variables/CVariable.cpp +++ b/SU2_CFD/src/variables/CVariable.cpp @@ -56,7 +56,7 @@ CVariable::CVariable(void) { Residual_Old = NULL; Residual_Sum = NULL; Solution_Adj_Old = NULL; - + } CVariable::CVariable(unsigned short val_nvar, CConfig *config) { @@ -82,20 +82,20 @@ CVariable::CVariable(unsigned short val_nvar, CConfig *config) { of the constructor will be used primarily for converting the restart files into solution files (SU2_SOL). ---*/ nVar = val_nvar; - + /*--- Allocate the solution array - here it is also possible to allocate some extra flow variables that do not participate in the simulation ---*/ Solution = new su2double [nVar]; for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; - + } CVariable::CVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig *config) { - + unsigned short iVar, iDim, jDim; - + /*--- Array initialization ---*/ Solution = NULL; Solution_Old = NULL; @@ -112,29 +112,29 @@ CVariable::CVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig * Residual_Old = NULL; Residual_Sum = NULL; Solution_Adj_Old = NULL; - + /*--- Initializate the number of dimension and number of variables ---*/ nDim = val_nDim; nVar = val_nvar; - - /*--- Allocate solution, solution old, residual and gradient - which is common for all the problems, here it is also possible - to allocate some extra flow variables that do not participate + + /*--- Allocate solution, solution old, residual and gradient + which is common for all the problems, here it is also possible + to allocate some extra flow variables that do not participate in the simulation ---*/ Solution = new su2double [nVar]; - + for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; Solution_Old = new su2double [nVar]; - + Gradient = new su2double* [nVar]; for (iVar = 0; iVar < nVar; iVar++) { Gradient[iVar] = new su2double [nDim]; for (iDim = 0; iDim < nDim; iDim ++) Gradient[iVar][iDim] = 0.0; } - + if (config->GetUnsteady_Simulation() != NO) { Solution_time_n = new su2double [nVar]; Solution_time_n1 = new su2double [nVar]; @@ -143,11 +143,11 @@ CVariable::CVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig * Solution_time_n = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = 0.0; } - + if (config->GetFSI_Simulation() && config->GetDiscrete_Adjoint()){ Solution_Adj_Old = new su2double [nVar]; } - + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { Rmatrix = new su2double*[nDim]; for (iDim = 0; iDim < nDim; iDim++) { @@ -156,7 +156,7 @@ CVariable::CVariable(unsigned short val_nDim, unsigned short val_nvar, CConfig * Rmatrix[iDim][jDim] = 0.0; } } - + } CVariable::~CVariable(void) { @@ -175,7 +175,7 @@ CVariable::~CVariable(void) { if (Residual_Old != NULL) delete [] Residual_Old; if (Residual_Sum != NULL) delete [] Residual_Sum; if (Solution_Adj_Old != NULL) delete [] Solution_Adj_Old; - + if (Gradient != NULL) { for (iVar = 0; iVar < nVar; iVar++) delete [] Gradient[iVar]; @@ -187,5 +187,5 @@ CVariable::~CVariable(void) { delete [] Rmatrix[iDim]; delete [] Rmatrix; } - + } From 30c45592e39e4543e4e6674b1c45815fc79a38de Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sat, 6 Jul 2019 15:12:16 +0100 Subject: [PATCH 5/6] addressing real and potential memory memory leaks --- .../include/variables/CHeatFVMVariable.hpp | 4 +- SU2_CFD/src/numerics_adjoint_mean.cpp | 2 - SU2_CFD/src/variables/CAdjTurbVariable.cpp | 2 +- SU2_CFD/src/variables/CDiscAdjVariable.cpp | 38 ++++++--- SU2_CFD/src/variables/CEulerVariable.cpp | 8 -- SU2_CFD/src/variables/CFEABoundVariable.cpp | 31 +++---- SU2_CFD/src/variables/CFEAVariable.cpp | 81 ++++++++++--------- SU2_CFD/src/variables/CHeatFVMVariable.cpp | 19 +++-- SU2_CFD/src/variables/CIncEulerVariable.cpp | 8 -- SU2_CFD/src/variables/CTurbSAVariable.cpp | 7 +- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 6 +- SU2_CFD/src/variables/CTurbVariable.cpp | 5 +- SU2_CFD/src/variables/CVariable.cpp | 2 +- 13 files changed, 103 insertions(+), 110 deletions(-) diff --git a/SU2_CFD/include/variables/CHeatFVMVariable.hpp b/SU2_CFD/include/variables/CHeatFVMVariable.hpp index e40d49b91610..c9d50f05b6af 100644 --- a/SU2_CFD/include/variables/CHeatFVMVariable.hpp +++ b/SU2_CFD/include/variables/CHeatFVMVariable.hpp @@ -47,8 +47,8 @@ */ class CHeatFVMVariable : public CVariable { protected: - su2double *Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */ - su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ + su2double* Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */ + su2double* Solution_BGS_k; /*!< \brief Old solution container for BGS iterations ---*/ public: diff --git a/SU2_CFD/src/numerics_adjoint_mean.cpp b/SU2_CFD/src/numerics_adjoint_mean.cpp index b11c74c5c5bc..8860e22595e3 100644 --- a/SU2_CFD/src/numerics_adjoint_mean.cpp +++ b/SU2_CFD/src/numerics_adjoint_mean.cpp @@ -352,7 +352,6 @@ CCentJST_AdjFlow::CCentJST_AdjFlow(unsigned short val_nDim, unsigned short val_n grid_movement = config->GetGrid_Movement(); Diff_Psi = new su2double [nVar]; Diff_Lapl = new su2double [nVar]; - Und_Lapl_i = new su2double [nVar]; Und_Lapl_j = new su2double [nVar]; Velocity_i = new su2double [nDim]; Velocity_j = new su2double [nDim]; MeanPhi = new su2double [nDim]; @@ -366,7 +365,6 @@ CCentJST_AdjFlow::CCentJST_AdjFlow(unsigned short val_nDim, unsigned short val_n CCentJST_AdjFlow::~CCentJST_AdjFlow(void) { delete [] Diff_Psi; delete [] Diff_Lapl; - delete [] Und_Lapl_i; delete [] Und_Lapl_j; delete [] Velocity_i; delete [] Velocity_j; delete [] MeanPhi; } diff --git a/SU2_CFD/src/variables/CAdjTurbVariable.cpp b/SU2_CFD/src/variables/CAdjTurbVariable.cpp index fa827c46fafe..4b329d683ecc 100644 --- a/SU2_CFD/src/variables/CAdjTurbVariable.cpp +++ b/SU2_CFD/src/variables/CAdjTurbVariable.cpp @@ -1,5 +1,5 @@ /*! - * \file variable_adjoint_turbulent.cpp + * \file CAdjTurbVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, A. Bueno * \version 6.2.0 "Falcon" diff --git a/SU2_CFD/src/variables/CDiscAdjVariable.cpp b/SU2_CFD/src/variables/CDiscAdjVariable.cpp index a9a783eac4a7..20f532a91cc2 100644 --- a/SU2_CFD/src/variables/CDiscAdjVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjVariable.cpp @@ -42,11 +42,23 @@ CDiscAdjVariable::CDiscAdjVariable() : CVariable() { /*--- Initialize arrays to NULL ---*/ Solution_Direct = NULL; - Sensitivity = NULL; + Sensitivity = NULL; DualTime_Derivative = NULL; DualTime_Derivative_n = NULL; + Geometry_Direct = NULL; + Solution_Geometry = NULL; + Solution_Geometry_Old = NULL; + Cross_Term_Derivative = NULL; + + Solution_BGS = NULL; + Solution_BGS_k = NULL; + Solution_Geometry_BGS_k = NULL; + + Geometry_CrossTerm_Derivative = NULL; + Geometry_CrossTerm_Derivative_Flow = NULL; + } CDiscAdjVariable::CDiscAdjVariable(su2double* val_solution, unsigned short val_ndim, unsigned short val_nvar, @@ -56,14 +68,27 @@ CDiscAdjVariable::CDiscAdjVariable(su2double* val_solution, unsigned short val_n || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND); bool fsi = config->GetFSI_Simulation(); + /*--- Initialize arrays to NULL ---*/ Solution_Direct = NULL; - Sensitivity = NULL; + Sensitivity = NULL; DualTime_Derivative = NULL; DualTime_Derivative_n = NULL; + Geometry_Direct = NULL; + Solution_Geometry = NULL; + Solution_Geometry_Old = NULL; + Cross_Term_Derivative = NULL; + + Solution_BGS = NULL; + Solution_BGS_k = NULL; + Solution_Geometry_BGS_k = NULL; + + Geometry_CrossTerm_Derivative = NULL; + Geometry_CrossTerm_Derivative_Flow = NULL; + if (dual_time) { DualTime_Derivative = new su2double[nVar]; DualTime_Derivative_n = new su2double[nVar]; @@ -93,15 +118,6 @@ CDiscAdjVariable::CDiscAdjVariable(su2double* val_solution, unsigned short val_n } } - Geometry_Direct = NULL; - Solution_Geometry = NULL; - Solution_Geometry_Old = NULL; - Cross_Term_Derivative = NULL; - Solution_BGS = NULL; - Solution_BGS_k = NULL; - Solution_Geometry_BGS_k = NULL; - Geometry_CrossTerm_Derivative = NULL; - Geometry_CrossTerm_Derivative_Flow = NULL; if (fsi){ Solution_Geometry = new su2double[nDim]; Geometry_Direct = new su2double[nDim]; diff --git a/SU2_CFD/src/variables/CEulerVariable.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp index 9245d99ec8dc..076e9135c629 100644 --- a/SU2_CFD/src/variables/CEulerVariable.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -60,8 +60,6 @@ CEulerVariable::CEulerVariable(void) : CVariable() { nSecondaryVar = 0; nSecondaryVarGrad = 0; - Undivided_Laplacian = NULL; - Solution_New = NULL; Solution_BGS_k = NULL; @@ -100,8 +98,6 @@ CEulerVariable::CEulerVariable(su2double val_density, su2double *val_velocity, s nSecondaryVar = 0; nSecondaryVarGrad = 0; - Undivided_Laplacian = NULL; - Solution_New = NULL; /*--- Allocate and initialize the primitive variables and gradients ---*/ @@ -275,8 +271,6 @@ CEulerVariable::CEulerVariable(su2double *val_solution, unsigned short val_nDim, nSecondaryVar = 0; nSecondaryVarGrad = 0; - Undivided_Laplacian = NULL; - Solution_New = NULL; /*--- Allocate and initialize the primitive variables and gradients ---*/ @@ -431,8 +425,6 @@ CEulerVariable::~CEulerVariable(void) { delete [] Gradient_Secondary; } - if (Undivided_Laplacian != NULL) delete [] Undivided_Laplacian; - if (Solution_New != NULL) delete [] Solution_New; if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; diff --git a/SU2_CFD/src/variables/CFEABoundVariable.cpp b/SU2_CFD/src/variables/CFEABoundVariable.cpp index fc2f98a29079..d92d1c83bb51 100644 --- a/SU2_CFD/src/variables/CFEABoundVariable.cpp +++ b/SU2_CFD/src/variables/CFEABoundVariable.cpp @@ -55,34 +55,29 @@ CFEABoundVariable::CFEABoundVariable(su2double *val_fea, unsigned short val_nDim bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); bool fsi_analysis = config->GetFSI_Simulation(); + FlowTraction = NULL; + Residual_Ext_Surf = NULL; + FlowTraction_n = NULL; + Residual_Ext_Surf_n = NULL; + /*--- Surface residual ---*/ Residual_Ext_Surf = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Residual_Ext_Surf[iVar] = 0.0; - } + for (iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf[iVar] = 0.0; /*--- Flow traction ---*/ - FlowTraction = NULL; if (fsi_analysis){ - FlowTraction = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - FlowTraction[iVar] = 0.0; - } + FlowTraction = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) FlowTraction[iVar] = 0.0; } /*--- Generalized alpha integration method requires storing the old residuals ---*/ - Residual_Ext_Surf_n = NULL; - FlowTraction_n = NULL; if (gen_alpha) { - Residual_Ext_Surf_n = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Residual_Ext_Surf_n[iVar] = 0.0; - } - if (fsi_analysis){ + Residual_Ext_Surf_n = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf_n[iVar] = 0.0; + + if (fsi_analysis) { FlowTraction_n = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - FlowTraction_n[iVar] = 0.0; - } + for (iVar = 0; iVar < nVar; iVar++) FlowTraction_n[iVar] = 0.0; } } diff --git a/SU2_CFD/src/variables/CFEAVariable.cpp b/SU2_CFD/src/variables/CFEAVariable.cpp index 8a6028cd0d49..37cc54478ff3 100644 --- a/SU2_CFD/src/variables/CFEAVariable.cpp +++ b/SU2_CFD/src/variables/CFEAVariable.cpp @@ -44,8 +44,6 @@ CFEAVariable::CFEAVariable(void) : CVariable() { Stress = NULL; // Nodal stress (for output purposes) Residual_Ext_Body = NULL; // Residual component due to body forces - Solution_time_n = NULL; // Solution at the node at the previous subiteration - Solution_Vel = NULL; // Velocity at the node at time t+dt Solution_Vel_time_n = NULL; // Velocity at the node at time t @@ -78,9 +76,26 @@ CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned bool dynamic_analysis = (config->GetDynamic_Analysis() == DYNAMIC); bool fsi_analysis = config->GetFSI_Simulation(); - VonMises_Stress = 0.0; + VonMises_Stress = 0.0; + + Stress = NULL; // Nodal stress (for output purposes) + Residual_Ext_Body = NULL; // Residual component due to body forces + + Solution_Vel = NULL; // Velocity at the node at time t+dt + Solution_Vel_time_n = NULL; // Velocity at the node at time t + + Solution_Accel = NULL; // Acceleration at the node at time t+dt + Solution_Accel_time_n = NULL; // Acceleration at the node at time t + + Solution_Pred = NULL; // Predictor of the solution at the current subiteration + Solution_Pred_Old = NULL; // Predictor of the solution at the previous subiteration + + Prestretch = NULL; // Prestretch geometry + Reference_Geometry = NULL; // Reference geometry for optimization purposes + + Solution_BGS_k = NULL; // Old solution stored to check convergence in the BGS loop - if (nDim == 2) Stress = new su2double [3]; + if (nDim == 2) Stress = new su2double [3]; else if (nDim == 3) Stress = new su2double [6]; /*--- Initialization of variables ---*/ @@ -88,65 +103,55 @@ CFEAVariable::CFEAVariable(su2double *val_fea, unsigned short val_nDim, unsigned Solution[iVar] = val_fea[iVar]; } - Solution_Vel = NULL; - Solution_Vel_time_n = NULL; - Solution_Accel = NULL; - Solution_Accel_time_n = NULL; if (dynamic_analysis) { - Solution_Vel = new su2double [nVar]; - Solution_Vel_time_n = new su2double [nVar]; - Solution_Accel = new su2double [nVar]; - Solution_Accel_time_n = new su2double [nVar]; + Solution_Vel = new su2double [nVar]; + Solution_Vel_time_n = new su2double [nVar]; + Solution_Accel = new su2double [nVar]; + Solution_Accel_time_n = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) { - Solution_Vel[iVar] = val_fea[iVar+nVar]; + Solution_Vel[iVar] = val_fea[iVar+nVar]; Solution_Vel_time_n[iVar] = val_fea[iVar+nVar]; - Solution_Accel[iVar] = val_fea[iVar+2*nVar]; + Solution_Accel[iVar] = val_fea[iVar+2*nVar]; Solution_Accel_time_n[iVar] = val_fea[iVar+2*nVar]; } } - Solution_Pred = NULL; - Solution_Pred_Old = NULL; - Solution_Pred_Old = NULL; - Solution_BGS_k = NULL; if (fsi_analysis) { Solution_Pred = new su2double [nVar]; Solution_Pred_Old = new su2double [nVar]; Solution_BGS_k = new su2double [nVar]; for (iVar = 0; iVar < nVar; iVar++) { - Solution_Pred[iVar] = val_fea[iVar]; + Solution_Pred[iVar] = val_fea[iVar]; Solution_Pred_Old[iVar] = val_fea[iVar]; - Solution_BGS_k[iVar] = 0.0; + Solution_BGS_k[iVar] = 0.0; } } - /*--- If we are going to use incremental analysis, we need a way to store the old solution ---*/ - if (incremental_load && nonlinear_analysis) { - Solution_Old = new su2double [nVar]; - } - /*--- If we are running a discrete adjoint iteration, we need this vector for cross-dependencies ---*/ - else if (discrete_adjoint && fsi_analysis) { - Solution_Old = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++){ - Solution_Old[iVar] = val_fea[iVar]; + /*--- This variable is not "ours", careful not to leak memory ---*/ + if (Solution_Old == NULL) + { + /*--- If we are going to use incremental analysis, we need a way to store the old solution ---*/ + if (incremental_load && nonlinear_analysis) { + Solution_Old = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) Solution_Old[iVar] = 0.0; + } + /*--- If we are running a discrete adjoint iteration, we need this vector for cross-dependencies ---*/ + else if (discrete_adjoint && fsi_analysis) { + Solution_Old = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) Solution_Old[iVar] = val_fea[iVar]; } } /*--- Body residual ---*/ - Residual_Ext_Body = NULL; - if (body_forces) {Residual_Ext_Body = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Residual_Ext_Body[iVar] = 0.0; - } + if (body_forces) { + Residual_Ext_Body = new su2double [nVar]; + for (iVar = 0; iVar < nVar; iVar++) Residual_Ext_Body[iVar] = 0.0; } - Reference_Geometry = NULL; - if (refgeom) Reference_Geometry = new su2double [nVar]; + if (refgeom) Reference_Geometry = new su2double [nVar]; - Prestretch = NULL; if (prestretch_fem) Prestretch = new su2double [nVar]; - } CFEAVariable::~CFEAVariable(void) { diff --git a/SU2_CFD/src/variables/CHeatFVMVariable.cpp b/SU2_CFD/src/variables/CHeatFVMVariable.cpp index 5b7f679f82c0..f8206508f8dd 100644 --- a/SU2_CFD/src/variables/CHeatFVMVariable.cpp +++ b/SU2_CFD/src/variables/CHeatFVMVariable.cpp @@ -41,8 +41,7 @@ CHeatFVMVariable::CHeatFVMVariable(void) : CVariable() { /*--- Array initialization ---*/ Solution_Direct = NULL; - - Undivided_Laplacian = NULL; + Solution_BGS_k = NULL; } @@ -55,8 +54,10 @@ CHeatFVMVariable::CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)); bool multizone = config->GetMultizone_Problem(); - Undivided_Laplacian = NULL; - + /*--- Array initialization ---*/ + Solution_Direct = NULL; + Solution_BGS_k = NULL; + /*--- Initialization of heat variable ---*/ Solution[0] = val_Heat; Solution_Old[0] = val_Heat; @@ -88,12 +89,14 @@ CHeatFVMVariable::CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, Undivided_Laplacian = new su2double [nVar]; } - Solution_BGS_k = NULL; if (multizone){ - Solution_BGS_k = new su2double [1]; - Solution_BGS_k[0] = val_Heat; + Solution_BGS_k = new su2double [1]; + Solution_BGS_k[0] = val_Heat; } } -CHeatFVMVariable::~CHeatFVMVariable(void) { } +CHeatFVMVariable::~CHeatFVMVariable(void) { + if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; + if (Solution_Direct != NULL) delete [] Solution_Direct; +} diff --git a/SU2_CFD/src/variables/CIncEulerVariable.cpp b/SU2_CFD/src/variables/CIncEulerVariable.cpp index 11488f5e03ae..62b997113a8b 100644 --- a/SU2_CFD/src/variables/CIncEulerVariable.cpp +++ b/SU2_CFD/src/variables/CIncEulerVariable.cpp @@ -53,8 +53,6 @@ CIncEulerVariable::CIncEulerVariable(void) : CVariable() { nSecondaryVar = 0; nSecondaryVarGrad = 0; - Undivided_Laplacian = NULL; - Solution_BGS_k = NULL; } @@ -86,8 +84,6 @@ CIncEulerVariable::CIncEulerVariable(su2double val_pressure, su2double *val_velo nSecondaryVar = 0; nSecondaryVarGrad = 0; - Undivided_Laplacian = NULL; - /*--- Allocate and initialize the primitive variables and gradients ---*/ nPrimVar = nDim+9; nPrimVarGrad = nDim+4; @@ -216,8 +212,6 @@ CIncEulerVariable::CIncEulerVariable(su2double *val_solution, unsigned short val nSecondaryVar = 0; nSecondaryVarGrad = 0; - Undivided_Laplacian = NULL; - /*--- Allocate and initialize the primitive variables and gradients ---*/ nPrimVar = nDim+9; nPrimVarGrad = nDim+4; @@ -323,8 +317,6 @@ CIncEulerVariable::~CIncEulerVariable(void) { delete [] Gradient_Primitive; } - if (Undivided_Laplacian != NULL) delete [] Undivided_Laplacian; - if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; } diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index 5302b467766a..9bb9654008cd 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -108,9 +108,4 @@ void CTurbSAVariable::SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vo AD::EndPreacc(); } -CTurbSAVariable::~CTurbSAVariable(void) { - - if (HB_Source != NULL) delete [] HB_Source; - -} - +CTurbSAVariable::~CTurbSAVariable(void) {} diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 70bffa225d5b..01c5e010345e 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -72,11 +72,7 @@ CTurbSSTVariable::CTurbSSTVariable(su2double val_kine, su2double val_omega, su2d } -CTurbSSTVariable::~CTurbSSTVariable(void) { - - if (HB_Source != NULL) delete [] HB_Source; - -} +CTurbSSTVariable::~CTurbSSTVariable(void) {} void CTurbSSTVariable::SetBlendingFunc(su2double val_viscosity, su2double val_dist, su2double val_density) { unsigned short iDim; diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index b1877c1ea41b..e9a1d90b0149 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -77,5 +77,6 @@ CTurbVariable::CTurbVariable(unsigned short val_nDim, unsigned short val_nvar, C } -CTurbVariable::~CTurbVariable(void) { } - +CTurbVariable::~CTurbVariable(void) { + if (HB_Source != NULL) delete [] HB_Source; +} diff --git a/SU2_CFD/src/variables/CVariable.cpp b/SU2_CFD/src/variables/CVariable.cpp index 7dcc8fa062da..b948adfc98e3 100644 --- a/SU2_CFD/src/variables/CVariable.cpp +++ b/SU2_CFD/src/variables/CVariable.cpp @@ -170,7 +170,7 @@ CVariable::~CVariable(void) { if (Solution_Max != NULL) delete [] Solution_Max; if (Solution_Min != NULL) delete [] Solution_Min; if (Grad_AuxVar != NULL) delete [] Grad_AuxVar; - //if (Undivided_Laplacian != NULL) delete [] Undivided_Laplacian; // Need to break pointer dependence btwn CNumerics and CVariable + if (Undivided_Laplacian != NULL) delete [] Undivided_Laplacian; if (Res_TruncError != NULL) delete [] Res_TruncError; if (Residual_Old != NULL) delete [] Residual_Old; if (Residual_Sum != NULL) delete [] Residual_Sum; From c15229d6a6c86574a9b685a0a1c972f25fc70924 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 7 Jul 2019 22:24:21 +0100 Subject: [PATCH 6/6] consistent EOL characters --- SU2_CFD/src/variables/CDiscAdjVariable.cpp | 2 +- SU2_CFD/src/variables/CHeatFVMVariable.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SU2_CFD/src/variables/CDiscAdjVariable.cpp b/SU2_CFD/src/variables/CDiscAdjVariable.cpp index 20f532a91cc2..dc2558f59cb0 100644 --- a/SU2_CFD/src/variables/CDiscAdjVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjVariable.cpp @@ -68,7 +68,7 @@ CDiscAdjVariable::CDiscAdjVariable(su2double* val_solution, unsigned short val_n || (config->GetUnsteady_Simulation() == DT_STEPPING_2ND); bool fsi = config->GetFSI_Simulation(); - + /*--- Initialize arrays to NULL ---*/ Solution_Direct = NULL; diff --git a/SU2_CFD/src/variables/CHeatFVMVariable.cpp b/SU2_CFD/src/variables/CHeatFVMVariable.cpp index f8206508f8dd..1d7cf9cf78f3 100644 --- a/SU2_CFD/src/variables/CHeatFVMVariable.cpp +++ b/SU2_CFD/src/variables/CHeatFVMVariable.cpp @@ -57,7 +57,7 @@ CHeatFVMVariable::CHeatFVMVariable(su2double val_Heat, unsigned short val_nDim, /*--- Array initialization ---*/ Solution_Direct = NULL; Solution_BGS_k = NULL; - + /*--- Initialization of heat variable ---*/ Solution[0] = val_Heat; Solution_Old[0] = val_Heat;