From c3af14fa43411e8b7c4c3261bfd3c6b29301689e Mon Sep 17 00:00:00 2001 From: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> Date: Sat, 16 Nov 2019 10:55:24 +0100 Subject: [PATCH] Delete all trailing whitespaces and tabs to 2 spaces (#808) * Removed all trailing whitespaces from [.cpp,.hpp,.inl,.py,.build] files. * Replaced all tabs with 2 spaces in [.cpp,.hpp,.inl] files * Create CPPLINT.cfg * Revert tab and trailing whitespace change for externals, SU2_IDE, Testcases * Replace tabs and trim whitespaces after merge with origin/develop. * Revert tab repl. and whitespace trimming for some files. * Add /externals/utils script to replace tabs and trim trailing whitespaces. * Revert all files to origin/develop * Remove trailing whitespaces and replace tabs by 2 spaces for restructured files. --- .../drivers/CDiscAdjSinglezoneDriver.hpp | 4 +- SU2_CFD/include/drivers/CDriver.hpp | 52 +- SU2_CFD/include/drivers/CDummyDriver.hpp | 10 +- SU2_CFD/include/drivers/CMultizoneDriver.hpp | 2 +- SU2_CFD/include/drivers/CSinglezoneDriver.hpp | 2 +- .../interfaces/fsi/CFlowTractionInterface.hpp | 2 +- .../include/output/CAdjElasticityOutput.hpp | 2 +- SU2_CFD/include/output/CAdjFlowIncOutput.hpp | 26 +- SU2_CFD/include/output/CAdjFlowOutput.hpp | 24 +- SU2_CFD/include/output/CAdjHeatOutput.hpp | 12 +- SU2_CFD/include/output/CElasticityOutput.hpp | 6 +- SU2_CFD/include/output/CFlowCompFEMOutput.hpp | 22 +- SU2_CFD/include/output/CFlowCompOutput.hpp | 26 +- SU2_CFD/include/output/CFlowIncOutput.hpp | 24 +- SU2_CFD/include/output/CFlowOutput.hpp | 26 +- SU2_CFD/include/output/CHeatOutput.hpp | 8 +- SU2_CFD/include/output/CMeshOutput.hpp | 2 +- SU2_CFD/include/output/CMultizoneOutput.hpp | 12 +- SU2_CFD/include/output/COutput.hpp | 320 ++--- SU2_CFD/include/output/COutputLegacy.hpp | 126 +- .../output/filewriter/CCSVFileWriter.hpp | 12 +- .../output/filewriter/CFEMDataSorter.hpp | 16 +- .../output/filewriter/CFVMDataSorter.hpp | 24 +- .../include/output/filewriter/CFileWriter.hpp | 34 +- .../output/filewriter/CParallelDataSorter.hpp | 74 +- .../filewriter/CParaviewBinaryFileWriter.hpp | 16 +- .../output/filewriter/CParaviewFileWriter.hpp | 16 +- .../filewriter/CSU2BinaryFileWriter.hpp | 16 +- .../output/filewriter/CSU2FileWriter.hpp | 16 +- .../output/filewriter/CSU2MeshFileWriter.hpp | 16 +- .../filewriter/CSurfaceFEMDataSorter.hpp | 18 +- .../filewriter/CSurfaceFVMDataSorter.hpp | 22 +- .../filewriter/CTecplotBinaryFileWriter.hpp | 28 +- .../output/filewriter/CTecplotFileWriter.hpp | 16 +- .../include/solvers/CDiscAdjMeshSolver.hpp | 2 +- SU2_CFD/include/solvers/CMeshSolver.hpp | 8 +- .../variables/CDiscAdjFEABoundVariable.hpp | 2 +- .../include/variables/CDiscAdjFEAVariable.hpp | 4 +- SU2_CFD/include/variables/CFEAVariable.hpp | 8 +- .../include/variables/CMeshBoundVariable.hpp | 2 +- SU2_CFD/include/variables/CTurbSAVariable.hpp | 2 +- .../include/variables/CTurbSSTVariable.hpp | 2 +- SU2_CFD/include/variables/CVariable.hpp | 6 +- .../src/drivers/CDiscAdjMultizoneDriver.cpp | 14 +- .../src/drivers/CDiscAdjSinglezoneDriver.cpp | 16 +- SU2_CFD/src/drivers/CDriver.cpp | 1194 ++++++++-------- SU2_CFD/src/drivers/CDummyDriver.cpp | 2 +- SU2_CFD/src/drivers/CMultizoneDriver.cpp | 92 +- SU2_CFD/src/drivers/CSinglezoneDriver.cpp | 76 +- SU2_CFD/src/interfaces/CInterface.cpp | 8 +- .../interfaces/cfd/CMixingPlaneInterface.cpp | 2 +- .../interfaces/fsi/CFlowTractionInterface.cpp | 4 +- SU2_CFD/src/output/CAdjFlowCompOutput.cpp | 240 ++-- SU2_CFD/src/output/CAdjFlowIncOutput.cpp | 236 ++-- SU2_CFD/src/output/CAdjHeatOutput.cpp | 100 +- SU2_CFD/src/output/CBaselineOutput.cpp | 50 +- SU2_CFD/src/output/CElasticityOutput.cpp | 76 +- SU2_CFD/src/output/CFlowCompFEMOutput.cpp | 122 +- SU2_CFD/src/output/CFlowCompOutput.cpp | 336 ++--- SU2_CFD/src/output/CFlowIncOutput.cpp | 304 ++-- SU2_CFD/src/output/CFlowOutput.cpp | 650 ++++----- SU2_CFD/src/output/CHeatOutput.cpp | 62 +- SU2_CFD/src/output/CMeshOutput.cpp | 20 +- SU2_CFD/src/output/CMultizoneOutput.cpp | 116 +- SU2_CFD/src/output/COutput.cpp | 1248 ++++++++--------- .../src/output/filewriter/CCSVFileWriter.cpp | 96 +- .../src/output/filewriter/CFEMDataSorter.cpp | 60 +- .../src/output/filewriter/CFVMDataSorter.cpp | 230 +-- .../output/filewriter/CParallelDataSorter.cpp | 176 +-- .../output/filewriter/CParallelFileWriter.cpp | 12 +- .../filewriter/CParaviewBinaryFileWriter.cpp | 570 ++++---- .../output/filewriter/CParaviewFileWriter.cpp | 122 +- .../filewriter/CSU2BinaryFileWriter.cpp | 36 +- .../src/output/filewriter/CSU2FileWriter.cpp | 62 +- .../output/filewriter/CSU2MeshFileWriter.cpp | 140 +- .../filewriter/CSurfaceFEMDataSorter.cpp | 80 +- .../filewriter/CSurfaceFVMDataSorter.cpp | 778 +++++----- .../filewriter/CTecplotBinaryFileWriter.cpp | 122 +- .../output/filewriter/CTecplotFileWriter.cpp | 98 +- SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp | 6 +- SU2_CFD/src/solvers/CMeshSolver.cpp | 8 +- SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp | 4 +- SU2_CFD/src/variables/CFEAVariable.cpp | 4 +- SU2_CFD/src/variables/CMeshBoundVariable.cpp | 2 +- SU2_CFD/src/variables/CTransLMVariable.cpp | 2 +- SU2_CFD/src/variables/CTurbSSTVariable.cpp | 2 +- SU2_CFD/src/variables/CVariable.cpp | 6 +- ...lace-tabs-and-trim-trailing-whitespaces.sh | 39 + 88 files changed, 4365 insertions(+), 4326 deletions(-) create mode 100644 externals/utils/replace-tabs-and-trim-trailing-whitespaces.sh diff --git a/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp b/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp index 00071ffe5ae..5f2f54e4512 100644 --- a/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp +++ b/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp @@ -62,9 +62,9 @@ class CDiscAdjSinglezoneDriver : public CSinglezoneDriver { CSolver **solver; /*!< \brief Container vector with all the solutions. */ COutput *direct_output; CNumerics ***numerics; /*!< \brief Container vector with all the numerics. */ - + COutputLegacy* output_legacy; - + public: /*! diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index 2fd38b1be48..5fc3d1556bf 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -79,15 +79,15 @@ using namespace std; -/*! +/*! * \class CDriver * \brief Parent class for driving an iteration of a single or multi-zone problem. * \author T. Economon */ class CDriver { protected: - int rank, /*!< \brief MPI Rank. */ - size; /*!< \brief MPI Size. */ + int rank, /*!< \brief MPI Rank. */ + size; /*!< \brief MPI Size. */ char* config_file_name; /*!< \brief Configuration file name of the problem.*/ char runtime_file_name[MAX_STRING_SIZE]; su2double StartTime, /*!< \brief Start point of the timer for performance benchmarking.*/ @@ -137,10 +137,10 @@ class CDriver { PyWrapNodalForceDensity[3], /*!< \brief This is used to store the force density at each vertex. */ PyWrapNodalHeatFlux[3]; /*!< \brief This is used to store the heat flux at each vertex. */ bool dummy_geometry; - + public: - /*! + /*! * \brief Constructor of the class. * \param[in] confFile - Configuration file name. * \param[in] val_nZone - Total number of zones. @@ -158,16 +158,16 @@ class CDriver { /*! * \brief A virtual member. - */ + */ virtual void Run() { }; protected: - + /*! * \brief Init_Containers */ void SetContainers_Null(); - + /*! * \brief Read in the config and mesh files. */ @@ -177,7 +177,7 @@ class CDriver { * \brief Construction of the edge-based data structure and the multigrid structure. */ void Geometrical_Preprocessing(CConfig *config, CGeometry **&geometry, bool dummy); - + /*! * \brief Do the geometrical preprocessing for the DG FEM solver. */ @@ -187,7 +187,7 @@ class CDriver { * \brief Geometrical_Preprocessing_FVM */ void Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geometry); - + /*! * \brief Definition of the physics iteration class or within a single zone. * \param[in] iteration_container - Pointer to the iteration container to be instantiated. @@ -293,7 +293,7 @@ class CDriver { void Turbomachinery_Preprocessing(CConfig** config, CGeometry**** geometry, CSolver***** solver, CInterface*** interface); - + /*! * \brief A virtual member. * \param[in] donorZone - zone in which the displacements will be predicted. @@ -337,7 +337,7 @@ class CDriver { * \param[in] iOuterIter - Fluid-Structure Interaction subiteration. */ virtual void Relaxation_Tractions(unsigned short donorZone, unsigned short targetZone, unsigned long iOuterIter) {} - + /*! * \brief A virtual member to run a Block Gauss-Seidel iteration in multizone problems. */ @@ -347,23 +347,23 @@ class CDriver { * \brief A virtual member to run a Block-Jacobi iteration in multizone problems. */ virtual void Run_Jacobi(){} - + /*! * \brief A virtual member. */ virtual void Update() {} - + public: /*! * \brief Launch the computation for all zones and all physics. */ virtual void StartSolver() {} - + /*! * \brief Deallocation routine */ - void Postprocessing(); + void Postprocessing(); /*! * \brief A virtual member. @@ -875,7 +875,7 @@ class CFluidDriver : public CDriver { unsigned long Max_Iter; public: - + /*! * \brief Constructor of the class. * \param[in] confFile - Configuration file name. @@ -891,7 +891,7 @@ class CFluidDriver : public CDriver { * \brief Destructor of the class. */ ~CFluidDriver(void); - + /*! * \brief Launch the computation for all zones and all physics. */ @@ -906,21 +906,21 @@ class CFluidDriver : public CDriver { * \brief Update the dual-time solution within multiple zones. */ void Update(); - + /*! * \brief Output the solution in solution file. */ void Output(unsigned long InnerIter); - + /*! * \brief Monitor the computation. */ bool Monitor(unsigned long ExtIter); - + /*! * \brief Perform some pre-processing before an iteration of the physics. */ - void Preprocess(unsigned long Iter); + void Preprocess(unsigned long Iter); /*! * \brief Perform a dynamic mesh deformation, included grid velocity computation and the update of the multigrid structure (multiple zone). @@ -992,7 +992,7 @@ class CFluidDriver : public CDriver { class CTurbomachineryDriver : public CFluidDriver { private: COutputLegacy* output_legacy; - + public: /*! @@ -1078,7 +1078,7 @@ class CHBDriver : public CFluidDriver { * \param[in] iZone - Current zone number. */ void SetHarmonicBalance(unsigned short iZone); - + /*! * \brief Precondition Harmonic Balance source term for stability * \author J. Howison @@ -1109,9 +1109,9 @@ class CHBDriver : public CFluidDriver { * \version 6.2.0 "Falcon" */ class CDiscAdjFSIDriver : public CDriver { - + COutputLegacy* output_legacy; - + CIteration** direct_iteration; unsigned short RecordingState; unsigned short CurrentRecording; /*!< \brief Stores the current status of the recording. */ diff --git a/SU2_CFD/include/drivers/CDummyDriver.hpp b/SU2_CFD/include/drivers/CDummyDriver.hpp index 471b56a780b..44710e3d761 100644 --- a/SU2_CFD/include/drivers/CDummyDriver.hpp +++ b/SU2_CFD/include/drivers/CDummyDriver.hpp @@ -43,9 +43,9 @@ * \brief CDummyDriver class that constructs the driver without running a solver. */ class CDummyDriver : public CDriver { - + public: - + /*! * \brief Constructor of the class. * \param[in] confFile - Configuration file name. @@ -55,15 +55,15 @@ class CDummyDriver : public CDriver { CDummyDriver (char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator); - + /*! * \brief Destructor of the class. */ ~CDummyDriver(){} - + /*! * \brief Does nothing except printing the information that no solver is running. */ void StartSolver(); - + }; diff --git a/SU2_CFD/include/drivers/CMultizoneDriver.hpp b/SU2_CFD/include/drivers/CMultizoneDriver.hpp index 5be1d0e9601..be413a54478 100644 --- a/SU2_CFD/include/drivers/CMultizoneDriver.hpp +++ b/SU2_CFD/include/drivers/CMultizoneDriver.hpp @@ -138,7 +138,7 @@ class CMultizoneDriver : public CDriver { * \return Boolean that determines whether the mesh needs to be updated for this particular transfer */ bool Transfer_Data(unsigned short donorZone, unsigned short targetZone); - + bool Monitor(unsigned long TimeIter); }; diff --git a/SU2_CFD/include/drivers/CSinglezoneDriver.hpp b/SU2_CFD/include/drivers/CSinglezoneDriver.hpp index 298b74f875e..784566d8390 100644 --- a/SU2_CFD/include/drivers/CSinglezoneDriver.hpp +++ b/SU2_CFD/include/drivers/CSinglezoneDriver.hpp @@ -107,7 +107,7 @@ class CSinglezoneDriver : public CDriver { * \param ExtIter */ virtual bool Monitor(unsigned long TimeIter); - + /*! * \brief Runtime_Parsing */ diff --git a/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp b/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp index cdac3b8638a..d1cb9612028 100644 --- a/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp +++ b/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp @@ -44,7 +44,7 @@ class CFlowTractionInterface : public CInterface { protected: bool consistent_interpolation; - + /*! * \brief Sets the dimensional factor for pressure and the consistent_interpolation flag * \param[in] flow_config - Definition of the fluid (donor) problem. diff --git a/SU2_CFD/include/output/CAdjElasticityOutput.hpp b/SU2_CFD/include/output/CAdjElasticityOutput.hpp index c236be31cef..eb492bd2b74 100644 --- a/SU2_CFD/include/output/CAdjElasticityOutput.hpp +++ b/SU2_CFD/include/output/CAdjElasticityOutput.hpp @@ -59,7 +59,7 @@ class CAdjElasticityOutput final : public COutput { * \brief Destructor of the class. */ ~CAdjElasticityOutput(void) override; - + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp index 59b7d464a33..91bdbde9219 100644 --- a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp @@ -46,11 +46,11 @@ */ class CAdjFlowIncOutput final: public COutput { private: - - unsigned short turb_model; /*!< \brief The kind of turbulence model*/ - bool heat, /*!< \brief Boolean indicating whether have a heat problem*/ - weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ - + + unsigned short turb_model; /*!< \brief The kind of turbulence model*/ + bool heat, /*!< \brief Boolean indicating whether have a heat problem*/ + weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ + public: @@ -70,19 +70,19 @@ class CAdjFlowIncOutput final: public COutput { * \param[in] config - Definition of the particular problem. */ void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override; - + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -91,7 +91,7 @@ class CAdjFlowIncOutput final: public COutput { * \param[in] iPoint - Index of the point. */ void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; - + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -101,16 +101,16 @@ class CAdjFlowIncOutput final: public COutput { * \param[in] iMarker - Index of the surface marker. * \param[in] iVertex - Index of the vertex on the marker. */ - void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, - unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; - + void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, + unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; + /*! * \brief Check whether the base values for relative residuals should be initialized * \param[in] config - Definition of the particular problem. * \return if the residuals should be initialized. */ bool SetInit_Residuals(CConfig *config) override; - + /*! * \brief Check whether the averaged values should be updated * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/CAdjFlowOutput.hpp b/SU2_CFD/include/output/CAdjFlowOutput.hpp index bb1a552a862..0df48c50f12 100644 --- a/SU2_CFD/include/output/CAdjFlowOutput.hpp +++ b/SU2_CFD/include/output/CAdjFlowOutput.hpp @@ -46,10 +46,10 @@ */ class CAdjFlowCompOutput final: public COutput { private: - - bool cont_adj; /*!< \brief Boolean indicating whether we run a cont. adjoint problem */ - unsigned short turb_model; /*!< \brief The kind of turbulence model*/ - + + bool cont_adj; /*!< \brief Boolean indicating whether we run a cont. adjoint problem */ + unsigned short turb_model; /*!< \brief The kind of turbulence model*/ + public: /*! @@ -68,19 +68,19 @@ class CAdjFlowCompOutput final: public COutput { * \param[in] config - Definition of the particular problem. */ void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override; - + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -89,7 +89,7 @@ class CAdjFlowCompOutput final: public COutput { * \param[in] iPoint - Index of the point. */ void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; - + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -99,16 +99,16 @@ class CAdjFlowCompOutput final: public COutput { * \param[in] iMarker - Index of the surface marker. * \param[in] iVertex - Index of the vertex on the marker. */ - void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, - unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; - + void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, + unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; + /*! * \brief Check whether the base values for relative residuals should be initialized * \param[in] config - Definition of the particular problem. * \return if the residuals should be initialized. */ bool SetInit_Residuals(CConfig *config) override; - + /*! * \brief Check whether the averaged values should be updated * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/CAdjHeatOutput.hpp b/SU2_CFD/include/output/CAdjHeatOutput.hpp index 032437a862c..ec2a759afd0 100644 --- a/SU2_CFD/include/output/CAdjHeatOutput.hpp +++ b/SU2_CFD/include/output/CAdjHeatOutput.hpp @@ -63,19 +63,19 @@ class CAdjHeatOutput final: public COutput { * \param[in] config - Definition of the particular problem. */ void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override; - + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -84,7 +84,7 @@ class CAdjHeatOutput final: public COutput { * \param[in] iPoint - Index of the point. */ void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; - + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -94,6 +94,6 @@ class CAdjHeatOutput final: public COutput { * \param[in] iMarker - Index of the surface marker. * \param[in] iVertex - Index of the vertex on the marker. */ - void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, - unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; + void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, + unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; }; diff --git a/SU2_CFD/include/output/CElasticityOutput.hpp b/SU2_CFD/include/output/CElasticityOutput.hpp index 5d7d5450949..fdeadbbeb30 100644 --- a/SU2_CFD/include/output/CElasticityOutput.hpp +++ b/SU2_CFD/include/output/CElasticityOutput.hpp @@ -51,7 +51,7 @@ class CElasticityOutput final: public COutput { bool linear_analysis, //!< Boolean indicating a linear analysis nonlinear_analysis, //!< Boolean indicating a nonlinear analysis dynamic; //!< Boolean indicating a dynamic analysis - + public: /*! @@ -82,7 +82,7 @@ class CElasticityOutput final: public COutput { * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -91,7 +91,7 @@ class CElasticityOutput final: public COutput { * \param[in] iPoint - Index of the point. */ void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; - + /*! * \brief Check whether the base values for relative residuals should be initialized * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/CFlowCompFEMOutput.hpp b/SU2_CFD/include/output/CFlowCompFEMOutput.hpp index 5195a1be62f..5856ac22511 100644 --- a/SU2_CFD/include/output/CFlowCompFEMOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompFEMOutput.hpp @@ -48,7 +48,7 @@ class CVariable; */ class CFlowCompFEMOutput final: public CFlowOutput { private: - + unsigned short nVar; //!< Number of variables unsigned short turb_model; //!< Kind of turbulence model @@ -70,7 +70,7 @@ class CFlowCompFEMOutput final: public CFlowOutput { * \param[in] config - Definition of the particular problem. */ void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override; - + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -80,15 +80,15 @@ class CFlowCompFEMOutput final: public CFlowOutput { * \param[in] iMarker - Index of the surface marker. * \param[in] iVertex - Index of the vertex on the marker. */ - void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, - unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; - + void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, + unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -98,27 +98,27 @@ class CFlowCompFEMOutput final: public CFlowOutput { * \param[in] index - Index of the value. * \param[in] dof - Index of the local degree of freedom. */ - void LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, CSolver **solver, + void LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iElem, unsigned long index, unsigned short dof) override; - + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - + /*! * \brief Check whether the base values for relative residuals should be initialized * \param[in] config - Definition of the particular problem. * \return if the residuals should be initialized. */ bool SetInit_Residuals(CConfig *config) override; - + /*! * \brief Check whether the averaged values should be updated * \param[in] config - Definition of the particular problem. * \return averages should be updated. */ bool SetUpdate_Averages(CConfig *config) override; - + }; diff --git a/SU2_CFD/include/output/CFlowCompOutput.hpp b/SU2_CFD/include/output/CFlowCompOutput.hpp index 44ba12a9f41..3cf30f828df 100644 --- a/SU2_CFD/include/output/CFlowCompOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompOutput.hpp @@ -48,10 +48,10 @@ class CVariable; */ class CFlowCompOutput final: public CFlowOutput { private: - + unsigned short turb_model; //!< Kind of turbulence model unsigned long lastInnerIter; - + public: /*! @@ -65,13 +65,13 @@ class CFlowCompOutput final: public CFlowOutput { */ ~CFlowCompOutput(void) override; - + /*! * \brief Load the history output field values * \param[in] config - Definition of the particular problem. */ void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override; - + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -81,15 +81,15 @@ class CFlowCompOutput final: public CFlowOutput { * \param[in] iMarker - Index of the surface marker. * \param[in] iVertex - Index of the vertex on the marker. */ - void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, - unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; - + void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, + unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -97,21 +97,21 @@ class CFlowCompOutput final: public CFlowOutput { * \param[in] solver - The container holding all solution data. * \param[in] iPoint - Index of the point. */ - void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; - + void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - + /*! * \brief Check whether the base values for relative residuals should be initialized * \param[in] config - Definition of the particular problem. * \return if the residuals should be initialized. */ bool SetInit_Residuals(CConfig *config) override; - + /*! * \brief Check whether the averaged values should be updated * \param[in] config - Definition of the particular problem. @@ -130,7 +130,7 @@ class CFlowCompOutput final: public CFlowOutput { * \param[in] config - Definition of the particular problem per zone. */ void SetFixedCLScreenOutput(CConfig *config); - + /*! * \brief Determines if the history file output. * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/CFlowIncOutput.hpp b/SU2_CFD/include/output/CFlowIncOutput.hpp index 153dd8ce2e3..ea11936e059 100644 --- a/SU2_CFD/include/output/CFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CFlowIncOutput.hpp @@ -49,9 +49,9 @@ class CVariable; class CFlowIncOutput final: public CFlowOutput { private: - unsigned short turb_model; /*!< \brief The kind of turbulence model*/ - bool heat, /*!< \brief Boolean indicating whether have a heat problem*/ - weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ + unsigned short turb_model; /*!< \brief The kind of turbulence model*/ + bool heat, /*!< \brief Boolean indicating whether have a heat problem*/ + weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ public: @@ -71,7 +71,7 @@ class CFlowIncOutput final: public CFlowOutput { * \param[in] config - Definition of the particular problem. */ void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override; - + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -81,15 +81,15 @@ class CFlowIncOutput final: public CFlowOutput { * \param[in] iMarker - Index of the surface marker. * \param[in] iVertex - Index of the vertex on the marker. */ - void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, - unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; - + void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, + unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override; + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -97,21 +97,21 @@ class CFlowIncOutput final: public CFlowOutput { * \param[in] solver - The container holding all solution data. * \param[in] iPoint - Index of the point. */ - void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; - + void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. */ void SetHistoryOutputFields(CConfig *config) override; - + /*! * \brief Check whether the base values for relative residuals should be initialized * \param[in] config - Definition of the particular problem. * \return if the residuals should be initialized. */ bool SetInit_Residuals(CConfig *config) override; - + /*! * \brief Check whether the averaged values should be updated * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index 79f495fe5ae..7290f352cd6 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -59,7 +59,7 @@ class CFlowOutput : public COutput{ * \param[in] config - Definition of the particular problem. */ void AddAnalyzeSurfaceOutput(CConfig *config); - + /*! * \brief Set flow surface output field values * \param[in] solver - The container holding all solution data. @@ -68,26 +68,26 @@ class CFlowOutput : public COutput{ * \param[in] output - Boolean indicating whether information should be written to screen */ void SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfig *config, bool output); - + /*! * \brief Add aerodynamic coefficients as output fields * \param[in] config - Definition of the particular problem. */ void AddAerodynamicCoefficients(CConfig *config); - + /*! - * \brief Set the value of the aerodynamic coefficients + * \brief Set the value of the aerodynamic coefficients * \param[in] config - Definition of the particular problem. * \param[in] flow_solver - The container holding all solution data. */ void SetAerodynamicCoefficients(CConfig *config, CSolver *flow_solver); - + /*! * \brief Add CP inverse design output as history fields * \param[in] config - Definition of the particular problem. */ void Add_CpInverseDesignOutput(CConfig *config); - + /*! * \brief Set CP inverse design output field values * \param[in] solver - The container holding all solution data. @@ -95,20 +95,20 @@ class CFlowOutput : public COutput{ * \param[in] config - Definition of the particular problem. */ 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] config - Definition of the particular problem per zone. */ void WriteMetaData(CConfig *config); - + /*! * \brief Write any additional files defined for the current solver. * \param[in] config - Definition of the particular problem per zone. @@ -116,7 +116,7 @@ class CFlowOutput : public COutput{ * \param[in] solver_container - The container holding all solution data. */ void WriteAdditionalFiles(CConfig *config, CGeometry *geometry, CSolver **solver_container) override; - + /*! * \brief Determines if the the volume output should be written. * \param[in] config - Definition of the particular problem. @@ -124,7 +124,7 @@ class CFlowOutput : public COutput{ * \param[in] force_writing - boolean that forces writing of volume output */ bool WriteVolume_Output(CConfig *config, unsigned long Iter, bool force_writing) override; - + /*! * \brief Write the forces breakdown file * \param[in] config - Definition of the particular problem per zone. @@ -132,12 +132,12 @@ class CFlowOutput : public COutput{ * \param[in] solver_container - The container holding all solution data. */ void WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSolver **solver_container); - + /*! * \brief Set the time averaged output fields. */ void SetTimeAveragedFields(); - + /*! * \brief Load the time averaged output fields. * \param iPoint diff --git a/SU2_CFD/include/output/CHeatOutput.hpp b/SU2_CFD/include/output/CHeatOutput.hpp index 81cad15dcd5..a6edc9a80bf 100644 --- a/SU2_CFD/include/output/CHeatOutput.hpp +++ b/SU2_CFD/include/output/CHeatOutput.hpp @@ -58,7 +58,7 @@ class CHeatOutput final: public COutput { * \brief Destructor of the class. */ ~CHeatOutput(void) override; - + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. @@ -70,13 +70,13 @@ class CHeatOutput final: public COutput { * \param[in] config - Definition of the particular problem. */ void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override; - + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. */ void SetVolumeOutputFields(CConfig *config) override; - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -84,7 +84,7 @@ class CHeatOutput final: public COutput { * \param[in] solver - The container holding all solution data. * \param[in] iPoint - Index of the point. */ - void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; + void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; /*! * \brief LoadSurfaceData diff --git a/SU2_CFD/include/output/CMeshOutput.hpp b/SU2_CFD/include/output/CMeshOutput.hpp index 8d2124f0d3b..feb15ceb95e 100644 --- a/SU2_CFD/include/output/CMeshOutput.hpp +++ b/SU2_CFD/include/output/CMeshOutput.hpp @@ -72,6 +72,6 @@ class CMeshOutput final: public COutput { * \param[in] solver - The container holding all solution data. * \param[in] iPoint - Index of the point. */ - void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; + void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint) override; }; diff --git a/SU2_CFD/include/output/CMultizoneOutput.hpp b/SU2_CFD/include/output/CMultizoneOutput.hpp index 754d57b830d..42cefe61681 100644 --- a/SU2_CFD/include/output/CMultizoneOutput.hpp +++ b/SU2_CFD/include/output/CMultizoneOutput.hpp @@ -64,10 +64,10 @@ class CMultizoneOutput final: public COutput { protected: unsigned short nZone; //!< Number of zones - + string bgs_res_name; //!< Block-Gauss seidel residual name bool write_zone; //!< Boolean indicating whether the individual zones write to screen - + public: /*! @@ -82,14 +82,14 @@ class CMultizoneOutput final: public COutput { /*! * \brief Load the multizone history output field values - * \param[in] output - Container holding the output instances per zone. + * \param[in] output - Container holding the output instances per zone. * \param[in] config - Definition of the particular problem. */ void LoadMultizoneHistoryData(COutput **output, CConfig **config) override; /*! * \brief Set the available multizone history output fields - * \param[in] output - Container holding the output instances per zone. + * \param[in] output - Container holding the output instances per zone. * \param[in] config - Definition of the particular problem per zone. */ void SetMultizoneHistoryOutputFields(COutput **output, CConfig **config) override; @@ -99,13 +99,13 @@ class CMultizoneOutput final: public COutput { * \param[in] config - Definition of the particular problem. */ bool WriteHistoryFile_Output(CConfig *config) override; - + /*! * \brief Determines if the screen header should be written. * \param[in] config - Definition of the particular problem. */ bool WriteScreen_Header(CConfig *config) override; - + /*! * \brief Determines if the screen header should be written. * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 2ecb3b9459f..25ae5a20389 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -58,80 +58,80 @@ class CConfig; using namespace std; -/*! +/*! * \class COutput * \brief Class for writing the convergence history and to write solution data to file. * \author T.Albring */ class COutput { protected: - - /*----------------------------- General ----------------------------*/ - + + /*----------------------------- General ----------------------------*/ + int rank, /*!< \brief MPI Rank. */ size; /*!< \brief MPI Size. */ - unsigned short nDim; /*!< \brief Physical Dimension */ - - bool multiZone, /*!< \brief Boolean to store whether we are running a multizone problem */ - gridMovement, /*!< \brief Boolean to store whether we have grid movement enabled */ - femOutput; /*!< \brief Boolean to store whether we should use the FEM routines */ - - /*----------------------------- Screen and history output ----------------------------*/ - - string historySep; /*!< \brief Character which separates values in the history file */ + unsigned short nDim; /*!< \brief Physical Dimension */ + + bool multiZone, /*!< \brief Boolean to store whether we are running a multizone problem */ + gridMovement, /*!< \brief Boolean to store whether we have grid movement enabled */ + femOutput; /*!< \brief Boolean to store whether we should use the FEM routines */ + + /*----------------------------- Screen and history output ----------------------------*/ + + string historySep; /*!< \brief Character which separates values in the history file */ unsigned short fieldWidth; /*!< \brief Width of each column for the screen output (hardcoded for now) */ bool noWriting; /*!< \brief Boolean indicating whether a screen/history output should be written */ unsigned long curTimeIter, /*!< \brief Current value of the time iteration index */ - curAbsTimeIter, /*!< \brief Current value of the time iteration index */ + curAbsTimeIter, /*!< \brief Current value of the time iteration index */ curOuterIter, /*!< \brief Current value of the outer iteration index */ curInnerIter; /*!< \brief Current value of the inner iteration index */ - + 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; - + /** \brief Enum to identify the screen output format. */ - enum class ScreenOutputFormat { + enum class ScreenOutputFormat { INTEGER, /*!< \brief Integer format. Example: 34 */ FIXED, /*!< \brief Format with fixed precision for floating point values. Example: 344.54 */ - SCIENTIFIC /*!< \brief Scientific format for floating point values. Example: 3.4454E02 */ + SCIENTIFIC /*!< \brief Scientific format for floating point values. Example: 3.4454E02 */ }; - - /** \brief Enum to identify the screen/history field type. */ - enum class HistoryFieldType { + + /** \brief Enum to identify the screen/history field type. */ + enum class HistoryFieldType { RESIDUAL, /*!< \brief A user-defined residual field type*/ AUTO_RESIDUAL, /*!< \brief An automatically generated residual field type */ COEFFICIENT, /*!< \brief User defined coefficient field type */ AUTO_COEFFICIENT, /*!< \brief Automatically generated coefficient field type */ - DEFAULT /*!< \brief Default field type */ + DEFAULT /*!< \brief Default field type */ }; - + /** \brief Structure to store information for a history output field. - * - * The stored information is printed to the history file and to screen. - * Each individual instance represents a single field (i.e. column) in the history file or on screen. + * + * The stored information is printed to the history file and to screen. + * Each individual instance represents a single field (i.e. column) in the history file or on screen. */ struct HistoryOutputField { /*! \brief The name of the field, i.e. the name that is printed in the screen or file header.*/ - string fieldName = ""; + string fieldName = ""; /*! \brief The value of the field. */ su2double value = 0.0; /*! \brief The format that is used to print this value to screen. */ - ScreenOutputFormat screenFormat = ScreenOutputFormat::FIXED; + ScreenOutputFormat screenFormat = ScreenOutputFormat::FIXED; /*! \brief The group this field belongs to. */ - string outputGroup =""; + string outputGroup =""; /*! \brief The field type*/ HistoryFieldType fieldType = HistoryFieldType::DEFAULT; /*! \brief String containing the description of the field */ string description = ""; /*! \brief Default constructor. */ - HistoryOutputField() {} + HistoryOutputField() {} /*! \brief Constructor to initialize all members. */ - HistoryOutputField(string fieldName_, ScreenOutputFormat screenFormat_, string OutputGroup_, + HistoryOutputField(string fieldName_, ScreenOutputFormat screenFormat_, string OutputGroup_, HistoryFieldType fieldType_, string description_): fieldName(std::move(fieldName_)), value(0.0), screenFormat(screenFormat_), outputGroup(std::move(OutputGroup_)), fieldType(fieldType_), description(std::move(description_)){} @@ -140,19 +140,19 @@ class COutput { /*! \brief Associative map to access data stored in the history output fields by a string identifier. */ std::map historyOutput_Map; /*! \brief Vector that contains the keys of the ::historyOutput_Map in the order of their insertion. */ - std::vector historyOutput_List; + std::vector historyOutput_List; /*! \brief Associative map to access data stored in the history per surface output fields by a string identifier. */ - std::map > historyOutputPerSurface_Map; + std::map > historyOutputPerSurface_Map; /*! \brief Vector that contains the keys of the ::historyOutputPerSurface_Map in the order of their insertion. */ - std::vector historyOutputPerSurface_List; + std::vector historyOutputPerSurface_List; - /*! \brief Requested history field names in the config file. */ + /*! \brief Requested history field names in the config file. */ std::vector requestedHistoryFields; - /*! \brief Number of requested history field names in the config file. */ + /*! \brief Number of requested history field names in the config file. */ unsigned short nRequestedHistoryFields; - /*! \brief Requested screen field names in the config file. */ + /*! \brief Requested screen field names in the config file. */ std::vector requestedScreenFields; - /*! \brief Number of requested screen field names in the config file. */ + /*! \brief Number of requested screen field names in the config file. */ unsigned short nRequestedScreenFields; PrintingToolbox::CTablePrinter* convergenceTable; //!< Convergence output table structure @@ -161,93 +161,93 @@ class COutput { PrintingToolbox::CTablePrinter* fileWritingTable; //!< File writing header std::string multiZoneHeaderString; //!< Multizone header string bool headerNeeded; //!< Boolean that stores whether a screen header is needed - + //! Structure to store the value of the running averages - map runningAverages; - + map runningAverages; + //! Structure to store the value initial residuals for relative residual computation std::map initialResiduals; - - /*----------------------------- Volume output ----------------------------*/ - + + /*----------------------------- Volume output ----------------------------*/ + CParallelDataSorter* volumeDataSorter; //!< Volume data sorter CParallelDataSorter* surfaceDataSorter; //!< Surface data sorter - + vector volumeFieldNames; //!< Vector containing the volume field names - unsigned short nVolumeFields; /*!< \brief Number of fields in the volume output */ - + unsigned short nVolumeFields; /*!< \brief Number of fields in the volume output */ + string volumeFilename, //!< Volume output filename surfaceFilename, //!< Surface output filename restartFilename; //!< Restart output filename - + /** \brief Structure to store information for a volume output field. - * - * The stored information is used to create the volume solution file. + * + * The stored information is used to create the volume solution file. */ struct VolumeOutputField { /*! \brief The name of the field, i.e. the name that is printed in the file header.*/ string fieldName; /*! \brief This value identifies the position of the values of this field at each node in the ::Local_Data array. */ - short offset; + short offset; /*! \brief The group this field belongs to. */ string outputGroup; /*! \brief String containing the description of the field */ string description; /*! \brief Default constructor. */ VolumeOutputField () {} - /*! \brief Constructor to initialize all members. */ + /*! \brief Constructor to initialize all members. */ VolumeOutputField(string fieldName_, int offset_, string volumeOutputGroup_, string description_): - fieldName(std::move(fieldName_)), offset(std::move(offset_)), + fieldName(std::move(fieldName_)), offset(std::move(offset_)), outputGroup(std::move(volumeOutputGroup_)), description(std::move(description_)){} }; - - /*! \brief Associative map to access data stored in the volume output fields by a string identifier. */ + + /*! \brief Associative map to access data stored in the volume output fields by a string identifier. */ std::map volumeOutput_Map; - /*! \brief Vector that contains the keys of the ::volumeOutput_Map in the order of their insertion. */ + /*! \brief Vector that contains the keys of the ::volumeOutput_Map in the order of their insertion. */ std::vector volumeOutput_List; - + /*! \brief Vector to cache the positions of the field in the data array */ std::vector fieldIndexCache; - /*! \brief Current value of the cache index */ + /*! \brief Current value of the cache index */ unsigned short cachePosition; - /*! \brief Boolean to store whether the field index cache should be build. */ + /*! \brief Boolean to store whether the field index cache should be build. */ bool buildFieldIndexCache; /*! \brief Vector to cache the positions of the field in the data array */ std::vector fieldGetIndexCache; - /*! \brief Current value of the cache index */ + /*! \brief Current value of the cache index */ unsigned short curGetFieldIndex; - /*! \brief Requested volume field names in the config file. */ + /*! \brief Requested volume field names in the config file. */ std::vector requestedVolumeFields; - /*! \brief Number of requested volume field names in the config file. */ + /*! \brief Number of requested volume field names in the config file. */ unsigned short nRequestedVolumeFields; - - /*----------------------------- Convergence monitoring ----------------------------*/ + + /*----------------------------- Convergence monitoring ----------------------------*/ su2double cauchyValue, /*!< \brief Summed value of the convergence indicator. */ cauchyFunc; /*!< \brief Current value of the convergence indicator at one iteration. */ unsigned short Cauchy_Counter; /*!< \brief Number of elements of the Cauchy serial. */ vector> cauchySerie; /*!< \brief Complete Cauchy serial. */ - unsigned long nCauchy_Elems; /*!< \brief Total number of cauchy elems to monitor */ - su2double cauchyEps; /*!< \brief Defines the threshold when to stop the solver. */ - su2double minLogResidual; /*!< \brief Minimum value of the residual to reach */ + unsigned long nCauchy_Elems; /*!< \brief Total number of cauchy elems to monitor */ + su2double cauchyEps; /*!< \brief Defines the threshold when to stop the solver. */ + su2double minLogResidual; /*!< \brief Minimum value of the residual to reach */ vector oldFunc, /*!< \brief Old value of the coefficient. */ newFunc; /*!< \brief Current value of the coefficient. */ bool convergence; /*!< \brief To indicate if the solver has converged or not. */ su2double initResidual; /*!< \brief Initial value of the residual to evaluate the convergence level. */ vector convFields; /*!< \brief Name of the field to be monitored for convergence */ - - /*----------------------------- Adaptive CFL ----------------------------*/ - + + /*----------------------------- Adaptive CFL ----------------------------*/ + su2double rhoResNew, /*!< New value of the residual for adaptive CFL routine */ rhoResOld; /*!< Old value of the residual for adaptive CFL routine */ - + public: - + /*----------------------------- Public member functions ----------------------------*/ - - /*! - * \brief Constructor of the class. + + /*! + * \brief Constructor of the class. */ COutput(CConfig *config, unsigned short nDim, bool femOutput); @@ -255,32 +255,32 @@ class COutput { * \brief Preprocess the volume output by setting the requested volume output fields. * \param[in] config - Definition of the particular problem. */ - void PreprocessVolumeOutput(CConfig *config); - + void PreprocessVolumeOutput(CConfig *config); + /*! * \brief Load the data from the solvers into the data sorters and sort it for the linear partitioning. - * + * * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. * \param[in] solver_container - The container holding all solution data. */ void Load_Data(CGeometry *geometry, CConfig *config, CSolver **solver_container); - + /*! * \brief Preprocess the history output by setting the history fields and opening the history file. * \param[in] config - Definition of the particular problem. * \param[in] wrt - If prepares history file for writing. */ - void PreprocessHistoryOutput(CConfig *config, bool wrt = true); - + void PreprocessHistoryOutput(CConfig *config, bool wrt = true); + /*! * \brief Preprocess the history output by setting the history fields and opening the history file. - * \param[in] output - Container holding the output instances per zone. + * \param[in] output - Container holding the output instances per zone. * \param[in] config - Definition of the particular problem per zone. * \param[in] wrt - If prepares history file for writing. */ - void PreprocessMultizoneHistoryOutput(COutput **output, CConfig **config, CConfig *driver_config, bool wrt = true); - + void PreprocessMultizoneHistoryOutput(COutput **output, CConfig **config, CConfig *driver_config, bool wrt = true); + /*! * \brief Collects history data from the solvers, monitors the convergence and writes to screen and history file. * \param[in] geometry - Geometrical definition of the problem. @@ -291,73 +291,73 @@ class COutput { * \param[in] InnerIter - Value of the inner iteration index */ void SetHistory_Output(CGeometry *geometry, CSolver **solver_container, CConfig *config, - unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter); - + unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter); + /*! * \brief Collects history data from the solvers and monitors the convergence. Does not write to screen or file. * \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 SetHistory_Output(CGeometry *geometry, CSolver **solver_container, CConfig *config); - + void SetHistory_Output(CGeometry *geometry, CSolver **solver_container, CConfig *config); + /*! * Collects history data from the individual output per zone, * monitors the convergence and writes to screen and history file. - - * \param[in] output - Container holding the output instances per zone. + + * \param[in] output - Container holding the output instances per zone. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem per zone. * \param[in] driver_config - Base definition of the particular problem. * \param[in] TimeIter - Value of the time iteration index * \param[in] OuterIter - Value of outer iteration index */ - void SetMultizoneHistory_Output(COutput** output, CConfig **config, CConfig *driver_config, + void SetMultizoneHistory_Output(COutput** output, CConfig **config, CConfig *driver_config, unsigned long TimeIter, unsigned long OuterIter); - + /*! * \brief Sets the volume output filename * \param[in] filename - the new filename */ inline void SetVolume_Filename(string filename) {volumeFilename = filename;} - + /*! * \brief Sets the surface output filename * \param[in] filename - the new filename */ inline void SetSurface_Filename(string filename) {surfaceFilename = filename;} - + /*! * \brief Returns the current volume filename * \return - The current volume filename */ inline string GetVolume_Filename() {return volumeFilename;} - + /*! * \brief Returns the current surface filename * \return - The current surface filename */ inline string GetSurface_Filename() {return surfaceFilename;} - + /*! * \brief Sets the restart filename * \param[in] filename - the new filename */ inline void SetRestart_Filename(string filename) {restartFilename = filename;} - + /*! * \brief Returns the current restart filename * \return - The current restart filename */ inline string GetRestart_Filename() {return restartFilename;} - + /*! * \brief Set the CFL number based on the current residuals * \param[in] solver_container - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - void SetCFL_Number(CSolver ****solver_container, CConfig *config); - + void SetCFL_Number(CSolver ****solver_container, CConfig *config); + /*! * \brief Set the current iteration indices * \param[in] TimeIter - Timer iteration index @@ -369,7 +369,7 @@ class COutput { curOuterIter = OuterIter; curInnerIter = InnerIter; } - + /*! * \brief Get the value of particular history output field * \param[in] field - Name of the field @@ -382,22 +382,22 @@ class COutput { su2double GetHistoryFieldValuePerSurface(string field, unsigned short iMarker){ return historyOutputPerSurface_Map[field][iMarker].value; } - + /*! * \brief Get a vector with all output fields in a particular group * \param groupname - Name of the history group - * \return Vector containing all output fields of a group + * \return Vector containing all output fields of a group */ vector GetHistoryGroup(string groupname){ - vector HistoryGroup; - for (unsigned short iField = 0; iField < historyOutput_Map.size(); iField++){ + vector HistoryGroup; + for (unsigned short iField = 0; iField < historyOutput_Map.size(); iField++){ if (historyOutput_Map[historyOutput_List[iField]].outputGroup == groupname){ HistoryGroup.push_back((historyOutput_Map[historyOutput_List[iField]])); } } return HistoryGroup; } - + /*! * \brief Get the list of all output fields * \return Vector container all output fields @@ -405,7 +405,7 @@ class COutput { vector GetHistoryOutput_List(){ return historyOutput_List; } - + /*! * \brief Get the map containing all output fields * \return Map containing all output fields @@ -413,7 +413,7 @@ class COutput { map GetHistoryFields(){ return historyOutput_Map; } - + /*! * \brief Monitor the convergence of an output field * \param[in] config - Definition of the particular problem. @@ -426,7 +426,7 @@ class COutput { * \brief Print a summary of the convergence to screen. */ void PrintConvergenceSummary(); - + /*! * \brief Get convergence of the problem. * \return Boolean indicating whether the problem is converged. @@ -438,17 +438,17 @@ class COutput { * \param[in] conv - New value of the convergence flag. */ void SetConvergence(bool conv) {convergence = conv;} - + /*! * \brief Print a list of all history output fields to screen. */ void PrintHistoryFields(); - + /*! * \brief Print a list of all volume output fields to screen. */ void PrintVolumeFields(); - + /*! * \brief Loop through all requested output files and write the volume output data. * \param[in] geometry - Geometrical definition of the problem. @@ -460,7 +460,7 @@ class COutput { */ bool SetResult_Files(CGeometry *geometry, CConfig *config, CSolver** solver_container, unsigned long iter, bool force_writing = false); - + /*! * \brief Allocates the appropriate file writer based on the chosen format and writes sorted data to file. * \param[in] config - Definition of the particular problem. @@ -468,11 +468,11 @@ class COutput { * \param[in] format - The output format. * \param[in] fileName - The file name. If empty, the filenames are automatically determined. */ - void WriteToFile(CConfig *config, CGeometry *geomery, unsigned short format, string fileName = ""); - + void WriteToFile(CConfig *config, CGeometry *geomery, unsigned short format, string fileName = ""); + protected: - - /*----------------------------- Protected member functions ----------------------------*/ + + /*----------------------------- Protected member functions ----------------------------*/ /*! * \brief Set the history file header @@ -509,12 +509,12 @@ class COutput { * \param[in] field_type - The type of the field (::HistoryFieldType). */ inline void AddHistoryOutput(string name, string field_name, ScreenOutputFormat format, - string groupname, string description, + string groupname, string description, HistoryFieldType field_type = HistoryFieldType::DEFAULT ){ historyOutput_Map[name] = HistoryOutputField(field_name, format, groupname, field_type, description); historyOutput_List.push_back(name); } - + /*! * \brief Set the value of a history output field * \param[in] name - Name of the field. @@ -527,7 +527,7 @@ class COutput { SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); } } - + /*! * \brief Add a new field per surface marker to the history output. * \param[in] name - Name for referencing it (in the config file and in the code). @@ -537,8 +537,8 @@ class COutput { * \param[in] marker_names - A list of markers. For every marker in this list a new field is created with "field_name + _marker_names[i]". * \param[in] field_type - The type of the field (::HistoryFieldType). */ - inline void AddHistoryOutputPerSurface(string name, string field_name, ScreenOutputFormat format, - string groupname, vector marker_names, + inline void AddHistoryOutputPerSurface(string name, string field_name, ScreenOutputFormat format, + string groupname, vector marker_names, HistoryFieldType field_type = HistoryFieldType::DEFAULT){ if (marker_names.size() != 0){ historyOutputPerSurface_List.push_back(name); @@ -547,7 +547,7 @@ class COutput { } } } - + /*! * \brief Set the value of a history output field for a specific surface marker * \param[in] name - Name of the field. @@ -561,7 +561,7 @@ class COutput { SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); } } - + /*! * \brief Add a new field to the volume output. * \param[in] name - Name for referencing it (in the config file and in the code). @@ -573,15 +573,15 @@ class COutput { volumeOutput_Map[name] = VolumeOutputField(field_name, -1, groupname, description); volumeOutput_List.push_back(name); } - - + + /*! * \brief Set the value of a volume output field * \param[in] name - Name of the field. * \param[in] value - The new value of this field. */ su2double GetVolumeOutputValue(string name, unsigned long iPoint); - + /*! * \brief Set the value of a volume output field * \param[in] name - Name of the field. @@ -595,12 +595,12 @@ class COutput { * \param[in] value - The new value of this field. */ void SetAvgVolumeOutputValue(string name, unsigned long iPoint, su2double value); - + /*! * \brief CheckHistoryOutput */ void CheckHistoryOutput(); - + /*! * \brief Open the history file and write the header. * \param[in] config - Definition of the particular problem. @@ -608,13 +608,13 @@ class COutput { void PrepareHistoryFile(CConfig *config); /*! - * \brief Load up the values of the requested volume fields into ::Local_Data array. + * \brief Load up the values of the requested volume fields into ::Local_Data array. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. * \param[in] solver_container - The container holding all solution data. */ void LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver** solver); - + /*! * \brief Postprocess_HistoryData * \param[in] config - Definition of the particular problem. @@ -626,7 +626,7 @@ class COutput { * \param[in] config - Definition of the particular problem. */ void Postprocess_HistoryFields(CConfig *config); - + /*! * \brief Check whether we should print output. * \param[in] iIter - Current iteration. @@ -636,51 +636,51 @@ class COutput { if (iFreq == 0){ return false; } - + return (iIter % iFreq == 0); - } - + } + /*! * \brief Set the history fields common for all solvers. * \param[in] config - Definition of the particular problem. */ void SetCommonHistoryFields(CConfig *config); - + /*! * \brief Load values of the history fields common for all solvers. * \param[in] config - Definition of the particular problem. */ void LoadCommonHistoryData(CConfig *config); - + /*! * \brief Allocates the data sorters if necessary. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. */ void AllocateDataSorters(CConfig *config, CGeometry *geometry); - + /*--------------------------------- Virtual functions ---------------------------------------- */ public: - - /*! - * \brief Destructor of the class. + + /*! + * \brief Destructor of the class. */ - virtual ~COutput(void); + virtual ~COutput(void); protected: - + /*! * \brief Determines if the history file output. * \param[in] config - Definition of the particular problem. */ virtual bool WriteHistoryFile_Output(CConfig *config); - + /*! * \brief Determines if the screen header should be written. * \param[in] config - Definition of the particular problem. */ virtual bool WriteScreen_Header(CConfig *config); - + /*! * \brief Determines if the screen header should be written. * \param[in] config - Definition of the particular problem. @@ -694,7 +694,7 @@ class COutput { * \param[in] force_writing - boolean that forces writing of volume output */ virtual bool WriteVolume_Output(CConfig *config, unsigned long Iter, bool force_writing); - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -703,7 +703,7 @@ class COutput { * \param[in] iPoint - Index of the point. */ inline virtual void LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){} - + /*! * \brief Set the values of the volume output fields for a point. * \param[in] config - Definition of the particular problem. @@ -713,23 +713,23 @@ class COutput { * \param[in] index - Index of the value. * \param[in] dof - Index of the local degree of freedom. */ - inline virtual void LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, CSolver **solver, - unsigned long iElem, unsigned long index, unsigned short dof){} - + inline virtual void LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, CSolver **solver, + unsigned long iElem, unsigned long index, unsigned short dof){} + /*! * \brief Check whether the base values for relative residuals should be initialized * \param[in] config - Definition of the particular problem. * \return if the residuals should be initialized. */ inline virtual bool SetInit_Residuals(CConfig *config) {return false;} - + /*! * \brief Check whether the averaged values should be updated * \param[in] config - Definition of the particular problem. * \return averages should be updated. */ inline virtual bool SetUpdate_Averages(CConfig *config){return false;} - + /*! * \brief Set the values of the volume output fields for a surface point. * \param[in] config - Definition of the particular problem. @@ -741,7 +741,7 @@ class COutput { */ inline virtual void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){} - + /*! * \brief Set the available volume output fields * \param[in] config - Definition of the particular problem. @@ -757,24 +757,24 @@ class COutput { /*! * \brief Load the multizone history output field values - * \param[in] output - Container holding the output instances per zone. + * \param[in] output - Container holding the output instances per zone. * \param[in] config - Definition of the particular problem. */ - inline virtual void LoadMultizoneHistoryData(COutput **output, CConfig **config) {} - + inline virtual void LoadMultizoneHistoryData(COutput **output, CConfig **config) {} + /*! * \brief Set the available history output fields * \param[in] config - Definition of the particular problem. */ inline virtual void SetHistoryOutputFields(CConfig *config) {} - + /*! * \brief Set the available multizone history output fields - * \param[in] output - Container holding the output instances per zone. + * \param[in] output - Container holding the output instances per zone. * \param[in] config - Definition of the particular problem per zone. */ inline virtual void SetMultizoneHistoryOutputFields(COutput **output, CConfig **config) {} - + /*! * \brief Write any additional files defined for the current solver. * \param[in] config - Definition of the particular problem per zone. diff --git a/SU2_CFD/include/output/COutputLegacy.hpp b/SU2_CFD/include/output/COutputLegacy.hpp index d430ee5373e..3002d9e2e80 100644 --- a/SU2_CFD/include/output/COutputLegacy.hpp +++ b/SU2_CFD/include/output/COutputLegacy.hpp @@ -66,9 +66,9 @@ class CIntegration; using namespace std; -/*! +/*! * \class COutputLegacy - * \brief Class for writing the flow, adjoint and linearized solver + * \brief Class for writing the flow, adjoint and linearized solver * solution (including the history solution, and parallel stuff). * \author F. Palacios, T. Economon, M. Colonno. */ @@ -98,8 +98,8 @@ class COutputLegacy { int *Conn_Hexa; int *Conn_Pris; int *Conn_Pyra; - - + + unsigned long nGlobal_Poin_Par; // Global number of nodes with halos unsigned long nGlobal_Elem_Par; // Global number of elems without halos unsigned long nGlobal_Surf_Poin; @@ -135,7 +135,7 @@ class COutputLegacy { unsigned long *nPointLinear; unsigned long *nPointCumulative; - + unsigned short nVar_Par; su2double **Local_Data; su2double **Local_Data_Copy; // Local data copy for cte. lift mode @@ -149,11 +149,11 @@ class COutputLegacy { unsigned short wrote_base_file; su2double RhoRes_New, *RhoRes_Old; int cgns_base, cgns_zone, cgns_base_results, cgns_zone_results; - + su2double Sum_Total_RadialDistortion, Sum_Total_CircumferentialDistortion; // Add all the distortion to compute a run average. bool turbo; unsigned short nSpanWiseSections, - nMarkerTurboPerf; + nMarkerTurboPerf; su2double **TotalStaticEfficiency, **TotalTotalEfficiency, @@ -213,22 +213,22 @@ class COutputLegacy { protected: - int rank, /*!< \brief MPI Rank. */ - size; /*!< \brief MPI Size. */ + int rank, /*!< \brief MPI Rank. */ + size; /*!< \brief MPI Size. */ public: - /*! - * \brief Constructor of the class. + /*! + * \brief Constructor of the class. */ COutputLegacy(CConfig *congig); - /*! - * \brief Destructor of the class. + /*! + * \brief Destructor of the class. */ ~COutputLegacy(void); - /*! + /*! * \brief Writes and organizes the all the output files, except the history one, for serial computations. * \param[in] solver_container - Container vector with all the solutions. * \param[in] geometry - Geometrical definition of the problem. @@ -239,7 +239,7 @@ class COutputLegacy { */ void SetResult_Files(CSolver *****solver_container, CGeometry ****geometry, CConfig **config, unsigned long iExtIter, unsigned short val_nZone); - + /*! * \brief Writes and organizes the all the output files, except the history one, for serial computations with the FEM solver. * \param[in] solver_container - Container vector with all the solutions. @@ -251,7 +251,7 @@ class COutputLegacy { */ void SetResult_Files_FEM(CSolver ****solver_container, CGeometry ***geometry, CConfig **config, unsigned long iExtIter, unsigned short val_nZone); - + /*! * \brief Writes and organizes the all the output files, except the history one, for serial computations. * \param[in] solver_container - Container vector with all the solutions. @@ -292,7 +292,7 @@ class COutputLegacy { * \param[in] output - Create output files. */ void SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry, CConfig *config, bool output); - + /*! * \brief Writes inverse design. * \param[in] solver_container - Container vector with all the solutions. @@ -302,7 +302,7 @@ class COutputLegacy { */ void SetCp_InverseDesign(CSolver *solver_container, CGeometry *geometry, CConfig *config, unsigned long iExtIter); - + /*! * \brief Writes inverse design. * \param[in] solver_container - Container vector with all the solutions. @@ -312,7 +312,7 @@ class COutputLegacy { */ void SetHeatFlux_InverseDesign(CSolver *solver_container, CGeometry *geometry, CConfig *config, unsigned long iExtIter); - + /*! * \brief Writes forces at different sections. * \param[in] solver_container - Container vector with all the solutions. @@ -321,7 +321,7 @@ class COutputLegacy { * \param[in] output - Create output files. */ void SpecialOutput_SpanLoad(CSolver *solver, CGeometry *geometry, CConfig *config, bool output); - + /*! * \brief Writes one dimensional output. * \author H. Kline @@ -331,7 +331,7 @@ class COutputLegacy { * \param[in] output - Create output files. */ void SpecialOutput_AnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfig *config, bool output); - + /*! * \brief Create and write the file with the flow coefficient on the surface. * \param[in] config - Definition of the particular problem. @@ -361,7 +361,7 @@ class COutputLegacy { */ bool PrintOutput(unsigned long iIter, unsigned long iFreq); - /*! + /*! * \brief Create and write the file with the flow coefficient on the surface. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. @@ -371,7 +371,7 @@ class COutputLegacy { */ void SetSurfaceCSV_Flow(CConfig *config, CGeometry *geometry, CSolver *FlowSolver, unsigned long iExtIter, unsigned short val_iZone, unsigned short val_iInst); - /*! + /*! * \brief Create and write the file with the adjoint coefficients on the surface for serial computations. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. @@ -389,7 +389,7 @@ class COutputLegacy { * \param[in] val_nZone - iZone index. */ void MergeConnectivity(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + /*! * \brief Merge the FEM geometry into a data structure used for output file writing. * \param[in] config - Definition of the particular problem. @@ -397,7 +397,7 @@ class COutputLegacy { * \param[in] val_nZone - iZone index. */ void MergeConnectivity_FEM(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + /*! * \brief Merge the node coordinates from all processors. * \param[in] config - Definition of the particular problem. @@ -411,7 +411,7 @@ class COutputLegacy { * \param[in] geometry - Geometrical definition of the problem. */ void MergeCoordinates_FEM(CConfig *config, CGeometry *geometry); - + /*! * \brief Merge the connectivity for a single element type from all processors. * \param[in] config - Definition of the particular problem. @@ -419,7 +419,7 @@ class COutputLegacy { * \param[in] Elem_Type - VTK index of the element type being merged. */ void MergeVolumetricConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type); - + /*! * \brief Merge the connectivity for a single element type from all processors for the FEM solver. * \param[in] config - Definition of the particular problem. @@ -427,7 +427,7 @@ class COutputLegacy { * \param[in] Elem_Type - VTK index of the element type being merged. */ void MergeVolumetricConnectivity_FEM(CConfig *config, CGeometry *geometry, unsigned short Elem_Type); - + /*! * \brief Merge the connectivity for a single element type from all processors. * \param[in] config - Definition of the particular problem. @@ -435,7 +435,7 @@ class COutputLegacy { * \param[in] Elem_Type - VTK index of the element type being merged. */ void MergeSurfaceConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type); - + /*! * \brief Merge the connectivity for a single element type from all processors for the FEM solver. * \param[in] config - Definition of the particular problem. @@ -443,7 +443,7 @@ class COutputLegacy { * \param[in] Elem_Type - VTK index of the element type being merged. */ void MergeSurfaceConnectivity_FEM(CConfig *config, CGeometry *geometry, unsigned short Elem_Type); - + /*! * \brief Merge the solution into a data structure used for output file writing. * \param[in] config - Definition of the particular problem. @@ -461,7 +461,7 @@ class COutputLegacy { * \param[in] val_nZone - iZone index. */ void MergeSolution_FEM(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned short val_iZone); - + /*! * \brief Merge the solution into a data structure used for output file writing. * \param[in] config - Definition of the particular problem. @@ -514,7 +514,7 @@ class COutputLegacy { * \param[in] val_iZone - iZone index. */ void SetCGNS_Coordinates(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + /*! * \brief Write the element connectivity to a CGNS output file. * \param[in] config - Definition of the particular problem. @@ -522,7 +522,7 @@ class COutputLegacy { * \param[in] val_iZone - iZone index. */ void SetCGNS_Connectivity(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + /*! * \brief Write solution data to a CGNS output file. * \param[in] config - Definition of the particular problem. @@ -530,7 +530,7 @@ class COutputLegacy { * \param[in] val_iZone - iZone index. */ void SetCGNS_Solution(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + // /*! // * \brief Write a Paraview ASCII solution file. // * \param[in] config - Definition of the particular problem. @@ -568,7 +568,7 @@ class COutputLegacy { // * \param[in] surf_sol - Flag controlling whether this is a volume or surface file. // */ // void WriteParaViewBinary_Parallel(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned short val_iZone, unsigned short val_nZone, bool surf_sol); - + // /*! // * \brief Write a Tecplot ASCII solution file. // * \param[in] config - Definition of the particular problem. @@ -577,7 +577,7 @@ class COutputLegacy { // * \param[in] val_nZone - Total number of zones. // */ // void SetTecplotASCII(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned short val_iZone, unsigned short val_nZone, bool surf_sol); - + // /*! // * \brief Write the nodal coordinates and connectivity to a Tecplot ASCII mesh file. // * \param[in] config - Definition of the particular problem. @@ -600,7 +600,7 @@ class COutputLegacy { // * \param[in] geometry - Geometrical definition of the problem. // */ // void SetCSV_MeshASCII(CConfig *config, CGeometry *geometry); - + // /*! // * \brief Write the nodal coordinates and connectivity to a n3d ASCII mesh file. // * \param[in] config - Definition of the particular problem. @@ -618,7 +618,7 @@ class COutputLegacy { // * \param[in] surf_sol - Flag controlling whether this is a volume or surface file. // */ // void WriteTecplotASCII_Parallel(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned short val_iZone, unsigned short val_nZone, unsigned short val_iInst, unsigned short val_nInst, bool surf_sol); - + /*! * \brief Write the nodal coordinates and connectivity to a Tecplot binary mesh file. * \param[in] config - Definition of the particular problem. @@ -634,7 +634,7 @@ class COutputLegacy { * \param[in] val_iZone - iZone index. */ void SetSU2_MeshASCII(CConfig *config, CGeometry *geometry, unsigned short val_iZone, ofstream &output_file); - + /*! * \brief Write the nodal coordinates and connectivity to a Tecplot binary mesh file. * \param[in] config - Definition of the particular problem. @@ -642,7 +642,7 @@ class COutputLegacy { * \param[in] val_iZone - iZone index. */ void SetSU2_MeshBinary(CConfig *config, CGeometry *geometry); - + /*! * \brief Write the nodal coordinates to a binary file. * \param[in] config - Definition of the particular problem. @@ -658,7 +658,7 @@ class COutputLegacy { // * \param[in] val_iZone - iZone index. // */ // void SetTecplotBinary_DomainMesh(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + // /*! // * \brief Write the coordinates and connectivity to a Tecplot binary surface mesh file. // * \param[in] config - Definition of the particular problem. @@ -666,7 +666,7 @@ class COutputLegacy { // * \param[in] val_iZone - iZone index. // */ // void SetTecplotBinary_SurfaceMesh(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + // /*! // * \brief Write solution data to a Tecplot binary volume solution file. // * \param[in] config - Definition of the particular problem. @@ -682,7 +682,7 @@ class COutputLegacy { // * \param[in] val_iZone - iZone index. // */ // void SetTecplotBinary_SurfaceSolution(CConfig *config, CGeometry *geometry, unsigned short val_iZone); - + // /*! // * \brief Write a Tecplot ASCII solution file. // * \param[in] config - Definition of the particular problem. @@ -691,7 +691,7 @@ class COutputLegacy { // * \param[in] val_nZone - Total number of zones. // */ // void SetFieldViewASCII(CConfig *config, CGeometry *geometry, unsigned short val_iZone, unsigned short val_nZone); - + // /*! // * \brief Write the nodal coordinates and connectivity to a Tecplot binary mesh file. // * \param[in] config - Definition of the particular problem. @@ -699,7 +699,7 @@ class COutputLegacy { // * \param[in] val_iZone - iZone index. // */ // void SetFieldViewASCII_Mesh(CConfig *config, CGeometry *geometry); - + // /*! // * \brief Write the nodal coordinates and connectivity to a Tecplot binary mesh file. // * \param[in] config - Definition of the particular problem. @@ -707,7 +707,7 @@ class COutputLegacy { // * \param[in] val_iZone - iZone index. // */ // void SetFieldViewBinary_Mesh(CConfig *config, CGeometry *geometry); - + // /*! // * \brief Write solution data to a Tecplot binary volume solution file. // * \param[in] config - Definition of the particular problem. @@ -715,36 +715,36 @@ class COutputLegacy { // * \param[in] val_iZone - iZone index. // */ // void SetFieldViewBinary(CConfig *config, CGeometry *geometry, unsigned short val_iZone, unsigned short val_nZone); - + /*! * \brief Deallocate temporary memory needed for merging and writing coordinates. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. */ void DeallocateCoordinates(CConfig *config, CGeometry *geometry); - + /*! * \brief Deallocate temporary memory needed for merging and writing connectivity. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. */ void DeallocateConnectivity(CConfig *config, CGeometry *geometry, bool surf_sol); - + /*! * \brief Deallocate temporary memory needed for merging and writing solution variables. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. */ void DeallocateSolution(CConfig *config, CGeometry *geometry); - - /*! + + /*! * \brief Write the header of the history file. * \param[in] ConvHist_file - Pointer to the convergence history file (which is defined in the main subroutine). * \param[in] config - Definition of the particular problem. */ void SetConvHistory_Header(ofstream *ConvHist_file, CConfig *config, unsigned short val_iZone, unsigned short val_iInst); - /*! + /*! * \brief Write the history file and the convergence on the screen for serial computations. * \param[in] ConvHist_file - Pointer to the convergence history file (which is defined in the main subroutine). * \param[in] geometry - Geometrical definition of the problem. @@ -757,7 +757,7 @@ class COutputLegacy { */ void SetConvHistory_Body(ofstream *ConvHist_file, CGeometry ****geometry, CSolver *****solver_container, CConfig **config, CIntegration ****integration, bool DualTime, su2double timeused, unsigned short val_iZone, unsigned short val_iInst); - + /*! * \brief Write the history file and the convergence on the screen for serial computations. * \param[in] solver - Container vector with all the solutions. @@ -766,7 +766,7 @@ class COutputLegacy { * \param[in] output - Create output files. */ void SpecialOutput_ForcesBreakdown(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short val_iZone, bool output); - + /*! * \brief Write the history file and the convergence on the screen for serial computations. * \param[in] ConvHist_file - Pointer to the convergence history file (which is defined in the main subroutine). @@ -779,7 +779,7 @@ class COutputLegacy { * \param[in] val_nZone - iZone index. */ void SetCFL_Number(CSolver *****solver_container, CConfig **config, unsigned short val_iZone); - + /*! * \brief Write the sensitivity (including mesh sensitivity) computed with the discrete adjoint method * on the surface and in the volume to a file. @@ -856,7 +856,7 @@ class COutputLegacy { */ void SetResult_Files_Parallel(CSolver *****solver_container, CGeometry ****geometry, CConfig **config, unsigned long iExtIter, unsigned short val_nZone); - + /*! * \brief Writes the special output files. * \param[in] solver_container - Container vector with all the solutions. @@ -877,7 +877,7 @@ class COutputLegacy { * \param[in] val_nZone - iZone index. */ void LoadLocalData_Flow(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned short val_iZone); - + /*! * \brief Load the desired solution data into a structure used for parallel reordering and output file writing for incmopressible flow problems. * \param[in] config - Definition of the particular problem. @@ -895,7 +895,7 @@ class COutputLegacy { * \param[in] val_nZone - iZone index. */ void LoadLocalData_AdjFlow(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned short val_iZone); - + /*! * \brief Load the desired solution data into a structure used for parallel reordering and output file writing for elasticity problems. * \param[in] config - Definition of the particular problem. @@ -904,7 +904,7 @@ class COutputLegacy { * \param[in] val_nZone - iZone index. */ void LoadLocalData_Elasticity(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned short val_iZone); - + /*! * \brief Load the desired solution data into a structure used for parallel reordering and output file writing for generic problems. * \param[in] config - Definition of the particular problem. @@ -1012,14 +1012,14 @@ class COutputLegacy { * \param[in] geometry - Geometrical definition of the problem. */ void DeallocateConnectivity_Parallel(CConfig *config, CGeometry *geometry, bool surf_sol); - + /*! * \brief Deallocate temporary memory needed for merging and writing output data in parallel. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. */ void DeallocateData_Parallel(CConfig *config, CGeometry *geometry); - + /*! * \brief Deallocate temporary memory needed for merging and writing output data in parallel. * \param[in] config - Definition of the particular problem. @@ -1048,8 +1048,8 @@ class COutputLegacy { * \param[in] geometry - Geometrical definition of the problem. */ void DeallocateInletCoordinates(CConfig *config, CGeometry *geometry); - - /*! + + /*! * \brief Create and write a CSV file with a slice of data. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. diff --git a/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp b/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp index 0f34e3e207c..c0f7fa933e4 100644 --- a/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp @@ -39,27 +39,27 @@ #include "CFileWriter.hpp" class CCSVFileWriter final: public CFileWriter{ - + public: - + /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names * \param[in] nDim - Physical dimension - */ + */ CCSVFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter); - + /*! * \brief Destructor */ ~CCSVFileWriter() override; - + /*! * \brief Write sorted data to file in CSV file format * \param[in] - The name of the file * \param[in] - The parallel sorted data to write */ void Write_Data() override; - + }; diff --git a/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp index 94a8505345c..e48e58c3b58 100644 --- a/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp @@ -42,7 +42,7 @@ class CFEMDataSorter final: public CParallelDataSorter{ public: - + /*! * \brief Constructor * \param[in] config - Pointer to the current config structure @@ -50,7 +50,7 @@ class CFEMDataSorter final: public CParallelDataSorter{ * \param[in] nFields - Number of output fields */ CFEMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields); - + /*! * \brief Destructor */ @@ -63,19 +63,19 @@ class CFEMDataSorter final: public CParallelDataSorter{ * \param[in] val_sort - boolean controlling whether the elements are sorted or simply loaded by their owning rank. */ void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) override; - + /*! * \brief Get the global index of a point. * \input iPoint - the point ID. * \return Global index of a specific point. */ - unsigned long GetGlobalIndex(unsigned long iPoint) override{ + unsigned long GetGlobalIndex(unsigned long iPoint) override{ return linearPartitioner->GetFirstIndexOnRank(rank) + iPoint; } - + private: - - + + /*! * \brief Sort the connectivity for a single volume element type into a linear partitioning across all processors. * \param[in] config - Definition of the particular problem. @@ -83,5 +83,5 @@ class CFEMDataSorter final: public CParallelDataSorter{ * \param[in] Elem_Type - VTK index of the element type being merged. */ void SortVolumetricConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type); - + }; diff --git a/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp index 712764f8b74..c6dbdcce145 100644 --- a/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp @@ -41,13 +41,13 @@ #include class CFVMDataSorter final: public CParallelDataSorter{ - + private: - + int* Local_Halo; //!< Array containing the flag whether a point is a halo node public: - + /*! * \brief Constructor * \param[in] config - Pointer to the current config structure @@ -55,12 +55,12 @@ class CFVMDataSorter final: public CParallelDataSorter{ * \param[in] nFields - Number of output fields */ CFVMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields); - + /*! * \brief Destructor */ ~CFVMDataSorter() override; - + /*! * \brief Sort the connectivities (volume and surface) into data structures used for output file writing. * \param[in] config - Definition of the particular problem. @@ -68,32 +68,32 @@ class CFVMDataSorter final: public CParallelDataSorter{ * \param[in] val_sort - boolean controlling whether the elements are sorted or simply loaded by their owning rank. */ void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) override; - + /*! * \brief Get the global index of a point. * \input iPoint - the point ID. * \return Global index of a specific point. */ - unsigned long GetGlobalIndex(unsigned long iPoint) override { + unsigned long GetGlobalIndex(unsigned long iPoint) override { return linearPartitioner->GetFirstIndexOnRank(rank) + iPoint; } - + /*! * \brief Get the boolean whether a point is a halo node * \param[in] iPoint - ID of the point * \return if the point is a halo node. */ bool GetHalo(unsigned long iPoint) {return Local_Halo[iPoint];} - + private: - + /*! * \brief Initialize the halo point flags * \param[in] geometry - Pointer to the current geometry * \param[in] config - Pointer to the current config structure */ void SetHaloPoints(CGeometry *geometry, CConfig *config); - + /*! * \brief Sort the connectivity for a single volume element type into a linear partitioning across all processors. * \param[in] config - Definition of the particular problem. @@ -102,5 +102,5 @@ class CFVMDataSorter final: public CParallelDataSorter{ * \param[in] val_sort - boolean controlling whether the elements are sorted or simply loaded by their owning rank. */ void SortVolumetricConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type, bool val_sort); - + }; diff --git a/SU2_CFD/include/output/filewriter/CFileWriter.hpp b/SU2_CFD/include/output/filewriter/CFileWriter.hpp index d2bbd3066cf..b5ceac490f5 100644 --- a/SU2_CFD/include/output/filewriter/CFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CFileWriter.hpp @@ -55,86 +55,86 @@ class CFileWriter{ * \brief Vector containing the field names */ std::vector fieldnames; - + /*! * \brief The physical dimension of the problem */ unsigned short nDim; - + /*! * \brief The MPI rank */ int rank; - + /*! * \brief The MPI size, aka the number of processors. */ int size; - + /*! * \brief The file extension to be attached to the filename. */ std::string file_ext; - + su2double StartTime, /*!< \brief Start time for time measurement */ StopTime , /*!< \brief Stop time for time measurement */ UsedTime , /*!< \brief Used time for time measurement */ Bandwidth, /*!< \brief Used bandwidth */ file_size; /*!< \brief Size of the last written file */ - + /*! * \brief Determine the file size * \param[in] filename - Name of the file. - * \return + * \return */ inline unsigned long Determine_Filesize(std::string filename){ struct stat stat_buf; int rc = stat(filename.c_str(), &stat_buf); return rc == 0 ? stat_buf.st_size : -1; } - + /*! * \brief Filename */ string fileName; - + /*! * \brief The parallel data sorter */ CParallelDataSorter* dataSorter; - + public: /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names * \param[in] file_ext - The file extension to be attached to the filename * \param[in] nDim - Physical dimension - */ + */ CFileWriter(std::vector fields, string fileName, CParallelDataSorter* dataSorter, string file_ext, unsigned short nDim); - + /*! * \brief Destructor */ virtual ~CFileWriter(); - + /*! * \brief Write sorted data to file */ virtual void Write_Data(){} - + /*! * \brief Get the bandwith used for the last writing */ su2double Get_Bandwidth(){return Bandwidth;} - + /*! * \brief Get the filesize of the last written file. */ su2double Get_Filesize(){return file_size;} - + /*! * \brief Get the used time of the last file writing. - * \return + * \return */ su2double Get_UsedTime(){return UsedTime;} diff --git a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp index 74b20f30e13..d9ffd563c8f 100644 --- a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp @@ -46,17 +46,17 @@ class CConfig; class CParallelDataSorter{ protected: - + /*! * \brief The MPI rank */ int rank; - + /*! * \brief The MPI size, aka the number of processors. */ int size; - + unsigned long nGlobal_Poin_Par; //!< Global number of points without halos before sorting unsigned long nGlobal_Elem_Par; //!< Global number of elems without halos before sorting unsigned long nParallel_Poin; //!< Local number of points after sorting on this proc @@ -74,51 +74,51 @@ class CParallelDataSorter{ int *Conn_Hexa_Par; //!< Local connectivity of hexahedral elements after sorting on this proc int *Conn_Pris_Par; //!< Local connectivity of prism elements after sorting on this proc int *Conn_Pyra_Par; //!< Local connectivity of pyramid elements after sorting on this proc - - unsigned long nGlobalPoint_Sort; //!< Global number of points without halos after sorting + + unsigned long nGlobalPoint_Sort; //!< Global number of points without halos after sorting unsigned long nLocalPoint_Sort; //!< Local number of points without halos after sorting on this proc - + CLinearPartitioner* linearPartitioner; //!< Linear partitioner based on the global number of points. - + unsigned short GlobalField_Counter; //!< Number of output fields - + bool connectivity_sorted; //!< Boolean to store information on whether the connectivity is sorted - + int *nPoint_Send; //!< Number of points this processor has to send to other processors int *nPoint_Recv; //!< Number of points this processor receives from other processors unsigned long *Index; //!< Index each point has in the send buffer su2double *connSend; //!< Send buffer holding the data that will be send to other processors - passivedouble *passiveDoubleBuffer; //!< Buffer holding the sorted, partitioned data as passivedouble types - su2double *doubleBuffer; //!< Buffer holding the sorted, partitioned data as su2double types + passivedouble *passiveDoubleBuffer; //!< Buffer holding the sorted, partitioned data as passivedouble types + su2double *doubleBuffer; //!< Buffer holding the sorted, partitioned data as su2double types /// Pointer used to allocate the memory used for ::passiveDoubleBuffer and ::doubleBuffer. - char *dataBuffer; + char *dataBuffer; unsigned long *idSend; //!< Send buffer holding global indices that will be send to other processors int nSends, //!< Number of sends nRecvs; //!< Number of receives - + /*! - * \brief Prepare the send buffers by filling them with the global indices. + * \brief Prepare the send buffers by filling them with the global indices. * After calling this function, the data buffer for sending can be filled with the * ::SetUnsorted_Data() routine. * \param[in] globalID - Vector containing the global indices of the points */ - void PrepareSendBuffers(std::vector& globalID); + void PrepareSendBuffers(std::vector& globalID); public: - + /*! * \brief Constructor * \param[in] config - Pointer to the current config structure * \param[in] nFields - Number of output fields */ CParallelDataSorter(CConfig *config, unsigned short nFields); - + /*! * \brief Destructor */ virtual ~CParallelDataSorter(); - + /*! * \brief Sort the output data for each grid node into a linear partitioning across all processors. */ @@ -131,38 +131,38 @@ class CParallelDataSorter{ * \param[in] val_sort - boolean controlling whether the elements are sorted or simply loaded by their owning rank. */ virtual void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort = true){} - + /*! * \brief Get the number of points the local rank owns. * \return local number of points. */ unsigned long GetnPoints(){return nParallel_Poin;} - + /*! * \brief Get the number of points to sort. * \return local number of points. */ unsigned long GetnLocalPointSort(){return nLocalPoint_Sort;} - + /*! * \brief Get the global number of points (accumulated from all ranks) * \return Global number of points. */ unsigned long GetnPointsGlobal(){return nGlobal_Poin_Par;} - + /*! * \brief Get the global of elements (accumulated from all ranks and element types) * \return Global number elements. */ unsigned long GetnElem(){return nGlobal_Elem_Par;} - + /*! * \brief Get the local number of elements of a specific type that the current rank owns * \input type - The type of element, ref GEO_TYPE * \return Local number of elements of a specific type. */ unsigned long GetnElem(GEO_TYPE type); - + /*! * \brief Get the connectivity of specific element. * \input type - The type of element, ref GEO_TYPE @@ -171,21 +171,21 @@ class CParallelDataSorter{ * \return the connected node. */ unsigned long GetElem_Connectivity(GEO_TYPE type, unsigned long iElem, unsigned long iNode); - + /*! * \brief Beginning node ID of the linear partition owned by a specific processor. * \input rank - the processor rank. * \return The beginning node ID. */ unsigned long GetNodeBegin(unsigned short rank){return linearPartitioner->GetFirstIndexOnRank(rank);} - + /*! * \brief Ending node ID of the linear partition owned by a specific processor. * \input rank - the processor rank. * \return The ending node ID. */ unsigned long GetNodeEnd(unsigned short rank){return linearPartitioner->GetLastIndexOnRank(rank);} - + /*! * \brief Get the value of the linear partitioned data. * \input iField - the output field ID. @@ -193,44 +193,44 @@ class CParallelDataSorter{ * \return the value of the data field at a point. */ passivedouble GetData(unsigned short iField, unsigned long iPoint) {return passiveDoubleBuffer[iPoint*GlobalField_Counter + iField];} - + /*! * \brief Get the pointer to the sorted linear partitioned data. * \return Pointer to the sorted data. */ const passivedouble *GetData() {return passiveDoubleBuffer;} - + /*! * \brief Get the global index of a point. * \input iPoint - the point ID. * \return Global index of a specific point. */ virtual unsigned long GetGlobalIndex(unsigned long iPoint){return 0;} - + /*! * \brief Get the cumulated number of points * \input rank - the processor rank. * \return The cumulated number of points up to certain processor rank. */ unsigned long GetnPointCumulative(unsigned short rank){return linearPartitioner->GetCumulativeSizeBeforeRank(rank);} - + /*! * \brief Get the linear number of points * \input rank - the processor rank. * \return The linear number of points up to certain processor rank. */ - unsigned long GetnPointLinear(unsigned short rank){return linearPartitioner->GetSizeOnRank(rank);} - + unsigned long GetnPointLinear(unsigned short rank){return linearPartitioner->GetSizeOnRank(rank);} + /*! * \brief Check whether the current connectivity is sorted (i.e. if SortConnectivity has been called) * \return if the connectivity is sorted. - */ + */ bool GetConnectivitySorted(){return connectivity_sorted;} - + /*! * \brief Set the value of a specific field at a point. * ::PrepareSendBuffers must be called before using this function. - * + * * \param[in] iPoint - ID of the point * \param[in] iField - Index of the field * \param[in] data - Value of the field @@ -238,7 +238,7 @@ class CParallelDataSorter{ void SetUnsorted_Data(unsigned long iPoint, unsigned short iField, su2double data){ connSend[Index[iPoint] + iField] = data; } - + su2double GetUnsorted_Data(unsigned long iPoint, unsigned short iField){ return connSend[Index[iPoint] + iField]; } diff --git a/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp b/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp index aa59bcfde46..90fbc5a775e 100644 --- a/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp @@ -40,14 +40,14 @@ #include "CFileWriter.hpp" class CParaviewBinaryFileWriter final: public CFileWriter{ - + public: - + /*! * \brief File extension */ const static string fileExt; - + /*! * \brief Construct a file writer using field names, dimension. * \param[in] fields - A list of field names @@ -57,19 +57,19 @@ class CParaviewBinaryFileWriter final: public CFileWriter{ */ CParaviewBinaryFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter); - + /*! * \brief Destructor */ ~CParaviewBinaryFileWriter() override; - + /*! * \brief Write sorted data to file in paraview binary file format */ void Write_Data() override; - + private: - + /*! * \brief Change storage of buffer from big endian to little endian * \param buffer - Pointer to the beginning of the buffer @@ -77,6 +77,6 @@ class CParaviewBinaryFileWriter final: public CFileWriter{ * \param nVar - The number of entries */ void SwapBytes(char *buffer, size_t nBytes, unsigned long nVar); - + }; diff --git a/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp b/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp index f3a0f5f7474..cd5b0087e9d 100644 --- a/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp @@ -39,35 +39,35 @@ #include "CFileWriter.hpp" class CParaviewFileWriter final: public CFileWriter{ - + public: - + /*! * \brief File extension */ const static string fileExt; - + /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names * \param[in] nDim - Physical dimension * \param[in] fileName - The name of the file * \param[in] data_sorter - The parallel sorted data to write - */ - CParaviewFileWriter(vector fields, unsigned short nDim, + */ + CParaviewFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter); - + /*! * \brief Destructor */ ~CParaviewFileWriter() override; - + /*! * \brief Write sorted data to file in paraview file format * \param[in] - The name of the file * \param[in] - The parallel sorted data to write */ void Write_Data() override; - + }; diff --git a/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp b/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp index 2e7bebc5e33..4015b8cf85e 100644 --- a/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp @@ -39,33 +39,33 @@ #include "CFileWriter.hpp" class CSU2BinaryFileWriter final: public CFileWriter{ - + public: - + /*! * \brief File extension */ const static string fileExt; - + /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names * \param[in] nDim - Physical dimension * \param[in] fileName - The name of the file * \param[in] data_sorter - The parallel sorted data to write - */ - CSU2BinaryFileWriter(vector fields, unsigned short nDim, + */ + CSU2BinaryFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter); - + /*! * \brief Destructor */ ~CSU2BinaryFileWriter() override; - + /*! * \brief Write sorted data to file in SU2 binary file format */ void Write_Data() override; - + }; diff --git a/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp b/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp index 4d10ff86d21..d8c11ddf44c 100644 --- a/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp @@ -39,33 +39,33 @@ #include "CFileWriter.hpp" class CSU2FileWriter final: public CFileWriter{ - + public: - + /*! * \brief File extension */ const static string fileExt; - + /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names * \param[in] nDim - Physical dimension * \param[in] fileName - The name of the file * \param[in] data_sorter - The parallel sorted data to write - */ - CSU2FileWriter(vector fields, unsigned short nDim, + */ + CSU2FileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter); - + /*! * \brief Destructor */ ~CSU2FileWriter() override; - + /*! * \brief Write sorted data to file in SU2 ASCII file format */ void Write_Data() override; - + }; diff --git a/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp b/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp index b03efbc41be..769a955890c 100644 --- a/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp @@ -38,18 +38,18 @@ #include "CFileWriter.hpp" class CSU2MeshFileWriter final: public CFileWriter{ - + private: unsigned short iZone, //!< Index of the current zone nZone; //!< Number of zones public: - + /*! * \brief File extension */ const static string fileExt; - + /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names @@ -58,22 +58,22 @@ class CSU2MeshFileWriter final: public CFileWriter{ * \param[in] data_sorter - The parallel sorted data to write * \param[in] iZone - Index of the current zone * \param[in] nZone - Number of zones - */ - CSU2MeshFileWriter(vector fields, unsigned short nDim, + */ + CSU2MeshFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter, unsigned short iZone, unsigned short nZone); - + /*! * \brief Destructor */ ~CSU2MeshFileWriter() override; - + /*! * \brief Write sorted data to file in SU2 mesh file format * \param[in] - The name of the file * \param[in] - The parallel sorted data to write */ void Write_Data() override; - + }; diff --git a/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp index e04c0f58599..afad7b4079b 100644 --- a/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp @@ -40,13 +40,13 @@ #include "CFEMDataSorter.hpp" class CSurfaceFEMDataSorter final: public CParallelDataSorter{ - + CFEMDataSorter* volume_sorter; //!< Pointer to the volume sorter instance //! Structure to map the local sorted point ID to the global point ID std::vector globalSurfaceDOFIDs; - + public: - + /*! * \brief Constructor * \param[in] config - Pointer to the current config structure @@ -55,19 +55,19 @@ class CSurfaceFEMDataSorter final: public CParallelDataSorter{ * \param[in] volume_sorter - Pointer to the corresponding volume sorter instance */ CSurfaceFEMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields, CFEMDataSorter* volume_sorter); - + /*! * \brief Destructor */ ~CSurfaceFEMDataSorter() override; - + /*! * \brief Sort the output data for each grid node into a linear partitioning across all processors. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. */ void SortOutputData() override; - + /*! * \brief Sort the connectivities (volume and surface) into data structures used for output file writing. * \param[in] config - Definition of the particular problem. @@ -75,7 +75,7 @@ class CSurfaceFEMDataSorter final: public CParallelDataSorter{ * \param[in] val_sort - boolean controlling whether the elements are sorted or simply loaded by their owning rank. */ void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) override; - + /*! * \brief Get the global index of a point. * \input iPoint - the point ID. @@ -84,9 +84,9 @@ class CSurfaceFEMDataSorter final: public CParallelDataSorter{ unsigned long GetGlobalIndex(unsigned long iPoint) override { return globalSurfaceDOFIDs[iPoint]; } - + private: - + /*! * \brief Sort the connectivity for a single surface element type into a linear partitioning across all processors (DG-FEM solver). * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp index 79d8c282912..e6370338d11 100644 --- a/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp @@ -40,12 +40,12 @@ #include "CFVMDataSorter.hpp" class CSurfaceFVMDataSorter final: public CParallelDataSorter{ - + CFVMDataSorter* volume_sorter; //!< Pointer to the volume sorter instance //! Structure to map the local sorted point ID to the global point ID - map Renumber2Global; + map Renumber2Global; public: - + /*! * \brief Constructor * \param[in] config - Pointer to the current config structure @@ -54,19 +54,19 @@ class CSurfaceFVMDataSorter final: public CParallelDataSorter{ * \param[in] volume_sorter - Pointer to the corresponding volume sorter instance */ CSurfaceFVMDataSorter(CConfig *config, CGeometry* geometry, unsigned short nFields, CFVMDataSorter* volume_sorter); - + /*! * \brief Destructor */ ~CSurfaceFVMDataSorter() override; - + /*! * \brief Sort the output data for each grid node into a linear partitioning across all processors. * \param[in] config - Definition of the particular problem. * \param[in] geometry - Geometrical definition of the problem. */ void SortOutputData() override; - + /*! * \brief Sort the connectivities (volume and surface) into data structures used for output file writing. * \param[in] config - Definition of the particular problem. @@ -74,19 +74,19 @@ class CSurfaceFVMDataSorter final: public CParallelDataSorter{ * \param[in] surf - boolean controlling whether surface or volume connectivity should be sorted. */ void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) override; - + /*! * \brief Get the global index of a point. * \input iPoint - the point ID. * \return Global index of a specific point. */ unsigned long GetGlobalIndex(unsigned long iPoint) override{ - return Renumber2Global[iPoint]; + return Renumber2Global[iPoint]; } - - + + private: - + /*! * \brief Sort the connectivity for a single surface element type into a linear partitioning across all processors. * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp b/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp index 8c0a93ecc5e..9b67c137cba 100644 --- a/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp @@ -42,40 +42,40 @@ #include class CTecplotBinaryFileWriter final: public CFileWriter{ - + unsigned long time_iter; //!< Current value of the time iteration su2double timestep; //!< Current value of the time step - + public: - + /*! * \brief File extension */ const static string fileExt; - + /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names * \param[in] nDim - Physical dimension * \param[in] fileName - The name of the file * \param[in] data_sorter - The parallel sorted data to write - */ - CTecplotBinaryFileWriter(vector fields, unsigned short nDim, + */ + CTecplotBinaryFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter, unsigned long time_iter, su2double timestep); - + /*! * \brief Destructor */ ~CTecplotBinaryFileWriter() override; - + /*! * \brief Write sorted data to file in tecplot binary file format * \param[in] - The name of the file * \param[in] - The parallel sorted data to write */ void Write_Data() override; - + /*! * \brief Calculate the partitioning of nodes to determine: * (a) For a given global node number, to which partition does it belong and what is its local node number; and @@ -103,7 +103,7 @@ class CTecplotBinaryFileWriter final: public CFileWriter{ } assert(m_node_range[num_ranks] == global_num_nodes); } - + /*! * \brief Determine the MPI rank that owns a global node number and its corresponding local node number. * \param global_node_number[in] - The global node number; global node numbers are sequential across all MPI ranks. @@ -121,7 +121,7 @@ class CTecplotBinaryFileWriter final: public CFileWriter{ --owning_rank; node_number = global_node_number - m_node_range[owning_rank]; } - + /*! * \brief Determine the number of nodes to be output by a particular rank * \param which_rank[in] - The MPI rank @@ -131,13 +131,13 @@ class CTecplotBinaryFileWriter final: public CFileWriter{ { return static_cast(m_node_range[which_rank + 1] - m_node_range[which_rank]); } - + private: int m_num_ranks; vector m_node_range; }; - + int64_t GetHaloNodeNumber(unsigned long global_node_number, unsigned long last_local_node, vector const &halo_node_list); - + }; diff --git a/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp b/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp index 8884eab0150..06f56a0c336 100644 --- a/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp @@ -39,37 +39,37 @@ #include "CFileWriter.hpp" class CTecplotFileWriter final: public CFileWriter{ - + unsigned long time_iter; //!< Current value of the time iteration su2double timestep; //!< Current value of the time step public: - + /*! * \brief File extension */ const static string fileExt; - + /*! * \brief Construct a file writer using field names, file extension and dimension. * \param[in] fields - A list of field names * \param[in] nDim - Physical dimension * \param[in] - The name of the file * \param[in] - The parallel sorted data to write - */ + */ CTecplotFileWriter(vector fields, unsigned short nDim, - string fileName, CParallelDataSorter *dataSorter, + string fileName, CParallelDataSorter *dataSorter, unsigned long time_iter, su2double timestep); - + /*! * \brief Destructor */ ~CTecplotFileWriter() override; - + /*! * \brief Write sorted data to file in tecplot ASCII file format */ void Write_Data() override; - + }; diff --git a/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp b/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp index 8e50d04d895..8194a1bed37 100644 --- a/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp +++ b/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp @@ -1,6 +1,6 @@ /*! * \file CMeshSolver.hpp - * \brief Declaration and inlines of the class to compute the + * \brief Declaration and inlines of the class to compute the * the discrete adjoint of the linear-elastic mesh solver. * \author Ruben Sanchez * \version 6.2.0 "Falcon" diff --git a/SU2_CFD/include/solvers/CMeshSolver.hpp b/SU2_CFD/include/solvers/CMeshSolver.hpp index 7bfc6c62e03..34952cbef42 100644 --- a/SU2_CFD/include/solvers/CMeshSolver.hpp +++ b/SU2_CFD/include/solvers/CMeshSolver.hpp @@ -177,14 +177,14 @@ class CMeshSolver : public CFEASolver { /*! * \brief Get minimun volume in the mesh - * \return + * \return */ su2double GetMinimum_Volume(){return MinVolume_Curr;} - + /*! * \brief Get maximum volume in the mesh - * \return + * \return */ su2double GetMaximum_Volume(){return MaxVolume_Curr;} - + }; diff --git a/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp index 1062a5feda0..083ff439480 100644 --- a/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp @@ -75,7 +75,7 @@ class CDiscAdjFEABoundVariable final : public CDiscAdjFEAVariable { * \brief Destructor of the class. */ ~CDiscAdjFEABoundVariable() = default; - + /*! * \brief Allocate member variables for points marked as vertex (via "Set_isVertex"). * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp index b439fd7a87d..d865910271b 100644 --- a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp @@ -162,11 +162,11 @@ class CDiscAdjFEAVariable : public CVariable { } 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]; + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Direct_Vel(iPoint,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]; + for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Direct_Accel(iPoint,iVar) = val_solution_direct[iVar]; } inline su2double* GetSolution_Direct(unsigned long iPoint) final { return Solution_Direct[iPoint]; } diff --git a/SU2_CFD/include/variables/CFEAVariable.hpp b/SU2_CFD/include/variables/CFEAVariable.hpp index 5108a20d522..2ef2c69e548 100644 --- a/SU2_CFD/include/variables/CFEAVariable.hpp +++ b/SU2_CFD/include/variables/CFEAVariable.hpp @@ -437,7 +437,7 @@ class CFEAVariable : public CVariable { * \param[in] adj_sol - The adjoint values of the solution. */ void SetAdjointSolution_Vel_time_n(unsigned long iPoint, const su2double *adj_sol) final { - for (unsigned long iVar = 0; iVar < nVar; iVar++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_Vel_time_n(iPoint,iVar), SU2_TYPE::GetValue(adj_sol[iVar])); } @@ -446,7 +446,7 @@ class CFEAVariable : public CVariable { * \param[in] adj_sol - The adjoint values of the solution. */ inline void GetAdjointSolution_Vel_time_n(unsigned long iPoint, su2double *adj_sol) const final { - for (unsigned long iVar = 0; iVar < nVar; iVar++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) adj_sol[iVar] = SU2_TYPE::GetDerivative(Solution_Vel_time_n(iPoint,iVar)); } @@ -473,7 +473,7 @@ class CFEAVariable : public CVariable { * \param[in] adj_sol - The adjoint values of the solution. */ void SetAdjointSolution_Accel_time_n(unsigned long iPoint, const su2double *adj_sol) final { - for (unsigned long iVar = 0; iVar < nVar; iVar++) + for (unsigned long iVar = 0; iVar < nVar; iVar++) SU2_TYPE::SetDerivative(Solution_Accel_time_n(iPoint,iVar), SU2_TYPE::GetValue(adj_sol[iVar])); } @@ -482,7 +482,7 @@ class CFEAVariable : public CVariable { * \param[in] adj_sol - The adjoint values of the solution. */ inline void GetAdjointSolution_Accel_time_n(unsigned long iPoint, su2double *adj_sol) const final { - for (unsigned long iVar = 0; iVar < nVar; iVar++) + 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/CMeshBoundVariable.hpp b/SU2_CFD/include/variables/CMeshBoundVariable.hpp index e7395ebbdca..f1a4800096c 100644 --- a/SU2_CFD/include/variables/CMeshBoundVariable.hpp +++ b/SU2_CFD/include/variables/CMeshBoundVariable.hpp @@ -62,7 +62,7 @@ class CMeshBoundVariable final : public CMeshVariable { * \brief Destructor of the class. */ ~CMeshBoundVariable() = default; - + /*! * \brief Allocate member variables for points marked as vertex (via "Set_isVertex"). * \param[in] config - Definition of the particular problem. diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index 1dc15995f0c..828f29e1c46 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -65,7 +65,7 @@ class CTurbSAVariable final : public CTurbVariable { * \param[in] config - Definition of the particular problem. */ CTurbSAVariable(su2double val_nu_tilde, su2double val_muT, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); - + /*! * \brief Destructor of the class. */ diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index 7b3ae7b7dfd..bb2f99f1d3d 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -68,7 +68,7 @@ class CTurbSSTVariable final : public CTurbVariable { */ 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. */ diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 3d74df798c4..7f50c03c015 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -133,7 +133,7 @@ class CVariable { 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: /*--- Disable default construction copy and assignment. ---*/ @@ -481,7 +481,7 @@ class CVariable { * \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. * \param[in] iPoint - Point index. @@ -2108,7 +2108,7 @@ class CVariable { * \brief Set the value of the solution in the previous BGS subiteration. */ virtual void Set_BGSSolution_k(); - + /*! * \brief Set the value of the solution in the previous BGS subiteration. */ diff --git a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp index 8e794e9d078..ecf7907f7bf 100644 --- a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp @@ -131,13 +131,13 @@ void CDiscAdjMultizoneDriver::StartSolver() { /*--- Set the value of the external iteration to TimeIter. -------------------------------------*/ /*--- TODO: This should be generalised for an homogeneous criteria throughout the code. --------*/ config_container[iZone]->SetTimeIter(0); - + } - + /*--- We directly start the (steady-state) discrete adjoint computation. ---*/ Run(); - + /*--- Output the solution in files. ---*/ Output(TimeIter); @@ -286,17 +286,17 @@ void CDiscAdjMultizoneDriver::Run() { * (Solution might be overwritten when entering another zone because of cross derivatives.) ---*/ Set_BGSSolution(iZone); - + /*--- make sure that everything is loaded into the output container ---*/ - + output_container[iZone]->SetHistory_Output(geometry_container[iZone][INST_0][MESH_0],solver_container[iZone][INST_0][MESH_0], config_container[iZone]); - + } /*--- Now all coupling terms are summed up, set External_Old to External for next outer iteration. ---*/ Set_OldExternal(); - + /*--- Set the multizone output. ---*/ driver_output->SetMultizoneHistory_Output(output_container, config_container, driver_config, diff --git a/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp b/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp index dd2e72eaa08..3573378922f 100644 --- a/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp +++ b/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp @@ -46,7 +46,7 @@ CDiscAdjSinglezoneDriver::CDiscAdjSinglezoneDriver(char* confFile, /*--- Store the number of internal iterations that will be run by the adjoint solver ---*/ nAdjoint_Iter = config_container[ZONE_0]->GetnInner_Iter(); - + /*--- Store the pointers ---*/ config = config_container[ZONE_0]; @@ -61,7 +61,7 @@ CDiscAdjSinglezoneDriver::CDiscAdjSinglezoneDriver(char* confFile, /*--- Determine if the problem is a turbomachinery problem ---*/ bool turbo = config->GetBoolTurbomachinery(); - + bool compressible = config->GetKind_Regime() == COMPRESSIBLE; /*--- Determine if the problem has a mesh deformation solver ---*/ @@ -109,13 +109,13 @@ CDiscAdjSinglezoneDriver::CDiscAdjSinglezoneDriver(char* confFile, if (rank == MASTER_NODE) cout << "Direct iteration: heat equation." << endl; direct_iteration = new CHeatIteration(config); - direct_output = new CHeatOutput(config, nDim); + direct_output = new CHeatOutput(config, nDim); MainVariables = FLOW_CONS_VARS; SecondaryVariables = MESH_COORDS; break; } - + direct_output->PreprocessHistoryOutput(config, false); } @@ -125,7 +125,7 @@ CDiscAdjSinglezoneDriver::~CDiscAdjSinglezoneDriver(void) { } void CDiscAdjSinglezoneDriver::Preprocess(unsigned long TimeIter) { - + config_container[ZONE_0]->SetTimeIter(TimeIter); /*--- NOTE: Inv Design Routines moved to CDiscAdjFluidIteration::Preprocess ---*/ @@ -184,7 +184,7 @@ void CDiscAdjSinglezoneDriver::Run() { /*--- Clear the stored adjoint information to be ready for a new evaluation. ---*/ AD::ClearAdjoints(); - + if (StopCalc) break; } @@ -293,7 +293,7 @@ void CDiscAdjSinglezoneDriver::SetObjFunction(){ bool turbo = (config->GetBoolTurbomachinery()); ObjFunc = 0.0; - + direct_output->SetHistory_Output(geometry, solver, config, config->GetTimeIter(), config->GetOuterIter(), @@ -302,7 +302,7 @@ void CDiscAdjSinglezoneDriver::SetObjFunction(){ /*--- Specific scalar objective functions ---*/ switch (config->GetKind_Solver()) { - case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: + case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: case DISC_ADJ_RANS: case DISC_ADJ_FEM_EULER: case DISC_ADJ_FEM_NS: case DISC_ADJ_FEM_RANS: diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index bb4d6b37175..a1a810d6584 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -46,7 +46,7 @@ CDriver::CDriver(char* confFile, unsigned short val_nZone, - SU2_Comm MPICommunicator, bool dummy_geo):config_file_name(confFile), StartTime(0.0), StopTime(0.0), UsedTime(0.0), + SU2_Comm MPICommunicator, bool dummy_geo):config_file_name(confFile), StartTime(0.0), StopTime(0.0), UsedTime(0.0), TimeIter(0), nZone(val_nZone), StopCalc(false), fsi(false), fem_solver(false), dummy_geometry(dummy_geo) { /*--- Initialize Medipack (must also be here so it is initialized from python) ---*/ @@ -64,114 +64,114 @@ CDriver::CDriver(char* confFile, size = SU2_MPI::GetSize(); /*--- Start timer to track preprocessing for benchmarking. ---*/ - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + /*--- Initialize containers with null --- */ - + SetContainers_Null(); - + /*--- Preprocessing of the config files. In this routine, the config file is read and it is determined whether a problem is single physics or multiphysics. . ---*/ - + Input_Preprocessing(config_container, driver_config); - + /*--- Retrieve dimension from mesh file ---*/ - + nDim = CConfig::GetnDim(config_container[ZONE_0]->GetMesh_FileName(), config_container[ZONE_0]->GetMesh_FileFormat()); - + /*--- Output preprocessing ---*/ - + Output_Preprocessing(config_container, driver_config, output_container, driver_output); - + for (iZone = 0; iZone < nZone; iZone++) { - + /*--- Read the number of instances for each zone ---*/ - + nInst[iZone] = config_container[iZone]->GetnTimeInstances(); - + geometry_container[iZone] = new CGeometry** [nInst[iZone]]; iteration_container[iZone] = new CIteration* [nInst[iZone]]; solver_container[iZone] = new CSolver*** [nInst[iZone]]; integration_container[iZone] = new CIntegration** [nInst[iZone]]; - numerics_container[iZone] = new CNumerics**** [nInst[iZone]]; + numerics_container[iZone] = new CNumerics**** [nInst[iZone]]; grid_movement[iZone] = new CVolumetricMovement* [nInst[iZone]]; - + /*--- Allocate transfer and interpolation container --- */ - + interface_container[iZone] = new CInterface*[nZone]; interpolator_container[iZone] = new CInterpolator*[nZone]; - + for (jZone = 0; jZone < nZone; jZone++){ interface_container[iZone][jZone] = NULL; interpolator_container[iZone][jZone] = NULL; } - + for (iInst = 0; iInst < nInst[iZone]; iInst++){ - + config_container[iZone]->SetiInst(iInst); - + geometry_container[iZone][iInst] = NULL; iteration_container[iZone][iInst] = NULL; solver_container[iZone][iInst] = NULL; integration_container[iZone][iInst] = NULL; grid_movement[iZone][iInst] = NULL; - + /*--- Preprocessing of the geometry for all zones. In this routine, the edge- based data structure is constructed, i.e. node and cell neighbors are identified and linked, face areas and volumes of the dual mesh cells are computed, and the multigrid levels are created using an agglomeration procedure. ---*/ - - Geometrical_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], dummy_geometry); - + + Geometrical_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], dummy_geometry); + /*--- Definition of the solver class: solver_container[#ZONES][#INSTANCES][#MG_GRIDS][#EQ_SYSTEMS]. The solver classes are specific to a particular set of governing equations, and they contain the subroutines with instructions for computing each spatial term of the PDE, i.e. loops over the edges to compute convective and viscous fluxes, loops over the nodes to compute source terms, and routines for imposing various boundary condition type for the PDE. ---*/ - + Solver_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], solver_container[iZone][iInst]); - + /*--- Definition of the numerical method class: numerics_container[#ZONES][#INSTANCES][#MG_GRIDS][#EQ_SYSTEMS][#EQ_TERMS]. The numerics class contains the implementation of the numerical methods for evaluating convective or viscous fluxes between any two nodes in the edge-based data structure (centered, upwind, galerkin), as well as any source terms (piecewise constant reconstruction) evaluated in each dual mesh volume. ---*/ - + Numerics_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], solver_container[iZone][iInst], numerics_container[iZone][iInst]); - + /*--- Definition of the integration class: integration_container[#ZONES][#INSTANCES][#EQ_SYSTEMS]. The integration class orchestrates the execution of the spatial integration subroutines contained in the solver class (including multigrid) for computing the residual at each node, R(U) and then integrates the equations to a steady state or time-accurately. ---*/ - - Integration_Preprocessing(config_container[iZone], integration_container[iZone][iInst]); - + + Integration_Preprocessing(config_container[iZone], integration_container[iZone][iInst]); + /*--- Instantiate the type of physics iteration to be executed within each zone. For example, one can execute the same physics across multiple zones (mixing plane), different physics in different zones (fluid-structure interaction), or couple multiple systems tightly within a single zone by creating a new iteration class (e.g., RANS). ---*/ - - Iteration_Preprocessing(config_container[iZone], iteration_container[iZone][iInst]); - + + Iteration_Preprocessing(config_container[iZone], iteration_container[iZone][iInst]); + /*--- Dynamic mesh processing. ---*/ - - DynamicMesh_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], solver_container[iZone][iInst], + + DynamicMesh_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], solver_container[iZone][iInst], iteration_container[iZone][iInst], grid_movement[iZone][iInst], surface_movement[iZone]); /*--- Static mesh processing. ---*/ - + StaticMesh_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], surface_movement[iZone]); - + } } @@ -185,28 +185,28 @@ CDriver::CDriver(char* confFile, if ( nZone > 1 ) { if (rank == MASTER_NODE) cout << endl <<"------------------- Multizone Interface Preprocessing -------------------" << endl; - + Interface_Preprocessing(config_container, solver_container, geometry_container, interface_types, interface_container, interpolator_container); } - + if(fsi && (config_container[ZONE_0]->GetRestart() || config_container[ZONE_0]->GetDiscrete_Adjoint())){ if (rank == MASTER_NODE)cout << endl <<"Restarting Fluid and Structural Solvers." << endl; for (iZone = 0; iZone < nZone; iZone++) { - for (iInst = 0; iInst < nInst[iZone]; iInst++){ + for (iInst = 0; iInst < nInst[iZone]; iInst++){ Solver_Restart(solver_container[iZone][iInst], geometry_container[iZone][iInst], config_container[iZone], true); - } + } } } - + if (config_container[ZONE_0]->GetBoolTurbomachinery()){ if (rank == MASTER_NODE)cout << endl <<"---------------------- Turbomachinery Preprocessing ---------------------" << endl; Turbomachinery_Preprocessing(config_container, geometry_container, solver_container, interface_container); } - - + + PythonInterface_Preprocessing(config_container, geometry_container, solver_container); /*--- Open the FSI convergence history file ---*/ @@ -220,15 +220,15 @@ CDriver::CDriver(char* confFile, // } /*--- Preprocessing time is reported now, but not included in the next compute portion. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StopTime = MPI_Wtime(); #endif - + /*--- Compute/print the total time for performance benchmarking. ---*/ - + UsedTime = StopTime-StartTime; UsedTimePreproc = UsedTime; UsedTimeCompute = 0.0; @@ -268,7 +268,7 @@ CDriver::CDriver(char* confFile, } void CDriver::SetContainers_Null(){ - + /*--- Create pointers to all of the classes that may be used throughout the SU2_CFD code. In general, the pointers are instantiated down a hierarchy over all zones, multigrid levels, equation sets, and equation @@ -326,7 +326,7 @@ void CDriver::SetContainers_Null(){ output_container[iZone] = NULL; nInst[iZone] = 1; } - + strcpy(runtime_file_name, "runtime.dat"); } @@ -336,7 +336,7 @@ void CDriver::Postprocessing() { bool isBinary = config_container[ZONE_0]->GetWrt_Binary_Restart(); bool wrt_perf = config_container[ZONE_0]->GetWrt_Performance(); - + /*--- Output some information to the console. ---*/ if (rank == MASTER_NODE) { @@ -361,7 +361,7 @@ void CDriver::Postprocessing() { } delete [] numerics_container; if (rank == MASTER_NODE) cout << "Deleted CNumerics container." << endl; - + for (iZone = 0; iZone < nZone; iZone++) { for (iInst = 0; iInst < nInst[iZone]; iInst++){ Integration_Postprocessing(integration_container[iZone], @@ -373,7 +373,7 @@ void CDriver::Postprocessing() { } delete [] integration_container; if (rank == MASTER_NODE) cout << "Deleted CIntegration container." << endl; - + for (iZone = 0; iZone < nZone; iZone++) { for (iInst = 0; iInst < nInst[iZone]; iInst++){ Solver_Postprocessing(solver_container[iZone], @@ -385,9 +385,9 @@ void CDriver::Postprocessing() { } delete [] solver_container; if (rank == MASTER_NODE) cout << "Deleted CSolver container." << endl; - + for (iZone = 0; iZone < nZone; iZone++) { - for (iInst = 0; iInst < nInst[iZone]; iInst++) + for (iInst = 0; iInst < nInst[iZone]; iInst++) delete iteration_container[iZone][iInst]; delete [] iteration_container[iZone]; } @@ -406,7 +406,7 @@ void CDriver::Postprocessing() { delete [] interpolator_container; if (rank == MASTER_NODE) cout << "Deleted CInterpolator container." << endl; } - + if (interface_container != NULL) { for (iZone = 0; iZone < nZone; iZone++) { if (interface_container[iZone] != NULL) { @@ -419,7 +419,7 @@ void CDriver::Postprocessing() { delete [] interface_container; if (rank == MASTER_NODE) cout << "Deleted CInterface container." << endl; } - + if (interface_types != NULL) { for (iZone = 0; iZone < nZone; iZone++) { if (interface_types[iZone] != NULL) @@ -427,7 +427,7 @@ void CDriver::Postprocessing() { } delete [] interface_types; } - + for (iZone = 0; iZone < nZone; iZone++) { if (geometry_container[iZone] != NULL) { for (iInst = 0; iInst < nInst[iZone]; iInst++){ @@ -484,7 +484,7 @@ void CDriver::Postprocessing() { if (nInst != NULL) delete [] nInst; if (rank == MASTER_NODE) cout << "Deleted nInst container." << endl; - + /*--- Deallocate output container ---*/ if (output_container!= NULL) { @@ -495,18 +495,18 @@ void CDriver::Postprocessing() { } delete [] output_container; } - + if(driver_output != NULL){ delete driver_output; } - + if (rank == MASTER_NODE) cout << "Deleted COutput class." << endl; if (rank == MASTER_NODE) cout << "-------------------------------------------------------------------------" << endl; /*--- Stop the timer and output the final performance summary. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else @@ -514,7 +514,7 @@ void CDriver::Postprocessing() { #endif UsedTime = StopTime-StartTime; UsedTimeCompute += UsedTime; - + if ((rank == MASTER_NODE) && (wrt_perf)) { su2double TotalTime = UsedTimePreproc + UsedTimeCompute + UsedTimeOutput; cout.precision(6); @@ -567,35 +567,35 @@ void CDriver::Postprocessing() { void CDriver::Input_Preprocessing(CConfig **&config, CConfig *&driver_config) { char zone_file_name[MAX_STRING_SIZE]; - + /*--- Initialize the configuration of the driver ---*/ - driver_config = new CConfig(config_file_name, SU2_CFD, false); - + driver_config = new CConfig(config_file_name, SU2_CFD, false); + for (iZone = 0; iZone < nZone; iZone++) { - + if (rank == MASTER_NODE){ cout << endl << "Parsing config file for zone " << iZone << endl; } /*--- Definition of the configuration option class for all zones. In this constructor, the input configuration file is parsed and all options are read and stored. ---*/ - + if (driver_config->GetnConfigFiles() > 0){ - + strcpy(zone_file_name, driver_config->GetConfigFilename(iZone).c_str()); config[iZone] = new CConfig(driver_config, zone_file_name, SU2_CFD, iZone, nZone, true); } else{ config[iZone] = new CConfig(driver_config, config_file_name, SU2_CFD, iZone, nZone, true); } - + /*--- Set the MPI communicator ---*/ - + config[iZone]->SetMPICommunicator(SU2_MPI::GetComm()); } - - + + /*--- Set the multizone part of the problem. ---*/ if (driver_config->GetMultizone_Problem()){ for (iZone = 0; iZone < nZone; iZone++) { @@ -603,7 +603,7 @@ void CDriver::Input_Preprocessing(CConfig **&config, CConfig *&driver_config) { config_container[iZone]->SetMultizone(driver_config, config_container); } } - + /*--- Determine whether or not the FEM solver is used, which decides the type of geometry classes that are instantiated. Only adapted for single-zone problems ---*/ @@ -623,7 +623,7 @@ void CDriver::Geometrical_Preprocessing(CConfig* config, CGeometry **&geometry, if (!dummy){ if (rank == MASTER_NODE) cout << endl <<"------------------- Geometry Preprocessing ( Zone " << config->GetiZone() <<" ) -------------------" << endl; - + if( fem_solver ) { switch( config->GetKind_FEM_Flow() ) { case DG: { @@ -638,11 +638,11 @@ void CDriver::Geometrical_Preprocessing(CConfig* config, CGeometry **&geometry, } else { if (rank == MASTER_NODE) cout << endl <<"-------------------------- Using Dummy Geometry -------------------------" << endl; - + unsigned short iMGlevel; - + geometry = new CGeometry*[config->GetnMGLevels()+1]; - + if (!fem_solver){ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { geometry[iMGlevel] = new CDummyGeometry(config); @@ -650,12 +650,12 @@ void CDriver::Geometrical_Preprocessing(CConfig* config, CGeometry **&geometry, } else { geometry[ZONE_0] = new CDummyMeshFEM_DG(config); } - + nDim = geometry[ZONE_0]->GetnDim(); } /*--- Computation of wall distances for turbulence modeling ---*/ - + if ((config->GetKind_Solver() == RANS) || (config->GetKind_Solver() == INC_RANS) || (config->GetKind_Solver() == ADJ_RANS) || @@ -663,48 +663,48 @@ void CDriver::Geometrical_Preprocessing(CConfig* config, CGeometry **&geometry, (config->GetKind_Solver() == DISC_ADJ_RANS) || (config->GetKind_Solver() == FEM_RANS) || (config->GetKind_Solver() == FEM_LES) ) { - + if (rank == MASTER_NODE) cout << "Computing wall distances." << endl; - + geometry[MESH_0]->ComputeWall_Distance(config); } - + /*--- Computation of positive surface area in the z-plane which is used for the calculation of force coefficient (non-dimensionalization). ---*/ - + geometry[MESH_0]->SetPositive_ZArea(config); - + /*--- Set the near-field, interface and actuator disk boundary conditions, if necessary. ---*/ - + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { geometry[iMesh]->MatchNearField(config); geometry[iMesh]->MatchActuator_Disk(config); } - + /*--- If we have any periodic markers in this calculation, we must match the periodic points found on both sides of the periodic BC. Note that the current implementation requires a 1-to-1 matching of periodic points on the pair of periodic faces after the translation or rotation is taken into account. ---*/ - + if ((config->GetnMarker_Periodic() != 0) && !fem_solver) { for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - + /*--- Note that we loop over pairs of periodic markers individually so that repeated nodes on adjacent periodic faces are properly accounted for in multiple places. ---*/ - + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { geometry[iMesh]->MatchPeriodic(config, iPeriodic); } - + /*--- Initialize the communication framework for the periodic BCs. ---*/ geometry[iMesh]->PreprocessPeriodicComms(geometry[iMesh], config); - + } } - + /*--- If activated by the compile directive, perform a partition analysis. ---*/ #if PARTITION if( fem_solver ) Partition_Analysis_FEM(geometry[MESH_0], config); @@ -713,8 +713,8 @@ void CDriver::Geometrical_Preprocessing(CConfig* config, CGeometry **&geometry, /*--- Check if Euler & Symmetry markers are straight/plane. This information is used in the Euler & Symmetry boundary routines. ---*/ - if((config_container[iZone]->GetnMarker_Euler() != 0 || - config_container[iZone]->GetnMarker_SymWall() != 0) && + if((config_container[iZone]->GetnMarker_Euler() != 0 || + config_container[iZone]->GetnMarker_SymWall() != 0) && !fem_solver) { if (rank == MASTER_NODE) @@ -724,345 +724,345 @@ void CDriver::Geometrical_Preprocessing(CConfig* config, CGeometry **&geometry, geometry_container[iZone][iInst][iMesh]->ComputeSurf_Straightness(config_container[iZone], (iMesh==MESH_0) ); } - + } void CDriver::Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geometry) { - + unsigned short iZone = config->GetiZone(), iMGlevel; unsigned short requestedMGlevels = config->GetnMGLevels(); unsigned long iPoint; bool fea = false; - + /*--- Definition of the geometry class to store the primal grid in the partitioning process. ---*/ - + CGeometry *geometry_aux = NULL; - + /*--- All ranks process the grid and call ParMETIS for partitioning ---*/ - + geometry_aux = new CPhysicalGeometry(config, iZone, nZone); - + /*--- Set the dimension --- */ - + nDim = geometry_aux->GetnDim(); - + /*--- Color the initial grid and set the send-receive domains (ParMETIS) ---*/ geometry_aux->SetColorGrid_Parallel(config); - + /*--- Allocate the memory of the current domain, and divide the grid between the ranks. ---*/ - + geometry = NULL; geometry = new CGeometry *[config->GetnMGLevels()+1]; - + /*--- Build the grid data structures using the ParMETIS coloring. ---*/ geometry[MESH_0] = new CPhysicalGeometry(geometry_aux, config); - + /*--- Deallocate the memory of geometry_aux and solver_aux ---*/ - + delete geometry_aux; - + /*--- Add the Send/Receive boundaries ---*/ geometry[MESH_0]->SetSendReceive(config); - + /*--- Add the Send/Receive boundaries ---*/ geometry[MESH_0]->SetBoundaries(config); - + fea = ((config->GetKind_Solver() == FEM_ELASTICITY) || (config->GetKind_Solver() == DISC_ADJ_FEM)); - + /*--- Compute elements surrounding points, points surrounding points ---*/ - + if (rank == MASTER_NODE) cout << "Setting point connectivity." << endl; geometry[MESH_0]->SetPoint_Connectivity(); - + /*--- Renumbering points using Reverse Cuthill McKee ordering ---*/ - + if (rank == MASTER_NODE) cout << "Renumbering points (Reverse Cuthill McKee Ordering)." << endl; geometry[MESH_0]->SetRCM_Ordering(config); - + /*--- recompute elements surrounding points, points surrounding points ---*/ - + if (rank == MASTER_NODE) cout << "Recomputing point connectivity." << endl; geometry[MESH_0]->SetPoint_Connectivity(); - + /*--- Compute elements surrounding elements ---*/ - + if (rank == MASTER_NODE) cout << "Setting element connectivity." << endl; geometry[MESH_0]->SetElement_Connectivity(); - + /*--- Check the orientation before computing geometrical quantities ---*/ - + geometry[MESH_0]->SetBoundVolume(); if (config->GetReorientElements()) { if (rank == MASTER_NODE) cout << "Checking the numerical grid orientation." << endl; geometry[MESH_0]->Check_IntElem_Orientation(config); geometry[MESH_0]->Check_BoundElem_Orientation(config); } - + /*--- Create the edge structure ---*/ - + if (rank == MASTER_NODE) cout << "Identifying edges and vertices." << endl; geometry[MESH_0]->SetEdges(); geometry[MESH_0]->SetVertex(config); - + /*--- Compute cell center of gravity ---*/ - + if ((rank == MASTER_NODE) && (!fea)) cout << "Computing centers of gravity." << endl; geometry[MESH_0]->SetCoord_CG(); - + /*--- Create the control volume structures ---*/ - + if ((rank == MASTER_NODE) && (!fea)) cout << "Setting the control volume structure." << endl; geometry[MESH_0]->SetControlVolume(config, ALLOCATE); geometry[MESH_0]->SetBoundControlVolume(config, ALLOCATE); - + /*--- Visualize a dual control volume if requested ---*/ - + if ((config->GetVisualize_CV() >= 0) && (config->GetVisualize_CV() < (long)geometry[MESH_0]->GetnPointDomain())) geometry[MESH_0]->VisualizeControlVolume(config, UPDATE); - + /*--- Identify closest normal neighbor ---*/ - + if (rank == MASTER_NODE) cout << "Searching for the closest normal neighbors to the surfaces." << endl; geometry[MESH_0]->FindNormal_Neighbor(config); - + /*--- Store the global to local mapping. ---*/ - + if (rank == MASTER_NODE) cout << "Storing a mapping from global to local point index." << endl; geometry[MESH_0]->SetGlobal_to_Local_Point(); - + /*--- Compute the surface curvature ---*/ - + if ((rank == MASTER_NODE) && (!fea)) cout << "Compute the surface curvature." << endl; geometry[MESH_0]->ComputeSurf_Curvature(config); - + /*--- Check for periodicity and disable MG if necessary. ---*/ - + if (rank == MASTER_NODE) cout << "Checking for periodicity." << endl; geometry[MESH_0]->Check_Periodicity(config); - + /*--- Compute mesh quality statistics on the fine grid. ---*/ - + if (!fea) { if (rank == MASTER_NODE) cout << "Computing mesh quality statistics for the dual control volumes." << endl; geometry[MESH_0]->ComputeMeshQualityStatistics(config); } - + geometry[MESH_0]->SetMGLevel(MESH_0); if ((config->GetnMGLevels() != 0) && (rank == MASTER_NODE)) cout << "Setting the multigrid structure." << endl; - + /*--- Loop over all the new grid ---*/ - + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - + /*--- Create main agglomeration structure ---*/ - + geometry[iMGlevel] = new CMultiGridGeometry(geometry, config, iMGlevel); - + /*--- Compute points surrounding points. ---*/ - + geometry[iMGlevel]->SetPoint_Connectivity(geometry[iMGlevel-1]); - + /*--- Create the edge structure ---*/ - + geometry[iMGlevel]->SetEdges(); geometry[iMGlevel]->SetVertex(geometry[iMGlevel-1], config); - + /*--- Create the control volume structures ---*/ - + geometry[iMGlevel]->SetControlVolume(config, geometry[iMGlevel-1], ALLOCATE); geometry[iMGlevel]->SetBoundControlVolume(config, geometry[iMGlevel-1], ALLOCATE); geometry[iMGlevel]->SetCoord(geometry[iMGlevel-1]); - + /*--- Find closest neighbor to a surface point ---*/ - + geometry[iMGlevel]->FindNormal_Neighbor(config); - + /*--- Store our multigrid index. ---*/ - + geometry[iMGlevel]->SetMGLevel(iMGlevel); - + /*--- Protect against the situation that we were not able to complete the agglomeration for this level, i.e., there weren't enough points. We need to check if we changed the total number of levels and delete the incomplete CMultiGridGeometry object. ---*/ - + if (config->GetnMGLevels() != requestedMGlevels) { delete geometry[iMGlevel]; break; } - + } - + /*--- For unsteady simulations, initialize the grid volumes and coordinates for previous solutions. Loop over all zones/grids ---*/ - + if (config->GetTime_Marching() && config->GetGrid_Movement()) { for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { for (iPoint = 0; iPoint < geometry[iMGlevel]->GetnPoint(); iPoint++) { - + /*--- Update cell volume ---*/ - + geometry[iMGlevel]->node[iPoint]->SetVolume_n(); geometry[iMGlevel]->node[iPoint]->SetVolume_nM1(); - + /*--- Update point coordinates ---*/ geometry[iMGlevel]->node[iPoint]->SetCoord_n(); geometry[iMGlevel]->node[iPoint]->SetCoord_n1(); - + } } } - - + + /*--- Create the data structure for MPI point-to-point communications. ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) geometry[iMGlevel]->PreprocessP2PComms(geometry[iMGlevel], config); - - + + /*--- Perform a few preprocessing routines and communications. ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - + /*--- Compute the max length. ---*/ - + if ((rank == MASTER_NODE) && (!fea) && (iMGlevel == MESH_0)) cout << "Finding max control volume width." << endl; geometry[iMGlevel]->SetMaxLength(config); - + /*--- Communicate the number of neighbors. This is needed for some centered schemes and for multigrid in parallel. ---*/ - + if ((rank == MASTER_NODE) && (size > SINGLE_NODE) && (!fea) && (iMGlevel == MESH_0)) cout << "Communicating number of neighbors." << endl; geometry[iMGlevel]->InitiateComms(geometry[iMGlevel], config, NEIGHBORS); geometry[iMGlevel]->CompleteComms(geometry[iMGlevel], config, NEIGHBORS); } - + } void CDriver::Geometrical_Preprocessing_DGFEM(CConfig* config, CGeometry **&geometry) { /*--- Definition of the geometry class to store the primal grid in the partitioning process. ---*/ - + CGeometry *geometry_aux = NULL; - + /*--- All ranks process the grid and call ParMETIS for partitioning ---*/ - + geometry_aux = new CPhysicalGeometry(config, iZone, nZone); - + /*--- Set the dimension --- */ - - nDim = geometry_aux->GetnDim(); - + + nDim = geometry_aux->GetnDim(); + /*--- For the FEM solver with time-accurate local time-stepping, use a dummy solver class to retrieve the initial flow state. ---*/ - + CSolver *solver_aux = NULL; solver_aux = new CFEM_DG_EulerSolver(config, nDim, MESH_0); - + /*--- Color the initial grid and set the send-receive domains (ParMETIS) ---*/ - + geometry_aux->SetColorFEMGrid_Parallel(config); - + /*--- Allocate the memory of the current domain, and divide the grid between the ranks. ---*/ - + geometry = NULL; geometry = new CGeometry *[config->GetnMGLevels()+1]; - + geometry[MESH_0] = new CMeshFEM_DG(geometry_aux, config); - + /*--- Deallocate the memory of geometry_aux and solver_aux ---*/ - + delete geometry_aux; if (solver_aux != NULL) delete solver_aux; - + /*--- Add the Send/Receive boundaries ---*/ geometry[MESH_0]->SetSendReceive(config); - + /*--- Add the Send/Receive boundaries ---*/ geometry[MESH_0]->SetBoundaries(config); - + /*--- Carry out a dynamic cast to CMeshFEM_DG, such that it is not needed to define all virtual functions in the base class CGeometry. ---*/ CMeshFEM_DG *DGMesh = dynamic_cast(geometry[MESH_0]); - + /*--- Determine the standard elements for the volume elements. ---*/ if (rank == MASTER_NODE) cout << "Creating standard volume elements." << endl; DGMesh->CreateStandardVolumeElements(config); - + /*--- Create the face information needed to compute the contour integral for the elements in the Discontinuous Galerkin formulation. ---*/ if (rank == MASTER_NODE) cout << "Creating face information." << endl; DGMesh->CreateFaces(config); - + /*--- Compute the metric terms of the volume elements. ---*/ if (rank == MASTER_NODE) cout << "Computing metric terms volume elements." << endl; DGMesh->MetricTermsVolumeElements(config); - + /*--- Compute the metric terms of the surface elements. ---*/ if (rank == MASTER_NODE) cout << "Computing metric terms surface elements." << endl; DGMesh->MetricTermsSurfaceElements(config); - + /*--- Compute a length scale of the volume elements. ---*/ if (rank == MASTER_NODE) cout << "Computing length scale volume elements." << endl; DGMesh->LengthScaleVolumeElements(); - + /*--- Compute the coordinates of the integration points. ---*/ if (rank == MASTER_NODE) cout << "Computing coordinates of the integration points." << endl; DGMesh->CoordinatesIntegrationPoints(); - + /*--- Compute the coordinates of the location of the solution DOFs. This is different from the grid points when a different polynomial degree is used to represent the geometry and solution. ---*/ if (rank == MASTER_NODE) cout << "Computing coordinates of the solution DOFs." << endl; DGMesh->CoordinatesSolDOFs(); - + /*--- Perform the preprocessing tasks when wall functions are used. ---*/ if (rank == MASTER_NODE) cout << "Preprocessing for the wall functions. " << endl; DGMesh->WallFunctionPreprocessing(config); - + /*--- Store the global to local mapping. ---*/ if (rank == MASTER_NODE) cout << "Storing a mapping from global to local DOF index." << endl; geometry[MESH_0]->SetGlobal_to_Local_Point(); - - + + /*--- Loop to create the coarser grid levels. ---*/ - + for(unsigned short iMGlevel=1; iMGlevel<=config->GetnMGLevels(); iMGlevel++) { - + SU2_MPI::Error("Geometrical_Preprocessing_DGFEM: Coarse grid levels not implemented yet.", CURRENT_FUNCTION); } - + } void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolver ***&solver) { - + unsigned short iSol; - + if (rank == MASTER_NODE) cout << endl <<"-------------------- Solver Preprocessing ( Zone " << config->GetiZone() <<" ) --------------------" << endl; solver = new CSolver**[config->GetnMGLevels()+1]; - + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) solver[iMesh] = NULL; - + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { solver[iMesh] = new CSolver* [MAX_SOLS]; for (iSol = 0; iSol < MAX_SOLS; iSol++) solver[iMesh][iSol] = NULL; } - + unsigned short iMGlevel; bool euler, ns, turbulent, fem_euler, fem_ns, fem_turbulent, fem_transition, @@ -1073,13 +1073,13 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve template_solver, disc_adj, disc_adj_turb, disc_adj_heat, fem_dg_flow, fem_dg_shock_persson, e_spalart_allmaras, comp_spalart_allmaras, e_comp_spalart_allmaras; - + /*--- Count the number of DOFs per solution point. ---*/ - + DOFsPerPoint = 0; - + /*--- Initialize some useful booleans ---*/ - + euler = false; ns = false; turbulent = false; fem_euler = false; fem_ns = false; fem_turbulent = false; adj_euler = false; adj_ns = false; adj_turb = false; @@ -1092,12 +1092,12 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve template_solver = false; fem_dg_flow = false; fem_dg_shock_persson = false; e_spalart_allmaras = false; comp_spalart_allmaras = false; e_comp_spalart_allmaras = false; - + bool compressible = false; bool incompressible = false; - + /*--- Assign booleans ---*/ - + switch (config->GetKind_Solver()) { case TEMPLATE_SOLVER: template_solver = true; break; case EULER : euler = true; compressible = true; break; @@ -1127,21 +1127,21 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve case DISC_ADJ_FEM: fem = true; disc_adj_fem = true; compressible = true; break; case DISC_ADJ_HEAT: heat_fvm = true; disc_adj_heat = true; break; } - + /*--- Determine the kind of FEM solver used for the flow. ---*/ - + switch( config->GetKind_FEM_Flow() ) { case DG: fem_dg_flow = true; break; } - + /*--- Determine the kind of shock capturing method for FEM DG solver. ---*/ - + switch( config->GetKind_FEM_DG_Shock() ) { case PERSSON: fem_dg_shock_persson = true; break; } - + /*--- Assign turbulence model booleans ---*/ - + if (turbulent || fem_turbulent) switch (config->GetKind_Turb_Model()) { case SA: spalart_allmaras = true; break; @@ -1153,21 +1153,21 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve case SST_SUST: menter_sst = true; break; default: SU2_MPI::Error("Specified turbulence model unavailable or none selected", CURRENT_FUNCTION); break; } - + /*--- Definition of the Class for the solution: solver[DOMAIN][INSTANCE][MESH_LEVEL][EQUATION]. Note that euler, ns and potential are incompatible, they use the same position in sol container ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - + /*--- Allocate solution for a template problem ---*/ - + if (template_solver) { solver[iMGlevel][TEMPLATE_SOL] = new CTemplateSolver(geometry[iMGlevel], config); if (iMGlevel == MESH_0) DOFsPerPoint += solver[iMGlevel][TEMPLATE_SOL]->GetnVar(); } - + /*--- Allocate solution for direct problem, and run the preprocessing and postprocessing ---*/ - + if (euler) { if (compressible) { solver[iMGlevel][FLOW_SOL] = new CEulerSolver(geometry[iMGlevel], config, iMGlevel); @@ -1222,7 +1222,7 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve } if (fem_turbulent) { SU2_MPI::Error("Finite element turbulence model not yet implemented.", CURRENT_FUNCTION); - + if(fem_transition) SU2_MPI::Error("Finite element transition model not yet implemented.", CURRENT_FUNCTION); } @@ -1234,9 +1234,9 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve solver[iMGlevel][FEA_SOL] = new CFEASolver(geometry[iMGlevel], config); if (iMGlevel == MESH_0) DOFsPerPoint += solver[iMGlevel][FEA_SOL]->GetnVar(); } - + /*--- Allocate solution for adjoint problem ---*/ - + if (adj_euler) { if (compressible) { solver[iMGlevel][ADJFLOW_SOL] = new CAdjEulerSolver(geometry[iMGlevel], config, iMGlevel); @@ -1259,7 +1259,7 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve solver[iMGlevel][ADJTURB_SOL] = new CAdjTurbSolver(geometry[iMGlevel], config, iMGlevel); if (iMGlevel == MESH_0) DOFsPerPoint += solver[iMGlevel][ADJTURB_SOL]->GetnVar(); } - + if (disc_adj) { solver[iMGlevel][ADJFLOW_SOL] = new CDiscAdjSolver(geometry[iMGlevel], config, solver[iMGlevel][FLOW_SOL], RUNTIME_FLOW_SYS, iMGlevel); if (iMGlevel == MESH_0) DOFsPerPoint += solver[iMGlevel][ADJFLOW_SOL]->GetnVar(); @@ -1272,18 +1272,18 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve if (iMGlevel == MESH_0) DOFsPerPoint += solver[iMGlevel][ADJHEAT_SOL]->GetnVar(); } } - + if (disc_adj_fem) { solver[iMGlevel][ADJFEA_SOL] = new CDiscAdjFEASolver(geometry[iMGlevel], config, solver[iMGlevel][FEA_SOL], RUNTIME_FEA_SYS, iMGlevel); if (iMGlevel == MESH_0) DOFsPerPoint += solver[iMGlevel][ADJFEA_SOL]->GetnVar(); } - + if (disc_adj_heat) { solver[iMGlevel][ADJHEAT_SOL] = new CDiscAdjSolver(geometry[iMGlevel], config, solver[iMGlevel][HEAT_SOL], RUNTIME_HEAT_SYS, iMGlevel); if (iMGlevel == MESH_0) DOFsPerPoint += solver[iMGlevel][ADJHEAT_SOL]->GetnVar(); } } - + /*--- Preprocess the mesh solver for dynamic meshes. ---*/ /*--- This needs to be done before solver restart so the old coordinates are stored. ---*/ if (config->GetDeform_Mesh()){ @@ -1295,16 +1295,16 @@ void CDriver::Solver_Preprocessing(CConfig* config, CGeometry** geometry, CSolve } /*--- Check for restarts and use the LoadRestart() routines. ---*/ - + bool update_geo = true; if (config->GetFSI_Simulation()) update_geo = false; - + Solver_Restart(solver, geometry, config, update_geo); - + /*--- Set up any necessary inlet profiles ---*/ - + Inlet_Preprocessing(solver, geometry, config); - + } void CDriver::Inlet_Preprocessing(CSolver ***solver, CGeometry **geometry, @@ -1365,7 +1365,7 @@ void CDriver::Inlet_Preprocessing(CSolver ***solver, CGeometry **geometry, } - /*--- Load inlet profile files for any of the active solver containers. + /*--- Load inlet profile files for any of the active solver containers. Note that these routines fill the fine grid data structures for the markers and restrict values down to all coarser MG levels. ---*/ @@ -1427,9 +1427,9 @@ void CDriver::Inlet_Preprocessing(CSolver ***solver, CGeometry **geometry, solver[iMesh][TURB_SOL]->SetUniformInlet(config, iMarker); } } - + } - + } void CDriver::Solver_Restart(CSolver ***solver, CGeometry **geometry, @@ -1577,7 +1577,7 @@ void CDriver::Solver_Restart(CSolver ***solver, CGeometry **geometry, } /*--- Think about calls to pre / post-processing here, plus realizability checks. ---*/ - + } @@ -1592,7 +1592,7 @@ void CDriver::Solver_Postprocessing(CSolver ****solver, CGeometry **geometry, e_spalart_allmaras, comp_spalart_allmaras, e_comp_spalart_allmaras; /*--- Initialize some useful booleans ---*/ - + euler = false; ns = false; turbulent = false; adj_euler = false; adj_ns = false; adj_turb = false; spalart_allmaras = false; menter_sst = false; disc_adj_turb = false; @@ -1605,7 +1605,7 @@ void CDriver::Solver_Postprocessing(CSolver ****solver, CGeometry **geometry, e_spalart_allmaras = false; comp_spalart_allmaras = false; e_comp_spalart_allmaras = false; /*--- Assign booleans ---*/ - + switch (config->GetKind_Solver()) { case TEMPLATE_SOLVER: template_solver = true; break; case EULER : case INC_EULER: euler = true; break; @@ -1629,9 +1629,9 @@ void CDriver::Solver_Postprocessing(CSolver ****solver, CGeometry **geometry, case DISC_ADJ_FEM: fem = true; disc_adj_fem = true; break; case DISC_ADJ_HEAT: heat_fvm = true; disc_adj_heat = true; break; } - + /*--- Assign turbulence model booleans ---*/ - + if (turbulent) switch (config->GetKind_Turb_Model()) { case SA: spalart_allmaras = true; break; @@ -1643,20 +1643,20 @@ void CDriver::Solver_Postprocessing(CSolver ****solver, CGeometry **geometry, case SST_SUST: menter_sst = true; break; default: SU2_MPI::Error("Specified turbulence model unavailable or none selected", CURRENT_FUNCTION); break; } - + /*--- Definition of the Class for the solution: solver_container[DOMAIN][MESH_LEVEL][EQUATION]. Note that euler, ns and potential are incompatible, they use the same position in sol container ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - + /*--- DeAllocate solution for a template problem ---*/ - + if (template_solver) { delete solver[val_iInst][iMGlevel][TEMPLATE_SOL]; } /*--- DeAllocate solution for adjoint problem ---*/ - + if (adj_euler || adj_ns || disc_adj) { delete solver[val_iInst][iMGlevel][ADJFLOW_SOL]; if (disc_adj_turb || adj_turb) { @@ -1672,7 +1672,7 @@ void CDriver::Solver_Postprocessing(CSolver ****solver, CGeometry **geometry, } /*--- DeAllocate solution for direct problem ---*/ - + if (euler || ns) { delete solver[val_iInst][iMGlevel][FLOW_SOL]; } @@ -1702,9 +1702,9 @@ void CDriver::Solver_Postprocessing(CSolver ****solver, CGeometry **geometry, delete solver[val_iInst][MESH_0][ADJMESH_SOL]; } } - + delete [] solver[val_iInst][iMGlevel]; - + } delete [] solver[val_iInst]; @@ -1714,14 +1714,14 @@ void CDriver::Solver_Postprocessing(CSolver ****solver, CGeometry **geometry, void CDriver::Integration_Preprocessing(CConfig *config, CIntegration **&integration) { unsigned short iSol; - + if (rank == MASTER_NODE) cout << endl <<"----------------- Integration Preprocessing ( Zone " << config->GetiZone() <<" ) ------------------" << endl; - + integration = new CIntegration* [MAX_SOLS]; for (iSol = 0; iSol < MAX_SOLS; iSol++) integration[iSol] = NULL; - + bool euler, adj_euler, ns, adj_ns, turbulent, adj_turb, fem, fem_euler, fem_ns, fem_turbulent, heat_fvm, template_solver, transition, disc_adj, disc_adj_fem, disc_adj_heat; @@ -1735,7 +1735,7 @@ void CDriver::Integration_Preprocessing(CConfig *config, CIntegration **&integra fem_ns = false; fem_turbulent = false; heat_fvm = false; disc_adj_heat = false; - fem = false; disc_adj_fem = false; + fem = false; disc_adj_fem = false; transition = false; template_solver = false; @@ -1865,12 +1865,12 @@ void CDriver::Integration_Postprocessing(CIntegration ***integration, CGeometry } void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSolver ***solver, CNumerics ****&numerics) { - + if (rank == MASTER_NODE) cout << endl <<"------------------- Numerics Preprocessing ( Zone " << config->GetiZone() <<" ) -------------------" << endl; unsigned short iMGlevel, iSol, - + nVar_Template = 0, nVar_Flow = 0, nVar_Trans = 0, @@ -1879,12 +1879,12 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol nVar_Adj_Turb = 0, nVar_FEM = 0, nVar_Heat = 0; - + numerics = new CNumerics***[config->GetnMGLevels()+1]; - + su2double *constants = NULL; su2double kine_Inf = 0.0, omega_Inf = 0.0; - + bool euler, adj_euler, ns, adj_ns, @@ -1896,23 +1896,23 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol transition, template_solver; bool e_spalart_allmaras, comp_spalart_allmaras, e_comp_spalart_allmaras; - + bool compressible = false; bool incompressible = false; bool ideal_gas = (config->GetKind_FluidModel() == STANDARD_AIR || config->GetKind_FluidModel() == IDEAL_GAS ); bool roe_low_dissipation = config->GetKind_RoeLowDiss() != NO_ROELOWDISS; - + /*--- Initialize some useful booleans ---*/ euler = false; ns = false; turbulent = false; fem_euler = false; fem_ns = false; fem_turbulent = false; adj_euler = false; adj_ns = false; adj_turb = false; heat_fvm = false; fem = false; - spalart_allmaras = false; neg_spalart_allmaras = false; menter_sst = false; + spalart_allmaras = false; neg_spalart_allmaras = false; menter_sst = false; transition = false; template_solver = false; e_spalart_allmaras = false; comp_spalart_allmaras = false; e_comp_spalart_allmaras = false; - + /*--- Assign booleans ---*/ switch (config->GetKind_Solver()) { case TEMPLATE_SOLVER: template_solver = true; break; @@ -1932,7 +1932,7 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol case ADJ_NAVIER_STOKES : compressible =true; ns = true; turbulent = (config->GetKind_Turb_Model() != NONE); adj_ns = true; break; case ADJ_RANS : compressible =true; ns = true; turbulent = true; adj_ns = true; adj_turb = (!config->GetFrozen_Visc_Cont()); break; } - + /*--- Assign turbulence model booleans ---*/ if (turbulent || fem_turbulent) @@ -1955,11 +1955,11 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol kine_Inf = solver[MESH_0][TURB_SOL]->GetTke_Inf(); omega_Inf = solver[MESH_0][TURB_SOL]->GetOmega_Inf(); } - + /*--- Number of variables for the template ---*/ - + if (template_solver) nVar_Flow = solver[MESH_0][FLOW_SOL]->GetnVar(); - + /*--- Number of variables for direct problem ---*/ if (euler) nVar_Flow = solver[MESH_0][FLOW_SOL]->GetnVar(); @@ -1970,16 +1970,16 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol if (fem_euler) nVar_Flow = solver[MESH_0][FLOW_SOL]->GetnVar(); if (fem_ns) nVar_Flow = solver[MESH_0][FLOW_SOL]->GetnVar(); //if (fem_turbulent) nVar_Turb = solver_container[MESH_0][FEM_TURB_SOL]->GetnVar(); - + if (fem) nVar_FEM = solver[MESH_0][FEA_SOL]->GetnVar(); if (heat_fvm) nVar_Heat = solver[MESH_0][HEAT_SOL]->GetnVar(); /*--- Number of variables for adjoint problem ---*/ - + if (adj_euler) nVar_Adj_Flow = solver[MESH_0][ADJFLOW_SOL]->GetnVar(); if (adj_ns) nVar_Adj_Flow = solver[MESH_0][ADJFLOW_SOL]->GetnVar(); if (adj_turb) nVar_Adj_Turb = solver[MESH_0][ADJTURB_SOL]->GetnVar(); - + /*--- Definition of the Class for the numerical method: numerics_container[INSTANCE_LEVEL][MESH_LEVEL][EQUATION][EQ_TERM] ---*/ if (fem){ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { @@ -1995,10 +1995,10 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol numerics[iMGlevel][iSol] = new CNumerics* [MAX_TERMS]; } } - + /*--- Solver definition for the template problem ---*/ if (template_solver) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ switch (config->GetKind_ConvNumScheme_Template()) { case SPACE_CENTERED : case SPACE_UPWIND : @@ -2007,31 +2007,31 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol break; default : SU2_MPI::Error("Convective scheme not implemented (template_solver).", CURRENT_FUNCTION); break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][TEMPLATE_SOL][VISC_TERM] = new CViscous_Template(nDim, nVar_Template, config); - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][TEMPLATE_SOL][SOURCE_FIRST_TERM] = new CSource_Template(nDim, nVar_Template, config); - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][TEMPLATE_SOL][CONV_BOUND_TERM] = new CConvective_Template(nDim, nVar_Template, config); } - + } - + /*--- Solver definition for the Potential, Euler, Navier-Stokes problems ---*/ if ((euler) || (ns)) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ switch (config->GetKind_ConvNumScheme_Flow()) { case NO_CONVECTIVE : SU2_MPI::Error("No convective scheme.", CURRENT_FUNCTION); break; - + case SPACE_CENTERED : if (compressible) { /*--- Compressible flow ---*/ @@ -2042,14 +2042,14 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol case JST_KE : numerics[MESH_0][FLOW_SOL][CONV_TERM] = new CCentJST_KE_Flow(nDim, nVar_Flow, config); break; default : SU2_MPI::Error("Centered scheme not implemented.", CURRENT_FUNCTION); break; } - + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CCentLax_Flow(nDim, nVar_Flow, config); - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwRoe_Flow(nDim, nVar_Flow, config, false); - + } if (incompressible) { /*--- Incompressible flow, use preconditioning method ---*/ @@ -2061,11 +2061,11 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CCentLaxInc_Flow(nDim, nVar_Flow, config); - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwFDSInc_Flow(nDim, nVar_Flow, config); - + } break; case SPACE_UPWIND : @@ -2075,20 +2075,20 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol case NO_UPWIND : cout << "No upwind scheme." << endl; break; case ROE: if (ideal_gas) { - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwRoe_Flow(nDim, nVar_Flow, config, roe_low_dissipation); numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwRoe_Flow(nDim, nVar_Flow, config, false); } } else { - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwGeneralRoe_Flow(nDim, nVar_Flow, config); numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwGeneralRoe_Flow(nDim, nVar_Flow, config); } } break; - + case AUSM: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwAUSM_Flow(nDim, nVar_Flow, config); @@ -2096,7 +2096,7 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } break; - case AUSMPLUSUP: + case AUSMPLUSUP: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwAUSMPLUSUP_Flow(nDim, nVar_Flow, config); numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwAUSMPLUSUP_Flow(nDim, nVar_Flow, config); @@ -2109,14 +2109,14 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwAUSMPLUSUP2_Flow(nDim, nVar_Flow, config); } break; - + case TURKEL: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwTurkel_Flow(nDim, nVar_Flow, config); numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwTurkel_Flow(nDim, nVar_Flow, config); } break; - + case L2ROE: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwL2Roe_Flow(nDim, nVar_Flow, config); @@ -2136,14 +2136,14 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwSLAU_Flow(nDim, nVar_Flow, config, false); } break; - + case SLAU2: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwSLAU2_Flow(nDim, nVar_Flow, config, roe_low_dissipation); numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwSLAU2_Flow(nDim, nVar_Flow, config, false); } break; - + case HLLC: if (ideal_gas) { for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { @@ -2158,24 +2158,24 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } } break; - + case MSW: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwMSW_Flow(nDim, nVar_Flow, config); numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwMSW_Flow(nDim, nVar_Flow, config); } break; - + case CUSP: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][FLOW_SOL][CONV_TERM] = new CUpwCUSP_Flow(nDim, nVar_Flow, config); numerics[iMGlevel][FLOW_SOL][CONV_BOUND_TERM] = new CUpwCUSP_Flow(nDim, nVar_Flow, config); } break; - + default : SU2_MPI::Error("Upwind scheme not implemented.", CURRENT_FUNCTION); break; } - + } if (incompressible) { /*--- Incompressible flow, use artificial compressibility method ---*/ @@ -2191,36 +2191,36 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } } break; - + default : SU2_MPI::Error("Convective scheme not implemented (Euler and Navier-Stokes).", CURRENT_FUNCTION); break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ if (compressible) { if (ideal_gas) { - + /*--- Compressible flow Ideal gas ---*/ numerics[MESH_0][FLOW_SOL][VISC_TERM] = new CAvgGrad_Flow(nDim, nVar_Flow, true, config); for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][VISC_TERM] = new CAvgGrad_Flow(nDim, nVar_Flow, false, config); - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][VISC_BOUND_TERM] = new CAvgGrad_Flow(nDim, nVar_Flow, false, config); - + } else { - + /*--- Compressible flow Realgas ---*/ numerics[MESH_0][FLOW_SOL][VISC_TERM] = new CGeneralAvgGrad_Flow(nDim, nVar_Flow, true, config); for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][VISC_TERM] = new CGeneralAvgGrad_Flow(nDim, nVar_Flow, false, config); - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][VISC_BOUND_TERM] = new CGeneralAvgGrad_Flow(nDim, nVar_Flow, false, config); - + } } if (incompressible) { @@ -2228,15 +2228,15 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol numerics[MESH_0][FLOW_SOL][VISC_TERM] = new CAvgGradInc_Flow(nDim, nVar_Flow, true, config); for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][VISC_TERM] = new CAvgGradInc_Flow(nDim, nVar_Flow, false, config); - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][VISC_BOUND_TERM] = new CAvgGradInc_Flow(nDim, nVar_Flow, false, config); } - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - + if (config->GetBody_Force() == YES) if (incompressible) numerics[iMGlevel][FLOW_SOL][SOURCE_FIRST_TERM] = new CSourceIncBodyForce(nDim, nVar_Flow, config); else numerics[iMGlevel][FLOW_SOL][SOURCE_FIRST_TERM] = new CSourceBodyForce(nDim, nVar_Flow, config); @@ -2254,10 +2254,10 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol numerics[iMGlevel][FLOW_SOL][SOURCE_FIRST_TERM] = new CSourceWindGust(nDim, nVar_Flow, config); else numerics[iMGlevel][FLOW_SOL][SOURCE_FIRST_TERM] = new CSourceNothing(nDim, nVar_Flow, config); - + numerics[iMGlevel][FLOW_SOL][SOURCE_SECOND_TERM] = new CSourceNothing(nDim, nVar_Flow, config); } - + } /*--- Riemann solver definition for the Euler, Navier-Stokes problems for the FEM discretization. ---*/ @@ -2313,11 +2313,11 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } /*--- Solver definition for the turbulent model problem ---*/ - + if (turbulent) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ - + switch (config->GetKind_ConvNumScheme_Turb()) { case NONE : break; @@ -2333,9 +2333,9 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol SU2_MPI::Error("Convective scheme not implemented (turbulent).", CURRENT_FUNCTION); break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { if (spalart_allmaras || e_spalart_allmaras || comp_spalart_allmaras || e_comp_spalart_allmaras){ numerics[iMGlevel][TURB_SOL][VISC_TERM] = new CAvgGrad_TurbSA(nDim, nVar_Turb, true, config); @@ -2343,9 +2343,9 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol else if (neg_spalart_allmaras) numerics[iMGlevel][TURB_SOL][VISC_TERM] = new CAvgGrad_TurbSA_Neg(nDim, nVar_Turb, true, config); else if (menter_sst) numerics[iMGlevel][TURB_SOL][VISC_TERM] = new CAvgGrad_TurbSST(nDim, nVar_Turb, constants, true, config); } - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { if (spalart_allmaras) numerics[iMGlevel][TURB_SOL][SOURCE_FIRST_TERM] = new CSourcePieceWise_TurbSA(nDim, nVar_Turb, config); else if (e_spalart_allmaras) numerics[iMGlevel][TURB_SOL][SOURCE_FIRST_TERM] = new CSourcePieceWise_TurbSA_E(nDim, nVar_Turb, config); @@ -2355,9 +2355,9 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol else if (menter_sst) numerics[iMGlevel][TURB_SOL][SOURCE_FIRST_TERM] = new CSourcePieceWise_TurbSST(nDim, nVar_Turb, constants, kine_Inf, omega_Inf, config); numerics[iMGlevel][TURB_SOL][SOURCE_SECOND_TERM] = new CSourceNothing(nDim, nVar_Turb, config); } - + /*--- Definition of the boundary condition method ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { if (spalart_allmaras || e_spalart_allmaras || comp_spalart_allmaras || e_comp_spalart_allmaras) { numerics[iMGlevel][TURB_SOL][CONV_BOUND_TERM] = new CUpwSca_TurbSA(nDim, nVar_Turb, config); @@ -2373,10 +2373,10 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } } } - + /*--- Solver definition for the transition model problem ---*/ if (transition) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ switch (config->GetKind_ConvNumScheme_Turb()) { case NONE : @@ -2390,24 +2390,24 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol SU2_MPI::Error("Convective scheme not implemented (transition).", CURRENT_FUNCTION); break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][TRANS_SOL][VISC_TERM] = new CAvgGradCorrected_TransLM(nDim, nVar_Trans, config); } - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][TRANS_SOL][SOURCE_FIRST_TERM] = new CSourcePieceWise_TransLM(nDim, nVar_Trans, config); numerics[iMGlevel][TRANS_SOL][SOURCE_SECOND_TERM] = new CSourceNothing(nDim, nVar_Trans, config); } - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][TRANS_SOL][CONV_BOUND_TERM] = new CUpwLin_TransLM(nDim, nVar_Trans, config); } } - + /*--- Solver definition of the finite volume heat solver ---*/ if (heat_fvm) { @@ -2435,53 +2435,53 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } } } - + /*--- Solver definition for the flow adjoint problem ---*/ - + if (adj_euler || adj_ns) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ - + switch (config->GetKind_ConvNumScheme_AdjFlow()) { case NO_CONVECTIVE : SU2_MPI::Error("No convective scheme.", CURRENT_FUNCTION); break; - + case SPACE_CENTERED : - + if (compressible) { - + /*--- Compressible flow ---*/ - + switch (config->GetKind_Centered_AdjFlow()) { case NO_CENTERED : cout << "No centered scheme." << endl; break; case LAX : numerics[MESH_0][ADJFLOW_SOL][CONV_TERM] = new CCentLax_AdjFlow(nDim, nVar_Adj_Flow, config); break; case JST : numerics[MESH_0][ADJFLOW_SOL][CONV_TERM] = new CCentJST_AdjFlow(nDim, nVar_Adj_Flow, config); break; default : SU2_MPI::Error("Centered scheme not implemented.", CURRENT_FUNCTION); break; } - + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][ADJFLOW_SOL][CONV_TERM] = new CCentLax_AdjFlow(nDim, nVar_Adj_Flow, config); - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][ADJFLOW_SOL][CONV_BOUND_TERM] = new CUpwRoe_AdjFlow(nDim, nVar_Adj_Flow, config); - + } - + if (incompressible) { SU2_MPI::Error("Schemes not implemented for incompressible continuous adjoint.", CURRENT_FUNCTION); } - + break; - + case SPACE_UPWIND : - + if (compressible) { - + /*--- Compressible flow ---*/ - + switch (config->GetKind_Upwind_AdjFlow()) { case NO_UPWIND : cout << "No upwind scheme." << endl; break; case ROE: @@ -2493,86 +2493,86 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol default : SU2_MPI::Error("Upwind scheme not implemented.", CURRENT_FUNCTION); break; } } - + if (incompressible) { - + SU2_MPI::Error("Schemes not implemented for incompressible continuous adjoint.", CURRENT_FUNCTION); } - + break; - + default : SU2_MPI::Error("Convective scheme not implemented (adj_euler and adj_ns).", CURRENT_FUNCTION); break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ - + if (compressible) { - + /*--- Compressible flow ---*/ - + numerics[MESH_0][ADJFLOW_SOL][VISC_TERM] = new CAvgGradCorrected_AdjFlow(nDim, nVar_Adj_Flow, config); numerics[MESH_0][ADJFLOW_SOL][VISC_BOUND_TERM] = new CAvgGrad_AdjFlow(nDim, nVar_Adj_Flow, config); - + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { numerics[iMGlevel][ADJFLOW_SOL][VISC_TERM] = new CAvgGrad_AdjFlow(nDim, nVar_Adj_Flow, config); numerics[iMGlevel][ADJFLOW_SOL][VISC_BOUND_TERM] = new CAvgGrad_AdjFlow(nDim, nVar_Adj_Flow, config); } - + } - + if (incompressible) { - + SU2_MPI::Error("Schemes not implemented for incompressible continuous adjoint.", CURRENT_FUNCTION); } - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - + /*--- Note that RANS is incompatible with Axisymmetric or Rotational (Fix it!) ---*/ - + if (compressible) { - + if (adj_ns) { - + numerics[iMGlevel][ADJFLOW_SOL][SOURCE_FIRST_TERM] = new CSourceViscous_AdjFlow(nDim, nVar_Adj_Flow, config); - + if (config->GetRotating_Frame() == YES) numerics[iMGlevel][ADJFLOW_SOL][SOURCE_SECOND_TERM] = new CSourceRotatingFrame_AdjFlow(nDim, nVar_Adj_Flow, config); else numerics[iMGlevel][ADJFLOW_SOL][SOURCE_SECOND_TERM] = new CSourceConservative_AdjFlow(nDim, nVar_Adj_Flow, config); - + } - + else { - + if (config->GetRotating_Frame() == YES) numerics[iMGlevel][ADJFLOW_SOL][SOURCE_FIRST_TERM] = new CSourceRotatingFrame_AdjFlow(nDim, nVar_Adj_Flow, config); else if (config->GetAxisymmetric() == YES) numerics[iMGlevel][ADJFLOW_SOL][SOURCE_FIRST_TERM] = new CSourceAxisymmetric_AdjFlow(nDim, nVar_Adj_Flow, config); else numerics[iMGlevel][ADJFLOW_SOL][SOURCE_FIRST_TERM] = new CSourceNothing(nDim, nVar_Adj_Flow, config); - + numerics[iMGlevel][ADJFLOW_SOL][SOURCE_SECOND_TERM] = new CSourceNothing(nDim, nVar_Adj_Flow, config); - + } - + } - + if (incompressible) { - + SU2_MPI::Error("Schemes not implemented for incompressible continuous adjoint.", CURRENT_FUNCTION); } - + } - + } - + /*--- Solver definition for the turbulent adjoint problem ---*/ if (adj_turb) { /*--- Definition of the convective scheme for each equation and mesh level ---*/ @@ -2594,7 +2594,7 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol SU2_MPI::Error("Convective scheme not implemented (adj_turb).", CURRENT_FUNCTION); break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { if (spalart_allmaras) { @@ -2607,7 +2607,7 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol else if (comp_spalart_allmaras) {SU2_MPI::Error("Adjoint CC SA turbulence model not implemented.", CURRENT_FUNCTION);} else if (e_comp_spalart_allmaras) {SU2_MPI::Error("Adjoint CC Edward's SA turbulence model not implemented.", CURRENT_FUNCTION);} } - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { if (spalart_allmaras) { @@ -2620,7 +2620,7 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol else if (comp_spalart_allmaras) {SU2_MPI::Error("Adjoint CC SA turbulence model not implemented.", CURRENT_FUNCTION);} else if (e_comp_spalart_allmaras) {SU2_MPI::Error("Adjoint CC Edward's SA turbulence model not implemented.", CURRENT_FUNCTION);} } - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { if (spalart_allmaras) numerics[iMGlevel][ADJTURB_SOL][CONV_BOUND_TERM] = new CUpwLin_AdjTurb(nDim, nVar_Adj_Turb, config); @@ -2630,7 +2630,7 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol else if (comp_spalart_allmaras) {SU2_MPI::Error("Adjoint CC SA turbulence model not implemented.", CURRENT_FUNCTION);} else if (e_comp_spalart_allmaras) {SU2_MPI::Error("Adjoint CC Edward's SA turbulence model not implemented.", CURRENT_FUNCTION);} } - + } /*--- Solver definition for the FEM problem ---*/ @@ -2713,10 +2713,10 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol void CDriver::Numerics_Postprocessing(CNumerics *****numerics, CSolver ***solver, CGeometry **geometry, CConfig *config, unsigned short val_iInst) { - + unsigned short iMGlevel, iSol; - - + + bool euler, adj_euler, ns, adj_ns, @@ -2732,7 +2732,7 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, bool compressible = false; bool incompressible = false; - + /*--- Initialize some useful booleans ---*/ euler = false; ns = false; turbulent = false; fem_euler = false; fem_ns = false; fem_turbulent = false; @@ -2741,7 +2741,7 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, spalart_allmaras = false; neg_spalart_allmaras = false; menter_sst = false; transition = false; heat_fvm = false; template_solver = false; - + e_spalart_allmaras = false; comp_spalart_allmaras = false; e_comp_spalart_allmaras = false; /*--- Assign booleans ---*/ @@ -2763,7 +2763,7 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, case ADJ_NAVIER_STOKES : ns = true; turbulent = (config->GetKind_Turb_Model() != NONE); adj_ns = true; break; case ADJ_RANS : ns = true; turbulent = true; adj_ns = true; adj_turb = (!config->GetFrozen_Visc_Cont()); break; } - + /*--- Assign turbulence model booleans ---*/ if (turbulent || fem_turbulent) @@ -2777,10 +2777,10 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, case SST_SUST: menter_sst = true; break; default: SU2_MPI::Error("Specified turbulence model unavailable or none selected", CURRENT_FUNCTION); break; } - + /*--- Solver definition for the template problem ---*/ if (template_solver) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ switch (config->GetKind_ConvNumScheme_Template()) { case SPACE_CENTERED : case SPACE_UPWIND : @@ -2788,7 +2788,7 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, delete numerics[val_iInst][iMGlevel][TEMPLATE_SOL][CONV_TERM]; break; } - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { /*--- Definition of the viscous scheme for each equation and mesh level ---*/ delete numerics[val_iInst][iMGlevel][TEMPLATE_SOL][VISC_TERM]; @@ -2797,29 +2797,29 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, /*--- Definition of the boundary condition method ---*/ delete numerics[val_iInst][iMGlevel][TEMPLATE_SOL][CONV_BOUND_TERM]; } - + } - + /*--- Solver definition for the Potential, Euler, Navier-Stokes problems ---*/ if ((euler) || (ns)) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ switch (config->GetKind_ConvNumScheme_Flow()) { - + case SPACE_CENTERED : if (compressible) { - + /*--- Compressible flow ---*/ switch (config->GetKind_Centered_Flow()) { case LAX : case JST : case JST_KE : delete numerics[val_iInst][MESH_0][FLOW_SOL][CONV_TERM]; break; } for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][FLOW_SOL][CONV_TERM]; - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][FLOW_SOL][CONV_BOUND_TERM]; - + } if (incompressible) { /*--- Incompressible flow, use preconditioning method ---*/ @@ -2828,15 +2828,15 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][FLOW_SOL][CONV_TERM]; - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][FLOW_SOL][CONV_BOUND_TERM]; - + } break; case SPACE_UPWIND : - + if (compressible) { /*--- Compressible flow ---*/ switch (config->GetKind_Upwind_Flow()) { @@ -2845,10 +2845,10 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, delete numerics[val_iInst][iMGlevel][FLOW_SOL][CONV_TERM]; delete numerics[val_iInst][iMGlevel][FLOW_SOL][CONV_BOUND_TERM]; } - + break; } - + } if (incompressible) { /*--- Incompressible flow, use preconditioning method ---*/ @@ -2861,29 +2861,29 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, break; } } - + break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ if (compressible||incompressible) { /*--- Compressible flow Ideal gas ---*/ delete numerics[val_iInst][MESH_0][FLOW_SOL][VISC_TERM]; for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][FLOW_SOL][VISC_TERM]; - + /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][FLOW_SOL][VISC_BOUND_TERM]; - + } - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { delete numerics[val_iInst][iMGlevel][FLOW_SOL][SOURCE_FIRST_TERM]; delete numerics[val_iInst][iMGlevel][FLOW_SOL][SOURCE_SECOND_TERM]; } - + } /*--- DG-FEM solver definition for Euler, Navier-Stokes problems ---*/ @@ -2903,11 +2903,11 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } /*--- Solver definition for the turbulent model problem ---*/ - + if (turbulent) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ - + switch (config->GetKind_ConvNumScheme_Turb()) { case SPACE_UPWIND : for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { @@ -2916,9 +2916,9 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ - + if (spalart_allmaras || neg_spalart_allmaras ||menter_sst|| comp_spalart_allmaras || e_spalart_allmaras || e_comp_spalart_allmaras){ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { delete numerics[val_iInst][iMGlevel][TURB_SOL][VISC_TERM]; @@ -2930,12 +2930,12 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } } - + } - + /*--- Solver definition for the transition model problem ---*/ if (transition) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ switch (config->GetKind_ConvNumScheme_Turb()) { case SPACE_UPWIND : @@ -2944,7 +2944,7 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } break; } - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { /*--- Definition of the viscous scheme for each equation and mesh level ---*/ delete numerics[val_iInst][iMGlevel][TRANS_SOL][VISC_TERM]; @@ -2979,59 +2979,59 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } } } - + /*--- Solver definition for the flow adjoint problem ---*/ - + if (adj_euler || adj_ns ) { - + /*--- Definition of the convective scheme for each equation and mesh level ---*/ - + switch (config->GetKind_ConvNumScheme_AdjFlow()) { case SPACE_CENTERED : - + if (compressible) { - + /*--- Compressible flow ---*/ - + switch (config->GetKind_Centered_AdjFlow()) { case LAX : case JST: delete numerics[val_iInst][MESH_0][ADJFLOW_SOL][CONV_TERM]; break; } - + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][CONV_TERM]; - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][CONV_BOUND_TERM]; - + } - + if (incompressible) { - + /*--- Incompressible flow, use artificial compressibility method ---*/ - + switch (config->GetKind_Centered_AdjFlow()) { case LAX : case JST: delete numerics[val_iInst][MESH_0][ADJFLOW_SOL][CONV_TERM]; break; } - + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][CONV_TERM]; - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][CONV_BOUND_TERM]; - + } - + break; - + case SPACE_UPWIND : - + if (compressible || incompressible) { - + /*--- Compressible flow ---*/ - + switch (config->GetKind_Upwind_AdjFlow()) { case ROE: for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { @@ -3041,42 +3041,42 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, break; } } - + break; } - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ - + if (compressible || incompressible) { - + /*--- Compressible flow ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][VISC_TERM]; delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][VISC_BOUND_TERM]; } } - + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ - + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - - + + if (compressible || incompressible) { - + delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][SOURCE_FIRST_TERM]; delete numerics[val_iInst][iMGlevel][ADJFLOW_SOL][SOURCE_SECOND_TERM]; - + } } - + } - - + + /*--- Solver definition for the turbulent adjoint problem ---*/ if (adj_turb) { /*--- Definition of the convective scheme for each equation and mesh level ---*/ switch (config->GetKind_ConvNumScheme_AdjTurb()) { - + case SPACE_UPWIND : for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) if (spalart_allmaras) { @@ -3084,8 +3084,8 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } break; } - - + + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { if (spalart_allmaras) { /*--- Definition of the viscous scheme for each equation and mesh level ---*/ @@ -3098,19 +3098,19 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } } } - + /*--- Solver definition for the FEA problem ---*/ if (fem) { - + /*--- Definition of the viscous scheme for each equation and mesh level ---*/ delete numerics[val_iInst][MESH_0][FEA_SOL][FEA_TERM]; - + } - + /*--- We initialize the numerics for the mesh solver ---*/ if (config->GetDeform_Mesh()) delete numerics[val_iInst][MESH_0][MESH_SOL][FEA_TERM]; - + /*--- Definition of the Class for the numerical method: numerics_container[INST_LEVEL][MESH_LEVEL][EQUATION][EQ_TERM] ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { for (iSol = 0; iSol < MAX_SOLS; iSol++) { @@ -3118,27 +3118,27 @@ void CDriver::Numerics_Postprocessing(CNumerics *****numerics, } delete[] numerics[val_iInst][iMGlevel]; } - + delete[] numerics[val_iInst]; } void CDriver::Iteration_Preprocessing(CConfig* config, CIteration *&iteration) { - + if (rank == MASTER_NODE) cout << endl <<"------------------- Iteration Preprocessing ( Zone " << config->GetiZone() <<" ) ------------------" << endl; - + /*--- Loop over all zones and instantiate the physics iteration. ---*/ - + switch (config->GetKind_Solver()) { - + case EULER: case NAVIER_STOKES: case RANS: case INC_EULER: case INC_NAVIER_STOKES: case INC_RANS: if(config->GetBoolTurbomachinery()){ if (rank == MASTER_NODE) cout << "Euler/Navier-Stokes/RANS turbomachinery fluid iteration." << endl; iteration = new CTurboIteration(config); - + } else{ if (rank == MASTER_NODE) @@ -3146,50 +3146,50 @@ void CDriver::Iteration_Preprocessing(CConfig* config, CIteration *&iteration) { iteration = new CFluidIteration(config); } break; - + case FEM_EULER: case FEM_NAVIER_STOKES: case FEM_RANS: case FEM_LES: if (rank == MASTER_NODE) cout << "Finite element Euler/Navier-Stokes/RANS/LES flow iteration." << endl; iteration = new CFEMFluidIteration(config); break; - + case HEAT_EQUATION_FVM: if (rank == MASTER_NODE) cout << "Heat iteration (finite volume method)." << endl; iteration = new CHeatIteration(config); break; - + case FEM_ELASTICITY: if (rank == MASTER_NODE) cout << "FEM iteration." << endl; iteration = new CFEAIteration(config); break; - + case ADJ_EULER: case ADJ_NAVIER_STOKES: case ADJ_RANS: if (rank == MASTER_NODE) cout << "Adjoint Euler/Navier-Stokes/RANS fluid iteration." << endl; iteration = new CAdjFluidIteration(config); break; - + case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: case DISC_ADJ_RANS: - case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: + case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: if (rank == MASTER_NODE) cout << "Discrete adjoint Euler/Navier-Stokes/RANS fluid iteration." << endl; iteration = new CDiscAdjFluidIteration(config); break; - + case DISC_ADJ_FEM_EULER : case DISC_ADJ_FEM_NS : case DISC_ADJ_FEM_RANS : if (rank == MASTER_NODE) cout << "Discrete adjoint finite element Euler/Navier-Stokes/RANS fluid iteration." << endl; iteration = new CDiscAdjFluidIteration(config); break; - + case DISC_ADJ_FEM: if (rank == MASTER_NODE) cout << "Discrete adjoint FEM structural iteration." << endl; iteration = new CDiscAdjFEAIteration(config); break; - + case DISC_ADJ_HEAT: if (rank == MASTER_NODE) cout << "Discrete adjoint heat iteration." << endl; @@ -3200,7 +3200,7 @@ void CDriver::Iteration_Preprocessing(CConfig* config, CIteration *&iteration) { void CDriver::DynamicMesh_Preprocessing(CConfig *config, CGeometry **geometry, CSolver ***solver, CIteration* iteration, CVolumetricMovement *&grid_movement, CSurfaceMovement *&surface_movement){ - + /*--- Instantiate the geometry movement classes for the solution of unsteady flows on dynamic meshes, including rigid mesh transformations, dynamically deforming meshes, and preprocessing of harmonic balance. ---*/ @@ -3210,7 +3210,7 @@ void CDriver::DynamicMesh_Preprocessing(CConfig *config, CGeometry **geometry, C if (rank == MASTER_NODE) cout << "Setting dynamic mesh structure for zone "<< iZone + 1<<"." << endl; grid_movement = new CVolumetricMovement(geometry[MESH_0], config); - + surface_movement = new CSurfaceMovement(); surface_movement->CopyBoundary(geometry[MESH_0], config); if (config->GetTime_Marching() == HARMONIC_BALANCE){ @@ -3218,27 +3218,27 @@ void CDriver::DynamicMesh_Preprocessing(CConfig *config, CGeometry **geometry, C iteration->SetGrid_Movement(geometry, surface_movement, grid_movement, solver, config, 0, iInst); } } - + if (config->GetDirectDiff() == D_DESIGN) { if (rank == MASTER_NODE) cout << "Setting surface/volume derivatives." << endl; - + /*--- Set the surface derivatives, i.e. the derivative of the surface mesh nodes with respect to the design variables ---*/ - + surface_movement->SetSurface_Derivative(geometry[MESH_0],config); - + /*--- Call the volume deformation routine with derivative mode enabled. This computes the derivative of the volume mesh with respect to the surface nodes ---*/ - - + + grid_movement->SetVolume_Deformation(geometry[MESH_0],config, true, true); - + /*--- Update the multi-grid structure to propagate the derivative information to the coarser levels ---*/ - + geometry[MESH_0]->UpdateGeometry(geometry,config); - + /*--- Set the derivative of the wall-distance with respect to the surface nodes ---*/ - + if ( (config->GetKind_Solver() == RANS) || (config->GetKind_Solver() == ADJ_RANS) || (config->GetKind_Solver() == DISC_ADJ_RANS) || @@ -3246,15 +3246,15 @@ void CDriver::DynamicMesh_Preprocessing(CConfig *config, CGeometry **geometry, C (config->GetKind_Solver() == DISC_ADJ_INC_RANS)) geometry[MESH_0]->ComputeWall_Distance(config); } - - + + if (config->GetSurface_Movement(FLUID_STRUCTURE_STATIC)){ if (rank == MASTER_NODE) cout << "Setting moving mesh structure for FSI problems." << endl; /*--- Instantiate the container for the grid movement structure ---*/ grid_movement = new CElasticityMovement(geometry[MESH_0], config); } - + } void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGeometry**** geometry, @@ -3332,7 +3332,7 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe markTarget = iMarkerTarget; break; - } + } } #ifdef HAVE_MPI @@ -3373,20 +3373,20 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe #else Donor_check = markDonor; - Target_check = markTarget; + Target_check = markTarget; #endif - /* --- Check ifzones are actually sharing the interface boundary, if not skip ---*/ + /* --- Check ifzones are actually sharing the interface boundary, if not skip ---*/ if(Target_check == -1 || Donor_check == -1) { interface_types[donorZone][targetZone] = NO_COMMON_INTERFACE; continue; } /*--- Set some boolean to properly allocate data structure later ---*/ - fluid_target = false; + fluid_target = false; structural_target = false; - fluid_donor = false; + fluid_donor = false; structural_donor = false; heat_donor = false; @@ -3394,15 +3394,15 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe switch ( config[targetZone]->GetKind_Solver() ) { - case EULER : case NAVIER_STOKES: case RANS: - case INC_EULER : case INC_NAVIER_STOKES: case INC_RANS: - case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: + case EULER : case NAVIER_STOKES: case RANS: + case INC_EULER : case INC_NAVIER_STOKES: case INC_RANS: + case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: case DISC_ADJ_RANS: - fluid_target = true; + fluid_target = true; break; case FEM_ELASTICITY: case DISC_ADJ_FEM: - structural_target = true; + structural_target = true; break; case HEAT_EQUATION_FVM: case DISC_ADJ_HEAT: @@ -3412,9 +3412,9 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe switch ( config[donorZone]->GetKind_Solver() ) { - case EULER : case NAVIER_STOKES: case RANS: - case INC_EULER : case INC_NAVIER_STOKES: case INC_RANS: - case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: + case EULER : case NAVIER_STOKES: case RANS: + case INC_EULER : case INC_NAVIER_STOKES: case INC_RANS: + case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: case DISC_ADJ_RANS: fluid_donor = true; break; @@ -3443,13 +3443,13 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe if (rank == MASTER_NODE) cout << "Setting coupling "; bool conservative_interp = config[donorZone]->GetConservativeInterpolation(); - + /*--- Conditions for conservative interpolation are not met, we cannot fallback on the consistent approach because CFlowTractionInterface relies on the information in config to be correct. ---*/ if ( conservative_interp && targetZone == 0 && structural_target ) SU2_MPI::Error("Conservative interpolation assumes the structural model mesh is evaluated second, " "somehow this has not happened.",CURRENT_FUNCTION); - + switch (config[donorZone]->GetKindInterpolation()) { case NEAREST_NEIGHBOR: @@ -3481,7 +3481,7 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe if (rank == MASTER_NODE) cout << "using an sliding mesh approach." << endl; break; - + case RADIAL_BASIS_FUNCTION: if ( conservative_interp && targetZone > 0 && structural_target ) { interpolation[donorZone][targetZone] = new CMirror(geometry, config, donorZone, targetZone); @@ -3571,7 +3571,7 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe interface_types[donorZone][targetZone] = CONSERVATIVE_VARIABLES; nVarTransfer = 0; interface[donorZone][targetZone] = new CConservativeVarsInterface(nVar, nVarTransfer, config[donorZone]); - if (rank == MASTER_NODE) cout << "generic conservative variables. " << endl; + if (rank == MASTER_NODE) cout << "generic conservative variables. " << endl; } break; @@ -3593,100 +3593,100 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe } #ifdef HAVE_MPI - if (rank == MASTER_NODE) + if (rank == MASTER_NODE) delete [] Buffer_Recv_mark; #endif } void CDriver::StaticMesh_Preprocessing(CConfig *config, CGeometry** geometry, CSurfaceMovement* surface_movement){ - + unsigned short iMGlevel, iMGfine; unsigned short Kind_Grid_Movement; - + unsigned short iZone = config->GetiZone(); - + Kind_Grid_Movement = config->GetKind_GridMovement(); - + if (!fem_solver) { - + switch (Kind_Grid_Movement) { - + case ROTATING_FRAME: - + /*--- Steadily rotating frame: set the grid velocities just once before the first iteration flow solver. ---*/ - + if (rank == MASTER_NODE) { cout << endl << " Setting rotating frame grid velocities"; cout << " for zone " << iZone << "." << endl; } - + /*--- Set the grid velocities on all multigrid levels for a steadily rotating reference frame. ---*/ - + for (iMGlevel = 0; iMGlevel <= config_container[ZONE_0]->GetnMGLevels(); iMGlevel++){ geometry[iMGlevel]->SetRotationalVelocity(config, iZone, true); geometry[iMGlevel]->SetShroudVelocity(config); } - + break; - + case STEADY_TRANSLATION: - + /*--- Set the translational velocity and hold the grid fixed during the calculation (similar to rotating frame, but there is no extra source term for translation). ---*/ - + if (rank == MASTER_NODE) cout << endl << " Setting translational grid velocities." << endl; - + /*--- Set the translational velocity on all grid levels. ---*/ - + for (iMGlevel = 0; iMGlevel <= config_container[ZONE_0]->GetnMGLevels(); iMGlevel++) geometry_container[iZone][INST_0][iMGlevel]->SetTranslationalVelocity(config, iZone, true); - + break; - + default: break; } - + if ((config->GetnMarker_Moving() > 0) && !config->GetSurface_Movement(FLUID_STRUCTURE_STATIC)) { - + /*--- Fixed wall velocities: set the grid velocities only one time before the first iteration flow solver. ---*/ if (rank == MASTER_NODE) cout << endl << " Setting the moving wall velocities." << endl; - + assert(surface_movement != NULL && "A surface_movement was not instantiated."); surface_movement->Moving_Walls(geometry[MESH_0], config, iZone, 0); - + /*--- Update the grid velocities on the coarser multigrid levels after setting the moving wall velocities for the finest mesh. ---*/ for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++){ - iMGfine = iMGlevel-1; + iMGfine = iMGlevel-1; geometry[iMGlevel]->SetRestricted_GridVelocity(geometry[iMGfine], config); } } } else { - + /*--- Carry out a dynamic cast to CMeshFEM_DG, such that it is not needed to define all virtual functions in the base class CGeometry. ---*/ CMeshFEM_DG *DGMesh = dynamic_cast(geometry[MESH_0]); - + /*--- Initialize the static mesh movement, if necessary. ---*/ const unsigned short Kind_Grid_Movement = config->GetKind_GridMovement(); const bool initStaticMovement = (config->GetGrid_Movement() && (Kind_Grid_Movement == MOVING_WALL || Kind_Grid_Movement == ROTATING_FRAME || Kind_Grid_Movement == STEADY_TRANSLATION)); - + if(initStaticMovement){ if (rank == MASTER_NODE) cout << "Initialize Static Mesh Movement" << endl; DGMesh->InitStaticMeshMovement(config, Kind_Grid_Movement, iZone); } } - + } void CDriver::Output_Preprocessing(CConfig **config, CConfig *driver_config, COutput **&output, COutput *&driver_output){ @@ -3695,12 +3695,12 @@ void CDriver::Output_Preprocessing(CConfig **config, CConfig *driver_config, COu manages the writing of all restart, volume solution, surface solution, surface comma-separated value, and convergence history files (both in serial and in parallel). ---*/ - + for (iZone = 0; iZone < nZone; iZone++){ if (rank == MASTER_NODE) cout << endl <<"-------------------- Output Preprocessing ( Zone " << iZone <<" ) --------------------" << endl; - + /*--- Loop over all zones and instantiate the physics iteration. ---*/ switch (config[iZone]->GetKind_Solver()) { @@ -3710,10 +3710,10 @@ void CDriver::Output_Preprocessing(CConfig **config, CConfig *driver_config, COu cout << "Euler/Navier-Stokes/RANS output structure." << endl; output[iZone] = new CFlowCompOutput(config[iZone], nDim); break; - case INC_EULER: case INC_NAVIER_STOKES: case INC_RANS: - if (rank == MASTER_NODE) - cout << "Euler/Navier-Stokes/RANS output structure." << endl; - output[iZone] = new CFlowIncOutput(config[iZone], nDim); + case INC_EULER: case INC_NAVIER_STOKES: case INC_RANS: + if (rank == MASTER_NODE) + cout << "Euler/Navier-Stokes/RANS output structure." << endl; + output[iZone] = new CFlowIncOutput(config[iZone], nDim); break; case HEAT_EQUATION_FVM: if (rank == MASTER_NODE) @@ -3741,28 +3741,28 @@ void CDriver::Output_Preprocessing(CConfig **config, CConfig *driver_config, COu cout << "Discrete adjoint FEA output structure." << endl; output[iZone] = new CAdjElasticityOutput(config[iZone], nDim); break; - + case DISC_ADJ_HEAT: if (rank == MASTER_NODE) cout << "Discrete adjoint heat output structure." << endl; output[iZone] = new CAdjHeatOutput(config[iZone], nDim); break; - + case FEM_EULER: case FEM_LES: case FEM_RANS: case FEM_NAVIER_STOKES: if (rank == MASTER_NODE) cout << "FEM output structure." << endl; output[iZone] = new CFlowCompFEMOutput(config[iZone], nDim); break; - + default: if (rank == MASTER_NODE) cout << "Default output structure." << endl; output[iZone] = new COutput(config[iZone], nDim, false); break; } - + output[iZone]->PreprocessHistoryOutput(config[iZone]); - + output[iZone]->PreprocessVolumeOutput(config[iZone]); } @@ -3770,11 +3770,11 @@ void CDriver::Output_Preprocessing(CConfig **config, CConfig *driver_config, COu if (driver_config->GetMultizone_Problem()){ if (rank == MASTER_NODE) cout << endl <<"------------------- Output Preprocessing ( Multizone ) ------------------" << endl; - + driver_output = new CMultizoneOutput(driver_config, config, nDim); driver_output->PreprocessMultizoneHistoryOutput(output, config, driver_config); } - + /*--- Check for an unsteady restart. Update ExtIter if necessary. ---*/ if (config_container[ZONE_0]->GetTime_Domain() && config_container[ZONE_0]->GetRestart()) @@ -3784,8 +3784,8 @@ void CDriver::Output_Preprocessing(CConfig **config, CConfig *driver_config, COu if (config_container[ZONE_0]->GetKind_Solver() == FEM_ELASTICITY && config_container[ZONE_0]->GetWrt_Dynamic() && config_container[ZONE_0]->GetRestart()) TimeIter = config_container[ZONE_0]->GetRestart_Iter(); - - + + } @@ -3992,15 +3992,15 @@ void CFluidDriver::Preprocess(unsigned long Iter) { /*--- Set the value of the external iteration and physical time. ---*/ - for (iZone = 0; iZone < nZone; iZone++) { + for (iZone = 0; iZone < nZone; iZone++) { config_container[iZone]->SetInnerIter(Iter); if (config_container[iZone]->GetTime_Marching()) config_container[iZone]->SetPhysicalTime(static_cast(Iter)*config_container[iZone]->GetDelta_UnstTimeND()); else config_container[iZone]->SetPhysicalTime(0.0); - + } - + // /*--- Read the target pressure ---*/ @@ -4050,11 +4050,11 @@ void CFluidDriver::Run() { /*--- Updating zone interface communication patterns, needed only for unsteady simulation since for steady problems - this is done once in the interpolator_container constructor + this is done once in the interpolator_container constructor at the beginning of the computation ---*/ if ( unsteady ) { - for (iZone = 0; iZone < nZone; iZone++) { + for (iZone = 0; iZone < nZone; iZone++) { for (jZone = 0; jZone < nZone; jZone++) if(jZone != iZone && interpolator_container[iZone][jZone] != NULL) interpolator_container[iZone][jZone]->Set_TransferCoeff(config_container); @@ -4063,7 +4063,7 @@ void CFluidDriver::Run() { /*--- Begin Unsteady pseudo-time stepping internal loop, if not unsteady it does only one step --*/ - if (unsteady) + if (unsteady) nIntIter = config_container[MESH_0]->GetUnst_nIntIter(); else nIntIter = 1; @@ -4071,7 +4071,7 @@ void CFluidDriver::Run() { for (IntIter = 0; IntIter < nIntIter; IntIter++) { /*--- At each pseudo time-step updates transfer data ---*/ - for (iZone = 0; iZone < nZone; iZone++) + for (iZone = 0; iZone < nZone; iZone++) for (jZone = 0; jZone < nZone; jZone++) if(jZone != iZone && interface_container[iZone][jZone] != NULL) Transfer_Data(iZone, jZone); @@ -4141,10 +4141,10 @@ bool CFluidDriver::Monitor(unsigned long ExtIter) { #endif IterCount++; UsedTime = (StopTime - StartTime) + UsedTimeCompute; - - + + /*--- Check if there is any change in the runtime parameters ---*/ - + CConfig *runtime = NULL; strcpy(runtime_file_name, "runtime.dat"); runtime = new CConfig(runtime_file_name, config_container[ZONE_0]); @@ -4161,7 +4161,7 @@ bool CFluidDriver::Monitor(unsigned long ExtIter) { /*--- Check whether the current simulation has reached the specified convergence criteria, and set StopCalc to true, if so. ---*/ - + switch (config_container[ZONE_0]->GetKind_Solver()) { case EULER: case NAVIER_STOKES: case RANS: StopCalc = integration_container[ZONE_0][INST_0][FLOW_SOL]->GetConvergence(); break; @@ -4171,29 +4171,29 @@ bool CFluidDriver::Monitor(unsigned long ExtIter) { StopCalc = integration_container[ZONE_0][INST_0][FEA_SOL]->GetConvergence(); break; case ADJ_EULER: case ADJ_NAVIER_STOKES: case ADJ_RANS: case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: case DISC_ADJ_RANS: - case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: + case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_INC_RANS: case DISC_ADJ_FEM_EULER: case DISC_ADJ_FEM_NS: case DISC_ADJ_FEM_RANS: StopCalc = integration_container[ZONE_0][INST_0][ADJFLOW_SOL]->GetConvergence(); break; } - + return StopCalc; - + } void CFluidDriver::Output(unsigned long InnerIter) { - + } CTurbomachineryDriver::CTurbomachineryDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator): CFluidDriver(confFile, val_nZone, MPICommunicator) { - + output_legacy = new COutputLegacy(config_container[ZONE_0]); - + /*--- LEGACY OUTPUT (going to be removed soon) --- */ - + /*--- Open the convergence history file ---*/ ConvHist_file = NULL; ConvHist_file = new ofstream*[nZone]; @@ -4207,7 +4207,7 @@ CTurbomachineryDriver::CTurbomachineryDriver(char* confFile, unsigned short val_ } } } - + if (nZone > 1){ Max_Iter = config_container[ZONE_0]->GetnOuter_Iter(); } @@ -4222,7 +4222,7 @@ CTurbomachineryDriver::~CTurbomachineryDriver(void) { } delete [] ConvHist_file[iZone]; } - delete [] ConvHist_file; + delete [] ConvHist_file; } } @@ -4259,7 +4259,7 @@ void CTurbomachineryDriver::Run() { SetTurboPerformance(ZONE_0); } - + } void CTurbomachineryDriver::SetMixingPlane(unsigned short donorZone){ @@ -4328,7 +4328,7 @@ bool CTurbomachineryDriver::Monitor(unsigned long ExtIter) { /*--- Update the convergence history file (serial and parallel computations). ---*/ for (iZone = 0; iZone < nZone; iZone++) { - for (iInst = 0; iInst < nInst[iZone]; iInst++) + for (iInst = 0; iInst < nInst[iZone]; iInst++) output_legacy->SetConvHistory_Body(&ConvHist_file[iZone][iInst], geometry_container, solver_container, config_container, integration_container, false, UsedTime, iZone, iInst); } @@ -4455,9 +4455,9 @@ CHBDriver::CHBDriver(char* confFile, D = NULL; /*--- allocate dynamic memory for the Harmonic Balance operator ---*/ D = new su2double*[nInstHB]; for (kInst = 0; kInst < nInstHB; kInst++) D[kInst] = new su2double[nInstHB]; - + output_legacy = new COutputLegacy(config_container[ZONE_0]); - + /*--- Open the convergence history file ---*/ ConvHist_file = NULL; ConvHist_file = new ofstream*[nZone]; @@ -4471,8 +4471,8 @@ CHBDriver::CHBDriver(char* confFile, } } } - - + + } CHBDriver::~CHBDriver(void) { @@ -4482,7 +4482,7 @@ CHBDriver::~CHBDriver(void) { /*--- delete dynamic memory for the Harmonic Balance operator ---*/ for (kInst = 0; kInst < nInstHB; kInst++) if (D[kInst] != NULL) delete [] D[kInst]; if (D[kInst] != NULL) delete [] D; - + if (rank == MASTER_NODE){ /*--- Close the convergence history file. ---*/ for (iZone = 0; iZone < nZone; iZone++) { @@ -4494,7 +4494,7 @@ CHBDriver::~CHBDriver(void) { delete [] ConvHist_file; } } - + void CHBDriver::Run() { @@ -4510,15 +4510,15 @@ void CHBDriver::Run() { iteration_container[ZONE_0][iInst]->Iterate(output_container[ZONE_0], integration_container, geometry_container, solver_container, numerics_container, config_container, surface_movement, grid_movement, FFDBox, ZONE_0, iInst); - + /*--- Update the convergence history file (serial and parallel computations). ---*/ for (iZone = 0; iZone < nZone; iZone++) { - for (iInst = 0; iInst < nInst[iZone]; iInst++) + for (iInst = 0; iInst < nInst[iZone]; iInst++) output_legacy->SetConvHistory_Body(&ConvHist_file[iZone][iInst], geometry_container, solver_container, config_container, integration_container, false, UsedTime, iZone, iInst); } - + } void CHBDriver::Update() { @@ -5069,7 +5069,7 @@ CDiscAdjFSIDriver::CDiscAdjFSIDriver(char* confFile, unsigned short iZone; for (iZone = 0; iZone < nZone; iZone++){ switch (config_container[iZone]->GetKind_Solver()) { - case DISC_ADJ_INC_RANS: case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: + case DISC_ADJ_INC_RANS: case DISC_ADJ_INC_EULER: case DISC_ADJ_INC_NAVIER_STOKES: case DISC_ADJ_RANS: case DISC_ADJ_EULER: case DISC_ADJ_NAVIER_STOKES: direct_iteration[iZone] = new CFluidIteration(config_container[iZone]); nVar_Flow = solver_container[iZone][INST_0][MESH_0][ADJFLOW_SOL]->GetnVar(); @@ -5242,7 +5242,7 @@ void CDiscAdjFSIDriver::Run( ) { } for (iZone = 0; iZone < nZone; iZone++) config_container[iZone]->SetOuterIter(iOuterIter); - + /*--- Start with structural terms if OF is based on displacements ---*/ if (Kind_Objective_Function == FEM_OBJECTIVE_FUNCTION) @@ -5259,9 +5259,9 @@ void CDiscAdjFSIDriver::Run( ) { /*--- Compute mesh cross term (dM / dSv) ---*/ Iterate_Block(ZONE_FLOW, ZONE_STRUCT, FEM_CROSS_TERM_GEOMETRY); - + /*--- End with structural terms if OF is based on fluid variables ---*/ - + if (Kind_Objective_Function == FLOW_OBJECTIVE_FUNCTION) Iterate_Block(ZONE_FLOW, ZONE_STRUCT, FEA_DISP_VARS); @@ -5692,12 +5692,12 @@ void CDiscAdjFSIDriver::Fluid_Iteration_Direct(unsigned short ZONE_FLOW, unsigne solver_container[ZONE_FLOW][INST_0][MESH_0][FLOW_SOL]->InitiateComms(geometry_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], SOLUTION); solver_container[ZONE_FLOW][INST_0][MESH_0][FLOW_SOL]->CompleteComms(geometry_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], SOLUTION); - + solver_container[ZONE_FLOW][INST_0][MESH_0][FLOW_SOL]->Preprocessing(geometry_container[ZONE_FLOW][INST_0][MESH_0],solver_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, true); if (turbulent && !frozen_visc) { solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->Postprocessing(geometry_container[ZONE_FLOW][INST_0][MESH_0], solver_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], MESH_0); - + solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->InitiateComms(geometry_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], SOLUTION_EDDY); solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->CompleteComms(geometry_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], SOLUTION_EDDY); @@ -5745,12 +5745,12 @@ void CDiscAdjFSIDriver::Structural_Iteration_Direct(unsigned short ZONE_FLOW, un if (turbulent && !frozen_visc) { solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->Postprocessing(geometry_container[ZONE_FLOW][INST_0][MESH_0], solver_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], MESH_0); - + solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->InitiateComms(geometry_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], SOLUTION_EDDY); solver_container[ZONE_FLOW][INST_0][MESH_0][TURB_SOL]->CompleteComms(geometry_container[ZONE_FLOW][INST_0][MESH_0], config_container[ZONE_FLOW], SOLUTION_EDDY); } - + /*-----------------------------------------------------------------*/ /*-------------------- Transfer Tractions -------------------------*/ /*-----------------------------------------------------------------*/ @@ -5804,7 +5804,7 @@ void CDiscAdjFSIDriver::Mesh_Deformation_Direct(unsigned short ZONE_FLOW, unsign /*---- as the flag Grid_Movement is set to false in this case -----*/ /*-----------------------------------------------------------------*/ - direct_iteration[ZONE_FLOW]->SetGrid_Movement(geometry_container[ZONE_FLOW][INST_0], + direct_iteration[ZONE_FLOW]->SetGrid_Movement(geometry_container[ZONE_FLOW][INST_0], surface_movement[ZONE_FLOW], grid_movement[ZONE_FLOW][INST_0], solver_container[ZONE_FLOW][INST_0], config_container[ZONE_FLOW], 0, ExtIter ); @@ -5954,7 +5954,7 @@ void CDiscAdjFSIDriver::PrepareRecording(unsigned short ZONE_FLOW, void CDiscAdjFSIDriver::RegisterInput(unsigned short ZONE_FLOW, unsigned short ZONE_STRUCT, unsigned short kind_recording){ - + /*--- Register flow variables ---*/ if (kind_recording == FLOW_CONS_VARS) { iteration_container[ZONE_FLOW][INST_0]->RegisterInput(solver_container, geometry_container, config_container, ZONE_FLOW, INST_0, kind_recording); @@ -5964,7 +5964,7 @@ void CDiscAdjFSIDriver::RegisterInput(unsigned short ZONE_FLOW, if (kind_recording == MESH_COORDS) { iteration_container[ZONE_FLOW][INST_0]->RegisterInput(solver_container, geometry_container, config_container, ZONE_FLOW, INST_0, kind_recording); } - + /*--- Register structural variables ---*/ if (kind_recording == FEM_CROSS_TERM_GEOMETRY) { iteration_container[ZONE_STRUCT][INST_0]->RegisterInput(solver_container, geometry_container, config_container, ZONE_STRUCT, INST_0, kind_recording); @@ -6146,7 +6146,7 @@ void CDiscAdjFSIDriver::InitializeAdjoint(unsigned short ZONE_FLOW, if (kind_recording == FEA_DISP_VARS) { solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->SetAdj_ObjFunc(geometry_container[ZONE_STRUCT][INST_0][MESH_0], config_container[ZONE_STRUCT]); - + solver_container[ZONE_STRUCT][INST_0][MESH_0][ADJFEA_SOL]->SetAdjoint_Output(geometry_container[ZONE_STRUCT][INST_0][MESH_0], config_container[ZONE_STRUCT]); } @@ -6321,7 +6321,7 @@ void CDiscAdjFSIDriver::ConvergenceHistory(unsigned long IntIter, unsigned long BGS_Iter = config_container[ZONE_FLOW]->GetOuterIter(); - if (rank == MASTER_NODE) + if (rank == MASTER_NODE) output_legacy->SetConvHistory_Header(&ConvHist_file[ZONE_0][INST_0], config_container[ZONE_0], ZONE_0, INST_0); if (kind_recording == FLOW_CONS_VARS) { diff --git a/SU2_CFD/src/drivers/CDummyDriver.cpp b/SU2_CFD/src/drivers/CDummyDriver.cpp index 1c4523d51e2..bdf324c1821 100644 --- a/SU2_CFD/src/drivers/CDummyDriver.cpp +++ b/SU2_CFD/src/drivers/CDummyDriver.cpp @@ -16,7 +16,7 @@ void CDummyDriver::StartSolver(){ cout << "No solver started. DRY_RUN option enabled. " << endl; cout << "--------------------------------------------" << endl; } - + for (iZone = 0; iZone < nZone; iZone++){ output_container[iZone]->PrintVolumeFields(); output_container[iZone]->PrintHistoryFields(); diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index 4b14df45f0f..0b44c5ef16c 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -43,7 +43,7 @@ CMultizoneDriver::CMultizoneDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator) : CDriver(confFile, val_nZone, - MPICommunicator, + MPICommunicator, false) { /*--- Initialize the counter for TimeIter ---*/ @@ -88,7 +88,7 @@ CMultizoneDriver::CMultizoneDriver(char* confFile, for (iZone = 0; iZone < nZone; iZone++){ switch (config_container[iZone]->GetKind_Solver()) { case EULER: case NAVIER_STOKES: case RANS: - case INC_EULER: case INC_NAVIER_STOKES: case INC_RANS: + case INC_EULER: case INC_NAVIER_STOKES: case INC_RANS: fluid_zone = true; break; case FEM_ELASTICITY: @@ -112,14 +112,14 @@ CMultizoneDriver::CMultizoneDriver(char* confFile, prefixed_motion = new bool[nZone]; for (iZone = 0; iZone < nZone; iZone++){ switch (config_container[iZone]->GetKind_GridMovement()){ - case RIGID_MOTION: + case RIGID_MOTION: prefixed_motion[iZone] = true; break; case STEADY_TRANSLATION: case ROTATING_FRAME: case NO_MOVEMENT: case GUST: default: case ELASTICITY: prefixed_motion[iZone] = false; break; } - if (config_container[iZone]->GetSurface_Movement(AEROELASTIC) || + if (config_container[iZone]->GetSurface_Movement(AEROELASTIC) || config_container[iZone]->GetSurface_Movement(AEROELASTIC_RIGID_MOTION) || config_container[iZone]->GetSurface_Movement(DEFORMING) || config_container[iZone]->GetSurface_Movement(EXTERNAL) || @@ -137,7 +137,7 @@ CMultizoneDriver::~CMultizoneDriver(void) { delete [] residual[iZone]; delete [] residual_rel[iZone]; } - + delete [] nVarZone; delete [] init_res; delete [] residual; @@ -148,15 +148,15 @@ CMultizoneDriver::~CMultizoneDriver(void) { } void CMultizoneDriver::StartSolver() { - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + driver_config->Set_StartTime(StartTime); - + /*--- Main external loop of the solver. Runs for the number of time steps required. ---*/ if (rank == MASTER_NODE) @@ -212,10 +212,10 @@ void CMultizoneDriver::StartSolver() { void CMultizoneDriver::Preprocess(unsigned long TimeIter) { bool unsteady = driver_config->GetTime_Domain(); - - + + /*--- Set the current time iteration in the config ---*/ - + driver_config->SetTimeIter(TimeIter); for (iZone = 0; iZone < nZone; iZone++){ @@ -223,17 +223,17 @@ void CMultizoneDriver::Preprocess(unsigned long TimeIter) { /*--- Set the value of the external iteration to TimeIter. -------------------------------------*/ /*--- TODO: This should be generalised for an homogeneous criteria throughout the code. --------*/ config_container[iZone]->SetTimeIter(TimeIter); - + /*--- Store the current physical time in the config container, as this can be used for verification / MMS. This should also be more general once the drivers are more stable. ---*/ - + if (unsteady) config_container[iZone]->SetPhysicalTime(static_cast(TimeIter)*config_container[iZone]->GetDelta_UnstTimeND()); else config_container[iZone]->SetPhysicalTime(0.0); - + /*--- Read the target pressure for inverse design. ---------------------------------------------*/ /*--- TODO: This routine should be taken out of output, and made general for multiple zones. ---*/ // if (config_container[iZone]->GetInvDesign_Cp() == YES) @@ -404,25 +404,25 @@ void CMultizoneDriver::Corrector(unsigned short val_iZone) { } bool CMultizoneDriver::OuterConvergence(unsigned long OuterIter) { - + /*--- Update the residual for the all the zones ---*/ - + for (iZone = 0; iZone < nZone; iZone++){ - + /*--- Account for all the solvers ---*/ - + for (unsigned short 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] != NULL){ solver_container[iZone][INST_0][MESH_0][iSol]->ComputeResidual_Multizone(geometry_container[iZone][INST_0][MESH_0], config_container[iZone]); } } - + /*--- make sure that everything is loaded into the output container ---*/ - + output_container[iZone]->SetHistory_Output(geometry_container[iZone][INST_0][MESH_0],solver_container[iZone][INST_0][MESH_0], config_container[iZone]); - + } - + /*--- Update the residual for the all the zones ---*/ for (iZone = 0; iZone < nZone; iZone++){ /*--- Accounting for all the solvers ---*/ @@ -478,7 +478,7 @@ void CMultizoneDriver::Update() { } void CMultizoneDriver::Output(unsigned long TimeIter) { - + /*--- Time the output for performance benchmarking. ---*/ #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); @@ -491,17 +491,17 @@ void CMultizoneDriver::Output(unsigned long TimeIter) { #else StartTime = MPI_Wtime(); #endif - + bool wrote_files = false; - + for (iZone = 0; iZone < nZone; iZone++){ wrote_files = output_container[iZone]->SetResult_Files(geometry_container[iZone][INST_0][MESH_0], config_container[iZone], solver_container[iZone][INST_0][MESH_0], TimeIter, StopCalc); } - + if (wrote_files){ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else @@ -528,7 +528,7 @@ void CMultizoneDriver::DynamicMeshUpdate(unsigned long TimeIter) { harmonic_balance = (config_container[iZone]->GetTime_Marching() == HARMONIC_BALANCE); /*--- Dynamic mesh update ---*/ if ((config_container[iZone]->GetGrid_Movement()) && (!harmonic_balance) && (!fsi)) { - iteration_container[iZone][INST_0]->SetGrid_Movement(geometry_container[iZone][INST_0],surface_movement[iZone], + iteration_container[iZone][INST_0]->SetGrid_Movement(geometry_container[iZone][INST_0],surface_movement[iZone], grid_movement[iZone][INST_0], solver_container[iZone][INST_0], config_container[iZone], 0, TimeIter); } @@ -539,7 +539,7 @@ void CMultizoneDriver::DynamicMeshUpdate(unsigned short val_iZone, unsigned long /*--- Legacy dynamic mesh update - Only if GRID_MOVEMENT = YES ---*/ 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], + 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); } @@ -647,27 +647,27 @@ bool CMultizoneDriver::Transfer_Data(unsigned short donorZone, unsigned short ta } bool CMultizoneDriver::Monitor(unsigned long TimeIter){ - + unsigned long nOuterIter, OuterIter, nTimeIter; su2double MaxTime, CurTime; bool TimeDomain, InnerConvergence, FinalTimeReached, MaxIterationsReached; - + OuterIter = driver_config->GetOuterIter(); nOuterIter = driver_config->GetnOuter_Iter(); nTimeIter = driver_config->GetnTime_Iter(); MaxTime = driver_config->GetMax_Time(); CurTime = driver_output->GetHistoryFieldValue("CUR_TIME"); - + TimeDomain = driver_config->GetTime_Domain(); - - + + /*--- Check whether the inner solver has converged --- */ if (TimeDomain == NO){ - - InnerConvergence = driver_output->GetConvergence(); + + InnerConvergence = driver_output->GetConvergence(); MaxIterationsReached = OuterIter+1 >= nOuterIter; - + if ((MaxIterationsReached || InnerConvergence) && (rank == MASTER_NODE)) { cout << endl << "----------------------------- Solver Exit -------------------------------" << endl; if (InnerConvergence) cout << "All convergence criteria satisfied." << endl; @@ -675,28 +675,28 @@ bool CMultizoneDriver::Monitor(unsigned long TimeIter){ driver_output->PrintConvergenceSummary(); cout << "-------------------------------------------------------------------------" << endl; } - + StopCalc = MaxIterationsReached || InnerConvergence; } if (TimeDomain == YES) { - + /*--- Check whether the outer time integration has reached the final time ---*/ - + FinalTimeReached = CurTime >= MaxTime; - MaxIterationsReached = TimeIter+1 >= nTimeIter; - + MaxIterationsReached = TimeIter+1 >= nTimeIter; + if ((FinalTimeReached || MaxIterationsReached) && (rank == MASTER_NODE)){ cout << endl << "----------------------------- Solver Exit -------------------------------"; if (FinalTimeReached) cout << endl << "Maximum time reached (MAX_TIME = " << MaxTime << "s)." << endl; else cout << endl << "Maximum number of time iterations reached (TIME_ITER = " << nTimeIter << ")." << endl; - cout << "-------------------------------------------------------------------------" << endl; + cout << "-------------------------------------------------------------------------" << endl; } - + StopCalc = FinalTimeReached || MaxIterationsReached; } return StopCalc; - + } diff --git a/SU2_CFD/src/drivers/CSinglezoneDriver.cpp b/SU2_CFD/src/drivers/CSinglezoneDriver.cpp index 4e9e8a066fa..1cf37621d9c 100644 --- a/SU2_CFD/src/drivers/CSinglezoneDriver.cpp +++ b/SU2_CFD/src/drivers/CSinglezoneDriver.cpp @@ -55,13 +55,13 @@ CSinglezoneDriver::~CSinglezoneDriver(void) { } void CSinglezoneDriver::StartSolver() { - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + config_container[ZONE_0]->Set_StartTime(StartTime); /*--- Main external loop of the solver. Runs for the number of time steps required. ---*/ @@ -72,14 +72,14 @@ void CSinglezoneDriver::StartSolver() { if (rank == MASTER_NODE){ cout << endl <<"Simulation Run using the Single-zone Driver" << endl; if (driver_config->GetTime_Domain()) - cout << "The simulation will run for " + cout << "The simulation will run for " << driver_config->GetnTime_Iter() - config_container[ZONE_0]->GetRestart_Iter() << " time steps." << endl; } /*--- Set the initial time iteration to the restart iteration. ---*/ if (config_container[ZONE_0]->GetRestart() && driver_config->GetTime_Domain()) TimeIter = config_container[ZONE_0]->GetRestart_Iter(); - + /*--- Run the problem until the number of time iterations required is reached. ---*/ while ( TimeIter < config_container[ZONE_0]->GetnTime_Iter() ) { @@ -118,24 +118,24 @@ void CSinglezoneDriver::StartSolver() { } void CSinglezoneDriver::Preprocess(unsigned long TimeIter) { - + /*--- Set runtime option ---*/ - + Runtime_Options(); - + /*--- Set the current time iteration in the config ---*/ - + config_container[ZONE_0]->SetTimeIter(TimeIter); /*--- Store the current physical time in the config container, as this can be used for verification / MMS. This should also be more general once the drivers are more stable. ---*/ - + if (config_container[ZONE_0]->GetTime_Marching()) config_container[ZONE_0]->SetPhysicalTime(static_cast(TimeIter)*config_container[ZONE_0]->GetDelta_UnstTimeND()); else config_container[ZONE_0]->SetPhysicalTime(0.0); - + /*--- Set the initial condition for EULER/N-S/RANS ---------------------------------------------*/ if ((config_container[ZONE_0]->GetKind_Solver() == EULER) || (config_container[ZONE_0]->GetKind_Solver() == NAVIER_STOKES) || @@ -209,13 +209,13 @@ void CSinglezoneDriver::Output(unsigned long TimeIter) { #else StartTime = MPI_Wtime(); #endif - + bool wrote_files = output_container[ZONE_0]->SetResult_Files(geometry_container[ZONE_0][INST_0][MESH_0], config_container[ZONE_0], solver_container[ZONE_0][INST_0][MESH_0], TimeIter, StopCalc); - + if (wrote_files){ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else @@ -231,13 +231,13 @@ void CSinglezoneDriver::Output(unsigned long TimeIter) { #endif config_container[ZONE_0]->Set_StartTime(StartTime); } -} +} void CSinglezoneDriver::DynamicMeshUpdate(unsigned long TimeIter) { /*--- Legacy dynamic mesh update - Only if GRID_MOVEMENT = YES ---*/ if (config_container[ZONE_0]->GetGrid_Movement()) { - iteration_container[ZONE_0][INST_0]->SetGrid_Movement(geometry_container[ZONE_0][INST_0],surface_movement[ZONE_0], + iteration_container[ZONE_0][INST_0]->SetGrid_Movement(geometry_container[ZONE_0][INST_0],surface_movement[ZONE_0], grid_movement[ZONE_0][INST_0], solver_container[ZONE_0][INST_0], config_container[ZONE_0], 0, TimeIter); } @@ -260,23 +260,23 @@ bool CSinglezoneDriver::Monitor(unsigned long TimeIter){ unsigned long nInnerIter, InnerIter, nTimeIter; su2double MaxTime, CurTime; bool TimeDomain, InnerConvergence, FinalTimeReached, MaxIterationsReached; - + nInnerIter = config_container[ZONE_0]->GetnInner_Iter(); InnerIter = config_container[ZONE_0]->GetInnerIter(); nTimeIter = config_container[ZONE_0]->GetnTime_Iter(); MaxTime = config_container[ZONE_0]->GetMax_Time(); CurTime = output_container[ZONE_0]->GetHistoryFieldValue("CUR_TIME"); - + TimeDomain = config_container[ZONE_0]->GetTime_Domain(); - - + + /*--- Check whether the inner solver has converged --- */ if (TimeDomain == NO){ - - InnerConvergence = output_container[ZONE_0]->GetConvergence(); + + InnerConvergence = output_container[ZONE_0]->GetConvergence(); MaxIterationsReached = InnerIter+1 >= nInnerIter; - + if ((MaxIterationsReached || InnerConvergence) && (rank == MASTER_NODE)) { cout << endl << "----------------------------- Solver Exit -------------------------------" << endl; if (InnerConvergence) cout << "All convergence criteria satisfied." << endl; @@ -284,52 +284,52 @@ bool CSinglezoneDriver::Monitor(unsigned long TimeIter){ output_container[ZONE_0]->PrintConvergenceSummary(); cout << "-------------------------------------------------------------------------" << endl; } - + StopCalc = MaxIterationsReached || InnerConvergence; } if (TimeDomain == YES) { - + /*--- Check whether the outer time integration has reached the final time ---*/ - + FinalTimeReached = CurTime >= MaxTime; - MaxIterationsReached = TimeIter+1 >= nTimeIter; - + MaxIterationsReached = TimeIter+1 >= nTimeIter; + if ((FinalTimeReached || MaxIterationsReached) && (rank == MASTER_NODE)){ cout << endl << "----------------------------- Solver Exit -------------------------------"; if (FinalTimeReached) cout << endl << "Maximum time reached (MAX_TIME = " << MaxTime << "s)." << endl; else cout << endl << "Maximum number of time iterations reached (TIME_ITER = " << nTimeIter << ")." << endl; - cout << "-------------------------------------------------------------------------" << endl; + cout << "-------------------------------------------------------------------------" << endl; } - + StopCalc = FinalTimeReached || MaxIterationsReached; } /*--- Reset the inner convergence --- */ - + output_container[ZONE_0]->SetConvergence(false); - + /*--- Increase the total iteration count --- */ - + IterCount += config_container[ZONE_0]->GetInnerIter()+1; return StopCalc; } void CSinglezoneDriver::Runtime_Options(){ - + ifstream runtime_configfile; - + /*--- Try to open the runtime config file ---*/ - + runtime_configfile.open(runtime_file_name, ios::in); - + /*--- If succeeded create a temporary config object ---*/ - + if (runtime_configfile.good()){ CConfig *runtime = new CConfig(runtime_file_name, config_container[ZONE_0]); delete runtime; } - + } diff --git a/SU2_CFD/src/interfaces/CInterface.cpp b/SU2_CFD/src/interfaces/CInterface.cpp index 05d1893fc66..99d3b3ffc86 100644 --- a/SU2_CFD/src/interfaces/CInterface.cpp +++ b/SU2_CFD/src/interfaces/CInterface.cpp @@ -446,8 +446,8 @@ void CInterface::PreprocessAverage(CGeometry *donor_geometry, CGeometry *target_ CConfig *donor_config, CConfig *target_config, unsigned short iMarkerInt){ - unsigned short nMarkerDonor, nMarkerTarget; // Number of markers on the interface, donor and target side - unsigned short iMarkerDonor, iMarkerTarget; // Variables for iteration over markers + unsigned short nMarkerDonor, nMarkerTarget; // Number of markers on the interface, donor and target side + unsigned short iMarkerDonor, iMarkerTarget; // Variables for iteration over markers unsigned short iSpan,jSpan, tSpan = 0, kSpan = 0, nSpanDonor, nSpanTarget, Donor_Flag = 0, Target_Flag = 0; int Marker_Donor = -1, Marker_Target = -1; @@ -583,8 +583,8 @@ void CInterface::PreprocessAverage(CGeometry *donor_geometry, CGeometry *target_ void CInterface::AllgatherAverage(CSolver *donor_solution, CSolver *target_solution, CGeometry *donor_geometry, CGeometry *target_geometry, CConfig *donor_config, CConfig *target_config, unsigned short iMarkerInt){ - unsigned short nMarkerDonor, nMarkerTarget; // Number of markers on the interface, donor and target side - unsigned short iMarkerDonor, iMarkerTarget; // Variables for iteration over markers + unsigned short nMarkerDonor, nMarkerTarget; // Number of markers on the interface, donor and target side + unsigned short iMarkerDonor, iMarkerTarget; // Variables for iteration over markers unsigned short iSpan, nSpanDonor, nSpanTarget; int Marker_Donor = -1, Marker_Target = -1; su2double *avgPressureDonor = NULL, *avgDensityDonor = NULL, *avgNormalVelDonor = NULL, diff --git a/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp b/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp index fd41ca638c6..19d23426b40 100644 --- a/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp +++ b/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp @@ -88,7 +88,7 @@ void CMixingPlaneInterface::GetDonor_Variable(CSolver *donor_solution, CGeometry Donor_Variable[0] = donor_solution->GetAverageDensity(Marker_Donor, iSpan); - Donor_Variable[1] = donor_solution->GetAveragePressure(Marker_Donor, iSpan); + Donor_Variable[1] = donor_solution->GetAveragePressure(Marker_Donor, iSpan); Donor_Variable[2] = donor_solution->GetAverageTurboVelocity(Marker_Donor, iSpan)[0]; Donor_Variable[3] = donor_solution->GetAverageTurboVelocity(Marker_Donor, iSpan)[1]; diff --git a/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp b/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp index 513e9ddf30f..8447e78b278 100644 --- a/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp +++ b/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp @@ -99,7 +99,7 @@ void CFlowTractionInterface::GetPhysical_Constants(CSolver *flow_solution, CSolv ModAmpl = struct_solution->Compute_LoadCoefficient(CurrentTime, Ramp_Time, struct_config); Physical_Constants[1] = ModAmpl; - + /*--- For static FSI, we cannot apply the ramp like this ---*/ if ((!flow_config->GetTime_Domain())){ Physical_Constants[1] = 1.0; @@ -154,7 +154,7 @@ void CFlowTractionInterface::GetDonor_Variable(CSolver *flow_solution, CGeometry Point_Flow = flow_geometry->vertex[Marker_Flow][Vertex_Flow]->GetNode(); // Get the normal at the vertex: this normal goes inside the fluid domain. Normal_Flow = flow_geometry->vertex[Marker_Flow][Vertex_Flow]->GetNormal(); - + if (consistent_interpolation) for (iVar = 0; iVar < nVar; ++iVar) area += Normal_Flow[iVar]*Normal_Flow[iVar]; else diff --git a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp index e9901ab8504..5b7ea434e10 100644 --- a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp @@ -41,13 +41,13 @@ #include "../../include/solver_structure.hpp" CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : COutput(config, nDim, false) { - + turb_model = config->GetKind_Turb_Model(); - + cont_adj = config->GetContinuous_Adjoint(); - + /*--- Set the default history fields if nothing is set in the config file ---*/ - + if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); @@ -56,7 +56,7 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C } if (nRequestedScreenFields == 0){ - if (config->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); + if (config->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); if (multiZone) requestedScreenFields.emplace_back("OUTER_ITER"); requestedScreenFields.emplace_back("INNER_ITER"); requestedScreenFields.emplace_back("RMS_ADJ_DENSITY"); @@ -65,47 +65,47 @@ CAdjFlowCompOutput::CAdjFlowCompOutput(CConfig *config, unsigned short nDim) : C requestedScreenFields.emplace_back("SENS_AOA"); nRequestedScreenFields = requestedScreenFields.size(); } - + if (nRequestedVolumeFields == 0){ requestedVolumeFields.emplace_back("COORDINATES"); - requestedVolumeFields.emplace_back("SOLUTION"); + requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("SENSITIVITY"); nRequestedVolumeFields = requestedVolumeFields.size(); } - + stringstream ss; ss << "Zone " << config->GetiZone() << " (Adj. Comp. Fluid)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetAdj_FileName(); - + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfAdjCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_AdjFileName(); - + /*--- Add the obj. function extension --- */ - + restartFilename = config->GetObjFunc_Extension(restartFilename); /*--- Set the default convergence field --- */ if (convFields.empty() ) convFields.emplace_back("RMS_ADJ_DENSITY"); - + } CAdjFlowCompOutput::~CAdjFlowCompOutput(void) {} void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config){ - /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. + /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. /// DESCRIPTION: Root-mean square residual of the adjoint density. - AddHistoryOutput("RMS_ADJ_DENSITY", "rms[A_Rho]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint density.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("RMS_ADJ_DENSITY", "rms[A_Rho]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint density.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint momentum x-component. AddHistoryOutput("RMS_ADJ_MOMENTUM-X", "rms[A_RhoU]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint momentum x-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint momentum y-component. @@ -113,101 +113,101 @@ void CAdjFlowCompOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: Root-mean square residual of the adjoint momentum z-component. AddHistoryOutput("RMS_ADJ_MOMENTUM-Z", "rms[A_RhoW]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint momentum z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint energy. - AddHistoryOutput("RMS_ADJ_ENERGY", "rms[A_E]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint energy.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("RMS_ADJ_ENERGY", "rms[A_E]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint energy.", HistoryFieldType::RESIDUAL); if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Root-mean square residual of the adjoint nu tilde. - AddHistoryOutput("RMS_ADJ_NU_TILDE", "rms[A_nu]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); - break; + AddHistoryOutput("RMS_ADJ_NU_TILDE", "rms[A_nu]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); + break; case SST: /// DESCRIPTION: Root-mean square residual of the adjoint kinetic energy. AddHistoryOutput("RMS_ADJ_TKE", "rms[A_k]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint dissipation. - AddHistoryOutput("RMS_ADJ_DISSIPATION", "rms[A_w]", ScreenOutputFormat::FIXED, "RMS_RES", " Root-mean square residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("RMS_ADJ_DISSIPATION", "rms[A_w]", ScreenOutputFormat::FIXED, "RMS_RES", " Root-mean square residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); break; default: break; } } /// END_GROUP - - /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. + + /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. /// DESCRIPTION: Maximum residual of the adjoint density. AddHistoryOutput("MAX_ADJ_DENSITY", "max[A_Rho]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint density.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint momentum x-component - AddHistoryOutput("MAX_ADJ_MOMENTUM-X", "max[A_RhoU]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum x-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_MOMENTUM-X", "max[A_RhoU]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum x-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint momentum y-component - AddHistoryOutput("MAX_ADJ_MOMENTUM-Y", "max[A_RhoV]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum y-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_MOMENTUM-Y", "max[A_RhoV]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint momentum z-component - AddHistoryOutput("MAX_ADJ_MOMENTUM-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_MOMENTUM-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint energy. - AddHistoryOutput("MAX_ADJ_ENERGY", "max[A_E]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint energy.", HistoryFieldType::RESIDUAL); - if (!config->GetFrozen_Visc_Disc()){ + AddHistoryOutput("MAX_ADJ_ENERGY", "max[A_E]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint energy.", HistoryFieldType::RESIDUAL); + if (!config->GetFrozen_Visc_Disc()){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Maximum residual of the adjoint nu tilde. - AddHistoryOutput("MAX_ADJ_NU_TILDE", "max[A_nu]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); - break; + AddHistoryOutput("MAX_ADJ_NU_TILDE", "max[A_nu]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); + break; case SST: /// DESCRIPTION: Maximum residual of the adjoint kinetic energy. AddHistoryOutput("MAX_ADJ_TKE", "max[A_k]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint dissipation. - AddHistoryOutput("MAX_ADJ_DISSIPATION", "max[A_w]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_DISSIPATION", "max[A_w]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); break; default: break; } } /// END_GROUP - - - /// /// BEGIN_GROUP: BGS_RES, DESCRIPTION: The Block Gauss Seidel residuals of the SOLUTION variables. + + + /// /// BEGIN_GROUP: BGS_RES, DESCRIPTION: The Block Gauss Seidel residuals of the SOLUTION variables. /// DESCRIPTION: BGS residual of the adjoint density. AddHistoryOutput("BGS_ADJ_DENSITY", "bgs[A_Rho]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint density.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint momentum x-component - AddHistoryOutput("BGS_ADJ_MOMENTUM-X", "bgs[A_RhoU]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum x-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_MOMENTUM-X", "bgs[A_RhoU]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum x-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint momentum y-component - AddHistoryOutput("BGS_ADJ_MOMENTUM-Y", "bgs[A_RhoV]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum y-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_MOMENTUM-Y", "bgs[A_RhoV]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint momentum z-component - AddHistoryOutput("BGS_ADJ_MOMENTUM-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_MOMENTUM-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint momentum z-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint energy. - AddHistoryOutput("BGS_ADJ_ENERGY", "bgs[A_E]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint energy.", HistoryFieldType::RESIDUAL); - if (!config->GetFrozen_Visc_Disc()){ + AddHistoryOutput("BGS_ADJ_ENERGY", "bgs[A_E]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint energy.", HistoryFieldType::RESIDUAL); + if (!config->GetFrozen_Visc_Disc()){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: BGS residual of the adjoint nu tilde. - AddHistoryOutput("BGS_ADJ_NU_TILDE", "bgs[A_nu]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); - break; + AddHistoryOutput("BGS_ADJ_NU_TILDE", "bgs[A_nu]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); + break; case SST: /// DESCRIPTION: BGS residual of the adjoint kinetic energy. AddHistoryOutput("BGS_ADJ_TKE", "bgs[A_k]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint dissipation. - AddHistoryOutput("BGS_ADJ_DISSIPATION", "bgs[A_w]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_DISSIPATION", "bgs[A_w]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); break; default: break; } } - + /// END_GROUP - - /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Sensitivities of different geometrical or boundary values. + + /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Sensitivities of different geometrical or boundary values. /// DESCRIPTION: Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING. - AddHistoryOutput("SENS_GEO", "Sens_Geo", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_GEO", "Sens_Geo", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the angle of attack (only for compressible solver). - AddHistoryOutput("SENS_AOA", "Sens_AoA", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the angle of attack (only for compressible solver).", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_AOA", "Sens_AoA", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the angle of attack (only for compressible solver).", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the Mach number (only of compressible solver). - AddHistoryOutput("SENS_MACH", "Sens_Mach", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the Mach number (only of compressible solver).", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_MACH", "Sens_Mach", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the Mach number (only of compressible solver).", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the far-field pressure. - AddHistoryOutput("SENS_PRESS", "Sens_Press", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the far-field pressure.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_PRESS", "Sens_Press", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the far-field pressure.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the far-field temperature. - AddHistoryOutput("SENS_TEMP", "Sens_Temp", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the far-field temperature.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_TEMP", "Sens_Temp", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the far-field temperature.", HistoryFieldType::COEFFICIENT); /// END_GROUP - + } -void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver){ - +void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver){ + CSolver* adjflow_solver = solver[ADJFLOW_SOL]; - CSolver* adjturb_solver = solver[ADJTURB_SOL]; + CSolver* adjturb_solver = solver[ADJTURB_SOL]; SetHistoryOutputValue("RMS_ADJ_DENSITY", log10(adjflow_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_ADJ_MOMENTUM-X", log10(adjflow_solver->GetRes_RMS(1))); @@ -216,13 +216,13 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C SetHistoryOutputValue("RMS_ADJ_MOMENTUM-Z", log10(adjflow_solver->GetRes_RMS(3))); SetHistoryOutputValue("RMS_ADJ_ENERGY", log10(adjflow_solver->GetRes_RMS(4))); } else { - SetHistoryOutputValue("RMS_ADJ_ENERGY", log10(adjflow_solver->GetRes_RMS(3))); + SetHistoryOutputValue("RMS_ADJ_ENERGY", log10(adjflow_solver->GetRes_RMS(3))); } if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("RMS_ADJ_NU_TILDE", log10(adjturb_solver->GetRes_RMS(0))); - break; + break; case SST: SetHistoryOutputValue("RMS_ADJ_TKE", log10(adjturb_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_ADJ_DISSIPATION", log10(adjturb_solver->GetRes_RMS(1))); @@ -237,13 +237,13 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C SetHistoryOutputValue("MAX_ADJ_MOMENTUM-Z", log10(adjflow_solver->GetRes_Max(3))); SetHistoryOutputValue("MAX_ADJ_ENERGY", log10(adjflow_solver->GetRes_Max(4))); } else { - SetHistoryOutputValue("MAX_ADJ_ENERGY", log10(adjflow_solver->GetRes_Max(3))); + SetHistoryOutputValue("MAX_ADJ_ENERGY", log10(adjflow_solver->GetRes_Max(3))); } if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("MAX_ADJ_NU_TILDE", log10(adjturb_solver->GetRes_Max(0))); - break; + break; case SST: SetHistoryOutputValue("MAX_ADJ_TKE", log10(adjturb_solver->GetRes_Max(0))); SetHistoryOutputValue("MAX_ADJ_DISSIPATION", log10(adjturb_solver->GetRes_Max(1))); @@ -251,7 +251,7 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C default: break; } } - + if (multiZone){ SetHistoryOutputValue("BGS_ADJ_DENSITY", log10(adjflow_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_ADJ_MOMENTUM-X", log10(adjflow_solver->GetRes_BGS(1))); @@ -260,13 +260,13 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C SetHistoryOutputValue("BGS_ADJ_MOMENTUM-Z", log10(adjflow_solver->GetRes_BGS(3))); SetHistoryOutputValue("BGS_ADJ_ENERGY", log10(adjflow_solver->GetRes_BGS(4))); } else { - SetHistoryOutputValue("BGS_ADJ_ENERGY", log10(adjflow_solver->GetRes_BGS(3))); + SetHistoryOutputValue("BGS_ADJ_ENERGY", log10(adjflow_solver->GetRes_BGS(3))); } if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("BGS_ADJ_NU_TILDE", log10(adjturb_solver->GetRes_BGS(0))); - break; + break; case SST: SetHistoryOutputValue("BGS_ADJ_TKE", log10(adjturb_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_ADJ_DISSIPATION", log10(adjturb_solver->GetRes_BGS(1))); @@ -275,7 +275,7 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C } } } - + SetHistoryOutputValue("SENS_GEO", adjflow_solver->GetTotal_Sens_Geo()); SetHistoryOutputValue("SENS_AOA", adjflow_solver->GetTotal_Sens_AoA() * PI_NUMBER / 180.0); SetHistoryOutputValue("SENS_MACH", adjflow_solver->GetTotal_Sens_Mach()); @@ -285,62 +285,62 @@ void CAdjFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C } void CAdjFlowCompOutput::SetVolumeOutputFields(CConfig *config){ - + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); if (nDim == 3) AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); - + /// BEGIN_GROUP: SOLUTION, DESCRIPTION: The SOLUTION variables of the adjoint solver. /// DESCRIPTION: Adjoint density. - AddVolumeOutput("ADJ_DENSITY", "Adjoint_Density", "SOLUTION", "Adjoint density"); + AddVolumeOutput("ADJ_DENSITY", "Adjoint_Density", "SOLUTION", "Adjoint density"); /// DESCRIPTION: Adjoint momentum x-component. - AddVolumeOutput("ADJ_MOMENTUM-X", "Adjoint_Momentum_x", "SOLUTION", "x-component of the adjoint momentum vector"); + AddVolumeOutput("ADJ_MOMENTUM-X", "Adjoint_Momentum_x", "SOLUTION", "x-component of the adjoint momentum vector"); /// DESCRIPTION: Adjoint momentum y-component. - AddVolumeOutput("ADJ_MOMENTUM-Y", "Adjoint_Momentum_y", "SOLUTION", "y-component of the adjoint momentum vector"); + AddVolumeOutput("ADJ_MOMENTUM-Y", "Adjoint_Momentum_y", "SOLUTION", "y-component of the adjoint momentum vector"); if (nDim == 3) /// DESCRIPTION: Adjoint momentum z-component. - AddVolumeOutput("ADJ_MOMENTUM-Z", "Adjoint_Momentum_z", "SOLUTION", "z-component of the adjoint momentum vector"); + AddVolumeOutput("ADJ_MOMENTUM-Z", "Adjoint_Momentum_z", "SOLUTION", "z-component of the adjoint momentum vector"); /// DESCRIPTION: Adjoint energy. - AddVolumeOutput("ADJ_ENERGY", "Adjoint_Energy", "SOLUTION", "Adjoint energy"); + AddVolumeOutput("ADJ_ENERGY", "Adjoint_Energy", "SOLUTION", "Adjoint energy"); if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Adjoint nu tilde. - AddVolumeOutput("ADJ_NU_TILDE", "Adjoint_Nu_Tilde", "SOLUTION", "Adjoint Spalart-Allmaras variable"); - break; + AddVolumeOutput("ADJ_NU_TILDE", "Adjoint_Nu_Tilde", "SOLUTION", "Adjoint Spalart-Allmaras variable"); + break; case SST: /// DESCRIPTION: Adjoint kinetic energy. AddVolumeOutput("ADJ_TKE", "Adjoint_TKE", "SOLUTION", "Adjoint kinetic energy"); /// DESCRIPTION: Adjoint dissipation. - AddVolumeOutput("ADJ_DISSIPATION", "Adjoint_Omega", "SOLUTION", "Adjoint rate of dissipation"); + AddVolumeOutput("ADJ_DISSIPATION", "Adjoint_Omega", "SOLUTION", "Adjoint rate of dissipation"); break; default: break; } } /// END_GROUP - /// BEGIN_GROUP: RESIDUAL, DESCRIPTION: Residuals of the SOLUTION variables. + /// BEGIN_GROUP: RESIDUAL, DESCRIPTION: Residuals of the SOLUTION variables. /// DESCRIPTION: Residual of the adjoint density. - AddVolumeOutput("RES_ADJ_DENSITY", "Residual_Adjoint_Density", "RESIDUAL", "Residual of the adjoint density"); + AddVolumeOutput("RES_ADJ_DENSITY", "Residual_Adjoint_Density", "RESIDUAL", "Residual of the adjoint density"); /// DESCRIPTION: Residual of the adjoint momentum x-component. - AddVolumeOutput("RES_ADJ_MOMENTUM-X", "Residual_Adjoint_Momentum_x", "RESIDUAL", "Residual of the adjoint x-momentum"); + AddVolumeOutput("RES_ADJ_MOMENTUM-X", "Residual_Adjoint_Momentum_x", "RESIDUAL", "Residual of the adjoint x-momentum"); /// DESCRIPTION: Residual of the adjoint momentum y-component. - AddVolumeOutput("RES_ADJ_MOMENTUM-Y", "Residual_Adjoint_Momentum_y", "RESIDUAL", "Residual of the adjoint y-momentum"); + AddVolumeOutput("RES_ADJ_MOMENTUM-Y", "Residual_Adjoint_Momentum_y", "RESIDUAL", "Residual of the adjoint y-momentum"); if (nDim == 3) /// DESCRIPTION: Residual of the adjoint momentum z-component. - AddVolumeOutput("RES_ADJ_MOMENTUM-Z", "Residual_Adjoint_Momentum_z", "RESIDUAL", "Residual of the adjoint z-momentum"); - /// DESCRIPTION: Residual of the adjoint energy. - AddVolumeOutput("RES_ADJ_ENERGY", "Residual_Adjoint_Energy", "RESIDUAL", "Residual of the adjoint energy"); + AddVolumeOutput("RES_ADJ_MOMENTUM-Z", "Residual_Adjoint_Momentum_z", "RESIDUAL", "Residual of the adjoint z-momentum"); + /// DESCRIPTION: Residual of the adjoint energy. + AddVolumeOutput("RES_ADJ_ENERGY", "Residual_Adjoint_Energy", "RESIDUAL", "Residual of the adjoint energy"); if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: - /// DESCRIPTION: Residual of the nu tilde. - AddVolumeOutput("RES_ADJ_NU_TILDE", "Residual_Adjoint_Nu_Tilde", "RESIDUAL", "Residual of the Spalart-Allmaras variable"); - break; + /// DESCRIPTION: Residual of the nu tilde. + AddVolumeOutput("RES_ADJ_NU_TILDE", "Residual_Adjoint_Nu_Tilde", "RESIDUAL", "Residual of the Spalart-Allmaras variable"); + break; case SST: - /// DESCRIPTION: Residual of the adjoint kinetic energy. + /// DESCRIPTION: Residual of the adjoint kinetic energy. AddVolumeOutput("RES_ADJ_TKE", "Residual_Adjoint_TKE", "RESIDUAL", "Residual of the turb. kinetic energy"); /// DESCRIPTION: Residual of the adjoint dissipation. AddVolumeOutput("RES_ADJ_DISSIPATION", "Residual_Adjoint_Omega", "RESIDUAL", "Residual of the rate of dissipation"); @@ -349,38 +349,38 @@ void CAdjFlowCompOutput::SetVolumeOutputFields(CConfig *config){ } } /// END_GROUP - + /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Geometrical sensitivities of the current objective function. /// DESCRIPTION: Sensitivity x-component. - AddVolumeOutput("SENSITIVITY-X", "Sensitivity_x", "SENSITIVITY", "x-component of the sensitivity vector"); + AddVolumeOutput("SENSITIVITY-X", "Sensitivity_x", "SENSITIVITY", "x-component of the sensitivity vector"); /// DESCRIPTION: Sensitivity y-component. AddVolumeOutput("SENSITIVITY-Y", "Sensitivity_y", "SENSITIVITY", "y-component of the sensitivity vector"); if (nDim == 3) /// DESCRIPTION: Sensitivity z-component. - AddVolumeOutput("SENSITIVITY-Z", "Sensitivity_z", "SENSITIVITY", "z-component of the sensitivity vector"); + AddVolumeOutput("SENSITIVITY-Z", "Sensitivity_z", "SENSITIVITY", "z-component of the sensitivity vector"); /// DESCRIPTION: Sensitivity in normal direction. - AddVolumeOutput("SENSITIVITY", "Surface_Sensitivity", "SENSITIVITY", "sensitivity in normal direction"); + AddVolumeOutput("SENSITIVITY", "Surface_Sensitivity", "SENSITIVITY", "sensitivity in normal direction"); /// END_GROUP - + } void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - - CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->GetNodes(); + + 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) || + + if (config->GetKind_Turb_Model() != NONE && + ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj))){ - Node_AdjTurb = solver[ADJTURB_SOL]->GetNodes(); + Node_AdjTurb = solver[ADJTURB_SOL]->GetNodes(); } - - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(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)); @@ -388,25 +388,25 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS 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(iPoint, 3)); + SetVolumeOutputValue("ADJ_ENERGY", iPoint, Node_AdjFlow->GetSolution(iPoint, 3)); } - + if ((!config->GetFrozen_Visc_Disc() && !cont_adj) || (!config->GetFrozen_Visc_Cont() && cont_adj)){ - // Turbulent + // Turbulent switch(turb_model){ case SST: 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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: SetVolumeOutputValue("ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0)); break; case NONE: break; } } - + // Residuals 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)); @@ -415,49 +415,49 @@ void CAdjFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CS 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(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 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)){ + + 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(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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: 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(iPoint, 0)); SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 1)); if (nDim == 3) SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 2)); - + } void CAdjFlowCompOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ - + SetVolumeOutputValue("SENSITIVITY", iPoint, solver[ADJFLOW_SOL]->GetCSensitivity(iMarker, iVertex)); - + } bool CAdjFlowCompOutput::SetInit_Residuals(CConfig *config){ - - return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| - (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); - + + return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| + (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); + } bool CAdjFlowCompOutput::SetUpdate_Averages(CConfig *config){ return false; - + // return (config->GetUnsteady_Simulation() != STEADY && !dualtime); - + } diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 1bd2bc35005..da24617d1cc 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -41,58 +41,58 @@ #include "../../include/solver_structure.hpp" CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : COutput(config, nDim, false) { - + turb_model = config->GetKind_Turb_Model(); - + heat = config->GetEnergy_Equation(); - + weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); - + /*--- Set the default history fields if nothing is set in the config file ---*/ - + if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); requestedHistoryFields.emplace_back("SENSITIVITY"); nRequestedHistoryFields = requestedHistoryFields.size(); } - + if (nRequestedScreenFields == 0){ - if (config->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); + if (config->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); if (multiZone) requestedScreenFields.emplace_back("OUTER_ITER"); - requestedScreenFields.emplace_back("INNER_ITER"); + requestedScreenFields.emplace_back("INNER_ITER"); requestedScreenFields.emplace_back("RMS_ADJ_PRESSURE"); requestedScreenFields.emplace_back("RMS_ADJ_VELOCITY-X"); requestedScreenFields.emplace_back("SENS_GEO"); requestedScreenFields.emplace_back("SENS_AOA"); nRequestedScreenFields = requestedScreenFields.size(); } - + if (nRequestedVolumeFields == 0){ requestedVolumeFields.emplace_back("COORDINATES"); - requestedVolumeFields.emplace_back("SOLUTION"); + requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("SENSITIVITY"); nRequestedVolumeFields = requestedVolumeFields.size(); } - + stringstream ss; ss << "Zone " << config->GetiZone() << " (Adj. Incomp. Fluid)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetAdj_FileName(); - + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfAdjCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_AdjFileName(); - + /*--- Add the obj. function extension --- */ - + restartFilename = config->GetObjFunc_Extension(restartFilename); /*--- Set the default convergence field --- */ @@ -104,10 +104,10 @@ CAdjFlowIncOutput::CAdjFlowIncOutput(CConfig *config, unsigned short nDim) : COu CAdjFlowIncOutput::~CAdjFlowIncOutput(void) {} void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ - - /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. + + /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. /// DESCRIPTION: Root-mean square residual of the adjoint Pressure. - AddHistoryOutput("RMS_ADJ_PRESSURE", "rms[A_P]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint Pressure.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("RMS_ADJ_PRESSURE", "rms[A_P]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint Pressure.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint Velocity x-component. AddHistoryOutput("RMS_ADJ_VELOCITY-X", "rms[A_U]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint Velocity x-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint Velocity y-component. @@ -120,94 +120,94 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Root-mean square residual of the adjoint nu tilde. - AddHistoryOutput("RMS_ADJ_NU_TILDE", "rms[A_nu]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); - break; + AddHistoryOutput("RMS_ADJ_NU_TILDE", "rms[A_nu]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); + break; case SST: /// DESCRIPTION: Root-mean square residual of the adjoint kinetic energy. - AddHistoryOutput("RMS_ADJ_TKE", "rms[A_k]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("RMS_ADJ_TKE", "rms[A_k]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the adjoint dissipation. - AddHistoryOutput("RMS_ADJ_DISSIPATION", "rms[A_w]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("RMS_ADJ_DISSIPATION", "rms[A_w]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); break; default: break; } } /// END_GROUP - - /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. + + /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. /// DESCRIPTION: Maximum residual of the adjoint Pressure. AddHistoryOutput("MAX_ADJ_PRESSURE", "max[A_Rho]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Pressure.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint Velocity x-component - AddHistoryOutput("MAX_ADJ_VELOCITY-X", "max[A_RhoU]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity x-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_VELOCITY-X", "max[A_RhoU]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity x-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint Velocity y-component - AddHistoryOutput("MAX_ADJ_VELOCITY-Y", "max[A_RhoV]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity y-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_VELOCITY-Y", "max[A_RhoV]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint Velocity z-component - AddHistoryOutput("MAX_ADJ_VELOCITY-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_VELOCITY-Z", "max[A_RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature.", HistoryFieldType::RESIDUAL); if (!config->GetFrozen_Visc_Disc() || !config->GetFrozen_Visc_Cont()){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Maximum residual of the adjoint nu tilde. - AddHistoryOutput("MAX_ADJ_NU_TILDE", "max[A_nu]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); - break; + AddHistoryOutput("MAX_ADJ_NU_TILDE", "max[A_nu]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); + break; case SST: /// DESCRIPTION: Maximum residual of the adjoint kinetic energy. - AddHistoryOutput("MAX_ADJ_TKE", "max[A_k]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_TKE", "max[A_k]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the adjoint dissipation. - AddHistoryOutput("MAX_ADJ_DISSIPATION", "max[A_w]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("MAX_ADJ_DISSIPATION", "max[A_w]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); break; default: break; } } /// END_GROUP - - /// BEGIN_GROUP: BGS_RES, DESCRIPTION: The block Gauss Seidel residuals of the SOLUTION variables. + + /// BEGIN_GROUP: BGS_RES, DESCRIPTION: The block Gauss Seidel residuals of the SOLUTION variables. /// DESCRIPTION: BGS residual of the adjoint Pressure. AddHistoryOutput("BGS_ADJ_PRESSURE", "bgs[A_Rho]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Pressure.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint Velocity x-component - AddHistoryOutput("BGS_ADJ_VELOCITY-X", "bsg[A_RhoU]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity x-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_VELOCITY-X", "bsg[A_RhoU]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity x-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint Velocity y-component - AddHistoryOutput("BGS_ADJ_VELOCITY-Y", "bgs[A_RhoV]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity y-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_VELOCITY-Y", "bgs[A_RhoV]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity y-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint Velocity z-component - AddHistoryOutput("BGS_ADJ_VELOCITY-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_VELOCITY-Z", "bgs[A_RhoW]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint Velocity z-component", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the temperature. AddHistoryOutput("BGS_ADJ_TEMPERATURE", "bgs[A_T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); if (!config->GetFrozen_Visc_Disc() || !config->GetFrozen_Visc_Cont()){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: BGS residual of the adjoint nu tilde. - AddHistoryOutput("BGS_ADJ_NU_TILDE", "bsg[A_nu]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); - break; + AddHistoryOutput("BGS_ADJ_NU_TILDE", "bsg[A_nu]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint nu tilde.", HistoryFieldType::RESIDUAL); + break; case SST: /// DESCRIPTION: BGS residual of the adjoint kinetic energy. - AddHistoryOutput("BGS_ADJ_TKE", "bgs[A_k]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_TKE", "bgs[A_k]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint kinetic energy.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: BGS residual of the adjoint dissipation. - AddHistoryOutput("BGS_ADJ_DISSIPATION", "bgs[A_w]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("BGS_ADJ_DISSIPATION", "bgs[A_w]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint dissipation.", HistoryFieldType::RESIDUAL); break; default: break; } } /// END_GROUP - - /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Sensitivities of different geometrical or boundary values. + + /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Sensitivities of different geometrical or boundary values. /// DESCRIPTION: Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING. - AddHistoryOutput("SENS_GEO", "Sens_Geo", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_GEO", "Sens_Geo", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the far-field pressure. - AddHistoryOutput("SENS_PRESS", "Sens_Press", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the far-field pressure.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_PRESS", "Sens_Press", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the far-field pressure.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the far-field temperature. - AddHistoryOutput("SENS_TEMP", "Sens_Temp", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", " Sensitivity of the objective function with respect to the far-field temperature.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_TEMP", "Sens_Temp", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", " Sensitivity of the objective function with respect to the far-field temperature.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the inlet velocity. - AddHistoryOutput("SENS_VEL_IN", "Sens_Vin", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", " Sensitivity of the objective function with respect to the inlet velocity.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_VEL_IN", "Sens_Vin", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", " Sensitivity of the objective function with respect to the inlet velocity.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Sensitivity of the objective function with respect to the outlet pressure. - AddHistoryOutput("SENS_PRESS_OUT", "Sens_Pout", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the outlet pressure.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_PRESS_OUT", "Sens_Pout", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sensitivity of the objective function with respect to the outlet pressure.", HistoryFieldType::COEFFICIENT); /// END_GROUP - + } -void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { - +void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { + CSolver* adjflow_solver = solver[ADJFLOW_SOL]; - CSolver* adjturb_solver = solver[ADJTURB_SOL]; + CSolver* adjturb_solver = solver[ADJTURB_SOL]; CSolver* adjheat_solver = solver[ADJHEAT_SOL]; SetHistoryOutputValue("RMS_ADJ_PRESSURE", log10(adjflow_solver->GetRes_RMS(0))); @@ -227,7 +227,7 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("RMS_ADJ_NU_TILDE", log10(adjturb_solver->GetRes_RMS(0))); - break; + break; case SST: SetHistoryOutputValue("RMS_ADJ_TKE", log10(adjturb_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_ADJ_DISSIPATION", log10(adjturb_solver->GetRes_RMS(1))); @@ -252,7 +252,7 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("MAX_ADJ_NU_TILDE", log10(adjturb_solver->GetRes_Max(0))); - break; + break; case SST: SetHistoryOutputValue("MAX_ADJ_TKE", log10(adjturb_solver->GetRes_Max(0))); SetHistoryOutputValue("MAX_ADJ_DISSIPATION", log10(adjturb_solver->GetRes_Max(1))); @@ -260,7 +260,7 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS default: break; } } - + if (multiZone){ SetHistoryOutputValue("BGS_ADJ_PRESSURE", log10(adjflow_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_ADJ_VELOCITY-X", log10(adjflow_solver->GetRes_BGS(1))); @@ -279,7 +279,7 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("BGS_ADJ_NU_TILDE", log10(adjturb_solver->GetRes_BGS(0))); - break; + break; case SST: SetHistoryOutputValue("BGS_ADJ_TKE", log10(adjturb_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_ADJ_DISSIPATION", log10(adjturb_solver->GetRes_BGS(1))); @@ -288,7 +288,7 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS } } } - + SetHistoryOutputValue("SENS_GEO", adjflow_solver->GetTotal_Sens_Geo()); SetHistoryOutputValue("SENS_PRESS", adjflow_solver->GetTotal_Sens_Press()); SetHistoryOutputValue("SENS_TEMP", adjflow_solver->GetTotal_Sens_Temp()); @@ -298,74 +298,74 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS } void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ - - + + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); if (nDim == 3) AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); - + /// BEGIN_GROUP: SOLUTION, DESCRIPTION: The SOLUTION variables of the adjoint solver. /// DESCRIPTION: Adjoint Pressure. - AddVolumeOutput("ADJ_PRESSURE", "Adjoint_Pressure", "SOLUTION", "Adjoint pressure"); + AddVolumeOutput("ADJ_PRESSURE", "Adjoint_Pressure", "SOLUTION", "Adjoint pressure"); /// DESCRIPTION: Adjoint Velocity x-component. - AddVolumeOutput("ADJ_VELOCITY-X", "Adjoint_Velocity_x", "SOLUTION", "x-component of the adjoint velocity vector"); + AddVolumeOutput("ADJ_VELOCITY-X", "Adjoint_Velocity_x", "SOLUTION", "x-component of the adjoint velocity vector"); /// DESCRIPTION: Adjoint Velocity y-component. - AddVolumeOutput("ADJ_VELOCITY-Y", "Adjoint_Velocity_y", "SOLUTION", "y-component of the adjoint velocity vector"); + AddVolumeOutput("ADJ_VELOCITY-Y", "Adjoint_Velocity_y", "SOLUTION", "y-component of the adjoint velocity vector"); if (nDim == 3) /// DESCRIPTION: Adjoint Velocity z-component. - AddVolumeOutput("ADJ_VELOCITY-Z", "Adjoint_Velocity_z", "SOLUTION", "z-component of the adjoint velocity vector"); + AddVolumeOutput("ADJ_VELOCITY-Z", "Adjoint_Velocity_z", "SOLUTION", "z-component of the adjoint velocity vector"); AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION", "Adjoint temperature"); - if (!config->GetFrozen_Visc_Disc()){ + if (!config->GetFrozen_Visc_Disc()){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Adjoint nu tilde. - AddVolumeOutput("ADJ_NU_TILDE", "Adjoint_Nu_Tilde", "SOLUTION", "Adjoint Spalart-Allmaras variable"); - break; + AddVolumeOutput("ADJ_NU_TILDE", "Adjoint_Nu_Tilde", "SOLUTION", "Adjoint Spalart-Allmaras variable"); + break; case SST: /// DESCRIPTION: Adjoint kinetic energy. - AddVolumeOutput("ADJ_TKE", "Adjoint_TKE", "SOLUTION", "Adjoint turbulent kinetic energy"); + AddVolumeOutput("ADJ_TKE", "Adjoint_TKE", "SOLUTION", "Adjoint turbulent kinetic energy"); /// DESCRIPTION: Adjoint dissipation. - AddVolumeOutput("ADJ_DISSIPATION", "Adjoint_Omega", "SOLUTION", "Adjoint rate of dissipation"); + AddVolumeOutput("ADJ_DISSIPATION", "Adjoint_Omega", "SOLUTION", "Adjoint rate of dissipation"); break; default: break; } } /// END_GROUP - + // Grid velocity if (config->GetGrid_Movement()){ AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); - if (nDim == 3 ) + if (nDim == 3 ) AddVolumeOutput("GRID_VELOCITY-Z", "Grid_Velocity_z", "GRID_VELOCITY", "z-component of the grid velocity vector"); } - - /// BEGIN_GROUP: RESIDUAL, DESCRIPTION: Residuals of the SOLUTION variables. + + /// BEGIN_GROUP: RESIDUAL, DESCRIPTION: Residuals of the SOLUTION variables. /// DESCRIPTION: Residual of the adjoint Pressure. - AddVolumeOutput("RES_ADJ_PRESSURE", "Residual_Adjoint_Pressure", "RESIDUAL", "Residual of the adjoint pressure"); + AddVolumeOutput("RES_ADJ_PRESSURE", "Residual_Adjoint_Pressure", "RESIDUAL", "Residual of the adjoint pressure"); /// DESCRIPTION: Residual of the adjoint Velocity x-component. - AddVolumeOutput("RES_ADJ_VELOCITY-X", "Residual_Adjoint_Velocity_x", "RESIDUAL", "Residual of the adjoint x-velocity"); + AddVolumeOutput("RES_ADJ_VELOCITY-X", "Residual_Adjoint_Velocity_x", "RESIDUAL", "Residual of the adjoint x-velocity"); /// DESCRIPTION: Residual of the adjoint Velocity y-component. - AddVolumeOutput("RES_ADJ_VELOCITY-Y", "Residual_Adjoint_Velocity_y", "RESIDUAL", "Residual of the adjoint y-velocity"); + AddVolumeOutput("RES_ADJ_VELOCITY-Y", "Residual_Adjoint_Velocity_y", "RESIDUAL", "Residual of the adjoint y-velocity"); if (nDim == 3) /// DESCRIPTION: Residual of the adjoint Velocity z-component. - AddVolumeOutput("RES_ADJ_VELOCITY-Z", "Residual_Adjoint_Velocity_z", "RESIDUAL", "Residual of the adjoint z-velocity"); - /// DESCRIPTION: Residual of the adjoint energy. + AddVolumeOutput("RES_ADJ_VELOCITY-Z", "Residual_Adjoint_Velocity_z", "RESIDUAL", "Residual of the adjoint z-velocity"); + /// DESCRIPTION: Residual of the adjoint energy. AddVolumeOutput("RES_ADJ_TEMPERATURE", "Residual_Adjoint_Heat", "RESIDUAL", "Residual of the adjoint temperature"); - if (!config->GetFrozen_Visc_Disc()){ + if (!config->GetFrozen_Visc_Disc()){ switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: - /// DESCRIPTION: Residual of the nu tilde. - AddVolumeOutput("RES_ADJ_NU_TILDE", "Residual_Adjoint_Nu_Tilde", "RESIDUAL", "Residual of the adjoint Spalart-Allmaras variable"); - break; + /// DESCRIPTION: Residual of the nu tilde. + AddVolumeOutput("RES_ADJ_NU_TILDE", "Residual_Adjoint_Nu_Tilde", "RESIDUAL", "Residual of the adjoint Spalart-Allmaras variable"); + break; case SST: - /// DESCRIPTION: Residual of the adjoint kinetic energy. - AddVolumeOutput("RES_ADJ_TKE", "Residual_Adjoint_TKE", "RESIDUAL", "Residual of the adjoint turb. kinetic energy"); + /// DESCRIPTION: Residual of the adjoint kinetic energy. + AddVolumeOutput("RES_ADJ_TKE", "Residual_Adjoint_TKE", "RESIDUAL", "Residual of the adjoint turb. kinetic energy"); /// DESCRIPTION: Residual of the adjoint dissipation. AddVolumeOutput("RES_ADJ_DISSIPATION", "Residual_Adjoint_Omega", "RESIDUAL", "Residual of adjoint rate of dissipation"); break; @@ -373,40 +373,40 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ } } /// END_GROUP - + /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Geometrical sensitivities of the current objective function. /// DESCRIPTION: Sensitivity x-component. - AddVolumeOutput("SENSITIVITY-X", "Sensitivity_x", "SENSITIVITY", "x-component of the sensitivity vector"); + AddVolumeOutput("SENSITIVITY-X", "Sensitivity_x", "SENSITIVITY", "x-component of the sensitivity vector"); /// DESCRIPTION: Sensitivity y-component. AddVolumeOutput("SENSITIVITY-Y", "Sensitivity_y", "SENSITIVITY", "y-component of the sensitivity vector"); if (nDim == 3) /// DESCRIPTION: Sensitivity z-component. - AddVolumeOutput("SENSITIVITY-Z", "Sensitivity_z", "SENSITIVITY", "z-component of the sensitivity vector"); + AddVolumeOutput("SENSITIVITY-Z", "Sensitivity_z", "SENSITIVITY", "z-component of the sensitivity vector"); /// DESCRIPTION: Sensitivity in normal direction. - AddVolumeOutput("SENSITIVITY", "Surface_Sensitivity", "SENSITIVITY", "sensitivity in normal direction"); + AddVolumeOutput("SENSITIVITY", "Surface_Sensitivity", "SENSITIVITY", "sensitivity in normal direction"); /// END_GROUP - + } void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - - CVariable* Node_AdjFlow = solver[ADJFLOW_SOL]->GetNodes(); + + 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]->GetNodes(); + Node_AdjTurb = solver[ADJTURB_SOL]->GetNodes(); } if (weakly_coupled_heat){ Node_AdjHeat = solver[ADJHEAT_SOL]->GetNodes(); } - - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(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)); @@ -421,22 +421,22 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo 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()){ + // Turbulent + if (!config->GetFrozen_Visc_Disc()){ switch(turb_model){ case SST: 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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: SetVolumeOutputValue("ADJ_NU_TILDE", iPoint, Node_AdjTurb->GetSolution(iPoint, 0)); break; case NONE: break; } } - + // Residuals 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)); @@ -446,47 +446,47 @@ void CAdjFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo 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(iPoint, 3) - Node_AdjFlow->GetSolution_Old(iPoint, 3)); - } - if (!config->GetFrozen_Visc_Disc()){ + } + if (!config->GetFrozen_Visc_Disc()){ switch(config->GetKind_Turb_Model()){ case SST: 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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: 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(iPoint, 0)); SetVolumeOutputValue("SENSITIVITY-Y", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 1)); if (nDim == 3) SetVolumeOutputValue("SENSITIVITY-Z", iPoint, Node_AdjFlow->GetSensitivity(iPoint, 2)); - + } void CAdjFlowIncOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ - + SetVolumeOutputValue("SENSITIVITY", iPoint, solver[ADJFLOW_SOL]->GetCSensitivity(iMarker, iVertex)); - + } bool CAdjFlowIncOutput::SetInit_Residuals(CConfig *config){ - - return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| - (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); - + + return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| + (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); + } bool CAdjFlowIncOutput::SetUpdate_Averages(CConfig *config){ return false; - + // return (config->GetUnsteady_Simulation() != STEADY && !dualtime); - + } diff --git a/SU2_CFD/src/output/CAdjHeatOutput.cpp b/SU2_CFD/src/output/CAdjHeatOutput.cpp index c766805c9cd..cc72af22cb1 100644 --- a/SU2_CFD/src/output/CAdjHeatOutput.cpp +++ b/SU2_CFD/src/output/CAdjHeatOutput.cpp @@ -41,49 +41,49 @@ #include "../../include/solver_structure.hpp" CAdjHeatOutput::CAdjHeatOutput(CConfig *config, unsigned short nDim) : COutput(config, nDim, false) { - + /*--- Set the default history fields if nothing is set in the config file ---*/ - + if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); requestedHistoryFields.emplace_back("SENSITIVITY"); nRequestedHistoryFields = requestedHistoryFields.size(); } - + if (nRequestedScreenFields == 0){ if (multiZone) requestedScreenFields.emplace_back("OUTER_ITER"); - requestedScreenFields.emplace_back("INNER_ITER"); + requestedScreenFields.emplace_back("INNER_ITER"); requestedScreenFields.emplace_back("RMS_ADJ_TEMPERATURE"); requestedScreenFields.emplace_back("SENS_GEO"); nRequestedScreenFields = requestedScreenFields.size(); } - + if (nRequestedVolumeFields == 0){ requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("SENSITIVITY"); nRequestedVolumeFields = requestedVolumeFields.size(); } - + stringstream ss; ss << "Zone " << config->GetiZone() << " (Adj. Heat)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetAdj_FileName(); - + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfAdjCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_AdjFileName(); - + /*--- Add the obj. function extension --- */ - + restartFilename = config->GetObjFunc_Extension(restartFilename); /*--- Set the default convergence field --- */ @@ -95,105 +95,105 @@ CAdjHeatOutput::CAdjHeatOutput(CConfig *config, unsigned short nDim) : COutput(c CAdjHeatOutput::~CAdjHeatOutput(void) {} void CAdjHeatOutput::SetHistoryOutputFields(CConfig *config){ - - /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the conservative variables. + + /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the conservative variables. /// DESCRIPTION: Root-mean square residual of the adjoint Pressure. - AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); + AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); /// END_GROUP - - /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the conservative variables. + + /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the conservative variables. /// DESCRIPTION: Maximum residual of the adjoint Pressure. AddHistoryOutput("MAX_ADJ_TEMPERATURE", "max[A_T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); - /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the conservative variables. + /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the conservative variables. /// DESCRIPTION: Maximum residual of the adjoint Pressure. AddHistoryOutput("BGS_ADJ_TEMPERATURE", "bgs[A_T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the adjoint temperature.", HistoryFieldType::RESIDUAL); - - /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Sensitivities of different geometrical or boundary values. + + /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Sensitivities of different geometrical or boundary values. /// DESCRIPTION: Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING. - AddHistoryOutput("SENS_GEO", "Sens_Geo", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("SENS_GEO", "Sens_Geo", ScreenOutputFormat::SCIENTIFIC, "SENSITIVITY", "Sum of the geometrical sensitivities on all markers set in MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// END_GROUP - + } -void CAdjHeatOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { - +void CAdjHeatOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { + CSolver* adjheat_solver = solver[ADJHEAT_SOL]; SetHistoryOutputValue("RMS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_RMS(0))); - + SetHistoryOutputValue("MAX_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_Max(0))); - + if (multiZone) { SetHistoryOutputValue("BGS_ADJ_TEMPERATURE", log10(adjheat_solver->GetRes_BGS(0))); } - + SetHistoryOutputValue("SENS_GEO", adjheat_solver->GetTotal_Sens_Geo()); - + } void CAdjHeatOutput::SetVolumeOutputFields(CConfig *config){ - + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); if (nDim == 3) AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); - + /// BEGIN_GROUP: CONSERVATIVE, DESCRIPTION: The conservative variables of the adjoint solver. /// DESCRIPTION: Adjoint Pressure. AddVolumeOutput("ADJ_TEMPERATURE", "Adjoint_Temperature", "SOLUTION" ,"Adjoint Temperature"); /// END_GROUP - - - /// BEGIN_GROUP: RESIDUAL, DESCRIPTION: Residuals of the conservative variables. + + + /// BEGIN_GROUP: RESIDUAL, DESCRIPTION: Residuals of the conservative variables. /// DESCRIPTION: Residual of the adjoint Pressure. AddVolumeOutput("RES_ADJ_TEMPERATURE", "Residual_Adjoint_Temperature", "RESIDUAL", "Residual of the Adjoint Temperature"); /// END_GROUP - + /// BEGIN_GROUP: SENSITIVITY, DESCRIPTION: Geometrical sensitivities of the current objective function. /// DESCRIPTION: Sensitivity x-component. - AddVolumeOutput("SENSITIVITY-X", "Sensitivity_x", "SENSITIVITY", "x-component of the sensitivity vector"); + AddVolumeOutput("SENSITIVITY-X", "Sensitivity_x", "SENSITIVITY", "x-component of the sensitivity vector"); /// DESCRIPTION: Sensitivity y-component. AddVolumeOutput("SENSITIVITY-Y", "Sensitivity_y", "SENSITIVITY", "y-component of the sensitivity vector"); if (nDim == 3) /// DESCRIPTION: Sensitivity z-component. - AddVolumeOutput("SENSITIVITY-Z", "Sensitivity_z", "SENSITIVITY", "z-component of the sensitivity vector"); + AddVolumeOutput("SENSITIVITY-Z", "Sensitivity_z", "SENSITIVITY", "z-component of the sensitivity vector"); /// DESCRIPTION: Sensitivity in normal direction. - AddVolumeOutput("SENSITIVITY", "Surface_Sensitivity", "SENSITIVITY", "sensitivity in normal direction"); + AddVolumeOutput("SENSITIVITY", "Surface_Sensitivity", "SENSITIVITY", "sensitivity in normal direction"); /// END_GROUP - + } void CAdjHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - - CVariable* Node_AdjHeat = solver[ADJHEAT_SOL]->GetNodes(); + + CVariable* Node_AdjHeat = solver[ADJHEAT_SOL]->GetNodes(); CPoint* Node_Geo = geometry->node[iPoint]; - - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - + SetVolumeOutputValue("ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0)); - + // Residuals SetVolumeOutputValue("RES_ADJ_TEMPERATURE", iPoint, Node_AdjHeat->GetSolution(iPoint, 0) - Node_AdjHeat->GetSolution_Old(iPoint, 0)); - + 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(iPoint, 2)); - + } void CAdjHeatOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ - + SetVolumeOutputValue("SENSITIVITY", iPoint, solver[ADJHEAT_SOL]->GetCSensitivity(iMarker, iVertex)); - + } diff --git a/SU2_CFD/src/output/CBaselineOutput.cpp b/SU2_CFD/src/output/CBaselineOutput.cpp index 5b6aa247464..ec3157f8441 100644 --- a/SU2_CFD/src/output/CBaselineOutput.cpp +++ b/SU2_CFD/src/output/CBaselineOutput.cpp @@ -42,38 +42,38 @@ #include "../../include/solver_structure.hpp" CBaselineOutput::CBaselineOutput(CConfig *config, unsigned short nDim, CSolver* solver) : COutput(config, nDim, false) { - + /*--- Set the requested volume fields to all fields in the solver ---*/ - + requestedVolumeFields.clear(); - + requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); - + nRequestedVolumeFields = requestedVolumeFields.size(); - + /*--- Get the fields from the solver ---*/ - + fields = solver->GetSolutionFields(); - + /*--- Remove point ID ---*/ - + fields.erase(fields.begin()); - + /*--- Remove first and last character of the strings (the quotation marks) ---*/ - + for (unsigned short iField = 0; iField < fields.size(); iField++){ fields[iField] = fields[iField].substr(1, fields[iField].size() - 2); } - + /*--- Set the volume filename --- */ - + volumeFilename = "baseline"; - + /*--- Set the surface filename ---*/ - + surfaceFilename = "surface_baseline"; - + } CBaselineOutput::~CBaselineOutput(void) {} @@ -81,9 +81,9 @@ CBaselineOutput::~CBaselineOutput(void) {} void CBaselineOutput::SetVolumeOutputFields(CConfig *config){ unsigned short iField = 0; - + /*--- The first three fields should be the coordinates, if not, something is wrong ---*/ - + if (fields[0] != "x" || fields[1] != "y"){ SU2_MPI::Error("No coordinates found in the restart file!!", CURRENT_FUNCTION); } @@ -92,7 +92,7 @@ void CBaselineOutput::SetVolumeOutputFields(CConfig *config){ SU2_MPI::Error("No coordinates found in the restart file!!", CURRENT_FUNCTION); } } - + // Grid coordinates AddVolumeOutput(fields[0], fields[0], "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput(fields[1], fields[1], "COORDINATES", "y-component of the coordinate vector"); @@ -100,27 +100,27 @@ void CBaselineOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput(fields[2], fields[2], "COORDINATES", "z-component of the coordinate vector"); // Add all the remaining fields - + for (iField = nDim; iField < fields.size(); iField++){ AddVolumeOutput(fields[iField], fields[iField], "SOLUTION",""); } - + } void CBaselineOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - + unsigned short iField = 0; - + if ( fields.size() != solver[0]->GetnVar()){ SU2_MPI::Error("Number of requested fields and number of variables do not match.", CURRENT_FUNCTION); } - + /*--- Take the solver at index 0 --- */ - + CVariable* Node_Sol = solver[0]->GetNodes(); for (iField = 0; iField < fields.size(); 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 f8677ac2630..01c3d3cade1 100644 --- a/SU2_CFD/src/output/CElasticityOutput.cpp +++ b/SU2_CFD/src/output/CElasticityOutput.cpp @@ -45,7 +45,7 @@ CElasticityOutput::CElasticityOutput(CConfig *config, unsigned short nDim) : COu linear_analysis = (config->GetGeometricConditions() == SMALL_DEFORMATIONS); // Linear analysis. nonlinear_analysis = (config->GetGeometricConditions() == LARGE_DEFORMATIONS); // Nonlinear analysis. dynamic = (config->GetTime_Domain()); // Dynamic analysis. - + /*--- Initialize number of variables ---*/ if (linear_analysis) nVar_FEM = nDim; if (nonlinear_analysis) nVar_FEM = 3; @@ -56,7 +56,7 @@ CElasticityOutput::CElasticityOutput(CConfig *config, unsigned short nDim) : COu requestedHistoryFields.emplace_back("RMS_RES"); nRequestedHistoryFields = requestedHistoryFields.size(); } - + /*--- Default fields for screen output ---*/ if (nRequestedScreenFields == 0){ if (dynamic) requestedScreenFields.emplace_back("TIME_ITER"); @@ -75,29 +75,29 @@ CElasticityOutput::CElasticityOutput(CConfig *config, unsigned short nDim) : COu requestedScreenFields.emplace_back("VMS"); nRequestedScreenFields = requestedScreenFields.size(); } - + /*--- Default fields for volume output ---*/ if (nRequestedVolumeFields == 0){ requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); - requestedVolumeFields.emplace_back("STRESS"); + requestedVolumeFields.emplace_back("STRESS"); nRequestedVolumeFields = requestedVolumeFields.size(); } stringstream ss; ss << "Zone " << config->GetiZone() << " (Structure)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetVolume_FileName(); - + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_FileName(); /*--- Set the default convergence field --- */ @@ -116,7 +116,7 @@ void CElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS /*--- Linear analysis: RMS of the displacements in the nDim coordinates ---*/ /*--- Nonlinear analysis: UTOL, RTOL and DTOL (defined in the Postprocessing function) ---*/ - + if (linear_analysis){ SetHistoryOutputValue("RMS_DISP_X", log10(fea_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_DISP_Y", log10(fea_solver->GetRes_RMS(1))); @@ -127,29 +127,29 @@ void CElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("RMS_UTOL", log10(fea_solver->LinSysSol.norm())); SetHistoryOutputValue("RMS_RTOL", log10(fea_solver->LinSysRes.norm())); SetHistoryOutputValue("RMS_ETOL", log10(dotProd(fea_solver->LinSysSol, fea_solver->LinSysRes))); - + } - + if (multiZone){ SetHistoryOutputValue("BGS_DISP_X", log10(fea_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_DISP_Y", log10(fea_solver->GetRes_BGS(1))); if (nDim == 3) SetHistoryOutputValue("BGS_DISP_Z", log10(fea_solver->GetRes_BGS(2))); } - + SetHistoryOutputValue("VMS", fea_solver->GetTotal_CFEA()); SetHistoryOutputValue("LOAD_INCREMENT", fea_solver->GetLoad_Increment()); SetHistoryOutputValue("LOAD_RAMP", fea_solver->GetForceCoeff()); - + SetHistoryOutputValue("LINSOL_ITER", fea_solver->GetIterLinSolver()); SetHistoryOutputValue("LINSOL_RESIDUAL", log10(fea_solver->GetLinSol_Residual())); - -} + +} void CElasticityOutput::SetHistoryOutputFields(CConfig *config){ - + AddHistoryOutput("LINSOL_ITER", "LinSolIter", ScreenOutputFormat::INTEGER, "LINSOL", "Number of iterations of the linear solver."); AddHistoryOutput("LINSOL_RESIDUAL", "LinSolRes", ScreenOutputFormat::FIXED, "LINSOL", "Residual of the linear solver."); - + // Residuals AddHistoryOutput("RMS_UTOL", "rms[U]", ScreenOutputFormat::FIXED, "RMS_RES", "", HistoryFieldType::RESIDUAL); @@ -167,33 +167,33 @@ void CElasticityOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("VMS", "VonMises", ScreenOutputFormat::SCIENTIFIC, "", "VMS"); AddHistoryOutput("LOAD_INCREMENT", "Load_Increment", ScreenOutputFormat::FIXED, "", "LOAD_INCREMENT"); AddHistoryOutput("LOAD_RAMP", "Load_Ramp", ScreenOutputFormat::FIXED, "", "LOAD_RAMP"); - + } void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - - CVariable* Node_Struc = solver[FEA_SOL]->GetNodes(); + + CVariable* Node_Struc = solver[FEA_SOL]->GetNodes(); CPoint* Node_Geo = geometry->node[iPoint]; - - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(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(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(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(iPoint)[0]); SetVolumeOutputValue("STRESS-YY", iPoint, Node_Struc->GetStress_FEM(iPoint)[1]); SetVolumeOutputValue("STRESS-XY", iPoint, Node_Struc->GetStress_FEM(iPoint)[2]); @@ -203,11 +203,11 @@ void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSo SetVolumeOutputValue("STRESS-YZ", iPoint, Node_Struc->GetStress_FEM(iPoint)[5]); } SetVolumeOutputValue("VON_MISES_STRESS", iPoint, Node_Struc->GetVonMises_Stress(iPoint)); - + } void CElasticityOutput::SetVolumeOutputFields(CConfig *config){ - + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); @@ -217,34 +217,34 @@ void CElasticityOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("DISPLACEMENT-X", "Displacement_x", "SOLUTION", "x-component of the displacement vector"); AddVolumeOutput("DISPLACEMENT-Y", "Displacement_y", "SOLUTION", "y-component of the displacement vector"); if (nDim == 3) AddVolumeOutput("DISPLACEMENT-Z", "Displacement_z", "SOLUTION", "z-component of the displacement vector"); - + if(dynamic){ AddVolumeOutput("VELOCITY-X", "Velocity_x", "VELOCITY", "x-component of the velocity vector"); AddVolumeOutput("VELOCITY-Y", "Velocity_y", "VELOCITY", "y-component of the velocity vector"); if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "VELOCITY", "z-component of the velocity vector"); - + AddVolumeOutput("ACCELERATION-X", "Acceleration_x", "ACCELERATION", "x-component of the acceleration vector"); AddVolumeOutput("ACCELERATION-Y", "Acceleration_y", "ACCELERATION", "y-component of the acceleration vector"); if (nDim == 3) AddVolumeOutput("ACCELERATION-Z", "Acceleration_z", "ACCELERATION", "z-component of the acceleration vector"); } - + AddVolumeOutput("STRESS-XX", "Sxx", "STRESS", "x-component of the normal stress vector"); AddVolumeOutput("STRESS-YY", "Syy", "STRESS", "y-component of the normal stress vector"); AddVolumeOutput("STRESS-XY", "Sxy", "STRESS", "xy shear stress component"); - + if (nDim == 3) { AddVolumeOutput("STRESS-ZZ", "Szz", "STRESS", "z-component of the normal stress vector"); AddVolumeOutput("STRESS-XZ", "Sxz", "STRESS", "xz shear stress component"); AddVolumeOutput("STRESS-YZ", "Syz", "STRESS", "yz shear stress component"); } - + AddVolumeOutput("VON_MISES_STRESS", "Von_Mises_Stress", "STRESS", "von-Mises stress"); - + } bool CElasticityOutput::SetInit_Residuals(CConfig *config){ - + return (config->GetTime_Domain() == NO && (curInnerIter == 0)); - + } diff --git a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp index 9534d1c2142..4e29a21184e 100644 --- a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp @@ -41,13 +41,13 @@ #include "../../include/solver_structure.hpp" CFlowCompFEMOutput::CFlowCompFEMOutput(CConfig *config, unsigned short nDim) : CFlowOutput(config, nDim, true) { - + turb_model = config->GetKind_Turb_Model(); - - gridMovement = config->GetGrid_Movement(); - + + gridMovement = config->GetGrid_Movement(); + /*--- Set the default history fields if nothing is set in the config file ---*/ - + if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); @@ -69,21 +69,21 @@ CFlowCompFEMOutput::CFlowCompFEMOutput(CConfig *config, unsigned short nDim) : C requestedVolumeFields.emplace_back("PRIMITIVE"); nRequestedVolumeFields = requestedVolumeFields.size(); } - + stringstream ss; ss << "Zone " << config->GetiZone() << " (Comp. Fluid)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetVolume_FileName(); - + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_FileName(); /*--- Set the default convergence field --- */ @@ -98,7 +98,7 @@ CFlowCompFEMOutput::~CFlowCompFEMOutput(void) {} void CFlowCompFEMOutput::SetHistoryOutputFields(CConfig *config){ - /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. + /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. /// DESCRIPTION: Root-mean square residual of the density. AddHistoryOutput("RMS_DENSITY", "rms[Rho]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the density.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the momentum x-component. @@ -110,37 +110,37 @@ void CFlowCompFEMOutput::SetHistoryOutputFields(CConfig *config){ /// DESCRIPTION: Root-mean square residual of the energy. AddHistoryOutput("RMS_ENERGY", "rms[RhoE]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the energy.", HistoryFieldType::RESIDUAL); /// END_GROUP - - /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. + + /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. /// DESCRIPTION: Maximum residual of the density. AddHistoryOutput("MAX_DENSITY", "max[Rho]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum square residual of the density.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the momentum x-component. + /// DESCRIPTION: Maximum residual of the momentum x-component. AddHistoryOutput("MAX_MOMENTUM-X", "max[RhoU]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum square residual of the momentum x-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the momentum y-component. + /// DESCRIPTION: Maximum residual of the momentum y-component. AddHistoryOutput("MAX_MOMENTUM-Y", "max[RhoV]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum square residual of the momentum y-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the momentum z-component. + /// DESCRIPTION: Maximum residual of the momentum z-component. if (nDim == 3) AddHistoryOutput("MAX_MOMENTUM-Z", "max[RhoW]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the z-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the energy. + /// DESCRIPTION: Maximum residual of the energy. AddHistoryOutput("MAX_ENERGY", "max[RhoE]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the energy.", HistoryFieldType::RESIDUAL); /// END_GROUP - - /// DESCRIPTION: Linear solver iterations + + /// DESCRIPTION: Linear solver iterations AddHistoryOutput("LINSOL_ITER", "Linear_Solver_Iterations", ScreenOutputFormat::INTEGER, "LINSOL_ITER", "Number of iterations of the linear solver."); - + AddHistoryOutput("CFL_NUMBER", "CFL number", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current value of the CFL number"); - + /*--- Add analyze surface history fields --- */ - + AddAnalyzeSurfaceOutput(config); - + /*--- Add aerodynamic coefficients fields --- */ - + AddAerodynamicCoefficients(config); } void CFlowCompFEMOutput::SetVolumeOutputFields(CConfig *config){ - + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); @@ -153,7 +153,7 @@ void CFlowCompFEMOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("MOMENTUM-Y", "Momentum_y", "SOLUTION", "y-component of the momentum vector"); if (nDim == 3) AddVolumeOutput("MOMENTUM-Z", "Momentum_z", "SOLUTION", "z-component of the momentum vector"); - AddVolumeOutput("ENERGY", "Energy", "SOLUTION", "Energy"); + AddVolumeOutput("ENERGY", "Energy", "SOLUTION", "Energy"); // Primitive variables AddVolumeOutput("PRESSURE", "Pressure", "PRIMITIVE", "Pressure"); @@ -164,18 +164,18 @@ void CFlowCompFEMOutput::SetVolumeOutputFields(CConfig *config){ if (config->GetKind_Solver() == FEM_NAVIER_STOKES){ AddVolumeOutput("LAMINAR_VISCOSITY", "Laminar_Viscosity", "PRIMITIVE", "Laminar viscosity"); } - + if (config->GetKind_Solver() == FEM_LES && (config->GetKind_SGS_Model() != IMPLICIT_LES)) { AddVolumeOutput("EDDY_VISCOSITY", "Eddy_Viscosity", "PRIMITIVE", "Turbulent eddy viscosity"); } } void CFlowCompFEMOutput::LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iElem, unsigned long index, unsigned short dof){ - + unsigned short iDim; unsigned short nVar = solver[FLOW_SOL]->GetnVar(); - + /*--- Create an object of the class CMeshFEM_DG and retrieve the necessary geometrical information for the FEM DG solver. ---*/ @@ -187,20 +187,20 @@ void CFlowCompFEMOutput::LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, so that we can access the states below. ---*/ CFluidModel *DGFluidModel = solver[FLOW_SOL]->GetFluidModel(); - + /* Set the pointers for the solution for this element. */ const unsigned long offset = nVar*volElem[iElem].offsetDOFsSolLocal; su2double *solDOFs = solver[FLOW_SOL]->GetVecSolDOFs() + offset; - + /*--- Get the conservative variables for this particular DOF. ---*/ const su2double *U = solDOFs+dof*nVar; /*--- Load the coordinate values of the solution DOFs. ---*/ - + const su2double *coor = volElem[iElem].coorSolDOFs.data() + dof*nDim; - + /*--- Prepare the primitive states. ---*/ const su2double DensityInv = 1.0/U[0]; @@ -211,11 +211,11 @@ void CFlowCompFEMOutput::LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, } su2double StaticEnergy = U[nDim+1]*DensityInv - 0.5*Velocity2; DGFluidModel->SetTDState_rhoe(U[0], StaticEnergy); - - + + SetVolumeOutputValue("COORD-X", index, coor[0]); SetVolumeOutputValue("COORD-Y", index, coor[1]); - if (nDim == 3) + if (nDim == 3) SetVolumeOutputValue("COORD-Z", index, coor[2]); SetVolumeOutputValue("DENSITY", index, U[0]); SetVolumeOutputValue("MOMENTUM-X", index, U[1]); @@ -223,33 +223,33 @@ void CFlowCompFEMOutput::LoadVolumeDataFEM(CConfig *config, CGeometry *geometry, if (nDim == 3){ SetVolumeOutputValue("MOMENTUM-Z", index, U[3]); SetVolumeOutputValue("ENERGY", index, U[4]); - } else { - SetVolumeOutputValue("ENERGY", index, U[3]); + } else { + SetVolumeOutputValue("ENERGY", index, U[3]); } - + SetVolumeOutputValue("PRESSURE", index, DGFluidModel->GetPressure()); SetVolumeOutputValue("TEMPERATURE", index, DGFluidModel->GetTemperature()); SetVolumeOutputValue("MACH", index, sqrt(Velocity2)/DGFluidModel->GetSoundSpeed()); SetVolumeOutputValue("PRESSURE_COEFF", index, DGFluidModel->GetCp()); - + if (config->GetKind_Solver() == FEM_NAVIER_STOKES){ - SetVolumeOutputValue("LAMINAR_VISCOSITY", index, DGFluidModel->GetLaminarViscosity()); + SetVolumeOutputValue("LAMINAR_VISCOSITY", index, DGFluidModel->GetLaminarViscosity()); } if ((config->GetKind_Solver() == FEM_LES) && (config->GetKind_SGS_Model() != IMPLICIT_LES)){ // todo: Export Eddy instead of Laminar viscosity - SetVolumeOutputValue("EDDY_VISCOSITY", index, DGFluidModel->GetLaminarViscosity()); + SetVolumeOutputValue("EDDY_VISCOSITY", index, DGFluidModel->GetLaminarViscosity()); } } void CFlowCompFEMOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ - + } void CFlowCompFEMOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { - + CSolver* flow_solver = solver[FLOW_SOL]; - + SetHistoryOutputValue("RMS_DENSITY", log10(flow_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_MOMENTUM-X", log10(flow_solver->GetRes_RMS(1))); SetHistoryOutputValue("RMS_MOMENTUM-Y", log10(flow_solver->GetRes_RMS(2))); @@ -259,8 +259,8 @@ void CFlowCompFEMOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C SetHistoryOutputValue("RMS_MOMENTUM-Z", log10(flow_solver->GetRes_RMS(3))); SetHistoryOutputValue("RMS_ENERGY", log10(flow_solver->GetRes_RMS(4))); } - - + + SetHistoryOutputValue("MAX_DENSITY", log10(flow_solver->GetRes_Max(0))); SetHistoryOutputValue("MAX_MOMENTUM-X", log10(flow_solver->GetRes_Max(1))); SetHistoryOutputValue("MAX_MOMENTUM-Y", log10(flow_solver->GetRes_Max(2))); @@ -270,33 +270,33 @@ void CFlowCompFEMOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, C SetHistoryOutputValue("MAX_MOMENTUM-Z", log10(flow_solver->GetRes_Max(3))); SetHistoryOutputValue("MAX_ENERGY", log10(flow_solver->GetRes_Max(4))); } - + SetHistoryOutputValue("AOA", config->GetAoA()); SetHistoryOutputValue("LINSOL_ITER", flow_solver->GetIterLinSolver()); SetHistoryOutputValue("CFL_NUMBER", config->GetCFL(MESH_0)); - + /*--- Set the analyse surface history values --- */ - + SetAnalyzeSurface(flow_solver, geometry, config, false); - + /*--- Set aeroydnamic coefficients --- */ - + SetAerodynamicCoefficients(config, flow_solver); - + } bool CFlowCompFEMOutput::SetInit_Residuals(CConfig *config){ - - return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| - (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); - + + return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| + (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); + } bool CFlowCompFEMOutput::SetUpdate_Averages(CConfig *config){ return false; - + // return (config->GetUnsteady_Simulation() != STEADY && !dualtime); - + } diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index 1e62fd4926f..440e54e2f95 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -41,13 +41,13 @@ #include "../../include/solver_structure.hpp" CFlowCompOutput::CFlowCompOutput(CConfig *config, unsigned short nDim) : CFlowOutput(config, nDim, false) { - + turb_model = config->GetKind_Turb_Model(); - lastInnerIter = curInnerIter; - gridMovement = config->GetGrid_Movement(); + lastInnerIter = curInnerIter; + gridMovement = config->GetGrid_Movement(); /*--- Set the default history fields if nothing is set in the config file ---*/ - + if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); @@ -69,21 +69,21 @@ CFlowCompOutput::CFlowCompOutput(CConfig *config, unsigned short nDim) : CFlowOu requestedVolumeFields.emplace_back("PRIMITIVE"); nRequestedVolumeFields = requestedVolumeFields.size(); } - + stringstream ss; ss << "Zone " << config->GetiZone() << " (Comp. Fluid)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetVolume_FileName(); - + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_FileName(); @@ -96,7 +96,7 @@ CFlowCompOutput::CFlowCompOutput(CConfig *config, unsigned short nDim) : CFlowOu for (unsigned short iField = 0; iField < convFields.size(); iField++) if (convFields[iField] == "LIFT") found = true; if (!found) { - if (rank == MASTER_NODE) + if (rank == MASTER_NODE) cout<<" Fixed CL: Adding LIFT as Convergence Field to ensure convergence to target CL"< Marker_Monitoring; for (unsigned short iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++){ Marker_Monitoring.push_back(config->GetMarker_Monitoring_TagBound(iMarker_Monitoring)); - } + } /// BEGIN_GROUP: AEROELASTIC, DESCRIPTION: Aeroelastic plunge, pitch /// DESCRIPTION: Aeroelastic plunge AddHistoryOutputPerSurface("PLUNGE", "plunge", ScreenOutputFormat::FIXED, "AEROELASTIC", Marker_Monitoring, HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Aeroelastic pitch AddHistoryOutputPerSurface("PITCH", "pitch", ScreenOutputFormat::FIXED, "AEROELASTIC", Marker_Monitoring, HistoryFieldType::COEFFICIENT); /// END_GROUP - - /// DESCRIPTION: Linear solver iterations + + /// DESCRIPTION: Linear solver iterations AddHistoryOutput("LINSOL_ITER", "Linear_Solver_Iterations", ScreenOutputFormat::INTEGER, "LINSOL", "Number of iterations of the linear solver."); AddHistoryOutput("LINSOL_RESIDUAL", "LinSolRes", ScreenOutputFormat::FIXED, "LINSOL", "Residual of the linear solver."); - + /// BEGIN_GROUP: ENGINE_OUTPUT, DESCRIPTION: Engine output /// DESCRIPTION: Aero CD drag AddHistoryOutput("AEROCDRAG", "AeroCDrag", ScreenOutputFormat::SCIENTIFIC, "ENGINE_OUTPUT", "Aero CD drag", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Solid CD drag + /// DESCRIPTION: Solid CD drag AddHistoryOutput("SOLIDCDRAG", "SolidCDrag", ScreenOutputFormat::SCIENTIFIC, "ENGINE_OUTPUT", "Solid CD drag ", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Radial distortion + /// DESCRIPTION: Radial distortion AddHistoryOutput("RADIAL_DISTORTION", "Radial_Distortion", ScreenOutputFormat::SCIENTIFIC, "ENGINE_OUTPUT", "Radial distortion ", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Circumferential distortion AddHistoryOutput("CIRCUMFERENTIAL_DISTORTION", "Circumferential_Distortion", ScreenOutputFormat::SCIENTIFIC, "ENGINE_OUTPUT", "Circumferential distortion", HistoryFieldType::COEFFICIENT); /// END_GROUP - + /// BEGIN_GROUP: ROTATING_FRAME, DESCRIPTION: Coefficients related to a rotating frame of reference. - /// DESCRIPTION: Merit + /// DESCRIPTION: Merit AddHistoryOutput("MERIT", "CMerit", ScreenOutputFormat::SCIENTIFIC, "ROTATING_FRAME", "Merit", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: CT + /// DESCRIPTION: CT AddHistoryOutput("CT", "CT", ScreenOutputFormat::SCIENTIFIC, "ROTATING_FRAME", "CT", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: CQ + /// DESCRIPTION: CQ AddHistoryOutput("CQ", "CQ", ScreenOutputFormat::SCIENTIFIC, "ROTATING_FRAME", "CQ", HistoryFieldType::COEFFICIENT); /// END_GROUP - - /// BEGIN_GROUP: EQUIVALENT_AREA, DESCRIPTION: Equivalent area. - /// DESCRIPTION: Equivalent area + + /// BEGIN_GROUP: EQUIVALENT_AREA, DESCRIPTION: Equivalent area. + /// DESCRIPTION: Equivalent area AddHistoryOutput("EQUIV_AREA", "CEquiv_Area", ScreenOutputFormat::SCIENTIFIC, "EQUIVALENT_AREA", "Equivalent area", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Nearfield obj. function + /// DESCRIPTION: Nearfield obj. function AddHistoryOutput("NEARFIELD_OF", "CNearFieldOF", ScreenOutputFormat::SCIENTIFIC, "EQUIVALENT_AREA", "Nearfield obj. function ", HistoryFieldType::COEFFICIENT); /// END_GROUP /// /// BEGIN_GROUP: HEAT_COEFF, DESCRIPTION: Heat coefficients on all surfaces set with MARKER_MONITORING. /// DESCRIPTION: Total heatflux AddHistoryOutput("HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heatflux on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Maximal heatflux + /// DESCRIPTION: Maximal heatflux AddHistoryOutput("HEATFLUX_MAX", "maxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total maximum heatflux on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Temperature AddHistoryOutput("TEMPERATURE", "Temp", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total avg. temperature on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// END_GROUP - + AddHistoryOutput("CFL_NUMBER", "CFL number", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current value of the CFL number"); - - /// /// BEGIN_GROUP: FIXED_CL, DESCRIPTION: Relevant outputs for the Fixed CL mode + + /// /// BEGIN_GROUP: FIXED_CL, DESCRIPTION: Relevant outputs for the Fixed CL mode if (config->GetFixed_CL_Mode()){ /// DESCRIPTION: Difference between current and target CL AddHistoryOutput("DELTA_CL", "Delta_CL", ScreenOutputFormat::SCIENTIFIC, "FIXED_CL", "Difference between Target CL and current CL", HistoryFieldType::COEFFICIENT); @@ -264,28 +264,28 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("DEFORM_MIN_VOLUME", "MinVolume", ScreenOutputFormat::SCIENTIFIC, "DEFORM", "Minimum volume in the mesh"); AddHistoryOutput("DEFORM_MAX_VOLUME", "MaxVolume", ScreenOutputFormat::SCIENTIFIC, "DEFORM", "Maximum volume in the mesh"); AddHistoryOutput("DEFORM_ITER", "DeformIter", ScreenOutputFormat::INTEGER, "DEFORM", "Linear solver iterations for the mesh deformation"); - AddHistoryOutput("DEFORM_RESIDUAL", "DeformRes", ScreenOutputFormat::FIXED, "DEFORM", "Residual of the linear solver for the mesh deformation"); + AddHistoryOutput("DEFORM_RESIDUAL", "DeformRes", ScreenOutputFormat::FIXED, "DEFORM", "Residual of the linear solver for the mesh deformation"); } - + /*--- Add analyze surface history fields --- */ - + AddAnalyzeSurfaceOutput(config); - + /*--- Add aerodynamic coefficients fields --- */ - - AddAerodynamicCoefficients(config); - + + AddAerodynamicCoefficients(config); + /*--- Add Cp diff fields ---*/ - + Add_CpInverseDesignOutput(config); - + /*--- Add combo obj value --- */ - + AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); } void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ - + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); @@ -298,53 +298,53 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("MOMENTUM-Y", "Momentum_y", "SOLUTION", "y-component of the momentum vector"); if (nDim == 3) AddVolumeOutput("MOMENTUM-Z", "Momentum_z", "SOLUTION", "z-component of the momentum vector"); - AddVolumeOutput("ENERGY", "Energy", "SOLUTION", "Energy"); - + AddVolumeOutput("ENERGY", "Energy", "SOLUTION", "Energy"); + // Turbulent Residuals switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy"); AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: AddVolumeOutput("NU_TILDE", "Nu_Tilde", "SOLUTION", "Spalart-Allmaras variable"); break; case NONE: break; } - + // Grid velocity if (config->GetGrid_Movement()){ AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); - if (nDim == 3 ) + if (nDim == 3 ) AddVolumeOutput("GRID_VELOCITY-Z", "Grid_Velocity_z", "GRID_VELOCITY", "z-component of the grid velocity vector"); } - + // Primitive variables AddVolumeOutput("PRESSURE", "Pressure", "PRIMITIVE", "Pressure"); AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature"); AddVolumeOutput("MACH", "Mach", "PRIMITIVE", "Mach number"); AddVolumeOutput("PRESSURE_COEFF", "Pressure_Coefficient", "PRIMITIVE", "Pressure coefficient"); - + if (config->GetKind_Solver() == RANS || config->GetKind_Solver() == NAVIER_STOKES){ AddVolumeOutput("LAMINAR_VISCOSITY", "Laminar_Viscosity", "PRIMITIVE", "Laminar viscosity"); - + AddVolumeOutput("SKIN_FRICTION-X", "Skin_Friction_Coefficient_x", "PRIMITIVE", "x-component of the skin friction vector"); AddVolumeOutput("SKIN_FRICTION-Y", "Skin_Friction_Coefficient_y", "PRIMITIVE", "y-component of the skin friction vector"); if (nDim == 3) AddVolumeOutput("SKIN_FRICTION-Z", "Skin_Friction_Coefficient_z", "PRIMITIVE", "z-component of the skin friction vector"); - + AddVolumeOutput("HEAT_FLUX", "Heat_Flux", "PRIMITIVE", "Heat-flux"); AddVolumeOutput("Y_PLUS", "Y_Plus", "PRIMITIVE", "Non-dim. wall distance (Y-Plus)"); - + } - + if (config->GetKind_Solver() == RANS) { AddVolumeOutput("EDDY_VISCOSITY", "Eddy_Viscosity", "PRIMITIVE", "Turbulent eddy viscosity"); } - + if (config->GetKind_Trans_Model() == BC){ AddVolumeOutput("INTERMITTENCY", "gamma_BC", "INTERMITTENCY", "Intermittency"); } @@ -356,20 +356,20 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("RES_MOMENTUM-Z", "Residual_Momentum_z", "RESIDUAL", "Residual of the z-momentum component"); AddVolumeOutput("RES_ENERGY", "Residual_Energy", "RESIDUAL", "Residual of the energy"); - + switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: AddVolumeOutput("RES_TKE", "Residual_TKE", "RESIDUAL", "Residual of turbulent kinetic energy"); AddVolumeOutput("RES_DISSIPATION", "Residual_Omega", "RESIDUAL", "Residual of the rate of dissipation"); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: AddVolumeOutput("RES_NU_TILDE", "Residual_Nu_Tilde", "RESIDUAL", "Residual of the Spalart-Allmaras variable"); break; case NONE: break; } - + // Limiter values AddVolumeOutput("LIMITER_DENSITY", "Limiter_Density", "LIMITER", "Limiter value of the density"); AddVolumeOutput("LIMITER_MOMENTUM-X", "Limiter_Momentum_x", "LIMITER", "Limiter value of the x-momentum"); @@ -377,62 +377,62 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("LIMITER_MOMENTUM-Z", "Limiter_Momentum_z", "LIMITER", "Limiter value of the z-momentum"); AddVolumeOutput("LIMITER_ENERGY", "Limiter_Energy", "LIMITER", "Limiter value of the energy"); - + switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy"); AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate"); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of the Spalart-Allmaras variable"); break; case NONE: break; } - + // Hybrid RANS-LES if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ AddVolumeOutput("DES_LENGTHSCALE", "DES_LengthScale", "DDES", "DES length scale value"); AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DDES", "Wall distance value"); } - + // Roe Low Dissipation if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ AddVolumeOutput("ROE_DISSIPATION", "Roe_Dissipation", "ROE_DISSIPATION", "Value of the Roe dissipation"); } - + if(config->GetKind_Solver() == RANS || config->GetKind_Solver() == NAVIER_STOKES){ if (nDim == 3){ AddVolumeOutput("VORTICITY_X", "Vorticity_x", "VORTEX_IDENTIFICATION", "x-component of the vorticity vector"); AddVolumeOutput("VORTICITY_Y", "Vorticity_y", "VORTEX_IDENTIFICATION", "y-component of the vorticity vector"); - AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); + AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); } AddVolumeOutput("VORTICITY_Z", "Vorticity_z", "VORTEX_IDENTIFICATION", "z-component of the vorticity vector"); } - + if (config->GetTime_Domain()){ SetTimeAveragedFields(); } } void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - - CVariable* Node_Flow = solver[FLOW_SOL]->GetNodes(); + + CVariable* Node_Flow = solver[FLOW_SOL]->GetNodes(); CVariable* Node_Turb = NULL; - + if (config->GetKind_Turb_Model() != NONE){ - Node_Turb = solver[TURB_SOL]->GetNodes(); + Node_Turb = solver[TURB_SOL]->GetNodes(); } - + CPoint* Node_Geo = geometry->node[iPoint]; - - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(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)); @@ -440,53 +440,53 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv SetVolumeOutputValue("MOMENTUM-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); SetVolumeOutputValue("ENERGY", iPoint, Node_Flow->GetSolution(iPoint, 4)); } else { - SetVolumeOutputValue("ENERGY", iPoint, Node_Flow->GetSolution(iPoint, 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(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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(iPoint, 0)); break; case NONE: break; } - + if (config->GetGrid_Movement()){ SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel()[0]); SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel()[1]); if (nDim == 3) SetVolumeOutputValue("GRID_VELOCITY-Z", iPoint, Node_Geo->GetGridVel()[2]); } - + 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 += pow(solver[FLOW_SOL]->GetVelocity_Inf(iDim),2.0); + VelMag += pow(solver[FLOW_SOL]->GetVelocity_Inf(iDim),2.0); } - su2double factor = 1.0/(0.5*solver[FLOW_SOL]->GetDensity_Inf()*VelMag); + su2double factor = 1.0/(0.5*solver[FLOW_SOL]->GetDensity_Inf()*VelMag); 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(iPoint)); } - + if (config->GetKind_Solver() == RANS) { SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity(iPoint)); } - + if (config->GetKind_Trans_Model() == BC){ SetVolumeOutputValue("INTERMITTENCY", iPoint, Node_Turb->GetGammaBC(iPoint)); } - + SetVolumeOutputValue("RES_DENSITY", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 0)); SetVolumeOutputValue("RES_MOMENTUM-X", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 1)); SetVolumeOutputValue("RES_MOMENTUM-Y", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 2)); @@ -496,20 +496,20 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv } else { SetVolumeOutputValue("RES_ENERGY", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 3)); } - + switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: SetVolumeOutputValue("RES_TKE", iPoint, solver[TURB_SOL]->LinSysRes.GetBlock(iPoint, 0)); SetVolumeOutputValue("RES_DISSIPATION", iPoint, solver[TURB_SOL]->LinSysRes.GetBlock(iPoint, 1)); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: SetVolumeOutputValue("RES_NU_TILDE", iPoint, solver[TURB_SOL]->LinSysRes.GetBlock(iPoint, 0)); break; case NONE: break; } - + 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)); @@ -517,64 +517,64 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv 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(iPoint, 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(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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: 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(iPoint)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance()); } - + if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ 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(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(iPoint)[2]); + } + SetVolumeOutputValue("VORTICITY_Z", iPoint, Node_Flow->GetVorticity(iPoint)[2]); } - + if (config->GetTime_Domain()){ LoadTimeAveragedData(iPoint, Node_Flow); } } void CFlowCompOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ - - if ((config->GetKind_Solver() == NAVIER_STOKES) || (config->GetKind_Solver() == RANS)) { + + if ((config->GetKind_Solver() == NAVIER_STOKES) || (config->GetKind_Solver() == RANS)) { SetVolumeOutputValue("SKIN_FRICTION-X", iPoint, solver[FLOW_SOL]->GetCSkinFriction(iMarker, iVertex, 0)); SetVolumeOutputValue("SKIN_FRICTION-Y", iPoint, solver[FLOW_SOL]->GetCSkinFriction(iMarker, iVertex, 1)); if (nDim == 3) SetVolumeOutputValue("SKIN_FRICTION-Z", iPoint, solver[FLOW_SOL]->GetCSkinFriction(iMarker, iVertex, 2)); - + SetVolumeOutputValue("HEAT_FLUX", iPoint, solver[FLOW_SOL]->GetHeatFlux(iMarker, iVertex)); SetVolumeOutputValue("Y_PLUS", iPoint, solver[FLOW_SOL]->GetYPlus(iMarker, iVertex)); } } void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { - + CSolver* flow_solver = solver[FLOW_SOL]; CSolver* turb_solver = solver[TURB_SOL]; CSolver* mesh_solver = solver[MESH_SOL]; - + SetHistoryOutputValue("RMS_DENSITY", log10(flow_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_MOMENTUM-X", log10(flow_solver->GetRes_RMS(1))); SetHistoryOutputValue("RMS_MOMENTUM-Y", log10(flow_solver->GetRes_RMS(2))); @@ -584,18 +584,18 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol SetHistoryOutputValue("RMS_MOMENTUM-Z", log10(flow_solver->GetRes_RMS(3))); SetHistoryOutputValue("RMS_ENERGY", log10(flow_solver->GetRes_RMS(4))); } - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("RMS_NU_TILDE", log10(turb_solver->GetRes_RMS(0))); - break; + break; case SST: case SST_SUST: SetHistoryOutputValue("RMS_TKE", log10(turb_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_DISSIPATION", log10(turb_solver->GetRes_RMS(1))); break; default: break; } - + SetHistoryOutputValue("MAX_DENSITY", log10(flow_solver->GetRes_Max(0))); SetHistoryOutputValue("MAX_MOMENTUM-X", log10(flow_solver->GetRes_Max(1))); SetHistoryOutputValue("MAX_MOMENTUM-Y", log10(flow_solver->GetRes_Max(2))); @@ -605,18 +605,18 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol SetHistoryOutputValue("MAX_MOMENTUM-Z", log10(flow_solver->GetRes_Max(3))); SetHistoryOutputValue("MAX_ENERGY", log10(flow_solver->GetRes_Max(4))); } - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("MAX_NU_TILDE", log10(turb_solver->GetRes_Max(0))); - break; + break; case SST: case SST_SUST: SetHistoryOutputValue("MAX_TKE", log10(turb_solver->GetRes_Max(0))); SetHistoryOutputValue("MAX_DISSIPATION", log10(turb_solver->GetRes_Max(1))); break; default: break; } - + if (multiZone){ SetHistoryOutputValue("BGS_DENSITY", log10(flow_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_MOMENTUM-X", log10(flow_solver->GetRes_BGS(1))); @@ -627,12 +627,12 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol SetHistoryOutputValue("BGS_MOMENTUM-Z", log10(flow_solver->GetRes_BGS(3))); SetHistoryOutputValue("BGS_ENERGY", log10(flow_solver->GetRes_BGS(4))); } - - + + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("BGS_NU_TILDE", log10(turb_solver->GetRes_BGS(0))); - break; + break; case SST: SetHistoryOutputValue("BGS_TKE", log10(turb_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_DISSIPATION", log10(turb_solver->GetRes_BGS(1))); @@ -640,21 +640,21 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol default: break; } } - + SetHistoryOutputValue("HEATFLUX", flow_solver->GetTotal_HeatFlux()); SetHistoryOutputValue("HEATFLUX_MAX", flow_solver->GetTotal_MaxHeatFlux()); SetHistoryOutputValue("TEMPERATURE", flow_solver->GetTotal_AvgTemperature()); - + SetHistoryOutputValue("CFL_NUMBER", config->GetCFL(MESH_0)); - + SetHistoryOutputValue("LINSOL_ITER", flow_solver->GetIterLinSolver()); SetHistoryOutputValue("LINSOL_RESIDUAL", log10(flow_solver->GetLinSol_Residual())); - + if (config->GetDeform_Mesh()){ SetHistoryOutputValue("DEFORM_MIN_VOLUME", mesh_solver->GetMinimum_Volume()); SetHistoryOutputValue("DEFORM_MAX_VOLUME", mesh_solver->GetMaximum_Volume()); SetHistoryOutputValue("DEFORM_ITER", mesh_solver->GetIterLinSolver()); - SetHistoryOutputValue("DEFORM_RESIDUAL", log10(mesh_solver->GetLinSol_Residual())); + SetHistoryOutputValue("DEFORM_RESIDUAL", log10(mesh_solver->GetLinSol_Residual())); } if(config->GetFixed_CL_Mode()){ @@ -664,36 +664,36 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol SetHistoryOutputValue("CL_DRIVER_COMMAND", flow_solver->GetAoA_inc()); } - + /*--- Set the analyse surface history values --- */ - + SetAnalyzeSurface(flow_solver, geometry, config, false); - + /*--- Set aeroydnamic coefficients --- */ - + SetAerodynamicCoefficients(config, flow_solver); /*--- Set Cp diff fields ---*/ - + Set_CpInverseDesign(flow_solver, geometry, config); - + /*--- Set combo obj value --- */ - + SetHistoryOutputValue("COMBO", flow_solver->GetTotal_ComboObj()); - + } bool CFlowCompOutput::SetInit_Residuals(CConfig *config){ - + return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| (config->GetTime_Marching() == STEADY && (curInnerIter < 2)); - + } bool CFlowCompOutput::SetUpdate_Averages(CConfig *config){ - + return (config->GetTime_Marching() != STEADY && (curInnerIter == config->GetnInner_Iter() - 1 || convergence)); - + } @@ -701,15 +701,15 @@ void CFlowCompOutput::SetAdditionalScreenOutput(CConfig *config){ if (config->GetFixed_CL_Mode()){ SetFixedCLScreenOutput(config); - } + } } void CFlowCompOutput::SetFixedCLScreenOutput(CConfig *config){ - PrintingToolbox::CTablePrinter FixedCLSummary(&cout); - + PrintingToolbox::CTablePrinter FixedCLSummary(&cout); + if (fabs(historyOutput_Map["CL_DRIVER_COMMAND"].value) > 1e-16){ - FixedCLSummary.AddColumn("Fixed CL Mode", 40); - FixedCLSummary.AddColumn("Value", 30); + FixedCLSummary.AddColumn("Fixed CL Mode", 40); + FixedCLSummary.AddColumn("Value", 30); FixedCLSummary.SetAlign(PrintingToolbox::CTablePrinter::LEFT); FixedCLSummary.PrintHeader(); FixedCLSummary << "Current CL" << historyOutput_Map["LIFT"].value; @@ -719,15 +719,15 @@ void CFlowCompOutput::SetFixedCLScreenOutput(CConfig *config){ FixedCLSummary << "Changed AoA by (Finite Difference step)" << historyOutput_Map["CL_DRIVER_COMMAND"].value; lastInnerIter = curInnerIter - 1; } - else + else FixedCLSummary << "Changed AoA by" << historyOutput_Map["CL_DRIVER_COMMAND"].value; FixedCLSummary.PrintFooter(); SetScreen_Header(config); } else if (config->GetFinite_Difference_Mode() && historyOutput_Map["AOA"].value == historyOutput_Map["PREV_AOA"].value){ - FixedCLSummary.AddColumn("Fixed CL Mode (Finite Difference)", 40); - FixedCLSummary.AddColumn("Value", 30); + FixedCLSummary.AddColumn("Fixed CL Mode (Finite Difference)", 40); + FixedCLSummary.AddColumn("Value", 30); FixedCLSummary.SetAlign(PrintingToolbox::CTablePrinter::LEFT); FixedCLSummary.PrintHeader(); FixedCLSummary << "Delta CL / Delta AoA" << config->GetdCL_dAlpha(); diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index f0372aac2ad..1b3249df3c9 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -41,21 +41,21 @@ #include "../../include/solver_structure.hpp" CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutput(config, nDim, false) { - + turb_model = config->GetKind_Turb_Model(); - + heat = config->GetEnergy_Equation(); - + weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); - + /*--- Set the default history fields if nothing is set in the config file ---*/ - + if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); nRequestedHistoryFields = requestedHistoryFields.size(); } - + if (nRequestedScreenFields == 0){ if (multiZone) requestedScreenFields.emplace_back("OUTER_ITER"); requestedScreenFields.emplace_back("INNER_ITER"); @@ -64,28 +64,28 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp requestedScreenFields.emplace_back("RMS_VELOCITY-Y"); nRequestedScreenFields = requestedScreenFields.size(); } - + if (nRequestedVolumeFields == 0){ requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("PRIMITIVE"); nRequestedVolumeFields = requestedVolumeFields.size(); } - + stringstream ss; ss << "Zone " << config->GetiZone() << " (Incomp. Fluid)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - - volumeFilename = config->GetVolume_FileName(); - + + volumeFilename = config->GetVolume_FileName(); + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_FileName(); /*--- Set the default convergence field --- */ @@ -100,86 +100,86 @@ CFlowIncOutput::~CFlowIncOutput(void) {} void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ - /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. + /// BEGIN_GROUP: RMS_RES, DESCRIPTION: The root-mean-square residuals of the SOLUTION variables. /// DESCRIPTION: Root-mean square residual of the pressure. AddHistoryOutput("RMS_PRESSURE", "rms[P]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the pressure.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Root-mean square residual of the velocity x-component. + /// DESCRIPTION: Root-mean square residual of the velocity x-component. AddHistoryOutput("RMS_VELOCITY-X", "rms[U]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the velocity x-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Root-mean square residual of the velocity y-component. + /// DESCRIPTION: Root-mean square residual of the velocity y-component. AddHistoryOutput("RMS_VELOCITY-Y", "rms[V]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the velocity y-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Root-mean square residual of the velocity z-component. + /// DESCRIPTION: Root-mean square residual of the velocity z-component. if (nDim == 3) AddHistoryOutput("RMS_VELOCITY-Z", "rms[W]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. if (heat || weakly_coupled_heat) AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: - /// DESCRIPTION: Root-mean square residual of nu tilde (SA model). + /// DESCRIPTION: Root-mean square residual of nu tilde (SA model). AddHistoryOutput("RMS_NU_TILDE", "rms[nu]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of nu tilde (SA model).", HistoryFieldType::RESIDUAL); - break; + break; case SST: case SST_SUST: - /// DESCRIPTION: Root-mean square residual of kinetic energy (SST model). + /// DESCRIPTION: Root-mean square residual of kinetic energy (SST model). AddHistoryOutput("RMS_TKE", "rms[k]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of kinetic energy (SST model).", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Root-mean square residual of the dissipation (SST model). + /// DESCRIPTION: Root-mean square residual of the dissipation (SST model). AddHistoryOutput("RMS_DISSIPATION", "rms[w]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of dissipation (SST model).", HistoryFieldType::RESIDUAL); break; default: break; } /// END_GROUP - - /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. + + /// BEGIN_GROUP: MAX_RES, DESCRIPTION: The maximum residuals of the SOLUTION variables. /// DESCRIPTION: Maximum residual of the pressure. AddHistoryOutput("MAX_PRESSURE", "max[P]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the pressure.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the velocity x-component. + /// DESCRIPTION: Maximum residual of the velocity x-component. AddHistoryOutput("MAX_VELOCITY-X", "max[U]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the velocity x-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the velocity y-component. + /// DESCRIPTION: Maximum residual of the velocity y-component. AddHistoryOutput("MAX_VELOCITY-Y", "max[V]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the velocity y-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the velocity z-component. - if (nDim == 3) + /// DESCRIPTION: Maximum residual of the velocity z-component. + if (nDim == 3) AddHistoryOutput("MAX_VELOCITY-Z", "max[W]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) + if (heat || weakly_coupled_heat) AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Root-mean square residual of the temperature.", HistoryFieldType::RESIDUAL); - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Maximum residual of nu tilde (SA model). AddHistoryOutput("MAX_NU_TILDE", "max[nu]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of nu tilde (SA model).", HistoryFieldType::RESIDUAL); - break; + break; case SST: case SST_SUST: - /// DESCRIPTION: Maximum residual of kinetic energy (SST model). + /// DESCRIPTION: Maximum residual of kinetic energy (SST model). AddHistoryOutput("MAX_TKE", "max[k]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of kinetic energy (SST model).", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the dissipation (SST model). - AddHistoryOutput("MAX_DISSIPATION", "max[w]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of dissipation (SST model).", HistoryFieldType::RESIDUAL); + /// DESCRIPTION: Maximum residual of the dissipation (SST model). + AddHistoryOutput("MAX_DISSIPATION", "max[w]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of dissipation (SST model).", HistoryFieldType::RESIDUAL); break; default: break; } /// END_GROUP - - /// BEGIN_GROUP: BGS_RES, DESCRIPTION: The block-gauss seidel residuals of the SOLUTION variables. + + /// BEGIN_GROUP: BGS_RES, DESCRIPTION: The block-gauss seidel residuals of the SOLUTION variables. /// DESCRIPTION: Maximum residual of the pressure. AddHistoryOutput("BGS_PRESSURE", "bgs[P]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the pressure.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the velocity x-component. + /// DESCRIPTION: Maximum residual of the velocity x-component. AddHistoryOutput("BGS_VELOCITY-X", "bgs[U]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the velocity x-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the velocity y-component. + /// DESCRIPTION: Maximum residual of the velocity y-component. AddHistoryOutput("BGS_VELOCITY-Y", "bgs[V]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the velocity y-component.", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the velocity z-component. - if (nDim == 3) + /// DESCRIPTION: Maximum residual of the velocity z-component. + if (nDim == 3) AddHistoryOutput("BGS_VELOCITY-Z", "bgs[W]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the velocity z-component.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Maximum residual of the temperature. - if (heat || weakly_coupled_heat) + if (heat || weakly_coupled_heat) AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of the temperature.", HistoryFieldType::RESIDUAL); - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: /// DESCRIPTION: Maximum residual of nu tilde (SA model). AddHistoryOutput("BGS_NU_TILDE", "bgs[nu]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of nu tilde (SA model).", HistoryFieldType::RESIDUAL); - break; + break; case SST: case SST_SUST: - /// DESCRIPTION: Maximum residual of kinetic energy (SST model). + /// DESCRIPTION: Maximum residual of kinetic energy (SST model). AddHistoryOutput("BGS_TKE", "bgs[k]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of kinetic energy (SST model).", HistoryFieldType::RESIDUAL); - /// DESCRIPTION: Maximum residual of the dissipation (SST model). - AddHistoryOutput("BGS_DISSIPATION", "bgs[w]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of dissipation (SST model).", HistoryFieldType::RESIDUAL); + /// DESCRIPTION: Maximum residual of the dissipation (SST model). + AddHistoryOutput("BGS_DISSIPATION", "bgs[w]", ScreenOutputFormat::FIXED, "BGS_RES", "BGS residual of dissipation (SST model).", HistoryFieldType::RESIDUAL); break; default: break; } @@ -188,90 +188,90 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ /// BEGIN_GROUP: HEAT_COEFF, DESCRIPTION: Heat coefficients on all surfaces set with MARKER_MONITORING. /// DESCRIPTION: Total heatflux AddHistoryOutput("HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heatflux on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Maximal heatflux + /// DESCRIPTION: Maximal heatflux AddHistoryOutput("HEATFLUX_MAX", "maxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total maximum heatflux on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Temperature AddHistoryOutput("TEMPERATURE", "Temp", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total avg. temperature on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// END_GROUP - - /// DESCRIPTION: Angle of attack + + /// DESCRIPTION: Angle of attack AddHistoryOutput("AOA", "AoA", ScreenOutputFormat::SCIENTIFIC,"AOA", "Angle of attack"); - /// DESCRIPTION: Linear solver iterations + /// DESCRIPTION: Linear solver iterations AddHistoryOutput("LINSOL_ITER", "LinSolIter", ScreenOutputFormat::INTEGER, "LINSOL", "Number of iterations of the linear solver."); AddHistoryOutput("LINSOL_RESIDUAL", "LinSolRes", ScreenOutputFormat::FIXED, "LINSOL", "Residual of the linear solver."); - AddHistoryOutput("CFL_NUMBER", "CFL number", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current value of the CFL number"); - + AddHistoryOutput("CFL_NUMBER", "CFL number", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current value of the CFL number"); + if (config->GetDeform_Mesh()){ AddHistoryOutput("DEFORM_MIN_VOLUME", "MinVolume", ScreenOutputFormat::SCIENTIFIC, "DEFORM", "Minimum volume in the mesh"); AddHistoryOutput("DEFORM_MAX_VOLUME", "MaxVolume", ScreenOutputFormat::SCIENTIFIC, "DEFORM", "Maximum volume in the mesh"); AddHistoryOutput("DEFORM_ITER", "DeformIter", ScreenOutputFormat::INTEGER, "DEFORM", "Linear solver iterations for the mesh deformation"); - AddHistoryOutput("DEFORM_RESIDUAL", "DeformRes", ScreenOutputFormat::FIXED, "DEFORM", "Residual of the linear solver for the mesh deformation"); + AddHistoryOutput("DEFORM_RESIDUAL", "DeformRes", ScreenOutputFormat::FIXED, "DEFORM", "Residual of the linear solver for the mesh deformation"); } - + /*--- Add analyze surface history fields --- */ - + AddAnalyzeSurfaceOutput(config); - + /*--- Add aerodynamic coefficients fields --- */ - + AddAerodynamicCoefficients(config); - + } void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { - + CSolver* flow_solver = solver[FLOW_SOL]; - CSolver* turb_solver = solver[TURB_SOL]; + CSolver* turb_solver = solver[TURB_SOL]; CSolver* heat_solver = solver[HEAT_SOL]; CSolver* mesh_solver = solver[MESH_SOL]; - + SetHistoryOutputValue("RMS_PRESSURE", log10(flow_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_VELOCITY-X", log10(flow_solver->GetRes_RMS(1))); SetHistoryOutputValue("RMS_VELOCITY-Y", log10(flow_solver->GetRes_RMS(2))); if (nDim == 3) SetHistoryOutputValue("RMS_VELOCITY-Z", log10(flow_solver->GetRes_RMS(3))); - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("RMS_NU_TILDE", log10(turb_solver->GetRes_RMS(0))); - break; + break; case SST: case SST_SUST: SetHistoryOutputValue("RMS_TKE", log10(turb_solver->GetRes_RMS(0))); SetHistoryOutputValue("RMS_DISSIPATION", log10(turb_solver->GetRes_RMS(1))); break; } - + SetHistoryOutputValue("MAX_PRESSURE", log10(flow_solver->GetRes_Max(0))); SetHistoryOutputValue("MAX_VELOCITY-X", log10(flow_solver->GetRes_Max(1))); SetHistoryOutputValue("MAX_VELOCITY-Y", log10(flow_solver->GetRes_Max(2))); if (nDim == 3) SetHistoryOutputValue("RMS_VELOCITY-Z", log10(flow_solver->GetRes_Max(3))); - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("MAX_NU_TILDE", log10(turb_solver->GetRes_Max(0))); - break; + break; case SST: case SST_SUST: SetHistoryOutputValue("MAX_TKE", log10(turb_solver->GetRes_Max(0))); SetHistoryOutputValue("MAX_DISSIPATION", log10(turb_solver->GetRes_Max(1))); break; } - + if (multiZone){ SetHistoryOutputValue("BGS_PRESSURE", log10(flow_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_VELOCITY-X", log10(flow_solver->GetRes_BGS(1))); SetHistoryOutputValue("BGS_VELOCITY-Y", log10(flow_solver->GetRes_BGS(2))); if (nDim == 3) SetHistoryOutputValue("BGS_VELOCITY-Z", log10(flow_solver->GetRes_BGS(3))); - + switch(turb_model){ case SA: case SA_NEG: case SA_E: case SA_COMP: case SA_E_COMP: SetHistoryOutputValue("BGS_NU_TILDE", log10(turb_solver->GetRes_BGS(0))); - break; + break; case SST: SetHistoryOutputValue("BGS_TKE", log10(turb_solver->GetRes_BGS(0))); SetHistoryOutputValue("BGS_DISSIPATION", log10(turb_solver->GetRes_BGS(1))); break; } } - + if (weakly_coupled_heat){ SetHistoryOutputValue("HEATFLUX", heat_solver->GetTotal_HeatFlux()); SetHistoryOutputValue("HEATFLUX_MAX", heat_solver->GetTotal_MaxHeatFlux()); @@ -286,7 +286,7 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv SetHistoryOutputValue("TEMPERATURE", flow_solver->GetTotal_AvgTemperature()); if (nDim == 3) SetHistoryOutputValue("RMS_TEMPERATURE", log10(flow_solver->GetRes_RMS(4))); else SetHistoryOutputValue("RMS_TEMPERATURE", log10(flow_solver->GetRes_RMS(3))); - + if (nDim == 3) SetHistoryOutputValue("MAX_TEMPERATURE", log10(flow_solver->GetRes_Max(4))); else SetHistoryOutputValue("MAX_TEMPERATURE", log10(flow_solver->GetRes_Max(3))); if (multiZone){ @@ -294,91 +294,91 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv else SetHistoryOutputValue("BGS_TEMPERATURE", log10(flow_solver->GetRes_BGS(3))); } - } - + } + SetHistoryOutputValue("LINSOL_ITER", flow_solver->GetIterLinSolver()); SetHistoryOutputValue("LINSOL_RESIDUAL", log10(flow_solver->GetLinSol_Residual())); - + if (config->GetDeform_Mesh()){ SetHistoryOutputValue("DEFORM_MIN_VOLUME", mesh_solver->GetMinimum_Volume()); SetHistoryOutputValue("DEFORM_MAX_VOLUME", mesh_solver->GetMaximum_Volume()); SetHistoryOutputValue("DEFORM_ITER", mesh_solver->GetIterLinSolver()); SetHistoryOutputValue("DEFORM_RESIDUAL", log10(mesh_solver->GetLinSol_Residual())); } - + SetHistoryOutputValue("CFL_NUMBER", config->GetCFL(MESH_0)); - + /*--- Set the analyse surface history values --- */ - + SetAnalyzeSurface(flow_solver, geometry, config, false); - + /*--- Set aeroydnamic coefficients --- */ - + SetAerodynamicCoefficients(config, flow_solver); } void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ - + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); if (nDim == 3) AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); - + // SOLUTION variables AddVolumeOutput("PRESSURE", "Pressure", "SOLUTION", "Pressure"); AddVolumeOutput("VELOCITY-X", "Velocity_x", "SOLUTION", "x-component of the velocity vector"); AddVolumeOutput("VELOCITY-Y", "Velocity_y", "SOLUTION", "y-component of the velocity vector"); - if (nDim == 3) + if (nDim == 3) AddVolumeOutput("VELOCITY-Z", "Velocity_z", "SOLUTION", "z-component of the velocity vector"); - if (heat || weakly_coupled_heat) - AddVolumeOutput("TEMPERATURE", "Temperature","SOLUTION", "Temperature"); - + if (heat || weakly_coupled_heat) + AddVolumeOutput("TEMPERATURE", "Temperature","SOLUTION", "Temperature"); + switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy"); AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation"); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: AddVolumeOutput("NU_TILDE", "Nu_Tilde", "SOLUTION", "Spalart–Allmaras variable"); break; case NONE: break; } - + // Grid velocity if (config->GetGrid_Movement()){ AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); - if (nDim == 3 ) + if (nDim == 3 ) AddVolumeOutput("GRID_VELOCITY-Z", "Grid_Velocity_z", "GRID_VELOCITY", "z-component of the grid velocity vector"); } - + // Primitive variables AddVolumeOutput("PRESSURE_COEFF", "Pressure_Coefficient", "PRIMITIVE", "Pressure coefficient"); AddVolumeOutput("DENSITY", "Density", "PRIMITIVE", "Density"); - + if (config->GetKind_Solver() == INC_RANS || config->GetKind_Solver() == INC_NAVIER_STOKES){ AddVolumeOutput("LAMINAR_VISCOSITY", "Laminar_Viscosity", "PRIMITIVE", "Laminar viscosity"); - + AddVolumeOutput("SKIN_FRICTION-X", "Skin_Friction_Coefficient_x", "PRIMITIVE", "x-component of the skin friction vector"); AddVolumeOutput("SKIN_FRICTION-Y", "Skin_Friction_Coefficient_y", "PRIMITIVE", "y-component of the skin friction vector"); if (nDim == 3) AddVolumeOutput("SKIN_FRICTION-Z", "Skin_Friction_Coefficient_z", "PRIMITIVE", "z-component of the skin friction vector"); - + AddVolumeOutput("HEAT_FLUX", "Heat_Flux", "PRIMITIVE", "Heat-flux"); AddVolumeOutput("Y_PLUS", "Y_Plus", "PRIMITIVE", "Non-dim. wall distance (Y-Plus)"); - + } - + if (config->GetKind_Solver() == INC_RANS) { AddVolumeOutput("EDDY_VISCOSITY", "Eddy_Viscosity", "PRIMITIVE", "Turbulent eddy viscosity"); } - + if (config->GetKind_Trans_Model() == BC){ AddVolumeOutput("INTERMITTENCY", "gamma_BC", "INTERMITTENCY", "Intermittency"); } @@ -390,20 +390,20 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("RES_VELOCITY-Z", "Residual_Velocity_z", "RESIDUAL", "Residual of the z-velocity component"); AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature"); - + switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: AddVolumeOutput("RES_TKE", "Residual_TKE", "RESIDUAL", "Residual of turbulent kinetic energy"); AddVolumeOutput("RES_DISSIPATION", "Residual_Omega", "RESIDUAL", "Residual of the rate of dissipation."); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: AddVolumeOutput("RES_NU_TILDE", "Residual_Nu_Tilde", "RESIDUAL", "Residual of the Spalart–Allmaras variable"); break; case NONE: break; } - + // Limiter values AddVolumeOutput("LIMITER_PRESSURE", "Limiter_Pressure", "LIMITER", "Limiter value of the pressure"); AddVolumeOutput("LIMITER_VELOCITY-X", "Limiter_Velocity_x", "LIMITER", "Limiter value of the x-velocity"); @@ -411,36 +411,36 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("LIMITER_VELOCITY-Z", "Limiter_Velocity_z", "LIMITER", "Limiter value of the z-velocity"); AddVolumeOutput("LIMITER_TEMPERATURE", "Limiter_Temperature", "LIMITER", "Limiter value of the temperature"); - + switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy."); AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate."); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of Spalart–Allmaras variable."); break; case NONE: break; } - + // Hybrid RANS-LES if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ AddVolumeOutput("DES_LENGTHSCALE", "DES_LengthScale", "DDES", "DES length scale value"); AddVolumeOutput("WALL_DISTANCE", "Wall_Distance", "DDES", "Wall distance value"); } - + // Roe Low Dissipation if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ AddVolumeOutput("ROE_DISSIPATION", "Roe_Dissipation", "ROE_DISSIPATION", "Value of the Roe dissipation"); } - + if(config->GetKind_Solver() == INC_RANS || config->GetKind_Solver() == INC_NAVIER_STOKES){ if (nDim == 3){ AddVolumeOutput("VORTICITY_X", "Vorticity_x", "VORTEX_IDENTIFICATION", "x-component of the vorticity vector"); AddVolumeOutput("VORTICITY_Y", "Vorticity_y", "VORTEX_IDENTIFICATION", "y-component of the vorticity vector"); - AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); + AddVolumeOutput("Q_CRITERION", "Q_Criterion", "VORTEX_IDENTIFICATION", "Value of the Q-Criterion"); } AddVolumeOutput("VORTICITY_Z", "Vorticity_z", "VORTEX_IDENTIFICATION", "z-component of the vorticity vector"); } @@ -448,24 +448,24 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - CVariable* Node_Flow = solver[FLOW_SOL]->GetNodes(); - CVariable* Node_Heat = NULL; + 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]->GetNodes(); + Node_Turb = solver[TURB_SOL]->GetNodes(); } if (weakly_coupled_heat){ Node_Heat = solver[HEAT_SOL]->GetNodes(); } - + CPoint* Node_Geo = geometry->node[iPoint]; - - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(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)); @@ -476,47 +476,47 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, 3)); } 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(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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: SetVolumeOutputValue("NU_TILDE", iPoint, Node_Turb->GetSolution(iPoint, 0)); break; case NONE: break; } - + if (config->GetGrid_Movement()){ SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel()[0]); SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel()[1]); if (nDim == 3) SetVolumeOutputValue("GRID_VELOCITY-Z", iPoint, Node_Geo->GetGridVel()[2]); } - + su2double VelMag = 0.0; for (unsigned short iDim = 0; iDim < nDim; iDim++){ - VelMag += pow(solver[FLOW_SOL]->GetVelocity_Inf(iDim),2.0); + VelMag += pow(solver[FLOW_SOL]->GetVelocity_Inf(iDim),2.0); } - su2double factor = 1.0/(0.5*solver[FLOW_SOL]->GetDensity_Inf()*VelMag); + su2double factor = 1.0/(0.5*solver[FLOW_SOL]->GetDensity_Inf()*VelMag); 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(iPoint)); } - + if (config->GetKind_Solver() == INC_RANS) { SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity(iPoint)); } - + if (config->GetKind_Trans_Model() == BC){ SetVolumeOutputValue("INTERMITTENCY", iPoint, Node_Turb->GetGammaBC(iPoint)); } - + SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 0)); SetVolumeOutputValue("RES_VELOCITY-X", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 1)); SetVolumeOutputValue("RES_VELOCITY-Y", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 2)); @@ -526,20 +526,20 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve } else { SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes.GetBlock(iPoint, 3)); } - + switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: SetVolumeOutputValue("RES_TKE", iPoint, solver[TURB_SOL]->LinSysRes.GetBlock(iPoint, 0)); SetVolumeOutputValue("RES_DISSIPATION", iPoint, solver[TURB_SOL]->LinSysRes.GetBlock(iPoint, 1)); break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: SetVolumeOutputValue("RES_NU_TILDE", iPoint, solver[TURB_SOL]->LinSysRes.GetBlock(iPoint, 0)); break; case NONE: break; } - + 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)); @@ -547,69 +547,69 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve 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(iPoint, 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(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: + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: 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(iPoint)); SetVolumeOutputValue("WALL_DISTANCE", iPoint, Node_Geo->GetWall_Distance()); } - + if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ 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(iPoint)[0]); - SetVolumeOutputValue("VORTICITY_Y", iPoint, Node_Flow->GetVorticity(iPoint)[1]); + 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(iPoint)[2]); + } + SetVolumeOutputValue("VORTICITY_Z", iPoint, Node_Flow->GetVorticity(iPoint)[2]); } } void CFlowIncOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ - + if ((config->GetKind_Solver() == INC_NAVIER_STOKES) || (config->GetKind_Solver() == INC_RANS)) { SetVolumeOutputValue("SKIN_FRICTION-X", iPoint, solver[FLOW_SOL]->GetCSkinFriction(iMarker, iVertex, 0)); SetVolumeOutputValue("SKIN_FRICTION-Y", iPoint, solver[FLOW_SOL]->GetCSkinFriction(iMarker, iVertex, 1)); if (nDim == 3) SetVolumeOutputValue("SKIN_FRICTION-Z", iPoint, solver[FLOW_SOL]->GetCSkinFriction(iMarker, iVertex, 2)); - + if (weakly_coupled_heat) SetVolumeOutputValue("HEAT_FLUX", iPoint, solver[HEAT_SOL]->GetHeatFlux(iMarker, iVertex)); else { SetVolumeOutputValue("HEAT_FLUX", iPoint, solver[FLOW_SOL]->GetHeatFlux(iMarker, iVertex)); - + } SetVolumeOutputValue("Y_PLUS", iPoint, solver[FLOW_SOL]->GetYPlus(iMarker, iVertex)); } } bool CFlowIncOutput::SetInit_Residuals(CConfig *config){ - - return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| - (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); - + + return (config->GetTime_Marching() != STEADY && (curInnerIter == 0))|| + (config->GetTime_Marching() == STEADY && (curTimeIter < 2)); + } bool CFlowIncOutput::SetUpdate_Averages(CConfig *config){ return false; - + // return (config->GetUnsteady_Simulation() != STEADY && !dualtime); - + } diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 8f740eaf411..7d482c9ed0d 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -39,86 +39,86 @@ #include "../../include/solver_structure.hpp" CFlowOutput::CFlowOutput(CConfig *config, unsigned short nDim, bool fem_output) : COutput (config, nDim, fem_output){ - + } CFlowOutput::~CFlowOutput(void){} void CFlowOutput::AddAnalyzeSurfaceOutput(CConfig *config){ - - - /// DESCRIPTION: Average mass flow + + + /// DESCRIPTION: Average mass flow AddHistoryOutput("AVG_MASSFLOW", "Avg_Massflow", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average mass flow on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Mach number + /// DESCRIPTION: Average Mach number AddHistoryOutput("AVG_MACH", "Avg_Mach", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average mach number on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Temperature + /// DESCRIPTION: Average Temperature AddHistoryOutput("AVG_TEMP", "Avg_Temp", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average temperature on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Pressure + /// DESCRIPTION: Average Pressure AddHistoryOutput("AVG_PRESS", "Avg_Press", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average pressure on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Density + /// DESCRIPTION: Average Density AddHistoryOutput("AVG_DENSITY", "Avg_Density", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average density on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Enthalpy + /// DESCRIPTION: Average Enthalpy AddHistoryOutput("AVG_ENTHALPY", "Avg_Enthalpy", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average enthalpy on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Average velocity in normal direction of the surface AddHistoryOutput("AVG_NORMALVEL", "Avg_NormalVel", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average normal velocity on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Flow uniformity + /// DESCRIPTION: Flow uniformity AddHistoryOutput("UNIFORMITY", "Uniformity", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total flow uniformity on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Secondary strength AddHistoryOutput("SECONDARY_STRENGTH", "Secondary_Strength", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total secondary strength on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Momentum distortion + /// DESCRIPTION: Momentum distortion AddHistoryOutput("MOMENTUM_DISTORTION", "Momentum_Distortion", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total momentum distortion on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Secondary over uniformity + /// DESCRIPTION: Secondary over uniformity AddHistoryOutput("SECONDARY_OVER_UNIFORMITY", "Secondary_Over_Uniformity", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total secondary over uniformity on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average total temperature + /// DESCRIPTION: Average total temperature AddHistoryOutput("AVG_TOTALTEMP", "Avg_TotalTemp", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average total temperature all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average total pressure + /// DESCRIPTION: Average total pressure AddHistoryOutput("AVG_TOTALPRESS", "Avg_TotalPress", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total average total pressure on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Pressure drop + /// DESCRIPTION: Pressure drop AddHistoryOutput("PRESSURE_DROP", "Pressure_Drop", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF", "Total pressure drop on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT); /// END_GROUP - - + + /// BEGIN_GROUP: AERO_COEFF_SURF, DESCRIPTION: Surface values on non-solid markers. vector Marker_Analyze; for (unsigned short iMarker_Analyze = 0; iMarker_Analyze < config->GetnMarker_Analyze(); iMarker_Analyze++){ Marker_Analyze.push_back(config->GetMarker_Analyze_TagBound(iMarker_Analyze)); - } - - /// DESCRIPTION: Average mass flow + } + + /// DESCRIPTION: Average mass flow AddHistoryOutputPerSurface("AVG_MASSFLOW", "Avg_Massflow", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Mach number + /// DESCRIPTION: Average Mach number AddHistoryOutputPerSurface("AVG_MACH", "Avg_Mach", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Temperature + /// DESCRIPTION: Average Temperature AddHistoryOutputPerSurface("AVG_TEMP", "Avg_Temp", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Pressure + /// DESCRIPTION: Average Pressure AddHistoryOutputPerSurface("AVG_PRESS", "Avg_Press", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Density + /// DESCRIPTION: Average Density AddHistoryOutputPerSurface("AVG_DENSITY", "Avg_Density", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average Enthalpy + /// DESCRIPTION: Average Enthalpy AddHistoryOutputPerSurface("AVG_ENTHALPY", "Avg_Enthalpy", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Average velocity in normal direction of the surface AddHistoryOutputPerSurface("AVG_NORMALVEL", "Avg_NormalVel", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Flow uniformity + /// DESCRIPTION: Flow uniformity AddHistoryOutputPerSurface("UNIFORMITY", "Uniformity", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); /// DESCRIPTION: Secondary strength AddHistoryOutputPerSurface("SECONDARY_STRENGTH", "Secondary_Strength", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Momentum distortion + /// DESCRIPTION: Momentum distortion AddHistoryOutputPerSurface("MOMENTUM_DISTORTION", "Momentum_Distortion", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Secondary over uniformity + /// DESCRIPTION: Secondary over uniformity AddHistoryOutputPerSurface("SECONDARY_OVER_UNIFORMITY", "Secondary_Over_Uniformity", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average total temperature + /// DESCRIPTION: Average total temperature AddHistoryOutputPerSurface("AVG_TOTALTEMP", "Avg_TotalTemp", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Average total pressure + /// DESCRIPTION: Average total pressure AddHistoryOutputPerSurface("AVG_TOTALPRESS", "Avg_TotalPress", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Pressure drop + /// DESCRIPTION: Pressure drop AddHistoryOutputPerSurface("PRESSURE_DROP", "Pressure_Drop", ScreenOutputFormat::SCIENTIFIC, "FLOW_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT); /// END_GROUP - + } void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfig *config, bool output){ - + unsigned short iDim, iMarker, iMarker_Analyze; unsigned long iVertex, iPoint; su2double Mach = 0.0, Pressure, Temperature = 0.0, TotalPressure = 0.0, TotalTemperature = 0.0, @@ -138,7 +138,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi bool axisymmetric = config->GetAxisymmetric(); unsigned short nMarker_Analyze = config->GetnMarker_Analyze(); - + su2double *Vector = new su2double[nDim]; su2double *Surface_MassFlow = new su2double[nMarker]; su2double *Surface_Mach = new su2double[nMarker]; @@ -154,7 +154,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi su2double *Surface_VelocityIdeal = new su2double[nMarker]; su2double *Surface_Area = new su2double[nMarker]; su2double *Surface_MassFlow_Abs = new su2double[nMarker]; - + su2double Tot_Surface_MassFlow = 0.0; su2double Tot_Surface_Mach = 0.0; su2double Tot_Surface_Temperature = 0.0; @@ -169,11 +169,11 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi su2double Tot_Momentum_Distortion = 0.0; su2double Tot_SecondOverUniformity = 0.0; su2double Tot_Surface_PressureDrop = 0.0; - + /*--- Compute the numerical fan face Mach number, and the total area of the inflow ---*/ - + for (iMarker = 0; iMarker < nMarker; iMarker++) { - + Surface_MassFlow[iMarker] = 0.0; Surface_Mach[iMarker] = 0.0; Surface_Temperature[iMarker] = 0.0; @@ -190,14 +190,14 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi Surface_MassFlow_Abs[iMarker] = 0.0; if (config->GetMarker_All_Analyze(iMarker) == YES) { - + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - + if (geometry->node[iPoint]->GetDomain()) { - + geometry->vertex[iMarker][iVertex]->GetNormal(Vector); - + if (axisymmetric) { if (geometry->node[iPoint]->GetCoord(1) != 0.0) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1); @@ -217,7 +217,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi Vn += Velocity[iDim] * Vector[iDim] * AxiFactor; MassFlow += Vector[iDim] * AxiFactor * Density * Velocity[iDim]; } - + Area = sqrt (Area); if (AxiFactor == 0.0) Vn = 0.0; else Vn /= Area; Vn2 = Vn * Vn; @@ -259,7 +259,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi if (Kind_Average == AVERAGE_MASSFLUX) Weight = abs(MassFlow); else if (Kind_Average == AVERAGE_AREA) Weight = abs(Area); else Weight = 1.0; - + Surface_Mach[iMarker] += Mach*Weight; Surface_Temperature[iMarker] += Temperature*Weight; Surface_Density[iMarker] += Density*Weight; @@ -278,13 +278,13 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi } } - + } - + } - + /*--- Copy to the appropriate structure ---*/ - + su2double *Surface_MassFlow_Local = new su2double [nMarker_Analyze]; su2double *Surface_Mach_Local = new su2double [nMarker_Analyze]; su2double *Surface_Temperature_Local = new su2double [nMarker_Analyze]; @@ -298,7 +298,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi su2double *Surface_TotalPressure_Local = new su2double [nMarker_Analyze]; su2double *Surface_Area_Local = new su2double [nMarker_Analyze]; su2double *Surface_MassFlow_Abs_Local = new su2double [nMarker_Analyze]; - + su2double *Surface_MassFlow_Total = new su2double [nMarker_Analyze]; su2double *Surface_Mach_Total = new su2double [nMarker_Analyze]; su2double *Surface_Temperature_Total = new su2double [nMarker_Analyze]; @@ -329,7 +329,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi Surface_TotalPressure_Local[iMarker_Analyze] = 0.0; Surface_Area_Local[iMarker_Analyze] = 0.0; Surface_MassFlow_Abs_Local[iMarker_Analyze] = 0.0; - + Surface_MassFlow_Total[iMarker_Analyze] = 0.0; Surface_Mach_Total[iMarker_Analyze] = 0.0; Surface_Temperature_Total[iMarker_Analyze] = 0.0; @@ -347,17 +347,17 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi Surface_MomentumDistortion_Total[iMarker_Analyze] = 0.0; } - + /*--- Compute the numerical fan face Mach number, mach number, temperature and the total area ---*/ - + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - + if (config->GetMarker_All_Analyze(iMarker) == YES) { - + for (iMarker_Analyze= 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { - + /*--- Add the Surface_MassFlow, and Surface_Area to the particular boundary ---*/ - + if (config->GetMarker_All_TagBound(iMarker) == config->GetMarker_Analyze_TagBound(iMarker_Analyze)) { Surface_MassFlow_Local[iMarker_Analyze] += Surface_MassFlow[iMarker]; Surface_Mach_Local[iMarker_Analyze] += Surface_Mach[iMarker]; @@ -373,15 +373,15 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi Surface_Area_Local[iMarker_Analyze] += Surface_Area[iMarker]; Surface_MassFlow_Abs_Local[iMarker_Analyze] += Surface_MassFlow_Abs[iMarker]; } - + } - + } - + } - + #ifdef HAVE_MPI - + SU2_MPI::Allreduce(Surface_MassFlow_Local, Surface_MassFlow_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); SU2_MPI::Allreduce(Surface_Mach_Local, Surface_Mach_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); SU2_MPI::Allreduce(Surface_Temperature_Local, Surface_Temperature_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); @@ -397,7 +397,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi SU2_MPI::Allreduce(Surface_MassFlow_Abs_Local, Surface_MassFlow_Abs_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); #else - + for (iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { Surface_MassFlow_Total[iMarker_Analyze] = Surface_MassFlow_Local[iMarker_Analyze]; Surface_Mach_Total[iMarker_Analyze] = Surface_Mach_Local[iMarker_Analyze]; @@ -413,14 +413,14 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi Surface_Area_Total[iMarker_Analyze] = Surface_Area_Local[iMarker_Analyze]; Surface_MassFlow_Abs_Total[iMarker_Analyze] = Surface_MassFlow_Abs_Local[iMarker_Analyze]; } - + #endif - + /*--- Compute the value of Surface_Area_Total, and Surface_Pressure_Total, and set the value in the config structure for future use ---*/ - + for (iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { - + if (Kind_Average == AVERAGE_MASSFLUX) Weight = Surface_MassFlow_Abs_Total[iMarker_Analyze]; else if (Kind_Average == AVERAGE_AREA) Weight = abs(Surface_Area_Total[iMarker_Analyze]); else Weight = 1.0; @@ -462,62 +462,62 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi } } - + for (iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { - + su2double MassFlow = Surface_MassFlow_Total[iMarker_Analyze] * config->GetDensity_Ref() * config->GetVelocity_Ref(); if (config->GetSystemMeasurements() == US) MassFlow *= 32.174; SetHistoryOutputPerSurfaceValue("AVG_MASSFLOW", MassFlow, iMarker_Analyze); Tot_Surface_MassFlow += MassFlow; - + su2double Mach = Surface_Mach_Total[iMarker_Analyze]; SetHistoryOutputPerSurfaceValue("AVG_MACH", Mach, iMarker_Analyze); Tot_Surface_Mach += Mach; - + su2double Temperature = Surface_Temperature_Total[iMarker_Analyze] * config->GetTemperature_Ref(); SetHistoryOutputPerSurfaceValue("AVG_TEMP", Temperature, iMarker_Analyze); Tot_Surface_Temperature += Temperature; - + su2double Pressure = Surface_Pressure_Total[iMarker_Analyze] * config->GetPressure_Ref(); SetHistoryOutputPerSurfaceValue("AVG_PRESS", Pressure, iMarker_Analyze); Tot_Surface_Pressure += Pressure; - + su2double Density = Surface_Density_Total[iMarker_Analyze] * config->GetDensity_Ref(); SetHistoryOutputPerSurfaceValue("AVG_DENSITY", Density, iMarker_Analyze); Tot_Surface_Density += Density; - + su2double Enthalpy = Surface_Enthalpy_Total[iMarker_Analyze]; SetHistoryOutputPerSurfaceValue("AVG_ENTHALPY", Enthalpy, iMarker_Analyze); Tot_Surface_Enthalpy += Enthalpy; - + su2double NormalVelocity = Surface_NormalVelocity_Total[iMarker_Analyze] * config->GetVelocity_Ref(); SetHistoryOutputPerSurfaceValue("AVG_NORMALVEL", NormalVelocity, iMarker_Analyze); Tot_Surface_NormalVelocity += NormalVelocity; - + su2double Uniformity = sqrt(Surface_StreamVelocity2_Total[iMarker_Analyze]) * config->GetVelocity_Ref(); SetHistoryOutputPerSurfaceValue("UNIFORMITY", Uniformity, iMarker_Analyze); Tot_Surface_StreamVelocity2 += Uniformity; - + su2double SecondaryStrength = sqrt(Surface_TransvVelocity2_Total[iMarker_Analyze]) * config->GetVelocity_Ref(); SetHistoryOutputPerSurfaceValue("SECONDARY_STRENGTH", SecondaryStrength, iMarker_Analyze); Tot_Surface_TransvVelocity2 += SecondaryStrength; - + su2double MomentumDistortion = Surface_MomentumDistortion_Total[iMarker_Analyze]; SetHistoryOutputPerSurfaceValue("MOMENTUM_DISTORTION", MomentumDistortion, iMarker_Analyze); Tot_Momentum_Distortion += MomentumDistortion; - + su2double SecondOverUniform = SecondaryStrength/Uniformity; SetHistoryOutputPerSurfaceValue("SECONDARY_OVER_UNIFORMITY", SecondOverUniform, iMarker_Analyze); Tot_SecondOverUniformity += SecondOverUniform; - + su2double TotalTemperature = Surface_TotalTemperature_Total[iMarker_Analyze] * config->GetTemperature_Ref(); SetHistoryOutputPerSurfaceValue("AVG_TOTALTEMP", TotalTemperature, iMarker_Analyze); Tot_Surface_TotalTemperature += TotalTemperature; - + su2double TotalPressure = Surface_TotalPressure_Total[iMarker_Analyze] * config->GetPressure_Ref(); SetHistoryOutputPerSurfaceValue("AVG_TOTALPRESS", TotalPressure, iMarker_Analyze); Tot_Surface_TotalPressure += TotalPressure; - + } /*--- Compute the average static pressure drop between two surfaces. Note @@ -532,14 +532,14 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi if (nMarker_Analyze == 2) { Pressure_Drop = (Surface_Pressure_Total[1]-Surface_Pressure_Total[0]) * config->GetPressure_Ref(); config->SetSurface_PressureDrop(iMarker_Analyze, Pressure_Drop); - } + } SetHistoryOutputPerSurfaceValue("PRESSURE_DROP", Pressure_Drop, iMarker_Analyze); Tot_Surface_PressureDrop += Pressure_Drop; } - + SetHistoryOutputValue("AVG_MASSFLOW", Tot_Surface_MassFlow); SetHistoryOutputValue("AVG_MACH", Tot_Surface_Mach); - SetHistoryOutputValue("AVG_TEMP", Tot_Surface_Temperature); + SetHistoryOutputValue("AVG_TEMP", Tot_Surface_Temperature); SetHistoryOutputValue("AVG_PRESS", Tot_Surface_Pressure); SetHistoryOutputValue("AVG_DENSITY", Tot_Surface_Density); SetHistoryOutputValue("AVG_ENTHALPY", Tot_Surface_Enthalpy); @@ -553,30 +553,30 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi SetHistoryOutputValue("PRESSURE_DROP", Tot_Surface_PressureDrop); if ((rank == MASTER_NODE) && !config->GetDiscrete_Adjoint() && output) { - + cout.precision(6); cout.setf(ios::scientific, ios::floatfield); cout << endl << "Computing surface mean values." << endl << endl; - + for (iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { cout << "Surface "<< config->GetMarker_Analyze_TagBound(iMarker_Analyze) << ":" << endl; - + if (nDim == 3) { if (config->GetSystemMeasurements() == SI) cout << setw(20) << "Area (m^2): "; else cout << setw(20) << "Area (ft^2): "; } else { if (config->GetSystemMeasurements() == SI) cout << setw(20) << "Area (m): "; else cout << setw(20) << "Area (ft): "; } - + if (config->GetSystemMeasurements() == SI) cout << setw(15) << fabs(Surface_Area_Total[iMarker_Analyze]); else if (config->GetSystemMeasurements() == US) cout << setw(15) << fabs(Surface_Area_Total[iMarker_Analyze])*12.0*12.0; - + cout << endl; su2double MassFlow = config->GetSurface_MassFlow(iMarker_Analyze); if (config->GetSystemMeasurements() == SI) cout << setw(20) << "Mf (kg/s): " << setw(15) << MassFlow; else if (config->GetSystemMeasurements() == US) cout << setw(20) << "Mf (lbs/s): " << setw(15) << MassFlow; - + su2double NormalVelocity = config->GetSurface_NormalVelocity(iMarker_Analyze); if (config->GetSystemMeasurements() == SI) cout << setw(20) << "Vn (m/s): " << setw(15) << NormalVelocity; else if (config->GetSystemMeasurements() == US) cout << setw(20) << "Vn (ft/s): " << setw(15) << NormalVelocity; - + cout << endl; su2double Uniformity = config->GetSurface_Uniformity(iMarker_Analyze); @@ -600,7 +600,7 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi su2double Pressure = config->GetSurface_Pressure(iMarker_Analyze); if (config->GetSystemMeasurements() == SI) cout << setw(20) << "P (Pa): " << setw(15) << Pressure; else if (config->GetSystemMeasurements() == US) cout << setw(20) << "P (psf): " << setw(15) << Pressure; - + su2double TotalPressure = config->GetSurface_TotalPressure(iMarker_Analyze); if (config->GetSystemMeasurements() == SI) cout << setw(20) << "PT (Pa): " << setw(15) <GetSystemMeasurements() == US) cout << setw(20) << "PT (psf): " << setw(15) < Marker_Monitoring; for (unsigned short iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++){ Marker_Monitoring.push_back(config->GetMarker_Monitoring_TagBound(iMarker_Monitoring)); - } - /// DESCRIPTION: Drag coefficient + } + /// DESCRIPTION: Drag coefficient AddHistoryOutputPerSurface("DRAG_ON_SURFACE", "CD", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Lift coefficient + /// DESCRIPTION: Lift coefficient AddHistoryOutputPerSurface("LIFT_ON_SURFACE", "CL", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Sideforce coefficient + /// DESCRIPTION: Sideforce coefficient AddHistoryOutputPerSurface("SIDEFORCE_ON_SURFACE", "CSF", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Moment around the x-axis + /// DESCRIPTION: Moment around the x-axis AddHistoryOutputPerSurface("MOMENT-X_ON_SURFACE", "CMx", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Moment around the y-axis + /// DESCRIPTION: Moment around the y-axis AddHistoryOutputPerSurface("MOMENT-Y_ON_SURFACE", "CMy", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Moment around the z-axis + /// DESCRIPTION: Moment around the z-axis AddHistoryOutputPerSurface("MOMENT-Z_ON_SURFACE", "CMz", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Force in x direction + /// DESCRIPTION: Force in x direction AddHistoryOutputPerSurface("FORCE-X_ON_SURFACE", "CFx", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Force in y direction + /// DESCRIPTION: Force in y direction AddHistoryOutputPerSurface("FORCE-Y_ON_SURFACE", "CFy", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Force in z direction + /// DESCRIPTION: Force in z direction AddHistoryOutputPerSurface("FORCE-Z_ON_SURFACE", "CFz", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// DESCRIPTION: Lift-to-drag ratio + /// DESCRIPTION: Lift-to-drag ratio AddHistoryOutputPerSurface("EFFICIENCY_ON_SURFACE", "CEff", ScreenOutputFormat::FIXED, "AERO_COEFF_SURF", Marker_Monitoring, HistoryFieldType::COEFFICIENT); - /// END_GROUP + /// END_GROUP - /// DESCRIPTION: Angle of attack + /// DESCRIPTION: Angle of attack AddHistoryOutput("AOA", "AoA", ScreenOutputFormat::FIXED, "AOA", "Angle of attack"); } void CFlowOutput::SetAerodynamicCoefficients(CConfig *config, CSolver *flow_solver){ - + SetHistoryOutputValue("DRAG", flow_solver->GetTotal_CD()); SetHistoryOutputValue("LIFT", flow_solver->GetTotal_CL()); if (nDim == 3) @@ -753,7 +753,7 @@ void CFlowOutput::SetAerodynamicCoefficients(CConfig *config, CSolver *flow_solv if (nDim == 3) SetHistoryOutputValue("FORCE_Z", flow_solver->GetTotal_CFz()); SetHistoryOutputValue("EFFICIENCY", flow_solver->GetTotal_CEff()); - + for (unsigned short iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) { SetHistoryOutputPerSurfaceValue("DRAG_ON_SURFACE", flow_solver->GetSurface_CD(iMarker_Monitoring), iMarker_Monitoring); SetHistoryOutputPerSurfaceValue("LIFT_ON_SURFACE", flow_solver->GetSurface_CL(iMarker_Monitoring), iMarker_Monitoring); @@ -767,27 +767,27 @@ void CFlowOutput::SetAerodynamicCoefficients(CConfig *config, CSolver *flow_solv SetHistoryOutputPerSurfaceValue("FORCE-X_ON_SURFACE", flow_solver->GetSurface_CFx(iMarker_Monitoring), iMarker_Monitoring); SetHistoryOutputPerSurfaceValue("FORCE-Y_ON_SURFACE", flow_solver->GetSurface_CFy(iMarker_Monitoring), iMarker_Monitoring); if (nDim == 3) - SetHistoryOutputPerSurfaceValue("FORCE-Z_ON_SURFACE", flow_solver->GetSurface_CFz(iMarker_Monitoring), iMarker_Monitoring); - + SetHistoryOutputPerSurfaceValue("FORCE-Z_ON_SURFACE", flow_solver->GetSurface_CFz(iMarker_Monitoring), iMarker_Monitoring); + SetHistoryOutputPerSurfaceValue("EFFICIENCY_ON_SURFACE", flow_solver->GetSurface_CEff(iMarker_Monitoring), iMarker_Monitoring); if (config->GetAeroelastic_Simulation()){ SetHistoryOutputPerSurfaceValue("PITCH", config->GetAeroelastic_pitch(iMarker_Monitoring), iMarker_Monitoring); SetHistoryOutputPerSurfaceValue("PLUNGE", config->GetAeroelastic_plunge(iMarker_Monitoring), iMarker_Monitoring); } } - + SetHistoryOutputValue("AOA", config->GetAoA()); } void CFlowOutput::Add_CpInverseDesignOutput(CConfig *config){ - + AddHistoryOutput("CP_DIFF", "Cp_Diff", ScreenOutputFormat::FIXED, "CP_DIFF", "Cp difference for inverse design"); - + } void CFlowOutput::Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CConfig *config){ - + unsigned short iMarker, icommas, Boundary, iDim; unsigned long iVertex, iPoint, (*Point2Vertex)[2], nPointLocal = 0, nPointGlobal = 0; su2double XCoord, YCoord, ZCoord, Pressure, PressureCoeff = 0, Cp, CpTarget, *Normal = NULL, Area, PressDiff = 0.0; @@ -795,129 +795,129 @@ void CFlowOutput::Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CCon string text_line, surfCp_filename; ifstream Surface_file; char cstr[200]; - + /*--- Prepare to read the surface pressure files (CSV) ---*/ - + surfCp_filename = "TargetCp"; - + surfCp_filename = config->GetUnsteady_FileName(surfCp_filename, (int)curTimeIter, ".dat"); - + strcpy (cstr, surfCp_filename.c_str()); - + /*--- Read the surface pressure file ---*/ - + string::size_type position; - + Surface_file.open(cstr, ios::in); - + if (!(Surface_file.fail())) { - + nPointLocal = geometry->GetnPoint(); #ifdef HAVE_MPI SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); #else nPointGlobal = nPointLocal; #endif - + Point2Vertex = new unsigned long[nPointGlobal][2]; PointInDomain = new bool[nPointGlobal]; - + for (iPoint = 0; iPoint < nPointGlobal; iPoint ++) PointInDomain[iPoint] = false; - + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { Boundary = config->GetMarker_All_KindBC(iMarker); - + if ((Boundary == EULER_WALL ) || (Boundary == HEAT_FLUX ) || (Boundary == ISOTHERMAL ) || (Boundary == NEARFIELD_BOUNDARY)) { for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { - + /*--- The Pressure file uses the global numbering ---*/ - + iPoint = geometry->node[geometry->vertex[iMarker][iVertex]->GetNode()]->GetGlobalIndex(); - + if (geometry->vertex[iMarker][iVertex]->GetNode() < geometry->GetnPointDomain()) { Point2Vertex[iPoint][0] = iMarker; Point2Vertex[iPoint][1] = iVertex; PointInDomain[iPoint] = true; solver->SetCPressureTarget(iMarker, iVertex, 0.0); } - + } } } - + getline(Surface_file, text_line); - + while (getline(Surface_file, text_line)) { for (icommas = 0; icommas < 50; icommas++) { position = text_line.find( ",", 0 ); if (position!=string::npos) text_line.erase (position,1); } stringstream point_line(text_line); - + if (geometry->GetnDim() == 2) point_line >> iPoint >> XCoord >> YCoord >> Pressure >> PressureCoeff; if (geometry->GetnDim() == 3) point_line >> iPoint >> XCoord >> YCoord >> ZCoord >> Pressure >> PressureCoeff; - + if (PointInDomain[iPoint]) { - + /*--- Find the vertex for the Point and Marker ---*/ - + iMarker = Point2Vertex[iPoint][0]; iVertex = Point2Vertex[iPoint][1]; - + solver->SetCPressureTarget(iMarker, iVertex, PressureCoeff); - + } - + } - + Surface_file.close(); - + delete [] Point2Vertex; delete [] PointInDomain; - + /*--- Compute the pressure difference ---*/ - + PressDiff = 0.0; for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { Boundary = config->GetMarker_All_KindBC(iMarker); - + if ((Boundary == EULER_WALL ) || (Boundary == HEAT_FLUX ) || (Boundary == ISOTHERMAL ) || (Boundary == NEARFIELD_BOUNDARY)) { for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { - + Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - + Cp = solver->GetCPressure(iMarker, iVertex); CpTarget = solver->GetCPressureTarget(iMarker, iVertex); - + Area = 0.0; for (iDim = 0; iDim < geometry->GetnDim(); iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area); - + PressDiff += Area * (CpTarget - Cp) * (CpTarget - Cp); } - + } } - + #ifdef HAVE_MPI - su2double MyPressDiff = PressDiff; + su2double MyPressDiff = PressDiff; SU2_MPI::Allreduce(&MyPressDiff, &PressDiff, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); #endif - + } - + /*--- Update the total Cp difference coeffient ---*/ - + solver->SetTotal_CpDiff(PressDiff); - + SetHistoryOutputValue("CP_DIFF", PressDiff); } @@ -949,38 +949,38 @@ su2double CFlowOutput::GetQ_Criterion(su2double** VelocityGradient) const { 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)) - + 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()){ WriteMetaData(config); } - + if (config->GetWrt_ForcesBreakdown()){ WriteForcesBreakdown(config, geometry, solver_container); } - + } void CFlowOutput::WriteMetaData(CConfig *config){ - + ofstream meta_file; - + string filename = "flow"; - + filename = config->GetFilename(filename, ".meta", curTimeIter); - + /*--- All processors open the file. ---*/ if (rank == MASTER_NODE) { meta_file.open(filename.c_str(), ios::out); meta_file.precision(15); - + if (config->GetTime_Marching() == DT_STEPPING_1ST || config->GetTime_Marching() == DT_STEPPING_2ND) meta_file <<"ITER= " << curTimeIter + 1 << endl; else @@ -997,24 +997,24 @@ void CFlowOutput::WriteMetaData(CConfig *config){ meta_file <<"DCMZ_DCL_VALUE= " << config->GetdCMz_dCL() << endl; } meta_file <<"INITIAL_BCTHRUST= " << config->GetInitial_BCThrust() << endl; - - + + if (( config->GetKind_Solver() == DISC_ADJ_EULER || config->GetKind_Solver() == DISC_ADJ_NAVIER_STOKES || config->GetKind_Solver() == DISC_ADJ_RANS )) { meta_file << "SENS_AOA=" << GetHistoryFieldValue("SENS_AOA") * PI_NUMBER / 180.0 << endl; } } - + meta_file.close(); } void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSolver **solver_container){ - + char cstr[200]; unsigned short iDim, iMarker_Monitoring; ofstream Breakdown_file; - + bool compressible = (config->GetKind_Regime() == COMPRESSIBLE); bool incompressible = (config->GetKind_Regime() == INCOMPRESSIBLE); bool unsteady = (config->GetTime_Marching() != NO); @@ -1028,15 +1028,15 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo unsigned short Ref_NonDim = config->GetRef_NonDim(); unsigned short nDim = geometry->GetnDim(); - + /*--- Output the mean flow solution using only the master node ---*/ - + if ( rank == MASTER_NODE) { - + cout << endl << "Writing the forces breakdown file ("<< config->GetBreakdown_FileName() << ")." << endl; - + /*--- Initialize variables to store information from all domains (direct solution) ---*/ - + su2double Total_CL = 0.0, Total_CD = 0.0, Total_CSF = 0.0, Total_CMx = 0.0, Total_CMy = 0.0, Total_CMz = 0.0, Total_CEff = 0.0, Total_CoPx = 0.0, Total_CoPy = 0.0, Total_CoPz = 0.0, @@ -1068,14 +1068,14 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo *Surface_CEff_Mnt = NULL, *Surface_CFx_Mnt = NULL, *Surface_CFy_Mnt = NULL, *Surface_CFz_Mnt = NULL, *Surface_CMx_Mnt = NULL, *Surface_CMy_Mnt = NULL, *Surface_CMz_Mnt = NULL; - + /*--- WARNING: when compiling on Windows, ctime() is not available. Comment out the two lines below that use the dt variable. ---*/ //time_t now = time(0); //string dt = ctime(&now); dt[24] = '.'; - + /*--- Allocate memory for the coefficients being monitored ---*/ - + Surface_CL = new su2double[config->GetnMarker_Monitoring()]; Surface_CD = new su2double[config->GetnMarker_Monitoring()]; Surface_CSF = new su2double[config->GetnMarker_Monitoring()]; @@ -1086,7 +1086,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Surface_CMx = new su2double[config->GetnMarker_Monitoring()]; Surface_CMy = new su2double[config->GetnMarker_Monitoring()]; Surface_CMz = new su2double[config->GetnMarker_Monitoring()]; - + Surface_CL_Inv = new su2double[config->GetnMarker_Monitoring()]; Surface_CD_Inv = new su2double[config->GetnMarker_Monitoring()]; Surface_CSF_Inv = new su2double[config->GetnMarker_Monitoring()]; @@ -1097,7 +1097,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Surface_CMx_Inv = new su2double[config->GetnMarker_Monitoring()]; Surface_CMy_Inv = new su2double[config->GetnMarker_Monitoring()]; Surface_CMz_Inv = new su2double[config->GetnMarker_Monitoring()]; - + Surface_CL_Visc = new su2double[config->GetnMarker_Monitoring()]; Surface_CD_Visc = new su2double[config->GetnMarker_Monitoring()]; Surface_CSF_Visc = @@ -1109,8 +1109,8 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Surface_CMx_Visc = new su2double[config->GetnMarker_Monitoring()]; Surface_CMy_Visc = new su2double[config->GetnMarker_Monitoring()]; Surface_CMz_Visc = new su2double[config->GetnMarker_Monitoring()]; - - + + Surface_CL_Mnt = new su2double[config->GetnMarker_Monitoring()]; Surface_CD_Mnt = new su2double[config->GetnMarker_Monitoring()]; Surface_CSF_Mnt = @@ -1124,7 +1124,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Surface_CMz_Mnt = new su2double[config->GetnMarker_Monitoring()]; /*--- Flow solution coefficients ---*/ - + Total_CL = solver_container[FLOW_SOL]->GetTotal_CL(); Total_CD = solver_container[FLOW_SOL]->GetTotal_CD(); Total_CSF = solver_container[FLOW_SOL]->GetTotal_CSF(); @@ -1135,7 +1135,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Total_CFx = solver_container[FLOW_SOL]->GetTotal_CFx(); Total_CFy = solver_container[FLOW_SOL]->GetTotal_CFy(); Total_CFz = solver_container[FLOW_SOL]->GetTotal_CFz(); - + if (nDim == 2) { Total_CoPx = solver_container[FLOW_SOL]->GetTotal_CoPx() / solver_container[FLOW_SOL]->GetTotal_CFy(); Total_CoPy = solver_container[FLOW_SOL]->GetTotal_CoPy() / solver_container[FLOW_SOL]->GetTotal_CFx(); @@ -1146,11 +1146,11 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Total_CoPy = 0.0; Total_CoPz = solver_container[FLOW_SOL]->GetTotal_CoPz() / solver_container[FLOW_SOL]->GetTotal_CFx(); } - + if (config->GetSystemMeasurements() == US) { Total_CoPx *= 12.0; Total_CoPy *= 12.0; Total_CoPz *= 12.0; } - + /*--- Flow inviscid solution coefficients ---*/ - + Inv_CL = solver_container[FLOW_SOL]->GetAllBound_CL_Inv(); Inv_CD = @@ -1171,9 +1171,9 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo solver_container[FLOW_SOL]->GetAllBound_CFy_Inv(); Inv_CFz = solver_container[FLOW_SOL]->GetAllBound_CFz_Inv(); - + /*--- Flow viscous solution coefficients ---*/ - + Visc_CL = solver_container[FLOW_SOL]->GetAllBound_CL_Visc(); Visc_CD = @@ -1194,9 +1194,9 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo solver_container[FLOW_SOL]->GetAllBound_CFy_Visc(); Visc_CFz = solver_container[FLOW_SOL]->GetAllBound_CFz_Visc(); - + /*--- Flow momentum solution coefficients ---*/ - + Mnt_CL = solver_container[FLOW_SOL]->GetAllBound_CL_Mnt(); Mnt_CD = @@ -1217,10 +1217,10 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo solver_container[FLOW_SOL]->GetAllBound_CFy_Mnt(); Mnt_CFz = solver_container[FLOW_SOL]->GetAllBound_CFz_Mnt(); - - + + /*--- Look over the markers being monitored and get the desired values ---*/ - + for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) { @@ -1254,7 +1254,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Surface_CFz[iMarker_Monitoring] = solver_container[FLOW_SOL]->GetSurface_CFz( iMarker_Monitoring); - + Surface_CL_Inv[iMarker_Monitoring] = solver_container[FLOW_SOL]->GetSurface_CL_Inv( iMarker_Monitoring); @@ -1315,7 +1315,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Surface_CFz_Visc[iMarker_Monitoring] = solver_container[FLOW_SOL]->GetSurface_CFz_Visc( iMarker_Monitoring); - + Surface_CL_Mnt[iMarker_Monitoring] = solver_container[FLOW_SOL]->GetSurface_CL_Mnt( iMarker_Monitoring); @@ -1346,17 +1346,17 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Surface_CFz_Mnt[iMarker_Monitoring] = solver_container[FLOW_SOL]->GetSurface_CFz_Mnt( iMarker_Monitoring); - + } - - + + /*--- Write file name with extension ---*/ - + string filename = config->GetBreakdown_FileName(); strcpy (cstr, filename.data()); - + Breakdown_file.open(cstr, ios::out); - + Breakdown_file << "\n" <<"-------------------------------------------------------------------------" << "\n"; Breakdown_file <<"| ___ _ _ ___ |" << "\n"; Breakdown_file <<"| / __| | | |_ ) Release 6.1.0 \"Falcon\" |" << "\n"; @@ -1395,11 +1395,11 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "| You should have received a copy of the GNU Lesser General Public |" << "\n"; Breakdown_file << "| License along with SU2. If not, see . |" << "\n"; Breakdown_file <<"-------------------------------------------------------------------------" << "\n"; - + Breakdown_file.precision(6); Breakdown_file << "\n" << "\n" << "Problem definition:" << "\n" << "\n"; - + switch (Kind_Solver) { case EULER: case INC_EULER: if (compressible) Breakdown_file << "Compressible Euler equations." << "\n"; @@ -1438,7 +1438,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo (Kind_Solver == RANS) || (Kind_Solver == INC_RANS)) Breakdown_file << "Reynolds number: " << config->GetReynolds() <<"."<< "\n"; } - + if (fixed_cl) { Breakdown_file << "Simulation at a cte. CL: " << config->GetTarget_CL() << ".\n"; Breakdown_file << "Approx. Delta CL / Delta AoA: " << config->GetdCL_dAlpha() << " (1/deg).\n"; @@ -1449,17 +1449,17 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo } Breakdown_file << "Approx. Delta CMz / Delta CL: " << config->GetdCMz_dCL() << ".\n"; } - + if (Ref_NonDim == DIMENSIONAL) { Breakdown_file << "Dimensional simulation." << "\n"; } else if (Ref_NonDim == FREESTREAM_PRESS_EQ_ONE) { Breakdown_file << "Non-Dimensional simulation (P=1.0, Rho=1.0, T=1.0 at the farfield)." << "\n"; } else if (Ref_NonDim == FREESTREAM_VEL_EQ_MACH) { Breakdown_file << "Non-Dimensional simulation (V=Mach, Rho=1.0, T=1.0 at the farfield)." << "\n"; } else if (Ref_NonDim == FREESTREAM_VEL_EQ_ONE) { Breakdown_file << "Non-Dimensional simulation (V=1.0, Rho=1.0, T=1.0 at the farfield)." << "\n"; } - + if (config->GetSystemMeasurements() == SI) { Breakdown_file << "The reference area is " << config->GetRefArea() << " m^2." << "\n"; Breakdown_file << "The reference length is " << config->GetRefLength() << " m." << "\n"; } - + if (config->GetSystemMeasurements() == US) { Breakdown_file << "The reference area is " << config->GetRefArea()*12.0*12.0 << " in^2." << "\n"; Breakdown_file << "The reference length is " << config->GetRefLength()*12.0 << " in." << "\n"; @@ -1475,10 +1475,10 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "temperature and pressure using the ideal gas law." << "\n"; } } - + if (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; else Breakdown_file << "Force coefficients computed using free-stream values." << "\n"; - + if (incompressible) { Breakdown_file << "Viscous and Inviscid flow: rho_ref, and vel_ref" << "\n"; Breakdown_file << "are based on the free-stream values, p_ref = rho_ref*vel_ref^2." << "\n"; @@ -1489,12 +1489,12 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo if (viscous) Breakdown_file << "Reynolds number: " << config->GetReynolds() << ", computed using free-stream values."<< "\n"; Breakdown_file << "Only dimensional computation, the grid should be dimensional." << "\n"; } - + Breakdown_file <<"-- Input conditions:"<< "\n"; - + if (compressible) { switch (config->GetKind_FluidModel()) { - + case STANDARD_AIR: Breakdown_file << "Fluid Model: STANDARD_AIR "<< "\n"; Breakdown_file << "Specific gas constant: " << config->GetGas_Constant(); @@ -1503,14 +1503,14 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Specific gas constant (non-dim): " << config->GetGas_ConstantND()<< "\n"; Breakdown_file << "Specific Heat Ratio: 1.4000 "<< "\n"; break; - + case IDEAL_GAS: Breakdown_file << "Fluid Model: IDEAL_GAS "<< "\n"; Breakdown_file << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << "\n"; Breakdown_file << "Specific gas constant (non-dim): " << config->GetGas_ConstantND()<< "\n"; Breakdown_file << "Specific Heat Ratio: "<< config->GetGamma() << "\n"; break; - + case VW_GAS: Breakdown_file << "Fluid Model: Van der Waals "<< "\n"; Breakdown_file << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << "\n"; @@ -1521,7 +1521,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Critical Pressure (non-dim): " << config->GetPressure_Critical() /config->GetPressure_Ref() << "\n"; Breakdown_file << "Critical Temperature (non-dim) : " << config->GetTemperature_Critical() /config->GetTemperature_Ref() << "\n"; break; - + case PR_GAS: Breakdown_file << "Fluid Model: Peng-Robinson "<< "\n"; Breakdown_file << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << "\n"; @@ -1533,11 +1533,11 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Critical Temperature (non-dim) : " << config->GetTemperature_Critical() /config->GetTemperature_Ref() << "\n"; break; } - + if (viscous) { - + switch (config->GetKind_ViscosityModel()) { - + case CONSTANT_VISCOSITY: Breakdown_file << "Viscosity Model: CONSTANT_VISCOSITY "<< "\n"; Breakdown_file << "Laminar Viscosity: " << config->GetMu_Constant(); @@ -1545,7 +1545,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; Breakdown_file << "Laminar Viscosity (non-dim): " << config->GetMu_ConstantND()<< "\n"; break; - + case SUTHERLAND: Breakdown_file << "Viscosity Model: SUTHERLAND "<< "\n"; Breakdown_file << "Ref. Laminar Viscosity: " << config->GetMu_Ref(); @@ -1561,23 +1561,23 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Ref. Temperature (non-dim): " << config->GetMu_Temperature_RefND()<< "\n"; Breakdown_file << "Sutherland constant (non-dim): "<< config->GetMu_SND()<< "\n"; break; - + } switch (config->GetKind_ConductivityModel()) { - + case CONSTANT_PRANDTL: Breakdown_file << "Conductivity Model: CONSTANT_PRANDTL "<< "\n"; Breakdown_file << "Prandtl: " << config->GetPrandtl_Lam()<< "\n"; break; - + case CONSTANT_CONDUCTIVITY: Breakdown_file << "Conductivity Model: CONSTANT_CONDUCTIVITY "<< "\n"; Breakdown_file << "Molecular Conductivity: " << config->GetKt_Constant()<< " W/m^2.K." << "\n"; Breakdown_file << "Molecular Conductivity (non-dim): " << config->GetKt_ConstantND()<< "\n"; break; - + } - + if ((Kind_Solver == RANS) || (Kind_Solver == INC_RANS)) { switch (config->GetKind_ConductivityModel_Turb()) { case CONSTANT_PRANDTL_TURB: @@ -1590,10 +1590,10 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo break; } } - + } } - + if (incompressible) { Breakdown_file << "Bulk modulus: " << config->GetBulk_Modulus(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; @@ -1602,29 +1602,29 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; } - + Breakdown_file << "Free-stream static pressure: " << config->GetPressure_FreeStream(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; - + Breakdown_file << "Free-stream total pressure: " << config->GetPressure_FreeStream() * pow( 1.0+config->GetMach()*config->GetMach()*0.5*(config->GetGamma()-1.0), config->GetGamma()/(config->GetGamma()-1.0) ); if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; - + if (compressible) { Breakdown_file << "Free-stream temperature: " << config->GetTemperature_FreeStream(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; - + Breakdown_file << "Free-stream total temperature: " << config->GetTemperature_FreeStream() * (1.0 + config->GetMach() * config->GetMach() * 0.5 * (config->GetGamma() - 1.0)); if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; } - + Breakdown_file << "Free-stream density: " << config->GetDensity_FreeStream(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " kg/m^3." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " slug/ft^3." << "\n"; - + if (nDim == 2) { Breakdown_file << "Free-stream velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; Breakdown_file << config->GetVelocity_FreeStream()[1] << ")"; @@ -1635,17 +1635,17 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo } if (config->GetSystemMeasurements() == SI) Breakdown_file << " m/s. "; else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft/s. "; - + Breakdown_file << "Magnitude: " << config->GetModVel_FreeStream(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " m/s." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft/s." << "\n"; - + if (compressible) { Breakdown_file << "Free-stream total energy per unit mass: " << config->GetEnergy_FreeStream(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " m^2/s^2." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft^2/s^2." << "\n"; } - + if (viscous) { Breakdown_file << "Free-stream viscosity: " << config->GetViscosity_FreeStream(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; @@ -1659,49 +1659,49 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo else if (config->GetSystemMeasurements() == US) Breakdown_file << " 1/s." << "\n"; } } - + if (unsteady) { Breakdown_file << "Total time: " << config->GetTotal_UnstTime() << " s. Time step: " << config->GetDelta_UnstTime() << " s." << "\n"; } - + /*--- Print out reference values. ---*/ - + Breakdown_file <<"-- Reference values:"<< "\n"; - + if (compressible) { Breakdown_file << "Reference specific gas constant: " << config->GetGas_Constant_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.m/kg.K." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.ft/slug.R." << "\n"; } - + Breakdown_file << "Reference pressure: " << config->GetPressure_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; - + if (compressible) { Breakdown_file << "Reference temperature: " << config->GetTemperature_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; } - + Breakdown_file << "Reference density: " << config->GetDensity_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " kg/m^3." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " slug/ft^3." << "\n"; - + Breakdown_file << "Reference velocity: " << config->GetVelocity_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " m/s." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft/s." << "\n"; - + if (compressible) { Breakdown_file << "Reference energy per unit mass: " << config->GetEnergy_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " m^2/s^2." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft^2/s^2." << "\n"; } - + if (incompressible) { Breakdown_file << "Reference length: " << config->GetLength_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " m." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " in." << "\n"; } - + if (viscous) { Breakdown_file << "Reference viscosity: " << config->GetViscosity_Ref(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; @@ -1712,12 +1712,12 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf/ft.s.R." << "\n"; } } - - + + if (unsteady) Breakdown_file << "Reference time: " << config->GetTime_Ref() <<" s." << "\n"; - + /*--- Print out resulting non-dim values here. ---*/ - + Breakdown_file << "-- Resulting non-dimensional state:" << "\n"; Breakdown_file << "Mach number (non-dim): " << config->GetMach() << "\n"; if (viscous) { @@ -1729,16 +1729,16 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Froude number (non-dim): " << config->GetFroude() << "\n"; Breakdown_file << "Lenght of the baseline wave (non-dim): " << 2.0*PI_NUMBER*config->GetFroude()*config->GetFroude() << "\n"; } - + if (compressible) { Breakdown_file << "Specific gas constant (non-dim): " << config->GetGas_ConstantND() << "\n"; Breakdown_file << "Free-stream temperature (non-dim): " << config->GetTemperature_FreeStreamND() << "\n"; } - + Breakdown_file << "Free-stream pressure (non-dim): " << config->GetPressure_FreeStreamND() << "\n"; - + Breakdown_file << "Free-stream density (non-dim): " << config->GetDensity_FreeStreamND() << "\n"; - + if (nDim == 2) { Breakdown_file << "Free-stream velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; Breakdown_file << config->GetVelocity_FreeStreamND()[1] << "). "; @@ -1747,10 +1747,10 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << config->GetVelocity_FreeStreamND()[1] << ", " << config->GetVelocity_FreeStreamND()[2] << "). "; } Breakdown_file << "Magnitude: " << config->GetModVel_FreeStreamND() << "\n"; - + if (compressible) Breakdown_file << "Free-stream total energy per unit mass (non-dim): " << config->GetEnergy_FreeStreamND() << "\n"; - + if (viscous) { Breakdown_file << "Free-stream viscosity (non-dim): " << config->GetViscosity_FreeStreamND() << "\n"; if (turbulent) { @@ -1758,7 +1758,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Free-stream specific dissipation (non-dim): " << config->GetOmega_FreeStreamND() << "\n"; } } - + if (unsteady) { Breakdown_file << "Total time (non-dim): " << config->GetTotal_UnstTimeND() << "\n"; Breakdown_file << "Time step (non-dim): " << config->GetDelta_UnstTimeND() << "\n"; @@ -1853,7 +1853,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << endl; else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << endl; break; - + case INC_IDEAL_GAS_POLY: Breakdown_file << "Fluid Model: INC_IDEAL_GAS_POLY "<< endl; Breakdown_file << "Variable density incompressible flow using ideal gas law." << endl; @@ -1905,7 +1905,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Ref. Temperature (non-dim): " << config->GetMu_Temperature_RefND()<< "\n"; Breakdown_file << "Sutherland constant (non-dim): "<< config->GetMu_SND()<< "\n"; break; - + case POLYNOMIAL_VISCOSITY: Breakdown_file << "Viscosity Model: POLYNOMIAL_VISCOSITY "<< endl; Breakdown_file << "Mu(T) polynomial coefficients: \n ("; @@ -1953,9 +1953,9 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo } Breakdown_file << ")." << endl; break; - + } - + if ((Kind_Solver == RANS) || (Kind_Solver == ADJ_RANS) || (Kind_Solver == DISC_ADJ_RANS)) { switch (config->GetKind_ConductivityModel_Turb()) { case CONSTANT_PRANDTL_TURB: @@ -1968,7 +1968,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo break; } } - + } } @@ -2104,7 +2104,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << config->GetVelocity_FreeStreamND()[1] << ", " << config->GetVelocity_FreeStreamND()[2] << "). "; } Breakdown_file << "Magnitude: " << config->GetModVel_FreeStreamND() << "\n"; - + if (viscous) { Breakdown_file << "Initial viscosity (non-dim): " << config->GetViscosity_FreeStreamND() << "\n"; if (turbulent) { @@ -2112,7 +2112,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Initial specific dissipation (non-dim): " << config->GetOmega_FreeStreamND() << "\n"; } } - + if (unsteady) { Breakdown_file << "Total time (non-dim): " << config->GetTotal_UnstTimeND() << "\n"; Breakdown_file << "Time step (non-dim): " << config->GetDelta_UnstTimeND() << "\n"; @@ -2121,14 +2121,14 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo } /*--- Begin forces breakdown info. ---*/ - + Breakdown_file << fixed; Breakdown_file << "\n" << "\n" <<"Forces breakdown:" << "\n" << "\n"; if (nDim == 3) { su2double m = solver_container[FLOW_SOL]->GetTotal_CFz()/solver_container[FLOW_SOL]->GetTotal_CFx(); su2double term = (Total_CoPz/m)-Total_CoPx; - + if (term > 0) Breakdown_file << "Center of Pressure: X=" << 1/m <<"Z-"<< term << "." << "\n\n"; else Breakdown_file << "Center of Pressure: X=" << 1/m <<"Z+"<< fabs(term); if (config->GetSystemMeasurements() == SI) Breakdown_file << " m." << "\n\n"; @@ -2190,7 +2190,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Mnt_CL << "\n"; - + Breakdown_file << "Total CD: "; Breakdown_file.width(11); Breakdown_file << Total_CD; @@ -2209,7 +2209,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << SU2_TYPE::Int((Mnt_CD * 100.0) / (Total_CD + EPS)) << "%): "; Breakdown_file.width(11); Breakdown_file << Mnt_CD << "\n"; - + if (nDim == 3) { Breakdown_file << "Total CSF: "; Breakdown_file.width(11); @@ -2233,7 +2233,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Mnt_CSF << "\n"; } - + Breakdown_file << "Total CL/CD: "; Breakdown_file.width(11); Breakdown_file << Total_CEff; @@ -2255,7 +2255,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Mnt_CEff << "\n"; - + if (nDim == 3) { Breakdown_file << "Total CMx: "; Breakdown_file.width(11); @@ -2278,7 +2278,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Mnt_CMx << "\n"; - + Breakdown_file << "Total CMy: "; Breakdown_file.width(11); Breakdown_file << Total_CMy; @@ -2301,7 +2301,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Mnt_CMy << "\n"; } - + Breakdown_file << "Total CMz: "; Breakdown_file.width(11); Breakdown_file << Total_CMz; @@ -2323,7 +2323,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Mnt_CMz << "\n"; - + Breakdown_file << "Total CFx: "; Breakdown_file.width(11); Breakdown_file << Total_CFx; @@ -2345,7 +2345,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Mnt_CFx << "\n"; - + Breakdown_file << "Total CFy: "; Breakdown_file.width(11); Breakdown_file << Total_CFy; @@ -2367,7 +2367,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Mnt_CFy << "\n"; - + if (nDim == 3) { Breakdown_file << "Total CFz: "; Breakdown_file.width(11); @@ -2391,17 +2391,17 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Mnt_CFz << "\n"; } - + Breakdown_file << "\n" << "\n"; - + for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) { - + Breakdown_file << "Surface name: " << config->GetMarker_Monitoring_TagBound( iMarker_Monitoring) << "\n" << "\n"; - + Breakdown_file << "Total CL ("; Breakdown_file.width(5); Breakdown_file @@ -2438,7 +2438,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Surface_CL_Mnt[iMarker_Monitoring] << "\n"; - + Breakdown_file << "Total CD ("; Breakdown_file.width(5); Breakdown_file @@ -2475,7 +2475,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "%): "; Breakdown_file.width(11); Breakdown_file << Surface_CD_Mnt[iMarker_Monitoring] << "\n"; - + if (nDim == 3) { Breakdown_file << "Total CSF ("; Breakdown_file.width(5); @@ -2516,7 +2516,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << Surface_CSF_Mnt[iMarker_Monitoring] << "\n"; } - + Breakdown_file << "Total CL/CD ("; Breakdown_file.width(5); Breakdown_file @@ -2554,9 +2554,9 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Surface_CEff_Mnt[iMarker_Monitoring] << "\n"; - + if (nDim == 3) { - + Breakdown_file << "Total CMx ("; Breakdown_file.width(5); Breakdown_file @@ -2594,7 +2594,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Surface_CMx_Mnt[iMarker_Monitoring] << "\n"; - + Breakdown_file << "Total CMy ("; Breakdown_file.width(5); Breakdown_file @@ -2633,7 +2633,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << Surface_CMy_Mnt[iMarker_Monitoring] << "\n"; } - + Breakdown_file << "Total CMz ("; Breakdown_file.width(5); Breakdown_file @@ -2670,7 +2670,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Surface_CMz_Mnt[iMarker_Monitoring] << "\n"; - + Breakdown_file << "Total CFx ("; Breakdown_file.width(5); Breakdown_file @@ -2707,7 +2707,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Surface_CFx_Mnt[iMarker_Monitoring] << "\n"; - + Breakdown_file << "Total CFy ("; Breakdown_file.width(5); Breakdown_file @@ -2744,7 +2744,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Surface_CFy_Mnt[iMarker_Monitoring] << "\n"; - + if (nDim == 3) { Breakdown_file << "Total CFz ("; Breakdown_file.width(5); @@ -2783,14 +2783,14 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file.width(11); Breakdown_file << Surface_CFz_Mnt[iMarker_Monitoring] << "\n"; - + } - + Breakdown_file << "\n"; - - + + } - + delete [] Surface_CL; delete [] Surface_CD; delete [] Surface_CSF; @@ -2801,7 +2801,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo delete [] Surface_CMx; delete [] Surface_CMy; delete [] Surface_CMz; - + delete [] Surface_CL_Inv; delete [] Surface_CD_Inv; delete [] Surface_CSF_Inv; @@ -2812,7 +2812,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo delete [] Surface_CMx_Inv; delete [] Surface_CMy_Inv; delete [] Surface_CMz_Inv; - + delete [] Surface_CL_Visc; delete [] Surface_CD_Visc; delete [] Surface_CSF_Visc; @@ -2836,24 +2836,24 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo delete [] Surface_CMz_Mnt; Breakdown_file.close(); - + } - + } bool CFlowOutput::WriteVolume_Output(CConfig *config, unsigned long Iter, bool force_writing){ - + if (config->GetTime_Domain()){ if (((config->GetTime_Marching() == DT_STEPPING_1ST) || (config->GetTime_Marching() == TIME_STEPPING)) && ((Iter == 0) || (Iter % config->GetVolume_Wrt_Freq() == 0))){ return true; } - + if ((config->GetTime_Marching() == DT_STEPPING_2ND) && ((Iter == 0) || (Iter % config->GetVolume_Wrt_Freq() == 0) || - ((Iter+1) % config->GetVolume_Wrt_Freq() == 0) || + ((Iter+1) % config->GetVolume_Wrt_Freq() == 0) || ((Iter+2 == config->GetnTime_Iter())))){ return true; } @@ -2861,7 +2861,7 @@ bool CFlowOutput::WriteVolume_Output(CConfig *config, unsigned long Iter, bool f if (config->GetFixed_CL_Mode() && config->GetFinite_Difference_Mode()) return false; return ((Iter > 0) && Iter % config->GetVolume_Wrt_Freq() == 0) || force_writing; } - + return false || force_writing; } @@ -2875,7 +2875,7 @@ void CFlowOutput::SetTimeAveragedFields(){ AddVolumeOutput("MEAN_PRESSURE", "MeanPressure", "TIME_AVERAGE", "Mean pressure"); AddVolumeOutput("RMS_U", "RMS[u]", "TIME_AVERAGE", "RMS u"); AddVolumeOutput("RMS_V", "RMS[v]", "TIME_AVERAGE", "RMS v"); - AddVolumeOutput("RMS_UV", "RMS[uv]", "TIME_AVERAGE", "RMS uv"); + AddVolumeOutput("RMS_UV", "RMS[uv]", "TIME_AVERAGE", "RMS uv"); AddVolumeOutput("RMS_P", "RMS[Pressure]", "TIME_AVERAGE", "RMS Pressure"); AddVolumeOutput("UUPRIME", "u'u'", "TIME_AVERAGE", "Mean Reynolds-stress component u'u'"); AddVolumeOutput("VVPRIME", "v'v'", "TIME_AVERAGE", "Mean Reynolds-stress component v'v'"); @@ -2897,7 +2897,7 @@ void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, CVariable *Node_Flo SetAvgVolumeOutputValue("MEAN_VELOCITY-Y", iPoint, Node_Flow->GetVelocity(iPoint,1)); if (nDim == 3) SetAvgVolumeOutputValue("MEAN_VELOCITY-Z", iPoint, Node_Flow->GetVelocity(iPoint,2)); - + SetAvgVolumeOutputValue("MEAN_PRESSURE", iPoint, Node_Flow->GetPressure(iPoint)); SetAvgVolumeOutputValue("RMS_U", iPoint, pow(Node_Flow->GetVelocity(iPoint,0),2)); @@ -2909,15 +2909,15 @@ void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, CVariable *Node_Flo 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); - const su2double uumean = GetVolumeOutputValue("RMS_U", iPoint); + const su2double uumean = GetVolumeOutputValue("RMS_U", iPoint); const su2double vmean = GetVolumeOutputValue("MEAN_VELOCITY-Y", iPoint); - const su2double vvmean = GetVolumeOutputValue("RMS_V", iPoint); + const su2double vvmean = GetVolumeOutputValue("RMS_V", iPoint); const su2double uvmean = GetVolumeOutputValue("RMS_UV", iPoint); const su2double pmean = GetVolumeOutputValue("MEAN_PRESSURE", iPoint); const su2double ppmean = GetVolumeOutputValue("RMS_P", iPoint); - + SetVolumeOutputValue("UUPRIME", iPoint, -(umean*umean - uumean)); SetVolumeOutputValue("VVPRIME", iPoint, -(vmean*vmean - vvmean)); SetVolumeOutputValue("UVPRIME", iPoint, -(umean*vmean - uvmean)); @@ -2930,5 +2930,5 @@ void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, CVariable *Node_Flo SetVolumeOutputValue("WWPRIME", iPoint, -(wmean*wmean - wwmean)); SetVolumeOutputValue("UWPRIME", iPoint, -(umean*wmean - uwmean)); SetVolumeOutputValue("VWPRIME", iPoint, -(vmean*wmean - vwmean)); - } + } } diff --git a/SU2_CFD/src/output/CHeatOutput.cpp b/SU2_CFD/src/output/CHeatOutput.cpp index 33e98660477..adff11deb32 100644 --- a/SU2_CFD/src/output/CHeatOutput.cpp +++ b/SU2_CFD/src/output/CHeatOutput.cpp @@ -44,14 +44,14 @@ CHeatOutput::CHeatOutput(CConfig *config, unsigned short nDim) : COutput(config, multiZone = config->GetMultizone_Problem(); /*--- Set the default history fields if nothing is set in the config file ---*/ - + if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); requestedHistoryFields.emplace_back("RMS_RES"); nRequestedHistoryFields = requestedHistoryFields.size(); } if (nRequestedScreenFields == 0){ - requestedScreenFields.emplace_back("OUTER_ITER"); + requestedScreenFields.emplace_back("OUTER_ITER"); requestedScreenFields.emplace_back("INNER_ITER"); requestedScreenFields.emplace_back("RMS_TEMPERATURE"); nRequestedScreenFields = requestedScreenFields.size(); @@ -61,21 +61,21 @@ CHeatOutput::CHeatOutput(CConfig *config, unsigned short nDim) : COutput(config, requestedVolumeFields.emplace_back("SOLUTION"); nRequestedVolumeFields = requestedVolumeFields.size(); } - + stringstream ss; ss << "Zone " << config->GetiZone() << " (Solid Heat)"; multiZoneHeaderString = ss.str(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetVolume_FileName(); - + /*--- Set the surface filename --- */ - + surfaceFilename = config->GetSurfCoeff_FileName(); - + /*--- Set the restart filename --- */ - + restartFilename = config->GetRestart_FileName(); /*--- Set the default convergence field --- */ @@ -88,8 +88,8 @@ CHeatOutput::CHeatOutput(CConfig *config, unsigned short nDim) : COutput(config, CHeatOutput::~CHeatOutput(void) {} void CHeatOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) { - - CSolver* heat_solver = solver[HEAT_SOL]; + + CSolver* heat_solver = solver[HEAT_SOL]; SetHistoryOutputValue("HEATFLUX", heat_solver->GetTotal_HeatFlux()); SetHistoryOutputValue("HEATFLUX_MAX", heat_solver->GetTotal_MaxHeatFlux()); @@ -98,72 +98,72 @@ void CHeatOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver SetHistoryOutputValue("MAX_TEMPERATURE", log10(heat_solver->GetRes_Max(0))); if (multiZone) SetHistoryOutputValue("BGS_TEMPERATURE", log10(heat_solver->GetRes_BGS(0))); - + SetHistoryOutputValue("LINSOL_ITER", heat_solver->GetIterLinSolver()); SetHistoryOutputValue("CFL_NUMBER", config->GetCFL(MESH_0)); - + } - + void CHeatOutput::SetHistoryOutputFields(CConfig *config){ - + AddHistoryOutput("LINSOL_ITER", "Linear_Solver_Iterations", ScreenOutputFormat::INTEGER, "LINSOL_ITER", "Linear solver iterations"); - + AddHistoryOutput("RMS_TEMPERATURE", "rms[T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root mean square residual of the temperature", HistoryFieldType::RESIDUAL); AddHistoryOutput("MAX_TEMPERATURE", "max[T]", ScreenOutputFormat::FIXED, "MAX_RES", "Maximum residual of the temperature", HistoryFieldType::RESIDUAL); AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "Block-Gauss seidel residual of the temperature", HistoryFieldType::RESIDUAL); - + AddHistoryOutput("HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heatflux on all surfaces defined in MARKER_MONITORING", HistoryFieldType::COEFFICIENT); AddHistoryOutput("HEATFLUX_MAX", "MaxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total maximal heatflux on all surfaces defined in MARKER_MONITORING", HistoryFieldType::COEFFICIENT); AddHistoryOutput("AVG_TEMPERATURE", "AvgTemp", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total average temperature on all surfaces defined in MARKER_MONITORING", HistoryFieldType::COEFFICIENT); AddHistoryOutput("CFL_NUMBER", "CFL number", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current value of the CFL number"); - + } void CHeatOutput::SetVolumeOutputFields(CConfig *config){ - + // Grid coordinates AddVolumeOutput("COORD-X", "x", "COORDINATES", "x-component of the coordinate vector"); AddVolumeOutput("COORD-Y", "y", "COORDINATES", "y-component of the coordinate vector"); if (nDim == 3) AddVolumeOutput("COORD-Z", "z", "COORDINATES","z-component of the coordinate vector"); - + // SOLUTION AddVolumeOutput("TEMPERATURE", "Temperature", "SOLUTION", "Temperature"); // Primitives AddVolumeOutput("HEAT_FLUX", "Heat_Flux", "PRIMITIVE", "Heatflux"); - // Residuals + // Residuals AddVolumeOutput("RES_TEMPERATURE", "Residual_Temperature", "RESIDUAL", "Residual of the temperature"); - + } void CHeatOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ - + CVariable* Node_Heat = solver[HEAT_SOL]->GetNodes(); CPoint* Node_Geo = geometry->node[iPoint]; - + // Grid coordinates - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - + // SOLUTION SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); - - // Residuals + + // Residuals SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[HEAT_SOL]->LinSysRes.GetBlock(iPoint, 0)); - + } void CHeatOutput::LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint, unsigned short iMarker, unsigned long iVertex){ - + /* Heat flux value at each surface grid node. */ SetVolumeOutputValue("HEAT_FLUX", iPoint, solver[HEAT_SOL]->GetHeatFlux(iMarker, iVertex)); - + } diff --git a/SU2_CFD/src/output/CMeshOutput.cpp b/SU2_CFD/src/output/CMeshOutput.cpp index 4d160a24414..c057e347425 100644 --- a/SU2_CFD/src/output/CMeshOutput.cpp +++ b/SU2_CFD/src/output/CMeshOutput.cpp @@ -41,18 +41,18 @@ CMeshOutput::CMeshOutput(CConfig *config, unsigned short nDim) : COutput(config, nDim, false) { /*--- Set the default history fields if nothing is set in the config file ---*/ - + requestedVolumeFields.emplace_back("COORDINATES"); nRequestedVolumeFields = requestedVolumeFields.size(); - + /*--- Set the volume filename --- */ - + volumeFilename = config->GetMesh_Out_FileName(); - + /*--- Set the surface filename ---*/ - + surfaceFilename = "surface_mesh"; - + } CMeshOutput::~CMeshOutput(void) {} @@ -65,16 +65,16 @@ void CMeshOutput::SetVolumeOutputFields(CConfig *config){ if (nDim == 3) AddVolumeOutput("COORD-Z", "z", "COORDINATES", "z-component of the coordinate vector"); - + } void CMeshOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ CPoint* Node_Geo = geometry->node[iPoint]; - - SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); + + SetVolumeOutputValue("COORD-X", iPoint, Node_Geo->GetCoord(0)); SetVolumeOutputValue("COORD-Y", iPoint, Node_Geo->GetCoord(1)); if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(2)); - + } diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index 167e22451e9..512d1f21d60 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -42,13 +42,13 @@ CMultizoneOutput::CMultizoneOutput(CConfig* driver_config, CConfig** config, uns unsigned short iZone = 0; rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); - + nZone = driver_config->GetnZone(); fieldWidth = 12; - + bgs_res_name = "BGS_RES"; - + write_zone = false; /*--- If the zone output is disabled for every zone ---*/ @@ -59,30 +59,30 @@ CMultizoneOutput::CMultizoneOutput(CConfig* driver_config, CConfig** config, uns if (nRequestedHistoryFields == 0){ requestedHistoryFields.emplace_back("ITER"); for (iZone = 0; iZone < nZone; iZone++){ - requestedHistoryFields.emplace_back(bgs_res_name + "[" + PrintingToolbox::to_string(iZone) + "]"); + requestedHistoryFields.emplace_back(bgs_res_name + "[" + PrintingToolbox::to_string(iZone) + "]"); requestedHistoryFields.emplace_back("AVG_RES[" + PrintingToolbox::to_string(iZone) + "]"); } nRequestedHistoryFields = requestedHistoryFields.size(); } - + if (nRequestedScreenFields == 0){ - if (config[ZONE_0]->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); + if (config[ZONE_0]->GetTime_Domain()) requestedScreenFields.emplace_back("TIME_ITER"); requestedScreenFields.emplace_back("OUTER_ITER"); for (iZone = 0; iZone < nZone; iZone++){ - requestedScreenFields.emplace_back("AVG_" + bgs_res_name + "[" + PrintingToolbox::to_string(iZone) + "]"); + requestedScreenFields.emplace_back("AVG_" + bgs_res_name + "[" + PrintingToolbox::to_string(iZone) + "]"); } nRequestedScreenFields = requestedScreenFields.size(); } - + multiZoneHeaderString = "Multizone Summary"; - + historyFilename = "multizone_history"; - + /*--- Add the correct file extension depending on the file format ---*/ - + string hist_ext = ".csv"; if (driver_config->GetTabular_FileFormat() == TAB_TECPLOT) hist_ext = ".dat"; - + historyFilename += hist_ext; /*--- Set the default convergence field --- */ @@ -100,20 +100,20 @@ void CMultizoneOutput::LoadMultizoneHistoryData(COutput **output, CConfig **conf string name, header; for (iZone = 0; iZone < nZone; iZone++){ - + map ZoneHistoryFields = output[iZone]->GetHistoryFields(); vector ZoneHistoryNames = output[iZone]->GetHistoryOutput_List(); - + nField = ZoneHistoryNames.size(); - - + + /*-- For all the variables per solver --*/ for (iField = 0; iField < nField; iField++){ - + if (ZoneHistoryNames[iField] != "TIME_ITER" && ZoneHistoryNames[iField] != "OUTER_ITER"){ - + name = ZoneHistoryNames[iField]+ "[" + PrintingToolbox::to_string(iZone) + "]"; - + SetHistoryOutputValue(name, ZoneHistoryFields[ZoneHistoryNames[iField]].value); } @@ -122,28 +122,28 @@ void CMultizoneOutput::LoadMultizoneHistoryData(COutput **output, CConfig **conf } void CMultizoneOutput::SetMultizoneHistoryOutputFields(COutput **output, CConfig **config) { - + unsigned short iZone, iField, nField; string name, header, group; - + /*--- Set the fields ---*/ for (iZone = 0; iZone < nZone; iZone++){ - + map ZoneHistoryFields = output[iZone]->GetHistoryFields(); vector ZoneHistoryNames = output[iZone]->GetHistoryOutput_List(); - + nField = ZoneHistoryNames.size(); - - + + /*-- For all the variables per solver --*/ for (iField = 0; iField < nField; iField++){ - + if (ZoneHistoryNames[iField] != "TIME_ITER" && ZoneHistoryNames[iField] != "OUTER_ITER"){ - + name = ZoneHistoryNames[iField]+ "[" + PrintingToolbox::to_string(iZone) + "]"; header = ZoneHistoryFields[ZoneHistoryNames[iField]].fieldName + "[" + PrintingToolbox::to_string(iZone) + "]"; group = ZoneHistoryFields[ZoneHistoryNames[iField]].outputGroup + "[" + PrintingToolbox::to_string(iZone) + "]"; - + AddHistoryOutput(name, header, ZoneHistoryFields[ZoneHistoryNames[iField]].screenFormat, group, "", ZoneHistoryFields[ZoneHistoryNames[iField]].fieldType ); } } @@ -153,67 +153,67 @@ void CMultizoneOutput::SetMultizoneHistoryOutputFields(COutput **output, CConfig bool CMultizoneOutput::WriteScreen_Header(CConfig *config) { /*--- Print header if the outer iteration is zero or zonal convergence is printed ---*/ - + return curOuterIter == 0 || write_zone; - + /*--- Always print header if it is forced ---*/ - + if (headerNeeded){ headerNeeded = false; return true; - } - + } + return false; } bool CMultizoneOutput::WriteScreen_Output(CConfig *config) { - + unsigned long ScreenWrt_Freq_Outer = config->GetScreen_Wrt_Freq(1); - unsigned long ScreenWrt_Freq_Time = config->GetScreen_Wrt_Freq(0); + unsigned long ScreenWrt_Freq_Time = config->GetScreen_Wrt_Freq(0); /*--- Check if screen output should be written --- */ - - if (!PrintOutput(curTimeIter, ScreenWrt_Freq_Time)&& + + if (!PrintOutput(curTimeIter, ScreenWrt_Freq_Time)&& !(curTimeIter == config->GetnTime_Iter() - 1)){ - + return false; - + } - + if (convergence) {return true;} - - if (!PrintOutput(curOuterIter, ScreenWrt_Freq_Outer) && + + if (!PrintOutput(curOuterIter, ScreenWrt_Freq_Outer) && !(curOuterIter == config->GetnOuter_Iter() - 1)){ - + return false; - + } - + return true; } bool CMultizoneOutput::WriteHistoryFile_Output(CConfig *config){ - + unsigned long HistoryWrt_Freq_Outer = config->GetHistory_Wrt_Freq(1); - unsigned long HistoryWrt_Freq_Time = config->GetHistory_Wrt_Freq(0); - + unsigned long HistoryWrt_Freq_Time = config->GetHistory_Wrt_Freq(0); + /*--- Check if screen output should be written --- */ - - if (!PrintOutput(curTimeIter, HistoryWrt_Freq_Time)&& + + if (!PrintOutput(curTimeIter, HistoryWrt_Freq_Time)&& !(curTimeIter == config->GetnTime_Iter() - 1)){ - + return false; - + } - + if (convergence) {return true;} - - if (!PrintOutput(curOuterIter, HistoryWrt_Freq_Outer) && + + if (!PrintOutput(curOuterIter, HistoryWrt_Freq_Outer) && !(curOuterIter == config->GetnOuter_Iter() - 1)){ - + return false; - + } - + return true; } diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index deec97c83cc..0f0589c4123 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -54,48 +54,48 @@ #include "../../include/solver_structure.hpp" COutput::COutput(CConfig *config, unsigned short nDim, bool fem_output): femOutput(fem_output) { - + this->nDim = nDim; rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); - + fieldWidth = 12; - + convergenceTable = new PrintingToolbox::CTablePrinter(&std::cout); multiZoneHeaderTable = new PrintingToolbox::CTablePrinter(&std::cout); fileWritingTable = new PrintingToolbox::CTablePrinter(&std::cout); - historyFileTable = new PrintingToolbox::CTablePrinter(&histFile, ""); - + historyFileTable = new PrintingToolbox::CTablePrinter(&histFile, ""); + /*--- Set default filenames ---*/ - + surfaceFilename = "surface"; volumeFilename = "volume"; restartFilename = "restart"; - + /*--- Retrieve the history filename ---*/ - + historyFilename = config->GetConv_FileName(); - + /*--- Add the correct file extension depending on the file format ---*/ - + string hist_ext = ".csv"; if (config->GetTabular_FileFormat() == TAB_TECPLOT) hist_ext = ".dat"; - + /*--- Append the zone ID ---*/ - + historyFilename = config->GetMultizone_HistoryFileName(historyFilename, config->GetiZone(), hist_ext); /*--- Append the restart iteration ---*/ - + if (config->GetTime_Domain() && config->GetRestart()) { historyFilename = config->GetUnsteady_FileName(historyFilename, config->GetRestart_Iter(), hist_ext); } - - historySep = ","; - + + historySep = ","; + /*--- Initialize residual ---*/ - + rhoResNew = EPS; rhoResOld = EPS; @@ -103,19 +103,19 @@ COutput::COutput(CConfig *config, unsigned short nDim, bool fem_output): femOutp for (unsigned short iField = 0; iField < nRequestedHistoryFields; iField++){ requestedHistoryFields.push_back(config->GetHistoryOutput_Field(iField)); } - + nRequestedScreenFields = config->GetnScreenOutput(); for (unsigned short iField = 0; iField < nRequestedScreenFields; iField++){ requestedScreenFields.push_back(config->GetScreenOutput_Field(iField)); } - + nRequestedVolumeFields = config->GetnVolumeOutput(); for (unsigned short iField = 0; iField < nRequestedVolumeFields; iField++){ requestedVolumeFields.push_back(config->GetVolumeOutput_Field(iField)); } - - gridMovement = config->GetGrid_Movement(); - + + gridMovement = config->GetGrid_Movement(); + multiZone = config->GetMultizone_Problem(); /*--- Default is to write history to file and screen --- */ @@ -123,11 +123,11 @@ COutput::COutput(CConfig *config, unsigned short nDim, bool fem_output): femOutp noWriting = false; /*--- Initialize convergence monitoring structure ---*/ - + nCauchy_Elems = config->GetCauchy_Elems(); cauchyEps = config->GetCauchy_Eps(); minLogResidual = config->GetMinLogResidual(); - + for (unsigned short iField = 0; iField < config->GetnConv_Field(); iField++){ convFields.emplace_back(config->GetConv_Field(iField)); } @@ -138,48 +138,48 @@ COutput::COutput(CConfig *config, unsigned short nDim, bool fem_output): femOutp cauchyValue = 0.0; convergence = false; - + /*--- Check that the number of cauchy elems is not too large ---*/ - + if (nCauchy_Elems > 1000){ - SU2_MPI::Error("Number of Cauchy Elems must be smaller than 1000", CURRENT_FUNCTION); + SU2_MPI::Error("Number of Cauchy Elems must be smaller than 1000", CURRENT_FUNCTION); } - + /*--- Initialize all convergence flags to false. ---*/ - + convergence = false; - + buildFieldIndexCache = false; - + curInnerIter = 0; curOuterIter = 0; curTimeIter = 0; - + volumeDataSorter = nullptr; surfaceDataSorter = nullptr; - + headerNeeded = false; - + } COutput::~COutput(void) { - + delete convergenceTable; delete multiZoneHeaderTable; delete fileWritingTable; delete historyFileTable; - + if (volumeDataSorter != nullptr) delete volumeDataSorter; - + volumeDataSorter = nullptr; - + if (surfaceDataSorter != nullptr) delete surfaceDataSorter; - + surfaceDataSorter = nullptr; - - + + } @@ -195,35 +195,35 @@ void COutput::SetHistory_Output(CGeometry *geometry, curAbsTimeIter = TimeIter - config->GetRestart_Iter(); curOuterIter = OuterIter; curInnerIter = InnerIter; - + bool write_header, write_history, write_screen; - + /*--- Retrieve residual and extra data -----------------------------------------------------------------*/ - + LoadCommonHistoryData(config); - + LoadHistoryData(config, geometry, solver_container); - + Convergence_Monitoring(config, curInnerIter); - + Postprocess_HistoryData(config); - + /*--- Output using only the master node ---*/ - + if (rank == MASTER_NODE && !noWriting) { - + /*--- Write the history file ---------------------------------------------------------------------------*/ write_history = WriteHistoryFile_Output(config); if (write_history) SetHistoryFile_Output(config); - + /*--- Write the screen header---------------------------------------------------------------------------*/ write_header = WriteScreen_Header(config); if (write_header) SetScreen_Header(config); - + /*--- Write the screen output---------------------------------------------------------------------------*/ write_screen = WriteScreen_Output(config); if (write_screen) SetScreen_Output(config); - + } } @@ -231,60 +231,60 @@ void COutput::SetHistory_Output(CGeometry *geometry, void COutput::SetHistory_Output(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - + /*--- Retrieve residual and extra data -----------------------------------------------------------------*/ - + LoadCommonHistoryData(config); - + LoadHistoryData(config, geometry, solver_container); - - Convergence_Monitoring(config, curInnerIter); - + + Convergence_Monitoring(config, curInnerIter); + Postprocess_HistoryData(config); } void COutput::SetMultizoneHistory_Output(COutput **output, CConfig **config, CConfig *driver_config, unsigned long TimeIter, unsigned long OuterIter){ - + curTimeIter = TimeIter; - curAbsTimeIter = TimeIter - driver_config->GetRestart_Iter(); + curAbsTimeIter = TimeIter - driver_config->GetRestart_Iter(); curOuterIter = OuterIter; - + bool write_header, write_screen, write_history; - + /*--- Retrieve residual and extra data -----------------------------------------------------------------*/ - + LoadCommonHistoryData(driver_config); - + LoadMultizoneHistoryData(output, config); - - Convergence_Monitoring(driver_config, curOuterIter); - + + Convergence_Monitoring(driver_config, curOuterIter); + Postprocess_HistoryData(driver_config); - + /*--- Output using only the master node ---*/ - + if (rank == MASTER_NODE && !noWriting) { - + /*--- Write the history file ---------------------------------------------------------------------------*/ write_history = WriteHistoryFile_Output(driver_config); if (write_history) SetHistoryFile_Output(driver_config); - + /*--- Write the screen header---------------------------------------------------------------------------*/ write_header = WriteScreen_Header(driver_config); if (write_header) SetScreen_Header(driver_config); - + /*--- Write the screen output---------------------------------------------------------------------------*/ write_screen = WriteScreen_Output(driver_config); if (write_screen) SetScreen_Output(driver_config); - + } - + } void COutput::SetCFL_Number(CSolver ****solver_container, CConfig *config) { - + su2double CFLFactor = 1.0, power = 1.0, CFL = 0.0, CFLMin = 0.0, CFLMax = 0.0, Div = 1.0, Diff = 0.0, MGFactor[100]; unsigned short iMesh; - + unsigned short FinestMesh = config->GetFinestMesh(); unsigned short nVar = 1; @@ -312,7 +312,7 @@ void COutput::SetCFL_Number(CSolver ****solver_container, CConfig *config) { rhoResNew = solver_container[INST_0][FinestMesh][HEAT_SOL]->GetRes_RMS(0); break; } - + if (rhoResNew < EPS) rhoResNew = EPS; if (rhoResOld < EPS) rhoResOld = rhoResNew; @@ -359,7 +359,7 @@ void COutput::SetCFL_Number(CSolver ****solver_container, CConfig *config) { switch( config->GetKind_Solver()) { case EULER : case NAVIER_STOKES : case RANS: - case INC_EULER : case INC_NAVIER_STOKES : case INC_RANS: + case INC_EULER : case INC_NAVIER_STOKES : case INC_RANS: nVar = solver_container[INST_0][FinestMesh][FLOW_SOL]->GetnVar(); if (energy) rhoResOld = solver_container[INST_0][FinestMesh][FLOW_SOL]->GetRes_RMS(nVar-1); else if (weakly_coupled_heat) rhoResOld = solver_container[INST_0][FinestMesh][HEAT_SOL]->GetRes_RMS(0); @@ -372,364 +372,364 @@ void COutput::SetCFL_Number(CSolver ****solver_container, CConfig *config) { rhoResOld = solver_container[INST_0][FinestMesh][HEAT_SOL]->GetRes_RMS(0); break; } - + } void COutput::AllocateDataSorters(CConfig *config, CGeometry *geometry){ - + /*---- Construct a data sorter object to partition and distribute * the local data into linear chunks across the processors ---*/ - + if (femOutput){ - + if (volumeDataSorter == nullptr) volumeDataSorter = new CFEMDataSorter(config, geometry, nVolumeFields); - + if (surfaceDataSorter == nullptr) - surfaceDataSorter = new CSurfaceFEMDataSorter(config, geometry, nVolumeFields, + surfaceDataSorter = new CSurfaceFEMDataSorter(config, geometry, nVolumeFields, dynamic_cast(volumeDataSorter)); - + } else { - - if (volumeDataSorter == nullptr) + + if (volumeDataSorter == nullptr) volumeDataSorter = new CFVMDataSorter(config, geometry, nVolumeFields); - + if (surfaceDataSorter == nullptr) surfaceDataSorter = new CSurfaceFVMDataSorter(config, geometry, nVolumeFields, - dynamic_cast(volumeDataSorter)); - + dynamic_cast(volumeDataSorter)); + } - + } void COutput::Load_Data(CGeometry *geometry, CConfig *config, CSolver** solver_container){ - - /*--- Check if the data sorters are allocated, if not, allocate them. --- */ - + + /*--- Check if the data sorters are allocated, if not, allocate them. --- */ + AllocateDataSorters(config, geometry); - + /*--- Loop over all points and store the requested volume output data into the data sorter objects ---*/ - + LoadDataIntoSorter(config, geometry, solver_container); /*--- Partition and sort the volume output data -- */ - + volumeDataSorter->SortOutputData(); - + } void COutput::WriteToFile(CConfig *config, CGeometry *geometry, unsigned short format, string fileName){ CFileWriter *fileWriter = NULL; - + unsigned short lastindex = fileName.find_last_of("."); fileName = fileName.substr(0, lastindex); - + /*--- Write files depending on the format --- */ - + switch (format) { - + case SURFACE_CSV: - + if (fileName.empty()) fileName = config->GetFilename(surfaceFilename, "", curTimeIter); - + surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); - + if (rank == MASTER_NODE) { - (*fileWritingTable) << "CSV file" << fileName + CSU2FileWriter::fileExt; + (*fileWritingTable) << "CSV file" << fileName + CSU2FileWriter::fileExt; } - + fileWriter = new CSU2FileWriter(volumeFieldNames, nDim, fileName, surfaceDataSorter); - + break; - + case RESTART_ASCII: case CSV: - + if (fileName.empty()) fileName = config->GetFilename(restartFilename, "", curTimeIter); - + if (rank == MASTER_NODE) { - (*fileWritingTable) << "SU2 ASCII restart" << fileName + CSU2FileWriter::fileExt; + (*fileWritingTable) << "SU2 ASCII restart" << fileName + CSU2FileWriter::fileExt; } - + fileWriter = new CSU2FileWriter(volumeFieldNames, nDim, fileName, volumeDataSorter); - + break; - + case RESTART_BINARY: - + if (fileName.empty()) fileName = config->GetFilename(restartFilename, "", curTimeIter); - + if (rank == MASTER_NODE) { - (*fileWritingTable) << "SU2 restart" << fileName + CSU2BinaryFileWriter::fileExt; + (*fileWritingTable) << "SU2 restart" << fileName + CSU2BinaryFileWriter::fileExt; } - + fileWriter = new CSU2BinaryFileWriter(volumeFieldNames, nDim, fileName, volumeDataSorter); - + break; - + case MESH: - + if (fileName.empty()) fileName = volumeFilename; - + /*--- Load and sort the output data and connectivity. ---*/ - + volumeDataSorter->SortConnectivity(config, geometry, true); - + /*--- Set the mesh ASCII format ---*/ - + if (rank == MASTER_NODE) { (*fileWritingTable) << "SU2 mesh" << fileName + CSU2MeshFileWriter::fileExt; } - + fileWriter = new CSU2MeshFileWriter(volumeFieldNames, nDim, fileName, volumeDataSorter, config->GetiZone(), config->GetnZone()); - - - break; - + + + break; + case TECPLOT_BINARY: - + if (fileName.empty()) fileName = config->GetFilename(volumeFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - + volumeDataSorter->SortConnectivity(config, geometry, false); - + /*--- Write tecplot binary ---*/ - + if (rank == MASTER_NODE) { (*fileWritingTable) << "Tecplot" << fileName + CTecplotBinaryFileWriter::fileExt; } - + fileWriter = new CTecplotBinaryFileWriter(volumeFieldNames, nDim, fileName, volumeDataSorter, curTimeIter, GetHistoryFieldValue("TIME_STEP")); - + break; - + case TECPLOT: - + if (fileName.empty()) fileName = config->GetFilename(volumeFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - + volumeDataSorter->SortConnectivity(config, geometry, true); - + /*--- Write tecplot binary ---*/ - + if (rank == MASTER_NODE) { (*fileWritingTable) << "Tecplot ASCII" << fileName + CTecplotFileWriter::fileExt; } - + fileWriter = new CTecplotFileWriter(volumeFieldNames, nDim, fileName, volumeDataSorter, curTimeIter, GetHistoryFieldValue("TIME_STEP")); - + break; - + case PARAVIEW_BINARY: - + if (fileName.empty()) fileName = config->GetFilename(volumeFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - + volumeDataSorter->SortConnectivity(config, geometry, true); - + /*--- Write paraview binary ---*/ if (rank == MASTER_NODE) { (*fileWritingTable) << "Paraview" << fileName + CParaviewBinaryFileWriter::fileExt; } - + fileWriter = new CParaviewBinaryFileWriter(volumeFieldNames, nDim, fileName, volumeDataSorter); - + break; - + case PARAVIEW: - + if (fileName.empty()) fileName = config->GetFilename(volumeFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - + volumeDataSorter->SortConnectivity(config, geometry, true); - + /*--- Write paraview binary ---*/ if (rank == MASTER_NODE) { - (*fileWritingTable) << "Paraview ASCII" << fileName + CParaviewFileWriter::fileExt; + (*fileWritingTable) << "Paraview ASCII" << fileName + CParaviewFileWriter::fileExt; } - + fileWriter = new CParaviewFileWriter(volumeFieldNames, nDim, fileName, volumeDataSorter); - + break; - + case SURFACE_PARAVIEW: - + if (fileName.empty()) fileName = config->GetFilename(surfaceFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - - surfaceDataSorter->SortConnectivity(config, geometry); + + surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); - + /*--- Write paraview binary ---*/ if (rank == MASTER_NODE) { - (*fileWritingTable) << "Paraview ASCII surface" << fileName + CParaviewFileWriter::fileExt; + (*fileWritingTable) << "Paraview ASCII surface" << fileName + CParaviewFileWriter::fileExt; } - + fileWriter = new CParaviewFileWriter(volumeFieldNames, nDim, fileName, surfaceDataSorter); - + break; - + case SURFACE_PARAVIEW_BINARY: - + if (fileName.empty()) fileName = config->GetFilename(surfaceFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - - surfaceDataSorter->SortConnectivity(config, geometry); + + surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); - + /*--- Write paraview binary ---*/ if (rank == MASTER_NODE) { - (*fileWritingTable) << "Paraview surface" << fileName + CParaviewBinaryFileWriter::fileExt; + (*fileWritingTable) << "Paraview surface" << fileName + CParaviewBinaryFileWriter::fileExt; } - + fileWriter = new CParaviewBinaryFileWriter(volumeFieldNames, nDim, fileName, surfaceDataSorter); - + break; - + case SURFACE_TECPLOT: - + if (fileName.empty()) fileName = config->GetFilename(surfaceFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - - surfaceDataSorter->SortConnectivity(config, geometry); + + surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); - + /*--- Write paraview binary ---*/ if (rank == MASTER_NODE) { - (*fileWritingTable) << "Tecplot ASCII surface" << fileName + CTecplotFileWriter::fileExt; + (*fileWritingTable) << "Tecplot ASCII surface" << fileName + CTecplotFileWriter::fileExt; } - + fileWriter = new CTecplotFileWriter(volumeFieldNames, nDim, fileName, surfaceDataSorter, curTimeIter, GetHistoryFieldValue("TIME_STEP")); - + break; - + case SURFACE_TECPLOT_BINARY: - + if (fileName.empty()) fileName = config->GetFilename(surfaceFilename, "", curTimeIter); - + /*--- Load and sort the output data and connectivity. ---*/ - - surfaceDataSorter->SortConnectivity(config, geometry); + + surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); - + /*--- Write paraview binary ---*/ if (rank == MASTER_NODE) { - (*fileWritingTable) << "Tecplot surface" << fileName + CTecplotBinaryFileWriter::fileExt; + (*fileWritingTable) << "Tecplot surface" << fileName + CTecplotBinaryFileWriter::fileExt; } - + fileWriter = new CTecplotBinaryFileWriter(volumeFieldNames, nDim, fileName, surfaceDataSorter, curTimeIter, GetHistoryFieldValue("TIME_STEP")); - + break; - + default: fileWriter = NULL; break; - } - + } + if (fileWriter != NULL){ - + /*--- Write data to file ---*/ - + fileWriter->Write_Data(); - + /*--- Compute and store the bandwidth ---*/ - + if (format == RESTART_BINARY){ su2double BandWidth = fileWriter->Get_Bandwidth(); config->SetRestart_Bandwidth_Agg(config->GetRestart_Bandwidth_Agg()+BandWidth); } - + delete fileWriter; - + } } -bool COutput::SetResult_Files(CGeometry *geometry, CConfig *config, CSolver** solver_container, +bool COutput::SetResult_Files(CGeometry *geometry, CConfig *config, CSolver** solver_container, unsigned long iter, bool force_writing){ - + bool writeFiles = WriteVolume_Output(config, iter, force_writing); - - /*--- Check if the data sorters are allocated, if not, allocate them. --- */ - + + /*--- Check if the data sorters are allocated, if not, allocate them. --- */ + AllocateDataSorters(config, geometry); /*--- Collect the volume data from the solvers. * If time-domain is enabled, we also load the data although we don't output it, * since we might want to do time-averaging. ---*/ - + if (writeFiles || config->GetTime_Domain()) LoadDataIntoSorter(config, geometry, solver_container); - + if (writeFiles){ - + /*--- Partition and sort the data --- */ - - volumeDataSorter->SortOutputData(); - + + volumeDataSorter->SortOutputData(); + unsigned short nVolumeFiles = config->GetnVolumeOutputFiles(); unsigned short *VolumeFiles = config->GetVolumeOutputFiles(); - + if (rank == MASTER_NODE && nVolumeFiles != 0){ - fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); + fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); fileWritingTable->PrintHeader(); - fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::LEFT); + fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::LEFT); } - - /*--- Loop through all requested output files and write + + /*--- Loop through all requested output files and write * the partitioned and sorted data stored in the data sorters. ---*/ - + for (unsigned short iFile = 0; iFile < nVolumeFiles; iFile++){ - + WriteToFile(config, geometry, VolumeFiles[iFile]); } - + if (rank == MASTER_NODE && nVolumeFiles != 0){ fileWritingTable->PrintFooter(); headerNeeded = true; } - + /*--- Write any additonal files defined in the child class ----*/ - + WriteAdditionalFiles(config, geometry, solver_container); - + return true; } - + return false; } void COutput::PrintConvergenceSummary(){ PrintingToolbox::CTablePrinter ConvSummary(&cout); - + ConvSummary.AddColumn("Convergence Field", 28); ConvSummary.AddColumn("Value", 14); ConvSummary.AddColumn("Criterion", 14); @@ -741,16 +741,16 @@ void COutput::PrintConvergenceSummary(){ if (historyOutput_Map[convField].fieldType == HistoryFieldType::COEFFICIENT) { string convMark = "No"; if ( historyOutput_Map["CAUCHY_" + convField].value < cauchyEps) convMark = "Yes"; - ConvSummary << historyOutput_Map["CAUCHY_" + convField].fieldName - << historyOutput_Map["CAUCHY_" + convField].value + ConvSummary << historyOutput_Map["CAUCHY_" + convField].fieldName + << historyOutput_Map["CAUCHY_" + convField].value << " < " + PrintingToolbox::to_string(cauchyEps) << convMark; } - else if (historyOutput_Map[convField].fieldType == HistoryFieldType::RESIDUAL || + else if (historyOutput_Map[convField].fieldType == HistoryFieldType::RESIDUAL || historyOutput_Map[convField].fieldType == HistoryFieldType::AUTO_RESIDUAL) { string convMark = "No"; if (historyOutput_Map[convField].value < minLogResidual) convMark = "Yes"; - ConvSummary << historyOutput_Map[convField].fieldName - << historyOutput_Map[convField].value + ConvSummary << historyOutput_Map[convField].fieldName + << historyOutput_Map[convField].value << " < " + PrintingToolbox::to_string(minLogResidual) << convMark; } } @@ -760,21 +760,21 @@ void COutput::PrintConvergenceSummary(){ bool COutput::Convergence_Monitoring(CConfig *config, unsigned long Iteration) { unsigned short iCounter; - + convergence = true; - + for (unsigned short iField_Conv = 0; iField_Conv < convFields.size(); iField_Conv++){ - + bool fieldConverged = false; - + const string &convField = convFields[iField_Conv]; if (historyOutput_Map.count(convField) > 0){ su2double monitor = historyOutput_Map[convField].value; - + /*--- Cauchy based convergence criteria ---*/ - + if (historyOutput_Map[convField].fieldType == HistoryFieldType::COEFFICIENT) { - + if (Iteration == 0){ for (iCounter = 0; iCounter < nCauchy_Elems; iCounter++){ cauchySerie[iField_Conv][iCounter] = 0.0; @@ -785,126 +785,126 @@ bool COutput::Convergence_Monitoring(CConfig *config, unsigned long Iteration) { oldFunc[iField_Conv] = newFunc[iField_Conv]; newFunc[iField_Conv] = monitor; cauchyFunc = fabs(newFunc[iField_Conv] - oldFunc[iField_Conv])/fabs(monitor); - + cauchySerie[iField_Conv][Iteration % nCauchy_Elems] = cauchyFunc; cauchyValue = 0.0; for (iCounter = 0; iCounter < nCauchy_Elems; iCounter++) cauchyValue += cauchySerie[iField_Conv][iCounter]; - + cauchyValue /= nCauchy_Elems; - + if (cauchyValue >= cauchyEps) { fieldConverged = false;} else { fieldConverged = true;} - + /*--- Start monitoring only if the current iteration * is larger than the number of cauchy elements and * the number of start-up iterations --- */ - + if (Iteration < max(config->GetStartConv_Iter(), nCauchy_Elems)){ fieldConverged = false; } - + SetHistoryOutputValue("CAUCHY_" + convField, cauchyValue); - + } - - + + /*--- Residual based convergence criteria ---*/ - - if (historyOutput_Map[convField].fieldType == HistoryFieldType::RESIDUAL || + + if (historyOutput_Map[convField].fieldType == HistoryFieldType::RESIDUAL || historyOutput_Map[convField].fieldType == HistoryFieldType::AUTO_RESIDUAL) { - + /*--- Check the convergence ---*/ - + if (Iteration != 0 && (monitor <= minLogResidual)) { fieldConverged = true; } else { fieldConverged = false; } - + } - + /*--- Do not apply any convergence criteria of the number of iterations is less than a particular value ---*/ - + if (Iteration < config->GetStartConv_Iter()) { fieldConverged = false; } - + convergence = fieldConverged && convergence; } } if (convFields.empty()) convergence = false; - + /*--- Apply the same convergence criteria to all the processors ---*/ - + #ifdef HAVE_MPI - + unsigned short *sbuf_conv = NULL, *rbuf_conv = NULL; sbuf_conv = new unsigned short[1]; sbuf_conv[0] = 0; rbuf_conv = new unsigned short[1]; rbuf_conv[0] = 0; - + /*--- Convergence criteria ---*/ - + sbuf_conv[0] = convergence; SU2_MPI::Reduce(sbuf_conv, rbuf_conv, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); - + /*-- Compute global convergence criteria in the master node --*/ - + sbuf_conv[0] = 0; if (rank == MASTER_NODE) { if (rbuf_conv[0] == size) sbuf_conv[0] = 1; else sbuf_conv[0] = 0; } - + SU2_MPI::Bcast(sbuf_conv, 1, MPI_UNSIGNED_SHORT, MASTER_NODE, MPI_COMM_WORLD); - + if (sbuf_conv[0] == 1) { convergence = true; } else { convergence = false; } - + delete [] sbuf_conv; delete [] rbuf_conv; - + #endif - - - + + + return convergence; } -void COutput::SetHistoryFile_Header(CConfig *config) { +void COutput::SetHistoryFile_Header(CConfig *config) { - unsigned short iField_Output = 0, + unsigned short iField_Output = 0, iReqField = 0, iMarker = 0; stringstream out; int width = 20; - + for (iField_Output = 0; iField_Output < historyOutput_List.size(); iField_Output++){ const string &fieldIdentifier = historyOutput_List[iField_Output]; const HistoryOutputField &field = historyOutput_Map[fieldIdentifier]; for (iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - const string & requestedField = requestedHistoryFields[iReqField]; + const string & requestedField = requestedHistoryFields[iReqField]; if (requestedField == field.outputGroup || (requestedField == fieldIdentifier)){ - if (field.screenFormat == ScreenOutputFormat::INTEGER) width = std::max((int)field.fieldName.size()+2, 10); + if (field.screenFormat == ScreenOutputFormat::INTEGER) width = std::max((int)field.fieldName.size()+2, 10); else{ width = std::max((int)field.fieldName.size()+2, 18);} historyFileTable->AddColumn("\"" + field.fieldName + "\"", width); } - } + } } - + for (iField_Output = 0; iField_Output < historyOutputPerSurface_List.size(); iField_Output++){ - const string &fieldIdentifier = historyOutputPerSurface_List[iField_Output]; - for (iMarker = 0; iMarker < historyOutputPerSurface_Map[fieldIdentifier].size(); iMarker++){ + const string &fieldIdentifier = historyOutputPerSurface_List[iField_Output]; + for (iMarker = 0; iMarker < historyOutputPerSurface_Map[fieldIdentifier].size(); iMarker++){ const HistoryOutputField &field = historyOutputPerSurface_Map[fieldIdentifier][iMarker]; for (iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - const string &requestedField = requestedHistoryFields[iReqField]; + const string &requestedField = requestedHistoryFields[iReqField]; if (requestedField == field.outputGroup || (requestedField == fieldIdentifier)){ - if (field.screenFormat == ScreenOutputFormat::INTEGER) width = std::max((int)field.fieldName.size()+2, 10); + if (field.screenFormat == ScreenOutputFormat::INTEGER) width = std::max((int)field.fieldName.size()+2, 10); else{ width = std::max((int)field.fieldName.size()+2, 18);} - historyFileTable->AddColumn("\"" + field.fieldName + "\"", width); + historyFileTable->AddColumn("\"" + field.fieldName + "\"", width); } } } } - + if (config->GetTabular_FileFormat() == TAB_TECPLOT) { histFile << "VARIABLES = \\" << endl; } @@ -913,57 +913,57 @@ void COutput::SetHistoryFile_Header(CConfig *config) { } -void COutput::SetHistoryFile_Output(CConfig *config) { - - unsigned short iField_Output = 0, +void COutput::SetHistoryFile_Output(CConfig *config) { + + unsigned short iField_Output = 0, iReqField = 0, iMarker = 0; stringstream out; - + for (iField_Output = 0; iField_Output < historyOutput_List.size(); iField_Output++){ - const string &fieldIdentifier = historyOutput_List[iField_Output]; + const string &fieldIdentifier = historyOutput_List[iField_Output]; const HistoryOutputField &field = historyOutput_Map[fieldIdentifier]; for (iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - const string &RequestedField = requestedHistoryFields[iReqField]; + const string &RequestedField = requestedHistoryFields[iReqField]; if (RequestedField == field.outputGroup){ - (*historyFileTable) << field.value; + (*historyFileTable) << field.value; } } } - + for (iField_Output = 0; iField_Output < historyOutputPerSurface_List.size(); iField_Output++){ - const string &fieldIdentifier = historyOutputPerSurface_List[iField_Output]; + const string &fieldIdentifier = historyOutputPerSurface_List[iField_Output]; for (iMarker = 0; iMarker < historyOutputPerSurface_Map[fieldIdentifier].size(); iMarker++){ const HistoryOutputField &field = historyOutputPerSurface_Map[fieldIdentifier][iMarker]; for (iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - const string &RequestedField = requestedHistoryFields[iReqField]; + const string &RequestedField = requestedHistoryFields[iReqField]; if (RequestedField == field.outputGroup){ - (*historyFileTable) << field.value; + (*historyFileTable) << field.value; } } } } - + /*--- Print the string to file and remove the last two characters (a separator and a space) ---*/ histFile.flush(); } void COutput::SetScreen_Header(CConfig *config) { - if (config->GetMultizone_Problem()) + if (config->GetMultizone_Problem()) multiZoneHeaderTable->PrintHeader(); convergenceTable->PrintHeader(); } void COutput::SetScreen_Output(CConfig *config) { - + string RequestedField; - + for (unsigned short iReqField = 0; iReqField < nRequestedScreenFields; iReqField++){ stringstream out; - RequestedField = requestedScreenFields[iReqField]; - if (historyOutput_Map.count(RequestedField) > 0){ + RequestedField = requestedScreenFields[iReqField]; + if (historyOutput_Map.count(RequestedField) > 0){ switch (historyOutput_Map[RequestedField].screenFormat) { case ScreenOutputFormat::INTEGER: PrintingToolbox::PrintScreenInteger(out, SU2_TYPE::Int(historyOutput_Map[RequestedField].value), fieldWidth); @@ -973,7 +973,7 @@ void COutput::SetScreen_Output(CConfig *config) { break; case ScreenOutputFormat::SCIENTIFIC: PrintingToolbox::PrintScreenScientific(out, historyOutput_Map[RequestedField].value, fieldWidth); - break; + break; } } if (historyOutputPerSurface_Map.count(RequestedField) > 0){ @@ -986,117 +986,117 @@ void COutput::SetScreen_Output(CConfig *config) { break; case ScreenOutputFormat::SCIENTIFIC: PrintingToolbox::PrintScreenScientific(out, historyOutputPerSurface_Map[RequestedField][0].value, fieldWidth); - break; + break; } - } + } (*convergenceTable) << out.str(); } SetAdditionalScreenOutput(config); } void COutput::PreprocessHistoryOutput(CConfig *config, bool wrt){ - + noWriting = !wrt; /*--- Set the common output fields ---*/ - + SetCommonHistoryFields(config); - + /*--- Set the History output fields using a virtual function call to the child implementation ---*/ - + SetHistoryOutputFields(config); - + /*--- Postprocess the history fields. Creates new fields based on the ones set in the child classes ---*/ - + Postprocess_HistoryFields(config); - + /*--- We use a fixed size of the file output summary table ---*/ - - int total_width = 72; - fileWritingTable->AddColumn("File Writing Summary", (total_width)/2-1); - fileWritingTable->AddColumn("Filename", total_width/2-1); + + int total_width = 72; + fileWritingTable->AddColumn("File Writing Summary", (total_width)/2-1); + fileWritingTable->AddColumn("Filename", total_width/2-1); fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::LEFT); - + if (rank == MASTER_NODE && !noWriting){ - + /*--- Check for consistency and remove fields that are requested but not available --- */ - + CheckHistoryOutput(); - + /*--- Open history file and print the header ---*/ - + PrepareHistoryFile(config); - + total_width = nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1); - + /*--- Set the multizone screen header ---*/ - + if (config->GetMultizone_Problem()){ - multiZoneHeaderTable->AddColumn(multiZoneHeaderString, total_width); + multiZoneHeaderTable->AddColumn(multiZoneHeaderString, total_width); multiZoneHeaderTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); multiZoneHeaderTable->SetPrintHeaderBottomLine(false); } } - + } void COutput::PreprocessMultizoneHistoryOutput(COutput **output, CConfig **config, CConfig* driver_config, bool wrt){ - + noWriting = !wrt; - + /*--- Set the common history fields for all solvers ---*/ - + SetCommonHistoryFields(driver_config); - + /*--- Set the History output fields using a virtual function call to the child implementation ---*/ - + SetMultizoneHistoryOutputFields(output, config); - + /*--- Postprocess the history fields. Creates new fields based on the ones set in the child classes ---*/ - + Postprocess_HistoryFields(driver_config); - + /*--- We use a fixed size of the file output summary table ---*/ - - int total_width = 72; - fileWritingTable->AddColumn("File Writing Summary", (total_width-1)/2); - fileWritingTable->AddColumn("Filename", total_width/2); + + int total_width = 72; + fileWritingTable->AddColumn("File Writing Summary", (total_width-1)/2); + fileWritingTable->AddColumn("Filename", total_width/2); fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::LEFT); if (rank == MASTER_NODE && !noWriting){ - + /*--- Check for consistency and remove fields that are requested but not available --- */ - + CheckHistoryOutput(); - + /*--- Open history file and print the header ---*/ - + PrepareHistoryFile(driver_config); - - total_width = nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1); - + + total_width = nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1); + /*--- Set the multizone screen header ---*/ if (config[ZONE_0]->GetMultizone_Problem()){ - multiZoneHeaderTable->AddColumn(multiZoneHeaderString, nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1)); + multiZoneHeaderTable->AddColumn(multiZoneHeaderString, nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1)); multiZoneHeaderTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); multiZoneHeaderTable->SetPrintHeaderBottomLine(false); } - + } - + } void COutput::PrepareHistoryFile(CConfig *config){ - + /*--- Open the history file ---*/ - + histFile.open(historyFilename.c_str(), ios::out); - + /*--- Create and format the history file table ---*/ - + historyFileTable->SetInnerSeparator(historySep); historyFileTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); historyFileTable->SetPrintHeaderTopLine(false); @@ -1104,23 +1104,23 @@ void COutput::PrepareHistoryFile(CConfig *config){ historyFileTable->SetPrecision(10); /*--- Add the header to the history file. ---*/ - - SetHistoryFile_Header(config); - + + SetHistoryFile_Header(config); + } void COutput::CheckHistoryOutput(){ - - + + /*--- Set screen convergence output header and remove unavailable fields ---*/ - + string requestedField; vector FieldsToRemove; vector FoundField(nRequestedHistoryFields, false); - + for (unsigned short iReqField = 0; iReqField < nRequestedScreenFields; iReqField++){ - requestedField = requestedScreenFields[iReqField]; - if (historyOutput_Map.count(requestedField) > 0){ + requestedField = requestedScreenFields[iReqField]; + if (historyOutput_Map.count(requestedField) > 0){ convergenceTable->AddColumn(historyOutput_Map[requestedField].fieldName, fieldWidth); } else if (historyOutputPerSurface_Map.count(requestedField) > 0){ @@ -1129,9 +1129,9 @@ void COutput::CheckHistoryOutput(){ FieldsToRemove.push_back(requestedField); } } - + /*--- Remove fields which are not defined --- */ - + for (unsigned short iReqField = 0; iReqField < FieldsToRemove.size(); iReqField++){ if (rank == MASTER_NODE) { if (iReqField == 0){ @@ -1147,44 +1147,44 @@ void COutput::CheckHistoryOutput(){ requestedScreenFields.erase(std::find(requestedScreenFields.begin(), requestedScreenFields.end(), FieldsToRemove[iReqField])); } - + nRequestedScreenFields = requestedScreenFields.size(); - + if (rank == MASTER_NODE){ cout <<"Screen output fields: "; for (unsigned short iReqField = 0; iReqField < nRequestedScreenFields; iReqField++){ - requestedField = requestedScreenFields[iReqField]; + requestedField = requestedScreenFields[iReqField]; cout << requestedScreenFields[iReqField]; if (iReqField != nRequestedScreenFields - 1) cout << ", "; } cout << endl; } - + /*--- Remove unavailable fields from the history file output ---*/ - + FieldsToRemove.clear(); FoundField = vector(nRequestedHistoryFields, false); - + for (unsigned short iField_Output = 0; iField_Output < historyOutput_List.size(); iField_Output++){ const string &fieldReference = historyOutput_List[iField_Output]; if (historyOutput_Map.count(fieldReference) > 0){ const HistoryOutputField &field = historyOutput_Map[fieldReference]; for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - requestedField = requestedHistoryFields[iReqField]; + requestedField = requestedHistoryFields[iReqField]; if (requestedField == field.outputGroup){ FoundField[iReqField] = true; } } } } - + for (unsigned short iField_Output = 0; iField_Output < historyOutputPerSurface_List.size(); iField_Output++){ - const string &fieldReference = historyOutputPerSurface_List[iField_Output]; + const string &fieldReference = historyOutputPerSurface_List[iField_Output]; if (historyOutputPerSurface_Map.count(fieldReference) > 0){ for (unsigned short iMarker = 0; iMarker < historyOutputPerSurface_Map[fieldReference].size(); iMarker++){ const HistoryOutputField &Field = historyOutputPerSurface_Map[fieldReference][iMarker]; for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - requestedField = requestedHistoryFields[iReqField]; + requestedField = requestedHistoryFields[iReqField]; if (requestedField == Field.outputGroup){ FoundField[iReqField] = true; } @@ -1192,15 +1192,15 @@ void COutput::CheckHistoryOutput(){ } } } - + for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ if (!FoundField[iReqField]){ FieldsToRemove.push_back(requestedHistoryFields[iReqField]); } } - - /*--- Remove fields which are not defined --- */ - + + /*--- Remove fields which are not defined --- */ + for (unsigned short iReqField = 0; iReqField < FieldsToRemove.size(); iReqField++){ if (rank == MASTER_NODE) { if (iReqField == 0){ @@ -1216,19 +1216,19 @@ void COutput::CheckHistoryOutput(){ requestedHistoryFields.erase(std::find(requestedHistoryFields.begin(), requestedHistoryFields.end(), FieldsToRemove[iReqField])); } - + nRequestedHistoryFields = requestedHistoryFields.size(); - + if (rank == MASTER_NODE){ cout <<"History output group(s): "; for (unsigned short iReqField = 0; iReqField < nRequestedHistoryFields; iReqField++){ - requestedField = requestedHistoryFields[iReqField]; + requestedField = requestedHistoryFields[iReqField]; cout << requestedHistoryFields[iReqField]; if (iReqField != nRequestedHistoryFields - 1) cout << ", "; - } + } cout << endl; } - + /*--- Check that the requested convergence monitoring field is available ---*/ bool removedField = false; FieldsToRemove.clear(); @@ -1248,24 +1248,24 @@ void COutput::CheckHistoryOutput(){ convFields.end(), FieldsToRemove[iField_Conv])); } if (rank == MASTER_NODE){ - cout <<"Convergence field(s): "; + cout <<"Convergence field(s): "; for (unsigned short iField_Conv = 0; iField_Conv < convFields.size(); iField_Conv++){ cout << convFields[iField_Conv]; - if (iField_Conv != convFields.size() - 1) cout << ", "; + if (iField_Conv != convFields.size() - 1) cout << ", "; } - cout << endl; + cout << endl; } } void COutput::PreprocessVolumeOutput(CConfig *config){ - /*--- Set the volume output fields using a virtual function call to the child implementation ---*/ - + /*--- Set the volume output fields using a virtual function call to the child implementation ---*/ + SetVolumeOutputFields(config); - + /*---Coordinates and solution groups must be always in the output. * If they are not requested, add them here. ---*/ - + vector::iterator itCoord = std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), "COORDINATES"); if (itCoord == requestedVolumeFields.end()){ @@ -1276,52 +1276,52 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ requestedVolumeFields.end(), "SOLUTION"); if (itSol == requestedVolumeFields.end()){ requestedVolumeFields.emplace_back("SOLUTION"); - nRequestedVolumeFields++; + nRequestedVolumeFields++; } - + nVolumeFields = 0; - + string RequestedField; std::vector FoundField(nRequestedVolumeFields, false); vector FieldsToRemove; - - - /*--- Loop through all fields defined in the corresponding SetVolumeOutputFields(). - * If it is also defined in the config (either as part of a group or a single field), the field + + + /*--- Loop through all fields defined in the corresponding SetVolumeOutputFields(). + * If it is also defined in the config (either as part of a group or a single field), the field * object gets an offset so that we know where to find the data in the Local_Data() array. * Note that the default offset is -1. An index !=-1 defines this field as part of the output. ---*/ for (unsigned short iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++){ - + const string &fieldReference = volumeOutput_List[iField_Output]; if (volumeOutput_Map.count(fieldReference) > 0){ VolumeOutputField &Field = volumeOutput_Map[fieldReference]; - + /*--- Loop through all fields specified in the config ---*/ - + for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ - - RequestedField = requestedVolumeFields[iReqField]; - + + RequestedField = requestedVolumeFields[iReqField]; + if (((RequestedField == Field.outputGroup) || (RequestedField == fieldReference)) && (Field.offset == -1)){ Field.offset = nVolumeFields; volumeFieldNames.push_back(Field.fieldName); nVolumeFields++; - + FoundField[iReqField] = true; } - } + } } } - + for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ if (!FoundField[iReqField]){ FieldsToRemove.push_back(requestedVolumeFields[iReqField]); } } - - /*--- Remove fields which are not defined --- */ - + + /*--- Remove fields which are not defined --- */ + for (unsigned short iReqField = 0; iReqField < FieldsToRemove.size(); iReqField++){ if (rank == MASTER_NODE) { if (iReqField == 0){ @@ -1335,16 +1335,16 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ cout << endl; } } - requestedVolumeFields.erase(std::find(requestedVolumeFields.begin(), + requestedVolumeFields.erase(std::find(requestedVolumeFields.begin(), requestedVolumeFields.end(), FieldsToRemove[iReqField])); } - + nRequestedVolumeFields = requestedVolumeFields.size(); - + if (rank == MASTER_NODE){ cout <<"Volume output fields: "; for (unsigned short iReqField = 0; iReqField < nRequestedVolumeFields; iReqField++){ - RequestedField = requestedVolumeFields[iReqField]; + RequestedField = requestedVolumeFields[iReqField]; cout << requestedVolumeFields[iReqField]; if (iReqField != nRequestedVolumeFields - 1) cout << ", "; } @@ -1353,191 +1353,191 @@ void COutput::PreprocessVolumeOutput(CConfig *config){ } void COutput::LoadDataIntoSorter(CConfig* config, CGeometry* geometry, CSolver** solver){ - + unsigned short iMarker = 0; unsigned long iPoint = 0, jPoint = 0; unsigned long iVertex = 0; - + /*--- Reset the offset cache and index --- */ cachePosition = 0; fieldIndexCache.clear(); curGetFieldIndex = 0; fieldGetIndexCache.clear(); - + if (femOutput){ - + /*--- Create an object of the class CMeshFEM_DG and retrieve the necessary geometrical information for the FEM DG solver. ---*/ - + CMeshFEM_DG *DGGeometry = dynamic_cast(geometry); - + unsigned long nVolElemOwned = DGGeometry->GetNVolElemOwned(); - + CVolumeElementFEM *volElem = DGGeometry->GetVolElem(); - + /*--- Access the solution by looping over the owned volume elements. ---*/ - + for(unsigned long l=0; lGetnPointDomain(); iPoint++) { - + /*--- Load the volume data into the data sorter. --- */ - + buildFieldIndexCache = fieldIndexCache.empty(); LoadVolumeData(config, geometry, solver, iPoint); } - + /*--- Reset the offset cache and index --- */ cachePosition = 0; fieldIndexCache.clear(); curGetFieldIndex = 0; fieldGetIndexCache.clear(); - + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - + /*--- We only want to have surface values on solid walls ---*/ - + if (config->GetSolid_Wall(iMarker)){ for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++){ - + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - + /*--- Load the surface data into the data sorter. --- */ - + if(geometry->node[iPoint]->GetDomain()){ - + buildFieldIndexCache = fieldIndexCache.empty(); - + LoadSurfaceData(config, geometry, solver, iPoint, iMarker, iVertex); - + } } - } + } } } } void COutput::SetVolumeOutputValue(string name, unsigned long iPoint, su2double value){ - - if (buildFieldIndexCache){ - - /*--- Build up the offset cache to speed up subsequent - * calls of this routine since the order of calls is + + if (buildFieldIndexCache){ + + /*--- Build up the offset cache to speed up subsequent + * calls of this routine since the order of calls is * the same for every value of iPoint --- */ - + if (volumeOutput_Map.count(name) > 0){ const short Offset = volumeOutput_Map[name].offset; - fieldIndexCache.push_back(Offset); + fieldIndexCache.push_back(Offset); if (Offset != -1){ volumeDataSorter->SetUnsorted_Data(iPoint, Offset, value); } } else { - SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); + SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); } } else { - + /*--- Use the offset cache for the access ---*/ - + const short Offset = fieldIndexCache[cachePosition++]; if (Offset != -1){ volumeDataSorter->SetUnsorted_Data(iPoint, Offset, value); - } + } if (cachePosition == fieldIndexCache.size()){ cachePosition = 0; } } - + } su2double COutput::GetVolumeOutputValue(string name, unsigned long iPoint){ - - if (buildFieldIndexCache){ - - /*--- Build up the offset cache to speed up subsequent - * calls of this routine since the order of calls is + + if (buildFieldIndexCache){ + + /*--- Build up the offset cache to speed up subsequent + * calls of this routine since the order of calls is * the same for every value of iPoint --- */ - + if (volumeOutput_Map.count(name) > 0){ const short Offset = volumeOutput_Map[name].offset; - fieldGetIndexCache.push_back(Offset); + fieldGetIndexCache.push_back(Offset); if (Offset != -1){ return volumeDataSorter->GetUnsorted_Data(iPoint, Offset); } } else { - SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); + SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); } } else { - + /*--- Use the offset cache for the access ---*/ - + const short Offset = fieldGetIndexCache[curGetFieldIndex++]; - + if (curGetFieldIndex == fieldGetIndexCache.size()){ curGetFieldIndex = 0; } if (Offset != -1){ return volumeDataSorter->GetUnsorted_Data(iPoint, Offset); - } + } } - + return 0.0; } void COutput::SetAvgVolumeOutputValue(string name, unsigned long iPoint, su2double value){ - + const su2double scaling = 1.0 / su2double(curAbsTimeIter + 1); - - if (buildFieldIndexCache){ - - /*--- Build up the offset cache to speed up subsequent - * calls of this routine since the order of calls is + + if (buildFieldIndexCache){ + + /*--- Build up the offset cache to speed up subsequent + * calls of this routine since the order of calls is * the same for every value of iPoint --- */ - + if (volumeOutput_Map.count(name) > 0){ const short Offset = volumeOutput_Map[name].offset; - fieldIndexCache.push_back(Offset); + fieldIndexCache.push_back(Offset); if (Offset != -1){ - + const su2double old_value = volumeDataSorter->GetUnsorted_Data(iPoint, Offset); const su2double new_value = value * scaling + old_value *( 1.0 - scaling); - + volumeDataSorter->SetUnsorted_Data(iPoint, Offset, new_value); } } else { - SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); + SU2_MPI::Error(string("Cannot find output field with name ") + name, CURRENT_FUNCTION); } } else { - + /*--- Use the offset cache for the access ---*/ - + const short Offset = fieldIndexCache[cachePosition++]; if (Offset != -1){ - + const su2double old_value = volumeDataSorter->GetUnsorted_Data(iPoint, Offset); const su2double new_value = value * scaling + old_value *( 1.0 - scaling); - + volumeDataSorter->SetUnsorted_Data(iPoint, Offset, new_value); - } + } if (cachePosition == fieldIndexCache.size()){ cachePosition = 0; } } - + } @@ -1545,10 +1545,10 @@ void COutput::SetAvgVolumeOutputValue(string name, unsigned long iPoint, su2doub void COutput::Postprocess_HistoryData(CConfig *config){ - + map > Average; map Count; - + for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ const string &fieldIdentifier = historyOutput_List[iField]; const HistoryOutputField ¤tField = historyOutput_Map[fieldIdentifier]; @@ -1556,12 +1556,12 @@ void COutput::Postprocess_HistoryData(CConfig *config){ if ( SetInit_Residuals(config) || (currentField.value > initialResiduals[fieldIdentifier]) ) { initialResiduals[fieldIdentifier] = currentField.value; } - SetHistoryOutputValue("REL_" + fieldIdentifier, + SetHistoryOutputValue("REL_" + fieldIdentifier, currentField.value - initialResiduals[fieldIdentifier]); - + Average[currentField.outputGroup].first += currentField.value; Average[currentField.outputGroup].second++; - + } if (currentField.fieldType == HistoryFieldType::COEFFICIENT){ @@ -1569,18 +1569,18 @@ void COutput::Postprocess_HistoryData(CConfig *config){ if (config->GetTime_Domain()){ SetHistoryOutputValue("TAVG_" + fieldIdentifier, runningAverages[fieldIdentifier].Update(currentField.value)); - if (config->GetDirectDiff() != NO_DERIVATIVE) { - SetHistoryOutputValue("D_TAVG_" + fieldIdentifier, + if (config->GetDirectDiff() != NO_DERIVATIVE) { + SetHistoryOutputValue("D_TAVG_" + fieldIdentifier, SU2_TYPE::GetDerivative(runningAverages[fieldIdentifier].Get())); } } } if (config->GetDirectDiff() != NO_DERIVATIVE){ - SetHistoryOutputValue("D_" + fieldIdentifier, SU2_TYPE::GetDerivative(currentField.value)); + SetHistoryOutputValue("D_" + fieldIdentifier, SU2_TYPE::GetDerivative(currentField.value)); } } } - + map >::iterator it = Average.begin(); for (it = Average.begin(); it != Average.end(); it++){ const su2double& value = it->second.first; @@ -1589,16 +1589,16 @@ void COutput::Postprocess_HistoryData(CConfig *config){ if (historyOutput_Map.count("AVG_" + it->first) > 0 ) SetHistoryOutputValue("AVG_" + it->first, average); } - + } void COutput::Postprocess_HistoryFields(CConfig *config){ - + map Average; map AverageGroupName = CCreateMap("BGS_RES", "bgs")("RMS_RES","rms")("MAX_RES", "max"); - + for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ - const string &fieldIdentifier = historyOutput_List[iField]; + const string &fieldIdentifier = historyOutput_List[iField]; const HistoryOutputField ¤tField = historyOutput_Map[fieldIdentifier]; if (currentField.fieldType == HistoryFieldType::RESIDUAL){ AddHistoryOutput("REL_" + fieldIdentifier, "rel" + currentField.fieldName, currentField.screenFormat, @@ -1606,51 +1606,51 @@ void COutput::Postprocess_HistoryFields(CConfig *config){ Average[currentField.outputGroup] = true; } } - + map::iterator it = Average.begin(); for (it = Average.begin(); it != Average.end(); it++){ if (AverageGroupName.count(it->first) > 0) { AddHistoryOutput("AVG_" + it->first, "avg[" + AverageGroupName[it->first] + "]", ScreenOutputFormat::FIXED, "AVG_" + it->first , "Average residual over all solution variables.", HistoryFieldType::AUTO_RESIDUAL); } - } - + } + if (config->GetTime_Domain()){ for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ - const string &fieldIdentifier = historyOutput_List[iField]; + const string &fieldIdentifier = historyOutput_List[iField]; const HistoryOutputField ¤tField = historyOutput_Map[fieldIdentifier]; if (currentField.fieldType == HistoryFieldType::COEFFICIENT){ AddHistoryOutput("TAVG_" + fieldIdentifier, "tavg[" + currentField.fieldName + "]", - currentField.screenFormat, "TAVG_" + currentField.outputGroup, "Time averaged values.", + currentField.screenFormat, "TAVG_" + currentField.outputGroup, "Time averaged values.", HistoryFieldType::AUTO_COEFFICIENT); } } } - + if (config->GetDirectDiff()){ for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ - const string &fieldIdentifier = historyOutput_List[iField]; + const string &fieldIdentifier = historyOutput_List[iField]; const HistoryOutputField ¤tField = historyOutput_Map[fieldIdentifier]; if (currentField.fieldType == HistoryFieldType::COEFFICIENT){ AddHistoryOutput("D_" + fieldIdentifier, "d[" + currentField.fieldName + "]", - currentField.screenFormat, "D_" + currentField.outputGroup, - "Derivative value (DIRECT_DIFF=YES)", HistoryFieldType::AUTO_COEFFICIENT); + currentField.screenFormat, "D_" + currentField.outputGroup, + "Derivative value (DIRECT_DIFF=YES)", HistoryFieldType::AUTO_COEFFICIENT); } } } - + if (config->GetTime_Domain() && config->GetDirectDiff()){ for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ - const string &fieldIdentifier = historyOutput_List[iField]; + const string &fieldIdentifier = historyOutput_List[iField]; const HistoryOutputField ¤tField = historyOutput_Map[fieldIdentifier]; if (currentField.fieldType == HistoryFieldType::COEFFICIENT){ AddHistoryOutput("D_TAVG_" + fieldIdentifier, "dtavg[" + currentField.fieldName + "]", - currentField.screenFormat, "D_TAVG_" + currentField.outputGroup, - "Derivative of the time averaged value (DIRECT_DIFF=YES)", HistoryFieldType::AUTO_COEFFICIENT); + currentField.screenFormat, "D_TAVG_" + currentField.outputGroup, + "Derivative of the time averaged value (DIRECT_DIFF=YES)", HistoryFieldType::AUTO_COEFFICIENT); } } } - + for (unsigned short iFieldConv = 0; iFieldConv < convFields.size(); iFieldConv++){ const string &convField = convFields[iFieldConv]; if (historyOutput_Map.count(convField) > 0){ @@ -1660,133 +1660,133 @@ void COutput::Postprocess_HistoryFields(CConfig *config){ } } } - + } -bool COutput::WriteScreen_Header(CConfig *config) { - +bool COutput::WriteScreen_Header(CConfig *config) { + unsigned long RestartIter = 0; - + if (config->GetRestart() && config->GetTime_Domain()){ RestartIter = config->GetRestart_Iter(); } - + unsigned long ScreenWrt_Freq_Inner = config->GetScreen_Wrt_Freq(2); unsigned long ScreenWrt_Freq_Outer = config->GetScreen_Wrt_Freq(1); unsigned long ScreenWrt_Freq_Time = config->GetScreen_Wrt_Freq(0); - + /*--- Header is always disabled for multizone problems unless explicitely requested --- */ - + if (config->GetMultizone_Problem() && !config->GetWrt_ZoneConv()){ return false; } - + /*--- Always print header if it is forced ---*/ - + if (headerNeeded){ headerNeeded = false; return true; - } + } /* --- Always print header in the first iteration --- */ - - if ((curInnerIter == 0) && - (curOuterIter == 0) && + + if ((curInnerIter == 0) && + (curOuterIter == 0) && (curTimeIter == RestartIter)){ return true; } - - if (!PrintOutput(curTimeIter, ScreenWrt_Freq_Time)&& + + if (!PrintOutput(curTimeIter, ScreenWrt_Freq_Time)&& !(curTimeIter == config->GetnTime_Iter() - 1)){ return false; } - + /*--- If there is no inner or outer iteration, don't print header ---*/ if (ScreenWrt_Freq_Outer == 0 && ScreenWrt_Freq_Inner == 0){ return false; } - + /*--- Print header if we are at the first inner iteration ---*/ - + if (curInnerIter == 0){ return true; } - + return false; } bool COutput::WriteScreen_Output(CConfig *config) { - + unsigned long ScreenWrt_Freq_Inner = config->GetScreen_Wrt_Freq(2); unsigned long ScreenWrt_Freq_Outer = config->GetScreen_Wrt_Freq(1); - unsigned long ScreenWrt_Freq_Time = config->GetScreen_Wrt_Freq(0); - + unsigned long ScreenWrt_Freq_Time = config->GetScreen_Wrt_Freq(0); + if (config->GetMultizone_Problem() && !config->GetWrt_ZoneConv()){ - + return false; - + } - + /*--- Check if screen output should be written --- */ - - if (!PrintOutput(curTimeIter, ScreenWrt_Freq_Time)&& + + if (!PrintOutput(curTimeIter, ScreenWrt_Freq_Time)&& !(curTimeIter == config->GetnTime_Iter() - 1)){ - + return false; - + } - + if (convergence) {return true;} - - if (!PrintOutput(curOuterIter, ScreenWrt_Freq_Outer) && + + if (!PrintOutput(curOuterIter, ScreenWrt_Freq_Outer) && !(curOuterIter == config->GetnOuter_Iter() - 1)){ - + return false; - + } - + if (!PrintOutput(curInnerIter, ScreenWrt_Freq_Inner) && !(curInnerIter == config->GetnInner_Iter() - 1)){ - + return false; - + } - + return true; - + } -bool COutput::WriteHistoryFile_Output(CConfig *config) { +bool COutput::WriteHistoryFile_Output(CConfig *config) { unsigned long HistoryWrt_Freq_Inner = config->GetHistory_Wrt_Freq(2); unsigned long HistoryWrt_Freq_Outer = config->GetHistory_Wrt_Freq(1); - unsigned long HistoryWrt_Freq_Time = config->GetHistory_Wrt_Freq(0); - + unsigned long HistoryWrt_Freq_Time = config->GetHistory_Wrt_Freq(0); + /*--- Check if screen output should be written --- */ - - if (!PrintOutput(curTimeIter, HistoryWrt_Freq_Time)&& + + if (!PrintOutput(curTimeIter, HistoryWrt_Freq_Time)&& !(curTimeIter == config->GetnTime_Iter() - 1)){ - + return false; - + } - + if (convergence) {return true;} - - if (!PrintOutput(curOuterIter,HistoryWrt_Freq_Outer) && + + if (!PrintOutput(curOuterIter,HistoryWrt_Freq_Outer) && !(curOuterIter == config->GetnOuter_Iter() - 1)){ - + return false; - + } - + if (!PrintOutput(curInnerIter, HistoryWrt_Freq_Inner) && !(curInnerIter == config->GetnInner_Iter() - 1)){ - + return false; - + } - + return true; } @@ -1799,68 +1799,68 @@ bool COutput::WriteVolume_Output(CConfig *config, unsigned long Iter, bool force } void COutput::SetCommonHistoryFields(CConfig *config){ - + /// BEGIN_GROUP: ITERATION, DESCRIPTION: Iteration identifier. /// DESCRIPTION: The time iteration index. - AddHistoryOutput("TIME_ITER", "Time_Iter", ScreenOutputFormat::INTEGER, "ITER", "Time iteration index"); + AddHistoryOutput("TIME_ITER", "Time_Iter", ScreenOutputFormat::INTEGER, "ITER", "Time iteration index"); /// DESCRIPTION: The outer iteration index. - AddHistoryOutput("OUTER_ITER", "Outer_Iter", ScreenOutputFormat::INTEGER, "ITER", "Outer iteration index"); + AddHistoryOutput("OUTER_ITER", "Outer_Iter", ScreenOutputFormat::INTEGER, "ITER", "Outer iteration index"); /// DESCRIPTION: The inner iteration index. - AddHistoryOutput("INNER_ITER", "Inner_Iter", ScreenOutputFormat::INTEGER, "ITER", "Inner iteration index"); + AddHistoryOutput("INNER_ITER", "Inner_Iter", ScreenOutputFormat::INTEGER, "ITER", "Inner iteration index"); /// END_GROUP - + /// BEGIN_GROUP: TIME_DOMAIN, DESCRIPTION: Time integration information /// Description: The current time AddHistoryOutput("CUR_TIME", "Cur_Time", ScreenOutputFormat::SCIENTIFIC, "TIME_DOMAIN", "Current physical time (s)"); /// Description: The current time step AddHistoryOutput("TIME_STEP", "Time_Step", ScreenOutputFormat::SCIENTIFIC, "TIME_DOMAIN", "Current time step (s)"); - + /// DESCRIPTION: Currently used wall-clock time. - AddHistoryOutput("WALL_TIME", "Time(sec)", ScreenOutputFormat::SCIENTIFIC, "WALL_TIME", "Average wall-clock time"); - + AddHistoryOutput("WALL_TIME", "Time(sec)", ScreenOutputFormat::SCIENTIFIC, "WALL_TIME", "Average wall-clock time"); + AddHistoryOutput("NONPHYSICAL_POINTS", "Nonphysical_Points", ScreenOutputFormat::INTEGER, "NONPHYSICAL_POINTS", "The number of non-physical points in the solution"); } void COutput::LoadCommonHistoryData(CConfig *config){ - - SetHistoryOutputValue("TIME_ITER", curTimeIter); + + SetHistoryOutputValue("TIME_ITER", curTimeIter); SetHistoryOutputValue("INNER_ITER", curInnerIter); - SetHistoryOutputValue("OUTER_ITER", curOuterIter); - + SetHistoryOutputValue("OUTER_ITER", curOuterIter); + if (config->GetTime_Domain()){ - SetHistoryOutputValue("TIME_STEP", config->GetDelta_UnstTimeND()*config->GetTime_Ref()); + SetHistoryOutputValue("TIME_STEP", config->GetDelta_UnstTimeND()*config->GetTime_Ref()); if (curInnerIter == 0){ - SetHistoryOutputValue("CUR_TIME", GetHistoryFieldValue("CUR_TIME") + GetHistoryFieldValue("TIME_STEP")); + SetHistoryOutputValue("CUR_TIME", GetHistoryFieldValue("CUR_TIME") + GetHistoryFieldValue("TIME_STEP")); } } - + su2double StopTime, UsedTime; #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StopTime = MPI_Wtime(); #endif - + UsedTime = (StopTime - config->Get_StartTime())/((curOuterIter + 1) * (curInnerIter+1)); - + SetHistoryOutputValue("WALL_TIME", UsedTime); - + SetHistoryOutputValue("NONPHYSICAL_POINTS", config->GetNonphysical_Points()); } -void COutput::PrintHistoryFields(){ - +void COutput::PrintHistoryFields(){ + if (rank == MASTER_NODE){ - + PrintingToolbox::CTablePrinter HistoryFieldTable(&std::cout); - + unsigned short NameSize = 0, GroupSize = 0, DescrSize = 0; - + for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ - + HistoryOutputField &Field = historyOutput_Map[historyOutput_List[iField]]; - + if (Field.description != ""){ if (historyOutput_List[iField].size() > NameSize){ NameSize = historyOutput_List[iField].size(); @@ -1873,22 +1873,22 @@ void COutput::PrintHistoryFields(){ } } } - + cout << "Available screen/history output fields for the current configuration in " << multiZoneHeaderString << ":" << endl; - + HistoryFieldTable.AddColumn("Name", NameSize); HistoryFieldTable.AddColumn("Group Name", GroupSize); HistoryFieldTable.AddColumn("Type",5); HistoryFieldTable.AddColumn("Description", DescrSize); HistoryFieldTable.SetAlign(PrintingToolbox::CTablePrinter::LEFT); - + HistoryFieldTable.PrintHeader(); - + for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ - + HistoryOutputField &Field = historyOutput_Map[historyOutput_List[iField]]; - - if (Field.fieldType == HistoryFieldType::DEFAULT + + if (Field.fieldType == HistoryFieldType::DEFAULT || Field.fieldType == HistoryFieldType::COEFFICIENT || Field.fieldType == HistoryFieldType::RESIDUAL){ string type; @@ -1903,34 +1903,34 @@ void COutput::PrintHistoryFields(){ type = "D"; break; } - + if (Field.description != "") HistoryFieldTable << historyOutput_List[iField] << Field.outputGroup << type << Field.description; - + } } - + HistoryFieldTable.PrintFooter(); - + cout << "Type legend: Default (D), Residual (R), Coefficient (C)" << endl; - + cout << "Generated screen/history fields (only first field of every group is shown):" << endl; - + PrintingToolbox::CTablePrinter ModifierTable(&std::cout); - + ModifierTable.AddColumn("Name", NameSize); ModifierTable.AddColumn("Group Name", GroupSize); ModifierTable.AddColumn("Type",5); ModifierTable.AddColumn("Description", DescrSize); ModifierTable.SetAlign(PrintingToolbox::CTablePrinter::LEFT); ModifierTable.PrintHeader(); - + std::map GroupVisited; - + for (unsigned short iField = 0; iField < historyOutput_List.size(); iField++){ - + HistoryOutputField &Field = historyOutput_Map[historyOutput_List[iField]]; - + if ((Field.fieldType == HistoryFieldType::AUTO_COEFFICIENT || Field.fieldType == HistoryFieldType::AUTO_RESIDUAL) && (GroupVisited.count(Field.outputGroup) == 0)){ string type; @@ -1945,30 +1945,30 @@ void COutput::PrintHistoryFields(){ type = "AD"; break; } - + if (Field.description != "") ModifierTable << historyOutput_List[iField] << Field.outputGroup << type << Field.description; - + GroupVisited[Field.outputGroup] = true; } - } + } ModifierTable.PrintFooter(); } } void COutput::PrintVolumeFields(){ - + if (rank == MASTER_NODE){ - + PrintingToolbox::CTablePrinter VolumeFieldTable(&std::cout); - + unsigned short NameSize = 0, GroupSize = 0, DescrSize = 0; - + for (unsigned short iField = 0; iField < volumeOutput_List.size(); iField++){ - + VolumeOutputField &Field = volumeOutput_Map[volumeOutput_List[iField]]; - + if (Field.description != ""){ if (volumeOutput_List[iField].size() > NameSize){ NameSize = volumeOutput_List[iField].size(); @@ -1981,25 +1981,25 @@ void COutput::PrintVolumeFields(){ } } } - + cout << "Available volume output fields for the current configuration in " << multiZoneHeaderString << ":" << endl; cout << "Note: COORDINATES and SOLUTION groups are always in the volume output." << endl; VolumeFieldTable.AddColumn("Name", NameSize); VolumeFieldTable.AddColumn("Group Name", GroupSize); VolumeFieldTable.AddColumn("Description", DescrSize); VolumeFieldTable.SetAlign(PrintingToolbox::CTablePrinter::LEFT); - + VolumeFieldTable.PrintHeader(); - + for (unsigned short iField = 0; iField < volumeOutput_List.size(); iField++){ - + VolumeOutputField &Field = volumeOutput_Map[volumeOutput_List[iField]]; if (Field.description != "") VolumeFieldTable << volumeOutput_List[iField] << Field.outputGroup << Field.description; - + } - + VolumeFieldTable.PrintFooter(); } } diff --git a/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp b/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp index 0ca04a32bde..ad6c2607531 100644 --- a/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp @@ -1,17 +1,17 @@ #include "../../../include/output/filewriter/CCSVFileWriter.hpp" #include "../../../include/output/filewriter/CParallelDataSorter.hpp" -CCSVFileWriter::CCSVFileWriter(vector fields, unsigned short nDim, - string fileName, CParallelDataSorter *dataSorter) : +CCSVFileWriter::CCSVFileWriter(vector fields, unsigned short nDim, + string fileName, CParallelDataSorter *dataSorter) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, std::move(".csv"), nDim){} CCSVFileWriter::~CCSVFileWriter(){ - + } void CCSVFileWriter::Write_Data(){ - + /*--- Routine to write the surface CSV files (ASCII). We assume here that, as an ASCII file, it is safer to merge the surface data onto the master rank for writing for 2 reasons: @@ -19,127 +19,127 @@ void CCSVFileWriter::Write_Data(){ than the volume solution, and (b) writing ASCII files in parallel requires serializing the IO calls with barriers, which ruins the performance at moderate to high rank counts. ---*/ - + unsigned short iVar; - + int iProcessor, nProcessor = size; - + unsigned long iPoint, index; unsigned long Buffer_Send_nVertex[1], *Buffer_Recv_nVertex = NULL; unsigned long nLocalVertex_Surface = 0, MaxLocalVertex_Surface = 0; - + ofstream Surf_file; Surf_file.precision(15); - + /*--- Find the max number of surface vertices among all partitions so we can set up buffers. The master node will handle the writing of the CSV file after gathering all of the data. ---*/ - + nLocalVertex_Surface = dataSorter->GetnPoints(); Buffer_Send_nVertex[0] = nLocalVertex_Surface; if (rank == MASTER_NODE) Buffer_Recv_nVertex = new unsigned long[nProcessor]; - + /*--- Communicate the number of local vertices on each partition to the master node with collective calls. ---*/ - + SU2_MPI::Allreduce(&nLocalVertex_Surface, &MaxLocalVertex_Surface, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); - + SU2_MPI::Gather(&Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Recv_nVertex, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - + /*--- Allocate buffers for send/recv of the data and global IDs. ---*/ - + su2double *bufD_Send = new su2double[MaxLocalVertex_Surface*fieldnames.size()](); su2double *bufD_Recv = NULL; - + unsigned long *bufL_Send = new unsigned long [MaxLocalVertex_Surface](); unsigned long *bufL_Recv = NULL; - + /*--- Load send buffers with the local data on this rank. ---*/ - + index = 0; for (iPoint = 0; iPoint < nLocalVertex_Surface; iPoint++) { - + /*--- Global index values. ---*/ - + bufL_Send[iPoint] = dataSorter->GetGlobalIndex(iPoint); - + /*--- Solution data. ---*/ - + for (iVar = 0; iVar < fieldnames.size(); iVar++){ bufD_Send[index] = dataSorter->GetData(iVar, iPoint); index++; } - + } - + /*--- Only the master rank allocates buffers for the recv. ---*/ - + if (rank == MASTER_NODE) { bufD_Recv = new su2double[nProcessor*MaxLocalVertex_Surface*fieldnames.size()](); bufL_Recv = new unsigned long[nProcessor*MaxLocalVertex_Surface]; } - + /*--- Collective comms of the solution data and global IDs. ---*/ - + SU2_MPI::Gather(bufD_Send, (int)MaxLocalVertex_Surface*fieldnames.size(), MPI_DOUBLE, bufD_Recv, (int)MaxLocalVertex_Surface*fieldnames.size(), MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - + SU2_MPI::Gather(bufL_Send, (int)MaxLocalVertex_Surface, MPI_UNSIGNED_LONG, bufL_Recv, (int)MaxLocalVertex_Surface, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - + /*--- The master rank alone writes the surface CSV file. ---*/ - + if (rank == MASTER_NODE) { - + /*--- Open the CSV file and write the header with variable names. ---*/ - + Surf_file.open(fileName.c_str(), ios::out); Surf_file << "\"Point\","; for (iVar = 0; iVar < fieldnames.size()-1; iVar++) { Surf_file << "\"" << fieldnames[iVar] << "\","; } Surf_file << "\"" << fieldnames[fieldnames.size()-1] << "\"" << endl; - + /*--- Loop through all of the collected data and write each node's values ---*/ - + for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) { for (iPoint = 0; iPoint < Buffer_Recv_nVertex[iProcessor]; iPoint++) { - + /*--- Current index position for global index access. ---*/ - + index = iProcessor*MaxLocalVertex_Surface + iPoint; - + /*--- Write global index values. ---*/ - + Surf_file << bufL_Recv[index] << ", "; - + /*--- Reset index for solution data access. ---*/ - + index = (iProcessor*MaxLocalVertex_Surface*fieldnames.size() + iPoint*fieldnames.size()); - + /*--- Write the solution data for each field variable. ---*/ - + for (iVar = 0; iVar < fieldnames.size(); iVar++){ Surf_file << scientific << bufD_Recv[index + iVar]; if (iVar != fieldnames.size() -1) Surf_file << ", "; } Surf_file << endl; - + } } - + /*--- Close the file. ---*/ - + Surf_file.close(); - + } - + /*--- Free temporary memory. ---*/ - + if (rank == MASTER_NODE) { delete [] bufL_Recv; delete [] bufD_Recv; diff --git a/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp b/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp index e9bdc6871b2..36ab62c62fc 100644 --- a/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp @@ -2,34 +2,34 @@ #include "../../../../Common/include/fem_geometry_structure.hpp" CFEMDataSorter::CFEMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields) : CParallelDataSorter(config, nFields){ - + /*--- Create an object of the class CMeshFEM_DG and retrieve the necessary geometrical information for the FEM DG solver. ---*/ - + CMeshFEM_DG *DGGeometry = dynamic_cast(geometry); - + unsigned long nVolElemOwned = DGGeometry->GetNVolElemOwned(); CVolumeElementFEM *volElem = DGGeometry->GetVolElem(); - + /*--- Create the map from the global DOF ID to the local index. ---*/ vector globalID; - + /*--- Update the solution by looping over the owned volume elements. ---*/ - + for(unsigned long l=0; l globalID; - + nGlobalPoint_Sort = geometry->GetGlobal_nPointDomain(); nLocalPoint_Sort = geometry->GetnPointDomain(); Local_Halo = new int[geometry->GetnPoint()](); - + for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++){ - + /*--- Store the global IDs ---*/ - + globalID.push_back(geometry->node[iPoint]->GetGlobalIndex()); - + Local_Halo[iPoint] = !geometry->node[iPoint]->GetDomain(); } - - + + /*--- Search all send/recv boundaries on this partition for halo cells. In particular, consider only the recv conditions (these are the true halo nodes). Check the ranks of the processors that are communicating and choose to keep only the halo cells from the higher rank processor. ---*/ SetHaloPoints(geometry, config); - + /*--- Create the linear partitioner --- */ - + linearPartitioner = new CLinearPartitioner(nGlobalPoint_Sort, 0); - + /*--- Prepare the send buffers ---*/ - + PrepareSendBuffers(globalID); - + } CFVMDataSorter::~CFVMDataSorter(){ - + delete [] Local_Halo; - + if (Index != NULL) delete [] Index; if (idSend != NULL) delete [] idSend; if (linearPartitioner != NULL) delete linearPartitioner; - + } void CFVMDataSorter::SetHaloPoints(CGeometry *geometry, CConfig *config){ - + unsigned long iPoint, iVertex; unsigned short iMarker; int SendRecv, RecvFrom; @@ -58,16 +58,16 @@ void CFVMDataSorter::SetHaloPoints(CGeometry *geometry, CConfig *config){ if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) { SendRecv = config->GetMarker_All_SendRecv(iMarker); RecvFrom = abs(SendRecv)-1; - + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - + /*--- We need to keep one copy of overlapping halo cells. ---*/ - + notHalo = ((SendRecv < 0) && (rank > RecvFrom)); - + /*--- If we found either of these types of nodes, flag them to be kept. ---*/ - + if (notHalo) { Local_Halo[iPoint] = false; } @@ -84,38 +84,38 @@ void CFVMDataSorter::SortConnectivity(CConfig *config, CGeometry *geometry, bool /*--- Sort connectivity for each type of element (excluding halos). Note In these routines, we sort the connectivity into a linear partitioning across all processors based on the global index of the grid nodes. ---*/ - + SortVolumetricConnectivity(config, geometry, TRIANGLE, val_sort); SortVolumetricConnectivity(config, geometry, QUADRILATERAL, val_sort); SortVolumetricConnectivity(config, geometry, TETRAHEDRON, val_sort); SortVolumetricConnectivity(config, geometry, HEXAHEDRON, val_sort); SortVolumetricConnectivity(config, geometry, PRISM, val_sort); - SortVolumetricConnectivity(config, geometry, PYRAMID, val_sort); - - + SortVolumetricConnectivity(config, geometry, PYRAMID, val_sort); + + /*--- Reduce the total number of cells we will be writing in the output files. ---*/ - + unsigned long nTotal_Elem = nParallel_Tria + nParallel_Quad + nParallel_Tetr + nParallel_Hexa + nParallel_Pris + nParallel_Pyra; #ifndef HAVE_MPI nGlobal_Elem_Par = nTotal_Elem; #else SU2_MPI::Allreduce(&nTotal_Elem, &nGlobal_Elem_Par, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); #endif - - connectivity_sorted = true; - + + connectivity_sorted = true; + } void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type, bool val_sort) { - + unsigned long iProcessor; unsigned short NODES_PER_ELEMENT = 0; unsigned long iPoint, jPoint; unsigned long nElem_Total = 0, Global_Index; - + int *Conn_Elem = NULL; #ifdef HAVE_MPI @@ -123,12 +123,12 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, SU2_MPI::Status status; int ind; #endif - + /*--- Store the local number of this element type and the number of nodes per this element type. In serial, this will be the total number of this element type in the entire mesh. In parallel, it is the number on only the current partition. ---*/ - + switch (Elem_Type) { case TRIANGLE: NODES_PER_ELEMENT = N_POINTS_TRIANGLE; @@ -151,204 +151,204 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, default: SU2_MPI::Error("Unrecognized element type", CURRENT_FUNCTION); } - + /*--- We start with the connectivity distributed across all procs with no particular ordering assumed. We need to loop through our local partition and decide how many elements we must send to each other rank in order to have all elements sorted according to a linear partitioning of the grid nodes, i.e., rank 0 holds the first nPoint()/nProcessors nodes. First, initialize a counter and flag. ---*/ - + int *nElem_Send = new int[size+1](); nElem_Send[0] = 0; int *nElem_Recv = new int[size+1](); nElem_Recv[0] = 0; int *nElem_Flag = new int[size](); - + for (int ii=0; ii < size; ii++) { nElem_Send[ii] = 0; nElem_Recv[ii] = 0; nElem_Flag[ii]= -1; } nElem_Send[size] = 0; nElem_Recv[size] = 0; - + for (int ii = 0; ii < (int)geometry->GetnElem(); ii++ ) { if (geometry->elem[ii]->GetVTK_Type() == Elem_Type) { for ( int jj = 0; jj < NODES_PER_ELEMENT; jj++ ) { - + /*--- Get the index of the current point. ---*/ - + iPoint = geometry->elem[ii]->GetNode(jj); Global_Index = geometry->node[iPoint]->GetGlobalIndex(); - + /*--- Search for the lowest global index in this element. We send the element to the processor owning the range that includes the lowest global index value. ---*/ - + for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) { jPoint = geometry->elem[ii]->GetNode(kk); unsigned long newID = geometry->node[jPoint]->GetGlobalIndex(); if (newID < Global_Index) Global_Index = newID; } - + /*--- Search for the processor that owns this point. If we are sorting the elements, we use the linear partitioning to find the rank, otherwise, we simply have the current rank load its own elements into the connectivity data structure. ---*/ - + if (val_sort) { iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); } else { iProcessor = rank; } - - + + /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != ii)) { nElem_Flag[iProcessor] = ii; nElem_Send[iProcessor+1]++; } - + } } } - + /*--- Communicate the number of cells to be sent/recv'd amongst all processors. After this communication, each proc knows how many cells it will receive from each other processor. ---*/ - + #ifdef HAVE_MPI SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); #else nElem_Recv[1] = nElem_Send[1]; #endif - + /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put the counters into cumulative storage format to make the communications simpler. ---*/ - + int nSends = 0, nRecvs = 0; for (int ii=0; ii < size; ii++) nElem_Flag[ii] = -1; - + for (int ii = 0; ii < size; ii++) { if ((ii != rank) && (nElem_Send[ii+1] > 0)) nSends++; if ((ii != rank) && (nElem_Recv[ii+1] > 0)) nRecvs++; - + nElem_Send[ii+1] += nElem_Send[ii]; nElem_Recv[ii+1] += nElem_Recv[ii]; } - + /*--- Allocate memory to hold the connectivity that we are sending. ---*/ - + unsigned long *connSend = NULL; connSend = new unsigned long[NODES_PER_ELEMENT*nElem_Send[size]](); - + /*--- Allocate arrays for storing halo flags. ---*/ - + unsigned short *haloSend = new unsigned short[nElem_Send[size]](); for (int ii = 0; ii < nElem_Send[size]; ii++) haloSend[ii] = false; - + /*--- Create an index variable to keep track of our index position as we load up the send buffer. ---*/ - + unsigned long *index = new unsigned long[size](); for (int ii=0; ii < size; ii++) index[ii] = NODES_PER_ELEMENT*nElem_Send[ii]; - + unsigned long *haloIndex = new unsigned long[size](); for (int ii=0; ii < size; ii++) haloIndex[ii] = nElem_Send[ii]; - + /*--- Loop through our elements and load the elems and their additional data that we will send to the other procs. ---*/ - + for (int ii = 0; ii < (int)geometry->GetnElem(); ii++) { if (geometry->elem[ii]->GetVTK_Type() == Elem_Type) { for ( int jj = 0; jj < NODES_PER_ELEMENT; jj++ ) { - + /*--- Get the index of the current point. ---*/ - + iPoint = geometry->elem[ii]->GetNode(jj); Global_Index = geometry->node[iPoint]->GetGlobalIndex(); - + /*--- Search for the lowest global index in this element. We send the element to the processor owning the range that includes the lowest global index value. ---*/ - + for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) { jPoint = geometry->elem[ii]->GetNode(kk); unsigned long newID = geometry->node[jPoint]->GetGlobalIndex(); if (newID < Global_Index) Global_Index = newID; } - + /*--- Search for the processor that owns this point. If we are sorting the elements, we use the linear partitioning to find the rank, otherwise, we simply have the current rank load its own elements into the connectivity data structure. ---*/ - + if (val_sort) { iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); } else { iProcessor = rank; } - + /*--- Load connectivity into the buffer for sending ---*/ - + if (nElem_Flag[iProcessor] != ii) { - + nElem_Flag[iProcessor] = ii; unsigned long nn = index[iProcessor]; - unsigned long mm = haloIndex[iProcessor]; - + unsigned long mm = haloIndex[iProcessor]; + /*--- Load the connectivity values. ---*/ - + for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) { iPoint = geometry->elem[ii]->GetNode(kk); connSend[nn] = geometry->node[iPoint]->GetGlobalIndex(); nn++; - + /*--- Check if this is a halo node. If so, flag this element as a halo cell. We will use this later to sort and remove - any duplicates from the connectivity list. Note that just checking + any duplicates from the connectivity list. Note that just checking whether the point is a halo point is not enough, since we want to keep elements on one side of the send receive boundary. ---*/ - + if (Local_Halo[iPoint]) haloSend[mm] = true; } - + /*--- Increment the index by the message length ---*/ - + index[iProcessor] += NODES_PER_ELEMENT; haloIndex[iProcessor]++; - + } } } } - + /*--- Free memory after loading up the send buffer. ---*/ - + delete [] index; delete [] haloIndex; - + /*--- Allocate the memory that we need for receiving the conn values and then cue up the non-blocking receives. Note that we do not include our own rank in the communications. We will directly copy our own data later. ---*/ - + unsigned long *connRecv = NULL; connRecv = new unsigned long[NODES_PER_ELEMENT*nElem_Recv[size]](); - + unsigned short *haloRecv = new unsigned short[nElem_Recv[size]](); - + #ifdef HAVE_MPI send_req = new SU2_MPI::Request[2*nSends]; recv_req = new SU2_MPI::Request[2*nRecvs]; - + /*--- Launch the non-blocking recv's for the connectivity. ---*/ - + unsigned long iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -362,9 +362,9 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, iMessage++; } } - + /*--- Launch the non-blocking sends of the connectivity. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -378,9 +378,9 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, iMessage++; } } - + /*--- Repeat the process to communicate the halo flags. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -394,9 +394,9 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, iMessage++; } } - + /*--- Launch the non-blocking sends of the halo flags. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -411,41 +411,41 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, } } #endif - + /*--- Copy my own rank's data into the recv buffer directly. ---*/ - + int mm = NODES_PER_ELEMENT*nElem_Recv[rank]; int ll = NODES_PER_ELEMENT*nElem_Send[rank]; int kk = NODES_PER_ELEMENT*nElem_Send[rank+1]; - + for (int nn=ll; nn 0) Conn_Elem = new int[NODES_PER_ELEMENT*nElem_Recv[size]](); int count = 0; nElem_Total = 0; for (int ii = 0; ii < nElem_Recv[size]; ii++) { @@ -454,13 +454,13 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, for (int jj = 0; jj < NODES_PER_ELEMENT; jj++) { Conn_Elem[count] = (int)connRecv[ii*NODES_PER_ELEMENT+jj] + 1; count++; - } + } } } - + /*--- Store the particular global element count in the class data, and set the class data pointer to the connectivity array. ---*/ - + switch (Elem_Type) { case TRIANGLE: nParallel_Tria = nElem_Total; @@ -469,36 +469,36 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, break; case QUADRILATERAL: nParallel_Quad = nElem_Total; - if (Conn_Quad_Par != NULL) delete [] Conn_Quad_Par; + if (Conn_Quad_Par != NULL) delete [] Conn_Quad_Par; if (nParallel_Quad > 0) Conn_Quad_Par = Conn_Elem; break; case TETRAHEDRON: nParallel_Tetr = nElem_Total; - if (Conn_Tetr_Par != NULL) delete [] Conn_Tetr_Par; + if (Conn_Tetr_Par != NULL) delete [] Conn_Tetr_Par; if (nParallel_Tetr > 0) Conn_Tetr_Par = Conn_Elem; break; case HEXAHEDRON: nParallel_Hexa = nElem_Total; - if (Conn_Hexa_Par != NULL) delete [] Conn_Hexa_Par; + if (Conn_Hexa_Par != NULL) delete [] Conn_Hexa_Par; if (nParallel_Hexa > 0) Conn_Hexa_Par = Conn_Elem; break; case PRISM: nParallel_Pris = nElem_Total; - if (Conn_Pris_Par != NULL) delete [] Conn_Pris_Par; + if (Conn_Pris_Par != NULL) delete [] Conn_Pris_Par; if (nParallel_Pris > 0) Conn_Pris_Par = Conn_Elem; break; case PYRAMID: nParallel_Pyra = nElem_Total; - if (Conn_Pyra_Par != NULL) delete [] Conn_Pyra_Par; + if (Conn_Pyra_Par != NULL) delete [] Conn_Pyra_Par; if (nParallel_Pyra > 0) Conn_Pyra_Par = Conn_Elem; break; default: SU2_MPI::Error("Unrecognized element type", CURRENT_FUNCTION); break; } - + /*--- Free temporary memory from communications ---*/ - + delete [] connSend; delete [] connRecv; delete [] haloSend; diff --git a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp index b0c7b1aa2c9..e2121681885 100644 --- a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp @@ -2,12 +2,12 @@ #include CParallelDataSorter::CParallelDataSorter(CConfig *config, unsigned short nFields){ - + rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); - + GlobalField_Counter = nFields; - + nParallel_Hexa = 0; nParallel_Line = 0; nParallel_Quad = 0; @@ -15,7 +15,7 @@ CParallelDataSorter::CParallelDataSorter(CConfig *config, unsigned short nFields nParallel_Pris = 0; nParallel_Pyra = 0; nParallel_Tria = 0; - + Conn_Line_Par = NULL; Conn_Hexa_Par = NULL; Conn_Pris_Par = NULL; @@ -23,7 +23,7 @@ CParallelDataSorter::CParallelDataSorter(CConfig *config, unsigned short nFields Conn_Tetr_Par = NULL; Conn_Tria_Par = NULL; Conn_Pyra_Par = NULL; - + nPoint_Send = NULL; nPoint_Recv = NULL; Index = NULL; @@ -34,24 +34,24 @@ CParallelDataSorter::CParallelDataSorter(CConfig *config, unsigned short nFields idSend = NULL; nSends = 0; nRecvs = 0; - + nLocalPoint_Sort = 0; nGlobalPoint_Sort = 0; - + nPoint_Send = new int[size+1](); - nPoint_Recv = new int[size+1](); - + nPoint_Recv = new int[size+1](); + linearPartitioner = NULL; } CParallelDataSorter::~CParallelDataSorter(){ - + if (nPoint_Send != NULL) delete [] nPoint_Send; if (nPoint_Recv != NULL) delete [] nPoint_Recv; - + /*--- Deallocate memory for connectivity data on each processor. ---*/ - + if (nParallel_Line > 0 && Conn_Line_Par != NULL) delete [] Conn_Line_Par; if (nParallel_Tria > 0 && Conn_Tria_Par != NULL) delete [] Conn_Tria_Par; if (nParallel_Quad > 0 && Conn_Quad_Par != NULL) delete [] Conn_Quad_Par; @@ -59,15 +59,15 @@ CParallelDataSorter::~CParallelDataSorter(){ if (nParallel_Hexa > 0 && Conn_Hexa_Par != NULL) delete [] Conn_Hexa_Par; if (nParallel_Pris > 0 && Conn_Pris_Par != NULL) delete [] Conn_Pris_Par; if (nParallel_Pyra > 0 && Conn_Pyra_Par != NULL) delete [] Conn_Pyra_Par; - + if (connSend != NULL) delete [] connSend; - + if (dataBuffer != NULL) delete [] dataBuffer; } unsigned long CParallelDataSorter::GetnElem(GEO_TYPE type){ - + switch (type) { case LINE: return nParallel_Line; @@ -93,16 +93,16 @@ unsigned long CParallelDataSorter::GetnElem(GEO_TYPE type){ default: break; } - + SU2_MPI::Error("GEO_TYPE not found", CURRENT_FUNCTION); - + return 0; } void CParallelDataSorter::SortOutputData() { - + int VARS_PER_POINT = GlobalField_Counter; - + #ifdef HAVE_MPI SU2_MPI::Request *send_req, *recv_req; SU2_MPI::Status status; @@ -114,16 +114,16 @@ void CParallelDataSorter::SortOutputData() { we do not include our own rank in the communications. We will directly copy our own data later. ---*/ - + unsigned long *idRecv = new unsigned long[nPoint_Recv[size]](); - + #ifdef HAVE_MPI /*--- We need double the number of messages to send both the conn. and the global IDs. ---*/ - + send_req = new SU2_MPI::Request[2*nSends]; recv_req = new SU2_MPI::Request[2*nRecvs]; - + unsigned long iMessage = 0; for (int ii=0; ii nPoint_Recv[ii])) { @@ -137,9 +137,9 @@ void CParallelDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking sends of the connectivity. ---*/ - + iMessage = 0; for (int ii=0; ii nPoint_Send[ii])) { @@ -153,9 +153,9 @@ void CParallelDataSorter::SortOutputData() { iMessage++; } } - + /*--- Repeat the process to communicate the global IDs. ---*/ - + iMessage = 0; for (int ii=0; ii nPoint_Recv[ii])) { @@ -169,9 +169,9 @@ void CParallelDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking sends of the global IDs. ---*/ - + iMessage = 0; for (int ii=0; ii nPoint_Send[ii])) { @@ -186,53 +186,53 @@ void CParallelDataSorter::SortOutputData() { } } #endif - + /*--- Copy my own rank's data into the recv buffer directly. ---*/ - + int mm = VARS_PER_POINT*nPoint_Recv[rank]; int ll = VARS_PER_POINT*nPoint_Send[rank]; int kk = VARS_PER_POINT*nPoint_Send[rank+1]; - + for (int nn=ll; nn::value){ for (int jj = 0; jj < VARS_PER_POINT*nPoint_Recv[size]; jj++){ const passivedouble tmpVal = SU2_TYPE::GetValue(doubleBuffer[jj]); - passiveDoubleBuffer[jj] = tmpVal; + passiveDoubleBuffer[jj] = tmpVal; /*--- For some AD datatypes a call of the destructor is * necessary to properly delete the AD type ---*/ doubleBuffer[jj].~su2double(); - } + } } - + /*--- Step 2: Reorder the data in the buffer --- */ - + passivedouble *tmpBuffer = new passivedouble[nPoint_Recv[size]]; for (int jj = 0; jj < VARS_PER_POINT; jj++){ for (int ii = 0; ii < nPoint_Recv[size]; ii++){ @@ -242,14 +242,14 @@ void CParallelDataSorter::SortOutputData() { passiveDoubleBuffer[ii*VARS_PER_POINT+jj] = tmpBuffer[ii]; } } - + delete [] tmpBuffer; - + /*--- Store the total number of local points my rank has for the current section after completing the communications. ---*/ - + nParallel_Poin = nPoint_Recv[size]; - + /*--- Reduce the total number of points we will write in the output files. ---*/ #ifndef HAVE_MPI @@ -258,126 +258,126 @@ void CParallelDataSorter::SortOutputData() { SU2_MPI::Allreduce(&nParallel_Poin, &nGlobal_Poin_Par, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); #endif - + /*--- Free temporary memory from communications ---*/ - + delete [] idRecv; } void CParallelDataSorter::PrepareSendBuffers(std::vector& globalID){ - + unsigned long iPoint; unsigned short iProcessor; - + int VARS_PER_POINT = GlobalField_Counter; - + /*--- We start with the grid nodes distributed across all procs with no particular ordering assumed. We need to loop through our local partition and decide how many nodes we must send to each other rank in order to have all nodes sorted according to a linear partitioning of the grid nodes, i.e., rank 0 holds the first ~ nGlobalPoint()/nProcessors nodes. First, initialize a counter and flag. ---*/ - + for (iPoint = 0; iPoint < nLocalPoint_Sort; iPoint++ ) { - - iProcessor = linearPartitioner->GetRankContainingIndex(globalID[iPoint]); - + + iProcessor = linearPartitioner->GetRankContainingIndex(globalID[iPoint]); + /*--- If we have not visited this node yet, increment our number of elements that must be sent to a particular proc. ---*/ - + nPoint_Send[iProcessor+1]++; } - + /*--- Communicate the number of nodes to be sent/recv'd amongst all processors. After this communication, each proc knows how many cells it will receive from each other processor. ---*/ - + #ifdef HAVE_MPI SU2_MPI::Alltoall(&(nPoint_Send[1]), 1, MPI_INT, &(nPoint_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); #else nPoint_Recv[1] = nPoint_Send[1]; #endif - + /*--- Prepare to send coordinates. First check how many messages we will be sending and receiving. Here we also put the counters into cumulative storage format to make the communications simpler. ---*/ - + nSends = 0; nRecvs = 0; for (int ii = 0; ii < size; ii++) { if ((ii != rank) && (nPoint_Send[ii+1] > 0)) nSends++; if ((ii != rank) && (nPoint_Recv[ii+1] > 0)) nRecvs++; - + nPoint_Send[ii+1] += nPoint_Send[ii]; nPoint_Recv[ii+1] += nPoint_Recv[ii]; } - + /*--- Allocate memory to hold the connectivity that we are sending. ---*/ - + connSend = NULL; connSend = new su2double[VARS_PER_POINT*nPoint_Send[size]](); - + /*--- Allocate the data buffer to hold the sorted data. We have to make it large enough * to hold passivedoubles and su2doubles ---*/ unsigned short maxSize = max(sizeof(passivedouble), sizeof(su2double)); dataBuffer = new char[VARS_PER_POINT*nPoint_Recv[size]*maxSize]; - + /*--- doubleBuffer and passiveDouble buffer use the same memory allocated above using the dataBuffer. ---*/ - + doubleBuffer = reinterpret_cast(dataBuffer); passiveDoubleBuffer = reinterpret_cast(dataBuffer); - + /*--- Allocate arrays for sending the global ID. ---*/ - + idSend = new unsigned long[nPoint_Send[size]](); /*--- Create an index variable to keep track of our index positions as we load up the send buffer. ---*/ - + unsigned long *index = new unsigned long[size](); for (int ii=0; ii < size; ii++) index[ii] = VARS_PER_POINT*nPoint_Send[ii]; - + unsigned long *idIndex = new unsigned long[size](); for (int ii=0; ii < size; ii++) idIndex[ii] = nPoint_Send[ii]; - + Index = new unsigned long[nLocalPoint_Sort](); /*--- Loop through our elements and load the elems and their additional data that we will send to the other procs. ---*/ - + for (iPoint = 0; iPoint < nLocalPoint_Sort; iPoint++) { - - iProcessor = linearPartitioner->GetRankContainingIndex(globalID[iPoint]); + + iProcessor = linearPartitioner->GetRankContainingIndex(globalID[iPoint]); /*--- Load the global ID (minus offset) for sorting the points once they all reach the correct processor. ---*/ - + unsigned long nn = idIndex[iProcessor]; idSend[nn] = globalID[iPoint] - linearPartitioner->GetFirstIndexOnRank(iProcessor); - + /*--- Store the index this point has in the send buffer ---*/ - - Index[iPoint] = index[iProcessor]; - + + Index[iPoint] = index[iProcessor]; + /*--- Increment the index by the message length ---*/ - + index[iProcessor] += VARS_PER_POINT; idIndex[iProcessor]++; } - + /*--- Free memory after loading up the send buffer. ---*/ - + delete [] index; delete [] idIndex; } unsigned long CParallelDataSorter::GetElem_Connectivity(GEO_TYPE type, unsigned long iElem, unsigned long iNode) { - + switch (type) { case LINE: return Conn_Line_Par[iElem*N_POINTS_LINE + iNode]; @@ -403,9 +403,9 @@ unsigned long CParallelDataSorter::GetElem_Connectivity(GEO_TYPE type, unsigned default: break; } - + SU2_MPI::Error("GEO_TYPE not found", CURRENT_FUNCTION); - + return 0; } diff --git a/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp index 296af142664..e33ca596812 100644 --- a/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp @@ -2,23 +2,23 @@ CFileWriter::CFileWriter(vector fields, string fileName, - CParallelDataSorter *dataSorter, string file_ext, unsigned short nDim): + CParallelDataSorter *dataSorter, string file_ext, unsigned short nDim): fieldnames(std::move(fields)), nDim(nDim), file_ext(file_ext), fileName(std::move(fileName)), dataSorter(dataSorter){ - + rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); - + this->fileName += file_ext; - + file_size = 0.0; - + } CFileWriter::~CFileWriter(){ - + } diff --git a/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp index c16340a75e8..95ea9e49107 100644 --- a/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp @@ -2,99 +2,99 @@ const string CParaviewBinaryFileWriter::fileExt = ".vtk"; -CParaviewBinaryFileWriter::CParaviewBinaryFileWriter(vector fields, unsigned short nDim, string fileName, - CParallelDataSorter *dataSorter) : +CParaviewBinaryFileWriter::CParaviewBinaryFileWriter(vector fields, unsigned short nDim, string fileName, + CParallelDataSorter *dataSorter) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, fileExt, nDim){} CParaviewBinaryFileWriter::~CParaviewBinaryFileWriter(){ - + } void CParaviewBinaryFileWriter::Write_Data(){ - + if (!dataSorter->GetConnectivitySorted()){ SU2_MPI::Error("Connectivity must be sorted.", CURRENT_FUNCTION); } - + unsigned short iDim; - + unsigned long iPoint, iElem; - + ofstream Paraview_File; - + const int MAX_STRING_LENGTH = 255; char str_buf[MAX_STRING_LENGTH], fname[100]; - + const int NCOORDS = 3; strcpy(fname, fileName.c_str()); - - /* Check for big endian. We have to swap bytes otherwise. + + /* Check for big endian. We have to swap bytes otherwise. * Since size of character is 1 byte when the character pointer * is de-referenced it will contain only first byte of integer. ---*/ - - bool BigEndian = false; - unsigned int i = 1; + + bool BigEndian = false; + unsigned int i = 1; char *c = (char*)&i; if (*c) BigEndian = false; else BigEndian = true; - + file_size = 0.0; - + /*--- Set a timer for the file writing. ---*/ - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + /*--- Serial implementation in case we have not compiled with MPI. ---*/ - + #ifndef HAVE_MPI - + FILE* fhw; fhw = fopen(fname, "wb"); - + unsigned long iNode2; unsigned long nGlobal_Elem_Storage; - + /*--- Error check for opening the file. ---*/ - + if (!fhw) { SU2_MPI::Error(string("Unable to open VTK binary legacy file ") + fileName, CURRENT_FUNCTION); } - + /*--- File header written in ASCII. ---*/ - + strcpy(str_buf, "# vtk DataFile Version 3.0\n"); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)*strlen(str_buf); - + strcpy(str_buf, "vtk output\n"); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)*strlen(str_buf); - + strcpy(str_buf, "BINARY\n"); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)*strlen(str_buf); - + strcpy(str_buf, "DATASET UNSTRUCTURED_GRID\n"); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)*strlen(str_buf); - + /*--- Write the point coordinates. ---*/ - + unsigned long GlobalPoint = dataSorter->GetnPointsGlobal(); - + SPRINTF(str_buf, "POINTS %i float\n", (int)GlobalPoint); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)*strlen(str_buf); - + /*--- Load/write the 1D buffer of point coordinates. ---*/ - + float *coord_buf = new float[GlobalPoint*NCOORDS]; for (iPoint = 0; iPoint < GlobalPoint; iPoint++) { for (iDim = 0; iDim < NCOORDS; iDim++) { @@ -107,18 +107,18 @@ void CParaviewBinaryFileWriter::Write_Data(){ } } if (!BigEndian) SwapBytes((char *)coord_buf, sizeof(float), 3*GlobalPoint); - + fwrite(coord_buf, sizeof(float), 3*GlobalPoint, fhw); file_size += sizeof(char)*3*GlobalPoint; - + delete [] coord_buf; - + /*--- Write the connectivity data. ---*/ - + unsigned long nTot_Line; unsigned long nTot_Tria, nTot_Quad; unsigned long nTot_Tetr, nTot_Hexa, nTot_Pris, nTot_Pyra; - nTot_Line = dataSorter->GetnElem(LINE); + nTot_Line = dataSorter->GetnElem(LINE); nTot_Tria = dataSorter->GetnElem(TRIANGLE); nTot_Quad = dataSorter->GetnElem(QUADRILATERAL); nTot_Tetr = dataSorter->GetnElem(TETRAHEDRON); @@ -127,20 +127,20 @@ void CParaviewBinaryFileWriter::Write_Data(){ nTot_Pyra = dataSorter->GetnElem(PYRAMID); nGlobal_Elem_Storage = (nTot_Line*3 + nTot_Tria*4 + nTot_Quad*5 + nTot_Tetr*5 + nTot_Hexa*9 + nTot_Pris*7 + nTot_Pyra*6); - + int *conn_buf = NULL; - + SPRINTF (str_buf, "\nCELLS %i %i\n", (int)dataSorter->GetnElem(), (int)nGlobal_Elem_Storage); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)*strlen(str_buf); - + conn_buf = new int[dataSorter->GetnElem()*(N_POINTS_HEXAHEDRON+1)]; - - + + /*--- Load/write 1D buffers for the connectivity of each element type. ---*/ - - + + for (iElem = 0; iElem < nTot_Line; iElem++) { iNode2 = iElem*(N_POINTS_LINE+1); conn_buf[iNode2+0] = N_POINTS_LINE; @@ -151,9 +151,9 @@ void CParaviewBinaryFileWriter::Write_Data(){ nTot_Line*(N_POINTS_LINE+1)); fwrite(conn_buf, sizeof(int), nTot_Line*(N_POINTS_LINE+1), fhw); - + file_size += sizeof(int)*nTot_Line*(N_POINTS_LINE+1); - + for (iElem = 0; iElem < nTot_Tria; iElem++) { iNode2 = iElem*(N_POINTS_TRIANGLE+1); conn_buf[iNode2+0] = N_POINTS_TRIANGLE; @@ -166,7 +166,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ fwrite(conn_buf, sizeof(int), nTot_Tria*(N_POINTS_TRIANGLE+1), fhw); file_size += sizeof(int)*nTot_Tria*(N_POINTS_TRIANGLE+1); - + for (iElem = 0; iElem < nTot_Quad; iElem++) { iNode2 = iElem*(N_POINTS_QUADRILATERAL+1); conn_buf[iNode2+0] = N_POINTS_QUADRILATERAL; @@ -180,7 +180,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ fwrite(conn_buf, sizeof(int), nTot_Quad*(N_POINTS_QUADRILATERAL+1), fhw); file_size += sizeof(int)*nTot_Quad*(N_POINTS_QUADRILATERAL+1); - + for (iElem = 0; iElem < nTot_Tetr; iElem++) { iNode2 = iElem*(N_POINTS_TETRAHEDRON+1); conn_buf[iNode2+0] = N_POINTS_TETRAHEDRON; @@ -194,7 +194,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ fwrite(conn_buf, sizeof(int), nTot_Tetr*(N_POINTS_TETRAHEDRON+1), fhw); file_size += sizeof(int)*nTot_Tetr*(N_POINTS_TETRAHEDRON+1); - + for (iElem = 0; iElem < nTot_Hexa; iElem++) { iNode2 = iElem*(N_POINTS_HEXAHEDRON+1); conn_buf[iNode2+0] = N_POINTS_HEXAHEDRON; @@ -212,7 +212,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ fwrite(conn_buf, sizeof(int), nTot_Hexa*(N_POINTS_HEXAHEDRON+1), fhw); file_size += sizeof(int)*nTot_Hexa*(N_POINTS_HEXAHEDRON+1); - + for (iElem = 0; iElem < nTot_Pris; iElem++) { iNode2 = iElem*(N_POINTS_PRISM+1); conn_buf[iNode2+0] = N_POINTS_PRISM; @@ -228,7 +228,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ fwrite(conn_buf, sizeof(int), nTot_Pris*(N_POINTS_PRISM+1), fhw); file_size += sizeof(int)*nTot_Pris*(N_POINTS_PRISM+1); - + for (iElem = 0; iElem < nTot_Pyra; iElem++) { iNode2 = iElem*(N_POINTS_PYRAMID+1); conn_buf[iNode2+0] = N_POINTS_PYRAMID; @@ -243,21 +243,21 @@ void CParaviewBinaryFileWriter::Write_Data(){ fwrite(conn_buf, sizeof(int), nTot_Pyra*(N_POINTS_PYRAMID+1), fhw); file_size += sizeof(int)*nTot_Pyra*(N_POINTS_PYRAMID+1); - - + + if (conn_buf != NULL) delete [] conn_buf; - + /*--- Load/write the cell type for all elements in the file. ---*/ - + SPRINTF (str_buf, "\nCELL_TYPES %i\n", SU2_TYPE::Int(dataSorter->GetnElem())); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)*strlen(str_buf); - + int *type_buf = NULL; - + type_buf = new int[dataSorter->GetnElem()]; - + for (iElem = 0; iElem < nTot_Line; iElem++) { type_buf[iElem] = LINE; } @@ -265,7 +265,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)type_buf, sizeof(int), nTot_Line); fwrite(type_buf, sizeof(int), nTot_Line, fhw); file_size += sizeof(int)*nTot_Line; - + for (iElem = 0; iElem < nTot_Tria; iElem++) { type_buf[iElem] = TRIANGLE; } @@ -273,7 +273,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)type_buf, sizeof(int), nTot_Tria); fwrite(type_buf, sizeof(int), nTot_Tria, fhw); file_size += sizeof(int)*nTot_Tria; - + for (iElem = 0; iElem < nTot_Quad; iElem++) { type_buf[iElem] = QUADRILATERAL; } @@ -281,7 +281,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)type_buf, sizeof(int), nTot_Quad); fwrite(type_buf, sizeof(int), nTot_Quad, fhw); file_size += sizeof(int)*nTot_Quad; - + for (iElem = 0; iElem < nTot_Tetr; iElem++) { type_buf[iElem] = TETRAHEDRON; } @@ -289,7 +289,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)type_buf, sizeof(int), nTot_Tetr); fwrite(type_buf, sizeof(int), nTot_Tetr, fhw); file_size += sizeof(int)*nTot_Tetr; - + for (iElem = 0; iElem < nTot_Hexa; iElem++) { type_buf[iElem] = HEXAHEDRON; } @@ -297,7 +297,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)type_buf, sizeof(int), nTot_Hexa); fwrite(type_buf, sizeof(int), nTot_Hexa, fhw); file_size += sizeof(int)*nTot_Hexa; - + for (iElem = 0; iElem < nTot_Pris; iElem++) { type_buf[iElem] = PRISM; } @@ -305,7 +305,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)type_buf, sizeof(int), nTot_Pris); fwrite(type_buf, sizeof(int), nTot_Pris, fhw); file_size += sizeof(int)*nTot_Pris; - + for (iElem = 0; iElem < nTot_Pyra; iElem++) { type_buf[iElem] = PYRAMID; } @@ -313,28 +313,28 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)type_buf, sizeof(int), nTot_Pyra); fwrite(type_buf, sizeof(int), nTot_Pyra, fhw); file_size += sizeof(int)*nTot_Pyra; - - + + if (type_buf != NULL) delete [] type_buf; - + /*--- Now write the scalar and vector data (reuse the counts above). ---*/ - + SPRINTF (str_buf, "\nPOINT_DATA %i\n", (int)GlobalPoint); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)* strlen(str_buf); - + unsigned short varStart = 2; if (nDim == 3) varStart++; - + /*--- Need to adjust container location to avoid PointID tag and coords. ---*/ - + unsigned short iField, VarCounter = varStart; for (iField = varStart; iField < fieldnames.size(); iField++) { - + string fieldname = fieldnames[iField]; fieldname.erase(remove(fieldname.begin(), fieldname.end(), '"'), fieldname.end()); - + bool output_variable = true, isVector = false; size_t found = fieldnames[iField].find("_x"); if (found!=string::npos) { @@ -353,21 +353,21 @@ void CParaviewBinaryFileWriter::Write_Data(){ output_variable = false; VarCounter++; } - + if (output_variable && isVector) { - + fieldname.erase(fieldname.end()-2,fieldname.end()); SPRINTF (str_buf, "\nVECTORS %s float\n", fieldname.c_str()); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)* strlen(str_buf); - + /*--- Prepare the 1D data buffer on this rank. ---*/ - + float *vec_buf = new float[GlobalPoint*NCOORDS]; - + /*--- For now, create a temp 1D buffer to load up the data for writing. This will be replaced with a derived data type most likely. ---*/ - + float val = 0.0; for (iPoint = 0; iPoint < GlobalPoint; iPoint++) for (iDim = 0; iDim < NCOORDS; iDim++) { @@ -382,28 +382,28 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)vec_buf, sizeof(float), NCOORDS*GlobalPoint); fwrite(vec_buf, sizeof(float), NCOORDS*GlobalPoint, fhw); file_size += sizeof(float)*NCOORDS*GlobalPoint; - + delete [] vec_buf; - + VarCounter++; - + } else if (output_variable) { - + SPRINTF (str_buf, "\nSCALARS %s float 1\n", fieldname.c_str()); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)* strlen(str_buf); - + SPRINTF (str_buf, "LOOKUP_TABLE default\n"); fwrite(str_buf, sizeof(char), strlen(str_buf), fhw); file_size += sizeof(char)* strlen(str_buf); - + /*--- Prepare the 1D data buffer on this rank. ---*/ - + float *scalar_buf = new float[GlobalPoint]; - + /*--- For now, create a temp 1D buffer to load up the data for writing. This will be replaced with a derived data type most likely. ---*/ - + for (iPoint = 0; iPoint < GlobalPoint; iPoint++) { float val = (float)dataSorter->GetData(VarCounter,iPoint); scalar_buf[iPoint] = val; @@ -412,33 +412,33 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)scalar_buf, sizeof(float), GlobalPoint); fwrite(scalar_buf, sizeof(float), GlobalPoint, fhw); file_size += sizeof(float)*GlobalPoint; - + delete [] scalar_buf; - + VarCounter++; } - + } - + /*--- Close the file. ---*/ - + fclose(fhw); - + #else - + /*--- Parallel binary output using MPI I/O. ---*/ - + MPI_File fhw; SU2_MPI::Status status; MPI_Datatype etype, filetype; MPI_Offset disp, disp2; int ierr; - + /*--- All ranks open the file using MPI. Here, we try to open the file with exclusive so that an error is generated if the file exists. We always want to write a fresh output file, so we delete any existing files and create a new one. ---*/ - + ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_WRONLY, MPI_INFO_NULL, &fhw); @@ -450,17 +450,17 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_WRONLY, MPI_INFO_NULL, &fhw); } - + /*--- Error check opening the file. ---*/ - + if (ierr) { SU2_MPI::Error(string("Unable to open VTK binary legacy file ") + string(fname), CURRENT_FUNCTION); } - + /*--- Write the initial strings to the file. Only the master will write the header lines, but all ranks will store the offsets. ---*/ - + disp = 0; strcpy(str_buf, "# vtk DataFile Version 3.0\n"); if (rank == MASTER_NODE) @@ -468,70 +468,70 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); file_size += sizeof(char)*strlen(str_buf); - - + + strcpy(str_buf, "vtk output\n"); if (rank == MASTER_NODE) MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); file_size += sizeof(char)*strlen(str_buf); - + strcpy(str_buf, "BINARY\n"); if (rank == MASTER_NODE) MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); file_size += sizeof(char)*strlen(str_buf); - + strcpy(str_buf, "DATASET UNSTRUCTURED_GRID\n"); if (rank == MASTER_NODE) MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); file_size += sizeof(char)*strlen(str_buf); - + /*--- Communicate the number of total points that will be written by each rank. After this communication, each proc knows how many poinnts will be written before its location in the file and the offsets can be correctly set. ---*/ - + unsigned long myPoint, GlobalPoint; - + GlobalPoint = dataSorter->GetnPointsGlobal(); myPoint = dataSorter->GetnPoints(); - - + + int *nPoint_Snd = new int[size+1]; int *nPoint_Cum = new int[size+1]; - + nPoint_Snd[0] = 0; nPoint_Cum[0] = 0; for (int ii=1; ii < size; ii++) { nPoint_Snd[ii] = myPoint; nPoint_Cum[ii] = 0; } nPoint_Snd[size] = myPoint; nPoint_Cum[size] = 0; - + /*--- Communicate the local counts to all ranks for building offsets. ---*/ - + SU2_MPI::Alltoall(&(nPoint_Snd[1]), 1, MPI_INT, &(nPoint_Cum[1]), 1, MPI_INT, MPI_COMM_WORLD); - + /*--- Put the counters into cumulative storage format. ---*/ - + for (int ii = 0; ii < size; ii++) { nPoint_Cum[ii+1] += nPoint_Cum[ii]; } - + SPRINTF(str_buf, "POINTS %i float\n", SU2_TYPE::Int(GlobalPoint)); if (rank == MASTER_NODE) MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); file_size += sizeof(char)*strlen(str_buf); - + /*--- Load/write the 1D buffer of point coordinates. Note that we always have 3 coordinate dimensions, even for 2D problems. ---*/ - + float *coord_buf = new float[myPoint*NCOORDS]; for (iPoint = 0; iPoint < myPoint; iPoint++) { for (iDim = 0; iDim < NCOORDS; iDim++) { @@ -546,49 +546,49 @@ void CParaviewBinaryFileWriter::Write_Data(){ if (!BigEndian) SwapBytes((char *)coord_buf, sizeof(float), myPoint*NCOORDS); /*--- We will write the point coordinates as floats. ---*/ - + etype = MPI_FLOAT; - + /*--- Define a derived datatype for this ranks contiguous chunk of data that will be placed in the file. ---*/ - + MPI_Type_contiguous(myPoint*NCOORDS, MPI_FLOAT, &filetype); MPI_Type_commit(&filetype); - + /*--- Compute the offset for this rank's linear partition of the data in bytes. ---*/ - + disp2 = disp + NCOORDS*nPoint_Cum[rank]*sizeof(float); - + /*--- Set the view for the MPI file write, i.e., describe the location in the file that this rank "sees" for writing its piece of the file. ---*/ - + MPI_File_set_view(fhw, disp2, etype, filetype, (char*)"native", MPI_INFO_NULL); - + /*--- Collective call for all ranks to write simultaneously. ---*/ - + MPI_File_write_all(fhw, coord_buf, myPoint*NCOORDS, MPI_FLOAT, &status); - + /*--- Update the displacement position for MPI IO. ---*/ - + disp += NCOORDS*nPoint_Cum[size]*sizeof(float); file_size += sizeof(float)*myPoint*NCOORDS; - + /*--- Free the derived datatype and coordinate array. ---*/ - + MPI_Type_free(&filetype); delete [] coord_buf; - + /*--- Compute our local number of elements, the required storage, and reduce the total number of elements and storage globally. ---*/ - + unsigned long nTot_Line; unsigned long nTot_Tria, nTot_Quad; unsigned long nTot_Tetr, nTot_Hexa, nTot_Pris, nTot_Pyra; unsigned long myElem, myElemStorage, GlobalElem, GlobalElemStorage; - + unsigned long nParallel_Line = dataSorter->GetnElem(LINE), nParallel_Tria = dataSorter->GetnElem(TRIANGLE), nParallel_Quad = dataSorter->GetnElem(QUADRILATERAL), @@ -596,7 +596,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ nParallel_Hexa = dataSorter->GetnElem(HEXAHEDRON), nParallel_Pris = dataSorter->GetnElem(PRISM), nParallel_Pyra = dataSorter->GetnElem(PYRAMID); - + SU2_MPI::Allreduce(&nParallel_Line, &nTot_Line, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); SU2_MPI::Allreduce(&nParallel_Tria, &nTot_Tria, 1, @@ -611,27 +611,27 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); SU2_MPI::Allreduce(&nParallel_Pyra, &nTot_Pyra, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - + myElem = (nParallel_Line + nParallel_Tria + nParallel_Quad + nParallel_Tetr + nParallel_Hexa + nParallel_Pris + nParallel_Pyra); myElemStorage = (nParallel_Line*3 + nParallel_Tria*4 + nParallel_Quad*5 + nParallel_Tetr*5 + nParallel_Hexa*9 + nParallel_Pris*7 + nParallel_Pyra*6); - + GlobalElem = (nTot_Line + nTot_Tria + nTot_Quad + nTot_Tetr + nTot_Hexa + nTot_Pris + nTot_Pyra); GlobalElemStorage = (nTot_Line*3 + nTot_Tria*4 + nTot_Quad*5 + nTot_Tetr*5 + nTot_Hexa*9 + nTot_Pris*7 + nTot_Pyra*6); - - - + + + /*--- Communicate the number of total cells/storage that will be written by each rank. After this communication, each proc knows how many cells will be written before its location in the file and the offsets can be correctly set. ---*/ - + int *nElem_Snd = new int[size+1]; int *nElemStorage_Snd = new int[size+1]; int *nElem_Cum = new int[size+1]; int *nElemStorage_Cum = new int[size+1]; - + nElem_Snd[0] = 0; nElemStorage_Snd[0] = 0; nElem_Cum[0] = 0; nElemStorage_Cum[0] = 0; for (int ii=1; ii < size; ii++) { @@ -640,24 +640,24 @@ void CParaviewBinaryFileWriter::Write_Data(){ } nElem_Snd[size] = myElem; nElemStorage_Snd[size] = myElemStorage; nElem_Cum[size] = 0; nElemStorage_Cum[size] = 0; - + /*--- Communicate the local counts to all ranks for building offsets. ---*/ - + SU2_MPI::Alltoall(&(nElem_Snd[1]), 1, MPI_INT, &(nElem_Cum[1]), 1, MPI_INT, MPI_COMM_WORLD); - + SU2_MPI::Alltoall(&(nElemStorage_Snd[1]), 1, MPI_INT, &(nElemStorage_Cum[1]), 1, MPI_INT, MPI_COMM_WORLD); - + /*--- Put the counters into cumulative storage format. ---*/ - + for (int ii = 0; ii < size; ii++) { nElem_Cum[ii+1] += nElem_Cum[ii]; nElemStorage_Cum[ii+1] += nElemStorage_Cum[ii]; } - + /*--- Reset the file view before writing the next ASCII line for cells. ---*/ - + MPI_File_set_view(fhw, 0, MPI_BYTE, MPI_BYTE, (char*)"native", MPI_INFO_NULL); SPRINTF(str_buf, "\nCELLS %i %i\n", SU2_TYPE::Int(GlobalElem), @@ -667,19 +667,19 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); file_size += sizeof(char)*strlen(str_buf); - + /*--- Load/write 1D buffers for the connectivity of each element type. ---*/ - + int *conn_buf = new int[myElemStorage]; unsigned long iStorage = 0; - + for (iElem = 0; iElem < nParallel_Line; iElem++) { conn_buf[iStorage+0] = N_POINTS_LINE; conn_buf[iStorage+1] = dataSorter->GetElem_Connectivity(LINE, iElem, 0)-1; conn_buf[iStorage+2] = dataSorter->GetElem_Connectivity(LINE, iElem, 1)-1; iStorage += (N_POINTS_LINE+1); } - + for (iElem = 0; iElem < nParallel_Tria; iElem++) { conn_buf[iStorage+0] = N_POINTS_TRIANGLE; conn_buf[iStorage+1] = dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 0)-1; @@ -687,7 +687,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ conn_buf[iStorage+3] = dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 2)-1 ; iStorage += (N_POINTS_TRIANGLE+1); } - + for (iElem = 0; iElem < nParallel_Quad; iElem++) { conn_buf[iStorage+0] = N_POINTS_QUADRILATERAL; conn_buf[iStorage+1] = dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0)-1; @@ -695,9 +695,9 @@ void CParaviewBinaryFileWriter::Write_Data(){ conn_buf[iStorage+3] = dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 2)-1; conn_buf[iStorage+4] = dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 3)-1; iStorage += (N_POINTS_QUADRILATERAL+1); - + } - + for (iElem = 0; iElem < nParallel_Tetr; iElem++) { conn_buf[iStorage+0] = N_POINTS_TETRAHEDRON; conn_buf[iStorage+1] = dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 0)-1; @@ -705,9 +705,9 @@ void CParaviewBinaryFileWriter::Write_Data(){ conn_buf[iStorage+3] = dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 2)-1; conn_buf[iStorage+4] = dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3)-1; iStorage += (N_POINTS_TETRAHEDRON+1); - + } - + for (iElem = 0; iElem < nParallel_Hexa; iElem++) { conn_buf[iStorage+0] = N_POINTS_HEXAHEDRON; conn_buf[iStorage+1] = dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 0)-1; @@ -720,7 +720,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ conn_buf[iStorage+8] = dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 7)-1; iStorage += (N_POINTS_HEXAHEDRON+1); } - + for (iElem = 0; iElem < nParallel_Pris; iElem++) { conn_buf[iStorage+0] = N_POINTS_PRISM; conn_buf[iStorage+1] = dataSorter->GetElem_Connectivity(PRISM, iElem, 0)-1; @@ -731,7 +731,7 @@ void CParaviewBinaryFileWriter::Write_Data(){ conn_buf[iStorage+6] = dataSorter->GetElem_Connectivity(PRISM, iElem, 5)-1; iStorage += (N_POINTS_PRISM+1); } - + for (iElem = 0; iElem < nParallel_Pyra; iElem++) { conn_buf[iStorage+0] = N_POINTS_PYRAMID; conn_buf[iStorage+1] = dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0)-1; @@ -741,49 +741,49 @@ void CParaviewBinaryFileWriter::Write_Data(){ conn_buf[iStorage+5] = dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4)-1; iStorage += (N_POINTS_PYRAMID+1); } - - + + if (!BigEndian) SwapBytes((char *)conn_buf, sizeof(int), myElemStorage); - + /*--- We write the connectivity with MPI_INTs. ---*/ - + etype = MPI_INT; - + /*--- Define a derived datatype for this ranks contiguous chunk of data that will be placed in the file. ---*/ - + MPI_Type_contiguous(myElemStorage, MPI_INT, &filetype); MPI_Type_commit(&filetype); - + /*--- Compute the offset for this rank's linear partition of the data in bytes. ---*/ - + disp2 = (disp + nElemStorage_Cum[rank]*sizeof(int)); - + /*--- Set the view for the MPI file write, i.e., describe the location in the file that this rank "sees" for writing its piece of the file. ---*/ - + MPI_File_set_view(fhw, disp2, etype, filetype, (char*)"native", MPI_INFO_NULL); - + /*--- Collective call for all ranks to write simultaneously. ---*/ - + MPI_File_write_all(fhw, conn_buf, myElemStorage, MPI_INT, &status); - + /*--- Update the displacement position for MPI IO. ---*/ - + disp += nElemStorage_Cum[size]*sizeof(int); - - file_size += sizeof(int)*myElemStorage; - + + file_size += sizeof(int)*myElemStorage; + /*--- Free the derived datatype. ---*/ - + MPI_Type_free(&filetype); delete [] conn_buf; - + /*--- Load/write the cell type for all elements in the file. ---*/ - + MPI_File_set_view(fhw, 0, MPI_BYTE, MPI_BYTE, (char*)"native", MPI_INFO_NULL); SPRINTF (str_buf, "\nCELL_TYPES %i\n", SU2_TYPE::Int(GlobalElem)); @@ -791,11 +791,11 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); - file_size += sizeof(char)*strlen(str_buf); - + file_size += sizeof(char)*strlen(str_buf); + int *type_buf = new int[myElem]; unsigned long jElem = 0; - + for (iElem = 0; iElem < nParallel_Line; iElem++) { type_buf[jElem] = LINE; jElem++; } @@ -817,48 +817,48 @@ void CParaviewBinaryFileWriter::Write_Data(){ for (iElem = 0; iElem < nParallel_Pyra; iElem++) { type_buf[jElem] = PYRAMID; jElem++; } - + if (!BigEndian) SwapBytes((char *)type_buf, sizeof(int), myElem); /*--- We write the cell types with MPI_INTs. ---*/ - + etype = MPI_INT; - + /*--- Define a derived datatype for this ranks contiguous chunk of data that will be placed in the file. ---*/ - + MPI_Type_contiguous(myElem, MPI_INT, &filetype); MPI_Type_commit(&filetype); - + /*--- Compute the offset for this rank's linear partition of the data in bytes. ---*/ - + disp2 = (disp + nElem_Cum[rank]*sizeof(int)); - + /*--- Set the view for the MPI file write, i.e., describe the location in the file that this rank "sees" for writing its piece of the file. ---*/ - + MPI_File_set_view(fhw, disp2, etype, filetype, (char*)"native", MPI_INFO_NULL); - + /*--- Collective call for all ranks to write simultaneously. ---*/ - + MPI_File_write_all(fhw, type_buf, myElem, MPI_INT, &status); - + /*--- Update the displacement position for MPI IO. ---*/ - + disp += nElem_Cum[size]*sizeof(int); - - file_size += sizeof(int)*myElem; - + + file_size += sizeof(int)*myElem; + /*--- Free the derived datatype. ---*/ - + MPI_Type_free(&filetype); if (type_buf != NULL) delete [] type_buf; - + /*--- Now write the scalar and vector point data. ---*/ - + MPI_File_set_view(fhw, 0, MPI_BYTE, MPI_BYTE, (char*)"native", MPI_INFO_NULL); SPRINTF (str_buf, "\nPOINT_DATA %i\n", SU2_TYPE::Int(GlobalPoint)); @@ -866,24 +866,24 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); - file_size += sizeof(char)*strlen(str_buf); - + file_size += sizeof(char)*strlen(str_buf); + /*--- Adjust container start location to avoid point coords. ---*/ - + unsigned short varStart = 2; if (nDim == 3) varStart++; - + /*--- Loop over all variables that have been registered in the output. ---*/ - + unsigned short iField, VarCounter = varStart; for (iField = varStart; iField < fieldnames.size(); iField++) { - + string fieldname = fieldnames[iField]; fieldname.erase(remove(fieldname.begin(), fieldname.end(), '"'), fieldname.end()); - + /*--- Check whether this field is a vector or scalar. ---*/ - + bool output_variable = true, isVector = false; size_t found = fieldnames[iField].find("_x"); if (found!=string::npos) { @@ -902,13 +902,13 @@ void CParaviewBinaryFileWriter::Write_Data(){ output_variable = false; VarCounter++; } - + /*--- Write the point data as an vector or a scalar. ---*/ - + if (output_variable && isVector) { - + /*--- Adjust the string name to remove the leading "X-" ---*/ - + fieldname.erase(fieldname.end()-2,fieldname.end()); MPI_File_set_view(fhw, 0, MPI_BYTE, MPI_BYTE, (char*)"native", MPI_INFO_NULL); @@ -917,14 +917,14 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); - file_size += sizeof(char)*strlen(str_buf); - + file_size += sizeof(char)*strlen(str_buf); + /*--- Prepare the 1D data buffer on this rank. ---*/ - + float *vec_buf = new float[myPoint*NCOORDS]; - + /*--- Load up the buffer for writing this rank's vector data. ---*/ - + float val = 0.0; for (iPoint = 0; iPoint < myPoint; iPoint++) { for (iDim = 0; iDim < NCOORDS; iDim++) { @@ -940,46 +940,46 @@ void CParaviewBinaryFileWriter::Write_Data(){ SwapBytes((char *)vec_buf, sizeof(float), myPoint*NCOORDS); /*--- We will write the point data as floats. ---*/ - + etype = MPI_FLOAT; - + /*--- Define a derived datatype for this ranks contiguous chunk of data that will be placed in the file. ---*/ - + MPI_Type_contiguous(myPoint*NCOORDS, MPI_FLOAT, &filetype); MPI_Type_commit(&filetype); - + /*--- Compute the offset for this rank's linear partition of the data in bytes. ---*/ - + disp2 = disp + NCOORDS*nPoint_Cum[rank]*sizeof(float); - + /*--- Set the view for the MPI file write, i.e., describe the location in the file that this rank "sees" for writing its piece of the file. ---*/ - + MPI_File_set_view(fhw, disp2, etype, filetype, (char*)"native", MPI_INFO_NULL); - + /*--- Collective call for all ranks to write simultaneously. ---*/ - + MPI_File_write_all(fhw, vec_buf, myPoint*NCOORDS, MPI_FLOAT, &status); - + /*--- Update the displacement position for MPI IO. ---*/ - + disp += NCOORDS*nPoint_Cum[size]*sizeof(float); - - file_size += sizeof(float)*myPoint*NCOORDS; - + + file_size += sizeof(float)*myPoint*NCOORDS; + /*--- Free the derived datatype and coordinate array. ---*/ - + MPI_Type_free(&filetype); delete [] vec_buf; vec_buf = NULL; - + VarCounter++; - + } else if (output_variable) { - + MPI_File_set_view(fhw, 0, MPI_BYTE, MPI_BYTE, (char*)"native", MPI_INFO_NULL); SPRINTF (str_buf, "\nSCALARS %s float 1\n", fieldname.c_str()); @@ -987,8 +987,8 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); - file_size += sizeof(char)*strlen(str_buf); - + file_size += sizeof(char)*strlen(str_buf); + MPI_File_set_view(fhw, 0, MPI_BYTE, MPI_BYTE, (char*)"native", MPI_INFO_NULL); SPRINTF (str_buf, "LOOKUP_TABLE default\n"); @@ -996,95 +996,95 @@ void CParaviewBinaryFileWriter::Write_Data(){ MPI_File_write_at(fhw, disp, str_buf, strlen(str_buf), MPI_CHAR, MPI_STATUS_IGNORE); disp += strlen(str_buf)*sizeof(char); - file_size += sizeof(char)*strlen(str_buf); - + file_size += sizeof(char)*strlen(str_buf); + /*--- Prepare the 1D data buffer on this rank. ---*/ - + float *scalar_buf = new float[myPoint]; - + /*--- For now, create a temp 1D buffer to load up the data for writing. This will be replaced with a derived data type most likely. ---*/ - + for (iPoint = 0; iPoint < myPoint; iPoint++) { float val = (float)dataSorter->GetData(VarCounter,iPoint); scalar_buf[iPoint] = val; } if (!BigEndian) SwapBytes((char *)scalar_buf, sizeof(float), myPoint); - + /*--- We will write the point data as floats. ---*/ - + etype = MPI_FLOAT; - + /*--- Define a derived datatype for this ranks contiguous chunk of data that will be placed in the file. ---*/ - + MPI_Type_contiguous(myPoint, MPI_FLOAT, &filetype); MPI_Type_commit(&filetype); - + /*--- Compute the offset for this rank's linear partition of the data in bytes. ---*/ - + disp2 = disp + nPoint_Cum[rank]*sizeof(float); - + /*--- Set the view for the MPI file write, i.e., describe the location in the file that this rank "sees" for writing its piece of the file. ---*/ - + MPI_File_set_view(fhw, disp2, etype, filetype, (char*)"native", MPI_INFO_NULL); - + /*--- Collective call for all ranks to write simultaneously. ---*/ - + MPI_File_write_all(fhw, scalar_buf, myPoint, MPI_FLOAT, &status); - + /*--- Update the displacement position for MPI IO. ---*/ - + disp += nPoint_Cum[size]*sizeof(float); - - file_size += sizeof(float)*myPoint; - + + file_size += sizeof(float)*myPoint; + /*--- Free the derived datatype and coordinate array. ---*/ - + MPI_Type_free(&filetype); delete [] scalar_buf; scalar_buf = NULL; - + VarCounter++; } - + } - + /*--- All ranks close the file after writing. ---*/ - + MPI_File_close(&fhw); - - + + /*--- Compute and store the write time. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StopTime = MPI_Wtime(); #endif UsedTime = StopTime-StartTime; - + /*--- Communicate the total file size for the restart ---*/ - + #ifdef HAVE_MPI su2double my_file_size = file_size; SU2_MPI::Allreduce(&my_file_size, &file_size, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); #endif - + /*--- Compute and store the bandwidth ---*/ - + Bandwidth = file_size/(1.0e6)/UsedTime; - + /*--- Delete the offset counters that we needed for MPI IO. ---*/ - + delete [] nElem_Snd; delete [] nElem_Cum; delete [] nElemStorage_Snd; delete [] nElemStorage_Cum; delete [] nPoint_Snd; delete [] nPoint_Cum; - + #endif } @@ -1093,31 +1093,31 @@ void CParaviewBinaryFileWriter::Write_Data(){ big endian, which is expected for ParaView binary legacy format. ---*/ void CParaviewBinaryFileWriter::SwapBytes(char *buffer, size_t nBytes, unsigned long nVar) { - + /*--- Store half the number of bytes in kk. ---*/ - + const int kk = (int)nBytes/2; - + /*--- Loop over the number of variables in the buffer. ---*/ - + for (int j = 0; j < (int)nVar; j++) { - + /*--- Initialize ii and jj, which are used to store the indices of the bytes to be swapped. ---*/ - + int ii = j*(int)nBytes; int jj = ii + (int)nBytes - 1; - + /*--- Swap the bytes. ---*/ - + for (int i = 0; i < kk; i++) { char tmp = buffer[jj]; buffer[jj] = buffer[ii]; buffer[ii] = tmp; - + ii++; jj--; - + } } } diff --git a/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp index 84782c8b971..2489fb08d28 100644 --- a/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp @@ -2,19 +2,19 @@ const string CParaviewFileWriter::fileExt = ".vtk"; -CParaviewFileWriter::CParaviewFileWriter(vector fields, unsigned short nDim, - string fileName, CParallelDataSorter *dataSorter) : +CParaviewFileWriter::CParaviewFileWriter(vector fields, unsigned short nDim, + string fileName, CParallelDataSorter *dataSorter) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, fileExt, nDim){} CParaviewFileWriter::~CParaviewFileWriter(){} void CParaviewFileWriter::Write_Data(){ - + if (!dataSorter->GetConnectivitySorted()){ SU2_MPI::Error("Connectivity must be sorted.", CURRENT_FUNCTION); } - + unsigned short iDim; unsigned long iPoint, iElem; @@ -24,17 +24,17 @@ void CParaviewFileWriter::Write_Data(){ ofstream Paraview_File; int iProcessor; - + /*--- Set a timer for the file writing. ---*/ - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + /*--- Open Paraview ASCII file and write the header. ---*/ - + if (rank == MASTER_NODE) { Paraview_File.open(fileName.c_str(), ios::out); Paraview_File.precision(6); @@ -42,10 +42,10 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File << "vtk output\n"; Paraview_File << "ASCII\n"; Paraview_File << "DATASET UNSTRUCTURED_GRID\n"; - + /*--- Write the header ---*/ Paraview_File << "POINTS "<< dataSorter->GetnPointsGlobal() <<" double\n"; - + } Paraview_File.close(); @@ -62,17 +62,17 @@ void CParaviewFileWriter::Write_Data(){ for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { - + /*--- Write the node data from this proc ---*/ - - + + for (iPoint = 0; iPoint < dataSorter->GetnPoints(); iPoint++) { for (iDim = 0; iDim < nDim; iDim++) Paraview_File << scientific << dataSorter->GetData(iDim, iPoint) << "\t"; if (nDim == 2) Paraview_File << scientific << "0.0" << "\t"; } } - + Paraview_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); @@ -107,40 +107,40 @@ void CParaviewFileWriter::Write_Data(){ nTot_Pris = nParallel_Pris; nTot_Pyra = nParallel_Pyra; #endif - + if (rank == MASTER_NODE) { - + /*--- Write the header ---*/ nGlobal_Elem_Storage = nTot_Line*3 + nTot_Tria*4 + nTot_Quad*5 + nTot_Tetr*5 + nTot_Hexa*9 + nTot_Pris*7 + nTot_Pyra*6; - + Paraview_File << "\nCELLS " << dataSorter->GetnElem() << "\t" << nGlobal_Elem_Storage << "\n"; - + } Paraview_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif - + /*--- Write connectivity data. ---*/ - + for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { - - + + for (iElem = 0; iElem < nParallel_Line; iElem++) { Paraview_File << N_POINTS_LINE << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(LINE, iElem, 0)-1 << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(LINE, iElem, 1)-1 << "\t"; } - + for (iElem = 0; iElem < nParallel_Tria; iElem++) { Paraview_File << N_POINTS_TRIANGLE << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 0)-1 << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 1)-1 << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 2)-1 << "\t"; } - + for (iElem = 0; iElem < nParallel_Quad; iElem++) { Paraview_File << N_POINTS_QUADRILATERAL << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0)-1 << "\t"; @@ -148,58 +148,58 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 2)-1 << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 3)-1 << "\t"; } - - + + for (iElem = 0; iElem < nParallel_Tetr; iElem++) { Paraview_File << N_POINTS_TETRAHEDRON << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 0)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 0)-1 << "\t" << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 1)-1 << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 2)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 2)-1 << "\t" << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3)-1 << "\t"; } - + for (iElem = 0; iElem < nParallel_Hexa; iElem++) { - Paraview_File << N_POINTS_HEXAHEDRON << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 0)-1 << "\t" + Paraview_File << N_POINTS_HEXAHEDRON << "\t"; + Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 0)-1 << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 1)-1 << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 2)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 2)-1 << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 3)-1 << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 4)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 4)-1 << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 5)-1 << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 6)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 6)-1 << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 7)-1 << "\t"; } - + for (iElem = 0; iElem < nParallel_Pris; iElem++) { Paraview_File << N_POINTS_PRISM << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 0)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 0)-1 << "\t" << dataSorter->GetElem_Connectivity(PRISM, iElem, 1)-1 << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 2)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 2)-1 << "\t" << dataSorter->GetElem_Connectivity(PRISM, iElem, 3)-1 << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 4)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 4)-1 << "\t" << dataSorter->GetElem_Connectivity(PRISM, iElem, 5)-1 << "\t"; } - + for (iElem = 0; iElem < nParallel_Pyra; iElem++) { Paraview_File << N_POINTS_PYRAMID << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0)-1 << "\t" << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 1)-1 << "\t"; - Paraview_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 2)-1 << "\t" + Paraview_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 2)-1 << "\t" << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 3)-1 << "\t"; Paraview_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4)-1 << "\t"; } - + } Paraview_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif } - + if (rank == MASTER_NODE) { - + /*--- Write the header ---*/ Paraview_File << "\nCELL_TYPES " << dataSorter->GetnElem() << "\n"; - + } Paraview_File.flush(); @@ -215,18 +215,18 @@ void CParaviewFileWriter::Write_Data(){ for (iElem = 0; iElem < nParallel_Tetr; iElem++) Paraview_File << "10\t"; for (iElem = 0; iElem < nParallel_Hexa; iElem++) Paraview_File << "12\t"; for (iElem = 0; iElem < nParallel_Pris; iElem++) Paraview_File << "13\t"; - for (iElem = 0; iElem < nParallel_Pyra; iElem++) Paraview_File << "14\t"; - } + for (iElem = 0; iElem < nParallel_Pyra; iElem++) Paraview_File << "14\t"; + } Paraview_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif } - + if (rank == MASTER_NODE) { /*--- Write the header ---*/ Paraview_File << "\nPOINT_DATA "<< dataSorter->GetnPointsGlobal() <<"\n"; - + } Paraview_File.flush(); @@ -290,16 +290,16 @@ found = fieldnames[iField].find("_z"); for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { - + /*--- Write the node data from this proc ---*/ - + for (iPoint = 0; iPoint < dataSorter->GetnPoints(); iPoint++) { Paraview_File << scientific << dataSorter->GetData(VarCounter+0, iPoint) << "\t" << dataSorter->GetData(VarCounter+1, iPoint) << "\t"; if (nDim == 3) Paraview_File << scientific << dataSorter->GetData(VarCounter+2, iPoint) << "\t"; if (nDim == 2) Paraview_File << scientific << "0.0" << "\t"; } } - + Paraview_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); @@ -327,39 +327,39 @@ found = fieldnames[iField].find("_z"); if (rank == iProcessor) { /*--- Write the node data from this proc ---*/ - + for (iPoint = 0; iPoint < dataSorter->GetnPoints(); iPoint++) { Paraview_File << scientific << dataSorter->GetData(VarCounter, iPoint) << "\t"; } - + } Paraview_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif } - + VarCounter++; } } Paraview_File.close(); - - + + /*--- Compute and store the write time. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StopTime = MPI_Wtime(); #endif UsedTime = StopTime-StartTime; - + file_size = Determine_Filesize(fileName); - + /*--- Compute and store the bandwidth ---*/ - + Bandwidth = file_size/(1.0e6)/UsedTime; } diff --git a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp index 5d528e5cd4a..045de795c96 100644 --- a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp @@ -2,48 +2,48 @@ const string CSU2BinaryFileWriter::fileExt = ".dat"; -CSU2BinaryFileWriter::CSU2BinaryFileWriter(vector fields, unsigned short nDim, - string fileName, CParallelDataSorter *dataSorter) : +CSU2BinaryFileWriter::CSU2BinaryFileWriter(vector fields, unsigned short nDim, + string fileName, CParallelDataSorter *dataSorter) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, fileExt, nDim){} CSU2BinaryFileWriter::~CSU2BinaryFileWriter(){ - + } void CSU2BinaryFileWriter::Write_Data(){ - + /*--- Local variables ---*/ unsigned short iVar; - + unsigned short GlobalField_Counter = fieldnames.size(); unsigned long nParallel_Poin = dataSorter->GetnPoints(); - + ofstream restart_file; char str_buf[CGNS_STRING_SIZE], fname[100]; file_size = 0.0; - + strcpy(fname, fileName.c_str()); /*--- Prepare the first ints containing the counts. The first is a magic number that we can use to check for binary files (it is the hex representation for "SU2"). The second two values are number of variables - and number of points (DoFs). The last two values are for metadata: + and number of points (DoFs). The last two values are for metadata: one int for ExtIter and 8 su2doubles. ---*/ int var_buf_size = 5; int var_buf[5] = {535532, GlobalField_Counter, (int)dataSorter->GetnPointsGlobal(), 0, 0}; /*--- Set a timer for the binary file writing. ---*/ - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + #ifndef HAVE_MPI FILE* fhw; @@ -59,9 +59,9 @@ void CSU2BinaryFileWriter::Write_Data(){ fwrite(var_buf, var_buf_size, sizeof(int), fhw); file_size += (su2double)var_buf_size*sizeof(int); - + /*--- Write the variable names to the file. Note that we are adopting a - fixed length of 33 for the string length to match with CGNS. This is + fixed length of 33 for the string length to match with CGNS. This is needed for when we read the strings later. ---*/ for (iVar = 0; iVar < GlobalField_Counter; iVar++) { @@ -123,7 +123,7 @@ void CSU2BinaryFileWriter::Write_Data(){ } /*--- First, write the number of variables and points (i.e., cols and rows), - which we will need in order to read the file later. Also, write the + which we will need in order to read the file later. Also, write the variable string names here. Only the master rank writes the header. ---*/ if (rank == MASTER_NODE) { @@ -174,24 +174,24 @@ void CSU2BinaryFileWriter::Write_Data(){ #endif /*--- Compute and store the write time. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StopTime = MPI_Wtime(); #endif UsedTime = StopTime-StartTime; - + /*--- Communicate the total file size for the restart ---*/ - + #ifdef HAVE_MPI su2double my_file_size = file_size; SU2_MPI::Allreduce(&my_file_size, &file_size, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); #endif - + /*--- Compute and store the bandwidth ---*/ - + Bandwidth = file_size/(1.0e6)/UsedTime; } diff --git a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp index f05f3c50ee7..e774514d8b5 100644 --- a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp @@ -2,36 +2,36 @@ const string CSU2FileWriter::fileExt = ".csv"; -CSU2FileWriter::CSU2FileWriter(vector fields, unsigned short nDim, - string fileName, CParallelDataSorter *dataSorter) : +CSU2FileWriter::CSU2FileWriter(vector fields, unsigned short nDim, + string fileName, CParallelDataSorter *dataSorter) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, fileExt, nDim){} CSU2FileWriter::~CSU2FileWriter(){ - + } void CSU2FileWriter::Write_Data(){ - + /*--- Local variables ---*/ - + unsigned short iVar; unsigned long iPoint; ofstream restart_file; - + int iProcessor; - + /*--- Set a timer for the file writing. ---*/ - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + /*--- Only the master node writes the header. ---*/ - + if (rank == MASTER_NODE) { restart_file.open(fileName.c_str(), ios::out); restart_file.precision(15); @@ -41,66 +41,66 @@ void CSU2FileWriter::Write_Data(){ restart_file << ",\"" << fieldnames[fieldnames.size()-1] << "\"" << endl; restart_file.close(); } - + #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif - + /*--- All processors open the file. ---*/ - + restart_file.open(fileName.c_str(), ios::out | ios::app); restart_file.precision(15); - + /*--- Write the restart file in parallel, processor by processor. ---*/ - + unsigned long myPoint = 0, Global_Index; for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { for (iPoint = 0; iPoint < dataSorter->GetnPoints(); iPoint++) { - + /*--- Global Index of the current point. (note outer loop over procs) ---*/ - + Global_Index = dataSorter->GetGlobalIndex(iPoint); - + /*--- Write global index. (note outer loop over procs) ---*/ - + restart_file << Global_Index << ", "; myPoint++; - + /*--- Loop over the variables and write the values to file ---*/ - + for (iVar = 0; iVar < fieldnames.size()-1; iVar++) { restart_file << scientific << dataSorter->GetData(iVar, iPoint) << ", "; } - restart_file << scientific << dataSorter->GetData(fieldnames.size()-1, iPoint) << "\n"; + restart_file << scientific << dataSorter->GetData(fieldnames.size()-1, iPoint) << "\n"; } - + } /*--- Flush the file and wait for all processors to arrive. ---*/ restart_file.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif - + } - + /*--- Compute and store the write time. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StopTime = MPI_Wtime(); #endif UsedTime = StopTime-StartTime; - + /*--- Determine the file size ---*/ - + file_size = Determine_Filesize(fileName); - + /*--- Compute and store the bandwidth ---*/ - + Bandwidth = file_size/(1.0e6)/UsedTime; - + /*--- All processors close the file. ---*/ restart_file.close(); diff --git a/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp index 3cdce619add..6c88274bb8b 100644 --- a/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp @@ -3,19 +3,19 @@ const string CSU2MeshFileWriter::fileExt = ".su2"; -CSU2MeshFileWriter::CSU2MeshFileWriter(vector fields, unsigned short nDim, +CSU2MeshFileWriter::CSU2MeshFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter *dataSorter, - unsigned short iZone, unsigned short nZone) : + unsigned short iZone, unsigned short nZone) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, fileExt, nDim), iZone(iZone), nZone(nZone) {} CSU2MeshFileWriter::~CSU2MeshFileWriter(){ - + } void CSU2MeshFileWriter::Write_Data(){ - + unsigned long iElem, iPoint, iElem_Bound, nElem_Bound_, vnodes_edge[2], vnodes_triangle[3], vnodes_quad[4], offset, nElem; unsigned short iMarker, iDim, iChar, VTK_Type, nMarker_; short SendTo; @@ -23,15 +23,15 @@ void CSU2MeshFileWriter::Write_Data(){ string text_line, Marker_Tag, str; string::size_type position; int iProcessor; - + ofstream output_file; char cstr[MAX_STRING_SIZE], out_file[MAX_STRING_SIZE]; - + strcpy (out_file, fileName.c_str()); - strcpy (cstr, out_file); - + strcpy (cstr, out_file); + if (rank == MASTER_NODE){ - + /*--- For multizone-cases this only works if the all zonal meshes are in one file. If the meshes are separate for each zone another solution has to be found. ---*/ if (iZone==0) { @@ -43,29 +43,29 @@ void CSU2MeshFileWriter::Write_Data(){ if (iZone==0 && nZone>1) { output_file << "NZONE= " << nZone << endl; } - + if (nZone > 1){ output_file << "IZONE= " << iZone+1 << endl; } - + /*--- Write dimensions data. ---*/ - + output_file << "NDIME= " << nDim << endl; - + output_file << "NELEM= " << dataSorter->GetnElem() << endl; - + output_file.close(); } - + output_file.open(cstr, ios::out | ios::app); output_file.precision(15); nElem = 0; offset = 0; - + for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { for (iElem = 0; iElem < dataSorter->GetnElem(TRIANGLE); iElem++) { - output_file << "5\t"; + output_file << "5\t"; output_file << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 0) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 1) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 2) - 1 << "\t"; @@ -73,7 +73,7 @@ void CSU2MeshFileWriter::Write_Data(){ } for (iElem = 0; iElem < dataSorter->GetnElem(QUADRILATERAL); iElem++) { output_file << "9\t"; - output_file << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 1) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 2) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 3) - 1 << "\t"; @@ -81,19 +81,19 @@ void CSU2MeshFileWriter::Write_Data(){ } for (iElem = 0; iElem < dataSorter->GetnElem(TETRAHEDRON); iElem++) { output_file << "10\t"; - output_file << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 0) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 0) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 1) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 2) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3) - 1 << "\t"; output_file << nElem + offset << "\n"; nElem++; - } + } for (iElem = 0; iElem < dataSorter->GetnElem(HEXAHEDRON); iElem++) { output_file << "12\t"; - output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 0) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 0) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 1) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 2) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 3) - 1 << "\t"; - output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 4) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 4) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 5) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 6) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 7) - 1 << "\t"; @@ -101,68 +101,68 @@ void CSU2MeshFileWriter::Write_Data(){ } for (iElem = 0; iElem < dataSorter->GetnElem(PRISM); iElem++) { output_file << "13\t"; - output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 0) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 0) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 1) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 2) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 3) - 1 << "\t"; - output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 4) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 4) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(PRISM, iElem, 5) - 1 << "\t"; output_file << nElem + offset << "\n"; nElem++; } - + for (iElem = 0; iElem < dataSorter->GetnElem(PYRAMID); iElem++) { output_file << "14\t"; - output_file << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 1) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 2) - 1 << "\t"; output_file << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 3) - 1 << "\t"; - output_file << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4) - 1 << "\t"; + output_file << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4) - 1 << "\t"; output_file << nElem + offset << "\n"; nElem++; } } output_file.flush(); #ifdef HAVE_MPI - SU2_MPI::Allreduce(&nElem, &offset, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nElem, &offset, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); SU2_MPI::Barrier(MPI_COMM_WORLD); #endif } - - + + /*--- Write the node coordinates ---*/ if (rank == MASTER_NODE){ output_file << "NPOIN= " << dataSorter->GetnPointsGlobal(); output_file << endl; - output_file.flush(); + output_file.flush(); } - - + + unsigned long Global_Index, myPoint = 0; offset = 0; - + for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { for (iPoint = 0; iPoint < dataSorter->GetnPoints(); iPoint++) { - + /*--- Global Index of the current point. (note outer loop over procs) ---*/ - + Global_Index = iPoint + offset; - + /*--- Only write original domain points, i.e., exclude any periodic or halo nodes, even if they are output in the viz. files. ---*/ - + /*--- Loop over the variables and write the values to file ---*/ - + for (iDim = 0; iDim < nDim; iDim++) { output_file << scientific << dataSorter->GetData(iDim, iPoint) << "\t"; } - + /*--- Write global index. (note outer loop over procs) ---*/ - + output_file << Global_Index << "\t"; myPoint++; - + output_file << "\n"; - + } } /*--- Flush the file and wait for all processors to arrive. ---*/ @@ -172,43 +172,43 @@ void CSU2MeshFileWriter::Write_Data(){ SU2_MPI::Barrier(MPI_COMM_WORLD); #endif } - + output_file.close(); - + if (rank == MASTER_NODE){ - + output_file.open(cstr, ios::out | ios::app); - + /*--- Read the boundary information ---*/ - + if (nZone == 1){ str = "boundary"; } else { str = "boundary_" + PrintingToolbox::to_string(iZone); } - + str += ".dat"; - + input_file.open(str.c_str(), ios::out); - + if (!input_file.is_open()){ SU2_MPI::Error(string("Cannot find ") + str, CURRENT_FUNCTION); } - + /*--- Read grid file with format SU2 ---*/ - + while (getline (input_file, text_line)) { - + /*--- Write the physical boundaries ---*/ - + position = text_line.find ("NMARK=",0); if (position != string::npos) { - + text_line.erase (0,6); nMarker_ = atoi(text_line.c_str()); output_file << "NMARK= " << nMarker_ << endl; - + for (iMarker = 0 ; iMarker < nMarker_; iMarker++) { - + getline (input_file, text_line); text_line.erase (0,11); string::size_type position; @@ -221,29 +221,29 @@ void CSU2MeshFileWriter::Write_Data(){ if (position != string::npos) text_line.erase (position,1); } Marker_Tag = text_line.c_str(); - + /*--- Standart physical boundary ---*/ - + getline (input_file, text_line); - + text_line.erase (0,13); nElem_Bound_ = atoi(text_line.c_str()); output_file << "MARKER_TAG= " << Marker_Tag << endl; output_file << "MARKER_ELEMS= " << nElem_Bound_<< endl; getline (input_file, text_line); - + text_line.erase (0,8); SendTo = atoi(text_line.c_str()); - + if (Marker_Tag == "SEND_RECEIVE"){ output_file << "SEND_TO= " << SendTo << endl; } for (iElem_Bound = 0; iElem_Bound < nElem_Bound_; iElem_Bound++) { - + getline(input_file, text_line); istringstream bound_line(text_line); - + bound_line >> VTK_Type; output_file << VTK_Type; - + switch(VTK_Type) { case LINE: bound_line >> vnodes_edge[0]; bound_line >> vnodes_edge[1]; @@ -265,13 +265,13 @@ void CSU2MeshFileWriter::Write_Data(){ } } } - + } - + input_file.close(); - + // remove(str.c_str()); - + output_file.close(); } } diff --git a/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp b/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp index 2df29691430..55dafec98a2 100644 --- a/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp @@ -3,39 +3,39 @@ CSurfaceFEMDataSorter::CSurfaceFEMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields, CFEMDataSorter* volume_sorter) : CParallelDataSorter(config, nFields){ - + this->volume_sorter = volume_sorter; - + connectivity_sorted = false; - + /*--- Create an object of the class CMeshFEM_DG and retrieve the necessary geometrical information for the FEM DG solver. ---*/ - + CMeshFEM_DG *DGGeometry = dynamic_cast(geometry); - + unsigned long nVolElemOwned = DGGeometry->GetNVolElemOwned(); CVolumeElementFEM *volElem = DGGeometry->GetVolElem(); - + /*--- Update the solution by looping over the owned volume elements. ---*/ - + for(unsigned long l=0; l mapGlobalVol2Surf; for(unsigned long i=0; i(geometry); - + unsigned long nVolElemOwned = DGGeometry->GetNVolElemOwned(); CVolumeElementFEM *volElem = DGGeometry->GetVolElem(); - + const CBoundaryFEM *boundaries = DGGeometry->GetBoundaries(); const CFEMStandardBoundaryFace *standardBoundaryFacesSol = DGGeometry->GetStandardBoundaryFacesSol(); - + /*--- Create the map from the global DOF ID to the local index. Note one is added to the index value, because visualization softwares typically use 1-based indexing. ---*/ @@ -364,7 +364,7 @@ void CSurfaceFEMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * globalID.push_back(globalIndex); } } - + /*--- Determine the number of sub-elements on this rank by looping over the surface elements of the boundary markers that must be plotted. ---*/ @@ -381,12 +381,12 @@ void CSurfaceFEMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * } } } - + /* Allocate the memory to store the connectivity if the size is larger than zero. */ int *Conn_SubElem = NULL; if(nSubElem_Local > 0) Conn_SubElem = new int[nSubElem_Local*NODES_PER_ELEMENT](); - + /*--- Repeat the loop over the surface elements of the boundary markers that must be plotted, but now store the connectivity. ---*/ unsigned long kNode = 0; @@ -394,20 +394,20 @@ void CSurfaceFEMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * if( !boundaries[iMarker].periodicBoundary ) { if (config->GetMarker_All_Plotting(iMarker) == YES) { const vector &surfElem = boundaries[iMarker].surfElem; - + /* Loop over the surface elements of this boundary marker. */ for(unsigned long i=0; ivolume_sorter = volume_sorter; - + connectivity_sorted = false; - + nGlobalPoint_Sort = geometry->GetGlobal_nPointDomain(); nLocalPoint_Sort = geometry->GetnPointDomain(); - + /*--- Create the linear partitioner --- */ - + linearPartitioner = new CLinearPartitioner(nGlobalPoint_Sort, 0); } CSurfaceFVMDataSorter::~CSurfaceFVMDataSorter(){ - + if (linearPartitioner != NULL) delete linearPartitioner; delete [] passiveDoubleBuffer; - + } void CSurfaceFVMDataSorter::SortOutputData() { - + unsigned long iProcessor; unsigned long iPoint, iElem; unsigned long Global_Index; - + int VARS_PER_POINT = GlobalField_Counter; int *Local_Halo = NULL; int iNode, count; @@ -38,260 +38,260 @@ void CSurfaceFVMDataSorter::SortOutputData() { SU2_MPI::Status status; int ind; #endif - - + + /*--- Prepare to check and communicate the nodes that each proc has locally from the surface connectivity. ---*/ - + int *nElem_Send = new int[size+1](); nElem_Send[0] = 0; int *nElem_Recv = new int[size+1](); nElem_Recv[0] = 0; int *nElem_Flag = new int[size](); - + for (int ii=0; ii < size; ii++) { nElem_Send[ii] = 0; nElem_Recv[ii] = 0; nElem_Flag[ii]= -1; } nElem_Send[size] = 0; nElem_Recv[size] = 0; - + /*--- Loop through our local line elements and check where each of the grid nodes resides based on global index. ---*/ - + for (int ii = 0; ii < (int)nParallel_Line; ii++) { for ( int jj = 0; jj < N_POINTS_LINE; jj++ ) { - + /*--- Get global index. Note the -1 since it was 1-based for viz. ---*/ - + iNode = ii*N_POINTS_LINE+jj; Global_Index = Conn_Line_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); - + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != iNode)) { nElem_Flag[iProcessor] = iNode; nElem_Send[iProcessor+1]++; } - + } } - + /*--- Reset out flags and then loop through our local triangle surface elements performing the same check for where each grid node resides. ---*/ - + for (int ii=0; ii < size; ii++) nElem_Flag[ii]= -1; - + for (int ii = 0; ii < (int)nParallel_Tria; ii++) { for ( int jj = 0; jj < N_POINTS_TRIANGLE; jj++ ) { - + /*--- Get global index. Note the -1 since it was 1-based for viz. ---*/ - + iNode = ii*N_POINTS_TRIANGLE + jj; Global_Index = Conn_Tria_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != iNode)) { nElem_Flag[iProcessor] = iNode; nElem_Send[iProcessor+1]++; } - + } } - + /*--- Reset out flags and then loop through our local quad surface elements performing the same check for where each grid node resides. ---*/ - + for (int ii=0; ii < size; ii++) nElem_Flag[ii]= -1; - + for (int ii = 0; ii < (int)nParallel_Quad; ii++) { for ( int jj = 0; jj < N_POINTS_QUADRILATERAL; jj++ ) { - + /*--- Get global index. Note the -1 since it was 1-based for viz. ---*/ - + iNode = ii*N_POINTS_QUADRILATERAL+jj; Global_Index = Conn_Quad_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != iNode)) { nElem_Flag[iProcessor] = iNode; nElem_Send[iProcessor+1]++; } - + } } - + /*--- Communicate the number of nodes to be sent/recv'd amongst all processors. After this communication, each proc knows how many nodes it will receive from each other processor. ---*/ - + #ifdef HAVE_MPI SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); #else nElem_Recv[1] = nElem_Send[1]; #endif - + /*--- Prepare to send. First check how many messages we will be sending and receiving. Here we also put the counters into cumulative storage format to make the communications simpler. ---*/ - + int nSends = 0, nRecvs = 0; for (int ii=0; ii < size; ii++) nElem_Flag[ii] = -1; - + for (int ii = 0; ii < size; ii++) { if ((ii != rank) && (nElem_Send[ii+1] > 0)) nSends++; if ((ii != rank) && (nElem_Recv[ii+1] > 0)) nRecvs++; - + nElem_Send[ii+1] += nElem_Send[ii]; nElem_Recv[ii+1] += nElem_Recv[ii]; } - + /*--- Allocate arrays for sending the global ID. ---*/ - + unsigned long *idSend = new unsigned long[nElem_Send[size]](); - + /*--- Create an index variable to keep track of our index positions as we load up the send buffer. ---*/ - + unsigned long *idIndex = new unsigned long[size](); for (int ii=0; ii < size; ii++) idIndex[ii] = nElem_Send[ii]; - + /*--- Now loop back through the local connectivities for the surface elements and load up the global IDs for sending to their home proc. ---*/ - + for (int ii = 0; ii < (int)nParallel_Line; ii++) { for ( int jj = 0; jj < N_POINTS_LINE; jj++ ) { - + /*--- Get global index. Note the -1 since it was 1-based for viz. ---*/ - + iNode = ii*N_POINTS_LINE+jj; Global_Index = Conn_Line_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- Load global ID into the buffer for sending ---*/ - + if (nElem_Flag[iProcessor] != iNode) { - + nElem_Flag[iProcessor] = iNode; unsigned long nn = idIndex[iProcessor]; - + /*--- Load the connectivity values. ---*/ - + idSend[nn] = Global_Index; nn++; - + /*--- Increment the index by the message length ---*/ - + idIndex[iProcessor]++; - + } - + } } - + for (int ii=0; ii < size; ii++) nElem_Flag[ii]= -1; - + for (int ii = 0; ii < (int)nParallel_Tria; ii++) { for ( int jj = 0; jj < N_POINTS_TRIANGLE; jj++ ) { - + /*--- Get global index. Note the -1 since it was 1-based for viz. ---*/ - + iNode = ii*N_POINTS_TRIANGLE + jj; Global_Index = Conn_Tria_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- Load global ID into the buffer for sending ---*/ - + if (nElem_Flag[iProcessor] != iNode) { - + nElem_Flag[iProcessor] = iNode; unsigned long nn = idIndex[iProcessor]; - + /*--- Load the connectivity values. ---*/ - + idSend[nn] = Global_Index; nn++; - + /*--- Increment the index by the message length ---*/ - + idIndex[iProcessor]++; - + } - + } } - + for (int ii=0; ii < size; ii++) nElem_Flag[ii]= -1; - + for (int ii = 0; ii < (int)nParallel_Quad; ii++) { for ( int jj = 0; jj < N_POINTS_QUADRILATERAL; jj++ ) { - + /*--- Get global index. Note the -1 since it was 1-based for viz. ---*/ - + iNode = ii*N_POINTS_QUADRILATERAL+jj; Global_Index = Conn_Quad_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- Load global ID into the buffer for sending ---*/ - + if (nElem_Flag[iProcessor] != iNode) { - + nElem_Flag[iProcessor] = iNode; unsigned long nn = idIndex[iProcessor]; - + /*--- Load the connectivity values. ---*/ - + idSend[nn] = Global_Index; nn++; - + /*--- Increment the index by the message length ---*/ - + idIndex[iProcessor]++; - + } - + } } - + /*--- Allocate the memory that we need for receiving the global IDs values and then cue up the non-blocking receives. Note that we do not include our own rank in the communications. We will directly copy our own data later. ---*/ - + unsigned long *idRecv = new unsigned long[nElem_Recv[size]](); - + #ifdef HAVE_MPI /*--- We need double the number of messages to send both the conn. and the flags for the halo cells. ---*/ - + send_req = new SU2_MPI::Request[nSends]; recv_req = new SU2_MPI::Request[nRecvs]; - + /*--- Launch the non-blocking recv's for the global IDs. ---*/ - + unsigned long iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -305,9 +305,9 @@ void CSurfaceFVMDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking sends of the global IDs. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -322,30 +322,30 @@ void CSurfaceFVMDataSorter::SortOutputData() { } } #endif - + /*--- Copy my own rank's data into the recv buffer directly. ---*/ - + int mm = nElem_Recv[rank]; int ll = nElem_Send[rank]; int kk = nElem_Send[rank+1]; - + for (int nn=ll; nnGetnPoints()]; for (iPoint = 0; iPoint < volume_sorter->GetnPoints(); iPoint++) surfPoint[iPoint] = -1; - + for (int ii = 0; ii < nElem_Recv[size]; ii++) { surfPoint[(int)idRecv[ii] - volume_sorter->GetNodeBegin(rank)] = (int)idRecv[ii]; } - + /*--- First, add up the number of surface points I have on my rank. ---*/ - + nParallel_Poin = 0; - Renumber2Global.clear(); - + Renumber2Global.clear(); + for (iPoint = 0; iPoint < volume_sorter->GetnPoints(); iPoint++) { if (surfPoint[iPoint] != -1) { - + /*--- Save the global index values for CSV output. ---*/ - + Renumber2Global[nParallel_Poin] = surfPoint[iPoint]; - + /*--- Increment total number of surface points found locally. ---*/ - + nParallel_Poin++; } } - + /*--- Communicate this number of local surface points to all other processors so that it can be used to create offsets for the new global numbering for the surface points. ---*/ - + int *nPoint_Send = new int[size+1](); nPoint_Send[0] = 0; int *nPoint_Recv = new int[size+1](); nPoint_Recv[0] = 0; - + for (int ii=1; ii < size+1; ii++) nPoint_Send[ii]= (int)nParallel_Poin; - + #ifdef HAVE_MPI SU2_MPI::Alltoall(&(nPoint_Send[1]), 1, MPI_INT, &(nPoint_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); #else nPoint_Recv[1] = nPoint_Send[1]; #endif - + /*--- Go to cumulative storage format to compute the offsets. ---*/ - + for (int ii = 0; ii < size; ii++) { nPoint_Send[ii+1] += nPoint_Send[ii]; nPoint_Recv[ii+1] += nPoint_Recv[ii]; } - + /*--- Now that we know the number of local surface points that we have, we can allocate the new data structure to hold these points alone. Here, we also copy the data for those points from our volume data structure. ---*/ - + if (passiveDoubleBuffer == nullptr){ passiveDoubleBuffer = new passivedouble[nParallel_Poin*VARS_PER_POINT]; } @@ -426,22 +426,22 @@ void CSurfaceFVMDataSorter::SortOutputData() { } /*--- Reduce the total number of surf points we have. This will be needed for writing the surface solution files later. ---*/ - + #ifndef HAVE_MPI nGlobal_Poin_Par = nParallel_Poin; #else SU2_MPI::Allreduce(&nParallel_Poin, &nGlobal_Poin_Par, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); #endif - + /*--- Now that we know every proc's global offset for the number of surface points, we can create the new global numbering. Here, we create a new mapping using two arrays, which will need to be communicated. We use our mask again here. ---*/ - + unsigned long *globalP = new unsigned long[nParallel_Poin](); unsigned long *renumbP = new unsigned long[nParallel_Poin](); - + count = 0; for (iPoint = 0; iPoint < volume_sorter->GetnPoints(); iPoint++) { if (surfPoint[iPoint] != -1) { @@ -450,7 +450,7 @@ void CSurfaceFVMDataSorter::SortOutputData() { count++; } } - + /*--------------------------------------------------------------------------*/ /*--- Step 3: Communicate the arrays with the new global surface point ---*/ /*--- numbering to the procs that hold the connectivity for ---*/ @@ -463,132 +463,132 @@ void CSurfaceFVMDataSorter::SortOutputData() { /*--- bounds. This is because the elems are distributed based ---*/ /*--- on the node with the smallest global ID. ---*/ /*--------------------------------------------------------------------------*/ - + /*--- Reset our flags and counters ---*/ - + for (int ii=0; ii < size; ii++) { nElem_Send[ii] = 0; nElem_Recv[ii] = 0; nElem_Flag[ii]= -1; } nElem_Send[size] = 0; nElem_Recv[size] = 0; - + /*--- Loop through my local surface nodes, find which proc the global value lives on, then communicate the global ID and remumbered value. ---*/ - + for (int ii = 0; ii < (int)nParallel_Poin; ii++) { - + Global_Index = globalP[ii]; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != ii)) { nElem_Flag[iProcessor] = ii; nElem_Send[iProcessor+1]++; } - + } - + /*--- Communicate the number of cells to be sent/recv'd amongst all processors. After this communication, each proc knows how many cells it will receive from each other processor. ---*/ - + #ifdef HAVE_MPI SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); #else nElem_Recv[1] = nElem_Send[1]; #endif - + /*--- Prepare to send. First check how many messages we will be sending and receiving. Here we also put the counters into cumulative storage format to make the communications simpler. ---*/ - + nSends = 0; nRecvs = 0; for (int ii=0; ii < size; ii++) nElem_Flag[ii] = -1; - + for (int ii = 0; ii < size; ii++) { if ((ii != rank) && (nElem_Send[ii+1] > 0)) nSends++; if ((ii != rank) && (nElem_Recv[ii+1] > 0)) nRecvs++; - + nElem_Send[ii+1] += nElem_Send[ii]; nElem_Recv[ii+1] += nElem_Recv[ii]; } - + /*--- Allocate memory to hold the globals that we are sending. ---*/ - + unsigned long *globalSend = NULL; globalSend = new unsigned long[nElem_Send[size]](); - + /*--- Allocate memory to hold the renumbering that we are sending. ---*/ - + unsigned long *renumbSend = NULL; renumbSend = new unsigned long[nElem_Send[size]](); - + /*--- Create an index variable to keep track of our index position as we load up the send buffer. ---*/ - + unsigned long *index = new unsigned long[size](); for (int ii=0; ii < size; ii++) index[ii] = nElem_Send[ii]; - + /*--- Loop back through and load up the buffers for the global IDs and their new renumbering values. ---*/ - + for (int ii = 0; ii < (int)nParallel_Poin; ii++) { - + Global_Index = globalP[ii]; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); if (nElem_Flag[iProcessor] != ii) { - + nElem_Flag[iProcessor] = ii; unsigned long nn = index[iProcessor]; - + globalSend[nn] = Global_Index; renumbSend[nn] = renumbP[ii]; - + /*--- Increment the index by the message length ---*/ - + index[iProcessor]++; - + } } - + /*--- Free memory after loading up the send buffer. ---*/ - + delete [] index; - + /*--- Allocate the memory that we need for receiving the values and then cue up the non-blocking receives. Note that we do not include our own rank in the communications. We will directly copy our own data later. ---*/ - + unsigned long *globalRecv = NULL; globalRecv = new unsigned long[nElem_Recv[size]](); - + unsigned long *renumbRecv = NULL; renumbRecv = new unsigned long[nElem_Recv[size]](); #ifdef HAVE_MPI /*--- We need double the number of messages to send both the conn. and the flags for the halo cells. ---*/ - + send_req = new SU2_MPI::Request[2*nSends]; recv_req = new SU2_MPI::Request[2*nRecvs]; - + /*--- Launch the non-blocking recv's for the global ID. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -602,9 +602,9 @@ void CSurfaceFVMDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking sends of the global ID. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -618,9 +618,9 @@ void CSurfaceFVMDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking recv's for the renumbered ID. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -634,9 +634,9 @@ void CSurfaceFVMDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking sends of the renumbered ID. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -650,237 +650,237 @@ void CSurfaceFVMDataSorter::SortOutputData() { iMessage++; } } - + #endif - + /*--- Load our own procs data into the buffers directly. ---*/ - + mm = nElem_Recv[rank]; ll = nElem_Send[rank]; kk = nElem_Send[rank+1]; - + for (int nn=ll; nn renumber for nodes. Note the adding of 1 back in here for the eventual viz. purposes. ---*/ - + map Global2Renumber; for (int ii = 0; ii < nElem_Recv[size]; ii++) { Global2Renumber[globalRecv[ii]] = renumbRecv[ii] + 1; } - - + + /*--- The final step is one last pass over all elements to check for points outside of the linear partitions of the elements. Again, note that elems were distributed based on their smallest global ID, so some nodes of the elem may have global IDs lying outside of the linear partitioning. We need to recover the mapping for these outliers. We loop over all local surface elements to find these. ---*/ - + vector::iterator it; vector outliers; - + for (int ii = 0; ii < (int)nParallel_Line; ii++) { for ( int jj = 0; jj < N_POINTS_LINE; jj++ ) { - + iNode = ii*N_POINTS_LINE+jj; Global_Index = Conn_Line_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- Store the global ID if it is outside our own linear partition. ---*/ - + if ((iProcessor != (unsigned long)rank)) { outliers.push_back(Global_Index); } - + } } - + for (int ii=0; ii < size; ii++) nElem_Flag[ii]= -1; - + for (int ii = 0; ii < (int)nParallel_Tria; ii++) { for ( int jj = 0; jj < N_POINTS_TRIANGLE; jj++ ) { - + iNode = ii*N_POINTS_TRIANGLE + jj; Global_Index = Conn_Tria_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- Store the global ID if it is outside our own linear partition. ---*/ - + if ((iProcessor != (unsigned long)rank)) { outliers.push_back(Global_Index); } - + } } - + for (int ii=0; ii < size; ii++) nElem_Flag[ii]= -1; - + for (int ii = 0; ii < (int)nParallel_Quad; ii++) { for ( int jj = 0; jj < N_POINTS_QUADRILATERAL; jj++ ) { - + iNode = ii*N_POINTS_QUADRILATERAL+jj; Global_Index = Conn_Quad_Par[iNode]-1; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- Store the global ID if it is outside our own linear partition. ---*/ - + if ((iProcessor != (unsigned long)rank)) { outliers.push_back(Global_Index); } - + } } - + /*--- Create a unique list of global IDs that fall outside of our procs linear partition. ---*/ - + sort(outliers.begin(), outliers.end()); it = unique(outliers.begin(), outliers.end()); outliers.resize(it - outliers.begin()); - + /*--- Now loop over the outliers and communicate to those procs that hold the new numbering for our outlier points. We need to ask for the new numbering from these procs. ---*/ - + for (int ii=0; ii < size; ii++) { nElem_Send[ii] = 0; nElem_Recv[ii] = 0; nElem_Flag[ii]= -1; } nElem_Send[size] = 0; nElem_Recv[size] = 0; - + for (int ii = 0; ii < (int)outliers.size(); ii++) { - + Global_Index = outliers[ii]; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != ii)) { nElem_Flag[iProcessor] = ii; nElem_Send[iProcessor+1]++; } - + } - + /*--- Communicate the number of cells to be sent/recv'd amongst all processors. After this communication, each proc knows how many cells it will receive from each other processor. ---*/ - + #ifdef HAVE_MPI SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); #else nElem_Recv[1] = nElem_Send[1]; #endif - + /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put the counters into cumulative storage format to make the communications simpler. ---*/ - + nSends = 0; nRecvs = 0; for (int ii=0; ii < size; ii++) nElem_Flag[ii] = -1; - + for (int ii = 0; ii < size; ii++) { if ((ii != rank) && (nElem_Send[ii+1] > 0)) nSends++; if ((ii != rank) && (nElem_Recv[ii+1] > 0)) nRecvs++; - + nElem_Send[ii+1] += nElem_Send[ii]; nElem_Recv[ii+1] += nElem_Recv[ii]; } - + delete [] idSend; idSend = new unsigned long[nElem_Send[size]]; for (int ii = 0; ii < nElem_Send[size]; ii++) idSend[ii] = 0; - + /*--- Reset our index variable for reuse. ---*/ - + for (int ii=0; ii < size; ii++) idIndex[ii] = nElem_Send[ii]; - + /*--- Loop over the outliers again and load up the global IDs. ---*/ - + for (int ii = 0; ii < (int)outliers.size(); ii++) { - + Global_Index = outliers[ii]; - + /*--- Search for the processor that owns this point ---*/ - - iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); + + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != ii)) { - + nElem_Flag[iProcessor] = ii; unsigned long nn = idIndex[iProcessor]; - + /*--- Load the global ID values. ---*/ - + idSend[nn] = Global_Index; nn++; - + /*--- Increment the index by the message length ---*/ - + idIndex[iProcessor]++; - + } } - + /*--- Allocate the memory that we need for receiving the values and then cue up the non-blocking receives. Note that we do not include our own rank in the communications. We will directly copy our own data later. ---*/ - + delete [] idRecv; idRecv = new unsigned long[nElem_Recv[size]](); #ifdef HAVE_MPI /*--- We need double the number of messages to send both the conn. and the flags for the halo cells. ---*/ - + send_req = new SU2_MPI::Request[nSends]; recv_req = new SU2_MPI::Request[nRecvs]; - + /*--- Launch the non-blocking recv's for the connectivity. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -894,9 +894,9 @@ void CSurfaceFVMDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking sends of the connectivity. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -911,33 +911,33 @@ void CSurfaceFVMDataSorter::SortOutputData() { } } #endif - + /*--- Copy my own rank's data into the recv buffer directly. ---*/ - + mm = nElem_Recv[rank]; ll = nElem_Send[rank]; kk = nElem_Send[rank+1]; - + for (int nn=ll; nn nElem_Send[ii])) { @@ -971,9 +971,9 @@ void CSurfaceFVMDataSorter::SortOutputData() { iMessage++; } } - + /*--- Launch the non-blocking recv's for the connectivity. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -988,55 +988,55 @@ void CSurfaceFVMDataSorter::SortOutputData() { } } #endif - + /*--- Copy my own rank's data into the recv buffer directly. ---*/ - + mm = nElem_Send[rank]; ll = nElem_Recv[rank]; kk = nElem_Recv[rank+1]; - + for (int nn=ll; nn renumber transformation. Note that by construction, + the global -> renumber transformation. Note that by construction, nElem_Send[ii] == outliers.size(). We also add in the 1 for viz. here. ---*/ - + for (int ii = 0; ii < nElem_Send[size]; ii++) { Global2Renumber[outliers[ii]] = idSend[ii] + 1; } - + /*--- We can now overwrite the local connectivity for our surface elems using our completed map with the new global renumbering. Whew!! Note the -1 when accessing the conn from the map. ---*/ - + for (iElem = 0; iElem < nParallel_Line; iElem++) { iNode = (int)iElem*N_POINTS_LINE; Conn_Line_Par[iNode+0] = (int)Global2Renumber[Conn_Line_Par[iNode+0]-1]; Conn_Line_Par[iNode+1] = (int)Global2Renumber[Conn_Line_Par[iNode+1]-1]; } - + for (iElem = 0; iElem < nParallel_Tria; iElem++) { iNode = (int)iElem*N_POINTS_TRIANGLE; Conn_Tria_Par[iNode+0] = (int)Global2Renumber[Conn_Tria_Par[iNode+0]-1]; Conn_Tria_Par[iNode+1] = (int)Global2Renumber[Conn_Tria_Par[iNode+1]-1]; Conn_Tria_Par[iNode+2] = (int)Global2Renumber[Conn_Tria_Par[iNode+2]-1]; } - + for (iElem = 0; iElem < nParallel_Quad; iElem++) { iNode = (int)iElem*N_POINTS_QUADRILATERAL; Conn_Quad_Par[iNode+0] = (int)Global2Renumber[Conn_Quad_Par[iNode+0]-1]; @@ -1044,14 +1044,14 @@ void CSurfaceFVMDataSorter::SortOutputData() { Conn_Quad_Par[iNode+2] = (int)Global2Renumber[Conn_Quad_Par[iNode+2]-1]; Conn_Quad_Par[iNode+3] = (int)Global2Renumber[Conn_Quad_Par[iNode+3]-1]; } - + /*--- Free temporary memory ---*/ - + delete [] idIndex; delete [] surfPoint; delete [] globalP; delete [] renumbP; - + delete [] idSend; delete [] idRecv; delete [] globalSend; @@ -1064,55 +1064,55 @@ void CSurfaceFVMDataSorter::SortOutputData() { delete [] Local_Halo; delete [] nPoint_Send; delete [] nPoint_Recv; - + } void CSurfaceFVMDataSorter::SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) { - + /*--- Sort connectivity for each type of element (excluding halos). Note In these routines, we sort the connectivity into a linear partitioning across all processors based on the global index of the grid nodes. ---*/ - + /*--- Sort volumetric grid connectivity. ---*/ SortSurfaceConnectivity(config, geometry, LINE ); SortSurfaceConnectivity(config, geometry, TRIANGLE ); - SortSurfaceConnectivity(config, geometry, QUADRILATERAL); - - + SortSurfaceConnectivity(config, geometry, QUADRILATERAL); + + unsigned long nTotal_Surf_Elem = nParallel_Line + nParallel_Tria + nParallel_Quad; #ifndef HAVE_MPI nGlobal_Elem_Par = nTotal_Surf_Elem; #else SU2_MPI::Allreduce(&nTotal_Surf_Elem, &nGlobal_Elem_Par, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); #endif - + connectivity_sorted = true; - + } void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type) { - + unsigned long iProcessor; unsigned short NODES_PER_ELEMENT; unsigned long iPoint, jPoint; unsigned long nElem_Total = 0, Global_Index; - - unsigned long iMarker; - + + unsigned long iMarker; + int *Conn_Elem = NULL; - + #ifdef HAVE_MPI SU2_MPI::Request *send_req, *recv_req; SU2_MPI::Status status; int ind; #endif - + /*--- Store the local number of this element type and the number of nodes per this element type. In serial, this will be the total number of this element type in the entire mesh. In parallel, it is the number on only the current partition. ---*/ - + switch (Elem_Type) { case LINE: NODES_PER_ELEMENT = N_POINTS_LINE; @@ -1128,18 +1128,18 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * NODES_PER_ELEMENT = 0; break; } - + /*--- We start with the connectivity distributed across all procs with no particular ordering assumed. We need to loop through our local partition and decide how many elements we must send to each other rank in order to have all elements sorted according to a linear partitioning of the grid nodes, i.e., rank 0 holds the first nPoint()/nProcessors nodes. First, initialize a counter and flag. ---*/ - + int *nElem_Send = new int[size+1]; nElem_Send[0] = 0; int *nElem_Recv = new int[size+1]; nElem_Recv[0] = 0; int *nElem_Flag = new int[size]; - + for (int ii=0; ii < size; ii++) { nElem_Send[ii] = 0; nElem_Recv[ii] = 0; @@ -1149,187 +1149,187 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { if (config->GetMarker_All_Plotting(iMarker) == YES) { - + for (int ii = 0; ii < (int)geometry->GetnElem_Bound(iMarker); ii++) { - + if (geometry->bound[iMarker][ii]->GetVTK_Type() == Elem_Type) { for ( int jj = 0; jj < NODES_PER_ELEMENT; jj++ ) { - + /*--- Get the index of the current point. ---*/ - + iPoint = geometry->bound[iMarker][ii]->GetNode(jj); Global_Index = geometry->node[iPoint]->GetGlobalIndex(); - + /*--- Search for the lowest global index in this element. We send the element to the processor owning the range that includes the lowest global index value. ---*/ - + for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) { jPoint = geometry->bound[iMarker][ii]->GetNode(kk); unsigned long newID = geometry->node[jPoint]->GetGlobalIndex(); if (newID < Global_Index) Global_Index = newID; } - + /*--- Search for the processor that owns this point ---*/ - + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- If we have not visited this element yet, increment our number of elements that must be sent to a particular proc. ---*/ - + if ((nElem_Flag[iProcessor] != ii)) { nElem_Flag[iProcessor] = ii; nElem_Send[iProcessor+1]++; } - + } } } } } - + /*--- Communicate the number of cells to be sent/recv'd amongst all processors. After this communication, each proc knows how many cells it will receive from each other processor. ---*/ - + #ifdef HAVE_MPI SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); #else nElem_Recv[1] = nElem_Send[1]; #endif - + /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put the counters into cumulative storage format to make the communications simpler. ---*/ - + int nSends = 0, nRecvs = 0; for (int ii=0; ii < size; ii++) nElem_Flag[ii] = -1; - + for (int ii = 0; ii < size; ii++) { if ((ii != rank) && (nElem_Send[ii+1] > 0)) nSends++; if ((ii != rank) && (nElem_Recv[ii+1] > 0)) nRecvs++; - + nElem_Send[ii+1] += nElem_Send[ii]; nElem_Recv[ii+1] += nElem_Recv[ii]; } - + /*--- Allocate memory to hold the connectivity that we are sending. ---*/ - + unsigned long *connSend = NULL; connSend = new unsigned long[NODES_PER_ELEMENT*nElem_Send[size]]; for (int ii = 0; ii < NODES_PER_ELEMENT*nElem_Send[size]; ii++) connSend[ii] = 0; - + /*--- Allocate arrays for storing halo flags. ---*/ - + unsigned short *haloSend = new unsigned short[nElem_Send[size]]; for (int ii = 0; ii < nElem_Send[size]; ii++) haloSend[ii] = false; - + /*--- Create an index variable to keep track of our index position as we load up the send buffer. ---*/ - + unsigned long *index = new unsigned long[size]; for (int ii=0; ii < size; ii++) index[ii] = NODES_PER_ELEMENT*nElem_Send[ii]; unsigned long *haloIndex = new unsigned long[size]; for (int ii=0; ii < size; ii++) haloIndex[ii] = nElem_Send[ii]; - + /*--- Loop through our elements and load the elems and their additional data that we will send to the other procs. ---*/ - + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { if (config->GetMarker_All_Plotting(iMarker) == YES) { - + for (int ii = 0; ii < (int)geometry->GetnElem_Bound(iMarker); ii++) { - + if (geometry->bound[iMarker][ii]->GetVTK_Type() == Elem_Type) { for ( int jj = 0; jj < NODES_PER_ELEMENT; jj++ ) { - + /*--- Get the index of the current point. ---*/ - + iPoint = geometry->bound[iMarker][ii]->GetNode(jj); Global_Index = geometry->node[iPoint]->GetGlobalIndex(); - + /*--- Search for the lowest global index in this element. We send the element to the processor owning the range that includes the lowest global index value. ---*/ - + for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) { jPoint = geometry->bound[iMarker][ii]->GetNode(kk); unsigned long newID = geometry->node[jPoint]->GetGlobalIndex(); if (newID < Global_Index) Global_Index = newID; } - + /*--- Search for the processor that owns this point ---*/ - + iProcessor = linearPartitioner->GetRankContainingIndex(Global_Index); /*--- Load connectivity into the buffer for sending ---*/ - + if (nElem_Flag[iProcessor] != ii) { - + nElem_Flag[iProcessor] = ii; unsigned long nn = index[iProcessor]; unsigned long mm = haloIndex[iProcessor]; - + /*--- Load the connectivity values. ---*/ - + for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) { iPoint = geometry->bound[iMarker][ii]->GetNode(kk); connSend[nn] = geometry->node[iPoint]->GetGlobalIndex(); nn++; - + /*--- Check if this is a halo node. If so, flag this element as a halo cell. We will use this later to sort and remove any duplicates from the connectivity list. ---*/ - + if (volume_sorter->GetHalo(iPoint)) haloSend[mm] = true; - + } - + /*--- Increment the index by the message length ---*/ - - index[iProcessor] += NODES_PER_ELEMENT; + + index[iProcessor] += NODES_PER_ELEMENT; haloIndex[iProcessor]++; - + } } } } } } - + /*--- Free memory after loading up the send buffer. ---*/ - + delete [] index; delete [] haloIndex; - + /*--- Allocate the memory that we need for receiving the conn values and then cue up the non-blocking receives. Note that we do not include our own rank in the communications. We will directly copy our own data later. ---*/ - + unsigned long *connRecv = NULL; connRecv = new unsigned long[NODES_PER_ELEMENT*nElem_Recv[size]]; for (int ii = 0; ii < NODES_PER_ELEMENT*nElem_Recv[size]; ii++) connRecv[ii] = 0; - + unsigned short *haloRecv = new unsigned short[nElem_Recv[size]]; for (int ii = 0; ii < nElem_Recv[size]; ii++) haloRecv[ii] = false; - + #ifdef HAVE_MPI /*--- We need double the number of messages to send both the conn. and the flags for the halo cells. ---*/ - + send_req = new SU2_MPI::Request[2*nSends]; recv_req = new SU2_MPI::Request[2*nRecvs]; - + /*--- Launch the non-blocking recv's for the connectivity. ---*/ - + unsigned long iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -1343,9 +1343,9 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * iMessage++; } } - + /*--- Launch the non-blocking sends of the connectivity. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -1359,9 +1359,9 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * iMessage++; } } - + /*--- Repeat the process to communicate the halo flags. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Recv[ii])) { @@ -1375,9 +1375,9 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * iMessage++; } } - + /*--- Launch the non-blocking sends of the halo flags. ---*/ - + iMessage = 0; for (int ii=0; ii nElem_Send[ii])) { @@ -1392,45 +1392,45 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * } } #endif - + /*--- Copy my own rank's data into the recv buffer directly. ---*/ - + int mm = NODES_PER_ELEMENT*nElem_Recv[rank]; int ll = NODES_PER_ELEMENT*nElem_Send[rank]; int kk = NODES_PER_ELEMENT*nElem_Send[rank+1]; - + for (int nn=ll; nn 0) Conn_Elem = new int[NODES_PER_ELEMENT*nElem_Recv[size]]; int count = 0; nElem_Total = 0; for (int ii = 0; ii < nElem_Recv[size]; ii++) { - if (!haloRecv[ii]) { + if (!haloRecv[ii]) { nElem_Total++; for (int jj = 0; jj < NODES_PER_ELEMENT; jj++) { Conn_Elem[count] = (int)connRecv[ii*NODES_PER_ELEMENT+jj] + 1; @@ -1441,7 +1441,7 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * /*--- Store the particular global element count in the class data, and set the class data pointer to the connectivity array. ---*/ - + switch (Elem_Type) { case LINE: nParallel_Line = nElem_Total; @@ -1450,21 +1450,21 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * break; case TRIANGLE: nParallel_Tria = nElem_Total; - if (Conn_Tria_Par != NULL) delete [] Conn_Tria_Par; + if (Conn_Tria_Par != NULL) delete [] Conn_Tria_Par; if (nParallel_Tria > 0) Conn_Tria_Par = Conn_Elem; break; case QUADRILATERAL: nParallel_Quad = nElem_Total; - if (Conn_Quad_Par != NULL) delete [] Conn_Quad_Par; + if (Conn_Quad_Par != NULL) delete [] Conn_Quad_Par; if (nParallel_Quad > 0) Conn_Quad_Par = Conn_Elem; break; default: SU2_MPI::Error("Unrecognized element type", CURRENT_FUNCTION); break; } - + /*--- Free temporary memory from communications ---*/ - + delete [] connSend; delete [] connRecv; delete [] haloSend; @@ -1472,5 +1472,5 @@ void CSurfaceFVMDataSorter::SortSurfaceConnectivity(CConfig *config, CGeometry * delete [] nElem_Recv; delete [] nElem_Send; delete [] nElem_Flag; - + } diff --git a/SU2_CFD/src/output/filewriter/CTecplotBinaryFileWriter.cpp b/SU2_CFD/src/output/filewriter/CTecplotBinaryFileWriter.cpp index 4ae02eb1119..484dd21b2f4 100644 --- a/SU2_CFD/src/output/filewriter/CTecplotBinaryFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CTecplotBinaryFileWriter.cpp @@ -8,27 +8,27 @@ const string CTecplotBinaryFileWriter::fileExt = ".szplt"; CTecplotBinaryFileWriter::CTecplotBinaryFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter *dataSorter, - unsigned long time_iter, su2double timestep) : + unsigned long time_iter, su2double timestep) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, fileExt, nDim), time_iter(time_iter), timestep(timestep){} CTecplotBinaryFileWriter::~CTecplotBinaryFileWriter(){} void CTecplotBinaryFileWriter::Write_Data(){ - + if (!dataSorter->GetConnectivitySorted()){ SU2_MPI::Error("Connectivity must be sorted.", CURRENT_FUNCTION); } - + /*--- Set a timer for the binary file writing. ---*/ - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); -#endif - +#endif + #ifdef HAVE_TECIO - + /*--- Reduce the total number of each element. ---*/ unsigned long nTot_Line, nTot_Tria, nTot_Quad, nTot_Tetr, nTot_Hexa, nTot_Pris, nTot_Pyra; @@ -57,7 +57,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ nTot_Pris = nParallel_Pris; nTot_Pyra = nParallel_Pyra; #endif - + string data_set_title = "Visualization of the solution"; ostringstream tecplot_variable_names; @@ -75,14 +75,14 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecMPIInitialize(file_handle, MPI_COMM_WORLD, MASTER_NODE); if (err) cout << "Error initializing Tecplot parallel output." << endl; #endif - + /*--- Define the zone(s). For 2D, and for 3D surfaces, each rank outputs a separate zone. ---*/ int64_t num_nodes; int64_t num_cells; int32_t zone_type; - - + + num_nodes = static_cast(dataSorter->GetnPointsGlobal()); num_cells = static_cast(dataSorter->GetnElem()); if (nDim == 3){ @@ -90,16 +90,16 @@ void CTecplotBinaryFileWriter::Write_Data(){ zone_type = ZONETYPE_FEQUADRILATERAL; } else { - zone_type = ZONETYPE_FEBRICK; + zone_type = ZONETYPE_FEBRICK; } } else { if (nTot_Line > 0 && (nTot_Tria + nTot_Quad == 0)){ zone_type = ZONETYPE_FELINESEG; - + } else{ - zone_type = ZONETYPE_FEQUADRILATERAL; + zone_type = ZONETYPE_FEQUADRILATERAL; } } @@ -110,7 +110,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ is_unsteady = true; solution_time = SU2_TYPE::GetValue(timestep)*time_iter; } - + int32_t zone; vector value_locations(fieldnames.size(), 1); /* Nodal variables. */ err = tecZoneCreateFE(file_handle, "Zone", zone_type, num_nodes, num_cells, NULL, NULL, &value_locations[0], NULL, 0, 0, 0, &zone); @@ -139,42 +139,42 @@ void CTecplotBinaryFileWriter::Write_Data(){ partition_owners.push_back(iRank); err = tecZoneMapPartitionsToMPIRanks(file_handle, zone, size, &partition_owners[0]); if (err) cout << rank << ": Error assigning MPI ranks for Tecplot zone partitions." << endl; - + /* Gather a list of nodes we refer to but are not outputting. */ for (unsigned long i = 0; i < nParallel_Tria * N_POINTS_TRIANGLE; ++i) - if ((unsigned long)dataSorter->GetElem_Connectivity(TRIANGLE, 0, i) <= dataSorter->GetNodeBegin(rank) || + if ((unsigned long)dataSorter->GetElem_Connectivity(TRIANGLE, 0, i) <= dataSorter->GetNodeBegin(rank) || dataSorter->GetNodeEnd(rank) < (unsigned long)dataSorter->GetElem_Connectivity(TRIANGLE, 0, i)) halo_nodes.insert(dataSorter->GetElem_Connectivity(TRIANGLE, 0, i)); - + for (unsigned long i = 0; i < nParallel_Quad * N_POINTS_QUADRILATERAL; ++i) - if ((unsigned long)dataSorter->GetElem_Connectivity(QUADRILATERAL, 0, i) <= dataSorter->GetNodeBegin(rank) || + if ((unsigned long)dataSorter->GetElem_Connectivity(QUADRILATERAL, 0, i) <= dataSorter->GetNodeBegin(rank) || dataSorter->GetNodeEnd(rank) < (unsigned long)dataSorter->GetElem_Connectivity(QUADRILATERAL, 0, i)) halo_nodes.insert(dataSorter->GetElem_Connectivity(QUADRILATERAL, 0, i)); for (unsigned long i = 0; i < nParallel_Tetr * N_POINTS_TETRAHEDRON; ++i) - if ((unsigned long)dataSorter->GetElem_Connectivity(TETRAHEDRON, 0, i) <= dataSorter->GetNodeBegin(rank) || + if ((unsigned long)dataSorter->GetElem_Connectivity(TETRAHEDRON, 0, i) <= dataSorter->GetNodeBegin(rank) || dataSorter->GetNodeEnd(rank) < (unsigned long)dataSorter->GetElem_Connectivity(TETRAHEDRON, 0, i)) halo_nodes.insert(dataSorter->GetElem_Connectivity(TETRAHEDRON, 0, i)); for (unsigned long i = 0; i < nParallel_Hexa * N_POINTS_HEXAHEDRON; ++i) - if ((unsigned long)dataSorter->GetElem_Connectivity(HEXAHEDRON, 0, i) <= dataSorter->GetNodeBegin(rank) || + if ((unsigned long)dataSorter->GetElem_Connectivity(HEXAHEDRON, 0, i) <= dataSorter->GetNodeBegin(rank) || dataSorter->GetNodeEnd(rank) < (unsigned long)dataSorter->GetElem_Connectivity(HEXAHEDRON, 0, i)) halo_nodes.insert(dataSorter->GetElem_Connectivity(HEXAHEDRON, 0, i)); - + for (unsigned long i = 0; i < nParallel_Pris * N_POINTS_PRISM; ++i) - if ((unsigned long)dataSorter->GetElem_Connectivity(PRISM, 0, i) <= dataSorter->GetNodeBegin(rank) || + if ((unsigned long)dataSorter->GetElem_Connectivity(PRISM, 0, i) <= dataSorter->GetNodeBegin(rank) || dataSorter->GetNodeEnd(rank) < (unsigned long)dataSorter->GetElem_Connectivity(PRISM, 0, i)) halo_nodes.insert(dataSorter->GetElem_Connectivity(PRISM, 0, i)); - + for (unsigned long i = 0; i < nParallel_Pyra * N_POINTS_PYRAMID; ++i) - if ((unsigned long)dataSorter->GetElem_Connectivity(PYRAMID, 0, i) <= dataSorter->GetNodeBegin(rank) || + if ((unsigned long)dataSorter->GetElem_Connectivity(PYRAMID, 0, i) <= dataSorter->GetNodeBegin(rank) || dataSorter->GetNodeEnd(rank) < (unsigned long)dataSorter->GetElem_Connectivity(PYRAMID, 0, i)) halo_nodes.insert(dataSorter->GetElem_Connectivity(PYRAMID, 0, i)); /* Sorted list of halo nodes for this MPI rank. */ sorted_halo_nodes.assign(halo_nodes.begin(), halo_nodes.end()); - + /* Have to include all nodes our cells refer to or TecIO will barf, so add the halo node count to the number of local nodes. */ int64_t partition_num_nodes = dataSorter->GetNodeEnd(rank) - dataSorter->GetNodeBegin(rank) + static_cast(halo_nodes.size()); int64_t partition_num_cells = nParallel_Tetr + nParallel_Hexa + nParallel_Pris + nParallel_Pyra; @@ -225,7 +225,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ SU2_MPI::Alltoallv(&sorted_halo_nodes[0], &num_nodes_to_receive[0], &nodes_to_receive_displacements[0], MPI_UNSIGNED_LONG, &nodes_to_send[0], &num_nodes_to_send[0], &nodes_to_send_displacements[0], MPI_UNSIGNED_LONG, MPI_COMM_WORLD); - + /* Now actually send and receive the data */ vector data_to_send(max(1, total_num_nodes_to_send * (int)fieldnames.size())); halo_var_data.resize(max((size_t)1, fieldnames.size() * num_halo_nodes)); @@ -256,7 +256,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ } /*--- Write surface and volumetric solution data. ---*/ - + if (zone_type == ZONETYPE_FEBRICK) { std::vector values_to_write(dataSorter->GetnPoints()); for (iVar = 0; err == 0 && iVar < fieldnames.size(); iVar++) { @@ -278,7 +278,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ unsigned long nPoint = dataSorter->GetnPoints(); vector num_points(size); SU2_MPI::Gather(&nPoint, 1, MPI_UNSIGNED_LONG, &num_points[0], 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - + for(int iRank = 0; iRank < size; ++iRank) { int64_t rank_num_points = num_points[iRank]; @@ -289,7 +289,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ values_to_write.resize(rank_num_points); for(unsigned long i = 0; i < (unsigned long)rank_num_points; ++i) values_to_write[i] = dataSorter->GetData(iVar,i); - err = tecZoneVarWriteDoubleValues(file_handle, zone, iVar + 1, 0, rank_num_points, &values_to_write[0]); + err = tecZoneVarWriteDoubleValues(file_handle, zone, iVar + 1, 0, rank_num_points, &values_to_write[0]); if (err) cout << rank << ": Error outputting Tecplot variable values." << endl; } } @@ -306,16 +306,16 @@ void CTecplotBinaryFileWriter::Write_Data(){ } else { /* Send data to MASTER_NODE */ unsigned long nPoint = dataSorter->GetnPoints(); - + SU2_MPI::Gather(&nPoint, 1, MPI_UNSIGNED_LONG, NULL, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - + vector var_data; size_t var_data_size = fieldnames.size() * dataSorter->GetnPoints(); var_data.reserve(var_data_size); for (iVar = 0; err == 0 && iVar < fieldnames.size() ; iVar++) for(unsigned long i = 0; i < dataSorter->GetnPoints(); ++i) var_data.push_back(dataSorter->GetData(iVar,i)); - + if (var_data.size() > 0) CBaseMPIWrapper::Send(&var_data[0], static_cast(var_data.size()), MPI_DOUBLE, MASTER_NODE, rank, MPI_COMM_WORLD); } @@ -324,11 +324,11 @@ void CTecplotBinaryFileWriter::Write_Data(){ #else unsigned short iVar; - + vector var_data; size_t var_data_size = fieldnames.size() * dataSorter->GetnPoints(); var_data.reserve(var_data_size); - + for (iVar = 0; err == 0 && iVar < fieldnames.size(); iVar++) { for(unsigned long i = 0; i < dataSorter->GetnPoints(); ++i) @@ -336,14 +336,14 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneVarWriteDoubleValues(file_handle, zone, iVar + 1, 0, dataSorter->GetnPoints(), &var_data[iVar * dataSorter->GetnPoints()]); if (err) cout << rank << ": Error outputting Tecplot variable value." << endl; } - + #endif /* HAVE_MPI */ - + /*--- Write connectivity data. ---*/ unsigned long iElem; - + #ifdef HAVE_MPI if (zone_type == ZONETYPE_FEBRICK) { @@ -383,7 +383,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank + 1, 1, 8, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Pris; iElem++) { nodes[0] = MAKE_LOCAL(dataSorter->GetElem_Connectivity(PRISM, iElem, 0)); nodes[1] = MAKE_LOCAL(dataSorter->GetElem_Connectivity(PRISM, iElem, 1)); @@ -396,7 +396,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank + 1, 1, 8, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Pyra; iElem++) { nodes[0] = MAKE_LOCAL(dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0)); nodes[1] = MAKE_LOCAL(dataSorter->GetElem_Connectivity(PYRAMID, iElem, 1)); @@ -428,7 +428,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, 0, 1, 2, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Tria; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 1); @@ -437,7 +437,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, 0, 1, 4, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Quad; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 1); @@ -446,7 +446,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, 0, 1, 4, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + } else { /* Receive node map and write out. */ connectivity.resize(max((unsigned long)1, connectivity_sizes[iRank])); SU2_MPI::Recv(&connectivity[0], connectivity_sizes[iRank], MPI_UNSIGNED_LONG, iRank, iRank, MPI_COMM_WORLD, MPI_STATUS_IGNORE); @@ -467,29 +467,29 @@ void CTecplotBinaryFileWriter::Write_Data(){ connectivity.push_back(dataSorter->GetElem_Connectivity(LINE, iElem, 0)); connectivity.push_back(dataSorter->GetElem_Connectivity(LINE, iElem, 0)); } - + for (iElem = 0; err == 0 && iElem < nParallel_Tria; iElem++) { connectivity.push_back(dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 0)); connectivity.push_back(dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 1)); connectivity.push_back(dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 2)); connectivity.push_back(dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 2)); } - + for (iElem = 0; err == 0 && iElem < nParallel_Quad; iElem++) { connectivity.push_back(dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0)); connectivity.push_back(dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 1)); connectivity.push_back(dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 2)); connectivity.push_back(dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 3)); } - + if (connectivity.empty()) connectivity.resize(1); /* Avoid crash */ SU2_MPI::Send(&connectivity[0], connectivity_size, MPI_UNSIGNED_LONG, MASTER_NODE, rank, MPI_COMM_WORLD); } } #else - + int64_t nodes[8]; - + for (iElem = 0; err == 0 && iElem < nParallel_Tria; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 1); @@ -498,7 +498,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank, 1, 4, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Quad; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 1); @@ -507,7 +507,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank, 1, 4, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Tetr; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 1); @@ -520,7 +520,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank, 1, 8, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Hexa; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 1); @@ -533,7 +533,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank, 1, 8, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Pris; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(PRISM, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(PRISM, iElem, 1); @@ -546,7 +546,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank, 1, 8, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - + for (iElem = 0; err == 0 && iElem < nParallel_Pyra; iElem++) { nodes[0] = dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0); nodes[1] = dataSorter->GetElem_Connectivity(PYRAMID, iElem, 1); @@ -559,18 +559,18 @@ void CTecplotBinaryFileWriter::Write_Data(){ err = tecZoneNodeMapWrite64(file_handle, zone, rank, 1, 8, nodes); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } - - + + #endif - + err = tecFileWriterClose(&file_handle); if (err) cout << rank << ": Error finishing Tecplot file output." << endl; - + #endif /* HAVE_TECIO */ - + /*--- Compute and store the write time. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else @@ -579,9 +579,9 @@ void CTecplotBinaryFileWriter::Write_Data(){ UsedTime = StopTime-StartTime; file_size = Determine_Filesize(fileName); - + /*--- Compute and store the bandwidth ---*/ - + Bandwidth = file_size/(1.0e6)/UsedTime; } diff --git a/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp b/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp index bb7c37e7391..7feed08b2a2 100644 --- a/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp @@ -2,37 +2,37 @@ const string CTecplotFileWriter::fileExt = ".dat"; -CTecplotFileWriter::CTecplotFileWriter(vector fields, unsigned short nDim, +CTecplotFileWriter::CTecplotFileWriter(vector fields, unsigned short nDim, string fileName, CParallelDataSorter *dataSorter, - unsigned long time_iter, su2double timestep) : + unsigned long time_iter, su2double timestep) : CFileWriter(std::move(fields), std::move(fileName), dataSorter, fileExt, nDim), time_iter(time_iter), timestep(timestep){} CTecplotFileWriter::~CTecplotFileWriter(){} void CTecplotFileWriter::Write_Data(){ - + if (!dataSorter->GetConnectivitySorted()){ SU2_MPI::Error("Connectivity must be sorted.", CURRENT_FUNCTION); } - + unsigned short iVar; - + unsigned long iPoint, iElem; - + int iProcessor; ofstream Tecplot_File; - + file_size = 0.0; - + /*--- Set a timer for the file writing. ---*/ - + #ifndef HAVE_MPI StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StartTime = MPI_Wtime(); #endif - + /*--- Reduce the total number of each element. ---*/ unsigned long nTot_Line, nTot_Tria, nTot_Quad, nTot_Tetr, nTot_Hexa, nTot_Pris, nTot_Pyra; @@ -61,30 +61,30 @@ void CTecplotFileWriter::Write_Data(){ nTot_Pris = nParallel_Pris; nTot_Pyra = nParallel_Pyra; #endif - + /*--- Open Tecplot ASCII file and write the header. ---*/ - + if (rank == MASTER_NODE) { Tecplot_File.open(fileName.c_str(), ios::out); Tecplot_File.precision(6); Tecplot_File << "TITLE = \"Visualization of the solution\"" << endl; - + Tecplot_File << "VARIABLES = "; for (iVar = 0; iVar < fieldnames.size()-1; iVar++) { Tecplot_File << "\"" << fieldnames[iVar] << "\","; } Tecplot_File << "\"" << fieldnames[fieldnames.size()-1] << "\"" << endl; - + /*--- Write the header ---*/ - + Tecplot_File << "ZONE "; if (timestep > 0.0){ - Tecplot_File << "STRANDID="< 0 && (nTot_Tria + nTot_Quad == 0)){ - Tecplot_File << ", DATAPACKING=POINT, ZONETYPE=FELINESEG"<< endl; + Tecplot_File << ", DATAPACKING=POINT, ZONETYPE=FELINESEG"<< endl; } else{ - Tecplot_File << ", DATAPACKING=POINT, ZONETYPE=FEQUADRILATERAL"<< endl; + Tecplot_File << ", DATAPACKING=POINT, ZONETYPE=FEQUADRILATERAL"<< endl; } } - Tecplot_File.close(); + Tecplot_File.close(); } - + #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif - + /*--- Each processor opens the file. ---*/ - + Tecplot_File.open(fileName.c_str(), ios::out | ios::app); - + /*--- Write surface and volumetric solution data. ---*/ - + for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { - + /*--- Write the node data from this proc ---*/ - - + + for (iPoint = 0; iPoint < dataSorter->GetnPoints(); iPoint++) { for (iVar = 0; iVar < fieldnames.size(); iVar++) Tecplot_File << scientific << dataSorter->GetData(iVar, iPoint) << "\t"; Tecplot_File << endl; } } - + Tecplot_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif } - + /*--- Write connectivity data. ---*/ - + for (iProcessor = 0; iProcessor < size; iProcessor++) { if (rank == iProcessor) { - + for (iElem = 0; iElem < nParallel_Line; iElem++) { Tecplot_File << dataSorter->GetElem_Connectivity(LINE, iElem, 0) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(LINE, iElem, 1)<< "\n"; } - - + + for (iElem = 0; iElem < nParallel_Tria; iElem++) { Tecplot_File << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 0) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 1) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 2) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(TRIANGLE, iElem, 2) << "\n"; } - + for (iElem = 0; iElem < nParallel_Quad; iElem++) { Tecplot_File << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 0) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 1) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 2) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(QUADRILATERAL, iElem, 3) << "\n"; } - + for (iElem = 0; iElem < nParallel_Tetr; iElem++) { Tecplot_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 0) << "\t" << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 1) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 2) << "\t" << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 2) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3) << "\t" << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3) << "\t"; - Tecplot_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3) << "\t" << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3) << "\n"; + Tecplot_File << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3) << "\t" << dataSorter->GetElem_Connectivity(TETRAHEDRON, iElem, 3) << "\n"; } - + for (iElem = 0; iElem < nParallel_Hexa; iElem++) { Tecplot_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 0) << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 1) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 2) << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 3) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 4) << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 5) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 6) << "\t" << dataSorter->GetElem_Connectivity(HEXAHEDRON, iElem, 7) << "\n"; } - + for (iElem = 0; iElem < nParallel_Pris; iElem++) { Tecplot_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 0) << "\t" << dataSorter->GetElem_Connectivity(PRISM, iElem, 1) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 1) << "\t" << dataSorter->GetElem_Connectivity(PRISM, iElem, 2) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 3) << "\t" << dataSorter->GetElem_Connectivity(PRISM, iElem, 4) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(PRISM, iElem, 4) << "\t" << dataSorter->GetElem_Connectivity(PRISM, iElem, 5) << "\n"; } - + for (iElem = 0; iElem < nParallel_Pyra; iElem++) { Tecplot_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 0) << "\t" << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 1) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 2) << "\t" << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 3) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4) << "\t" << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4) << "\t"; Tecplot_File << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4) << "\t" << dataSorter->GetElem_Connectivity(PYRAMID, iElem, 4) << "\n"; } - - + + } Tecplot_File.flush(); #ifdef HAVE_MPI SU2_MPI::Barrier(MPI_COMM_WORLD); #endif } - + Tecplot_File.close(); - + /*--- Compute and store the write time. ---*/ - + #ifndef HAVE_MPI StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC); #else StopTime = MPI_Wtime(); #endif UsedTime = StopTime-StartTime; - + file_size = Determine_Filesize(fileName); - + /*--- Compute and store the bandwidth ---*/ - + Bandwidth = file_size/(1.0e6)/UsedTime; } diff --git a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp index 9bc6bd10721..e0523985714 100644 --- a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp @@ -106,13 +106,13 @@ CDiscAdjMeshSolver::CDiscAdjMeshSolver(CGeometry *geometry, CConfig *config, CSo /*--- Initialize the node structure ---*/ 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) { diff --git a/SU2_CFD/src/solvers/CMeshSolver.cpp b/SU2_CFD/src/solvers/CMeshSolver.cpp index a68d8224bc4..5dd516b5fd0 100644 --- a/SU2_CFD/src/solvers/CMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CMeshSolver.cpp @@ -81,7 +81,7 @@ CMeshSolver::CMeshSolver(CGeometry *geometry, CConfig *config) : CFEASolver(true Coordinate = new su2double[nDim]; nodes = new CMeshBoundVariable(nPoint, nDim, config); SetBaseClassPointerToNodes(); - + /*--- Set which points are vertices and allocate boundary data. ---*/ for (iPoint = 0; iPoint < nPoint; iPoint++) { @@ -199,7 +199,7 @@ CMeshSolver::CMeshSolver(CGeometry *geometry, CConfig *config) : CFEASolver(true } CMeshSolver::~CMeshSolver(void) { - + if (Coordinate != NULL) delete [] Coordinate; if (element !=NULL ) delete [] element; } @@ -238,7 +238,7 @@ 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 = nodes->GetMesh_Coord(indexNode[iNode],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); @@ -688,7 +688,7 @@ void CMeshSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * unsigned short rbuf_NotMatching = 0, sbuf_NotMatching = 0; restart_filename = config->GetFilename(restart_filename, "", val_iter); - + /*--- Read the restart data from either an ASCII or binary SU2 file. ---*/ if (config->GetRead_Binary_Restart()) { diff --git a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp index cc6daa2473a..a1d12b6b477 100644 --- a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp @@ -54,10 +54,10 @@ CDiscAdjFEAVariable::CDiscAdjFEAVariable(const su2double *disp, const su2double 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()) Solution_BGS_k.resize(nPoint,nDim) = su2double(0.0); diff --git a/SU2_CFD/src/variables/CFEAVariable.cpp b/SU2_CFD/src/variables/CFEAVariable.cpp index 51615062942..959b91d45c3 100644 --- a/SU2_CFD/src/variables/CFEAVariable.cpp +++ b/SU2_CFD/src/variables/CFEAVariable.cpp @@ -63,7 +63,7 @@ CFEAVariable::CFEAVariable(const su2double *val_fea, unsigned long npoint, unsig if (dynamic_analysis) { 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]; @@ -93,7 +93,7 @@ CFEAVariable::CFEAVariable(const su2double *val_fea, unsigned long npoint, unsig if (refgeom) Reference_Geometry.resize(nPoint,nVar); if (prestretch_fem) Prestretch.resize(nPoint,nVar); - + if (config->GetMultizone_Problem()) Set_BGSSolution_k(); } diff --git a/SU2_CFD/src/variables/CMeshBoundVariable.cpp b/SU2_CFD/src/variables/CMeshBoundVariable.cpp index d31f0475a60..9c8f9b89384 100644 --- a/SU2_CFD/src/variables/CMeshBoundVariable.cpp +++ b/SU2_CFD/src/variables/CMeshBoundVariable.cpp @@ -57,7 +57,7 @@ void CMeshBoundVariable::AllocateBoundaryVariables(CConfig *config) { } void CMeshBoundVariable::Register_BoundDisp(bool input) { - if (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)); diff --git a/SU2_CFD/src/variables/CTransLMVariable.cpp b/SU2_CFD/src/variables/CTransLMVariable.cpp index 03a7d19ace4..0aad143b414 100644 --- a/SU2_CFD/src/variables/CTransLMVariable.cpp +++ b/SU2_CFD/src/variables/CTransLMVariable.cpp @@ -46,7 +46,7 @@ CTransLMVariable::CTransLMVariable(su2double intermittency, su2double REth, unsi Solution_Old(iPoint,0) = Solution(iPoint,0) = intermittency; Solution_Old(iPoint,1) = Solution(iPoint,1) = REth; } - + if (config->GetMultizone_Problem()) Set_BGSSolution_k(); diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index a381c354608..f432732da61 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -46,7 +46,7 @@ CTurbSSTVariable::CTurbSSTVariable(su2double kine, su2double omega, su2double mu Solution(iPoint,0) = kine; Solution(iPoint,1) = omega; } - + Solution_Old = Solution; sigma_om2 = constants[3]; diff --git a/SU2_CFD/src/variables/CVariable.cpp b/SU2_CFD/src/variables/CVariable.cpp index 02e10e3e6cf..60603c314f8 100644 --- a/SU2_CFD/src/variables/CVariable.cpp +++ b/SU2_CFD/src/variables/CVariable.cpp @@ -74,9 +74,9 @@ CVariable::CVariable(unsigned long npoint, unsigned long ndim, unsigned long nva Solution_time_n.resize(nPoint,nVar) = su2double(0.0); } - if (config->GetFSI_Simulation() && config->GetDiscrete_Adjoint()) { - Solution_Adj_Old.resize(nPoint,nVar); - } + if (config->GetFSI_Simulation() && config->GetDiscrete_Adjoint()) { + Solution_Adj_Old.resize(nPoint,nVar); + } Non_Physical.resize(nPoint) = false; diff --git a/externals/utils/replace-tabs-and-trim-trailing-whitespaces.sh b/externals/utils/replace-tabs-and-trim-trailing-whitespaces.sh new file mode 100644 index 00000000000..96c179acfab --- /dev/null +++ b/externals/utils/replace-tabs-and-trim-trailing-whitespaces.sh @@ -0,0 +1,39 @@ +#! /bin/bash + +# has to be called from code-root + +for folder in SU2_AD \ + SU2_BASE \ + SU2_CFD \ + SU2_DEF \ + SU2_DIRECTDIFF \ + SU2_DOT \ + SU2_GEO \ + SU2_MSH \ + SU2_SOL +do + cd $folder + echo $folder + + # replace all leading tabs by 2 spaces, for some reason trailing tabs and tabs enclosed by characters are only replaced by 2-1=1 spaces. + # The trailing tabs are irrelevant anyway as they are trimmed and enclosed tabs require new formatting anyway + + #https://stackoverflow.com/questions/11094383/how-can-i-convert-tabs-to-spaces-in-every-file-of-a-directory + #https://unix.stackexchange.com/questions/15308/how-to-use-find-command-to-search-for-multiple-extensions + + echo -n "Replace all tabs by 2 spaces..." + find . \( -name 'C*.cpp' -o -name 'C*.hpp' -o -name 'C*.inl' \) ! -type d -exec bash -c 'expand -t 2 "$0" > /tmp/e && mv /tmp/e "$0"' {} \; + #find . \( -name 'C*.cpp' -o -name 'C*.hpp' -o -name 'C*.inl' \) + echo "done" + + # deletes trailing whitespaces in all cpp,hpp,inl,build,py files + + #https://stackoverflow.com/questions/10711051/how-to-remove-trailing-whitespaces-for-multiple-files + #https://unix.stackexchange.com/questions/15308/how-to-use-find-command-to-search-for-multiple-extensions + + echo -n "Trim all trailing whitespaces..." + find . -type f \( -name 'C*.cpp' -o -name 'C*.hpp' -o -name 'C*.inl' \) -exec sed --in-place 's/[[:space:]]\+$//' {} \+ + echo "done" + + cd .. +done