diff --git a/Common/include/config_structure.inl b/Common/include/config_structure.inl index f2f601536d3e..7d1b2024d209 100644 --- a/Common/include/config_structure.inl +++ b/Common/include/config_structure.inl @@ -1877,7 +1877,7 @@ inline bool CConfig::GetEulerPersson(void) { return EulerPersson; } inline void CConfig::SetEulerPersson(bool val_EulerPersson) { EulerPersson = val_EulerPersson; } -inline bool CConfig::GetFSI_Simulation(void) { return FSI_Problem; } +inline bool CConfig::GetFSI_Simulation(void) { return FSI_Problem || (nMarker_Fluid_Load > 0); } inline void CConfig::SetFSI_Simulation(bool FSI_sim) { FSI_Problem = FSI_sim; } diff --git a/Common/include/geometry_structure.hpp b/Common/include/geometry_structure.hpp index bc8d00bc2077..5632a2b82325 100644 --- a/Common/include/geometry_structure.hpp +++ b/Common/include/geometry_structure.hpp @@ -926,19 +926,19 @@ class CGeometry { */ virtual void SetCoord(CGeometry *geometry); - /*! - * \brief A virtual member. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] val_marker - Index of the boundary marker. - */ - virtual void SetMultiGridWallHeatFlux(CGeometry *geometry, unsigned short val_marker); + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] val_marker - Index of the boundary marker. + */ + virtual void SetMultiGridWallHeatFlux(CGeometry *geometry, unsigned short val_marker); - /*! - * \brief A virtual member. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] val_marker - Index of the boundary marker. - */ - virtual void SetMultiGridWallTemperature(CGeometry *geometry, unsigned short val_marker); + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] val_marker - Index of the boundary marker. + */ + virtual void SetMultiGridWallTemperature(CGeometry *geometry, unsigned short val_marker); /*! * \brief A virtual member. diff --git a/Common/include/toolboxes/C2DContainer.hpp b/Common/include/toolboxes/C2DContainer.hpp new file mode 100644 index 000000000000..3924a35c7729 --- /dev/null +++ b/Common/include/toolboxes/C2DContainer.hpp @@ -0,0 +1,505 @@ +/*! + * \file C2DContainer.hpp + * \brief A templated vector/matrix object. + * \author P. Gomes + * \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 +#include +#include + +/*! + * \enum StorageType + * \brief Supported ways to flatten a matrix into an array. + * Contiguous rows or contiguous columns respectively. + */ +enum class StorageType {RowMajor=0, ColumnMajor=1}; + +/*! + * \enum SizeType + * \brief Special value "DynamicSize" to indicate a dynamic size. + */ +enum SizeType : size_t {DynamicSize=0}; + + +/*--- Namespace to "hide" helper classes and + functions used by the container class. ---*/ +namespace container_helpers +{ +/*! + * \class AccessorImpl + * \brief Base accessor class and version of template for both sizes known at compile time. + * + * The actual container inherits from this class, this is to reduce the number of + * methods that need to be redefined with each size specialization. + */ +template +class AccessorImpl +{ + static_assert(!(StaticRows==1 && Store==StorageType::ColumnMajor), + "Row vector should have row-major storage."); + static_assert(!(StaticCols==1 && Store==StorageType::RowMajor), + "Column vector should have column-major storage."); +protected: + /*! + * For static specializations AlignSize will force the alignment + * specification of the entire class, not just the data. + */ + alignas(AlignSize) Scalar_t m_data[StaticRows*StaticCols]; + + /*! + * Static size specializations use this do-nothing macro. + */ +#define DUMMY_ALLOCATOR \ + void m_allocate(size_t sz, Index_t rows, Index_t cols) noexcept {} + /*! + * Dynamic size specializations use this one, EXTRA is used to set some + * runtime internal value that depend on the number of rows/columns. + * What values need setting depends on the specialization as not all have + * members for e.g. number of rows and cols (static size optimization). + */ +#define REAL_ALLOCATOR(EXTRA) \ + static_assert(AlignSize % alignof(Scalar_t)==0, \ + "AlignSize is not a multiple of the type's alignment spec."); \ + \ + void m_allocate(size_t sz, Index_t rows, Index_t cols) noexcept { \ + EXTRA; \ + if(AlignSize==0) \ + m_data = static_cast(malloc(sz)); \ + else \ + m_data = static_cast(aligned_alloc(AlignSize,sz)); \ + } + + DUMMY_ALLOCATOR + +public: + /*! + * Dynamic types need to manage internal data as the derived class would + * not compile if it tried to set m_data to null on static specializations. + * Move construct/assign are enabled by transferring ownership of data + * pointer, the rvalue is left in the empty state. + * The default ctor needs to "INIT" some fields. The move ctor/assign need + * to "MOVE" those fields, i.e. copy and set "other" appropriately. + */ +#define CUSTOM_CTOR_AND_DTOR_BASE(INIT,MOVE) \ + AccessorImpl() noexcept : m_data(nullptr) {INIT;} \ + \ + AccessorImpl(AccessorImpl&& other) noexcept \ + { \ + MOVE; m_data=other.m_data; other.m_data=nullptr; \ + } \ + \ + AccessorImpl& operator= (AccessorImpl&& other) noexcept \ + { \ + if(m_data!=nullptr) free(m_data); \ + MOVE; m_data=other.m_data; other.m_data=nullptr; \ + return *this; \ + } \ + \ + ~AccessorImpl() {if(m_data!=nullptr) free(m_data);} + /*! + * Shorthand for when specialization has only one more member than m_data. + */ +#define CUSTOM_CTOR_AND_DTOR(X) \ + CUSTOM_CTOR_AND_DTOR_BASE(X=0, X=other.X; other.X=0) + + /*! + * Universal accessors return a raw pointer to the data. + */ +#define UNIV_ACCESSORS \ + bool empty() const noexcept {return size()==0;} \ + Scalar_t* data() noexcept {return m_data;} \ + const Scalar_t* data() const noexcept {return m_data;} + + /*! + * Operator (,) gives pointwise access, operator [] returns a pointer to the + * first element of the row/column of a row/column-major matrix respectively. + */ +#define MATRIX_ACCESSORS(M,N) \ + UNIV_ACCESSORS \ + Index_t rows() const noexcept {return M;} \ + Index_t cols() const noexcept {return N;} \ + size_t size() const noexcept {return M*N;} \ + \ + const Scalar_t& operator() (const Index_t i, \ + const Index_t j) const noexcept \ + { \ + assert(i>=0 && i=0 && j( const_this(i,j) ); \ + } \ + \ + const Scalar_t* operator[] (const Index_t k) const noexcept \ + { \ + if(Store == StorageType::RowMajor) { \ + assert(k>=0 && k=0 && k( const_this[k] ); \ + } + + /*! + * Vectors do not provide operator [] as it is redundant + * since operator () already returns by reference. + */ +#define VECTOR_ACCESSORS(M,ROWMAJOR) \ + UNIV_ACCESSORS \ + Index_t rows() const noexcept {return ROWMAJOR? 1 : M;} \ + Index_t cols() const noexcept {return ROWMAJOR? M : 1;} \ + size_t size() const noexcept {return M;} \ + \ + Scalar_t& operator() (const Index_t i) noexcept \ + { \ + assert(i>=0 && i=0 && i +class AccessorImpl +{ + static_assert(!(StaticCols==1 && Store==StorageType::RowMajor), + "Column vector should have column-major storage."); +protected: + Index_t m_rows; + Scalar_t* m_data; + + REAL_ALLOCATOR(m_rows=rows) + +public: + CUSTOM_CTOR_AND_DTOR(m_rows) + + MATRIX_ACCESSORS(m_rows,StaticCols) +}; + +/*! + * Specialization for compile-time number of columns. + */ +template +class AccessorImpl +{ + static_assert(!(StaticRows==1 && Store==StorageType::ColumnMajor), + "Row vector should have row-major storage."); +protected: + Index_t m_cols; + Scalar_t* m_data; + + REAL_ALLOCATOR(m_cols=cols) + +public: + CUSTOM_CTOR_AND_DTOR(m_cols) + + MATRIX_ACCESSORS(StaticRows,m_cols) +}; + +/*! + * Specialization for fully dynamic sizes (generic matrix). + */ +template +class AccessorImpl +{ +protected: + Index_t m_rows, m_cols; + Scalar_t* m_data; + + REAL_ALLOCATOR(m_rows=rows; m_cols=cols) + +public: + CUSTOM_CTOR_AND_DTOR_BASE(m_rows = 0; m_cols = 0, + m_rows = other.m_rows; other.m_rows = 0; + m_cols = other.m_cols; other.m_cols = 0) + + MATRIX_ACCESSORS(m_rows,m_cols) +}; + +/*! + * Specialization for static column-vector. + */ +template +class AccessorImpl +{ +protected: + alignas(AlignSize) Scalar_t m_data[StaticRows]; + + DUMMY_ALLOCATOR + +public: + VECTOR_ACCESSORS(StaticRows,false) +}; + +/*! + * Specialization for dynamic column-vector. + */ +template +class AccessorImpl +{ +protected: + Index_t m_rows; + Scalar_t* m_data; + + REAL_ALLOCATOR(m_rows=rows) + +public: + CUSTOM_CTOR_AND_DTOR(m_rows) + + VECTOR_ACCESSORS(m_rows,false) +}; + +/*! + * Specialization for static row-vector. + */ +template +class AccessorImpl +{ +protected: + alignas(AlignSize) Scalar_t m_data[StaticCols]; + + DUMMY_ALLOCATOR + +public: + VECTOR_ACCESSORS(StaticCols,true) +}; + +/*! + * Specialization for dynamic row-vector. + */ +template +class AccessorImpl +{ +protected: + Index_t m_cols; + Scalar_t* m_data; + + REAL_ALLOCATOR(m_cols=cols) + +public: + CUSTOM_CTOR_AND_DTOR(m_cols) + + VECTOR_ACCESSORS(m_cols,true) +}; + +#undef CUSTOM_CTOR_AND_DTOR_BASE +#undef CUSTOM_CTOR_AND_DTOR +#undef DUMMY_ALLOCATOR +#undef REAL_ALLOCATOR +#undef MATRIX_ACCESSORS +#undef VECTOR_ACCESSORS +#undef UNIV_ACCESSORS +} + +/*! + * \class C2DContainer + * \brief A templated matrix/vector-like object. + * + * See notes about MATRIX_ACCESSORS and VECTOR_ACCESSORS for how to access data. + * For how to construct/resize/initialize see methods below. + * + * Template parameters: + * + * \param Index_t - The data type (built-in) for indices, signed and unsigned allowed. + * \param Scalar_t - The stored data type, anything that can be default constructed. + * \param Store - Mode to map 1D to 2D, row-major or column-major. + * \param AlignSize - Desired alignment for the data in bytes, 0 means default. + * \param StaticRows - Number of rows at compile time, for dynamic (sized at runtime) use "DynamicSize". + * \param StaticCols - As above for columns. + * + * \note All accesses to data are range checked via assertions, for + * release compile with -DNDEBUG to avoid the associated overhead. + * + */ +template +class C2DContainer : + public container_helpers::AccessorImpl +{ +private: + using Base = container_helpers::AccessorImpl; + using Base::m_data; + using Base::m_allocate; +public: + using Base::size; + +private: + /*! + * \brief Logic to resize data according to arguments, a non DynamicSize cannot be changed. + */ + size_t m_resize(Index_t rows, Index_t cols) noexcept + { + /*--- fully static, no allocation needed ---*/ + if(StaticRows!=DynamicSize && StaticCols!=DynamicSize) + return StaticRows*StaticCols; + + /*--- dynamic row vector, swap size specification ---*/ + if(StaticRows==1 && StaticCols==DynamicSize) {cols = rows; rows = 1;} + + /*--- assert a static size is not being asked to change ---*/ + if(StaticRows!=DynamicSize) assert(rows==StaticRows && "A static size was asked to change."); + if(StaticCols!=DynamicSize) assert(cols==StaticCols && "A static size was asked to change."); + + /*--- "rectify" sizes before continuing as asserts are usually dissabled ---*/ + rows = (StaticRows!=DynamicSize)? StaticRows : rows; + cols = (StaticCols!=DynamicSize)? StaticCols : cols; + + /*--- number of requested elements ---*/ + size_t reqSize = rows*cols; + + /*--- compare with current dimensions to determine if deallocation + is needed, also makes the container safe against self assignment + no need to check for 0 size as the allocators handle that ---*/ + if(m_data!=nullptr) + { + if(rows==this->rows() && cols==this->cols()) + return reqSize; + free(m_data); + } + + /*--- round up size to a multiple of the alignment specification if necessary ---*/ + size_t bytes = reqSize*sizeof(Scalar_t); + size_t allocSize = (AlignSize==0)? bytes : ((bytes+AlignSize-1)/AlignSize)*AlignSize; + + /*--- request actual allocation to base class as it needs specialization ---*/ + m_allocate(allocSize,rows,cols); + + return reqSize; + } + +public: + /*! + * \brief Default ctor. + */ + C2DContainer() noexcept : Base() {} + + /*! + * \brief Sizing ctor (no initialization of data). + * For matrices size1 is rows and size2 columns, for vectors size1 is lenght and size2 is ignored. + */ + C2DContainer(const Index_t size1, const Index_t size2 = 1) noexcept : + Base() {m_resize(size1,size2);} + + /*! + * \brief Copy ctor. + */ + C2DContainer(const C2DContainer& other) noexcept : Base() + { + size_t sz = m_resize(other.rows(),other.cols()); + for(size_t i=0; i using su2vector = C2DContainer; +template using su2matrix = C2DContainer; + +using su2activevector = su2vector; +using su2activematrix = su2matrix; + +using su2passivevector = su2vector; +using su2passivematrix = su2matrix; diff --git a/Common/include/toolboxes/CVertexMap.hpp b/Common/include/toolboxes/CVertexMap.hpp new file mode 100644 index 000000000000..65cfa9ded4dc --- /dev/null +++ b/Common/include/toolboxes/CVertexMap.hpp @@ -0,0 +1,141 @@ +/*! + * \file CVertexMap.hpp + * \brief An index to index lookup vector. + * \author P. Gomes + * \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 "C2DContainer.hpp" +#include +#include + +/*! + * \class CVertexMap + * \brief A lookup type map, maps indices in a large range to indices in a smaller one. + * + * The usage case is: + * 1 - Initialize via Reset for the large range size. + * 2 - Use SetIsVertex to define what large range indices have small range correspondence. + * 3 - Call Build, vertices are given a sequential index in increasing order of iPoint, + * not in order of calls to SetIsVertex. Keep this in mind when allocating vertex data. + * 4 - Use GetVertexIndex to convert a point index to vertex index. + * + * Only consider using this class if you have no reasonable way to keep track of vertices. + * For example if you need to assume every point might be a vertex, but you do not want to + * allocate data for the entire set of points. + * + * \note For efficiency use the smallest type that can fit the maximum number of vertices. + */ +template +class CVertexMap { + static_assert(std::is_unsigned::value && std::is_integral::value, + "Vertex map requires an unsigned integral type (e.g. unsigned)."); + + private: + su2vector Map; /*!< \brief Map from range 0-(nPoint-1) to 1-nVertex. */ + bool isValid = false; /*!< \brief Set to true when it is safe to use the accessors. */ + T nVertex = 0; /*!< \brief Number of vertices. */ + + public: + /*! + * \brief Check if the current mapping is valid. + */ + inline bool GetIsValid() const { return isValid; } + + /*! + * \brief Get the number of vertices currently mapped. + */ + inline T GetnVertex() const { return nVertex; } + + /*! + * \brief Reset the map for size nPoint, marks every point as not-a-vertex. + */ + void Reset(unsigned long nPoint) { + Map.resize(nPoint) = 0; + nVertex = 0; + isValid = true; + } + + /*! + * \brief Set the vertex status of a point. + */ + inline bool SetIsVertex(unsigned long iPoint, bool isVertex) { + /*--- Invalidate map if change is requested as that destroys it. ---*/ + if (isVertex != bool(Map(iPoint))) { + isValid = false; + Map(iPoint) = T(isVertex); + } + return isValid; + } + + /*! + * \brief Get wheter a point is marked as vertex. + */ + inline bool GetIsVertex(unsigned long iPoint) const { + return (Map(iPoint) != 0); + } + + /*! + * \brief Build the point to vertex map. + */ + T Build() { + if (!isValid) { + /*--- The map is 1 based, the accessors correct + accordingly when returning vertex indices. ---*/ + nVertex = 0; + + for (unsigned long iPoint = 0; iPoint < Map.size(); ++iPoint) + if (Map(iPoint)!=0) + Map(iPoint) = ++nVertex; + + isValid = true; + } + return nVertex; + } + + /*! + * \brief Convert a point index to vertex index. + * \param[in,out] iVertex - On entry point index, on exit vertex index. + * \return True if conversion is successful (i.e. point is vertex). + */ + inline bool GetVertexIndex(unsigned long &iVertex) const { + assert(isValid && "Vertex map is not in valid state."); + iVertex = Map(iVertex); + if(iVertex==0) return false; // not a vertex + iVertex--; // decrement for 0 based + return true; // is a vertex + } + +}; diff --git a/Common/include/toolboxes/signal_processing_toolbox.hpp b/Common/include/toolboxes/signal_processing_toolbox.hpp index 8f2128cb5390..9eb35fea067a 100644 --- a/Common/include/toolboxes/signal_processing_toolbox.hpp +++ b/Common/include/toolboxes/signal_processing_toolbox.hpp @@ -5,7 +5,7 @@ namespace Signal_Processing { - su2double Average(std::vector &data); + su2double Average(const std::vector &data); class RunningAverage { @@ -25,11 +25,11 @@ namespace Signal_Processing { return val; } - su2double Get(){ + su2double Get() const{ return val; } - unsigned long Count(){ + unsigned long Count() const{ return count; } diff --git a/Common/src/config_structure.cpp b/Common/src/config_structure.cpp index d6b52b87bc32..82a30b545fef 100644 --- a/Common/src/config_structure.cpp +++ b/Common/src/config_structure.cpp @@ -2476,7 +2476,7 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Multipoint design for outlet quantities (varying back pressure or mass flow operating points). */ addPythonOption("MULTIPOINT_OUTLET_VALUE"); - + /* DESCRIPTION: Multipoint mesh filenames, if using different meshes for each point */ addPythonOption("MULTIPOINT_MESH_FILENAME"); @@ -2915,12 +2915,12 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ SU2_MPI::Error("A turbulence model must be specified with KIND_TURB_MODEL if SOLVER= INC_RANS", CURRENT_FUNCTION); } -#ifndef HAVE_TECIO - if (Output_FileFormat == TECPLOT_BINARY) { - cout << "Tecplot binary file requested but SU2 was built without TecIO support." << "\n"; - Output_FileFormat = TECPLOT; - } -#endif +//#ifndef HAVE_TECIO +// if (Output_FileFormat == TECPLOT_BINARY) { +// cout << "Tecplot binary file requested but SU2 was built without TecIO support." << "\n"; +// Output_FileFormat = TECPLOT; +// } +//#endif /*--- Set the boolean Wall_Functions equal to true if there is a definition for the wall founctions ---*/ diff --git a/Common/src/grid_movement_structure.cpp b/Common/src/grid_movement_structure.cpp index 1333f9f19383..87f66058421a 100644 --- a/Common/src/grid_movement_structure.cpp +++ b/Common/src/grid_movement_structure.cpp @@ -1904,7 +1904,6 @@ void CVolumetricMovement::Rigid_Rotation(CGeometry *geometry, CConfig *config, bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE); bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint()); - /*--- Problem dimension and physical time step ---*/ nDim = geometry->GetnDim(); dt = config->GetDelta_UnstTimeND(); @@ -2066,7 +2065,6 @@ void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, u unsigned long iPoint; bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE); bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint()); - /*--- Retrieve values from the config file ---*/ deltaT = config->GetDelta_UnstTimeND(); @@ -2206,14 +2204,13 @@ void CVolumetricMovement::Rigid_Pitching(CGeometry *geometry, CConfig *config, u void CVolumetricMovement::Rigid_Plunging(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter) { /*--- Local variables ---*/ - su2double deltaX[3], newCoord[3], Center[3], *Coord, Omega[3], Ampl[3], Lref; + su2double deltaX[3], newCoord[3] = {0.0, 0.0, 0.0}, Center[3], *Coord, Omega[3], Ampl[3], Lref; su2double *GridVel, newGridVel[3] = {0.0, 0.0, 0.0}, xDot[3]; su2double deltaT, time_new, time_old; unsigned short iDim, nDim = geometry->GetnDim(); unsigned long iPoint; bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE); bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint()); - /*--- Retrieve values from the config file ---*/ deltaT = config->GetDelta_UnstTimeND(); @@ -2345,7 +2342,6 @@ void CVolumetricMovement::Rigid_Translation(CGeometry *geometry, CConfig *config unsigned long iPoint; bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE); bool adjoint = (config->GetContinuous_Adjoint() || config->GetDiscrete_Adjoint()); - /*--- Retrieve values from the config file ---*/ deltaT = config->GetDelta_UnstTimeND(); diff --git a/Common/src/primal_grid_structure.cpp b/Common/src/primal_grid_structure.cpp index 4fca81028975..429c14c5ea89 100644 --- a/Common/src/primal_grid_structure.cpp +++ b/Common/src/primal_grid_structure.cpp @@ -882,7 +882,7 @@ void CPrimalGridBoundFEM::GetCornerPointsAllFaces(unsigned short &nFaces, /*--- Get the corner points of the face local to the element. ---*/ - unsigned long thisFaceConn[4]; + unsigned long thisFaceConn[4] = {0, 0, 0, 0}; GetLocalCornerPointsFace(VTK_Type, nPolyGrid, nDOFsGrid, nPointsPerFace[0], thisFaceConn); diff --git a/Common/src/toolboxes/signal_processing_toolbox.cpp b/Common/src/toolboxes/signal_processing_toolbox.cpp index 84cf990037e3..774a02448418 100644 --- a/Common/src/toolboxes/signal_processing_toolbox.cpp +++ b/Common/src/toolboxes/signal_processing_toolbox.cpp @@ -1,10 +1,10 @@ #include "../../include/toolboxes/signal_processing_toolbox.hpp" -su2double Signal_Processing::Average(std::vector &data){ +su2double Signal_Processing::Average(const std::vector &data){ su2double avg = 0.0; - for (std::vector::iterator it = data.begin(); it != data.end(); it++){ - avg += (*it); + for (const su2double& val : data){ + avg += val; } - return avg/=data.size(); + return avg/data.size(); } diff --git a/SU2_CFD/include/definition_structure.hpp b/SU2_CFD/include/definition_structure.hpp index 6c96cc27674f..b54f3898ea59 100644 --- a/SU2_CFD/include/definition_structure.hpp +++ b/SU2_CFD/include/definition_structure.hpp @@ -42,10 +42,9 @@ #include -#include "../../Common/include/config_structure.hpp" -#include "../../Common/include/geometry_structure.hpp" #include "../../Common/include/fem_geometry_structure.hpp" - +#include "../../Common/include/geometry_structure.hpp" +#include "../../Common/include/config_structure.hpp" using namespace std; diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index e77961bbb260..2c3040d7be0c 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -38,7 +38,7 @@ #pragma once -#include "../../Common/include/mpi_structure.hpp" +#include "../../../Common/include/mpi_structure.hpp" #include "../iteration_structure.hpp" #include "../solver_structure.hpp" #include "../integration_structure.hpp" diff --git a/SU2_CFD/include/numerics_structure.hpp b/SU2_CFD/include/numerics_structure.hpp index ef6b44d854ee..d4788a3dd3b3 100644 --- a/SU2_CFD/include/numerics_structure.hpp +++ b/SU2_CFD/include/numerics_structure.hpp @@ -272,12 +272,6 @@ class CNumerics { */ void SetTimeStep(su2double val_timestep); - /*! - * \brief Get the Preconditioning Beta. - * \return val_Beta - Value of the low Mach Preconditioner. - */ - virtual su2double GetPrecond_Beta(); - /*! * \brief Set the freestream velocity square. * \param[in] SetVelocity2_Inf - Value of the square of the freestream velocity. @@ -1835,12 +1829,7 @@ class CUpwTurkel_Flow : public CNumerics { * \param[in] config - Definition of the particular problem. */ void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config); - - /*! - * \brief Get the Preconditioning Beta. - * \return Beta - Value of the low Mach Preconditioner. - */ - su2double GetPrecond_Beta(); + }; /*! diff --git a/SU2_CFD/include/numerics_structure.inl b/SU2_CFD/include/numerics_structure.inl index ce1bcae6502d..57c836b396fe 100644 --- a/SU2_CFD/include/numerics_structure.inl +++ b/SU2_CFD/include/numerics_structure.inl @@ -201,8 +201,6 @@ inline void CNumerics::ComputeChemistry(su2double *val_residual, su2double **val inline void CNumerics::GetKeqConstants(su2double *A, unsigned short val_reaction, CConfig *config) { } -inline su2double CNumerics::GetPrecond_Beta() { return 0; } - inline void CNumerics::SetUndivided_Laplacian(su2double *val_und_lapl_i, su2double *val_und_lapl_j) { Und_Lapl_i = val_und_lapl_i; Und_Lapl_j = val_und_lapl_j; @@ -566,8 +564,6 @@ inline su2double CSourcePieceWise_TurbSA_Neg::GetDestruction(void) { return Dest inline su2double CSourcePieceWise_TurbSA_Neg::GetCrossProduction(void) { return CrossProduction; } -inline su2double CUpwTurkel_Flow::GetPrecond_Beta() { return Beta; } - inline void CNumerics::ComputeResidual(su2double **val_Jacobian_i, su2double *val_Jacobian_mui, su2double ***val_Jacobian_gradi, CConfig *config) { } inline void CNumerics::ComputeResidual(su2double **val_Jacobian_i, su2double *val_Jacobian_mui, su2double ***val_Jacobian_gradi, diff --git a/SU2_CFD/include/output/CFlowCompFEMOutput.hpp b/SU2_CFD/include/output/CFlowCompFEMOutput.hpp index fa407f93c497..5195a1be62f4 100644 --- a/SU2_CFD/include/output/CFlowCompFEMOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompFEMOutput.hpp @@ -106,15 +106,6 @@ class CFlowCompFEMOutput final: public CFlowOutput { * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - - /*! - * \brief Compute value of the Q criteration for vortex idenfitication - * \param[in] config - Definition of the particular problem. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] node_flow - The flow variable node - * \return Value of the Q criteration at the node - */ - su2double GetQ_Criterion(CConfig *config, CGeometry *geometry, CVariable *node_flow); /*! * \brief Check whether the base values for relative residuals should be initialized diff --git a/SU2_CFD/include/output/CFlowCompOutput.hpp b/SU2_CFD/include/output/CFlowCompOutput.hpp index 06385afeaba5..b48714ddb931 100644 --- a/SU2_CFD/include/output/CFlowCompOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompOutput.hpp @@ -103,15 +103,6 @@ class CFlowCompOutput final: public CFlowOutput { * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - - /*! - * \brief Compute value of the Q criteration for vortex idenfitication - * \param[in] config - Definition of the particular problem. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] node_flow - The flow variable node - * \return Value of the Q criteration at the node - */ - su2double GetQ_Criterion(CConfig *config, CGeometry *geometry, CVariable *node_flow); /*! * \brief Check whether the base values for relative residuals should be initialized diff --git a/SU2_CFD/include/output/CFlowIncOutput.hpp b/SU2_CFD/include/output/CFlowIncOutput.hpp index 7efeb9467777..153dd8ce2e33 100644 --- a/SU2_CFD/include/output/CFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CFlowIncOutput.hpp @@ -104,15 +104,6 @@ class CFlowIncOutput final: public CFlowOutput { * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - - /*! - * \brief Compute value of the Q criteration for vortex idenfitication - * \param[in] config - Definition of the particular problem. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] node_flow - The flow variable node - * \return Value of the Q criteration at the node - */ - su2double GetQ_Criterion(CConfig *config, CGeometry *geometry, CVariable *node_flow); /*! * \brief Check whether the base values for relative residuals should be initialized diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index f5d0e3aa1f5b..0e663404b286 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -96,6 +96,13 @@ class CFlowOutput : public COutput{ */ void Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CConfig *config); + /*! + * \brief Compute value of the Q criteration for vortex idenfitication + * \param[in] VelocityGradient - Velocity gradients + * \return Value of the Q criteration at the node + */ + su2double GetQ_Criterion(su2double** VelocityGradient) const; + /*! * \brief Write information to meta data file * \param[in] output - Container holding the output instances per zone. diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 949b1afe546d..71b69e618ad3 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -90,9 +90,9 @@ class COutput { string historyFilename; /*!< \brief The history filename*/ /*! \brief Temporary variable to store the history filename */ - char char_histfile[200]; - /*! \brief Output file stream for the history */ - ofstream histFile; + char char_histfile[200]; + /*! \brief Output file stream for the history */ + ofstream histFile; /** \brief Enum to identify the screen output format. */ enum class ScreenOutputFormat { diff --git a/SU2_CFD/include/solver_structure.hpp b/SU2_CFD/include/solver_structure.hpp index 553a8debb405..7ee8ac1faa46 100644 --- a/SU2_CFD/include/solver_structure.hpp +++ b/SU2_CFD/include/solver_structure.hpp @@ -56,8 +56,6 @@ #include "task_definition.hpp" #include "numerics_structure.hpp" #include "sgs_model.hpp" -#include "variables/CVariable.hpp" -#include "variables/CMeshElement.hpp" #include "../../Common/include/gauss_structure.hpp" #include "../../Common/include/element_structure.hpp" #include "../../Common/include/fem_geometry_structure.hpp" @@ -71,6 +69,18 @@ #include "../../Common/include/graph_coloring_structure.hpp" #include "../../Common/include/toolboxes/MMS/CVerificationSolution.hpp" +/*--- CVariable includes, ToDo: Once this file is split, one per class these includes can also be separated. ---*/ +#include "variables/CBaselineVariable.hpp" +#include "variables/CEulerVariable.hpp" +#include "variables/CIncEulerVariable.hpp" +#include "variables/CTurbVariable.hpp" +#include "variables/CAdjEulerVariable.hpp" +#include "variables/CAdjTurbVariable.hpp" +#include "variables/CHeatFVMVariable.hpp" +#include "variables/CDiscAdjVariable.hpp" +#include "variables/CDiscAdjFEABoundVariable.hpp" +#include "variables/CMeshElement.hpp" + using namespace std; /*! @@ -157,8 +167,29 @@ class CSolver { string SolverName; /*!< \brief Store the name of the solver for output purposes. */ - su2double valResidual; /*!< \brief Store the residual of the linear system solution. */ - + su2double valResidual; /*!< \brief Store the residual of the linear system solution. */ + + /*! + * \brief Pure virtual function, all derived solvers MUST implement a method returning their "nodes". + * \note Don't forget to call SetBaseClassPointerToNodes() in the constructor of the derived CSolver. + * \return Nodes of the solver, upcast to their base class (CVariable). + */ + virtual CVariable* GetBaseClassPointerToNodes() = 0; + + /*! + * \brief Call this method to set "base_nodes" after the "nodes" variable of the derived solver is instantiated. + * \note One could set base_nodes directly if it were not private but that could lead to confusion + */ + inline void SetBaseClassPointerToNodes() { base_nodes = GetBaseClassPointerToNodes(); } + +private: + + /*--- Private to prevent use by derived solvers, each solver MUST have its own "nodes" member of the + most derived type possible, e.g. CEulerVariable has nodes of CEulerVariable* and not CVariable*. + This variable is to avoid two virtual functions calls per call i.e. CSolver::GetNodes() returns + directly instead of calling GetBaseClassPointerToNodes() or doing something equivalent. ---*/ + CVariable* base_nodes; /*!< \brief Pointer to CVariable to allow polymorphic access to solver nodes. */ + public: CSysVector LinSysSol; /*!< \brief vector to store iterative solution of implicit linear system. */ @@ -176,10 +207,7 @@ class CSolver { CSysVector OutputVariables; /*!< \brief vector to store the extra variables to be written. */ string* OutputHeadingNames; /*< \brief vector of strings to store the headings for the exra variables */ - - CVariable** node; /*!< \brief Vector which the define the variables for each problem. */ - CVariable* node_infty; /*!< \brief CVariable storing the free stream conditions. */ - + CVerificationSolution *VerificationSolution; /*!< \brief Verification solution class used within the solver. */ vector fields; @@ -192,7 +220,16 @@ class CSolver { * \brief Destructor of the class. */ virtual ~CSolver(void); - + + /*! + * \brief Allow outside access to the nodes of the solver, containing conservatives, primitives, etc. + * \return Nodes of the solver. + */ + inline CVariable* GetNodes() { + assert(base_nodes!=nullptr && "CSolver::base_nodes was not set properly, see brief for CSolver::SetBaseClassPointerToNodes()"); + return base_nodes; + } + /*! * \brief Routine to load a solver quantity into the data structures for MPI point-to-point communication and to launch non-blocking sends and recvs. * \param[in] geometry - Geometrical definition of the problem. @@ -268,9 +305,8 @@ class CSolver { /*! * \brief Store the BGS solution in the previous subiteration in the corresponding vector. - * \param[in] val_iterlinsolver - Number of linear iterations. */ - virtual void UpdateSolution_BGS(CGeometry *geometry, CConfig *config); + void UpdateSolution_BGS(CGeometry *geometry, CConfig *config); /*! * \brief Set the solver nondimensionalization. @@ -528,12 +564,6 @@ class CSolver { * \param[in] config - Definition of the particular problem. */ void SetAuxVar_Surface_Gradient(CGeometry *geometry, CConfig *config); - - /*! - * \brief Set the solution vector to solution in Solution_Old. - * \param[in] geometry - The geometrical definition of the problem. - */ - void SetSolution_Old(CGeometry *geometry); /*! * \brief Add External_Old to Solution vector. @@ -541,18 +571,6 @@ class CSolver { */ void Add_ExternalOld_To_Solution(CGeometry *geometry); - /*! - * \brief Set the Solution vector to zero. - * \param[in] geometry - The geometrical definition of the problem. - */ - void SetSolution_Zero(CGeometry *geometry); - - /*! - * \brief Set the External vector to zero. - * \param[in] geometry - The geometrical definition of the problem. - */ - void SetExternal_Zero(CGeometry *geometry); - /*! * \brief Add the current Solution vector to External. * \param[in] geometry - The geometrical definition of the problem. @@ -565,12 +583,6 @@ class CSolver { */ void Add_Solution_To_ExternalOld(CGeometry *geometry); - /*! - * \brief Set External_Old to External. - * \param[in] geometry - The geometrical definition of the problem. - */ - void Set_OldExternal(CGeometry *geometry); - /*! * \brief Compute the Green-Gauss gradient of the solution. * \param[in] geometry - Geometrical definition of the problem. @@ -4550,8 +4562,16 @@ class CSolver { * \brief Main class for defining a baseline solution from a restart file (for output). * \author F. Palacios, T. Economon. */ -class CBaselineSolver : public CSolver { - +class CBaselineSolver final : public CSolver { +protected: + + CBaselineVariable* nodes = nullptr; /*!< \brief Variables of the baseline solver. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -4626,6 +4646,8 @@ class CBaselineSolver_FEM : public CSolver { vector VecSolDOFs; /*!< \brief Vector, which stores the solution variables in all the DOFs. */ + CVariable* GetBaseClassPointerToNodes() {return nullptr;} + public: /*! @@ -4950,6 +4972,13 @@ class CEulerSolver : public CSolver { su2double ****SlidingState; int **SlidingStateNodes; + CEulerVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: @@ -7225,6 +7254,13 @@ class CIncEulerSolver : public CSolver { su2double ****SlidingState; int **SlidingStateNodes; + CIncEulerVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -9376,12 +9412,21 @@ class CTurbSolver : public CSolver { su2double Gamma; /*!< \brief Fluid's Gamma constant (ratio of specific heats). */ su2double Gamma_Minus_One; /*!< \brief Fluids's Gamma - 1.0 . */ su2double*** Inlet_TurbVars; /*!< \brief Turbulence variables at inlet profiles */ - + + CTurbVariable* snode; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + /* Sliding meshes variables */ su2double ****SlidingState; int **SlidingStateNodes; + CTurbVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -10343,7 +10388,14 @@ class CAdjEulerSolver : public CSolver { unsigned long AoA_Counter; su2double ACoeff, ACoeff_inc, ACoeff_old; bool Update_ACoeff; - + + CAdjEulerVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -10977,7 +11029,14 @@ class CAdjTurbSolver : public CSolver { su2double Gamma; /*!< \brief Fluid's Gamma constant (ratio of specific heats). */ su2double Gamma_Minus_One; /*!< \brief Fluids's Gamma - 1.0 . */ - + + CAdjTurbVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -11089,290 +11148,6 @@ class CAdjTurbSolver : public CSolver { }; -/*! \class CPoissonSolver - * \brief Main class for defining the poisson potential solver. - * \author F. Palacios - * \date May 3, 2010. - */ -class CPoissonSolver : public CSolver { -private: - su2double *Source_Vector; /*!< \brief Auxiliary vector for storing element source vector. */ - su2double **StiffMatrix_Elem; /*!< \brief Auxiliary matrices for storing point to point Stiffness Matrices. */ - su2double **StiffMatrix_Node; /*!< \brief Auxiliary matrices for storing point to point Stiffness Matrices. */ - -public: - - /*! - * \brief Constructor of the class. - */ - CPoissonSolver(void); - - /*! - * \overload - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - */ - CPoissonSolver(CGeometry *geometry, CConfig *config); - - /*! - * \brief A virtual member. - * \param[in] solver1_geometry - Geometrical definition of the problem. - * \param[in] solver1_solution - Container vector with all the solutions. - * \param[in] solver1_config - Definition of the particular problem. - * \param[in] solver2_geometry - Geometrical definition of the problem. - * \param[in] solver2_solution - Container vector with all the solutions. - * \param[in] solver2_config - Definition of the particular problem. - */ - void Copy_Zone_Solution(CSolver ***solver1_solution, CGeometry **solver1_geometry, CConfig *solver1_config, CSolver ***solver2_solution, CGeometry **solver2_geometry, CConfig *solver2_config); - - /*! - * \brief Destructor of the class. - */ - ~CPoissonSolver(void); - - /*! - * \brief Integrate the Poisson equation using a Galerkin method. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - */ - void Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, - unsigned short iMesh, unsigned short iRKStep); - - /*! - * \brief Integrate the Poisson equation using a Galerkin method. - * \param[in] StiffMatrix_Elem - Element stiffness matrix - */ - void AddStiffMatrix(su2double **StiffMatrix_Elem, unsigned long Point_0, unsigned long Point_1, unsigned long Point_2, unsigned long Point_3); - - /*! - * \brief Compute the residual. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - */ - void Compute_Residual(CGeometry *geometry, CSolver **solver_container, CConfig *config, - unsigned short iMesh); - - /*! - * \brief Impose via the residual the Dirichlet boundary condition. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - * \param[in] val_marker - Surface marker where the boundary condition is applied. - */ - void BC_Dirichlet(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short val_marker); - - /*! - * \brief Impose via the residual the Neumann boundary condition. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] val_marker - Surface marker where the boundary condition is applied. - */ - void BC_Neumann(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker); - - /*! - * \brief Set residuals to zero. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - * \param[in] iRKStep - Current step of the Runge-Kutta iteration. - * \param[in] RunTime_EqSystem - System of equations which is going to be solved. - * \param[in] Output - boolean to determine whether to print output. - */ - void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output); - - /*! - * \brief Source term computation. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] second_numerics - Description of the second numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - */ - void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CNumerics *second_numerics, - CConfig *config, unsigned short iMesh); - - /*! - * \brief Source term computation. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - */ - void Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, - CConfig *config, unsigned short iMesh); - - /*! - * \brief Update the solution using an implicit solver. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - */ - void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config); - -}; - -/*! \class CWaveSolver - * \brief Main class for defining the wave solver. - * \author F. Palacios - * \date May 3, 2010. - */ -class CWaveSolver : public CSolver { -private: - su2double *CWave; /*!< \brief Wave strength for each boundary. */ - su2double AllBound_CWave; /*!< \brief Total wave strength for all the boundaries. */ - su2double Total_CWave; /*!< \brief Total wave strength for all the boundaries. */ - - CSysMatrix StiffMatrixSpace; /*!< \brief Sparse structure for storing the stiffness matrix in Galerkin computations. */ - CSysMatrix StiffMatrixTime; /*!< \brief Sparse structure for storing the stiffness matrix in Galerkin computations. */ - - su2double **StiffMatrix_Elem, /*!< \brief Auxiliary matrices for storing point to point Stiffness Matrices. */ - **StiffMatrix_Node; /*!< \brief Auxiliary matrices for storing point to point Stiffness Matrices. */ - -public: - - /*! - * \brief Constructor of the class. - */ - CWaveSolver(void); - - /*! - * \overload - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - */ - CWaveSolver(CGeometry *geometry, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CWaveSolver(void); - - /*! - * \brief Integrate the Poisson equation using a Galerkin method. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - * \param[in] iRKStep - Current step of the Runge-Kutta iteration. - */ - void Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, - unsigned short iMesh, unsigned short iRKStep); - - /*! - * \brief Impose via the residual the Euler wall boundary condition. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] val_marker - Surface marker where the boundary condition is applied. - */ - void BC_Euler_Wall(CGeometry *geometry, - CSolver **solver_container, - CNumerics *conv_numerics, - CNumerics *visc_numerics, - CConfig *config, - unsigned short val_marker) override; - - /*! - * \brief Impose a Dirichlet boundary condition. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] conv_numerics - Description of the numerical method. - * \param[in] visc_numerics - Description of the numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] val_marker - Surface marker where the boundary condition is applied. - */ - void BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, - unsigned short val_marker); - - /*! - * \brief Set residuals to zero. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - * \param[in] iRKStep - Current step of the Runge-Kutta iteration. - * \param[in] RunTime_EqSystem - System of equations which is going to be solved. - * \param[in] Output - boolean to determine whether to print output. - */ - void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output); - - /*! - * \brief Source term computation. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] second_numerics - Description of the second numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - */ - void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CNumerics *second_numerics, - CConfig *config, unsigned short iMesh); - - /*! - * \brief Source term computation. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] numerics - Description of the numerical method. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - */ - void Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, - CConfig *config, unsigned short iMesh); - - /*! - * \brief Update the solution using an implicit solver. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - */ - void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config); - - /*! - * \brief Set the total residual adding the term that comes from the Dual Time Strategy. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - * \param[in] iRKStep - Current step of the Runge-Kutta iteration. - * \param[in] iMesh - Index of the mesh in multigrid computations. - * \param[in] RunTime_EqSystem - System of equations which is going to be solved. - */ - void SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, - unsigned short iRKStep, unsigned short iMesh, unsigned short RunTime_EqSystem); - - /*! - * \brief Compute the total wave strength coefficient. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - */ - void Wave_Strength(CGeometry *geometry, CConfig *config); - - /*! - * \brief Build stiffness matrix in space. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - */ - void SetSpace_Matrix(CGeometry *geometry, - CConfig *config); - - /*! - * \brief Provide the total wave strength. - * \return Value of the wave strength. - */ - su2double GetTotal_CWave(void); - -}; - /*! \class CHeatSolverFVM * \brief Main class for defining the finite-volume heat solver. * \author O. Burghardt @@ -11387,6 +11162,13 @@ class CHeatSolverFVM : public CSolver { *Surface_Areas, Total_HeatFlux_Areas, Total_HeatFlux_Areas_Monitor; su2double ***ConjugateVar, ***InterfaceVar; + CHeatFVMVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -11721,6 +11503,13 @@ class CFEASolver : public CSolver { su2double *Res_Stress_i; /*!< \brief Submatrix to store the nodal stress contribution of node i. */ + CVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: CSysVector TimeRes_Aux; /*!< \brief Auxiliary vector for adding mass and damping contributions to the residual. */ @@ -12367,7 +12156,14 @@ class CFEASolver : public CSolver { */ class CTemplateSolver : public CSolver { private: - + + CVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -12598,7 +12394,14 @@ class CDiscAdjSolver : public CSolver { su2double Mach, Alpha, Beta, Pressure, Temperature, BPressure, ModVel; su2double *Solution_Geometry; /*!< \brief Auxiliary vector for the geometry solution (dimension nDim instead of nVar). */ - + + CDiscAdjVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -12897,6 +12700,13 @@ class CDiscAdjFEASolver : public CSolver { su2double *Local_Sens_DV, *Global_Sens_DV; /*!< \brief Local and global sensitivity of the Design Variable. */ su2double *Total_Sens_DV; + CDiscAdjFEABoundVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -13429,6 +13239,9 @@ class CFEM_DG_EulerSolver : public CSolver { vector tasksList; /*!< \brief List of tasks to be carried out in the computationally intensive part of the solver. */ + + CVariable* GetBaseClassPointerToNodes() {return nullptr;} + public: /*! diff --git a/SU2_CFD/include/solver_structure.inl b/SU2_CFD/include/solver_structure.inl index 2f0ce508955d..9d47478bbb92 100644 --- a/SU2_CFD/include/solver_structure.inl +++ b/SU2_CFD/include/solver_structure.inl @@ -935,12 +935,7 @@ inline unsigned long CSolver::GetPoint_Max_BGS(unsigned short val_var) { return inline su2double* CSolver::GetPoint_Max_Coord_BGS(unsigned short val_var) { return Point_Max_Coord_BGS[val_var]; } -inline void CSolver::Set_OldSolution(CGeometry *geometry) { - for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) - node[iPoint]->Set_OldSolution(); // The loop should be over nPoints - // to guarantee that the boundaries are - // well updated -} +inline void CSolver::Set_OldSolution(CGeometry *geometry) { base_nodes->Set_OldSolution(); } inline void CSolver::Set_NewSolution(CGeometry *geometry) { } @@ -1046,10 +1041,7 @@ inline void CSolver::SetTauWall_WF(CGeometry *geometry, CSolver** solver_contain inline void CSolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {} -inline void CEulerSolver::Set_NewSolution(CGeometry *geometry) { - for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) - node[iPoint]->SetSolution_New(); -} +inline void CEulerSolver::Set_NewSolution(CGeometry *geometry) { nodes->SetSolution_New(); } inline void CSolver::InitTurboContainers(CGeometry *geometry, CConfig *config){} @@ -2452,16 +2444,15 @@ inline void CTurbSolver::SetInlet_TurbVar(unsigned short val_marker, unsigned lo } inline void CTurbSASolver::SetFreeStream_Solution(CConfig *config) { - for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint]->SetSolution(0, nu_tilde_Inf); + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) nodes->SetSolution(iPoint, 0, nu_tilde_Inf); } inline su2double CTurbSASolver::GetNuTilde_Inf(void) { return nu_tilde_Inf; } inline void CTurbSSTSolver::SetFreeStream_Solution(CConfig *config){ for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ - node[iPoint]->SetSolution(0, kine_Inf); - node[iPoint]->SetSolution(1, omega_Inf); + nodes->SetSolution(iPoint, 0, kine_Inf); + nodes->SetSolution(iPoint, 1, omega_Inf); } } diff --git a/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp b/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp index 66dadb27fd15..8e50d04d895b 100644 --- a/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp +++ b/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp @@ -39,6 +39,7 @@ #pragma once #include "../solver_structure.hpp" +#include "../variables/CDiscAdjMeshBoundVariable.hpp" /*! * \class CDiscAdjMeshSolver @@ -51,6 +52,13 @@ class CDiscAdjMeshSolver : public CSolver { unsigned short KindDirect_Solver; CSolver *direct_solver; + CDiscAdjMeshBoundVariable* nodes = nullptr; /*!< \brief Variables of the discrete adjoint mesh solver. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + public: /*! @@ -110,12 +118,6 @@ class CDiscAdjMeshSolver : public CSolver { */ void ComputeResidual_Multizone(CGeometry *geometry, CConfig *config); - /*! - * \brief Store the BGS solution in the previous subiteration in the corresponding vector. - * \param[in] val_iterlinsolver - Number of linear iterations. - */ - void UpdateSolution_BGS(CGeometry *geometry, CConfig *config); - /*! * \brief Prepare the solver for a new recording. * \param[in] kind_recording - Kind of AD recording. diff --git a/SU2_CFD/include/solvers/CMeshSolver.hpp b/SU2_CFD/include/solvers/CMeshSolver.hpp index 614fbe06a50f..7bfc6c62e03c 100644 --- a/SU2_CFD/include/solvers/CMeshSolver.hpp +++ b/SU2_CFD/include/solvers/CMeshSolver.hpp @@ -116,7 +116,7 @@ class CMeshSolver : public CFEASolver { * \param[in] iDim - Dimension required. */ inline su2double Get_ValCoord(CGeometry *geometry, unsigned long indexNode, unsigned short iDim) { - return node[indexNode]->GetMesh_Coord(iDim); + return nodes->GetMesh_Coord(indexNode,iDim); } /*! @@ -154,12 +154,6 @@ class CMeshSolver : public CFEASolver { */ void SetBoundaryDisplacements(CGeometry *geometry, CNumerics *numerics, CConfig *config); - /*! - * \brief Set the value of the max residual and BGS residual. - * \param[in] val_iterlinsolver - Number of linear iterations. - */ - void ComputeResidual_Multizone(CGeometry *geometry, CConfig *config); - /*! * \brief Move the mesh in time. */ @@ -181,14 +175,6 @@ class CMeshSolver : public CFEASolver { */ void Restart_OldGeometry(CGeometry *geometry, CConfig *config); - /*! - * \brief Store the old displacement before a new deformation is done. - */ - inline void SetSolution_Old(void){ - for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint]->Set_OldSolution(); - } - /*! * \brief Get minimun volume in the mesh * \return diff --git a/SU2_CFD/include/variables/CAdjEulerVariable.hpp b/SU2_CFD/include/variables/CAdjEulerVariable.hpp index c03a070d4965..4d56bcdd22bc 100644 --- a/SU2_CFD/include/variables/CAdjEulerVariable.hpp +++ b/SU2_CFD/include/variables/CAdjEulerVariable.hpp @@ -47,104 +47,101 @@ */ 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: + MatrixType Psi; /*!< \brief Vector of the adjoint variables. */ + MatrixType ForceProj_Vector; /*!< \brief Vector d. */ + MatrixType ObjFuncSource; /*!< \brief Vector containing objective function sensitivity for discrete adjoint. */ + MatrixType IntBoundary_Jump; /*!< \brief Interior boundary jump vector. */ + MatrixType HB_Source; /*!< \brief Harmonic balance source term. */ +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] psirho - Value of the adjoint density (initialization value). + * \param[in] phi - Value of the adjoint velocity (initialization value). + * \param[in] psie - Value of the adjoint energy (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CAdjEulerVariable(su2double psirho, const su2double *phi, su2double psie, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - virtual ~CAdjEulerVariable(void); + virtual ~CAdjEulerVariable() = default; /*! * \brief Set all the primitive variables for compressible flows. */ - bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config); + bool SetPrimVar(unsigned long iPoint, su2double SharpEdge_Distance, bool check, CConfig *config) final; /*! * \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]; }; + inline void SetPhi_Old(unsigned long iPoint, const su2double *val_phi) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution_Old(iPoint,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]; } + inline void SetForceProj_Vector(unsigned long iPoint, const su2double *val_ForceProj_Vector) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) ForceProj_Vector(iPoint,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]; + inline void SetObjFuncSource(unsigned long iPoint, const su2double *val_ObjFuncSource) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) ObjFuncSource(iPoint,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]; } + inline void SetIntBoundary_Jump(unsigned long iPoint, const su2double *val_IntBoundary_Jump) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) IntBoundary_Jump(iPoint,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; } + inline su2double *GetForceProj_Vector(unsigned long iPoint) final { return ForceProj_Vector[iPoint]; } /*! * \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; } + inline su2double *GetObjFuncSource(unsigned long iPoint) final { return ObjFuncSource[iPoint]; } /*! * \brief Get the value of the force projection vector. * \return Pointer to the force projection vector. */ - inline su2double *GetIntBoundary_Jump(void) {return IntBoundary_Jump; } + inline su2double *GetIntBoundary_Jump(unsigned long iPoint) final { return IntBoundary_Jump[iPoint]; } /*! * \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. + * \param[in] iVar - Index of the variable. + * \param[in] val_solution - Value of the harmonic balance source term. for the index iVar. */ - inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } + inline void SetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar, su2double val_source) final { + HB_Source(iPoint,iVar) = 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. + * \param[in] iVar - Index of the variable. + * \return Value of the harmonic balance source term for the index iVar. */ - inline su2double GetHarmonicBalance_Source(unsigned short val_var) {return HB_Source[val_var]; } + inline su2double GetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar) const final { + return HB_Source(iPoint,iVar); + } }; diff --git a/SU2_CFD/include/variables/CAdjNSVariable.hpp b/SU2_CFD/include/variables/CAdjNSVariable.hpp index aaad126197e5..66e6f83e6a38 100644 --- a/SU2_CFD/include/variables/CAdjNSVariable.hpp +++ b/SU2_CFD/include/variables/CAdjNSVariable.hpp @@ -45,67 +45,31 @@ * \ingroup Navier_Stokes_Equations * \author F. Palacios */ -class CAdjNSVariable : public CAdjEulerVariable { -private: - +class CAdjNSVariable final : public CAdjEulerVariable { 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] psirho - Value of the adjoint density (initialization value). + * \param[in] phi - Value of the adjoint velocity (initialization value). + * \param[in] psie - Value of the adjoint energy (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CAdjNSVariable(su2double psirho, const su2double *phi, su2double psie, + unsigned long npoint, unsigned long ndim, unsigned long 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]; }; + ~CAdjNSVariable() = default; /*! * \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]; }; + inline void SetVelSolutionDVector(unsigned long iPoint) override { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint,iDim+1) = ForceProj_Vector(iPoint,iDim); + } }; diff --git a/SU2_CFD/include/variables/CAdjTurbVariable.hpp b/SU2_CFD/include/variables/CAdjTurbVariable.hpp index 9aae546b341f..9f1e16a59d96 100644 --- a/SU2_CFD/include/variables/CAdjTurbVariable.hpp +++ b/SU2_CFD/include/variables/CAdjTurbVariable.hpp @@ -45,47 +45,42 @@ * \ingroup Turbulence_Model * \author A. Bueno. */ -class CAdjTurbVariable : public CVariable { +class CAdjTurbVariable final : 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. */ + // ToDo: These variables were not being allocated... is this class used? + MatrixType dmuT_dUTvar; /*!< \brief Sensitivity of eddy viscosity to mean flow and turbulence vars. */ + VectorOfMatrix dRTstar_dUTvar; /*!< \brief Sensitivity of modified turbulence residual (no boundary flux) to mean flow and turbulence vars. */ + VectorOfMatrix dFT_dUTvar; /*!< \brief Sensitivity of boundary flux to mean flow and turbulence vars. */ + MatrixType 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] psinu_inf - Value of the adjoint turbulence variable at the infinity (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CAdjTurbVariable(su2double psinu_inf, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - ~CAdjTurbVariable(void); + ~CAdjTurbVariable() = default; /*! * \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]; + inline void SetEddyViscSens(unsigned long iPoint, const su2double *val_EddyViscSens, unsigned long numTotalVar) override { + for (unsigned long iVar = 0; iVar < numTotalVar; iVar++) + EddyViscSens(iPoint,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; } + inline su2double *GetEddyViscSens(unsigned long iPoint) override { return EddyViscSens[iPoint]; } }; diff --git a/SU2_CFD/include/variables/CBaselineVariable.hpp b/SU2_CFD/include/variables/CBaselineVariable.hpp index 9f52d8c23e0b..921622e07788 100644 --- a/SU2_CFD/include/variables/CBaselineVariable.hpp +++ b/SU2_CFD/include/variables/CBaselineVariable.hpp @@ -44,25 +44,19 @@ * \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 { +class CBaselineVariable final : 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] npoint - Number of points/nodes/vertices in the domain. + * \param[in] 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); + CBaselineVariable(unsigned long npoint, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - virtual ~CBaselineVariable(void); + ~CBaselineVariable() = default; }; diff --git a/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp index f8b064d41992..1062a5feda06 100644 --- a/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp @@ -38,6 +38,7 @@ #pragma once #include "CDiscAdjFEAVariable.hpp" +#include "../../../Common/include/toolboxes/CVertexMap.hpp" /*! * \class CDiscAdjFEABoundVariable @@ -46,55 +47,69 @@ * \author R. Sanchez. * \version 6.2.0 "Falcon" */ -class CDiscAdjFEABoundVariable : public CDiscAdjFEAVariable { -protected: +class CDiscAdjFEABoundVariable final : public CDiscAdjFEAVariable { +private: - su2double *FlowTraction_Sens; /*!< \brief Adjoint of the flow tractions. */ - su2double *SourceTerm_DispAdjoint; /*!< \brief Source term applied into the displacement adjoint - coming from external solvers. */ + MatrixType FlowTraction_Sens; /*!< \brief Adjoint of the flow tractions. */ + MatrixType SourceTerm_DispAdjoint; /*!< \brief Source term applied into the displacement + adjoint coming from external solvers. */ -public: - - /*! - * \brief Constructor of the class. - */ - CDiscAdjFEABoundVariable(void); + CVertexMap VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */ +public: /*! * \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] disp - Pointer to the adjoint value (initialization value). + * \param[in] vel - Pointer to the adjoint value (initialization value). + * \param[in] accel - Pointer to the adjoint value (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] nvar - Number of variables of the problem. + * \param[in] unsteady - Allocate velocity and acceleration. * \param[in] config - Definition of the particular problem. */ - CDiscAdjFEABoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + CDiscAdjFEABoundVariable(const su2double *disp, const su2double *vel, const su2double *accel, + unsigned long npoint, unsigned long ndim, unsigned long nvar, bool unsteady, CConfig *config); /*! * \brief Destructor of the class. */ - ~CDiscAdjFEABoundVariable(void); + ~CDiscAdjFEABoundVariable() = default; + + /*! + * \brief Allocate member variables for points marked as vertex (via "Set_isVertex"). + * \param[in] config - Definition of the particular problem. + */ + void AllocateBoundaryVariables(CConfig *config); /*! * \brief Set the FSI force sensitivity at the node * \param[in] iDim - spacial component * \param[in] val - value of the Sensitivity */ - inline void SetFlowTractionSensitivity(unsigned short iDim, su2double val) { FlowTraction_Sens[iDim] = val; } + inline void SetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim, su2double val) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + FlowTraction_Sens(iPoint,iDim) = val; + } /*! * \brief Get the FSI force sensitivity at the node * \param[in] iDim - spacial component * \return value of the Sensitivity */ - inline su2double GetFlowTractionSensitivity(unsigned short iDim) { return FlowTraction_Sens[iDim]; } + inline su2double GetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return FlowTraction_Sens(iPoint,iDim); + } /*! * \brief Set the source term applied into the displacement adjoint coming from external solvers * \param[in] iDim - spacial component * \param[in] val - value of the source term */ - inline void SetSourceTerm_DispAdjoint(unsigned short iDim, su2double val){ - SourceTerm_DispAdjoint[iDim] = val; + inline void SetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim, su2double val) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + SourceTerm_DispAdjoint(iPoint,iDim) = val; } /*! @@ -102,13 +117,23 @@ class CDiscAdjFEABoundVariable : public CDiscAdjFEAVariable { * \param[in] iDim - spacial component * \return value of the source term */ - inline su2double GetSourceTerm_DispAdjoint(unsigned short iDim){ - return SourceTerm_DispAdjoint[iDim]; + inline su2double GetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return SourceTerm_DispAdjoint(iPoint,iDim); } /*! - * \brief Get whether this node is on the boundary + * \brief Get whether a node is on the boundary */ - inline bool Get_isVertex(void) { return true; } + inline bool Get_isVertex(unsigned long iPoint) const override { + return VertexMap.GetIsVertex(iPoint); + } + + /*! + * \brief Set whether a node is on the boundary + */ + inline void Set_isVertex(unsigned long iPoint, bool isVertex) override { + VertexMap.SetIsVertex(iPoint,isVertex); + } }; diff --git a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp index 60e7a43b6b1d..b439fd7a87df 100644 --- a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp @@ -39,239 +39,255 @@ #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; +protected: + MatrixType Sensitivity; /* Vector holding the derivative of target functional with respect to the coordinates at this node*/ + MatrixType 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; + MatrixType Dynamic_Derivative; + MatrixType Dynamic_Derivative_n; + MatrixType Dynamic_Derivative_Vel; + MatrixType Dynamic_Derivative_Vel_n; + MatrixType Dynamic_Derivative_Accel; + MatrixType Dynamic_Derivative_Accel_n; - su2double* Solution_Vel; - su2double* Solution_Accel; + MatrixType Solution_Vel; + MatrixType Solution_Accel; - su2double* Solution_Vel_time_n; - su2double* Solution_Accel_time_n; + MatrixType Solution_Vel_time_n; + MatrixType Solution_Accel_time_n; - su2double* Solution_Old_Vel; - su2double* Solution_Old_Accel; + MatrixType Solution_Old_Vel; + MatrixType Solution_Old_Accel; - su2double* Solution_Direct_Vel; - su2double* Solution_Direct_Accel; + MatrixType Solution_Direct_Vel; + MatrixType Solution_Direct_Accel; - su2double* Cross_Term_Derivative; - su2double* Geometry_CrossTerm_Derivative; + MatrixType Cross_Term_Derivative; + MatrixType Geometry_CrossTerm_Derivative; - su2double* Solution_BGS; + MatrixType Solution_BGS; -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] disp - Pointer to the adjoint value (initialization value). + * \param[in] vel - Pointer to the adjoint value (initialization value). + * \param[in] accel - Pointer to the adjoint value (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] nvar - Number of variables of the problem. + * \param[in] unsteady - Allocate velocity and acceleration. * \param[in] config - Definition of the particular problem. */ - CDiscAdjFEAVariable(su2double *val_solution, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); + CDiscAdjFEAVariable(const su2double *disp, const su2double *vel, const su2double *accel, + unsigned long npoint, unsigned long ndim, unsigned long nvar, bool unsteady, CConfig *config); +public: /*! - * \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. + * \brief Destructor of the class. */ - CDiscAdjFEAVariable(su2double *val_solution, su2double *val_solution_accel, su2double *val_solution_vel, unsigned short val_ndim, unsigned short val_nvar, CConfig *config); + ~CDiscAdjFEAVariable() = default; /*! * \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;} + inline void SetSensitivity(unsigned long iPoint, unsigned long iDim, su2double val) final { Sensitivity(iPoint,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 su2double GetSensitivity(unsigned long iPoint, unsigned long iDim) const final { return Sensitivity(iPoint,iDim);} - inline void SetDynamic_Derivative(unsigned short iVar, su2double der) {Dynamic_Derivative[iVar] = der; } + inline void SetDynamic_Derivative(unsigned long iPoint, unsigned long iVar, su2double der) final { + Dynamic_Derivative(iPoint,iVar) = der; + } - inline void SetDynamic_Derivative_n(unsigned short iVar, su2double der) {Dynamic_Derivative_n[iVar] = der; } + inline void SetDynamic_Derivative_n(unsigned long iPoint, unsigned long iVar, su2double der) final { + Dynamic_Derivative_n(iPoint,iVar) = der; + } - inline su2double GetDynamic_Derivative(unsigned short iVar) {return Dynamic_Derivative[iVar]; } + inline su2double GetDynamic_Derivative(unsigned long iPoint, unsigned long iVar) const final { + return Dynamic_Derivative(iPoint,iVar); + } - inline su2double GetDynamic_Derivative_n(unsigned short iVar) {return Dynamic_Derivative_n[iVar]; } + inline su2double GetDynamic_Derivative_n(unsigned long iPoint, unsigned long iVar) const final { + return Dynamic_Derivative_n(iPoint,iVar); + } - inline void SetDynamic_Derivative_Vel(unsigned short iVar, su2double der) {Dynamic_Derivative_Vel[iVar] = der; } + inline void SetDynamic_Derivative_Vel(unsigned long iPoint, unsigned long iVar, su2double der) final { + Dynamic_Derivative_Vel(iPoint,iVar) = der; + } - inline void SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der) {Dynamic_Derivative_Vel_n[iVar] = der; } + inline void SetDynamic_Derivative_Vel_n(unsigned long iPoint, unsigned long iVar, su2double der) final { + Dynamic_Derivative_Vel_n(iPoint,iVar) = der; + } - inline su2double GetDynamic_Derivative_Vel(unsigned short iVar) {return Dynamic_Derivative_Vel[iVar]; } + inline su2double GetDynamic_Derivative_Vel(unsigned long iPoint, unsigned long iVar) const final { + return Dynamic_Derivative_Vel(iPoint,iVar); + } - inline su2double GetDynamic_Derivative_Vel_n(unsigned short iVar) {return Dynamic_Derivative_Vel_n[iVar]; } + inline su2double GetDynamic_Derivative_Vel_n(unsigned long iPoint, unsigned long iVar) const final { + return Dynamic_Derivative_Vel_n(iPoint,iVar); + } - inline void SetDynamic_Derivative_Accel(unsigned short iVar, su2double der) {Dynamic_Derivative_Accel[iVar] = der; } + inline void SetDynamic_Derivative_Accel(unsigned long iPoint, unsigned long iVar, su2double der) final { + Dynamic_Derivative_Accel(iPoint,iVar) = der; + } - inline void SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der) {Dynamic_Derivative_Accel_n[iVar] = der; } + inline void SetDynamic_Derivative_Accel_n(unsigned long iPoint, unsigned long iVar, su2double der) final { + Dynamic_Derivative_Accel_n(iPoint,iVar) = der; + } - inline su2double GetDynamic_Derivative_Accel(unsigned short iVar) {return Dynamic_Derivative_Accel[iVar]; } + inline su2double GetDynamic_Derivative_Accel(unsigned long iPoint, unsigned long iVar) const final { + return Dynamic_Derivative_Accel(iPoint,iVar); + } - inline su2double GetDynamic_Derivative_Accel_n(unsigned short iVar) {return Dynamic_Derivative_Accel_n[iVar]; } + inline su2double GetDynamic_Derivative_Accel_n(unsigned long iPoint, unsigned long iVar) const final { + return Dynamic_Derivative_Accel_n(iPoint,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_Direct(unsigned long iPoint, const su2double *val_solution_direct) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Direct(iPoint,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_Vel_Direct(unsigned long iPoint, const su2double *val_solution_direct) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Direct_Vel(iPoint,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 void SetSolution_Accel_Direct(unsigned long iPoint, const su2double *val_solution_direct) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Direct_Accel(iPoint,iVar) = val_solution_direct[iVar]; } - inline su2double* GetSolution_Direct() {return Solution_Direct; } + inline su2double* GetSolution_Direct(unsigned long iPoint) final { return Solution_Direct[iPoint]; } - inline su2double* GetSolution_Vel_Direct() {return Solution_Direct_Vel; } + inline su2double* GetSolution_Vel_Direct(unsigned long iPoint) final { return Solution_Direct_Vel[iPoint]; } - inline su2double* GetSolution_Accel_Direct() {return Solution_Direct_Accel; } + inline su2double* GetSolution_Accel_Direct(unsigned long iPoint) final { return Solution_Direct_Accel[iPoint]; } - inline su2double GetSolution_Old_Vel(unsigned short iVar) {return Solution_Old_Vel[iVar]; } + inline su2double GetSolution_Old_Vel(unsigned long iPoint, unsigned long iVar) const final { return Solution_Old_Vel(iPoint,iVar); } - inline su2double GetSolution_Old_Accel(unsigned short iVar) {return Solution_Old_Accel[iVar]; } + inline su2double GetSolution_Old_Accel(unsigned long iPoint, unsigned long iVar) const final { return Solution_Old_Accel(iPoint,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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetSolution_Accel(unsigned short val_var) {return Solution_Accel[val_var]; } + inline su2double GetSolution_Accel(unsigned long iPoint, unsigned long iVar) const final { return Solution_Accel(iPoint,iVar); } /*! * \brief Get the acceleration of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - 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]; } + inline su2double GetSolution_Accel_time_n(unsigned long iPoint, unsigned long iVar) const final { return Solution_Accel_time_n(iPoint,iVar); } /*! * \brief Get the velocity (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetSolution_Vel(unsigned short val_var) {return Solution_Vel[val_var]; } + inline su2double GetSolution_Vel(unsigned long iPoint, unsigned long iVar) const final { return Solution_Vel(iPoint,iVar); } /*! * \brief Get the velocity of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - 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]; } + inline su2double GetSolution_Vel_time_n(unsigned long iPoint, unsigned long iVar) const final { return Solution_Vel_time_n(iPoint,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]; + inline void SetSolution_Accel(unsigned long iPoint, const su2double *val_solution_accel) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution_Accel(iPoint,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]; + inline void SetSolution_Vel(unsigned long iPoint, const su2double *val_solution_vel) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Vel(iPoint,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]; + inline void SetSolution_Accel_time_n(unsigned long iPoint, const su2double *val_solution_accel_time_n) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Accel_time_n(iPoint,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]; + inline void SetSolution_Vel_time_n(unsigned long iPoint, const su2double *val_solution_vel_time_n) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n(iPoint,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]; - } + void Set_OldSolution_Accel() final; /*! * \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]; - } + void Set_OldSolution_Vel() final; /*! * \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; } + inline void SetCross_Term_Derivative(unsigned long iPoint, unsigned long iVar, su2double der) final { + Cross_Term_Derivative(iPoint,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]; } + inline su2double GetCross_Term_Derivative(unsigned long iPoint, unsigned long iVar) const final { return Cross_Term_Derivative(iPoint,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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return Geometry_CrossTerm_Derivative[val_var];} + inline su2double GetGeometry_CrossTerm_Derivative(unsigned long iPoint, unsigned long iVar) const final { + return Geometry_CrossTerm_Derivative(iPoint,iVar); + } /*! * \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;} + inline void SetGeometry_CrossTerm_Derivative(unsigned long iPoint, unsigned long iVar, su2double der) final { + Geometry_CrossTerm_Derivative(iPoint,iVar) = 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;} + inline void Set_BGSSolution(unsigned long iPoint, unsigned long iDim, su2double val_solution) final { Solution_BGS(iPoint,iDim) = val_solution; } /*! * \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];} + inline su2double Get_BGSSolution(unsigned long iPoint, unsigned long iDim) const final { return Solution_BGS(iPoint,iDim); } - /*! - * \brief Get whether this node is on the boundary - */ - inline virtual bool Get_isVertex(void) { return false; } }; diff --git a/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp b/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp index 56eee21f8f58..ba2f0b82b022 100644 --- a/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp @@ -38,53 +38,67 @@ #pragma once -#include "CDiscAdjMeshVariable.hpp" +#include "CVariable.hpp" +#include "../../../Common/include/toolboxes/CVertexMap.hpp" -class CDiscAdjMeshBoundVariable : public CDiscAdjMeshVariable { -protected: +class CDiscAdjMeshBoundVariable final : public CVariable { +private: - su2double* Bound_Disp_Sens; /*!< \brief Store the reference coordinates of the mesh. */ - su2double* Bound_Disp_Direct; /*!< \brief Store the reference boundary displacements of the mesh. */ + MatrixType Bound_Disp_Sens; /*!< \brief Store the reference coordinates of the mesh. */ + MatrixType Bound_Disp_Direct; /*!< \brief Store the reference boundary displacements of the mesh. */ - su2double* Solution_BGS_k; /*!< \brief BGS solution to compute overall convergence. */ + MatrixType Solution_BGS_k; /*!< \brief BGS solution to compute overall convergence. */ + + CVertexMap VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */ public: /*! * \brief Constructor of the class. - * \param[in] val_coor - Values of the coordinates (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] npoint - Values of the coordinates (initialization value). + * \param[in] ndim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CDiscAdjMeshBoundVariable(su2double *val_coor, unsigned short val_nDim, CConfig *config); + CDiscAdjMeshBoundVariable(unsigned long npoint, unsigned long ndim, CConfig *config); /*! * \brief Destructor of the class. */ - ~CDiscAdjMeshBoundVariable(void); + ~CDiscAdjMeshBoundVariable() = default; + + /*! + * \brief Allocate member variables for points marked as vertex (via "Set_isVertex"). + * \param[in] config - Definition of the particular problem. + */ + void AllocateBoundaryVariables(CConfig *config); /*! * \brief Get the value of the displacement imposed at the boundary. * \return Value of the boundary displacement. */ - inline su2double* GetBoundDisp_Direct(void) { return Bound_Disp_Direct; } + inline const su2double* GetBoundDisp_Direct(unsigned long iPoint) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return nullptr; + return Bound_Disp_Direct[iPoint]; + } /*! * \brief Set the solution for the boundary displacements. * \param[in] val_BoundDisp - Pointer to the boundary displacements. */ - inline void SetBoundDisp_Direct(const su2double *val_BoundDisp) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Bound_Disp_Direct[iDim] = val_BoundDisp[iDim]; + inline void SetBoundDisp_Direct(unsigned long iPoint, const su2double *val_BoundDisp) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Bound_Disp_Direct(iPoint,iDim) = val_BoundDisp[iDim]; } /*! * \brief Set the value of the sensitivity with respect to the undeformed coordinates. * \param[in] val_sens - Pointer to the sensitivities of the boundary displacements. */ - inline void SetBoundDisp_Sens(const su2double *val_sens) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Bound_Disp_Sens[iDim] = val_sens[iDim]; + inline void SetBoundDisp_Sens(unsigned long iPoint, const su2double *val_sens) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Bound_Disp_Sens(iPoint,iDim) = val_sens[iDim]; } /*! @@ -92,26 +106,37 @@ class CDiscAdjMeshBoundVariable : public CDiscAdjMeshVariable { * \param[in] iDim - Index of Mesh_Coord_Sens[nDim] * \return Value of the original Mesh_Coord_Sens iDim. */ - inline su2double GetBoundDisp_Sens(unsigned short iDim) const final { return Bound_Disp_Sens[iDim]; } + inline su2double GetBoundDisp_Sens(unsigned long iPoint, unsigned long iDim) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return Bound_Disp_Sens(iPoint,iDim); + } + + /*! + * \brief Get whether a node is on the boundary + */ + inline bool Get_isVertex(unsigned long iPoint) const override { + return VertexMap.GetIsVertex(iPoint); + } /*! - * \brief Determine whether the node is a moving vertex. - * \return True. The node is at the boundary. + * \brief Set whether a node is on the boundary */ - inline bool Get_isVertex(void) const final { return true; } + inline void Set_isVertex(unsigned long iPoint, bool isVertex) override { + VertexMap.SetIsVertex(iPoint,isVertex); + } /*! * \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] = Bound_Disp_Sens[iVar]; - } + void Set_BGSSolution_k() override; /*! * \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];} + inline su2double Get_BGSSolution_k(unsigned long iPoint, unsigned long iDim) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return Solution_BGS_k(iPoint,iDim); + } }; diff --git a/SU2_CFD/include/variables/CDiscAdjMeshVariable.hpp b/SU2_CFD/include/variables/CDiscAdjMeshVariable.hpp deleted file mode 100644 index 0bbe0aa29e53..000000000000 --- a/SU2_CFD/include/variables/CDiscAdjMeshVariable.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/*! - * \file CDiscAdjMeshVariable.hpp - * \brief Declaration and inlines of the class - * to define the adjoint variables of the mesh movement. - * \author Ruben 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 . - */ - -#pragma once - -#include "CVariable.hpp" - -class CDiscAdjMeshVariable : public CVariable { -protected: - -public: - - /*! - * \brief Constructor of the class. - * \param[in] val_coor - Values of the coordinates (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] config - Definition of the particular problem. - */ - CDiscAdjMeshVariable(su2double *val_coor, unsigned short val_nDim, CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CDiscAdjMeshVariable(void); - - /*! - * \brief Determine whether the node is a moving vertex. - * \return False. The node is not at the boundary. - */ - inline virtual bool Get_isVertex(void) const override { return false; } - -}; diff --git a/SU2_CFD/include/variables/CDiscAdjVariable.hpp b/SU2_CFD/include/variables/CDiscAdjVariable.hpp index da57d66d41de..1ad4ecc1a3a9 100644 --- a/SU2_CFD/include/variables/CDiscAdjVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjVariable.hpp @@ -45,235 +45,186 @@ * \ingroup Discrete_Adjoint * \author T. Albring. */ -class CDiscAdjVariable : public CVariable { +class CDiscAdjVariable final : 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; + MatrixType Sensitivity; /* Vector holding the derivative of target functional with respect to the coordinates at this node*/ + MatrixType Solution_Direct; + MatrixType DualTime_Derivative; + MatrixType DualTime_Derivative_n; - su2double* Cross_Term_Derivative; - su2double* Geometry_CrossTerm_Derivative; - su2double* Geometry_CrossTerm_Derivative_Flow; + MatrixType Cross_Term_Derivative; + MatrixType Geometry_CrossTerm_Derivative; + MatrixType Geometry_CrossTerm_Derivative_Flow; - su2double* Solution_Geometry; - su2double* Solution_Geometry_Old; - su2double* Geometry_Direct; + MatrixType Solution_Geometry; + MatrixType Solution_Geometry_Old; + MatrixType Geometry_Direct; - su2double* Solution_BGS; - su2double* Solution_Geometry_BGS_k; + MatrixType Solution_BGS; + MatrixType Solution_Geometry_BGS_k; public: /*! * \brief Constructor of the class. + * \param[in] sol - Pointer to the adjoint value (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. */ - CDiscAdjVariable(void); + CDiscAdjVariable(const su2double* sol, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \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); + ~CDiscAdjVariable() = default; /*! * \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;} + inline void SetSensitivity(unsigned long iPoint, unsigned long iDim, su2double val) override { Sensitivity(iPoint,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 su2double GetSensitivity(unsigned long iPoint, unsigned long iDim) const override { return Sensitivity(iPoint,iDim); } - inline void SetDual_Time_Derivative(unsigned short iVar, su2double der) {DualTime_Derivative[iVar] = der;} + inline void SetDual_Time_Derivative(unsigned long iPoint, unsigned long iVar, su2double der) override { DualTime_Derivative(iPoint,iVar) = der; } - inline void SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {DualTime_Derivative_n[iVar] = der;} + inline void SetDual_Time_Derivative_n(unsigned long iPoint, unsigned long iVar, su2double der) override { DualTime_Derivative_n(iPoint,iVar) = der; } - inline su2double GetDual_Time_Derivative(unsigned short iVar) {return DualTime_Derivative[iVar];} + inline su2double GetDual_Time_Derivative(unsigned long iPoint, unsigned long iVar) const override { return DualTime_Derivative(iPoint,iVar); } - inline su2double GetDual_Time_Derivative_n(unsigned short iVar) {return DualTime_Derivative_n[iVar];} + inline su2double GetDual_Time_Derivative_n(unsigned long iPoint, unsigned long iVar) const override { return DualTime_Derivative_n(iPoint,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_Direct(unsigned long iPoint, const su2double *val_solution_direct) override { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution_Direct(iPoint,iVar) = val_solution_direct[iVar]; } - inline su2double* GetSolution_Direct() {return Solution_Direct; } + inline su2double* GetSolution_Direct(unsigned long iPoint) override { return Solution_Direct[iPoint]; } /*! * \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]; + inline void SetGeometry_Direct(unsigned long iPoint, const su2double *val_geometry_direct) override { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Geometry_Direct(iPoint,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;} + inline su2double *GetGeometry_Direct(unsigned long iPoint) override { return Geometry_Direct[iPoint]; } /*! * \brief Get the restart geometry (coordinate of the converged solution). - * \return Coordinate val_dim of the geometry_direct vector. + * \return Coordinate iDim of the geometry_direct vector. */ - inline su2double GetGeometry_Direct(unsigned short val_dim) {return Geometry_Direct[val_dim]; } + inline su2double GetGeometry_Direct(unsigned long iPoint, unsigned long iDim) const override { return Geometry_Direct(iPoint,iDim); } /*! * \brief Get the geometry solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. + * \param[in] iDim - Index of the coordinate. + * \return Value of the solution for the index iDim. */ - inline su2double GetSolution_Geometry(unsigned short val_var) {return Solution_Geometry[val_var];} + inline su2double GetSolution_Geometry(unsigned long iPoint, unsigned long iDim) const override { return Solution_Geometry(iPoint,iDim); } /*! * \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]; + inline void SetSolution_Geometry(unsigned long iPoint, const su2double *val_solution_geometry) override { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Solution_Geometry(iPoint,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 Get the external contribution to a solution. - * \return Pointer to the External array. - */ - inline su2double* Get_External(void) const { return External; } - - /*! - * \brief Set external contributions to zero. - */ - inline void SetExternalZero(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - External[iVar] = 0.0; - } - } - - /*! - * \brief Add a value to the External vector. - * \param[in] val_sol - vector that has to be added component-wise - */ - inline void Add_External(const su2double* val_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - External[iVar] += val_sol[iVar]; - } - } - - /*! - * \brief Add a value to the old External vector. - * \param[in] val_solution - Value that we want to add to the solution. - */ - inline void Add_ExternalOld(const su2double *val_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - External_Old[iVar] = External_Old[iVar] + val_sol[iVar]; - } - } - - /*! - * \brief Set old External to the value of the current variables. - */ - inline void Set_OldExternal() { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - External_Old[iVar] = External[iVar]; + inline void SetSolution_Geometry(unsigned long iPoint, unsigned long iVar, su2double val_solution_geometry) override { + Solution_Geometry(iPoint,iVar) = 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return Geometry_CrossTerm_Derivative[val_var];} + inline su2double GetGeometry_CrossTerm_Derivative(unsigned long iPoint, unsigned long iVar) const override { + return Geometry_CrossTerm_Derivative(iPoint,iVar); + } /*! * \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;} + inline void SetGeometry_CrossTerm_Derivative(unsigned long iPoint, unsigned long iDim, su2double der) override { + Geometry_CrossTerm_Derivative(iPoint,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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) {return Geometry_CrossTerm_Derivative_Flow[val_var];} + inline su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned long iPoint, unsigned long iVar) const override { + return Geometry_CrossTerm_Derivative_Flow(iPoint,iVar); + } /*! * \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;} + inline void SetGeometry_CrossTerm_Derivative_Flow(unsigned long iPoint, unsigned long iDim, su2double der) override { + Geometry_CrossTerm_Derivative_Flow(iPoint,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]; - } + void Set_OldSolution_Geometry() override; /*! * \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];} + inline su2double Get_OldSolution_Geometry(unsigned long iPoint, unsigned long iDim) const override { + return Solution_Geometry_Old(iPoint,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;} + inline void Set_BGSSolution(unsigned long iPoint, unsigned long iDim, su2double val_solution) override { + Solution_BGS(iPoint,iDim) = val_solution; + } /*! * \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 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];} + inline su2double Get_BGSSolution(unsigned long iPoint, unsigned long iDim) const override { return Solution_BGS(iPoint,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; } + inline void SetCross_Term_Derivative(unsigned long iPoint, unsigned long iVar, su2double der) override { + Cross_Term_Derivative(iPoint,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]; } + inline su2double GetCross_Term_Derivative(unsigned long iPoint, unsigned long iVar) const override { + return Cross_Term_Derivative(iPoint,iVar); + } }; diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index b6d191877ea2..2c63aea50a05 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -47,239 +47,161 @@ */ 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 */ + VectorType Velocity2; /*!< \brief Square of the velocity vector. */ + MatrixType HB_Source; /*!< \brief harmonic balance source term. */ + MatrixType WindGust; /*! < \brief Wind gust value */ + MatrixType 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). */ + MatrixType Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ + VectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ + MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ /*--- Secondary variable definition ---*/ + MatrixType Secondary; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ - 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; + MatrixType Solution_New; /*!< \brief New solution container for Classical RK4. */ 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] density - Value of the flow density (initialization value). + * \param[in] velocity - Value of the flow velocity (initialization value). + * \param[in] energy - Value of the flow energy (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CEulerVariable(su2double density, const su2double *velocity, su2double energy, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - virtual ~CEulerVariable(void); + virtual ~CEulerVariable() = default; /*! * \brief Get the new solution of the problem (Classical RK4). - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline su2double GetSolution_New(unsigned short val_var) {return Solution_New[val_var]; } + inline su2double GetSolution_New(unsigned long iPoint, unsigned long iVar) const final { return Solution_New(iPoint,iVar); } /*! * \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]; - } + void SetSolution_New() final; /*! * \brief Add a value to the new solution container for Classical RK4. - * \param[in] val_var - Number of the variable. + * \param[in] iVar - 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; } + inline void AddSolution_New(unsigned long iPoint, unsigned long iVar, su2double val_solution) final { + Solution_New(iPoint,iVar) += val_solution; + } /*! * \brief Set to zero the gradient of the primitive variables. */ - void SetGradient_SecondaryZero(unsigned short val_secondaryvar); + void SetGradient_PrimitiveZero() final; /*! - * \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. + * \brief Add value to the gradient of the primitive variables. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void AddGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) += 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. + * \brief Subtract value to the gradient of the primitive variables. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void SubtractGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) -= 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. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - 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]; } + inline su2double GetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final { + return Gradient_Primitive(iPoint,iVar,iDim); + } /*! * \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. + * \param[in] iVar - Index of the variable. * \return Value of the primitive variables gradient. */ - inline su2double GetLimiter_Secondary(unsigned short val_var) {return Limiter_Secondary[val_var]; } + inline su2double GetLimiter_Primitive(unsigned long iPoint, unsigned long iVar) const final {return Limiter_Primitive(iPoint,iVar); } /*! * \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. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void SetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) = 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. + * \param[in] iVar - Index of the variable. + * \param[in] value - Value of the gradient. */ - inline void SetLimiter_Secondary(unsigned short val_var, su2double val_value) {Limiter_Secondary[val_var] = val_value; } + inline void SetLimiter_Primitive(unsigned long iPoint, unsigned long iVar, su2double value) final { + Limiter_Primitive(iPoint,iVar) = 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; } + inline su2double **GetGradient_Primitive(unsigned long iPoint) final { return Gradient_Primitive[iPoint]; } /*! * \brief Get the value of the primitive variables gradient. * \return Value of the primitive variables gradient. */ - inline su2double *GetLimiter_Secondary(void) {return Limiter_Secondary; } + inline su2double *GetLimiter_Primitive(unsigned long iPoint) final { return Limiter_Primitive[iPoint]; } /*! * \brief A virtual member. */ - inline void SetdPdrho_e(su2double dPdrho_e) {Secondary[0] = dPdrho_e;} + inline void SetdPdrho_e(unsigned long iPoint, su2double dPdrho_e) final { Secondary(iPoint,0) = dPdrho_e;} /*! * \brief A virtual member. */ - inline void SetdPde_rho(su2double dPde_rho) {Secondary[1] = dPde_rho;} + inline void SetdPde_rho(unsigned long iPoint, su2double dPde_rho) final { Secondary(iPoint,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; + inline bool SetPressure(unsigned long iPoint, su2double pressure) final { + Primitive(iPoint,nDim+1) = pressure; + return pressure <= 0.0; } /*! * \brief Set the value of the speed of the sound. * \param[in] soundspeed2 - Value of soundspeed^2. */ - bool SetSoundSpeed(su2double soundspeed2) { + bool SetSoundSpeed(unsigned long iPoint, su2double soundspeed2) final { su2double radical = soundspeed2; if (radical < 0.0) return true; else { - Primitive[nDim+4] = sqrt(radical); + Primitive(iPoint,nDim+4) = sqrt(radical); return false; } } @@ -287,164 +209,169 @@ class CEulerVariable : public CVariable { /*! * \brief Set the value of the enthalpy. */ - inline void SetEnthalpy(void) {Primitive[nDim+3] = (Solution[nVar-1] + Primitive[nDim+1]) / Solution[0]; } + inline void SetEnthalpy(unsigned long iPoint) final { + Primitive(iPoint,nDim+3) = (Solution(iPoint,nVar-1) + Primitive(iPoint,nDim+1)) / Solution(iPoint,0); + } /*! * \brief Set all the primitive variables for compressible flows. */ - bool SetPrimVar(CFluidModel *FluidModel); + bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) final; /*! * \brief A virtual member. */ - void SetSecondaryVar(CFluidModel *FluidModel); + void SetSecondaryVar(unsigned long iPoint, 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. + * \param[in] iVar - Index of the variable. + * \return Value of the primitive variable for the index iVar. */ - inline su2double GetPrimitive(unsigned short val_var) {return Primitive[val_var]; } + inline su2double GetPrimitive(unsigned long iPoint, unsigned long iVar) const final { return Primitive(iPoint,iVar); } /*! * \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. + * \param[in] iVar - Index of the variable. + * \param[in] iVar - Index of the variable. + * \return Set the value of the primitive variable for the index iVar. */ - inline void SetPrimitive(unsigned short val_var, su2double val_prim) {Primitive[val_var] = val_prim; } + inline void SetPrimitive(unsigned long iPoint, unsigned long iVar, su2double val_prim) final { Primitive(iPoint,iVar) = 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. + * \return Set the value of the primitive variable for the index iVar. */ - inline void SetPrimitive(su2double *val_prim) { - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Primitive[iVar] = val_prim[iVar]; + inline void SetPrimitive(unsigned long iPoint, const su2double *val_prim) final { + for (unsigned long iVar = 0; iVar < nPrimVar; iVar++) + Primitive(iPoint,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; } + inline su2double *GetPrimitive(unsigned long iPoint) final {return Primitive[iPoint]; } /*! * \brief Get the primitive variables. - * \param[in] val_var - Index of the variable. - * \return Value of the primitive variable for the index val_var. + * \param[in] iVar - Index of the variable. + * \return Value of the primitive variable for the index iVar. */ - inline su2double GetSecondary(unsigned short val_var) {return Secondary[val_var]; } + inline su2double GetSecondary(unsigned long iPoint, unsigned long iVar) const final {return Secondary(iPoint,iVar); } /*! * \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. + * \param[in] iVar - Index of the variable. + * \param[in] iVar - Index of the variable. + * \return Set the value of the primitive variable for the index iVar. */ - inline void SetSecondary(unsigned short val_var, su2double val_secondary) {Secondary[val_var] = val_secondary; } + inline void SetSecondary(unsigned long iPoint, unsigned long iVar, su2double val_secondary) final {Secondary(iPoint,iVar) = 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. + * \return Set the value of the primitive variable for the index iVar. */ - inline void SetSecondary(su2double *val_secondary) { - for (unsigned short iVar = 0; iVar < nSecondaryVar; iVar++) - Secondary[iVar] = val_secondary[iVar]; + inline void SetSecondary(unsigned long iPoint, const su2double *val_secondary) final { + for (unsigned long iVar = 0; iVar < nSecondaryVar; iVar++) + Secondary(iPoint,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; } + inline su2double *GetSecondary(unsigned long iPoint) final { return Secondary[iPoint]; } /*! * \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; + inline bool SetDensity(unsigned long iPoint) final { + Primitive(iPoint,nDim+2) = Solution(iPoint,0); + return Primitive(iPoint,nDim+2) <= 0.0; } /*! * \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; + inline bool SetTemperature(unsigned long iPoint, su2double temperature) final { + Primitive(iPoint,0) = temperature; + return temperature <= 0.0; } /*! * \brief Get the norm 2 of the velocity. * \return Norm 2 of the velocity vector. */ - inline su2double GetVelocity2(void) {return Velocity2; } + inline su2double GetVelocity2(unsigned long iPoint) const final { return Velocity2(iPoint); } /*! * \brief Get the flow pressure. * \return Value of the flow pressure. */ - inline su2double GetPressure(void) {return Primitive[nDim+1]; } + inline su2double GetPressure(unsigned long iPoint) const final { return Primitive(iPoint,nDim+1); } /*! * \brief Get the speed of the sound. * \return Value of speed of the sound. */ - inline su2double GetSoundSpeed(void) {return Primitive[nDim+4]; } + inline su2double GetSoundSpeed(unsigned long iPoint) const final { return Primitive(iPoint,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]; } + inline su2double GetEnthalpy(unsigned long iPoint) const final { return Primitive(iPoint,nDim+3); } /*! * \brief Get the density of the flow. * \return Value of the density of the flow. */ - inline su2double GetDensity(void) {return Solution[0]; } + inline su2double GetDensity(unsigned long iPoint) const final { return Solution(iPoint,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]; }; + inline su2double GetEnergy(unsigned long iPoint) const final { return Solution(iPoint,nVar-1)/Solution(iPoint,0); } /*! * \brief Get the temperature of the flow. * \return Value of the temperature of the flow. */ - inline su2double GetTemperature(void) {return Primitive[0]; } + inline su2double GetTemperature(unsigned long iPoint) const final { return Primitive(iPoint,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. + * \param[in] iDim - Index of the dimension. + * \return Value of the velocity for the dimension iDim. */ - inline su2double GetVelocity(unsigned short val_dim) {return Primitive[val_dim+1]; } + inline su2double GetVelocity(unsigned long iPoint, unsigned long iDim) const final { return Primitive(iPoint,iDim+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); + inline su2double GetProjVel(unsigned long iPoint, const su2double *val_vector) const final { + su2double ProjVel = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjVel += Primitive(iPoint,iDim+1)*val_vector[iDim]; + return ProjVel; + } /*! * \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]; + inline void SetVelocity(unsigned long iPoint) final { + Velocity2(iPoint) = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + Primitive(iPoint,iDim+1) = Solution(iPoint,iDim+1) / Solution(iPoint,0); + Velocity2(iPoint) += pow(Primitive(iPoint,iDim+1),2); } } @@ -452,65 +379,55 @@ class CEulerVariable : public CVariable { * \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]; + inline void SetVelocity_Old(unsigned long iPoint, const su2double *val_velocity) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Solution_Old(iPoint,iDim+1) = val_velocity[iDim]*Solution(iPoint,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. + * \param[in] iVar - Index of the variable. + * \param[in] val_solution - Value of the harmonic balance source term. for the index iVar. */ - inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } + inline void SetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar, su2double val_source) final { + HB_Source(iPoint,iVar) = 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 + * \param[in] iVar - Index of the variable. + * \return Value of the harmonic balance source term for the index iVar. */ - inline void SetPreconditioner_Beta(su2double val_Beta) {Precond_Beta = val_Beta; } + inline su2double GetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar) const final { return HB_Source(iPoint,iVar); } /*! * \brief Get the value of the wind gust * \return Value of the wind gust */ - inline su2double* GetWindGust() {return WindGust;} + inline su2double* GetWindGust(unsigned long iPoint) final { return WindGust[iPoint]; } /*! * \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]; + inline void SetWindGust(unsigned long iPoint, const su2double* val_WindGust) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + WindGust(iPoint,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;} + inline su2double* GetWindGustDer(unsigned long iPoint) final { return WindGustDer[iPoint]; } /*! * \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]; + inline void SetWindGustDer(unsigned long iPoint, const su2double* val_WindGustDer) final { + for (unsigned long iDim = 0; iDim < nDim+1; iDim++) + WindGustDer(iPoint,iDim) = val_WindGustDer[iDim]; } }; diff --git a/SU2_CFD/include/variables/CFEABoundVariable.hpp b/SU2_CFD/include/variables/CFEABoundVariable.hpp index 23c8625719ea..2c071bc829d4 100644 --- a/SU2_CFD/include/variables/CFEABoundVariable.hpp +++ b/SU2_CFD/include/variables/CFEABoundVariable.hpp @@ -38,80 +38,169 @@ #pragma once #include "CFEAVariable.hpp" +#include "../../../Common/include/toolboxes/CVertexMap.hpp" /*! * \class CFEABoundVariable - * \brief Class for defining the variables on the FEA boundaries for FSI applications. + * \brief Class that adds storage of boundary variables (tractions) to CFEAVariable. + * \note Member variables are allocated only for points marked as "vertex" i.e. on a boundary. + * A map is constructed so that variables can be referenced by iPoint instead of iVertex. * \ingroup Structural Finite Element Analysis Variables * \author R. Sanchez. * \version 6.2.0 "Falcon" */ -class CFEABoundVariable : public CFEAVariable { +class CFEABoundVariable final : public CFEAVariable { protected: - 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 */ + MatrixType FlowTraction; /*!< \brief Traction from the fluid field. */ + MatrixType FlowTraction_n; /*!< \brief Traction from the fluid field at time n. */ -public: + MatrixType Residual_Ext_Surf; /*!< \brief Term of the residual due to external forces. */ + MatrixType Residual_Ext_Surf_n; /*!< \brief Term of the residual due to external forces at time n. */ - /*! - * \brief Constructor of the class. - */ - CFEABoundVariable(void); + CVertexMap VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */ + + bool fsi_analysis = false; /*!< \brief If flow tractions are available. */ +public: /*! - * \overload + * \brief Constructor of the class. * \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] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CFEABoundVariable(const su2double *val_fea, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - ~CFEABoundVariable(void); + ~CFEABoundVariable() = default; + + /*! + * \brief Allocate member variables for points marked as vertex (via "Set_isVertex"). + * \param[in] config - Definition of the particular problem. + */ + void AllocateBoundaryVariables(CConfig *config); /*! * \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]; + inline void Add_SurfaceLoad_Res(unsigned long iPoint, const su2double *val_surfForce) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf(iPoint,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;} + inline void Set_SurfaceLoad_Res(unsigned long iPoint, unsigned long iVar, su2double val_surfForce) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + Residual_Ext_Surf(iPoint,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];} + inline su2double Get_SurfaceLoad_Res(unsigned long iPoint, unsigned long iVar) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return Residual_Ext_Surf(iPoint,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; + inline void Clear_SurfaceLoad_Res(unsigned long iPoint) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf(iPoint,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]; - } + void Set_SurfaceLoad_Res_n() override; /*! * \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]; } + inline su2double Get_SurfaceLoad_Res_n(unsigned long iPoint, unsigned long iVar) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return Residual_Ext_Surf_n(iPoint,iVar); + } + + /*! + * \brief Set the flow traction at a node on the structural side + */ + inline void Set_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) override { + if (!fsi_analysis) return; + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iVar = 0; iVar < nVar; iVar++) FlowTraction(iPoint,iVar) = val_flowTraction[iVar]; + } + + /*! + * \brief Add a value to the flow traction at a node on the structural side + */ + inline void Add_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) override { + if (!fsi_analysis) return; + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iVar = 0; iVar < nVar; iVar++) FlowTraction(iPoint,iVar) += val_flowTraction[iVar]; + } + + /*! + * \brief Get the residual term due to the flow traction + */ + inline su2double Get_FlowTraction(unsigned long iPoint, unsigned long iVar) const override { + if (!fsi_analysis) return 0.0; + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return FlowTraction(iPoint,iVar); + } + + /*! + * \brief Set the value of the flow traction at the previous time step. + */ + void Set_FlowTraction_n() override; + + /*! + * \brief Retrieve the value of the flow traction from the previous time step. + */ + inline su2double Get_FlowTraction_n(unsigned long iPoint, unsigned long iVar) const override { + if (!fsi_analysis) return 0.0; + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return FlowTraction_n(iPoint,iVar); + } + + /*! + * \brief Clear the flow traction residual + */ + void Clear_FlowTraction() override; /*! - * \brief Get whether this node is on the boundary + * \brief Register the flow tractions as input variable. */ - inline bool Get_isVertex(void) {return true; } + void RegisterFlowTraction() override; + + /*! + * \brief Extract the flow traction derivatives. + */ + inline su2double ExtractFlowTraction_Sensitivity(unsigned long iPoint, unsigned long iDim) const override { + if (!fsi_analysis) return 0.0; + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return SU2_TYPE::GetDerivative(FlowTraction(iPoint,iDim)); + } + + /*! + * \brief Get whether a node is on the boundary + */ + inline bool Get_isVertex(unsigned long iPoint) const override { + return VertexMap.GetIsVertex(iPoint); + } + + /*! + * \brief Set whether a node is on the boundary + */ + inline void Set_isVertex(unsigned long iPoint, bool isVertex) override { + VertexMap.SetIsVertex(iPoint,isVertex); + } }; diff --git a/SU2_CFD/include/variables/CFEAFSIBoundVariable.hpp b/SU2_CFD/include/variables/CFEAFSIBoundVariable.hpp deleted file mode 100644 index 2a452c44dfbc..000000000000 --- a/SU2_CFD/include/variables/CFEAFSIBoundVariable.hpp +++ /dev/null @@ -1,132 +0,0 @@ -/*! - * \file CFEAFSIBoundVariable.hpp - * \brief Class for defining the variables on the FEA boundaries for FSI applications. - * \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 . - */ - -#pragma once - -#include "CFEABoundVariable.hpp" - - -/*! - * \class CFEAFSIBoundVariable - * \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 CFEAFSIBoundVariable : public CFEABoundVariable { -protected: - - su2double *FlowTraction; /*!< \brief Traction from the fluid field. */ - su2double *FlowTraction_n; /*!< \brief Traction from the fluid field at time n. */ - -public: - - /*! - * \brief Constructor of the class. - */ - CFEAFSIBoundVariable(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. - */ - CFEAFSIBoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, - CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CFEAFSIBoundVariable(void); - - /*! - * \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 Register the flow tractions as input variable. - */ - inline void RegisterFlowTraction() { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(FlowTraction[iVar]); - } - - /*! - * \brief Extract the flow traction derivatives. - */ - inline su2double ExtractFlowTraction_Sensitivity(unsigned short iDim){ - su2double val_sens; val_sens = SU2_TYPE::GetDerivative(FlowTraction[iDim]); return val_sens; - } - - -}; diff --git a/SU2_CFD/include/variables/CFEAVariable.hpp b/SU2_CFD/include/variables/CFEAVariable.hpp index 7412420f93be..5108a20d522e 100644 --- a/SU2_CFD/include/variables/CFEAVariable.hpp +++ b/SU2_CFD/include/variables/CFEAVariable.hpp @@ -49,444 +49,441 @@ class CFEAVariable : public CVariable { protected: - su2double *Stress; /*!< \brief Stress tensor. */ + MatrixType Stress; /*!< \brief Stress tensor. */ - su2double *Residual_Ext_Body; /*!< \brief Term of the residual due to body forces */ + MatrixType Residual_Ext_Body; /*!< \brief Term of the residual due to body forces */ - su2double VonMises_Stress; /*!< \brief Von Mises stress. */ + VectorType 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. */ + MatrixType Solution_Vel; /*!< \brief Velocity of the nodes. */ + MatrixType 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. */ + MatrixType Solution_Accel; /*!< \brief Acceleration of the nodes. */ + MatrixType 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 */ + MatrixType Solution_Pred; /*!< \brief Predictor of the solution for FSI purposes */ + MatrixType Solution_Pred_Old; /*!< \brief Predictor of the solution at time n for FSI purposes */ - su2double *Reference_Geometry; /*!< \brief Reference solution for optimization problems */ + MatrixType Reference_Geometry; /*!< \brief Reference solution for optimization problems */ - su2double *Prestretch; /*!< \brief Prestretch geometry */ - -public: + MatrixType Prestretch; /*!< \brief Prestretch geometry */ /*! * \brief Constructor of the class. - */ - CFEAVariable(void); - - /*! - * \overload + * \note This class is not supposed to be instantiated, it is only a building block for CFEABoundVariable * \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] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CFEAVariable(const su2double *val_fea, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); +public: /*! * \brief Destructor of the class. */ - ~CFEAVariable(void); + virtual ~CFEAVariable() = default; /*! * \brief Get the value of the stress. * \return Value of the stress. */ - inline su2double *GetStress_FEM(void) {return Stress; } + inline su2double *GetStress_FEM(unsigned long iPoint) final { return Stress[iPoint]; } /*! * \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; } + inline void SetStress_FEM(unsigned long iPoint, unsigned long iVar, su2double val_stress) final { Stress(iPoint,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; } + inline void AddStress_FEM(unsigned long iPoint, unsigned long iVar, su2double val_stress) final { Stress(iPoint,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]; + inline void Add_BodyForces_Res(unsigned long iPoint, const su2double *val_bodyForce) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Residual_Ext_Body(iPoint,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; + inline void Clear_BodyForces_Res(unsigned long iPoint) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Residual_Ext_Body(iPoint,iVar) = 0.0; } /*! * \brief Get the body forces. */ - inline su2double Get_BodyForces_Res(unsigned short iVar) {return Residual_Ext_Body[iVar];} + inline su2double Get_BodyForces_Res(unsigned long iPoint, unsigned long iVar) const final { return Residual_Ext_Body(iPoint,iVar); } /*! * \brief Set the value of the velocity (Structural Analysis). - * \param[in] val_solution - Solution of the problem (velocity). + * \param[in] val_solution_vel - 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]; + inline void SetSolution_Vel(unsigned long iPoint, const su2double *val_solution_vel) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Vel(iPoint,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. + * \param[in] iVar - Index of the variable. + * \param[in] val_solution_vel - Value of the solution for the index iVar. */ - inline void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) {Solution_Vel[val_var] = val_solution_vel; } + inline void SetSolution_Vel(unsigned long iPoint, unsigned long iVar, su2double val_solution_vel) final { + Solution_Vel(iPoint,iVar) = 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]; - } + void SetSolution_Vel_time_n() final; /*! * \brief Set the value of the velocity (Structural Analysis) at time n. - * \param[in] val_solution_old - Pointer to the residual vector. + * \param[in] val_solution_vel_time_n - 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]; + inline void SetSolution_Vel_time_n(unsigned long iPoint, const su2double *val_solution_vel_time_n) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Vel_time_n(iPoint,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. + * \param[in] iVar - Index of the variable. + * \param[in] val_solution_vel_time_n - Value of the old solution for the index iVar. */ - 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; } + inline void SetSolution_Vel_time_n(unsigned long iPoint, unsigned long iVar, su2double val_solution_vel_time_n) final { + Solution_Vel_time_n(iPoint,iVar) = 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetSolution_Vel(unsigned short val_var) {return Solution_Vel[val_var]; } + inline su2double GetSolution_Vel(unsigned long iPoint, unsigned long iVar) const final { return Solution_Vel(iPoint,iVar); } /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ - inline su2double *GetSolution_Vel(void) {return Solution_Vel; } + inline su2double *GetSolution_Vel(unsigned long iPoint) final { return Solution_Vel[iPoint]; } /*! * \brief Get the velocity of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - 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]; } + inline su2double GetSolution_Vel_time_n(unsigned long iPoint, unsigned long iVar) const final { + return Solution_Vel_time_n(iPoint,iVar); + } /*! * \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; } + inline su2double *GetSolution_Vel_time_n(unsigned long iPoint) final { return Solution_Vel_time_n[iPoint]; } /*! * \brief Set the value of the acceleration (Structural Analysis). - * \param[in] val_solution - Solution of the problem (acceleration). + * \param[in] val_solution_accel - 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]; + inline void SetSolution_Accel(unsigned long iPoint, const su2double *val_solution_accel) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Accel(iPoint,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. + * \param[in] iVar - Index of the variable. + * \param[in] val_solution_accel - Value of the solution for the index iVar. */ - inline void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) {Solution_Accel[val_var] = val_solution_accel;} + inline void SetSolution_Accel(unsigned long iPoint, unsigned long iVar, su2double val_solution_accel) final { + Solution_Accel(iPoint,iVar) = 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]; + inline void SetSolution_Accel_time_n(unsigned long iPoint, const su2double *val_solution_accel_time_n) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution_Accel_time_n(iPoint,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]; - } + void SetSolution_Accel_time_n() final; /*! * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_old - Value of the old solution for the index val_var. + * \param[in] iVar - Index of the variable. + * \param[in] val_solution_accel_time_n - Value of the old solution for the index iVar. */ - 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; } + inline void SetSolution_Accel_time_n(unsigned long iPoint, unsigned long iVar, su2double val_solution_accel_time_n) final { + Solution_Accel_time_n(iPoint,iVar) = 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetSolution_Accel(unsigned short val_var) {return Solution_Accel[val_var]; } + inline su2double GetSolution_Accel(unsigned long iPoint, unsigned long iVar) const final { return Solution_Accel(iPoint,iVar); } /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ - inline su2double *GetSolution_Accel(void) {return Solution_Accel; } + inline su2double *GetSolution_Accel(unsigned long iPoint) final { return Solution_Accel[iPoint]; } /*! * \brief Get the acceleration of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - 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]; } + inline su2double GetSolution_Accel_time_n(unsigned long iPoint, unsigned long iVar) const final { + return Solution_Accel_time_n(iPoint,iVar); + } /*! * \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; } + inline su2double *GetSolution_Accel_time_n(unsigned long iPoint) final { return Solution_Accel_time_n[iPoint]; } /*! * \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]; + inline void SetSolution_Pred(unsigned long iPoint) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred(iPoint,iVar) = Solution(iPoint,iVar); } /*! * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. + * \param[in] val_solution_pred - Pointer to the residual vector. */ - inline void SetSolution_Pred(su2double *val_solution_pred) {Solution_Pred = val_solution_pred; } + inline void SetSolution_Pred(unsigned long iPoint, const su2double *val_solution_pred) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred(iPoint,iVar) = val_solution_pred[iVar]; + } /*! * \brief Set the value of the predicted solution. - * \param[in] val_var - Index of the variable + * \param[in] iVar - 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; } + inline void SetSolution_Pred(unsigned long iPoint, unsigned long iVar, su2double val_solution_pred) final { + Solution_Pred(iPoint,iVar) = val_solution_pred; + } /*! * \brief Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline su2double GetSolution_Pred(unsigned short val_var) {return Solution_Pred[val_var]; } + inline su2double GetSolution_Pred(unsigned long iPoint, unsigned long iVar) const final { return Solution_Pred(iPoint,iVar); } /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ - inline su2double *GetSolution_Pred(void) {return Solution_Pred; } + inline su2double *GetSolution_Pred(unsigned long iPoint) final { return Solution_Pred[iPoint]; } /*! * \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]; + inline void SetSolution_Pred_Old(unsigned long iPoint) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred_Old(iPoint,iVar) = Solution_Pred(iPoint,iVar); } /*! * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. + * \param[in] val_solution_pred_old - Pointer to the residual vector. */ - inline void SetSolution_Pred_Old(su2double *val_solution_pred_Old) {Solution_Pred_Old = val_solution_pred_Old; } + inline void SetSolution_Pred_Old(unsigned long iPoint, const su2double *val_solution_pred_old) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred_Old(iPoint,iVar) = val_solution_pred_old[iVar]; + } /*! * \brief A virtual member. Set the value of the old solution predicted. - * \param[in] val_var - Index of the variable + * \param[in] iVar - 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; } + inline void SetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar, su2double val_solution_pred_old) final { + Solution_Pred_Old(iPoint,iVar) = val_solution_pred_old; + } /*! * \brief Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - 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]; } + inline su2double GetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar) const final { + return Solution_Pred_Old(iPoint,iVar); + } /*! * \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; } + inline su2double *GetSolution_Pred_Old(unsigned long iPoint) final { return Solution_Pred_Old[iPoint]; } /*! * \brief A virtual member. */ - inline void SetPrestretch(unsigned short iVar, su2double val_prestretch) {Prestretch[iVar] = val_prestretch;} + inline void SetPrestretch(unsigned long iPoint, unsigned long iVar, su2double val_prestretch) final { + Prestretch(iPoint,iVar) = val_prestretch; + } /*! * \brief A virtual member. */ - inline su2double *GetPrestretch(void) {return Prestretch; } + inline su2double *GetPrestretch(unsigned long iPoint) final { return Prestretch[iPoint]; } /*! * \brief A virtual member. */ - inline su2double GetPrestretch(unsigned short iVar) {return Prestretch[iVar]; } + inline su2double GetPrestretch(unsigned long iPoint, unsigned long iVar) const final { return Prestretch(iPoint,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; } + inline void SetVonMises_Stress(unsigned long iPoint, su2double val_stress) final { VonMises_Stress(iPoint) = 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; } + inline su2double GetVonMises_Stress(unsigned long iPoint) const final { return VonMises_Stress(iPoint); } /*! * \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;} + inline void SetReference_Geometry(unsigned long iPoint, unsigned long iVar, su2double ref_geometry) final { + Reference_Geometry(iPoint,iVar) = ref_geometry; + } /*! * \brief Get the pointer to the reference geometry */ - inline su2double *GetReference_Geometry(void) {return Reference_Geometry; } + inline su2double *GetReference_Geometry(unsigned long iPoint) final { return Reference_Geometry[iPoint]; } /*! * \brief Get the value of the reference geometry for the coordinate iVar */ - inline su2double GetReference_Geometry(unsigned short iVar) {return Reference_Geometry[iVar]; } + inline su2double GetReference_Geometry(unsigned long iPoint, unsigned long iVar) const final { + return Reference_Geometry(iPoint,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]); - } + void Register_femSolution_time_n() final; /*! * \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]);} - } + void RegisterSolution_Vel(bool input) final; /*! * \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]); - } + void RegisterSolution_Vel_time_n() final; /*! * \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]);} - } + void RegisterSolution_Accel(bool input) final; /*! * \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]); - } + void RegisterSolution_Accel_time_n() final; /*! * \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])); + inline void SetAdjointSolution_Vel(unsigned long iPoint, const su2double *adj_sol) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Vel(iPoint,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]); + inline void GetAdjointSolution_Vel(unsigned long iPoint, su2double *adj_sol) const final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel(iPoint,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])); + void SetAdjointSolution_Vel_time_n(unsigned long iPoint, const su2double *adj_sol) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Vel_time_n(iPoint,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]); + inline void GetAdjointSolution_Vel_time_n(unsigned long iPoint, su2double *adj_sol) const final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel_time_n(iPoint,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])); + inline void SetAdjointSolution_Accel(unsigned long iPoint, const su2double *adj_sol) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Accel(iPoint,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]); + inline void GetAdjointSolution_Accel(unsigned long iPoint, su2double *adj_sol) const final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel(iPoint,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])); + void SetAdjointSolution_Accel_time_n(unsigned long iPoint, const su2double *adj_sol) final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_Accel_time_n(iPoint,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]); + inline void GetAdjointSolution_Accel_time_n(unsigned long iPoint, su2double *adj_sol) const final { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Accel_time_n(iPoint,iVar)); } }; diff --git a/SU2_CFD/include/variables/CHeatFVMVariable.hpp b/SU2_CFD/include/variables/CHeatFVMVariable.hpp index dd9db20e9460..6cfa284de410 100644 --- a/SU2_CFD/include/variables/CHeatFVMVariable.hpp +++ b/SU2_CFD/include/variables/CHeatFVMVariable.hpp @@ -45,29 +45,24 @@ * \author O. Burghardt * \version 6.2.0 "Falcon" */ -class CHeatFVMVariable : public CVariable { +class CHeatFVMVariable final : public CVariable { protected: - su2double* Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */ + MatrixType Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */ 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] heat - Values of the Heat solution (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CHeatFVMVariable(su2double heat, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - ~CHeatFVMVariable(void); + ~CHeatFVMVariable() = default; }; diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index b50554ddcd51..bfc999d4983c 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -47,268 +47,281 @@ */ 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 density for variable density turbulent flows (SST). ---*/ - - su2double Density_Old; + VectorType Velocity2; /*!< \brief Square of the velocity vector. */ + MatrixType Primitive; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ + VectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ + MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (T, vx, vy, vz, P, rho). */ + VectorType Density_Old; /*!< \brief Old density for variable density turbulent flows (SST). */ 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] velocity - Value of the flow velocity (initialization value). + * \param[in] temperature - Value of the temperature (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CIncEulerVariable(su2double pressure, const su2double *velocity, su2double temperature, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - virtual ~CIncEulerVariable(void); + virtual ~CIncEulerVariable() = default; /*! * \brief Set to zero the gradient of the primitive variables. */ - void SetGradient_PrimitiveZero(unsigned short val_primvar); + void SetGradient_PrimitiveZero() final; /*! - * \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. + * \brief Add value to the gradient of the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void AddGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) += 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. + * \brief Subtract value to the gradient of the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void SubtractGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) -= 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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - 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]; } + inline su2double GetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final { + return Gradient_Primitive(iPoint,iVar,iDim); + } /*! * \brief Get the value of the primitive variables gradient. - * \param[in] val_var - Index of the variable. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. * \return Value of the primitive variables gradient. */ - inline su2double GetLimiter_Primitive(unsigned short val_var) {return Limiter_Primitive[val_var]; } + inline su2double GetLimiter_Primitive(unsigned long iPoint, unsigned long iVar) const final { + return Limiter_Primitive(iPoint,iVar); + } /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void SetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) = 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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] value - Value of the gradient. */ - inline void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {Limiter_Primitive[val_var] = val_value; } + inline void SetLimiter_Primitive(unsigned long iPoint, unsigned long iVar, su2double value) final { + Limiter_Primitive(iPoint,iVar) = value; + } /*! * \brief Get the value of the primitive variables gradient. + * \param[in] iPoint - Point index. * \return Value of the primitive variables gradient. */ - inline su2double **GetGradient_Primitive(void) {return Gradient_Primitive; } + inline su2double **GetGradient_Primitive(unsigned long iPoint) final { return Gradient_Primitive[iPoint]; } /*! * \brief Get the value of the primitive variables gradient. + * \param[in] iPoint - Point index. * \return Value of the primitive variables gradient. */ - inline su2double *GetLimiter_Primitive(void) {return Limiter_Primitive; } + inline su2double *GetLimiter_Primitive(unsigned long iPoint) final { return Limiter_Primitive[iPoint]; } /*! * \brief Set the value of the pressure. + * \param[in] iPoint - Point index. */ - inline void SetPressure(void) {Primitive[0] = Solution[0];} + inline void SetPressure(unsigned long iPoint) final { Primitive(iPoint,0) = Solution(iPoint,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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \return Value of the primitive variable for the index iVar. */ - inline su2double GetPrimitive(unsigned short val_var) {return Primitive[val_var]; } + inline su2double GetPrimitive(unsigned long iPoint, unsigned long iVar) const final { return Primitive(iPoint,iVar); } /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iVar - Index of the variable. + * \return Set the value of the primitive variable for the index iVar. */ - inline void SetPrimitive(unsigned short val_var, su2double val_prim) {Primitive[val_var] = val_prim; } + inline void SetPrimitive(unsigned long iPoint, unsigned long iVar, su2double val_prim) final { Primitive(iPoint,iVar) = val_prim; } /*! * \brief Set the value of the primitive variables. + * \param[in] iPoint - Point index. * \param[in] val_prim - Primitive variables. - * \return Set the value of the primitive variable for the index val_var. + * \return Set the value of the primitive variable for the index iVar. */ - inline void SetPrimitive(su2double *val_prim) { - for (unsigned short iVar = 0; iVar < nPrimVar; iVar++) - Primitive[iVar] = val_prim[iVar]; + inline void SetPrimitive(unsigned long iPoint, const su2double *val_prim) final { + for (unsigned long iVar = 0; iVar < nPrimVar; iVar++) Primitive(iPoint,iVar) = val_prim[iVar]; } /*! * \brief Get the primitive variables of the problem. + * \param[in] iPoint - Point index. * \return Pointer to the primitive variable vector. */ - inline su2double *GetPrimitive(void) {return Primitive; } + inline su2double *GetPrimitive(unsigned long iPoint) final { return Primitive[iPoint]; } /*! * \brief Set the value of the density for the incompressible flows. + * \param[in] iPoint - Point index. */ - inline bool SetDensity(su2double val_density) { - Primitive[nDim+2] = val_density; - if (Primitive[nDim+2] > 0.0) return false; + inline bool SetDensity(unsigned long iPoint, su2double val_density) final { + Primitive(iPoint,nDim+2) = val_density; + if (Primitive(iPoint,nDim+2) > 0.0) return false; else return true; } /*! * \brief Set the value of the density for the incompressible flows. + * \param[in] iPoint - Point index. */ - 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]; + inline void SetVelocity(unsigned long iPoint) final { + Velocity2(iPoint) = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + Primitive(iPoint,iDim+1) = Solution(iPoint,iDim+1); + Velocity2(iPoint) += pow(Primitive(iPoint,iDim+1),2); } } /*! * \brief Set the value of the temperature for incompressible flows with energy equation. + * \param[in] iPoint - Point index. */ - inline bool SetTemperature(su2double val_temperature) { - Primitive[nDim+1] = val_temperature; - if (Primitive[nDim+1] > 0.0) return false; + inline bool SetTemperature(unsigned long iPoint, su2double val_temperature) final { + Primitive(iPoint,nDim+1) = val_temperature; + if (Primitive(iPoint,nDim+1) > 0.0) return false; else return true; } /*! * \brief Set the value of the beta coeffient for incompressible flows. + * \param[in] iPoint - Point index. */ - inline void SetBetaInc2(su2double val_betainc2) {Primitive[nDim+3] = val_betainc2; } + inline void SetBetaInc2(unsigned long iPoint, su2double val_betainc2) final { Primitive(iPoint,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; } + inline su2double GetVelocity2(unsigned long iPoint) const final { return Velocity2(iPoint); } /*! * \brief Get the flow pressure. * \return Value of the flow pressure. */ - inline su2double GetPressure(void) {return Primitive[0]; } + inline su2double GetPressure(unsigned long iPoint) const final { return Primitive(iPoint,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]; } + inline su2double GetBetaInc2(unsigned long iPoint) const final { return Primitive(iPoint,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]; } + inline su2double GetDensity(unsigned long iPoint) const final { return Primitive(iPoint,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; } + inline su2double GetDensity_Old(unsigned long iPoint) const final { return Density_Old(iPoint); } /*! * \brief Get the temperature of the flow. * \return Value of the temperature of the flow. */ - inline su2double GetTemperature(void) {return Primitive[nDim+1]; } + inline su2double GetTemperature(unsigned long iPoint) const final { return Primitive(iPoint,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. + * \param[in] iDim - Index of the dimension. + * \return Value of the velocity for the dimension iDim. */ - inline su2double GetVelocity(unsigned short val_dim) {return Primitive[val_dim+1]; } + inline su2double GetVelocity(unsigned long iPoint, unsigned long iDim) const final { return Primitive(iPoint,iDim+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); + inline su2double GetProjVel(unsigned long iPoint, const su2double *val_vector) const final { + su2double ProjVel = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjVel += Primitive(iPoint,iDim+1)*val_vector[iDim]; + return ProjVel; + } /*! * \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]; + inline void SetVelocity_Old(unsigned long iPoint, const su2double *val_velocity) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Solution_Old(iPoint,iDim+1) = val_velocity[iDim]; } /*! * \brief Set all the primitive variables for incompressible flows. */ - bool SetPrimVar(CFluidModel *FluidModel); + bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) final; /*! * \brief Set the specific heat Cp. */ - inline void SetSpecificHeatCp(su2double val_Cp) {Primitive[nDim+7] = val_Cp;} + inline void SetSpecificHeatCp(unsigned long iPoint, su2double val_Cp) final { Primitive(iPoint, nDim+7) = val_Cp; } /*! * \brief Set the specific heat Cv. */ - inline void SetSpecificHeatCv(su2double val_Cv) {Primitive[nDim+8] = val_Cv;} + inline void SetSpecificHeatCv(unsigned long iPoint, su2double val_Cv) final { Primitive(iPoint, 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]; } + inline su2double GetSpecificHeatCp(unsigned long iPoint) const final { return Primitive(iPoint, 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]; } + inline su2double GetSpecificHeatCv(unsigned long iPoint) const final { return Primitive(iPoint, nDim+8); } }; diff --git a/SU2_CFD/include/variables/CIncNSVariable.hpp b/SU2_CFD/include/variables/CIncNSVariable.hpp index 7f89a5e024da..1992b9f702fd 100644 --- a/SU2_CFD/include/variables/CIncNSVariable.hpp +++ b/SU2_CFD/include/variables/CIncNSVariable.hpp @@ -46,116 +46,106 @@ * \ingroup Navier_Stokes_Equations * \author F. Palacios, T. Economon, T. Albring */ -class CIncNSVariable : public CIncEulerVariable { +class CIncNSVariable final : public CIncEulerVariable { private: - su2double Vorticity[3]; /*!< \brief Vorticity of the fluid. */ - su2double StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ + VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ - su2double DES_LengthScale; -public: + VectorType 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] pressure - value of the pressure. + * \param[in] velocity - Value of the flow velocity (initialization value). + * \param[in] temperature - Value of the temperature (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CIncNSVariable(su2double pressure, const su2double *velocity, su2double temperature, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - ~CIncNSVariable(void); + ~CIncNSVariable() = default; /*! * \brief Set the laminar viscosity. */ - inline void SetLaminarViscosity(su2double laminarViscosity) {Primitive[nDim+4] = laminarViscosity;} + inline void SetLaminarViscosity(unsigned long iPoint, su2double laminarViscosity) override { + Primitive(iPoint,nDim+4) = laminarViscosity; + } /*! * \brief Set the vorticity value. */ - bool SetVorticity(void); - - /*! - * \brief Set the rate of strain magnitude. - */ - bool SetStrainMag(void); + bool SetVorticity_StrainMag() override; /*! * \overload * \param[in] eddy_visc - Value of the eddy viscosity. */ - inline void SetEddyViscosity(su2double eddy_visc) {Primitive[nDim+5] = eddy_visc; } + inline void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) override { + Primitive(iPoint,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]; } + inline su2double GetLaminarViscosity(unsigned long iPoint) const override { return Primitive(iPoint,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]; } + inline su2double GetEddyViscosity(unsigned long iPoint) const override { return Primitive(iPoint,nDim+5); } /*! * \brief Set the thermal conductivity. */ - inline void SetThermalConductivity(su2double thermalConductivity) {Primitive[nDim+6] = thermalConductivity;} + inline void SetThermalConductivity(unsigned long iPoint, su2double thermalConductivity) override { + Primitive(iPoint,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]; } + inline su2double GetThermalConductivity(unsigned long iPoint) const override { return Primitive(iPoint,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; } + inline su2double *GetVorticity(unsigned long iPoint) override { return Vorticity[iPoint]; } /*! * \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; } + inline su2double GetStrainMag(unsigned long iPoint) const override { return StrainMag(iPoint); } /*! * \brief Set all the primitive variables for incompressible flows */ - bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); + bool SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) override; using CVariable::SetPrimVar; /*! * \brief Set the DES Length Scale. */ - inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } + inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { + DES_LengthScale(iPoint) = val_des_lengthscale; + } /*! * \brief Get the DES length scale * \return Value of the DES length Scale. */ - inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } + inline su2double GetDES_LengthScale(unsigned long iPoint) const override { return DES_LengthScale(iPoint); } }; diff --git a/SU2_CFD/include/variables/CMeshBoundVariable.hpp b/SU2_CFD/include/variables/CMeshBoundVariable.hpp index 3487bc6b27f4..e7395ebbdcaa 100644 --- a/SU2_CFD/include/variables/CMeshBoundVariable.hpp +++ b/SU2_CFD/include/variables/CMeshBoundVariable.hpp @@ -39,39 +39,52 @@ #pragma once #include "CMeshVariable.hpp" +#include "../../../Common/include/toolboxes/CVertexMap.hpp" -class CMeshBoundVariable : public CMeshVariable { -protected: +class CMeshBoundVariable final : public CMeshVariable { +private: - su2double *Boundary_Displacement; /*!< \brief Store the reference coordinates of the mesh. */ + MatrixType Boundary_Displacement; /*!< \brief Store the reference coordinates of the mesh. */ + + CVertexMap VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */ public: /*! * \brief Constructor of the class. * \param[in] val_coor - Values of the coordinates (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] ndim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CMeshBoundVariable(su2double *val_coor, unsigned short val_nDim, CConfig *config); + CMeshBoundVariable(unsigned long npoint, unsigned long ndim, CConfig *config); /*! * \brief Destructor of the class. */ - ~CMeshBoundVariable(void); + ~CMeshBoundVariable() = default; + + /*! + * \brief Allocate member variables for points marked as vertex (via "Set_isVertex"). + * \param[in] config - Definition of the particular problem. + */ + void AllocateBoundaryVariables(CConfig *config); /*! * \brief Get the value of the displacement imposed at the boundary. * \return Value of the boundary displacement. */ - inline su2double GetBound_Disp(unsigned short iDim) const final { return Boundary_Displacement[iDim]; } + inline su2double GetBound_Disp(unsigned long iPoint, unsigned long iDim) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return 0.0; + return Boundary_Displacement(iPoint,iDim); + } /*! * \brief Set the boundary displacements. * \param[in] val_BoundDisp - Pointer to the boundary displacements. */ - inline void SetBound_Disp(const su2double *val_BoundDisp) final { - for (unsigned short iDim = 0; iDim < nDim; iDim++) Boundary_Displacement[iDim] = val_BoundDisp[iDim]; + inline void SetBound_Disp(unsigned long iPoint, const su2double *val_BoundDisp) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iDim = 0; iDim < nDim; iDim++) Boundary_Displacement(iPoint,iDim) = val_BoundDisp[iDim]; } /*! @@ -79,37 +92,39 @@ class CMeshBoundVariable : public CMeshVariable { * \param[in] iDim - Index of the dimension of interest. * \param[in] val_BoundDisp - Value of the boundary displacements. */ - inline void SetBound_Disp(unsigned short iDim, const su2double val_BoundDisp) final { - Boundary_Displacement[iDim] = val_BoundDisp; + inline void SetBound_Disp(unsigned long iPoint, unsigned long iDim, su2double val_BoundDisp) override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + Boundary_Displacement(iPoint,iDim) = val_BoundDisp; } /*! - * \brief Determine whether the node is a moving vertex. - * \return True. The node is at the boundary. + * \brief Register the boundary displacements of the mesh. + * \param[in] input - Defines whether we are registering the variable as input or as output. */ - inline bool Get_isVertex(void) const final { return true; } + void Register_BoundDisp(bool input) override; /*! - * \brief Register the boundary displacements of the mesh. - * \param[in] input - Defines whether we are registering the variable as input or as output. + * \brief Recover the value of the adjoint of the boundary displacements. */ - inline void Register_BoundDisp(bool input) final { - if (input) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Boundary_Displacement[iVar]); - } - else { for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterOutput(Boundary_Displacement[iVar]); + inline void GetAdjoint_BoundDisp(unsigned long iPoint, su2double *adj_disp) const override { + if (!VertexMap.GetVertexIndex(iPoint)) return; + for (unsigned long iVar = 0; iVar < nVar; iVar++) { + adj_disp[iVar] = SU2_TYPE::GetDerivative(Boundary_Displacement(iPoint,iVar)); } } /*! - * \brief Recover the value of the adjoint of the boundary displacements. + * \brief Get whether a node is on the boundary */ - inline void GetAdjoint_BoundDisp(su2double *adj_disp) final { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - adj_disp[iVar] = SU2_TYPE::GetDerivative(Boundary_Displacement[iVar]); - } + inline bool Get_isVertex(unsigned long iPoint) const override { + return VertexMap.GetIsVertex(iPoint); + } + + /*! + * \brief Set whether a node is on the boundary + */ + inline void Set_isVertex(unsigned long iPoint, bool isVertex) override { + VertexMap.SetIsVertex(iPoint,isVertex); } }; diff --git a/SU2_CFD/include/variables/CMeshElement.hpp b/SU2_CFD/include/variables/CMeshElement.hpp index 0e49bd0c8b1b..ee6ea355eb98 100644 --- a/SU2_CFD/include/variables/CMeshElement.hpp +++ b/SU2_CFD/include/variables/CMeshElement.hpp @@ -67,7 +67,7 @@ class CMeshElement { /*! * \brief Destructor of the class. */ - ~CMeshElement(void); + ~CMeshElement(void) = default; /*! * \brief Get the value of the element volume with undeformed coordinates. diff --git a/SU2_CFD/include/variables/CMeshVariable.hpp b/SU2_CFD/include/variables/CMeshVariable.hpp index 08c46c626d1a..4d38a9f3f340 100644 --- a/SU2_CFD/include/variables/CMeshVariable.hpp +++ b/SU2_CFD/include/variables/CMeshVariable.hpp @@ -43,54 +43,43 @@ class CMeshVariable : public CVariable { protected: - unsigned short nDim; - - su2double WallDistance; /*!< \brief Store the wall distance in reference coordinates. */ - - su2double *Mesh_Coord; /*!< \brief Store the reference coordinates of the mesh. */ - - -public: + VectorType WallDistance; /*!< \brief Store the wall distance in reference coordinates. */ + MatrixType Mesh_Coord; /*!< \brief Store the reference coordinates of the mesh. */ /*! * \brief Constructor of the class. - * \param[in] val_coor - Values of the coordinates (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. * \param[in] config - Definition of the particular problem. */ - CMeshVariable(const su2double *val_coor, unsigned short val_nDim, CConfig *config); + CMeshVariable(unsigned long npoint, unsigned long ndim, CConfig *config); +public: /*! * \brief Destructor of the class. */ - ~CMeshVariable(void); + ~CMeshVariable() = default; /*! * \brief Get the value of the undeformed coordinates. * \param[in] iDim - Index of Mesh_Coord[nDim] * \return Value of the original coordinate iDim. */ - inline su2double GetMesh_Coord(unsigned short iDim) const final { return Mesh_Coord[iDim]; } + inline su2double GetMesh_Coord(unsigned long iPoint, unsigned long iDim) const final { return Mesh_Coord(iPoint,iDim); } /*! * \brief Get the undeformed coordinates. * \return Pointer to the reference coordinates. */ - inline su2double *GetMesh_Coord() final { return Mesh_Coord; } + inline const su2double *GetMesh_Coord(unsigned long iPoint) const final { return Mesh_Coord[iPoint]; } /*! * \brief Set the value of the undeformed coordinates. * \param[in] iDim - Index of Mesh_Coord[nDim] * \param[in] val_coord - Value of Mesh_Coord[nDim] */ - inline void SetMesh_Coord(unsigned short iDim, const su2double val_coord) final { Mesh_Coord[iDim] = val_coord;} - - /*! - * \brief Move Displacement into Displacement_Old. - */ - inline void SetSolution_Old(void){ - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution_Old[iDim] = Solution[iDim]; + inline void SetMesh_Coord(unsigned long iPoint, unsigned long iDim, su2double val_coord) final { + Mesh_Coord(iPoint,iDim) = val_coord; } /*! @@ -98,41 +87,26 @@ class CMeshVariable : public CVariable { * \param[in] iDim - Index of Mesh_Coord[nDim] * \return Value of the wall distance in reference coordinates. */ - inline su2double GetWallDistance(void) const final { return WallDistance; } + inline su2double GetWallDistance(unsigned long iPoint) const final { return WallDistance(iPoint); } /*! * \brief Set the value of the wall distance in reference coordinates. * \param[in] val_dist - Value of wall distance. */ - inline void SetWallDistance(const su2double val_dist) final { WallDistance = val_dist; } - - /*! - * \brief Determine whether the node is a moving vertex. - * \return False. The node is not at the boundary. - */ - inline virtual bool Get_isVertex(void) const override { return false; } + inline void SetWallDistance(unsigned long iPoint, su2double val_dist) final { WallDistance(iPoint) = val_dist; } /*! * \brief Register the reference coordinates of the mesh. * \param[in] input - Defines whether we are registering the variable as input or as output. */ - inline void Register_MeshCoord(bool input) final { - if (input) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput(Mesh_Coord[iVar]); - } - else { for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterOutput(Mesh_Coord[iVar]); - } - } + void Register_MeshCoord(bool input) final; /*! * \brief Recover the value of the adjoint of the mesh coordinates. */ - inline void GetAdjoint_MeshCoord(su2double *adj_mesh) const final{ - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - adj_mesh[iVar] = SU2_TYPE::GetDerivative(Mesh_Coord[iVar]); - } + inline void GetAdjoint_MeshCoord(unsigned long iPoint, su2double *adj_mesh) const final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + adj_mesh[iDim] = SU2_TYPE::GetDerivative(Mesh_Coord(iPoint,iDim)); } }; diff --git a/SU2_CFD/include/variables/CNSVariable.hpp b/SU2_CFD/include/variables/CNSVariable.hpp index 692f5acea912..9efee442d51a 100644 --- a/SU2_CFD/include/variables/CNSVariable.hpp +++ b/SU2_CFD/include/variables/CNSVariable.hpp @@ -45,212 +45,198 @@ * \ingroup Navier_Stokes_Equations * \author F. Palacios, T. Economon */ -class CNSVariable : public CEulerVariable { +class CNSVariable final : 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: + MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ + VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ + VectorType DES_LengthScale; /*!< \brief DES Length Scale. */ + VectorType Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */ + VectorType 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] density - Value of the flow density (initialization value). + * \param[in] velocity - Value of the flow velocity (initialization value). + * \param[in] energy - Value of the flow energy (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CNSVariable(su2double density, const su2double *velocity, su2double energy, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - ~CNSVariable(void); + ~CNSVariable() = default; /*! * \brief Set the laminar viscosity. */ - inline void SetLaminarViscosity(su2double laminarViscosity) {Primitive[nDim+5] = laminarViscosity;} + inline void SetLaminarViscosity(unsigned long iPoint, su2double laminarViscosity) override { + Primitive(iPoint,nDim+5) = laminarViscosity; + } /*! * \brief Set the laminar viscosity. */ - inline void SetThermalConductivity(su2double thermalConductivity) {Primitive[nDim+7] = thermalConductivity;} + inline void SetThermalConductivity(unsigned long iPoint, su2double thermalConductivity) override { + Primitive(iPoint,nDim+7) = thermalConductivity; + } /*! * \brief Set the specific heat Cp. */ - inline void SetSpecificHeatCp(su2double val_Cp) {Primitive[nDim+8] = val_Cp;} + inline void SetSpecificHeatCp(unsigned long iPoint, su2double val_Cp) override { Primitive(iPoint,nDim+8) = val_Cp; } /*! * \brief Set the vorticity value. */ - bool SetVorticity(void); - - /*! - * \brief Set the rate of strain magnitude. - */ - bool SetStrainMag(void); + bool SetVorticity_StrainMag() override; /*! * \overload * \param[in] eddy_visc - Value of the eddy viscosity. */ - inline void SetEddyViscosity(su2double eddy_visc) {Primitive[nDim+6] = eddy_visc; } + inline void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) override { Primitive(iPoint,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]; } + inline su2double GetLaminarViscosity(unsigned long iPoint) const override { return Primitive(iPoint,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]; } + inline su2double GetThermalConductivity(unsigned long iPoint) const override { return Primitive(iPoint,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]; } + inline su2double GetEddyViscosity(unsigned long iPoint) const override { return Primitive(iPoint,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]; } + inline su2double GetSpecificHeatCp(unsigned long iPoint) const override { return Primitive(iPoint,nDim+8); } /*! * \brief Set the temperature at the wall */ - inline void SetWallTemperature(su2double temperature_wall) { Primitive[0] = temperature_wall; } + inline void SetWallTemperature(unsigned long iPoint, su2double temperature_wall) override { + Primitive(iPoint,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; } + inline su2double *GetVorticity(unsigned long iPoint) override { return Vorticity[iPoint]; } /*! * \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; } + inline su2double GetStrainMag(unsigned long iPoint) const override { return StrainMag(iPoint); } /*! * \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;} + inline void SetdTdrho_e(unsigned long iPoint, su2double dTdrho_e) override { Secondary(iPoint,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;} + inline void SetdTde_rho(unsigned long iPoint, su2double dTde_rho) override { Secondary(iPoint,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;} + inline void Setdmudrho_T(unsigned long iPoint, su2double dmudrho_T) override { Secondary(iPoint,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;} + inline void SetdmudT_rho(unsigned long iPoint, su2double dmudT_rho) override { Secondary(iPoint,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;} + inline void Setdktdrho_T(unsigned long iPoint, su2double dktdrho_T) override { Secondary(iPoint,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;} + inline void SetdktdT_rho(unsigned long iPoint, su2double dktdT_rho) override { Secondary(iPoint,7) = dktdT_rho;} /*! * \brief Set all the primitive variables for compressible flows */ - bool SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel); + bool SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) override; using CVariable::SetPrimVar; /*! * \brief Set all the secondary variables (partial derivatives) for compressible flows */ - void SetSecondaryVar(CFluidModel *FluidModel); + void SetSecondaryVar(unsigned long iPoint, CFluidModel *FluidModel) override; /*! * \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; } + inline void SetTauWall(unsigned long iPoint, su2double val_tau_wall) override { Tau_Wall(iPoint) = 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; } + inline su2double GetTauWall(unsigned long iPoint) const override { return Tau_Wall(iPoint); } /*! * \brief Get the DES length scale * \return Value of the DES length Scale. */ - inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } + inline su2double GetDES_LengthScale(unsigned long iPoint) const override { return DES_LengthScale(iPoint); } /*! * \brief Set the DES Length Scale. */ - inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } + inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { + DES_LengthScale(iPoint) = 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); + void SetRoe_Dissipation_NTS(unsigned long iPoint, su2double val_delta, su2double val_const_DES) override; /*! * \brief Set the new solution for Roe Dissipation. */ - void SetRoe_Dissipation_FD(su2double wall_distance); + void SetRoe_Dissipation_FD(unsigned long iPoint, su2double wall_distance) override; /*! * \brief Get the Roe Dissipation Coefficient. * \return Value of the Roe Dissipation. */ - inline su2double GetRoe_Dissipation(void) {return Roe_Dissipation; } + inline su2double GetRoe_Dissipation(unsigned long iPoint) const override { return Roe_Dissipation(iPoint); } /*! * \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; } + inline void SetRoe_Dissipation(unsigned long iPoint, su2double val_dissipation) override { + Roe_Dissipation(iPoint) = val_dissipation; + } }; diff --git a/SU2_CFD/include/variables/CTransLMVariable.hpp b/SU2_CFD/include/variables/CTransLMVariable.hpp index a90141f9adc6..43a900f71161 100644 --- a/SU2_CFD/include/variables/CTransLMVariable.hpp +++ b/SU2_CFD/include/variables/CTransLMVariable.hpp @@ -46,46 +46,41 @@ * \author A. Bueno. */ -class CTransLMVariable : public CTurbVariable { +class CTransLMVariable final : public CTurbVariable { protected: - su2double gamma_sep; + VectorType 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] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] nvar - Number of variables of the problem. + * \param[in] constants - * \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); + CTransLMVariable(su2double intermittency, su2double REth, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - ~CTransLMVariable(void); + ~CTransLMVariable() = default; /*! * \brief ________________. */ - inline su2double GetIntermittency(void) { return Solution[0]; } + inline su2double GetIntermittency(unsigned long iPoint) const override { return Solution(iPoint,0); } /*! * \brief ________________. * \param[in] gamma_sep_in */ - inline void SetGammaSep(su2double gamma_sep_in) {gamma_sep = gamma_sep_in;} + inline void SetGammaSep(unsigned long iPoint, su2double gamma_sep_in) override { gamma_sep(iPoint) = gamma_sep_in; } /*! * \brief Correction for separation-induced transition. */ - inline void SetGammaEff(void) {Solution[0] = max(Solution[0], gamma_sep);} + inline void SetGammaEff(unsigned long iPoint) override { Solution(iPoint,0) = max(Solution(iPoint,0), gamma_sep(iPoint)); } }; diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index b65178f24f78..1dc15995f0c9 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -46,80 +46,85 @@ * \author A. Bueno. */ -class CTurbSAVariable : public CTurbVariable { +class CTurbSAVariable final : public CTurbVariable { private: - su2double gamma_BC; /*!< \brief Value of the intermittency for the BC trans. model. */ - su2double DES_LengthScale; - su2double Vortex_Tilting; + VectorType gamma_BC; /*!< \brief Value of the intermittency for the BC trans. model. */ + VectorType DES_LengthScale; + VectorType 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] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] nvar - Number of variables of the problem. + * \param[in] constants - * \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); - + CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); + /*! * \brief Destructor of the class. */ - ~CTurbSAVariable(void); + ~CTurbSAVariable() = default; /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] source - Value of the harmonic balance source term. for the index iVar. */ - inline void SetHarmonicBalance_Source(unsigned short val_var, su2double val_source) {HB_Source[val_var] = val_source; } + inline void SetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar, su2double source) override { HB_Source(iPoint,iVar) = source; } /*! * \brief Get the harmonic balance source term. - * \param[in] val_var - Index of the variable. + * \param[in] iPoint - Point index. + * \param[in] iVar - 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]; } + inline su2double GetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar) const override { return HB_Source(iPoint,iVar); } /*! * \brief Get the intermittency of the BC transition model. + * \param[in] iPoint - Point index. * \return Value of the intermittency of the BC transition model. */ - inline su2double GetGammaBC(void) {return gamma_BC; } + inline su2double GetGammaBC(unsigned long iPoint) const override { return gamma_BC(iPoint); } /*! * \brief Set the intermittency of the BC transition model. + * \param[in] iPoint - Point index. * \param[in] val_gamma - New value of the intermittency. */ - inline void SetGammaBC(su2double val_gamma) {gamma_BC = val_gamma; } + inline void SetGammaBC(unsigned long iPoint, su2double val_gamma) override { gamma_BC(iPoint) = val_gamma; } /*! * \brief Get the DES length scale + * \param[in] iPoint - Point index. * \return Value of the DES length Scale. */ - inline su2double GetDES_LengthScale(void) {return DES_LengthScale; } + inline su2double GetDES_LengthScale(unsigned long iPoint) const override { return DES_LengthScale(iPoint); } /*! * \brief Set the DES Length Scale. + * \param[in] iPoint - Point index. */ - inline void SetDES_LengthScale(su2double val_des_lengthscale) {DES_LengthScale = val_des_lengthscale; } + inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { DES_LengthScale(iPoint) = val_des_lengthscale; } /*! * \brief Set the vortex tilting measure for computation of the EDDES length scale + * \param[in] iPoint - Point index. */ - void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity); + void SetVortex_Tilting(unsigned long iPoint, su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity) override; /*! * \brief Get the vortex tilting measure for computation of the EDDES length scale + * \param[in] iPoint - Point index. * \return Value of the DES length Scale */ - inline su2double GetVortex_Tilting() {return Vortex_Tilting; } + inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); } }; diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 9168414b8657..7b3ae7b7dfd7 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -46,37 +46,33 @@ * \author A. Bueno. */ -class CTurbSSTVariable : public CTurbVariable { +class CTurbSSTVariable final : 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. */ + su2double sigma_om2; + su2double beta_star; + VectorType F1; + VectorType F2; /*!< \brief Menter blending function for blending of k-w and k-eps. */ + VectorType 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] kine - Turbulence kinetic energy (k) (initialization value). + * \param[in] omega - Turbulent variable value (initialization value). + * \param[in] mut - Eddy viscosity (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); - + CTurbSSTVariable(su2double kine, su2double omega, su2double mut, unsigned long npoint, + unsigned long ndim, unsigned long nvar, const su2double* constants, CConfig *config); + /*! * \brief Destructor of the class. */ - ~CTurbSSTVariable(void); + ~CTurbSSTVariable() = default; /*! * \brief Set the blending function for the blending of k-w and k-eps. @@ -84,20 +80,20 @@ class CTurbSSTVariable : public CTurbVariable { * \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); + void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density) override; /*! * \brief Get the first blending function. */ - inline su2double GetF1blending(void) { return F1; } + inline su2double GetF1blending(unsigned long iPoint) const override { return F1(iPoint); } /*! * \brief Get the second blending function. */ - inline su2double GetF2blending(void) { return F2; } + inline su2double GetF2blending(unsigned long iPoint) const override { return F2(iPoint); } /*! * \brief Get the value of the cross diffusion of tke and omega. */ - inline su2double GetCrossDiff(void) { return CDkw; } + inline su2double GetCrossDiff(unsigned long iPoint) const override { return CDkw(iPoint); } }; diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 10eeefedc8f4..f21384efcb09 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -47,38 +47,36 @@ */ class CTurbVariable : public CVariable { protected: - su2double muT; /*!< \brief Eddy viscosity. */ - su2double *HB_Source; /*!< \brief Harmonic Balance source term. */ + VectorType muT; /*!< \brief Eddy viscosity. */ + MatrixType 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] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - virtual ~CTurbVariable(void); + virtual ~CTurbVariable() = default; /*! * \brief Get the value of the eddy viscosity. + * \param[in] iPoint - Point index. * \return the value of the eddy viscosity. */ - inline su2double GetmuT() { return muT; } + inline su2double GetmuT(unsigned long iPoint) const final { return muT(iPoint); } /*! * \brief Set the value of the eddy viscosity. + * \param[in] iPoint - Point index. * \param[in] val_muT - Value of the eddy viscosity. */ - inline void SetmuT(su2double val_muT) { muT = val_muT; } + inline void SetmuT(unsigned long iPoint, su2double val_muT) final { muT(iPoint) = val_muT; } }; diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 010d91443aa1..7e16e6e19bc3 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -47,6 +47,7 @@ #include "../../../Common/include/config_structure.hpp" #include "../fluid_model.hpp" +#include "../../../Common/include/toolboxes/C2DContainer.hpp" using namespace std; @@ -58,1444 +59,1542 @@ using namespace std; */ class CVariable { protected: + using VectorType = C2DContainer; + using MatrixType = C2DContainer; + + /*--- This contrived container is used to store matrices in a contiguous manner but still present the + "su2double**" interface to the outside world, it will be replaced by something more efficient. ---*/ + struct VectorOfMatrix { + su2activevector storage; + su2matrix interface; + unsigned long M, N; + + void resize(unsigned long length, unsigned long rows, unsigned long cols, su2double value) { + M = rows; + N = cols; + storage.resize(length*rows*cols) = value; + interface.resize(length,rows); + + for(unsigned long i=0; i Non_Physical; /*!< \brief Non-physical points in the solution (force first order). */ + + MatrixType Solution_time_n; /*!< \brief Solution of the problem at time n for dual-time stepping technique. */ + MatrixType Solution_time_n1; /*!< \brief Solution of the problem at time n-1 for dual-time stepping technique. */ + VectorType Delta_Time; /*!< \brief Time step. */ + + VectorOfMatrix Gradient; /*!< \brief Gradient of the solution of the problem. */ + VectorOfMatrix Rmatrix; /*!< \brief Geometry-based matrix for weighted least squares gradient calculations. */ + + MatrixType Limiter; /*!< \brief Limiter of the solution of the problem. */ + MatrixType Solution_Max; /*!< \brief Max solution for limiter computation. */ + MatrixType Solution_Min; /*!< \brief Min solution for limiter computation. */ + + VectorType AuxVar; /*!< \brief Auxiliar variable for gradient computation. */ + MatrixType Grad_AuxVar; /*!< \brief Gradient of the auxiliar variable. */ - su2double *Solution_BGS_k; + VectorType Max_Lambda_Inv; /*!< \brief Maximun inviscid eingenvalue. */ + VectorType Max_Lambda_Visc; /*!< \brief Maximun viscous eingenvalue. */ + VectorType Lambda; /*!< \brief Value of the eingenvalue. */ + + VectorType Sensor; /*!< \brief Pressure sensor for high order central scheme and Roe dissipation. */ + MatrixType Undivided_Laplacian; /*!< \brief Undivided laplacian of the solution. */ + + MatrixType Res_TruncError; /*!< \brief Truncation error for multigrid cycle. */ + MatrixType Residual_Old; /*!< \brief Auxiliar structure for residual smoothing. */ + MatrixType Residual_Sum; /*!< \brief Auxiliar structure for residual smoothing. */ + + MatrixType Solution_Adj_Old; /*!< \brief Solution of the problem in the previous AD-BGS iteration. */ + + MatrixType Solution_BGS_k; /*!< \brief Old solution container for BGS iterations. */ + + su2matrix Input_AdjIndices; /*!< \brief Indices of Solution variables in the adjoint vector. */ + su2matrix Output_AdjIndices; /*!< \brief Indices of Solution variables in the adjoint vector after having been updated. */ + + unsigned long nPoint = {0}; /*!< \brief Number of points in the domain. */ + unsigned long nDim = {0}; /*!< \brief Number of dimension of the problem. */ + unsigned long nVar = {0}; /*!< \brief Number of variables of the problem. */ + unsigned long nPrimVar = {0}; /*!< \brief Number of primitive variables. */ + unsigned long nPrimVarGrad = {0}; /*!< \brief Number of primitives for which a gradient is computed. */ + unsigned long nSecondaryVar = {0}; /*!< \brief Number of secondary variables. */ + unsigned long nSecondaryVarGrad = {0}; /*!< \brief Number of secondaries for which a gradient is computed. */ public: - /*! - * \brief Constructor of the class. - */ - CVariable(void); + /*--- Disable default construction copy and assignment. ---*/ + CVariable() = delete; + CVariable(const CVariable&) = delete; + CVariable(CVariable&&) = delete; + CVariable& operator= (const CVariable&) = delete; + CVariable& operator= (CVariable&&) = delete; /*! * \overload - * \param[in] val_nvar - Number of variables of the problem. + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] nvar - Number of variables of the problem. * \param[in] config - Definition of the particular problem. */ - CVariable(unsigned short val_nvar, CConfig *config); + CVariable(unsigned long npoint, unsigned long 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] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] 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); + CVariable(unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); /*! * \brief Destructor of the class. */ - virtual ~CVariable(void); + virtual ~CVariable() = default; /*! - * \brief Set the value of the solution. - * \param[in] val_solution - Solution of the problem. + * \brief Set the value of the solution, all variables. + * \param[in] iPoint - Point index. + * \param[in] solution - Solution of the problem. */ - inline void SetSolution(su2double *val_solution) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = val_solution[iVar]; + inline void SetSolution(unsigned long iPoint, const su2double *solution) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution(iPoint,iVar) = solution[iVar]; } /*! - * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution - Value of the solution for the index val_var. + * \brief Set the value of the solution, one variable. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] solution - Value of the solution for the index iVar. */ - inline void SetSolution(unsigned short val_var, su2double val_solution) {Solution[val_var] = val_solution;} + inline void SetSolution(unsigned long iPoint, unsigned long iVar, su2double solution) { Solution(iPoint,iVar) = 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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] solution - Value of the solution for the index iVar. */ - inline void Add_DeltaSolution(unsigned short val_var, su2double val_solution) {Solution[val_var] += val_solution;} + inline void Add_DeltaSolution(unsigned long iPoint, unsigned long iVar, su2double solution) { Solution(iPoint,iVar) += solution; } /*! * \brief Set the value of the non-physical point. - * \param[in] val_value - identification of the non-physical point. + * \param[in] iPoint - Point index. + * \param[in] value - identification of the non-physical point. */ - inline void SetNon_Physical(bool val_value) { Non_Physical = !val_value; } + inline void SetNon_Physical(unsigned long iPoint, bool value) { Non_Physical(iPoint) = !value; } /*! * \brief Get the value of the non-physical point. + * \param[in] iPoint - Point index. * \return Value of the Non-physical point. */ - inline su2double GetNon_Physical(void) { return su2double(Non_Physical); } + inline su2double GetNon_Physical(unsigned long iPoint) const { return su2double(Non_Physical(iPoint)); } /*! * \brief Get the solution. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetSolution(unsigned short val_var) {return Solution[val_var]; } + inline su2double GetSolution(unsigned long iPoint, unsigned long iVar) const { return Solution(iPoint,iVar); } /*! * \brief Get the old solution of the problem (Runge-Kutta method) - * \param[in] val_var - Index of the variable. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline su2double GetSolution_Old(unsigned short val_var) {return Solution_Old[val_var]; } + inline su2double GetSolution_Old(unsigned long iPoint, unsigned long iVar) const { return Solution_Old(iPoint,iVar); } /*! - * \brief Get the old solution of the discrete adjoint problem (for multiphysics subiterations= - * \param[in] val_var - Index of the variable. + * \brief Get the old solution of the discrete adjoint problem (for multiphysics subiterations) + * \param[in] iPoint - Point index. + * \param[in] iVar - 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]; } + inline su2double GetSolution_Old_Adj(unsigned long iPoint, unsigned long iVar) const { return Solution_Adj_Old(iPoint,iVar); } /*! * \brief Set the value of the old solution. - * \param[in] val_solution_old - Pointer to the residual vector. + * \param[in] iPoint - Point index. + * \param[in] solution_old - Pointer to the residual vector. */ - inline void SetSolution_Old(su2double *val_solution_old) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_Old[iVar] = val_solution_old[iVar]; + inline void SetSolution_Old(unsigned long iPoint, const su2double *solution_old) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution_Old(iPoint,iVar) = solution_old[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. + * \param[in] iVar - Index of the variable. + * \param[in] iPoint - Point index. + * \param[in] solution_old - Value of the old solution for the index iVar. */ - inline void SetSolution_Old(unsigned short val_var, su2double val_solution_old) {Solution_Old[val_var] = val_solution_old; } + inline void SetSolution_Old(unsigned long iPoint, unsigned long iVar, su2double solution_old) { Solution_Old(iPoint,iVar) = solution_old; } /*! * \brief Set old variables to the value of the current variables. */ - inline void Set_OldSolution(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_Old[iVar] = Solution[iVar]; - } + void Set_OldSolution(); /*! * \brief Set variables to the value of the old variables. */ - 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. - */ - inline void Set_OldSolution_Adj(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_Adj_Old[iVar] = Solution[iVar]; - } + void Set_Solution(); /*! * \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]; - } + void Set_Solution_time_n(); /*! * \brief Set the variable solution at time n-1. */ - inline void Set_Solution_time_n1(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n1[iVar] = Solution_time_n[iVar]; - } + void Set_Solution_time_n1(); /*! * \brief Set the variable solution at time n. + * \param[in] iPoint - Point index. */ - inline void Set_Solution_time_n(su2double* val_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n[iVar] = val_sol[iVar]; + inline void Set_Solution_time_n(unsigned long iPoint, const su2double* val_sol) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_time_n(iPoint,iVar) = val_sol[iVar]; } /*! * \brief Set the variable solution at time n-1. + * \param[in] iPoint - Point index. */ - inline void Set_Solution_time_n1(su2double* val_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Solution_time_n1[iVar] = val_sol[iVar]; + inline void Set_Solution_time_n1(unsigned long iPoint, const su2double* val_sol) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution_time_n1(iPoint,iVar) = val_sol[iVar]; } /*! - * \brief Set the variable solution at time n-1. + * \brief Set the variable solution at time n. */ - inline void Set_Solution_time_n(unsigned short iVar, su2double val_sol) { - Solution_time_n[iVar] = val_sol; + inline void Set_Solution_time_n(unsigned long iPoint, unsigned long iVar, su2double val_sol) { + Solution_time_n(iPoint,iVar) = val_sol; } /*! * \brief Set the variable solution at time n-1. */ - inline void Set_Solution_time_n1(unsigned short iVar, su2double val_sol) { - Solution_time_n1[iVar] = val_sol; + inline void Set_Solution_time_n1(unsigned long iPoint, unsigned long iVar, su2double val_sol) { + Solution_time_n1(iPoint,iVar) = val_sol; } /*! * \brief Set to zero the velocity components of the solution. + * \param[in] iPoint - Point index. */ - inline void SetVelSolutionZero(void) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = 0.0; + inline void SetVelSolutionZero(unsigned long iPoint) { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint,iDim+1) = 0.0; } /*! * \brief Specify a vector to set the velocity components of the solution. + * \param[in] iPoint - Point index. * \param[in] val_vector - Pointer to the vector. */ - inline void SetVelSolutionVector(su2double *val_vector) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Solution[iDim+1] = val_vector[iDim]; + inline void SetVelSolutionVector(unsigned long iPoint, const su2double *val_vector) { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint, 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. - */ - 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. - */ - inline void SetSolutionZero(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; + inline void SetVelSolutionOldZero(unsigned long iPoint) { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution_Old(iPoint, iDim+1) = 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. - * \param[in] val_solution - Value that we want to add to the solution. + * \param[in] iPoint - Point index. + * \param[in] iVar - Number of the variable. + * \param[in] solution - Value that we want to add to the solution. */ - inline void AddSolution(unsigned short val_var, su2double val_solution) { - Solution[val_var] = Solution_Old[val_var] + val_solution; + inline void AddSolution(unsigned long iPoint, unsigned long iVar, su2double solution) { + Solution(iPoint, iVar) = Solution_Old(iPoint, iVar) + solution; } /*! * \brief Add a value to the solution. - * \param[in] val_solution - Value that we want to add to the solution. + * \param[in] iPoint - Point index. + * \param[in] solution - Value that we want to add to the solution. */ - inline void AddSolution(su2double *val_solution) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = Solution[iVar] + val_solution[iVar]; - } + inline void AddSolution(unsigned long iPoint, const su2double *solution) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution(iPoint, iVar) += solution[iVar]; } /*! * \brief A virtual member. - * \param[in] val_var - Index of the variable. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline virtual su2double GetSolution_New(unsigned short val_var) {return 0.0; } + inline virtual su2double GetSolution_New(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual su2double GetRoe_Dissipation(void) {return 0.0; } + inline virtual su2double GetRoe_Dissipation(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual void SetRoe_Dissipation(su2double val_dissipation) {} + inline virtual void SetRoe_Dissipation(unsigned long iPoint, su2double val_dissipation) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual void SetRoe_Dissipation_FD(su2double val_wall_dist) {} + inline virtual void SetRoe_Dissipation_FD(unsigned long iPoint, su2double val_wall_dist) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \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) {} + inline virtual void SetRoe_Dissipation_NTS(unsigned long iPoint, su2double val_delta, su2double val_const_DES) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual su2double GetDES_LengthScale(void) {return 0.0; } + inline virtual su2double GetDES_LengthScale(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual void SetDES_LengthScale(su2double val_des_lengthscale) {} + inline virtual void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual void SetSolution_New(void) {} + virtual void SetSolution_New() {} /*! - * \brief A virtual member. + * \brief Set external contributions to zero. */ - inline virtual void SetExternalZero(void) {} + void SetExternalZero(); /*! - * \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. + * \brief Set old External to the value of the current variables. */ - inline virtual void AddSolution_New(unsigned short val_var, su2double val_solution) {} + void Set_OldExternal(); /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Number of the variable. + * \param[in] solution - Value that we want to add to the solution. */ - inline virtual void Add_External(const su2double* val_sol) {} + inline virtual void AddSolution_New(unsigned long iPoint, unsigned long iVar, su2double solution) {} /*! - * \brief A virtual member. + * \brief Add a value to the External vector. + * \param[in] iPoint - Point index. + * \param[in] val_sol - vector that has to be added component-wise */ - inline virtual void Add_ExternalOld(const su2double* val_sol) {} + inline void Add_External(unsigned long iPoint, const su2double* val_sol) { + for(unsigned long iVar = 0; iVar < nVar; iVar++) External(iPoint,iVar) += val_sol[iVar]; + } /*! - * \brief A virtual member. + * \brief Add a valaue to the old External vector. + * \param[in] iPoint - Point index. + * \param[in] val_solution - Value that we want to add to the solution. */ - inline virtual void Set_OldExternal(void) {} + inline void Add_ExternalOld(unsigned long iPoint, const su2double* val_sol) { + for(unsigned long iVar = 0; iVar < nVar; iVar++) External_Old(iPoint,iVar) += val_sol[iVar]; + } /*! * \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] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] solution - Value of the solution change. * \param[in] lowerlimit - Lower value. * \param[in] upperlimit - Upper value. */ - inline void AddClippedSolution(unsigned short val_var, su2double val_solution, + inline void AddClippedSolution(unsigned long iPoint, unsigned long iVar, su2double solution, su2double lowerlimit, su2double upperlimit) { - su2double val_new = Solution_Old[val_var] + val_solution; - Solution[val_var] = min(max(val_new, lowerlimit), upperlimit); + su2double val_new = Solution_Old(iPoint, iVar) + solution; + Solution(iPoint,iVar) = min(max(val_new, lowerlimit), 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] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] 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. */ - inline void AddConservativeSolution(unsigned short val_var, su2double val_solution, + inline void AddConservativeSolution(unsigned long iPoint, unsigned long iVar, su2double 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); + su2double val_new = (Solution_Old(iPoint,iVar)*val_density_old + solution)/val_density; + Solution(iPoint,iVar) = 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; } + inline su2double *GetSolution(unsigned long iPoint) { return Solution[iPoint]; } /*! * \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; } + inline su2double *GetSolution_Old(unsigned long iPoint) { return Solution_Old[iPoint]; } + /*! + * \brief Get the external contributions of the problem. + * \param[in] iPoint - Point index. + * \return Pointer to the External row for iPoint. + */ + inline const su2double *Get_External(unsigned long iPoint) const { return External[iPoint]; } + /*! * \brief Get the old external contributions of the problem. - * \return Pointer to the External_Old vector. + * \param[in] iPoint - Point index. + * \return Pointer to the External_Old row for iPoint. */ - inline su2double *GetSolution_ExternalOld(void) {return External_Old; } + inline const su2double *Get_ExternalOld(unsigned long iPoint) const { return External_Old[iPoint]; } /*! * \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; } + inline su2double *GetSolution_time_n(unsigned long iPoint) { return Solution_time_n[iPoint]; } /*! * \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; } + inline su2double *GetSolution_time_n1(unsigned long iPoint) { return Solution_time_n1[iPoint]; } /*! * \brief Set the value of the old residual. + * \param[in] iPoint - Point index. * \param[in] val_residual_old - Pointer to the residual vector. */ - inline void SetResidual_Old(su2double *val_residual_old) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Residual_Old[iVar] = val_residual_old[iVar]; + inline void SetResidual_Old(unsigned long iPoint, const su2double *val_residual_old) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Residual_Old(iPoint,iVar) = val_residual_old[iVar]; } /*! * \brief Add a value to the summed residual vector. + * \param[in] iPoint - Point index. * \param[in] val_residual - Pointer to the residual vector. */ - inline void AddResidual_Sum(su2double *val_residual) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Residual_Sum[iVar] += val_residual[iVar]; + inline void AddResidual_Sum(unsigned long iPoint, const su2double *val_residual) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Residual_Sum(iPoint,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; - } + void SetResidualSumZero(); /*! * \brief Set the velocity of the truncation error to zero. + * \param[in] iPoint - Point index. */ - inline virtual void SetVel_ResTruncError_Zero(unsigned short iSpecies) {} + inline virtual void SetVel_ResTruncError_Zero(unsigned long iPoint, unsigned long iSpecies) {} /*! * \brief Get the value of the summed residual. + * \param[in] iPoint - Point index. * \return Pointer to the summed residual. */ - inline su2double *GetResidual_Sum(void) {return Residual_Sum; } + inline su2double *GetResidual_Sum(unsigned long iPoint) { return Residual_Sum[iPoint]; } /*! * \brief Get the value of the old residual. + * \param[in] iPoint - Point index. * \return Pointer to the old residual. */ - inline su2double *GetResidual_Old(void) {return Residual_Old; } + inline su2double *GetResidual_Old(unsigned long iPoint) { return Residual_Old[iPoint]; } /*! * \brief Get the value of the summed residual. + * \param[in] iPoint - Point index. * \param[in] val_residual - Pointer to the summed residual. */ - inline void GetResidual_Sum(su2double *val_residual) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - val_residual[iVar] = Residual_Sum[iVar]; + inline void GetResidual_Sum(unsigned long iPoint, su2double *val_residual) const { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + val_residual[iVar] = Residual_Sum(iPoint,iVar); } /*! * \brief Set auxiliar variables, we are looking for the gradient of that variable. + * \param[in] iPoint - Point index. * \param[in] val_auxvar - Value of the auxiliar variable. */ - inline void SetAuxVar(su2double val_auxvar) {AuxVar = val_auxvar; } + inline void SetAuxVar(unsigned long iPoint, su2double val_auxvar) { AuxVar(iPoint) = val_auxvar; } /*! * \brief Get the value of the auxiliary variable. + * \param[in] iPoint - Point index. * \return Value of the auxiliary variable. */ - inline su2double GetAuxVar(void) {return AuxVar; } + inline su2double GetAuxVar(unsigned long iPoint) const { return AuxVar(iPoint); } /*! * \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; - } + void SetAuxVarGradientZero(); /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \param[in] val_gradient - Value of the gradient for the index iDim. */ - inline void SetAuxVarGradient(unsigned short val_dim, su2double val_gradient) {Grad_AuxVar[val_dim] = val_gradient;} + inline void SetAuxVarGradient(unsigned long iPoint, unsigned long iDim, su2double val_gradient) { Grad_AuxVar(iPoint,iDim) = 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. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \param[in] val_value - Value of the gradient to be added for the index iDim. */ - inline void AddAuxVarGradient(unsigned short val_dim, su2double val_value) {Grad_AuxVar[val_dim] += val_value;} + inline void AddAuxVarGradient(unsigned long iPoint, unsigned long iDim, su2double val_value) { Grad_AuxVar(iPoint,iDim) += 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. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \param[in] val_value - Value of the gradient to be subtracted for the index iDim. */ - inline void SubtractAuxVarGradient(unsigned short val_dim, su2double val_value) {Grad_AuxVar[val_dim] -= val_value; } + inline void SubtractAuxVarGradient(unsigned long iPoint, unsigned long iDim, su2double val_value) { Grad_AuxVar(iPoint,iDim) -= val_value; } /*! * \brief Get the gradient of the auxiliary variable. + * \param[in] iPoint - Point index. * \return Value of the gradient of the auxiliary variable. */ - inline su2double *GetAuxVarGradient(void) {return Grad_AuxVar; } + inline su2double *GetAuxVarGradient(unsigned long iPoint) { return Grad_AuxVar[iPoint]; } /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \return Value of the gradient of the auxiliary variable for the dimension iDim. */ - inline su2double GetAuxVarGradient(unsigned short val_dim) {return Grad_AuxVar[val_dim]; } + inline su2double GetAuxVarGradient(unsigned long iPoint, unsigned long iDim) const { return Grad_AuxVar(iPoint,iDim); } /*! * \brief Add a value to the truncation error. + * \param[in] iPoint - Point index. * \param[in] val_truncation_error - Value that we want to add to the 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]; + inline void AddRes_TruncError(unsigned long iPoint, const su2double *val_truncation_error) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Res_TruncError(iPoint, iVar) += val_truncation_error[iVar]; } /*! * \brief Subtract a value to the truncation error. + * \param[in] iPoint - Point index. * \param[in] val_truncation_error - Value that we want to subtract to the 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]; + inline void SubtractRes_TruncError(unsigned long iPoint, const su2double *val_truncation_error) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Res_TruncError(iPoint, iVar) -= val_truncation_error[iVar]; } /*! * \brief Set the truncation error to zero. + * \param[in] iPoint - Point index. */ - inline void SetRes_TruncErrorZero(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) Res_TruncError[iVar] = 0.0; + inline void SetRes_TruncErrorZero(unsigned long iPoint) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) Res_TruncError(iPoint, iVar) = 0.0; } /*! * \brief Set the truncation error to zero. + * \param[in] iPoint - Point index. */ - inline void SetVal_ResTruncError_Zero(unsigned short val_var) {Res_TruncError[val_var] = 0.0;} + inline void SetVal_ResTruncError_Zero(unsigned long iPoint, unsigned long iVar) {Res_TruncError(iPoint, iVar) = 0.0;} /*! * \brief Set the velocity of the truncation error to zero. + * \param[in] iPoint - Point index. */ - inline void SetVel_ResTruncError_Zero(void) { - for (unsigned short iDim = 0; iDim < nDim; iDim++) Res_TruncError[iDim+1] = 0.0; + inline void SetVel_ResTruncError_Zero(unsigned long iPoint) { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,iDim+1) = 0.0; } /*! * \brief Set the velocity of the truncation error to zero. + * \param[in] iPoint - Point index. */ - inline void SetEnergy_ResTruncError_Zero(void) {Res_TruncError[nDim+1] = 0.0;} + inline void SetEnergy_ResTruncError_Zero(unsigned long iPoint) { Res_TruncError(iPoint,nDim+1) = 0.0;} /*! * \brief Get the truncation error. + * \param[in] iPoint - Point index. * \return Pointer to the truncation error. */ - inline su2double *GetResTruncError(void) {return Res_TruncError; } + inline su2double *GetResTruncError(unsigned long iPoint) { return Res_TruncError[iPoint]; } /*! * \brief Get the truncation error. + * \param[in] iPoint - Point index. * \param[in] val_trunc_error - Pointer to the truncation error. */ - inline void GetResTruncError(su2double *val_trunc_error) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - val_trunc_error[iVar] = Res_TruncError[iVar]; + inline void GetResTruncError(unsigned long iPoint, su2double *val_trunc_error) const { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + val_trunc_error[iVar] = Res_TruncError(iPoint, iVar); } /*! * \brief Set the gradient of the solution. - * \param[in] val_gradient - Gradient of the solution. + * \param[in] iPoint - Point index. + * \param[in] gradient - Gradient of the solution. */ - 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]; + inline void SetGradient(unsigned long iPoint, su2double **gradient) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Gradient(iPoint,iVar,iDim) = gradient[iVar][iDim]; } /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void SetGradient(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) { Gradient(iPoint,iVar,iDim) = value; } /*! * \brief Set to zero the gradient of the solution. */ - 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; - } + void SetGradientZero(); /*! - * \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. + * \brief Add value to the solution gradient. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void AddGradient(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) { Gradient(iPoint,iVar,iDim) += 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. + * \brief Subtract value to the solution gradient. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] 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; } + inline void SubtractGradient(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) { Gradient(iPoint,iVar,iDim) -= value; } /*! * \brief Get the value of the solution gradient. + * \param[in] iPoint - Point index. * \return Value of the gradient solution. */ - inline su2double **GetGradient(void) {return Gradient; } + inline su2double **GetGradient(unsigned long iPoint) { return Gradient[iPoint]; } /*! * \brief Get the value of the solution gradient. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - 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]; } + inline su2double GetGradient(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const { return Gradient(iPoint,iVar,iDim); } /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \param[in] jDim - Index of the dimension. + * \param[in] 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; } + inline void SetRmatrix(unsigned long iPoint, unsigned long iDim, unsigned long jDim, su2double value) { Rmatrix(iPoint,iDim,jDim) = value; } /*! * \brief Set to zero the Rmatrix for least squares gradient calculations. */ - 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; - } + void SetRmatrixZero(); /*! - * \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. + * \brief Add value to the Rmatrix for least squares gradient calculations. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \param[in] jDim - Index of the dimension. + * \param[in] value - Value of the Rmatrix entry. */ - inline void AddRmatrix(unsigned short val_iDim, unsigned short val_jDim, su2double val_value) {Rmatrix[val_iDim][val_jDim] += val_value; } + inline void AddRmatrix(unsigned long iPoint, unsigned long iDim, unsigned long jDim, su2double value) { Rmatrix(iPoint,iDim,jDim) += 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. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \param[in] 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]; } + inline su2double GetRmatrix(unsigned long iPoint, unsigned long iDim, unsigned long jDim) const { return Rmatrix(iPoint,iDim,jDim); } /*! * \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. + * \param[in] iPoint - Point index. * \return Value of the Rmatrix entry. */ - inline su2double **GetRmatrix(void) {return Rmatrix; } + inline su2double **GetRmatrix(unsigned long iPoint) { return Rmatrix[iPoint]; } /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] val_limiter - Value of the limiter for the index iVar. */ - inline void SetLimiter(unsigned short val_var, su2double val_limiter) {Limiter[val_var] = val_limiter; } + inline void SetLimiter(unsigned long iPoint, unsigned long iVar, su2double val_limiter) { Limiter(iPoint,iVar) = val_limiter; } /*! * \brief Set the value of the limiter. + * \param[in] iPoint - Point index. * \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. + * \param[in] iVar - Index of the variable. + * \param[in] val_limiter - Value of the limiter for the index iVar. */ - inline virtual void SetLimiterPrimitive(unsigned short val_species, unsigned short val_var, su2double val_limiter) {} + inline virtual void SetLimiterPrimitive(unsigned long iPoint, unsigned long val_species, unsigned long iVar, su2double val_limiter) {} /*! * \brief Set the value of the limiter. + * \param[in] iPoint - Point index. * \param[in] val_species - Index of the species . - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. */ - inline virtual su2double GetLimiterPrimitive(unsigned short val_species, unsigned short val_var) {return 0.0; } + inline virtual su2double GetLimiterPrimitive(unsigned long iPoint, unsigned long val_species, unsigned long iVar) const { 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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] solution - Value of the max solution for the index iVar. */ - inline void SetSolution_Max(unsigned short val_var, su2double val_solution) {Solution_Max[val_var] = val_solution; } + inline void SetSolution_Max(unsigned long iPoint, unsigned long iVar, su2double solution) { Solution_Max(iPoint,iVar) = 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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] solution - Value of the min solution for the index iVar. */ - inline void SetSolution_Min(unsigned short val_var, su2double val_solution) {Solution_Min[val_var] = val_solution; } + inline void SetSolution_Min(unsigned long iPoint, unsigned long iVar, su2double solution) { Solution_Min(iPoint,iVar) = solution; } /*! * \brief Get the value of the slope limiter. + * \param[in] iPoint - Point index. * \return Pointer to the limiters vector. */ - inline su2double *GetLimiter(void) {return Limiter; } + inline su2double *GetLimiter(unsigned long iPoint) { return Limiter[iPoint]; } /*! * \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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \return Value of the limiter vector for the variable iVar. */ - inline su2double GetSolution_Max(unsigned short val_var) {return Solution_Max[val_var]; } + inline su2double GetLimiter(unsigned long iPoint, unsigned long iVar) const { return Limiter(iPoint,iVar); } /*! * \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 A virtual member. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \return Value of the min solution for the variable iVar. */ - inline virtual su2double *Get_External(void) const { return NULL; } - - /*! - * \brief Get the value of the preconditioner Beta. - * \return Value of the low Mach preconditioner variable Beta - */ - inline virtual su2double GetPreconditioner_Beta() {return 0; } + inline su2double GetSolution_Max(unsigned long iPoint, unsigned long iVar) const { return Solution_Max(iPoint,iVar); } /*! * \brief Set the value of the preconditioner Beta. * \param[in] val_Beta - Value of the low Mach preconditioner variable Beta + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \return Value of the min solution for the variable iVar. */ - inline virtual void SetPreconditioner_Beta(su2double val_Beta) {} + inline su2double GetSolution_Min(unsigned long iPoint, unsigned long iVar) const { return Solution_Min(iPoint,iVar); } /*! * \brief Get the value of the wind gust + * \param[in] iPoint - Point index. * \return Value of the wind gust */ - inline virtual su2double* GetWindGust() {return 0; } + inline virtual su2double* GetWindGust(unsigned long iPoint) { return nullptr; } /*! * \brief Set the value of the wind gust + * \param[in] iPoint - Point index. * \param[in] val_WindGust - Value of the wind gust */ - inline virtual void SetWindGust(su2double* val_WindGust) {} + inline virtual void SetWindGust(unsigned long iPoint, const 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;} + inline virtual su2double* GetWindGustDer(unsigned long iPoint) { return nullptr;} /*! * \brief Set the value of the derivatives of the wind gust + * \param[in] iPoint - Point index. * \param[in] val_WindGust - Value of the derivatives of the wind gust */ - inline virtual void SetWindGustDer(su2double* val_WindGust) {} + inline virtual void SetWindGustDer(unsigned long iPoint, const su2double* val_WindGust) {} /*! * \brief Set the value of the time step. + * \param[in] iPoint - Point index. * \param[in] val_delta_time - Value of the time step. */ - inline void SetDelta_Time(su2double val_delta_time) {Delta_Time = val_delta_time; } + inline void SetDelta_Time(unsigned long iPoint, su2double val_delta_time) { Delta_Time(iPoint) = val_delta_time; } /*! * \brief Set the value of the time step. + * \param[in] iPoint - Point index. * \param[in] val_delta_time - Value of the time step. - * \param[in] iSpecies - Index of the Species . + * \param[in] iSpecies - Index of the Species. */ - inline virtual void SetDelta_Time(su2double val_delta_time, unsigned short iSpecies) {} + inline virtual void SetDelta_Time(unsigned long iPoint, su2double val_delta_time, unsigned long iSpecies) {} /*! * \brief Get the value of the time step. + * \param[in] iPoint - Point index. * \return Value of the time step. */ - inline su2double GetDelta_Time(void) {return Delta_Time; } + inline su2double GetDelta_Time(unsigned long iPoint) const {return Delta_Time(iPoint); } /*! * \brief Get the value of the time step. + * \param[in] iPoint - Point index. * \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; } + inline virtual su2double GetDelta_Time(unsigned long iPoint, unsigned long iSpecies) { return 0.0; } /*! * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] iPoint - Point index. * \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; } + inline void SetMax_Lambda_Inv(unsigned long iPoint, su2double val_max_lambda) { Max_Lambda_Inv(iPoint) = val_max_lambda; } /*! * \brief Set the value of the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] iPoint - Point index. * \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) {} + inline virtual void SetMax_Lambda_Inv(unsigned long iPoint, su2double val_max_lambda, unsigned long val_species) {} /*! * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] iPoint - Point index. * \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; } + inline void SetMax_Lambda_Visc(unsigned long iPoint, su2double val_max_lambda) { Max_Lambda_Visc(iPoint) = val_max_lambda; } /*! * \brief Set the value of the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] iPoint - Point index. * \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; } + inline virtual void SetMax_Lambda_Visc(unsigned long iPoint, su2double val_max_lambda, unsigned long val_species) {} /*! * \brief Add a value to the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] iPoint - Point index. * \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; } + inline void AddMax_Lambda_Inv(unsigned long iPoint, su2double val_max_lambda) { Max_Lambda_Inv(iPoint) += val_max_lambda; } /*! * \brief Add a value to the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] iPoint - Point index. * \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; } + inline void AddMax_Lambda_Visc(unsigned long iPoint, su2double val_max_lambda) { Max_Lambda_Visc(iPoint) += val_max_lambda; } /*! * \brief Get the value of the maximum eigenvalue for the inviscid terms of the PDE. + * \param[in] iPoint - Point index. * \return the value of the maximum eigenvalue for the inviscid terms of the PDE. */ - inline su2double GetMax_Lambda_Inv(void) {return Max_Lambda_Inv; } + inline su2double GetMax_Lambda_Inv(unsigned long iPoint) const { return Max_Lambda_Inv(iPoint); } /*! * \brief Get the value of the maximum eigenvalue for the viscous terms of the PDE. + * \param[in] iPoint - Point index. * \return the value of the maximum eigenvalue for the viscous terms of the PDE. */ - inline su2double GetMax_Lambda_Visc(void) {return Max_Lambda_Visc; } + inline su2double GetMax_Lambda_Visc(unsigned long iPoint) const { return Max_Lambda_Visc(iPoint); } /*! * \brief Set the value of the spectral radius. + * \param[in] iPoint - Point index. * \param[in] val_lambda - Value of the spectral radius. */ - inline void SetLambda(su2double val_lambda) {Lambda = val_lambda; } + inline void SetLambda(unsigned long iPoint, su2double val_lambda) { Lambda(iPoint) = val_lambda; } /*! * \brief Set the value of the spectral radius. + * \param[in] iPoint - Point index. * \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) {} + inline virtual void SetLambda(unsigned long iPoint, su2double val_lambda, unsigned long val_iSpecies) {} /*! * \brief Add the value of the spectral radius. + * \param[in] iPoint - Point index. * \param[in] val_lambda - Value of the spectral radius. */ - inline void AddLambda(su2double val_lambda) {Lambda += val_lambda; } + inline void AddLambda(unsigned long iPoint, su2double val_lambda) { Lambda(iPoint) += val_lambda; } /*! * \brief Add the value of the spectral radius. + * \param[in] iPoint - Point index. * \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) {} + inline virtual void AddLambda(unsigned long iPoint, su2double val_lambda, unsigned long val_iSpecies) {} /*! * \brief Get the value of the spectral radius. + * \param[in] iPoint - Point index. * \return Value of the spectral radius. */ - inline su2double GetLambda(void) {return Lambda; } + inline su2double GetLambda(unsigned long iPoint) const { return Lambda(iPoint); } /*! * \brief Get the value of the spectral radius. + * \param[in] iPoint - Point index. * \param[in] val_iSpecies -Index of species * \return Value of the spectral radius. */ - inline virtual su2double GetLambda(unsigned short val_iSpecies) {return 0.0;} + inline virtual su2double GetLambda(unsigned long iPoint, unsigned long val_iSpecies) { return 0.0; } /*! * \brief Set pressure sensor. + * \param[in] iPoint - Point index. * \param[in] val_sensor - Value of the pressure sensor. */ - inline void SetSensor(su2double val_sensor) {Sensor = val_sensor; } + inline void SetSensor(unsigned long iPoint, su2double val_sensor) { Sensor(iPoint) = val_sensor; } /*! * \brief Set pressure sensor. + * \param[in] iPoint - Point index. * \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) {} + inline virtual void SetSensor(unsigned long iPoint, su2double val_sensor, unsigned long iSpecies) {} /*! * \brief Get the pressure sensor. + * \param[in] iPoint - Point index. * \return Value of the pressure sensor. */ - inline su2double GetSensor(void) {return Sensor; } + inline su2double GetSensor(unsigned long iPoint) const { return Sensor(iPoint); } /*! * \brief Get the pressure sensor. + * \param[in] iPoint - Point index. * \param[in] iSpecies - index of species * \return Value of the pressure sensor. */ - inline virtual su2double GetSensor(unsigned short iSpecies) {return 0;} + inline virtual su2double GetSensor(unsigned long iPoint, unsigned long iSpecies) const { return 0.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. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] val_undivided_laplacian - Value of the undivided solution for the index iVar. */ - inline void SetUndivided_Laplacian(unsigned short val_var, su2double val_undivided_laplacian) { - Undivided_Laplacian[val_var] = val_undivided_laplacian; + inline void SetUndivided_Laplacian(unsigned long iPoint, unsigned long iVar, su2double val_undivided_laplacian) { + Undivided_Laplacian(iPoint,iVar) = val_undivided_laplacian; } /*! * \brief Add the value of the undivided laplacian of the solution. + * \param[in] iPoint - Point index. * \param[in] val_und_lapl - Value of the undivided solution. */ - inline void AddUnd_Lapl(su2double *val_und_lapl) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian[iVar] += val_und_lapl[iVar]; + inline void AddUnd_Lapl(unsigned long iPoint, const su2double *val_und_lapl) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Undivided_Laplacian(iPoint, iVar) += val_und_lapl[iVar]; } /*! * \brief Subtract the value of the undivided laplacian of the solution. + * \param[in] iPoint - Point index. * \param[in] val_und_lapl - Value of the undivided solution. */ - inline void SubtractUnd_Lapl(su2double *val_und_lapl) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian[iVar] -= val_und_lapl[iVar]; + inline void SubtractUnd_Lapl(unsigned long iPoint, const su2double *val_und_lapl) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Undivided_Laplacian(iPoint, 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] iPoint - Point index. + * \param[in] iVar - Variable of the undivided laplacian. * \param[in] val_und_lapl - Value of the undivided solution. */ - inline void SubtractUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { - Undivided_Laplacian[val_var] -= val_und_lapl; + inline void SubtractUnd_Lapl(unsigned long iPoint, unsigned long iVar, su2double val_und_lapl) { + Undivided_Laplacian(iPoint, iVar) -= val_und_lapl; } /*! * \brief Set the undivided laplacian of the solution to zero. */ - inline void SetUnd_LaplZero(void) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian[iVar] = 0.0; - } + void SetUnd_LaplZero(); /*! * \brief Set a value to the undivided laplacian. - * \param[in] val_var - Variable of the undivided laplacian. + * \param[in] iPoint - Point index. + * \param[in] iVar - Variable of the undivided laplacian. * \param[in] val_und_lapl - Value of the undivided laplacian. */ - inline void SetUnd_Lapl(unsigned short val_var, su2double val_und_lapl) { - Undivided_Laplacian[val_var] = val_und_lapl; + inline void SetUnd_Lapl(unsigned long iPoint, unsigned long iVar, su2double val_und_lapl) { + Undivided_Laplacian(iPoint, iVar) = val_und_lapl; } /*! * \brief Get the undivided laplacian of the solution. + * \param[in] iPoint - Point index. * \return Pointer to the undivided laplacian vector. */ - inline su2double *GetUndivided_Laplacian(void) {return Undivided_Laplacian; } + inline su2double *GetUndivided_Laplacian(unsigned long iPoint) { return Undivided_Laplacian[iPoint]; } /*! * \brief Get the undivided laplacian of the solution. - * \param[in] val_var - Variable of the undivided laplacian. + * \param[in] iPoint - Point index. + * \param[in] iVar - 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]; } + inline su2double GetUndivided_Laplacian(unsigned long iPoint, unsigned long iVar) const { return Undivided_Laplacian(iPoint, iVar); } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the flow density. */ - inline virtual su2double GetDensity(void) {return 0; } + inline virtual su2double GetDensity(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Old value of the flow density. */ - inline virtual su2double GetDensity_Old(void) {return 0; } + inline virtual su2double GetDensity_Old(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the flow density. */ - inline virtual su2double GetDensity(unsigned short val_iSpecies) {return 0; } + inline virtual su2double GetDensity(unsigned long iPoint, unsigned long val_iSpecies) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \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;} + inline virtual su2double GetMassFraction(unsigned long iPoint, unsigned long val_Species) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the flow energy. */ - inline virtual su2double GetEnergy(void) {return 0; } + inline virtual su2double GetEnergy(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Pointer to the force projection vector. */ - inline virtual su2double *GetForceProj_Vector(void) {return NULL; } + inline virtual su2double *GetForceProj_Vector(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Pointer to the objective function source. */ - inline virtual su2double *GetObjFuncSource(void) {return NULL; } + inline virtual su2double *GetObjFuncSource(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Pointer to the internal boundary vector. */ - inline virtual su2double *GetIntBoundary_Jump(void) {return NULL; } + inline virtual su2double *GetIntBoundary_Jump(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the eddy viscosity. */ - inline virtual su2double GetEddyViscosity(void) {return 0; } + inline virtual su2double GetEddyViscosity(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the flow enthalpy. */ - inline virtual su2double GetEnthalpy(void) {return 0; } + inline virtual su2double GetEnthalpy(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the flow pressure. */ - inline virtual su2double GetPressure(void) {return 0; } + inline virtual su2double GetPressure(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \param[in] val_vector - Direction of projection. * \return Value of the projected velocity. */ - inline virtual su2double GetProjVel(su2double *val_vector) {return 0; } + inline virtual su2double GetProjVel(unsigned long iPoint, const su2double *val_vector) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \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; } + inline virtual su2double GetProjVel(unsigned long iPoint, su2double *val_vector, unsigned long val_species) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the sound speed. */ - inline virtual su2double GetSoundSpeed(void) {return 0; } + inline virtual su2double GetSoundSpeed(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the beta for the incompressible flow. */ - inline virtual su2double GetBetaInc2(void) { return 0.0; } + inline virtual su2double GetBetaInc2(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. * \return Value of the temperature. */ - inline virtual su2double GetTemperature(void) {return 0.0; } + inline virtual su2double GetTemperature(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the vibrational-electronic temperature. */ - inline virtual su2double GetTemperature_ve(void) {return 0; } + inline virtual su2double GetTemperature_ve(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member -- Get the mixture specific heat at constant volume (trans.-rot.). + * \param[in] iPoint - Point index. * \return \f$\rho C^{t-r}_{v} \f$ */ - inline virtual su2double GetRhoCv_tr(void) {return 0; } + inline virtual su2double GetRhoCv_tr(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member -- Get the mixture specific heat at constant volume (vib.-el.). + * \param[in] iPoint - Point index. * \return \f$\rho C^{v-e}_{v} \f$ */ - inline virtual su2double GetRhoCv_ve(void) {return 0; } + inline virtual su2double GetRhoCv_ve(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. - * \param[in] val_dim - Index of the dimension. - * \return Value of the velocity for the dimension val_dim. + * \param[in] iPoint - Point index. + * \param[in] iDim - Index of the dimension. + * \return Value of the velocity for the dimension iDim. */ - inline virtual su2double GetVelocity(unsigned short val_dim) {return 0; } + inline virtual su2double GetVelocity(unsigned long iPoint, unsigned long iDim) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Norm 2 of the velocity vector. */ - inline virtual su2double GetVelocity2(void) {return 0; } + inline virtual su2double GetVelocity2(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Norm 2 of the velocity vector of Fluid val_species. */ - inline virtual su2double GetVelocity2(unsigned short val_species) {return 0;} + inline virtual su2double GetVelocity2(unsigned long iPoint, unsigned long val_species) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return The laminar viscosity of the flow. */ - inline virtual su2double GetLaminarViscosity(void) {return 0; } + inline virtual su2double GetLaminarViscosity(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return The laminar viscosity of the flow. */ - inline virtual su2double GetLaminarViscosity(unsigned short iSpecies) {return 0; } + inline virtual su2double GetLaminarViscosity(unsigned long iPoint, unsigned long iSpecies) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the species diffusion coefficient. */ - inline virtual su2double* GetDiffusionCoeff(void) {return NULL; } + inline virtual su2double* GetDiffusionCoeff(unsigned long iPoint) {return nullptr; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the thermal conductivity (translational/rotational) */ - inline virtual su2double GetThermalConductivity(void) {return 0; } + inline virtual su2double GetThermalConductivity(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the specific heat at constant P */ - inline virtual su2double GetSpecificHeatCp(void) {return 0; } + inline virtual su2double GetSpecificHeatCp(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the specific heat at constant V */ - inline virtual su2double GetSpecificHeatCv(void) {return 0; } + inline virtual su2double GetSpecificHeatCv(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the thermal conductivity (vibrational) */ - inline virtual su2double GetThermalConductivity_ve(void) {return 0; } + inline virtual su2double GetThermalConductivity_ve(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Sets separation intermittency */ - inline virtual void SetGammaSep(su2double gamma_sep) {} + inline virtual void SetGammaSep(unsigned long iPoint, su2double gamma_sep) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Sets separation intermittency */ - inline virtual void SetGammaEff(void) {} + inline virtual void SetGammaEff(unsigned long iPoint) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Returns intermittency */ - inline virtual su2double GetIntermittency() { return 0.0; } + inline virtual su2double GetIntermittency(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the vorticity. */ - inline virtual su2double *GetVorticity(void) {return 0; } + inline virtual su2double *GetVorticity(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the rate of strain magnitude. */ - inline virtual su2double GetStrainMag(void) {return 0; } + inline virtual su2double GetStrainMag(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \param[in] val_ForceProj_Vector - Pointer to the force projection vector. */ - inline virtual void SetForceProj_Vector(su2double *val_ForceProj_Vector) {} + inline virtual void SetForceProj_Vector(unsigned long iPoint, const su2double *val_ForceProj_Vector) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \param[in] val_SetObjFuncSource - Pointer to the objective function source. */ - inline virtual void SetObjFuncSource(su2double *val_SetObjFuncSource) {} + inline virtual void SetObjFuncSource(unsigned long iPoint, const su2double *val_SetObjFuncSource) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \param[in] val_IntBoundary_Jump - Pointer to the interior boundary jump. */ - inline virtual void SetIntBoundary_Jump(su2double *val_IntBoundary_Jump) {} + inline virtual void SetIntBoundary_Jump(unsigned long iPoint, const su2double *val_IntBoundary_Jump) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \return Value of the gamma_BC of B-C transition model. */ - inline virtual su2double GetGammaBC(void) {return 0; } + inline virtual su2double GetGammaBC(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual void SetGammaBC(su2double val_gamma) {} + inline virtual void SetGammaBC(unsigned long iPoint, su2double val_gamma) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. * \param[in] eddy_visc - Value of the eddy viscosity. */ - inline virtual void SetEddyViscosity(su2double eddy_visc) {} + inline virtual void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual void SetEnthalpy(void) {} + inline virtual void SetEnthalpy(unsigned long iPoint) {} /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual bool SetPrimVar(CConfig *config) {return true; } + inline virtual bool SetPrimVar(unsigned long iPoint, CConfig *config) { return true; } /*! * \brief A virtual member. + * \param[in] iPoint - Point index. */ - inline virtual bool SetPrimVar(CFluidModel *FluidModel) {return true; } + inline virtual bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) { return true; } /*! * \brief A virtual member. */ - inline virtual void SetSecondaryVar(CFluidModel *FluidModel) {} + inline virtual void SetSecondaryVar(unsigned long iPoint, CFluidModel *FluidModel) {} /*! * \brief A virtual member. */ - inline virtual bool Cons2PrimVar(CConfig *config, su2double *U, su2double *V, su2double *dPdU, + inline virtual bool Cons2PrimVar(CConfig *config, unsigned long iPoint, 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; } + inline virtual void Prim2ConsVar(CConfig *config, unsigned long iPoint, su2double *V, su2double *U) { } /*! * \brief A virtual member. */ - inline virtual bool SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config) {return true; } + inline virtual bool SetPrimVar(unsigned long iPoint, 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; } + inline virtual bool SetPrimVar(unsigned long iPoint, 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; } + inline virtual bool SetPrimVar(unsigned long iPoint, 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; } + inline virtual bool SetPrimVar(unsigned long iPoint, 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; } + inline virtual bool SetPrimVar(unsigned long iPoint, 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; } + inline virtual su2double GetPrimitive(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void SetPrimitive(unsigned short val_var, su2double val_prim) {} + inline virtual void SetPrimitive(unsigned long iPoint, unsigned long iVar, su2double val_prim) {} /*! * \brief A virtual member. */ - inline virtual void SetPrimitive(su2double *val_prim) {} + inline virtual void SetPrimitive(unsigned long iPoint, const su2double *val_prim) {} /*! * \brief A virtual member. */ - inline virtual su2double *GetPrimitive(void) {return NULL; } + inline virtual su2double *GetPrimitive(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. */ - inline virtual su2double GetSecondary(unsigned short val_var) {return 0; } + inline virtual su2double GetSecondary(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void SetSecondary(unsigned short val_var, su2double val_secondary) {} + inline virtual void SetSecondary(unsigned long iPoint, unsigned long iVar, su2double val_secondary) {} /*! * \brief A virtual member. */ - inline virtual void SetSecondary(su2double *val_secondary) {} + inline virtual void SetSecondary(unsigned long iPoint, const su2double *val_secondary) {} /*! * \brief A virtual member. */ - inline virtual void SetdPdrho_e(su2double dPdrho_e) {} + inline virtual void SetdPdrho_e(unsigned long iPoint, su2double dPdrho_e) {} /*! * \brief A virtual member. */ - inline virtual void SetdPde_rho(su2double dPde_rho) {} + inline virtual void SetdPde_rho(unsigned long iPoint, su2double dPde_rho) {} /*! * \brief A virtual member. */ - inline virtual void SetdTdrho_e(su2double dTdrho_e) {} + inline virtual void SetdTdrho_e(unsigned long iPoint, su2double dTdrho_e) {} /*! * \brief A virtual member. */ - inline virtual void SetdTde_rho(su2double dTde_rho) {} + inline virtual void SetdTde_rho(unsigned long iPoint, su2double dTde_rho) {} /*! * \brief A virtual member. */ - inline virtual void Setdmudrho_T(su2double dmudrho_T) {} + inline virtual void Setdmudrho_T(unsigned long iPoint, su2double dmudrho_T) {} /*! * \brief A virtual member. */ - inline virtual void SetdmudT_rho(su2double dmudT_rho) {} + inline virtual void SetdmudT_rho(unsigned long iPoint, su2double dmudT_rho) {} /*! * \brief A virtual member. */ - inline virtual void Setdktdrho_T(su2double dktdrho_T) {} + inline virtual void Setdktdrho_T(unsigned long iPoint, su2double dktdrho_T) {} /*! * \brief A virtual member. */ - inline virtual void SetdktdT_rho(su2double dktdT_rho) {} + inline virtual void SetdktdT_rho(unsigned long iPoint, su2double dktdT_rho) {} /*! * \brief A virtual member. */ - inline virtual su2double *GetSecondary(void) {return NULL; } + inline virtual su2double *GetSecondary(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. */ - inline virtual bool SetDensity(su2double val_density) { return false; } + inline virtual bool SetDensity(unsigned long iPoint, su2double val_density) { return false; } /*! * \brief A virtual member. */ - inline virtual bool SetDensity(void) { return false; } + inline virtual bool SetDensity(unsigned long iPoint) { return false; } /*! * \brief A virtual member. */ - inline virtual void SetPressure(void) {} + inline virtual void SetPressure(unsigned long iPoint) {} /*! * \brief A virtual member. */ - inline virtual void SetVelocity(void) {} + inline virtual void SetVelocity(unsigned long iPoint) {} /*! * \brief A virtual member. */ - inline virtual void SetBetaInc2(su2double val_betainc2) {} + inline virtual void SetBetaInc2(unsigned long iPoint, su2double val_betainc2) {} /*! * \brief A virtual member. * \param[in] val_phi - Value of the adjoint velocity. */ - inline virtual void SetPhi_Old(su2double *val_phi) {} + inline virtual void SetPhi_Old(unsigned long iPoint, const su2double *val_phi) {} /*! * \brief A virtual member. * \param[in] Gamma - Ratio of Specific heats */ - inline virtual bool SetPressure(su2double Gamma) {return false; } + inline virtual bool SetPressure(unsigned long iPoint, su2double Gamma) { return false; } /*! * \brief A virtual member. * \param[in] config */ - inline virtual bool SetPressure(CConfig *config) {return false; } + inline virtual bool SetPressure(unsigned long iPoint, CConfig *config) { return false; } /*! * \brief A virtual member. */ - inline virtual bool SetPressure(su2double Gamma, su2double turb_ke) {return false; } + inline virtual bool SetPressure(unsigned long iPoint, 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; } + inline virtual su2double CalcEve(unsigned long iPoint, su2double *V, CConfig *config, unsigned long val_Species) { return 0.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; } + inline virtual su2double CalcHs(unsigned long iPoint, su2double *V, CConfig *config, unsigned long val_Species) { return 0.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; } + inline virtual su2double CalcCvve(unsigned long iPoint, su2double val_Tve, CConfig *config, unsigned long val_Species) { return 0.0; } /*! * \brief A virtual member. @@ -1503,7 +1602,7 @@ class CVariable { * \param[in] config - Configuration settings * \param[in] dPdU */ - inline virtual void CalcdPdU(su2double *V, CConfig *config, su2double *dPdU) {} + inline virtual void CalcdPdU(unsigned long iPoint, su2double *V, CConfig *config, su2double *dPdU) {} /*! * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ @@ -1511,7 +1610,7 @@ class CVariable { * \param[in] config - Configuration settings * \param[in] dTdU */ - inline virtual void CalcdTdU(su2double *V, CConfig *config, su2double *dTdU) {} + inline virtual void CalcdTdU(unsigned long iPoint, su2double *V, CConfig *config, su2double *dTdU) {} /*! * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ @@ -1519,394 +1618,326 @@ class CVariable { * \param[in] config - Configuration settings * \param[in] dTdU */ - inline virtual void CalcdTvedU(su2double *V, CConfig *config, su2double *dTdU) {} + inline virtual void CalcdTvedU(unsigned long iPoint, su2double *V, CConfig *config, su2double *dTdU) {} /*! * \brief A virtual member. */ - inline virtual su2double *GetdPdU(void) { return NULL; } + inline virtual su2double *GetdPdU(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. */ - inline virtual su2double *GetdTdU(void) { return NULL; } + inline virtual su2double *GetdTdU(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. */ - inline virtual su2double *GetdTvedU(void) { return NULL; } + inline virtual su2double *GetdTvedU(unsigned long iPoint) { return nullptr; } /*! * \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) {} + inline virtual void SetDeltaPressure(unsigned long iPoint, const su2double *val_velocity, su2double Gamma) {} /*! * \brief A virtual member. * \param[in] Gamma - Ratio of specific heats. */ - inline virtual bool SetSoundSpeed(su2double Gamma) {return false; } + inline virtual bool SetSoundSpeed(unsigned long iPoint, su2double Gamma) { return false; } /*! * \brief A virtual member. * \param[in] config - Configuration parameters. */ - inline virtual bool SetSoundSpeed(CConfig *config) {return false; } + inline virtual bool SetSoundSpeed(unsigned long iPoint, CConfig *config) { return false; } /*! * \brief A virtual member. */ - inline virtual bool SetSoundSpeed(void) { return false; } + inline virtual bool SetSoundSpeed(unsigned long iPoint) { return false; } /*! * \brief A virtual member. * \param[in] Gas_Constant - Value of the Gas Constant */ - inline virtual bool SetTemperature(su2double Gas_Constant) {return false; } + inline virtual bool SetTemperature(unsigned long iPoint, 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; } + inline virtual bool SetTemperature_ve(unsigned long iPoint, su2double val_Tve) { return false; } /*! * \brief A virtual member. * \param[in] config - Configuration parameters. */ - inline virtual bool SetTemperature(CConfig *config) {return false; } + inline virtual bool SetTemperature(unsigned long iPoint, CConfig *config) { return false; } /*! * \brief A virtual member. * \param[in] config - Configuration parameters. */ - inline virtual void SetPrimitive(CConfig *config) {} + inline virtual void SetPrimitive(unsigned long iPoint, CConfig *config) {} /*! * \brief A virtual member. * \param[in] config - Configuration parameters. * \param[in] Coord - Physical coordinates. */ - inline virtual void SetPrimitive(CConfig *config, su2double *Coord) {} + inline virtual void SetPrimitive(unsigned long iPoint, 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) {} + inline virtual void SetWallTemperature(unsigned long iPoint, 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) {} + inline virtual void SetWallTemperature(unsigned long iPoint, su2double* Temperature_Wall) {} /*! * \brief Set the thermal coefficient. * \param[in] config - Configuration parameters. */ - inline virtual void SetThermalCoeff(CConfig *config) {} + inline virtual void SetThermalCoeff(unsigned long iPoint, CConfig *config) {} /*! * \brief A virtual member. */ - inline virtual void SetStress_FEM(unsigned short iVar, su2double val_stress) {} + inline virtual void SetStress_FEM(unsigned long iPoint, unsigned long iVar, su2double val_stress) {} /*! * \brief A virtual member. */ - inline virtual void AddStress_FEM(unsigned short iVar, su2double val_stress) {} + inline virtual void AddStress_FEM(unsigned long iPoint, unsigned long iVar, su2double val_stress) {} /*! * \brief A virtual member. */ - inline virtual su2double *GetStress_FEM(void) {return NULL;} + inline virtual su2double *GetStress_FEM(unsigned long iPoint) {return nullptr;} /*! * \brief A virtual member. */ - inline virtual void SetVonMises_Stress(su2double val_stress) {} + inline virtual void SetVonMises_Stress(unsigned long iPoint, su2double val_stress) {} /*! * \brief A virtual member. */ - inline virtual su2double GetVonMises_Stress(void) {return 0.0;} + inline virtual su2double GetVonMises_Stress(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void Add_SurfaceLoad_Res(su2double *val_surfForce) {} + inline virtual void Add_SurfaceLoad_Res(unsigned long iPoint, const su2double *val_surfForce) {} /*! * \brief A virtual member. */ - inline virtual void Set_SurfaceLoad_Res(unsigned short iVar, su2double val_surfForce) {} + inline virtual void Set_SurfaceLoad_Res(unsigned long iPoint, unsigned long iVar, su2double val_surfForce) {} /*! * \brief A virtual member. */ - inline virtual su2double Get_SurfaceLoad_Res(unsigned short iVar) {return 0.0;} + inline virtual su2double Get_SurfaceLoad_Res(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void Clear_SurfaceLoad_Res(void) {} + inline virtual void Clear_SurfaceLoad_Res(unsigned long iPoint) {} /*! * \brief A virtual member. */ - inline virtual void Set_SurfaceLoad_Res_n(void) {} + virtual void Set_SurfaceLoad_Res_n() {} /*! * \brief A virtual member. */ - inline virtual su2double Get_SurfaceLoad_Res_n(unsigned short iVar) {return 0.0;} + inline virtual su2double Get_SurfaceLoad_Res_n(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void Add_BodyForces_Res(su2double *val_bodyForce) {} + inline virtual void Add_BodyForces_Res(unsigned long iPoint, const su2double *val_bodyForce) {} /*! * \brief A virtual member. */ - inline virtual su2double Get_BodyForces_Res(unsigned short iVar) {return 0.0;} + inline virtual su2double Get_BodyForces_Res(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void Clear_BodyForces_Res(void) {} + inline virtual void Clear_BodyForces_Res(unsigned long iPoint) {} /*! * \brief A virtual member. */ - inline virtual void Set_FlowTraction(su2double *val_flowTraction) {} + inline virtual void Set_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) {} /*! * \brief A virtual member. */ - inline virtual void Add_FlowTraction(su2double *val_flowTraction) {} + inline virtual void Add_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) {} /*! * \brief A virtual member. */ - inline virtual su2double Get_FlowTraction(unsigned short iVar) {return 0.0;} + inline virtual su2double Get_FlowTraction(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void Set_FlowTraction_n(void) {} + virtual void Set_FlowTraction_n() {} /*! * \brief A virtual member. */ - inline virtual su2double Get_FlowTraction_n(unsigned short iVar) {return 0.0;} + inline virtual su2double Get_FlowTraction_n(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void Clear_FlowTraction(void) {} + inline virtual void Clear_FlowTraction() {} /*! * \brief A virtual member. */ - inline virtual bool Get_isVertex(void) const {return false;} + inline virtual void Set_isVertex(unsigned long iPoint, bool isVertex) {} /*! * \brief A virtual member. */ - inline virtual void SetVelocity2(void) {} + inline virtual bool Get_isVertex(unsigned long iPoint) const { return false; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetVelocity2(unsigned long iPoint) {} /*! * \brief A virtual member. * \param[in] val_velocity - Pointer to the velocity. */ - inline virtual void SetVelocity_Old(su2double *val_velocity) {} + inline virtual void SetVelocity_Old(unsigned long iPoint, const su2double *val_velocity) {} /*! * \brief A virtual member. * \param[in] laminarViscosity */ - inline virtual void SetLaminarViscosity(su2double laminarViscosity) {} + inline virtual void SetLaminarViscosity(unsigned long iPoint, su2double laminarViscosity) {} /*! * \brief A virtual member. * \param[in] config - Definition of the particular problem. */ - inline virtual void SetLaminarViscosity(CConfig *config) {} + inline virtual void SetLaminarViscosity(unsigned long iPoint, CConfig *config) {} /*! * \brief A virtual member. * \param[in] thermalConductivity */ - inline virtual void SetThermalConductivity(su2double thermalConductivity) {} + inline virtual void SetThermalConductivity(unsigned long iPoint, su2double thermalConductivity) {} /*! * \brief A virtual member. * \param[in] config - Definition of the particular problem. */ - inline virtual void SetThermalConductivity(CConfig *config) {} + inline virtual void SetThermalConductivity(unsigned long iPoint, CConfig *config) {} /*! * \brief A virtual member. * \param[in] Cp - Constant pressure specific heat. */ - inline virtual void SetSpecificHeatCp(su2double Cp) {} + inline virtual void SetSpecificHeatCp(unsigned long iPoint, su2double Cp) {} /*! * \brief A virtual member. * \param[in] Cv - Constant volume specific heat. */ - inline virtual void SetSpecificHeatCv(su2double Cv) {} + inline virtual void SetSpecificHeatCv(unsigned long iPoint, su2double Cv) {} /*! * \brief A virtual member. */ - inline virtual bool SetVorticity(void) {return false; } + inline virtual bool SetVorticity_StrainMag() { return false; } /*! * \brief A virtual member. */ - inline virtual bool SetStrainMag(void) {return false; } + inline virtual void SetVelSolutionDVector(unsigned long iPoint) {} /*! * \brief A virtual member. */ - inline virtual void SetVelSolutionOldDVector(void) {} + virtual void SetGradient_PrimitiveZero() {} /*! * \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] iVar - Index of the variable. + * \param[in] iDim - 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) {} + inline virtual void AddGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, 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] iVar - Index of the variable. + * \param[in] iDim - 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) {} + inline virtual void SubtractGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, 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] iVar - Index of the variable. + * \param[in] iDim - 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; } + inline virtual su2double GetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const { return 0.0; } /*! * \brief A virtual member. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \return Value of the primitive variables gradient. */ - inline virtual su2double GetLimiter_Primitive(unsigned short val_var) {return 0; } + inline virtual su2double GetLimiter_Primitive(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. - * \param[in] val_var - Index of the variable. - * \param[in] val_dim - Index of the dimension. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - 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) {} + inline virtual void SetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double val_value) {} /*! * \brief A virtual member. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \param[in] val_value - Value of the gradient. */ - inline virtual void SetLimiter_Primitive(unsigned short val_var, su2double val_value) {} + inline virtual void SetLimiter_Primitive(unsigned long iPoint, unsigned long iVar, su2double val_value) {} /*! * \brief A virtual member. * \return Value of the primitive variables gradient. */ - inline virtual su2double **GetGradient_Primitive(void) {return NULL; } + inline virtual su2double **GetGradient_Primitive(unsigned long iPoint) { return nullptr; } /*! * \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; } + inline virtual su2double *GetLimiter_Primitive(unsigned long iPoint) { return nullptr; } /*! * \brief Set the blending function for the blending of k-w and k-eps. @@ -1914,499 +1945,487 @@ class CVariable { * \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) {} + inline virtual void SetBlendingFunc(unsigned long iPoint, 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; } + inline virtual su2double GetF1blending(unsigned long iPoint) const { return 0.0; } /*! * \brief Get the second blending function of the SST model. */ - inline virtual su2double GetF2blending(void) {return 0; } + inline virtual su2double GetF2blending(unsigned long iPoint) const { return 0.0; } /*! * \brief Get the value of the cross diffusion of tke and omega. */ - inline virtual su2double GetCrossDiff(void) { return 0.0; } + inline virtual su2double GetCrossDiff(unsigned long iPoint) const { 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; } + inline virtual su2double GetmuT(unsigned long iPoint) const { return 0.0; } /*! * \brief Set the value of the eddy viscosity. * \param[in] val_muT */ - inline virtual void SetmuT(su2double val_muT) {} + inline virtual void SetmuT(unsigned long iPoint, 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) {} + inline virtual void AddMax_Lambda_Inv(unsigned long iPoint, su2double val_max_lambda, unsigned long 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) {} + inline virtual void AddMax_Lambda_Visc(unsigned long iPoint, su2double val_max_lambda, unsigned long iSpecies) {} /*! * \brief A virtual member. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - 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) {} + inline virtual void SetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar, su2double val_source) {} /*! * \brief A virtual member. */ - inline virtual su2double GetHarmonicBalance_Source(unsigned short val_var) {return 0; } + inline virtual su2double GetHarmonicBalance_Source(unsigned long iPoint, unsigned long iVar) const { return 0.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) {} + inline virtual void SetEddyViscSens(unsigned long iPoint, const su2double *val_EddyViscSens, unsigned long numTotalVar) {} /*! * \brief Get the Eddy Viscosity Sensitivity of the problem. * \return Pointer to the Eddy Viscosity Sensitivity. */ - inline virtual su2double *GetEddyViscSens(void) {return NULL; } + inline virtual su2double *GetEddyViscSens(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. Set the direct solution for the adjoint solver. - * \param[in] val_solution_direct - Value of the direct solution. + * \param[in] solution_direct - Value of the direct solution. */ - inline virtual void SetSolution_Direct(su2double *val_solution_direct) {} + inline virtual void SetSolution_Direct(unsigned long iPoint, const su2double *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; } + inline virtual su2double *GetSolution_Direct(unsigned long iPoint) { return nullptr; } /*! * \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) {} + inline virtual void SetGeometry_Direct(unsigned long iPoint, const 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; } + inline virtual su2double *GetGeometry_Direct(unsigned long iPoint) { return nullptr; } /*! * \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; } + inline virtual su2double GetGeometry_Direct(unsigned long iPoint, unsigned long iDim) const { 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline virtual su2double GetSolution_Geometry(unsigned short val_var) {return 0.0;} + inline virtual su2double GetSolution_Geometry(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). + * \param[in] solution - Solution of the problem (acceleration). */ - inline virtual void SetSolution_Geometry(su2double *val_solution_geometry) {} + inline virtual void SetSolution_Geometry(unsigned long iPoint, const su2double *solution_geometry) {} /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). + * \param[in] solution - Solution of the problem (acceleration). */ - inline virtual void SetSolution_Geometry(unsigned short val_var, su2double val_solution_geometry) {} + inline virtual void SetSolution_Geometry(unsigned long iPoint, unsigned long iVar, su2double 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline virtual su2double GetGeometry_CrossTerm_Derivative(unsigned short val_var) {return 0.0;} + inline virtual su2double GetGeometry_CrossTerm_Derivative(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). + * \param[in] solution - Solution of the problem (acceleration). */ - inline virtual void SetGeometry_CrossTerm_Derivative(unsigned short iDim, su2double der) {} + inline virtual void SetGeometry_CrossTerm_Derivative(unsigned long iPoint, unsigned long 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline virtual su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned short val_var) {return 0.0;} + inline virtual su2double GetGeometry_CrossTerm_Derivative_Flow(unsigned long iPoint, unsigned long iVar) const { return 0.0;} /*! * \brief A virtual member. Set the value of the mesh solution (adjoint). - * \param[in] val_solution - Solution of the problem (acceleration). + * \param[in] solution - Solution of the problem (acceleration). */ - inline virtual void SetGeometry_CrossTerm_Derivative_Flow(unsigned short iDim, su2double der) {} + inline virtual void SetGeometry_CrossTerm_Derivative_Flow(unsigned long iPoint, unsigned long iDim, su2double der) {} /*! * \brief A virtual member. Set the value of the old geometry solution (adjoint). */ - inline virtual void Set_OldSolution_Geometry(void) {} + inline virtual void Set_OldSolution_Geometry() {} /*! * \brief A virtual member. Get the value of the old geometry solution (adjoint). - * \param[out] val_solution - old adjoint solution for coordinate iDim + * \param[out] solution - old adjoint solution for coordinate iDim */ - inline virtual su2double Get_OldSolution_Geometry(unsigned short iDim) {return 0.0;} + inline virtual su2double Get_OldSolution_Geometry(unsigned long iPoint, unsigned long iDim) const { 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) {} + inline virtual void Set_BGSSolution(unsigned long iPoint, unsigned long iDim, su2double solution) {} /*! * \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]; - } + virtual void Set_BGSSolution_k(); /*! * \brief Set the value of the solution in the previous BGS subiteration. */ - inline void Set_BGSSolution_k(unsigned short iVar, su2double val_var) { - Solution_BGS_k[iVar] = val_var; + inline void Set_BGSSolution_k(unsigned long iPoint, unsigned long iVar, su2double val_var) { + Solution_BGS_k(iPoint,iVar) = val_var; } /*! * \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];} - - /*! - * \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. Set the value of the old geometry solution (adjoint). - */ - inline virtual void Set_BGSSolution_Geometry(void) {} + inline virtual su2double Get_BGSSolution_k(unsigned long iPoint, unsigned long iVar) const { + return Solution_BGS_k(iPoint,iVar); + } /*! * \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;} + inline virtual su2double Get_BGSSolution(unsigned long iPoint, unsigned long iDim) const {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) {} + inline virtual void SetCross_Term_Derivative(unsigned long iPoint, unsigned long 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; } + inline virtual su2double GetCross_Term_Derivative(unsigned long iPoint, unsigned long iVar) const { 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. + * \param[in] solution_direct - Value of the direct velocity solution. */ - inline virtual void SetSolution_Vel_Direct(su2double *sol) {} + inline virtual void SetSolution_Vel_Direct(unsigned long iPoint, const 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. + * \param[in] solution_direct - Value of the direct acceleration solution. */ - inline virtual void SetSolution_Accel_Direct(su2double *sol) {} + inline virtual void SetSolution_Accel_Direct(unsigned long iPoint, const 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; } + inline virtual su2double* GetSolution_Vel_Direct(unsigned long iPoint) { return nullptr; } /*! * \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; } + inline virtual su2double* GetSolution_Accel_Direct(unsigned long iPoint) { return nullptr; } /*! * \brief Set the value of the velocity (Structural Analysis). - * \param[in] val_solution - Solution of the problem (velocity). + * \param[in] solution - Solution of the problem (velocity). */ - inline virtual void SetSolution_Vel(su2double *val_solution) {} + inline virtual void SetSolution_Vel(unsigned long iPoint, const su2double *solution) {} /*! * \overload - * \param[in] val_var - Index of the variable. - * \param[in] val_solution_vel - Value of the solution for the index val_var. + * \param[in] iVar - Index of the variable. + * \param[in] solution_vel - Value of the solution for the index iVar. */ - inline virtual void SetSolution_Vel(unsigned short val_var, su2double val_solution_vel) {} + inline virtual void SetSolution_Vel(unsigned long iPoint, unsigned long iVar, su2double 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. + * \param[in] solution_vel_time_n - Value of the old solution. */ - inline virtual void SetSolution_Vel_time_n(su2double *val_solution_vel_time_n) {} + inline virtual void SetSolution_Vel_time_n(unsigned long iPoint, const su2double *solution_vel_time_n) {} /*! * \brief Set the value of the velocity (Structural Analysis) at time n. */ - inline virtual void SetSolution_Vel_time_n(void) {} + inline virtual void SetSolution_Vel_time_n() {} /*! * \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. + * \param[in] iVar - Index of the variable. + * \param[in] solution_vel_time_n - Value of the old solution for the index iVar. */ - inline virtual void SetSolution_Vel_time_n(unsigned short val_var, su2double val_solution_vel_time_n) {} + inline virtual void SetSolution_Vel_time_n(unsigned long iPoint, unsigned long iVar, su2double 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetSolution_time_n(unsigned short val_var) {return Solution_time_n[val_var]; } + inline su2double GetSolution_time_n(unsigned long iPoint, unsigned long iVar) const { return Solution_time_n(iPoint,iVar); } /*! * \brief Get the solution at time n-1. - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline su2double GetSolution_time_n1(unsigned short val_var) {return Solution_time_n1[val_var]; } + inline su2double GetSolution_time_n1(unsigned long iPoint, unsigned long iVar) const { return Solution_time_n1(iPoint,iVar); } /*! * \brief Get the velocity (Structural Analysis). - * \param[in] val_var - Index of the variable. - * \return Value of the solution for the index val_var. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline virtual su2double GetSolution_Vel(unsigned short val_var) {return 0; } + inline virtual su2double GetSolution_Vel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ - inline virtual su2double *GetSolution_Vel(void) {return NULL; } + inline virtual su2double *GetSolution_Vel(unsigned long iPoint) {return nullptr; } /*! * \brief Get the velocity of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline virtual su2double GetSolution_Vel_time_n(unsigned short val_var) {return 0; } + inline virtual su2double GetSolution_Vel_time_n(unsigned long iPoint, unsigned long iVar) const { return 0.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; } + inline virtual su2double *GetSolution_Vel_time_n(unsigned long iPoint) { return nullptr; } /*! * \brief Set the value of the acceleration (Structural Analysis). - * \param[in] val_solution_accel - Solution of the problem (acceleration). + * \param[in] solution_accel - Solution of the problem (acceleration). */ - inline virtual void SetSolution_Accel(su2double *val_solution_accel) {} + inline virtual void SetSolution_Accel(unsigned long iPoint, const su2double *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. + * \param[in] iVar - Index of the variable. + * \param[in] solution_accel - Value of the solution for the index iVar. */ - inline virtual void SetSolution_Accel(unsigned short val_var, su2double val_solution_accel) {} + inline virtual void SetSolution_Accel(unsigned long iPoint, unsigned long iVar, su2double 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. + * \param[in] solution_accel_time_n - Pointer to the residual vector. */ - inline virtual void SetSolution_Accel_time_n(su2double *val_solution_accel_time_n) {} + inline virtual void SetSolution_Accel_time_n(unsigned long iPoint, const su2double *solution_accel_time_n) {} /*! * \brief Set the value of the acceleration (Structural Analysis) at time n. */ - inline virtual void SetSolution_Accel_time_n(void) {} + inline virtual void SetSolution_Accel_time_n() {} /*! * \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. + * \param[in] iVar - Index of the variable. + * \param[in] solution_accel_time_n - Value of the old solution for the index iVar. */ - inline virtual void SetSolution_Accel_time_n(unsigned short val_var, su2double val_solution_accel_time_n) {} + inline virtual void SetSolution_Accel_time_n(unsigned long iPoint, unsigned long iVar, su2double 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. + * \param[in] iVar - Index of the variable. + * \return Value of the solution for the index iVar. */ - inline virtual su2double GetSolution_Accel(unsigned short val_var) {return 0; } + inline virtual su2double GetSolution_Accel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief Get the solution of the problem. * \return Pointer to the solution vector. */ - inline virtual su2double *GetSolution_Accel(void) {return NULL; } + inline virtual su2double *GetSolution_Accel(unsigned long iPoint) { return nullptr; } /*! * \brief Get the acceleration of the nodes (Structural Analysis) at time n. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline virtual su2double GetSolution_Accel_time_n(unsigned short val_var) {return 0; } + inline virtual su2double GetSolution_Accel_time_n(unsigned long iPoint, unsigned long iVar) const { return 0.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; } + inline virtual su2double *GetSolution_Accel_time_n(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. */ - inline virtual void Set_OldSolution_Vel(void) {} + inline virtual void Set_OldSolution_Vel() {} /*! * \brief A virtual member. */ - inline virtual void Set_OldSolution_Accel(void) {} + inline virtual void Set_OldSolution_Accel() {} /*! * \brief A virtual member. Set the value of the solution predictor. */ - inline virtual void SetSolution_Pred(void) {} + inline virtual void SetSolution_Pred(unsigned long iPoint) {} /*! * \brief A virtual member. Set the value of the old solution. - * \param[in] val_solution_pred - Pointer to the residual vector. + * \param[in] solution_pred - Pointer to the residual vector. */ - inline virtual void SetSolution_Pred(su2double *val_solution_pred) {} + inline virtual void SetSolution_Pred(unsigned long iPoint, const su2double *solution_pred) {} /*! * \brief A virtual member. Set the value of the solution predicted. - * \param[in] val_solution_old - Pointer to the residual vector. + * \param[in] solution_old - Pointer to the residual vector. */ - inline virtual void SetSolution_Pred(unsigned short val_var, su2double val_solution_pred) {} + inline virtual void SetSolution_Pred(unsigned long iPoint, unsigned long iVar, su2double solution_pred) {} /*! * \brief A virtual member. Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline virtual su2double GetSolution_Pred(unsigned short val_var) {return 0.0; } + inline virtual su2double GetSolution_Pred(unsigned long iPoint, unsigned long iVar) const { 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; } + inline virtual su2double *GetSolution_Pred(unsigned long iPoint) {return nullptr; } /*! * \brief A virtual member. Set the value of the solution predictor. */ - inline virtual void SetSolution_Pred_Old(void) {} + inline virtual void SetSolution_Pred_Old(unsigned long iPoint) {} /*! * \brief A virtual member. Set the value of the old solution. - * \param[in] val_solution_pred_Old - Pointer to the residual vector. + * \param[in] solution_pred_Old - Pointer to the residual vector. */ - inline virtual void SetSolution_Pred_Old(su2double *val_solution_pred_Old) {} + inline virtual void SetSolution_Pred_Old(unsigned long iPoint, const su2double *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. + * \param[in] solution_pred_old - Pointer to the residual vector. */ - inline virtual void SetSolution_Pred_Old(unsigned short val_var, su2double val_solution_pred_old) {} + inline virtual void SetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar, su2double solution_pred_old) {} /*! * \brief A virtual member. Get the value of the solution predictor. - * \param[in] val_var - Index of the variable. + * \param[in] iVar - Index of the variable. * \return Pointer to the old solution vector. */ - inline virtual su2double GetSolution_Pred_Old(unsigned short val_var) {return 0.0; } + inline virtual su2double GetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar) const { 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; } + inline virtual su2double *GetSolution_Pred_Old(unsigned long iPoint) { return nullptr; } /*! * \brief A virtual member. */ - inline virtual void SetReference_Geometry(unsigned short iVar, su2double ref_geometry) {} + inline virtual void SetReference_Geometry(unsigned long iPoint, unsigned long iVar, su2double ref_geometry) {} /*! * \brief A virtual member. */ - inline virtual su2double *GetReference_Geometry(void) {return NULL; } + inline virtual su2double *GetReference_Geometry(unsigned long iPoint) {return nullptr; } /*! * \brief A virtual member. */ - inline virtual void SetPrestretch(unsigned short iVar, su2double val_prestretch) {} + inline virtual void SetPrestretch(unsigned long iPoint, unsigned long iVar, su2double val_prestretch) {} /*! * \brief A virtual member. */ - inline virtual su2double *GetPrestretch(void) {return NULL; } + inline virtual su2double *GetPrestretch(unsigned long iPoint) {return nullptr; } /*! * \brief A virtual member. */ - inline virtual su2double GetPrestretch(unsigned short iVar) {return 0.0; } + inline virtual su2double GetPrestretch(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual su2double GetReference_Geometry(unsigned short iVar) {return 0.0; } + inline virtual su2double GetReference_Geometry(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief A virtual member. Get the value of the undeformed coordinates. * \param[in] iDim - Index of Mesh_Coord[nDim] * \return Value of the original coordinate iDim. */ - inline virtual su2double GetMesh_Coord(unsigned short iDim) const { return 0.0; } + inline virtual su2double GetMesh_Coord(unsigned long iPoint, unsigned long iDim) const { return 0.0; } /*! * \brief A virtual member. Get the undeformed coordinates. * \return Pointer to the reference coordinates. */ - inline virtual su2double *GetMesh_Coord() { return NULL; } + inline virtual const su2double *GetMesh_Coord(unsigned long iPoint) const { return nullptr; } /*! * \brief A virtual member. Set the value of the undeformed coordinates. * \param[in] iDim - Index of Mesh_Coord[nDim] * \param[in] val_coord - Value of Mesh_Coord[nDim] */ - inline virtual void SetMesh_Coord(unsigned short iDim, const su2double val_coord) { } + inline virtual void SetMesh_Coord(unsigned long iPoint, unsigned long iDim, su2double val_coord) { } /*! * \brief A virtual member. Get the value of the wall distance in reference coordinates. * \param[in] iDim - Index of Mesh_Coord[nDim] * \return Value of the wall distance in reference coordinates. */ - inline virtual su2double GetWallDistance(void) const { return 0.0; } + inline virtual su2double GetWallDistance(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. Set the value of the wall distance in reference coordinates. * \param[in] val_dist - Value of wall distance. */ - inline virtual void SetWallDistance(const su2double val_dist) { } + inline virtual void SetWallDistance(unsigned long iPoint, su2double val_dist) { } /*! * \brief A virtual member. Register the reference coordinates of the mesh. @@ -2417,19 +2436,19 @@ class CVariable { /*! * \brief A virtual member. Recover the value of the adjoint of the mesh coordinates. */ - inline virtual void GetAdjoint_MeshCoord(su2double *adj_mesh) const { } + inline virtual void GetAdjoint_MeshCoord(unsigned long iPoint, su2double *adj_mesh) const { } /*! * \brief A virtual member. Get the value of the displacement imposed at the boundary. * \return Value of the boundary displacement. */ - inline virtual su2double GetBound_Disp(unsigned short iDim) const { return 0.0; } + inline virtual su2double GetBound_Disp(unsigned long iPoint, unsigned long iDim) const { return 0.0; } /*! * \brief A virtual member. Set the boundary displacement. * \param[in] val_BoundDisp - Pointer to the boundary displacements. */ - inline virtual void SetBound_Disp(const su2double *val_BoundDisp) { } + inline virtual void SetBound_Disp(unsigned long iPoint, const su2double *val_BoundDisp) { } /*! @@ -2437,32 +2456,32 @@ class CVariable { * \param[in] iDim - Index of the dimension of interest. * \param[in] val_BoundDisp - Value of the boundary displacements. */ - inline virtual void SetBound_Disp(unsigned short iDim, const su2double val_BoundDisp) { } + inline virtual void SetBound_Disp(unsigned long iPoint, unsigned long iDim, const su2double val_BoundDisp) { } /*! * \brief A virtual member. Get the value of the displacement imposed at the boundary. * \return Value of the boundary displacement. */ - inline virtual su2double* GetBoundDisp_Direct(void) { return NULL; } + inline virtual const su2double* GetBoundDisp_Direct(unsigned long iPoint) const { return nullptr; } /*! * \brief A virtual member. Set the solution for the boundary displacements. * \param[in] val_BoundDisp - Pointer to the boundary displacements. */ - inline virtual void SetBoundDisp_Direct(const su2double *val_BoundDisp) { } + inline virtual void SetBoundDisp_Direct(unsigned long iPoint, const su2double *val_BoundDisp) { } /*! * \brief Set the value of the sensitivity with respect to the undeformed coordinates. * \param[in] val_sens - Pointer to the sensitivities of the boundary displacements. */ - inline virtual void SetBoundDisp_Sens(const su2double *val_sens) { } + inline virtual void SetBoundDisp_Sens(unsigned long iPoint, const su2double *val_sens) { } /*! * \brief A virtual member. Get the value of the sensitivity with respect to the undeformed coordinates. * \param[in] iDim - Index of Mesh_Coord_Sens[nDim] * \return Value of the original Mesh_Coord_Sens iDim. */ - inline virtual su2double GetBoundDisp_Sens(unsigned short iDim) const { return 0.0; } + inline virtual su2double GetBoundDisp_Sens(unsigned long iPoint, unsigned long iDim) const { return 0.0; } /*! * \brief A virtual member. Register the boundary displacements of the mesh. @@ -2473,7 +2492,7 @@ class CVariable { /*! * \brief A virtual member. Recover the value of the adjoint of the boundary displacements. */ - inline virtual void GetAdjoint_BoundDisp(su2double *adj_disph) { } + inline virtual void GetAdjoint_BoundDisp(unsigned long iPoint, su2double *adj_disp) const { } /*! * \brief A virtual member. @@ -2503,184 +2522,151 @@ class CVariable { /*! * \brief A virtual member. */ - inline virtual void RegisterFlowTraction() { } + inline virtual void SetAdjointSolution_Vel(unsigned long iPoint, const su2double *adj_sol) {} /*! * \brief A virtual member. */ - inline virtual su2double ExtractFlowTraction_Sensitivity(unsigned short iDim) {return 0.0;} + inline virtual void RegisterFlowTraction() { } /*! * \brief A virtual member. */ - inline virtual void SetAdjointSolution_Vel(su2double *adj_sol) {} + inline virtual su2double ExtractFlowTraction_Sensitivity(unsigned long iPoint, unsigned long iDim) const { return 0.0; } /*! * \brief A virtual member. */ - inline virtual void GetAdjointSolution_Vel(su2double *adj_sol) {} + inline virtual void GetAdjointSolution_Vel(unsigned long iPoint, su2double *adj_sol) const {} /*! * \brief A virtual member. */ - inline virtual void SetAdjointSolution_Vel_time_n(su2double *adj_sol) {} + inline virtual void SetAdjointSolution_Vel_time_n(unsigned long iPoint, const su2double *adj_sol) {} /*! * \brief A virtual member. */ - inline virtual void GetAdjointSolution_Vel_time_n(su2double *adj_sol) {} + inline virtual void GetAdjointSolution_Vel_time_n(unsigned long iPoint, su2double *adj_sol) const {} /*! * \brief A virtual member. */ - inline virtual void SetAdjointSolution_Accel(su2double *adj_sol) {} + inline virtual void SetAdjointSolution_Accel(unsigned long iPoint, const su2double *adj_sol) {} /*! * \brief A virtual member. */ - inline virtual void GetAdjointSolution_Accel(su2double *adj_sol) {} + inline virtual void GetAdjointSolution_Accel(unsigned long iPoint, su2double *adj_sol) const {} /*! * \brief A virtual member. */ - inline virtual void SetAdjointSolution_Accel_time_n(su2double *adj_sol) {} + inline virtual void SetAdjointSolution_Accel_time_n(unsigned long iPoint, const su2double *adj_sol) {} /*! * \brief A virtual member. */ - inline virtual void GetAdjointSolution_Accel_time_n(su2double *adj_sol) {} + inline virtual void GetAdjointSolution_Accel_time_n(unsigned long iPoint, su2double *adj_sol) const {} /*! * \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]);} - } + void RegisterSolution(bool input); /*! * \brief Register the variables in the solution array as input/output variable. * \param[in] input - input or output variables. */ - inline void RegisterSolution_intIndexBased(bool input) { - if (input) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterInput_intIndexBased(Solution[iVar]); - } - else { - for (unsigned short iVar = 0; iVar < nVar; iVar++) - AD::RegisterOutput(Solution[iVar]); - } - } + void RegisterSolution_intIndexBased(bool input); /*! * \brief Saving the adjoint vector position with respect to the solution variables. * \param[in] input - input or output variables. */ - inline void SetAdjIndices(bool input) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - if (input) { - AD::SetAdjIndex(Input_AdjIndices[iVar], Solution[iVar]); - } - else { - AD::SetAdjIndex(Output_AdjIndices[iVar], Solution[iVar]); - } - } - } + void SetAdjIndices(bool input); /*! * \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]); - } + void RegisterSolution_time_n(); /*! * \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]); - } + void RegisterSolution_time_n1(); /*! * \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])); + inline void SetAdjointSolution(unsigned long iPoint, const su2double *adj_sol) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution(iPoint,iVar), SU2_TYPE::GetValue(adj_sol[iVar])); } /*! * \brief Set the adjoint values of the solution. * \param[in] adj_sol - The adjoint values of the solution. */ - inline void SetAdjointSolution_intIndexBased(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - AD::SetDerivative(Output_AdjIndices[iVar], SU2_TYPE::GetValue(adj_sol[iVar])); - } + inline void SetAdjointSolution_intIndexBased(unsigned long iPoint, const su2double *adj_sol) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::SetDerivative(Output_AdjIndices(iPoint,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]); + inline void GetAdjointSolution(unsigned long iPoint, su2double *adj_sol) const { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution(iPoint,iVar)); } /*! * \brief Get the adjoint values of the solution. * \param[in] adj_sol - The adjoint values of the solution. */ - inline void GetAdjointSolution_intIndexBased(su2double *adj_sol) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - adj_sol[iVar] = AD::GetDerivative(Input_AdjIndices[iVar]); - } + inline void GetAdjointSolution_intIndexBased(unsigned long iPoint, su2double *adj_sol) const { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = AD::GetDerivative(Input_AdjIndices(iPoint,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])); + inline void SetAdjointSolution_time_n(unsigned long iPoint, const su2double *adj_sol) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_time_n(iPoint,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]); + inline void GetAdjointSolution_time_n(unsigned long iPoint, su2double *adj_sol) const { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n(iPoint,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])); + inline void SetAdjointSolution_time_n1(unsigned long iPoint, const su2double *adj_sol) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + SU2_TYPE::SetDerivative(Solution_time_n1(iPoint,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]); + inline void GetAdjointSolution_time_n1(unsigned long iPoint, su2double *adj_sol) const { + for (unsigned long iVar = 0; iVar < nVar; iVar++) + adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_time_n1(iPoint,iVar)); } /*! @@ -2688,85 +2674,85 @@ class CVariable { * \param[in] iDim - spacial component * \param[in] val - value of the Sensitivity */ - inline virtual void SetSensitivity(unsigned short iDim, su2double val) {} + inline virtual void SetSensitivity(unsigned long iPoint, unsigned long 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 su2double GetSensitivity(unsigned long iPoint, unsigned long iDim) const { return 0.0; } - inline virtual void SetDual_Time_Derivative(unsigned short iVar, su2double der) {} + inline virtual void SetDual_Time_Derivative(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual void SetDual_Time_Derivative_n(unsigned short iVar, su2double der) {} + inline virtual void SetDual_Time_Derivative_n(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual su2double GetDual_Time_Derivative(unsigned short iVar) {return 0.0;} + inline virtual su2double GetDual_Time_Derivative(unsigned long iPoint, unsigned long iVar) const {return 0.0;} - inline virtual su2double GetDual_Time_Derivative_n(unsigned short iVar) {return 0.0;} + inline virtual su2double GetDual_Time_Derivative_n(unsigned long iPoint, unsigned long iVar) const {return 0.0;} - inline virtual void SetTauWall(su2double val_tau_wall) {} + inline virtual void SetTauWall(unsigned long iPoint, su2double val_tau_wall) {} - inline virtual su2double GetTauWall() {return 0.0; } + inline virtual su2double GetTauWall(unsigned long iPoint) const { return 0.0; } - inline virtual void SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity) {} + inline virtual void SetVortex_Tilting(unsigned long iPoint, su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity) {} - inline virtual su2double GetVortex_Tilting() {return 0.0; } + inline virtual su2double GetVortex_Tilting(unsigned long iPoint) const { return 0.0; } - inline virtual void SetDynamic_Derivative(unsigned short iVar, su2double der) {} + inline virtual void SetDynamic_Derivative(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual void SetDynamic_Derivative_n(unsigned short iVar, su2double der) {} + inline virtual void SetDynamic_Derivative_n(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual su2double GetDynamic_Derivative(unsigned short iVar) {return 0.0; } + inline virtual su2double GetDynamic_Derivative(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - inline virtual su2double GetDynamic_Derivative_n(unsigned short iVar) {return 0.0; } + inline virtual su2double GetDynamic_Derivative_n(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - inline virtual void SetDynamic_Derivative_Vel(unsigned short iVar, su2double der) {} + inline virtual void SetDynamic_Derivative_Vel(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual void SetDynamic_Derivative_Vel_n(unsigned short iVar, su2double der) {} + inline virtual void SetDynamic_Derivative_Vel_n(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual su2double GetDynamic_Derivative_Vel(unsigned short iVar) {return 0.0; } + inline virtual su2double GetDynamic_Derivative_Vel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - inline virtual su2double GetDynamic_Derivative_Vel_n(unsigned short iVar) {return 0.0; } + inline virtual su2double GetDynamic_Derivative_Vel_n(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - inline virtual void SetDynamic_Derivative_Accel(unsigned short iVar, su2double der) {} + inline virtual void SetDynamic_Derivative_Accel(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual void SetDynamic_Derivative_Accel_n(unsigned short iVar, su2double der) {} + inline virtual void SetDynamic_Derivative_Accel_n(unsigned long iPoint, unsigned long iVar, su2double der) {} - inline virtual su2double GetDynamic_Derivative_Accel(unsigned short iVar) {return 0.0; } + inline virtual su2double GetDynamic_Derivative_Accel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - inline virtual su2double GetDynamic_Derivative_Accel_n(unsigned short iVar) {return 0.0; } + inline virtual su2double GetDynamic_Derivative_Accel_n(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - inline virtual su2double GetSolution_Old_Vel(unsigned short iVar) {return 0.0; } + inline virtual su2double GetSolution_Old_Vel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - inline virtual su2double GetSolution_Old_Accel(unsigned short iVar) {return 0.0; } + inline virtual su2double GetSolution_Old_Accel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } /*! * \brief Set the FSI force sensitivity at the node * \param[in] iDim - spacial component * \param[in] val - value of the Sensitivity */ - virtual void SetFlowTractionSensitivity(unsigned short iDim, su2double val) { } + virtual void SetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim, su2double val) { } /*! * \brief Get the FSI force sensitivity at the node * \param[in] iDim - spacial component * \return value of the Sensitivity */ - virtual su2double GetFlowTractionSensitivity(unsigned short iDim) { return 0.0; } + virtual su2double GetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim) const { return 0.0; } /*! * \brief Set the source term applied into the displacement adjoint coming from external solvers * \param[in] iDim - spacial component * \param[in] val - value of the source term */ - virtual void SetSourceTerm_DispAdjoint(unsigned short iDim, su2double val) { } + virtual void SetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim, su2double val) { } /*! * \brief Get the source term applied into the displacement adjoint coming from external solvers * \param[in] iDim - spacial component * \return value of the source term */ - virtual su2double GetSourceTerm_DispAdjoint(unsigned short iDim) { return 0.0; } + virtual su2double GetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim) const { return 0.0; } }; diff --git a/SU2_CFD/src/SU2_CFD.cpp b/SU2_CFD/src/SU2_CFD.cpp index 17d5b5c7870f..d6fe18f845ae 100644 --- a/SU2_CFD/src/SU2_CFD.cpp +++ b/SU2_CFD/src/SU2_CFD.cpp @@ -109,8 +109,7 @@ int main(int argc, char *argv[]) { if (!dry_run){ - if ((!config->GetMultizone_Problem()) - && (config->GetTime_Marching() != HARMONIC_BALANCE && (!turbo)) + if ((!config->GetMultizone_Problem() && (config->GetTime_Marching() != HARMONIC_BALANCE) && !turbo) || (turbo && config->GetDiscrete_Adjoint())) { /*--- Single zone problem: instantiate the single zone driver class. ---*/ diff --git a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp index 472e2d8eddd6..bd2f60f70950 100644 --- a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp @@ -35,7 +35,7 @@ * License along with SU2. If not, see . */ -#include "../include/drivers/CDiscAdjMultizoneDriver.hpp" +#include "../../include/drivers/CDiscAdjMultizoneDriver.hpp" CDiscAdjMultizoneDriver::CDiscAdjMultizoneDriver(char* confFile, unsigned short val_nZone, @@ -531,6 +531,7 @@ void CDiscAdjMultizoneDriver::DirectIteration(unsigned short iZone, unsigned sho cout << " Zone " << iZone << " (turb) - log10[RMS k] : " << log10(solver_container[iZone][INST_0][MESH_0][TURB_SOL]->GetRes_RMS(0)) << endl; } + break; case DISC_ADJ_HEAT: cout << " Zone " << iZone << " (heat) - log10[RMS Solution_0]: " << log10(solver_container[iZone][INST_0][MESH_0][HEAT_SOL]->GetRes_RMS(0)) << endl; @@ -788,7 +789,7 @@ void CDiscAdjMultizoneDriver::SetExternal_Zero(void) { for (iSol=0; iSol < MAX_SOLS; iSol++){ if (solver_container[iZone][INST_0][MESH_0][iSol] != NULL) { if (solver_container[iZone][INST_0][MESH_0][iSol]->GetAdjoint()) { - solver_container[iZone][INST_0][MESH_0][iSol]->SetExternal_Zero(geometry_container[iZone][INST_0][MESH_0]); + solver_container[iZone][INST_0][MESH_0][iSol]->GetNodes()->SetExternalZero(); } } } @@ -804,7 +805,7 @@ void CDiscAdjMultizoneDriver::Set_OldExternal(void) { for (iSol=0; iSol < MAX_SOLS; iSol++){ if (solver_container[iZone][INST_0][MESH_0][iSol] != NULL) { if (solver_container[iZone][INST_0][MESH_0][iSol]->GetAdjoint()) { - solver_container[iZone][INST_0][MESH_0][iSol]->Set_OldExternal(geometry_container[iZone][INST_0][MESH_0]); + solver_container[iZone][INST_0][MESH_0][iSol]->GetNodes()->Set_OldExternal(); } } } diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 5db45c5b3436..2e9e0ceec4f1 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -4619,11 +4619,11 @@ void CHBDriver::SetHarmonicBalance(unsigned short iInst) { for (iVar = 0; iVar < nVar; iVar++) { if (!adjoint) { - U[iVar] = solver_container[ZONE_0][jInst][iMGlevel][FLOW_SOL]->node[iPoint]->GetSolution(iVar); + U[iVar] = solver_container[ZONE_0][jInst][iMGlevel][FLOW_SOL]->GetNodes()->GetSolution(iPoint, iVar); Source[iVar] += U[iVar]*D[iInst][jInst]; if (implicit) { - U_old[iVar] = solver_container[ZONE_0][jInst][iMGlevel][FLOW_SOL]->node[iPoint]->GetSolution_Old(iVar); + U_old[iVar] = solver_container[ZONE_0][jInst][iMGlevel][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint, iVar); deltaU = U[iVar] - U_old[iVar]; Source[iVar] += deltaU*D[iInst][jInst]; } @@ -4631,11 +4631,11 @@ void CHBDriver::SetHarmonicBalance(unsigned short iInst) { } else { - Psi[iVar] = solver_container[ZONE_0][jInst][iMGlevel][ADJFLOW_SOL]->node[iPoint]->GetSolution(iVar); + Psi[iVar] = solver_container[ZONE_0][jInst][iMGlevel][ADJFLOW_SOL]->GetNodes()->GetSolution(iPoint, iVar); Source[iVar] += Psi[iVar]*D[jInst][iInst]; if (implicit) { - Psi_old[iVar] = solver_container[ZONE_0][jInst][iMGlevel][ADJFLOW_SOL]->node[iPoint]->GetSolution_Old(iVar); + Psi_old[iVar] = solver_container[ZONE_0][jInst][iMGlevel][ADJFLOW_SOL]->GetNodes()->GetSolution_Old(iPoint, iVar); deltaPsi = Psi[iVar] - Psi_old[iVar]; Source[iVar] += deltaPsi*D[jInst][iInst]; } @@ -4645,10 +4645,10 @@ void CHBDriver::SetHarmonicBalance(unsigned short iInst) { /*--- Store sources for current row ---*/ for (iVar = 0; iVar < nVar; iVar++) { if (!adjoint) { - solver_container[ZONE_0][iInst][iMGlevel][FLOW_SOL]->node[iPoint]->SetHarmonicBalance_Source(iVar, Source[iVar]); + solver_container[ZONE_0][iInst][iMGlevel][FLOW_SOL]->GetNodes()->SetHarmonicBalance_Source(iPoint, iVar, Source[iVar]); } else { - solver_container[ZONE_0][iInst][iMGlevel][ADJFLOW_SOL]->node[iPoint]->SetHarmonicBalance_Source(iVar, Source[iVar]); + solver_container[ZONE_0][iInst][iMGlevel][ADJFLOW_SOL]->GetNodes()->SetHarmonicBalance_Source(iPoint, iVar, Source[iVar]); } } @@ -4672,14 +4672,14 @@ void CHBDriver::SetHarmonicBalance(unsigned short iInst) { /*--- Retrieve solution at this node in current zone ---*/ for (iVar = 0; iVar < nVar_Turb; iVar++) { - U_Turb[iVar] = solver_container[ZONE_0][jInst][MESH_0][TURB_SOL]->node[iPoint]->GetSolution(iVar); + U_Turb[iVar] = solver_container[ZONE_0][jInst][MESH_0][TURB_SOL]->GetNodes()->GetSolution(iPoint, iVar); Source_Turb[iVar] += U_Turb[iVar]*D[iInst][jInst]; } } /*--- Store sources for current iZone ---*/ for (iVar = 0; iVar < nVar_Turb; iVar++) - solver_container[ZONE_0][iInst][MESH_0][TURB_SOL]->node[iPoint]->SetHarmonicBalance_Source(iVar, Source_Turb[iVar]); + solver_container[ZONE_0][iInst][MESH_0][TURB_SOL]->GetNodes()->SetHarmonicBalance_Source(iPoint, iVar, Source_Turb[iVar]); } delete [] U_Turb; @@ -4720,7 +4720,7 @@ void CHBDriver::StabilizeHarmonicBalance() { for (iPoint = 0; iPoint < geometry_container[ZONE_0][INST_0][iMGlevel]->GetnPoint(); iPoint++) { /*--- Get time step for current node ---*/ - Delta = solver_container[ZONE_0][INST_0][iMGlevel][FLOW_SOL]->node[iPoint]->GetDelta_Time(); + Delta = solver_container[ZONE_0][INST_0][iMGlevel][FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint); /*--- Setup stabilization matrix for this node ---*/ for (iInst = 0; iInst < nInstHB; iInst++) { @@ -4819,7 +4819,7 @@ void CHBDriver::StabilizeHarmonicBalance() { /*--- Get current source terms (not yet preconditioned) and zero source array to prepare preconditioning ---*/ for (iInst = 0; iInst < nInstHB; iInst++) { - Source_old[iInst] = solver_container[ZONE_0][iInst][iMGlevel][FLOW_SOL]->node[iPoint]->GetHarmonicBalance_Source(iVar); + Source_old[iInst] = solver_container[ZONE_0][iInst][iMGlevel][FLOW_SOL]->GetNodes()->GetHarmonicBalance_Source(iPoint, iVar); Source[iInst] = 0; } @@ -4831,10 +4831,10 @@ void CHBDriver::StabilizeHarmonicBalance() { /*--- Store updated source terms for current node ---*/ if (!adjoint) { - solver_container[ZONE_0][iInst][iMGlevel][FLOW_SOL]->node[iPoint]->SetHarmonicBalance_Source(iVar, Source[iInst]); + solver_container[ZONE_0][iInst][iMGlevel][FLOW_SOL]->GetNodes()->SetHarmonicBalance_Source(iPoint, iVar, Source[iInst]); } else { - solver_container[ZONE_0][iInst][iMGlevel][ADJFLOW_SOL]->node[iPoint]->SetHarmonicBalance_Source(iVar, Source[iInst]); + solver_container[ZONE_0][iInst][iMGlevel][ADJFLOW_SOL]->GetNodes()->SetHarmonicBalance_Source(iPoint, iVar, Source[iInst]); } } @@ -5323,13 +5323,11 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Push solution back to correct array ---*/ for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1(); - if (turbulent) { - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n1(); - } + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(); + if (turbulent) { + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(); } } } @@ -5342,11 +5340,9 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Push solution back to correct array ---*/ for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - if (turbulent) { - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - } + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + if (turbulent) { + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); } } } @@ -5367,11 +5363,9 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Temporarily store the loaded solution in the Solution_Old array ---*/ for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->Set_OldSolution(); - if (turbulent){ - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->Set_OldSolution(); - } + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->Set_OldSolution(); + if (turbulent){ + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->Set_OldSolution(); } } @@ -5379,9 +5373,9 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->SetSolution(solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_time_n()); + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint)); if (turbulent) { - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->SetSolution(solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->GetSolution_time_n()); + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->SetSolution(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n(iPoint)); } } } @@ -5389,9 +5383,9 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Set Solution at timestep n-1 to the previously loaded solution ---*/ for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_time_n1()); + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); if (turbulent) { - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->GetSolution_time_n1()); + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); } } } @@ -5400,18 +5394,18 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Set Solution at timestep n-1 to solution at n-2 ---*/ for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_time_n1()); + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); if (turbulent) { - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->GetSolution_time_n1()); + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); } } } /*--- Set Solution at timestep n-2 to the previously loaded solution ---*/ for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1(solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_Old()); + solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint)); if (turbulent) { - solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n1(solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->node[iPoint]->GetSolution_Old()); + solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][TURB_SOL]->GetNodes()->GetSolution_Old(iPoint)); } } } @@ -5428,12 +5422,12 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, for (iMesh=0; iMesh<=config_container[ZONE_FLOW]->GetnMGLevels();iMesh++) { for (iPoint = 0; iPoint < geometry_container[ZONE_FLOW][INST_0][iMesh]->GetnPoint(); iPoint++) { - solver_container[ZONE_FLOW][INST_0][iMesh][ADJFLOW_SOL]->node[iPoint]->SetSolution_Direct(solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->node[iPoint]->GetSolution()); + solver_container[ZONE_FLOW][INST_0][iMesh][ADJFLOW_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver_container[ZONE_FLOW][INST_0][iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint)); } } if (turbulent && !config_container[ZONE_FLOW]->GetFrozen_Visc_Disc()) { for (iPoint = 0; iPoint < geometry_container[ZONE_FLOW][INST_0][MESH_0]->GetnPoint(); iPoint++) { - solver_container[ZONE_FLOW][INST_0][MESH_0][ADJTURB_SOL]->node[iPoint]->SetSolution_Direct(solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->node[iPoint]->GetSolution()); + solver_container[ZONE_FLOW][INST_0][MESH_0][ADJTURB_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->GetNodes()->GetSolution(iPoint)); } } } @@ -5441,7 +5435,7 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Store geometry of the converged solution also in the adjoint solver in order to be able to reset it later ---*/ for (iPoint = 0; iPoint < geometry_container[ZONE_FLOW][INST_0][MESH_0]->GetnPoint(); iPoint++){ - solver_container[ZONE_FLOW][INST_0][MESH_0][ADJFLOW_SOL]->node[iPoint]->SetGeometry_Direct(geometry_container[ZONE_FLOW][INST_0][MESH_0]->node[iPoint]->GetCoord()); + solver_container[ZONE_FLOW][INST_0][MESH_0][ADJFLOW_SOL]->GetNodes()->SetGeometry_Direct(iPoint, geometry_container[ZONE_FLOW][INST_0][MESH_0]->node[iPoint]->GetCoord()); } } @@ -5471,21 +5465,15 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Push solution back to correct array ---*/ - for(iPoint=0; iPointGetnPoint();iPoint++){ - solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->node[iPoint]->Set_Solution_time_n(); - } + solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->GetNodes()->Set_Solution_time_n(); /*--- Push solution back to correct array ---*/ - for(iPoint=0; iPointGetnPoint();iPoint++){ - solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Accel_time_n(); - } + solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Accel_time_n(); /*--- Push solution back to correct array ---*/ - for(iPoint=0; iPointGetnPoint();iPoint++){ - solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Vel_time_n(); - } + solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Vel_time_n(); /*--- Load solution timestep n ---*/ @@ -5494,15 +5482,15 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Store FEA solution also in the adjoint solver in order to be able to reset it later ---*/ for (iPoint = 0; iPoint < geometry_container[ZONE_STRUCT][INST_0][MESH_0]->GetnPoint(); iPoint++){ - solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Direct(solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->node[iPoint]->GetSolution()); + solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint)); } for (iPoint = 0; iPoint < geometry_container[ZONE_STRUCT][INST_0][MESH_0]->GetnPoint(); iPoint++){ - solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Accel_Direct(solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Accel()); + solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Accel_Direct(iPoint, solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->GetNodes()->GetSolution_Accel(iPoint)); } for (iPoint = 0; iPoint < geometry_container[ZONE_STRUCT][INST_0][MESH_0]->GetnPoint(); iPoint++){ - solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Vel_Direct(solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Vel()); + solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Vel_Direct(iPoint, solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->GetNodes()->GetSolution_Vel(iPoint)); } } @@ -5513,7 +5501,7 @@ void CDiscAdjFSIDriver::Preprocess(unsigned short ZONE_FLOW, /*--- Store FEA solution also in the adjoint solver in order to be able to reset it later ---*/ for (iPoint = 0; iPoint < geometry_container[ZONE_STRUCT][INST_0][MESH_0]->GetnPoint(); iPoint++){ - solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Direct(solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->node[iPoint]->GetSolution()); + solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver_container[ZONE_STRUCT][INST_0][MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint)); } } @@ -6249,9 +6237,8 @@ bool CDiscAdjFSIDriver::CheckConvergence(unsigned long IntIter, unsigned short kind_recording){ bool flow_convergence = false, - struct_convergence = false; - - bool adjoint_convergence = false; + struct_convergence = false, + adjoint_convergence = false; // su2double residual_1, residual_2; diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index 4485732a3fa9..4b14df45f0fe 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -538,7 +538,7 @@ void CMultizoneDriver::DynamicMeshUpdate(unsigned long TimeIter) { void CMultizoneDriver::DynamicMeshUpdate(unsigned short val_iZone, unsigned long TimeIter) { /*--- Legacy dynamic mesh update - Only if GRID_MOVEMENT = YES ---*/ - if (config_container[ZONE_0]->GetGrid_Movement()) { + if (config_container[ZONE_0]->GetGrid_Movement() || config_container[ZONE_0]->GetSurface_Movement(FLUID_STRUCTURE_STATIC)) { iteration_container[val_iZone][INST_0]->SetGrid_Movement(geometry_container[val_iZone][INST_0],surface_movement[val_iZone], grid_movement[val_iZone][INST_0], solver_container[val_iZone][INST_0], config_container[val_iZone], 0, TimeIter); diff --git a/SU2_CFD/src/integration_structure.cpp b/SU2_CFD/src/integration_structure.cpp index 2fa8814dc77c..606c6ca7143a 100644 --- a/SU2_CFD/src/integration_structure.cpp +++ b/SU2_CFD/src/integration_structure.cpp @@ -311,8 +311,9 @@ void CIntegration::Adjoint_Setup(CGeometry ****geometry, CSolver *****solver_con if (iMGLevel != config[iZone]->GetnMGLevels()) { SetRestricted_Solution(RUNTIME_FLOW_SYS, solver_container[iZone][INST_0][iMGLevel][FLOW_SOL], solver_container[iZone][INST_0][iMGLevel+1][FLOW_SOL], geometry[iZone][INST_0][iMGLevel], geometry[iZone][INST_0][iMGLevel+1], config[iZone]); - SetRestricted_Gradient(RUNTIME_FLOW_SYS, solver_container[iZone][INST_0][iMGLevel][FLOW_SOL], solver_container[iZone][INST_0][iMGLevel+1][FLOW_SOL], - geometry[iZone][INST_0][iMGLevel], geometry[iZone][INST_0][iMGLevel+1], config[iZone]); +// ToDo: The flow solvers do not use the conservative variable gradients +// SetRestricted_Gradient(RUNTIME_FLOW_SYS, solver_container[iZone][INST_0][iMGLevel][FLOW_SOL], solver_container[iZone][INST_0][iMGLevel+1][FLOW_SOL], +// geometry[iZone][INST_0][iMGLevel], geometry[iZone][INST_0][iMGLevel+1], config[iZone]); } } @@ -441,12 +442,13 @@ void CIntegration::Time_Integration_FEM(CGeometry *geometry, CSolver **solver_co void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CConfig *config, unsigned short iMesh) { + unsigned long iPoint; - + + solver->GetNodes()->Set_Solution_time_n1(); + solver->GetNodes()->Set_Solution_time_n(); + for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - solver->node[iPoint]->Set_Solution_time_n1(); - solver->node[iPoint]->Set_Solution_time_n(); - geometry->node[iPoint]->SetVolume_nM1(); geometry->node[iPoint]->SetVolume_n(); @@ -529,36 +531,27 @@ void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CCon } void CIntegration::SetStructural_Solver(CGeometry *geometry, CSolver *solver, CConfig *config, unsigned short iMesh) { - - unsigned long iPoint; - - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - - solver->node[iPoint]->Set_Solution_time_n(); - solver->node[iPoint]->SetSolution_Vel_time_n(); - solver->node[iPoint]->SetSolution_Accel_time_n(); - - } - + + solver->GetNodes()->Set_Solution_time_n(); + solver->GetNodes()->SetSolution_Vel_time_n(); + solver->GetNodes()->SetSolution_Accel_time_n(); + bool fsi = config->GetFSI_Simulation(); - + /*--- If FSI problem, save the last Aitken relaxation parameter of the previous time step ---*/ - + if (fsi) { - + su2double WAitk=0.0; - + WAitk = solver->GetWAitken_Dyn(); solver->SetWAitken_Dyn_tn1(WAitk); - + } - - } void CIntegration::SetFEM_StructuralSolver(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) { - - unsigned long iPoint; + bool fsi = config->GetFSI_Simulation(); /*--- Update the solution according to the integration scheme used ---*/ @@ -575,25 +568,21 @@ void CIntegration::SetFEM_StructuralSolver(CGeometry *geometry, CSolver **solver solver_container[FEA_SOL]->GeneralizedAlpha_UpdateLoads(geometry, solver_container, config); break; } - + /*--- Store the solution at t+1 as solution at t, both for the local points and for the halo points ---*/ - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - - solver_container[FEA_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[FEA_SOL]->node[iPoint]->SetSolution_Vel_time_n(); - solver_container[FEA_SOL]->node[iPoint]->SetSolution_Accel_time_n(); - - } - + + solver_container[FEA_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[FEA_SOL]->GetNodes()->SetSolution_Vel_time_n(); + solver_container[FEA_SOL]->GetNodes()->SetSolution_Accel_time_n(); + /*--- If FSI problem, save the last Aitken relaxation parameter of the previous time step ---*/ - + if (fsi) { - + su2double WAitk=0.0; - + WAitk = solver_container[FEA_SOL]->GetWAitken_Dyn(); solver_container[FEA_SOL]->SetWAitken_Dyn_tn1(WAitk); - + } - } diff --git a/SU2_CFD/src/integration_time.cpp b/SU2_CFD/src/integration_time.cpp index 78b93d3fecc6..6f7602073fcd 100644 --- a/SU2_CFD/src/integration_time.cpp +++ b/SU2_CFD/src/integration_time.cpp @@ -254,18 +254,18 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) { Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren); Area_Children = geo_fine->node[Point_Fine]->GetVolume(); - Solution_Fine = sol_fine->node[Point_Fine]->GetSolution(); + Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] -= Solution_Fine[iVar]*Area_Children/Area_Parent; } - Solution_Coarse = sol_coarse->node[Point_Coarse]->GetSolution(); + Solution_Coarse = sol_coarse->GetNodes()->GetSolution(Point_Coarse); for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] += Solution_Coarse[iVar]; for (iVar = 0; iVar < nVar; iVar++) - sol_coarse->node[Point_Coarse]->SetSolution_Old(Solution); + sol_coarse->GetNodes()->SetSolution_Old(Point_Coarse,Solution); } @@ -284,7 +284,7 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS /*--- For dirichlet boundary condtions, set the correction to zero. Note that Solution_Old stores the correction not the actual value ---*/ - sol_coarse->node[Point_Coarse]->SetVelSolutionOldZero(); + sol_coarse->GetNodes()->SetVelSolutionOldZero(Point_Coarse); } @@ -299,7 +299,7 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) { Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren); - sol_fine->LinSysRes.SetBlock(Point_Fine, sol_coarse->node[Point_Coarse]->GetSolution_Old()); + sol_fine->LinSysRes.SetBlock(Point_Fine, sol_coarse->GetNodes()->GetSolution_Old(Point_Coarse)); } } @@ -321,14 +321,13 @@ void CMultiGridIntegration::SmoothProlongated_Correction (unsigned short RunTime for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { Residual_Old = solver->LinSysRes.GetBlock(iPoint); - solver->node[iPoint]->SetResidual_Old(Residual_Old); + solver->GetNodes()->SetResidual_Old(iPoint,Residual_Old); } /*--- Jacobi iterations ---*/ for (iSmooth = 0; iSmooth < val_nSmooth; iSmooth++) { - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) - solver->node[iPoint]->SetResidualSumZero(); + solver->GetNodes()->SetResidualSumZero(); /*--- Loop over Interior edges ---*/ @@ -341,16 +340,16 @@ void CMultiGridIntegration::SmoothProlongated_Correction (unsigned short RunTime /*--- Accumulate nearest neighbor Residual to Res_sum for each variable ---*/ - solver->node[iPoint]->AddResidual_Sum(Residual_j); - solver->node[jPoint]->AddResidual_Sum(Residual_i); + solver->GetNodes()->AddResidual_Sum(iPoint,Residual_j); + solver->GetNodes()->AddResidual_Sum(jPoint,Residual_i); } /*--- Loop over all mesh points (Update Residuals with averaged sum) ---*/ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { nneigh = geometry->node[iPoint]->GetnPoint(); - Residual_Sum = solver->node[iPoint]->GetResidual_Sum(); - Residual_Old = solver->node[iPoint]->GetResidual_Old(); + Residual_Sum = solver->GetNodes()->GetResidual_Sum(iPoint); + Residual_Old = solver->GetNodes()->GetResidual_Old(iPoint); for (iVar = 0; iVar < nVar; iVar++) { Residual[iVar] =(Residual_Old[iVar] + val_smooth_coeff*Residual_Sum[iVar]) /(1.0 + val_smooth_coeff*su2double(nneigh)); @@ -365,7 +364,7 @@ void CMultiGridIntegration::SmoothProlongated_Correction (unsigned short RunTime (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - Residual_Old = solver->node[iPoint]->GetResidual_Old(); + Residual_Old = solver->GetNodes()->GetResidual_Old(iPoint); solver->LinSysRes.SetBlock(iPoint, Residual_Old); } } @@ -389,15 +388,14 @@ void CMultiGridIntegration::Smooth_Solution(unsigned short RunTime_EqSystem, CSo Solution = new su2double [nVar]; for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - Solution_Old = solver->node[iPoint]->GetSolution(); - solver->node[iPoint]->SetResidual_Old(Solution_Old); + Solution_Old = solver->GetNodes()->GetSolution(iPoint); + solver->GetNodes()->SetResidual_Old(iPoint,Solution_Old); } /*--- Jacobi iterations ---*/ for (iSmooth = 0; iSmooth < val_nSmooth; iSmooth++) { - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) - solver->node[iPoint]->SetResidualSumZero(); + solver->GetNodes()->SetResidualSumZero(); /*--- Loop over Interior edges ---*/ @@ -405,26 +403,26 @@ void CMultiGridIntegration::Smooth_Solution(unsigned short RunTime_EqSystem, CSo iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Solution_i = solver->node[iPoint]->GetSolution(); - Solution_j = solver->node[jPoint]->GetSolution(); + Solution_i = solver->GetNodes()->GetSolution(iPoint); + Solution_j = solver->GetNodes()->GetSolution(jPoint); /*--- Accumulate nearest neighbor Residual to Res_sum for each variable ---*/ - solver->node[iPoint]->AddResidual_Sum(Solution_j); - solver->node[jPoint]->AddResidual_Sum(Solution_i); + solver->GetNodes()->AddResidual_Sum(iPoint,Solution_j); + solver->GetNodes()->AddResidual_Sum(jPoint,Solution_i); } /*--- Loop over all mesh points (Update Residuals with averaged sum) ---*/ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { nneigh = geometry->node[iPoint]->GetnPoint(); - Solution_Sum = solver->node[iPoint]->GetResidual_Sum(); - Solution_Old = solver->node[iPoint]->GetResidual_Old(); + Solution_Sum = solver->GetNodes()->GetResidual_Sum(iPoint); + Solution_Old = solver->GetNodes()->GetResidual_Old(iPoint); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] =(Solution_Old[iVar] + val_smooth_coeff*Solution_Sum[iVar]) /(1.0 + val_smooth_coeff*su2double(nneigh)); } - solver->node[iPoint]->SetSolution(Solution); + solver->GetNodes()->SetSolution(iPoint,Solution); } /*--- Copy boundary values ---*/ @@ -434,8 +432,8 @@ void CMultiGridIntegration::Smooth_Solution(unsigned short RunTime_EqSystem, CSo (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - Solution_Old = solver->node[iPoint]->GetResidual_Old(); - solver->node[iPoint]->SetSolution(Solution_Old); + Solution_Old = solver->GetNodes()->GetResidual_Old(iPoint); + solver->GetNodes()->SetSolution(iPoint,Solution_Old); } } } @@ -458,13 +456,13 @@ void CMultiGridIntegration::SetProlongated_Correction(CSolver *sol_fine, CGeomet for (Point_Fine = 0; Point_Fine < geo_fine->GetnPointDomain(); Point_Fine++) { Residual_Fine = sol_fine->LinSysRes.GetBlock(Point_Fine); - Solution_Fine = sol_fine->node[Point_Fine]->GetSolution(); + Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { /*--- Prevent a fine grid divergence due to a coarse grid divergence ---*/ if (Residual_Fine[iVar] != Residual_Fine[iVar]) Residual_Fine[iVar] = 0.0; Solution[iVar] = Solution_Fine[iVar]+factor*Residual_Fine[iVar]; } - sol_fine->node[Point_Fine]->SetSolution(Solution); + sol_fine->GetNodes()->SetSolution(Point_Fine,Solution); } /*--- MPI the new interpolated solution ---*/ @@ -483,7 +481,7 @@ void CMultiGridIntegration::SetProlongated_Solution(unsigned short RunTime_EqSys for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) { Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren); - sol_fine->node[Point_Fine]->SetSolution(sol_coarse->node[Point_Coarse]->GetSolution()); + sol_fine->GetNodes()->SetSolution(Point_Fine, sol_coarse->GetNodes()->GetSolution(Point_Coarse)); } } } @@ -499,7 +497,7 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar su2double *Residual = new su2double[nVar]; for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { - sol_coarse->node[Point_Coarse]->SetRes_TruncErrorZero(); + sol_coarse->GetNodes()->SetRes_TruncErrorZero(Point_Coarse); for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) { @@ -508,7 +506,7 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] += factor*Residual_Fine[iVar]; } - sol_coarse->node[Point_Coarse]->AddRes_TruncError(Residual); + sol_coarse->GetNodes()->AddRes_TruncError(Point_Coarse,Residual); } for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { @@ -517,13 +515,13 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar (config->GetMarker_All_KindBC(iMarker) == CHT_WALL_INTERFACE )) { for (iVertex = 0; iVertex < geo_coarse->nVertex[iMarker]; iVertex++) { Point_Coarse = geo_coarse->vertex[iMarker][iVertex]->GetNode(); - sol_coarse->node[Point_Coarse]->SetVel_ResTruncError_Zero(); + sol_coarse->GetNodes()->SetVel_ResTruncError_Zero(Point_Coarse); } } } for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { - sol_coarse->node[Point_Coarse]->SubtractRes_TruncError(sol_coarse->LinSysRes.GetBlock(Point_Coarse)); + sol_coarse->GetNodes()->SubtractRes_TruncError(Point_Coarse, sol_coarse->LinSysRes.GetBlock(Point_Coarse)); } delete [] Residual; @@ -533,7 +531,7 @@ void CMultiGridIntegration::SetResidual_Term(CGeometry *geometry, CSolver *solve unsigned long iPoint; for (iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++) - solver->LinSysRes.AddBlock(iPoint, solver->node[iPoint]->GetResTruncError()); + solver->LinSysRes.AddBlock(iPoint, solver->GetNodes()->GetResTruncError(iPoint)); } @@ -547,7 +545,7 @@ void CMultiGridIntegration::SetRestricted_Residual(CSolver *sol_fine, CSolver *s su2double *Residual = new su2double[nVar]; for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { - sol_coarse->node[Point_Coarse]->SetRes_TruncErrorZero(); + sol_coarse->GetNodes()->SetRes_TruncErrorZero(Point_Coarse); for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) { @@ -556,7 +554,7 @@ void CMultiGridIntegration::SetRestricted_Residual(CSolver *sol_fine, CSolver *s for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] += Residual_Fine[iVar]; } - sol_coarse->node[Point_Coarse]->AddRes_TruncError(Residual); + sol_coarse->GetNodes()->AddRes_TruncError(Point_Coarse,Residual); } for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { @@ -565,7 +563,7 @@ void CMultiGridIntegration::SetRestricted_Residual(CSolver *sol_fine, CSolver *s (config->GetMarker_All_KindBC(iMarker) == CHT_WALL_INTERFACE )) { for (iVertex = 0; iVertexnVertex[iMarker]; iVertex++) { Point_Coarse = geo_coarse->vertex[iMarker][iVertex]->GetNode(); - sol_coarse->node[Point_Coarse]->SetVel_ResTruncError_Zero(); + sol_coarse->GetNodes()->SetVel_ResTruncError_Zero(Point_Coarse); } } } @@ -596,13 +594,13 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren); Area_Children = geo_fine->node[Point_Fine]->GetVolume(); - Solution_Fine = sol_fine->node[Point_Fine]->GetSolution(); + Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - sol_coarse->node[Point_Coarse]->SetSolution(Solution); + sol_coarse->GetNodes()->SetSolution(Point_Coarse,Solution); } @@ -623,19 +621,19 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst if (grid_movement) { Grid_Vel = geo_coarse->node[Point_Coarse]->GetGridVel(); for (iDim = 0; iDim < nDim; iDim++) - Vector[iDim] = sol_coarse->node[Point_Coarse]->GetSolution(0)*Grid_Vel[iDim]; - sol_coarse->node[Point_Coarse]->SetVelSolutionVector(Vector); + Vector[iDim] = sol_coarse->GetNodes()->GetSolution(Point_Coarse,0)*Grid_Vel[iDim]; + sol_coarse->GetNodes()->SetVelSolutionVector(Point_Coarse,Vector); } else { /*--- For stationary no-slip walls, set the velocity to zero. ---*/ - sol_coarse->node[Point_Coarse]->SetVelSolutionZero(); + sol_coarse->GetNodes()->SetVelSolutionZero(Point_Coarse); } } if (SolContainer_Position == ADJFLOW_SOL) { - sol_coarse->node[Point_Coarse]->SetVelSolutionDVector(); + sol_coarse->GetNodes()->SetVelSolutionDVector(Point_Coarse); } } @@ -674,13 +672,13 @@ void CMultiGridIntegration::SetRestricted_Gradient(unsigned short RunTime_EqSyst for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) { Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren); Area_Children = geo_fine->node[Point_Fine]->GetVolume(); - Gradient_fine = sol_fine->node[Point_Fine]->GetGradient(); + Gradient_fine = sol_fine->GetNodes()->GetGradient(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) for (iDim = 0; iDim < nDim; iDim++) Gradient[iVar][iDim] += Gradient_fine[iVar][iDim]*Area_Children/Area_Parent; } - sol_coarse->node[Point_Coarse]->SetGradient(Gradient); + sol_coarse->GetNodes()->SetGradient(Point_Coarse,Gradient); } for (iVar = 0; iVar < nVar; iVar++) @@ -800,12 +798,12 @@ void CSingleGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSys Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren); Area_Children = geo_fine->node[Point_Fine]->GetVolume(); - Solution_Fine = sol_fine->node[Point_Fine]->GetSolution(); + Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } - sol_coarse->node[Point_Coarse]->SetSolution(Solution); + sol_coarse->GetNodes()->SetSolution(Point_Coarse,Solution); } @@ -834,11 +832,11 @@ void CSingleGridIntegration::SetRestricted_EddyVisc(unsigned short RunTime_EqSys for (iChildren = 0; iChildren < geo_coarse->node[Point_Coarse]->GetnChildren_CV(); iChildren++) { Point_Fine = geo_coarse->node[Point_Coarse]->GetChildren_CV(iChildren); Area_Children = geo_fine->node[Point_Fine]->GetVolume(); - EddyVisc_Fine = sol_fine->node[Point_Fine]->GetmuT(); + EddyVisc_Fine = sol_fine->GetNodes()->GetmuT(Point_Fine); EddyVisc += EddyVisc_Fine*Area_Children/Area_Parent; } - sol_coarse->node[Point_Coarse]->SetmuT(EddyVisc); + sol_coarse->GetNodes()->SetmuT(Point_Coarse,EddyVisc); } @@ -852,7 +850,7 @@ void CSingleGridIntegration::SetRestricted_EddyVisc(unsigned short RunTime_EqSys (config->GetMarker_All_KindBC(iMarker) == CHT_WALL_INTERFACE )) { for (iVertex = 0; iVertex < geo_coarse->nVertex[iMarker]; iVertex++) { Point_Coarse = geo_coarse->vertex[iMarker][iVertex]->GetNode(); - sol_coarse->node[Point_Coarse]->SetmuT(0); + sol_coarse->GetNodes()->SetmuT(Point_Coarse,0.0); } } } diff --git a/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp b/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp index 91804d930309..aeece59b71e0 100644 --- a/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp +++ b/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp @@ -65,7 +65,7 @@ void CConservativeVarsInterface::GetDonor_Variable(CSolver *donor_solution, CGeo unsigned short iVar; /*--- Retrieve solution and set it as the donor variable ---*/ - Solution = donor_solution->node[Point_Donor]->GetSolution(); + Solution = donor_solution->GetNodes()->GetSolution(Point_Donor); for (iVar = 0; iVar < nVar; iVar++) Donor_Variable[iVar] = Solution[iVar]; @@ -76,6 +76,6 @@ void CConservativeVarsInterface::SetTarget_Variable(CSolver *target_solution, CG unsigned long Vertex_Target, unsigned long Point_Target) { /*--- Set the target solution with the value of the Target Variable ---*/ - target_solution->node[Point_Target]->SetSolution(Target_Variable); + target_solution->GetNodes()->SetSolution(Point_Target,Target_Variable); } diff --git a/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp b/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp index e73596ddaa74..20b3671549be 100644 --- a/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp +++ b/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp @@ -99,14 +99,14 @@ void CSlidingInterface::GetDonor_Variable(CSolver *donor_solution, CGeometry *do if (turbulent){ /*--- for turbulent solver retrieve solution and set it as the donor variable ---*/ - Donor_Variable[0] = donor_solution->node[Point_Donor]->GetSolution(0); - Donor_Variable[1] = donor_solution->node[Point_Donor]->GetSolution(1); + Donor_Variable[0] = donor_solution->GetNodes()->GetSolution(Point_Donor,0); + Donor_Variable[1] = donor_solution->GetNodes()->GetSolution(Point_Donor,1); } else{ /*--- Retrieve primitive variables and set them as the donor variables ---*/ for (iVar = 0; iVar < nDonorVar; iVar++) - Donor_Variable[iVar] = donor_solution->node[Point_Donor]->GetPrimitive(iVar); + Donor_Variable[iVar] = donor_solution->GetNodes()->GetPrimitive(Point_Donor,iVar); } } diff --git a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp index 2f0a0e16a88e..bfd7cfe8874e 100644 --- a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp +++ b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp @@ -54,8 +54,8 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet su2double *Coord, *Coord_Normal, *Normal, *Edge_Vector, dist, dist2, Area, Twall, Tnormal, dTdn, rho_cp_solid, Prandtl_Lam, laminar_viscosity, - thermal_diffusivity, thermal_conductivity, thermal_conductivityND, - heat_flux_density, conductivity_over_dist; + thermal_diffusivity, thermal_conductivity=0.0, thermal_conductivityND, + heat_flux_density=0.0, conductivity_over_dist=0.0; nDim = donor_geometry->GetnDim(); @@ -97,22 +97,21 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet if (compressible_flow) { - Twall = donor_solution->node[Point_Donor]->GetPrimitive(0); - Tnormal = donor_solution->node[PointNormal]->GetPrimitive(0); + Twall = donor_solution->GetNodes()->GetPrimitive(Point_Donor,0); + Tnormal = donor_solution->GetNodes()->GetPrimitive(PointNormal,0); dTdn = (Twall - Tnormal)/dist; } else if (incompressible_flow) { - Twall = donor_solution->node[Point_Donor]->GetTemperature(); - Tnormal = donor_solution->node[PointNormal]->GetTemperature(); + Twall = donor_solution->GetNodes()->GetTemperature(Point_Donor); + Tnormal = donor_solution->GetNodes()->GetTemperature(PointNormal); dTdn = (Twall - Tnormal)/dist; } else if (heat_equation) { - - Twall = donor_solution->node[Point_Donor]->GetSolution(0); - Tnormal = donor_solution->node[PointNormal]->GetSolution(0); + Twall = donor_solution->GetNodes()->GetSolution(Point_Donor,0); + Tnormal = donor_solution->GetNodes()->GetSolution(PointNormal,0); // TODO: Check if these improve accuracy, if needed at all // for (iDim = 0; iDim < nDim; iDim++) { @@ -135,7 +134,7 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet su2double Cp = (Gamma / (Gamma - 1.0)) * Gas_Constant; Prandtl_Lam = donor_config->GetPrandtl_Lam(); - laminar_viscosity = donor_solution->node[Point_Donor]->GetLaminarViscosity(); // TDE check for consistency + laminar_viscosity = donor_solution->GetNodes()->GetLaminarViscosity(Point_Donor); // TDE check for consistency Cp = (Gamma / (Gamma - 1.0)) * Gas_Constant; thermal_conductivityND = Cp*(laminar_viscosity/Prandtl_Lam); @@ -149,7 +148,9 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet } else if (incompressible_flow) { - thermal_conductivityND = donor_solution->node[iPoint]->GetThermalConductivity(); + iPoint = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNode(); + + thermal_conductivityND = donor_solution->GetNodes()->GetThermalConductivity(iPoint); heat_flux_density = thermal_conductivityND*dTdn; if (donor_config->GetCHT_Robin()) { diff --git a/SU2_CFD/src/interfaces/fsi/CDiscAdjDisplacementsInterfaceLegacy.cpp b/SU2_CFD/src/interfaces/fsi/CDiscAdjDisplacementsInterfaceLegacy.cpp index d3090df53ada..e135e6c2ba76 100644 --- a/SU2_CFD/src/interfaces/fsi/CDiscAdjDisplacementsInterfaceLegacy.cpp +++ b/SU2_CFD/src/interfaces/fsi/CDiscAdjDisplacementsInterfaceLegacy.cpp @@ -78,7 +78,7 @@ void CDiscAdjDisplacementsInterfaceLegacy::GetDonor_Variable(CSolver *struct_sol Coord_Struct = struct_geometry->node[Point_Struct]->GetCoord(); /*--- The displacements come from the predicted solution ---*/ - Displacement_Struct = struct_solution->node[Point_Struct]->GetSolution(); + Displacement_Struct = struct_solution->GetNodes()->GetSolution(Point_Struct); for (iVar = 0; iVar < nVar; iVar++) Donor_Variable[iVar] = Coord_Struct[iVar] + Displacement_Struct[iVar]; diff --git a/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp b/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp index 237bf18c8580..0d13487004a4 100644 --- a/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp +++ b/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp @@ -58,8 +58,7 @@ void CDiscAdjFlowTractionInterface::GetPhysical_Constants(CSolver *flow_solution /*--- We have to clear the traction before applying it, because we are "adding" to node and not "setting" ---*/ - for (unsigned long iPoint = 0; iPoint < struct_geometry->GetnPoint(); iPoint++) - struct_solution->node[iPoint]->Clear_FlowTraction(); + struct_solution->GetNodes()->Clear_FlowTraction(); Preprocess(flow_config); diff --git a/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp b/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp index d46c272b215d..b08f240b7234 100644 --- a/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp +++ b/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp @@ -62,7 +62,7 @@ void CDisplacementsInterface::GetDonor_Variable(CSolver *struct_solution, CGeome unsigned short iVar; /*--- The displacements come from the predicted solution, but they are no longer incremental ---*/ - DisplacementDonor = struct_solution->node[Point_Struct]->GetSolution_Pred(); + DisplacementDonor = struct_solution->GetNodes()->GetSolution_Pred(Point_Struct); for (iVar = 0; iVar < nVar; iVar++) Donor_Variable[iVar] = DisplacementDonor[iVar]; @@ -75,6 +75,6 @@ void CDisplacementsInterface::SetTarget_Variable(CSolver *mesh_solver, CGeometry /*--- Impose the boundary displacements ---*/ - mesh_solver->node[Point_Mesh]->SetBound_Disp(Target_Variable); + mesh_solver->GetNodes()->SetBound_Disp(Point_Mesh,Target_Variable); } diff --git a/SU2_CFD/src/interfaces/fsi/CDisplacementsInterfaceLegacy.cpp b/SU2_CFD/src/interfaces/fsi/CDisplacementsInterfaceLegacy.cpp index 469e389fbb86..3d81f1911cba 100644 --- a/SU2_CFD/src/interfaces/fsi/CDisplacementsInterfaceLegacy.cpp +++ b/SU2_CFD/src/interfaces/fsi/CDisplacementsInterfaceLegacy.cpp @@ -66,9 +66,9 @@ void CDisplacementsInterfaceLegacy::GetDonor_Variable(CSolver *struct_solution, unsigned short iVar; /*--- The displacements come from the predicted solution ---*/ - DisplacementDonor = struct_solution->node[Point_Struct]->GetSolution_Pred(); + DisplacementDonor = struct_solution->GetNodes()->GetSolution_Pred(Point_Struct); - DisplacementDonor_Prev = struct_solution->node[Point_Struct]->GetSolution_Pred_Old(); + DisplacementDonor_Prev = struct_solution->GetNodes()->GetSolution_Pred_Old(Point_Struct); for (iVar = 0; iVar < nVar; iVar++) Donor_Variable[iVar] = DisplacementDonor[iVar] - DisplacementDonor_Prev[iVar]; diff --git a/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp b/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp index d240d4f95771..513e9ddf30ff 100644 --- a/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp +++ b/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp @@ -84,8 +84,7 @@ void CFlowTractionInterface::GetPhysical_Constants(CSolver *flow_solution, CSolv /*--- We have to clear the traction before applying it, because we are "adding" to node and not "setting" ---*/ - for (unsigned long iPoint = 0; iPoint < struct_geometry->GetnPoint(); iPoint++) - struct_solution->node[iPoint]->Clear_FlowTraction(); + struct_solution->GetNodes()->Clear_FlowTraction(); Preprocess(flow_config); @@ -164,7 +163,7 @@ void CFlowTractionInterface::GetDonor_Variable(CSolver *flow_solution, CGeometry // Retrieve the values of pressure - Pn = flow_solution->node[Point_Flow]->GetPressure(); + Pn = flow_solution->GetNodes()->GetPressure(Point_Flow); // Calculate tn in the fluid nodes for the inviscid term --> Units of force (non-dimensional). for (iVar = 0; iVar < nVar; iVar++) @@ -174,11 +173,11 @@ void CFlowTractionInterface::GetDonor_Variable(CSolver *flow_solution, CGeometry if ((incompressible || compressible) && viscous_flow) { - Viscosity = flow_solution->node[Point_Flow]->GetLaminarViscosity(); + Viscosity = flow_solution->GetNodes()->GetLaminarViscosity(Point_Flow); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0 ; jVar < nVar; jVar++) { - Grad_Vel[iVar][jVar] = flow_solution->node[Point_Flow]->GetGradient_Primitive(iVar+1, jVar); + Grad_Vel[iVar][jVar] = flow_solution->GetNodes()->GetGradient_Primitive(Point_Flow, iVar+1, jVar); } } @@ -212,6 +211,6 @@ void CFlowTractionInterface::SetTarget_Variable(CSolver *fea_solution, CGeometry /*--- Add to the Flow traction. If nonconservative interpolation is in use, this is a stress and is integrated by the structural solver later on. ---*/ - fea_solution->node[Point_Struct]->Add_FlowTraction(Target_Variable); + fea_solution->GetNodes()->Add_FlowTraction(Point_Struct,Target_Variable); } diff --git a/SU2_CFD/src/iteration_structure.cpp b/SU2_CFD/src/iteration_structure.cpp index 9ec7e4092ba1..41e56f75383e 100644 --- a/SU2_CFD/src/iteration_structure.cpp +++ b/SU2_CFD/src/iteration_structure.cpp @@ -69,7 +69,7 @@ void CIteration::SetGrid_Movement(CGeometry **geometry, bool Screen_Output = config->GetDeform_Output(); unsigned short val_iZone = config->GetiZone(); - + /*--- Perform mesh movement depending on specified type ---*/ switch (Kind_Grid_Movement) { @@ -99,10 +99,9 @@ void CIteration::SetGrid_Movement(CGeometry **geometry, break; - /*--- Already initialized in the static mesh movement routine at driver level. ---*/ - case STEADY_TRANSLATION: case ROTATING_FRAME: - break; + case STEADY_TRANSLATION: case ROTATING_FRAME: + break; } @@ -280,8 +279,7 @@ void CIteration::SetGrid_Movement(CGeometry **geometry, if ((rank == MASTER_NODE) && (!discrete_adjoint)&& Screen_Output) cout << "Deforming the volume grid." << endl; - grid_movement->SetVolume_Deformation_Elas(geometry[MESH_0], - config, true, false); + grid_movement->SetVolume_Deformation_Elas(geometry[MESH_0], config, true, false); if ((rank == MASTER_NODE) && (!discrete_adjoint)&& Screen_Output) cout << "There is no grid velocity." << endl; @@ -979,8 +977,8 @@ void CFluidIteration::SetWind_GustField(CConfig *config, CGeometry **geometry, C GustDer[1] = dgust_dy; GustDer[2] = dgust_dt; - solver[iMGlevel][FLOW_SOL]->node[iPoint]->SetWindGust(Gust); - solver[iMGlevel][FLOW_SOL]->node[iPoint]->SetWindGustDer(GustDer); + solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGust(iPoint, Gust); + solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGustDer(iPoint, GustDer); GridVel = geometry[iMGlevel]->node[iPoint]->GetGridVel(); @@ -2032,21 +2030,21 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output, /*--- Push solution back to correct array ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1(); - if (grid_IsMoving) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(); + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(); + } + if (grid_IsMoving) { + for(iPoint=0; iPointGetnPoint();iPoint++) { geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n(); geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n1(); } - if (turbulent) { - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n1(); - } - if (heat) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(); - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n1(); - } } } } @@ -2058,17 +2056,17 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output, /*--- Push solution back to correct array ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - if (grid_IsMoving) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + } + if (grid_IsMoving) { + for(iPoint=0; iPointGetnPoint();iPoint++) { geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n(); } - if (turbulent) { - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - } - if (heat) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(); - } } } } @@ -2097,17 +2095,17 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output, /*--- Temporarily store the loaded solution in the Solution_Old array ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_OldSolution(); - if (grid_IsMoving) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_OldSolution(); + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_OldSolution(); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_OldSolution(); + } + if (grid_IsMoving) { + for(iPoint=0; iPointGetnPoint();iPoint++) { geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_Old(); } - if (turbulent){ - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_OldSolution(); - } - if (heat){ - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_OldSolution(); - } } } @@ -2115,15 +2113,16 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output, for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->SetSolution(solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_time_n()); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint)); + if (grid_IsMoving) { geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_n()); } if (turbulent) { - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->SetSolution(solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->GetSolution_time_n()); + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n(iPoint)); } if (heat) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->SetSolution(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_time_n()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n(iPoint)); } } } @@ -2131,15 +2130,16 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output, /*--- Set Solution at timestep n-1 to the previously loaded solution ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_Old()); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint)); + if (grid_IsMoving) { geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_Old()); } if (turbulent) { - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->GetSolution_Old()); + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_Old(iPoint)); } if (heat) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_Old()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_Old(iPoint)); } } } @@ -2148,30 +2148,32 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output, /*--- Set Solution at timestep n-1 to solution at n-2 ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_time_n1()); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); + if (grid_IsMoving) { geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_n1()); } if (turbulent) { - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->GetSolution_time_n1()); + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); } if (heat) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_time_n1()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); } } } /*--- Set Solution at timestep n-2 to the previously loaded solution ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1(solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->GetSolution_Old()); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint)); + if (grid_IsMoving) { geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->SetCoord_n1(geometry[val_iZone][val_iInst][iMesh]->node[iPoint]->GetCoord_Old()); } if (turbulent) { - solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n1(solver[val_iZone][val_iInst][iMesh][TURB_SOL]->node[iPoint]->GetSolution_Old()); + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_Old(iPoint)); } if (heat) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n1(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_Old()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_Old(iPoint)); } } } @@ -2191,17 +2193,17 @@ void CDiscAdjFluidIteration::Preprocess(COutput *output, if (TimeIter == 0 || dual_time) { for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][iMesh]->GetnPoint(); iPoint++) { - solver[val_iZone][val_iInst][iMesh][ADJFLOW_SOL]->node[iPoint]->SetSolution_Direct(solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->node[iPoint]->GetSolution()); + solver[val_iZone][val_iInst][iMesh][ADJFLOW_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint)); } } if (turbulent && !config[val_iZone]->GetFrozen_Visc_Disc()) { for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++) { - solver[val_iZone][val_iInst][MESH_0][ADJTURB_SOL]->node[iPoint]->SetSolution_Direct(solver[val_iZone][val_iInst][MESH_0][TURB_SOL]->node[iPoint]->GetSolution()); + solver[val_iZone][val_iInst][MESH_0][ADJTURB_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][TURB_SOL]->GetNodes()->GetSolution(iPoint)); } } if (heat) { for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++) { - solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->node[iPoint]->SetSolution_Direct(solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->node[iPoint]->GetSolution()); + solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->GetNodes()->GetSolution(iPoint)); } } } @@ -2656,21 +2658,15 @@ void CDiscAdjFEAIteration::Preprocess(COutput *output, /*--- Push solution back to correct array ---*/ - for(iPoint=0; iPointGetnPoint();iPoint++){ - solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->Set_Solution_time_n(); - } + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->Set_Solution_time_n(); /*--- Push solution back to correct array ---*/ - for(iPoint=0; iPointGetnPoint();iPoint++){ - solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Accel_time_n(); - } + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Accel_time_n(); /*--- Push solution back to correct array ---*/ - for(iPoint=0; iPointGetnPoint();iPoint++){ - solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Vel_time_n(); - } + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Vel_time_n(); /*--- Load solution timestep n ---*/ @@ -2679,15 +2675,15 @@ void CDiscAdjFEAIteration::Preprocess(COutput *output, /*--- Store FEA solution also in the adjoint solver in order to be able to reset it later ---*/ for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ - solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Direct(solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->GetSolution()); + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint)); } for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ - solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Accel_Direct(solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Accel()); + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Accel_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution_Accel(iPoint)); } for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ - solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Vel_Direct(solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Vel()); + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Vel_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution_Vel(iPoint)); } } @@ -2695,7 +2691,7 @@ void CDiscAdjFEAIteration::Preprocess(COutput *output, /*--- Store FEA solution also in the adjoint solver in order to be able to reset it later ---*/ for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ - solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->node[iPoint]->SetSolution_Direct(solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->GetSolution()); + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint)); } } @@ -2727,9 +2723,9 @@ void CDiscAdjFEAIteration::LoadDynamic_Solution(CGeometry ****geometry, /*--- Push solution back to correct array ---*/ for(iPoint=0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint();iPoint++){ for (iVar = 0; iVar < solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetnVar(); iVar++){ - solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->SetSolution(iVar, 0.0); - solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Accel(iVar, 0.0); - solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Vel(iVar, 0.0); + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution(iPoint, iVar, 0.0); + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Accel(iPoint, iVar, 0.0); + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Vel(iPoint, iVar, 0.0); } } } @@ -3253,11 +3249,8 @@ void CDiscAdjHeatIteration::Preprocess(COutput *output, /*--- Push solution back to correct array ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(); - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n1(); - } + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(); } } if (dual_time) { @@ -3269,10 +3262,7 @@ void CDiscAdjHeatIteration::Preprocess(COutput *output, /*--- Push solution back to correct array ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(); - } + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); } } @@ -3291,19 +3281,15 @@ void CDiscAdjHeatIteration::Preprocess(COutput *output, /*--- Temporarily store the loaded solution in the Solution_Old array ---*/ - for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { - for(iPoint=0; iPointGetnPoint();iPoint++) { - - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_OldSolution(); - } - } + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_OldSolution(); /*--- Set Solution at timestep n to solution at n-1 ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->SetSolution(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_time_n()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n(iPoint)); } } if (dual_time_1st){ @@ -3311,7 +3297,7 @@ void CDiscAdjHeatIteration::Preprocess(COutput *output, for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_time_n1()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); } } } @@ -3320,14 +3306,14 @@ void CDiscAdjHeatIteration::Preprocess(COutput *output, for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_time_n1()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); } } /*--- Set Solution at timestep n-2 to the previously loaded solution ---*/ for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { for(iPoint=0; iPointGetnPoint();iPoint++) { - solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n1(solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->node[iPoint]->GetSolution_Old()); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_Old(iPoint)); } } } @@ -3338,7 +3324,7 @@ void CDiscAdjHeatIteration::Preprocess(COutput *output, if (TimeIter == 0 || dual_time) { for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++) { - solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->node[iPoint]->SetSolution_Direct(solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->node[iPoint]->GetSolution()); + solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->GetNodes()->GetSolution(iPoint)); } } diff --git a/SU2_CFD/src/meson.build b/SU2_CFD/src/meson.build index 58e2c341bde1..298d2d1489b2 100644 --- a/SU2_CFD/src/meson.build +++ b/SU2_CFD/src/meson.build @@ -76,10 +76,8 @@ su2_cfd_src += files(['variables/CIncNSVariable.cpp', 'variables/CBaselineVariable.cpp', 'variables/CDiscAdjFEAVariable.cpp', 'variables/CDiscAdjFEABoundVariable.cpp', - 'variables/CDiscAdjMeshVariable.cpp', 'variables/CDiscAdjMeshBoundVariable.cpp', 'variables/CFEABoundVariable.cpp', - 'variables/CFEAFSIBoundVariable.cpp', 'variables/CDiscAdjVariable.cpp', 'variables/CTurbSAVariable.cpp', 'variables/CFEAVariable.cpp', diff --git a/SU2_CFD/src/numerics_direct_mean.cpp b/SU2_CFD/src/numerics_direct_mean.cpp index 7511b4961d2b..a76e150de33a 100644 --- a/SU2_CFD/src/numerics_direct_mean.cpp +++ b/SU2_CFD/src/numerics_direct_mean.cpp @@ -1044,6 +1044,9 @@ CUpwAUSMPLUSUP_Flow::CUpwAUSMPLUSUP_Flow(unsigned short val_nDim, unsigned short Kp = 0.25; Ku = 0.75; sigma = 1.0; + + if (Minf < EPS) + SU2_MPI::Error("AUSM+Up requires a reference Mach number (\"MACH_NUMBER\") greater than 0.", CURRENT_FUNCTION); } CUpwAUSMPLUSUP_Flow::~CUpwAUSMPLUSUP_Flow(void) { @@ -1269,6 +1272,9 @@ CUpwAUSMPLUSUP2_Flow::CUpwAUSMPLUSUP2_Flow(unsigned short val_nDim, unsigned sho Minf = config->GetMach(); Kp = 0.25; sigma = 1.0; + + if (Minf < EPS) + SU2_MPI::Error("AUSM+Up2 requires a reference Mach number (\"MACH_NUMBER\") greater than 0.", CURRENT_FUNCTION); } CUpwAUSMPLUSUP2_Flow::~CUpwAUSMPLUSUP2_Flow(void) { diff --git a/SU2_CFD/src/output/CAdjElasticityOutput.cpp b/SU2_CFD/src/output/CAdjElasticityOutput.cpp index 3f44b4eeb48d..62470f03c9e9 100644 --- a/SU2_CFD/src/output/CAdjElasticityOutput.cpp +++ b/SU2_CFD/src/output/CAdjElasticityOutput.cpp @@ -147,7 +147,7 @@ inline void CAdjElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *ge void CAdjElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_Struc = solver[FEA_SOL]->node[iPoint]; + CVariable* Node_Struc = solver[FEA_SOL]->GetNodes(); CPoint* Node_Geo = geometry->node[iPoint]; SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); @@ -155,9 +155,9 @@ void CAdjElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_Struc->GetSolution(0)); - SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_Struc->GetSolution(1)); - if (nDim == 3) SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_Struc->GetSolution(2)); + SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_Struc->GetSolution(iPoint, 0)); + SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_Struc->GetSolution(iPoint, 1)); + if (nDim == 3) SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_Struc->GetSolution(iPoint, 2)); } diff --git a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp index aee945be59d1..a6859b69ae47 100644 --- a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp @@ -366,14 +366,14 @@ void CAdjFlowCompOutput::SetVolumeOutputFields(CConfig *config){ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->node[iPoint]; + CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->GetNodes(); CVariable* Node_AdjTurb = NULL; CPoint* Node_Geo = geometry->node[iPoint]; if (config->GetKind_Turb_Model() != NONE && ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj))){ - Node_AdjTurb = solver[ADJTURB_SOL]->node[iPoint]; + Node_AdjTurb = solver[ADJTURB_SOL]->GetNodes(); } SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); @@ -381,26 +381,26 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - SetVolumeOutputValue("ADJ_DENSITY", iPoint, Node_AdjFlow->GetSolution(0)); - SetVolumeOutputValue("ADJ_MOMENTUM-X", iPoint, Node_AdjFlow->GetSolution(1)); - SetVolumeOutputValue("ADJ_MOMENTUM-Y", iPoint, Node_AdjFlow->GetSolution(2)); + SetVolumeOutputValue("ADJ_DENSITY", iPoint, Node_AdjFlow->GetSolution(iPoint, 0)); + SetVolumeOutputValue("ADJ_MOMENTUM-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1)); + SetVolumeOutputValue("ADJ_MOMENTUM-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("ADJ_MOMENTUM-Z", iPoint, Node_AdjFlow->GetSolution(3)); - SetVolumeOutputValue("ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(4)); + SetVolumeOutputValue("ADJ_MOMENTUM-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); + SetVolumeOutputValue("ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); } else { - SetVolumeOutputValue("ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(3)); + SetVolumeOutputValue("ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); } if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ // Turbulent switch(turb_model){ case SST: - SetVolumeOutputValue("ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(0)); - SetVolumeOutputValue("ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(1)); + SetVolumeOutputValue("ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0)); + SetVolumeOutputValue("ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(0)); + SetVolumeOutputValue("ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0)); break; case NONE: break; @@ -408,35 +408,35 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS } // Residuals - SetVolumeOutputValue("RES_ADJ_DENSITY", iPoint, Node_AdjFlow->GetSolution(0) - Node_AdjFlow->GetSolution_Old(0)); - SetVolumeOutputValue("RES_ADJ_MOMENTUM-X", iPoint, Node_AdjFlow->GetSolution(1) - Node_AdjFlow->GetSolution_Old(1)); - SetVolumeOutputValue("RES_ADJ_MOMENTUM-Y", iPoint, Node_AdjFlow->GetSolution(2) - Node_AdjFlow->GetSolution_Old(2)); + SetVolumeOutputValue("RES_ADJ_DENSITY", iPoint, Node_AdjFlow->GetSolution(iPoint, 0) - Node_AdjFlow->GetSolution_Old(iPoint, 0)); + SetVolumeOutputValue("RES_ADJ_MOMENTUM-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1) - Node_AdjFlow->GetSolution_Old(iPoint, 1)); + SetVolumeOutputValue("RES_ADJ_MOMENTUM-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2) - Node_AdjFlow->GetSolution_Old(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("RES_ADJ_MOMENTUM-Z", iPoint, Node_AdjFlow->GetSolution(3) - Node_AdjFlow->GetSolution_Old(3)); - SetVolumeOutputValue("RES_ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(4) - Node_AdjFlow->GetSolution_Old(4)); + SetVolumeOutputValue("RES_ADJ_MOMENTUM-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); + SetVolumeOutputValue("RES_ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); } else { - SetVolumeOutputValue("RES_ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(3) - Node_AdjFlow->GetSolution_Old(3)); + SetVolumeOutputValue("RES_ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); } if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ switch(config->GetKind_Turb_Model()){ case SST: - SetVolumeOutputValue("RES_ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(0) - Node_AdjTurb->GetSolution_Old(0)); - SetVolumeOutputValue("RES_ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(1) - Node_AdjTurb->GetSolution_Old(1)); + SetVolumeOutputValue("RES_ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0) - Node_AdjTurb->GetSolution_Old(iPoint, 0)); + SetVolumeOutputValue("RES_ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(iPoint, 1) - Node_AdjTurb->GetSolution_Old(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("RES_ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(0) - Node_AdjTurb->GetSolution_Old(0)); + SetVolumeOutputValue("RES_ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0) - Node_AdjTurb->GetSolution_Old(iPoint, 0)); break; case NONE: break; } } - SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_AdjFlow->GetSensitivity(0)); - SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjFlow->GetSensitivity(1)); + SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 0)); + SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 1)); if (nDim == 3) - SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjFlow->GetSensitivity(2)); + SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 2)); } diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 395d011acc21..d6356f136a0b 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -390,16 +390,16 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->node[iPoint]; + CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->GetNodes(); CVariable* Node_AdjHeat = NULL; CVariable* Node_AdjTurb = NULL; CPoint* Node_Geo = geometry->node[iPoint]; if (config->GetKind_Turb_Model() != NONE && !config->GetFrozen_Visc_Disc()){ - Node_AdjTurb = solver[ADJTURB_SOL]->node[iPoint]; + Node_AdjTurb = solver[ADJTURB_SOL]->GetNodes(); } if (weakly_coupled_heat){ - Node_AdjHeat = solver[ADJHEAT_SOL]->node[iPoint]; + Node_AdjHeat = solver[ADJHEAT_SOL]->GetNodes(); } SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); @@ -407,30 +407,30 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - SetVolumeOutputValue("ADJ_PRESSURE", iPoint, Node_AdjFlow->GetSolution(0)); - SetVolumeOutputValue("ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(1)); - SetVolumeOutputValue("ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(2)); + SetVolumeOutputValue("ADJ_PRESSURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 0)); + SetVolumeOutputValue("ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1)); + SetVolumeOutputValue("ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(3)); + SetVolumeOutputValue("ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); } if (weakly_coupled_heat){ - SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(0)); + SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0)); } else { - if (nDim == 3) SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(4)); - else SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(3)); + if (nDim == 3) SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4)); + else SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); } // Turbulent if (!config->GetFrozen_Visc_Disc()){ switch(turb_model){ case SST: - SetVolumeOutputValue("ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(0)); - SetVolumeOutputValue("ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(1)); + SetVolumeOutputValue("ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0)); + SetVolumeOutputValue("ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(0)); + SetVolumeOutputValue("ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0)); break; case NONE: break; @@ -438,34 +438,34 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo } // Residuals - SetVolumeOutputValue("RES_ADJ_PRESSURE", iPoint, Node_AdjFlow->GetSolution(0) - Node_AdjFlow->GetSolution_Old(0)); - SetVolumeOutputValue("RES_ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(1) - Node_AdjFlow->GetSolution_Old(1)); - SetVolumeOutputValue("RES_ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(2) - Node_AdjFlow->GetSolution_Old(2)); + SetVolumeOutputValue("RES_ADJ_PRESSURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 0) - Node_AdjFlow->GetSolution_Old(iPoint, 0)); + SetVolumeOutputValue("RES_ADJ_VELOCITY-X", iPoint, Node_AdjFlow->GetSolution(iPoint, 1) - Node_AdjFlow->GetSolution_Old(iPoint, 1)); + SetVolumeOutputValue("RES_ADJ_VELOCITY-Y", iPoint, Node_AdjFlow->GetSolution(iPoint, 2) - Node_AdjFlow->GetSolution_Old(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("RES_ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(3) - Node_AdjFlow->GetSolution_Old(3)); - SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(4) - Node_AdjFlow->GetSolution_Old(4)); + SetVolumeOutputValue("RES_ADJ_VELOCITY-Z", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); + SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 4) - Node_AdjFlow->GetSolution_Old(iPoint, 4)); } else { - SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(3) - Node_AdjFlow->GetSolution_Old(3)); + SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjFlow->GetSolution(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); } if (!config->GetFrozen_Visc_Disc()){ switch(config->GetKind_Turb_Model()){ case SST: - SetVolumeOutputValue("RES_ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(0) - Node_AdjTurb->GetSolution_Old(0)); - SetVolumeOutputValue("RES_ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(1) - Node_AdjTurb->GetSolution_Old(1)); + SetVolumeOutputValue("RES_ADJ_TKE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0) - Node_AdjTurb->GetSolution_Old(iPoint, 0)); + SetVolumeOutputValue("RES_ADJ_DISSIPATION", iPoint, Node_AdjTurb->GetSolution(iPoint, 1) - Node_AdjTurb->GetSolution_Old(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("RES_ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(0) - Node_AdjTurb->GetSolution_Old(0)); + SetVolumeOutputValue("RES_ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0) - Node_AdjTurb->GetSolution_Old(iPoint, 0)); break; case NONE: break; } } - SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_AdjFlow->GetSensitivity(0)); - SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjFlow->GetSensitivity(1)); + SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 0)); + SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 1)); if (nDim == 3) - SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjFlow->GetSensitivity(2)); + SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 2)); } diff --git a/SU2_CFD/src/output/CAdjHeatOutput.cpp b/SU2_CFD/src/output/CAdjHeatOutput.cpp index 0c59dff5e80a..c766805c9cdd 100644 --- a/SU2_CFD/src/output/CAdjHeatOutput.cpp +++ b/SU2_CFD/src/output/CAdjHeatOutput.cpp @@ -169,7 +169,7 @@ void CAdjHeatOutput::SetVolumeOutputFields(CConfig *config){ void CAdjHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_AdjHeat = solver[ADJHEAT_SOL]->node[iPoint]; + CVariable* Node_AdjHeat = solver[ADJHEAT_SOL]->GetNodes(); CPoint* Node_Geo = geometry->node[iPoint]; @@ -178,15 +178,15 @@ void CAdjHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(0)); + SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0)); // Residuals - SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(0) - Node_AdjHeat->GetSolution_Old(0)); + SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0) - Node_AdjHeat->GetSolution_Old(iPoint, 0)); - SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_AdjHeat->GetSensitivity(0)); - SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjHeat->GetSensitivity(1)); + SetVolumeOutputValue("SENSITIVITY-X", iPoint, Node_AdjHeat->GetSensitivity(iPoint, 0)); + SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjHeat->GetSensitivity(iPoint, 1)); if (nDim == 3) - SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjHeat->GetSensitivity(2)); + SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjHeat->GetSensitivity(iPoint, 2)); } diff --git a/SU2_CFD/src/output/CBaselineOutput.cpp b/SU2_CFD/src/output/CBaselineOutput.cpp index 9139c03eb724..5b6aa2474641 100644 --- a/SU2_CFD/src/output/CBaselineOutput.cpp +++ b/SU2_CFD/src/output/CBaselineOutput.cpp @@ -117,10 +117,10 @@ void CBaselineOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv /*--- Take the solver at index 0 --- */ - CVariable* Node_Sol = solver[0]->node[iPoint]; - + CVariable* Node_Sol = solver[0]->GetNodes(); + for (iField = 0; iField < fields.size(); iField++){ - SetVolumeOutputValue(fields[iField], iPoint, Node_Sol->GetSolution(iField)); + SetVolumeOutputValue(fields[iField], iPoint, Node_Sol->GetSolution(iPoint, iField)); } } diff --git a/SU2_CFD/src/output/CElasticityOutput.cpp b/SU2_CFD/src/output/CElasticityOutput.cpp index 9d041cb55a69..f8677ac26306 100644 --- a/SU2_CFD/src/output/CElasticityOutput.cpp +++ b/SU2_CFD/src/output/CElasticityOutput.cpp @@ -172,7 +172,7 @@ void CElasticityOutput::SetHistoryOutputFields(CConfig *config){ void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_Struc = solver[FEA_SOL]->node[iPoint]; + CVariable* Node_Struc = solver[FEA_SOL]->GetNodes(); CPoint* Node_Geo = geometry->node[iPoint]; SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); @@ -180,29 +180,29 @@ void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - SetVolumeOutputValue("DISPLACEMENT-X", iPoint, Node_Struc->GetSolution(0)); - SetVolumeOutputValue("DISPLACEMENT-Y", iPoint, Node_Struc->GetSolution(1)); - if (nDim == 3) SetVolumeOutputValue("DISPLACEMENT-Z", iPoint, Node_Struc->GetSolution(2)); + SetVolumeOutputValue("DISPLACEMENT-X", iPoint, Node_Struc->GetSolution(iPoint, 0)); + SetVolumeOutputValue("DISPLACEMENT-Y", iPoint, Node_Struc->GetSolution(iPoint, 1)); + if (nDim == 3) SetVolumeOutputValue("DISPLACEMENT-Z", iPoint, Node_Struc->GetSolution(iPoint, 2)); if(dynamic){ - SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Struc->GetSolution_Vel(0)); - SetVolumeOutputValue("VELOCITY-Y", iPoint, Node_Struc->GetSolution_Vel(1)); - if (nDim == 3) SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Struc->GetSolution_Vel(2)); + SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Struc->GetSolution_Vel(iPoint, 0)); + SetVolumeOutputValue("VELOCITY-Y", iPoint, Node_Struc->GetSolution_Vel(iPoint, 1)); + if (nDim == 3) SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Struc->GetSolution_Vel(iPoint, 2)); - SetVolumeOutputValue("ACCELERATION-X", iPoint, Node_Struc->GetSolution_Accel(0)); - SetVolumeOutputValue("ACCELERATION-Y", iPoint, Node_Struc->GetSolution_Accel(1)); - if (nDim == 3) SetVolumeOutputValue("ACCELERATION-Z", iPoint, Node_Struc->GetSolution_Accel(2)); + SetVolumeOutputValue("ACCELERATION-X", iPoint, Node_Struc->GetSolution_Accel(iPoint, 0)); + SetVolumeOutputValue("ACCELERATION-Y", iPoint, Node_Struc->GetSolution_Accel(iPoint, 1)); + if (nDim == 3) SetVolumeOutputValue("ACCELERATION-Z", iPoint, Node_Struc->GetSolution_Accel(iPoint, 2)); } - SetVolumeOutputValue("STRESS-XX", iPoint, Node_Struc->GetStress_FEM()[0]); - SetVolumeOutputValue("STRESS-YY", iPoint, Node_Struc->GetStress_FEM()[1]); - SetVolumeOutputValue("STRESS-XY", iPoint, Node_Struc->GetStress_FEM()[2]); + SetVolumeOutputValue("STRESS-XX", iPoint, Node_Struc->GetStress_FEM(iPoint)[0]); + SetVolumeOutputValue("STRESS-YY", iPoint, Node_Struc->GetStress_FEM(iPoint)[1]); + SetVolumeOutputValue("STRESS-XY", iPoint, Node_Struc->GetStress_FEM(iPoint)[2]); if (nDim == 3){ - SetVolumeOutputValue("STRESS-ZZ", iPoint, Node_Struc->GetStress_FEM()[3]); - SetVolumeOutputValue("STRESS-XZ", iPoint, Node_Struc->GetStress_FEM()[4]); - SetVolumeOutputValue("STRESS-YZ", iPoint, Node_Struc->GetStress_FEM()[5]); + SetVolumeOutputValue("STRESS-ZZ", iPoint, Node_Struc->GetStress_FEM(iPoint)[3]); + SetVolumeOutputValue("STRESS-XZ", iPoint, Node_Struc->GetStress_FEM(iPoint)[4]); + SetVolumeOutputValue("STRESS-YZ", iPoint, Node_Struc->GetStress_FEM(iPoint)[5]); } - SetVolumeOutputValue("VON_MISES_STRESS", iPoint, Node_Struc->GetVonMises_Stress()); + SetVolumeOutputValue("VON_MISES_STRESS", iPoint, Node_Struc->GetVonMises_Stress(iPoint)); } diff --git a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp index 20769af8def6..9534d1c2142a 100644 --- a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp @@ -285,35 +285,6 @@ void CFlowCompFEMOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C } -su2double CFlowCompFEMOutput::GetQ_Criterion(CConfig *config, CGeometry *geometry, CVariable* node_flow){ - - unsigned short iDim, jDim; - su2double Grad_Vel[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}; - su2double Omega[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}; - su2double Strain[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}; - for (iDim = 0; iDim < nDim; iDim++) { - for (unsigned short jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node_flow->GetGradient_Primitive(iDim+1, jDim); - Strain[iDim][jDim] = 0.5*(Grad_Vel[iDim][jDim] + Grad_Vel[jDim][iDim]); - Omega[iDim][jDim] = 0.5*(Grad_Vel[iDim][jDim] - Grad_Vel[jDim][iDim]); - } - } - - su2double OmegaMag = 0.0, StrainMag = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - for (jDim = 0 ; jDim < nDim; jDim++) { - StrainMag += Strain[iDim][jDim]*Strain[iDim][jDim]; - OmegaMag += Omega[iDim][jDim]*Omega[iDim][jDim]; - } - } - StrainMag = sqrt(StrainMag); OmegaMag = sqrt(OmegaMag); - - su2double Q = 0.5*(OmegaMag - StrainMag); - - return Q; -} - - bool CFlowCompFEMOutput::SetInit_Residuals(CConfig *config){ return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 8d22c4faddc0..807bb8ce2c82 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -394,11 +394,11 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_Flow = solver[FLOW_SOL]->node[iPoint]; + CVariable* Node_Flow = solver[FLOW_SOL]->GetNodes(); CVariable* Node_Turb = NULL; if (config->GetKind_Turb_Model() != NONE){ - Node_Turb = solver[TURB_SOL]->node[iPoint]; + Node_Turb = solver[TURB_SOL]->GetNodes(); } CPoint* Node_Geo = geometry->node[iPoint]; @@ -408,25 +408,25 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - SetVolumeOutputValue("DENSITY", iPoint, Node_Flow->GetSolution(0)); - SetVolumeOutputValue("MOMENTUM-X", iPoint, Node_Flow->GetSolution(1)); - SetVolumeOutputValue("MOMENTUM-Y", iPoint, Node_Flow->GetSolution(2)); + SetVolumeOutputValue("DENSITY", iPoint, Node_Flow->GetSolution(iPoint, 0)); + SetVolumeOutputValue("MOMENTUM-X", iPoint, Node_Flow->GetSolution(iPoint, 1)); + SetVolumeOutputValue("MOMENTUM-Y", iPoint, Node_Flow->GetSolution(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("MOMENTUM-Z", iPoint, Node_Flow->GetSolution(3)); - SetVolumeOutputValue("ENERGY", iPoint, Node_Flow->GetSolution(4)); + SetVolumeOutputValue("MOMENTUM-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); + SetVolumeOutputValue("ENERGY", iPoint, Node_Flow->GetSolution(iPoint, 4)); } else { - SetVolumeOutputValue("ENERGY", iPoint, Node_Flow->GetSolution(3)); + SetVolumeOutputValue("ENERGY", iPoint, Node_Flow->GetSolution(iPoint, 3)); } // Turbulent Residuals switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: - SetVolumeOutputValue("TKE", iPoint, Node_Turb->GetSolution(0)); - SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(1)); + SetVolumeOutputValue("TKE", iPoint, Node_Turb->GetSolution(iPoint, 0)); + SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(0)); + SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(iPoint, 0)); break; case NONE: break; @@ -439,26 +439,27 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv SetVolumeOutputValue("GRID_VELOCITY-Z", iPoint, Node_Geo->GetGridVel()[2]); } - SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetPressure()); - SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature()); - SetVolumeOutputValue("MACH", iPoint, sqrt(Node_Flow->GetVelocity2())/Node_Flow->GetSoundSpeed()); + SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetPressure(iPoint)); + SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint)); + SetVolumeOutputValue("MACH", iPoint, sqrt(Node_Flow->GetVelocity2(iPoint))/Node_Flow->GetSoundSpeed(iPoint)); + su2double VelMag = 0.0; for (unsigned short iDim = 0; iDim < nDim; iDim++){ - VelMag += solver[FLOW_SOL]->GetVelocity_Inf(iDim)*solver[FLOW_SOL]->GetVelocity_Inf(iDim); + VelMag += pow(solver[FLOW_SOL]->GetVelocity_Inf(iDim),2.0); } su2double factor = 1.0/(0.5*solver[FLOW_SOL]->GetDensity_Inf()*VelMag); - SetVolumeOutputValue("PRESSURE_COEFF", iPoint, (Node_Flow->GetPressure() - solver[FLOW_SOL]->GetPressure_Inf())*factor); + SetVolumeOutputValue("PRESSURE_COEFF", iPoint, (Node_Flow->GetPressure(iPoint) - solver[FLOW_SOL]->GetPressure_Inf())*factor); if (config->GetKind_Solver() == RANS || config->GetKind_Solver() == NAVIER_STOKES){ - SetVolumeOutputValue("LAMINAR_VISCOSITY", iPoint, Node_Flow->GetLaminarViscosity()); + SetVolumeOutputValue("LAMINAR_VISCOSITY", iPoint, Node_Flow->GetLaminarViscosity(iPoint)); } if (config->GetKind_Solver() == RANS) { - SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity()); + SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity(iPoint)); } if (config->GetKind_Trans_Model() == BC){ - SetVolumeOutputValue("INTERMITTENCY", iPoint, Node_Turb->GetGammaBC()); + SetVolumeOutputValue("INTERMITTENCY", iPoint, Node_Turb->GetGammaBC(iPoint)); } SetVolumeOutputValue("RES_DENSITY", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 0)); @@ -484,45 +485,45 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv break; } - SetVolumeOutputValue("LIMITER_DENSITY", iPoint, Node_Flow->GetLimiter_Primitive(0)); - SetVolumeOutputValue("LIMITER_MOMENTUM-X", iPoint, Node_Flow->GetLimiter_Primitive(1)); - SetVolumeOutputValue("LIMITER_MOMENTUM-Y", iPoint, Node_Flow->GetLimiter_Primitive(2)); + SetVolumeOutputValue("LIMITER_DENSITY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 0)); + SetVolumeOutputValue("LIMITER_MOMENTUM-X", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 1)); + SetVolumeOutputValue("LIMITER_MOMENTUM-Y", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("LIMITER_MOMENTUM-Z", iPoint, Node_Flow->GetLimiter_Primitive(3)); - SetVolumeOutputValue("LIMITER_ENERGY", iPoint, Node_Flow->GetLimiter_Primitive(4)); + SetVolumeOutputValue("LIMITER_MOMENTUM-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); + SetVolumeOutputValue("LIMITER_ENERGY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 4)); } else { - SetVolumeOutputValue("LIMITER_ENERGY", iPoint, Node_Flow->GetLimiter_Primitive(3)); + SetVolumeOutputValue("LIMITER_ENERGY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); } switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: - SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter_Primitive(0)); - SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter_Primitive(1)); + SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); + SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter_Primitive(0)); + SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); break; case NONE: break; } if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ - SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale()); + SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale(iPoint)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance()); } if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ - SetVolumeOutputValue("ROE_DISSIPATION", iPoint, Node_Flow->GetRoe_Dissipation()); + SetVolumeOutputValue("ROE_DISSIPATION", iPoint, Node_Flow->GetRoe_Dissipation(iPoint)); } if(config->GetKind_Solver() == RANS || config->GetKind_Solver() == NAVIER_STOKES){ if (nDim == 3){ - SetVolumeOutputValue("VORTICITY_X", iPoint, Node_Flow->GetVorticity()[0]); - SetVolumeOutputValue("VORTICITY_Y", iPoint, Node_Flow->GetVorticity()[1]); - SetVolumeOutputValue("Q_CRITERION", iPoint, GetQ_Criterion(config, geometry, Node_Flow)); + SetVolumeOutputValue("VORTICITY_X", iPoint, Node_Flow->GetVorticity(iPoint)[0]); + SetVolumeOutputValue("VORTICITY_Y", iPoint, Node_Flow->GetVorticity(iPoint)[1]); + SetVolumeOutputValue("Q_CRITERION", iPoint, GetQ_Criterion(&(Node_Flow->GetGradient_Primitive(iPoint)[1]))); } - SetVolumeOutputValue("VORTICITY_Z", iPoint, Node_Flow->GetVorticity()[2]); + SetVolumeOutputValue("VORTICITY_Z", iPoint, Node_Flow->GetVorticity(iPoint)[2]); } if (config->GetTime_Domain()){ @@ -649,34 +650,6 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol } -su2double CFlowCompOutput::GetQ_Criterion(CConfig *config, CGeometry *geometry, CVariable* node_flow){ - - unsigned short iDim; - su2double Grad_Vel[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}; - - for (iDim = 0; iDim < nDim; iDim++) { - for (unsigned short jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node_flow->GetGradient_Primitive(iDim+1, jDim); - } - } - - su2double s11 = Grad_Vel[0][0]; - su2double s12 = 0.5 * (Grad_Vel[0][1] + Grad_Vel[1][0]); - su2double s13 = 0.5 * (Grad_Vel[0][2] + Grad_Vel[2][0]); - su2double s22 = Grad_Vel[1][1]; - su2double s23 = 0.5 * (Grad_Vel[1][2] + Grad_Vel[2][1]); - su2double s33 = Grad_Vel[2][2]; - su2double omega12 = 0.5 * (Grad_Vel[0][1] - Grad_Vel[1][0]); - su2double omega13 = 0.5 * (Grad_Vel[0][2] - Grad_Vel[2][0]); - su2double omega23 = 0.5 * (Grad_Vel[1][2] - Grad_Vel[2][1]); - - su2double Q = 2. * pow( omega12, 2.) + 2. * pow( omega13, 2.) + 2. * pow( omega23, 2.) - \ - pow( s11, 2.) - pow( s22, 2.) - pow( s33, 2.0) - 2. * pow( s12, 2.) - 2. * pow( s13, 2.) - 2. * pow( s23, 2.0); - - return Q; -} - - bool CFlowCompOutput::SetInit_Residuals(CConfig *config){ return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 21803e8ac2eb..f0372aac2ada 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -448,15 +448,15 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_Flow = solver[FLOW_SOL]->node[iPoint]; + CVariable* Node_Flow = solver[FLOW_SOL]->GetNodes(); CVariable* Node_Heat = NULL; CVariable* Node_Turb = NULL; if (config->GetKind_Turb_Model() != NONE){ - Node_Turb = solver[TURB_SOL]->node[iPoint]; + Node_Turb = solver[TURB_SOL]->GetNodes(); } if (weakly_coupled_heat){ - Node_Heat = solver[HEAT_SOL]->node[iPoint]; + Node_Heat = solver[HEAT_SOL]->GetNodes(); } CPoint* Node_Geo = geometry->node[iPoint]; @@ -466,25 +466,25 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetSolution(0)); - SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Flow->GetSolution(1)); - SetVolumeOutputValue("VELOCITY-Y", iPoint, Node_Flow->GetSolution(2)); + SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetSolution(iPoint, 0)); + SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Flow->GetSolution(iPoint, 1)); + SetVolumeOutputValue("VELOCITY-Y", iPoint, Node_Flow->GetSolution(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(3)); - if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(4)); + SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); + if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, 4)); } else { - if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(3)); + if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, 3)); } - if (weakly_coupled_heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(0)); + if (weakly_coupled_heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: - SetVolumeOutputValue("TKE", iPoint, Node_Turb->GetSolution(0)); - SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(1)); + SetVolumeOutputValue("TKE", iPoint, Node_Turb->GetSolution(iPoint, 0)); + SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(0)); + SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(iPoint, 0)); break; case NONE: break; @@ -499,22 +499,22 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve su2double VelMag = 0.0; for (unsigned short iDim = 0; iDim < nDim; iDim++){ - VelMag += solver[FLOW_SOL]->GetVelocity_Inf(iDim)*solver[FLOW_SOL]->GetVelocity_Inf(iDim); + VelMag += pow(solver[FLOW_SOL]->GetVelocity_Inf(iDim),2.0); } su2double factor = 1.0/(0.5*solver[FLOW_SOL]->GetDensity_Inf()*VelMag); - SetVolumeOutputValue("PRESSURE_COEFF", iPoint, (Node_Flow->GetPressure() - config->GetPressure_FreeStreamND())*factor); - SetVolumeOutputValue("DENSITY", iPoint, Node_Flow->GetDensity()); + SetVolumeOutputValue("PRESSURE_COEFF", iPoint, (Node_Flow->GetPressure(iPoint) - config->GetPressure_FreeStreamND())*factor); + SetVolumeOutputValue("DENSITY", iPoint, Node_Flow->GetDensity(iPoint)); if (config->GetKind_Solver() == INC_RANS || config->GetKind_Solver() == INC_NAVIER_STOKES){ - SetVolumeOutputValue("LAMINAR_VISCOSITY", iPoint, Node_Flow->GetLaminarViscosity()); + SetVolumeOutputValue("LAMINAR_VISCOSITY", iPoint, Node_Flow->GetLaminarViscosity(iPoint)); } if (config->GetKind_Solver() == INC_RANS) { - SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity()); + SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity(iPoint)); } if (config->GetKind_Trans_Model() == BC){ - SetVolumeOutputValue("INTERMITTENCY", iPoint, Node_Turb->GetGammaBC()); + SetVolumeOutputValue("INTERMITTENCY", iPoint, Node_Turb->GetGammaBC(iPoint)); } SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 0)); @@ -540,45 +540,45 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve break; } - SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(0)); - SetVolumeOutputValue("LIMITER_VELOCITY-X", iPoint, Node_Flow->GetLimiter_Primitive(1)); - SetVolumeOutputValue("LIMITER_VELOCITY-Y", iPoint, Node_Flow->GetLimiter_Primitive(2)); + SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 0)); + SetVolumeOutputValue("LIMITER_VELOCITY-X", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 1)); + SetVolumeOutputValue("LIMITER_VELOCITY-Y", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 2)); if (nDim == 3){ - SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(3)); - SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(4)); + SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); + SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 4)); } else { - SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(3)); + SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); } switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: - SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter_Primitive(0)); - SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter_Primitive(1)); + SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); + SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 1)); break; case SA: case SA_COMP: case SA_E: case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter_Primitive(0)); + SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); break; case NONE: break; } if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ - SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale()); + SetVolumeOutputValue("DES_LENGTHSCALE", iPoint, Node_Flow->GetDES_LengthScale(iPoint)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance()); } if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ - SetVolumeOutputValue("ROE_DISSIPATION", iPoint, Node_Flow->GetRoe_Dissipation()); + SetVolumeOutputValue("ROE_DISSIPATION", iPoint, Node_Flow->GetRoe_Dissipation(iPoint)); } if(config->GetKind_Solver() == INC_RANS || config->GetKind_Solver() == INC_NAVIER_STOKES){ if (nDim == 3){ - SetVolumeOutputValue("VORTICITY_X", iPoint, Node_Flow->GetVorticity()[0]); - SetVolumeOutputValue("VORTICITY_Y", iPoint, Node_Flow->GetVorticity()[1]); - SetVolumeOutputValue("Q_CRITERION", iPoint, GetQ_Criterion(config, geometry, Node_Flow)); + SetVolumeOutputValue("VORTICITY_X", iPoint, Node_Flow->GetVorticity(iPoint)[0]); + SetVolumeOutputValue("VORTICITY_Y", iPoint, Node_Flow->GetVorticity(iPoint)[1]); + SetVolumeOutputValue("Q_CRITERION", iPoint, GetQ_Criterion(&(Node_Flow->GetGradient_Primitive(iPoint)[1]))); } - SetVolumeOutputValue("VORTICITY_Z", iPoint, Node_Flow->GetVorticity()[2]); + SetVolumeOutputValue("VORTICITY_Z", iPoint, Node_Flow->GetVorticity(iPoint)[2]); } } @@ -600,33 +600,6 @@ void CFlowIncOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolv } } -su2double CFlowIncOutput::GetQ_Criterion(CConfig *config, CGeometry *geometry, CVariable* node_flow){ - - unsigned short iDim; - su2double Grad_Vel[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}; - - for (iDim = 0; iDim < nDim; iDim++) { - for (unsigned short jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node_flow->GetGradient_Primitive(iDim+1, jDim); - } - } - - su2double s11 = Grad_Vel[0][0]; - su2double s12 = 0.5 * (Grad_Vel[0][1] + Grad_Vel[1][0]); - su2double s13 = 0.5 * (Grad_Vel[0][2] + Grad_Vel[2][0]); - su2double s22 = Grad_Vel[1][1]; - su2double s23 = 0.5 * (Grad_Vel[1][2] + Grad_Vel[2][1]); - su2double s33 = Grad_Vel[2][2]; - su2double omega12 = 0.5 * (Grad_Vel[0][1] - Grad_Vel[1][0]); - su2double omega13 = 0.5 * (Grad_Vel[0][2] - Grad_Vel[2][0]); - su2double omega23 = 0.5 * (Grad_Vel[1][2] - Grad_Vel[2][1]); - - su2double Q = 2. * pow( omega12, 2.) + 2. * pow( omega13, 2.) + 2. * pow( omega23, 2.) - \ - pow( s11, 2.) - pow( s22, 2.) - pow( s33, 2.0) - 2. * pow( s12, 2.) - 2. * pow( s13, 2.) - 2. * pow( s23, 2.0); - - return Q; -} - bool CFlowIncOutput::SetInit_Residuals(CConfig *config){ return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 76208552ba1d..7d9e36e7d237 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -122,7 +122,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi unsigned short iDim, iMarker, iMarker_Analyze; unsigned long iVertex, iPoint; su2double Mach = 0.0, Pressure, Temperature = 0.0, TotalPressure = 0.0, TotalTemperature = 0.0, - Enthalpy, Velocity[3], TangVel[3], Velocity2, MassFlow, Density, Area, + Enthalpy, Velocity[3] = {}, TangVel[3], Velocity2, MassFlow, Density, Area, AxiFactor = 1.0, SoundSpeed, Vn, Vn2, Vtang2, Weight = 1.0; su2double Gas_Constant = config->GetGas_ConstantND(); @@ -207,12 +207,12 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi AxiFactor = 1.0; } - Density = solver->node[iPoint]->GetDensity(); + Density = solver->GetNodes()->GetDensity(iPoint); Velocity2 = 0.0; Area = 0.0; MassFlow = 0.0; Vn = 0.0; Vtang2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) { Area += (Vector[iDim] * AxiFactor) * (Vector[iDim] * AxiFactor); - Velocity[iDim] = solver->node[iPoint]->GetVelocity(iDim); + Velocity[iDim] = solver->GetNodes()->GetVelocity(iPoint,iDim); Velocity2 += Velocity[iDim] * Velocity[iDim]; Vn += Velocity[iDim] * Vector[iDim] * AxiFactor; MassFlow += Vector[iDim] * AxiFactor * Density * Velocity[iDim]; @@ -221,8 +221,8 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi Area = sqrt (Area); if (AxiFactor == 0.0) Vn = 0.0; else Vn /= Area; Vn2 = Vn * Vn; - Pressure = solver->node[iPoint]->GetPressure(); - SoundSpeed = solver->node[iPoint]->GetSoundSpeed(); + Pressure = solver->GetNodes()->GetPressure(iPoint); + SoundSpeed = solver->GetNodes()->GetSoundSpeed(iPoint); for (iDim = 0; iDim < nDim; iDim++) { TangVel[iDim] = Velocity[iDim] - Vn*Vector[iDim]*AxiFactor/Area; @@ -231,21 +231,21 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi if (incompressible){ if (config->GetKind_DensityModel() == VARIABLE) { - Mach = sqrt(solver->node[iPoint]->GetVelocity2())/ - sqrt(solver->node[iPoint]->GetSpecificHeatCp()*config->GetPressure_ThermodynamicND()/(solver->node[iPoint]->GetSpecificHeatCv()*solver->node[iPoint]->GetDensity())); + Mach = sqrt(solver->GetNodes()->GetVelocity2(iPoint))/ + sqrt(solver->GetNodes()->GetSpecificHeatCp(iPoint)*config->GetPressure_ThermodynamicND()/(solver->GetNodes()->GetSpecificHeatCv(iPoint)*solver->GetNodes()->GetDensity(iPoint))); } else { - Mach = sqrt(solver->node[iPoint]->GetVelocity2())/ - sqrt(config->GetBulk_Modulus()/(solver->node[iPoint]->GetDensity())); + Mach = sqrt(solver->GetNodes()->GetVelocity2(iPoint))/ + sqrt(config->GetBulk_Modulus()/(solver->GetNodes()->GetDensity(iPoint))); } - Temperature = solver->node[iPoint]->GetTemperature(); - Enthalpy = solver->node[iPoint]->GetSpecificHeatCp()*Temperature; - TotalTemperature = Temperature + 0.5*Velocity2/solver->node[iPoint]->GetSpecificHeatCp(); + Temperature = solver->GetNodes()->GetTemperature(iPoint); + Enthalpy = solver->GetNodes()->GetSpecificHeatCp(iPoint)*Temperature; + TotalTemperature = Temperature + 0.5*Velocity2/solver->GetNodes()->GetSpecificHeatCp(iPoint); TotalPressure = Pressure + 0.5*Density*Velocity2; } else{ Mach = sqrt(Velocity2)/SoundSpeed; Temperature = Pressure / (Gas_Constant * Density); - Enthalpy = solver->node[iPoint]->GetEnthalpy(); + Enthalpy = solver->GetNodes()->GetEnthalpy(iPoint); TotalTemperature = Temperature * (1.0 + Mach * Mach * 0.5 * (Gamma - 1.0)); TotalPressure = Pressure * pow( 1.0 + Mach * Mach * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0)); } @@ -922,6 +922,39 @@ void CFlowOutput::Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CCon } +su2double CFlowOutput::GetQ_Criterion(su2double** VelocityGradient) const { + + /*--- Make a 3D copy of the gradient so we do not have worry about nDim ---*/ + + su2double Grad_Vel[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}; + + for (unsigned short iDim = 0; iDim < nDim; iDim++) + for (unsigned short jDim = 0 ; jDim < nDim; jDim++) + Grad_Vel[iDim][jDim] = VelocityGradient[iDim][jDim]; + + /*--- Q Criterion Eq 1.2 of HALLER, G. (2005). An objective definition of a vortex. + Journal of Fluid Mechanics, 525, 1-26. doi:10.1017/S0022112004002526 ---*/ + + /*--- Components of the strain rate tensor (symmetric) ---*/ + su2double s11 = Grad_Vel[0][0]; + su2double s12 = 0.5 * (Grad_Vel[0][1] + Grad_Vel[1][0]); + su2double s13 = 0.5 * (Grad_Vel[0][2] + Grad_Vel[2][0]); + su2double s22 = Grad_Vel[1][1]; + su2double s23 = 0.5 * (Grad_Vel[1][2] + Grad_Vel[2][1]); + su2double s33 = Grad_Vel[2][2]; + + /*--- Components of the spin tensor (skew-symmetric) ---*/ + su2double omega12 = 0.5 * (Grad_Vel[0][1] - Grad_Vel[1][0]); + su2double omega13 = 0.5 * (Grad_Vel[0][2] - Grad_Vel[2][0]); + su2double omega23 = 0.5 * (Grad_Vel[1][2] - Grad_Vel[2][1]); + + /*--- Q = ||Omega|| - ||Strain|| ---*/ + su2double Q = 2*(pow(omega12,2) + pow(omega13,2) + pow(omega23,2)) - + (pow(s11,2) + pow(s22,2) + pow(s33,2) + 2*(pow(s12,2) + pow(s13,2) + pow(s23,2))); + + return Q; +} + void CFlowOutput::WriteAdditionalFiles(CConfig *config, CGeometry *geometry, CSolver **solver_container){ if (config->GetFixed_CL_Mode() || config->GetFixed_CM_Mode()){ @@ -968,7 +1001,6 @@ void CFlowOutput::WriteMetaData(CConfig *config, CGeometry *geometry){ } meta_file.close(); - } void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSolver **solver_container){ @@ -2853,22 +2885,22 @@ void CFlowOutput::SetTimeAveragedFields(){ } void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, CVariable *Node_Flow){ - SetAvgVolumeOutputValue("MEAN_DENSITY", iPoint, Node_Flow->GetDensity()); - SetAvgVolumeOutputValue("MEAN_VELOCITY-X", iPoint, Node_Flow->GetVelocity(0)); - SetAvgVolumeOutputValue("MEAN_VELOCITY-Y", iPoint, Node_Flow->GetVelocity(1)); + SetAvgVolumeOutputValue("MEAN_DENSITY", iPoint, Node_Flow->GetDensity(iPoint)); + SetAvgVolumeOutputValue("MEAN_VELOCITY-X", iPoint, Node_Flow->GetVelocity(iPoint,0)); + SetAvgVolumeOutputValue("MEAN_VELOCITY-Y", iPoint, Node_Flow->GetVelocity(iPoint,1)); if (nDim == 3) - SetAvgVolumeOutputValue("MEAN_VELOCITY-Z", iPoint, Node_Flow->GetVelocity(2)); + SetAvgVolumeOutputValue("MEAN_VELOCITY-Z", iPoint, Node_Flow->GetVelocity(iPoint,2)); - SetAvgVolumeOutputValue("MEAN_PRESSURE", iPoint, Node_Flow->GetPressure()); + SetAvgVolumeOutputValue("MEAN_PRESSURE", iPoint, Node_Flow->GetPressure(iPoint)); - SetAvgVolumeOutputValue("RMS_U", iPoint, pow(Node_Flow->GetVelocity(0),2)); - SetAvgVolumeOutputValue("RMS_V", iPoint, pow(Node_Flow->GetVelocity(1),2)); - SetAvgVolumeOutputValue("RMS_UV", iPoint, Node_Flow->GetVelocity(0) * Node_Flow->GetVelocity(1)); - SetAvgVolumeOutputValue("RMS_P", iPoint, pow(Node_Flow->GetPressure(),2)); + SetAvgVolumeOutputValue("RMS_U", iPoint, pow(Node_Flow->GetVelocity(iPoint,0),2)); + SetAvgVolumeOutputValue("RMS_V", iPoint, pow(Node_Flow->GetVelocity(iPoint,1),2)); + SetAvgVolumeOutputValue("RMS_UV", iPoint, Node_Flow->GetVelocity(iPoint,0) * Node_Flow->GetVelocity(iPoint,1)); + SetAvgVolumeOutputValue("RMS_P", iPoint, pow(Node_Flow->GetPressure(iPoint),2)); if (nDim == 3){ - SetAvgVolumeOutputValue("RMS_W", iPoint, pow(Node_Flow->GetVelocity(2),2)); - SetAvgVolumeOutputValue("RMS_VW", iPoint, Node_Flow->GetVelocity(2) * Node_Flow->GetVelocity(1)); - SetAvgVolumeOutputValue("RMS_UW", iPoint, Node_Flow->GetVelocity(2) * Node_Flow->GetVelocity(0)); + SetAvgVolumeOutputValue("RMS_W", iPoint, pow(Node_Flow->GetVelocity(iPoint,2),2)); + SetAvgVolumeOutputValue("RMS_VW", iPoint, Node_Flow->GetVelocity(iPoint,2) * Node_Flow->GetVelocity(iPoint,1)); + SetAvgVolumeOutputValue("RMS_UW", iPoint, Node_Flow->GetVelocity(iPoint,2) * Node_Flow->GetVelocity(iPoint,0)); } const su2double umean = GetVolumeOutputValue("MEAN_VELOCITY-X", iPoint); diff --git a/SU2_CFD/src/output/CHeatOutput.cpp b/SU2_CFD/src/output/CHeatOutput.cpp index cb3dcbf15d9d..33e98660477f 100644 --- a/SU2_CFD/src/output/CHeatOutput.cpp +++ b/SU2_CFD/src/output/CHeatOutput.cpp @@ -143,8 +143,7 @@ void CHeatOutput::SetVolumeOutputFields(CConfig *config){ void CHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_Heat = solver[HEAT_SOL]->node[iPoint]; - + CVariable* Node_Heat = solver[HEAT_SOL]->GetNodes(); CPoint* Node_Geo = geometry->node[iPoint]; // Grid coordinates @@ -154,7 +153,7 @@ void CHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver * SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); // SOLUTION - SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(0)); + SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); // Residuals SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[HEAT_SOL]->LinSysRes.GetBlock(iPoint, 0)); diff --git a/SU2_CFD/src/output/output_structure_legacy.cpp b/SU2_CFD/src/output/output_structure_legacy.cpp index 47379fade86b..6f984688e9ab 100644 --- a/SU2_CFD/src/output/output_structure_legacy.cpp +++ b/SU2_CFD/src/output/output_structure_legacy.cpp @@ -514,14 +514,14 @@ void COutputLegacy::SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry, if (nDim == 3) zCoord *= 12.0; } - Pressure = FlowSolver->node[iPoint]->GetPressure(); + Pressure = FlowSolver->GetNodes()->GetPressure(iPoint); PressCoeff = FlowSolver->GetCPressure(iMarker, iVertex); SurfFlow_file << scientific << Global_Index << ", " << xCoord << ", " << yCoord << ", "; if (nDim == 3) SurfFlow_file << scientific << zCoord << ", "; SurfFlow_file << scientific << Pressure << ", " << PressCoeff << ", "; switch (solver) { case EULER : case FEM_EULER: case INC_EULER: - Mach = sqrt(FlowSolver->node[iPoint]->GetVelocity2()) / FlowSolver->node[iPoint]->GetSoundSpeed(); + Mach = sqrt(FlowSolver->GetNodes()->GetVelocity2(iPoint)) / FlowSolver->GetNodes()->GetSoundSpeed(iPoint); SurfFlow_file << scientific << Mach << "\n"; break; case NAVIER_STOKES: case RANS: case FEM_NAVIER_STOKES: case FEM_RANS: case FEM_LES: @@ -631,7 +631,7 @@ void COutputLegacy::SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry, for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { - Buffer_Send_Press[nVertex_Surface] = FlowSolver->node[iPoint]->GetPressure(); + Buffer_Send_Press[nVertex_Surface] = FlowSolver->GetNodes()->GetPressure(iPoint); Buffer_Send_CPress[nVertex_Surface] = FlowSolver->GetCPressure(iMarker, iVertex); Buffer_Send_Coord_x[nVertex_Surface] = geometry->node[iPoint]->GetCoord(0); Buffer_Send_Coord_y[nVertex_Surface] = geometry->node[iPoint]->GetCoord(1); @@ -648,7 +648,7 @@ void COutputLegacy::SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry, Buffer_Send_GlobalIndex[nVertex_Surface] = geometry->node[iPoint]->GetGlobalIndex(); if (solver == EULER || solver == FEM_EULER || solver == INC_EULER) - Buffer_Send_Mach[nVertex_Surface] = sqrt(FlowSolver->node[iPoint]->GetVelocity2()) / FlowSolver->node[iPoint]->GetSoundSpeed(); + Buffer_Send_Mach[nVertex_Surface] = sqrt(FlowSolver->GetNodes()->GetVelocity2(iPoint)) / FlowSolver->GetNodes()->GetSoundSpeed(iPoint); if (solver == NAVIER_STOKES || solver == RANS || solver == INC_NAVIER_STOKES || solver == INC_RANS || solver == FEM_NAVIER_STOKES || solver == FEM_RANS || solver == FEM_LES) { @@ -849,7 +849,7 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry, for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); Global_Index = geometry->node[iPoint]->GetGlobalIndex(); - Solution = AdjSolver->node[iPoint]->GetSolution(); + Solution = AdjSolver->GetNodes()->GetSolution(iPoint); xCoord = geometry->node[iPoint]->GetCoord(0); yCoord = geometry->node[iPoint]->GetCoord(1); @@ -866,7 +866,7 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry, SurfAdj_file << scientific << Global_Index << ", " << AdjSolver->GetCSensitivity(iMarker, iVertex) << ", " << Solution[0] << ", " << Solution[1] << ", " << Solution[2] <<", " << xCoord <<", "<< yCoord; if (config->GetDiscrete_Adjoint()) { - SurfAdj_file << ", " << AdjSolver->node[iPoint]->GetSensitivity(0) << ", " << AdjSolver->node[iPoint]->GetSensitivity(1); + SurfAdj_file << ", " << AdjSolver->GetNodes()->GetSensitivity(iPoint,0) << ", " << AdjSolver->GetNodes()->GetSensitivity(iPoint,1); } SurfAdj_file << "\n"; } @@ -888,7 +888,7 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry, for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); Global_Index = geometry->node[iPoint]->GetGlobalIndex(); - Solution = AdjSolver->node[iPoint]->GetSolution(); + Solution = AdjSolver->GetNodes()->GetSolution(iPoint); xCoord = geometry->node[iPoint]->GetCoord(0); yCoord = geometry->node[iPoint]->GetCoord(1); @@ -908,8 +908,8 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry, SurfAdj_file << scientific << Global_Index << ", " << AdjSolver->GetCSensitivity(iMarker, iVertex) << ", " << Solution[0] << ", " << Solution[1] << ", " << Solution[2] << ", " << Solution[3] << ", " << xCoord <<", "<< yCoord <<", "<< zCoord; if (config->GetDiscrete_Adjoint()) { - SurfAdj_file << ", " << AdjSolver->node[iPoint]->GetSensitivity(0) << ", " << AdjSolver->node[iPoint]->GetSensitivity(1) - << ", " << AdjSolver->node[iPoint]->GetSensitivity(2); + SurfAdj_file << ", " << AdjSolver->GetNodes()->GetSensitivity(iPoint,0) << ", " << AdjSolver->GetNodes()->GetSensitivity(iPoint,1) + << ", " << AdjSolver->GetNodes()->GetSensitivity(iPoint, 2); } SurfAdj_file << "\n"; } @@ -975,10 +975,10 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry, for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { - Solution = AdjSolver->node[iPoint]->GetSolution(); + Solution = AdjSolver->GetNodes()->GetSolution(iPoint); //Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); Coord = geometry->node[iPoint]->GetCoord(); - //d = AdjSolver->node[iPoint]->GetForceProj_Vector(); + //d = AdjSolver->GetNodes()->GetForceProj_Vector(iPoint); Buffer_Send_GlobalPoint[nVertex_Surface] = geometry->node[iPoint]->GetGlobalIndex(); Buffer_Send_Coord_x[nVertex_Surface] = Coord[0]; Buffer_Send_Coord_y[nVertex_Surface] = Coord[1]; @@ -993,10 +993,10 @@ void COutputLegacy::SetSurfaceCSV_Adjoint(CConfig *config, CGeometry *geometry, if(config->GetKind_Regime() == COMPRESSIBLE) Buffer_Send_PsiE[nVertex_Surface] = Solution[4]; } if (config->GetDiscrete_Adjoint()) { - Buffer_Send_Sens_x[nVertex_Surface] = AdjSolver->node[iPoint]->GetSensitivity(0); - Buffer_Send_Sens_y[nVertex_Surface] = AdjSolver->node[iPoint]->GetSensitivity(1); + Buffer_Send_Sens_x[nVertex_Surface] = AdjSolver->GetNodes()->GetSensitivity(iPoint, 0); + Buffer_Send_Sens_y[nVertex_Surface] = AdjSolver->GetNodes()->GetSensitivity(iPoint, 1); if (nDim == 3) { - Buffer_Send_Sens_z[nVertex_Surface] = AdjSolver->node[iPoint]->GetSensitivity(2); + Buffer_Send_Sens_z[nVertex_Surface] = AdjSolver->GetNodes()->GetSensitivity(iPoint, 2); } } @@ -2620,24 +2620,23 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Get this variable into the temporary send buffer. ---*/ - Buffer_Send_Var[jPoint] = solver[CurrentIndex]->node[iPoint]->GetSolution(jVar); - - + Buffer_Send_Var[jPoint] = solver[CurrentIndex]->GetNodes()->GetSolution(iPoint, jVar); + + if (config->GetWrt_Limiters()) { - Buffer_Send_Vol[jPoint] = solver[CurrentIndex]->node[iPoint]->GetLimiter_Primitive(jVar); + Buffer_Send_Vol[jPoint] = solver[CurrentIndex]->GetNodes()->GetLimiter_Primitive(iPoint, jVar); } if (config->GetWrt_Residuals()) { if (!config->GetDiscrete_Adjoint()) { Buffer_Send_Res[jPoint] = solver[CurrentIndex]->LinSysRes.GetBlock(iPoint, jVar); } else { - Buffer_Send_Res[jPoint] = solver[CurrentIndex]->node[iPoint]->GetSolution(jVar) - - solver[CurrentIndex]->node[iPoint]->GetSolution_Old(jVar); + Buffer_Send_Res[jPoint] = solver[CurrentIndex]->GetNodes()->GetSolution(iPoint, jVar) - + solver[CurrentIndex]->GetNodes()->GetSolution_Old(iPoint, jVar); } } - /*--- Only send/recv the volumes & global indices during the first loop ---*/ if (iVar == 0) { @@ -2807,13 +2806,13 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the pressure, Cp, and mach variables. ---*/ - Buffer_Send_Var[jPoint] = solver[FLOW_SOL]->node[iPoint]->GetPressure(); + Buffer_Send_Var[jPoint] = solver[FLOW_SOL]->GetNodes()->GetPressure(iPoint); if (compressible){ - Buffer_Send_Res[jPoint] = solver[FLOW_SOL]->node[iPoint]->GetTemperature(); + Buffer_Send_Res[jPoint] = solver[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); } else{ Buffer_Send_Res[jPoint] = 0.0; } - Buffer_Send_Vol[jPoint] = (solver[FLOW_SOL]->node[iPoint]->GetPressure() - RefPressure)*factor*RefArea; + Buffer_Send_Vol[jPoint] = (solver[FLOW_SOL]->GetNodes()->GetPressure(iPoint) - RefPressure)*factor*RefArea; jPoint++; } @@ -2872,12 +2871,12 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the temperature and laminar viscosity variables. ---*/ if (compressible) { - Buffer_Send_Var[jPoint] = sqrt(solver[FLOW_SOL]->node[iPoint]->GetVelocity2())/ - solver[FLOW_SOL]->node[iPoint]->GetSoundSpeed(); + Buffer_Send_Var[jPoint] = sqrt(solver[FLOW_SOL]->GetNodes()->GetVelocity2(iPoint))/ + solver[FLOW_SOL]->GetNodes()->GetSoundSpeed(iPoint); } if (incompressible) { - Buffer_Send_Var[jPoint] = sqrt(solver[FLOW_SOL]->node[iPoint]->GetVelocity2())*config->GetVelocity_Ref()/ - sqrt(config->GetBulk_Modulus()/(solver[FLOW_SOL]->node[iPoint]->GetDensity()*config->GetDensity_Ref())); + Buffer_Send_Var[jPoint] = sqrt(solver[FLOW_SOL]->GetNodes()->GetVelocity2(iPoint))*config->GetVelocity_Ref()/ + sqrt(config->GetBulk_Modulus()/(solver[FLOW_SOL]->GetNodes()->GetDensity(iPoint)*config->GetDensity_Ref())); } jPoint++; } @@ -2929,7 +2928,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the temperature and laminar viscosity variables. ---*/ - Buffer_Send_Res[jPoint] = solver[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + Buffer_Send_Res[jPoint] = solver[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); jPoint++; } @@ -3142,7 +3141,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the pressure and mach variables. ---*/ - Buffer_Send_Var[jPoint] = solver[FLOW_SOL]->node[iPoint]->GetEddyViscosity(); + Buffer_Send_Var[jPoint] = solver[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint); jPoint++; } @@ -3274,9 +3273,9 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver Buffer_Send_Var[jPoint] = Aux_Sens[iPoint]; if ((config->GetKind_ConvNumScheme() == SPACE_CENTERED) && (!config->GetDiscrete_Adjoint())) - Buffer_Send_Res[jPoint] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensor(iPoint); + Buffer_Send_Res[jPoint] = solver[ADJFLOW_SOL]->GetNodes()->GetSensor(iPoint, iPoint); if ((config->GetKind_ConvNumScheme() == SPACE_UPWIND) && (!config->GetDiscrete_Adjoint())) - Buffer_Send_Res[jPoint] = solver[ADJFLOW_SOL]->node[iPoint]->GetLimiter(0); + Buffer_Send_Res[jPoint] = solver[ADJFLOW_SOL]->GetNodes()->GetLimiter(iPoint, 0); jPoint++; } @@ -3334,10 +3333,10 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the skin friction, heat transfer, y+ variables. ---*/ - Buffer_Send_Var[jPoint] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensitivity(0); - Buffer_Send_Res[jPoint] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensitivity(1); + Buffer_Send_Var[jPoint] = solver[ADJFLOW_SOL]->GetNodes()->GetSensitivity(iPoint, 0); + Buffer_Send_Res[jPoint] = solver[ADJFLOW_SOL]->GetNodes()->GetSensitivity(iPoint, 1); if (nDim == 3) - Buffer_Send_Vol[jPoint] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensitivity(2); + Buffer_Send_Vol[jPoint] = solver[ADJFLOW_SOL]->GetNodes()->GetSensitivity(iPoint, 2); jPoint++; } } @@ -3396,7 +3395,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the three grid velocity components. ---*/ - Node_Vel = solver[FEA_SOL]->node[iPoint]->GetSolution_Vel(); + Node_Vel = solver[FEA_SOL]->GetNodes()->GetSolution_Vel(iPoint); Buffer_Send_Var[jPoint] = Node_Vel[0]; Buffer_Send_Res[jPoint] = Node_Vel[1]; if (geometry->GetnDim() == 3) Buffer_Send_Vol[jPoint] = Node_Vel[2]; @@ -3459,7 +3458,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the three grid velocity components. ---*/ - Node_Accel = solver[FEA_SOL]->node[iPoint]->GetSolution_Accel(); + Node_Accel = solver[FEA_SOL]->GetNodes()->GetSolution_Accel(iPoint); Buffer_Send_Var[jPoint] = Node_Accel[0]; Buffer_Send_Res[jPoint] = Node_Accel[1]; if (geometry->GetnDim() == 3) Buffer_Send_Vol[jPoint] = Node_Accel[2]; @@ -3522,7 +3521,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the three grid velocity components. ---*/ - Stress = solver[FEA_SOL]->node[iPoint]->GetStress_FEM(); + Stress = solver[FEA_SOL]->GetNodes()->GetStress_FEM(iPoint); /*--- Sigma xx ---*/ Buffer_Send_Var[jPoint] = Stress[0]; /*--- Sigma yy ---*/ @@ -3583,7 +3582,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the three grid velocity components. ---*/ - Stress = solver[FEA_SOL]->node[iPoint]->GetStress_FEM(); + Stress = solver[FEA_SOL]->GetNodes()->GetStress_FEM(iPoint); /*--- Sigma zz ---*/ Buffer_Send_Var[jPoint] = Stress[3]; /*--- Sigma xz ---*/ @@ -3645,7 +3644,7 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the temperature and laminar viscosity variables. ---*/ - Buffer_Send_Var[jPoint] = solver[FEA_SOL]->node[iPoint]->GetVonMises_Stress(); + Buffer_Send_Var[jPoint] = solver[FEA_SOL]->GetNodes()->GetVonMises_Stress(iPoint); jPoint++; } } @@ -3691,10 +3690,10 @@ void COutputLegacy::MergeSolution(CConfig *config, CGeometry *geometry, CSolver /*--- Load buffers with the skin friction, heat transfer, y+ variables. ---*/ - Buffer_Send_Var[jPoint] = solver[ADJFEA_SOL]->node[iPoint]->GetGeometry_CrossTerm_Derivative(0); - Buffer_Send_Res[jPoint] = solver[ADJFEA_SOL]->node[iPoint]->GetGeometry_CrossTerm_Derivative(1); + Buffer_Send_Var[jPoint] = solver[ADJFEA_SOL]->GetNodes()->GetGeometry_CrossTerm_Derivative(iPoint, 0); + Buffer_Send_Res[jPoint] = solver[ADJFEA_SOL]->GetNodes()->GetGeometry_CrossTerm_Derivative(iPoint, 1); if (geometry->GetnDim() == 3) - Buffer_Send_Vol[jPoint] = solver[ADJFEA_SOL]->node[iPoint]->GetGeometry_CrossTerm_Derivative(2); + Buffer_Send_Vol[jPoint] = solver[ADJFEA_SOL]->GetNodes()->GetGeometry_CrossTerm_Derivative(iPoint, 2); jPoint++; } } @@ -3891,7 +3890,7 @@ void COutputLegacy::MergeBaselineSolution(CConfig *config, CGeometry *geometry, unsigned short jVar = 0; for (iVar = 0; iVar < nVar_Total; iVar++) { - Data[jVar][jPoint] = solver->node[iPoint]->GetSolution(iVar); + Data[jVar][jPoint] = solver->GetNodes()->GetSolution(iPoint,iVar); jVar++; } } @@ -4002,7 +4001,7 @@ void COutputLegacy::MergeBaselineSolution(CConfig *config, CGeometry *geometry, if (!Local_Halo[iPoint] || Wrt_Halo) { /*--- Get this variable into the temporary send buffer. ---*/ - Buffer_Send_Var[jPoint] = solver->node[iPoint]->GetSolution(iVar); + Buffer_Send_Var[jPoint] = solver->GetNodes()->GetSolution(iPoint,iVar); /*--- Only send/recv the volumes & global indices during the first loop ---*/ if (iVar == 0) { @@ -8894,7 +8893,7 @@ void COutputLegacy::SpecialOutput_SpanLoad(CSolver *solver, CGeometry *geometry, /*--- Copy the pressure to an auxiliar structure ---*/ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - CPressure[iPoint] = (solver->node[iPoint]->GetPressure() + CPressure[iPoint] = (solver->GetNodes()->GetPressure(iPoint) - RefPressure) * factor * RefArea; } @@ -9662,7 +9661,7 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry } if (AzimuthalAngle[nVertex_NearField] <= 60) { - Pressure[nVertex_NearField] = solver->node[iPoint]->GetPressure(); + Pressure[nVertex_NearField] = solver->GetNodes()->GetPressure(iPoint); FaceArea[nVertex_NearField] = fabs(Face_Normal[nDim-1]); nVertex_NearField ++; } @@ -9760,7 +9759,7 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry Buffer_Send_Xcoord[nLocalVertex_NearField] = geometry->node[iPoint]->GetCoord(0); Buffer_Send_Ycoord[nLocalVertex_NearField] = geometry->node[iPoint]->GetCoord(1); Buffer_Send_Zcoord[nLocalVertex_NearField] = geometry->node[iPoint]->GetCoord(2); - Buffer_Send_Pressure[nLocalVertex_NearField] = solver->node[iPoint]->GetPressure(); + Buffer_Send_Pressure[nLocalVertex_NearField] = solver->GetNodes()->GetPressure(iPoint); Buffer_Send_FaceArea[nLocalVertex_NearField] = fabs(Face_Normal[nDim-1]); nLocalVertex_NearField++; } @@ -10349,11 +10348,11 @@ void COutputLegacy::SpecialOutput_Distortion(CSolver *solver, CGeometry *geometr Buffer_Send_Coord_y[nVertex_Surface] = geometry->node[iPoint]->GetCoord(1); if (nDim == 3) { Buffer_Send_Coord_z[nVertex_Surface] = geometry->node[iPoint]->GetCoord(2); } - Pressure = solver->node[iPoint]->GetPressure(); - Density = solver->node[iPoint]->GetDensity(); - Temperature = solver->node[iPoint]->GetTemperature(); - SoundSpeed = solver->node[iPoint]->GetSoundSpeed(); - Velocity2 = solver->node[iPoint]->GetVelocity2(); + Pressure = solver->GetNodes()->GetPressure(iPoint); + Density = solver->GetNodes()->GetDensity(iPoint); + Temperature = solver->GetNodes()->GetTemperature(iPoint); + SoundSpeed = solver->GetNodes()->GetSoundSpeed(iPoint); + Velocity2 = solver->GetNodes()->GetVelocity2(iPoint); Mach = sqrt(Velocity2)/SoundSpeed; Gamma = config->GetGamma(); @@ -10376,10 +10375,10 @@ void COutputLegacy::SpecialOutput_Distortion(CSolver *solver, CGeometry *geometr TotalTemperature_Inf = Temperature_Inf * (1.0 + Mach * Mach * 0.5 * (Gamma - 1.0)); Buffer_Send_TT[nVertex_Surface] = TotalTemperature / TotalTemperature_Inf; - Buffer_Send_Vel_x[nVertex_Surface] = solver->node[iPoint]->GetVelocity(0) / Velocity_Inf; - Buffer_Send_Vel_y[nVertex_Surface] = solver->node[iPoint]->GetVelocity(1) / Velocity_Inf; + Buffer_Send_Vel_x[nVertex_Surface] = solver->GetNodes()->GetVelocity(iPoint,0) / Velocity_Inf; + Buffer_Send_Vel_y[nVertex_Surface] = solver->GetNodes()->GetVelocity(iPoint,1) / Velocity_Inf; if (nDim == 3) { - Buffer_Send_Vel_z[nVertex_Surface] = solver->node[iPoint]->GetVelocity(2) / Velocity_Inf; + Buffer_Send_Vel_z[nVertex_Surface] = solver->GetNodes()->GetVelocity(iPoint,2) / Velocity_Inf; } Buffer_Send_q[nVertex_Surface] = 0.5*Density*Velocity2; @@ -11623,10 +11622,10 @@ void COutputLegacy::SetSensitivity_Files(CGeometry ***geometry, CConfig **config for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iDim = 0; iDim < nDim; iDim++) { - solver[iZone][INST_0]->node[iPoint]->SetSolution(iDim, geometry[iZone][INST_0]->node[iPoint]->GetCoord(iDim)); + solver[iZone][INST_0]->GetNodes()->SetSolution(iPoint, iDim, geometry[iZone][INST_0]->node[iPoint]->GetCoord(iDim)); } for (iVar = 0; iVar < nDim; iVar++) { - solver[iZone][INST_0]->node[iPoint]->SetSolution(iVar+nDim, geometry[iZone][INST_0]->GetSensitivity(iPoint, iVar)); + solver[iZone][INST_0]->GetNodes()->SetSolution(iPoint, iVar+nDim, geometry[iZone][INST_0]->GetSensitivity(iPoint, iVar)); } } @@ -11666,7 +11665,7 @@ void COutputLegacy::SetSensitivity_Files(CGeometry ***geometry, CConfig **config Sens = Prod/Area; - solver[iZone][INST_0]->node[iPoint]->SetSolution(2*nDim, Sens); + solver[iZone][INST_0]->GetNodes()->SetSolution(iPoint, 2*nDim, Sens); } } @@ -13043,7 +13042,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo /*--- Load the conservative variable states for the mean flow variables. ---*/ for (jVar = 0; jVar < nVar_First; jVar++) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, jVar); iVar++; } @@ -13052,7 +13051,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo if (SecondIndex != NONE) { for (jVar = 0; jVar < nVar_Second; jVar++) { - Local_Data[jPoint][iVar] = solver[SecondIndex]->node[iPoint]->GetSolution(jVar); + Local_Data[jPoint][iVar] = solver[SecondIndex]->GetNodes()->GetSolution(iPoint, jVar); iVar++; } } @@ -13063,13 +13062,13 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo if (config->GetWrt_Limiters()) { /*--- Mean Flow Limiters ---*/ for (jVar = 0; jVar < nVar_First; jVar++) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetLimiter_Primitive(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetLimiter_Primitive(iPoint, jVar); iVar++; } /*--- RANS Limiters ---*/ if (SecondIndex != NONE) { for (jVar = 0; jVar < nVar_Second; jVar++) { - Local_Data[jPoint][iVar] = solver[SecondIndex]->node[iPoint]->GetLimiter_Primitive(jVar); + Local_Data[jPoint][iVar] = solver[SecondIndex]->GetNodes()->GetLimiter_Primitive(iPoint, jVar); iVar++; } } @@ -13107,16 +13106,16 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo /*--- Load data for the pressure, temperature, Cp, and Mach variables. ---*/ - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetPressure(); iVar++; - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetTemperature(); iVar++; - Local_Data[jPoint][iVar] = sqrt(solver[FLOW_SOL]->node[iPoint]->GetVelocity2())/solver[FLOW_SOL]->node[iPoint]->GetSoundSpeed(); iVar++; - Local_Data[jPoint][iVar] = (solver[FLOW_SOL]->node[iPoint]->GetPressure() - RefPressure)*factor*RefArea; iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetPressure(iPoint); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); iVar++; + Local_Data[jPoint][iVar] = sqrt(solver[FLOW_SOL]->GetNodes()->GetVelocity2(iPoint))/solver[FLOW_SOL]->GetNodes()->GetSoundSpeed(iPoint); iVar++; + Local_Data[jPoint][iVar] = (solver[FLOW_SOL]->GetNodes()->GetPressure(iPoint) - RefPressure)*factor*RefArea; iVar++; if ((Kind_Solver == NAVIER_STOKES) || (Kind_Solver == RANS)) { /*--- Load data for the laminar viscosity. ---*/ - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); iVar++; /*--- Load data for the skin friction, heat flux, buffet, and y-plus. ---*/ @@ -13138,7 +13137,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo if (Kind_Solver == RANS) { Local_Data[jPoint][iVar] = Aux_yPlus[iPoint]; iVar++; - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetEddyViscosity(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint); iVar++; } /*--- Load data for the distance to the nearest sharp edge. ---*/ @@ -13150,16 +13149,16 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo /*--- Load data for the intermittency of the BC trans. model. ---*/ if (transition) { - Local_Data[jPoint][iVar] = solver[TURB_SOL]->node[iPoint]->GetGammaBC(); iVar++; + Local_Data[jPoint][iVar] = solver[TURB_SOL]->GetNodes()->GetGammaBC(iPoint); iVar++; } if (config->GetKind_HybridRANSLES()!=NO_HYBRIDRANSLES){ - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetDES_LengthScale(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetDES_LengthScale(iPoint); iVar++; Local_Data[jPoint][iVar] = geometry->node[iPoint]->GetWall_Distance(); iVar++; } if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetRoe_Dissipation(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetRoe_Dissipation(iPoint); iVar++; } if (solver[FLOW_SOL]->VerificationSolution) { @@ -13171,7 +13170,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo /* Set the pointers to the coordinates and solution of this DOF. */ const su2double *coor = geometry->node[iPoint]->GetCoord(); - su2double *solDOF = solver[FLOW_SOL]->node[iPoint]->GetSolution(); + su2double *solDOF = solver[FLOW_SOL]->GetNodes()->GetSolution(iPoint); su2double mmsSol[5] = {0.0,0.0,0.0,0.0,0.0}; su2double error[5] = {0.0,0.0,0.0,0.0,0.0}; @@ -13196,17 +13195,17 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo assuming they were registered above correctly. ---*/ if ((Kind_Solver == NAVIER_STOKES) || (Kind_Solver == RANS)) { - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetVorticity()[0]; iVar++; - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetVorticity()[1]; iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint)[0]; iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint)[1]; iVar++; if (geometry->GetnDim() == 3) { - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetVorticity()[2]; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint)[2]; iVar++; } if (nDim == 3){ for (iDim = 0; iDim < nDim; iDim++) { for (unsigned short jDim = 0; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = solver[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = solver[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint, iDim+1, jDim); } } @@ -13233,7 +13232,7 @@ void COutputLegacy::LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSo if (rotating_frame) { Grid_Vel = geometry->node[iPoint]->GetGridVel(); - su2double *Solution = solver[FLOW_SOL]->node[iPoint]->GetSolution(); + su2double *Solution = solver[FLOW_SOL]->GetNodes()->GetSolution(iPoint); Local_Data[jPoint][iVar] = Solution[1]/Solution[0] - Grid_Vel[0]; iVar++; Local_Data[jPoint][iVar] = Solution[2]/Solution[0] - Grid_Vel[1]; iVar++; if (geometry->GetnDim() == 3) { @@ -13675,17 +13674,17 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, /*--- Load the conservative variable states for the mean flow variables. ---*/ - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(0); iVar++; - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(1); iVar++; - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(2); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 0); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 1); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 2); iVar++; if (nDim == 3) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(3); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 3); iVar++; } if (weakly_coupled_heat) { - Local_Data[jPoint][iVar] = solver[HEAT_SOL]->node[iPoint]->GetSolution(0); + Local_Data[jPoint][iVar] = solver[HEAT_SOL]->GetNodes()->GetSolution(iPoint, 0); iVar++; } else if (energy) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(nDim+1); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, nDim+1); iVar++; } @@ -13694,7 +13693,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, if (SecondIndex != NONE) { for (jVar = 0; jVar < nVar_Second; jVar++) { - Local_Data[jPoint][iVar] = solver[SecondIndex]->node[iPoint]->GetSolution(jVar); iVar++; + Local_Data[jPoint][iVar] = solver[SecondIndex]->GetNodes()->GetSolution(iPoint, jVar); iVar++; } } @@ -13704,13 +13703,13 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, if (config->GetWrt_Limiters()) { /*--- Mean Flow Limiters ---*/ for (jVar = 0; jVar < nVar_First; jVar++) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetLimiter_Primitive(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetLimiter_Primitive(iPoint, jVar); iVar++; } /*--- RANS Limiters ---*/ if (SecondIndex != NONE) { for (jVar = 0; jVar < nVar_Second; jVar++) { - Local_Data[jPoint][iVar] = solver[SecondIndex]->node[iPoint]->GetLimiter_Primitive(jVar); + Local_Data[jPoint][iVar] = solver[SecondIndex]->GetNodes()->GetLimiter_Primitive(iPoint, jVar); iVar++; } } @@ -13723,6 +13722,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, Local_Data[jPoint][iVar] = solver[FirstIndex]->LinSysRes.GetBlock(iPoint, jVar); iVar++; } + /*--- RANS Residuals ---*/ if (SecondIndex != NONE) { for (jVar = 0; jVar < nVar_Second; jVar++) { @@ -13733,7 +13733,6 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, } - /*--- Load buffers with the three grid velocity components. ---*/ if (dynamic_grid) { @@ -13748,13 +13747,13 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, /*--- Load data for Cp and Mach variables. ---*/ - Local_Data[jPoint][iVar] = (solver[FLOW_SOL]->node[iPoint]->GetPressure() - RefPressure)*factor*RefArea; iVar++; + Local_Data[jPoint][iVar] = (solver[FLOW_SOL]->GetNodes()->GetPressure(iPoint) - RefPressure)*factor*RefArea; iVar++; if ((Kind_Solver == INC_NAVIER_STOKES) || (Kind_Solver == INC_RANS)) { /*--- Load data for the laminar viscosity. ---*/ - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); iVar++; /*--- Load data for the skin friction, heat flux, and y-plus. ---*/ @@ -13775,7 +13774,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, if (Kind_Solver == INC_RANS) { Local_Data[jPoint][iVar] = Aux_yPlus[iPoint]; iVar++; - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetEddyViscosity(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint); iVar++; } /*--- Load data for the distance to the nearest sharp edge. ---*/ @@ -13787,22 +13786,22 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, /*--- Load data for the intermittency of the BC trans. model. ---*/ if (transition) { - Local_Data[jPoint][iVar] = solver[TURB_SOL]->node[iPoint]->GetGammaBC(); iVar++; + Local_Data[jPoint][iVar] = solver[TURB_SOL]->GetNodes()->GetGammaBC(iPoint); iVar++; } /*--- Load density if we are solving a variable density problem. ---*/ if (variable_density) { - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetDensity(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetDensity(iPoint); iVar++; } /*--- Load Cp and conductivity if they are temperature-dependent. ---*/ if (wrt_cp) { - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetSpecificHeatCp(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetSpecificHeatCp(iPoint); iVar++; } if (wrt_kt) { - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetThermalConductivity(); iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetThermalConductivity(iPoint); iVar++; } if (solver[FLOW_SOL]->VerificationSolution) { @@ -13814,7 +13813,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, /* Set the pointers to the coordinates and solution of this DOF. */ const su2double *coor = geometry->node[iPoint]->GetCoord(); - su2double *solDOF = solver[FLOW_SOL]->node[iPoint]->GetSolution(); + su2double *solDOF = solver[FLOW_SOL]->GetNodes()->GetSolution(iPoint); su2double mmsSol[5] = {0.0,0.0,0.0,0.0,0.0}; su2double error[5] = {0.0,0.0,0.0,0.0,0.0}; @@ -13837,14 +13836,14 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, if ((Kind_Solver == INC_NAVIER_STOKES) || (Kind_Solver == INC_RANS)) { - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetVorticity()[0]; iVar++; - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetVorticity()[1]; iVar++; - Local_Data[jPoint][iVar] = solver[FLOW_SOL]->node[iPoint]->GetVorticity()[2]; iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint)[0]; iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint)[1]; iVar++; + Local_Data[jPoint][iVar] = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint)[2]; iVar++; if (nDim == 3){ for (iDim = 0; iDim < nDim; iDim++) { for (unsigned short jDim = 0; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = solver[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = solver[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint, iDim+1, jDim); } } @@ -14197,7 +14196,7 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry, If requested, load the limiters and residuals as well. ---*/ for (jVar = 0; jVar < nVar_First; jVar++) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, jVar); iVar++; } @@ -14208,7 +14207,7 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry, if (SecondIndex != NONE) { for (jVar = 0; jVar < nVar_Second; jVar++) { - Local_Data[jPoint][iVar] = solver[SecondIndex]->node[iPoint]->GetSolution(jVar); + Local_Data[jPoint][iVar] = solver[SecondIndex]->GetNodes()->GetSolution(iPoint, jVar); iVar++; } } @@ -14221,22 +14220,22 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry, (Kind_Solver == DISC_ADJ_INC_EULER) || (Kind_Solver == DISC_ADJ_INC_NAVIER_STOKES) || (Kind_Solver == DISC_ADJ_INC_RANS)) { - Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensitivity(0); iVar++; - Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensitivity(1); iVar++; + Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->GetNodes()->GetSensitivity(iPoint, 0); iVar++; + Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->GetNodes()->GetSensitivity(iPoint, 1); iVar++; if (geometry->GetnDim()== 3) { - Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensitivity(2); + Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->GetNodes()->GetSensitivity(iPoint, 2); iVar++; } } if (config->GetWrt_Limiters()) { for (jVar = 0; jVar < nVar_First; jVar++) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetLimiter(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetLimiter(iPoint, jVar); iVar++; } if (SecondIndex != NONE) { for (jVar = 0; jVar < nVar_Second; jVar++) { - Local_Data[jPoint][iVar] = solver[SecondIndex]->node[iPoint]->GetLimiter(jVar); + Local_Data[jPoint][iVar] = solver[SecondIndex]->GetNodes()->GetLimiter(iPoint, jVar); iVar++; } } @@ -14247,8 +14246,8 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry, if (!config->GetDiscrete_Adjoint()) { Local_Data[jPoint][iVar] = solver[FirstIndex]->LinSysRes.GetBlock(iPoint, jVar); } else { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(jVar) - - solver[FirstIndex]->node[iPoint]->GetSolution_Old(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, jVar) - + solver[FirstIndex]->GetNodes()->GetSolution_Old(iPoint, jVar); } iVar++; } @@ -14257,8 +14256,8 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry, if (!config->GetDiscrete_Adjoint()) { Local_Data[jPoint][iVar] = solver[SecondIndex]->LinSysRes.GetBlock(iPoint, jVar); } else { - Local_Data[jPoint][iVar] = solver[SecondIndex]->node[iPoint]->GetSolution(jVar) - - solver[SecondIndex]->node[iPoint]->GetSolution_Old(jVar); + Local_Data[jPoint][iVar] = solver[SecondIndex]->GetNodes()->GetSolution(iPoint, jVar) - + solver[SecondIndex]->GetNodes()->GetSolution_Old(iPoint, jVar); } iVar++; } @@ -14287,9 +14286,9 @@ void COutputLegacy::LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry, ( Kind_Solver == ADJ_NAVIER_STOKES ) || ( Kind_Solver == ADJ_RANS )) { if (config->GetKind_ConvNumScheme() == SPACE_CENTERED) { - Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->node[iPoint]->GetSensor(iPoint); iVar++; + Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->GetNodes()->GetSensor(iPoint); iVar++; } else { - Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->node[iPoint]->GetLimiter(0); iVar++; + Local_Data[jPoint][iVar] = solver[ADJFLOW_SOL]->GetNodes()->GetLimiter(iPoint, 0); iVar++; } } @@ -14503,7 +14502,7 @@ void COutputLegacy::LoadLocalData_Elasticity(CConfig *config, CGeometry *geometr If requested, load the limiters and residuals as well. ---*/ for (jVar = 0; jVar < nVar_First; jVar++) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, jVar); iVar++; } @@ -14522,7 +14521,7 @@ void COutputLegacy::LoadLocalData_Elasticity(CConfig *config, CGeometry *geometr /*--- Velocities ---*/ - Node_Vel = solver[FEA_SOL]->node[iPoint]->GetSolution_Vel(); + Node_Vel = solver[FEA_SOL]->GetNodes()->GetSolution_Vel(iPoint); Local_Data[jPoint][iVar] = Node_Vel[0]; iVar++; Local_Data[jPoint][iVar] = Node_Vel[1]; iVar++; if (geometry->GetnDim() == 3) { @@ -14532,7 +14531,7 @@ void COutputLegacy::LoadLocalData_Elasticity(CConfig *config, CGeometry *geometr /*--- Accelerations ---*/ - Node_Accel = solver[FEA_SOL]->node[iPoint]->GetSolution_Accel(); + Node_Accel = solver[FEA_SOL]->GetNodes()->GetSolution_Accel(iPoint); Local_Data[jPoint][iVar] = Node_Accel[0]; iVar++; Local_Data[jPoint][iVar] = Node_Accel[1]; iVar++; if (geometry->GetnDim() == 3) { @@ -14545,7 +14544,7 @@ void COutputLegacy::LoadLocalData_Elasticity(CConfig *config, CGeometry *geometr /*--- Add the stresses. ---*/ - Stress = solver[FEA_SOL]->node[iPoint]->GetStress_FEM(); + Stress = solver[FEA_SOL]->GetNodes()->GetStress_FEM(iPoint); /*--- Sigma xx ---*/ Local_Data[jPoint][iVar] = Stress[0]; iVar++; @@ -14565,7 +14564,7 @@ void COutputLegacy::LoadLocalData_Elasticity(CConfig *config, CGeometry *geometr /*--- Add the Von Mises Stress. ---*/ - Local_Data[iPoint][iVar] = solver[FEA_SOL]->node[iPoint]->GetVonMises_Stress(); iVar++; + Local_Data[iPoint][iVar] = solver[FEA_SOL]->GetNodes()->GetVonMises_Stress(iPoint); iVar++; /*--- New variables can be loaded to the Local_Data structure here, @@ -14729,7 +14728,7 @@ void COutputLegacy::LoadLocalData_Base(CConfig *config, CGeometry *geometry, CSo If requested, load the limiters and residuals as well. ---*/ for (jVar = 0; jVar < nVar_First; jVar++) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->node[iPoint]->GetSolution(jVar); + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, jVar); iVar++; } @@ -19005,12 +19004,12 @@ void COutputLegacy::SpecialOutput_AnalyzeSurface(CSolver *solver, CGeometry *geo AxiFactor = 1.0; } - Density = solver->node[iPoint]->GetDensity(); + Density = solver->GetNodes()->GetDensity(iPoint); Velocity2 = 0.0; Area = 0.0; MassFlow = 0.0; Vn = 0.0; Vtang2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) { Area += (Vector[iDim] * AxiFactor) * (Vector[iDim] * AxiFactor); - Velocity[iDim] = solver->node[iPoint]->GetVelocity(iDim); + Velocity[iDim] = solver->GetNodes()->GetVelocity(iPoint,iDim); Velocity2 += Velocity[iDim] * Velocity[iDim]; Vn += Velocity[iDim] * Vector[iDim] * AxiFactor; MassFlow += Vector[iDim] * AxiFactor * Density * Velocity[iDim]; @@ -19019,8 +19018,8 @@ void COutputLegacy::SpecialOutput_AnalyzeSurface(CSolver *solver, CGeometry *geo Area = sqrt (Area); if (AxiFactor == 0.0) Vn = 0.0; else Vn /= Area; Vn2 = Vn * Vn; - Pressure = solver->node[iPoint]->GetPressure(); - SoundSpeed = solver->node[iPoint]->GetSoundSpeed(); + Pressure = solver->GetNodes()->GetPressure(iPoint); + SoundSpeed = solver->GetNodes()->GetSoundSpeed(iPoint); for (iDim = 0; iDim < nDim; iDim++) { TangVel[iDim] = Velocity[iDim] - Vn*Vector[iDim]*AxiFactor/Area; @@ -19029,21 +19028,21 @@ void COutputLegacy::SpecialOutput_AnalyzeSurface(CSolver *solver, CGeometry *geo if (incompressible){ if (config->GetKind_DensityModel() == VARIABLE) { - Mach = sqrt(solver->node[iPoint]->GetVelocity2())/ - sqrt(solver->node[iPoint]->GetSpecificHeatCp()*config->GetPressure_ThermodynamicND()/(solver->node[iPoint]->GetSpecificHeatCv()*solver->node[iPoint]->GetDensity())); + Mach = sqrt(solver->GetNodes()->GetVelocity2(iPoint))/ + sqrt(solver->GetNodes()->GetSpecificHeatCp(iPoint)*config->GetPressure_ThermodynamicND()/(solver->GetNodes()->GetSpecificHeatCv(iPoint)*solver->GetNodes()->GetDensity(iPoint))); } else { - Mach = sqrt(solver->node[iPoint]->GetVelocity2())/ - sqrt(config->GetBulk_Modulus()/(solver->node[iPoint]->GetDensity())); + Mach = sqrt(solver->GetNodes()->GetVelocity2(iPoint))/ + sqrt(config->GetBulk_Modulus()/(solver->GetNodes()->GetDensity(iPoint))); } - Temperature = solver->node[iPoint]->GetTemperature(); - Enthalpy = solver->node[iPoint]->GetSpecificHeatCp()*Temperature; - TotalTemperature = Temperature + 0.5*Velocity2/solver->node[iPoint]->GetSpecificHeatCp(); + Temperature = solver->GetNodes()->GetTemperature(iPoint); + Enthalpy = solver->GetNodes()->GetSpecificHeatCp(iPoint)*Temperature; + TotalTemperature = Temperature + 0.5*Velocity2/solver->GetNodes()->GetSpecificHeatCp(iPoint); TotalPressure = Pressure + 0.5*Density*Velocity2; } else{ Mach = sqrt(Velocity2)/SoundSpeed; Temperature = Pressure / (Gas_Constant * Density); - Enthalpy = solver->node[iPoint]->GetEnthalpy(); + Enthalpy = solver->GetNodes()->GetEnthalpy(iPoint); TotalTemperature = Temperature * (1.0 + Mach * Mach * 0.5 * (Gamma - 1.0)); TotalPressure = Pressure * pow( 1.0 + Mach * Mach * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0)); } diff --git a/SU2_CFD/src/python_wrapper_structure.cpp b/SU2_CFD/src/python_wrapper_structure.cpp index 501939b3be6a..049cf2134179 100644 --- a/SU2_CFD/src/python_wrapper_structure.cpp +++ b/SU2_CFD/src/python_wrapper_structure.cpp @@ -47,21 +47,21 @@ void CDriver::PythonInterface_Preprocessing(CConfig **config, CGeometry ****geom /* --- Initialize boundary conditions customization, this is achieve through the Python wrapper --- */ for(iZone=0; iZone < nZone; iZone++){ - + if (config[iZone]->GetnMarker_PyCustom() > 0){ - + if (rank == MASTER_NODE) cout << endl << "----------------- Python Interface Preprocessing ( Zone "<< iZone <<" ) -----------------" << endl; - + if (rank == MASTER_NODE) cout << "Setting customized boundary conditions for zone " << iZone << endl; for (iMesh = 0; iMesh <= config[iZone]->GetnMGLevels(); iMesh++) { geometry[iZone][INST_0][iMesh]->SetCustomBoundary(config[iZone]); } geometry[iZone][INST_0][MESH_0]->UpdateCustomBoundaryConditions(geometry[iZone][INST_0], config[iZone]); - + if ((config[iZone]->GetKind_Solver() == EULER) || (config[iZone]->GetKind_Solver() == NAVIER_STOKES) || (config[iZone]->GetKind_Solver() == RANS)) { - + solver[iZone][INST_0][MESH_0][FLOW_SOL]->UpdateCustomBoundaryConditions(geometry[iZone][INST_0], config[iZone]); } } @@ -391,14 +391,14 @@ bool CDriver::ComputeVertexForces(unsigned short iMarker, unsigned short iVertex Area = sqrt(AreaSquare); /*--- Get the values of pressure and viscosity ---*/ - Pn = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetPressure(); + Pn = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetPressure(iPoint); if (viscous_flow) { for(iDim=0; iDimnode[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = solver_container[ZONE_0][INST_0][FinestMesh][FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint, iDim+1, jDim); } } - Viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + Viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); } /*--- Calculate the inviscid (pressure) part of tn in the fluid nodes (force units) ---*/ @@ -523,11 +523,11 @@ passivedouble CDriver::GetVertexTemperature(unsigned short iMarker, unsigned sho su2double vertexWallTemp(0.0); bool compressible = (config_container[ZONE_0]->GetKind_Regime() == COMPRESSIBLE); - + iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); if(geometry_container[ZONE_0][INST_0][MESH_0]->node[iPoint]->GetDomain() && compressible){ - vertexWallTemp = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetTemperature(); + vertexWallTemp = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetTemperature(iPoint); } return SU2_TYPE::GetValue(vertexWallTemp); @@ -564,10 +564,10 @@ bool CDriver::ComputeVertexHeatFluxes(unsigned short iMarker, unsigned short iVe } if(!halo && compressible){ - laminar_viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + laminar_viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); thermal_conductivity = Cp * (laminar_viscosity/Prandtl_Lam); for(iDim=0; iDim < nDim; iDim++){ - GradT[iDim] = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetGradient_Primitive(0, iDim); + GradT[iDim] = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint, 0, iDim); PyWrapNodalHeatFlux[iDim] = -thermal_conductivity*GradT[iDim]; } } @@ -605,7 +605,7 @@ passivedouble CDriver::GetVertexNormalHeatFlux(unsigned short iMarker, unsigned su2double *Normal, GradT[3] = {0.0,0.0,0.0}, UnitNormal[3] = {0.0,0.0,0.0}; bool compressible = (config_container[ZONE_0]->GetKind_Regime() == COMPRESSIBLE); - + vertexWallHeatFlux = 0.0; dTdn = 0.0; @@ -621,11 +621,11 @@ passivedouble CDriver::GetVertexNormalHeatFlux(unsigned short iMarker, unsigned for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim]/Area; - laminar_viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + laminar_viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); thermal_conductivity = Cp * (laminar_viscosity/Prandtl_Lam); /*Compute wall heat flux (normal to the wall) based on computed temperature gradient*/ for(iDim=0; iDim < nDim; iDim++){ - GradT[iDim] = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetGradient_Primitive(0, iDim); + GradT[iDim] = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint, 0, iDim); dTdn += GradT[iDim]*UnitNormal[iDim]; } @@ -651,7 +651,7 @@ passivedouble CDriver::GetThermalConductivity(unsigned short iMarker, unsigned s su2double laminar_viscosity, thermal_conductivity; iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - laminar_viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + laminar_viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); thermal_conductivity = Cp * (laminar_viscosity/Prandtl_Lam); return SU2_TYPE::GetValue(thermal_conductivity); @@ -983,7 +983,7 @@ void CDriver::SetMeshDisplacement(unsigned short iMarker, unsigned long iVertex, iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->node[iPoint]->SetBound_Disp(PyWrapVarCoord); + solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->SetBound_Disp(iPoint,PyWrapVarCoord); } @@ -1006,10 +1006,10 @@ vector CDriver::GetMeshDisp_Sensitivity(unsigned short iMarker, u CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][ADJMESH_SOL]; CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; - Disp_Sens[0] = solver->node[iPoint]->GetBoundDisp_Sens(0); - Disp_Sens[1] = solver->node[iPoint]->GetBoundDisp_Sens(1); + Disp_Sens[0] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 0); + Disp_Sens[1] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 1); if (geometry->GetnDim() == 3) - Disp_Sens[2] = solver->node[iPoint]->GetBoundDisp_Sens(2); + Disp_Sens[2] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 2); else Disp_Sens[2] = 0.0; @@ -1030,7 +1030,7 @@ void CDriver::SetFEA_Loads(unsigned short iMarker, unsigned short iVertex, passi PyWrapNodalForce[2] = LoadZ; iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - solver_container[ZONE_0][INST_0][MESH_0][FEA_SOL]->node[iPoint]->Set_FlowTraction(PyWrapNodalForce); + solver_container[ZONE_0][INST_0][MESH_0][FEA_SOL]->GetNodes()->Set_FlowTraction(iPoint,PyWrapNodalForce); } @@ -1044,10 +1044,10 @@ vector CDriver::GetFEA_Displacements(unsigned short iMarker, unsi CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][FEA_SOL]; CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; - Displacements[0] = solver->node[iPoint]->GetSolution(0); - Displacements[1] = solver->node[iPoint]->GetSolution(1); + Displacements[0] = solver->GetNodes()->GetSolution(iPoint, 0); + Displacements[1] = solver->GetNodes()->GetSolution(iPoint, 1); if (geometry->GetnDim() == 3) - Displacements[2] = solver->node[iPoint]->GetSolution(2); + Displacements[2] = solver->GetNodes()->GetSolution(iPoint, 2); else Displacements[2] = 0.0; @@ -1070,10 +1070,10 @@ vector CDriver::GetFEA_Velocity(unsigned short iMarker, unsigned CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; if (config_container[ZONE_0]->GetDynamic_Analysis() == DYNAMIC){ - Velocity[0] = solver->node[iPoint]->GetSolution_Vel(0); - Velocity[1] = solver->node[iPoint]->GetSolution_Vel(1); + Velocity[0] = solver->GetNodes()->GetSolution_Vel(iPoint, 0); + Velocity[1] = solver->GetNodes()->GetSolution_Vel(iPoint, 1); if (geometry->GetnDim() == 3) - Velocity[2] = solver->node[iPoint]->GetSolution_Vel(2); + Velocity[2] = solver->GetNodes()->GetSolution_Vel(iPoint, 2); else Velocity[2] = 0.0; } @@ -1101,10 +1101,10 @@ vector CDriver::GetFEA_Velocity_n(unsigned short iMarker, unsigne CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; if (config_container[ZONE_0]->GetDynamic_Analysis() == DYNAMIC){ - Velocity_n[0] = solver->node[iPoint]->GetSolution_Vel_time_n(0); - Velocity_n[1] = solver->node[iPoint]->GetSolution_Vel_time_n(1); + Velocity_n[0] = solver->GetNodes()->GetSolution_Vel_time_n(iPoint, 0); + Velocity_n[1] = solver->GetNodes()->GetSolution_Vel_time_n(iPoint, 1); if (geometry->GetnDim() == 3) - Velocity_n[2] = solver->node[iPoint]->GetSolution_Vel_time_n(2); + Velocity_n[2] = solver->GetNodes()->GetSolution_Vel_time_n(iPoint, 2); else Velocity_n[2] = 0.0; } @@ -1132,10 +1132,10 @@ vector CDriver::GetFlowLoad_Sensitivity(unsigned short iMarker, u CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][ADJFEA_SOL]; CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; - FlowLoad_Sens[0] = solver->node[iPoint]->GetFlowTractionSensitivity(0); - FlowLoad_Sens[1] = solver->node[iPoint]->GetFlowTractionSensitivity(1); + FlowLoad_Sens[0] = solver->GetNodes()->GetFlowTractionSensitivity(iPoint, 0); + FlowLoad_Sens[1] = solver->GetNodes()->GetFlowTractionSensitivity(iPoint, 1); if (geometry->GetnDim() == 3) - FlowLoad_Sens[2] = solver->node[iPoint]->GetFlowTractionSensitivity(2); + FlowLoad_Sens[2] = solver->GetNodes()->GetFlowTractionSensitivity(iPoint, 2); else FlowLoad_Sens[2] = 0.0; @@ -1199,10 +1199,10 @@ void CDriver::SetSourceTerm_DispAdjoint(unsigned short iMarker, unsigned short i CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - solver->node[iPoint]->SetSourceTerm_DispAdjoint(0, val_AdjointX); - solver->node[iPoint]->SetSourceTerm_DispAdjoint(1, val_AdjointY); + solver->GetNodes()->SetSourceTerm_DispAdjoint(iPoint, 0, val_AdjointX); + solver->GetNodes()->SetSourceTerm_DispAdjoint(iPoint, 1, val_AdjointY); if (geometry->GetnDim() == 3) - solver->node[iPoint]->SetSourceTerm_DispAdjoint(2, val_AdjointZ); + solver->GetNodes()->SetSourceTerm_DispAdjoint(iPoint, 2, val_AdjointZ); } @@ -1217,10 +1217,10 @@ vector CDriver::GetVertex_UndeformedCoord(unsigned short iMarker, iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); if (solver != NULL) { - MeshCoord[0] = solver->node[iPoint]->GetMesh_Coord(0); - MeshCoord[1] = solver->node[iPoint]->GetMesh_Coord(1); + MeshCoord[0] = solver->GetNodes()->GetMesh_Coord(iPoint,0); + MeshCoord[1] = solver->GetNodes()->GetMesh_Coord(iPoint,1); if (geometry->GetnDim() == 3) - MeshCoord[2] = solver->node[iPoint]->GetMesh_Coord(2); + MeshCoord[2] = solver->GetNodes()->GetMesh_Coord(iPoint,2); else MeshCoord[2] = 0.0; } diff --git a/SU2_CFD/src/solver_adjoint_discrete.cpp b/SU2_CFD/src/solver_adjoint_discrete.cpp index ed6f368278ce..3aac9731a57f 100644 --- a/SU2_CFD/src/solver_adjoint_discrete.cpp +++ b/SU2_CFD/src/solver_adjoint_discrete.cpp @@ -49,15 +49,13 @@ CDiscAdjSolver::CDiscAdjSolver(CGeometry *geometry, CConfig *config) : CSolver( CDiscAdjSolver::CDiscAdjSolver(CGeometry *geometry, CConfig *config, CSolver *direct_solver, unsigned short Kind_Solver, unsigned short iMesh) : CSolver() { unsigned short iVar, iMarker, iDim; - unsigned long iVertex, iPoint; + unsigned long iVertex; string text_line, mesh_filename; ifstream restart_file; string filename, AdjExt; adjoint = true; - bool fsi = config->GetFSI_Simulation(); - nVar = direct_solver->GetnVar(); nDim = geometry->GetnDim(); @@ -74,10 +72,6 @@ CDiscAdjSolver::CDiscAdjSolver(CGeometry *geometry, CConfig *config, CSolver *di nPoint = geometry->GetnPoint(); nPointDomain = geometry->GetnPointDomain(); - /*--- Allocate the node variables ---*/ - - node = new CVariable*[nPoint]; - /*--- Define some auxiliary vectors related to the residual ---*/ Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 1.0; @@ -137,8 +131,8 @@ CDiscAdjSolver::CDiscAdjSolver(CGeometry *geometry, CConfig *config, CSolver *di /*--- Initialize the discrete adjoint solution to zero everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CDiscAdjVariable(Solution, nDim, nVar, config); + nodes = new CDiscAdjVariable(Solution, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); switch(KindDirect_Solver){ case RUNTIME_FLOW_SYS: @@ -167,6 +161,7 @@ CDiscAdjSolver::~CDiscAdjSolver(void) { delete [] CSensitivity; } + if (nodes != nullptr) delete nodes; } void CDiscAdjSolver::SetRecording(CGeometry* geometry, CConfig *config){ @@ -182,20 +177,20 @@ void CDiscAdjSolver::SetRecording(CGeometry* geometry, CConfig *config){ /*--- Reset the solution to the initial (converged) solution ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++) { - direct_solver->node[iPoint]->SetSolution(node[iPoint]->GetSolution_Direct()); + direct_solver->GetNodes()->SetSolution(iPoint, nodes->GetSolution_Direct(iPoint)); } if (time_n_needed) { for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - AD::ResetInput(direct_solver->node[iPoint]->GetSolution_time_n()[iVar]); + AD::ResetInput(direct_solver->GetNodes()->GetSolution_time_n(iPoint)[iVar]); } } } if (time_n1_needed) { for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - AD::ResetInput(direct_solver->node[iPoint]->GetSolution_time_n1()[iVar]); + AD::ResetInput(direct_solver->GetNodes()->GetSolution_time_n1(iPoint)[iVar]); } } } @@ -227,7 +222,7 @@ void CDiscAdjSolver::SetMesh_Recording(CGeometry** geometry, CVolumetricMovement for (iPoint = 0; iPoint < nPoint; iPoint++){ for (iDim = 0; iDim < nDim; iDim++){ - geometry[MESH_0]->node[iPoint]->SetCoord(iDim,node[iPoint]->GetGeometry_Direct(iDim)); + geometry[MESH_0]->node[iPoint]->SetCoord(iDim,nodes->GetGeometry_Direct(iPoint,iDim)); } } @@ -249,14 +244,14 @@ void CDiscAdjSolver::SetMesh_Recording(CGeometry** geometry, CVolumetricMovement // if (time_n_needed){ // for (iPoint = 0; iPoint < nPoint; iPoint++){ // for (iVar = 0; iVar < nVar; iVar++){ -// AD::ResetInput(direct_solver->node[iPoint]->GetSolution_time_n()[iVar]); +// AD::ResetInput(direct_solver->GetNodes()->GetSolution_time_n(iPoint,iVar)); // } // } // } // if (time_n1_needed){ // for (iPoint = 0; iPoint < nPoint; iPoint++){ // for (iVar = 0; iVar < nVar; iVar++){ -// AD::ResetInput(direct_solver->node[iPoint]->GetSolution_time_n1()[iVar]); +// AD::ResetInput(direct_solver->GetNodes()->GetSolution_time_n1(iPoint,iVar)); // } // } // } @@ -264,34 +259,25 @@ void CDiscAdjSolver::SetMesh_Recording(CGeometry** geometry, CVolumetricMovement } void CDiscAdjSolver::RegisterSolution(CGeometry *geometry, CConfig *config) { - unsigned long iPoint, nPoint = geometry->GetnPoint(); - bool time_n_needed = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)), - time_n1_needed = config->GetTime_Marching() == DT_STEPPING_2ND, - input = true; + bool time_n1_needed = (config->GetTime_Marching() == DT_STEPPING_2ND); + bool time_n_needed = (config->GetTime_Marching() == DT_STEPPING_1ST) || time_n1_needed; + bool input = true; /*--- Register solution at all necessary time instances and other variables on the tape ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) { - if(config->GetMultizone_Problem()) { - direct_solver->node[iPoint]->RegisterSolution_intIndexBased(input); - direct_solver->node[iPoint]->SetAdjIndices(input); - } - else { - direct_solver->node[iPoint]->RegisterSolution(input); - } - } - if (time_n_needed) { - for (iPoint = 0; iPoint < nPoint; iPoint++) { - direct_solver->node[iPoint]->RegisterSolution_time_n(); - } - } - if (time_n1_needed) { - for (iPoint = 0; iPoint < nPoint; iPoint++) { - direct_solver->node[iPoint]->RegisterSolution_time_n1(); - } + if(config->GetMultizone_Problem()) { + direct_solver->GetNodes()->RegisterSolution_intIndexBased(input); + direct_solver->GetNodes()->SetAdjIndices(input); + } else { + direct_solver->GetNodes()->RegisterSolution(input); } + + if (time_n_needed) + direct_solver->GetNodes()->RegisterSolution_time_n(); + + if (time_n1_needed) + direct_solver->GetNodes()->RegisterSolution_time_n1(); } void CDiscAdjSolver::RegisterVariables(CGeometry *geometry, CConfig *config, bool reset) { @@ -391,22 +377,15 @@ void CDiscAdjSolver::RegisterVariables(CGeometry *geometry, CConfig *config, boo void CDiscAdjSolver::RegisterOutput(CGeometry *geometry, CConfig *config) { - unsigned long iPoint, nPoint = geometry->GetnPoint(); - /*--- Register variables as output of the solver iteration ---*/ - bool input = false; - /*--- Register output variables on the tape ---*/ - - for (iPoint = 0; iPoint < nPoint; iPoint++) { - if(config->GetMultizone_Problem()) { - direct_solver->node[iPoint]->RegisterSolution_intIndexBased(input); - direct_solver->node[iPoint]->SetAdjIndices(input); - } - else { - direct_solver->node[iPoint]->RegisterSolution(input); - } + if(config->GetMultizone_Problem()) { + direct_solver->GetNodes()->RegisterSolution_intIndexBased(input); + direct_solver->GetNodes()->SetAdjIndices(input); + } + else { + direct_solver->GetNodes()->RegisterSolution(input); } } @@ -506,26 +485,24 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi SetRes_Max(iVar,0.0,0); } - for (iPoint = 0; iPoint < nPoint; iPoint++) { - - /*--- Set the old solution ---*/ + /*--- Set the old solution ---*/ - if(!config->GetMultizone_Problem()) { - node[iPoint]->Set_OldSolution(); - } + if(!config->GetMultizone_Problem()) nodes->Set_OldSolution(); + + for (iPoint = 0; iPoint < nPoint; iPoint++) { /*--- Extract the adjoint solution ---*/ - + if(config->GetMultizone_Problem()) { - direct_solver->node[iPoint]->GetAdjointSolution_intIndexBased(Solution); + direct_solver->GetNodes()->GetAdjointSolution_intIndexBased(iPoint,Solution); } else { - direct_solver->node[iPoint]->GetAdjointSolution(Solution); + direct_solver->GetNodes()->GetAdjointSolution(iPoint,Solution); } /*--- Store the adjoint solution ---*/ - node[iPoint]->SetSolution(Solution); + nodes->SetSolution(iPoint,Solution); } if (time_n_needed) { @@ -533,11 +510,11 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi /*--- Extract the adjoint solution at time n ---*/ - direct_solver->node[iPoint]->GetAdjointSolution_time_n(Solution); + direct_solver->GetNodes()->GetAdjointSolution_time_n(iPoint,Solution); /*--- Store the adjoint solution at time n ---*/ - node[iPoint]->Set_Solution_time_n(Solution); + nodes->Set_Solution_time_n(iPoint,Solution); } } if (time_n1_needed) { @@ -545,11 +522,11 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi /*--- Extract the adjoint solution at time n-1 ---*/ - direct_solver->node[iPoint]->GetAdjointSolution_time_n1(Solution); + direct_solver->GetNodes()->GetAdjointSolution_time_n1(iPoint,Solution); /*--- Store the adjoint solution at time n-1 ---*/ - node[iPoint]->Set_Solution_time_n1(Solution); + nodes->Set_Solution_time_n1(iPoint,Solution); } } @@ -557,7 +534,7 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi for (iPoint = 0; iPoint < nPointDomain; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - residual = node[iPoint]->GetSolution(iVar) - node[iPoint]->GetSolution_Old(iVar); + residual = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution_Old(iPoint,iVar); AddRes_RMS(iVar,residual*residual); AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); @@ -654,11 +631,11 @@ void CDiscAdjSolver::ExtractAdjoint_Geometry(CGeometry *geometry, CConfig *confi // SetRes_Max(iVar,0.0,0); // } - for (iPoint = 0; iPoint < nPoint; iPoint++){ + /*--- Set the old solution ---*/ - /*--- Set the old solution ---*/ + nodes->Set_OldSolution_Geometry(); - node[iPoint]->Set_OldSolution_Geometry(); + for (iPoint = 0; iPoint < nPoint; iPoint++){ /*--- Extract the adjoint solution ---*/ @@ -666,7 +643,7 @@ void CDiscAdjSolver::ExtractAdjoint_Geometry(CGeometry *geometry, CConfig *confi /*--- Store the adjoint solution ---*/ - node[iPoint]->SetSolution_Geometry(Solution_Geometry); + nodes->SetSolution_Geometry(iPoint,Solution_Geometry); } @@ -675,11 +652,11 @@ void CDiscAdjSolver::ExtractAdjoint_Geometry(CGeometry *geometry, CConfig *confi // // /*--- Extract the adjoint solution at time n ---*/ // -// direct_solver->node[iPoint]->GetAdjointSolution_time_n(Solution); +// direct_solver->GetNodes()->GetAdjointSolution_time_n(iPoint,Solution); // // /*--- Store the adjoint solution at time n ---*/ // -// node[iPoint]->Set_Solution_time_n(Solution); +// nodes->Set_Solution_time_n(iPoint,Solution); // } // } // if (time_n1_needed){ @@ -687,11 +664,11 @@ void CDiscAdjSolver::ExtractAdjoint_Geometry(CGeometry *geometry, CConfig *confi // // /*--- Extract the adjoint solution at time n-1 ---*/ // -// direct_solver->node[iPoint]->GetAdjointSolution_time_n1(Solution); +// direct_solver->GetNodes()->GetAdjointSolution_time_n1(iPoint,Solution); // // /*--- Store the adjoint solution at time n-1 ---*/ // -// node[iPoint]->Set_Solution_time_n1(Solution); +// nodes->Set_Solution_time_n1(iPoint,Solution); // } // } @@ -718,9 +695,9 @@ void CDiscAdjSolver::ExtractAdjoint_CrossTerm(CGeometry *geometry, CConfig *conf /*--- Extract the adjoint solution ---*/ - direct_solver->node[iPoint]->GetAdjointSolution(Solution); + direct_solver->GetNodes()->GetAdjointSolution(iPoint,Solution); - for (iVar = 0; iVar < nVar; iVar++) node[iPoint]->SetCross_Term_Derivative(iVar, Solution[iVar]); + for (iVar = 0; iVar < nVar; iVar++) nodes->SetCross_Term_Derivative(iPoint,iVar, Solution[iVar]); } @@ -738,7 +715,7 @@ void CDiscAdjSolver::ExtractAdjoint_CrossTerm_Geometry(CGeometry *geometry, CCon geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); - for (iDim = 0; iDim < nDim; iDim++) node[iPoint]->SetGeometry_CrossTerm_Derivative(iDim, Solution_Geometry[iDim]); + for (iDim = 0; iDim < nDim; iDim++) nodes->SetGeometry_CrossTerm_Derivative(iPoint,iDim, Solution_Geometry[iDim]); } @@ -756,7 +733,7 @@ void CDiscAdjSolver::ExtractAdjoint_CrossTerm_Geometry_Flow(CGeometry *geometry, geometry->node[iPoint]->GetAdjointCoord(Solution_Geometry); - for (iDim = 0; iDim < nDim; iDim++) node[iPoint]->SetGeometry_CrossTerm_Derivative_Flow(iDim, Solution_Geometry[iDim]); + for (iDim = 0; iDim < nDim; iDim++) nodes->SetGeometry_CrossTerm_Derivative_Flow(iPoint,iDim, Solution_Geometry[iDim]); } @@ -775,27 +752,27 @@ void CDiscAdjSolver::SetAdjoint_Output(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { if(config->GetMultizone_Problem()) { - Solution[iVar] = node[iPoint]->Get_BGSSolution_k(iVar); + Solution[iVar] = nodes->Get_BGSSolution_k(iPoint,iVar); } else { - Solution[iVar] = node[iPoint]->GetSolution(iVar); + Solution[iVar] = nodes->GetSolution(iPoint,iVar); } } if (fsi) { for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] += node[iPoint]->GetCross_Term_Derivative(iVar); + Solution[iVar] += nodes->GetCross_Term_Derivative(iPoint,iVar); } } if (dual_time) { for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] += node[iPoint]->GetDual_Time_Derivative(iVar); + Solution[iVar] += nodes->GetDual_Time_Derivative(iPoint,iVar); } } if(config->GetMultizone_Problem()) { - direct_solver->node[iPoint]->SetAdjointSolution_intIndexBased(Solution); + direct_solver->GetNodes()->SetAdjointSolution_intIndexBased(iPoint,Solution); } else { - direct_solver->node[iPoint]->SetAdjointSolution(Solution); + direct_solver->GetNodes()->SetAdjointSolution(iPoint,Solution); } } } @@ -816,19 +793,19 @@ void CDiscAdjSolver::SetAdjoint_OutputMesh(CGeometry *geometry, CConfig *config) } if (fsi){ for (iDim = 0; iDim < nDim; iDim++){ - Solution_Geometry[iDim] += node[iPoint]->GetGeometry_CrossTerm_Derivative(iDim); + Solution_Geometry[iDim] += nodes->GetGeometry_CrossTerm_Derivative(iPoint,iDim); } for (iDim = 0; iDim < nDim; iDim++){ - Solution_Geometry[iDim] += node[iPoint]->GetGeometry_CrossTerm_Derivative_Flow(iDim); + Solution_Geometry[iDim] += nodes->GetGeometry_CrossTerm_Derivative_Flow(iPoint,iDim); } } // if (dual_time){ // for (iDim = 0; iDim < nVar; iDim++){ -// Solution_Geometry[iDim] += node[iPoint]->GetDual_Time_Derivative_Geometry(iDim); +// Solution_Geometry[iDim] += nodes->GetDual_Time_Derivative_Geometry(iPoint,iDim); // } // } for (iDim = 0; iDim < nDim; iDim++){ - node[iPoint]->SetSensitivity(iDim, Solution_Geometry[iDim]); + nodes->SetSensitivity(iPoint,iDim, Solution_Geometry[iDim]); } geometry->node[iPoint]->SetAdjointCoord(Solution_Geometry); } @@ -867,9 +844,9 @@ void CDiscAdjSolver::SetSensitivity(CGeometry *geometry, CSolver **solver, CConf Sensitivity = 0.0; } if (!time_stepping) { - node[iPoint]->SetSensitivity(iDim, Sensitivity); + nodes->SetSensitivity(iPoint,iDim, Sensitivity); } else { - node[iPoint]->SetSensitivity(iDim, node[iPoint]->GetSensitivity(iDim) + Sensitivity); + nodes->SetSensitivity(iPoint, iDim, nodes->GetSensitivity(iPoint,iDim) + Sensitivity); } } } @@ -907,7 +884,7 @@ void CDiscAdjSolver::SetSurface_Sensitivity(CGeometry *geometry, CConfig *config Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) { /*--- retrieve the gradient calculated with AD -- */ - SensDim = node[iPoint]->GetSensitivity(iDim); + SensDim = nodes->GetSensitivity(iPoint,iDim); /*--- calculate scalar product for projection onto the normal vector ---*/ Prod += Normal[iDim]*SensDim; @@ -970,11 +947,11 @@ void CDiscAdjSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain unsigned short iVar; if (dual_time) { for (iPoint = 0; iPointGetnPoint(); iPoint++) { - solution_n = node[iPoint]->GetSolution_time_n(); - solution_n1 = node[iPoint]->GetSolution_time_n1(); + solution_n = nodes->GetSolution_time_n(iPoint); + solution_n1 = nodes->GetSolution_time_n1(iPoint); for (iVar=0; iVar < nVar; iVar++) { - node[iPoint]->SetDual_Time_Derivative(iVar, solution_n[iVar]+node[iPoint]->GetDual_Time_Derivative_n(iVar)); - node[iPoint]->SetDual_Time_Derivative_n(iVar, solution_n1[iVar]); + nodes->SetDual_Time_Derivative(iPoint, iVar, solution_n[iVar]+nodes->GetDual_Time_Derivative_n(iPoint, iVar)); + nodes->SetDual_Time_Derivative_n(iPoint,iVar, solution_n1[iVar]); } } } @@ -1045,7 +1022,7 @@ void CDiscAdjSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfi index = counter*Restart_Vars[1] + skipVars; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); iPoint_Global_Local++; /*--- Increment the overall counter for how many points have been loaded. ---*/ @@ -1077,12 +1054,12 @@ void CDiscAdjSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfi for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver[iMesh][ADJFLOW_SOL]->node[iPoint]->SetSolution(Solution); + solver[iMesh][ADJFLOW_SOL]->GetNodes()->SetSolution(iPoint, Solution); } } @@ -1111,24 +1088,23 @@ void CDiscAdjSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *con for (iPoint = 0; iPoint < nPointDomain; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ if(config->GetMultizone_Problem()) { - bgs_sol = node[iPoint]->GetSolution(iVar); + bgs_sol = nodes->GetSolution(iPoint,iVar); } else { - bgs_sol = node[iPoint]->GetSolution(iVar) + node[iPoint]->GetCross_Term_Derivative(iVar); + bgs_sol = nodes->GetSolution(iPoint,iVar) + nodes->GetCross_Term_Derivative(iPoint,iVar); } - node[iPoint]->Set_BGSSolution(iVar, bgs_sol); + nodes->Set_BGSSolution(iPoint, iVar, bgs_sol); } } /*--- Set the residuals ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++){ - for (iVar = 0; iVar < nVar; iVar++){ - residual = node[iPoint]->Get_BGSSolution(iVar) - node[iPoint]->Get_BGSSolution_k(iVar); - - AddRes_BGS(iVar,residual*residual); - AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); - } + for (iVar = 0; iVar < nVar; iVar++){ + residual = nodes->Get_BGSSolution(iPoint,iVar) - nodes->Get_BGSSolution_k(iPoint,iVar); + AddRes_BGS(iVar,residual*residual); + AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); + } } SetResidual_BGS(geometry, config); diff --git a/SU2_CFD/src/solver_adjoint_elasticity.cpp b/SU2_CFD/src/solver_adjoint_elasticity.cpp index 4e12d66d8441..c3ec97ab7d7e 100644 --- a/SU2_CFD/src/solver_adjoint_elasticity.cpp +++ b/SU2_CFD/src/solver_adjoint_elasticity.cpp @@ -55,6 +55,8 @@ CDiscAdjFEASolver::CDiscAdjFEASolver(void) : CSolver (){ Solution_Vel = NULL; Solution_Accel= NULL; + nodes = nullptr; + } CDiscAdjFEASolver::CDiscAdjFEASolver(CGeometry *geometry, CConfig *config) : CSolver(){ @@ -75,6 +77,8 @@ CDiscAdjFEASolver::CDiscAdjFEASolver(CGeometry *geometry, CConfig *config) : CS SolRest = NULL; + nodes = nullptr; + } CDiscAdjFEASolver::CDiscAdjFEASolver(CGeometry *geometry, CConfig *config, CSolver *direct_solver, unsigned short Kind_Solver, unsigned short iMesh) : CSolver(){ @@ -106,10 +110,6 @@ CDiscAdjFEASolver::CDiscAdjFEASolver(CGeometry *geometry, CConfig *config, CSolv nMarker_nL = 0; - /*--- Allocate the node variables ---*/ - - node = new CVariable*[nPoint]; - /*--- Define some auxiliary vectors related to the residual ---*/ Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 1.0; @@ -187,43 +187,35 @@ CDiscAdjFEASolver::CDiscAdjFEASolver(CGeometry *geometry, CConfig *config, CSolv } } - if (dynamic){ - /*--- Restart the solution from zero ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CDiscAdjFEAVariable(Solution, Solution_Accel, Solution_Vel, nDim, nVar, config); - } - else{ - bool isVertex; - long indexVertex; - /*--- Restart the solution from zero ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) { - isVertex = false; - for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - if (config->GetMarker_All_Fluid_Load(iMarker) == YES) { - indexVertex = geometry->node[iPoint]->GetVertex(iMarker); - if (indexVertex != -1){isVertex = true; break;} - } + nodes = new CDiscAdjFEABoundVariable(Solution, Solution_Accel, Solution_Vel, nPoint, nDim, nVar, dynamic, config); + SetBaseClassPointerToNodes(); + + /*--- Set which points are vertices and allocate boundary data. ---*/ + + for (iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + long iVertex = geometry->node[iPoint]->GetVertex(iMarker); + if (iVertex >= 0) { + nodes->Set_isVertex(iPoint,true); + break; } - if (isVertex) - node[iPoint] = new CDiscAdjFEABoundVariable(Solution, nDim, nVar, config); - else - node[iPoint] = new CDiscAdjFEAVariable(Solution, nDim, nVar, config); } - } + nodes->AllocateBoundaryVariables(config); + /*--- Store the direct solution ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++){ - node[iPoint]->SetSolution_Direct(direct_solver->node[iPoint]->GetSolution()); + nodes->SetSolution_Direct(iPoint, direct_solver->GetNodes()->GetSolution(iPoint)); } if (dynamic){ for (iPoint = 0; iPoint < nPoint; iPoint++){ - node[iPoint]->SetSolution_Accel_Direct(direct_solver->node[iPoint]->GetSolution_Accel()); + nodes->SetSolution_Accel_Direct(iPoint, direct_solver->GetNodes()->GetSolution_Accel(iPoint)); } for (iPoint = 0; iPoint < nPoint; iPoint++){ - node[iPoint]->SetSolution_Vel_Direct(direct_solver->node[iPoint]->GetSolution_Vel()); + nodes->SetSolution_Vel_Direct(iPoint, direct_solver->GetNodes()->GetSolution_Vel(iPoint)); } } @@ -380,6 +372,7 @@ CDiscAdjFEASolver::~CDiscAdjFEASolver(void){ if (Solution_Accel != NULL) delete [] Solution_Accel; if (SolRest != NULL) delete [] SolRest; + if (nodes != nullptr) delete nodes; } void CDiscAdjFEASolver::SetRecording(CGeometry* geometry, CConfig *config){ @@ -393,35 +386,35 @@ void CDiscAdjFEASolver::SetRecording(CGeometry* geometry, CConfig *config){ /*--- Reset the solution to the initial (converged) solution ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->SetSolution(node[iPoint]->GetSolution_Direct()); + direct_solver->GetNodes()->SetSolution(iPoint, nodes->GetSolution_Direct(iPoint)); } if (dynamic){ /*--- Reset the solution to the initial (converged) solution ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->SetSolution_Accel(node[iPoint]->GetSolution_Accel_Direct()); + direct_solver->GetNodes()->SetSolution_Accel(iPoint, nodes->GetSolution_Accel_Direct(iPoint)); } for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->SetSolution_Vel(node[iPoint]->GetSolution_Vel_Direct()); + direct_solver->GetNodes()->SetSolution_Vel(iPoint, nodes->GetSolution_Vel_Direct(iPoint)); } /*--- Reset the input for time n ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - AD::ResetInput(direct_solver->node[iPoint]->GetSolution_time_n()[iVar]); + AD::ResetInput(direct_solver->GetNodes()->GetSolution_time_n(iPoint)[iVar]); } } for (iPoint = 0; iPoint < nPoint; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - AD::ResetInput(direct_solver->node[iPoint]->GetSolution_Accel_time_n()[iVar]); + AD::ResetInput(direct_solver->GetNodes()->GetSolution_Accel_time_n(iPoint)[iVar]); } } for (iPoint = 0; iPoint < nPoint; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - AD::ResetInput(direct_solver->node[iPoint]->GetSolution_Vel_time_n()[iVar]); + AD::ResetInput(direct_solver->GetNodes()->GetSolution_Vel_time_n(iPoint)[iVar]); } } @@ -440,35 +433,26 @@ void CDiscAdjFEASolver::SetRecording(CGeometry* geometry, CConfig *config){ void CDiscAdjFEASolver::RegisterSolution(CGeometry *geometry, CConfig *config){ - unsigned long iPoint, nPoint = geometry->GetnPoint(); - - bool dynamic (config->GetTime_Domain()); + bool dynamic = config->GetTime_Domain(); bool input = true; /*--- Register solution at all necessary time instances and other variables on the tape ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution(input); - } + direct_solver->GetNodes()->RegisterSolution(input); + + if (dynamic) { - if (dynamic){ /*--- Register acceleration (u'') and velocity (u') at time step n ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution_Accel(input); - } - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution_Vel(input); - } + + direct_solver->GetNodes()->RegisterSolution_Accel(input); + direct_solver->GetNodes()->RegisterSolution_Vel(input); + /*--- Register solution (u), acceleration (u'') and velocity (u') at time step n-1 ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->Register_femSolution_time_n(); - } - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution_Accel_time_n(); - } - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution_Vel_time_n(); - } + + direct_solver->GetNodes()->Register_femSolution_time_n(); + direct_solver->GetNodes()->RegisterSolution_Accel_time_n(); + direct_solver->GetNodes()->RegisterSolution_Vel_time_n(); + } } @@ -500,29 +484,26 @@ void CDiscAdjFEASolver::RegisterVariables(CGeometry *geometry, CConfig *config, // for (iVar = 0; iVar < nDV; iVar++) DV_Val[iVar] = config->GetDV_Value(iVar,0); // } - if (!reset){ - for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(E_i[iVar]); - for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(Nu_i[iVar]); - for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(Rho_i[iVar]); - for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(Rho_DL_i[iVar]); + if (!reset) { + for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(E_i[iVar]); + for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(Nu_i[iVar]); + for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(Rho_i[iVar]); + for (iVar = 0; iVar < nMPROP; iVar++) AD::RegisterInput(Rho_DL_i[iVar]); - if(de_effects){ - for (iVar = 0; iVar < nEField; iVar++) AD::RegisterInput(EField[iVar]); - } + if(de_effects){ + for (iVar = 0; iVar < nEField; iVar++) AD::RegisterInput(EField[iVar]); + } - if(fea_dv){ - for (iVar = 0; iVar < nDV; iVar++) AD::RegisterInput(DV_Val[iVar]); - } + if(fea_dv){ + for (iVar = 0; iVar < nDV; iVar++) AD::RegisterInput(DV_Val[iVar]); + } - if (config->GetTopology_Optimization()) - direct_solver->RegisterVariables(geometry,config); + if (config->GetTopology_Optimization()) + direct_solver->RegisterVariables(geometry,config); - /*--- Register the flow traction sensitivities ---*/ - if (config->GetnMarker_Fluid_Load() > 0){ - for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterFlowTraction(); - } - } + /*--- Register the flow traction sensitivities ---*/ + if (config->GetnMarker_Fluid_Load() > 0) + direct_solver->GetNodes()->RegisterFlowTraction(); } } @@ -535,30 +516,20 @@ void CDiscAdjFEASolver::RegisterVariables(CGeometry *geometry, CConfig *config, void CDiscAdjFEASolver::RegisterOutput(CGeometry *geometry, CConfig *config){ - unsigned long iPoint, nPoint = geometry->GetnPoint(); - - bool dynamic = (config->GetTime_Domain()); + bool dynamic = config->GetTime_Domain(); /*--- Register variables as output of the solver iteration ---*/ bool input = false; - /*--- Register output variables on the tape ---*/ + direct_solver->GetNodes()->RegisterSolution(input); - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution(input); - } - if (dynamic){ + if (dynamic) { /*--- Register acceleration (u'') and velocity (u') at time step n ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution_Accel(input); - } - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->RegisterSolution_Vel(input); - } + direct_solver->GetNodes()->RegisterSolution_Accel(input); + direct_solver->GetNodes()->RegisterSolution_Vel(input); } - } void CDiscAdjFEASolver::RegisterObj_Func(CConfig *config){ @@ -637,19 +608,19 @@ void CDiscAdjFEASolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *co SetRes_Max(iVar,0.0,0); } - for (iPoint = 0; iPoint < nPoint; iPoint++){ + /*--- Set the old solution ---*/ - /*--- Set the old solution ---*/ + nodes->Set_OldSolution(); - node[iPoint]->Set_OldSolution(); + for (iPoint = 0; iPoint < nPoint; iPoint++){ /*--- Extract the adjoint solution ---*/ - direct_solver->node[iPoint]->GetAdjointSolution(Solution); + direct_solver->GetNodes()->GetAdjointSolution(iPoint,Solution); /*--- Store the adjoint solution ---*/ - node[iPoint]->SetSolution(Solution); + nodes->SetSolution(iPoint,Solution); } @@ -658,36 +629,36 @@ void CDiscAdjFEASolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *co if (dynamic){ /*--- FIRST: The acceleration solution ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - /*--- Set the old acceleration solution ---*/ + /*--- Set the old acceleration solution ---*/ + nodes->Set_OldSolution_Accel(); - node[iPoint]->Set_OldSolution_Accel(); + for (iPoint = 0; iPoint < nPoint; iPoint++){ /*--- Extract the adjoint acceleration solution u'' ---*/ - direct_solver->node[iPoint]->GetAdjointSolution_Accel(Solution_Accel); + direct_solver->GetNodes()->GetAdjointSolution_Accel(iPoint,Solution_Accel); /*--- Store the adjoint acceleration solution u'' ---*/ - node[iPoint]->SetSolution_Accel(Solution_Accel); + nodes->SetSolution_Accel(iPoint,Solution_Accel); } /*--- NEXT: The velocity solution ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - - /*--- Set the old velocity solution ---*/ - node[iPoint]->Set_OldSolution_Vel(); + /*--- Set the old velocity solution ---*/ + nodes->Set_OldSolution_Vel(); + + for (iPoint = 0; iPoint < nPoint; iPoint++){ /*--- Extract the adjoint velocity solution u'' ---*/ - direct_solver->node[iPoint]->GetAdjointSolution_Vel(Solution_Vel); + direct_solver->GetNodes()->GetAdjointSolution_Vel(iPoint,Solution_Vel); /*--- Store the adjoint velocity solution u'' ---*/ - node[iPoint]->SetSolution_Vel(Solution_Vel); + nodes->SetSolution_Vel(iPoint,Solution_Vel); } @@ -696,11 +667,11 @@ void CDiscAdjFEASolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *co /*--- Extract the adjoint solution at time n ---*/ - direct_solver->node[iPoint]->GetAdjointSolution_time_n(Solution); + direct_solver->GetNodes()->GetAdjointSolution_time_n(iPoint,Solution); /*--- Store the adjoint solution at time n ---*/ - node[iPoint]->Set_Solution_time_n(Solution); + nodes->Set_Solution_time_n(iPoint,Solution); } /*--- The acceleration solution at time n... ---*/ @@ -708,11 +679,11 @@ void CDiscAdjFEASolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *co /*--- Extract the adjoint acceleration solution u'' at time n ---*/ - direct_solver->node[iPoint]->GetAdjointSolution_Accel_time_n(Solution_Accel); + direct_solver->GetNodes()->GetAdjointSolution_Accel_time_n(iPoint,Solution_Accel); /*--- Store the adjoint acceleration solution u'' at time n---*/ - node[iPoint]->SetSolution_Accel_time_n(Solution_Accel); + nodes->SetSolution_Accel_time_n(iPoint,Solution_Accel); } @@ -721,11 +692,11 @@ void CDiscAdjFEASolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *co /*--- Extract the adjoint velocity solution u' at time n ---*/ - direct_solver->node[iPoint]->GetAdjointSolution_Vel_time_n(Solution_Vel); + direct_solver->GetNodes()->GetAdjointSolution_Vel_time_n(iPoint,Solution_Vel); /*--- Store the adjoint velocity solution u' at time n ---*/ - node[iPoint]->SetSolution_Vel_time_n(Solution_Vel); + nodes->SetSolution_Vel_time_n(iPoint,Solution_Vel); } @@ -737,20 +708,20 @@ void CDiscAdjFEASolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *co for (iPoint = 0; iPoint < nPointDomain; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - residual = node[iPoint]->GetSolution(iVar) - node[iPoint]->GetSolution_Old(iVar); + residual = nodes->GetSolution(iPoint, iVar) - nodes->GetSolution_Old(iPoint, iVar); AddRes_RMS(iVar,residual*residual); AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); } if (dynamic){ for (iVar = 0; iVar < nVar; iVar++){ - residual = node[iPoint]->GetSolution_Accel(iVar) - node[iPoint]->GetSolution_Old_Accel(iVar); + residual = nodes->GetSolution_Accel(iPoint, iVar) - nodes->GetSolution_Old_Accel(iPoint, iVar); AddRes_RMS(iVar,residual*residual); AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); } for (iVar = 0; iVar < nVar; iVar++){ - residual = node[iPoint]->GetSolution_Vel(iVar) - node[iPoint]->GetSolution_Old_Vel(iVar); + residual = nodes->GetSolution_Vel(iPoint, iVar) - nodes->GetSolution_Old_Vel(iPoint, iVar); AddRes_RMS(iVar,residual*residual); AddRes_Max(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); @@ -821,8 +792,8 @@ void CDiscAdjFEASolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *c su2double val_sens; for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ for (unsigned short iDim = 0; iDim < nDim; iDim++){ - val_sens = direct_solver->node[iPoint]->ExtractFlowTraction_Sensitivity(iDim); - node[iPoint]->SetFlowTractionSensitivity(iDim, val_sens); + val_sens = direct_solver->GetNodes()->ExtractFlowTraction_Sensitivity(iPoint,iDim); + nodes->SetFlowTractionSensitivity(iPoint, iDim, val_sens); } } } @@ -843,44 +814,44 @@ void CDiscAdjFEASolver::SetAdjoint_Output(CGeometry *geometry, CConfig *config){ for (iPoint = 0; iPoint < nPoint; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - Solution[iVar] = node[iPoint]->GetSolution(iVar); + Solution[iVar] = nodes->GetSolution(iPoint,iVar); } if (fsi) { for (iVar = 0; iVar < nVar; iVar++){ - Solution[iVar] += node[iPoint]->GetGeometry_CrossTerm_Derivative(iVar); + Solution[iVar] += nodes->GetGeometry_CrossTerm_Derivative(iPoint,iVar); } for (iVar = 0; iVar < nVar; iVar++){ - Solution[iVar] += node[iPoint]->GetCross_Term_Derivative(iVar); + Solution[iVar] += nodes->GetCross_Term_Derivative(iPoint,iVar); } } if(deform_mesh){ for (iVar = 0; iVar < nVar; iVar++){ - Solution[iVar] += node[iPoint]->GetSourceTerm_DispAdjoint(iVar); + Solution[iVar] += nodes->GetSourceTerm_DispAdjoint(iPoint,iVar); } } if (dynamic){ for (iVar = 0; iVar < nVar; iVar++){ - Solution_Accel[iVar] = node[iPoint]->GetSolution_Accel(iVar); + Solution_Accel[iVar] = nodes->GetSolution_Accel(iPoint,iVar); } for (iVar = 0; iVar < nVar; iVar++){ - Solution_Vel[iVar] = node[iPoint]->GetSolution_Vel(iVar); + Solution_Vel[iVar] = nodes->GetSolution_Vel(iPoint,iVar); } for (iVar = 0; iVar < nVar; iVar++){ - Solution[iVar] += node[iPoint]->GetDynamic_Derivative_n(iVar); + Solution[iVar] += nodes->GetDynamic_Derivative_n(iPoint,iVar); } for (iVar = 0; iVar < nVar; iVar++){ - Solution_Accel[iVar] += node[iPoint]->GetDynamic_Derivative_Accel_n(iVar); + Solution_Accel[iVar] += nodes->GetDynamic_Derivative_Accel_n(iPoint,iVar); } for (iVar = 0; iVar < nVar; iVar++){ - Solution_Vel[iVar] += node[iPoint]->GetDynamic_Derivative_Vel_n(iVar); + Solution_Vel[iVar] += nodes->GetDynamic_Derivative_Vel_n(iPoint,iVar); } } - direct_solver->node[iPoint]->SetAdjointSolution(Solution); + direct_solver->GetNodes()->SetAdjointSolution(iPoint,Solution); if (dynamic){ - direct_solver->node[iPoint]->SetAdjointSolution_Accel(Solution_Accel); - direct_solver->node[iPoint]->SetAdjointSolution_Vel(Solution_Vel); + direct_solver->GetNodes()->SetAdjointSolution_Accel(iPoint,Solution_Accel); + direct_solver->GetNodes()->SetAdjointSolution_Vel(iPoint,Solution_Vel); } } @@ -896,13 +867,13 @@ void CDiscAdjFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_cont if (dynamic){ for (iPoint = 0; iPointGetnPoint(); iPoint++){ for (iVar=0; iVar < nVar; iVar++){ - node[iPoint]->SetDynamic_Derivative_n(iVar, node[iPoint]->GetSolution_time_n(iVar)); + nodes->SetDynamic_Derivative_n(iPoint, iVar, nodes->GetSolution_time_n(iPoint, iVar)); } for (iVar=0; iVar < nVar; iVar++){ - node[iPoint]->SetDynamic_Derivative_Accel_n(iVar, node[iPoint]->GetSolution_Accel_time_n(iVar)); + nodes->SetDynamic_Derivative_Accel_n(iPoint, iVar, nodes->GetSolution_Accel_time_n(iPoint, iVar)); } for (iVar=0; iVar < nVar; iVar++){ - node[iPoint]->SetDynamic_Derivative_Vel_n(iVar, node[iPoint]->GetSolution_Vel_time_n(iVar)); + nodes->SetDynamic_Derivative_Vel_n(iPoint, iVar, nodes->GetSolution_Vel_time_n(iPoint, iVar)); } } } @@ -918,9 +889,9 @@ void CDiscAdjFEASolver::ExtractAdjoint_CrossTerm(CGeometry *geometry, CConfig *c /*--- Extract the adjoint solution ---*/ - direct_solver->node[iPoint]->GetAdjointSolution(Solution); + direct_solver->GetNodes()->GetAdjointSolution(iPoint,Solution); - for (iVar = 0; iVar < nVar; iVar++) node[iPoint]->SetCross_Term_Derivative(iVar, Solution[iVar]); + for (iVar = 0; iVar < nVar; iVar++) nodes->SetCross_Term_Derivative(iPoint,iVar, Solution[iVar]); } @@ -937,14 +908,14 @@ void CDiscAdjFEASolver::ExtractAdjoint_CrossTerm_Geometry(CGeometry *geometry, C /*--- Extract the adjoint solution ---*/ - direct_solver->node[iPoint]->GetAdjointSolution(Solution); + direct_solver->GetNodes()->GetAdjointSolution(iPoint,Solution); /*--- Relax and set the solution ---*/ for(iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = relax*Solution[iVar] + (1.0-relax)*node[iPoint]->GetGeometry_CrossTerm_Derivative(iVar); + Solution[iVar] = relax*Solution[iVar] + (1.0-relax)*nodes->GetGeometry_CrossTerm_Derivative(iPoint,iVar); - for (iVar = 0; iVar < nVar; iVar++) node[iPoint]->SetGeometry_CrossTerm_Derivative(iVar, Solution[iVar]); + for (iVar = 0; iVar < nVar; iVar++) nodes->SetGeometry_CrossTerm_Derivative(iPoint,iVar, Solution[iVar]); } @@ -994,15 +965,15 @@ void CDiscAdjFEASolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig * /*--- Compute the BGS solution (adding the cross term) ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - bgs_sol = node[iPoint]->GetSolution(iVar) + node[iPoint]->GetGeometry_CrossTerm_Derivative(iVar); - node[iPoint]->Set_BGSSolution(iVar, bgs_sol); + bgs_sol = nodes->GetSolution(iPoint, iVar) + nodes->GetGeometry_CrossTerm_Derivative(iPoint, iVar); + nodes->Set_BGSSolution(iPoint,iVar, bgs_sol); } } /*--- Set the residuals ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++){ for (iVar = 0; iVar < nVar; iVar++){ - residual = node[iPoint]->Get_BGSSolution(iVar) - node[iPoint]->Get_BGSSolution_k(iVar); + residual = nodes->Get_BGSSolution(iPoint, iVar) - nodes->Get_BGSSolution_k(iPoint, iVar); AddRes_BGS(iVar,residual*residual); AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); } @@ -1012,7 +983,6 @@ void CDiscAdjFEASolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig * } - void CDiscAdjFEASolver::BC_Clamped_Post(CGeometry *geometry, CNumerics *numerics, CConfig *config, unsigned short val_marker) { unsigned long iPoint, iVertex; @@ -1031,11 +1001,11 @@ void CDiscAdjFEASolver::BC_Clamped_Post(CGeometry *geometry, CNumerics *numerics Solution[0] = 0.0; Solution[1] = 0.0; Solution[2] = 0.0; } - node[iPoint]->SetSolution(Solution); + nodes->SetSolution(iPoint,Solution); if (dynamic){ - node[iPoint]->SetSolution_Vel(Solution); - node[iPoint]->SetSolution_Accel(Solution); + nodes->SetSolution_Vel(iPoint,Solution); + nodes->SetSolution_Accel(iPoint,Solution); } } @@ -1202,7 +1172,7 @@ void CDiscAdjFEASolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CCo index = counter*Restart_Vars[1] + skipVars; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); iPoint_Global_Local++; /*--- Increment the overall counter for how many points have been loaded. ---*/ @@ -1234,12 +1204,12 @@ void CDiscAdjFEASolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CCo for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver[iMesh][ADJFLOW_SOL]->node[iPoint]->SetSolution(Solution); + solver[iMesh][ADJFLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution); } } diff --git a/SU2_CFD/src/solver_adjoint_mean.cpp b/SU2_CFD/src/solver_adjoint_mean.cpp index 3942c5e5377d..e1af84656d27 100644 --- a/SU2_CFD/src/solver_adjoint_mean.cpp +++ b/SU2_CFD/src/solver_adjoint_mean.cpp @@ -118,8 +118,6 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned nVarGrad = nVar; - node = new CVariable*[nPoint]; - /*--- Define some auxiliary vectors related to the residual ---*/ Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; Residual_RMS = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_RMS[iVar] = 0.0; @@ -294,8 +292,8 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- Initialize the solution with the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CAdjEulerVariable(PsiRho_Inf, Phi_Inf, PsiE_Inf, nDim, nVar, config); + nodes = new CAdjEulerVariable(PsiRho_Inf, Phi_Inf, PsiE_Inf, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); /*--- Read the restart metadata. ---*/ @@ -411,6 +409,7 @@ CAdjEulerSolver::~CAdjEulerSolver(void) { delete [] CSensitivity; } + if (nodes != nullptr) delete nodes; } void CAdjEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, @@ -584,7 +583,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker(); for (iVar = 0; iVar < nVar; iVar++) { - Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = node[iPoint]->GetSolution(iVar); + Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = nodes->GetSolution(iPoint,iVar); } Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+(nVar+0)] = su2double(iGlobalIndex); Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+(nVar+1)] = su2double(jVertex); @@ -899,7 +898,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker(); for (iVar = 0; iVar < nVar; iVar++) { - Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = node[iPoint]->GetSolution(iVar); + Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = nodes->GetSolution(iPoint,iVar); } Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+(nVar+0)] = su2double(iGlobalIndex); Buffer_Send_AdjVar[(nVar+3)*(PointTotal_Counter+iPointTotal)+(nVar+1)] = su2double(jVertex); @@ -1092,7 +1091,7 @@ void CAdjEulerSolver::SetForceProj_Vector(CGeometry *geometry, CSolver **solver_ for (iDim=0; iDimvertex[iMarker][iVertex]->GetNode(); - node[iPoint]->SetForceProj_Vector(ForceProj_Vector); + nodes->SetForceProj_Vector(iPoint,ForceProj_Vector); } } @@ -1119,7 +1118,7 @@ void CAdjEulerSolver::SetForceProj_Vector(CGeometry *geometry, CSolver **solver_ if (nDim == 3) z = geometry->node[iPoint]->GetCoord(2); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - ForceProj_Vector2 = node[iPoint]->GetForceProj_Vector(); + ForceProj_Vector2 = nodes->GetForceProj_Vector(iPoint); for (iDim=0; iDimSetForceProj_Vector(ForceProj_Vector); + nodes->SetForceProj_Vector(iPoint,ForceProj_Vector); } } @@ -1451,7 +1450,7 @@ void CAdjEulerSolver::SetIntBoundary_Jump(CGeometry *geometry, CSolver **solver_ case NEARFIELD_PRESSURE : - DerivativeOF = factor*WeightSB*(solver_container[FLOW_SOL]->node[iPoint]->GetPressure() + DerivativeOF = factor*WeightSB*(solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint) - solver_container[FLOW_SOL]->GetPressure_Inf()); break; @@ -1460,7 +1459,7 @@ void CAdjEulerSolver::SetIntBoundary_Jump(CGeometry *geometry, CSolver **solver_ /*--- Compute the jump of the adjoint variables (2D, and 3D problems) --*/ - FlowSolution = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + FlowSolution = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); Rho = FlowSolution[0]; Energy = FlowSolution[nVar-1]/FlowSolution[0]; @@ -1560,7 +1559,7 @@ void CAdjEulerSolver::SetIntBoundary_Jump(CGeometry *geometry, CSolver **solver_ for (iVar = 0; iVar < nVar; iVar++) IntBound_Vector[iVar] = b[iVar]; - node[iPoint]->SetIntBoundary_Jump(IntBound_Vector); + nodes->SetIntBoundary_Jump(iPoint,IntBound_Vector); } } @@ -1601,12 +1600,12 @@ void CAdjEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver_container[iMesh-1][ADJFLOW_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver_container[iMesh-1][ADJFLOW_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver_container[iMesh][ADJFLOW_SOL]->node[iPoint]->SetSolution(Solution); + solver_container[iMesh][ADJFLOW_SOL]->GetNodes()->SetSolution(iPoint, Solution); } solver_container[iMesh][ADJFLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); @@ -1617,11 +1616,9 @@ void CAdjEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve /*--- The value of the solution for the first iteration of the dual time ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - if ((TimeIter == 0) && (dual_time)) { - solver_container[iMesh][ADJFLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[iMesh][ADJFLOW_SOL]->node[iPoint]->Set_Solution_time_n1(); - } + if ((TimeIter == 0) && (dual_time)) { + solver_container[iMesh][ADJFLOW_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[iMesh][ADJFLOW_SOL]->GetNodes()->Set_Solution_time_n1(); } } @@ -1658,13 +1655,13 @@ void CAdjEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contai /*--- Initialize the non-physical points vector ---*/ - node[iPoint]->SetNon_Physical(false); + nodes->SetNon_Physical(iPoint,false); /*--- Set the primitive variables compressible adjoint variables ---*/ - RightSol = node[iPoint]->SetPrimVar(SharpEdge_Distance, false, config); - if (!RightSol) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; } + RightSol = nodes->SetPrimVar(iPoint,SharpEdge_Distance, false, config); + if (!RightSol) { nodes->SetNon_Physical(iPoint,true); ErrorCounter++; } /*--- Initialize the convective residual vector ---*/ @@ -1733,25 +1730,25 @@ void CAdjEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co /*--- Adjoint variables w/o reconstruction ---*/ - numerics->SetAdjointVar(node[iPoint]->GetSolution(), node[jPoint]->GetSolution()); + numerics->SetAdjointVar(nodes->GetSolution(iPoint), nodes->GetSolution(jPoint)); /*--- Conservative variables w/o reconstruction ---*/ - numerics->SetConservative(solver_container[FLOW_SOL]->node[iPoint]->GetSolution(), - solver_container[FLOW_SOL]->node[jPoint]->GetSolution()); + numerics->SetConservative(solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetSolution(jPoint)); - numerics->SetSoundSpeed(solver_container[FLOW_SOL]->node[iPoint]->GetSoundSpeed(), - solver_container[FLOW_SOL]->node[jPoint]->GetSoundSpeed()); - numerics->SetEnthalpy(solver_container[FLOW_SOL]->node[iPoint]->GetEnthalpy(), - solver_container[FLOW_SOL]->node[jPoint]->GetEnthalpy()); + numerics->SetSoundSpeed(solver_container[FLOW_SOL]->GetNodes()->GetSoundSpeed(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetSoundSpeed(jPoint)); + numerics->SetEnthalpy(solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(jPoint)); - numerics->SetLambda(solver_container[FLOW_SOL]->node[iPoint]->GetLambda(), - solver_container[FLOW_SOL]->node[jPoint]->GetLambda()); + numerics->SetLambda(solver_container[FLOW_SOL]->GetNodes()->GetLambda(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetLambda(jPoint)); if (jst_scheme) { - numerics->SetUndivided_Laplacian(node[iPoint]->GetUndivided_Laplacian(), node[jPoint]->GetUndivided_Laplacian()); - numerics->SetSensor(node[iPoint]->GetSensor(), node[jPoint]->GetSensor()); + numerics->SetUndivided_Laplacian(nodes->GetUndivided_Laplacian(iPoint), nodes->GetUndivided_Laplacian(jPoint)); + numerics->SetSensor(nodes->GetSensor(iPoint), nodes->GetSensor(jPoint)); } /*--- Mesh motion ---*/ @@ -1807,14 +1804,14 @@ void CAdjEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Adjoint variables w/o reconstruction ---*/ - Psi_i = node[iPoint]->GetSolution(); - Psi_j = node[jPoint]->GetSolution(); + Psi_i = nodes->GetSolution(iPoint); + Psi_j = nodes->GetSolution(jPoint); numerics->SetAdjointVar(Psi_i, Psi_j); /*--- Primitive variables w/o reconstruction ---*/ - V_i = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); - V_j = solver_container[FLOW_SOL]->node[jPoint]->GetPrimitive(); + V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); + V_j = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(jPoint); numerics->SetPrimitive(V_i, V_j); /*--- Grid velocities for dynamic meshes ---*/ @@ -1834,12 +1831,12 @@ void CAdjEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Adjoint variables using gradient reconstruction and limiters ---*/ - Gradient_i = node[iPoint]->GetGradient(); Gradient_j = node[jPoint]->GetGradient(); - if (limiter) { Limiter_i = node[iPoint]->GetLimiter(); Limiter_j = node[jPoint]->GetLimiter(); } + Gradient_i = nodes->GetGradient(iPoint); Gradient_j = nodes->GetGradient(jPoint); + if (limiter) { Limiter_i = nodes->GetLimiter(iPoint); Limiter_j = nodes->GetLimiter(jPoint); } for (iVar = 0; iVar < nVar; iVar++) { Project_Grad_i = 0; Project_Grad_j = 0; - Non_Physical = node[iPoint]->GetNon_Physical()*node[jPoint]->GetNon_Physical(); + Non_Physical = nodes->GetNon_Physical(iPoint)*nodes->GetNon_Physical(jPoint); for (iDim = 0; iDim < nDim; iDim++) { Project_Grad_i += Vector_i[iDim]*Gradient_i[iVar][iDim]*Non_Physical; Project_Grad_j += Vector_j[iDim]*Gradient_j[iVar][iDim]*Non_Physical; @@ -1900,8 +1897,8 @@ void CAdjEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the adjoint variables ---*/ - numerics->SetAdjointVar(node[iPoint]->GetSolution(), - node[iPoint]->GetSolution()); + numerics->SetAdjointVar(nodes->GetSolution(iPoint), + nodes->GetSolution(iPoint)); /*--- Load the volume of the dual mesh cell ---*/ numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -1930,7 +1927,7 @@ void CAdjEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Get stored harmonic balance source term ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Source = node[iPoint]->GetHarmonicBalance_Source(iVar); + Source = nodes->GetHarmonicBalance_Source(iPoint,iVar); Residual[iVar] = Source*Volume; } @@ -1953,10 +1950,10 @@ void CAdjEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Set solution ---*/ - numerics->SetConservative(solver_container[FLOW_SOL]->node[iPoint]->GetSolution(), solver_container[FLOW_SOL]->node[iPoint]->GetSolution()); + numerics->SetConservative(solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint), solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint)); /*--- Set adjoint variables ---*/ - numerics->SetAdjointVar(node[iPoint]->GetSolution(), node[iPoint]->GetSolution()); + numerics->SetAdjointVar(nodes->GetSolution(iPoint), nodes->GetSolution(iPoint)); /*--- Set control volume ---*/ numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -1994,20 +1991,19 @@ void CAdjEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi Diff = new su2double[nVar]; - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetUnd_LaplZero(); + nodes->SetUnd_LaplZero(); for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = node[iPoint]->GetSolution(iVar) - node[jPoint]->GetSolution(iVar); + Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar); #ifdef STRUCTURED_GRID - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff); #else @@ -2016,17 +2012,17 @@ void CAdjEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi /*--- Both points inside the domain, or both in the boundary ---*/ if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff); } /*--- iPoint inside the domain, jPoint on the boundary ---*/ if (!boundary_i && boundary_j) - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff); /*--- jPoint inside the domain, iPoint on the boundary ---*/ if (boundary_i && !boundary_j) - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff); #endif @@ -2059,13 +2055,13 @@ void CAdjEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi /*--- Interpolate & compute difference in the conserved variables ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Psi_mirror[iVar] = 2.0*node[iPoint]->GetSolution(iVar) - node[Point_Normal]->GetSolution(iVar); - Diff[iVar] = node[iPoint]->GetSolution(iVar) - Psi_mirror[iVar]; + Psi_mirror[iVar] = 2.0*node[iPoint]->GetSolution(iVar) - nodes->GetSolution(Point_Normal, iVar); + Diff[iVar] = nodes->GetSolution(iPoint,iVar) - Psi_mirror[iVar]; } /*--- Subtract contribution at the boundary node only ---*/ - node[iPoint]->SubtractUnd_Lapl(Diff); + nodes->SubtractUnd_Lapl(iPoint,Diff); } } } @@ -2107,7 +2103,7 @@ void CAdjEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi Sensor = scale * ds; - node[iPoint]->SetSensor(Sensor); + nodes->SetSensor(iPoint,Sensor); } @@ -2134,14 +2130,14 @@ void CAdjEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver /*--- Update the solution ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { Vol = geometry->node[iPoint]->GetVolume(); - Delta = solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time() / Vol; + Delta = solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint) / Vol; - Res_TruncError = node[iPoint]->GetResTruncError(); + Res_TruncError = nodes->GetResTruncError(iPoint); Residual = LinSysRes.GetBlock(iPoint); for (iVar = 0; iVar < nVar; iVar++) { Res = Residual[iVar] + Res_TruncError[iVar]; - node[iPoint]->AddSolution(iVar, -Res*Delta*RK_AlphaCoeff); + nodes->AddSolution(iPoint,iVar, -Res*Delta*RK_AlphaCoeff); AddRes_RMS(iVar, Res*Res); AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord()); } @@ -2171,14 +2167,14 @@ void CAdjEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol /*--- Update the solution ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { Vol = geometry->node[iPoint]->GetVolume(); - Delta = solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time() / Vol; + Delta = solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint) / Vol; - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); local_Residual = LinSysRes.GetBlock(iPoint); for (iVar = 0; iVar < nVar; iVar++) { Res = local_Residual[iVar] + local_Res_TruncError[iVar]; - node[iPoint]->AddSolution(iVar, -Res*Delta); + nodes->AddSolution(iPoint,iVar, -Res*Delta); AddRes_RMS(iVar, Res*Res); AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord()); } @@ -2214,7 +2210,7 @@ void CAdjEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol /*--- Read the residual ---*/ - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); /*--- Read the volume ---*/ @@ -2222,8 +2218,8 @@ void CAdjEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol /*--- Modify matrix diagonal to assure diagonal dominance ---*/ - if (solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time() != 0.0) { - Delta = Vol / solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time(); + if (solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint) != 0.0) { + Delta = Vol / solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint); Jacobian.AddVal2Diag(iPoint, Delta); } else { @@ -2265,7 +2261,7 @@ void CAdjEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol for (iPoint = 0; iPoint < nPointDomain; iPoint++) for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->AddSolution(iVar, config->GetRelaxation_Factor_AdjFlow()*LinSysSol[iPoint*nVar+iVar]); + nodes->AddSolution(iPoint,iVar, config->GetRelaxation_Factor_AdjFlow()*LinSysSol[iPoint*nVar+iVar]); } /*--- MPI solution ---*/ @@ -2355,24 +2351,24 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { - Psi = node[iPoint]->GetSolution(); - U = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); - Enthalpy = solver_container[FLOW_SOL]->node[iPoint]->GetEnthalpy(); + Psi = nodes->GetSolution(iPoint); + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); + Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint); conspsi = U[0]*Psi[0] + U[0]*Enthalpy*Psi[nDim+1]; for (iDim = 0; iDim < nDim; iDim++) conspsi += U[iDim+1]*Psi[iDim+1]; - node[iPoint]->SetAuxVar(conspsi); + nodes->SetAuxVar(iPoint,conspsi); /*--- Also load the auxiliary variable for first neighbors ---*/ for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) { Neigh = geometry->node[iPoint]->GetPoint(iNeigh); - Psi = node[Neigh]->GetSolution(); - U = solver_container[FLOW_SOL]->node[Neigh]->GetSolution(); - Enthalpy = solver_container[FLOW_SOL]->node[Neigh]->GetEnthalpy(); + Psi = nodes->GetSolution(Neigh); + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(Neigh); + Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(Neigh); conspsi = U[0]*Psi[0] + U[0]*Enthalpy*Psi[nDim+1]; for (iDim = 0; iDim < nDim; iDim++) conspsi += U[iDim+1]*Psi[iDim+1]; - node[Neigh]->SetAuxVar(conspsi); + nodes->SetAuxVar(Neigh,conspsi); } } } @@ -2391,16 +2387,16 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { - d = node[iPoint]->GetForceProj_Vector(); + d = nodes->GetForceProj_Vector(iPoint); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); Area = 0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area); - PrimVar_Grad = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); - ConsPsi_Grad = node[iPoint]->GetAuxVarGradient(); - ConsPsi = node[iPoint]->GetAuxVar(); + PrimVar_Grad = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); + ConsPsi_Grad = nodes->GetAuxVarGradient(iPoint); + ConsPsi = nodes->GetAuxVar(iPoint); d_press = 0.0; grad_v = 0.0; v_gradconspsi = 0.0; for (iDim = 0; iDim < nDim; iDim++) { @@ -2415,7 +2411,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver /*-- Retrieve the value of the theta gradient ---*/ - v_gradconspsi += solver_container[FLOW_SOL]->node[iPoint]->GetVelocity(iDim) * ConsPsi_Grad[iDim]; + v_gradconspsi += solver_container[FLOW_SOL]->GetNodes()->GetVelocity(iPoint, iDim) * ConsPsi_Grad[iDim]; /*--- Additional sensitivity term for grid movement ---*/ @@ -2460,8 +2456,8 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { - Psi = node[iPoint]->GetSolution(); - U = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + Psi = nodes->GetSolution(iPoint); + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); Mach_Inf = config->GetMach(); @@ -2478,7 +2474,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver Vn += UnitNormal[iDim]*Velocity[iDim]; } - SoundSpeed = solver_container[FLOW_SOL]->node[iPoint]->GetSoundSpeed(); + SoundSpeed = solver_container[FLOW_SOL]->GetNodes()->GetSoundSpeed(iPoint); if (Vn0) { /*TODO: MDO compatible*/ Sens_BPress[iMarker]+=Psi[nDim+1]*(SoundSpeed*SoundSpeed-Vn*Vn)/(Vn*Gamma_Minus_One); @@ -2507,8 +2503,8 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { - Psi = node[iPoint]->GetSolution(); - U = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + Psi = nodes->GetSolution(iPoint); + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); Mach_Inf = config->GetMach(); @@ -2660,12 +2656,12 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver if (geometry->node[iPoint]->GetDomain()) { Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - p = solver_container[FLOW_SOL]->node[iPoint]->GetPressure(); + p = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint); Mach_Inf = config->GetMach(); if (grid_movement) Mach_Inf = config->GetMach_Motion(); - d = node[iPoint]->GetForceProj_Vector(); + d = nodes->GetForceProj_Vector(iPoint); Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area); for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim]/Area; @@ -3017,14 +3013,14 @@ void CAdjEulerSolver::BC_Euler_Wall(CGeometry *geometry, Normal = geometry->vertex[val_marker][iVertex]->GetNormal(); /*--- Create a copy of the adjoint solution ---*/ - Psi_Aux = node[iPoint]->GetSolution(); + Psi_Aux = nodes->GetSolution(iPoint); for (iVar = 0; iVar < nVar; iVar++) Psi[iVar] = Psi_Aux[iVar]; /*--- Flow solution ---*/ - U = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); /*--- Read the value of the objective function ---*/ - d = node[iPoint]->GetForceProj_Vector(); + d = nodes->GetForceProj_Vector(iPoint); /*--- Normal vector computation ---*/ Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; @@ -3034,8 +3030,8 @@ void CAdjEulerSolver::BC_Euler_Wall(CGeometry *geometry, for (iDim = 0; iDim < nDim; iDim++) Velocity[iDim] = U[iDim+1] / U[0]; - Enthalpy = solver_container[FLOW_SOL]->node[iPoint]->GetEnthalpy(); - sq_vel = 0.5*solver_container[FLOW_SOL]->node[iPoint]->GetVelocity2(); + Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint); + sq_vel = 0.5*solver_container[FLOW_SOL]->GetNodes()->GetVelocity2(iPoint); /*--- Compute projections ---*/ ProjVel = 0.0; bcn = 0.0; vn = 0.0; phin = 0.0; @@ -3170,15 +3166,15 @@ void CAdjEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contain /*--- Create a copy of the adjoint solution ---*/ - for (iVar = 0; iVar < nVar; iVar++) Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + for (iVar = 0; iVar < nVar; iVar++) Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Retrieve flow variables ---*/ for (iDim = 0; iDim < nDim; iDim++) - Velocity[iDim] = solver_container[FLOW_SOL]->node[iPoint]->GetVelocity(iDim); + Velocity[iDim] = solver_container[FLOW_SOL]->GetNodes()->GetVelocity(iPoint, iDim); - Enthalpy = solver_container[FLOW_SOL]->node[iPoint]->GetEnthalpy(); - sq_vel = 0.5*solver_container[FLOW_SOL]->node[iPoint]->GetVelocity2(); + Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint); + sq_vel = 0.5*solver_container[FLOW_SOL]->GetNodes()->GetVelocity2(iPoint); /*--- Compute projections ---*/ @@ -3319,7 +3315,7 @@ void CAdjEulerSolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solve /*--- Store the solution for both points ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Psi_i[iVar] = node[iPoint]->GetSolution(iVar); + Psi_i[iVar] = nodes->GetSolution(iPoint,iVar); Psi_j[iVar] = GetDonorAdjVar(val_marker, iVertex, iVar); } @@ -3329,7 +3325,7 @@ void CAdjEulerSolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solve /*--- Conservative variables w/o reconstruction (the same at both points) ---*/ - V_i = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); numerics->SetPrimitive(V_i, V_i); /*--- Set Normal ---*/ @@ -3384,7 +3380,7 @@ void CAdjEulerSolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solve /*--- Store the solution for both points ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Psi_i[iVar] = node[iPoint]->GetSolution(iVar); + Psi_i[iVar] = nodes->GetSolution(iPoint,iVar); Psi_j[iVar] = GetDonorAdjVar(val_marker, iVertex, iVar); } @@ -3401,7 +3397,7 @@ void CAdjEulerSolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solve /*--- Read the jump ---*/ - IntBoundary_Jump = node[iPoint]->GetIntBoundary_Jump(); + IntBoundary_Jump = nodes->GetIntBoundary_Jump(iPoint); /*--- Inner point ---*/ @@ -3433,7 +3429,7 @@ void CAdjEulerSolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solve /*--- Conservative variables w/o reconstruction (the same at both points) ---*/ - V_i = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); numerics->SetPrimitive(V_i, V_i); /*--- Compute residual ---*/ @@ -3495,14 +3491,14 @@ void CAdjEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); conv_numerics->SetPrimitive(V_domain, V_infty); /*--- Adjoint flow solution at the wall ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); Psi_infty[iVar] = 0.0; } conv_numerics->SetAdjointVar(Psi_domain, Psi_infty); @@ -3541,7 +3537,7 @@ void CAdjEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Gradient and limiter of Adjoint Variables ---*/ - visc_numerics->SetAdjointVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetAdjointVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute residual ---*/ @@ -3597,12 +3593,12 @@ void CAdjEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_ /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Construct the flow & adjoint states at the inlet ---*/ /*--- Supersonic Inlet: All characteristic are exiting: using nearest neighbor to set value ---*/ @@ -3654,7 +3650,7 @@ void CAdjEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_ /*--- Gradient and limiter of Adjoint Variables ---*/ - visc_numerics->SetAdjointVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetAdjointVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute residual ---*/ @@ -3712,12 +3708,12 @@ void CAdjEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Construct the flow & adjoint states at the inlet ---*/ @@ -3769,7 +3765,7 @@ void CAdjEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver /*--- Gradient and limiter of Adjoint Variables ---*/ - visc_numerics->SetAdjointVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetAdjointVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute residual ---*/ @@ -3838,12 +3834,12 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Construct the flow & adjoint states at the inlet ---*/ @@ -3871,11 +3867,11 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Get primitives from current inlet state. ---*/ for (iDim = 0; iDim < nDim; iDim++) - Velocity[iDim] = solver_container[FLOW_SOL]->node[iPoint]->GetVelocity(iDim); + Velocity[iDim] = solver_container[FLOW_SOL]->GetNodes()->GetVelocity(iPoint, iDim); /*--- Retrieve current adjoint solution values at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi_inlet[iVar] = node[iPoint]->GetSolution(iVar); + Psi_inlet[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Some terms needed for the adjoint BC ---*/ bcn = 0.0; phin = 0.0; @@ -3944,7 +3940,7 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Gradient and limiter of Adjoint Variables ---*/ - visc_numerics->SetAdjointVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetAdjointVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute residual ---*/ @@ -4035,12 +4031,12 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Construct the flow & adjoint states at the outlet ---*/ @@ -4212,8 +4208,8 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, if (config->GetViscous()) { /*--- Set laminar and eddy viscosity at the infinity ---*/ - V_outlet[nDim+5] = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - V_outlet[nDim+6] = solver_container[FLOW_SOL]->node[iPoint]->GetEddyViscosity(); + V_outlet[nDim+5] = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + V_outlet[nDim+6] = solver_container[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint); /*--- Points in edge, coordinates and normal vector---*/ visc_numerics->SetNormal(Normal); @@ -4225,13 +4221,13 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, visc_numerics->SetAdjointVar(Psi_domain, Psi_outlet); /*--- Turbulent kinetic energy ---*/ - if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Gradient and limiter of Adjoint Variables ---*/ - visc_numerics->SetAdjointVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetAdjointVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute residual ---*/ @@ -4298,12 +4294,12 @@ void CAdjEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_con /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Subsonic flow is assumed, note that there is no non-dimensionalization. ---*/ @@ -4422,18 +4418,18 @@ void CAdjEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_co /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Adjoint flow solution at the exhaust (this should be improved using characteristics bc) ---*/ Psi_exhaust[0] = 0.0; for (iDim = 0; iDim < nDim; iDim++) - Psi_exhaust[iDim+1] = node[Point_Normal]->GetSolution(iDim+1); + Psi_exhaust[iDim+1] = nodes->GetSolution(Point_Normal,iDim+1); Psi_exhaust[nDim+1] = 0.0; /*--- Set the flow and adjoint states in the solver ---*/ @@ -4498,13 +4494,13 @@ void CAdjEulerSolver::BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_con /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); - Psi_inlet[iVar] = 0.0;// node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); + Psi_inlet[iVar] = 0.0;// nodes->GetSolution(iPoint,iVar); } #ifdef CHECK @@ -4631,13 +4627,13 @@ void CAdjEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_co /*--- Retrieve solution at the boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Adjoint flow solution at the boundary ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Psi_domain[iVar] = node[iPoint]->GetSolution(iVar); - Psi_outlet[iVar] = 0.0; //node[iPoint]->GetSolution(iVar); + Psi_domain[iVar] = nodes->GetSolution(iPoint,iVar); + Psi_outlet[iVar] = 0.0; //nodes->GetSolution(iPoint,iVar); } #ifdef CHECK @@ -4650,7 +4646,7 @@ void CAdjEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_co Psi_outlet[0] = 0.0; for (iDim = 0; iDim < nDim; iDim++) - Psi_outlet[iDim+1] = node[Point_Normal]->GetSolution(iDim+1); + Psi_outlet[iDim+1] = nodes->GetSolution(Point_Normal,iDim+1); Psi_outlet[nDim+1] = 0.0; #endif @@ -4701,9 +4697,9 @@ void CAdjEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Solution at time n-1, n and n+1 ---*/ - U_time_nM1 = node[iPoint]->GetSolution_time_n1(); - U_time_n = node[iPoint]->GetSolution_time_n(); - U_time_nP1 = node[iPoint]->GetSolution(); + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); /*--- Volume at time n-1 and n ---*/ if (Grid_Movement) { @@ -4800,7 +4796,7 @@ void CAdjEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf index = counter*Restart_Vars[1] + skipVars; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); iPoint_Global_Local++; /*--- Increment the overall counter for how many points have been loaded. ---*/ @@ -4839,12 +4835,12 @@ void CAdjEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver[iMesh-1][ADJFLOW_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver[iMesh][ADJFLOW_SOL]->node[iPoint]->SetSolution(Solution); + solver[iMesh][ADJFLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver[iMesh][ADJFLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); solver[iMesh][ADJFLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); @@ -4906,8 +4902,6 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short nVarGrad = nVar; - node = new CVariable*[nPoint]; - /*--- Define some auxiliary arrays related to the residual ---*/ Point_Max = new unsigned long[nVar]; for (iVar = 0; iVar < nVar; iVar++) Point_Max[iVar] = 0; @@ -5059,8 +5053,8 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short /*--- Initialize the solution to the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CAdjNSVariable(PsiRho_Inf, Phi_Inf, PsiE_Inf, nDim, nVar, config); + nodes = new CAdjNSVariable(PsiRho_Inf, Phi_Inf, PsiE_Inf, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); /*--- Read the restart metadata. ---*/ @@ -5190,13 +5184,13 @@ void CAdjNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container /*--- Initialize the non-physical points vector ---*/ - node[iPoint]->SetNon_Physical(false); + nodes->SetNon_Physical(iPoint,false); /*--- Set the primitive variables compressible adjoint variables ---*/ - RightSol = node[iPoint]->SetPrimVar(SharpEdge_Distance, false, config); - if (!RightSol) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; } + RightSol = nodes->SetPrimVar(iPoint,SharpEdge_Distance, false, config); + if (!RightSol) { nodes->SetNon_Physical(iPoint,true); ErrorCounter++; } /*--- Initialize the convective residual vector ---*/ @@ -5261,14 +5255,14 @@ void CAdjNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai /*--- Primitive variables w/o reconstruction and adjoint variables w/o reconstruction---*/ - numerics->SetPrimitive(solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(), - solver_container[FLOW_SOL]->node[jPoint]->GetPrimitive()); + numerics->SetPrimitive(solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(jPoint)); - numerics->SetAdjointVar(node[iPoint]->GetSolution(), node[jPoint]->GetSolution()); + numerics->SetAdjointVar(nodes->GetSolution(iPoint), nodes->GetSolution(jPoint)); /*--- Gradient and limiter of Adjoint Variables ---*/ - numerics->SetAdjointVarGradient(node[iPoint]->GetGradient(), node[jPoint]->GetGradient()); + numerics->SetAdjointVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(jPoint)); /*--- Compute residual ---*/ @@ -5305,13 +5299,13 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Primitive variables w/o reconstruction, and its gradient ---*/ - numerics->SetPrimitive(solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(), NULL); + numerics->SetPrimitive(solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint), NULL); - numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(), NULL); + numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint), NULL); /*--- Gradient of adjoint variables ---*/ - numerics->SetAdjointVarGradient(node[iPoint]->GetGradient(), NULL); + numerics->SetAdjointVarGradient(nodes->GetGradient(iPoint), NULL); /*--- Set volume ---*/ @@ -5323,15 +5317,15 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Turbulent variables w/o reconstruction and its gradient ---*/ - numerics->SetTurbVar(solver_container[TURB_SOL]->node[iPoint]->GetSolution(), NULL); + numerics->SetTurbVar(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint), NULL); - numerics->SetTurbVarGradient(solver_container[TURB_SOL]->node[iPoint]->GetGradient(), NULL); + numerics->SetTurbVarGradient(solver_container[TURB_SOL]->GetNodes()->GetGradient(iPoint), NULL); /*--- Turbulent adjoint variables w/o reconstruction and its gradient ---*/ - numerics->SetTurbAdjointVar(solver_container[ADJTURB_SOL]->node[iPoint]->GetSolution(), NULL); + numerics->SetTurbAdjointVar(solver_container[ADJTURB_SOL]->GetNodes()->GetSolution(iPoint), NULL); - numerics->SetTurbAdjointGradient(solver_container[ADJTURB_SOL]->node[iPoint]->GetGradient(), NULL); + numerics->SetTurbAdjointGradient(solver_container[ADJTURB_SOL]->GetNodes()->GetGradient(iPoint), NULL); /*--- Set distance to the surface ---*/ @@ -5363,28 +5357,28 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Conservative variables w/o reconstruction ---*/ - second_numerics->SetConservative(solver_container[FLOW_SOL]->node[iPoint]->GetSolution(), - solver_container[FLOW_SOL]->node[jPoint]->GetSolution()); + second_numerics->SetConservative(solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetSolution(jPoint)); /*--- Gradient of primitive variables w/o reconstruction ---*/ - second_numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(), - solver_container[FLOW_SOL]->node[jPoint]->GetGradient_Primitive()); + second_numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(jPoint)); /*--- Viscosity ---*/ - second_numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(), - solver_container[FLOW_SOL]->node[jPoint]->GetLaminarViscosity()); + second_numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(jPoint)); /*--- Turbulent variables w/o reconstruction ---*/ - second_numerics->SetTurbVar(solver_container[TURB_SOL]->node[iPoint]->GetSolution(), - solver_container[TURB_SOL]->node[jPoint]->GetSolution()); + second_numerics->SetTurbVar(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint), + solver_container[TURB_SOL]->GetNodes()->GetSolution(jPoint)); /*--- Turbulent adjoint variables w/o reconstruction ---*/ - second_numerics->SetTurbAdjointVar(solver_container[ADJTURB_SOL]->node[iPoint]->GetSolution(), - solver_container[ADJTURB_SOL]->node[jPoint]->GetSolution()); + second_numerics->SetTurbAdjointVar(solver_container[ADJTURB_SOL]->GetNodes()->GetSolution(iPoint), + solver_container[ADJTURB_SOL]->GetNodes()->GetSolution(jPoint)); /*--- Set distance to the surface ---*/ @@ -5410,8 +5404,8 @@ void CAdjNSSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the adjoint variables ---*/ - second_numerics->SetAdjointVar(node[iPoint]->GetSolution(), - node[iPoint]->GetSolution()); + second_numerics->SetAdjointVar(nodes->GetSolution(iPoint), + nodes->GetSolution(iPoint)); /*--- Load the volume of the dual mesh cell ---*/ second_numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -5527,10 +5521,10 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con if (geometry->node[iPoint]->GetDomain()) { - PsiVar_Grad = node[iPoint]->GetGradient(); - PrimVar_Grad = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); + PsiVar_Grad = nodes->GetGradient(iPoint); + PrimVar_Grad = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); - Laminar_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + Laminar_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); heat_flux_factor = Cp * Laminar_Viscosity / Prandtl_Lam; @@ -5598,16 +5592,16 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con if (grid_movement) { - Psi = node[iPoint]->GetSolution(); - U = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + Psi = nodes->GetSolution(iPoint); + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); Density = U[0]; - Pressure = solver_container[FLOW_SOL]->node[iPoint]->GetPressure(); - Enthalpy = solver_container[FLOW_SOL]->node[iPoint]->GetEnthalpy(); + Pressure = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint); + Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - val_turb_ke = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0); + val_turb_ke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); else val_turb_ke = 0.0; @@ -5756,8 +5750,8 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { - Psi = node[iPoint]->GetSolution(); - U = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + Psi = nodes->GetSolution(iPoint); + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); Mach_Inf = config->GetMach(); @@ -5912,12 +5906,12 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con if (geometry->node[iPoint]->GetDomain()) { Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - p = solver_container[FLOW_SOL]->node[iPoint]->GetPressure(); + p = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint); Mach_Inf = config->GetMach(); if (grid_movement) Mach_Inf = config->GetMach_Motion(); - d = node[iPoint]->GetForceProj_Vector(); + d = nodes->GetForceProj_Vector(iPoint); Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area); for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = -Normal[iDim]/Area; @@ -6024,7 +6018,7 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai unsigned short iDim, iVar, jVar, jDim; unsigned long iVertex, iPoint, total_index, Point_Normal; - su2double *d, l1psi, vartheta, Sigma_5, **PsiVar_Grad, phi[3]; + su2double *d, l1psi, vartheta, Sigma_5, **PsiVar_Grad, phi[3] = {}; su2double sq_vel, ProjGridVel, Enthalpy = 0.0, *GridVel; su2double ViscDens, XiDens, Density, Pressure = 0.0, dPhiE_dn; su2double Laminar_Viscosity = 0.0, Eddy_Viscosity = 0.0; @@ -6080,11 +6074,11 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai /*--- Retrieve adjoint solution at the wall boundary node ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi[iVar] = node[iPoint]->GetSolution(iVar); + Psi[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Get the force projection vector (based on the objective function) ---*/ - d = node[iPoint]->GetForceProj_Vector(); + d = nodes->GetForceProj_Vector(iPoint); /*--- Set the adjoint velocity BC ---*/ @@ -6103,11 +6097,11 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai contribution to the residual at this node. ---*/ for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetSolution_Old(iDim+1, phi[iDim]); + nodes->SetSolution_Old(iPoint,iDim+1, phi[iDim]); for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); /*--- Compute additional contributions to the adjoint density and energy equations which will be added to the residual (weak imposition) ---*/ @@ -6132,11 +6126,11 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai /*--- Get some additional quantities from the flow solution ---*/ - Density = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - Pressure = solver_container[FLOW_SOL]->node[iPoint]->GetPressure(); - Enthalpy = solver_container[FLOW_SOL]->node[iPoint]->GetEnthalpy(); - Laminar_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - Eddy_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetEddyViscosity(); // Should be zero at the wall + Density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + Pressure = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint); + Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint); + Laminar_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + Eddy_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint); // Should be zero at the wall ViscDens = (Laminar_Viscosity + Eddy_Viscosity) / Density; XiDens = Gamma * (Laminar_Viscosity/Prandtl_Lam + Eddy_Viscosity/Prandtl_Turb) / Density; @@ -6171,7 +6165,7 @@ void CAdjNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai /*--- Store the adjoint velocity and energy gradients for clarity ---*/ - PsiVar_Grad = node[iPoint]->GetGradient(); + PsiVar_Grad = nodes->GetGradient(iPoint); for (iDim = 0; iDim < nDim; iDim++) { GradPsiE[iDim] = PsiVar_Grad[nVar-1][iDim]; for (jDim = 0; jDim < nDim; jDim++) @@ -6460,7 +6454,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Retrieve adjoint solution at the wall boundary node ---*/ for (iVar = 0; iVar < nVar; iVar++) - Psi[iVar] = node[iPoint]->GetSolution(iVar); + Psi[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Normal vector for this vertex (negate for outward convention) ---*/ geometry->vertex[val_marker][iVertex]->GetNormal(Normal); @@ -6468,7 +6462,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; /*--- Get the force projection vector (based on the objective function) ---*/ - d = node[iPoint]->GetForceProj_Vector(); + d = nodes->GetForceProj_Vector(iPoint); /*--- Adjustments to strong boundary condition for dynamic meshes ---*/ if ( grid_movement) { @@ -6485,9 +6479,9 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Strong BC imposition for the adjoint velocity equations ---*/ for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetSolution_Old(iDim+1, phi[iDim]); + nodes->SetSolution_Old(iPoint,iDim+1, phi[iDim]); if (implicit) { for (iVar = 1; iVar <= nDim; iVar++) { total_index = iPoint*nVar+iVar; @@ -6496,12 +6490,12 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont } /*--- Get transport coefficient information ---*/ - Laminar_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - Eddy_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetEddyViscosity(); + Laminar_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + Eddy_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint); Thermal_Conductivity = Cp * ( Laminar_Viscosity/Prandtl_Lam +Eddy_Viscosity/Prandtl_Turb); -// GradV = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); +// GradV = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); /*--- Calculate Dirichlet condition for energy equation ---*/ if (!heat_flux_obj) { @@ -6514,7 +6508,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont Area = sqrt(Area); /*--- Temperature gradient term ---*/ - GradT = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive()[0]; + GradT = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint)[0]; kGTdotn = 0.0; for (iDim = 0; iDim < nDim; iDim++) kGTdotn += Cp * Laminar_Viscosity/Prandtl_Lam*GradT[iDim]*Normal[iDim]/Area; @@ -6529,8 +6523,8 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Strong BC enforcement of the energy equation ---*/ LinSysRes.SetBlock_Zero(iPoint, nVar-1); - node[iPoint]->SetEnergy_ResTruncError_Zero(); - node[iPoint]->SetSolution_Old(nDim+1, q); + nodes->SetEnergy_ResTruncError_Zero(iPoint); + nodes->SetSolution_Old(iPoint,nDim+1, q); if (implicit) { iVar = nDim+1; total_index = iPoint*nVar+iVar; @@ -6540,13 +6534,13 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Additional contributions to adjoint density (weak imposition) ---*/ /*--- Acquire gradient information ---*/ - PsiVar_Grad = node[iPoint]->GetGradient(); - GradP = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive()[nVar-1]; - GradDens = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive()[nVar]; + PsiVar_Grad = nodes->GetGradient(iPoint); + GradP = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint)[nVar-1]; + GradDens = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint)[nVar]; /*--- Acqure flow information ---*/ - rho = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - pressure = solver_container[FLOW_SOL]->node[iPoint]->GetPressure(); + rho = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + pressure = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint); invrho3 = (1.0/rho)*(1.0/rho)*(1.0/rho); /*--- Calculate supporting quantities ---*/ @@ -6566,7 +6560,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont Res_Visc_i[0] = -mu2*Gamma/(rho*Gamma_Minus_One)*(pressure/rho)*gpsi5n; /*--- Components of the effective and adjoint stress tensors ---*/ - PsiVar_Grad = node[iPoint]->GetGradient(); + PsiVar_Grad = nodes->GetGradient(iPoint); div_phi = 0; for (iDim = 0; iDim < nDim; iDim++) { div_phi += PsiVar_Grad[iDim+1][iDim]; @@ -6583,16 +6577,16 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont force_stress += Normal[iDim]*Tau[iDim][jDim]*d[jDim]; /*--- \partial \mu_dyn \partial T ---*/ - // mu_dyn = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - // Temp = solver_container[FLOW_SOL]->node[iPoint]->GetTemperature(); + // mu_dyn = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + // Temp = solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); dVisc_T = 0.0; // dVisc_T = mu_dyn*(Temp+3.0*mu2)/(2.0*Temp*(Temp+mu2)); /*--- \Sigma_5 Check Area computation for Res_Conv[0] ---*/ Sigma_5 = (Gamma/Cp)*dVisc_T*force_stress; /*--- Imposition of residuals ---*/ - rho = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - pressure = solver_container[FLOW_SOL]->node[iPoint]->GetPressure(); + rho = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + pressure = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint); Res_Conv_i[0] = pressure*Sigma_5/(Gamma_Minus_One*rho*rho); /*--- Flux contribution and Jacobian contributions for moving @@ -6604,7 +6598,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont GridVel = geometry->node[iPoint]->GetGridVel(); /*--- Get the enthalpy from the direct solution ---*/ - Enthalpy = solver_container[FLOW_SOL]->node[iPoint]->GetEnthalpy(); + Enthalpy = solver_container[FLOW_SOL]->GetNodes()->GetEnthalpy(iPoint); /*--- Compute projections, velocity squared divided by two, and other inner products. Note that we are imposing v = u_wall from @@ -6634,9 +6628,9 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Viscous flux contributions at the wall node ---*/ - U = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); - Laminar_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - Eddy_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetEddyViscosity(); // Should be zero at the wall + U = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); + Laminar_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + Eddy_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint); // Should be zero at the wall Density = U[0]; for (iDim = 0; iDim < nDim; iDim++) { Velocity[iDim] = GridVel[iDim]; @@ -6648,7 +6642,7 @@ void CAdjNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont XiDens = Gamma * (Laminar_Viscosity/Prandtl_Lam + Eddy_Viscosity/Prandtl_Turb) / Density; /*--- Average of the derivatives of the adjoint variables ---*/ - PsiVar_Grad = node[iPoint]->GetGradient(); + PsiVar_Grad = nodes->GetGradient(iPoint); for (iDim = 0; iDim < nDim; iDim++) { GradPsiE[iDim] = PsiVar_Grad[nVar-1][iDim]; diff --git a/SU2_CFD/src/solver_adjoint_turbulent.cpp b/SU2_CFD/src/solver_adjoint_turbulent.cpp index 30357a6844d0..99b6b030ca6f 100644 --- a/SU2_CFD/src/solver_adjoint_turbulent.cpp +++ b/SU2_CFD/src/solver_adjoint_turbulent.cpp @@ -41,7 +41,7 @@ CAdjTurbSolver::CAdjTurbSolver(void) : CSolver() {} CAdjTurbSolver::CAdjTurbSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CSolver() { - unsigned long iPoint; + unsigned short iDim, iVar, nLineLets; adjoint = true; @@ -124,16 +124,12 @@ CAdjTurbSolver::CAdjTurbSolver(CGeometry *geometry, CConfig *config, unsigned sh } /*--- Far-Field values and initizalization ---*/ - node = new CVariable* [nPoint]; bool restart = config->GetRestart(); - - if (!restart || (iMesh != MESH_0)) { - PsiNu_Inf = 0.0; - for (iPoint = 0; iPoint < nPoint; iPoint++) { - node[iPoint] = new CAdjTurbVariable(PsiNu_Inf, nDim, nVar, config); - } - } - else { + + nodes = new CAdjTurbVariable(0.0, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); + + if (restart && (iMesh == MESH_0)) { unsigned long index; su2double dull_val; string filename, AdjExt, text_line; @@ -173,7 +169,8 @@ CAdjTurbSolver::CAdjTurbSolver(CGeometry *geometry, CConfig *config, unsigned sh if (nDim == 2) point_line >> index >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> Solution[0]; if (nDim == 3) point_line >> index >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> Solution[0]; - node[iPoint_Local] = new CAdjTurbVariable(Solution[0], nDim, nVar, config); + nodes->SetSolution(iPoint_Local,0,Solution[0]); + nodes->SetSolution_Old(iPoint_Local,0,Solution[0]); iPoint_Global_Local++; } @@ -193,16 +190,8 @@ CAdjTurbSolver::CAdjTurbSolver(CGeometry *geometry, CConfig *config, unsigned sh string("It could be empty lines at the end of the file."), CURRENT_FUNCTION); } - /*--- Instantiate the variable class with an arbitrary solution - at any halo/periodic nodes. The initial solution can be arbitrary, - because a send/recv is performed immediately in the solver. ---*/ - for (iPoint = nPointDomain; iPoint < nPoint; iPoint++) { - node[iPoint] = new CAdjTurbVariable(Solution[0], nDim, nVar, config); - } - /*--- Close the restart file ---*/ restart_file.close(); - } /*--- MPI solution ---*/ @@ -213,6 +202,7 @@ CAdjTurbSolver::CAdjTurbSolver(CGeometry *geometry, CConfig *config, unsigned sh } CAdjTurbSolver::~CAdjTurbSolver(void) { + if (nodes != nullptr) delete nodes; } void CAdjTurbSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { @@ -228,7 +218,7 @@ void CAdjTurbSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont Solution[0] = 0.0; /*--- Set the solution values and zero the residual ---*/ - node[iPoint]->SetSolution_Old(Solution); + nodes->SetSolution_Old(iPoint,Solution); LinSysRes.SetBlock_Zero(iPoint); /*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/ @@ -252,7 +242,7 @@ void CAdjTurbSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_co Solution[0] = 0.0; /*--- Set the solution values and zero the residual ---*/ - node[iPoint]->SetSolution_Old(Solution); + nodes->SetSolution_Old(iPoint,Solution); LinSysRes.SetBlock_Zero(iPoint); /*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/ @@ -274,11 +264,11 @@ void CAdjTurbSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe conv_numerics->SetNormal(geometry->vertex[val_marker][iVertex]->GetNormal()); /*--- Set Conservative variables (for convection) ---*/ - su2double* U_i = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + su2double* U_i = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); conv_numerics->SetConservative(U_i, NULL); /*--- Turbulent adjoint variables w/o reconstruction ---*/ - su2double* TurbPsi_i = node[iPoint]->GetSolution(); + su2double* TurbPsi_i = nodes->GetSolution(iPoint); conv_numerics->SetTurbAdjointVar(TurbPsi_i, NULL); /*--- Add Residuals and Jacobians ---*/ @@ -337,21 +327,21 @@ void CAdjTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta jPoint = geometry->edge[iEdge]->GetNode(1); /*--- Conservative variables w/o reconstruction ---*/ - U_i = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); - U_j = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(); + U_i = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); + U_j = solver_container[FLOW_SOL]->GetNodes()->GetSolution(jPoint); numerics->SetConservative(U_i, U_j); /*--- Set normal vectors and length ---*/ numerics->SetNormal(geometry->edge[iEdge]->GetNormal()); /*--- Turbulent adjoint variables w/o reconstruction ---*/ - TurbPsi_i = node[iPoint]->GetSolution(); - TurbPsi_j = node[jPoint]->GetSolution(); + TurbPsi_i = nodes->GetSolution(iPoint); + TurbPsi_j = nodes->GetSolution(jPoint); numerics->SetTurbAdjointVar(TurbPsi_i, TurbPsi_j); /*--- Gradient of turbulent variables w/o reconstruction ---*/ - TurbVar_Grad_i = solver_container[TURB_SOL]->node[iPoint]->GetGradient(); - TurbVar_Grad_j = solver_container[TURB_SOL]->node[jPoint]->GetGradient(); + TurbVar_Grad_i = solver_container[TURB_SOL]->GetNodes()->GetGradient(iPoint); + TurbVar_Grad_j = solver_container[TURB_SOL]->GetNodes()->GetGradient(jPoint); numerics->SetTurbVarGradient(TurbVar_Grad_i, TurbVar_Grad_j); // if (muscl) { @@ -361,8 +351,8 @@ void CAdjTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta // Vector_i[iDim] = 0.5*(geometry->node[jPoint]->GetCoord(iDim) - geometry->node[iPoint]->GetCoord(iDim)); // Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim)); // } -// Gradient_i = solver_container[FLOW_SOL]->node[iPoint]->GetGradient(); -// Gradient_j = solver_container[FLOW_SOL]->node[jPoint]->GetGradient(); +// Gradient_i = solver_container[FLOW_SOL]->GetNodes()->GetGradient(iPoint); +// Gradient_j = solver_container[FLOW_SOL]->GetNodes()->GetGradient(jPoint); // for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++) { // Project_Grad_i = 0; Project_Grad_j = 0; // for (iDim = 0; iDim < nDim; iDim++) { @@ -432,16 +422,16 @@ void CAdjTurbSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Conservative variables w/o reconstruction, turbulent variables w/o reconstruction, and turbulent adjoint variables w/o reconstruction ---*/ - numerics->SetConservative(solver_container[FLOW_SOL]->node[iPoint]->GetSolution(), solver_container[FLOW_SOL]->node[jPoint]->GetSolution()); - numerics->SetTurbVar(solver_container[TURB_SOL]->node[iPoint]->GetSolution(), solver_container[TURB_SOL]->node[jPoint]->GetSolution()); - numerics->SetTurbAdjointVar(node[iPoint]->GetSolution(), node[jPoint]->GetSolution()); + numerics->SetConservative(solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint), solver_container[FLOW_SOL]->GetNodes()->GetSolution(jPoint)); + numerics->SetTurbVar(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint), solver_container[TURB_SOL]->GetNodes()->GetSolution(jPoint)); + numerics->SetTurbAdjointVar(nodes->GetSolution(iPoint), nodes->GetSolution(jPoint)); /*--- Viscosity ---*/ - numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(), - solver_container[FLOW_SOL]->node[jPoint]->GetLaminarViscosity()); + numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(jPoint)); /*--- Turbulent adjoint variables w/o reconstruction ---*/ - numerics->SetTurbAdjointGradient(node[iPoint]->GetGradient(), node[jPoint]->GetGradient()); + numerics->SetTurbAdjointGradient(nodes->GetGradient(iPoint), nodes->GetGradient(jPoint)); /*--- Compute residual in a non-conservative way, and update ---*/ numerics->ComputeResidual(Residual_i, Residual_j, Jacobian_ii, Jacobian_ij, Jacobian_ji, Jacobian_jj, config); @@ -468,31 +458,31 @@ void CAdjTurbSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Conservative variables w/o reconstruction ---*/ - U_i = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + U_i = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); numerics->SetConservative(U_i, NULL); /*--- Gradient of primitive variables w/o reconstruction ---*/ - GradPrimVar_i = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); + GradPrimVar_i = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); numerics->SetPrimVarGradient(GradPrimVar_i, NULL); /*--- Laminar viscosity of the fluid ---*/ - numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(), 0.0); + numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint), 0.0); /*--- Turbulent variables w/o reconstruction ---*/ - TurbVar_i = solver_container[TURB_SOL]->node[iPoint]->GetSolution(); + TurbVar_i = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint); numerics->SetTurbVar(TurbVar_i, NULL); /*--- Gradient of Turbulent Variables w/o reconstruction ---*/ - TurbVar_Grad_i = solver_container[TURB_SOL]->node[iPoint]->GetGradient(); + TurbVar_Grad_i = solver_container[TURB_SOL]->GetNodes()->GetGradient(iPoint); numerics->SetTurbVarGradient(TurbVar_Grad_i, NULL); /*--- Turbulent adjoint variables w/o reconstruction ---*/ - TurbPsi_i = node[iPoint]->GetSolution(); + TurbPsi_i = nodes->GetSolution(iPoint); numerics->SetTurbAdjointVar(TurbPsi_i, NULL); /*--- Gradient of Adjoint flow variables w/o reconstruction (for non-conservative terms depending on gradients of flow adjoint vars.) ---*/ - PsiVar_Grad_i = solver_container[ADJFLOW_SOL]->node[iPoint]->GetGradient(); + PsiVar_Grad_i = solver_container[ADJFLOW_SOL]->GetNodes()->GetGradient(iPoint); numerics->SetAdjointVarGradient(PsiVar_Grad_i, NULL); /*--- Set volume and distances to the surface ---*/ @@ -517,13 +507,13 @@ void CAdjTurbSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta // jPoint = geometry->edge[iEdge]->GetNode(1); // // /*--- Gradient of turbulent variables w/o reconstruction ---*/ -// TurbVar_Grad_i = solver_container[TURB_SOL]->node[iPoint]->GetGradient(); -// TurbVar_Grad_j = solver_container[TURB_SOL]->node[jPoint]->GetGradient(); +// TurbVar_Grad_i = solver_container[TURB_SOL]->GetNodes()->GetGradient(iPoint); +// TurbVar_Grad_j = solver_container[TURB_SOL]->GetNodes()->GetGradient(jPoint); // second_numerics->SetTurbVarGradient(TurbVar_Grad_i, TurbVar_Grad_j); // // /*--- Turbulent adjoint variables w/o reconstruction ---*/ -// TurbPsi_i = node[iPoint]->GetSolution(); -// TurbPsi_j = node[jPoint]->GetSolution(); +// TurbPsi_i = nodes->GetSolution(iPoint); +// TurbPsi_j = nodes->GetSolution(jPoint); // second_numerics->SetTurbAdjointVar(TurbPsi_i, TurbPsi_j); // // /*--- Set normal vectors and length ---*/ @@ -565,7 +555,7 @@ void CAdjTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv /*--- Modify matrix diagonal to assure diagonal dominance ---*/ - Delta = Vol / (config->GetCFLRedCoeff_AdjTurb()*solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time()); + Delta = Vol / (config->GetCFLRedCoeff_AdjTurb()*solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint)); Jacobian.AddVal2Diag(iPoint, Delta); @@ -599,7 +589,7 @@ void CAdjTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv for (iPoint = 0; iPoint < nPointDomain; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->AddSolution(iVar, LinSysSol[iPoint*nVar+iVar]); + nodes->AddSolution(iPoint,iVar, LinSysSol[iPoint*nVar+iVar]); } /*--- MPI solution ---*/ diff --git a/SU2_CFD/src/solver_direct_elasticity.cpp b/SU2_CFD/src/solver_direct_elasticity.cpp index ad51b191021c..f59c14ac24b0 100644 --- a/SU2_CFD/src/solver_direct_elasticity.cpp +++ b/SU2_CFD/src/solver_direct_elasticity.cpp @@ -36,9 +36,7 @@ */ #include "../include/solver_structure.hpp" -#include "../include/variables/CFEAFSIBoundVariable.hpp" #include "../include/variables/CFEABoundVariable.hpp" -#include "../include/variables/CFEAVariable.hpp" #include "../../Common/include/toolboxes/printing_toolbox.hpp" #include @@ -64,7 +62,7 @@ CFEASolver::CFEASolver(bool mesh_deform_mode) : CSolver(mesh_deform_mode) { for (iTerm = 0; iTerm < MAX_TERMS; iTerm++) element_container[iTerm] = new CElement* [MAX_FE_KINDS](); - node = NULL; + nodes = nullptr; element_properties = NULL; elProperties = NULL; @@ -111,15 +109,17 @@ CFEASolver::CFEASolver(CGeometry *geometry, CConfig *config) : CSolver() { unsigned short iVar, jVar, iDim, jDim; unsigned short iTerm; - bool dynamic = (config->GetTime_Domain()); // Dynamic simulations. - bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); // Nonlinear analysis. - bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); // Generalized alpha method requires residual at previous time step. - - bool de_effects = config->GetDE_Effects(); // Test whether we consider dielectric elastomers - - bool body_forces = config->GetDeadLoad(); // Body forces (dead loads). - - element_based = false; // A priori we don't have an element-based input file (most of the applications will be like this) + bool dynamic = (config->GetTime_Domain()); + bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); + /*--- Generalized alpha method requires residual at previous time step. ---*/ + bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); + /*--- Test whether we consider dielectric elastomers ---*/ + bool de_effects = config->GetDE_Effects(); + bool body_forces = config->GetDeadLoad(); + + /*--- A priori we don't have an element-based input file (most of the applications will be like this) ---*/ + element_based = false; + topol_filter_applied = false; nElement = geometry->GetnElem(); @@ -169,8 +169,6 @@ CFEASolver::CFEASolver(CGeometry *geometry, CConfig *config) : CSolver() { } - node = new CVariable*[nPoint]; - /*--- Set element properties ---*/ elProperties = new unsigned long[4]; for (iVar = 0; iVar < 4; iVar++) @@ -230,28 +228,26 @@ CFEASolver::CFEASolver(CGeometry *geometry, CConfig *config) : CSolver() { else nSolVar = nVar; SolRest = new su2double[nSolVar]; + for (iVar = 0; iVar < nSolVar; iVar++) SolRest[iVar] = 0.0; - /*--- Initialize from zero everywhere. ---*/ - long iVertex; - bool isVertex, isInterface; + /*--- Initialize from zero everywhere ---*/ - for (iVar = 0; iVar < nSolVar; iVar++) SolRest[iVar] = 0.0; - for (iPoint = 0; iPoint < nPoint; iPoint++) { - isVertex = false; - isInterface = false; + nodes = new CFEABoundVariable(SolRest, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); + + /*--- Set which points are vertices and allocate boundary data. ---*/ + + for (iPoint = 0; iPoint < nPoint; iPoint++) for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - iVertex = geometry->node[iPoint]->GetVertex(iMarker); - if (iVertex != -1){ - isVertex = true; - if (config->GetMarker_All_Fluid_Load(iMarker) == YES) {isInterface = true;} + long iVertex = geometry->node[iPoint]->GetVertex(iMarker); + if (iVertex >= 0) { + nodes->Set_isVertex(iPoint,true); break; } } - if (isVertex && isInterface) node[iPoint] = new CFEAFSIBoundVariable(SolRest, nDim, nVar, config); - else if (isVertex && !isInterface) node[iPoint] = new CFEABoundVariable(SolRest, nDim, nVar, config); - else node[iPoint] = new CFEAVariable(SolRest, nDim, nVar, config); - } - + static_cast(nodes)->AllocateBoundaryVariables(config); + + bool reference_geometry = config->GetRefGeom(); if (reference_geometry) Set_ReferenceGeometry(geometry, config); @@ -523,6 +519,7 @@ CFEASolver::~CFEASolver(void) { if (Res_FSI_Cont != NULL) delete [] Res_FSI_Cont; + if (nodes != nullptr) delete nodes; } void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) { @@ -730,7 +727,7 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { if (nDim == 2) point_line >> Solution[0] >> Solution[1] >> index; if (nDim == 3) point_line >> Solution[0] >> Solution[1] >> Solution[2] >> index; - for (iVar = 0; iVar < nVar; iVar++) node[iPoint_Local]->SetPrestretch(iVar, Solution[iVar]); + for (iVar = 0; iVar < nVar; iVar++) nodes->SetPrestretch(iPoint_Local,iVar, Solution[iVar]); iPoint_Global_Local++; } @@ -790,7 +787,7 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { for (iVertex = 0; iVertex < nVertexS; iVertex++) { iPoint = geometry->vertex[MarkerS][iVertex]->GetNode(); for (iVar = 0; iVar < nVar; iVar++) - Buffer_Send_U[iVar*nVertexS+iVertex] = node[iPoint]->GetPrestretch(iVar); + Buffer_Send_U[iVar*nVertexS+iVertex] = nodes->GetPrestretch(iPoint,iVar); } #ifdef HAVE_MPI @@ -824,7 +821,7 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { /*--- Store received values back into the variable. ---*/ for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetPrestretch(iVar, SolRest[iVar]); + nodes->SetPrestretch(iPoint,iVar, SolRest[iVar]); } @@ -915,7 +912,7 @@ void CFEASolver::Set_ReferenceGeometry(CGeometry *geometry, CConfig *config) { Solution[2] = PrintingToolbox::stod(point_line[6]); } - for (iVar = 0; iVar < nVar; iVar++) node[iPoint_Local]->SetReference_Geometry(iVar, Solution[iVar]); + for (iVar = 0; iVar < nVar; iVar++) nodes->SetReference_Geometry(iPoint_Local,iVar, Solution[iVar]); iPoint_Global_Local++; } @@ -970,7 +967,7 @@ void CFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, bool body_forces = config->GetDeadLoad(); // Body forces (dead loads). - bool fsi = (config->GetnMarker_Fluid_Load() > 0); + bool fsi = config->GetFSI_Simulation(); bool consistent_interpolation = (!config->GetConservativeInterpolation() || (config->GetKindInterpolation() == WEIGHTED_AVERAGE)); @@ -1045,7 +1042,7 @@ void CFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, (body_forces && restart && initial_calc_restart && first_iter)) { // If the load is incremental, we have to reset the variable to avoid adding up over the increments if (incremental_load) { - for (iPoint = 0; iPoint < nPoint; iPoint++) node[iPoint]->Clear_BodyForces_Res(); + for (iPoint = 0; iPoint < nPoint; iPoint++) nodes->Clear_BodyForces_Res(iPoint); } // Compute the dead load term Compute_DeadLoad(geometry, numerics, config); @@ -1066,7 +1063,7 @@ void CFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, * Some external forces may be considered constant over the time step. */ if (first_iter) { - for (iPoint = 0; iPoint < nPoint; iPoint++) node[iPoint]->Clear_SurfaceLoad_Res(); + for (iPoint = 0; iPoint < nPoint; iPoint++) nodes->Clear_SurfaceLoad_Res(iPoint); } /* @@ -1085,7 +1082,7 @@ void CFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve the point ID ---*/ iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); /*--- Clear the residual of the node, to avoid adding on previous values ---*/ - node[iPoint]->Clear_SurfaceLoad_Res(); + nodes->Clear_SurfaceLoad_Res(iPoint); } } break; @@ -1095,7 +1092,7 @@ void CFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve the point ID ---*/ iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); /*--- Clear the residual of the node, to avoid adding on previous values ---*/ - node[iPoint]->Clear_SurfaceLoad_Res(); + nodes->Clear_SurfaceLoad_Res(iPoint); } break; } @@ -1111,34 +1108,19 @@ void CFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, void CFEASolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) { } void CFEASolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long TimeIter) { - - unsigned long iPoint, nPoint; - bool incremental_load = config->GetIncrementalLoad(); // If an incremental load is applied - - nPoint = geometry[MESH_0]->GetnPoint(); - + /*--- We store the current solution as "Solution Old", for the case that we need to retrieve it ---*/ - - if (incremental_load) { - for (iPoint = 0; iPoint < nPoint; iPoint++) node[iPoint]->Set_OldSolution(); - } - - + + if (config->GetIncrementalLoad()) nodes->Set_OldSolution(); + } void CFEASolver::ResetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long TimeIter) { - - unsigned long iPoint, nPoint; - bool incremental_load = config->GetIncrementalLoad(); // If an incremental load is applied - - nPoint = geometry[MESH_0]->GetnPoint(); - + /*--- We store the current solution as "Solution Old", for the case that we need to retrieve it ---*/ - - if (incremental_load) { - for (iPoint = 0; iPoint < nPoint; iPoint++) node[iPoint]->Set_Solution(); - } - + + if (config->GetIncrementalLoad()) nodes->Set_Solution(); + } void CFEASolver::Compute_StiffMatrix(CGeometry *geometry, CNumerics **numerics, CConfig *config) { @@ -1175,7 +1157,7 @@ void CFEASolver::Compute_StiffMatrix(CGeometry *geometry, CNumerics **numerics, for (iDim = 0; iDim < nDim; iDim++) { val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); - val_Sol = node[indexNode[iNode]]->GetSolution(iDim) + val_Coord; + val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Coord, iNode, iDim); element_container[FEA_TERM][EL_KIND]->SetCurr_Coord(val_Sol, iNode, iDim); } @@ -1269,7 +1251,7 @@ void CFEASolver::Compute_StiffMatrix_NodalStressRes(CGeometry *geometry, CNumeri indexNode[iNode] = geometry->elem[iElem]->GetNode(iNode); for (iDim = 0; iDim < nDim; iDim++) { val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); - val_Sol = node[indexNode[iNode]]->GetSolution(iDim) + val_Coord; + val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; /*--- Set current coordinate ---*/ element_container[FEA_TERM][EL_KIND]->SetCurr_Coord(val_Sol, iNode, iDim); @@ -1277,7 +1259,7 @@ void CFEASolver::Compute_StiffMatrix_NodalStressRes(CGeometry *geometry, CNumeri /*--- Set reference coordinate ---*/ if (prestretch_fem) { - val_Ref = node[indexNode[iNode]]->GetPrestretch(iDim); + val_Ref = nodes->GetPrestretch(indexNode[iNode],iDim); element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Ref, iNode, iDim); if (de_effects) element_container[DE_TERM][EL_KIND]->SetRef_Coord(val_Ref, iNode, iDim); } @@ -1541,10 +1523,10 @@ void CFEASolver::Compute_NodalStressRes(CGeometry *geometry, CNumerics **numeric indexNode[iNode] = geometry->elem[iElem]->GetNode(iNode); for (iDim = 0; iDim < nDim; iDim++) { val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); - val_Sol = node[indexNode[iNode]]->GetSolution(iDim) + val_Coord; + val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; element_container[FEA_TERM][EL_KIND]->SetCurr_Coord(val_Sol, iNode, iDim); if (prestretch_fem) { - val_Ref = node[indexNode[iNode]]->GetPrestretch(iDim); + val_Ref = nodes->GetPrestretch(indexNode[iNode],iDim); element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Ref, iNode, iDim); } else { @@ -1612,7 +1594,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, for (iPoint = 0; iPoint < nPointDomain; iPoint++) { for (iStress = 0; iStress < nStress; iStress++) { - node[iPoint]->SetStress_FEM(iStress, 0.0); + nodes->SetStress_FEM(iPoint,iStress, 0.0); } } @@ -1633,16 +1615,16 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, indexNode[iNode] = geometry->elem[iElem]->GetNode(iNode); // for (iDim = 0; iDim < nDim; iDim++) { // val_Coord = geometry->node[indexNode[iNode]]->GetCoord(iDim); - // val_Sol = node[indexNode[iNode]]->GetSolution(iDim) + val_Coord; + // val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; // element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Coord, iNode, iDim); // element_container[FEA_TERM][EL_KIND]->SetCurr_Coord(val_Sol, iNode, iDim); // } for (iDim = 0; iDim < nDim; iDim++) { val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); - val_Sol = node[indexNode[iNode]]->GetSolution(iDim) + val_Coord; + val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; element_container[FEA_TERM][EL_KIND]->SetCurr_Coord(val_Sol, iNode, iDim); if (prestretch_fem) { - val_Ref = node[indexNode[iNode]]->GetPrestretch(iDim); + val_Ref = nodes->GetPrestretch(indexNode[iNode],iDim); element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Ref, iNode, iDim); } else { @@ -1679,7 +1661,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, LinSysReact.AddBlock(indexNode[iNode], Res_Stress_i); for (iStress = 0; iStress < nStress; iStress++) { - node[indexNode[iNode]]->AddStress_FEM(iStress, simp_penalty * + nodes->AddStress_FEM(indexNode[iNode],iStress, simp_penalty * (element_container[FEA_TERM][EL_KIND]->Get_NodalStress(iNode, iStress) / geometry->node[indexNode[iNode]]->GetnElem()) ); } @@ -1697,7 +1679,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, /*--- Get the stresses, added up from all the elements that connect to the node ---*/ - Stress = node[iPoint]->GetStress_FEM(); + Stress = nodes->GetStress_FEM(iPoint); /*--- Compute the stress averaged from all the elements connecting to the node and the Von Mises stress ---*/ @@ -1731,7 +1713,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, } - node[iPoint]->SetVonMises_Stress(VonMises_Stress); + nodes->SetVonMises_Stress(iPoint,VonMises_Stress); /*--- Compute the maximum value of the Von Mises Stress ---*/ @@ -1812,10 +1794,10 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, /*--- Loop over all points, and set aux vector TimeRes_Aux = a0*U+a2*U'+a3*U'' ---*/ for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - Residual[iVar] = a_dt[0]*node[iPoint]->GetSolution_time_n(iVar) //a0*U(t) - - a_dt[0]*node[iPoint]->GetSolution(iVar) //a0*U(t+dt)(k-1) - + a_dt[2]*node[iPoint]->GetSolution_Vel_time_n(iVar) //a2*U'(t) - + a_dt[3]*node[iPoint]->GetSolution_Accel_time_n(iVar); //a3*U''(t) + Residual[iVar] = a_dt[0]*nodes->GetSolution_time_n(iPoint,iVar) //a0*U(t) + - a_dt[0]*nodes->GetSolution(iPoint,iVar) //a0*U(t+dt)(k-1) + + a_dt[2]*nodes->GetSolution_Vel_time_n(iPoint,iVar) //a2*U'(t) + + a_dt[3]*nodes->GetSolution_Accel_time_n(iPoint,iVar); //a3*U''(t) } TimeRes_Aux.SetBlock(iPoint, Residual); } @@ -1926,7 +1908,7 @@ void CFEASolver::Compute_DeadLoad(CGeometry *geometry, CNumerics **numerics, CCo Dead_Load = element_container[FEA_TERM][EL_KIND]->Get_FDL_a(iNode); for (iVar = 0; iVar < nVar; iVar++) Res_Dead_Load[iVar] = simp_penalty*Dead_Load[iVar]; - node[indexNode[iNode]]->Add_BodyForces_Res(Res_Dead_Load); + nodes->Add_BodyForces_Res(indexNode[iNode],Res_Dead_Load); } @@ -2007,18 +1989,18 @@ void CFEASolver::BC_Clamped(CGeometry *geometry, CNumerics *numerics, CConfig *c iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); /*--- Set and enforce solution at current and previous time-step ---*/ - node[iPoint]->SetSolution(Solution); + nodes->SetSolution(iPoint,Solution); if (dynamic) { - node[iPoint]->SetSolution_Vel(Solution); - node[iPoint]->SetSolution_Accel(Solution); - node[iPoint]->Set_Solution_time_n(Solution); - node[iPoint]->SetSolution_Vel_time_n(Solution); - node[iPoint]->SetSolution_Accel_time_n(Solution); + nodes->SetSolution_Vel(iPoint,Solution); + nodes->SetSolution_Accel(iPoint,Solution); + nodes->Set_Solution_time_n(iPoint,Solution); + nodes->SetSolution_Vel_time_n(iPoint,Solution); + nodes->SetSolution_Accel_time_n(iPoint,Solution); } /*--- Set and enforce 0 solution for mesh deformation ---*/ - node[iPoint]->SetBound_Disp(Solution); + nodes->SetBound_Disp(iPoint,Solution); LinSysSol.SetBlock(iPoint, Solution); LinSysReact.SetBlock(iPoint, Solution); @@ -2046,11 +2028,11 @@ void CFEASolver::BC_Clamped_Post(CGeometry *geometry, CNumerics *numerics, CConf Solution[0] = 0.0; Solution[1] = 0.0; Solution[2] = 0.0; } - node[iPoint]->SetSolution(Solution); + nodes->SetSolution(iPoint,Solution); if (dynamic) { - node[iPoint]->SetSolution_Vel(Solution); - node[iPoint]->SetSolution_Accel(Solution); + nodes->SetSolution_Vel(iPoint,Solution); + nodes->SetSolution_Accel(iPoint,Solution); } } @@ -2142,7 +2124,7 @@ void CFEASolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); // Nonlinear analysis. bool disc_adj_fem = (config->GetKind_Solver() == DISC_ADJ_FEM); - + if (disc_adj_fem) { if (nonlinear_analysis) { @@ -2211,7 +2193,6 @@ void CFEASolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, else { if (nonlinear_analysis){ - /*--- MPI solution ---*/ InitiateComms(geometry, config, SOLUTION_FEA); @@ -2331,7 +2312,7 @@ void CFEASolver::BC_Normal_Load(CGeometry *geometry, CNumerics *numerics, CConfi indexNode[iNode] = geometry->bound[val_marker][iElem]->GetNode(iNode); for (iDim = 0; iDim < nDim; iDim++) { val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); - val_Sol = node[indexNode[iNode]]->GetSolution(iDim) + val_Coord; + val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; /*--- Assign values to the container ---*/ nodeCoord_ref[iNode][iDim] = val_Coord; nodeCoord_curr[iNode][iDim] = val_Sol; @@ -2398,15 +2379,15 @@ void CFEASolver::BC_Normal_Load(CGeometry *geometry, CNumerics *numerics, CConfi Residual[0] = (1.0/2.0) * TotalLoad * Length_Elem_ref * normal_ref_unit[0]; Residual[1] = (1.0/2.0) * TotalLoad * Length_Elem_ref * normal_ref_unit[1]; - node[indexNode[0]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[1]]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(indexNode[0],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[1],Residual); } else if (nonlinear_analysis) { Residual[0] = (1.0/2.0) * TotalLoad * Length_Elem_curr * normal_curr_unit[0]; Residual[1] = (1.0/2.0) * TotalLoad * Length_Elem_curr * normal_curr_unit[1]; - node[indexNode[0]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[1]]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(indexNode[0],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[1],Residual); } } @@ -2468,18 +2449,18 @@ void CFEASolver::BC_Normal_Load(CGeometry *geometry, CNumerics *numerics, CConfi Residual[1] = (1.0/3.0) * TotalLoad * Area_Elem_ref * normal_ref_unit[1]; Residual[2] = (1.0/3.0) * TotalLoad * Area_Elem_ref * normal_ref_unit[2]; - node[indexNode[0]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[1]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[2]]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(indexNode[0],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[1],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[2],Residual); } else if (nonlinear_analysis) { Residual[0] = (1.0/3.0) * TotalLoad * Area_Elem_curr * normal_curr_unit[0]; Residual[1] = (1.0/3.0) * TotalLoad * Area_Elem_curr * normal_curr_unit[1]; Residual[2] = (1.0/3.0) * TotalLoad * Area_Elem_curr * normal_curr_unit[2]; - node[indexNode[0]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[1]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[2]]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(indexNode[0],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[1],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[2],Residual); } } @@ -2539,20 +2520,20 @@ void CFEASolver::BC_Normal_Load(CGeometry *geometry, CNumerics *numerics, CConfi Residual[1] = (1.0/4.0) * TotalLoad * Area_Elem_ref * normal_ref_unit[1]; Residual[2] = (1.0/4.0) * TotalLoad * Area_Elem_ref * normal_ref_unit[2]; - node[indexNode[0]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[1]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[2]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[3]]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(indexNode[0],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[1],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[2],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[3],Residual); } else if (nonlinear_analysis) { Residual[0] = (1.0/4.0) * TotalLoad * Area_Elem_curr * normal_curr_unit[0]; Residual[1] = (1.0/4.0) * TotalLoad * Area_Elem_curr * normal_curr_unit[1]; Residual[2] = (1.0/4.0) * TotalLoad * Area_Elem_curr * normal_curr_unit[2]; - node[indexNode[0]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[1]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[2]]->Add_SurfaceLoad_Res(Residual); - node[indexNode[3]]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(indexNode[0],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[1],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[2],Residual); + nodes->Add_SurfaceLoad_Res(indexNode[3],Residual); } } @@ -2659,8 +2640,8 @@ void CFEASolver::BC_Dir_Load(CGeometry *geometry, CNumerics *numerics, CConfig * Residual[0] = (1.0/2.0)*Length_Elem*TotalLoad*Load_Dir_Local[0]/Norm; Residual[1] = (1.0/2.0)*Length_Elem*TotalLoad*Load_Dir_Local[1]/Norm; - node[Point_0]->Add_SurfaceLoad_Res(Residual); - node[Point_1]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(Point_0,Residual); + nodes->Add_SurfaceLoad_Res(Point_1,Residual); } @@ -2671,9 +2652,9 @@ void CFEASolver::BC_Dir_Load(CGeometry *geometry, CNumerics *numerics, CConfig * Residual[1] = (1.0/3.0)*Area_Elem*TotalLoad*Load_Dir_Local[1]/Norm; Residual[2] = (1.0/3.0)*Area_Elem*TotalLoad*Load_Dir_Local[2]/Norm; - node[Point_0]->Add_SurfaceLoad_Res(Residual); - node[Point_1]->Add_SurfaceLoad_Res(Residual); - node[Point_2]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(Point_0,Residual); + nodes->Add_SurfaceLoad_Res(Point_1,Residual); + nodes->Add_SurfaceLoad_Res(Point_2,Residual); } else if (geometry->bound[val_marker][iElem]->GetVTK_Type() == QUADRILATERAL) { @@ -2682,10 +2663,10 @@ void CFEASolver::BC_Dir_Load(CGeometry *geometry, CNumerics *numerics, CConfig * Residual[1] = (1.0/4.0)*Area_Elem*TotalLoad*Load_Dir_Local[1]/Norm; Residual[2] = (1.0/4.0)*Area_Elem*TotalLoad*Load_Dir_Local[2]/Norm; - node[Point_0]->Add_SurfaceLoad_Res(Residual); - node[Point_1]->Add_SurfaceLoad_Res(Residual); - node[Point_2]->Add_SurfaceLoad_Res(Residual); - node[Point_3]->Add_SurfaceLoad_Res(Residual); + nodes->Add_SurfaceLoad_Res(Point_0,Residual); + nodes->Add_SurfaceLoad_Res(Point_1,Residual); + nodes->Add_SurfaceLoad_Res(Point_2,Residual); + nodes->Add_SurfaceLoad_Res(Point_3,Residual); } @@ -2717,11 +2698,11 @@ void CFEASolver::BC_Damper(CGeometry *geometry, CNumerics *numerics, CConfig *co for (iVar = 0; iVar < nVar; iVar++){ - dampValue = - 1.0 * dampC * node[Point_0]->GetSolution_Vel(iVar); - node[Point_0]->Set_SurfaceLoad_Res(iVar, dampValue); + dampValue = - 1.0 * dampC * nodes->GetSolution_Vel(Point_0,iVar); + nodes->Set_SurfaceLoad_Res(Point_0,iVar, dampValue); - dampValue = - 1.0 * dampC * node[Point_1]->GetSolution_Vel(iVar); - node[Point_1]->Set_SurfaceLoad_Res(iVar, dampValue); + dampValue = - 1.0 * dampC * nodes->GetSolution_Vel(Point_1,iVar); + nodes->Set_SurfaceLoad_Res(Point_1,iVar, dampValue); } if (nDim == 3) { @@ -2729,15 +2710,15 @@ void CFEASolver::BC_Damper(CGeometry *geometry, CNumerics *numerics, CConfig *co Point_2 = geometry->bound[val_marker][iElem]->GetNode(2); for (iVar = 0; iVar < nVar; iVar++){ - dampValue = - 1.0 * dampC * node[Point_2]->GetSolution_Vel(iVar); - node[Point_2]->Set_SurfaceLoad_Res(iVar, dampValue); + dampValue = - 1.0 * dampC * nodes->GetSolution_Vel(Point_2,iVar); + nodes->Set_SurfaceLoad_Res(Point_2,iVar, dampValue); } if (geometry->bound[val_marker][iElem]->GetVTK_Type() == QUADRILATERAL) { Point_3 = geometry->bound[val_marker][iElem]->GetNode(3); for (iVar = 0; iVar < nVar; iVar++){ - dampValue = - 1.0 * dampC * node[Point_3]->GetSolution_Vel(iVar); - node[Point_3]->Set_SurfaceLoad_Res(iVar, dampValue); + dampValue = - 1.0 * dampC * nodes->GetSolution_Vel(Point_3,iVar); + nodes->Set_SurfaceLoad_Res(Point_3,iVar, dampValue); } } @@ -2759,7 +2740,7 @@ void CFEASolver::BC_Deforming(CGeometry *geometry, CNumerics *numerics, CConfig iNode = geometry->vertex[val_marker][iVertex]->GetNode(); /*--- Retrieve the boundary displacement ---*/ - for (iDim = 0; iDim < nDim; iDim++) Solution[iDim] = node[iNode]->GetBound_Disp(iDim); + for (iDim = 0; iDim < nDim; iDim++) Solution[iDim] = nodes->GetBound_Disp(iNode,iDim); /*--- Set and enforce solution ---*/ LinSysSol.SetBlock(iNode, Solution); @@ -2794,16 +2775,16 @@ void CFEASolver::Integrate_FSI_Loads(CGeometry *geometry, CConfig *config) { for (iElem = 0; iElem < nElem; ++iElem) { /*--- Define the boundary element ---*/ - unsigned long nodes[4]; + unsigned long nodeList[4]; su2double coords[4][3]; bool quad = geometry->bound[iMarker][iElem]->GetVTK_Type() == QUADRILATERAL; nNode = quad? 4 : nDim; for (iNode = 0; iNode < nNode; ++iNode) { - nodes[iNode] = geometry->bound[iMarker][iElem]->GetNode(iNode); + nodeList[iNode] = geometry->bound[iMarker][iElem]->GetNode(iNode); for (iDim = 0; iDim < nDim; ++iDim) - coords[iNode][iDim] = geometry->node[nodes[iNode]]->GetCoord(iDim)+ - node[nodes[iNode]]->GetSolution(iDim); + coords[iNode][iDim] = geometry->node[nodeList[iNode]]->GetCoord(iDim)+ + nodes->GetSolution(nodeList[iNode],iDim); } /*--- Compute the area ---*/ @@ -2843,7 +2824,7 @@ void CFEASolver::Integrate_FSI_Loads(CGeometry *geometry, CConfig *config) { for (iNode = 0; iNode < nNode; ++iNode) for (iDim = 0; iDim < nDim; ++iDim) - force[iDim] += weight*area*node[nodes[iNode]]->Get_FlowTraction(iDim); + force[iDim] += weight*area*nodes->Get_FlowTraction(nodeList[iNode],iDim); for (iDim = 0; iDim < nDim; ++iDim) forces.push_back(force[iDim]); } @@ -2851,8 +2832,7 @@ void CFEASolver::Integrate_FSI_Loads(CGeometry *geometry, CConfig *config) { /*--- 2nd pass to set values. This is to account for overlap in the markers. ---*/ /*--- By putting the integrated values back into the nodes no changes have to be made elsewhere. ---*/ - for (iPoint = 0; iPoint < geometry->GetnPoint(); ++iPoint) - node[iPoint]->Clear_FlowTraction(); + nodes->Clear_FlowTraction(); vector::iterator force_it = forces.begin(); @@ -2876,7 +2856,7 @@ void CFEASolver::Integrate_FSI_Loads(CGeometry *geometry, CConfig *config) { for (iNode = 0; iNode < nNode; ++iNode) { iPoint = geometry->bound[iMarker][iElem]->GetNode(iNode); - node[iPoint]->Add_FlowTraction(force); + nodes->Add_FlowTraction(iPoint,force); } } } @@ -2913,7 +2893,7 @@ void CFEASolver::Integrate_FSI_Loads(CGeometry *geometry, CConfig *config) { halo_point_loc.push_back(iPoint); halo_point_glb.push_back(geometry->node[iPoint]->GetGlobalIndex()); for (iDim = 0; iDim < nDim; ++iDim) - halo_force.push_back(node[iPoint]->Get_FlowTraction(iDim)); + halo_force.push_back(nodes->Get_FlowTraction(iPoint,iDim)); } } } @@ -2946,7 +2926,7 @@ void CFEASolver::Integrate_FSI_Loads(CGeometry *geometry, CConfig *config) { ptrdiff_t pos = find(halo_point_glb.begin(),halo_point_glb.end(),iPoint_glb)-halo_point_glb.begin(); if (pos < long(halo_point_glb.size())) { unsigned long iPoint_loc = halo_point_loc[pos]; - node[iPoint_loc]->Add_FlowTraction(&halo_force_all[(offset+iPoint)*nDim]); + nodes->Add_FlowTraction(iPoint_loc,&halo_force_all[(offset+iPoint)*nDim]); } } } @@ -2970,7 +2950,7 @@ su2double CFEASolver::Compute_LoadCoefficient(su2double CurrentTime, su2double R su2double TransferTime = 1.0; bool restart = config->GetRestart(); // Restart analysis - bool fsi = (config->GetnMarker_Fluid_Load() > 0); // FSI simulation. + bool fsi = config->GetFSI_Simulation(); bool stat_fsi = !config->GetTime_Domain(); /*--- This offset introduces the ramp load in dynamic cases starting from the restart point. ---*/ @@ -3050,9 +3030,8 @@ void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CSolver **solver bool linear_analysis = (config->GetGeometricConditions() == SMALL_DEFORMATIONS); // Linear analysis. bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); // Nonlinear analysis. bool newton_raphson = (config->GetKind_SpaceIteScheme_FEA() == NEWTON_RAPHSON); // Newton-Raphson method - bool body_forces = config->GetDeadLoad(); // Body forces (dead loads). - + bool incremental_load = config->GetIncrementalLoad(); if (!dynamic) { @@ -3062,16 +3041,14 @@ void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CSolver **solver /*--- (the terms that are constant over the time step) ---*/ if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = loadIncrement * node[iPoint]->Get_SurfaceLoad_Res(iVar); + Res_Ext_Surf[iVar] = loadIncrement * nodes->Get_SurfaceLoad_Res(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = node[iPoint]->Get_SurfaceLoad_Res(iVar); + Res_Ext_Surf[iVar] = nodes->Get_SurfaceLoad_Res(iPoint,iVar); } - //Res_Ext_Surf = node[iPoint]->Get_SurfaceLoad_Res(); } - LinSysRes.AddBlock(iPoint, Res_Ext_Surf); /*--- Add the contribution to the residual due to body forces ---*/ @@ -3079,32 +3056,31 @@ void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CSolver **solver if (body_forces) { if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = loadIncrement * node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = loadIncrement * nodes->Get_BodyForces_Res(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = nodes->Get_BodyForces_Res(iPoint,iVar); } } - LinSysRes.AddBlock(iPoint, Res_Dead_Load); } /*--- Add the contribution to the residual due to flow loads (FSI contribution) ---*/ - if (incremental_load){ - for (iVar = 0; iVar < nVar; iVar++){ - Res_FSI_Cont[iVar] = loadIncrement * node[iPoint]->Get_FlowTraction(iVar); - } + + if (incremental_load) { + for (iVar = 0; iVar < nVar; iVar++) + Res_FSI_Cont[iVar] = loadIncrement * nodes->Get_FlowTraction(iPoint,iVar); } else { - for (iVar = 0; iVar < nVar; iVar++){ - Res_FSI_Cont[iVar] = node[iPoint]->Get_FlowTraction(iVar); - } + for (iVar = 0; iVar < nVar; iVar++) + Res_FSI_Cont[iVar] = nodes->Get_FlowTraction(iPoint,iVar); } LinSysRes.AddBlock(iPoint, Res_FSI_Cont); + } - + } if (dynamic) { @@ -3138,10 +3114,10 @@ void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CSolver **solver for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - Residual[iVar] = a_dt[0]*node[iPoint]->GetSolution_time_n(iVar) //a0*U(t) - - a_dt[0]*node[iPoint]->GetSolution(iVar) //a0*U(t+dt)(k-1) - + a_dt[2]*node[iPoint]->GetSolution_Vel_time_n(iVar) //a2*U'(t) - + a_dt[3]*node[iPoint]->GetSolution_Accel_time_n(iVar); //a3*U''(t) + Residual[iVar] = a_dt[0]*nodes->GetSolution_time_n(iPoint,iVar) //a0*U(t) + - a_dt[0]*nodes->GetSolution(iPoint,iVar) //a0*U(t+dt)(k-1) + + a_dt[2]*nodes->GetSolution_Vel_time_n(iPoint,iVar) //a2*U'(t) + + a_dt[3]*nodes->GetSolution_Accel_time_n(iPoint,iVar); //a3*U''(t) } TimeRes_Aux.SetBlock(iPoint, Residual); } @@ -3161,14 +3137,14 @@ void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CSolver **solver /*--- External surface load contribution ---*/ if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = loadIncrement * node[iPoint]->Get_SurfaceLoad_Res(iVar); + Res_Ext_Surf[iVar] = loadIncrement * nodes->Get_SurfaceLoad_Res(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = node[iPoint]->Get_SurfaceLoad_Res(iVar); + Res_Ext_Surf[iVar] = nodes->Get_SurfaceLoad_Res(iPoint,iVar); } - //Res_Ext_Surf = node[iPoint]->Get_SurfaceLoad_Res(); + //Res_Ext_Surf = nodes->Get_SurfaceLoad_Res(iPoint); } LinSysRes.AddBlock(iPoint, Res_Ext_Surf); @@ -3178,34 +3154,36 @@ void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CSolver **solver if (body_forces) { if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = loadIncrement * node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = loadIncrement * nodes->Get_BodyForces_Res(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = nodes->Get_BodyForces_Res(iPoint,iVar); } } - LinSysRes.AddBlock(iPoint, Res_Dead_Load); } - + + /*--- FSI contribution (flow loads) ---*/ + if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_FSI_Cont[iVar] = loadIncrement * node[iPoint]->Get_FlowTraction(iVar); + Res_FSI_Cont[iVar] = loadIncrement * nodes->Get_FlowTraction(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_FSI_Cont[iVar] = node[iPoint]->Get_FlowTraction(iVar); + Res_FSI_Cont[iVar] = nodes->Get_FlowTraction(iPoint,iVar); } } LinSysRes.AddBlock(iPoint, Res_FSI_Cont); + } + } - - + } void CFEASolver::ImplicitNewmark_Update(CGeometry *geometry, CSolver **solver_container, CConfig *config) { @@ -3223,7 +3201,7 @@ void CFEASolver::ImplicitNewmark_Update(CGeometry *geometry, CSolver **solver_co /*--- Displacements component of the solution ---*/ - node[iPoint]->Add_DeltaSolution(iVar, LinSysSol[iPoint*nVar+iVar]); + nodes->Add_DeltaSolution(iPoint,iVar, LinSysSol[iPoint*nVar+iVar]); } @@ -3238,30 +3216,30 @@ void CFEASolver::ImplicitNewmark_Update(CGeometry *geometry, CSolver **solver_co /*--- Acceleration component of the solution ---*/ /*--- U''(t+dt) = a0*(U(t+dt)-U(t))+a2*(U'(t))+a3*(U''(t)) ---*/ - Solution[iVar]=a_dt[0]*(node[iPoint]->GetSolution(iVar) - - node[iPoint]->GetSolution_time_n(iVar)) - - a_dt[2]* node[iPoint]->GetSolution_Vel_time_n(iVar) - - a_dt[3]* node[iPoint]->GetSolution_Accel_time_n(iVar); + Solution[iVar]=a_dt[0]*(nodes->GetSolution(iPoint,iVar) - + nodes->GetSolution_time_n(iPoint,iVar)) - + a_dt[2]* nodes->GetSolution_Vel_time_n(iPoint,iVar) - + a_dt[3]* nodes->GetSolution_Accel_time_n(iPoint,iVar); } /*--- Set the acceleration in the node structure ---*/ - node[iPoint]->SetSolution_Accel(Solution); + nodes->SetSolution_Accel(iPoint,Solution); for (iVar = 0; iVar < nVar; iVar++) { /*--- Velocity component of the solution ---*/ /*--- U'(t+dt) = U'(t)+ a6*(U''(t)) + a7*(U''(t+dt)) ---*/ - Solution[iVar]=node[iPoint]->GetSolution_Vel_time_n(iVar)+ - a_dt[6]* node[iPoint]->GetSolution_Accel_time_n(iVar) + - a_dt[7]* node[iPoint]->GetSolution_Accel(iVar); + Solution[iVar]=nodes->GetSolution_Vel_time_n(iPoint,iVar)+ + a_dt[6]* nodes->GetSolution_Accel_time_n(iPoint,iVar) + + a_dt[7]* nodes->GetSolution_Accel(iPoint,iVar); } /*--- Set the velocity in the node structure ---*/ - node[iPoint]->SetSolution_Vel(Solution); + nodes->SetSolution_Vel(iPoint,Solution); } @@ -3285,9 +3263,9 @@ void CFEASolver::ImplicitNewmark_Relaxation(CGeometry *geometry, CSolver **solve for (iPoint=0; iPoint < nPointDomain; iPoint++) { - valSolutionPred = node[iPoint]->GetSolution_Pred(); + valSolutionPred = nodes->GetSolution_Pred(iPoint); - node[iPoint]->SetSolution(valSolutionPred); + nodes->SetSolution(iPoint,valSolutionPred); } if (dynamic){ @@ -3301,30 +3279,30 @@ void CFEASolver::ImplicitNewmark_Relaxation(CGeometry *geometry, CSolver **solve /*--- Acceleration component of the solution ---*/ /*--- U''(t+dt) = a0*(U(t+dt)-U(t))+a2*(U'(t))+a3*(U''(t)) ---*/ - Solution[iVar]=a_dt[0]*(node[iPoint]->GetSolution(iVar) - - node[iPoint]->GetSolution_time_n(iVar)) - - a_dt[2]* node[iPoint]->GetSolution_Vel_time_n(iVar) - - a_dt[3]* node[iPoint]->GetSolution_Accel_time_n(iVar); + Solution[iVar]=a_dt[0]*(nodes->GetSolution(iPoint,iVar) - + nodes->GetSolution_time_n(iPoint,iVar)) - + a_dt[2]* nodes->GetSolution_Vel_time_n(iPoint,iVar) - + a_dt[3]* nodes->GetSolution_Accel_time_n(iPoint,iVar); } /*--- Set the acceleration in the node structure ---*/ - node[iPoint]->SetSolution_Accel(Solution); + nodes->SetSolution_Accel(iPoint,Solution); for (iVar = 0; iVar < nVar; iVar++) { /*--- Velocity component of the solution ---*/ /*--- U'(t+dt) = U'(t)+ a6*(U''(t)) + a7*(U''(t+dt)) ---*/ - Solution[iVar]=node[iPoint]->GetSolution_Vel_time_n(iVar)+ - a_dt[6]* node[iPoint]->GetSolution_Accel_time_n(iVar) + - a_dt[7]* node[iPoint]->GetSolution_Accel(iVar); + Solution[iVar]=nodes->GetSolution_Vel_time_n(iPoint,iVar)+ + a_dt[6]* nodes->GetSolution_Accel_time_n(iPoint,iVar) + + a_dt[7]* nodes->GetSolution_Accel(iPoint,iVar); } /*--- Set the velocity in the node structure ---*/ - node[iPoint]->SetSolution_Vel(Solution); + nodes->SetSolution_Vel(iPoint,Solution); } @@ -3340,7 +3318,7 @@ void CFEASolver::ImplicitNewmark_Relaxation(CGeometry *geometry, CSolver **solve for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->SetSolution_Pred_Old(iVar,node[iPoint]->GetSolution(iVar)); + nodes->SetSolution_Pred_Old(iPoint,iVar,nodes->GetSolution(iPoint,iVar)); } } @@ -3358,7 +3336,6 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CSolver **solve bool linear_analysis = (config->GetGeometricConditions() == SMALL_DEFORMATIONS); // Linear analysis. bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); // Nonlinear analysis. bool newton_raphson = (config->GetKind_SpaceIteScheme_FEA() == NEWTON_RAPHSON); // Newton-Raphson method - bool body_forces = config->GetDeadLoad(); // Body forces (dead loads). su2double alpha_f = config->Get_Int_Coeffs(2); @@ -3372,14 +3349,14 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CSolver **solve /*--- (the terms that are constant over the time step) ---*/ if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = loadIncrement * node[iPoint]->Get_SurfaceLoad_Res(iVar); + Res_Ext_Surf[iVar] = loadIncrement * nodes->Get_SurfaceLoad_Res(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = node[iPoint]->Get_SurfaceLoad_Res(iVar); + Res_Ext_Surf[iVar] = nodes->Get_SurfaceLoad_Res(iPoint,iVar); } - //Res_Ext_Surf = node[iPoint]->Get_SurfaceLoad_Res(); + //Res_Ext_Surf = nodes->Get_SurfaceLoad_Res(iPoint); } LinSysRes.AddBlock(iPoint, Res_Ext_Surf); @@ -3389,12 +3366,12 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CSolver **solve if (body_forces) { if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = loadIncrement * node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = loadIncrement * nodes->Get_BodyForces_Res(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = nodes->Get_BodyForces_Res(iPoint,iVar); } } @@ -3436,10 +3413,10 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CSolver **solve for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - Residual[iVar] = a_dt[0]*node[iPoint]->GetSolution_time_n(iVar) //a0*U(t) - - a_dt[0]*node[iPoint]->GetSolution(iVar) //a0*U(t+dt)(k-1) - + a_dt[2]*node[iPoint]->GetSolution_Vel_time_n(iVar) //a2*U'(t) - + a_dt[3]*node[iPoint]->GetSolution_Accel_time_n(iVar); //a3*U''(t) + Residual[iVar] = a_dt[0]*nodes->GetSolution_time_n(iPoint,iVar) //a0*U(t) + - a_dt[0]*nodes->GetSolution(iPoint,iVar) //a0*U(t+dt)(k-1) + + a_dt[2]*nodes->GetSolution_Vel_time_n(iPoint,iVar) //a2*U'(t) + + a_dt[3]*nodes->GetSolution_Accel_time_n(iPoint,iVar); //a3*U''(t) } TimeRes_Aux.SetBlock(iPoint, Residual); } @@ -3457,14 +3434,14 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CSolver **solve /*--- External surface load contribution ---*/ if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = loadIncrement * ( (1 - alpha_f) * node[iPoint]->Get_SurfaceLoad_Res(iVar) + - alpha_f * node[iPoint]->Get_SurfaceLoad_Res_n(iVar) ); + Res_Ext_Surf[iVar] = loadIncrement * ( (1 - alpha_f) * nodes->Get_SurfaceLoad_Res(iPoint,iVar) + + alpha_f * nodes->Get_SurfaceLoad_Res_n(iPoint,iVar) ); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Ext_Surf[iVar] = (1 - alpha_f) * node[iPoint]->Get_SurfaceLoad_Res(iVar) + - alpha_f * node[iPoint]->Get_SurfaceLoad_Res_n(iVar); + Res_Ext_Surf[iVar] = (1 - alpha_f) * nodes->Get_SurfaceLoad_Res(iPoint,iVar) + + alpha_f * nodes->Get_SurfaceLoad_Res_n(iPoint,iVar); } } LinSysRes.AddBlock(iPoint, Res_Ext_Surf); @@ -3475,12 +3452,12 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CSolver **solve if (body_forces) { if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = loadIncrement * node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = loadIncrement * nodes->Get_BodyForces_Res(iPoint,iVar); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_Dead_Load[iVar] = node[iPoint]->Get_BodyForces_Res(iVar); + Res_Dead_Load[iVar] = nodes->Get_BodyForces_Res(iPoint,iVar); } } @@ -3488,22 +3465,25 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CSolver **solve } /*--- Add FSI contribution ---*/ + if (incremental_load) { for (iVar = 0; iVar < nVar; iVar++) { - Res_FSI_Cont[iVar] = loadIncrement * ( (1 - alpha_f) * node[iPoint]->Get_FlowTraction(iVar) + - alpha_f * node[iPoint]->Get_FlowTraction_n(iVar) ); + Res_FSI_Cont[iVar] = loadIncrement * ( (1 - alpha_f) * nodes->Get_FlowTraction(iPoint,iVar) + + alpha_f * nodes->Get_FlowTraction_n(iPoint,iVar) ); } } else { for (iVar = 0; iVar < nVar; iVar++) { - Res_FSI_Cont[iVar] = (1 - alpha_f) * node[iPoint]->Get_FlowTraction(iVar) + - alpha_f * node[iPoint]->Get_FlowTraction_n(iVar); + Res_FSI_Cont[iVar] = (1 - alpha_f) * nodes->Get_FlowTraction(iPoint,iVar) + + alpha_f * nodes->Get_FlowTraction_n(iPoint,iVar); } } LinSysRes.AddBlock(iPoint, Res_FSI_Cont); + } + } - + } void CFEASolver::GeneralizedAlpha_UpdateDisp(CGeometry *geometry, CSolver **solver_container, CConfig *config) { @@ -3519,7 +3499,7 @@ void CFEASolver::GeneralizedAlpha_UpdateDisp(CGeometry *geometry, CSolver **solv /*--- Displacements component of the solution ---*/ - node[iPoint]->Add_DeltaSolution(iVar, LinSysSol[iPoint*nVar+iVar]); + nodes->Add_DeltaSolution(iPoint,iVar, LinSysSol[iPoint*nVar+iVar]); } @@ -3548,50 +3528,50 @@ void CFEASolver::GeneralizedAlpha_UpdateSolution(CGeometry *geometry, CSolver ** /*--- Compute the solution from the previous time step and the solution computed at t+1-alpha_f ---*/ /*--- U(t+dt) = 1/alpha_f*(U(t+1-alpha_f)-alpha_f*U(t)) ---*/ - Solution[iVar]=(1 / (1 - alpha_f))*(node[iPoint]->GetSolution(iVar) - - alpha_f * node[iPoint]->GetSolution_time_n(iVar)); + Solution[iVar]=(1 / (1 - alpha_f))*(nodes->GetSolution(iPoint,iVar) - + alpha_f * nodes->GetSolution_time_n(iPoint,iVar)); } /*--- Set the solution in the node structure ---*/ - node[iPoint]->SetSolution(Solution); + nodes->SetSolution(iPoint,Solution); for (iVar = 0; iVar < nVar; iVar++) { /*--- Acceleration component of the solution ---*/ /*--- U''(t+dt-alpha_m) = a8*(U(t+dt)-U(t))+a2*(U'(t))+a3*(U''(t)) ---*/ - Solution_Interm[iVar]=a_dt[8]*( node[iPoint]->GetSolution(iVar) - - node[iPoint]->GetSolution_time_n(iVar)) - - a_dt[2]* node[iPoint]->GetSolution_Vel_time_n(iVar) - - a_dt[3]* node[iPoint]->GetSolution_Accel_time_n(iVar); + Solution_Interm[iVar]=a_dt[8]*( nodes->GetSolution(iPoint,iVar) - + nodes->GetSolution_time_n(iPoint,iVar)) - + a_dt[2]* nodes->GetSolution_Vel_time_n(iPoint,iVar) - + a_dt[3]* nodes->GetSolution_Accel_time_n(iPoint,iVar); /*--- Compute the solution from the previous time step and the solution computed at t+1-alpha_f ---*/ /*--- U''(t+dt) = 1/alpha_m*(U''(t+1-alpha_m)-alpha_m*U''(t)) ---*/ - Solution[iVar]=(1 / (1 - alpha_m))*(Solution_Interm[iVar] - alpha_m * node[iPoint]->GetSolution_Accel_time_n(iVar)); + Solution[iVar]=(1 / (1 - alpha_m))*(Solution_Interm[iVar] - alpha_m * nodes->GetSolution_Accel_time_n(iPoint,iVar)); } /*--- Set the acceleration in the node structure ---*/ - node[iPoint]->SetSolution_Accel(Solution); + nodes->SetSolution_Accel(iPoint,Solution); for (iVar = 0; iVar < nVar; iVar++) { /*--- Velocity component of the solution ---*/ /*--- U'(t+dt) = U'(t)+ a6*(U''(t)) + a7*(U''(t+dt)) ---*/ - Solution[iVar]=node[iPoint]->GetSolution_Vel_time_n(iVar)+ - a_dt[6]* node[iPoint]->GetSolution_Accel_time_n(iVar) + - a_dt[7]* node[iPoint]->GetSolution_Accel(iVar); + Solution[iVar]=nodes->GetSolution_Vel_time_n(iPoint,iVar)+ + a_dt[6]* nodes->GetSolution_Accel_time_n(iPoint,iVar) + + a_dt[7]* nodes->GetSolution_Accel(iPoint,iVar); } /*--- Set the velocity in the node structure ---*/ - node[iPoint]->SetSolution_Vel(Solution); + nodes->SetSolution_Vel(iPoint,Solution); } @@ -3603,15 +3583,11 @@ void CFEASolver::GeneralizedAlpha_UpdateSolution(CGeometry *geometry, CSolver ** } void CFEASolver::GeneralizedAlpha_UpdateLoads(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - - unsigned long iPoint; - + /*--- Set the load conditions of the time step n+1 as the load conditions for time step n ---*/ - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->Set_SurfaceLoad_Res_n(); - node[iPoint]->Set_FlowTraction_n(); - } - + nodes->Set_SurfaceLoad_Res_n(); + nodes->Set_FlowTraction_n(); + } void CFEASolver::Solve_System(CGeometry *geometry, CConfig *config) { @@ -3654,12 +3630,12 @@ void CFEASolver::PredictStruct_Displacement(CGeometry **fea_geometry, //To nPointDomain: we need to communicate the predicted solution after setting it for (iPoint=0; iPoint < nPointDomain; iPoint++) { - if (predOrder==0) fea_solution[MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Pred(); + if (predOrder==0) fea_solution[MESH_0][FEA_SOL]->GetNodes()->SetSolution_Pred(iPoint); else if (predOrder==1) { - solDisp = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution(); - solVel = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Vel(); - valPred = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Pred(); + solDisp = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint); + solVel = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Vel(iPoint); + valPred = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Pred(iPoint); for (iDim=0; iDim < nDim; iDim++) { valPred[iDim] = solDisp[iDim] + Delta_t*solVel[iDim]; @@ -3668,10 +3644,10 @@ void CFEASolver::PredictStruct_Displacement(CGeometry **fea_geometry, } else if (predOrder==2) { - solDisp = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution(); - solVel = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Vel(); - solVel_tn = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Vel_time_n(); - valPred = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Pred(); + solDisp = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint); + solVel = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Vel(iPoint); + solVel_tn = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Vel_time_n(iPoint); + valPred = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Pred(iPoint); for (iDim=0; iDim < nDim; iDim++) { valPred[iDim] = solDisp[iDim] + 0.5*Delta_t*(3*solVel[iDim]-solVel_tn[iDim]); @@ -3680,7 +3656,7 @@ void CFEASolver::PredictStruct_Displacement(CGeometry **fea_geometry, } else { cout<< "Higher order predictor not implemented. Solving with order 0." << endl; - fea_solution[MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Pred(); + fea_solution[MESH_0][FEA_SOL]->GetNodes()->SetSolution_Pred(iPoint); } } @@ -3740,10 +3716,10 @@ void CFEASolver::ComputeAitken_Coefficient(CGeometry **fea_geometry, CConfig *fe // To nPointDomain; we need to communicate the values for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - dispPred = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Pred(); - dispPred_Old = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Pred_Old(); - dispCalc = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution(); - dispCalc_Old = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Old(); + dispPred = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Pred(iPoint); + dispPred_Old = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Pred_Old(iPoint); + dispCalc = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint); + dispCalc_Old = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Old(iPoint); for (iDim = 0; iDim < nDim; iDim++) { @@ -3819,14 +3795,14 @@ void CFEASolver::SetAitken_Relaxation(CGeometry **fea_geometry, for (iPoint=0; iPoint < nPointDomain; iPoint++) { /*--- Retrieve pointers to the predicted and calculated solutions ---*/ - dispPred = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Pred(); - dispCalc = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution(); + dispPred = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Pred(iPoint); + dispCalc = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint); /*--- Set predicted solution as the old predicted solution ---*/ - fea_solution[MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Pred_Old(); + fea_solution[MESH_0][FEA_SOL]->GetNodes()->SetSolution_Pred_Old(iPoint); /*--- Set calculated solution as the old solution (needed for dynamic Aitken relaxation) ---*/ - fea_solution[MESH_0][FEA_SOL]->node[iPoint]->SetSolution_Old(dispCalc); + fea_solution[MESH_0][FEA_SOL]->GetNodes()->SetSolution_Old(iPoint, dispCalc); /*--- Apply the Aitken relaxation ---*/ for (iDim=0; iDim < nDim; iDim++) { @@ -3846,9 +3822,9 @@ void CFEASolver::Update_StructSolution(CGeometry **fea_geometry, for (iPoint=0; iPoint < nPointDomain; iPoint++) { - valSolutionPred = fea_solution[MESH_0][FEA_SOL]->node[iPoint]->GetSolution_Pred(); + valSolutionPred = fea_solution[MESH_0][FEA_SOL]->GetNodes()->GetSolution_Pred(iPoint); - fea_solution[MESH_0][FEA_SOL]->node[iPoint]->SetSolution(valSolutionPred); + fea_solution[MESH_0][FEA_SOL]->GetNodes()->SetSolution(iPoint, valSolutionPred); } @@ -3872,7 +3848,7 @@ void CFEASolver::Compute_OFRefGeom(CGeometry *geometry, CSolver **solver_contain su2double reference_geometry = 0.0, current_solution = 0.0; - bool fsi = (config->GetnMarker_Fluid_Load() > 0); + bool fsi = config->GetFSI_Simulation(); su2double objective_function = 0.0, objective_function_reduce = 0.0; su2double weight_OF = 1.0; @@ -3892,10 +3868,10 @@ void CFEASolver::Compute_OFRefGeom(CGeometry *geometry, CSolver **solver_contain for (iVar = 0; iVar < nVar; iVar++){ /*--- Retrieve the value of the reference geometry ---*/ - reference_geometry = node[iPoint]->GetReference_Geometry(iVar); + reference_geometry = nodes->GetReference_Geometry(iPoint,iVar); /*--- Retrieve the value of the current solution ---*/ - current_solution = node[iPoint]->GetSolution(iVar); + current_solution = nodes->GetSolution(iPoint,iVar); /*--- The objective function is the sum of the difference between solution and difference, squared ---*/ objective_function += weight_OF * (current_solution - reference_geometry)*(current_solution - reference_geometry); @@ -4007,7 +3983,7 @@ void CFEASolver::Compute_OFRefNode(CGeometry *geometry, CSolver **solver_contain su2double reference_geometry = 0.0, current_solution = 0.0; - bool fsi = (config->GetnMarker_Fluid_Load() > 0); + bool fsi = config->GetFSI_Simulation(); su2double objective_function = 0.0, objective_function_reduce = 0.0; su2double distance_sq = 0.0 ; @@ -4031,7 +4007,7 @@ void CFEASolver::Compute_OFRefNode(CGeometry *geometry, CSolver **solver_contain reference_geometry = config->GetRefNode_Displacement(iVar); /*--- Retrieve the value of the current solution ---*/ - current_solution = node[iPoint]->GetSolution(iVar); + current_solution = nodes->GetSolution(iPoint,iVar); /*--- The objective function is the sum of the difference between solution and difference, squared ---*/ distance_sq += (current_solution - reference_geometry)*(current_solution - reference_geometry); @@ -4039,8 +4015,8 @@ void CFEASolver::Compute_OFRefNode(CGeometry *geometry, CSolver **solver_contain objective_function = weight_OF * sqrt(distance_sq); - difX = node[iPoint]->GetSolution(0) - config->GetRefNode_Displacement(0); - difY = node[iPoint]->GetSolution(1) - config->GetRefNode_Displacement(1); + difX = nodes->GetSolution(iPoint,0) - config->GetRefNode_Displacement(0); + difY = nodes->GetSolution(iPoint,1) - config->GetRefNode_Displacement(1); } @@ -4209,7 +4185,6 @@ void CFEASolver::Compute_OFCompliance(CGeometry *geometry, CSolver **solver_cont su2double nodalForce[3]; /*--- Types of loads to consider ---*/ - bool fsi = config->GetFSI_Simulation(); bool body_forces = config->GetDeadLoad(); /*--- If the loads are being applied incrementaly ---*/ @@ -4224,17 +4199,16 @@ void CFEASolver::Compute_OFCompliance(CGeometry *geometry, CSolver **solver_cont /*--- Initialize with loads speficied through config ---*/ for (iVar = 0; iVar < nVar; iVar++) - nodalForce[iVar] = node[iPoint]->Get_SurfaceLoad_Res(iVar); + nodalForce[iVar] = nodes->Get_SurfaceLoad_Res(iPoint,iVar); /*--- Add contributions due to body forces ---*/ if (body_forces) for (iVar = 0; iVar < nVar; iVar++) - nodalForce[iVar] += node[iPoint]->Get_BodyForces_Res(iVar); + nodalForce[iVar] += nodes->Get_BodyForces_Res(iPoint,iVar); /*--- Add contributions due to fluid loads---*/ - if (fsi) - for (iVar = 0; iVar < nVar; iVar++) - nodalForce[iVar] += node[iPoint]->Get_FlowTraction(iVar); + for (iVar = 0; iVar < nVar; iVar++) + nodalForce[iVar] += nodes->Get_FlowTraction(iPoint,iVar); /*--- Correct for incremental loading ---*/ if (incremental_load) @@ -4243,7 +4217,7 @@ void CFEASolver::Compute_OFCompliance(CGeometry *geometry, CSolver **solver_cont /*--- Add work contribution from this node ---*/ for (iVar = 0; iVar < nVar; iVar++) - Total_OFCompliance += nodalForce[iVar]*node[iPoint]->GetSolution(iVar); + Total_OFCompliance += nodalForce[iVar]*nodes->GetSolution(iPoint,iVar); } #ifdef HAVE_MPI @@ -4294,10 +4268,10 @@ void CFEASolver::Stiffness_Penalty(CGeometry *geometry, CSolver **solver, CNumer for (iNode = 0; iNode < nNodes; iNode++) { indexNode[iNode] = geometry->elem[iElem]->GetNode(iNode); for (iDim = 0; iDim < nDim; iDim++) { - val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); - val_Sol = node[indexNode[iNode]]->GetSolution(iDim) + val_Coord; - element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Coord, iNode, iDim); - element_container[FEA_TERM][EL_KIND]->SetCurr_Coord(val_Sol, iNode, iDim); + val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); + val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; + element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Coord, iNode, iDim); + element_container[FEA_TERM][EL_KIND]->SetCurr_Coord(val_Sol, iNode, iDim); } } @@ -4350,7 +4324,7 @@ void CFEASolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *c string filename; bool dynamic = (config->GetTime_Domain()); - bool fluid_structure = (config->GetnMarker_Fluid_Load() > 0); + bool fluid_structure = config->GetFSI_Simulation(); bool discrete_adjoint = config->GetDiscrete_Adjoint(); if (dynamic) nSolVar = 3 * nVar; @@ -4399,20 +4373,20 @@ void CFEASolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *c for (iVar = 0; iVar < nSolVar; iVar++) Sol[iVar] = Restart_Data[index+iVar]; for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint_Local]->SetSolution(iVar, Sol[iVar]); + nodes->SetSolution(iPoint_Local,iVar, Sol[iVar]); if (dynamic) { - node[iPoint_Local]->Set_Solution_time_n(iVar, Sol[iVar]); - node[iPoint_Local]->SetSolution_Vel(iVar, Sol[iVar+nVar]); - node[iPoint_Local]->SetSolution_Vel_time_n(iVar, Sol[iVar+nVar]); - node[iPoint_Local]->SetSolution_Accel(iVar, Sol[iVar+2*nVar]); - node[iPoint_Local]->SetSolution_Accel_time_n(iVar, Sol[iVar+2*nVar]); + nodes->Set_Solution_time_n(iPoint_Local,iVar, Sol[iVar]); + nodes->SetSolution_Vel(iPoint_Local,iVar, Sol[iVar+nVar]); + nodes->SetSolution_Vel_time_n(iPoint_Local,iVar, Sol[iVar+nVar]); + nodes->SetSolution_Accel(iPoint_Local,iVar, Sol[iVar+2*nVar]); + nodes->SetSolution_Accel_time_n(iPoint_Local,iVar, Sol[iVar+2*nVar]); } - if (fluid_structure) { - node[iPoint_Local]->SetSolution_Pred(iVar, Sol[iVar]); - node[iPoint_Local]->SetSolution_Pred_Old(iVar, Sol[iVar]); + if (fluid_structure && !dynamic) { + nodes->SetSolution_Pred(iPoint_Local,iVar, Sol[iVar]); + nodes->SetSolution_Pred_Old(iPoint_Local,iVar, Sol[iVar]); } if (fluid_structure && discrete_adjoint){ - node[iPoint_Local]->SetSolution_Old(iVar, Sol[iVar]); + nodes->SetSolution_Old(iPoint_Local,iVar, Sol[iVar]); } } iPoint_Global_Local++; diff --git a/SU2_CFD/src/solver_direct_heat.cpp b/SU2_CFD/src/solver_direct_heat.cpp index e86bed9204fc..386fef52a318 100644 --- a/SU2_CFD/src/solver_direct_heat.cpp +++ b/SU2_CFD/src/solver_direct_heat.cpp @@ -47,7 +47,7 @@ CHeatSolverFVM::CHeatSolverFVM(void) : CSolver() { CHeatSolverFVM::CHeatSolverFVM(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CSolver() { unsigned short iVar, iDim, nLineLets, iMarker; - unsigned long iPoint, iVertex; + unsigned long iVertex; bool multizone = config->GetMultizone_Problem(); @@ -81,7 +81,6 @@ CHeatSolverFVM::CHeatSolverFVM(CGeometry *geometry, CConfig *config, unsigned sh /*--- Define geometry constants in the solver structure ---*/ nDim = geometry->GetnDim(); - node = new CVariable*[nPoint]; nMarker = config->GetnMarker_All(); CurrentMesh = iMesh; @@ -250,18 +249,14 @@ CHeatSolverFVM::CHeatSolverFVM(CGeometry *geometry, CConfig *config, unsigned sh } } - /*--- Initialize solution array ---*/ - - for (iPoint = 0; iPoint < nPoint; iPoint++) { - - if (flow) { - node[iPoint] = new CHeatFVMVariable(config->GetTemperature_FreeStreamND(), nDim, nVar, config); - } - else { - su2double Temperature_Solid_Freestream_ND = config->GetTemperature_Freestream_Solid()/config->GetTemperature_Ref(); - node[iPoint] = new CHeatFVMVariable(Temperature_Solid_Freestream_ND, nDim, nVar, config); - } + if (flow) { + nodes = new CHeatFVMVariable(config->GetTemperature_FreeStreamND(), nPoint, nDim, nVar, config); } + else { + su2double Temperature_Solid_Freestream_ND = config->GetTemperature_Freestream_Solid()/config->GetTemperature_Ref(); + nodes = new CHeatFVMVariable(Temperature_Solid_Freestream_ND, nPoint, nDim, nVar, config); + } + SetBaseClassPointerToNodes(); /*--- MPI solution ---*/ @@ -284,9 +279,9 @@ CHeatSolverFVM::~CHeatSolverFVM(void) { delete [] HeatFlux; } + if (nodes != nullptr) delete nodes; } - void CHeatSolverFVM::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { unsigned long iPoint; @@ -389,7 +384,7 @@ void CHeatSolverFVM::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfi index = counter*Restart_Vars[1] + skipVars; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); iPoint_Global_Local++; /*--- Increment the overall counter for how many points have been loaded. ---*/ @@ -440,12 +435,12 @@ void CHeatSolverFVM::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfi for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver[iMesh-1][HEAT_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver[iMesh-1][HEAT_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver[iMesh][HEAT_SOL]->node[iPoint]->SetSolution(Solution); + solver[iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver[iMesh][HEAT_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); solver[iMesh][HEAT_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); @@ -472,8 +467,7 @@ void CHeatSolverFVM::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config Diff = new su2double[nVar]; - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetUnd_LaplZero(); + nodes->SetUnd_LaplZero(); for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { @@ -483,7 +477,7 @@ void CHeatSolverFVM::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config /*--- Solution differences ---*/ for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = node[iPoint]->GetSolution(iVar) - node[jPoint]->GetSolution(iVar); + Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar); boundary_i = geometry->node[iPoint]->GetPhysicalBoundary(); boundary_j = geometry->node[jPoint]->GetPhysicalBoundary(); @@ -491,19 +485,19 @@ void CHeatSolverFVM::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config /*--- Both points inside the domain, or both in the boundary ---*/ if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff); } /*--- iPoint inside the domain, jPoint on the boundary ---*/ if (!boundary_i && boundary_j) - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff); /*--- jPoint inside the domain, iPoint on the boundary ---*/ if (boundary_i && !boundary_j) - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff); } @@ -538,13 +532,13 @@ void CHeatSolverFVM::Centered_Residual(CGeometry *geometry, CSolver **solver_con numerics->SetNormal(geometry->edge[iEdge]->GetNormal()); /*--- Primitive variables w/o reconstruction ---*/ - V_i = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); - V_j = solver_container[FLOW_SOL]->node[jPoint]->GetPrimitive(); + V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); + V_j = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(jPoint); - Temp_i = node[iPoint]->GetSolution(0); - Temp_j = node[jPoint]->GetSolution(0); + Temp_i = nodes->GetSolution(iPoint,0); + Temp_j = nodes->GetSolution(jPoint,0); - numerics->SetUndivided_Laplacian(node[iPoint]->GetUndivided_Laplacian(), node[jPoint]->GetUndivided_Laplacian()); + numerics->SetUndivided_Laplacian(nodes->GetUndivided_Laplacian(iPoint), nodes->GetUndivided_Laplacian(jPoint)); numerics->SetNeighbor(geometry->node[iPoint]->GetnNeighbor(), geometry->node[jPoint]->GetnNeighbor()); numerics->SetPrimitive(V_i, V_j); @@ -589,15 +583,15 @@ void CHeatSolverFVM::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta numerics->SetNormal(geometry->edge[iEdge]->GetNormal()); /*--- Primitive variables w/o reconstruction ---*/ - V_i = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); - V_j = solver_container[FLOW_SOL]->node[jPoint]->GetPrimitive(); + V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); + V_j = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(jPoint); - Temp_i_Grad = node[iPoint]->GetGradient(); - Temp_j_Grad = node[jPoint]->GetGradient(); + Temp_i_Grad = nodes->GetGradient(iPoint); + Temp_j_Grad = nodes->GetGradient(jPoint); numerics->SetConsVarGradient(Temp_i_Grad, Temp_j_Grad); - Temp_i = node[iPoint]->GetSolution(0); - Temp_j = node[jPoint]->GetSolution(0); + Temp_i = nodes->GetSolution(iPoint,0); + Temp_j = nodes->GetSolution(jPoint,0); /* Second order reconstruction */ if (muscl) { @@ -607,10 +601,10 @@ void CHeatSolverFVM::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim)); } - Gradient_i = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); - Gradient_j = solver_container[FLOW_SOL]->node[jPoint]->GetGradient_Primitive(); - Temp_i_Grad = node[iPoint]->GetGradient(); - Temp_j_Grad = node[jPoint]->GetGradient(); + Gradient_i = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); + Gradient_j = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(jPoint); + Temp_i_Grad = nodes->GetGradient(iPoint); + Temp_j_Grad = nodes->GetGradient(jPoint); /*Loop to correct the flow variables*/ for (iVar = 0; iVar < nVarFlow; iVar++) { @@ -692,20 +686,20 @@ void CHeatSolverFVM::Viscous_Residual(CGeometry *geometry, CSolver **solver_cont geometry->node[jPoint]->GetCoord()); numerics->SetNormal(geometry->edge[iEdge]->GetNormal()); - Temp_i_Grad = node[iPoint]->GetGradient(); - Temp_j_Grad = node[jPoint]->GetGradient(); + Temp_i_Grad = nodes->GetGradient(iPoint); + Temp_j_Grad = nodes->GetGradient(jPoint); numerics->SetConsVarGradient(Temp_i_Grad, Temp_j_Grad); /*--- Primitive variables w/o reconstruction ---*/ - Temp_i = node[iPoint]->GetSolution(0); - Temp_j = node[jPoint]->GetSolution(0); + Temp_i = nodes->GetSolution(iPoint,0); + Temp_j = nodes->GetSolution(jPoint,0); numerics->SetTemperature(Temp_i, Temp_j); /*--- Eddy viscosity to compute thermal conductivity ---*/ if (flow) { if (turb) { - eddy_viscosity_i = solver_container[TURB_SOL]->node[iPoint]->GetmuT(); - eddy_viscosity_j = solver_container[TURB_SOL]->node[jPoint]->GetmuT(); + eddy_viscosity_i = solver_container[TURB_SOL]->GetNodes()->GetmuT(iPoint); + eddy_viscosity_j = solver_container[TURB_SOL]->GetNodes()->GetmuT(jPoint); } thermal_diffusivity_i = (laminar_viscosity/Prandtl_Lam) + (eddy_viscosity_i/Prandtl_Turb); thermal_diffusivity_j = (laminar_viscosity/Prandtl_Lam) + (eddy_viscosity_j/Prandtl_Turb); @@ -845,7 +839,7 @@ void CHeatSolverFVM::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_co dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]); dist_ij = sqrt(dist_ij); - dTdn = -(node[Point_Normal]->GetSolution(0) - Twall)/dist_ij; + dTdn = -(nodes->GetSolution(Point_Normal,0) - Twall)/dist_ij; if(flow) { thermal_diffusivity = laminar_viscosity/Prandtl_Lam; @@ -975,7 +969,7 @@ void CHeatSolverFVM::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at this boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Retrieve the specified velocity for the inlet. ---*/ @@ -992,7 +986,7 @@ void CHeatSolverFVM::BC_Inlet(CGeometry *geometry, CSolver **solver_container, if (dynamic_grid) conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel()); - conv_numerics->SetTemperature(node[iPoint]->GetSolution(0), config->GetInlet_Ttotal(Marker_Tag)/config->GetTemperature_Ref()); + conv_numerics->SetTemperature(nodes->GetSolution(iPoint,0), config->GetInlet_Ttotal(Marker_Tag)/config->GetTemperature_Ref()); /*--- Compute the residual using an upwind scheme ---*/ @@ -1026,7 +1020,7 @@ void CHeatSolverFVM::BC_Inlet(CGeometry *geometry, CSolver **solver_container, dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]); dist_ij = sqrt(dist_ij); - dTdn = -(node[Point_Normal]->GetSolution(0) - Twall)/dist_ij; + dTdn = -(nodes->GetSolution(Point_Normal,0) - Twall)/dist_ij; thermal_diffusivity = laminar_viscosity/Prandtl_Lam; @@ -1082,20 +1076,20 @@ void CHeatSolverFVM::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at this boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Retrieve the specified velocity for the inlet. ---*/ V_outlet = solver_container[FLOW_SOL]->GetCharacPrimVar(val_marker, iVertex); for (iDim = 0; iDim < nDim; iDim++) - V_outlet[iDim+1] = solver_container[FLOW_SOL]->node[Point_Normal]->GetPrimitive(iDim+1); + V_outlet[iDim+1] = solver_container[FLOW_SOL]->GetNodes()->GetVelocity(Point_Normal, iDim); conv_numerics->SetPrimitive(V_domain, V_outlet); if (dynamic_grid) conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel()); - conv_numerics->SetTemperature(node[iPoint]->GetSolution(0), node[Point_Normal]->GetSolution(0)); + conv_numerics->SetTemperature(nodes->GetSolution(iPoint,0), nodes->GetSolution(Point_Normal,0)); /*--- Compute the residual using an upwind scheme ---*/ @@ -1155,9 +1149,9 @@ void CHeatSolverFVM::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **s T_Conjugate = GetConjugateHeatVariable(iMarker, iVertex, 0)/Temperature_Ref; - node[iPoint]->SetSolution_Old(&T_Conjugate); + nodes->SetSolution_Old(iPoint,&T_Conjugate); LinSysRes.SetBlock_Zero(iPoint, 0); - node[iPoint]->SetRes_TruncErrorZero(); + nodes->SetRes_TruncErrorZero(iPoint); if (implicit) { for (iVar = 0; iVar < nVar; iVar++) { @@ -1190,7 +1184,7 @@ void CHeatSolverFVM::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **s if (config->GetCHT_Robin()) { - Tinterface = node[iPoint]->GetSolution(0); + Tinterface = nodes->GetSolution(iPoint,0); Tnormal_Conjugate = GetConjugateHeatVariable(iMarker, iVertex, 3)/Temperature_Ref; HeatFluxDensity = thermal_diffusivity*(Tinterface - Tnormal_Conjugate); @@ -1269,7 +1263,7 @@ void CHeatSolverFVM::Heat_Fluxes(CGeometry *geometry, CSolver **solver_container for (iDim = 0; iDim < nDim; iDim++) dist += (Coord_Normal[iDim]-Coord[iDim])*(Coord_Normal[iDim]-Coord[iDim]); dist = sqrt(dist); - dTdn = (Twall - node[iPointNormal]->GetSolution(0))/dist; + dTdn = (Twall - nodes->GetSolution(iPointNormal,0))/dist; if(flow) { thermal_diffusivity = config->GetViscosity_FreeStreamND()/config->GetPrandtl_Lam(); @@ -1295,7 +1289,7 @@ void CHeatSolverFVM::Heat_Fluxes(CGeometry *geometry, CSolver **solver_container iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor(); - Twall = node[iPoint]->GetSolution(0); + Twall = nodes->GetSolution(iPoint,0); Coord = geometry->node[iPoint]->GetCoord(); Coord_Normal = geometry->node[iPointNormal]->GetCoord(); @@ -1309,7 +1303,7 @@ void CHeatSolverFVM::Heat_Fluxes(CGeometry *geometry, CSolver **solver_container for (iDim = 0; iDim < nDim; iDim++) dist += (Coord_Normal[iDim]-Coord[iDim])*(Coord_Normal[iDim]-Coord[iDim]); dist = sqrt(dist); - dTdn = (Twall - node[iPointNormal]->GetSolution(0))/dist; + dTdn = (Twall - nodes->GetSolution(iPointNormal,0))/dist; if(flow) { thermal_diffusivity = config->GetViscosity_FreeStreamND()/config->GetPrandtl_Lam(); @@ -1387,8 +1381,8 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe CFL_Reduction = config->GetCFLRedCoeff_Turb(); for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->SetMax_Lambda_Inv(0.0); - node[iPoint]->SetMax_Lambda_Visc(0.0); + nodes->SetMax_Lambda_Inv(iPoint,0.0); + nodes->SetMax_Lambda_Visc(iPoint,0.0); } /*--- Loop interior edges ---*/ @@ -1405,14 +1399,14 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe /*--- Inviscid contribution ---*/ if (flow) { - Mean_ProjVel = 0.5 * (solver_container[FLOW_SOL]->node[iPoint]->GetProjVel(Normal) + solver_container[FLOW_SOL]->node[jPoint]->GetProjVel(Normal)); - Mean_BetaInc2 = 0.5 * (solver_container[FLOW_SOL]->node[iPoint]->GetBetaInc2() + solver_container[FLOW_SOL]->node[jPoint]->GetBetaInc2()); - Mean_DensityInc = 0.5 * (solver_container[FLOW_SOL]->node[iPoint]->GetDensity() + solver_container[FLOW_SOL]->node[jPoint]->GetDensity()); + Mean_ProjVel = 0.5 * (solver_container[FLOW_SOL]->GetNodes()->GetProjVel(iPoint,Normal) + solver_container[FLOW_SOL]->GetNodes()->GetProjVel(jPoint,Normal)); + Mean_BetaInc2 = 0.5 * (solver_container[FLOW_SOL]->GetNodes()->GetBetaInc2(iPoint) + solver_container[FLOW_SOL]->GetNodes()->GetBetaInc2(jPoint)); + Mean_DensityInc = 0.5 * (solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint) + solver_container[FLOW_SOL]->GetNodes()->GetDensity(jPoint)); Mean_SoundSpeed = sqrt(Mean_ProjVel*Mean_ProjVel + (Mean_BetaInc2/Mean_DensityInc)*Area*Area); Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Inv(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint, Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint, Lambda); } /*--- Viscous contribution ---*/ @@ -1420,15 +1414,15 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe thermal_diffusivity = config->GetThermalDiffusivity_Solid(); if(flow) { if(turb) { - eddy_viscosity = solver_container[TURB_SOL]->node[iPoint]->GetmuT(); + eddy_viscosity = solver_container[TURB_SOL]->GetNodes()->GetmuT(iPoint); } thermal_diffusivity = laminar_viscosity/Prandtl_Lam + eddy_viscosity/Prandtl_Turb; } Lambda = thermal_diffusivity*Area*Area; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Visc(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(jPoint, Lambda); } @@ -1446,13 +1440,13 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe /*--- Inviscid contribution ---*/ if (flow) { - Mean_ProjVel = solver_container[FLOW_SOL]->node[iPoint]->GetProjVel(Normal); - Mean_BetaInc2 = solver_container[FLOW_SOL]->node[iPoint]->GetBetaInc2(); - Mean_DensityInc = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); + Mean_ProjVel = solver_container[FLOW_SOL]->GetNodes()->GetProjVel(iPoint, Normal); + Mean_BetaInc2 = solver_container[FLOW_SOL]->GetNodes()->GetBetaInc2(iPoint); + Mean_DensityInc = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); Mean_SoundSpeed = sqrt(Mean_ProjVel*Mean_ProjVel + (Mean_BetaInc2/Mean_DensityInc)*Area*Area); Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint, Lambda); } /*--- Viscous contribution ---*/ @@ -1460,14 +1454,14 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe thermal_diffusivity = config->GetThermalDiffusivity_Solid(); if(flow) { if(turb) { - eddy_viscosity = solver_container[TURB_SOL]->node[iPoint]->GetmuT(); + eddy_viscosity = solver_container[TURB_SOL]->GetNodes()->GetmuT(iPoint); } thermal_diffusivity = laminar_viscosity/Prandtl_Lam + eddy_viscosity/Prandtl_Turb; } Lambda = thermal_diffusivity*Area*Area; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda); } } @@ -1481,19 +1475,19 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe if (Vol != 0.0) { if(flow) { - Local_Delta_Time_Inv = config->GetCFL(iMesh)*Vol / node[iPoint]->GetMax_Lambda_Inv(); - Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ node[iPoint]->GetMax_Lambda_Visc(); + Local_Delta_Time_Inv = config->GetCFL(iMesh)*Vol / nodes->GetMax_Lambda_Inv(iPoint); + Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); } else { Local_Delta_Time_Inv = config->GetMax_DeltaTime(); - Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ node[iPoint]->GetMax_Lambda_Visc(); - //Local_Delta_Time_Visc = 100.0*K_v*Vol*Vol/ node[iPoint]->GetMax_Lambda_Visc(); + Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); + //Local_Delta_Time_Visc = 100.0*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); } /*--- Time step setting method ---*/ if (config->GetKind_TimeStep_Heat() == BYFLOW && flow) { - Local_Delta_Time = solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time(); + Local_Delta_Time = solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint); } else if (config->GetKind_TimeStep_Heat() == MINIMUM) { Local_Delta_Time = min(Local_Delta_Time_Inv, Local_Delta_Time_Visc); @@ -1513,10 +1507,10 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe if (Local_Delta_Time > config->GetMax_DeltaTime()) Local_Delta_Time = config->GetMax_DeltaTime(); - node[iPoint]->SetDelta_Time(CFL_Reduction*Local_Delta_Time); + nodes->SetDelta_Time(iPoint,CFL_Reduction*Local_Delta_Time); } else { - node[iPoint]->SetDelta_Time(0.0); + nodes->SetDelta_Time(iPoint,0.0); } } @@ -1546,7 +1540,7 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe Global_Delta_Time = rbuf_time; #endif for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetDelta_Time(Global_Delta_Time); + nodes->SetDelta_Time(iPoint,Global_Delta_Time); } /*--- Recompute the unsteady time step for the dual time strategy @@ -1569,8 +1563,8 @@ void CHeatSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_containe for (iPoint = 0; iPoint < nPointDomain; iPoint++) { if (!implicit) { cout << "Using unsteady time: " << config->GetDelta_UnstTimeND() << endl; - Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), node[iPoint]->GetDelta_Time()); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } } } @@ -1592,15 +1586,15 @@ void CHeatSolverFVM::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solv for (iPoint = 0; iPoint < nPointDomain; iPoint++) { Vol = geometry->node[iPoint]->GetVolume(); - Delta = node[iPoint]->GetDelta_Time() / Vol; + Delta = nodes->GetDelta_Time(iPoint) / Vol; - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); local_Residual = LinSysRes.GetBlock(iPoint); if (!adjoint) { for (iVar = 0; iVar < nVar; iVar++) { Res = local_Residual[iVar] + local_Res_TruncError[iVar]; - node[iPoint]->AddSolution(iVar, -Res*Delta); + nodes->AddSolution(iPoint,iVar, -Res*Delta); AddRes_RMS(iVar, Res*Res); AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord()); } @@ -1644,7 +1638,7 @@ void CHeatSolverFVM::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv /*--- Read the residual ---*/ - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); /*--- Read the volume ---*/ @@ -1652,14 +1646,14 @@ void CHeatSolverFVM::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv /*--- Modify matrix diagonal to assure diagonal dominance ---*/ - if (node[iPoint]->GetDelta_Time() != 0.0) { + if (nodes->GetDelta_Time(iPoint) != 0.0) { if(flow) { - Delta = Vol / node[iPoint]->GetDelta_Time(); + Delta = Vol / nodes->GetDelta_Time(iPoint); Jacobian.AddVal2Diag(iPoint, Delta); } else { - Delta = Vol / node[iPoint]->GetDelta_Time(); + Delta = Vol / nodes->GetDelta_Time(iPoint); Jacobian.AddVal2Diag(iPoint, Delta); } @@ -1699,7 +1693,7 @@ void CHeatSolverFVM::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv for (iPoint = 0; iPoint < nPointDomain; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->AddSolution(iVar, LinSysSol[iPoint*nVar+iVar]); + nodes->AddSolution(iPoint,iVar, LinSysSol[iPoint*nVar+iVar]); } } @@ -1737,12 +1731,12 @@ void CHeatSolverFVM::SetInitialCondition(CGeometry **geometry, CSolver ***solver for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver_container[iMesh-1][HEAT_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver_container[iMesh-1][HEAT_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver_container[iMesh][HEAT_SOL]->node[iPoint]->SetSolution(Solution); + solver_container[iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver_container[iMesh][HEAT_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); solver_container[iMesh][HEAT_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); @@ -1758,10 +1752,8 @@ void CHeatSolverFVM::SetInitialCondition(CGeometry **geometry, CSolver ***solver for a 1st-order restart or when simply intitializing to freestream. ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n1(); - } + solver_container[iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(); } if ((restart && (long)TimeIter == (long)config->GetRestart_Iter()) && @@ -1774,9 +1766,7 @@ void CHeatSolverFVM::SetInitialCondition(CGeometry **geometry, CSolver ***solver /*--- Push back this new solution to time level N. ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][HEAT_SOL]->node[iPoint]->Set_Solution_time_n(); - } + solver_container[iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); } } } @@ -1811,9 +1801,9 @@ void CHeatSolverFVM::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_ we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, previous solutions that are stored in memory. ---*/ - U_time_nM1 = node[iPoint]->GetSolution_time_n1(); - U_time_n = node[iPoint]->GetSolution_time_n(); - U_time_nP1 = node[iPoint]->GetSolution(); + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); /*--- CV volume at time n+1. As we are on a static mesh, the volume of the CV will remained fixed for all time steps. ---*/ @@ -1849,5 +1839,3 @@ void CHeatSolverFVM::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_ } } } - - diff --git a/SU2_CFD/src/solver_direct_mean.cpp b/SU2_CFD/src/solver_direct_mean.cpp index 1550fa70ef96..21d126923825 100644 --- a/SU2_CFD/src/solver_direct_mean.cpp +++ b/SU2_CFD/src/solver_direct_mean.cpp @@ -166,7 +166,8 @@ CEulerSolver::CEulerSolver(void) : CSolver() { CkInflow = NULL; CkOutflow1 = NULL; CkOutflow2 = NULL; - + + nodes = nullptr; } CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CSolver() { @@ -390,10 +391,6 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, unsigned short SetVerificationSolution(nDim, nVar, config); - /*--- Allocate the node variables ---*/ - - node = new CVariable*[nPoint]; - /*--- Define some auxiliary vectors related to the residual ---*/ Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; @@ -808,8 +805,8 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, unsigned short /*--- Initialize the solution to the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CEulerVariable(Density_Inf, Velocity_Inf, Energy_Inf, nDim, nVar, config); + nodes = new CEulerVariable(Density_Inf, Velocity_Inf, Energy_Inf, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); /*--- Check that the initial solution is physical, report any non-physical nodes ---*/ @@ -817,13 +814,13 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, unsigned short for (iPoint = 0; iPoint < nPoint; iPoint++) { - Density = node[iPoint]->GetSolution(0); + Density = nodes->GetDensity(iPoint); Velocity2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) - Velocity2 += (node[iPoint]->GetSolution(iDim+1)/Density)*(node[iPoint]->GetSolution(iDim+1)/Density); + Velocity2 += pow(nodes->GetSolution(iPoint,iDim+1)/Density,2); - StaticEnergy= node[iPoint]->GetSolution(nDim+1)/Density - 0.5*Velocity2; + StaticEnergy= nodes->GetEnergy(iPoint) - 0.5*Velocity2; FluidModel->SetTDState_rhoe(Density, StaticEnergy); Pressure= FluidModel->GetPressure(); @@ -836,8 +833,8 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, unsigned short for (iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = Velocity_Inf[iDim]*Density_Inf; Solution[nDim+1] = Energy_Inf*Density_Inf; - node[iPoint]->SetSolution(Solution); - node[iPoint]->SetSolution_Old(Solution); + nodes->SetSolution(iPoint,Solution); + nodes->SetSolution_Old(iPoint,Solution); counter_local++; } @@ -1367,6 +1364,7 @@ CEulerSolver::~CEulerSolver(void) { delete [] CkOutflow2; } + if (nodes != nullptr) delete nodes; } void CEulerSolver::InitTurboContainers(CGeometry *geometry, CConfig *config){ @@ -1717,10 +1715,10 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) { for (iVar = 0; iVar < nPrimVar; iVar++) { - Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+iVar] = node[iPoint]->GetPrimitive(iVar); + Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+iVar] = nodes->GetPrimitive(iPoint,iVar); } if (rans) { - Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+nPrimVar] = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0); + Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+nPrimVar] = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+(nPrimVar+1)] = 0.0; } @@ -2052,7 +2050,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex(); jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker(); for (iVar = 0; iVar < nPrimVar; iVar++) { - Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = node[iPoint]->GetPrimitive(iVar); + Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = nodes->GetPrimitive(iPoint,iVar); } Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+0)] = su2double(iGlobalIndex); Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+1)] = su2double(jVertex); @@ -2792,7 +2790,7 @@ void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_c /* Set the pointers to the coordinates and solution of this DOF. */ const su2double *coor = geometry[iMesh]->node[iPoint]->GetCoord(); - su2double *solDOF = solver_container[iMesh][FLOW_SOL]->node[iPoint]->GetSolution(); + su2double *solDOF = solver_container[iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint); /* Set the solution in this DOF to the initial condition provided by the verification solution class. This can be the exact solution, @@ -2903,15 +2901,15 @@ void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_c if (Distance < Radius) { - solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(0, Density_CylND); + solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, 0, Density_CylND); for (iDim = 0; iDim < nDim; iDim++) - solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(iDim+1, Density_CylND*Velocity_CylND[iDim]); - solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(nVar-1, Density_CylND*Energy_CylND); + solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, iDim+1, Density_CylND*Velocity_CylND[iDim]); + solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, nVar-1, Density_CylND*Energy_CylND); - solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution_Old(0, Density_CylND); + solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution_Old(iPoint, 0, Density_CylND); for (iDim = 0; iDim < nDim; iDim++) - solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution_Old(iDim+1, Density_CylND*Velocity_CylND[iDim]); - solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution_Old(nVar-1, Density_CylND*Energy_CylND); + solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution_Old(iPoint, iDim+1, Density_CylND*Velocity_CylND[iDim]); + solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution_Old(iPoint, nVar-1, Density_CylND*Energy_CylND); } @@ -2940,13 +2938,11 @@ void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_c for a 1st-order restart or when simply intitializing to freestream. ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1(); - if (rans) { - solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n1(); - } + solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(); + if (rans) { + solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(); } } @@ -2964,11 +2960,9 @@ void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_c /*--- Push back this new solution to time level N. ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - if (rans) { - solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - } + solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + if (rans) { + solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); } } } @@ -3092,14 +3086,14 @@ unsigned long CEulerSolver::SetPrimitive_Variables(CSolver **solver_container, C /*--- Initialize the non-physical points vector ---*/ - node[iPoint]->SetNon_Physical(false); + nodes->SetNon_Physical(iPoint,false); /*--- Compressible flow, primitive variables nDim+5, (T, vx, vy, vz, P, rho, h, c, lamMu, eddyMu, ThCond, Cp) ---*/ - RightSol = node[iPoint]->SetPrimVar(FluidModel); - node[iPoint]->SetSecondaryVar(FluidModel); + RightSol = nodes->SetPrimVar(iPoint,FluidModel); + nodes->SetSecondaryVar(iPoint,FluidModel); - if (!RightSol) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; } + if (!RightSol) { nodes->SetNon_Physical(iPoint,true); ErrorCounter++; } /*--- Initialize the convective, source and viscous residual vector ---*/ @@ -3127,7 +3121,7 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetMax_Lambda_Inv(0.0); + nodes->SetMax_Lambda_Inv(iPoint,0.0); /*--- Loop interior edges ---*/ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { @@ -3142,8 +3136,8 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Mean Values ---*/ - Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal)); - Mean_SoundSpeed = 0.5 * (node[iPoint]->GetSoundSpeed() + node[jPoint]->GetSoundSpeed()) * Area; + Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + Mean_SoundSpeed = 0.5 * (nodes->GetSoundSpeed(iPoint) + nodes->GetSoundSpeed(jPoint)) * Area; /*--- Adjustment for grid movement ---*/ @@ -3161,8 +3155,8 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Inviscid contribution ---*/ Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Inv(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint,Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint,Lambda); } @@ -3181,8 +3175,8 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Mean Values ---*/ - Mean_ProjVel = node[iPoint]->GetProjVel(Normal); - Mean_SoundSpeed = node[iPoint]->GetSoundSpeed() * Area; + Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); + Mean_SoundSpeed = nodes->GetSoundSpeed(iPoint) * Area; /*--- Adjustment for grid movement ---*/ @@ -3197,7 +3191,7 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Inviscid contribution ---*/ Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; if (geometry->node[iPoint]->GetDomain()) { - node[iPoint]->AddMax_Lambda_Inv(Lambda); + nodes->AddMax_Lambda_Inv(iPoint,Lambda); } } } @@ -3210,16 +3204,16 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, Vol = geometry->node[iPoint]->GetVolume(); if (Vol != 0.0) { - Local_Delta_Time = config->GetCFL(iMesh)*Vol / node[iPoint]->GetMax_Lambda_Inv(); + Local_Delta_Time = config->GetCFL(iMesh)*Vol / nodes->GetMax_Lambda_Inv(iPoint); Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time); Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time); Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time); if (Local_Delta_Time > config->GetMax_DeltaTime()) Local_Delta_Time = config->GetMax_DeltaTime(); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } else { - node[iPoint]->SetDelta_Time(0.0); + nodes->SetDelta_Time(iPoint,0.0); } } @@ -3259,9 +3253,9 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- If the unsteady CFL is set to zero, it uses the defined unsteady time step, otherwise it computes the time step based on the unsteady CFL ---*/ if (config->GetCFL(iMesh) == 0.0) { - node[iPoint]->SetDelta_Time(config->GetDelta_UnstTime()); + nodes->SetDelta_Time(iPoint,config->GetDelta_UnstTime()); } else { - node[iPoint]->SetDelta_Time(Global_Delta_Time); + nodes->SetDelta_Time(iPoint,Global_Delta_Time); } } } @@ -3287,8 +3281,8 @@ void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, if (dual_time) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { if (!implicit) { - Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), node[iPoint]->GetDelta_Time()); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } } @@ -3312,17 +3306,17 @@ void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Set primitive variables w/o reconstruction ---*/ - numerics->SetPrimitive(node[iPoint]->GetPrimitive(), node[jPoint]->GetPrimitive()); + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), nodes->GetPrimitive(jPoint)); /*--- Set the largest convective eigenvalue ---*/ - numerics->SetLambda(node[iPoint]->GetLambda(), node[jPoint]->GetLambda()); + numerics->SetLambda(nodes->GetLambda(iPoint), nodes->GetLambda(jPoint)); /*--- Set undivided laplacian an pressure based sensor ---*/ if (jst_scheme) { - numerics->SetUndivided_Laplacian(node[iPoint]->GetUndivided_Laplacian(), node[jPoint]->GetUndivided_Laplacian()); - numerics->SetSensor(node[iPoint]->GetSensor(), node[jPoint]->GetSensor()); + numerics->SetUndivided_Laplacian(nodes->GetUndivided_Laplacian(iPoint), nodes->GetUndivided_Laplacian(jPoint)); + numerics->SetSensor(nodes->GetSensor(iPoint), nodes->GetSensor(jPoint)); } /*--- Grid movement ---*/ @@ -3399,8 +3393,8 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Get primitive variables ---*/ - V_i = node[iPoint]->GetPrimitive(); V_j = node[jPoint]->GetPrimitive(); - S_i = node[iPoint]->GetSecondary(); S_j = node[jPoint]->GetSecondary(); + V_i = nodes->GetPrimitive(iPoint); V_j = nodes->GetPrimitive(jPoint); + S_i = nodes->GetSecondary(iPoint); S_j = nodes->GetSecondary(jPoint); /*--- High order reconstruction using MUSCL strategy ---*/ @@ -3411,16 +3405,16 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim)); } - Gradient_i = node[iPoint]->GetGradient_Primitive(); - Gradient_j = node[jPoint]->GetGradient_Primitive(); + Gradient_i = nodes->GetGradient_Primitive(iPoint); + Gradient_j = nodes->GetGradient_Primitive(jPoint); if (limiter) { - Limiter_i = node[iPoint]->GetLimiter_Primitive(); - Limiter_j = node[jPoint]->GetLimiter_Primitive(); + Limiter_i = nodes->GetLimiter_Primitive(iPoint); + Limiter_j = nodes->GetLimiter_Primitive(jPoint); } for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Project_Grad_i = 0.0; Project_Grad_j = 0.0; - Non_Physical = node[iPoint]->GetNon_Physical()*node[jPoint]->GetNon_Physical(); + Non_Physical = nodes->GetNon_Physical(iPoint)*nodes->GetNon_Physical(jPoint); for (iDim = 0; iDim < nDim; iDim++) { Project_Grad_i += Vector_i[iDim]*Gradient_i[iVar][iDim]*Non_Physical; Project_Grad_j += Vector_j[iDim]*Gradient_j[iVar][iDim]*Non_Physical; @@ -3538,13 +3532,13 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain if (kind_dissipation != NO_ROELOWDISS){ - Dissipation_i = node[iPoint]->GetRoe_Dissipation(); - Dissipation_j = node[jPoint]->GetRoe_Dissipation(); + Dissipation_i = nodes->GetRoe_Dissipation(iPoint); + Dissipation_j = nodes->GetRoe_Dissipation(jPoint); numerics->SetDissipation(Dissipation_i, Dissipation_j); if (kind_dissipation == FD_DUCROS || kind_dissipation == NTS_DUCROS){ - Sensor_i = node[iPoint]->GetSensor(); - Sensor_j = node[jPoint]->GetSensor(); + Sensor_i = nodes->GetSensor(iPoint); + Sensor_j = nodes->GetSensor(jPoint); numerics->SetSensor(Sensor_i, Sensor_j); } if (kind_dissipation == NTS || kind_dissipation == NTS_DUCROS){ @@ -3571,19 +3565,12 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain Jacobian.SubtractBlock(jPoint, iPoint, Jacobian_i); Jacobian.SubtractBlock(jPoint, jPoint, Jacobian_j); } - - /*--- Roe Turkel preconditioning, set the value of beta ---*/ - - if (roe_turkel) { - node[iPoint]->SetPreconditioner_Beta(numerics->GetPrecond_Beta()); - node[jPoint]->SetPreconditioner_Beta(numerics->GetPrecond_Beta()); - } - + /*--- Set the final value of the Roe dissipation coefficient ---*/ if (kind_dissipation != NO_ROELOWDISS){ - node[iPoint]->SetRoe_Dissipation(numerics->GetDissipation()); - node[jPoint]->SetRoe_Dissipation(numerics->GetDissipation()); + nodes->SetRoe_Dissipation(iPoint,numerics->GetDissipation()); + nodes->SetRoe_Dissipation(jPoint,numerics->GetDissipation()); } } @@ -3660,8 +3647,8 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the conservative variables ---*/ - numerics->SetConservative(node[iPoint]->GetSolution(), - node[iPoint]->GetSolution()); + numerics->SetConservative(nodes->GetSolution(iPoint), + nodes->GetSolution(iPoint)); /*--- Load the volume of the dual mesh cell ---*/ numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -3686,8 +3673,8 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the conservative variables ---*/ - numerics->SetConservative(node[iPoint]->GetSolution(), - node[iPoint]->GetSolution()); + numerics->SetConservative(nodes->GetSolution(iPoint), + nodes->GetSolution(iPoint)); /*--- Load the volume of the dual mesh cell ---*/ numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -3717,7 +3704,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Set solution ---*/ - numerics->SetConservative(node[iPoint]->GetSolution(), node[iPoint]->GetSolution()); + numerics->SetConservative(nodes->GetSolution(iPoint), nodes->GetSolution(iPoint)); /*--- Set control volume ---*/ numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -3743,7 +3730,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Set solution ---*/ - numerics->SetConservative(node[iPoint]->GetSolution(), node[iPoint]->GetSolution()); + numerics->SetConservative(nodes->GetSolution(iPoint), nodes->GetSolution(iPoint)); /*--- Set control volume ---*/ numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -3770,7 +3757,7 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Get stored time spectral source term ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Source = node[iPoint]->GetHarmonicBalance_Source(iVar); + Source = nodes->GetHarmonicBalance_Source(iPoint,iVar); Residual[iVar] = Source*Volume; } @@ -3786,13 +3773,13 @@ void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_contain for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the wind gust ---*/ - numerics->SetWindGust(node[iPoint]->GetWindGust(), node[iPoint]->GetWindGust()); + numerics->SetWindGust(nodes->GetWindGust(iPoint), nodes->GetWindGust(iPoint)); /*--- Load the wind gust derivatives ---*/ - numerics->SetWindGustDer(node[iPoint]->GetWindGustDer(), node[iPoint]->GetWindGustDer()); + numerics->SetWindGustDer(nodes->GetWindGustDer(iPoint), nodes->GetWindGustDer(iPoint)); /*--- Load the primitive variables ---*/ - numerics->SetPrimitive(node[iPoint]->GetPrimitive(), node[iPoint]->GetPrimitive()); + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), nodes->GetPrimitive(iPoint)); /*--- Load the volume of the dual mesh cell ---*/ numerics->SetVolume(geometry->node[iPoint]->GetVolume()); @@ -3853,9 +3840,9 @@ void CEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_contain /* Next we describe how to get access to some important quanties for this method */ /* Access to all points in the current geometric mesh by saying: nPointDomain */ - /* Get the vector of conservative variables at some point iPoint = node[iPoint]->GetSolution() */ - /* Get the volume (or area in 2D) associated with iPoint = node[iPoint]->GetVolume() */ - /* Get the vector of geometric coordinates of point iPoint = node[iPoint]->GetCoord() */ + /* Get the vector of conservative variables at some point iPoint = nodes->GetSolution(iPoint) */ + /* Get the volume (or area in 2D) associated with iPoint = nodes->GetVolume(iPoint) */ + /* Get the vector of geometric coordinates of point iPoint = nodes->GetCoord(iPoint) */ } @@ -3869,7 +3856,7 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->SetLambda(0.0); + nodes->SetLambda(iPoint,0.0); } /*--- Loop interior edges ---*/ @@ -3886,8 +3873,8 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Mean Values ---*/ - Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal)); - Mean_SoundSpeed = 0.5 * (node[iPoint]->GetSoundSpeed() + node[jPoint]->GetSoundSpeed()) * Area; + Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + Mean_SoundSpeed = 0.5 * (nodes->GetSoundSpeed(iPoint) + nodes->GetSoundSpeed(jPoint)) * Area; /*--- Adjustment for grid movement ---*/ @@ -3905,8 +3892,8 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Inviscid contribution ---*/ Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddLambda(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddLambda(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddLambda(iPoint, Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddLambda(jPoint, Lambda); } @@ -3925,8 +3912,8 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Mean Values ---*/ - Mean_ProjVel = node[iPoint]->GetProjVel(Normal); - Mean_SoundSpeed = node[iPoint]->GetSoundSpeed() * Area; + Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); + Mean_SoundSpeed = nodes->GetSoundSpeed(iPoint) * Area; /*--- Adjustment for grid movement ---*/ @@ -3942,7 +3929,7 @@ void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; if (geometry->node[iPoint]->GetDomain()) { - node[iPoint]->AddLambda(Lambda); + nodes->AddLambda(iPoint,Lambda); } } } @@ -3971,8 +3958,7 @@ void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) Diff = new su2double[nVar]; - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetUnd_LaplZero(); + nodes->SetUnd_LaplZero(); for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { @@ -3982,13 +3968,13 @@ void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) /*--- Solution differences ---*/ for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = node[iPoint]->GetSolution(iVar) - node[jPoint]->GetSolution(iVar); + Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar); /*--- Correction for compressible flows which use the enthalpy ---*/ - Pressure_i = node[iPoint]->GetPressure(); - Pressure_j = node[jPoint]->GetPressure(); - Diff[nVar-1] = (node[iPoint]->GetSolution(nVar-1) + Pressure_i) - (node[jPoint]->GetSolution(nVar-1) + Pressure_j); + Pressure_i = nodes->GetPressure(iPoint); + Pressure_j = nodes->GetPressure(jPoint); + Diff[nVar-1] = (nodes->GetSolution(iPoint,nVar-1) + Pressure_i) - (nodes->GetSolution(jPoint,nVar-1) + Pressure_j); boundary_i = geometry->node[iPoint]->GetPhysicalBoundary(); boundary_j = geometry->node[jPoint]->GetPhysicalBoundary(); @@ -3996,19 +3982,19 @@ void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) /*--- Both points inside the domain, or both in the boundary ---*/ if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff); } /*--- iPoint inside the domain, jPoint on the boundary ---*/ if (!boundary_i && boundary_j) - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint, Diff); /*--- jPoint inside the domain, iPoint on the boundary ---*/ if (boundary_i && !boundary_j) - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint, Diff); } @@ -4048,8 +4034,8 @@ void CEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfig * iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Pressure_i = node[iPoint]->GetPressure(); - Pressure_j = node[jPoint]->GetPressure(); + Pressure_i = nodes->GetPressure(iPoint); + Pressure_j = nodes->GetPressure(jPoint); boundary_i = geometry->node[iPoint]->GetPhysicalBoundary(); boundary_j = geometry->node[jPoint]->GetPhysicalBoundary(); @@ -4083,7 +4069,7 @@ void CEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfig * /*--- Set pressure switch for each point ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetSensor(fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); + nodes->SetSensor(iPoint,fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); /*--- MPI parallelization ---*/ @@ -4107,12 +4093,12 @@ void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config) uixi=0.0; for(iDim = 0; iDim < nDim; iDim++){ - uixi += node[iPoint]->GetGradient_Primitive(iDim+1, iDim); + uixi += nodes->GetGradient_Primitive(iPoint,iDim+1, iDim); } /*--- Compute norm of vorticity ---*/ - Vorticity = node[iPoint]->GetVorticity(); + Vorticity = nodes->GetVorticity(iPoint); Omega = 0.0; for (iDim = 0; iDim < nDim; iDim++){ Omega += Vorticity[iDim]*Vorticity[iDim]; @@ -4127,7 +4113,7 @@ void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config) Ducros_i = pow(uixi,2.0) /(pow(uixi,2.0)+ pow(Omega,2.0) + 1e-20); } - node[iPoint]->SetSensor(Ducros_i); + nodes->SetSensor(iPoint,Ducros_i); /*---- Ducros sensor for neighbor points of iPoint to avoid lower the dissipation in regions near the shock ---*/ @@ -4139,12 +4125,12 @@ void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config) uixi=0.0; for(iDim = 0; iDim < nDim; iDim++){ - uixi += node[jPoint]->GetGradient_Primitive(iDim+1, iDim); + uixi += nodes->GetGradient_Primitive(jPoint,iDim+1, iDim); } /*--- Compute norm of vorticity ---*/ - Vorticity = node[jPoint]->GetVorticity(); + Vorticity = nodes->GetVorticity(jPoint); Omega = 0.0; for (iDim = 0; iDim < nDim; iDim++){ Omega += Vorticity[iDim]*Vorticity[iDim]; @@ -4156,7 +4142,7 @@ void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config) } else if (config->GetKind_RoeLowDiss() == NTS_DUCROS){ Ducros_j = pow(uixi,2.0) /(pow(uixi,2.0)+ pow(Omega,2.0) + 1e-20); } - node[iPoint]->SetSensor(max(node[iPoint]->GetSensor(), Ducros_j)); + nodes->SetSensor(iPoint, max(nodes->GetSensor(iPoint), Ducros_j)); } } @@ -4290,7 +4276,7 @@ void CEulerSolver::Pressure_Forces(CGeometry *geometry, CConfig *config) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - Pressure = node[iPoint]->GetPressure(); + Pressure = nodes->GetPressure(iPoint); CPressure[iMarker][iVertex] = (Pressure - RefPressure)*factor*RefArea; @@ -4687,7 +4673,7 @@ void CEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) { Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); Coord = geometry->node[iPoint]->GetCoord(); - Density = node[iPoint]->GetDensity(); + Density = nodes->GetDensity(iPoint); /*--- Quadratic objective function for the near-field. This uses the infinity pressure regardless of Mach number. ---*/ @@ -4696,7 +4682,7 @@ void CEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) { MassFlow = 0.0; for (iDim = 0; iDim < nDim; iDim++) { - Velocity[iDim] = node[iPoint]->GetVelocity(iDim); + Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); MomentDist[iDim] = Coord[iDim] - Origin[iDim]; MassFlow -= Normal[iDim]*Velocity[iDim]*Density; } @@ -4960,15 +4946,15 @@ void CEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_co for (iPoint = 0; iPoint < nPointDomain; iPoint++) { Vol = (geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume()); - Delta = node[iPoint]->GetDelta_Time() / Vol; + Delta = nodes->GetDelta_Time(iPoint) / Vol; - Res_TruncError = node[iPoint]->GetResTruncError(); + Res_TruncError = nodes->GetResTruncError(iPoint); Residual = LinSysRes.GetBlock(iPoint); if (!adjoint) { for (iVar = 0; iVar < nVar; iVar++) { Res = Residual[iVar] + Res_TruncError[iVar]; - node[iPoint]->AddSolution(iVar, -Res*Delta*RK_AlphaCoeff); + nodes->AddSolution(iPoint,iVar, -Res*Delta*RK_AlphaCoeff); AddRes_RMS(iVar, Res*Res); AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord()); } @@ -5014,9 +5000,9 @@ void CEulerSolver::ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_ Vol = (geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume()); - Delta = node[iPoint]->GetDelta_Time() / Vol; + Delta = nodes->GetDelta_Time(iPoint) / Vol; - Res_TruncError = node[iPoint]->GetResTruncError(); + Res_TruncError = nodes->GetResTruncError(iPoint); Residual = LinSysRes.GetBlock(iPoint); tmp_time = -1.0*RK_TimeCoeff[iRKStep]*Delta; @@ -5027,12 +5013,12 @@ void CEulerSolver::ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_ Res = Residual[iVar] + Res_TruncError[iVar]; if (iRKStep < 3) { /* Base Solution Update */ - node[iPoint]->AddSolution(iVar, tmp_time*Res); + nodes->AddSolution(iPoint,iVar, tmp_time*Res); /* New Solution Update */ - node[iPoint]->AddSolution_New(iVar, tmp_func*Res); + nodes->AddSolution_New(iPoint,iVar, tmp_func*Res); } else { - node[iPoint]->SetSolution(iVar, node[iPoint]->GetSolution_New(iVar) + tmp_func*Res); + nodes->SetSolution(iPoint, iVar, nodes->GetSolution_New(iPoint, iVar) + tmp_func*Res); } AddRes_RMS(iVar, Res*Res); @@ -5074,14 +5060,14 @@ void CEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver for (iPoint = 0; iPoint < nPointDomain; iPoint++) { Vol = (geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume()); - Delta = node[iPoint]->GetDelta_Time() / Vol; + Delta = nodes->GetDelta_Time(iPoint) / Vol; - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); local_Residual = LinSysRes.GetBlock(iPoint); if (!adjoint) { for (iVar = 0; iVar < nVar; iVar++) { Res = local_Residual[iVar] + local_Res_TruncError[iVar]; - node[iPoint]->AddSolution(iVar, -Res*Delta); + nodes->AddSolution(iPoint,iVar, -Res*Delta); AddRes_RMS(iVar, Res*Res); AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord()); } @@ -5127,7 +5113,7 @@ void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver /*--- Read the residual ---*/ - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); /*--- Read the volume ---*/ @@ -5137,8 +5123,8 @@ void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver /*--- Modify matrix diagonal to assure diagonal dominance ---*/ - if (node[iPoint]->GetDelta_Time() != 0.0) { - Delta = Vol / node[iPoint]->GetDelta_Time(); + if (nodes->GetDelta_Time(iPoint) != 0.0) { + Delta = Vol / nodes->GetDelta_Time(iPoint); if (roe_turkel || low_mach_prec) { SetPreconditioner(config, iPoint); for (iVar = 0; iVar < nVar; iVar ++ ) @@ -5197,7 +5183,7 @@ void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver if (!adjoint) { for (iPoint = 0; iPoint < nPointDomain; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->AddSolution(iVar, config->GetRelaxation_Factor_Flow()*LinSysSol[iPoint*nVar+iVar]); + nodes->AddSolution(iPoint,iVar, config->GetRelaxation_Factor_Flow()*LinSysSol[iPoint*nVar+iVar]); } } } @@ -5235,9 +5221,8 @@ void CEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *config PrimVar_j = new su2double [nPrimVarGrad]; /*--- Set Gradient_Primitive to zero ---*/ - - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetGradient_PrimitiveZero(nPrimVarGrad); + + nodes->SetGradient_PrimitiveZero(); /*--- Loop interior edges ---*/ @@ -5246,8 +5231,8 @@ void CEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *config jPoint = geometry->edge[iEdge]->GetNode(1); for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar); - PrimVar_j[iVar] = node[jPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = nodes->GetPrimitive(iPoint,iVar); + PrimVar_j[iVar] = nodes->GetPrimitive(jPoint,iVar); } Normal = geometry->edge[iEdge]->GetNormal(); @@ -5256,9 +5241,9 @@ void CEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *config for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = PrimVar_Average*Normal[iDim]; if (geometry->node[iPoint]->GetDomain()) - node[iPoint]->AddGradient_Primitive(iVar, iDim, Partial_Res); + nodes->AddGradient_Primitive(iPoint,iVar, iDim, Partial_Res); if (geometry->node[jPoint]->GetDomain()) - node[jPoint]->SubtractGradient_Primitive(iVar, iDim, Partial_Res); + nodes->SubtractGradient_Primitive(jPoint,iVar, iDim, Partial_Res); } } } @@ -5273,13 +5258,13 @@ void CEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *config if (geometry->node[iPoint]->GetDomain()) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) - PrimVar_Vertex[iVar] = node[iPoint]->GetPrimitive(iVar); + PrimVar_Vertex[iVar] = nodes->GetPrimitive(iPoint,iVar); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); for (iVar = 0; iVar < nPrimVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = PrimVar_Vertex[iVar]*Normal[iDim]; - node[iPoint]->SubtractGradient_Primitive(iVar, iDim, Partial_Res); + nodes->SubtractGradient_Primitive(iPoint,iVar, iDim, Partial_Res); } } } @@ -5304,8 +5289,8 @@ void CEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *config for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - Partial_Gradient = node[iPoint]->GetGradient_Primitive(iVar, iDim)/Vol; - node[iPoint]->SetGradient_Primitive(iVar, iDim, Partial_Gradient); + Partial_Gradient = nodes->GetGradient_Primitive(iPoint,iVar, iDim)/Vol; + nodes->SetGradient_Primitive(iPoint,iVar, iDim, Partial_Gradient); } } @@ -5331,6 +5316,10 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config su2double z11, z12, z13, z22, z23, z33, detR2; bool singular; + /*--- Clear Rmatrix and Primitive gradient ---*/ + nodes->SetRmatrixZero(); + nodes->SetGradient_PrimitiveZero(); + /*--- Loop over points of the grid ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { @@ -5344,7 +5333,7 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config /*--- Get primitives from CVariable ---*/ - PrimVar_i = node[iPoint]->GetPrimitive(); + PrimVar_i = nodes->GetPrimitive(iPoint); /*--- Inizialization of variables ---*/ @@ -5355,9 +5344,6 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config /*--- Clear Rmatrix, which could eventually be computed once and stored for static meshes, as well as the prim gradient. ---*/ - node[iPoint]->SetRmatrixZero(); - node[iPoint]->SetGradient_PrimitiveZero(nPrimVarGrad); - AD::StartPreacc(); AD::SetPreaccIn(PrimVar_i, nPrimVarGrad); AD::SetPreaccIn(Coord_i, nDim); @@ -5365,12 +5351,12 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) { jPoint = geometry->node[iPoint]->GetPoint(iNeigh); Coord_j = geometry->node[jPoint]->GetCoord(); - - PrimVar_j = node[jPoint]->GetPrimitive(); - + + PrimVar_j = nodes->GetPrimitive(jPoint); + AD::SetPreaccIn(Coord_j, nDim); AD::SetPreaccIn(PrimVar_j, nPrimVarGrad); - + weight = 0.0; for (iDim = 0; iDim < nDim; iDim++) weight += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]); @@ -5379,28 +5365,28 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config if (weight != 0.0) { - node[iPoint]->AddRmatrix(0, 0, (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight); - node[iPoint]->AddRmatrix(0, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight); - node[iPoint]->AddRmatrix(1, 1, (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight); + nodes->AddRmatrix(iPoint,0, 0, (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight); + nodes->AddRmatrix(iPoint,0, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight); + nodes->AddRmatrix(iPoint,1, 1, (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight); if (nDim == 3) { - node[iPoint]->AddRmatrix(0, 2, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(1, 2, (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(2, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(2, 2, (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,0, 2, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,1, 2, (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,2, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,2, 2, (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight); } /*--- Entries of c:= transpose(A)*b ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->AddGradient_Primitive(iVar,iDim, (Coord_j[iDim]-Coord_i[iDim])*(PrimVar_j[iVar]-PrimVar_i[iVar])/weight); + nodes->AddGradient_Primitive(iPoint,iVar,iDim, (Coord_j[iDim]-Coord_i[iDim])*(PrimVar_j[iVar]-PrimVar_i[iVar])/weight); } } } } - AD::SetPreaccOut(node[iPoint]->GetRmatrix(), nDim, nDim); - AD::SetPreaccOut(node[iPoint]->GetGradient_Primitive(), nPrimVarGrad, nDim); + AD::SetPreaccOut(nodes->GetRmatrix(iPoint), nDim, nDim); + AD::SetPreaccOut(nodes->GetGradient_Primitive(iPoint), nPrimVarGrad, nDim); AD::EndPreacc(); } @@ -5424,9 +5410,9 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config r11 = 0.0; r12 = 0.0; r13 = 0.0; r22 = 0.0; r23 = 0.0; r23_a = 0.0; r23_b = 0.0; r33 = 0.0; - r11 = node[iPoint]->GetRmatrix(0,0); - r12 = node[iPoint]->GetRmatrix(0,1); - r22 = node[iPoint]->GetRmatrix(1,1); + r11 = nodes->GetRmatrix(iPoint,0,0); + r12 = nodes->GetRmatrix(iPoint,0,1); + r22 = nodes->GetRmatrix(iPoint,1,1); AD::StartPreacc(); AD::SetPreaccIn(r11); @@ -5438,10 +5424,10 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config if (r22-r12*r12 >= 0.0) r22 = sqrt(r22-r12*r12); else r22 = 0.0; if (nDim == 3) { - r13 = node[iPoint]->GetRmatrix(0,2); - r23_a = node[iPoint]->GetRmatrix(1,2); - r23_b = node[iPoint]->GetRmatrix(2,1); - r33 = node[iPoint]->GetRmatrix(2,2); + r13 = nodes->GetRmatrix(iPoint,0,2); + r23_a = nodes->GetRmatrix(iPoint,1,2); + r23_b = nodes->GetRmatrix(iPoint,2,1); + r33 = nodes->GetRmatrix(iPoint,2,2); AD::SetPreaccIn(r13); AD::SetPreaccIn(r23_a); @@ -5499,14 +5485,14 @@ void CEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config for (iDim = 0; iDim < nDim; iDim++) { Cvector[iVar][iDim] = 0.0; for (jDim = 0; jDim < nDim; jDim++) { - Cvector[iVar][iDim] += Smatrix[iDim][jDim]*node[iPoint]->GetGradient_Primitive(iVar, jDim); + Cvector[iVar][iDim] += Smatrix[iDim][jDim]*nodes->GetGradient_Primitive(iPoint,iVar, jDim); } } } for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->SetGradient_Primitive(iVar, iDim, Cvector[iVar][iDim]); + nodes->SetGradient_Primitive(iPoint,iVar, iDim, Cvector[iVar][iDim]); } } @@ -5546,7 +5532,7 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - node[iPoint]->SetLimiter_Primitive(iVar, 1.0); + nodes->SetLimiter_Primitive(iPoint,iVar, 1.0); } } @@ -5558,9 +5544,9 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - node[iPoint]->SetSolution_Max(iVar, -EPS); - node[iPoint]->SetSolution_Min(iVar, EPS); - node[iPoint]->SetLimiter_Primitive(iVar, 2.0); + nodes->SetSolution_Max(iPoint,iVar, -EPS); + nodes->SetSolution_Min(iPoint,iVar, EPS); + nodes->SetLimiter_Primitive(iPoint,iVar, 2.0); } } @@ -5575,17 +5561,17 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { /*--- Get the primitive variables ---*/ - Primitive_i = node[iPoint]->GetPrimitive(); - Primitive_j = node[jPoint]->GetPrimitive(); + Primitive_i = nodes->GetPrimitive(iPoint); + Primitive_j = nodes->GetPrimitive(jPoint); /*--- Compute the maximum, and minimum values for nodes i & j ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { du = (Primitive_j[iVar] - Primitive_i[iVar]); - node[iPoint]->SetSolution_Min(iVar, min(node[iPoint]->GetSolution_Min(iVar), du)); - node[iPoint]->SetSolution_Max(iVar, max(node[iPoint]->GetSolution_Max(iVar), du)); - node[jPoint]->SetSolution_Min(iVar, min(node[jPoint]->GetSolution_Min(iVar), -du)); - node[jPoint]->SetSolution_Max(iVar, max(node[jPoint]->GetSolution_Max(iVar), -du)); + nodes->SetSolution_Min(iPoint, iVar, min(nodes->GetSolution_Min(iPoint, iVar), du)); + nodes->SetSolution_Max(iPoint, iVar, max(nodes->GetSolution_Max(iPoint, iVar), du)); + nodes->SetSolution_Min(jPoint, iVar, min(nodes->GetSolution_Min(jPoint, iVar), -du)); + nodes->SetSolution_Max(jPoint, iVar, max(nodes->GetSolution_Max(jPoint, iVar), -du)); } } @@ -5607,8 +5593,8 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient_Primitive(); - Gradient_j = node[jPoint]->GetGradient_Primitive(); + Gradient_i = nodes->GetGradient_Primitive(iPoint); + Gradient_j = nodes->GetGradient_Primitive(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -5619,10 +5605,10 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(jPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(jPoint,iVar)); /*--- Calculate the interface left gradient, delta- (dm) ---*/ @@ -5632,14 +5618,14 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { if (dm == 0.0) { limiter = 2.0; } else { - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(iPoint,iVar); + else dp = nodes->GetSolution_Min(iPoint,iVar); limiter = dp/dm; } - if (limiter < node[iPoint]->GetLimiter_Primitive(iVar)) { - node[iPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[iPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(iPoint,iVar)) { + nodes->SetLimiter_Primitive(iPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(iPoint)[iVar]); } /*--- Calculate the interface right gradient, delta+ (dp) ---*/ @@ -5650,14 +5636,14 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { if (dm == 0.0) { limiter = 2.0; } else { - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(jPoint,iVar); + else dp = nodes->GetSolution_Min(jPoint,iVar); limiter = dp/dm; } - if (limiter < node[jPoint]->GetLimiter_Primitive(iVar)) { - node[jPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[jPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(jPoint,iVar)) { + nodes->SetLimiter_Primitive(jPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(jPoint)[iVar]); } } @@ -5668,9 +5654,9 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - y = node[iPoint]->GetLimiter_Primitive(iVar); + y = nodes->GetLimiter_Primitive(iPoint,iVar); limiter = (y*y + 2.0*y) / (y*y + y + 2.0); - node[iPoint]->SetLimiter_Primitive(iVar, limiter); + nodes->SetLimiter_Primitive(iPoint,iVar, limiter); } } @@ -5690,7 +5676,7 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { /*--- Compute the max value and min value of the solution ---*/ - Primitive = node[0]->GetPrimitive(); + Primitive = nodes->GetPrimitive(0); for (iVar = 0; iVar < nPrimVarGrad; iVar++) { LocalMinPrimitive[iVar] = Primitive[iVar]; LocalMaxPrimitive[iVar] = Primitive[iVar]; @@ -5700,7 +5686,7 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { /*--- Get the primitive variables ---*/ - Primitive = node[iPoint]->GetPrimitive(); + Primitive = nodes->GetPrimitive(iPoint); for (iVar = 0; iVar < nPrimVarGrad; iVar++) { LocalMinPrimitive[iVar] = min (LocalMinPrimitive[iVar], Primitive[iVar]); @@ -5724,8 +5710,8 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient_Primitive(); - Gradient_j = node[jPoint]->GetGradient_Primitive(); + Gradient_i = nodes->GetGradient_Primitive(iPoint); + Gradient_j = nodes->GetGradient_Primitive(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -5736,10 +5722,10 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { AD::SetPreaccIn(Gradient_j[iVar], nDim); AD::SetPreaccIn(Coord_i, nDim); AD::SetPreaccIn(Coord_j, nDim); - AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(jPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(jPoint,iVar)); if (config->GetKind_SlopeLimit_Flow() == VENKATAKRISHNAN_WANG) { AD::SetPreaccIn(GlobalMaxPrimitive[iVar]); @@ -5760,14 +5746,14 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { /*--- Calculate the interface right gradient, delta+ (dp) ---*/ - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(iPoint,iVar); + else dp = nodes->GetSolution_Min(iPoint,iVar); limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[iPoint]->GetLimiter_Primitive(iVar)) { - node[iPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[iPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(iPoint,iVar)) { + nodes->SetLimiter_Primitive(iPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(iPoint)[iVar]); } /*-- Repeat for point j on the edge ---*/ @@ -5776,14 +5762,14 @@ void CEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) { for (iDim = 0; iDim < nDim; iDim++) dm += 0.5*(Coord_i[iDim]-Coord_j[iDim])*Gradient_j[iVar][iDim]; - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(jPoint,iVar); + else dp = nodes->GetSolution_Min(jPoint,iVar); limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[jPoint]->GetLimiter_Primitive(iVar)) { - node[jPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[jPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(jPoint,iVar)) { + nodes->SetLimiter_Primitive(jPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(jPoint)[iVar]); } AD::EndPreacc(); @@ -5822,7 +5808,7 @@ void CEulerSolver::SetPreconditioner(CConfig *config, unsigned long iPoint) { su2double Mach_infty2, Mach_lim2, aux, parameter; /*--- Variables to calculate the preconditioner parameter Beta ---*/ - local_Mach = sqrt(node[iPoint]->GetVelocity2())/node[iPoint]->GetSoundSpeed(); + local_Mach = sqrt(nodes->GetVelocity2(iPoint))/nodes->GetSoundSpeed(iPoint); /*--- Weiss and Smith Preconditioning---*/ Mach_infty2 = pow(config->GetMach(),2.0); @@ -5830,12 +5816,12 @@ void CEulerSolver::SetPreconditioner(CConfig *config, unsigned long iPoint) { aux = max(pow(local_Mach,2.0),Mach_lim2); parameter = min(1.0, max(aux,Beta_max*Mach_infty2)); - U_i = node[iPoint]->GetSolution(); + U_i = nodes->GetSolution(iPoint); rho = U_i[0]; - enthalpy = node[iPoint]->GetEnthalpy(); - soundspeed = node[iPoint]->GetSoundSpeed(); - sq_vel = node[iPoint]->GetVelocity2(); + enthalpy = nodes->GetEnthalpy(iPoint); + soundspeed = nodes->GetSoundSpeed(iPoint); + sq_vel = nodes->GetVelocity2(iPoint); /*---Calculating the inverse of the preconditioning matrix that multiplies the time derivative */ LowMach_Precontioner[0][0] = 0.5*sq_vel; @@ -5960,7 +5946,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns if (geometry->node[iPoint]->GetDomain()) { - V_inlet = node[iPoint]->GetPrimitive(); + V_inlet = nodes->GetPrimitive(iPoint); geometry->vertex[iMarker][iVertex]->GetNormal(Vector); @@ -6030,7 +6016,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns if (geometry->node[iPoint]->GetDomain()) { - V_outlet = node[iPoint]->GetPrimitive(); + V_outlet = nodes->GetPrimitive(iPoint); geometry->vertex[iMarker][iVertex]->GetNormal(Vector); @@ -7210,7 +7196,7 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con /*--- Use the inlet state to compute the Pressure and Temperature jumps ---*/ if (config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) - V_inlet = node[iPoint]->GetPrimitive(); + V_inlet = nodes->GetPrimitive(iPoint); if (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET) V_inlet = GetDonorPrimVar(iMarker, iVertex); @@ -7984,27 +7970,25 @@ void CEulerSolver::BC_Sym_Plane(CGeometry *geometry, conv_numerics->SetNormal(Normal); /*--- Get current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Set the reflected state based on the boundary node. Scalars are copied and the velocity is mirrored along the symmetry boundary, i.e. the velocity in normal direction is substracted twice. ---*/ for(iVar = 0; iVar < nPrimVar; iVar++) - V_reflected[iVar] = node[iPoint]->GetPrimitive(iVar); + V_reflected[iVar] = nodes->GetPrimitive(iPoint,iVar); /*--- Compute velocity in normal direction (ProjVelcity_i=(v*n)) und substract twice from velocity in normal direction: v_r = v - 2 (v*n)n ---*/ - ProjVelocity_i = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - ProjVelocity_i += node[iPoint]->GetVelocity(iDim)*UnitNormal[iDim]; + ProjVelocity_i = nodes->GetProjVel(iPoint,UnitNormal); for (iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim+1] = node[iPoint]->GetVelocity(iDim) - 2.0 * ProjVelocity_i*UnitNormal[iDim]; + V_reflected[iDim+1] = nodes->GetVelocity(iPoint,iDim) - 2.0 * ProjVelocity_i*UnitNormal[iDim]; /*--- Set Primitive and Secondary for numerics class. ---*/ conv_numerics->SetPrimitive(V_domain, V_reflected); - conv_numerics->SetSecondary(node[iPoint]->GetSecondary(), - node[iPoint]->GetSecondary()); + conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), + nodes->GetSecondary(iPoint)); /*--- Compute the residual using an upwind scheme. ---*/ conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config); @@ -8035,8 +8019,8 @@ void CEulerSolver::BC_Sym_Plane(CGeometry *geometry, /*--- Set the primitive and Secondary variables. ---*/ visc_numerics->SetPrimitive(V_domain, V_reflected); - visc_numerics->SetSecondary(node[iPoint]->GetSecondary(), - node[iPoint]->GetSecondary()); + visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), + nodes->GetSecondary(iPoint)); /*--- For viscous Fluxes also the gradients of the primitives need to be determined. 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives @@ -8047,7 +8031,7 @@ void CEulerSolver::BC_Sym_Plane(CGeometry *geometry, /*--- Get gradients of primitives of boundary cell ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = node[iPoint]->GetGradient_Primitive(iVar, iDim); + Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint, iVar, iDim); /*--- Reflect the gradients for all scalars including the velocity components. The gradients of the velocity components are set later with the @@ -8102,12 +8086,12 @@ void CEulerSolver::BC_Sym_Plane(CGeometry *geometry, Grad_Reflected[iVar+1][iDim] = GradNormVel[iDim]*UnitNormal[iVar] + GradTangVel[iDim]*Tangential[iVar]; /*--- Set the primitive gradients of the boundary and reflected state. ---*/ - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), Grad_Reflected); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), Grad_Reflected); /*--- Turbulent kinetic energy. ---*/ if (config->GetKind_Turb_Model() == SST) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the following routine based upon the velocity-component gradients. ---*/ @@ -8183,7 +8167,7 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, conv_numerics->SetNormal(Normal); /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Construct solution state at infinity for compressible flow by using Riemann invariants, and then impose a weak boundary condition @@ -8214,7 +8198,7 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, Vel2_Bound += Vel_Bound[iDim]*Vel_Bound[iDim]; Vn_Bound += Vel_Bound[iDim]*UnitNormal[iDim]; } - Pressure_Bound = node[iPoint]->GetPressure(); + Pressure_Bound = nodes->GetPressure(iPoint); SoundSpeed_Bound = sqrt(Gamma*Pressure_Bound/Density_Bound); Entropy_Bound = pow(Density_Bound, Gamma)/Pressure_Bound; @@ -8342,20 +8326,15 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i); - - /*--- Roe Turkel preconditioning, set the value of beta ---*/ - - if (config->GetKind_Upwind() == TURKEL) - node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta()); - + /*--- Viscous residual contribution ---*/ if (viscous) { /*--- Set laminar and eddy viscosity at the infinity ---*/ - V_infty[nDim+5] = node[iPoint]->GetLaminarViscosity(); - V_infty[nDim+6] = node[iPoint]->GetEddyViscosity(); + V_infty[nDim+5] = nodes->GetLaminarViscosity(iPoint); + V_infty[nDim+6] = nodes->GetEddyViscosity(iPoint); /*--- Set the normal vector and the coordinates ---*/ @@ -8366,14 +8345,14 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(V_domain, V_infty); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), - node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ @@ -8467,20 +8446,20 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, UnitNormal[iDim] = Normal[iDim]/Area; /*--- Retrieve solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Compute the internal state u_i ---*/ Velocity2_i = 0; for (iDim=0; iDim < nDim; iDim++) { - Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim); + Velocity_i[iDim] = nodes->GetVelocity(iPoint,iDim); Velocity2_i += Velocity_i[iDim]*Velocity_i[iDim]; } - Density_i = node[iPoint]->GetDensity(); + Density_i = nodes->GetDensity(iPoint); - Energy_i = node[iPoint]->GetEnergy(); + Energy_i = nodes->GetEnergy(iPoint); StaticEnergy_i = Energy_i - 0.5*Velocity2_i; FluidModel->SetTDState_rhoe(Density_i, StaticEnergy_i); @@ -8799,10 +8778,6 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i); - /*--- Roe Turkel preconditioning, set the value of beta ---*/ - if (config->GetKind_Upwind() == TURKEL) - node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta()); - /*--- Viscous contribution ---*/ if (viscous) { @@ -8819,7 +8794,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, /*--- Set laminar and eddy viscosity at the infinity ---*/ V_boundary[nDim+5] = FluidModel->GetLaminarViscosity(); - V_boundary[nDim+6] = node[iPoint]->GetEddyViscosity(); + V_boundary[nDim+6] = nodes->GetEddyViscosity(iPoint); V_boundary[nDim+7] = FluidModel->GetThermalConductivity(); V_boundary[nDim+8] = FluidModel->GetCp(); @@ -8831,11 +8806,11 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(V_domain, V_boundary); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); /*--- Secondary variables ---*/ - S_domain = node[iPoint]->GetSecondary(); + S_domain = nodes->GetSecondary(iPoint); /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/ @@ -8858,7 +8833,7 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ @@ -8979,19 +8954,19 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain geometry->turbovertex[val_marker][iSpan][iVertex]->GetTurboNormal(turboNormal); /*--- Retrieve solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /* --- Compute the internal state u_i --- */ Velocity2_i = 0; for (iDim=0; iDim < nDim; iDim++) { - Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim); + Velocity_i[iDim] = nodes->GetVelocity(iPoint,iDim); Velocity2_i += Velocity_i[iDim]*Velocity_i[iDim]; } - Density_i = node[iPoint]->GetDensity(); + Density_i = nodes->GetDensity(iPoint); - Energy_i = node[iPoint]->GetEnergy(); + Energy_i = nodes->GetEnergy(iPoint); StaticEnergy_i = Energy_i - 0.5*Velocity2_i; FluidModel->SetTDState_rhoe(Density_i, StaticEnergy_i); @@ -9305,10 +9280,6 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i); - /*--- Roe Turkel preconditioning, set the value of beta ---*/ - if (config->GetKind_Upwind() == TURKEL) - node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta()); - /*--- Viscous contribution ---*/ if (viscous) { @@ -9325,7 +9296,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain /*--- Set laminar and eddy viscosity at the infinity ---*/ V_boundary[nDim+5] = FluidModel->GetLaminarViscosity(); - V_boundary[nDim+6] = node[iPoint]->GetEddyViscosity(); + V_boundary[nDim+6] = nodes->GetEddyViscosity(iPoint); V_boundary[nDim+7] = FluidModel->GetThermalConductivity(); V_boundary[nDim+8] = FluidModel->GetCp(); @@ -9337,11 +9308,11 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(V_domain, V_boundary); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); /*--- Secondary variables ---*/ - S_domain = node[iPoint]->GetSecondary(); + S_domain = nodes->GetSecondary(iPoint); /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/ @@ -9364,7 +9335,7 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ @@ -9453,11 +9424,11 @@ void CEulerSolver::PreprocessBC_Giles(CGeometry *geometry, CConfig *config, CNum geometry->turbovertex[iMarker][iSpan][iVertex]->GetTurboNormal(turboNormal); /*--- Compute the internal state _i ---*/ - Pressure_i = node[iPoint]->GetPressure(); - Density_i = node[iPoint]->GetDensity(); + Pressure_i = nodes->GetPressure(iPoint); + Density_i = nodes->GetDensity(iPoint); for (iDim = 0; iDim < nDim; iDim++) { - Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim); + Velocity_i[iDim] = nodes->GetVelocity(iPoint,iDim); } ComputeTurboVelocity(Velocity_i, turboNormal, turboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone)); @@ -9902,24 +9873,24 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, geometry->turbovertex[val_marker][iSpan][iVertex]->GetTurboNormal(turboNormal); /*--- Retrieve solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Retrieve domain Secondary variables ---*/ - S_domain = node[iPoint]->GetSecondary(); + S_domain = nodes->GetSecondary(iPoint); /*--- Compute the internal state u_i ---*/ Velocity2_i = 0; for (iDim = 0; iDim < nDim; iDim++) { - Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim); + Velocity_i[iDim] = nodes->GetVelocity(iPoint,iDim); Velocity2_i += Velocity_i[iDim]*Velocity_i[iDim]; } - Density_i = node[iPoint]->GetDensity(); + Density_i = nodes->GetDensity(iPoint); - Energy_i = node[iPoint]->GetEnergy(); + Energy_i = nodes->GetEnergy(iPoint); StaticEnergy_i = Energy_i - 0.5*Velocity2_i; FluidModel->SetTDState_rhoe(Density_i, StaticEnergy_i); @@ -10210,11 +10181,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, /*--- Jacobian contribution for implicit integration ---*/ if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i); - - /*--- Roe Turkel preconditioning, set the value of beta ---*/ - if (config->GetKind_Upwind() == TURKEL) - node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta()); - + /*--- Viscous contribution ---*/ if (viscous) { @@ -10222,7 +10189,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, /*--- Set laminar and eddy viscosity at the infinity ---*/ V_boundary[nDim+5] = FluidModel->GetLaminarViscosity(); - V_boundary[nDim+6] = node[iPoint]->GetEddyViscosity(); + V_boundary[nDim+6] = nodes->GetEddyViscosity(iPoint); V_boundary[nDim+7] = FluidModel->GetThermalConductivity(); V_boundary[nDim+8] = FluidModel->GetCp(); @@ -10234,7 +10201,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(V_domain, V_boundary); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/ @@ -10258,7 +10225,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ @@ -10357,7 +10324,7 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Build the fictitious intlet state based on characteristics ---*/ @@ -10496,8 +10463,8 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Get primitives from current inlet state. ---*/ for (iDim = 0; iDim < nDim; iDim++) - Velocity[iDim] = node[iPoint]->GetVelocity(iDim); - Pressure = node[iPoint]->GetPressure(); + Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); + Pressure = nodes->GetPressure(iPoint); SoundSpeed2 = Gamma*Pressure/V_domain[nDim+2]; /*--- Compute the acoustic Riemann invariant that is extrapolated @@ -10556,20 +10523,15 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i); - - /*--- Roe Turkel preconditioning, set the value of beta ---*/ - - if (config->GetKind_Upwind() == TURKEL) - node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta()); - + // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // // if (viscous) { // // /*--- Set laminar and eddy viscosity at the infinity ---*/ // -// V_inlet[nDim+5] = node[iPoint]->GetLaminarViscosity(); -// V_inlet[nDim+6] = node[iPoint]->GetEddyViscosity(); +// V_inlet[nDim+5] = nodes->GetLaminarViscosity(iPoint); +// V_inlet[nDim+6] = nodes->GetEddyViscosity(iPoint); // // /*--- Set the normal vector and the coordinates ---*/ // @@ -10579,12 +10541,12 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, // /*--- Primitive variables, and gradient ---*/ // // visc_numerics->SetPrimitive(V_domain, V_inlet); -// visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); +// visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); // // /*--- Turbulent kinetic energy ---*/ // // if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) -// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); +// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); // // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ // @@ -10651,7 +10613,7 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, UnitNormal[iDim] = Normal[iDim]/Area; /*--- Current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Build the fictitious intlet state based on characteristics ---*/ @@ -10735,19 +10697,15 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, if (implicit) { Jacobian.AddBlock(iPoint, iPoint, Jacobian_i); } - - /*--- Roe Turkel preconditioning, set the value of beta ---*/ - if (config->GetKind_Upwind() == TURKEL) - node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta()); - + // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // // if (viscous) { // // /*--- Set laminar and eddy viscosity at the infinity ---*/ // -// V_outlet[nDim+5] = node[iPoint]->GetLaminarViscosity(); -// V_outlet[nDim+6] = node[iPoint]->GetEddyViscosity(); +// V_outlet[nDim+5] = nodes->GetLaminarViscosity(iPoint); +// V_outlet[nDim+6] = nodes->GetEddyViscosity(iPoint); // // /*--- Set the normal vector and the coordinates ---*/ // @@ -10757,12 +10715,12 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, // /*--- Primitive variables, and gradient ---*/ // // visc_numerics->SetPrimitive(V_domain, V_outlet); -// visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); +// visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); // // /*--- Turbulent kinetic energy ---*/ // // if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) -// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); +// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); // // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ // visc_numerics->SetTauWall(-1.0, -1.0); @@ -10854,7 +10812,7 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con /*--- Current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Normal vector for this vertex (negate for outward convention) ---*/ @@ -10886,8 +10844,8 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con // // /*--- Set laminar and eddy viscosity at the infinity ---*/ // -// V_inlet[nDim+5] = node[iPoint]->GetLaminarViscosity(); -// V_inlet[nDim+6] = node[iPoint]->GetEddyViscosity(); +// V_inlet[nDim+5] = nodes->GetLaminarViscosity(iPoint); +// V_inlet[nDim+6] = nodes->GetEddyViscosity(iPoint); // // /*--- Set the normal vector and the coordinates ---*/ // @@ -10897,12 +10855,12 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con // /*--- Primitive variables, and gradient ---*/ // // visc_numerics->SetPrimitive(V_domain, V_inlet); -// visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); +// visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); // // /*--- Turbulent kinetic energy ---*/ // // if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) -// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); +// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); // // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ // @@ -10955,7 +10913,7 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co /*--- Current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Allocate the value at the outlet ---*/ @@ -10972,7 +10930,7 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co /*--- Current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Normal vector for this vertex (negate for outward convention) ---*/ @@ -11004,8 +10962,8 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co // // /*--- Set laminar and eddy viscosity at the infinity ---*/ // - // V_outlet[nDim+5] = node[iPoint]->GetLaminarViscosity(); - // V_outlet[nDim+6] = node[iPoint]->GetEddyViscosity(); + // V_outlet[nDim+5] = nodes->GetLaminarViscosity(iPoint); + // V_outlet[nDim+6] = nodes->GetEddyViscosity(iPoint); // // /*--- Set the normal vector and the coordinates ---*/ // @@ -11015,12 +10973,12 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co // /*--- Primitive variables, and gradient ---*/ // // visc_numerics->SetPrimitive(V_domain, V_outlet); - // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); + // visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); // // /*--- Turbulent kinetic energy ---*/ // // if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); // // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ // @@ -11152,7 +11110,7 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai /*--- Current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Subsonic nacelle inflow: there is one incoming characteristic, therefore one variable can be specified (back pressure) and is used @@ -11225,8 +11183,8 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai // // /*--- Set laminar and eddy viscosity at the infinity ---*/ // -// V_inflow[nDim+5] = node[iPoint]->GetLaminarViscosity(); -// V_inflow[nDim+6] = node[iPoint]->GetEddyViscosity(); +// V_inflow[nDim+5] = nodes->GetLaminarViscosity(iPoint); +// V_inflow[nDim+6] = nodes->GetEddyViscosity(iPoint); // // /*--- Set the normal vector and the coordinates ---*/ // @@ -11236,12 +11194,12 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai // /*--- Primitive variables, and gradient ---*/ // // visc_numerics->SetPrimitive(V_domain, V_inflow); -// visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); +// visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); // // /*--- Turbulent kinetic energy ---*/ // // if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) -// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); +// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); // // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ // @@ -11338,7 +11296,7 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta /*--- Current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Subsonic inflow: there is one outgoing characteristic (u-c), therefore we can specify all but one state variable at the inlet. @@ -11478,8 +11436,8 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta // // /*--- Set laminar and eddy viscosity at the infinity ---*/ // -// V_exhaust[nDim+5] = node[iPoint]->GetLaminarViscosity(); -// V_exhaust[nDim+6] = node[iPoint]->GetEddyViscosity(); +// V_exhaust[nDim+5] = nodes->GetLaminarViscosity(iPoint); +// V_exhaust[nDim+6] = nodes->GetEddyViscosity(iPoint); // // /*--- Set the normal vector and the coordinates ---*/ // @@ -11489,12 +11447,12 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta // /*--- Primitive variables, and gradient ---*/ // // visc_numerics->SetPrimitive(V_domain, V_exhaust); -// visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); +// visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); // // /*--- Turbulent kinetic energy ---*/ // // if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) -// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); +// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); // // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ // @@ -11519,7 +11477,6 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta } - void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config) { @@ -11560,7 +11517,7 @@ void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_cont Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor(); for (iVar = 0; iVar < nPrimVar; iVar++) { - PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = nodes->GetPrimitive(iPoint,iVar); PrimVar_j[iVar] = GetSlidingState(iMarker, iVertex, iVar, jVertex); } @@ -11573,7 +11530,7 @@ void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_cont conv_numerics->SetPrimitive( PrimVar_i, PrimVar_j ); if( !( config->GetKind_FluidModel() == STANDARD_AIR || config->GetKind_FluidModel() == IDEAL_GAS ) ) { - Secondary_i = node[iPoint]->GetSecondary(); + Secondary_i = nodes->GetSecondary(iPoint); P_static = PrimVar_j[nDim+1]; rho_static = PrimVar_j[nDim+2]; @@ -11638,12 +11595,12 @@ void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_cont /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(PrimVar_i, PrimVar_j); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ @@ -11706,7 +11663,7 @@ void CEulerSolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_c /*--- Store the solution for both points ---*/ for (iVar = 0; iVar < nPrimVar; iVar++) { - PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = nodes->GetPrimitive(iPoint,iVar); PrimVar_j[iVar] = GetDonorPrimVar(val_marker, iVertex, iVar); } @@ -11767,7 +11724,7 @@ void CEulerSolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_c /*--- Store the solution for both points ---*/ for (iVar = 0; iVar < nPrimVar; iVar++) { - PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = nodes->GetPrimitive(iPoint,iVar); PrimVar_j[iVar] = GetDonorPrimVar(val_marker, iVertex, iVar); } @@ -11872,12 +11829,12 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C /*--- Current solution at this boundary node and jumps values ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); Target_Press_Jump = GetActDisk_DeltaP(val_marker, iVertex); Target_Temp_Jump = GetActDisk_DeltaT(val_marker, iVertex); if (val_inlet_surface) { - V_inlet = node[iPoint]->GetPrimitive(); + V_inlet = nodes->GetPrimitive(iPoint); V_outlet = GetDonorPrimVar(val_marker, iVertex); Pressure_out = V_outlet[nDim+1]; @@ -11914,7 +11871,7 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C else { P_static = V_outlet[nDim+1] - Target_Press_Jump; T_static = V_outlet[0] - Target_Temp_Jump; } } else { - V_outlet = node[iPoint]->GetPrimitive(); + V_outlet = nodes->GetPrimitive(iPoint); V_inlet = GetDonorPrimVar(val_marker, iVertex); Pressure_out = V_outlet[nDim+1]; @@ -12177,12 +12134,12 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C // /*--- Set laminar and eddy viscosity at the infinity ---*/ // // if (val_inlet_surface) { -// V_inlet[nDim+5] = node[iPoint]->GetLaminarViscosity(); -// V_inlet[nDim+6] = node[iPoint]->GetEddyViscosity(); +// V_inlet[nDim+5] = nodes->GetLaminarViscosity(iPoint); +// V_inlet[nDim+6] = nodes->GetEddyViscosity(iPoint); // } // else { -// V_outlet[nDim+5] = node[iPoint]->GetLaminarViscosity(); -// V_outlet[nDim+6] = node[iPoint]->GetEddyViscosity(); +// V_outlet[nDim+5] = nodes->GetLaminarViscosity(iPoint); +// V_outlet[nDim+6] = nodes->GetEddyViscosity(iPoint); // } // // /*--- Set the normal vector and the coordinates ---*/ @@ -12195,12 +12152,12 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C // if (val_inlet_surface) visc_numerics->SetPrimitive(V_domain, V_inlet); // else visc_numerics->SetPrimitive(V_domain, V_outlet); // -// visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); +// visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); // // /*--- Turbulent kinetic energy ---*/ // // if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) -// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); +// visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); // // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ // @@ -12292,9 +12249,9 @@ void CEulerSolver::BC_Custom(CGeometry *geometry, condition by setting the solution values at the boundary nodes directly and setting the residual to zero at those nodes. ---*/ - node[iPoint]->SetSolution_Old(Solution); - node[iPoint]->SetSolution(Solution); - node[iPoint]->SetRes_TruncErrorZero(); + nodes->SetSolution_Old(iPoint,Solution); + nodes->SetSolution(iPoint,Solution); + nodes->SetRes_TruncErrorZero(iPoint); LinSysRes.SetBlock_Zero(iPoint); /*--- Adjust rows of the Jacobian (includes 1 in the diagonal) ---*/ @@ -12348,9 +12305,9 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, previous solutions that are stored in memory. ---*/ - U_time_nM1 = node[iPoint]->GetSolution_time_n1(); - U_time_n = node[iPoint]->GetSolution_time_n(); - U_time_nP1 = node[iPoint]->GetSolution(); + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); /*--- CV volume at time n+1. As we are on a static mesh, the volume of the CV will remained fixed for all time steps. ---*/ @@ -12418,14 +12375,14 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co /*--- Compute the GCL component of the source term for node i ---*/ - U_time_n = node[iPoint]->GetSolution_time_n(); + U_time_n = nodes->GetSolution_time_n(iPoint); for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = U_time_n[iVar]*Residual_GCL; LinSysRes.AddBlock(iPoint, Residual); /*--- Compute the GCL component of the source term for node j ---*/ - U_time_n = node[jPoint]->GetSolution_time_n(); + U_time_n = nodes->GetSolution_time_n(jPoint); for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = U_time_n[iVar]*Residual_GCL; LinSysRes.SubtractBlock(jPoint, Residual); @@ -12457,7 +12414,7 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co /*--- Compute the GCL component of the source term for node i ---*/ - U_time_n = node[iPoint]->GetSolution_time_n(); + U_time_n = nodes->GetSolution_time_n(iPoint); for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = U_time_n[iVar]*Residual_GCL; LinSysRes.AddBlock(iPoint, Residual); @@ -12475,9 +12432,9 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, previous solutions that are stored in memory. ---*/ - U_time_nM1 = node[iPoint]->GetSolution_time_n1(); - U_time_n = node[iPoint]->GetSolution_time_n(); - U_time_nP1 = node[iPoint]->GetSolution(); + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); /*--- CV volume at time n-1 and n+1. In the case of dynamically deforming grids, the volumes will change. On rigidly transforming grids, the @@ -12516,7 +12473,6 @@ void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_co } - void CEulerSolver::ComputeVerificationError(CGeometry *geometry, CConfig *config) { @@ -12554,7 +12510,7 @@ void CEulerSolver::ComputeVerificationError(CGeometry *geometry, /* Set the pointers to the coordinates and solution of this DOF. */ const su2double *coor = geometry->node[iPoint]->GetCoord(); - su2double *solDOF = node[iPoint]->GetSolution(); + su2double *solDOF = nodes->GetSolution(iPoint); /* Get local error from the verification solution class. */ vector error(nVar,0.0); @@ -12678,7 +12634,7 @@ void CEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig index = counter*Restart_Vars[1] + skipVars; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); iPoint_Global_Local++; /*--- For dynamic meshes, read in and store the @@ -12757,12 +12713,12 @@ void CEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver[iMesh-1][FLOW_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(Solution); + solver[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); @@ -12854,11 +12810,11 @@ void CEulerSolver::SetFreeStream_Solution(CConfig *config) { unsigned short iDim; for (iPoint = 0; iPoint < nPoint; iPoint++) { - node[iPoint]->SetSolution(0, Density_Inf); + nodes->SetSolution(iPoint,0, Density_Inf); for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->SetSolution(iDim+1, Density_Inf*Velocity_Inf[iDim]); + nodes->SetSolution(iPoint,iDim+1, Density_Inf*Velocity_Inf[iDim]); } - node[iPoint]->SetSolution(nVar-1, Density_Inf*Energy_Inf); + nodes->SetSolution(iPoint,nVar-1, Density_Inf*Energy_Inf); } } @@ -12893,14 +12849,14 @@ void CEulerSolver::SetFreeStream_TurboSolution(CConfig *config) { ComputeBackVelocity(turboVelocity, turboNormal, cartVelocity, INFLOW, config->GetKind_TurboMachinery(iZone)); for (iPoint = 0; iPoint < nPoint; iPoint++) { - node[iPoint]->SetSolution(0, Density_Inf); + nodes->SetSolution(iPoint,0, Density_Inf); for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->SetSolution(iDim+1, Density_Inf*cartVelocity[iDim]); + nodes->SetSolution(iPoint,iDim+1, Density_Inf*cartVelocity[iDim]); } - node[iPoint]->SetSolution(nVar-1, Density_Inf*Energy_Inf); + nodes->SetSolution(iPoint,nVar-1, Density_Inf*Energy_Inf); - node[iPoint]->SetPrimVar(FluidModel); - node[iPoint]->SetSecondaryVar(FluidModel); + nodes->SetPrimVar(iPoint,FluidModel); + nodes->SetSecondaryVar(iPoint,FluidModel); } delete [] turboVelocity; @@ -12956,8 +12912,8 @@ void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CCon if (geometry->node[iPoint]->GetDomain()){ /*--- Compute the integral fluxes for the boundaries ---*/ - Pressure = node[iPoint]->GetPressure(); - Density = node[iPoint]->GetDensity(); + Pressure = nodes->GetPressure(iPoint); + Density = nodes->GetDensity(iPoint); /*--- Normal vector for this vertex (negate for outward convention) ---*/ geometry->turbovertex[iMarker][iSpan][iVertex]->GetNormal(UnitNormal); @@ -12966,7 +12922,7 @@ void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CCon VelSq = 0.0; for (iDim = 0; iDim < nDim; iDim++) { - Velocity[iDim] = node[iPoint]->GetPrimitive(iDim+1); + Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); VelSq += Velocity[iDim]*Velocity[iDim]; } @@ -13177,9 +13133,9 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC iPoint = geometry->turbovertex[iMarker][iSpan][iVertex]->GetNode(); /*--- Compute the integral fluxes for the boundaries ---*/ - Pressure = node[iPoint]->GetPressure(); - Density = node[iPoint]->GetDensity(); - Enthalpy = node[iPoint]->GetEnthalpy(); + Pressure = nodes->GetPressure(iPoint); + Density = nodes->GetDensity(iPoint); + Enthalpy = nodes->GetEnthalpy(iPoint); /*--- Normal vector for this vertex (negate for outward convention) ---*/ geometry->turbovertex[iMarker][iSpan][iVertex]->GetNormal(UnitNormal); @@ -13188,7 +13144,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC su2double VelNormal = 0.0, VelSq = 0.0; for (iDim = 0; iDim < nDim; iDim++) { - Velocity[iDim] = node[iPoint]->GetPrimitive(iDim+1); + Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); VelNormal += UnitNormal[iDim]*Velocity[iDim]; VelSq += Velocity[iDim]*Velocity[iDim]; } @@ -13223,11 +13179,11 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC if(turbulent){ if(menter_sst){ - Kine = solver[TURB_SOL]->node[iPoint]->GetSolution(0); - Omega = solver[TURB_SOL]->node[iPoint]->GetSolution(1); + Kine = solver[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); + Omega = solver[TURB_SOL]->GetNodes()->GetSolution(iPoint,1); } if(spalart_allmaras){ - Nu = solver[TURB_SOL]->node[iPoint]->GetSolution(0); + Nu = solver[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); } TotalKine += Kine; @@ -13252,9 +13208,9 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC iPoint = geometry->turbovertex[iMarker][jSpan][iVertex]->GetNode(); /*--- Compute the integral fluxes for the boundaries ---*/ - Pressure = node[iPoint]->GetPressure(); - Density = node[iPoint]->GetDensity(); - Enthalpy = node[iPoint]->GetEnthalpy(); + Pressure = nodes->GetPressure(iPoint); + Density = nodes->GetDensity(iPoint); + Enthalpy = nodes->GetEnthalpy(iPoint); /*--- Normal vector for this vertex (negate for outward convention) ---*/ geometry->turbovertex[iMarker][jSpan][iVertex]->GetNormal(UnitNormal); @@ -13263,7 +13219,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC su2double VelNormal = 0.0, VelSq = 0.0; for (iDim = 0; iDim < nDim; iDim++) { - Velocity[iDim] = node[iPoint]->GetPrimitive(iDim+1); + Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); VelNormal += UnitNormal[iDim]*Velocity[iDim]; VelSq += Velocity[iDim]*Velocity[iDim]; } @@ -13298,11 +13254,11 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC if(turbulent){ if(menter_sst){ - Kine = solver[TURB_SOL]->node[iPoint]->GetSolution(0); - Omega = solver[TURB_SOL]->node[iPoint]->GetSolution(1); + Kine = solver[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); + Omega = solver[TURB_SOL]->GetNodes()->GetSolution(iPoint,1); } if(spalart_allmaras){ - Nu = solver[TURB_SOL]->node[iPoint]->GetSolution(0); + Nu = solver[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); } TotalKine += Kine; @@ -14174,9 +14130,6 @@ CNSSolver::CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) SetVerificationSolution(nDim, nVar, config); - /*--- Allocate the node variables ---*/ - node = new CVariable*[nPoint]; - /*--- Define some auxiliar vector related with the residual ---*/ Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; @@ -14708,8 +14661,8 @@ CNSSolver::CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) /*--- Initialize the solution to the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CNSVariable(Density_Inf, Velocity_Inf, Energy_Inf, nDim, nVar, config); + nodes = new CNSVariable(Density_Inf, Velocity_Inf, Energy_Inf, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); /*--- Check that the initial solution is physical, report any non-physical nodes ---*/ @@ -14717,13 +14670,13 @@ CNSSolver::CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) for (iPoint = 0; iPoint < nPoint; iPoint++) { - Density = node[iPoint]->GetSolution(0); + Density = nodes->GetDensity(iPoint); Velocity2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) - Velocity2 += (node[iPoint]->GetSolution(iDim+1)/Density)*(node[iPoint]->GetSolution(iDim+1)/Density); + Velocity2 += pow(nodes->GetSolution(iPoint,iDim+1)/Density,2); - StaticEnergy= node[iPoint]->GetSolution(nDim+1)/Density - 0.5*Velocity2; + StaticEnergy= nodes->GetEnergy(iPoint) - 0.5*Velocity2; FluidModel->SetTDState_rhoe(Density, StaticEnergy); Pressure= FluidModel->GetPressure(); @@ -14736,8 +14689,8 @@ CNSSolver::CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) for (iDim = 0; iDim < nDim; iDim++) Solution[iDim+1] = Velocity_Inf[iDim]*Density_Inf; Solution[nDim+1] = Energy_Inf*Density_Inf; - node[iPoint]->SetSolution(Solution); - node[iPoint]->SetSolution_Old(Solution); + nodes->SetSolution(iPoint,Solution); + nodes->SetSolution_Old(iPoint,Solution); counter_local++; } @@ -14958,14 +14911,13 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C /*--- Evaluate the vorticity and strain rate magnitude ---*/ + solver_container[FLOW_SOL]->GetNodes()->SetVorticity_StrainMag(); + StrainMag_Max = 0.0; Omega_Max = 0.0; for (iPoint = 0; iPoint < nPoint; iPoint++) { - solver_container[FLOW_SOL]->node[iPoint]->SetVorticity(); - solver_container[FLOW_SOL]->node[iPoint]->SetStrainMag(); - - StrainMag = solver_container[FLOW_SOL]->node[iPoint]->GetStrainMag(); - Vorticity = solver_container[FLOW_SOL]->node[iPoint]->GetVorticity(); + StrainMag = solver_container[FLOW_SOL]->GetNodes()->GetStrainMag(iPoint); + Vorticity = solver_container[FLOW_SOL]->GetNodes()->GetVorticity(iPoint); Omega = sqrt(Vorticity[0]*Vorticity[0]+ Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); StrainMag_Max = max(StrainMag_Max, StrainMag); @@ -15020,28 +14972,28 @@ unsigned long CNSSolver::SetPrimitive_Variables(CSolver **solver_container, CCon /*--- Retrieve the value of the kinetic energy (if need it) ---*/ if (turb_model != NONE) { - eddy_visc = solver_container[TURB_SOL]->node[iPoint]->GetmuT(); - if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0); + eddy_visc = solver_container[TURB_SOL]->GetNodes()->GetmuT(iPoint); + if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ - DES_LengthScale = solver_container[TURB_SOL]->node[iPoint]->GetDES_LengthScale(); + DES_LengthScale = solver_container[TURB_SOL]->GetNodes()->GetDES_LengthScale(iPoint); } } /*--- Initialize the non-physical points vector ---*/ - node[iPoint]->SetNon_Physical(false); + nodes->SetNon_Physical(iPoint,false); /*--- Compressible flow, primitive variables nDim+5, (T, vx, vy, vz, P, rho, h, c, lamMu, eddyMu, ThCond, Cp) ---*/ - RightSol = node[iPoint]->SetPrimVar(eddy_visc, turb_ke, FluidModel); - node[iPoint]->SetSecondaryVar(FluidModel); + RightSol = static_cast(nodes)->SetPrimVar(iPoint,eddy_visc, turb_ke, FluidModel); + nodes->SetSecondaryVar(iPoint,FluidModel); - if (!RightSol) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; } + if (!RightSol) { nodes->SetNon_Physical(iPoint,true); ErrorCounter++; } /*--- Set the DES length scale ---*/ - node[iPoint]->SetDES_LengthScale(DES_LengthScale); + nodes->SetDES_LengthScale(iPoint,DES_LengthScale); /*--- Initialize the convective, source and viscous residual vector ---*/ @@ -15069,8 +15021,8 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed and viscosity ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->SetMax_Lambda_Inv(0.0); - node[iPoint]->SetMax_Lambda_Visc(0.0); + nodes->SetMax_Lambda_Inv(iPoint,0.0); + nodes->SetMax_Lambda_Visc(iPoint,0.0); } /*--- Loop interior edges ---*/ @@ -15087,8 +15039,8 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC /*--- Mean Values ---*/ - Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal)); - Mean_SoundSpeed = 0.5 * (node[iPoint]->GetSoundSpeed() + node[jPoint]->GetSoundSpeed()) * Area; + Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + Mean_SoundSpeed = 0.5 * (nodes->GetSoundSpeed(iPoint) + nodes->GetSoundSpeed(jPoint)) * Area; /*--- Adjustment for grid movement ---*/ @@ -15106,22 +15058,22 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC /*--- Inviscid contribution ---*/ Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed ; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Inv(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint,Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint,Lambda); /*--- Viscous contribution ---*/ - Mean_LaminarVisc = 0.5*(node[iPoint]->GetLaminarViscosity() + node[jPoint]->GetLaminarViscosity()); - Mean_EddyVisc = 0.5*(node[iPoint]->GetEddyViscosity() + node[jPoint]->GetEddyViscosity()); - Mean_Density = 0.5*(node[iPoint]->GetSolution(0) + node[jPoint]->GetSolution(0)); + Mean_LaminarVisc = 0.5*(nodes->GetLaminarViscosity(iPoint) + nodes->GetLaminarViscosity(jPoint)); + Mean_EddyVisc = 0.5*(nodes->GetEddyViscosity(iPoint) + nodes->GetEddyViscosity(jPoint)); + Mean_Density = 0.5*(nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); //TODO (REAL_GAS) removing Gamma it cannot work with FLUIDPROP Lambda_2 = (1.0 + (Prandtl_Lam/Prandtl_Turb)*(Mean_EddyVisc/Mean_LaminarVisc))*(Gamma*Mean_LaminarVisc/Prandtl_Lam); Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Visc(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(jPoint, Lambda); } @@ -15140,8 +15092,8 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC /*--- Mean Values ---*/ - Mean_ProjVel = node[iPoint]->GetProjVel(Normal); - Mean_SoundSpeed = node[iPoint]->GetSoundSpeed() * Area; + Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); + Mean_SoundSpeed = nodes->GetSoundSpeed(iPoint) * Area; /*--- Adjustment for grid movement ---*/ @@ -15157,20 +15109,20 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; if (geometry->node[iPoint]->GetDomain()) { - node[iPoint]->AddMax_Lambda_Inv(Lambda); + nodes->AddMax_Lambda_Inv(iPoint,Lambda); } /*--- Viscous contribution ---*/ - Mean_LaminarVisc = node[iPoint]->GetLaminarViscosity(); - Mean_EddyVisc = node[iPoint]->GetEddyViscosity(); - Mean_Density = node[iPoint]->GetSolution(0); + Mean_LaminarVisc = nodes->GetLaminarViscosity(iPoint); + Mean_EddyVisc = nodes->GetEddyViscosity(iPoint); + Mean_Density = nodes->GetDensity(iPoint); Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); Lambda_2 = (1.0 + (Prandtl_Lam/Prandtl_Turb)*(Mean_EddyVisc/Mean_LaminarVisc))*(Gamma*Mean_LaminarVisc/Prandtl_Lam); Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint, Lambda); } } @@ -15184,18 +15136,18 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC Vol = geometry->node[iPoint]->GetVolume(); if (Vol != 0.0) { - Local_Delta_Time = config->GetCFL(iMesh)*Vol / node[iPoint]->GetMax_Lambda_Inv(); - Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ node[iPoint]->GetMax_Lambda_Visc(); + Local_Delta_Time = config->GetCFL(iMesh)*Vol / nodes->GetMax_Lambda_Inv(iPoint); + Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); Local_Delta_Time = min(Local_Delta_Time, Local_Delta_Time_Visc); Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time); Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time); Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time); if (Local_Delta_Time > config->GetMax_DeltaTime()) Local_Delta_Time = config->GetMax_DeltaTime(); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } else { - node[iPoint]->SetDelta_Time(0.0); + nodes->SetDelta_Time(iPoint,0.0); } } @@ -15227,7 +15179,7 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC Global_Delta_Time = rbuf_time; #endif for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetDelta_Time(Global_Delta_Time); + nodes->SetDelta_Time(iPoint,Global_Delta_Time); config->SetDelta_UnstTimeND(Global_Delta_Time); } @@ -15251,8 +15203,8 @@ void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CC if (dual_time) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { if (!implicit) { - Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), node[iPoint]->GetDelta_Time()); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } } @@ -15276,22 +15228,22 @@ void CNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_container /*--- Primitive and secondary variables ---*/ - numerics->SetPrimitive(node[iPoint]->GetPrimitive(), node[jPoint]->GetPrimitive()); - numerics->SetSecondary(node[iPoint]->GetSecondary(), node[jPoint]->GetSecondary()); + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), nodes->GetPrimitive(jPoint)); + numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(jPoint)); /*--- Gradient and limiters ---*/ - numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[jPoint]->GetGradient_Primitive()); + numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(jPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[jPoint]->GetSolution(0)); + numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(jPoint,0)); /*--- Wall shear stress values (wall functions) ---*/ - numerics->SetTauWall(node[iPoint]->GetTauWall(), node[iPoint]->GetTauWall()); + numerics->SetTauWall(nodes->GetTauWall(iPoint), nodes->GetTauWall(iPoint)); /*--- Compute and update residual ---*/ @@ -15433,13 +15385,13 @@ void CNSSolver::Friction_Forces(CGeometry *geometry, CConfig *config) { for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint,iDim+1, jDim); } - Grad_Temp[iDim] = node[iPoint]->GetGradient_Primitive(0, iDim); + Grad_Temp[iDim] = nodes->GetGradient_Primitive(iPoint,0, iDim); } - Viscosity = node[iPoint]->GetLaminarViscosity(); - Density = node[iPoint]->GetDensity(); + Viscosity = nodes->GetLaminarViscosity(iPoint); + Density = nodes->GetDensity(iPoint); Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area); @@ -16021,11 +15973,11 @@ void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container condition (Dirichlet). Fix the velocity and remove any contribution to the residual at this node. ---*/ - node[iPoint]->SetVelocity_Old(Vector); + nodes->SetVelocity_Old(iPoint,Vector); for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); /*--- Apply a weak boundary condition for the energy equation. Compute the residual due to the prescribed heat flux. ---*/ @@ -16046,15 +15998,15 @@ void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container /*--- Retrieve other primitive quantities and viscosities ---*/ - Density = node[iPoint]->GetSolution(0); - Pressure = node[iPoint]->GetPressure(); - laminar_viscosity = node[iPoint]->GetLaminarViscosity(); - eddy_viscosity = node[iPoint]->GetEddyViscosity(); + Density = nodes->GetDensity(iPoint); + Pressure = nodes->GetPressure(iPoint); + laminar_viscosity = nodes->GetLaminarViscosity(iPoint); + eddy_viscosity = nodes->GetEddyViscosity(iPoint); total_viscosity = laminar_viscosity + eddy_viscosity; for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint,iDim+1, jDim); } } @@ -16285,25 +16237,25 @@ void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_contain /*--- Set the residual, truncation error and velocity value on the boundary ---*/ - node[iPoint]->SetVelocity_Old(Vector); + nodes->SetVelocity_Old(iPoint,Vector); for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); /*--- Compute the normal gradient in temperature using Twall ---*/ - dTdn = -(node[Point_Normal]->GetPrimitive(0) - Twall)/dist_ij; + dTdn = -(nodes->GetTemperature(Point_Normal) - Twall)/dist_ij; /*--- Get transport coefficients ---*/ - laminar_viscosity = node[iPoint]->GetLaminarViscosity(); - eddy_viscosity = node[iPoint]->GetEddyViscosity(); + laminar_viscosity = nodes->GetLaminarViscosity(iPoint); + eddy_viscosity = nodes->GetEddyViscosity(iPoint); thermal_conductivity = Cp * ( laminar_viscosity/Prandtl_Lam + eddy_viscosity/Prandtl_Turb); // work in progress on real-gases... - //thermal_conductivity = node[iPoint]->GetThermalConductivity(); - //Cp = node[iPoint]->GetSpecificHeatCp(); + //thermal_conductivity = nodes->GetThermalConductivity(iPoint); + //Cp = nodes->GetSpecificHeatCp(iPoint); //thermal_conductivity += Cp*eddy_viscosity/Prandtl_Turb; /*--- Apply a weak boundary condition for the energy equation. @@ -16321,10 +16273,10 @@ void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_contain /*--- Calculate useful quantities ---*/ - Density = node[iPoint]->GetPrimitive(nDim+2); + Density = nodes->GetDensity(iPoint); Vel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) - Vel2 += node[iPoint]->GetPrimitive(iDim+1) * node[iPoint]->GetPrimitive(iDim+1); + Vel2 += pow(nodes->GetVelocity(iPoint,iDim),2); dTdrho = 1.0/Density * ( -Twall + (Gamma-1.0)/Gas_Constant*(Vel2/2.0) ); /*--- Enforce the no-slip boundary condition in a strong way ---*/ @@ -16359,16 +16311,16 @@ void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_contain /*--- Retrieve other primitive quantities and viscosities ---*/ - Density = node[iPoint]->GetSolution(0); - Pressure = node[iPoint]->GetPressure(); - laminar_viscosity = node[iPoint]->GetLaminarViscosity(); - eddy_viscosity = node[iPoint]->GetEddyViscosity(); + Density = nodes->GetDensity(iPoint); + Pressure = nodes->GetPressure(iPoint); + laminar_viscosity = nodes->GetLaminarViscosity(iPoint); + eddy_viscosity = nodes->GetEddyViscosity(iPoint); total_viscosity = laminar_viscosity + eddy_viscosity; for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint,iDim+1, jDim); } } @@ -16501,13 +16453,13 @@ void CNSSolver::SetRoe_Dissipation(CGeometry *geometry, CConfig *config){ wall_distance = geometry->node[iPoint]->GetWall_Distance(); - node[iPoint]->SetRoe_Dissipation_FD(wall_distance); + nodes->SetRoe_Dissipation_FD(iPoint,wall_distance); } else if (kind_roe_dissipation == NTS || kind_roe_dissipation == NTS_DUCROS) { const su2double delta = geometry->node[iPoint]->GetMaxLength(); assert(delta > 0); // Delta must be initialized and non-negative - node[iPoint]->SetRoe_Dissipation_NTS(delta, config->GetConst_DES()); + nodes->SetRoe_Dissipation_NTS(iPoint,delta, config->GetConst_DES()); } } } @@ -16599,26 +16551,26 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver /*--- Set the residual, truncation error and velocity value on the boundary ---*/ - node[iPoint]->SetVelocity_Old(Vector); + nodes->SetVelocity_Old(iPoint,Vector); for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); /*--- Get transport coefficients ---*/ - laminar_viscosity = node[iPoint]->GetLaminarViscosity(); - eddy_viscosity = node[iPoint]->GetEddyViscosity(); + laminar_viscosity = nodes->GetLaminarViscosity(iPoint); + eddy_viscosity = nodes->GetEddyViscosity(iPoint); thermal_conductivity = Cp * ( laminar_viscosity/Prandtl_Lam + eddy_viscosity/Prandtl_Turb); // work in progress on real-gases... - //thermal_conductivity = node[iPoint]->GetThermalConductivity(); - //Cp = node[iPoint]->GetSpecificHeatCp(); + //thermal_conductivity = nodes->GetThermalConductivity(iPoint); + //Cp = nodes->GetSpecificHeatCp(iPoint); //thermal_conductivity += Cp*eddy_viscosity/Prandtl_Turb; /*--- Compute the normal gradient in temperature using Twall ---*/ - There = node[Point_Normal]->GetPrimitive(0); + There = nodes->GetTemperature(Point_Normal); Tconjugate = GetConjugateHeatVariable(val_marker, iVertex, 0); HF_FactorHere = thermal_conductivity*config->GetViscosity_Ref()/dist_ij; @@ -16629,7 +16581,7 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver // this will be changed soon... Twall = GetConjugateHeatVariable(val_marker, iVertex, 0); - dTdn = -(node[Point_Normal]->GetPrimitive(0) - Twall)/dist_ij; + dTdn = -(There - Twall)/dist_ij; /*--- Apply a weak boundary condition for the energy equation. Compute the residual due to the prescribed heat flux. ---*/ @@ -16646,10 +16598,10 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver /*--- Calculate useful quantities ---*/ - Density = node[iPoint]->GetPrimitive(nDim+2); + Density = nodes->GetDensity(iPoint); Vel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) - Vel2 += node[iPoint]->GetPrimitive(iDim+1) * node[iPoint]->GetPrimitive(iDim+1); + Vel2 += pow(nodes->GetVelocity(iPoint,iDim),2); dTdrho = 1.0/Density * ( -Twall + (Gamma-1.0)/Gas_Constant*(Vel2/2.0) ); /*--- Enforce the no-slip boundary condition in a strong way ---*/ @@ -16684,16 +16636,16 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver /*--- Retrieve other primitive quantities and viscosities ---*/ - Density = node[iPoint]->GetSolution(0); - Pressure = node[iPoint]->GetPressure(); - laminar_viscosity = node[iPoint]->GetLaminarViscosity(); - eddy_viscosity = node[iPoint]->GetEddyViscosity(); + Density = nodes->GetDensity(iPoint); + Pressure = nodes->GetPressure(iPoint); + laminar_viscosity = nodes->GetLaminarViscosity(iPoint); + eddy_viscosity = nodes->GetEddyViscosity(iPoint); total_viscosity = laminar_viscosity + eddy_viscosity; for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint,iDim+1, jDim); } } @@ -16821,7 +16773,7 @@ void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, C su2double Area, div_vel, UnitNormal[3], *Normal; su2double **grad_primvar, tau[3][3]; - su2double Vel[3], VelNormal, VelTang[3], VelTangMod, VelInfMod, WallDist[3], WallDistMod; + su2double Vel[3] = {0.0, 0.0, 0.0}, VelNormal, VelTang[3], VelTangMod, VelInfMod, WallDist[3], WallDistMod; su2double T_Normal, P_Normal; su2double Density_Wall, T_Wall, P_Wall, Lam_Visc_Wall, Tau_Wall = 0.0, Tau_Wall_Old = 0.0; su2double *Coord, *Coord_Normal; @@ -16897,9 +16849,9 @@ void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, C (normal) interior point. ---*/ for (iDim = 0; iDim < nDim; iDim++) - Vel[iDim] = node[Point_Normal]->GetVelocity(iDim); - P_Normal = node[Point_Normal]->GetPressure(); - T_Normal = node[Point_Normal]->GetTemperature(); + Vel[iDim] = nodes->GetVelocity(Point_Normal,iDim); + P_Normal = nodes->GetPressure(Point_Normal); + T_Normal = nodes->GetTemperature(Point_Normal); /*--- Compute the wall-parallel velocity at first point off the wall ---*/ @@ -16942,8 +16894,8 @@ void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, C /*--- Compute the shear stress at the wall in the regular fashion by using the stress tensor on the surface ---*/ - Lam_Visc_Wall = node[iPoint]->GetLaminarViscosity(); - grad_primvar = node[iPoint]->GetGradient_Primitive(); + Lam_Visc_Wall = nodes->GetLaminarViscosity(iPoint); + grad_primvar = nodes->GetGradient_Primitive(iPoint); div_vel = 0.0; for (iDim = 0; iDim < nDim; iDim++) @@ -17031,7 +16983,7 @@ void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, C /*--- Store this value for the wall shear stress at the node. ---*/ - node[iPoint]->SetTauWall(Tau_Wall); + nodes->SetTauWall(iPoint,Tau_Wall); } diff --git a/SU2_CFD/src/solver_direct_mean_inc.cpp b/SU2_CFD/src/solver_direct_mean_inc.cpp index 5c5c87fbc815..773bd1957c4f 100644 --- a/SU2_CFD/src/solver_direct_mean_inc.cpp +++ b/SU2_CFD/src/solver_direct_mean_inc.cpp @@ -97,7 +97,8 @@ CIncEulerSolver::CIncEulerSolver(void) : CSolver() { SlidingState = NULL; SlidingStateNodes = NULL; - + + nodes = nullptr; } CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CSolver() { @@ -253,10 +254,6 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned SetVerificationSolution(nDim, nVar, config); - /*--- Allocate the node variables ---*/ - - node = new CVariable*[nPoint]; - /*--- Define some auxiliary vectors related to the residual ---*/ Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; @@ -578,8 +575,8 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned /*--- Initialize the solution to the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CIncEulerVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nDim, nVar, config); + nodes = new CIncEulerVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); /*--- Initialize the BGS residuals in FSI problems. ---*/ if (fsi || multizone){ @@ -813,6 +810,8 @@ CIncEulerSolver::~CIncEulerSolver(void) { if (Cauchy_Serie != NULL) delete [] Cauchy_Serie; if (FluidModel != NULL) delete FluidModel; + + if (nodes != nullptr) delete nodes; } void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMesh) { @@ -1426,7 +1425,7 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve /* Set the pointers to the coordinates and solution of this DOF. */ const su2double *coor = geometry[iMesh]->node[iPoint]->GetCoord(); - su2double *solDOF = solver_container[iMesh][FLOW_SOL]->node[iPoint]->GetSolution(); + su2double *solDOF = solver_container[iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint); /* Set the solution in this DOF to the initial condition provided by the verification solution class. This can be the exact solution, @@ -1449,12 +1448,12 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver_container[iMesh-1][FLOW_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver_container[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(Solution); + solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver_container[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); solver_container[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); @@ -1474,12 +1473,12 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver_container[iMesh-1][TURB_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver_container[iMesh-1][TURB_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar_Turb; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver_container[iMesh][TURB_SOL]->node[iPoint]->SetSolution(Solution); + solver_container[iMesh][TURB_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver_container[iMesh][TURB_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION_EDDY); solver_container[iMesh][TURB_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION_EDDY); @@ -1498,13 +1497,11 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve for a 1st-order restart or when simply intitializing to freestream. ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1(); - if (rans) { - solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n1(); - } + solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(); + if (rans) { + solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); + solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(); } } @@ -1522,11 +1519,9 @@ void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solve /*--- Push back this new solution to time level N. ---*/ for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n(); - if (rans) { - solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n(); - } + solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + if (rans) { + solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); } } } @@ -1624,15 +1619,15 @@ unsigned long CIncEulerSolver::SetPrimitive_Variables(CSolver **solver_container /*--- Initialize the non-physical points vector ---*/ - node[iPoint]->SetNon_Physical(false); + nodes->SetNon_Physical(iPoint,false); /*--- Incompressible flow, primitive variables ---*/ - physical = node[iPoint]->SetPrimVar(FluidModel); + physical = nodes->SetPrimVar(iPoint,FluidModel); /*--- Record any non-physical points. ---*/ - if (!physical) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; } + if (!physical) { nodes->SetNon_Physical(iPoint,true); ErrorCounter++; } /*--- Initialize the convective, source and viscous residual vector ---*/ @@ -1663,7 +1658,7 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetMax_Lambda_Inv(0.0); + nodes->SetMax_Lambda_Inv(iPoint,0.0); /*--- Loop interior edges ---*/ @@ -1682,8 +1677,8 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain /*--- Mean Values ---*/ - Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal)); - Mean_BetaInc2 = 0.5 * (node[iPoint]->GetBetaInc2() + node[jPoint]->GetBetaInc2()); + Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + Mean_BetaInc2 = 0.5 * (nodes->GetBetaInc2(iPoint) + nodes->GetBetaInc2(jPoint)); Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); /*--- Adjustment for grid movement ---*/ @@ -1702,8 +1697,8 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain /*--- Inviscid contribution ---*/ Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Inv(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint,Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint,Lambda); } @@ -1725,8 +1720,8 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain /*--- Mean Values ---*/ - Mean_ProjVel = node[iPoint]->GetProjVel(Normal); - Mean_BetaInc2 = node[iPoint]->GetBetaInc2(); + Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); + Mean_BetaInc2 = nodes->GetBetaInc2(iPoint); Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); /*--- Adjustment for grid movement ---*/ @@ -1743,7 +1738,7 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; if (geometry->node[iPoint]->GetDomain()) { - node[iPoint]->AddMax_Lambda_Inv(Lambda); + nodes->AddMax_Lambda_Inv(iPoint,Lambda); } } @@ -1758,16 +1753,16 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain Vol = geometry->node[iPoint]->GetVolume(); if (Vol != 0.0) { - Local_Delta_Time = config->GetCFL(iMesh)*Vol / node[iPoint]->GetMax_Lambda_Inv(); + Local_Delta_Time = config->GetCFL(iMesh)*Vol / nodes->GetMax_Lambda_Inv(iPoint); Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time); Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time); Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time); if (Local_Delta_Time > config->GetMax_DeltaTime()) Local_Delta_Time = config->GetMax_DeltaTime(); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } else { - node[iPoint]->SetDelta_Time(0.0); + nodes->SetDelta_Time(iPoint,0.0); } } @@ -1809,9 +1804,9 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain it computes the time step based on the unsteady CFL ---*/ if (config->GetCFL(iMesh) == 0.0){ - node[iPoint]->SetDelta_Time(config->GetDelta_UnstTime()); + nodes->SetDelta_Time(iPoint,config->GetDelta_UnstTime()); } else { - node[iPoint]->SetDelta_Time(Global_Delta_Time); + nodes->SetDelta_Time(iPoint,Global_Delta_Time); } } } @@ -1837,8 +1832,8 @@ void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contain if (dual_time) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { if (!implicit) { - Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), node[iPoint]->GetDelta_Time()); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } } @@ -1862,17 +1857,17 @@ void CIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co /*--- Set primitive variables w/o reconstruction ---*/ - numerics->SetPrimitive(node[iPoint]->GetPrimitive(), node[jPoint]->GetPrimitive()); + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), nodes->GetPrimitive(jPoint)); /*--- Set the largest convective eigenvalue ---*/ - numerics->SetLambda(node[iPoint]->GetLambda(), node[jPoint]->GetLambda()); + numerics->SetLambda(nodes->GetLambda(iPoint), nodes->GetLambda(jPoint)); /*--- Set undivided laplacian and pressure-based sensor ---*/ if (jst_scheme) { - numerics->SetUndivided_Laplacian(node[iPoint]->GetUndivided_Laplacian(), node[jPoint]->GetUndivided_Laplacian()); - numerics->SetSensor(node[iPoint]->GetSensor(), node[jPoint]->GetSensor()); + numerics->SetUndivided_Laplacian(nodes->GetUndivided_Laplacian(iPoint), nodes->GetUndivided_Laplacian(jPoint)); + numerics->SetSensor(nodes->GetSensor(iPoint), nodes->GetSensor(jPoint)); } /*--- Grid movement ---*/ @@ -1933,8 +1928,8 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Get primitive variables ---*/ - V_i = node[iPoint]->GetPrimitive(); V_j = node[jPoint]->GetPrimitive(); - S_i = node[iPoint]->GetSecondary(); S_j = node[jPoint]->GetSecondary(); + V_i = nodes->GetPrimitive(iPoint); V_j = nodes->GetPrimitive(jPoint); + S_i = nodes->GetSecondary(iPoint); S_j = nodes->GetSecondary(jPoint); /*--- High order reconstruction using MUSCL strategy ---*/ @@ -1945,16 +1940,16 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim)); } - Gradient_i = node[iPoint]->GetGradient_Primitive(); - Gradient_j = node[jPoint]->GetGradient_Primitive(); + Gradient_i = nodes->GetGradient_Primitive(iPoint); + Gradient_j = nodes->GetGradient_Primitive(jPoint); if (limiter) { - Limiter_i = node[iPoint]->GetLimiter_Primitive(); - Limiter_j = node[jPoint]->GetLimiter_Primitive(); + Limiter_i = nodes->GetLimiter_Primitive(iPoint); + Limiter_j = nodes->GetLimiter_Primitive(jPoint); } for (iVar = 0; iVar < nPrimVarGrad; iVar++) { Project_Grad_i = 0.0; Project_Grad_j = 0.0; - Non_Physical = node[iPoint]->GetNon_Physical()*node[jPoint]->GetNon_Physical(); + Non_Physical = nodes->GetNon_Physical(iPoint)*nodes->GetNon_Physical(jPoint); for (iDim = 0; iDim < nDim; iDim++) { Project_Grad_i += Vector_i[iDim]*Gradient_i[iVar][iDim]*Non_Physical; Project_Grad_j += Vector_j[iDim]*Gradient_j[iVar][iDim]*Non_Physical; @@ -2046,13 +2041,13 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Load the conservative variables ---*/ - numerics->SetConservative(node[iPoint]->GetSolution(), - node[iPoint]->GetSolution()); + numerics->SetConservative(nodes->GetSolution(iPoint), + nodes->GetSolution(iPoint)); /*--- Set incompressible density ---*/ - numerics->SetDensity(node[iPoint]->GetDensity(), - node[iPoint]->GetDensity()); + numerics->SetDensity(nodes->GetDensity(iPoint), + nodes->GetDensity(iPoint)); /*--- Load the volume of the dual mesh cell ---*/ @@ -2077,13 +2072,13 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Load the conservative variables ---*/ - numerics->SetConservative(node[iPoint]->GetSolution(), - node[iPoint]->GetSolution()); + numerics->SetConservative(nodes->GetSolution(iPoint), + nodes->GetSolution(iPoint)); /*--- Set incompressible density ---*/ - numerics->SetDensity(node[iPoint]->GetDensity(), - node[iPoint]->GetDensity()); + numerics->SetDensity(nodes->GetDensity(iPoint), + nodes->GetDensity(iPoint)); /*--- Load the volume of the dual mesh cell ---*/ @@ -2105,14 +2100,14 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Loop over all points ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - /*--- Load the primitive variables ---*/ - - numerics->SetPrimitive(node[iPoint]->GetPrimitive(), NULL); - + + /*--- Load the conservative variables ---*/ + + numerics->SetConservative(nodes->GetSolution(iPoint), NULL); + /*--- Set incompressible density ---*/ - numerics->SetDensity(node[iPoint]->GetDensity(), 0.0); + numerics->SetDensity(nodes->GetDensity(iPoint), 0.0); /*--- Load the volume of the dual mesh cell ---*/ @@ -2152,9 +2147,9 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont for (iPoint = 0; iPoint < nPoint; iPoint++) { yCoord = geometry->node[iPoint]->GetCoord(1); - yVelocity = node[iPoint]->GetVelocity(1); - Total_Viscosity = (node[iPoint]->GetLaminarViscosity() + - node[iPoint]->GetEddyViscosity()); + yVelocity = nodes->GetVelocity(iPoint,1); + Total_Viscosity = (nodes->GetLaminarViscosity(iPoint) + + nodes->GetEddyViscosity(iPoint)); if (yCoord > EPS) { AuxVar = Total_Viscosity*yVelocity/yCoord; @@ -2164,7 +2159,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Set the auxilairy variable for this node. ---*/ - node[iPoint]->SetAuxVar(AuxVar); + nodes->SetAuxVar(iPoint,AuxVar); } @@ -2185,12 +2180,12 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Conservative variables w/o reconstruction ---*/ - numerics->SetPrimitive(node[iPoint]->GetPrimitive(), NULL); + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), NULL); /*--- Set incompressible density ---*/ - numerics->SetDensity(node[iPoint]->GetDensity(), - node[iPoint]->GetDensity()); + numerics->SetDensity(nodes->GetDensity(iPoint), + nodes->GetDensity(iPoint)); /*--- Set control volume ---*/ @@ -2207,11 +2202,11 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Gradient of the primitive variables ---*/ - numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), NULL); + numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), NULL); /*--- Load the aux variable gradient that we already computed. ---*/ - numerics->SetAuxVarGrad(node[iPoint]->GetAuxVarGradient(), NULL); + numerics->SetAuxVarGrad(nodes->GetAuxVarGradient(iPoint), NULL); } @@ -2274,9 +2269,9 @@ void CIncEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_cont /* Next we describe how to get access to some important quanties for this method */ /* Access to all points in the current geometric mesh by saying: nPointDomain */ - /* Get the vector of conservative variables at some point iPoint = node[iPoint]->GetSolution() */ - /* Get the volume (or area in 2D) associated with iPoint = node[iPoint]->GetVolume() */ - /* Get the vector of geometric coordinates of point iPoint = node[iPoint]->GetCoord() */ + /* Get the vector of conservative variables at some point iPoint = nodes->GetSolution(iPoint) */ + /* Get the volume (or area in 2D) associated with iPoint = nodes->GetVolume(iPoint) */ + /* Get the vector of geometric coordinates of point iPoint = nodes->GetCoord(iPoint) */ } @@ -2291,7 +2286,7 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->SetLambda(0.0); + nodes->SetLambda(iPoint,0.0); } /*--- Loop interior edges ---*/ @@ -2310,8 +2305,8 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Mean Values ---*/ - Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal)); - Mean_BetaInc2 = 0.5 * (node[iPoint]->GetBetaInc2() + node[jPoint]->GetBetaInc2()); + Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + Mean_BetaInc2 = 0.5 * (nodes->GetBetaInc2(iPoint) + nodes->GetBetaInc2(jPoint)); Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); /*--- Adjustment for grid movement ---*/ @@ -2330,8 +2325,8 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Inviscid contribution ---*/ Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddLambda(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddLambda(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddLambda(iPoint,Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddLambda(jPoint,Lambda); } @@ -2352,8 +2347,8 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { /*--- Mean Values ---*/ - Mean_ProjVel = node[iPoint]->GetProjVel(Normal); - Mean_BetaInc2 = node[iPoint]->GetBetaInc2(); + Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); + Mean_BetaInc2 = nodes->GetBetaInc2(iPoint); Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); /*--- Adjustment for grid movement ---*/ @@ -2370,7 +2365,7 @@ void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; if (geometry->node[iPoint]->GetDomain()) { - node[iPoint]->AddLambda(Lambda); + nodes->AddLambda(iPoint,Lambda); } } @@ -2400,8 +2395,7 @@ void CIncEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi Diff = new su2double[nVar]; - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetUnd_LaplZero(); + nodes->SetUnd_LaplZero(); for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { @@ -2411,7 +2405,7 @@ void CIncEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi /*--- Solution differences ---*/ for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = node[iPoint]->GetSolution(iVar) - node[jPoint]->GetSolution(iVar); + Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar); boundary_i = geometry->node[iPoint]->GetPhysicalBoundary(); boundary_j = geometry->node[jPoint]->GetPhysicalBoundary(); @@ -2419,19 +2413,19 @@ void CIncEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *confi /*--- Both points inside the domain, or both in the boundary ---*/ if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff); } /*--- iPoint inside the domain, jPoint on the boundary ---*/ if (!boundary_i && boundary_j) - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff); + if (geometry->node[iPoint]->GetDomain()) nodes->SubtractUnd_Lapl(iPoint,Diff); /*--- jPoint inside the domain, iPoint on the boundary ---*/ if (boundary_i && !boundary_j) - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff); + if (geometry->node[jPoint]->GetDomain()) nodes->AddUnd_Lapl(jPoint,Diff); } @@ -2473,8 +2467,8 @@ void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi /*--- Get the pressure, or density for incompressible solvers ---*/ - Pressure_i = node[iPoint]->GetDensity(); - Pressure_j = node[jPoint]->GetDensity(); + Pressure_i = nodes->GetDensity(iPoint); + Pressure_j = nodes->GetDensity(jPoint); boundary_i = geometry->node[iPoint]->GetPhysicalBoundary(); boundary_j = geometry->node[jPoint]->GetPhysicalBoundary(); @@ -2523,7 +2517,7 @@ void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfi /*--- Set pressure switch for each point ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetSensor(fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); + nodes->SetSensor(iPoint,fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); /*--- MPI parallelization ---*/ @@ -2662,7 +2656,7 @@ void CIncEulerSolver::Pressure_Forces(CGeometry *geometry, CConfig *config) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - Pressure = node[iPoint]->GetPressure(); + Pressure = nodes->GetPressure(iPoint); CPressure[iMarker][iVertex] = (Pressure - RefPressure)*factor*RefArea; @@ -3044,7 +3038,7 @@ void CIncEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) { Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); Coord = geometry->node[iPoint]->GetCoord(); - Density = node[iPoint]->GetDensity(); + Density = nodes->GetDensity(iPoint); Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) @@ -3053,7 +3047,7 @@ void CIncEulerSolver::Momentum_Forces(CGeometry *geometry, CConfig *config) { MassFlow = 0.0; for (iDim = 0; iDim < nDim; iDim++) { - Velocity[iDim] = node[iPoint]->GetVelocity(iDim); + Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); MomentDist[iDim] = Coord[iDim] - Origin[iDim]; MassFlow -= Normal[iDim]*Velocity[iDim]*Density; } @@ -3321,9 +3315,9 @@ void CIncEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver for (iPoint = 0; iPoint < nPointDomain; iPoint++) { Vol = (geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume()); - Delta = node[iPoint]->GetDelta_Time() / Vol; + Delta = nodes->GetDelta_Time(iPoint) / Vol; - Res_TruncError = node[iPoint]->GetResTruncError(); + Res_TruncError = nodes->GetResTruncError(iPoint); Residual = LinSysRes.GetBlock(iPoint); if (!adjoint) { @@ -3332,7 +3326,7 @@ void CIncEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver Res = 0.0; for (jVar = 0; jVar < nVar; jVar ++ ) Res += Preconditioner[iVar][jVar]*(Residual[jVar] + Res_TruncError[jVar]); - node[iPoint]->AddSolution(iVar, -Res*Delta*RK_AlphaCoeff); + nodes->AddSolution(iPoint,iVar, -Res*Delta*RK_AlphaCoeff); AddRes_RMS(iVar, Res*Res); AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord()); } @@ -3372,9 +3366,9 @@ void CIncEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol for (iPoint = 0; iPoint < nPointDomain; iPoint++) { Vol = (geometry->node[iPoint]->GetVolume() + geometry->node[iPoint]->GetPeriodicVolume()); - Delta = node[iPoint]->GetDelta_Time() / Vol; + Delta = nodes->GetDelta_Time(iPoint) / Vol; - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); local_Residual = LinSysRes.GetBlock(iPoint); @@ -3384,7 +3378,7 @@ void CIncEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol Res = 0.0; for (jVar = 0; jVar < nVar; jVar ++ ) Res += Preconditioner[iVar][jVar]*(local_Residual[jVar] + local_Res_TruncError[jVar]); - node[iPoint]->AddSolution(iVar, -Res*Delta); + nodes->AddSolution(iPoint,iVar, -Res*Delta); AddRes_RMS(iVar, Res*Res); AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord()); } @@ -3427,7 +3421,7 @@ void CIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol /*--- Read the residual ---*/ - local_Res_TruncError = node[iPoint]->GetResTruncError(); + local_Res_TruncError = nodes->GetResTruncError(iPoint); /*--- Read the volume ---*/ @@ -3436,8 +3430,8 @@ void CIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol /*--- Apply the preconditioner and add to the diagonal. ---*/ - if (node[iPoint]->GetDelta_Time() != 0.0) { - Delta = Vol / node[iPoint]->GetDelta_Time(); + if (nodes->GetDelta_Time(iPoint) != 0.0) { + Delta = Vol / nodes->GetDelta_Time(iPoint); SetPreconditioner(config, iPoint); for (iVar = 0; iVar < nVar; iVar ++ ) { for (jVar = 0; jVar < nVar; jVar ++ ) { @@ -3493,7 +3487,7 @@ void CIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol if (!adjoint) { for (iPoint = 0; iPoint < nPointDomain; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->AddSolution(iVar, config->GetRelaxation_Factor_Flow()*LinSysSol[iPoint*nVar+iVar]); + nodes->AddSolution(iPoint,iVar, config->GetRelaxation_Factor_Flow()*LinSysSol[iPoint*nVar+iVar]); } } } @@ -3531,8 +3525,7 @@ void CIncEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *con PrimVar_j = new su2double [nPrimVarGrad]; /*--- Set Gradient_Primitive to zero ---*/ - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetGradient_PrimitiveZero(nPrimVarGrad); + nodes->SetGradient_PrimitiveZero(); /*--- Loop interior edges ---*/ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { @@ -3540,8 +3533,8 @@ void CIncEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *con jPoint = geometry->edge[iEdge]->GetNode(1); for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar); - PrimVar_j[iVar] = node[jPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = nodes->GetPrimitive(iPoint,iVar); + PrimVar_j[iVar] = nodes->GetPrimitive(jPoint,iVar); } Normal = geometry->edge[iEdge]->GetNormal(); @@ -3550,9 +3543,9 @@ void CIncEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *con for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = PrimVar_Average*Normal[iDim]; if (geometry->node[iPoint]->GetDomain()) - node[iPoint]->AddGradient_Primitive(iVar, iDim, Partial_Res); + nodes->AddGradient_Primitive(iPoint,iVar, iDim, Partial_Res); if (geometry->node[jPoint]->GetDomain()) - node[jPoint]->SubtractGradient_Primitive(iVar, iDim, Partial_Res); + nodes->SubtractGradient_Primitive(jPoint,iVar, iDim, Partial_Res); } } } @@ -3566,13 +3559,13 @@ void CIncEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *con if (geometry->node[iPoint]->GetDomain()) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) - PrimVar_Vertex[iVar] = node[iPoint]->GetPrimitive(iVar); + PrimVar_Vertex[iVar] = nodes->GetPrimitive(iPoint,iVar); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); for (iVar = 0; iVar < nPrimVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = PrimVar_Vertex[iVar]*Normal[iDim]; - node[iPoint]->SubtractGradient_Primitive(iVar, iDim, Partial_Res); + nodes->SubtractGradient_Primitive(iPoint,iVar, iDim, Partial_Res); } } } @@ -3596,8 +3589,8 @@ void CIncEulerSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *con for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - Partial_Gradient = node[iPoint]->GetGradient_Primitive(iVar, iDim)/Vol; - node[iPoint]->SetGradient_Primitive(iVar, iDim, Partial_Gradient); + Partial_Gradient = nodes->GetGradient_Primitive(iPoint,iVar, iDim)/Vol; + nodes->SetGradient_Primitive(iPoint,iVar, iDim, Partial_Gradient); } } } @@ -3622,6 +3615,12 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con su2double z11, z12, z13, z22, z23, z33, detR2; bool singular; + /*--- Clear Rmatrix, which could eventually be computed once + and stored for static meshes, as well as the prim gradient. ---*/ + + nodes->SetRmatrixZero(); + nodes->SetGradient_PrimitiveZero(); + /*--- Loop over points of the grid ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { @@ -3635,7 +3634,7 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con /*--- Get primitives from CVariable ---*/ - PrimVar_i = node[iPoint]->GetPrimitive(); + PrimVar_i = nodes->GetPrimitive(iPoint); /*--- Inizialization of variables ---*/ @@ -3646,9 +3645,6 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con /*--- Clear Rmatrix, which could eventually be computed once and stored for static meshes, as well as the prim gradient. ---*/ - node[iPoint]->SetRmatrixZero(); - node[iPoint]->SetGradient_PrimitiveZero(nPrimVarGrad); - AD::StartPreacc(); AD::SetPreaccIn(PrimVar_i, nPrimVarGrad); AD::SetPreaccIn(Coord_i, nDim); @@ -3657,7 +3653,7 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con jPoint = geometry->node[iPoint]->GetPoint(iNeigh); Coord_j = geometry->node[jPoint]->GetCoord(); - PrimVar_j = node[jPoint]->GetPrimitive(); + PrimVar_j = nodes->GetPrimitive(jPoint); AD::SetPreaccIn(Coord_j, nDim); AD::SetPreaccIn(PrimVar_j, nPrimVarGrad); @@ -3670,29 +3666,29 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con if (weight != 0.0) { - node[iPoint]->AddRmatrix(0, 0, (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight); - node[iPoint]->AddRmatrix(0, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight); - node[iPoint]->AddRmatrix(1, 1, (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight); + nodes->AddRmatrix(iPoint,0, 0, (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight); + nodes->AddRmatrix(iPoint,0, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight); + nodes->AddRmatrix(iPoint,1, 1, (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight); if (nDim == 3) { - node[iPoint]->AddRmatrix(0, 2, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(1, 2, (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(2, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(2, 2, (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,0, 2, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,1, 2, (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,2, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); + nodes->AddRmatrix(iPoint,2, 2, (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight); } /*--- Entries of c:= transpose(A)*b ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->AddGradient_Primitive(iVar,iDim, (Coord_j[iDim]-Coord_i[iDim])*(PrimVar_j[iVar]-PrimVar_i[iVar])/weight); + nodes->AddGradient_Primitive(iPoint,iVar,iDim, (Coord_j[iDim]-Coord_i[iDim])*(PrimVar_j[iVar]-PrimVar_i[iVar])/weight); } } } } - AD::SetPreaccOut(node[iPoint]->GetRmatrix(), nDim, nDim); - AD::SetPreaccOut(node[iPoint]->GetGradient_Primitive(), nPrimVarGrad, nDim); + AD::SetPreaccOut(nodes->GetRmatrix(iPoint), nDim, nDim); + AD::SetPreaccOut(nodes->GetGradient_Primitive(iPoint), nPrimVarGrad, nDim); AD::EndPreacc(); } @@ -3716,9 +3712,9 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con r11 = 0.0; r12 = 0.0; r13 = 0.0; r22 = 0.0; r23 = 0.0; r23_a = 0.0; r23_b = 0.0; r33 = 0.0; - r11 = node[iPoint]->GetRmatrix(0,0); - r12 = node[iPoint]->GetRmatrix(0,1); - r22 = node[iPoint]->GetRmatrix(1,1); + r11 = nodes->GetRmatrix(iPoint,0,0); + r12 = nodes->GetRmatrix(iPoint,0,1); + r22 = nodes->GetRmatrix(iPoint,1,1); AD::StartPreacc(); AD::SetPreaccIn(r11); @@ -3730,10 +3726,10 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con if (r22-r12*r12 >= 0.0) r22 = sqrt(r22-r12*r12); else r22 = 0.0; if (nDim == 3) { - r13 = node[iPoint]->GetRmatrix(0,2); - r23_a = node[iPoint]->GetRmatrix(1,2); - r23_b = node[iPoint]->GetRmatrix(2,1); - r33 = node[iPoint]->GetRmatrix(2,2); + r13 = nodes->GetRmatrix(iPoint,0,2); + r23_a = nodes->GetRmatrix(iPoint,1,2); + r23_b = nodes->GetRmatrix(iPoint,2,1); + r33 = nodes->GetRmatrix(iPoint,2,2); AD::SetPreaccIn(r13); AD::SetPreaccIn(r23_a); @@ -3791,14 +3787,14 @@ void CIncEulerSolver::SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *con for (iDim = 0; iDim < nDim; iDim++) { Cvector[iVar][iDim] = 0.0; for (jDim = 0; jDim < nDim; jDim++) { - Cvector[iVar][iDim] += Smatrix[iDim][jDim]*node[iPoint]->GetGradient_Primitive(iVar, jDim); + Cvector[iVar][iDim] += Smatrix[iDim][jDim]*nodes->GetGradient_Primitive(iPoint,iVar, jDim); } } } for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->SetGradient_Primitive(iVar, iDim, Cvector[iVar][iDim]); + nodes->SetGradient_Primitive(iPoint,iVar, iDim, Cvector[iVar][iDim]); } } @@ -3838,7 +3834,7 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - node[iPoint]->SetLimiter_Primitive(iVar, 1.0); + nodes->SetLimiter_Primitive(iPoint,iVar, 1.0); } } @@ -3850,9 +3846,9 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - node[iPoint]->SetSolution_Max(iVar, -EPS); - node[iPoint]->SetSolution_Min(iVar, EPS); - node[iPoint]->SetLimiter_Primitive(iVar, 2.0); + nodes->SetSolution_Max(iPoint,iVar, -EPS); + nodes->SetSolution_Min(iPoint,iVar, EPS); + nodes->SetLimiter_Primitive(iPoint,iVar, 2.0); } } @@ -3867,17 +3863,17 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) /*--- Get the primitive variables ---*/ - Primitive_i = node[iPoint]->GetPrimitive(); - Primitive_j = node[jPoint]->GetPrimitive(); + Primitive_i = nodes->GetPrimitive(iPoint); + Primitive_j = nodes->GetPrimitive(jPoint); /*--- Compute the maximum, and minimum values for nodes i & j ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { du = (Primitive_j[iVar] - Primitive_i[iVar]); - node[iPoint]->SetSolution_Min(iVar, min(node[iPoint]->GetSolution_Min(iVar), du)); - node[iPoint]->SetSolution_Max(iVar, max(node[iPoint]->GetSolution_Max(iVar), du)); - node[jPoint]->SetSolution_Min(iVar, min(node[jPoint]->GetSolution_Min(iVar), -du)); - node[jPoint]->SetSolution_Max(iVar, max(node[jPoint]->GetSolution_Max(iVar), -du)); + nodes->SetSolution_Min(iPoint, iVar, min(nodes->GetSolution_Min(iPoint, iVar), du)); + nodes->SetSolution_Max(iPoint, iVar, max(nodes->GetSolution_Max(iPoint, iVar), du)); + nodes->SetSolution_Min(jPoint, iVar, min(nodes->GetSolution_Min(jPoint, iVar), -du)); + nodes->SetSolution_Max(jPoint, iVar, max(nodes->GetSolution_Max(jPoint, iVar), -du)); } } @@ -3900,8 +3896,8 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient_Primitive(); - Gradient_j = node[jPoint]->GetGradient_Primitive(); + Gradient_i = nodes->GetGradient_Primitive(iPoint); + Gradient_j = nodes->GetGradient_Primitive(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -3912,10 +3908,10 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(jPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(jPoint,iVar)); /*--- Calculate the interface left gradient, delta- (dm) ---*/ @@ -3925,14 +3921,14 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) if (dm == 0.0) { limiter = 2.0; } else { - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(iPoint,iVar); + else dp = nodes->GetSolution_Min(iPoint,iVar); limiter = dp/dm; } - if (limiter < node[iPoint]->GetLimiter_Primitive(iVar)) { - node[iPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[iPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(iPoint,iVar)) { + nodes->SetLimiter_Primitive(iPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(iPoint)[iVar]); } /*--- Calculate the interface right gradient, delta+ (dp) ---*/ @@ -3943,14 +3939,14 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) if (dm == 0.0) { limiter = 2.0; } else { - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(jPoint,iVar); + else dp = nodes->GetSolution_Min(jPoint,iVar); limiter = dp/dm; } - if (limiter < node[jPoint]->GetLimiter_Primitive(iVar)) { - node[jPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[jPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(jPoint,iVar)) { + nodes->SetLimiter_Primitive(jPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(jPoint)[iVar]); } } @@ -3961,9 +3957,9 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - y = node[iPoint]->GetLimiter_Primitive(iVar); + y = nodes->GetLimiter_Primitive(iPoint,iVar); limiter = (y*y + 2.0*y) / (y*y + y + 2.0); - node[iPoint]->SetLimiter_Primitive(iVar, limiter); + nodes->SetLimiter_Primitive(iPoint,iVar, limiter); } } @@ -3983,7 +3979,7 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) /*--- Compute the max value and min value of the solution ---*/ - Primitive = node[0]->GetPrimitive(); + Primitive = nodes->GetPrimitive(0); for (iVar = 0; iVar < nPrimVarGrad; iVar++) { LocalMinPrimitive[iVar] = Primitive[iVar]; LocalMaxPrimitive[iVar] = Primitive[iVar]; @@ -3993,7 +3989,7 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) /*--- Get the primitive variables ---*/ - Primitive = node[iPoint]->GetPrimitive(); + Primitive = nodes->GetPrimitive(iPoint); for (iVar = 0; iVar < nPrimVarGrad; iVar++) { LocalMinPrimitive[iVar] = min (LocalMinPrimitive[iVar], Primitive[iVar]); @@ -4017,8 +4013,8 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient_Primitive(); - Gradient_j = node[jPoint]->GetGradient_Primitive(); + Gradient_i = nodes->GetGradient_Primitive(iPoint); + Gradient_j = nodes->GetGradient_Primitive(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -4029,10 +4025,10 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) AD::SetPreaccIn(Gradient_j[iVar], nDim); AD::SetPreaccIn(Coord_i, nDim); AD::SetPreaccIn(Coord_j, nDim); - AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(iPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Max(jPoint,iVar)); + AD::SetPreaccIn(nodes->GetSolution_Min(jPoint,iVar)); if (config->GetKind_SlopeLimit_Flow() == VENKATAKRISHNAN_WANG) { AD::SetPreaccIn(GlobalMaxPrimitive[iVar]); @@ -4053,14 +4049,14 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) /*--- Calculate the interface right gradient, delta+ (dp) ---*/ - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(iPoint,iVar); + else dp = nodes->GetSolution_Min(iPoint,iVar); limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[iPoint]->GetLimiter_Primitive(iVar)){ - node[iPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[iPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(iPoint,iVar)){ + nodes->SetLimiter_Primitive(iPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(iPoint)[iVar]); } /*-- Repeat for point j on the edge ---*/ @@ -4069,14 +4065,14 @@ void CIncEulerSolver::SetPrimitive_Limiter(CGeometry *geometry, CConfig *config) for (iDim = 0; iDim < nDim; iDim++) dm += 0.5*(Coord_i[iDim]-Coord_j[iDim])*Gradient_j[iVar][iDim]; - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = nodes->GetSolution_Max(jPoint,iVar); + else dp = nodes->GetSolution_Min(jPoint,iVar); limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[jPoint]->GetLimiter_Primitive(iVar)){ - node[jPoint]->SetLimiter_Primitive(iVar, limiter); - AD::SetPreaccOut(node[jPoint]->GetLimiter_Primitive()[iVar]); + if (limiter < nodes->GetLimiter_Primitive(jPoint,iVar)){ + nodes->SetLimiter_Primitive(jPoint,iVar, limiter); + AD::SetPreaccOut(nodes->GetLimiter_Primitive(jPoint)[iVar]); } AD::EndPreacc(); @@ -4513,8 +4509,8 @@ void CIncEulerSolver::SetBeta_Parameter(CGeometry *geometry, CSolver **solver_co /*--- Store the local maximum of the squared velocity in the field. ---*/ - if (node[iPoint]->GetVelocity2() > maxVel2) - maxVel2 = node[iPoint]->GetVelocity2(); + if (nodes->GetVelocity2(iPoint) > maxVel2) + maxVel2 = nodes->GetVelocity2(iPoint); } @@ -4535,7 +4531,7 @@ void CIncEulerSolver::SetBeta_Parameter(CGeometry *geometry, CSolver **solver_co epsilon2 = max(epsilon2_default,epsilon2); for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint]->SetBetaInc2(epsilon2*config->GetMax_Vel2()); + nodes->SetBetaInc2(iPoint,epsilon2*config->GetMax_Vel2()); } @@ -4552,14 +4548,14 @@ void CIncEulerSolver::SetPreconditioner(CConfig *config, unsigned long iPoint) { /*--- Access the primitive variables at this node. ---*/ - Density = node[iPoint]->GetDensity(); - BetaInc2 = node[iPoint]->GetBetaInc2(); - Cp = node[iPoint]->GetSpecificHeatCp(); + Density = nodes->GetDensity(iPoint); + BetaInc2 = nodes->GetBetaInc2(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); oneOverCp = 1.0/Cp; - Temperature = node[iPoint]->GetTemperature(); + Temperature = nodes->GetTemperature(iPoint); for (iDim = 0; iDim < nDim; iDim++) - Velocity[iDim] = node[iPoint]->GetVelocity(iDim); + Velocity[iDim] = nodes->GetVelocity(iPoint,iDim); /*--- We need the derivative of the equation of state to build the preconditioning matrix. For now, the only option is the ideal gas @@ -4637,7 +4633,6 @@ void CIncEulerSolver::SetPreconditioner(CConfig *config, unsigned long iPoint) { } - void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { @@ -4676,7 +4671,7 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Recompute and store the velocity in the primitive variable vector. ---*/ @@ -4697,11 +4692,11 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Beta coefficient stored at the node ---*/ - V_infty[nDim+3] = node[iPoint]->GetBetaInc2(); + V_infty[nDim+3] = nodes->GetBetaInc2(iPoint); /*--- Cp is needed for Temperature equation. ---*/ - V_infty[nDim+7] = node[iPoint]->GetSpecificHeatCp(); + V_infty[nDim+7] = nodes->GetSpecificHeatCp(iPoint); /*--- Set various quantities in the numerics class ---*/ @@ -4730,9 +4725,9 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Set transport properties at infinity. ---*/ - V_infty[nDim+4] = node[iPoint]->GetLaminarViscosity(); - V_infty[nDim+5] = node[iPoint]->GetEddyViscosity(); - V_infty[nDim+6] = node[iPoint]->GetThermalConductivity(); + V_infty[nDim+4] = nodes->GetLaminarViscosity(iPoint); + V_infty[nDim+5] = nodes->GetEddyViscosity(iPoint); + V_infty[nDim+6] = nodes->GetThermalConductivity(iPoint); /*--- Set the normal vector and the coordinates ---*/ @@ -4743,14 +4738,14 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(V_domain, V_infty); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), - node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Compute and update viscous residual ---*/ @@ -4837,11 +4832,11 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at this boundary node. ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Neumann condition for dynamic pressure ---*/ - V_inlet[0] = node[iPoint]->GetPressure(); + V_inlet[0] = nodes->GetPressure(iPoint); /*--- The velocity is either prescribed or computed from total pressure. ---*/ @@ -4876,7 +4871,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Store the current static pressure for clarity. ---*/ - P_domain = node[iPoint]->GetPressure(); + P_domain = nodes->GetPressure(iPoint); /*--- Check for back flow through the inlet. ---*/ @@ -4904,13 +4899,13 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Neumann condition for the temperature. ---*/ - V_inlet[nDim+1] = node[iPoint]->GetTemperature(); + V_inlet[nDim+1] = nodes->GetTemperature(iPoint); } else { /*--- Update the velocity magnitude using the total pressure. ---*/ - Vel_Mag = sqrt((P_total - P_domain)/(0.5*node[iPoint]->GetDensity())); + Vel_Mag = sqrt((P_total - P_domain)/(0.5*nodes->GetDensity(iPoint))); /*--- If requested, use the local boundary normal (negative), instead of the prescribed flow direction in the config. ---*/ @@ -4945,15 +4940,15 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, construction, or will be set fixed implicitly by the temperature and equation of state. ---*/ - V_inlet[nDim+2] = node[iPoint]->GetDensity(); + V_inlet[nDim+2] = nodes->GetDensity(iPoint); /*--- Beta coefficient from the config file ---*/ - V_inlet[nDim+3] = node[iPoint]->GetBetaInc2(); + V_inlet[nDim+3] = nodes->GetBetaInc2(iPoint); /*--- Cp is needed for Temperature equation. ---*/ - V_inlet[nDim+7] = node[iPoint]->GetSpecificHeatCp(); + V_inlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -4982,9 +4977,9 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Set transport properties at the inlet ---*/ - V_inlet[nDim+4] = node[iPoint]->GetLaminarViscosity(); - V_inlet[nDim+5] = node[iPoint]->GetEddyViscosity(); - V_inlet[nDim+6] = node[iPoint]->GetThermalConductivity(); + V_inlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); + V_inlet[nDim+5] = nodes->GetEddyViscosity(iPoint); + V_inlet[nDim+6] = nodes->GetThermalConductivity(iPoint); /*--- Set the normal vector and the coordinates ---*/ @@ -4995,14 +4990,14 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(V_domain, V_inlet); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), - node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Compute and update residual ---*/ @@ -5073,11 +5068,11 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Store the current static pressure for clarity. ---*/ - P_domain = node[iPoint]->GetPressure(); + P_domain = nodes->GetPressure(iPoint); /*--- Compute a boundary value for the pressure depending on whether we are prescribing a back pressure or a mass flow target. ---*/ @@ -5099,7 +5094,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Neumann condition for the velocity. ---*/ for (iDim = 0; iDim < nDim; iDim++) { - V_outlet[iDim+1] = node[iPoint]->GetPrimitive(iDim+1); + V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); } break; @@ -5138,7 +5133,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Neumann condition for the velocity ---*/ for (iDim = 0; iDim < nDim; iDim++) { - V_outlet[iDim+1] = node[iPoint]->GetPrimitive(iDim+1); + V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); } break; @@ -5147,21 +5142,21 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Neumann condition for the temperature. ---*/ - V_outlet[nDim+1] = node[iPoint]->GetTemperature(); + V_outlet[nDim+1] = nodes->GetTemperature(iPoint); /*--- Access density at the interior node. This is either constant by construction, or will be set fixed implicitly by the temperature and equation of state. ---*/ - V_outlet[nDim+2] = node[iPoint]->GetDensity(); + V_outlet[nDim+2] = nodes->GetDensity(iPoint); /*--- Beta coefficient from the config file ---*/ - V_outlet[nDim+3] = node[iPoint]->GetBetaInc2(); + V_outlet[nDim+3] = nodes->GetBetaInc2(iPoint); /*--- Cp is needed for Temperature equation. ---*/ - V_outlet[nDim+7] = node[iPoint]->GetSpecificHeatCp(); + V_outlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -5191,9 +5186,9 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Set transport properties at the outlet. ---*/ - V_outlet[nDim+4] = node[iPoint]->GetLaminarViscosity(); - V_outlet[nDim+5] = node[iPoint]->GetEddyViscosity(); - V_outlet[nDim+6] = node[iPoint]->GetThermalConductivity(); + V_outlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); + V_outlet[nDim+5] = nodes->GetEddyViscosity(iPoint); + V_outlet[nDim+6] = nodes->GetThermalConductivity(iPoint); /*--- Set the normal vector and the coordinates ---*/ @@ -5204,14 +5199,14 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(V_domain, V_outlet); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), - node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Compute and update residual ---*/ @@ -5371,28 +5366,25 @@ void CIncEulerSolver::BC_Sym_Plane(CGeometry *geometry, conv_numerics->SetNormal(Normal); /*--- Get current solution at this boundary node ---*/ - V_domain = node[iPoint]->GetPrimitive(); + V_domain = nodes->GetPrimitive(iPoint); /*--- Set the reflected state based on the boundary node. Scalars are copied and the velocity is mirrored along the symmetry boundary, i.e. the velocity in normal direction is substracted twice. ---*/ for(iVar = 0; iVar < nPrimVar; iVar++) - V_reflected[iVar] = node[iPoint]->GetPrimitive(iVar); + V_reflected[iVar] = nodes->GetPrimitive(iPoint,iVar); /*--- Compute velocity in normal direction (ProjVelcity_i=(v*n)) und substract twice from velocity in normal direction: v_r = v - 2 (v*n)n ---*/ - ProjVelocity_i = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - ProjVelocity_i += node[iPoint]->GetVelocity(iDim)*UnitNormal[iDim]; + ProjVelocity_i = nodes->GetProjVel(iPoint,UnitNormal); for (iDim = 0; iDim < nDim; iDim++) - V_reflected[iDim+1] = node[iPoint]->GetVelocity(iDim) - 2.0 * ProjVelocity_i*UnitNormal[iDim]; + V_reflected[iDim+1] = nodes->GetVelocity(iPoint,iDim) - 2.0 * ProjVelocity_i*UnitNormal[iDim]; /*--- Set Primitive and Secondary for numerics class. ---*/ conv_numerics->SetPrimitive(V_domain, V_reflected); - conv_numerics->SetSecondary(node[iPoint]->GetSecondary(), - node[iPoint]->GetSecondary()); - + conv_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); + /*--- Compute the residual using an upwind scheme. ---*/ conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config); @@ -5422,8 +5414,7 @@ void CIncEulerSolver::BC_Sym_Plane(CGeometry *geometry, /*--- Set the primitive and Secondary variables. ---*/ visc_numerics->SetPrimitive(V_domain, V_reflected); - visc_numerics->SetSecondary(node[iPoint]->GetSecondary(), - node[iPoint]->GetSecondary()); + visc_numerics->SetSecondary(nodes->GetSecondary(iPoint), nodes->GetSecondary(iPoint)); /*--- For viscous Fluxes also the gradients of the primitives need to be determined. 1. The gradients of scalars are mirrored along the sym plane just as velocity for the primitives @@ -5434,7 +5425,7 @@ void CIncEulerSolver::BC_Sym_Plane(CGeometry *geometry, /*--- Get gradients of primitives of boundary cell ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) - Grad_Reflected[iVar][iDim] = node[iPoint]->GetGradient_Primitive(iVar, iDim); + Grad_Reflected[iVar][iDim] = nodes->GetGradient_Primitive(iPoint,iVar, iDim); /*--- Reflect the gradients for all scalars including the velocity components. The gradients of the velocity components are set later with the @@ -5489,12 +5480,12 @@ void CIncEulerSolver::BC_Sym_Plane(CGeometry *geometry, Grad_Reflected[iVar+1][iDim] = GradNormVel[iDim]*UnitNormal[iVar] + GradTangVel[iDim]*Tangential[iVar]; /*--- Set the primitive gradients of the boundary and reflected state. ---*/ - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), Grad_Reflected); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), Grad_Reflected); /*--- Turbulent kinetic energy. ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Compute and update residual. Note that the viscous shear stress tensor is computed in the following routine based upon the velocity-component gradients. ---*/ @@ -5561,7 +5552,7 @@ void CIncEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_c Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor(); for (iVar = 0; iVar < nPrimVar; iVar++) { - PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = nodes->GetPrimitive(iPoint,iVar); PrimVar_j[iVar] = GetSlidingState(iMarker, iVertex, iVar, jVertex); } @@ -5626,12 +5617,12 @@ void CIncEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_c /*--- Primitive variables, and gradient ---*/ visc_numerics->SetPrimitive(PrimVar_i, PrimVar_j); - visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive()); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), nodes->GetGradient_Primitive(iPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0)); + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/ @@ -5730,9 +5721,9 @@ void CIncEulerSolver::BC_Custom(CGeometry *geometry, condition by setting the solution values at the boundary nodes directly and setting the residual to zero at those nodes. ---*/ - node[iPoint]->SetSolution_Old(Solution); - node[iPoint]->SetSolution(Solution); - node[iPoint]->SetRes_TruncErrorZero(); + nodes->SetSolution_Old(iPoint,Solution); + nodes->SetSolution(iPoint,Solution); + nodes->SetRes_TruncErrorZero(iPoint); LinSysRes.SetBlock_Zero(iPoint); /*--- Adjust rows of the Jacobian (includes 1 in the diagonal) ---*/ @@ -5800,14 +5791,14 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver previous solutions that are stored in memory. These are actually the primitive values, but we will convert to conservatives. ---*/ - V_time_nM1 = node[iPoint]->GetSolution_time_n1(); - V_time_n = node[iPoint]->GetSolution_time_n(); - V_time_nP1 = node[iPoint]->GetSolution(); + V_time_nM1 = nodes->GetSolution_time_n1(iPoint); + V_time_n = nodes->GetSolution_time_n(iPoint); + V_time_nP1 = nodes->GetSolution(iPoint); /*--- Access the density and Cp at this node (constant for now). ---*/ - - Density = node[iPoint]->GetDensity(); - Cp = node[iPoint]->GetSpecificHeatCp(); + + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); /*--- Compute the conservative variable vector for all time levels. ---*/ @@ -5851,6 +5842,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver LinSysRes.AddBlock(iPoint, Residual); if (implicit) { + SetPreconditioner(config, iPoint); for (iVar = 0; iVar < nVar; iVar++) { for (jVar = 0; jVar < nVar; jVar++) { @@ -5917,13 +5909,13 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver /*--- Compute the GCL component of the source term for node i ---*/ - V_time_n = node[iPoint]->GetSolution_time_n(); + V_time_n = nodes->GetSolution_time_n(iPoint); /*--- Access the density and Cp at this node (constant for now). ---*/ - - Density = node[iPoint]->GetDensity(); - Cp = node[iPoint]->GetSpecificHeatCp(); - + + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); + /*--- Compute the conservative variable vector for all time levels. ---*/ U_time_n[0] = Density; @@ -5940,7 +5932,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver /*--- Compute the GCL component of the source term for node j ---*/ - V_time_n = node[jPoint]->GetSolution_time_n(); + V_time_n = nodes->GetSolution_time_n(jPoint); U_time_n[0] = Density; for (iDim = 0; iDim < nDim; iDim++) { @@ -5985,12 +5977,12 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver /*--- Compute the GCL component of the source term for node i ---*/ - V_time_n = node[iPoint]->GetSolution_time_n(); + V_time_n = nodes->GetSolution_time_n(iPoint); /*--- Access the density and Cp at this node (constant for now). ---*/ - Density = node[iPoint]->GetDensity(); - Cp = node[iPoint]->GetSpecificHeatCp(); + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); U_time_n[0] = Density; for (iDim = 0; iDim < nDim; iDim++) { @@ -6027,14 +6019,14 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, previous solutions that are stored in memory. ---*/ - V_time_nM1 = node[iPoint]->GetSolution_time_n1(); - V_time_n = node[iPoint]->GetSolution_time_n(); - V_time_nP1 = node[iPoint]->GetSolution(); + V_time_nM1 = nodes->GetSolution_time_n1(iPoint); + V_time_n = nodes->GetSolution_time_n(iPoint); + V_time_nP1 = nodes->GetSolution(iPoint); /*--- Access the density and Cp at this node (constant for now). ---*/ - Density = node[iPoint]->GetDensity(); - Cp = node[iPoint]->GetSpecificHeatCp(); + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); /*--- Compute the conservative variable vector for all time levels. ---*/ @@ -6160,7 +6152,7 @@ void CIncEulerSolver::GetOutlet_Properties(CGeometry *geometry, CConfig *config, if (geometry->node[iPoint]->GetDomain()) { - V_outlet = node[iPoint]->GetPrimitive(); + V_outlet = nodes->GetPrimitive(iPoint); geometry->vertex[iMarker][iVertex]->GetNormal(Vector); @@ -6356,7 +6348,7 @@ void CIncEulerSolver::ComputeVerificationError(CGeometry *geometry, /* Set the pointers to the coordinates and solution of this DOF. */ const su2double *coor = geometry->node[iPoint]->GetCoord(); - su2double *solDOF = node[iPoint]->GetSolution(); + su2double *solDOF = nodes->GetSolution(iPoint); /* Get local error from the verification solution class. */ vector error(nVar,0.0); @@ -6494,7 +6486,7 @@ void CIncEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf index = counter*Restart_Vars[1] + skipVars; for (iVar = 0; iVar < nVar_Restart; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); iPoint_Global_Local++; /*--- For dynamic meshes, read in and store the @@ -6577,12 +6569,12 @@ void CIncEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver[iMesh-1][FLOW_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(Solution); + solver[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); solver[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); @@ -6669,11 +6661,11 @@ void CIncEulerSolver::SetFreeStream_Solution(CConfig *config){ unsigned short iDim; for (iPoint = 0; iPoint < nPoint; iPoint++){ - node[iPoint]->SetSolution(0, Pressure_Inf); + nodes->SetSolution(iPoint,0, Pressure_Inf); for (iDim = 0; iDim < nDim; iDim++){ - node[iPoint]->SetSolution(iDim+1, Velocity_Inf[iDim]); + nodes->SetSolution(iPoint,iDim+1, Velocity_Inf[iDim]); } - node[iPoint]->SetSolution(nDim+1, Temperature_Inf); + nodes->SetSolution(iPoint,nDim+1, Temperature_Inf); } } @@ -6819,9 +6811,6 @@ CIncNSSolver::CIncNSSolver(CGeometry *geometry, CConfig *config, unsigned short SetVerificationSolution(nDim, nVar, config); - /*--- Allocate the node variables ---*/ - node = new CVariable*[nPoint]; - /*--- Define some auxiliar vector related with the residual ---*/ Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; @@ -7243,8 +7232,8 @@ CIncNSSolver::CIncNSSolver(CGeometry *geometry, CConfig *config, unsigned short /*--- Initialize the solution to the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nDim, nVar, config); + nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); /*--- Initialize the BGS residuals in FSI problems. ---*/ if (config->GetMultizone_Residual()){ @@ -7419,14 +7408,13 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container /*--- Evaluate the vorticity and strain rate magnitude ---*/ + solver_container[FLOW_SOL]->GetNodes()->SetVorticity_StrainMag(); + StrainMag_Max = 0.0; Omega_Max = 0.0; for (iPoint = 0; iPoint < nPoint; iPoint++) { - solver_container[FLOW_SOL]->node[iPoint]->SetVorticity(); - solver_container[FLOW_SOL]->node[iPoint]->SetStrainMag(); - - StrainMag = solver_container[FLOW_SOL]->node[iPoint]->GetStrainMag(); - Vorticity = solver_container[FLOW_SOL]->node[iPoint]->GetVorticity(); + StrainMag = solver_container[FLOW_SOL]->GetNodes()->GetStrainMag(iPoint); + Vorticity = solver_container[FLOW_SOL]->GetNodes()->GetVorticity(iPoint); Omega = sqrt(Vorticity[0]*Vorticity[0]+ Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); StrainMag_Max = max(StrainMag_Max, StrainMag); @@ -7476,29 +7464,29 @@ unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, C /*--- Retrieve the value of the kinetic energy (if needed) ---*/ if (turb_model != NONE) { - eddy_visc = solver_container[TURB_SOL]->node[iPoint]->GetmuT(); - if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0); + eddy_visc = solver_container[TURB_SOL]->GetNodes()->GetmuT(iPoint); + if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ - DES_LengthScale = solver_container[TURB_SOL]->node[iPoint]->GetDES_LengthScale(); + DES_LengthScale = solver_container[TURB_SOL]->GetNodes()->GetDES_LengthScale(iPoint); } } /*--- Initialize the non-physical points vector ---*/ - node[iPoint]->SetNon_Physical(false); + nodes->SetNon_Physical(iPoint,false); /*--- Incompressible flow, primitive variables --- */ - physical = node[iPoint]->SetPrimVar(eddy_visc, turb_ke, FluidModel); + physical = static_cast(nodes)->SetPrimVar(iPoint,eddy_visc, turb_ke, FluidModel); /*--- Record any non-physical points. ---*/ - if (!physical) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; } + if (!physical) { nodes->SetNon_Physical(iPoint,true); ErrorCounter++; } /*--- Set the DES length scale ---*/ - node[iPoint]->SetDES_LengthScale(DES_LengthScale); + nodes->SetDES_LengthScale(iPoint,DES_LengthScale); /*--- Initialize the convective, source and viscous residual vector ---*/ @@ -7528,8 +7516,8 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed and viscosity ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->SetMax_Lambda_Inv(0.0); - node[iPoint]->SetMax_Lambda_Visc(0.0); + nodes->SetMax_Lambda_Inv(iPoint,0.0); + nodes->SetMax_Lambda_Visc(iPoint,0.0); } /*--- Loop interior edges ---*/ @@ -7546,9 +7534,9 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Mean Values ---*/ - Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal)); - Mean_BetaInc2 = 0.5 * (node[iPoint]->GetBetaInc2() + node[jPoint]->GetBetaInc2()); - Mean_Density = 0.5 * (node[iPoint]->GetDensity() + node[jPoint]->GetDensity()); + Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + Mean_BetaInc2 = 0.5 * (nodes->GetBetaInc2(iPoint) + nodes->GetBetaInc2(jPoint)); + Mean_Density = 0.5 * (nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); /*--- Adjustment for grid movement ---*/ @@ -7567,24 +7555,24 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Inviscid contribution ---*/ Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Inv(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(iPoint,Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Inv(jPoint,Lambda); /*--- Viscous contribution ---*/ - Mean_LaminarVisc = 0.5*(node[iPoint]->GetLaminarViscosity() + node[jPoint]->GetLaminarViscosity()); - Mean_EddyVisc = 0.5*(node[iPoint]->GetEddyViscosity() + node[jPoint]->GetEddyViscosity()); - Mean_Density = 0.5*(node[iPoint]->GetDensity() + node[jPoint]->GetDensity()); - Mean_Thermal_Conductivity = 0.5*(node[iPoint]->GetThermalConductivity() + node[jPoint]->GetThermalConductivity()); - Mean_Cv = 0.5*(node[iPoint]->GetSpecificHeatCv() + node[jPoint]->GetSpecificHeatCv()); + Mean_LaminarVisc = 0.5*(nodes->GetLaminarViscosity(iPoint) + nodes->GetLaminarViscosity(jPoint)); + Mean_EddyVisc = 0.5*(nodes->GetEddyViscosity(iPoint) + nodes->GetEddyViscosity(jPoint)); + Mean_Density = 0.5*(nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); + Mean_Thermal_Conductivity = 0.5*(nodes->GetThermalConductivity(iPoint) + nodes->GetThermalConductivity(jPoint)); + Mean_Cv = 0.5*(nodes->GetSpecificHeatCv(iPoint) + nodes->GetSpecificHeatCv(jPoint)); Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); Lambda_2 = 0.0; if (energy) Lambda_2 = (1.0/Mean_Cv)*Mean_Thermal_Conductivity; Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda); - if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Visc(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint,Lambda); + if (geometry->node[jPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(jPoint,Lambda); } @@ -7603,9 +7591,9 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, /*--- Mean Values ---*/ - Mean_ProjVel = node[iPoint]->GetProjVel(Normal); - Mean_BetaInc2 = node[iPoint]->GetBetaInc2(); - Mean_Density = node[iPoint]->GetDensity(); + Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); + Mean_BetaInc2 = nodes->GetBetaInc2(iPoint); + Mean_Density = nodes->GetDensity(iPoint); Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); /*--- Adjustment for grid movement ---*/ @@ -7622,23 +7610,23 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; if (geometry->node[iPoint]->GetDomain()) { - node[iPoint]->AddMax_Lambda_Inv(Lambda); + nodes->AddMax_Lambda_Inv(iPoint,Lambda); } /*--- Viscous contribution ---*/ - Mean_LaminarVisc = node[iPoint]->GetLaminarViscosity(); - Mean_EddyVisc = node[iPoint]->GetEddyViscosity(); - Mean_Density = node[iPoint]->GetDensity(); - Mean_Thermal_Conductivity = node[iPoint]->GetThermalConductivity(); - Mean_Cv = node[iPoint]->GetSpecificHeatCv(); + Mean_LaminarVisc = nodes->GetLaminarViscosity(iPoint); + Mean_EddyVisc = nodes->GetEddyViscosity(iPoint); + Mean_Density = nodes->GetDensity(iPoint); + Mean_Thermal_Conductivity = nodes->GetThermalConductivity(iPoint); + Mean_Cv = nodes->GetSpecificHeatCv(iPoint); Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); Lambda_2 = 0.0; if (energy) Lambda_2 = (1.0/Mean_Cv)*Mean_Thermal_Conductivity; Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda); + if (geometry->node[iPoint]->GetDomain()) nodes->AddMax_Lambda_Visc(iPoint,Lambda); } } @@ -7651,18 +7639,18 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, Vol = geometry->node[iPoint]->GetVolume(); if (Vol != 0.0) { - Local_Delta_Time = config->GetCFL(iMesh)*Vol / node[iPoint]->GetMax_Lambda_Inv(); - Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ node[iPoint]->GetMax_Lambda_Visc(); + Local_Delta_Time = config->GetCFL(iMesh)*Vol / nodes->GetMax_Lambda_Inv(iPoint); + Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); Local_Delta_Time = min(Local_Delta_Time, Local_Delta_Time_Visc); Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time); Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time); Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time); if (Local_Delta_Time > config->GetMax_DeltaTime()) Local_Delta_Time = config->GetMax_DeltaTime(); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } else { - node[iPoint]->SetDelta_Time(0.0); + nodes->SetDelta_Time(iPoint,0.0); } } @@ -7693,7 +7681,7 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, Global_Delta_Time = rbuf_time; #endif for (iPoint = 0; iPoint < nPointDomain; iPoint++) - node[iPoint]->SetDelta_Time(Global_Delta_Time); + nodes->SetDelta_Time(iPoint,Global_Delta_Time); } /*--- Recompute the unsteady time step for the dual time strategy @@ -7715,8 +7703,8 @@ void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, if (dual_time) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { if (!implicit) { - Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), node[iPoint]->GetDelta_Time()); - node[iPoint]->SetDelta_Time(Local_Delta_Time); + Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint,Local_Delta_Time); } } @@ -7741,19 +7729,19 @@ void CIncNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contai /*--- Primitive and secondary variables ---*/ - numerics->SetPrimitive(node[iPoint]->GetPrimitive(), - node[jPoint]->GetPrimitive()); + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), + nodes->GetPrimitive(jPoint)); /*--- Gradient and limiters ---*/ - numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), - node[jPoint]->GetGradient_Primitive()); + numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(jPoint)); /*--- Turbulent kinetic energy ---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), - solver_container[TURB_SOL]->node[jPoint]->GetSolution(0)); + numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(jPoint,0)); /*--- Compute and update residual ---*/ @@ -7896,13 +7884,13 @@ void CIncNSSolver::Friction_Forces(CGeometry *geometry, CConfig *config) { for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = nodes->GetGradient_Primitive(iPoint,iDim+1, jDim); } - Grad_Temp[iDim] = node[iPoint]->GetGradient_Primitive(nDim+1, iDim); + Grad_Temp[iDim] = nodes->GetGradient_Primitive(iPoint,nDim+1, iDim); } - Viscosity = node[iPoint]->GetLaminarViscosity(); - Density = node[iPoint]->GetDensity(); + Viscosity = nodes->GetLaminarViscosity(iPoint); + Density = nodes->GetDensity(iPoint); Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area); for (iDim = 0; iDim < nDim; iDim++) { @@ -7958,7 +7946,7 @@ void CIncNSSolver::Friction_Forces(CGeometry *geometry, CConfig *config) { GradTemperature -= Grad_Temp[iDim]*UnitNormal[iDim]; } - thermal_conductivity = node[iPoint]->GetThermalConductivity(); + thermal_conductivity = nodes->GetThermalConductivity(iPoint); HeatFlux[iMarker][iVertex] = -thermal_conductivity*GradTemperature*RefHeatFlux; HF_Visc[iMarker] += HeatFlux[iMarker][iVertex]*Area; MaxHF_Visc[iMarker] += pow(HeatFlux[iMarker][iVertex], MaxNorm); @@ -8304,11 +8292,11 @@ void CIncNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contai condition (Dirichlet). Fix the velocity and remove any contribution to the residual at this node. ---*/ - node[iPoint]->SetVelocity_Old(Vector); + nodes->SetVelocity_Old(iPoint,Vector); for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); if (energy) { @@ -8400,11 +8388,11 @@ void CIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont condition (Dirichlet). Fix the velocity and remove any contribution to the residual at this node. ---*/ - node[iPoint]->SetVelocity_Old(Vector); + nodes->SetVelocity_Old(iPoint,Vector); for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); if (energy) { @@ -8432,11 +8420,11 @@ void CIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Compute the normal gradient in temperature using Twall ---*/ - dTdn = -(node[Point_Normal]->GetTemperature() - Twall)/dist_ij; + dTdn = -(nodes->GetTemperature(Point_Normal) - Twall)/dist_ij; /*--- Get thermal conductivity ---*/ - thermal_conductivity = node[iPoint]->GetThermalConductivity(); + thermal_conductivity = nodes->GetThermalConductivity(iPoint); /*--- Apply a weak boundary condition for the energy equation. Compute the residual due to the prescribed heat flux. ---*/ @@ -8537,21 +8525,21 @@ void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **sol condition (Dirichlet). Fix the velocity and remove any contribution to the residual at this node. ---*/ - node[iPoint]->SetVelocity_Old(Vector); + nodes->SetVelocity_Old(iPoint,Vector); for (iDim = 0; iDim < nDim; iDim++) LinSysRes.SetBlock_Zero(iPoint, iDim+1); - node[iPoint]->SetVel_ResTruncError_Zero(); + nodes->SetVel_ResTruncError_Zero(iPoint); if (energy) { Tconjugate = GetConjugateHeatVariable(val_marker, iVertex, 0)/Temperature_Ref; /*--- Strong imposition of the temperature on the fluid zone. ---*/ - + LinSysRes.SetBlock_Zero(iPoint, nDim+1); - node[iPoint]->SetSolution_Old(nDim+1, Tconjugate); - node[iPoint]->SetEnergy_ResTruncError_Zero(); + nodes->SetSolution_Old(iPoint, nDim+1, Tconjugate); + nodes->SetEnergy_ResTruncError_Zero(iPoint); } diff --git a/SU2_CFD/src/solver_direct_transition.cpp b/SU2_CFD/src/solver_direct_transition.cpp index 4c18ad313f55..58dd46efba64 100644 --- a/SU2_CFD/src/solver_direct_transition.cpp +++ b/SU2_CFD/src/solver_direct_transition.cpp @@ -44,7 +44,7 @@ CTransLMSolver::CTransLMSolver(void) : CTurbSolver() {} CTransLMSolver::CTransLMSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CTurbSolver() { unsigned short iVar, iDim, nLineLets; unsigned long iPoint, index; - su2double Density_Inf, Viscosity_Inf, tu_Inf, nu_tilde_Inf, Factor_nu_Inf, dull_val, rey; + su2double tu_Inf, dull_val, rey; ifstream restart_file; char *cstr; string text_line; @@ -60,8 +60,6 @@ CTransLMSolver::CTransLMSolver(CGeometry *geometry, CConfig *config, unsigned sh nPoint = geometry->GetnPoint(); nPointDomain = geometry->GetnPointDomain(); - node = new CVariable*[geometry->GetnPoint()]; - /*--- Dimension of the problem --> 2 Transport equations (intermittency, Reth) ---*/ nVar = 2; @@ -115,53 +113,38 @@ CTransLMSolver::CTransLMSolver(CGeometry *geometry, CConfig *config, unsigned sh } - /*--- Computation of gradients by least squares ---*/ - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { - /*--- S matrix := inv(R)*traspose(inv(R)) ---*/ - Smatrix = new su2double* [nDim]; - for (iDim = 0; iDim < nDim; iDim++) - Smatrix[iDim] = new su2double [nDim]; - /*--- c vector := transpose(WA)*(Wb) ---*/ - Cvector = new su2double* [nVar]; - for (iVar = 0; iVar < nVar; iVar++) - Cvector[iVar] = new su2double [nDim]; - } - - /*--- Read farfield conditions from config ---*/ - Density_Inf = config->GetDensity_FreeStreamND(); - Viscosity_Inf = config->GetViscosity_FreeStreamND(); - Intermittency_Inf = config->GetIntermittency_FreeStream(); - tu_Inf = config->GetTurbulenceIntensity_FreeStream(); - - /*-- Initialize REth from correlation --*/ - if (tu_Inf <= 1.3) { - REth_Inf = (1173.51-589.428*tu_Inf+0.2196/(tu_Inf*tu_Inf)); - } else { - REth_Inf = 331.5*pow(tu_Inf-0.5658,-0.671); - } - rey = config->GetReynolds(); - -// REth_Inf *= mach/rey; - cout << "REth_Inf = " << REth_Inf << ", rey: "<< rey << " -AA" << endl; + /*--- Computation of gradients by least squares ---*/ + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + /*--- S matrix := inv(R)*traspose(inv(R)) ---*/ + Smatrix = new su2double* [nDim]; + for (iDim = 0; iDim < nDim; iDim++) + Smatrix[iDim] = new su2double [nDim]; + /*--- c vector := transpose(WA)*(Wb) ---*/ + Cvector = new su2double* [nVar]; + for (iVar = 0; iVar < nVar; iVar++) + Cvector[iVar] = new su2double [nDim]; + } - /*--- Factor_nu_Inf in [3.0, 5.0] ---*/ - Factor_nu_Inf = config->GetNuFactor_FreeStream(); - nu_tilde_Inf = Factor_nu_Inf*Viscosity_Inf/Density_Inf; + /*--- Read farfield conditions from config ---*/ + Intermittency_Inf = config->GetIntermittency_FreeStream(); + tu_Inf = config->GetTurbulenceIntensity_FreeStream(); - /*--- Restart the solution from file information ---*/ - if (!restart) { - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - // TODO: Erase this bubble of specially initialized points -AA -// if (iPoint == 9745||iPoint == 9746||iPoint == 9608||iPoint == 9609) { -// node[iPoint] = new CTransLMVariable(nu_tilde_Inf, 0.0, 1100.0, nDim, nVar, config); -// } else { - node[iPoint] = new CTransLMVariable(nu_tilde_Inf, Intermittency_Inf, REth_Inf, nDim, nVar, config); - // } - } + /*-- Initialize REth from correlation --*/ + if (tu_Inf <= 1.3) { + REth_Inf = (1173.51-589.428*tu_Inf+0.2196/(tu_Inf*tu_Inf)); + } else { + REth_Inf = 331.5*pow(tu_Inf-0.5658,-0.671); } + rey = config->GetReynolds(); - } - else { + // REth_Inf *= mach/rey; + cout << "REth_Inf = " << REth_Inf << ", rey: "<< rey << " -AA" << endl; + + /*--- Restart the solution from file information ---*/ + if (!restart) nodes = new CTransLMVariable(Intermittency_Inf, REth_Inf, nPoint, nDim, nVar, config); + + } else { /*--- Coarse levels ---*/ + cout << "No LM restart yet!!" << endl; // TODO, Aniket int j; cin >> j; @@ -173,15 +156,20 @@ CTransLMSolver::CTransLMSolver(CGeometry *geometry, CConfig *config, unsigned sh SU2_MPI::Error("There is no turbulent restart file.", CURRENT_FUNCTION); } + nodes = new CTurbSAVariable(0.0, 0.0, nPoint, nDim, nVar, config); + for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { getline(restart_file, text_line); istringstream point_line(text_line); if (nDim == 2) point_line >> index >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> Solution[0]; if (nDim == 3) point_line >> index >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> dull_val >> Solution[0]; - node[iPoint] = new CTurbSAVariable(Solution[0], 0, nDim, nVar, config); + nodes->SetSolution(iPoint,0,Solution[0]); + nodes->SetSolution_Old(iPoint,0,Solution[0]); } restart_file.close(); } + + SetBaseClassPointerToNodes(); /*--- Add the solver name (max 8 characters) ---*/ SolverName = "TRANS"; @@ -207,7 +195,7 @@ void CTransLMSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai /*--- Correction for separation-induced transition, Replace intermittency with gamma_eff ---*/ for (unsigned int iPoint = 0; iPoint < geometry->GetnPoint(); iPoint ++) - node[iPoint]->SetGammaEff(); + nodes->SetGammaEff(iPoint); } void CTransLMSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { @@ -231,7 +219,7 @@ void CTransLMSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv /*--- Modify matrix diagonal to assure diagonal dominance ---*/ - Delta_flow = Vol / (solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time()); + Delta_flow = Vol / (solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint)); Delta = Delta_flow; Jacobian.AddVal2Diag(iPoint, Delta); @@ -265,7 +253,7 @@ void CTransLMSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solv for (iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++) { for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->AddSolution(iVar, LinSysSol[iPoint*nVar+iVar]); + nodes->AddSolution(iPoint,iVar, LinSysSol[iPoint*nVar+iVar]); } /*--- MPI solution ---*/ @@ -291,13 +279,13 @@ void CTransLMSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_conta numerics->SetNormal(geometry->edge[iEdge]->GetNormal()); /*--- Conservative variables w/o reconstruction ---*/ - U_i = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); - U_j = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(); + U_i = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); + U_j = solver_container[FLOW_SOL]->GetNodes()->GetSolution(jPoint); numerics->SetConservative(U_i, U_j); /*--- Transition variables w/o reconstruction ---*/ - trans_var_i = node[iPoint]->GetSolution(); - trans_var_j = node[jPoint]->GetSolution(); + trans_var_i = nodes->GetSolution(iPoint); + trans_var_j = nodes->GetSolution(jPoint); numerics->SetTransVar(trans_var_i, trans_var_j); /*--- Add and subtract Residual ---*/ @@ -333,22 +321,23 @@ void CTransLMSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_cont numerics->SetNormal(geometry->edge[iEdge]->GetNormal()); /*--- Conservative variables w/o reconstruction ---*/ - numerics->SetConservative(solver_container[FLOW_SOL]->node[iPoint]->GetSolution(), - solver_container[FLOW_SOL]->node[jPoint]->GetSolution()); + numerics->SetConservative(solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetSolution(jPoint)); /*--- Laminar Viscosity ---*/ - numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(), - solver_container[FLOW_SOL]->node[jPoint]->GetLaminarViscosity()); + numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(jPoint)); /*--- Eddy Viscosity ---*/ - numerics->SetEddyViscosity(solver_container[FLOW_SOL]->node[iPoint]->GetEddyViscosity(), - solver_container[FLOW_SOL]->node[jPoint]->GetEddyViscosity()); + numerics->SetEddyViscosity(solver_container[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetEddyViscosity(jPoint)); /*--- Transition variables w/o reconstruction, and its gradients ---*/ - numerics->SetTransVar(node[iPoint]->GetSolution(), node[jPoint]->GetSolution()); - numerics->SetTransVarGradient(node[iPoint]->GetGradient(), node[jPoint]->GetGradient()); + numerics->SetTransVar(nodes->GetSolution(iPoint), nodes->GetSolution(jPoint)); + numerics->SetTransVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(jPoint)); - numerics->SetConsVarGradient(solver_container[FLOW_SOL]->node[iPoint]->GetGradient(), - solver_container[FLOW_SOL]->node[jPoint]->GetGradient()); +// ToDo: The flow solvers do not use the conservative variable gradients +// numerics->SetConsVarGradient(solver_container[FLOW_SOL]->GetNodes()->GetGradient(iPoint), +// solver_container[FLOW_SOL]->GetNodes()->GetGradient(jPoint)); /*--- Compute residual, and Jacobians ---*/ @@ -378,21 +367,21 @@ void CTransLMSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Conservative variables w/o reconstruction ---*/ - numerics->SetConservative(solver_container[FLOW_SOL]->node[iPoint]->GetSolution(), NULL); + numerics->SetConservative(solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint), NULL); /*--- Gradient of the primitive and conservative variables ---*/ - numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(), NULL); + numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint), NULL); /*--- Laminar and eddy viscosity ---*/ - numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(), 0.0); - numerics->SetEddyViscosity(solver_container[FLOW_SOL]->node[iPoint]->GetEddyViscosity(),0.0); + numerics->SetLaminarViscosity(solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint), 0.0); + numerics->SetEddyViscosity(solver_container[FLOW_SOL]->GetNodes()->GetEddyViscosity(iPoint),0.0); /*--- Turbulent variables w/o reconstruction, and its gradient ---*/ - numerics->SetTransVar(node[iPoint]->GetSolution(), NULL); - // numerics->SetTransVarGradient(node[iPoint]->GetGradient(), NULL); // Is this needed?? + numerics->SetTransVar(nodes->GetSolution(iPoint), NULL); + // numerics->SetTransVarGradient(nodes->GetGradient(iPoint), NULL); // Is this needed?? /*--- Set volume ---*/ @@ -408,7 +397,7 @@ void CTransLMSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*-- Store gamma_sep in variable class --*/ - node[iPoint]->SetGammaSep(gamma_sep); + nodes->SetGammaSep(iPoint,gamma_sep); /*--- Subtract residual and the Jacobian ---*/ @@ -447,14 +436,14 @@ void CTransLMSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Set both interior and exterior point to current value ---*/ for (iVar=0; iVar < nVar; iVar++) { - U_domain[iVar] = node[iPoint]->GetSolution(iVar); - U_wall[iVar] = node[iPoint]->GetSolution(iVar); + U_domain[iVar] = nodes->GetSolution(iPoint,iVar); + U_wall[iVar] = nodes->GetSolution(iPoint,iVar); } /*--- Set various quantities in the solver class ---*/ numerics->SetNormal(Normal); numerics->SetTransVar(U_domain,U_wall); - U_i = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); + U_i = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint); numerics->SetConservative(U_i, U_i); /*--- Compute the residual using an upwind scheme ---*/ @@ -483,7 +472,7 @@ void CTransLMSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont // /*--- Impose boundary values (Dirichlet) ---*/ // Solution[0] = 0.0; // Solution[1] = 0.0; -// node[iPoint]->SetSolution_Old(Solution); +// nodes->SetSolution_Old(iPoint,Solution); // LinSysRes.SetBlock_Zero(iPoint); // // /*--- includes 1 in the diagonal ---*/ @@ -516,7 +505,7 @@ void CTransLMSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe /*--- Impose boundary values (Dirichlet) ---*/ Solution[0] = Intermittency_Inf; Solution[1] = REth_Inf; - node[iPoint]->SetSolution_Old(Solution); + nodes->SetSolution_Old(iPoint,Solution); LinSysRes.SetBlock_Zero(iPoint); /*--- includes 1 in the diagonal ---*/ diff --git a/SU2_CFD/src/solver_direct_turbulent.cpp b/SU2_CFD/src/solver_direct_turbulent.cpp index 4a23ba9e0966..7886ec3f3ec5 100644 --- a/SU2_CFD/src/solver_direct_turbulent.cpp +++ b/SU2_CFD/src/solver_direct_turbulent.cpp @@ -48,7 +48,7 @@ CTurbSolver::CTurbSolver(void) : CSolver() { nVertex = NULL; nMarker = 0; Inlet_TurbVars = NULL; - + snode = nullptr; } CTurbSolver::CTurbSolver(CGeometry* geometry, CConfig *config) : CSolver() { @@ -91,6 +91,7 @@ CTurbSolver::~CTurbSolver(void) { if (lowerlimit != NULL) delete [] lowerlimit; if (upperlimit != NULL) delete [] upperlimit; + if (nodes != nullptr) delete nodes; } void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short iMesh) { @@ -112,14 +113,14 @@ void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe /*--- Primitive variables w/o reconstruction ---*/ - V_i = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); - V_j = solver_container[FLOW_SOL]->node[jPoint]->GetPrimitive(); + V_i = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); + V_j = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(jPoint); numerics->SetPrimitive(V_i, V_j); /*--- Turbulent variables w/o reconstruction ---*/ - Turb_i = node[iPoint]->GetSolution(); - Turb_j = node[jPoint]->GetSolution(); + Turb_i = nodes->GetSolution(iPoint); + Turb_j = nodes->GetSolution(jPoint); numerics->SetTurbVar(Turb_i, Turb_j); /*--- Grid Movement ---*/ @@ -136,11 +137,11 @@ void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe /*--- Mean flow primitive variables using gradient reconstruction and limiters ---*/ - Gradient_i = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); - Gradient_j = solver_container[FLOW_SOL]->node[jPoint]->GetGradient_Primitive(); + Gradient_i = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); + Gradient_j = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(jPoint); if (limiter) { - Limiter_i = solver_container[FLOW_SOL]->node[iPoint]->GetLimiter_Primitive(); - Limiter_j = solver_container[FLOW_SOL]->node[jPoint]->GetLimiter_Primitive(); + Limiter_i = solver_container[FLOW_SOL]->GetNodes()->GetLimiter_Primitive(iPoint); + Limiter_j = solver_container[FLOW_SOL]->GetNodes()->GetLimiter_Primitive(jPoint); } for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnPrimVarGrad(); iVar++) { @@ -163,11 +164,11 @@ void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe /*--- Turbulent variables using gradient reconstruction and limiters ---*/ - Gradient_i = node[iPoint]->GetGradient(); - Gradient_j = node[jPoint]->GetGradient(); + Gradient_i = nodes->GetGradient(iPoint); + Gradient_j = nodes->GetGradient(jPoint); if (limiter) { - Limiter_i = node[iPoint]->GetLimiter(); - Limiter_j = node[jPoint]->GetLimiter(); + Limiter_i = nodes->GetLimiter(iPoint); + Limiter_j = nodes->GetLimiter(jPoint); } for (iVar = 0; iVar < nVar; iVar++) { @@ -227,17 +228,17 @@ void CTurbSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Conservative variables w/o reconstruction ---*/ - numerics->SetPrimitive(solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(), - solver_container[FLOW_SOL]->node[jPoint]->GetPrimitive()); + numerics->SetPrimitive(solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint), + solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(jPoint)); /*--- Turbulent variables w/o reconstruction, and its gradients ---*/ - numerics->SetTurbVar(node[iPoint]->GetSolution(), node[jPoint]->GetSolution()); - numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), node[jPoint]->GetGradient()); + numerics->SetTurbVar(nodes->GetSolution(iPoint), nodes->GetSolution(jPoint)); + numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(jPoint)); /*--- Menter's first blending function (only SST)---*/ if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - numerics->SetF1blending(node[iPoint]->GetF1blending(), node[jPoint]->GetF1blending()); + numerics->SetF1blending(nodes->GetF1blending(iPoint), nodes->GetF1blending(jPoint)); /*--- Compute residual, and Jacobians ---*/ @@ -378,7 +379,7 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ /*--- Modify matrix diagonal to assure diagonal dominance ---*/ - Delta = Vol / (config->GetCFLRedCoeff_Turb()*solver_container[FLOW_SOL]->node[iPoint]->GetDelta_Time()); + Delta = Vol / (config->GetCFLRedCoeff_Turb()*solver_container[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint)); Jacobian.AddVal2Diag(iPoint, Delta); /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/ @@ -417,7 +418,7 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ case SA: case SA_E: case SA_COMP: case SA_E_COMP: for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->AddClippedSolution(0, config->GetRelaxation_Factor_Turb()*LinSysSol[iPoint], lowerlimit[0], upperlimit[0]); + nodes->AddClippedSolution(iPoint,0, config->GetRelaxation_Factor_Turb()*LinSysSol[iPoint], lowerlimit[0], upperlimit[0]); } break; @@ -425,7 +426,7 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ case SA_NEG: for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - node[iPoint]->AddSolution(0, config->GetRelaxation_Factor_Turb()*LinSysSol[iPoint]); + nodes->AddSolution(iPoint,0, config->GetRelaxation_Factor_Turb()*LinSysSol[iPoint]); } break; @@ -435,16 +436,16 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ for (iPoint = 0; iPoint < nPointDomain; iPoint++) { if (compressible) { - density_old = solver_container[FLOW_SOL]->node[iPoint]->GetSolution_Old(0); - density = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); + density_old = solver_container[FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint,0); + density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); } if (incompressible) { - density_old = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - density = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); + density_old = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); } for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->AddConservativeSolution(iVar, config->GetRelaxation_Factor_Turb()*LinSysSol[iPoint*nVar+iVar], density, density_old, lowerlimit[iVar], upperlimit[iVar]); + nodes->AddConservativeSolution(iPoint,iVar, config->GetRelaxation_Factor_Turb()*LinSysSol[iPoint*nVar+iVar], density, density_old, lowerlimit[iVar], upperlimit[iVar]); } } @@ -504,9 +505,9 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, previous solutions that are stored in memory. ---*/ - U_time_nM1 = node[iPoint]->GetSolution_time_n1(); - U_time_n = node[iPoint]->GetSolution_time_n(); - U_time_nP1 = node[iPoint]->GetSolution(); + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); /*--- CV volume at time n+1. As we are on a static mesh, the volume of the CV will remained fixed for all time steps. ---*/ @@ -525,14 +526,14 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con density could also be temperature dependent, but as it is not a part of the solution vector it's neither stored for previous time steps nor updated with the solution at the end of each iteration. */ - Density_nM1 = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - Density_nP1 = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); + Density_nM1 = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + Density_n = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + Density_nP1 = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); } else{ - Density_nM1 = solver_container[FLOW_SOL]->node[iPoint]->GetSolution_time_n1()[0]; - Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetSolution_time_n()[0]; - Density_nP1 = solver_container[FLOW_SOL]->node[iPoint]->GetSolution()[0]; + Density_nM1 = solver_container[FLOW_SOL]->GetNodes()->GetSolution_time_n1(iPoint)[0]; + Density_n = solver_container[FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint,0); + Density_nP1 = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint,0); } for (iVar = 0; iVar < nVar; iVar++) { @@ -602,13 +603,13 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con /*--- Compute the GCL component of the source term for node i ---*/ - U_time_n = node[iPoint]->GetSolution_time_n(); + U_time_n = nodes->GetSolution_time_n(iPoint); /*--- Multiply by density at node i for the SST model ---*/ if ((turbModel == SST) || (turbModel == SST_SUST)) { - if (incompressible) Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); // Temporary fix - else Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetSolution_time_n()[0]; + if (incompressible) Density_n = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); // Temporary fix + else Density_n = solver_container[FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint,0); for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = Density_n*U_time_n[iVar]*Residual_GCL; } else { @@ -619,13 +620,13 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con /*--- Compute the GCL component of the source term for node j ---*/ - U_time_n = node[jPoint]->GetSolution_time_n(); + U_time_n = nodes->GetSolution_time_n(jPoint); /*--- Multiply by density at node j for the SST model ---*/ if ((turbModel == SST) || (turbModel == SST_SUST)) { - if (incompressible) Density_n = solver_container[FLOW_SOL]->node[jPoint]->GetDensity(); // Temporary fix - else Density_n = solver_container[FLOW_SOL]->node[jPoint]->GetSolution_time_n()[0]; + if (incompressible) Density_n = solver_container[FLOW_SOL]->GetNodes()->GetDensity(jPoint); // Temporary fix + else Density_n = solver_container[FLOW_SOL]->GetNodes()->GetSolution_time_n(jPoint)[0]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = Density_n*U_time_n[iVar]*Residual_GCL; } else { @@ -661,13 +662,13 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con /*--- Compute the GCL component of the source term for node i ---*/ - U_time_n = node[iPoint]->GetSolution_time_n(); + U_time_n = nodes->GetSolution_time_n(iPoint); /*--- Multiply by density at node i for the SST model ---*/ if ((turbModel == SST) || (turbModel == SST_SUST)) { - if (incompressible) Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); // Temporary fix - else Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetSolution_time_n()[0]; + if (incompressible) Density_n = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); // Temporary fix + else Density_n = solver_container[FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint,0); for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = Density_n*U_time_n[iVar]*Residual_GCL; } else { @@ -689,9 +690,9 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, previous solutions that are stored in memory. ---*/ - U_time_nM1 = node[iPoint]->GetSolution_time_n1(); - U_time_n = node[iPoint]->GetSolution_time_n(); - U_time_nP1 = node[iPoint]->GetSolution(); + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); /*--- CV volume at time n-1 and n+1. In the case of dynamically deforming grids, the volumes will change. On rigidly transforming grids, the @@ -713,14 +714,14 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con density could also be temperature dependent, but as it is not a part of the solution vector it's neither stored for previous time steps nor updated with the solution at the end of each iteration. */ - Density_nM1 = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - Density_nP1 = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); + Density_nM1 = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + Density_n = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + Density_nP1 = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); } else{ - Density_nM1 = solver_container[FLOW_SOL]->node[iPoint]->GetSolution_time_n1()[0]; - Density_n = solver_container[FLOW_SOL]->node[iPoint]->GetSolution_time_n()[0]; - Density_nP1 = solver_container[FLOW_SOL]->node[iPoint]->GetSolution()[0]; + Density_nM1 = solver_container[FLOW_SOL]->GetNodes()->GetSolution_time_n1(iPoint)[0]; + Density_n = solver_container[FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint,0); + Density_nP1 = solver_container[FLOW_SOL]->GetNodes()->GetSolution(iPoint,0); } for (iVar = 0; iVar < nVar; iVar++) { @@ -821,7 +822,7 @@ void CTurbSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * index = counter*Restart_Vars[1] + skipVars; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); iPoint_Global_Local++; /*--- Increment the overall counter for how many points have been loaded. ---*/ @@ -861,12 +862,12 @@ void CTurbSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) { Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren); Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume(); - Solution_Fine = solver[iMesh-1][TURB_SOL]->node[Point_Fine]->GetSolution(); + Solution_Fine = solver[iMesh-1][TURB_SOL]->GetNodes()->GetSolution(Point_Fine); for (iVar = 0; iVar < nVar; iVar++) { Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; } } - solver[iMesh][TURB_SOL]->node[iPoint]->SetSolution(Solution); + solver[iMesh][TURB_SOL]->GetNodes()->SetSolution(iPoint,Solution); } solver[iMesh][TURB_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION_EDDY); solver[iMesh][TURB_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION_EDDY); @@ -913,7 +914,6 @@ CTurbSASolver::CTurbSASolver(CGeometry *geometry, CConfig *config, unsigned shor /*--- Define geometry constants in the solver structure ---*/ nDim = geometry->GetnDim(); - node = new CVariable*[nPoint]; /*--- Single grid simulation ---*/ @@ -1054,8 +1054,8 @@ CTurbSASolver::CTurbSASolver(CGeometry *geometry, CConfig *config, unsigned shor /*--- Initialize the solution to the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CTurbSAVariable(nu_tilde_Inf, muT_Inf, nDim, nVar, config); + nodes = new CTurbSAVariable(nu_tilde_Inf, muT_Inf, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); /*--- MPI solution ---*/ @@ -1175,10 +1175,10 @@ void CTurbSASolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe if (kind_hybridRANSLES == SA_EDDES){ for (iPoint = 0; iPoint < nPoint; iPoint++){ - PrimGrad_Flow = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); - Vorticity = solver_container[FLOW_SOL]->node[iPoint]->GetVorticity(); - Laminar_Viscosity = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - node[iPoint]->SetVortex_Tilting(PrimGrad_Flow, Vorticity, Laminar_Viscosity); + PrimGrad_Flow = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); + Vorticity = solver_container[FLOW_SOL]->GetNodes()->GetVorticity(iPoint); + Laminar_Viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + nodes->SetVortex_Tilting(iPoint,PrimGrad_Flow, Vorticity, Laminar_Viscosity); } } @@ -1201,11 +1201,11 @@ void CTurbSASolver::Postprocessing(CGeometry *geometry, CSolver **solver_contain for (iPoint = 0; iPoint < nPoint; iPoint ++) { - rho = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - mu = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + rho = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + mu = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); nu = mu/rho; - nu_hat = node[iPoint]->GetSolution(); + nu_hat = nodes->GetSolution(iPoint); Ji = nu_hat[0]/nu; Ji_3 = Ji*Ji*Ji; @@ -1215,7 +1215,7 @@ void CTurbSASolver::Postprocessing(CGeometry *geometry, CSolver **solver_contain if (neg_spalart_allmaras && (muT < 0.0)) muT = 0.0; - node[iPoint]->SetmuT(muT); + nodes->SetmuT(iPoint,muT); } @@ -1233,28 +1233,28 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai /*--- Conservative variables w/o reconstruction ---*/ - numerics->SetPrimitive(solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(), NULL); + numerics->SetPrimitive(solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint), NULL); /*--- Gradient of the primitive and conservative variables ---*/ - numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(), NULL); + numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint), NULL); /*--- Set vorticity and strain rate magnitude ---*/ - numerics->SetVorticity(solver_container[FLOW_SOL]->node[iPoint]->GetVorticity(), NULL); + numerics->SetVorticity(solver_container[FLOW_SOL]->GetNodes()->GetVorticity(iPoint), NULL); - numerics->SetStrainMag(solver_container[FLOW_SOL]->node[iPoint]->GetStrainMag(), 0.0); + numerics->SetStrainMag(solver_container[FLOW_SOL]->GetNodes()->GetStrainMag(iPoint), 0.0); /*--- Set intermittency ---*/ if (transition) { - numerics->SetIntermittency(solver_container[TRANS_SOL]->node[iPoint]->GetIntermittency()); + numerics->SetIntermittency(solver_container[TRANS_SOL]->GetNodes()->GetIntermittency(iPoint)); } /*--- Turbulent variables w/o reconstruction, and its gradient ---*/ - numerics->SetTurbVar(node[iPoint]->GetSolution(), NULL); - numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), NULL); + numerics->SetTurbVar(nodes->GetSolution(iPoint), NULL); + numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), NULL); /*--- Set volume ---*/ @@ -1272,7 +1272,7 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai /*--- Set DES length scale ---*/ - numerics->SetDistance(node[iPoint]->GetDES_LengthScale(), 0.0); + numerics->SetDistance(nodes->GetDES_LengthScale(iPoint), 0.0); } @@ -1283,7 +1283,7 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai /*--- Store the intermittency ---*/ if (transition_BC) { - node[iPoint]->SetGammaBC(numerics->GetGammaBC()); + nodes->SetGammaBC(iPoint,numerics->GetGammaBC()); } /*--- Subtract residual and the Jacobian ---*/ @@ -1310,7 +1310,7 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai /*--- Access stored harmonic balance source term ---*/ for (unsigned short iVar = 0; iVar < nVar_Turb; iVar++) { - Source = node[iPoint]->GetHarmonicBalance_Source(iVar); + Source = nodes->GetHarmonicBalance_Source(iPoint,iVar); Residual[iVar] = Source*Volume; } @@ -1350,7 +1350,7 @@ void CTurbSASolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_conta for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; - node[iPoint]->SetSolution_Old(Solution); + nodes->SetSolution_Old(iPoint,Solution); LinSysRes.SetBlock_Zero(iPoint); /*--- Includes 1 in the diagonal ---*/ @@ -1385,7 +1385,7 @@ void CTurbSASolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_con for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; - node[iPoint]->SetSolution_Old(Solution); + nodes->SetSolution_Old(iPoint,Solution); LinSysRes.SetBlock_Zero(iPoint); /*--- Includes 1 in the diagonal ---*/ @@ -1418,7 +1418,7 @@ void CTurbSASolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Grid Movement ---*/ @@ -1430,7 +1430,7 @@ void CTurbSASolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container /*--- Set turbulent variable at the wall, and at infinity ---*/ for (iVar = 0; iVar < nVar; iVar++) - Solution_i[iVar] = node[iPoint]->GetSolution(iVar); + Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); Solution_j[0] = nu_tilde_Inf; conv_numerics->SetTurbVar(Solution_i, Solution_j); @@ -1488,7 +1488,7 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -1496,7 +1496,7 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN /*--- Set the turbulent variable states (prescribed for an inflow) ---*/ - Solution_i[0] = node[iPoint]->GetSolution(0); + Solution_i[0] = nodes->GetSolution(iPoint,0); /*--- Load the inlet turbulence variable (uniform by default). ---*/ @@ -1575,7 +1575,7 @@ void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, C /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -1588,8 +1588,8 @@ void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, C Solution_j --> TurbVar_outlet ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Solution_i[iVar] = node[iPoint]->GetSolution(iVar); - Solution_j[iVar] = node[iPoint]->GetSolution(iVar); + Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); + Solution_j[iVar] = nodes->GetSolution(iPoint,iVar); } conv_numerics->SetTurbVar(Solution_i, Solution_j); @@ -1669,7 +1669,7 @@ void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_conta /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -1679,7 +1679,7 @@ void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_conta that the turbulent variable is copied from the interior of the domain to the outlet before computing the residual. ---*/ - conv_numerics->SetTurbVar(node[iPoint]->GetSolution(), node[iPoint]->GetSolution()); + conv_numerics->SetTurbVar(nodes->GetSolution(iPoint), nodes->GetSolution(iPoint)); /*--- Set Normal (negate for outward convention) ---*/ @@ -1767,7 +1767,7 @@ void CTurbSASolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_cont /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -1775,7 +1775,7 @@ void CTurbSASolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_cont /*--- Set the turbulent variable states (prescribed for an inflow) ---*/ - Solution_i[0] = node[iPoint]->GetSolution(0); + Solution_i[0] = nodes->GetSolution(iPoint,0); Solution_j[0] = nu_tilde_Engine; conv_numerics->SetTurbVar(Solution_i, Solution_j); @@ -1885,7 +1885,7 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Check the flow direction. Project the flow into the normal to the inlet face ---*/ @@ -1919,10 +1919,10 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, domain to the outlet before computing the residual. or set the turbulent variable states (prescribed for an inflow) ----*/ - Solution_i[0] = node[iPoint]->GetSolution(0); + Solution_i[0] = nodes->GetSolution(iPoint,0); - // if (val_inlet_surface) Solution_j[0] = 0.5*(node[iPoint]->GetSolution(0)+V_outlet [nDim+9]); - // else Solution_j[0] = 0.5*(node[iPoint]->GetSolution(0)+V_inlet [nDim+9]); + // if (val_inlet_surface) Solution_j[0] = 0.5*(nodes->GetSolution(iPoint,0)+V_outlet [nDim+9]); + // else Solution_j[0] = 0.5*(nodes->GetSolution(iPoint,0)+V_inlet [nDim+9]); // /*--- Inflow analysis (interior extrapolation) ---*/ // if (((val_inlet_surface) && (!ReverseFlow)) || ((!val_inlet_surface) && (ReverseFlow))) { @@ -1937,7 +1937,7 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, /*--- Inflow analysis (interior extrapolation) ---*/ if (((val_inlet_surface) && (!ReverseFlow)) || ((!val_inlet_surface) && (ReverseFlow))) { - Solution_j[0] = node[iPoint]->GetSolution(0); + Solution_j[0] = nodes->GetSolution(iPoint,0); } /*--- Outflow analysis ---*/ @@ -2036,7 +2036,7 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -2044,7 +2044,7 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c /*--- Set the turbulent variable states (prescribed for an inflow) ---*/ - Solution_i[0] = node[iPoint]->GetSolution(0); + Solution_i[0] = nodes->GetSolution(iPoint,0); Solution_j[0] = extAverageNu; conv_numerics->SetTurbVar(Solution_i, Solution_j); @@ -2084,7 +2084,7 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c /*--- Turbulent variables w/o reconstruction, and its gradients ---*/ visc_numerics->SetTurbVar(Solution_i, Solution_j); - visc_numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute residual, and Jacobians ---*/ @@ -2153,7 +2153,7 @@ void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contain /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -2161,7 +2161,7 @@ void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contain /*--- Set the turbulent variable states (prescribed for an inflow) ---*/ - Solution_i[0] = node[iPoint]->GetSolution(0); + Solution_i[0] = nodes->GetSolution(iPoint,0); Solution_j[0] = nu_tilde; conv_numerics->SetTurbVar(Solution_i, Solution_j); @@ -2201,7 +2201,7 @@ void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contain /*--- Turbulent variables w/o reconstruction, and its gradients ---*/ visc_numerics->SetTurbVar(Solution_i, Solution_j); - visc_numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute residual, and Jacobians ---*/ @@ -2242,8 +2242,8 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_ // // /*--- Store the solution for both points ---*/ // for (iVar = 0; iVar < nVar; iVar++) { - // Solution_i[iVar] = node[iPoint]->GetSolution(iVar); - // Solution_j[iVar] = node[jPoint]->GetSolution(iVar); + // Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); + // Solution_j[iVar] = nodes->GetSolution(jPoint,iVar); // } // // /*--- Set Conservative Variables ---*/ @@ -2299,7 +2299,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_ // /*--- We only send the information that belong to other boundary ---*/ // if ((jProcessor != rank) && compute) { // - // Conserv_Var = node[iPoint]->GetSolution(); + // Conserv_Var = nodes->GetSolution(iPoint); // Flow_Var = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); // // for (iVar = 0; iVar < nVar; iVar++) @@ -2336,7 +2336,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_ // else { // // for (iVar = 0; iVar < nVar; iVar++) - // Buffer_Receive_U[iVar] = node[jPoint]->GetSolution(iVar); + // Buffer_Receive_U[iVar] = nodes->GetSolution(jPoint,iVar); // // for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++) // Buffer_Send_U[nVar+iVar] = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(iVar); @@ -2345,7 +2345,7 @@ void CTurbSASolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_ // // /*--- Store the solution for both points ---*/ // for (iVar = 0; iVar < nVar; iVar++) { - // Solution_i[iVar] = node[iPoint]->GetSolution(iVar); + // Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); // Solution_j[iVar] = Buffer_Receive_U[iVar]; // } // @@ -2424,7 +2424,7 @@ void CTurbSASolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_con for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; for (iVar = 0; iVar < nPrimVar; iVar++) { - PrimVar_i[iVar] = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint,iVar); PrimVar_j[iVar] = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, iVar, jVertex); } @@ -2437,7 +2437,7 @@ void CTurbSASolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_con conv_numerics->SetPrimitive( PrimVar_i, PrimVar_j ); /*--- Set the turbulent variable states ---*/ - Solution_i[0] = node[iPoint]->GetSolution(0); + Solution_i[0] = nodes->GetSolution(iPoint,0); Solution_j[0] = GetSlidingState(iMarker, iVertex, 0, jVertex); conv_numerics->SetTurbVar(Solution_i, Solution_j); @@ -2478,7 +2478,7 @@ void CTurbSASolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_con /*--- Turbulent variables and its gradients ---*/ visc_numerics->SetTurbVar(Solution_i, Solution_j); - visc_numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute and update residual ---*/ @@ -2526,8 +2526,8 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_ // // /*--- Store the solution for both points ---*/ // for (iVar = 0; iVar < nVar; iVar++) { - // Solution_i[iVar] = node[iPoint]->GetSolution(iVar); - // Solution_j[iVar] = node[jPoint]->GetSolution(iVar); + // Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); + // Solution_j[iVar] = nodes->GetSolution(jPoint,iVar); // } // // /*--- Set Conservative Variables ---*/ @@ -2583,7 +2583,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_ // /*--- We only send the information that belong to other boundary ---*/ // if ((jProcessor != rank) && compute) { // - // Conserv_Var = node[iPoint]->GetSolution(); + // Conserv_Var = nodes->GetSolution(iPoint); // Flow_Var = solver_container[FLOW_SOL]->node[iPoint]->GetSolution(); // // for (iVar = 0; iVar < nVar; iVar++) @@ -2620,7 +2620,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_ // else { // // for (iVar = 0; iVar < nVar; iVar++) - // Buffer_Receive_U[iVar] = node[jPoint]->GetSolution(iVar); + // Buffer_Receive_U[iVar] = nodes->GetSolution(jPoint,iVar); // // for (iVar = 0; iVar < solver_container[FLOW_SOL]->GetnVar(); iVar++) // Buffer_Send_U[nVar+iVar] = solver_container[FLOW_SOL]->node[jPoint]->GetSolution(iVar); @@ -2629,7 +2629,7 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_ // // /*--- Store the solution for both points ---*/ // for (iVar = 0; iVar < nVar; iVar++) { - // Solution_i[iVar] = node[iPoint]->GetSolution(iVar); + // Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); // Solution_j[iVar] = Buffer_Receive_U[iVar]; // } // @@ -2756,9 +2756,9 @@ void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_containe (normal) interior point. ---*/ for (iDim = 0; iDim < nDim; iDim++) - Vel[iDim] = solver_container[FLOW_SOL]->node[iPoint_Neighbor]->GetVelocity(iDim); - P_Normal = solver_container[FLOW_SOL]->node[iPoint_Neighbor]->GetPressure(); - T_Normal = solver_container[FLOW_SOL]->node[iPoint_Neighbor]->GetTemperature(); + Vel[iDim] = solver_container[FLOW_SOL]->GetNodes()->GetVelocity(iPoint_Neighbor,iDim); + P_Normal = solver_container[FLOW_SOL]->GetNodes()->GetPressure(iPoint_Neighbor); + T_Normal = solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint_Neighbor); /*--- Compute the wall-parallel velocity at first point off the wall ---*/ @@ -2801,8 +2801,8 @@ void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_containe /*--- Compute the shear stress at the wall in the regular fashion by using the stress tensor on the surface ---*/ - Lam_Visc_Wall = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - grad_primvar = solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); + Lam_Visc_Wall = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + grad_primvar = solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); div_vel = 0.0; for (iDim = 0; iDim < nDim; iDim++) @@ -2888,8 +2888,8 @@ void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_containe /*--- Now compute the Eddy viscosity at the first point off of the wall ---*/ - Lam_Visc_Normal = solver_container[FLOW_SOL]->node[iPoint_Neighbor]->GetLaminarViscosity(); - Density_Normal = solver_container[FLOW_SOL]->node[iPoint_Neighbor]->GetDensity(); + Lam_Visc_Normal = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint_Neighbor); + Density_Normal = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint_Neighbor); Kin_Visc_Normal = Lam_Visc_Normal/Density_Normal; dypw_dyp = 2.0*Y_Plus_White*(kappa*sqrt(Gam)/Q)*sqrt(1.0 - pow(2.0*Gam*U_Plus - Beta,2.0)/(Q*Q)); @@ -2905,7 +2905,7 @@ void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_containe /*--- Solve for the new value of nu_tilde given the eddy viscosity and using a Newton method ---*/ nu_til_old = 0.0; nu_til = 0.0; cv1_3 = 7.1*7.1*7.1; - nu_til_old = node[iPoint]->GetSolution(0); + nu_til_old = nodes->GetSolution(iPoint,0); counter = 0; diff = 1.0; while (diff > tol) { @@ -2928,7 +2928,7 @@ void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_containe for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = nu_til; - node[iPoint_Neighbor]->SetSolution_Old(Solution); + nodes->SetSolution_Old(iPoint_Neighbor,Solution); LinSysRes.SetBlock_Zero(iPoint_Neighbor); /*--- includes 1 in the diagonal ---*/ @@ -2968,11 +2968,11 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC coord_i = geometry->node[iPoint]->GetCoord(); nNeigh = geometry->node[iPoint]->GetnPoint(); wallDistance = geometry->node[iPoint]->GetWall_Distance(); - primVarGrad = solver[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(); - vorticity = solver[FLOW_SOL]->node[iPoint]->GetVorticity(); - density = solver[FLOW_SOL]->node[iPoint]->GetDensity(); - laminarViscosity = solver[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); - eddyViscosity = solver[TURB_SOL]->node[iPoint]->GetmuT(); + primVarGrad = solver[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint); + vorticity = solver[FLOW_SOL]->GetNodes()->GetVorticity(iPoint); + density = solver[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + laminarViscosity = solver[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); + eddyViscosity = solver[TURB_SOL]->GetNodes()->GetmuT(iPoint); kinematicViscosity = laminarViscosity/density; kinematicViscosityTurb = eddyViscosity/density; @@ -2987,7 +2987,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC /*--- Low Reynolds number correction term ---*/ - nu_hat = node[iPoint]->GetSolution()[0]; + nu_hat = nodes->GetSolution(iPoint,0); Ji = nu_hat/kinematicViscosity; Ji_2 = Ji * Ji; Ji_3 = Ji*Ji*Ji; @@ -3074,7 +3074,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC Flow Turbulence Combust - 2015 ---*/ - vortexTiltingMeasure = node[iPoint]->GetVortex_Tilting(); + vortexTiltingMeasure = nodes->GetVortex_Tilting(iPoint); omega = sqrt(vorticity[0]*vorticity[0] + vorticity[1]*vorticity[1] + @@ -3098,7 +3098,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC ln[2] = delta[0]*ratioOmega[1] - delta[1]*ratioOmega[0]; aux_ln = sqrt(ln[0]*ln[0] + ln[1]*ln[1] + ln[2]*ln[2]); ln_max = max(ln_max,aux_ln); - vortexTiltingMeasure += node[jPoint]->GetVortex_Tilting(); + vortexTiltingMeasure += nodes->GetVortex_Tilting(jPoint); } vortexTiltingMeasure = (vortexTiltingMeasure/fabs(nNeigh + 1.0)); @@ -3120,7 +3120,7 @@ void CTurbSASolver::SetDES_LengthScale(CSolver **solver, CGeometry *geometry, CC } - node[iPoint]->SetDES_LengthScale(lengthScale); + nodes->SetDES_LengthScale(iPoint,lengthScale); } } @@ -3240,7 +3240,6 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned sh /*--- Define geometry constants in the solver structure ---*/ nDim = geometry->GetnDim(); - node = new CVariable*[nPoint]; /*--- Single grid simulation ---*/ @@ -3374,8 +3373,8 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned sh /*--- Initialize the solution to the far-field state everywhere. ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++) - node[iPoint] = new CTurbSSTVariable(kine_Inf, omega_Inf, muT_Inf, nDim, nVar, constants, config); + nodes = new CTurbSSTVariable(kine_Inf, omega_Inf, muT_Inf, nPoint, nDim, nVar, constants, config); + SetBaseClassPointerToNodes(); /*--- MPI solution ---*/ @@ -3511,24 +3510,24 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai /*--- Compute blending functions and cross diffusion ---*/ - rho = solver_container[FLOW_SOL]->node[iPoint]->GetDensity(); - mu = solver_container[FLOW_SOL]->node[iPoint]->GetLaminarViscosity(); + rho = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint); + mu = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); dist = geometry->node[iPoint]->GetWall_Distance(); - strMag = solver_container[FLOW_SOL]->node[iPoint]->GetStrainMag(); + strMag = solver_container[FLOW_SOL]->GetNodes()->GetStrainMag(iPoint); - node[iPoint]->SetBlendingFunc(mu, dist, rho); + nodes->SetBlendingFunc(iPoint,mu, dist, rho); - F2 = node[iPoint]->GetF2blending(); + F2 = nodes->GetF2blending(iPoint); /*--- Compute the eddy viscosity ---*/ - kine = node[iPoint]->GetSolution(0); - omega = node[iPoint]->GetSolution(1); + kine = nodes->GetSolution(iPoint,0); + omega = nodes->GetSolution(iPoint,1); zeta = min(1.0/omega, a1/(strMag*F2)); muT = min(max(rho*kine*zeta,0.0),1.0); - node[iPoint]->SetmuT(muT); + nodes->SetmuT(iPoint,muT); } @@ -3542,16 +3541,16 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Conservative variables w/o reconstruction ---*/ - numerics->SetPrimitive(solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(), NULL); + numerics->SetPrimitive(solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint), NULL); /*--- Gradient of the primitive and conservative variables ---*/ - numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->node[iPoint]->GetGradient_Primitive(), NULL); + numerics->SetPrimVarGradient(solver_container[FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint), NULL); /*--- Turbulent variables w/o reconstruction, and its gradient ---*/ - numerics->SetTurbVar(node[iPoint]->GetSolution(), NULL); - numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), NULL); + numerics->SetTurbVar(nodes->GetSolution(iPoint), NULL); + numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), NULL); /*--- Set volume ---*/ @@ -3563,21 +3562,21 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Menter's first blending function ---*/ - numerics->SetF1blending(node[iPoint]->GetF1blending(),0.0); + numerics->SetF1blending(nodes->GetF1blending(iPoint),0.0); /*--- Menter's second blending function ---*/ - numerics->SetF2blending(node[iPoint]->GetF2blending(),0.0); + numerics->SetF2blending(nodes->GetF2blending(iPoint),0.0); /*--- Set vorticity and strain rate magnitude ---*/ - numerics->SetVorticity(solver_container[FLOW_SOL]->node[iPoint]->GetVorticity(), NULL); + numerics->SetVorticity(solver_container[FLOW_SOL]->GetNodes()->GetVorticity(iPoint), NULL); - numerics->SetStrainMag(solver_container[FLOW_SOL]->node[iPoint]->GetStrainMag(), 0.0); + numerics->SetStrainMag(solver_container[FLOW_SOL]->GetNodes()->GetStrainMag(iPoint), 0.0); /*--- Cross diffusion ---*/ - numerics->SetCrossDiff(node[iPoint]->GetCrossDiff(),0.0); + numerics->SetCrossDiff(nodes->GetCrossDiff(iPoint),0.0); /*--- Compute the source term ---*/ @@ -3620,8 +3619,8 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont /*--- Set wall values ---*/ - density = solver_container[FLOW_SOL]->node[jPoint]->GetDensity(); - laminar_viscosity = solver_container[FLOW_SOL]->node[jPoint]->GetLaminarViscosity(); + density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(jPoint); + laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(jPoint); beta_1 = constants[4]; @@ -3629,8 +3628,8 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont Solution[1] = 60.0*laminar_viscosity/(density*beta_1*distance*distance); /*--- Set the solution values and zero the residual ---*/ - node[iPoint]->SetSolution_Old(Solution); - node[iPoint]->SetSolution(Solution); + nodes->SetSolution_Old(iPoint,Solution); + nodes->SetSolution(iPoint,Solution); LinSysRes.SetBlock_Zero(iPoint); /*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/ @@ -3668,8 +3667,8 @@ void CTurbSSTSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_co /*--- Set wall values ---*/ - density = solver_container[FLOW_SOL]->node[jPoint]->GetDensity(); - laminar_viscosity = solver_container[FLOW_SOL]->node[jPoint]->GetLaminarViscosity(); + density = solver_container[FLOW_SOL]->GetNodes()->GetDensity(jPoint); + laminar_viscosity = solver_container[FLOW_SOL]->GetNodes()->GetLaminarViscosity(jPoint); beta_1 = constants[4]; @@ -3677,8 +3676,8 @@ void CTurbSSTSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_co Solution[1] = 60.0*laminar_viscosity/(density*beta_1*distance*distance); /*--- Set the solution values and zero the residual ---*/ - node[iPoint]->SetSolution_Old(Solution); - node[iPoint]->SetSolution(Solution); + nodes->SetSolution_Old(iPoint,Solution); + nodes->SetSolution(iPoint,Solution); LinSysRes.SetBlock_Zero(iPoint); /*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/ @@ -3714,14 +3713,14 @@ void CTurbSSTSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); conv_numerics->SetPrimitive(V_domain, V_infty); /*--- Set turbulent variable at the wall, and at infinity ---*/ for (iVar = 0; iVar < nVar; iVar++) - Solution_i[iVar] = node[iPoint]->GetSolution(iVar); + Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); Solution_j[0] = kine_Inf; Solution_j[1] = omega_Inf; @@ -3788,7 +3787,7 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -3798,7 +3797,7 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C values for the turbulent state at the inflow. ---*/ for (iVar = 0; iVar < nVar; iVar++) - Solution_i[iVar] = node[iPoint]->GetSolution(iVar); + Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Load the inlet turbulence variables (uniform by default). ---*/ @@ -3884,7 +3883,7 @@ void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -3897,8 +3896,8 @@ void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, Solution_j --> TurbVar_outlet ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Solution_i[iVar] = node[iPoint]->GetSolution(iVar); - Solution_j[iVar] = node[iPoint]->GetSolution(iVar); + Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); + Solution_j[iVar] = nodes->GetSolution(iPoint,iVar); } conv_numerics->SetTurbVar(Solution_i, Solution_j); @@ -4001,7 +4000,7 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_ /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ @@ -4010,7 +4009,7 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_ /*--- Set the turbulent variable states (prescribed for an inflow) ---*/ for (iVar = 0; iVar < nVar; iVar++) - Solution_i[iVar] = node[iPoint]->GetSolution(iVar); + Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); Solution_j[0]= extAverageKine; Solution_j[1]= extAverageOmega; @@ -4040,10 +4039,10 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_ /*--- Turbulent variables w/o reconstruction, and its gradients ---*/ visc_numerics->SetTurbVar(Solution_i, Solution_j); - visc_numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Menter's first blending function ---*/ - visc_numerics->SetF1blending(node[iPoint]->GetF1blending(), node[iPoint]->GetF1blending()); + visc_numerics->SetF1blending(nodes->GetF1blending(iPoint), nodes->GetF1blending(iPoint)); /*--- Compute residual, and Jacobians ---*/ visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config); @@ -4126,14 +4125,14 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai /*--- Retrieve solution at the farfield boundary node ---*/ - V_domain = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(); + V_domain = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint); /*--- Set various quantities in the solver class ---*/ conv_numerics->SetPrimitive(V_domain, V_inlet); for (iVar = 0; iVar < nVar; iVar++) - Solution_i[iVar] = node[iPoint]->GetSolution(iVar); + Solution_i[iVar] = nodes->GetSolution(iPoint,iVar); /*--- Set the turbulent variable states. Use average span-wise values values for the turbulent state at the inflow. ---*/ @@ -4166,10 +4165,10 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai /*--- Turbulent variables w/o reconstruction, and its gradients ---*/ visc_numerics->SetTurbVar(Solution_i, Solution_j); - visc_numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Menter's first blending function ---*/ - visc_numerics->SetF1blending(node[iPoint]->GetF1blending(), node[iPoint]->GetF1blending()); + visc_numerics->SetF1blending(nodes->GetF1blending(iPoint), nodes->GetF1blending(iPoint)); /*--- Compute residual, and Jacobians ---*/ visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config); @@ -4229,7 +4228,7 @@ void CTurbSSTSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_co for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; for (iVar = 0; iVar < nPrimVar; iVar++) { - PrimVar_i[iVar] = solver_container[FLOW_SOL]->node[iPoint]->GetPrimitive(iVar); + PrimVar_i[iVar] = solver_container[FLOW_SOL]->GetNodes()->GetPrimitive(iPoint,iVar); PrimVar_j[iVar] = solver_container[FLOW_SOL]->GetSlidingState(iMarker, iVertex, iVar, jVertex); } @@ -4242,8 +4241,8 @@ void CTurbSSTSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_co conv_numerics->SetPrimitive( PrimVar_i, PrimVar_j ); /*--- Set the turbulent variable states ---*/ - Solution_i[0] = node[iPoint]->GetSolution(0); - Solution_i[1] = node[iPoint]->GetSolution(1); + Solution_i[0] = nodes->GetSolution(iPoint,0); + Solution_i[1] = nodes->GetSolution(iPoint,1); Solution_j[0] = GetSlidingState(iMarker, iVertex, 0, jVertex); Solution_j[1] = GetSlidingState(iMarker, iVertex, 1, jVertex); @@ -4284,7 +4283,7 @@ void CTurbSSTSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_co /*--- Turbulent variables and its gradients ---*/ visc_numerics->SetTurbVar(Solution_i, Solution_j); - visc_numerics->SetTurbVarGradient(node[iPoint]->GetGradient(), node[iPoint]->GetGradient()); + visc_numerics->SetTurbVarGradient(nodes->GetGradient(iPoint), nodes->GetGradient(iPoint)); /*--- Compute and update residual ---*/ diff --git a/SU2_CFD/src/solver_structure.cpp b/SU2_CFD/src/solver_structure.cpp index 681bad8cc2d0..464ff29ec7ed 100644 --- a/SU2_CFD/src/solver_structure.cpp +++ b/SU2_CFD/src/solver_structure.cpp @@ -102,9 +102,9 @@ CSolver::CSolver(bool mesh_deform_mode) : System(mesh_deform_mode) { Cvector = NULL; Restart_Vars = NULL; Restart_Data = NULL; - node = NULL; + base_nodes = nullptr; nOutputVariables = 0; - valResidual = 0.0; + valResidual = 0.0; /*--- Inlet profile data structures. ---*/ @@ -146,21 +146,14 @@ CSolver::CSolver(bool mesh_deform_mode) : System(mesh_deform_mode) { CSolver::~CSolver(void) { unsigned short iVar, iDim; - unsigned long iPoint, iMarker, iVertex; - + unsigned long iMarker, iVertex; + /*--- Public variables, may be accessible outside ---*/ if ( OutputHeadingNames != NULL) { delete [] OutputHeadingNames; } - if (node != NULL) { - for (iPoint = 0; iPoint < nPoint; iPoint++) { - delete node[iPoint]; - } - delete [] node; - } - /*--- Private ---*/ if (Residual_RMS != NULL) delete [] Residual_RMS; @@ -552,7 +545,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Load the time step for the current point. ---*/ - bufDSend[buf_offset] = node[iPoint]->GetDelta_Time(); + bufDSend[buf_offset] = base_nodes->GetDelta_Time(iPoint); buf_offset++; /*--- For implicit calculations, we will communicate the @@ -612,27 +605,27 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, linear solve. ---*/ for (iVar = 0; iVar < nVar; iVar++) { - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); } /*--- Rotate the momentum components of the solution array. ---*/ if (rotate_periodic) { if (nDim == 2) { - bufDSend[buf_offset+1] = (rotMatrix[0][0]*node[iPoint]->GetSolution(1) + - rotMatrix[0][1]*node[iPoint]->GetSolution(2)); - bufDSend[buf_offset+2] = (rotMatrix[1][0]*node[iPoint]->GetSolution(1) + - rotMatrix[1][1]*node[iPoint]->GetSolution(2)); + bufDSend[buf_offset+1] = (rotMatrix[0][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetSolution(iPoint,2)); + bufDSend[buf_offset+2] = (rotMatrix[1][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetSolution(iPoint,2)); } else { - bufDSend[buf_offset+1] = (rotMatrix[0][0]*node[iPoint]->GetSolution(1) + - rotMatrix[0][1]*node[iPoint]->GetSolution(2) + - rotMatrix[0][2]*node[iPoint]->GetSolution(3)); - bufDSend[buf_offset+2] = (rotMatrix[1][0]*node[iPoint]->GetSolution(1) + - rotMatrix[1][1]*node[iPoint]->GetSolution(2) + - rotMatrix[1][2]*node[iPoint]->GetSolution(3)); - bufDSend[buf_offset+3] = (rotMatrix[2][0]*node[iPoint]->GetSolution(1) + - rotMatrix[2][1]*node[iPoint]->GetSolution(2) + - rotMatrix[2][2]*node[iPoint]->GetSolution(3)); + bufDSend[buf_offset+1] = (rotMatrix[0][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetSolution(iPoint,2) + + rotMatrix[0][2]*base_nodes->GetSolution(iPoint,3)); + bufDSend[buf_offset+2] = (rotMatrix[1][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetSolution(iPoint,2) + + rotMatrix[1][2]*base_nodes->GetSolution(iPoint,3)); + bufDSend[buf_offset+3] = (rotMatrix[2][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[2][1]*base_nodes->GetSolution(iPoint,2) + + rotMatrix[2][2]*base_nodes->GetSolution(iPoint,3)); } } @@ -658,16 +651,16 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Solution differences ---*/ for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = (node[iPoint]->GetSolution(iVar) - - node[jPoint]->GetSolution(iVar)); + Diff[iVar] = (base_nodes->GetSolution(iPoint, iVar) - + base_nodes->GetSolution(jPoint,iVar)); /*--- Correction for compressible flows (use enthalpy) ---*/ if (!(config->GetKind_Regime() == INCOMPRESSIBLE)) { - Pressure_i = node[iPoint]->GetPressure(); - Pressure_j = node[jPoint]->GetPressure(); - Diff[nVar-1] = ((node[iPoint]->GetSolution(nVar-1) + Pressure_i) - - (node[jPoint]->GetSolution(nVar-1) + Pressure_j)); + Pressure_i = base_nodes->GetPressure(iPoint); + Pressure_j = base_nodes->GetPressure(jPoint); + Diff[nVar-1] = ((base_nodes->GetSolution(iPoint,nVar-1) + Pressure_i) - + (base_nodes->GetSolution(jPoint,nVar-1) + Pressure_j)); } boundary_i = geometry->node[iPoint]->GetPhysicalBoundary(); @@ -727,7 +720,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Simple summation of eig calc on both periodic faces. ---*/ - bufDSend[buf_offset] = node[iPoint]->GetLambda(); + bufDSend[buf_offset] = base_nodes->GetLambda(iPoint); break; @@ -749,11 +742,11 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Use density instead of pressure for incomp. flows. ---*/ if ((config->GetKind_Regime() == INCOMPRESSIBLE)) { - Pressure_i = node[iPoint]->GetDensity(); - Pressure_j = node[jPoint]->GetDensity(); + Pressure_i = base_nodes->GetDensity(iPoint); + Pressure_j = base_nodes->GetDensity(jPoint); } else { - Pressure_i = node[iPoint]->GetPressure(); - Pressure_j = node[jPoint]->GetPressure(); + Pressure_i = base_nodes->GetPressure(iPoint); + Pressure_j = base_nodes->GetPressure(jPoint); } boundary_i = geometry->node[iPoint]->GetPhysicalBoundary(); @@ -799,8 +792,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - jacBlock[iVar][iDim] = node[iPoint]->GetGradient(iVar, iDim); - rotBlock[iVar][iDim] = node[iPoint]->GetGradient(iVar, iDim); + jacBlock[iVar][iDim] = base_nodes->GetGradient(iPoint, iVar, iDim); + rotBlock[iVar][iDim] = base_nodes->GetGradient(iPoint, iVar, iDim); } } @@ -844,8 +837,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++){ - jacBlock[iVar][iDim] = node[iPoint]->GetGradient_Primitive(iVar, iDim); - rotBlock[iVar][iDim] = node[iPoint]->GetGradient_Primitive(iVar, iDim); + jacBlock[iVar][iDim] = base_nodes->GetGradient_Primitive(iPoint, iVar, iDim); + rotBlock[iVar][iDim] = base_nodes->GetGradient_Primitive(iPoint, iVar, iDim); } } @@ -916,25 +909,25 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Get conservative solution and rotate if necessary. ---*/ for (iVar = 0; iVar < nVar; iVar++) - rotPrim_i[iVar] = node[iPoint]->GetSolution(iVar); + rotPrim_i[iVar] = base_nodes->GetSolution(iPoint, iVar); if (rotate_periodic) { if (nDim == 2) { - rotPrim_i[1] = (rotMatrix[0][0]*node[iPoint]->GetSolution(1) + - rotMatrix[0][1]*node[iPoint]->GetSolution(2)); - rotPrim_i[2] = (rotMatrix[1][0]*node[iPoint]->GetSolution(1) + - rotMatrix[1][1]*node[iPoint]->GetSolution(2)); + rotPrim_i[1] = (rotMatrix[0][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetSolution(iPoint,2)); + rotPrim_i[2] = (rotMatrix[1][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetSolution(iPoint,2)); } else { - rotPrim_i[1] = (rotMatrix[0][0]*node[iPoint]->GetSolution(1) + - rotMatrix[0][1]*node[iPoint]->GetSolution(2) + - rotMatrix[0][2]*node[iPoint]->GetSolution(3)); - rotPrim_i[2] = (rotMatrix[1][0]*node[iPoint]->GetSolution(1) + - rotMatrix[1][1]*node[iPoint]->GetSolution(2) + - rotMatrix[1][2]*node[iPoint]->GetSolution(3)); - rotPrim_i[3] = (rotMatrix[2][0]*node[iPoint]->GetSolution(1) + - rotMatrix[2][1]*node[iPoint]->GetSolution(2) + - rotMatrix[2][2]*node[iPoint]->GetSolution(3)); + rotPrim_i[1] = (rotMatrix[0][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetSolution(iPoint,2) + + rotMatrix[0][2]*base_nodes->GetSolution(iPoint,3)); + rotPrim_i[2] = (rotMatrix[1][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetSolution(iPoint,2) + + rotMatrix[1][2]*base_nodes->GetSolution(iPoint,3)); + rotPrim_i[3] = (rotMatrix[2][0]*base_nodes->GetSolution(iPoint,1) + + rotMatrix[2][1]*base_nodes->GetSolution(iPoint,2) + + rotMatrix[2][2]*base_nodes->GetSolution(iPoint,3)); } } @@ -983,25 +976,25 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Get conservative solution and rotte if necessary. ---*/ for (iVar = 0; iVar < nVar; iVar++) - rotPrim_j[iVar] = node[jPoint]->GetSolution(iVar); + rotPrim_j[iVar] = base_nodes->GetSolution(jPoint,iVar); if (rotate_periodic) { if (nDim == 2) { - rotPrim_j[1] = (rotMatrix[0][0]*node[jPoint]->GetSolution(1) + - rotMatrix[0][1]*node[jPoint]->GetSolution(2)); - rotPrim_j[2] = (rotMatrix[1][0]*node[jPoint]->GetSolution(1) + - rotMatrix[1][1]*node[jPoint]->GetSolution(2)); + rotPrim_j[1] = (rotMatrix[0][0]*base_nodes->GetSolution(jPoint,1) + + rotMatrix[0][1]*base_nodes->GetSolution(jPoint,2)); + rotPrim_j[2] = (rotMatrix[1][0]*base_nodes->GetSolution(jPoint,1) + + rotMatrix[1][1]*base_nodes->GetSolution(jPoint,2)); } else { - rotPrim_j[1] = (rotMatrix[0][0]*node[jPoint]->GetSolution(1) + - rotMatrix[0][1]*node[jPoint]->GetSolution(2) + - rotMatrix[0][2]*node[jPoint]->GetSolution(3)); - rotPrim_j[2] = (rotMatrix[1][0]*node[jPoint]->GetSolution(1) + - rotMatrix[1][1]*node[jPoint]->GetSolution(2) + - rotMatrix[1][2]*node[jPoint]->GetSolution(3)); - rotPrim_j[3] = (rotMatrix[2][0]*node[jPoint]->GetSolution(1) + - rotMatrix[2][1]*node[jPoint]->GetSolution(2) + - rotMatrix[2][2]*node[jPoint]->GetSolution(3)); + rotPrim_j[1] = (rotMatrix[0][0]*base_nodes->GetSolution(jPoint,1) + + rotMatrix[0][1]*base_nodes->GetSolution(jPoint,2) + + rotMatrix[0][2]*base_nodes->GetSolution(jPoint,3)); + rotPrim_j[2] = (rotMatrix[1][0]*base_nodes->GetSolution(jPoint,1) + + rotMatrix[1][1]*base_nodes->GetSolution(jPoint,2) + + rotMatrix[1][2]*base_nodes->GetSolution(jPoint,3)); + rotPrim_j[3] = (rotMatrix[2][0]*base_nodes->GetSolution(jPoint,1) + + rotMatrix[2][1]*base_nodes->GetSolution(jPoint,2) + + rotMatrix[2][2]*base_nodes->GetSolution(jPoint,3)); } } @@ -1114,25 +1107,25 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Get primitives and rotate if necessary. ---*/ for (iVar = 0; iVar < nPrimVar; iVar++) - rotPrim_i[iVar] = node[iPoint]->GetPrimitive(iVar); + rotPrim_i[iVar] = base_nodes->GetPrimitive(iPoint, iVar); if (rotate_periodic) { if (nDim == 2) { - rotPrim_i[1] = (rotMatrix[0][0]*node[iPoint]->GetPrimitive(1) + - rotMatrix[0][1]*node[iPoint]->GetPrimitive(2)); - rotPrim_i[2] = (rotMatrix[1][0]*node[iPoint]->GetPrimitive(1) + - rotMatrix[1][1]*node[iPoint]->GetPrimitive(2)); + rotPrim_i[1] = (rotMatrix[0][0]*base_nodes->GetPrimitive(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetPrimitive(iPoint,2)); + rotPrim_i[2] = (rotMatrix[1][0]*base_nodes->GetPrimitive(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetPrimitive(iPoint,2)); } else { - rotPrim_i[1] = (rotMatrix[0][0]*node[iPoint]->GetPrimitive(1) + - rotMatrix[0][1]*node[iPoint]->GetPrimitive(2) + - rotMatrix[0][2]*node[iPoint]->GetPrimitive(3)); - rotPrim_i[2] = (rotMatrix[1][0]*node[iPoint]->GetPrimitive(1) + - rotMatrix[1][1]*node[iPoint]->GetPrimitive(2) + - rotMatrix[1][2]*node[iPoint]->GetPrimitive(3)); - rotPrim_i[3] = (rotMatrix[2][0]*node[iPoint]->GetPrimitive(1) + - rotMatrix[2][1]*node[iPoint]->GetPrimitive(2) + - rotMatrix[2][2]*node[iPoint]->GetPrimitive(3)); + rotPrim_i[1] = (rotMatrix[0][0]*base_nodes->GetPrimitive(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetPrimitive(iPoint,2) + + rotMatrix[0][2]*base_nodes->GetPrimitive(iPoint,3)); + rotPrim_i[2] = (rotMatrix[1][0]*base_nodes->GetPrimitive(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetPrimitive(iPoint,2) + + rotMatrix[1][2]*base_nodes->GetPrimitive(iPoint,3)); + rotPrim_i[3] = (rotMatrix[2][0]*base_nodes->GetPrimitive(iPoint,1) + + rotMatrix[2][1]*base_nodes->GetPrimitive(iPoint,2) + + rotMatrix[2][2]*base_nodes->GetPrimitive(iPoint,3)); } } @@ -1181,25 +1174,25 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Get primitives from CVariable ---*/ for (iVar = 0; iVar < nPrimVar; iVar++) - rotPrim_j[iVar] = node[jPoint]->GetPrimitive(iVar); + rotPrim_j[iVar] = base_nodes->GetPrimitive(jPoint,iVar); if (rotate_periodic) { if (nDim == 2) { - rotPrim_j[1] = (rotMatrix[0][0]*node[jPoint]->GetPrimitive(1) + - rotMatrix[0][1]*node[jPoint]->GetPrimitive(2)); - rotPrim_j[2] = (rotMatrix[1][0]*node[jPoint]->GetPrimitive(1) + - rotMatrix[1][1]*node[jPoint]->GetPrimitive(2)); + rotPrim_j[1] = (rotMatrix[0][0]*base_nodes->GetPrimitive(jPoint,1) + + rotMatrix[0][1]*base_nodes->GetPrimitive(jPoint,2)); + rotPrim_j[2] = (rotMatrix[1][0]*base_nodes->GetPrimitive(jPoint,1) + + rotMatrix[1][1]*base_nodes->GetPrimitive(jPoint,2)); } else { - rotPrim_j[1] = (rotMatrix[0][0]*node[jPoint]->GetPrimitive(1) + - rotMatrix[0][1]*node[jPoint]->GetPrimitive(2) + - rotMatrix[0][2]*node[jPoint]->GetPrimitive(3)); - rotPrim_j[2] = (rotMatrix[1][0]*node[jPoint]->GetPrimitive(1) + - rotMatrix[1][1]*node[jPoint]->GetPrimitive(2) + - rotMatrix[1][2]*node[jPoint]->GetPrimitive(3)); - rotPrim_j[3] = (rotMatrix[2][0]*node[jPoint]->GetPrimitive(1) + - rotMatrix[2][1]*node[jPoint]->GetPrimitive(2) + - rotMatrix[2][2]*node[jPoint]->GetPrimitive(3)); + rotPrim_j[1] = (rotMatrix[0][0]*base_nodes->GetPrimitive(jPoint,1) + + rotMatrix[0][1]*base_nodes->GetPrimitive(jPoint,2) + + rotMatrix[0][2]*base_nodes->GetPrimitive(jPoint,3)); + rotPrim_j[2] = (rotMatrix[1][0]*base_nodes->GetPrimitive(jPoint,1) + + rotMatrix[1][1]*base_nodes->GetPrimitive(jPoint,2) + + rotMatrix[1][2]*base_nodes->GetPrimitive(jPoint,3)); + rotPrim_j[3] = (rotMatrix[2][0]*base_nodes->GetPrimitive(jPoint,1) + + rotMatrix[2][1]*base_nodes->GetPrimitive(jPoint,2) + + rotMatrix[2][2]*base_nodes->GetPrimitive(jPoint,3)); } } @@ -1282,11 +1275,11 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, among all nodes adjacent to periodic faces. ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - Sol_Min[iVar] = node[iPoint]->GetSolution_Min(iVar); - Sol_Max[iVar] = node[iPoint]->GetSolution_Max(iVar); + Sol_Min[iVar] = base_nodes->GetSolution_Min(iPoint, iVar); + Sol_Max[iVar] = base_nodes->GetSolution_Max(iPoint, iVar); - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_Min(iVar); - bufDSend[buf_offset+nPrimVarGrad+iVar] = node[iPoint]->GetSolution_Max(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Min(iPoint, iVar); + bufDSend[buf_offset+nPrimVarGrad+iVar] = base_nodes->GetSolution_Max(iPoint, iVar); } /*--- Rotate the momentum components of the min/max. ---*/ @@ -1335,27 +1328,27 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, found for a node on a periodic face and stores it. ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - bufDSend[buf_offset+iVar] = node[iPoint]->GetLimiter_Primitive(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetLimiter_Primitive(iPoint, iVar); } if (rotate_periodic) { if (nDim == 2) { - bufDSend[buf_offset+1] = (rotMatrix[0][0]*node[iPoint]->GetLimiter_Primitive(1) + - rotMatrix[0][1]*node[iPoint]->GetLimiter_Primitive(2)); - bufDSend[buf_offset+2] = (rotMatrix[1][0]*node[iPoint]->GetLimiter_Primitive(1) + - rotMatrix[1][1]*node[iPoint]->GetLimiter_Primitive(2)); + bufDSend[buf_offset+1] = (rotMatrix[0][0]*base_nodes->GetLimiter_Primitive(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetLimiter_Primitive(iPoint,2)); + bufDSend[buf_offset+2] = (rotMatrix[1][0]*base_nodes->GetLimiter_Primitive(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetLimiter_Primitive(iPoint,2)); } else { - bufDSend[buf_offset+1] = (rotMatrix[0][0]*node[iPoint]->GetLimiter_Primitive(1) + - rotMatrix[0][1]*node[iPoint]->GetLimiter_Primitive(2) + - rotMatrix[0][2]*node[iPoint]->GetLimiter_Primitive(3)); - bufDSend[buf_offset+2] = (rotMatrix[1][0]*node[iPoint]->GetLimiter_Primitive(1) + - rotMatrix[1][1]*node[iPoint]->GetLimiter_Primitive(2) + - rotMatrix[1][2]*node[iPoint]->GetLimiter_Primitive(3)); - bufDSend[buf_offset+3] = (rotMatrix[2][0]*node[iPoint]->GetLimiter_Primitive(1) + - rotMatrix[2][1]*node[iPoint]->GetLimiter_Primitive(2) + - rotMatrix[2][2]*node[iPoint]->GetLimiter_Primitive(3)); + bufDSend[buf_offset+1] = (rotMatrix[0][0]*base_nodes->GetLimiter_Primitive(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetLimiter_Primitive(iPoint,2) + + rotMatrix[0][2]*base_nodes->GetLimiter_Primitive(iPoint,3)); + bufDSend[buf_offset+2] = (rotMatrix[1][0]*base_nodes->GetLimiter_Primitive(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetLimiter_Primitive(iPoint,2) + + rotMatrix[1][2]*base_nodes->GetLimiter_Primitive(iPoint,3)); + bufDSend[buf_offset+3] = (rotMatrix[2][0]*base_nodes->GetLimiter_Primitive(iPoint,1) + + rotMatrix[2][1]*base_nodes->GetLimiter_Primitive(iPoint,2) + + rotMatrix[2][2]*base_nodes->GetLimiter_Primitive(iPoint,3)); } } @@ -1368,11 +1361,11 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, among all nodes adjacent to periodic faces. ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Sol_Min[iVar] = node[iPoint]->GetSolution_Min(iVar); - Sol_Max[iVar] = node[iPoint]->GetSolution_Max(iVar); + Sol_Min[iVar] = base_nodes->GetSolution_Min(iPoint, iVar); + Sol_Max[iVar] = base_nodes->GetSolution_Max(iPoint, iVar); - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_Min(iVar); - bufDSend[buf_offset+nVar+iVar] = node[iPoint]->GetSolution_Max(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Min(iPoint, iVar); + bufDSend[buf_offset+nVar+iVar] = base_nodes->GetSolution_Max(iPoint, iVar); } /*--- Rotate the momentum components of the min/max. ---*/ @@ -1424,27 +1417,27 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, found for a node on a periodic face and stores it. ---*/ for (iVar = 0; iVar < nVar; iVar++) { - bufDSend[buf_offset+iVar] = node[iPoint]->GetLimiter(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetLimiter(iPoint, iVar); } if (rotate_periodic) { if (nDim == 2) { - bufDSend[buf_offset+1] = (rotMatrix[0][0]*node[iPoint]->GetLimiter(1) + - rotMatrix[0][1]*node[iPoint]->GetLimiter(2)); - bufDSend[buf_offset+2] = (rotMatrix[1][0]*node[iPoint]->GetLimiter(1) + - rotMatrix[1][1]*node[iPoint]->GetLimiter(2)); + bufDSend[buf_offset+1] = (rotMatrix[0][0]*base_nodes->GetLimiter(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetLimiter(iPoint,2)); + bufDSend[buf_offset+2] = (rotMatrix[1][0]*base_nodes->GetLimiter(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetLimiter(iPoint,2)); } else { - bufDSend[buf_offset+1] = (rotMatrix[0][0]*node[iPoint]->GetLimiter(1) + - rotMatrix[0][1]*node[iPoint]->GetLimiter(2) + - rotMatrix[0][2]*node[iPoint]->GetLimiter(3)); - bufDSend[buf_offset+2] = (rotMatrix[1][0]*node[iPoint]->GetLimiter(1) + - rotMatrix[1][1]*node[iPoint]->GetLimiter(2) + - rotMatrix[1][2]*node[iPoint]->GetLimiter(3)); - bufDSend[buf_offset+3] = (rotMatrix[2][0]*node[iPoint]->GetLimiter(1) + - rotMatrix[2][1]*node[iPoint]->GetLimiter(2) + - rotMatrix[2][2]*node[iPoint]->GetLimiter(3)); + bufDSend[buf_offset+1] = (rotMatrix[0][0]*base_nodes->GetLimiter(iPoint,1) + + rotMatrix[0][1]*base_nodes->GetLimiter(iPoint,2) + + rotMatrix[0][2]*base_nodes->GetLimiter(iPoint,3)); + bufDSend[buf_offset+2] = (rotMatrix[1][0]*base_nodes->GetLimiter(iPoint,1) + + rotMatrix[1][1]*base_nodes->GetLimiter(iPoint,2) + + rotMatrix[1][2]*base_nodes->GetLimiter(iPoint,3)); + bufDSend[buf_offset+3] = (rotMatrix[2][0]*base_nodes->GetLimiter(iPoint,1) + + rotMatrix[2][1]*base_nodes->GetLimiter(iPoint,2) + + rotMatrix[2][2]*base_nodes->GetLimiter(iPoint,3)); } } @@ -1597,9 +1590,9 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, /*--- Check the computed time step against the donor value and keep the minimum in order to be conservative. ---*/ - Time_Step = node[iPoint]->GetDelta_Time(); + Time_Step = base_nodes->GetDelta_Time(iPoint); if (bufDRecv[buf_offset] < Time_Step) - node[iPoint]->SetDelta_Time(bufDRecv[buf_offset]); + base_nodes->SetDelta_Time(iPoint,bufDRecv[buf_offset]); buf_offset++; /*--- Access the Jacobian from the donor if implicit. ---*/ @@ -1664,8 +1657,8 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, face that is provided from the master. ---*/ for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->SetSolution(iVar, Solution[iVar]); - node[iPoint]->SetSolution_Old(iVar, Solution[iVar]); + base_nodes->SetSolution(iPoint, iVar, Solution[iVar]); + base_nodes->SetSolution_Old(iPoint, iVar, Solution[iVar]); } } @@ -1680,7 +1673,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) Diff[iVar] = bufDRecv[buf_offset+iVar]; - node[iPoint]->AddUnd_Lapl(Diff); + base_nodes->AddUnd_Lapl(iPoint,Diff); break; @@ -1688,7 +1681,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, /*--- Simple accumulation of the max eig on periodic faces. ---*/ - node[iPoint]->AddLambda(bufDRecv[buf_offset]); + base_nodes->AddLambda(iPoint,bufDRecv[buf_offset]); break; @@ -1708,7 +1701,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetGradient(iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim] + node[iPoint]->GetGradient(iVar, iDim)); + base_nodes->SetGradient(iPoint, iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim] + base_nodes->GetGradient(iPoint, iVar, iDim)); break; @@ -1719,7 +1712,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, for (iVar = 0; iVar < nPrimVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetGradient_Primitive(iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim] + node[iPoint]->GetGradient_Primitive(iVar, iDim)); + base_nodes->SetGradient_Primitive(iPoint, iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim] + base_nodes->GetGradient_Primitive(iPoint, iVar, iDim)); break; case PERIODIC_SOL_LS: @@ -1730,13 +1723,13 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0; jDim < nDim; jDim++) { - node[iPoint]->AddRmatrix(iDim,jDim,bufDRecv[buf_offset]); + base_nodes->AddRmatrix(iPoint, iDim,jDim,bufDRecv[buf_offset]); buf_offset++; } } for (iVar = 0; iVar < nVar; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->AddGradient(iVar, iDim, bufDRecv[buf_offset]); + base_nodes->AddGradient(iPoint, iVar, iDim, bufDRecv[buf_offset]); buf_offset++; } } @@ -1751,13 +1744,13 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0; jDim < nDim; jDim++) { - node[iPoint]->AddRmatrix(iDim,jDim,bufDRecv[buf_offset]); + base_nodes->AddRmatrix(iPoint, iDim,jDim,bufDRecv[buf_offset]); buf_offset++; } } for (iVar = 0; iVar < nPrimVarGrad; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->AddGradient_Primitive(iVar, iDim, bufDRecv[buf_offset]); + base_nodes->AddGradient_Primitive(iPoint, iVar, iDim, bufDRecv[buf_offset]); buf_offset++; } } @@ -1771,8 +1764,8 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, and max for this point. ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - node[iPoint]->SetSolution_Min(iVar, min(node[iPoint]->GetSolution_Min(iVar), bufDRecv[buf_offset+iVar])); - node[iPoint]->SetSolution_Max(iVar, max(node[iPoint]->GetSolution_Max(iVar), bufDRecv[buf_offset+nPrimVarGrad+iVar])); + base_nodes->SetSolution_Min(iPoint, iVar, min(base_nodes->GetSolution_Min(iPoint, iVar), bufDRecv[buf_offset+iVar])); + base_nodes->SetSolution_Max(iPoint, iVar, max(base_nodes->GetSolution_Max(iPoint, iVar), bufDRecv[buf_offset+nPrimVarGrad+iVar])); } break; @@ -1783,7 +1776,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, faces for the limiter, and store the proper min value. ---*/ for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - node[iPoint]->SetLimiter_Primitive(iVar, min(node[iPoint]->GetLimiter_Primitive(iVar), bufDRecv[buf_offset+iVar])); + base_nodes->SetLimiter_Primitive(iPoint, iVar, min(base_nodes->GetLimiter_Primitive(iPoint, iVar), bufDRecv[buf_offset+iVar])); } break; @@ -1798,15 +1791,15 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, /*--- Solution minimum. ---*/ - Solution_Min = min(node[iPoint]->GetSolution_Min(iVar), + Solution_Min = min(base_nodes->GetSolution_Min(iPoint, iVar), bufDRecv[buf_offset+iVar]); - node[iPoint]->SetSolution_Min(iVar, Solution_Min); + base_nodes->SetSolution_Min(iPoint, iVar, Solution_Min); /*--- Solution maximum. ---*/ - Solution_Max = max(node[iPoint]->GetSolution_Max(iVar), + Solution_Max = max(base_nodes->GetSolution_Max(iPoint, iVar), bufDRecv[buf_offset+nVar+iVar]); - node[iPoint]->SetSolution_Max(iVar, Solution_Max); + base_nodes->SetSolution_Max(iPoint, iVar, Solution_Max); } @@ -1818,9 +1811,9 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, faces for the limiter, and store the proper min value. ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Limiter_Min = min(node[iPoint]->GetLimiter_Primitive(iVar), + Limiter_Min = min(base_nodes->GetLimiter_Primitive(iPoint, iVar), bufDRecv[buf_offset+iVar]); - node[iPoint]->SetLimiter_Primitive(iVar, Limiter_Min); + base_nodes->SetLimiter_Primitive(iPoint, iVar, Limiter_Min); } break; @@ -1988,91 +1981,91 @@ void CSolver::InitiateComms(CGeometry *geometry, switch (commType) { case SOLUTION: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); break; case SOLUTION_OLD: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_Old(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Old(iPoint, iVar); break; case SOLUTION_EDDY: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution(iVar); - bufDSend[buf_offset+nVar] = node[iPoint]->GetmuT(); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); + bufDSend[buf_offset+nVar] = base_nodes->GetmuT(iPoint); break; case UNDIVIDED_LAPLACIAN: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetUndivided_Laplacian(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetUndivided_Laplacian(iPoint, iVar); break; case SOLUTION_LIMITER: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetLimiter(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetLimiter(iPoint, iVar); break; case MAX_EIGENVALUE: - bufDSend[buf_offset] = node[iPoint]->GetLambda(); + bufDSend[buf_offset] = base_nodes->GetLambda(iPoint); break; case SENSOR: - bufDSend[buf_offset] = node[iPoint]->GetSensor(); + bufDSend[buf_offset] = base_nodes->GetSensor(iPoint); break; case SOLUTION_GRADIENT: for (iVar = 0; iVar < nVar; iVar++) for (iDim = 0; iDim < nDim; iDim++) - bufDSend[buf_offset+iVar*nDim+iDim] = node[iPoint]->GetGradient(iVar, iDim); + bufDSend[buf_offset+iVar*nDim+iDim] = base_nodes->GetGradient(iPoint, iVar, iDim); break; case PRIMITIVE_GRADIENT: for (iVar = 0; iVar < nPrimVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) - bufDSend[buf_offset+iVar*nDim+iDim] = node[iPoint]->GetGradient_Primitive(iVar, iDim); + bufDSend[buf_offset+iVar*nDim+iDim] = base_nodes->GetGradient_Primitive(iPoint, iVar, iDim); break; case PRIMITIVE_LIMITER: for (iVar = 0; iVar < nPrimVarGrad; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetLimiter_Primitive(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetLimiter_Primitive(iPoint, iVar); break; case AUXVAR_GRADIENT: for (iDim = 0; iDim < nDim; iDim++) - bufDSend[buf_offset+iDim] = node[iPoint]->GetAuxVarGradient(iDim); + bufDSend[buf_offset+iDim] = base_nodes->GetAuxVarGradient(iPoint, iDim); break; case SOLUTION_FEA: for (iVar = 0; iVar < nVar; iVar++) { - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); if (config->GetTime_Domain()) { - bufDSend[buf_offset+nVar+iVar] = node[iPoint]->GetSolution_Vel(iVar); - bufDSend[buf_offset+nVar*2+iVar] = node[iPoint]->GetSolution_Accel(iVar); + bufDSend[buf_offset+nVar+iVar] = base_nodes->GetSolution_Vel(iPoint, iVar); + bufDSend[buf_offset+nVar*2+iVar] = base_nodes->GetSolution_Accel(iPoint, iVar); } } break; case SOLUTION_FEA_OLD: for (iVar = 0; iVar < nVar; iVar++) { - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_time_n(iVar); - bufDSend[buf_offset+nVar+iVar] = node[iPoint]->GetSolution_Vel_time_n(iVar); - bufDSend[buf_offset+nVar*2+iVar] = node[iPoint]->GetSolution_Accel_time_n(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n(iPoint, iVar); + bufDSend[buf_offset+nVar+iVar] = base_nodes->GetSolution_Vel_time_n(iPoint, iVar); + bufDSend[buf_offset+nVar*2+iVar] = base_nodes->GetSolution_Accel_time_n(iPoint, iVar); } break; case SOLUTION_DISPONLY: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution(iPoint, iVar); break; case SOLUTION_PRED: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_Pred(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Pred(iPoint, iVar); break; case SOLUTION_PRED_OLD: for (iVar = 0; iVar < nVar; iVar++) { - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_Old(iVar); - bufDSend[buf_offset+nVar+iVar] = node[iPoint]->GetSolution_Pred(iVar); - bufDSend[buf_offset+nVar*2+iVar] = node[iPoint]->GetSolution_Pred_Old(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Old(iPoint, iVar); + bufDSend[buf_offset+nVar+iVar] = base_nodes->GetSolution_Pred(iPoint, iVar); + bufDSend[buf_offset+nVar*2+iVar] = base_nodes->GetSolution_Pred_Old(iPoint, iVar); } break; case MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) - bufDSend[buf_offset+iDim] = node[iPoint]->GetBound_Disp(iDim); + bufDSend[buf_offset+iDim] = base_nodes->GetBound_Disp(iPoint, iDim); break; case SOLUTION_TIME_N: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_time_n(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n(iPoint, iVar); break; case SOLUTION_TIME_N1: for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = node[iPoint]->GetSolution_time_n1(iVar); + bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n1(iPoint, iVar); break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", @@ -2150,91 +2143,91 @@ void CSolver::CompleteComms(CGeometry *geometry, switch (commType) { case SOLUTION: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetSolution(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetSolution(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case SOLUTION_OLD: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetSolution_Old(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetSolution_Old(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case SOLUTION_EDDY: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetSolution(iVar, bufDRecv[buf_offset+iVar]); - node[iPoint]->SetmuT(bufDRecv[buf_offset+nVar]); + base_nodes->SetSolution(iPoint, iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetmuT(iPoint,bufDRecv[buf_offset+nVar]); break; case UNDIVIDED_LAPLACIAN: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetUndivided_Laplacian(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetUndivided_Laplacian(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case SOLUTION_LIMITER: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetLimiter(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetLimiter(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case MAX_EIGENVALUE: - node[iPoint]->SetLambda(bufDRecv[buf_offset]); + base_nodes->SetLambda(iPoint,bufDRecv[buf_offset]); break; case SENSOR: - node[iPoint]->SetSensor(bufDRecv[buf_offset]); + base_nodes->SetSensor(iPoint,bufDRecv[buf_offset]); break; case SOLUTION_GRADIENT: for (iVar = 0; iVar < nVar; iVar++) for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetGradient(iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim]); + base_nodes->SetGradient(iPoint, iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim]); break; case PRIMITIVE_GRADIENT: for (iVar = 0; iVar < nPrimVarGrad; iVar++) for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetGradient_Primitive(iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim]); + base_nodes->SetGradient_Primitive(iPoint, iVar, iDim, bufDRecv[buf_offset+iVar*nDim+iDim]); break; case PRIMITIVE_LIMITER: for (iVar = 0; iVar < nPrimVarGrad; iVar++) - node[iPoint]->SetLimiter_Primitive(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetLimiter_Primitive(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case AUXVAR_GRADIENT: for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetAuxVarGradient(iDim, bufDRecv[buf_offset+iDim]); + base_nodes->SetAuxVarGradient(iPoint, iDim, bufDRecv[buf_offset+iDim]); break; case SOLUTION_FEA: for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->SetSolution(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetSolution(iPoint, iVar, bufDRecv[buf_offset+iVar]); if (config->GetTime_Domain()) { - node[iPoint]->SetSolution_Vel(iVar, bufDRecv[buf_offset+nVar+iVar]); - node[iPoint]->SetSolution_Accel(iVar, bufDRecv[buf_offset+nVar*2+iVar]); + base_nodes->SetSolution_Vel(iPoint, iVar, bufDRecv[buf_offset+nVar+iVar]); + base_nodes->SetSolution_Accel(iPoint, iVar, bufDRecv[buf_offset+nVar*2+iVar]); } } break; case SOLUTION_FEA_OLD: for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->Set_Solution_time_n(iVar, bufDRecv[buf_offset+iVar]); - node[iPoint]->SetSolution_Vel_time_n(iVar, bufDRecv[buf_offset+nVar+iVar]); - node[iPoint]->SetSolution_Accel_time_n(iVar, bufDRecv[buf_offset+nVar*2+iVar]); + base_nodes->Set_Solution_time_n(iPoint, iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetSolution_Vel_time_n(iPoint, iVar, bufDRecv[buf_offset+nVar+iVar]); + base_nodes->SetSolution_Accel_time_n(iPoint, iVar, bufDRecv[buf_offset+nVar*2+iVar]); } break; case SOLUTION_DISPONLY: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetSolution(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetSolution(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case SOLUTION_PRED: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->SetSolution_Pred(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetSolution_Pred(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case SOLUTION_PRED_OLD: for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->SetSolution_Old(iVar, bufDRecv[buf_offset+iVar]); - node[iPoint]->SetSolution_Pred(iVar, bufDRecv[buf_offset+nVar+iVar]); - node[iPoint]->SetSolution_Pred_Old(iVar, bufDRecv[buf_offset+nVar*2+iVar]); + base_nodes->SetSolution_Old(iPoint, iVar, bufDRecv[buf_offset+iVar]); + base_nodes->SetSolution_Pred(iPoint, iVar, bufDRecv[buf_offset+nVar+iVar]); + base_nodes->SetSolution_Pred_Old(iPoint, iVar, bufDRecv[buf_offset+nVar*2+iVar]); } break; case MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) - node[iPoint]->SetBound_Disp(iDim, bufDRecv[buf_offset+iDim]); + base_nodes->SetBound_Disp(iPoint, iDim, bufDRecv[buf_offset+iDim]); break; case SOLUTION_TIME_N: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->Set_Solution_time_n(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->Set_Solution_time_n(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; case SOLUTION_TIME_N1: for (iVar = 0; iVar < nVar; iVar++) - node[iPoint]->Set_Solution_time_n1(iVar, bufDRecv[buf_offset+iVar]); + base_nodes->Set_Solution_time_n1(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", @@ -2469,8 +2462,8 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, CConfig *config) { /*--- Solution at each edge point ---*/ - su2double *Solution_i = node[iPoint]->GetSolution(); - su2double *Solution_j = node[jPoint]->GetSolution(); + su2double *Solution_i = base_nodes->GetSolution(iPoint); + su2double *Solution_j = base_nodes->GetSolution(jPoint); for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.5* (Solution_i[iVar] + Solution_j[iVar]); @@ -2510,7 +2503,7 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, CConfig *config) { /*--- Solution at each edge point ---*/ - su2double *Solution = node[Point]->GetSolution(); + su2double *Solution = base_nodes->GetSolution(Point); /*--- Grid Velocity at each edge point ---*/ @@ -2543,8 +2536,9 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, CConfig *config) { su2double AuxVar_Vertex, AuxVar_i, AuxVar_j, AuxVar_Average; su2double *Gradient, DualArea, Partial_Res, Grad_Val, *Normal; - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) - node[iPoint]->SetAuxVarGradientZero(); // Set Gradient to Zero + /*--- Set Gradient to Zero ---*/ + + base_nodes->SetAuxVarGradientZero(); /*--- Loop interior edges ---*/ @@ -2552,15 +2546,15 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, CConfig *config) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - AuxVar_i = node[iPoint]->GetAuxVar(); - AuxVar_j = node[jPoint]->GetAuxVar(); + AuxVar_i = base_nodes->GetAuxVar(iPoint); + AuxVar_j = base_nodes->GetAuxVar(jPoint); Normal = geometry->edge[iEdge]->GetNormal(); AuxVar_Average = 0.5 * ( AuxVar_i + AuxVar_j); for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = AuxVar_Average*Normal[iDim]; - node[iPoint]->AddAuxVarGradient(iDim, Partial_Res); - node[jPoint]->SubtractAuxVarGradient(iDim, Partial_Res); + base_nodes->AddAuxVarGradient(iPoint, iDim, Partial_Res); + base_nodes->SubtractAuxVarGradient(jPoint,iDim, Partial_Res); } } @@ -2571,21 +2565,21 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, CConfig *config) { (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { Point = geometry->vertex[iMarker][iVertex]->GetNode(); - AuxVar_Vertex = node[Point]->GetAuxVar(); + AuxVar_Vertex = base_nodes->GetAuxVar(Point); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = AuxVar_Vertex*Normal[iDim]; - node[Point]->SubtractAuxVarGradient(iDim, Partial_Res); + base_nodes->SubtractAuxVarGradient(Point,iDim, Partial_Res); } } } for (iPoint=0; iPointGetnPoint(); iPoint++) for (iDim = 0; iDim < nDim; iDim++) { - Gradient = node[iPoint]->GetAuxVarGradient(); + Gradient = base_nodes->GetAuxVarGradient(iPoint); DualArea = geometry->node[iPoint]->GetVolume(); Grad_Val = Gradient[iDim]/(DualArea+EPS); - node[iPoint]->SetAuxVarGradient(iDim, Grad_Val); + base_nodes->SetAuxVarGradient(iPoint, iDim, Grad_Val); } /*--- Gradient MPI ---*/ @@ -2611,7 +2605,7 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { Coord_i = geometry->node[iPoint]->GetCoord(); - AuxVar_i = node[iPoint]->GetAuxVar(); + AuxVar_i = base_nodes->GetAuxVar(iPoint); /*--- Inizialization of variables ---*/ for (iDim = 0; iDim < nDim; iDim++) @@ -2623,7 +2617,7 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, CConfig *config) { for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) { jPoint = geometry->node[iPoint]->GetPoint(iNeigh); Coord_j = geometry->node[jPoint]->GetCoord(); - AuxVar_j = node[jPoint]->GetAuxVar(); + AuxVar_j = base_nodes->GetAuxVar(jPoint); weight = 0.0; for (iDim = 0; iDim < nDim; iDim++) @@ -2708,7 +2702,7 @@ void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, CConfig *config) { for (jDim = 0; jDim < nDim; jDim++) product += Smatrix[iDim][jDim]*Cvector[jDim]; if (geometry->node[iPoint]->GetDomain()) - node[iPoint]->SetAuxVarGradient(iDim, product); + base_nodes->SetAuxVarGradient(iPoint, iDim, product); } } @@ -2728,25 +2722,24 @@ void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, CConfig *config) { Partial_Res, Grad_Val, *Normal, Vol; /*--- Set Gradient to Zero ---*/ - for (iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++) - node[iPoint]->SetGradientZero(); + base_nodes->SetGradientZero(); /*--- Loop interior edges ---*/ for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Solution_i = node[iPoint]->GetSolution(); - Solution_j = node[jPoint]->GetSolution(); + Solution_i = base_nodes->GetSolution(iPoint); + Solution_j = base_nodes->GetSolution(jPoint); Normal = geometry->edge[iEdge]->GetNormal(); for (iVar = 0; iVar< nVar; iVar++) { Solution_Average = 0.5 * (Solution_i[iVar] + Solution_j[iVar]); for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = Solution_Average*Normal[iDim]; if (geometry->node[iPoint]->GetDomain()) - node[iPoint]->AddGradient(iVar, iDim, Partial_Res); + base_nodes->AddGradient(iPoint, iVar, iDim, Partial_Res); if (geometry->node[jPoint]->GetDomain()) - node[jPoint]->SubtractGradient(iVar, iDim, Partial_Res); + base_nodes->SubtractGradient(jPoint,iVar, iDim, Partial_Res); } } } @@ -2757,13 +2750,13 @@ void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, CConfig *config) { (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { Point = geometry->vertex[iMarker][iVertex]->GetNode(); - Solution_Vertex = node[Point]->GetSolution(); + Solution_Vertex = base_nodes->GetSolution(Point); Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); for (iVar = 0; iVar < nVar; iVar++) for (iDim = 0; iDim < nDim; iDim++) { Partial_Res = Solution_Vertex[iVar]*Normal[iDim]; if (geometry->node[Point]->GetDomain()) - node[Point]->SubtractGradient(iVar, iDim, Partial_Res); + base_nodes->SubtractGradient(Point,iVar, iDim, Partial_Res); } } } @@ -2786,9 +2779,9 @@ void CSolver::SetSolution_Gradient_GG(CGeometry *geometry, CConfig *config) { for (iVar = 0; iVar < nVar; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - Gradient = node[iPoint]->GetGradient(); + Gradient = base_nodes->GetGradient(iPoint); Grad_Val = Gradient[iVar][iDim] / (Vol+EPS); - node[iPoint]->SetGradient(iVar, iDim, Grad_Val); + base_nodes->SetGradient(iPoint, iVar, iDim, Grad_Val); } } @@ -2814,6 +2807,12 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, CConfig *config) { for (iVar = 0; iVar < nVar; iVar++) Cvector[iVar] = new su2double [nDim]; + /*--- Clear Rmatrix, which could eventually be computed once + and stored for static meshes, as well as the gradient. ---*/ + + base_nodes->SetRmatrixZero(); + base_nodes->SetGradientZero(); + /*--- Loop over points of the grid ---*/ for (iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++) { @@ -2827,25 +2826,19 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, CConfig *config) { /*--- Get consevative solution ---*/ - Solution_i = node[iPoint]->GetSolution(); + Solution_i = base_nodes->GetSolution(iPoint); /*--- Inizialization of variables ---*/ for (iVar = 0; iVar < nVar; iVar++) for (iDim = 0; iDim < nDim; iDim++) Cvector[iVar][iDim] = 0.0; - - /*--- Clear Rmatrix, which could eventually be computed once - and stored for static meshes, as well as the prim gradient. ---*/ - - node[iPoint]->SetRmatrixZero(); - node[iPoint]->SetGradientZero(); for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) { jPoint = geometry->node[iPoint]->GetPoint(iNeigh); Coord_j = geometry->node[jPoint]->GetCoord(); - Solution_j = node[jPoint]->GetSolution(); + Solution_j = base_nodes->GetSolution(jPoint); weight = 0.0; for (iDim = 0; iDim < nDim; iDim++) @@ -2855,22 +2848,22 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, CConfig *config) { if (weight != 0.0) { - node[iPoint]->AddRmatrix(0, 0, (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight); - node[iPoint]->AddRmatrix(0, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight); - node[iPoint]->AddRmatrix(1, 1, (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight); + base_nodes->AddRmatrix(iPoint,0, 0, (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight); + base_nodes->AddRmatrix(iPoint,0, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight); + base_nodes->AddRmatrix(iPoint,1, 1, (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight); if (nDim == 3) { - node[iPoint]->AddRmatrix(0, 2, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(1, 2, (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(2, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); - node[iPoint]->AddRmatrix(2, 2, (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight); + base_nodes->AddRmatrix(iPoint,0, 2, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); + base_nodes->AddRmatrix(iPoint,1, 2, (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight); + base_nodes->AddRmatrix(iPoint,2, 1, (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight); + base_nodes->AddRmatrix(iPoint,2, 2, (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight); } /*--- Entries of c:= transpose(A)*b ---*/ for (iVar = 0; iVar < nVar; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->AddGradient(iVar,iDim, (Coord_j[iDim]-Coord_i[iDim])*(Solution_j[iVar]-Solution_i[iVar])/weight); + base_nodes->AddGradient(iPoint, iVar,iDim, (Coord_j[iDim]-Coord_i[iDim])*(Solution_j[iVar]-Solution_i[iVar])/weight); } } @@ -2898,9 +2891,9 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, CConfig *config) { r11 = 0.0; r12 = 0.0; r13 = 0.0; r22 = 0.0; r23 = 0.0; r23_a = 0.0; r23_b = 0.0; r33 = 0.0; - r11 = node[iPoint]->GetRmatrix(0,0); - r12 = node[iPoint]->GetRmatrix(0,1); - r22 = node[iPoint]->GetRmatrix(1,1); + r11 = base_nodes->GetRmatrix(iPoint,0,0); + r12 = base_nodes->GetRmatrix(iPoint,0,1); + r22 = base_nodes->GetRmatrix(iPoint,1,1); /*--- Entries of upper triangular matrix R ---*/ @@ -2909,10 +2902,10 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, CConfig *config) { if (r22-r12*r12 >= 0.0) r22 = sqrt(r22-r12*r12); else r22 = 0.0; if (nDim == 3) { - r13 = node[iPoint]->GetRmatrix(0,2); - r23_a = node[iPoint]->GetRmatrix(1,2); - r23_b = node[iPoint]->GetRmatrix(2,1); - r33 = node[iPoint]->GetRmatrix(2,2); + r13 = base_nodes->GetRmatrix(iPoint,0,2); + r23_a = base_nodes->GetRmatrix(iPoint,1,2); + r23_b = base_nodes->GetRmatrix(iPoint,2,1); + r33 = base_nodes->GetRmatrix(iPoint,2,2); if (r11 != 0.0) r13 = r13/r11; else r13 = 0.0; if ((r22 != 0.0) && (r11*r22 != 0.0)) r23 = r23_a/r22 - r23_b*r12/(r11*r22); else r23 = 0.0; @@ -2963,14 +2956,14 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, CConfig *config) { for (iDim = 0; iDim < nDim; iDim++) { Cvector[iVar][iDim] = 0.0; for (jDim = 0; jDim < nDim; jDim++) { - Cvector[iVar][iDim] += Smatrix[iDim][jDim]*node[iPoint]->GetGradient(iVar, jDim); + Cvector[iVar][iDim] += Smatrix[iDim][jDim]*base_nodes->GetGradient(iPoint, iVar, jDim); } } } for (iVar = 0; iVar < nVar; iVar++) { for (iDim = 0; iDim < nDim; iDim++) { - node[iPoint]->SetGradient(iVar, iDim, Cvector[iVar][iDim]); + base_nodes->SetGradient(iPoint, iVar, iDim, Cvector[iVar][iDim]); } } @@ -2989,45 +2982,21 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, CConfig *config) { } -void CSolver::SetSolution_Zero(CGeometry *geometry) { - for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint]->SetSolutionZero(); - } -} - -void CSolver::SetSolution_Old(CGeometry *geometry) { - for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint]->SetSolution(node[iPoint]->GetSolution_Old()); - } -} - void CSolver::Add_ExternalOld_To_Solution(CGeometry *geometry) { for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint]->AddSolution(node[iPoint]->GetSolution_ExternalOld()); - } -} - -void CSolver::SetExternal_Zero(CGeometry *geometry) { - for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint]->SetExternalZero(); + base_nodes->AddSolution(iPoint, base_nodes->Get_ExternalOld(iPoint)); } } void CSolver::Add_Solution_To_External(CGeometry *geometry) { for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint]->Add_External(node[iPoint]->GetSolution()); + base_nodes->Add_External(iPoint, base_nodes->GetSolution(iPoint)); } } void CSolver::Add_Solution_To_ExternalOld(CGeometry *geometry) { for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint]->Add_ExternalOld(node[iPoint]->GetSolution()); - } -} - -void CSolver::Set_OldExternal(CGeometry *geometry) { - for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint]->Set_OldExternal(); + base_nodes->Add_ExternalOld(iPoint, base_nodes->GetSolution(iPoint)); } } @@ -3163,7 +3132,7 @@ void CSolver::SetAuxVar_Surface_Gradient(CGeometry *geometry, CConfig *config) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); if (geometry->node[iPoint]->GetDomain()) { Coord_i = geometry->node[iPoint]->GetCoord(); - AuxVar_i = node[iPoint]->GetAuxVar(); + AuxVar_i = base_nodes->GetAuxVar(iPoint); /*--- Inizialization of variables ---*/ for (iDim = 0; iDim < nDim; iDim++) @@ -3173,7 +3142,7 @@ void CSolver::SetAuxVar_Surface_Gradient(CGeometry *geometry, CConfig *config) { for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) { jPoint = geometry->node[iPoint]->GetPoint(iNeigh); Coord_j = geometry->node[jPoint]->GetCoord(); - AuxVar_j = node[jPoint]->GetAuxVar(); + AuxVar_j = base_nodes->GetAuxVar(jPoint); su2double weight = 0; for (iDim = 0; iDim < nDim; iDim++) @@ -3237,7 +3206,7 @@ void CSolver::SetAuxVar_Surface_Gradient(CGeometry *geometry, CConfig *config) { product = 0.0; for (jDim = 0; jDim < nDim; jDim++) product += Smatrix[iDim][jDim]*Cvector[jDim]; - node[iPoint]->SetAuxVarGradient(iDim, product); + base_nodes->SetAuxVarGradient(iPoint, iDim, product); } } } /*--- End of loop over surface points ---*/ @@ -3281,7 +3250,7 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->SetLimiter(iVar, 1.0); + base_nodes->SetLimiter(iPoint, iVar, 1.0); } } @@ -3293,9 +3262,9 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - node[iPoint]->SetSolution_Max(iVar, -EPS); - node[iPoint]->SetSolution_Min(iVar, EPS); - node[iPoint]->SetLimiter(iVar, 2.0); + base_nodes->SetSolution_Max(iPoint, iVar, -EPS); + base_nodes->SetSolution_Min(iPoint, iVar, EPS); + base_nodes->SetLimiter(iPoint, iVar, 2.0); } } @@ -3310,17 +3279,17 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { /*--- Get the conserved variables ---*/ - Solution_i = node[iPoint]->GetSolution(); - Solution_j = node[jPoint]->GetSolution(); + Solution_i = base_nodes->GetSolution(iPoint); + Solution_j = base_nodes->GetSolution(jPoint); /*--- Compute the maximum, and minimum values for nodes i & j ---*/ for (iVar = 0; iVar < nVar; iVar++) { du = (Solution_j[iVar] - Solution_i[iVar]); - node[iPoint]->SetSolution_Min(iVar, min(node[iPoint]->GetSolution_Min(iVar), du)); - node[iPoint]->SetSolution_Max(iVar, max(node[iPoint]->GetSolution_Max(iVar), du)); - node[jPoint]->SetSolution_Min(iVar, min(node[jPoint]->GetSolution_Min(iVar), -du)); - node[jPoint]->SetSolution_Max(iVar, max(node[jPoint]->GetSolution_Max(iVar), -du)); + base_nodes->SetSolution_Min(iPoint, iVar, min(base_nodes->GetSolution_Min(iPoint, iVar), du)); + base_nodes->SetSolution_Max(iPoint, iVar, max(base_nodes->GetSolution_Max(iPoint, iVar), du)); + base_nodes->SetSolution_Min(jPoint, iVar, min(base_nodes->GetSolution_Min(jPoint, iVar), -du)); + base_nodes->SetSolution_Max(jPoint, iVar, max(base_nodes->GetSolution_Max(jPoint, iVar), -du)); } } @@ -3342,8 +3311,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient(); - Gradient_j = node[jPoint]->GetGradient(); + Gradient_i = base_nodes->GetGradient(iPoint); + Gradient_j = base_nodes->GetGradient(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -3354,10 +3323,10 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { for (iVar = 0; iVar < nVar; iVar++) { - AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Max(iPoint, iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Min(iPoint, iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Max(jPoint,iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Min(jPoint,iVar)); /*--- Calculate the interface left gradient, delta- (dm) ---*/ @@ -3367,14 +3336,14 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { if (dm == 0.0) { limiter = 2.0; } else { - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(iPoint, iVar); + else dp = base_nodes->GetSolution_Min(iPoint, iVar); limiter = dp/dm; } - if (limiter < node[iPoint]->GetLimiter(iVar)) { - node[iPoint]->SetLimiter(iVar, limiter); - AD::SetPreaccOut(node[iPoint]->GetLimiter()[iVar]); + if (limiter < base_nodes->GetLimiter(iPoint, iVar)) { + base_nodes->SetLimiter(iPoint, iVar, limiter); + AD::SetPreaccOut(base_nodes->GetLimiter(iPoint)[iVar]); } /*--- Calculate the interface right gradient, delta+ (dp) ---*/ @@ -3385,14 +3354,14 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { if (dm == 0.0) { limiter = 2.0; } else { - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(jPoint,iVar); + else dp = base_nodes->GetSolution_Min(jPoint,iVar); limiter = dp/dm; } - if (limiter < node[jPoint]->GetLimiter(iVar)) { - node[jPoint]->SetLimiter(iVar, limiter); - AD::SetPreaccOut(node[jPoint]->GetLimiter()[iVar]); + if (limiter < base_nodes->GetLimiter(jPoint,iVar)) { + base_nodes->SetLimiter(jPoint,iVar, limiter); + AD::SetPreaccOut(base_nodes->GetLimiter(jPoint)[iVar]); } } @@ -3404,9 +3373,9 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { - y = node[iPoint]->GetLimiter(iVar); + y = base_nodes->GetLimiter(iPoint, iVar); limiter = (y*y + 2.0*y) / (y*y + y + 2.0); - node[iPoint]->SetLimiter(iVar, limiter); + base_nodes->SetLimiter(iPoint, iVar, limiter); } } @@ -3425,7 +3394,7 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { /*--- Compute the max value and min value of the solution ---*/ - Solution = node[iPoint]->GetSolution(); + Solution = base_nodes->GetSolution(iPoint); for (iVar = 0; iVar < nVar; iVar++) { LocalMinSolution[iVar] = Solution[iVar]; LocalMaxSolution[iVar] = Solution[iVar]; @@ -3435,7 +3404,7 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { /*--- Get the solution variables ---*/ - Solution = node[iPoint]->GetSolution(); + Solution = base_nodes->GetSolution(iPoint); for (iVar = 0; iVar < nVar; iVar++) { LocalMinSolution[iVar] = min (LocalMinSolution[iVar], Solution[iVar]); @@ -3459,8 +3428,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient(); - Gradient_j = node[jPoint]->GetGradient(); + Gradient_i = base_nodes->GetGradient(iPoint); + Gradient_j = base_nodes->GetGradient(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -3476,10 +3445,10 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { AD::SetPreaccIn(Gradient_j[iVar], nDim); AD::SetPreaccIn(Coord_i, nDim); AD::SetPreaccIn(Coord_j, nDim); - AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar)); - AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Max(iPoint, iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Min(iPoint, iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Max(jPoint,iVar)); + AD::SetPreaccIn(base_nodes->GetSolution_Min(jPoint,iVar)); if (config->GetKind_SlopeLimit_Flow() == VENKATAKRISHNAN_WANG) { AD::SetPreaccIn(GlobalMaxSolution[iVar]); @@ -3500,14 +3469,14 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { /*--- Calculate the interface right gradient, delta+ (dp) ---*/ - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(iPoint, iVar); + else dp = base_nodes->GetSolution_Min(iPoint, iVar); limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[iPoint]->GetLimiter(iVar)) { - node[iPoint]->SetLimiter(iVar, limiter); - AD::SetPreaccOut(node[iPoint]->GetLimiter()[iVar]); + if (limiter < base_nodes->GetLimiter(iPoint, iVar)) { + base_nodes->SetLimiter(iPoint, iVar, limiter); + AD::SetPreaccOut(base_nodes->GetLimiter(iPoint)[iVar]); } /*-- Repeat for point j on the edge ---*/ @@ -3516,14 +3485,14 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { for (iDim = 0; iDim < nDim; iDim++) dm += 0.5*(Coord_i[iDim]-Coord_j[iDim])*Gradient_j[iVar][iDim]; - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(jPoint,iVar); + else dp = base_nodes->GetSolution_Min(jPoint,iVar); limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[jPoint]->GetLimiter(iVar)) { - node[jPoint]->SetLimiter(iVar, limiter); - AD::SetPreaccOut(node[jPoint]->GetLimiter()[iVar]); + if (limiter < base_nodes->GetLimiter(jPoint,iVar)) { + base_nodes->SetLimiter(jPoint,iVar, limiter); + AD::SetPreaccOut(base_nodes->GetLimiter(jPoint)[iVar]); } AD::EndPreacc(); @@ -3552,8 +3521,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient(); - Gradient_j = node[jPoint]->GetGradient(); + Gradient_i = base_nodes->GetGradient(iPoint); + Gradient_j = base_nodes->GetGradient(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -3567,8 +3536,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { /*--- Calculate the interface right gradient, delta+ (dp) ---*/ - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(iPoint, iVar); + else dp = base_nodes->GetSolution_Min(iPoint, iVar); /*--- Compute the distance to a sharp edge ---*/ @@ -3580,8 +3549,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { limiter = ds * ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[iPoint]->GetLimiter(iVar)) - node[iPoint]->SetLimiter(iVar, limiter); + if (limiter < base_nodes->GetLimiter(iPoint, iVar)) + base_nodes->SetLimiter(iPoint, iVar, limiter); /*-- Repeat for point j on the edge ---*/ @@ -3589,8 +3558,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { for (iDim = 0; iDim < nDim; iDim++) dm += 0.5*(Coord_i[iDim]-Coord_j[iDim])*Gradient_j[iVar][iDim]; - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(jPoint,iVar); + else dp = base_nodes->GetSolution_Min(jPoint,iVar); /*--- Compute the distance to a sharp edge ---*/ @@ -3602,8 +3571,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { limiter = ds * ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[jPoint]->GetLimiter(iVar)) - node[jPoint]->SetLimiter(iVar, limiter); + if (limiter < base_nodes->GetLimiter(jPoint,iVar)) + base_nodes->SetLimiter(jPoint,iVar, limiter); } } @@ -3624,8 +3593,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1); - Gradient_i = node[iPoint]->GetGradient(); - Gradient_j = node[jPoint]->GetGradient(); + Gradient_i = base_nodes->GetGradient(iPoint); + Gradient_j = base_nodes->GetGradient(jPoint); Coord_i = geometry->node[iPoint]->GetCoord(); Coord_j = geometry->node[jPoint]->GetCoord(); @@ -3639,8 +3608,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { /*--- Calculate the interface right gradient, delta+ (dp) ---*/ - if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar); - else dp = node[iPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(iPoint, iVar); + else dp = base_nodes->GetSolution_Min(iPoint, iVar); /*--- Compute the distance to a sharp edge ---*/ @@ -3652,8 +3621,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { limiter = ds * ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[iPoint]->GetLimiter(iVar)) - node[iPoint]->SetLimiter(iVar, limiter); + if (limiter < base_nodes->GetLimiter(iPoint, iVar)) + base_nodes->SetLimiter(iPoint, iVar, limiter); /*-- Repeat for point j on the edge ---*/ @@ -3661,8 +3630,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { for (iDim = 0; iDim < nDim; iDim++) dm += 0.5*(Coord_i[iDim]-Coord_j[iDim])*Gradient_j[iVar][iDim]; - if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar); - else dp = node[jPoint]->GetSolution_Min(iVar); + if ( dm > 0.0 ) dp = base_nodes->GetSolution_Max(jPoint,iVar); + else dp = base_nodes->GetSolution_Min(jPoint,iVar); /*--- Compute the distance to a sharp edge ---*/ @@ -3674,8 +3643,8 @@ void CSolver::SetSolution_Limiter(CGeometry *geometry, CConfig *config) { limiter = ds * ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2); - if (limiter < node[jPoint]->GetLimiter(iVar)) - node[jPoint]->SetLimiter(iVar, limiter); + if (limiter < base_nodes->GetLimiter(jPoint,iVar)) + base_nodes->SetLimiter(jPoint,iVar, limiter); } } @@ -5249,7 +5218,7 @@ void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){ if (geometry->node[iPoint]->GetDomain()) { // Retrieve the values of pressure - Pn = node[iPoint]->GetPressure(); + Pn = base_nodes->GetPressure(iPoint); // Calculate tn in the fluid nodes for the inviscid term --> Units of force (non-dimensional). for (iDim = 0; iDim < nDim; iDim++) @@ -5258,11 +5227,11 @@ void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){ // Calculate tn in the fluid nodes for the viscous term if (viscous_flow) { - Viscosity = node[iPoint]->GetLaminarViscosity(); + Viscosity = base_nodes->GetLaminarViscosity(iPoint); for (iDim = 0; iDim < nDim; iDim++) { for (jDim = 0 ; jDim < nDim; jDim++) { - Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim); + Grad_Vel[iDim][jDim] = base_nodes->GetGradient_Primitive(iPoint, iDim+1, jDim); } } @@ -5411,17 +5380,17 @@ void CSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *config){ /*--- Set Residuals to zero ---*/ for (iVar = 0; iVar < nVar; iVar++){ - SetRes_BGS(iVar,0.0); - SetRes_Max_BGS(iVar,0.0,0); + SetRes_BGS(iVar,0.0); + SetRes_Max_BGS(iVar,0.0,0); } /*--- Set the residuals ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++){ - for (iVar = 0; iVar < nVar; iVar++){ - residual = node[iPoint]->GetSolution(iVar) - node[iPoint]->Get_BGSSolution_k(iVar); - AddRes_BGS(iVar,residual*residual); - AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); - } + for (iVar = 0; iVar < nVar; iVar++){ + residual = base_nodes->GetSolution(iPoint,iVar) - base_nodes->Get_BGSSolution_k(iPoint,iVar); + AddRes_BGS(iVar,residual*residual); + AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); + } } SetResidual_BGS(geometry, config); @@ -5431,24 +5400,14 @@ void CSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *config){ void CSolver::UpdateSolution_BGS(CGeometry *geometry, CConfig *config){ - unsigned long iPoint; - /*--- To nPoint: The solution must be communicated beforehand ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - - node[iPoint]->Set_BGSSolution_k(); - - } - + base_nodes->Set_BGSSolution_k(); } CBaselineSolver::CBaselineSolver(void) : CSolver() { } CBaselineSolver::CBaselineSolver(CGeometry *geometry, CConfig *config) { - unsigned long iPoint; - unsigned short iVar; - nPoint = geometry->GetnPoint(); /*--- Define geometry constants in the solver structure ---*/ @@ -5462,49 +5421,27 @@ CBaselineSolver::CBaselineSolver(CGeometry *geometry, CConfig *config) { /*--- Initialize a zero solution and instantiate the CVariable class. ---*/ Solution = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = 0.0; - } + for (unsigned short iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; - node = new CVariable*[geometry->GetnPoint()]; - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - node[iPoint] = new CBaselineVariable(Solution, nVar, config); - } + nodes = new CBaselineVariable(nPoint, nVar, config); + SetBaseClassPointerToNodes(); dynamic_grid = config->GetDynamic_Grid(); - } CBaselineSolver::CBaselineSolver(CGeometry *geometry, CConfig *config, unsigned short val_nvar, vector field_names) { - unsigned long iPoint; - unsigned short iVar; - - nVar = val_nvar; - - nPoint = geometry->GetnPoint(); - - fields = field_names; - - Solution = new su2double[nVar]; - - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = 0.0; - } - /*--- Define geometry constants in the solver structure ---*/ + nPoint = geometry->GetnPoint(); nDim = geometry->GetnDim(); + nVar = val_nvar; + fields = field_names; /*--- Allocate the node variables ---*/ - node = new CVariable*[geometry->GetnPoint()]; - - for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - - node[iPoint] = new CBaselineVariable(Solution, nVar, config); - - } + nodes = new CBaselineVariable(nPoint, nVar, config); + SetBaseClassPointerToNodes(); dynamic_grid = config->GetDynamic_Grid(); @@ -5849,7 +5786,7 @@ void CBaselineSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf index = counter*Restart_Vars[1]; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); /*--- For dynamic meshes, read in and store the grid coordinates and grid velocities for each node. ---*/ @@ -5978,7 +5915,7 @@ void CBaselineSolver::LoadRestart_FSI(CGeometry *geometry, CConfig *config, int index = counter*Restart_Vars[1]; for (iVar = 0; iVar < nVar_Local; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - node[iPoint_Local]->SetSolution(Solution); + nodes->SetSolution(iPoint_Local,Solution); /*--- Increment the overall counter for how many points have been loaded. ---*/ @@ -5992,7 +5929,9 @@ void CBaselineSolver::LoadRestart_FSI(CGeometry *geometry, CConfig *config, int } -CBaselineSolver::~CBaselineSolver(void) { } +CBaselineSolver::~CBaselineSolver(void) { + if (nodes != nullptr) delete nodes; +} CBaselineSolver_FEM::CBaselineSolver_FEM(void) : CSolver() { } diff --git a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp index c9a66616f636..9bc6bd107216 100644 --- a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp @@ -37,7 +37,6 @@ #include "../../include/solvers/CDiscAdjMeshSolver.hpp" -#include "../../include/variables/CDiscAdjMeshVariable.hpp" #include "../../include/variables/CDiscAdjMeshBoundVariable.hpp" CDiscAdjMeshSolver::CDiscAdjMeshSolver(void) : CSolver (){ @@ -56,10 +55,7 @@ CDiscAdjMeshSolver::CDiscAdjMeshSolver(CGeometry *geometry, CConfig *config) : CDiscAdjMeshSolver::CDiscAdjMeshSolver(CGeometry *geometry, CConfig *config, CSolver *direct_solver) : CSolver(){ - unsigned short iVar, iMarker, iDim; - unsigned long iPoint; - long iVertex; - bool isVertex; + unsigned short iVar, iDim; nVar = geometry->GetnDim(); nDim = geometry->GetnDim(); @@ -108,32 +104,29 @@ CDiscAdjMeshSolver::CDiscAdjMeshSolver(CGeometry *geometry, CConfig *config, CSo for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 1e-16; /*--- Initialize the node structure ---*/ - node = new CVariable*[nPoint]; - for (iPoint = 0; iPoint < nPoint; iPoint++){ - - /*--- In principle, the node is not at the boundary ---*/ - isVertex = false; - /*--- Looping over all markers ---*/ - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - - /*--- If the marker is flagged as moving, retrieve the node vertex ---*/ - if (config->GetMarker_All_Deform_Mesh(iMarker) == YES) iVertex = geometry->node[iPoint]->GetVertex(iMarker); - else iVertex = -1; - - if (iVertex != -1){isVertex = true; break;} + nodes = new CDiscAdjMeshBoundVariable(nPoint,nDim,config); + SetBaseClassPointerToNodes(); + + /*--- Set which points are vertices and allocate boundary data. ---*/ + + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) { + + nodes->SetSolution(iPoint,Solution); + + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + long iVertex = geometry->node[iPoint]->GetVertex(iMarker); + if (iVertex >= 0) { + nodes->Set_isVertex(iPoint,true); + break; + } } - - /*--- The MeshBound variable includes the displacements at the boundaries ---*/ - if (isVertex) node[iPoint] = new CDiscAdjMeshBoundVariable(Solution, nDim, config); - else node[iPoint] = new CDiscAdjMeshVariable(Solution, nDim, config); - } - + static_cast(nodes)->AllocateBoundaryVariables(config); } CDiscAdjMeshSolver::~CDiscAdjMeshSolver(void){ - + if (nodes != nullptr) delete nodes; } @@ -148,8 +141,8 @@ void CDiscAdjMeshSolver::SetRecording(CGeometry* geometry, CConfig *config){ unsigned long iPoint; /*--- Reset the solution to the initial (converged) solution ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->SetBound_Disp(node[iPoint]->GetBoundDisp_Direct()); + for (iPoint = 0; iPoint < nPoint; iPoint++) { + direct_solver->GetNodes()->SetBound_Disp(iPoint,nodes->GetBoundDisp_Direct(iPoint)); } /*--- Set indices to zero ---*/ @@ -160,29 +153,17 @@ void CDiscAdjMeshSolver::SetRecording(CGeometry* geometry, CConfig *config){ void CDiscAdjMeshSolver::RegisterSolution(CGeometry *geometry, CConfig *config){ - unsigned long iPoint, nPoint = geometry->GetnPoint(); - bool input = true; - /*--- Register reference mesh coordinates ---*/ - - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->Register_MeshCoord(input); - } + bool input = true; + direct_solver->GetNodes()->Register_MeshCoord(input); } void CDiscAdjMeshSolver::RegisterVariables(CGeometry *geometry, CConfig *config, bool reset){ /*--- Register boundary displacements as input ---*/ - - unsigned long iPoint, nPoint = geometry->GetnPoint(); bool input = true; - - /*--- Register reference mesh coordinates ---*/ - - for (iPoint = 0; iPoint < nPoint; iPoint++){ - direct_solver->node[iPoint]->Register_BoundDisp(input); - } + direct_solver->GetNodes()->Register_BoundDisp(input); } @@ -196,11 +177,11 @@ void CDiscAdjMeshSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *c /*--- Extract the adjoint solution from the original mesh coordinates ---*/ - direct_solver->node[iPoint]->GetAdjoint_MeshCoord(Solution); + direct_solver->GetNodes()->GetAdjoint_MeshCoord(iPoint,Solution); /*--- Store the adjoint solution (the container is reused) ---*/ - node[iPoint]->SetSolution(Solution); + nodes->SetSolution(iPoint,Solution); } @@ -216,11 +197,11 @@ void CDiscAdjMeshSolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig * /*--- Extract the adjoint solution of the boundary displacements ---*/ - direct_solver->node[iPoint]->GetAdjoint_BoundDisp(Solution); + direct_solver->GetNodes()->GetAdjoint_BoundDisp(iPoint,Solution); /*--- Store the sensitivities of the boundary displacements ---*/ - node[iPoint]->SetBoundDisp_Sens(Solution); + nodes->SetBoundDisp_Sens(iPoint,Solution); } @@ -245,7 +226,7 @@ void CDiscAdjMeshSolver::SetSensitivity(CGeometry *geometry, CSolver **solver, C for (iDim = 0; iDim < nDim; iDim++) { /*--- The sensitivity was extracted using ExtractAdjoint_Solution ---*/ - Sensitivity = node[iPoint]->GetSolution(iDim); + Sensitivity = nodes->GetSolution(iPoint,iDim); /*--- If sharp edge, set the sensitivity to 0 on that region ---*/ if (config->GetSens_Remove_Sharp()) { @@ -256,9 +237,10 @@ void CDiscAdjMeshSolver::SetSensitivity(CGeometry *geometry, CSolver **solver, C /*--- Store the sensitivities ---*/ if (!time_stepping) { - solver[ADJFLOW_SOL]->node[iPoint]->SetSensitivity(iDim, Sensitivity); + solver[ADJFLOW_SOL]->GetNodes()->SetSensitivity(iPoint, iDim, Sensitivity); } else { - solver[ADJFLOW_SOL]->node[iPoint]->SetSensitivity(iDim, solver[ADJFLOW_SOL]->node[iPoint]->GetSensitivity(iDim) + Sensitivity); + solver[ADJFLOW_SOL]->GetNodes()->SetSensitivity(iPoint, iDim, + solver[ADJFLOW_SOL]->GetNodes()->GetSensitivity(iPoint, iDim) + Sensitivity); } } } @@ -268,6 +250,8 @@ void CDiscAdjMeshSolver::SetSensitivity(CGeometry *geometry, CSolver **solver, C void CDiscAdjMeshSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *config){ + // ToDo: Can this be made generic to use the CSolver impl + unsigned short iVar; unsigned long iPoint; su2double residual; @@ -275,19 +259,19 @@ void CDiscAdjMeshSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig /*--- Set Residuals to zero ---*/ for (iVar = 0; iVar < nVar; iVar++){ - SetRes_BGS(iVar,0.0); - SetRes_Max_BGS(iVar,0.0,0); + SetRes_BGS(iVar,0.0); + SetRes_Max_BGS(iVar,0.0,0); } /*--- Set the residuals ---*/ for (iPoint = 0; iPoint < nPointDomain; iPoint++){ /*--- Only for the boundary vertices ---*/ - if (node[iPoint]->Get_isVertex()){ + if (nodes->Get_isVertex(iPoint)){ for (iVar = 0; iVar < nVar; iVar++){ - /*--- Compute only for the sensitivities of the boundary displacements ---*/ - residual = node[iPoint]->GetBoundDisp_Sens(iVar) - node[iPoint]->Get_BGSSolution_k(iVar); - AddRes_BGS(iVar,residual*residual); - AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); + /*--- Compute only for the sensitivities of the boundary displacements ---*/ + residual = nodes->GetBoundDisp_Sens(iPoint,iVar) - nodes->Get_BGSSolution_k(iPoint,iVar); + AddRes_BGS(iVar,residual*residual); + AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); } } } @@ -296,19 +280,6 @@ void CDiscAdjMeshSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig } - -void CDiscAdjMeshSolver::UpdateSolution_BGS(CGeometry *geometry, CConfig *config){ - - unsigned long iPoint; - - /*--- To nPoint: The solution must be communicated beforehand ---*/ - for (iPoint = 0; iPoint < nPoint; iPoint++){ - if (node[iPoint]->Get_isVertex()) node[iPoint]->Set_BGSSolution_k(); - } - -} - - void CDiscAdjMeshSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) { } diff --git a/SU2_CFD/src/solvers/CMeshSolver.cpp b/SU2_CFD/src/solvers/CMeshSolver.cpp index 628f63f1a7b4..a68d8224bc41 100644 --- a/SU2_CFD/src/solvers/CMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CMeshSolver.cpp @@ -37,7 +37,6 @@ #include "../../../Common/include/adt_structure.hpp" #include "../../include/solvers/CMeshSolver.hpp" -#include "../../include/variables/CMeshVariable.hpp" #include "../../include/variables/CMeshBoundVariable.hpp" #include "../../include/variables/CMeshElement.hpp" @@ -78,33 +77,28 @@ CMeshSolver::CMeshSolver(CGeometry *geometry, CConfig *config) : CFEASolver(true MaxVolume_Curr = 0.0; /*--- Initialize the node structure ---*/ - bool isVertex; - long iVertex; - Coordinate = new su2double[nDim]; - node = new CVariable*[nPoint]; - for (iPoint = 0; iPoint < nPoint; iPoint++){ - /*--- We store directly the reference coordinates ---*/ - for (iDim = 0; iDim < nDim; iDim++) - Coordinate[iDim] = geometry->node[iPoint]->GetCoord(iDim); + Coordinate = new su2double[nDim]; + nodes = new CMeshBoundVariable(nPoint, nDim, config); + SetBaseClassPointerToNodes(); + + /*--- Set which points are vertices and allocate boundary data. ---*/ - /*--- In principle, the node is not at the boundary ---*/ - isVertex = false; - /*--- Looping over all markers ---*/ - for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + for (iPoint = 0; iPoint < nPoint; iPoint++) { - /*--- If the marker is flagged as deforming, retrieve the node vertex ---*/ - if (config->GetMarker_All_Deform_Mesh(iMarker) == YES) iVertex = geometry->node[iPoint]->GetVertex(iMarker); - else iVertex = -1; + for (iDim = 0; iDim < nDim; ++iDim) + nodes->SetMesh_Coord(iPoint, iDim, geometry->node[iPoint]->GetCoord(iDim)); - if (iVertex != -1){isVertex = true; break;} + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + long iVertex = geometry->node[iPoint]->GetVertex(iMarker); + if (iVertex >= 0) { + nodes->Set_isVertex(iPoint,true); + break; + } } - - /*--- Temporarily, keep everything the same ---*/ - if (isVertex) node[iPoint] = new CMeshBoundVariable(Coordinate, nDim, config); - else node[iPoint] = new CMeshVariable(Coordinate, nDim, config); - } + static_cast(nodes)->AllocateBoundaryVariables(config); + /*--- Initialize the element structure ---*/ element = new CMeshElement[nElement]; @@ -244,9 +238,9 @@ void CMeshSolver::SetMinMaxVolume(CGeometry *geometry, CConfig *config, bool upd /*--- Compute the volume with the reference or with the current coordinates ---*/ for (iDim = 0; iDim < nDim; iDim++) { - if (updated) val_Coord = node[indexNode[iNode]]->GetMesh_Coord(iDim) - + node[indexNode[iNode]]->GetSolution(iDim); - else val_Coord = node[indexNode[iNode]]->GetMesh_Coord(iDim); + if (updated) val_Coord = nodes->GetMesh_Coord(indexNode[iNode],iDim) + + nodes->GetSolution(indexNode[iNode],iDim); + else val_Coord = nodes->GetMesh_Coord(indexNode[iNode],iDim); element_container[FEA_TERM][EL_KIND]->SetRef_Coord(val_Coord, iNode, iDim); } } @@ -347,7 +341,7 @@ void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); PointIDs[jj++] = iPoint; for (iDim=0; iDimGetMesh_Coord(iDim); + Coord_bound[ii++] = nodes->GetMesh_Coord(iPoint,iDim); } } } @@ -378,9 +372,9 @@ void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { for(iPoint=0; iPoint< nPoint; ++iPoint) { - WallADT.DetermineNearestNode(node[iPoint]->GetMesh_Coord(), dist, + WallADT.DetermineNearestNode(nodes->GetMesh_Coord(iPoint), dist, pointID, rankID); - node[iPoint]->SetWallDistance(dist); + nodes->SetWallDistance(iPoint,dist); MaxDistance = max(MaxDistance, dist); @@ -405,8 +399,8 @@ void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { /*--- Normalize distance from 0 to 1 ---*/ for (iPoint=0; iPoint < nPoint; ++iPoint) { - nodeDist = node[iPoint]->GetWallDistance()/MaxDistance; - node[iPoint]->SetWallDistance(nodeDist); + nodeDist = nodes->GetWallDistance(iPoint)/MaxDistance; + nodes->SetWallDistance(iPoint,nodeDist); } /*--- Compute the element distances ---*/ @@ -428,7 +422,7 @@ void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { ElemDist = 0.0; for (iNodes = 0; iNodes < nNodes; iNodes++){ - ElemDist += node[PointCorners[iNodes]]->GetWallDistance(); + ElemDist += nodes->GetWallDistance(PointCorners[iNodes]); } ElemDist = ElemDist/(su2double)nNodes; @@ -464,7 +458,7 @@ void CMeshSolver::SetMesh_Stiffness(CGeometry **geometry, CNumerics **numerics, void CMeshSolver::DeformMesh(CGeometry **geometry, CNumerics **numerics, CConfig *config){ - if (multizone) SetSolution_Old(); + if (multizone) nodes->Set_BGSSolution_k(); /*--- Initialize sparse matrix ---*/ Jacobian.SetValZero(); @@ -530,9 +524,9 @@ void CMeshSolver::UpdateGridCoord(CGeometry *geometry, CConfig *config){ /*--- Retrieve the displacement from the solution of the linear system ---*/ val_disp = LinSysSol[total_index]; /*--- Store the displacement of the mesh node ---*/ - node[iPoint]->SetSolution(iDim, val_disp); + nodes->SetSolution(iPoint, iDim, val_disp); /*--- Compute the current coordinate as Mesh_Coord + Displacement ---*/ - val_coord = node[iPoint]->GetMesh_Coord(iDim) + val_disp; + val_coord = nodes->GetMesh_Coord(iPoint,iDim) + val_disp; /*--- Update the geometry container ---*/ geometry->node[iPoint]->SetCoord(iDim, val_coord); } @@ -578,9 +572,9 @@ void CMeshSolver::ComputeGridVelocity(CGeometry *geometry, CConfig *config){ /*--- Coordinates of the current point at n+1, n, & n-1 time levels ---*/ - Disp_nM1 = node[iPoint]->GetSolution_time_n1(); - Disp_n = node[iPoint]->GetSolution_time_n(); - Disp_nP1 = node[iPoint]->GetSolution(); + Disp_nM1 = nodes->GetSolution_time_n1(iPoint); + Disp_n = nodes->GetSolution_time_n(iPoint); + Disp_nP1 = nodes->GetSolution(iPoint); /*--- Unsteady time step ---*/ @@ -671,39 +665,8 @@ void CMeshSolver::SetBoundaryDisplacements(CGeometry *geometry, CNumerics *numer void CMeshSolver::SetDualTime_Mesh(void){ - unsigned long iPoint; - - for (iPoint = 0; iPoint < nPoint; iPoint++) { - node[iPoint]->Set_Solution_time_n1(); - node[iPoint]->Set_Solution_time_n(); - } - -} - -void CMeshSolver::ComputeResidual_Multizone(CGeometry *geometry, CConfig *config){ - - unsigned short iVar; - unsigned long iPoint; - su2double residual; - - /*--- Set Residuals to zero ---*/ - - for (iVar = 0; iVar < nVar; iVar++){ - SetRes_BGS(iVar,0.0); - SetRes_Max_BGS(iVar,0.0,0); - } - - /*--- Set the residuals ---*/ - for (iPoint = 0; iPoint < nPointDomain; iPoint++){ - for (iVar = 0; iVar < nVar; iVar++){ - residual = node[iPoint]->GetSolution(iVar) - node[iPoint]->GetSolution_Old(iVar); - AddRes_BGS(iVar,residual*residual); - AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord()); - } - } - - SetResidual_BGS(geometry, config); - + nodes->Set_Solution_time_n1(); + nodes->Set_Solution_time_n(); } void CMeshSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) { @@ -755,8 +718,8 @@ void CMeshSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, curr_coord); /*--- Store the displacements computed as the current coordinates minus the coordinates of the reference mesh file ---*/ - displ = curr_coord - node[iPoint_Local]->GetMesh_Coord(iDim); - node[iPoint_Local]->SetSolution(iDim, displ); + displ = curr_coord - nodes->GetMesh_Coord(iPoint_Local, iDim); + nodes->SetSolution(iPoint_Local, iDim, displ); } iPoint_Global_Local++; @@ -823,10 +786,10 @@ void CMeshSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * /*--- Store it into the current displacement. ---*/ for (iDim = 0; iDim < nDim; iDim++){ - VarCoord[iDim] = node[iNode]->GetSolution(iDim); + VarCoord[iDim] = nodes->GetSolution(iNode,iDim); } - node[iNode]->SetBound_Disp(VarCoord); + nodes->SetBound_Disp(iNode,VarCoord); } @@ -902,8 +865,8 @@ void CMeshSolver::Restart_OldGeometry(CGeometry *geometry, CConfig *config) { index = counter*Restart_Vars[1]; for (iDim = 0; iDim < nDim; iDim++){ curr_coord = Restart_Data[index+iDim]; - displ = curr_coord - node[iPoint_Local]->GetMesh_Coord(iDim); - node[iPoint_Local]->Set_Solution_time_n(iDim, displ); + displ = curr_coord - nodes->GetMesh_Coord(iPoint_Local,iDim); + nodes->Set_Solution_time_n(iPoint_Local, iDim, displ); } iPoint_Global_Local++; @@ -978,8 +941,8 @@ void CMeshSolver::Restart_OldGeometry(CGeometry *geometry, CConfig *config) { index = counter*Restart_Vars[1]; for (iDim = 0; iDim < nDim; iDim++){ curr_coord = Restart_Data[index+iDim]; - displ = curr_coord - node[iPoint_Local]->GetMesh_Coord(iDim); - node[iPoint_Local]->Set_Solution_time_n1(iDim, displ); + displ = curr_coord - nodes->GetMesh_Coord(iPoint_Local, iDim); + nodes->Set_Solution_time_n1(iPoint_Local, iDim, displ); } iPoint_Global_Local++; diff --git a/SU2_CFD/src/variables/CAdjEulerVariable.cpp b/SU2_CFD/src/variables/CAdjEulerVariable.cpp index d97a308fa0ec..40d97ee9e04d 100644 --- a/SU2_CFD/src/variables/CAdjEulerVariable.cpp +++ b/SU2_CFD/src/variables/CAdjEulerVariable.cpp @@ -37,214 +37,85 @@ #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 psirho, const su2double *phi, su2double psie, unsigned long npoint, unsigned long ndim, + unsigned long nvar, CConfig *config) : CVariable(npoint, ndim, 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->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - - /*--- Array initialization ---*/ - Psi = NULL; - ForceProj_Vector = NULL; - ObjFuncSource = NULL; - IntBoundary_Jump = NULL; - HB_Source = NULL; + bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); /*--- Allocate residual structures ---*/ - Res_TruncError = new su2double [nVar]; - - for (iVar = 0; iVar < nVar; iVar++) { - Res_TruncError[iVar] = 0.0; - } + Res_TruncError.resize(nPoint,nVar) = su2double(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]; - Solution_Max = new su2double [nVar]; - Solution_Min = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Limiter[iVar] = 0.0; - 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; - for (iDim = 0; iDim < nDim; iDim++) { - Solution[iDim+1] = val_phi[iDim]; - Solution_Old[iDim+1] = val_phi[iDim]; - } - - /*--- Allocate and initialize solution for dual time strategy ---*/ - if (dual_time) { - Solution_time_n[0] = val_psirho; - Solution_time_n1[0] = val_psirho; - for (iDim = 0; iDim < nDim; iDim++) { - Solution_time_n[iDim+1] = val_phi[iDim]; - Solution_time_n1[iDim+1] = val_phi[iDim]; + for (unsigned long iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + if (config->GetMG_CorrecSmooth(iMesh) > 0) { + Residual_Sum.resize(nPoint,nVar); + Residual_Old.resize(nPoint,nVar); + break; } - Solution_time_n[nVar-1] = val_psie; - Solution_time_n1[nVar-1] = val_psie; - - } - /*--- 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; + Gradient.resize(nPoint,nVar,nDim,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->GetTime_Marching() == HARMONIC_BALANCE) { - HB_Source = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) - HB_Source[iVar] = 0.0; - } - - if (config->GetMultizone_Problem()) - Set_BGSSolution_k(); -} - -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->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == 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]; + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); } /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ if (config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED) - Undivided_Laplacian = new su2double [nVar]; + Undivided_Laplacian.resize(nPoint,nVar); /*--- Always allocate the slope limiter, and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ - Limiter = new su2double [nVar]; - Solution_Max = new su2double [nVar]; - Solution_Min = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Limiter[iVar] = 0.0; - Solution_Max[iVar] = 0.0; - Solution_Min[iVar] = 0.0; - } + Limiter.resize(nPoint,nVar) = su2double(0.0); + Solution_Max.resize(nPoint,nVar) = su2double(0.0); + Solution_Min.resize(nPoint,nVar) = su2double(0.0); /*--- Solution initialization ---*/ - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = val_solution[iVar]; - Solution_Old[iVar] = val_solution[iVar]; - } + su2double val_solution[5] = {psirho, phi[0], phi[1], psie, psie}; + if(nDim==3) val_solution[3] = phi[2]; + + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution(iPoint,iVar) = val_solution[iVar]; + + Solution_Old = Solution; /*--- 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]; - } + Solution_time_n = Solution; + Solution_time_n1 = Solution; } /*--- Allocate auxiliar vector for sensitivity computation ---*/ - Grad_AuxVar = new su2double [nDim]; + AuxVar.resize(nPoint); + Grad_AuxVar.resize(nPoint,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; + ForceProj_Vector.resize(nPoint,nDim) = su2double(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; + IntBoundary_Jump.resize(nPoint,nVar) = su2double(0.0); /*--- Allocate space for the harmonic balance source terms ---*/ - if (config->GetTime_Marching() == HARMONIC_BALANCE) { - HB_Source = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) - HB_Source[iVar] = 0.0; - } - + if (config->GetTime_Marching() == HARMONIC_BALANCE) + HB_Source.resize(nPoint,nVar) = su2double(0.0); + if (config->GetMultizone_Problem()) Set_BGSSolution_k(); -} -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; + Sensor.resize(nPoint); } -bool CAdjEulerVariable::SetPrimVar(su2double SharpEdge_Distance, bool check, CConfig *config) { - unsigned short iVar; - bool check_dens = false, RightVol = true; +bool CAdjEulerVariable::SetPrimVar(unsigned long iPoint, su2double SharpEdge_Distance, bool check, CConfig *config) { + + bool RightVol = true; su2double adj_limit = config->GetAdjointLimit(); - check_dens = (fabs(Solution[0]) > adj_limit); + bool check_dens = (fabs(Solution(iPoint,0)) > adj_limit); /*--- Check that the adjoint solution is bounded ---*/ @@ -252,13 +123,12 @@ bool CAdjEulerVariable::SetPrimVar(su2double SharpEdge_Distance, bool check, CCo /*--- Copy the old solution ---*/ - for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution(iPoint,iVar) = Solution_Old(iPoint,iVar); RightVol = false; } return RightVol; - } diff --git a/SU2_CFD/src/variables/CAdjNSVariable.cpp b/SU2_CFD/src/variables/CAdjNSVariable.cpp index b83accf92a18..55334cd1fd3b 100644 --- a/SU2_CFD/src/variables/CAdjNSVariable.cpp +++ b/SU2_CFD/src/variables/CAdjNSVariable.cpp @@ -38,15 +38,5 @@ #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) { } +CAdjNSVariable::CAdjNSVariable(su2double psirho, const su2double *phi, su2double psie, unsigned long npoint, unsigned long ndim, unsigned long nvar, + CConfig *config) : CAdjEulerVariable(psirho, phi, psie, npoint, ndim, nvar, config) { } diff --git a/SU2_CFD/src/variables/CAdjTurbVariable.cpp b/SU2_CFD/src/variables/CAdjTurbVariable.cpp index eb7a671f35dc..d96117c6be64 100644 --- a/SU2_CFD/src/variables/CAdjTurbVariable.cpp +++ b/SU2_CFD/src/variables/CAdjTurbVariable.cpp @@ -37,51 +37,30 @@ #include "../../include/variables/CAdjTurbVariable.hpp" -CAdjTurbVariable::CAdjTurbVariable(void) : CVariable() { - /*--- Array initialization ---*/ +CAdjTurbVariable::CAdjTurbVariable(su2double psinu_inf, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) + : CVariable(npoint, ndim, nvar, config) { - dmuT_dUTvar = NULL; - dRTstar_dUTvar = NULL; - dFT_dUTvar = NULL; - EddyViscSens = NULL; + /*--- Initialization of variables ---*/ -} + Solution = psinu_inf; + Solution_Old = psinu_inf; -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; + Residual_Old.resize(nPoint,nVar); - /*--- Array initialization ---*/ + /*--- Gradient related fields. ---*/ - dmuT_dUTvar = NULL; - dRTstar_dUTvar = NULL; - dFT_dUTvar = NULL; - EddyViscSens = NULL; + Gradient.resize(nPoint,nVar,nDim,0.0); - /*--- Initialization of variables ---*/ - - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = val_psinu_inf; - Solution_Old[iVar] = val_psinu_inf; + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); } - Residual_Old = 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]; - for (iVar = 0; iVar < nVar; iVar++) - Limiter[iVar] = 0.0; - + Limiter.resize(nPoint,nVar) = su2double(0.0); + if (config->GetMultizone_Problem()) Set_BGSSolution_k(); } - -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 31aaf5c47eaf..3f41c7b01ef4 100644 --- a/SU2_CFD/src/variables/CBaselineVariable.cpp +++ b/SU2_CFD/src/variables/CBaselineVariable.cpp @@ -37,14 +37,8 @@ #include "../../include/variables/CBaselineVariable.hpp" -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(unsigned long npoint, unsigned long nvar, CConfig *config) + : CVariable(npoint,nvar,config) { } - -CBaselineVariable::~CBaselineVariable(void) { } - diff --git a/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp b/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp index 8a7d62fedfe9..5082cf94b1c5 100644 --- a/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp @@ -37,30 +37,24 @@ #include "../../include/variables/CDiscAdjFEABoundVariable.hpp" -CDiscAdjFEABoundVariable::CDiscAdjFEABoundVariable() : CDiscAdjFEAVariable(){ - - FlowTraction_Sens = NULL; - SourceTerm_DispAdjoint = NULL; +CDiscAdjFEABoundVariable::CDiscAdjFEABoundVariable(const su2double *disp, const su2double *vel, + const su2double *accel, unsigned long npoint, unsigned long ndim, unsigned long nvar, bool unsteady, CConfig *config) : + CDiscAdjFEAVariable(disp, vel, accel, npoint, ndim, nvar, unsteady, config) { + VertexMap.Reset(nPoint); } -CDiscAdjFEABoundVariable::CDiscAdjFEABoundVariable(su2double* val_solution, unsigned short val_ndim, - unsigned short val_nvar, CConfig *config) : CDiscAdjFEAVariable(val_solution, val_ndim, val_nvar, config){ +void CDiscAdjFEABoundVariable::AllocateBoundaryVariables(CConfig *config) { + if (VertexMap.GetIsValid()) return; // nothing to do - unsigned short iDim; - FlowTraction_Sens = new su2double[nDim]; - SourceTerm_DispAdjoint = new su2double[nDim]; - for (iDim = 0; iDim < nDim; iDim++){ - FlowTraction_Sens[iDim] = val_solution[iDim]; - SourceTerm_DispAdjoint[iDim] = 0.0; - } + /*--- Count number of vertices and build map ---*/ -} + unsigned long nBoundPt = VertexMap.Build(); -CDiscAdjFEABoundVariable::~CDiscAdjFEABoundVariable(){ + /*--- Allocate ---*/ - if (FlowTraction_Sens != NULL) delete [] FlowTraction_Sens; - if (SourceTerm_DispAdjoint != NULL) delete [] SourceTerm_DispAdjoint; + FlowTraction_Sens.resize(nBoundPt,nDim) = su2double(0.0); + SourceTerm_DispAdjoint.resize(nBoundPt,nDim) = su2double(0.0); } diff --git a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp index bc10bc8fa15a..94b5b3c1d608 100644 --- a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp @@ -37,208 +37,62 @@ #include "../../include/variables/CDiscAdjFEAVariable.hpp" -CDiscAdjFEAVariable::CDiscAdjFEAVariable() : CVariable(){ - Sensitivity = NULL; - Solution_Direct = NULL; - - Dynamic_Derivative = NULL; - Dynamic_Derivative_n = NULL; - Dynamic_Derivative_Vel = NULL; - Dynamic_Derivative_Vel_n = NULL; - Dynamic_Derivative_Accel = NULL; - Dynamic_Derivative_Accel_n = NULL; - - Solution_Direct_Vel = NULL; - Solution_Direct_Accel = NULL; - - Solution_Vel = NULL; - Solution_Accel = NULL; - - Solution_Old_Vel = NULL; - Solution_Old_Accel = NULL; - - Solution_Vel_time_n = NULL; - Solution_Accel_time_n = NULL; - - Cross_Term_Derivative = NULL; - Geometry_CrossTerm_Derivative = NULL; - - Solution_BGS = NULL; - -} - -CDiscAdjFEAVariable::CDiscAdjFEAVariable(su2double* val_solution, unsigned short val_ndim, unsigned short val_nvar, - CConfig *config) : CVariable(val_ndim, val_nvar, config){ +CDiscAdjFEAVariable::CDiscAdjFEAVariable(const su2double *disp, const su2double *vel, const su2double *accel, unsigned long npoint, + unsigned long ndim, unsigned long nvar, bool unsteady, CConfig *config) : CVariable(npoint, ndim, nvar, config) { bool fsi = config->GetFSI_Simulation(); - Dynamic_Derivative = NULL; - Dynamic_Derivative_n = NULL; - Dynamic_Derivative_Vel = NULL; - Dynamic_Derivative_Vel_n = NULL; - Dynamic_Derivative_Accel = NULL; - Dynamic_Derivative_Accel_n = NULL; - - Solution_Direct_Vel = NULL; - Solution_Direct_Accel = NULL; - - Solution_Vel = NULL; - Solution_Accel = NULL; - - Solution_Old_Vel = NULL; - Solution_Old_Accel = NULL; + Solution_Direct.resize(nPoint,nVar); - Solution_Vel_time_n = NULL; - Solution_Accel_time_n = NULL; + Sensitivity.resize(nPoint,nDim) = su2double(0.0); - Solution_Direct = new su2double[nVar]; + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution(iPoint,iVar) = disp[iVar]; - Sensitivity = new su2double[nDim]; - - unsigned short iVar,iDim; - - for (iDim = 0; iDim < nDim; iDim++){ - Sensitivity[iDim] = 0.0; - } - - for (iVar = 0; iVar < nVar; iVar++){ - Solution[iVar] = val_solution[iVar]; - } - - Solution_BGS = NULL; - Cross_Term_Derivative = NULL; - Geometry_CrossTerm_Derivative = NULL; - if (fsi){ - Cross_Term_Derivative = new su2double[nDim]; - Geometry_CrossTerm_Derivative = new su2double[nDim]; - Solution_BGS = new su2double[nDim]; - for (iDim = 0; iDim < nDim; iDim++) { - Geometry_CrossTerm_Derivative [iDim] = 0.0; - Cross_Term_Derivative[iDim] = 0.0; - Solution_BGS[iDim] = 0.0; - } + if (fsi) { + Cross_Term_Derivative.resize(nPoint,nDim) = su2double(0.0); + Geometry_CrossTerm_Derivative.resize(nPoint,nDim) = su2double(0.0); + + Solution_BGS.resize(nPoint,nDim) = su2double(0.0); } if (config->GetMultizone_Problem()) Set_BGSSolution_k(); - -} - -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(); - - Dynamic_Derivative = new su2double[nVar]; - Dynamic_Derivative_n = new su2double[nVar]; - Dynamic_Derivative_Vel = new su2double[nVar]; - Dynamic_Derivative_Vel_n = new su2double[nVar]; - Dynamic_Derivative_Accel = new su2double[nVar]; - Dynamic_Derivative_Accel_n = new su2double[nVar]; - Solution_Direct_Vel = new su2double[nVar]; - Solution_Direct_Accel = new su2double[nVar]; + /*--- Nothing else to allocate ---*/ + if (!unsteady) return; - Solution_Vel = new su2double[nVar]; - Solution_Accel = new su2double[nVar]; - Solution_Old_Vel = new su2double[nVar]; - Solution_Old_Accel = new su2double[nVar]; + Dynamic_Derivative.resize(nPoint,nVar) = su2double(0.0); + Dynamic_Derivative_n.resize(nPoint,nVar) = su2double(0.0); + Dynamic_Derivative_Vel.resize(nPoint,nVar) = su2double(0.0); + Dynamic_Derivative_Vel_n.resize(nPoint,nVar) = su2double(0.0); + Dynamic_Derivative_Accel.resize(nPoint,nVar) = su2double(0.0); + Dynamic_Derivative_Accel_n.resize(nPoint,nVar) = su2double(0.0); - Solution_Vel_time_n = new su2double[nVar]; - Solution_Accel_time_n = new su2double[nVar]; + Solution_Direct_Vel.resize(nPoint,nVar) = su2double(0.0); + Solution_Direct_Accel.resize(nPoint,nVar) = su2double(0.0); - Solution_Direct = new su2double[nVar]; + Solution_Vel.resize(nPoint,nVar); + Solution_Accel.resize(nPoint,nVar); - Sensitivity = new su2double[nDim]; + Solution_Old_Vel.resize(nPoint,nVar) = su2double(0.0); + Solution_Old_Accel.resize(nPoint,nVar) = su2double(0.0); - unsigned short iVar,iDim; + Solution_Vel_time_n.resize(nPoint,nVar) = su2double(0.0); + Solution_Accel_time_n.resize(nPoint,nVar) = su2double(0.0); - for (iDim = 0; iDim < nDim; iDim++){ - Sensitivity[iDim] = 0.0; - } - - for (iVar = 0; iVar < nVar; iVar++){ - Solution[iVar] = val_solution[iVar]; - } - - for (iVar = 0; iVar < nVar; iVar++){ - Solution_Accel[iVar] = val_solution_accel[iVar]; - } - - for (iVar = 0; iVar < nVar; iVar++){ - Solution_Vel[iVar] = val_solution_vel[iVar]; - } - - /*--- Initialize the rest to 0 ---*/ - - for (iVar = 0; iVar < nVar; iVar++){ - Dynamic_Derivative[iVar] = 0.0; - Dynamic_Derivative_n[iVar] = 0.0; - Dynamic_Derivative_Vel[iVar] = 0.0; - Dynamic_Derivative_Vel_n[iVar] = 0.0; - Dynamic_Derivative_Accel[iVar] = 0.0; - Dynamic_Derivative_Accel_n[iVar] = 0.0; - - Solution_Direct_Vel[iVar] = 0.0; - Solution_Direct_Accel[iVar] = 0.0; - - Solution_Vel_time_n[iVar] = 0.0; - Solution_Accel_time_n[iVar] = 0.0; - - Solution_Old_Vel[iVar] = 0.0; - Solution_Old_Accel[iVar] = 0.0; - - } - - Solution_BGS = NULL; - Solution_BGS_k = NULL; - Cross_Term_Derivative = NULL; - Geometry_CrossTerm_Derivative = NULL; - if (fsi){ - Cross_Term_Derivative = new su2double[nDim]; - Geometry_CrossTerm_Derivative = new su2double[nDim]; - Solution_BGS_k = new su2double[nDim]; - for (iDim = 0; iDim < nDim; iDim++) { - Geometry_CrossTerm_Derivative [iDim] = 0.0; - Cross_Term_Derivative[iDim] = 0.0; - Solution_BGS[iDim] = 0.0; - Solution_BGS_k[iDim] = 0.0; + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) { + Solution_Vel(iPoint,iVar) = vel[iVar]; + Solution_Accel(iPoint,iVar) = accel[iVar]; } } } +void CDiscAdjFEAVariable::Set_OldSolution_Vel() { Solution_Old_Vel = Solution_Vel; } -CDiscAdjFEAVariable::~CDiscAdjFEAVariable(){ - - if (Sensitivity != NULL) delete [] Sensitivity; - if (Solution_Direct != NULL) delete [] Solution_Direct; - - if (Dynamic_Derivative != NULL) delete [] Dynamic_Derivative; - if (Dynamic_Derivative_n != NULL) delete [] Dynamic_Derivative_n; - if (Dynamic_Derivative_Vel != NULL) delete [] Dynamic_Derivative_Vel; - if (Dynamic_Derivative_Vel_n != NULL) delete [] Dynamic_Derivative_Vel_n; - if (Dynamic_Derivative_Accel != NULL) delete [] Dynamic_Derivative_Accel; - if (Dynamic_Derivative_Accel_n != NULL) delete [] Dynamic_Derivative_Accel_n; - - if (Solution_Direct_Vel != NULL) delete [] Solution_Direct_Vel; - if (Solution_Direct_Accel != NULL) delete [] Solution_Direct_Accel; - - if (Solution_Vel != NULL) delete [] Solution_Vel; - if (Solution_Accel != NULL) delete [] Solution_Accel; - - if (Solution_Vel_time_n != NULL) delete [] Solution_Vel_time_n; - if (Solution_Accel_time_n != NULL) delete [] Solution_Accel_time_n; - - if (Solution_Old_Vel != NULL) delete [] Solution_Old_Vel; - if (Solution_Old_Accel != NULL) delete [] Solution_Old_Accel; - - if (Cross_Term_Derivative != NULL) delete [] Cross_Term_Derivative; - if (Geometry_CrossTerm_Derivative != NULL) delete [] Geometry_CrossTerm_Derivative; - - if (Solution_BGS != NULL) delete [] Solution_BGS; - -} +void CDiscAdjFEAVariable::Set_OldSolution_Accel() { Solution_Old_Accel = Solution_Accel; } diff --git a/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp b/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp index 08bcf8a07880..8a7544fbfa8c 100644 --- a/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp @@ -35,37 +35,40 @@ * License along with SU2. If not, see . */ - #include "../../include/variables/CDiscAdjMeshBoundVariable.hpp" -CDiscAdjMeshBoundVariable::CDiscAdjMeshBoundVariable(su2double *val_coor, unsigned short val_nDim, CConfig *config) : CDiscAdjMeshVariable(val_coor, val_nDim, config) { - unsigned short iDim; +CDiscAdjMeshBoundVariable::CDiscAdjMeshBoundVariable(unsigned long npoint, unsigned long ndim, CConfig *config) : + CVariable(npoint, ndim, config) { + + nDim = ndim; + + VertexMap.Reset(nPoint); +} + +void CDiscAdjMeshBoundVariable::AllocateBoundaryVariables(CConfig *config) { + + if (VertexMap.GetIsValid()) return; // nothing to do + + /*--- Count number of vertices and build map ---*/ + + unsigned long nBoundPt = VertexMap.Build(); + + /*--- Allocate ---*/ bool fsi = false; /*--- Initialize Boundary Displacement container to 0.0 ---*/ - Bound_Disp_Sens = new su2double [nDim]; - Bound_Disp_Direct = new su2double [nDim]; - for (iDim = 0; iDim < nDim; iDim++){ - Bound_Disp_Sens[iDim] = 0.0; - Bound_Disp_Direct[iDim] = 0.0; - } - /*--- Container for the BGS solution at the previous iteration ---*/ - Solution_BGS_k = NULL; - if (fsi){ - Solution_BGS_k = new su2double[nDim]; - for (iDim = 0; iDim < nDim; iDim++) { - Solution_BGS_k[iDim] = 0.0; - } - } + Bound_Disp_Sens.resize(nBoundPt,nDim) = su2double(0.0); + Bound_Disp_Direct.resize(nBoundPt,nDim) = su2double(0.0); -} + /*--- Container for the BGS solution at the previous iteration ---*/ -CDiscAdjMeshBoundVariable::~CDiscAdjMeshBoundVariable(void) { + if (fsi) Solution_BGS_k.resize(nBoundPt,nDim) = su2double(0.0); - if (Bound_Disp_Sens != NULL) delete [] Bound_Disp_Sens; - if (Bound_Disp_Direct != NULL) delete [] Bound_Disp_Direct; +} +void CDiscAdjMeshBoundVariable::Set_BGSSolution_k() { + Solution_BGS_k = Bound_Disp_Sens; } diff --git a/SU2_CFD/src/variables/CDiscAdjMeshVariable.cpp b/SU2_CFD/src/variables/CDiscAdjMeshVariable.cpp deleted file mode 100644 index 1e351dbb4448..000000000000 --- a/SU2_CFD/src/variables/CDiscAdjMeshVariable.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/*! - * \file CDiscAdjMeshVariable.cpp - * \brief Main subroutines for the discrete adjoint mesh variable structure. - * \author Ruben 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/CDiscAdjMeshVariable.hpp" - -CDiscAdjMeshVariable::CDiscAdjMeshVariable(su2double *val_coor, unsigned short val_nDim, CConfig *config) : CVariable(val_nDim, config) { - - /*--- Store the dimensionality of the problem ---*/ - nDim = val_nDim; - -} - -CDiscAdjMeshVariable::~CDiscAdjMeshVariable(void) { - -} diff --git a/SU2_CFD/src/variables/CDiscAdjVariable.cpp b/SU2_CFD/src/variables/CDiscAdjVariable.cpp index def9f45c835f..c8ef81878871 100644 --- a/SU2_CFD/src/variables/CDiscAdjVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjVariable.cpp @@ -37,143 +37,49 @@ #include "../../include/variables/CDiscAdjVariable.hpp" -CDiscAdjVariable::CDiscAdjVariable() : CVariable() { - /*--- Initialize arrays to NULL ---*/ +CDiscAdjVariable::CDiscAdjVariable(const su2double* sol, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) + : CVariable(npoint, ndim, nvar, config) { - Solution_Direct = NULL; - External = NULL; - Solution_Old = 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, - CConfig *config) : CVariable(val_ndim, val_nvar, config) { - - bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) - || (config->GetTime_Marching() == DT_STEPPING_2ND); + bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); bool fsi = config->GetFSI_Simulation(); - /*--- Initialize arrays to NULL ---*/ - - Solution_Direct = NULL; - External = NULL; - External_Old = 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_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]; + DualTime_Derivative.resize(nPoint,nVar) = su2double(0.0); + DualTime_Derivative_n.resize(nPoint,nVar) = su2double(0.0); + + Solution_time_n.resize(nPoint,nVar) = su2double(0.0); + Solution_time_n1.resize(nPoint,nVar) = su2double(0.0); } - Solution_Direct = new su2double[nVar]; - External = new su2double[nVar]; - External_Old = new su2double[nVar]; + Solution_Direct.resize(nPoint,nVar); + Sensitivity.resize(nPoint,nDim) = su2double(0.0); - Sensitivity = new su2double[nDim]; + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) + for (unsigned long iVar = 0; iVar < nVar; ++iVar) + Solution(iPoint,iVar) = sol[iVar]; - unsigned short iVar,iDim; + External = Solution; + External_Old.resize(nPoint,nVar) = su2double(0.0); - for (iDim = 0; iDim < nDim; iDim++) { - Sensitivity[iDim] = 0.0; - } + if (fsi) { + Geometry_Direct.resize(nPoint,nDim) = su2double(0.0); + Solution_Geometry.resize(nPoint,nDim) = su2double(1e-16); + Solution_Geometry_Old.resize(nPoint,nDim) = su2double(0.0); + Cross_Term_Derivative.resize(nPoint,nVar) = su2double(0.0); + Geometry_CrossTerm_Derivative.resize(nPoint,nDim) = su2double(0.0); + Geometry_CrossTerm_Derivative_Flow.resize(nPoint,nDim) = su2double(0.0); - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = val_solution[iVar]; - External[iVar] = val_solution[iVar]; + Solution_BGS.resize(nPoint,nVar) = su2double(0.0); + Solution_Geometry_BGS_k.resize(nPoint,nDim) = su2double(0.0); } - if (dual_time) { - for (iVar = 0; iVar < nVar; iVar++) { - Solution_time_n[iVar] = 0.0; - Solution_time_n1[iVar] = 0.0; - DualTime_Derivative[iVar] = 0.0; - DualTime_Derivative_n[iVar] = 0.0; - } - } - - if (fsi){ - Solution_Geometry = new su2double[nDim]; - Geometry_Direct = new su2double[nDim]; - Solution_Geometry_Old = new su2double[nDim]; - Geometry_CrossTerm_Derivative = new su2double[nDim]; - Geometry_CrossTerm_Derivative_Flow = new su2double[nDim]; - Cross_Term_Derivative = new su2double[nVar]; - Solution_BGS = new su2double[nVar]; - Solution_Geometry_BGS_k = new su2double[nDim]; - for (iDim = 0; iDim < nDim; iDim++) { - Geometry_Direct[iDim] = 0.0; - Solution_Geometry[iDim] = 1e-16; - Solution_Geometry_Old[iDim] = 0.0; - Solution_Geometry_BGS_k[iDim] = 0.0; - Geometry_CrossTerm_Derivative[iDim] = 0.0; - Geometry_CrossTerm_Derivative_Flow[iDim] = 0.0; - } - for (iVar = 0; iVar < nVar; iVar++) { - Cross_Term_Derivative[iVar] = 0.0; - Solution_BGS[iVar] = 0.0; - } - } - if (config->GetMultizone_Problem()) { - - Solution_BGS = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Solution_BGS[iVar] = 0.0; - } - + Solution_BGS.resize(nPoint,nVar) = su2double(0.0); Set_BGSSolution_k(); } } -CDiscAdjVariable::~CDiscAdjVariable() { - - if (Geometry_Direct != NULL) delete [] Geometry_Direct; - if (Solution_Geometry != NULL) delete [] Solution_Geometry; - if (Solution_Geometry_Old != NULL) delete [] Solution_Geometry_Old; - if (Cross_Term_Derivative != NULL) delete [] Cross_Term_Derivative; - if (Geometry_CrossTerm_Derivative != NULL) delete [] Geometry_CrossTerm_Derivative; - if (Geometry_CrossTerm_Derivative_Flow != NULL) delete [] Geometry_CrossTerm_Derivative_Flow; - if (Solution_BGS != NULL) delete [] Solution_BGS; - if (Solution_Geometry_BGS_k != NULL) delete [] Solution_Geometry_BGS_k; - - if (Solution_Direct != NULL) delete [] Solution_Direct; - if (External != NULL) delete [] External; - if (External_Old != NULL) delete [] External_Old; - if (Sensitivity != NULL) delete [] Sensitivity; - - if (DualTime_Derivative != NULL) delete [] DualTime_Derivative; - if (DualTime_Derivative_n != NULL) delete [] DualTime_Derivative_n; - -} +void CDiscAdjVariable::Set_OldSolution_Geometry() { Solution_Geometry_Old = Solution_Geometry; } diff --git a/SU2_CFD/src/variables/CEulerVariable.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp index 17a939b2bff5..639a4b9f0802 100644 --- a/SU2_CFD/src/variables/CEulerVariable.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -37,422 +37,130 @@ #include "../../include/variables/CEulerVariable.hpp" -CEulerVariable::CEulerVariable(void) : CVariable() { - /*--- Array initialization ---*/ +CEulerVariable::CEulerVariable(su2double density, const su2double *velocity, su2double energy, unsigned long npoint, + unsigned long ndim, unsigned long nvar, CConfig *config) : CVariable(npoint, ndim, nvar, config) { - 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; - - Solution_New = NULL; - -} - -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->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - bool viscous = config->GetViscous(); - bool windgust = config->GetWind_Gust(); + bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); + bool viscous = config->GetViscous(); + bool windgust = config->GetWind_Gust(); bool classical_rk4 = (config->GetKind_TimeIntScheme_Flow() == CLASSICAL_RK4_EXPLICIT); - /*--- 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; - - 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; } + nPrimVar = nDim+9; + nPrimVarGrad = nDim+4; + nSecondaryVar = viscous? 8 : 2; + nSecondaryVarGrad = 2; /*--- Allocate residual structures ---*/ - Res_TruncError = new su2double [nVar]; - - for (iVar = 0; iVar < nVar; iVar++) { - Res_TruncError[iVar] = 0.0; - } + Res_TruncError.resize(nPoint,nVar) = su2double(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; - - 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; - Solution_Old[0] = val_density; - for (iDim = 0; iDim < nDim; iDim++) { - Solution[iDim+1] = val_density*val_velocity[iDim]; - Solution_Old[iDim+1] = val_density*val_velocity[iDim]; - } - Solution[nVar-1] = val_density*val_energy; - Solution_Old[nVar-1] = val_density*val_energy; - - /*--- New solution initialization for Classical RK4 ---*/ - - if (classical_rk4) { - Solution_New = new su2double[nVar]; - Solution_New[0] = val_density; - for (iDim = 0; iDim < nDim; iDim++) { - Solution_New[iDim+1] = val_density*val_velocity[iDim]; - } - Solution_New[nVar-1] = val_density*val_energy; - } - - /*--- Allocate and initialize solution for dual time strategy ---*/ - - if (dual_time) { - Solution_time_n[0] = val_density; - Solution_time_n1[0] = val_density; - for (iDim = 0; iDim < nDim; iDim++) { - Solution_time_n[iDim+1] = val_density*val_velocity[iDim]; - Solution_time_n1[iDim+1] = val_density*val_velocity[iDim]; + for (unsigned long iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + if (config->GetMG_CorrecSmooth(iMesh) > 0) { + Residual_Sum.resize(nPoint,nVar); + Residual_Old.resize(nPoint,nVar); + break; } - Solution_time_n[nVar-1] = val_density*val_energy; - Solution_time_n1[nVar-1] = val_density*val_energy; - } - - - /*--- Allocate space for the harmonic balance source terms ---*/ - - if (config->GetTime_Marching() == 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]; - for (iDim = 0; iDim < nDim; iDim++) - Gradient_Primitive[iVar][iDim] = 0.0; - } - - Gradient_Secondary = new su2double* [nSecondaryVarGrad]; - for (iVar = 0; iVar < nSecondaryVarGrad; iVar++) { - Gradient_Secondary[iVar] = new su2double [nDim]; - for (iDim = 0; iDim < nDim; iDim++) - Gradient_Secondary[iVar][iDim] = 0.0; - } - - if (config->GetMultizone_Problem()) - Set_BGSSolution_k(); -} - -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->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - bool viscous = config->GetViscous(); - bool windgust = config->GetWind_Gust(); - bool classical_rk4 = (config->GetKind_TimeIntScheme_Flow() == CLASSICAL_RK4_EXPLICIT); - - /*--- 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; - - 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]; + Undivided_Laplacian.resize(nPoint,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_Primitive.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Limiter.resize(nPoint,nVar) = su2double(0.0); - Limiter_Secondary = new su2double [nSecondaryVarGrad]; - for (iVar = 0; iVar < nSecondaryVarGrad; iVar++) - Limiter_Secondary[iVar] = 0.0; + Solution_Max.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Min.resize(nPoint,nPrimVarGrad) = su2double(0.0); - Limiter = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) - Limiter[iVar] = 0.0; + /*--- Solution initialization ---*/ - 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; - } + su2double val_solution[5] = {su2double(1.0), velocity[0], velocity[1], energy, energy}; + if(nDim==3) val_solution[3] = velocity[2]; - /*--- Solution initialization ---*/ + for(unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) + for (unsigned long iVar = 0; iVar < nVar; ++iVar) + Solution(iPoint,iVar) = density*val_solution[iVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = val_solution[iVar]; - Solution_Old[iVar] = val_solution[iVar]; - } + Solution_Old = Solution; /*--- New solution initialization for Classical RK4 ---*/ - if (classical_rk4) { - Solution_New = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Solution_New[iVar] = val_solution[iVar]; - } - } + if (classical_rk4) Solution_New = Solution; /*--- 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]; - } + Solution_time_n = Solution; + Solution_time_n1 = Solution; } /*--- Allocate space for the harmonic balance source terms ---*/ - if (config->GetTime_Marching() == HARMONIC_BALANCE) { - HB_Source = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) HB_Source[iVar] = 0.0; - } + if (config->GetTime_Marching() == HARMONIC_BALANCE) + HB_Source.resize(nPoint,nVar) = su2double(0.0); /*--- Allocate vector for wind gust and wind gust derivative field ---*/ if (windgust) { - WindGust = new su2double [nDim]; - WindGustDer = new su2double [nDim+1]; + WindGust.resize(nPoint,nDim); + WindGustDer.resize(nPoint,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; - + Primitive.resize(nPoint,nPrimVar) = su2double(0.0); + Secondary.resize(nPoint,nSecondaryVar) = su2double(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]; - for (iDim = 0; iDim < nDim; iDim++) - Gradient_Primitive[iVar][iDim] = 0.0; - } + Gradient_Primitive.resize(nPoint,nPrimVarGrad,nDim,0.0); - Gradient_Secondary = new su2double* [nSecondaryVarGrad]; - for (iVar = 0; iVar < nSecondaryVarGrad; iVar++) { - Gradient_Secondary[iVar] = new su2double [nDim]; - for (iDim = 0; iDim < nDim; iDim++) - Gradient_Secondary[iVar][iDim] = 0.0; + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); } - + if (config->GetMultizone_Problem()) Set_BGSSolution_k(); -} - -CEulerVariable::~CEulerVariable(void) { - unsigned short iVar; - - if (HB_Source != NULL) delete [] HB_Source; - if (Primitive != NULL) delete [] Primitive; - if (Secondary != NULL) delete [] Secondary; - if (Limiter_Primitive != NULL) delete [] Limiter_Primitive; - if (Limiter_Secondary != NULL) delete [] Limiter_Secondary; - if (WindGust != NULL) delete [] WindGust; - if (WindGustDer != NULL) delete [] WindGustDer; - - if (Gradient_Primitive != NULL) { - for (iVar = 0; iVar < nPrimVarGrad; iVar++) - if (Gradient_Primitive[iVar] != NULL) delete [] Gradient_Primitive[iVar]; - delete [] Gradient_Primitive; - } - if (Gradient_Secondary != NULL) { - for (iVar = 0; iVar < nSecondaryVarGrad; iVar++) - if (Gradient_Secondary[iVar] != NULL) delete [] Gradient_Secondary[iVar]; - delete [] Gradient_Secondary; - } - - if (Solution_New != NULL) delete [] Solution_New; -} -void CEulerVariable::SetGradient_PrimitiveZero(unsigned short val_primvar) { - unsigned short iVar, iDim; + Velocity2.resize(nPoint) = su2double(0.0); + Max_Lambda_Inv.resize(nPoint) = su2double(0.0); + Delta_Time.resize(nPoint) = su2double(0.0); + Lambda.resize(nPoint) = su2double(0.0); + Sensor.resize(nPoint) = su2double(0.0); - for (iVar = 0; iVar < val_primvar; iVar++) - for (iDim = 0; iDim < nDim; iDim++) - Gradient_Primitive[iVar][iDim] = 0.0; } -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; +void CEulerVariable::SetGradient_PrimitiveZero() { + Gradient_Primitive.storage.setConstant(0.0); } -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(unsigned long iPoint, CFluidModel *FluidModel) { -bool CEulerVariable::SetPrimVar(CFluidModel *FluidModel) { - unsigned short iVar; - bool check_dens = false, check_press = false, check_sos = false, check_temp = false, RightVol = true; + bool RightVol = true; - - SetVelocity(); // Computes velocity and velocity^2 - su2double density = GetDensity(); - su2double staticEnergy = GetEnergy()-0.5*Velocity2; + SetVelocity(iPoint); // Computes velocity and velocity^2 + su2double density = GetDensity(iPoint); + su2double staticEnergy = GetEnergy(iPoint)-0.5*Velocity2(iPoint); /*--- 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()); + bool check_dens = SetDensity(iPoint); + bool check_press = SetPressure(iPoint, FluidModel->GetPressure()); + bool check_sos = SetSoundSpeed(iPoint, FluidModel->GetSoundSpeed2()); + bool check_temp = SetTemperature(iPoint, FluidModel->GetTemperature()); /*--- Check that the solution has a physical meaning ---*/ @@ -460,40 +168,38 @@ bool CEulerVariable::SetPrimVar(CFluidModel *FluidModel) { /*--- Copy the old solution ---*/ - for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution(iPoint, iVar) = Solution_Old(iPoint, iVar); /*--- Recompute the primitive variables ---*/ - SetVelocity(); // Computes velocity and velocity^2 - su2double density = GetDensity(); - su2double staticEnergy = GetEnergy()-0.5*Velocity2; + SetVelocity(iPoint); // Computes velocity and velocity^2 + su2double density = GetDensity(iPoint); + su2double staticEnergy = GetEnergy(iPoint)-0.5*Velocity2(iPoint); /* 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()); + SetDensity(iPoint); + SetPressure(iPoint, FluidModel->GetPressure()); + SetSoundSpeed(iPoint, FluidModel->GetSoundSpeed2()); + SetTemperature(iPoint, FluidModel->GetTemperature()); RightVol = false; } - /*--- Set enthalpy ---*/ - - SetEnthalpy(); // Requires pressure computation. + SetEnthalpy(iPoint); // Requires pressure computation. return RightVol; - } -void CEulerVariable::SetSecondaryVar(CFluidModel *FluidModel) { +void CEulerVariable::SetSecondaryVar(unsigned long iPoint, CFluidModel *FluidModel) { /*--- Compute secondary thermo-physical properties (partial derivatives...) ---*/ - SetdPdrho_e(FluidModel->GetdPdrho_e()); - SetdPde_rho(FluidModel->GetdPde_rho()); + SetdPdrho_e(iPoint, FluidModel->GetdPdrho_e()); + SetdPde_rho(iPoint, FluidModel->GetdPde_rho()); } +void CEulerVariable::SetSolution_New() { Solution_New = Solution; } diff --git a/SU2_CFD/src/variables/CFEABoundVariable.cpp b/SU2_CFD/src/variables/CFEABoundVariable.cpp index db7e26be2c36..07b4cfcb043d 100644 --- a/SU2_CFD/src/variables/CFEABoundVariable.cpp +++ b/SU2_CFD/src/variables/CFEABoundVariable.cpp @@ -38,37 +38,48 @@ #include "../../include/variables/CFEABoundVariable.hpp" -CFEABoundVariable::CFEABoundVariable(void) : CFEAVariable() { - - Residual_Ext_Surf = NULL; // Residual component due to external surface forces - Residual_Ext_Surf_n = NULL; // Residual component due to external surface forces at time n (for gen-alpha methods) +CFEABoundVariable::CFEABoundVariable(const su2double *val_fea, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) + : CFEAVariable(val_fea, npoint, ndim, nvar, config) { + VertexMap.Reset(nPoint); } -CFEABoundVariable::CFEABoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, - CConfig *config) : CFEAVariable(val_fea, val_nDim, val_nvar, config) { +void CFEABoundVariable::AllocateBoundaryVariables(CConfig *config) { - unsigned short iVar; - bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); + if (VertexMap.GetIsValid()) return; // nothing to do + + /*--- Count number of vertices and build map ---*/ + + unsigned long nBoundPt = VertexMap.Build(); + + /*--- Allocate ---*/ - Residual_Ext_Surf = NULL; - Residual_Ext_Surf_n = NULL; + bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); + 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; + Residual_Ext_Surf.resize(nBoundPt,nVar) = su2double(0.0); + + /*--- Flow traction ---*/ + if (fsi_analysis) FlowTraction.resize(nBoundPt,nVar) = su2double(0.0); /*--- Generalized alpha integration method requires storing the old residuals ---*/ if (gen_alpha) { - Residual_Ext_Surf_n = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf_n[iVar] = 0.0; - } + Residual_Ext_Surf_n.resize(nBoundPt,nVar) = su2double(0.0); + if (fsi_analysis) FlowTraction_n.resize(nBoundPt,nVar) = su2double(0.0); + } } -CFEABoundVariable::~CFEABoundVariable(void) { +void CFEABoundVariable::Set_FlowTraction_n() { FlowTraction_n = FlowTraction; } + +void CFEABoundVariable::Set_SurfaceLoad_Res_n() { Residual_Ext_Surf_n = Residual_Ext_Surf; } - if (Residual_Ext_Surf != NULL) delete [] Residual_Ext_Surf; - if (Residual_Ext_Surf_n != NULL) delete [] Residual_Ext_Surf_n; +void CFEABoundVariable::Clear_FlowTraction() { FlowTraction.setConstant(0.0); } +void CFEABoundVariable::RegisterFlowTraction() { + if (!fsi_analysis) return; + for (unsigned long iVertex = 0; iVertex < FlowTraction.rows(); iVertex++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(FlowTraction(iVertex,iVar)); } diff --git a/SU2_CFD/src/variables/CFEAFSIBoundVariable.cpp b/SU2_CFD/src/variables/CFEAFSIBoundVariable.cpp deleted file mode 100644 index 6f689807bbf4..000000000000 --- a/SU2_CFD/src/variables/CFEAFSIBoundVariable.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * \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/CFEAFSIBoundVariable.hpp" - -CFEAFSIBoundVariable::CFEAFSIBoundVariable(void) : CFEABoundVariable() { - - FlowTraction = NULL; // Nodal traction due to the fluid (fsi) - FlowTraction_n = NULL; // Nodal traction due to the fluid (fsi) at time n (for gen-alpha methods) - -} - -CFEAFSIBoundVariable::CFEAFSIBoundVariable(su2double *val_fea, unsigned short val_nDim, unsigned short val_nvar, - CConfig *config) : CFEABoundVariable(val_fea, val_nDim, val_nvar, config) { - - unsigned short iVar; - bool gen_alpha = (config->GetKind_TimeIntScheme_FEA() == GENERALIZED_ALPHA); - - /*--- Flow traction ---*/ - FlowTraction = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - FlowTraction[iVar] = 0.0; - } - - /*--- Generalized alpha integration method requires storing the old residuals ---*/ - FlowTraction_n = NULL; - if (gen_alpha) { - FlowTraction_n = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - FlowTraction_n[iVar] = 0.0; - } - } - -} - -CFEAFSIBoundVariable::~CFEAFSIBoundVariable(void) { - - if (FlowTraction != NULL) delete [] FlowTraction; - if (FlowTraction_n != NULL) delete [] FlowTraction_n; - -} diff --git a/SU2_CFD/src/variables/CFEAVariable.cpp b/SU2_CFD/src/variables/CFEAVariable.cpp index a953cc5c5917..51615062942f 100644 --- a/SU2_CFD/src/variables/CFEAVariable.cpp +++ b/SU2_CFD/src/variables/CFEAVariable.cpp @@ -37,133 +37,111 @@ #include "../../include/variables/CFEAVariable.hpp" -CFEAVariable::CFEAVariable(void) : CVariable() { - VonMises_Stress = 0.0; +CFEAVariable::CFEAVariable(const su2double *val_fea, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) + : CVariable(npoint, ndim, nvar, config) { - Stress = NULL; // Nodal stress (for output purposes) - Residual_Ext_Body = NULL; // Residual component due to body forces + bool nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); + bool body_forces = config->GetDeadLoad(); + bool incremental_load = config->GetIncrementalLoad(); + 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->GetTime_Domain(); + bool fsi_analysis = config->GetFSI_Simulation(); - Solution_Vel = NULL; // Velocity at the node at time t+dt - Solution_Vel_time_n = NULL; // Velocity at the node at time t + VonMises_Stress.resize(nPoint) = su2double(0.0); - 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 -} - -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). - bool incremental_load = config->GetIncrementalLoad(); - 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->GetTime_Domain()); - bool fsi_analysis = (config->GetnMarker_Fluid_Load() > 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 - - if (nDim == 2) Stress = new su2double [3]; - else if (nDim == 3) Stress = new su2double [6]; + if (nDim==2) Stress.resize(nPoint,3); + else Stress.resize(nPoint,6); /*--- Initialization of variables ---*/ - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = val_fea[iVar]; - } + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution(iPoint,iVar) = val_fea[iVar]; 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]; - for (iVar = 0; iVar < nVar; iVar++) { - 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_time_n[iVar] = val_fea[iVar+2*nVar]; + Solution_Vel.resize(nPoint,nVar); + Solution_Accel.resize(nPoint,nVar); + + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { + for (unsigned long iVar = 0; iVar < nVar; iVar++) { + Solution_Vel(iPoint,iVar) = val_fea[iVar+nVar]; + Solution_Accel(iPoint,iVar) = val_fea[iVar+2*nVar]; + } } + Solution_Vel_time_n = Solution_Vel; + Solution_Accel_time_n = Solution_Accel; } + if (fsi_analysis) { - Solution_Pred = new su2double [nVar]; - Solution_Pred_Old = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) { - Solution_Pred[iVar] = val_fea[iVar]; - Solution_Pred_Old[iVar] = val_fea[iVar]; - } + Solution_Pred = Solution; + Solution_Pred_Old = Solution; } - /*--- 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]; - } - } + /*--- If we are going to use incremental analysis, we need a way to store the old solution ---*/ + + if (incremental_load && nonlinear_analysis) Solution_Old.resize(nPoint,nVar) = su2double(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 = Solution; /*--- Body residual ---*/ - 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.resize(nPoint,nVar) = su2double(0.0); - if (refgeom) Reference_Geometry = new su2double [nVar]; + if (refgeom) Reference_Geometry.resize(nPoint,nVar); - if (prestretch_fem) Prestretch = new su2double [nVar]; + if (prestretch_fem) Prestretch.resize(nPoint,nVar); if (config->GetMultizone_Problem()) Set_BGSSolution_k(); } -CFEAVariable::~CFEAVariable(void) { - - if (Stress != NULL) delete [] Stress; - if (Residual_Ext_Body != NULL) delete [] Residual_Ext_Body; +void CFEAVariable::SetSolution_Vel_time_n() { Solution_Vel_time_n = Solution_Vel; } - if (Solution_Vel != NULL) delete [] Solution_Vel; - if (Solution_Vel_time_n != NULL) delete [] Solution_Vel_time_n; +void CFEAVariable::SetSolution_Accel_time_n() { Solution_Accel_time_n = Solution_Accel; } - if (Solution_Accel != NULL) delete [] Solution_Accel; - if (Solution_Accel_time_n != NULL) delete [] Solution_Accel_time_n; +void CFEAVariable::Register_femSolution_time_n() { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_time_n(iPoint,iVar)); +} - if (Solution_Pred != NULL) delete [] Solution_Pred; - if (Solution_Pred_Old != NULL) delete [] Solution_Pred_Old; +void CFEAVariable::RegisterSolution_Vel(bool input) { + if (input) { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Vel(iPoint,iVar)); + } + else { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterOutput(Solution_Vel(iPoint,iVar)); + } +} - if (Reference_Geometry != NULL) delete [] Reference_Geometry; - if (Prestretch != NULL) delete [] Prestretch; +void CFEAVariable::RegisterSolution_Vel_time_n() { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Vel_time_n(iPoint,iVar)); +} +void CFEAVariable::RegisterSolution_Accel(bool input) { + if (input) { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Accel(iPoint,iVar)); + } + else { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterOutput(Solution_Accel(iPoint,iVar)); + } } +void CFEAVariable::RegisterSolution_Accel_time_n() { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Solution_Accel_time_n(iPoint,iVar)); +} diff --git a/SU2_CFD/src/variables/CHeatFVMVariable.cpp b/SU2_CFD/src/variables/CHeatFVMVariable.cpp index d140958f7b84..067e46c22097 100644 --- a/SU2_CFD/src/variables/CHeatFVMVariable.cpp +++ b/SU2_CFD/src/variables/CHeatFVMVariable.cpp @@ -37,61 +37,53 @@ #include "../../include/variables/CHeatFVMVariable.hpp" -CHeatFVMVariable::CHeatFVMVariable(void) : CVariable() { - /*--- Array initialization ---*/ - Solution_Direct = NULL; - Solution_BGS_k = NULL; +CHeatFVMVariable::CHeatFVMVariable(su2double heat, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) + : CVariable(npoint, ndim, 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; bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || (config->GetTime_Marching() == DT_STEPPING_2ND)); - /*--- Array initialization ---*/ - Solution_Direct = NULL; - /*--- Initialization of heat variable ---*/ - Solution[0] = val_Heat; Solution_Old[0] = val_Heat; - /*--- Allocate residual structures ---*/ + Solution = heat; + Solution_Old = heat; - Res_TruncError = new su2double [nVar]; + /*--- Allocate residual structures ---*/ - for (iVar = 0; iVar < nVar; iVar++) { - Res_TruncError[iVar] = 0.0; - } + Res_TruncError.resize(nPoint,nVar) = su2double(0.0); /*--- Only for residual smoothing (multigrid) ---*/ - for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) - nMGSmooth += config->GetMG_CorrecSmooth(iMesh); - - if ((nMGSmooth > 0) || low_fidelity) { - Residual_Sum = new su2double [nVar]; - Residual_Old = new su2double [nVar]; + for (unsigned long iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + if ((config->GetMG_CorrecSmooth(iMesh) > 0) || low_fidelity) { + Residual_Sum.resize(nPoint,nVar); + Residual_Old.resize(nPoint,nVar); + break; + } } /*--- Allocate and initialize solution for dual time strategy ---*/ if (dual_time) { - Solution_time_n[0] = val_Heat; - Solution_time_n1[0] = val_Heat; + Solution_time_n = heat; + Solution_time_n1 = heat; } - if (config->GetKind_ConvNumScheme_Heat() == SPACE_CENTERED) { - Undivided_Laplacian = new su2double [nVar]; + /*--- Gradient related fields ---*/ + Gradient.resize(nPoint,nVar,nDim,0.0); + + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); } - + + if (config->GetKind_ConvNumScheme_Heat() == SPACE_CENTERED) + Undivided_Laplacian.resize(nPoint,nVar); + + Max_Lambda_Inv.resize(nPoint); + Max_Lambda_Visc.resize(nPoint); + Delta_Time.resize(nPoint); + if (config->GetMultizone_Problem()) Set_BGSSolution_k(); - -} - -CHeatFVMVariable::~CHeatFVMVariable(void) { - if (Solution_Direct != NULL) delete [] Solution_Direct; } diff --git a/SU2_CFD/src/variables/CIncEulerVariable.cpp b/SU2_CFD/src/variables/CIncEulerVariable.cpp index 8b2b1adab61a..1ef1113d6576 100644 --- a/SU2_CFD/src/variables/CIncEulerVariable.cpp +++ b/SU2_CFD/src/variables/CIncEulerVariable.cpp @@ -37,303 +37,116 @@ #include "../../include/variables/CIncEulerVariable.hpp" -CIncEulerVariable::CIncEulerVariable(void) : CVariable() { - /*--- Array initialization ---*/ +CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *velocity, su2double temperature, unsigned long npoint, + unsigned long ndim, unsigned long nvar, CConfig *config) : CVariable(npoint, ndim, nvar, config) { - Primitive = NULL; - Gradient_Primitive = NULL; - Limiter_Primitive = NULL; - - Grad_AuxVar = NULL; - - nPrimVar = 0; - nPrimVarGrad = 0; - - nSecondaryVar = 0; - nSecondaryVarGrad = 0; -} - -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->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); + bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); bool viscous = config->GetViscous(); bool axisymmetric = config->GetAxisymmetric(); - /*--- Array initialization ---*/ - - Primitive = NULL; - Gradient_Primitive = NULL; - Limiter_Primitive = NULL; - - Grad_AuxVar = NULL; - - nPrimVar = 0; - nPrimVarGrad = 0; - - nSecondaryVar = 0; - nSecondaryVarGrad = 0; - /*--- 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; - } + Res_TruncError.resize(nPoint,nVar) = su2double(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 = 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; - Solution_Old[0] = val_pressure; - for (iDim = 0; iDim < nDim; iDim++) { - Solution[iDim+1] = val_velocity[iDim]; - Solution_Old[iDim+1] = val_velocity[iDim]; - } - Solution[nDim+1] = val_temperature; - 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; - for (iDim = 0; iDim < nDim; iDim++) { - Solution_time_n[iDim+1] = val_velocity[iDim]; - Solution_time_n1[iDim+1] = val_velocity[iDim]; + for (unsigned long iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + if (config->GetMG_CorrecSmooth(iMesh) > 0) { + Residual_Sum.resize(nPoint,nVar); + Residual_Old.resize(nPoint,nVar); + break; } - Solution[nDim+1] = val_temperature; - Solution_Old[nDim+1] = val_temperature; - } - - /*--- 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]; - for (iDim = 0; iDim < nDim; iDim++) - Gradient_Primitive[iVar][iDim] = 0.0; - } - - /*--- If axisymmetric and viscous, we need an auxiliary gradient. ---*/ - - if (axisymmetric && viscous) - Grad_AuxVar = new su2double[nDim]; - -} - -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->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - bool viscous = config->GetViscous(); - bool axisymmetric = config->GetAxisymmetric(); - - /*--- Array initialization ---*/ - - Primitive = NULL; - Gradient_Primitive = NULL; - Limiter_Primitive = NULL; - - Grad_AuxVar = NULL; - - nPrimVar = 0; - nPrimVarGrad = 0; - - nSecondaryVar = 0; - nSecondaryVarGrad = 0; - - /*--- 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]; + Undivided_Laplacian.resize(nPoint,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_Primitive.resize(nPoint,nPrimVarGrad) = su2double(0.0); - Limiter = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) - Limiter[iVar] = 0.0; + Limiter.resize(nPoint,nVar) = su2double(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_Max.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Min.resize(nPoint,nPrimVarGrad) = su2double(0.0); /*--- Solution initialization ---*/ - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] = val_solution[iVar]; - Solution_Old[iVar] = val_solution[iVar]; - } + su2double val_solution[5] = {pressure, velocity[0], velocity[1], temperature, temperature}; + if(nDim==3) val_solution[3] = velocity[2]; + + for(unsigned long iPoint=0; iPointGetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); } /*--- If axisymmetric and viscous, we need an auxiliary gradient. ---*/ - if (axisymmetric && viscous) - Grad_AuxVar = new su2double[nDim]; - + if (axisymmetric && viscous) Grad_AuxVar.resize(nPoint,nDim); + if (config->GetMultizone_Problem()) Set_BGSSolution_k(); - -} - -CIncEulerVariable::~CIncEulerVariable(void) { - unsigned short iVar; - - if (Primitive != NULL) delete [] Primitive; - if (Limiter_Primitive != NULL) delete [] Limiter_Primitive; - - if (Gradient_Primitive != NULL) { - for (iVar = 0; iVar < nPrimVarGrad; iVar++) - if (Gradient_Primitive!=NULL) delete [] Gradient_Primitive[iVar]; - delete [] Gradient_Primitive; - } -} - -void CIncEulerVariable::SetGradient_PrimitiveZero(unsigned short val_primvar) { - unsigned short iVar, iDim; + Density_Old.resize(nPoint) = su2double(0.0); + Velocity2.resize(nPoint) = su2double(0.0); + Max_Lambda_Inv.resize(nPoint) = su2double(0.0); + Delta_Time.resize(nPoint) = su2double(0.0); + Lambda.resize(nPoint) = su2double(0.0); + Sensor.resize(nPoint) = su2double(0.0); - for (iVar = 0; iVar < val_primvar; iVar++) - for (iDim = 0; iDim < nDim; iDim++) - Gradient_Primitive[iVar][iDim] = 0.0; } - -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; +void CIncEulerVariable::SetGradient_PrimitiveZero() { + Gradient_Primitive.storage.setConstant(0.0); } -bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { +bool CIncEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) { - unsigned short iVar; + unsigned long iVar; bool check_dens = false, check_temp = false, physical = true; /*--- Store the density from the previous iteration. ---*/ - Density_Old = GetDensity(); + Density_Old(iPoint) = GetDensity(iPoint); /*--- Set the value of the pressure ---*/ - SetPressure(); + SetPressure(iPoint); /*--- Set the value of the temperature directly ---*/ - su2double Temperature = Solution[nDim+1]; - check_temp = SetTemperature(Temperature); + su2double Temperature = Solution(iPoint,nDim+1); + check_temp = SetTemperature(iPoint,Temperature); /*--- Use the fluid model to compute the new value of density. Note that the thermodynamic pressure is constant and decoupled @@ -345,7 +158,7 @@ bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { /*--- Set the value of the density ---*/ - check_dens = SetDensity(FluidModel->GetDensity()); + check_dens = SetDensity(iPoint, FluidModel->GetDensity()); /*--- Non-physical solution found. Revert to old values. ---*/ @@ -354,14 +167,14 @@ bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { /*--- Copy the old solution ---*/ for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; + Solution(iPoint, iVar) = Solution_Old(iPoint, iVar); /*--- Recompute the primitive variables ---*/ - Temperature = Solution[nDim+1]; - SetTemperature(Temperature); + Temperature = Solution(iPoint, nDim+1); + SetTemperature(iPoint, Temperature); FluidModel->SetTDState_T(Temperature); - SetDensity(FluidModel->GetDensity()); + SetDensity(iPoint, FluidModel->GetDensity()); /*--- Flag this point as non-physical. ---*/ @@ -371,12 +184,12 @@ bool CIncEulerVariable::SetPrimVar(CFluidModel *FluidModel) { /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ - SetVelocity(); + SetVelocity(iPoint); /*--- Set specific heats (only necessary for consistency with preconditioning). ---*/ - SetSpecificHeatCp(FluidModel->GetCp()); - SetSpecificHeatCv(FluidModel->GetCv()); + SetSpecificHeatCp(iPoint, FluidModel->GetCp()); + SetSpecificHeatCv(iPoint, FluidModel->GetCv()); return physical; diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index 9f7be562914b..501a67559f92 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -38,96 +38,85 @@ #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 pressure, const su2double *velocity, su2double temperature, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) : + CIncEulerVariable(pressure, velocity, temperature, npoint, ndim, nvar, config) { + Vorticity.resize(nPoint,3); + StrainMag.resize(nPoint); + DES_LengthScale.resize(nPoint) = su2double(0.0); + Max_Lambda_Visc.resize(nPoint); } -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; -} +bool CIncNSVariable::SetVorticity_StrainMag() { -CIncNSVariable::~CIncNSVariable(void) { } + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { -bool CIncNSVariable::SetVorticity(void) { + /*--- Vorticity ---*/ - Vorticity[0] = 0.0; Vorticity[1] = 0.0; + Vorticity(iPoint,0) = 0.0; Vorticity(iPoint,1) = 0.0; - Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; + Vorticity(iPoint,2) = Gradient_Primitive(iPoint,2,0)-Gradient_Primitive(iPoint,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]); - } + if (nDim == 3) { + Vorticity(iPoint,0) = Gradient_Primitive(iPoint,3,1)-Gradient_Primitive(iPoint,2,2); + Vorticity(iPoint,1) = -(Gradient_Primitive(iPoint,3,0)-Gradient_Primitive(iPoint,1,2)); + } - return false; + /*--- Strain Magnitude ---*/ -} + AD::StartPreacc(); + AD::SetPreaccIn(Gradient_Primitive[iPoint], nDim+1, nDim); -bool CIncNSVariable::SetStrainMag(void) { + su2double Div = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Div += Gradient_Primitive(iPoint,iDim+1,iDim); - su2double Div; - unsigned short iDim; + StrainMag(iPoint) = 0.0; - AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); + /*--- Add diagonal part ---*/ - Div = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Div += Gradient_Primitive[iDim+1][iDim]; - } + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + StrainMag(iPoint) += pow(Gradient_Primitive(iPoint,iDim+1,iDim) - 1.0/3.0*Div, 2.0); + } + if (nDim == 2) { + StrainMag(iPoint) += pow(1.0/3.0*Div, 2.0); + } - StrainMag = 0.0; + /*--- Add off diagonals ---*/ - /*--- Add diagonal part ---*/ + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,1,1) + Gradient_Primitive(iPoint,2,0)), 2); - for (iDim = 0; iDim < nDim; iDim++) { - StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); - } - if (nDim == 2) { - StrainMag += pow(1.0/3.0*Div, 2.0); - } - - /*--- Add off diagonals ---*/ + if (nDim == 3) { + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,1,2) + Gradient_Primitive(iPoint,3,0)), 2); + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,2,2) + Gradient_Primitive(iPoint,3,1)), 2); + } - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); + StrainMag(iPoint) = sqrt(2.0*StrainMag(iPoint)); - 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); + AD::SetPreaccOut(StrainMag(iPoint)); + AD::EndPreacc(); } - - StrainMag = sqrt(2.0*StrainMag); - - AD::SetPreaccOut(StrainMag); - AD::EndPreacc(); - return false; - } -bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) { +bool CIncNSVariable::SetPrimVar(unsigned long iPoint, 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(); + Density_Old(iPoint) = GetDensity(iPoint); /*--- Set the value of the pressure ---*/ - SetPressure(); + SetPressure(iPoint); /*--- Set the value of the temperature directly ---*/ - su2double Temperature = Solution[nDim+1]; - check_temp = SetTemperature(Temperature); + su2double Temperature = Solution(iPoint,nDim+1); + check_temp = SetTemperature(iPoint,Temperature); /*--- Use the fluid model to compute the new value of density. Note that the thermodynamic pressure is constant and decoupled @@ -139,7 +128,7 @@ bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidMo /*--- Set the value of the density ---*/ - check_dens = SetDensity(FluidModel->GetDensity()); + check_dens = SetDensity(iPoint, FluidModel->GetDensity()); /*--- Non-physical solution found. Revert to old values. ---*/ @@ -148,14 +137,14 @@ bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidMo /*--- Copy the old solution ---*/ for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; + Solution(iPoint,iVar) = Solution_Old(iPoint,iVar); /*--- Recompute the primitive variables ---*/ - Temperature = Solution[nDim+1]; - SetTemperature(Temperature); + Temperature = Solution(iPoint,nDim+1); + SetTemperature(iPoint, Temperature); FluidModel->SetTDState_T(Temperature); - SetDensity(FluidModel->GetDensity()); + SetDensity(iPoint, FluidModel->GetDensity()); /*--- Flag this point as non-physical. ---*/ @@ -165,25 +154,25 @@ bool CIncNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidMo /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ - SetVelocity(); + SetVelocity(iPoint); /*--- Set laminar viscosity ---*/ - SetLaminarViscosity(FluidModel->GetLaminarViscosity()); + SetLaminarViscosity(iPoint, FluidModel->GetLaminarViscosity()); /*--- Set eddy viscosity locally and in the fluid model. ---*/ - SetEddyViscosity(eddy_visc); + SetEddyViscosity(iPoint, eddy_visc); FluidModel->SetEddyViscosity(eddy_visc); /*--- Set thermal conductivity (effective value if RANS). ---*/ - SetThermalConductivity(FluidModel->GetThermalConductivity()); + SetThermalConductivity(iPoint, FluidModel->GetThermalConductivity()); /*--- Set specific heats ---*/ - SetSpecificHeatCp(FluidModel->GetCp()); - SetSpecificHeatCv(FluidModel->GetCv()); + SetSpecificHeatCp(iPoint, FluidModel->GetCp()); + SetSpecificHeatCv(iPoint, FluidModel->GetCv()); return physical; diff --git a/SU2_CFD/src/variables/CMeshBoundVariable.cpp b/SU2_CFD/src/variables/CMeshBoundVariable.cpp index f3d4adc2eaba..d31f0475a60c 100644 --- a/SU2_CFD/src/variables/CMeshBoundVariable.cpp +++ b/SU2_CFD/src/variables/CMeshBoundVariable.cpp @@ -37,20 +37,34 @@ #include "../../include/variables/CMeshBoundVariable.hpp" -CMeshBoundVariable::CMeshBoundVariable(su2double *val_coor, unsigned short val_nDim, CConfig *config) : CMeshVariable(val_coor, val_nDim, config) { +CMeshBoundVariable::CMeshBoundVariable(unsigned long npoint, unsigned long ndim, CConfig *config) : + CMeshVariable(npoint, ndim, config) { - unsigned short iDim; + VertexMap.Reset(nPoint); +} - /*--- Initialize Boundary Displacement container to 0.0 ---*/ - Boundary_Displacement = new su2double [nDim]; - for (iDim = 0; iDim < nDim; iDim++){ - Boundary_Displacement[iDim] = 0.0; - } +void CMeshBoundVariable::AllocateBoundaryVariables(CConfig *config) { -} + if (VertexMap.GetIsValid()) return; // nothing to do + + /*--- Count number of vertices and build map ---*/ -CMeshBoundVariable::~CMeshBoundVariable(void) { + unsigned long nBoundPt = VertexMap.Build(); - if (Boundary_Displacement != NULL) delete [] Boundary_Displacement; + /*--- Allocate ---*/ + Boundary_Displacement.resize(nBoundPt,nDim) = su2double(0.0); +} + +void CMeshBoundVariable::Register_BoundDisp(bool input) { + if (input) { + for (unsigned long iVertex = 0; iVertex < Boundary_Displacement.rows(); iVertex++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterInput(Boundary_Displacement(iVertex,iVar)); + } + else { + for (unsigned long iVertex = 0; iVertex < Boundary_Displacement.rows(); iVertex++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) + AD::RegisterOutput(Boundary_Displacement(iVertex,iVar)); + } } diff --git a/SU2_CFD/src/variables/CMeshElement.cpp b/SU2_CFD/src/variables/CMeshElement.cpp index 2004473ab684..2e9654d65475 100644 --- a/SU2_CFD/src/variables/CMeshElement.cpp +++ b/SU2_CFD/src/variables/CMeshElement.cpp @@ -45,7 +45,3 @@ CMeshElement::CMeshElement(void){ WallDistance = 0.0; /*!< \brief Store the reference distance to the nearest wall of the element. */ } - -CMeshElement::~CMeshElement(void){ - -} diff --git a/SU2_CFD/src/variables/CMeshVariable.cpp b/SU2_CFD/src/variables/CMeshVariable.cpp index f5581ea2a0e4..e6c13d9c09d8 100644 --- a/SU2_CFD/src/variables/CMeshVariable.cpp +++ b/SU2_CFD/src/variables/CMeshVariable.cpp @@ -37,54 +37,35 @@ #include "../../include/variables/CMeshVariable.hpp" -CMeshVariable::CMeshVariable(const su2double *val_coor, unsigned short val_nDim, CConfig *config) : CVariable(val_nDim, config) { - - unsigned short iDim; - - /*--- Initialize pointers to NULL ---*/ - Mesh_Coord = nullptr; - - Solution_Old = nullptr; - - Solution_time_n = nullptr; - Solution_time_n1 = nullptr; +CMeshVariable::CMeshVariable(unsigned long npoint, unsigned long ndim, CConfig *config) : + CVariable(npoint, ndim, config) { /*--- Booleans that determine the kind of problems ---*/ bool time_domain = config->GetTime_Domain(); - bool multizone = config->GetMultizone_Problem(); /*--- Store the dimensionality of the problem ---*/ - nDim = val_nDim; + nDim = ndim; /*--- Initalize the variables that will always be there in a problem with moving mesh ---*/ - Mesh_Coord = new su2double [nDim]; - for (iDim = 0; iDim < nDim; iDim++){ - Mesh_Coord[iDim] = val_coor[iDim]; - } - - /*--- Initialize the variables necessary when the problem is multizone ---*/ - if (multizone){ - Solution_Old = new su2double [nDim]; - for (iDim = 0; iDim < nDim; iDim++){ - Solution_Old[iDim] = 0.0; - } - } + Mesh_Coord.resize(nPoint,nDim) = su2double(0.0); + WallDistance.resize(nPoint) = su2double(1e-9); /*--- Initialize the variables necessary when the problem is time domain ---*/ - if (time_domain){ - Solution_time_n = new su2double [nDim]; - Solution_time_n1 = new su2double [nDim]; - - for (iDim = 0; iDim < nDim; iDim++){ - Solution_time_n[iDim] = 0.0; - Solution_time_n1[iDim] = 0.0; - } + if (time_domain) { + Solution_time_n.resize(nPoint,nDim) = su2double(0.0); + Solution_time_n1.resize(nPoint,nDim) = su2double(0.0); } - } -CMeshVariable::~CMeshVariable(void) { - - if (Mesh_Coord != nullptr) delete [] Mesh_Coord; - +void CMeshVariable::Register_MeshCoord(bool input) { + if (input) { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iDim = 0; iDim < nDim; iDim++) + AD::RegisterInput(Mesh_Coord(iPoint,iDim)); + } + else { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned long iDim = 0; iDim < nDim; iDim++) + AD::RegisterOutput(Mesh_Coord(iPoint,iDim)); + } } diff --git a/SU2_CFD/src/variables/CNSVariable.cpp b/SU2_CFD/src/variables/CNSVariable.cpp index ebb28eb3b39c..635eff013ae0 100644 --- a/SU2_CFD/src/variables/CNSVariable.cpp +++ b/SU2_CFD/src/variables/CNSVariable.cpp @@ -38,102 +38,75 @@ #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(su2double density, const su2double *velocity, su2double energy, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) : + CEulerVariable(density,velocity,energy,npoint,ndim,nvar,config) { + + inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); + + Vorticity.resize(nPoint,3) = su2double(0.0); + StrainMag.resize(nPoint) = su2double(0.0); + Tau_Wall.resize(nPoint) = su2double(-1.0); + DES_LengthScale.resize(nPoint) = su2double(0.0); + Roe_Dissipation.resize(nPoint) = su2double(0.0); + Vortex_Tilting.resize(nPoint) = su2double(0.0); + Max_Lambda_Visc.resize(nPoint) = su2double(0.0); } -CNSVariable::~CNSVariable(void) { } +bool CNSVariable::SetVorticity_StrainMag() { -bool CNSVariable::SetVorticity(void) { + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { - Vorticity[0] = 0.0; Vorticity[1] = 0.0; + /*--- Vorticity ---*/ - Vorticity[2] = Gradient_Primitive[2][0]-Gradient_Primitive[1][1]; + Vorticity(iPoint,0) = 0.0; Vorticity(iPoint,1) = 0.0; - if (nDim == 3) { - Vorticity[0] = Gradient_Primitive[3][1]-Gradient_Primitive[2][2]; - Vorticity[1] = -(Gradient_Primitive[3][0]-Gradient_Primitive[1][2]); - } + Vorticity(iPoint,2) = Gradient_Primitive(iPoint,2,0)-Gradient_Primitive(iPoint,1,1); - return false; + if (nDim == 3) { + Vorticity(iPoint,0) = Gradient_Primitive(iPoint,3,1)-Gradient_Primitive(iPoint,2,2); + Vorticity(iPoint,1) = -(Gradient_Primitive(iPoint,3,0)-Gradient_Primitive(iPoint,1,2)); + } -} + /*--- Strain Magnitude ---*/ -bool CNSVariable::SetStrainMag(void) { + AD::StartPreacc(); + AD::SetPreaccIn(Gradient_Primitive[iPoint], nDim+1, nDim); - su2double Div; - unsigned short iDim; + su2double Div = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Div += Gradient_Primitive(iPoint,iDim+1,iDim); - AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive, nDim+1, nDim); + StrainMag(iPoint) = 0.0; - Div = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Div += Gradient_Primitive[iDim+1][iDim]; - } + /*--- Add diagonal part ---*/ - StrainMag = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + StrainMag(iPoint) += pow(Gradient_Primitive(iPoint,iDim+1,iDim) - 1.0/3.0*Div, 2.0); + } + if (nDim == 2) { + StrainMag(iPoint) += pow(1.0/3.0*Div, 2.0); + } - /*--- Add diagonal part ---*/ + /*--- Add off diagonals ---*/ - for (iDim = 0; iDim < nDim; iDim++) { - StrainMag += pow(Gradient_Primitive[iDim+1][iDim] - 1.0/3.0*Div, 2.0); - } - if (nDim == 2) { - StrainMag += pow(1.0/3.0*Div, 2.0); - } + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,1,1) + Gradient_Primitive(iPoint,2,0)), 2); - /*--- Add off diagonals ---*/ + if (nDim == 3) { + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,1,2) + Gradient_Primitive(iPoint,3,0)), 2); + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,2,2) + Gradient_Primitive(iPoint,3,1)), 2); + } - StrainMag += 2.0*pow(0.5*(Gradient_Primitive[1][1] + Gradient_Primitive[2][0]), 2.0); + StrainMag(iPoint) = sqrt(2.0*StrainMag(iPoint)); - 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); + AD::SetPreaccOut(StrainMag(iPoint)); + AD::EndPreacc(); } - - StrainMag = sqrt(2.0*StrainMag); - - AD::SetPreaccOut(StrainMag); - AD::EndPreacc(); - return false; - } -void CNSVariable::SetRoe_Dissipation_NTS(su2double val_delta, +void CNSVariable::SetRoe_Dissipation_NTS(unsigned long iPoint, + su2double val_delta, su2double val_const_DES){ static const su2double cnu = pow(0.09, 1.5), @@ -142,20 +115,20 @@ void CNSVariable::SetRoe_Dissipation_NTS(su2double val_delta, ch3 = 2.0, sigma_max = 1.0; - unsigned short iDim; - su2double Omega, Omega_2 = 0, Baux, Gaux, Lturb, Kaux, Aaux; + unsigned long iDim; + su2double Omega, Omega_2 = 0.0, Baux, Gaux, Lturb, Kaux, Aaux; AD::StartPreacc(); - AD::SetPreaccIn(Vorticity, 3); - AD::SetPreaccIn(StrainMag); + AD::SetPreaccIn(Vorticity[iPoint], 3); + AD::SetPreaccIn(StrainMag(iPoint)); AD::SetPreaccIn(val_delta); AD::SetPreaccIn(val_const_DES); /*--- Density ---*/ - AD::SetPreaccIn(Solution[0]); + AD::SetPreaccIn(Solution(iPoint,0)); /*--- Laminar viscosity --- */ - AD::SetPreaccIn(Primitive[nDim+5]); + AD::SetPreaccIn(Primitive(iPoint,nDim+5)); /*--- Eddy viscosity ---*/ - AD::SetPreaccIn(Primitive[nDim+6]); + AD::SetPreaccIn(Primitive(iPoint,nDim+6)); /*--- Central/upwind blending based on: * Zhixiang Xiao, Jian Liu, Jingbo Huang, and Song Fu. "Numerical @@ -165,86 +138,77 @@ void CNSVariable::SetRoe_Dissipation_NTS(su2double val_delta, * ---*/ for (iDim = 0; iDim < 3; iDim++){ - Omega_2 += Vorticity[iDim]*Vorticity[iDim]; + Omega_2 += pow(Vorticity(iPoint,iDim),2); } Omega = sqrt(Omega_2); - Baux = (ch3 * Omega * max(StrainMag, Omega)) / - max((pow(StrainMag,2)+Omega_2)*0.5, 1E-20); + Baux = (ch3 * Omega * max(StrainMag(iPoint), Omega)) / + max((pow(StrainMag(iPoint),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); + Kaux = max(sqrt((Omega_2 + pow(StrainMag(iPoint), 2))*0.5), 0.1 * inv_TimeScale); - const su2double nu = GetLaminarViscosity()/GetDensity(); - const su2double nu_t = GetEddyViscosity()/GetDensity(); + const su2double nu = GetLaminarViscosity(iPoint)/GetDensity(iPoint); + const su2double nu_t = GetEddyViscosity(iPoint)/GetDensity(iPoint); 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(iPoint) = sigma_max * tanh(pow(Aaux, ch1)); - AD::SetPreaccOut(Roe_Dissipation); + AD::SetPreaccOut(Roe_Dissipation(iPoint)); AD::EndPreacc(); } -void CNSVariable::SetRoe_Dissipation_FD(su2double val_wall_dist){ +void CNSVariable::SetRoe_Dissipation_FD(unsigned long iPoint, su2double val_wall_dist){ /*--- Constants for Roe Dissipation ---*/ - static const su2double k2 = pow(0.41,2.0); - - su2double uijuij = 0; - unsigned short iDim, jDim; + const passivedouble k2 = pow(0.41,2.0); AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive, nVar, nDim); + AD::SetPreaccIn(Gradient_Primitive[iPoint], nVar, nDim); AD::SetPreaccIn(val_wall_dist); /*--- Eddy viscosity ---*/ - AD::SetPreaccIn(Primitive[nDim+5]); + AD::SetPreaccIn(Primitive(iPoint,nDim+5)); /*--- Laminar viscosity --- */ - AD::SetPreaccIn(Primitive[nDim+6]); + AD::SetPreaccIn(Primitive(iPoint,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()); + bool check_dens = SetDensity(iPoint); + bool check_press = SetPressure(iPoint, FluidModel->GetPressure()); + bool check_sos = SetSoundSpeed(iPoint, FluidModel->GetSoundSpeed2()); + bool check_temp = SetTemperature(iPoint, FluidModel->GetTemperature()); /*--- Check that the solution has a physical meaning ---*/ @@ -252,23 +216,23 @@ bool CNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel /*--- Copy the old solution ---*/ - for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = Solution_Old[iVar]; + for (unsigned long iVar = 0; iVar < nVar; iVar++) + Solution(iPoint,iVar) = Solution_Old(iPoint,iVar); /*--- Recompute the primitive variables ---*/ - SetVelocity(); // Computes velocity and velocity^2 - density = GetDensity(); - staticEnergy = GetEnergy()-0.5*Velocity2 - turb_ke; + SetVelocity(iPoint); // Computes velocity and velocity^2 + density = GetDensity(iPoint); + staticEnergy = GetEnergy(iPoint)-0.5*Velocity2(iPoint) - 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()); + SetDensity(iPoint); + SetPressure(iPoint, FluidModel->GetPressure()); + SetSoundSpeed(iPoint, FluidModel->GetSoundSpeed2()); + SetTemperature(iPoint, FluidModel->GetTemperature()); RightVol = false; @@ -276,45 +240,44 @@ bool CNSVariable::SetPrimVar(su2double eddy_visc, su2double turb_ke, CFluidModel /*--- Set enthalpy ---*/ - SetEnthalpy(); // Requires pressure computation. + SetEnthalpy(iPoint); // Requires pressure computation. /*--- Set laminar viscosity ---*/ - SetLaminarViscosity(FluidModel->GetLaminarViscosity()); + SetLaminarViscosity(iPoint, FluidModel->GetLaminarViscosity()); /*--- Set eddy viscosity ---*/ - SetEddyViscosity(eddy_visc); + SetEddyViscosity(iPoint, eddy_visc); /*--- Set thermal conductivity ---*/ - SetThermalConductivity(FluidModel->GetThermalConductivity()); + SetThermalConductivity(iPoint, FluidModel->GetThermalConductivity()); /*--- Set specific heat ---*/ - SetSpecificHeatCp(FluidModel->GetCp()); + SetSpecificHeatCp(iPoint, FluidModel->GetCp()); return RightVol; - } -void CNSVariable::SetSecondaryVar(CFluidModel *FluidModel) { +void CNSVariable::SetSecondaryVar(unsigned long iPoint, CFluidModel *FluidModel) { /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/ - SetdPdrho_e( FluidModel->GetdPdrho_e() ); - SetdPde_rho( FluidModel->GetdPde_rho() ); + SetdPdrho_e( iPoint, FluidModel->GetdPdrho_e() ); + SetdPde_rho( iPoint, FluidModel->GetdPde_rho() ); - SetdTdrho_e( FluidModel->GetdTdrho_e() ); - SetdTde_rho( FluidModel->GetdTde_rho() ); + SetdTdrho_e( iPoint, FluidModel->GetdTdrho_e() ); + SetdTde_rho( iPoint, FluidModel->GetdTde_rho() ); /*--- Compute secondary thermo-physical properties (partial derivatives...) ---*/ - Setdmudrho_T( FluidModel->Getdmudrho_T() ); - SetdmudT_rho( FluidModel->GetdmudT_rho() ); + Setdmudrho_T( iPoint, FluidModel->Getdmudrho_T() ); + SetdmudT_rho( iPoint, FluidModel->GetdmudT_rho() ); - Setdktdrho_T( FluidModel->Getdktdrho_T() ); - SetdktdT_rho( FluidModel->GetdktdT_rho() ); + Setdktdrho_T( iPoint, FluidModel->Getdktdrho_T() ); + SetdktdT_rho( iPoint, FluidModel->GetdktdT_rho() ); } diff --git a/SU2_CFD/src/variables/CTransLMVariable.cpp b/SU2_CFD/src/variables/CTransLMVariable.cpp index e2ed54b47016..03a7d19ace45 100644 --- a/SU2_CFD/src/variables/CTransLMVariable.cpp +++ b/SU2_CFD/src/variables/CTransLMVariable.cpp @@ -37,17 +37,18 @@ #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) { - // Initialization of variables - Solution[0] = val_intermittency; Solution_Old[0] = val_intermittency; - Solution[1] = val_REth; Solution_Old[1] = val_REth; +CTransLMVariable::CTransLMVariable(su2double intermittency, su2double REth, unsigned long npoint, unsigned long ndim, + unsigned long nvar, CConfig *config) : CTurbVariable(npoint, ndim, nvar, config) { + + for(unsigned long iPoint=0; iPointGetMultizone_Problem()) Set_BGSSolution_k(); -} -CTransLMVariable::~CTransLMVariable(void) { } + gamma_sep.resize(nPoint); +} diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index cb8a897c1fc8..7b519f7a543b 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -38,31 +38,29 @@ #include "../../include/variables/CTurbSAVariable.hpp" -CTurbSAVariable::CTurbSAVariable(void) : CTurbVariable() { } +CTurbSAVariable::CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned long npoint, unsigned long ndim, unsigned long nvar, + CConfig *config) : CTurbVariable(npoint, ndim, 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) { + Solution_Old = Solution = val_nu_tilde; + muT.resize(nPoint) = val_muT; + + /*--- Allocate and initialize solution for the dual time strategy ---*/ bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || (config->GetTime_Marching() == 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; + Solution_time_n = Solution; + Solution_time_n1 = Solution; } - DES_LengthScale = 0.0; - + gamma_BC.resize(nPoint); + DES_LengthScale.resize(nPoint) = su2double(0.0); + Vortex_Tilting.resize(nPoint); } -void CTurbSAVariable::SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vorticity, su2double LaminarViscosity){ +void CTurbSAVariable::SetVortex_Tilting(unsigned long iPoint, 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,7 +69,7 @@ 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(iPoint)); /*--- Laminar viscosity --- */ AD::SetPreaccIn(LaminarViscosity); @@ -102,10 +100,8 @@ void CTurbSAVariable::SetVortex_Tilting(su2double **PrimGrad_Flow, su2double* Vo 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(iPoint) = (numerator/denominator) * max(1.0,0.2*LaminarViscosity/muT(iPoint)); - AD::SetPreaccOut(Vortex_Tilting); + AD::SetPreaccOut(Vortex_Tilting(iPoint)); AD::EndPreacc(); } - -CTurbSAVariable::~CTurbSAVariable(void) {} diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 3e8c11b9f4b5..a381c3546085 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -38,74 +38,59 @@ #include "../../include/variables/CTurbSSTVariable.hpp" -CTurbSSTVariable::CTurbSSTVariable(void) : CTurbVariable() { } +CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mut, unsigned long npoint, unsigned long ndim, unsigned long nvar, const su2double* constants, CConfig *config) + : CTurbVariable(npoint, ndim, nvar, config) { -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->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - - /*--- Initialization of variables ---*/ - - Solution[0] = val_kine; Solution_Old[0] = val_kine; - Solution[1] = val_omega; Solution_Old[1] = val_omega; + for(unsigned long iPoint=0; iPointGetTime_Marching() == HARMONIC_BALANCE) { - HB_Source = new su2double[nVar]; - for (iVar = 0; iVar < nVar; iVar++) - HB_Source[iVar] = 0.0; + HB_Source.resize(nPoint,nVar) = su2double(0.0); } - /*--- Always allocate the slope limiter, - and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ + /*--- Gradient related fields ---*/ - Limiter = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) - Limiter[iVar] = 0.0; + Gradient.resize(nPoint,nVar,nDim,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; + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); } -} + /*--- Always allocate the slope limiter, and the auxiliar + variables (check the logic - JST with 2nd order Turb model) ---*/ + + Limiter.resize(nPoint,nVar) = su2double(0.0); + Solution_Max.resize(nPoint,nVar) = su2double(0.0); + Solution_Min.resize(nPoint,nVar) = su2double(0.0); -CTurbVariable::~CTurbVariable(void) { - if (HB_Source != NULL) delete [] HB_Source; + Delta_Time.resize(nPoint); } diff --git a/SU2_CFD/src/variables/CVariable.cpp b/SU2_CFD/src/variables/CVariable.cpp index 224717cc76fe..7f129fe3fb52 100644 --- a/SU2_CFD/src/variables/CVariable.cpp +++ b/SU2_CFD/src/variables/CVariable.cpp @@ -37,185 +37,124 @@ #include "../../include/variables/CVariable.hpp" -unsigned short CVariable::nDim = 0; - -CVariable::CVariable(void) { - - /*--- Array initialization ---*/ - Solution = NULL; - Solution_Old = NULL; - Solution_time_n = NULL; - Solution_time_n1 = NULL; - Gradient = NULL; - Limiter = NULL; - Solution_Max = NULL; - Solution_Min = NULL; - Grad_AuxVar = NULL; - Undivided_Laplacian = NULL; - Res_TruncError = NULL; - Residual_Old = NULL; - Residual_Sum = NULL; - Solution_Adj_Old = NULL; - Solution_BGS_k = NULL; - Input_AdjIndices = NULL; - Output_AdjIndices = NULL; -} -CVariable::CVariable(unsigned short val_nvar, CConfig *config) { - - /*--- Array initialization ---*/ - Solution = NULL; - Solution_Old = NULL; - Solution_time_n = NULL; - Solution_time_n1 = NULL; - Gradient = NULL; - Rmatrix = NULL; - Limiter = NULL; - Solution_Max = NULL; - Solution_Min = NULL; - Grad_AuxVar = NULL; - Undivided_Laplacian = NULL; - Res_TruncError = NULL; - Residual_Old = NULL; - Residual_Sum = NULL; - Solution_Adj_Old = NULL; - Solution_BGS_k = NULL; - Input_AdjIndices = NULL; - Output_AdjIndices = NULL; +CVariable::CVariable(unsigned long npoint, unsigned long nvar, CConfig *config) { /*--- Initialize the number of solution variables. This version of the constructor will be used primarily for converting the restart files into solution files (SU2_SOL). ---*/ - nVar = val_nvar; + nPoint = npoint; + nVar = 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; + /*--- Allocate the solution array. ---*/ + Solution.resize(nPoint,nVar) = su2double(0.0); - if (config->GetMultizone_Problem()){ - Solution_BGS_k = new su2double[nVar](); - } + if (config->GetMultizone_Problem()) + Solution_BGS_k.resize(nPoint,nVar) = su2double(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; - Solution_time_n = NULL; - Solution_time_n1 = NULL; - Gradient = NULL; - Rmatrix = NULL; - Limiter = NULL; - Solution_Max = NULL; - Solution_Min = NULL; - Grad_AuxVar = NULL; - Undivided_Laplacian = NULL; - Res_TruncError = NULL; - Residual_Old = NULL; - Residual_Sum = NULL; - Solution_Adj_Old = NULL; - Solution_BGS_k = NULL; - Input_AdjIndices = NULL; - Output_AdjIndices = NULL; +CVariable::CVariable(unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) { /*--- 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 - in the simulation ---*/ - Solution = new su2double [nVar]; - - for (iVar = 0; iVar < nVar; iVar++) - Solution[iVar] = 0.0; + nPoint = npoint; + nDim = ndim; + nVar = nvar; - Solution_Old = new su2double [nVar]; + /*--- Allocate fields common to all problems. Do not allocate fields + that are specific to one solver, i.e. not common, in this class. ---*/ + Solution.resize(nPoint,nVar) = su2double(0.0); - 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; - } + Solution_Old.resize(nPoint,nVar) = su2double(0.0); if (config->GetTime_Marching() != NO) { - Solution_time_n = new su2double [nVar]; - Solution_time_n1 = new su2double [nVar]; + Solution_time_n.resize(nPoint,nVar); + Solution_time_n1.resize(nPoint,nVar); } else if (config->GetTime_Domain()) { - Solution_time_n = new su2double [nVar]; - for (iVar = 0; iVar < nVar; iVar++) Solution_time_n[iVar] = 0.0; + Solution_time_n.resize(nPoint,nVar) = su2double(0.0); } - if (config->GetFSI_Simulation() && config->GetDiscrete_Adjoint()){ - Solution_Adj_Old = new su2double [nVar]; + if (config->GetFSI_Simulation() && config->GetDiscrete_Adjoint()) { + Solution_Adj_Old.resize(nPoint,nVar); } - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { - Rmatrix = new su2double*[nDim]; - for (iDim = 0; iDim < nDim; iDim++) { - Rmatrix[iDim] = new su2double[nDim]; - for (jDim = 0; jDim < nDim; jDim++) - Rmatrix[iDim][jDim] = 0.0; - } - } - - if(config->GetMultizone_Problem() && config->GetAD_Mode()) { - Input_AdjIndices = new int[nVar]; - Output_AdjIndices = new int[nVar]; + Non_Physical.resize(nPoint) = false; - for (iVar = 0; iVar < nVar; iVar++) { - Input_AdjIndices[iVar] = -1; - Output_AdjIndices[iVar] = -1; - } + if(config->GetMultizone_Problem() && config->GetAD_Mode()) { + Input_AdjIndices.resize(nPoint,nVar) = -1; + Output_AdjIndices.resize(nPoint,nVar) = -1; } - if (config->GetMultizone_Problem()){ - Solution_BGS_k = new su2double[nVar](); - } - - Delta_Time = 0.0; - + if (config->GetMultizone_Problem()) + Solution_BGS_k.resize(nPoint,nVar) = su2double(0.0); } -CVariable::~CVariable(void) { - unsigned short iVar, iDim; - - if (Solution != NULL) delete [] Solution; - if (Solution_Old != NULL) delete [] Solution_Old; - if (Solution_time_n != NULL) delete [] Solution_time_n; - if (Solution_time_n1 != NULL) delete [] Solution_time_n1; - if (Limiter != NULL) delete [] Limiter; - 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; - if (Res_TruncError != NULL) delete [] Res_TruncError; - if (Residual_Old != NULL) delete [] Residual_Old; - if (Residual_Sum != NULL) delete [] Residual_Sum; - if (Solution_Adj_Old != NULL) delete [] Solution_Adj_Old; - if (Solution_BGS_k != NULL) delete [] Solution_BGS_k; - if (Input_AdjIndices != NULL) delete [] Input_AdjIndices; - if (Output_AdjIndices != NULL) delete [] Output_AdjIndices; - - if (Gradient != NULL) { - for (iVar = 0; iVar < nVar; iVar++) - delete [] Gradient[iVar]; - delete [] Gradient; +void CVariable::Set_OldSolution() { Solution_Old = Solution; } + +void CVariable::Set_Solution() { Solution = Solution_Old; } + +void CVariable::Set_Solution_time_n() { Solution_time_n = Solution; } + +void CVariable::Set_Solution_time_n1() { Solution_time_n1 = Solution_time_n; } + +void CVariable::Set_BGSSolution_k() { Solution_BGS_k = Solution; } + +void CVariable::SetResidualSumZero() { Residual_Sum.setConstant(0.0); } + +void CVariable::SetAuxVarGradientZero() { Grad_AuxVar.setConstant(0.0); } + +void CVariable::SetGradientZero() { Gradient.storage.setConstant(0.0); } + +void CVariable::SetRmatrixZero() { Rmatrix.storage.setConstant(0.0); } + +void CVariable::SetUnd_LaplZero() { Undivided_Laplacian.setConstant(0.0); } + +void CVariable::SetExternalZero() { External.setConstant(0.0); } + +void CVariable::Set_OldExternal() { External_Old = External; } + +void CVariable::RegisterSolution(bool input) { + if (input) { + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) + for(unsigned long iVar=0; iVar& indices = input? Input_AdjIndices : Output_AdjIndices; + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) + for(unsigned long iVar=0; iVar < nVar; ++iVar) + AD::SetAdjIndex(indices(iPoint,iVar), Solution(iPoint,iVar)); } diff --git a/SU2_DOT/src/SU2_DOT.cpp b/SU2_DOT/src/SU2_DOT.cpp index 7bd436e4f5af..e104d1bd6ab0 100644 --- a/SU2_DOT/src/SU2_DOT.cpp +++ b/SU2_DOT/src/SU2_DOT.cpp @@ -937,10 +937,10 @@ void SetSensitivity_Files(CGeometry ***geometry, CConfig **config, unsigned shor for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iDim = 0; iDim < nDim; iDim++) { - solver->node[iPoint]->SetSolution(iDim, geometry[iZone][INST_0]->node[iPoint]->GetCoord(iDim)); + solver->GetNodes()->SetSolution(iPoint, iDim, geometry[iZone][INST_0]->node[iPoint]->GetCoord(iDim)); } for (iVar = 0; iVar < nDim; iVar++) { - solver->node[iPoint]->SetSolution(iVar+nDim, geometry[iZone][INST_0]->GetSensitivity(iPoint, iVar)); + solver->GetNodes()->SetSolution(iPoint, iVar+nDim, geometry[iZone][INST_0]->GetSensitivity(iPoint, iVar)); } } @@ -980,7 +980,7 @@ void SetSensitivity_Files(CGeometry ***geometry, CConfig **config, unsigned shor Sens = Prod/Area; - solver->node[iPoint]->SetSolution(2*nDim, Sens); + solver->GetNodes()->SetSolution(iPoint, 2*nDim, Sens); } } diff --git a/SU2_PY/pySU2/Makefile.am b/SU2_PY/pySU2/Makefile.am index 8da1e827ebec..e65a43251d20 100644 --- a/SU2_PY/pySU2/Makefile.am +++ b/SU2_PY/pySU2/Makefile.am @@ -84,12 +84,12 @@ all: real: ${SWIG_SO_REAL} if BUILD_NORMAL - EXTRA_CC_FLAGS = -fPIC -O3 + EXTRA_CC_FLAGS = -fPIC -O3 -std=c++11 endif if BUILD_REVERSE - EXTRA_CC_FLAGS = -fPIC -O3 -std=c++0x -DCODI_REVERSE_TYPE -I$(top_srcdir)/externals/codi/include -I$(top_srcdir)/externals/medi/include -# EXTRA_CC_FLAGS = -fPIC -g3 -std=c++0x -DCODI_REVERSE_TYPE -I$(top_srcdir)/externals/codi/include -I$(top_srcdir)/externals/medi/include + EXTRA_CC_FLAGS = -fPIC -O3 -std=c++11 -DCODI_REVERSE_TYPE -I$(top_srcdir)/externals/codi/include -I$(top_srcdir)/externals/medi/include +# EXTRA_CC_FLAGS = -fPIC -g3 -std=c++11 -DCODI_REVERSE_TYPE -I$(top_srcdir)/externals/codi/include -I$(top_srcdir)/externals/medi/include endif #SU2_BASE lib diff --git a/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg b/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg index 110917c6ae2b..00ba0cae1050 100755 --- a/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg +++ b/TestCases/disc_adj_fsi/Airfoil_2d/config.cfg @@ -40,7 +40,7 @@ MATERIAL_DENSITY= 2700.0 % Boundary conditions -------------------------------------------------- % % fluid MARKER_FAR= ( farfield ) -MARKER_EULER= ( leading_edge, 0.0, pressure_side, 0.0, suction_side, 0.0) +MARKER_EULER= ( leading_edge, pressure_side, suction_side) % interface % this needs to appear before the normal load marker MARKER_ZONE_INTERFACE= (pressure_side,pressure_side_s, suction_side,suction_side_s) diff --git a/TestCases/fea_fsi/Airfoil_RBF/config.cfg b/TestCases/fea_fsi/Airfoil_RBF/config.cfg index cf944219af6c..437ca3394f55 100755 --- a/TestCases/fea_fsi/Airfoil_RBF/config.cfg +++ b/TestCases/fea_fsi/Airfoil_RBF/config.cfg @@ -1,25 +1,25 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % % SU2 configuration file % % Case description: 2D airfoil FSI with radial basis function interp. % % Institution: Imperial College London % % Date: 2015.08.12 % -% File Version 3.9 "eagle" % -% % +% File Version 6.2 "Falcon" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -SOLVER= MULTIPHYSICS +SOLVER = MULTIPHYSICS CONFIG_LIST = (configFlow.cfg, configFEA.cfg) MULTIZONE_SOLVER = BLOCK_GAUSS_SEIDEL -MARKER_ZONE_INTERFACE= (pressure_side,pressure_side_s, suction_side,suction_side_s) +MARKER_ZONE_INTERFACE = (pressure_side,pressure_side_s, suction_side,suction_side_s) -MESH_FILENAME= mesh.su2 +MESH_FILENAME = mesh.su2 TIME_DOMAIN = NO -OUTER_ITER = 1 +OUTER_ITER = 50 +% enable this option to see convergence output for individual zones +WRT_ZONE_CONV = NO diff --git a/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg b/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg index 44ea9d2eaac6..fa18417b62ee 100644 --- a/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg +++ b/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg @@ -6,16 +6,12 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Interface options ---------------------------------------------------- % - +% See "configFlow.cfg" for explanation of these options. KIND_INTERPOLATION = RADIAL_BASIS_FUNCTION -CONSERVATIVE_INTERPOLATION = NO +CONSERVATIVE_INTERPOLATION = YES KIND_RADIAL_BASIS_FUNCTION = WENDLAND_C2 RADIAL_BASIS_FUNCTION_PARAMETER = 0.015 RADIAL_BASIS_FUNCTION_POLYNOMIAL_TERM = YES - -INNER_ITER = 30 -WRT_BINARY_RESTART=NO -READ_BINARY_RESTART=NO % % Physics -------------------------------------------------------------- % SOLVER= ELASTICITY @@ -29,20 +25,10 @@ MATERIAL_DENSITY= 2700.0 % % Boundary conditions -------------------------------------------------- % MARKER_PRESSURE= ( pressure_side_s,0.0, suction_side_s,0.0 ) -MARKER_FLUID_LOAD = (pressure_side_s, suction_side_s, clamped) -MARKER_CLAMPED = ( clamped ) -% -% Common numerics settings --------------------------------------------- % -REF_DIMENSIONALIZATION= DIMENSIONAL -NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 10.0 +MARKER_FLUID_LOAD= ( pressure_side_s, suction_side_s, clamped ) +MARKER_CLAMPED= ( clamped ) % -% Flow numerics -------------------------------------------------------- % -CONV_NUM_METHOD_FLOW= JST -JST_SENSOR_COEFF= ( 0.5, 0.02 ) -TIME_DISCRE_FLOW= EULER_IMPLICIT -% -% Solid numerics ------------------------------------------------------- % +% Numerics ------------------------------------------------------------- % GEOMETRIC_CONDITIONS= LARGE_DEFORMATIONS FORMULATION_ELASTICITY_2D= PLANE_STRESS % @@ -53,31 +39,31 @@ LINEAR_SOLVER_ERROR= 1E-6 LINEAR_SOLVER_ITER= 1000 LINEAR_SOLVER_RESTART_FREQUENCY= 100 % -% Convergence criteria ------------------------------------------------- % -OUTER_ITER= 1 -% interaction -FSI_ITER= 1 -% if running from scratch this helps a bunch +% Fluid-structure interaction ------------------------------------------ % +% when running from scratch RAMP_LOADING helps (don't do it with restart) %RAMP_LOADING= YES %RAMP_FSI_ITER= 5 BGS_RELAXATION= FIXED_PARAMETER STAT_RELAX_PARAMETER= 0.7 -% solid -NONLINEAR_FEM_INT_ITER= 30 +% +% Convergence criteria ------------------------------------------------- % +INNER_ITER= 30 +CONV_FIELD= RMS_UTOL, RMS_ETOL +CONV_STARTITER= 0 +CONV_RESIDUAL_MINVAL= -5 % % In\Out --------------------------------------------------------------- % MESH_FILENAME= meshFEA.su2 MESH_FORMAT= SU2 -MULTIZONE_MESH = NO -% +MULTIZONE_MESH= NO +% inputs RESTART_SOL= YES SOLUTION_FILENAME= solution_solid.dat -WRT_SOL_FREQ= 999999 +% outputs +WRT_SOL_FREQ= 9999 RESTART_FILENAME= restart_solid.dat -% -TABULAR_FORMAT= CSV VOLUME_FILENAME= solid -% -WRT_CON_FREQ= 10 +% history and screen +SCREEN_WRT_FREQ_INNER= 10 CONV_FILENAME= history diff --git a/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg b/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg index e255e2118c55..c4865ad0e1cf 100644 --- a/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg +++ b/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg @@ -6,23 +6,35 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Interface options ---------------------------------------------------- % - +% This is one of the ways of interpolating between non-matching meshes, +% its attractiveness comes from removing the need to map nodes between +% sides, the downside is that dense matrix algebra is involved, so w.r.t. +% the number of interface nodes the approach is quadratic in memory and +% cubic in computation. To manage this the interface needs to be split in +% patches (by the user, this example has 2 patches), compiling with BLAS +% and LAPACK is recommended. KIND_INTERPOLATION = RADIAL_BASIS_FUNCTION -CONSERVATIVE_INTERPOLATION = NO +% Conserve virtual work by using the transpose of the displacement +% interpolation matrix when transferring fluid loads, this is usually the +% best option, if the range of cell sizes on the interface is large (2-3 +% orders) and you have issues, break up the interface or use "NO" for +% consistent interpolation. +CONSERVATIVE_INTERPOLATION = YES +% Wendland provides good results and produces a nice diagonally dominant +% interpolation kernel, other options: +% INV_MULTI_QUADRIC; GAUSSIAN; THIN_PLATE_SPLINE; MULTI_QUADRIC KIND_RADIAL_BASIS_FUNCTION = WENDLAND_C2 +% The radius in meters, 2 times the largest cell size on the interface is +% a good compromise between accuracy and condition number of the kernel. RADIAL_BASIS_FUNCTION_PARAMETER = 0.015 +% Recommended as it recovers rigid body motion, only requires a few more +% matrix products... feel free to explore though! RADIAL_BASIS_FUNCTION_POLYNOMIAL_TERM = YES - -WRT_BINARY_RESTART=NO -READ_BINARY_RESTART=NO % % Physics -------------------------------------------------------------- % SOLVER= EULER MATH_PROBLEM= DIRECT KIND_TURB_MODEL= NONE - -MULTIZONE_MESH = NO -INNER_ITER= 60 % % Compressible free-stream conditions ---------------------------------- % MACH_NUMBER= 0.7 @@ -39,14 +51,8 @@ GAMMA_VALUE= 1.4 GAS_CONSTANT= 287.87 % % Boundary conditions -------------------------------------------------- % -% fluid MARKER_FAR= ( farfield ) -MARKER_EULER= ( leading_edge, 0.0, pressure_side, 0.0, suction_side, 0.0) -% solid -MARKER_CLAMPED = ( clamped ) -% -SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC -MARKER_MOVING= ( leading_edge, pressure_side, suction_side ) +MARKER_EULER= ( leading_edge, pressure_side, suction_side ) % % Post processing and monitoring --------------------------------------- % REF_ORIGIN_MOMENT_X= -0.125 @@ -58,22 +64,15 @@ MARKER_PLOTTING= ( leading_edge, pressure_side, suction_side ) MARKER_MONITORING= ( leading_edge, pressure_side, suction_side ) MARKER_DESIGNING= ( leading_edge, pressure_side, suction_side ) % -% Common numerics settings --------------------------------------------- % -REF_DIMENSIONALIZATION= DIMENSIONAL -NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 10.0 -% % Flow numerics -------------------------------------------------------- % CONV_NUM_METHOD_FLOW= JST JST_SENSOR_COEFF= ( 0.5, 0.02 ) TIME_DISCRE_FLOW= EULER_IMPLICIT +REF_DIMENSIONALIZATION= DIMENSIONAL +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 10.0 % -% Linear solvers ------------------------------------------------------- % -LINEAR_SOLVER= BCGSTAB -LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-2 -LINEAR_SOLVER_ITER= 100 -% Multigrid +% Multigrid ------------------------------------------------------------ % MGLEVEL= 1 MGCYCLE= V_CYCLE MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) @@ -82,41 +81,43 @@ MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) MG_DAMP_RESTRICTION= 0.75 MG_DAMP_PROLONGATION= 0.75 % +% Grid deformation ----------------------------------------------------- % +SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC +MARKER_MOVING= ( leading_edge, pressure_side, suction_side ) +DEFORM_NONLINEAR_ITER= 1 +DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME +DEFORM_CONSOLE_OUTPUT= NO +% +% Linear solvers ------------------------------------------------------- % +LINEAR_SOLVER= BCGSTAB +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-2 +LINEAR_SOLVER_ITER= 100 +% DEFORM_LINEAR_SOLVER= CONJUGATE_GRADIENT DEFORM_LINEAR_SOLVER_PREC= ILU DEFORM_LINEAR_SOLVER_ERROR= 1e-6 DEFORM_LINEAR_SOLVER_ITER= 1000 % % Convergence criteria ------------------------------------------------- % -OUTER_ITER= 1 -% interaction -FSI_ITER= 1 -% if running from scratch this helps a bunch -%RAMP_LOADING= YES -%RAMP_FSI_ITER= 5 -BGS_RELAXATION= FIXED_PARAMETER -STAT_RELAX_PARAMETER= 0.7 -% fluid +INNER_ITER= 60 CONV_CRITERIA= RESIDUAL CONV_STARTITER= 0 CONV_RESIDUAL_MINVAL= -9 -% grid deformation -DEFORM_NONLINEAR_ITER= 1 -DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME % % In\Out --------------------------------------------------------------- % MESH_FILENAME= meshFlow.su2 MESH_FORMAT= SU2 -% +MULTIZONE_MESH= NO +% inputs RESTART_SOL= YES SOLUTION_FILENAME= solution_fluid.dat -WRT_SOL_FREQ= 999999 +% outputs +WRT_SOL_FREQ= 9999 RESTART_FILENAME= restart_fluid.dat -% -TABULAR_FORMAT= CSV VOLUME_FILENAME= fluid SURFACE_FILENAME= surface_fluid -% -WRT_CON_FREQ= 10 +% history and screen +SCREEN_WRT_FREQ_INNER= 10 CONV_FILENAME= history diff --git a/TestCases/fea_fsi/Airfoil_RBF/settings.cfg b/TestCases/fea_fsi/Airfoil_RBF/settings.cfg deleted file mode 100644 index 6a8b9e76ec6b..000000000000 --- a/TestCases/fea_fsi/Airfoil_RBF/settings.cfg +++ /dev/null @@ -1,171 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% SU2 configuration file % -% Case description: 2D airfoil FSI with radial basis function interp. % -% Institution: Imperial College London % -% File Version 6.2.0 "Falcon" % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Interface options ---------------------------------------------------- % - -% This is one of the ways of interpolating between non-matching meshes, -% its attractiveness comes from removing the need to map nodes between -% sides, the downside is that dense matrix algebra is involved, so w.r.t. -% the number of interface nodes the approach is quadratic in memory and -% cubic in computation. To manage this the interface needs to be split in -% patches (by the user, this example has 2 patches), compiling with BLAS -% and LAPACK is also recommended and the way to get some parallelism (if -% the particular library supports it), to do so you need to set the env -% var CPPFLAGS=-DHAVE_LAPACK plus LDFLAGS and LIBS appropriately: -% Ref. LAPACK: LDFLAGS=-L/libdirpath LIBS=-llapack -lrefblas -lgfortran -% OpenBLAS: LDFLAGS=-L/libdirpath LIBS=-lopenblas -lgfortran -% Others are similar, check the docs of your library of choice. -KIND_INTERPOLATION = RADIAL_BASIS_FUNCTION -% Conserve virtual work by using the transpose of the displacement -% interpolation matrix when transferring fluid loads, this is usually the -% best option, if the range of cell sizes on the interface is large (2-3 -% orders) and you have issues, break up the interface or use "NO" for -% consistent interpolation. -CONSERVATIVE_INTERPOLATION = YES -% Wendland provides good results and produces a nice diagonally dominant -% interpolation kernel, other options: -% INV_MULTI_QUADRIC; GAUSSIAN; THIN_PLATE_SPLINE; MULTI_QUADRIC -KIND_RADIAL_BASIS_FUNCTION = WENDLAND_C2 -% The radius in meters, 2 times the largest cell size on the interface is -% a good compromise between accuracy and condition number of the kernel. -RADIAL_BASIS_FUNCTION_PARAMETER = 0.015 -% Recommended as it recovers rigid body motion, only requires a few more -% matrix products... feel free to explore though! -RADIAL_BASIS_FUNCTION_POLYNOMIAL_TERM = YES -% -% Physics -------------------------------------------------------------- % -SOLVER= FLUID_STRUCTURE_INTERACTION -MATH_PROBLEM= DIRECT -% -FSI_FLUID_PROBLEM= EULER -KIND_TURB_MODEL= NONE -FSI_STRUCTURAL_PROBLEM= ELASTICITY -% -% Compressible free-stream conditions ---------------------------------- % -MACH_NUMBER= 0.7 -AOA= 2.5 -INIT_OPTION= TD_CONDITIONS -FREESTREAM_OPTION= TEMPERATURE_FS -FREESTREAM_PRESSURE= 101325.0 -FREESTREAM_TEMPERATURE= 273.15 -REYNOLDS_LENGTH= 0.5 -% -% Fluid properties ----------------------------------------------------- % -FLUID_MODEL= IDEAL_GAS -GAMMA_VALUE= 1.4 -GAS_CONSTANT= 287.87 -% -% Solid properties ----------------------------------------------------- % -MATERIAL_MODEL= NEO_HOOKEAN -ELASTICITY_MODULUS= 7E8 -POISSON_RATIO= 0.35 -MATERIAL_DENSITY= 2700.0 -% -% Boundary conditions -------------------------------------------------- % -% fluid -MARKER_FAR= ( farfield ) -MARKER_EULER= ( leading_edge, 0.0, pressure_side, 0.0, suction_side, 0.0) -% interface -% this needs to appear before the last dummy load marker -MARKER_ZONE_INTERFACE= (pressure_side,pressure_side_s, suction_side,suction_side_s) -% solid -MARKER_CLAMPED = ( clamped ) -% this needs to be here to make SU2 happy -MARKER_PRESSURE= ( pressure_side_s,0.0, suction_side_s,0.0 ) -% -SURFACE_MOVEMENT= FLUID_STRUCTURE_STATIC -MARKER_MOVING= ( leading_edge, pressure_side, suction_side ) -% -% Post processing and monitoring --------------------------------------- % -REF_ORIGIN_MOMENT_X= -0.125 -REF_ORIGIN_MOMENT_Y= 0.00 -REF_ORIGIN_MOMENT_Z= 0.00 -REF_LENGTH= 0.5 -REF_AREA= 0.5 -MARKER_PLOTTING= ( leading_edge, pressure_side, suction_side ) -MARKER_MONITORING= ( leading_edge, pressure_side, suction_side ) -MARKER_DESIGNING= ( leading_edge, pressure_side, suction_side ) -% -% Common numerics settings --------------------------------------------- % -REF_DIMENSIONALIZATION= DIMENSIONAL -NUM_METHOD_GRAD= GREEN_GAUSS -CFL_NUMBER= 10.0 -% -% Flow numerics -------------------------------------------------------- % -CONV_NUM_METHOD_FLOW= JST -JST_SENSOR_COEFF= ( 0.5, 0.02 ) -TIME_DISCRE_FLOW= EULER_IMPLICIT -% -% Solid numerics ------------------------------------------------------- % -GEOMETRIC_CONDITIONS= LARGE_DEFORMATIONS -FORMULATION_ELASTICITY_2D= PLANE_STRESS -% -% Linear solvers ------------------------------------------------------- % -LINEAR_SOLVER= BCGSTAB -LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-2 -LINEAR_SOLVER_ITER= 100 -% Multigrid -MGLEVEL= 1 -MGCYCLE= V_CYCLE -MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) -MG_POST_SMOOTH= ( 0, 0, 0, 0 ) -MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) -MG_DAMP_RESTRICTION= 0.75 -MG_DAMP_PROLONGATION= 0.75 -% -FSI_LINEAR_SOLVER_STRUC= RESTARTED_FGMRES -FSI_LINEAR_SOLVER_PREC_STRUC= ILU -FSI_LINEAR_SOLVER_ERROR_STRUC= 1E-6 -FSI_LINEAR_SOLVER_ITER_STRUC= 1000 -LINEAR_SOLVER_RESTART_FREQUENCY= 100 -% -DEFORM_LINEAR_SOLVER= CONJUGATE_GRADIENT -DEFORM_LINEAR_SOLVER_PREC= ILU -DEFORM_LINEAR_SOLVER_ERROR= 1e-6 -DEFORM_LINEAR_SOLVER_ITER= 1000 -% -% Convergence criteria ------------------------------------------------- % -EXT_ITER= 1 -% interaction -FSI_ITER= 1 -% if running from scratch this helps a bunch -%RAMP_LOADING= YES -%RAMP_FSI_ITER= 5 -BGS_RELAXATION= FIXED_PARAMETER -STAT_RELAX_PARAMETER= 0.7 -CONV_RESIDUAL_MINVAL_FSI= -8 -% fluid -UNST_INT_ITER= 60 -CONV_CRITERIA= RESIDUAL -CONV_STARTITER= 0 -CONV_RESIDUAL_MINVAL= -9 -% solid -NONLINEAR_FEM_INT_ITER= 30 -% grid deformation -DEFORM_NONLINEAR_ITER= 1 -DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME -% -% In\Out --------------------------------------------------------------- % -MESH_FILENAME= mesh.su2 -MESH_FORMAT= SU2 -% -RESTART_SOL= YES -SOLUTION_FILENAME= solution_fluid.dat -SOLUTION_STRUCTURE_FILENAME= solution_solid.dat -WRT_SOL_FREQ= 999999 -RESTART_FILENAME= restart_fluid.dat -RESTART_STRUCTURE_FILENAME= restart_solid.dat -% -TABULAR_FORMAT= CSV -VOLUME_FILENAME= fluid -SURFACE_FILENAME= surface_fluid -VOLUME_STRUCTURE_FILENAME= solid -% -WRT_CON_FREQ= 10 -CONV_FILENAME= history - diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index ac65ead2a7fc..19e15e8c9ce4 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -1193,8 +1193,8 @@ def main(): airfoilRBF = TestCase('airfoil_fsi_rbf') airfoilRBF.cfg_dir = "fea_fsi/Airfoil_RBF" airfoilRBF.cfg_file = "config.cfg" - airfoilRBF.test_iter = 0 - airfoilRBF.test_vals = [0.000000, 1.440246, -2.236518] #last 4 columns + airfoilRBF.test_iter = 1 + airfoilRBF.test_vals = [1.0, -2.979045, -4.882900] airfoilRBF.su2_exec = "SU2_CFD" airfoilRBF.timeout = 1600 airfoilRBF.multizone = True diff --git a/meson.build b/meson.build index 94d7310b108e..c3821017dbde 100644 --- a/meson.build +++ b/meson.build @@ -35,6 +35,11 @@ if get_option('enable-cgns') su2_cpp_args += '-DHAVE_CGNS' endif +# Check for non-debug build +if get_option('buildtype')!='debug' + su2_cpp_args += '-DNDEBUG' +endif + # check if MPI dependencies are found and add them if mpi_dep[0].found() and mpi_dep[1].found()