diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index cb08d80f7a07..98f56a6bcd0b 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -136,6 +136,7 @@ class CConfig { Hold_GridFixed, /*!< \brief Flag hold fixed some part of the mesh during the deformation. */ Axisymmetric, /*!< \brief Flag for axisymmetric calculations */ Integrated_HeatFlux, /*!< \brief Flag for heat flux BC whether it deals with integrated values.*/ + Pressure_based, /*!< \brief Flag to check if we are using a pressure-based system.*/ Buffet_Monitoring; /*!< \brief Flag for computing the buffet sensor.*/ su2double Buffet_k; /*!< \brief Sharpness coefficient for buffet sensor.*/ su2double Buffet_lambda; /*!< \brief Offset parameter for buffet sensor.*/ @@ -221,6 +222,7 @@ class CConfig { nMarker_Load_Sine, /*!< \brief Number of load surface markers defined by magnitude and direction. */ nMarker_FlowLoad, /*!< \brief Number of load surface markers. */ nMarker_Internal, /*!< \brief Number of internal flow markers. */ + nMarker_Empty, /*!< \brief Number of empty flow markers. */ nMarker_All, /*!< \brief Total number of markers using the grid information. */ nMarker_Max, /*!< \brief Max number of number of markers using the grid information. */ nMarker_CfgFile; /*!< \brief Total number of markers using the config file (note that in @@ -269,6 +271,7 @@ class CConfig { *Marker_Load_Sine, /*!< \brief Sine-wave loaded markers defined in cartesian coordinates. */ *Marker_FlowLoad, /*!< \brief Flow Load markers. */ *Marker_Internal, /*!< \brief Internal flow markers. */ + *Marker_Empty, /*!< \brief Empty markers. */ *Marker_All_TagBound; /*!< \brief Global index for markers using grid information. */ su2double *Exhaust_Temperature_Target; /*!< \brief Specified total temperatures for nacelle boundaries. */ @@ -497,10 +500,11 @@ class CConfig { Kind_TimeIntScheme_Flow, /*!< \brief Time integration for the flow equations. */ Kind_TimeIntScheme_FEM_Flow, /*!< \brief Time integration for the flow equations. */ Kind_ADER_Predictor, /*!< \brief Predictor step of the ADER-DG time integration scheme. */ - Kind_TimeIntScheme_AdjFlow, /*!< \brief Time integration for the adjoint flow equations. */ - Kind_TimeIntScheme_Turb, /*!< \brief Time integration for the turbulence model. */ - Kind_TimeIntScheme_AdjTurb, /*!< \brief Time integration for the adjoint turbulence model. */ - Kind_TimeIntScheme_Heat, /*!< \brief Time integration for the wave equations. */ + Kind_TimeIntScheme_AdjFlow, /*!< \brief Time integration for the adjoint flow equations. */ + Kind_TimeIntScheme_Turb, /*!< \brief Time integration for the turbulence model. */ + Kind_TimeIntScheme_AdjTurb, /*!< \brief Time integration for the adjoint turbulence model. */ + Kind_TimeIntScheme_Poisson, /*!< \brief Time integration for the poisson(pressure correction) equation. */ + Kind_TimeIntScheme_Heat, /*!< \brief Time integration for the wave equations. */ Kind_TimeStep_Heat, /*!< \brief Time stepping method for the (fvm) heat equation. */ Kind_TimeIntScheme_FEA, /*!< \brief Time integration for the FEA equations. */ Kind_SpaceIteScheme_FEA, /*!< \brief Iterative scheme for nonlinear structural analysis. */ @@ -529,6 +533,10 @@ class CConfig { Kind_FEM_Flow, /*!< \brief Finite element scheme for the flow equations. */ Kind_FEM_DG_Shock, /*!< \brief Shock capturing method for the FEM DG solver. */ Kind_Matrix_Coloring, /*!< \brief Type of matrix coloring for sparse Jacobian computation. */ + Kind_Incomp_System, /*!< \brief Pressure-based solver for incompressible flows. */ + Kind_PBIter, /*!< \brief Pressure-based solver for incompressible flows. */ + Kind_Solver_Fluid_FSI, /*!< \brief Kind of solver for the fluid in FSI applications. */ + Kind_Solver_Struc_FSI, /*!< \brief Kind of solver for the structure in FSI applications. */ Kind_BGS_RelaxMethod, /*!< \brief Kind of relaxation method for Block Gauss Seidel method in FSI problems. */ Kind_CHT_Coupling; /*!< \brief Kind of coupling method used at CHT interfaces. */ bool ReconstructionGradientRequired; /*!< \brief Enable or disable a second gradient calculation for upwind reconstruction only. */ @@ -578,13 +586,17 @@ class CConfig { unsigned long Linear_Solver_Restart_Frequency; /*!< \brief Restart frequency of the linear solver for the implicit formulation. */ unsigned long Linear_Solver_Prec_Threads; /*!< \brief Number of threads per rank for ILU and LU_SGS preconditioners. */ unsigned short Linear_Solver_ILU_n; /*!< \brief ILU fill=in level. */ + unsigned long Linear_Solver_Iter_Flow; /*!< \brief Max iterations of the linear solver for the implicit formulation in the pressure based flow solver. */ + unsigned long Linear_Solver_Iter_Poisson; /*!< \brief Max iterations of the linear solver for the implicit formulation in the poisson solver of the pressure based method. */ su2double SemiSpan; /*!< \brief Wing Semi span. */ su2double Roe_Kappa; /*!< \brief Relaxation of the Roe scheme. */ + su2double RCFactor; /*!< \brief Relaxation for Rhie Chow interpolation contribution. */ + su2double Relaxation_Factor_PBFlow; /*!< \brief Relaxation coefficient of the flow corrections in PB solver. */ su2double Relaxation_Factor_Adjoint; /*!< \brief Relaxation coefficient for variable updates of adjoint solvers. */ su2double Relaxation_Factor_CHT; /*!< \brief Relaxation coefficient for the update of conjugate heat variables. */ su2double AdjTurb_Linear_Error; /*!< \brief Min error of the turbulent adjoint linear solver for the implicit formulation. */ su2double EntropyFix_Coeff; /*!< \brief Entropy fix coefficient. */ - unsigned short AdjTurb_Linear_Iter; /*!< \brief Min error of the turbulent adjoint linear solver for the implicit formulation. */ + unsigned short AdjTurb_Linear_Iter; /*!< \brief Min error of the turbulent adjoint linear solver for the implicit formulation. */ su2double *Stations_Bounds; /*!< \brief Airfoil section limit. */ unsigned short nLocationStations, /*!< \brief Number of section cuts to make when outputting mesh and cp . */ nWingStations; /*!< \brief Number of section cuts to make when calculating internal volume. */ @@ -955,6 +967,8 @@ class CConfig { Gust_Ampl, /*!< \brief Gust amplitude. */ Gust_Begin_Time, /*!< \brief Time at which to begin the gust. */ Gust_Begin_Loc; /*!< \brief Location at which the gust begins. */ + su2double *PRef_Coord, /*!< \brief Store the coordinate of reference cell for pressure */ + PRef_Value; /*!< \brief Store the reference value for pressure */ long Visualize_CV; /*!< \brief Node number for the CV to be visualized */ bool ExtraOutput; /*!< \brief Check if extra output need. */ bool Wall_Functions; /*!< \brief Use wall functions with the turbulence model */ @@ -1093,6 +1107,7 @@ class CConfig { default_nacelle_location[5], /*!< \brief Location of the nacelle. */ default_hs_axes[3], /*!< \brief Default principal axes (x, y, z) of the ellipsoid containing the heat source. */ default_hs_center[3], /*!< \brief Default position of the center of the heat source. */ + default_prefcoord_location[3], default_roughness[1]; unsigned short Riemann_Solver_FEM; /*!< \brief Riemann solver chosen for the DG method. */ @@ -2140,6 +2155,19 @@ class CConfig { */ bool GetPrestretch(void) const { return Prestretch; } + /*! + * \brief Return the value of pressure reference. + * \return PRef_Value. + */ + su2double GetPRef_Value(void) const {return PRef_Value;} + + /*! + * \brief Return the coordinates of the reference cell. + * \return PRef_Coord. + */ + + su2double* GetPRef_Coord(void) {return PRef_Coord;} + /*! * \brief Get the name of the file with the element properties for structural problems. * \return Name of the file with the element properties of the structural problem. @@ -2579,6 +2607,17 @@ class CConfig { */ void SetTotal_UnstTimeND(su2double val_total_unsttimend) { Total_UnstTimeND = val_total_unsttimend; } + /*! + * \brief Set the value of pressure reference. + */ + void SetPRef_Value(su2double val_PRef_Value); + + /*! + * \brief Set the coordinates of the reference cell. + */ + + void SetPRef_Coord(su2double val_PRef_Coord, unsigned short iDim); + /*! * \brief Get the angle of attack of the body. This is the angle between a reference line on a lifting body * (often the chord line of an airfoil) and the vector representing the relative motion between the @@ -3731,6 +3770,34 @@ class CConfig { */ unsigned short GetKind_MZSolver(void) const { return Kind_MZSolver; } + /*! + * \brief Governing equations of the flow (it can be different from the run time equation). + * \param[in] val_zone - Zone where the soler is applied. + * \return Governing equation that we are solving. + */ + unsigned short GetKind_Incomp_System(void) const { return Kind_Incomp_System; } + + /*! + * \brief Governing equations of the flow (it can be different from the run time equation). + * \param[in] val_zone - Zone where the soler is applied. + * \return Governing equation that we are solving. + */ + unsigned short GetKind_PBIter(void) const { return Kind_PBIter; } + + /*! + * \brief Governing equations of the flow (it can be different from the run time equation). + * \param[in] val_zone - Zone where the soler is applied. + * \return Governing equation that we are solving. + */ + void SetIncomp_System(unsigned short val_system); + + /*! + * \brief Governing equations of the flow (it can be different from the run time equation). + * \param[in] val_zone - Zone where the soler is applied. + * \return Governing equation that we are solving. + */ + void SetPBIter(unsigned short val_PBIter); + /*! * \brief Governing equations of the flow (it can be different from the run time equation). * \param[in] val_zone - Zone where the soler is applied. @@ -4075,6 +4142,24 @@ class CConfig { */ unsigned long GetLinear_Solver_Iter(void) const { return Linear_Solver_Iter; } + /*! + * \brief Get max number of iterations of the linear solver for the implicit formulation of flow solver for PB system. + * \return Max number of iterations of the linear solver for the implicit formulation of flow solver for PB system. + */ + unsigned long GetLinear_Solver_Iter_Flow(void) const { return Linear_Solver_Iter_Flow; } + + /*! + * \brief Get max number of iterations of the linear solver for the implicit formulation of poisson solver for PB system. + * \return Max number of iterations of the linear solver for the implicit formulation of poisson solver for PB system. + */ + unsigned long GetLinear_Solver_Iter_Poisson(void) const { return Linear_Solver_Iter_Poisson; } + + /*! + * \brief Get max number of iterations of the linear solver for the implicit formulation. + * \return Max number of iterations of the linear solver for the implicit formulation. + */ + void SetLinear_Solver_Iter(unsigned long LinSolver_Iter) { Linear_Solver_Iter = LinSolver_Iter; } + /*! * \brief Get max number of iterations of the linear solver for the implicit formulation. * \return Max number of iterations of the linear solver for the implicit formulation. @@ -4098,6 +4183,18 @@ class CConfig { * \return Relaxation factor. */ su2double GetLinear_Solver_Smoother_Relaxation(void) const { return Linear_Solver_Smoother_Relaxation; } + + /*! + * \brief Get the relaxation coefficient of the flow correction for PB solver. + * \return relaxation coefficient of the flow correction for PB solver + */ + su2double GetRelaxation_Factor_PBFlow(void) const { return Relaxation_Factor_PBFlow; } + + /*! + * \brief Get the relaxation coefficient of the flow correction for PB solver. + * \return relaxation coefficient of the flow correction for PB solver + */ + su2double GetRCFactor(void) const { return RCFactor; } /*! * \brief Get the relaxation factor for solution updates of adjoint solvers. @@ -4464,6 +4561,15 @@ class CConfig { */ unsigned short GetKind_TimeIntScheme_Radiation(void) const { return Kind_TimeIntScheme_Radiation; } + /*! + * \brief Get the kind of integration scheme (explicit or implicit) + * for the poisson/pressure correction equations. + * \note This value is obtained from the config file, and it is constant + * during the computation. + * \return Kind of integration scheme for the poisson/pressure correction equations. + */ + unsigned short GetKind_TimeIntScheme_Poisson(void) const { return Kind_TimeIntScheme_Poisson; } + /*! * \brief Get the kind of integration scheme (explicit or implicit) * for the template equations. diff --git a/Common/include/geometry/primal_grid/CPrimalGrid.hpp b/Common/include/geometry/primal_grid/CPrimalGrid.hpp index a8c279e4a3c3..e61c4db54598 100644 --- a/Common/include/geometry/primal_grid/CPrimalGrid.hpp +++ b/Common/include/geometry/primal_grid/CPrimalGrid.hpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "../../CConfig.hpp" diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 1acfe7a7a797..2ec9bbd28a57 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -79,7 +79,7 @@ const unsigned int MAX_PARAMETERS = 10; /*!< \brief Maximum number of para const unsigned int MAX_NUMBER_PERIODIC = 10; /*!< \brief Maximum number of periodic boundary conditions. */ const unsigned int MAX_STRING_SIZE = 200; /*!< \brief Maximum number of domains. */ const unsigned int MAX_NUMBER_FFD = 15; /*!< \brief Maximum number of FFDBoxes for the FFD. */ -const unsigned int MAX_SOLS = 12; /*!< \brief Maximum number of solutions at the same time (dimension of solution container array). */ +const unsigned int MAX_SOLS = 13; /*!< \brief Maximum number of solutions at the same time (dimension of solution container array). */ const unsigned int MAX_TERMS = 6; /*!< \brief Maximum number of terms in the numerical equations (dimension of solver container array). */ const unsigned int MAX_ZONES = 3; /*!< \brief Maximum number of zones. */ const unsigned int MAX_FE_KINDS = 4; /*!< \brief Maximum number of Finite Elements. */ @@ -199,6 +199,7 @@ enum ENUM_MAIN_SOLVER { FEM_RANS = 28, /*!< \brief Definition of the finite element Reynolds-averaged Navier-Stokes' (RANS) solver. */ FEM_LES = 29, /*!< \brief Definition of the finite element Large Eddy Simulation Navier-Stokes' (LES) solver. */ MULTIPHYSICS = 30, + POISSON_EQUATION = 31, /*!< \brief Definition of the poisson/pressure correction equation. */ NEMO_EULER = 41, /*!< \brief Definition of the NEMO Euler solver. */ NEMO_NAVIER_STOKES = 42 /*!< \brief Definition of the NEMO NS solver. */ }; @@ -235,6 +236,7 @@ static const MapType Solver_Map = { MakePair("FLUID_STRUCTURE_INTERACTION", FLUID_STRUCTURE_INTERACTION) MakePair("TEMPLATE_SOLVER", TEMPLATE_SOLVER) MakePair("MULTIPHYSICS", MULTIPHYSICS) + MakePair("POISSON_EQUATION", POISSON_EQUATION) }; /*! @@ -317,6 +319,35 @@ static const MapType MatComp_Map = { MakePair("NEARLY_INCOMPRESSIBLE", NEARLY_INCOMPRESSIBLE_MAT) }; +/*------New option for pressure-based system-------*/ +/*! + * \brief Type of incompressible solver + */ +enum ENUM_INCOMP_SYSTEM { + DENSITY_BASED = 0, /*!< \brief Density-based. */ + PRESSURE_BASED = 1 /*!< \brief Pressure-based. */ +}; +static const MapType Incomp_Map = { + MakePair("DENSITY_BASED", DENSITY_BASED) + MakePair("PRESSURE_BASED", PRESSURE_BASED) +}; + +/*! + * \brief Type of iteration + */ +enum ENUM_PBITER { + SIMPLE = 0, /*!< \brief SIMPLE algorithm. */ + SIMPLEC = 1, /*!< \brief SIMPLE algorithm. */ + PISO = 2, /*!< \brief PISO algorithm. */ +}; +static const MapType PBIter_Map = { + MakePair("SIMPLE", SIMPLE) + MakePair("SIMPLEC", SIMPLEC) + MakePair("PISO", PISO) +}; + +/*------ End new option for pressure-based system-------*/ + /*! * \brief Types of interpolators */ @@ -442,6 +473,7 @@ static const MapType Measurements_Map = { enum RUNTIME_TYPE { RUNTIME_FLOW_SYS = 2, /*!< \brief One-physics case, the code is solving the flow equations(Euler and Navier-Stokes). */ RUNTIME_TURB_SYS = 3, /*!< \brief One-physics case, the code is solving the turbulence model. */ + RUNTIME_POISSON_SYS = 4, /*!< \brief One-physics case, the code is solving the pressure correction equations. */ RUNTIME_ADJPOT_SYS = 5, /*!< \brief One-physics case, the code is solving the adjoint potential flow equation. */ RUNTIME_ADJFLOW_SYS = 6, /*!< \brief One-physics case, the code is solving the adjoint equations is being solved (Euler and Navier-Stokes). */ RUNTIME_ADJTURB_SYS = 7, /*!< \brief One-physics case, the code is solving the adjoint turbulence model. */ @@ -455,20 +487,21 @@ enum RUNTIME_TYPE { RUNTIME_ADJRAD_SYS = 24, /*!< \brief One-physics case, the code is solving the adjoint radiation model. */ }; -const int FLOW_SOL = 0; /*!< \brief Position of the mean flow solution in the solver container array. */ -const int ADJFLOW_SOL = 1; /*!< \brief Position of the continuous adjoint flow solution in the solver container array. */ +const int FLOW_SOL = 0; /*!< \brief Position of the mean flow solution in the solver container array. */ +const int ADJFLOW_SOL = 1; /*!< \brief Position of the continuous adjoint flow solution in the solver container array. */ -const int TURB_SOL = 2; /*!< \brief Position of the turbulence model solution in the solver container array. */ -const int ADJTURB_SOL = 3; /*!< \brief Position of the continuous adjoint turbulence solution in the solver container array. */ +const int TURB_SOL = 2; /*!< \brief Position of the turbulence model solution in the solver container array. */ +const int ADJTURB_SOL = 3; /*!< \brief Position of the continuous adjoint turbulence solution in the solver container array. */ -const int TRANS_SOL = 4; /*!< \brief Position of the transition model solution in the solver container array. */ -const int HEAT_SOL = 5; /*!< \brief Position of the heat equation in the solution solver array. */ +const int TRANS_SOL = 4; /*!< \brief Position of the transition model solution in the solver container array. */ +const int HEAT_SOL = 5; /*!< \brief Position of the heat equation in the solution solver array. */ const int ADJHEAT_SOL = 6; /*!< \brief Position of the adjoint heat equation in the solution solver array. */ const int RAD_SOL = 7; /*!< \brief Position of the radiation equation in the solution solver array. */ const int ADJRAD_SOL = 8; /*!< \brief Position of the continuous adjoint turbulence solution in the solver container array. */ +const int POISSON_SOL = 9; /*!< \brief Position of the electronic potential solution in the solver container array. */ -const int MESH_SOL = 9; /*!< \brief Position of the mesh solver. */ -const int ADJMESH_SOL = 10; /*!< \brief Position of the adjoint of the mesh solver. */ +const int MESH_SOL = 10; /*!< \brief Position of the mesh solver. */ +const int ADJMESH_SOL = 11; /*!< \brief Position of the adjoint of the mesh solver. */ const int FEA_SOL = 0; /*!< \brief Position of the FEA equation in the solution solver array. */ const int ADJFEA_SOL = 1; /*!< \brief Position of the FEA adjoint equation in the solution solver array. */ @@ -755,7 +788,8 @@ enum ENUM_CENTERED { JST = 1, /*!< \brief Jameson-Smith-Turkel centered numerical method. */ LAX = 2, /*!< \brief Lax-Friedrich centered numerical method. */ JST_MAT = 3, /*!< \brief JST with matrix dissipation. */ - JST_KE = 4 /*!< \brief Kinetic Energy preserving Jameson-Smith-Turkel centered numerical method. */ + JST_KE = 4, + CDS = 5 }; static const MapType Centered_Map = { MakePair("NONE", NO_CENTERED) @@ -763,6 +797,7 @@ static const MapType Centered_Map = { MakePair("JST_KE", JST_KE) MakePair("JST_MAT", JST_MAT) MakePair("LAX-FRIEDRICH", LAX) + MakePair("CDS", CDS) }; @@ -789,7 +824,8 @@ enum ENUM_UPWIND { LAX_FRIEDRICH = 15, /*!< \brief Lax-Friedrich numerical method. */ AUSMPLUSUP = 16, /*!< \brief AUSM+ -up numerical method (All Speed) */ AUSMPLUSUP2 = 17, /*!< \brief AUSM+ -up2 numerical method (All Speed) */ - AUSMPWPLUS = 18 /*!< \brief AUSMplus numerical method. (MAYBE for TNE2 ONLY)*/ + AUSMPWPLUS = 18, /*!< \brief AUSMplus numerical method. (MAYBE for TNE2 ONLY)*/ + UDS = 19 }; static const MapType Upwind_Map = { MakePair("NONE", NO_UPWIND) @@ -810,6 +846,7 @@ static const MapType Upwind_Map = { MakePair("LMROE", LMROE) MakePair("SLAU2", SLAU2) MakePair("FDS", FDS) + MakePair("UDS", UDS) MakePair("LAX-FRIEDRICH", LAX_FRIEDRICH) }; @@ -927,6 +964,21 @@ static const MapType SGS_Model_Map = { MakePair("VREMAN", VREMAN) }; +/*! + * \brief types of crossflow instability models of the LM transition model. + */ +enum ENUM_LM_CROSS_FLOW_MODEL { + NO_CROSS_FLOW_MODEL = 0, + LANGTRY_GENERAL_CROSS_FLOW = 1, + GRABE_WING_ONLY_CROSS_FLOW = 2, + GRABE_GENERAL_CROSS_FLOW = 3 +}; +static const MapType LM_CrossFlow_Model_Map = { +MakePair("NONE", NO_CROSS_FLOW_MODEL) +MakePair("LANGTRY_GENERAL_CROSS_FLOW", LANGTRY_GENERAL_CROSS_FLOW) +MakePair("GRABE_WING_ONLY_CROSS_FLOW", GRABE_WING_ONLY_CROSS_FLOW) +MakePair("GRABE_GENERAL_CROSS_FLOW", GRABE_GENERAL_CROSS_FLOW) +}; /*! * \brief Types of window (weight) functions for cost functional @@ -1147,6 +1199,7 @@ enum BC_TYPE { FLUID_INTERFACE = 39, /*!< \brief Domain interface definition. */ DISP_DIR_BOUNDARY = 40, /*!< \brief Boundary displacement definition. */ DAMPER_BOUNDARY = 41, /*!< \brief Damper. */ + EMPTY_BOUNDARY = 42, /*!< \brief Empty boundary for dummy faces. */ CHT_WALL_INTERFACE = 50, /*!< \brief Domain interface definition. */ SMOLUCHOWSKI_MAXWELL = 55, /*!< \brief Smoluchoski/Maxwell wall boundary condition. */ SEND_RECEIVE = 99, /*!< \brief Boundary send-receive definition. */ @@ -1405,10 +1458,13 @@ static const MapType Inlet_Map = { enum OUTLET_TYPE { PRESSURE_OUTLET = 1, /*!< \brief Gauge pressure outlet for incompressible flow */ MASS_FLOW_OUTLET = 2, /*!< \brief Mass flow outlet for incompressible flow. */ + OPEN = 3 /*!< \brief Inlet-Outlet type. */ }; + static const MapType Outlet_Map = { MakePair("PRESSURE_OUTLET", PRESSURE_OUTLET) MakePair("MASS_FLOW_OUTLET", MASS_FLOW_OUTLET) + MakePair("OPEN", OPEN) }; /*! @@ -2145,7 +2201,8 @@ enum PERIODIC_QUANTITIES { PERIODIC_LIM_PRIM_2 = 14, /*!< \brief Primitive limiter communication phase 2 of 2 (periodic only). */ PERIODIC_IMPLICIT = 15, /*!< \brief Implicit update communication to ensure consistency across periodic boundaries. */ PERIODIC_SOL_ULS = 16, /*!< \brief Solution gradient communication for unwieghted Least Squares (periodic only). */ - PERIODIC_PRIM_ULS = 17 /*!< \brief Primitive gradient communication for unweighted Least Squares (periodic only). */ + PERIODIC_PRIM_ULS = 17, /*!< \brief Primitive gradient communication for unweighted Least Squares (periodic only). */ + PERIODIC_PRESSURE = 18, /*!< \brief Corrected pressure communication . */ }; /*! @@ -2180,8 +2237,11 @@ enum MPI_QUANTITIES { SOLUTION_FEA_OLD = 26, /*!< \brief FEA solution old communication. */ MESH_DISPLACEMENTS = 27, /*!< \brief Mesh displacements at the interface. */ SOLUTION_TIME_N = 28, /*!< \brief Solution at time n. */ - SOLUTION_TIME_N1 = 29, /*!< \brief Solution at time n-1. */ - PRIMITIVE = 30 /*!< \brief Primitive solution communication. */ + SOLUTION_TIME_N1 = 29, /*!< \brief Solution at time n-1. */ + PRIMITIVE = 30, /*!< \brief Primitive solution communication. */ + MASS_FLUX = 31, /*!< \brief Mass flux in a CV communication. */ + MOM_COEFF = 32, /*!< \brief Momentum eq coefficient communication. */ + PRESSURE_VAR = 33 /*!< \brief Primitive variable communication. */ }; /*! diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 0878221557c8..5a838aa660c9 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -823,7 +823,7 @@ void CConfig::SetPointersNull(void) { Marker_Load = nullptr; Marker_Disp_Dir = nullptr; Marker_RoughWall = nullptr; Marker_EngineExhaust = nullptr; Marker_Displacement = nullptr; Marker_Load = nullptr; Marker_Load_Dir = nullptr; Marker_Load_Sine = nullptr; Marker_Clamped = nullptr; - Marker_FlowLoad = nullptr; Marker_Internal = nullptr; + Marker_FlowLoad = nullptr; Marker_Internal = nullptr; Marker_Empty = nullptr; Marker_All_TagBound = nullptr; Marker_CfgFile_TagBound = nullptr; Marker_All_KindBC = nullptr; Marker_CfgFile_KindBC = nullptr; Marker_All_SendRecv = nullptr; Marker_All_PerBound = nullptr; Marker_ZoneInterface = nullptr; Marker_All_ZoneInterface= nullptr; Marker_Riemann = nullptr; @@ -1089,11 +1089,14 @@ void CConfig::SetConfig_Options() { addEnumOption("MULTIZONE_SOLVER", Kind_MZSolver, Multizone_Map, MZ_BLOCK_GAUSS_SEIDEL); /*!\brief MATH_PROBLEM \n DESCRIPTION: Mathematical problem \n Options: DIRECT, ADJOINT \ingroup Config*/ addMathProblemOption("MATH_PROBLEM", ContinuousAdjoint, false, DiscreteAdjoint, false, Restart_Flow, false); + /*!\brief KIND_INCOMP_SYSTEM \n DESCRIPTION: Incomp Type \n OPTIONS: see \link Incomp_Map \endlink \ingroup Config*/ + addEnumOption("KIND_INCOMP_SYSTEM", Kind_Incomp_System, Incomp_Map, DENSITY_BASED); + /*!\brief KIND_PB_ITER \n DESCRIPTION: Kind_PBIter \n OPTIONS: see \link PBIter_Map \endlink \ingroup Config*/ + addEnumOption("KIND_PB_ITER", Kind_PBIter, PBIter_Map, SIMPLE); /*!\brief KIND_TURB_MODEL \n DESCRIPTION: Specify turbulence model \n Options: see \link Turb_Model_Map \endlink \n DEFAULT: NO_TURB_MODEL \ingroup Config*/ addEnumOption("KIND_TURB_MODEL", Kind_Turb_Model, Turb_Model_Map, NO_TURB_MODEL); /*!\brief KIND_TRANS_MODEL \n DESCRIPTION: Specify transition model OPTIONS: see \link Trans_Model_Map \endlink \n DEFAULT: NO_TRANS_MODEL \ingroup Config*/ - addEnumOption("KIND_TRANS_MODEL", Kind_Trans_Model, Trans_Model_Map, NO_TRANS_MODEL); - + addEnumOption("KIND_TRANS_MODEL", Kind_Trans_Model, Trans_Model_Map, NO_TRANS_MODEL); /*!\brief KIND_SGS_MODEL \n DESCRIPTION: Specify subgrid scale model OPTIONS: see \link SGS_Model_Map \endlink \n DEFAULT: NO_SGS_MODEL \ingroup Config*/ addEnumOption("KIND_SGS_MODEL", Kind_SGS_Model, SGS_Model_Map, NO_SGS_MODEL); @@ -1287,7 +1290,7 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: */ addDoubleOption("FREESTREAM_INTERMITTENCY", Intermittency_FreeStream, 1.0); /* DESCRIPTION: */ - addDoubleOption("FREESTREAM_TURBULENCEINTENSITY", TurbulenceIntensity_FreeStream, 0.05); + addDoubleOption("FREESTREAM_TURBULENCEINTENSITY", TurbulenceIntensity_FreeStream, 0.0005); /* DESCRIPTION: */ addDoubleOption("FREESTREAM_NU_FACTOR", NuFactor_FreeStream, 3.0); /* DESCRIPTION: */ @@ -1355,6 +1358,11 @@ void CConfig::SetConfig_Options() { addDoubleOption("REF_VISCOSITY", Viscosity_Ref, -1.0); /* DESCRIPTION: Type of mesh motion */ addEnumOption("REF_DIMENSIONALIZATION", Ref_NonDim, NonDim_Map, DIMENSIONAL); + + default_prefcoord_location[0] = 0.5; default_prefcoord_location[1] = 0.5; default_prefcoord_location[2] = 0.5; + addDoubleArrayOption("PRESSURE_REF_COORD", 3, PRef_Coord, default_prefcoord_location); + + addDoubleOption("PRESSURE_REF", PRef_Value, 0.0); /*!\par CONFIG_CATEGORY: Boundary Markers \ingroup Config*/ /*--- Options related to various boundary markers ---*/ @@ -1392,6 +1400,8 @@ void CConfig::SetConfig_Options() { addStringListOption("MARKER_CHT_INTERFACE", nMarker_CHTInterface, Marker_CHTInterface); /* DESCRIPTION: Internal boundary marker(s) */ addStringListOption("MARKER_INTERNAL", nMarker_Internal, Marker_Internal); + /* DESCRIPTION: Internal boundary marker(s) */ + addStringListOption("MARKER_Empty", nMarker_Empty, Marker_Empty); /* DESCRIPTION: Custom boundary marker(s) */ addStringListOption("MARKER_CUSTOM", nMarker_Custom, Marker_Custom); /* DESCRIPTION: Periodic boundary marker(s) for use with SU2_MSH @@ -1670,6 +1680,8 @@ void CConfig::SetConfig_Options() { addEnumOption("TIME_DISCRE_HEAT", Kind_TimeIntScheme_Heat, Time_Int_Map, EULER_IMPLICIT); /* DESCRIPTION: Time discretization */ addEnumOption("TIMESTEP_HEAT", Kind_TimeStep_Heat, Heat_TimeStep_Map, MINIMUM); + /* DESCRIPTION: Time discretization */ + addEnumOption("TIME_DISCRE_POISSON", Kind_TimeIntScheme_Poisson, Time_Int_Map, EULER_IMPLICIT); /*!\par CONFIG_CATEGORY: Linear solver definition \ingroup Config*/ /*--- Options related to the linear solvers ---*/ @@ -1684,6 +1696,10 @@ void CConfig::SetConfig_Options() { addDoubleOption("LINEAR_SOLVER_ERROR", Linear_Solver_Error, 1E-6); /* DESCRIPTION: Maximum number of iterations of the linear solver for the implicit formulation */ addUnsignedLongOption("LINEAR_SOLVER_ITER", Linear_Solver_Iter, 10); + /* DESCRIPTION: Max iterations of the linear solver for the FVM flow solver in PB system. */ + addUnsignedLongOption("LINEAR_SOLVER_ITER_FLOW", Linear_Solver_Iter_Flow, 10); + /* DESCRIPTION: Max iterations of the linear solver for the poisson solver in PB system. */ + addUnsignedLongOption("LINEAR_SOLVER_ITER_POISSON", Linear_Solver_Iter_Poisson, 10); /* DESCRIPTION: Fill in level for the ILU preconditioner */ addUnsignedShortOption("LINEAR_SOLVER_ILU_FILL_IN", Linear_Solver_ILU_n, 0); /* DESCRIPTION: Maximum number of iterations of the linear solver for the implicit formulation */ @@ -1692,6 +1708,10 @@ void CConfig::SetConfig_Options() { addDoubleOption("LINEAR_SOLVER_SMOOTHER_RELAXATION", Linear_Solver_Smoother_Relaxation, 1.0); /* DESCRIPTION: Custom number of threads used for additive domain decomposition for ILU and LU_SGS (0 is "auto"). */ addUnsignedLongOption("LINEAR_SOLVER_PREC_THREADS", Linear_Solver_Prec_Threads, 0); + /* DESCRIPTION: Relaxation of the pressure based flow corrections */ + addDoubleOption("RELAXATION_FACTOR_PBFLOW", Relaxation_Factor_PBFlow, 0.5); + /* DESCRIPTION: Relaxation of the Rhie Chow interpolation contribution in pressure based flow. */ + addDoubleOption("RELAXATION_FACTOR_RHIECHOW", RCFactor, 0.0); /* DESCRIPTION: Relaxation factor for updates of adjoint variables. */ addDoubleOption("RELAXATION_FACTOR_ADJOINT", Relaxation_Factor_Adjoint, 1.0); /* DESCRIPTION: Relaxation of the CHT coupling */ @@ -4635,7 +4655,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ SU2_MPI::Error("Outlet types for incompressible problem improperly specified.\n Use INC_OUTLET_TYPE= PRESSURE_OUTLET or MASS_FLOW_OUTLET.\n Must list a type for each inlet marker, including duplicates, e.g.,\n INC_OUTLET_TYPE= PRESSURE_OUTLET PRESSURE_OUTLET MASS_FLOW_OUTLET", CURRENT_FUNCTION); } for (unsigned short iInlet = 0; iInlet < nInc_Outlet; iInlet++){ - if ((Kind_Inc_Outlet[iInlet] != PRESSURE_OUTLET) && (Kind_Inc_Outlet[iInlet] != MASS_FLOW_OUTLET)) { + if ((Kind_Inc_Outlet[iInlet] != PRESSURE_OUTLET) && (Kind_Inc_Outlet[iInlet] != MASS_FLOW_OUTLET) && (Kind_Inc_Outlet[iInlet] != OPEN)) { SU2_MPI::Error("Undefined incompressible outlet type. PRESSURE_OUTLET or MASS_FLOW_OUTLET possible.", CURRENT_FUNCTION); } } @@ -4643,9 +4663,9 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ /*--- Rotating frame is not yet supported with the incompressible solver. ---*/ - if ((Kind_Solver == INC_EULER || Kind_Solver == INC_NAVIER_STOKES || Kind_Solver == INC_RANS) && (Kind_GridMovement == ROTATING_FRAME)) { + /*if ((Kind_Solver == INC_EULER || Kind_Solver == INC_NAVIER_STOKES || Kind_Solver == INC_RANS) && (Kind_GridMovement == ROTATING_FRAME)) { SU2_MPI::Error("Support for rotating frame simulation not yet implemented for incompressible flows.", CURRENT_FUNCTION); - } + }*/ /*--- Assert that there are two markers being analyzed if the pressure drop objective function is selected. ---*/ @@ -5031,7 +5051,7 @@ void CConfig::SetMarkers(unsigned short val_software) { iMarker_Smoluchowski_Maxwell, iMarker_Isothermal,iMarker_HeatFlux, iMarker_EngineInflow, iMarker_EngineExhaust, iMarker_Damper, - iMarker_Displacement, iMarker_Load, iMarker_FlowLoad, iMarker_Internal, + iMarker_Displacement, iMarker_Load, iMarker_FlowLoad, iMarker_Internal, iMarker_Empty, iMarker_Monitoring, iMarker_Designing, iMarker_GeoEval, iMarker_Plotting, iMarker_Analyze, iMarker_DV, iMarker_Moving, iMarker_PyCustom, iMarker_Supersonic_Inlet, iMarker_Supersonic_Outlet, iMarker_Clamped, iMarker_ZoneInterface, iMarker_CHTInterface, iMarker_Load_Dir, iMarker_Disp_Dir, iMarker_Load_Sine, @@ -5053,7 +5073,7 @@ void CConfig::SetMarkers(unsigned short val_software) { nMarker_CHTInterface + nMarker_Inlet + nMarker_Riemann + nMarker_Smoluchowski_Maxwell + nMarker_Giles + nMarker_Outlet + nMarker_Isothermal + nMarker_HeatFlux + - nMarker_EngineInflow + nMarker_EngineExhaust + nMarker_Internal + + nMarker_EngineInflow + nMarker_EngineExhaust + nMarker_Internal + nMarker_Empty + nMarker_Supersonic_Inlet + nMarker_Supersonic_Outlet + nMarker_Displacement + nMarker_Load + nMarker_FlowLoad + nMarker_Custom + nMarker_Damper + nMarker_Fluid_Load + nMarker_Clamped + nMarker_Load_Sine + nMarker_Load_Dir + nMarker_Disp_Dir + @@ -5309,6 +5329,12 @@ void CConfig::SetMarkers(unsigned short val_software) { iMarker_CfgFile++; } + for (iMarker_Empty = 0; iMarker_Empty < nMarker_Empty; iMarker_Empty++) { + Marker_CfgFile_TagBound[iMarker_CfgFile] = Marker_Empty[iMarker_Empty]; + Marker_CfgFile_KindBC[iMarker_CfgFile] = EMPTY_BOUNDARY; + iMarker_CfgFile++; + } + for (iMarker_Custom = 0; iMarker_Custom < nMarker_Custom; iMarker_Custom++) { Marker_CfgFile_TagBound[iMarker_CfgFile] = Marker_Custom[iMarker_Custom]; Marker_CfgFile_KindBC[iMarker_CfgFile] = CUSTOM_BOUNDARY; @@ -5528,7 +5554,7 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) { iMarker_Deform_Mesh, iMarker_Fluid_Load, iMarker_Smoluchowski_Maxwell, iWall_Catalytic, iMarker_Giles, iMarker_Outlet, iMarker_Isothermal, iMarker_HeatFlux, iMarker_EngineInflow, iMarker_EngineExhaust, iMarker_Displacement, iMarker_Damper, - iMarker_Load, iMarker_FlowLoad, iMarker_Internal, iMarker_Monitoring, + iMarker_Load, iMarker_FlowLoad, iMarker_Internal, iMarker_Monitoring, iMarker_Empty, iMarker_Designing, iMarker_GeoEval, iMarker_Plotting, iMarker_Analyze, iMarker_DV, iDV_Value, iMarker_ZoneInterface, iMarker_PyCustom, iMarker_Load_Dir, iMarker_Disp_Dir, iMarker_Load_Sine, iMarker_Clamped, iMarker_Moving, iMarker_Supersonic_Inlet, iMarker_Supersonic_Outlet, iMarker_ActDiskInlet, @@ -6853,6 +6879,15 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) { BoundaryTable.PrintFooter(); } + if (nMarker_Empty != 0) { + BoundaryTable << "Empty boundary"; + for (iMarker_Empty = 0; iMarker_Empty < nMarker_Empty; iMarker_Empty++) { + BoundaryTable << Marker_Empty[iMarker_Empty]; + if (iMarker_Empty < nMarker_Empty-1) BoundaryTable << " "; + } + BoundaryTable.PrintFooter(); + } + if (nMarker_Inlet != 0) { BoundaryTable << "Inlet boundary"; for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) { @@ -7794,6 +7829,7 @@ CConfig::~CConfig(void) { delete[] Marker_Load_Sine; delete[] Marker_FlowLoad; delete[] Marker_Internal; + delete[] Marker_Empty; delete[] Marker_HeatFlux; delete[] Marker_Emissivity; @@ -8043,6 +8079,7 @@ unsigned short CConfig::GetContainerPosition(unsigned short val_eqsystem) { case RUNTIME_TURB_SYS: return TURB_SOL; case RUNTIME_TRANS_SYS: return TRANS_SOL; case RUNTIME_HEAT_SYS: return HEAT_SOL; + case RUNTIME_POISSON_SYS: return POISSON_SOL; case RUNTIME_FEA_SYS: return FEA_SOL; case RUNTIME_ADJPOT_SYS: return ADJFLOW_SOL; case RUNTIME_ADJFLOW_SYS: return ADJFLOW_SOL; @@ -8207,6 +8244,13 @@ void CConfig::SetGlobalParam(unsigned short val_solver, SetKind_TimeIntScheme(Kind_TimeIntScheme_Heat); } break; + + case POISSON_EQUATION: + if (val_system == RUNTIME_POISSON_SYS) { + SetKind_ConvNumScheme(NONE, NONE, NONE, NONE, NONE, NONE); + SetKind_TimeIntScheme(Kind_TimeIntScheme_Poisson); + } + break; case FEM_ELASTICITY: diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index 896111c1309a..c49fc777fa5d 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -11034,6 +11034,7 @@ void CPhysicalGeometry::Compute_Nacelle(CConfig *config, bool original_surface, } + std::unique_ptr CPhysicalGeometry::ComputeViscousWallADT(const CConfig *config) const{ /*--------------------------------------------------------------------------*/ diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index 53ba43715cae..cb9f983f6460 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -1017,8 +1017,104 @@ class CFluidDriver : public CDriver { void SetVertexTurbVar(unsigned short iMarker, unsigned long iVertex, unsigned short iDim, passivedouble val_tub_var); }; +//------------------------------------------------------------------------------------------------------------------------- +class CPBFluidDriver : public CDriver { +public: + + /*! + * \brief Constructor of the class. + * \param[in] confFile - Configuration file name. + * \param[in] val_nZone - Total number of zones. + * \param[in] val_nDim - Number of dimensions. + * \param[in] MPICommunicator - MPI communicator for SU2. + */ + CPBFluidDriver(char* confFile, + unsigned short val_nZone, + unsigned short val_nDim, + SU2_Comm MPICommunicator); + /*! + * \brief Destructor of the class. + */ + ~CPBFluidDriver(void); + + /*! + * \brief Run a single iteration of the physics within multiple zones. + */ + void Run(); + + /*! + * \brief Update the dual-time solution within multiple zones. + */ + void Update(); + + /*! + * \brief Reset the convergence flag (set to false) of the multizone solver. + */ + void ResetConvergence(); + + /*! + * \brief Perform a dynamic mesh deformation, included grid velocity computation and the update of the multigrid structure (multiple zone). + */ + void DynamicMeshUpdate(unsigned long ExtIter); + + /*! + * \brief Perform a static mesh deformation, without considering grid velocity (multiple zone). + */ + void StaticMeshUpdate(); + + /*! + * \brief Perform a mesh deformation as initial condition (multiple zone). + */ + void SetInitialMesh(); + + /*! + * \brief Process the boundary conditions and update the multigrid structure. + */ + void BoundaryConditionsUpdate(); + + /*! + * \brief Transfer data among different zones (multiple zone). + */ + void Transfer_Data(unsigned short donorZone, unsigned short targetZone); + + /*! + * \brief Set the total temperature of a vertex on a specified inlet marker. + * \param[in] iMarker - Marker identifier. + * \param[in] iVertex - Vertex identifier. + * \param[in] val_Ttotal - Value of the total (stagnation) temperature. + */ + void SetVertexTtotal(unsigned short iMarker, unsigned short iVertex, su2double val_Ttotal); + + /*! + * \brief Set the total pressure of a vertex on a specified inlet marker. + * \param[in] iMarker - Marker identifier. + * \param[in] iVertex - Vertex identifier. + * \param[in] val_Ptotal - Value of the total (stagnation) pressure. + */ + void SetVertexPtotal(unsigned short iMarker, unsigned short iVertex, su2double val_Ptotal); + + /*! + * \brief Set the flow direction of a vertex on a specified inlet marker. + * \param[in] iMarker - Marker identifier. + * \param[in] iVertex - Vertex identifier. + * \param[in] iDim - Index of the flow direction unit vector + * \param[in] val_FlowDir - Component of a unit vector representing the flow direction + */ + void SetVertexFlowDir(unsigned short iMarker, unsigned short iVertex, unsigned short iDim, su2double val_FlowDir); + + /*! + * \brief Set a turbulence variable on a specified inlet marker. + * \param[in] iMarker - Marker identifier. + * \param[in] iVertex - Vertex identifier. + * \param[in] iDim - Index of the turbulence variable (i.e. k is 0 in SST) + * \param[in] val_turb_var - Value of the turbulence variable to be used. + */ + void SetVertexTurbVar(unsigned short iMarker, unsigned short iVertex, unsigned short iDim, su2double val_tub_var); + +}; +//------------------------------------------------------------------------------------------------------------------------- /*! * \class CTurbomachineryDriver * \brief Class for driving an iteration for turbomachinery flow analysis. diff --git a/SU2_CFD/include/integration/CIntegration.hpp b/SU2_CFD/include/integration/CIntegration.hpp index 857a7a2936be..1faaffaac80c 100644 --- a/SU2_CFD/include/integration/CIntegration.hpp +++ b/SU2_CFD/include/integration/CIntegration.hpp @@ -176,4 +176,11 @@ class CIntegration { CNumerics ******numerics_container, CConfig **config, unsigned short RunTime_EqSystem, unsigned short iZone, unsigned short iInst) { }; + virtual void MultiGrid_CyclePB(CGeometry ****geometry, CSolver *****solver_container, CNumerics ******numerics_container, + CConfig **config, unsigned short iMesh, unsigned short mu, unsigned short RunTime_EqSystem, + unsigned short iZone, unsigned short iInst) { }; + + virtual void CurrentGridIteration(CGeometry ****geometry, CSolver *****solver_container, CNumerics ******numerics_container, + CConfig **config, unsigned short iMesh, unsigned short RunTime_EqSystem, + unsigned short iZone, unsigned short iInst) {}; }; diff --git a/SU2_CFD/include/integration/CMultiGridIntegration.hpp b/SU2_CFD/include/integration/CMultiGridIntegration.hpp index 7a450cce6f70..9c37077e2e5a 100644 --- a/SU2_CFD/include/integration/CMultiGridIntegration.hpp +++ b/SU2_CFD/include/integration/CMultiGridIntegration.hpp @@ -51,7 +51,11 @@ class CMultiGridIntegration final : public CIntegration { void MultiGrid_Iteration(CGeometry ****geometry, CSolver *****solver_container, CNumerics ******numerics_container, CConfig **config, unsigned short RunTime_EqSystem, unsigned short iZone, unsigned short iInst) override; - + + void MultiGrid_CyclePB(CGeometry ****geometry, CSolver *****solver_container, CNumerics ******numerics_container, + CConfig **config, unsigned short iMesh, unsigned short mu, unsigned short RunTime_EqSystem, + unsigned short iZone, unsigned short iInst) override; + private: /*! * \brief Perform a Full-Approximation Storage (FAS) Multigrid. @@ -69,6 +73,11 @@ class CMultiGridIntegration final : public CIntegration { unsigned short iMesh, unsigned short mu, unsigned short RunTime_EqSystem, unsigned short iZone, unsigned short iInst); + + void CurrentGridIteration(CGeometry ****geometry, CSolver *****solver_container, CNumerics ******numerics_container, + CConfig **config, unsigned short iMesh, unsigned short RunTime_EqSystem, + unsigned short iZone, unsigned short iInst); + /*! * \brief Compute the forcing term. * \param[in] sol_fine - Pointer to the solution on the fine grid. diff --git a/SU2_CFD/include/iteration/CPBFluidIteration.hpp b/SU2_CFD/include/iteration/CPBFluidIteration.hpp new file mode 100644 index 000000000000..fe9b6b69d934 --- /dev/null +++ b/SU2_CFD/include/iteration/CPBFluidIteration.hpp @@ -0,0 +1,74 @@ +/*! + * \file CIteration.hpp + * \brief Headers of the iteration classes used by SU2_CFD. + * Each CIteration class represents an available physics package. + * \author F. Palacios, T. Economon + * \version 7.0.6 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CFluidIteration.hpp" + +/*! + * \class CFluidIteration + * \brief Class for driving an iteration of the fluid system. + * \author T. Economon + */ +class CPBFluidIteration : public CFluidIteration { +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CPBFluidIteration(const CConfig *config) ; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] ??? - Description here. + */ + void Preprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver, + CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, + CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone, + unsigned short val_iInst) final; + + /*! + * \brief Perform a single iteration of the fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration_container - Container vector with all the integration methods. + * \param[in] geometry_container - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics_container - Description of the numerical method (the way in which the equations are solved). + * \param[in] config_container - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Iterate(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver, + CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement, + CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone, + unsigned short val_iInst) final; + +}; + diff --git a/SU2_CFD/include/iteration_structure.hpp b/SU2_CFD/include/iteration_structure.hpp new file mode 100644 index 000000000000..a58b13a52afb --- /dev/null +++ b/SU2_CFD/include/iteration_structure.hpp @@ -0,0 +1,1921 @@ +/*! + * \file iteration_structure.hpp + * \brief Headers of the iteration classes used by SU2_CFD. + * Each CIteration class represents an available physics package. + * \author F. Palacios, T. Economon + * \version 7.0.4 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "../../Common/include/mpi_structure.hpp" +#include "../../Common/include/geometry/CGeometry.hpp" +#include "../../Common/include/grid_movement_structure.hpp" +#include "output/COutput.hpp" +#include "../../Common/include/CConfig.hpp" +#include "../include/integration/CIntegration.hpp" + +using namespace std; + +/*! + * \class CIteration + * \brief Parent class for defining a single iteration of a physics problem. + * \author T. Economon + */ +class CIteration { +protected: + int rank, /*!< \brief MPI Rank. */ + size; /*!< \brief MPI Size. */ + unsigned short nZone; /*!< \brief Total number of zones in the problem. */ + unsigned short nInst; /*!< \brief Total number of instances in the problem. */ + + bool multizone, /*!< \brief Flag for multizone problems. */ + singlezone; /*!< \brief Flag for singlezone problems. */ + + su2double StartTime, /*!< \brief Tracking wall time. */ + StopTime, + UsedTime; + +public: + + /*! + * \brief Constructor of the class. + */ + CIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CIteration(void); + + /*! + * \brief Updates the positions and grid velocities for dynamic meshes between physical time steps. + * \author T. Economon + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] IntIter - Current sudo time iteration number. + * \param[in] ExtIter - Current physical time iteration number. + */ + virtual void SetGrid_Movement(CGeometry **geometry, CSurfaceMovement *surface_movement, + CVolumetricMovement *grid_movement, + CSolver ***solver, CConfig *config, unsigned long IntIter, unsigned long TimeIter); + /*! + * \brief Run the mesh deformation algorithms. + * \author R. Sanchez + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] kind_recording - Current kind of recording. + */ + void SetMesh_Deformation(CGeometry **geometry, + CSolver **solver_container, + CNumerics ***numerics_container, + CConfig *config_container, + unsigned short kind_recording); + + /*! + * \brief A virtual member. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + virtual void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + virtual void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + virtual void Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + virtual void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + virtual void Predictor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + virtual void Relaxation(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] ??? - Description here. + */ + virtual bool Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] ??? - Description here. + */ + void Output(COutput *output, + CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned long InnerIter, + bool StopCalc, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief A virtual member. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + virtual void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + virtual void InitializeAdjoint(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short iZone, + unsigned short iInst){} + + virtual void RegisterInput(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + unsigned short iZone, + unsigned short iInst, + unsigned short kind_recording){} + + virtual void SetDependencies(CSolver *****solver, + CGeometry ****geometry, + CNumerics ******numerics, + CConfig **config, + unsigned short iZone, + unsigned short iInst, + unsigned short kind_recording){} + + virtual void RegisterOutput(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + COutput* output, + unsigned short iZone, + unsigned short iInst){} + + virtual void LoadUnsteady_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter){} + + virtual void LoadDynamic_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter){} + + virtual void SetRecording(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording) { } + +}; + + +/*! + * \class CFluidIteration + * \brief Class for driving an iteration of the fluid system. + * \author T. Economon + */ +class CFluidIteration : public CIteration { +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CFluidIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CFluidIteration(void) override; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] ??? - Description here. + */ + void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Perform a single iteration of the fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Iterate the fluid system for a number of Inner_Iter iterations. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Updates the containers for the fluid system. + * \param[in] ??? - Description here. + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Monitors the convergence and other metrics for the fluid system. + * \param[in] ??? - Description here. + */ + bool Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Postprocesses the fluid system before heading to another physics system or the next iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Imposes a gust via the grid velocities. + * \author S. Padron + * \param[in] config - Definition of the particular problem. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + */ + void SetWind_GustField(CConfig *config, CGeometry **geometry, CSolver ***solver); + + /*! + * \brief Reads and initializes the vortex positions, strengths and gradient. + * \author S. Padron + * \param[in] nVortex - number of vortices. + * \param[in] x0 - Vector of x-loc of the vortices. + * \param[in] y0 - Vector of y-loc of the vortices. + * \param[in] vort_strength - Vector of vortex strengths. + * \param[in] r_core - Vector of vortex core size. + */ + void InitializeVortexDistribution(unsigned long &nVortex, vector& x0, vector& y0, vector& vort_strength, vector& r_core); + + + /*! + * \brief Fixed CL monitoring function + * \author J. Mukhopadhaya + * \param[in] output - Pointer to the COutput class. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Pointer to the flow solver + * \param[in] config - Definition of the particular problem. + * \return Boolean indicating weather calculation should be stopped + */ + bool MonitorFixed_CL(COutput *output, CGeometry *geometry, CSolver **solver, CConfig *config); +}; + +/*! + * \class CFluidIteration + * \brief Class for driving an iteration of the fluid system. + * \author T. Economon + */ +class CPBFluidIteration : public CFluidIteration { +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CPBFluidIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CPBFluidIteration(void); + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] ??? - Description here. + */ + void Preprocess(COutput *output, + CIntegration ****integration_container, + CGeometry ****geometry_container, + CSolver *****solver_container, + CNumerics ******numerics_container, + CConfig **config_container, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief Perform a single iteration of the fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration_container - Container vector with all the integration methods. + * \param[in] geometry_container - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics_container - Description of the numerical method (the way in which the equations are solved). + * \param[in] config_container - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Iterate(COutput *output, + CIntegration ****integration_container, + CGeometry ****geometry_container, + CSolver *****solver_container, + CNumerics ******numerics_container, + CConfig **config_container, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); + + /*! + * \brief Postprocesses the fluid system before heading to another physics system or the next iteration. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] geometry_container - Geometrical definition of the problem. + * \param[in] config_container - Definition of the particular problem. + */ + void Postprocess(COutput *output, + CIntegration ****integration_container, + CGeometry ****geometry_container, + CSolver *****solver_container, + CNumerics ******numerics_container, + CConfig **config_container, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst); +}; + +/*! + * \class CTurboIteration + * \brief Class for driving an iteration for turbomachinery simulation. + * \author T. Economon + */ +class CTurboIteration : public CFluidIteration { +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CTurboIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CTurboIteration(void) override; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] ??? - Description here. + */ + void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Postprocesses the fluid system before heading to another physics system or the next iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + +}; + +/*! + * \class CFEMFluidIteration + * \brief Class for driving an iteration of the finite element flow system. + * \author T. Economon, E. van der Weide + * \version 7.0.4 "Blackbird" + */ +class CFEMFluidIteration : public CFluidIteration { +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CFEMFluidIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CFEMFluidIteration(void) override; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + /*! + * \brief Perform a single iteration of the finite element flow system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Updates the containers for the finite element flow system. + * \param[in] ??? - Description here. + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Postprocess routine for the finite element flow system. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; +}; + +/*! + * \class CHeatIteration + * \brief Class for driving an iteration of the heat system. + * \author T. Economon + */ +class CHeatIteration : public CFluidIteration { + +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CHeatIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CHeatIteration(void) override; + + /*! + * \brief Perform a single iteration of the heat system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Iterate the heat system for a number of Inner_Iter iterations. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Updates the containers for the heat system. + * \param[in] ??? - Description here. + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; +}; + +/*! + * \class CFEAIteration + * \brief Class for driving an iteration of structural analysis. + * \author R. Sanchez + * \version 7.0.4 "Blackbird" + */ +class CFEAIteration : public CIteration { +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CFEAIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CFEAIteration(void) override; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] ??? - Description here. + */ + void Preprocess(); + using CIteration::Preprocess; + + + /*! + * \brief Perform a single iteration for structural analysis using the Finite Element Method. + * \author R. Sanchez. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Iterate the structural system for a number of Inner_Iter iterations. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - zone of the problem. + */ + void Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Updates the containers for the FEM system. + * \param[in] ??? - Description here. + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Predictor. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Predictor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Relaxation. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Relaxation(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Monitors the convergence and other metrics for the FEM system. + * \param[in] ??? - Description here. + */ + bool Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Postprocess ???. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + +}; + +/*! + * \class CAdjFluidIteration + * \brief Class for driving an iteration of the adjoint fluid system. + * \author T. Economon + */ +class CAdjFluidIteration : public CFluidIteration { +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CAdjFluidIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CAdjFluidIteration(void) override; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] ??? - Description here. + */ + void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Perform a single iteration of the adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Updates the containers for the adjoint fluid system. + * \param[in] ??? - Description here. + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + + +}; + +/*! + * \class CDiscAdjFluidIteration + * \brief Class for driving an iteration of the discrete adjoint fluid system. + * \author T. Economon + */ +class CDiscAdjFluidIteration : public CIteration { + +private: + + CFluidIteration* meanflow_iteration; /*!< \brief Pointer to the mean flow iteration class. */ + unsigned short CurrentRecording; /*!< \brief Stores the current status of the recording. */ + bool turbulent; /*!< \brief Stores the turbulent flag. */ + +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CDiscAdjFluidIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CDiscAdjFluidIteration(void) override; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \brief Perform a single iteration of the adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance + */ + void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Perform a single iteration of the adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + + /*! + * \brief Updates the containers for the discrete adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Monitors the convergence and other metrics for the discrete adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance + */ + bool Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Postprocess the discrete adjoint fluid iteration. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + */ + void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Registers all input variables of the fluid iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] iInst - Index of the instance. + */ + void InitializeAdjoint(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + unsigned short iZone, + unsigned short iInst) override; + + /*! + * \brief Registers all output variables of the fluid iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] iInst - Index of the instance. + * \param[in] kind_recording - Kind of recording, either FLOW_SOLUTION_VARIABLES or MESH_COORDS + */ + void RegisterInput(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + unsigned short iZone, + unsigned short iInst, + unsigned short kind_recording) override; + + /*! + * \brief Initializes the adjoints of the output variables of the fluid iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] iInst - Index of the instance. + */ + void RegisterOutput(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + COutput* output, + unsigned short iZone, + unsigned short iInst) override; + + /*! + * \brief Record a single iteration of the direct mean flow system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + * \param[in] kind_recording - The kind of recording (geometry or flow). + */ + void SetRecording(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording); + + /*! + * \brief Record a single iteration of the direct mean flow system. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + * \param[in] kind_recording - The kind of recording (geometry or flow). + */ + + void SetRecording(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording) override; + + /*! + * \brief Compute necessary variables that depend on the conservative variables or the mesh node positions + * (e.g. turbulent variables, normals, volumes). + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] iInst - Index of the zone. + * \param[in] kind_recording - The kind of recording (geometry or flow). + */ + void SetDependencies(CSolver *****solver, + CGeometry ****geometry, + CNumerics ******numerics, + CConfig **config, + unsigned short iZone, + unsigned short iInst, + unsigned short kind_recording) override; + + /*! + * \brief load unsteady solution for unsteady problems + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + * \param[in] val_DirectIter - Direct iteration to load. + */ + void LoadUnsteady_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter) override; + + + +}; + +/*! + * \class CDiscAdjFEAIteration + * \brief Class for driving an iteration of the discrete adjoint FEM system. + * \author R. Sanchez + */ +class CDiscAdjFEAIteration : public CIteration { + +private: + + CFEAIteration* fem_iteration; /*!< \brief Pointer to the primal iteration class. */ + unsigned short CurrentRecording; /*!< \brief Stores the current status of the recording. */ + + +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CDiscAdjFEAIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CDiscAdjFEAIteration(void) override; + + /*! + * \brief Preprocessing to prepare for an iteration of the physics. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + */ + void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Perform a single iteration of the adjoint mean flow system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Updates the containers for the discrete adjoint mean flow system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Monitors the convergence and other metrics for the discrete adjoint mean flow system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + */ + bool Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Postprocesses the discrete adjoint mean flow system before heading to another physics system or the next iteration. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + */ + void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Registers all input variables of the FEM iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] kind_recording - Kind of recording, either FEM_VARIABLES or MESH_COORDS + */ + void RegisterInput(CSolver *****solver, CGeometry ****geometry, CConfig** config, unsigned short iZone, unsigned short iInst, unsigned short kind_recording) override; + + /*! + * \brief Registers all output variables of the FEM iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] iInst - Index of the zone. + */ + void RegisterOutput(CSolver *****solver, CGeometry ****geometry, CConfig** config, unsigned short iZone, unsigned short iInst); + using CIteration::RegisterOutput; + + /*! + * \brief Initializes the adjoints of the output variables of the FEM iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] iInst - Index of the zone. + */ + void InitializeAdjoint(CSolver *****solver, CGeometry ****geometry, CConfig** config, unsigned short iZone, unsigned short iInst) override; + + /*! + * \brief Record a single iteration of the direct FEM system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + * \param[in] kind_recording - The kind of recording (geometry or flow). + */ + void SetRecording(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording); + + /*! + * \brief Record a single iteration of the direct FEM system. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + * \param[in] kind_recording - The kind of recording (geometry or flow). + */ + + void SetRecording(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording) override; + + /*! + * \brief Compute necessary variables that depend on the variables in the numerics (E, Nu...) + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] iInst - Index of the zone. + * \param[in] kind_recording - The kind of recording (geometry or flow). + */ + void SetDependencies(CSolver *****solver, + CGeometry ****geometry, + CNumerics ******numerics, + CConfig **config, + unsigned short iZone, + unsigned short iInst, + unsigned short kind_recording) override; + + /*! + * \brief load solution for dynamic problems + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance. + * \param[in] val_DirectIter - Direct iteration to load. + */ + void LoadDynamic_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter) override; + +}; + +/*! + * \class CDiscAdjHeatIteration + * \brief Class for driving an iteration of the discrete adjoint heat equation. + * \author O. Burghardt + */ +class CDiscAdjHeatIteration : public CIteration { + +private: + + CHeatIteration* mean_iteration; /*!< \brief Pointer to the mean flow iteration class. */ + unsigned short CurrentRecording; /*!< \brief Stores the current status of the recording. */ + +public: + + /*! + * \brief Constructor of the class. + * \param[in] config - Definition of the particular problem. + */ + CDiscAdjHeatIteration(CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CDiscAdjHeatIteration(void) override; + + /*! + * \brief Perform a single iteration of the adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + */ + void Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Perform a single iteration of the adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + */ + void Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Perform a single iteration of the adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + */ + void Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, unsigned short val_iInst) override; + + /*! + * \brief Monitors the convergence and other metrics for the discrete adjoint fluid system. + */ + bool Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) override; + + /*! + * \brief Outputs desired files and quantities for the discrete adjoint fluid system. + */ + void Output(COutput *output, + CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned long InnerIter, + bool StopCalc, + unsigned short val_iZone, + unsigned short val_iInst); + + + /*! + * \brief Perform a single iteration of the adjoint fluid system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + */ + void Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, unsigned short val_iInst) override; + + /*! + * \brief Registers all input variables of the fluid iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + */ + void InitializeAdjoint(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + unsigned short iZone, unsigned short iInst) override; + + /*! + * \brief Registers all output variables of the fluid iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + * \param[in] kind_recording - Kind of recording. + */ + void RegisterInput(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + unsigned short iZone, unsigned short iInst, + unsigned short kind_recording) override; + + /*! + * \brief Initializes the adjoints of the output variables of the fluid iteration. + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + */ + void RegisterOutput(CSolver *****solver, + CGeometry ****geometry, + CConfig** config, + COutput* output, + unsigned short iZone, unsigned short iInst) override; + + /*! + * \brief Record a single iteration of the direct heat system. + * \param[in] output - Pointer to the COutput class. + * \param[in] integration - Container vector with all the integration methods. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] surface_movement - Surface movement classes of the problem. + * \param[in] grid_movement - Volume grid movement classes of the problem. + * \param[in] FFDBox - FFD FFDBoxes of the problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] kind_recording - The kind of recording. + */ + void SetRecording(COutput *output, + CIntegration ***integration, + CGeometry ***geometry, + CSolver ****solver, + CNumerics *****numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short kind_recording); + + /*! + * \brief Record a single iteration of the direct heat system. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iZone - Index of the instance. + * \param[in] kind_recording - The kind of recording (geometry or flow). + */ + + void SetRecording(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording) override { } + + /*! + * \brief Compute necessary variables that depend on the conservative variables or the mesh node positions + * (e.g. turbulent variables, normals, volumes). + * \param[in] solver - Container vector with all the solutions. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + * \param[in] kind_recording - The kind of recording. + */ + void SetDependencies(CSolver *****solver, + CGeometry ****geometry, + CNumerics ******numerics, + CConfig **config, + unsigned short iZone, unsigned short iInst, + unsigned short kind_recording) override; + + /*! + * \brief load unsteady solution for unsteady problems + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iZone - Index of the zone. + * \param[in] val_iInst - Index of the instance layer. + * \param[in] val_DirectIter - Direct iteration to load. + */ + void LoadUnsteady_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter) override; +}; diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index 37eff768daa2..53701655cb24 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -183,6 +183,10 @@ class CNumerics { su2double *AuxVar_Grad_i, /*!< \brief Gradient of an auxiliary variable at point i. */ *AuxVar_Grad_j; /*!< \brief Gradient of an auxiliary variable at point i. */ + su2double Poisson_Coeff_i, /*!< \brief Poisson coefficient at point i. */ + Poisson_Coeff_j; /*!< \brief Poisson coefficient at point j. */ + su2double Poissonval_i, /*!< \brief Temperature at point i. */ + Poissonval_j; /*!< \brief Temperature at point j. */ const su2double *RadVar_Source; /*!< \brief Source term from the radiative heat transfer equation. */ su2double *Coord_i, /*!< \brief Cartesians coordinates of point i. */ @@ -210,9 +214,9 @@ class CNumerics { su2double StrainMag_i, StrainMag_j; /*!< \brief Strain rate magnitude. */ su2double Dissipation_i, Dissipation_j; /*!< \brief Dissipation. */ su2double Dissipation_ij; + su2double Source_Term; su2double roughness_i = 0.0, /*!< \brief Roughness of the wall nearest to point i. */ roughness_j = 0.0; /*!< \brief Roughness of the wall nearest to point j. */ - su2double *l, *m; su2double **MeanReynoldsStress; /*!< \brief Mean Reynolds stress tensor */ @@ -224,6 +228,7 @@ class CNumerics { su2double uq_delta_b; /*!< \brief Magnitude of perturbation */ su2double uq_urlx; /*!< \brief Under-relaxation factor for numerical stability */ bool uq_permute; /*!< \brief Flag for eigenvector permutation */ + su2double Face_Flux; /* Supporting data structures for the eigenspace perturbation for UQ methodology */ su2double **A_ij, **newA_ij, **Eig_Vec, **New_Eig_Vec, **Corners; @@ -480,6 +485,13 @@ class CNumerics { */ virtual void SetCrossDiff(su2double val_CDkw_i, su2double val_CDkw_j) {/* empty */}; + /*! + * \brief Set the value of the effective intermittency for a turbulence model. + * \param[in] val_gammaEff_i - Value of the effective intermittency at point i. + * \param[in] val_gammaEff_j - Value of the effective intermittency at point j. + */ + virtual void SetGammaEff(su2double val_gammaEff_i, su2double val_gammaEff_j) {/* empty */}; + /*! * \brief Set the gradient of the auxiliary variables. * \param[in] val_auxvargrad_i - Gradient of the auxiliary variable at point i. @@ -756,6 +768,46 @@ class CNumerics { */ inline su2double GetDissipation() const { return Dissipation_ij; } + /*! + * \brief Set the Poisson coefficient + * \param[in] val_Poisson_i - Value of the Poisson coefficient at point i. + * \param[in] val_Poisson_j - Value of the Poisson coefficient at point j. + */ + inline void SetPoisson_Coeff(su2double val_Poisson_Coeff_i,su2double val_Poisson_Coeff_j){ + Poisson_Coeff_i = val_Poisson_Coeff_i; + Poisson_Coeff_j = val_Poisson_Coeff_j; + } + + /*! + * \brief Set the Poisson value + * \param[in] val_Poisson_i - Value of the Poisson variable at point i. + * \param[in] val_Poisson_j - Value of the Poisson variable at point j. + */ + inline void SetPoissonval(su2double val_Poisson_i,su2double val_Poisson_j){ + Poissonval_i = val_Poisson_i; + Poissonval_j = val_Poisson_j; + } + + /*! + * \brief Set the Poisson value + * \param[in] val_Poisson_i - Value of the Poisson variable at point i. + * \param[in] val_Poisson_j - Value of the Poisson variable at point j. + */ + inline void SetSourcePoisson(su2double val_Source_Term) { Source_Term = val_Source_Term; } + + /*! + * \brief Set the value of the momentum equation coefficients for Poisson eq. + * \param[in] val_Mom_Coeff_i - Value of the cross coefficient at point i. + * \param[in] val_Mom_Coeff_j - Value of the cross coefficient at point j. + */ + inline virtual void SetInvMomCoeff(su2double *val_Mom_Coeff_i, su2double *val_Mom_Coeff_j) { } ; + + /*! + * \brief Set the value of the velocity at a given edge. + * \param[in] val_FaceVel - Velocity at the face. + */ + inline virtual void SetFaceVel(su2double val_FaceVel) { }; + /*! * \brief Get the inviscid fluxes. * \param[in] val_density - Value of the density. @@ -840,6 +892,21 @@ class CNumerics { su2double val_scale, su2double **val_Proj_Jac_Tensor) const; + /*! + * \brief Compute the projected inviscid flux vector for incompresible simulations + * \param[in] val_density - Pointer to the density. + * \param[in] val_velocity - Pointer to the velocity. + * \param[in] val_pressure - Pointer to the pressure. + * \param[in] val_betainc2 - Value of the artificial compresibility factor. + * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. + * \param[out] val_Proj_Flux - Pointer to the projected flux. + */ + void GetInviscidPBProjFlux(const su2double *val_density, + const su2double *val_velocity, + const su2double *val_pressure, + const su2double *val_normal, + su2double *val_Proj_Flux); + /*! * \brief Compute the low speed preconditioning matrix. * \param[in] val_density - Value of the density. @@ -885,6 +952,21 @@ class CNumerics { const su2double *val_normal, su2double val_scale, su2double **val_Proj_Jac_tensor) const; + /*! + * \brief Compute the projection of the inviscid Jacobian matrices (Pressure based method). + * \param[in] val_density - Value of the density. + * \param[in] val_velocity - Pointer to the velocity. + * \param[in] val_cp - Value of the specific heat at constant pressure. + * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. + * \param[in] val_scale - Scale of the projection. + * \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian. + */ + + + void GetInviscidPBProjJac(const su2double val_density, const su2double *val_velocity, + const su2double *val_normal, const su2double val_scale, + su2double **val_Proj_Jac_tensor); + /*! * \brief Mapping between primitives variables P and conservatives variables C. * \param[in] val_Mean_PrimVar - Mean value of the primitive variables. @@ -1380,6 +1462,40 @@ class CNumerics { * \param[in] n: order of matrix V */ static void tql2(su2double **V, su2double *d, su2double *e, unsigned short n); + + /*! + * \brief Compute the projection of the viscous Jacobian matrices. + * \param[in] val_laminar_viscosity - Value of the laminar viscosity. + * \param[in] val_eddy_viscosity - Value of the eddy viscosity. + * \param[in] val_dist_ij - Distance between the points. + * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. + * \param[in] val_dS - Area of the face between two nodes. + * \param[out] val_Proj_Jac_Tensor_i - Pointer to the projected viscous Jacobian at point i. + * \param[out] val_Proj_Jac_Tensor_j - Pointer to the projected viscous Jacobian at point j. + */ + + void GetViscousPBIncProjJacs(const su2double val_laminar_viscosity, + const su2double val_eddy_viscosity, + const su2double val_dist_ij, + const su2double *val_normal, + const su2double val_dS, + su2double **val_Proj_Jac_Tensor_i, + su2double **val_Proj_Jac_Tensor_j); + /*! + * \brief Compute the projection of the viscous fluxes into a direction (pressure based method). + * \param[in] val_primvar - Primitive variables. + * \param[in] val_gradprimvar - Gradient of the primitive variables. + * \param[in] val_normal - Normal vector, the norm of the vector is the area of the face. + * \param[in] val_laminar_viscosity - Laminar viscosity. + * \param[in] val_eddy_viscosity - Eddy viscosity. + */ + + void GetViscousPBIncProjFlux(const su2double *val_primvar, + su2double **val_gradprimvar, + const su2double *val_normal, + const su2double val_laminar_viscosity, + const su2double val_eddy_viscosity, + const su2double val_turb_ke); virtual inline void SetdPdU(su2double *val_dPdU_i, su2double *val_dPdU_j) { } diff --git a/SU2_CFD/include/numerics/pbflow.hpp b/SU2_CFD/include/numerics/pbflow.hpp new file mode 100644 index 000000000000..515fe2b96099 --- /dev/null +++ b/SU2_CFD/include/numerics/pbflow.hpp @@ -0,0 +1,232 @@ +/*! + * \file heat.hpp + * \brief Delarations of numerics classes for heat transfer problems. + * \author F. Palacios, T. Economon + * \version 7.0.2 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CNumerics.hpp" + +/*! + * \class CUpwPB_Flow + * \brief Class for solving an approximate Riemann solver of Roe for the pressure based incompressible flow equations. + * \ingroup ConvDiscr + * \author F. Palacios + */ +class CUpwPB_Flow : public CNumerics { +private: + bool implicit, dynamic_grid; + bool gravity; + su2double Froude, Upw_i, Upw_j; + su2double *Diff_U; + su2double *Velocity_i, *Velocity_j, *MeanVelocity, *Velocity_upw; + su2double *ProjFlux_i, *ProjFlux_j; + su2double Proj_ModJac_Tensor_ij, Pressure_i, + Pressure_j, MeanDensity, MeanSoundSpeed, MeanPressure, MeanBetaInc2, + ProjVelocity, FaceVel, Face_Flux; + unsigned short iDim, iVar, jVar, kVar; + + su2double *Flux = nullptr; + su2double **Jacobian_i = nullptr; + su2double **Jacobian_j = nullptr; + su2double **Jacobian_upw = nullptr; + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CUpwPB_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CUpwPB_Flow(void); + + /*! + * \brief Compute the Roe's flux between two nodes i and j. + * \param[out] val_residual - Pointer to the total residual. + * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig* config) override; + + /*! + * \brief Set the value of face velocity. This is used as a proxy for massflux at a face. + * \param[in] val_FaceVel. + */ + inline void SetFaceVel(su2double val_FaceVel){ FaceVel = val_FaceVel; } +}; + + +/*! + * \class CCentLaxArtComp_Flow + * \brief Class for computing the Lax-Friedrich centered scheme (artificial compressibility). + * \ingroup ConvDiscr + * \author F. Palacios + */ +class CCentPB_Flow : public CNumerics { +private: + bool implicit, dynamic_grid; + bool gravity; + su2double Froude, Upw_i, Upw_j; + su2double *Diff_U; + su2double *Velocity_i, *Velocity_j, *MeanVelocity, *Velocity_upw; + su2double *ProjFlux_i, *ProjFlux_j; + su2double *Lambda, *Epsilon; + su2double **P_Tensor, **invP_Tensor,**val_Jacobian_upw; + su2double Proj_ModJac_Tensor_ij, Pressure_i, + Pressure_j, MeanDensity, MeanSoundSpeed, MeanPressure, MeanBetaInc2, + ProjVelocity, FaceVel; + unsigned short iDim, iVar, jVar, kVar; + + su2double *Flux = nullptr; + su2double **Jacobian_i = nullptr; + su2double **Jacobian_j = nullptr; + su2double **Jacobian_upw = nullptr; + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimension of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CCentPB_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CCentPB_Flow(void); + + /*! + * \brief Compute the flow residual using a Lax method. + * \param[out] val_resconv - Pointer to the convective residual. + * \param[out] val_resvisc - Pointer to the artificial viscosity residual. + * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig* config) override; +}; + +/*! + * \class CAvgGradInc_Flow + * \brief Class for computing viscous term using an average of gradients. + * \ingroup ViscDiscr + * \author A. Bueno, F. Palacios, T. Economon + */ +class CAvgGradPBInc_Flow : public CNumerics { +private: + unsigned short iDim, iVar, jVar; /*!< \brief Iterators in dimension an variable. */ + su2double *Mean_PrimVar, /*!< \brief Mean primitive variables. */ + *PrimVar_i, *PrimVar_j; /*!< \brief Primitives variables at point i and j. */ + su2double **Mean_GradPrimVar, /*!< \brief Mean value of the gradient. */ + Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, /*!< \brief Mean value of the viscosity. */ + Mean_turb_ke, /*!< \brief Mean value of the turbulent kinetic energy. */ + dist_ij, /*!< \brief Length of the edge and face. */ + proj_vector_ij; /*!< \brief (Edge_Vector DOT normal)/|Edge_Vector|^2 */ + bool implicit; /*!< \brief Implicit calculus. */ + + su2double *Flux = nullptr; + su2double **Jacobian_i = nullptr; + su2double **Jacobian_j = nullptr; + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimension of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAvgGradPBInc_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CAvgGradPBInc_Flow(void); + /*! + * \brief Compute the viscous flow residual using an average of gradients. + * \param[out] val_residual - Pointer to the total residual. + * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig* config) override; +}; + + +/*! + * \class CAvgGradCorrectedPBInc_Flow + * \brief Class for computing viscous term using an average of gradients with correction (incompressible). + * \ingroup ViscDiscr + */ +class CAvgGradCorrectedPBInc_Flow : public CNumerics { +private: + unsigned short iDim, iVar, jVar; /*!< \brief Iterators in dimension an variable. */ + su2double *Mean_PrimVar; /*!< \brief Mean primitive variables. */ + su2double *PrimVar_i, *PrimVar_j, /*!< \brief Primitives variables at point i and 1. */ + *Edge_Vector, /*!< \brief Vector form point i to point j. */ + **Mean_GradPrimVar, *Proj_Mean_GradPrimVar_Edge, /*!< \brief Mean value of the gradient. */ + Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, /*!< \brief Mean value of the viscosity. */ + Mean_turb_ke, /*!< \brief Mean value of the turbulent kinetic energy. */ + dist_ij_2, /*!< \brief Length of the edge and face. */ + proj_vector_ij; /*!< \brief (Edge_Vector DOT normal)/|Edge_Vector|^2 */ + bool implicit; /*!< \brief Implicit calculus. */ + + su2double *Flux = nullptr; + su2double **Jacobian_i = nullptr; + su2double **Jacobian_j = nullptr; + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimension of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAvgGradCorrectedPBInc_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CAvgGradCorrectedPBInc_Flow(void); + + /*! + * \brief Compute the viscous flow residual using an average of gradients with correction. + * \param[out] val_residual - Pointer to the total residual. + * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig* config) override; +}; diff --git a/SU2_CFD/include/numerics/poisson.hpp b/SU2_CFD/include/numerics/poisson.hpp new file mode 100644 index 000000000000..45b19d924688 --- /dev/null +++ b/SU2_CFD/include/numerics/poisson.hpp @@ -0,0 +1,219 @@ +/*! + * \file heat.hpp + * \brief Delarations of numerics classes for heat transfer problems. + * \author F. Palacios, T. Economon + * \version 7.0.2 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CNumerics.hpp" + +/*! + * \class CAvgGrad_Poisson + * \brief Class for computing viscous term using average of gradients without correction (Poisson equation). + * \ingroup ViscDiscr + */ +class CAvgGrad_Poisson : public CNumerics { +private: + + su2double *Edge_Vector; + bool implicit,direct; + su2double **Mean_GradPoissonVar; + su2double *Mom_Coeff_i,*Mom_Coeff_j; + su2double *Proj_Mean_GradPoissonVar_Normal, *Proj_Mean_GradPoissonVar_Corrected; + su2double dist_ij_2, proj_vector_ij, Poisson_Coeff_Mean ; + unsigned short iVar, iDim; + + su2double *Flux = nullptr; + su2double **Jacobian_i = nullptr; + su2double **Jacobian_j = nullptr; + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAvgGrad_Poisson(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CAvgGrad_Poisson(void); + + /*! + * \brief Compute the viscous heat residual using an average of gradients with correction. + * \param[out] val_residual - Pointer to the total residual. + * \param[out] Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[out] Jacobian_j - Jacobian of the numerical method at node j (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig* config) override; + + + inline void SetInvMomCoeff(su2double *val_Mom_Coeff_i, su2double *val_Mom_Coeff_j) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Mom_Coeff_i[iDim] = val_Mom_Coeff_i[iDim]; + Mom_Coeff_j[iDim] = val_Mom_Coeff_j[iDim]; + } + } +}; + +/*! + * \class CAvgGradCorrected_Poisson + * \brief Class for computing viscous term using average of gradients with correction (Poisson equation). + * \ingroup ViscDiscr + */ + +class CAvgGradCorrected_Poisson : public CNumerics { +private: + + su2double *Edge_Vector; + bool implicit,direct; + su2double **Mean_GradPoissonVar; + su2double *Mom_Coeff_i,*Mom_Coeff_j; + su2double *Proj_Mean_GradPoissonVar_Kappa, *Proj_Mean_GradPoissonVar_Edge, *Proj_Mean_GradPoissonVar_Corrected; + su2double dist_ij_2, proj_vector_ij, Poisson_Coeff_Mean; + unsigned short iVar, iDim; + + su2double *Flux = nullptr; + su2double **Jacobian_i = nullptr; + su2double **Jacobian_j = nullptr; + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CAvgGradCorrected_Poisson(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CAvgGradCorrected_Poisson(void); + + /*! + * \brief Compute the viscous residual using an average of gradients with correction. + * \param[out] val_residual - Pointer to the total residual. + * \param[out] Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[out] Jacobian_j - Jacobian of the numerical method at node j (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig* config) override; + + + inline void SetInvMomCoeff(su2double *val_Mom_Coeff_i, su2double *val_Mom_Coeff_j) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Mom_Coeff_i[iDim] = val_Mom_Coeff_i[iDim]; + Mom_Coeff_j[iDim] = val_Mom_Coeff_j[iDim]; + } + } +}; + +/*! + * \class CAvgGrad_Poisson + * \brief Class for computing viscous term using average of gradients without correction (Poisson equation). + * \ingroup ViscDiscr + */ +class CPressure_Poisson : public CNumerics { +private: + + su2double *Edge_Vector; + bool implicit,direct; + su2double **Mean_GradPoissonVar; + su2double *Proj_Mean_GradPoissonVar_Kappa, *Proj_Mean_GradPoissonVar_Edge, *Proj_Mean_GradPoissonVar_Corrected; + su2double dist_ij_2, proj_vector_ij, Poisson_Coeff_Mean; + su2double *Mom_Coeff_i,*Mom_Coeff_j; + unsigned short iVar, iDim; + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CPressure_Poisson(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CPressure_Poisson(void); + + /*! + * \brief Compute the viscous heat residual using an average of gradients with correction. + * \param[out] val_residual - Pointer to the total residual. + * \param[out] Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[out] Jacobian_j - Jacobian of the numerical method at node j (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + void ComputeResidual(su2double *val_residual, su2double **Jacobian_i, su2double **Jacobian_j, CConfig *config); + + + inline void SetInvMomCoeff(su2double *val_Mom_Coeff_i, su2double *val_Mom_Coeff_j) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Mom_Coeff_i[iDim] = val_Mom_Coeff_i[iDim]; + Mom_Coeff_j[iDim] = val_Mom_Coeff_j[iDim]; + } + } +}; + +/*! + * \class CSource_Poisson + * \brief Class for source term of the Poisson equation. + * \ingroup SourceDiscr + */ +class CSource_PoissonFVM : public CNumerics { +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of variables of the problem. + * \param[in] config - Name of the input config file + * + */ + CSource_PoissonFVM(unsigned short val_nDim, unsigned short val_nVar, CConfig *config); + + + /*! + * \brief Residual for source term integration. + * \param[out] val_residual - Pointer to the total residual. + * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation). + * \param[in] config - Definition of the particular problem. + */ + void ComputeResidual(su2double *val_residual, su2double **Jacobian_i, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CSource_PoissonFVM(void); +}; + diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index fe8886cdb98f..7c2612f161f7 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -133,7 +133,7 @@ class CSourcePieceWise_TurbSA final : public CSourceBase_TurbSA { su2double dfv1, dfv2, dShat; su2double dr, dg, dfw; unsigned short iDim; - bool transition; + bool transition_BC; public: /*! @@ -311,6 +311,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics { a1; su2double CDkw_i, CDkw_j; + su2double gammaEff_i, gammaEff_j; su2double kAmb, omegaAmb; @@ -385,6 +386,16 @@ class CSourcePieceWise_TurbSST final : public CNumerics { CDkw_j = val_CDkw_j; } + /*! + * \brief Set the value of the effective intermittency for a turbulence model. + * \param[in] val_gammaEff_i - Value of the effective intermittency at point i. + * \param[in] val_gammaEff_j - Value of the effective intermittency at point j. + */ + inline void SetGammaEff(su2double val_gammaEff_i, su2double val_gammaEff_j) { + gammaEff_i = val_gammaEff_i; + gammaEff_j = val_gammaEff_j; + } + /*! * \brief Residual for source term integration. * \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 8f57b39af8eb..3d295b756325 100644 --- a/SU2_CFD/include/output/CFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CFlowIncOutput.hpp @@ -42,6 +42,7 @@ class CFlowIncOutput final: public CFlowOutput { unsigned short turb_model; /*!< \brief The kind of turbulence model*/ bool heat; /*!< \brief Boolean indicating whether have a heat problem*/ bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/ + bool pressure_based; /*!< \brief Boolean indicating whether running the pressure based version*/ public: diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 0eafec43eb72..0caa3e0ea8d9 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -344,7 +344,7 @@ class CFVMFlowSolverBase : public CSolver { * \param[in] numerics - Description of the numerical method. * \param[in] config - Definition of the particular problem. */ - void BC_Periodic(CGeometry* geometry, CSolver** solver_container, CNumerics* numerics, CConfig* config) final; + void BC_Periodic(CGeometry* geometry, CSolver** solver_container, CNumerics* numerics, CConfig* config) override; /*! * \brief Impose the interface state across sliding meshes. diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index c6190ac980f0..73a1e2042e14 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -2311,7 +2311,6 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr AxiFactor = 1.0; /*--- Force computation ---*/ - su2double Force[MAXNDIM] = {0.0}, MomentDist[MAXNDIM] = {0.0}; for (iDim = 0; iDim < nDim; iDim++) { Force[iDim] = TauElem[iDim] * Area * factor * AxiFactor; diff --git a/SU2_CFD/include/solvers/CPBIncEulerSolver.hpp b/SU2_CFD/include/solvers/CPBIncEulerSolver.hpp new file mode 100644 index 000000000000..3eb53f4deb34 --- /dev/null +++ b/SU2_CFD/include/solvers/CPBIncEulerSolver.hpp @@ -0,0 +1,384 @@ +/*! + * \file CIncEulerSolver.hpp + * \brief Headers of the CIncEulerSolver class + * \author F. Palacios, T. Economon, T. Albring + * \version 7.0.2 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + + +#pragma once + +#include "CFVMFlowSolverBase.hpp" +#include "../variables/CPBIncEulerVariable.hpp" + +class CPBIncEulerSolver : public CFVMFlowSolverBase { +protected: + +su2double + *Primitive = nullptr, /*!< \brief Auxiliary nPrimVar vector. */ + *Primitive_i = nullptr, /*!< \brief Auxiliary nPrimVar vector for storing the primitive at point i. */ + *Primitive_j = nullptr; /*!< \brief Auxiliary nPrimVar vector for storing the primitive at point j. */ + + CFluidModel *FluidModel; /*!< \brief fluid model used in the solver */ + + su2double ResMassFlux; + su2activematrix PseudoTimeCorr, TimeMarchingCorr_n, TimeMarchingCorr_n1; + + su2activematrix FaceVelocity, FaceVelocityCorrec; + + unsigned long PRef_Point = 1; /*!< \brief Store the index of reference cell for pressure */ + bool PRef_Check; /*!< \brief To check if a reference pressure cell is necessary */ + unsigned long nEdge; + +public: + + /*! + * \brief Constructor of the class. + */ + CPBIncEulerSolver(void): CFVMFlowSolverBase() {} + + /*! + * \overload + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + CPBIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh, const bool navier_stokes = false); + + /*! + * \brief Destructor of the class. + */ + ~CPBIncEulerSolver(void) override ; + + /*! + * \brief Set the solver nondimensionalization. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void SetNondimensionalization(CConfig *config, unsigned short iMesh) final; + + /*! + * \brief Compute the time step for solving the Euler equations. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + * \param[in] Iteration - Value of the current iteration. + */ + void SetTime_Step(CGeometry *geometry, + CSolver **solver_container, + CConfig *config, + unsigned short iMesh, + unsigned long Iteration) override; + + /*! + * \brief Compute the spatial integration using a centered scheme. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics_container - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + */ + void Centered_Residual(CGeometry *geometry, + CSolver **solver_container, + CNumerics **numerics_container, + CConfig *config, + unsigned short iMesh, + unsigned short iRKStep) final; + + /*! + * \brief Compute the spatial integration using a upwind scheme. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics_container - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void Upwind_Residual(CGeometry *geometry, + CSolver **solver_container, + CNumerics **numerics_container, + CConfig *config, + unsigned short iMesh) final; + + /*! + * \brief Source term integration. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics_container - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void Source_Residual(CGeometry *geometry, + CSolver **solver_container, + CNumerics **numerics_container, + CConfig *config, + unsigned short iMesh) final; + + /*! + * \brief Source term integration. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void Source_Template(CGeometry *geometry, + CSolver **solver_container, + CNumerics *numerics, + CConfig *config, + unsigned short iMesh) final; + + /*! + * \brief Compute primitive variables and their gradients. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + * \param[in] RunTime_EqSystem - System of equations which is going to be solved. + * \param[in] Output - boolean to determine whether to print output. + */ + void Preprocessing(CGeometry *geometry, + CSolver **solver_container, + CConfig *config, + unsigned short iMesh, + unsigned short iRKStep, + unsigned short RunTime_EqSystem, + bool Output) override; + + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void Postprocessing(CGeometry *geometry, + CSolver **solver_container, + CConfig *config, + unsigned short iMesh) override; + + /*! + * \brief Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] Output - boolean to determine whether to print output. + * \return - The number of non-physical points. + */ + unsigned long SetPrimitive_Variables(CSolver **solver_container, + CConfig *config, + bool Output); + + /*! + * \brief Impose the far-field boundary condition using characteristics. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Far_Field(CGeometry *geometry, + CSolver **solver_container, + CNumerics *conv_numerics, + CNumerics *visc_numerics, + CConfig *config, + unsigned short val_marker) final; + + /*! + * \brief Impose a subsonic inlet boundary condition. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Inlet(CGeometry *geometry, + CSolver **solver_container, + CNumerics *conv_numerics, + CNumerics *visc_numerics, + CConfig *config, + unsigned short val_marker) final; + + /*! + * \brief Impose the outlet boundary condition. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Outlet(CGeometry *geometry, + CSolver **solver_container, + CNumerics *conv_numerics, + CNumerics *visc_numerics, + CConfig *config, + unsigned short val_marker) final; + + /*! + * \brief Impose a periodic boundary condition by summing contributions from the complete control volume. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + */ + void BC_Periodic(CGeometry *geometry, + CSolver **solver_container, + CNumerics *numerics, + CConfig *config) final; + + /*! + * \brief compare to values. + * \param[in] a - value 1. + * \param[in] b - value 2. + */ + static bool Compareval(std::vector a,std::vector b); + + /*! + * \brief Update the solution using the explicit Euler scheme. + * \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 ExplicitEuler_Iteration(CGeometry *geometry, + CSolver **solver_container, + CConfig *config) final; + + /*! + * \brief Update the solution using an implicit Euler scheme. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + */ + void ImplicitEuler_Iteration(CGeometry *geometry, + CSolver **solver_container, + CConfig *config) final; + + /*! + * \brief Set the total residual adding the term that comes from the Dual Time Strategy. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + * \param[in] iMesh - Index of the mesh in multigrid computations. + * \param[in] RunTime_EqSystem - System of equations which is going to be solved. + */ + void SetResidual_DualTime(CGeometry *geometry, + CSolver **solver_container, + CConfig *config, + unsigned short iRKStep, + unsigned short iMesh, + unsigned short RunTime_EqSystem) final; + + /*! + * \brief Load a solution from a restart file. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all of the solvers. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iter - Current external iteration number. + * \param[in] val_update_geo - Flag for updating coords and grid velocity. + */ + void LoadRestart(CGeometry **geometry, + CSolver ***solver, + CConfig *config, + int val_iter, + bool val_update_geo) final; + + /*! + * \brief Set the initial condition for the Euler Equations. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] ExtIter - External iteration. + */ + void SetInitialCondition(CGeometry **geometry, + CSolver ***solver_container, + CConfig *config, + unsigned long TimeIter) final; + + /*! + * \brief Print verification error to screen. + * \param[in] config - Definition of the particular problem. + */ + void PrintVerificationError(const CConfig* config) const final; + + + /*! + * \brief Correct the velocity using the velocity corrections. + * + * + */ + void Flow_Correction(CGeometry *geometry, CSolver **solver_container, CConfig *config); + + /*! + * \brief Compute the source term for the pressure correction equation based + * on the residuals from the solution of momentum equation. + * + */ + void SetPoissonSourceTerm(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh); + + /*! + * \brief Compute the coefficients for the pressure correction equation based + * on the residuals from the solution of momentum equation. + */ + void SetMomCoeff(CGeometry *geometry, CSolver **solver_container, CConfig *config, bool periodic, unsigned short iMesh); + + /*! + * \brief Compute the coefficients for the pressure correction equation based + * on the residuals from the solution of momentum equation in a periodic problem. + */ + void SetMomCoeffPer(CGeometry *geometry, CSolver **solver_container, CConfig *config); + + /*! + * \brief Update corrections for the Rhie-Chow interpolation for unsteady problems. + */ + void SetMomentumCorrection_DualTime(); + + /*! + * \brief Set the convergence of mass flux for current internal iteration. + */ + void SetResMassFluxZero() { ResMassFlux = 0.0; } + + /*! + * \brief Set the convergence of mass flux for current internal iteration. + */ + void SetResMassFlux(su2double val_ResMassFlux) { ResMassFlux = val_ResMassFlux; } + + /*! + * \brief Set the convergence of mass flux for current internal iteration. + */ + void SetResMassFluxRMS(CGeometry *geometry, CConfig *config); + + /*! + * \brief Set the convergence of mass flux for current internal iteration. + */ + void AddResMassFlux(su2double val_ResMassFlux) { ResMassFlux += val_ResMassFlux; } + + /*! + * \brief Get the convergence of mass flux for current internal iteration. + * \return Value of the residual for the variable in the position val_var. + */ + su2double GetResMassFlux(void) const { return ResMassFlux; } + +}; diff --git a/SU2_CFD/include/solvers/CPBIncNSSolver.hpp b/SU2_CFD/include/solvers/CPBIncNSSolver.hpp new file mode 100644 index 000000000000..2fcf1f78ecfd --- /dev/null +++ b/SU2_CFD/include/solvers/CPBIncNSSolver.hpp @@ -0,0 +1,99 @@ +#pragma once + +#include "CPBIncEulerSolver.hpp" + +/*! + * \class CPBIncNSSolver + * \brief Main class for defining the pressure based incompressible Navier-Stokes flow solver. + * \ingroup Navier_Stokes_Equations + */ +class CPBIncNSSolver final : public CPBIncEulerSolver { + +public: + + /*! + * \brief Constructor of the class. + */ + CPBIncNSSolver(void): CPBIncEulerSolver() {} + + /*! + * \overload + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + CPBIncNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh); + + /*! + * \brief Compute the time step for solving the Navier-Stokes equations with turbulence model. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + * \param[in] Iteration - Index of the current iteration. + */ + void SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh, unsigned long Iteration); + + /*! + * \brief Restart residual and compute gradients. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + * \param[in] RunTime_EqSystem - System of equations which is going to be solved. + * \param[in] Output - boolean to determine whether to print output. + */ + void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output); + + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh); + + /*! + * \brief Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] Output - boolean to determine whether to print output. + * \return - The number of non-physical points. + */ + unsigned long SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output); + + /*! + * \brief Impose a no-slip condition. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker); + + /*! + * \brief Impose an isothermal temperature condition at the wall. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker); + + /*! + * \brief Compute the viscous residuals. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + */ + void Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, + CConfig *config, unsigned short iMesh, unsigned short iRKStep); +}; diff --git a/SU2_CFD/include/solvers/CPoissonSolverFVM.hpp b/SU2_CFD/include/solvers/CPoissonSolverFVM.hpp new file mode 100644 index 000000000000..e63225f68046 --- /dev/null +++ b/SU2_CFD/include/solvers/CPoissonSolverFVM.hpp @@ -0,0 +1,247 @@ +/*! + * \file CHeatSolver.hpp + * \brief Headers of the CHeatSolver class + * \author F. Palacios, T. Economon + * \version 7.0.2 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CSolver.hpp" +#include "../variables/CPBIncEulerVariable.hpp" + +/*! \class CPoissonSolverFVM + * \brief Main class for defining the poisson finite volume solver. + * \version 6.0.0 "Falcon" + */ +class CPoissonSolverFVM : public CSolver { +protected: + static constexpr size_t MAXNDIM = 3; /*!< \brief Max number of space dimensions, used in some static arrays. */ + su2double **CoeffMatrix_Node; /*!< \brief Auxiliary matrices for storing point to point coefficient matrices. */ + + CPoissonVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */ + + /*! + * \brief Return nodes to allow CSolver::base_nodes to be set. + */ + inline CVariable* GetBaseClassPointerToNodes() override { return nodes; } + +public: + + /*! + * \brief Constructor of the class. + */ + CPoissonSolverFVM(void); + + /*! + * \overload + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + CPoissonSolverFVM(CGeometry *geometry, CConfig *config); + + + /*! + * \brief Destructor of the class. + */ + ~CPoissonSolverFVM(void); + + + /*! + * \brief Return the value at the dirichlet boundary + * + */ + su2double GetDirichlet_BC(CGeometry *geometry, CConfig *config, unsigned long Point); + + /*! + * \brief Compute the spatial integration using a centered scheme. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + */ + void Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, + unsigned short iMesh, unsigned short iRKStep); + /*! + * \brief Load a solution from a restart file. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Container vector with all of the solvers. + * \param[in] config - Definition of the particular problem. + * \param[in] val_iter - Current external iteration number. + * \param[in] val_update_geo - Flag for updating coords and grid velocity. + */ + void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo); + + /*! + * \brief Restart residual and compute gradients. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + * \param[in] RunTime_EqSystem - System of equations which is going to be solved. + * \param[in] Output - boolean to determine whether to print output. + */ + void Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh); + + + void SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh, unsigned long Iteration); + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Euler_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, + unsigned short val_marker); + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Sym_Plane(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, + unsigned short val_marker); + + + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker); + + + /*! + * \brief A virtual member. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, + unsigned short val_marker); + + /*! + * \brief Impose the inlet boundary condition. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, + unsigned short val_marker); + + /*! + * \brief Impose the inlet boundary condition. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] conv_numerics - Description of the numerical method. + * \param[in] visc_numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + */ + void BC_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, + unsigned short val_marker); + + /*! + * \brief Impose a periodic boundary condition by summing contributions from the complete control volume. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + */ + void BC_Periodic(CGeometry *geometry, + CSolver **solver_container, + CNumerics *numerics, + CConfig *config) final; + + /*! + * \brief Set residuals to zero. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] iRKStep - Current step of the Runge-Kutta iteration. + * \param[in] RunTime_EqSystem - System of equations which is going to be solved. + * \param[in] Output - boolean to determine whether to print output. + */ + void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output); + + /*! + * \brief Source term integration. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics_container - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void Source_Residual(CGeometry *geometry, + CSolver **solver_container, + CNumerics **numerics_container, + CConfig *config, + unsigned short iMesh) final; + + /*! + * \brief Source term computation. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] numerics - Description of the numerical method. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the mesh in multigrid computations. + */ + void Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, + CConfig *config, unsigned short iMesh); + + /*! + * \brief Update the solution using an implicit solver. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + */ + void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config); + + /*! + * \brief Update the solution using an explicit solver. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + */ + + void ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config); + +}; diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 6576c775a7b2..32a2b109a257 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -537,6 +537,33 @@ class CSolver { */ inline virtual su2double GetRes_FEM(unsigned short val_var) const { return 0.0; } + /*! + * \brief Set the RMS of mass flux to zero. + */ + inline virtual void SetResMassFluxZero() { } + + /*! + * \brief Set the RMS of mass flux to given value. + * \param[in] val_ResMassFlux - Value of ResMassFlux + */ + inline virtual void SetResMassFlux(su2double val_ResMassFlux) { } + + /*! + * \brief Set the RMS of mass flux. + */ + inline virtual void SetResMassFluxRMS(CGeometry *geometry, CConfig *config) { } + + /*! + * \brief Set the convergence of mass flux for current internal iteration. + */ + inline virtual void AddResMassFlux(su2double val_ResMassFlux) { } + + /*! + * \brief Get the convergence of mass flux for current internal iteration. + * \return Value of the residual for the variable in the position val_var. + */ + inline virtual su2double GetResMassFlux() const {return 0.0; } + /*! * \brief Get the maximal residual, this is useful for the convergence history. * \param[in] val_var - Index of the variable. @@ -1541,7 +1568,7 @@ class CSolver { * \param[in] solver - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - inline virtual void ComputeUnderRelaxationFactor(CSolver **solver_container, const CConfig *config) { } + inline virtual void ComputeUnderRelaxationFactor(CSolver **solver_container,const CConfig *config) { } /*! * \brief Adapt the CFL number based on the local under-relaxation parameters @@ -4528,6 +4555,36 @@ class CSolver { * \return Should return true if "yes", false if "no". */ inline virtual bool GetHasHybridParallel() const { return false; } + + /*! + * \brief A virtual member + * Correct velocity and pressure. + */ + inline virtual void Flow_Correction(CGeometry *geometry, CSolver **solver_container, CConfig *config) { } + + /*! + * \brief A virtual member + * Set source term for pressure correction. + */ + inline virtual void SetPoissonSourceTerm(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) { } + + /*! + * \brief A virtual member + * Set coefficients for pressure correction equation. + */ + inline virtual void SetMomCoeff(CGeometry *geometry, CSolver **solver_container, CConfig *config, bool periodic, unsigned short iMesh) { } + + /*! + * \brief A virtual member + * Set coefficients for pressure correction equation in periodic problems. + */ + inline virtual void SetMomCoeffPer(CGeometry *geometry, CSolver **solver_container, CConfig *config) { } + + /*! + * \brief A virtual member + * Update corrections for the Rhie-Chow interpolation for unsteady problems. + */ + inline virtual void SetMomentumCorrection_DualTime() { } protected: /*! diff --git a/SU2_CFD/include/solvers/CSolverFactory.hpp b/SU2_CFD/include/solvers/CSolverFactory.hpp index e7b470017859..186a5efb0e56 100644 --- a/SU2_CFD/include/solvers/CSolverFactory.hpp +++ b/SU2_CFD/include/solvers/CSolverFactory.hpp @@ -61,6 +61,7 @@ enum class SUB_SOLVER_TYPE { MESH, /*!< \brief Mesh solver */ RADIATION, /*!< \brief Radiation solver */ DISC_ADJ_RADIATION, /*!< \brief Discrete adjoint radiation solver */ + POISSON_EQUATION, NONE }; diff --git a/SU2_CFD/include/solvers/CTurbSolver.hpp b/SU2_CFD/include/solvers/CTurbSolver.hpp index f4cf6e692cf4..e76dd3fec593 100644 --- a/SU2_CFD/include/solvers/CTurbSolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSolver.hpp @@ -83,6 +83,8 @@ class CTurbSolver : public CSolver { * \brief Return nodes to allow CSolver::base_nodes to be set. */ inline CVariable* GetBaseClassPointerToNodes() final { return nodes; } + + bool transitionSolver; /*!< \brief Whether or not the solver is actually a transition solver. */ private: @@ -240,7 +242,7 @@ class CTurbSolver : public CSolver { CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, - CConfig *config) final; + CConfig *config) override; /*! * \brief Update the solution using an implicit solver. @@ -286,7 +288,7 @@ class CTurbSolver : public CSolver { CSolver ***solver, CConfig *config, int val_iter, - bool val_update_geo) final; + bool val_update_geo) override; /*! * \brief Get the outer state for fluid interface nodes. diff --git a/SU2_CFD/include/variables/CPBIncEulerVariable.hpp b/SU2_CFD/include/variables/CPBIncEulerVariable.hpp new file mode 100644 index 000000000000..cb8ec6bac841 --- /dev/null +++ b/SU2_CFD/include/variables/CPBIncEulerVariable.hpp @@ -0,0 +1,418 @@ +/*! + * \file CPBIncEulerVariable.hpp + * \brief Class for defining the variables of the pressure based incompressible Euler solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CVariable.hpp" + +/*! + * \class CPBIncEulerVariable + * \brief Class for defining the variables of the pressure based incompressible Euler solver. + * \ingroup Euler_Equations + * \author A. Koodly + */ +class CPBIncEulerVariable : public CVariable { +protected: + VectorType Velocity2; /*!< \brief Square of the velocity vector. */ + MatrixType Primitive; /*!< \brief Primitive variables (P, vx, vy, vz, T, rho, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) in incompressible flows. */ + CVectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (P, vx, vy, vz, T, rho, beta). */ + CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */ + CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */ + MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (P, vx, vy, vz, T, rho, beta). */ + VectorType Density_Old; /*!< \brief Old density for variable density turbulent flows (SST). */ + + VectorType MassFlux; /*!< \brief Massflux associated with each CV */ + MatrixType Mom_Coeff; + MatrixType Mom_Coeff_nb; + using BoolVectorType = C2DContainer; + BoolVectorType strong_bc; + + +public: + + static constexpr size_t MAXNVAR = 7; + + /*! + * \brief Constructor of the class. + * \param[in] val_pressure - value of the pressure. + * \param[in] velocity - Value of the flow velocity (initialization value). + * \param[in] temperature - Value of the temperature (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] ndim - Number of dimensions of the problem. + * \param[in] nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CPBIncEulerVariable(su2double density, su2double pressure, const su2double *velocity, + unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CPBIncEulerVariable() = default; + + /*! + * \brief Get the primitive variable gradients for all points. + * \return Reference to primitive variable gradient. + */ + inline CVectorOfMatrix& GetGradient_Primitive(void) { return Gradient_Primitive; } + + /*! + * \brief Get the reconstruction gradient for primitive variable at all points. + * \return Reference to variable reconstruction gradient. + */ + inline CVectorOfMatrix& GetGradient_Reconstruction(void) final { return Gradient_Reconstruction; } + + /*! + * \brief Add value to the gradient of the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] value - Value to add to the gradient of the primitive variables. + */ + inline void AddGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) += value; + } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \return Value of the primitive variables gradient. + */ + inline su2double GetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final { + return Gradient_Primitive(iPoint,iVar,iDim); + } + + /*! + * \brief Get the primitive variables limiter. + * \return Primitive variables limiter for the entire domain. + */ + inline MatrixType& GetLimiter_Primitive(void) {return Limiter_Primitive; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \return Value of the primitive variables gradient. + */ + inline su2double GetLimiter_Primitive(unsigned long iPoint, unsigned long iVar) const final { + return Limiter_Primitive(iPoint,iVar); + } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] value - Value of the gradient. + */ + inline void SetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) = value; + } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] value - Value of the gradient. + */ + inline void SetLimiter_Primitive(unsigned long iPoint, unsigned long iVar, su2double value) final { + Limiter_Primitive(iPoint,iVar) = value; + } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] iPoint - Point index. + * \return Value of the primitive variables gradient. + */ + inline su2double **GetGradient_Primitive(unsigned long iPoint) final { return Gradient_Primitive[iPoint]; } + + /*! + * \brief Get the value of the primitive variables gradient. + * \param[in] iPoint - Point index. + * \return Value of the primitive variables gradient. + */ + inline su2double *GetLimiter_Primitive(unsigned long iPoint) final { return Limiter_Primitive[iPoint]; } + + /*! + * \brief Get the value of the reconstruction variables gradient at a node. + * \param[in] iPoint - Index of the current node. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \return Value of the reconstruction variables gradient at a node. + */ + inline su2double GetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final { + return Gradient_Reconstruction(iPoint,iVar,iDim); + } + + /*! + * \brief Get the value of the reconstruction variables gradient at a node. + * \param[in] iPoint - Index of the current node. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] value - Value of the reconstruction gradient component. + */ + inline void SetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Reconstruction(iPoint,iVar,iDim) = value; + } + + /*! + * \brief Get the array of the reconstruction variables gradient at a node. + * \param[in] iPoint - Index of the current node. + * \return Array of the reconstruction variables gradient at a node. + */ + inline su2double **GetGradient_Reconstruction(unsigned long iPoint) final { return Gradient_Reconstruction[iPoint]; } + + /*! + * \brief Get the primitive variables for all points. + * \return Reference to primitives. + */ + inline const MatrixType& GetPrimitive(void) const { return Primitive; } + + /*! + * \brief Get the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \return Value of the primitive variable for the index iVar. + */ + inline su2double GetPrimitive(unsigned long iPoint, unsigned long iVar) const final { return Primitive(iPoint,iVar); } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] iVar - Index of the variable. + * \param[in] iVar - Index of the variable. + * \return Set the value of the primitive variable for the index iVar. + */ + inline void SetPrimitive(unsigned long iPoint, unsigned long iVar, su2double val_prim) final { Primitive(iPoint,iVar) = val_prim; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] iPoint - Point index. + * \param[in] val_prim - Primitive variables. + * \return Set the value of the primitive variable for the index iVar. + */ + inline void SetPrimitive(unsigned long iPoint, const su2double *val_prim) final { + for (unsigned long iVar = 0; iVar < nPrimVar; iVar++) Primitive(iPoint,iVar) = val_prim[iVar]; + } + + /*! + * \brief Get the primitive variables of the problem. + * \param[in] iPoint - Point index. + * \return Pointer to the primitive variable vector. + */ + inline su2double *GetPrimitive(unsigned long iPoint) final { return Primitive[iPoint]; } + + /*! + * \brief Set the value of the pressure. + */ + inline void SetPressure_val(unsigned long iPoint, su2double val_pressure) { Primitive(iPoint,0) = val_pressure; } + + /*! + * \brief Set the value of the density for the incompressible flows. + * \param[in] iPoint - Point index. + */ + inline bool SetDensity(unsigned long iPoint, su2double val_density) final { + Primitive(iPoint,nDim+1) = val_density; + if (Primitive(iPoint,nDim+1) > 0.0) return false; + else return true; + } + + /*! + * \brief Set the value of the density for the incompressible flows. + * \param[in] iPoint - Point index. + */ + inline void SetVelocity(unsigned long iPoint) final { + Velocity2(iPoint) = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + Primitive(iPoint,iDim+1) = Solution(iPoint,iDim)/Primitive(iPoint, nDim+1); + Velocity2(iPoint) += pow(Primitive(iPoint,iDim+1),2); + } + } + + /*! + * \brief Get the norm 2 of the velocity. + * \return Norm 2 of the velocity vector. + */ + inline su2double GetVelocity2(unsigned long iPoint) const final { return Velocity2(iPoint); } + + /*! + * \brief Get the flow pressure. + * \return Value of the flow pressure. + */ + inline su2double GetPressure(unsigned long iPoint) const final { return Primitive(iPoint,0); } + + /*! + * \brief Get the density of the flow. + * \return Value of the density of the flow. + */ + inline su2double GetDensity(unsigned long iPoint) const final { return Primitive(iPoint,nDim+1); } + + /*! + * \brief Get the density of the flow from the previous iteration. + * \return Old value of the density of the flow. + */ + inline su2double GetDensity_Old(unsigned long iPoint) const final { return Density_Old(iPoint); } + + /*! + * \brief Get the velocity of the flow. + * \param[in] iDim - Index of the dimension. + * \return Value of the velocity for the dimension iDim. + */ + inline su2double GetVelocity(unsigned long iPoint, unsigned long iDim) const final { return Primitive(iPoint,iDim+1); } + + /*! + * \brief Get the projected velocity in a unitary vector direction (compressible solver). + * \param[in] val_vector - Direction of projection. + * \return Value of the projected velocity. + */ + inline su2double GetProjVel(unsigned long iPoint, const su2double *val_vector) const final { + su2double ProjVel = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + ProjVel += Primitive(iPoint,iDim+1)*val_vector[iDim]; + return ProjVel; + } + + /*! + * \brief Set the velocity vector from the old solution. + * \param[in] val_velocity - Pointer to the velocity. + */ + inline void SetVelocity_Old(unsigned long iPoint, const su2double *val_velocity) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Solution_Old(iPoint,iDim) = Primitive(iPoint,nDim+1)*val_velocity[iDim]; + } + + /*! + * \brief Set all the primitive variables for incompressible flows. + */ + bool SetPrimVar(unsigned long iPoint, su2double Density_Inf, CConfig *config); + + inline void Set_Mom_CoeffZero(unsigned long iPoint) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Mom_Coeff(iPoint,iDim) = 0.0; + } + + inline su2double Get_Mom_Coeff(unsigned long iPoint, unsigned short val_Var) { return Mom_Coeff(iPoint,val_Var);} + + inline void Set_Mom_Coeff(unsigned long iPoint, const su2double *val_Mom_Coeff) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Mom_Coeff(iPoint,iDim) = val_Mom_Coeff[iDim]; + } + + inline void Set_Mom_Coeff(unsigned long iPoint, unsigned short val_Var, su2double val_Mom_Coeff) { Mom_Coeff(iPoint,val_Var) = val_Mom_Coeff; } + + inline su2double Get_Mom_Coeff_nb(unsigned long iPoint, unsigned short val_Var) { return Mom_Coeff_nb(iPoint,val_Var);} + + inline void Set_Mom_Coeff_nb(unsigned long iPoint, su2double *val_Mom_Coeff) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Mom_Coeff_nb(iPoint,iDim) = val_Mom_Coeff[iDim]; + } + + inline void Set_Mom_Coeff_nb(unsigned long iPoint, unsigned short val_Var, su2double val_Mom_Coeff) { Mom_Coeff_nb(iPoint,val_Var) = val_Mom_Coeff; } + + inline void Set_Mom_Coeff_nbZero(unsigned long iPoint) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Mom_Coeff_nb(iPoint,iDim) = 0.0; + } + + inline void Add_Mom_Coeff_nb(unsigned long iPoint, su2double val_coeff_nb, unsigned short val_Var) { Mom_Coeff_nb(iPoint,val_Var) += val_coeff_nb;} + + inline void Add_Mom_Coeff(unsigned long iPoint, su2double val_coeff, unsigned short val_Var) { Mom_Coeff(iPoint,val_Var) += val_coeff;} + + inline void SetStrongBC(unsigned long iPoint) { strong_bc(iPoint) = true; } + + inline void ResetStrongBC(unsigned long iPoint) { strong_bc(iPoint) = false; } + + inline bool GetStrongBC(unsigned long iPoint) { return strong_bc(iPoint); } + + inline void SetMassFluxZero(unsigned iPoint) {MassFlux(iPoint) = 0.0; } + + inline void SetMassFlux(unsigned long iPoint, su2double val_MassFlux) { MassFlux(iPoint) = val_MassFlux; } + + inline void AddMassFlux(unsigned long iPoint, su2double val_MassFlux) {MassFlux(iPoint) += val_MassFlux; } + + inline void SubtractMassFlux(unsigned long iPoint, su2double val_MassFlux) {MassFlux(iPoint) -= val_MassFlux; } + + inline su2double GetMassFlux(unsigned long iPoint) const { return MassFlux(iPoint); } + +}; + + + + +/*! + * \class CPoissonVariable + * \brief Main class for defining the variables of the potential solver. + * \ingroup Potential_Flow_Equation + * \author F. Palacios + */ +class CPoissonVariable : public CVariable { + VectorType SourceTerm; + VectorType Poisson_Coeff; + using BoolVectorType = C2DContainer; + BoolVectorType strong_bc; +public: + /*! + * \overload + * \param[in] val_potential - Value of the potential solution (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CPoissonVariable(su2double val_SourceTerm, unsigned long npoint, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CPoissonVariable() = default; + + inline su2double GetPoisson_Coeff(unsigned long iPoint) { return Poisson_Coeff(iPoint);} + + inline void SetPoisson_Coeff(unsigned long iPoint, su2double val_Poisson_Coeff) { Poisson_Coeff(iPoint) = val_Poisson_Coeff ; } + + inline void SetSourceTerm(unsigned long iPoint, su2double val_SourceTerm) { SourceTerm(iPoint) = val_SourceTerm ; } + + inline su2double GetSourceTerm(unsigned long iPoint) { return SourceTerm(iPoint);} + + inline void SetStrongBC(unsigned long iPoint) { strong_bc(iPoint) = true; } + + inline bool GetStrongBC(unsigned long iPoint) { return strong_bc(iPoint); } + + inline void ResetStrongBC(unsigned long iPoint) { strong_bc(iPoint) = false; } + +}; diff --git a/SU2_CFD/include/variables/CPBIncNSVariable.hpp b/SU2_CFD/include/variables/CPBIncNSVariable.hpp new file mode 100644 index 000000000000..4c42bc732cfd --- /dev/null +++ b/SU2_CFD/include/variables/CPBIncNSVariable.hpp @@ -0,0 +1,144 @@ +/*! + * \file CPBIncNSVariable.hpp + * \brief Class for defining the variables of the pressure based incompressible NS solver. + * \author F. Palacios, T. Economon + * \version 6.2.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once + +#include "CPBIncEulerVariable.hpp" +/*! + * \class CPBIncNSVariable + * \brief Main class for defining the variables of the incompressible Navier-Stokes solver. + * \ingroup Navier_Stokes_Equations + */ +class CPBIncNSVariable final : public CPBIncEulerVariable { +private: + MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ + VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + + VectorType DES_LengthScale; +public: + + /*! + * \brief Constructor of the class. + */ + CPBIncNSVariable(void); + + /*! + * \param[in] val_pressure - value of the pressure. + * \param[in] val_velocity - Value of the flow velocity (initialization value). + * \param[in] val_temperature - Value of the temperature (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nvar - Number of variables of the problem. + * \param[in] config - Definition of the particular problem. + */ + CPBIncNSVariable(su2double val_density, su2double val_pressure, su2double *val_velocity, + unsigned long npoint, unsigned short val_nDim, unsigned short val_nvar, CConfig *config); + + /*! + * \brief Destructor of the class. + */ + virtual ~CPBIncNSVariable() = default; + + /*! + * \brief Set all the primitive variables for incompressible flows + */ + bool SetPrimVar(unsigned long iPoint, su2double Density_Inf, su2double Viscosity_Inf, su2double eddy_visc, su2double turb_ke, CConfig *config); + using CVariable::SetPrimVar; + + /*! + * \brief Set the laminar viscosity. + */ + inline void SetLaminarViscosity(unsigned long iPoint, su2double laminarViscosity) override { + Primitive(iPoint,nDim+2) = laminarViscosity; + } + + /*! + * \brief Set the vorticity value. + */ + bool SetVorticity_StrainMag() override; + + /*! + * \overload + * \param[in] eddy_visc - Value of the eddy viscosity. + */ + inline void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) override { + Primitive(iPoint,nDim+3) = eddy_visc; + } + + /*! + * \brief Get the laminar viscosity of the flow. + * \return Value of the laminar viscosity of the flow. + */ + inline su2double GetLaminarViscosity(unsigned long iPoint) const override { return Primitive(iPoint,nDim+2); } + + /*! + * \brief Get the eddy viscosity of the flow. + * \return The eddy viscosity of the flow. + */ + inline su2double GetEddyViscosity(unsigned long iPoint) const override { return Primitive(iPoint,nDim+3); } + + /*! + * \brief Get the value of the vorticity. + * \return Value of the vorticity. + */ + inline su2double *GetVorticity(unsigned long iPoint) override { return Vorticity[iPoint]; } + + /*! + * \brief Get the value of the magnitude of rate of strain. + * \return Value of the rate of strain magnitude. + */ + inline su2double GetStrainMag(unsigned long iPoint) const override { return StrainMag(iPoint); } + + /*! + * \brief Set the DES Length Scale. + */ + inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override { + DES_LengthScale(iPoint) = val_des_lengthscale; + } + + /*! + * \brief Get the DES length scale + * \return Value of the DES length Scale. + */ + inline su2double GetDES_LengthScale(unsigned long iPoint) const override { return DES_LengthScale(iPoint); } + + /*! + * \brief Get the thermal conductivity of the flow. + * \return Value of the laminar viscosity of the flow. + */ + inline su2double GetThermalConductivity(unsigned long iPoint) const override { return 0.0; } + +}; diff --git a/SU2_CFD/include/variables/CTransLMVariable.hpp b/SU2_CFD/include/variables/CTransLMVariable.hpp index eef802ef28e5..bf257e718686 100644 --- a/SU2_CFD/include/variables/CTransLMVariable.hpp +++ b/SU2_CFD/include/variables/CTransLMVariable.hpp @@ -61,7 +61,8 @@ class CTransLMVariable final : public CTurbVariable { /*! * \brief ________________. */ - inline su2double GetIntermittency(unsigned long iPoint) const override { return Solution(iPoint,0); } + //inline su2double GetIntermittency(unsigned long iPoint) const override { return Solution(iPoint,0); } + inline su2double GetGammaEff(unsigned long iPoint) const override { return max(Solution(iPoint,0), gamma_sep(iPoint)); } /*! * \brief ________________. diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index b9af5873f6b6..0548142e0c47 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -70,7 +70,7 @@ class CTurbSSTVariable final : public CTurbVariable { * \param[in] val_dist - Value of the distance to the wall. * \param[in] val_density - Value of the density. */ - void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density) override; + void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density, bool transitionLM) override; /*! * \brief Get the first blending function. diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index aa3f220dd11c..eee62d448245 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -1336,7 +1336,8 @@ class CVariable { * \param[in] iPoint - Point index. * \return Returns intermittency */ - inline virtual su2double GetIntermittency(unsigned long iPoint) const { return 0.0; } + //inline virtual su2double GetIntermittency(unsigned long iPoint) const { return 0.0; } + inline virtual su2double GetGammaEff(unsigned long iPoint) const { return 0.0; } /*! * \brief A virtual member. @@ -1582,10 +1583,20 @@ class CVariable { */ inline virtual bool SetPressure(unsigned long iPoint, CConfig *config) { return false; } + /*! + * \brief A virtual member. + */ + inline virtual bool SetPressure(su2double Gamma, su2double turb_ke) {return false; } + /*! * \brief A virtual member. */ inline virtual bool SetPressure(unsigned long iPoint, su2double Gamma, su2double turb_ke) { return false; } + + /*! + * \brief A virtual member. + */ + inline virtual void SetPressure_val(unsigned long iPoint, su2double val_pressure) {} /*! * \brief Calculates vib.-el. energy per mass, \f$e^{vib-el}_s\f$, for input species (not including KE) @@ -1961,7 +1972,7 @@ class CVariable { * \param[in] val_density - Value of the density. * \param[in] val_dist - Value of the distance to the wall. */ - inline virtual void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density) {} + inline virtual void SetBlendingFunc(unsigned long iPoint, su2double val_viscosity, su2double val_dist, su2double val_density, bool transitionLM) {} /*! * \brief Get the first blending function of the SST model. @@ -2698,6 +2709,51 @@ class CVariable { inline virtual su2double GetSolution_Old_Vel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } inline virtual su2double GetSolution_Old_Accel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } + + inline virtual void SetMassFluxZero(unsigned long iPoint) {} + + inline virtual void SetStrongBC(unsigned long iPoint) {} + + inline virtual void ResetStrongBC(unsigned long iPoint) {} + + inline virtual void SetMassFlux(unsigned long iPoint, su2double val_MassFlux) {} + + inline virtual void AddMassFlux(unsigned long iPoint, su2double val_MassFlux) {} + + inline virtual void SubtractMassFlux(unsigned long iPoint, su2double val_MassFlux) {} + + inline virtual void Set_Mom_Coeff(unsigned long iPoint, su2double *val_Mom_Coeff) {} + + inline virtual su2double Get_Mom_Coeff(unsigned long iPoint, unsigned short val_Var) { return 0.0; } + + inline virtual su2double Get_Mom_Coeff_nb(unsigned long iPoint, unsigned short val_Var) { return 0.0; } + + inline virtual void Set_Mom_Coeff_nb(unsigned long iPoint, su2double *val_Mom_Coeff) {} + + inline virtual void Add_Mom_Coeff_nb(unsigned long iPoint, su2double val_coeff_nb, unsigned short val_Var) {} + + inline virtual void Add_Mom_Coeff(unsigned long iPoint, su2double val_coeff, unsigned short val_Var) {} + + inline virtual void Set_Mom_Coeff_nbZero(unsigned long iPoint) {} + + inline virtual void Set_Mom_CoeffZero(unsigned long iPoint) {} + + inline virtual void Set_Mom_Coeff(unsigned long iPoint, unsigned short val_Var, su2double val_Mom_Coeff) {} + + inline virtual void Set_Mom_Coeff_nb(unsigned long iPoint, unsigned short val_Var, su2double val_Mom_Coeff) {} + + inline virtual su2double GetMassFlux(unsigned long iPoint) const { return 0.0; } + + inline virtual bool GetStrongBC(unsigned long iPoint) { return false; } + + inline virtual su2double GetPoisson_Coeff(unsigned long iPoint) { return 0.0; } + + inline virtual void SetPoisson_Coeff(unsigned long iPoint, su2double val_Poisson_Coeff) {} + + inline virtual void SetSourceTerm(unsigned long iPoint, su2double val_SourceTerm) {} + + inline virtual su2double GetSourceTerm(unsigned long iPoint) { return 0.0; } + /*! * \brief Virtual member: Set the Radiative source term at the node diff --git a/SU2_CFD/obj/Makefile.am b/SU2_CFD/obj/Makefile.am index 412117f0fabe..c8d87c5ad845 100644 --- a/SU2_CFD/obj/Makefile.am +++ b/SU2_CFD/obj/Makefile.am @@ -77,6 +77,7 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/iteration/CFEAIteration.cpp \ ../src/iteration/CFEMFluidIteration.cpp \ ../src/iteration/CFluidIteration.cpp \ + ../src/iteration/CPBFluidIteration.cpp \ ../src/iteration/CHeatIteration.cpp \ ../src/iteration/CTurboIteration.cpp \ ../src/numerics/CNumerics.cpp \ @@ -84,6 +85,8 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/numerics/transition.cpp \ ../src/numerics/heat.cpp \ ../src/numerics/radiation.cpp \ + ../src/numerics/pbflow.cpp \ + ../src/numerics/poisson.cpp \ ../src/numerics/flow/convection/roe.cpp \ ../src/numerics/flow/convection/fds.cpp \ ../src/numerics/flow/convection/fvs.cpp \ @@ -157,6 +160,7 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/output/CNEMOCompOutput.cpp \ ../src/output/COutputFactory.cpp \ ../src/output/output_structure_legacy.cpp \ + ../src/output/COutputFactory.cpp \ ../src/python_wrapper_structure.cpp \ ../src/solvers/CAdjEulerSolver.cpp \ ../src/solvers/CAdjNSSolver.cpp \ @@ -172,7 +176,10 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/solvers/CFEM_DG_NSSolver.cpp \ ../src/solvers/CHeatSolver.cpp \ ../src/solvers/CIncEulerSolver.cpp \ + ../src/solvers/CPBIncEulerSolver.cpp \ ../src/solvers/CIncNSSolver.cpp \ + ../src/solvers/CPBIncNSSolver.cpp \ + ../src/solvers/CPoissonSolverFVM.cpp \ ../src/solvers/CMeshSolver.cpp \ ../src/solvers/CRadSolver.cpp \ ../src/solvers/CRadP1Solver.cpp \ @@ -212,6 +219,7 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/variables/CDiscAdjFEABoundVariable.cpp \ ../src/variables/CDiscAdjFEAVariable.cpp \ ../src/variables/CIncEulerVariable.cpp \ + ../src/variables/CPBIncEulerVariable.cpp \ ../src/variables/CTurbVariable.cpp \ ../src/variables/CNSVariable.cpp \ ../src/variables/CNEMOEulerVariable.cpp \ @@ -222,6 +230,7 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/variables/CAdjEulerVariable.cpp \ ../src/variables/CDiscAdjVariable.cpp \ ../src/variables/CIncNSVariable.cpp \ + ../src/variables/CPBIncNSVariable.cpp \ ../src/variables/CEulerVariable.cpp su2_cfd_sources = \ diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 6e8530faad5e..30818354e4e5 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -55,6 +55,8 @@ #include "../../include/numerics/transition.hpp" #include "../../include/numerics/radiation.hpp" #include "../../include/numerics/heat.hpp" +#include "../../include/numerics/pbflow.hpp" +#include "../../include/numerics/poisson.hpp" #include "../../include/numerics/flow/convection/roe.hpp" #include "../../include/numerics/flow/convection/fds.hpp" #include "../../include/numerics/flow/convection/fvs.hpp" @@ -1386,14 +1388,14 @@ void CDriver::Integration_Postprocessing(CIntegration ***integration, CGeometry for (unsigned int iSol = 0; iSol < MAX_SOLS; iSol++){ delete integration[val_iInst][iSol]; } - + delete [] integration[val_iInst]; } void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSolver ***solver, CNumerics ****&numerics) const { - if (rank == MASTER_NODE) + if (rank == MASTER_NODE) cout << endl <<"------------------- Numerics Preprocessing ( Zone " << config->GetiZone() <<" ) -------------------" << endl; unsigned short iMGlevel, iSol, @@ -1409,6 +1411,7 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol nVar_Adj_Turb = 0, nVar_FEM = 0, nVar_Rad = 0, + nVar_Poisson = 0, nVar_Heat = 0; numerics = new CNumerics***[config->GetnMGLevels()+1]; @@ -1419,6 +1422,8 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol bool compressible = false; bool incompressible = false; bool ideal_gas = (config->GetKind_FluidModel() == STANDARD_AIR) || (config->GetKind_FluidModel() == IDEAL_GAS); + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); + bool poisson = (config->GetKind_Incomp_System() == PRESSURE_BASED); bool roe_low_dissipation = (config->GetKind_RoeLowDiss() != NO_ROELOWDISS); /*--- Initialize some useful booleans ---*/ @@ -1548,7 +1553,8 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol //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) nVar_Heat = solver[MESH_0][HEAT_SOL]->GetnVar(); + if (heat) nVar_Heat = solver[MESH_0][HEAT_SOL]->GetnVar(); + if (poisson) nVar_Poisson = solver[MESH_0][POISSON_SOL]->GetnVar(); if (config->AddRadiation()) nVar_Rad = solver[MESH_0][RAD_SOL]->GetnVar(); @@ -1655,22 +1661,40 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } if (incompressible) { - /*--- Incompressible flow, use preconditioning method ---*/ - switch (config->GetKind_Centered_Flow()) { - case LAX : numerics[MESH_0][FLOW_SOL][conv_term] = new CCentLaxInc_Flow(nDim, nVar_Flow, config); break; - case JST : numerics[MESH_0][FLOW_SOL][conv_term] = new CCentJSTInc_Flow(nDim, nVar_Flow, config); break; - default: - SU2_OMP_MASTER - SU2_MPI::Error("Invalid centered scheme or not implemented.\n Currently, only JST and LAX-FRIEDRICH are available for incompressible flows.", CURRENT_FUNCTION); - break; - } - for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) - numerics[iMGlevel][FLOW_SOL][conv_term] = new CCentLaxInc_Flow(nDim, nVar_Flow, config); + if (!pressure_based) { + /*--- Incompressible flow, use preconditioning method ---*/ + switch (config->GetKind_Centered_Flow()) { + case LAX : numerics[MESH_0][FLOW_SOL][conv_term] = new CCentLaxInc_Flow(nDim, nVar_Flow, config); break; + case JST : numerics[MESH_0][FLOW_SOL][conv_term] = new CCentJSTInc_Flow(nDim, nVar_Flow, config); break; + default: + SU2_OMP_MASTER + SU2_MPI::Error("Invalid centered scheme or not implemented.\n Currently, only JST and LAX-FRIEDRICH are available for incompressible flows.", CURRENT_FUNCTION); + break; + } + 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); + /*--- 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); + + } + else { + /*--- Incompressible flow, use pressure based method ---*/ + switch (config->GetKind_Centered_Flow()) { + case CDS : numerics[MESH_0][FLOW_SOL][conv_term] = new CCentPB_Flow(nDim, nVar_Flow, config); break; + default: + SU2_OMP_MASTER + SU2_MPI::Error("Invalid centered scheme or not implemented.\n Currently, only CDS are available for incompressible flows.", CURRENT_FUNCTION); + break; + } + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) + numerics[iMGlevel][FLOW_SOL][conv_term] = new CCentPB_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 CUpwPB_Flow(nDim, nVar_Flow, config); + } } break; case SPACE_UPWIND : @@ -1785,18 +1809,35 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } if (incompressible) { - /*--- Incompressible flow, use artificial compressibility method ---*/ - switch (config->GetKind_Upwind_Flow()) { - case FDS: - for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { - numerics[iMGlevel][FLOW_SOL][conv_term] = new CUpwFDSInc_Flow(nDim, nVar_Flow, config); - numerics[iMGlevel][FLOW_SOL][conv_bound_term] = new CUpwFDSInc_Flow(nDim, nVar_Flow, config); - } - break; - default: - SU2_OMP_MASTER - SU2_MPI::Error("Invalid upwind scheme or not implemented.\n Currently, only FDS is available for incompressible flows.", CURRENT_FUNCTION); - break; + if (!pressure_based) { + /*--- Incompressible flow, use artificial compressibility method ---*/ + switch (config->GetKind_Upwind_Flow()) { + case FDS: + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { + numerics[iMGlevel][FLOW_SOL][conv_term] = new CUpwFDSInc_Flow(nDim, nVar_Flow, config); + numerics[iMGlevel][FLOW_SOL][conv_bound_term] = new CUpwFDSInc_Flow(nDim, nVar_Flow, config); + } + break; + default: + SU2_OMP_MASTER + SU2_MPI::Error("Invalid upwind scheme or not implemented.\n Currently, only FDS is available for incompressible flows.", CURRENT_FUNCTION); + break; + } + } + else { + /*--- Incompressible flow, use pressure based method ---*/ + switch (config->GetKind_Upwind_Flow()) { + case UDS: + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { + numerics[iMGlevel][FLOW_SOL][conv_term] = new CUpwPB_Flow(nDim, nVar_Flow, config); + numerics[iMGlevel][FLOW_SOL][conv_bound_term] = new CUpwPB_Flow(nDim, nVar_Flow, config); + } + break; + default: + SU2_OMP_MASTER + SU2_MPI::Error("Invalid upwind scheme or not implemented.\n Currently, only UDS is available for pressure based incompressible flows.", CURRENT_FUNCTION); + break; + } } } break; @@ -1834,14 +1875,27 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } } if (incompressible) { - /*--- Incompressible flow, use preconditioning method ---*/ - 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); + if (!pressure_based) { + /*--- Incompressible flow, use preconditioning method ---*/ + 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 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); + } + else { + /*--- Incompressible flow, use pressure based method ---*/ + numerics[MESH_0][FLOW_SOL][visc_term] = new CAvgGradCorrectedPBInc_Flow(nDim, nVar_Flow, config); + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { + numerics[iMGlevel][FLOW_SOL][visc_term] = new CAvgGradPBInc_Flow(nDim, nVar_Flow, config); + } + + /*--- Definition of the boundary condition method ---*/ + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) + numerics[iMGlevel][FLOW_SOL][visc_bound_term] = new CAvgGradPBInc_Flow(nDim, nVar_Flow, config); + } } /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ @@ -2110,7 +2164,6 @@ 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 ---*/ @@ -2175,6 +2228,24 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol } } } + + /*--- Solver definition for the poisson/pressure correction problem ---*/ + if (poisson) { + /*--- Pressure correction (Poisson) equation ---*/ + numerics[MESH_0][POISSON_SOL][visc_term] = new CAvgGradCorrected_Poisson(nDim, nVar_Poisson, config); + + for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) + numerics[iMGlevel][POISSON_SOL][visc_term] = new CAvgGrad_Poisson(nDim, nVar_Poisson, config); + + /*--- Assign the convective boundary term as well to account for flow BCs as well --*/ + for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { + numerics[iMGlevel][POISSON_SOL][visc_bound_term] = new CAvgGrad_Poisson(nDim, nVar_Poisson, config); + + /*--- Definition of the source term integration scheme for each equation and mesh level ---*/ + numerics[iMGlevel][POISSON_SOL][source_first_term] = new CSource_PoissonFVM(nDim, nVar_Poisson, config); + numerics[iMGlevel][POISSON_SOL][source_second_term] = new CSourceNothing(nDim, nVar_Poisson, config); + } + } /*--- Solver definition for the radiation model problem ---*/ @@ -2943,8 +3014,7 @@ void CFluidDriver::StartSolver(){ DynamicMeshUpdate(Iter); } - /*--- Run a single iteration of the problem (fluid, elasticity, heat, ...). ---*/ - + /*--- Run a single iteration of the problem (fluid, elasticity, heat, ...). ---*/ Run(); /*--- Update the solution for dual time stepping strategy ---*/ @@ -3010,11 +3080,13 @@ void CFluidDriver::Preprocess(unsigned long Iter) { (config_container[iZone]->GetKind_Solver() == NEMO_EULER) || (config_container[iZone]->GetKind_Solver() == NEMO_NAVIER_STOKES) || (config_container[iZone]->GetKind_Solver() == RANS) || + (config_container[iZone]->GetKind_Solver() == INC_EULER) || (config_container[iZone]->GetKind_Solver() == INC_NAVIER_STOKES) || (config_container[iZone]->GetKind_Solver() == INC_RANS)) { for (iInst = 0; iInst < nInst[iZone]; iInst++) solver_container[iZone][iInst][MESH_0][FLOW_SOL]->SetInitialCondition(geometry_container[iZone][INST_0], solver_container[iZone][iInst], config_container[iZone], Iter); + } } } @@ -3069,6 +3141,7 @@ void CFluidDriver::Run() { for (iZone = 0; iZone < nZone; iZone++) { config_container[iZone]->SetInnerIter(IntIter); + cout<<"Calling Iterate"<Iterate(output_container[iZone], integration_container, geometry_container, solver_container, numerics_container, config_container, surface_movement, grid_movement, FFDBox, iZone, INST_0); } diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index b50ebdb7bd45..da1fc816f04d 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -186,6 +186,7 @@ void CIntegration::Space_Integration(CGeometry *geometry, } + void CIntegration::Time_Integration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep, unsigned short RunTime_EqSystem) { @@ -205,7 +206,6 @@ void CIntegration::Time_Integration(CGeometry *geometry, CSolver **solver_contai solver_container[MainSolver]->ImplicitEuler_Iteration(geometry, solver_container, config); break; } - } void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CConfig *config, unsigned short iMesh) { @@ -224,6 +224,9 @@ void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CCon geometry->nodes->SetCoord_n1(); geometry->nodes->SetCoord_n(); } + + if (config->GetKind_Incomp_System() == PRESSURE_BASED) + solver->SetMomentumCorrection_DualTime(); SU2_OMP_MASTER solver->ResetCFLAdapt(); diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp index 3dce54985d59..8e743d5e4edf 100644 --- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp +++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp @@ -761,3 +761,191 @@ void CMultiGridIntegration::Adjoint_Setup(CGeometry ****geometry, CSolver *****s } } + + +void CMultiGridIntegration::MultiGrid_CyclePB(CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + unsigned short iMesh, + unsigned short RecursiveParam, + unsigned short RunTime_EqSystem, + unsigned short iZone, + unsigned short iInst) { + /*--- Not using this routine for now. ---*/ + + unsigned short iPreSmooth, iPostSmooth, iRKStep, iRKLimit = 1, iCorr, nCorr = 1; + + //bool startup_multigrid = (config[iZone]->GetRestart_Flow() && (RunTime_EqSystem == RUNTIME_FLOW_SYS) && (Iteration == 0)); + //bool piso = true; + bool piso = (config[iZone]->GetKind_PBIter() == PISO); + unsigned short SolContainer_Position = config[iZone]->GetContainerPosition(RunTime_EqSystem); + bool periodic = (config[iZone]->GetnMarker_Periodic() > 0); + + /*--- Do a presmoothing on the grid iMesh to be restricted to the grid iMesh+1 ---*/ + + + for (iPreSmooth = 0; iPreSmooth < config[iZone]->GetMG_PreSmooth(iMesh); iPreSmooth++) { + + /*--- Momentum solve (Predict velocities using existing pressure field)---*/ + switch( config[iZone]->GetKind_Solver() ) { + case INC_EULER: + config[iZone]->SetGlobalParam(EULER, RUNTIME_FLOW_SYS); break; + + case INC_NAVIER_STOKES: + config[iZone]->SetGlobalParam(NAVIER_STOKES, RUNTIME_FLOW_SYS); break; + + case INC_RANS: + config[iZone]->SetGlobalParam(RANS, RUNTIME_FLOW_SYS); break; + } + + config[iZone]->SetKind_TimeIntScheme(config[iZone]->GetKind_TimeIntScheme_Flow()); + + CurrentGridIteration(geometry, solver, numerics, config, iMesh, RUNTIME_FLOW_SYS, iZone, iInst); + + /*--- Set source term for pressure correction equation based on current flow solution ---*/ + solver[iZone][iInst][iMesh][FLOW_SOL]->SetMomCoeff(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], periodic, iMesh); + + solver[iZone][iInst][iMesh][FLOW_SOL]->SetPoissonSourceTerm(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], iMesh); + + /*--- Solve the poisson equation (pressure correction) ---*/ + config[iZone]->SetGlobalParam(POISSON_EQUATION, RUNTIME_POISSON_SYS); + config[iZone]->SetKind_TimeIntScheme(config[iZone]->GetKind_TimeIntScheme_Poisson()); + + for (iCorr = 0; iCorr < nCorr; iCorr++) { + CurrentGridIteration(geometry, solver, numerics, config, iMesh, RUNTIME_POISSON_SYS, iZone, iInst); + } + + /*--- Correct pressure and velocities ---*/ + solver[iZone][iInst][iMesh][FLOW_SOL]->Flow_Correction(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone]); + + solver[iZone][iInst][iMesh][FLOW_SOL]->Postprocessing(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], iMesh); + + if (piso) { + config[iZone]->SetKind_TimeIntScheme(EULER_EXPLICIT); + + /*--- Momentum solve (Predict velocities using existing pressure field)---*/ + switch( config[iZone]->GetKind_Solver() ) { + case INC_EULER: + config[iZone]->SetGlobalParam(EULER, RUNTIME_FLOW_SYS); break; + + case INC_NAVIER_STOKES: + config[iZone]->SetGlobalParam(NAVIER_STOKES, RUNTIME_FLOW_SYS); break; + + case INC_RANS: + config[iZone]->SetGlobalParam(RANS, RUNTIME_FLOW_SYS); break; + } + + CurrentGridIteration(geometry, solver, numerics, config, iMesh, RUNTIME_FLOW_SYS, iZone, iInst); + + config[iZone]->SetKind_TimeIntScheme(config[iZone]->GetKind_TimeIntScheme_Flow()); + + /*--- Set source term for pressure correction equation based on current flow solution ---*/ + solver[iZone][iInst][iMesh][FLOW_SOL]->SetMomCoeff(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], periodic, iMesh); + + solver[iZone][iInst][iMesh][FLOW_SOL]->SetPoissonSourceTerm(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], iMesh); + + /*--- Solve the poisson equation (pressure correction) ---*/ + config[iZone]->SetGlobalParam(POISSON_EQUATION, RUNTIME_POISSON_SYS); + + config[iZone]->SetKind_TimeIntScheme(config[iZone]->GetKind_TimeIntScheme_Poisson()); + + CurrentGridIteration(geometry, solver, numerics, config, iMesh, RUNTIME_POISSON_SYS, iZone, iInst); + + /*--- Correct pressure and velocities ---*/ + solver[iZone][iInst][iMesh][FLOW_SOL]->Flow_Correction(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone]); + } + + } + /*--- Compute Forcing Term $P_(k+1) = I^(k+1)_k(P_k+F_k(u_k))-F_(k+1)(I^(k+1)_k u_k)$ and update solution for multigrid ---*/ + + if ( iMesh < config[iZone]->GetnMGLevels() ) { + + + /*--- Solution postsmoothing in the prolongated grid ---*/ + + for (iPostSmooth = 0; iPostSmooth < config[iZone]->GetMG_PostSmooth(iMesh); iPostSmooth++) { + + /*--- Momentum solve (Predict velocities using existing pressure field)---*/ + switch( config[iZone]->GetKind_Solver() ) { + case EULER: + config[iZone]->SetGlobalParam(EULER, RUNTIME_FLOW_SYS); break; + + case NAVIER_STOKES: + config[iZone]->SetGlobalParam(NAVIER_STOKES, RUNTIME_FLOW_SYS); break; + + case RANS: + config[iZone]->SetGlobalParam(RANS, RUNTIME_FLOW_SYS); break; + + } + + CurrentGridIteration(geometry, solver, numerics, config, + iMesh, RUNTIME_FLOW_SYS, + iZone, iInst); + + /*--- Set source term for pressure correction equation based on current flow solution ---*/ + solver[iZone][iInst][iMesh][FLOW_SOL]->SetMomCoeff(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], periodic, iMesh); + + solver[iZone][iInst][iMesh][FLOW_SOL]->SetPoissonSourceTerm(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], iMesh); + + + /*--- Solve the poisson equation (pressure correction) ---*/ + config[iZone]->SetGlobalParam(POISSON_EQUATION, RUNTIME_POISSON_SYS); + + CurrentGridIteration(geometry, solver, numerics, config, + iMesh, RUNTIME_POISSON_SYS, + iZone, iInst); + + + /*--- Correct pressure and velocities ---*/ + solver[iZone][iInst][iMesh][FLOW_SOL]->Flow_Correction(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone]); + } + } +} + +void CMultiGridIntegration::CurrentGridIteration(CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + unsigned short iMesh, + unsigned short RunTime_EqSystem, + unsigned short iZone, + unsigned short iInst) { + + unsigned short SolContainer_Position = config[iZone]->GetContainerPosition(RunTime_EqSystem); + su2double monitor = 0.0; + unsigned short FinestMesh = config[iZone]->GetFinestMesh(); + + + /*--- Send-Receive boundary conditions, and preprocessing ---*/ + + solver[iZone][iInst][iMesh][SolContainer_Position]->Preprocessing(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], iMesh, 0, RunTime_EqSystem, false); + + /*--- Set the old solution ---*/ + + solver[iZone][iInst][iMesh][SolContainer_Position]->Set_OldSolution(); + + /*--- Compute time step, max eigenvalue, and integration scheme (steady and unsteady problems) ---*/ + solver[iZone][iInst][iMesh][SolContainer_Position]->SetTime_Step(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], iMesh, config[iZone]->GetTimeIter()); + + /*--- Space integration ---*/ + Space_Integration(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], numerics[iZone][iInst][iMesh][SolContainer_Position], config[iZone], iMesh, NO_RK_ITER, RunTime_EqSystem); + + /*--- Time integration, update solution using the old solution plus the solution increment ---*/ + Time_Integration(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], NO_RK_ITER, RunTime_EqSystem); + + /*--- Send-Receive boundary conditions, and postprocessing ---*/ + solver[iZone][iInst][iMesh][SolContainer_Position]->Postprocessing(geometry[iZone][iInst][iMesh], solver[iZone][iInst][iMesh], config[iZone], iMesh); + + /*--- Compute adimensional parameters and the convergence monitor ---*/ + + switch (RunTime_EqSystem) { + case RUNTIME_POISSON_SYS: monitor = log10(solver[iZone][iInst][iMesh][POISSON_SOL]->GetRes_RMS(0)); break; + case RUNTIME_FLOW_SYS: monitor = log10(solver[iZone][iInst][iMesh][FLOW_SOL]->GetRes_RMS(0)); break; + } + + /*--- Convergence strategy ---*/ + + //Convergence_Monitoring(geometry[iZone][iInst][FinestMesh], config[iZone], Iteration, monitor, FinestMesh); + +} diff --git a/SU2_CFD/src/iteration/CIterationFactory.cpp b/SU2_CFD/src/iteration/CIterationFactory.cpp index 61b5106529e1..11d0f2da753a 100644 --- a/SU2_CFD/src/iteration/CIterationFactory.cpp +++ b/SU2_CFD/src/iteration/CIterationFactory.cpp @@ -32,6 +32,7 @@ #include "../../include/iteration/CDiscAdjFluidIteration.hpp" #include "../../include/iteration/CDiscAdjHeatIteration.hpp" #include "../../include/iteration/CFluidIteration.hpp" +#include "../../include/iteration/CPBFluidIteration.hpp" #include "../../include/iteration/CFEMFluidIteration.hpp" #include "../../include/iteration/CTurboIteration.hpp" #include "../../include/iteration/CHeatIteration.hpp" @@ -56,6 +57,11 @@ CIteration* CIterationFactory::CreateIteration(ENUM_MAIN_SOLVER kindSolver, cons iteration = new CTurboIteration(config); } + else if (config->GetKind_Incomp_System() == PRESSURE_BASED) { + if (rank == MASTER_NODE) + cout<<"Pressure based fluid iteration."<. + */ + +#include "../../include/iteration/CPBFluidIteration.hpp" +#include "../../include/output/COutput.hpp" + +CPBFluidIteration::CPBFluidIteration(const CConfig *config) : CFluidIteration(config) { } + +void CPBFluidIteration::Preprocess(COutput *output, + CIntegration ****integration_container, + CGeometry ****geometry_container, + CSolver *****solver_container, + CNumerics ******numerics_container, + CConfig **config_container, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } + +void CPBFluidIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + unsigned long InnerIter, TimeIter; + unsigned short FinestMesh = config[val_iZone]->GetFinestMesh(); + bool unsteady = (config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND); + bool frozen_visc = (config[val_iZone]->GetContinuous_Adjoint() && config[val_iZone]->GetFrozen_Visc_Cont()) || + (config[val_iZone]->GetDiscrete_Adjoint() && config[val_iZone]->GetFrozen_Visc_Disc()); + bool periodic = (config[val_iZone]->GetnMarker_Periodic() > 0); + TimeIter = config[val_iZone]->GetTimeIter(); + + /* --- Setting up iteration values depending on if this is a + steady or an unsteady simulaiton */ + + InnerIter = config[val_iZone]->GetInnerIter(); + + /*--- Solve the Euler, Navier-Stokes or Reynolds-averaged Navier-Stokes (RANS) equations ---*/ + + switch( config[val_iZone]->GetKind_Solver() ) { + case INC_EULER: + config[val_iZone]->SetGlobalParam(EULER, RUNTIME_FLOW_SYS); break; + + case INC_NAVIER_STOKES: + config[val_iZone]->SetGlobalParam(NAVIER_STOKES, RUNTIME_FLOW_SYS); break; + + case INC_RANS: + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_FLOW_SYS); break; + } + + /*--- Solve the momentum equations. ---*/ + integration[val_iZone][val_iInst][FLOW_SOL]->CurrentGridIteration(geometry, solver, numerics, config, FinestMesh, RUNTIME_FLOW_SYS, val_iZone,val_iInst); + + + /*--- Set source term for pressure correction equation based on current flow solution ---*/ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetMomCoeff(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], periodic, MESH_0); + + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetPoissonSourceTerm(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], MESH_0); + + + /*--- Solve the poisson equation ---*/ + config[val_iZone]->SetGlobalParam(POISSON_EQUATION, RUNTIME_POISSON_SYS); + + integration[val_iZone][val_iInst][POISSON_SOL]->CurrentGridIteration(geometry, solver, numerics, config, FinestMesh, RUNTIME_POISSON_SYS, val_iZone,val_iInst); + //integration[val_iZone][val_iInst][POISSON_SOL]->MultiGrid_Iteration(geometry, solver, numerics, config, RUNTIME_POISSON_SYS, ExtIter, val_iZone,val_iInst); + + /*--- Correct pressure and velocities ---*/ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Flow_Correction(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + /*--- Set the prmitive value based on updated solution ---*/ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Postprocessing(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], MESH_0); + + /*integration[val_iZone][val_iInst][FLOW_SOL]->MultiGrid_CyclePB(geometry, solver, numerics, + config, FinestMesh, 0, RUNTIME_FLOW_SYS, val_iZone,val_iInst);*/ + + if (config[val_iZone]->GetKind_Solver() == INC_RANS) { + + /*--- Solve the turbulence model ---*/ + + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_TURB_SYS); + integration[val_iZone][val_iInst][TURB_SOL]->SingleGrid_Iteration(geometry, solver, numerics, config, RUNTIME_TURB_SYS, val_iZone, val_iInst); + + /*--- Solve transition model ---*/ + + if (config[val_iZone]->GetKind_Trans_Model() == LM) { + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_TRANS_SYS); + integration[val_iZone][val_iInst][TRANS_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_TRANS_SYS, val_iZone, val_iInst); + } + } + + + /*--- Calculate the inviscid and viscous forces ---*/ + + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Pressure_Forces(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Momentum_Forces(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Friction_Forces(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + + /*--- Write the convergence history ---*/ + + /*if ( unsteady && !config[val_iZone]->GetDiscrete_Adjoint() ) + output->SetConvHistory_Body(NULL, geometry, solver, config, integration, true, 0.0, val_iZone,val_iInst);*/ + +} diff --git a/SU2_CFD/src/iteration_structure.cpp b/SU2_CFD/src/iteration_structure.cpp new file mode 100644 index 000000000000..3b83caae78ac --- /dev/null +++ b/SU2_CFD/src/iteration_structure.cpp @@ -0,0 +1,3336 @@ +/*! + * \file iteration_structure.cpp + * \brief Main subroutines used by SU2_CFD + * \author F. Palacios, T. Economon + * \version 7.0.4 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + + +#include "../include/iteration_structure.hpp" +#include "../include/solvers/CFEASolver.hpp" + +CIteration::CIteration(CConfig *config) { + rank = SU2_MPI::GetRank(); + size = SU2_MPI::GetSize(); + + nInst = config->GetnTimeInstances(); + nZone = config->GetnZone(); + + multizone = config->GetMultizone_Problem(); + singlezone = !(config->GetMultizone_Problem()); + +} + +CIteration::~CIteration(void) { } + +void CIteration::SetGrid_Movement(CGeometry **geometry, + CSurfaceMovement *surface_movement, + CVolumetricMovement *grid_movement, + CSolver ***solver, + CConfig *config, + unsigned long IntIter, + unsigned long TimeIter) { + + unsigned short Kind_Grid_Movement = config->GetKind_GridMovement(); + unsigned long nIterMesh; + bool stat_mesh = true; + bool adjoint = config->GetContinuous_Adjoint(); + + /*--- Only write to screen if this option is enabled ---*/ + bool Screen_Output = config->GetDeform_Output(); + + unsigned short val_iZone = config->GetiZone(); + + /*--- Perform mesh movement depending on specified type ---*/ + switch (Kind_Grid_Movement) { + + case RIGID_MOTION: + + if (rank == MASTER_NODE) + cout << endl << " Performing rigid mesh transformation." << endl; + + /*--- Move each node in the volume mesh using the specified type + of rigid mesh motion. These routines also compute analytic grid + velocities for the fine mesh. ---*/ + + grid_movement->Rigid_Translation(geometry[MESH_0], config, val_iZone, TimeIter); + grid_movement->Rigid_Plunging(geometry[MESH_0], config, val_iZone, TimeIter); + grid_movement->Rigid_Pitching(geometry[MESH_0], config, val_iZone, TimeIter); + grid_movement->Rigid_Rotation(geometry[MESH_0], config, val_iZone, TimeIter); + + /*--- Update the multigrid structure after moving the finest grid, + including computing the grid velocities on the coarser levels. ---*/ + + grid_movement->UpdateMultiGrid(geometry, config); + + break; + + /*--- Already initialized in the static mesh movement routine at driver level. ---*/ + case STEADY_TRANSLATION: + case ROTATING_FRAME: + break; + + } + + if (config->GetSurface_Movement(AEROELASTIC) || + config->GetSurface_Movement(AEROELASTIC_RIGID_MOTION)) { + + /*--- Apply rigid mesh transformation to entire grid first, if necessary ---*/ + if (IntIter == 0) { + if (Kind_Grid_Movement == AEROELASTIC_RIGID_MOTION) { + + if (rank == MASTER_NODE) + cout << endl << " Performing rigid mesh transformation." << endl; + + /*--- Move each node in the volume mesh using the specified type + of rigid mesh motion. These routines also compute analytic grid + velocities for the fine mesh. ---*/ + + grid_movement->Rigid_Translation(geometry[MESH_0], config, val_iZone, TimeIter); + grid_movement->Rigid_Plunging(geometry[MESH_0], config, val_iZone, TimeIter); + grid_movement->Rigid_Pitching(geometry[MESH_0], config, val_iZone, TimeIter); + grid_movement->Rigid_Rotation(geometry[MESH_0], config, val_iZone, TimeIter); + + /*--- Update the multigrid structure after moving the finest grid, + including computing the grid velocities on the coarser levels. ---*/ + + grid_movement->UpdateMultiGrid(geometry, config); + } + + } + + /*--- Use the if statement to move the grid only at selected dual time step iterations. ---*/ + else if (IntIter % config->GetAeroelasticIter() == 0) { + + if (rank == MASTER_NODE) + cout << endl << " Solving aeroelastic equations and updating surface positions." << endl; + + /*--- Solve the aeroelastic equations for the new node locations of the moving markers(surfaces) ---*/ + + solver[MESH_0][FLOW_SOL]->Aeroelastic(surface_movement, geometry[MESH_0], config, TimeIter); + + /*--- Deform the volume grid around the new boundary locations ---*/ + + if (rank == MASTER_NODE) + cout << " Deforming the volume grid due to the aeroelastic movement." << endl; + grid_movement->SetVolume_Deformation(geometry[MESH_0], config, true); + + /*--- Update the grid velocities on the fine mesh using finite + differencing based on node coordinates at previous times. ---*/ + + if (rank == MASTER_NODE) + cout << " Computing grid velocities by finite differencing." << endl; + geometry[MESH_0]->SetGridVelocity(config, TimeIter); + + /*--- Update the multigrid structure after moving the finest grid, + including computing the grid velocities on the coarser levels. ---*/ + + grid_movement->UpdateMultiGrid(geometry, config); + } + + } + + if (config->GetSurface_Movement(FLUID_STRUCTURE)) { + if (rank == MASTER_NODE && Screen_Output) + cout << endl << "Deforming the grid for Fluid-Structure Interaction applications." << endl; + + /*--- Deform the volume grid around the new boundary locations ---*/ + + if (rank == MASTER_NODE && Screen_Output) + cout << "Deforming the volume grid." << endl; + grid_movement->SetVolume_Deformation(geometry[MESH_0], config, true, false); + + nIterMesh = grid_movement->Get_nIterMesh(); + stat_mesh = (nIterMesh == 0); + + if (!adjoint && !stat_mesh) { + if (rank == MASTER_NODE && Screen_Output) + cout << "Computing grid velocities by finite differencing." << endl; + geometry[MESH_0]->SetGridVelocity(config, TimeIter); + } + else if (stat_mesh) { + if (rank == MASTER_NODE && Screen_Output) + cout << "The mesh is up-to-date. Using previously stored grid velocities." << endl; + } + + /*--- Update the multigrid structure after moving the finest grid, + including computing the grid velocities on the coarser levels. ---*/ + + grid_movement->UpdateMultiGrid(geometry, config); + + } + + if (config->GetSurface_Movement(EXTERNAL) || + config->GetSurface_Movement(EXTERNAL_ROTATION)) { + + /*--- Apply rigid rotation to entire grid first, if necessary ---*/ + + if (Kind_Grid_Movement == EXTERNAL_ROTATION) { + if (rank == MASTER_NODE) + cout << " Updating node locations by rigid rotation." << endl; + grid_movement->Rigid_Rotation(geometry[MESH_0], config, val_iZone, TimeIter); + } + + /*--- Load new surface node locations from external files ---*/ + + if (rank == MASTER_NODE) + cout << " Updating surface locations from file." << endl; + surface_movement->SetExternal_Deformation(geometry[MESH_0], config, val_iZone, TimeIter); + + /*--- Deform the volume grid around the new boundary locations ---*/ + + if (rank == MASTER_NODE) + cout << " Deforming the volume grid." << endl; + grid_movement->SetVolume_Deformation(geometry[MESH_0], config, true); + + /*--- Update the grid velocities on the fine mesh using finite + differencing based on node coordinates at previous times. ---*/ + + if (!adjoint) { + if (rank == MASTER_NODE) + cout << " Computing grid velocities by finite differencing." << endl; + geometry[MESH_0]->SetGridVelocity(config, TimeIter); + } + + /*--- Update the multigrid structure after moving the finest grid, + including computing the grid velocities on the coarser levels. ---*/ + + grid_movement->UpdateMultiGrid(geometry, config); + + } + +} + +void CIteration::SetMesh_Deformation(CGeometry **geometry, + CSolver **solver, + CNumerics ***numerics, + CConfig *config, + unsigned short kind_recording) { + + if (!config->GetDeform_Mesh()) return; + + /*--- Perform the elasticity mesh movement ---*/ + + const bool ActiveTape = AD::TapeActive(); + + if ((kind_recording != MESH_DEFORM) && !config->GetMultizone_Problem()) { + /*--- In a primal run, AD::TapeActive returns a false ---*/ + /*--- In any other recordings, the tape is passive during the deformation. ---*/ + AD::StopRecording(); + } + + /*--- Set the stiffness of each element mesh into the mesh numerics ---*/ + + solver[MESH_SOL]->SetMesh_Stiffness(geometry, numerics[MESH_SOL], config); + + /*--- Deform the volume grid around the new boundary locations ---*/ + + solver[MESH_SOL]->DeformMesh(geometry, numerics[MESH_SOL], config); + + /*--- Continue recording. ---*/ + if (ActiveTape) AD::StartRecording(); + +} + +void CIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } +void CIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } +void CIteration::Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } +void CIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } +void CIteration::Predictor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } +void CIteration::Relaxation(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } +bool CIteration::Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { return false; } + +void CIteration::Output(COutput *output, + CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned long InnerIter, + bool StopCalc, + unsigned short val_iZone, + unsigned short val_iInst) { + + output->SetResult_Files(geometry[val_iZone][INST_0][MESH_0], + config[val_iZone], + solver[val_iZone][INST_0][MESH_0], + InnerIter); + +} +void CIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } + + + +CFluidIteration::CFluidIteration(CConfig *config) : CIteration(config) { } +CFluidIteration::~CFluidIteration(void) { } + +void CFluidIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned long TimeIter = config[val_iZone]->GetTimeIter(); + + bool fsi = config[val_iZone]->GetFSI_Simulation(); + unsigned long OuterIter = config[val_iZone]->GetOuterIter(); + + + /*--- Set the initial condition for FSI problems with subiterations ---*/ + /*--- This is done only in the first block subiteration.---*/ + /*--- From then on, the solver reuses the partially converged solution obtained in the previous subiteration ---*/ + if( fsi && ( OuterIter == 0 ) ){ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetInitialCondition(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], TimeIter); + } + + /*--- Apply a Wind Gust ---*/ + + if (config[val_iZone]->GetWind_Gust()) { + SetWind_GustField(config[val_iZone], geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst]); + } + +} + +void CFluidIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + unsigned long InnerIter, TimeIter; + + bool unsteady = (config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND); + bool frozen_visc = (config[val_iZone]->GetContinuous_Adjoint() && config[val_iZone]->GetFrozen_Visc_Cont()) || + (config[val_iZone]->GetDiscrete_Adjoint() && config[val_iZone]->GetFrozen_Visc_Disc()); + TimeIter = config[val_iZone]->GetTimeIter(); + + /* --- Setting up iteration values depending on if this is a + steady or an unsteady simulaiton */ + + InnerIter = config[val_iZone]->GetInnerIter(); + + /*--- Update global parameters ---*/ + + switch( config[val_iZone]->GetKind_Solver() ) { + + case EULER: case DISC_ADJ_EULER: case INC_EULER: case DISC_ADJ_INC_EULER: + config[val_iZone]->SetGlobalParam(EULER, RUNTIME_FLOW_SYS); break; + + case NAVIER_STOKES: case DISC_ADJ_NAVIER_STOKES: case INC_NAVIER_STOKES: case DISC_ADJ_INC_NAVIER_STOKES: + config[val_iZone]->SetGlobalParam(NAVIER_STOKES, RUNTIME_FLOW_SYS); break; + + case RANS: case DISC_ADJ_RANS: case INC_RANS: case DISC_ADJ_INC_RANS: + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_FLOW_SYS); break; + + } + + + /*--- Solve the Euler, Navier-Stokes or Reynolds-averaged Navier-Stokes (RANS) equations (one iteration) ---*/ + + integration[val_iZone][val_iInst][FLOW_SOL]->MultiGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_FLOW_SYS, val_iZone, val_iInst); + + if ((config[val_iZone]->GetKind_Solver() == RANS || + config[val_iZone]->GetKind_Solver() == DISC_ADJ_RANS || + config[val_iZone]->GetKind_Solver() == INC_RANS || + config[val_iZone]->GetKind_Solver() == DISC_ADJ_INC_RANS ) && !frozen_visc) { + + /*--- Solve the turbulence model ---*/ + + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_TURB_SYS); + integration[val_iZone][val_iInst][TURB_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_TURB_SYS, val_iZone, val_iInst); + + /*--- Solve transition model ---*/ + + if (config[val_iZone]->GetKind_Trans_Model() == LM) { + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_TRANS_SYS); + integration[val_iZone][val_iInst][TRANS_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_TRANS_SYS, val_iZone, val_iInst); + } + + } + + if (config[val_iZone]->GetWeakly_Coupled_Heat()){ + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_HEAT_SYS); + integration[val_iZone][val_iInst][HEAT_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_HEAT_SYS, val_iZone, val_iInst); + } + + /*--- Incorporate a weakly-coupled radiation model to the analysis ---*/ + if (config[val_iZone]->AddRadiation()){ + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_RADIATION_SYS); + integration[val_iZone][val_iInst][RAD_SOL]->SingleGrid_Iteration(geometry, solver, numerics, config, + RUNTIME_RADIATION_SYS, val_iZone, val_iInst); + } + + /*--- Adapt the CFL number using an exponential progression with under-relaxation approach. ---*/ + + if (config[val_iZone]->GetCFL_Adapt() == YES) { + SU2_OMP_PARALLEL + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->AdaptCFLNumber(geometry[val_iZone][val_iInst], + solver[val_iZone][val_iInst], config[val_iZone]); + } + + /*--- Call Dynamic mesh update if AEROELASTIC motion was specified ---*/ + + if ((config[val_iZone]->GetGrid_Movement()) && (config[val_iZone]->GetAeroelastic_Simulation()) && unsteady) { + + SetGrid_Movement(geometry[val_iZone][val_iInst], surface_movement[val_iZone], grid_movement[val_iZone][val_iInst], + solver[val_iZone][val_iInst], config[val_iZone], InnerIter, TimeIter); + + /*--- Apply a Wind Gust ---*/ + + if (config[val_iZone]->GetWind_Gust()) { + if (InnerIter % config[val_iZone]->GetAeroelasticIter() == 0 && InnerIter != 0) + SetWind_GustField(config[val_iZone], geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst]); + } + + } +} + +void CFluidIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned short iMesh; + + /*--- Dual time stepping strategy ---*/ + + if ((config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || + (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND)) { + + /*--- Update dual time solver on all mesh levels ---*/ + + for (iMesh = 0; iMesh <= config[val_iZone]->GetnMGLevels(); iMesh++) { + integration[val_iZone][val_iInst][FLOW_SOL]->SetDualTime_Solver(geometry[val_iZone][val_iInst][iMesh], solver[val_iZone][val_iInst][iMesh][FLOW_SOL], config[val_iZone], iMesh); + integration[val_iZone][val_iInst][FLOW_SOL]->SetConvergence(false); + } + + /*--- Update dual time solver for the dynamic mesh solver ---*/ + if (config[val_iZone]->GetDeform_Mesh()) { + solver[val_iZone][val_iInst][MESH_0][MESH_SOL]->SetDualTime_Mesh(); + } + + /*--- Update dual time solver for the turbulence model ---*/ + + if ((config[val_iZone]->GetKind_Solver() == RANS) || + (config[val_iZone]->GetKind_Solver() == DISC_ADJ_RANS) || + (config[val_iZone]->GetKind_Solver() == INC_RANS) || + (config[val_iZone]->GetKind_Solver() == DISC_ADJ_INC_RANS)) { + integration[val_iZone][val_iInst][TURB_SOL]->SetDualTime_Solver(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0][TURB_SOL], config[val_iZone], MESH_0); + integration[val_iZone][val_iInst][TURB_SOL]->SetConvergence(false); + } + + /*--- Update dual time solver for the transition model ---*/ + + if (config[val_iZone]->GetKind_Trans_Model() == LM) { + integration[val_iZone][val_iInst][TRANS_SOL]->SetDualTime_Solver(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0][TRANS_SOL], config[val_iZone], MESH_0); + integration[val_iZone][val_iInst][TRANS_SOL]->SetConvergence(false); + } + } +} + +bool CFluidIteration::Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + bool StopCalc = false; + + StopTime = SU2_MPI::Wtime(); + + UsedTime = StopTime - StartTime; + + + if (config[val_iZone]->GetMultizone_Problem() || config[val_iZone]->GetSinglezone_Driver()){ + output->SetHistory_Output(geometry[val_iZone][INST_0][MESH_0], + solver[val_iZone][INST_0][MESH_0], + config[val_iZone], + config[val_iZone]->GetTimeIter(), + config[val_iZone]->GetOuterIter(), + config[val_iZone]->GetInnerIter()); + } + + /*--- If convergence was reached --*/ + StopCalc = output->GetConvergence(); + + /* --- Checking convergence of Fixed CL mode to target CL, and perform finite differencing if needed --*/ + + if (config[val_iZone]->GetFixed_CL_Mode()){ + StopCalc = MonitorFixed_CL(output, geometry[val_iZone][INST_0][MESH_0], solver[val_iZone][INST_0][MESH_0], config[val_iZone]); + } + + return StopCalc; + +} + +void CFluidIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Temporary: enable only for single-zone driver. This should be removed eventually when generalized. ---*/ + + if(config[val_iZone]->GetSinglezone_Driver()){ + + /*--- Compute the tractions at the vertices ---*/ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->ComputeVertexTractions( + geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + if (config[val_iZone]->GetKind_Solver() == DISC_ADJ_EULER || + config[val_iZone]->GetKind_Solver() == DISC_ADJ_NAVIER_STOKES || + config[val_iZone]->GetKind_Solver() == DISC_ADJ_RANS){ + + /*--- Read the target pressure ---*/ + +// if (config[val_iZone]->GetInvDesign_Cp() == YES) +// output->SetCp_InverseDesign(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL],geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], config[val_iZone]->GetExtIter()); + +// /*--- Read the target heat flux ---*/ + +// if (config[val_iZone]->GetInvDesign_HeatFlux() == YES) +// output->SetHeatFlux_InverseDesign(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL],geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], config[val_iZone]->GetExtIter()); + + } + + } + + +} + +void CFluidIteration::Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Boolean to determine if we are running a static or dynamic case ---*/ + bool steady = !config[val_iZone]->GetTime_Domain(); + + unsigned long Inner_Iter, nInner_Iter = config[val_iZone]->GetnInner_Iter(); + bool StopCalc = false; + + /*--- Synchronization point before a single solver iteration. + Compute the wall clock time required. ---*/ + + StartTime = SU2_MPI::Wtime(); + + /*--- Preprocess the solver ---*/ + Preprocess(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + /*--- For steady-state flow simulations, we need to loop over ExtIter for the number of time steps ---*/ + /*--- However, ExtIter is the number of FSI iterations, so nIntIter is used in this case ---*/ + + for (Inner_Iter = 0; Inner_Iter < nInner_Iter; Inner_Iter++){ + + config[val_iZone]->SetInnerIter(Inner_Iter); + + /*--- Run a single iteration of the solver ---*/ + Iterate(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + /*--- Monitor the pseudo-time ---*/ + StopCalc = Monitor(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + /*--- Output files at intermediate iterations if the problem is single zone ---*/ + + if (singlezone && steady) { + Output(output, geometry, solver, config, Inner_Iter, StopCalc, val_iZone, val_iInst); + } + + /*--- If the iteration has converged, break the loop ---*/ + if (StopCalc) break; + } + + if (multizone && steady) { + Output(output, geometry, solver, config, + config[val_iZone]->GetOuterIter(), + StopCalc, val_iZone, val_iInst); + + /*--- Set the fluid convergence to false (to make sure outer subiterations converge) ---*/ + + integration[val_iZone][INST_0][FLOW_SOL]->SetConvergence(false); + } +} + +void CFluidIteration::SetWind_GustField(CConfig *config, CGeometry **geometry, CSolver ***solver) { + // The gust is imposed on the flow field via the grid velocities. This method called the Field Velocity Method is described in the + // NASA TM–2012-217771 - Development, Verification and Use of Gust Modeling in the NASA Computational Fluid Dynamics Code FUN3D + // the desired gust is prescribed as the negative of the grid velocity. + + // If a source term is included to account for the gust field, the method is described by Jones et al. as the Split Velocity Method in + // Simulation of Airfoil Gust Responses Using Prescribed Velocities. + // In this routine the gust derivatives needed for the source term are calculated when applicable. + // If the gust derivatives are zero the source term is also zero. + // The source term itself is implemented in the class CSourceWindGust + + if (rank == MASTER_NODE) + cout << endl << "Running simulation with a Wind Gust." << endl; + unsigned short iDim, nDim = geometry[MESH_0]->GetnDim(); //We assume nDim = 2 + if (nDim != 2) { + if (rank == MASTER_NODE) { + cout << endl << "WARNING - Wind Gust capability is only verified for 2 dimensional simulations." << endl; + } + } + + /*--- Gust Parameters from config ---*/ + unsigned short Gust_Type = config->GetGust_Type(); + su2double xbegin = config->GetGust_Begin_Loc(); // Location at which the gust begins. + su2double L = config->GetGust_WaveLength(); // Gust size + su2double tbegin = config->GetGust_Begin_Time(); // Physical time at which the gust begins. + su2double gust_amp = config->GetGust_Ampl(); // Gust amplitude + su2double n = config->GetGust_Periods(); // Number of gust periods + unsigned short GustDir = config->GetGust_Dir(); // Gust direction + + /*--- Variables needed to compute the gust ---*/ + unsigned short Kind_Grid_Movement = config->GetKind_GridMovement(); + unsigned long iPoint; + unsigned short iMGlevel, nMGlevel = config->GetnMGLevels(); + + su2double x, y, x_gust, dgust_dx, dgust_dy, dgust_dt; + su2double *Gust, *GridVel, *NewGridVel, *GustDer; + + su2double Physical_dt = config->GetDelta_UnstTime(); + unsigned long TimeIter = config->GetTimeIter(); + su2double Physical_t = TimeIter*Physical_dt; + + su2double Uinf = solver[MESH_0][FLOW_SOL]->GetVelocity_Inf(0); // Assumption gust moves at infinity velocity + + Gust = new su2double [nDim]; + NewGridVel = new su2double [nDim]; + for (iDim = 0; iDim < nDim; iDim++) { + Gust[iDim] = 0.0; + NewGridVel[iDim] = 0.0; + } + + GustDer = new su2double [3]; + for (unsigned short i = 0; i < 3; i++) { + GustDer[i] = 0.0; + } + + // Vortex variables + unsigned long nVortex = 0; + vector x0, y0, vort_strenth, r_core; //vortex is positive in clockwise direction. + if (Gust_Type == VORTEX) { + InitializeVortexDistribution(nVortex, x0, y0, vort_strenth, r_core); + } + + /*--- Check to make sure gust lenght is not zero or negative (vortex gust doesn't use this). ---*/ + if (L <= 0.0 && Gust_Type != VORTEX) { + SU2_MPI::Error("The gust length needs to be positive", CURRENT_FUNCTION); + } + + /*--- Loop over all multigrid levels ---*/ + + for (iMGlevel = 0; iMGlevel <= nMGlevel; iMGlevel++) { + + /*--- Loop over each node in the volume mesh ---*/ + + for (iPoint = 0; iPoint < geometry[iMGlevel]->GetnPoint(); iPoint++) { + + /*--- Reset the Grid Velocity to zero if there is no grid movement ---*/ + if (Kind_Grid_Movement == GUST) { + for (iDim = 0; iDim < nDim; iDim++) + geometry[iMGlevel]->nodes->SetGridVel(iPoint, iDim, 0.0); + } + + /*--- initialize the gust and derivatives to zero everywhere ---*/ + + for (iDim = 0; iDim < nDim; iDim++) {Gust[iDim]=0.0;} + dgust_dx = 0.0; dgust_dy = 0.0; dgust_dt = 0.0; + + /*--- Begin applying the gust ---*/ + + if (Physical_t >= tbegin) { + + x = geometry[iMGlevel]->nodes->GetCoord(iPoint)[0]; // x-location of the node. + y = geometry[iMGlevel]->nodes->GetCoord(iPoint)[1]; // y-location of the node. + + // Gust coordinate + x_gust = (x - xbegin - Uinf*(Physical_t-tbegin))/L; + + /*--- Calculate the specified gust ---*/ + switch (Gust_Type) { + + case TOP_HAT: + // Check if we are in the region where the gust is active + if (x_gust > 0 && x_gust < n) { + Gust[GustDir] = gust_amp; + // Still need to put the gust derivatives. Think about this. + } + break; + + case SINE: + // Check if we are in the region where the gust is active + if (x_gust > 0 && x_gust < n) { + Gust[GustDir] = gust_amp*(sin(2*PI_NUMBER*x_gust)); + + // Gust derivatives + //dgust_dx = gust_amp*2*PI_NUMBER*(cos(2*PI_NUMBER*x_gust))/L; + //dgust_dy = 0; + //dgust_dt = gust_amp*2*PI_NUMBER*(cos(2*PI_NUMBER*x_gust))*(-Uinf)/L; + } + break; + + case ONE_M_COSINE: + // Check if we are in the region where the gust is active + if (x_gust > 0 && x_gust < n) { + Gust[GustDir] = gust_amp*(1-cos(2*PI_NUMBER*x_gust)); + + // Gust derivatives + //dgust_dx = gust_amp*2*PI_NUMBER*(sin(2*PI_NUMBER*x_gust))/L; + //dgust_dy = 0; + //dgust_dt = gust_amp*2*PI_NUMBER*(sin(2*PI_NUMBER*x_gust))*(-Uinf)/L; + } + break; + + case EOG: + // Check if we are in the region where the gust is active + if (x_gust > 0 && x_gust < n) { + Gust[GustDir] = -0.37*gust_amp*sin(3*PI_NUMBER*x_gust)*(1-cos(2*PI_NUMBER*x_gust)); + } + break; + + case VORTEX: + + /*--- Use vortex distribution ---*/ + // Algebraic vortex equation. + for (unsigned long i=0; iGetNodes()->SetWindGust(iPoint, Gust); + solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGustDer(iPoint, GustDer); + + GridVel = geometry[iMGlevel]->nodes->GetGridVel(iPoint); + + /*--- Store new grid velocity ---*/ + + for (iDim = 0; iDim < nDim; iDim++) { + NewGridVel[iDim] = GridVel[iDim] - Gust[iDim]; + geometry[iMGlevel]->nodes->SetGridVel(iPoint, iDim, NewGridVel[iDim]); + } + + } + } + + delete [] Gust; + delete [] GustDer; + delete [] NewGridVel; + +} + +void CFluidIteration::InitializeVortexDistribution(unsigned long &nVortex, vector& x0, vector& y0, vector& vort_strength, vector& r_core) { + /*--- Read in Vortex Distribution ---*/ + std::string line; + std::ifstream file; + su2double x_temp, y_temp, vort_strength_temp, r_core_temp; + file.open("vortex_distribution.txt"); + /*--- In case there is no vortex file ---*/ + if (file.fail()) { + SU2_MPI::Error("There is no vortex data file!!", CURRENT_FUNCTION); + } + + // Ignore line containing the header + getline(file, line); + // Read in the information of the vortices (xloc, yloc, lambda(strength), eta(size, gradient)) + while (file.good()) + { + getline(file, line); + std::stringstream ss(line); + if (line.size() != 0) { //ignore blank lines if they exist. + ss >> x_temp; + ss >> y_temp; + ss >> vort_strength_temp; + ss >> r_core_temp; + x0.push_back(x_temp); + y0.push_back(y_temp); + vort_strength.push_back(vort_strength_temp); + r_core.push_back(r_core_temp); + } + } + file.close(); + // number of vortices + nVortex = x0.size(); + +} + +bool CFluidIteration::MonitorFixed_CL(COutput *output, CGeometry *geometry, CSolver **solver, CConfig *config) { + + CSolver* flow_solver= solver[FLOW_SOL]; + + bool fixed_cl_convergence = flow_solver->FixedCL_Convergence(config, output->GetConvergence()); + + /* --- If Fixed CL mode has ended and Finite Differencing has started: --- */ + + if (flow_solver->GetStart_AoA_FD() && flow_solver->GetIter_Update_AoA() == config->GetInnerIter()){ + + /* --- Print convergence history and volume files since fixed CL mode has converged--- */ + if (rank == MASTER_NODE) output->PrintConvergenceSummary(); + + output->SetResult_Files(geometry, config, solver, + config->GetInnerIter(), true); + + /* --- Set finite difference mode in config (disables output) --- */ + config->SetFinite_Difference_Mode(true); + } + + /* --- Set convergence based on fixed CL convergence --- */ + return fixed_cl_convergence; +} + +CPBFluidIteration::CPBFluidIteration(CConfig *config) : CFluidIteration(config) { } +CPBFluidIteration::~CPBFluidIteration(void) { } + +void CPBFluidIteration::Preprocess(COutput *output, + CIntegration ****integration_container, + CGeometry ****geometry_container, + CSolver *****solver_container, + CNumerics ******numerics_container, + CConfig **config_container, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + } + +void CPBFluidIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + unsigned long InnerIter, TimeIter; + unsigned short FinestMesh = config[val_iZone]->GetFinestMesh(); + bool unsteady = (config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND); + bool frozen_visc = (config[val_iZone]->GetContinuous_Adjoint() && config[val_iZone]->GetFrozen_Visc_Cont()) || + (config[val_iZone]->GetDiscrete_Adjoint() && config[val_iZone]->GetFrozen_Visc_Disc()); + TimeIter = config[val_iZone]->GetTimeIter(); + + /* --- Setting up iteration values depending on if this is a + steady or an unsteady simulaiton */ + + InnerIter = config[val_iZone]->GetInnerIter(); + + /*--- Solve the Euler, Navier-Stokes or Reynolds-averaged Navier-Stokes (RANS) equations ---*/ + + switch( config[val_iZone]->GetKind_Solver() ) { + case INC_EULER: + config[val_iZone]->SetGlobalParam(EULER, RUNTIME_FLOW_SYS); break; + + case INC_NAVIER_STOKES: + config[val_iZone]->SetGlobalParam(NAVIER_STOKES, RUNTIME_FLOW_SYS); break; + + case INC_RANS: + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_FLOW_SYS); break; + } + + /*--- Solve the momentum equations. ---*/ + /*integration_container[val_iZone][val_iInst][FLOW_SOL]->SingleGrid_Iteration(geometry_container, solver_container, numerics_container, + config_container, RUNTIME_FLOW_SYS, MassIter, val_iZone,val_iInst); */ + //integration[val_iZone][val_iInst][FLOW_SOL]->CurrentGridIteration(geometry, solver, numerics, + // config, FinestMesh, RUNTIME_FLOW_SYS, ExtIter, val_iZone,val_iInst); + + + /*--- Set source term for pressure correction equation based on current flow solution ---*/ + //solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetMomCoeff(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], false, MESH_0); + + //solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetPoissonSourceTerm(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], MESH_0); + + + /*--- Solve the poisson equation ---*/ + //config[val_iZone]->SetGlobalParam(POISSON_EQUATION, RUNTIME_POISSON_SYS, ExtIter); + + /*integration_container[val_iZone][val_iInst][POISSON_SOL]->SingleGrid_Iteration(geometry_container, solver_container, numerics_container, + config_container, RUNTIME_POISSON_SYS, PressureIter, val_iZone,val_iInst);*/ + + //integration[val_iZone][val_iInst][POISSON_SOL]->CurrentGridIteration(geometry, solver, numerics, config, FinestMesh, RUNTIME_POISSON_SYS, PressureIter, val_iZone,val_iInst); + //integration[val_iZone][val_iInst][POISSON_SOL]->MultiGrid_Iteration(geometry, solver, numerics, config, RUNTIME_POISSON_SYS, ExtIter, val_iZone,val_iInst); + + /*--- Correct pressure and velocities ---*/ + //solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Flow_Correction(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + /*--- Set the prmitive value based on updated solution ---*/ + //solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Postprocessing(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone], MESH_0); + + integration[val_iZone][val_iInst][FLOW_SOL]->MultiGrid_CyclePB(geometry, solver, numerics, + config, FinestMesh, 0, RUNTIME_FLOW_SYS, InnerIter, val_iZone,val_iInst); + + if (config[val_iZone]->GetKind_Solver() == INC_RANS) { + + /*--- Solve the turbulence model ---*/ + + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_TURB_SYS); + integration[val_iZone][val_iInst][TURB_SOL]->SingleGrid_Iteration(geometry, solver, numerics, config, RUNTIME_TURB_SYS, val_iZone, val_iInst); + + /*--- Solve transition model ---*/ + + if (config[val_iZone]->GetKind_Trans_Model() == LM) { + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_TRANS_SYS); + integration[val_iZone][val_iInst][TRANS_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_TRANS_SYS, val_iZone, val_iInst); + } + } + + + /*--- Calculate the inviscid and viscous forces ---*/ + + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Pressure_Forces(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Momentum_Forces(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->Friction_Forces(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + + /*--- Write the convergence history ---*/ + + /*if ( unsteady && !config[val_iZone]->GetDiscrete_Adjoint() ) + output->SetConvHistory_Body(NULL, geometry, solver, config, integration, true, 0.0, val_iZone,val_iInst);*/ + +} + +void CPBFluidIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } + + +CTurboIteration::CTurboIteration(CConfig *config) : CFluidIteration(config) { } +CTurboIteration::~CTurboIteration(void) { } +void CTurboIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Average quantities at the inflow and outflow boundaries ---*/ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[val_iZone][val_iInst][MESH_0], geometry[val_iZone][val_iInst][MESH_0],config[val_iZone],INFLOW); + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[val_iZone][val_iInst][MESH_0], geometry[val_iZone][val_iInst][MESH_0],config[val_iZone],OUTFLOW); + +} + +void CTurboIteration::Postprocess( COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Average quantities at the inflow and outflow boundaries ---*/ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[val_iZone][val_iInst][MESH_0], geometry[val_iZone][val_iInst][MESH_0],config[val_iZone],INFLOW); + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->TurboAverageProcess(solver[val_iZone][val_iInst][MESH_0], geometry[val_iZone][val_iInst][MESH_0],config[val_iZone],OUTFLOW); + + /*--- Gather Inflow and Outflow quantities on the Master Node to compute performance ---*/ + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GatherInOutAverageValues(config[val_iZone], geometry[val_iZone][val_iInst][MESH_0]); + +} + +CFEMFluidIteration::CFEMFluidIteration(CConfig *config) : CFluidIteration(config) { } +CFEMFluidIteration::~CFEMFluidIteration(void) { } + +void CFEMFluidIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned long TimeIter = config[ZONE_0]->GetTimeIter(); + const bool restart = (config[ZONE_0]->GetRestart() || + config[ZONE_0]->GetRestart_Flow()); + + /*--- Set the initial condition if this is not a restart. ---*/ + if (TimeIter == 0 && !restart) + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetInitialCondition(geometry[val_iZone][val_iInst], + solver[val_iZone][val_iInst], + config[val_iZone], + TimeIter); + +} + +void CFEMFluidIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Update global parameters ---*/ + + if (config[val_iZone]->GetKind_Solver() == FEM_EULER || config[val_iZone]->GetKind_Solver() == DISC_ADJ_FEM_EULER) + config[val_iZone]->SetGlobalParam(FEM_EULER, RUNTIME_FLOW_SYS); + + if (config[val_iZone]->GetKind_Solver() == FEM_NAVIER_STOKES || config[val_iZone]->GetKind_Solver() == DISC_ADJ_FEM_NS) + config[val_iZone]->SetGlobalParam(FEM_NAVIER_STOKES, RUNTIME_FLOW_SYS); + + if (config[val_iZone]->GetKind_Solver() == FEM_RANS || config[val_iZone]->GetKind_Solver() == DISC_ADJ_FEM_RANS) + config[val_iZone]->SetGlobalParam(FEM_RANS, RUNTIME_FLOW_SYS); + + if (config[val_iZone]->GetKind_Solver() == FEM_LES) + config[val_iZone]->SetGlobalParam(FEM_LES, RUNTIME_FLOW_SYS); + + /*--- Solve the Euler, Navier-Stokes, RANS or LES equations (one iteration) ---*/ + + integration[val_iZone][val_iInst][FLOW_SOL]->SingleGrid_Iteration(geometry, + solver, + numerics, + config, + RUNTIME_FLOW_SYS, + val_iZone, + val_iInst); +} + +void CFEMFluidIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } + +void CFEMFluidIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst){} + +CHeatIteration::CHeatIteration(CConfig *config) : CFluidIteration(config) { } + +CHeatIteration::~CHeatIteration(void) { } + +void CHeatIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Update global parameters ---*/ + + config[val_iZone]->SetGlobalParam(HEAT_EQUATION, RUNTIME_HEAT_SYS); + + integration[val_iZone][val_iInst][HEAT_SOL]->SingleGrid_Iteration(geometry, solver, numerics, config, RUNTIME_HEAT_SYS, val_iZone, val_iInst); + +} + +void CHeatIteration::Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Boolean to determine if we are running a static or dynamic case ---*/ + bool steady = !config[val_iZone]->GetTime_Domain(); + + unsigned long Inner_Iter, nInner_Iter = config[val_iZone]->GetnInner_Iter(); + bool StopCalc = false; + + /*--- Synchronization point before a single solver iteration. + Compute the wall clock time required. ---*/ + + StartTime = SU2_MPI::Wtime(); + + /*--- For steady-state flow simulations, we need to loop over ExtIter for the number of time steps ---*/ + /*--- However, ExtIter is the number of FSI iterations, so nIntIter is used in this case ---*/ + + for (Inner_Iter = 0; Inner_Iter < nInner_Iter; Inner_Iter++){ + + config[val_iZone]->SetInnerIter(Inner_Iter); + + /*--- Run a single iteration of the solver ---*/ + Iterate(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + /*--- Monitor the pseudo-time ---*/ + StopCalc = Monitor(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + /*--- Output files at intermediate iterations if the problem is single zone ---*/ + + if (singlezone && steady) { + Output(output, geometry, solver, config, Inner_Iter, StopCalc, val_iZone, val_iInst); + } + + /*--- If the iteration has converged, break the loop ---*/ + if (StopCalc) break; + } + + if (multizone && steady) { + Output(output, geometry, solver, config, + config[val_iZone]->GetOuterIter(), + StopCalc, val_iZone, val_iInst); + + /*--- Set the fluid convergence to false (to make sure outer subiterations converge) ---*/ + + integration[val_iZone][INST_0][HEAT_SOL]->SetConvergence(false); + } +} + +void CHeatIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned short iMesh; + + /*--- Dual time stepping strategy ---*/ + + if ((config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || + (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND)) { + + /*--- Update dual time solver ---*/ + + for (iMesh = 0; iMesh <= config[val_iZone]->GetnMGLevels(); iMesh++) { + integration[val_iZone][val_iInst][HEAT_SOL]->SetDualTime_Solver(geometry[val_iZone][val_iInst][iMesh], solver[val_iZone][val_iInst][iMesh][HEAT_SOL], config[val_iZone], iMesh); + integration[val_iZone][val_iInst][HEAT_SOL]->SetConvergence(false); + } + } +} + +CFEAIteration::CFEAIteration(CConfig *config) : CIteration(config) { } +CFEAIteration::~CFEAIteration(void) { } +void CFEAIteration::Preprocess() { } +void CFEAIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + bool StopCalc = false; + unsigned long IntIter = 0; + + const unsigned long TimeIter = config[val_iZone]->GetTimeIter(); + const unsigned long nIncrements = config[val_iZone]->GetNumberIncrements(); + + const bool nonlinear = (config[val_iZone]->GetGeometricConditions() == LARGE_DEFORMATIONS); + const bool linear = (config[val_iZone]->GetGeometricConditions() == SMALL_DEFORMATIONS); + const bool disc_adj_fem = config[val_iZone]->GetDiscrete_Adjoint(); + + /*--- Loads applied in steps (not used for discrete adjoint). ---*/ + const bool incremental_load = config[val_iZone]->GetIncrementalLoad() && !disc_adj_fem; + + CIntegration* feaIntegration = integration[val_iZone][val_iInst][FEA_SOL]; + CSolver* feaSolver = solver[val_iZone][val_iInst][MESH_0][FEA_SOL]; + + /*--- Set the convergence monitor to false, to prevent the solver to stop in intermediate FSI subiterations ---*/ + feaIntegration->SetConvergence(false); + + /*--- FEA equations ---*/ + config[val_iZone]->SetGlobalParam(FEM_ELASTICITY, RUNTIME_FEA_SYS); + + if (linear) { + /*--- Run the (one) iteration ---*/ + + config[val_iZone]->SetInnerIter(0); + + feaIntegration->Structural_Iteration(geometry, solver, numerics, config, + RUNTIME_FEA_SYS, val_iZone, val_iInst); + + if (!disc_adj_fem) { + Monitor(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + /*--- Set the convergence monitor to true, to prevent the solver to stop in intermediate FSI subiterations ---*/ + output->SetConvergence(true); + } + + } + else if (nonlinear && !incremental_load) { + + /*--- THIS IS THE DIRECT APPROACH (NO INCREMENTAL LOAD APPLIED) ---*/ + + /*--- Keep the current inner iter, we need to restore it in discrete adjoint cases as file output depends on it ---*/ + const auto CurIter = config[val_iZone]->GetInnerIter(); + + /*--- Newton-Raphson subiterations ---*/ + + for (IntIter = 0; IntIter < config[val_iZone]->GetnInner_Iter(); IntIter++) { + + config[val_iZone]->SetInnerIter(IntIter); + + feaIntegration->Structural_Iteration(geometry, solver, numerics, config, + RUNTIME_FEA_SYS, val_iZone, val_iInst); + + /*--- Limit to only one iteration for the discrete adjoint recording, restore inner iter (see above) ---*/ + if (disc_adj_fem) { + config[val_iZone]->SetInnerIter(CurIter); + break; + } + else { + StopCalc = Monitor(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + if (StopCalc && (IntIter > 0)) break; + } + } + + } + else { + + /*--- THIS IS THE INCREMENTAL LOAD APPROACH (only makes sense for nonlinear) ---*/ + + /*--- Assume the initial load increment as 1.0 ---*/ + + feaSolver->SetLoad_Increment(0, 1.0); + feaSolver->SetForceCoeff(1.0); + + /*--- Run two nonlinear iterations to check if incremental loading can be skipped ---*/ + + for (IntIter = 0; IntIter < 2; ++IntIter) { + + config[val_iZone]->SetInnerIter(IntIter); + + feaIntegration->Structural_Iteration(geometry, solver, numerics, config, + RUNTIME_FEA_SYS, val_iZone, val_iInst); + + StopCalc = Monitor(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + } + + /*--- Early return if we already meet the convergence criteria. ---*/ + if (StopCalc) return; + + /*--- Check user-defined criteria to either increment loads or continue with NR iterations. ---*/ + + bool meetCriteria = true; + for (int i = 0; i < 3; ++i) + meetCriteria &= (log10(feaSolver->GetRes_FEM(i)) < config[val_iZone]->GetIncLoad_Criteria(i)); + + /*--- If the criteria is met, i.e. the load is not too large, continue the regular calculation. ---*/ + + if (meetCriteria) { + + /*--- Newton-Raphson subiterations ---*/ + + for (IntIter = 2; IntIter < config[val_iZone]->GetnInner_Iter(); IntIter++) { + + config[val_iZone]->SetInnerIter(IntIter); + + feaIntegration->Structural_Iteration(geometry, solver, numerics, config, + RUNTIME_FEA_SYS, val_iZone, val_iInst); + + StopCalc = Monitor(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + if (StopCalc) break; + } + + } + + /*--- If the criteria is not met, a whole set of subiterations for the different loads must be done. ---*/ + + else { + + /*--- Restore solution to initial. Because we ramp the load from zero, in multizone cases it is not + * adequate to take "old values" as those will be for maximum loading on the previous outer iteration. ---*/ + + feaSolver->SetInitialCondition(geometry[val_iZone][val_iInst], + solver[val_iZone][val_iInst], + config[val_iZone], TimeIter); + + /*--- For the number of increments ---*/ + for (auto iIncrement = 1ul; iIncrement <= nIncrements; iIncrement++) { + + /*--- Set the load increment and the initial condition, and output the + * parameters of UTOL, RTOL, ETOL for the previous iteration ---*/ + + su2double loadIncrement = su2double(iIncrement) / nIncrements; + feaSolver->SetLoad_Increment(iIncrement, loadIncrement); + + /*--- Set the convergence monitor to false, to force the solver to converge every subiteration ---*/ + output->SetConvergence(false); + + if (rank == MASTER_NODE) + cout << "\nIncremental load: increment " << iIncrement << endl; + + /*--- Newton-Raphson subiterations ---*/ + + for (IntIter = 0; IntIter < config[val_iZone]->GetnInner_Iter(); IntIter++) { + + config[val_iZone]->SetInnerIter(IntIter); + + feaIntegration->Structural_Iteration(geometry, solver, numerics, config, + RUNTIME_FEA_SYS, val_iZone, val_iInst); + + StopCalc = Monitor(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, INST_0); + + if (StopCalc && (IntIter > 0)) break; + + } + + } + /*--- Just to be sure, set default increment settings. ---*/ + feaSolver->SetLoad_Increment(0, 1.0); + } + + } + +} + +void CFEAIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + const auto TimeIter = config[val_iZone]->GetTimeIter(); + const bool dynamic = (config[val_iZone]->GetTime_Domain()); + const bool fsi = config[val_iZone]->GetFSI_Simulation(); + + CSolver* feaSolver = solver[val_iZone][val_iInst][MESH_0][FEA_SOL]; + + /*----------------- Update structural solver ----------------------*/ + + if (dynamic) { + + integration[val_iZone][val_iInst][FEA_SOL]->SetStructural_Solver(geometry[val_iZone][val_iInst][MESH_0], + solver[val_iZone][val_iInst][MESH_0], config[val_iZone], MESH_0); + integration[val_iZone][val_iInst][FEA_SOL]->SetConvergence(false); + + /*--- Verify convergence criteria (based on total time) ---*/ + + const su2double Physical_dt = config[val_iZone]->GetDelta_DynTime(); + const su2double Physical_t = (TimeIter+1)*Physical_dt; + if (Physical_t >= config[val_iZone]->GetTotal_DynTime()) + integration[val_iZone][val_iInst][FEA_SOL]->SetConvergence(true); + + } else if (fsi) { + + /*--- For FSI problems, output the relaxed result, which is the one transferred into the fluid domain (for restart purposes) ---*/ + if (config[val_iZone]->GetKind_TimeIntScheme_FEA() == NEWMARK_IMPLICIT) { + feaSolver->ImplicitNewmark_Relaxation(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + } + } + +} + +void CFEAIteration::Predictor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + CSolver* feaSolver = solver[val_iZone][val_iInst][MESH_0][FEA_SOL]; + + feaSolver->PredictStruct_Displacement(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + +} + +void CFEAIteration::Relaxation(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + CSolver* feaSolver = solver[val_iZone][val_iInst][MESH_0][FEA_SOL]; + + /*-------------------- Aitken's relaxation ------------------------*/ + + /*------------------- Compute the coefficient ---------------------*/ + + feaSolver->ComputeAitken_Coefficient(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], + config[val_iZone]->GetOuterIter()); + + /*----------------- Set the relaxation parameter ------------------*/ + + feaSolver->SetAitken_Relaxation(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + +} + +bool CFEAIteration::Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + StopTime = SU2_MPI::Wtime(); + + UsedTime = StopTime - StartTime; + + if (config[val_iZone]->GetMultizone_Problem() || config[val_iZone]->GetSinglezone_Driver()){ + output->SetHistory_Output(geometry[val_iZone][val_iInst][MESH_0], + solver[val_iZone][val_iInst][MESH_0], + config[val_iZone], config[val_iZone]->GetTimeIter(), + config[val_iZone]->GetOuterIter(), config[val_iZone]->GetInnerIter()); + } + + return output->GetConvergence(); + +} + +void CFEAIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } + +void CFEAIteration::Solve(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst + ) { + + /*------------------ Structural subiteration ----------------------*/ + Iterate(output, integration, geometry, solver, numerics, config, + surface_movement, grid_movement, FFDBox, val_iZone, val_iInst); + + /*--- Write the convergence history for the structure (only screen output) ---*/ +// if (multizone) output->SetConvHistory_Body(geometry, solver, config, integration, false, 0.0, val_iZone, INST_0); + + /*--- Set the structural convergence to false (to make sure outer subiterations converge) ---*/ + integration[val_iZone][val_iInst][FEA_SOL]->SetConvergence(false); + +} + +CAdjFluidIteration::CAdjFluidIteration(CConfig *config) : CFluidIteration(config) { } +CAdjFluidIteration::~CAdjFluidIteration(void) { } +void CAdjFluidIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned short iMesh; + bool harmonic_balance = (config[ZONE_0]->GetTime_Marching() == HARMONIC_BALANCE); + bool dynamic_mesh = config[ZONE_0]->GetGrid_Movement(); + unsigned long InnerIter = 0; + unsigned long TimeIter = config[ZONE_0]->GetTimeIter(); + + /*--- For the unsteady adjoint, load a new direct solution from a restart file. ---*/ + + if (((dynamic_mesh && TimeIter == 0) || config[val_iZone]->GetTime_Marching()) && !harmonic_balance) { + int Direct_Iter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 1; + if (rank == MASTER_NODE && val_iZone == ZONE_0 && config[val_iZone]->GetTime_Marching()) + cout << endl << " Loading flow solution from direct iteration " << Direct_Iter << "." << endl; + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->LoadRestart(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], Direct_Iter, true); + } + + /*--- Continuous adjoint Euler, Navier-Stokes or Reynolds-averaged Navier-Stokes (RANS) equations ---*/ + + if ((InnerIter == 0) || config[val_iZone]->GetTime_Marching()) { + + if (config[val_iZone]->GetKind_Solver() == ADJ_EULER) + config[val_iZone]->SetGlobalParam(ADJ_EULER, RUNTIME_FLOW_SYS); + if (config[val_iZone]->GetKind_Solver() == ADJ_NAVIER_STOKES) + config[val_iZone]->SetGlobalParam(ADJ_NAVIER_STOKES, RUNTIME_FLOW_SYS); + if (config[val_iZone]->GetKind_Solver() == ADJ_RANS) + config[val_iZone]->SetGlobalParam(ADJ_RANS, RUNTIME_FLOW_SYS); + + /*--- Solve the Euler, Navier-Stokes or Reynolds-averaged Navier-Stokes (RANS) equations (one iteration) ---*/ + + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << "Begin direct solver to store flow data (single iteration)." << endl; + + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << "Compute residuals to check the convergence of the direct problem." << endl; + + integration[val_iZone][val_iInst][FLOW_SOL]->MultiGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_FLOW_SYS, val_iZone, val_iInst); + + if (config[val_iZone]->GetKind_Solver() == ADJ_RANS) { + + /*--- Solve the turbulence model ---*/ + + config[val_iZone]->SetGlobalParam(ADJ_RANS, RUNTIME_TURB_SYS); + integration[val_iZone][val_iInst][TURB_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_TURB_SYS, val_iZone, val_iInst); + + /*--- Solve transition model ---*/ + + if (config[val_iZone]->GetKind_Trans_Model() == LM) { + config[val_iZone]->SetGlobalParam(RANS, RUNTIME_TRANS_SYS); + integration[val_iZone][val_iInst][TRANS_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_TRANS_SYS, val_iZone, val_iInst); + } + + } + + /*--- Output the residual (visualization purpouses to identify if + the direct solution is converged)---*/ + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << "log10[Maximum residual]: " << log10(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetRes_Max(0)) + <<", located at point "<< solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetPoint_Max(0) << "." << endl; + + /*--- Compute gradients of the flow variables, this is necessary for sensitivity computation, + note that in the direct Euler problem we are not computing the gradients of the primitive variables ---*/ + + if (config[val_iZone]->GetKind_Gradient_Method() == GREEN_GAUSS) + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetPrimitive_Gradient_GG(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + if (config[val_iZone]->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->SetPrimitive_Gradient_LS(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + /*--- Set contribution from cost function for boundary conditions ---*/ + + for (iMesh = 0; iMesh <= config[val_iZone]->GetnMGLevels(); iMesh++) { + + /*--- Set the value of the non-dimensional coefficients in the coarse levels, using the fine level solution ---*/ + + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->SetTotal_CD(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetTotal_CD()); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->SetTotal_CL(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetTotal_CL()); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->SetTotal_CT(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetTotal_CT()); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->SetTotal_CQ(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->GetTotal_CQ()); + + /*--- Compute the adjoint boundary condition on Euler walls ---*/ + + solver[val_iZone][val_iInst][iMesh][ADJFLOW_SOL]->SetForceProj_Vector(geometry[val_iZone][val_iInst][iMesh], solver[val_iZone][val_iInst][iMesh], config[val_iZone]); + + /*--- Set the internal boundary condition on nearfield surfaces ---*/ + + if ((config[val_iZone]->GetKind_ObjFunc() == EQUIVALENT_AREA) || + (config[val_iZone]->GetKind_ObjFunc() == NEARFIELD_PRESSURE)) + solver[val_iZone][val_iInst][iMesh][ADJFLOW_SOL]->SetIntBoundary_Jump(geometry[val_iZone][val_iInst][iMesh], solver[val_iZone][val_iInst][iMesh], config[val_iZone]); + + } + + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << "End direct solver, begin adjoint problem." << endl; + + } + +} +void CAdjFluidIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + switch( config[val_iZone]->GetKind_Solver() ) { + + case ADJ_EULER: + config[val_iZone]->SetGlobalParam(ADJ_EULER, RUNTIME_ADJFLOW_SYS); break; + + case ADJ_NAVIER_STOKES: + config[val_iZone]->SetGlobalParam(ADJ_NAVIER_STOKES, RUNTIME_ADJFLOW_SYS); break; + + case ADJ_RANS: + config[val_iZone]->SetGlobalParam(ADJ_RANS, RUNTIME_ADJFLOW_SYS); break; + } + + /*--- Iteration of the flow adjoint problem ---*/ + + integration[val_iZone][val_iInst][ADJFLOW_SOL]->MultiGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_ADJFLOW_SYS, val_iZone, val_iInst); + + /*--- Iteration of the turbulence model adjoint ---*/ + + if ((config[val_iZone]->GetKind_Solver() == ADJ_RANS) && (!config[val_iZone]->GetFrozen_Visc_Cont())) { + + /*--- Adjoint turbulence model solution ---*/ + + config[val_iZone]->SetGlobalParam(ADJ_RANS, RUNTIME_ADJTURB_SYS); + integration[val_iZone][val_iInst][ADJTURB_SOL]->SingleGrid_Iteration(geometry, solver, numerics, + config, RUNTIME_ADJTURB_SYS, val_iZone, val_iInst); + + } + +} +void CAdjFluidIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + su2double Physical_dt, Physical_t; + unsigned short iMesh; + unsigned long TimeIter = config[ZONE_0]->GetTimeIter(); + + /*--- Dual time stepping strategy ---*/ + + if ((config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || + (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND)) { + + /*--- Update dual time solver ---*/ + + for (iMesh = 0; iMesh <= config[val_iZone]->GetnMGLevels(); iMesh++) { + integration[val_iZone][val_iInst][ADJFLOW_SOL]->SetDualTime_Solver(geometry[val_iZone][val_iInst][iMesh], solver[val_iZone][val_iInst][iMesh][ADJFLOW_SOL], config[val_iZone], iMesh); + integration[val_iZone][val_iInst][ADJFLOW_SOL]->SetConvergence(false); + } + + Physical_dt = config[val_iZone]->GetDelta_UnstTime(); Physical_t = (TimeIter+1)*Physical_dt; + if (Physical_t >= config[val_iZone]->GetTotal_UnstTime()) integration[val_iZone][val_iInst][ADJFLOW_SOL]->SetConvergence(true); + + } +} + + +CDiscAdjFluidIteration::CDiscAdjFluidIteration(CConfig *config) : CIteration(config) { + + turbulent = ( config->GetKind_Solver() == DISC_ADJ_RANS || config->GetKind_Solver() == DISC_ADJ_INC_RANS); + +} + +CDiscAdjFluidIteration::~CDiscAdjFluidIteration(void) { } + +void CDiscAdjFluidIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + StartTime = SU2_MPI::Wtime(); + + unsigned long iPoint; + unsigned short TimeIter = config[val_iZone]->GetTimeIter(); + bool dual_time_1st = (config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST); + bool dual_time_2nd = (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND); + bool dual_time = (dual_time_1st || dual_time_2nd); + unsigned short iMesh; + int Direct_Iter; + bool heat = config[val_iZone]->GetWeakly_Coupled_Heat(); + bool grid_IsMoving = config[val_iZone]->GetGrid_Movement(); + +// /*--- Read the target pressure for inverse design. ---------------------------------------------*/ +// if (config[val_iZone]->GetInvDesign_Cp() == YES) +// output->SetCp_InverseDesign(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL], geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], ExtIter); + +// /*--- Read the target heat flux ----------------------------------------------------------------*/ +// if (config[ZONE_0]->GetInvDesign_HeatFlux() == YES) +// output->SetHeatFlux_InverseDesign(solver[val_iZone][val_iInst][MESH_0][FLOW_SOL], geometry[val_iZone][val_iInst][MESH_0], config[val_iZone], ExtIter); + + /*--- For the unsteady adjoint, load direct solutions from restart files. ---*/ + + if (config[val_iZone]->GetTime_Marching()) { + + Direct_Iter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 2; + + /*--- For dual-time stepping we want to load the already converged solution at timestep n ---*/ + + if (dual_time) { + Direct_Iter += 1; + } + + if (TimeIter == 0){ + + if (dual_time_2nd) { + + /*--- Load solution at timestep n-2 ---*/ + LoadUnsteady_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter-2); + + /*--- Push solution back to correct array ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(); + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(); + } + if (grid_IsMoving) { + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n(); + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n1(); + } + } + } + if (dual_time) { + + /*--- Load solution at timestep n-1 ---*/ + LoadUnsteady_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter-1); + + /*--- Push solution back to correct array ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + } + if (grid_IsMoving) { + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n(); + } + } + } + + /*--- Load solution timestep n ---*/ + + LoadUnsteady_Solution(geometry, solver,config, val_iInst, val_iZone, Direct_Iter); + + if (config[val_iZone]->GetDeform_Mesh()) { + solver[val_iZone][val_iInst][MESH_0][MESH_SOL]->LoadRestart(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], Direct_Iter, true); + } + + } else if ((TimeIter > 0) && dual_time) { + + /*--- + Here the primal solutions (only working variables) are loaded and put in the correct order + into containers. For ALE the mesh coordinates have to be put into the + correct containers as well, i.e. follow the same logic for the solution. + Afterwards the GridVelocity is computed based on the Coordinates. + ---*/ + + if (config[val_iZone]->GetDeform_Mesh()) { + solver[val_iZone][val_iInst][MESH_0][MESH_SOL]->LoadRestart(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], Direct_Iter, true); + } + + /*--- Load solution timestep n-1 | n-2 for DualTimestepping 1st | 2nd order ---*/ + if (dual_time_1st){ + LoadUnsteady_Solution(geometry, solver,config, val_iInst, val_iZone, Direct_Iter - 1); + } else { + LoadUnsteady_Solution(geometry, solver,config, val_iInst, val_iZone, Direct_Iter - 2); + } + + + /*--- Temporarily store the loaded solution in the Solution_Old array ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->Set_OldSolution(); + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->Set_OldSolution(); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->Set_OldSolution(); + } + if (grid_IsMoving) { + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_Old(); + } + } + + /*--- Set Solution at timestep n to solution at n-1 ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n(iPoint)); + + if (grid_IsMoving) { + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord(iPoint,geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_n(iPoint)); + } + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n(iPoint)); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n(iPoint)); + } + } + } + if (dual_time_1st){ + /*--- Set Solution at timestep n-1 to the previously loaded solution ---*/ + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint)); + + if (grid_IsMoving) { + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n(iPoint, geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_Old(iPoint)); + } + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_Old(iPoint)); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_Old(iPoint)); + } + } + } + } + if (dual_time_2nd){ + /*--- Set Solution at timestep n-1 to solution at n-2 ---*/ + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); + + if (grid_IsMoving) { + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n(iPoint, geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_n1(iPoint)); + } + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); + } + } + } + /*--- Set Solution at timestep n-2 to the previously loaded solution ---*/ + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution_Old(iPoint)); + + if (grid_IsMoving) { + geometry[val_iZone][val_iInst][iMesh]->nodes->SetCoord_n1(iPoint, geometry[val_iZone][val_iInst][iMesh]->nodes->GetCoord_Old(iPoint)); + } + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][TURB_SOL]->GetNodes()->GetSolution_Old(iPoint)); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_Old(iPoint)); + } + } + } + } + + }//else if Ext_Iter > 0 + + /*--- Compute & set Grid Velocity via finite differences of the Coordinates. ---*/ + if (grid_IsMoving) + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) + geometry[val_iZone][val_iInst][iMesh]->SetGridVelocity(config[val_iZone], TimeIter); + + }//if unsteady + + /*--- Store flow solution also in the adjoint solver in order to be able to reset it later ---*/ + + if (TimeIter == 0 || dual_time) { + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][iMesh]->GetnPoint(); iPoint++) { + solver[val_iZone][val_iInst][iMesh][ADJFLOW_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint)); + } + } + if (turbulent && !config[val_iZone]->GetFrozen_Visc_Disc()) { + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++) { + solver[val_iZone][val_iInst][MESH_0][ADJTURB_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][TURB_SOL]->GetNodes()->GetSolution(iPoint)); + } + } + if (heat) { + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++) { + solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->GetNodes()->GetSolution(iPoint)); + } + } + if (config[val_iZone]->AddRadiation()) { + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++) { + solver[val_iZone][val_iInst][MESH_0][ADJRAD_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][RAD_SOL]->GetNodes()->GetSolution(iPoint)); + } + } + } + + solver[val_iZone][val_iInst][MESH_0][ADJFLOW_SOL]->Preprocessing(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone] , MESH_0, 0, RUNTIME_ADJFLOW_SYS, false); + if (turbulent && !config[val_iZone]->GetFrozen_Visc_Disc()){ + solver[val_iZone][val_iInst][MESH_0][ADJTURB_SOL]->Preprocessing(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone] , MESH_0, 0, RUNTIME_ADJTURB_SYS, false); + } + if (heat) { + solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->Preprocessing(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone] , MESH_0, 0, RUNTIME_ADJHEAT_SYS, false); + } + if (config[val_iZone]->AddRadiation()){ + solver[val_iZone][val_iInst][MESH_0][ADJRAD_SOL]->Preprocessing(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone] , MESH_0, 0, RUNTIME_ADJRAD_SYS, false); + } + +} + + + +void CDiscAdjFluidIteration::LoadUnsteady_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter) { + unsigned short iMesh; + bool heat = config[val_iZone]->GetWeakly_Coupled_Heat(); + + if (val_DirectIter >= 0) { + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << " Loading flow solution from direct iteration " << val_DirectIter << "." << endl; + solver[val_iZone][val_iInst][MESH_0][FLOW_SOL]->LoadRestart(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], val_DirectIter, true); + if (turbulent) { + solver[val_iZone][val_iInst][MESH_0][TURB_SOL]->LoadRestart(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], val_DirectIter, false); + } + if (heat) { + solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->LoadRestart(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], val_DirectIter, false); + } + } else { + /*--- If there is no solution file we set the freestream condition ---*/ + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << " Setting freestream conditions at direct iteration " << val_DirectIter << "." << endl; + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->SetFreeStream_Solution(config[val_iZone]); + solver[val_iZone][val_iInst][iMesh][FLOW_SOL]->Preprocessing(geometry[val_iZone][val_iInst][iMesh],solver[val_iZone][val_iInst][iMesh], config[val_iZone], iMesh, val_DirectIter, RUNTIME_FLOW_SYS, false); + if (turbulent) { + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->SetFreeStream_Solution(config[val_iZone]); + solver[val_iZone][val_iInst][iMesh][TURB_SOL]->Postprocessing(geometry[val_iZone][val_iInst][iMesh],solver[val_iZone][val_iInst][iMesh], config[val_iZone], iMesh); + } + if (heat) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->SetFreeStream_Solution(config[val_iZone]); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->Postprocessing(geometry[val_iZone][val_iInst][iMesh],solver[val_iZone][val_iInst][iMesh], config[val_iZone], iMesh); + } + } + } +} + + +void CDiscAdjFluidIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***volume_grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short iZone, + unsigned short iInst) { + + bool frozen_visc = config[iZone]->GetFrozen_Visc_Disc(); + bool heat = config[iZone]->GetWeakly_Coupled_Heat(); + + /*--- Extract the adjoints of the conservative input variables and store them for the next iteration ---*/ + + if (config[iZone]->GetFluidProblem()) { + solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->ExtractAdjoint_Solution(geometry[iZone][iInst][MESH_0], config[iZone]); + + solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->ExtractAdjoint_Variables(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (turbulent && !frozen_visc) { + + solver[iZone][iInst][MESH_0][ADJTURB_SOL]->ExtractAdjoint_Solution(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (heat) { + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->ExtractAdjoint_Solution(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (config[iZone]->AddRadiation()) { + solver[iZone][iInst][MESH_0][ADJRAD_SOL]->ExtractAdjoint_Solution(geometry[iZone][iInst][MESH_0], config[iZone]); + + solver[iZone][iInst][MESH_0][ADJRAD_SOL]->ExtractAdjoint_Variables(geometry[iZone][iInst][MESH_0], config[iZone]); + } + +} + + +void CDiscAdjFluidIteration::InitializeAdjoint(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst){ + + bool frozen_visc = config[iZone]->GetFrozen_Visc_Disc(); + bool heat = config[iZone]->GetWeakly_Coupled_Heat(); + bool interface_boundary = (config[iZone]->GetnMarker_Fluid_Load() > 0); + + /*--- Initialize the adjoints the conservative variables ---*/ + + if (config[iZone]->GetFluidProblem()) { + solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]); + } + + if (turbulent && !frozen_visc) { + solver[iZone][iInst][MESH_0][ADJTURB_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]); + } + + if (heat) { + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]); + } + + if (config[iZone]->AddRadiation()) { + solver[iZone][iInst][MESH_0][ADJRAD_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]); + } + + if (interface_boundary) { + solver[iZone][iInst][MESH_0][FLOW_SOL]->SetVertexTractionsAdjoint(geometry[iZone][iInst][MESH_0], config[iZone]); + } + +} + + +void CDiscAdjFluidIteration::RegisterInput(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst, unsigned short kind_recording){ + + bool frozen_visc = config[iZone]->GetFrozen_Visc_Disc(); + bool heat = config[iZone]->GetWeakly_Coupled_Heat(); + + if (kind_recording == SOLUTION_VARIABLES || kind_recording == SOLUTION_AND_MESH) { + + /*--- Register flow and turbulent variables as input ---*/ + + if (config[iZone]->GetFluidProblem()) { + solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->RegisterSolution(geometry[iZone][iInst][MESH_0], config[iZone]); + + solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->RegisterVariables(geometry[iZone][iInst][MESH_0], config[iZone]); + } + + if (turbulent && !frozen_visc) { + solver[iZone][iInst][MESH_0][ADJTURB_SOL]->RegisterSolution(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (heat) { + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->RegisterSolution(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (config[iZone]->AddRadiation()) { + solver[iZone][iInst][MESH_0][ADJRAD_SOL]->RegisterSolution(geometry[iZone][iInst][MESH_0], config[iZone]); + + solver[iZone][iInst][MESH_0][ADJRAD_SOL]->RegisterVariables(geometry[iZone][iInst][MESH_0], config[iZone]); + } + } + + if (kind_recording == MESH_COORDS){ + + /*--- Register node coordinates as input ---*/ + + geometry[iZone][iInst][MESH_0]->RegisterCoordinates(config[iZone]); + + } + + /*--- Register the variables of the mesh deformation ---*/ + if (kind_recording == MESH_DEFORM){ + + /*--- Undeformed mesh coordinates ---*/ + solver[iZone][iInst][MESH_0][ADJMESH_SOL]->RegisterSolution(geometry[iZone][iInst][MESH_0], config[iZone]); + + /*--- Boundary displacements ---*/ + solver[iZone][iInst][MESH_0][ADJMESH_SOL]->RegisterVariables(geometry[iZone][iInst][MESH_0], config[iZone]); + + } + +} + +void CDiscAdjFluidIteration::SetRecording(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short iZone, + unsigned short iInst, + unsigned short kind_recording) { + + bool frozen_visc = config[iZone]->GetFrozen_Visc_Disc(); + + /*--- Prepare for recording by resetting the solution to the initial converged solution ---*/ + + if (solver[iZone][iInst][MESH_0][ADJFEA_SOL]) { + solver[iZone][iInst][MESH_0][ADJFEA_SOL]->SetRecording(geometry[iZone][iInst][MESH_0], config[iZone]); + } + + for (auto iMesh = 0u; iMesh <= config[iZone]->GetnMGLevels(); iMesh++){ + solver[iZone][iInst][iMesh][ADJFLOW_SOL]->SetRecording(geometry[iZone][iInst][iMesh], config[iZone]); + } + if (turbulent && !frozen_visc) { + solver[iZone][iInst][MESH_0][ADJTURB_SOL]->SetRecording(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (config[iZone]->GetWeakly_Coupled_Heat()) { + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->SetRecording(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (config[iZone]->AddRadiation()) { + solver[iZone][INST_0][MESH_0][ADJRAD_SOL]->SetRecording(geometry[iZone][INST_0][MESH_0], config[iZone]); + } + +} + +void CDiscAdjFluidIteration::SetDependencies(CSolver *****solver, + CGeometry ****geometry, + CNumerics ******numerics, + CConfig **config, + unsigned short iZone, + unsigned short iInst, + unsigned short kind_recording){ + + bool frozen_visc = config[iZone]->GetFrozen_Visc_Disc(); + bool heat = config[iZone]->GetWeakly_Coupled_Heat(); + + if ((kind_recording == MESH_COORDS) || (kind_recording == NONE) || (kind_recording == SOLUTION_AND_MESH)){ + + /*--- Update geometry to get the influence on other geometry variables (normals, volume etc) ---*/ + + geometry[iZone][iInst][MESH_0]->UpdateGeometry(geometry[iZone][iInst], config[iZone]); + + CGeometry::ComputeWallDistance(config, geometry); + + } + + /*--- Compute coupling between flow and turbulent equations ---*/ + solver[iZone][iInst][MESH_0][FLOW_SOL]->Preprocessing(geometry[iZone][iInst][MESH_0], solver[iZone][iInst][MESH_0], config[iZone], MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, true); + solver[iZone][iInst][MESH_0][FLOW_SOL]->InitiateComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + solver[iZone][iInst][MESH_0][FLOW_SOL]->CompleteComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + + if (turbulent && !frozen_visc){ + solver[iZone][iInst][MESH_0][TURB_SOL]->Postprocessing(geometry[iZone][iInst][MESH_0],solver[iZone][iInst][MESH_0], config[iZone], MESH_0); + solver[iZone][iInst][MESH_0][TURB_SOL]->InitiateComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + solver[iZone][iInst][MESH_0][TURB_SOL]->CompleteComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + } + + if (heat){ + solver[iZone][iInst][MESH_0][HEAT_SOL]->Set_Heatflux_Areas(geometry[iZone][iInst][MESH_0], config[iZone]); + solver[iZone][iInst][MESH_0][HEAT_SOL]->Preprocessing(geometry[iZone][iInst][MESH_0],solver[iZone][iInst][MESH_0], config[iZone], MESH_0, NO_RK_ITER, RUNTIME_HEAT_SYS, true); + solver[iZone][iInst][MESH_0][HEAT_SOL]->Postprocessing(geometry[iZone][iInst][MESH_0],solver[iZone][iInst][MESH_0], config[iZone], MESH_0); + solver[iZone][iInst][MESH_0][HEAT_SOL]->InitiateComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + solver[iZone][iInst][MESH_0][HEAT_SOL]->CompleteComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + } + if (config[iZone]->AddRadiation()){ + solver[iZone][iInst][MESH_0][RAD_SOL]->Postprocessing(geometry[iZone][iInst][MESH_0],solver[iZone][iInst][MESH_0], config[iZone], MESH_0); + solver[iZone][iInst][MESH_0][RAD_SOL]->InitiateComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + solver[iZone][iInst][MESH_0][RAD_SOL]->CompleteComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + } +} + +void CDiscAdjFluidIteration::RegisterOutput(CSolver *****solver, CGeometry ****geometry, CConfig **config, COutput* output, unsigned short iZone, unsigned short iInst){ + + bool frozen_visc = config[iZone]->GetFrozen_Visc_Disc(); + bool heat = config[iZone]->GetWeakly_Coupled_Heat(); + bool interface_boundary = (config[iZone]->GetnMarker_Fluid_Load() > 0); + + /*--- Register conservative variables as output of the iteration ---*/ + + if (config[iZone]->GetFluidProblem()){ + solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->RegisterOutput(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (turbulent && !frozen_visc){ + solver[iZone][iInst][MESH_0][ADJTURB_SOL]->RegisterOutput(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (heat){ + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->RegisterOutput(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (config[iZone]->AddRadiation()){ + solver[iZone][iInst][MESH_0][ADJRAD_SOL]->RegisterOutput(geometry[iZone][iInst][MESH_0], config[iZone]); + } + if (interface_boundary){ + solver[iZone][iInst][MESH_0][FLOW_SOL]->RegisterVertexTractions(geometry[iZone][iInst][MESH_0], config[iZone]); + } +} + +void CDiscAdjFluidIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned short iMesh; + + /*--- Dual time stepping strategy ---*/ + + if ((config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || + (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND)) { + + for (iMesh = 0; iMesh <= config[val_iZone]->GetnMGLevels(); iMesh++) { + integration[val_iZone][val_iInst][ADJFLOW_SOL]->SetConvergence(false); + } + } +} + +bool CDiscAdjFluidIteration::Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + StopTime = SU2_MPI::Wtime(); + + UsedTime = StopTime - StartTime; + + /*--- Write the convergence history for the fluid (only screen output) ---*/ + + output->SetHistory_Output(geometry[val_iZone][INST_0][MESH_0], + solver[val_iZone][INST_0][MESH_0], + config[val_iZone], + config[val_iZone]->GetTimeIter(), + config[val_iZone]->GetOuterIter(), + config[val_iZone]->GetInnerIter()); + + return output->GetConvergence(); + +} +void CDiscAdjFluidIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } + + +CDiscAdjFEAIteration::CDiscAdjFEAIteration(CConfig *config) : CIteration(config), CurrentRecording(NONE){ + + fem_iteration = new CFEAIteration(config); + + // TEMPORARY output only for standalone structural problems + if ((!config->GetFSI_Simulation()) && (rank == MASTER_NODE)){ + + bool de_effects = config->GetDE_Effects(); + unsigned short iVar; + + /*--- Header of the temporary output file ---*/ + ofstream myfile_res; + myfile_res.open ("Results_Reverse_Adjoint.txt"); + + myfile_res << "Obj_Func" << " "; + for (iVar = 0; iVar < config->GetnElasticityMod(); iVar++) + myfile_res << "Sens_E_" << iVar << "\t"; + + for (iVar = 0; iVar < config->GetnPoissonRatio(); iVar++) + myfile_res << "Sens_Nu_" << iVar << "\t"; + + if (config->GetTime_Domain()){ + for (iVar = 0; iVar < config->GetnMaterialDensity(); iVar++) + myfile_res << "Sens_Rho_" << iVar << "\t"; + } + + if (de_effects){ + for (iVar = 0; iVar < config->GetnElectric_Field(); iVar++) + myfile_res << "Sens_EField_" << iVar << "\t"; + } + + myfile_res << endl; + + myfile_res.close(); + } + +} + +CDiscAdjFEAIteration::~CDiscAdjFEAIteration(void) { } +void CDiscAdjFEAIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned long iPoint; + unsigned short TimeIter = config[val_iZone]->GetTimeIter(); + bool dynamic = (config[val_iZone]->GetTime_Domain()); + + int Direct_Iter; + + /*--- For the dynamic adjoint, load direct solutions from restart files. ---*/ + + if (dynamic) { + + Direct_Iter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 1; + + /*--- We want to load the already converged solution at timesteps n and n-1 ---*/ + + /*--- Load solution at timestep n-1 ---*/ + + LoadDynamic_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter-1); + + /*--- Push solution back to correct array ---*/ + + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->Set_Solution_time_n(); + + /*--- Push solution back to correct array ---*/ + + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Accel_time_n(); + + /*--- Push solution back to correct array ---*/ + + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Vel_time_n(); + + /*--- Load solution timestep n ---*/ + + LoadDynamic_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter); + + /*--- Store FEA solution also in the adjoint solver in order to be able to reset it later ---*/ + + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint)); + } + + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Accel_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution_Accel(iPoint)); + } + + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Vel_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution_Vel(iPoint)); + } + + } + else{ + /*--- Store FEA solution also in the adjoint solver in order to be able to reset it later ---*/ + + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++){ + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->GetSolution(iPoint)); + } + + } + + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->Preprocessing(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0], config[val_iZone] , MESH_0, 0, RUNTIME_ADJFEA_SYS, false); + +} + + + +void CDiscAdjFEAIteration::LoadDynamic_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter) { + unsigned short iVar; + unsigned long iPoint; + bool update_geo = false; //TODO: check + + if (val_DirectIter >= 0){ + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << " Loading FEA solution from direct iteration " << val_DirectIter << "." << endl; + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->LoadRestart(geometry[val_iZone][val_iInst], solver[val_iZone][val_iInst], config[val_iZone], val_DirectIter, update_geo); + } else { + /*--- If there is no solution file we set the freestream condition ---*/ + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << " Setting static conditions at direct iteration " << val_DirectIter << "." << endl; + /*--- Push solution back to correct array ---*/ + for(iPoint=0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint();iPoint++){ + for (iVar = 0; iVar < solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetnVar(); iVar++){ + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution(iPoint, iVar, 0.0); + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Accel(iPoint, iVar, 0.0); + solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetNodes()->SetSolution_Vel(iPoint, iVar, 0.0); + } + } + } +} + + +void CDiscAdjFEAIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***volume_grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + + bool dynamic = (config[val_iZone]->GetTime_Domain()); + + /*--- Extract the adjoints of the conservative input variables and store them for the next iteration ---*/ + + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->ExtractAdjoint_Solution(geometry[val_iZone][val_iInst][MESH_0], + config[val_iZone]); + + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->ExtractAdjoint_Variables(geometry[val_iZone][val_iInst][MESH_0], + config[val_iZone]); + if (dynamic){ + integration[val_iZone][val_iInst][ADJFEA_SOL]->SetConvergence(false); + } + +} + +void CDiscAdjFEAIteration::SetRecording(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording) { + + unsigned long InnerIter = config[ZONE_0]->GetInnerIter(); + unsigned long TimeIter = config[val_iZone]->GetTimeIter(), DirectTimeIter; + bool dynamic = (config[val_iZone]->GetTime_Domain()); + + DirectTimeIter = 0; + if (dynamic){ + DirectTimeIter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 1; + } + + /*--- Reset the tape ---*/ + + AD::Reset(); + + /*--- We only need to reset the indices if the current recording is different from the recording we want to have ---*/ + + if (CurrentRecording != kind_recording && (CurrentRecording != NONE) ){ + + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->SetRecording(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + /*--- Clear indices of coupling variables ---*/ + + SetDependencies(solver, geometry, numerics, config, val_iZone, val_iInst, SOLUTION_AND_MESH); + + /*--- Run one iteration while tape is passive - this clears all indices ---*/ + + fem_iteration->Iterate(output,integration,geometry,solver,numerics, + config,surface_movement,grid_movement,FFDBox,val_iZone, val_iInst); + + } + + /*--- Prepare for recording ---*/ + + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->SetRecording(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + + /*--- Start the recording of all operations ---*/ + + AD::StartRecording(); + + /*--- Register FEA variables ---*/ + + RegisterInput(solver, geometry, config, val_iZone, val_iInst, kind_recording); + + /*--- Compute coupling or update the geometry ---*/ + + SetDependencies(solver, geometry, numerics, config, val_iZone, val_iInst, kind_recording); + + /*--- Set the correct direct iteration number ---*/ + + if (dynamic){ + config[val_iZone]->SetTimeIter(DirectTimeIter); + } + + /*--- Run the direct iteration ---*/ + + fem_iteration->Iterate(output,integration,geometry,solver,numerics, + config,surface_movement,grid_movement,FFDBox, val_iZone, val_iInst); + + config[val_iZone]->SetTimeIter(TimeIter); + + /*--- Register structural variables and objective function as output ---*/ + + RegisterOutput(solver, geometry, config, val_iZone, val_iInst); + + /*--- Stop the recording ---*/ + + AD::StopRecording(); + + /*--- Set the recording status ---*/ + + CurrentRecording = kind_recording; + + /* --- Reset the number of the internal iterations---*/ + + config[ZONE_0]->SetInnerIter(InnerIter); + +} + + +void CDiscAdjFEAIteration::SetRecording(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + unsigned short kind_recording) { + + /*--- Prepare for recording by resetting the solution to the initial converged solution ---*/ + + solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->SetRecording(geometry[val_iZone][val_iInst][MESH_0], config[val_iZone]); + +} + +void CDiscAdjFEAIteration::RegisterInput(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst, unsigned short kind_recording){ + + if(kind_recording != MESH_COORDS) { + + /*--- Register structural displacements as input ---*/ + + solver[iZone][iInst][MESH_0][ADJFEA_SOL]->RegisterSolution(geometry[iZone][iInst][MESH_0], config[iZone]); + + /*--- Register variables as input ---*/ + + solver[iZone][iInst][MESH_0][ADJFEA_SOL]->RegisterVariables(geometry[iZone][iInst][MESH_0], config[iZone]); + } + else { + /*--- Register topology optimization densities (note direct solver) ---*/ + + solver[iZone][iInst][MESH_0][FEA_SOL]->RegisterVariables(geometry[iZone][iInst][MESH_0], config[iZone]); + + /*--- Register mesh coordinates for geometric sensitivities ---*/ + + geometry[iZone][iInst][MESH_0]->RegisterCoordinates(config[iZone]); + } +} + +void CDiscAdjFEAIteration::SetDependencies(CSolver *****solver, CGeometry ****geometry, CNumerics ******numerics, CConfig **config, + unsigned short iZone, unsigned short iInst, unsigned short kind_recording){ + + auto dir_solver = solver[iZone][iInst][MESH_0][FEA_SOL]; + auto adj_solver = solver[iZone][iInst][MESH_0][ADJFEA_SOL]; + auto structural_geometry = geometry[iZone][iInst][MESH_0]; + auto structural_numerics = numerics[iZone][iInst][MESH_0][FEA_SOL]; + + /*--- Some numerics are only instanciated under these conditions ---*/ + bool fsi = config[iZone]->GetFSI_Simulation(); + bool nonlinear = config[iZone]->GetGeometricConditions() == LARGE_DEFORMATIONS; + bool de_effects = config[iZone]->GetDE_Effects() && nonlinear; + bool element_based = dir_solver->IsElementBased() && nonlinear; + + for (unsigned short iProp = 0; iProp < config[iZone]->GetnElasticityMod(); iProp++){ + + su2double E = adj_solver->GetVal_Young(iProp); + su2double nu = adj_solver->GetVal_Poisson(iProp); + su2double rho = adj_solver->GetVal_Rho(iProp); + su2double rhoDL = adj_solver->GetVal_Rho_DL(iProp); + + /*--- Add dependencies for E and Nu ---*/ + + structural_numerics[FEA_TERM]->SetMaterial_Properties(iProp, E, nu); + + /*--- Add dependencies for Rho and Rho_DL ---*/ + + structural_numerics[FEA_TERM]->SetMaterial_Density(iProp, rho, rhoDL); + + /*--- Add dependencies for element-based simulations. ---*/ + + if (element_based){ + + /*--- Neo Hookean Compressible ---*/ + structural_numerics[MAT_NHCOMP]->SetMaterial_Properties(iProp, E, nu); + structural_numerics[MAT_NHCOMP]->SetMaterial_Density(iProp, rho, rhoDL); + + /*--- Ideal DE ---*/ + structural_numerics[MAT_IDEALDE]->SetMaterial_Properties(iProp, E, nu); + structural_numerics[MAT_IDEALDE]->SetMaterial_Density(iProp, rho, rhoDL); + + /*--- Knowles ---*/ + structural_numerics[MAT_KNOWLES]->SetMaterial_Properties(iProp, E, nu); + structural_numerics[MAT_KNOWLES]->SetMaterial_Density(iProp, rho, rhoDL); + } + } + + if (de_effects){ + for (unsigned short iEField = 0; iEField < adj_solver->GetnEField(); iEField++){ + structural_numerics[FEA_TERM]->Set_ElectricField(iEField, adj_solver->GetVal_EField(iEField)); + structural_numerics[DE_TERM]->Set_ElectricField(iEField, adj_solver->GetVal_EField(iEField)); + } + } + + /*--- Add dependencies for element-based simulations. ---*/ + + switch (config[iZone]->GetDV_FEA()) { + case YOUNG_MODULUS: + case POISSON_RATIO: + case DENSITY_VAL: + case DEAD_WEIGHT: + case ELECTRIC_FIELD: + + for (unsigned short iDV = 0; iDV < adj_solver->GetnDVFEA(); iDV++) { + + su2double dvfea = adj_solver->GetVal_DVFEA(iDV); + + structural_numerics[FEA_TERM]->Set_DV_Val(iDV, dvfea); + + if (de_effects) + structural_numerics[DE_TERM]->Set_DV_Val(iDV, dvfea); + + if (element_based){ + structural_numerics[MAT_NHCOMP]->Set_DV_Val(iDV, dvfea); + structural_numerics[MAT_IDEALDE]->Set_DV_Val(iDV, dvfea); + structural_numerics[MAT_KNOWLES]->Set_DV_Val(iDV, dvfea); + } + } + break; + } + + /*--- FSI specific dependencies. ---*/ + if (fsi) { + /*--- Set relation between solution and predicted displacements, which are the transferred ones. ---*/ + dir_solver->PredictStruct_Displacement(structural_geometry, config[iZone]); + } + + /*--- MPI dependencies. ---*/ + + dir_solver->InitiateComms(structural_geometry, config[iZone], SOLUTION_FEA); + dir_solver->CompleteComms(structural_geometry, config[iZone], SOLUTION_FEA); + + if (kind_recording == MESH_COORDS) { + structural_geometry->InitiateComms(structural_geometry, config[iZone], COORDINATES); + structural_geometry->CompleteComms(structural_geometry, config[iZone], COORDINATES); + } + + /*--- Topology optimization dependencies. ---*/ + + /*--- We only differentiate wrt to this variable in the adjoint secondary recording. ---*/ + if (config[iZone]->GetTopology_Optimization() && (kind_recording == MESH_COORDS)) { + /*--- The filter may require the volumes of the elements. ---*/ + structural_geometry->SetElemVolume(config[iZone]); + /// TODO: Ideally there would be a way to capture this dependency without the `static_cast`, but + /// making it a virtual method of CSolver does not feel "right" as its purpose could be confused. + static_cast(dir_solver)->FilterElementDensities(structural_geometry, config[iZone]); + } + +} + +void CDiscAdjFEAIteration::RegisterOutput(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst){ + + /*--- Register conservative variables as output of the iteration ---*/ + + solver[iZone][iInst][MESH_0][ADJFEA_SOL]->RegisterOutput(geometry[iZone][iInst][MESH_0],config[iZone]); + +} + +void CDiscAdjFEAIteration::InitializeAdjoint(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst){ + + /*--- Initialize the adjoint of the objective function (typically with 1.0) ---*/ + + solver[iZone][iInst][MESH_0][ADJFEA_SOL]->SetAdj_ObjFunc(geometry[iZone][iInst][MESH_0], config[iZone]); + + /*--- Initialize the adjoints the conservative variables ---*/ + + solver[iZone][iInst][MESH_0][ADJFEA_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]); + +} + +void CDiscAdjFEAIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { } + +bool CDiscAdjFEAIteration::Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + /*--- Write the convergence history (only screen output) ---*/ + + output->SetHistory_Output(geometry[val_iZone][INST_0][MESH_0], + solver[val_iZone][INST_0][MESH_0], + config[val_iZone], + config[val_iZone]->GetTimeIter(), + config[val_iZone]->GetOuterIter(), + config[val_iZone]->GetInnerIter()); + + return output->GetConvergence(); + +} +void CDiscAdjFEAIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + bool dynamic = (config[val_iZone]->GetTime_Domain()); + + // TEMPORARY output only for standalone structural problems + if ((!config[val_iZone]->GetFSI_Simulation()) && (rank == MASTER_NODE)){ + + unsigned short iVar; + + bool de_effects = config[val_iZone]->GetDE_Effects(); + + /*--- Header of the temporary output file ---*/ + ofstream myfile_res; + myfile_res.open ("Results_Reverse_Adjoint.txt", ios::app); + + myfile_res.precision(15); + + myfile_res << config[val_iZone]->GetTimeIter() << "\t"; + + switch (config[val_iZone]->GetKind_ObjFunc()){ + case REFERENCE_GEOMETRY: + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetTotal_OFRefGeom() << "\t"; + break; + case REFERENCE_NODE: + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetTotal_OFRefNode() << "\t"; + break; + case VOLUME_FRACTION: + case TOPOL_DISCRETENESS: + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetTotal_OFVolFrac() << "\t"; + break; + case TOPOL_COMPLIANCE: + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][FEA_SOL]->GetTotal_OFCompliance() << "\t"; + break; + } + + for (iVar = 0; iVar < config[val_iZone]->GetnElasticityMod(); iVar++) + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetTotal_Sens_E(iVar) << "\t"; + for (iVar = 0; iVar < config[val_iZone]->GetnPoissonRatio(); iVar++) + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetTotal_Sens_Nu(iVar) << "\t"; + if (dynamic){ + for (iVar = 0; iVar < config[val_iZone]->GetnMaterialDensity(); iVar++) + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetTotal_Sens_Rho(iVar) << "\t"; + } + + if (de_effects){ + for (iVar = 0; iVar < config[val_iZone]->GetnElectric_Field(); iVar++) + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetTotal_Sens_EField(iVar) << "\t"; + } + + for (iVar = 0; iVar < solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetnDVFEA(); iVar++){ + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetTotal_Sens_DVFEA(iVar) << "\t"; + } + + myfile_res << endl; + + myfile_res.close(); + } + + // TEST: for implementation of python framework in standalone structural problems + if ((!config[val_iZone]->GetFSI_Simulation()) && (rank == MASTER_NODE)){ + + /*--- Header of the temporary output file ---*/ + ofstream myfile_res; + bool outputDVFEA = false; + + switch (config[val_iZone]->GetDV_FEA()) { + case YOUNG_MODULUS: + myfile_res.open("grad_young.opt"); + outputDVFEA = true; + break; + case POISSON_RATIO: + myfile_res.open("grad_poisson.opt"); + outputDVFEA = true; + break; + case DENSITY_VAL: + case DEAD_WEIGHT: + myfile_res.open("grad_density.opt"); + outputDVFEA = true; + break; + case ELECTRIC_FIELD: + myfile_res.open("grad_efield.opt"); + outputDVFEA = true; + break; + default: + outputDVFEA = false; + break; + } + + if (outputDVFEA){ + + unsigned short iDV; + unsigned short nDV = solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetnDVFEA(); + + myfile_res << "INDEX" << "\t" << "GRAD" << endl; + + myfile_res.precision(15); + + for (iDV = 0; iDV < nDV; iDV++){ + myfile_res << iDV; + myfile_res << "\t"; + myfile_res << scientific << solver[val_iZone][val_iInst][MESH_0][ADJFEA_SOL]->GetTotal_Sens_DVFEA(iDV); + myfile_res << endl; + } + + myfile_res.close(); + + } + + } + +} + +CDiscAdjHeatIteration::CDiscAdjHeatIteration(CConfig *config) : CIteration(config) { } + +CDiscAdjHeatIteration::~CDiscAdjHeatIteration(void) { } + +void CDiscAdjHeatIteration::Preprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + unsigned long iPoint; + unsigned short TimeIter = config[val_iZone]->GetTimeIter(); + bool dual_time_1st = (config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST); + bool dual_time_2nd = (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND); + bool dual_time = (dual_time_1st || dual_time_2nd); + unsigned short iMesh; + int Direct_Iter; + + /*--- For the unsteady adjoint, load direct solutions from restart files. ---*/ + + if (config[val_iZone]->GetTime_Marching()) { + + Direct_Iter = SU2_TYPE::Int(config[val_iZone]->GetUnst_AdjointIter()) - SU2_TYPE::Int(TimeIter) - 2; + + /*--- For dual-time stepping we want to load the already converged solution at timestep n ---*/ + + if (dual_time) { + Direct_Iter += 1; + } + + if (TimeIter == 0){ + + if (dual_time_2nd) { + + /*--- Load solution at timestep n-2 ---*/ + + LoadUnsteady_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter-2); + + /*--- Push solution back to correct array ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(); + } + } + if (dual_time) { + + /*--- Load solution at timestep n-1 ---*/ + + LoadUnsteady_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter-1); + + /*--- Push solution back to correct array ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(); + } + } + + /*--- Load solution timestep n ---*/ + + LoadUnsteady_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter); + + } + + + if ((TimeIter > 0) && dual_time){ + + /*--- Load solution timestep n - 2 ---*/ + + LoadUnsteady_Solution(geometry, solver,config, val_iZone, val_iInst, Direct_Iter - 2); + + /*--- Temporarily store the loaded solution in the Solution_Old array ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->Set_OldSolution(); + + /*--- Set Solution at timestep n to solution at n-1 ---*/ + + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n(iPoint)); + } + } + if (dual_time_1st){ + /*--- Set Solution at timestep n-1 to the previously loaded solution ---*/ + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); + } + } + } + if (dual_time_2nd){ + /*--- Set Solution at timestep n-1 to solution at n-2 ---*/ + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_time_n1(iPoint)); + } + } + /*--- Set Solution at timestep n-2 to the previously loaded solution ---*/ + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + for(iPoint=0; iPointGetnPoint();iPoint++) { + + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->Set_Solution_time_n1(iPoint, solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->GetNodes()->GetSolution_Old(iPoint)); + } + } + } + } + } + + /*--- Store flow solution also in the adjoint solver in order to be able to reset it later ---*/ + + if (TimeIter == 0 || dual_time) { + for (iPoint = 0; iPoint < geometry[val_iZone][val_iInst][MESH_0]->GetnPoint(); iPoint++) { + solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->GetNodes()->SetSolution_Direct(iPoint, solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->GetNodes()->GetSolution(iPoint)); + } + } + + solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->Preprocessing(geometry[val_iZone][val_iInst][MESH_0], + solver[val_iZone][val_iInst][MESH_0], + config[val_iZone], + MESH_0, 0, RUNTIME_ADJHEAT_SYS, false); +} + + + +void CDiscAdjHeatIteration::LoadUnsteady_Solution(CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned short val_iZone, + unsigned short val_iInst, + int val_DirectIter) { + unsigned short iMesh; + + if (val_DirectIter >= 0) { + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << " Loading heat solution from direct iteration " << val_DirectIter << "." << endl; + + solver[val_iZone][val_iInst][MESH_0][HEAT_SOL]->LoadRestart(geometry[val_iZone][val_iInst], + solver[val_iZone][val_iInst], + config[val_iZone], + val_DirectIter, false); + } + + else { + /*--- If there is no solution file we set the freestream condition ---*/ + if (rank == MASTER_NODE && val_iZone == ZONE_0) + cout << " Setting freestream conditions at direct iteration " << val_DirectIter << "." << endl; + for (iMesh=0; iMesh<=config[val_iZone]->GetnMGLevels();iMesh++) { + + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->SetFreeStream_Solution(config[val_iZone]); + solver[val_iZone][val_iInst][iMesh][HEAT_SOL]->Postprocessing(geometry[val_iZone][val_iInst][iMesh], + solver[val_iZone][val_iInst][iMesh], + config[val_iZone], + iMesh); + } + } +} + + +void CDiscAdjHeatIteration::Iterate(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***volume_grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + + solver[val_iZone][val_iInst][MESH_0][ADJHEAT_SOL]->ExtractAdjoint_Solution(geometry[val_iZone][val_iInst][MESH_0], + config[val_iZone]); +} + +void CDiscAdjHeatIteration::InitializeAdjoint(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short iZone, unsigned short iInst){ + + /*--- Initialize the adjoints the conservative variables ---*/ + + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], + config[iZone]); +} + + +void CDiscAdjHeatIteration::RegisterInput(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, + unsigned short iZone, unsigned short iInst, + unsigned short kind_recording){ + + if (kind_recording == SOLUTION_VARIABLES || kind_recording == SOLUTION_AND_MESH){ + + /*--- Register flow and turbulent variables as input ---*/ + + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->RegisterSolution(geometry[iZone][iInst][MESH_0], config[iZone]); + + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->RegisterVariables(geometry[iZone][iInst][MESH_0], config[iZone]); + + } + if (kind_recording == MESH_COORDS){ + + /*--- Register node coordinates as input ---*/ + + geometry[iZone][iInst][MESH_0]->RegisterCoordinates(config[iZone]); + + } +} + +void CDiscAdjHeatIteration::SetDependencies(CSolver *****solver, + CGeometry ****geometry, + CNumerics ******numerics, + CConfig **config, + unsigned short iZone, unsigned short iInst, + unsigned short kind_recording){ + + if ((kind_recording == MESH_COORDS) || (kind_recording == NONE) || (kind_recording == SOLUTION_AND_MESH)){ + + /*--- Update geometry to get the influence on other geometry variables (normals, volume etc) ---*/ + + geometry[iZone][iInst][MESH_0]->UpdateGeometry(geometry[iZone][iInst], config[iZone]); + + CGeometry::ComputeWallDistance(config, geometry); + + } + + solver[iZone][iInst][MESH_0][HEAT_SOL]->Set_Heatflux_Areas(geometry[iZone][iInst][MESH_0], config[iZone]); + solver[iZone][iInst][MESH_0][HEAT_SOL]->Preprocessing(geometry[iZone][iInst][MESH_0], solver[iZone][iInst][MESH_0], + config[iZone], MESH_0, NO_RK_ITER, RUNTIME_HEAT_SYS, true); + solver[iZone][iInst][MESH_0][HEAT_SOL]->Postprocessing(geometry[iZone][iInst][MESH_0], solver[iZone][iInst][MESH_0], + config[iZone], MESH_0); + solver[iZone][iInst][MESH_0][HEAT_SOL]->InitiateComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + solver[iZone][iInst][MESH_0][HEAT_SOL]->CompleteComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION); + +} + +void CDiscAdjHeatIteration::RegisterOutput(CSolver *****solver, + CGeometry ****geometry, + CConfig **config, COutput* output, + unsigned short iZone, unsigned short iInst){ + + solver[iZone][iInst][MESH_0][ADJHEAT_SOL]->RegisterOutput(geometry[iZone][iInst][MESH_0], config[iZone]); + + geometry[iZone][iInst][MESH_0]->RegisterOutput_Coordinates(config[iZone]); +} + +void CDiscAdjHeatIteration::Update(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, unsigned short val_iInst) { + + unsigned short iMesh; + + /*--- Dual time stepping strategy ---*/ + + if ((config[val_iZone]->GetTime_Marching() == DT_STEPPING_1ST) || + (config[val_iZone]->GetTime_Marching() == DT_STEPPING_2ND)) { + + for (iMesh = 0; iMesh <= config[val_iZone]->GetnMGLevels(); iMesh++) { + integration[val_iZone][val_iInst][ADJHEAT_SOL]->SetConvergence(false); + } + } +} + +bool CDiscAdjHeatIteration::Monitor(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, + unsigned short val_iInst) { + + output->SetHistory_Output(geometry[val_iZone][INST_0][MESH_0], + solver[val_iZone][INST_0][MESH_0], + config[val_iZone], + config[val_iZone]->GetTimeIter(), + config[val_iZone]->GetOuterIter(), + config[val_iZone]->GetInnerIter()); + + return output->GetConvergence(); +} + +void CDiscAdjHeatIteration::Output(COutput *output, + CGeometry ****geometry, + CSolver *****solver, + CConfig **config, + unsigned long InnerIter, + bool StopCalc, + unsigned short val_iZone, + unsigned short val_iInst) { } + +void CDiscAdjHeatIteration::Postprocess(COutput *output, + CIntegration ****integration, + CGeometry ****geometry, + CSolver *****solver, + CNumerics ******numerics, + CConfig **config, + CSurfaceMovement **surface_movement, + CVolumetricMovement ***grid_movement, + CFreeFormDefBox*** FFDBox, + unsigned short val_iZone, unsigned short val_iInst) { } diff --git a/SU2_CFD/src/meson.build b/SU2_CFD/src/meson.build index d6eeb45630ec..c7fde72f4c3a 100644 --- a/SU2_CFD/src/meson.build +++ b/SU2_CFD/src/meson.build @@ -49,6 +49,7 @@ su2_cfd_src += files(['output/COutputFactory.cpp', 'output/tools/CWindowingTools.cpp']) su2_cfd_src += files(['variables/CIncNSVariable.cpp', + 'variables/CPBIncNSVariable.cpp', 'variables/CTransLMVariable.cpp', 'variables/CAdjEulerVariable.cpp', 'variables/CHeatVariable.cpp', @@ -72,6 +73,8 @@ su2_cfd_src += files(['variables/CIncNSVariable.cpp', 'variables/CNSVariable.cpp', 'variables/CAdjTurbVariable.cpp', 'variables/CIncEulerVariable.cpp', + 'variables/CPBIncEulerVariable.cpp', + 'variables/CEulerVariable.cpp', 'variables/CEulerVariable.cpp', 'variables/CNEMOEulerVariable.cpp', 'variables/CNEMONSVariable.cpp']) @@ -93,7 +96,10 @@ su2_cfd_src += files(['solvers/CSolverFactory.cpp', 'solvers/CFEM_DG_NSSolver.cpp', 'solvers/CHeatSolver.cpp', 'solvers/CIncEulerSolver.cpp', + 'solvers/CPBIncEulerSolver.cpp', 'solvers/CIncNSSolver.cpp', + 'solvers/CPBIncNSSolver.cpp', + 'solvers/CPoissonSolverFVM.cpp', 'solvers/CMeshSolver.cpp', 'solvers/CNEMOEulerSolver.cpp', 'solvers/CNEMONSSolver.cpp', @@ -110,6 +116,8 @@ su2_cfd_src += files(['numerics/CNumerics.cpp', 'numerics/transition.cpp', 'numerics/heat.cpp', 'numerics/radiation.cpp', + 'numerics/pbflow.cpp', + 'numerics/poisson.cpp', 'numerics/flow/convection/roe.cpp', 'numerics/flow/convection/fds.cpp', 'numerics/flow/convection/fvs.cpp', @@ -173,6 +181,7 @@ su2_cfd_src += files(['iteration/CIteration.cpp', 'iteration/CFEAIteration.cpp', 'iteration/CFEMFluidIteration.cpp', 'iteration/CFluidIteration.cpp', + 'iteration/CPBFluidIteration.cpp', 'iteration/CHeatIteration.cpp', 'iteration/CTurboIteration.cpp']) diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 75955dcbb3df..bbb20722e3e5 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -325,6 +325,33 @@ void CNumerics::GetInviscidIncProjFlux(const su2double *val_density, } + +void CNumerics::GetInviscidPBProjFlux(const su2double *val_density, + const su2double *val_velocity, + const su2double *val_pressure, + const su2double *val_normal, + su2double *val_Proj_Flux) { + su2double rhou, rhov, rhow; + + if (nDim == 2) { + rhou = (*val_density)*val_velocity[0]; + rhov = (*val_density)*val_velocity[1]; + + val_Proj_Flux[0] = (rhou*val_velocity[0])*val_normal[0] + rhou*val_velocity[1]*val_normal[1]; + val_Proj_Flux[1] = rhov*val_velocity[0]*val_normal[0] + (rhov*val_velocity[1])*val_normal[1]; + } + else { + rhou = (*val_density)*val_velocity[0]; + rhov = (*val_density)*val_velocity[1]; + rhow = (*val_density)*val_velocity[2]; + + val_Proj_Flux[0] = (rhou*val_velocity[0])*val_normal[0] + rhou*val_velocity[1]*val_normal[1] + rhou*val_velocity[2]*val_normal[2]; + val_Proj_Flux[1] = rhov*val_velocity[0]*val_normal[0] + (rhov*val_velocity[1])*val_normal[1] + rhov*val_velocity[2]*val_normal[2]; + val_Proj_Flux[2] = rhow*val_velocity[0]*val_normal[0] + rhow*val_velocity[1]*val_normal[1] + (rhow*val_velocity[2])*val_normal[2]; + } +} + + void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2double *val_energy, const su2double *val_normal, su2double val_scale, su2double **val_Proj_Jac_Tensor) const { @@ -362,7 +389,6 @@ void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2doubl AD::EndPassive(wasActive); } - void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2double *val_enthalpy, const su2double *val_chi, const su2double *val_kappa, const su2double *val_normal, su2double val_scale, @@ -529,7 +555,39 @@ void CNumerics::GetPreconditionedProjJac(const su2double *val_density, const su2 for (iDim = 0; iDim < nDim; iDim++) val_invPrecon_A[iDim+1][nDim+1] = 0.0; val_invPrecon_A[nDim+1][nDim+1] = val_lambda[nDim-1]; +} + +void CNumerics::GetInviscidPBProjJac(const su2double val_density, const su2double *val_velocity, const su2double *val_normal, + const su2double val_scale, su2double **val_Proj_Jac_Tensor) { + + unsigned short iDim; + su2double proj_vel; + + proj_vel = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + proj_vel += val_velocity[iDim]*val_normal[iDim]; + if (nDim == 2) { + val_Proj_Jac_Tensor[0][0] = val_scale*val_density*(val_velocity[0]*val_normal[0] + proj_vel); + val_Proj_Jac_Tensor[0][1] = val_scale*val_density*val_velocity[0]*val_normal[1]; + + val_Proj_Jac_Tensor[1][0] = val_scale*val_density*val_velocity[1]*val_normal[0]; + val_Proj_Jac_Tensor[1][1] = val_scale*val_density*(val_velocity[1]*val_normal[1] + proj_vel); + } + else { + val_Proj_Jac_Tensor[0][0] = val_scale*val_density*(proj_vel+val_velocity[0]*val_normal[0]); + val_Proj_Jac_Tensor[0][1] = val_scale*val_density*(val_velocity[0]*val_normal[1]); + val_Proj_Jac_Tensor[0][2] = val_scale*val_density*(val_velocity[0]*val_normal[2]); + + val_Proj_Jac_Tensor[1][0] = val_scale*val_density*(val_velocity[1]*val_normal[0]); + val_Proj_Jac_Tensor[1][1] = val_scale*val_density*(proj_vel+val_velocity[1]*val_normal[1]); + val_Proj_Jac_Tensor[1][2] = val_scale*val_density*(val_velocity[1]*val_normal[2]); + + val_Proj_Jac_Tensor[2][0] = val_scale*val_density*(val_velocity[2]*val_normal[0]); + val_Proj_Jac_Tensor[2][1] = val_scale*val_density*(val_velocity[2]*val_normal[1]); + val_Proj_Jac_Tensor[2][2] = val_scale*val_density*(proj_vel+val_velocity[2]*val_normal[2]); + + } } void CNumerics::GetPMatrix(const su2double *val_density, const su2double *val_velocity, @@ -1758,8 +1816,6 @@ void CNumerics::GetPrimitive2Conservative (const su2double *val_Mean_PrimVar, } } - - void CNumerics::CreateBasis(const su2double *val_Normal) { unsigned short iDim; su2double modm, modl; @@ -2206,3 +2262,127 @@ void CNumerics::tql2(su2double **V, su2double *d, su2double *e, unsigned short n } } +void CNumerics::GetViscousPBIncProjFlux(const su2double *val_primvar, + su2double **val_gradprimvar, + const su2double *val_normal, + const su2double val_laminar_viscosity, + const su2double val_eddy_viscosity, + const su2double val_turb_ke) { + + unsigned short iVar, iDim, jDim; + su2double total_viscosity, div_vel, Density; + + Density = val_primvar[nDim+1]; + + total_viscosity = (val_laminar_viscosity + val_eddy_viscosity); + + /*--- The full stress tensor is needed for variable density, as nabla.u != 0 ---*/ + /*--- Note: Gradients are computed as [iDim][jDim] and not [iDim+1][jDim] because + *--- the mean gradient passed here contains only velocities and no pressure. The + *--- mean gradient is computed as PrimVar_Grad[iVar+1][iDim], so no need to repeat.---*/ + + div_vel = 0.0; + for (iDim = 0 ; iDim < nDim; iDim++) + div_vel += val_gradprimvar[iDim][iDim]; + + for (iDim = 0 ; iDim < nDim; iDim++) + for (jDim = 0 ; jDim < nDim; jDim++) + tau[iDim][jDim] = (total_viscosity*(val_gradprimvar[jDim][iDim] + + val_gradprimvar[iDim][jDim] ) + -TWO3*total_viscosity*div_vel*delta[iDim][jDim] + -TWO3*Density*val_turb_ke*delta[iDim][jDim]); + + /*--- Gradient of primitive variables -> [Pressure vel_x vel_y vel_z Density] ---*/ + + if (nDim == 2) { + Flux_Tensor[0][0] = tau[0][0]; + Flux_Tensor[1][0] = tau[0][1]; + + Flux_Tensor[0][1] = tau[1][0]; + Flux_Tensor[1][1] = tau[1][1]; + + } else { + + Flux_Tensor[0][0] = tau[0][0]; + Flux_Tensor[1][0] = tau[0][1]; + Flux_Tensor[2][0] = tau[0][2]; + + Flux_Tensor[0][1] = tau[1][0]; + Flux_Tensor[1][1] = tau[1][1]; + Flux_Tensor[2][1] = tau[1][2]; + + Flux_Tensor[0][2] = tau[2][0]; + Flux_Tensor[1][2] = tau[2][1]; + Flux_Tensor[2][2] = tau[2][2]; + + } + + for (iVar = 0; iVar < nVar; iVar++) { + Proj_Flux_Tensor[iVar] = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Proj_Flux_Tensor[iVar] += Flux_Tensor[iVar][iDim] * val_normal[iDim]; + } + +} + +void CNumerics::GetViscousPBIncProjJacs(const su2double val_laminar_viscosity, + const su2double val_eddy_viscosity, + const su2double val_dist_ij, + const su2double *val_normal, + const su2double val_dS, + su2double **val_Proj_Jac_Tensor_i, su2double **val_Proj_Jac_Tensor_j) { + unsigned short iDim, iVar, jVar; + + su2double theta = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + theta += val_normal[iDim]*val_normal[iDim]; + + su2double total_viscosity = val_laminar_viscosity + val_eddy_viscosity; + su2double factor = total_viscosity/(val_dist_ij)*val_dS; + + if (nDim == 3) { + su2double thetax = theta + val_normal[0]*val_normal[0]/3.0; + su2double thetay = theta + val_normal[1]*val_normal[1]/3.0; + su2double thetaz = theta + val_normal[2]*val_normal[2]/3.0; + + su2double etax = val_normal[1]*val_normal[2]/3.0; + su2double etay = val_normal[0]*val_normal[2]/3.0; + su2double etaz = val_normal[0]*val_normal[1]/3.0; + + val_Proj_Jac_Tensor_i[0][0] = -factor*thetax; + val_Proj_Jac_Tensor_i[0][1] = -factor*etaz; + val_Proj_Jac_Tensor_i[0][2] = -factor*etay; + + val_Proj_Jac_Tensor_i[1][0] = -factor*etaz; + val_Proj_Jac_Tensor_i[1][1] = -factor*thetay; + val_Proj_Jac_Tensor_i[1][2] = -factor*etax; + + val_Proj_Jac_Tensor_i[2][0] = -factor*etay; + val_Proj_Jac_Tensor_i[2][1] = -factor*etax; + val_Proj_Jac_Tensor_i[2][2] = -factor*thetaz; + + + for (iVar = 0; iVar < nVar; iVar++) + for (jVar = 0; jVar < nVar; jVar++) + val_Proj_Jac_Tensor_j[iVar][jVar] = -val_Proj_Jac_Tensor_i[iVar][jVar]; + + } + + if (nDim == 2) { + su2double thetax = theta + val_normal[0]*val_normal[0]/3.0; + su2double thetay = theta + val_normal[1]*val_normal[1]/3.0; + su2double etaz = val_normal[0]*val_normal[1]/3.0; + + + val_Proj_Jac_Tensor_i[0][0] = -factor*thetax; + val_Proj_Jac_Tensor_i[0][1] = -factor*etaz; + + val_Proj_Jac_Tensor_i[1][0] = -factor*etaz; + val_Proj_Jac_Tensor_i[1][1] = -factor*thetay; + + for (iVar = 0; iVar < nVar; iVar++) + for (jVar = 0; jVar < nVar; jVar++) + val_Proj_Jac_Tensor_j[iVar][jVar] = -val_Proj_Jac_Tensor_i[iVar][jVar]; + } + +} diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index c871c5a841a4..c213745ca9e4 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -461,10 +461,15 @@ CNumerics::ResidualType<> CSourceIncRotatingFrame_Flow::ComputeResidual(const CC unsigned short iDim, iVar, jVar; su2double Momentum[MAXNDIM] = {0}, Velocity_i[MAXNDIM] = {0}; + unsigned short iVel = 1; + if (config->GetKind_Incomp_System()==PRESSURE_BASED) iVel = 0; /*--- Primitive variables plus momentum at the node (point i) ---*/ - DensityInc_i = V_i[nDim+2]; + if (config->GetKind_Incomp_System()==PRESSURE_BASED) + DensityInc_i = V_i[nDim+1]; + else + DensityInc_i = V_i[nDim+2]; for (iDim = 0; iDim < nDim; iDim++) { Velocity_i[iDim] = V_i[iDim+1]; @@ -472,18 +477,17 @@ CNumerics::ResidualType<> CSourceIncRotatingFrame_Flow::ComputeResidual(const CC } /*--- Calculate rotating frame source term residual as ( Omega X Rho-U ) ---*/ + + for (iVar = 0; iVar < nVar; iVar++) + residual[iVar] = 0.0; if (nDim == 2) { - residual[0] = 0.0; - residual[1] = (Omega[1]*Momentum[2] - Omega[2]*Momentum[1])*Volume; - residual[2] = (Omega[2]*Momentum[0] - Omega[0]*Momentum[2])*Volume; - residual[3] = 0.0; + residual[iVel] = (Omega[1]*Momentum[2] - Omega[2]*Momentum[1])*Volume; + residual[iVel+1] = (Omega[2]*Momentum[0] - Omega[0]*Momentum[2])*Volume; } else { - residual[0] = 0.0; - residual[1] = (Omega[1]*Momentum[2] - Omega[2]*Momentum[1])*Volume; - residual[2] = (Omega[2]*Momentum[0] - Omega[0]*Momentum[2])*Volume; - residual[3] = (Omega[0]*Momentum[1] - Omega[1]*Momentum[0])*Volume; - residual[4] = 0.0; + residual[iVel] = (Omega[1]*Momentum[2] - Omega[2]*Momentum[1])*Volume; + residual[iVel+1] = (Omega[2]*Momentum[0] - Omega[0]*Momentum[2])*Volume; + residual[iVel+2] = (Omega[0]*Momentum[1] - Omega[1]*Momentum[0])*Volume; } /*--- Calculate the source term Jacobian ---*/ @@ -493,15 +497,15 @@ CNumerics::ResidualType<> CSourceIncRotatingFrame_Flow::ComputeResidual(const CC for (jVar = 0; jVar < nVar; jVar++) jacobian[iVar][jVar] = 0.0; if (nDim == 2) { - jacobian[1][2] = -DensityInc_i*Omega[2]*Volume; - jacobian[2][1] = DensityInc_i*Omega[2]*Volume; + jacobian[iVel][iVel+1] = -DensityInc_i*Omega[2]*Volume; + jacobian[iVel+1][iVel] = DensityInc_i*Omega[2]*Volume; } else { - jacobian[1][2] = -DensityInc_i*Omega[2]*Volume; - jacobian[1][3] = DensityInc_i*Omega[1]*Volume; - jacobian[2][1] = DensityInc_i*Omega[2]*Volume; - jacobian[2][3] = -DensityInc_i*Omega[0]*Volume; - jacobian[3][1] = -DensityInc_i*Omega[1]*Volume; - jacobian[3][2] = DensityInc_i*Omega[0]*Volume; + jacobian[iVel][iVel+1] = -DensityInc_i*Omega[2]*Volume; + jacobian[iVel][iVel+2] = DensityInc_i*Omega[1]*Volume; + jacobian[iVel+1][iVel] = DensityInc_i*Omega[2]*Volume; + jacobian[iVel+1][iVel+2] = -DensityInc_i*Omega[0]*Volume; + jacobian[iVel+2][iVel] = -DensityInc_i*Omega[1]*Volume; + jacobian[iVel+2][iVel+1] = DensityInc_i*Omega[0]*Volume; } } diff --git a/SU2_CFD/src/numerics/pbflow.cpp b/SU2_CFD/src/numerics/pbflow.cpp new file mode 100644 index 000000000000..422d9aef4722 --- /dev/null +++ b/SU2_CFD/src/numerics/pbflow.cpp @@ -0,0 +1,573 @@ +/*! + * \file numerics_direct_mean_inc.cpp + * \brief This file contains the numerical methods for incompressible flow. + * \author F. Palacios, T. Economon + * \version 6.0.1 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2018, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/numerics/pbflow.hpp" + +CUpwPB_Flow::CUpwPB_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config) : CNumerics(val_nDim, val_nVar, config) { + + implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + gravity = config->GetGravityForce(); + Froude = config->GetFroude(); + dynamic_grid = config->GetDynamic_Grid(); + + Diff_U = new su2double [nVar]; + Velocity_i = new su2double [nDim]; + Velocity_j = new su2double [nDim]; + Velocity_upw = new su2double [nDim]; + MeanVelocity = new su2double [nDim]; + Flux = new su2double [nDim]; + ProjFlux_i = new su2double [nVar]; + ProjFlux_j = new su2double [nVar]; + Jacobian_i = new su2double* [nVar]; + Jacobian_j = new su2double* [nVar]; + Jacobian_upw = new su2double* [nVar]; + + + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar] = new su2double [nVar]; + Jacobian_j[iVar] = new su2double [nVar]; + Jacobian_upw[iVar] = new su2double [nVar]; + } + +} + +CUpwPB_Flow::~CUpwPB_Flow(void) { + + delete [] Diff_U; + delete [] Velocity_i; + delete [] Velocity_j; + delete [] Velocity_upw; + delete [] MeanVelocity; + delete [] Flux; + delete [] ProjFlux_i; + delete [] ProjFlux_j; + + for (iVar = 0; iVar < nVar; iVar++) { + delete [] Jacobian_i[iVar]; + delete [] Jacobian_j[iVar]; + delete [] Jacobian_upw[iVar]; + } + delete [] Jacobian_i; + delete [] Jacobian_j; + delete [] Jacobian_upw; + +} + +CNumerics::ResidualType<> CUpwPB_Flow::ComputeResidual(const CConfig *config) { + + + su2double MeanDensity, Flux0, Flux1, MeanPressure, Area, FF, Vel0, Vel1, ProjGridVelFlux = 0.0; + + + /*--- Primitive variables at point i and j ---*/ + Pressure_i = V_i[0]; Pressure_j = V_j[0]; + DensityInc_i = V_i[nDim+1]; DensityInc_j = V_j[nDim+1]; + MeanDensity = 0.5*(DensityInc_i + DensityInc_j); + MeanPressure = 0.5*(Pressure_i + Pressure_j); + + Area = 0.0; + for(iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + /*--- (rho*u_i) ---*/ + Face_Flux = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Velocity_i[iDim] = V_i[iDim+1]; + Velocity_j[iDim] = V_j[iDim+1]; + MeanVelocity[iDim] = 0.5*(Velocity_i[iDim] + Velocity_j[iDim]); + Face_Flux += MeanDensity*MeanVelocity[iDim]*Normal[iDim]; + } + + if (dynamic_grid) { + ProjGridVelFlux = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + ProjGridVelFlux += 0.5*MeanDensity*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; + } + Face_Flux -= ProjGridVelFlux; + } + + /*--- Find upwind direction. ---*/ + Flux0 = 0.5*(Face_Flux + fabs(Face_Flux)) ; + Flux1 = 0.5*(Face_Flux - fabs(Face_Flux)) ; + + Upw_i = round(fabs(Flux0/(fabs(Face_Flux)+EPS))); + Upw_j = round(fabs(Flux1/(fabs(Face_Flux)+EPS))); + + /*--- Find flux. ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + Flux[iVar] = Flux0*V_i[iVar+1] + Flux1*V_j[iVar+1]; + Velocity_upw[iVar] = Upw_i*V_i[iVar+1] + Upw_j*V_j[iVar+1]; + if (dynamic_grid) Velocity_upw[iVar] -= (Upw_i*GridVel_i[iVar] + Upw_j*GridVel_j[iVar]); + } + + if (implicit) { + for (iVar = 0; iVar < nVar; iVar++) + for (jVar = 0; jVar < nVar; jVar++) { + Jacobian_j[iVar][jVar] = 0.0; + Jacobian_i[iVar][jVar] = 0.0; + Jacobian_upw[iVar][jVar] = 0.0; + } + + GetInviscidPBProjJac(MeanDensity, Velocity_upw, Normal, 0.5, Jacobian_upw); + + for (iVar = 0; iVar < nVar; iVar++) + for (jVar = 0; jVar < nVar; jVar++) { + Jacobian_i[iVar][jVar] = Upw_i*Jacobian_upw[iVar][jVar]; + Jacobian_j[iVar][jVar] = Upw_j*Jacobian_upw[iVar][jVar]; + } + } + + return ResidualType<>(Flux, Jacobian_i, Jacobian_j); +} + +CCentPB_Flow::CCentPB_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config) : CNumerics(val_nDim, val_nVar, config) { + + implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + gravity = config->GetGravityForce(); + Froude = config->GetFroude(); + dynamic_grid = config->GetDynamic_Grid(); + + Diff_U = new su2double [nVar]; + Velocity_i = new su2double [nDim]; + Velocity_j = new su2double [nDim]; + Velocity_upw = new su2double [nDim]; + MeanVelocity = new su2double [nDim]; + Flux = new su2double [nDim]; + ProjFlux_i = new su2double [nVar]; + ProjFlux_j = new su2double [nVar]; + Jacobian_i = new su2double* [nVar]; + Jacobian_j = new su2double* [nVar]; + Jacobian_upw = new su2double* [nVar]; + + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar] = new su2double [nVar]; + Jacobian_j[iVar] = new su2double [nVar]; + Jacobian_upw[iVar] = new su2double [nVar]; + } +} + +CCentPB_Flow::~CCentPB_Flow(void) { + + delete [] Diff_U; + delete [] Velocity_i; + delete [] Velocity_j; + delete [] Velocity_upw; + delete [] MeanVelocity; + delete [] Flux; + delete [] ProjFlux_i; + delete [] ProjFlux_j; + + for (iVar = 0; iVar < nVar; iVar++) { + delete [] Jacobian_i[iVar]; + delete [] Jacobian_j[iVar]; + delete [] Jacobian_upw[iVar]; + } + delete [] Jacobian_i; + delete [] Jacobian_j; + delete [] Jacobian_upw; + +} + +CNumerics::ResidualType<> CCentPB_Flow::ComputeResidual(const CConfig *config) { + /*--- To do list + * 1. Find upwind direction, upwind node and downwind node + * 2. Compute normalised variable for the upwind node using the gradient of the upwind node + * 3. Find face velocity using central difference scheme + * 4. Use the ULTIMATE limiter to find the adjusted face velocity + * 5. Find residual as FaceFlux * AdjustedFaceVelocity + * */ + + + su2double MeanDensity, Flux0, Flux1, MeanPressure, Area, FF, Vel0, Vel1, ProjGridVelFlux = 0.0; + su2double dissipation, kappa=0.15, ProjVel_i = 0.0, ProjVel_j = 0.0; + + /*--- Conservative variables at point i and j ---*/ + + Pressure_i = V_i[0]; Pressure_j = V_j[0]; + DensityInc_i = V_i[nDim+1]; DensityInc_j = V_j[nDim+1]; + + for (iDim = 0; iDim < nDim; iDim++) { + Velocity_i[iDim] = V_i[iDim+1]; + Velocity_j[iDim] = V_j[iDim+1]; + } + + Area = 0.0; + for(iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + Face_Flux = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Velocity_i[iDim] = V_i[iDim+1]; + Velocity_j[iDim] = V_j[iDim+1]; + MeanVelocity[iDim] = 0.5*(Velocity_i[iDim] + Velocity_j[iDim]); + Face_Flux += MeanDensity*MeanVelocity[iDim]*Normal[iDim]; + ProjVel_i += Velocity_i[iDim]*Normal[iDim]; + ProjVel_j += Velocity_j[iDim]*Normal[iDim]; + } + + if (dynamic_grid) { + ProjGridVelFlux = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + ProjGridVelFlux += 0.5*MeanDensity*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; + } + Face_Flux -= ProjGridVelFlux; + } + + Flux0 = 0.5*(Face_Flux + fabs(Face_Flux)) ; + Flux1 = 0.5*(Face_Flux - fabs(Face_Flux)) ; + + Upw_i = round(fabs(Flux0/(fabs(Face_Flux)+EPS))); + Upw_j = round(fabs(Flux1/(fabs(Face_Flux)+EPS))); + + for (iVar = 0; iVar < nVar; iVar++) { + Velocity_upw[iVar] = Upw_i*V_i[iVar+1] + Upw_j*V_j[iVar+1]; + if (dynamic_grid) Velocity_upw[iVar] -= (Upw_i*GridVel_i[iVar] + Upw_j*GridVel_j[iVar]); + Flux[iVar] = Face_Flux*MeanVelocity[iVar]; + } + + //Dissipation + su2double lambda_i = 0.0, lambda_j = 0.0; + lambda_i = 2.0*abs(ProjVel_i); + lambda_j = 2.0*abs(ProjVel_j); + + su2double lambda_mean = 0.5*(lambda_i + lambda_j); + if (lambda_mean < EPS) { + lambda_i = 2.0*abs(config->GetVelocity_Ref()*Area); + lambda_j = 2.0*abs(config->GetVelocity_Ref()*Area); + lambda_mean = abs(config->GetVelocity_Ref()*Area); + } + + su2double Param_p = 0.3, SF=0.0; + su2double Phi_i = pow((lambda_i/(4.0*lambda_mean)),Param_p); + su2double Phi_j = pow((lambda_j/(4.0*lambda_mean)),Param_p); + + if ((Phi_i + Phi_j) != 0.0) + SF = 4.0*Phi_i*Phi_j/(Phi_i + Phi_j); + + su2double sc0 = 3.0*(Neighbor_i + Neighbor_j)/(Neighbor_i*Neighbor_j); + su2double E_0 = kappa*sc0*2.0/3.0; + + su2double diss[MAXNDIM]; + for (iDim = 0; iDim < nDim; iDim++) + diss[iDim] = E_0*(DensityInc_i*Velocity_i[iDim] - DensityInc_j*Velocity_j[iDim])*SF*lambda_mean; + + for (iVar = 0; iVar < nVar; iVar++) + Flux[iVar] += diss[iVar]; + + /*--- For implicit schemes, compute jacobians based on the upwind scheme for stability issues. (See ANSYS user guide) ---*/ + if (implicit) { + for (iVar = 0; iVar < nVar; iVar++) + for (jVar = 0; jVar < nVar; jVar++) { + Jacobian_j[iVar][jVar] = 0.0; + Jacobian_i[iVar][jVar] = 0.0; + Jacobian_upw[iVar][jVar] = 0.0; + } + + GetInviscidPBProjJac(MeanDensity, MeanVelocity, Normal, 0.5, Jacobian_upw); + //GetInviscidPBProjJac(&DensityInc_i, Velocity_upw, Normal, 0.5, val_Jacobian_upw); + /*GetInviscidPBProjJac(&DensityInc_i, Velocity_i, Normal, 0.5, Jacobian_i); + GetInviscidPBProjJac(&DensityInc_i, Velocity_j, Normal, 0.5, Jacobian_j);*/ + + for (iVar = 0; iVar < nVar; iVar++) + for (jVar = 0; jVar < nVar; jVar++) { + Jacobian_i[iVar][jVar] = Upw_i*Jacobian_upw[iVar][jVar]; + Jacobian_j[iVar][jVar] = Upw_j*Jacobian_upw[iVar][jVar]; + } + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar][iVar] += E_0*DensityInc_i*SF*lambda_mean; + Jacobian_i[iVar][iVar] -= E_0*DensityInc_j*SF*lambda_mean; + } + + } + + return ResidualType<>(Flux, Jacobian_i, Jacobian_j); + +} + +CAvgGradPBInc_Flow::CAvgGradPBInc_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config) : CNumerics(val_nDim, val_nVar, config) { + + implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + Jacobian_i = new su2double* [nVar]; + Jacobian_j = new su2double* [nVar]; + + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar] = new su2double [nVar]; + Jacobian_j[iVar] = new su2double [nVar]; + } + + /*--- Primitive flow variables. ---*/ + + PrimVar_i = new su2double [nDim+4]; + PrimVar_j = new su2double [nDim+4]; + Mean_PrimVar = new su2double [nDim+4]; + + /*--- Incompressible flow, primitive variables nDim+2, (P, vx, vy, vz, rho) ---*/ + + Mean_GradPrimVar = new su2double*[nVar]; + + /*--- Incompressible flow, gradient primitive variables nDim+2, (P, vx, vy, vz, rho) ---*/ + + for (iVar = 0; iVar < nVar; iVar++) + Mean_GradPrimVar[iVar] = new su2double[nDim]; + +} + +CAvgGradPBInc_Flow::~CAvgGradPBInc_Flow(void) { + + delete [] PrimVar_i; + delete [] PrimVar_j; + delete [] Mean_PrimVar; + + for (iVar = 0; iVar < nVar; iVar++) + delete [] Mean_GradPrimVar[iVar]; + delete [] Mean_GradPrimVar; + + for (iVar = 0; iVar < nVar; iVar++) { + delete [] Jacobian_i[iVar]; + delete [] Jacobian_j[iVar]; + } + delete [] Jacobian_i; + delete [] Jacobian_j; + +} + +CNumerics::ResidualType<> CAvgGradPBInc_Flow::ComputeResidual(const CConfig *config) { + + /*--- Normalized normal vector ---*/ + + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + for (iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = Normal[iDim]/Area; + + for (iVar = 0; iVar < nDim+4; iVar++) { + PrimVar_i[iVar] = V_i[iVar]; + PrimVar_j[iVar] = V_j[iVar]; + Mean_PrimVar[iVar] = 0.5*(PrimVar_i[iVar]+PrimVar_j[iVar]); + } + + /*--- Density and transport properties ---*/ + + Laminar_Viscosity_i = V_i[nDim+2]; Laminar_Viscosity_j = V_j[nDim+2]; + Eddy_Viscosity_i = V_i[nDim+3]; Eddy_Viscosity_j = V_j[nDim+3]; + + /*--- Mean transport properties ---*/ + + Mean_Laminar_Viscosity = 0.5*(Laminar_Viscosity_i + Laminar_Viscosity_j); + Mean_Eddy_Viscosity = 0.5*(Eddy_Viscosity_i + Eddy_Viscosity_j); + Mean_turb_ke = 0.0;//0.5*(turb_ke_i + turb_ke_j); + + /*--- Mean gradient approximation ---*/ + + for (iVar = 0; iVar < nVar; iVar++) + for (iDim = 0; iDim < nDim; iDim++) + Mean_GradPrimVar[iVar][iDim] = 0.5*(PrimVar_Grad_i[iVar+1][iDim] + PrimVar_Grad_j[iVar+1][iDim]); + + /*--- Get projected flux tensor ---*/ + + GetViscousPBIncProjFlux(Mean_PrimVar, Mean_GradPrimVar, Normal, Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, Mean_turb_ke); + + + /*--- Implicit part ---*/ + + if (implicit) { + + dist_ij = 0.0; proj_vector_ij = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]); + proj_vector_ij += (Coord_j[iDim]-Coord_i[iDim])*Normal[iDim]; + } + proj_vector_ij = proj_vector_ij/dist_ij; + dist_ij = sqrt(dist_ij); + + if (dist_ij == 0.0) { + for (iVar = 0; iVar < nVar; iVar++) { + for (jVar = 0; jVar < nVar; jVar++) { + Jacobian_i[iVar][jVar] = 0.0; + Jacobian_j[iVar][jVar] = 0.0; + } + } + } + else { + GetViscousPBIncProjJacs(Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, dist_ij, UnitNormal, + Area, Jacobian_i, Jacobian_j); + } + + } + + return ResidualType<>(Proj_Flux_Tensor, Jacobian_i, Jacobian_j); +} + +CAvgGradCorrectedPBInc_Flow::CAvgGradCorrectedPBInc_Flow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config) : CNumerics(val_nDim, val_nVar, config) { + + implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + Jacobian_i = new su2double* [nVar]; + Jacobian_j = new su2double* [nVar]; + + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar] = new su2double [nVar]; + Jacobian_j[iVar] = new su2double [nVar]; + } + + /*--- Primitive flow variables. ---*/ + + Mean_PrimVar = new su2double [nDim+4]; + PrimVar_i = new su2double [nDim+4]; + PrimVar_j = new su2double [nDim+4]; + Proj_Mean_GradPrimVar_Edge = new su2double [nVar]; + Edge_Vector = new su2double [nDim]; + + Mean_GradPrimVar = new su2double* [nVar]; + for (iVar = 0; iVar < nVar; iVar++) + Mean_GradPrimVar[iVar] = new su2double [nDim]; + +} + +CAvgGradCorrectedPBInc_Flow::~CAvgGradCorrectedPBInc_Flow(void) { + + delete [] Mean_PrimVar; + delete [] PrimVar_i; + delete [] PrimVar_j; + delete [] Proj_Mean_GradPrimVar_Edge; + delete [] Edge_Vector; + + for (iVar = 0; iVar < nVar; iVar++) + delete [] Mean_GradPrimVar[iVar]; + delete [] Mean_GradPrimVar; + + for (iVar = 0; iVar < nVar; iVar++) { + delete [] Jacobian_i[iVar]; + delete [] Jacobian_j[iVar]; + } + delete [] Jacobian_i; + delete [] Jacobian_j; + +} + +CNumerics::ResidualType<> CAvgGradCorrectedPBInc_Flow::ComputeResidual(const CConfig *config) { + + unsigned short nPrimVarGrad = nDim+2, nPrimVar = nDim+4; + + /*--- Normalized normal vector ---*/ + + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + for (iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = Normal[iDim]/Area; + + /*--- Conversion to Primitive Variables (P, u, v, w, rho, mu, muT) ---*/ + + for (iVar = 0; iVar < nPrimVar; iVar++) { + PrimVar_i[iVar] = V_i[iVar]; + PrimVar_j[iVar] = V_j[iVar]; + Mean_PrimVar[iVar] = 0.5*(PrimVar_i[iVar]+PrimVar_j[iVar]); + } + + /*--- Density and transport properties ---*/ + + DensityInc_i = V_i[nDim+1]; DensityInc_j = V_j[nDim+1]; + Laminar_Viscosity_i = V_i[nDim+2]; Laminar_Viscosity_j = V_j[nDim+2]; + Eddy_Viscosity_i = V_i[nDim+3]; Eddy_Viscosity_j = V_j[nDim+3]; + + /*--- Mean transport properties ---*/ + + Mean_Laminar_Viscosity = 0.5*(Laminar_Viscosity_i + Laminar_Viscosity_j); + Mean_Eddy_Viscosity = 0.5*(Eddy_Viscosity_i + Eddy_Viscosity_j); + Mean_turb_ke = 0.0;//0.5*(turb_ke_i + turb_ke_j); + + /*--- Compute vector going from iPoint to jPoint ---*/ + + dist_ij_2 = 0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + } + + /*--- Projection of the mean gradient in the direction of the edge ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + Proj_Mean_GradPrimVar_Edge[iVar] = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradPrimVar[iVar][iDim] = 0.5*(PrimVar_Grad_i[iVar+1][iDim] + PrimVar_Grad_j[iVar+1][iDim]); + Proj_Mean_GradPrimVar_Edge[iVar] += Mean_GradPrimVar[iVar][iDim]*Edge_Vector[iDim]; + } + if (dist_ij_2 != 0.0) { + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradPrimVar[iVar][iDim] -= (Proj_Mean_GradPrimVar_Edge[iVar] - + (PrimVar_j[iVar+1]-PrimVar_i[iVar+1]))*Edge_Vector[iDim] / dist_ij_2; + } + } + } + + /*--- Get projected flux tensor ---*/ + + GetViscousPBIncProjFlux(Mean_PrimVar, Mean_GradPrimVar, Normal, Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, Mean_turb_ke); + + /*--- Implicit part ---*/ + + if (implicit) { + + proj_vector_ij = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + proj_vector_ij += (Coord_j[iDim]-Coord_i[iDim])*Normal[iDim]; + } + proj_vector_ij = proj_vector_ij/dist_ij_2; + + if (dist_ij_2 == 0.0) { + for (iVar = 0; iVar < nVar; iVar++) { + for (jVar = 0; jVar < nVar; jVar++) { + Jacobian_i[iVar][jVar] = 0.0; + Jacobian_j[iVar][jVar] = 0.0; + } + } + } + else { + GetViscousPBIncProjJacs(Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, sqrt(dist_ij_2), UnitNormal, + Area, Jacobian_i, Jacobian_j); + } + + } + + return ResidualType<>(Proj_Flux_Tensor, Jacobian_i, Jacobian_j); +} diff --git a/SU2_CFD/src/numerics/poisson.cpp b/SU2_CFD/src/numerics/poisson.cpp new file mode 100644 index 000000000000..11c8a357f39e --- /dev/null +++ b/SU2_CFD/src/numerics/poisson.cpp @@ -0,0 +1,423 @@ +/*! + * \file numerics_direct_poisson.cpp + * \brief This file contains all the convective term discretization. + * \author F. Palacios + * \version 6.1.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2018, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/numerics/poisson.hpp" + + +CAvgGradCorrected_Poisson::CAvgGradCorrected_Poisson(unsigned short val_nDim, unsigned short val_nVar, + CConfig *config) : CNumerics(val_nDim, val_nVar, config) { + + implicit = false; + implicit = (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT); + direct = false; + + + Edge_Vector = new su2double [nDim]; + Proj_Mean_GradPoissonVar_Edge = new su2double [nVar]; + Proj_Mean_GradPoissonVar_Kappa = new su2double [nVar]; + Proj_Mean_GradPoissonVar_Corrected = new su2double [nVar]; + Jacobian_i = new su2double* [nVar]; + Jacobian_j = new su2double* [nVar]; + Mean_GradPoissonVar = new su2double* [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar] = new su2double [nDim]; + Jacobian_j[iVar] = new su2double [nDim]; + Mean_GradPoissonVar[iVar] = new su2double [nDim]; + } + + Poisson_Coeff_i = 1.0; + Poisson_Coeff_j = 1.0; + + Mom_Coeff_i = new su2double [nDim]; + Mom_Coeff_j = new su2double [nDim]; + +} + + +CAvgGradCorrected_Poisson::~CAvgGradCorrected_Poisson(void) { + + delete [] Edge_Vector; + delete [] Proj_Mean_GradPoissonVar_Edge; + delete [] Proj_Mean_GradPoissonVar_Kappa; + delete [] Proj_Mean_GradPoissonVar_Corrected; + delete [] Mom_Coeff_i; + delete [] Mom_Coeff_j; + + for (iVar = 0; iVar < nVar; iVar++) { + delete [] Mean_GradPoissonVar[iVar]; + delete [] Jacobian_i[iVar]; + delete [] Jacobian_j[iVar]; + } + delete [] Mean_GradPoissonVar; + delete [] Jacobian_i; + delete [] Jacobian_j; +} + +CNumerics::ResidualType<> CAvgGradCorrected_Poisson::ComputeResidual(const CConfig *config) { + + su2double Coeff_Mean; + su2double *MomCoeffxNormal = new su2double[nDim]; + su2double *MomCoeffxNormalCorrected = new su2double[nDim]; + su2double Mean_GradPoissonVar_Edge[MAXNDIM], GradPoisson[MAXNDIM]; + su2double Mean_GradPoissonVar_Face[MAXNDIM][MAXNDIM], Num, Den; + + Poisson_Coeff_Mean = 1.0;//0.5*(Poisson_Coeff_i + Poisson_Coeff_j); + + /*--- Multiply the normal with the coefficients of the momentum equation + * and use it instead of the normal during the projection operation ---*/ + for (iDim = 0; iDim < nDim; iDim++) { + Coeff_Mean = 0.5*(Mom_Coeff_i[iDim] + Mom_Coeff_j[iDim]) ; + MomCoeffxNormal[iDim] = Coeff_Mean*Normal[iDim]; + } + + /*--- Compute vector going from iPoint to jPoint ---*/ + /*--- Minimum correction approach. ---*/ + /*dist_ij_2 = 0; proj_vector_ij = 0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + proj_vector_ij += Edge_Vector[iDim]*MomCoeffxNormal[iDim]; + } + if (dist_ij_2 == 0.0) proj_vector_ij = 0.0; + else proj_vector_ij = proj_vector_ij/dist_ij_2;*/ + + /*--- Over relaxed approach. ---*/ + dist_ij_2 = 0; proj_vector_ij = 0; + Num = 0.0; Den = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + Num += MomCoeffxNormal[iDim]*MomCoeffxNormal[iDim]; + Den += Edge_Vector[iDim]*MomCoeffxNormal[iDim]; + } + if (Den == 0.0) proj_vector_ij = 0.0; + else proj_vector_ij = Num/Den; + + /*--- Orthogonal correction approach. ---*/ + /*dist_ij_2 = 0; proj_vector_ij = 0; + Num = 0.0; Den = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + Num += MomCoeffxNormal[iDim]*MomCoeffxNormal[iDim]; + } + Den = dist_ij_2; + if (Den == 0.0) proj_vector_ij = 0.0; + else proj_vector_ij = sqrt(Num/Den);*/ + + /*--- Correct the face gradient for odd-even decoupling ---*/ + /*--- Steps are + * 1. Interpolate the gradient at the face -> du/ds|_in + * 2. Find the projection of the interpolated gradient on the edge vector -> (du/ds|_in) . e + * 3. Find the gradient as the difference between the neighboring nodes -> (u_j - u_i)/ds + * 4. Correct the gradient at the face using du/ds = du/ds|_in + ( (u_j - u_i)/ds - (du/ds|_in . e) ) . e ---*/ + + /*for (iVar = 0; iVar < nVar; iVar++) { + Mean_GradPoissonVar_Edge[iVar] = 0.0; + + GradPoisson[iVar] = (Poissonval_j - Poissonval_i)/sqrt(dist_ij_2); + + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradPoissonVar[iVar][iDim] = 0.5*(ConsVar_Grad_i[iVar][iDim] + ConsVar_Grad_j[iVar][iDim]); + + Mean_GradPoissonVar_Edge[iVar] += Mean_GradPoissonVar[iVar][iDim]*Edge_Vector[iDim]/dist_ij_2; + } + } + + for (iVar = 0; iVar < nVar; iVar++) { + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradPoissonVar_Face[iVar][iDim] = Mean_GradPoissonVar[iVar][iDim] + + (GradPoisson[iVar] - Mean_GradPoissonVar_Edge[iVar])*Edge_Vector[iDim]/dist_ij_2; + } + }*/ + + + /*--- Mean gradient approximation. Projection of the mean gradient + in the direction of the edge ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + Proj_Mean_GradPoissonVar_Edge[iVar] = 0.0; + Proj_Mean_GradPoissonVar_Kappa[iVar] = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradPoissonVar[iVar][iDim] = 0.5*(ConsVar_Grad_i[iVar][iDim] + ConsVar_Grad_j[iVar][iDim]); + Proj_Mean_GradPoissonVar_Kappa[iVar] += Mean_GradPoissonVar[iVar][iDim]*MomCoeffxNormal[iDim]; + Proj_Mean_GradPoissonVar_Edge[iVar] += Mean_GradPoissonVar[iVar][iDim]*Edge_Vector[iDim]; + } + Proj_Mean_GradPoissonVar_Corrected[iVar] = Proj_Mean_GradPoissonVar_Kappa[iVar]; + Proj_Mean_GradPoissonVar_Corrected[iVar] -= Proj_Mean_GradPoissonVar_Edge[iVar]*proj_vector_ij - + (Poissonval_j-Poissonval_i)*proj_vector_ij; + } + + /*--- Jacobians for implicit scheme ---*/ + + if (implicit) { + Jacobian_i[0][0] = -Poisson_Coeff_Mean*proj_vector_ij; + Jacobian_j[0][0] = Poisson_Coeff_Mean*proj_vector_ij; + } + + /*AD::SetPreaccOut(val_residual, nVar); + AD::EndPreacc();*/ + + delete [] MomCoeffxNormal; + delete [] MomCoeffxNormalCorrected; + + return ResidualType<>(Proj_Mean_GradPoissonVar_Corrected, Jacobian_i, Jacobian_j); +} + +CAvgGrad_Poisson::CAvgGrad_Poisson(unsigned short val_nDim, unsigned short val_nVar, + CConfig *config) : CNumerics(val_nDim, val_nVar, config) { + + implicit = false; + implicit = (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT); + direct = false; + + + Edge_Vector = new su2double [nDim]; + Proj_Mean_GradPoissonVar_Normal = new su2double [nVar]; + Proj_Mean_GradPoissonVar_Corrected = new su2double [nVar]; + Mom_Coeff_i = new su2double [nDim]; + Mom_Coeff_j = new su2double [nDim]; + + Jacobian_i = new su2double* [nVar]; + Jacobian_j = new su2double* [nVar]; + Mean_GradPoissonVar = new su2double* [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar] = new su2double [nDim]; + Jacobian_j[iVar] = new su2double [nDim]; + Mean_GradPoissonVar[iVar] = new su2double [nDim]; + } + + Poisson_Coeff_i = 1.0; + Poisson_Coeff_j = 1.0; +} + + +CAvgGrad_Poisson::~CAvgGrad_Poisson(void) { + + unsigned int iDim; + delete [] Edge_Vector; + delete [] Proj_Mean_GradPoissonVar_Normal; + delete [] Proj_Mean_GradPoissonVar_Corrected; + delete [] Mom_Coeff_i; + delete [] Mom_Coeff_j; + + for (iVar = 0; iVar < nVar; iVar++) { + delete [] Mean_GradPoissonVar[iVar]; + delete [] Jacobian_i[iVar]; + delete [] Jacobian_j[iVar]; + } + delete [] Mean_GradPoissonVar; + delete [] Jacobian_i; + delete [] Jacobian_j; + +} + +CNumerics::ResidualType<> CAvgGrad_Poisson::ComputeResidual(const CConfig *config) { + + + su2double Coeff_Mean, Num, Den; + su2double *MomCoeffxNormal = new su2double[nDim]; + su2double Mean_GradPoissonVar_Edge[MAXNDIM], GradPoisson[MAXNDIM]; + su2double Mean_GradPoissonVar_Face[MAXNDIM][MAXNDIM]; + + + + Poisson_Coeff_Mean = 1.0;//0.5*(Poisson_Coeff_i + Poisson_Coeff_j); + + /*--- Multiply the normal with the coefficients of the momentum equation + * and use it instead of the normal during the projection operation ---*/ + for (iDim = 0; iDim < nDim; iDim++) { + Coeff_Mean = 0.5*(Mom_Coeff_i[iDim] + Mom_Coeff_j[iDim]) ; + MomCoeffxNormal[iDim] = Coeff_Mean*Normal[iDim]; + } + + /*--- Compute vector going from iPoint to jPoint ---*/ + /*--- Minimum correction approach. ---*/ + /*dist_ij_2 = 0; proj_vector_ij = 0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + proj_vector_ij += Edge_Vector[iDim]*MomCoeffxNormal[iDim]; + } + if (dist_ij_2 == 0.0) proj_vector_ij = 0.0; + else proj_vector_ij = proj_vector_ij/dist_ij_2;*/ + + /*--- Over relaxed approach. ---*/ + dist_ij_2 = 0; proj_vector_ij = 0; + Num = 0.0; Den = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + Num += MomCoeffxNormal[iDim]*MomCoeffxNormal[iDim]; + Den += Edge_Vector[iDim]*MomCoeffxNormal[iDim]; + } + if (Den == 0.0) proj_vector_ij = 0.0; + else proj_vector_ij = Num/Den; + + /*--- Orthogonal correction approach. ---*/ + /*dist_ij_2 = 0; proj_vector_ij = 0; + Num = 0.0; Den = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + Num += MomCoeffxNormal[iDim]*MomCoeffxNormal[iDim]; + } + Den = dist_ij_2; + if (Den == 0.0) proj_vector_ij = 0.0; + else proj_vector_ij = sqrt(Num/Den);*/ + + /*--- Correct the face gradient for odd-even decoupling ---*/ + /*--- Steps are + * 1. Interpolate the gradient at the face -> du/ds|_in + * 2. Find the projection of the interpolated gradient on the edge vector -> (du/ds|_in) . e + * 3. Find the gradient as the difference between the neighboring nodes -> (u_j - u_i)/ds + * 4. Correct the gradient at the face using du/ds = du/ds|_in + ( (u_j - u_i)/ds - (du/ds|_in . e) ) . e ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + Mean_GradPoissonVar_Edge[iVar] = 0.0; + + GradPoisson[iVar] = (Poissonval_j - Poissonval_i)/sqrt(dist_ij_2); + + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradPoissonVar[iVar][iDim] = 0.5*(ConsVar_Grad_i[iVar][iDim] + ConsVar_Grad_j[iVar][iDim]); + + Mean_GradPoissonVar_Edge[iVar] += Mean_GradPoissonVar[iVar][iDim]*Edge_Vector[iDim]/sqrt(dist_ij_2); + } + } + + for (iVar = 0; iVar < nVar; iVar++) { + for (iDim = 0; iDim < nDim; iDim++) { + Mean_GradPoissonVar_Face[iVar][iDim] = Mean_GradPoissonVar[iVar][iDim] + + (GradPoisson[iVar] - Mean_GradPoissonVar_Edge[iVar])*Edge_Vector[iDim]/sqrt(dist_ij_2); + } + } + + /*--- Mean gradient approximation. Projection of the mean gradient in the direction of the edge ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + Proj_Mean_GradPoissonVar_Normal[iVar] = 0.0; + Proj_Mean_GradPoissonVar_Corrected[iVar] = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Proj_Mean_GradPoissonVar_Normal[iVar] += Mean_GradPoissonVar_Face[iVar][iDim]*MomCoeffxNormal[iDim]; + } + } + + /*--- Jacobians for implicit scheme ---*/ + if (implicit) { + Jacobian_i[0][0] = -Poisson_Coeff_Mean*proj_vector_ij; + Jacobian_j[0][0] = Poisson_Coeff_Mean*proj_vector_ij; + } + + delete [] MomCoeffxNormal; + + return ResidualType<>(Proj_Mean_GradPoissonVar_Normal, Jacobian_i, Jacobian_j); +} + + + +CPressure_Poisson::CPressure_Poisson(unsigned short val_nDim, unsigned short val_nVar, + CConfig *config) : CNumerics(val_nDim, val_nVar, config) { + + implicit = true; + + Edge_Vector = new su2double [nDim]; + + Poisson_Coeff_i = 1.0; + Poisson_Coeff_j = 1.0; + + Mom_Coeff_i = new su2double [nDim]; + Mom_Coeff_j = new su2double [nDim]; + +} + + +CPressure_Poisson::~CPressure_Poisson(void) { + + unsigned int iDim; + delete [] Edge_Vector; + + delete Mom_Coeff_i; + delete Mom_Coeff_j; +} + +void CPressure_Poisson::ComputeResidual(su2double *val_residual, su2double **Jacobian_i, su2double **Jacobian_j, CConfig *config) { + + + su2double Area; + su2double UnitNormal[MAXNDIM]; + + /*--- Compute vector going from iPoint to jPoint ---*/ + + dist_ij_2 = 0; proj_vector_ij = 0; + Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + proj_vector_ij += Edge_Vector[iDim]*Normal[iDim]; + UnitNormal[iDim] = Normal[iDim]/Area; + } + if (dist_ij_2 == 0.0) proj_vector_ij = 0.0; + else proj_vector_ij = proj_vector_ij/dist_ij_2; + + + Poisson_Coeff_Mean = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Poisson_Coeff_Mean += 0.5*(Mom_Coeff_i[iDim] + Mom_Coeff_j[iDim]); + + + val_residual[0] = 0.5*Poisson_Coeff_Mean*(Poissonval_i + Poissonval_j); + + if (implicit){ + Jacobian_i[0][0] = Poisson_Coeff_Mean; + Jacobian_j[0][0] = -Poisson_Coeff_Mean; + } +} + + +CSource_PoissonFVM::CSource_PoissonFVM(unsigned short val_nDim, unsigned short val_nVar, CConfig *config) : CNumerics(val_nDim, val_nVar, config) { } + +CSource_PoissonFVM::~CSource_PoissonFVM(void) { } + +void CSource_PoissonFVM::ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, CConfig *config) { + + if (config->GetKind_Incomp_System()==PRESSURE_BASED) + val_residual[0] = Source_Term; + else + val_residual[0] = Source_Term*Volume; +} + + diff --git a/SU2_CFD/src/numerics/turbulent/turb_convection.cpp b/SU2_CFD/src/numerics/turbulent/turb_convection.cpp index 0975492fa9cc..b1b2597f2bdc 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_convection.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_convection.cpp @@ -61,6 +61,7 @@ CUpwScalar::~CUpwScalar(void) { CNumerics::ResidualType<> CUpwScalar::ComputeResidual(const CConfig* config) { unsigned short iDim; + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); AD::StartPreacc(); AD::SetPreaccIn(Normal, nDim); @@ -71,8 +72,14 @@ CNumerics::ResidualType<> CUpwScalar::ComputeResidual(const CConfig* config) { ExtraADPreaccIn(); - Density_i = V_i[nDim+2]; - Density_j = V_j[nDim+2]; + if (pressure_based) { + Density_i = V_i[nDim+1]; + Density_j = V_j[nDim+1]; + } + else { + Density_i = V_i[nDim+2]; + Density_j = V_j[nDim+2]; + } q_ij = 0.0; if (dynamic_grid) { diff --git a/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp b/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp index e19d64da755a..5a3c280b4c51 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp @@ -70,6 +70,7 @@ CAvgGrad_Scalar::~CAvgGrad_Scalar(void) { CNumerics::ResidualType<> CAvgGrad_Scalar::ComputeResidual(const CConfig* config) { unsigned short iVar, iDim; + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); AD::StartPreacc(); AD::SetPreaccIn(Coord_i, nDim); AD::SetPreaccIn(Coord_j, nDim); @@ -82,11 +83,18 @@ CNumerics::ResidualType<> CAvgGrad_Scalar::ComputeResidual(const CConfig* config ExtraADPreaccIn(); if (incompressible) { - AD::SetPreaccIn(V_i, nDim+6); AD::SetPreaccIn(V_j, nDim+6); - - Density_i = V_i[nDim+2]; Density_j = V_j[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; Laminar_Viscosity_j = V_j[nDim+4]; - Eddy_Viscosity_i = V_i[nDim+5]; Eddy_Viscosity_j = V_j[nDim+5]; + if (pressure_based) { + Density_i = V_i[nDim+1]; Density_j = V_j[nDim+1]; + Laminar_Viscosity_i = V_i[nDim+2]; Laminar_Viscosity_j = V_j[nDim+2]; + Eddy_Viscosity_i = V_i[nDim+3]; Eddy_Viscosity_j = V_j[nDim+3]; + } + else { + AD::SetPreaccIn(V_i, nDim+6); AD::SetPreaccIn(V_j, nDim+6); + + Density_i = V_i[nDim+2]; Density_j = V_j[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+4]; Laminar_Viscosity_j = V_j[nDim+4]; + Eddy_Viscosity_i = V_i[nDim+5]; Eddy_Viscosity_j = V_j[nDim+5]; + } } else { AD::SetPreaccIn(V_i, nDim+7); AD::SetPreaccIn(V_j, nDim+7); diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index 2ab0f0aab780..b9fdbd5f83da 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -55,6 +55,10 @@ CSourceBase_TurbSA::CSourceBase_TurbSA(unsigned short val_nDim, * having to dynamically allocate. ---*/ Jacobian_i = &Jacobian_Buffer; + + /*--- Set the default value for the intermittency, which corresponds + to no transition modeling. ---*/ + intermittency = 1.0; } @@ -63,7 +67,7 @@ CSourcePieceWise_TurbSA::CSourcePieceWise_TurbSA(unsigned short val_nDim, const CConfig* config) : CSourceBase_TurbSA(val_nDim, val_nVar, config) { - transition = (config->GetKind_Trans_Model() == BC); + transition_BC = (config->GetKind_Trans_Model() == BC); } CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig* config) { @@ -79,13 +83,23 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig // BC Transition Model variables su2double vmag, rey, re_theta, re_theta_t, re_v; su2double tu , nu_cr, nu_t, nu_BC, chi_1, chi_2, term1, term2, term_exponential; + su2double Hl,H12,Ue,Fgrowth,Fcrit,re_y,re_y0,Dh12,lh12,mh12,re_12,re_120,n,dndre,Ncrit,ky; + su2double Uinfty,Pinfty,roinfty,lRetheta,Ret,Nfactor; + + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); // Set the boolean here depending on whether the point is closest to a rough wall or not. roughwall = (roughness_i > 0.0); if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; + if (pressure_based) { + Density_i = V_i[nDim+1]; + Laminar_Viscosity_i = V_i[nDim+2]; + } + else { + Density_i = V_i[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+4]; + } } else { Density_i = V_i[nDim+2]; @@ -100,7 +114,8 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig gamma_BC = 0.0; vmag = 0.0; - tu = config->GetTurbulenceIntensity_FreeStream(); + //tu = config->GetTurbulenceIntensity_FreeStream(); + tu = 100.0*config->GetTurbulenceIntensity_FreeStream(); // Turbulence intensity in percent. rey = config->GetReynolds(); if (nDim==2) { @@ -149,7 +164,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig // Original SA model // Production = cb1*(1.0-ft2)*Shat*TurbVar_i[0]*Volume; - if (transition) { + if (transition_BC) { // BC model constants chi_1 = 0.002; @@ -174,6 +189,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig else { Production = cb1*Shat*TurbVar_i[0]*Volume; } + //Production = cb1*Shat*TurbVar_i[0]*Volume; /*--- Destruction term ---*/ @@ -205,12 +221,13 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig if ( Shat <= 1.0e-10 ) dShat = 0.0; else dShat = (fv2+TurbVar_i[0]*dfv2)*inv_k2_d2; - if (transition) { + /*if (transition) { Jacobian_i[0] += gamma_BC*cb1*(TurbVar_i[0]*dShat+Shat)*Volume; } else { Jacobian_i[0] += cb1*(TurbVar_i[0]*dShat+Shat)*Volume; - } + }*/ + Jacobian_i[0] += intermittency*cb1*(TurbVar_i[0]*dShat+Shat)*Volume; /*--- Implicit part, destruction term ---*/ @@ -365,15 +382,23 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA_E::ComputeResidual(const CConf // AD::SetPreaccIn(TurbVar_i[0]); // AD::SetPreaccIn(TurbVar_Grad_i[0], nDim); // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); + if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - } - else { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+5]; + if (pressure_based) { + Density_i = V_i[nDim+1]; + Laminar_Viscosity_i = V_i[nDim+2]; + } + else { + Density_i = V_i[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+4]; + } } + else { + Density_i = V_i[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+5]; + } Residual = 0.0; Production = 0.0; @@ -632,10 +657,18 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA_Neg::ComputeResidual(const CCo // AD::SetPreaccIn(TurbVar_i[0]); // AD::SetPreaccIn(TurbVar_Grad_i[0], nDim); // AD::SetPreaccIn(Volume); AD::SetPreaccIn(dist_i); + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); + if (incompressible) { - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; + if (pressure_based) { + Density_i = V_i[nDim+1]; + Laminar_Viscosity_i = V_i[nDim+2]; + } + else { + Density_i = V_i[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+4]; + } } else { Density_i = V_i[nDim+2]; @@ -810,16 +843,25 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi unsigned short iDim; su2double alfa_blended, beta_blended; su2double diverg, pk, pw, zeta; + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); + su2double VorticityMag = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); if (incompressible) { - AD::SetPreaccIn(V_i, nDim+6); - - Density_i = V_i[nDim+2]; - Laminar_Viscosity_i = V_i[nDim+4]; - Eddy_Viscosity_i = V_i[nDim+5]; + if (pressure_based) { + Density_i = V_i[nDim+1]; + Laminar_Viscosity_i = V_i[nDim+2]; + Eddy_Viscosity_i = V_i[nDim+3]; + } + else { + AD::SetPreaccIn(V_i, nDim+6); + + Density_i = V_i[nDim+2]; + Laminar_Viscosity_i = V_i[nDim+4]; + Eddy_Viscosity_i = V_i[nDim+5]; + } } else { AD::SetPreaccIn(V_i, nDim+7); @@ -840,6 +882,12 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi if (dist_i > 1e-10) { + /*--- Compute the intermittency for the destruction term of + the kinetic energy. Only when a transition model is used + this value can differ from 1.0. ---*/ + + const su2double gammaEffDestr = min(max(gammaEff_i, 0.1), 1.0); + /*--- Production ---*/ diverg = 0.0; @@ -861,7 +909,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi pk = min(pk,20.0*beta_star*Density_i*TurbVar_i[1]*TurbVar_i[0]); - pk = max(pk,0.0); + pk = gammaEff_i*max(pk,0.0); zeta = max(TurbVar_i[1], VorticityMag*F2_i/a1); @@ -883,7 +931,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi intensity. ---*/ if ( sustaining_terms ) { - const su2double sust_k = beta_star*Density_i*kAmb*omegaAmb; + const su2double sust_k = gammaEff_i*beta_star*Density_i*kAmb*omegaAmb; const su2double sust_w = beta_blended*Density_i*omegaAmb*omegaAmb; pk = max(pk, sust_k); @@ -897,7 +945,8 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi /*--- Dissipation ---*/ - Residual[0] -= beta_star*Density_i*TurbVar_i[1]*TurbVar_i[0]*Volume; + //Residual[0] -= beta_star*Density_i*TurbVar_i[1]*TurbVar_i[0]*Volume; + Residual[0] -= gammaEffDestr*beta_star*Density_i*TurbVar_i[1]*TurbVar_i[0]*Volume; Residual[1] -= beta_blended*Density_i*TurbVar_i[1]*TurbVar_i[1]*Volume; /*--- Cross diffusion ---*/ @@ -906,8 +955,8 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi /*--- Implicit part ---*/ - Jacobian_i[0][0] = -beta_star*TurbVar_i[1]*Volume; - Jacobian_i[0][1] = -beta_star*TurbVar_i[0]*Volume; + Jacobian_i[0][0] = -gammaEffDestr*beta_star*TurbVar_i[1]*Volume; + Jacobian_i[0][1] = -gammaEffDestr*beta_star*TurbVar_i[0]*Volume; Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -2.0*beta_blended*TurbVar_i[1]*Volume; } diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index 2a12899142e5..9269c4188780 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -38,6 +38,8 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp heat = config->GetEnergy_Equation(); weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); + + pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); /*--- Set the default history fields if nothing is set in the config file ---*/ @@ -82,7 +84,8 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp /*--- Set the default convergence field --- */ - if (convFields.empty() ) convFields.emplace_back("RMS_PRESSURE"); + if (convFields.empty() && !pressure_based) convFields.emplace_back("RMS_PRESSURE"); + if (convFields.empty() && pressure_based) convFields.emplace_back("RMS_VELOCITY-X"); } @@ -94,7 +97,7 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ /// 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); + if (!pressure_based) 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. 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. @@ -103,6 +106,8 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ 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); + /// DESCRIPTION: Maximum residual of the mass flux (only for pressure based). + if (pressure_based) AddHistoryOutput("RMS_MASSFLUX", "rms[Mf]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the mass flux.", HistoryFieldType::RESIDUAL); /// DESCRIPTION: Root-mean square residual of the radiative energy (P1 model). if (config->AddRadiation()) AddHistoryOutput("RMS_RAD_ENERGY", "rms[E_Rad]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the radiative energy.", HistoryFieldType::RESIDUAL); @@ -204,6 +209,7 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ /// 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("POISSON_RESIDUAL", "PoissonSolRes", ScreenOutputFormat::FIXED, "LINSOL", "Residual of the poisson solver."); AddHistoryOutput("MIN_DELTA_TIME", "Min DT", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current minimum local time step"); AddHistoryOutput("MAX_DELTA_TIME", "Max DT", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current maximum local time step"); @@ -236,11 +242,20 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv CSolver* heat_solver = solver[HEAT_SOL]; CSolver* rad_solver = solver[RAD_SOL]; CSolver* mesh_solver = solver[MESH_SOL]; + CSolver* poisson_solver = solver[POISSON_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))); + if (pressure_based) { + SetHistoryOutputValue("RMS_MASSFLUX", log10(flow_solver->GetResMassFlux())); + SetHistoryOutputValue("RMS_VELOCITY-X", log10(flow_solver->GetRes_RMS(0))); + SetHistoryOutputValue("RMS_VELOCITY-Y", log10(flow_solver->GetRes_RMS(1))); + if (nDim == 3) SetHistoryOutputValue("RMS_VELOCITY-Z", log10(flow_solver->GetRes_RMS(2))); + } + else { + 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: @@ -255,11 +270,17 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv if (config->AddRadiation()) SetHistoryOutputValue("RMS_RAD_ENERGY", log10(rad_solver->GetRes_RMS(0))); - - 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))); + if (pressure_based) { + SetHistoryOutputValue("MAX_VELOCITY-X", log10(flow_solver->GetRes_Max(0))); + SetHistoryOutputValue("MAX_VELOCITY-Y", log10(flow_solver->GetRes_Max(1))); + if (nDim == 3) SetHistoryOutputValue("RMS_VELOCITY-Z", log10(flow_solver->GetRes_Max(2))); + } + else { + 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: @@ -318,6 +339,7 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv SetHistoryOutputValue("LINSOL_ITER", flow_solver->GetIterLinSolver()); SetHistoryOutputValue("LINSOL_RESIDUAL", log10(flow_solver->GetResLinSolver())); + if (pressure_based) SetHistoryOutputValue("POISSON_RESIDUAL",log10(poisson_solver->GetResLinSolver())); if (config->GetDeform_Mesh()){ SetHistoryOutputValue("DEFORM_MIN_VOLUME", mesh_solver->GetMinimum_Volume()); @@ -364,6 +386,8 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("VELOCITY-Z", "Velocity_z", "SOLUTION", "z-component of the velocity vector"); if (heat || weakly_coupled_heat) AddVolumeOutput("TEMPERATURE", "Temperature","SOLUTION", "Temperature"); + if (pressure_based) + AddVolumeOutput("MASS_FLUX", "Mass_flux","SOLUTION", "Mass flux at a point"); switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: @@ -416,12 +440,21 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ } //Residuals - AddVolumeOutput("RES_PRESSURE", "Residual_Pressure", "RESIDUAL", "Residual of the pressure"); - AddVolumeOutput("RES_VELOCITY-X", "Residual_Velocity_x", "RESIDUAL", "Residual of the x-velocity component"); - AddVolumeOutput("RES_VELOCITY-Y", "Residual_Velocity_y", "RESIDUAL", "Residual of the y-velocity component"); - 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"); + if (pressure_based) { + AddVolumeOutput("RES_VELOCITY-X", "Residual_Velocity_x", "RESIDUAL", "Residual of the x-velocity component"); + AddVolumeOutput("RES_VELOCITY-Y", "Residual_Velocity_y", "RESIDUAL", "Residual of the y-velocity component"); + if (nDim == 3) + AddVolumeOutput("RES_VELOCITY-Z", "Residual_Velocity_z", "RESIDUAL", "Residual of the z-velocity component"); + AddVolumeOutput("RES_MASSFLUX", "Residual_Mass_Flux", "RESIDUAL", "Residual of the mass flux"); + } + else { + AddVolumeOutput("RES_PRESSURE", "Residual_Pressure", "RESIDUAL", "Residual of the pressure"); + AddVolumeOutput("RES_VELOCITY-X", "Residual_Velocity_x", "RESIDUAL", "Residual of the x-velocity component"); + AddVolumeOutput("RES_VELOCITY-Y", "Residual_Velocity_y", "RESIDUAL", "Residual of the y-velocity component"); + 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: @@ -507,16 +540,24 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (nDim == 3) SetVolumeOutputValue("COORD-Z", iPoint, Node_Geo->GetCoord(iPoint, 2)); - SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetSolution(iPoint, 0)); - SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Flow->GetSolution(iPoint, 1)); - SetVolumeOutputValue("VELOCITY-Y", iPoint, Node_Flow->GetSolution(iPoint, 2)); - if (nDim == 3){ - SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); - if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, 4)); - } else { - if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, 3)); - } - if (weakly_coupled_heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Heat->GetSolution(iPoint, 0)); + if (pressure_based) { + SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetPressure(iPoint)); + SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Flow->GetSolution(iPoint, 0)); + SetVolumeOutputValue("VELOCITY-Y", iPoint, Node_Flow->GetSolution(iPoint, 1)); + if (nDim == 3) SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(iPoint, 2)); + SetVolumeOutputValue("MASS_FLUX", iPoint, Node_Flow->GetMassFlux(iPoint)); + } else { + SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetSolution(iPoint, 0)); + SetVolumeOutputValue("VELOCITY-X", iPoint, Node_Flow->GetSolution(iPoint, 1)); + SetVolumeOutputValue("VELOCITY-Y", iPoint, Node_Flow->GetSolution(iPoint, 2)); + if (nDim == 3){ + SetVolumeOutputValue("VELOCITY-Z", iPoint, Node_Flow->GetSolution(iPoint, 3)); + if (heat) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetSolution(iPoint, 4)); + } else { + 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: @@ -563,16 +604,24 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve if (config->GetKind_Trans_Model() == BC){ SetVolumeOutputValue("INTERMITTENCY", iPoint, Node_Turb->GetGammaBC(iPoint)); } - - SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); - SetVolumeOutputValue("RES_VELOCITY-X", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 1)); - SetVolumeOutputValue("RES_VELOCITY-Y", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 2)); - if (nDim == 3){ - SetVolumeOutputValue("RES_VELOCITY-Z", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); - SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 4)); - } else { - SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); - } + + if (pressure_based) { + SetVolumeOutputValue("RES_VELOCITY-X", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); + SetVolumeOutputValue("RES_VELOCITY-Y", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 1)); + if (nDim == 3) + SetVolumeOutputValue("RES_VELOCITY-Z", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 2)); + SetVolumeOutputValue("RES_MASSFLUX", iPoint, solver[POISSON_SOL]->LinSysRes(iPoint, 0)); + } else { + SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0)); + SetVolumeOutputValue("RES_VELOCITY-X", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 1)); + SetVolumeOutputValue("RES_VELOCITY-Y", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 2)); + if (nDim == 3){ + SetVolumeOutputValue("RES_VELOCITY-Z", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); + SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 4)); + } else { + SetVolumeOutputValue("RES_TEMPERATURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 3)); + } + } switch(config->GetKind_Turb_Model()){ case SST: case SST_SUST: diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index 994790894c47..18a56367db3f 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -1440,44 +1440,40 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo /*--- Compressible version of console output ---*/ - if (compressible) { - - if (compressible) { Breakdown_file << "Mach number: " << config->GetMach() <<"."<< "\n"; Breakdown_file << "Angle of attack (AoA): " << config->GetAoA() <<" deg, and angle of sideslip (AoS): " << config->GetAoS() <<" deg."<< "\n"; if ((Kind_Solver == NAVIER_STOKES) || (Kind_Solver == INC_NAVIER_STOKES) || (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"; - Breakdown_file << "Approx. Delta CD / Delta CL: " << config->GetdCD_dCL() << ".\n"; - if (nDim == 3 ) { - Breakdown_file << "Approx. Delta CMx / Delta CL: " << config->GetdCMx_dCL() << ".\n"; - Breakdown_file << "Approx. Delta CMy / Delta CL: " << config->GetdCMy_dCL() << ".\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"; + Breakdown_file << "Approx. Delta CD / Delta CL: " << config->GetdCD_dCL() << ".\n"; + if (nDim == 3 ) { + Breakdown_file << "Approx. Delta CMx / Delta CL: " << config->GetdCMx_dCL() << ".\n"; + Breakdown_file << "Approx. Delta CMy / Delta CL: " << config->GetdCMy_dCL() << ".\n"; + } + Breakdown_file << "Approx. Delta CMz / Delta CL: " << config->GetdCMz_dCL() << ".\n"; } - 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 (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() == 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"; - } - Breakdown_file << "\n" << "\n" <<"Problem definition:" << "\n" << "\n"; - if (compressible) { + 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"; + } + Breakdown_file << "\n" << "\n" <<"Problem definition:" << "\n" << "\n"; if (viscous) { Breakdown_file << "Viscous flow: Computing pressure using the ideal gas law" << "\n"; Breakdown_file << "based on the free-stream temperature and a density computed" << "\n"; @@ -1486,12 +1482,11 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Inviscid flow: Computing density based on free-stream" << "\n"; 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 (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; + else Breakdown_file << "Force coefficients computed using free-stream values." << "\n"; - if (incompressible) { + /*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"; Breakdown_file << "The free-stream value of the pressure is 0." << "\n"; @@ -1500,11 +1495,10 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "Side slip angle (deg): "<< config->GetAoS() << ", computed using the the free-stream velocity." << "\n"; 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"; + Breakdown_file <<"-- Input conditions:"<< "\n"; - if (compressible) { switch (config->GetKind_FluidModel()) { case STANDARD_AIR: @@ -1590,7 +1584,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo } - if ((Kind_Solver == RANS) || (Kind_Solver == INC_RANS)) { + if (Kind_Solver == RANS) { switch (config->GetKind_ConductivityModel_Turb()) { case CONSTANT_PRANDTL_TURB: Breakdown_file << "Turbulent Conductivity Model: CONSTANT_PRANDTL_TURB "<< "\n"; @@ -1602,28 +1596,26 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo break; } } - } - } - if (incompressible) { - Breakdown_file << "Bulk modulus: " << config->GetBulk_Modulus(); + + /*if (incompressible) { + Breakdown_file << "Bulk modulus: " << config->GetBulk_Modulus(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; + Breakdown_file << "Epsilon^2 multiplier of Beta for incompressible preconditioner: " << config->GetBeta_Factor(); + 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 << "Epsilon^2 multiplier of Beta for incompressible preconditioner: " << config->GetBeta_Factor(); + + 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"; - } - 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"; @@ -1631,336 +1623,291 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo 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"; + 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] << ")"; - } - if (nDim == 3) { - Breakdown_file << "Free-stream velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; - Breakdown_file << config->GetVelocity_FreeStream()[1] << ", " << config->GetVelocity_FreeStream()[2] << ")"; - } - if (config->GetSystemMeasurements() == SI) Breakdown_file << " m/s. "; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft/s. "; + if (nDim == 2) { + Breakdown_file << "Free-stream velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; + Breakdown_file << config->GetVelocity_FreeStream()[1] << ")"; + } + if (nDim == 3) { + Breakdown_file << "Free-stream velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; + Breakdown_file << config->GetVelocity_FreeStream()[1] << ", " << config->GetVelocity_FreeStream()[2] << ")"; + } + 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"; + 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"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; - if (turbulent) { - Breakdown_file << "Free-stream turb. kinetic energy per unit mass: " << config->GetTke_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " m^2/s^2." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft^2/s^2." << "\n"; - Breakdown_file << "Free-stream specific dissipation: " << config->GetOmega_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " 1/s." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " 1/s." << "\n"; + if (viscous) { + Breakdown_file << "Free-stream viscosity: " << config->GetViscosity_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; + if (turbulent) { + Breakdown_file << "Free-stream turb. kinetic energy per unit mass: " << config->GetTke_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " m^2/s^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft^2/s^2." << "\n"; + Breakdown_file << "Free-stream specific dissipation: " << config->GetOmega_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " 1/s." << "\n"; + 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"; } + if (unsteady) { Breakdown_file << "Total time: " << config->GetTotal_UnstTime() << " s. Time step: " << config->GetDelta_UnstTime() << " s." << "\n"; } - /*--- Print out reference values. ---*/ + /*--- Print out reference values. ---*/ - Breakdown_file <<"-- Reference values:"<< "\n"; + 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"; + 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 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"; + 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 (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"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; - if (compressible){ - Breakdown_file << "Reference conductivity: " << config->GetConductivity_Ref(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " W/m^2.K." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf/ft.s.R." << "\n"; + if (viscous) { + Breakdown_file << "Reference viscosity: " << config->GetViscosity_Ref(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; + if (compressible){ + Breakdown_file << "Reference conductivity: " << config->GetConductivity_Ref(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " W/m^2.K." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf/ft.s.R." << "\n"; + } } - } - - if (unsteady) Breakdown_file << "Reference time: " << config->GetTime_Ref() <<" s." << "\n"; + if (unsteady) Breakdown_file << "Reference time: " << config->GetTime_Ref() <<" s." << "\n"; - /*--- Print out resulting non-dim values here. ---*/ + /*--- 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) { - Breakdown_file << "Reynolds number (non-dim): " << config->GetReynolds() <<". Re length: " << config->GetLength_Reynolds(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " m." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft." << "\n"; - } - if (gravity) { - 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"; - } + Breakdown_file << "-- Resulting non-dimensional state:" << "\n"; + Breakdown_file << "Mach number (non-dim): " << config->GetMach() << "\n"; + if (viscous) { + Breakdown_file << "Reynolds number (non-dim): " << config->GetReynolds() <<". Re length: " << config->GetLength_Reynolds(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " m." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft." << "\n"; + } + if (gravity) { + 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 pressure (non-dim): " << config->GetPressure_FreeStreamND() << "\n"; - Breakdown_file << "Free-stream density (non-dim): " << config->GetDensity_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] << "). "; - } else { - Breakdown_file << "Free-stream velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; - Breakdown_file << config->GetVelocity_FreeStreamND()[1] << ", " << config->GetVelocity_FreeStreamND()[2] << "). "; - } - Breakdown_file << "Magnitude: " << config->GetModVel_FreeStreamND() << "\n"; + if (nDim == 2) { + Breakdown_file << "Free-stream velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; + Breakdown_file << config->GetVelocity_FreeStreamND()[1] << "). "; + } else { + Breakdown_file << "Free-stream velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; + 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) { - Breakdown_file << "Free-stream turb. kinetic energy (non-dim): " << config->GetTke_FreeStreamND() << "\n"; - Breakdown_file << "Free-stream specific dissipation (non-dim): " << config->GetOmega_FreeStreamND() << "\n"; + if (viscous) { + Breakdown_file << "Free-stream viscosity (non-dim): " << config->GetViscosity_FreeStreamND() << "\n"; + if (turbulent) { + Breakdown_file << "Free-stream turb. kinetic energy (non-dim): " << config->GetTke_FreeStreamND() << "\n"; + 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"; - } - - } else { - - /*--- Incompressible version of the console output ---*/ - - bool energy = config->GetEnergy_Equation(); - bool boussinesq = (config->GetKind_DensityModel() == BOUSSINESQ); - - if (config->GetRef_Inc_NonDim() == DIMENSIONAL) { - Breakdown_file << "Viscous and Inviscid flow: rho_ref, vel_ref, temp_ref, p_ref" << "\n"; - Breakdown_file << "are set to 1.0 in order to perform a dimensional calculation." << "\n"; - if (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; - else Breakdown_file << "Force coefficients computed using initial values." << "\n"; - } - else if (config->GetRef_Inc_NonDim() == INITIAL_VALUES) { - Breakdown_file << "Viscous and Inviscid flow: rho_ref, vel_ref, and temp_ref" << "\n"; - Breakdown_file << "are based on the initial values, p_ref = rho_ref*vel_ref^2." << "\n"; - if (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; - else Breakdown_file << "Force coefficients computed using initial values." << "\n"; - } - else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) { - Breakdown_file << "Viscous and Inviscid flow: rho_ref, vel_ref, and temp_ref" << "\n"; - Breakdown_file << "are user-provided reference values, p_ref = rho_ref*vel_ref^2." << "\n"; - if (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; - else Breakdown_file << "Force coefficients computed using reference values." << "\n"; + if (unsteady) { + Breakdown_file << "Total time (non-dim): " << config->GetTotal_UnstTimeND() << "\n"; + Breakdown_file << "Time step (non-dim): " << config->GetDelta_UnstTimeND() << "\n"; } - Breakdown_file << "The reference area for force coeffs. is " << config->GetRefArea() << " m^2." << "\n"; - Breakdown_file << "The reference length for force coeffs. is " << config->GetRefLength() << " m." << "\n"; - - Breakdown_file << "The pressure is decomposed into thermodynamic and dynamic components." << "\n"; - Breakdown_file << "The initial value of the dynamic pressure is 0." << "\n"; - Breakdown_file << "Mach number: "<< config->GetMach(); - if (config->GetKind_FluidModel() == CONSTANT_DENSITY) { - Breakdown_file << ", computed using the Bulk modulus." << "\n"; } else { - Breakdown_file << ", computed using fluid speed of sound." << "\n"; - } - Breakdown_file << "For external flows, the initial state is imposed at the far-field." << "\n"; - Breakdown_file << "Angle of attack (deg): "<< config->GetAoA() << ", computed using the initial velocity." << "\n"; - Breakdown_file << "Side slip angle (deg): "<< config->GetAoS() << ", computed using the initial velocity." << "\n"; + /*--- Incompressible version of the console output ---*/ - if (viscous) { - Breakdown_file << "Reynolds number per meter: " << config->GetReynolds() << ", computed using initial values."<< "\n"; - Breakdown_file << "Reynolds number is a byproduct of inputs only (not used internally)." << "\n"; - } - Breakdown_file << "SI units only. The grid should be dimensional (meters)." << "\n"; + bool energy = config->GetEnergy_Equation(); + bool boussinesq = (config->GetKind_DensityModel() == BOUSSINESQ); - switch (config->GetKind_DensityModel()) { + if (config->GetRef_Inc_NonDim() == DIMENSIONAL) { + Breakdown_file << "Viscous and Inviscid flow: rho_ref, vel_ref, temp_ref, p_ref" << "\n"; + Breakdown_file << "are set to 1.0 in order to perform a dimensional calculation." << "\n"; + if (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; + else Breakdown_file << "Force coefficients computed using initial values." << "\n"; + } + else if (config->GetRef_Inc_NonDim() == INITIAL_VALUES) { + Breakdown_file << "Viscous and Inviscid flow: rho_ref, vel_ref, and temp_ref" << "\n"; + Breakdown_file << "are based on the initial values, p_ref = rho_ref*vel_ref^2." << "\n"; + if (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; + else Breakdown_file << "Force coefficients computed using initial values." << "\n"; + } + else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) { + Breakdown_file << "Viscous and Inviscid flow: rho_ref, vel_ref, and temp_ref" << "\n"; + Breakdown_file << "are user-provided reference values, p_ref = rho_ref*vel_ref^2." << "\n"; + if (dynamic_grid) Breakdown_file << "Force coefficients computed using MACH_MOTION." << "\n"; + else Breakdown_file << "Force coefficients computed using reference values." << "\n"; + } + Breakdown_file << "The reference area for force coeffs. is " << config->GetRefArea() << " m^2." << "\n"; + Breakdown_file << "The reference length for force coeffs. is " << config->GetRefLength() << " m." << "\n"; - case CONSTANT: - if (energy) Breakdown_file << "Energy equation is active and decoupled." << "\n"; - else Breakdown_file << "No energy equation." << "\n"; - break; + Breakdown_file << "The pressure is decomposed into thermodynamic and dynamic components." << "\n"; + Breakdown_file << "The initial value of the dynamic pressure is 0." << "\n"; - case BOUSSINESQ: - if (energy) Breakdown_file << "Energy equation is active and coupled through Boussinesq approx." << "\n"; - break; + Breakdown_file << "Mach number: "<< config->GetMach(); + if (config->GetKind_FluidModel() == CONSTANT_DENSITY) { + Breakdown_file << ", computed using the Bulk modulus." << "\n"; + } else { + Breakdown_file << ", computed using fluid speed of sound." << "\n"; + } - case VARIABLE: - if (energy) Breakdown_file << "Energy equation is active and coupled for variable density." << "\n"; - break; + Breakdown_file << "For external flows, the initial state is imposed at the far-field." << "\n"; + Breakdown_file << "Angle of attack (deg): "<< config->GetAoA() << ", computed using the initial velocity." << "\n"; + Breakdown_file << "Side slip angle (deg): "<< config->GetAoS() << ", computed using the initial velocity." << "\n"; - } + if (viscous) { + Breakdown_file << "Reynolds number per meter: " << config->GetReynolds() << ", computed using initial values."<< "\n"; + Breakdown_file << "Reynolds number is a byproduct of inputs only (not used internally)." << "\n"; + } + Breakdown_file << "SI units only. The grid should be dimensional (meters)." << "\n"; - Breakdown_file <<"-- Input conditions:"<< "\n"; + switch (config->GetKind_DensityModel()) { - switch (config->GetKind_FluidModel()) { + case CONSTANT: + if (energy) Breakdown_file << "Energy equation is active and decoupled." << "\n"; + else Breakdown_file << "No energy equation." << "\n"; + break; - case CONSTANT_DENSITY: - Breakdown_file << "Fluid Model: CONSTANT_DENSITY "<< "\n"; - if (energy) { - Breakdown_file << "Specific heat at constant pressure (Cp): " << config->GetSpecific_Heat_Cp() << " N.m/kg.K." << "\n"; - } - if (boussinesq) Breakdown_file << "Thermal expansion coefficient: " << config->GetThermal_Expansion_Coeff() << " K^-1." << "\n"; - Breakdown_file << "Thermodynamic pressure not required." << "\n"; - break; + case BOUSSINESQ: + if (energy) Breakdown_file << "Energy equation is active and coupled through Boussinesq approx." << "\n"; + break; - case INC_IDEAL_GAS: - Breakdown_file << "Fluid Model: INC_IDEAL_GAS "<< endl; - Breakdown_file << "Variable density incompressible flow using ideal gas law." << endl; - Breakdown_file << "Density is a function of temperature (constant thermodynamic pressure)." << endl; - Breakdown_file << "Specific heat at constant pressure (Cp): " << config->GetSpecific_Heat_Cp() << " N.m/kg.K." << endl; - Breakdown_file << "Molecular weight : "<< config->GetMolecular_Weight() << " g/mol" << endl; - Breakdown_file << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << endl; - Breakdown_file << "Thermodynamic pressure: " << config->GetPressure_Thermodynamic(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << endl; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << endl; - break; + case VARIABLE: + if (energy) Breakdown_file << "Energy equation is active and coupled for variable density." << "\n"; + 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; - Breakdown_file << "Density is a function of temperature (constant thermodynamic pressure)." << endl; - Breakdown_file << "Molecular weight: " << config->GetMolecular_Weight() << " g/mol." << endl; - Breakdown_file << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << endl; - Breakdown_file << "Specific gas constant (non-dim): " << config->GetGas_ConstantND() << endl; - Breakdown_file << "Thermodynamic pressure: " << config->GetPressure_Thermodynamic(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << endl; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << endl; - Breakdown_file << "Cp(T) polynomial coefficients: \n ("; - for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { - Breakdown_file << config->GetCp_PolyCoeff(iVar); - if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; - } - Breakdown_file << ")." << endl; - Breakdown_file << "Cp(T) polynomial coefficients (non-dim.): \n ("; - for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { - Breakdown_file << config->GetCp_PolyCoeffND(iVar); - if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; - } - Breakdown_file << ")." << endl; - break; + } - } - if (viscous) { - switch (config->GetKind_ViscosityModel()) { + Breakdown_file <<"-- Input conditions:"<< "\n"; - case CONSTANT_VISCOSITY: - Breakdown_file << "Viscosity Model: CONSTANT_VISCOSITY "<< "\n"; - Breakdown_file << "Constant Laminar Viscosity: " << config->GetMu_Constant(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; - Breakdown_file << "Laminar Viscosity (non-dim): " << config->GetMu_ConstantND()<< "\n"; + switch (config->GetKind_FluidModel()) { + + case CONSTANT_DENSITY: + Breakdown_file << "Fluid Model: CONSTANT_DENSITY "<< "\n"; + if (energy) { + Breakdown_file << "Specific heat at constant pressure (Cp): " << config->GetSpecific_Heat_Cp() << " N.m/kg.K." << "\n"; + } + if (boussinesq) Breakdown_file << "Thermal expansion coefficient: " << config->GetThermal_Expansion_Coeff() << " K^-1." << "\n"; + Breakdown_file << "Thermodynamic pressure not required." << "\n"; break; - case SUTHERLAND: - Breakdown_file << "Viscosity Model: SUTHERLAND "<< "\n"; - Breakdown_file << "Ref. Laminar Viscosity: " << config->GetMu_Ref(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; - Breakdown_file << "Ref. Temperature: " << config->GetMu_Temperature_Ref(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; - Breakdown_file << "Sutherland Constant: "<< config->GetMu_S(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; - Breakdown_file << "Laminar Viscosity (non-dim): " << config->GetMu_ConstantND()<< "\n"; - Breakdown_file << "Ref. Temperature (non-dim): " << config->GetMu_Temperature_RefND()<< "\n"; - Breakdown_file << "Sutherland constant (non-dim): "<< config->GetMu_SND()<< "\n"; + case INC_IDEAL_GAS: + Breakdown_file << "Fluid Model: INC_IDEAL_GAS "<< endl; + Breakdown_file << "Variable density incompressible flow using ideal gas law." << endl; + Breakdown_file << "Density is a function of temperature (constant thermodynamic pressure)." << endl; + Breakdown_file << "Specific heat at constant pressure (Cp): " << config->GetSpecific_Heat_Cp() << " N.m/kg.K." << endl; + Breakdown_file << "Molecular weight : "<< config->GetMolecular_Weight() << " g/mol" << endl; + Breakdown_file << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << endl; + Breakdown_file << "Thermodynamic pressure: " << config->GetPressure_Thermodynamic(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << endl; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << endl; break; - case POLYNOMIAL_VISCOSITY: - Breakdown_file << "Viscosity Model: POLYNOMIAL_VISCOSITY "<< endl; - Breakdown_file << "Mu(T) polynomial coefficients: \n ("; + 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; + Breakdown_file << "Density is a function of temperature (constant thermodynamic pressure)." << endl; + Breakdown_file << "Molecular weight: " << config->GetMolecular_Weight() << " g/mol." << endl; + Breakdown_file << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << endl; + Breakdown_file << "Specific gas constant (non-dim): " << config->GetGas_ConstantND() << endl; + Breakdown_file << "Thermodynamic pressure: " << config->GetPressure_Thermodynamic(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << endl; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << endl; + Breakdown_file << "Cp(T) polynomial coefficients: \n ("; for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { - Breakdown_file << config->GetMu_PolyCoeff(iVar); + Breakdown_file << config->GetCp_PolyCoeff(iVar); if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; } Breakdown_file << ")." << endl; - Breakdown_file << "Mu(T) polynomial coefficients (non-dim.): \n ("; + Breakdown_file << "Cp(T) polynomial coefficients (non-dim.): \n ("; for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { - Breakdown_file << config->GetMu_PolyCoeffND(iVar); + Breakdown_file << config->GetCp_PolyCoeffND(iVar); if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; } Breakdown_file << ")." << endl; break; } - - if (energy) { - switch (config->GetKind_ConductivityModel()) { - - case CONSTANT_PRANDTL: - Breakdown_file << "Conductivity Model: CONSTANT_PRANDTL "<< "\n"; - Breakdown_file << "Prandtl (Laminar): " << config->GetPrandtl_Lam()<< "\n"; + if (viscous) { + switch (config->GetKind_ViscosityModel()) { + + case CONSTANT_VISCOSITY: + Breakdown_file << "Viscosity Model: CONSTANT_VISCOSITY "<< "\n"; + Breakdown_file << "Constant Laminar Viscosity: " << config->GetMu_Constant(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; + Breakdown_file << "Laminar Viscosity (non-dim): " << config->GetMu_ConstantND()<< "\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"; + case SUTHERLAND: + Breakdown_file << "Viscosity Model: SUTHERLAND "<< "\n"; + Breakdown_file << "Ref. Laminar Viscosity: " << config->GetMu_Ref(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; + Breakdown_file << "Ref. Temperature: " << config->GetMu_Temperature_Ref(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; + Breakdown_file << "Sutherland Constant: "<< config->GetMu_S(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; + Breakdown_file << "Laminar Viscosity (non-dim): " << config->GetMu_ConstantND()<< "\n"; + Breakdown_file << "Ref. Temperature (non-dim): " << config->GetMu_Temperature_RefND()<< "\n"; + Breakdown_file << "Sutherland constant (non-dim): "<< config->GetMu_SND()<< "\n"; break; - case POLYNOMIAL_CONDUCTIVITY: - Breakdown_file << "Viscosity Model: POLYNOMIAL_CONDUCTIVITY "<< endl; - Breakdown_file << "Kt(T) polynomial coefficients: \n ("; + case POLYNOMIAL_VISCOSITY: + Breakdown_file << "Viscosity Model: POLYNOMIAL_VISCOSITY "<< endl; + Breakdown_file << "Mu(T) polynomial coefficients: \n ("; for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { - Breakdown_file << config->GetKt_PolyCoeff(iVar); + Breakdown_file << config->GetMu_PolyCoeff(iVar); if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; } Breakdown_file << ")." << endl; - Breakdown_file << "Kt(T) polynomial coefficients (non-dim.): \n ("; + Breakdown_file << "Mu(T) polynomial coefficients (non-dim.): \n ("; for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { - Breakdown_file << config->GetKt_PolyCoeffND(iVar); + Breakdown_file << config->GetMu_PolyCoeffND(iVar); if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; } Breakdown_file << ")." << endl; @@ -1968,169 +1915,198 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo } - if ((Kind_Solver == RANS) || (Kind_Solver == ADJ_RANS) || (Kind_Solver == DISC_ADJ_RANS)) { - switch (config->GetKind_ConductivityModel_Turb()) { - case CONSTANT_PRANDTL_TURB: - Breakdown_file << "Turbulent Conductivity Model: CONSTANT_PRANDTL_TURB "<< "\n"; - Breakdown_file << "Turbulent Prandtl: " << config->GetPrandtl_Turb()<< "\n"; + if (energy) { + switch (config->GetKind_ConductivityModel()) { + + case CONSTANT_PRANDTL: + Breakdown_file << "Conductivity Model: CONSTANT_PRANDTL "<< "\n"; + Breakdown_file << "Prandtl (Laminar): " << config->GetPrandtl_Lam()<< "\n"; break; - case NO_CONDUCTIVITY_TURB: - Breakdown_file << "Turbulent Conductivity Model: NO_CONDUCTIVITY_TURB "<< "\n"; - Breakdown_file << "No turbulent component in effective thermal conductivity." << "\n"; + + 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; + + case POLYNOMIAL_CONDUCTIVITY: + Breakdown_file << "Viscosity Model: POLYNOMIAL_CONDUCTIVITY "<< endl; + Breakdown_file << "Kt(T) polynomial coefficients: \n ("; + for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { + Breakdown_file << config->GetKt_PolyCoeff(iVar); + if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; + } + Breakdown_file << ")." << endl; + Breakdown_file << "Kt(T) polynomial coefficients (non-dim.): \n ("; + for (unsigned short iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) { + Breakdown_file << config->GetKt_PolyCoeffND(iVar); + if (iVar < config->GetnPolyCoeffs()-1) Breakdown_file << ", "; + } + 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: + Breakdown_file << "Turbulent Conductivity Model: CONSTANT_PRANDTL_TURB "<< "\n"; + Breakdown_file << "Turbulent Prandtl: " << config->GetPrandtl_Turb()<< "\n"; + break; + case NO_CONDUCTIVITY_TURB: + Breakdown_file << "Turbulent Conductivity Model: NO_CONDUCTIVITY_TURB "<< "\n"; + Breakdown_file << "No turbulent component in effective thermal conductivity." << "\n"; + break; + } + } + } } - } + if (config->GetKind_FluidModel() == CONSTANT_DENSITY) { + Breakdown_file << "Bulk modulus: " << config->GetBulk_Modulus(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; + } - if (config->GetKind_FluidModel() == CONSTANT_DENSITY) { - Breakdown_file << "Bulk modulus: " << config->GetBulk_Modulus(); + Breakdown_file << "Initial dynamic pressure: " << config->GetPressure_FreeStream(); if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; - } - - Breakdown_file << "Initial dynamic pressure: " << config->GetPressure_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; - - Breakdown_file << "Initial total pressure: " << config->GetPressure_FreeStream() + 0.5*config->GetDensity_FreeStream()*config->GetModVel_FreeStream()*config->GetModVel_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; - if (energy) { - Breakdown_file << "Initial temperature: " << config->GetTemperature_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; - } + Breakdown_file << "Initial total pressure: " << config->GetPressure_FreeStream() + 0.5*config->GetDensity_FreeStream()*config->GetModVel_FreeStream()*config->GetModVel_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " Pa." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " psf." << "\n"; - Breakdown_file << "Initial 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 (energy) { + Breakdown_file << "Initial temperature: " << config->GetTemperature_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; + } - if (nDim == 2) { - Breakdown_file << "Initial velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; - Breakdown_file << config->GetVelocity_FreeStream()[1] << ")"; - } - if (nDim == 3) { - Breakdown_file << "Initial velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; - Breakdown_file << config->GetVelocity_FreeStream()[1] << ", " << config->GetVelocity_FreeStream()[2] << ")"; - } - if (config->GetSystemMeasurements() == SI) Breakdown_file << " m/s. "; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft/s. "; + Breakdown_file << "Initial 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"; - 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 (viscous) { - Breakdown_file << "Initial laminar viscosity: " << config->GetViscosity_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; - if (turbulent) { - Breakdown_file << "Initial turb. kinetic energy per unit mass: " << config->GetTke_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " m^2/s^2." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft^2/s^2." << "\n"; - Breakdown_file << "Initial specific dissipation: " << config->GetOmega_FreeStream(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " 1/s." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " 1/s." << "\n"; + if (nDim == 2) { + Breakdown_file << "Initial velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; + Breakdown_file << config->GetVelocity_FreeStream()[1] << ")"; + } + if (nDim == 3) { + Breakdown_file << "Initial velocity: (" << config->GetVelocity_FreeStream()[0] << ", "; + Breakdown_file << config->GetVelocity_FreeStream()[1] << ", " << config->GetVelocity_FreeStream()[2] << ")"; + } + 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 (viscous) { + Breakdown_file << "Initial laminar viscosity: " << config->GetViscosity_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; + if (turbulent) { + Breakdown_file << "Initial turb. kinetic energy per unit mass: " << config->GetTke_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " m^2/s^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " ft^2/s^2." << "\n"; + Breakdown_file << "Initial specific dissipation: " << config->GetOmega_FreeStream(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " 1/s." << "\n"; + 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"; } + if (unsteady) { Breakdown_file << "Total time: " << config->GetTotal_UnstTime() << " s. Time step: " << config->GetDelta_UnstTime() << " s." << "\n"; } - /*--- Print out reference values. ---*/ + /*--- Print out reference values. ---*/ - Breakdown_file <<"-- Reference values:"<< "\n"; + Breakdown_file <<"-- Reference values:"<< "\n"; - if (config->GetKind_FluidModel() != CONSTANT_DENSITY) { - 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"; - } else { - if (energy) { - Breakdown_file << "Reference specific heat: " << config->GetGas_Constant_Ref(); + if (config->GetKind_FluidModel() != CONSTANT_DENSITY) { + 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"; + } else { + if (energy) { + Breakdown_file << "Reference specific heat: " << 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"; + 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 (energy) { - Breakdown_file << "Reference temperature: " << config->GetTemperature_Ref(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " K." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " R." << "\n"; - } + if (energy) { + 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 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"; + 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"; - Breakdown_file << "Reference length: " << config->GetLength_Ref(); - if (config->GetSystemMeasurements() == SI) Breakdown_file << " m." << "\n"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " in." << "\n"; + 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"; - else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; - } + if (viscous) { + Breakdown_file << "Reference viscosity: " << config->GetViscosity_Ref(); + if (config->GetSystemMeasurements() == SI) Breakdown_file << " N.s/m^2." << "\n"; + else if (config->GetSystemMeasurements() == US) Breakdown_file << " lbf.s/ft^2." << "\n"; + } - if (unsteady) Breakdown_file << "Reference time: " << config->GetTime_Ref() <<" s." << "\n"; + if (unsteady) Breakdown_file << "Reference time: " << config->GetTime_Ref() <<" s." << "\n"; - /*--- Print out resulting non-dim values here. ---*/ + /*--- 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) { - Breakdown_file << "Reynolds number (per m): " << config->GetReynolds() << "\n"; - } + Breakdown_file << "-- Resulting non-dimensional state:" << "\n"; + Breakdown_file << "Mach number (non-dim): " << config->GetMach() << "\n"; + if (viscous) { + Breakdown_file << "Reynolds number (per m): " << config->GetReynolds() << "\n"; + } - if (config->GetKind_FluidModel() != CONSTANT_DENSITY) { - Breakdown_file << "Specific gas constant (non-dim): " << config->GetGas_ConstantND() << "\n"; - Breakdown_file << "Initial thermodynamic pressure (non-dim): " << config->GetPressure_ThermodynamicND() << "\n"; - } else { - if (energy) { - Breakdown_file << "Specific heat at constant pressure (non-dim): " << config->GetSpecific_Heat_CpND() << "\n"; - if (boussinesq) Breakdown_file << "Thermal expansion coefficient (non-dim.): " << config->GetThermal_Expansion_CoeffND() << " K^-1." << "\n"; + if (config->GetKind_FluidModel() != CONSTANT_DENSITY) { + Breakdown_file << "Specific gas constant (non-dim): " << config->GetGas_ConstantND() << "\n"; + Breakdown_file << "Initial thermodynamic pressure (non-dim): " << config->GetPressure_ThermodynamicND() << "\n"; + } else { + if (energy) { + Breakdown_file << "Specific heat at constant pressure (non-dim): " << config->GetSpecific_Heat_CpND() << "\n"; + if (boussinesq) Breakdown_file << "Thermal expansion coefficient (non-dim.): " << config->GetThermal_Expansion_CoeffND() << " K^-1." << "\n"; + } } - } - if (energy) Breakdown_file << "Initial temperature (non-dim): " << config->GetTemperature_FreeStreamND() << "\n"; - Breakdown_file << "Initial pressure (non-dim): " << config->GetPressure_FreeStreamND() << "\n"; - Breakdown_file << "Initial density (non-dim): " << config->GetDensity_FreeStreamND() << "\n"; + if (energy) Breakdown_file << "Initial temperature (non-dim): " << config->GetTemperature_FreeStreamND() << "\n"; + Breakdown_file << "Initial pressure (non-dim): " << config->GetPressure_FreeStreamND() << "\n"; + Breakdown_file << "Initial density (non-dim): " << config->GetDensity_FreeStreamND() << "\n"; - if (nDim == 2) { - Breakdown_file << "Initial velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; - Breakdown_file << config->GetVelocity_FreeStreamND()[1] << "). "; - } else { - Breakdown_file << "Initial velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; - 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) { - Breakdown_file << "Initial turb. kinetic energy (non-dim): " << config->GetTke_FreeStreamND() << "\n"; - Breakdown_file << "Initial specific dissipation (non-dim): " << config->GetOmega_FreeStreamND() << "\n"; + if (nDim == 2) { + Breakdown_file << "Initial velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; + Breakdown_file << config->GetVelocity_FreeStreamND()[1] << "). "; + } else { + Breakdown_file << "Initial velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", "; + Breakdown_file << config->GetVelocity_FreeStreamND()[1] << ", " << config->GetVelocity_FreeStreamND()[2] << "). "; } - } + Breakdown_file << "Magnitude: " << config->GetModVel_FreeStreamND() << "\n"; - if (unsteady) { - Breakdown_file << "Total time (non-dim): " << config->GetTotal_UnstTimeND() << "\n"; - Breakdown_file << "Time step (non-dim): " << config->GetDelta_UnstTimeND() << "\n"; - } + if (viscous) { + Breakdown_file << "Initial viscosity (non-dim): " << config->GetViscosity_FreeStreamND() << "\n"; + if (turbulent) { + Breakdown_file << "Initial turb. kinetic energy (non-dim): " << config->GetTke_FreeStreamND() << "\n"; + 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"; + } + } /*--- Begin forces breakdown info. ---*/ @@ -2859,13 +2835,13 @@ bool CFlowOutput::WriteVolume_Output(CConfig *config, unsigned long Iter, bool f if (config->GetTime_Domain()){ if (((config->GetTime_Marching() == DT_STEPPING_1ST) || (config->GetTime_Marching() == TIME_STEPPING)) && - ((Iter == 0) || (Iter % config->GetVolume_Wrt_Freq() == 0))){ + ((Iter == 0) || (Iter % config->GetWrt_Sol_Freq_DualTime() == 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 == 0) || (Iter % config->GetWrt_Sol_Freq_DualTime() == 0) || + ((Iter+1) % config->GetWrt_Sol_Freq_DualTime() == 0) || ((Iter+2 == config->GetnTime_Iter())))){ return true; } diff --git a/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp index 196f203169b7..60246c778ee1 100644 --- a/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp @@ -27,6 +27,7 @@ #include "../../../include/output/filewriter/CParaviewXMLFileWriter.hpp" #include "../../../../Common/include/toolboxes/printing_toolbox.hpp" +#include const string CParaviewXMLFileWriter::fileExt = ".vtu"; diff --git a/SU2_CFD/src/output/output_structure_legacy.cpp b/SU2_CFD/src/output/output_structure_legacy.cpp index 48620bfd7a25..82f6b41827c3 100644 --- a/SU2_CFD/src/output/output_structure_legacy.cpp +++ b/SU2_CFD/src/output/output_structure_legacy.cpp @@ -4291,6 +4291,7 @@ void COutputLegacy::SetConvHistory_Header(ofstream *ConvHist_file, CConfig *conf bool compressible = (config->GetKind_Regime() == COMPRESSIBLE); bool incompressible = (config->GetKind_Regime() == INCOMPRESSIBLE); + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); bool incload = config->GetIncrementalLoad(); bool thermal = false; /* Flag for whether to print heat flux values */ @@ -4418,6 +4419,7 @@ void COutputLegacy::SetConvHistory_Header(ofstream *ConvHist_file, CConfig *conf } char fem_resid[]= ",\"Res_FEM[0]\",\"Res_FEM[1]\",\"Res_FEM[2]\""; char heat_resid[]= ",\"Res_Heat\""; + char poisson_resid[] = ",\"Res_Poisson\""; char rad_resid[]= ",\"Res_P1-rad\""; /*--- End of the header ---*/ @@ -4452,6 +4454,7 @@ void COutputLegacy::SetConvHistory_Header(ofstream *ConvHist_file, CConfig *conf if (rotating_frame && !turbo) ConvHist_file[0] << rotating_frame_coeff; ConvHist_file[0] << flow_resid; + if (pressure_based) ConvHist_file[0] << poisson_resid; if (turbulent) ConvHist_file[0] << turb_resid; if (weakly_coupled_heat) ConvHist_file[0] << heat_resid; if (radiation) ConvHist_file[0] << rad_resid; @@ -4649,7 +4652,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, char begin[1000], direct_coeff[1000], heat_coeff[1000], equivalent_area_coeff[1000], engine_coeff[1000], rotating_frame_coeff[1000], Cp_inverse_design[1000], Heat_inverse_design[1000], surface_coeff[1000], aeroelastic_coeff[1000], monitoring_coeff[10000], buffet_coeff[1000], adjoint_coeff[1000], flow_resid[1000], adj_flow_resid[1000], turb_resid[1000], trans_resid[1000], adj_turb_resid[1000], rad_resid[1000], - begin_fem[1000], fem_coeff[1000], heat_resid[1000], combo_obj[1000], + begin_fem[1000], fem_coeff[1000], heat_resid[1000], combo_obj[1000],poisson_resid[1000], fem_resid[1000], end[1000], end_fem[1000], surface_outputs[1000], d_surface_outputs[1000], d_direct_coeff[1000], turbo_coeff[10000]; @@ -4678,6 +4681,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, bool frozen_visc = (cont_adj && config[val_iZone]->GetFrozen_Visc_Cont()) ||( disc_adj && config[val_iZone]->GetFrozen_Visc_Disc()); bool heat = ((config[val_iZone]->GetKind_Solver() == HEAT_EQUATION) || (config[val_iZone]->GetWeakly_Coupled_Heat())); bool weakly_coupled_heat = config[val_iZone]->GetWeakly_Coupled_Heat(); + bool poisson = (config[val_iZone]->GetKind_Solver() == POISSON_EQUATION); bool flow = (config[val_iZone]->GetKind_Solver() == EULER) || (config[val_iZone]->GetKind_Solver() == NAVIER_STOKES) || (config[val_iZone]->GetKind_Solver() == RANS) || (config[val_iZone]->GetKind_Solver() == FEM_EULER) || (config[val_iZone]->GetKind_Solver() == FEM_NAVIER_STOKES) || (config[val_iZone]->GetKind_Solver() == FEM_RANS) || @@ -4685,6 +4689,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, (config[val_iZone]->GetKind_Solver() == ADJ_NAVIER_STOKES) || (config[val_iZone]->GetKind_Solver() == ADJ_RANS) || (config[val_iZone]->GetKind_Solver() == INC_EULER) || (config[val_iZone]->GetKind_Solver() == INC_NAVIER_STOKES) || (config[val_iZone]->GetKind_Solver() == INC_RANS); + bool pressure_based = config[val_iZone]->GetKind_Incomp_System() == PRESSURE_BASED; // Pressure based solver bool buffet = (config[val_iZone]->GetBuffet_Monitoring() || config[val_iZone]->GetKind_ObjFunc() == BUFFET_SENSOR); bool fem = ((config[val_iZone]->GetKind_Solver() == FEM_ELASTICITY) || // FEM structural solver. @@ -4760,6 +4765,8 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, su2double *residual_fem = nullptr; su2double *residual_heat = nullptr; su2double *residual_rad = nullptr; + su2double *residual_poisson = nullptr; + su2double residual_mass; /*--- Coefficients Monitored arrays ---*/ su2double *aeroelastic_plunge = nullptr, @@ -4780,10 +4787,14 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, unsigned short nVar_Flow = 0, nVar_Turb = 0, nVar_Trans = 0, nVar_Heat = 0, nVar_AdjFlow = 0, nVar_AdjTurb = 0, nVar_AdjHeat = 0, - nVar_FEM = 0, nVar_Rad = 0; + nVar_FEM = 0, nVar_Poisson = 0, nVar_Rad = 0; /*--- Direct problem variables ---*/ if (compressible) nVar_Flow = nDim+2; else nVar_Flow = nDim+2; + if (pressure_based) { + nVar_Flow = nDim; + nVar_Poisson = 1; + } if (turbulent) { switch (config[val_iZone]->GetKind_Turb_Model()) { case SA: case SA_NEG: case SA_E: case SA_E_COMP: case SA_COMP: nVar_Turb = 1; break; @@ -4792,6 +4803,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, } if (transition) nVar_Trans = 2; if (heat) nVar_Heat = 1; + if (poisson) nVar_Poisson = 1; if (fem) { if (linear_analysis) nVar_FEM = nDim; @@ -4818,6 +4830,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, residual_turbulent = new su2double[nVar_Turb]; residual_transition = new su2double[nVar_Trans]; residual_heat = new su2double[nVar_Heat]; + residual_poisson = new su2double[nVar_Poisson]; residual_fem = new su2double[nVar_FEM]; residual_rad = new su2double[nVar_Rad]; residual_adjflow = new su2double[nVar_AdjFlow]; @@ -5008,9 +5021,14 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, } /*--- Flow Residuals ---*/ - - for (iVar = 0; iVar < nVar_Flow; iVar++) + for (iVar = 0; iVar < nVar_Flow; iVar++) residual_flow[iVar] = solver_container[val_iZone][val_iInst][FinestMesh][FLOW_SOL]->GetRes_RMS(iVar); + + /*--- Mass flux residual (for pressure-based problem) ---*/ + if (pressure_based) { + residual_mass = solver_container[val_iZone][val_iInst][FinestMesh][FLOW_SOL]->GetResMassFlux(); + for (iVar = 0; iVar < nVar_Poisson; iVar++) residual_poisson[iVar] = solver_container[val_iZone][val_iInst][FinestMesh][POISSON_SOL]->GetRes_RMS(iVar); + } /*--- Turbulent residual ---*/ @@ -5104,6 +5122,15 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, break; + case POISSON_EQUATION: + /*--- Poisson Residuals ---*/ + + for (iVar = 0; iVar < nVar_Poisson; iVar++) { + residual_poisson[iVar] = solver_container[val_iZone][val_iInst][FinestMesh][POISSON_SOL]->GetRes_RMS(iVar); + } + + break; + case FEM_ELASTICITY: /*--- FEM coefficients -- As of now, this is the Von Mises Stress ---*/ @@ -5356,11 +5383,19 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, /*--- Flow residual ---*/ if (nDim == 2) { if (compressible) SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]), log10 (residual_flow[2]), log10 (residual_flow[3]), dummy); - if (incompressible) SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]), log10 (residual_flow[2]), log10 (residual_flow[3]), dummy); + if (incompressible && (pressure_based)) { + SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]),log10 (residual_mass), dummy, dummy); + SPRINTF(poisson_resid, ", %14.8e", log10 (residual_poisson[0])); + } + if (incompressible && (!pressure_based)) SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]), log10 (residual_flow[2]), log10 (residual_flow[3]), dummy); } else { if (compressible) SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]), log10 (residual_flow[2]), log10 (residual_flow[3]), log10 (residual_flow[4]) ); - if (incompressible) SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]), log10 (residual_flow[2]), log10 (residual_flow[3]), log10 (residual_flow[4])); + if (incompressible && (!pressure_based)) SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]), log10 (residual_flow[2]), log10 (residual_flow[3]), log10 (residual_flow[4])); + if (incompressible && (pressure_based)) { + SPRINTF (flow_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_flow[0]), log10 (residual_flow[1]),log10 (residual_flow[2]), log10 (residual_mass), dummy); + SPRINTF(poisson_resid, ", %14.8e", log10 (residual_poisson[0])); + } } /*--- Turbulent residual ---*/ @@ -5449,6 +5484,12 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, SPRINTF (heat_resid, ", %14.8e", log10 (residual_heat[0])); break; + + case POISSON_EQUATION: + + SPRINTF (poisson_resid, ", %14.8e, %14.8e, %14.8e, %14.8e, %14.8e", log10 (residual_poisson[0]), dummy, dummy, dummy, dummy ); + + break; case FEM_ELASTICITY: @@ -5633,6 +5674,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, // if (!fluid_structure) { if (incompressible && !weakly_coupled_heat) { if (energy) {cout << " Res[Press]" << " Res[Temp]" << " CLift(Total)" << " CDrag(Total)" << endl;} + else if (pressure_based) {cout << " Res[Velx]" << " Res[Mass]" << " CLift(Total)" << " CDrag(Total)" << endl;} else {cout << " Res[Press]" << " Res[Velx]" << " CLift(Total)" << " CDrag(Total)" << endl;} } else if (incompressible && weakly_coupled_heat) cout << " Res[Press]" << " Res[Heat]" << " HFlux(Total)"; @@ -5699,7 +5741,8 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, if (!Unsteady) cout << endl << " Iter" << " Time(s)"; else cout << endl << " IntIter" << " ExtIter"; - if (incompressible) cout << " Res[Press]"; + if (incompressible && !pressure_based) cout << " Res[Press]"; + else if (incompressible && pressure_based) cout << " Res[Velx]"; else cout << " Res[Rho]";//, cout << " Res[RhoE]"; switch (config[val_iZone]->GetKind_Turb_Model()) { @@ -5749,6 +5792,12 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, cout << " Res[Heat]" << " HFlux(Total)"; break; + + case POISSON_EQUATION : + cout << endl << " Iter" << " Time(s)"; + cout << " Res[Poisson]" << " "<< endl; + + break; case FEM_ELASTICITY : if (!nonlinear_analysis) cout << endl << " Iter" << " Time(s)"; @@ -5951,6 +6000,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, if (rotating_frame && !turbo) config[val_iZone]->GetHistFile()[0] << rotating_frame_coeff; config[val_iZone]->GetHistFile()[0] << flow_resid; if (weakly_coupled_heat) config[val_iZone]->GetHistFile()[0] << heat_resid; + if (pressure_based) config[val_iZone]->GetHistFile()[0] << poisson_resid; if (radiation) config[val_iZone]->GetHistFile()[0] << rad_resid; } else { @@ -5982,6 +6032,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, } if (incompressible && !weakly_coupled_heat) { if (energy) {cout.width(14); cout << log10(residual_flow[nDim+1]);} + else if (pressure_based) {cout.width(14); cout << log10(residual_mass);} else {cout.width(14); cout << log10(residual_flow[1]);} } if (incompressible && weakly_coupled_heat) { cout.width(14); cout << log10(residual_heat[0]);} @@ -6048,6 +6099,7 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, if (rotating_frame && !turbo) config[val_iZone]->GetHistFile()[0] << rotating_frame_coeff; config[val_iZone]->GetHistFile()[0] << flow_resid << turb_resid; if (weakly_coupled_heat) config[val_iZone]->GetHistFile()[0] << heat_resid; + if (pressure_based) config[val_iZone]->GetHistFile()[0] << poisson_resid; } else { config[val_iZone]->GetHistFile()[0] << begin << turbo_coeff << flow_resid << turb_resid; @@ -6138,6 +6190,20 @@ void COutputLegacy::SetConvHistory_Body(ofstream *ConvHist_file, config[val_iZone]->GetHistFile()[0].flush(); } break; + + case POISSON_EQUATION: + + if (!DualTime_Iteration) { + ConvHist_file[0] << begin << poisson_resid << end; + ConvHist_file[0].flush(); + } + if (val_iZone == 0 || fluid_structure){ + cout.precision(6); + cout.setf(ios::fixed, ios::floatfield); + cout.width(14); cout << log10(residual_poisson[0]); + cout << endl; + } + break; case FEM_ELASTICITY: @@ -12854,6 +12920,8 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, bool variable_density = (config->GetKind_DensityModel() == VARIABLE); bool energy = config->GetEnergy_Equation(); bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); + bool wrt_cp = (variable_density && (config->GetKind_FluidModel() == INC_IDEAL_GAS_POLY)); bool wrt_kt = ((config->GetKind_ConductivityModel() != CONSTANT_CONDUCTIVITY) && @@ -12899,7 +12967,10 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, } nVar_First = solver[FirstIndex]->GetnVar(); - if ((!energy) && (!weakly_coupled_heat)) nVar_First--; + if (((!energy) && (!weakly_coupled_heat))&&(!pressure_based)) nVar_First--; + /*--- For pressure based solver, Pressure is not part of the solution but we still want + * it in the output and will be written from Primitive variables ---*/ + if (pressure_based) nVar_First += 1; if (SecondIndex != NONE) nVar_Second = solver[SecondIndex]->GetnVar(); nVar_Consv_Par = nVar_First + nVar_Second; @@ -13236,13 +13307,21 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, } /*--- Load the conservative variable states for the mean flow variables. ---*/ - - Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 0); iVar++; - Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 1); iVar++; - Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 2); iVar++; - if (nDim == 3) { - Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 3); iVar++; - } + if (pressure_based) { + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetPressure(iPoint); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 0); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 1); iVar++; + if (nDim == 3) { + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 2); iVar++; + } + } + else { + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 0); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 1); iVar++; + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 2); iVar++; + if (nDim == 3) { + Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, 3); iVar++; + } if (weakly_coupled_heat) { Local_Data[jPoint][iVar] = solver[HEAT_SOL]->GetNodes()->GetSolution(iPoint, 0); iVar++; @@ -13250,6 +13329,7 @@ void COutputLegacy::LoadLocalData_IncFlow(CConfig *config, CGeometry *geometry, Local_Data[jPoint][iVar] = solver[FirstIndex]->GetNodes()->GetSolution(iPoint, nDim+1); iVar++; } + } /*--- If this is RANS, i.e., the second solver container is not empty, then load data for the conservative turbulence variables. ---*/ diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 44cfdd1c3b6b..4b252a3b0aa2 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -3748,7 +3748,6 @@ void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver } SU2_OMP_BARRIER - ComputeUnderRelaxationFactor(solver_container, config); /*--- Update solution (system written in terms of increments) ---*/ diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index e221024c8ba8..c2de253c4e8b 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -1527,9 +1527,9 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - /*--- Load the conservative variables ---*/ + /*--- Load the primitive variables ---*/ - numerics->SetConservative(nodes->GetSolution(iPoint), nullptr); + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), NULL); /*--- Set incompressible density ---*/ @@ -2070,6 +2070,8 @@ void CIncEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **sol } } + SetIterLinSolver(1); + /*--- MPI solution ---*/ InitiateComms(geometry, config, SOLUTION); @@ -2167,8 +2169,6 @@ void CIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **sol SetIterLinSolver(IterLinSol); - /*--- Update solution (system written in terms of increments) ---*/ - if (!adjoint) { for (iPoint = 0; iPoint < nPointDomain; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { @@ -2958,7 +2958,7 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep, unsigned short iMesh, unsigned short RunTime_EqSystem) { - /*--- Local variables ---*/ + /*--- Local variables ---*/ unsigned short iVar, jVar, iMarker, iDim; unsigned long iPoint, jPoint, iEdge, iVertex; @@ -3051,33 +3051,19 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver LinSysRes.AddBlock(iPoint, Residual); if (implicit) { - - SetPreconditioner(config, iPoint); - for (iVar = 0; iVar < nVar; iVar++) { - for (jVar = 0; jVar < nVar; jVar++) { - Jacobian_i[iVar][jVar] = Preconditioner[iVar][jVar]; - } - } - - for (iVar = 0; iVar < nVar; iVar++) { - for (jVar = 0; jVar < nVar; jVar++) { - if (config->GetTime_Marching() == DT_STEPPING_1ST) - Jacobian_i[iVar][jVar] *= Volume_nP1 / TimeStep; - if (config->GetTime_Marching() == DT_STEPPING_2ND) - Jacobian_i[iVar][jVar] *= (Volume_nP1*3.0)/(2.0*TimeStep); - } - } - - if (!energy) { - for (iVar = 0; iVar < nVar; iVar++) { - Jacobian_i[iVar][nDim+1] = 0.0; - Jacobian_i[nDim+1][iVar] = 0.0; - } + for (iVar = 1; iVar < nVar; iVar++) { + if (config->GetTime_Marching() == DT_STEPPING_1ST) + Jacobian_i[iVar][iVar] = Volume_nP1 / TimeStep; + if (config->GetTime_Marching() == DT_STEPPING_2ND) + Jacobian_i[iVar][iVar] = (Volume_nP1*3.0)/(2.0*TimeStep); } + for (iDim = 0; iDim < nDim; iDim++) + Jacobian_i[iDim+1][iDim+1] = Density*Jacobian_i[iDim+1][iDim+1]; + if (energy) Jacobian_i[nDim+1][nDim+1] = Density*Cp*Jacobian_i[nDim+1][nDim+1]; Jacobian.AddBlock2Diag(iPoint, Jacobian_i); - } + } } @@ -3276,34 +3262,25 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver to the dual time source term. ---*/ if (!energy) Residual[nDim+1] = 0.0; LinSysRes.AddBlock(iPoint, Residual); - if (implicit) { - SetPreconditioner(config, iPoint); - for (iVar = 0; iVar < nVar; iVar++) { - for (jVar = 0; jVar < nVar; jVar++) { - Jacobian_i[iVar][jVar] = Preconditioner[iVar][jVar]; - } - } - for (iVar = 0; iVar < nVar; iVar++) { - for (jVar = 0; jVar < nVar; jVar++) { - if (config->GetTime_Marching() == DT_STEPPING_1ST) - Jacobian_i[iVar][jVar] *= Volume_nP1 / TimeStep; - if (config->GetTime_Marching() == DT_STEPPING_2ND) - Jacobian_i[iVar][jVar] *= (Volume_nP1*3.0)/(2.0*TimeStep); - } + if (implicit) { + for (iVar = 1; iVar < nVar; iVar++) { + if (config->GetTime_Marching() == DT_STEPPING_1ST) + Jacobian_i[iVar][iVar] = Volume_nP1 / TimeStep; + if (config->GetTime_Marching() == DT_STEPPING_2ND) + Jacobian_i[iVar][iVar] = (Volume_nP1*3.0)/(2.0*TimeStep); } + for (iDim = 0; iDim < nDim; iDim++) + Jacobian_i[iDim+1][iDim+1] = Density*Jacobian_i[iDim+1][iDim+1]; + if (energy) Jacobian_i[nDim+1][nDim+1] = Density*Cp*Jacobian_i[nDim+1][nDim+1]; - if (!energy) { - for (iVar = 0; iVar < nVar; iVar++) { - Jacobian_i[iVar][nDim+1] = 0.0; - Jacobian_i[nDim+1][iVar] = 0.0; - } - } Jacobian.AddBlock2Diag(iPoint, Jacobian_i); } + } } + } void CIncEulerSolver::GetOutlet_Properties(CGeometry *geometry, CConfig *config, unsigned short iMesh, bool Output) { diff --git a/SU2_CFD/src/solvers/CPBIncEulerSolver.cpp b/SU2_CFD/src/solvers/CPBIncEulerSolver.cpp new file mode 100644 index 000000000000..4fd89b8cf8f1 --- /dev/null +++ b/SU2_CFD/src/solvers/CPBIncEulerSolver.cpp @@ -0,0 +1,2766 @@ +/*! + * \file CPBIncEulerSolver.cpp + * \brief Main subroutines for solving pressure based incompressible flow (Euler, Navier-Stokes, etc.). + * \author F. Palacios, T. Economon, A. Koodly + * \version 7.0.6 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/solvers/CPBIncEulerSolver.hpp" +#include "../../../Common/include/toolboxes/printing_toolbox.hpp" +#include "../../include/fluid/CConstantDensity.hpp" +#include "../../include/fluid/CIncIdealGas.hpp" +#include "../../include/fluid/CIncIdealGasPolynomial.hpp" +#include "../../include/variables/CPBIncNSVariable.hpp" +#include "../../include/solvers/CFVMFlowSolverBase.inl" + +template class CFVMFlowSolverBase; + +CPBIncEulerSolver::CPBIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh, + const bool navier_stokes) : + CFVMFlowSolverBase() { + + /*--- Based on the navier_stokes boolean, determine if this constructor is + * being called by itself, or by the Navier Stokes solver. ---*/ + const string description = navier_stokes? "Navier-Stokes" : "Euler"; + + unsigned long iPoint, iVertex, iEdge, jPoint; + unsigned short iVar, iDim, iMarker; + ifstream restart_file; + unsigned short nZone = geometry->GetnZone(); + bool restart = (config->GetRestart() || config->GetRestart_Flow()); + int Unst_RestartIter; + unsigned short iZone = config->GetiZone(); + bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND)); + bool time_stepping = config->GetTime_Marching() == TIME_STEPPING; + string filename_ = config->GetSolution_FileName(); + + /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ + dynamic_grid = config->GetDynamic_Grid(); + + /*--- Check for a restart file to evaluate if there is a change in the angle of attack + before computing all the non-dimesional quantities. ---*/ + if (!(!restart || (iMesh != MESH_0) || nZone > 1)) { + + /*--- Multizone problems require the number of the zone to be appended. ---*/ + + if (nZone > 1) filename_ = config->GetMultizone_FileName(filename_, iZone, ".dat"); + + /*--- Modify file name for a dual-time unsteady restart ---*/ + + if (dual_time) { + if (config->GetTime_Marching() == DT_STEPPING_1ST) + Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-1; + else Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-2; + filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, ".dat"); + } + + /*--- Modify file name for a time stepping unsteady restart ---*/ + + if (time_stepping) { + Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-1; + filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, ".dat"); + } + } + + /*--- Define geometry constants in the solver structure. + * Incompressible flow, primitive variables (P, vx, vy, vz, rho, mu_lam, mu_t) ---*/ + + nDim = geometry->GetnDim(); + + nVar = nDim; nPrimVar = nDim+4; nPrimVarGrad = nDim+2; + + /*--- Initialize nVarGrad for deallocation ---*/ + + nVarGrad = nPrimVarGrad; + + nMarker = config->GetnMarker_All(); + nPoint = geometry->GetnPoint(); + nPointDomain = geometry->GetnPointDomain(); + nEdge = geometry->GetnEdge(); + + /*--- Store the number of vertices on each marker for deallocation later ---*/ + + nVertex = new unsigned long[nMarker]; + for (iMarker = 0; iMarker < nMarker; iMarker++) + nVertex[iMarker] = geometry->nVertex[iMarker]; + + /*--- Perform the non-dimensionalization for the flow equations using the + specified reference values. ---*/ + + SetNondimensionalization(config, iMesh); + + AllocateTerribleLegacyTemporaryVariables(); + + /*--- Define some auxiliary vectors related to the primitive solution ---*/ + + Primitive = new su2double[nPrimVar] (); + Primitive_i = new su2double[nPrimVar] (); + Primitive_j = new su2double[nPrimVar] (); + + /*--- Allocate base class members. ---*/ + + Allocate(*config); + + /*--- Jacobians and vector structures for implicit computations ---*/ + + if (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT) { + if (rank == MASTER_NODE) cout << "Initialize Jacobian structure ("<GetDensity_FreeStreamND(); + Pressure_Inf = config->GetPressure_FreeStreamND(); + Velocity_Inf = config->GetVelocity_FreeStreamND(); + + + /*--- Initialize the solution to the far-field state everywhere. ---*/ + if (navier_stokes) { + nodes = new CPBIncNSVariable(Density_Inf, Pressure_Inf, Velocity_Inf, nPoint, nDim, nVar, config); + } else { + nodes = new CPBIncEulerVariable(Density_Inf, Pressure_Inf, Velocity_Inf, nPoint, nDim, nVar, config); + } + SetBaseClassPointerToNodes(); + + /*--- Allocate velocities at every face. This is for momentum interpolation. ---*/ + + FaceVelocity.resize(nEdge,nDim); + FaceVelocityCorrec.resize(nEdge,nDim); + su2double Normal[MAXNDIM]; + for (iEdge = 0; iEdge < nEdge; iEdge++) { + geometry->edges->GetNormal(iEdge, Normal); + iPoint = geometry->edges->GetNode(iEdge,0); + jPoint = geometry->edges->GetNode(iEdge,1); + for (iDim = 0; iDim < nDim; iDim++) { + FaceVelocity[iEdge][iDim]= 0.5*(nodes->GetSolution(iPoint,iDim)+nodes->GetSolution(jPoint,iDim)); + FaceVelocityCorrec[iEdge][iDim] = 0.0; + } + } + PseudoTimeCorr.resize(nEdge,nDim) = su2double(0.0); + TimeMarchingCorr_n.resize(nEdge,nDim) = su2double(0.0); + TimeMarchingCorr_n1.resize(nEdge,nDim) = su2double(0.0); + + /*--- Initial comms. ---*/ + + CommunicateInitialState(geometry, config); + InitiateComms(geometry, config, PRESSURE_VAR); + CompleteComms(geometry, config, PRESSURE_VAR); + + /*--- Add the solver name (max 8 characters) ---*/ + SolverName = "INC.FLOW"; + +} + +CPBIncEulerSolver::~CPBIncEulerSolver(void) { + + unsigned short iMarker; + unsigned long iVertex; + unsigned long iEdge; + + delete [] Primitive; + delete [] Primitive_i; + delete [] Primitive_j; + + delete FluidModel; + +} + +void CPBIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMesh) { + + su2double Temperature_FreeStream = 0.0, ModVel_FreeStream = 0.0,Energy_FreeStream = 0.0, + ModVel_FreeStreamND = 0.0, Omega_FreeStream = 0.0, Omega_FreeStreamND = 0.0, Viscosity_FreeStream = 0.0, + Density_FreeStream = 0.0, Pressure_FreeStream = 0.0, Pressure_Thermodynamic = 0.0, Tke_FreeStream = 0.0, + Length_Ref = 0.0, Density_Ref = 0.0, Pressure_Ref = 0.0, Temperature_Ref = 0.0, Velocity_Ref = 0.0, Time_Ref = 0.0, + Gas_Constant_Ref = 0.0, Omega_Ref = 0.0, Force_Ref = 0.0, Viscosity_Ref = 0.0, Conductivity_Ref = 0.0, Heat_Flux_Ref = 0.0, Energy_Ref= 0.0, Pressure_FreeStreamND = 0.0, Pressure_ThermodynamicND = 0.0, Density_FreeStreamND = 0.0, + Temperature_FreeStreamND = 0.0, Gas_ConstantND = 0.0, Specific_Heat_CpND = 0.0, Specific_Heat_CvND = 0.0, Thermal_Expansion_CoeffND = 0.0, + Velocity_FreeStreamND[3] = {0.0, 0.0, 0.0}, Viscosity_FreeStreamND = 0.0, + Tke_FreeStreamND = 0.0, Energy_FreeStreamND = 0.0, + Total_UnstTimeND = 0.0, Delta_UnstTimeND = 0.0; + + unsigned short iDim, iVar; + + /*--- Local variables ---*/ + + su2double Mach = config->GetMach(); + su2double Reynolds = config->GetReynolds(); + unsigned short turb_model = config->GetKind_Turb_Model(); + + bool unsteady = (config->GetTime_Marching() != NO); + bool viscous = config->GetViscous(); + bool turbulent = (config->GetKind_Solver() == RANS); + bool tkeNeeded = ((turbulent) && ((turb_model == SST) || (turb_model == SST_SUST))); + + /*--- Compute dimensional free-stream values. ---*/ + + Density_FreeStream = config->GetInc_Density_Init(); config->SetDensity_FreeStream(Density_FreeStream); + Temperature_FreeStream = config->GetInc_Temperature_Init(); config->SetTemperature_FreeStream(Temperature_FreeStream); + Pressure_FreeStream = 0.0; config->SetPressure_FreeStream(Pressure_FreeStream); + + ModVel_FreeStream = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + ModVel_FreeStream += config->GetInc_Velocity_Init()[iDim]*config->GetInc_Velocity_Init()[iDim]; + config->SetVelocity_FreeStream(config->GetInc_Velocity_Init()[iDim],iDim); + } + ModVel_FreeStream = sqrt(ModVel_FreeStream); config->SetModVel_FreeStream(ModVel_FreeStream); + + /*--- Only constant density model is available. ---*/ + + switch (config->GetKind_FluidModel()) { + + case CONSTANT_DENSITY: + + FluidModel = new CConstantDensity(Density_FreeStream, config->GetSpecific_Heat_Cp()); + FluidModel->SetTDState_T(Temperature_FreeStream); + break; + default: + SU2_MPI::Error("Fluid model not implemented for pressure based incompressible solver.", CURRENT_FUNCTION); + break; + } + + if (viscous) { + + /*--- The dimensional viscosity is needed to determine the free-stream conditions. + To accomplish this, simply set the non-dimensional coefficients to the + dimensional ones. This will be overruled later.---*/ + + config->SetMu_RefND(config->GetMu_Ref()); + config->SetMu_Temperature_RefND(config->GetMu_Temperature_Ref()); + config->SetMu_SND(config->GetMu_S()); + config->SetMu_ConstantND(config->GetMu_Constant()); + + /*--- Use the fluid model to compute the dimensional viscosity/conductivity. ---*/ + + FluidModel->SetLaminarViscosityModel(config); + Viscosity_FreeStream = FluidModel->GetLaminarViscosity(); + config->SetViscosity_FreeStream(Viscosity_FreeStream); + + Reynolds = Density_FreeStream*ModVel_FreeStream/Viscosity_FreeStream; config->SetReynolds(Reynolds); + + /*--- Turbulence kinetic energy ---*/ + + Tke_FreeStream = 3.0/2.0*(ModVel_FreeStream*ModVel_FreeStream*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream()); + + } + + /*--- The non-dim. scheme for incompressible flows uses the following ref. values: + Reference length = 1 m (fixed by default, grid in meters) + Reference density = liquid density or freestream (input) + Reference velocity = liquid velocity or freestream (input) + Reference temperature = liquid temperature or freestream (input) + Reference pressure = Reference density * Reference velocity * Reference velocity + Reference viscosity = Reference Density * Reference velocity * Reference length + This is the same non-dim. scheme as in the compressible solver. + Note that the Re and Re Length are not used as part of initialization. ---*/ + + if (config->GetRef_Inc_NonDim() == DIMENSIONAL) { + Density_Ref = 1.0; + Velocity_Ref = 1.0; + Temperature_Ref = 1.0; + Pressure_Ref = 1.0; + } + else if (config->GetRef_Inc_NonDim() == INITIAL_VALUES) { + Density_Ref = Density_FreeStream; + Velocity_Ref = ModVel_FreeStream; + Temperature_Ref = Temperature_FreeStream; + Pressure_Ref = Density_Ref*Velocity_Ref*Velocity_Ref; + } + else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) { + Density_Ref = config->GetInc_Density_Ref(); + Velocity_Ref = config->GetInc_Velocity_Ref(); + Temperature_Ref = config->GetInc_Temperature_Ref(); + Pressure_Ref = Density_Ref*Velocity_Ref*Velocity_Ref; + } + config->SetDensity_Ref(Density_Ref); + config->SetVelocity_Ref(Velocity_Ref); + config->SetTemperature_Ref(Temperature_Ref); + config->SetPressure_Ref(Pressure_Ref); + + /*--- More derived reference values ---*/ + + Length_Ref = 1.0; config->SetLength_Ref(Length_Ref); + Time_Ref = Length_Ref/Velocity_Ref; config->SetTime_Ref(Time_Ref); + Omega_Ref = Velocity_Ref/Length_Ref; config->SetOmega_Ref(Omega_Ref); + Force_Ref = Velocity_Ref*Velocity_Ref/Length_Ref; config->SetForce_Ref(Force_Ref); + Gas_Constant_Ref = Velocity_Ref*Velocity_Ref/Temperature_Ref; config->SetGas_Constant_Ref(Gas_Constant_Ref); + Viscosity_Ref = Density_Ref*Velocity_Ref*Length_Ref; config->SetViscosity_Ref(Viscosity_Ref); + Heat_Flux_Ref = Density_Ref*Velocity_Ref*Velocity_Ref*Velocity_Ref; config->SetHeat_Flux_Ref(Heat_Flux_Ref); //To avoid error in Friction Force routine only + + /*--- Get the freestream energy. Only useful if energy equation is active. ---*/ + + Energy_FreeStream = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStream*ModVel_FreeStream; + config->SetEnergy_FreeStream(Energy_FreeStream); + if (tkeNeeded) { Energy_FreeStream += Tke_FreeStream; }; config->SetEnergy_FreeStream(Energy_FreeStream); + + /*--- Compute Mach number ---*/ + + if (config->GetKind_FluidModel() == CONSTANT_DENSITY) { + Mach = ModVel_FreeStream / sqrt(config->GetBulk_Modulus()/Density_FreeStream); + } else { + Mach = 0.0; + } + config->SetMach(Mach); + + /*--- Divide by reference values, to compute the non-dimensional free-stream values ---*/ + + Pressure_FreeStreamND = Pressure_FreeStream/config->GetPressure_Ref(); config->SetPressure_FreeStreamND(Pressure_FreeStreamND); + Pressure_ThermodynamicND = Pressure_Thermodynamic/config->GetPressure_Ref(); config->SetPressure_ThermodynamicND(Pressure_ThermodynamicND); + Density_FreeStreamND = Density_FreeStream/config->GetDensity_Ref(); config->SetDensity_FreeStreamND(Density_FreeStreamND); + + for (iDim = 0; iDim < nDim; iDim++) { + Velocity_FreeStreamND[iDim] = config->GetVelocity_FreeStream()[iDim]/Velocity_Ref; config->SetVelocity_FreeStreamND(Velocity_FreeStreamND[iDim], iDim); + } + + ModVel_FreeStreamND = 0.0; + for (iDim = 0; iDim < nDim; iDim++) ModVel_FreeStreamND += Velocity_FreeStreamND[iDim]*Velocity_FreeStreamND[iDim]; + ModVel_FreeStreamND = sqrt(ModVel_FreeStreamND); config->SetModVel_FreeStreamND(ModVel_FreeStreamND); + + Viscosity_FreeStreamND = Viscosity_FreeStream / Viscosity_Ref; config->SetViscosity_FreeStreamND(Viscosity_FreeStreamND); + + Tke_FreeStream = 3.0/2.0*(ModVel_FreeStream*ModVel_FreeStream*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream()); + config->SetTke_FreeStream(Tke_FreeStream); + + Tke_FreeStreamND = 3.0/2.0*(ModVel_FreeStreamND*ModVel_FreeStreamND*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream()); + config->SetTke_FreeStreamND(Tke_FreeStreamND); + + Omega_FreeStream = Density_FreeStream*Tke_FreeStream/(Viscosity_FreeStream*config->GetTurb2LamViscRatio_FreeStream()); + config->SetOmega_FreeStream(Omega_FreeStream); + + Omega_FreeStreamND = Density_FreeStreamND*Tke_FreeStreamND/(Viscosity_FreeStreamND*config->GetTurb2LamViscRatio_FreeStream()); + config->SetOmega_FreeStreamND(Omega_FreeStreamND); + + /*--- Delete the original (dimensional) FluidModel object. No fluid is used for inscompressible cases. ---*/ + + delete FluidModel; + + switch (config->GetKind_FluidModel()) { + + case CONSTANT_DENSITY: + FluidModel = new CConstantDensity(Density_FreeStreamND, Specific_Heat_CpND); + FluidModel->SetTDState_T(Temperature_FreeStreamND); + break; + + } + + if (viscous) { + + /*--- Constant viscosity model ---*/ + + config->SetMu_ConstantND(config->GetMu_Constant()/Viscosity_Ref); + + /*--- Set up the transport property models. ---*/ + + FluidModel->SetLaminarViscosityModel(config); + + } + + if (tkeNeeded) { Energy_FreeStreamND += Tke_FreeStreamND; }; config->SetEnergy_FreeStreamND(Energy_FreeStreamND); + + Total_UnstTimeND = config->GetTotal_UnstTime() / Time_Ref; config->SetTotal_UnstTimeND(Total_UnstTimeND); + Delta_UnstTimeND = config->GetDelta_UnstTime() / Time_Ref; config->SetDelta_UnstTimeND(Delta_UnstTimeND); + + /*--- Write output to the console if this is the master node and first domain ---*/ + + if ((rank == MASTER_NODE) && (iMesh == MESH_0)) { + + cout.precision(6); + + if (config->GetRef_Inc_NonDim() == DIMENSIONAL) { + cout << "Pressure based incompressible flow: rho_ref, vel_ref, temp_ref, p_ref" << endl; + cout << "are set to 1.0 in order to perform a dimensional calculation." << endl; + if (dynamic_grid) cout << "Force coefficients computed using MACH_MOTION." << endl; + else cout << "Force coefficients computed using initial values." << endl; + } + else if (config->GetRef_Inc_NonDim() == INITIAL_VALUES) { + cout << "Pressure based incompressible flow: rho_ref, vel_ref, and temp_ref" << endl; + cout << "are based on the initial values, p_ref = rho_ref*vel_ref^2." << endl; + if (dynamic_grid) cout << "Force coefficients computed using MACH_MOTION." << endl; + else cout << "Force coefficients computed using initial values." << endl; + } + else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) { + cout << "Pressure based incompressible flow: rho_ref, vel_ref, and temp_ref" << endl; + cout << "are user-provided reference values, p_ref = rho_ref*vel_ref^2." << endl; + if (dynamic_grid) cout << "Force coefficients computed using MACH_MOTION." << endl; + else cout << "Force coefficients computed using reference values." << endl; + } + cout << "The reference area for force coeffs. is " << config->GetRefArea() << " m^2." << endl; + cout << "The reference length for force coeffs. is " << config->GetRefLength() << " m." << endl; + + cout << "The pressure is decomposed into thermodynamic and dynamic components." << endl; + cout << "The initial value of the dynamic pressure is 0." << endl; + + cout << "Mach number: "<< config->GetMach(); + if (config->GetKind_FluidModel() == CONSTANT_DENSITY) { + cout << ", computed using the Bulk modulus." << endl; + } else { + cout << ", computed using fluid speed of sound." << endl; + } + + cout << "For external flows, the initial state is imposed at the far-field." << endl; + cout << "Angle of attack (deg): "<< config->GetAoA() << ", computed using the initial velocity." << endl; + cout << "Side slip angle (deg): "<< config->GetAoS() << ", computed using the initial velocity." << endl; + + if (viscous) { + cout << "Reynolds number per meter: " << config->GetReynolds() << ", computed using initial values."<< endl; + cout << "Reynolds number is a byproduct of inputs only (not used internally)." << endl; + } + cout << "SI units only. The grid should be dimensional (meters)." << endl; + + switch (config->GetKind_DensityModel()) { + + case CONSTANT: + cout << "No energy equation." << endl; + break; + } + + stringstream NonDimTableOut, ModelTableOut; + stringstream Unit; + + cout << endl; + PrintingToolbox::CTablePrinter ModelTable(&ModelTableOut); + ModelTableOut <<"-- Models:"<< endl; + + ModelTable.AddColumn("Viscosity Model", 25); + ModelTable.AddColumn("Conductivity Model", 26); + ModelTable.AddColumn("Fluid Model", 25); + ModelTable.SetAlign(PrintingToolbox::CTablePrinter::RIGHT); + ModelTable.PrintHeader(); + + PrintingToolbox::CTablePrinter NonDimTable(&NonDimTableOut); + NonDimTable.AddColumn("Name", 22); + NonDimTable.AddColumn("Dim. value", 14); + NonDimTable.AddColumn("Ref. value", 14); + NonDimTable.AddColumn("Unit", 10); + NonDimTable.AddColumn("Non-dim. value", 14); + NonDimTable.SetAlign(PrintingToolbox::CTablePrinter::RIGHT); + + NonDimTableOut <<"-- Fluid properties:"<< endl; + + NonDimTable.PrintHeader(); + + if (viscous){ + + switch(config->GetKind_ViscosityModel()){ + case CONSTANT_VISCOSITY: + ModelTable << "CONSTANT_VISCOSITY"; + if (config->GetSystemMeasurements() == SI) Unit << "N.s/m^2"; + else if (config->GetSystemMeasurements() == US) Unit << "lbf.s/ft^2"; + NonDimTable << "Viscosity" << config->GetMu_Constant() << config->GetMu_Constant()/config->GetMu_ConstantND() << Unit.str() << config->GetMu_ConstantND(); + Unit.str(""); + NonDimTable.PrintFooter(); + break; + } + } else { + ModelTable << "-" << "-"; + } + + NonDimTableOut <<"-- Initial and free-stream conditions:"<< endl; + NonDimTable.PrintHeader(); + + if (config->GetSystemMeasurements() == SI) Unit << "Pa"; + else if (config->GetSystemMeasurements() == US) Unit << "psf"; + NonDimTable << "Dynamic Pressure" << config->GetPressure_FreeStream() << config->GetPressure_Ref() << Unit.str() << config->GetPressure_FreeStreamND(); + Unit.str(""); + if (config->GetSystemMeasurements() == SI) Unit << "Pa"; + else if (config->GetSystemMeasurements() == US) Unit << "psf"; + NonDimTable << "Total Pressure" << config->GetPressure_FreeStream() + 0.5*config->GetDensity_FreeStream()*config->GetModVel_FreeStream()*config->GetModVel_FreeStream() + << config->GetPressure_Ref() << Unit.str() << config->GetPressure_FreeStreamND() + 0.5*config->GetDensity_FreeStreamND()*config->GetModVel_FreeStreamND()*config->GetModVel_FreeStreamND(); + Unit.str(""); + if (config->GetSystemMeasurements() == SI) Unit << "kg/m^3"; + else if (config->GetSystemMeasurements() == US) Unit << "slug/ft^3"; + NonDimTable << "Density" << config->GetDensity_FreeStream() << config->GetDensity_Ref() << Unit.str() << config->GetDensity_FreeStreamND(); + Unit.str(""); + if (config->GetSystemMeasurements() == SI) Unit << "m/s"; + else if (config->GetSystemMeasurements() == US) Unit << "ft/s"; + NonDimTable << "Velocity-X" << config->GetVelocity_FreeStream()[0] << config->GetVelocity_Ref() << Unit.str() << config->GetVelocity_FreeStreamND()[0]; + NonDimTable << "Velocity-Y" << config->GetVelocity_FreeStream()[1] << config->GetVelocity_Ref() << Unit.str() << config->GetVelocity_FreeStreamND()[1]; + if (nDim == 3){ + NonDimTable << "Velocity-Z" << config->GetVelocity_FreeStream()[2] << config->GetVelocity_Ref() << Unit.str() << config->GetVelocity_FreeStreamND()[2]; + } + NonDimTable << "Velocity Magnitude" << config->GetModVel_FreeStream() << config->GetVelocity_Ref() << Unit.str() << config->GetModVel_FreeStreamND(); + Unit.str(""); + + if (viscous){ + NonDimTable.PrintFooter(); + if (config->GetSystemMeasurements() == SI) Unit << "N.s/m^2"; + else if (config->GetSystemMeasurements() == US) Unit << "lbf.s/ft^2"; + NonDimTable << "Viscosity" << config->GetViscosity_FreeStream() << config->GetViscosity_Ref() << Unit.str() << config->GetViscosity_FreeStreamND(); + Unit.str(""); + if (turbulent){ + if (config->GetSystemMeasurements() == SI) Unit << "m^2/s^2"; + else if (config->GetSystemMeasurements() == US) Unit << "ft^2/s^2"; + NonDimTable << "Turb. Kin. Energy" << config->GetTke_FreeStream() << config->GetTke_FreeStream()/config->GetTke_FreeStreamND() << Unit.str() << config->GetTke_FreeStreamND(); + Unit.str(""); + if (config->GetSystemMeasurements() == SI) Unit << "1/s"; + else if (config->GetSystemMeasurements() == US) Unit << "1/s"; + NonDimTable << "Spec. Dissipation" << config->GetOmega_FreeStream() << config->GetOmega_FreeStream()/config->GetOmega_FreeStreamND() << Unit.str() << config->GetOmega_FreeStreamND(); + Unit.str(""); + } + } + + NonDimTable.PrintFooter(); + NonDimTable << "Mach Number" << "-" << "-" << "-" << config->GetMach(); + if (viscous){ + NonDimTable << "Reynolds Number" << "-" << "-" << "-" << config->GetReynolds(); + } + + NonDimTable.PrintFooter(); + ModelTable.PrintFooter(); + + if (unsteady){ + NonDimTable.PrintHeader(); + NonDimTableOut << "-- Unsteady conditions" << endl; + NonDimTable << "Total Time" << config->GetTotal_UnstTime() << config->GetTime_Ref() << "s" << config->GetTotal_UnstTimeND(); + Unit.str(""); + NonDimTable << "Time Step" << config->GetDelta_UnstTime() << config->GetTime_Ref() << "s" << config->GetDelta_UnstTimeND(); + Unit.str(""); + NonDimTable.PrintFooter(); + } + + + cout << ModelTableOut.str(); + cout << NonDimTableOut.str(); + } +} + +void CPBIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long TimeIter) { + +} + +void CPBIncEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { + + unsigned long ErrorCounter = 0; + + unsigned long InnerIter = config->GetInnerIter(); + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + bool muscl = config->GetMUSCL_Flow(); + bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); + unsigned long iVertex; + unsigned short iVar, iMarker; + + /*--- Set the primitive variables ---*/ + + ErrorCounter = SetPrimitive_Variables(solver_container, config, Output); + + /*--- Compute Primitive gradients to be used in Mass flux computation and pressure residual ---*/ + + if ((iMesh == MESH_0) && !Output) { + + /*--- Gradient computation for MUSCL reconstruction. ---*/ + + if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) + SetPrimitive_Gradient_GG(geometry, config, true); + if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) + SetPrimitive_Gradient_LS(geometry, config, true); + if (config->GetKind_Gradient_Method_Recon() == WEIGHTED_LEAST_SQUARES) + SetPrimitive_Gradient_LS(geometry, config, true); + + /*--- Limiter computation ---*/ + + if ((limiter) && (iMesh == MESH_0) && !Output) { + SetPrimitive_Limiter(geometry, config); + } + + /*--- Compute gradient of the primitive variables for pressure source term ---*/ + + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { + SetPrimitive_Gradient_GG(geometry, config, false); + } + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + SetPrimitive_Gradient_LS(geometry, config, false); + } + } + + /*--- Reset mass flux residual. ---*/ + SetResMassFluxZero(); + + /*--- Reset flag for strong BCs. ---*/ + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) + nodes->ResetStrongBC(iPoint); + + + /*--- Initialize the Jacobian matrices ---*/ + + if (implicit) Jacobian.SetValZero(); + + /*--- Error message ---*/ + + if (config->GetComm_Level() == COMM_FULL) { +#ifdef HAVE_MPI + unsigned long MyErrorCounter = ErrorCounter; ErrorCounter = 0; + SU2_MPI::Allreduce(&MyErrorCounter, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); +#endif + if (iMesh == MESH_0) config->SetNonphysical_Points(ErrorCounter); + } +} + +void CPBIncEulerSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh) { +bool RightSol = true; +unsigned long iPoint, ErrorCounter = 0; + + /*--- Set the current estimate of velocity as a primitive variable, needed for momentum interpolation. + * -- This does not change the pressure, it remains the same as the old value .i.e. previous (pseudo)time step. ---*/ + if (iMesh == MESH_0) ErrorCounter = SetPrimitive_Variables(solver_container, config, true); + + /*--- Compute gradients to be used in Rhie Chow interpolation ---*/ + + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { + SetPrimitive_Gradient_GG(geometry, config); + } + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + SetPrimitive_Gradient_LS(geometry, config); + } +} + +unsigned long CPBIncEulerSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) { + + unsigned long iPoint, nonPhysicalPoints = 0; + unsigned short iVar; + su2double pressure_val; + + bool physical = true; + + for (iPoint = 0; iPoint < nPoint; iPoint ++) { + + /*--- PB Incompressible flow, primitive variables nDim+4, (P, vx, vy, vz, rho, lam_mu, eddy_visc) ---*/ + + physical = nodes->SetPrimVar(iPoint, Density_Inf, config); + + /* Check for non-realizable states for reporting. */ + + if (!physical) nonPhysicalPoints++; + + /*--- Initialize the convective, source and viscous residual vector ---*/ + + if (!Output) LinSysRes.SetBlock_Zero(iPoint); + + } + + return nonPhysicalPoints; +} + + +void CPBIncEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) { + + /*--- Restart the solution from file information ---*/ + unsigned short iDim, iVar, iMesh, iMeshFine; + unsigned long iPoint, index, iChildren, Point_Fine; + unsigned short turb_model = config->GetKind_Turb_Model(); + su2double Area_Children, Area_Parent, Coord[3] = {0.0}, *Solution_Fine; + + bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND)); + bool steady_restart = config->GetSteadyRestart(); + bool time_stepping = config->GetTime_Marching() == TIME_STEPPING; + bool turbulent = (config->GetKind_Solver() == INC_RANS) || (config->GetKind_Solver() == DISC_ADJ_INC_RANS); + + string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", val_iter); + + int counter = 0; + long iPoint_Local = 0; unsigned long iPoint_Global = 0; + unsigned long iPoint_Global_Local = 0; + unsigned short rbuf_NotMatching = 0, sbuf_NotMatching = 0; + + /*--- This variable is only used to skip upto grid velocities. + Pressure + ndim velocities need to be read from the restart file. + Mass flux is also stored in restart file, need to skip it when + reading grid velocities.---*/ + unsigned short nVar_Restart = nVar+2; + + /*--- Skip coordinates ---*/ + + unsigned short skipVars = geometry[MESH_0]->GetnDim(); + + /*--- Store the number of variables for the turbulence model + (that could appear in the restart file before the grid velocities). ---*/ + unsigned short turbVars = 0; + if (turbulent){ + if ((turb_model == SST) || (turb_model == SST_SUST)) turbVars = 2; + else turbVars = 1; + } + + /*--- Read the restart data from either an ASCII or binary SU2 file. ---*/ + + if (config->GetRead_Binary_Restart()) { + Read_SU2_Restart_Binary(geometry[MESH_0], config, restart_filename); + } else { + Read_SU2_Restart_ASCII(geometry[MESH_0], config, restart_filename); + } + + /*--- Load data from the restart into correct containers. ---*/ + + counter = 0; + for (iPoint_Global = 0; iPoint_Global < geometry[MESH_0]->GetGlobal_nPointDomain(); iPoint_Global++ ) { + + /*--- Retrieve local index. If this node from the restart file lives + on the current processor, we will load and instantiate the vars. ---*/ + + iPoint_Local = geometry[MESH_0]->GetGlobal_to_Local_Point(iPoint_Global); + + if (iPoint_Local > -1) { + + /*--- We need to store this point's data, so jump to the correct + offset in the buffer of data from the restart file and load it. + Pressure is not part of the solution vector, so store it in the + primitive variable vector---*/ + + index = counter*Restart_Vars[1] + skipVars; + nodes->SetPressure_val(iPoint_Local, Restart_Data[index]); + for (iVar = 1; iVar <= nVar; iVar++) Solution[iVar-1] = Restart_Data[index+iVar]; + nodes->SetSolution(iPoint_Local, Solution); + iPoint_Global_Local++; + + /*--- Remove mass flux. ---*/ + index++; + + /*--- For dynamic meshes, read in and store the + grid coordinates and grid velocities for each node. ---*/ + + if (dynamic_grid) { + + /*--- First, remove any variables for the turbulence model that + appear in the restart file before the grid velocities. ---*/ + + if (turb_model == SA || turb_model == SA_NEG) { + index++; + } else if ((turb_model == SST) || (turb_model == SST_SUST)) { + index+=2; + } + + /*--- Read in the next 2 or 3 variables which are the grid velocities ---*/ + /*--- If we are restarting the solution from a previously computed static calculation (no grid movement) ---*/ + /*--- the grid velocities are set to 0. This is useful for FSI computations ---*/ + + su2double GridVel[3] = {0.0,0.0,0.0}; + if (!steady_restart) { + + /*--- Rewind the index to retrieve the Coords. ---*/ + index = counter*Restart_Vars[1]; + for (iDim = 0; iDim < nDim; iDim++) { Coord[iDim] = Restart_Data[index+iDim]; } + + /*--- Move the index forward to get the grid velocities. ---*/ + index = counter*Restart_Vars[1] + skipVars + nVar_Restart + turbVars; + for (iDim = 0; iDim < nDim; iDim++) { GridVel[iDim] = Restart_Data[index+iDim]; } + } + + for (iDim = 0; iDim < nDim; iDim++) { + geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]); + geometry[MESH_0]->nodes->SetGridVel(iPoint_Local, iDim, GridVel[iDim]); + } + } + /*--- Increment the overall counter for how many points have been loaded. ---*/ + counter++; + + } + } + + /*--- Detect a wrong solution file ---*/ + + if (iPoint_Global_Local < nPointDomain) { + SU2_MPI::Error(string("The solution file ") + restart_filename + string(" doesn't match with the mesh file!\n") + + string("It could be empty lines at the end of the file."), CURRENT_FUNCTION); + } + + /*--- Update the geometry for flows on deforming meshes ---*/ + + if (dynamic_grid) { + + /*--- Communicate the new coordinates and grid velocities at the halos ---*/ + + geometry[MESH_0]->InitiateComms(geometry[MESH_0], config, COORDINATES); + geometry[MESH_0]->CompleteComms(geometry[MESH_0], config, COORDINATES); + + if (dynamic_grid) { + geometry[MESH_0]->InitiateComms(geometry[MESH_0], config, GRID_VELOCITY); + geometry[MESH_0]->CompleteComms(geometry[MESH_0], config, GRID_VELOCITY); + } + + /*--- Recompute the edges and dual mesh control volumes in the + domain and on the boundaries. ---*/ + + geometry[MESH_0]->SetCoord_CG(); + geometry[MESH_0]->SetControlVolume(config, UPDATE); + geometry[MESH_0]->SetBoundControlVolume(config, UPDATE); + geometry[MESH_0]->SetMaxLength(config); + + /*--- Update the multigrid structure after setting up the finest grid, + including computing the grid velocities on the coarser levels. ---*/ + + for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) { + iMeshFine = iMesh-1; + geometry[iMesh]->SetControlVolume(config, geometry[iMeshFine], UPDATE); + geometry[iMesh]->SetBoundControlVolume(config, geometry[iMeshFine],UPDATE); + geometry[iMesh]->SetCoord(geometry[iMeshFine]); + if (dynamic_grid) { + geometry[iMesh]->SetRestricted_GridVelocity(geometry[iMeshFine], config); + } + geometry[iMesh]->SetMaxLength(config); + } + } + + /*--- Communicate the loaded solution on the fine grid before we transfer + it down to the coarse levels. We alo call the preprocessing routine + on the fine level in order to have all necessary quantities updated, + especially if this is a turbulent simulation (eddy viscosity). ---*/ + + solver[MESH_0][FLOW_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][FLOW_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); + solver[MESH_0][FLOW_SOL]->InitiateComms(geometry[MESH_0], config, PRESSURE_VAR); + solver[MESH_0][FLOW_SOL]->CompleteComms(geometry[MESH_0], config, PRESSURE_VAR); + + /*--- For turbulent simulations the flow preprocessing is done by the turbulence solver + * after it loads its variables (they are needed to compute flow primitives). ---*/ + if (!turbulent) { + solver[MESH_0][FLOW_SOL]->Preprocessing(geometry[MESH_0], solver[MESH_0], config, MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, false); + } + + /*--- Interpolate the solution down to the coarse multigrid levels ---*/ + + for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) { + for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { + Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint); + for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0; + for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) { + Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren); + Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine); + Solution_Fine = solver[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine); + for (iVar = 0; iVar < nVar; iVar++) { + Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; + } + } + solver[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, Solution); + } + + solver[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + solver[MESH_0][FLOW_SOL]->InitiateComms(geometry[iMesh], config, PRESSURE_VAR); + solver[MESH_0][FLOW_SOL]->CompleteComms(geometry[iMesh], config, PRESSURE_VAR); + if (!turbulent) { + solver[iMesh][FLOW_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_FLOW_SYS, false); + } + } + + /*--- Update the old geometry (coordinates n and n-1) in dual time-stepping strategy ---*/ + if (dual_time && config->GetGrid_Movement() && !config->GetDeform_Mesh() && + (config->GetKind_GridMovement() != RIGID_MOTION)) { + Restart_OldGeometry(geometry[MESH_0], config); + } + + /*--- Delete the class memory that is used to load the restart. ---*/ + + delete [] Restart_Vars; Restart_Vars = nullptr; + delete [] Restart_Data; Restart_Data = nullptr; + +} + + + + +void CPBIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, + CConfig *config, unsigned short iMesh, unsigned short iRKStep) { + + CNumerics* numerics = numerics_container[CONV_TERM]; + su2double *V_i, *V_j; + unsigned long iEdge, iPoint, jPoint, counter_local = 0, counter_global = 0; + unsigned short iDim, iVar; + unsigned long InnerIter = config->GetInnerIter(); + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + /*--- Loop over all the edges ---*/ + + for (iEdge = 0; iEdge < nEdge; iEdge++) { + + /*--- Points in edge and normal vectors ---*/ + iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1); + numerics->SetNormal(geometry->edges->GetNormal(iEdge)); + numerics->SetNeighbor(geometry->nodes->GetnNeighbor(iPoint), geometry->nodes->GetnNeighbor(jPoint)); + + /*--- Grid movement ---*/ + if (dynamic_grid) + numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(jPoint)); + + /*--- Get primitive variables ---*/ + V_i = nodes->GetPrimitive(iPoint); V_j = nodes->GetPrimitive(jPoint); + numerics->SetPrimitive(V_i, V_j); + + /*--- Compute residuals, and Jacobians ---*/ + auto residual = numerics->ComputeResidual(config); + + /*--- Update residual value ---*/ + LinSysRes.AddBlock(iPoint, residual); + LinSysRes.SubtractBlock(jPoint, residual); + + + /*--- Set implicit Jacobians ---*/ + if (implicit) + Jacobian.UpdateBlocks(iEdge,iPoint,jPoint,residual.jacobian_i, residual.jacobian_j); + } +} + +void CPBIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, + CConfig *config, unsigned short iMesh) { + + CNumerics* numerics = numerics_container[CONV_TERM]; + + su2double **Gradient_i, **Gradient_j, Project_Grad_i, Project_Grad_j, Normal[3], *GV, + *V_i, *V_j, *S_i, *S_j, *Limiter_i = NULL, *Limiter_j = NULL, Non_Physical = 1.0; + unsigned long iEdge, iPoint, jPoint, counter_local = 0, counter_global = 0; + unsigned short iDim, iVar; + unsigned long InnerIter = config->GetInnerIter(); + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + bool muscl = (config->GetMUSCL_Flow() && (iMesh == MESH_0)); + bool limiter = ((config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter())); + bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; + + /*--- Loop over all the edges ---*/ + + for (iEdge = 0; iEdge < nEdge; iEdge++) { + + /*--- Points in edge and normal vectors ---*/ + + iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1); + numerics->SetNormal(geometry->edges->GetNormal(iEdge)); + + /*--- Grid movement ---*/ + + if (dynamic_grid) + numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(jPoint)); + + /*--- Get primitive variables ---*/ + + V_i = nodes->GetPrimitive(iPoint); V_j = nodes->GetPrimitive(jPoint); + S_i = nodes->GetSecondary(iPoint); S_j = nodes->GetSecondary(jPoint); + + /*--- High order reconstruction using MUSCL strategy ---*/ + + if (muscl) { + + for (iDim = 0; iDim < nDim; iDim++) { + Vector_i[iDim] = 0.5*(geometry->nodes->GetCoord(jPoint, iDim) - geometry->nodes->GetCoord(iPoint, iDim)); + Vector_j[iDim] = 0.5*(geometry->nodes->GetCoord(iPoint, iDim) - geometry->nodes->GetCoord(jPoint, iDim)); + } + + Gradient_i = nodes->GetGradient_Reconstruction(iPoint); + Gradient_j = nodes->GetGradient_Reconstruction(jPoint); + + if (limiter) { + Limiter_i = nodes->GetLimiter_Primitive(iPoint); + Limiter_j = nodes->GetLimiter_Primitive(jPoint); + } + + for (iVar = 0; iVar < nPrimVarGrad; iVar++) { + Project_Grad_i = 0.0; Project_Grad_j = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Project_Grad_i += Vector_i[iDim]*Gradient_i[iVar][iDim]; + Project_Grad_j += Vector_j[iDim]*Gradient_j[iVar][iDim]; + } + if (limiter) { + if (van_albada){ + Limiter_i[iVar] = (V_j[iVar]-V_i[iVar])*(2.0*Project_Grad_i + V_j[iVar]-V_i[iVar])/(4*Project_Grad_i*Project_Grad_i+(V_j[iVar]-V_i[iVar])*(V_j[iVar]-V_i[iVar])+EPS); + Limiter_j[iVar] = (V_j[iVar]-V_i[iVar])*(-2.0*Project_Grad_j + V_j[iVar]-V_i[iVar])/(4*Project_Grad_j*Project_Grad_j+(V_j[iVar]-V_i[iVar])*(V_j[iVar]-V_i[iVar])+EPS); + } + Primitive_i[iVar] = V_i[iVar] + Limiter_i[iVar]*Project_Grad_i; + Primitive_j[iVar] = V_j[iVar] + Limiter_j[iVar]*Project_Grad_j; + } + else { + Primitive_i[iVar] = V_i[iVar] + Project_Grad_i; + Primitive_j[iVar] = V_j[iVar] + Project_Grad_j; + } + } + + for (iVar = nPrimVarGrad; iVar < nPrimVar; iVar++) { + Primitive_i[iVar] = V_i[iVar]; + Primitive_j[iVar] = V_j[iVar]; + } + numerics->SetPrimitive(Primitive_i, Primitive_j); + } else { + /*--- Set conservative variables without reconstruction ---*/ + numerics->SetPrimitive(V_i, V_j); + numerics->SetSecondary(S_i, S_j); + + } + //numerics->SetFaceVel(FaceVelocity[iEdge]); + + auto residual = numerics->ComputeResidual(config); + + /*--- Update residual value ---*/ + LinSysRes.AddBlock(iPoint, residual); + LinSysRes.SubtractBlock(jPoint, residual); + + + /*--- Set implicit Jacobians ---*/ + if (implicit) + Jacobian.UpdateBlocks(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + + } + + /*--- Warning message about non-physical reconstructions. ---*/ + + if (config->GetComm_Level() == COMM_FULL) { +#ifdef HAVE_MPI + SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); +#else + counter_global = counter_local; +#endif + if (iMesh == MESH_0) config->SetNonphysical_Reconstr(counter_global); + } + +} + + + +void CPBIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, + CConfig *config, unsigned short iMesh) { + + CNumerics* numerics = numerics_container[SOURCE_FIRST_TERM]; + + unsigned short iVar,iDim,jVar,jDim; + unsigned long iEdge, iPoint, jPoint; + + const bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + const bool rotating_frame = config->GetRotating_Frame(); + const bool axisymmetric = config->GetAxisymmetric(); + const bool gravity = (config->GetGravityForce() == YES); + const bool body_force = config->GetBody_Force(); + + su2double **Jacobian_Temp, *Residual_Temp; + + /*--- Add pressure contribution. ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Initialize residual to zero. ---*/ + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = 0.0; + + /*--- Assign the pressure gradient to the residual. ---*/ + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = geometry->nodes->GetVolume(iPoint)*nodes->GetGradient_Primitive(iPoint,0,iVar); + + /*--- Add Residual ---*/ + LinSysRes.AddBlock(iPoint, Residual); + } + + /*--- Other source terms for body force, rotation etc ---*/ + if (body_force) { + /*--- Loop over all points ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + /*--- Load the conservative variables ---*/ + numerics->SetConservative(nodes->GetSolution(iPoint), + nodes->GetSolution(iPoint)); + /*--- Set incompressible density ---*/ + numerics->SetDensity(nodes->GetDensity(iPoint), + nodes->GetDensity(iPoint)); + /*--- Load the volume of the dual mesh cell ---*/ + numerics->SetVolume(geometry->nodes->GetVolume(iPoint)); + /*--- Compute the rotating frame source residual ---*/ + auto residual = numerics->ComputeResidual(config); + /*--- Add the source residual to the total ---*/ + LinSysRes.AddBlock(iPoint, residual); + } + } + + if (rotating_frame) { + + /*--- Loop over all points ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Load the primitive variables ---*/ + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), NULL); + + /*--- Set incompressible density ---*/ + numerics->SetDensity(nodes->GetDensity(iPoint), 0.0); + + /*--- Load the volume of the dual mesh cell ---*/ + numerics->SetVolume(geometry->nodes->GetVolume(iPoint)); + + /*--- Compute the rotating frame source residual (CSourceIncRotatingFrame_Flow class) ---*/ + auto residual = numerics->ComputeResidual(config); + + /*--- Add the source residual to the total ---*/ + LinSysRes.AddBlock(iPoint, residual); + + /*--- Add the implicit Jacobian contribution ---*/ + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + + } + } + + if (axisymmetric) { + + } +} + +void CPBIncEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + + su2double *local_Residual, *local_Res_TruncError, Vol, Delta, Res,alfa,Mom_Coeff[3]; + unsigned short iVar, jVar; + unsigned long iPoint; + + for (iVar = 0; iVar < nVar; iVar++) { + SetRes_RMS(iVar, 0.0); + SetRes_Max(iVar, 0.0, 0); + } + alfa = 1.0; + /*--- Update the solution ---*/ + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + Vol = (geometry->nodes->GetVolume(iPoint) + + geometry->nodes->GetPeriodicVolume(iPoint)); + Delta = nodes->GetDelta_Time(iPoint) / Vol; + + local_Res_TruncError = nodes->GetResTruncError(iPoint); + local_Residual = LinSysRes.GetBlock(iPoint); + + /*--- Workaround to deal with nodes that are part of multiple boundaries and where + * one face might be strong BC and another weak BC (mostly for farfield boundary + * where the boundary face is strong or weak depending on local flux. ---*/ + if (nodes->GetStrongBC(iPoint)) { + LinSysRes.SetBlock_Zero(iPoint); + } + + for (iVar = 0; iVar < nVar; iVar ++ ) { + Res = local_Residual[iVar] + local_Res_TruncError[iVar]; + nodes->AddSolution(iPoint, iVar, -alfa*Res*Delta); + AddRes_RMS(iVar, Res*Res); + AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint)); + } + } + SetIterLinSolver(1); + + /*-- Note here that there is an assumption that solution[0] is pressure/density and velocities start from 1 ---*/ + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + } + + /*--- MPI solution ---*/ + + InitiateComms(geometry, config, SOLUTION); + CompleteComms(geometry, config, SOLUTION); + + /*--- Compute the root mean square residual ---*/ + + SetResidual_RMS(geometry, config); + +} + + +void CPBIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + + unsigned short iVar, iDim; + unsigned long iPoint, total_index, IterLinSol = 0; + su2double Delta, *local_Res_TruncError, Vol,Mom_Coeff[3]; + + /*--- Set maximum residual to zero ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + SetRes_RMS(iVar, 0.0); + SetRes_Max(iVar, 0.0, 0); + } + + config->SetLinear_Solver_Iter(config->GetLinear_Solver_Iter_Flow()); + + /*--- Build implicit system ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Workaround to deal with nodes that are part of multiple boundaries and where + * one face might be strong BC and another weak BC (mostly for farfield boundary + * where the boundary face is strong or weak depending on local flux. ---*/ + if (nodes->GetStrongBC(iPoint)) { + for (iVar = 0; iVar < nVar; iVar++) { + total_index = iPoint*nVar+iVar; + Jacobian.DeleteValsRowi(total_index); + } + LinSysRes.SetBlock_Zero(iPoint); + } + + /*--- Read the volume ---*/ + Vol = (geometry->nodes->GetVolume(iPoint) + + geometry->nodes->GetPeriodicVolume(iPoint)); + + if (nodes->GetDelta_Time(iPoint) != 0.0) { + Delta = Vol / nodes->GetDelta_Time(iPoint); + Jacobian.AddVal2Diag(iPoint, Delta); + } else { + Jacobian.SetVal2Diag(iPoint, 1.0); + for (iVar = 0; iVar < nVar; iVar++) { + total_index = iPoint*nVar + iVar; + LinSysRes[total_index] = 0.0; + local_Res_TruncError[iVar] = 0.0; + } + } + + /*--- Read the residual ---*/ + + local_Res_TruncError = nodes->GetResTruncError(iPoint); + /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + total_index = iPoint*nVar + iVar; + LinSysRes[total_index] = - (LinSysRes[total_index] + local_Res_TruncError[iVar]); + LinSysSol[total_index] = 0.0; + AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]); + AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint)); + } + } + + /*--- Initialize residual and solution at the ghost points ---*/ + + for (iPoint = nPointDomain; iPoint < nPoint; iPoint++) { + for (iVar = 0; iVar < nVar; iVar++) { + total_index = iPoint*nVar + iVar; + LinSysRes[total_index] = 0.0; + LinSysSol[total_index] = 0.0; + } + } + + /*--- Solve or smooth the linear system ---*/ + IterLinSol = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + + /*--- Store the value of the residual. ---*/ + SetResLinSolver(System.GetResidual()); + + /*--- The the number of iterations of the linear solver ---*/ + SetIterLinSolver(IterLinSol); + + /*--- Update solution (system written in terms of increments) ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (iVar = 0; iVar < nVar; iVar++) { + nodes->AddSolution(iPoint, iVar, config->GetRelaxation_Factor_PBFlow()*LinSysSol[iPoint*nVar+iVar]); + } + } + + /*-- Note here that there is an assumption that solution[0] is pressure/density and velocities start from 1 ---*/ + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + } + + /*--- MPI solution ---*/ + InitiateComms(geometry, config, SOLUTION); + CompleteComms(geometry, config, SOLUTION); + + /*--- Compute the root mean square residual ---*/ + SetResidual_RMS(geometry, config); + +} + +void CPBIncEulerSolver::SetMomCoeff(CGeometry *geometry, CSolver **solver_container, CConfig *config, bool periodic, unsigned short iMesh) { + + unsigned short iVar, jVar, iDim, jDim; + unsigned long iPoint, jPoint, iNeigh; + su2double Mom_Coeff[MAXNDIM], Mom_Coeff_nb[MAXNDIM], Vol, delT; + bool simplec = (config->GetKind_PBIter() == SIMPLEC); + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + if (!periodic) { + + if (implicit) { + /* First sum up the momentum coefficient using the jacobian from given point and it's neighbors. ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Self contribution. ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + Mom_Coeff[iVar] = Jacobian.GetBlock(iPoint,iPoint,iVar,iVar); + } + + /*--- Contribution from neighbors. ---*/ + nodes->Set_Mom_Coeff_nbZero(iPoint); + + if (simplec) { + for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) { + jPoint = geometry->nodes->GetPoint(iPoint,iNeigh); + for (iVar = 0; iVar < nVar; iVar++) { + nodes->Add_Mom_Coeff_nb(iPoint, Jacobian.GetBlock(iPoint,jPoint,iVar,iVar),iVar); + } + } + } + + Vol = geometry->nodes->GetVolume(iPoint); delT = nodes->GetDelta_Time(iPoint); + + for (iVar = 0; iVar < nVar; iVar++) { + Mom_Coeff[iVar] = Mom_Coeff[iVar] - nodes->Get_Mom_Coeff_nb(iPoint, iVar) - config->GetRCFactor()*(Vol/delT); + //Mom_Coeff[iVar] = nodes->GetDensity(iPoint)*Vol/Mom_Coeff[iVar]; + Mom_Coeff[iVar] = Vol/Mom_Coeff[iVar]; + } + + nodes->Set_Mom_Coeff(iPoint, Mom_Coeff); + } + } + else { + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + Vol = geometry->nodes->GetVolume(iPoint); delT = nodes->GetDelta_Time(iPoint); + + for(iVar = 0; iVar < nVar; iVar++) + Mom_Coeff[iVar] = delT/Vol; + + nodes->Set_Mom_Coeff(iPoint, Mom_Coeff); + } + } + /*--- Insert MPI call here. ---*/ + InitiateComms(geometry, config, MOM_COEFF); + CompleteComms(geometry, config, MOM_COEFF); + } + +} + + +void CPBIncEulerSolver::SetMomCoeffPer(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + + unsigned short iVar, jVar, iDim, jDim; + unsigned long iPoint, jPoint, iNeigh; + su2double Mom_Coeff[MAXNDIM], Mom_Coeff_nb[MAXNDIM], Vol, delT; + bool simplec = (config->GetKind_PBIter() == SIMPLEC); + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Self contribution. ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + Mom_Coeff[iVar] = Jacobian.GetBlock(iPoint,iPoint,iVar,iVar); + } + + /*--- Contribution from neighbors. ---*/ + nodes->Set_Mom_Coeff_nbZero(iPoint); + if (simplec) { + for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) { + jPoint = geometry->nodes->GetPoint(iPoint,iNeigh); + for (iVar = 0; iVar < nVar; iVar++) { + nodes->Add_Mom_Coeff_nb(iPoint, Jacobian.GetBlock(iPoint,jPoint,iVar,iVar),iVar); + } + } + } + + Vol = geometry->nodes->GetVolume(iPoint); delT = nodes->GetDelta_Time(iPoint); + + for (iVar = 0; iVar < nVar; iVar++) { + Mom_Coeff[iVar] = Mom_Coeff[iVar] + (1.0 - config->GetRCFactor())*(Vol/delT) - nodes->Get_Mom_Coeff_nb(iPoint, iVar); + //Mom_Coeff[iVar] = nodes->GetDensity(iPoint)*Vol/Mom_Coeff[iVar]; + Mom_Coeff[iVar] = Vol/Mom_Coeff[iVar]; + } + nodes->Set_Mom_Coeff(iPoint, Mom_Coeff); + } + + /*--- Insert MPI call here. ---*/ + InitiateComms(geometry, config, MOM_COEFF); + CompleteComms(geometry, config, MOM_COEFF); + +} + +void CPBIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh, unsigned long Iteration) { + + su2double *Normal, Area, Vol, Length, Mean_ProjVel = 0.0, Mean_Vel, Mean_Density, + Mean_BetaInc2 = 4.1, Lambda, Local_Delta_Time, Mean_DensityInc, GradVel, Lambda1, + Global_Delta_Time = 1E6, Global_Delta_UnstTimeND, ProjVel, RefProjFlux, MinRefProjFlux, ProjVel_i, ProjVel_j; + + unsigned long iEdge, iVertex, iPoint, jPoint; + unsigned short iDim, iMarker, iVar; + + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + bool time_steping = config->GetTime_Marching() == TIME_STEPPING; + bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND)); + + Min_Delta_Time = 1.E6; Max_Delta_Time = 0.0; MinRefProjFlux = 0.0; + Normal = new su2double[nDim]; + + /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) + nodes->SetMax_Lambda_Inv(iPoint, 0.0); + + /*--- Loop interior edges ---*/ + + for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + + /*--- Point identification, Normal vector and area ---*/ + + iPoint = geometry->edges->GetNode(iEdge,0); + jPoint = geometry->edges->GetNode(iEdge,1); + + geometry->edges->GetNormal(iEdge, Normal); + + + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + /*--- Compute flux across the cell ---*/ + + Mean_Density = 0.5*(nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); + Mean_ProjVel = 0.0; + for (iVar = 0; iVar < nVar; iVar++) { + Mean_Vel = 0.5*(nodes->GetVelocity(iPoint, iVar) + nodes->GetVelocity(jPoint, iVar)); + Mean_ProjVel += (Mean_Vel*Normal[iVar]); + } + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint); + su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint); + ProjVel_i = 0.0; ProjVel_j = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + ProjVel_i += GridVel_i[iDim]*Normal[iDim]; + ProjVel_j += GridVel_j[iDim]*Normal[iDim]; + } + Mean_ProjVel -= 0.5 * (ProjVel_i + ProjVel_j); + } + + RefProjFlux = fabs(config->GetInc_Velocity_Ref()*Area); + MinRefProjFlux = max(RefProjFlux, MinRefProjFlux); + + Lambda = fabs(Mean_ProjVel) + RefProjFlux; + + /*--- Inviscid contribution ---*/ + + if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint, Lambda+EPS); + if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Inv(jPoint, Lambda+EPS); + + } + + /*--- Loop boundary edges ---*/ + + for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + + /*--- Point identification, Normal vector and area ---*/ + + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + /*--- Compute flux across the cell ---*/ + Mean_Density = nodes->GetDensity(iPoint); + Mean_ProjVel = 0.0; + for (iVar = 0; iVar < nVar; iVar++) { + Mean_Vel = nodes->GetVelocity(iPoint, iVar); + Mean_ProjVel += Mean_Vel*Normal[iVar]; + } + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + su2double *GridVel = geometry->nodes->GetGridVel(iPoint); + ProjVel = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + ProjVel += GridVel[iDim]*Normal[iDim]; + Mean_ProjVel -= ProjVel; + } + + RefProjFlux = fabs(config->GetInc_Velocity_Ref()*Area); + MinRefProjFlux = max(RefProjFlux, MinRefProjFlux); + + Lambda = fabs(Mean_ProjVel) + RefProjFlux; + + if (geometry->nodes->GetDomain(iPoint)) { + nodes->AddMax_Lambda_Inv(iPoint, Lambda+EPS); + } + } + } + } + + /*--- Local time-stepping: each element uses their own speed for steady state + simulations or for pseudo time steps in a dual time simulation. ---*/ + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + Vol = geometry->nodes->GetVolume(iPoint); + + if (Vol != 0.0) { + Local_Delta_Time = config->GetCFL(iMesh)*Vol/nodes->GetMax_Lambda_Inv(iPoint); + if (!implicit) Local_Delta_Time = 0.5*config->GetCFL(iMesh)*Vol/nodes->GetMax_Lambda_Inv(iPoint); + Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time); + Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time); + Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time); + if (Local_Delta_Time > config->GetMax_DeltaTime()) + Local_Delta_Time = config->GetMax_DeltaTime(); + nodes->SetDelta_Time(iPoint, Local_Delta_Time); + } + else { + nodes->SetDelta_Time(iPoint, 0.0); + } + } + + /*--- Compute the max and the min dt (in parallel) ---*/ + + if (config->GetComm_Level() == COMM_FULL) { +#ifdef HAVE_MPI + su2double rbuf_time, sbuf_time; + sbuf_time = Min_Delta_Time; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Min_Delta_Time = rbuf_time; + + sbuf_time = Max_Delta_Time; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Max_Delta_Time = rbuf_time; +#endif + } + + /*--- For time-accurate simulations use the minimum delta time of the whole mesh (global) ---*/ + + if (time_steping) { +#ifdef HAVE_MPI + su2double rbuf_time, sbuf_time; + sbuf_time = Global_Delta_Time; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Global_Delta_Time = rbuf_time; +#endif + for (iPoint = 0; iPoint < nPointDomain; iPoint++){ + + /*--- Sets the regular CFL equal to the unsteady CFL ---*/ + + config->SetCFL(iMesh,config->GetUnst_CFL()); + + /*--- If the unsteady CFL is set to zero, it uses the defined unsteady time step, otherwise + it computes the time step based on the unsteady CFL ---*/ + + if (config->GetCFL(iMesh) == 0.0){ + nodes->SetDelta_Time(iPoint, config->GetDelta_UnstTime()); + } else { + nodes->SetDelta_Time(iPoint, Global_Delta_Time); + } + } + } + + /*--- Recompute the unsteady time step for the dual time strategy + if the unsteady CFL is diferent from 0 ---*/ + + if ((dual_time) && (Iteration == 0) && (config->GetUnst_CFL() != 0.0) && (iMesh == MESH_0)) { + Global_Delta_UnstTimeND = config->GetUnst_CFL()*Global_Delta_Time/config->GetCFL(iMesh); + +#ifdef HAVE_MPI + su2double rbuf_time, sbuf_time; + sbuf_time = Global_Delta_UnstTimeND; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Global_Delta_UnstTimeND = rbuf_time; +#endif + config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND); + } + + /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/ + + if (dual_time) + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + if (!implicit) { + Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint, Local_Delta_Time); + } + } + +} + +void CPBIncEulerSolver::SetPoissonSourceTerm(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) { + + + unsigned short iVar, jVar, iDim, jDim, KindBC; + unsigned long iPoint, jPoint, iEdge, iMarker, iVertex, iNeigh, n_inlet; + su2double Edge_Vector[MAXNDIM], dist_ij_2; + su2double *Coord_i, *Coord_j; + su2double MassFlux_Part, MassFlux_Avg, Mom_Coeff[MAXNDIM], *Normal,Vel_Avg, Grad_Avg; + su2double Area, MeanDensity, Vol , TimeStep; + su2double GradP_f[MAXNDIM], GradP_in[MAXNDIM], GradP_proj, RhieChowInterp, Coeff_Mom, PsCorr[MAXNDIM], PsCorrFace; + su2double *Flow_Dir, Flow_Dir_Mag, Vel_Mag, Adj_Mass,*GridVel_i,*GridVel_j; + su2double Net_Mass, alfa, Mass_In, Mass_Out, Mass_Free_In, Mass_Free_Out, Mass_Corr, Area_out; + string Marker_Tag; + su2double ProjGridVelFlux, *MeshVel_i, *MeshVel_j; + unsigned short Kind_Outlet; + Normal = new su2double [nDim]; + bool unsteady = (config->GetTime_Marching() != NO); + + /*--- Initialize mass flux to zero ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) + nodes->SetMassFluxZero(iPoint); + + Net_Mass = 0.0; + + for (iEdge = 0; iEdge < nEdge; iEdge++) { + + iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1); + geometry->edges->GetNormal(iEdge, Normal); + + Area = GeometryToolbox::Norm(nDim, Normal); + + MeanDensity = 0.5*(nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); + + if (dynamic_grid) { + GridVel_i = geometry->nodes->GetGridVel(iPoint); + GridVel_j = geometry->nodes->GetGridVel(jPoint); + } + + /*--- Face average mass flux. ---*/ + MassFlux_Avg = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Vel_Avg = 0.5*(nodes->GetVelocity(iPoint,iDim) + nodes->GetVelocity(jPoint,iDim)); + MassFlux_Avg += MeanDensity*Vel_Avg*Normal[iDim]; + } + + if (dynamic_grid) + for (iDim = 0; iDim < nDim; iDim++) { + Vel_Avg = 0.5*(GridVel_i[iDim]+GridVel_j[iDim]); + MassFlux_Avg -= MeanDensity*Vel_Avg*Normal[iDim]; + } + + /*--- Rhie Chow interpolation ---*/ + Coord_i = geometry->nodes->GetCoord(iPoint); + Coord_j = geometry->nodes->GetCoord(jPoint); + dist_ij_2 = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim]; + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + } + /*--- 1. Interpolate the pressure gradient based on node values ---*/ + for (iDim = 0; iDim < nDim; iDim++) { + Grad_Avg = 0.5*(nodes->GetGradient_Primitive(iPoint,0,iDim) + nodes->GetGradient_Primitive(jPoint,0,iDim)); + GradP_in[iDim] = Grad_Avg; + } + + /*--- 2. Compute pressure gradient at the face ---* + Eq 15.62 F Moukalled, L Mangani M. Darwish OpenFOAM and uFVM book. ---*/ + GradP_proj = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + GradP_proj += GradP_in[iDim]*Edge_Vector[iDim]; + } + if (dist_ij_2 != 0.0) { + for (iDim = 0; iDim < nDim; iDim++) { + GradP_f[iDim] = GradP_in[iDim] - (GradP_proj - (nodes->GetPressure(jPoint) - nodes->GetPressure(iPoint)))*Edge_Vector[iDim]/ dist_ij_2; + } + } + + /*--- Correct the massflux by adding the pressure terms. + * --- GradP_f is the gradient computed directly at the face and GradP_in is the + * --- gradient linearly interpolated based on node values. This effectively adds a third + * --- order derivative of pressure to remove odd-even decoupling of pressure and velocities. + * --- GradP_f = (p_F^n - p_P^n)/ds , GradP_in = 0.5*(GradP_P^n + GradP_F^n)---*/ + RhieChowInterp = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + /*--- Linearly interpolated coefficient. ---*/ + Coeff_Mom = 0.5*(nodes->Get_Mom_Coeff(iPoint,iDim) + nodes->Get_Mom_Coeff(jPoint,iDim)); + /*--- Difference of pressure gradients. ---*/ + RhieChowInterp += Coeff_Mom*(GradP_f[iDim] - GradP_in[iDim])*Normal[iDim]*MeanDensity; + /*--- Save the pressure gradient contribution for the correction term used in the next iteration. ---*/ + PsCorr[iDim] = -Coeff_Mom*(GradP_f[iDim] - GradP_in[iDim]); + } + + /*--- Rhie Chow correction for time step must go here ---*/ + su2double beta = 0.0, beta_n = 0.0, beta_n1 = 0.0; + su2double den_i,den_j,num_i,num_n_i,num_n1_i,num_j,num_n1_j,num_n_j; + if (unsteady) { + TimeStep = config->GetDelta_UnstTimeND(); + + Vol = 0.5*(geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetVolume(jPoint)); + + for (iDim = 0; iDim < nDim; iDim++) { + den_i = geometry->nodes->GetVolume(iPoint)/nodes->Get_Mom_Coeff(iPoint,iDim); + den_j = geometry->nodes->GetVolume(jPoint)/nodes->Get_Mom_Coeff(jPoint,iDim); + Coeff_Mom = 0.5*(nodes->Get_Mom_Coeff(iPoint,iDim) + nodes->Get_Mom_Coeff(jPoint,iDim)); + } + PsCorrFace = 0.0; + if (config->GetTime_Marching() == DT_STEPPING_1ST) { + for (iDim = 0; iDim < nDim; iDim++) { + // Coefficient of correction for pseudo time iteration + num_i = den_i - geometry->nodes->GetVolume(iPoint)/TimeStep; + num_j = den_j - geometry->nodes->GetVolume(jPoint)/TimeStep; + beta = 0.5*(num_i/den_i + num_j/den_j); + // Coefficient of correction for unsteady time level n + num_n_i = -geometry->nodes->GetVolume(iPoint)/TimeStep; + num_n_j = -geometry->nodes->GetVolume(jPoint)/TimeStep; + beta_n = -0.5*(num_n_i/den_i + num_n_j/den_j); + + PsCorrFace += (beta*PseudoTimeCorr[iEdge][iDim] + beta_n*TimeMarchingCorr_n[iEdge][iDim])*Normal[iDim]*MeanDensity; + } + } + if (config->GetTime_Marching() == DT_STEPPING_2ND) { + for (iDim = 0; iDim < nDim; iDim++) { + // Coefficient of correction for pseudo time iteration + num_i = den_i - 3.0*geometry->nodes->GetVolume(iPoint)/(2.0*TimeStep); + num_j = den_j - 3.0*geometry->nodes->GetVolume(jPoint)/(2.0*TimeStep); + beta = 0.5*(num_i/den_i + num_j/den_j); + // Coefficient of correction for unsteady time level n + num_n_i = -4.0*geometry->nodes->GetVolume(iPoint)/(2.0*TimeStep); + num_n_j = -4.0*geometry->nodes->GetVolume(jPoint)/(2.0*TimeStep); + beta_n = -0.5*(num_n_i/den_i + num_n_j/den_j); + // Coefficient of correction for unsteady time level n-1 + num_n1_i = geometry->nodes->GetVolume(iPoint)/(2.0*TimeStep); + num_n1_j = geometry->nodes->GetVolume(jPoint)/(2.0*TimeStep); + beta_n1 = 0.5*(num_n1_i/den_i + num_n1_j/den_j); + + PsCorrFace += (beta*PseudoTimeCorr[iEdge][iDim] + beta_n*TimeMarchingCorr_n[iEdge][iDim] + beta_n1*TimeMarchingCorr_n1[iEdge][iDim])*Normal[iDim]*MeanDensity; + } + } + } + else { + beta = 1.0; PsCorrFace = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + PsCorrFace += PseudoTimeCorr[iEdge][iDim]*Normal[iDim]*MeanDensity; + PsCorrFace = beta*PsCorrFace; + } + + /*--- Calculate the mass flux at the face including the linearly interpolated velocities, pressure + * gradient difference contribution and correction for time stepping (both pseudo and dual time). ---*/ + MassFlux_Part = MassFlux_Avg - RhieChowInterp + PsCorrFace; + + + /*--- Update correction of face velocity for the next iteration. ---*/ + for (iDim = 0; iDim < nDim; iDim++) + PseudoTimeCorr[iEdge][iDim] = PsCorr[iDim] ;//+ PseudoTimeCorr[iEdge][iDim]; + + if (geometry->nodes->GetDomain(iPoint)) nodes->AddMassFlux(iPoint,MassFlux_Part); + if (geometry->nodes->GetDomain(jPoint)) nodes->SubtractMassFlux(jPoint,MassFlux_Part); + } + + /*--- Mass flux correction for outflow ---*/ + Mass_In = 0.0; Mass_Out = 0.0; Mass_Free_In = 0.0; Mass_Free_Out = 0.0; + Area_out = 0.0; Adj_Mass = 0.0; n_inlet = 0; + /*--- Loop boundary edges ---*/ + for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { + KindBC = config->GetMarker_All_KindBC(iMarker); + Marker_Tag = config->GetMarker_All_TagBound(iMarker); + + switch (KindBC) { + /*--- Wall boundaries have zero mass flux (irrespective of grid movement) ---*/ + case EULER_WALL: case ISOTHERMAL: case HEAT_FLUX: case SYMMETRY_PLANE: + break; + + case INLET_FLOW: + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (geometry->nodes->GetDomain(iPoint)) { + + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + + if (dynamic_grid) + GridVel_i = geometry->nodes->GetGridVel(iPoint); + + MassFlux_Part = 0.0; + if (dynamic_grid) + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= nodes->GetDensity(iPoint)*(nodes->GetVelocity(iPoint, iDim)-GridVel_i[iDim])*Normal[iDim]; + else + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= nodes->GetDensity(iPoint)*(nodes->GetVelocity(iPoint, iDim))*Normal[iDim]; + + if (geometry->nodes->GetDomain(iPoint)) + nodes->AddMassFlux(iPoint, MassFlux_Part); + + /*--- Sum up the mass flux entering to be used for mass flow correction at outflow ---*/ + Mass_In += fabs(MassFlux_Part); + } + } + break; + + case FAR_FIELD: + /*--- Treat the farfield as a fully developed outlet for pressure. I still compute the mass fluxes + * to use when dealing with truncated open boundaries (not implemented yet). ---*/ + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (geometry->nodes->GetDomain(iPoint)) { + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + + if (dynamic_grid) + GridVel_i = geometry->nodes->GetGridVel(iPoint); + + MassFlux_Part = 0.0; + if (dynamic_grid) + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= nodes->GetDensity(iPoint)*(nodes->GetVelocity(iPoint, iDim)-GridVel_i[iDim])*Normal[iDim]; + else + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= nodes->GetDensity(iPoint)*(nodes->GetVelocity(iPoint, iDim))*Normal[iDim]; + + if ((MassFlux_Part < 0.0) && (fabs(MassFlux_Part) > EPS)) { + Mass_Free_In += fabs(MassFlux_Part); + nodes->AddMassFlux(iPoint, MassFlux_Part); + } + else { + Mass_Free_Out += fabs(MassFlux_Part); + nodes->AddMassFlux(iPoint, MassFlux_Part); + } + + nodes->SetMassFluxZero(iPoint); + } + } + break; + + case OUTLET_FLOW: + /*--- Note I am assuming a fully developed outlet, thus the pressure value is prescribed + * -- and a dirichlet bc has to be applied along outlet faces. The Massflux, which forms the RHS + * -- of the equation, is set to zero to enforce the dirichlet bc. ---*/ + + Kind_Outlet = config->GetKind_Inc_Outlet(Marker_Tag); + + switch (Kind_Outlet) { + case PRESSURE_OUTLET: + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (geometry->nodes->GetDomain(iPoint)) { + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + + if (dynamic_grid) + GridVel_i = geometry->nodes->GetGridVel(iPoint); + + MassFlux_Part = 0.0; + if (dynamic_grid) + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= nodes->GetDensity(iPoint)*(nodes->GetVelocity(iPoint, iDim)-GridVel_i[iDim])*Normal[iDim]; + else + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= nodes->GetDensity(iPoint)*(nodes->GetVelocity(iPoint, iDim))*Normal[iDim]; + + /*--- Sum up the mass flux leaving to be used for mass flow correction at outflow ---*/ + Mass_Out += fabs(MassFlux_Part); + + nodes->AddMassFlux(iPoint, MassFlux_Part); + } + } + break; + // Not working properly - Also removed the mass flux correction outside the loop which was summing up mass in and out + case OPEN: + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (geometry->nodes->GetDomain(iPoint)) { + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + + MassFlux_Part = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= nodes->GetDensity(iPoint)*nodes->GetVelocity(iPoint,iDim)*Normal[iDim]; + + /*--- Sum up the mass flux leaving to be used for mass flow correction at outflow ---*/ + if (MassFlux_Part > 0.0) + Mass_Free_Out += fabs(MassFlux_Part); + else + Mass_Free_In += fabs(MassFlux_Part); + } + } + break; + } + break; + + default: + break; + } + } + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + AddResMassFlux(nodes->GetMassFlux(iPoint)*nodes->GetMassFlux(iPoint)); + //cout<GetMassFlux(iPoint)<GetnPoint()); + +#else + + int nProcessor = size, iProcessor; + + su2double sbuf_residual, rbuf_residual; + unsigned long Global_nPointDomain; + unsigned short iDim; + + /*--- Set the L2 Norm residual in all the processors ---*/ + + sbuf_residual = 0.0; + rbuf_residual = 0.0; + + sbuf_residual = GetResMassFlux(); + + if (config->GetComm_Level() == COMM_FULL) { + + unsigned long Local_nPointDomain = geometry->GetnPointDomain(); + SU2_MPI::Allreduce(&sbuf_residual, &rbuf_residual, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&Local_nPointDomain, &Global_nPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + + } else { + + /*--- Reduced MPI comms have been requested. Use a local residual only. ---*/ + + rbuf_residual = sbuf_residual; + Global_nPointDomain = geometry->GetnPointDomain(); + + } + + + if (rbuf_residual != rbuf_residual) { + SU2_MPI::Error("SU2 has diverged. (NaN detected)", CURRENT_FUNCTION); + } + + SetResMassFlux(max(EPS*EPS, sqrt(rbuf_residual/Global_nPointDomain))); +#endif + +} + + +void CPBIncEulerSolver:: Flow_Correction(CGeometry *geometry, CSolver **solver_container, CConfig *config){ + + unsigned long iEdge, iPoint, jPoint, iMarker, iVertex; + unsigned short iDim, iVar, KindBC, Kind_Outlet; + su2double Vel, Current_Pressure, factor, PCorr_Ref, Vol, delT, Density; + string Marker_Tag; + su2activevector Pressure_Correc, alpha_p; + su2activematrix vel_corr; + long Pref_local; + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + /*--- Allocate corrections and relaxation ---*/ + Pressure_Correc.resize(nPointDomain); + vel_corr.resize(nPointDomain,nVar); + alpha_p.resize(nPointDomain); + + /*--- Pressure Corrections ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) + Pressure_Correc[iPoint] = solver_container[POISSON_SOL]->GetNodes()->GetSolution(iPoint,0); + + Pref_local = geometry->GetGlobal_to_Local_Point(PRef_Point); + PCorr_Ref = 0.0; + /*if (Pref_local >= 0) + if(geometry->nodes->GetDomain(Pref_local)) + PCorr_Ref = 0.0;//Pressure_Correc[Pref_local];*/ + + /*--- Velocity Corrections. ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + factor = 0.0; + Vol = geometry->nodes->GetVolume(iPoint); + delT = nodes->GetDelta_Time(iPoint); + for (iVar = 0; iVar < nVar; iVar++) { + vel_corr[iPoint][iVar] = nodes->Get_Mom_Coeff(iPoint,iVar)*(solver_container[POISSON_SOL]->GetNodes()->GetGradient(iPoint,0,iVar)); + if (implicit) factor += Jacobian.GetBlock(iPoint, iPoint, iVar, iVar); + } + if (implicit) + alpha_p[iPoint] = config->GetRelaxation_Factor_PBFlow()*(Vol/delT) / (factor+(Vol/delT)); + else + alpha_p[iPoint] = config->GetRelaxation_Factor_PBFlow(); + } + + /*--- Reassign strong boundary conditions ---*/ + /*--- For now I only have velocity inlet and fully developed outlet. Will need to add other types of inlet/outlet conditions + * where different treatment of pressure might be needed. Symmetry and Euler wall are weak BCs. ---*/ + for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { + KindBC = config->GetMarker_All_KindBC(iMarker); + Marker_Tag = config->GetMarker_All_TagBound(iMarker); + switch (KindBC) { + /*--- Only a fully developed outlet is implemented. For pressure, a dirichlet + BC has to be applied and no correction is necessary. Velocity has a neumann BC. ---*/ + case OUTLET_FLOW: + Kind_Outlet = config->GetKind_Inc_Outlet(Marker_Tag); + switch (Kind_Outlet) { + case PRESSURE_OUTLET: + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + if (geometry->nodes->GetDomain(iPoint)) + Pressure_Correc[iPoint] = PCorr_Ref; + } + break; + // Not working yet + case OPEN: + + break; + } + break; + + /*--- Only a fixed velocity inlet is implemented now. Along with the wall boundaries, + * the velocity is known and thus no correction is necessary.---*/ + case ISOTHERMAL: case HEAT_FLUX: case INLET_FLOW: + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + if (geometry->nodes->GetDomain(iPoint)) { + for (iDim = 0; iDim < nDim; iDim++) + vel_corr[iPoint][iDim] = 0.0; + alpha_p[iPoint] = 1.0; + } + } + break; + + /*--- Farfield is treated as a fully developed flow for pressure and a fixed pressure is + * used, thus no correction is necessary. The treatment for velocity depends on whether the + * flow is into the domain or out. If flow is in, a dirichlet bc is applied and no correction + * is made, otherwise a Neumann BC is used and velocity is adjusted. The fixed value of velocity + * is the one from the previous iteration. ---*/ + + case FAR_FIELD: + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + if (geometry->nodes->GetDomain(iPoint)) { + // Check if inlet or not + if (nodes->GetStrongBC(iPoint)) { + for (iDim = 0; iDim < nDim; iDim++) + vel_corr[iPoint][iDim] = 0.0; + } + Pressure_Correc[iPoint] = PCorr_Ref; + } + } + break; + default: + break; + } + } + + /*--- Velocity corrections ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (iVar = 0; iVar < nVar; iVar++) { + Vel = nodes->GetVelocity(iPoint,iVar); + Vel = Vel - vel_corr[iPoint][iVar]; + Density = nodes->GetDensity(iPoint); + nodes->SetSolution(iPoint,iVar,Density*Vel); + } + nodes->SetVelocity(iPoint); + /*--- Pressure corrections ---*/ + Current_Pressure = nodes->GetPressure(iPoint); + Current_Pressure += alpha_p[iPoint]*(Pressure_Correc[iPoint] - PCorr_Ref); + nodes->SetPressure_val(iPoint,Current_Pressure); + } + + /*--- Correct face velocity. ---*/ + /*su2double Area, Vel_Mag,rho, GradP_in[MAXNDIM],GradP_f[MAXNDIM], GradP_proj; + su2double *Coord_i, *Coord_j, dist_ij, delP, Pressure_j, Pressure_i; + su2double Edge_Vector[MAXNDIM], dist_ij_2, proj_vector_ij; + for (iEdge = 0; iEdge < nEdge; iEdge++) { + + iPoint = geometry->edges->GetNode(iEdge,0); jPoint = geometry->edges->GetNode(iEdge,1); + geometry->edges->GetNormal(iEdge, Normal); + dist_ij_2 = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Edge_Vector[iDim] = (geometry->nodes->GetCoord(jPoint, iDim) - + geometry->nodes->GetCoord(iPoint, iDim)); + dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim]; + } + + for (iDim = 0; iDim < nDim; iDim++) + GradP_in[iDim] = ( solver_container[POISSON_SOL]->GetNodes()->GetGradient(iPoint,0,iDim) + + solver_container[POISSON_SOL]->GetNodes()->GetGradient(jPoint,0,iDim) ); + + GradP_proj = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + GradP_proj += GradP_in[iDim]*Edge_Vector[iDim]; + } + if (dist_ij_2 != 0.0) { + for (iDim = 0; iDim < nDim; iDim++) { + GradP_f[iDim] = GradP_in[iDim] - (GradP_proj - (Pressure_Correc[jPoint] - Pressure_Correc[iPoint]))*Edge_Vector[iDim]/ dist_ij_2; + } + } + + for (iDim =0; iDim < nDim; iDim++) { + Coeff_Mom = 0.5*(nodes->Get_Mom_Coeff(iPoint,iDim) + nodes->Get_Mom_Coeff(jPoint,iDim)); + FaceVelocity[iEdge][iDim] = FaceVelocity[iEdge][iDim] - Coeff_Mom*(GradP_f[iDim]); + } + }*/ + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_PRESSURE); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_PRESSURE); + } + + /*--- Communicate updated velocities and pressure ---*/ + InitiateComms(geometry, config, SOLUTION); + CompleteComms(geometry, config, SOLUTION); + + InitiateComms(geometry, config, PRESSURE_VAR); + CompleteComms(geometry, config, PRESSURE_VAR); + + /*--- Reset pressure corrections to zero for next iteration. ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + solver_container[POISSON_SOL]->GetNodes()->SetSolution(iPoint,0,0.0); + } + + /*--- Communicate updated Poisson solution ---*/ + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + solver_container[POISSON_SOL]->InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + solver_container[POISSON_SOL]->CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + } + + solver_container[POISSON_SOL]->InitiateComms(geometry, config, SOLUTION); + solver_container[POISSON_SOL]->CompleteComms(geometry, config, SOLUTION); + +} + + +void CPBIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iRKStep, unsigned short iMesh, unsigned short RunTime_EqSystem) { + + /*--- Local variables ---*/ + + unsigned short iVar, jVar, iMarker, iDim; + unsigned long iPoint, jPoint, iEdge, iVertex; + + su2double Density, Cp; + su2double *U_time_nM1, *U_time_n, *U_time_nP1; + su2double Volume_nM1, Volume_nP1, TimeStep; + su2double *GridVel_i = nullptr, *GridVel_j = nullptr, Residual_GCL; + const su2double* Normal; + + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + /*--- Store the physical time step ---*/ + + TimeStep = config->GetDelta_UnstTimeND(); + + /*--- Compute the dual time-stepping source term for static meshes ---*/ + + if (!dynamic_grid) { + + /*--- Loop over all nodes (excluding halos) ---*/ + + for (iPoint = 0; iPoint < nPoint; iPoint++) { + + /*--- Initialize the Residual / Jacobian container to zero. ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + Residual[iVar] = 0.0; + if (implicit) { + for (jVar = 0; jVar < nVar; jVar++) + Jacobian_i[iVar][jVar] = 0.0; + } + } + + /*--- Retrieve the solution at time levels n-1, n, and n+1. Note that + we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, + previous solutions that are stored in memory. ---*/ + + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); + + /*--- CV volume at time n+1. As we are on a static mesh, the volume + of the CV will remained fixed for all time steps. ---*/ + + Volume_nP1 = geometry->nodes->GetVolume(iPoint); + + /*--- Compute the dual time-stepping source term based on the chosen + time discretization scheme (1st- or 2nd-order). ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + if (config->GetTime_Marching() == DT_STEPPING_1ST) + Residual[iVar] = (U_time_nP1[iVar] - U_time_n[iVar])*Volume_nP1 / TimeStep; + if (config->GetTime_Marching() == DT_STEPPING_2ND) + Residual[iVar] = ( 3.0*U_time_nP1[iVar] - 4.0*U_time_n[iVar] + +1.0*U_time_nM1[iVar])*Volume_nP1 / (2.0*TimeStep); + } + + /*--- Store the residual and compute the Jacobian contribution due + to the dual time source term. ---*/ + + LinSysRes.AddBlock(iPoint, Residual); + + if (implicit) { + for (iVar = 0; iVar < nVar; iVar++) { + if (config->GetTime_Marching() == DT_STEPPING_1ST) + Jacobian_i[iVar][iVar] = Volume_nP1 / TimeStep; + if (config->GetTime_Marching() == DT_STEPPING_2ND) + Jacobian_i[iVar][iVar] = (Volume_nP1*3.0)/(2.0*TimeStep); + } + Jacobian.AddBlock2Diag(iPoint, Jacobian_i); + } + } + + } + else { + /*--- For unsteady flows on dynamic meshes (rigidly transforming or + dynamically deforming), the Geometric Conservation Law (GCL) should be + satisfied in conjunction with the ALE formulation of the governing + equations. The GCL prevents accuracy issues caused by grid motion, i.e. + a uniform free-stream should be preserved through a moving grid. First, + we will loop over the edges and boundaries to compute the GCL component + of the dual time source term that depends on grid velocities. ---*/ + + for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + + /*--- Initialize the Residual / Jacobian container to zero. ---*/ + + for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; + + /*--- Get indices for nodes i & j plus the face normal ---*/ + + iPoint = geometry->edges->GetNode(iEdge,0); + jPoint = geometry->edges->GetNode(iEdge,1); + Normal = geometry->edges->GetNormal(iEdge); + + /*--- Grid velocities stored at nodes i & j ---*/ + + GridVel_i = geometry->nodes->GetGridVel(iPoint); + GridVel_j = geometry->nodes->GetGridVel(jPoint); + + /*--- Compute the GCL term by averaging the grid velocities at the + edge mid-point and dotting with the face normal. ---*/ + + Residual_GCL = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Residual_GCL += 0.5*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; + + /*--- Compute the GCL component of the source term for node i ---*/ + + U_time_n = nodes->GetSolution_time_n(iPoint); + + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = U_time_n[iVar]*Residual_GCL; + + LinSysRes.AddBlock(iPoint, Residual); + + /*--- Compute the GCL component of the source term for node j ---*/ + + U_time_n = nodes->GetSolution_time_n(jPoint); + + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = U_time_n[iVar]*Residual_GCL; + + LinSysRes.SubtractBlock(jPoint, Residual); + + } + + /*--- Loop over the boundary edges ---*/ + + for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + + /*--- Initialize the Residual / Jacobian container to zero. ---*/ + + for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; + + /*--- Get the index for node i plus the boundary face normal ---*/ + + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); + + /*--- Grid velocities stored at boundary node i ---*/ + + GridVel_i = geometry->nodes->GetGridVel(iPoint); + + /*--- Compute the GCL term by dotting the grid velocity with the face + normal. The normal is negated to match the boundary convention. ---*/ + + Residual_GCL = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Residual_GCL -= 0.5*(GridVel_i[iDim]+GridVel_i[iDim])*Normal[iDim]; + + /*--- Compute the GCL component of the source term for node i ---*/ + + U_time_n = nodes->GetSolution_time_n(iPoint); + + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = U_time_n[iVar]*Residual_GCL; + + LinSysRes.AddBlock(iPoint, Residual); + + } + } + } + + /*--- Loop over all nodes (excluding halos) to compute the remainder + of the dual time-stepping source term. ---*/ + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Initialize the Residual / Jacobian container to zero. ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + Residual[iVar] = 0.0; + if (implicit) { + for (jVar = 0; jVar < nVar; jVar++) + Jacobian_i[iVar][jVar] = 0.0; + } + } + + /*--- Retrieve the solution at time levels n-1, n, and n+1. Note that + we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed, + previous solutions that are stored in memory. ---*/ + + U_time_nM1 = nodes->GetSolution_time_n1(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + U_time_nP1 = nodes->GetSolution(iPoint); + + /*--- CV volume at time n-1 and n+1. In the case of dynamically deforming + grids, the volumes will change. On rigidly transforming grids, the + volumes will remain constant. ---*/ + + Volume_nM1 = geometry->nodes->GetVolume_nM1(iPoint); + Volume_nP1 = geometry->nodes->GetVolume(iPoint); + + /*--- Compute the dual time-stepping source residual. Due to the + introduction of the GCL term above, the remainder of the source residual + due to the time discretization has a new form.---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + if (config->GetTime_Marching() == DT_STEPPING_1ST) + Residual[iVar] = (U_time_nP1[iVar] - U_time_n[iVar])*(Volume_nP1/TimeStep); + if (config->GetTime_Marching() == DT_STEPPING_2ND) + Residual[iVar] = (U_time_nP1[iVar] - U_time_n[iVar])*(3.0*Volume_nP1/(2.0*TimeStep)) + + (U_time_nM1[iVar] - U_time_n[iVar])*(Volume_nM1/(2.0*TimeStep)); + } + + /*--- Store the residual and compute the Jacobian contribution due + to the dual time source term. ---*/ + LinSysRes.AddBlock(iPoint, Residual); + if (implicit) { + for (iVar = 0; iVar < nVar; iVar++) { + if (config->GetTime_Marching() == DT_STEPPING_1ST) + Jacobian_i[iVar][iVar] = Volume_nP1 / TimeStep; + if (config->GetTime_Marching() == DT_STEPPING_2ND) + Jacobian_i[iVar][iVar] = (Volume_nP1*3.0)/(2.0*TimeStep); + } + Jacobian.AddBlock2Diag(iPoint, Jacobian_i); + } + } + } +} + +void CPBIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, + CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + + unsigned short iDim, jDim, iVar; + unsigned long iVertex, iPoint, Point_Normal, total_index; + + su2double *V_infty, *V_domain; + su2double Face_Flux, Flux0, Flux1, MeanDensity, proj_vel; + su2double *Coord_i, *Coord_j, dist_ij, delP, Pressure_j, Pressure_i; + bool implicit = config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT; + bool viscous = config->GetViscous(); + bool inflow = false; + + su2double *Normal = new su2double[nDim]; + unsigned short turb_model = config->GetKind_Turb_Model(); + + string Marker_Tag = config->GetMarker_All_TagBound(val_marker); + su2double *GridVel_i; + + /*--- Loop over all the vertices on this boundary marker ---*/ + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) + Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); + + /*--- Retrieve solution at the farfield boundary node ---*/ + V_domain = nodes->GetPrimitive(iPoint); + + /*--- Set farfield soultion. ---*/ + V_infty = GetCharacPrimVar(val_marker, iVertex); + V_infty[0] = GetPressure_Inf(); + for (iDim = 0; iDim < nDim; iDim++) + V_infty[iDim+1] = GetVelocity_Inf(iDim); + V_infty[nDim+1] = nodes->GetDensity(iPoint); + + if (dynamic_grid) { + GridVel_i = geometry->nodes->GetGridVel(iPoint); + conv_numerics->SetGridVel(GridVel_i,GridVel_i); + } + + Face_Flux = 0.0; + if (dynamic_grid) + for (iDim = 0; iDim < nDim; iDim++) + Face_Flux += nodes->GetDensity(iPoint)*(V_domain[iDim+1]-GridVel_i[iDim])*Normal[iDim]; + else + for (iDim = 0; iDim < nDim; iDim++) + Face_Flux += nodes->GetDensity(iPoint)*V_domain[iDim+1]*Normal[iDim]; + + inflow = false; + if ((Face_Flux < 0.0) && (fabs(Face_Flux) > EPS)) inflow = true; + + if (inflow) { + + /*--- Set this face as an inlet. ---*/ + LinSysRes.SetBlock_Zero(iPoint); + + nodes->SetStrongBC(iPoint); + + if (implicit) { + for (iDim = 0; iDim < nDim; iDim++) { + total_index = iPoint*nVar+iDim; + Jacobian.DeleteValsRowi(total_index); + } + } + } + else { + + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + /*--- Compute the residual using an upwind scheme ---*/ + + conv_numerics->SetPrimitive(V_domain, V_domain); + auto residual = conv_numerics->ComputeResidual(config); + + LinSysRes.AddBlock(iPoint, residual); + nodes->SetPressure_val(iPoint,GetPressure_Inf()); + + if (implicit) + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + } + + /*--- Set transport properties at the outlet (used by turb solver also). ---*/ + if (viscous) { + V_domain[nDim+2] = nodes->GetLaminarViscosity(iPoint); + V_domain[nDim+3] = nodes->GetEddyViscosity(iPoint); + V_infty[nDim+2] = nodes->GetLaminarViscosity(iPoint); + V_infty[nDim+3] = nodes->GetEddyViscosity(iPoint); + } + if (viscous && !inflow) { + + /*--- Set the normal vector and the coordinates ---*/ + Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); + + visc_numerics->SetNormal(Normal); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), + geometry->nodes->GetCoord(Point_Normal)); + + /*--- Primitive variables, and gradient ---*/ + visc_numerics->SetPrimitive(V_domain, V_domain); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); + + /*--- Turbulent kinetic energy ---*/ + if ((turb_model == SST) || (turb_model == SST_SUST)) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); + + /*--- Compute and update residual ---*/ + auto residual = visc_numerics->ComputeResidual(config); + + LinSysRes.SubtractBlock(iPoint, residual); + + /*--- Jacobian contribution for implicit integration ---*/ + if (implicit) + Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + } + } + } + + /*--- Free locally allocated memory ---*/ + delete [] Normal; +} + + +void CPBIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, + CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + unsigned short iDim, iVar, jDim; + unsigned long iVertex, iPoint,total_index, Point_Normal; + su2double *Flow_Dir, Vel_Mag, Area, Flow_Dir_Mag; + su2double UnitFlowDir[3] = {0.0,0.0,0.0}; + su2double Face_Flux, proj_vel; + su2double *V_inlet = new su2double[nDim]; + su2double *V_Charac; + su2double *V_domain; + su2double *Coord_i, *Coord_j, dist_ij, delP, Pressure_j, Pressure_i; + string Marker_Tag = config->GetMarker_All_TagBound(val_marker); + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + bool viscous = config->GetViscous(); + + su2double *Normal = new su2double[nDim]; + su2double *val_normal = new su2double[nDim]; + su2double *GridVel_i; + + /*--- Loop over all the vertices on this boundary marker ---*/ + + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + + /*--- Retrieve solution at the farfield boundary node ---*/ + + V_domain = nodes->GetPrimitive(iPoint); + + /*--- Retrieve the specified velocity for the inlet. ---*/ + + Vel_Mag = Inlet_Ptotal[val_marker][iVertex]/config->GetVelocity_Ref(); + + Flow_Dir = Inlet_FlowDir[val_marker][iVertex]; + Flow_Dir_Mag = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Flow_Dir_Mag += Flow_Dir[iDim]*Flow_Dir[iDim]; + Flow_Dir_Mag = sqrt(Flow_Dir_Mag); + + /*--- Store the unit flow direction vector. ---*/ + + for (iDim = 0; iDim < nDim; iDim++) + UnitFlowDir[iDim] = Flow_Dir[iDim]/Flow_Dir_Mag; + + /*--- Store the velocity in the primitive variable vector. ---*/ + + for (iDim = 0; iDim < nDim; iDim++) + V_inlet[iDim] = Vel_Mag*UnitFlowDir[iDim]; + + /*--- Adding the grid velocity because SetVelocityOld sets the solution which is U = U_rel + U_grid. ---*/ + /*if (dynamic_grid) { + GridVel_i = geometry->nodes->GetGridVel(iPoint); + for (iDim = 0; iDim < nDim; iDim++) + V_inlet[iDim] += GridVel_i[iDim]; + }*/ + + /*--- Update the CharacPrimVar for this vertex on inlet marker. ---*/ + /*--- This is necessary for the turbulent solver. ---*/ + V_Charac = GetCharacPrimVar(val_marker, iVertex); + + V_Charac[0] = nodes->GetPressure(iPoint); + for (iDim = 0; iDim < nDim; iDim++) + V_Charac[iDim+1] = V_domain[iDim]; + V_Charac[nDim+1] = nodes->GetDensity(iPoint); + + if (viscous) { + V_Charac[nDim+2] = nodes->GetLaminarViscosity(iPoint); + V_Charac[nDim+3] = nodes->GetEddyViscosity(iPoint); + } + + /*--- Impose the value of the velocity as a strong boundary condition (Dirichlet). + * Fix the velocity and remove any contribution to the residual at this node. + * Note that SetVelocityOld sets the solution which needs to be multiplied by rho. ---*/ + + nodes->SetVelocity_Old(iPoint,V_inlet); + + nodes->SetStrongBC(iPoint); + + LinSysRes.SetBlock_Zero(iPoint); + /*--- Jacobian contribution for implicit integration ---*/ + if (implicit) { + for (iDim = 0; iDim < nDim; iDim++) { + total_index = iPoint*nVar+iDim; + Jacobian.DeleteValsRowi(total_index); + } + } + } + } + + /*--- Free locally allocated memory ---*/ + + delete [] Normal; + delete [] V_inlet; + delete [] val_normal; + +} + +void CPBIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, + CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + unsigned short iDim,iVar,jDim; + unsigned long iVertex, iPoint, Point_Normal, total_index; + su2double Area, yCoordRef, yCoord,proj_vel; + su2double *V_outlet, *V_domain, P_Outlet, Face_Flux, Flux0; + su2double *Coord_i, *Coord_j, dist_ij, delP, Pressure_j, Pressure_i; + + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + bool viscous = config->GetViscous(); + string Marker_Tag = config->GetMarker_All_TagBound(val_marker); + + su2double *Normal = new su2double[nDim]; + unsigned short Kind_Outlet = config->GetKind_Inc_Outlet(Marker_Tag); + unsigned short turb_model = config->GetKind_Turb_Model(); + su2double *GridVel_j = new su2double[nDim]; + + /*--- Loop over all the vertices on this boundary marker ---*/ + + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + + /*--- Normal vector for this vertex (negate for outward convention) ---*/ + + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + + Area = GeometryToolbox::Norm(nDim, Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); + + /*--- Current solution at this boundary node ---*/ + + V_domain = nodes->GetPrimitive(iPoint); + + V_outlet = GetCharacPrimVar(val_marker, iVertex); + + for (iDim = 0; iDim < nDim; iDim++) GridVel_j[iDim] = 0.0; + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), GridVel_j); + + switch (Kind_Outlet) { + case PRESSURE_OUTLET: { + + /*--- Retrieve the specified back pressure for this outlet. ---*/ + P_Outlet = config->GetOutlet_Pressure(Marker_Tag)/config->GetPressure_Ref(); + + nodes->SetPressure_val(iPoint, P_Outlet); + V_outlet[0] = P_Outlet; + for (iDim = 0; iDim < nDim; iDim++) + V_outlet[iDim+1] = 0.0; + V_outlet[nDim+1] = nodes->GetDensity(iPoint); + + conv_numerics->SetPrimitive(V_domain, V_outlet); + + /*--- Compute the residual using an upwind scheme ---*/ + + auto residual = conv_numerics->ComputeResidual(config); + + for (iVar = 0; iVar < nVar; iVar++) { + Residual[iVar] = 2.0*residual.residual[iVar]; + } + + for (iDim = 0; iDim < nDim; iDim++) + for (jDim = 0; jDim < nDim; jDim++) + Jacobian_i[iDim][jDim] = 2.0*residual.jacobian_i[iDim][jDim]; + + /*--- Update residual value ---*/ + LinSysRes.AddBlock(iPoint, Residual); + + if (implicit) + Jacobian.AddBlock2Diag(iPoint, Jacobian_i); + + for (iDim = 0; iDim < nDim; iDim++) + V_outlet[iDim+1] = V_domain[iDim+1]; + + break; + } + + case OPEN: + /* Not working yet */ + + break; + } + + if (viscous) { + /*--- Set transport properties at the outlet. ---*/ + V_domain[nDim+2] = nodes->GetLaminarViscosity(iPoint); + V_domain[nDim+3] = nodes->GetEddyViscosity(iPoint); + V_outlet[nDim+2] = nodes->GetLaminarViscosity(iPoint); + V_outlet[nDim+3] = nodes->GetEddyViscosity(iPoint); + + /*--- Set the normal vector and the coordinates ---*/ + Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); + visc_numerics->SetNormal(Normal); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), + geometry->nodes->GetCoord(Point_Normal)); + + /*--- Primitive variables, and gradient ---*/ + visc_numerics->SetPrimitive(V_domain, V_outlet); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); + + /*--- Turbulent kinetic energy ---*/ + if ((turb_model == SST) || (turb_model == SST_SUST)) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); + + /*--- Compute and update residual ---*/ + auto residual = visc_numerics->ComputeResidual(config); + + LinSysRes.SubtractBlock(iPoint, residual); + + /*--- Jacobian contribution for implicit integration ---*/ + if (implicit) + Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + } + } + } + + /*--- Free locally allocated memory ---*/ + delete [] Normal; + delete [] GridVel_j; + +} + +/*--- Note that velocity indices in residual are hard coded in solver_structure. Need to be careful. ---*/ + +void CPBIncEulerSolver::BC_Periodic(CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config) { + + /*--- Complete residuals for periodic boundary conditions. We loop over + the periodic BCs in matching pairs so that, in the event that there are + adjacent periodic markers, the repeated points will have their residuals + accumulated correctly during the communications. For implicit calculations, + the Jacobians and linear system are also correctly adjusted here. ---*/ + + SetMomCoeffPer(geometry, solver_container, config); + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); + } +} + +void CPBIncEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, + CConfig *config, unsigned short iMesh) { } + + +void CPBIncEulerSolver::PrintVerificationError(const CConfig *config) const { } diff --git a/SU2_CFD/src/solvers/CPBIncNSSolver.cpp b/SU2_CFD/src/solvers/CPBIncNSSolver.cpp new file mode 100644 index 000000000000..c72d9c41fd25 --- /dev/null +++ b/SU2_CFD/src/solvers/CPBIncNSSolver.cpp @@ -0,0 +1,562 @@ +/*! + * \file CPBIncNSSolver.cpp + * \brief Main subroutines for solving Navier-Stokes incompressible flow. + * \author F. Palacios, T. Economon + * \version 7.0.2 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/solvers/CPBIncNSSolver.hpp" +#include "../../include/variables/CPBIncNSVariable.hpp" +#include "../../../Common/include/toolboxes/printing_toolbox.hpp" +#include "../../include/solvers/CFVMFlowSolverBase.inl" + + +CPBIncNSSolver::CPBIncNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CPBIncEulerSolver(geometry, config, iMesh, true) { + + + Viscosity_Inf = config->GetViscosity_FreeStreamND(); + Tke_Inf = config->GetTke_FreeStreamND(); + +} + +void CPBIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { + +unsigned long iPoint, ErrorCounter = 0; + su2double StrainMag = 0.0, Omega = 0.0, *Vorticity; + + unsigned long InnerIter = config->GetInnerIter(); + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + bool limiter_flow = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); + bool limiter_turb = (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); + bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; + bool outlet = ((config->GetnMarker_Outlet() != 0)); + + /*--- Set the primitive variables ---*/ + + ErrorCounter = SetPrimitive_Variables(solver_container, config, Output); + + /*--- Compute gradient for MUSCL reconstruction. ---*/ + + if (config->GetReconstructionGradientRequired() && (iMesh == MESH_0)) { + if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) + SetPrimitive_Gradient_GG(geometry, config, true); + if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) + SetPrimitive_Gradient_LS(geometry, config, true); + if (config->GetKind_Gradient_Method_Recon() == WEIGHTED_LEAST_SQUARES) + SetPrimitive_Gradient_LS(geometry, config, true); + } + + /*--- Compute gradient of the primitive variables ---*/ + + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { + SetPrimitive_Gradient_GG(geometry, config, false); + } + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + SetPrimitive_Gradient_LS(geometry, config, false); + } + + /*--- Compute the limiter in case we need it in the turbulence model + or to limit the viscous terms (check this logic with JST and 2nd order turbulence model) ---*/ + + if ((iMesh == MESH_0) && (limiter_flow || limiter_turb ) + && !Output && !van_albada) { SetPrimitive_Limiter(geometry, config); } + + /*--- Evaluate the vorticity and strain rate magnitude ---*/ + + solver_container[FLOW_SOL]->GetNodes()->SetVorticity_StrainMag(); + + StrainMag_Max = 0.0; Omega_Max = 0.0; + for (iPoint = 0; iPoint < nPoint; iPoint++) { + + StrainMag = solver_container[FLOW_SOL]->GetNodes()->GetStrainMag(iPoint); + Vorticity = solver_container[FLOW_SOL]->GetNodes()->GetVorticity(iPoint); + Omega = sqrt(Vorticity[0]*Vorticity[0]+ Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); + + StrainMag_Max = max(StrainMag_Max, StrainMag); + Omega_Max = max(Omega_Max, Omega); + + nodes->ResetStrongBC(iPoint); + + } + + /*--- Initialize the Jacobian matrices ---*/ + + if (implicit ) Jacobian.SetValZero(); + + /*--- Error message ---*/ + if (config->GetComm_Level() == COMM_FULL) { + +#ifdef HAVE_MPI + unsigned long MyErrorCounter = ErrorCounter; ErrorCounter = 0; + su2double MyOmega_Max = Omega_Max; Omega_Max = 0.0; + su2double MyStrainMag_Max = StrainMag_Max; StrainMag_Max = 0.0; + + SU2_MPI::Allreduce(&MyErrorCounter, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyStrainMag_Max, &StrainMag_Max, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyOmega_Max, &Omega_Max, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); +#endif + + if (iMesh == MESH_0) + config->SetNonphysical_Points(ErrorCounter); + + } + + SetResMassFluxZero(); + +} + + +unsigned long CPBIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) { + + unsigned long iPoint, nonPhysicalPoints = 0; + su2double eddy_visc = 0.0, turb_ke = 0.0, DES_LengthScale = 0.0; + unsigned short turb_model = config->GetKind_Turb_Model(); + bool physical = true; + + bool tkeNeeded = ((turb_model == SST) || (turb_model == SST_SUST)); + + for (iPoint = 0; iPoint < nPoint; iPoint++) { + + /*--- Retrieve the value of the kinetic energy (if needed) ---*/ + + if (turb_model != NONE && solver_container[TURB_SOL] != nullptr) { + eddy_visc = solver_container[TURB_SOL]->GetNodes()->GetmuT(iPoint); + if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0); + + if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ + DES_LengthScale = solver_container[TURB_SOL]->GetNodes()->GetDES_LengthScale(iPoint); + } + } + + /*--- Incompressible flow, primitive variables --- */ + + physical = static_cast(nodes)->SetPrimVar(iPoint,Density_Inf, Viscosity_Inf, eddy_visc, turb_ke, config); + + /* Check for non-realizable states for reporting. */ + + if (!physical) nonPhysicalPoints++; + + /*--- Initialize the convective, source and viscous residual vector ---*/ + + if (!Output) LinSysRes.SetBlock_Zero(iPoint); + + } + + return nonPhysicalPoints; + + +} + +void CPBIncNSSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh) { + +bool RightSol = true; +unsigned long iPoint, ErrorCounter = 0; + + /*--- Set the current estimate of velocity as a primitive variable, needed for momentum interpolation. + * -- This does not change the pressure, it remains the same as the old value .i.e. previous (pseudo)time step. ---*/ + if (iMesh == MESH_0) ErrorCounter = SetPrimitive_Variables(solver_container, config, true); + + /*--- Compute gradients to be used in Rhie Chow interpolation ---*/ + + /*--- Gradient computation ---*/ + + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { + SetPrimitive_Gradient_GG(geometry, config); + } + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + SetPrimitive_Gradient_LS(geometry, config); + } + + /*--- Evaluate the vorticity and strain rate magnitude ---*/ + + solver_container[FLOW_SOL]->GetNodes()->SetVorticity_StrainMag(); +} + + +void CPBIncNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, + CConfig *config, unsigned short iMesh, unsigned short iRKStep) { + + CNumerics* numerics = numerics_container[VISC_TERM]; + + unsigned long iPoint, jPoint, iEdge; + + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + unsigned short turb_model = config->GetKind_Turb_Model(); + bool print = false; + + for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + + /*--- Points, coordinates and normal vector in edge ---*/ + + iPoint = geometry->edges->GetNode(iEdge,0); + jPoint = geometry->edges->GetNode(iEdge,1); + numerics->SetCoord(geometry->nodes->GetCoord(iPoint), + geometry->nodes->GetCoord(jPoint)); + numerics->SetNormal(geometry->edges->GetNormal(iEdge)); + + /*--- Primitive and secondary variables ---*/ + + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), + nodes->GetPrimitive(jPoint)); + + /*--- Gradient and limiters ---*/ + + numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(jPoint)); + + /*--- Turbulent kinetic energy ---*/ + + if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) + numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(jPoint,0)); + + /*--- Compute and update residual ---*/ + + auto residual = numerics->ComputeResidual(config); + + LinSysRes.SubtractBlock(iPoint, residual); + LinSysRes.AddBlock(jPoint, residual); + + /*--- Implicit part ---*/ + + if (implicit) { + Jacobian.UpdateBlocksSub(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + } + + } +} + + + +void CPBIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh, unsigned long Iteration) { + + su2double *Normal, Area, Vol, Length, Mean_ProjVel = 0.0, Mean_Vel, Mean_Density, + Mean_BetaInc2 = 4.1, Lambda, Local_Delta_Time, Mean_DensityInc, GradVel, Lambda1, + Mean_LaminarVisc, Mean_EddyVisc, Local_Delta_Time_Visc, K_v = 0.25, ProjVel_i, ProjVel_j, + Global_Delta_Time = 1E6, Global_Delta_UnstTimeND, ProjVel, RefProjFlux, MinRefProjFlux; + + unsigned long iEdge, iVertex, iPoint, jPoint; + unsigned short iDim, iMarker, iVar; + + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + bool grid_movement = config->GetGrid_Movement(); + bool time_steping = config->GetTime_Marching() == TIME_STEPPING; + bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND)); + + Min_Delta_Time = 1.E6; Max_Delta_Time = 0.0; MinRefProjFlux = 0.0; + + Normal = new su2double [nDim]; + + /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ + + for (iPoint = 0; iPoint < nPointDomain; iPoint++){ + nodes->SetMax_Lambda_Inv(iPoint,0.0); + nodes->SetMax_Lambda_Visc(iPoint, 0.0); + } + + /*--- Loop interior edges ---*/ + + for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + + /*--- Point identification, Normal vector and area ---*/ + + iPoint = geometry->edges->GetNode(iEdge,0); + jPoint = geometry->edges->GetNode(iEdge,1); + + geometry->edges->GetNormal(iEdge,Normal); + + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + /*--- Compute flux across the cell ---*/ + + Mean_Density = 0.5*(nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); + Mean_ProjVel = 0.0; + for (iVar = 0; iVar < nVar; iVar++) { + Mean_Vel = 0.5*(nodes->GetVelocity(iPoint, iVar) + nodes->GetVelocity(jPoint,iVar)); + Mean_ProjVel += Mean_Vel*Normal[iVar]; + } + RefProjFlux = fabs(config->GetInc_Velocity_Ref()*Area); + MinRefProjFlux = max(RefProjFlux, MinRefProjFlux); + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint); + su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint); + ProjVel_i = 0.0; ProjVel_j =0.0; + for (iDim = 0; iDim < nDim; iDim++) { + ProjVel_i += GridVel_i[iDim]*Normal[iDim]; + ProjVel_j += GridVel_j[iDim]*Normal[iDim]; + } + Mean_ProjVel -= 0.5 * (ProjVel_i + ProjVel_j); + } + + Lambda = fabs(Mean_ProjVel) + fabs(RefProjFlux); + + /*--- Inviscid contribution ---*/ + + if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint,Lambda+EPS); + if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Inv(jPoint,Lambda+EPS); + + + /*--- Viscous contribution ---*/ + + Mean_LaminarVisc = 0.5*(nodes->GetLaminarViscosity(iPoint) + nodes->GetLaminarViscosity(jPoint)); + Mean_EddyVisc = 0.5*(nodes->GetEddyViscosity(iPoint) + nodes->GetEddyViscosity(jPoint)); + Mean_Density = 0.5*(nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); + + Lambda = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc)*Area*Area/Mean_Density; + + if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint,Lambda); + if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Visc(jPoint,Lambda); + + } + + /*--- Loop boundary edges ---*/ + + for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + + /*--- Point identification, Normal vector and area ---*/ + + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt(Area); + + /*--- Compute flux across the cell ---*/ + Mean_Density = nodes->GetDensity(iPoint); + Mean_ProjVel = 0.0; + for (iVar = 0; iVar < nVar; iVar++) { + Mean_Vel = nodes->GetVelocity(iPoint,iVar); + Mean_ProjVel += Mean_Vel*Normal[iVar]; + } + RefProjFlux = fabs(config->GetInc_Velocity_Ref()*Area); + + MinRefProjFlux = max(RefProjFlux, MinRefProjFlux); + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + su2double *GridVel = geometry->nodes->GetGridVel(iPoint); + ProjVel = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + ProjVel += GridVel[iDim]*Normal[iDim]; + Mean_ProjVel -= ProjVel; + } + + Lambda = fabs(Mean_ProjVel) + fabs(RefProjFlux); + + if (geometry->nodes->GetDomain(iPoint)) { + nodes->AddMax_Lambda_Inv(iPoint,Lambda+EPS); + } + + /*--- Viscous contribution ---*/ + + Mean_LaminarVisc = nodes->GetLaminarViscosity(iPoint); + Mean_EddyVisc = nodes->GetEddyViscosity(iPoint); + Mean_Density = nodes->GetDensity(iPoint); + + Lambda = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc)*Area*Area/Mean_Density; + + if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint,Lambda); + } + } + + /*--- Each element uses their own speed, steady state simulation ---*/ + + + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + Vol = geometry->nodes->GetVolume(iPoint); + + if (Vol != 0.0) { + Local_Delta_Time = config->GetCFL(iMesh)*Vol / nodes->GetMax_Lambda_Inv(iPoint); + Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); + Local_Delta_Time = min(Local_Delta_Time, Local_Delta_Time_Visc); + Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time); + Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time); + Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time); + if (Local_Delta_Time > config->GetMax_DeltaTime()) + Local_Delta_Time = config->GetMax_DeltaTime(); + nodes->SetDelta_Time(iPoint, Local_Delta_Time); + } + else { + nodes->SetDelta_Time(iPoint, 0.0); + } + } + + /*--- Compute the max and the min dt (in parallel) ---*/ + if (config->GetComm_Level() == COMM_FULL) { +#ifdef HAVE_MPI + su2double rbuf_time, sbuf_time; + sbuf_time = Min_Delta_Time; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Min_Delta_Time = rbuf_time; + + sbuf_time = Max_Delta_Time; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Max_Delta_Time = rbuf_time; +#endif + } + + /*--- For exact time solution use the minimum delta time of the whole mesh ---*/ + if (config->GetTime_Marching() == TIME_STEPPING) { +#ifdef HAVE_MPI + su2double rbuf_time, sbuf_time; + sbuf_time = Global_Delta_Time; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Global_Delta_Time = rbuf_time; +#endif + for (iPoint = 0; iPoint < nPointDomain; iPoint++) + nodes->SetDelta_Time(iPoint, Global_Delta_Time); + } + + /*--- Recompute the unsteady time step for the dual time strategy + if the unsteady CFL is diferent from 0 ---*/ + if ((dual_time) && (Iteration == 0) && (config->GetUnst_CFL() != 0.0) && (iMesh == MESH_0)) { + Global_Delta_UnstTimeND = config->GetUnst_CFL()*Global_Delta_Time/config->GetCFL(iMesh); + +#ifdef HAVE_MPI + su2double rbuf_time, sbuf_time; + sbuf_time = Global_Delta_UnstTimeND; + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Global_Delta_UnstTimeND = rbuf_time; +#endif + config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND); + } + + /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/ + if (dual_time) + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + if (!implicit) { + Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint, Local_Delta_Time); + } + } + + delete [] Normal; +} + +void CPBIncNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker){ + + + unsigned short iDim, iVar, jVar;// Wall_Function; + unsigned long iVertex, iPoint, total_index, Point_Normal; + + su2double *GridVel, *Normal, Area, Wall_HeatFlux; + su2double *Coord_i, *Coord_j, dist_ij, delP, Pressure_j, Pressure_i; + + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + Normal = new su2double [nDim]; + /*--- Identify the boundary by string name ---*/ + + string Marker_Tag = config->GetMarker_All_TagBound(val_marker); + + /*--- Loop over all of the vertices on this boundary marker ---*/ + + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + + /*--- Compute dual-grid area and boundary normal ---*/ + + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Area += Normal[iDim]*Normal[iDim]; + Area = sqrt (Area); + + /*--- Initialize the convective & viscous residuals to zero ---*/ + + for (iVar = 0; iVar < nVar; iVar++) { + Res_Conv[iVar] = 0.0; + Res_Visc[iVar] = 0.0; + if (implicit) { + for (jVar = 0; jVar < nVar; jVar++) + Jacobian_i[iVar][jVar] = 0.0; + } + } + + /*--- Store the corrected velocity at the wall which will + be zero (v = 0), unless there are moving walls (v = u_wall)---*/ + + if (dynamic_grid) { + GridVel = geometry->nodes->GetGridVel(iPoint); + for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim]; + } else { + for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0; + } + + /*--- Impose the value of the velocity as a strong boundary + condition (Dirichlet). Fix the velocity and remove any + contribution to the residual at this node. ---*/ + + nodes->SetVelocity_Old(iPoint, Vector); + + /*for (iDim = 0; iDim < nDim; iDim++) + LinSysRes.SetBlock_Zero(iPoint, iDim);*/ + LinSysRes.SetBlock_Zero(iPoint); + + nodes->SetStrongBC(iPoint); + + /*--- Enforce the no-slip boundary condition in a strong way by + modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/ + + if (implicit) { + for (iVar = 0; iVar < nDim; iVar++) { + total_index = iPoint*nVar+iVar; + Jacobian.DeleteValsRowi(total_index); + } + } + } + } + + delete [] Normal; +} + + + +void CPBIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker){ + + + /*--- No energy equation => Both adiabatic and isothermal walls become the usual no-slip boundary. ---*/ + BC_HeatFlux_Wall(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker); + +} diff --git a/SU2_CFD/src/solvers/CPoissonSolverFVM.cpp b/SU2_CFD/src/solvers/CPoissonSolverFVM.cpp new file mode 100644 index 000000000000..f83f6273307a --- /dev/null +++ b/SU2_CFD/src/solvers/CPoissonSolverFVM.cpp @@ -0,0 +1,575 @@ +/*! + * \file solution_direct_poisson.cpp + * \brief Main subrotuines for solving direct problems + * \author F. Palacios + * \version 6.1.0 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2018, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/solvers/CPoissonSolverFVM.hpp" +#include "../../../Common/include/toolboxes/printing_toolbox.hpp" +#include "../../include/gradients/computeGradientsGreenGauss.hpp" +#include "../../include/gradients/computeGradientsLeastSquares.hpp" +#include "../../include/limiters/computeLimiters.hpp" + +CPoissonSolverFVM::CPoissonSolverFVM(void) : CSolver() { } + +CPoissonSolverFVM::CPoissonSolverFVM(CGeometry *geometry, CConfig *config) : CSolver() { + + unsigned long iPoint; + unsigned short iVar, iDim; + + int rank = MASTER_NODE; +#ifdef HAVE_MPI + MPI_Comm_rank(MPI_COMM_WORLD, &rank); +#endif + + nDim = geometry->GetnDim(); + nPoint = geometry->GetnPoint(); + nPointDomain = geometry->GetnPointDomain(); + nVar = 1; + nPrimVar = 1; + + /*--- Initialize nVarGrad for deallocation ---*/ + + nVarGrad = nVar; + + Residual = new su2double[nVar]; Residual_RMS = new su2double[nVar]; + Solution = new su2double[nVar]; + Residual_Max = new su2double[nVar]; + + + /*--- Define some structures for locating max residuals ---*/ + + Point_Max = new unsigned long[nVar]; + for (iVar = 0; iVar < nVar; iVar++) Point_Max[iVar] = 0; + Point_Max_Coord = new su2double*[nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + Point_Max_Coord[iVar] = new su2double[nDim]; + for (iDim = 0; iDim < nDim; iDim++) Point_Max_Coord[iVar][iDim] = 0.0; + } + + /*--- Define some auxiliar vector related with the solution ---*/ + + Solution_i = new su2double[nVar]; Solution_j = new su2double[nVar]; + + if (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT) { + Jacobian_i = new su2double* [nVar]; + Jacobian_j = new su2double* [nVar]; + for (iVar = 0; iVar < nVar; iVar++) { + Jacobian_i[iVar] = new su2double [nVar]; + Jacobian_j[iVar] = new su2double [nVar]; + } + /*--- Initialization of the structure of the whole Jacobian ---*/ + if (rank == MASTER_NODE) cout << "Initialize Jacobian structure (Poisson equation)." << endl; + Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config); + } + /*--- Solution and residual vectors ---*/ + + LinSysSol.Initialize(nPoint, nPointDomain, nVar, 0.0); + LinSysRes.Initialize(nPoint, nPointDomain, nVar, 0.0); + + /*--- Computation of gradients by least squares ---*/ + + + /*--- Always instantiate and initialize the variable to a zero value. ---*/ + + nodes = new CPoissonVariable(0.0, nPoint, nDim, nVar, config); + SetBaseClassPointerToNodes(); + + /*--- The poisson equation always solved implicitly, so set the + implicit flag in case we have periodic BCs. Geometry info is + communicated in the flow solver. ---*/ + + SetImplicitPeriodic(true); + + /*--- Perform the MPI communication of the solution ---*/ + + InitiateComms(geometry, config, SOLUTION); + CompleteComms(geometry, config, SOLUTION); + +} + +CPoissonSolverFVM::~CPoissonSolverFVM(void) { + + if (nodes != nullptr) delete nodes; +} + + +void CPoissonSolverFVM::Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, + CConfig *config, unsigned short iMesh) { +} + + +void CPoissonSolverFVM::Preprocessing(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { + unsigned long iPoint; + /*--- Initialize the residual vector ---*/ + for (iPoint = 0; iPoint < nPoint; iPoint ++) + LinSysRes.SetBlock_Zero(iPoint); + + /*--- Initialize the Jacobian matrices ---*/ + Jacobian.SetValZero(); + + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) + SetSolution_Gradient_GG(geometry, config,false); + + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) + SetSolution_Gradient_LS(geometry, config,false); +} + +void CPoissonSolverFVM::Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh){ + + /*--- Compute gradients so we can use it to find the velocity corrections ---*/ + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) + SetSolution_Gradient_GG(geometry, config,false); + + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) + SetSolution_Gradient_LS(geometry, config,false); +} + +void CPoissonSolverFVM:: LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo){ + +} + +void CPoissonSolverFVM::Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, + CConfig *config, unsigned short iMesh, unsigned short iRKStep) { + + CNumerics* numerics = numerics_container[VISC_TERM]; + + su2double Poisson_Coeff_i,Poisson_Coeff_j,**Sol_i_Grad,**Sol_j_Grad,Poissonval_i,Poissonval_j,Normal[MAXNDIM]; + su2double Mom_Coeff_i[MAXNDIM],Mom_Coeff_j[MAXNDIM]; + unsigned long iEdge, iPoint, jPoint; + unsigned short iDim; + bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + iPoint = geometry->edges->GetNode(iEdge,0); + jPoint = geometry->edges->GetNode(iEdge,1); + + /*--- Points coordinates, and normal vector ---*/ + numerics->SetCoord(geometry->nodes->GetCoord(iPoint),geometry->nodes->GetCoord(jPoint)); + numerics->SetNormal(geometry->edges->GetNormal(iEdge)); + + numerics->SetVolume(geometry->nodes->GetVolume(iPoint)); + numerics->SetVolume(geometry->nodes->GetVolume(jPoint)); + + /*--- Primitive variables w/o reconstruction ---*/ + Poissonval_i = nodes->GetSolution(iPoint, 0); + Poissonval_j = nodes->GetSolution(jPoint, 0); + + numerics->SetPoissonval(Poissonval_i,Poissonval_j); + + Sol_i_Grad = nodes->GetGradient(iPoint); + Sol_j_Grad = nodes->GetGradient(jPoint); + + numerics->SetConsVarGradient(Sol_i_Grad, Sol_j_Grad); + + if (config->GetKind_Incomp_System()!=PRESSURE_BASED) { + for (iDim = 0; iDim < nDim; iDim++) { + Mom_Coeff_i[iDim] = 1.0; + Mom_Coeff_j[iDim] = 1.0; + } + } else { + for (iDim = 0; iDim < nDim; iDim++) { + Mom_Coeff_i[iDim] = solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint)*solver_container[FLOW_SOL]->GetNodes()->Get_Mom_Coeff(iPoint, iDim) ; + Mom_Coeff_j[iDim] = solver_container[FLOW_SOL]->GetNodes()->GetDensity(jPoint)*solver_container[FLOW_SOL]->GetNodes()->Get_Mom_Coeff(jPoint, iDim) ; + } + } + numerics->SetInvMomCoeff(Mom_Coeff_i,Mom_Coeff_j); + + /*--- Compute and update residual ---*/ + auto residual = numerics->ComputeResidual(config); + + LinSysRes.SubtractBlock(iPoint, residual); + LinSysRes.AddBlock(jPoint, residual); + + /*--- Implicit part ---*/ + if (implicit) + Jacobian.UpdateBlocksSub(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + } +} + +void CPoissonSolverFVM::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, + CConfig *config, unsigned short iMesh) { + CNumerics* numerics = numerics_container[SOURCE_FIRST_TERM]; + + unsigned short iVar; + unsigned long iPoint; + su2double Src_Term; + + /*--- Initialize the source residual to zero ---*/ + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = 0.0; + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Load the volume of the dual mesh cell ---*/ + numerics->SetVolume(geometry->nodes->GetVolume(iPoint)); + + /*--- Compute the source term ---*/ + if ((config->GetKind_Incomp_System() == PRESSURE_BASED)) { + Src_Term = solver_container[FLOW_SOL]->GetNodes()->GetMassFlux(iPoint) ; + if (Src_Term != Src_Term)Src_Term = 0.0; + nodes->SetSourceTerm(iPoint, Src_Term); + } + numerics->SetSourcePoisson(nodes->GetSourceTerm(iPoint)); + + /*--- Compute the source residual ---*/ + numerics->ComputeResidual(Residual, Jacobian_i, config); + + /*--- Add the source residual to the total ---*/ + LinSysRes.AddBlock(iPoint, Residual); + + /*--- No jacobian contribution from mass flux/constant source term. ---*/ + } +} + +void CPoissonSolverFVM::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + + /*--- No time integration is done here. The routine is used as a means to solve the jacobian matrix in a way + * consistent with the rest of the code. Time step is set to zero and no under-relaxation is applied to the + * jacobian matrix.*/ + + unsigned long iPoint, total_index, IterLinSol = 0;; + unsigned short iVar; + su2double *local_Residual, *local_Res_TruncError, Vol, Delta, Res; + + /*--- Set max linear solver iter which can be different from flow iterations ---*/ + config->SetLinear_Solver_Iter(config->GetLinear_Solver_Iter_Poisson()); + + /*--- Set maximum residual to zero ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + SetRes_RMS(iVar, 0.0); + SetRes_Max(iVar, 0.0, 0); + } + /*--- Initialize residual and solution at the ghost points ---*/ + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { +/*--- Workaround to deal with nodes that are part of multiple boundaries and where + * one face might be strong BC and another weak BC (mostly for farfield boundary + * where the boundary face is strong or weak depending on local flux. ---*/ + if (nodes->GetStrongBC(iPoint)) { + for (iVar = 0; iVar < nVar; iVar++) { + total_index = iPoint*nVar+iVar; + Jacobian.DeleteValsRowi(total_index); + } + LinSysRes.SetBlock_Zero(iPoint); + } + + /*--- Read the residual ---*/ + local_Res_TruncError = nodes->GetResTruncError(iPoint); + + /*--- Read the volume ---*/ + Vol = geometry->nodes->GetVolume(iPoint); + + /*--- Possible under-relaxation if needed goes here. ---*/ + /*--- Currently, nothing changes. ---*/ + /*su2double *diag = Jacobian.GetBlock(iPoint, iPoint); + for (iVar = 0; iVar < nVar; iVar++) + diag[(nVar+1)*iVar] = diag[(nVar+1)*iVar]/1.0; + + Jacobian.SetBlock(iPoint, iPoint, diag);*/ + + /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + total_index = iPoint*nVar+iVar; + LinSysRes[total_index] = - (LinSysRes[total_index] + local_Res_TruncError[iVar] ); + LinSysSol[total_index] = 0.0; + AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]); + AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint)); + } + } + + /*--- Initialize residual and solution at the ghost points ---*/ + for (iPoint = nPointDomain; iPoint < nPoint; iPoint++) { + for (iVar = 0; iVar < nVar; iVar++) { + total_index = iPoint*nVar + iVar; + LinSysRes[total_index] = 0.0; + LinSysSol[total_index] = 0.0; + } + } + + /*--- Solve or smooth the linear system ---*/ + IterLinSol = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + + /*--- Store the value of the residual. ---*/ + SetResLinSolver(System.GetResidual()); + + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (iVar = 0; iVar < nVar; iVar++) { + nodes->AddSolution(iPoint, iVar, LinSysSol[iPoint*nVar+iVar]); + } + } + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); + } + + /*--- MPI solution ---*/ + InitiateComms(geometry, config, SOLUTION); + CompleteComms(geometry, config, SOLUTION); + + /*--- Compute the root mean square residual ---*/ + SetResidual_RMS(geometry, config); +} + + +void CPoissonSolverFVM::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + + + +} + +void CPoissonSolverFVM::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh, unsigned long Iteration){ + + /*--- Set a value for periodic communication routines. Is not used during any computations. + * Done in the constructor---*/ +} + +void CPoissonSolverFVM::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, + CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + + unsigned long iVertex, iPoint; + unsigned short iDim, iVar; + + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + if (geometry->nodes->GetDomain(iPoint)) { + /*--- The farfield boundary is considered as an inlet-outlet boundary, where flow + * can either enter or leave. For pressure, it is treated as a fully developed flow + * and a dirichlet BC is applied. For velocity, based on the sign of massflux, either + * a dirichlet or a neumann BC is applied (in Flow_Correction routine). ---*/ + + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = 0.0; + + LinSysRes.SetBlock_Zero(iPoint); + + nodes->SetSolution(iPoint, Residual); + nodes->SetSolution_Old(iPoint,Residual); + nodes->SetStrongBC(iPoint); + if (config->GetKind_TimeIntScheme_Poisson()==EULER_IMPLICIT) { + Jacobian.DeleteValsRowi(iPoint); + } + } + } +} + + + +void CPoissonSolverFVM::BC_Euler_Wall(CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config, unsigned short val_marker) { +unsigned long iVertex, iPoint, Point_Normal; +unsigned short iVar; + + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + /*--- Zero flux (Neumann) BC on pressure ---*/ + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = 0.0; + + /*--- Add and subtract residual, and update Jacobians ---*/ + LinSysRes.SubtractBlock(iPoint, Residual); + if (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT) { + Jacobian_i[0][0] = 0.0; + Jacobian.SubtractBlock2Diag(iPoint, Jacobian_i); + } + } + } +} + + +void CPoissonSolverFVM::BC_Inlet(CGeometry *geometry, CSolver **solver_container, + CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + +unsigned long iVertex, iPoint; +unsigned short iVar; + + /*--- Only fixed velocity inlet is considered ---*/ + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + /*--- Zero flux (Neumann) BC on pressure ---*/ + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = 0.0; + + /*--- Add and subtract residual, and update Jacobians ---*/ + LinSysRes.SubtractBlock(iPoint, Residual); + + if (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT) { + Jacobian_i[0][0] = 0.0; + Jacobian.SubtractBlock2Diag(iPoint, Jacobian_i); + } + } + } +} + + +void CPoissonSolverFVM::BC_Outlet(CGeometry *geometry, CSolver **solver_container, + CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + + unsigned long iVertex, iPoint; + unsigned short iDim, iVar; + su2double MassFlux_Part, Normal[MAXNDIM]; + string Marker_Tag = config->GetMarker_All_TagBound(val_marker); + unsigned short Kind_Outlet = config->GetKind_Inc_Outlet(Marker_Tag); + + /*--- Only fully developed case is considered ---*/ + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + if (geometry->nodes->GetDomain(iPoint)) { + + /*--- A Dirichlet BC is applied at the fully developed outlet, pressure is + * assumed to be uniform and assigned the value of P_ref. ---*/ + for (iVar = 0; iVar < nVar; iVar++) + Residual[iVar] = 0.0; + + switch (Kind_Outlet) { + case PRESSURE_OUTLET: + LinSysRes.SetBlock_Zero(iPoint); + nodes->SetSolution(iPoint, Residual); + nodes->SetSolution_Old(iPoint, Residual); + nodes->SetStrongBC(iPoint); + if (config->GetKind_TimeIntScheme_Poisson()==EULER_IMPLICIT) + Jacobian.DeleteValsRowi(iPoint); + break; + + case OPEN: + /*--- Normal vector for this vertex (negative for outward convention) ---*/ + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + MassFlux_Part = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + MassFlux_Part -= solver_container[FLOW_SOL]->GetNodes()->GetDensity(iPoint)*(solver_container[FLOW_SOL]->GetNodes()->GetVelocity(iPoint, iDim))*Normal[iDim]; + + LinSysRes.SubtractBlock(iPoint, Residual); + if (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT) { + Jacobian_i[0][0] = 0.0; + Jacobian.SubtractBlock2Diag(iPoint, Jacobian_i); + } + break; + } + } + } + +} + + +void CPoissonSolverFVM::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, + CConfig *config, unsigned short val_marker) { + + unsigned long iVertex, iPoint; + unsigned short iVar; + + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + + /*--- Zero flux (Neumann) BC on pressure ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + Residual[iVar] = 0.0; + } + + /*--- Add and subtract residual, and update Jacobians ---*/ + LinSysRes.SubtractBlock(iPoint, Residual); + + if (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT) { + Jacobian_i[0][0] = 0.0; + Jacobian.SubtractBlock2Diag(iPoint, Jacobian_i); + } + } + } +} + + +void CPoissonSolverFVM::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + +unsigned long iVertex, iPoint, jPoint, total_index; +unsigned short iVar; + + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + + if (geometry->nodes->GetDomain(iPoint)) { + + /*--- Zero flux (Neumann) BC on pressure ---*/ + for (iVar = 0; iVar < nVar; iVar++) { + Residual[iVar] = 0.0; + } + + /*--- Add and subtract residual, and update Jacobians ---*/ + LinSysRes.SubtractBlock(iPoint, Residual); + + if (config->GetKind_TimeIntScheme_Poisson() == EULER_IMPLICIT) { + Jacobian_i[0][0] = 0.0; + Jacobian.SubtractBlock2Diag(iPoint, Jacobian_i); + } + } + } +} + + +/*--- Note that velocity indices in residual are hard coded in solver_structure. Need to be careful. ---*/ + +void CPoissonSolverFVM::BC_Periodic(CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config) { + + /*--- Complete residuals for periodic boundary conditions. We loop over + the periodic BCs in matching pairs so that, in the event that there are + adjacent periodic markers, the repeated points will have their residuals + accumulated correctly during the communications. For implicit calculations, + the Jacobians and linear system are also correctly adjusted here. ---*/ + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); + } + +} diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index be0a826ab29e..42b23f9e109a 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -322,6 +322,10 @@ void CSolver::GetPeriodicCommCountAndType(const CConfig* config, COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; + case PERIODIC_PRESSURE: + COUNT_PER_POINT = 1; + MPI_TYPE = COMM_TYPE_DOUBLE; + break; default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", CURRENT_FUNCTION); @@ -342,9 +346,10 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, bool boundary_i, boundary_j; bool weighted = true; + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); - unsigned short iVar, jVar, iDim; - unsigned short nNeighbor = 0; + unsigned short iVar, jVar, iDim, iVel = 1; + unsigned short iNeighbor, nNeighbor = 0; unsigned short COUNT_PER_POINT = 0; unsigned short MPI_TYPE = 0; unsigned short ICOUNT = nVar; @@ -378,6 +383,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, }; string Marker_Tag; + + if (pressure_based) iVel = 0; /*--- Set the size of the data packet and type depending on quantity. ---*/ @@ -506,11 +513,12 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, for (iVar = 0; iVar < nVar; iVar++) { bufDSend[buf_offset+iVar] = LinSysRes(iPoint, iVar); } + //cout<<"Residual"<GetSolution(iPoint, iVar); } + //cout<<"IMplicit"<GetSolution(iPoint)[1], &bufDSend[buf_offset+1]); + Rotate(zeros, &base_nodes->GetSolution(iPoint)[iVel], &bufDSend[buf_offset+iVel]); } break; @@ -811,7 +820,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, rotPrim_i[iVar] = base_nodes->GetSolution(iPoint, iVar); if (rotate_periodic) { - Rotate(zeros, &base_nodes->GetSolution(iPoint)[1], &rotPrim_i[1]); + Rotate(zeros, &base_nodes->GetSolution(iPoint)[iVel], &rotPrim_i[iVel]); } /*--- Inizialization of variables ---*/ @@ -840,13 +849,13 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, Rotate(translation, distance, rotCoord_j); - /*--- Get conservative solution and rotte if necessary. ---*/ + /*--- Get conservative solution and rotate if necessary. ---*/ for (iVar = 0; iVar < nVar; iVar++) rotPrim_j[iVar] = base_nodes->GetSolution(jPoint,iVar); if (rotate_periodic) { - Rotate(zeros, &base_nodes->GetSolution(jPoint)[1], &rotPrim_j[1]); + Rotate(zeros, &base_nodes->GetSolution(jPoint)[iVel], &rotPrim_j[iVel]); } if (weighted) { @@ -1102,8 +1111,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Rotate the momentum components of the min/max. ---*/ if (rotate_periodic) { - Rotate(zeros, &Sol_Min[1], &bufDSend[buf_offset+1]); - Rotate(zeros, &Sol_Max[1], &bufDSend[buf_offset+nPrimVarGrad+1]); + Rotate(zeros, &Sol_Min[iVel], &bufDSend[buf_offset+iVel]); + Rotate(zeros, &Sol_Max[iVel], &bufDSend[buf_offset+nPrimVarGrad+iVel]); } break; @@ -1152,8 +1161,8 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, /*--- Rotate the momentum components of the min/max. ---*/ if (rotate_periodic) { - Rotate(zeros, &Sol_Min[1], &bufDSend[buf_offset+1]); - Rotate(zeros, &Sol_Max[1], &bufDSend[buf_offset+nVar+1]); + Rotate(zeros, &Sol_Min[iVel], &bufDSend[buf_offset+iVel]); + Rotate(zeros, &Sol_Max[iVel], &bufDSend[buf_offset+nVar+iVel]); } break; @@ -1169,11 +1178,19 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry, } if (rotate_periodic) { - Rotate(zeros, &base_nodes->GetLimiter(iPoint)[1], &bufDSend[buf_offset+1]); + Rotate(zeros, &base_nodes->GetLimiter(iPoint)[iVel], &bufDSend[buf_offset+iVel]); } break; + case PERIODIC_PRESSURE: + + /*--- Load the pressure. ---*/ + + bufDSend[buf_offset] = base_nodes->GetPressure(iPoint); + + break; + default: SU2_MPI::Error("Unrecognized quantity for periodic communication.", CURRENT_FUNCTION); @@ -1560,6 +1577,14 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, } break; + + case PERIODIC_PRESSURE: + + if (iPeriodic == val_periodic_index + nPeriodic/2) { + base_nodes->SetPressure_val(iPoint, bufDRecv[buf_offset]); + } + + break; default: @@ -1603,6 +1628,7 @@ void CSolver::GetCommCountAndType(const CConfig* config, case SOLUTION_OLD: case UNDIVIDED_LAPLACIAN: case SOLUTION_LIMITER: + case MOM_COEFF: COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; @@ -1650,6 +1676,14 @@ void CSolver::GetCommCountAndType(const CConfig* config, COUNT_PER_POINT = nDim; MPI_TYPE = COMM_TYPE_DOUBLE; break; + case MASS_FLUX: + COUNT_PER_POINT = 1; + MPI_TYPE = COMM_TYPE_DOUBLE; + break; + case PRESSURE_VAR: + COUNT_PER_POINT = 1; + MPI_TYPE = COMM_TYPE_DOUBLE; + break; case MESH_DISPLACEMENTS: COUNT_PER_POINT = nDim; MPI_TYPE = COMM_TYPE_DOUBLE; @@ -1808,6 +1842,16 @@ void CSolver::InitiateComms(CGeometry *geometry, bufDSend[buf_offset+nVar*2+iVar] = base_nodes->GetSolution_Pred_Old(iPoint, iVar); } break; + case MOM_COEFF: + for (iVar = 0; iVar < nVar; iVar++) + bufDSend[buf_offset+iVar] = base_nodes->Get_Mom_Coeff(iPoint, iVar); + break; + case MASS_FLUX: + bufDSend[buf_offset] = base_nodes->GetMassFlux(iPoint); + break; + case PRESSURE_VAR: + bufDSend[buf_offset] = base_nodes->GetPrimitive(iPoint, 0); + break; case MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) bufDSend[buf_offset+iDim] = base_nodes->GetBound_Disp(iPoint, iDim); @@ -1983,6 +2027,16 @@ void CSolver::CompleteComms(CGeometry *geometry, base_nodes->SetSolution_Pred_Old(iPoint, iVar, bufDRecv[buf_offset+nVar*2+iVar]); } break; + case MOM_COEFF: + for (iVar = 0; iVar < nVar; iVar++) + base_nodes->Set_Mom_Coeff(iPoint, iVar, bufDRecv[buf_offset+iVar]); + break; + case MASS_FLUX: + base_nodes->SetMassFlux(iPoint, bufDRecv[buf_offset]); + break; + case PRESSURE_VAR: + base_nodes->SetPressure_val(iPoint, bufDRecv[buf_offset]); + break; case MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) base_nodes->SetBound_Disp(iPoint, iDim, bufDRecv[buf_offset+iDim]); diff --git a/SU2_CFD/src/solvers/CSolverFactory.cpp b/SU2_CFD/src/solvers/CSolverFactory.cpp index 169828a524b8..fcd55ee4a8a8 100644 --- a/SU2_CFD/src/solvers/CSolverFactory.cpp +++ b/SU2_CFD/src/solvers/CSolverFactory.cpp @@ -29,8 +29,11 @@ #include "../../include/solvers/CSolverFactory.hpp" #include "../../include/solvers/CEulerSolver.hpp" #include "../../include/solvers/CIncEulerSolver.hpp" +#include "../../include/solvers/CPBIncEulerSolver.hpp" #include "../../include/solvers/CNSSolver.hpp" #include "../../include/solvers/CIncNSSolver.hpp" +#include "../../include/solvers/CPBIncNSSolver.hpp" +#include "../../include/solvers/CPoissonSolverFVM.hpp" #include "../../include/solvers/CNEMOEulerSolver.hpp" #include "../../include/solvers/CNEMONSSolver.hpp" #include "../../include/solvers/CTurbSASolver.hpp" @@ -67,6 +70,7 @@ CSolver** CSolverFactory::CreateSolverContainer(ENUM_MAIN_SOLVER kindMainSolver, case INC_EULER: solver[FLOW_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::INC_EULER, solver, geometry, config, iMGLevel); solver[RAD_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::RADIATION, solver, geometry, config, iMGLevel); + solver[POISSON_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::POISSON_EQUATION, solver, geometry, config, iMGLevel); break; case EULER: solver[FLOW_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::EULER, solver, geometry, config, iMGLevel); @@ -78,6 +82,7 @@ CSolver** CSolverFactory::CreateSolverContainer(ENUM_MAIN_SOLVER kindMainSolver, solver[FLOW_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::INC_NAVIER_STOKES, solver, geometry, config, iMGLevel); solver[HEAT_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::HEAT, solver, geometry, config, iMGLevel); solver[RAD_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::RADIATION, solver, geometry, config, iMGLevel); + solver[POISSON_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::POISSON_EQUATION, solver, geometry, config, iMGLevel); break; case NAVIER_STOKES: solver[FLOW_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::NAVIER_STOKES, solver, geometry, config, iMGLevel); @@ -93,7 +98,9 @@ CSolver** CSolverFactory::CreateSolverContainer(ENUM_MAIN_SOLVER kindMainSolver, solver[FLOW_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::INC_NAVIER_STOKES, solver, geometry, config, iMGLevel); solver[HEAT_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::HEAT, solver, geometry, config, iMGLevel); solver[TURB_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::TURB, solver, geometry, config, iMGLevel); + solver[TRANS_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::TRANSITION, solver, geometry, config, iMGLevel); solver[RAD_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::RADIATION, solver, geometry, config, iMGLevel); + solver[POISSON_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::POISSON_EQUATION, solver, geometry, config, iMGLevel); break; case HEAT_EQUATION: solver[HEAT_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::HEAT, solver, geometry, config, iMGLevel); @@ -288,8 +295,10 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s metaData.integrationType = INTEGRATION_TYPE::DEFAULT; break; case SUB_SOLVER_TYPE::TRANSITION: - genericSolver = new CTransLMSolver(geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::SINGLEGRID; + if (config->GetKind_Trans_Model() == LM) { + genericSolver = new CTransLMSolver(geometry, config, iMGLevel); + metaData.integrationType = INTEGRATION_TYPE::SINGLEGRID; + } break; case SUB_SOLVER_TYPE::TURB: case SUB_SOLVER_TYPE::TURB_SA: case SUB_SOLVER_TYPE::TURB_SST: genericSolver = CreateTurbSolver(kindTurbModel, solver, geometry, config, iMGLevel, false); @@ -311,6 +320,12 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s } metaData.integrationType = INTEGRATION_TYPE::DEFAULT; break; + case SUB_SOLVER_TYPE::POISSON_EQUATION: + if (config->GetKind_Incomp_System() == PRESSURE_BASED) { + genericSolver = new CPoissonSolverFVM(geometry, config); + } + metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; + break; default: SU2_MPI::Error("No proper allocation found for requested sub solver", CURRENT_FUNCTION); break; @@ -435,11 +450,26 @@ CSolver* CSolverFactory::CreateFlowSolver(SUB_SOLVER_TYPE kindFlowSolver, CSolve flowSolver = new CNSSolver(geometry, config, iMGLevel); break; case SUB_SOLVER_TYPE::INC_EULER: - flowSolver = new CIncEulerSolver(geometry, config, iMGLevel); - flowSolver->Preprocessing(geometry, solver, config, iMGLevel, NO_RK_ITER, RUNTIME_FLOW_SYS, false); + switch (config->GetKind_Incomp_System()) { + case DENSITY_BASED: + flowSolver = new CIncEulerSolver(geometry, config, iMGLevel); + flowSolver->Preprocessing(geometry, solver, config, iMGLevel, NO_RK_ITER, RUNTIME_FLOW_SYS, false); + break; + case PRESSURE_BASED: + flowSolver = new CPBIncEulerSolver(geometry, config, iMGLevel); + flowSolver->Preprocessing(geometry, solver, config, iMGLevel, NO_RK_ITER, RUNTIME_FLOW_SYS, false); + break; + } break; case SUB_SOLVER_TYPE::INC_NAVIER_STOKES: - flowSolver = new CIncNSSolver(geometry, config, iMGLevel); + switch (config->GetKind_Incomp_System()) { + case DENSITY_BASED: + flowSolver = new CIncNSSolver(geometry, config, iMGLevel); + break; + case PRESSURE_BASED: + flowSolver = new CPBIncNSSolver(geometry, config, iMGLevel); + break; + } break; default: SU2_MPI::Error("Flow solver not found", CURRENT_FUNCTION); diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 4d28cd695160..2ec3ab1941f7 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -372,7 +372,8 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai /*--- Set intermittency ---*/ if (transition) { - numerics->SetIntermittency(solver_container[TRANS_SOL]->GetNodes()->GetIntermittency(iPoint)); + //numerics->SetIntermittency(solver_container[TRANS_SOL]->GetNodes()->GetIntermittency(iPoint)); + numerics->SetIntermittency(solver_container[TRANS_SOL]->GetNodes()->GetGammaEff(iPoint)); } /*--- Turbulent variables w/o reconstruction, and its gradient ---*/ diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 7ddd84fa66d6..f7c3d91541b0 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -277,6 +277,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai CConfig *config, unsigned short iMesh) { const su2double a1 = constants[7]; + const bool transitionLM = (config->GetKind_Trans_Model() == LM); /*--- Compute turbulence gradients. ---*/ @@ -302,7 +303,7 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai Vorticity[1]*Vorticity[1] + Vorticity[2]*Vorticity[2]); - nodes->SetBlendingFunc(iPoint, mu, dist, rho); + nodes->SetBlendingFunc(iPoint, mu, dist, rho, transitionLM); su2double F2 = nodes->GetF2blending(iPoint); @@ -323,6 +324,7 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { CVariable* flowNodes = solver_container[FLOW_SOL]->GetNodes(); + const bool transitionLM = (config->GetKind_Trans_Model() == LM); /*--- Pick one numerics object per thread. ---*/ CNumerics* numerics = numerics_container[SOURCE_FIRST_TERM + omp_get_thread_num()*MAX_TERMS]; @@ -370,6 +372,11 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Cross diffusion ---*/ numerics->SetCrossDiff(nodes->GetCrossDiff(iPoint),0.0); + + /*--- Intermittency ---*/ + su2double gammaEff = 1.0; + if ( transitionLM ) gammaEff = solver_container[TRANS_SOL]->GetNodes()->GetGammaEff(iPoint); + numerics->SetGammaEff(gammaEff, 0.0); /*--- Compute the source term ---*/ diff --git a/SU2_CFD/src/solvers/CTurbSolver.cpp b/SU2_CFD/src/solvers/CTurbSolver.cpp index a949a384a55d..f598dd13cb9c 100644 --- a/SU2_CFD/src/solvers/CTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSolver.cpp @@ -45,6 +45,8 @@ CTurbSolver::CTurbSolver(CGeometry* geometry, CConfig *config) : CSolver() { /* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */ dynamic_grid = config->GetDynamic_Grid(); + + transitionSolver = false; #ifdef HAVE_OMP /*--- Get the edge coloring, see notes in CEulerSolver's constructor. ---*/ @@ -514,6 +516,7 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ const bool adjoint = config->GetContinuous_Adjoint() || (config->GetDiscrete_Adjoint() && config->GetFrozen_Visc_Disc()); const bool compressible = (config->GetKind_Regime() == COMPRESSIBLE); + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); CVariable* flowNodes = solver_container[FLOW_SOL]->GetNodes(); @@ -543,8 +546,9 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ /*--- Modify matrix diagonal to assure diagonal dominance ---*/ su2double Delta = Vol / ((nodes->GetLocalCFL(iPoint)/flowNodes->GetLocalCFL(iPoint))*flowNodes->GetDelta_Time(iPoint)); + if (pressure_based) Delta = Vol/(config->GetCFLRedCoeff_Turb()*flowNodes->GetDelta_Time(iPoint)); Jacobian.AddVal2Diag(iPoint, Delta); - + /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/ for (unsigned short iVar = 0; iVar < nVar; iVar++) { @@ -629,6 +633,24 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ break; } + if (transitionSolver) { + + //SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + + su2double density = flowNodes->GetDensity(iPoint); + su2double density_old = density; + + if (compressible) + density_old = flowNodes->GetSolution_Old(iPoint,0); + + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + nodes->AddConservativeSolution(iPoint, iVar, + nodes->GetUnderRelaxation(iPoint)*LinSysSol(iPoint,iVar), + density, density_old, lowerlimit[iVar], upperlimit[iVar]); + } + } + } } for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { @@ -1010,8 +1032,10 @@ void CTurbSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * bool incompressible = (config->GetKind_Regime() == INCOMPRESSIBLE); bool energy = config->GetEnergy_Equation(); bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); + bool pressure_based = (config->GetKind_Incomp_System() == PRESSURE_BASED); if (incompressible && ((!energy) && (!weakly_coupled_heat))) skipVars--; + if (pressure_based) skipVars++; /*--- Load data from the restart into correct containers. ---*/ diff --git a/SU2_CFD/src/variables/CPBIncEulerVariable.cpp b/SU2_CFD/src/variables/CPBIncEulerVariable.cpp new file mode 100644 index 000000000000..0ce73f05f339 --- /dev/null +++ b/SU2_CFD/src/variables/CPBIncEulerVariable.cpp @@ -0,0 +1,198 @@ +/*! + * \file variable_direct_mean_inc.cpp + * \brief Definition of the variable classes for incompressible flow. + * \author F. Palacios, T. Economon + * \version 6.0.1 "Falcon" + * + * The current SU2 release has been coordinated by the + * SU2 International Developers Society + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2018, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CPBIncEulerVariable.hpp" + +CPBIncEulerVariable::CPBIncEulerVariable(su2double density, su2double pressure, const su2double *velocity, unsigned long nPoint, + unsigned long ndim, unsigned long nvar, CConfig *config) : CVariable(nPoint, ndim, nvar, config), + Gradient_Reconstruction(config->GetReconstructionGradientRequired() ? Gradient_Aux : Gradient_Primitive) { + + bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); + bool viscous = config->GetViscous(); + bool axisymmetric = config->GetAxisymmetric(); + + /*--- Allocate and initialize the primitive variables and gradients ---*/ + + nPrimVar = nDim+4; nPrimVarGrad = nDim+2; + + /*--- Allocate residual structures ---*/ + + Res_TruncError.resize(nPoint,nVar) = su2double(0.0); + + /*--- Only for residual smoothing (multigrid) ---*/ + + for (unsigned long iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + if (config->GetMG_CorrecSmooth(iMesh) > 0) { + Residual_Sum.resize(nPoint,nVar); + Residual_Old.resize(nPoint,nVar); + break; + } + } + + /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ + + if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) + Undivided_Laplacian.resize(nPoint,nVar); + + /*--- Always allocate the slope limiter, + and the auxiliar variables (check the logic - JST with 2nd order Turb model - ) ---*/ + + Limiter_Primitive.resize(nPoint,nPrimVarGrad) = su2double(0.0); + + Limiter.resize(nPoint,nVar) = su2double(0.0); + + Solution_Max.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Min.resize(nPoint,nPrimVarGrad) = su2double(0.0); + + /*--- Solution initialization ---*/ + for(unsigned long iPoint=0; iPointGetReconstructionGradientRequired()) { + Gradient_Aux.resize(nPoint,nPrimVarGrad,nDim,0.0); + } + + if (config->GetLeastSquaresRequired()) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); + } + + /*--- If axisymmetric and viscous, we need an auxiliary gradient. ---*/ + + if (axisymmetric && viscous) Grad_AuxVar.resize(nPoint,nDim); + + Velocity2.resize(nPoint) = su2double(0.0); + Max_Lambda_Inv.resize(nPoint) = su2double(0.0); + Delta_Time.resize(nPoint) = su2double(0.0); + + /* Under-relaxation parameter. */ + UnderRelaxation.resize(nPoint) = su2double(1.0); + LocalCFL.resize(nPoint) = su2double(0.0); + + /* Non-physical point (first-order) initialization. */ + Non_Physical.resize(nPoint) = false; + Non_Physical_Counter.resize(nPoint) = 0; + + /*--- Store coefficients of momentum equation ---*/ + Mom_Coeff.resize(nPoint, nDim) = su2double(0.0); + Mom_Coeff_nb.resize(nPoint, nDim) = su2double(0.0); + + /*--- Strong BC flag ---*/ + strong_bc.resize(nPoint) = false; + + MassFlux.resize(nPoint) = su2double(0.0); +} + +bool CPBIncEulerVariable::SetPrimVar(unsigned long iPoint, su2double Density_Inf, CConfig *config) { + + unsigned long iVar; + bool check_dens = false, physical = true; + + /*--- Set the value of the density ---*/ + + check_dens = SetDensity(iPoint, Density_Inf); + + /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ + + SetVelocity(iPoint); + + return physical; + +} + +CPoissonVariable::CPoissonVariable(su2double val_SourceTerm, unsigned long nPoint, + unsigned short val_nDim, unsigned short val_nVar, + CConfig *config) : CVariable(nPoint, val_nDim, + val_nVar, + config) { + unsigned short iVar,iMesh ,nMGSmooth = 0; + + /*--- Allocate residual structures ---*/ + + Res_TruncError.resize(nPoint,nVar) = su2double(0.0); + + /*--- Only for residual smoothing (multigrid) ---*/ + + for (unsigned long iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + if (config->GetMG_CorrecSmooth(iMesh) > 0) { + Residual_Sum.resize(nPoint,nVar); + Residual_Old.resize(nPoint,nVar); + break; + } + } + + /*--- Gradient related fields ---*/ + + Gradient.resize(nPoint,val_nVar,val_nDim,0.0); + + if (config->GetLeastSquaresRequired()) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); + } + + /*--- Intitialize the source term of Poisson equation. ---*/ + + SourceTerm.resize(nPoint) = su2double(0.0); + Delta_Time.resize(nPoint) = su2double(0.0); + + for(unsigned long iPoint=0; iPoint + * with selected contributions from the open-source community. + * + * The main research teams contributing to the current release are: + * - Prof. Juan J. Alonso's group at Stanford University. + * - Prof. Piero Colonna's group at Delft University of Technology. + * - Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. + * - Prof. Alberto Guardone's group at Polytechnic University of Milan. + * - Prof. Rafael Palacios' group at Imperial College London. + * - Prof. Vincent Terrapon's group at the University of Liege. + * - Prof. Edwin van der Weide's group at the University of Twente. + * - Lab. of New Concepts in Aeronautics at Tech. Institute of Aeronautics. + * + * Copyright 2012-2019, Francisco D. Palacios, Thomas D. Economon, + * Tim Albring, and the SU2 contributors. + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/variables/CPBIncNSVariable.hpp" + +CPBIncNSVariable::CPBIncNSVariable(su2double val_density, su2double val_pressure, su2double *val_velocity, unsigned long nPoint, + unsigned short nDim, unsigned short nvar, CConfig *config) : + CPBIncEulerVariable(val_density, val_pressure, val_velocity, nPoint, nDim, nvar, config) { + + Vorticity.resize(nPoint,3); + StrainMag.resize(nPoint); + DES_LengthScale.resize(nPoint) = su2double(0.0); + Max_Lambda_Visc.resize(nPoint); +} + +bool CPBIncNSVariable::SetPrimVar(unsigned long iPoint, su2double Density_Inf, su2double Viscosity_Inf, su2double eddy_visc, su2double turb_ke, CConfig *config) { + + unsigned short iVar; + bool check_dens = false, physical = true; + + /*--- Set eddy viscosity locally and in the fluid model. ---*/ + SetEddyViscosity(iPoint, eddy_visc); + + /*--- Set the value of the density ---*/ + + check_dens = SetDensity(iPoint, Density_Inf); + + /*--- Set the value of the velocity and velocity^2 (requires density) ---*/ + + SetVelocity(iPoint); + + /*--- Set laminar viscosity ---*/ + + SetLaminarViscosity(iPoint, Viscosity_Inf); + + return physical; +} + + +bool CPBIncNSVariable::SetVorticity_StrainMag(void) { + + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { + + /*--- Vorticity ---*/ + + Vorticity(iPoint,0) = 0.0; Vorticity(iPoint,1) = 0.0; + + Vorticity(iPoint,2) = Gradient_Primitive(iPoint,2,0)-Gradient_Primitive(iPoint,1,1); + + if (nDim == 3) { + Vorticity(iPoint,0) = Gradient_Primitive(iPoint,3,1)-Gradient_Primitive(iPoint,2,2); + Vorticity(iPoint,1) = -(Gradient_Primitive(iPoint,3,0)-Gradient_Primitive(iPoint,1,2)); + } + + /*--- Strain Magnitude ---*/ + su2double Div = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Div += Gradient_Primitive(iPoint,iDim+1,iDim); + + StrainMag(iPoint) = 0.0; + + /*--- Add diagonal part ---*/ + + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + StrainMag(iPoint) += pow(Gradient_Primitive(iPoint,iDim+1,iDim) - 1.0/3.0*Div, 2.0); + } + if (nDim == 2) { + StrainMag(iPoint) += pow(1.0/3.0*Div, 2.0); + } + + /*--- Add off diagonals ---*/ + + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,1,1) + Gradient_Primitive(iPoint,2,0)), 2); + + if (nDim == 3) { + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,1,2) + Gradient_Primitive(iPoint,3,0)), 2); + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,2,2) + Gradient_Primitive(iPoint,3,1)), 2); + } + + StrainMag(iPoint) = sqrt(2.0*StrainMag(iPoint)); + + } + return false; +} diff --git a/SU2_CFD/src/variables/CTransLMVariable.cpp b/SU2_CFD/src/variables/CTransLMVariable.cpp index df4157d9df2d..0c3b4ed46f79 100644 --- a/SU2_CFD/src/variables/CTransLMVariable.cpp +++ b/SU2_CFD/src/variables/CTransLMVariable.cpp @@ -28,7 +28,7 @@ #include "../../include/variables/CTransLMVariable.hpp" - +/* develop version CTransLMVariable::CTransLMVariable(su2double intermittency, su2double REth, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config) : CTurbVariable(npoint, ndim, nvar, config) { @@ -42,4 +42,40 @@ CTransLMVariable::CTransLMVariable(su2double intermittency, su2double REth, unsi Set_BGSSolution_k(); gamma_sep.resize(nPoint); +}*/ + +// LM branch modified +//CTransLMVariable::CTransLMVariable(void) : CTurbVariable() {} + +CTransLMVariable::CTransLMVariable(const su2double val_intermittency, + const su2double val_REth, + const unsigned long val_nPoint, + const unsigned long val_nDim, + const unsigned long val_nvar, + CConfig *config) +: CTurbVariable(val_nPoint, val_nDim, val_nvar, config) { + + bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND)); + + gamma_sep.resize(nPoint) = val_intermittency; + /* Initialization of variables */ + for (unsigned long iPoint=0; iPoint 130.89969389957471 rad/s +ROTATION_RATE = 0.0 0.0 1990.00 +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +%NUM_METHOD_GRAD= GREEN_GAUSS +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 1 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, CFL max value ) +CFL_ADAPT_PARAM= ( 0.3, 0.4, 10.0, 1000.0) +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +% Linear solver or smoother for implicit formulations (BCGSTAB, FGMRES, SMOOTHER) +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) +LINEAR_SOLVER_PREC= LU_SGS +% +% Min error of the linear solver for the implicit formulation +LINEAR_SOLVER_ERROR= 1E-4 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 5 +% +% ----------------------- SLOPE LIMITER DEFINITION ----------------------------% +% +% Coefficient for the limiter +VENKAT_LIMITER_COEFF= 0.1 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, JST_KE, JST_MAT, LAX-FRIEDRICH, CUSP, ROE, AUSM, +% AUSMPLUSUP, AUSMPLUSUP2, AUSMPWPLUS, HLLC, TURKEL_PREC, +% SW, MSW, FDS, SLAU, SLAU2, L2ROE, LMROE, UDS) +CONV_NUM_METHOD_FLOW= UDS +% +% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE) +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Slope limiter (VENKATAKRISHNAN) +SLOPE_LIMITER_TURB= NONE +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT +% +% Reduction factor of the CFL coefficient in the turbulence problem +CFL_REDUCTION_TURB= 0.01 +% +% Number of iterations for the poisson solver +LINEAR_SOLVER_ITER_POISSON = 20 +% +% Number of iterations for the flow solver +LINEAR_SOLVER_ITER_FLOW = 20 +% +% Relaxation factor for pressure solution +RELAXATION_FACTOR_PBFLOW= 1.0 +% +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Number of total iterations +ITER=1500 +% +% Convergence criteria (CAUCHY, RESIDUAL) +CONV_CRITERIA= RESIDUAL +% +% Flow functional for the Residual criteria (RHO, RHO_ENERGY) +% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -16 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 100 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= su2mesh.su2 +%MESH_FILENAME= centrifugal_blade_tet.su2 +% +% Mesh input file format (SU2, CGNS) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= su2mesh_per.su2 +% +% Restart flow input file +SOLUTION_FILENAME= restart_flow.dat +% +% Output file format (PARAVIEW, TECPLOT, STL) +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +WRT_SOL_FREQ= 500 +% +% Writing convergence history frequency +WRT_CON_FREQ= 1 +% +WRT_FORCES_BREAKDOWN= YES +% +SCREEN_OUTPUT= INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX +% +VOLUME_OUTPUT= COORDINATES, SOLUTION, PRIMITIVE +% +BREAKDOWN_FILENAME= forces_breakdown.dat + + diff --git a/TestCases/pressure_based/channel/channel_visc.cfg b/TestCases/pressure_based/channel/channel_visc.cfg new file mode 100644 index 000000000000..2aec3f1ff88f --- /dev/null +++ b/TestCases/pressure_based/channel/channel_visc.cfg @@ -0,0 +1,225 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Incompressible and laminar channel flow % +% Author: Akshay Koodly % +% Institution: University of Twente % +% File Version 7.0.7 "Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= INC_NAVIER_STOKES +% +% Incompressible solver (DENSITY_BASED, PRESSURE_BASED) +% DENSITY_BASED is chosen by default +KIND_INCOMP_SYSTEM= PRESSURE_BASED +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +% Density model within the incompressible flow solver. +% Options are CONSTANT (default), BOUSSINESQ, or VARIABLE. If VARIABLE, +% an appropriate fluid model must be selected. +INC_DENSITY_MODEL= CONSTANT +% +% Solve the energy equation in the incompressible flow solver +INC_ENERGY_EQUATION = NO +% +% Initial density for incompressible flows (1.2886 kg/m^3 by default) +INC_DENSITY_INIT= 1.0 +% +% Reference density for incompressible flows (1.0 kg/m^3 by default) +INC_DENSITY_REF= 1.0 +% +% Reference velocity for incompressible flows (1.0 m/s by default) +INC_VELOCITY_REF= 1.0 +% +% Reference temperature for incompressible flows that include the +% energy equation (1.0 K by default) +INC_TEMPERATURE_REF = 1.0 +% Initial velocity for incompressible flows (1.0,0,0 m/s by default) +INC_VELOCITY_INIT= ( 1.0, 0.0, 0.0 ) + +% Non-dimensionalization scheme for incompressible flows. Options are +% INITIAL_VALUES (default), REFERENCE_VALUES, or DIMENSIONAL. +% INC_*_REF values are ignored unless REFERENCE_VALUES is chosen. +%INC_NONDIM= INITIAL_VALUES +% +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity thsat would be constant (1.716E-5 by default) +MU_CONSTANT= 2.5E-3 +% +% +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------% +% +% Euler wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( wall,0.0 ) +% +% Incompressible: (inlet marker, NULL, velocity magnitude, flow_direction_x, +% flow_direction_y, flow_direction_z, ... ) where flow_direction is +% a unit vector. +MARKER_INLET= (inlet, 0.0, 1.0, 1.0, 0.0, 0.0 ) +% +INC_INLET_TYPE= VELOCITY_INLET +% +% Outlet boundary marker(s) (NONE = no marker) +MARKER_OUTLET= ( outlet, 0.0 ) +% +INC_OUTLET_TYPE= PRESSURE_OUTLET +% +% Symmetry boundary marker(s) (NONE = no marker) +MARKER_SYM= ( symmetry) +% +% Marker(s) of the surface that is going to be analyzed in detail (massflow, average pressure, distortion, etc) +MARKER_ANALYZE = ( inlet, outlet ) +% +MARKER_PLOTTING= ( wall ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( wall) + +% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= GREEN_GAUSS +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 4.0 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Runge-Kutta alpha coefficients +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +% +% Number of total iterations +ITER= 15000 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +% Linear solver or smoother for implicit formulations (BCGSTAB, FGMRES, SMOOTHER_JACOBI, +% SMOOTHER_ILU, SMOOTHER_LUSGS, +% SMOOTHER_LINELET) +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) +LINEAR_SOLVER_PREC= LU_SGS +% +% Linael solver ILU preconditioner fill-in level (0 by default) +LINEAR_SOLVER_ILU_FILL_IN= 0 +% +% Minimum error of the linear solver for implicit formulations +LINEAR_SOLVER_ERROR= 1E-12 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, JST_KE, JST_MAT, LAX-FRIEDRICH, CUSP, ROE, AUSM, +% AUSMPLUSUP, AUSMPLUSUP2, AUSMPWPLUS, HLLC, TURKEL_PREC, +% SW, MSW, FDS, SLAU, SLAU2, L2ROE, LMROE, UDS) +CONV_NUM_METHOD_FLOW= UDS +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= NONE +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.05 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% Number of iterations for the poisson solver +LINEAR_SOLVER_ITER_POISSON = 30 +% +% Number of iterations for the flow solver +LINEAR_SOLVER_ITER_FLOW = 30 +RELAXATION_FACTOR_PBFLOW= 1.0 +RELAXATION_FACTOR_RHIECHOW= 1.0 +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +%1 +% Convergence criteria (CAUCHY, RESIDUAL) +% +CONV_FIELD= RMS_VELOCITY-X +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -14 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= channel_y0125_fine.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= restart_flow +% +% Output file format (PARAVIEW, TECPLOT, SLT) +TABULAR_FORMAT= CSV + +OUTPUT_FILES= PARAVIEW, RESTART, SURFACE_PARAVIEW +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +WRT_SOL_FREQ= 250 +% +% Writing convergence history frequency +WRT_CON_FREQ= 1 + +SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX, LIFT,DRAG) +%SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX, RMS_NU_TILDE, LIFT,DRAG) diff --git a/TestCases/pressure_based/couette_flow/couette_flow.cfg b/TestCases/pressure_based/couette_flow/couette_flow.cfg new file mode 100644 index 000000000000..1bf8a56cbeb7 --- /dev/null +++ b/TestCases/pressure_based/couette_flow/couette_flow.cfg @@ -0,0 +1,223 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Couette flow (co-rotating discs % +% Author: Akshay Koodly % +% Institution: University of Twente % +% File Version 7.0.7 "Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= INC_NAVIER_STOKES +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% +% If Navier-Stokes, kind of turbulent model (NONE, SA) +KIND_TURB_MODEL= NONE + +KIND_INCOMP_SYSTEM= PRESSURE_BASED + +% -------------------- INCOMPRESSIBLE FREE-STREAM DEFINITION ------------------% +% +% Initial density for incompressible flows +% (1.2886 kg/m^3 by default (air), 998.2 Kg/m^3 (water)) +INC_DENSITY_INIT= 1.0 +% +% Initial velocity for incompressible flows (1.0,0,0 m/s by default) +INC_VELOCITY_INIT= ( 0.0, 0.0, 0.0 ) +% +% Non-dimensionalization scheme for incompressible flows. Options are +% INITIAL_VALUES (default), REFERENCE_VALUES, or DIMENSIONAL. +% INC_*_REF values are ignored unless REFERENCE_VALUES is chosen. +INC_NONDIM= REFERENCE_VALUES +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity that would be constant (1.716E-5 by default) +% Re : 1 +MU_CONSTANT= 1 +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% ----------------------- DYNAMIC MESH DEFINITION -----------------------------% + +% Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, +% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, EXTERNAL) +SURFACE_MOVEMENT= MOVING_WALL + +MARKER_MOVING= Inner_cylinder +% +% +% Coordinates of the motion origin +SURFACE_MOTION_ORIGIN = 0.0 0.0 0.0 +% +% Angular velocity vector (rad/s) about the motion origin +SURFACE_ROTATION_RATE = 0.0 1.0 0.0 +%SURFACE_ROTATION_RATE = 0.0 0.0 1.0 + +% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------% +% +% Marker of the Euler boundary (0 = no marker) +%Non-periodic case +%MARKER_HEATFLUX= ( inner_cylinder, 0.0, outer_cylinder, 0.0 ) +%Periodic case +MARKER_HEATFLUX= ( Inner_cylinder, 0.0, Outer_cylinder, 0.0 ) + +MARKER_SYM= ( Symmetry) + +MARKER_PERIODIC= (Periodic1,Periodic2, 0.0,0.0,0.0, 0.0,-120,0.0, 0.0,0.0,0.0) +%MARKER_PERIODIC= (Periodic1,Periodic2, 0.0,0.0,0.0, 0.0,0,120.0, 0.0,0.0,0.0) +% +% ------------------------ SURFACES IDENTIFICATION ----------------------------% +% +% Marker(s) of the surface in the surface flow solution file +MARKER_PLOTTING = ( Periodic1,Periodic2) +% +% Marker(s) of the surface where the non-dimensional coefficients are evaluated. +MARKER_MONITORING = ( Inner_cylinder, Outer_cylinder ) +% + +% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +%NUM_METHOD_GRAD_RECON= WEIGHTED_LEAST_SQUARES +NUM_METHOD_GRAD= GREEN_GAUSS +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER=5.0 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Runge-Kutta alpha coefficients +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +% + +RELAXATION_FACTOR_PBFLOW= 1.0 +RELAXATION_FACTOR_RHIECHOW= 0.0 +LINEAR_SOLVER_ITER_POISSON = 20 +LINEAR_SOLVER_ITER_FLOW = 20 +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +% Linear solver for implicit formulations (BCGSTAB, FGMRES) +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver (JACOBI, LINELET, LU_SGS) +LINEAR_SOLVER_PREC= LU_SGS +% +% Minimum error of the linear solver for implicit formulations +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 25 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 0 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= W_CYCLE +% +% Multi-Grid PreSmoothing Level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-Grid PostSmoothing Level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.95 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.95 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +%CONV_NUM_METHOD_FLOW= FDS +CONV_NUM_METHOD_FLOW= UDS +% +% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) +% +MUSCL_FLOW= YES +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Number of total iterations +ITER= 10000 +% +% Convergence criteria (CAUCHY, RESIDUAL) +CONV_FIELD= RESIDUAL +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -10 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= couette_per.su2 +%MESH_FILENAME= couette_per2d.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= restart_flow.dat +% +%Output file format(CSV, TECPLOT) +TABULAR_FORMAT= CSV +% +% Output file format (PARAVIEW, TECPLOT, STL) +OUTPUT_FILES= PARAVIEW, SURFACE_PARAVIEW, RESTART +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flowpbhex_per +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +WRT_SOL_FREQ= 25 +% +% Writing convergence history frequency +WRT_CON_FREQ= 1 + +SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, LIFT,DRAG) diff --git a/TestCases/pressure_based/cylinder/lam_cylinder.cfg b/TestCases/pressure_based/cylinder/lam_cylinder.cfg new file mode 100755 index 000000000000..8fef1010daa2 --- /dev/null +++ b/TestCases/pressure_based/cylinder/lam_cylinder.cfg @@ -0,0 +1,243 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Steady incompressible laminar flow around a cylinder % +% Author: Akshay Koodly % +% Institution: University of Twente % +% File Version 7.0.7 "Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= INC_NAVIER_STOKES + +% +% +KIND_INCOMP_SYSTEM= PRESSURE_BASED + + +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO + +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +% Initial density for incompressible flows (1.2886 kg/m^3 by default) +INC_DENSITY_INIT= 1.0 +% +% Initial velocity for incompressible flows (1.0,0,0 m/s by default) +%INC_VELOCITY_INIT= ( 0.76604444311, 0.64278760968, 0.0 ) +INC_VELOCITY_INIT= ( 1.0, 0.0, 0.0 ) + +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity that would be constant (1.716E-5 by default) +MU_CONSTANT= 0.025 +% +% Sutherland Viscosity Ref (1.716E-5 default value for AIR SI) +MU_REF= 1.716E-5 +% +% Sutherland Temperature Ref (273.15 K default value for AIR SI) +MU_T_REF= 273.15 +% +% Sutherland constant (110.4 default value for AIR SI) +SUTHERLAND_CONSTANT= 110.4 +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +%PRESSURE_REF_COORD= (10.0, 10.0, 0.0) + +%PRESSURE_REF= 0.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( cylinder, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( farfield ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( cylinder ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( cylinder ) + +MARKER_ANALYZE = ( farfield) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= GREEN_GAUSS +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER=1.0 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 10.0, 100.0 ) +% +% Runge-Kutta alpha coefficients +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +% +% Number of total iterations +ITER= 25000 +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +% Linear solver or smoother for implicit formulations (BCGSTAB, FGMRES, SMOOTHER_JACOBI, +% SMOOTHER_ILU, SMOOTHER_LUSGS, +% SMOOTHER_LINELET) +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) +LINEAR_SOLVER_PREC= ILU +% +% Linael solver ILU preconditioner fill-in level (0 by default) +LINEAR_SOLVER_ILU_FILL_IN= 0 +% +% Minimum error of the linear solver for implicit formulations +LINEAR_SOLVER_ERROR= 1E-12 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 0 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= V_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 1, 1, 1, 1 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.75 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.75 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= UDS +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, +% BARTH_JESPERSEN, VAN_ALBADA_EDGE) +SLOPE_LIMITER_FLOW= NONE +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT +LINEAR_SOLVER_ITER_POISSON = 25 +LINEAR_SOLVER_ITER_FLOW = 25 +RELAXATION_FACTOR_PBFLOW= 0.5 +RELAXATION_FACTOR_RHIECHOW= 1.0 + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Convergence criteria (CAUCHY, RESIDUAL) +% +CONV_FIELD= RMS_VELOCITY-X +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -12 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +%MESH_FILENAME= ../mesh/mesh_cylinder_lam_65.su2 +%MESH_FILENAME= ../mesh/mesh_cylinder_lam_129.su2 +MESH_FILENAME= ../mesh/mesh_cylinder_lam_257.su2 +%MESH_FILENAME= ../mesh/mesh_cylinder_lam_513.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Restart flow input file +SOLUTION_FILENAME= restart_flow +% +% Output file format (PARAVIEW, TECPLOT) +TABULAR_FORMAT= CSV +% +OUTPUT_FILES= RESTART PARAVIEW SURFACE_PARAVIEW +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +WRT_SOL_FREQ= 200 +% +% Writing convergence history frequency +WRT_CON_FREQ= 1 + +SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX, LIFT,DRAG) +% +%1.547135 +%1.517068 +%1.505034 +%1.501479 diff --git a/TestCases/pressure_based/flatplate_turb/turb_flatplate.cfg b/TestCases/pressure_based/flatplate_turb/turb_flatplate.cfg new file mode 100755 index 000000000000..872f63084e0b --- /dev/null +++ b/TestCases/pressure_based/flatplate_turb/turb_flatplate.cfg @@ -0,0 +1,298 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Turbulent flow over flat plate with zero pressure gradient % +% Author: Akshay Koodly % +% Institution: University of Twente % +% File Version 7.0.7 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= INC_RANS +% +% If Navier-Stokes, kind of turbulent model (NONE, SA) +KIND_TURB_MODEL= SA + +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL=NO +% +% Incompressible solver (DENSITY_BASED, PRESSURE_BASED) +% DENSITY_BASED is chosen by default +KIND_INCOMP_SYSTEM= PRESSURE_BASED + +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +% Density model within the incompressible flow solver. +% Options are CONSTANT (default), BOUSSINESQ, or VARIABLE. If VARIABLE, +% an appropriate fluid model must be selected. +INC_DENSITY_MODEL= CONSTANT +% +% Solve the energy equation in the incompressible flow solver +INC_ENERGY_EQUATION = NO +% +% Initial density for incompressible flows (1.2886 kg/m^3 by default) +INC_DENSITY_INIT= 1.32905 +% +% Initial velocity for incompressible flows (1.0,0,0 m/s by default) +INC_VELOCITY_INIT= ( 69.4448, 0.0, 0.0 ) +% +% Initial temperature for incompressible flows that include the +% energy equation (288.15 K by default). Value is ignored if +% INC_ENERGY_EQUATION is false. +INC_TEMPERATURE_INIT= 300.0 +% +% Non-dimensionalization scheme for incompressible flows. Options are +% INITIAL_VALUES (default), REFERENCE_VALUES, or DIMENSIONAL. +% INC_*_REF values are ignored unless REFERENCE_VALUES is chosen. +INC_NONDIM= INITIAL_VALUES +% +% Reference density for incompressible flows (1.0 kg/m^3 by default) +INC_DENSITY_REF= 1.0 +% +% Reference velocity for incompressible flows (1.0 m/s by default) +INC_VELOCITY_REF= 1.0KIND_PB_ITER=PISO +% +% Reference temperature for incompressible flows that include the +% energy equation (1.0 K by default) +INC_TEMPERATURE_REF = 1.0 +% +% List of inlet types for incompressible flows. List length must +% match number of inlet markers. Options: VELOCITY_INLET, PRESSURE_INLET. +INC_INLET_TYPE= VELOCITY_INLET + +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity that would be constant (1.716E-5 by default) +MU_CONSTANT= 1.84592e-05 +% +% Sutherland Viscosity Ref (1.716E-5 default value for AIR SI) +MU_REF= 1.716E-5 +% +% Sutherland Temperature Ref (273.15 K default value for AIR SI) +MU_T_REF= 273.15 +% +% Sutherland constant (110.4 default value for AIR SI) +SUTHERLAND_CONSTANT= 110.4 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 2.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( wall, 0.0 ) +% +% Inlet boundary marker(s) (NONE = no marker) +% Format: ( inlet marker, total temperature, total pressure, flow_direction_x, +% flow_direction_y, flow_direction_z, ... ) +MARKER_INLET= ( inlet, 300.0, 69.4448, 1.0, 0.0, 0.0 ) +% +% Outlet boundary marker(s) (NONE = no marker) +% Format: ( outlet marker, back pressure, ... ) +MARKER_OUTLET= ( outlet, 0.0, farfield, 0.0 ) +% +INC_OUTLET_TYPE= PRESSURE_OUTLET,PRESSURE_OUTLET +% +% Symmetry boundary marker(s) (NONE = no marker) +MARKER_SYM= ( symmetry ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( wall ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( wall ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, LEAST_SQUARES, +% WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= GREEN_GAUSS +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 1 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Runge-Kutta alpha coefficients +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +% +% Number of total iterations +ITER= 15000 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +% Linear solver for implicit formulations (BCGSTAB, FGMRES) +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver (JACOBI, LINELET, LU_SGS) +LINEAR_SOLVER_PREC= ILU +% +% Linael solver ILU preconditioner fill-in level (0 by default) +LINEAR_SOLVER_ILU_FILL_IN= 0 +% +% Minimum error of the linear solver for implicit formulations +LINEAR_SOLVER_ERROR= 1E-12 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 + +% ----------------------- SLOPE LIMITER DEFINITION ----------------------------% +% +% Coefficient for the limiter +VENKAT_LIMITER_COEFF= 0.1 +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% Reference coefficient (sensitivity) for detecting sharp edges. +REF_SHARP_EDGES= 3.0 +% +% Remove sharp edges from the sensitivity evaluation (NO, YES) +SENS_REMOVE_SHARP= NO + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 0 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= V_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 1, 1, 1 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.8 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.8 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, JST_KE, JST_MAT, LAX-FRIEDRICH, CUSP, ROE, AUSM, +% AUSMPLUSUP, AUSMPLUSUP2, AUSMPWPLUS, HLLC, TURKEL_PREC, +% SW, MSW, FDS, SLAU, SLAU2, L2ROE, LMROE, UDS) +CONV_NUM_METHOD_FLOW= UDS +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, +% BARTH_JESPERSEN, VAN_ALBADA_EDGE) +SLOPE_LIMITER_FLOW= NONE +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT +% +% Number of iterations for the poisson solver +LINEAR_SOLVER_ITER_POISSON = 25 +% +% Number of iterations for the flow solver +LINEAR_SOLVER_ITER_FLOW = 25 + +RELAXATION_FACTOR_PBFLOW= 1.0 +RELAXATION_FACTOR_RHIECHOW= 1.0 + + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Convergence criteria (CAUCHY, RESIDUAL) +% +CONV_FIELD= RMS_VELOCITY-X +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -14 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= mesh/mesh_flatplate_turb_69x49.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= restart_flowo2 +% +% Output file format (PARAVIEW, TECPLOT, SLT) +TABULAR_FORMAT= CSV + +OUTPUT_FILES= PARAVIEW, RESTART, SURFACE_PARAVIEW +% +% Output file convergence history (w/o extension) +CONV_FILENAME= historyc1l4 +% +% Output file restart flow +RESTART_FILENAME= restart_flowo2 +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow_l4o2 +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow_l4o2 +% +% Writing solution file frequency +WRT_SOL_FREQ= 250 +% +% Writing convergence history frequency +WRT_CON_FREQ= 1 + +%SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX, RMS_TKE, LIFT,DRAG) +SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX, RMS_NU_TILDE, LIFT,DRAG) diff --git a/TestCases/pressure_based/lid_driven_cavity/liddrivencavity.cfg b/TestCases/pressure_based/lid_driven_cavity/liddrivencavity.cfg new file mode 100644 index 000000000000..9c82dd8a9023 --- /dev/null +++ b/TestCases/pressure_based/lid_driven_cavity/liddrivencavity.cfg @@ -0,0 +1,297 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Incompressible and laminar lid driven cavity % +% Author: Akshay Koodly % +% Institution: University of Twente % +% File Version 7.0.7 "Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) + +SOLVER= INC_NAVIER_STOKES +% +% Incompressible solver (DENSITY_BASED, PRESSURE_BASED) +% DENSITY_BASED is chosen by default +KIND_INCOMP_SYSTEM= PRESSURE_BASED +% +% Gravity force (NO, YES) +GRAVITY_FORCE= NO +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO + +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +% Density model within the incompressible flow solver. +% Options are CONSTANT (default), BOUSSINESQ, or VARIABLE. If VARIABLE, +% an appropriate fluid model must be selected. +INC_DENSITY_MODEL= CONSTANT +% +% Solve the energy equation in the incompressible flow solver +INC_ENERGY_EQUATION = NO +% +% Initial density for incompressible flows (1.2886 kg/m^3 by default) +INC_DENSITY_INIT= 1.0 +% +% Reference density for incompressible flows (1.0 kg/m^3 by default) +INC_DENSITY_REF= 1.0 +% +% Reference velocity for incompressible flows (1.0 m/s by default) +INC_VELOCITY_REF= 1.0 +% +% Reference temperature for incompressible flows that include the +% energy equation (1.0 K by default) +INC_TEMPERATURE_REF = 1.0 +% Initial velocity for incompressible flows (1.0,0,0 m/s by default) +INC_VELOCITY_INIT= ( 1.0, 0.0, 0.0 ) + +% Non-dimensionalization scheme for incompressible flows. Options are +% INITIAL_VALUES (default), REFERENCE_VALUES, or DIMENSIONAL. +% INC_*_REF values are ignored unless REFERENCE_VALUES is chosen. +%INC_NONDIM= REFERENCE_VALUES +% +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity thsat would be constant (1.716E-5 by default) +MU_CONSTANT= 2.5E-3 +% +% +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------% +% +% Euler wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( Bottom,0.0 , Left, 0.0, Right, 0.0, Top, 0.0) +% +% Incompressible: (inlet marker, NULL, velocity magnitude, flow_direction_x, +% flow_direction_y, flow_direction_z, ... ) where flow_direction is +% a unit vector. +%MARKER_INLET= (Left, 0.0, 1.0, 1.0, 0.0, 0.0 ) +% +%INC_INLET_TYPE= VELOCITY_INLET +% +% Outlet boundary marker(s) (NONE = no marker) +%MARKER_OUTLET= ( Right, 0.0,Top, 0.0, Bottom, 0.0 ) +% +%INC_OUTLET_TYPE= PRESSURE_OUTLET, OPEN, OPEN +% Outlet boundary marker(s) (NONE = no marker) +%MARKER_OUTLET= ( Right, 0.0, Top, 0.0 ) +% +%INC_OUTLET_TYPE= PRESSURE_OUTLET,PRESSURE_OUTLET +% +% Symmetry boundary marker(s) (NONE = no marker) +%MARKER_EULER= ( Bottom) +% +%MARKER_SYM= (Bottom) +% Marker(s) of the surface that is going to be analyzed in detail (massflow, average pressure, distortion, etc) +%MARKER_ANALYZE = ( Left, Right, Top, Bottom ) + +% Method to compute the average value in MARKER_ANALYZE (AREA, MASSFLUX). +%MARKER_ANALYZE_AVERAGE = AREA + +%MARKER_PLOTTING= ( Bottom, Top ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( Bottom, Top) + +% ----------------------- DYNAMIC MESH DEFINITION -----------------------------% + +% Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, +% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, EXTERNAL) +SURFACE_MOVEMENT= MOVING_WALL + +MARKER_MOVING= Top +% +% +% Coordinates of the motion origin +SURFACE_MOTION_ORIGIN = 0.0 0.0 0.0 +% +% Angular velocity vector (rad/s) about the motion origin +SURFACE_ROTATION_RATE = 0.0 0.0 0.0 +SURFACE_TRANSLATION_RATE = 1.0 0.0 0.0 + +% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +%NUM_METHOD_GRAD= GREEN_GAUSS +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 1.0 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +% +% Runge-Kutta alpha coefficients +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +% +% Number of total iterations +EXT_ITER= 10000 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-Grid Levels (0 = no multi-grid) +MGLEVEL= 0 +% +% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) +MGCYCLE= V_CYCLE +% +% Multi-grid pre-smoothing level +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +% +% Multi-grid post-smoothing level +MG_POST_SMOOTH= ( 1, 1, 1, 1 ) +% +% Jacobi implicit smoothing of the correction +MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) +% +% Damping factor for the residual restriction +MG_DAMP_RESTRICTION= 0.85 +% +% Damping factor for the correction prolongation +MG_DAMP_PROLONGATION= 0.85 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +% Linear solver for implicit formulations (BCGSTAB, FGMRES) +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver (JACOBI, LINELET, LU_SGS) +LINEAR_SOLVER_PREC= LU_SGS +% +% Minimum error of the linear solver for implicit formulations +LINEAR_SOLVER_ERROR= 1E-6 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 20 +% +% Number of iterations for the poisson solver +LINEAR_SOLVER_ITER_POISSON= 50 +% +% Number of iterations for the flow solver +LINEAR_SOLVER_ITER_FLOW= 25 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, JST_KE, JST_MAT, LAX-FRIEDRICH, CUSP, ROE, AUSM, +% AUSMPLUSUP, AUSMPLUSUP2, AUSMPWPLUS, HLLC, TURKEL_PREC, +% SW, MSW, FDS, SLAU, SLAU2, L2ROE, LMROE, UDS) +CONV_NUM_METHOD_FLOW= UDS +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= NONE +% +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 0.03 +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% Convergence criteria (CAUCHY, RESIDUAL) +% +CONV_CRITERIA= RESIDUAL +% +% Residual reduction (order of magnitude with respect to the initial value) +RESIDUAL_REDUCTION= 7 +% +% Min value of the residual (log10 of the residual) +RESIDUAL_MINVAL= -10 +% +% Start Cauchy criteria at iteration number +STARTCONV_ITER= 10 +% +% Number of elements to apply the criteria +CAUCHY_ELEMS= 50 +% +% Epsilon to control the series convergence +CAUCHY_EPS= 1E-6 +% +% Function to apply the criteria (LIFT, DRAG, SENS_GEOMETRY, SENS_MACH, +% DELTA_LIFT, DELTA_DRAG) +CAUCHY_FUNC_FLOW= DRAG + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +%MESH_FILENAME= Square_8x8.su2 +MESH_FILENAME= ../Square_65x65.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Restart flow input file +SOLUTION_FLOW_FILENAME= restart_flow.dat +% +% Output file format (PARAVIEW, TECPLOT) +OUTPUT_FORMAT= PARAVIEW +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history15_25 +% +% Output file restart flow +RESTART_FLOW_FILENAME= restart_flow.dat +% +% Output file flow (w/o extension) variables +VOLUME_FLOW_FILENAME= squaredb128 +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FLOW_FILENAME= surface_flow +% +% Writing solution file frequency +WRT_SOL_FREQ= 50 +% +% Writing convergence history frequency +WRT_CON_FREQ= 1 +% Write binary restart files (YES, NO) +WRT_BINARY_RESTART= NO +READ_BINARY_RESTART= NO +WRT_PERFORMANCE= YES diff --git a/TestCases/pressure_based/turb_naca0012/turb_naca0012_v7.cfg b/TestCases/pressure_based/turb_naca0012/turb_naca0012_v7.cfg new file mode 100644 index 000000000000..16e984666ad7 --- /dev/null +++ b/TestCases/pressure_based/turb_naca0012/turb_naca0012_v7.cfg @@ -0,0 +1,247 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: 2D NACA 0012 Airfoil Validation Case (incompressible) % +% http://turbmodels.larc.nasa.gov/naca0012_val_sa.html % +% Author: Akshay Koodly % +% Institution: University of Twente % +% File Version 7.0.7 "Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= INC_RANS +% +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= SST +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% +% Incompressible solver (DENSITY_BASED, PRESSURE_BASED) +% DENSITY_BASED is chosen by default +%KIND_INCOMP_SYSTEM= PRESSURE_BASED +% -------------------- INCOMPRESSIBLE FREE-STREAM DEFINITION ------------------% +% +% Free-stream density (1.2886 Kg/m^3 (air), 998.2 Kg/m^3 (water)) +INC_DENSITY_INIT= 2.13163 +% +% Initial velocity for incompressible flows (1.0,0,0 m/s by default) +% +% AoA 0.0 deg +INC_VELOCITY_INIT= ( 52.1572, 0.0, 0.0 ) + +% AoA 4.0 deg +INC_VELOCITY_INIT= ( 52.0301476822, 3.63830235237, 0.0 ) +% +% AoA 10 deg +%INC_VELOCITY_INIT= ( 51.36481493540834, 9.0570027322096198, 0.0 ) +% +% AoA 15 deg +%INC_VELOCITY_INIT= (50.3799865069, 13.4992766992, 0.0 ) +% Non-dimensionalization scheme for incompressible flows. Options are +% INITIAL_VALUES (default), REFERENCE_VALUES, or DIMENSIONAL. +% INC_*_REF values are ignored unless REFERENCE_VALUES is chosen. +INC_NONDIM= INITIAL_VALUES +% +% Reference density for incompressible flows (1.0 kg/m^3 by default) +INC_DENSITY_REF= 1.0 +% +% Reference velocity for incompressible flows (1.0 m/s by default) +INC_VELOCITY_REF= 1.0 +% +% Reference temperature for incompressible flows that include the +% energy equation (1.0 K by default) +INC_TEMPERATURE_REF = 1.0 +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity that would be constant (1.716E-5 by default) +MU_CONSTANT= 1.853e-05 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +% +% Reference length for pitching, rolling, and yawing non-dimensional moment +REF_LENGTH= 1.0 +% +% Reference area for force coefficients (0 implies automatic calculation) +REF_AREA= 1.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes wall boundary marker(s) (NONE = no marker) +MARKER_HEATFLUX= ( airfoil, 0.0 ) +% +% Farfield boundary marker(s) (NONE = no marker) +MARKER_FAR= ( farfield-1, farfield-2 ) +% +% Marker(s) of the surface to be plotted or designed +MARKER_PLOTTING= ( airfoil ) +% +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= ( airfoil ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= GREEN_GAUSS +% +% Courant-Friedrichs-Lewy condition of the finest grid +CFL_NUMBER= 1 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Parameters of the adaptive CFL number (factor down, factor up, CFL min value, +% CFL max value ) +CFL_ADAPT_PARAM= ( 1.5, 0.5, 10.0, 100.0 ) +% +% Maximum Delta Time in local time stepping simulations +MAX_DELTA_TIME= 1E6 +% +% Runge-Kutta alpha coefficients +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +% +% Number of total iterations +ITER= 45000 + +% ----------------------- SLOPE LIMITER DEFINITION ----------------------------% +% +% Coefficient for the limiter +VENKAT_LIMITER_COEFF= 0.05 +% +% Coefficient for the sharp edges limiter +ADJ_SHARP_LIMITER_COEFF= 3.0 +% +% Reference coefficient (sensitivity) for detecting sharp edges. +REF_SHARP_EDGES= 3.0 +% +% Remove sharp edges from the sensitivity evaluation (NO, YES) +SENS_REMOVE_SHARP= NO + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +% Linear solver for implicit formulations (BCGSTAB, FGMRES) +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver (JACOBI, LINELET, LU_SGS) +LINEAR_SOLVER_PREC= ILU +% +% Linael solver ILU preconditioner fill-in level (0 by default) +LINEAR_SOLVER_ILU_FILL_IN= 0 +% +% Minimum error of the linear solver for implicit formulations +LINEAR_SOLVER_ERROR= 1E-10 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 10 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, JST_KE, JST_MAT, LAX-FRIEDRICH, CUSP, ROE, AUSM, +% AUSMPLUSUP, AUSMPLUSUP2, AUSMPWPLUS, HLLC, TURKEL_PREC, +% SW, MSW, FDS, SLAU, SLAU2, L2ROE, LMROE, UDS) +CONV_NUM_METHOD_FLOW= UDS +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= YES +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= NONE +% +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.0, 0.02 ) +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% Number of iterations for the poisson solver +LINEAR_SOLVER_ITER_POISSON = 20 +% +% Number of iterations for the flow solver +LINEAR_SOLVER_ITER_FLOW = 20 + +RELAXATION_FACTOR_PBFLOW= 1.0 +RELAXATION_FACTOR_RHIECHOW= 0.5 + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Convergence criteria (CAUCHY, RESIDUAL) +% +CONV_FIELD= RMS_VELOCITY-X +% +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -14 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= NACA0012refgrid_lvl2.su2 +% +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 +% +% Restart flow input file +SOLUTION_FILENAME= restart_flow +% +% Output file format (CSV, TECPLOT) +TABULAR_FORMAT= CSV + +OUTPUT_FILES= PARAVIEW RESTART SURFACE_PARAVIEW +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow_rough_sa2 +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow_rough_sa2 +% +% Writing solution file frequency +WRT_SOL_FREQ= 200 +% +% Writing convergence history frequency +WRT_CON_FREQ= 1 + +%SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX, RMS_NU_TILDE, LIFT,DRAG) +SCREEN_OUTPUT= (INNER_ITER, RMS_VELOCITY-X, RMS_MASSFLUX, RMS_TKE, RMS_DISSIPATION, LIFT,DRAG) + +WRT_FORCES_BREAKDOWN= YES diff --git a/externals/autotools/share/autoconf/autom4te.cfg b/externals/autotools/share/autoconf/autom4te.cfg new file mode 100644 index 000000000000..4444b5ff7724 --- /dev/null +++ b/externals/autotools/share/autoconf/autom4te.cfg @@ -0,0 +1,165 @@ +# Definition of Autom4te option sets. -*- Makefile -*- +# +# Copyright (C) 2001-2012 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +## -------------------------- ## +## Autoheader preselections. ## +## -------------------------- ## + +begin-language: "Autoheader-preselections" +args: --preselect AC_CONFIG_HEADERS +args: --preselect AH_OUTPUT +args: --preselect AC_DEFINE_TRACE_LITERAL +end-language: "Autoheader-preselections" + + +## ------------------------ ## +## Automake-preselections. ## +## ------------------------ ## + +begin-language: "Automake-preselections" +args: --preselect AC_CANONICAL_BUILD +args: --preselect AC_CANONICAL_HOST +# AC_CANONICAL_SYSTEM was traced from Automake 1.7 to Automake 1.9. +# Later versions trace AC_CANONICAL_TARGET instead. +args: --preselect AC_CANONICAL_SYSTEM +args: --preselect AC_CANONICAL_TARGET +args: --preselect AC_CONFIG_AUX_DIR +args: --preselect AC_CONFIG_FILES +args: --preselect AC_CONFIG_HEADERS +args: --preselect AC_CONFIG_LIBOBJ_DIR +args: --preselect AC_CONFIG_LINKS +args: --preselect AC_FC_FREEFORM +args: --preselect AC_FC_SRCEXT +args: --preselect AC_FC_PP_DEFINE +args: --preselect AC_FC_PP_SRCEXT +args: --preselect AC_INIT +args: --preselect AC_LIBSOURCE +args: --preselect AC_REQUIRE_AUX_FILE +# Automake < 1.10 traces AC_SUBST. Automake >= 1.10 traces AC_SUBST_TRACE. +args: --preselect AC_SUBST +args: --preselect AC_SUBST_TRACE +args: --preselect AM_AUTOMAKE_VERSION +args: --preselect AM_CONDITIONAL +args: --preselect AM_ENABLE_MULTILIB +args: --preselect AM_GNU_GETTEXT +args: --preselect AM_GNU_GETTEXT_INTL_SUBDIR +args: --preselect AM_INIT_AUTOMAKE +args: --preselect AM_MAKEFILE_INCLUDE +args: --preselect AM_MAINTAINER_MODE +args: --preselect AM_NLS +args: --preselect AM_POT_TOOLS +args: --preselect AM_PATH_GUILE +args: --preselect AM_PROG_AR +args: --preselect AM_PROG_CC_C_O +args: --preselect AM_PROG_CXX_C_O +args: --preselect AM_PROG_F77_C_O +args: --preselect AM_PROG_FC_C_O +args: --preselect AM_PROG_MOC +args: --preselect AM_SILENT_RULES +args: --preselect AM_XGETTEXT_OPTION +args: --preselect _AM_MAKEFILE_INCLUDE +args: --preselect _AM_SUBST_NOTMAKE +args: --preselect _AM_COND_IF +args: --preselect _AM_COND_ELSE +args: --preselect _AM_COND_ENDIF +args: --preselect LT_SUPPORTED_TAG +args: --preselect _LT_AC_TAGCONFIG +args: --preselect m4_include +args: --preselect m4_sinclude +end-language: "Automake-preselections" + + +## -------------------------- ## +## Autoreconf-preselections. ## +## -------------------------- ## + +begin-language: "Autoreconf-preselections" +args: --preselect AC_CONFIG_AUX_DIR +args: --preselect AC_CONFIG_HEADERS +args: --preselect AC_CONFIG_SUBDIRS +args: --preselect AC_INIT +args: --preselect AC_PROG_LIBTOOL +args: --preselect LT_INIT +args: --preselect LT_CONFIG_LTDL_DIR +args: --preselect AM_GNU_GETTEXT +end-language: "Autoreconf-preselections" + + +## ----------------------------- ## +## Autoconf without aclocal.m4. ## +## ----------------------------- ## + +# This intermediate language is used by aclocal to build aclocal.m4. + +begin-language: "Autoconf-without-aclocal-m4" +args: --prepend-include '/home/akshay/codes/SU2/externals/autotools/share/autoconf' +args: --cache=autom4te.cache +args: autoconf/autoconf.m4f +args: acsite.m4? +args: --mode 777 +args: --language M4sh +end-language: "Autoconf-without-aclocal-m4" + + +## ---------- ## +## Autoconf. ## +## ---------- ## + +begin-language: "Autoconf" +args: --language Autoheader-preselections +args: --language Automake-preselections +args: --language Autoreconf-preselections +args: --language Autoconf-without-aclocal-m4 +args: aclocal.m4? +end-language: "Autoconf" + + +## -------- ## +## Autotest ## +## -------- ## + +begin-language: "Autotest" +args: --prepend-include '/home/akshay/codes/SU2/externals/autotools/share/autoconf' +args: autotest/autotest.m4f +args: package.m4? +args: local.at? +args: --mode 777 +args: --language M4sh +end-language: "Autotest" + + +## ---- ## +## M4sh ## +## ---- ## + +begin-language: "M4sh" +args: --prepend-include '/home/akshay/codes/SU2/externals/autotools/share/autoconf' +args: m4sugar/m4sh.m4f +args: --mode 777 +args: --language M4sugar +end-language: "M4sh" + + +## ------- ## +## M4sugar ## +## ------- ## + +begin-language: "M4sugar" +args: --prepend-include '/home/akshay/codes/SU2/externals/autotools/share/autoconf' +args: m4sugar/m4sugar.m4f +args: --warnings syntax +end-language: "M4sugar" diff --git a/externals/autotools/share/autoconf/autotest/autotest.m4f b/externals/autotools/share/autoconf/autotest/autotest.m4f new file mode 100644 index 000000000000..3014d3fc5f54 --- /dev/null +++ b/externals/autotools/share/autoconf/autotest/autotest.m4f @@ -0,0 +1,3865 @@ +# This is a frozen state file generated by GNU M4 1.4.18 +V1 +Q1,1 +[] +T22,133 +_AS_LITERAL_HEREDOC_IFm4_if(m4_index([$1], [@S|@]), [-1], + [m4_if(m4_index(m4_translit([[$1]], [\`], [$]), [$]), [-1], + [$0_YES], [$0_NO])], + [$0_NO]) +T16,400 +_AS_EXIT_PREPARE_m4_defun_pro([$0])AS_REQUIRE_SHELL_FN([as_fn_set_status], + [AS_FUNCTION_DESCRIBE([as_fn_set_status], [STATUS], + [Set $? to STATUS, without forking.])], [ return $[]1])AS_REQUIRE_SHELL_FN([as_fn_exit], + [AS_FUNCTION_DESCRIBE([as_fn_exit], [STATUS], + [Exit the shell with STATUS, even in a "trap 0" or "set -e" context.])], +[ set +e + as_fn_set_status $[1] + exit $[1]])[]_m4_defun_epi([$0]) +T12,69 +_m4_list_cmpm4_if([$1], [], [0m4_ignore], [$2], [0], [m4_unquote], [$2m4_ignore]) +F12,9 +m4_debugfiledebugfile +T17,0 +AS_MESSAGE_LOG_FD +T8,0 +_m4_warn +T8,734 +AT_SETUPm4_ifdef([AT_ingroup], [m4_fatal([$0: nested AT_SETUP detected])], + [m4_define([AT_ingroup], [AS_ECHO(["$at_setup_line"]) >"$at_check_line_file" +])]) +m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])]) +m4_define([AT_capture_files], []) +m4_define([AT_line], AT_LINE) +m4_define([AT_xfail], [at_xfail=no]) +m4_define([AT_description], m4_expand([$1])) +m4_define([AT_ordinal], m4_incr(AT_ordinal)) +m4_divert_push([TEST_GROUPS])dnl +[#AT_START_]AT_ordinal +at_fn_group_banner AT_ordinal 'm4_defn([AT_line])' \ + "AS_ESCAPE(m4_dquote(m4_defn([AT_description])))" m4_format(["%*s"], + m4_max(0, m4_eval(47 - m4_qlen(m4_defn([AT_description])))), [])m4_if( + AT_banner_ordinal, [0], [], [ AT_banner_ordinal]) +m4_divert_push([TEST_SCRIPT])dnl + +T8,46 +AT_SETUPm4_fatal([AT_SETUP: missing AT_INIT detected]) +T27,30 +m4_location(_AS_ME_PREPARE)../../lib/m4sugar/m4sh.m4:1122 +T20,29 +m4_location(AS_EXIT)../../lib/m4sugar/m4sh.m4:585 +T21,479 +_AS_VAR_ARITH_PREPARE_m4_defun_pro([$0])AS_FUNCTION_DESCRIBE([as_fn_arith], [ARG...], +[Perform arithmetic evaluation on the ARGs, and store the result in +the global $as_val. Take advantage of shells that can avoid forks. +The arguments must be portable across $(()) and expr.]) +AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_ARITH_WORKS))"])], +[eval 'as_fn_arith () + { + as_val=$(( $[]* )) + }'], +[as_fn_arith () + { + as_val=`expr "$[]@" || test $? -eq 1` + }]) # as_fn_arith +[]_m4_defun_epi([$0]) +T15,218 +m4_map_args_sepm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [$#], [2], [], + [$#], [3], [], + [$#], [4], [$1[$4]$2[]], + [$1[$4]$2[]_m4_foreach([$3[]$1], [$2], m4_shift3($@))]) +T22,30 +m4_location(AS_TEST_X)../../lib/m4sugar/m4sh.m4:1090 +T16,3 +_m4_divert(HELP)300 +T8,150 +m4_defunm4_define([m4_location($1)], m4_location)m4_default([$3], [m4_define])([$1], + [_m4_defun_pro(]m4_dquote($[0])[)$2[]_m4_defun_epi(]m4_dquote($[0])[)]) +T18,50 +_m4_set_contents_1_m4_stack_reverse([_m4_set([$1])], [_m4_set_($1)]) +T7,225 +AT_LINEm4_if(m4_defn([_AT_LINE_file]), __file__, [], + [m4_do([m4_define([_AT_LINE_file], __file__)], + [m4_define([_AT_LINE_base], + m4_bregexp(/__file__, [/\([^/]*\)$], [[\1]]))])])dnl +m4_defn([_AT_LINE_base]):__line__ +T18,94 +_m4_set_contents_2_m4_stack_reverse([_m4_set_($1)], [_m4_set([$1])], + [$2[]_m4_defn([_m4_set_($1)])$3], [$4[]]) +T8,81 +m4_chompm4_format([[%.*s]], m4_index(m4_translit([[$1]], [ +/.], [/ ])[./.], [/.]), [$1]) +T10,68 +_AS_TR_CPP_AS_LITERAL_IF([$1], [*][ ][ +])([], [$0_INDIR], [$0_LITERAL])([$1]) +T16,283 +_AS_TEST_PREPARE_m4_defun_pro([$0])AS_REQUIRE_SHELL_FN([as_fn_executable_p], + [AS_FUNCTION_DESCRIBE([as_fn_executable_p], [FILE], + [Test if FILE is an executable regular file.])], + [ test -f "$[]1" && test -x "$[]1"])as_test_x='test -x' +as_executable_p=as_fn_executable_p +[]_m4_defun_epi([$0]) +T18,303 +_AS_ECHO_N_PREPARE_m4_defun_pro([$0])ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in @%:@((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac +[]_m4_defun_epi([$0]) +T13,82 +m4_dquote_eltm4_if([$#], [0], [], + [$#], [1], [[[$1]]], + [[[$1]],$0(m4_shift($@))]) +T24,32 +m4_default_nblank_quotedm4_ifblank([$1], [[$2]], [[$1]]) +T9,57 +m4_appendm4_define([$1], m4_ifdef([$1], [_m4_defn([$1])[$3]])[$2]) +T11,37 +m4_list_cmp_$0_raw(m4_dquote($1), m4_dquote($2)) +T7,84 +_m4_for$4[$1]$5[]m4_if([$1], [$2], [], + [$0(m4_eval([$1 + $3]), [$2], [$3], [$4], [$5])]) +T27,34 +m4_location(_AT_ARG_OPTION)../../lib/autotest/general.m4:1674 +T12,78 +m4_foreach_wm4_pushdef([$1])m4_map_args_w([$2], + [m4_define([$1],], [)$3])m4_popdef([$1]) +T5,113 +AS_IF_m4_defun_pro([$0])if $1; then : + $2 +m4_map_args_pair([_$0], [_$0_ELSE], m4_shift2($@))fi[][]_m4_defun_epi([$0]) +T11,165 +_m4_dumpdefm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_builtin([dumpdef], [$1])], + [m4_map_args_sep([m4_builtin([dumpdef],], [)], [], $@)]) +T20,3 +_m4_divert(HELP_END)305 +T25,30 +m4_location(AS_VAR_ARITH)../../lib/m4sugar/m4sh.m4:1981 +T14,131 +m4_set_add_allm4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1]) + + m4_len(m4_ifdef([_m4_set_cleanup($1)], [_$0_check], [_$0])([$1], $@)))) +F7,4 +m4_incrincr +F8,4 +_m4_defndefn +T13,124 +_m4_defun_prom4_ifdef([_m4_expansion_stack], [], [_m4_defun_pro_outer([$1])])m4_expansion_stack_push([$1])m4_pushdef([_m4_expanding($1)]) +T15,114 +AS_VAR_TEST_SETAS_LITERAL_WORD_IF([$1], + [${$1+:} false], + [{ as_var=$1; eval \${$as_var+:} false; }], + [eval \${$1+:} false]) +T7,111 +AS_EXIT_m4_defun_pro([$0])AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_exit m4_ifval([$1], [$1], [$][?])[]_m4_defun_epi([$0]) +T27,30 +m4_location(_AS_CR_PREPARE)../../lib/m4sugar/m4sh.m4:1793 +T13,175 +m4_defun_initm4_define([$1], [$3[]])m4_defun([$1], + [$2[]_m4_popdef(]m4_dquote($[0])[)m4_indir(]m4_dquote($[0])dnl +[m4_if(]m4_dquote($[#])[, [0], [], ]m4_dquote([,$]@)[))], [m4_pushdef]) +T12,64 +_AS_ECHO_LOG_AS_ECHO([$as_me:${as_lineno-$LINENO}: $1], AS_MESSAGE_LOG_FD)[] +T12,131 +_AS_ECHO_LOG_m4_defun_pro([$0])AS_REQUIRE([_AS_LINENO_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T17,604 +_AS_SHELL_FN_WORKas_fn_return () { (exit [$]1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +AS_IF([( set x; as_fn_ret_success y && test x = "[$]1" )], [], + [exitcode=1; echo positional parameters were not saved.]) +test x$exitcode = x0[] +T21,97 +m4_copyright_condensem4_text_wrap(m4_bpatsubst(m4_flatten([[$1]]), +[(C)[- ,0-9]*\([1-9][0-9][0-9][0-9]\)], [(C) \1])) +T17,203 +m4_cr_not_Letters +  !"#*%&'()$+,./0123456789:;<=>?@[\]^_`{|}~- +T21,1 +_m4_divert(M4SH-INIT)6 +T12,66 +m4_re_string[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]* +T16,5 +_m4_divert(GROW)10000 +T18,72 +m4_version_compare_m4_list_cmp_raw(_m4_version_unletter([$1]), _m4_version_unletter([$2])) +T32,0 +m4_include(autotest/specific.m4) +T31,30 +m4_location(_AS_LINENO_PREPARE)../../lib/m4sugar/m4sh.m4:1167 +T25,1 +_m4_divert(M4SH-SANITIZE)4 +T10,120 +_AS_ESCAPEm4_if(m4_index(m4_translit([[$1]], [$3], [$2$2$2$2]), [$2]), [-1], + [$0_], [m4_bpatsubst])([$1], [[$2$3]], [\\\&]) +T29,29 +m4_location(_AS_EXIT_PREPARE)../../lib/m4sugar/m4sh.m4:568 +T15,165 +_m4_set_add_allm4_if([$#], [2], [], + [m4_ifdef([_m4_set([$1],$3)], [], + [m4_define([_m4_set([$1],$3)], [1])m4_pushdef([_m4_set([$1])], + [$3])-])$0([$1], m4_shift2($@))]) +T17,780 +_AS_ERROR_PREPAREAS_REQUIRE_SHELL_FN([as_fn_error], + [AS_FUNCTION_DESCRIBE([as_fn_error], [STATUS ERROR]m4_ifval(AS_MESSAGE_LOG_FD, + [[ [[LINENO LOG_FD]]]]), + [Output "`basename @S|@0`: error: ERROR" to stderr.] +m4_ifval(AS_MESSAGE_LOG_FD, + [[If LINENO and LOG_FD are provided, also output the error to LOG_FD, + referencing LINENO.]]) + [Then exit the script with STATUS, using 1 if that was 0.])], +[ as_status=$[1]; test $as_status -eq 0 && as_status=1 +m4_ifval(AS_MESSAGE_LOG_FD, +[m4_pushdef([AS_MESSAGE_LOG_FD], [$[4]])dnl + if test "$[4]"; then + AS_LINENO_PUSH([$[3]]) + _AS_ECHO_LOG([error: $[2]]) + fi +m4_define([AS_MESSAGE_LOG_FD])], [m4_pushdef([AS_MESSAGE_LOG_FD])])dnl + AS_MESSAGE([error: $[2]], [2]) +_m4_popdef([AS_MESSAGE_LOG_FD])dnl + AS_EXIT([$as_status])]) +T20,676 +_AT_DECIDE_TRACEABLEm4_pushdef([at_reason], +m4_cond([m4_eval(m4_index([$1], [`]) >= 0)], [1], + [[a `...` command substitution]], + [m4_eval(m4_index([$1], [$(]) >= 0)], [1], + [[a $(...) command substitution]], + [m4_eval(m4_index([$1], [${]) >= 0)], [1], + [[a ${...} parameter expansion]], + [m4_eval(m4_index([$1], m4_newline) >= 0)], [1], + [[an embedded newline]], + [m4_eval(m4_bregexp([$1], [[^|]|[^|]]) >= 0)], [1], + [[a shell pipeline]], + []))m4_if(m4_index(_m4_defn([at_reason]), [a]), [0],[at_fn_check_prepare_notrace '_m4_defn([at_reason])'], + m4_index([$1], [$]), [-1],[at_fn_check_prepare_trace],[at_fn_check_prepare_dynamic "AS_ESCAPE([[$1]], [`\"])"])[]_m4_popdef([at_reason]) +T8,4 +m4_quote[$*] +T15,4 +m4_PACKAGE_YEAR2012 +T10,211 +m4_dumpdefm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_ifdef([$1], [m4_errprintn( + [$1: ]m4_dquote(_m4_defn([$1])))], [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T15,193 +m4_cr_not_alnum +  !"#*%&'()$+,./:;<=>?@[\]^_`{|}~- +T6,21 +_AS_IFelif $1; then : + $2 + +T13,15 +AS_VAR_POPDEFm4_popdef([$1]) +T23,29 +m4_location(AS_REQUIRE)../../lib/m4sugar/m4sh.m4:385 +F6,3 +m4_lenlen +T14,42 +m4_divert_textm4_divert_push([$1])$2 +m4_divert_pop([$1]) +T8,94 +AS_UNSET_m4_defun_pro([$0]){ AS_LITERAL_WORD_IF([$1], [], [eval ])$1=; unset $1;}[]_m4_defun_epi([$0]) +T10,115 +AS_VAR_GETAS_LITERAL_WORD_IF([$1], + [$$1], + [`eval 'as_val=${'_AS_ESCAPE([[$1]], [`], [\])'};AS_ECHO(["$as_val"])'`]) +T29,30 +m4_location(_AS_LN_S_PREPARE)../../lib/m4sugar/m4sh.m4:1223 +F12,9 +m4_debugmodedebugmode +T10,280 +m4_set_addm4_ifdef([_m4_set([$1],$2)], + [m4_if(m4_indir([_m4_set([$1],$2)]), [0], + [m4_define([_m4_set([$1],$2)], + [1])_m4_set_size([$1], [m4_incr])$3], [$4])], + [m4_define([_m4_set([$1],$2)], + [1])m4_pushdef([_m4_set([$1])], + [$2])_m4_set_size([$1], [m4_incr])$3]) +T14,122 +m4_append_uniqm4_ifval([$3], [m4_if(m4_index([$2], [$3]), [-1], [], + [m4_warn([syntax], + [$0: `$2' contains `$3'])])])_$0($@) +T15,0 +_m4_divert_dump +T27,30 +m4_location(AS_VAR_PUSHDEF)../../lib/m4sugar/m4sh.m4:2066 +T20,20 +m4_PACKAGE_BUGREPORTbug-autoconf@gnu.org +T22,38 +AT_DIFF_STDOUT(stdout)echo stdout:; tee stdout <"$at_stdout" +T8,66 +m4_ifsetm4_ifdef([$1], + [m4_ifval(_m4_defn([$1]), [$2], [$3])], + [$3]) +T7,182 +m4_condm4_if([$#], [0], [m4_fatal([$0: cannot be called without arguments])], + [$#], [1], [$1], + m4_eval([$# % 3]), [2], [m4_fatal([$0: missing an argument])], + [_$0($@)]) +T22,3 +_m4_divert(PARSE_ARGS)201 +T9,15 +AS_ECHO_N$as_echo_n $1[] +T9,129 +AS_ECHO_N_m4_defun_pro([$0])AS_REQUIRE([_AS_ECHO_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T12,30 +m4_esyscmd_sm4_chomp_all(m4_esyscmd([$1])) +T6,264 +AS_FOR_m4_defun_pro([$0])m4_pushdef([$1], m4_if([$3], [], [[$$2]], m4_translit([$3], [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789][%+=:,./-]), [], [[$3]], [[$$2]]))for $2[]m4_ifval([$3], [ in $3]) +do : + $4 +done[]_m4_popdef([$1])[]_m4_defun_epi([$0]) +T14,276 +_AS_CR_PREPARE_m4_defun_pro([$0])# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits +[]_m4_defun_epi([$0]) +T22,43 +AT_DIFF_STDOUT(expout)$at_diff expout "$at_stdout" || at_failed=: +T15,148 +_m4_append_uniqm4_ifdef([$1], + [m4_if(m4_index([$3]_m4_defn([$1])[$3], [$3$2$3]), [-1], + [m4_append([$1], [$2], [$3])$4], [$5])], + [m4_define([$1], [$2])$4]) +T32,30 +m4_location(_AS_MKDIR_P_PREPARE)../../lib/m4sugar/m4sh.m4:1296 +T20,201 +_AS_BASENAME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_EXPR_PREPARE])if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi +[]_m4_defun_epi([$0]) +T17,272 +_AS_IDENTIFIER_IFm4_cond([[$1]], [], [], + [m4_eval(m4_len(m4_translit([[$1]], ][[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]][)) > 0)], [1], [], + [m4_len(m4_translit(m4_format([[%.1s]], [$1]), ][[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]][))], [0], [-]) +T11,85 +AS_BASENAME$as_basename -- $1 || +_AS_BASENAME_EXPR([$1]) 2>/dev/null || +_AS_BASENAME_SED([$1])[] +T11,124 +AS_BASENAME_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T9,31 +_m4_applym4_if([$2], [], [], [$1($2)[]]) +T13,84 +_AS_QUOTE_OLDm4_warn([obsolete], + [back quotes and double quotes must not be escaped in: $1])$1 +T10,2 +m4_unquote$* +T9,72 +m4_mapallm4_if([$2], [], [], + [_m4_foreach([m4_apply([$1],], [)], [], $2)]) +F14,6 +_m4_divert_rawdivert +T6,122 +m4_cdrm4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))]) +T16,27 +_AS_QUOTE_MODERN_AS_ESCAPE([$1], [`], [""]) +T14,41 +_m4_list_cmp_1_m4_list_cmp_2([$2], [m4_shift2($@)], $1) +T20,3 +_m4_divert(DEFAULTS)100 +T14,95 +_m4_list_cmp_2_m4_list_cmp([$1$3], m4_cmp([$3+0], [$1+0]))( + [_m4_list_cmp_1(m4_dquote(m4_shift3($@)), $2)]) +T11,53 +_m4_joinallm4_if([$#], [2], [], [[$1$3]$0([$1], m4_shift2($@))]) +T16,137 +_AS_DIRNAME_EXPR$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \ + X[]$1 : 'X\(//\)[[^/]]' \| \ + X[]$1 : 'X\(//\)$' \| \ + X[]$1 : 'X\(/\)' \| .[] +T16,129 +_AS_DIRNAME_EXPR_m4_defun_pro([$0])AS_REQUIRE([_AS_EXPR_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T9,158 +m4_popdefm4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_popdef([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T21,29 +m4_location(AS_UNSET)../../lib/m4sugar/m4sh.m4:671 +T12,152 +_m4_set_dumpm4_ifdef([_m4_set([$1])], + [[$2]_m4_defn([_m4_set([$1])])_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)], [_m4_set([$1])])$0([$1], [$2$3])]) +T17,196 +AS_SHELL_SANITIZE_AS_SHELL_SANITIZE +m4_provide_if([AS_INIT], [], +[m4_provide([AS_INIT]) +_AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK]) +_AS_DETECT_REQUIRED([_AS_TEST_X_WORKS]) +_AS_DETECT_BETTER_SHELL +_AS_UNSET_PREPARE +]) +T12,32 +m4_make_listm4_join([, +], m4_dquote_elt($@)) +T16,90 +_AT_DEFINE_SETUPm4_define([$1], [m4_ifndef([AT_ingroup], + [m4_fatal([$1: missing AT_SETUP detected])])$2]) +T11,353 +AT_XFAIL_IFm4_ifndef([AT_ingroup], + [m4_fatal([AT_XFAIL_IF: missing AT_SETUP detected])])dnl +dnl Try to limit the amount of conditionals that we emit. +m4_case([$1], + [], [], + [false], [], + [:], [m4_define([AT_xfail], [at_xfail=yes])], + [true], [m4_define([AT_xfail], [at_xfail=yes])], + [m4_append([AT_xfail], [ + $1 && at_xfail=yes])]) +T31,29 +m4_location(_AS_ECHO_N_PREPARE)../../lib/m4sugar/m4sh.m4:807 +T27,29 +m4_location(AS_LINENO_PUSH)../../lib/m4sugar/m4sh.m4:894 +T14,142 +_AT_CHECK_EXITm4_define([AT_ingroup])AS_ECHO(_AT_LINE_ESCAPED) >"$at_check_line_file" +m4_ifval([$1], [($1) \ + && ])at_fn_check_skip $2 "$at_srcdir/AT_LINE" +T11,498 +_AS_MKDIR_Pcase $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`AS_DIRNAME("$as_dir")` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir]) + +T39,30 +m4_location(_AS_PATH_SEPARATOR_PREPARE)../../lib/m4sugar/m4sh.m4:1315 +T5,73 +m4_dom4_if([$#], 0, [], + [$#], 1, [$1[]], + [$1[]$0(m4_shift($@))]) +F9,6 +m4_substrsubstr +T33,29 +m4_location(_AS_DETECT_SUGGESTED)../../lib/m4sugar/m4sh.m4:167 +T18,8 +m4_PACKAGE_TARNAMEautoconf +T13,252 +m4_set_removem4_set_contains([$1], [$2], [_m4_set_size([$1], + [m4_decr])m4_if(_m4_defn([_m4_set([$1])]), [$2], + [_m4_popdef([_m4_set([$1],$2)], [_m4_set([$1])])], + [m4_define([_m4_set_cleanup($1)])m4_define( + [_m4_set([$1],$2)], [0])])$3], [$4]) +T19,109 +_m4_defun_epi_outer_m4_popdef([_m4_divert_dump], [_m4_diverting([$1])], [_m4_diverting])m4_divert_pop([GROW])m4_undivert([GROW]) +T27,30 +m4_location(_AS_TR_PREPARE)../../lib/m4sugar/m4sh.m4:1878 +T15,58 +m4_divert_stackm4_stack_foreach_sep_lifo([_m4_divert_stack], [], [], [ +]) +T17,31 +m4_default_quotedm4_if([$1], [], [[$2]], [[$1]]) +T14,28 +AS_VAR_PUSHDEF_$0([$1], m4_expand([$2]))[] +T14,130 +AS_VAR_PUSHDEF_m4_defun_pro([$0])AS_REQUIRE([_AS_TR_SH_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T18,29 +m4_location(AS_IF)../../lib/m4sugar/m4sh.m4:639 +T31,30 +m4_location(AS_VERSION_COMPARE)../../lib/m4sugar/m4sh.m4:1767 +F9,6 +m4_syscmdsyscmd +T28,44 +AT_DIFF_STDERR(stderr-nolog)echo stderr captured; cp "$at_stderr" stderr +T11,136 +m4_set_dumpm4_ifdef([_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])m4_ifdef([_m4_set_cleanup($1)], + [_$0_check], [_$0])([$1], [], [$2]) +T9,58 +m4_ifvalnm4_if([$1], + [], [m4_n([$3])], + [m4_n([$2])]) +T7,0 +__gnu__ +T10,27 +m4_joinall[$2]_$0([$1], m4_shift($@)) +T11,2 +_AS_ESCAPE_$1 +T9,22 +m4_shift2m4_shift(m4_shift($@)) +T18,80 +m4_expansion_stackm4_stack_foreach_sep_lifo([_$0], [_$0_entry(], [) +])m4_location[: the top level] +T9,32 +m4_shift3m4_shift(m4_shift(m4_shift($@))) +T17,152 +m4_version_prereqm4_if(m4_version_compare([2.69], [$1]), + [-1], + [m4_default([$3], + [m4_fatal([Autoconf version $1 or higher is required], + [63])])], + [$2]) +T16,50 +_m4_list_cmp_rawm4_if([$1], [$2], [0], [_m4_list_cmp_1([$1], $2)]) +T8,0 +__unix__ +T17,77 +AT_ARG_OPTION_ARG_m4_defun_pro([$0])_AT_ARG_OPTION([$1],[$2],1,[$3],[$4])[]_m4_defun_epi([$0]) +T20,30 +m4_location(AS_LN_S)../../lib/m4sugar/m4sh.m4:1257 +T14,109 +m4_file_appendm4_syscmd([cat >>$1 <<_m4eof +$2 +_m4eof +]) +m4_if(m4_sysval, [0], [], + [m4_fatal([$0: cannot write: $1])]) +T15,140 +_AS_VAR_PUSHDEF_AS_LITERAL_IF([$2], [ ][ +])([], [as_$1=_AS_TR_SH_INDIR([$2]) +m4_pushdef([$1], [$as_[$1]])], +[m4_pushdef([$1], [_AS_TR_SH_LITERAL([$2])])]) +T15,49 +m4_rename_forcem4_ifdef([$2], [_m4_undefine([$2])])m4_rename($@) +T28,30 +m4_location(AS_EXECUTABLE_P)../../lib/m4sugar/m4sh.m4:1098 +T9,222 +m4_bmatchm4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [$2], + [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shift3($@))], + [$3])]) +T10,26 +AS_MKDIR_Pas_dir=$1; as_fn_mkdir_p[] +T10,124 +AS_MKDIR_P_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T13,333 +m4_divert_popm4_if([$1], [], [], + [$1], _m4_defn([_m4_divert_diversion]), [], + [m4_fatal([$0($1): diversion mismatch: +]m4_divert_stack)])_m4_popdef([_m4_divert_stack], [_m4_divert_diversion])m4_ifdef([_m4_divert_diversion], [], + [m4_fatal([too many m4_divert_pop])])_m4_divert_raw(_m4_divert(_m4_defn([_m4_divert_diversion]), [-])) +T16,169 +_AS_EXPR_PREPARE_m4_defun_pro([$0])if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi +[]_m4_defun_epi([$0]) +T19,95 +_AS_DETECT_REQUIRED_m4_defun_pro([$0])m4_set_add([_AS_DETECT_REQUIRED_BODY], [$1 || AS_EXIT])[]_m4_defun_epi([$0]) +T10,121 +m4_re_word[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]* +T28,0 +AT_DIFF_STDERR(ignore-nolog) +T27,3 +_m4_divert(VERSION_NOTICES)351 +T26,29 +m4_location(AS_SET_STATUS)../../lib/m4sugar/m4sh.m4:649 +T14,37 +m4_PACKAGE_URLhttp://www.gnu.org/software/autoconf/ +T11,62 +m4_cr_alnumabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 +T12,71 +AS_COPYRIGHTm4_divert_text([HEADER-COPYRIGHT], +[m4_bpatsubst([ +$1], [^], [@%:@ ])]) +F11,8 +m4_translittranslit +T14,110 +m4_divert_pushm4_divert_stack_push([$0], [$1])m4_pushdef([_m4_divert_diversion], [$1])_m4_divert_raw(_m4_divert([$1], [$2])) +T8,87 +m4_fatalm4_errprintn(m4_location[: error: $1] +m4_expansion_stack)m4_exit(m4_if([$2],, 1, [$2])) +F8,5 +m4_ifdefifdef +T16,225 +_AS_LINENO_WORKS as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' +T7,20 +m4_wrap_m4_wrap([], [$1[]]) +T16,9 +_AS_TEST_X_WORKStest -x / +T17,3 +_m4_divert(TESTS)403 +T12,110 +_m4_set_sizem4_define([_m4_set_size($1)], + m4_ifdef([_m4_set_size($1)], [$2(m4_indir([_m4_set_size($1)]))], + [1])) +T6,43 +m4_map_m4_foreach([_m4_apply([$1],], [)], [], $2) +T10,54 +m4_includem4_include_unique([$1])dnl +m4_builtin([include], [$1]) +T17,136 +_AS_BASENAME_EXPR_m4_defun_pro([$0])$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \ + X[]$1 : 'X\(//\)$' \| \ + X[]$1 : 'X\(/\)' \| .[]_m4_defun_epi([$0]) +T8,115 +AS_ERRORas_fn_error m4_default([$2], [$?]) "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD, + [ "$LINENO" AS_MESSAGE_LOG_FD])[] +T8,187 +AS_ERROR_m4_defun_pro([$0])m4_append_uniq([_AS_CLEANUP], + [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T8,189 +m4_splitm4_if([$1], [], [], + [$2], [ ], [m4_if(m4_index([$1], [ ]), [-1], [[[$1]]], + [_$0([$1], [$2], [, ])])], + [$2], [], [_$0([$1], [[ ]+], [, ])], + [_$0([$1], [$2], [, ])]) +T6,190 +m4_minm4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)]) +F14,11 +m4_changequotechangequote +T17,2 +_AS_LITERAL_IF_NO$2 +T26,1 +_m4_divert(HEADER-COMMENT)2 +T10,54 +m4_ifblankm4_if(m4_translit([[$1]], [ ][ ][ +]), [], [$2], [$3]) +T14,166 +m4_cleardivertm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [_m4_divert_raw([-1])m4_undivert($@)_m4_divert_raw( + _m4_divert(_m4_defn([_m4_divert_diversion]), [-]))]) +T18,206 +_m4_text_wrap_wordm4_define([m4_Cursor], m4_eval(m4_Cursor + m4_qlen([$1]) + 1))m4_if(m4_eval(m4_Cursor > ([$3])), + [1], [m4_define([m4_Cursor], m4_eval(m4_Indent + m4_qlen([$1]) + 1)) +[$2]], + [m4_Separator[]])[$1] +T18,1601 +_AS_SHELL_SANITIZE_m4_defun_pro([$0])m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])m4_text_box([M4sh Initialization.]) + +AS_BOURNE_COMPATIBLE +_AS_ECHO_PREPARE +_AS_PATH_SEPARATOR_PREPARE + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $[0] in @%:@(( + *[[\\/]]* ) as_myself=$[0] ;; + *) _AS_PATH_WALK([], + [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break]) + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$[0] +fi +if test ! -f "$as_myself"; then + AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2 + AS_EXIT +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +_m4_popdef([AS_EXIT])[]_m4_defun_epi([$0]) +T28,0 +AT_DIFF_STDOUT(ignore-nolog) +T7,48 +m4_qlenm4_ifdef([$0-$1], [_m4_defn([$0-]], [_$0(])[$1]) +T6,190 +m4_maxm4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)]) +F11,8 +m4_errprinterrprint +T10,137 +_m4_divertm4_ifdef([_m4_divert($1)], + [m4_indir([_m4_divert($1)])], + [m4_if([$2], [], [m4_warn([syntax], + [prefer named diversions])])$1]) +T13,26 +m4_cr_LETTERSABCDEFGHIJKLMNOPQRSTUVWXYZ +T15,272 +_AS_DIRNAME_SED_m4_defun_pro([$0])AS_ECHO([X[]$1]) | + sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'][]_m4_defun_epi([$0]) +T17,94 +_m4_stack_reversem4_ifdef([$1], [m4_pushdef([$2], + _m4_defn([$1]))$3[]_m4_popdef([$1])$0([$1], [$2], [$4$3])]) +T7,45675 +AT_INITm4_pushdef([AT_INIT], [m4_fatal([$0: invoked multiple times])]) +m4_pattern_forbid([^_?AT_]) +m4_pattern_allow([^_ATEOF$]) +m4_ifndef([AT_PACKAGE_BUGREPORT], [m4_fatal( + [$1: AT_PACKAGE_BUGREPORT is missing, consider writing package.m4])]) +m4_define([AT_TESTSUITE_NAME], + m4_defn([AT_PACKAGE_STRING])[ test suite]m4_ifval([$1], + [m4_expand([: $1])])) +m4_define([AT_ordinal], 0) +m4_define([AT_banner_ordinal], 0) +m4_define([AT_help_all], []) +m4_map_args([_m4_popdef], _AT_DEFINE_INIT_LIST) +m4_wrap([_AT_FINISH]) +AS_INIT[]m4_cleardivert([BODY])AS_ME_PREPARE[]m4_divert_push([DEFAULTS])AT_COPYRIGHT(m4_defn([_AT_COPYRIGHT_YEARS]), [ +m4_copyright_condense]) +AT_COPYRIGHT( +[This test suite is free software; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it.], [m4_echo]) +AS_PREPARE + +SHELL=${CONFIG_SHELL-/bin/sh} + +# How were we run? +at_cli_args="$[@]" + +m4_divert_push([BANNERS])dnl + +# Should we print banners? Yes if more than one test is run. +case $at_groups in #( + *$as_nl* ) + at_print_banners=: ;; #( + * ) at_print_banners=false ;; +esac +# Text for banner N, set to a single space once printed. +m4_divert_pop([BANNERS])dnl back to DEFAULTS +m4_divert_push([PREPARE_TESTS])dnl + +m4_text_box([Autotest shell functions.]) + +AS_FUNCTION_DESCRIBE([at_fn_banner], [NUMBER], +[Output banner NUMBER, provided the testsuite is running multiple groups +and this particular banner has not yet been printed.]) +at_fn_banner () +{ + $at_print_banners || return 0 + eval at_banner_text=\$at_banner_text_$[1] + test "x$at_banner_text" = "x " && return 0 + eval "at_banner_text_$[1]=\" \"" + if test -z "$at_banner_text"; then + $at_first || echo + else + AS_ECHO(["$as_nl$at_banner_text$as_nl"]) + fi +} # at_fn_banner + +AS_FUNCTION_DESCRIBE([at_fn_check_prepare_notrace], [REASON LINE], +[Perform AT_CHECK preparations for the command at LINE for an +untraceable command; REASON is the reason for disabling tracing.]) +at_fn_check_prepare_notrace () +{ + $at_trace_echo "Not enabling shell tracing (command contains $[1])" + AS_ECHO(["$[2]"]) >"$at_check_line_file" + at_check_trace=: at_check_filter=: + : >"$at_stdout"; : >"$at_stderr" +} + +AS_FUNCTION_DESCRIBE([at_fn_check_prepare_trace], [LINE], +[Perform AT_CHECK preparations for the command at LINE for a traceable +command.]) +at_fn_check_prepare_trace () +{ + AS_ECHO(["$[1]"]) >"$at_check_line_file" + at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace + : >"$at_stdout"; : >"$at_stderr" +} + +AS_FUNCTION_DESCRIBE([at_fn_check_prepare_dynamic], [COMMAND LINE], +[Decide if COMMAND at LINE is traceable at runtime, and call the +appropriate preparation function.]) +at_fn_check_prepare_dynamic () +{ + case $[1] in + *$as_nl*) + at_fn_check_prepare_notrace 'an embedded newline' "$[2]" ;; + *) + at_fn_check_prepare_trace "$[2]" ;; + esac +} + +AS_FUNCTION_DESCRIBE([at_fn_filter_trace], [], +[Remove the lines in the file "$at_stderr" generated by "set -x" and print +them to stderr.]) +at_fn_filter_trace () +{ + mv "$at_stderr" "$at_stder1" + grep '^ *+' "$at_stder1" >&2 + grep -v '^ *+' "$at_stder1" >"$at_stderr" +} + +AS_FUNCTION_DESCRIBE([at_fn_log_failure], [FILE-LIST], +[Copy the files in the list on stdout with a "> " prefix, and exit the shell +with a failure exit code.]) +at_fn_log_failure () +{ + for file + do AS_ECHO(["$file:"]); sed 's/^/> /' "$file"; done + echo 1 > "$at_status_file" + exit 1 +} + +AS_FUNCTION_DESCRIBE([at_fn_check_skip], [EXIT-CODE LINE], +[Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit +the test group subshell with that same exit code. Use LINE in any report +about test failure.]) +at_fn_check_skip () +{ + case $[1] in + 99) echo 99 > "$at_status_file"; at_failed=: + AS_ECHO(["$[2]: hard failure"]); exit 99;; + 77) echo 77 > "$at_status_file"; exit 77;; + esac +} + +AS_FUNCTION_DESCRIBE([at_fn_check_status], [EXPECTED EXIT-CODE LINE], +[Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing. +Otherwise, if it is 77 or 99, exit the test group subshell with that same +exit code; if it is anything else print an error message referring to LINE, +and fail the test.]) +at_fn_check_status () +{ +dnl This order ensures that we don't `skip' if we are precisely checking +dnl $? = 77 or $? = 99. + case $[2] in + $[1] ) ;; + 77) echo 77 > "$at_status_file"; exit 77;; + 99) echo 99 > "$at_status_file"; at_failed=: + AS_ECHO(["$[3]: hard failure"]); exit 99;; + *) AS_ECHO(["$[3]: exit code was $[2], expected $[1]"]) + at_failed=:;; + esac +} + +AS_FUNCTION_DESCRIBE([at_fn_diff_devnull], [FILE], +[Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless +diff invocations.]) +at_fn_diff_devnull () +{ + test -s "$[1]" || return 0 + $at_diff "$at_devnull" "$[1]" +} + +AS_FUNCTION_DESCRIBE([at_fn_test], [NUMBER], +[Parse out test NUMBER from the tail of this file.]) +at_fn_test () +{ + eval at_sed=\$at_sed$[1] + sed "$at_sed" "$at_myself" > "$at_test_source" +} + +AS_FUNCTION_DESCRIBE([at_fn_create_debugging_script], [], +[Create the debugging script $at_group_dir/run which will reproduce the +current test group.]) +at_fn_create_debugging_script () +{ + { + echo "#! /bin/sh" && + echo 'test "${ZSH_VERSION+set}" = set dnl +&& alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\''' && + AS_ECHO(["cd '$at_dir'"]) && + AS_ECHO(["exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d ]dnl +[$at_debug_args $at_group \${1+\"\$[@]\"}"]) && + echo 'exit 1' + } >"$at_group_dir/run" && + chmod +x "$at_group_dir/run" +} + +m4_text_box([End of autotest shell functions.]) +m4_divert_pop([PREPARE_TESTS])dnl back to DEFAULTS + +# Not all shells have the 'times' builtin; the subshell is needed to make +# sure we discard the 'times: not found' message from the shell. +at_times_p=false +(times) >/dev/null 2>&1 && at_times_p=: + +# CLI Arguments to pass to the debugging scripts. +at_debug_args= +# -e sets to true +at_errexit_p=false +# Shall we be verbose? ':' means no, empty means yes. +at_verbose=: +at_quiet= +# Running several jobs in parallel, 0 means as many as test groups. +at_jobs=1 +at_traceon=: +at_trace_echo=: +at_check_filter_trace=: + +# Shall we keep the debug scripts? Must be `:' when the suite is +# run by a debug script, so that the script doesn't remove itself. +at_debug_p=false +# Display help message? +at_help_p=false +# Display the version message? +at_version_p=false +# List test groups? +at_list_p=false +# --clean +at_clean=false +# Test groups to run +at_groups= +# Whether to rerun failed tests. +at_recheck= +# Whether a write failure occurred +at_write_fail=0 + +# The directory we run the suite in. Default to . if no -C option. +at_dir=`pwd` +# An absolute reference to this testsuite script. +dnl m4-double quote, to preserve [] +[case $as_myself in + [\\/]* | ?:[\\/]* ) at_myself=$as_myself ;; + * ) at_myself=$at_dir/$as_myself ;; +esac] +# Whether -C is in effect. +at_change_dir=false +m4_divert_pop([DEFAULTS])dnl +m4_define([_AT_FINISH], +[m4_ifdef([AT_ingroup], [m4_fatal([missing AT_CLEANUP detected])])dnl +m4_divert_text([DEFAULTS], +[ +# Whether to enable colored test results. +at_color=m4_ifdef([AT_color], [AT_color], [no]) +# List of the tested programs. +at_tested='m4_ifdef([AT_tested], + [m4_translit(m4_dquote(m4_defn([AT_tested])), [ ], m4_newline)])' +# As many question marks as there are digits in the last test group number. +# Used to normalize the test group numbers so that `ls' lists them in +# numerical order. +at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])' +# Description of all the test groups. +at_help_all="AS_ESCAPE(m4_dquote(m4_defn([AT_help_all])))" +# List of the all the test groups. +at_groups_all=`AS_ECHO(["$at_help_all"]) | sed 's/;.*//'` + +AS_FUNCTION_DESCRIBE([at_fn_validate_ranges], [NAME...], +[Validate and normalize the test group number contained in each +variable NAME. Leading zeroes are treated as decimal.]) +at_fn_validate_ranges () +{ + for at_grp + do + eval at_value=\$$at_grp + if test $at_value -lt 1 || test $at_value -gt AT_ordinal; then + AS_ECHO(["invalid test group: $at_value"]) >&2 + exit 1 + fi + case $at_value in + 0*) # We want to treat leading 0 as decimal, like expr and test, but + # AS_VAR_ARITH treats it as octal if it uses $(( )). + # With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the + # expr fork, but it is not worth the effort to determine if the + # shell supports XSI when the user can just avoid leading 0. + eval $at_grp='`expr $at_value + 0`' ;; + esac + done +}])])dnl +m4_divert_push([PARSE_ARGS])dnl + +at_prev= +for at_option +do + # If the previous option needs an argument, assign it. + if test -n "$at_prev"; then + at_option=$at_prev=$at_option + at_prev= + fi + + case $at_option in + *=?*) at_optarg=`expr "X$at_option" : '[[^=]]*=\(.*\)'` ;; + *) at_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $at_option in + --help | -h ) + at_help_p=: + ;; + + --list | -l ) + at_list_p=: + ;; + + --version | -V ) + at_version_p=: + ;; + + --clean | -c ) + at_clean=: + ;; + + --color ) + at_color=always + ;; + --color=* ) + case $at_optarg in + no | never | none) at_color=never ;; + auto | tty | if-tty) at_color=auto ;; + always | yes | force) at_color=always ;; + *) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'` + AS_ERROR([unrecognized argument to $at_optname: $at_optarg]) ;; + esac + ;; + + --debug | -d ) + at_debug_p=: + ;; + + --errexit | -e ) + at_debug_p=: + at_errexit_p=: + ;; + + --verbose | -v ) + at_verbose=; at_quiet=: + ;; + + --trace | -x ) + at_traceon='set -x' + at_trace_echo=echo + at_check_filter_trace=at_fn_filter_trace + ;; + + [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) + at_fn_validate_ranges at_option + AS_VAR_APPEND([at_groups], ["$at_option$as_nl"]) + ;; + + # Ranges + [[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-]) + at_range_start=`echo $at_option |tr -d X-` + at_fn_validate_ranges at_range_start + at_range=`AS_ECHO(["$at_groups_all"]) | \ + sed -ne '/^'$at_range_start'$/,$p'` + AS_VAR_APPEND([at_groups], ["$at_range$as_nl"]) + ;; + + [-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]]) + at_range_end=`echo $at_option |tr -d X-` + at_fn_validate_ranges at_range_end + at_range=`AS_ECHO(["$at_groups_all"]) | \ + sed -ne '1,/^'$at_range_end'$/p'` + AS_VAR_APPEND([at_groups], ["$at_range$as_nl"]) + ;; + + [[0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9]] | \ + [[0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9]] | \ + [[0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9]] | \ + [[0-9][0-9][0-9]-[0-9][0-9][0-9]] | \ + [[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] | \ + [[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]] ) + at_range_start=`expr $at_option : '\(.*\)-'` + at_range_end=`expr $at_option : '.*-\(.*\)'` + if test $at_range_start -gt $at_range_end; then + at_tmp=$at_range_end + at_range_end=$at_range_start + at_range_start=$at_tmp + fi + at_fn_validate_ranges at_range_start at_range_end + at_range=`AS_ECHO(["$at_groups_all"]) | \ + sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'` + AS_VAR_APPEND([at_groups], ["$at_range$as_nl"]) + ;; + + # Directory selection. + --directory | -C ) + at_prev=--directory + ;; + --directory=* ) + at_change_dir=: + at_dir=$at_optarg + if test x- = "x$at_dir" ; then + at_dir=./- + fi + ;; + + # Parallel execution. + --jobs | -j ) + at_jobs=0 + ;; + --jobs=* | -j[[0-9]]* ) + if test -n "$at_optarg"; then + at_jobs=$at_optarg + else + at_jobs=`expr X$at_option : 'X-j\(.*\)'` + fi + case $at_jobs in *[[!0-9]]*) + at_optname=`echo " $at_option" | sed 's/^ //; s/[[0-9=]].*//'` + AS_ERROR([non-numeric argument to $at_optname: $at_jobs]) ;; + esac + ;; + + # Keywords. + --keywords | -k ) + at_prev=--keywords + ;; + --keywords=* ) + at_groups_selected=$at_help_all + at_save_IFS=$IFS + IFS=, + set X $at_optarg + shift + IFS=$at_save_IFS + for at_keyword + do + at_invert= + case $at_keyword in + '!'*) + at_invert="-v" + at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'` + ;; + esac + # It is on purpose that we match the test group titles too. + at_groups_selected=`AS_ECHO(["$at_groups_selected"]) | + grep -i $at_invert ["^[1-9][^;]*;.*[; ]$at_keyword[ ;]"]` + done + # Smash the keywords. + at_groups_selected=`AS_ECHO(["$at_groups_selected"]) | sed 's/;.*//'` + AS_VAR_APPEND([at_groups], ["$at_groups_selected$as_nl"]) + ;; + --recheck) + at_recheck=: + ;; +m4_divert_pop([PARSE_ARGS])dnl +dnl Process *=* last to allow for user specified --option=* type arguments. +m4_divert_push([PARSE_ARGS_END])dnl + + *=*) + at_envvar=`expr "x$at_option" : 'x\([[^=]]*\)='` + # Reject names that are not valid shell variable names. + case $at_envvar in + '' | [[0-9]]* | *[[!_$as_cr_alnum]]* ) + AS_ERROR([invalid variable name: `$at_envvar']) ;; + esac + at_value=`AS_ECHO(["$at_optarg"]) | sed "s/'/'\\\\\\\\''/g"` + # Export now, but save eval for later and for debug scripts. + export $at_envvar + AS_VAR_APPEND([at_debug_args], [" $at_envvar='$at_value'"]) + ;; + + *) AS_ECHO(["$as_me: invalid option: $at_option"]) >&2 + AS_ECHO(["Try \`$[0] --help' for more information."]) >&2 + exit 1 + ;; + esac +done + +# Verify our last option didn't require an argument +AS_IF([test -n "$at_prev"], [AS_ERROR([`$at_prev' requires an argument])]) + +# The file containing the suite. +at_suite_log=$at_dir/$as_me.log + +# Selected test groups. +if test -z "$at_groups$at_recheck"; then + at_groups=$at_groups_all +else + if test -n "$at_recheck" && test -r "$at_suite_log"; then + at_oldfails=`sed -n [' + /^Failed tests:$/,/^Skipped tests:$/{ + s/^[ ]*\([1-9][0-9]*\):.*/\1/p + } + /^Unexpected passes:$/,/^## Detailed failed tests/{ + s/^[ ]*\([1-9][0-9]*\):.*/\1/p + } + /^## Detailed failed tests/q + '] "$at_suite_log"` + AS_VAR_APPEND([at_groups], ["$at_oldfails$as_nl"]) + fi + # Sort the tests, removing duplicates. + at_groups=`AS_ECHO(["$at_groups"]) | sort -nu | sed '/^$/d'` +fi + +if test x"$at_color" = xalways \ + || { test x"$at_color" = xauto && test -t 1; }; then + at_red=`printf '\033@<:@0;31m'` + at_grn=`printf '\033@<:@0;32m'` + at_lgn=`printf '\033@<:@1;32m'` + at_blu=`printf '\033@<:@1;34m'` + at_std=`printf '\033@<:@m'` +else + at_red= at_grn= at_lgn= at_blu= at_std= +fi +m4_divert_pop([PARSE_ARGS_END])dnl +m4_divert_push([HELP])dnl + +# Help message. +if $at_help_p; then + cat <<_ATEOF || at_write_fail=1 +Usage: $[0] [[OPTION]... [VARIABLE=VALUE]... [TESTS]] + +Run all the tests, or the selected TESTS, given by numeric ranges, and +save a detailed log file. Upon failure, create debugging scripts. + +Do not change environment variables directly. Instead, set them via +command line arguments. Set \`AUTOTEST_PATH' to select the executables +to exercise. Each relative directory is expanded as build and source +directories relative to the top level of this distribution. +E.g., from within the build directory /tmp/foo-1.0, invoking this: + + $ $[0] AUTOTEST_PATH=bin + +is equivalent to the following, assuming the source directory is /src/foo-1.0: + + PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $[0] +_ATEOF +m4_divert_pop([HELP])dnl +m4_divert_push([HELP_MODES])dnl +cat <<_ATEOF || at_write_fail=1 + +Operation modes: + -h, --help print the help message, then exit + -V, --version print version number, then exit + -c, --clean remove all the files this test suite might create and exit + -l, --list describes all the tests, or the selected TESTS +_ATEOF +m4_divert_pop([HELP_MODES])dnl +m4_wrap([m4_divert_push([HELP_TUNING_BEGIN])dnl +cat <<_ATEOF || at_write_fail=1 + +dnl extra quoting prevents emacs whitespace mode from putting tabs in output +Execution tuning: + -C, --directory=DIR +[ change to directory DIR before starting] + --color[[=never|auto|always]] +[ ]m4_ifdef([AT_color], + [disable colored test results, or enable even without terminal], + [enable colored test results on terminal, or always]) + -j, --jobs[[=N]] +[ Allow N jobs at once; infinite jobs with no arg (default 1)] + -k, --keywords=KEYWORDS +[ select the tests matching all the comma-separated KEYWORDS] +[ multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD] + --recheck select all tests that failed or passed unexpectedly last time + -e, --errexit abort as soon as a test fails; implies --debug + -v, --verbose force more detailed output +[ default for debugging scripts] + -d, --debug inhibit clean up and top-level logging +[ default for debugging scripts] + -x, --trace enable tests shell tracing +_ATEOF +m4_divert_pop([HELP_TUNING_BEGIN])])dnl +m4_divert_push([HELP_END])dnl +cat <<_ATEOF || at_write_fail=1 + +Report bugs to .dnl +m4_ifdef([AT_PACKAGE_NAME], +[m4_ifset([AT_PACKAGE_URL], [ +m4_defn([AT_PACKAGE_NAME]) home page: .])dnl +m4_if(m4_index(m4_defn([AT_PACKAGE_NAME]), [GNU ]), [0], [ +General help using GNU software: .])]) +_ATEOF + exit $at_write_fail +fi + +# List of tests. +if $at_list_p; then + cat <<_ATEOF || at_write_fail=1 +AT_TESTSUITE_NAME test groups: + + NUM: FILE-NAME:LINE TEST-GROUP-NAME + KEYWORDS + +_ATEOF + # Pass an empty line as separator between selected groups and help. + AS_ECHO(["$at_groups$as_nl$as_nl$at_help_all"]) | + awk 'NF == 1 && FS != ";" { + selected[[$ 1]] = 1 + next + } + /^$/ { FS = ";" } + NF > 0 { + if (selected[[$ 1]]) { + printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3 + if ($ 4) { + lmax = 79 + indent = " " + line = indent + len = length (line) + n = split ($ 4, a, " ") + for (i = 1; i <= n; i++) { + l = length (a[[i]]) + 1 + if (i > 1 && len + l > lmax) { + print line + line = indent " " a[[i]] + len = length (line) + } else { + line = line " " a[[i]] + len += l + } + } + if (n) + print line + } + } + }' || at_write_fail=1 + exit $at_write_fail +fi +m4_divert_pop([HELP_END])dnl +m4_divert_push([VERSION])dnl +if $at_version_p; then + AS_ECHO(["$as_me (AT_PACKAGE_STRING)"]) && + cat <<\_ATEOF || at_write_fail=1 +m4_divert_pop([VERSION])dnl +m4_divert_push([VERSION_END])dnl +_ATEOF + exit $at_write_fail +fi +m4_divert_pop([VERSION_END])dnl +m4_divert_push([TESTS_BEGIN])dnl + +# Take any -C into account. +if $at_change_dir ; then + test x != "x$at_dir" && cd "$at_dir" \ + || AS_ERROR([unable to change directory]) + at_dir=`pwd` +fi + +# Load the config files for any default variable assignments. +for at_file in atconfig atlocal +do + test -r $at_file || continue + . ./$at_file || AS_ERROR([invalid content: $at_file]) +done + +# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix: +: "${at_top_build_prefix=$at_top_builddir}" + +# Perform any assignments requested during argument parsing. +eval "$at_debug_args" + +# atconfig delivers names relative to the directory the test suite is +# in, but the groups themselves are run in testsuite-dir/group-dir. +if test -n "$at_top_srcdir"; then + builddir=../.. + for at_dir_var in srcdir top_srcdir top_build_prefix + do + AS_VAR_COPY([at_val], [at_$at_dir_var]) + case $at_val in + [[\\/$]]* | ?:[[\\/]]* ) at_prefix= ;; + *) at_prefix=../../ ;; + esac + AS_VAR_SET([$at_dir_var], [$at_prefix$at_val]) + done +fi + +m4_text_box([Directory structure.]) + +# This is the set of directories and files used by this script +# (non-literals are capitalized): +# +# TESTSUITE - the testsuite +# TESTSUITE.log - summarizes the complete testsuite run +# TESTSUITE.dir/ - created during a run, remains after -d or failed test +# + at-groups/ - during a run: status of all groups in run +# | + NNN/ - during a run: meta-data about test group NNN +# | | + check-line - location (source file and line) of current AT_CHECK +# | | + status - exit status of current AT_CHECK +# | | + stdout - stdout of current AT_CHECK +# | | + stder1 - stderr, including trace +# | | + stderr - stderr, with trace filtered out +# | | + test-source - portion of testsuite that defines group +# | | + times - timestamps for computing duration +# | | + pass - created if group passed +# | | + xpass - created if group xpassed +# | | + fail - created if group failed +# | | + xfail - created if group xfailed +# | | + skip - created if group skipped +# + at-stop - during a run: end the run if this file exists +# + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction +# + 0..NNN/ - created for each group NNN, remains after -d or failed test +# | + TESTSUITE.log - summarizes the group results +# | + ... - files created during the group + +# The directory the whole suite works in. +# Should be absolute to let the user `cd' at will. +at_suite_dir=$at_dir/$as_me.dir +# The file containing the suite ($at_dir might have changed since earlier). +at_suite_log=$at_dir/$as_me.log +# The directory containing helper files per test group. +at_helper_dir=$at_suite_dir/at-groups +# Stop file: if it exists, do not start new jobs. +at_stop_file=$at_suite_dir/at-stop +# The fifo used for the job dispatcher. +at_job_fifo=$at_suite_dir/at-job-fifo + +if $at_clean; then + test -d "$at_suite_dir" && + find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; + rm -f -r "$at_suite_dir" "$at_suite_log" + exit $? +fi + +# Don't take risks: use only absolute directories in PATH. +# +# For stand-alone test suites (ie. atconfig was not found), +# AUTOTEST_PATH is relative to `.'. +# +# For embedded test suites, AUTOTEST_PATH is relative to the top level +# of the package. Then expand it into build/src parts, since users +# may create executables in both places. +AUTOTEST_PATH=`AS_ECHO(["$AUTOTEST_PATH"]) | sed "s|:|$PATH_SEPARATOR|g"` +at_path= +_AS_PATH_WALK([$AUTOTEST_PATH $PATH], +[test -n "$at_path" && AS_VAR_APPEND([at_path], [$PATH_SEPARATOR]) +case $as_dir in + [[\\/]]* | ?:[[\\/]]* ) + AS_VAR_APPEND([at_path], ["$as_dir"]) + ;; + * ) + if test -z "$at_top_build_prefix"; then + # Stand-alone test suite. + AS_VAR_APPEND([at_path], ["$as_dir"]) + else + # Embedded test suite. + AS_VAR_APPEND([at_path], ["$at_top_build_prefix$as_dir$PATH_SEPARATOR"]) + AS_VAR_APPEND([at_path], ["$at_top_srcdir/$as_dir"]) + fi + ;; +esac]) + +# Now build and simplify PATH. +# +# There might be directories that don't exist, but don't redirect +# builtins' (eg., cd) stderr directly: Ultrix's sh hates that. +at_new_path= +_AS_PATH_WALK([$at_path], +[test -d "$as_dir" || continue +case $as_dir in + [[\\/]]* | ?:[[\\/]]* ) ;; + * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;; +esac +case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in + *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;; + $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;; + *) AS_VAR_APPEND([at_new_path], ["$PATH_SEPARATOR$as_dir"]) ;; +esac]) +PATH=$at_new_path +export PATH + +# Setting up the FDs. +m4_define([AS_MESSAGE_LOG_FD], [5]) +dnl The parent needs two fds to the same fifo, otherwise, there is a race +dnl where the parent can read the fifo before a child opens it for writing +m4_define([AT_JOB_FIFO_IN_FD], [6]) +m4_define([AT_JOB_FIFO_OUT_FD], [7]) +[#] AS_MESSAGE_LOG_FD is the log file. Not to be overwritten if `-d'. +if $at_debug_p; then + at_suite_log=/dev/null +else + : >"$at_suite_log" +fi +exec AS_MESSAGE_LOG_FD>>"$at_suite_log" + +# Banners and logs. +AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.]) +{ + AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.]) + echo + + AS_ECHO(["$as_me: command line was:"]) + AS_ECHO([" \$ $[0] $at_cli_args"]) + echo + + # If ChangeLog exists, list a few lines in case it might help determining + # the exact version. + if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then + AS_BOX([ChangeLog.]) + echo + sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog" + echo + fi + + AS_UNAME + echo + + # Contents of the config files. + for at_file in atconfig atlocal + do + test -r $at_file || continue + AS_ECHO(["$as_me: $at_file:"]) + sed 's/^/| /' $at_file + echo + done +} >&AS_MESSAGE_LOG_FD + +m4_divert_pop([TESTS_BEGIN])dnl +m4_divert_push([PREPARE_TESTS])dnl +{ + AS_BOX([Tested programs.]) + echo +} >&AS_MESSAGE_LOG_FD + +# Report what programs are being tested. +for at_program in : $at_tested +do + test "$at_program" = : && continue + case $at_program in + [[\\/]* | ?:[\\/]* ) $at_program_=$at_program ;;] + * ) + _AS_PATH_WALK([$PATH], [test -f "$as_dir/$at_program" && break]) + at_program_=$as_dir/$at_program ;; + esac + if test -f "$at_program_"; then + { + AS_ECHO(["$at_srcdir/AT_LINE: $at_program_ --version"]) + "$at_program_" --version &AS_MESSAGE_LOG_FD 2>&1 + else + AS_ERROR([cannot find $at_program]) + fi +done + +{ + AS_BOX([Running the tests.]) +} >&AS_MESSAGE_LOG_FD + +at_start_date=`date` +at_start_time=`date +%s 2>/dev/null` +AS_ECHO(["$as_me: starting at: $at_start_date"]) >&AS_MESSAGE_LOG_FD +m4_divert_pop([PREPARE_TESTS])dnl +m4_divert_push([TESTS])dnl + +# Create the master directory if it doesn't already exist. +AS_MKDIR_P(["$at_suite_dir"]) || + AS_ERROR([cannot create `$at_suite_dir']) + +# Can we diff with `/dev/null'? DU 5.0 refuses. +if diff /dev/null /dev/null >/dev/null 2>&1; then + at_devnull=/dev/null +else + at_devnull=$at_suite_dir/devnull + >"$at_devnull" +fi + +# Use `diff -u' when possible. +if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff" +then + at_diff='diff -u' +else + at_diff=diff +fi + +# Get the last needed group. +for at_group in : $at_groups; do :; done + +# Extract the start and end lines of each test group at the tail +# of this file +awk ' +BEGIN { FS="" } +/^@%:@AT_START_/ { + start = NR +} +/^@%:@AT_STOP_/ { + test = substr ($ 0, 10) + print "at_sed" test "=\"1," start "d;" (NR-1) "q\"" + if (test == "'"$at_group"'") exit +}' "$at_myself" > "$at_suite_dir/at-source-lines" && +. "$at_suite_dir/at-source-lines" || + AS_ERROR([cannot create test line number cache]) +rm -f "$at_suite_dir/at-source-lines" + +# Set number of jobs for `-j'; avoid more jobs than test groups. +set X $at_groups; shift; at_max_jobs=$[@%:@] +if test $at_max_jobs -eq 0; then + at_jobs=1 +fi +if test $at_jobs -ne 1 && + { test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then + at_jobs=$at_max_jobs +fi + +# If parallel mode, don't output banners, don't split summary lines. +if test $at_jobs -ne 1; then + at_print_banners=false + at_quiet=: +fi + +# Set up helper dirs. +rm -rf "$at_helper_dir" && +mkdir "$at_helper_dir" && +cd "$at_helper_dir" && +{ test -z "$at_groups" || mkdir $at_groups; } || +AS_ERROR([testsuite directory setup failed]) + +# Functions for running a test group. We leave the actual +# test group execution outside of a shell function in order +# to avoid hitting zsh 4.x exit status bugs. + +AS_FUNCTION_DESCRIBE([at_fn_group_prepare], [], +[Prepare for running a test group.]) +at_fn_group_prepare () +{ + # The directory for additional per-group helper files. + at_job_dir=$at_helper_dir/$at_group + # The file containing the location of the last AT_CHECK. + at_check_line_file=$at_job_dir/check-line + # The file containing the exit status of the last command. + at_status_file=$at_job_dir/status + # The files containing the output of the tested commands. + at_stdout=$at_job_dir/stdout + at_stder1=$at_job_dir/stder1 + at_stderr=$at_job_dir/stderr + # The file containing the code for a test group. + at_test_source=$at_job_dir/test-source + # The file containing dates. + at_times_file=$at_job_dir/times + + # Be sure to come back to the top test directory. + cd "$at_suite_dir" + + # Clearly separate the test groups when verbose. + $at_first || $at_verbose echo + + at_group_normalized=$at_group + _AT_NORMALIZE_TEST_GROUP_NUMBER(at_group_normalized) + + # Create a fresh directory for the next test group, and enter. + # If one already exists, the user may have invoked ./run from + # within that directory; we remove the contents, but not the + # directory itself, so that we aren't pulling the rug out from + # under the shell's notion of the current directory. + at_group_dir=$at_suite_dir/$at_group_normalized + at_group_log=$at_group_dir/$as_me.log + _AS_CLEAN_DIR("$at_group_dir") || + AS_WARN([test directory for $at_group_normalized could not be cleaned]) + # Be tolerant if the above `rm' was not able to remove the directory. + AS_MKDIR_P(["$at_group_dir"]) + + echo 0 > "$at_status_file" + + # In verbose mode, append to the log file *and* show on + # the standard output; in quiet mode only write to the log. + if test -z "$at_verbose"; then + at_tee_pipe='tee -a "$at_group_log"' + else + at_tee_pipe='cat >> "$at_group_log"' + fi +} + +AS_FUNCTION_DESCRIBE([at_fn_group_banner], [[ORDINAL LINE DESC PAD [BANNER]]], +[Declare the test group ORDINAL, located at LINE with group description +DESC, and residing under BANNER. Use PAD to align the status column.]) +at_fn_group_banner () +{ + at_setup_line="$[2]" + test -n "$[5]" && at_fn_banner $[5] + at_desc="$[3]" + case $[1] in + [[0-9]]) at_desc_line=" $[1]: ";; + [[0-9][0-9]]) at_desc_line=" $[1]: " ;; + [*]) at_desc_line="$[1]: " ;; + esac + AS_VAR_APPEND([at_desc_line], ["$[3]$[4]"]) + $at_quiet AS_ECHO_N(["$at_desc_line"]) + echo "# -*- compilation -*-" >> "$at_group_log" +} + +AS_FUNCTION_DESCRIBE([at_fn_group_postprocess], [], +[Perform cleanup after running a test group.]) +at_fn_group_postprocess () +{ + # Be sure to come back to the suite directory, in particular + # since below we might `rm' the group directory we are in currently. + cd "$at_suite_dir" + + if test ! -f "$at_check_line_file"; then + sed "s/^ */$as_me: WARNING: /" <<_ATEOF + A failure happened in a test group before any test could be + run. This means that test suite is improperly designed. Please + report this failure to . +_ATEOF + AS_ECHO(["$at_setup_line"]) >"$at_check_line_file" + at_status=99 + fi + $at_verbose AS_ECHO_N(["$at_group. $at_setup_line: "]) + AS_ECHO_N(["$at_group. $at_setup_line: "]) >> "$at_group_log" + case $at_xfail:$at_status in + yes:0) + at_msg="UNEXPECTED PASS" + at_res=xpass + at_errexit=$at_errexit_p + at_color=$at_red + ;; + no:0) + at_msg="ok" + at_res=pass + at_errexit=false + at_color=$at_grn + ;; + *:77) + at_msg='skipped ('`cat "$at_check_line_file"`')' + at_res=skip + at_errexit=false + at_color=$at_blu + ;; + no:* | *:99) + at_msg='FAILED ('`cat "$at_check_line_file"`')' + at_res=fail + at_errexit=$at_errexit_p + at_color=$at_red + ;; + yes:*) + at_msg='expected failure ('`cat "$at_check_line_file"`')' + at_res=xfail + at_errexit=false + at_color=$at_lgn + ;; + esac + echo "$at_res" > "$at_job_dir/$at_res" + # In parallel mode, output the summary line only afterwards. + if test $at_jobs -ne 1 && test -n "$at_verbose"; then + AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"]) + else + # Make sure there is a separator even with long titles. + AS_ECHO([" $at_color$at_msg$at_std"]) + fi + at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" + case $at_status in + 0|77) + # $at_times_file is only available if the group succeeded. + # We're not including the group log, so the success message + # is written in the global log separately. But we also + # write to the group log in case they're using -d. + if test -f "$at_times_file"; then + at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')' + rm -f "$at_times_file" + fi + AS_ECHO(["$at_log_msg"]) >> "$at_group_log" + AS_ECHO(["$at_log_msg"]) >&AS_MESSAGE_LOG_FD + + # Cleanup the group directory, unless the user wants the files + # or the success was unexpected. + if $at_debug_p || test $at_res = xpass; then + at_fn_create_debugging_script + if test $at_res = xpass && $at_errexit; then + echo stop > "$at_stop_file" + fi + else + if test -d "$at_group_dir"; then + find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; + rm -fr "$at_group_dir" + fi + rm -f "$at_test_source" + fi + ;; + *) + # Upon failure, include the log into the testsuite's global + # log. The failure message is written in the group log. It + # is later included in the global log. + AS_ECHO(["$at_log_msg"]) >> "$at_group_log" + + # Upon failure, keep the group directory for autopsy, and create + # the debugging script. With -e, do not start any further tests. + at_fn_create_debugging_script + if $at_errexit; then + echo stop > "$at_stop_file" + fi + ;; + esac +} + + +m4_text_box([Driver loop.]) + +dnl Catching signals correctly: +dnl +dnl The first idea was: trap the signal, send it to all spawned jobs, +dnl then reset the handler and reraise the signal for ourselves. +dnl However, before exiting, ksh will then send the signal to all +dnl process group members, potentially killing the outer testsuite +dnl and/or the 'make' process driving us. +dnl So now the strategy is: trap the signal, send it to all spawned jobs, +dnl then exit the script with the right status. +dnl +dnl In order to let the jobs know about the signal, we cannot just send it +dnl to the current process group (kill $SIG 0), for the same reason as above. +dnl Also, it does not reliably stop the suite to send the signal to the +dnl spawned processes, because they might not transport it further +dnl (maybe this can be fixed?). +dnl +dnl So what we do is enable shell job control if available, which causes the +dnl shell to start each parallel task as its own shell job, thus as a new +dnl process group leader. We then send the signal to all new process groups. + +dnl Do we have job control? +if (set -m && set +m && set +b) >/dev/null 2>&1; then + set +b + at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=- +else + at_job_control_on=: at_job_control_off=: at_job_group= +fi + +for at_signal in 1 2 15; do +dnl This signal handler is not suitable for PIPE: it causes writes. +dnl The code that was interrupted may have the errexit, monitor, or xtrace +dnl flags enabled, so sanitize. + trap 'set +x; set +e + $at_job_control_off + at_signal='"$at_signal"' +dnl Safety belt: even with runaway processes, prevent starting new jobs. + echo stop > "$at_stop_file" +dnl Do not enter this area multiple times, do not kill self prematurely. + trap "" $at_signal +dnl Gather process group IDs of currently running jobs. + at_pgids= + for at_pgid in `jobs -p 2>/dev/null`; do + at_pgids="$at_pgids $at_job_group$at_pgid" + done +dnl Ignore `kill' errors, as some jobs may have finished in the meantime. + test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null +dnl wait until all jobs have exited. + wait +dnl Status output. Do this after waiting for the jobs, for ordered output. +dnl Avoid scribbling onto the end of a possibly incomplete line. + if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then + echo >&2 + fi + at_signame=`kill -l $at_signal 2>&1 || echo $at_signal` + set x $at_signame + test $# -gt 2 && at_signame=$at_signal + AS_WARN([caught signal $at_signame, bailing out]) +dnl Do not reinstall the default handler here and reraise the signal to +dnl let the default handler do its job, see the note about ksh above. +dnl trap - $at_signal +dnl kill -$at_signal $$ +dnl Instead, exit with appropriate status. + AS_VAR_ARITH([exit_status], [128 + $at_signal]) + AS_EXIT([$exit_status])' $at_signal +done + +rm -f "$at_stop_file" +at_first=: + +if test $at_jobs -ne 1 && + rm -f "$at_job_fifo" && + test -n "$at_job_group" && + ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null +then + # FIFO job dispatcher. + +dnl Since we use job control, we need to propagate TSTP. +dnl This handler need not be used for serial execution. +dnl Again, we should stop all processes in the job groups, otherwise +dnl the stopping will not be effective while one test group is running. +dnl Apparently ksh does not honor the TSTP trap. +dnl As a safety measure, not use the same variable names as in the +dnl termination handlers above, one might get called during execution +dnl of the other. + trap 'at_pids= + for at_pid in `jobs -p`; do + at_pids="$at_pids $at_job_group$at_pid" + done +dnl Send it to all spawned jobs, ignoring those finished meanwhile. + if test -n "$at_pids"; then +dnl Unfortunately, ksh93 fork-bombs when we send TSTP, so send STOP +dnl if this might be ksh (STOP prevents possible TSTP handlers inside +dnl AT_CHECKs from running). Then stop ourselves. + at_sig=TSTP + test "${TMOUT+set}" = set && at_sig=STOP + kill -$at_sig $at_pids 2>/dev/null + fi + kill -STOP $$ +dnl We got a CONT, so let's go again. Passing this to all processes +dnl in the groups is necessary (because we stopped them), but it may +dnl cause changed test semantics; e.g., a sleep will be interrupted. + test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP + + echo + # Turn jobs into a list of numbers, starting from 1. + at_joblist=`AS_ECHO(["$at_groups"]) | sed -n 1,${at_jobs}p` + + set X $at_joblist + shift + for at_group in $at_groups; do +dnl Enable job control only for spawning the test group: +dnl Let the jobs to run in separate process groups, but +dnl avoid all the status output by the shell. + $at_job_control_on 2>/dev/null + ( + # Start one test group. + $at_job_control_off +dnl First child must open the fifo to avoid blocking parent; all other +dnl children inherit it already opened from the parent. + if $at_first; then + exec AT_JOB_FIFO_OUT_FD>"$at_job_fifo" + else +dnl Children do not need parent's copy of fifo. + exec AT_JOB_FIFO_IN_FD<&- + fi +dnl When a child receives PIPE, be sure to write back the token, +dnl so the master does not hang waiting for it. +dnl errexit and xtrace should not be set in this shell instance, +dnl except as debug measures. However, shells such as dash may +dnl optimize away the _AT_CHECK subshell, so normalize here. + trap 'set +x; set +e +dnl Ignore PIPE signals that stem from writing back the token. + trap "" PIPE + echo stop > "$at_stop_file" + echo >&AT_JOB_FIFO_OUT_FD +dnl Do not reraise the default PIPE handler. +dnl It wreaks havoc with ksh, see above. +dnl trap - 13 +dnl kill -13 $$ + AS_EXIT([141])' PIPE + at_fn_group_prepare + if cd "$at_group_dir" && + at_fn_test $at_group && + . "$at_test_source" + then :; else + AS_WARN([unable to parse test group: $at_group]) + at_failed=: + fi + at_fn_group_postprocess + echo >&AT_JOB_FIFO_OUT_FD + ) & + $at_job_control_off + if $at_first; then + at_first=false + exec AT_JOB_FIFO_IN_FD<"$at_job_fifo" AT_JOB_FIFO_OUT_FD>"$at_job_fifo" + fi + shift # Consume one token. + if test $[@%:@] -gt 0; then :; else + read at_token <&AT_JOB_FIFO_IN_FD || break + set x $[*] + fi + test -f "$at_stop_file" && break + done + exec AT_JOB_FIFO_OUT_FD>&- + # Read back the remaining ($at_jobs - 1) tokens. + set X $at_joblist + shift + if test $[@%:@] -gt 0; then + shift + for at_job + do + read at_token + done <&AT_JOB_FIFO_IN_FD + fi + exec AT_JOB_FIFO_IN_FD<&- + wait +else + # Run serially, avoid forks and other potential surprises. + for at_group in $at_groups; do + at_fn_group_prepare + if cd "$at_group_dir" && + at_fn_test $at_group && + . "$at_test_source"; then :; else + AS_WARN([unable to parse test group: $at_group]) + at_failed=: + fi + at_fn_group_postprocess + test -f "$at_stop_file" && break + at_first=false + done +fi + +# Wrap up the test suite with summary statistics. +cd "$at_helper_dir" + +# Use ?..???? when the list must remain sorted, the faster * otherwise. +at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'` +at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'` +at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'` +at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do + echo $f; done | sed '/?/d; s,/xpass,,'` +at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do + echo $f; done | sed '/?/d; s,/fail,,'` + +set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list +shift; at_group_count=$[@%:@] +set X $at_xpass_list; shift; at_xpass_count=$[@%:@]; at_xpass_list=$[*] +set X $at_xfail_list; shift; at_xfail_count=$[@%:@] +set X $at_fail_list; shift; at_fail_count=$[@%:@]; at_fail_list=$[*] +set X $at_skip_list; shift; at_skip_count=$[@%:@] + +AS_VAR_ARITH([at_run_count], [$at_group_count - $at_skip_count]) +AS_VAR_ARITH([at_unexpected_count], [$at_xpass_count + $at_fail_count]) +AS_VAR_ARITH([at_total_fail_count], [$at_xfail_count + $at_fail_count]) + +# Back to the top directory. +cd "$at_dir" +rm -rf "$at_helper_dir" + +# Compute the duration of the suite. +at_stop_date=`date` +at_stop_time=`date +%s 2>/dev/null` +AS_ECHO(["$as_me: ending at: $at_stop_date"]) >&AS_MESSAGE_LOG_FD +case $at_start_time,$at_stop_time in + [[0-9]*,[0-9]*]) + AS_VAR_ARITH([at_duration_s], [$at_stop_time - $at_start_time]) + AS_VAR_ARITH([at_duration_m], [$at_duration_s / 60]) + AS_VAR_ARITH([at_duration_h], [$at_duration_m / 60]) + AS_VAR_ARITH([at_duration_s], [$at_duration_s % 60]) + AS_VAR_ARITH([at_duration_m], [$at_duration_m % 60]) + at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s" + AS_ECHO(["$as_me: test suite duration: $at_duration"]) >&AS_MESSAGE_LOG_FD + ;; +esac + +echo +AS_BOX([Test results.]) +echo +{ + echo + AS_BOX([Test results.]) + echo +} >&AS_MESSAGE_LOG_FD + +dnl +dnl FIXME: this code is as far from i18n-cleanness as man +dnl could imagine... +dnl +if test $at_run_count = 1; then + at_result="1 test" + at_were=was +else + at_result="$at_run_count tests" + at_were=were +fi +if $at_errexit_p && test $at_unexpected_count != 0; then + if test $at_xpass_count = 1; then + at_result="$at_result $at_were run, one passed" + else + at_result="$at_result $at_were run, one failed" + fi + at_result="$at_result unexpectedly and inhibited subsequent tests." + at_color=$at_red +else + # Don't you just love exponential explosion of the number of cases? + at_color=$at_red + case $at_xpass_count:$at_fail_count:$at_xfail_count in + # So far, so good. + 0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;; + 0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;; + + # Some unexpected failures + 0:*:0) at_result="$at_result $at_were run, +$at_fail_count failed unexpectedly." ;; + + # Some failures, both expected and unexpected + 0:*:1) at_result="$at_result $at_were run, +$at_total_fail_count failed ($at_xfail_count expected failure)." ;; + 0:*:*) at_result="$at_result $at_were run, +$at_total_fail_count failed ($at_xfail_count expected failures)." ;; + + # No unexpected failures, but some xpasses + *:0:*) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly." ;; + + # No expected failures, but failures and xpasses + *:1:0) at_result="$at_result $at_were run, +$at_unexpected_count did not behave as expected dnl +($at_fail_count unexpected failure)." ;; + *:*:0) at_result="$at_result $at_were run, +$at_unexpected_count did not behave as expected dnl +($at_fail_count unexpected failures)." ;; + + # All of them. + *:*:1) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly, +$at_total_fail_count failed ($at_xfail_count expected failure)." ;; + *:*:*) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly, +$at_total_fail_count failed ($at_xfail_count expected failures)." ;; + esac + + if test $at_skip_count = 0 && test $at_run_count -gt 1; then + at_result="All $at_result" + fi +fi + +# Now put skips in the mix. +case $at_skip_count in + 0) ;; + 1) at_result="$at_result +1 test was skipped." ;; + *) at_result="$at_result +$at_skip_count tests were skipped." ;; +esac + +if test $at_unexpected_count = 0; then + echo "$at_color$at_result$at_std" + echo "$at_result" >&AS_MESSAGE_LOG_FD +else + echo "${at_color}ERROR: $at_result$at_std" >&2 + echo "ERROR: $at_result" >&AS_MESSAGE_LOG_FD + { + echo + AS_BOX([Summary of the failures.]) + + # Summary of failed and skipped tests. + if test $at_fail_count != 0; then + echo "Failed tests:" + $SHELL "$at_myself" $at_fail_list --list + echo + fi + if test $at_skip_count != 0; then + echo "Skipped tests:" + $SHELL "$at_myself" $at_skip_list --list + echo + fi + if test $at_xpass_count != 0; then + echo "Unexpected passes:" + $SHELL "$at_myself" $at_xpass_list --list + echo + fi + if test $at_fail_count != 0; then + AS_BOX([Detailed failed tests.]) + echo + for at_group in $at_fail_list + do + at_group_normalized=$at_group + _AT_NORMALIZE_TEST_GROUP_NUMBER(at_group_normalized) + cat "$at_suite_dir/$at_group_normalized/$as_me.log" + echo + done + echo + fi + if test -n "$at_top_srcdir"; then + AS_BOX([${at_top_build_prefix}config.log]) + sed 's/^/| /' ${at_top_build_prefix}config.log + echo + fi + } >&AS_MESSAGE_LOG_FD + + AS_BOX([$as_me.log was created.]) + + echo + if $at_debug_p; then + at_msg='per-test log files' + else + at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'" + fi + AS_ECHO(["Please send $at_msg and all information you think might help: + + To: + Subject: @<:@AT_PACKAGE_STRING@:>@ $as_me: dnl +$at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}dnl +$at_xpass_list${at_xpass_list:+ passed unexpectedly} + +You may investigate any problem if you feel able to do so, in which +case the test suite provides a good starting point. Its output may +be found below \`${at_testdir+${at_testdir}/}$as_me.dir'. +"]) + exit 1 +fi + +exit 0 + +m4_text_box([Actual tests.]) +m4_divert_pop([TESTS])dnl +dnl End of AT_INIT: divert to KILL, only test groups are to be +dnl output, the rest is ignored. Current diversion is BODY, inherited +dnl from M4sh. +m4_divert([KILL]) + +T16,103 +AS_IDENTIFIER_IFm4_if(_$0(m4_if(m4_index([$1], [@]), [-1], + [[$1]], [m4_bpatsubst([[$1]], [@&t@])])), [-], [$2], [$3]) +F11,7 +m4_maketempmkstemp +T17,129 +_AS_DETECT_EXPAND$1="m4_bpatsubst(m4_dquote(AS_ESCAPE(_m4_expand(m4_set_contents([$2], [ +])))), [\\\$LINENO\(.*\)$], [";$1=$$1$LINENO;$1=$$1"\1])" +T4,37 +m4_nm4_if([$1], + [], [], + [$1 +]) +T26,29 +m4_location(AS_LINENO_POP)../../lib/m4sugar/m4sh.m4:904 +T8,22 +AS_TR_SH_$0(m4_expand([$1]))[] +T8,124 +AS_TR_SH_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,154 +m4_providem4_ifdef([m4_provide($1)], [], +[m4_set_add([_m4_provide], [$1], [m4_define([m4_provide($1)], + m4_ifdef([_m4_diverting], [_m4_defn([_m4_diverting])]))])]) +T13,100 +AS_LINENO_POP_m4_defun_pro([$0])eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno[]_m4_defun_epi([$0]) +T11,65 +m4_set_sizem4_ifdef([_m4_set_size($1)], [m4_indir([_m4_set_size($1)])], [0]) +T9,0 +m4_ignore +T9,28 +_m4_quotem4_if([$#], [0], [], [[$*]]) +T29,3 +_m4_divert(HELP_TUNING_BEGIN)302 +T22,3 +_m4_divert(HELP_MODES)301 +T21,30 +m4_location(AS_TR_SH)../../lib/m4sugar/m4sh.m4:1826 +T22,3 +_m4_divert(HELP_OTHER)304 +T9,35 +m4_shiftnm4_assert(0 < $1 && $1 < $#)_$0($@) +T7,75 +m4_warn_m4_warn([$1], [$2], +m4_ifdef([_m4_expansion_stack], [m4_expansion_stack])) +T23,3 +_m4_divert(TESTS_BEGIN)401 +T16,245 +m4_cr_not_digits +  !"#*%&'()$+,./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T12,25 +m4_set_listcm4_set_map_sep([$1], [,]) +F9,6 +m4_divnumdivnum +T30,30 +m4_location(AS_INIT_GENERATED)../../lib/m4sugar/m4sh.m4:2121 +T21,76 +_m4_set_add_all_checkm4_if([$#], [2], [], + [m4_set_add([$1], [$3])$0([$1], m4_shift2($@))]) +T17,220 +AT_CHECK_UNQUOTEDm4_ifndef([AT_ingroup], + [m4_fatal([AT_CHECK_UNQUOTED: missing AT_SETUP detected])])_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3])), [""]), + AS_ESCAPE(m4_dquote(m4_expand([$4])), [""]), [$5], [$6]) +T24,1 +_m4_divert(M4SH-INIT-FN)5 +T8,199 +AT_CHECKm4_ifndef([AT_ingroup], + [m4_fatal([AT_CHECK: missing AT_SETUP detected])])_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3]))), + AS_ESCAPE(m4_dquote(m4_expand([$4]))), [$5], [$6]) +T10,91 +AS_VAR_SETAS_LITERAL_WORD_IF([$1], + [$1=$2], + [eval "$1=_AS_ESCAPE([$2], [`], [\"$])"]) +T10,3 +m4_newline +$1 +T16,31 +_AT_LINE_ESCAPED"AS_ESCAPE(m4_dquote(AT_LINE))" +T13,293 +m4_defun_oncem4_define([m4_location($1)], m4_location)m4_define([$1], [_m4_defun_once([$1], [$2], m4_if(_m4_divert_dump, [], + [[_m4_defun_pro([$1])m4_unquote(], [)_m4_defun_epi([$1])]], +m4_ifdef([_m4_diverting([$1])], [-]), [-], [[m4_unquote(], [)]], + [[_m4_require_call([$1],], [, _m4_divert_dump)]]))]) +T13,474 +_m4_text_wrapm4_pushdef([m4_Indent], m4_qlen([$2]))m4_pushdef([m4_Cursor], m4_qlen([$3]))m4_pushdef([m4_Separator], [m4_define([m4_Separator], [ ])])[$3]m4_cond([m4_Cursor], m4_Indent, [], + [m4_eval(m4_Cursor > m4_Indent)], [1], [ +[$2]m4_define([m4_Cursor], m4_Indent)], + [m4_format([%*s], m4_max([0], + m4_eval(m4_Indent - m4_Cursor)), [])m4_define([m4_Cursor], m4_Indent)])m4_map_args_w([$1], [$0_word(], [, [$2], [$4])])_m4_popdef([m4_Separator], [m4_Cursor], [m4_Indent]) +T21,342 +_AS_BOURNE_COMPATIBLEAS_IF([test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1], + [emulate sh + NULLCMD=: + [#] Pre-4.2 versions of Zsh do word splitting on ${1+"$[@]"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$[@]"}'='"$[@]"' + setopt NO_GLOB_SUBST], + [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])]) + +T20,35 +_AT_DEFINE_INIT_LIST[AT_SETUP],[AT_CLEANUP],[AT_BANNER] +T15,99 +_AS_LITERAL_IF_m4_if(m4_translit([$1], [+]), [], [$0YES], + m4_translit([$1], [$]), [], [m4_default], [$0NO]) +F9,6 +m4_formatformat +F10,7 +m4_mkstempmkstemp +T12,93 +AT_COPYRIGHTAS_COPYRIGHT([$1])[]m4_divert_text([VERSION_NOTICES], +[m4_default([$2], [m4_newline])([$1])]) +F11,11 +__program____program__ +T14,997 +AT_CHECK_EUNITm4_ifndef([AT_ingroup], + [m4_fatal([AT_CHECK_EUNIT: missing AT_SETUP detected])])AT_SKIP_IF([test ! -f "$ERL" || test ! -f "$ERLC"]) +## A wrapper to EUnit, to exit the Erlang VM with the right exit code: +AT_DATA([$1.erl], +[[-module($1). +-export([test/0, test/1]). +test() -> test([]). +test(Options) -> + TestSpec = $2, + ReturnValue = case code:load_file(eunit) of + {module, _} -> case eunit:test(TestSpec, Options) of + ok -> "0\n"; %% test passes + _ -> "1\n" %% test fails + end; + _ -> "77\n" %% EUnit not found, test skipped + end, + file:write_file("$1.result", ReturnValue), + init:stop(). +]]) +AT_CHECK(["$ERLC" $ERLCFLAGS -b beam $1.erl]) +## Make EUnit verbose when testsuite is verbose: +if test -z "$at_verbose"; then + at_eunit_options="verbose" +else + at_eunit_options="" +fi +AT_CHECK(["$ERL" $3 -s $1 test $at_eunit_options -noshell], [0], [ignore], [], + [$4], [$5]) +AT_CAPTURE_FILE([$1.result]) +AT_CHECK([test -f "$1.result" && (exit `cat "$1.result"`)]) + +T6,26 +AS_BOX_$0(m4_expand([$1]), [$2]) +T7,156 +m4_defnm4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_defn([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T17,149 +AT_CHECK_NOESCAPEm4_warn([obsolete], [consider using AT_CHECK_UNQUOTED instead of $0])_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]), + m4_expand([$4]), [$5], [$6]) +T11,544 +_AS_PREPARE_m4_defun_pro([$0])m4_pushdef([AS_REQUIRE])m4_pushdef([AS_REQUIRE_SHELL_FN], _m4_defn([_AS_REQUIRE_SHELL_FN]) +)m4_pushdef([AS_MESSAGE_LOG_FD], [-1])_AS_ERROR_PREPARE +_m4_popdef([AS_MESSAGE_LOG_FD])_AS_EXIT_PREPARE +_AS_UNSET_PREPARE +_AS_VAR_APPEND_PREPARE +_AS_VAR_ARITH_PREPARE + +_AS_EXPR_PREPARE +_AS_BASENAME_PREPARE +_AS_DIRNAME_PREPARE +_AS_ME_PREPARE +_AS_CR_PREPARE +_AS_ECHO_N_PREPARE +_AS_LN_S_PREPARE +_AS_MKDIR_P_PREPARE +_AS_TEST_PREPARE +_AS_TR_CPP_PREPARE +_AS_TR_SH_PREPARE +_m4_popdef([AS_REQUIRE], [AS_REQUIRE_SHELL_FN])[]_m4_defun_epi([$0]) +T16,54 +m4_append_uniq_wm4_map_args_w([$2], [_m4_append_uniq([$1],], [, [ ])]) +T13,76 +AT_ARG_OPTION_m4_defun_pro([$0])_AT_ARG_OPTION([$1],[$2],,[$3],[$4])[]_m4_defun_epi([$0]) +T13,207 +m4_map_args_w_$0(_m4_split([ ]m4_flatten([$1])[ ], [[ ]+], + m4_if(m4_index([$2$3$4], [\]), [-1], [[$3[]$4[]$2]], + [m4_bpatsubst([[$3[]$4[]$2]], [\\], [\\\\])])), + m4_len([[]$3[]$4]), m4_len([$4[]$2[]])) +T6,4 +m4_car[$1] +T8,2 +m4_count$# +T14,42 +_m4_defun_oncem4_pushdef([$1])$3[$2[]m4_provide([$1])]$4 +T16,1346 +_AS_ECHO_PREPARE_m4_defun_pro([$0])[as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$][1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$][1; + case $arg in @%:@( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi +][]_m4_defun_epi([$0]) +T10,681 +AT_CLEANUPm4_ifdef([AT_ingroup], [AT_ingroup[]_m4_undefine([AT_ingroup])], + [m4_fatal([$0: missing AT_SETUP detected])])dnl +m4_append([AT_help_all], +m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);dnl +m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]); +)dnl +m4_divert_pop([TEST_SCRIPT])dnl Back to TEST_GROUPS +AT_xfail +( + AS_ECHO(["AT_ordinal. $at_setup_line: testing $at_desc ..."]) + $at_traceon +m4_undivert([TEST_SCRIPT])dnl Insert the code here + set +x + $at_times_p && times >"$at_times_file" +) AS_MESSAGE_LOG_FD>&1 2>&1 AT_JOB_FIFO_OUT_FD>&- | eval $at_tee_pipe +read at_status <"$at_status_file" +[#AT_STOP_]AT_ordinal +m4_divert_pop([TEST_GROUPS])dnl Back to KILL. + +T10,48 +AT_CLEANUPm4_fatal([AT_CLEANUP: missing AT_INIT detected]) +T17,164 +_AS_UNSET_PREPARE_m4_defun_pro([$0])AS_FUNCTION_DESCRIBE([as_fn_unset], [VAR], [Portably unset VAR.]) +as_fn_unset () +{ + AS_UNSET([$[1]]) +} +as_unset=as_fn_unset[]_m4_defun_epi([$0]) +T14,62 +m4_set_foreachm4_pushdef([$2])m4_set_map_sep([$1], [m4_define([$2],], [)$3]) +T16,101 +m4_stack_foreach_m4_stack_reverse([$1], [m4_tmp-$1])_m4_stack_reverse([m4_tmp-$1], [$1], [$2(_m4_defn([m4_tmp-$1]))]) +T12,77 +m4_chomp_allm4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [ +/], [/ ]), [/*$]), [$1]) +T6,46 +m4_cmpm4_eval((([$1]) > ([$2])) - (([$1]) < ([$2]))) +T9,373 +AS_TMPDIR# Create a (secure) tmp directory for tmp files. +m4_if([$2], [], [: "${TMPDIR:=/tmp}"]) +{ + tmp=`(umask 077 && mktemp -d "m4_default([$2], + [$TMPDIR])/$1XXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || AS_ERROR([cannot create a temporary directory in m4_default([$2], + [$TMPDIR])]) +T17,51 +_AS_ECHO_UNQUOTEDAS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD]) +T20,96 +_AS_DETECT_SUGGESTED_m4_defun_pro([$0])m4_set_add([_AS_DETECT_SUGGESTED_BODY], [$1 || AS_EXIT])[]_m4_defun_epi([$0]) +T17,57 +AS_LINENO_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_$0])[]_m4_defun_epi([$0]) +F5,6 +m4_ififelse +T9,36 +m4_renamem4_copy([$1], [$2])m4_undefine([$1]) +F8,5 +m4_indirindir +T12,1 +_m4_divert()0 +T31,30 +m4_location(_AS_TR_CPP_PREPARE)../../lib/m4sugar/m4sh.m4:1845 +F12,9 +m4_changecomchangecom +T20,40 +_AS_VAR_APPEND_WORKSas_var=1; as_var+=2; test x$as_var = x12 +T10,62 +m4_noquotem4_changequote([-=<{(],[)}>=-])$1-=<{()}>=-m4_changequote([,]) +T14,2182 +_AT_ARG_OPTION_m4_defun_pro([$0])m4_divert_once([HELP_OTHER], +[cat <<_ATEOF || at_write_fail=1 + +Other options: +_ATEOF +])dnl m4_divert_once HELP_OTHER +m4_divert_text([HELP_OTHER], +[cat <<_ATEOF || at_write_fail=1 +$2 +_ATEOF])dnl +dnl Turn our options into our desired strings +m4_ifdef([AT_first_option],[m4_undefine([AT_first_option])])dnl +m4_ifdef([AT_case],[m4_undefine([AT_case])])dnl +m4_ifdef([AT_case_no],[m4_undefine([AT_case_no])])dnl +m4_ifdef([AT_case_arg],[m4_undefine([AT_case_arg])])dnl +m4_foreach([AT_option], m4_split(m4_normalize([$1]),[[ \|]+]), +[m4_define_default([AT_first_option],AT_option)dnl +m4_define_default([AT_first_option_tr], + [m4_bpatsubst(m4_defn([AT_first_option]), -, [_])])dnl +m4_append([AT_case],m4_if(m4_len(AT_option),1,[],[-])[-]AT_option, [ | ])dnl +m4_append([AT_case_no],[--no-]AT_option, [ | ])dnl +m4_append([AT_case_arg], + m4_if(m4_len(AT_option),1,[],[-])[-]AT_option[=*], [ | ])dnl +])dnl m4_foreach AT_option +dnl keep track so we or the user may process ACTION-IF-NOT-GIVEN +m4_divert_once([PARSE_ARGS_BEGIN], +[ +## +## Set up package specific options. +## +])dnl +m4_divert_text([PARSE_ARGS_BEGIN], +[dnl Provide a default value for options without arguments. +m4_ifvaln([$3],,[at_arg_[]AT_first_option_tr=false])dnl +at_arg_given_[]AT_first_option_tr=false +])dnl m4_divert_text DEFAULTS +m4_divert_text([PARSE_ARGS], +[dnl Parse the options and args when necessary. +m4_ifvaln([$3], +[ AT_case ) + at_prev=--AT_first_option_tr + ;; + AT_case_arg ) + at_arg_[]AT_first_option_tr=$at_optarg + at_arg_given_[]AT_first_option_tr=: + $4 + ;;], +[ AT_case ) + at_optarg=: + at_arg_[]AT_first_option_tr=: + at_arg_given_[]AT_first_option_tr=: + m4_ifval([$4],[$4])[]dnl + ;; + AT_case_no ) + at_optarg=false + at_arg_[]AT_first_option_tr=false + at_arg_given_[]AT_first_option_tr=: + m4_ifval([$4],[$4])[]dnl + ;;])dnl m4_ifvaln $3 +])dnl m4_divert_text PARSE_ARGS +m4_ifvaln([$5], +[m4_divert_once([PARSE_ARGS_END], +[ +## +## Process package specific options when _not_ supplied. +##])dnl m4_divert_once PARSE_ARGS_END +m4_divert_text([PARSE_ARGS_END], +[ +AS_IF([$at_arg_given_[]AT_first_option_tr],,[$5])dnl +])dnl m4_divert_text PARSE_ARGS_END +])dnl m4_ifvaln $5 +[]_m4_defun_epi([$0]) +T13,42 +AS_VAR_SET_IFAS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3]) +F8,5 +m4_indexindex +T14,58 +_m4_map_args_wm4_substr([$1], [$2], m4_eval(m4_len([$1]) - [$2] - [$3])) +T7,98 +_AS_RUNm4_ifval([$2], [{ $as_echo "$as_bourne_compatible"$1 | as_run=a $2; }], + [(eval $1)]) 2>/dev/null +T14,107 +m4_set_map_sepm4_ifdef([_m4_set_cleanup($1)], [_m4_set_contents_1c], + [_m4_set_contents_1])([$1])_m4_set_contents_2($@) +T9,174 +m4_expandm4_pushdef([m4_divert], _m4_defn([_m4_divert_unsafe]))m4_pushdef([m4_divert_push], _m4_defn([_m4_divert_unsafe]))m4_chomp(_$0([$1 +]))_m4_popdef([m4_divert], [m4_divert_push]) +T19,336 +_AS_MKDIR_P_PREPARE_m4_defun_pro([$0])AS_REQUIRE_SHELL_FN([as_fn_mkdir_p], + [AS_FUNCTION_DESCRIBE([as_fn_mkdir_p], [], + [Create "$as_dir" as a directory, including parents if necessary.])], +[ + _AS_MKDIR_P +])if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi +[]_m4_defun_epi([$0]) +T17,229 +m4_cr_not_LETTERS +  !"#*%&'()$+,./0123456789:;<=>?@[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T18,256 +_m4_set_dump_checkm4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [[$2]_m4_defn([_m4_set([$1])])])_m4_popdef( + [_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1], [$2$3])], + [_m4_popdef([_m4_set_cleanup($1)])]) +T10,728 +AS_PREPARE_m4_defun_pro([$0])m4_divert_push([KILL]) +m4_append_uniq([_AS_CLEANUP], + [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])]) +AS_REQUIRE([_AS_EXPR_PREPARE]) +AS_REQUIRE([_AS_BASENAME_PREPARE]) +AS_REQUIRE([_AS_DIRNAME_PREPARE]) +AS_REQUIRE([_AS_ME_PREPARE]) +AS_REQUIRE([_AS_CR_PREPARE]) +AS_REQUIRE([_AS_LINENO_PREPARE]) +AS_REQUIRE([_AS_ECHO_N_PREPARE]) +AS_REQUIRE([_AS_EXIT_PREPARE]) +AS_REQUIRE([_AS_LN_S_PREPARE]) +AS_REQUIRE([_AS_MKDIR_P_PREPARE]) +AS_REQUIRE([_AS_TEST_PREPARE]) +AS_REQUIRE([_AS_TR_CPP_PREPARE]) +AS_REQUIRE([_AS_TR_SH_PREPARE]) +AS_REQUIRE([_AS_UNSET_PREPARE]) +AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN]) +AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN]) +m4_divert_pop[][]_m4_defun_epi([$0]) +T11,17 +m4_location__file__:__line__ +T24,29 +m4_location(AS_BASENAME)../../lib/m4sugar/m4sh.m4:942 +T22,30 +AT_DIFF_STDERR(ignore)echo stderr:; cat "$at_stderr" +T36,29 +m4_location(_AS_DETECT_BETTER_SHELL)../../lib/m4sugar/m4sh.m4:194 +T11,54 +m4_ifnblankm4_if(m4_translit([[$1]], [ ][ ][ +]), [], [$3], [$2]) +T13,134 +_m4_defun_epi_m4_popdef([_m4_expanding($1)], [_m4_expansion_stack])m4_ifdef([_m4_expansion_stack], [], [_m4_defun_epi_outer([$1])])m4_provide([$1]) +T10,40 +m4_warningm4_errprintn(m4_location[: warning: $1]) +T23,3 +_m4_divert(TEST_GROUPS)500 +T22,30 +AT_DIFF_STDOUT(ignore)echo stdout:; cat "$at_stdout" +F7,4 +m4_evaleval +T31,98 +_AT_NORMALIZE_TEST_GROUP_NUMBER + eval 'while :; do + case $$1 in #( + '"$at_format"'*) break;; + esac + $1=0$$1 + done' + +T15,5 +_m4_divert_grow10000 +T16,46 +AT_DIFF_STDOUT()at_fn_diff_devnull "$at_stdout" || at_failed=: +T15,23 +AS_EXECUTABLE_Pas_fn_executable_p $1[] +T15,129 +AS_EXECUTABLE_P_m4_defun_pro([$0])AS_REQUIRE([_AS_TEST_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T6,598 +m4_form4_pushdef([$1], m4_eval([$2]))m4_cond([m4_eval(([$3]) > ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4], + 1)))m4_assert(_m4_step > 0)_$0(_m4_defn([$1]), + m4_eval((([$3]) - ([$2])) / _m4_step * _m4_step + ([$2])), _m4_step,], + [m4_eval(([$3]) < ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4], + -1)))m4_assert(_m4_step < 0)_$0(_m4_defn([$1]), + m4_eval((([$2]) - ([$3])) / -(_m4_step) * _m4_step + ([$2])), _m4_step,], + [m4_pushdef([_m4_step])_$0(_m4_defn([$1]), _m4_defn([$1]), 0,])[m4_define([$1],], [)$5])m4_popdef([_m4_step], [$1]) +T8,42 +_AS_ECHO_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2]) +T25,29 +m4_location(_AS_ECHO_LOG)../../lib/m4sugar/m4sh.m4:790 +T17,185 +_AS_TR_SH_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_CR_PREPARE])# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'" +[]_m4_defun_epi([$0]) +T13,110 +_AS_CLEAN_DIRif test -d $1; then + find $1 -type d ! -perm -700 -exec chmod u+rwx {} \; + rm -fr $1/* $1/.[[!.]] $1/.??* +fi +T20,181 +AS_FUNCTION_DESCRIBE@%:@ $1[]m4_ifval([$2], [ $2]) +@%:@ m4_translit(m4_format([%*s], + m4_decr(m4_qlen(_m4_expand([$1[]m4_ifval([$2], [ $2]) +]))), []), [ ], [-]) +m4_text_wrap([$3], [@%:@ ], [], [$4]) +T16,298 +m4_map_args_pairm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [m4_fatal([$0: too few arguments: $#: $1])], + [$#], [2], [], + [$#], [3], [m4_default([$2], [$1])([$3])[]], + [$#], [4], [$1([$3], [$4])[]], + [$1([$3], [$4])[]$0([$1], [$2], m4_shift(m4_shift3($@)))]) +T18,1 +_m4_divert(NOTICE)6 +T27,1 +_m4_divert(HEADER-REVISION)1 +T10,302 +AT_SKIP_IFm4_ifndef([AT_ingroup], + [m4_fatal([AT_SKIP_IF: missing AT_SETUP detected])])dnl +dnl Try to limit the amount of conditionals that we emit. +m4_case([$1], + [], [], + [false], [], + [:], [_AT_CHECK_EXIT([], [77])], + [true], [_AT_CHECK_EXIT([], [77])], + [_AT_CHECK_EXIT([$1], [77])]) +T10,124 +AS_MESSAGEm4_ifval(AS_MESSAGE_LOG_FD, + [{ _AS_ECHO_LOG([$1]) +_AS_ECHO([$as_me: $1], [$2]);}], + [_AS_ECHO([$as_me: $1], [$2])])[][] +T10,127 +AS_MESSAGE_m4_defun_pro([$0])AS_REQUIRE([_AS_ME_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T16,27 +_AS_CASE_DEFAULT [@%:@(] + *[)] : + $1 ;; +T7,30 +AS_WARNAS_MESSAGE([WARNING: $1], [2]) +T30,29 +m4_location(_AS_BASENAME_EXPR)../../lib/m4sugar/m4sh.m4:921 +T17,490 +_AS_TR_SH_LITERALm4_translit([[$1]], + [*+[]][ +  !"#*%&'()$+,./:;<=>?@[\]^`{|}~-], + [pp[]][_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________]) +T10,66 +_AS_ECHO_NAS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD]) +T7,36 +m4_signm4_eval((([$1]) > 0) - (([$1]) < 0)) +T25,53 +_m4_expansion_stack_entry_m4_defn([m4_location($1)])[: $1 is expanded from...] +T19,191 +_AS_DIRNAME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_EXPR_PREPARE])if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi +[]_m4_defun_epi([$0]) +T26,2 +_AS_LITERAL_HEREDOC_IF_YES$1 +T9,127 +_m4_splitm4_changequote([-=<{(],[)}>=-])[m4_bpatsubst(-=<{(-=<{($1)}>=-)}>=-, -=<{($2)}>=-, + -=<{(]$3[)}>=-)]m4_changequote([, ]) +T19,54 +_AT_COPYRIGHT_YEARSCopyright (C) 2009-2012 Free Software Foundation, Inc. +T8,85 +_m4_joinm4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift2($@))]) +T13,0 +_AT_LINE_base +T16,4 +_m4_divert(BODY)1000 +T18,1268 +_AS_LINENO_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_CR_PREPARE])AS_REQUIRE([_AS_ME_PREPARE])_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])m4_pushdef([AS_MESSAGE_LOG_FD])m4_pushdef([AS_ERROR], + [{ AS_MESSAGE(]m4_dquote([error: $][1])[, [2]); AS_EXIT([1]); }])_AS_LINENO_WORKS || { +[ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno"] || + AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell]) + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} +_m4_popdef([AS_MESSAGE_LOG_FD], [AS_ERROR])[]_m4_defun_epi([$0]) +T13,276 +m4_set_deletem4_ifdef([_m4_set([$1])], + [_m4_popdef([_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1])], + [m4_ifdef([_m4_set_cleanup($1)], + [_m4_popdef([_m4_set_cleanup($1)])])m4_ifdef( + [_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])]) +T34,29 +m4_location(_AS_REEXEC_WITH_SHELL)../../lib/m4sugar/m4sh.m4:279 +T12,10 +m4_cr_digits0123456789 +T17,17 +m4_PACKAGE_STRINGGNU Autoconf 2.69 +T9,14 +AS_TEST_Xtest -x $1[][] +T9,129 +AS_TEST_X_m4_defun_pro([$0])AS_REQUIRE([_AS_TEST_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +F10,6 +_m4_popdefpopdef +T9,68 +_AS_TR_SH_AS_LITERAL_IF([$1], [*][ ][ +])([], [$0_INDIR], [$0_LITERAL])([$1]) +T7,1688 +m4_init# All the M4sugar macros start with `m4_', except `dnl' kept as is +# for sake of simplicity. +m4_pattern_forbid([^_?m4_]) +m4_pattern_forbid([^dnl$]) + +# If __m4_version__ is defined, we assume that we are being run by M4 +# 1.6 or newer, thus $@ recursion is linear, and debugmode(+do) +# is available for faster checks of dereferencing undefined macros +# and forcing dumpdef to print to stderr regardless of debugfile. +# But if it is missing, we assume we are being run by M4 1.4.x, that +# $@ recursion is quadratic, and that we need foreach-based +# replacement macros. Also, m4 prior to 1.4.8 loses track of location +# during m4wrap text; __line__ should never be 0. +# +# Use the raw builtin to avoid tripping up include tracing. +# Meanwhile, avoid m4_copy, since it temporarily undefines m4_defn. +m4_ifdef([__m4_version__], +[m4_debugmode([+do]) +m4_define([m4_defn], _m4_defn([_m4_defn])) +m4_define([m4_dumpdef], _m4_defn([_m4_dumpdef])) +m4_define([m4_popdef], _m4_defn([_m4_popdef])) +m4_define([m4_undefine], _m4_defn([_m4_undefine]))], +[m4_builtin([include], [m4sugar/foreach.m4]) +m4_wrap_lifo([m4_if(__line__, [0], [m4_pushdef([m4_location], +]]m4_dquote(m4_dquote(m4_dquote(__file__:__line__)))[[)])])]) + +# Rewrite the first entry of the diversion stack. +m4_divert([KILL]) + +# Check the divert push/pop perfect balance. +# Some users are prone to also use m4_wrap to register last-minute +# m4_divert_text; so after our diversion cleanups, we restore +# KILL as the bottom of the diversion stack. +m4_wrap([m4_popdef([_m4_divert_diversion])m4_ifdef( + [_m4_divert_diversion], [m4_fatal([$0: unbalanced m4_divert_push: +]m4_divert_stack)])_m4_popdef([_m4_divert_stack])m4_divert_push([KILL])]) + +T21,29 +m4_location(AS_ERROR)../../lib/m4sugar/m4sh.m4:883 +T11,162 +m4_dumpdefsm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_stack_foreach_lifo([$1], [m4_dumpdef([$1])m4_ignore])], + [m4_map_args([$0], $@)]) +T12,16 +m4_wrap_lifo_m4_wrap([$1[]]) +T10,103 +m4_flattenm4_if(m4_index([$1], [ +]), [-1], [[$1]], + [m4_translit(m4_bpatsubst([[[$1]]], [\\ +]), [ +], [ ])]) +T20,36 +_m4_set_intersectionm4_set_contains([$1], [$2], [,[$2]]) +T20,33 +_AS_REQUIRE_SHELL_FN +m4_n([$2])$1 () +{ +$3 +} @%:@ $1[] +T22,30 +m4_location(AS_TR_CPP)../../lib/m4sugar/m4sh.m4:1859 +T8,28 +_AS_CASE [@%:@(] + $1[)] : + $2 ;; +T19,29 +m4_location(AS_FOR)../../lib/m4sugar/m4sh.m4:607 +T9,156 +m4_escapem4_if(m4_index(m4_translit([$1], + [[]#,()][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789], [$$$]), [$]), + [-1], [m4_echo], [_$0])([$1]) +T17,478 +AS_INIT_GENERATED_m4_defun_pro([$0])m4_require([AS_PREPARE])m4_pushdef([AS_MESSAGE_LOG_FD])as_write_fail=0 +cat >$1 <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || as_write_fail=1 +_AS_SHELL_SANITIZE +_AS_PREPARE +m4_if(AS_MESSAGE_FD, [1], [], [exec AS_MESSAGE_FD>&1 +])m4_text_box([Main body of $1 script.]) +_ASEOF +test $as_write_fail = 0 && chmod +x $1[]dnl +_m4_popdef([AS_MESSAGE_LOG_FD])[]_m4_defun_epi([$0]) +T29,29 +m4_location(_AS_DIRNAME_EXPR)../../lib/m4sugar/m4sh.m4:975 +T12,24 +m4_rename_m4m4_rename([$1], [m4_$1]) +T30,29 +m4_location(_AS_UNSET_PREPARE)../../lib/m4sugar/m4sh.m4:657 +T20,111 +m4_stack_foreach_sep_m4_stack_reverse([$1], [m4_tmp-$1])_m4_stack_reverse([m4_tmp-$1], [$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]]) +T20,30 +m4_location(AS_ECHO)../../lib/m4sugar/m4sh.m4:1026 +T35,30 +m4_location(_AS_VAR_APPEND_PREPARE)../../lib/m4sugar/m4sh.m4:1906 +T19,156 +_m4_defun_pro_outerm4_set_delete([_m4_provide])m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])m4_pushdef([_m4_divert_dump], m4_divnum)m4_divert_push([GROW]) +T18,49 +AS_LITERAL_WORD_IF_AS_LITERAL_IF(m4_expand([$1]))([$4], [$3], [$2]) +T17,63 +m4_set_differencem4_if([$1], [$2], [], [m4_set_map_sep([$1], [_$0([$2],], [)])]) +T17,292 +_m4_require_checkm4_if(_m4_defn([_m4_diverting]), [$2], [m4_ignore], + m4_ifdef([_m4_diverting([$2])], [-]), [-], [m4_warn([syntax], + [$3: `$1' was expanded before it was required +http://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call], + [m4_ignore]) +T19,166 +m4_set_intersectionm4_if([$1], [$2], [m4_set_listc([$1])], + m4_eval(m4_set_size([$2]) < m4_set_size([$1])), [1], [$0([$2], [$1])], + [m4_set_map_sep([$1], [_$0([$2],], [)])]) +T19,147 +AS_REQUIRE_SHELL_FNm4_provide_if([AS_SHELL_FN_$1], [], +[AS_REQUIRE([AS_SHELL_FN_$1], +[m4_provide([AS_SHELL_FN_$1])_$0($@)], +m4_default_quoted([$4], [M4SH-INIT-FN]))]) +T13,47 +AS_LITERAL_IF_$0(m4_expand([$1]), [ ][ +])([$4], [$3], [$2]) +T21,101 +m4_stack_foreach_lifo_m4_stack_reverse([$1], [m4_tmp-$1], [$2(_m4_defn([m4_tmp-$1]))])_m4_stack_reverse([m4_tmp-$1], [$1]) +T11,33 +m4_set_listm4_set_map_sep([$1], [], [], [,]) +T32,29 +m4_location(_AS_DETECT_REQUIRED)../../lib/m4sugar/m4sh.m4:156 +T23,29 +m4_location(AS_PREPARE)../../lib/m4sugar/m4sh.m4:353 +T29,30 +m4_location(_AS_TEST_PREPARE)../../lib/m4sugar/m4sh.m4:1384 +F8,8 +__line____line__ +T9,793 +_AT_CHECKm4_define([AT_ingroup]){ set +x +AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE([[$1]])"]) +_AT_DECIDE_TRACEABLE([$1]) _AT_LINE_ESCAPED +( $at_check_trace; [$1] +) >>"$at_stdout" 2>>"$at_stderr" AS_MESSAGE_LOG_FD>&- +at_status=$? at_failed=false +$at_check_filter +m4_ifdef([AT_DIFF_STDERR($4)], [m4_indir([AT_DIFF_STDERR($4)])], + [echo >>"$at_stderr"; AS_ECHO([["$4"]]) | \ + $at_diff - "$at_stderr" || at_failed=:]) +m4_ifdef([AT_DIFF_STDOUT($3)], [m4_indir([AT_DIFF_STDOUT($3)])], + [echo >>"$at_stdout"; AS_ECHO([["$3"]]) | \ + $at_diff - "$at_stdout" || at_failed=:]) +m4_if([$2], [ignore], [at_fn_check_skip], + [at_fn_check_status m4_default([$2], [0])]) $at_status "$at_srcdir/AT_LINE" +m4_ifvaln([$5$6], [AS_IF($at_failed, [$5], [$6])])$at_failed && at_fn_log_failure AT_capture_files +$at_traceon; } + +T13,41 +_m4_set_unionm4_ifdef([_m4_set([$1],$2)], [], [,[$2]]) +T17,1 +_m4_divert(BINSH)0 +T10,55 +_m4_shift2m4_if([$#], [2], [], + [, m4_shift(m4_shift($@))]) +T18,4 +m4_PACKAGE_VERSION2.69 +T10,65 +_m4_shift3m4_if([$#], [3], [], + [, m4_shift(m4_shift(m4_shift($@)))]) +T16,222 +_AS_BASENAME_SED_m4_defun_pro([$0])AS_ECHO([X/[]$1]) | + sed ['/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'][]_m4_defun_epi([$0]) +T9,35 +AT_TESTEDm4_append_uniq_w([AT_tested], [$1]) +T23,3 +_m4_divert(VERSION_END)352 +T25,3 +_m4_divert(PREPARE_TESTS)402 +T13,383 +_AS_PATH_WALKas_save_IFS=$IFS; IFS=$PATH_SEPARATOR +m4_ifvaln([$3], [as_found=false])dnl +m4_bmatch([$1], [[:;]], +[as_dummy="$1" +for as_dir in $as_dummy], +[for as_dir in m4_default([$1], [$PATH])]) +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + m4_ifvaln([$3], [as_found=:])dnl + $2 + m4_ifvaln([$3], [as_found=false])dnl +done +m4_ifvaln([$3], [$as_found || { $3; }])dnl +IFS=$as_save_IFS +[] +T13,139 +_AS_PATH_WALK_m4_defun_pro([$0])AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T16,46 +AT_DIFF_STDERR()at_fn_diff_devnull "$at_stderr" || at_failed=: +T28,1 +_m4_divert(HEADER-COPYRIGHT)3 +T11,58 +_AS_CLEANUPm4_divert_text([M4SH-SANITIZE], [_AS_DETECT_BETTER_SHELL]) +T21,32 +AS_LITERAL_HEREDOC_IF_$0(m4_expand([$1]))([$2], [$3]) +T10,84 +_m4_minmaxm4_if([$#], [3], [$1([$2], [$3])], + [$0([$1], $1([$2], [$3]), m4_shift3($@))]) +T13,57 +AS_ME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_$0])[]_m4_defun_epi([$0]) +T11,238 +m4_text_boxm4_pushdef([m4_Border], + m4_translit(m4_format([[[%*s]]], m4_decr(m4_qlen(_m4_expand([$1 +]))), []), [ ], m4_default_quoted([$2], [-])))[##] _m4_defn([m4_Border]) [##] +[##] $1 [##] +[##] _m4_defn([m4_Border]) [##]_m4_popdef([m4_Border]) +T22,38 +AT_DIFF_STDERR(stderr)echo stderr:; tee stderr <"$at_stderr" +T15,180 +m4_set_containsm4_ifdef([_m4_set_cleanup($1)], + [m4_if(m4_ifdef([_m4_set([$1],$2)], + [m4_indir([_m4_set([$1],$2)])], [0]), [1], [$3], [$4])], + [m4_ifdef([_m4_set([$1],$2)], [$3], [$4])]) +T30,34 +m4_location(AT_ARG_OPTION_ARG)../../lib/autotest/general.m4:1787 +F10,7 +m4_esyscmdesyscmd +T22,43 +AT_DIFF_STDERR(experr)$at_diff experr "$at_stderr" || at_failed=: +T9,22 +AS_TR_CPP_$0(m4_expand([$1]))[] +T9,124 +AS_TR_CPP_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,32 +m4_set_mapm4_set_map_sep([$1], [$2(], [)]) +T14,53 +m4_cr_symbols1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ +T14,181 +_AS_LITERAL_IFm4_if(m4_index([$1], [@S|@]), [-1], [$0_(m4_translit([$1], + [-:=%/@{}[]#(),.$2]][[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]][, + [++++++$$`````]))], [$0_NO]) +T14,63 +m4_cr_symbols2abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 +T13,116 +_AS_BOX_INDIRsed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ $1 @%:@@%:@ +_ASBOX +T12,18 +m4_errprintnm4_errprint([$1 +]) +T13,306 +m4_bpatsubstsm4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2]))], + [$#], 3, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2], [$3]))], + [_$0($@m4_if(m4_eval($# & 1), 0, [,]))]) +T23,29 +m4_location(AS_MESSAGE)../../lib/m4sugar/m4sh.m4:834 +F7,4 +m4_decrdecr +T12,93 +m4_text_wrap_$0(m4_escape([$1]), [$2], m4_default_quoted([$3], [$2]), + m4_default_quoted([$4], [79])) +T23,3 +_m4_divert(HELP_TUNING)303 +T12,93 +m4_set_emptym4_ifdef([_m4_set_size($1)], + [m4_if(m4_indir([_m4_set_size($1)]), [0], [$2], [$3])], [$2]) +T15,36 +m4_set_contentsm4_set_map_sep([$1], [], [], [[$2]]) +T32,30 +m4_location(_AS_DIRNAME_PREPARE)../../lib/m4sugar/m4sh.m4:1011 +T15,55 +_AS_TR_SH_INDIR`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_sh` +T20,29 +m4_location(AS_CASE)../../lib/m4sugar/m4sh.m4:550 +T10,168 +m4_combinem4_if([$2], [], [], m4_eval([$# > 3]), [1], +[m4_map_args_sep([m4_map_args_sep(m4_dquote(], [)[[$3]], [], [[$1]],]]m4_dquote(m4_dquote(m4_shift3($@)))[[)], [[$1]], $2)]) +T9,339 +AS_VAR_IFAS_LITERAL_WORD_IF([$1], + [AS_IF(m4_ifval([$2], [[test "x$$1" = x[]$2]], [[${$1:+false} :]])], + [AS_VAR_COPY([as_val], [$1]) + AS_IF(m4_ifval([$2], [[test "x$as_val" = x[]$2]], [[${as_val:+false} :]])], + [AS_IF(m4_ifval([$2], + [[eval test \"x\$"$1"\" = x"_AS_ESCAPE([$2], [`], [\"$])"]], + [[eval \${$1:+false} :]])]), +[$3], [$4]) +T18,202 +m4_cr_not_symbols1 +  !"#*%&'()$+,./0123456789:;<=>?@[\]^`{|}~- +T18,192 +m4_cr_not_symbols2 +  !"#*%&'()$+,./:;<=>?@[\]^`{|}~- +T23,30 +m4_location(AS_DIRNAME)../../lib/m4sugar/m4sh.m4:1002 +F12,8 +m4_bpatsubstpatsubst +T31,29 +m4_location(_AS_SHELL_SANITIZE)../../lib/m4sugar/m4sh.m4:451 +T7,2 +m4_echo$@ +T20,1 +AS_ORIGINAL_STDIN_FD0 +T28,3 +_m4_divert(PARSE_ARGS_BEGIN)200 +T25,111 +m4_stack_foreach_sep_lifo_m4_stack_reverse([$1], [m4_tmp-$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]])_m4_stack_reverse([m4_tmp-$1], [$1]) +T14,102 +_AS_ME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_BASENAME_PREPARE])as_me=`AS_BASENAME("$[0]")` +[]_m4_defun_epi([$0]) +T26,30 +m4_location(_AS_PATH_WALK)../../lib/m4sugar/m4sh.m4:1339 +T7,91 +m4_argnm4_assert([0 < $1])m4_pushdef([_$0], [_m4_popdef([_$0])]m4_dquote([$]m4_incr([$1])))_$0($@) +T29,30 +m4_location(_AS_ECHO_PREPARE)../../lib/m4sugar/m4sh.m4:1044 +T8,27 +m4_ifvalm4_if([$1], [], [$3], [$2]) +T7,197 +m4_copym4_ifdef([$2], [m4_fatal([$0: won't overwrite defined macro: $2])], + [m4_stack_foreach_sep([$1], [m4_pushdef([$2],], [)])])m4_ifdef([m4_location($1)], [m4_define([m4_location($2)], m4_location)]) +T11,31 +_AS_IF_ELSEm4_ifnblank([$1], +[else + $1 +]) +T26,292 +_AS_PATH_SEPARATOR_PREPARE_m4_defun_pro([$0])# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi +[]_m4_defun_epi([$0]) +T14,113 +m4_expand_oncem4_provide_if(m4_default_quoted([$2], [$1]), + [], + [m4_provide(m4_default_quoted([$2], [$1]))[]$1]) +T14,96 +_m4_bpatsubstsm4_if([$#], 2, [$1], + [$0(m4_builtin([patsubst], [[$1]], [$2], [$3]), + m4_shift3($@))]) +T13,41 +m4_provide_ifm4_ifdef([m4_provide($1)], + [$2], [$3]) +T16,838 +_AS_LN_S_PREPARE_m4_defun_pro([$0])rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null +[]_m4_defun_epi([$0]) +T8,1075 +AS_UNAME{ +cat <<_ASUNAME +m4_text_box([Platform.]) + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +_AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])]) +} +T7,16 +AS_LN_S$as_ln_s $1 $2[] +T7,129 +AS_LN_S_m4_defun_pro([$0])AS_REQUIRE([_AS_LN_S_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T18,207 +_AS_TR_CPP_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_CR_PREPARE])# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'" +[]_m4_defun_epi([$0]) +T9,75 +AS_ESCAPE_$0([$1], m4_if([$2], [], [[`], [\"$]], [m4_substr([$2], [0], [1]), [$2]])) +T20,4 +_m4_divert_diversionKILL +T24,29 +m4_location(_AS_PREPARE)../../lib/m4sugar/m4sh.m4:322 +T22,30 +m4_location(AS_ECHO_N)../../lib/m4sugar/m4sh.m4:1034 +T15,131 +AT_CAPTURE_FILEm4_ifndef([AT_ingroup], + [m4_fatal([AT_CAPTURE_FILE: missing AT_SETUP detected])])m4_append_uniq([AT_capture_files], ["$1"], [ \ +]) +T30,30 +m4_location(_AS_TR_SH_PREPARE)../../lib/m4sugar/m4sh.m4:1805 +T23,30 +m4_location(AS_MKDIR_P)../../lib/m4sugar/m4sh.m4:1289 +F12,8 +_m4_undivertundivert +T7,54 +_m4_cdrm4_if([$#], 1, [], + [, m4_dquote(m4_shift($@))]) +T10,86 +m4_toupperm4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ]) +T8,19 +m4_curry$1(m4_shift($@,)_$0 +T16,56 +_AS_TR_CPP_INDIR`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_cpp` +T17,28 +m4_default_nblankm4_ifblank([$1], [$2], [$1]) +T28,29 +m4_location(_AS_DIRNAME_SED)../../lib/m4sugar/m4sh.m4:982 +T18,540 +_AS_TR_CPP_LITERALm4_translit([[$1]], + [*[]][abcdefghijklmnopqrstuvwxyz +  !"#*%&'()$+,./:;<=>?@[\]^`{|}~-], + [P[]][ABCDEFGHIJKLMNOPQRSTUVWXYZ_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________]) +T12,48 +m4_re_escapem4_bpatsubst([$1], + [[][*+.?\^$]], [\\\&]) +T12,26 +m4_normalizem4_strip(m4_flatten([$1])) +T18,40 +_m4_set_differencem4_set_contains([$1], [$2], [], [,[$2]]) +F3,3 +dnldnl +T27,2052 +_AS_VERSION_COMPARE_PREPARE_m4_defun_pro([$0])[as_awk_strverscmp=' + # Use only awk features that work with 7th edition Unix awk (1978). + # My, what an old awk you have, Mr. Solaris! + END { + while (length(v1) && length(v2)) { + # Set d1 to be the next thing to compare from v1, and likewise for d2. + # Normally this is a single character, but if v1 and v2 contain digits, + # compare them as integers and fractions as strverscmp does. + if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { + # Split v1 and v2 into their leading digit string components d1 and d2, + # and advance v1 and v2 past the leading digit strings. + for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue + for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue + d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) + d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) + if (d1 ~ /^0/) { + if (d2 ~ /^0/) { + # Compare two fractions. + while (d1 ~ /^0/ && d2 ~ /^0/) { + d1 = substr(d1, 2); len1-- + d2 = substr(d2, 2); len2-- + } + if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { + # The two components differ in length, and the common prefix + # contains only leading zeros. Consider the longer to be less. + d1 = -len1 + d2 = -len2 + } else { + # Otherwise, compare as strings. + d1 = "x" d1 + d2 = "x" d2 + } + } else { + # A fraction is less than an integer. + exit 1 + } + } else { + if (d2 ~ /^0/) { + # An integer is greater than a fraction. + exit 2 + } else { + # Compare two integers. + d1 += 0 + d2 += 0 + } + } + } else { + # The normal case, without worrying about digits. + d1 = substr(v1, 1, 1); v1 = substr(v1, 2) + d2 = substr(v2, 1, 1); v2 = substr(v2, 2) + } + if (d1 < d2) exit 1 + if (d1 > d2) exit 2 + } + # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10), + # which mishandles some comparisons of empty strings to integers. + if (length(v2)) exit 1 + if (length(v1)) exit 2 + } +'][]_m4_defun_epi([$0]) +T14,116 +AS_LINENO_PUSH_m4_defun_pro([$0])as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack[]_m4_defun_epi([$0]) +F12,8 +_m4_undefineundefine +T10,79 +_m4_shiftnm4_if([$1], 1, [m4_shift(], + [$0(m4_decr([$1])]), m4_shift(m4_shift($@))) +T20,170 +_m4_version_unletterm4_bpatsubst(m4_bpatsubst(m4_translit([[[[0,$1]]]], [.-], [,,]),[[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]][+], + [+1,-1,[0r36:\&]]), [,0], [,[0r10:0]]) +T7,676 +AS_INIT# Wrap our cleanup prior to m4sugar's cleanup. +m4_wrap([_AS_CLEANUP]) +m4_init +m4_provide([AS_INIT]) + +# Forbidden tokens and exceptions. +m4_pattern_forbid([^_?AS_]) + +# Bangshe and minimal initialization. +m4_divert_text([BINSH], [@%:@! /bin/sh]) +m4_divert_text([HEADER-COMMENT], + [@%:@ Generated from __file__ by m4_PACKAGE_STRING.]) +m4_divert_text([M4SH-SANITIZE], [_AS_SHELL_SANITIZE]) +m4_divert_text([M4SH-INIT-FN], [m4_text_box([M4sh Shell Functions.])]) + +# Let's go! +m4_divert([BODY])dnl +m4_text_box([Main body of script.]) +_AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl +_AS_DETECT_REQUIRED([_AS_TEST_X_WORKS])dnl +AS_REQUIRE([_AS_UNSET_PREPARE], [], [M4SH-INIT-FN])dnl + +T10,302 +AT_FAIL_IFm4_ifndef([AT_ingroup], + [m4_fatal([AT_FAIL_IF: missing AT_SETUP detected])])dnl +dnl Try to limit the amount of conditionals that we emit. +m4_case([$1], + [], [], + [false], [], + [:], [_AT_CHECK_EXIT([], [99])], + [true], [_AT_CHECK_EXIT([], [99])], + [_AT_CHECK_EXIT([$1], [99])]) +T11,136 +m4_undivertm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [_m4_undivert(_m4_divert([$1]))], + [m4_map_args([$0], $@)]) +T28,44 +AT_DIFF_STDOUT(stdout-nolog)echo stdout captured; cp "$at_stdout" stdout +T15,76 +_AS_BOX_LITERALAS_ECHO(["_AS_ESCAPE(m4_dquote(m4_expand([m4_text_box($@)])), [`], [\"$])"]) +T10,412 +m4_requirem4_ifdef([_m4_expanding($1)], + [m4_fatal([$0: circular dependency of $1])])m4_if(_m4_divert_dump, [], + [m4_fatal([$0($1): cannot be used outside of an ]dnl +m4_if([$0], [m4_require], [[m4_defun]], [[AC_DEFUN]])['d macro])])m4_provide_if([$1], [m4_set_contains([_m4_provide], [$1], + [_m4_require_check([$1], _m4_defn([m4_provide($1)]), [$0])], [m4_ignore])], + [_m4_require_call])([$1], [$2], _m4_divert_dump) +T7,119 +m4_casem4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + [$1], [$2], [$3], + [$0([$1], m4_shift3($@))]) +T11,55 +m4_sincludem4_include_unique([$1])dnl +m4_builtin([sinclude], [$1]) +T25,2 +_AS_LITERAL_HEREDOC_IF_NO$2 +T9,255 +m4_cr_all +  !"#*%&'()$+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T19,62 +m4_version_unletterm4_substr(m4_map_args([.m4_eval], m4_unquote(_$0([$1]))), [3]) +T17,32 +m4_define_defaultm4_ifndef([$1], [m4_define($@)]) +T21,696 +_AS_REEXEC_WITH_SHELL_m4_defun_pro([$0])dnl +# We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in @%:@ (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $1 $as_opts "$as_myself" ${1+"$[@]"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +AS_ECHO(["$[]0: could not re-execute with $1"]) >&2 +AS_EXIT([255])[]_m4_defun_epi([$0]) +T11,160 +m4_undefinem4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_undefine([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T15,12 +m4_PACKAGE_NAMEGNU Autoconf +F10,7 +m4_builtinbuiltin +T26,3 +_m4_divert(PARSE_ARGS_END)202 +T10,266 +AS_REQUIRE_m4_defun_pro([$0])m4_define([_m4_divert_desired], [m4_default_quoted([$3], [M4SH-INIT])])m4_if(m4_eval(_m4_divert_dump - 0 <= _m4_divert(_m4_divert_desired, [-])), + 1, [m4_require(], + [m4_divert_require(_m4_divert_desired,]) [$1], [$2])[]_m4_defun_epi([$0]) +T14,44 +m4_divert_oncem4_expand_once([m4_divert_text([$1], [$2])]) +T11,146 +_m4_expand_m4_if([$4], [}>=-], + [m4_changequote([-=<{$2], [)}>=-])$3m4_changequote([, ])], + [$0([$1], [($2], -=<{($2$1)}>=-, [}>=-])m4_ignore$2]) +T29,29 +m4_location(_AS_BASENAME_SED)../../lib/m4sugar/m4sh.m4:926 +T14,29 +AT_COLOR_TESTSm4_define([AT_color], [auto]) +T17,64 +_m4_divert_unsafem4_fatal([$0: cannot change diversion to `$1' inside m4_expand]) +T8,99 +_m4_condm4_if(($1), [($2)], [$3], + [$#], [3], [], + [$#], [4], [$4], + [$0(m4_shift3($@))]) +T16,0 +m4_pattern_allow +T17,253 +m4_divert_requirem4_ifdef([_m4_expanding($2)], + [m4_fatal([$0: circular dependency of $2])])m4_if(_m4_divert_dump, [], + [m4_fatal([$0($2): cannot be used outside of an m4_defun'd macro])])m4_provide_if([$2], [], + [_m4_require_call([$2], [$3], _m4_divert([$1], [-]))]) +F9,6 +m4_sysvalsysval +T13,91 +AS_SET_STATUS_m4_defun_pro([$0])AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_set_status $1[]_m4_defun_epi([$0]) +T22,527 +_AS_VAR_APPEND_PREPARE_m4_defun_pro([$0])AS_FUNCTION_DESCRIBE([as_fn_append], [VAR VALUE], +[Append the text in VALUE to the end of the definition contained in +VAR. Take advantage of any shell optimizations that allow amortized +linear growth over repeated appends, instead of the typical quadratic +growth present in naive implementations.]) +AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_APPEND_WORKS))"])], +[eval 'as_fn_append () + { + eval $[]1+=\$[]2 + }'], +[as_fn_append () + { + eval $[]1=\$$[]1\$[]2 + }]) # as_fn_append +[]_m4_defun_epi([$0]) +T19,3 +_m4_divert(BANNERS)400 +T17,0 +m4_pattern_forbid +T9,69 +m4_assertm4_if(m4_eval([$1]), 0, + [m4_fatal([assert failed: $1], [$2])]) +F10,7 +m4_pushdefpushdef +T20,53 +m4_divert_stack_pushm4_pushdef([_m4_divert_stack], m4_location[: $1: $2]) +T17,105 +_m4_define_cr_notm4_define([m4_cr_not_$1], + m4_translit(m4_dquote(m4_defn([m4_cr_all])), + m4_defn([m4_cr_$1]))) +T19,21 +_AS_VAR_ARITH_WORKStest $(( 1 + 1 )) = 2 +T23,39 +m4_expansion_stack_pushm4_pushdef([_m4_expansion_stack], [$1]) +T14,199 +AS_SET_CATFILEcase $2 in @%:@(( +.) AS_VAR_SET([$1], [$3]);; +*) + case $3 in @%:@((( + .) AS_VAR_SET([$1], [$2]);; + [[\\/]]* | ?:[[\\/]]* ) AS_VAR_SET([$1], [$3]);; + *) AS_VAR_SET([$1], [$2/$3]);; + esac;; +esac[] +T34,30 +m4_location(_AS_VAR_ARITH_PREPARE)../../lib/m4sugar/m4sh.m4:1948 +T13,26 +m4_cr_lettersabcdefghijklmnopqrstuvwxyz +T11,140 +AT_KEYWORDSm4_ifndef([AT_ingroup], + [m4_fatal([AT_KEYWORDS: missing AT_SETUP detected])])m4_append_uniq_w([AT_keywords], m4_tolower(_m4_expand([$1 +]))) +T7,13 +AS_ECHO$as_echo $1[] +T7,124 +AS_ECHO_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,36 +_m4_expand$0_([$1], [(], -=<{($1)}>=-, [}>=-]) +T26,104 +_AS_DETECT_SUGGESTED_PRUNEm4_set_contains([_AS_DETECT_REQUIRED_BODY], [$1], + [m4_set_remove([_AS_DETECT_SUGGESTED_BODY], [$1])]) +T11,149 +m4_map_argsm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [$#], [2], [$1([$2])[]], + [_m4_foreach([$1(], [)], $@)]) +T19,288 +_m4_set_contents_1cm4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [m4_pushdef([_m4_set_($1)], _m4_defn([_m4_set([$1])]))], + [_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)])])_m4_popdef([_m4_set([$1])])$0([$1])], + [_m4_popdef([_m4_set_cleanup($1)])]) +T7,65 +_m4_minm4_eval((([$1]) < ([$2])) * ([$1]) + (([$1]) >= ([$2])) * ([$2])) +T14,180 +AS_HELP_STRINGm4_text_wrap([$2], m4_cond([[$3]], [], [ ], + [m4_eval([$3]+0)], [0], [[$3]], + [m4_format([[%*s]], [$3], [])]), + m4_expand([ $1 ]), [$4]) +F8,5 +m4_shiftshift +T16,452 +_m4_require_callm4_pushdef([_m4_divert_grow], m4_decr(_m4_divert_grow))m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])m4_divert_push(_m4_divert_grow, [-])m4_if([$2], [], [$1], [$2]) +m4_provide_if([$1], [m4_set_remove([_m4_provide], [$1])], + [m4_warn([syntax], [$1 is m4_require'd but not m4_defun'd])])_m4_divert_raw($3)_m4_undivert(_m4_divert_grow)m4_divert_pop(_m4_divert_grow)_m4_popdef([_m4_divert_grow], +[_m4_diverting([$1])], [_m4_diverting]) +T11,70 +_m4_foreachm4_if([$#], [3], [], + [$1[$4]$2[]$0([$1], [$2], m4_shift3($@))]) +T7,65 +_m4_maxm4_eval((([$1]) > ([$2])) * ([$1]) + (([$1]) <= ([$2])) * ([$2])) +F8,8 +__file____file__ +T18,2 +_AS_LITERAL_IF_YES$3 +F10,6 +m4_bregexpregexp +T13,0 +_AT_LINE_file +T14,103 +_AS_TR_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_TR_SH_PREPARE])AS_REQUIRE([_AS_TR_CPP_PREPARE])[]_m4_defun_epi([$0]) +T12,47 +AS_VAR_ARITHas_fn_arith $2 && AS_VAR_SET([$1], [$as_val])[] +T12,197 +AS_VAR_ARITH_m4_defun_pro([$0])_AS_DETECT_SUGGESTED([_AS_VAR_ARITH_WORKS])AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,82 +AS_DIRNAME$as_dirname -- $1 || +_AS_DIRNAME_EXPR([$1]) 2>/dev/null || +_AS_DIRNAME_SED([$1])[] +T10,124 +AS_DIRNAME_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T23,3 +_m4_divert(TEST_SCRIPT)450 +T33,29 +m4_location(_AS_BASENAME_PREPARE)../../lib/m4sugar/m4sh.m4:954 +T13,42 +m4_mapall_sepm4_if([$3], [], [], [_$0([$1], [$2], $3)]) +T9,26 +m4_ifndefm4_ifdef([$1], [$3], [$2]) +T18,144 +AS_VERSION_COMPAREas_arg_v1=$1 +as_arg_v2=$2 +awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null +AS_CASE([$?], + [1], [$3], + [0], [$4], + [2], [$5])[] +T18,124 +AS_VERSION_COMPARE_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T13,47 +m4_copy_forcem4_ifdef([$2], [_m4_undefine([$2])])m4_copy($@) +T7,108 +m4_joinm4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift2($@))]) +T23,3173 +_AS_DETECT_BETTER_SHELL_m4_defun_pro([$0])m4_if(_AS_FORCE_REEXEC_WITH_CONFIG_SHELL, [yes], + [# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL]) + fi + # We don't want this to propagate to other subprocesses. + dnl This might be especially important in case an m4sh-generated script + dnl is used to later execute other m4sh-generated scripts. This happens + dnl for example in autoconf's own testsuite (and happens *a lot* there, + dnl in fact). + AS_UNSET([_as_can_reexec]) +])m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="AS_ESCAPE(_m4_expand([_AS_BOURNE_COMPATIBLE]))" + _AS_DETECT_EXPAND([as_required], [_AS_DETECT_REQUIRED_BODY]) + _AS_DETECT_EXPAND([as_suggested], [_AS_DETECT_SUGGESTED_BODY]) + AS_IF([_AS_RUN(["$as_required"])], + [as_have_required=yes], + [as_have_required=no]) + AS_IF([test x$as_have_required = xyes && _AS_RUN(["$as_suggested"])], + [], + [_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH], + [case $as_dir in @%:@( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } && + _AS_RUN(["$as_required"], ["$as_shell"])], + [CONFIG_SHELL=$as_shell as_have_required=yes + m4_set_empty([_AS_DETECT_SUGGESTED_BODY], [break 2], + [AS_IF([_AS_RUN(["$as_suggested"], ["$as_shell"])], + [break 2])])]) + done;; + esac], + [AS_IF([{ test -f "$SHELL" || test -f "$SHELL.exe"; } && + _AS_RUN(["$as_required"], ["$SHELL"])], + [CONFIG_SHELL=$SHELL as_have_required=yes])]) + + AS_IF([test "x$CONFIG_SHELL" != x], + [export CONFIG_SHELL + _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL])]) + +dnl Unfortunately, $as_me isn't available here. + AS_IF([test x$as_have_required = xno], + [AS_ECHO(["$[]0: This script requires a shell more modern than all"]) + AS_ECHO(["$[]0: the shells that I found on your system."]) + if test x${ZSH_VERSION+set} = xset ; then + AS_ECHO(["$[]0: In particular, zsh $ZSH_VERSION has bugs and should"]) + AS_ECHO(["$[]0: be upgraded to zsh 4.3.4 or later."]) + else + AS_ECHO("m4_text_wrap([Please tell ]_m4_defn([m4_PACKAGE_BUGREPORT]) +m4_ifset([AC_PACKAGE_BUGREPORT], [m4_if(_m4_defn([m4_PACKAGE_BUGREPORT]), +_m4_defn([AC_PACKAGE_BUGREPORT]), [], [and _m4_defn([AC_PACKAGE_BUGREPORT])])]) +[about your system, including any error possibly output before this message. +Then install a modern shell, or manually run the script under such a +shell if you do have one.], [$[]0: ], [], [62])") + fi + AS_EXIT])]) +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +_m4_popdef([AS_EXIT])[]_m4_defun_epi([$0]) +T7,160 +AT_DATAm4_ifndef([AT_ingroup], + [m4_fatal([AT_DATA: missing AT_SETUP detected])])m4_if([$2], [], [: >$1], + [$2], [[]], [: >$1], +[cat >$1 <<'_ATEOF' +$2[]_ATEOF +]) +T26,30 +m4_location(AS_ME_PREPARE)../../lib/m4sugar/m4sh.m4:1121 +F7,6 +m4_exitm4exit +T12,83 +m4_set_unionm4_set_listc([$1])m4_if([$1], [$2], [], + [m4_set_map_sep([$2], [_$0([$1],], [)])]) +T20,73 +AS_BOURNE_COMPATIBLE# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +_$0 + +T16,2 +_m4_divert(KILL)-1 +T10,100 +m4_foreachm4_if([$2], [], [], + [m4_pushdef([$1])_$0([m4_define([$1],], [)$3], [], + $2)m4_popdef([$1])]) +T9,265 +_AS_QUOTEm4_cond([m4_index([$1], [\])], [-1], [_AS_QUOTE_MODERN], + [m4_eval(m4_index(m4_translit([[$1]], [$], [\]), [\\]) >= 0)], +[1], [_AS_QUOTE_MODERN], + [m4_eval(m4_index(m4_translit([[$1]], ["], [`]), [\`]) >= 0)],dnl" +[1], [_AS_QUOTE_OLD], + [_AS_QUOTE_MODERN])([$1]) +F11,8 +m4_traceofftraceoff +T8,33 +m4_applym4_if([$2], [], [$1], [$1($2)])[] +T30,0 +m4_include(m4sugar/version.m4) +T26,30 +m4_location(AS_VAR_APPEND)../../lib/m4sugar/m4sh.m4:1939 +T19,3 +_m4_divert(VERSION)350 +T14,73 +_m4_mapall_sepm4_apply([$1], [$3])_m4_foreach([m4_apply([$2[]$1],], [)], m4_shift2($@)) +T26,34 +m4_location(AT_ARG_OPTION)../../lib/autotest/general.m4:1766 +T9,132 +m4_divertm4_popdef([_m4_divert_stack])m4_define([_m4_divert_diversion], [$1])m4_divert_stack_push([$0], [$1])_m4_divert_raw(_m4_divert([$1])) +F10,7 +m4_traceontraceon +T13,52 +m4_cr_LettersabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ +T7,146 +AS_CASE_m4_defun_pro([$0])case $1 in[]m4_map_args_pair([_$0], [_$0_DEFAULT], + m4_shift($@m4_if(m4_eval([$# & 1]), [1], [,]))) +esac[]_m4_defun_epi([$0]) +T9,75 +m4_beforem4_provide_if([$2], + [m4_warn([syntax], [$2 was called before $1])]) +T10,143 +m4_map_sepm4_pushdef([m4_Sep], [m4_define([m4_Sep], _m4_defn([m4_unquote]))])_m4_foreach([_m4_apply([m4_Sep([$2])[]$1],], [)], [], $3)m4_popdef([m4_Sep]) +T12,55 +m4_copy_unm4m4_copy([$1], m4_bpatsubst([$1], [^m4_\(.*\)], [[\1]])) +T10,86 +m4_tolowerm4_translit([[$1]], [ABCDEFGHIJKLMNOPQRSTUVWXYZ], + [abcdefghijklmnopqrstuvwxyz]) +T7,93 +_AS_BOXm4_if(m4_index(m4_translit([[$1]], [`\"], [$$$]), [$]), + [-1], [$0_LITERAL], [$0_INDIR])($@) +T8,189 +_m4_wrapm4_ifdef([$0_text], + [m4_define([$0_text], [$1]_m4_defn([$0_text])[$2])], + [m4_builtin([m4wrap], [m4_unquote( + _m4_defn([$0_text])_m4_popdef([$0_text]))])m4_define([$0_text], [$1$2])]) +T15,123 +_AT_DEFINE_INITm4_define($@)m4_pushdef([$1], [m4_fatal([$1: missing AT_INIT detected])])dnl +m4_append([_AT_DEFINE_INIT_LIST], [[$1]], [,]) +F9,6 +m4_definedefine +T9,309 +AT_BANNERm4_ifdef([AT_ingroup], [m4_fatal([$0: nested AT_SETUP detected])])dnl +m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal)) +m4_divert_text([BANNERS], +[@%:@ Banner AT_banner_ordinal. AT_LINE +@%:@ Category starts at test group m4_incr(AT_ordinal). +at_banner_text_[]AT_banner_ordinal="AS_ESCAPE([$1])"])dnl + +T9,47 +AT_BANNERm4_fatal([AT_BANNER: missing AT_INIT detected]) +T10,27 +m4_defaultm4_if([$1], [], [$2], [$1]) +T9,5 +_m4_curry[$1]) +T13,20 +AS_VAR_APPENDas_fn_append $1 $2[] +T13,155 +AS_VAR_APPEND_m4_defun_pro([$0])AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T29,30 +m4_location(_AS_EXPR_PREPARE)../../lib/m4sugar/m4sh.m4:1108 +T8,198 +_m4_qlenm4_define([m4_qlen-$1], +m4_if(m4_index([$1], [@]), [-1], [m4_len([$1])], + [m4_len(m4_bpatsubst([[$1]], + [@\(\(<:\|:>\|S|\|%:\|\{:\|:\}\)\(@\)\|&t@\)], + [\3]))]))_m4_defn([m4_qlen-$1]) +T10,72 +m4_reversem4_if([$#], [0], [], [$#], [1], [[$1]], + [$0(m4_shift($@)), [$1]]) +T13,1 +AS_MESSAGE_FD1 +T40,30 +m4_location(_AS_VERSION_COMPARE_PREPARE)../../lib/m4sugar/m4sh.m4:1697 +T30,30 +m4_location(AS_LINENO_PREPARE)../../lib/m4sugar/m4sh.m4:1166 +T10,294 +_m4_escapem4_changequote([-=<{(],[)}>=-])m4_bpatsubst(m4_bpatsubst(m4_bpatsubst(m4_bpatsubst( + -=<{(-=<{(-=<{(-=<{(-=<{($1)}>=-)}>=-)}>=-)}>=-)}>=-, + -=<{(#)}>=-, -=<{(@%:@)}>=-), + -=<{(\[)}>=-, -=<{(@<:@)}>=-), + -=<{(\])}>=-, -=<{(@:>@)}>=-), + -=<{(\$)}>=-, -=<{(@S|@)}>=-)m4_changequote([,]) +T16,55 +_m4_divert_stack../../lib/m4sugar/m4sugar.m4:3259: m4_divert_push: KILL +T11,54 +AS_VAR_COPYAS_LITERAL_WORD_IF([$1[]$2], [$1=$$2], [eval $1=\$$2]) +T17,229 +m4_cr_not_letters +  !"#*%&'()$+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~- +T31,0 +m4_include(autotest/general.m4) +T17,117 +m4_include_uniquem4_ifdef([m4_include($1)], + [m4_warn([syntax], [file `$1' included several times])])dnl +m4_define([m4_include($1)]) +T8,77 +m4_stripm4_bpatsubsts([$1 ], + [[ ]+], [ ], + [^. ?\(.*\) .$], [[[\1]]]) +T9,4 +m4_dquote[$@] +D-1,0 + +# End of frozen state file diff --git a/externals/autotools/share/autoconf/m4sugar/m4sh.m4f b/externals/autotools/share/autoconf/m4sugar/m4sh.m4f new file mode 100644 index 000000000000..87b900c7fddb --- /dev/null +++ b/externals/autotools/share/autoconf/m4sugar/m4sh.m4f @@ -0,0 +1,2031 @@ +# This is a frozen state file generated by GNU M4 1.4.18 +V1 +Q1,1 +[] +T22,133 +_AS_LITERAL_HEREDOC_IFm4_if(m4_index([$1], [@S|@]), [-1], + [m4_if(m4_index(m4_translit([[$1]], [\`], [$]), [$]), [-1], + [$0_YES], [$0_NO])], + [$0_NO]) +T16,400 +_AS_EXIT_PREPARE_m4_defun_pro([$0])AS_REQUIRE_SHELL_FN([as_fn_set_status], + [AS_FUNCTION_DESCRIBE([as_fn_set_status], [STATUS], + [Set $? to STATUS, without forking.])], [ return $[]1])AS_REQUIRE_SHELL_FN([as_fn_exit], + [AS_FUNCTION_DESCRIBE([as_fn_exit], [STATUS], + [Exit the shell with STATUS, even in a "trap 0" or "set -e" context.])], +[ set +e + as_fn_set_status $[1] + exit $[1]])[]_m4_defun_epi([$0]) +T12,69 +_m4_list_cmpm4_if([$1], [], [0m4_ignore], [$2], [0], [m4_unquote], [$2m4_ignore]) +F12,9 +m4_debugfiledebugfile +T17,0 +AS_MESSAGE_LOG_FD +T8,0 +_m4_warn +T27,30 +m4_location(_AS_ME_PREPARE)../../lib/m4sugar/m4sh.m4:1122 +T20,29 +m4_location(AS_EXIT)../../lib/m4sugar/m4sh.m4:585 +T21,479 +_AS_VAR_ARITH_PREPARE_m4_defun_pro([$0])AS_FUNCTION_DESCRIBE([as_fn_arith], [ARG...], +[Perform arithmetic evaluation on the ARGs, and store the result in +the global $as_val. Take advantage of shells that can avoid forks. +The arguments must be portable across $(()) and expr.]) +AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_ARITH_WORKS))"])], +[eval 'as_fn_arith () + { + as_val=$(( $[]* )) + }'], +[as_fn_arith () + { + as_val=`expr "$[]@" || test $? -eq 1` + }]) # as_fn_arith +[]_m4_defun_epi([$0]) +T15,218 +m4_map_args_sepm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [$#], [2], [], + [$#], [3], [], + [$#], [4], [$1[$4]$2[]], + [$1[$4]$2[]_m4_foreach([$3[]$1], [$2], m4_shift3($@))]) +T22,30 +m4_location(AS_TEST_X)../../lib/m4sugar/m4sh.m4:1090 +T8,150 +m4_defunm4_define([m4_location($1)], m4_location)m4_default([$3], [m4_define])([$1], + [_m4_defun_pro(]m4_dquote($[0])[)$2[]_m4_defun_epi(]m4_dquote($[0])[)]) +T18,50 +_m4_set_contents_1_m4_stack_reverse([_m4_set([$1])], [_m4_set_($1)]) +T18,94 +_m4_set_contents_2_m4_stack_reverse([_m4_set_($1)], [_m4_set([$1])], + [$2[]_m4_defn([_m4_set_($1)])$3], [$4[]]) +T8,81 +m4_chompm4_format([[%.*s]], m4_index(m4_translit([[$1]], [ +/.], [/ ])[./.], [/.]), [$1]) +T10,68 +_AS_TR_CPP_AS_LITERAL_IF([$1], [*][ ][ +])([], [$0_INDIR], [$0_LITERAL])([$1]) +T16,283 +_AS_TEST_PREPARE_m4_defun_pro([$0])AS_REQUIRE_SHELL_FN([as_fn_executable_p], + [AS_FUNCTION_DESCRIBE([as_fn_executable_p], [FILE], + [Test if FILE is an executable regular file.])], + [ test -f "$[]1" && test -x "$[]1"])as_test_x='test -x' +as_executable_p=as_fn_executable_p +[]_m4_defun_epi([$0]) +T18,303 +_AS_ECHO_N_PREPARE_m4_defun_pro([$0])ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in @%:@((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac +[]_m4_defun_epi([$0]) +T13,82 +m4_dquote_eltm4_if([$#], [0], [], + [$#], [1], [[[$1]]], + [[[$1]],$0(m4_shift($@))]) +T24,32 +m4_default_nblank_quotedm4_ifblank([$1], [[$2]], [[$1]]) +T9,57 +m4_appendm4_define([$1], m4_ifdef([$1], [_m4_defn([$1])[$3]])[$2]) +T11,37 +m4_list_cmp_$0_raw(m4_dquote($1), m4_dquote($2)) +T7,84 +_m4_for$4[$1]$5[]m4_if([$1], [$2], [], + [$0(m4_eval([$1 + $3]), [$2], [$3], [$4], [$5])]) +T12,78 +m4_foreach_wm4_pushdef([$1])m4_map_args_w([$2], + [m4_define([$1],], [)$3])m4_popdef([$1]) +T5,113 +AS_IF_m4_defun_pro([$0])if $1; then : + $2 +m4_map_args_pair([_$0], [_$0_ELSE], m4_shift2($@))fi[][]_m4_defun_epi([$0]) +T11,165 +_m4_dumpdefm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_builtin([dumpdef], [$1])], + [m4_map_args_sep([m4_builtin([dumpdef],], [)], [], $@)]) +T25,30 +m4_location(AS_VAR_ARITH)../../lib/m4sugar/m4sh.m4:1981 +T14,131 +m4_set_add_allm4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1]) + + m4_len(m4_ifdef([_m4_set_cleanup($1)], [_$0_check], [_$0])([$1], $@)))) +F7,4 +m4_incrincr +F8,4 +_m4_defndefn +T13,124 +_m4_defun_prom4_ifdef([_m4_expansion_stack], [], [_m4_defun_pro_outer([$1])])m4_expansion_stack_push([$1])m4_pushdef([_m4_expanding($1)]) +T15,114 +AS_VAR_TEST_SETAS_LITERAL_WORD_IF([$1], + [${$1+:} false], + [{ as_var=$1; eval \${$as_var+:} false; }], + [eval \${$1+:} false]) +T7,111 +AS_EXIT_m4_defun_pro([$0])AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_exit m4_ifval([$1], [$1], [$][?])[]_m4_defun_epi([$0]) +T27,30 +m4_location(_AS_CR_PREPARE)../../lib/m4sugar/m4sh.m4:1793 +T13,175 +m4_defun_initm4_define([$1], [$3[]])m4_defun([$1], + [$2[]_m4_popdef(]m4_dquote($[0])[)m4_indir(]m4_dquote($[0])dnl +[m4_if(]m4_dquote($[#])[, [0], [], ]m4_dquote([,$]@)[))], [m4_pushdef]) +T12,64 +_AS_ECHO_LOG_AS_ECHO([$as_me:${as_lineno-$LINENO}: $1], AS_MESSAGE_LOG_FD)[] +T12,131 +_AS_ECHO_LOG_m4_defun_pro([$0])AS_REQUIRE([_AS_LINENO_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T17,604 +_AS_SHELL_FN_WORKas_fn_return () { (exit [$]1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +AS_IF([( set x; as_fn_ret_success y && test x = "[$]1" )], [], + [exitcode=1; echo positional parameters were not saved.]) +test x$exitcode = x0[] +T21,97 +m4_copyright_condensem4_text_wrap(m4_bpatsubst(m4_flatten([[$1]]), +[(C)[- ,0-9]*\([1-9][0-9][0-9][0-9]\)], [(C) \1])) +T17,203 +m4_cr_not_Letters +  !"#*%&'()$+,./0123456789:;<=>?@[\]^_`{|}~- +T21,1 +_m4_divert(M4SH-INIT)6 +T12,66 +m4_re_string[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]* +T16,5 +_m4_divert(GROW)10000 +T18,72 +m4_version_compare_m4_list_cmp_raw(_m4_version_unletter([$1]), _m4_version_unletter([$2])) +T31,30 +m4_location(_AS_LINENO_PREPARE)../../lib/m4sugar/m4sh.m4:1167 +T25,1 +_m4_divert(M4SH-SANITIZE)4 +T10,120 +_AS_ESCAPEm4_if(m4_index(m4_translit([[$1]], [$3], [$2$2$2$2]), [$2]), [-1], + [$0_], [m4_bpatsubst])([$1], [[$2$3]], [\\\&]) +T29,29 +m4_location(_AS_EXIT_PREPARE)../../lib/m4sugar/m4sh.m4:568 +T15,165 +_m4_set_add_allm4_if([$#], [2], [], + [m4_ifdef([_m4_set([$1],$3)], [], + [m4_define([_m4_set([$1],$3)], [1])m4_pushdef([_m4_set([$1])], + [$3])-])$0([$1], m4_shift2($@))]) +T17,780 +_AS_ERROR_PREPAREAS_REQUIRE_SHELL_FN([as_fn_error], + [AS_FUNCTION_DESCRIBE([as_fn_error], [STATUS ERROR]m4_ifval(AS_MESSAGE_LOG_FD, + [[ [[LINENO LOG_FD]]]]), + [Output "`basename @S|@0`: error: ERROR" to stderr.] +m4_ifval(AS_MESSAGE_LOG_FD, + [[If LINENO and LOG_FD are provided, also output the error to LOG_FD, + referencing LINENO.]]) + [Then exit the script with STATUS, using 1 if that was 0.])], +[ as_status=$[1]; test $as_status -eq 0 && as_status=1 +m4_ifval(AS_MESSAGE_LOG_FD, +[m4_pushdef([AS_MESSAGE_LOG_FD], [$[4]])dnl + if test "$[4]"; then + AS_LINENO_PUSH([$[3]]) + _AS_ECHO_LOG([error: $[2]]) + fi +m4_define([AS_MESSAGE_LOG_FD])], [m4_pushdef([AS_MESSAGE_LOG_FD])])dnl + AS_MESSAGE([error: $[2]], [2]) +_m4_popdef([AS_MESSAGE_LOG_FD])dnl + AS_EXIT([$as_status])]) +T8,4 +m4_quote[$*] +T15,4 +m4_PACKAGE_YEAR2012 +T10,211 +m4_dumpdefm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_ifdef([$1], [m4_errprintn( + [$1: ]m4_dquote(_m4_defn([$1])))], [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T15,193 +m4_cr_not_alnum +  !"#*%&'()$+,./:;<=>?@[\]^_`{|}~- +T6,21 +_AS_IFelif $1; then : + $2 + +T13,15 +AS_VAR_POPDEFm4_popdef([$1]) +T23,29 +m4_location(AS_REQUIRE)../../lib/m4sugar/m4sh.m4:385 +F6,3 +m4_lenlen +T14,42 +m4_divert_textm4_divert_push([$1])$2 +m4_divert_pop([$1]) +T8,94 +AS_UNSET_m4_defun_pro([$0]){ AS_LITERAL_WORD_IF([$1], [], [eval ])$1=; unset $1;}[]_m4_defun_epi([$0]) +T10,115 +AS_VAR_GETAS_LITERAL_WORD_IF([$1], + [$$1], + [`eval 'as_val=${'_AS_ESCAPE([[$1]], [`], [\])'};AS_ECHO(["$as_val"])'`]) +T29,30 +m4_location(_AS_LN_S_PREPARE)../../lib/m4sugar/m4sh.m4:1223 +F12,9 +m4_debugmodedebugmode +T10,280 +m4_set_addm4_ifdef([_m4_set([$1],$2)], + [m4_if(m4_indir([_m4_set([$1],$2)]), [0], + [m4_define([_m4_set([$1],$2)], + [1])_m4_set_size([$1], [m4_incr])$3], [$4])], + [m4_define([_m4_set([$1],$2)], + [1])m4_pushdef([_m4_set([$1])], + [$2])_m4_set_size([$1], [m4_incr])$3]) +T14,122 +m4_append_uniqm4_ifval([$3], [m4_if(m4_index([$2], [$3]), [-1], [], + [m4_warn([syntax], + [$0: `$2' contains `$3'])])])_$0($@) +T15,0 +_m4_divert_dump +T27,30 +m4_location(AS_VAR_PUSHDEF)../../lib/m4sugar/m4sh.m4:2066 +T20,20 +m4_PACKAGE_BUGREPORTbug-autoconf@gnu.org +T8,66 +m4_ifsetm4_ifdef([$1], + [m4_ifval(_m4_defn([$1]), [$2], [$3])], + [$3]) +T7,182 +m4_condm4_if([$#], [0], [m4_fatal([$0: cannot be called without arguments])], + [$#], [1], [$1], + m4_eval([$# % 3]), [2], [m4_fatal([$0: missing an argument])], + [_$0($@)]) +T9,15 +AS_ECHO_N$as_echo_n $1[] +T9,129 +AS_ECHO_N_m4_defun_pro([$0])AS_REQUIRE([_AS_ECHO_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T12,30 +m4_esyscmd_sm4_chomp_all(m4_esyscmd([$1])) +T6,264 +AS_FOR_m4_defun_pro([$0])m4_pushdef([$1], m4_if([$3], [], [[$$2]], m4_translit([$3], [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789][%+=:,./-]), [], [[$3]], [[$$2]]))for $2[]m4_ifval([$3], [ in $3]) +do : + $4 +done[]_m4_popdef([$1])[]_m4_defun_epi([$0]) +T14,276 +_AS_CR_PREPARE_m4_defun_pro([$0])# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits +[]_m4_defun_epi([$0]) +T15,148 +_m4_append_uniqm4_ifdef([$1], + [m4_if(m4_index([$3]_m4_defn([$1])[$3], [$3$2$3]), [-1], + [m4_append([$1], [$2], [$3])$4], [$5])], + [m4_define([$1], [$2])$4]) +T32,30 +m4_location(_AS_MKDIR_P_PREPARE)../../lib/m4sugar/m4sh.m4:1296 +T20,201 +_AS_BASENAME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_EXPR_PREPARE])if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi +[]_m4_defun_epi([$0]) +T17,272 +_AS_IDENTIFIER_IFm4_cond([[$1]], [], [], + [m4_eval(m4_len(m4_translit([[$1]], ][[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]][)) > 0)], [1], [], + [m4_len(m4_translit(m4_format([[%.1s]], [$1]), ][[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]][))], [0], [-]) +T11,85 +AS_BASENAME$as_basename -- $1 || +_AS_BASENAME_EXPR([$1]) 2>/dev/null || +_AS_BASENAME_SED([$1])[] +T11,124 +AS_BASENAME_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T9,31 +_m4_applym4_if([$2], [], [], [$1($2)[]]) +T13,84 +_AS_QUOTE_OLDm4_warn([obsolete], + [back quotes and double quotes must not be escaped in: $1])$1 +T10,2 +m4_unquote$* +T9,72 +m4_mapallm4_if([$2], [], [], + [_m4_foreach([m4_apply([$1],], [)], [], $2)]) +F14,6 +_m4_divert_rawdivert +T6,122 +m4_cdrm4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))]) +T16,27 +_AS_QUOTE_MODERN_AS_ESCAPE([$1], [`], [""]) +T14,41 +_m4_list_cmp_1_m4_list_cmp_2([$2], [m4_shift2($@)], $1) +T14,95 +_m4_list_cmp_2_m4_list_cmp([$1$3], m4_cmp([$3+0], [$1+0]))( + [_m4_list_cmp_1(m4_dquote(m4_shift3($@)), $2)]) +T11,53 +_m4_joinallm4_if([$#], [2], [], [[$1$3]$0([$1], m4_shift2($@))]) +T16,137 +_AS_DIRNAME_EXPR$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \ + X[]$1 : 'X\(//\)[[^/]]' \| \ + X[]$1 : 'X\(//\)$' \| \ + X[]$1 : 'X\(/\)' \| .[] +T16,129 +_AS_DIRNAME_EXPR_m4_defun_pro([$0])AS_REQUIRE([_AS_EXPR_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T9,158 +m4_popdefm4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_popdef([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T21,29 +m4_location(AS_UNSET)../../lib/m4sugar/m4sh.m4:671 +T12,152 +_m4_set_dumpm4_ifdef([_m4_set([$1])], + [[$2]_m4_defn([_m4_set([$1])])_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)], [_m4_set([$1])])$0([$1], [$2$3])]) +T17,196 +AS_SHELL_SANITIZE_AS_SHELL_SANITIZE +m4_provide_if([AS_INIT], [], +[m4_provide([AS_INIT]) +_AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK]) +_AS_DETECT_REQUIRED([_AS_TEST_X_WORKS]) +_AS_DETECT_BETTER_SHELL +_AS_UNSET_PREPARE +]) +T12,32 +m4_make_listm4_join([, +], m4_dquote_elt($@)) +T31,29 +m4_location(_AS_ECHO_N_PREPARE)../../lib/m4sugar/m4sh.m4:807 +T27,29 +m4_location(AS_LINENO_PUSH)../../lib/m4sugar/m4sh.m4:894 +T11,498 +_AS_MKDIR_Pcase $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`AS_DIRNAME("$as_dir")` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir]) + +T39,30 +m4_location(_AS_PATH_SEPARATOR_PREPARE)../../lib/m4sugar/m4sh.m4:1315 +T5,73 +m4_dom4_if([$#], 0, [], + [$#], 1, [$1[]], + [$1[]$0(m4_shift($@))]) +F9,6 +m4_substrsubstr +T33,29 +m4_location(_AS_DETECT_SUGGESTED)../../lib/m4sugar/m4sh.m4:167 +T18,8 +m4_PACKAGE_TARNAMEautoconf +T13,252 +m4_set_removem4_set_contains([$1], [$2], [_m4_set_size([$1], + [m4_decr])m4_if(_m4_defn([_m4_set([$1])]), [$2], + [_m4_popdef([_m4_set([$1],$2)], [_m4_set([$1])])], + [m4_define([_m4_set_cleanup($1)])m4_define( + [_m4_set([$1],$2)], [0])])$3], [$4]) +T19,109 +_m4_defun_epi_outer_m4_popdef([_m4_divert_dump], [_m4_diverting([$1])], [_m4_diverting])m4_divert_pop([GROW])m4_undivert([GROW]) +T27,30 +m4_location(_AS_TR_PREPARE)../../lib/m4sugar/m4sh.m4:1878 +T15,58 +m4_divert_stackm4_stack_foreach_sep_lifo([_m4_divert_stack], [], [], [ +]) +T17,31 +m4_default_quotedm4_if([$1], [], [[$2]], [[$1]]) +T14,28 +AS_VAR_PUSHDEF_$0([$1], m4_expand([$2]))[] +T14,130 +AS_VAR_PUSHDEF_m4_defun_pro([$0])AS_REQUIRE([_AS_TR_SH_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T18,29 +m4_location(AS_IF)../../lib/m4sugar/m4sh.m4:639 +T31,30 +m4_location(AS_VERSION_COMPARE)../../lib/m4sugar/m4sh.m4:1767 +F9,6 +m4_syscmdsyscmd +T11,136 +m4_set_dumpm4_ifdef([_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])m4_ifdef([_m4_set_cleanup($1)], + [_$0_check], [_$0])([$1], [], [$2]) +T9,58 +m4_ifvalnm4_if([$1], + [], [m4_n([$3])], + [m4_n([$2])]) +T7,0 +__gnu__ +T10,27 +m4_joinall[$2]_$0([$1], m4_shift($@)) +T11,2 +_AS_ESCAPE_$1 +T9,22 +m4_shift2m4_shift(m4_shift($@)) +T18,80 +m4_expansion_stackm4_stack_foreach_sep_lifo([_$0], [_$0_entry(], [) +])m4_location[: the top level] +T9,32 +m4_shift3m4_shift(m4_shift(m4_shift($@))) +T17,152 +m4_version_prereqm4_if(m4_version_compare([2.69], [$1]), + [-1], + [m4_default([$3], + [m4_fatal([Autoconf version $1 or higher is required], + [63])])], + [$2]) +T16,50 +_m4_list_cmp_rawm4_if([$1], [$2], [0], [_m4_list_cmp_1([$1], $2)]) +T8,0 +__unix__ +T20,30 +m4_location(AS_LN_S)../../lib/m4sugar/m4sh.m4:1257 +T14,109 +m4_file_appendm4_syscmd([cat >>$1 <<_m4eof +$2 +_m4eof +]) +m4_if(m4_sysval, [0], [], + [m4_fatal([$0: cannot write: $1])]) +T15,140 +_AS_VAR_PUSHDEF_AS_LITERAL_IF([$2], [ ][ +])([], [as_$1=_AS_TR_SH_INDIR([$2]) +m4_pushdef([$1], [$as_[$1]])], +[m4_pushdef([$1], [_AS_TR_SH_LITERAL([$2])])]) +T15,49 +m4_rename_forcem4_ifdef([$2], [_m4_undefine([$2])])m4_rename($@) +T28,30 +m4_location(AS_EXECUTABLE_P)../../lib/m4sugar/m4sh.m4:1098 +T9,222 +m4_bmatchm4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [$2], + [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shift3($@))], + [$3])]) +T10,26 +AS_MKDIR_Pas_dir=$1; as_fn_mkdir_p[] +T10,124 +AS_MKDIR_P_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T13,333 +m4_divert_popm4_if([$1], [], [], + [$1], _m4_defn([_m4_divert_diversion]), [], + [m4_fatal([$0($1): diversion mismatch: +]m4_divert_stack)])_m4_popdef([_m4_divert_stack], [_m4_divert_diversion])m4_ifdef([_m4_divert_diversion], [], + [m4_fatal([too many m4_divert_pop])])_m4_divert_raw(_m4_divert(_m4_defn([_m4_divert_diversion]), [-])) +T16,169 +_AS_EXPR_PREPARE_m4_defun_pro([$0])if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi +[]_m4_defun_epi([$0]) +T19,95 +_AS_DETECT_REQUIRED_m4_defun_pro([$0])m4_set_add([_AS_DETECT_REQUIRED_BODY], [$1 || AS_EXIT])[]_m4_defun_epi([$0]) +T10,121 +m4_re_word[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]* +T26,29 +m4_location(AS_SET_STATUS)../../lib/m4sugar/m4sh.m4:649 +T14,37 +m4_PACKAGE_URLhttp://www.gnu.org/software/autoconf/ +T11,62 +m4_cr_alnumabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 +T12,71 +AS_COPYRIGHTm4_divert_text([HEADER-COPYRIGHT], +[m4_bpatsubst([ +$1], [^], [@%:@ ])]) +F11,8 +m4_translittranslit +T14,110 +m4_divert_pushm4_divert_stack_push([$0], [$1])m4_pushdef([_m4_divert_diversion], [$1])_m4_divert_raw(_m4_divert([$1], [$2])) +T8,87 +m4_fatalm4_errprintn(m4_location[: error: $1] +m4_expansion_stack)m4_exit(m4_if([$2],, 1, [$2])) +F8,5 +m4_ifdefifdef +T16,225 +_AS_LINENO_WORKS as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' +T7,20 +m4_wrap_m4_wrap([], [$1[]]) +T16,9 +_AS_TEST_X_WORKStest -x / +T12,110 +_m4_set_sizem4_define([_m4_set_size($1)], + m4_ifdef([_m4_set_size($1)], [$2(m4_indir([_m4_set_size($1)]))], + [1])) +T6,43 +m4_map_m4_foreach([_m4_apply([$1],], [)], [], $2) +T10,54 +m4_includem4_include_unique([$1])dnl +m4_builtin([include], [$1]) +T17,136 +_AS_BASENAME_EXPR_m4_defun_pro([$0])$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \ + X[]$1 : 'X\(//\)$' \| \ + X[]$1 : 'X\(/\)' \| .[]_m4_defun_epi([$0]) +T8,115 +AS_ERRORas_fn_error m4_default([$2], [$?]) "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD, + [ "$LINENO" AS_MESSAGE_LOG_FD])[] +T8,187 +AS_ERROR_m4_defun_pro([$0])m4_append_uniq([_AS_CLEANUP], + [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T8,189 +m4_splitm4_if([$1], [], [], + [$2], [ ], [m4_if(m4_index([$1], [ ]), [-1], [[[$1]]], + [_$0([$1], [$2], [, ])])], + [$2], [], [_$0([$1], [[ ]+], [, ])], + [_$0([$1], [$2], [, ])]) +T6,190 +m4_minm4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)]) +F14,11 +m4_changequotechangequote +T17,2 +_AS_LITERAL_IF_NO$2 +T26,1 +_m4_divert(HEADER-COMMENT)2 +T10,54 +m4_ifblankm4_if(m4_translit([[$1]], [ ][ ][ +]), [], [$2], [$3]) +T14,166 +m4_cleardivertm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [_m4_divert_raw([-1])m4_undivert($@)_m4_divert_raw( + _m4_divert(_m4_defn([_m4_divert_diversion]), [-]))]) +T18,206 +_m4_text_wrap_wordm4_define([m4_Cursor], m4_eval(m4_Cursor + m4_qlen([$1]) + 1))m4_if(m4_eval(m4_Cursor > ([$3])), + [1], [m4_define([m4_Cursor], m4_eval(m4_Indent + m4_qlen([$1]) + 1)) +[$2]], + [m4_Separator[]])[$1] +T18,1601 +_AS_SHELL_SANITIZE_m4_defun_pro([$0])m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])m4_text_box([M4sh Initialization.]) + +AS_BOURNE_COMPATIBLE +_AS_ECHO_PREPARE +_AS_PATH_SEPARATOR_PREPARE + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $[0] in @%:@(( + *[[\\/]]* ) as_myself=$[0] ;; + *) _AS_PATH_WALK([], + [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break]) + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$[0] +fi +if test ! -f "$as_myself"; then + AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2 + AS_EXIT +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +_m4_popdef([AS_EXIT])[]_m4_defun_epi([$0]) +T7,48 +m4_qlenm4_ifdef([$0-$1], [_m4_defn([$0-]], [_$0(])[$1]) +T6,190 +m4_maxm4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)]) +F11,8 +m4_errprinterrprint +T10,137 +_m4_divertm4_ifdef([_m4_divert($1)], + [m4_indir([_m4_divert($1)])], + [m4_if([$2], [], [m4_warn([syntax], + [prefer named diversions])])$1]) +T13,26 +m4_cr_LETTERSABCDEFGHIJKLMNOPQRSTUVWXYZ +T15,272 +_AS_DIRNAME_SED_m4_defun_pro([$0])AS_ECHO([X[]$1]) | + sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'][]_m4_defun_epi([$0]) +T17,94 +_m4_stack_reversem4_ifdef([$1], [m4_pushdef([$2], + _m4_defn([$1]))$3[]_m4_popdef([$1])$0([$1], [$2], [$4$3])]) +T16,103 +AS_IDENTIFIER_IFm4_if(_$0(m4_if(m4_index([$1], [@]), [-1], + [[$1]], [m4_bpatsubst([[$1]], [@&t@])])), [-], [$2], [$3]) +F11,7 +m4_maketempmkstemp +T17,129 +_AS_DETECT_EXPAND$1="m4_bpatsubst(m4_dquote(AS_ESCAPE(_m4_expand(m4_set_contents([$2], [ +])))), [\\\$LINENO\(.*\)$], [";$1=$$1$LINENO;$1=$$1"\1])" +T4,37 +m4_nm4_if([$1], + [], [], + [$1 +]) +T26,29 +m4_location(AS_LINENO_POP)../../lib/m4sugar/m4sh.m4:904 +T8,22 +AS_TR_SH_$0(m4_expand([$1]))[] +T8,124 +AS_TR_SH_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,154 +m4_providem4_ifdef([m4_provide($1)], [], +[m4_set_add([_m4_provide], [$1], [m4_define([m4_provide($1)], + m4_ifdef([_m4_diverting], [_m4_defn([_m4_diverting])]))])]) +T13,100 +AS_LINENO_POP_m4_defun_pro([$0])eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno[]_m4_defun_epi([$0]) +T11,65 +m4_set_sizem4_ifdef([_m4_set_size($1)], [m4_indir([_m4_set_size($1)])], [0]) +T9,0 +m4_ignore +T9,28 +_m4_quotem4_if([$#], [0], [], [[$*]]) +T21,30 +m4_location(AS_TR_SH)../../lib/m4sugar/m4sh.m4:1826 +T9,35 +m4_shiftnm4_assert(0 < $1 && $1 < $#)_$0($@) +T7,75 +m4_warn_m4_warn([$1], [$2], +m4_ifdef([_m4_expansion_stack], [m4_expansion_stack])) +T16,245 +m4_cr_not_digits +  !"#*%&'()$+,./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T12,25 +m4_set_listcm4_set_map_sep([$1], [,]) +F9,6 +m4_divnumdivnum +T30,30 +m4_location(AS_INIT_GENERATED)../../lib/m4sugar/m4sh.m4:2121 +T21,76 +_m4_set_add_all_checkm4_if([$#], [2], [], + [m4_set_add([$1], [$3])$0([$1], m4_shift2($@))]) +T24,1 +_m4_divert(M4SH-INIT-FN)5 +T10,91 +AS_VAR_SETAS_LITERAL_WORD_IF([$1], + [$1=$2], + [eval "$1=_AS_ESCAPE([$2], [`], [\"$])"]) +T10,3 +m4_newline +$1 +T13,293 +m4_defun_oncem4_define([m4_location($1)], m4_location)m4_define([$1], [_m4_defun_once([$1], [$2], m4_if(_m4_divert_dump, [], + [[_m4_defun_pro([$1])m4_unquote(], [)_m4_defun_epi([$1])]], +m4_ifdef([_m4_diverting([$1])], [-]), [-], [[m4_unquote(], [)]], + [[_m4_require_call([$1],], [, _m4_divert_dump)]]))]) +T13,474 +_m4_text_wrapm4_pushdef([m4_Indent], m4_qlen([$2]))m4_pushdef([m4_Cursor], m4_qlen([$3]))m4_pushdef([m4_Separator], [m4_define([m4_Separator], [ ])])[$3]m4_cond([m4_Cursor], m4_Indent, [], + [m4_eval(m4_Cursor > m4_Indent)], [1], [ +[$2]m4_define([m4_Cursor], m4_Indent)], + [m4_format([%*s], m4_max([0], + m4_eval(m4_Indent - m4_Cursor)), [])m4_define([m4_Cursor], m4_Indent)])m4_map_args_w([$1], [$0_word(], [, [$2], [$4])])_m4_popdef([m4_Separator], [m4_Cursor], [m4_Indent]) +T21,342 +_AS_BOURNE_COMPATIBLEAS_IF([test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1], + [emulate sh + NULLCMD=: + [#] Pre-4.2 versions of Zsh do word splitting on ${1+"$[@]"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$[@]"}'='"$[@]"' + setopt NO_GLOB_SUBST], + [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])]) + +T15,99 +_AS_LITERAL_IF_m4_if(m4_translit([$1], [+]), [], [$0YES], + m4_translit([$1], [$]), [], [m4_default], [$0NO]) +F9,6 +m4_formatformat +F10,7 +m4_mkstempmkstemp +F11,11 +__program____program__ +T6,26 +AS_BOX_$0(m4_expand([$1]), [$2]) +T7,156 +m4_defnm4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_defn([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T11,544 +_AS_PREPARE_m4_defun_pro([$0])m4_pushdef([AS_REQUIRE])m4_pushdef([AS_REQUIRE_SHELL_FN], _m4_defn([_AS_REQUIRE_SHELL_FN]) +)m4_pushdef([AS_MESSAGE_LOG_FD], [-1])_AS_ERROR_PREPARE +_m4_popdef([AS_MESSAGE_LOG_FD])_AS_EXIT_PREPARE +_AS_UNSET_PREPARE +_AS_VAR_APPEND_PREPARE +_AS_VAR_ARITH_PREPARE + +_AS_EXPR_PREPARE +_AS_BASENAME_PREPARE +_AS_DIRNAME_PREPARE +_AS_ME_PREPARE +_AS_CR_PREPARE +_AS_ECHO_N_PREPARE +_AS_LN_S_PREPARE +_AS_MKDIR_P_PREPARE +_AS_TEST_PREPARE +_AS_TR_CPP_PREPARE +_AS_TR_SH_PREPARE +_m4_popdef([AS_REQUIRE], [AS_REQUIRE_SHELL_FN])[]_m4_defun_epi([$0]) +T16,54 +m4_append_uniq_wm4_map_args_w([$2], [_m4_append_uniq([$1],], [, [ ])]) +T13,207 +m4_map_args_w_$0(_m4_split([ ]m4_flatten([$1])[ ], [[ ]+], + m4_if(m4_index([$2$3$4], [\]), [-1], [[$3[]$4[]$2]], + [m4_bpatsubst([[$3[]$4[]$2]], [\\], [\\\\])])), + m4_len([[]$3[]$4]), m4_len([$4[]$2[]])) +T6,4 +m4_car[$1] +T8,2 +m4_count$# +T14,42 +_m4_defun_oncem4_pushdef([$1])$3[$2[]m4_provide([$1])]$4 +T16,1346 +_AS_ECHO_PREPARE_m4_defun_pro([$0])[as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$][1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$][1; + case $arg in @%:@( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi +][]_m4_defun_epi([$0]) +T17,164 +_AS_UNSET_PREPARE_m4_defun_pro([$0])AS_FUNCTION_DESCRIBE([as_fn_unset], [VAR], [Portably unset VAR.]) +as_fn_unset () +{ + AS_UNSET([$[1]]) +} +as_unset=as_fn_unset[]_m4_defun_epi([$0]) +T14,62 +m4_set_foreachm4_pushdef([$2])m4_set_map_sep([$1], [m4_define([$2],], [)$3]) +T16,101 +m4_stack_foreach_m4_stack_reverse([$1], [m4_tmp-$1])_m4_stack_reverse([m4_tmp-$1], [$1], [$2(_m4_defn([m4_tmp-$1]))]) +T12,77 +m4_chomp_allm4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [ +/], [/ ]), [/*$]), [$1]) +T6,46 +m4_cmpm4_eval((([$1]) > ([$2])) - (([$1]) < ([$2]))) +T9,373 +AS_TMPDIR# Create a (secure) tmp directory for tmp files. +m4_if([$2], [], [: "${TMPDIR:=/tmp}"]) +{ + tmp=`(umask 077 && mktemp -d "m4_default([$2], + [$TMPDIR])/$1XXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || AS_ERROR([cannot create a temporary directory in m4_default([$2], + [$TMPDIR])]) +T17,51 +_AS_ECHO_UNQUOTEDAS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD]) +T20,96 +_AS_DETECT_SUGGESTED_m4_defun_pro([$0])m4_set_add([_AS_DETECT_SUGGESTED_BODY], [$1 || AS_EXIT])[]_m4_defun_epi([$0]) +T17,57 +AS_LINENO_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_$0])[]_m4_defun_epi([$0]) +F5,6 +m4_ififelse +T9,36 +m4_renamem4_copy([$1], [$2])m4_undefine([$1]) +F8,5 +m4_indirindir +T12,1 +_m4_divert()0 +T31,30 +m4_location(_AS_TR_CPP_PREPARE)../../lib/m4sugar/m4sh.m4:1845 +F12,9 +m4_changecomchangecom +T20,40 +_AS_VAR_APPEND_WORKSas_var=1; as_var+=2; test x$as_var = x12 +T10,62 +m4_noquotem4_changequote([-=<{(],[)}>=-])$1-=<{()}>=-m4_changequote([,]) +T13,42 +AS_VAR_SET_IFAS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3]) +F8,5 +m4_indexindex +T14,58 +_m4_map_args_wm4_substr([$1], [$2], m4_eval(m4_len([$1]) - [$2] - [$3])) +T7,98 +_AS_RUNm4_ifval([$2], [{ $as_echo "$as_bourne_compatible"$1 | as_run=a $2; }], + [(eval $1)]) 2>/dev/null +T14,107 +m4_set_map_sepm4_ifdef([_m4_set_cleanup($1)], [_m4_set_contents_1c], + [_m4_set_contents_1])([$1])_m4_set_contents_2($@) +T9,174 +m4_expandm4_pushdef([m4_divert], _m4_defn([_m4_divert_unsafe]))m4_pushdef([m4_divert_push], _m4_defn([_m4_divert_unsafe]))m4_chomp(_$0([$1 +]))_m4_popdef([m4_divert], [m4_divert_push]) +T19,336 +_AS_MKDIR_P_PREPARE_m4_defun_pro([$0])AS_REQUIRE_SHELL_FN([as_fn_mkdir_p], + [AS_FUNCTION_DESCRIBE([as_fn_mkdir_p], [], + [Create "$as_dir" as a directory, including parents if necessary.])], +[ + _AS_MKDIR_P +])if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi +[]_m4_defun_epi([$0]) +T17,229 +m4_cr_not_LETTERS +  !"#*%&'()$+,./0123456789:;<=>?@[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T18,256 +_m4_set_dump_checkm4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [[$2]_m4_defn([_m4_set([$1])])])_m4_popdef( + [_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1], [$2$3])], + [_m4_popdef([_m4_set_cleanup($1)])]) +T10,728 +AS_PREPARE_m4_defun_pro([$0])m4_divert_push([KILL]) +m4_append_uniq([_AS_CLEANUP], + [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])]) +AS_REQUIRE([_AS_EXPR_PREPARE]) +AS_REQUIRE([_AS_BASENAME_PREPARE]) +AS_REQUIRE([_AS_DIRNAME_PREPARE]) +AS_REQUIRE([_AS_ME_PREPARE]) +AS_REQUIRE([_AS_CR_PREPARE]) +AS_REQUIRE([_AS_LINENO_PREPARE]) +AS_REQUIRE([_AS_ECHO_N_PREPARE]) +AS_REQUIRE([_AS_EXIT_PREPARE]) +AS_REQUIRE([_AS_LN_S_PREPARE]) +AS_REQUIRE([_AS_MKDIR_P_PREPARE]) +AS_REQUIRE([_AS_TEST_PREPARE]) +AS_REQUIRE([_AS_TR_CPP_PREPARE]) +AS_REQUIRE([_AS_TR_SH_PREPARE]) +AS_REQUIRE([_AS_UNSET_PREPARE]) +AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN]) +AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN]) +m4_divert_pop[][]_m4_defun_epi([$0]) +T11,17 +m4_location__file__:__line__ +T24,29 +m4_location(AS_BASENAME)../../lib/m4sugar/m4sh.m4:942 +T36,29 +m4_location(_AS_DETECT_BETTER_SHELL)../../lib/m4sugar/m4sh.m4:194 +T11,54 +m4_ifnblankm4_if(m4_translit([[$1]], [ ][ ][ +]), [], [$3], [$2]) +T13,134 +_m4_defun_epi_m4_popdef([_m4_expanding($1)], [_m4_expansion_stack])m4_ifdef([_m4_expansion_stack], [], [_m4_defun_epi_outer([$1])])m4_provide([$1]) +T10,40 +m4_warningm4_errprintn(m4_location[: warning: $1]) +F7,4 +m4_evaleval +T15,5 +_m4_divert_grow10000 +T15,23 +AS_EXECUTABLE_Pas_fn_executable_p $1[] +T15,129 +AS_EXECUTABLE_P_m4_defun_pro([$0])AS_REQUIRE([_AS_TEST_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T6,598 +m4_form4_pushdef([$1], m4_eval([$2]))m4_cond([m4_eval(([$3]) > ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4], + 1)))m4_assert(_m4_step > 0)_$0(_m4_defn([$1]), + m4_eval((([$3]) - ([$2])) / _m4_step * _m4_step + ([$2])), _m4_step,], + [m4_eval(([$3]) < ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4], + -1)))m4_assert(_m4_step < 0)_$0(_m4_defn([$1]), + m4_eval((([$2]) - ([$3])) / -(_m4_step) * _m4_step + ([$2])), _m4_step,], + [m4_pushdef([_m4_step])_$0(_m4_defn([$1]), _m4_defn([$1]), 0,])[m4_define([$1],], [)$5])m4_popdef([_m4_step], [$1]) +T8,42 +_AS_ECHO_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2]) +T25,29 +m4_location(_AS_ECHO_LOG)../../lib/m4sugar/m4sh.m4:790 +T17,185 +_AS_TR_SH_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_CR_PREPARE])# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'" +[]_m4_defun_epi([$0]) +T13,110 +_AS_CLEAN_DIRif test -d $1; then + find $1 -type d ! -perm -700 -exec chmod u+rwx {} \; + rm -fr $1/* $1/.[[!.]] $1/.??* +fi +T20,181 +AS_FUNCTION_DESCRIBE@%:@ $1[]m4_ifval([$2], [ $2]) +@%:@ m4_translit(m4_format([%*s], + m4_decr(m4_qlen(_m4_expand([$1[]m4_ifval([$2], [ $2]) +]))), []), [ ], [-]) +m4_text_wrap([$3], [@%:@ ], [], [$4]) +T16,298 +m4_map_args_pairm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [m4_fatal([$0: too few arguments: $#: $1])], + [$#], [2], [], + [$#], [3], [m4_default([$2], [$1])([$3])[]], + [$#], [4], [$1([$3], [$4])[]], + [$1([$3], [$4])[]$0([$1], [$2], m4_shift(m4_shift3($@)))]) +T18,1 +_m4_divert(NOTICE)6 +T27,1 +_m4_divert(HEADER-REVISION)1 +T10,124 +AS_MESSAGEm4_ifval(AS_MESSAGE_LOG_FD, + [{ _AS_ECHO_LOG([$1]) +_AS_ECHO([$as_me: $1], [$2]);}], + [_AS_ECHO([$as_me: $1], [$2])])[][] +T10,127 +AS_MESSAGE_m4_defun_pro([$0])AS_REQUIRE([_AS_ME_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T16,27 +_AS_CASE_DEFAULT [@%:@(] + *[)] : + $1 ;; +T7,30 +AS_WARNAS_MESSAGE([WARNING: $1], [2]) +T30,29 +m4_location(_AS_BASENAME_EXPR)../../lib/m4sugar/m4sh.m4:921 +T17,490 +_AS_TR_SH_LITERALm4_translit([[$1]], + [*+[]][ +  !"#*%&'()$+,./:;<=>?@[\]^`{|}~-], + [pp[]][_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________]) +T10,66 +_AS_ECHO_NAS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD]) +T7,36 +m4_signm4_eval((([$1]) > 0) - (([$1]) < 0)) +T25,53 +_m4_expansion_stack_entry_m4_defn([m4_location($1)])[: $1 is expanded from...] +T19,191 +_AS_DIRNAME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_EXPR_PREPARE])if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi +[]_m4_defun_epi([$0]) +T26,2 +_AS_LITERAL_HEREDOC_IF_YES$1 +T9,127 +_m4_splitm4_changequote([-=<{(],[)}>=-])[m4_bpatsubst(-=<{(-=<{($1)}>=-)}>=-, -=<{($2)}>=-, + -=<{(]$3[)}>=-)]m4_changequote([, ]) +T8,85 +_m4_joinm4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift2($@))]) +T16,4 +_m4_divert(BODY)1000 +T18,1268 +_AS_LINENO_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_CR_PREPARE])AS_REQUIRE([_AS_ME_PREPARE])_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])m4_pushdef([AS_MESSAGE_LOG_FD])m4_pushdef([AS_ERROR], + [{ AS_MESSAGE(]m4_dquote([error: $][1])[, [2]); AS_EXIT([1]); }])_AS_LINENO_WORKS || { +[ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno"] || + AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell]) + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} +_m4_popdef([AS_MESSAGE_LOG_FD], [AS_ERROR])[]_m4_defun_epi([$0]) +T13,276 +m4_set_deletem4_ifdef([_m4_set([$1])], + [_m4_popdef([_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1])], + [m4_ifdef([_m4_set_cleanup($1)], + [_m4_popdef([_m4_set_cleanup($1)])])m4_ifdef( + [_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])]) +T34,29 +m4_location(_AS_REEXEC_WITH_SHELL)../../lib/m4sugar/m4sh.m4:279 +T12,10 +m4_cr_digits0123456789 +T17,17 +m4_PACKAGE_STRINGGNU Autoconf 2.69 +T9,14 +AS_TEST_Xtest -x $1[][] +T9,129 +AS_TEST_X_m4_defun_pro([$0])AS_REQUIRE([_AS_TEST_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +F10,6 +_m4_popdefpopdef +T9,68 +_AS_TR_SH_AS_LITERAL_IF([$1], [*][ ][ +])([], [$0_INDIR], [$0_LITERAL])([$1]) +T7,1688 +m4_init# All the M4sugar macros start with `m4_', except `dnl' kept as is +# for sake of simplicity. +m4_pattern_forbid([^_?m4_]) +m4_pattern_forbid([^dnl$]) + +# If __m4_version__ is defined, we assume that we are being run by M4 +# 1.6 or newer, thus $@ recursion is linear, and debugmode(+do) +# is available for faster checks of dereferencing undefined macros +# and forcing dumpdef to print to stderr regardless of debugfile. +# But if it is missing, we assume we are being run by M4 1.4.x, that +# $@ recursion is quadratic, and that we need foreach-based +# replacement macros. Also, m4 prior to 1.4.8 loses track of location +# during m4wrap text; __line__ should never be 0. +# +# Use the raw builtin to avoid tripping up include tracing. +# Meanwhile, avoid m4_copy, since it temporarily undefines m4_defn. +m4_ifdef([__m4_version__], +[m4_debugmode([+do]) +m4_define([m4_defn], _m4_defn([_m4_defn])) +m4_define([m4_dumpdef], _m4_defn([_m4_dumpdef])) +m4_define([m4_popdef], _m4_defn([_m4_popdef])) +m4_define([m4_undefine], _m4_defn([_m4_undefine]))], +[m4_builtin([include], [m4sugar/foreach.m4]) +m4_wrap_lifo([m4_if(__line__, [0], [m4_pushdef([m4_location], +]]m4_dquote(m4_dquote(m4_dquote(__file__:__line__)))[[)])])]) + +# Rewrite the first entry of the diversion stack. +m4_divert([KILL]) + +# Check the divert push/pop perfect balance. +# Some users are prone to also use m4_wrap to register last-minute +# m4_divert_text; so after our diversion cleanups, we restore +# KILL as the bottom of the diversion stack. +m4_wrap([m4_popdef([_m4_divert_diversion])m4_ifdef( + [_m4_divert_diversion], [m4_fatal([$0: unbalanced m4_divert_push: +]m4_divert_stack)])_m4_popdef([_m4_divert_stack])m4_divert_push([KILL])]) + +T21,29 +m4_location(AS_ERROR)../../lib/m4sugar/m4sh.m4:883 +T11,162 +m4_dumpdefsm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_stack_foreach_lifo([$1], [m4_dumpdef([$1])m4_ignore])], + [m4_map_args([$0], $@)]) +T12,16 +m4_wrap_lifo_m4_wrap([$1[]]) +T10,103 +m4_flattenm4_if(m4_index([$1], [ +]), [-1], [[$1]], + [m4_translit(m4_bpatsubst([[[$1]]], [\\ +]), [ +], [ ])]) +T20,36 +_m4_set_intersectionm4_set_contains([$1], [$2], [,[$2]]) +T20,33 +_AS_REQUIRE_SHELL_FN +m4_n([$2])$1 () +{ +$3 +} @%:@ $1[] +T22,30 +m4_location(AS_TR_CPP)../../lib/m4sugar/m4sh.m4:1859 +T8,28 +_AS_CASE [@%:@(] + $1[)] : + $2 ;; +T19,29 +m4_location(AS_FOR)../../lib/m4sugar/m4sh.m4:607 +T9,156 +m4_escapem4_if(m4_index(m4_translit([$1], + [[]#,()][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789], [$$$]), [$]), + [-1], [m4_echo], [_$0])([$1]) +T17,478 +AS_INIT_GENERATED_m4_defun_pro([$0])m4_require([AS_PREPARE])m4_pushdef([AS_MESSAGE_LOG_FD])as_write_fail=0 +cat >$1 <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || as_write_fail=1 +_AS_SHELL_SANITIZE +_AS_PREPARE +m4_if(AS_MESSAGE_FD, [1], [], [exec AS_MESSAGE_FD>&1 +])m4_text_box([Main body of $1 script.]) +_ASEOF +test $as_write_fail = 0 && chmod +x $1[]dnl +_m4_popdef([AS_MESSAGE_LOG_FD])[]_m4_defun_epi([$0]) +T29,29 +m4_location(_AS_DIRNAME_EXPR)../../lib/m4sugar/m4sh.m4:975 +T12,24 +m4_rename_m4m4_rename([$1], [m4_$1]) +T30,29 +m4_location(_AS_UNSET_PREPARE)../../lib/m4sugar/m4sh.m4:657 +T20,111 +m4_stack_foreach_sep_m4_stack_reverse([$1], [m4_tmp-$1])_m4_stack_reverse([m4_tmp-$1], [$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]]) +T20,30 +m4_location(AS_ECHO)../../lib/m4sugar/m4sh.m4:1026 +T35,30 +m4_location(_AS_VAR_APPEND_PREPARE)../../lib/m4sugar/m4sh.m4:1906 +T19,156 +_m4_defun_pro_outerm4_set_delete([_m4_provide])m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])m4_pushdef([_m4_divert_dump], m4_divnum)m4_divert_push([GROW]) +T18,49 +AS_LITERAL_WORD_IF_AS_LITERAL_IF(m4_expand([$1]))([$4], [$3], [$2]) +T17,63 +m4_set_differencem4_if([$1], [$2], [], [m4_set_map_sep([$1], [_$0([$2],], [)])]) +T17,292 +_m4_require_checkm4_if(_m4_defn([_m4_diverting]), [$2], [m4_ignore], + m4_ifdef([_m4_diverting([$2])], [-]), [-], [m4_warn([syntax], + [$3: `$1' was expanded before it was required +http://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call], + [m4_ignore]) +T19,166 +m4_set_intersectionm4_if([$1], [$2], [m4_set_listc([$1])], + m4_eval(m4_set_size([$2]) < m4_set_size([$1])), [1], [$0([$2], [$1])], + [m4_set_map_sep([$1], [_$0([$2],], [)])]) +T19,147 +AS_REQUIRE_SHELL_FNm4_provide_if([AS_SHELL_FN_$1], [], +[AS_REQUIRE([AS_SHELL_FN_$1], +[m4_provide([AS_SHELL_FN_$1])_$0($@)], +m4_default_quoted([$4], [M4SH-INIT-FN]))]) +T13,47 +AS_LITERAL_IF_$0(m4_expand([$1]), [ ][ +])([$4], [$3], [$2]) +T21,101 +m4_stack_foreach_lifo_m4_stack_reverse([$1], [m4_tmp-$1], [$2(_m4_defn([m4_tmp-$1]))])_m4_stack_reverse([m4_tmp-$1], [$1]) +T11,33 +m4_set_listm4_set_map_sep([$1], [], [], [,]) +T32,29 +m4_location(_AS_DETECT_REQUIRED)../../lib/m4sugar/m4sh.m4:156 +T23,29 +m4_location(AS_PREPARE)../../lib/m4sugar/m4sh.m4:353 +T29,30 +m4_location(_AS_TEST_PREPARE)../../lib/m4sugar/m4sh.m4:1384 +F8,8 +__line____line__ +T13,41 +_m4_set_unionm4_ifdef([_m4_set([$1],$2)], [], [,[$2]]) +T17,1 +_m4_divert(BINSH)0 +T10,55 +_m4_shift2m4_if([$#], [2], [], + [, m4_shift(m4_shift($@))]) +T18,4 +m4_PACKAGE_VERSION2.69 +T10,65 +_m4_shift3m4_if([$#], [3], [], + [, m4_shift(m4_shift(m4_shift($@)))]) +T16,222 +_AS_BASENAME_SED_m4_defun_pro([$0])AS_ECHO([X/[]$1]) | + sed ['/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'][]_m4_defun_epi([$0]) +T13,383 +_AS_PATH_WALKas_save_IFS=$IFS; IFS=$PATH_SEPARATOR +m4_ifvaln([$3], [as_found=false])dnl +m4_bmatch([$1], [[:;]], +[as_dummy="$1" +for as_dir in $as_dummy], +[for as_dir in m4_default([$1], [$PATH])]) +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + m4_ifvaln([$3], [as_found=:])dnl + $2 + m4_ifvaln([$3], [as_found=false])dnl +done +m4_ifvaln([$3], [$as_found || { $3; }])dnl +IFS=$as_save_IFS +[] +T13,139 +_AS_PATH_WALK_m4_defun_pro([$0])AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T28,1 +_m4_divert(HEADER-COPYRIGHT)3 +T11,58 +_AS_CLEANUPm4_divert_text([M4SH-SANITIZE], [_AS_DETECT_BETTER_SHELL]) +T21,32 +AS_LITERAL_HEREDOC_IF_$0(m4_expand([$1]))([$2], [$3]) +T10,84 +_m4_minmaxm4_if([$#], [3], [$1([$2], [$3])], + [$0([$1], $1([$2], [$3]), m4_shift3($@))]) +T13,57 +AS_ME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_$0])[]_m4_defun_epi([$0]) +T11,238 +m4_text_boxm4_pushdef([m4_Border], + m4_translit(m4_format([[[%*s]]], m4_decr(m4_qlen(_m4_expand([$1 +]))), []), [ ], m4_default_quoted([$2], [-])))[##] _m4_defn([m4_Border]) [##] +[##] $1 [##] +[##] _m4_defn([m4_Border]) [##]_m4_popdef([m4_Border]) +T15,180 +m4_set_containsm4_ifdef([_m4_set_cleanup($1)], + [m4_if(m4_ifdef([_m4_set([$1],$2)], + [m4_indir([_m4_set([$1],$2)])], [0]), [1], [$3], [$4])], + [m4_ifdef([_m4_set([$1],$2)], [$3], [$4])]) +F10,7 +m4_esyscmdesyscmd +T9,22 +AS_TR_CPP_$0(m4_expand([$1]))[] +T9,124 +AS_TR_CPP_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,32 +m4_set_mapm4_set_map_sep([$1], [$2(], [)]) +T14,53 +m4_cr_symbols1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ +T14,181 +_AS_LITERAL_IFm4_if(m4_index([$1], [@S|@]), [-1], [$0_(m4_translit([$1], + [-:=%/@{}[]#(),.$2]][[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]][, + [++++++$$`````]))], [$0_NO]) +T14,63 +m4_cr_symbols2abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 +T13,116 +_AS_BOX_INDIRsed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ $1 @%:@@%:@ +_ASBOX +T12,18 +m4_errprintnm4_errprint([$1 +]) +T13,306 +m4_bpatsubstsm4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2]))], + [$#], 3, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2], [$3]))], + [_$0($@m4_if(m4_eval($# & 1), 0, [,]))]) +T23,29 +m4_location(AS_MESSAGE)../../lib/m4sugar/m4sh.m4:834 +F7,4 +m4_decrdecr +T12,93 +m4_text_wrap_$0(m4_escape([$1]), [$2], m4_default_quoted([$3], [$2]), + m4_default_quoted([$4], [79])) +T12,93 +m4_set_emptym4_ifdef([_m4_set_size($1)], + [m4_if(m4_indir([_m4_set_size($1)]), [0], [$2], [$3])], [$2]) +T15,36 +m4_set_contentsm4_set_map_sep([$1], [], [], [[$2]]) +T32,30 +m4_location(_AS_DIRNAME_PREPARE)../../lib/m4sugar/m4sh.m4:1011 +T15,55 +_AS_TR_SH_INDIR`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_sh` +T20,29 +m4_location(AS_CASE)../../lib/m4sugar/m4sh.m4:550 +T10,168 +m4_combinem4_if([$2], [], [], m4_eval([$# > 3]), [1], +[m4_map_args_sep([m4_map_args_sep(m4_dquote(], [)[[$3]], [], [[$1]],]]m4_dquote(m4_dquote(m4_shift3($@)))[[)], [[$1]], $2)]) +T9,339 +AS_VAR_IFAS_LITERAL_WORD_IF([$1], + [AS_IF(m4_ifval([$2], [[test "x$$1" = x[]$2]], [[${$1:+false} :]])], + [AS_VAR_COPY([as_val], [$1]) + AS_IF(m4_ifval([$2], [[test "x$as_val" = x[]$2]], [[${as_val:+false} :]])], + [AS_IF(m4_ifval([$2], + [[eval test \"x\$"$1"\" = x"_AS_ESCAPE([$2], [`], [\"$])"]], + [[eval \${$1:+false} :]])]), +[$3], [$4]) +T18,202 +m4_cr_not_symbols1 +  !"#*%&'()$+,./0123456789:;<=>?@[\]^`{|}~- +T18,192 +m4_cr_not_symbols2 +  !"#*%&'()$+,./:;<=>?@[\]^`{|}~- +T23,30 +m4_location(AS_DIRNAME)../../lib/m4sugar/m4sh.m4:1002 +F12,8 +m4_bpatsubstpatsubst +T31,29 +m4_location(_AS_SHELL_SANITIZE)../../lib/m4sugar/m4sh.m4:451 +T7,2 +m4_echo$@ +T20,1 +AS_ORIGINAL_STDIN_FD0 +T25,111 +m4_stack_foreach_sep_lifo_m4_stack_reverse([$1], [m4_tmp-$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]])_m4_stack_reverse([m4_tmp-$1], [$1]) +T14,102 +_AS_ME_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_BASENAME_PREPARE])as_me=`AS_BASENAME("$[0]")` +[]_m4_defun_epi([$0]) +T26,30 +m4_location(_AS_PATH_WALK)../../lib/m4sugar/m4sh.m4:1339 +T7,91 +m4_argnm4_assert([0 < $1])m4_pushdef([_$0], [_m4_popdef([_$0])]m4_dquote([$]m4_incr([$1])))_$0($@) +T29,30 +m4_location(_AS_ECHO_PREPARE)../../lib/m4sugar/m4sh.m4:1044 +T8,27 +m4_ifvalm4_if([$1], [], [$3], [$2]) +T7,197 +m4_copym4_ifdef([$2], [m4_fatal([$0: won't overwrite defined macro: $2])], + [m4_stack_foreach_sep([$1], [m4_pushdef([$2],], [)])])m4_ifdef([m4_location($1)], [m4_define([m4_location($2)], m4_location)]) +T11,31 +_AS_IF_ELSEm4_ifnblank([$1], +[else + $1 +]) +T26,292 +_AS_PATH_SEPARATOR_PREPARE_m4_defun_pro([$0])# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi +[]_m4_defun_epi([$0]) +T14,113 +m4_expand_oncem4_provide_if(m4_default_quoted([$2], [$1]), + [], + [m4_provide(m4_default_quoted([$2], [$1]))[]$1]) +T14,96 +_m4_bpatsubstsm4_if([$#], 2, [$1], + [$0(m4_builtin([patsubst], [[$1]], [$2], [$3]), + m4_shift3($@))]) +T13,41 +m4_provide_ifm4_ifdef([m4_provide($1)], + [$2], [$3]) +T16,838 +_AS_LN_S_PREPARE_m4_defun_pro([$0])rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null +[]_m4_defun_epi([$0]) +T8,1075 +AS_UNAME{ +cat <<_ASUNAME +m4_text_box([Platform.]) + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +_AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])]) +} +T7,16 +AS_LN_S$as_ln_s $1 $2[] +T7,129 +AS_LN_S_m4_defun_pro([$0])AS_REQUIRE([_AS_LN_S_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T18,207 +_AS_TR_CPP_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_CR_PREPARE])# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'" +[]_m4_defun_epi([$0]) +T9,75 +AS_ESCAPE_$0([$1], m4_if([$2], [], [[`], [\"$]], [m4_substr([$2], [0], [1]), [$2]])) +T20,4 +_m4_divert_diversionKILL +T24,29 +m4_location(_AS_PREPARE)../../lib/m4sugar/m4sh.m4:322 +T22,30 +m4_location(AS_ECHO_N)../../lib/m4sugar/m4sh.m4:1034 +T30,30 +m4_location(_AS_TR_SH_PREPARE)../../lib/m4sugar/m4sh.m4:1805 +T23,30 +m4_location(AS_MKDIR_P)../../lib/m4sugar/m4sh.m4:1289 +F12,8 +_m4_undivertundivert +T7,54 +_m4_cdrm4_if([$#], 1, [], + [, m4_dquote(m4_shift($@))]) +T10,86 +m4_toupperm4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ]) +T8,19 +m4_curry$1(m4_shift($@,)_$0 +T16,56 +_AS_TR_CPP_INDIR`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_cpp` +T17,28 +m4_default_nblankm4_ifblank([$1], [$2], [$1]) +T28,29 +m4_location(_AS_DIRNAME_SED)../../lib/m4sugar/m4sh.m4:982 +T18,540 +_AS_TR_CPP_LITERALm4_translit([[$1]], + [*[]][abcdefghijklmnopqrstuvwxyz +  !"#*%&'()$+,./:;<=>?@[\]^`{|}~-], + [P[]][ABCDEFGHIJKLMNOPQRSTUVWXYZ_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________]) +T12,48 +m4_re_escapem4_bpatsubst([$1], + [[][*+.?\^$]], [\\\&]) +T12,26 +m4_normalizem4_strip(m4_flatten([$1])) +T18,40 +_m4_set_differencem4_set_contains([$1], [$2], [], [,[$2]]) +F3,3 +dnldnl +T27,2052 +_AS_VERSION_COMPARE_PREPARE_m4_defun_pro([$0])[as_awk_strverscmp=' + # Use only awk features that work with 7th edition Unix awk (1978). + # My, what an old awk you have, Mr. Solaris! + END { + while (length(v1) && length(v2)) { + # Set d1 to be the next thing to compare from v1, and likewise for d2. + # Normally this is a single character, but if v1 and v2 contain digits, + # compare them as integers and fractions as strverscmp does. + if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { + # Split v1 and v2 into their leading digit string components d1 and d2, + # and advance v1 and v2 past the leading digit strings. + for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue + for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue + d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) + d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) + if (d1 ~ /^0/) { + if (d2 ~ /^0/) { + # Compare two fractions. + while (d1 ~ /^0/ && d2 ~ /^0/) { + d1 = substr(d1, 2); len1-- + d2 = substr(d2, 2); len2-- + } + if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { + # The two components differ in length, and the common prefix + # contains only leading zeros. Consider the longer to be less. + d1 = -len1 + d2 = -len2 + } else { + # Otherwise, compare as strings. + d1 = "x" d1 + d2 = "x" d2 + } + } else { + # A fraction is less than an integer. + exit 1 + } + } else { + if (d2 ~ /^0/) { + # An integer is greater than a fraction. + exit 2 + } else { + # Compare two integers. + d1 += 0 + d2 += 0 + } + } + } else { + # The normal case, without worrying about digits. + d1 = substr(v1, 1, 1); v1 = substr(v1, 2) + d2 = substr(v2, 1, 1); v2 = substr(v2, 2) + } + if (d1 < d2) exit 1 + if (d1 > d2) exit 2 + } + # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10), + # which mishandles some comparisons of empty strings to integers. + if (length(v2)) exit 1 + if (length(v1)) exit 2 + } +'][]_m4_defun_epi([$0]) +T14,116 +AS_LINENO_PUSH_m4_defun_pro([$0])as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack[]_m4_defun_epi([$0]) +F12,8 +_m4_undefineundefine +T10,79 +_m4_shiftnm4_if([$1], 1, [m4_shift(], + [$0(m4_decr([$1])]), m4_shift(m4_shift($@))) +T20,170 +_m4_version_unletterm4_bpatsubst(m4_bpatsubst(m4_translit([[[[0,$1]]]], [.-], [,,]),[[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]][+], + [+1,-1,[0r36:\&]]), [,0], [,[0r10:0]]) +T7,676 +AS_INIT# Wrap our cleanup prior to m4sugar's cleanup. +m4_wrap([_AS_CLEANUP]) +m4_init +m4_provide([AS_INIT]) + +# Forbidden tokens and exceptions. +m4_pattern_forbid([^_?AS_]) + +# Bangshe and minimal initialization. +m4_divert_text([BINSH], [@%:@! /bin/sh]) +m4_divert_text([HEADER-COMMENT], + [@%:@ Generated from __file__ by m4_PACKAGE_STRING.]) +m4_divert_text([M4SH-SANITIZE], [_AS_SHELL_SANITIZE]) +m4_divert_text([M4SH-INIT-FN], [m4_text_box([M4sh Shell Functions.])]) + +# Let's go! +m4_divert([BODY])dnl +m4_text_box([Main body of script.]) +_AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl +_AS_DETECT_REQUIRED([_AS_TEST_X_WORKS])dnl +AS_REQUIRE([_AS_UNSET_PREPARE], [], [M4SH-INIT-FN])dnl + +T11,136 +m4_undivertm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [_m4_undivert(_m4_divert([$1]))], + [m4_map_args([$0], $@)]) +T15,76 +_AS_BOX_LITERALAS_ECHO(["_AS_ESCAPE(m4_dquote(m4_expand([m4_text_box($@)])), [`], [\"$])"]) +T10,412 +m4_requirem4_ifdef([_m4_expanding($1)], + [m4_fatal([$0: circular dependency of $1])])m4_if(_m4_divert_dump, [], + [m4_fatal([$0($1): cannot be used outside of an ]dnl +m4_if([$0], [m4_require], [[m4_defun]], [[AC_DEFUN]])['d macro])])m4_provide_if([$1], [m4_set_contains([_m4_provide], [$1], + [_m4_require_check([$1], _m4_defn([m4_provide($1)]), [$0])], [m4_ignore])], + [_m4_require_call])([$1], [$2], _m4_divert_dump) +T7,119 +m4_casem4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + [$1], [$2], [$3], + [$0([$1], m4_shift3($@))]) +T11,55 +m4_sincludem4_include_unique([$1])dnl +m4_builtin([sinclude], [$1]) +T25,2 +_AS_LITERAL_HEREDOC_IF_NO$2 +T9,255 +m4_cr_all +  !"#*%&'()$+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T19,62 +m4_version_unletterm4_substr(m4_map_args([.m4_eval], m4_unquote(_$0([$1]))), [3]) +T17,32 +m4_define_defaultm4_ifndef([$1], [m4_define($@)]) +T21,696 +_AS_REEXEC_WITH_SHELL_m4_defun_pro([$0])dnl +# We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in @%:@ (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $1 $as_opts "$as_myself" ${1+"$[@]"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +AS_ECHO(["$[]0: could not re-execute with $1"]) >&2 +AS_EXIT([255])[]_m4_defun_epi([$0]) +T11,160 +m4_undefinem4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_undefine([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T15,12 +m4_PACKAGE_NAMEGNU Autoconf +F10,7 +m4_builtinbuiltin +T10,266 +AS_REQUIRE_m4_defun_pro([$0])m4_define([_m4_divert_desired], [m4_default_quoted([$3], [M4SH-INIT])])m4_if(m4_eval(_m4_divert_dump - 0 <= _m4_divert(_m4_divert_desired, [-])), + 1, [m4_require(], + [m4_divert_require(_m4_divert_desired,]) [$1], [$2])[]_m4_defun_epi([$0]) +T14,44 +m4_divert_oncem4_expand_once([m4_divert_text([$1], [$2])]) +T11,146 +_m4_expand_m4_if([$4], [}>=-], + [m4_changequote([-=<{$2], [)}>=-])$3m4_changequote([, ])], + [$0([$1], [($2], -=<{($2$1)}>=-, [}>=-])m4_ignore$2]) +T29,29 +m4_location(_AS_BASENAME_SED)../../lib/m4sugar/m4sh.m4:926 +T17,64 +_m4_divert_unsafem4_fatal([$0: cannot change diversion to `$1' inside m4_expand]) +T8,99 +_m4_condm4_if(($1), [($2)], [$3], + [$#], [3], [], + [$#], [4], [$4], + [$0(m4_shift3($@))]) +T16,0 +m4_pattern_allow +T17,253 +m4_divert_requirem4_ifdef([_m4_expanding($2)], + [m4_fatal([$0: circular dependency of $2])])m4_if(_m4_divert_dump, [], + [m4_fatal([$0($2): cannot be used outside of an m4_defun'd macro])])m4_provide_if([$2], [], + [_m4_require_call([$2], [$3], _m4_divert([$1], [-]))]) +F9,6 +m4_sysvalsysval +T13,91 +AS_SET_STATUS_m4_defun_pro([$0])AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_set_status $1[]_m4_defun_epi([$0]) +T22,527 +_AS_VAR_APPEND_PREPARE_m4_defun_pro([$0])AS_FUNCTION_DESCRIBE([as_fn_append], [VAR VALUE], +[Append the text in VALUE to the end of the definition contained in +VAR. Take advantage of any shell optimizations that allow amortized +linear growth over repeated appends, instead of the typical quadratic +growth present in naive implementations.]) +AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_APPEND_WORKS))"])], +[eval 'as_fn_append () + { + eval $[]1+=\$[]2 + }'], +[as_fn_append () + { + eval $[]1=\$$[]1\$[]2 + }]) # as_fn_append +[]_m4_defun_epi([$0]) +T17,0 +m4_pattern_forbid +T9,69 +m4_assertm4_if(m4_eval([$1]), 0, + [m4_fatal([assert failed: $1], [$2])]) +F10,7 +m4_pushdefpushdef +T20,53 +m4_divert_stack_pushm4_pushdef([_m4_divert_stack], m4_location[: $1: $2]) +T17,105 +_m4_define_cr_notm4_define([m4_cr_not_$1], + m4_translit(m4_dquote(m4_defn([m4_cr_all])), + m4_defn([m4_cr_$1]))) +T19,21 +_AS_VAR_ARITH_WORKStest $(( 1 + 1 )) = 2 +T23,39 +m4_expansion_stack_pushm4_pushdef([_m4_expansion_stack], [$1]) +T14,199 +AS_SET_CATFILEcase $2 in @%:@(( +.) AS_VAR_SET([$1], [$3]);; +*) + case $3 in @%:@((( + .) AS_VAR_SET([$1], [$2]);; + [[\\/]]* | ?:[[\\/]]* ) AS_VAR_SET([$1], [$3]);; + *) AS_VAR_SET([$1], [$2/$3]);; + esac;; +esac[] +T34,30 +m4_location(_AS_VAR_ARITH_PREPARE)../../lib/m4sugar/m4sh.m4:1948 +T13,26 +m4_cr_lettersabcdefghijklmnopqrstuvwxyz +T7,13 +AS_ECHO$as_echo $1[] +T7,124 +AS_ECHO_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,36 +_m4_expand$0_([$1], [(], -=<{($1)}>=-, [}>=-]) +T26,104 +_AS_DETECT_SUGGESTED_PRUNEm4_set_contains([_AS_DETECT_REQUIRED_BODY], [$1], + [m4_set_remove([_AS_DETECT_SUGGESTED_BODY], [$1])]) +T11,149 +m4_map_argsm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [$#], [2], [$1([$2])[]], + [_m4_foreach([$1(], [)], $@)]) +T19,288 +_m4_set_contents_1cm4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [m4_pushdef([_m4_set_($1)], _m4_defn([_m4_set([$1])]))], + [_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)])])_m4_popdef([_m4_set([$1])])$0([$1])], + [_m4_popdef([_m4_set_cleanup($1)])]) +T7,65 +_m4_minm4_eval((([$1]) < ([$2])) * ([$1]) + (([$1]) >= ([$2])) * ([$2])) +T14,180 +AS_HELP_STRINGm4_text_wrap([$2], m4_cond([[$3]], [], [ ], + [m4_eval([$3]+0)], [0], [[$3]], + [m4_format([[%*s]], [$3], [])]), + m4_expand([ $1 ]), [$4]) +F8,5 +m4_shiftshift +T16,452 +_m4_require_callm4_pushdef([_m4_divert_grow], m4_decr(_m4_divert_grow))m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])m4_divert_push(_m4_divert_grow, [-])m4_if([$2], [], [$1], [$2]) +m4_provide_if([$1], [m4_set_remove([_m4_provide], [$1])], + [m4_warn([syntax], [$1 is m4_require'd but not m4_defun'd])])_m4_divert_raw($3)_m4_undivert(_m4_divert_grow)m4_divert_pop(_m4_divert_grow)_m4_popdef([_m4_divert_grow], +[_m4_diverting([$1])], [_m4_diverting]) +T11,70 +_m4_foreachm4_if([$#], [3], [], + [$1[$4]$2[]$0([$1], [$2], m4_shift3($@))]) +T7,65 +_m4_maxm4_eval((([$1]) > ([$2])) * ([$1]) + (([$1]) <= ([$2])) * ([$2])) +F8,8 +__file____file__ +T18,2 +_AS_LITERAL_IF_YES$3 +F10,6 +m4_bregexpregexp +T14,103 +_AS_TR_PREPARE_m4_defun_pro([$0])AS_REQUIRE([_AS_TR_SH_PREPARE])AS_REQUIRE([_AS_TR_CPP_PREPARE])[]_m4_defun_epi([$0]) +T12,47 +AS_VAR_ARITHas_fn_arith $2 && AS_VAR_SET([$1], [$as_val])[] +T12,197 +AS_VAR_ARITH_m4_defun_pro([$0])_AS_DETECT_SUGGESTED([_AS_VAR_ARITH_WORKS])AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T10,82 +AS_DIRNAME$as_dirname -- $1 || +_AS_DIRNAME_EXPR([$1]) 2>/dev/null || +_AS_DIRNAME_SED([$1])[] +T10,124 +AS_DIRNAME_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T33,29 +m4_location(_AS_BASENAME_PREPARE)../../lib/m4sugar/m4sh.m4:954 +T13,42 +m4_mapall_sepm4_if([$3], [], [], [_$0([$1], [$2], $3)]) +T9,26 +m4_ifndefm4_ifdef([$1], [$3], [$2]) +T18,144 +AS_VERSION_COMPAREas_arg_v1=$1 +as_arg_v2=$2 +awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null +AS_CASE([$?], + [1], [$3], + [0], [$4], + [2], [$5])[] +T18,124 +AS_VERSION_COMPARE_m4_defun_pro([$0])AS_REQUIRE([_$0_PREPARE])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T13,47 +m4_copy_forcem4_ifdef([$2], [_m4_undefine([$2])])m4_copy($@) +T7,108 +m4_joinm4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift2($@))]) +T23,3173 +_AS_DETECT_BETTER_SHELL_m4_defun_pro([$0])m4_if(_AS_FORCE_REEXEC_WITH_CONFIG_SHELL, [yes], + [# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL]) + fi + # We don't want this to propagate to other subprocesses. + dnl This might be especially important in case an m4sh-generated script + dnl is used to later execute other m4sh-generated scripts. This happens + dnl for example in autoconf's own testsuite (and happens *a lot* there, + dnl in fact). + AS_UNSET([_as_can_reexec]) +])m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="AS_ESCAPE(_m4_expand([_AS_BOURNE_COMPATIBLE]))" + _AS_DETECT_EXPAND([as_required], [_AS_DETECT_REQUIRED_BODY]) + _AS_DETECT_EXPAND([as_suggested], [_AS_DETECT_SUGGESTED_BODY]) + AS_IF([_AS_RUN(["$as_required"])], + [as_have_required=yes], + [as_have_required=no]) + AS_IF([test x$as_have_required = xyes && _AS_RUN(["$as_suggested"])], + [], + [_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH], + [case $as_dir in @%:@( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } && + _AS_RUN(["$as_required"], ["$as_shell"])], + [CONFIG_SHELL=$as_shell as_have_required=yes + m4_set_empty([_AS_DETECT_SUGGESTED_BODY], [break 2], + [AS_IF([_AS_RUN(["$as_suggested"], ["$as_shell"])], + [break 2])])]) + done;; + esac], + [AS_IF([{ test -f "$SHELL" || test -f "$SHELL.exe"; } && + _AS_RUN(["$as_required"], ["$SHELL"])], + [CONFIG_SHELL=$SHELL as_have_required=yes])]) + + AS_IF([test "x$CONFIG_SHELL" != x], + [export CONFIG_SHELL + _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL])]) + +dnl Unfortunately, $as_me isn't available here. + AS_IF([test x$as_have_required = xno], + [AS_ECHO(["$[]0: This script requires a shell more modern than all"]) + AS_ECHO(["$[]0: the shells that I found on your system."]) + if test x${ZSH_VERSION+set} = xset ; then + AS_ECHO(["$[]0: In particular, zsh $ZSH_VERSION has bugs and should"]) + AS_ECHO(["$[]0: be upgraded to zsh 4.3.4 or later."]) + else + AS_ECHO("m4_text_wrap([Please tell ]_m4_defn([m4_PACKAGE_BUGREPORT]) +m4_ifset([AC_PACKAGE_BUGREPORT], [m4_if(_m4_defn([m4_PACKAGE_BUGREPORT]), +_m4_defn([AC_PACKAGE_BUGREPORT]), [], [and _m4_defn([AC_PACKAGE_BUGREPORT])])]) +[about your system, including any error possibly output before this message. +Then install a modern shell, or manually run the script under such a +shell if you do have one.], [$[]0: ], [], [62])") + fi + AS_EXIT])]) +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +_m4_popdef([AS_EXIT])[]_m4_defun_epi([$0]) +T26,30 +m4_location(AS_ME_PREPARE)../../lib/m4sugar/m4sh.m4:1121 +F7,6 +m4_exitm4exit +T12,83 +m4_set_unionm4_set_listc([$1])m4_if([$1], [$2], [], + [m4_set_map_sep([$2], [_$0([$1],], [)])]) +T20,73 +AS_BOURNE_COMPATIBLE# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +_$0 + +T16,2 +_m4_divert(KILL)-1 +T10,100 +m4_foreachm4_if([$2], [], [], + [m4_pushdef([$1])_$0([m4_define([$1],], [)$3], [], + $2)m4_popdef([$1])]) +T9,265 +_AS_QUOTEm4_cond([m4_index([$1], [\])], [-1], [_AS_QUOTE_MODERN], + [m4_eval(m4_index(m4_translit([[$1]], [$], [\]), [\\]) >= 0)], +[1], [_AS_QUOTE_MODERN], + [m4_eval(m4_index(m4_translit([[$1]], ["], [`]), [\`]) >= 0)],dnl" +[1], [_AS_QUOTE_OLD], + [_AS_QUOTE_MODERN])([$1]) +F11,8 +m4_traceofftraceoff +T8,33 +m4_applym4_if([$2], [], [$1], [$1($2)])[] +T30,0 +m4_include(m4sugar/version.m4) +T26,30 +m4_location(AS_VAR_APPEND)../../lib/m4sugar/m4sh.m4:1939 +T14,73 +_m4_mapall_sepm4_apply([$1], [$3])_m4_foreach([m4_apply([$2[]$1],], [)], m4_shift2($@)) +T9,132 +m4_divertm4_popdef([_m4_divert_stack])m4_define([_m4_divert_diversion], [$1])m4_divert_stack_push([$0], [$1])_m4_divert_raw(_m4_divert([$1])) +F10,7 +m4_traceontraceon +T13,52 +m4_cr_LettersabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ +T7,146 +AS_CASE_m4_defun_pro([$0])case $1 in[]m4_map_args_pair([_$0], [_$0_DEFAULT], + m4_shift($@m4_if(m4_eval([$# & 1]), [1], [,]))) +esac[]_m4_defun_epi([$0]) +T9,75 +m4_beforem4_provide_if([$2], + [m4_warn([syntax], [$2 was called before $1])]) +T10,143 +m4_map_sepm4_pushdef([m4_Sep], [m4_define([m4_Sep], _m4_defn([m4_unquote]))])_m4_foreach([_m4_apply([m4_Sep([$2])[]$1],], [)], [], $3)m4_popdef([m4_Sep]) +T12,55 +m4_copy_unm4m4_copy([$1], m4_bpatsubst([$1], [^m4_\(.*\)], [[\1]])) +T10,86 +m4_tolowerm4_translit([[$1]], [ABCDEFGHIJKLMNOPQRSTUVWXYZ], + [abcdefghijklmnopqrstuvwxyz]) +T7,93 +_AS_BOXm4_if(m4_index(m4_translit([[$1]], [`\"], [$$$]), [$]), + [-1], [$0_LITERAL], [$0_INDIR])($@) +T8,189 +_m4_wrapm4_ifdef([$0_text], + [m4_define([$0_text], [$1]_m4_defn([$0_text])[$2])], + [m4_builtin([m4wrap], [m4_unquote( + _m4_defn([$0_text])_m4_popdef([$0_text]))])m4_define([$0_text], [$1$2])]) +F9,6 +m4_definedefine +T10,27 +m4_defaultm4_if([$1], [], [$2], [$1]) +T9,5 +_m4_curry[$1]) +T13,20 +AS_VAR_APPENDas_fn_append $1 $2[] +T13,155 +AS_VAR_APPEND_m4_defun_pro([$0])AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])[]_m4_popdef([$0])m4_indir([$0]m4_if([$#], [0], [], [,$@]))[]_m4_defun_epi([$0]) +T29,30 +m4_location(_AS_EXPR_PREPARE)../../lib/m4sugar/m4sh.m4:1108 +T8,198 +_m4_qlenm4_define([m4_qlen-$1], +m4_if(m4_index([$1], [@]), [-1], [m4_len([$1])], + [m4_len(m4_bpatsubst([[$1]], + [@\(\(<:\|:>\|S|\|%:\|\{:\|:\}\)\(@\)\|&t@\)], + [\3]))]))_m4_defn([m4_qlen-$1]) +T10,72 +m4_reversem4_if([$#], [0], [], [$#], [1], [[$1]], + [$0(m4_shift($@)), [$1]]) +T13,1 +AS_MESSAGE_FD1 +T40,30 +m4_location(_AS_VERSION_COMPARE_PREPARE)../../lib/m4sugar/m4sh.m4:1697 +T30,30 +m4_location(AS_LINENO_PREPARE)../../lib/m4sugar/m4sh.m4:1166 +T10,294 +_m4_escapem4_changequote([-=<{(],[)}>=-])m4_bpatsubst(m4_bpatsubst(m4_bpatsubst(m4_bpatsubst( + -=<{(-=<{(-=<{(-=<{(-=<{($1)}>=-)}>=-)}>=-)}>=-)}>=-, + -=<{(#)}>=-, -=<{(@%:@)}>=-), + -=<{(\[)}>=-, -=<{(@<:@)}>=-), + -=<{(\])}>=-, -=<{(@:>@)}>=-), + -=<{(\$)}>=-, -=<{(@S|@)}>=-)m4_changequote([,]) +T16,55 +_m4_divert_stack../../lib/m4sugar/m4sugar.m4:3259: m4_divert_push: KILL +T11,54 +AS_VAR_COPYAS_LITERAL_WORD_IF([$1[]$2], [$1=$$2], [eval $1=\$$2]) +T17,229 +m4_cr_not_letters +  !"#*%&'()$+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~- +T17,117 +m4_include_uniquem4_ifdef([m4_include($1)], + [m4_warn([syntax], [file `$1' included several times])])dnl +m4_define([m4_include($1)]) +T8,77 +m4_stripm4_bpatsubsts([$1 ], + [[ ]+], [ ], + [^. ?\(.*\) .$], [[[\1]]]) +T9,4 +m4_dquote[$@] +D-1,0 + +# End of frozen state file diff --git a/externals/autotools/share/autoconf/m4sugar/m4sugar.m4f b/externals/autotools/share/autoconf/m4sugar/m4sugar.m4f new file mode 100644 index 000000000000..a1b10825025a --- /dev/null +++ b/externals/autotools/share/autoconf/m4sugar/m4sugar.m4f @@ -0,0 +1,864 @@ +# This is a frozen state file generated by GNU M4 1.4.18 +V1 +Q1,1 +[] +T12,69 +_m4_list_cmpm4_if([$1], [], [0m4_ignore], [$2], [0], [m4_unquote], [$2m4_ignore]) +F12,9 +m4_debugfiledebugfile +T8,0 +_m4_warn +T15,218 +m4_map_args_sepm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [$#], [2], [], + [$#], [3], [], + [$#], [4], [$1[$4]$2[]], + [$1[$4]$2[]_m4_foreach([$3[]$1], [$2], m4_shift3($@))]) +T8,150 +m4_defunm4_define([m4_location($1)], m4_location)m4_default([$3], [m4_define])([$1], + [_m4_defun_pro(]m4_dquote($[0])[)$2[]_m4_defun_epi(]m4_dquote($[0])[)]) +T18,50 +_m4_set_contents_1_m4_stack_reverse([_m4_set([$1])], [_m4_set_($1)]) +T18,94 +_m4_set_contents_2_m4_stack_reverse([_m4_set_($1)], [_m4_set([$1])], + [$2[]_m4_defn([_m4_set_($1)])$3], [$4[]]) +T8,81 +m4_chompm4_format([[%.*s]], m4_index(m4_translit([[$1]], [ +/.], [/ ])[./.], [/.]), [$1]) +T13,82 +m4_dquote_eltm4_if([$#], [0], [], + [$#], [1], [[[$1]]], + [[[$1]],$0(m4_shift($@))]) +T24,32 +m4_default_nblank_quotedm4_ifblank([$1], [[$2]], [[$1]]) +T9,57 +m4_appendm4_define([$1], m4_ifdef([$1], [_m4_defn([$1])[$3]])[$2]) +T11,37 +m4_list_cmp_$0_raw(m4_dquote($1), m4_dquote($2)) +T7,84 +_m4_for$4[$1]$5[]m4_if([$1], [$2], [], + [$0(m4_eval([$1 + $3]), [$2], [$3], [$4], [$5])]) +T12,78 +m4_foreach_wm4_pushdef([$1])m4_map_args_w([$2], + [m4_define([$1],], [)$3])m4_popdef([$1]) +T11,165 +_m4_dumpdefm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_builtin([dumpdef], [$1])], + [m4_map_args_sep([m4_builtin([dumpdef],], [)], [], $@)]) +T14,131 +m4_set_add_allm4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1]) + + m4_len(m4_ifdef([_m4_set_cleanup($1)], [_$0_check], [_$0])([$1], $@)))) +F7,4 +m4_incrincr +F8,4 +_m4_defndefn +T13,124 +_m4_defun_prom4_ifdef([_m4_expansion_stack], [], [_m4_defun_pro_outer([$1])])m4_expansion_stack_push([$1])m4_pushdef([_m4_expanding($1)]) +T13,175 +m4_defun_initm4_define([$1], [$3[]])m4_defun([$1], + [$2[]_m4_popdef(]m4_dquote($[0])[)m4_indir(]m4_dquote($[0])dnl +[m4_if(]m4_dquote($[#])[, [0], [], ]m4_dquote([,$]@)[))], [m4_pushdef]) +T21,97 +m4_copyright_condensem4_text_wrap(m4_bpatsubst(m4_flatten([[$1]]), +[(C)[- ,0-9]*\([1-9][0-9][0-9][0-9]\)], [(C) \1])) +T17,203 +m4_cr_not_Letters +  !"#*%&'()$+,./0123456789:;<=>?@[\]^_`{|}~- +T12,66 +m4_re_string[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]* +T16,5 +_m4_divert(GROW)10000 +T18,72 +m4_version_compare_m4_list_cmp_raw(_m4_version_unletter([$1]), _m4_version_unletter([$2])) +T15,165 +_m4_set_add_allm4_if([$#], [2], [], + [m4_ifdef([_m4_set([$1],$3)], [], + [m4_define([_m4_set([$1],$3)], [1])m4_pushdef([_m4_set([$1])], + [$3])-])$0([$1], m4_shift2($@))]) +T8,4 +m4_quote[$*] +T15,4 +m4_PACKAGE_YEAR2012 +T10,211 +m4_dumpdefm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_ifdef([$1], [m4_errprintn( + [$1: ]m4_dquote(_m4_defn([$1])))], [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T15,193 +m4_cr_not_alnum +  !"#*%&'()$+,./:;<=>?@[\]^_`{|}~- +F6,3 +m4_lenlen +T14,42 +m4_divert_textm4_divert_push([$1])$2 +m4_divert_pop([$1]) +F12,9 +m4_debugmodedebugmode +T10,280 +m4_set_addm4_ifdef([_m4_set([$1],$2)], + [m4_if(m4_indir([_m4_set([$1],$2)]), [0], + [m4_define([_m4_set([$1],$2)], + [1])_m4_set_size([$1], [m4_incr])$3], [$4])], + [m4_define([_m4_set([$1],$2)], + [1])m4_pushdef([_m4_set([$1])], + [$2])_m4_set_size([$1], [m4_incr])$3]) +T14,122 +m4_append_uniqm4_ifval([$3], [m4_if(m4_index([$2], [$3]), [-1], [], + [m4_warn([syntax], + [$0: `$2' contains `$3'])])])_$0($@) +T15,0 +_m4_divert_dump +T20,20 +m4_PACKAGE_BUGREPORTbug-autoconf@gnu.org +T8,66 +m4_ifsetm4_ifdef([$1], + [m4_ifval(_m4_defn([$1]), [$2], [$3])], + [$3]) +T7,182 +m4_condm4_if([$#], [0], [m4_fatal([$0: cannot be called without arguments])], + [$#], [1], [$1], + m4_eval([$# % 3]), [2], [m4_fatal([$0: missing an argument])], + [_$0($@)]) +T12,30 +m4_esyscmd_sm4_chomp_all(m4_esyscmd([$1])) +T15,148 +_m4_append_uniqm4_ifdef([$1], + [m4_if(m4_index([$3]_m4_defn([$1])[$3], [$3$2$3]), [-1], + [m4_append([$1], [$2], [$3])$4], [$5])], + [m4_define([$1], [$2])$4]) +T9,31 +_m4_applym4_if([$2], [], [], [$1($2)[]]) +T10,2 +m4_unquote$* +T9,72 +m4_mapallm4_if([$2], [], [], + [_m4_foreach([m4_apply([$1],], [)], [], $2)]) +F14,6 +_m4_divert_rawdivert +T6,122 +m4_cdrm4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))]) +T14,41 +_m4_list_cmp_1_m4_list_cmp_2([$2], [m4_shift2($@)], $1) +T14,95 +_m4_list_cmp_2_m4_list_cmp([$1$3], m4_cmp([$3+0], [$1+0]))( + [_m4_list_cmp_1(m4_dquote(m4_shift3($@)), $2)]) +T11,53 +_m4_joinallm4_if([$#], [2], [], [[$1$3]$0([$1], m4_shift2($@))]) +T9,158 +m4_popdefm4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_popdef([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T12,152 +_m4_set_dumpm4_ifdef([_m4_set([$1])], + [[$2]_m4_defn([_m4_set([$1])])_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)], [_m4_set([$1])])$0([$1], [$2$3])]) +T12,32 +m4_make_listm4_join([, +], m4_dquote_elt($@)) +T5,73 +m4_dom4_if([$#], 0, [], + [$#], 1, [$1[]], + [$1[]$0(m4_shift($@))]) +F9,6 +m4_substrsubstr +T18,8 +m4_PACKAGE_TARNAMEautoconf +T13,252 +m4_set_removem4_set_contains([$1], [$2], [_m4_set_size([$1], + [m4_decr])m4_if(_m4_defn([_m4_set([$1])]), [$2], + [_m4_popdef([_m4_set([$1],$2)], [_m4_set([$1])])], + [m4_define([_m4_set_cleanup($1)])m4_define( + [_m4_set([$1],$2)], [0])])$3], [$4]) +T19,109 +_m4_defun_epi_outer_m4_popdef([_m4_divert_dump], [_m4_diverting([$1])], [_m4_diverting])m4_divert_pop([GROW])m4_undivert([GROW]) +T15,58 +m4_divert_stackm4_stack_foreach_sep_lifo([_m4_divert_stack], [], [], [ +]) +T17,31 +m4_default_quotedm4_if([$1], [], [[$2]], [[$1]]) +F9,6 +m4_syscmdsyscmd +T11,136 +m4_set_dumpm4_ifdef([_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])m4_ifdef([_m4_set_cleanup($1)], + [_$0_check], [_$0])([$1], [], [$2]) +T9,58 +m4_ifvalnm4_if([$1], + [], [m4_n([$3])], + [m4_n([$2])]) +T7,0 +__gnu__ +T10,27 +m4_joinall[$2]_$0([$1], m4_shift($@)) +T9,22 +m4_shift2m4_shift(m4_shift($@)) +T18,80 +m4_expansion_stackm4_stack_foreach_sep_lifo([_$0], [_$0_entry(], [) +])m4_location[: the top level] +T9,32 +m4_shift3m4_shift(m4_shift(m4_shift($@))) +T17,152 +m4_version_prereqm4_if(m4_version_compare([2.69], [$1]), + [-1], + [m4_default([$3], + [m4_fatal([Autoconf version $1 or higher is required], + [63])])], + [$2]) +T16,50 +_m4_list_cmp_rawm4_if([$1], [$2], [0], [_m4_list_cmp_1([$1], $2)]) +T8,0 +__unix__ +T14,109 +m4_file_appendm4_syscmd([cat >>$1 <<_m4eof +$2 +_m4eof +]) +m4_if(m4_sysval, [0], [], + [m4_fatal([$0: cannot write: $1])]) +T15,49 +m4_rename_forcem4_ifdef([$2], [_m4_undefine([$2])])m4_rename($@) +T9,222 +m4_bmatchm4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [$2], + [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shift3($@))], + [$3])]) +T13,333 +m4_divert_popm4_if([$1], [], [], + [$1], _m4_defn([_m4_divert_diversion]), [], + [m4_fatal([$0($1): diversion mismatch: +]m4_divert_stack)])_m4_popdef([_m4_divert_stack], [_m4_divert_diversion])m4_ifdef([_m4_divert_diversion], [], + [m4_fatal([too many m4_divert_pop])])_m4_divert_raw(_m4_divert(_m4_defn([_m4_divert_diversion]), [-])) +T10,121 +m4_re_word[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]* +T14,37 +m4_PACKAGE_URLhttp://www.gnu.org/software/autoconf/ +T11,62 +m4_cr_alnumabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 +F11,8 +m4_translittranslit +T14,110 +m4_divert_pushm4_divert_stack_push([$0], [$1])m4_pushdef([_m4_divert_diversion], [$1])_m4_divert_raw(_m4_divert([$1], [$2])) +T8,87 +m4_fatalm4_errprintn(m4_location[: error: $1] +m4_expansion_stack)m4_exit(m4_if([$2],, 1, [$2])) +F8,5 +m4_ifdefifdef +T7,20 +m4_wrap_m4_wrap([], [$1[]]) +T12,110 +_m4_set_sizem4_define([_m4_set_size($1)], + m4_ifdef([_m4_set_size($1)], [$2(m4_indir([_m4_set_size($1)]))], + [1])) +T6,43 +m4_map_m4_foreach([_m4_apply([$1],], [)], [], $2) +T10,54 +m4_includem4_include_unique([$1])dnl +m4_builtin([include], [$1]) +T8,189 +m4_splitm4_if([$1], [], [], + [$2], [ ], [m4_if(m4_index([$1], [ ]), [-1], [[[$1]]], + [_$0([$1], [$2], [, ])])], + [$2], [], [_$0([$1], [[ ]+], [, ])], + [_$0([$1], [$2], [, ])]) +T6,190 +m4_minm4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)]) +F14,11 +m4_changequotechangequote +T10,54 +m4_ifblankm4_if(m4_translit([[$1]], [ ][ ][ +]), [], [$2], [$3]) +T14,166 +m4_cleardivertm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [_m4_divert_raw([-1])m4_undivert($@)_m4_divert_raw( + _m4_divert(_m4_defn([_m4_divert_diversion]), [-]))]) +T18,206 +_m4_text_wrap_wordm4_define([m4_Cursor], m4_eval(m4_Cursor + m4_qlen([$1]) + 1))m4_if(m4_eval(m4_Cursor > ([$3])), + [1], [m4_define([m4_Cursor], m4_eval(m4_Indent + m4_qlen([$1]) + 1)) +[$2]], + [m4_Separator[]])[$1] +T7,48 +m4_qlenm4_ifdef([$0-$1], [_m4_defn([$0-]], [_$0(])[$1]) +T6,190 +m4_maxm4_if([$#], [0], [m4_fatal([too few arguments to $0])], + [$#], [1], [m4_eval([$1])], + [$#$1], [2$2], [m4_eval([$1])], + [$#], [2], [_$0($@)], + [_m4_minmax([_$0], $@)]) +F11,8 +m4_errprinterrprint +T10,137 +_m4_divertm4_ifdef([_m4_divert($1)], + [m4_indir([_m4_divert($1)])], + [m4_if([$2], [], [m4_warn([syntax], + [prefer named diversions])])$1]) +T13,26 +m4_cr_LETTERSABCDEFGHIJKLMNOPQRSTUVWXYZ +T17,94 +_m4_stack_reversem4_ifdef([$1], [m4_pushdef([$2], + _m4_defn([$1]))$3[]_m4_popdef([$1])$0([$1], [$2], [$4$3])]) +F11,7 +m4_maketempmkstemp +T4,37 +m4_nm4_if([$1], + [], [], + [$1 +]) +T10,154 +m4_providem4_ifdef([m4_provide($1)], [], +[m4_set_add([_m4_provide], [$1], [m4_define([m4_provide($1)], + m4_ifdef([_m4_diverting], [_m4_defn([_m4_diverting])]))])]) +T11,65 +m4_set_sizem4_ifdef([_m4_set_size($1)], [m4_indir([_m4_set_size($1)])], [0]) +T9,0 +m4_ignore +T9,28 +_m4_quotem4_if([$#], [0], [], [[$*]]) +T9,35 +m4_shiftnm4_assert(0 < $1 && $1 < $#)_$0($@) +T7,75 +m4_warn_m4_warn([$1], [$2], +m4_ifdef([_m4_expansion_stack], [m4_expansion_stack])) +T16,245 +m4_cr_not_digits +  !"#*%&'()$+,./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T12,25 +m4_set_listcm4_set_map_sep([$1], [,]) +F9,6 +m4_divnumdivnum +T21,76 +_m4_set_add_all_checkm4_if([$#], [2], [], + [m4_set_add([$1], [$3])$0([$1], m4_shift2($@))]) +T10,3 +m4_newline +$1 +T13,293 +m4_defun_oncem4_define([m4_location($1)], m4_location)m4_define([$1], [_m4_defun_once([$1], [$2], m4_if(_m4_divert_dump, [], + [[_m4_defun_pro([$1])m4_unquote(], [)_m4_defun_epi([$1])]], +m4_ifdef([_m4_diverting([$1])], [-]), [-], [[m4_unquote(], [)]], + [[_m4_require_call([$1],], [, _m4_divert_dump)]]))]) +T13,474 +_m4_text_wrapm4_pushdef([m4_Indent], m4_qlen([$2]))m4_pushdef([m4_Cursor], m4_qlen([$3]))m4_pushdef([m4_Separator], [m4_define([m4_Separator], [ ])])[$3]m4_cond([m4_Cursor], m4_Indent, [], + [m4_eval(m4_Cursor > m4_Indent)], [1], [ +[$2]m4_define([m4_Cursor], m4_Indent)], + [m4_format([%*s], m4_max([0], + m4_eval(m4_Indent - m4_Cursor)), [])m4_define([m4_Cursor], m4_Indent)])m4_map_args_w([$1], [$0_word(], [, [$2], [$4])])_m4_popdef([m4_Separator], [m4_Cursor], [m4_Indent]) +F9,6 +m4_formatformat +F10,7 +m4_mkstempmkstemp +F11,11 +__program____program__ +T7,156 +m4_defnm4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_defn([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T16,54 +m4_append_uniq_wm4_map_args_w([$2], [_m4_append_uniq([$1],], [, [ ])]) +T13,207 +m4_map_args_w_$0(_m4_split([ ]m4_flatten([$1])[ ], [[ ]+], + m4_if(m4_index([$2$3$4], [\]), [-1], [[$3[]$4[]$2]], + [m4_bpatsubst([[$3[]$4[]$2]], [\\], [\\\\])])), + m4_len([[]$3[]$4]), m4_len([$4[]$2[]])) +T6,4 +m4_car[$1] +T8,2 +m4_count$# +T14,42 +_m4_defun_oncem4_pushdef([$1])$3[$2[]m4_provide([$1])]$4 +T14,62 +m4_set_foreachm4_pushdef([$2])m4_set_map_sep([$1], [m4_define([$2],], [)$3]) +T16,101 +m4_stack_foreach_m4_stack_reverse([$1], [m4_tmp-$1])_m4_stack_reverse([m4_tmp-$1], [$1], [$2(_m4_defn([m4_tmp-$1]))]) +T12,77 +m4_chomp_allm4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [ +/], [/ ]), [/*$]), [$1]) +T6,46 +m4_cmpm4_eval((([$1]) > ([$2])) - (([$1]) < ([$2]))) +F5,6 +m4_ififelse +T9,36 +m4_renamem4_copy([$1], [$2])m4_undefine([$1]) +F8,5 +m4_indirindir +T12,1 +_m4_divert()0 +F12,9 +m4_changecomchangecom +T10,62 +m4_noquotem4_changequote([-=<{(],[)}>=-])$1-=<{()}>=-m4_changequote([,]) +F8,5 +m4_indexindex +T14,58 +_m4_map_args_wm4_substr([$1], [$2], m4_eval(m4_len([$1]) - [$2] - [$3])) +T14,107 +m4_set_map_sepm4_ifdef([_m4_set_cleanup($1)], [_m4_set_contents_1c], + [_m4_set_contents_1])([$1])_m4_set_contents_2($@) +T9,174 +m4_expandm4_pushdef([m4_divert], _m4_defn([_m4_divert_unsafe]))m4_pushdef([m4_divert_push], _m4_defn([_m4_divert_unsafe]))m4_chomp(_$0([$1 +]))_m4_popdef([m4_divert], [m4_divert_push]) +T17,229 +m4_cr_not_LETTERS +  !"#*%&'()$+,./0123456789:;<=>?@[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T18,256 +_m4_set_dump_checkm4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [[$2]_m4_defn([_m4_set([$1])])])_m4_popdef( + [_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1], [$2$3])], + [_m4_popdef([_m4_set_cleanup($1)])]) +T11,17 +m4_location__file__:__line__ +T11,54 +m4_ifnblankm4_if(m4_translit([[$1]], [ ][ ][ +]), [], [$3], [$2]) +T13,134 +_m4_defun_epi_m4_popdef([_m4_expanding($1)], [_m4_expansion_stack])m4_ifdef([_m4_expansion_stack], [], [_m4_defun_epi_outer([$1])])m4_provide([$1]) +T10,40 +m4_warningm4_errprintn(m4_location[: warning: $1]) +F7,4 +m4_evaleval +T15,5 +_m4_divert_grow10000 +T6,598 +m4_form4_pushdef([$1], m4_eval([$2]))m4_cond([m4_eval(([$3]) > ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4], + 1)))m4_assert(_m4_step > 0)_$0(_m4_defn([$1]), + m4_eval((([$3]) - ([$2])) / _m4_step * _m4_step + ([$2])), _m4_step,], + [m4_eval(([$3]) < ([$2]))], 1, + [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4], + -1)))m4_assert(_m4_step < 0)_$0(_m4_defn([$1]), + m4_eval((([$2]) - ([$3])) / -(_m4_step) * _m4_step + ([$2])), _m4_step,], + [m4_pushdef([_m4_step])_$0(_m4_defn([$1]), _m4_defn([$1]), 0,])[m4_define([$1],], [)$5])m4_popdef([_m4_step], [$1]) +T16,298 +m4_map_args_pairm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [m4_fatal([$0: too few arguments: $#: $1])], + [$#], [2], [], + [$#], [3], [m4_default([$2], [$1])([$3])[]], + [$#], [4], [$1([$3], [$4])[]], + [$1([$3], [$4])[]$0([$1], [$2], m4_shift(m4_shift3($@)))]) +T7,36 +m4_signm4_eval((([$1]) > 0) - (([$1]) < 0)) +T25,53 +_m4_expansion_stack_entry_m4_defn([m4_location($1)])[: $1 is expanded from...] +T9,127 +_m4_splitm4_changequote([-=<{(],[)}>=-])[m4_bpatsubst(-=<{(-=<{($1)}>=-)}>=-, -=<{($2)}>=-, + -=<{(]$3[)}>=-)]m4_changequote([, ]) +T8,85 +_m4_joinm4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift2($@))]) +T13,276 +m4_set_deletem4_ifdef([_m4_set([$1])], + [_m4_popdef([_m4_set([$1],]_m4_defn([_m4_set([$1])])[)], + [_m4_set([$1])])$0([$1])], + [m4_ifdef([_m4_set_cleanup($1)], + [_m4_popdef([_m4_set_cleanup($1)])])m4_ifdef( + [_m4_set_size($1)], + [_m4_popdef([_m4_set_size($1)])])]) +T12,10 +m4_cr_digits0123456789 +T17,17 +m4_PACKAGE_STRINGGNU Autoconf 2.69 +F10,6 +_m4_popdefpopdef +T7,1688 +m4_init# All the M4sugar macros start with `m4_', except `dnl' kept as is +# for sake of simplicity. +m4_pattern_forbid([^_?m4_]) +m4_pattern_forbid([^dnl$]) + +# If __m4_version__ is defined, we assume that we are being run by M4 +# 1.6 or newer, thus $@ recursion is linear, and debugmode(+do) +# is available for faster checks of dereferencing undefined macros +# and forcing dumpdef to print to stderr regardless of debugfile. +# But if it is missing, we assume we are being run by M4 1.4.x, that +# $@ recursion is quadratic, and that we need foreach-based +# replacement macros. Also, m4 prior to 1.4.8 loses track of location +# during m4wrap text; __line__ should never be 0. +# +# Use the raw builtin to avoid tripping up include tracing. +# Meanwhile, avoid m4_copy, since it temporarily undefines m4_defn. +m4_ifdef([__m4_version__], +[m4_debugmode([+do]) +m4_define([m4_defn], _m4_defn([_m4_defn])) +m4_define([m4_dumpdef], _m4_defn([_m4_dumpdef])) +m4_define([m4_popdef], _m4_defn([_m4_popdef])) +m4_define([m4_undefine], _m4_defn([_m4_undefine]))], +[m4_builtin([include], [m4sugar/foreach.m4]) +m4_wrap_lifo([m4_if(__line__, [0], [m4_pushdef([m4_location], +]]m4_dquote(m4_dquote(m4_dquote(__file__:__line__)))[[)])])]) + +# Rewrite the first entry of the diversion stack. +m4_divert([KILL]) + +# Check the divert push/pop perfect balance. +# Some users are prone to also use m4_wrap to register last-minute +# m4_divert_text; so after our diversion cleanups, we restore +# KILL as the bottom of the diversion stack. +m4_wrap([m4_popdef([_m4_divert_diversion])m4_ifdef( + [_m4_divert_diversion], [m4_fatal([$0: unbalanced m4_divert_push: +]m4_divert_stack)])_m4_popdef([_m4_divert_stack])m4_divert_push([KILL])]) + +T11,162 +m4_dumpdefsm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [m4_stack_foreach_lifo([$1], [m4_dumpdef([$1])m4_ignore])], + [m4_map_args([$0], $@)]) +T12,16 +m4_wrap_lifo_m4_wrap([$1[]]) +T10,103 +m4_flattenm4_if(m4_index([$1], [ +]), [-1], [[$1]], + [m4_translit(m4_bpatsubst([[[$1]]], [\\ +]), [ +], [ ])]) +T20,36 +_m4_set_intersectionm4_set_contains([$1], [$2], [,[$2]]) +T9,156 +m4_escapem4_if(m4_index(m4_translit([$1], + [[]#,()][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789], [$$$]), [$]), + [-1], [m4_echo], [_$0])([$1]) +T12,24 +m4_rename_m4m4_rename([$1], [m4_$1]) +T20,111 +m4_stack_foreach_sep_m4_stack_reverse([$1], [m4_tmp-$1])_m4_stack_reverse([m4_tmp-$1], [$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]]) +T19,156 +_m4_defun_pro_outerm4_set_delete([_m4_provide])m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])m4_pushdef([_m4_divert_dump], m4_divnum)m4_divert_push([GROW]) +T17,63 +m4_set_differencem4_if([$1], [$2], [], [m4_set_map_sep([$1], [_$0([$2],], [)])]) +T17,292 +_m4_require_checkm4_if(_m4_defn([_m4_diverting]), [$2], [m4_ignore], + m4_ifdef([_m4_diverting([$2])], [-]), [-], [m4_warn([syntax], + [$3: `$1' was expanded before it was required +http://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call], + [m4_ignore]) +T19,166 +m4_set_intersectionm4_if([$1], [$2], [m4_set_listc([$1])], + m4_eval(m4_set_size([$2]) < m4_set_size([$1])), [1], [$0([$2], [$1])], + [m4_set_map_sep([$1], [_$0([$2],], [)])]) +T21,101 +m4_stack_foreach_lifo_m4_stack_reverse([$1], [m4_tmp-$1], [$2(_m4_defn([m4_tmp-$1]))])_m4_stack_reverse([m4_tmp-$1], [$1]) +T11,33 +m4_set_listm4_set_map_sep([$1], [], [], [,]) +F8,8 +__line____line__ +T13,41 +_m4_set_unionm4_ifdef([_m4_set([$1],$2)], [], [,[$2]]) +T10,55 +_m4_shift2m4_if([$#], [2], [], + [, m4_shift(m4_shift($@))]) +T18,4 +m4_PACKAGE_VERSION2.69 +T10,65 +_m4_shift3m4_if([$#], [3], [], + [, m4_shift(m4_shift(m4_shift($@)))]) +T10,84 +_m4_minmaxm4_if([$#], [3], [$1([$2], [$3])], + [$0([$1], $1([$2], [$3]), m4_shift3($@))]) +T11,238 +m4_text_boxm4_pushdef([m4_Border], + m4_translit(m4_format([[[%*s]]], m4_decr(m4_qlen(_m4_expand([$1 +]))), []), [ ], m4_default_quoted([$2], [-])))[##] _m4_defn([m4_Border]) [##] +[##] $1 [##] +[##] _m4_defn([m4_Border]) [##]_m4_popdef([m4_Border]) +T15,180 +m4_set_containsm4_ifdef([_m4_set_cleanup($1)], + [m4_if(m4_ifdef([_m4_set([$1],$2)], + [m4_indir([_m4_set([$1],$2)])], [0]), [1], [$3], [$4])], + [m4_ifdef([_m4_set([$1],$2)], [$3], [$4])]) +F10,7 +m4_esyscmdesyscmd +T10,32 +m4_set_mapm4_set_map_sep([$1], [$2(], [)]) +T14,53 +m4_cr_symbols1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ +T14,63 +m4_cr_symbols2abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 +T12,18 +m4_errprintnm4_errprint([$1 +]) +T13,306 +m4_bpatsubstsm4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], + [$#], 2, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2]))], + [$#], 3, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2], [$3]))], + [_$0($@m4_if(m4_eval($# & 1), 0, [,]))]) +F7,4 +m4_decrdecr +T12,93 +m4_text_wrap_$0(m4_escape([$1]), [$2], m4_default_quoted([$3], [$2]), + m4_default_quoted([$4], [79])) +T12,93 +m4_set_emptym4_ifdef([_m4_set_size($1)], + [m4_if(m4_indir([_m4_set_size($1)]), [0], [$2], [$3])], [$2]) +T15,36 +m4_set_contentsm4_set_map_sep([$1], [], [], [[$2]]) +T10,168 +m4_combinem4_if([$2], [], [], m4_eval([$# > 3]), [1], +[m4_map_args_sep([m4_map_args_sep(m4_dquote(], [)[[$3]], [], [[$1]],]]m4_dquote(m4_dquote(m4_shift3($@)))[[)], [[$1]], $2)]) +T18,202 +m4_cr_not_symbols1 +  !"#*%&'()$+,./0123456789:;<=>?@[\]^`{|}~- +T18,192 +m4_cr_not_symbols2 +  !"#*%&'()$+,./:;<=>?@[\]^`{|}~- +F12,8 +m4_bpatsubstpatsubst +T7,2 +m4_echo$@ +T25,111 +m4_stack_foreach_sep_lifo_m4_stack_reverse([$1], [m4_tmp-$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]])_m4_stack_reverse([m4_tmp-$1], [$1]) +T7,91 +m4_argnm4_assert([0 < $1])m4_pushdef([_$0], [_m4_popdef([_$0])]m4_dquote([$]m4_incr([$1])))_$0($@) +T8,27 +m4_ifvalm4_if([$1], [], [$3], [$2]) +T7,197 +m4_copym4_ifdef([$2], [m4_fatal([$0: won't overwrite defined macro: $2])], + [m4_stack_foreach_sep([$1], [m4_pushdef([$2],], [)])])m4_ifdef([m4_location($1)], [m4_define([m4_location($2)], m4_location)]) +T14,113 +m4_expand_oncem4_provide_if(m4_default_quoted([$2], [$1]), + [], + [m4_provide(m4_default_quoted([$2], [$1]))[]$1]) +T14,96 +_m4_bpatsubstsm4_if([$#], 2, [$1], + [$0(m4_builtin([patsubst], [[$1]], [$2], [$3]), + m4_shift3($@))]) +T13,41 +m4_provide_ifm4_ifdef([m4_provide($1)], + [$2], [$3]) +T20,4 +_m4_divert_diversionKILL +F12,8 +_m4_undivertundivert +T7,54 +_m4_cdrm4_if([$#], 1, [], + [, m4_dquote(m4_shift($@))]) +T10,86 +m4_toupperm4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ]) +T8,19 +m4_curry$1(m4_shift($@,)_$0 +T17,28 +m4_default_nblankm4_ifblank([$1], [$2], [$1]) +T12,48 +m4_re_escapem4_bpatsubst([$1], + [[][*+.?\^$]], [\\\&]) +T12,26 +m4_normalizem4_strip(m4_flatten([$1])) +T18,40 +_m4_set_differencem4_set_contains([$1], [$2], [], [,[$2]]) +F3,3 +dnldnl +F12,8 +_m4_undefineundefine +T10,79 +_m4_shiftnm4_if([$1], 1, [m4_shift(], + [$0(m4_decr([$1])]), m4_shift(m4_shift($@))) +T20,170 +_m4_version_unletterm4_bpatsubst(m4_bpatsubst(m4_translit([[[[0,$1]]]], [.-], [,,]),[[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]][+], + [+1,-1,[0r36:\&]]), [,0], [,[0r10:0]]) +T11,136 +m4_undivertm4_if([$#], [0], [m4_fatal([$0: missing argument])], + [$#], [1], [_m4_undivert(_m4_divert([$1]))], + [m4_map_args([$0], $@)]) +T10,412 +m4_requirem4_ifdef([_m4_expanding($1)], + [m4_fatal([$0: circular dependency of $1])])m4_if(_m4_divert_dump, [], + [m4_fatal([$0($1): cannot be used outside of an ]dnl +m4_if([$0], [m4_require], [[m4_defun]], [[AC_DEFUN]])['d macro])])m4_provide_if([$1], [m4_set_contains([_m4_provide], [$1], + [_m4_require_check([$1], _m4_defn([m4_provide($1)]), [$0])], [m4_ignore])], + [_m4_require_call])([$1], [$2], _m4_divert_dump) +T7,119 +m4_casem4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + [$1], [$2], [$3], + [$0([$1], m4_shift3($@))]) +T11,55 +m4_sincludem4_include_unique([$1])dnl +m4_builtin([sinclude], [$1]) +T9,255 +m4_cr_all +  !"#*%&'()$+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- +T19,62 +m4_version_unletterm4_substr(m4_map_args([.m4_eval], m4_unquote(_$0([$1]))), [3]) +T17,32 +m4_define_defaultm4_ifndef([$1], [m4_define($@)]) +T11,160 +m4_undefinem4_if([$#], [0], [[$0]], + [$#], [1], [m4_ifdef([$1], [_m4_undefine([$1])], + [m4_fatal([$0: undefined macro: $1])])], + [m4_map_args([$0], $@)]) +T15,12 +m4_PACKAGE_NAMEGNU Autoconf +F10,7 +m4_builtinbuiltin +T14,44 +m4_divert_oncem4_expand_once([m4_divert_text([$1], [$2])]) +T11,146 +_m4_expand_m4_if([$4], [}>=-], + [m4_changequote([-=<{$2], [)}>=-])$3m4_changequote([, ])], + [$0([$1], [($2], -=<{($2$1)}>=-, [}>=-])m4_ignore$2]) +T17,64 +_m4_divert_unsafem4_fatal([$0: cannot change diversion to `$1' inside m4_expand]) +T8,99 +_m4_condm4_if(($1), [($2)], [$3], + [$#], [3], [], + [$#], [4], [$4], + [$0(m4_shift3($@))]) +T16,0 +m4_pattern_allow +T17,253 +m4_divert_requirem4_ifdef([_m4_expanding($2)], + [m4_fatal([$0: circular dependency of $2])])m4_if(_m4_divert_dump, [], + [m4_fatal([$0($2): cannot be used outside of an m4_defun'd macro])])m4_provide_if([$2], [], + [_m4_require_call([$2], [$3], _m4_divert([$1], [-]))]) +F9,6 +m4_sysvalsysval +T17,0 +m4_pattern_forbid +T9,69 +m4_assertm4_if(m4_eval([$1]), 0, + [m4_fatal([assert failed: $1], [$2])]) +F10,7 +m4_pushdefpushdef +T20,53 +m4_divert_stack_pushm4_pushdef([_m4_divert_stack], m4_location[: $1: $2]) +T17,105 +_m4_define_cr_notm4_define([m4_cr_not_$1], + m4_translit(m4_dquote(m4_defn([m4_cr_all])), + m4_defn([m4_cr_$1]))) +T23,39 +m4_expansion_stack_pushm4_pushdef([_m4_expansion_stack], [$1]) +T13,26 +m4_cr_lettersabcdefghijklmnopqrstuvwxyz +T10,36 +_m4_expand$0_([$1], [(], -=<{($1)}>=-, [}>=-]) +T11,149 +m4_map_argsm4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])], + [$#], [1], [], + [$#], [2], [$1([$2])[]], + [_m4_foreach([$1(], [)], $@)]) +T19,288 +_m4_set_contents_1cm4_ifdef([_m4_set([$1])], + [m4_set_contains([$1], _m4_defn([_m4_set([$1])]), + [m4_pushdef([_m4_set_($1)], _m4_defn([_m4_set([$1])]))], + [_m4_popdef([_m4_set([$1],]_m4_defn( + [_m4_set([$1])])[)])])_m4_popdef([_m4_set([$1])])$0([$1])], + [_m4_popdef([_m4_set_cleanup($1)])]) +T7,65 +_m4_minm4_eval((([$1]) < ([$2])) * ([$1]) + (([$1]) >= ([$2])) * ([$2])) +F8,5 +m4_shiftshift +T16,452 +_m4_require_callm4_pushdef([_m4_divert_grow], m4_decr(_m4_divert_grow))m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])m4_divert_push(_m4_divert_grow, [-])m4_if([$2], [], [$1], [$2]) +m4_provide_if([$1], [m4_set_remove([_m4_provide], [$1])], + [m4_warn([syntax], [$1 is m4_require'd but not m4_defun'd])])_m4_divert_raw($3)_m4_undivert(_m4_divert_grow)m4_divert_pop(_m4_divert_grow)_m4_popdef([_m4_divert_grow], +[_m4_diverting([$1])], [_m4_diverting]) +T11,70 +_m4_foreachm4_if([$#], [3], [], + [$1[$4]$2[]$0([$1], [$2], m4_shift3($@))]) +T7,65 +_m4_maxm4_eval((([$1]) > ([$2])) * ([$1]) + (([$1]) <= ([$2])) * ([$2])) +F8,8 +__file____file__ +F10,6 +m4_bregexpregexp +T13,42 +m4_mapall_sepm4_if([$3], [], [], [_$0([$1], [$2], $3)]) +T9,26 +m4_ifndefm4_ifdef([$1], [$3], [$2]) +T13,47 +m4_copy_forcem4_ifdef([$2], [_m4_undefine([$2])])m4_copy($@) +T7,108 +m4_joinm4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift2($@))]) +F7,6 +m4_exitm4exit +T12,83 +m4_set_unionm4_set_listc([$1])m4_if([$1], [$2], [], + [m4_set_map_sep([$2], [_$0([$1],], [)])]) +T16,2 +_m4_divert(KILL)-1 +T10,100 +m4_foreachm4_if([$2], [], [], + [m4_pushdef([$1])_$0([m4_define([$1],], [)$3], [], + $2)m4_popdef([$1])]) +F11,8 +m4_traceofftraceoff +T8,33 +m4_applym4_if([$2], [], [$1], [$1($2)])[] +T30,0 +m4_include(m4sugar/version.m4) +T14,73 +_m4_mapall_sepm4_apply([$1], [$3])_m4_foreach([m4_apply([$2[]$1],], [)], m4_shift2($@)) +T9,132 +m4_divertm4_popdef([_m4_divert_stack])m4_define([_m4_divert_diversion], [$1])m4_divert_stack_push([$0], [$1])_m4_divert_raw(_m4_divert([$1])) +F10,7 +m4_traceontraceon +T13,52 +m4_cr_LettersabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ +T9,75 +m4_beforem4_provide_if([$2], + [m4_warn([syntax], [$2 was called before $1])]) +T10,143 +m4_map_sepm4_pushdef([m4_Sep], [m4_define([m4_Sep], _m4_defn([m4_unquote]))])_m4_foreach([_m4_apply([m4_Sep([$2])[]$1],], [)], [], $3)m4_popdef([m4_Sep]) +T12,55 +m4_copy_unm4m4_copy([$1], m4_bpatsubst([$1], [^m4_\(.*\)], [[\1]])) +T10,86 +m4_tolowerm4_translit([[$1]], [ABCDEFGHIJKLMNOPQRSTUVWXYZ], + [abcdefghijklmnopqrstuvwxyz]) +T8,189 +_m4_wrapm4_ifdef([$0_text], + [m4_define([$0_text], [$1]_m4_defn([$0_text])[$2])], + [m4_builtin([m4wrap], [m4_unquote( + _m4_defn([$0_text])_m4_popdef([$0_text]))])m4_define([$0_text], [$1$2])]) +F9,6 +m4_definedefine +T10,27 +m4_defaultm4_if([$1], [], [$2], [$1]) +T9,5 +_m4_curry[$1]) +T8,198 +_m4_qlenm4_define([m4_qlen-$1], +m4_if(m4_index([$1], [@]), [-1], [m4_len([$1])], + [m4_len(m4_bpatsubst([[$1]], + [@\(\(<:\|:>\|S|\|%:\|\{:\|:\}\)\(@\)\|&t@\)], + [\3]))]))_m4_defn([m4_qlen-$1]) +T10,72 +m4_reversem4_if([$#], [0], [], [$#], [1], [[$1]], + [$0(m4_shift($@)), [$1]]) +T10,294 +_m4_escapem4_changequote([-=<{(],[)}>=-])m4_bpatsubst(m4_bpatsubst(m4_bpatsubst(m4_bpatsubst( + -=<{(-=<{(-=<{(-=<{(-=<{($1)}>=-)}>=-)}>=-)}>=-)}>=-, + -=<{(#)}>=-, -=<{(@%:@)}>=-), + -=<{(\[)}>=-, -=<{(@<:@)}>=-), + -=<{(\])}>=-, -=<{(@:>@)}>=-), + -=<{(\$)}>=-, -=<{(@S|@)}>=-)m4_changequote([,]) +T16,55 +_m4_divert_stack../../lib/m4sugar/m4sugar.m4:3259: m4_divert_push: KILL +T17,229 +m4_cr_not_letters +  !"#*%&'()$+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~- +T17,117 +m4_include_uniquem4_ifdef([m4_include($1)], + [m4_warn([syntax], [file `$1' included several times])])dnl +m4_define([m4_include($1)]) +T8,77 +m4_stripm4_bpatsubsts([$1 ], + [[ ]+], [ ], + [^. ?\(.*\) .$], [[[\1]]]) +T9,4 +m4_dquote[$@] +D-1,0 + +# End of frozen state file diff --git a/externals/codi b/externals/codi index 1b8d3f5f03de..b8ddede642eb 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 1b8d3f5f03de560fb63a2a76ad91ab7bb3fa67d8 +Subproject commit b8ddede642eb2824a56c75cebddb79ba194c2ada diff --git a/externals/medi b/externals/medi index 783f6ab7e6d0..051753df5bb6 160000 --- a/externals/medi +++ b/externals/medi @@ -1 +1 @@ -Subproject commit 783f6ab7e6d068714e855758b338edde0cf0e025 +Subproject commit 051753df5bb6e66c9fb6fbe4f2413c4ba187e81d