diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index ecd9e069edd0..cea9c098ee41 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -19,19 +19,19 @@ jobs: config_set: [BaseMPI, ReverseMPI, ForwardMPI, BaseNoMPI, ReverseNoMPI, ForwardNoMPI, BaseOMP] include: - config_set: BaseMPI - flags: '-Denable-pywrapper=true -Denable-tests=true --werror' + flags: '-Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror' - config_set: ReverseMPI - flags: '-Denable-autodiff=true -Denable-normal=false -Denable-pywrapper=true -Denable-tests=true --werror' + flags: '-Denable-autodiff=true -Denable-normal=false -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror' - config_set: ForwardMPI - flags: '-Denable-directdiff=true -Denable-normal=false -Denable-tests=true --werror' + flags: '-Denable-directdiff=true -Denable-normal=false -Denable-tests=true --warnlevel=3 --werror' - config_set: BaseNoMPI - flags: '-Denable-pywrapper=true -Dwith-mpi=disabled -Denable-tests=true --werror' + flags: '-Denable-pywrapper=true -Dwith-mpi=disabled -Denable-tests=true --warnlevel=3 --werror' - config_set: ReverseNoMPI - flags: '-Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-pywrapper=true -Denable-tests=true --werror' + flags: '-Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror' - config_set: ForwardNoMPI - flags: '-Denable-directdiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-tests=true --werror' + flags: '-Denable-directdiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-tests=true --warnlevel=3 --werror' - config_set: BaseOMP - flags: '-Dwith-omp=true -Denable-mixedprec=true -Denable-tecio=false --werror' + flags: '-Dwith-omp=true -Denable-mixedprec=true -Denable-tecio=false --warnlevel=3 --werror' runs-on: ubuntu-latest steps: - name: Cache Object Files diff --git a/.gitignore b/.gitignore index 711b91bb5fdf..318ff72ff1be 100644 --- a/.gitignore +++ b/.gitignore @@ -79,7 +79,11 @@ TestData # Ignore output files if tests are run locally *.vtk *.vtu +*.vtm +*.pvsm *.ref +*.plt +*.szplt Mercurial .hg* diff --git a/AUTHORS.md b/AUTHORS.md index b223314f1cf4..9ac39ec05e9c 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -43,6 +43,7 @@ Copyright holders might be the individual person or their respective employer. I ``` Akshay.K.R Alejandro +Alessandro Gastaldi Aman uz zaman Baig Amit Sachdeva Ana Lourenco @@ -53,19 +54,23 @@ Antonio Rubino Arne Bachmann Beckett Y. Zhou Benjamin S. Kirk -Brandon Tracey +Brendan Tracey +Brian Munguía Carsten Othmer +Catarina Garbacz +Charanya Venkatesan-Crome Clark Pederson Daumantas Kavolis Dave Taflin Eduardo Molina Ethan Alan Hereth -FlorianDm +Florian Dittmann Francisco D. Palacios Gaurav Bansal Giulio Gori Guillaume Bâty Harichand M V +HL Kline IndianaStokes J. Sinsay JSmith36 @@ -75,13 +80,19 @@ Jayant Mukhopadhaya Jeffrey van Oostrom Jessie Lauzon João Loureiro +Johannes Blühdorn +JonathanSmith1936 Kedar Naik LaSerpe +Lennaert Tol Matteo Pini +Max Aehle Max Le Max Sagebaum Michele Gaffuri Mickael Philit +Mladen Banovic +Nicola Fonzi Ole Burghardt Patrick Mischke Paul Urbanczyk @@ -91,6 +102,7 @@ Pete Bachant RaulFeijo55 Ruben Sanchez Ryan Barrett +SaettaE Salvatore Vitale Samet Cakmakcioglu Scott Imlay @@ -104,25 +116,26 @@ Trent Lukaczyk VivaanKhatri Wally Maier aaronyicongfu +aeroamit anilvar +band-a-prend +bigfootedrockmidget bmunguia chamsolli costat -cr109 -cvencro daniel-linton demanosalvas dmudiger erangit flo -hlkline +fmpmorgado +garcgutierrez +jtneedels juliendm jvanoostrom -koodlyakshay mcolonno minkwankim padronas -sametcaka sravya91 srcopela tobadavid diff --git a/Common/doc/docmain.hpp b/Common/doc/docmain.hpp index 4a915ae58e0b..885bafeba5b8 100644 --- a/Common/doc/docmain.hpp +++ b/Common/doc/docmain.hpp @@ -2,7 +2,7 @@ * \file docmain.hpp * \brief This file contains documentation for Doxygen and does not have any significance with respect to C++. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * The current SU2 release has been coordinated by the * SU2 International Developers Society @@ -33,7 +33,7 @@ */ /*! - * \mainpage SU2 version 7.1.0 "Blackbird" + * \mainpage SU2 version 7.1.1 "Blackbird" * SU2 suite is an open-source collection of C++ based software tools * to perform PDE analysis and PDE constrained optimization problems. The toolset is designed with * computational fluid dynamics and aerodynamic shape optimization in mind, but is extensible to diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 8a386ea598ae..d46efb245478 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -3,7 +3,7 @@ * \brief All the information about the definition of the physical problem. * The subroutines and functions are in the CConfig.cpp file. * \author F. Palacios, T. Economon, B. Tracey - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -28,7 +28,7 @@ #pragma once -#include "./parallelization/mpi_structure.hpp" +#include "parallelization/mpi_structure.hpp" #include #include @@ -78,10 +78,7 @@ class CConfig { su2double Fan_Poly_Eff; /*!< \brief Fan polytropic effeciency. */ su2double MinLogResidual; /*!< \brief Minimum value of the log residual. */ su2double EA_ScaleFactor; /*!< \brief Equivalent Area scaling factor */ - su2double* EA_IntLimit; /*!< \brief Integration limits of the Equivalent Area computation */ su2double AdjointLimit; /*!< \brief Adjoint variable limit */ - su2double* Obj_ChainRuleCoeff; /*!< \brief Array defining objective function for adjoint problem based on - chain rule in terms of gradient w.r.t. density, velocity, pressure */ string* ConvField; /*!< \brief Field used for convergence check.*/ string* WndConvField; /*!< \brief Function where to apply the windowed convergence criteria for the time average of the unsteady (single zone) flow problem. */ @@ -93,10 +90,6 @@ class CConfig { bool Wnd_Cauchy_Crit; /*!< \brief True => Cauchy criterion is used for time average objective function in unsteady flows. */ bool MG_AdjointFlow; /*!< \brief MG with the adjoint flow problem */ - su2double* SubsonicEngine_Cyl; /*!< \brief Coordinates of the box subsonic region */ - su2double* SubsonicEngine_Values; /*!< \brief Values of the box subsonic region */ - su2double* Hold_GridFixed_Coord; /*!< \brief Coordinates of the box to hold fixed the nbumerical grid */ - su2double *DistortionRack; su2double *PressureLimits, *DensityLimits, *TemperatureLimits; /*!< \brief Limits for the primitive variables */ @@ -106,7 +99,6 @@ class CConfig { unsigned short ConvCriteria; /*!< \brief Kind of convergence criteria. */ unsigned short nFFD_Iter; /*!< \brief Iteration for the point inversion problem. */ unsigned short FFD_Blending; /*!< \brief Kind of FFD Blending function. */ - su2double* FFD_BSpline_Order; /*!< \brief BSpline order in i,j,k direction. */ su2double FFD_Tol; /*!< \brief Tolerance in the point inversion problem. */ bool FFD_IntPrev; /*!< \brief Enables self-intersection prevention procedure within the FFD box. */ unsigned short FFD_IntPrev_MaxIter; /*!< \brief Amount of iterations for FFD box self-intersection prevention procedure. */ @@ -117,6 +109,7 @@ class CConfig { su2double Opt_RelaxFactor; /*!< \brief Scale factor for the line search. */ su2double Opt_LineSearch_Bound; /*!< \brief Bounds for the line search. */ su2double StartTime; + unsigned short SmoothNumGrid; /*!< \brief Smooth the numerical grid. */ bool ContinuousAdjoint, /*!< \brief Flag to know if the code is solving an adjoint problem. */ Viscous, /*!< \brief Flag to know if the code is solving a viscous problem. */ EquivArea, /*!< \brief Flag to know if the code is going to compute and plot the equivalent area. */ @@ -131,8 +124,6 @@ class CConfig { Low_Mach_Precon, /*!< \brief Flag to know if we are using a low Mach number preconditioner. */ Low_Mach_Corr, /*!< \brief Flag to know if we are using a low Mach number correction. */ GravityForce, /*!< \brief Flag to know if the gravity force is incuded in the formulation. */ - SmoothNumGrid, /*!< \brief Smooth the numerical grid. */ - AdaptBoundary, /*!< \brief Adapt the elements on the boundary. */ SubsonicEngine, /*!< \brief Engine intake subsonic region. */ Frozen_Visc_Cont, /*!< \brief Flag for cont. adjoint problem with/without frozen viscosity. */ Frozen_Visc_Disc, /*!< \brief Flag for disc. adjoint problem with/without frozen viscosity. */ @@ -175,10 +166,8 @@ class CConfig { unsigned short Continuous_Eqns; /*!< \brief Which equations to treat continuously (Hybrid adjoint)*/ unsigned short Discrete_Eqns; /*!< \brief Which equations to treat discretely (Hybrid adjoint). */ unsigned short *Design_Variable; /*!< \brief Kind of design variable. */ - unsigned short Kind_Adaptation; /*!< \brief Kind of numerical grid adaptation. */ unsigned short nTimeInstances; /*!< \brief Number of periodic time instances for harmonic balance. */ su2double HarmonicBalance_Period; /*!< \brief Period of oscillation to be used with harmonic balance computations. */ - su2double New_Elem_Adapt; /*!< \brief Elements to adapt in the numerical grid adaptation process. */ su2double Delta_UnstTime, /*!< \brief Time step for unsteady computations. */ Delta_UnstTimeND; /*!< \brief Time step for unsteady computations (non dimensional). */ su2double Delta_DynTime, /*!< \brief Time step for dynamic structural computations. */ @@ -427,6 +416,9 @@ class CConfig { unsigned short nQuasiNewtonSamples; /*!< \brief Number of samples used in quasi-Newton solution methods. */ bool UseVectorization; /*!< \brief Whether to use vectorized numerics schemes. */ + bool NewtonKrylov; /*!< \brief Use a coupled Newton method to solve the flow equations. */ + array NK_IntParam{{20, 3, 2}}; /*!< \brief Integer parameters for NK method. */ + array NK_DblParam{{-2.0, 0.1, -3.0, 1e-4}}; /*!< \brief Floating-point parameters for NK method. */ unsigned short nMGLevels; /*!< \brief Number of multigrid levels (coarse levels). */ unsigned short nCFL; /*!< \brief Number of CFL, one for each multigrid level. */ @@ -470,7 +462,6 @@ class CConfig { *MG_PostSmooth, /*!< \brief Multigrid Post smoothing. */ *MG_CorrecSmooth; /*!< \brief Multigrid Jacobi implicit smoothing of the correction. */ su2double *LocationStations; /*!< \brief Airfoil sections in wing slicing subroutine. */ - su2double *NacelleLocation; /*!< \brief Definition of the nacelle location. */ unsigned short Kind_Solver, /*!< \brief Kind of solver Euler, NS, Continuous adjoint, etc. */ Kind_MZSolver, /*!< \brief Kind of multizone solver. */ @@ -592,13 +583,8 @@ class CConfig { 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. */ - 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. */ - su2double* Kappa_Flow, /*!< \brief Numerical dissipation coefficients for the flow equations. */ - *Kappa_AdjFlow, /*!< \brief Numerical dissipation coefficients for the adjoint flow equations. */ - *Kappa_Heat; /*!< \brief Numerical dissipation coefficients for the (fvm) heat equation. */ - su2double* FFD_Axis; /*!< \brief Numerical dissipation coefficients for the adjoint equations. */ su2double Kappa_1st_AdjFlow, /*!< \brief Lax 1st order dissipation coefficient for adjoint flow equations (coarse multigrid levels). */ Kappa_2nd_AdjFlow, /*!< \brief JST 2nd order dissipation coefficient for adjoint flow equations. */ Kappa_4th_AdjFlow, /*!< \brief JST 4th order dissipation coefficient for adjoint flow equations. */ @@ -674,7 +660,7 @@ class CConfig { nMarker_ZoneInterface, /*!< \brief Number of markers in the zone interface. */ nMarker_Plotting, /*!< \brief Number of markers to plot. */ nMarker_Analyze, /*!< \brief Number of markers to analyze. */ - nMarker_Moving, /*!< \brief Number of markers in motion (DEFORMING, MOVING_WALL, or FLUID_STRUCTURE). */ + nMarker_Moving, /*!< \brief Number of markers in motion (DEFORMING, MOVING_WALL). */ nMarker_PyCustom, /*!< \brief Number of markers that are customizable in Python. */ nMarker_DV, /*!< \brief Number of markers affected by the design variables. */ nMarker_WallFunctions; /*!< \brief Number of markers for which wall functions must be applied. */ @@ -684,7 +670,7 @@ class CConfig { *Marker_Plotting, /*!< \brief Markers to plot. */ *Marker_Analyze, /*!< \brief Markers to analyze. */ *Marker_ZoneInterface, /*!< \brief Markers in the FSI interface. */ - *Marker_Moving, /*!< \brief Markers in motion (DEFORMING, MOVING_WALL, or FLUID_STRUCTURE). */ + *Marker_Moving, /*!< \brief Markers in motion (DEFORMING, MOVING_WALL). */ *Marker_PyCustom, /*!< \brief Markers that are customizable in Python. */ *Marker_DV, /*!< \brief Markers affected by the design variables. */ *Marker_WallFunctions; /*!< \brief Markers for which wall functions must be applied. */ @@ -726,12 +712,11 @@ class CConfig { *Marker_CfgFile_DV, /*!< \brief Global index for design variable markers using the config information. */ *Marker_CfgFile_PerBound; /*!< \brief Global index for periodic boundaries using the config information. */ string *PlaneTag; /*!< \brief Global index for the plane adaptation (upper, lower). */ - su2double DualVol_Power; /*!< \brief Power for the dual volume in the grid adaptation sensor. */ su2double *nBlades; /*!< \brief number of blades for turbomachinery computation. */ - unsigned short Analytical_Surface; /*!< \brief Information about the analytical definition of the surface for grid adaptation. */ unsigned short Geo_Description; /*!< \brief Description of the geometry. */ unsigned short Mesh_FileFormat; /*!< \brief Mesh input format. */ unsigned short Tab_FileFormat; /*!< \brief Format of the output files. */ + unsigned short output_precision; /*!< \brief .precision(value) for SU2_DOT and HISTORY output */ unsigned short ActDisk_Jump; /*!< \brief Format of the output files. */ unsigned long StartWindowIteration; /*!< \brief Starting Iteration for long time Windowing apporach . */ unsigned short nCFL_AdaptParam; /*!< \brief Number of CFL parameters provided in config. */ @@ -747,7 +732,6 @@ class CConfig { *CFL_AdaptParam, /*!< \brief Information about the CFL ramp. */ *RelaxFactor_Giles, /*!< \brief Information about the under relaxation factor for Giles BC. */ *CFL, /*!< \brief CFL number. */ - *HTP_Axis, /*!< \brief Location of the HTP axis. */ DomainVolume; /*!< \brief Volume of the computational grid. */ unsigned short nRefOriginMoment_X, /*!< \brief Number of X-coordinate moment computation origins. */ @@ -755,8 +739,6 @@ class CConfig { nRefOriginMoment_Z; /*!< \brief Number of Z-coordinate moment computation origins. */ unsigned short nMesh_Box_Size; short *Mesh_Box_Size; /*!< \brief Array containing the number of grid points in the x-, y-, and z-directions for the analytic RECTANGLE and BOX grid formats. */ - su2double* Mesh_Box_Length; /*!< \brief Array containing the length in the x-, y-, and z-directions for the analytic RECTANGLE and BOX grid formats. */ - su2double* Mesh_Box_Offset; /*!< \brief Array containing the offset from 0.0 in the x-, y-, and z-directions for the analytic RECTANGLE and BOX grid formats. */ string Mesh_FileName, /*!< \brief Mesh input file. */ Mesh_Out_FileName, /*!< \brief Mesh output file. */ Solution_FileName, /*!< \brief Flow solution input file. */ @@ -799,7 +781,6 @@ class CConfig { Inc_Velocity_Ref, /*!< \brief Reference velocity for custom incompressible non-dim. */ Inc_Temperature_Ref, /*!< \brief Reference temperature for custom incompressible non-dim. */ Inc_Density_Init, /*!< \brief Initial density for incompressible flows. */ - *Inc_Velocity_Init, /*!< \brief Initial velocity vector for incompressible flows. */ Inc_Temperature_Init, /*!< \brief Initial temperature for incompressible flows w/ heat transfer. */ Heat_Flux_Ref, /*!< \brief Reference heat flux for non-dim. */ Gas_Constant_Ref, /*!< \brief Reference specific gas constant. */ @@ -817,9 +798,6 @@ class CConfig { Mu_Temperature_RefND, /*!< \brief Non-dimensional reference temperature for Sutherland model. */ Mu_S, /*!< \brief Reference S for Sutherland model. */ Mu_SND; /*!< \brief Non-dimensional reference S for Sutherland model. */ - su2double* CpPolyCoefficients; /*!< \brief Definition of the temperature polynomial coefficients for specific heat Cp. */ - su2double* MuPolyCoefficients; /*!< \brief Definition of the temperature polynomial coefficients for viscosity. */ - su2double* KtPolyCoefficients; /*!< \brief Definition of the temperature polynomial coefficients for thermal conductivity. */ array CpPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for specific heat Cp. */ array MuPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for viscosity. */ array KtPolyCoefficientsND{{0.0}}; /*!< \brief Definition of the non-dimensional temperature polynomial coefficients for thermal conductivity. */ @@ -827,7 +805,6 @@ class CConfig { Thermal_Diffusivity_Solid, /*!< \brief Thermal diffusivity in solids. */ Temperature_Freestream_Solid, /*!< \brief Temperature in solids at freestream conditions. */ Density_Solid, /*!< \brief Total density in solids. */ - *Velocity_FreeStream, /*!< \brief Free-stream velocity vector of the fluid. */ Energy_FreeStream, /*!< \brief Free-stream total energy of the fluid. */ ModVel_FreeStream, /*!< \brief Magnitude of the free-stream velocity of the fluid. */ ModVel_FreeStreamND, /*!< \brief Non-dimensional magnitude of the free-stream velocity of the fluid. */ @@ -876,7 +853,7 @@ class CConfig { su2double Knowles_B, /*!< \brief Knowles material model constant B. */ Knowles_N; /*!< \brief Knowles material model constant N. */ bool DE_Effects; /*!< Application of DE effects to FE analysis */ - bool RefGeom; /*!< Read a reference geometry for optimization purposes. */ + bool RefGeom, RefGeomSurf; /*!< Read a reference geometry for optimization purposes. */ unsigned long refNodeID; /*!< \brief Global ID for the reference node (optimization). */ string RefGeom_FEMFileName; /*!< \brief File name for reference geometry. */ unsigned short RefGeom_FileFormat; /*!< \brief Mesh input format. */ @@ -888,20 +865,19 @@ class CConfig { su2double AitkenDynMinInit; /*!< \brief Aitken's minimum dynamic relaxation factor for the first iteration */ bool RampAndRelease; /*!< \brief option for ramp load and release */ bool Sine_Load; /*!< \brief option for sine load */ - su2double *SineLoad_Coeff; /*!< \brief Stores the load coefficient */ su2double Thermal_Diffusivity; /*!< \brief Thermal diffusivity used in the heat solver. */ su2double Cyclic_Pitch, /*!< \brief Cyclic pitch for rotorcraft simulations. */ Collective_Pitch; /*!< \brief Collective pitch for rotorcraft simulations. */ su2double Mach_Motion; /*!< \brief Mach number based on mesh velocity and freestream quantities. */ - su2double *Motion_Origin, /*!< \brief Mesh motion origin. */ - *Translation_Rate, /*!< \brief Translational velocity of the mesh. */ - *Rotation_Rate, /*!< \brief Angular velocity of the mesh . */ - *Pitching_Omega, /*!< \brief Angular frequency of the mesh pitching. */ - *Pitching_Ampl, /*!< \brief Pitching amplitude. */ - *Pitching_Phase, /*!< \brief Pitching phase offset. */ - *Plunging_Omega, /*!< \brief Angular frequency of the mesh plunging. */ - *Plunging_Ampl; /*!< \brief Plunging amplitude. */ + su2double Motion_Origin[3] = {0.0}, /*!< \brief Mesh motion origin. */ + Translation_Rate[3] = {0.0}, /*!< \brief Translational velocity of the mesh. */ + Rotation_Rate[3] = {0.0}, /*!< \brief Angular velocity of the mesh . */ + Pitching_Omega[3] = {0.0}, /*!< \brief Angular frequency of the mesh pitching. */ + Pitching_Ampl[3] = {0.0}, /*!< \brief Pitching amplitude. */ + Pitching_Phase[3] = {0.0}, /*!< \brief Pitching phase offset. */ + Plunging_Omega[3] = {0.0}, /*!< \brief Angular frequency of the mesh plunging. */ + Plunging_Ampl[3] = {0.0}; /*!< \brief Plunging amplitude. */ su2double *MarkerMotion_Origin, /*!< \brief Mesh motion origin of marker. */ *MarkerTranslation_Rate, /*!< \brief Translational velocity of marker. */ *MarkerRotation_Rate, /*!< \brief Angular velocity of marker. */ @@ -972,7 +948,6 @@ class CConfig { unsigned short Dynamic_LoadTransfer; /*!< \brief Method for dynamic load transferring. */ bool IncrementalLoad; /*!< \brief Apply the load in increments (for nonlinear structural analysis). */ unsigned long IncLoad_Nincrements; /*!< \brief Number of increments. */ - su2double *IncLoad_Criteria; /*!< \brief Criteria for the application of incremental loading. */ su2double Ramp_Time; /*!< \brief Time until the maximum load is applied. */ bool Predictor, /*!< \brief Determines whether a predictor step is used. */ Relaxation; /*!< \brief Determines whether a relaxation step is used. */ @@ -991,13 +966,14 @@ class CConfig { su2double RefGeom_Penalty, /*!< \brief Penalty weight value for the reference geometry objective function. */ RefNode_Penalty, /*!< \brief Penalty weight value for the reference node objective function. */ DV_Penalty; /*!< \brief Penalty weight to add a constraint to the total amount of stiffness. */ + array StressPenaltyParam = {{1.0, 20.0}}; /*!< \brief Allowed stress and KS aggregation exponent. */ unsigned long Nonphys_Points, /*!< \brief Current number of non-physical points in the solution. */ Nonphys_Reconstr; /*!< \brief Current number of non-physical reconstructions for 2nd-order upwinding. */ su2double ParMETIS_tolerance; /*!< \brief Load balancing tolerance for ParMETIS. */ long ParMETIS_pointWgt; /*!< \brief Load balancing weight given to points. */ long ParMETIS_edgeWgt; /*!< \brief Load balancing weight given to edges. */ unsigned short DirectDiff; /*!< \brief Direct Differentation mode. */ - bool DiscreteAdjoint; /*!< \brief AD-based discrete adjoint mode. */ + bool DiscreteAdjoint; /*!< \brief AD-based discrete adjoint mode. */ su2double Const_DES; /*!< \brief Detached Eddy Simulation Constant. */ unsigned short Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */ unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */ @@ -1011,19 +987,21 @@ class CConfig { bool SpatialFourier; /*!< \brief option for computing the fourier transforms for subsonic non-reflecting BC. */ bool RampRotatingFrame; /*!< \brief option for ramping up or down the Rotating Frame values */ bool RampOutletPressure; /*!< \brief option for ramping up or down the outlet pressure */ - su2double *Mixedout_Coeff; /*!< \brief coefficient for the */ - su2double *RampRotatingFrame_Coeff; /*!< \brief coefficient for Rotating frame ramp */ - su2double *RampOutletPressure_Coeff; /*!< \brief coefficient for outlet pressure ramp */ su2double AverageMachLimit; /*!< \brief option for turbulent mixingplane */ su2double FinalRotation_Rate_Z; /*!< \brief Final rotation rate Z if Ramp rotating frame is activated. */ su2double FinalOutletPressure; /*!< \brief Final outlet pressure if Ramp outlet pressure is activated. */ su2double MonitorOutletPressure; /*!< \brief Monitor outlet pressure if Ramp outlet pressure is activated. */ - array default_cp_polycoeffs{{0.0}}; /*!< \brief Array for specific heat polynomial coefficients. */ - array default_mu_polycoeffs{{0.0}}; /*!< \brief Array for viscosity polynomial coefficients. */ - array default_kt_polycoeffs{{0.0}}; /*!< \brief Array for thermal conductivity polynomial coefficients. */ - su2double *ExtraRelFacGiles; /*!< \brief coefficient for extra relaxation factor for Giles BC*/ + array cp_polycoeffs{{0.0}}; /*!< \brief Array for specific heat polynomial coefficients. */ + array mu_polycoeffs{{0.0}}; /*!< \brief Array for viscosity polynomial coefficients. */ + array kt_polycoeffs{{0.0}}; /*!< \brief Array for thermal conductivity polynomial coefficients. */ bool Body_Force; /*!< \brief Flag to know if a body force is included in the formulation. */ - su2double *Body_Force_Vector; /*!< \brief Values of the prescribed body force vector. */ + + unsigned short Kind_Streamwise_Periodic; /*!< \brief Kind of Streamwise periodic flow (pressure drop or massflow) */ + bool Streamwise_Periodic_Temperature; /*!< \brief Use real periodicity for Energy equation or otherwise outlet source term. */ + su2double Streamwise_Periodic_PressureDrop; /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */ + su2double Streamwise_Periodic_TargetMassFlow; /*!< \brief Value of prescribed massflow [kg/s] which results in an delta p and therefore an artificial body force vector. */ + su2double Streamwise_Periodic_OutletHeat; /*!< /brief Heatflux boundary [W/m^2] imposed at streamwise periodic outlet. */ + su2double *FreeStreamTurboNormal; /*!< \brief Direction to initialize the flow in turbomachinery computation */ su2double Restart_Bandwidth_Agg; /*!< \brief The aggregate of the bandwidth for writing binary restarts (to be averaged later). */ su2double Max_Vel2; /*!< \brief The maximum velocity^2 in the domain for the incompressible preconditioner. */ @@ -1040,11 +1018,9 @@ class CConfig { *top_optim_filter_radius; /*!< \brief Radius of the filter(s) used on the design density for topology optimization. */ unsigned short top_optim_proj_type; /*!< \brief The projection function used in topology optimization. */ su2double top_optim_proj_param; /*!< \brief The value of the parameter for the projection function. */ - bool HeatSource; /*!< \brief Flag to know if there is a volumetric heat source on the flow. */ - su2double ValHeatSource; /*!< \brief Value of the volumetric heat source on the flow (W/m3). */ - su2double Heat_Source_Rot_Z; /*!< \brief Rotation of the volumetric heat source on the Z axis. */ - su2double *Heat_Source_Center, /*!< \brief Position of the center of the heat source. */ - *Heat_Source_Axes; /*!< \brief Principal axes (x, y, z) of the ellipsoid containing the heat source. */ + bool HeatSource; /*!< \brief Flag to know if there is a volumetric heat source on the flow. */ + su2double ValHeatSource; /*!< \brief Value of the volumetric heat source on the flow (W/m3). */ + su2double Heat_Source_Rot_Z; /*!< \brief Rotation of the volumetric heat source on the Z axis. */ unsigned short Kind_Radiation; /*!< \brief Kind of radiation model used. */ unsigned short Kind_P1_Init; /*!< \brief Kind of initialization used in the P1 model. */ su2double Absorption_Coeff, /*!< \brief Absorption coefficient of the medium (radiation). */ @@ -1056,33 +1032,33 @@ class CConfig { su2double CFL_Rad; /*!< \brief CFL Number for the radiation solver. */ array default_cfl_adapt; /*!< \brief Default CFL adapt param array for the COption class. */ - su2double default_vel_inf[3], /*!< \brief Default freestream velocity array for the COption class. */ - default_eng_cyl[7], /*!< \brief Default engine box array for the COption class. */ - default_eng_val[5], /*!< \brief Default engine box array values for the COption class. */ - default_jst_coeff[2], /*!< \brief Default artificial dissipation (flow) array for the COption class. */ - default_ffd_coeff[3], /*!< \brief Default artificial dissipation (flow) array for the COption class. */ - default_mixedout_coeff[3], /*!< \brief Default default mixedout algorithm coefficients for the COption class. */ - default_rampRotFrame_coeff[3], /*!< \brief Default ramp rotating frame coefficients for the COption class. */ - default_rampOutPres_coeff[3], /*!< \brief Default ramp outlet pressure coefficients for the COption class. */ - default_jst_adj_coeff[2], /*!< \brief Default artificial dissipation (adjoint) array for the COption class. */ - default_ad_coeff_heat[2], /*!< \brief Default artificial dissipation (heat) array for the COption class. */ - default_obj_coeff[5], /*!< \brief Default objective array for the COption class. */ - default_mesh_box_length[3], /*!< \brief Default mesh box length for the COption class. */ - default_mesh_box_offset[3], /*!< \brief Default mesh box offset for the COption class. */ - default_geo_loc[2], /*!< \brief Default SU2_GEO section locations array for the COption class. */ - default_distortion[2], /*!< \brief Default SU2_GEO section locations array for the COption class. */ - default_ea_lim[3], /*!< \brief Default equivalent area limit array for the COption class. */ - default_grid_fix[6], /*!< \brief Default fixed grid (non-deforming region) array for the COption class. */ - default_htp_axis[2], /*!< \brief Default HTP axis for the COption class. */ - default_ffd_axis[3], /*!< \brief Default FFD axis for the COption class. */ - default_inc_crit[3], /*!< \brief Default incremental criteria array for the COption class. */ - default_extrarelfac[2], /*!< \brief Default extra relaxation factor for Giles BC in the COption class. */ - default_sineload_coeff[3], /*!< \brief Default values for a sine load. */ - default_body_force[3], /*!< \brief Default body force vector for the COption class. */ - 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_roughness[1]; + su2double vel_init[3], /*!< \brief initial velocity array for the COption class. */ + vel_inf[3], /*!< \brief freestream velocity array for the COption class. */ + eng_cyl[7], /*!< \brief engine box array for the COption class. */ + eng_val[5], /*!< \brief engine box array values for the COption class. */ + jst_coeff[2], /*!< \brief artificial dissipation (flow) array for the COption class. */ + ffd_coeff[3], /*!< \brief artificial dissipation (flow) array for the COption class. */ + mixedout_coeff[3], /*!< \brief default mixedout algorithm coefficients for the COption class. */ + rampRotFrame_coeff[3], /*!< \brief ramp rotating frame coefficients for the COption class. */ + rampOutPres_coeff[3], /*!< \brief ramp outlet pressure coefficients for the COption class. */ + jst_adj_coeff[2], /*!< \brief artificial dissipation (adjoint) array for the COption class. */ + ad_coeff_heat[2], /*!< \brief artificial dissipation (heat) array for the COption class. */ + obj_coeff[5], /*!< \brief objective array for the COption class. */ + mesh_box_length[3], /*!< \brief mesh box length for the COption class. */ + mesh_box_offset[3], /*!< \brief mesh box offset for the COption class. */ + geo_loc[2], /*!< \brief SU2_GEO section locations array for the COption class. */ + distortion[2], /*!< \brief SU2_GEO section locations array for the COption class. */ + ea_lim[3], /*!< \brief equivalent area limit array for the COption class. */ + grid_fix[6], /*!< \brief fixed grid (non-deforming region) array for the COption class. */ + htp_axis[2], /*!< \brief HTP axis for the COption class. */ + ffd_axis[3], /*!< \brief FFD axis for the COption class. */ + inc_crit[3], /*!< \brief incremental criteria array for the COption class. */ + extrarelfac[2], /*!< \brief extra relaxation factor for Giles BC in the COption class. */ + sineload_coeff[3], /*!< \brief values for a sine load. */ + body_force[3], /*!< \brief body force vector for the COption class. */ + nacelle_location[5], /*!< \brief Location of the nacelle. */ + hs_axes[3], /*!< \brief principal axes (x, y, z) of the ellipsoid containing the heat source. */ + hs_center[3]; /*!< \brief position of the center of the heat source. */ unsigned short Riemann_Solver_FEM; /*!< \brief Riemann solver chosen for the DG method. */ su2double Quadrature_Factor_Straight; /*!< \brief Factor applied during quadrature of elements with a constant Jacobian. */ @@ -1218,7 +1194,9 @@ class CConfig { template void addEnumListOption(const string name, unsigned short & input_size, unsigned short * & option_field, const map & enum_map); - void addDoubleArrayOption(const string name, const int size, su2double * & option_field, su2double * default_value); + void addDoubleArrayOption(const string name, const int size, su2double* option_field); + + void addUShortArrayOption(const string name, const int size, unsigned short* option_field); void addDoubleListOption(const string name, unsigned short & size, su2double * & option_field); @@ -1449,7 +1427,7 @@ class CConfig { * \param[in] index - 0 means x_min, and 1 means x_max. * \return Integration limits for the equivalent area computation. */ - su2double GetEA_IntLimit(unsigned short index) const { return EA_IntLimit[index]; } + su2double GetEA_IntLimit(unsigned short index) const { return ea_lim[index]; } /*! * \brief Get the integration limits for the equivalent area computation. @@ -1468,39 +1446,25 @@ class CConfig { * \brief Get the coordinates where of the box where the grid is going to be deformed. * \return Coordinates where of the box where the grid is going to be deformed. */ - const su2double *GetHold_GridFixed_Coord(void) const { return Hold_GridFixed_Coord; } + const su2double *GetHold_GridFixed_Coord(void) const { return grid_fix; } /*! * \brief Get the values of subsonic engine. * \return Values of subsonic engine. */ - su2double *GetSubsonicEngine_Values(void) { return SubsonicEngine_Values; } + const su2double *GetSubsonicEngine_Values(void) const { return eng_val; } /*! * \brief Get the cycle of a subsonic engine. * \return Cyl of a subsonic engine. */ - su2double *GetSubsonicEngine_Cyl(void) { return SubsonicEngine_Cyl; } + const su2double *GetSubsonicEngine_Cyl(void) const { return eng_cyl; } /*! * \brief Get the distortion rack. * \return Distortion rack. */ - su2double *GetDistortionRack(void) { return DistortionRack; } - - /*! - * \brief Get the power of the dual volume in the grid adaptation sensor. - * \return Power of the dual volume in the grid adaptation sensor. - */ - su2double GetDualVol_Power(void) const { return DualVol_Power; } - - /*! - * \brief Get Information about if there is an analytical definition of the surface for doing the - * grid adaptation. - * \return Definition of the surfaces. NONE implies that there isn't any analytical definition - * and it will use and interpolation. - */ - unsigned short GetAnalytical_Surface(void) const { return Analytical_Surface; } + const su2double *GetDistortionRack(void) const { return distortion; } /*! * \brief Get Description of the geometry to be analyzed @@ -1547,19 +1511,19 @@ class CConfig { * \brief Get the values of the CFL adapation. * \return Value of CFL adapation */ - su2double GetHTP_Axis(unsigned short val_index) const { return HTP_Axis[val_index]; } + su2double GetHTP_Axis(unsigned short val_index) const { return htp_axis[val_index]; } /*! * \brief Get the value of the limits for the sections. * \return Value of the limits for the sections. */ - su2double GetStations_Bounds(unsigned short val_var) const { return Stations_Bounds[val_var]; } + su2double GetStations_Bounds(unsigned short val_var) const { return geo_loc[val_var]; } /*! * \brief Get the value of the vector that connects the cartesian axis with a sherical or cylindrical one. * \return Coordinate of the Axis. */ - su2double GetFFD_Axis(unsigned short val_var) const { return FFD_Axis[val_var]; } + su2double GetFFD_Axis(unsigned short val_var) const { return ffd_axis[val_var]; } /*! * \brief Get the value of the bulk modulus. @@ -1829,8 +1793,8 @@ class CConfig { * \brief Get the vector of the dimensionalized freestream velocity. * \return Dimensionalized freestream velocity vector. */ - su2double* GetVelocity_FreeStream(void) { return Velocity_FreeStream; } - const su2double* GetVelocity_FreeStream(void) const { return Velocity_FreeStream; } + su2double* GetVelocity_FreeStream(void) { return vel_inf; } + const su2double* GetVelocity_FreeStream(void) const { return vel_inf; } /*! * \brief Get the value of the non-dimensionalized freestream temperature. @@ -2019,7 +1983,7 @@ class CConfig { * \brief Get the value of the initial velocity for incompressible flows. * \return Initial velocity for incompressible flows. */ - su2double* GetInc_Velocity_Init(void) { return Inc_Velocity_Init; } + const su2double* GetInc_Velocity_Init(void) const { return vel_init; } /*! * \brief Get the value of the initial temperature for incompressible flows. @@ -2094,11 +2058,15 @@ class CConfig { su2double GetRefNode_Penalty(void) const { return RefNode_Penalty; } /*! - * \brief Decide whether it's necessary to read a reference geometry. - * \return TRUE if it's necessary to read a reference geometry, FALSE otherwise. - */ + * \brief Decide whether it's necessary to read a reference geometry. + */ bool GetRefGeom(void) const { return RefGeom; } + /*! + * \brief Consider only the surface of the reference geometry. + */ + bool GetRefGeomSurf(void) const { return RefGeomSurf; } + /*! * \brief Get the name of the file with the reference geometry of the structural problem. * \return Name of the file with the reference geometry of the structural problem. @@ -2500,7 +2468,7 @@ class CConfig { * \param[in] val_velocity_freestream - Value of the free-stream velocity component. * \param[in] val_dim - Value of the current dimension. */ - void SetVelocity_FreeStream(su2double val_velocity_freestream, unsigned short val_dim) { Velocity_FreeStream[val_dim] = val_velocity_freestream; } + void SetVelocity_FreeStream(su2double val_velocity_freestream, unsigned short val_dim) { vel_inf[val_dim] = val_velocity_freestream; } /*! * \brief Set the Froude number for free surface problems. @@ -2775,7 +2743,7 @@ class CConfig { * \brief Get the kind BSpline Order in i,j,k direction. * \return The kind BSpline Order in i,j,k direction. */ - su2double* GetFFD_BSplineOrder() { return FFD_BSpline_Order;} + const su2double* GetFFD_BSplineOrder() const { return ffd_coeff;} /*! * \brief Get the number of Runge-Kutta steps. @@ -2805,7 +2773,7 @@ class CConfig { * \brief Get the location of the time DOFs for ADER-DG on the interval [-1..1]. * \return The location of the time DOFs used in ADER-DG. */ - su2double *GetTimeDOFsADER_DG(void) { return TimeDOFsADER_DG; } + const su2double *GetTimeDOFsADER_DG(void) const { return TimeDOFsADER_DG; } /*! * \brief Get the number time integration points for ADER-DG. @@ -2817,16 +2785,16 @@ class CConfig { * \brief Get the location of the time integration points for ADER-DG on the interval [-1..1]. * \return The location of the time integration points used in ADER-DG. */ - su2double *GetTimeIntegrationADER_DG(void) { return TimeIntegrationADER_DG; } + const su2double *GetTimeIntegrationADER_DG(void) const { return TimeIntegrationADER_DG; } /*! * \brief Get the weights of the time integration points for ADER-DG. * \return The weights of the time integration points used in ADER-DG. */ - su2double *GetWeightsIntegrationADER_DG(void) { return WeightsIntegrationADER_DG; } + const su2double *GetWeightsIntegrationADER_DG(void) const { return WeightsIntegrationADER_DG; } /*! - * \brief Get the total number of boundary markers including send/receive domains. + * \brief Get the total number of boundary markers of the local process including send/receive domains. * \return Total number of boundary markers. */ unsigned short GetnMarker_All(void) const { return nMarker_All; } @@ -2850,7 +2818,7 @@ class CConfig { unsigned short GetnMarker_SymWall(void) const { return nMarker_SymWall; } /*! - * \brief Get the total number of boundary markers. + * \brief Get the total number of boundary markers in the cfg plus the possible send/receive domains. * \return Total number of boundary markers. */ unsigned short GetnMarker_Max(void) const { return nMarker_Max; } @@ -2946,7 +2914,7 @@ class CConfig { unsigned short GetnMarker_Periodic(void) const { return nMarker_PerBound; } /*! - * \brief Get the total number of heat flux markers. + * \brief Get the total (local) number of heat flux markers. * \return Total number of heat flux markers. */ unsigned short GetnMarker_HeatFlux(void) const { return nMarker_HeatFlux; } @@ -3468,7 +3436,7 @@ class CConfig { * \param[in] val_index - Index of the section. * \return Coordinate of the nacelle location. */ - su2double GetNacelleLocation(unsigned short val_index) const { return NacelleLocation[val_index]; } + su2double GetNacelleLocation(unsigned short val_index) const { return nacelle_location[val_index]; } /*! * \brief Get the number of pre-smoothings in a multigrid strategy. @@ -3802,7 +3770,7 @@ class CConfig { * \param[in] val_index - Index of the array with all polynomial coefficients. * \return Temperature polynomial coefficient for specific heat Cp. */ - su2double GetCp_PolyCoeff(unsigned short val_index) const { return CpPolyCoefficients[val_index]; } + su2double GetCp_PolyCoeff(unsigned short val_index) const { return cp_polycoeffs[val_index]; } /*! * \brief Get the temperature polynomial coefficient for specific heat Cp. @@ -3816,7 +3784,7 @@ class CConfig { * \param[in] val_index - Index of the array with all polynomial coefficients. * \return Temperature polynomial coefficient for viscosity. */ - su2double GetMu_PolyCoeff(unsigned short val_index) const { return MuPolyCoefficients[val_index]; } + su2double GetMu_PolyCoeff(unsigned short val_index) const { return mu_polycoeffs[val_index]; } /*! * \brief Get the temperature polynomial coefficient for viscosity. @@ -3836,7 +3804,7 @@ class CConfig { * \param[in] val_index - Index of the array with all polynomial coefficients. * \return Temperature polynomial coefficient for thermal conductivity. */ - su2double GetKt_PolyCoeff(unsigned short val_index) const { return KtPolyCoefficients[val_index]; } + su2double GetKt_PolyCoeff(unsigned short val_index) const { return kt_polycoeffs[val_index]; } /*! * \brief Get the temperature polynomial coefficient for thermal conductivity. @@ -4015,6 +3983,21 @@ class CConfig { */ bool GetUseVectorization(void) const { return UseVectorization; } + /*! + * \brief Get whether to use a Newton-Krylov method. + */ + bool GetNewtonKrylov(void) const { return NewtonKrylov; } + + /*! + * \brief Get Newton-Krylov integer parameters. + */ + array GetNewtonKrylovIntParam(void) const { return NK_IntParam; } + + /*! + * \brief Get Newton-Krylov floating-point parameters. + */ + array GetNewtonKrylovDblParam(void) const { return NK_DblParam; } + /*! * \brief Get the relaxation coefficient of the linear solver for the implicit formulation. * \return relaxation coefficient of the linear solver for the implicit formulation. @@ -4187,18 +4170,6 @@ class CConfig { */ unsigned short GetKind_SGS_Model(void) const { return Kind_SGS_Model; } - /*! - * \brief Get the kind of adaptation technique. - * \return Kind of adaptation technique. - */ - unsigned short GetKind_Adaptation(void) const { return Kind_Adaptation; } - - /*! - * \brief Get the number of new elements added in the adaptation process. - * \return percentage of new elements that are going to be added in the adaptation. - */ - su2double GetNew_Elem_Adapt(void) const { return New_Elem_Adapt; } - /*! * \brief Get the kind of time integration method. * \note This is the information that the code will use, the method will @@ -4768,7 +4739,7 @@ class CConfig { * \brief Get coeff for Rotating Frame Ramp. * \return coeff Ramp Rotating Frame. */ - su2double GetRampRotatingFrame_Coeff(unsigned short iCoeff) const { return RampRotatingFrame_Coeff[iCoeff];} + su2double GetRampRotatingFrame_Coeff(unsigned short iCoeff) const { return rampRotFrame_coeff[iCoeff];} /*! * \brief Get Rotating Frame Ramp option. @@ -4780,7 +4751,7 @@ class CConfig { * \brief Get coeff for Outlet Pressure Ramp. * \return coeff Ramp Outlet Pressure. */ - su2double GetRampOutletPressure_Coeff(unsigned short iCoeff) const { return RampOutletPressure_Coeff[iCoeff];} + su2double GetRampOutletPressure_Coeff(unsigned short iCoeff) const { return rampOutPres_coeff[iCoeff];} /*! * \brief Get final Outlet Pressure value for the ramp. @@ -4809,13 +4780,13 @@ class CConfig { * \brief Get mixedout coefficients. * \return mixedout coefficient. */ - su2double GetMixedout_Coeff(unsigned short iCoeff) const { return Mixedout_Coeff[iCoeff];} + su2double GetMixedout_Coeff(unsigned short iCoeff) const { return mixedout_coeff[iCoeff];} /*! * \brief Get extra relaxation factor coefficients for the Giels BC. * \return mixedout coefficient. */ - su2double GetExtraRelFacGiles(unsigned short iCoeff) const { return ExtraRelFacGiles[iCoeff];} + su2double GetExtraRelFacGiles(unsigned short iCoeff) const { return extrarelfac[iCoeff];} /*! * \brief Get mach limit for average massflow-based procedure . @@ -5058,7 +5029,7 @@ class CConfig { * calculated using the area averaged outlet values of density, velocity, and pressure. * Gradients are w.r.t density, velocity[3], and pressure. when 2D gradient w.r.t. 3rd component of velocity set to 0. */ - su2double GetCoeff_ObjChainRule(unsigned short iVar) const { return Obj_ChainRuleCoeff[iVar]; } + su2double GetCoeff_ObjChainRule(unsigned short iVar) const { return obj_coeff[iVar]; } /*! * \brief Get the kind of sensitivity smoothing technique. @@ -5207,6 +5178,12 @@ class CConfig { */ unsigned short GetTabular_FileFormat(void) const { return Tab_FileFormat; } + /*! + * \brief Get the output precision to be used in .precision(value) for history and SU2_DOT output. + * \return Output precision. + */ + unsigned short GetOutput_Precision(void) const { return output_precision; } + /*! * \brief Get the format of the output solution. * \return Format of the output solution. @@ -5691,7 +5668,7 @@ class CConfig { * \brief Get the Harmonic Balance frequency pointer. * \return Harmonic Balance Frequency pointer. */ - su2double* GetOmega_HB(void) { return Omega_HB; } + const su2double* GetOmega_HB(void) const { return Omega_HB; } /*! * \brief Get if harmonic balance source term is to be preconditioned @@ -5764,7 +5741,37 @@ class CConfig { * \brief Get a pointer to the body force vector. * \return A pointer to the body force vector. */ - const su2double* GetBody_Force_Vector(void) const { return Body_Force_Vector; } + const su2double* GetBody_Force_Vector(void) const { return body_force; } + + /*! + * \brief Get information about the streamwise periodicity (None, Pressure_Drop, Massflow). + * \return Driving force identification. + */ + unsigned short GetKind_Streamwise_Periodic(void) const { return Kind_Streamwise_Periodic; } + + /*! + * \brief Get information about the streamwise periodicity Energy equation handling. + * \return Real periodic treatment of energy equation. + */ + bool GetStreamwise_Periodic_Temperature(void) const { return Streamwise_Periodic_Temperature; } + + /*! + * \brief Get the value of the artificial periodic outlet heat. + * \return Heat value. + */ + su2double GetStreamwise_Periodic_OutletHeat(void) const { return Streamwise_Periodic_OutletHeat; } + + /*! + * \brief Get the value of the pressure delta from which body force vector is computed. + * \return Delta Pressure for body force computation. + */ + su2double GetStreamwise_Periodic_PressureDrop(void) const { return Streamwise_Periodic_PressureDrop; } + + /*! + * \brief Get the value of the massflow from which body force vector is computed. + * \return Massflow for body force computation. + */ + su2double GetStreamwise_Periodic_TargetMassFlow(void) const { return Streamwise_Periodic_TargetMassFlow; } /*! * \brief Get information about the volumetric heat source. @@ -5794,7 +5801,7 @@ class CConfig { * \brief Get the position of the center of the volumetric heat source. * \return Pointer to the center of the ellipsoid that introduces a volumetric heat source. */ - inline const su2double* GetHeatSource_Center(void) const {return Heat_Source_Center;} + inline const su2double* GetHeatSource_Center(void) const {return hs_center;} /*! * \brief Set the position of the center of the volumetric heat source. @@ -5803,14 +5810,14 @@ class CConfig { * \param[in] z_cent = Z position of the center of the volumetric heat source. */ inline void SetHeatSource_Center(su2double x_cent, su2double y_cent, su2double z_cent) { - Heat_Source_Center[0] = x_cent; Heat_Source_Center[1] = y_cent; Heat_Source_Center[2] = z_cent; + hs_center[0] = x_cent; hs_center[1] = y_cent; hs_center[2] = z_cent; } /*! * \brief Get the radius of the ellipsoid that introduces a volumetric heat source. * \return Pointer to the radii (x, y, z) of the ellipsoid that introduces a volumetric heat source. */ - inline const su2double* GetHeatSource_Axes(void) const {return Heat_Source_Axes;} + inline const su2double* GetHeatSource_Axes(void) const {return hs_axes;} /*! * \brief Get information about the rotational frame. @@ -5824,29 +5831,11 @@ class CConfig { */ bool GetAxisymmetric(void) const { return Axisymmetric; } - /*! - * \brief Get information about the axisymmetric frame. - * \return TRUE if there is a rotational frame; otherwise FALSE. - */ - bool GetDebugMode(void); - /*! * \brief Get information about there is a smoothing of the grid coordinates. * \return TRUE if there is smoothing of the grid coordinates; otherwise FALSE. */ - bool GetAdaptBoundary(void) const { return AdaptBoundary; } - - /*! - * \brief Get information about there is a smoothing of the grid coordinates. - * \return TRUE if there is smoothing of the grid coordinates; otherwise FALSE. - */ - bool GetSmoothNumGrid(void) const { return SmoothNumGrid; } - - /*! - * \brief Set information about there is a smoothing of the grid coordinates. - * \param[in] val_smoothnumgrid - TRUE if there is smoothing of the grid coordinates; otherwise FALSE. - */ - void SetSmoothNumGrid(bool val_smoothnumgrid) { SmoothNumGrid = val_smoothnumgrid; } + unsigned short GetSmoothNumGrid(void) const { return SmoothNumGrid; } /*! * \brief Subtract one to the index of the finest grid (full multigrid strategy). @@ -6202,10 +6191,17 @@ class CConfig { const su2double *GetPeriodicRotAngles(string val_marker) const; /*! - * \brief Translation vector for a rotational periodic boundary. + * \brief Translation vector for a translational periodic boundary. */ const su2double *GetPeriodicTranslation(string val_marker) const; + /*! + * \brief Get the translation vector for a periodic transformation. + * \param[in] val_index - Index corresponding to the periodic transformation. + * \return The translation vector. + */ + const su2double* GetPeriodic_Translation(unsigned short val_index ) const { return Periodic_Translation[val_index]; } + /*! * \brief Get the rotationally periodic donor marker for boundary val_marker. * \return Periodic donor marker from the config information for the marker val_marker. @@ -6396,7 +6392,7 @@ class CConfig { * \param[in] val_index - Index corresponding to the inlet boundary. * \return The inlet velocity vector. */ - su2double* GetInlet_Velocity(string val_index); + const su2double* GetInlet_Velocity(string val_index) const; /*! * \brief Get the mass fraction vector at a supersonic inlet boundary. @@ -6472,7 +6468,7 @@ class CConfig { * \param[in] val_marker - Index corresponding to the Riemann boundary. * \return The Flowdir */ - su2double* GetRiemann_FlowDir(string val_marker); + const su2double* GetRiemann_FlowDir(string val_marker) const; /*! * \brief Get Kind Data of Riemann boundary. @@ -6500,7 +6496,7 @@ class CConfig { * \param[in] val_marker - Index corresponding to the Giles BC. * \return The Flowdir */ - su2double* GetGiles_FlowDir(string val_marker); + const su2double* GetGiles_FlowDir(string val_marker) const; /*! * \brief Get Kind Data for the Giles BC. @@ -6628,7 +6624,7 @@ class CConfig { * \param[in] val_marker - String of the viscous wall marker. * \return Pointer to the integer info for the given marker. */ - unsigned short* GetWallFunction_IntInfo(string val_marker); + const unsigned short* GetWallFunction_IntInfo(string val_marker) const; /*! * \brief Get the additional double info for the wall function treatment @@ -6636,7 +6632,7 @@ class CConfig { * \param[in] val_marker - String of the viscous wall marker. * \return Pointer to the double info for the given marker. */ - su2double* GetWallFunction_DoubleInfo(string val_marker); + const su2double* GetWallFunction_DoubleInfo(string val_marker) const; /*! * \brief Get the type of wall and roughness height on a wall boundary (Heatflux or Isothermal). @@ -8290,7 +8286,7 @@ class CConfig { * * \brief Set freestream turbonormal for initializing solution. */ - su2double* GetFreeStreamTurboNormal(void) { return FreeStreamTurboNormal; } + const su2double* GetFreeStreamTurboNormal(void) const { return FreeStreamTurboNormal; } /*! * @@ -8510,7 +8506,7 @@ class CConfig { * \param[in] val_index - Index corresponding to the load boundary. * \return The pointer to the sine load values. */ - const su2double* GetLoad_Sine(void) const { return SineLoad_Coeff; } + const su2double* GetLoad_Sine(void) const { return sineload_coeff; } /*! * \brief Get the kind of load transfer method we want to use for dynamic problems @@ -8532,6 +8528,11 @@ class CConfig { */ su2double GetTotalDV_Penalty(void) const { return DV_Penalty; } + /*! + * \brief Get the maximum allowed VM stress and KS exponent for the stress penalty objective function. + */ + array GetStressPenaltyParam(void) const { return StressPenaltyParam; } + /*! * \brief Get whether a predictor is used for FSI applications. * \return Bool: determines if predictor is used or not @@ -8602,7 +8603,7 @@ class CConfig { * \brief Get the value of the criteria for applying incremental loading. * \return Value of the log10 of the residual. */ - su2double GetIncLoad_Criteria(unsigned short val_var) const { return IncLoad_Criteria[val_var]; } + su2double GetIncLoad_Criteria(unsigned short val_var) const { return inc_crit[val_var]; } /*! * \brief Get the relaxation method chosen for the simulation @@ -9056,13 +9057,13 @@ class CConfig { * \brief Get the length of the analytic RECTANGLE or BOX grid in the specified coordinate direction. * \return Length the analytic RECTANGLE or BOX grid in the specified coordinate direction. */ - su2double GetMeshBoxLength(unsigned short val_iDim) const { return Mesh_Box_Length[val_iDim]; } + su2double GetMeshBoxLength(unsigned short val_iDim) const { return mesh_box_length[val_iDim]; } /*! * \brief Get the offset from 0.0 of the analytic RECTANGLE or BOX grid in the specified coordinate direction. * \return Offset from 0.0 the analytic RECTANGLE or BOX grid in the specified coordinate direction. */ - su2double GetMeshBoxOffset(unsigned short val_iDim) const { return Mesh_Box_Offset[val_iDim]; } + su2double GetMeshBoxOffset(unsigned short val_iDim) const { return mesh_box_offset[val_iDim]; } /*! * \brief Get the number of screen output variables requested (maximum 6) diff --git a/Common/include/adt/CADTBaseClass.hpp b/Common/include/adt/CADTBaseClass.hpp index d2f88d38c9e4..9cf778354921 100644 --- a/Common/include/adt/CADTBaseClass.hpp +++ b/Common/include/adt/CADTBaseClass.hpp @@ -2,7 +2,7 @@ * \file CADTBaseClass.hpp * \brief Base class for storing an ADT in an arbitrary number of dimensions. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/adt/CADTComparePointClass.hpp b/Common/include/adt/CADTComparePointClass.hpp index a8b8572eef35..2b7663e2086e 100644 --- a/Common/include/adt/CADTComparePointClass.hpp +++ b/Common/include/adt/CADTComparePointClass.hpp @@ -2,7 +2,7 @@ * \file CADTComparePointClass.hpp * \brief subroutines for comparing two points in an alternating digital tree (ADT). * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/adt/CADTElemClass.hpp b/Common/include/adt/CADTElemClass.hpp index 1cdfce581fed..07a61555c9ca 100644 --- a/Common/include/adt/CADTElemClass.hpp +++ b/Common/include/adt/CADTElemClass.hpp @@ -2,7 +2,7 @@ * \file CADTElemClass.hpp * \brief Class for storing an ADT of (linear) elements in an arbitrary number of dimensions. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -35,7 +35,7 @@ * \class CADTElemClass * \brief Class for storing an ADT of (linear) elements in an arbitrary number of dimensions. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CADTElemClass : public CADTBaseClass { private: diff --git a/Common/include/adt/CADTNodeClass.hpp b/Common/include/adt/CADTNodeClass.hpp index 1bb848ae2471..f572cb36fc95 100644 --- a/Common/include/adt/CADTNodeClass.hpp +++ b/Common/include/adt/CADTNodeClass.hpp @@ -2,7 +2,7 @@ * \file CADTNodeClass.hpp * \brief Class for storing the information needed in a node of an ADT. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/adt/CADTPointsOnlyClass.hpp b/Common/include/adt/CADTPointsOnlyClass.hpp index f3131588a943..5370054f5124 100644 --- a/Common/include/adt/CADTPointsOnlyClass.hpp +++ b/Common/include/adt/CADTPointsOnlyClass.hpp @@ -2,7 +2,7 @@ * \file CADTPointsOnlyClass.hpp * \brief Class for storing an ADT of only points in an arbitrary number of dimensions. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/adt/CBBoxTargetClass.hpp b/Common/include/adt/CBBoxTargetClass.hpp index 0bd62b861d76..4c6be23da997 100644 --- a/Common/include/adt/CBBoxTargetClass.hpp +++ b/Common/include/adt/CBBoxTargetClass.hpp @@ -3,7 +3,7 @@ * \brief Class for storing the information of a possible bounding box candidate during a minimum distance search. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for storing the information of a possible bounding box candidate during a minimum distance search. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ struct CBBoxTargetClass { diff --git a/Common/include/basic_types/ad_structure.hpp b/Common/include/basic_types/ad_structure.hpp index 6353ec3046c2..6875896bad45 100644 --- a/Common/include/basic_types/ad_structure.hpp +++ b/Common/include/basic_types/ad_structure.hpp @@ -2,7 +2,7 @@ * \file ad_structure.hpp * \brief Main routines for the algorithmic differentiation (AD) structure. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/basic_types/datatype_structure.hpp b/Common/include/basic_types/datatype_structure.hpp index 58bc9920c3bd..f806c5f6cc46 100644 --- a/Common/include/basic_types/datatype_structure.hpp +++ b/Common/include/basic_types/datatype_structure.hpp @@ -2,7 +2,7 @@ * \file datatype_structure.hpp * \brief Headers for generalized datatypes, defines an interface for AD types. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/containers/C2DContainer.hpp b/Common/include/containers/C2DContainer.hpp index bd7efbf75cc2..4ef2bf1b4ae5 100644 --- a/Common/include/containers/C2DContainer.hpp +++ b/Common/include/containers/C2DContainer.hpp @@ -2,7 +2,7 @@ * \file C2DContainer.hpp * \brief A templated vector/matrix object. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/containers/CFastFindAndEraseQueue.hpp b/Common/include/containers/CFastFindAndEraseQueue.hpp index 90965f39ecbc..d6ffc0db6ef2 100644 --- a/Common/include/containers/CFastFindAndEraseQueue.hpp +++ b/Common/include/containers/CFastFindAndEraseQueue.hpp @@ -3,7 +3,7 @@ * \brief A queue-type container (push back, pop front), but with * fast deletion of arbitrary items (possibly in the middle). * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/containers/CVertexMap.hpp b/Common/include/containers/CVertexMap.hpp index 80afd30d7246..166a3ae2251f 100644 --- a/Common/include/containers/CVertexMap.hpp +++ b/Common/include/containers/CVertexMap.hpp @@ -2,7 +2,7 @@ * \file CVertexMap.hpp * \brief An index to index lookup vector. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/containers/container_decorators.hpp b/Common/include/containers/container_decorators.hpp index 14910d941683..a129ff51e8ae 100644 --- a/Common/include/containers/container_decorators.hpp +++ b/Common/include/containers/container_decorators.hpp @@ -3,7 +3,7 @@ * \brief Collection of small classes that decorate C2DContainer to * augment its functionality, e.g. give it extra dimensions. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/fem/fem_cgns_elements.hpp b/Common/include/fem/fem_cgns_elements.hpp index 511580eb0430..9bd1bde737a9 100644 --- a/Common/include/fem/fem_cgns_elements.hpp +++ b/Common/include/fem/fem_cgns_elements.hpp @@ -4,7 +4,7 @@ * with high order elements. * The functions are in the cgns_elements.cpp file. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -47,7 +47,7 @@ class CBoundaryFace; * \class CCGNSElementType * \brief Class which stores the CGNS element type info for a connectivity section. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CCGNSElementType { diff --git a/Common/include/fem/fem_gauss_jacobi_quadrature.hpp b/Common/include/fem/fem_gauss_jacobi_quadrature.hpp index 2b3413a11050..c8dfeb55f857 100644 --- a/Common/include/fem/fem_gauss_jacobi_quadrature.hpp +++ b/Common/include/fem/fem_gauss_jacobi_quadrature.hpp @@ -6,7 +6,7 @@ All the functions in this class are based on the program JACOBI_RULE of John Burkardt. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -95,7 +95,7 @@ using namespace std; * \brief Class used to determine the quadrature points of the Gauss Jacobi integration rules. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CGaussJacobiQuadrature { public: diff --git a/Common/include/fem/fem_geometry_structure.hpp b/Common/include/fem/fem_geometry_structure.hpp index a719e8134195..a2c9b13a65a2 100644 --- a/Common/include/fem/fem_geometry_structure.hpp +++ b/Common/include/fem/fem_geometry_structure.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for creating the geometrical structure for the FEM solver. * The subroutines and functions are in the fem_geometry_structure.cpp file. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -41,7 +41,7 @@ using namespace std; /*! * \class CLong3T * \brief Help class used to store three longs as one entity. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ struct CLong3T { long long0 = 0; /*!< \brief First long to store in this class. */ @@ -59,7 +59,7 @@ struct CLong3T { * \class CReorderElements * \brief Class, used to reorder the owned elements after the partitioning. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CReorderElements { private: @@ -131,7 +131,7 @@ class CReorderElements { * \brief Functor, used for a different sorting of the faces than the < operator * of CFaceOfElement. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CVolumeElementFEM; // Forward declaration to avoid problems. class CSortFaces { @@ -172,7 +172,7 @@ class CSortFaces { * \brief Functor, used for a different sorting of the faces than the < operator * of CSurfaceElementFEM. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ struct CSurfaceElementFEM; // Forward declaration to avoid problems. struct CSortBoundaryFaces { @@ -189,7 +189,7 @@ struct CSortBoundaryFaces { * \class CVolumeElementFEM * \brief Class to store a volume element for the FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CVolumeElementFEM { public: @@ -283,7 +283,7 @@ class CVolumeElementFEM { * \class CPointFEM * \brief Class to a point for the FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ struct CPointFEM { unsigned long globalID; /*!< \brief The global ID of this point in the grid. */ @@ -308,7 +308,7 @@ struct CPointFEM { * \class CInternalFaceElementFEM * \brief Class to store an internal face for the FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ struct CInternalFaceElementFEM { unsigned short VTK_Type; /*!< \brief Element type using the VTK convention. */ @@ -353,7 +353,7 @@ struct CInternalFaceElementFEM { * \class CSurfaceElementFEM * \brief Class to store a surface element for the FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ struct CSurfaceElementFEM { unsigned short VTK_Type; /*!< \brief Element type using the VTK convention. */ @@ -415,7 +415,7 @@ struct CSurfaceElementFEM { * \class CBoundaryFEM * \brief Class to store a boundary for the FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ struct CBoundaryFEM { string markerTag; /*!< \brief Marker tag of this boundary. */ @@ -438,7 +438,7 @@ struct CBoundaryFEM { * \class CMeshFEM * \brief Base class for the FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CMeshFEM: public CGeometry { protected: @@ -712,7 +712,7 @@ class CMeshFEM: public CGeometry { * \class CMeshFEM_DG * \brief Class which contains all the variables for the DG FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CMeshFEM_DG: public CMeshFEM { protected: diff --git a/Common/include/fem/fem_standard_element.hpp b/Common/include/fem/fem_standard_element.hpp index 549d2b7b8bc0..28622a6b9c6b 100644 --- a/Common/include/fem/fem_standard_element.hpp +++ b/Common/include/fem/fem_standard_element.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main functions for the FEM standard elements. * The functions are in the fem_standard_element.cpp file. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -40,7 +40,7 @@ using namespace std; * \class CFEMStandardElementBase * \brief Base class for a FEM standard element. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEMStandardElementBase { protected: @@ -781,7 +781,7 @@ class CFEMStandardElementBase { * \class CFEMStandardElement * \brief Class to define a FEM standard element. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEMStandardElement : public CFEMStandardElementBase { private: @@ -1220,7 +1220,7 @@ class CFEMStandardElement : public CFEMStandardElementBase { * \class CFEMStandardInternalFace * \brief Class to define a FEM standard internal face. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEMStandardInternalFace : public CFEMStandardElementBase { private: @@ -1546,7 +1546,7 @@ class CFEMStandardInternalFace : public CFEMStandardElementBase { * \class CFEMStandardBoundaryFace * \brief Class to define a FEM standard boundary face. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEMStandardBoundaryFace : public CFEMStandardElementBase { private: diff --git a/Common/include/fem/geometry_structure_fem_part.hpp b/Common/include/fem/geometry_structure_fem_part.hpp index c0aef4985290..72d2e76c1301 100644 --- a/Common/include/fem/geometry_structure_fem_part.hpp +++ b/Common/include/fem/geometry_structure_fem_part.hpp @@ -2,7 +2,7 @@ * \file geometry_structure_fem_part.hpp * \brief Helper classes for the Fluid FEM solver. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/CDummyGeometry.hpp b/Common/include/geometry/CDummyGeometry.hpp index 4a6b29dfe0d2..a179257ead3b 100644 --- a/Common/include/geometry/CDummyGeometry.hpp +++ b/Common/include/geometry/CDummyGeometry.hpp @@ -2,7 +2,7 @@ * \file CDummyGeometry.hpp * \brief Headers of the dummy geometry class used in "dry run" mode. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 8a4c89922856..a8549d18d435 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for creating the geometrical structure. * The subroutines and functions are in the CGeometry.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -1711,5 +1711,17 @@ class CGeometry { * \param[out] nNonconvexElements- amount of nonconvex elements in the mesh */ unsigned long GetnNonconvexElements() const {return nNonconvexElements;} + + /*! + * \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet. + * \param[in] config - Definition of the particular problem. + */ + inline virtual void FindUniqueNode_PeriodicBound(const CConfig *config) {} + + /*! + * \brief Get a pointer to the reference node coordinate vector. + * \return A pointer to the reference node coordinate vector. + */ + inline virtual const su2double* GetStreamwise_Periodic_RefNode(void) const { return nullptr; } }; diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index e0883b6d5ae9..516460cccc54 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -2,7 +2,7 @@ * \file CMultiGridGeometry.hpp * \brief Headers of the multigrid geometry class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/CMultiGridQueue.hpp b/Common/include/geometry/CMultiGridQueue.hpp index d521e7f853af..ca16e62a9248 100644 --- a/Common/include/geometry/CMultiGridQueue.hpp +++ b/Common/include/geometry/CMultiGridQueue.hpp @@ -3,7 +3,7 @@ * \brief Header of the multigrid queue class for the FVM solver. * The subroutines and functions are in the CMultiGridQueue.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/CPhysicalGeometry.hpp b/Common/include/geometry/CPhysicalGeometry.hpp index 57bd79fba77d..b231ef8579e7 100644 --- a/Common/include/geometry/CPhysicalGeometry.hpp +++ b/Common/include/geometry/CPhysicalGeometry.hpp @@ -2,7 +2,7 @@ * \file CPhysicalGeometry.hpp * \brief Headers of the physical geometry class used to read meshes from file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -107,6 +107,8 @@ class CPhysicalGeometry final : public CGeometry { vector GlobalMarkerStorageDispl; vector GlobalRoughness_Height; + su2double Streamwise_Periodic_RefNode[MAXNDIM] = {0}; /*!< \brief Coordinates of the reference node [m] on the receiving periodic marker, for recovered pressure/temperature computation only.*/ + public: /*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/ using CGeometry::SetVertex; @@ -784,4 +786,15 @@ class CPhysicalGeometry final : public CGeometry { */ void SetGlobalMarkerRoughness(const CConfig* config); + /*! + * \brief For streamwise periodicity, find & store a unique reference node on the designated periodic inlet. + * \param[in] config - Definition of the particular problem. + */ + void FindUniqueNode_PeriodicBound(const CConfig *config) final; + + /*! + * \brief Get a pointer to the reference node coordinate vector. + * \return A pointer to the reference node coordinate vector. + */ + inline const su2double* GetStreamwise_Periodic_RefNode(void) const final { return Streamwise_Periodic_RefNode;} }; diff --git a/Common/include/geometry/dual_grid/CDualGrid.hpp b/Common/include/geometry/dual_grid/CDualGrid.hpp index 7f51ee3f57b3..052449b277f2 100644 --- a/Common/include/geometry/dual_grid/CDualGrid.hpp +++ b/Common/include/geometry/dual_grid/CDualGrid.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for doing the complete dual grid structure. * The subroutines and functions are in the CDualGrid.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/dual_grid/CEdge.hpp b/Common/include/geometry/dual_grid/CEdge.hpp index 9a9808db4078..f09878a7c4d7 100644 --- a/Common/include/geometry/dual_grid/CEdge.hpp +++ b/Common/include/geometry/dual_grid/CEdge.hpp @@ -2,7 +2,7 @@ * \file CEdge.hpp * \brief Declaration of the edge class CEdge.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/dual_grid/CPoint.hpp b/Common/include/geometry/dual_grid/CPoint.hpp index 2fe1a51a34a4..a7227d4fe7af 100644 --- a/Common/include/geometry/dual_grid/CPoint.hpp +++ b/Common/include/geometry/dual_grid/CPoint.hpp @@ -3,7 +3,7 @@ * \brief Declaration of the point class that stores geometric and adjacency * information for dual control volumes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/dual_grid/CTurboVertex.hpp b/Common/include/geometry/dual_grid/CTurboVertex.hpp index 166ece7e998a..436c7888aced 100644 --- a/Common/include/geometry/dual_grid/CTurboVertex.hpp +++ b/Common/include/geometry/dual_grid/CTurboVertex.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for doing the complete dual grid structure. * The subroutines and functions are in the CTurboVertex.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/dual_grid/CVertex.hpp b/Common/include/geometry/dual_grid/CVertex.hpp index b27ecfc24aea..c7d2e2f0a613 100644 --- a/Common/include/geometry/dual_grid/CVertex.hpp +++ b/Common/include/geometry/dual_grid/CVertex.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for doing the complete dual grid structure. * The subroutines and functions are in the CVertex.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/elements/CElement.hpp b/Common/include/geometry/elements/CElement.hpp index 727da680ec8c..dec7fa99c8f0 100644 --- a/Common/include/geometry/elements/CElement.hpp +++ b/Common/include/geometry/elements/CElement.hpp @@ -3,7 +3,7 @@ * \brief Main header of the Finite Element structure declaring the abstract * interface and the available finite element types. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -470,6 +470,13 @@ class CElement { AD::SetPreaccOut(Mab.data(), nNodes*nNodes); } + /*! + * \brief Register the dead load as a pre-accumulation output. + */ + inline void SetPreaccOut_FDL_a(void) { + AD::SetPreaccOut(FDL_a.data(), nNodes*nDim); + } + }; /*! @@ -742,7 +749,7 @@ class CPYRAM5 final : public CElementWithKnownSizes<5,5,3> { * \class CPRISM6 * \brief Prism element with 6 Gauss Points * \author R. Sanchez, F. Palacios, A. Bueno, T. Economon, S. Padron. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CPRISM6 final : public CElementWithKnownSizes<6,6,3> { private: diff --git a/Common/include/geometry/elements/CElementProperty.hpp b/Common/include/geometry/elements/CElementProperty.hpp index 071681f4360a..7f067e0f6af8 100644 --- a/Common/include/geometry/elements/CElementProperty.hpp +++ b/Common/include/geometry/elements/CElementProperty.hpp @@ -2,7 +2,7 @@ * \file CElementProperty.hpp * \brief Light classes to define finite element properties. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -31,7 +31,7 @@ * \class CProperty * \brief Base class for defining element properties. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CProperty { protected: @@ -106,7 +106,7 @@ class CProperty { * \class CElementProperty * \brief Class for defining element properties for the structural solver. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CElementProperty final : public CProperty { private: diff --git a/Common/include/geometry/elements/CGaussVariable.hpp b/Common/include/geometry/elements/CGaussVariable.hpp index e80782ad2e7b..b54f9716ef0e 100644 --- a/Common/include/geometry/elements/CGaussVariable.hpp +++ b/Common/include/geometry/elements/CGaussVariable.hpp @@ -2,7 +2,7 @@ * \file CGaussVariable.hpp * \brief Light-weight class to store Gaussian point information. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -32,7 +32,7 @@ /*! * \class CGaussVariable * \brief Main class for defining the gaussian points. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CGaussVariable { protected: diff --git a/Common/include/geometry/meshreader/CBoxMeshReaderFVM.hpp b/Common/include/geometry/meshreader/CBoxMeshReaderFVM.hpp index 3c73b9307641..462c99b9d904 100644 --- a/Common/include/geometry/meshreader/CBoxMeshReaderFVM.hpp +++ b/Common/include/geometry/meshreader/CBoxMeshReaderFVM.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CBoxMeshReaderFVM. * The implementations are in the CBoxMeshReaderFVM.cpp file. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp b/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp index 1c8da185d696..3e334b69b308 100644 --- a/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp +++ b/Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CCGNSMeshReaderFVM. * The implementations are in the CCGNSMeshReaderFVM.cpp file. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/meshreader/CMeshReaderFVM.hpp b/Common/include/geometry/meshreader/CMeshReaderFVM.hpp index bde5bf2d6e32..75f609e449cf 100644 --- a/Common/include/geometry/meshreader/CMeshReaderFVM.hpp +++ b/Common/include/geometry/meshreader/CMeshReaderFVM.hpp @@ -4,7 +4,7 @@ * \brief Header file for the class CMeshReaderFVM. * The implementations are in the CMeshReaderFVM.cpp file. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/meshreader/CRectangularMeshReaderFVM.hpp b/Common/include/geometry/meshreader/CRectangularMeshReaderFVM.hpp index 8c56b1407cac..80cd4007cd3b 100644 --- a/Common/include/geometry/meshreader/CRectangularMeshReaderFVM.hpp +++ b/Common/include/geometry/meshreader/CRectangularMeshReaderFVM.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CRectangularMeshReaderFVM. * The implementations are in the CRectangularMeshReaderFVM.cpp file. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/meshreader/CSU2ASCIIMeshReaderFVM.hpp b/Common/include/geometry/meshreader/CSU2ASCIIMeshReaderFVM.hpp index cdd895ed3405..55547d97625e 100644 --- a/Common/include/geometry/meshreader/CSU2ASCIIMeshReaderFVM.hpp +++ b/Common/include/geometry/meshreader/CSU2ASCIIMeshReaderFVM.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CSU2ASCIIMeshReaderFVM. * The implementations are in the CSU2ASCIIMeshReaderFVM.cpp file. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CHexahedron.hpp b/Common/include/geometry/primal_grid/CHexahedron.hpp index 6311fde85383..8c0f4ecbe82d 100644 --- a/Common/include/geometry/primal_grid/CHexahedron.hpp +++ b/Common/include/geometry/primal_grid/CHexahedron.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CHexahedron.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CLine.hpp b/Common/include/geometry/primal_grid/CLine.hpp index 7254535436a5..01abde6ca4b8 100644 --- a/Common/include/geometry/primal_grid/CLine.hpp +++ b/Common/include/geometry/primal_grid/CLine.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CLine.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CPrimalGrid.hpp b/Common/include/geometry/primal_grid/CPrimalGrid.hpp index f99d7ffde477..41fe4b07d387 100644 --- a/Common/include/geometry/primal_grid/CPrimalGrid.hpp +++ b/Common/include/geometry/primal_grid/CPrimalGrid.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the primal_grid_structure.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CPrimalGridBoundFEM.hpp b/Common/include/geometry/primal_grid/CPrimalGridBoundFEM.hpp index b784607f3f6f..e24acc3ae9a1 100644 --- a/Common/include/geometry/primal_grid/CPrimalGridBoundFEM.hpp +++ b/Common/include/geometry/primal_grid/CPrimalGridBoundFEM.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CPrimalGridBoundFEM.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -33,7 +33,7 @@ /*! * \class CPrimalGridBoundFEM * \brief Class to define primal grid boundary element for the FEM solver. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CPrimalGridBoundFEM final: public CPrimalGrid { private: diff --git a/Common/include/geometry/primal_grid/CPrimalGridFEM.hpp b/Common/include/geometry/primal_grid/CPrimalGridFEM.hpp index 06e0f73ad0a9..f271f55b398c 100644 --- a/Common/include/geometry/primal_grid/CPrimalGridFEM.hpp +++ b/Common/include/geometry/primal_grid/CPrimalGridFEM.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CPrimalGridFEM.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -33,7 +33,7 @@ /*! * \class CPrimalGridFEM * \brief Class to define primal grid element for the FEM solver. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CPrimalGridFEM final: public CPrimalGrid { private: diff --git a/Common/include/geometry/primal_grid/CPrism.hpp b/Common/include/geometry/primal_grid/CPrism.hpp index 3968c87c8fd4..bfc59dd07193 100644 --- a/Common/include/geometry/primal_grid/CPrism.hpp +++ b/Common/include/geometry/primal_grid/CPrism.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CPrism.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CPyramid.hpp b/Common/include/geometry/primal_grid/CPyramid.hpp index b34a8cd7fd33..180266557f90 100644 --- a/Common/include/geometry/primal_grid/CPyramid.hpp +++ b/Common/include/geometry/primal_grid/CPyramid.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CPyramid.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CQuadrilateral.hpp b/Common/include/geometry/primal_grid/CQuadrilateral.hpp index 3e828977060b..23c2d301a667 100644 --- a/Common/include/geometry/primal_grid/CQuadrilateral.hpp +++ b/Common/include/geometry/primal_grid/CQuadrilateral.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CQuadrilateral.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CTetrahedron.hpp b/Common/include/geometry/primal_grid/CTetrahedron.hpp index 95a11b9394ae..508d937236f0 100644 --- a/Common/include/geometry/primal_grid/CTetrahedron.hpp +++ b/Common/include/geometry/primal_grid/CTetrahedron.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CTetrahedron.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CTriangle.hpp b/Common/include/geometry/primal_grid/CTriangle.hpp index ab333e162db2..a2a0e7b9be4b 100644 --- a/Common/include/geometry/primal_grid/CTriangle.hpp +++ b/Common/include/geometry/primal_grid/CTriangle.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the CTriangle.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/geometry/primal_grid/CVertexMPI.hpp b/Common/include/geometry/primal_grid/CVertexMPI.hpp index fa1b9b779b90..e6c5c04355a4 100644 --- a/Common/include/geometry/primal_grid/CVertexMPI.hpp +++ b/Common/include/geometry/primal_grid/CVertexMPI.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for storing the primal grid structure. * The subroutines and functions are in the primal_grid_structure.cpp file. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/graph_coloring_structure.hpp b/Common/include/graph_coloring_structure.hpp index f6179507738a..aeea3385eb91 100644 --- a/Common/include/graph_coloring_structure.hpp +++ b/Common/include/graph_coloring_structure.hpp @@ -4,7 +4,7 @@ * coloring of a given graph. The functions are in the * graph_coloring_structure.cpp file. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -40,7 +40,7 @@ using namespace std; * \class CGraphColoringStructure * \brief Class, which provides graph coloring algorithms. * \author: E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CGraphColoringStructure { public: diff --git a/Common/include/grid_movement/CBSplineBlending.hpp b/Common/include/grid_movement/CBSplineBlending.hpp index bc829b3be099..a67b0367ba06 100644 --- a/Common/include/grid_movement/CBSplineBlending.hpp +++ b/Common/include/grid_movement/CBSplineBlending.hpp @@ -3,7 +3,7 @@ * \brief Headers of the CBSplineBlending class. * Defines blending using uniform BSplines * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/grid_movement/CBezierBlending.hpp b/Common/include/grid_movement/CBezierBlending.hpp index 137e2b9247b3..b2ee0712b48b 100644 --- a/Common/include/grid_movement/CBezierBlending.hpp +++ b/Common/include/grid_movement/CBezierBlending.hpp @@ -3,7 +3,7 @@ * \brief Headers of the CBezierBlending class. * Defines blending using Bernsteinpolynomials (Bezier Curves) * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/grid_movement/CFreeFormBlending.hpp b/Common/include/grid_movement/CFreeFormBlending.hpp index a54366b834b9..3e46b5485999 100644 --- a/Common/include/grid_movement/CFreeFormBlending.hpp +++ b/Common/include/grid_movement/CFreeFormBlending.hpp @@ -3,7 +3,7 @@ * \brief Headers of the CFreeFormBlending class. * It is the parent class for the FFD blending function * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/grid_movement/CFreeFormDefBox.hpp b/Common/include/grid_movement/CFreeFormDefBox.hpp index aa914da34087..fabbe85dab69 100644 --- a/Common/include/grid_movement/CFreeFormDefBox.hpp +++ b/Common/include/grid_movement/CFreeFormDefBox.hpp @@ -2,7 +2,7 @@ * \file CFreeFormDefBox.hpp * \brief Headers of the CFreeFormDefBox class. * \author F. Palacios & A. Galdran. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/grid_movement/CGridMovement.hpp b/Common/include/grid_movement/CGridMovement.hpp index b3ad2d7a1ff2..b88b151c997b 100644 --- a/Common/include/grid_movement/CGridMovement.hpp +++ b/Common/include/grid_movement/CGridMovement.hpp @@ -2,7 +2,7 @@ * \file CGridMovement.hpp * \brief Headers of the CGridMovement class * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/grid_movement/CSurfaceMovement.hpp b/Common/include/grid_movement/CSurfaceMovement.hpp index 09cf4d6514b7..c1ecf20c78f9 100644 --- a/Common/include/grid_movement/CSurfaceMovement.hpp +++ b/Common/include/grid_movement/CSurfaceMovement.hpp @@ -2,7 +2,7 @@ * \file CSurfaceMovement.hpp * \brief Headers of the CSurfaceMovement class. * \author F. Palacios, T. Economon. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/grid_movement/CVolumetricMovement.hpp b/Common/include/grid_movement/CVolumetricMovement.hpp index 8de7f01c30fa..78137e3362fe 100644 --- a/Common/include/grid_movement/CVolumetricMovement.hpp +++ b/Common/include/grid_movement/CVolumetricMovement.hpp @@ -2,7 +2,7 @@ * \file CVolumetricMovement.hpp * \brief Headers of the CVolumetricMovement class. * \author F. Palacios, A. Bueno, T. Economon, S. Padron. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/interface_interpolation/CInterpolator.hpp b/Common/include/interface_interpolation/CInterpolator.hpp index 3404f32688b4..9065a18e9519 100644 --- a/Common/include/interface_interpolation/CInterpolator.hpp +++ b/Common/include/interface_interpolation/CInterpolator.hpp @@ -2,7 +2,7 @@ * \file CInterpolator.hpp * \brief Base class for multiphysics interpolation. * \author H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/interface_interpolation/CInterpolatorFactory.hpp b/Common/include/interface_interpolation/CInterpolatorFactory.hpp index c1a77bfc5021..cf7498b2aff7 100644 --- a/Common/include/interface_interpolation/CInterpolatorFactory.hpp +++ b/Common/include/interface_interpolation/CInterpolatorFactory.hpp @@ -1,7 +1,7 @@ /*! * \file CInterpolatorFactory.hpp * \brief Factory to generate interpolator objects. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/interface_interpolation/CIsoparametric.hpp b/Common/include/interface_interpolation/CIsoparametric.hpp index d1205c744b72..b3517b078c9c 100644 --- a/Common/include/interface_interpolation/CIsoparametric.hpp +++ b/Common/include/interface_interpolation/CIsoparametric.hpp @@ -2,7 +2,7 @@ * \file CIsoparametric.hpp * \brief Isoparametric interpolation using FE shape functions. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/interface_interpolation/CMirror.hpp b/Common/include/interface_interpolation/CMirror.hpp index 36e8c78664cb..9908a45f6ca4 100644 --- a/Common/include/interface_interpolation/CMirror.hpp +++ b/Common/include/interface_interpolation/CMirror.hpp @@ -2,7 +2,7 @@ * \file CMirror.hpp * \brief Mirror interpolation for the conservative (work-wise) approach in FSI problems. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/interface_interpolation/CNearestNeighbor.hpp b/Common/include/interface_interpolation/CNearestNeighbor.hpp index c9b17e5585d5..33e74a7dc882 100644 --- a/Common/include/interface_interpolation/CNearestNeighbor.hpp +++ b/Common/include/interface_interpolation/CNearestNeighbor.hpp @@ -2,7 +2,7 @@ * \file CNearestNeighbor.hpp * \brief Nearest Neighbor interpolation class. * \author H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/interface_interpolation/CRadialBasisFunction.hpp b/Common/include/interface_interpolation/CRadialBasisFunction.hpp index 6a3d96d252c7..bc50ad1c23ed 100644 --- a/Common/include/interface_interpolation/CRadialBasisFunction.hpp +++ b/Common/include/interface_interpolation/CRadialBasisFunction.hpp @@ -2,7 +2,7 @@ * \file CRadialBasisFunction.hpp * \brief Radial basis function interpolation. * \author Joel Ho, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/interface_interpolation/CSlidingMesh.hpp b/Common/include/interface_interpolation/CSlidingMesh.hpp index b9bc8ef2557d..8adcc4a79e94 100644 --- a/Common/include/interface_interpolation/CSlidingMesh.hpp +++ b/Common/include/interface_interpolation/CSlidingMesh.hpp @@ -2,7 +2,7 @@ * \file CSlidingMesh.hpp * \brief Sliding mesh interpolation. * \author H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/linear_algebra/CMatrixVectorProduct.hpp b/Common/include/linear_algebra/CMatrixVectorProduct.hpp index e3e9e9f60d74..53cf338570fd 100644 --- a/Common/include/linear_algebra/CMatrixVectorProduct.hpp +++ b/Common/include/linear_algebra/CMatrixVectorProduct.hpp @@ -3,7 +3,7 @@ * \brief Headers for the classes related to sparse matrix-vector product wrappers. * The actual operations are currently implemented mostly by CSysMatrix. * \author F. Palacios, J. Hicken, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/linear_algebra/CPastixWrapper.hpp b/Common/include/linear_algebra/CPastixWrapper.hpp index 3f7a87ecf5f6..e494053c845a 100644 --- a/Common/include/linear_algebra/CPastixWrapper.hpp +++ b/Common/include/linear_algebra/CPastixWrapper.hpp @@ -3,7 +3,7 @@ * \brief An interface to the INRIA solver PaStiX * (http://pastix.gforge.inria.fr/files/README-txt.html) * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -93,7 +93,7 @@ class CPastixWrapper * \brief Run the external solver for the task it is currently setup to execute. */ void Run() { - dpastix(&state, MPI_COMM_WORLD, nCols, colptr.data(), rowidx.data(), values.data(), + dpastix(&state, SU2_MPI::GetComm(), nCols, colptr.data(), rowidx.data(), values.data(), loc2glb.data(), perm.data(), NULL, workvec.data(), 1, iparm, dparm); } diff --git a/Common/include/linear_algebra/CPreconditioner.hpp b/Common/include/linear_algebra/CPreconditioner.hpp index b79dcc916ee4..d2ca29cb45b5 100644 --- a/Common/include/linear_algebra/CPreconditioner.hpp +++ b/Common/include/linear_algebra/CPreconditioner.hpp @@ -3,7 +3,7 @@ * \brief Classes related to linear preconditioner wrappers. * The actual operations are currently implemented mostly by CSysMatrix. * \author F. Palacios, J. Hicken, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/linear_algebra/CSysMatrix.hpp b/Common/include/linear_algebra/CSysMatrix.hpp index 44f5afe1f893..cf26885d2fa2 100644 --- a/Common/include/linear_algebra/CSysMatrix.hpp +++ b/Common/include/linear_algebra/CSysMatrix.hpp @@ -3,7 +3,7 @@ * \brief Declaration of the block-sparse matrix class. * The implemtation is in CSysMatrix.cpp. * \author F. Palacios, A. Bueno, T. Economon, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -28,9 +28,7 @@ #pragma once -#include "../../include/parallelization/mpi_structure.hpp" -#include "../../include/parallelization/omp_structure.hpp" -#include "../../include/parallelization/vectorization.hpp" +#include "../../include/CConfig.hpp" #include "CSysVector.hpp" #include "CPastixWrapper.hpp" @@ -75,9 +73,34 @@ struct mkl_jit_wrapper { #endif #endif -class CConfig; class CGeometry; +struct CSysMatrixComms { + /*! + * \brief Routine to load a vector quantity into the data structures for MPI point-to-point + * communication and to launch non-blocking sends and recvs. + * \param[in] x - CSysVector holding the array of data. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] commType - Enumerated type for the quantity to be communicated. + */ + template + static void Initiate(const CSysVector& x, CGeometry *geometry, const CConfig *config, + unsigned short commType = SOLUTION_MATRIX); + + /*! + * \brief Routine to complete the set of non-blocking communications launched by + * Initiate() and unpacking of the data in the vector. + * \param[in] x - CSysVector holding the array of data. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \param[in] commType - Enumerated type for the quantity to be unpacked. + */ + template + static void Complete(CSysVector& x, CGeometry *geometry, const CConfig *config, + unsigned short commType = SOLUTION_MATRIX); +}; + /*! * \class CSysMatrix * \brief Main class for defining block-compressed-row-storage sparse matrices. @@ -85,6 +108,8 @@ class CGeometry; template class CSysMatrix { private: + friend class CSysMatrixComms; + const int rank; /*!< \brief MPI Rank. */ const int size; /*!< \brief MPI Size. */ @@ -163,9 +188,11 @@ class CSysMatrix { /*! * \brief Handle type conversion for when we Set, Add, etc. blocks, preserving derivative information (if supported by types). - * \note See specialization for discrete adjoint right outside this class's declaration. */ - template + template::value> = 0> + FORCEINLINE static DstType ActiveAssign(const SrcType& val) { return SU2_TYPE::GetValue(val); } + + template::value> = 0> FORCEINLINE static DstType ActiveAssign(const SrcType& val) { return val; } /*! @@ -378,34 +405,6 @@ class CSysMatrix { */ void SetValDiagonalZero(void); - /*! - * \brief Routine to load a vector quantity into the data structures for MPI point-to-point - * communication and to launch non-blocking sends and recvs. - * \param[in] x - CSysVector holding the array of data. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - * \param[in] commType - Enumerated type for the quantity to be communicated. - */ - template - void InitiateComms(const CSysVector & x, - CGeometry *geometry, - const CConfig *config, - unsigned short commType) const; - - /*! - * \brief Routine to complete the set of non-blocking communications launched by - * InitiateComms() and unpacking of the data in the vector. - * \param[in] x - CSysVector holding the array of data. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - * \param[in] commType - Enumerated type for the quantity to be unpacked. - */ - template - void CompleteComms(CSysVector & x, - CGeometry *geometry, - const CConfig *config, - unsigned short commType) const; - /*! * \brief Get a pointer to the start of block "ij" * \param[in] block_i - Row index. @@ -708,8 +707,8 @@ class CSysMatrix { * \param[in] val_block - Block to add to the diagonal of the matrix. * \param[in] alpha - Scale factor. */ - template - inline void SetBlock2Diag(unsigned long block_i, const OtherType* const* val_block, OtherType alpha = 1.0) { + template + inline void SetBlock2Diag(unsigned long block_i, const OtherType& val_block, T alpha = 1.0) { auto mat_ii = &matrix[dia_ptr[block_i]*nVar*nEqn]; @@ -723,8 +722,8 @@ class CSysMatrix { /*! * \brief Non overwrite version of SetBlock2Diag, also with scaling. */ - template - inline void AddBlock2Diag(unsigned long block_i, const OtherType* const* val_block, OtherType alpha = 1.0) { + template + inline void AddBlock2Diag(unsigned long block_i, const OtherType& val_block, T alpha = 1.0) { SetBlock2Diag(block_i, val_block, alpha); } @@ -732,8 +731,8 @@ class CSysMatrix { * \brief Short-hand to AddBlock2Diag with alpha = -1, i.e. subtracts from the current diagonal. */ template - inline void SubtractBlock2Diag(unsigned long block_i, const OtherType* const* val_block) { - AddBlock2Diag(block_i, val_block, OtherType(-1)); + inline void SubtractBlock2Diag(unsigned long block_i, const OtherType& val_block) { + AddBlock2Diag(block_i, val_block, -1.0); } /*! @@ -748,6 +747,18 @@ class CSysMatrix { matrix[dia_ptr[block_i]*nVar*nVar + iVar*(nVar+1)] += PassiveAssign(val_matrix); } + /*! + * \brief Adds the specified value to the diagonal of the (i, i) subblock + * of the matrix-by-blocks structure. + * \param[in] block_i - Diagonal index. + * \param[in] iVar - Variable index. + * \param[in] val - Value to add to the diagonal elements of A(i, i). + */ + template + inline void AddVal2Diag(unsigned long block_i, unsigned long iVar, OtherType val) { + matrix[dia_ptr[block_i]*nVar*nVar + iVar*(nVar+1)] += PassiveAssign(val); + } + /*! * \brief Sets the specified value to the diagonal of the (i, i) subblock * of the matrix-by-blocks structure. @@ -906,8 +917,3 @@ class CSysMatrix { CGeometry *geometry, const CConfig *config) const; }; - -#ifdef CODI_REVERSE_TYPE -template<> template<> -FORCEINLINE su2mixedfloat CSysMatrix::ActiveAssign(const su2double& val) { return SU2_TYPE::GetValue(val); } -#endif diff --git a/Common/include/linear_algebra/CSysMatrix.inl b/Common/include/linear_algebra/CSysMatrix.inl index 04d84b724cb3..e0738cc9daa8 100644 --- a/Common/include/linear_algebra/CSysMatrix.inl +++ b/Common/include/linear_algebra/CSysMatrix.inl @@ -5,7 +5,7 @@ * of the .cpp file and so they are hidden to avoid triggering * recompilation of other units when changes are made here. * \author F. Palacios, A. Bueno, T. Economon, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/linear_algebra/CSysSolve.hpp b/Common/include/linear_algebra/CSysSolve.hpp index d3a507f6a4f7..ecfb4a3a789e 100644 --- a/Common/include/linear_algebra/CSysSolve.hpp +++ b/Common/include/linear_algebra/CSysSolve.hpp @@ -3,7 +3,7 @@ * \brief Headers for the classes related to linear solvers (CG, FGMRES, etc) * The subroutines and functions are in the CSysSolve.cpp file. * \author J. Hicken, F. Palacios, T. Economon, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -81,7 +81,6 @@ class CSysSolve { mutable bool cg_ready; /*!< \brief Indicate if memory used by CG is allocated. */ mutable bool bcg_ready; /*!< \brief Indicate if memory used by BCGSTAB is allocated. */ - mutable bool gmres_ready; /*!< \brief Indicate if memory used by FGMRES is allocated. */ mutable bool smooth_ready; /*!< \brief Indicate if memory used by SMOOTHER is allocated. */ mutable VectorType r; /*!< \brief Residual in CG and BCGSTAB. */ @@ -101,6 +100,9 @@ class CSysSolve { const VectorType* LinSysRes_ptr; /*!< \brief Pointer to appropriate LinSysRes (set to original or temporary in call to Solve). */ LinearToleranceType tol_type = LinearToleranceType::RELATIVE; /*!< \brief How the linear solvers interpret the tolerance. */ + bool xIsZero = false; /*!< \brief If true assume the initial solution is always 0. */ + bool recomputeRes = false; /*!< \brief Recompute the residual after inner iterations, if monitoring. */ + unsigned long monitorFreq = 10; /*!< \brief Monitoring frequency. */ /*! * \brief sign transfer function @@ -388,4 +390,19 @@ class CSysSolve { */ inline void SetToleranceType(LinearToleranceType type) {tol_type = type;} + /*! + * \brief Assume the initial solution is 0 to save one product, or don't. + */ + inline void SetxIsZero(bool isZero) {xIsZero = isZero;} + + /*! + * \brief Set whether to recompute residuals at the end (while monitoring only). + */ + inline void SetRecomputeResidual(bool recompRes) {recomputeRes = recompRes;} + + /*! + * \brief Set the screen output frequency during monitoring. + */ + inline void SetMonitoringFrequency(bool frequency) {monitorFreq = frequency;} + }; diff --git a/Common/include/linear_algebra/CSysSolve_b.hpp b/Common/include/linear_algebra/CSysSolve_b.hpp index 87455c5d5657..f37e110845c8 100644 --- a/Common/include/linear_algebra/CSysSolve_b.hpp +++ b/Common/include/linear_algebra/CSysSolve_b.hpp @@ -2,7 +2,7 @@ * \file CSysSolve_b.hpp * \brief Routines for the linear solver used in the reverse sweep of AD. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/linear_algebra/CSysVector.hpp b/Common/include/linear_algebra/CSysVector.hpp index 2896b8ea8784..6a54b84efa17 100644 --- a/Common/include/linear_algebra/CSysVector.hpp +++ b/Common/include/linear_algebra/CSysVector.hpp @@ -3,7 +3,7 @@ * \brief Declararion and inlines of the vector class used in the * solution of large, distributed, sparse linear systems. * \author P. Gomes, F. Palacios, J. Hicken, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -66,7 +66,7 @@ class CSysVector : public VecExpr::CVecExpr, ScalarType> ScalarType* vec_val = nullptr; /*!< \brief Storage, 64 byte aligned (do not use normal new/delete). */ unsigned long nElm = 0; /*!< \brief Total number of elements (or number elements on this processor). */ unsigned long nElmDomain = 0; /*!< \brief Total number of elements without Ghost cells. */ - unsigned long nVar = 0; /*!< \brief Number of elements in a block. */ + unsigned long nVar = 1; /*!< \brief Number of elements in a block. */ /*! * \brief Generic initialization from a scalar or array. @@ -111,7 +111,7 @@ class CSysVector : public VecExpr::CVecExpr, ScalarType> * \param[in] size - Number of elements locally. * \param[in] val - Default value for elements. */ - CSysVector(unsigned long size, ScalarType val = 0.0) { Initialize(size, size, 1, &val, false); } + explicit CSysVector(unsigned long size, ScalarType val = 0.0) { Initialize(size, size, 1, &val, false); } /*! * \brief Construct from size and value (block version). @@ -129,7 +129,7 @@ class CSysVector : public VecExpr::CVecExpr, ScalarType> * \param[in] size - Number of elements locally. * \param[in] u_array - Vector stored as array being copied. */ - explicit CSysVector(unsigned long size, const ScalarType* u_array) { Initialize(size, size, 1, u_array, true); } + CSysVector(unsigned long size, const ScalarType* u_array) { Initialize(size, size, 1, u_array, true); } /*! * \brief Constructor from array (block version). @@ -138,8 +138,7 @@ class CSysVector : public VecExpr::CVecExpr, ScalarType> * \param[in] numVar - number of variables in each block * \param[in] u_array - vector stored as array being copied */ - explicit CSysVector(unsigned long numBlk, unsigned long numBlkDomain, unsigned long numVar, - const ScalarType* u_array) { + CSysVector(unsigned long numBlk, unsigned long numBlkDomain, unsigned long numVar, const ScalarType* u_array) { Initialize(numBlk, numBlkDomain, numVar, u_array, true); } @@ -315,7 +314,7 @@ class CSysVector : public VecExpr::CVecExpr, ScalarType> SU2_OMP_MASTER { sum = dotRes; const auto mpi_type = (sizeof(ScalarType) < sizeof(double)) ? MPI_FLOAT : MPI_DOUBLE; - SelectMPIWrapper::W::Allreduce(&sum, &dotRes, 1, mpi_type, MPI_SUM, MPI_COMM_WORLD); + SelectMPIWrapper::W::Allreduce(&sum, &dotRes, 1, mpi_type, MPI_SUM, SU2_MPI::GetComm()); } } #endif diff --git a/Common/include/linear_algebra/blas_structure.hpp b/Common/include/linear_algebra/blas_structure.hpp index 49e131bc54db..0aea97ce64c2 100644 --- a/Common/include/linear_algebra/blas_structure.hpp +++ b/Common/include/linear_algebra/blas_structure.hpp @@ -4,7 +4,7 @@ operations, which are typically found in the BLAS libraries. The functions are in the blass_structure.cpp file. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -40,7 +40,7 @@ class CConfig; * \class CBlasStructure * \brief Class, which serves as an interface to the BLAS functionalities needed. * \author: E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CBlasStructure { public: diff --git a/Common/include/linear_algebra/vector_expressions.hpp b/Common/include/linear_algebra/vector_expressions.hpp index 3f1b6ed80a66..0df23094f62a 100644 --- a/Common/include/linear_algebra/vector_expressions.hpp +++ b/Common/include/linear_algebra/vector_expressions.hpp @@ -2,7 +2,7 @@ * \file vector_expressions.hpp * \brief Expression templates for vector types with coefficient-wise operations. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 36dc198d4454..49c75bbfad22 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -2,7 +2,7 @@ * \file option_structure.hpp * \brief Defines classes for referencing options for easy input in CConfig * \author J. Hicken, B. Tracey - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -67,7 +67,6 @@ enum SU2_COMPONENT { SU2_CFD = 1, /*!< \brief Running the SU2_CFD software. */ SU2_DEF = 2, /*!< \brief Running the SU2_DEF software. */ SU2_DOT = 3, /*!< \brief Running the SU2_DOT software. */ - SU2_MSH = 4, /*!< \brief Running the SU2_MSH software. */ SU2_GEO = 5, /*!< \brief Running the SU2_GEO software. */ SU2_SOL = 6 /*!< \brief Running the SU2_SOL software. */ }; @@ -78,7 +77,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). */ +enum: unsigned int{MAX_SOLS = 12}; /*!< \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. */ @@ -177,7 +176,6 @@ enum ENUM_MAIN_SOLVER { INC_NAVIER_STOKES =5, /*!< \brief Definition of the incompressible Navier-Stokes' solver. */ INC_RANS = 6, /*!< \brief Definition of the incompressible Reynolds-averaged Navier-Stokes' (RANS) solver. */ HEAT_EQUATION = 7, /*!< \brief Definition of the finite volume heat solver. */ - FLUID_STRUCTURE_INTERACTION = 8, /*!< \brief Definition of a FSI solver. */ FEM_ELASTICITY = 9, /*!< \brief Definition of a FEM solver. */ ADJ_EULER = 10, /*!< \brief Definition of the continuous adjoint Euler's solver. */ ADJ_NAVIER_STOKES = 11, /*!< \brief Definition of the continuous adjoint Navier-Stokes' solver. */ @@ -232,13 +230,12 @@ static const MapType Solver_Map = { MakePair("DISC_ADJ_FEM_RANS", DISC_ADJ_FEM_RANS) MakePair("DISC_ADJ_FEM_NS", DISC_ADJ_FEM_NS) MakePair("DISC_ADJ_FEM", DISC_ADJ_FEM) - MakePair("FLUID_STRUCTURE_INTERACTION", FLUID_STRUCTURE_INTERACTION) MakePair("TEMPLATE_SOLVER", TEMPLATE_SOLVER) MakePair("MULTIPHYSICS", MULTIPHYSICS) }; /*! - * \brief different solver types for the multizone environment component + * \brief Different solver types for multizone problems */ enum ENUM_MULTIZONE { MZ_BLOCK_GAUSS_SEIDEL = 0, /*!< \brief Definition of a Block-Gauss-Seidel multizone solver. */ @@ -442,7 +439,6 @@ 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_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. */ RUNTIME_MULTIGRID_SYS = 14, /*!< \brief Full Approximation Storage Multigrid system of equations. */ @@ -700,7 +696,6 @@ enum ENUM_SURFACEMOVEMENT { MOVING_WALL = 2, /*!< \brief Simulation with moving wall. */ AEROELASTIC = 3, /*!< \brief Simulation with aeroelastic motion. */ AEROELASTIC_RIGID_MOTION = 4, /*!< \brief Simulation with rotation and aeroelastic motion. */ - FLUID_STRUCTURE = 5, /*!< \brief Fluid structure deformation. */ EXTERNAL = 6, /*!< \brief Simulation with external motion. */ EXTERNAL_ROTATION = 7, /*!< \brief Simulation with external rotation motion. */ }; @@ -709,7 +704,6 @@ static const MapType SurfaceMovement_Map = { MakePair("MOVING_WALL", MOVING_WALL) MakePair("AEROELASTIC_RIGID_MOTION", AEROELASTIC_RIGID_MOTION) MakePair("AEROELASTIC", AEROELASTIC) - MakePair("FLUID_STRUCTURE", FLUID_STRUCTURE) MakePair("EXTERNAL", EXTERNAL) MakePair("EXTERNAL_ROTATION", EXTERNAL_ROTATION) }; @@ -1524,7 +1518,8 @@ enum ENUM_OBJECTIVE { REFERENCE_NODE = 61, /*!< \brief Objective function defined as the difference of a particular node respect to a reference position. */ VOLUME_FRACTION = 62, /*!< \brief Volume average physical density, for material-based topology optimization applications. */ TOPOL_DISCRETENESS = 63, /*!< \brief Measure of the discreteness of the current topology. */ - TOPOL_COMPLIANCE = 64 /*!< \brief Measure of the discreteness of the current topology. */ + TOPOL_COMPLIANCE = 64, /*!< \brief Measure of the discreteness of the current topology. */ + STRESS_PENALTY = 65, /*!< \brief Penalty function of VM stresses above a maximum value. */ }; static const MapType Objective_Map = { MakePair("DRAG", DRAG_COEFFICIENT) @@ -1575,6 +1570,7 @@ static const MapType Objective_Map = { MakePair("VOLUME_FRACTION", VOLUME_FRACTION) MakePair("TOPOL_DISCRETENESS", TOPOL_DISCRETENESS) MakePair("TOPOL_COMPLIANCE", TOPOL_COMPLIANCE) + MakePair("STRESS_PENALTY", STRESS_PENALTY) }; /*! @@ -1617,40 +1613,6 @@ static const MapType Sens_Map = { MakePair("SENS_AOS", SENS_AOS) }; -/*! - * \brief Types of grid adaptation/refinement - */ -enum ENUM_ADAPT { - NO_ADAPT = 0, /*!< \brief No grid adaptation. */ - FULL = 1, /*!< \brief Do a complete grid refinement of all the computational grids. */ - FULL_FLOW = 2, /*!< \brief Do a complete grid refinement of the flow grid. */ - FULL_ADJOINT = 3, /*!< \brief Do a complete grid refinement of the adjoint grid. */ - GRAD_FLOW = 5, /*!< \brief Do a gradient based grid adaptation of the flow grid. */ - GRAD_ADJOINT = 6, /*!< \brief Do a gradient based grid adaptation of the adjoint grid. */ - GRAD_FLOW_ADJ = 7, /*!< \brief Do a gradient based grid adaptation of the flow and adjoint grid. */ - COMPUTABLE = 9, /*!< \brief Apply a computable error grid adaptation. */ - REMAINING = 10, /*!< \brief Apply a remaining error grid adaptation. */ - WAKE = 12, /*!< \brief Do a grid refinement on the wake. */ - SMOOTHING = 14, /*!< \brief Do a grid smoothing of the geometry. */ - SUPERSONIC_SHOCK = 15, /*!< \brief Do a grid smoothing. */ - PERIODIC = 17 /*!< \brief Add the periodic halo cells. */ -}; -static const MapType Adapt_Map = { - MakePair("NONE", NO_ADAPT) - MakePair("FULL", FULL) - MakePair("FULL_FLOW", FULL_FLOW) - MakePair("FULL_ADJOINT", FULL_ADJOINT) - MakePair("GRAD_FLOW", GRAD_FLOW) - MakePair("GRAD_ADJOINT", GRAD_ADJOINT) - MakePair("GRAD_FLOW_ADJ", GRAD_FLOW_ADJ) - MakePair("COMPUTABLE", COMPUTABLE) - MakePair("REMAINING", REMAINING) - MakePair("WAKE", WAKE) - MakePair("SMOOTHING", SMOOTHING) - MakePair("SUPERSONIC_SHOCK", SUPERSONIC_SHOCK) - MakePair("PERIODIC", PERIODIC) -}; - /*! * \brief Types of input file formats */ @@ -2189,8 +2151,6 @@ enum MPI_QUANTITIES { SOLUTION_OLD = 1, /*!< \brief Conservative solution old communication. */ SOLUTION_GRADIENT = 2, /*!< \brief Conservative solution gradient communication. */ SOLUTION_LIMITER = 3, /*!< \brief Conservative solution limiter communication. */ - SOLUTION_PRED = 5, /*!< \brief Solution predicted communication. */ - SOLUTION_PRED_OLD = 6, /*!< \brief Solution predicted old communication. */ SOLUTION_GEOMETRY = 7, /*!< \brief Geometry solution communication. */ PRIMITIVE_GRADIENT = 8, /*!< \brief Primitive gradient communication. */ PRIMITIVE_LIMITER = 9, /*!< \brief Primitive limiter communication. */ @@ -2210,7 +2170,6 @@ enum MPI_QUANTITIES { SOLUTION_MATRIXTRANS = 23, /*!< \brief Matrix transposed solution communication. */ NEIGHBORS = 24, /*!< \brief Neighbor point count communication (for JST). */ SOLUTION_FEA = 25, /*!< \brief FEA solution communication. */ - 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. */ @@ -2297,6 +2256,30 @@ static const MapType Verification_Solution_ MakePair("USER_DEFINED_SOLUTION", USER_DEFINED_SOLUTION) }; +/*! + * \brief Types of streamwise periodicity. + */ +enum ENUM_STREAMWISE_PERIODIC { + NO_STREAMWISE_PERIODIC = 0, /*!< \brief No streamwise periodic flow. */ + PRESSURE_DROP = 1, /*!< \brief Prescribed pressure drop. */ + STREAMWISE_MASSFLOW = 2, /*!< \brief Prescribed massflow. */ +}; +static const MapType Streamwise_Periodic_Map = { + MakePair("NONE", NO_STREAMWISE_PERIODIC) + MakePair("PRESSURE_DROP", PRESSURE_DROP) + MakePair("MASSFLOW", STREAMWISE_MASSFLOW) +}; + +/*! + * \brief Container to hold Variables for streamwise Periodic flow as they are often used together in places. + */ +struct StreamwisePeriodicValues { + su2double Streamwise_Periodic_PressureDrop; /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */ + su2double Streamwise_Periodic_MassFlow; /*!< \brief Value of current massflow [kg/s] which results in a delta p and therefore an artificial body force vector. */ + su2double Streamwise_Periodic_IntegratedHeatFlow; /*!< \brief Value of of the net sum of heatflow [W] into the domain. */ + su2double Streamwise_Periodic_InletTemperature; /*!< \brief Area avg static Temp [K] at the periodic inlet. Used for adaptive outlet heatsink. */ +}; + #undef MakePair /* END_CONFIG_ENUMS */ diff --git a/Common/include/option_structure.inl b/Common/include/option_structure.inl index ff56e139c01b..669419b1f5ec 100644 --- a/Common/include/option_structure.inl +++ b/Common/include/option_structure.inl @@ -3,7 +3,7 @@ * \brief Template derived classes from COption, defined here as we * only include them where needed to reduce compilation time. * \author J. Hicken, B. Tracey - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -334,26 +334,21 @@ public: } }; -class COptionDoubleArray : public COptionBase { - su2double * & field; // Reference to the feildname - string name; // identifier for the option - const int size; - su2double * def; - su2double * vals; - su2double * default_value; +template +class COptionArray : public COptionBase { + string name; // Identifier for the option + const int size; // Number of elements + Type* field; // Reference to the field public: - COptionDoubleArray(string option_field_name, const int list_size, su2double * & option_field, su2double * default_value) : field(option_field), size(list_size) { - this->name = option_field_name; - this->default_value = default_value; - def = nullptr; - vals = nullptr; + COptionArray(string option_field_name, const int list_size, Type* option_field) : + name(option_field_name), + size(list_size), + field(option_field) { } - ~COptionDoubleArray() override { - delete [] def; - delete [] vals; - }; + ~COptionArray() override {}; + string SetValue(vector option_value) override { COptionBase::SetValue(option_value); // Check that the size is correct @@ -371,27 +366,16 @@ public: newstring.append(" found"); return newstring; } - vals = new su2double[this->size]; for (int i = 0; i < this->size; i++) { istringstream is(option_value[i]); - su2double val; - if (!(is >> val)) { - delete [] vals; - return badValue(option_value, "su2double array", this->name); + if (!(is >> field[i])) { + return badValue(option_value, " array", this->name); } - vals[i] = val; } - this->field = vals; return ""; } - void SetDefault() override { - def = new su2double [size]; - for (int i = 0; i < size; i++) { - def[i] = default_value[i]; - } - this->field = def; - } + void SetDefault() override {} }; class COptionDoubleList : public COptionBase { diff --git a/Common/include/parallelization/mpi_structure.cpp b/Common/include/parallelization/mpi_structure.cpp index c707cef4877e..72a06917cbd9 100644 --- a/Common/include/parallelization/mpi_structure.cpp +++ b/Common/include/parallelization/mpi_structure.cpp @@ -2,7 +2,7 @@ * \file mpi_structure.cpp * \brief Main subroutines for the mpi structures. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -27,9 +27,17 @@ #include "mpi_structure.hpp" + +/* Initialise the MPI Communicator Rank and Size */ int CBaseMPIWrapper::Rank = 0; int CBaseMPIWrapper::Size = 1; + +/* Set the default MPI Communicator */ +#ifdef HAVE_MPI CBaseMPIWrapper::Comm CBaseMPIWrapper::currentComm = MPI_COMM_WORLD; +#else +CBaseMPIWrapper::Comm CBaseMPIWrapper::currentComm = 0; // dummy value +#endif #ifdef HAVE_MPI int CBaseMPIWrapper::MinRankError; @@ -114,6 +122,49 @@ void CBaseMPIWrapper::Error(std::string ErrorMsg, std::string FunctionName){ } Abort(currentComm, 0); } + +void CBaseMPIWrapper::CopyData(const void* sendbuf, void* recvbuf, int size, Datatype datatype) { + switch (datatype) { + case MPI_DOUBLE: + for (int i = 0; i < size; i++) { + static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; + } + break; + case MPI_UNSIGNED_LONG: + for (int i = 0; i < size; i++) { + static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; + } + break; + case MPI_LONG: + for (int i = 0; i < size; i++) { + static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; + } + break; + case MPI_UNSIGNED_SHORT: + for (int i = 0; i < size; i++) { + static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; + } + break; + case MPI_CHAR: + for (int i = 0; i < size; i++) { + static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; + } + break; + case MPI_SHORT: + for (int i = 0; i < size; i++) { + static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; + } + break; + case MPI_INT: + for (int i = 0; i < size; i++) { + static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; + } + break; + default: + Error("Unknown type", CURRENT_FUNCTION); + break; + }; +} #endif #ifdef HAVE_MPI diff --git a/Common/include/parallelization/mpi_structure.hpp b/Common/include/parallelization/mpi_structure.hpp index b4640bfbcd93..1ee14c7d2fb7 100644 --- a/Common/include/parallelization/mpi_structure.hpp +++ b/Common/include/parallelization/mpi_structure.hpp @@ -3,7 +3,7 @@ * \brief Headers of the mpi interface for generalized datatypes. * The subroutines and functions are in the mpi_structure.cpp file. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -467,7 +467,6 @@ class CMediMPIWrapper : public CBaseMPIWrapper { #else // HAVE_MPI -#define MPI_COMM_WORLD 0 #define MPI_UNSIGNED_LONG 1 #define MPI_LONG 2 #define MPI_UNSIGNED_SHORT 3 @@ -504,48 +503,7 @@ class CBaseMPIWrapper { static int Rank, Size; static Comm currentComm; - static inline void CopyData(const void* sendbuf, void* recvbuf, int size, Datatype datatype) { - switch (datatype) { - case MPI_DOUBLE: - for (int i = 0; i < size; i++) { - static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; - } - break; - case MPI_UNSIGNED_LONG: - for (int i = 0; i < size; i++) { - static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; - } - break; - case MPI_LONG: - for (int i = 0; i < size; i++) { - static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; - } - break; - case MPI_UNSIGNED_SHORT: - for (int i = 0; i < size; i++) { - static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; - } - break; - case MPI_CHAR: - for (int i = 0; i < size; i++) { - static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; - } - break; - case MPI_SHORT: - for (int i = 0; i < size; i++) { - static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; - } - break; - case MPI_INT: - for (int i = 0; i < size; i++) { - static_cast(recvbuf)[i] = static_cast(sendbuf)[i]; - } - break; - default: - Error("Unknown type", CURRENT_FUNCTION); - break; - }; - } + static void CopyData(const void* sendbuf, void* recvbuf, int size, Datatype datatype); public: static void Error(std::string ErrorMsg, std::string FunctionName); diff --git a/Common/include/parallelization/omp_structure.hpp b/Common/include/parallelization/omp_structure.hpp index d12f450219b7..09721e414b4b 100644 --- a/Common/include/parallelization/omp_structure.hpp +++ b/Common/include/parallelization/omp_structure.hpp @@ -13,7 +13,7 @@ * defined here with suitable fallback versions to limit the spread of * compiler tricks in other areas of the code. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/parallelization/special_vectorization.hpp b/Common/include/parallelization/special_vectorization.hpp index 1f49bfa0f187..b435632abc4a 100644 --- a/Common/include/parallelization/special_vectorization.hpp +++ b/Common/include/parallelization/special_vectorization.hpp @@ -2,7 +2,7 @@ * \file special_vectorization.hpp * \brief Code generator header to create specializations of simd::Array. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/parallelization/vectorization.hpp b/Common/include/parallelization/vectorization.hpp index 1a232844ee6a..aaa601a25af1 100644 --- a/Common/include/parallelization/vectorization.hpp +++ b/Common/include/parallelization/vectorization.hpp @@ -2,7 +2,7 @@ * \file vectorization.hpp * \brief Implementation of a portable SIMD type. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/C1DInterpolation.hpp b/Common/include/toolboxes/C1DInterpolation.hpp index f7a577c83a53..13f7dbf68cf9 100644 --- a/Common/include/toolboxes/C1DInterpolation.hpp +++ b/Common/include/toolboxes/C1DInterpolation.hpp @@ -2,7 +2,7 @@ * \file C1DInterpolation.hpp * \brief Inlet_interpolation_functions * \author Aman Baig - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/CLinearPartitioner.hpp b/Common/include/toolboxes/CLinearPartitioner.hpp index 8c937932d9b6..783c0e792675 100644 --- a/Common/include/toolboxes/CLinearPartitioner.hpp +++ b/Common/include/toolboxes/CLinearPartitioner.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CLinearPartitioner. * The implementations are in the CLinearPartitioner.cpp file. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/CQuasiNewtonInvLeastSquares.hpp b/Common/include/toolboxes/CQuasiNewtonInvLeastSquares.hpp index cbd5f192a811..49a8fce74fec 100644 --- a/Common/include/toolboxes/CQuasiNewtonInvLeastSquares.hpp +++ b/Common/include/toolboxes/CQuasiNewtonInvLeastSquares.hpp @@ -7,7 +7,7 @@ * \note Based on the IQN-ILS method, see DOI 10.1007/s11831-013-9085-5 and * references therein. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -95,11 +95,11 @@ class CQuasiNewtonInvLeastSquares { su2vector tmp(mat.size()); MPI_Wrapper::Allreduce(mat.data(), tmp.data(), iSample*(iSample+1)/2, - type, MPI_SUM, MPI_COMM_WORLD); + type, MPI_SUM, SU2_MPI::GetComm()); mat = std::move(tmp); MPI_Wrapper::Allreduce(rhs.data(), sol.data(), iSample, - type, MPI_SUM, MPI_COMM_WORLD); + type, MPI_SUM, SU2_MPI::GetComm()); std::swap(rhs, sol); } } diff --git a/Common/include/toolboxes/CSquareMatrixCM.hpp b/Common/include/toolboxes/CSquareMatrixCM.hpp index adb4094199cb..0e17144a54f1 100644 --- a/Common/include/toolboxes/CSquareMatrixCM.hpp +++ b/Common/include/toolboxes/CSquareMatrixCM.hpp @@ -3,7 +3,7 @@ * \brief Dense general square matrix, used for example in DG standard elements * in Column Major order storage. * \author Edwin van der Weide, Pedro Gomes. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/CSymmetricMatrix.hpp b/Common/include/toolboxes/CSymmetricMatrix.hpp index 9d7f158c0486..fac98cb8ddae 100644 --- a/Common/include/toolboxes/CSymmetricMatrix.hpp +++ b/Common/include/toolboxes/CSymmetricMatrix.hpp @@ -2,7 +2,7 @@ * \file CSymmetricMatrix.hpp * \brief Dense symmetric matrix, used for example in RBF interpolation. * \author Joel Ho, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CIncTGVSolution.hpp b/Common/include/toolboxes/MMS/CIncTGVSolution.hpp index c9dc9c24ef7a..de7c108ab27a 100644 --- a/Common/include/toolboxes/MMS/CIncTGVSolution.hpp +++ b/Common/include/toolboxes/MMS/CIncTGVSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CIncTGVSolution. * The implementations are in the CIncTGVSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CInviscidVortexSolution.hpp b/Common/include/toolboxes/MMS/CInviscidVortexSolution.hpp index 7521402cbd17..c32da19c91ab 100644 --- a/Common/include/toolboxes/MMS/CInviscidVortexSolution.hpp +++ b/Common/include/toolboxes/MMS/CInviscidVortexSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CInviscidVortexSolution. * The implementations are in the CInviscidVortexSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CMMSIncEulerSolution.hpp b/Common/include/toolboxes/MMS/CMMSIncEulerSolution.hpp index 39b73aeb9752..8b290bedde60 100644 --- a/Common/include/toolboxes/MMS/CMMSIncEulerSolution.hpp +++ b/Common/include/toolboxes/MMS/CMMSIncEulerSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CMMSIncEulerSolution. * The implementations are in the CMMSIncEulerSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CMMSIncNSSolution.hpp b/Common/include/toolboxes/MMS/CMMSIncNSSolution.hpp index 3664007e538c..b5b8063739ad 100644 --- a/Common/include/toolboxes/MMS/CMMSIncNSSolution.hpp +++ b/Common/include/toolboxes/MMS/CMMSIncNSSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CMMSIncNSSolution. * The implementations are in the CMMSIncNSSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.hpp b/Common/include/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.hpp index 74048c8a0eb1..1e9e090bf7da 100644 --- a/Common/include/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.hpp +++ b/Common/include/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CMMSNSTwoHalfCirclesSolution. * The implementations are in the CMMSNSTwoHalfCirclesSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.hpp b/Common/include/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.hpp index 3b37fff112c7..747b15957c57 100644 --- a/Common/include/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.hpp +++ b/Common/include/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CMMSNSTwoHalfSpheresSolution. * The implementations are in the CMMSNSTwoHalfSpheresSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolution.hpp b/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolution.hpp index 4108157fb2fc..a9647ffe9d98 100644 --- a/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolution.hpp +++ b/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CMMSNSUnitQuadSolution. * The implementations are in the CMMSNSUnitQuadSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.hpp b/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.hpp index e0fca4c310df..31ba4471d126 100644 --- a/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.hpp +++ b/Common/include/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CMMSNSUnitQuadSolutionWallBC. * The implementations are in the CMMSNSUnitQuadSolutionWallBC.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CNSUnitQuadSolution.hpp b/Common/include/toolboxes/MMS/CNSUnitQuadSolution.hpp index 9029824f4e06..cd4a8708b5b2 100644 --- a/Common/include/toolboxes/MMS/CNSUnitQuadSolution.hpp +++ b/Common/include/toolboxes/MMS/CNSUnitQuadSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CNSUnitQuadSolution.hpp. * The implementations are in the CNSUnitQuadSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CRinglebSolution.hpp b/Common/include/toolboxes/MMS/CRinglebSolution.hpp index a0edf62cf958..1262cc4b22bd 100644 --- a/Common/include/toolboxes/MMS/CRinglebSolution.hpp +++ b/Common/include/toolboxes/MMS/CRinglebSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CRinglebSolution.hpp. * The implementations are in the CRinglebSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CTGVSolution.hpp b/Common/include/toolboxes/MMS/CTGVSolution.hpp index 9a41a30dc037..10fb86405d7c 100644 --- a/Common/include/toolboxes/MMS/CTGVSolution.hpp +++ b/Common/include/toolboxes/MMS/CTGVSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CTGVSolution. * The implementations are in the CTGVSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CUserDefinedSolution.hpp b/Common/include/toolboxes/MMS/CUserDefinedSolution.hpp index 4c9b52f2e012..d17e143919a1 100644 --- a/Common/include/toolboxes/MMS/CUserDefinedSolution.hpp +++ b/Common/include/toolboxes/MMS/CUserDefinedSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CUserDefinedSolution. * The implementations are in the CUserDefinedSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/MMS/CVerificationSolution.hpp b/Common/include/toolboxes/MMS/CVerificationSolution.hpp index ce7cabd37eff..1ce3d0d0e2c1 100644 --- a/Common/include/toolboxes/MMS/CVerificationSolution.hpp +++ b/Common/include/toolboxes/MMS/CVerificationSolution.hpp @@ -3,7 +3,7 @@ * \brief Header file for the base class CVerificationSolution. * The implementations are in the CVerificationSolution.cpp file. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/allocation_toolbox.hpp b/Common/include/toolboxes/allocation_toolbox.hpp index 9754217d3a7d..fa2a18bdeaa8 100644 --- a/Common/include/toolboxes/allocation_toolbox.hpp +++ b/Common/include/toolboxes/allocation_toolbox.hpp @@ -5,7 +5,7 @@ * \note These are "kernel" functions, only to be used with good reason, * always try to use higher level container classes. * \author P. Gomes, D. Kavolis - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/geometry_toolbox.hpp b/Common/include/toolboxes/geometry_toolbox.hpp index 126d35e9cdfc..051119515109 100644 --- a/Common/include/toolboxes/geometry_toolbox.hpp +++ b/Common/include/toolboxes/geometry_toolbox.hpp @@ -1,7 +1,7 @@ /*! * \file geometry_toolbox.hpp * \brief Collection of common lightweight geometry-oriented methods. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -50,6 +50,13 @@ inline void Distance(Int nDim, const T* a, const T* b, T* d) { for(Int i = 0; i < nDim; i++) d[i] = a[i] - b[i]; } +/*! \brief Reflect a at b: c = 2*b - a + */ +template +inline void PointPointReflect(Int nDim, const T* a, const T* b, T* d){ + for(Int i = 0; i < nDim; i++) d[i] = 2 * b[i] - a[i]; +} + /*! \return a.b */ template inline T DotProduct(Int nDim, const T* a, const T* b) { diff --git a/Common/include/toolboxes/graph_toolbox.hpp b/Common/include/toolboxes/graph_toolbox.hpp index 3ad0721ab10d..a33e7d431170 100644 --- a/Common/include/toolboxes/graph_toolbox.hpp +++ b/Common/include/toolboxes/graph_toolbox.hpp @@ -2,7 +2,7 @@ * \file graph_toolbox.hpp * \brief Functions and classes to build/represent sparse graphs or sparse patterns. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/toolboxes/printing_toolbox.hpp b/Common/include/toolboxes/printing_toolbox.hpp index 4b243b77d653..fe9d75b9e5db 100644 --- a/Common/include/toolboxes/printing_toolbox.hpp +++ b/Common/include/toolboxes/printing_toolbox.hpp @@ -2,7 +2,7 @@ * \file printing_toolbox.hpp * \brief Header file for the printing toolbox. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/include/wall_model.hpp b/Common/include/wall_model.hpp index 72b1fce03efb..8571cfe90793 100644 --- a/Common/include/wall_model.hpp +++ b/Common/include/wall_model.hpp @@ -2,7 +2,7 @@ * \file wall_model.hpp * \brief Headers for the wall model functions for large eddy simulations. * \author E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -42,7 +42,7 @@ class CFluidModel; * \class CWallModel * \brief Base class for defining the LES wall model. * \author: E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CWallModel { diff --git a/Common/lib/Makefile.am b/Common/lib/Makefile.am index 3b88976007f3..2e698b723360 100644 --- a/Common/lib/Makefile.am +++ b/Common/lib/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for the SU2 common library # \author M. Colonno, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 6dabd4d63115..c693a48338dd 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -2,7 +2,7 @@ * \file CConfig.cpp * \brief Main file for managing the config file * \author F. Palacios, T. Economon, B. Tracey, H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -365,10 +365,17 @@ void CConfig::addEnumListOption(const string name, unsigned short & input_size, option_map.insert( pair(name, val) ); } -void CConfig::addDoubleArrayOption(const string name, const int size, su2double * & option_field, su2double * default_value) { +void CConfig::addDoubleArrayOption(const string name, const int size, su2double* option_field) { assert(option_map.find(name) == option_map.end()); all_options.insert(pair(name, true)); - COptionBase* val = new COptionDoubleArray(name, size, option_field, default_value); + COptionBase* val = new COptionArray(name, size, option_field); + option_map.insert(pair(name, val)); +} + +void CConfig::addUShortArrayOption(const string name, const int size, unsigned short* option_field) { + assert(option_map.find(name) == option_map.end()); + all_options.insert(pair(name, true)); + COptionBase* val = new COptionArray(name, size, option_field); option_map.insert(pair(name, val)); } @@ -907,24 +914,14 @@ void CConfig::SetPointersNull(void) { Aeroelastic_plunge = nullptr; Aeroelastic_pitch = nullptr; - Velocity_FreeStream = nullptr; - Inc_Velocity_Init = nullptr; CFL_AdaptParam = nullptr; CFL = nullptr; - HTP_Axis = nullptr; PlaneTag = nullptr; - Kappa_Flow = nullptr; - Kappa_AdjFlow = nullptr; - Kappa_Heat = nullptr; - Stations_Bounds = nullptr; ParamDV = nullptr; DV_Value = nullptr; Design_Variable = nullptr; - Hold_GridFixed_Coord = nullptr; - SubsonicEngine_Cyl = nullptr; - EA_IntLimit = nullptr; TimeDOFsADER_DG = nullptr; TimeIntegrationADER_DG = nullptr; WeightsIntegrationADER_DG = nullptr; @@ -946,14 +943,6 @@ void CConfig::SetPointersNull(void) { nKind_SurfaceMovement = 0; Kind_SurfaceMovement = nullptr; LocationStations = nullptr; - Motion_Origin = nullptr; - Translation_Rate = nullptr; - Rotation_Rate = nullptr; - Pitching_Omega = nullptr; - Pitching_Ampl = nullptr; - Pitching_Phase = nullptr; - Plunging_Omega = nullptr; - Plunging_Ampl = nullptr; MarkerMotion_Origin = nullptr; MarkerTranslation_Rate = nullptr; MarkerRotation_Rate = nullptr; @@ -993,12 +982,7 @@ void CConfig::SetPointersNull(void) { RelaxFactorAverage = nullptr; RelaxFactorFourier = nullptr; nSpan_iZones = nullptr; - ExtraRelFacGiles = nullptr; - Mixedout_Coeff = nullptr; - RampRotatingFrame_Coeff = nullptr; - RampOutletPressure_Coeff = nullptr; Kind_TurboMachinery = nullptr; - SineLoad_Coeff = nullptr; Marker_MixingPlaneInterface = nullptr; Marker_TurboBoundIn = nullptr; @@ -1117,9 +1101,21 @@ void CConfig::SetConfig_Options() { addBoolOption("GRAVITY_FORCE", GravityForce, false); /* DESCRIPTION: Apply a body force as a source term (NO, YES) */ addBoolOption("BODY_FORCE", Body_Force, false); - default_body_force[0] = 0.0; default_body_force[1] = 0.0; default_body_force[2] = 0.0; + body_force[0] = 0.0; body_force[1] = 0.0; body_force[2] = 0.0; /* DESCRIPTION: Vector of body force values (BodyForce_X, BodyForce_Y, BodyForce_Z) */ - addDoubleArrayOption("BODY_FORCE_VECTOR", 3, Body_Force_Vector, default_body_force); + addDoubleArrayOption("BODY_FORCE_VECTOR", 3, body_force); + + /* DESCRIPTION: Apply a body force as a source term for periodic boundary conditions \n Options: NONE, PRESSURE_DROP, MASSFLOW \n DEFAULT: NONE \ingroup Config */ + addEnumOption("KIND_STREAMWISE_PERIODIC", Kind_Streamwise_Periodic, Streamwise_Periodic_Map, NO_STREAMWISE_PERIODIC); + /* DESCRIPTION: Use real periodicity for temperature \n Options: NO, YES \n DEFAULT: NO \ingroup Config */ + addBoolOption("STREAMWISE_PERIODIC_TEMPERATURE", Streamwise_Periodic_Temperature, false); + /* DESCRIPTION: Heatflux boundary at streamwise periodic 'outlet', choose heat [W] such that net domain heatflux is zero. Only active if STREAMWISE_PERIODIC_TEMPERATURE is active. \n DEFAULT: 0.0 \ingroup Config */ + addDoubleOption("STREAMWISE_PERIODIC_OUTLET_HEAT", Streamwise_Periodic_OutletHeat, 0.0); + /* DESCRIPTION: Delta pressure [Pa] on which basis body force will be computed, serves as initial value if MASSFLOW is chosen. \n DEFAULT: 1.0 \ingroup Config */ + addDoubleOption("STREAMWISE_PERIODIC_PRESSURE_DROP", Streamwise_Periodic_PressureDrop, 1.0); + /* DESCRIPTION: Target Massflow [kg/s], Delta P will be adapted until m_dot is met. \n DEFAULT: 0.0 \ingroup Config */ + addDoubleOption("STREAMWISE_PERIODIC_MASSFLOW", Streamwise_Periodic_TargetMassFlow, 0.0); + /*!\brief RESTART_SOL \n DESCRIPTION: Restart solution from native solution file \n Options: NO, YES \ingroup Config */ addBoolOption("RESTART_SOL", Restart, false); /*!\brief BINARY_RESTART \n DESCRIPTION: Read binary SU2 native restart files. \n Options: YES, NO \ingroup Config */ @@ -1213,11 +1209,11 @@ void CConfig::SetConfig_Options() { /*--- Options related to temperature polynomial coefficients for fluid models. ---*/ /* DESCRIPTION: Definition of the temperature polynomial coefficients for specific heat Cp. */ - addDoubleArrayOption("CP_POLYCOEFFS", N_POLY_COEFFS, CpPolyCoefficients, default_cp_polycoeffs.data()); + addDoubleArrayOption("CP_POLYCOEFFS", N_POLY_COEFFS, cp_polycoeffs.data()); /* DESCRIPTION: Definition of the temperature polynomial coefficients for specific heat Cp. */ - addDoubleArrayOption("MU_POLYCOEFFS", N_POLY_COEFFS, MuPolyCoefficients, default_mu_polycoeffs.data()); + addDoubleArrayOption("MU_POLYCOEFFS", N_POLY_COEFFS, mu_polycoeffs.data()); /* DESCRIPTION: Definition of the temperature polynomial coefficients for specific heat Cp. */ - addDoubleArrayOption("KT_POLYCOEFFS", N_POLY_COEFFS, KtPolyCoefficients, default_kt_polycoeffs.data()); + addDoubleArrayOption("KT_POLYCOEFFS", N_POLY_COEFFS, kt_polycoeffs.data()); /*!\brief REYNOLDS_NUMBER \n DESCRIPTION: Reynolds number (non-dimensional, based on the free-stream values). Needed for viscous solvers. For incompressible solvers the Reynolds length will always be 1.0 \n DEFAULT: 0.0 \ingroup Config */ addDoubleOption("REYNOLDS_NUMBER", Reynolds, 0.0); @@ -1262,8 +1258,8 @@ void CConfig::SetConfig_Options() { /*!\brief INC_DENSITY_INIT \n DESCRIPTION: Initial density for incompressible flows (1.2886 kg/m^3 by default) \ingroup Config*/ addDoubleOption("INC_DENSITY_INIT", Inc_Density_Init, 1.2886); /*!\brief INC_VELOCITY_INIT \n DESCRIPTION: Initial velocity for incompressible flows (1.0,0,0 m/s by default) \ingroup Config*/ - default_vel_inf[0] = 1.0; default_vel_inf[1] = 0.0; default_vel_inf[2] = 0.0; - addDoubleArrayOption("INC_VELOCITY_INIT", 3, Inc_Velocity_Init, default_vel_inf); + vel_init[0] = 1.0; vel_init[1] = 0.0; vel_init[2] = 0.0; + addDoubleArrayOption("INC_VELOCITY_INIT", 3, vel_init); /*!\brief INC_TEMPERATURE_INIT \n DESCRIPTION: Initial temperature for incompressible flows with the energy equation (288.15 K by default) \ingroup Config*/ addDoubleOption("INC_TEMPERATURE_INIT", Inc_Temperature_Init, 288.15); /*!\brief INC_NONDIM \n DESCRIPTION: Non-dimensionalization scheme for incompressible flows. \ingroup Config*/ @@ -1275,9 +1271,9 @@ void CConfig::SetConfig_Options() { /*!\brief INC_OUTLET_DAMPING \n DESCRIPTION: Damping factor applied to the iterative updates to the pressure at a mass flow outlet in incompressible flow (0.1 by default). \ingroup Config*/ addDoubleOption("INC_OUTLET_DAMPING", Inc_Outlet_Damping, 0.1); - default_vel_inf[0] = 1.0; default_vel_inf[1] = 0.0; default_vel_inf[2] = 0.0; + vel_inf[0] = 1.0; vel_inf[1] = 0.0; vel_inf[2] = 0.0; /*!\brief FREESTREAM_VELOCITY\n DESCRIPTION: Free-stream velocity (m/s) */ - addDoubleArrayOption("FREESTREAM_VELOCITY", 3, Velocity_FreeStream, default_vel_inf); + addDoubleArrayOption("FREESTREAM_VELOCITY", 3, vel_inf); /* DESCRIPTION: Free-stream viscosity (1.853E-5 Ns/m^2 (air), 0.798E-3 Ns/m^2 (water)) */ addDoubleOption("FREESTREAM_VISCOSITY", Viscosity_FreeStream, -1.0); /* DESCRIPTION: Thermal conductivity used for heat equation */ @@ -1362,8 +1358,8 @@ void CConfig::SetConfig_Options() { /*--- Options related to various boundary markers ---*/ /*!\brief HTP_AXIS\n DESCRIPTION: Location of the HTP axis*/ - default_htp_axis[0] = 0.0; default_htp_axis[1] = 0.0; - addDoubleArrayOption("HTP_AXIS", 2, HTP_Axis, default_htp_axis); + htp_axis[0] = 0.0; htp_axis[1] = 0.0; + addDoubleArrayOption("HTP_AXIS", 2, htp_axis); /*!\brief MARKER_PLOTTING\n DESCRIPTION: Marker(s) of the surface in the surface flow solution file \ingroup Config*/ addStringListOption("MARKER_PLOTTING", nMarker_Plotting, Marker_Plotting); /*!\brief MARKER_MONITORING\n DESCRIPTION: Marker(s) of the surface where evaluate the non-dimensional coefficients \ingroup Config*/ @@ -1398,7 +1394,7 @@ void CConfig::SetConfig_Options() { addStringListOption("MARKER_INTERNAL", nMarker_Internal, Marker_Internal); /* DESCRIPTION: Custom boundary marker(s) */ addStringListOption("MARKER_CUSTOM", nMarker_Custom, Marker_Custom); - /* DESCRIPTION: Periodic boundary marker(s) for use with SU2_MSH + /* DESCRIPTION: Periodic boundary marker(s) Format: ( periodic marker, donor marker, rotation_center_x, rotation_center_y, rotation_center_z, rotation_angle_x-axis, rotation_angle_y-axis, rotation_angle_z-axis, translation_x, translation_y, translation_z, ... ) */ @@ -1416,10 +1412,7 @@ void CConfig::SetConfig_Options() { /*!\brief ACTDISK_TYPE \n DESCRIPTION: Actuator Disk boundary type \n OPTIONS: see \link ActDisk_Map \endlink \n Default: VARIABLES_JUMP \ingroup Config*/ addEnumOption("ACTDISK_TYPE", Kind_ActDisk, ActDisk_Map, VARIABLES_JUMP); - /*!\brief MARKER_ACTDISK\n DESCRIPTION: Periodic boundary marker(s) for use with SU2_MSH - Format: ( periodic marker, donor marker, rotation_center_x, rotation_center_y, - rotation_center_z, rotation_angle_x-axis, rotation_angle_y-axis, - rotation_angle_z-axis, translation_x, translation_y, translation_z, ... ) \ingroup Config*/ + /*!\brief MARKER_ACTDISK\n DESCRIPTION: \ingroup Config*/ addActDiskOption("MARKER_ACTDISK", nMarker_ActDiskInlet, nMarker_ActDiskOutlet, Marker_ActDiskInlet, Marker_ActDiskOutlet, ActDisk_PressJump, ActDisk_TempJump, ActDisk_Omega); @@ -1458,8 +1451,8 @@ void CConfig::SetConfig_Options() { addBoolOption("SPATIAL_FOURIER", SpatialFourier, false); /*!\brief GILES_EXTRA_RELAXFACTOR \n DESCRIPTION: the 1st coeff the value of the under relaxation factor to apply to the shroud and hub, * the 2nd coefficient is the the percentage of span-wise height influenced by this extra under relaxation factor.*/ - default_extrarelfac[0] = 0.1; default_extrarelfac[1] = 0.1; - addDoubleArrayOption("GILES_EXTRA_RELAXFACTOR", 2, ExtraRelFacGiles, default_extrarelfac); + extrarelfac[0] = 0.1; extrarelfac[1] = 0.1; + addDoubleArrayOption("GILES_EXTRA_RELAXFACTOR", 2, extrarelfac); /*!\brief AVERAGE_PROCESS_TYPE \n DESCRIPTION: types of mixing process for averaging quantities at the boundaries. \n OPTIONS: see \link MixingProcess_Map \endlink \n DEFAULT: AREA_AVERAGE \ingroup Config*/ addEnumOption("MIXINGPLANE_INTERFACE_KIND", Kind_MixingPlaneInterface, MixingPlaneInterface_Map, NEAREST_SPAN); @@ -1469,25 +1462,25 @@ void CConfig::SetConfig_Options() { /*!\brief PERFORMANCE_AVERAGE_PROCESS_KIND \n DESCRIPTION: types of mixing process for averaging quantities at the boundaries for performance computation. \n OPTIONS: see \link MixingProcess_Map \endlink \n DEFAULT: AREA_AVERAGE \ingroup Config*/ addEnumOption("PERFORMANCE_AVERAGE_PROCESS_KIND", Kind_PerformanceAverageProcess, AverageProcess_Map, AREA); - default_mixedout_coeff[0] = 1.0; default_mixedout_coeff[1] = 1.0E-05; default_mixedout_coeff[2] = 15.0; + mixedout_coeff[0] = 1.0; mixedout_coeff[1] = 1.0E-05; mixedout_coeff[2] = 15.0; /*!\brief MIXEDOUT_COEFF \n DESCRIPTION: the 1st coeff is an under relaxation factor for the Newton method, * the 2nd coefficient is the tolerance for the Newton method, 3rd coefficient is the maximum number of * iteration for the Newton Method.*/ - addDoubleArrayOption("MIXEDOUT_COEFF", 3, Mixedout_Coeff, default_mixedout_coeff); + addDoubleArrayOption("MIXEDOUT_COEFF", 3, mixedout_coeff); /*!\brief RAMP_ROTATING_FRAME\n DESCRIPTION: option to ramp up or down the rotating frame velocity value*/ addBoolOption("RAMP_ROTATING_FRAME", RampRotatingFrame, false); - default_rampRotFrame_coeff[0] = 0; default_rampRotFrame_coeff[1] = 1.0; default_rampRotFrame_coeff[2] = 1000.0; + rampRotFrame_coeff[0] = 0; rampRotFrame_coeff[1] = 1.0; rampRotFrame_coeff[2] = 1000.0; /*!\brief RAMP_ROTATING_FRAME_COEFF \n DESCRIPTION: the 1st coeff is the staring velocity, * the 2nd coeff is the number of iterations for the update, 3rd is the number of iteration */ - addDoubleArrayOption("RAMP_ROTATING_FRAME_COEFF", 3, RampRotatingFrame_Coeff, default_rampRotFrame_coeff); + addDoubleArrayOption("RAMP_ROTATING_FRAME_COEFF", 3, rampRotFrame_coeff); /* DESCRIPTION: AVERAGE_MACH_LIMIT is a limit value for average procedure based on the mass flux. */ addDoubleOption("AVERAGE_MACH_LIMIT", AverageMachLimit, 0.03); /*!\brief RAMP_OUTLET_PRESSURE\n DESCRIPTION: option to ramp up or down the rotating frame velocity value*/ addBoolOption("RAMP_OUTLET_PRESSURE", RampOutletPressure, false); - default_rampOutPres_coeff[0] = 100000.0; default_rampOutPres_coeff[1] = 1.0; default_rampOutPres_coeff[2] = 1000.0; + rampOutPres_coeff[0] = 100000.0; rampOutPres_coeff[1] = 1.0; rampOutPres_coeff[2] = 1000.0; /*!\brief RAMP_OUTLET_PRESSURE_COEFF \n DESCRIPTION: the 1st coeff is the staring outlet pressure, * the 2nd coeff is the number of iterations for the update, 3rd is the number of total iteration till reaching the final outlet pressure value */ - addDoubleArrayOption("RAMP_OUTLET_PRESSURE_COEFF", 3, RampOutletPressure_Coeff, default_rampOutPres_coeff); + addDoubleArrayOption("RAMP_OUTLET_PRESSURE_COEFF", 3, rampOutPres_coeff); /*!\brief MARKER_MIXINGPLANE \n DESCRIPTION: Identify the boundaries in which the mixing plane is applied. \ingroup Config*/ addStringListOption("MARKER_MIXINGPLANE_INTERFACE", nMarker_MixingPlaneInterface, Marker_MixingPlaneInterface); /*!\brief TURBULENT_MIXINGPLANE \n DESCRIPTION: Activate mixing plane also for turbulent quantities \ingroup Config*/ @@ -1545,16 +1538,15 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Actuator disk double surface */ addBoolOption("ACTDISK_SU2_DEF", ActDisk_SU2_DEF, false); /* DESCRIPTION: Definition of the distortion rack (radial number of proves / circumferential density (degree) */ - default_distortion[0] = 5.0; default_distortion[1] = 15.0; - addDoubleArrayOption("DISTORTION_RACK", 2, DistortionRack, default_distortion); + distortion[0] = 5.0; distortion[1] = 15.0; + addDoubleArrayOption("DISTORTION_RACK", 2, distortion); /* DESCRIPTION: Values of the box to impose a subsonic nacellle (mach, Pressure, Temperature) */ - default_eng_val[0]=0.0; default_eng_val[1]=0.0; default_eng_val[2]=0.0; - default_eng_val[3]=0.0; default_eng_val[4]=0.0; - addDoubleArrayOption("SUBSONIC_ENGINE_VALUES", 5, SubsonicEngine_Values, default_eng_val); + eng_val[0]=0.0; eng_val[1]=0.0; eng_val[2]=0.0; eng_val[3]=0.0; eng_val[4]=0.0; + addDoubleArrayOption("SUBSONIC_ENGINE_VALUES", 5, eng_val); /* DESCRIPTION: Coordinates of the box to impose a subsonic nacellle cylinder (Xmin, Ymin, Zmin, Xmax, Ymax, Zmax, Radius) */ - default_eng_cyl[0] = 0.0; default_eng_cyl[1] = 0.0; default_eng_cyl[2] = 0.0; - default_eng_cyl[3] = 1E15; default_eng_cyl[4] = 1E15; default_eng_cyl[5] = 1E15; default_eng_cyl[6] = 1E15; - addDoubleArrayOption("SUBSONIC_ENGINE_CYL", 7, SubsonicEngine_Cyl, default_eng_cyl); + eng_cyl[0] = 0.0; eng_cyl[1] = 0.0; eng_cyl[2] = 0.0; + eng_cyl[3] = 1E15; eng_cyl[4] = 1E15; eng_cyl[5] = 1E15; eng_cyl[6] = 1E15; + addDoubleArrayOption("SUBSONIC_ENGINE_CYL", 7, eng_cyl); /* DESCRIPTION: Engine exhaust boundary marker(s) Format: (nacelle exhaust marker, total nozzle temp, total nozzle pressure, ... )*/ addExhaustOption("MARKER_ENGINE_EXHAUST", nMarker_EngineExhaust, Marker_EngineExhaust, Exhaust_Temperature_Target, Exhaust_Pressure_Target); @@ -1577,9 +1569,9 @@ void CConfig::SetConfig_Options() { addInletOption("MARKER_SINE_LOAD", nMarker_Load_Sine, Marker_Load_Sine, Load_Sine_Amplitude, Load_Sine_Frequency, Load_Sine_Dir); /*!\brief SINE_LOAD\n DESCRIPTION: option to apply the load as a sine*/ addBoolOption("SINE_LOAD", Sine_Load, false); - default_sineload_coeff[0] = 0.0; default_sineload_coeff[1] = 0.0; default_sineload_coeff[2] = 0.0; + sineload_coeff[0] = 0.0; sineload_coeff[1] = 0.0; sineload_coeff[2] = 0.0; /*!\brief SINE_LOAD_COEFF \n DESCRIPTION: the 1st coeff is the amplitude, the 2nd is the frequency, 3rd is the phase in radians */ - addDoubleArrayOption("SINE_LOAD_COEFF", 3, SineLoad_Coeff, default_sineload_coeff); + addDoubleArrayOption("SINE_LOAD_COEFF", 3, sineload_coeff); /*!\brief RAMP_AND_RELEASE\n DESCRIPTION: release the load after applying the ramp*/ addBoolOption("RAMP_AND_RELEASE_LOAD", RampAndRelease, false); @@ -1599,6 +1591,13 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Offset parameter for the buffet sensor */ addDoubleOption("BUFFET_LAMBDA", Buffet_lambda, 0.0); + /* DESCRIPTION: Use a Newton-Krylov method. */ + addBoolOption("NEWTON_KRYLOV", NewtonKrylov, false); + /* DESCRIPTION: Integer parameters {startup iters, precond iters, initial tolerance relaxation}. */ + addUShortArrayOption("NEWTON_KRYLOV_IPARAM", NK_IntParam.size(), NK_IntParam.data()); + /* DESCRIPTION: Double parameters {startup residual drop, precond tolerance, full tolerance residual drop, findiff step}. */ + addDoubleArrayOption("NEWTON_KRYLOV_DPARAM", NK_DblParam.size(), NK_DblParam.data()); + /* DESCRIPTION: Number of samples for quasi-Newton methods. */ addUnsignedShortOption("QUASI_NEWTON_NUM_SAMPLES", nQuasiNewtonSamples, 0); /* DESCRIPTION: Whether to use vectorized numerical schemes, less robust against transients. */ @@ -1805,14 +1804,14 @@ void CConfig::SetConfig_Options() { /*!\brief SLOPE_LIMITER_FLOW * DESCRIPTION: Slope limiter for the direct solution. \n OPTIONS: See \link Limiter_Map \endlink \n DEFAULT VENKATAKRISHNAN \ingroup Config*/ addEnumOption("SLOPE_LIMITER_FLOW", Kind_SlopeLimit_Flow, Limiter_Map, VENKATAKRISHNAN); - default_jst_coeff[0] = 0.5; default_jst_coeff[1] = 0.02; + jst_coeff[0] = 0.5; jst_coeff[1] = 0.02; /*!\brief JST_SENSOR_COEFF \n DESCRIPTION: 2nd and 4th order artificial dissipation coefficients for the JST method \ingroup Config*/ - addDoubleArrayOption("JST_SENSOR_COEFF", 2, Kappa_Flow, default_jst_coeff); + addDoubleArrayOption("JST_SENSOR_COEFF", 2, jst_coeff); /*!\brief LAX_SENSOR_COEFF \n DESCRIPTION: 1st order artificial dissipation coefficients for the Lax-Friedrichs method. \ingroup Config*/ addDoubleOption("LAX_SENSOR_COEFF", Kappa_1st_Flow, 0.15); - default_ad_coeff_heat[0] = 0.5; default_ad_coeff_heat[1] = 0.02; + ad_coeff_heat[0] = 0.5; ad_coeff_heat[1] = 0.02; /*!\brief JST_SENSOR_COEFF_HEAT \n DESCRIPTION: 2nd and 4th order artificial dissipation coefficients for the JST method \ingroup Config*/ - addDoubleArrayOption("JST_SENSOR_COEFF_HEAT", 2, Kappa_Heat, default_ad_coeff_heat); + addDoubleArrayOption("JST_SENSOR_COEFF_HEAT", 2, ad_coeff_heat); /*!\brief USE_ACCURATE_FLUX_JACOBIANS \n DESCRIPTION: Use numerically computed Jacobians for AUSM+up(2) and SLAU(2) \ingroup Config*/ addBoolOption("USE_ACCURATE_FLUX_JACOBIANS", Use_Accurate_Jacobians, false); /*!\brief CENTRAL_JACOBIAN_FIX_FACTOR \n DESCRIPTION: Improve the numerical properties (diagonal dominance) of the global Jacobian matrix, 3 to 4 is "optimum" (central schemes) \ingroup Config*/ @@ -1829,9 +1828,9 @@ void CConfig::SetConfig_Options() { /*!\brief SLOPE_LIMITER_ADJFLOW * DESCRIPTION: Slope limiter for the adjoint solution. \n OPTIONS: See \link Limiter_Map \endlink \n DEFAULT VENKATAKRISHNAN \ingroup Config*/ addEnumOption("SLOPE_LIMITER_ADJFLOW", Kind_SlopeLimit_AdjFlow, Limiter_Map, VENKATAKRISHNAN); - default_jst_adj_coeff[0] = 0.5; default_jst_adj_coeff[1] = 0.02; + jst_adj_coeff[0] = 0.5; jst_adj_coeff[1] = 0.02; /*!\brief ADJ_JST_SENSOR_COEFF \n DESCRIPTION: 2nd and 4th order artificial dissipation coefficients for the adjoint JST method. \ingroup Config*/ - addDoubleArrayOption("ADJ_JST_SENSOR_COEFF", 2, Kappa_AdjFlow, default_jst_adj_coeff); + addDoubleArrayOption("ADJ_JST_SENSOR_COEFF", 2, jst_adj_coeff); /*!\brief LAX_SENSOR_COEFF \n DESCRIPTION: 1st order artificial dissipation coefficients for the adjoint Lax-Friedrichs method. \ingroup Config*/ addDoubleOption("ADJ_LAX_SENSOR_COEFF", Kappa_1st_AdjFlow, 0.15); @@ -1884,17 +1883,16 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: parameter for the definition of a complex objective function */ addDoubleOption("DCD_DCMY_VALUE", dCD_dCMy, 0.0); - default_obj_coeff[0]=0.0; default_obj_coeff[1]=0.0; default_obj_coeff[2]=0.0; - default_obj_coeff[3]=0.0; default_obj_coeff[4]=0.0; + obj_coeff[0]=0.0; obj_coeff[1]=0.0; obj_coeff[2]=0.0; obj_coeff[3]=0.0; obj_coeff[4]=0.0; /*!\brief OBJ_CHAIN_RULE_COEFF * \n DESCRIPTION: Coefficients defining the objective function gradient using the chain rule * with area-averaged outlet primitive variables. This is used with the genereralized outflow * objective. \ingroup Config */ - addDoubleArrayOption("OBJ_CHAIN_RULE_COEFF", 5, Obj_ChainRuleCoeff, default_obj_coeff); + addDoubleArrayOption("OBJ_CHAIN_RULE_COEFF", 5, obj_coeff); - default_geo_loc[0] = 0.0; default_geo_loc[1] = 1.0; + geo_loc[0] = 0.0; geo_loc[1] = 1.0; /* DESCRIPTION: Definition of the airfoil section */ - addDoubleArrayOption("GEO_BOUNDS", 2, Stations_Bounds, default_geo_loc); + addDoubleArrayOption("GEO_BOUNDS", 2, geo_loc); /* DESCRIPTION: Identify the body to slice */ addEnumOption("GEO_DESCRIPTION", Geo_Description, Geo_Description_Map, WING); /* DESCRIPTION: Z location of the waterline */ @@ -1903,10 +1901,10 @@ void CConfig::SetConfig_Options() { addUnsignedShortOption("GEO_NUMBER_STATIONS", nWingStations, 25); /* DESCRIPTION: Definition of the airfoil sections */ addDoubleListOption("GEO_LOCATION_STATIONS", nLocationStations, LocationStations); - default_nacelle_location[0] = 0.0; default_nacelle_location[1] = 0.0; default_nacelle_location[2] = 0.0; - default_nacelle_location[3] = 0.0; default_nacelle_location[4] = 0.0; + nacelle_location[0] = 0.0; nacelle_location[1] = 0.0; nacelle_location[2] = 0.0; + nacelle_location[3] = 0.0; nacelle_location[4] = 0.0; /* DESCRIPTION: Definition of the nacelle location (higlite coordinates, tilt angle, toe angle) */ - addDoubleArrayOption("GEO_NACELLE_LOCATION", 5, NacelleLocation, default_nacelle_location); + addDoubleArrayOption("GEO_NACELLE_LOCATION", 5, nacelle_location); /* DESCRIPTION: Output sectional forces for specified markers. */ addBoolOption("GEO_PLOT_STATIONS", Plot_Section_Forces, false); /* DESCRIPTION: Mode of the GDC code (analysis, or gradient) */ @@ -1938,6 +1936,8 @@ void CConfig::SetConfig_Options() { /*!\brief OUTPUT_FORMAT \n DESCRIPTION: I/O format for output plots. \n OPTIONS: see \link TabOutput_Map \endlink \n DEFAULT: TECPLOT \ingroup Config */ addEnumOption("TABULAR_FORMAT", Tab_FileFormat, TabOutput_Map, TAB_CSV); + /*!\brief OUTPUT_PRECISION \n DESCRIPTION: Set .precision(value) to specified value for SU2_DOT and HISTORY output. Useful for exact gradient validation. \n DEFAULT: 6 \ingroup Config */ + addUnsignedShortOption("OUTPUT_PRECISION", output_precision, 10); /*!\brief ACTDISK_JUMP \n DESCRIPTION: The jump is given by the difference in values or a ratio */ addEnumOption("ACTDISK_JUMP", ActDisk_Jump, Jump_Map, DIFFERENCE); /*!\brief MESH_FORMAT \n DESCRIPTION: Mesh input file format \n OPTIONS: see \link Input_Map \endlink \n DEFAULT: SU2 \ingroup Config*/ @@ -1951,12 +1951,12 @@ void CConfig::SetConfig_Options() { addShortListOption("MESH_BOX_SIZE", nMesh_Box_Size, Mesh_Box_Size); /* DESCRIPTION: List of the length of the RECTANGLE or BOX grid in the x,y,z directions. (default: (1.0,1.0,1.0) ). */ - default_mesh_box_length[0] = 1.0; default_mesh_box_length[1] = 1.0; default_mesh_box_length[2] = 1.0; - addDoubleArrayOption("MESH_BOX_LENGTH", 3, Mesh_Box_Length, default_mesh_box_length); + mesh_box_length[0] = 1.0; mesh_box_length[1] = 1.0; mesh_box_length[2] = 1.0; + addDoubleArrayOption("MESH_BOX_LENGTH", 3, mesh_box_length); /* DESCRIPTION: List of the offset from 0.0 of the RECTANGLE or BOX grid in the x,y,z directions. (default: (0.0,0.0,0.0) ). */ - default_mesh_box_offset[0] = 0.0; default_mesh_box_offset[1] = 0.0; default_mesh_box_offset[2] = 0.0; - addDoubleArrayOption("MESH_BOX_OFFSET", 3, Mesh_Box_Offset, default_mesh_box_offset); + mesh_box_offset[0] = 0.0; mesh_box_offset[1] = 0.0; mesh_box_offset[2] = 0.0; + addDoubleArrayOption("MESH_BOX_OFFSET", 3, mesh_box_offset); /* DESCRIPTION: Determine if the mesh file supports multizone. \n DEFAULT: true (temporarily) */ addBoolOption("MULTIZONE_MESH", Multizone_Mesh, true); @@ -2022,23 +2022,22 @@ void CConfig::SetConfig_Options() { addStringListOption("MARKER_MOVING", nMarker_Moving, Marker_Moving); /* DESCRIPTION: Mach number (non-dimensional, based on the mesh velocity and freestream vals.) */ addDoubleOption("MACH_MOTION", Mach_Motion, 0.0); - default_vel_inf[0] = 0.0; default_vel_inf[1] = 0.0; default_vel_inf[2] = 0.0; /* DESCRIPTION: Coordinates of the rigid motion origin */ - addDoubleArrayOption("MOTION_ORIGIN", 3, Motion_Origin, default_vel_inf); + addDoubleArrayOption("MOTION_ORIGIN", 3, Motion_Origin); /* DESCRIPTION: Translational velocity vector (m/s) in the x, y, & z directions (RIGID_MOTION only) */ - addDoubleArrayOption("TRANSLATION_RATE", 3, Translation_Rate, default_vel_inf); + addDoubleArrayOption("TRANSLATION_RATE", 3, Translation_Rate); /* DESCRIPTION: Angular velocity vector (rad/s) about x, y, & z axes (RIGID_MOTION only) */ - addDoubleArrayOption("ROTATION_RATE", 3, Rotation_Rate, default_vel_inf); + addDoubleArrayOption("ROTATION_RATE", 3, Rotation_Rate); /* DESCRIPTION: Pitching angular freq. (rad/s) about x, y, & z axes (RIGID_MOTION only) */ - addDoubleArrayOption("PITCHING_OMEGA", 3, Pitching_Omega, default_vel_inf); + addDoubleArrayOption("PITCHING_OMEGA", 3, Pitching_Omega); /* DESCRIPTION: Pitching amplitude (degrees) about x, y, & z axes (RIGID_MOTION only) */ - addDoubleArrayOption("PITCHING_AMPL", 3, Pitching_Ampl, default_vel_inf); + addDoubleArrayOption("PITCHING_AMPL", 3, Pitching_Ampl); /* DESCRIPTION: Pitching phase offset (degrees) about x, y, & z axes (RIGID_MOTION only) */ - addDoubleArrayOption("PITCHING_PHASE", 3, Pitching_Phase, default_vel_inf); + addDoubleArrayOption("PITCHING_PHASE", 3, Pitching_Phase); /* DESCRIPTION: Plunging angular freq. (rad/s) in x, y, & z directions (RIGID_MOTION only) */ - addDoubleArrayOption("PLUNGING_OMEGA", 3, Plunging_Omega, default_vel_inf); + addDoubleArrayOption("PLUNGING_OMEGA", 3, Plunging_Omega); /* DESCRIPTION: Plunging amplitude (m) in x, y, & z directions (RIGID_MOTION only) */ - addDoubleArrayOption("PLUNGING_AMPL", 3, Plunging_Ampl, default_vel_inf); + addDoubleArrayOption("PLUNGING_AMPL", 3, Plunging_Ampl); /* DESCRIPTION: Coordinates of the rigid motion origin */ addDoubleListOption("SURFACE_MOTION_ORIGIN", nMarkerMotion_Origin, MarkerMotion_Origin); /* DESCRIPTION: Translational velocity vector (m/s) in the x, y, & z directions (DEFORMING only) */ @@ -2058,21 +2057,8 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Value to move motion origins (1 or 0) */ addUShortListOption("MOVE_MOTION_ORIGIN", nMoveMotion_Origin, MoveMotion_Origin); - /*!\par CONFIG_CATEGORY: Grid adaptation \ingroup Config*/ - /*--- Options related to grid adaptation ---*/ - - /* DESCRIPTION: Kind of grid adaptation */ - addEnumOption("KIND_ADAPT", Kind_Adaptation, Adapt_Map, NO_ADAPT); - /* DESCRIPTION: Percentage of new elements (% of the original number of elements) */ - addDoubleOption("NEW_ELEMS", New_Elem_Adapt, -1.0); - /* DESCRIPTION: Scale factor for the dual volume */ - addDoubleOption("DUALVOL_POWER", DualVol_Power, 0.5); - /* DESCRIPTION: Use analytical definition for surfaces */ - addEnumOption("ANALYTICAL_SURFDEF", Analytical_Surface, Geo_Analytic_Map, NO_GEO_ANALYTIC); /* DESCRIPTION: Before each computation, implicitly smooth the nodal coordinates */ - addBoolOption("SMOOTH_GEOMETRY", SmoothNumGrid, false); - /* DESCRIPTION: Adapt the boundary elements */ - addBoolOption("ADAPT_BOUNDARY", AdaptBoundary, true); + addUnsignedShortOption("SMOOTH_GEOMETRY", SmoothNumGrid, 0); /*!\par CONFIG_CATEGORY: Aeroelastic Simulation (Typical Section Model) \ingroup Config*/ /*--- Options related to aeroelastic simulations using the Typical Section Model) ---*/ @@ -2128,9 +2114,9 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Evaluate equivalent area on the Near-Field */ addBoolOption("EQUIV_AREA", EquivArea, false); - default_ea_lim[0] = 0.0; default_ea_lim[1] = 1.0; default_ea_lim[2] = 1.0; + ea_lim[0] = 0.0; ea_lim[1] = 1.0; ea_lim[2] = 1.0; /* DESCRIPTION: Integration limits of the equivalent area ( xmin, xmax, Dist_NearField ) */ - addDoubleArrayOption("EA_INT_LIMIT", 3, EA_IntLimit, default_ea_lim); + addDoubleArrayOption("EA_INT_LIMIT", 3, ea_lim); /* DESCRIPTION: Equivalent area scaling factor */ addDoubleOption("EA_SCALE_FACTOR", EA_ScaleFactor, 1.0); @@ -2176,10 +2162,10 @@ void CConfig::SetConfig_Options() { addEnumOption("DV_SENSITIVITY_FORMAT", Sensitivity_FileFormat, Sensitivity_Map, SU2_NATIVE); /* DESCRIPTION: Hold the grid fixed in a region */ addBoolOption("HOLD_GRID_FIXED", Hold_GridFixed, false); - default_grid_fix[0] = -1E15; default_grid_fix[1] = -1E15; default_grid_fix[2] = -1E15; - default_grid_fix[3] = 1E15; default_grid_fix[4] = 1E15; default_grid_fix[5] = 1E15; + grid_fix[0] = -1E15; grid_fix[1] = -1E15; grid_fix[2] = -1E15; + grid_fix[3] = 1E15; grid_fix[4] = 1E15; grid_fix[5] = 1E15; /* DESCRIPTION: Coordinates of the box where the grid will be deformed (Xmin, Ymin, Zmin, Xmax, Ymax, Zmax) */ - addDoubleArrayOption("HOLD_GRID_FIXED_COORD", 6, Hold_GridFixed_Coord, default_grid_fix); + addDoubleArrayOption("HOLD_GRID_FIXED_COORD", 6, grid_fix); /*!\par CONFIG_CATEGORY: Deformable mesh \ingroup Config*/ /*--- option related to deformable meshes ---*/ @@ -2279,21 +2265,26 @@ void CConfig::SetConfig_Options() { addBoolOption("REFERENCE_GEOMETRY", RefGeom, false); /*!\brief REFERENCE_GEOMETRY_PENALTY\n DESCRIPTION: Penalty weight value for the objective function \ingroup Config*/ addDoubleOption("REFERENCE_GEOMETRY_PENALTY", RefGeom_Penalty, 1E6); - /*!\brief SOLUTION_FLOW_FILENAME \n DESCRIPTION: Restart structure input file (the file output under the filename set by RESTART_FLOW_FILENAME) \n Default: solution_flow.dat \ingroup Config */ + /*!\brief REFERENCE_GEOMETRY_FILENAME \n DESCRIPTION: Reference geometry filename \n Default: reference_geometry.dat \ingroup Config */ addStringOption("REFERENCE_GEOMETRY_FILENAME", RefGeom_FEMFileName, string("reference_geometry.dat")); - /*!\brief MESH_FORMAT \n DESCRIPTION: Mesh input file format \n OPTIONS: see \link Input_Map \endlink \n DEFAULT: SU2 \ingroup Config*/ + /*!\brief REFERENCE_GEOMETRY_FORMAT \n DESCRIPTION: Format of the reference geometry file \n OPTIONS: see \link Input_Ref_Map \endlink \n DEFAULT: SU2 \ingroup Config*/ addEnumOption("REFERENCE_GEOMETRY_FORMAT", RefGeom_FileFormat, Input_Ref_Map, SU2_REF); + /*!\brief REFERENCE_GEOMETRY_SURFACE\n DESCRIPTION: If true consider only the surfaces where loads are applied. \ingroup Config*/ + addBoolOption("REFERENCE_GEOMETRY_SURFACE", RefGeomSurf, false); /*!\brief TOTAL_DV_PENALTY\n DESCRIPTION: Penalty weight value to maintain the total sum of DV constant \ingroup Config*/ addDoubleOption("TOTAL_DV_PENALTY", DV_Penalty, 0); /*!\brief REFERENCE_NODE\n DESCRIPTION: Reference node for the structure (optimization applications) */ addUnsignedLongOption("REFERENCE_NODE", refNodeID, 0); - /* DESCRIPTION: Modulus of the electric fields */ + /*!\brief REFERENCE_NODE_DISPLACEMENT\n DESCRIPTION: Target displacement of the reference node \ingroup Config*/ addDoubleListOption("REFERENCE_NODE_DISPLACEMENT", nDim_RefNode, RefNode_Displacement); /*!\brief REFERENCE_NODE_PENALTY\n DESCRIPTION: Penalty weight value for the objective function \ingroup Config*/ addDoubleOption("REFERENCE_NODE_PENALTY", RefNode_Penalty, 1E3); + /*!\brief STRESS_PENALTY_PARAM\n DESCRIPTION: Maximum allowed stress and KS exponent for structural optimization \ingroup Config*/ + addDoubleArrayOption("STRESS_PENALTY_PARAM", 2, StressPenaltyParam.data()); + /*!\brief REGIME_TYPE \n DESCRIPTION: Geometric condition \n OPTIONS: see \link Struct_Map \endlink \ingroup Config*/ addEnumOption("GEOMETRIC_CONDITIONS", Kind_Struct_Solver, Struct_Map, SMALL_DEFORMATIONS); /*!\brief REGIME_TYPE \n DESCRIPTION: Material model \n OPTIONS: see \link Material_Map \endlink \ingroup Config*/ @@ -2342,9 +2333,9 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Maximum number of increments of the */ addUnsignedLongOption("NUMBER_INCREMENTS", IncLoad_Nincrements, 10); - default_inc_crit[0] = 0.0; default_inc_crit[1] = 0.0; default_inc_crit[2] = 0.0; + inc_crit[0] = 0.0; inc_crit[1] = 0.0; inc_crit[2] = 0.0; /* DESCRIPTION: Definition of the UTOL RTOL ETOL*/ - addDoubleArrayOption("INCREMENTAL_CRITERIA", 3, IncLoad_Criteria, default_inc_crit); + addDoubleArrayOption("INCREMENTAL_CRITERIA", 3, inc_crit); /* DESCRIPTION: Use of predictor */ addBoolOption("PREDICTOR", Predictor, false); @@ -2483,11 +2474,11 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Rotation of the volumetric heat source respect to Z axis */ addDoubleOption("HEAT_SOURCE_ROTATION_Z", Heat_Source_Rot_Z, 0.0); /* DESCRIPTION: Position of heat source center (Heat_Source_Center_X, Heat_Source_Center_Y, Heat_Source_Center_Z) */ - default_hs_center[0] = 0.0; default_hs_center[1] = 0.0; default_hs_center[2] = 0.0; - addDoubleArrayOption("HEAT_SOURCE_CENTER", 3, Heat_Source_Center, default_hs_center); + hs_center[0] = 0.0; hs_center[1] = 0.0; hs_center[2] = 0.0; + addDoubleArrayOption("HEAT_SOURCE_CENTER", 3, hs_center); /* DESCRIPTION: Vector of heat source radii (Heat_Source_Axes_A, Heat_Source_Axes_B, Heat_Source_Axes_C) */ - default_hs_axes[0] = 1.0; default_hs_axes[1] = 1.0; default_hs_axes[2] = 1.0; - addDoubleArrayOption("HEAT_SOURCE_AXES", 3, Heat_Source_Axes, default_hs_axes); + hs_axes[0] = 1.0; hs_axes[1] = 1.0; hs_axes[2] = 1.0; + addDoubleArrayOption("HEAT_SOURCE_AXES", 3, hs_axes); /*!\brief MARKER_EMISSIVITY DESCRIPTION: Wall emissivity of the marker for radiation purposes \n * Format: ( marker, emissivity of the marker, ... ) \ingroup Config */ @@ -2552,8 +2543,8 @@ void CConfig::SetConfig_Options() { addEnumOption("FFD_COORD_SYSTEM", FFD_CoordSystem, CoordSystem_Map, CARTESIAN); /* DESCRIPTION: Axis information for the spherical and cylindrical coord system */ - default_ffd_axis[0] = 0.0; default_ffd_axis[1] = 0.0; default_ffd_axis[2] =0.0; - addDoubleArrayOption("FFD_AXIS", 3, FFD_Axis, default_ffd_axis); + ffd_axis[0] = 0.0; ffd_axis[1] = 0.0; ffd_axis[2] =0.0; + addDoubleArrayOption("FFD_AXIS", 3, ffd_axis); /* DESCRIPTION: Number of total iterations in the FFD point inversion */ addUnsignedShortOption("FFD_ITERATIONS", nFFD_Iter, 500); @@ -2592,8 +2583,8 @@ void CConfig::SetConfig_Options() { addEnumOption("FFD_BLENDING", FFD_Blending, Blending_Map, BEZIER ); /* DESCRIPTION: Order of the BSplines for BSpline Blending function */ - default_ffd_coeff[0] = 2; default_ffd_coeff[1] = 2; default_ffd_coeff[2] = 2; - addDoubleArrayOption("FFD_BSPLINE_ORDER", 3, FFD_BSpline_Order, default_ffd_coeff); + ffd_coeff[0] = 2; ffd_coeff[1] = 2; ffd_coeff[2] = 2; + addDoubleArrayOption("FFD_BSPLINE_ORDER", 3, ffd_coeff); /*--- Options for the automatic differentiation methods ---*/ /*!\par CONFIG_CATEGORY: Automatic Differentation options\ingroup Config*/ @@ -3055,13 +3046,12 @@ void CConfig::SetHeader(unsigned short val_software) const{ if ((iZone == 0) && (rank == MASTER_NODE)){ cout << endl << "-------------------------------------------------------------------------" << endl; cout << "| ___ _ _ ___ |" << endl; - cout << "| / __| | | |_ ) Release 7.1.0 \"Blackbird\" |" << endl; + cout << "| / __| | | |_ ) Release 7.1.1 \"Blackbird\" |" << endl; cout << "| \\__ \\ |_| |/ / |" << endl; switch (val_software) { case SU2_CFD: cout << "| |___/\\___//___| Suite (Computational Fluid Dynamics Code) |" << endl; break; case SU2_DEF: cout << "| |___/\\___//___| Suite (Mesh Deformation Code) |" << endl; break; case SU2_DOT: cout << "| |___/\\___//___| Suite (Gradient Projection Code) |" << endl; break; - case SU2_MSH: cout << "| |___/\\___//___| Suite (Mesh Adaptation Code) |" << endl; break; case SU2_GEO: cout << "| |___/\\___//___| Suite (Geometry Definition Code) |" << endl; break; case SU2_SOL: cout << "| |___/\\___//___| Suite (Solution Exporting Code) |" << endl; break; } @@ -3152,13 +3142,6 @@ void CConfig::SetnZone(){ } - /*--- Temporary fix until Multizone Disc. Adj. solver is ready ---- */ - - if (Kind_Solver == FLUID_STRUCTURE_INTERACTION){ - - nZone = GetnZone(Mesh_FileName, Mesh_FileFormat); - - } } void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_izone, unsigned short val_nDim) { @@ -3262,18 +3245,18 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ /*--- Compute x-velocity with a safegaurd for 0.0. ---*/ su2double Vx = 1e-10; - if (Inc_Velocity_Init[0] != 0.0) { - Vx = Inc_Velocity_Init[0]; + if (vel_init[0] != 0.0) { + Vx = vel_init[0]; } /*--- Compute the angle-of-attack and sideslip. ---*/ su2double alpha = 0.0, beta = 0.0; if (val_nDim == 2) { - alpha = atan(Inc_Velocity_Init[1]/Vx)*180.0/PI_NUMBER; + alpha = atan(vel_init[1]/Vx)*180.0/PI_NUMBER; } else { - alpha = atan(Inc_Velocity_Init[2]/Vx)*180.0/PI_NUMBER; - beta = atan(Inc_Velocity_Init[1]/Vx)*180.0/PI_NUMBER; + alpha = atan(vel_init[2]/Vx)*180.0/PI_NUMBER; + beta = atan(vel_init[1]/Vx)*180.0/PI_NUMBER; } /*--- Set alpha and beta in the config class. ---*/ @@ -3415,7 +3398,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ if ((TimeMarching == TIME_STEPPING || TimeMarching == DT_STEPPING_1ST || TimeMarching == DT_STEPPING_2ND) && !Time_Domain){ - SU2_MPI::Error("TIME_DOMAIN must be set to YES if UNSTEADY_SIMULATION is " + SU2_MPI::Error("TIME_DOMAIN must be set to YES if TIME_MARCHING is " "TIME_STEPPING, DUAL_TIME_STEPPING-1ST_ORDER or DUAL_TIME_STEPPING-2ND_ORDER", CURRENT_FUNCTION); } @@ -3601,11 +3584,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ } } - if ((nKind_SurfaceMovement > 1) && GetSurface_Movement(FLUID_STRUCTURE)) { - SU2_MPI::Error("FSI in combination with moving surfaces is currently not supported.", CURRENT_FUNCTION); - } - - if ((nKind_SurfaceMovement != nMarker_Moving) && !GetSurface_Movement(FLUID_STRUCTURE)) { + if (nKind_SurfaceMovement != nMarker_Moving) { SU2_MPI::Error("Number of KIND_SURFACE_MOVEMENT must match number of MARKER_MOVING", CURRENT_FUNCTION); } @@ -3793,28 +3772,28 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ if(GetGrid_Movement() && RampRotatingFrame && !DiscreteAdjoint){ FinalRotation_Rate_Z = Rotation_Rate[2]; if(abs(FinalRotation_Rate_Z) > 0.0){ - Rotation_Rate[2] = RampRotatingFrame_Coeff[0]; + Rotation_Rate[2] = rampRotFrame_coeff[0]; } } if(RampOutletPressure && !DiscreteAdjoint){ for (iMarker = 0; iMarker < nMarker_Giles; iMarker++){ if (Kind_Data_Giles[iMarker] == STATIC_PRESSURE || Kind_Data_Giles[iMarker] == STATIC_PRESSURE_1D || Kind_Data_Giles[iMarker] == RADIAL_EQUILIBRIUM ){ - FinalOutletPressure = Giles_Var1[iMarker]; - Giles_Var1[iMarker] = RampOutletPressure_Coeff[0]; + FinalOutletPressure = Giles_Var1[iMarker]; + Giles_Var1[iMarker] = rampOutPres_coeff[0]; } } for (iMarker = 0; iMarker < nMarker_Riemann; iMarker++){ if (Kind_Data_Riemann[iMarker] == STATIC_PRESSURE || Kind_Data_Riemann[iMarker] == RADIAL_EQUILIBRIUM){ - FinalOutletPressure = Riemann_Var1[iMarker]; - Riemann_Var1[iMarker] = RampOutletPressure_Coeff[0]; - } + FinalOutletPressure = Riemann_Var1[iMarker]; + Riemann_Var1[iMarker] = rampOutPres_coeff[0]; } } + } /*--- Check on extra Relaxation factor for Giles---*/ - if(ExtraRelFacGiles[1] > 0.5){ - ExtraRelFacGiles[1] = 0.5; + if(extrarelfac[1] > 0.5){ + extrarelfac[1] = 0.5; } /*--- Use the various rigid-motion input frequencies to determine the period to be used with harmonic balance cases. There are THREE types of motion to consider, namely: rotation, pitching, and plunging. @@ -3998,12 +3977,12 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ Kind_Solver == FEM_EULER) Kind_Turb_Model = NONE; - Kappa_2nd_Flow = Kappa_Flow[0]; - Kappa_4th_Flow = Kappa_Flow[1]; - Kappa_2nd_AdjFlow = Kappa_AdjFlow[0]; - Kappa_4th_AdjFlow = Kappa_AdjFlow[1]; - Kappa_2nd_Heat = Kappa_Heat[0]; - Kappa_4th_Heat = Kappa_Heat[1]; + Kappa_2nd_Flow = jst_coeff[0]; + Kappa_4th_Flow = jst_coeff[1]; + Kappa_2nd_AdjFlow = jst_adj_coeff[0]; + Kappa_4th_AdjFlow = jst_adj_coeff[1]; + Kappa_2nd_Heat = ad_coeff_heat[0]; + Kappa_4th_Heat = ad_coeff_heat[1]; /*--- Make the MG_PreSmooth, MG_PostSmooth, and MG_CorrecSmooth arrays consistent with nMGLevels ---*/ @@ -4170,8 +4149,8 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ Kind_ConvNumScheme_Flow = Kind_ConvNumScheme_AdjFlow; Kind_Centered_Flow = Kind_Centered_AdjFlow; Kind_Upwind_Flow = Kind_Upwind_AdjFlow; - Kappa_Flow[0] = Kappa_AdjFlow[0]; - Kappa_Flow[1] = Kappa_AdjFlow[1]; + Kappa_2nd_Flow = jst_adj_coeff[0]; + Kappa_4th_Flow = jst_adj_coeff[1]; } if (Update_AoA_Iter_Limit == 0 && Fixed_CL_Mode) { @@ -4191,9 +4170,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ /* Check if the byte alignment of the matrix multiplications is a multiple of 64. */ if( byteAlignmentMatMul%64 ) { - if(rank == MASTER_NODE) - cout << "ALIGNED_BYTES_MATMUL must be a multiple of 64." << endl; - exit(EXIT_FAILURE); + SU2_MPI::Error("ALIGNED_BYTES_MATMUL must be a multiple of 64.", CURRENT_FUNCTION); } /* Determine the value of sizeMatMulPadding, which is the matrix size in @@ -4329,8 +4306,8 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ for (unsigned short iSections = 0; iSections < nLocationStations; iSections++) { LocationStations[iSections] += EPS; } - Stations_Bounds[0] += EPS; - Stations_Bounds[1] += EPS; + geo_loc[0] += EPS; + geo_loc[1] += EPS; } /*--- Length based parameter for slope limiters uses a default value of @@ -4364,26 +4341,19 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ Highlite_Area = Highlite_Area/144.0; SemiSpan = SemiSpan/12.0; - EA_IntLimit[0] = EA_IntLimit[0]/12.0; - EA_IntLimit[1] = EA_IntLimit[1]/12.0; - EA_IntLimit[2] = EA_IntLimit[2]/12.0; + ea_lim[0] /= 12.0; + ea_lim[1] /= 12.0; + ea_lim[2] /= 12.0; if (Geo_Description != NACELLE) { for (unsigned short iSections = 0; iSections < nLocationStations; iSections++) { LocationStations[iSections] = LocationStations[iSections]/12.0; } - Stations_Bounds[0] = Stations_Bounds[0]/12.0; - Stations_Bounds[1] = Stations_Bounds[1]/12.0; + geo_loc[0] /= 12.0; + geo_loc[1] /= 12.0; } - SubsonicEngine_Cyl[0] = SubsonicEngine_Cyl[0]/12.0; - SubsonicEngine_Cyl[1] = SubsonicEngine_Cyl[1]/12.0; - SubsonicEngine_Cyl[2] = SubsonicEngine_Cyl[2]/12.0; - SubsonicEngine_Cyl[3] = SubsonicEngine_Cyl[3]/12.0; - SubsonicEngine_Cyl[4] = SubsonicEngine_Cyl[4]/12.0; - SubsonicEngine_Cyl[5] = SubsonicEngine_Cyl[5]/12.0; - SubsonicEngine_Cyl[6] = SubsonicEngine_Cyl[6]/12.0; - + for (int i=0; i<7; ++i) eng_cyl[i] /= 12.0; } if ((Kind_Turb_Model != SA) && (Kind_Trans_Model == BC)){ @@ -4401,7 +4371,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ if (Fixed_CM_Mode) Update_HTPIncidence = false; if (DirectDiff != NO_DERIVATIVE) { -#if !defined COMPLEX_TYPE && !defined ADOLC_FORWARD_TYPE && !defined CODI_FORWARD_TYPE +#ifndef CODI_FORWARD_TYPE if (Kind_SU2 == SU2_CFD) { SU2_MPI::Error(string("SU2_CFD: Config option DIRECT_DIFF= YES requires AD or complex support!\n") + string("Please use SU2_CFD_DIRECTDIFF (configuration/compilation is done using the preconfigure.py script)."), @@ -4629,6 +4599,28 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ SU2_MPI::Error("Must list two markers for the pressure drop objective function.\n Expected format: MARKER_ANALYZE= (outlet_name, inlet_name).", CURRENT_FUNCTION); } } + + /*--- Check feassbility for Streamwise Periodic flow ---*/ + if (Kind_Streamwise_Periodic != NONE) { + if (Kind_Regime != INCOMPRESSIBLE) + SU2_MPI::Error("Streamwise Periodic Flow currently only implemented for incompressible flow.", CURRENT_FUNCTION); + if (Kind_Solver == INC_EULER) + SU2_MPI::Error("Streamwise Periodic Flow + Incompressible Euler: Not tested yet.", CURRENT_FUNCTION); + if (nMarker_PerBound != 2) + SU2_MPI::Error("Streamwise Periodic Flow currently only implemented for one Periodic Marker pair. Combining Streamwise and Spanwise periodicity not possible in the moment.", CURRENT_FUNCTION); + if (Energy_Equation && Streamwise_Periodic_Temperature && nMarker_Isothermal != 0) + SU2_MPI::Error("No MARKER_ISOTHERMAL marker allowed with STREAMWISE_PERIODIC_TEMPERATURE= YES, only MARKER_HEATFLUX & MARKER_SYM.", CURRENT_FUNCTION); + if (DiscreteAdjoint && Kind_Streamwise_Periodic == MASSFLOW) + SU2_MPI::Error("Discrete Adjoint currently not validated for prescribed MASSFLOW.", CURRENT_FUNCTION); + if (Ref_Inc_NonDim != DIMENSIONAL) + SU2_MPI::Error("Streamwise Periodicity only works with \"INC_NONDIM= DIMENSIONAL\", the nondimensionalization with source terms doesn;t work in general.", CURRENT_FUNCTION); + if (Axisymmetric) + SU2_MPI::Error("Streamwise Periodicity terms does not not have axisymmetric corrections.", CURRENT_FUNCTION); + if (!Energy_Equation) Streamwise_Periodic_Temperature = false; + } else { + /*--- Safety measure ---*/ + Streamwise_Periodic_Temperature = false; + } /*--- Check that if the wall roughness array are compatible and set deafult values if needed. ---*/ if ((nMarker_HeatFlux > 0) || (nMarker_Isothermal > 0) || (nMarker_CHTInterface > 0)) { @@ -4788,16 +4780,6 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_ Kind_ConductivityModel_Turb = NO_CONDUCTIVITY_TURB; } - /*--- Check for running SU2_MSH for periodic preprocessing, and throw - an error to report that this is no longer necessary. ---*/ - - if ((Kind_SU2 == SU2_MSH) && - (Kind_Adaptation == PERIODIC)) { - SU2_MPI::Error(string("For SU2 v7.0.0 and later, preprocessing of periodic grids by SU2_MSH\n") + - string("is no longer necessary. Please use the original mesh file (prior to SU2_MSH)\n") + - string("with the same MARKER_PERIODIC definition in the configuration file.") , CURRENT_FUNCTION); - } - /* Set a default for the size of the RECTANGLE / BOX grid sizes. */ if (nMesh_Box_Size == 0) { @@ -5008,11 +4990,7 @@ void CConfig::SetMarkers(unsigned short val_software) { iMarker_Turbomachinery, iMarker_MixingPlaneInterface; int size = SINGLE_NODE; - -#ifdef HAVE_MPI - if (val_software != SU2_MSH) - SU2_MPI::Comm_size(MPI_COMM_WORLD, &size); -#endif + SU2_MPI::Comm_size(SU2_MPI::GetComm(), &size); /*--- Compute the total number of markers in the config file ---*/ @@ -5632,14 +5610,14 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) { } if (Fixed_CM_Mode) { cout << "Fixed CM mode, target value: " << Target_CM << "." << endl; - cout << "HTP rotation axis (X,Z): ("<< HTP_Axis[0] <<", "<< HTP_Axis[1] <<")."<< endl; + cout << "HTP rotation axis (X,Z): ("<< htp_axis[0] <<", "<< htp_axis[1] <<")."<< endl; } } if (EquivArea) { cout <<"The equivalent area is going to be evaluated on the near-field."<< endl; - cout <<"The lower integration limit is "< recvBufMNK(3*nEntries); SU2_MPI::Recv(recvBufNCalls.data(), recvBufNCalls.size(), - MPI_LONG, proc, 0, MPI_COMM_WORLD, &status); + MPI_LONG, proc, 0, SU2_MPI::GetComm(), &status); SU2_MPI::Recv(recvBufTotTime.data(), recvBufTotTime.size(), - MPI_DOUBLE, proc, 1, MPI_COMM_WORLD, &status); + MPI_DOUBLE, proc, 1, SU2_MPI::GetComm(), &status); SU2_MPI::Recv(recvBufMinTime.data(), recvBufMinTime.size(), - MPI_DOUBLE, proc, 2, MPI_COMM_WORLD, &status); + MPI_DOUBLE, proc, 2, SU2_MPI::GetComm(), &status); SU2_MPI::Recv(recvBufMaxTime.data(), recvBufMaxTime.size(), - MPI_DOUBLE, proc, 3, MPI_COMM_WORLD, &status); + MPI_DOUBLE, proc, 3, SU2_MPI::GetComm(), &status); SU2_MPI::Recv(recvBufMNK.data(), recvBufMNK.size(), - MPI_LONG, proc, 4, MPI_COMM_WORLD, &status); + MPI_LONG, proc, 4, SU2_MPI::GetComm(), &status); /* Loop over the number of entries. */ for(int i=0; i recvCounts(size), displs(size); int sizeLocal = (int) val_coor.size(); SU2_MPI::Allgather(&sizeLocal, 1, MPI_INT, recvCounts.data(), 1, - MPI_INT, MPI_COMM_WORLD); + MPI_INT, SU2_MPI::GetComm()); displs[0] = 0; for(int i=1; i recvCounts(size), displs(size); int sizeLocal = (int) nPoints; SU2_MPI::Allgather(&sizeLocal, 1, MPI_INT, recvCounts.data(), 1, - MPI_INT, MPI_COMM_WORLD); + MPI_INT, SU2_MPI::GetComm()); displs[0] = 0; for(int i=1; i rankLocal(sizeLocal, rank); SU2_MPI::Allgatherv(rankLocal.data(), sizeLocal, MPI_INT, ranksOfPoints.data(), - recvCounts.data(), displs.data(), MPI_INT, MPI_COMM_WORLD); + recvCounts.data(), displs.data(), MPI_INT, SU2_MPI::GetComm()); /*--- Gather the coordinates of the points on all ranks. ---*/ for(int i=0; i sizeRecv(size, 1); SU2_MPI::Reduce_scatter(sendToRank.data(), &nRankRecv, sizeRecv.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); #endif /*--- Loop over the local elements to fill the communication buffers with element data. ---*/ @@ -468,11 +468,11 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { int dest = MI->first; SU2_MPI::Isend(shortSendBuf[i].data(), shortSendBuf[i].size(), MPI_SHORT, - dest, dest, MPI_COMM_WORLD, &commReqs[3*i]); + dest, dest, SU2_MPI::GetComm(), &commReqs[3*i]); SU2_MPI::Isend(longSendBuf[i].data(), longSendBuf[i].size(), MPI_LONG, - dest, dest+1, MPI_COMM_WORLD, &commReqs[3*i+1]); + dest, dest+1, SU2_MPI::GetComm(), &commReqs[3*i+1]); SU2_MPI::Isend(doubleSendBuf[i].data(), doubleSendBuf[i].size(), MPI_DOUBLE, - dest, dest+2, MPI_COMM_WORLD, &commReqs[3*i+2]); + dest, dest+2, SU2_MPI::GetComm(), &commReqs[3*i+2]); } /* Loop over the number of ranks from which I receive data. */ @@ -481,7 +481,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Block until a message with shorts arrives from any processor. Determine the source and the size of the message. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank, SU2_MPI::GetComm(), &status); int source = status.MPI_SOURCE; int sizeMess; @@ -490,24 +490,24 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Allocate the memory for the short receive buffer and receive the message. */ shortRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(shortRecvBuf[i].data(), sizeMess, MPI_SHORT, - source, rank, MPI_COMM_WORLD, &status); + source, rank, SU2_MPI::GetComm(), &status); /* Block until the corresponding message with longs arrives, determine its size, allocate the memory and receive the message. */ - SU2_MPI::Probe(source, rank+1, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(source, rank+1, SU2_MPI::GetComm(), &status); SU2_MPI::Get_count(&status, MPI_LONG, &sizeMess); longRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(longRecvBuf[i].data(), sizeMess, MPI_LONG, - source, rank+1, MPI_COMM_WORLD, &status); + source, rank+1, SU2_MPI::GetComm(), &status); /* Idem for the message with doubles. */ - SU2_MPI::Probe(source, rank+2, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(source, rank+2, SU2_MPI::GetComm(), &status); SU2_MPI::Get_count(&status, MPI_DOUBLE, &sizeMess); doubleRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(doubleRecvBuf[i].data(), sizeMess, MPI_DOUBLE, - source, rank+2, MPI_COMM_WORLD, &status); + source, rank+2, SU2_MPI::GetComm(), &status); } /* Complete the non-blocking sends. */ @@ -515,7 +515,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Wild cards have been used in the communication, so synchronize the ranks to avoid problems. */ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #else @@ -701,7 +701,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { #ifdef HAVE_MPI SU2_MPI::Allreduce(&maxTimeLevelLoc, &maxTimeLevelGlob, - 1, MPI_UNSIGNED_SHORT, MPI_MAX, MPI_COMM_WORLD); + 1, MPI_UNSIGNED_SHORT, MPI_MAX, SU2_MPI::GetComm()); #endif const unsigned short nTimeLevels = maxTimeLevelGlob+1; @@ -763,7 +763,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { #ifdef HAVE_MPI SU2_MPI::Reduce_scatter(sendToRank.data(), &nRankRecv, sizeRecv.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); #endif /* Loop over the local halo elements to fill the communication buffers. */ @@ -808,7 +808,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { for(int i=0; ifirst; SU2_MPI::Isend(longSendBuf[i].data(), longSendBuf[i].size(), MPI_LONG, - dest, dest, MPI_COMM_WORLD, &commReqs[i]); + dest, dest, SU2_MPI::GetComm(), &commReqs[i]); } /* Loop over the number of ranks from which I receive data. */ @@ -817,7 +817,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Block until a message with longs arrives from any processor. Determine the source and the size of the message and receive it. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank, SU2_MPI::GetComm(), &status); sourceRank[i] = status.MPI_SOURCE; int sizeMess; @@ -825,7 +825,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { longSecondRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(longSecondRecvBuf[i].data(), sizeMess, MPI_LONG, - sourceRank[i], rank, MPI_COMM_WORLD, &status); + sourceRank[i], rank, SU2_MPI::GetComm(), &status); } /* Complete the non-blocking sends. */ @@ -895,7 +895,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { #ifdef HAVE_MPI int dest = sourceRank[i]; SU2_MPI::Isend(longSendBuf[i].data(), longSendBuf[i].size(), MPI_LONG, - dest, dest+1, MPI_COMM_WORLD, &commReqs[i]); + dest, dest+1, SU2_MPI::GetComm(), &commReqs[i]); #endif } @@ -914,7 +914,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Block until a message with longs arrives from any processor. Determine the source and the size of the message. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank+1, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank+1, SU2_MPI::GetComm(), &status); int source = status.MPI_SOURCE; int sizeMess; @@ -923,13 +923,13 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Allocate the memory for the long receive buffer and receive the message. */ longSecondRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(longSecondRecvBuf[i].data(), sizeMess, MPI_LONG, - source, rank+1, MPI_COMM_WORLD, &status); + source, rank+1, SU2_MPI::GetComm(), &status); } /* Complete the non-blocking sends and synchronize the ranks, because wild cards have been used. */ SU2_MPI::Waitall(nRankRecv, commReqs.data(), MPI_STATUSES_IGNORE); - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #else @@ -1000,7 +1000,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { #ifdef HAVE_MPI SU2_MPI::Reduce_scatter(sendToRank.data(), &nRankRecv, sizeRecv.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); #endif /* Copy the data to be sent to the send buffers. */ @@ -1030,7 +1030,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { for(int i=0; ifirst; SU2_MPI::Isend(longSendBuf[i].data(), longSendBuf[i].size(), MPI_LONG, - dest, dest, MPI_COMM_WORLD, &commReqs[i]); + dest, dest, SU2_MPI::GetComm(), &commReqs[i]); } /* Resize the vector to store the ranks from which the message came. */ @@ -1042,7 +1042,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Block until a message with longs arrives from any processor. Determine the source and the size of the message and receive it. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank, SU2_MPI::GetComm(), &status); sourceRank[i] = status.MPI_SOURCE; int sizeMess; @@ -1050,13 +1050,13 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { longSecondRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(longSecondRecvBuf[i].data(), sizeMess, MPI_LONG, - sourceRank[i], rank, MPI_COMM_WORLD, &status); + sourceRank[i], rank, SU2_MPI::GetComm(), &status); } /* Complete the non-blocking sends and synchronize the ranks, because wild cards have been used. */ SU2_MPI::Waitall(nRankSend, commReqs.data(), MPI_STATUSES_IGNORE); - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #else @@ -1215,7 +1215,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { unsigned long nRanksTooManyPartChunks = tooManyPartChunksLoc; #ifdef HAVE_MPI SU2_MPI::Reduce(&tooManyPartChunksLoc, &nRanksTooManyPartChunks, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); #endif if((rank == MASTER_NODE) && (nRanksTooManyPartChunks != 0) && (size > 1)) { @@ -1404,7 +1404,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { unsigned long nEmptyPartitions = 0; SU2_MPI::Reduce(&thisPartitionEmpty, &nEmptyPartitions, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); if(rank == MASTER_NODE && nEmptyPartitions) { cout << endl << " WARNING" << endl; @@ -1671,11 +1671,11 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { #ifdef HAVE_MPI int dest = sourceRank[i]; SU2_MPI::Isend(shortSendBuf[i].data(), shortSendBuf[i].size(), MPI_SHORT, - dest, dest+1, MPI_COMM_WORLD, &commReqs[3*i]); + dest, dest+1, SU2_MPI::GetComm(), &commReqs[3*i]); SU2_MPI::Isend(longSendBuf[i].data(), longSendBuf[i].size(), MPI_LONG, - dest, dest+2, MPI_COMM_WORLD, &commReqs[3*i+1]); + dest, dest+2, SU2_MPI::GetComm(), &commReqs[3*i+1]); SU2_MPI::Isend(doubleSendBuf[i].data(), doubleSendBuf[i].size(), MPI_DOUBLE, - dest, dest+3, MPI_COMM_WORLD, &commReqs[3*i+2]); + dest, dest+3, SU2_MPI::GetComm(), &commReqs[3*i+2]); #endif } @@ -1700,7 +1700,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Block until a message with shorts arrives from any processor. Determine the source and the size of the message. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank+1, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank+1, SU2_MPI::GetComm(), &status); sourceRank[i] = status.MPI_SOURCE; int sizeMess; @@ -1709,24 +1709,24 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Allocate the memory for the short receive buffer and receive the message. */ shortRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(shortRecvBuf[i].data(), sizeMess, MPI_SHORT, - sourceRank[i], rank+1, MPI_COMM_WORLD, &status); + sourceRank[i], rank+1, SU2_MPI::GetComm(), &status); /* Block until the corresponding message with longs arrives, determine its size, allocate the memory and receive the message. */ - SU2_MPI::Probe(sourceRank[i], rank+2, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(sourceRank[i], rank+2, SU2_MPI::GetComm(), &status); SU2_MPI::Get_count(&status, MPI_LONG, &sizeMess); longRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(longRecvBuf[i].data(), sizeMess, MPI_LONG, - sourceRank[i], rank+2, MPI_COMM_WORLD, &status); + sourceRank[i], rank+2, SU2_MPI::GetComm(), &status); /* Idem for the message with doubles. */ - SU2_MPI::Probe(sourceRank[i], rank+3, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(sourceRank[i], rank+3, SU2_MPI::GetComm(), &status); SU2_MPI::Get_count(&status, MPI_DOUBLE, &sizeMess); doubleRecvBuf[i].resize(sizeMess); SU2_MPI::Recv(doubleRecvBuf[i].data(), sizeMess, MPI_DOUBLE, - sourceRank[i], rank+3, MPI_COMM_WORLD, &status); + sourceRank[i], rank+3, SU2_MPI::GetComm(), &status); } /* Complete the non-blocking sends. */ @@ -1734,7 +1734,7 @@ CMeshFEM::CMeshFEM(CGeometry *geometry, CConfig *config) { /* Wild cards have been used in the communication, so synchronize the ranks to avoid problems. */ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #else @@ -2420,7 +2420,7 @@ void CMeshFEM::SetPositive_ZArea(CConfig *config) { #ifdef HAVE_MPI su2double locArea = PositiveZArea; - SU2_MPI::Allreduce(&locArea, &PositiveZArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&locArea, &PositiveZArea, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #endif /*---------------------------------------------------------------------------*/ @@ -3504,7 +3504,7 @@ void CMeshFEM_DG::SetSendReceive(const CConfig *config) { vector sizeReduce(size, 1); SU2_MPI::Reduce_scatter(recvFromRank.data(), &nRankSend, sizeReduce.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /* Resize ranksSend and the first index of entitiesSend to the number of ranks to which this rank has to send data. */ @@ -3517,7 +3517,7 @@ void CMeshFEM_DG::SetSendReceive(const CConfig *config) { for(unsigned long i=0; i nDOFsPerRank(size); SU2_MPI::Allgather(&nDOFsLoc, 1, MPI_UNSIGNED_LONG, nDOFsPerRank.data(), 1, - MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); /* Determine the offset for the DOFs on this rank. */ unsigned long offsetRank = 0; @@ -1184,7 +1184,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, int nRankRecv; vector sizeRecv(size, 1); SU2_MPI::Reduce_scatter(sendToRank.data(), &nRankRecv, sizeRecv.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /*--- Send out the messages with the global node numbers. Use nonblocking sends to avoid deadlock. ---*/ @@ -1193,7 +1193,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, for(int i=0; i faceRecvBuf(sizeMess); SU2_MPI::Recv(faceRecvBuf.data(), faceRecvBuf.size(), MPI_UNSIGNED_LONG, - source, rank+4, MPI_COMM_WORLD, &status); + source, rank+4, SU2_MPI::GetComm(), &status); /* Loop to extract the data from the receive buffer. */ int ii = 0; @@ -1432,7 +1432,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, /* Complete the non-blocking sends. Afterwards, synchronize the ranks, because wild cards have been used. */ SU2_MPI::Waitall(sendReqs.size(), sendReqs.data(), MPI_STATUSES_IGNORE); - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif @@ -1681,7 +1681,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, } SU2_MPI::Reduce_scatter(sendToRank.data(), &nRankRecv, sizeRecv.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /*--- Send the messages using non-blocking sends to avoid deadlock. ---*/ sendReqs.resize(nRankSend); @@ -1689,7 +1689,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, for(int i=0; i boundElemRecvBuf(sizeMess); SU2_MPI::Recv(boundElemRecvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank+5, MPI_COMM_WORLD, &status); + source, rank+5, SU2_MPI::GetComm(), &status); /* Loop to extract the data from the receive buffer. */ int ii = 0; @@ -1783,7 +1783,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, } SU2_MPI::Reduce_scatter(sendToRank.data(), &nRankRecv, sizeRecv.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /*--- Send the messages using non-blocking sends to avoid deadlock. ---*/ sendReqs.resize(nRankSend); @@ -1791,7 +1791,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, for(int i=0; i boundElemRecvBuf(sizeMess); SU2_MPI::Recv(boundElemRecvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank+6, MPI_COMM_WORLD, &status); + source, rank+6, SU2_MPI::GetComm(), &status); /* Loop to extract the data from the receive buffer. */ int ii = 0; @@ -1853,7 +1853,7 @@ void CPhysicalGeometry::Read_CGNS_Format_Parallel_FEM(CConfig *config, because wild cards have been used. */ SU2_MPI::Waitall(sendReqs.size(), sendReqs.data(), MPI_STATUSES_IGNORE); - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #else /*--- Sequential mode. All boundary elements read must be stored on this @@ -2059,7 +2059,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { unsigned long maxPointID; SU2_MPI::Allreduce(&maxPointIDLoc, &maxPointID, 1, MPI_UNSIGNED_LONG, - MPI_MAX, MPI_COMM_WORLD); + MPI_MAX, SU2_MPI::GetComm()); ++maxPointID; /*--- Create a vector with a linear distribution over the ranks for @@ -2126,7 +2126,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { unsigned long nMessRecv; SU2_MPI::Reduce_scatter(counter.data(), &nMessRecv, sizeRecv.data(), - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- Send the data using nonblocking sends. ---*/ vector commReqs(max(nMessSend,nMessRecv)); @@ -2137,7 +2137,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { if( nFacesComm[i] ) { unsigned long count = 9*nFacesComm[i]; SU2_MPI::Isend(&sendBufFace[indSend], count, MPI_UNSIGNED_LONG, i, i, - MPI_COMM_WORLD, &commReqs[nMessSend]); + SU2_MPI::GetComm(), &commReqs[nMessSend]); ++nMessSend; indSend += count; } @@ -2151,14 +2151,14 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { nFacesRecv[0] = 0; for(unsigned long i=0; i recvBuf(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - rankRecv[i], rank, MPI_COMM_WORLD, &status); + rankRecv[i], rank, SU2_MPI::GetComm(), &status); nFacesRecv[i+1] = nFacesRecv[i] + sizeMess/9; facesRecv.resize(nFacesRecv[i+1]); @@ -2237,7 +2237,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { unsigned long count = ii - indSend; SU2_MPI::Isend(&sendBufFace[indSend], count, MPI_UNSIGNED_LONG, rankRecv[i], - rankRecv[i]+1, MPI_COMM_WORLD, &commReqs[i]); + rankRecv[i]+1, SU2_MPI::GetComm(), &commReqs[i]); indSend = ii; } @@ -2246,13 +2246,13 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { The return data contains information about the neighboring element. ---*/ for(unsigned long i=0; i recvBuf(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - status.MPI_SOURCE, rank+1, MPI_COMM_WORLD, &status); + status.MPI_SOURCE, rank+1, SU2_MPI::GetComm(), &status); sizeMess /= 9; unsigned long jj = 0; @@ -2278,7 +2278,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { /*--- Wild cards have been used in the communication, so synchronize the ranks to avoid problems. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif @@ -2310,7 +2310,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { #ifdef HAVE_MPI SU2_MPI::Reduce(&nFacesLocOr, &nNonMatchingFaces, 1, MPI_UNSIGNED_LONG, - MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); #endif if(rank == MASTER_NODE && nNonMatchingFaces) { cout << "There are " << nNonMatchingFaces << " non-matching faces in the grid. " @@ -2568,7 +2568,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { int nRankRecv; vector sizeSend(size, 1); SU2_MPI::Reduce_scatter(sendToRank.data(), &nRankRecv, sizeSend.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /* Send the data using non-blocking sends. */ vector sendReqs(nRankSend); @@ -2576,7 +2576,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { for(int i=0; i recvBuf(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank, MPI_COMM_WORLD, &status); + source, rank, SU2_MPI::GetComm(), &status); /* Loop over the contents of the receive buffer and update the graph accordingly. */ @@ -2610,7 +2610,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { /* Complete the non-blocking sends amd synchronize the ranks, because wild cards have been used in the above communication. */ SU2_MPI::Waitall(nRankSend, sendReqs.data(), MPI_STATUSES_IGNORE); - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif @@ -2687,7 +2687,7 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig *config) { if (rank == MASTER_NODE) cout << "Calling ParMETIS..."; idx_t edgecut; - MPI_Comm comm = MPI_COMM_WORLD; + MPI_Comm comm = SU2_MPI::GetComm(); ParMETIS_V3_PartKway(vtxdist.data(), xadjPar.data(), adjacencyPar.data(), vwgtPar.data(), adjwgtPar.data(), &wgtflag, &numflag, &ncon, &nparts, tpwgts.data(), ubvec, options, @@ -2843,7 +2843,7 @@ void CPhysicalGeometry::DeterminePeriodicFacesFEMGrid(CConfig *co int sizeLocal = facesDonor.size(); SU2_MPI::Allgather(&sizeLocal, 1, MPI_INT, recvCounts.data(), 1, - MPI_INT, MPI_COMM_WORLD); + MPI_INT, SU2_MPI::GetComm()); /*--- Create the data for the vector displs from the known values of recvCounts. Also determine the total size of the data. ---*/ @@ -2898,7 +2898,7 @@ void CPhysicalGeometry::DeterminePeriodicFacesFEMGrid(CConfig *co SU2_MPI::Allgatherv(longLocBuf.data(), longLocBuf.size(), MPI_UNSIGNED_LONG, longGlobBuf.data(), recvCounts.data(), displs.data(), - MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); for(int i=0; i bufBoundaryElemIDGlobalSearch(nGlobalSearchPoints); SU2_MPI::Allgatherv(boundaryElemIDGlobalSearch.data(), nLocalSearchPoints, MPI_UNSIGNED_LONG, bufBoundaryElemIDGlobalSearch.data(), recvCounts.data(), displs.data(), MPI_UNSIGNED_LONG, - MPI_COMM_WORLD); + SU2_MPI::GetComm()); for(int i=0; i bufCoorExGlobalSearch(nDim*nGlobalSearchPoints); SU2_MPI::Allgatherv(coorExGlobalSearch.data(), nDim*nLocalSearchPoints, MPI_DOUBLE, bufCoorExGlobalSearch.data(), recvCounts.data(), displs.data(), MPI_DOUBLE, - MPI_COMM_WORLD); + SU2_MPI::GetComm()); /* Buffers to store the return information. */ vector markerIDReturn; @@ -3878,7 +3878,7 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) { int nRankRecv; SU2_MPI::Reduce_scatter(recvCounts.data(), &nRankRecv, displs.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /* Send the data using nonblocking sends to avoid deadlock. */ vector commReqs(3*nRankSend); @@ -3887,13 +3887,13 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) { if( recvCounts[i] ) { const int sizeMessage = nSearchPerRank[i+1] - nSearchPerRank[i]; SU2_MPI::Isend(markerIDReturn.data() + nSearchPerRank[i], - sizeMessage, MPI_UNSIGNED_SHORT, i, i, MPI_COMM_WORLD, + sizeMessage, MPI_UNSIGNED_SHORT, i, i, SU2_MPI::GetComm(), &commReqs[nRankSend++]); SU2_MPI::Isend(boundaryElemIDReturn.data() + nSearchPerRank[i], - sizeMessage, MPI_UNSIGNED_LONG, i, i+1, MPI_COMM_WORLD, + sizeMessage, MPI_UNSIGNED_LONG, i, i+1, SU2_MPI::GetComm(), &commReqs[nRankSend++]); SU2_MPI::Isend(volElemIDDonorReturn.data() + nSearchPerRank[i], - sizeMessage, MPI_UNSIGNED_LONG, i, i+2, MPI_COMM_WORLD, + sizeMessage, MPI_UNSIGNED_LONG, i, i+2, SU2_MPI::GetComm(), &commReqs[nRankSend++]); } } @@ -3904,7 +3904,7 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) { /* Block until a message with unsigned shorts arrives from any processor. Determine the source and the size of the message. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank, SU2_MPI::GetComm(), &status); int source = status.MPI_SOURCE; int sizeMess; @@ -3917,13 +3917,13 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) { /* Receive the three messages using blocking receives. */ SU2_MPI::Recv(bufMarkerIDReturn.data(), sizeMess, MPI_UNSIGNED_SHORT, - source, rank, MPI_COMM_WORLD, &status); + source, rank, SU2_MPI::GetComm(), &status); SU2_MPI::Recv(bufBoundaryElemIDReturn.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank+1, MPI_COMM_WORLD, &status); + source, rank+1, SU2_MPI::GetComm(), &status); SU2_MPI::Recv(bufVolElemIDDonorReturn.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank+2, MPI_COMM_WORLD, &status); + source, rank+2, SU2_MPI::GetComm(), &status); /* Loop over the data just received and add it to the wall function donor information of the corresponding boundary element. */ @@ -3941,7 +3941,7 @@ void CPhysicalGeometry::DetermineDonorElementsWallFunctions(CConfig *config) { /* Wild cards have been used in the communication, so synchronize the ranks to avoid problems. */ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /* Loop again over the boundary elements of the marker for which a wall function treatment must be used and make remove the multiple entries @@ -4057,7 +4057,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( int nRankRecv; vector sizeSend(size, 1); SU2_MPI::Reduce_scatter(recvFromRank.data(), &nRankRecv, sizeSend.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /* Determine the number of messages this rank will send. */ int nRankSend = 0; @@ -4075,7 +4075,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( sendBufAddExternals[i].erase(lastElem, sendBufAddExternals[i].end()); SU2_MPI::Isend(sendBufAddExternals[i].data(), sendBufAddExternals[i].size(), - MPI_UNSIGNED_LONG, i, i, MPI_COMM_WORLD, &sendReqs[nRankSend++]); + MPI_UNSIGNED_LONG, i, i, SU2_MPI::GetComm(), &sendReqs[nRankSend++]); } } @@ -4086,7 +4086,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( /* Block until a message arrives and determine the source and size of the message. Allocate the memory for a receive buffer. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank, SU2_MPI::GetComm(), &status); int source = status.MPI_SOURCE; int sizeMess; @@ -4094,7 +4094,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( vector recvBuf(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank, MPI_COMM_WORLD, &status); + source, rank, SU2_MPI::GetComm(), &status); /* Loop over the entries of recvBuf and add them to mapExternalElemIDToTimeLevel, if not present already. */ @@ -4109,7 +4109,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( /* Complete the non-blocking sends. Synchronize the processors afterwards, because wild cards have been used in the communication. */ SU2_MPI::Waitall(nRankSend, sendReqs.data(), MPI_STATUSES_IGNORE); - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif @@ -4185,7 +4185,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( Only needed for a parallel implementation. */ #ifdef HAVE_MPI su2double locVal = minDeltaT; - SU2_MPI::Allreduce(&locVal, &minDeltaT, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&locVal, &minDeltaT, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); #endif /* Initial estimate of the time level of the owned elements. */ @@ -4244,7 +4244,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( which I will send data. */ nRankRecv = mapRankToIndRecv.size(); SU2_MPI::Reduce_scatter(recvFromRank.data(), &nRankSend, sizeSend.data(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI_INT, MPI_SUM, SU2_MPI::GetComm()); /*--- Create the vector of vectors of the global element ID's that will be received from other ranks. ---*/ @@ -4282,7 +4282,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( recvElem[i].erase(lastElem, recvElem[i].end()); SU2_MPI::Isend(recvElem[i].data(), recvElem[i].size(), MPI_UNSIGNED_LONG, - MRI->first, MRI->first, MPI_COMM_WORLD, &sendReqs[i]); + MRI->first, MRI->first, SU2_MPI::GetComm(), &sendReqs[i]); } /*--- Receive the messages in arbitrary sequence and store the requested @@ -4294,7 +4294,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( for(int i=0; ifirst, rank, MPI_COMM_WORLD, &status); + MRI->first, rank, SU2_MPI::GetComm(), &status); for(unsigned long j=0; jGetTimeLevel(); SU2_MPI::Isend(sendBuf[i].data(), sendElem[i].size(), MPI_UNSIGNED_SHORT, - sendRank[i], sendRank[i], MPI_COMM_WORLD, &sendReqs[i]); + sendRank[i], sendRank[i], SU2_MPI::GetComm(), &sendReqs[i]); } /*--- Receive the data for the externals. As this data is needed @@ -4568,7 +4568,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( SU2_MPI::Status status; SU2_MPI::Recv(returnBuf[i].data(), recvElem[i].size(), MPI_UNSIGNED_SHORT, - MRI->first, rank, MPI_COMM_WORLD, &status); + MRI->first, rank, SU2_MPI::GetComm(), &status); for(unsigned long j=0; jfirst, MRI->first+1, MPI_COMM_WORLD, &returnReqs[i]); + MRI->first, MRI->first+1, SU2_MPI::GetComm(), &returnReqs[i]); } /* Complete the first round of nonblocking sends, such that the @@ -4594,7 +4594,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( SU2_MPI::Status status; SU2_MPI::Recv(sendBuf[i].data(), sendElem[i].size(), MPI_UNSIGNED_SHORT, - sendRank[i], rank+1, MPI_COMM_WORLD, &status); + sendRank[i], rank+1, SU2_MPI::GetComm(), &status); for(unsigned long j=0; jSetTimeLevel(sendBuf[i][j]); @@ -4625,7 +4625,7 @@ void CPhysicalGeometry::DetermineTimeLevelElements( #ifdef HAVE_MPI SU2_MPI::Reduce(nLocalElemPerLevel.data(), nGlobalElemPerLevel.data(), nTimeLevels, MPI_UNSIGNED_LONG, MPI_SUM, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); #endif /* Write the output. */ @@ -4655,7 +4655,7 @@ void CPhysicalGeometry::ComputeFEMGraphWeights( #ifdef HAVE_MPI unsigned short maxTimeLevelLocal = maxTimeLevel; SU2_MPI::Allreduce(&maxTimeLevelLocal, &maxTimeLevel, 1, - MPI_UNSIGNED_SHORT, MPI_MAX, MPI_COMM_WORLD); + MPI_UNSIGNED_SHORT, MPI_MAX, SU2_MPI::GetComm()); #endif /*--------------------------------------------------------------------------*/ @@ -4891,7 +4891,7 @@ void CPhysicalGeometry::ComputeFEMGraphWeights( #ifdef HAVE_MPI su2double locminvwgt = minvwgt; - SU2_MPI::Allreduce(&locminvwgt, &minvwgt, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&locminvwgt, &minvwgt, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); #endif /*--- Scale the workload of the elements, the 1st vertex weight, with the diff --git a/Common/src/geometry/CDummyGeometry.cpp b/Common/src/geometry/CDummyGeometry.cpp index a4ff312d54ae..9419bda7386c 100644 --- a/Common/src/geometry/CDummyGeometry.cpp +++ b/Common/src/geometry/CDummyGeometry.cpp @@ -2,7 +2,7 @@ * \file CDummyGeometry.hpp * \brief Implementation of the dummy geometry class used in "dry run" mode. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 8cfc74f5c24c..69f337368dea 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -2,7 +2,7 @@ * \file CGeometry.cpp * \brief Implementation of the base geometry class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -224,7 +224,7 @@ void CGeometry::PreprocessP2PComms(CGeometry *geometry, many cells it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nPoint_Send_All[1]), 1, MPI_INT, - &(nPoint_Recv_All[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nPoint_Recv_All[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put @@ -452,11 +452,11 @@ void CGeometry::PostP2PRecvs(CGeometry *geometry, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Irecv(&(bufD_P2PSend[offset]), count, MPI_DOUBLE, - source, tag, MPI_COMM_WORLD, &(req_P2PRecv[iRecv])); + source, tag, SU2_MPI::GetComm(), &(req_P2PRecv[iRecv])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Irecv(&(bufS_P2PSend[offset]), count, MPI_UNSIGNED_SHORT, - source, tag, MPI_COMM_WORLD, &(req_P2PRecv[iRecv])); + source, tag, SU2_MPI::GetComm(), &(req_P2PRecv[iRecv])); break; default: SU2_MPI::Error("Unrecognized data type for point-to-point MPI comms.", @@ -489,11 +489,11 @@ void CGeometry::PostP2PRecvs(CGeometry *geometry, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Irecv(&(bufD_P2PRecv[offset]), count, MPI_DOUBLE, - source, tag, MPI_COMM_WORLD, &(req_P2PRecv[iMessage])); + source, tag, SU2_MPI::GetComm(), &(req_P2PRecv[iMessage])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Irecv(&(bufS_P2PRecv[offset]), count, MPI_UNSIGNED_SHORT, - source, tag, MPI_COMM_WORLD, &(req_P2PRecv[iMessage])); + source, tag, SU2_MPI::GetComm(), &(req_P2PRecv[iMessage])); break; default: SU2_MPI::Error("Unrecognized data type for point-to-point MPI comms.", @@ -551,11 +551,11 @@ void CGeometry::PostP2PSends(CGeometry *geometry, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Isend(&(bufD_P2PRecv[offset]), count, MPI_DOUBLE, - dest, tag, MPI_COMM_WORLD, &(req_P2PSend[val_iSend])); + dest, tag, SU2_MPI::GetComm(), &(req_P2PSend[val_iSend])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Isend(&(bufS_P2PRecv[offset]), count, MPI_UNSIGNED_SHORT, - dest, tag, MPI_COMM_WORLD, &(req_P2PSend[val_iSend])); + dest, tag, SU2_MPI::GetComm(), &(req_P2PSend[val_iSend])); break; default: SU2_MPI::Error("Unrecognized data type for point-to-point MPI comms.", @@ -588,11 +588,11 @@ void CGeometry::PostP2PSends(CGeometry *geometry, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Isend(&(bufD_P2PSend[offset]), count, MPI_DOUBLE, - dest, tag, MPI_COMM_WORLD, &(req_P2PSend[val_iSend])); + dest, tag, SU2_MPI::GetComm(), &(req_P2PSend[val_iSend])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Isend(&(bufS_P2PSend[offset]), count, MPI_UNSIGNED_SHORT, - dest, tag, MPI_COMM_WORLD, &(req_P2PSend[val_iSend])); + dest, tag, SU2_MPI::GetComm(), &(req_P2PSend[val_iSend])); break; default: SU2_MPI::Error("Unrecognized data type for point-to-point MPI comms.", @@ -927,7 +927,7 @@ void CGeometry::PreprocessPeriodicComms(CGeometry *geometry, many periodic points it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nPoint_Send_All[1]), 1, MPI_INT, - &(nPoint_Recv_All[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nPoint_Recv_All[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Check how many messages we will be sending and receiving. Here we also put the counters into cumulative storage format to @@ -1112,7 +1112,7 @@ void CGeometry::PreprocessPeriodicComms(CGeometry *geometry, /*--- Post non-blocking recv for this proc. ---*/ SU2_MPI::Irecv(&(static_cast(idRecv)[offset]), - count, MPI_UNSIGNED_LONG, source, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_LONG, source, tag, SU2_MPI::GetComm(), &(req_PeriodicRecv[iMessage])); /*--- Increment message counter. ---*/ @@ -1143,7 +1143,7 @@ void CGeometry::PreprocessPeriodicComms(CGeometry *geometry, /*--- Post non-blocking send for this proc. ---*/ SU2_MPI::Isend(&(static_cast(idSend)[offset]), - count, MPI_UNSIGNED_LONG, dest, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_LONG, dest, tag, SU2_MPI::GetComm(), &(req_PeriodicSend[iMessage])); /*--- Increment message counter. ---*/ @@ -1268,12 +1268,12 @@ void CGeometry::PostPeriodicRecvs(CGeometry *geometry, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Irecv(&(static_cast(bufD_PeriodicRecv)[offset]), - count, MPI_DOUBLE, source, tag, MPI_COMM_WORLD, + count, MPI_DOUBLE, source, tag, SU2_MPI::GetComm(), &(req_PeriodicRecv[iRecv])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Irecv(&(static_cast(bufS_PeriodicRecv)[offset]), - count, MPI_UNSIGNED_SHORT, source, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_SHORT, source, tag, SU2_MPI::GetComm(), &(req_PeriodicRecv[iRecv])); break; default: @@ -1324,12 +1324,12 @@ void CGeometry::PostPeriodicSends(CGeometry *geometry, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Isend(&(static_cast(bufD_PeriodicSend)[offset]), - count, MPI_DOUBLE, dest, tag, MPI_COMM_WORLD, + count, MPI_DOUBLE, dest, tag, SU2_MPI::GetComm(), &(req_PeriodicSend[val_iSend])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Isend(&(static_cast(bufS_PeriodicSend)[offset]), - count, MPI_UNSIGNED_SHORT, dest, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_SHORT, dest, tag, SU2_MPI::GetComm(), &(req_PeriodicSend[val_iSend])); break; default: @@ -1991,8 +1991,8 @@ void CGeometry::ComputeAirfoil_Section(su2double *Plane_P0, su2double *Plane_Nor Buffer_Send_nEdge[0] = nLocalEdge; - SU2_MPI::Allreduce(&nLocalEdge, &MaxLocalEdge, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allgather(Buffer_Send_nEdge, 1, MPI_UNSIGNED_LONG, Buffer_Receive_nEdge, 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nLocalEdge, &MaxLocalEdge, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allgather(Buffer_Send_nEdge, 1, MPI_UNSIGNED_LONG, Buffer_Receive_nEdge, 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); Buffer_Send_Coord = new su2double [MaxLocalEdge*6]; Buffer_Receive_Coord = new su2double [nProcessor*MaxLocalEdge*6]; @@ -2024,9 +2024,9 @@ void CGeometry::ComputeAirfoil_Section(su2double *Plane_P0, su2double *Plane_Nor Buffer_Send_GlobalID[iEdge*4 + 3] = JGlobalID_Index1[iEdge]; } - SU2_MPI::Allgather(Buffer_Send_Coord, nBuffer_Coord, MPI_DOUBLE, Buffer_Receive_Coord, nBuffer_Coord, MPI_DOUBLE, MPI_COMM_WORLD); - SU2_MPI::Allgather(Buffer_Send_Variable, nBuffer_Variable, MPI_DOUBLE, Buffer_Receive_Variable, nBuffer_Variable, MPI_DOUBLE, MPI_COMM_WORLD); - SU2_MPI::Allgather(Buffer_Send_GlobalID, nBuffer_GlobalID, MPI_UNSIGNED_LONG, Buffer_Receive_GlobalID, nBuffer_GlobalID, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + SU2_MPI::Allgather(Buffer_Send_Coord, nBuffer_Coord, MPI_DOUBLE, Buffer_Receive_Coord, nBuffer_Coord, MPI_DOUBLE, SU2_MPI::GetComm()); + SU2_MPI::Allgather(Buffer_Send_Variable, nBuffer_Variable, MPI_DOUBLE, Buffer_Receive_Variable, nBuffer_Variable, MPI_DOUBLE, SU2_MPI::GetComm()); + SU2_MPI::Allgather(Buffer_Send_GlobalID, nBuffer_GlobalID, MPI_UNSIGNED_LONG, Buffer_Receive_GlobalID, nBuffer_GlobalID, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); /*--- Clean the vectors before adding the new vertices only to the master node ---*/ @@ -2520,7 +2520,7 @@ void CGeometry::UpdateGeometry(CGeometry **geometry_container, CConfig *config) geometry_container[MESH_0]->InitiateComms(geometry_container[MESH_0], config, COORDINATES); geometry_container[MESH_0]->CompleteComms(geometry_container[MESH_0], config, COORDINATES); - if (config->GetGrid_Movement() || config->GetDynamic_Grid()){ + if (config->GetDynamic_Grid()){ geometry_container[MESH_0]->InitiateComms(geometry_container[MESH_0], config, GRID_VELOCITY); geometry_container[MESH_0]->CompleteComms(geometry_container[MESH_0], config, GRID_VELOCITY); } @@ -2728,7 +2728,7 @@ void CGeometry::ComputeSurf_Straightness(CConfig *config, /*--- Product of type (bool) is equivalnt to a 'logical and' ---*/ SU2_MPI::Allreduce(Buff_Send_isStraight.data(), Buff_Recv_isStraight.data(), - nMarker_Global, MPI_INT, MPI_PROD, MPI_COMM_WORLD); + nMarker_Global, MPI_INT, MPI_PROD, SU2_MPI::GetComm()); /*--- Print results on screen. ---*/ if(rank == MASTER_NODE) { @@ -2996,9 +2996,9 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) { su2double MyMeanK = MeanK; MeanK = 0.0; su2double MyMaxK = MaxK; MaxK = 0.0; unsigned long MynPointDomain = TotalnPointDomain; TotalnPointDomain = 0; - SU2_MPI::Allreduce(&MyMeanK, &MeanK, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyMaxK, &MaxK, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MynPointDomain, &TotalnPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyMeanK, &MeanK, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyMaxK, &MaxK, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MynPointDomain, &TotalnPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- Compute the mean ---*/ MeanK /= su2double(TotalnPointDomain); @@ -3017,7 +3017,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) { } su2double MySigmaK = SigmaK; SigmaK = 0.0; - SU2_MPI::Allreduce(&MySigmaK, &SigmaK, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MySigmaK, &SigmaK, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); SigmaK = sqrt(SigmaK/su2double(TotalnPointDomain)); @@ -3052,8 +3052,8 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) { /*--- Communicate to all processors the total number of critical edge nodes. ---*/ MaxLocalVertex = 0; - SU2_MPI::Allreduce(&nLocalVertex, &MaxLocalVertex, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allgather(Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Receive_nVertex, 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nLocalVertex, &MaxLocalVertex, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allgather(Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Receive_nVertex, 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); /*--- Create and initialize to zero some buffers to hold the coordinates of the boundary nodes that are communicated from each partition (all-to-all). ---*/ @@ -3071,7 +3071,7 @@ void CGeometry::ComputeSurf_Curvature(CConfig *config) { Buffer_Send_Coord[iVertex*nDim+iDim] = nodes->GetCoord(iPoint, iDim); } - SU2_MPI::Allgather(Buffer_Send_Coord, nBuffer, MPI_DOUBLE, Buffer_Receive_Coord, nBuffer, MPI_DOUBLE, MPI_COMM_WORLD); + SU2_MPI::Allgather(Buffer_Send_Coord, nBuffer, MPI_DOUBLE, Buffer_Receive_Coord, nBuffer, MPI_DOUBLE, SU2_MPI::GetComm()); /*--- Loop over all interior mesh nodes on the local partition and compute the distances to each of the no-slip boundary nodes in the entire mesh. @@ -3184,15 +3184,15 @@ void CGeometry::FilterValuesAtElementCG(const vector &filter_radius, SU2_OMP_MASTER { su2double* dbl_buffer = new su2double [Global_nElemDomain*nDim]; - SU2_MPI::Allreduce(cg_elem,dbl_buffer,Global_nElemDomain*nDim,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + SU2_MPI::Allreduce(cg_elem,dbl_buffer,Global_nElemDomain*nDim,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm()); swap(dbl_buffer, cg_elem); delete [] dbl_buffer; dbl_buffer = new su2double [Global_nElemDomain]; - SU2_MPI::Allreduce(vol_elem,dbl_buffer,Global_nElemDomain,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + SU2_MPI::Allreduce(vol_elem,dbl_buffer,Global_nElemDomain,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm()); swap(dbl_buffer, vol_elem); delete [] dbl_buffer; vector char_buffer(Global_nElemDomain); - MPI_Allreduce(halo_detect.data(),char_buffer.data(),Global_nElemDomain,MPI_CHAR,MPI_SUM,MPI_COMM_WORLD); + MPI_Allreduce(halo_detect.data(),char_buffer.data(),Global_nElemDomain,MPI_CHAR,MPI_SUM,SU2_MPI::GetComm()); halo_detect.swap(char_buffer); } SU2_OMP_BARRIER @@ -3234,7 +3234,7 @@ void CGeometry::FilterValuesAtElementCG(const vector &filter_radius, SU2_OMP_MASTER { su2double *buffer = new su2double [Global_nElemDomain]; - SU2_MPI::Allreduce(work_values,buffer,Global_nElemDomain,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + SU2_MPI::Allreduce(work_values,buffer,Global_nElemDomain,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm()); swap(buffer, work_values); delete [] buffer; } SU2_OMP_BARRIER @@ -3315,7 +3315,7 @@ void CGeometry::FilterValuesAtElementCG(const vector &filter_radius, limited_searches /= kernels.size(); unsigned long tmp = limited_searches; - SU2_MPI::Reduce(&tmp,&limited_searches,1,MPI_UNSIGNED_LONG,MPI_SUM,MASTER_NODE,MPI_COMM_WORLD); + SU2_MPI::Reduce(&tmp,&limited_searches,1,MPI_UNSIGNED_LONG,MPI_SUM,MASTER_NODE,SU2_MPI::GetComm()); if (rank==MASTER_NODE && limited_searches>0) cout << "Warning: The filter radius was limited for " << limited_searches @@ -3353,7 +3353,7 @@ void CGeometry::GetGlobalElementAdjacencyMatrix(vector &neighbour /*--- Share with all processors ---*/ { unsigned short *buffer = new unsigned short [Global_nElemDomain]; - MPI_Allreduce(nFaces_elem,buffer,Global_nElemDomain,MPI_UNSIGNED_SHORT,MPI_MAX,MPI_COMM_WORLD); + MPI_Allreduce(nFaces_elem,buffer,Global_nElemDomain,MPI_UNSIGNED_SHORT,MPI_MAX,SU2_MPI::GetComm()); /*--- swap pointers and delete old data to keep the same variable name after reduction ---*/ swap(buffer, nFaces_elem); delete [] buffer; } @@ -3400,7 +3400,7 @@ void CGeometry::GetGlobalElementAdjacencyMatrix(vector &neighbour /*--- Share with all processors ---*/ { long *buffer = new long [matrix_size]; - MPI_Allreduce(neighbour_idx,buffer,matrix_size,MPI_LONG,MPI_MAX,MPI_COMM_WORLD); + MPI_Allreduce(neighbour_idx,buffer,matrix_size,MPI_LONG,MPI_MAX,SU2_MPI::GetComm()); swap(buffer, neighbour_idx); delete [] buffer; } #endif @@ -3961,4 +3961,3 @@ void CGeometry::ComputeWallDistance(const CConfig* const* config_container, CGeo } } } - diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 914b21a7d202..f6ba9222211e 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -2,7 +2,7 @@ * \file CMultiGridGeometry.cpp * \brief Implementation of the multigrid geometry class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -513,9 +513,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con #ifdef HAVE_MPI /*--- Send/Receive information using Sendrecv ---*/ SU2_MPI::Sendrecv(Buffer_Send_Children, nBufferS_Vector, MPI_UNSIGNED_LONG, send_to,0, - Buffer_Receive_Children, nBufferR_Vector, MPI_UNSIGNED_LONG, receive_from,0, MPI_COMM_WORLD, &status); + Buffer_Receive_Children, nBufferR_Vector, MPI_UNSIGNED_LONG, receive_from,0, SU2_MPI::GetComm(), &status); SU2_MPI::Sendrecv(Buffer_Send_Parent, nBufferS_Vector, MPI_UNSIGNED_LONG, send_to,1, - Buffer_Receive_Parent, nBufferR_Vector, MPI_UNSIGNED_LONG, receive_from,1, MPI_COMM_WORLD, &status); + Buffer_Receive_Parent, nBufferR_Vector, MPI_UNSIGNED_LONG, receive_from,1, SU2_MPI::GetComm(), &status); #else /*--- Receive information without MPI ---*/ for (iVertex = 0; iVertex < nVertexR; iVertex++) { @@ -612,8 +612,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry **geometry, CConfig *config_con Local_nPointCoarse = nPoint; Local_nPointFine = fine_grid->GetnPoint(); - SU2_MPI::Allreduce(&Local_nPointCoarse, &Global_nPointCoarse, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_nPointFine, &Global_nPointFine, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&Local_nPointCoarse, &Global_nPointCoarse, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_nPointFine, &Global_nPointFine, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); su2double Coeff = 1.0, CFL = 0.0, factor = 1.5; diff --git a/Common/src/geometry/CMultiGridQueue.cpp b/Common/src/geometry/CMultiGridQueue.cpp index 10bf0e29c03b..114550207de8 100644 --- a/Common/src/geometry/CMultiGridQueue.cpp +++ b/Common/src/geometry/CMultiGridQueue.cpp @@ -2,7 +2,7 @@ * \file CMultiGridQueue.cpp * \brief Implementation of the multigrid queue class for the FVM solver. * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index dc8ae548d27b..6ede288f986a 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -2,7 +2,7 @@ * \file CPhysicalGeometry.cpp * \brief Implementation of the physical geometry class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -256,9 +256,9 @@ CPhysicalGeometry::CPhysicalGeometry(CGeometry *geometry, nLocal_Bound_Elem = nLocal_Line + nLocal_BoundTria + nLocal_BoundQuad; SU2_MPI::Allreduce(&nLocal_Elem, &nGlobal_Elem, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&nLocal_Bound_Elem, &nGlobal_Bound_Elem, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- With the distribution of all points, elements, and markers based on the ParMETIS coloring complete, as a final step, load this data into @@ -597,7 +597,7 @@ void CPhysicalGeometry::DistributeColoring(const CConfig *config, many points it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nPoint_Send[1]), 1, MPI_INT, - &(nPoint_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nPoint_Recv[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send colors. First check how many messages we will be sending and receiving. Here we also put @@ -840,7 +840,7 @@ void CPhysicalGeometry::DistributeVolumeConnectivity(const CConfig *config, many cells it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, - &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nElem_Recv[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put @@ -1137,7 +1137,7 @@ void CPhysicalGeometry::DistributePoints(const CConfig *config, CGeometry *geome many points it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nPoint_Send[1]), 1, MPI_INT, - &(nPoint_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nPoint_Recv[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send colors, ids, and coords. First check how many messages we will be sending and receiving. Here we also put @@ -1444,7 +1444,7 @@ void CPhysicalGeometry::PartitionSurfaceConnectivity(CConfig *config, many cells it will receive from each other processor. ---*/ SU2_MPI::Scatter(&(nElem_Send[1]), 1, MPI_INT, - &(nElem_Recv[1]), 1, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + &(nElem_Recv[1]), 1, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put @@ -1816,7 +1816,7 @@ void CPhysicalGeometry::DistributeSurfaceConnectivity(CConfig *config, many cells it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, - &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nElem_Recv[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put @@ -2086,7 +2086,7 @@ void CPhysicalGeometry::DistributeMarkerTags(CConfig *config, CGeometry *geometr /*--- Broadcast the global number of markers in the mesh. ---*/ SU2_MPI::Bcast(&nMarker_Global, 1, MPI_UNSIGNED_LONG, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); char *mpi_str_buf = new char[nMarker_Global*MAX_STRING_SIZE](); if (rank == MASTER_NODE) { @@ -2099,7 +2099,7 @@ void CPhysicalGeometry::DistributeMarkerTags(CConfig *config, CGeometry *geometr /*--- Broadcast the string names of the variables. ---*/ SU2_MPI::Bcast(mpi_str_buf, (int)nMarker_Global*MAX_STRING_SIZE, MPI_CHAR, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); /*--- Now parse the string names and load into our marker tag vector. We also need to set the values of all markers into the config. ---*/ @@ -2200,9 +2200,9 @@ void CPhysicalGeometry::LoadPoints(CConfig *config, CGeometry *geometry) { #ifdef HAVE_MPI SU2_MPI::Allreduce(&Local_nPoint, &Global_nPoint, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&Local_nPointDomain, &Global_nPointDomain, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #else Global_nPoint = Local_nPoint; Global_nPointDomain = Local_nPointDomain; @@ -2498,7 +2498,7 @@ void CPhysicalGeometry::LoadVolumeElements(CConfig *config, CGeometry *geometry) values are important for merging and writing output later. ---*/ SU2_MPI::Allreduce(&Local_Elem, &Global_nElem, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); if ((rank == MASTER_NODE) && (size > SINGLE_NODE)) cout << Global_nElem << " interior elements including halo cells. " << endl; @@ -2527,17 +2527,17 @@ void CPhysicalGeometry::LoadVolumeElements(CConfig *config, CGeometry *geometry) unsigned long Local_nElemPyramid = nelem_pyramid; SU2_MPI::Allreduce(&Local_nElemTri, &Global_nelem_triangle, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&Local_nElemQuad, &Global_nelem_quad, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&Local_nElemTet, &Global_nelem_tetra, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&Local_nElemHex, &Global_nelem_hexa, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&Local_nElemPrism, &Global_nelem_prism, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&Local_nElemPyramid, &Global_nelem_pyramid, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #else Global_nelem_triangle = nelem_triangle; Global_nelem_quad = nelem_quad; @@ -2903,37 +2903,37 @@ void CPhysicalGeometry::InitiateCommsAll(void *bufSend, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_DOUBLE, source, tag, MPI_COMM_WORLD, + count, MPI_DOUBLE, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_UNSIGNED_LONG: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_UNSIGNED_LONG, source, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_LONG, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_LONG: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_LONG, source, tag, MPI_COMM_WORLD, + count, MPI_LONG, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_UNSIGNED_SHORT, source, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_SHORT, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_CHAR: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_CHAR, source, tag, MPI_COMM_WORLD, + count, MPI_CHAR, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_SHORT: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_SHORT, source, tag, MPI_COMM_WORLD, + count, MPI_SHORT, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_INT: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_INT, source, tag, MPI_COMM_WORLD, + count, MPI_INT, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; default: @@ -2978,37 +2978,37 @@ void CPhysicalGeometry::InitiateCommsAll(void *bufSend, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_DOUBLE, dest, tag, MPI_COMM_WORLD, + count, MPI_DOUBLE, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_UNSIGNED_LONG: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_UNSIGNED_LONG, dest, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_LONG, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_LONG: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_LONG, dest, tag, MPI_COMM_WORLD, + count, MPI_LONG, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_UNSIGNED_SHORT, dest, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_SHORT, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_CHAR: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_CHAR, dest, tag, MPI_COMM_WORLD, + count, MPI_CHAR, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_SHORT: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_SHORT, dest, tag, MPI_COMM_WORLD, + count, MPI_SHORT, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_INT: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_INT, dest, tag, MPI_COMM_WORLD, + count, MPI_INT, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; default: @@ -3884,7 +3884,7 @@ void CPhysicalGeometry::LoadLinearlyPartitionedVolumeElements(CConfig *co the CGNS grid with all ranks. ---*/ auto reduce = [](unsigned long p, unsigned long& t) { - SU2_MPI::Allreduce(&p, &t, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&p, &t, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); }; reduce(nelem_triangle, Global_nelem_triangle); reduce(nelem_quad, Global_nelem_quad); @@ -4318,7 +4318,7 @@ void CPhysicalGeometry::Check_IntElem_Orientation(const CConfig *config) { if (elem[iElem]->GetVTK_Type() == TETRAHEDRON) { - if (checkTetra(iElem,0,1,2,3) < 0.0) { + if (checkTetra(iElem,0,1,2,3)) { elem[iElem]->Change_Orientation(); tet_flip++; } @@ -4379,7 +4379,7 @@ void CPhysicalGeometry::Check_IntElem_Orientation(const CConfig *config) { auto reduce = [](unsigned long& val) { unsigned long tmp = val; - SU2_MPI::Allreduce(&tmp, &val, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &val, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); }; reduce(tria_flip); reduce(quad_flip); reduce(tet_flip); reduce(pyram_flip); @@ -4526,7 +4526,7 @@ void CPhysicalGeometry::Check_BoundElem_Orientation(const CConfig *config) { auto reduce = [](unsigned long& val) { unsigned long tmp = val; - SU2_MPI::Allreduce(&tmp, &val, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &val, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); }; reduce(line_flip); reduce(tria_flip); reduce(quad_flip); reduce(quad_error); @@ -4557,8 +4557,8 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) { TotalMinCoordZ = 1E10, TotalMaxCoordX = -1E10, TotalMaxCoordY = -1E10, TotalMaxCoordZ = -1E10; su2double TotalPositiveXArea = 0.0, TotalPositiveYArea = 0.0, TotalPositiveZArea = 0.0, TotalWettedArea = 0.0, AxiFactor; - bool axisymmetric = config->GetAxisymmetric(); - bool fea = ((config->GetKind_Solver() == FEM_ELASTICITY) || (config->GetKind_Solver() == DISC_ADJ_FEM)); + const bool axisymmetric = config->GetAxisymmetric(); + const bool fea = config->GetStructuralProblem(); PositiveXArea = 0.0; PositiveYArea = 0.0; @@ -4569,12 +4569,8 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) { Boundary = config->GetMarker_All_KindBC(iMarker); Monitoring = config->GetMarker_All_Monitoring(iMarker); - if ((((Boundary == EULER_WALL) || - (Boundary == HEAT_FLUX) || - (Boundary == ISOTHERMAL) || - (Boundary == LOAD_BOUNDARY) || - (Boundary == DISPLACEMENT_BOUNDARY)) && (Monitoring == YES)) - || (fea)) + if (((config->GetSolid_Wall(iMarker) || Boundary == LOAD_BOUNDARY || + Boundary == DISPLACEMENT_BOUNDARY) && Monitoring == YES) || fea) { for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { iPoint = vertex[iMarker][iVertex]->GetNode(); @@ -4588,8 +4584,7 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) { if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*nodes->GetCoord(iPoint, 1); else AxiFactor = 1.0; - if (nDim == 2) WettedArea = AxiFactor * GeometryToolbox::Norm(nDim, Normal); - if (nDim == 3) WettedArea = GeometryToolbox::Norm(nDim, Normal); + WettedArea += AxiFactor * GeometryToolbox::Norm(nDim, Normal); if (Normal[0] < 0) PositiveXArea -= Normal[0]; if (Normal[1] < 0) PositiveYArea -= Normal[1]; @@ -4605,102 +4600,75 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig *config) { if (CoordZ < MinCoordZ) MinCoordZ = CoordZ; if (CoordZ > MaxCoordZ) MaxCoordZ = CoordZ; } - } } - + } } - SU2_MPI::Allreduce(&PositiveXArea, &TotalPositiveXArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&PositiveYArea, &TotalPositiveYArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&PositiveZArea, &TotalPositiveZArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&PositiveXArea, &TotalPositiveXArea, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&PositiveYArea, &TotalPositiveYArea, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&PositiveZArea, &TotalPositiveZArea, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); - SU2_MPI::Allreduce(&MinCoordX, &TotalMinCoordX, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MinCoordY, &TotalMinCoordY, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MinCoordZ, &TotalMinCoordZ, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MinCoordX, &TotalMinCoordX, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MinCoordY, &TotalMinCoordY, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MinCoordZ, &TotalMinCoordZ, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); - SU2_MPI::Allreduce(&MaxCoordX, &TotalMaxCoordX, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MaxCoordY, &TotalMaxCoordY, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MaxCoordZ, &TotalMaxCoordZ, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MaxCoordX, &TotalMaxCoordX, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MaxCoordY, &TotalMaxCoordY, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MaxCoordZ, &TotalMaxCoordZ, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); - SU2_MPI::Allreduce(&WettedArea, &TotalWettedArea, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&WettedArea, &TotalWettedArea, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Set a reference area if no value is provided ---*/ + const string L = (config->GetSystemMeasurements() == SI)? " m" : " ft"; + const string A = (config->GetSystemMeasurements() == SI)? " m^2" : " ft^2"; + const bool D3 = (nDim == 3); + if (config->GetRefArea() == 0.0) { - if (nDim == 3) config->SetRefArea(TotalPositiveZArea); + if (D3) config->SetRefArea(TotalPositiveZArea); else config->SetRefArea(TotalPositiveYArea); if (rank == MASTER_NODE) { - if (nDim == 3) { - cout << "Reference area = "<< TotalPositiveZArea; - if (config->GetSystemMeasurements() == SI) cout <<" m^2." << endl; else cout <<" ft^2." << endl; - } - else { - cout << "Reference length = "<< TotalPositiveYArea; - if (config->GetSystemMeasurements() == SI) cout <<" m." << endl; else cout <<" ft." << endl; - } + if (D3) cout << "Reference area = "<< TotalPositiveZArea << A << ".\n"; + else cout << "Reference length = "<< TotalPositiveYArea << L << ".\n"; } - } /*--- Set a semi-span value if no value is provided ---*/ if (config->GetSemiSpan() == 0.0) { - if (nDim == 3) config->SetSemiSpan(fabs(TotalMaxCoordY)); + if (D3) config->SetSemiSpan(fabs(TotalMaxCoordY)); else config->SetSemiSpan(1.0); - if ((nDim == 3) && (rank == MASTER_NODE)) { - cout << "Semi-span length = "<< TotalMaxCoordY; - if (config->GetSystemMeasurements() == SI) cout <<" m." << endl; else cout <<" ft." << endl; + if (D3 && (rank == MASTER_NODE)) { + cout << "Semi-span length = "<< TotalMaxCoordY << L << ".\n"; } - } if (rank == MASTER_NODE) { if (fea) cout << "Surface area = "<< TotalWettedArea; else cout << "Wetted area = "<< TotalWettedArea; + if (D3 || axisymmetric) cout << A << ".\n"; + else cout << L << ".\n"; - if ((nDim == 3) || (axisymmetric)) { if (config->GetSystemMeasurements() == SI) cout <<" m^2." << endl; else cout <<" ft^2." << endl; } - else { if (config->GetSystemMeasurements() == SI) cout <<" m." << endl; else cout <<" ft." << endl; } - - cout << "Area projection in the x-plane = "<< TotalPositiveXArea; - if (nDim == 3) { if (config->GetSystemMeasurements() == SI) cout <<" m^2,"; else cout <<" ft^2,"; } - else { if (config->GetSystemMeasurements() == SI) cout <<" m,"; else cout <<" ft,"; } - - cout << " y-plane = "<< TotalPositiveYArea; - if (nDim == 3) { if (config->GetSystemMeasurements() == SI) cout <<" m^2,"; else cout <<" ft^2,"; } - else { if (config->GetSystemMeasurements() == SI) cout <<" m." << endl; else cout <<" ft." << endl; } + cout << "Area projection in the x-plane = "<< TotalPositiveXArea << (D3? A : L); + cout << ", y-plane = "<< TotalPositiveYArea << (D3? A : L); + if (D3) cout << ", z-plane = "<< TotalPositiveZArea << A; + cout << ".\n"; - if (nDim == 3) { cout << " z-plane = "<< TotalPositiveZArea; - if (config->GetSystemMeasurements() == SI) cout <<" m^2." << endl; else cout <<" ft^2."<< endl; } + cout << "Max. coordinate in the x-direction = "<< TotalMaxCoordX << L; + cout << ", y-direction = "<< TotalMaxCoordY << L; + if (D3) cout << ", z-direction = "<< TotalMaxCoordZ << L; + cout << ".\n"; - cout << "Max. coordinate in the x-direction = "<< TotalMaxCoordX; - if (config->GetSystemMeasurements() == SI) cout <<" m,"; else cout <<" ft,"; - - cout << " y-direction = "<< TotalMaxCoordY; - if (config->GetSystemMeasurements() == SI) cout <<" m"; else cout <<" ft"; - - if (nDim == 3) { - cout << ", z-direction = "<< TotalMaxCoordZ; - if (config->GetSystemMeasurements() == SI) cout <<" m." << endl; else cout <<" ft."<< endl; - } - else cout << "." << endl; - - cout << "Min. coordinate in the x-direction = "<< TotalMinCoordX; - if (config->GetSystemMeasurements() == SI) cout <<" m,"; else cout <<" ft"; - - cout << " y-direction = "<< TotalMinCoordY; - if (config->GetSystemMeasurements() == SI) cout <<" m"; else cout <<" ft"; - - if (nDim == 3) { - cout << ", z-direction = "<< TotalMinCoordZ; - if (config->GetSystemMeasurements() == SI) cout <<" m." << endl; else cout <<" ft."<< endl; - } - else cout << "." << endl; + cout << "Min. coordinate in the x-direction = "<< TotalMinCoordX << L; + cout << ", y-direction = "<< TotalMinCoordY << L; + if (D3) cout << ", z-direction = "<< TotalMinCoordZ << L; + cout << "." << endl; } @@ -5128,8 +5096,8 @@ unsigned short iMarker, jMarker, iMarkerTP, iSpan, jSpan, kSpan = 0; nSpan_max = nSpan; My_nSpan = nSpan; nSpan = 0; My_MaxnSpan = nSpan_max; nSpan_max = 0; - SU2_MPI::Allreduce(&My_nSpan, &nSpan, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&My_MaxnSpan, &nSpan_max, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&My_nSpan, &nSpan, 1, MPI_INT, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&My_MaxnSpan, &nSpan_max, 1, MPI_INT, MPI_MAX, SU2_MPI::GetComm()); #endif /*--- initialize the vector that will contain the disordered values span-wise ---*/ @@ -5214,8 +5182,8 @@ unsigned short iMarker, jMarker, iMarkerTP, iSpan, jSpan, kSpan = 0; valueSpan[iSpan] = -1001.0; } - SU2_MPI::Allgather(MyValueSpan, nSpan_max , MPI_DOUBLE, MyTotValueSpan, nSpan_max, MPI_DOUBLE, MPI_COMM_WORLD); - SU2_MPI::Allgather(&nSpan_loc, 1 , MPI_INT, My_nSpan_loc, 1, MPI_INT, MPI_COMM_WORLD); + SU2_MPI::Allgather(MyValueSpan, nSpan_max , MPI_DOUBLE, MyTotValueSpan, nSpan_max, MPI_DOUBLE, SU2_MPI::GetComm()); + SU2_MPI::Allgather(&nSpan_loc, 1 , MPI_INT, My_nSpan_loc, 1, MPI_INT, SU2_MPI::GetComm()); jSpan = 0; for (iSize = 0; iSize< size; iSize++){ @@ -5334,8 +5302,8 @@ unsigned short iMarker, jMarker, iMarkerTP, iSpan, jSpan, kSpan = 0; #ifdef HAVE_MPI MyMin= min; min = 0; MyMax= max; max = 0; - SU2_MPI::Allreduce(&MyMin, &min, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyMax, &max, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyMin, &min, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyMax, &max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); #endif // cout <<"min " << min << endl; @@ -5858,9 +5826,9 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone MyIntMin = minIntAngPitch[iSpan]; minIntAngPitch[iSpan] = 10.0E+6; MyMax = maxAngPitch[iSpan]; maxAngPitch[iSpan] = -10.0E+6; - SU2_MPI::Allreduce(&MyMin, &minAngPitch[iSpan], 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyIntMin, &minIntAngPitch[iSpan], 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyMax, &maxAngPitch[iSpan], 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyMin, &minAngPitch[iSpan], 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyIntMin, &minIntAngPitch[iSpan], 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyMax, &maxAngPitch[iSpan], 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); #endif @@ -5885,7 +5853,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone #ifdef HAVE_MPI My_nVert = nVert;nVert = 0; - SU2_MPI::Allreduce(&My_nVert, &nVert, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&My_nVert, &nVert, 1, MPI_INT, MPI_SUM, SU2_MPI::GetComm()); #endif /*--- to be set for all the processor to initialize an appropriate number of frequency for the NR BC ---*/ @@ -5970,11 +5938,11 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone } } } - SU2_MPI::Gather(y_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, y_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(x_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, x_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(z_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, z_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(angCoord_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, angCoord_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(deltaAngCoord_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, deltaAngCoord_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(y_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, y_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(x_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, x_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(z_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, z_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(angCoord_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, angCoord_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(deltaAngCoord_loc[iSpan], nTotVertex_gb[iSpan] , MPI_DOUBLE, deltaAngCoord_gb, nTotVertex_gb[iSpan], MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); if (rank == MASTER_NODE){ for(iSpanVertex = 0; iSpanVertex|, the choice of the ---*/ + /*--- reference node is not relevant at all. This is probably true for most streamwise ---*/ + /*--- periodic cases. Other cases where it is relevant could look like this (--->( or ---*/ + /*--- \--->\ . The chosen metric is the minimal distance to the origin. ---*/ + /*-------------------------------------------------------------------------------------------*/ + + /*--- Initialize/Allocate variables. ---*/ + su2double min_norm = numeric_limits::max(); + + /*--- Communicate Coordinates plus the minimum distance, therefor the nDim+1 ---*/ + vector Buffer_Send_RefNode(nDim+1, numeric_limits::max()); + su2activematrix Buffer_Recv_RefNode(size,nDim+1); + unsigned long iPointMin = 0; // Initialisaton, otherwise 'may be uninitialized` warning' + + /*-------------------------------------------------------------------------------------------*/ + /*--- Step 1: Find a unique reference node on each rank and communicate them such that ---*/ + /*--- each process has the local ref-nodes from every process. Most processes ---*/ + /*--- won't have a boundary with the streamwise periodic 'inlet' marker, ---*/ + /*--- therefore the default value of the send value is set super high. ---*/ + /*-------------------------------------------------------------------------------------------*/ + + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY) { + + /*--- 1 is the receiver/'inlet', 2 is the donor/'outlet', 0 if no PBC at all. ---*/ + auto iPeriodic = config->GetMarker_All_PerBound(iMarker); + if (iPeriodic == 1) { + + for (auto iVertex = 0ul; iVertex < GetnVertex(iMarker); iVertex++) { + + auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + /*--- Get the squared norm of the current point. sqrt is a monotonic function in [0,R+) so for comparison we dont need Norm. ---*/ + auto norm = GeometryToolbox::SquaredNorm(nDim, nodes->GetCoord(iPoint)); + + /*--- Check if new unique reference node is found and store Point ID. ---*/ + if (norm < min_norm) { + min_norm = norm; + iPointMin = iPoint; + } + /*--- The theoretical case, that multiple inlet points with the same distance to the origin exists, remains. ---*/ + } + break; // Actually no more than one streamwise periodic marker pair is allowed + } // receiver conditional + } // periodic conditional + } // marker loop + + /*--- Copy the Coordinates and norm into send buffer. ---*/ + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Buffer_Send_RefNode[iDim] = nodes->GetCoord(iPointMin,iDim); + Buffer_Send_RefNode[nDim] = min_norm; + + /*--- Communicate unique nodes to all processes. In case of serial mode nothing happens. ---*/ + SU2_MPI::Allgather(Buffer_Send_RefNode.data(), nDim+1, MPI_DOUBLE, + Buffer_Recv_RefNode.data(), nDim+1, MPI_DOUBLE, SU2_MPI::GetComm()); + + /*-------------------------------------------------------------------------------------------*/ + /*--- Step 2: Amongst all local nodes with the smallest distance to the origin, find the ---*/ + /*--- globally closest to the origin. Store the found node coordinates in the ---*/ + /*--- geometry container. ---*/ + /*-------------------------------------------------------------------------------------------*/ + + min_norm = numeric_limits::max(); + + for (int iRank = 0; iRank < size; iRank++) { + + auto norm = Buffer_Recv_RefNode(iRank,nDim); + + /*--- Check if new unique reference node is found. ---*/ + if (norm < min_norm) { + min_norm = norm; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Streamwise_Periodic_RefNode[iDim] = Buffer_Recv_RefNode(iRank,iDim); + } + } + + /*--- Print the reference node to screen. ---*/ + if (rank == MASTER_NODE) { + cout << "Streamwise Periodic Reference Node: ["; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + cout << " " << Streamwise_Periodic_RefNode[iDim]; + cout << " ]" << endl; + } } @@ -7630,7 +7691,7 @@ void CPhysicalGeometry::SetControlVolume(CConfig *config, unsigned short action) } su2double DomainVolume; - SU2_MPI::Allreduce(&my_DomainVolume, &DomainVolume, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&my_DomainVolume, &DomainVolume, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); config->SetDomainVolume(DomainVolume); if ((rank == MASTER_NODE) && (action == ALLOCATE)) { @@ -8199,7 +8260,7 @@ void CPhysicalGeometry::SetColorGrid_Parallel(const CConfig *config) { if (size == SINGLE_NODE) return; - MPI_Comm comm = MPI_COMM_WORLD; + MPI_Comm comm = SU2_MPI::GetComm(); /*--- Linear partitioner object to help prepare parmetis data. ---*/ @@ -8532,21 +8593,21 @@ void CPhysicalGeometry::ComputeMeshQualityStatistics(const CConfig *config) { su2double Global_Ortho_Min, Global_Ortho_Max; SU2_MPI::Allreduce(&orthoMin, &Global_Ortho_Min, 1, - MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&orthoMax, &Global_Ortho_Max, 1, - MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); su2double Global_AR_Min, Global_AR_Max; SU2_MPI::Allreduce(&arMin, &Global_AR_Min, 1, - MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&arMax, &Global_AR_Max, 1, - MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); su2double Global_VR_Min, Global_VR_Max; SU2_MPI::Allreduce(&vrMin, &Global_VR_Min, 1, - MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); SU2_MPI::Allreduce(&vrMax, &Global_VR_Max, 1, - MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); /*--- Print the summary to the console for the user. ---*/ @@ -8624,7 +8685,7 @@ void CPhysicalGeometry::SetBoundSensitivity(CConfig *config) { bool *PointInDomain; nPointLocal = nPoint; - SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); Point2Vertex = new unsigned long[nPointGlobal][2]; PointInDomain = new bool[nPointGlobal]; @@ -8903,7 +8964,7 @@ void CPhysicalGeometry::SetSensitivity(CConfig *config) { /*--- All ranks open the file using MPI. ---*/ - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -8920,7 +8981,7 @@ void CPhysicalGeometry::SetSensitivity(CConfig *config) { /*--- Broadcast the number of variables to all procs and store clearly. ---*/ - SU2_MPI::Bcast(Restart_Vars, nRestart_Vars, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(Restart_Vars, nRestart_Vars, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ @@ -8951,7 +9012,7 @@ void CPhysicalGeometry::SetSensitivity(CConfig *config) { /*--- Broadcast the string names of the variables. ---*/ SU2_MPI::Bcast(mpi_str_buf, nFields*CGNS_STRING_SIZE, MPI_CHAR, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); /*--- Now parse the string names and load into the config class in case we need them for writing visualization files (SU2_SOL). ---*/ @@ -9038,7 +9099,7 @@ void CPhysicalGeometry::SetSensitivity(CConfig *config) { /*--- Communicate metadata. ---*/ - SU2_MPI::Bcast(&Restart_Iter, 1, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&Restart_Iter, 1, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Copy to a su2double structure (because of the SU2_MPI::Bcast doesn't work with passive data)---*/ @@ -9046,7 +9107,7 @@ void CPhysicalGeometry::SetSensitivity(CConfig *config) { for (unsigned short iVar = 0; iVar < 8; iVar++) Restart_Meta[iVar] = Restart_Meta_Passive[iVar]; - SU2_MPI::Bcast(Restart_Meta, 8, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(Restart_Meta, 8, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); /*--- All ranks close the file after writing. ---*/ @@ -9164,7 +9225,7 @@ void CPhysicalGeometry::SetSensitivity(CConfig *config) { /*--- All ranks open the file using MPI. ---*/ - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -9179,7 +9240,7 @@ void CPhysicalGeometry::SetSensitivity(CConfig *config) { /*--- Broadcast the number of variables to all procs and store clearly. ---*/ - SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ @@ -9413,7 +9474,7 @@ void CPhysicalGeometry::ReadUnorderedSensitivity(CConfig *config) { unsigned long myUnmatched = unmatched; unmatched = 0; SU2_MPI::Allreduce(&myUnmatched, &unmatched, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); if ((unmatched > 0) && (rank == MASTER_NODE)) { cout << " Warning: there are " << unmatched; cout << " points with a match distance > 1e-10." << endl; @@ -11028,7 +11089,7 @@ void CPhysicalGeometry::SetGlobalMarkerRoughness(const CConfig* config) { auto sizeLocal = static_cast(nMarker_All); // number of local markers /*--- Communicate size of local marker array and make an array large enough to hold all data. ---*/ - SU2_MPI::Allgather(&sizeLocal, 1, MPI_INT, recvCounts.data(), 1, MPI_INT, MPI_COMM_WORLD); + SU2_MPI::Allgather(&sizeLocal, 1, MPI_INT, recvCounts.data(), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Set the global array of displacements, needed to access the correct roughness element. ---*/ GlobalMarkerStorageDispl.resize(size); @@ -11050,5 +11111,5 @@ void CPhysicalGeometry::SetGlobalMarkerRoughness(const CConfig* config) { /*--- Finally, gather the roughness of all markers. ---*/ SU2_MPI::Allgatherv(localRough.data(), sizeLocal, MPI_DOUBLE, GlobalRoughness_Height.data(), - recvCounts.data(), GlobalMarkerStorageDispl.data(), MPI_DOUBLE, MPI_COMM_WORLD); + recvCounts.data(), GlobalMarkerStorageDispl.data(), MPI_DOUBLE, SU2_MPI::GetComm()); } diff --git a/Common/src/geometry/dual_grid/CDualGrid.cpp b/Common/src/geometry/dual_grid/CDualGrid.cpp index 9e92d133b044..b09df0e32117 100644 --- a/Common/src/geometry/dual_grid/CDualGrid.cpp +++ b/Common/src/geometry/dual_grid/CDualGrid.cpp @@ -2,7 +2,7 @@ * \file CDualGrid.cpp * \brief Main classes for defining the dual grid * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/dual_grid/CEdge.cpp b/Common/src/geometry/dual_grid/CEdge.cpp index 18d38e9cab52..f0aecede3fa0 100644 --- a/Common/src/geometry/dual_grid/CEdge.cpp +++ b/Common/src/geometry/dual_grid/CEdge.cpp @@ -2,7 +2,7 @@ * \file CEdge.cpp * \brief Implementation of the edge class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/dual_grid/CPoint.cpp b/Common/src/geometry/dual_grid/CPoint.cpp index 08ad55cf1fc9..e4fb9944e81f 100644 --- a/Common/src/geometry/dual_grid/CPoint.cpp +++ b/Common/src/geometry/dual_grid/CPoint.cpp @@ -2,7 +2,7 @@ * \file CPoint.cpp * \brief Main classes for defining the points of the dual grid * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/dual_grid/CTurboVertex.cpp b/Common/src/geometry/dual_grid/CTurboVertex.cpp index 1f485d8da1af..429dfc17b456 100644 --- a/Common/src/geometry/dual_grid/CTurboVertex.cpp +++ b/Common/src/geometry/dual_grid/CTurboVertex.cpp @@ -2,7 +2,7 @@ * \file CTurboVertex.cpp * \brief Main classes for defining the turbo vertices of the dual grid * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/dual_grid/CVertex.cpp b/Common/src/geometry/dual_grid/CVertex.cpp index a60dc9bb122f..76e9a518b4a8 100644 --- a/Common/src/geometry/dual_grid/CVertex.cpp +++ b/Common/src/geometry/dual_grid/CVertex.cpp @@ -2,7 +2,7 @@ * \file CVertex.cpp * \brief Main classes for defining the vertices of the dual grid * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/elements/CElement.cpp b/Common/src/geometry/elements/CElement.cpp index adc36c439cc6..d49f13e0839e 100644 --- a/Common/src/geometry/elements/CElement.cpp +++ b/Common/src/geometry/elements/CElement.cpp @@ -2,7 +2,7 @@ * \file CElement.cpp * \brief Definition of the Finite Element structure (elements) * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/elements/CHEXA8.cpp b/Common/src/geometry/elements/CHEXA8.cpp index bf354132841a..815d9628c79c 100644 --- a/Common/src/geometry/elements/CHEXA8.cpp +++ b/Common/src/geometry/elements/CHEXA8.cpp @@ -2,7 +2,7 @@ * \file CHEXA8.cpp * \brief Definition of 8-node hexa element with 8 Gauss points. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/elements/CPRISM6.cpp b/Common/src/geometry/elements/CPRISM6.cpp index cc38c7c9e255..799c43c8e863 100644 --- a/Common/src/geometry/elements/CPRISM6.cpp +++ b/Common/src/geometry/elements/CPRISM6.cpp @@ -2,7 +2,7 @@ * \file CPRISM6.cpp * \brief Definition of the 6-node triangular prism element with 6 Gauss points. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/elements/CPYRAM5.cpp b/Common/src/geometry/elements/CPYRAM5.cpp index 8f82241d68fc..d31aed690124 100644 --- a/Common/src/geometry/elements/CPYRAM5.cpp +++ b/Common/src/geometry/elements/CPYRAM5.cpp @@ -2,7 +2,7 @@ * \file CPYRAM5.cpp * \brief Definition of 5-node pyramid element with 5 Gauss points. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/elements/CQUAD4.cpp b/Common/src/geometry/elements/CQUAD4.cpp index 433c90279089..8d6c98221161 100644 --- a/Common/src/geometry/elements/CQUAD4.cpp +++ b/Common/src/geometry/elements/CQUAD4.cpp @@ -2,7 +2,7 @@ * \file CQUAD4.cpp * \brief Definition of the 4-node quadrilateral element with 4 Gauss points. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/elements/CTETRA1.cpp b/Common/src/geometry/elements/CTETRA1.cpp index 4fd754222d1b..9cb9454c51f8 100644 --- a/Common/src/geometry/elements/CTETRA1.cpp +++ b/Common/src/geometry/elements/CTETRA1.cpp @@ -2,7 +2,7 @@ * \file CTETRA1.cpp * \brief Definition of 4-node tetra element with 1 Gauss point. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/elements/CTRIA1.cpp b/Common/src/geometry/elements/CTRIA1.cpp index 2b33b3857627..5f383fcf364f 100644 --- a/Common/src/geometry/elements/CTRIA1.cpp +++ b/Common/src/geometry/elements/CTRIA1.cpp @@ -2,7 +2,7 @@ * \file CTRIA1.cpp * \brief Definition of the 3-node triangular element with one Gauss point. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/meshreader/CBoxMeshReaderFVM.cpp b/Common/src/geometry/meshreader/CBoxMeshReaderFVM.cpp index 90ede660f4df..54076dbd8d2a 100644 --- a/Common/src/geometry/meshreader/CBoxMeshReaderFVM.cpp +++ b/Common/src/geometry/meshreader/CBoxMeshReaderFVM.cpp @@ -3,7 +3,7 @@ * \brief Reads a 3D box grid into linear partitions for the * finite volume solver (FVM). * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/meshreader/CCGNSMeshReaderFVM.cpp b/Common/src/geometry/meshreader/CCGNSMeshReaderFVM.cpp index 1a4a7d409b33..b23616979a4a 100644 --- a/Common/src/geometry/meshreader/CCGNSMeshReaderFVM.cpp +++ b/Common/src/geometry/meshreader/CCGNSMeshReaderFVM.cpp @@ -3,7 +3,7 @@ * \brief Class that reads a single zone of a CGNS mesh file from disk into * linear partitions across all ranks. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -637,7 +637,7 @@ void CCGNSMeshReaderFVM::ReadCGNSVolumeSection(int val_section) { many cells it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, - &(nElem_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nElem_Recv[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put @@ -1127,37 +1127,37 @@ void CCGNSMeshReaderFVM::InitiateCommsAll(void *bufSend, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_DOUBLE, source, tag, MPI_COMM_WORLD, + count, MPI_DOUBLE, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_UNSIGNED_LONG: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_UNSIGNED_LONG, source, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_LONG, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_LONG: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_LONG, source, tag, MPI_COMM_WORLD, + count, MPI_LONG, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_UNSIGNED_SHORT, source, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_SHORT, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_CHAR: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_CHAR, source, tag, MPI_COMM_WORLD, + count, MPI_CHAR, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_SHORT: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_SHORT, source, tag, MPI_COMM_WORLD, + count, MPI_SHORT, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; case COMM_TYPE_INT: SU2_MPI::Irecv(&(static_cast(bufRecv)[offset]), - count, MPI_INT, source, tag, MPI_COMM_WORLD, + count, MPI_INT, source, tag, SU2_MPI::GetComm(), &(recvReq[iMessage])); break; default: @@ -1202,37 +1202,37 @@ void CCGNSMeshReaderFVM::InitiateCommsAll(void *bufSend, switch (commType) { case COMM_TYPE_DOUBLE: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_DOUBLE, dest, tag, MPI_COMM_WORLD, + count, MPI_DOUBLE, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_UNSIGNED_LONG: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_UNSIGNED_LONG, dest, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_LONG, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_LONG: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_LONG, dest, tag, MPI_COMM_WORLD, + count, MPI_LONG, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_UNSIGNED_SHORT: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_UNSIGNED_SHORT, dest, tag, MPI_COMM_WORLD, + count, MPI_UNSIGNED_SHORT, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_CHAR: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_CHAR, dest, tag, MPI_COMM_WORLD, + count, MPI_CHAR, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_SHORT: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_SHORT, dest, tag, MPI_COMM_WORLD, + count, MPI_SHORT, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; case COMM_TYPE_INT: SU2_MPI::Isend(&(static_cast(bufSend)[offset]), - count, MPI_INT, dest, tag, MPI_COMM_WORLD, + count, MPI_INT, dest, tag, SU2_MPI::GetComm(), &(sendReq[iMessage])); break; default: diff --git a/Common/src/geometry/meshreader/CMeshReaderFVM.cpp b/Common/src/geometry/meshreader/CMeshReaderFVM.cpp index 3274e8203a97..ce5b53f5dd6d 100644 --- a/Common/src/geometry/meshreader/CMeshReaderFVM.cpp +++ b/Common/src/geometry/meshreader/CMeshReaderFVM.cpp @@ -3,7 +3,7 @@ * \brief Helper class that provides the counts for each rank in a linear * partitioning given the global count as input. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/meshreader/CRectangularMeshReaderFVM.cpp b/Common/src/geometry/meshreader/CRectangularMeshReaderFVM.cpp index ec59f1730d8d..2d89f9f92449 100644 --- a/Common/src/geometry/meshreader/CRectangularMeshReaderFVM.cpp +++ b/Common/src/geometry/meshreader/CRectangularMeshReaderFVM.cpp @@ -3,7 +3,7 @@ * \brief Reads a 2D rectangular grid into linear partitions for the * finite volume solver (FVM). * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/meshreader/CSU2ASCIIMeshReaderFVM.cpp b/Common/src/geometry/meshreader/CSU2ASCIIMeshReaderFVM.cpp index ed9855fa543a..480450a87e6b 100644 --- a/Common/src/geometry/meshreader/CSU2ASCIIMeshReaderFVM.cpp +++ b/Common/src/geometry/meshreader/CSU2ASCIIMeshReaderFVM.cpp @@ -3,7 +3,7 @@ * \brief Reads a native SU2 ASCII grid into linear partitions for the * finite volume solver (FVM). * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CHexahedron.cpp b/Common/src/geometry/primal_grid/CHexahedron.cpp index b24caa18f2d3..e71536990f29 100644 --- a/Common/src/geometry/primal_grid/CHexahedron.cpp +++ b/Common/src/geometry/primal_grid/CHexahedron.cpp @@ -2,7 +2,7 @@ * \file CHexahedron.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CLine.cpp b/Common/src/geometry/primal_grid/CLine.cpp index 3cdddbe178e3..7eb589cbd2bc 100644 --- a/Common/src/geometry/primal_grid/CLine.cpp +++ b/Common/src/geometry/primal_grid/CLine.cpp @@ -2,7 +2,7 @@ * \file CLine.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CPrimalGrid.cpp b/Common/src/geometry/primal_grid/CPrimalGrid.cpp index 077923502db9..7593048a17d9 100644 --- a/Common/src/geometry/primal_grid/CPrimalGrid.cpp +++ b/Common/src/geometry/primal_grid/CPrimalGrid.cpp @@ -2,7 +2,7 @@ * \file CPrimalGrid.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CPrimalGridBoundFEM.cpp b/Common/src/geometry/primal_grid/CPrimalGridBoundFEM.cpp index ed26eabbcc32..9e07c168c9d3 100644 --- a/Common/src/geometry/primal_grid/CPrimalGridBoundFEM.cpp +++ b/Common/src/geometry/primal_grid/CPrimalGridBoundFEM.cpp @@ -2,7 +2,7 @@ * \file CPrimalGridBoundFEM.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CPrimalGridFEM.cpp b/Common/src/geometry/primal_grid/CPrimalGridFEM.cpp index 4d5a15f9f7f5..665b14dbafd7 100644 --- a/Common/src/geometry/primal_grid/CPrimalGridFEM.cpp +++ b/Common/src/geometry/primal_grid/CPrimalGridFEM.cpp @@ -2,7 +2,7 @@ * \file CPrimalGridFEM.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CPrism.cpp b/Common/src/geometry/primal_grid/CPrism.cpp index d2a6bbfb1f54..62230e783f63 100644 --- a/Common/src/geometry/primal_grid/CPrism.cpp +++ b/Common/src/geometry/primal_grid/CPrism.cpp @@ -2,7 +2,7 @@ * \file CPrism.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CPyramid.cpp b/Common/src/geometry/primal_grid/CPyramid.cpp index c8048e67e22c..bf1d69087db2 100644 --- a/Common/src/geometry/primal_grid/CPyramid.cpp +++ b/Common/src/geometry/primal_grid/CPyramid.cpp @@ -2,7 +2,7 @@ * \file CPyramid.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CQuadrilateral.cpp b/Common/src/geometry/primal_grid/CQuadrilateral.cpp index 6691474092c7..3e332c9aad06 100644 --- a/Common/src/geometry/primal_grid/CQuadrilateral.cpp +++ b/Common/src/geometry/primal_grid/CQuadrilateral.cpp @@ -2,7 +2,7 @@ * \file CQuadrilateral.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CTetrahedron.cpp b/Common/src/geometry/primal_grid/CTetrahedron.cpp index ef8e8311bba7..612ed31bc273 100644 --- a/Common/src/geometry/primal_grid/CTetrahedron.cpp +++ b/Common/src/geometry/primal_grid/CTetrahedron.cpp @@ -2,7 +2,7 @@ * \file CTetrahedron.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CTriangle.cpp b/Common/src/geometry/primal_grid/CTriangle.cpp index 464de22f4181..421e4739a46f 100644 --- a/Common/src/geometry/primal_grid/CTriangle.cpp +++ b/Common/src/geometry/primal_grid/CTriangle.cpp @@ -2,7 +2,7 @@ * \file CTriangle.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/geometry/primal_grid/CVertexMPI.cpp b/Common/src/geometry/primal_grid/CVertexMPI.cpp index a615d91adfb7..2dcf2446faad 100644 --- a/Common/src/geometry/primal_grid/CVertexMPI.cpp +++ b/Common/src/geometry/primal_grid/CVertexMPI.cpp @@ -2,7 +2,7 @@ * \file CVertexMPI.cpp * \brief Main classes for defining the primal grid elements * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/graph_coloring_structure.cpp b/Common/src/graph_coloring_structure.cpp index f60871e18164..d6e85a739f74 100644 --- a/Common/src/graph_coloring_structure.cpp +++ b/Common/src/graph_coloring_structure.cpp @@ -2,7 +2,7 @@ * \file graph_coloring_structure.cpp * \brief Functions used to carry out the coloring of a given graph. * \author E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -46,8 +46,8 @@ void CGraphColoringStructure::GraphVertexColoring( int myRank = 0; #ifdef HAVE_MPI - SU2_MPI::Comm_rank(MPI_COMM_WORLD, &myRank); - SU2_MPI::Comm_size(MPI_COMM_WORLD, &nRank); + SU2_MPI::Comm_rank(SU2_MPI::GetComm(), &myRank); + SU2_MPI::Comm_size(SU2_MPI::GetComm(), &nRank); #endif /*--- Determine the algorithm to use for the graph coloring. ---*/ @@ -81,7 +81,7 @@ void CGraphColoringStructure::GraphVertexColoring( /* Determine the size of the message to be received. */ SU2_MPI::Status status; - SU2_MPI::Probe(rank, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(rank, rank, SU2_MPI::GetComm(), &status); int sizeMess; SU2_MPI::Get_count(&status, MPI_UNSIGNED_LONG, &sizeMess); @@ -89,7 +89,7 @@ void CGraphColoringStructure::GraphVertexColoring( /* Allocate the memory for the receive buffer and receive the message. */ vector recvBuf(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, rank, rank, - MPI_COMM_WORLD, &status); + SU2_MPI::GetComm(), &status); /* Store the data just received in the global vector for the graph. */ unsigned long ii = 0; @@ -195,7 +195,7 @@ void CGraphColoringStructure::GraphVertexColoring( for(int rank=1; rankGetKind_GridMovement() == AEROELASTIC_RIGID_MOTION) { su2double Omega, dt, psi; dt = config->GetDelta_UnstTimeND(); - Omega = (config->GetRotation_Rate(3)/config->GetOmega_Ref()); + Omega = config->GetRotation_Rate(2)/config->GetOmega_Ref(); psi = Omega*(dt*TimeIter); /*--- Correct for the airfoil starting position (This is hardcoded in here) ---*/ @@ -4319,7 +4319,7 @@ void CSurfaceMovement::ReadFFDInfo(CGeometry *geometry, CConfig *config, CFreeFo #ifdef HAVE_MPI nSurfPoints = 0; - SU2_MPI::Allreduce(&my_nSurfPoints, &nSurfPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&my_nSurfPoints, &nSurfPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); if (rank == MASTER_NODE) cout << "Surface points: " << nSurfPoints <<"."<< endl; #else nSurfPoints = my_nSurfPoints; @@ -4616,8 +4616,8 @@ void CSurfaceMovement::MergeFFDInfo(CGeometry *geometry, CConfig *config) { /*--- Communicate the total number of nodes on this domain. ---*/ SU2_MPI::Gather(&Buffer_Send_nPoint, 1, MPI_UNSIGNED_LONG, - Buffer_Recv_nPoint, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&nLocalPoint, &MaxLocalPoint, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); + Buffer_Recv_nPoint, 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&nLocalPoint, &MaxLocalPoint, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); nBuffer_Scalar = MaxLocalPoint; @@ -4692,11 +4692,11 @@ void CSurfaceMovement::MergeFFDInfo(CGeometry *geometry, CConfig *config) { /*--- Gather the coordinate data on the master node using MPI. ---*/ - SU2_MPI::Gather(Buffer_Send_X, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_X, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Y, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_Y, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Z, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_Z, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Point, nBuffer_Scalar, MPI_UNSIGNED_LONG, Buffer_Recv_Point, nBuffer_Scalar, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_MarkerIndex_CfgFile, nBuffer_Scalar, MPI_UNSIGNED_SHORT, Buffer_Recv_MarkerIndex_CfgFile, nBuffer_Scalar, MPI_UNSIGNED_SHORT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(Buffer_Send_X, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_X, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Y, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_Y, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Z, nBuffer_Scalar, MPI_DOUBLE, Buffer_Recv_Z, nBuffer_Scalar, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Point, nBuffer_Scalar, MPI_UNSIGNED_LONG, Buffer_Recv_Point, nBuffer_Scalar, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_MarkerIndex_CfgFile, nBuffer_Scalar, MPI_UNSIGNED_SHORT, Buffer_Recv_MarkerIndex_CfgFile, nBuffer_Scalar, MPI_UNSIGNED_SHORT, MASTER_NODE, SU2_MPI::GetComm()); /*--- The master node unpacks and sorts this variable by global index ---*/ @@ -4966,7 +4966,7 @@ unsigned long CSurfaceMovement::calculateJacobianDeterminant(CGeometry *geometry } unsigned long tmp = negative_determinants; - SU2_MPI::Allreduce(&tmp, &negative_determinants, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &negative_determinants, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); return negative_determinants; } diff --git a/Common/src/grid_movement/CVolumetricMovement.cpp b/Common/src/grid_movement/CVolumetricMovement.cpp index 35d45cacddcd..bf448631c6a8 100644 --- a/Common/src/grid_movement/CVolumetricMovement.cpp +++ b/Common/src/grid_movement/CVolumetricMovement.cpp @@ -2,7 +2,7 @@ * \file CVolumetricMovement.cpp * \brief Subroutines for moving mesh volume elements * \author F. Palacios, T. Economon, S. Padron - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -168,11 +168,11 @@ void CVolumetricMovement::SetVolume_Deformation(CGeometry *geometry, CConfig *co so that all nodes have the same solution and r.h.s. entries across all partitions. ---*/ - StiffMatrix.InitiateComms(LinSysSol, geometry, config, SOLUTION_MATRIX); - StiffMatrix.CompleteComms(LinSysSol, geometry, config, SOLUTION_MATRIX); + CSysMatrixComms::Initiate(LinSysSol, geometry, config); + CSysMatrixComms::Complete(LinSysSol, geometry, config); - StiffMatrix.InitiateComms(LinSysRes, geometry, config, SOLUTION_MATRIX); - StiffMatrix.CompleteComms(LinSysRes, geometry, config, SOLUTION_MATRIX); + CSysMatrixComms::Initiate(LinSysRes, geometry, config); + CSysMatrixComms::Complete(LinSysRes, geometry, config); /*--- Definition of the preconditioner matrix vector multiplication, and linear solver ---*/ @@ -281,9 +281,9 @@ void CVolumetricMovement::ComputeDeforming_Element_Volume(CGeometry *geometry, s unsigned long ElemCounter_Local = ElemCounter; ElemCounter = 0; su2double MaxVolume_Local = MaxVolume; MaxVolume = 0.0; su2double MinVolume_Local = MinVolume; MinVolume = 0.0; - SU2_MPI::Allreduce(&ElemCounter_Local, &ElemCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MaxVolume_Local, &MaxVolume, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MinVolume_Local, &MinVolume, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&ElemCounter_Local, &ElemCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MaxVolume_Local, &MaxVolume, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MinVolume_Local, &MinVolume, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); #endif /*--- Volume from 0 to 1 ---*/ @@ -418,7 +418,7 @@ void CVolumetricMovement::ComputenNonconvexElements(CGeometry *geometry, bool Sc } unsigned long nNonconvexElements_Local = nNonconvexElements; nNonconvexElements = 0; - SU2_MPI::Allreduce(&nNonconvexElements_Local, &nNonconvexElements, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nNonconvexElements_Local, &nNonconvexElements, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- Set number of nonconvex elements in geometry ---*/ geometry->SetnNonconvexElements(nNonconvexElements); @@ -513,8 +513,8 @@ void CVolumetricMovement::ComputeSolid_Wall_Distance(CGeometry *geometry, CConfi MinDistance_Local = MinDistance; MinDistance = 0.0; #ifdef HAVE_MPI - SU2_MPI::Allreduce(&MaxDistance_Local, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MinDistance_Local, &MinDistance, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MaxDistance_Local, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MinDistance_Local, &MinDistance, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); #else MaxDistance = MaxDistance_Local; MinDistance = MinDistance_Local; @@ -1641,7 +1641,7 @@ void CVolumetricMovement::SetBoundaryDisplacements(CGeometry *geometry, CConfig VarIncrement = 1.0/((su2double)config->GetGridDef_Nonlinear_Iter()); /*--- As initialization, set to zero displacements of all the surfaces except the symmetry - plane, internal and periodic bc the receive boundaries and periodic boundaries. ---*/ + plane (which is treated specially, see below), internal and the send-receive boundaries ---*/ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { if (((config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE) && diff --git a/Common/src/interface_interpolation/CInterpolator.cpp b/Common/src/interface_interpolation/CInterpolator.cpp index 22b0f631454f..95b5eb2c79e7 100644 --- a/Common/src/interface_interpolation/CInterpolator.cpp +++ b/Common/src/interface_interpolation/CInterpolator.cpp @@ -2,7 +2,7 @@ * \file CInterpolator.cpp * \brief Definition of the base class for interface interpolation. * \author H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -46,8 +46,8 @@ bool CInterpolator::CheckInterfaceBoundary(int markDonor, int markTarget) { /*--- Determine whether the boundary is not on the rank because of * the partition or because it is not part of the zone. ---*/ int donorCheck = -1, targetCheck = -1; - SU2_MPI::Allreduce(&markDonor, &donorCheck, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&markTarget, &targetCheck, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&markDonor, &donorCheck, 1, MPI_INT, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&markTarget, &targetCheck, 1, MPI_INT, MPI_MAX, SU2_MPI::GetComm()); return (donorCheck != -1) && (targetCheck != -1); } @@ -74,9 +74,9 @@ void CInterpolator::Determine_ArraySize(int markDonor, int markTarget, Buffer_Send_nVertex_Donor[0] = nLocalVertex_Donor; /*--- Send Interface vertex information --*/ - SU2_MPI::Allreduce(&nLocalVertex_Donor, &MaxLocalVertex_Donor, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nLocalVertex_Donor, &MaxLocalVertex_Donor, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); SU2_MPI::Allgather(Buffer_Send_nVertex_Donor, 1, MPI_UNSIGNED_LONG, - Buffer_Receive_nVertex_Donor, 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + Buffer_Receive_nVertex_Donor, 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); } void CInterpolator::Collect_VertexInfo(int markDonor, int markTarget, @@ -105,9 +105,9 @@ void CInterpolator::Collect_VertexInfo(int markDonor, int markTarget, auto nBuffer_Point = MaxLocalVertex_Donor; SU2_MPI::Allgather(Buffer_Send_Coord, nBuffer_Coord, MPI_DOUBLE, - Buffer_Receive_Coord, nBuffer_Coord, MPI_DOUBLE, MPI_COMM_WORLD); + Buffer_Receive_Coord, nBuffer_Coord, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(Buffer_Send_GlobalPoint, nBuffer_Point, MPI_LONG, - Buffer_Receive_GlobalPoint, nBuffer_Point, MPI_LONG, MPI_COMM_WORLD); + Buffer_Receive_GlobalPoint, nBuffer_Point, MPI_LONG, SU2_MPI::GetComm()); } unsigned long CInterpolator::Collect_ElementInfo(int markDonor, unsigned short nDim, bool compress, @@ -120,7 +120,7 @@ unsigned long CInterpolator::Collect_ElementInfo(int markDonor, unsigned short n if (markDonor != -1) nElemDonor = donor_geometry->GetnElem_Bound(markDonor); allNumElem.resize(size); - SU2_MPI::Allgather(&nElemDonor, 1, MPI_UNSIGNED_LONG, allNumElem.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + SU2_MPI::Allgather(&nElemDonor, 1, MPI_UNSIGNED_LONG, allNumElem.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); auto nMaxElemDonor = *max_element(allNumElem.begin(), allNumElem.end()); @@ -144,9 +144,9 @@ unsigned long CInterpolator::Collect_ElementInfo(int markDonor, unsigned short n } SU2_MPI::Allgather(bufferSendNum.data(), bufferSendNum.size(), MPI_UNSIGNED_SHORT, - numNodes.data(), bufferSendNum.size(), MPI_UNSIGNED_SHORT, MPI_COMM_WORLD); + numNodes.data(), bufferSendNum.size(), MPI_UNSIGNED_SHORT, SU2_MPI::GetComm()); SU2_MPI::Allgather(bufferSendIdx.data(), bufferSendIdx.size(), MPI_LONG, - idxNodes.data(), bufferSendIdx.size(), MPI_LONG, MPI_COMM_WORLD); + idxNodes.data(), bufferSendIdx.size(), MPI_LONG, SU2_MPI::GetComm()); if (!compress) return accumulate(allNumElem.begin(), allNumElem.end(), 0ul); @@ -275,8 +275,8 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ /*--- Reconstruct boundary by gathering data from all ranks ---*/ - SU2_MPI::Allreduce( &nLocalVertex, &nGlobalVertex, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&nLocalLinkedNodes, &nGlobalLinkedNodes, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce( &nLocalVertex, &nGlobalVertex, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&nLocalLinkedNodes, &nGlobalLinkedNodes, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); Buffer_Receive_Coord = new su2double [ nGlobalVertex * nDim ]; Buffer_Receive_GlobalPoint = new long[ nGlobalVertex ]; @@ -307,15 +307,15 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ for(iRank = 1; iRank < nProcessor; iRank++){ - SU2_MPI::Recv( &iTmp2, 1, MPI_UNSIGNED_LONG, iRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - SU2_MPI::Recv(&Buffer_Receive_LinkedNodes[tmp_index_2], iTmp2, MPI_UNSIGNED_LONG, iRank, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + SU2_MPI::Recv( &iTmp2, 1, MPI_UNSIGNED_LONG, iRank, 0, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); + SU2_MPI::Recv(&Buffer_Receive_LinkedNodes[tmp_index_2], iTmp2, MPI_UNSIGNED_LONG, iRank, 1, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); - SU2_MPI::Recv( &iTmp, 1, MPI_UNSIGNED_LONG, iRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - SU2_MPI::Recv(&Buffer_Receive_Coord[tmp_index*nDim], nDim*iTmp, MPI_DOUBLE, iRank, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + SU2_MPI::Recv( &iTmp, 1, MPI_UNSIGNED_LONG, iRank, 0, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); + SU2_MPI::Recv(&Buffer_Receive_Coord[tmp_index*nDim], nDim*iTmp, MPI_DOUBLE, iRank, 1, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); - SU2_MPI::Recv( &Buffer_Receive_GlobalPoint[tmp_index], iTmp, MPI_LONG, iRank, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - SU2_MPI::Recv( &Buffer_Receive_nLinkedNodes[tmp_index], iTmp, MPI_UNSIGNED_LONG, iRank, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - SU2_MPI::Recv(&Buffer_Receive_StartLinkedNodes[tmp_index], iTmp, MPI_UNSIGNED_LONG, iRank, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + SU2_MPI::Recv( &Buffer_Receive_GlobalPoint[tmp_index], iTmp, MPI_LONG, iRank, 1, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); + SU2_MPI::Recv( &Buffer_Receive_nLinkedNodes[tmp_index], iTmp, MPI_UNSIGNED_LONG, iRank, 1, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); + SU2_MPI::Recv(&Buffer_Receive_StartLinkedNodes[tmp_index], iTmp, MPI_UNSIGNED_LONG, iRank, 1, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); for (iVertex = 0; iVertex < iTmp; iVertex++){ Buffer_Receive_Proc[ tmp_index + iVertex ] = iRank; @@ -327,15 +327,15 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ } } else{ - SU2_MPI::Send( &nLocalLinkedNodes, 1, MPI_UNSIGNED_LONG, 0, 0, MPI_COMM_WORLD); - SU2_MPI::Send(Buffer_Send_LinkedNodes, nLocalLinkedNodes, MPI_UNSIGNED_LONG, 0, 1, MPI_COMM_WORLD); + SU2_MPI::Send( &nLocalLinkedNodes, 1, MPI_UNSIGNED_LONG, 0, 0, SU2_MPI::GetComm()); + SU2_MPI::Send(Buffer_Send_LinkedNodes, nLocalLinkedNodes, MPI_UNSIGNED_LONG, 0, 1, SU2_MPI::GetComm()); - SU2_MPI::Send( &nLocalVertex, 1, MPI_UNSIGNED_LONG, 0, 0, MPI_COMM_WORLD); - SU2_MPI::Send(Buffer_Send_Coord, nDim * nLocalVertex, MPI_DOUBLE, 0, 1, MPI_COMM_WORLD); + SU2_MPI::Send( &nLocalVertex, 1, MPI_UNSIGNED_LONG, 0, 0, SU2_MPI::GetComm()); + SU2_MPI::Send(Buffer_Send_Coord, nDim * nLocalVertex, MPI_DOUBLE, 0, 1, SU2_MPI::GetComm()); - SU2_MPI::Send( Buffer_Send_GlobalPoint, nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, MPI_COMM_WORLD); - SU2_MPI::Send( Buffer_Send_nLinkedNodes, nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, MPI_COMM_WORLD); - SU2_MPI::Send(Buffer_Send_StartLinkedNodes, nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, MPI_COMM_WORLD); + SU2_MPI::Send( Buffer_Send_GlobalPoint, nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, SU2_MPI::GetComm()); + SU2_MPI::Send( Buffer_Send_nLinkedNodes, nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, SU2_MPI::GetComm()); + SU2_MPI::Send(Buffer_Send_StartLinkedNodes, nLocalVertex, MPI_UNSIGNED_LONG, 0, 1, SU2_MPI::GetComm()); } #else for (iVertex = 0; iVertex < nDim * nGlobalVertex; iVertex++) @@ -378,13 +378,13 @@ void CInterpolator::ReconstructBoundary(unsigned long val_zone, int val_marker){ } } - SU2_MPI::Bcast(Buffer_Receive_GlobalPoint, nGlobalVertex, MPI_LONG, 0, MPI_COMM_WORLD); - SU2_MPI::Bcast(Buffer_Receive_Coord, nGlobalVertex*nDim, MPI_DOUBLE, 0, MPI_COMM_WORLD); - SU2_MPI::Bcast(Buffer_Receive_Proc, nGlobalVertex, MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD); + SU2_MPI::Bcast(Buffer_Receive_GlobalPoint, nGlobalVertex, MPI_LONG, 0, SU2_MPI::GetComm()); + SU2_MPI::Bcast(Buffer_Receive_Coord, nGlobalVertex*nDim, MPI_DOUBLE, 0, SU2_MPI::GetComm()); + SU2_MPI::Bcast(Buffer_Receive_Proc, nGlobalVertex, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); - SU2_MPI::Bcast(Buffer_Receive_nLinkedNodes, nGlobalVertex, MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD); - SU2_MPI::Bcast(Buffer_Receive_StartLinkedNodes, nGlobalVertex, MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD); - SU2_MPI::Bcast(Buffer_Receive_LinkedNodes, nGlobalLinkedNodes, MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD); + SU2_MPI::Bcast(Buffer_Receive_nLinkedNodes, nGlobalVertex, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); + SU2_MPI::Bcast(Buffer_Receive_StartLinkedNodes, nGlobalVertex, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); + SU2_MPI::Bcast(Buffer_Receive_LinkedNodes, nGlobalLinkedNodes, MPI_UNSIGNED_LONG, 0, SU2_MPI::GetComm()); delete [] Buffer_Send_Coord; Buffer_Send_Coord = nullptr; delete [] Buffer_Send_GlobalPoint; Buffer_Send_GlobalPoint = nullptr; diff --git a/Common/src/interface_interpolation/CInterpolatorFactory.cpp b/Common/src/interface_interpolation/CInterpolatorFactory.cpp index 625294274beb..8bf2ea30cf6d 100644 --- a/Common/src/interface_interpolation/CInterpolatorFactory.cpp +++ b/Common/src/interface_interpolation/CInterpolatorFactory.cpp @@ -1,7 +1,7 @@ /*! * \file CInterpolatorFactory.cpp * \brief Factory to generate interpolator objects. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/interface_interpolation/CIsoparametric.cpp b/Common/src/interface_interpolation/CIsoparametric.cpp index 590c32bf7bc6..c0589a2a88e8 100644 --- a/Common/src/interface_interpolation/CIsoparametric.cpp +++ b/Common/src/interface_interpolation/CIsoparametric.cpp @@ -2,7 +2,7 @@ * \file CIsoparametric.cpp * \brief Implementation isoparametric interpolation (using FE shape functions). * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -266,9 +266,9 @@ void CIsoparametric::SetTransferCoeff(const CConfig* const* config) { /*--- Final reduction of statistics. ---*/ su2double tmp = MaxDistance; unsigned long tmp1 = ErrorCounter, tmp2 = nGlobalVertexTarget; - SU2_MPI::Allreduce(&tmp, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&tmp1, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&tmp2, &nGlobalVertexTarget, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&tmp1, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&tmp2, &nGlobalVertexTarget, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); ErrorRate = 100*su2double(ErrorCounter) / nGlobalVertexTarget; diff --git a/Common/src/interface_interpolation/CMirror.cpp b/Common/src/interface_interpolation/CMirror.cpp index 502ae2714009..0ef8a55d7511 100644 --- a/Common/src/interface_interpolation/CMirror.cpp +++ b/Common/src/interface_interpolation/CMirror.cpp @@ -2,7 +2,7 @@ * \file CMirror.cpp * \brief Implementation of mirror interpolation (conservative approach in FSI problems). * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -93,11 +93,11 @@ void CMirror::SetTransferCoeff(const CConfig* const* config) { /*--- Communicate vertex and donor node counts. ---*/ SU2_MPI::Allgather(&nVertexTarget, 1, MPI_UNSIGNED_LONG, - allNumVertexTarget.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + allNumVertexTarget.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); SU2_MPI::Allgather(&nVertexDonorLocal, 1, MPI_UNSIGNED_LONG, - allNumVertexDonor.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + allNumVertexDonor.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); SU2_MPI::Allgather(&nNodeDonorLocal, 1, MPI_UNSIGNED_LONG, - allNumNodeDonor.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + allNumNodeDonor.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); /*--- Copy donor interpolation matrix (triplet format). ---*/ vector sendGlobalIndex(nNodeDonorLocal); @@ -175,15 +175,15 @@ void CMirror::SetTransferCoeff(const CConfig* const* config) { GlobalIndex[iSend] = new long [numCoeff]; DonorIndex[iSend] = new long [numCoeff]; DonorCoeff[iSend] = new su2double [numCoeff]; - SU2_MPI::Recv(GlobalIndex[iSend], numCoeff, MPI_LONG, jProcessor, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - SU2_MPI::Recv(DonorIndex[iSend], numCoeff, MPI_LONG, jProcessor, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - SU2_MPI::Recv(DonorCoeff[iSend], numCoeff, MPI_DOUBLE, jProcessor, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + SU2_MPI::Recv(GlobalIndex[iSend], numCoeff, MPI_LONG, jProcessor, 0, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); + SU2_MPI::Recv(DonorIndex[iSend], numCoeff, MPI_LONG, jProcessor, 0, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); + SU2_MPI::Recv(DonorCoeff[iSend], numCoeff, MPI_DOUBLE, jProcessor, 0, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); } else if (rank == jProcessor) { /*--- "I'm" the donor, send. ---*/ - SU2_MPI::Send(sendGlobalIndex.data(), numCoeff, MPI_LONG, iProcessor, 0, MPI_COMM_WORLD); - SU2_MPI::Send(sendDonorIndex.data(), numCoeff, MPI_LONG, iProcessor, 0, MPI_COMM_WORLD); - SU2_MPI::Send(sendDonorCoeff.data(), numCoeff, MPI_DOUBLE, iProcessor, 0, MPI_COMM_WORLD); + SU2_MPI::Send(sendGlobalIndex.data(), numCoeff, MPI_LONG, iProcessor, 0, SU2_MPI::GetComm()); + SU2_MPI::Send(sendDonorIndex.data(), numCoeff, MPI_LONG, iProcessor, 0, SU2_MPI::GetComm()); + SU2_MPI::Send(sendDonorCoeff.data(), numCoeff, MPI_DOUBLE, iProcessor, 0, SU2_MPI::GetComm()); } } } diff --git a/Common/src/interface_interpolation/CNearestNeighbor.cpp b/Common/src/interface_interpolation/CNearestNeighbor.cpp index e1de1ff93021..e29d893c1fe0 100644 --- a/Common/src/interface_interpolation/CNearestNeighbor.cpp +++ b/Common/src/interface_interpolation/CNearestNeighbor.cpp @@ -2,7 +2,7 @@ * \file CNearestNeighbor.cpp * \brief Implementation of nearest neighbor interpolation. * \author H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -177,10 +177,10 @@ void CNearestNeighbor::SetTransferCoeff(const CConfig* const* config) { delete[] Buffer_Receive_nVertex_Donor; unsigned long tmp = totalTargetPoints; - SU2_MPI::Allreduce(&tmp, &totalTargetPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &totalTargetPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); su2double tmp1 = AvgDistance, tmp2 = MaxDistance; - SU2_MPI::Allreduce(&tmp1, &AvgDistance, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&tmp2, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp1, &AvgDistance, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&tmp2, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); AvgDistance /= totalTargetPoints; } diff --git a/Common/src/interface_interpolation/CRadialBasisFunction.cpp b/Common/src/interface_interpolation/CRadialBasisFunction.cpp index fcbf242537af..2b88464dea71 100644 --- a/Common/src/interface_interpolation/CRadialBasisFunction.cpp +++ b/Common/src/interface_interpolation/CRadialBasisFunction.cpp @@ -2,7 +2,7 @@ * \file CRadialBasisFunction.cpp * \brief Implementation of RBF interpolation. * \author Joel Ho, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -250,25 +250,25 @@ void CRadialBasisFunction::SetTransferCoeff(const CConfig* const* config) { #ifdef HAVE_MPI /*--- For simplicity, broadcast small information about the interpolation matrix. ---*/ - SU2_MPI::Bcast(&nPolynomial, 1, MPI_INT, iProcessor, MPI_COMM_WORLD); - SU2_MPI::Bcast(keepPolynomialRow.data(), nDim, MPI_INT, iProcessor, MPI_COMM_WORLD); + SU2_MPI::Bcast(&nPolynomial, 1, MPI_INT, iProcessor, SU2_MPI::GetComm()); + SU2_MPI::Bcast(keepPolynomialRow.data(), nDim, MPI_INT, iProcessor, SU2_MPI::GetComm()); /*--- Send C_inv_trunc only to the ranks that need it (those with target points), * partial broadcast. MPI wrapper not used due to passive double. ---*/ vector allNumVertex(nProcessor); SU2_MPI::Allgather(&nVertexTarget, 1, MPI_UNSIGNED_LONG, - allNumVertex.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + allNumVertex.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); if (rank == iProcessor) { for (int jProcessor = 0; jProcessor < nProcessor; ++jProcessor) if ((jProcessor != iProcessor) && (allNumVertex[jProcessor] != 0)) MPI_Send(C_inv_trunc.data(), C_inv_trunc.size(), - MPI_DOUBLE, jProcessor, 0, MPI_COMM_WORLD); + MPI_DOUBLE, jProcessor, 0, SU2_MPI::GetComm()); } else if (nVertexTarget != 0) { C_inv_trunc.resize(1+nPolynomial+nGlobalVertexDonor, nGlobalVertexDonor); MPI_Recv(C_inv_trunc.data(), C_inv_trunc.size(), MPI_DOUBLE, - iProcessor, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + iProcessor, 0, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); } #endif @@ -403,7 +403,7 @@ void CRadialBasisFunction::SetTransferCoeff(const CConfig* const* config) { /*--- Final reduction of interpolation statistics and basic sanity checks. ---*/ auto Reduce = [](SU2_MPI::Op op, unsigned long &val) { auto tmp = val; - SU2_MPI::Allreduce(&tmp, &val, 1, MPI_UNSIGNED_LONG, op, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &val, 1, MPI_UNSIGNED_LONG, op, SU2_MPI::GetComm()); }; Reduce(MPI_SUM, totalTargetPoints); Reduce(MPI_SUM, totalDonorPoints); @@ -412,8 +412,8 @@ void CRadialBasisFunction::SetTransferCoeff(const CConfig* const* config) { Reduce(MPI_MAX, MaxDonors); #ifdef HAVE_MPI passivedouble tmp1 = AvgCorrection, tmp2 = MaxCorrection; - MPI_Allreduce(&tmp1, &AvgCorrection, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - MPI_Allreduce(&tmp2, &MaxCorrection, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + MPI_Allreduce(&tmp1, &AvgCorrection, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + MPI_Allreduce(&tmp2, &MaxCorrection, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); #endif if (totalTargetPoints == 0) SU2_MPI::Error("Somehow there are no target interpolation points.", CURRENT_FUNCTION); diff --git a/Common/src/interface_interpolation/CSlidingMesh.cpp b/Common/src/interface_interpolation/CSlidingMesh.cpp index fb856382b7a7..0df50ec2fd42 100644 --- a/Common/src/interface_interpolation/CSlidingMesh.cpp +++ b/Common/src/interface_interpolation/CSlidingMesh.cpp @@ -2,7 +2,7 @@ * \file CSlidingMesh.cpp * \brief Implementation of sliding mesh interpolation. * \author H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/linear_algebra/CPastixWrapper.cpp b/Common/src/linear_algebra/CPastixWrapper.cpp index 9a1c67d86e36..af199bd8eff5 100644 --- a/Common/src/linear_algebra/CPastixWrapper.cpp +++ b/Common/src/linear_algebra/CPastixWrapper.cpp @@ -3,7 +3,7 @@ * \brief An interface to the INRIA solver PaStiX * (http://pastix.gforge.inria.fr/files/README-txt.html) * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -113,7 +113,7 @@ void CPastixWrapper::Initialize(CGeometry *geometry, const CConfig * #ifdef HAVE_MPI vector domain_sizes(mpi_size); - MPI_Allgather(&nPointDomain, 1, MPI_UNSIGNED_LONG, domain_sizes.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + MPI_Allgather(&nPointDomain, 1, MPI_UNSIGNED_LONG, domain_sizes.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); for (int i=0; i::Initialize(CGeometry *geometry, const CConfig * /*--- Send and Receive data ---*/ MPI_Sendrecv(Buffer_Send.data(), nVertexS, MPI_UNSIGNED_LONG, sender, 0, Buffer_Recv.data(), nVertexR, MPI_UNSIGNED_LONG, recver, 0, - MPI_COMM_WORLD, MPI_STATUS_IGNORE); + SU2_MPI::GetComm(), MPI_STATUS_IGNORE); /*--- Store received data---*/ for (unsigned long iVertex = 0; iVertex < nVertexR; iVertex++) @@ -333,5 +333,8 @@ void CPastixWrapper::Factorize(CGeometry *geometry, const CConfig *c template class CPastixWrapper; #else template class CPastixWrapper; +#ifdef USE_MIXED_PRECISION +template class CPastixWrapper; +#endif #endif #endif diff --git a/Common/src/linear_algebra/CSysMatrix.cpp b/Common/src/linear_algebra/CSysMatrix.cpp index dd6aaae8f620..5acf31fac080 100644 --- a/Common/src/linear_algebra/CSysMatrix.cpp +++ b/Common/src/linear_algebra/CSysMatrix.cpp @@ -2,7 +2,7 @@ * \file CSysMatrix.cpp * \brief Implementation of the sparse matrix class. * \author F. Palacios, A. Bueno, T. Economon, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -28,8 +28,6 @@ #include "../../include/linear_algebra/CSysMatrix.inl" #include "../../include/geometry/CGeometry.hpp" -#include "../../include/CConfig.hpp" -#include "../../include/parallelization/omp_structure.hpp" #include "../../include/toolboxes/allocation_toolbox.hpp" #include @@ -226,44 +224,29 @@ void CSysMatrix::Initialize(unsigned long npoint, unsigned long npoi } -template -template -void CSysMatrix::InitiateComms(const CSysVector & x, - CGeometry *geometry, - const CConfig *config, - unsigned short commType) const { +template +void CSysMatrixComms::Initiate(const CSysVector& x, CGeometry *geometry, + const CConfig *config, unsigned short commType) { + if (geometry->nP2PSend == 0) return; /*--- Local variables ---*/ - unsigned short iVar; - unsigned short COUNT_PER_POINT = 0; - unsigned short MPI_TYPE = 0; - - unsigned long iPoint, msg_offset, buf_offset; - - int iMessage, iSend, nSend; + const unsigned short COUNT_PER_POINT = x.GetNVar(); + const unsigned short MPI_TYPE = COMM_TYPE_DOUBLE; /*--- Create a boolean for reversing the order of comms. ---*/ - bool reverse = false; + const bool reverse = (commType == SOLUTION_MATRIXTRANS); /*--- Set the size of the data packet and type depending on quantity. ---*/ switch (commType) { case SOLUTION_MATRIX: - COUNT_PER_POINT = nVar; - MPI_TYPE = COMM_TYPE_DOUBLE; - reverse = false; - break; case SOLUTION_MATRIXTRANS: - COUNT_PER_POINT = nEqn; - MPI_TYPE = COMM_TYPE_DOUBLE; - reverse = true; break; default: - SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", - CURRENT_FUNCTION); + SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); break; } @@ -274,10 +257,6 @@ void CSysMatrix::InitiateComms(const CSysVector & x, geometry->AllocateP2PComms(COUNT_PER_POINT); - /*--- Set some local pointers to make access simpler. ---*/ - - su2double *bufDSend = geometry->bufD_P2PSend; - /*--- Load the specified quantity from the solver into the generic communication buffer in the geometry class. ---*/ @@ -285,79 +264,77 @@ void CSysMatrix::InitiateComms(const CSysVector & x, geometry->PostP2PRecvs(geometry, config, MPI_TYPE, COUNT_PER_POINT, reverse); - for (iMessage = 0; iMessage < geometry->nP2PSend; iMessage++) { + for (auto iMessage = 0; iMessage < geometry->nP2PSend; iMessage++) { switch (commType) { - case SOLUTION_MATRIX: + case SOLUTION_MATRIX: { + + su2double* bufDSend = geometry->bufD_P2PSend; /*--- Get the offset for the start of this message. ---*/ - msg_offset = geometry->nPoint_P2PSend[iMessage]; + const auto msg_offset = geometry->nPoint_P2PSend[iMessage]; /*--- Total count can include multiple pieces of data per point. ---*/ - nSend = (geometry->nPoint_P2PSend[iMessage+1] - - geometry->nPoint_P2PSend[iMessage]); + const auto nSend = (geometry->nPoint_P2PSend[iMessage+1] - geometry->nPoint_P2PSend[iMessage]); - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (iSend = 0; iSend < nSend; iSend++) { + SU2_OMP_FOR_STAT(CSysMatrix::OMP_MIN_SIZE) + for (auto iSend = 0; iSend < nSend; iSend++) { /*--- Get the local index for this communicated data. ---*/ - iPoint = geometry->Local_Point_P2PSend[msg_offset + iSend]; + const auto iPoint = geometry->Local_Point_P2PSend[msg_offset + iSend]; /*--- Compute the offset in the recv buffer for this point. ---*/ - buf_offset = (msg_offset + iSend)*COUNT_PER_POINT; + const auto buf_offset = (msg_offset + iSend)*COUNT_PER_POINT; /*--- Load the buffer with the data to be sent. ---*/ - for (iVar = 0; iVar < nVar; iVar++) + for (auto iVar = 0ul; iVar < x.GetNVar(); iVar++) bufDSend[buf_offset+iVar] = x(iPoint,iVar); - } - break; + } - case SOLUTION_MATRIXTRANS: + case SOLUTION_MATRIXTRANS: { /*--- We are going to communicate in reverse, so we use the recv buffer for the send instead. Also, all of the offsets and counts are derived from the recv data structures. ---*/ - bufDSend = geometry->bufD_P2PRecv; + su2double* bufDSend = geometry->bufD_P2PRecv; /*--- Get the offset for the start of this message. ---*/ - msg_offset = geometry->nPoint_P2PRecv[iMessage]; + const auto msg_offset = geometry->nPoint_P2PRecv[iMessage]; /*--- Total count can include multiple pieces of data per point. ---*/ - nSend = (geometry->nPoint_P2PRecv[iMessage+1] - - geometry->nPoint_P2PRecv[iMessage]); + const auto nSend = (geometry->nPoint_P2PRecv[iMessage+1] - geometry->nPoint_P2PRecv[iMessage]); - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (iSend = 0; iSend < nSend; iSend++) { + SU2_OMP_FOR_STAT(CSysMatrix::OMP_MIN_SIZE) + for (auto iSend = 0; iSend < nSend; iSend++) { /*--- Get the local index for this communicated data. Here we again use the recv structure to find the send point, since the usual recv points are now the senders in reverse mode. ---*/ - iPoint = geometry->Local_Point_P2PRecv[msg_offset + iSend]; + const auto iPoint = geometry->Local_Point_P2PRecv[msg_offset + iSend]; /*--- Compute the offset in the recv buffer for this point. ---*/ - buf_offset = (msg_offset + iSend)*COUNT_PER_POINT; + const auto buf_offset = (msg_offset + iSend)*COUNT_PER_POINT; /*--- Load the buffer with the data to be sent. ---*/ - for (iVar = 0; iVar < nEqn; iVar++) + for (auto iVar = 0ul; iVar < x.GetNVar(); iVar++) bufDSend[buf_offset+iVar] = x(iPoint,iVar); - } - break; + } default: SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", @@ -374,33 +351,24 @@ void CSysMatrix::InitiateComms(const CSysVector & x, } -template -template -void CSysMatrix::CompleteComms(CSysVector & x, - CGeometry *geometry, - const CConfig *config, - unsigned short commType) const { +template +void CSysMatrixComms::Complete(CSysVector& x, CGeometry *geometry, + const CConfig *config, unsigned short commType) { + if (geometry->nP2PRecv == 0) return; /*--- Local variables ---*/ - unsigned short iVar; - unsigned long iPoint, iRecv, nRecv, msg_offset, buf_offset; - const auto COUNT_PER_POINT = (commType == SOLUTION_MATRIX)? nVar : nEqn; - - int ind, source, iMessage, jRecv; + const unsigned short COUNT_PER_POINT = x.GetNVar(); /*--- Global status so all threads can see the result of Waitany. ---*/ static SU2_MPI::Status status; - - /*--- Set some local pointers to make access simpler. ---*/ - - const su2double *bufDRecv = geometry->bufD_P2PRecv; + int ind; /*--- Store the data that was communicated into the appropriate location within the local class data structures. ---*/ - for (iMessage = 0; iMessage < geometry->nP2PRecv; iMessage++) { + for (auto iMessage = 0; iMessage < geometry->nP2PRecv; iMessage++) { /*--- For efficiency, recv the messages dynamically based on the order they arrive. ---*/ @@ -411,84 +379,85 @@ void CSysMatrix::CompleteComms(CSysVector & x, /*--- Once we have recv'd a message, get the source rank. ---*/ - source = status.MPI_SOURCE; + const auto source = status.MPI_SOURCE; switch (commType) { - case SOLUTION_MATRIX: + case SOLUTION_MATRIX: { + + const su2double *bufDRecv = geometry->bufD_P2PRecv; /*--- We know the offsets based on the source rank. ---*/ - jRecv = geometry->P2PRecv2Neighbor[source]; + const auto jRecv = geometry->P2PRecv2Neighbor[source]; /*--- Get the offset for the start of this message. ---*/ - msg_offset = geometry->nPoint_P2PRecv[jRecv]; + const auto msg_offset = geometry->nPoint_P2PRecv[jRecv]; /*--- Get the number of packets to be received in this message. ---*/ - nRecv = (geometry->nPoint_P2PRecv[jRecv+1] - - geometry->nPoint_P2PRecv[jRecv]); + const auto nRecv = (geometry->nPoint_P2PRecv[jRecv+1] - geometry->nPoint_P2PRecv[jRecv]); - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (iRecv = 0; iRecv < nRecv; iRecv++) { + SU2_OMP_FOR_STAT(CSysMatrix::OMP_MIN_SIZE) + for (auto iRecv = 0; iRecv < nRecv; iRecv++) { /*--- Get the local index for this communicated data. ---*/ - iPoint = geometry->Local_Point_P2PRecv[msg_offset + iRecv]; + const auto iPoint = geometry->Local_Point_P2PRecv[msg_offset + iRecv]; /*--- Compute the offset in the recv buffer for this point. ---*/ - buf_offset = (msg_offset + iRecv)*COUNT_PER_POINT; + const auto buf_offset = (msg_offset + iRecv)*COUNT_PER_POINT; /*--- Store the data correctly depending on the quantity. ---*/ - for (iVar = 0; iVar < nVar; iVar++) - x(iPoint,iVar) = ActiveAssign(bufDRecv[buf_offset+iVar]); + for (auto iVar = 0ul; iVar < x.GetNVar(); iVar++) + x(iPoint,iVar) = CSysMatrix::template ActiveAssign(bufDRecv[buf_offset+iVar]); } break; + } - case SOLUTION_MATRIXTRANS: + case SOLUTION_MATRIXTRANS: { /*--- We are going to communicate in reverse, so we use the send buffer for the recv instead. Also, all of the offsets and counts are derived from the send data structures. ---*/ - bufDRecv = geometry->bufD_P2PSend; + const su2double* bufDRecv = geometry->bufD_P2PSend; /*--- We know the offsets based on the source rank. ---*/ - jRecv = geometry->P2PSend2Neighbor[source]; + const auto jRecv = geometry->P2PSend2Neighbor[source]; /*--- Get the offset for the start of this message. ---*/ - msg_offset = geometry->nPoint_P2PSend[jRecv]; + const auto msg_offset = geometry->nPoint_P2PSend[jRecv]; /*--- Get the number of packets to be received in this message. ---*/ - nRecv = (geometry->nPoint_P2PSend[jRecv+1] - - geometry->nPoint_P2PSend[jRecv]); + const auto nRecv = (geometry->nPoint_P2PSend[jRecv+1] - geometry->nPoint_P2PSend[jRecv]); - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (iRecv = 0; iRecv < nRecv; iRecv++) { + SU2_OMP_FOR_STAT(CSysMatrix::OMP_MIN_SIZE) + for (auto iRecv = 0; iRecv < nRecv; iRecv++) { /*--- Get the local index for this communicated data. ---*/ - iPoint = geometry->Local_Point_P2PSend[msg_offset + iRecv]; + const auto iPoint = geometry->Local_Point_P2PSend[msg_offset + iRecv]; /*--- Compute the offset in the recv buffer for this point. ---*/ - buf_offset = (msg_offset + iRecv)*COUNT_PER_POINT; + const auto buf_offset = (msg_offset + iRecv)*COUNT_PER_POINT; /*--- Update receiving point. ---*/ - for (iVar = 0; iVar < nEqn; iVar++) - x(iPoint,iVar) += ActiveAssign(bufDRecv[buf_offset+iVar]); + for (auto iVar = 0ul; iVar < x.GetNVar(); iVar++) + x(iPoint,iVar) += CSysMatrix::template ActiveAssign(bufDRecv[buf_offset+iVar]); } break; + } default: - SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", - CURRENT_FUNCTION); + SU2_MPI::Error("Unrecognized quantity for point-to-point MPI comms.", CURRENT_FUNCTION); break; } } @@ -654,8 +623,8 @@ void CSysMatrix::MatrixVectorProduct(const CSysVector & /*--- MPI Parallelization. ---*/ - InitiateComms(prod, geometry, config, SOLUTION_MATRIX); - CompleteComms(prod, geometry, config, SOLUTION_MATRIX); + CSysMatrixComms::Initiate(prod, geometry, config, SOLUTION_MATRIX); + CSysMatrixComms::Complete(prod, geometry, config, SOLUTION_MATRIX); } @@ -694,8 +663,8 @@ void CSysMatrix::MatrixVectorProductTransposed(const CSysVector::ComputeJacobiPreconditioner(const CSysVector::ComputeILUPreconditioner(const CSysVector::ComputeLU_SGSPreconditioner(const CSysVector::ComputeLU_SGSPreconditioner(const CSysVector::BuildLineletPreconditioner(CGeometry *geom } Local_nLineLets = nLinelet; - SU2_MPI::Allreduce(&Local_nPoints, &Global_nPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_nLineLets, &Global_nLineLets, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&Local_nPoints, &Global_nPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_nLineLets, &Global_nLineLets, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- Memory allocation --*/ @@ -1227,8 +1196,8 @@ void CSysMatrix::ComputeLineletPreconditioner(const CSysVector::ComputePastixPreconditioner(const CSysVector::ComputePastixPreconditioner(const CSysVector(const CSysVector&, CGeometry*, const CConfig*, unsigned short);\ +template void CSysMatrixComms::Complete(CSysVector&, CGeometry*, const CConfig*, unsigned short); + +#define INSTANTIATE_MATRIX(TYPE)\ +template class CSysMatrix;\ +template void CSysMatrix::EnforceSolutionAtNode(unsigned long, const su2double*, CSysVector&);\ +template void CSysMatrix::EnforceSolutionAtDOF(unsigned long, unsigned long, su2double, CSysVector&);\ +INSTANTIATE_COMMS(TYPE) + #ifdef CODI_FORWARD_TYPE /*--- In forward AD only the active type is used. ---*/ -template class CSysMatrix; -template void CSysMatrix::InitiateComms(const CSysVector&, CGeometry*, const CConfig*, unsigned short) const; -template void CSysMatrix::CompleteComms(CSysVector&, CGeometry*, const CConfig*, unsigned short) const; -template void CSysMatrix::EnforceSolutionAtNode(unsigned long, const su2double*, CSysVector&); -template void CSysMatrix::EnforceSolutionAtDOF(unsigned long, unsigned long, su2double, CSysVector&); +INSTANTIATE_MATRIX(su2double) #else -/*--- Base and reverse AD, matrix is passive (either float or double). ---*/ -template class CSysMatrix; -template void CSysMatrix::InitiateComms(const CSysVector&, CGeometry*, const CConfig*, unsigned short) const; -template void CSysMatrix::CompleteComms(CSysVector&, CGeometry*, const CConfig*, unsigned short) const; -template void CSysMatrix::EnforceSolutionAtNode(unsigned long, const su2double*, CSysVector&); -template void CSysMatrix::EnforceSolutionAtDOF(unsigned long, unsigned long, su2double, CSysVector&); -#if defined(CODI_REVERSE_TYPE) || defined(USE_MIXED_PRECISION) -/*--- In reverse AD (or mixed precision) the passive matrix is also used to communicate active (or double) vectors resp.. ---*/ -template void CSysMatrix::InitiateComms(const CSysVector&, CGeometry*, const CConfig*, unsigned short) const; -template void CSysMatrix::CompleteComms(CSysVector&, CGeometry*, const CConfig*, unsigned short) const; +/*--- Base and reverse AD, matrix is passive. ---*/ +INSTANTIATE_MATRIX(su2mixedfloat) +/*--- If using mixed precision (float) instantiate also a version for doubles, and allow cross communications. ---*/ +#ifdef USE_MIXED_PRECISION +INSTANTIATE_MATRIX(passivedouble) +#endif +#ifdef CODI_REVERSE_TYPE +INSTANTIATE_COMMS(su2double) #endif #endif // CODI_FORWARD_TYPE diff --git a/Common/src/linear_algebra/CSysSolve.cpp b/Common/src/linear_algebra/CSysSolve.cpp index db9e415098dd..43b1fffe92d5 100644 --- a/Common/src/linear_algebra/CSysSolve.cpp +++ b/Common/src/linear_algebra/CSysSolve.cpp @@ -2,7 +2,7 @@ * \file CSysSolve.cpp * \brief Main classes required for solving linear systems of equations * \author J. Hicken, F. Palacios, T. Economon, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -54,7 +54,6 @@ CSysSolve::CSysSolve(const bool mesh_deform_mode) : mesh_deform(mesh_deform_mode), cg_ready(false), bcg_ready(false), - gmres_ready(false), smooth_ready(false), LinSysSol_ptr(nullptr), LinSysRes_ptr(nullptr) { @@ -236,8 +235,12 @@ unsigned long CSysSolve::CG_LinSolver(const CSysVector & /*--- Calculate the initial residual, compute norm, and check if system is already solved ---*/ - mat_vec(x, A_x); - r = b - A_x; + if (!xIsZero) { + mat_vec(x, A_x); + r = b - A_x; + } else { + r = b; + } /*--- Only compute the residuals in full communication mode. ---*/ @@ -293,7 +296,7 @@ unsigned long CSysSolve::CG_LinSolver(const CSysVector & norm_r = r.norm(); if (norm_r < tol*norm0) break; - if (((monitoring) && (master)) && ((i+1) % 10 == 0)) + if (((monitoring) && (master)) && ((i+1) % monitorFreq == 0)) WriteHistory(i+1, norm_r/norm0); } @@ -318,16 +321,17 @@ unsigned long CSysSolve::CG_LinSolver(const CSysVector & if (master) WriteFinalResidual("CG", i, norm_r/norm0); - mat_vec(x, A_x); - r = b - A_x; - ScalarType true_res = r.norm(); + if (recomputeRes) { + mat_vec(x, A_x); + r = b - A_x; + ScalarType true_res = r.norm(); - if (fabs(true_res - norm_r) > tol*10.0) { - if (master) { - WriteWarning(norm_r, true_res, tol); + if (fabs(true_res - norm_r) > tol*10.0) { + if (master) { + WriteWarning(norm_r, true_res, tol); + } } } - } residual = norm_r/norm0; @@ -354,18 +358,15 @@ unsigned long CSysSolve::FGMRES_LinSolver(const CSysVector::FGMRES_LinSolver(const CSysVector::FGMRES_LinSolver(const CSysVector::FGMRES_LinSolver(const CSysVector tol*10) { - if (master) { - WriteWarning(beta, res, tol); + if (fabs(res - beta) > tol*10) { + if (master) { + WriteWarning(beta, res, tol); + } } } - } residual = beta/norm0; @@ -531,8 +538,12 @@ unsigned long CSysSolve::BCGSTAB_LinSolver(const CSysVector::BCGSTAB_LinSolver(const CSysVector::BCGSTAB_LinSolver(const CSysVector tol*10.0) && (master)) { - WriteWarning(norm_r, true_res, tol); + if ((fabs(true_res - norm_r) > tol*10.0) && (master)) { + WriteWarning(norm_r, true_res, tol); + } } - } residual = norm_r/norm0; @@ -688,8 +700,12 @@ unsigned long CSysSolve::Smoother_LinSolver(const CSysVector::Smoother_LinSolver(const CSysVectorGetComm_Level() == COMM_FULL) { norm_r = r.norm(); if (norm_r < tol*norm0) break; - if (((monitoring) && (master)) && ((i+1) % 5 == 0)) + if (((monitoring) && (master)) && ((i+1) % monitorFreq == 0)) WriteHistory(i+1, norm_r/norm0); } } @@ -1050,4 +1066,7 @@ unsigned long CSysSolve::Solve_b(CSysMatrix & Jacobian, template class CSysSolve; #else template class CSysSolve; +#ifdef USE_MIXED_PRECISION +template class CSysSolve; +#endif #endif diff --git a/Common/src/linear_algebra/CSysSolve_b.cpp b/Common/src/linear_algebra/CSysSolve_b.cpp index 4d30bec3faae..977c1ab0d0a1 100644 --- a/Common/src/linear_algebra/CSysSolve_b.cpp +++ b/Common/src/linear_algebra/CSysSolve_b.cpp @@ -2,7 +2,7 @@ * \file CSysSolve_b.cpp * \brief Routines for the linear solver used in the reverse sweep of AD. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -70,5 +70,7 @@ void CSysSolve_b::Solve_b(const codi::RealReverse::Real* x, codi::Re } template class CSysSolve_b; - +#ifdef USE_MIXED_PRECISION +template class CSysSolve_b; +#endif #endif diff --git a/Common/src/linear_algebra/CSysVector.cpp b/Common/src/linear_algebra/CSysVector.cpp index 7bcd0fe7d913..42aec4517e6f 100644 --- a/Common/src/linear_algebra/CSysVector.cpp +++ b/Common/src/linear_algebra/CSysVector.cpp @@ -2,7 +2,7 @@ * \file CSysVector.cpp * \brief Implementation and explicit instantiations of CSysVector. * \author P. Gomes, F. Palacios, J. Hicken, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -69,7 +69,10 @@ CSysVector::~CSysVector() { /*--- Explicit instantiations ---*/ /*--- We allways need su2double (regardless if it is passive or active). ---*/ template class CSysVector; -#if defined(CODI_REVERSE_TYPE) || defined(USE_MIXED_PRECISION) +#ifdef USE_MIXED_PRECISION /*--- In reverse AD (or with mixed precision) we will also have passive (or float) vectors. ---*/ template class CSysVector; #endif +#ifdef CODI_REVERSE_TYPE +template class CSysVector; +#endif diff --git a/Common/src/toolboxes/C1DInterpolation.cpp b/Common/src/toolboxes/C1DInterpolation.cpp index d91759517147..00c0ae5f2883 100644 --- a/Common/src/toolboxes/C1DInterpolation.cpp +++ b/Common/src/toolboxes/C1DInterpolation.cpp @@ -2,7 +2,7 @@ * \file C1DInterpolation.cpp * \brief Inlet_interpolation_functions * \author Aman Baig - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/CLinearPartitioner.cpp b/Common/src/toolboxes/CLinearPartitioner.cpp index 4fde525bd848..5c48abc15ee7 100644 --- a/Common/src/toolboxes/CLinearPartitioner.cpp +++ b/Common/src/toolboxes/CLinearPartitioner.cpp @@ -3,7 +3,7 @@ * \brief Helper class that provides the counts for each rank in a linear * partitioning given the global count as input. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/CSquareMatrixCM.cpp b/Common/src/toolboxes/CSquareMatrixCM.cpp index a5da8779b195..a4a538bfdcd4 100644 --- a/Common/src/toolboxes/CSquareMatrixCM.cpp +++ b/Common/src/toolboxes/CSquareMatrixCM.cpp @@ -2,7 +2,7 @@ * \file CSquareMatrixCM.cpp * \brief Implementation of dense matrix helper class in Column Major order (see hpp). * \author Edwin van der Weide, Pedro Gomes. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/CSymmetricMatrix.cpp b/Common/src/toolboxes/CSymmetricMatrix.cpp index 9aa9a682cf3b..fa4b7abee6a1 100644 --- a/Common/src/toolboxes/CSymmetricMatrix.cpp +++ b/Common/src/toolboxes/CSymmetricMatrix.cpp @@ -2,7 +2,7 @@ * \file CSymmetricMatrix.cpp * \brief Implementation of dense symmetric matrix helper class (see hpp). * \author Joel Ho, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CIncTGVSolution.cpp b/Common/src/toolboxes/MMS/CIncTGVSolution.cpp index 6dcfb0c3a57e..5f7c9a786d22 100644 --- a/Common/src/toolboxes/MMS/CIncTGVSolution.cpp +++ b/Common/src/toolboxes/MMS/CIncTGVSolution.cpp @@ -2,7 +2,7 @@ * \file CIncTGVSolution.cpp * \brief Implementations of the member functions of CIncTGVSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CInviscidVortexSolution.cpp b/Common/src/toolboxes/MMS/CInviscidVortexSolution.cpp index 73fb08f638f8..c437bf4a542d 100644 --- a/Common/src/toolboxes/MMS/CInviscidVortexSolution.cpp +++ b/Common/src/toolboxes/MMS/CInviscidVortexSolution.cpp @@ -2,7 +2,7 @@ * \file CInviscidVortexSolution.cpp * \brief Implementations of the member functions of CInviscidVortexSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CMMSIncEulerSolution.cpp b/Common/src/toolboxes/MMS/CMMSIncEulerSolution.cpp index c3b04d5adafd..847ef0bbcd27 100644 --- a/Common/src/toolboxes/MMS/CMMSIncEulerSolution.cpp +++ b/Common/src/toolboxes/MMS/CMMSIncEulerSolution.cpp @@ -2,7 +2,7 @@ * \file CMMSIncEulerSolution.cpp * \brief Implementations of the member functions of CMMSIncEulerSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CMMSIncNSSolution.cpp b/Common/src/toolboxes/MMS/CMMSIncNSSolution.cpp index 6b49e2275387..7f411dbe6a09 100644 --- a/Common/src/toolboxes/MMS/CMMSIncNSSolution.cpp +++ b/Common/src/toolboxes/MMS/CMMSIncNSSolution.cpp @@ -2,7 +2,7 @@ * \file CMMSIncNSSolution.cpp * \brief Implementations of the member functions of CMMSIncNSSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.cpp b/Common/src/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.cpp index c5a6fcb6771d..cc8f546d1d2d 100644 --- a/Common/src/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.cpp +++ b/Common/src/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.cpp @@ -2,7 +2,7 @@ * \file CMMSNSTwoHalfCirclesSolution.cpp * \brief Implementations of the member functions of CMMSNSTwoHalfCirclesSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.cpp b/Common/src/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.cpp index 2350d0014afb..ac2e2cf71641 100644 --- a/Common/src/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.cpp +++ b/Common/src/toolboxes/MMS/CMMSNSTwoHalfSpheresSolution.cpp @@ -2,7 +2,7 @@ * \file CMMSNSTwoHalfSpheresSolution.cpp * \brief Implementations of the member functions of CMMSNSTwoHalfSpheresSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolution.cpp b/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolution.cpp index 5004b8584fbd..a49a7782d55b 100644 --- a/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolution.cpp +++ b/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolution.cpp @@ -2,7 +2,7 @@ * \file CMMSNSUnitQuadSolution.cpp * \brief Implementations of the member functions of CMMSNSUnitQuadSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.cpp b/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.cpp index e6bf87a6679e..66ebdbb8322f 100644 --- a/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.cpp +++ b/Common/src/toolboxes/MMS/CMMSNSUnitQuadSolutionWallBC.cpp @@ -2,7 +2,7 @@ * \file CMMSNSUnitQuadSolutionWallBC.cpp * \brief Implementations of the member functions of CMMSNSUnitQuadSolutionWallBC. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CNSUnitQuadSolution.cpp b/Common/src/toolboxes/MMS/CNSUnitQuadSolution.cpp index 250282bf9cc9..9ea6741b9e48 100644 --- a/Common/src/toolboxes/MMS/CNSUnitQuadSolution.cpp +++ b/Common/src/toolboxes/MMS/CNSUnitQuadSolution.cpp @@ -2,7 +2,7 @@ * \file CNSUnitQuadSolution.cpp * \brief Implementations of the member functions of CNSUnitQuadSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CRinglebSolution.cpp b/Common/src/toolboxes/MMS/CRinglebSolution.cpp index 0b0e4d4d45b9..c7710624bea2 100644 --- a/Common/src/toolboxes/MMS/CRinglebSolution.cpp +++ b/Common/src/toolboxes/MMS/CRinglebSolution.cpp @@ -2,7 +2,7 @@ * \file CRinglebSolution.cpp * \brief Implementations of the member functions of CRinglebSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CTGVSolution.cpp b/Common/src/toolboxes/MMS/CTGVSolution.cpp index 86cd097873ca..b9e399d4e121 100644 --- a/Common/src/toolboxes/MMS/CTGVSolution.cpp +++ b/Common/src/toolboxes/MMS/CTGVSolution.cpp @@ -2,7 +2,7 @@ * \file CTGVSolution.cpp * \brief Implementations of the member functions of CTGVSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CUserDefinedSolution.cpp b/Common/src/toolboxes/MMS/CUserDefinedSolution.cpp index 85a81a43b579..4ab8cbfcb6b5 100644 --- a/Common/src/toolboxes/MMS/CUserDefinedSolution.cpp +++ b/Common/src/toolboxes/MMS/CUserDefinedSolution.cpp @@ -2,7 +2,7 @@ * \file CUserDefinedSolution.cpp * \brief Implementations of the member functions of CUserDefinedSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CVerificationSolution.cpp b/Common/src/toolboxes/MMS/CVerificationSolution.cpp index 5fb39ef9ae3f..6d56a733766c 100644 --- a/Common/src/toolboxes/MMS/CVerificationSolution.cpp +++ b/Common/src/toolboxes/MMS/CVerificationSolution.cpp @@ -2,7 +2,7 @@ * \file CVerificationSolution.cpp * \brief Implementations of the member functions of CVerificationSolution. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncEulerSolution.py b/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncEulerSolution.py index 95b1afd698a1..cbf999f412e6 100755 --- a/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncEulerSolution.py +++ b/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncEulerSolution.py @@ -4,7 +4,7 @@ # \brief Python script that generates the source terms for a # manufactured solution for the incompressible Euler eqns. # \author T. Economon -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society diff --git a/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncNSSolution.py b/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncNSSolution.py index ac585bddf054..614c458c1037 100755 --- a/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncNSSolution.py +++ b/Common/src/toolboxes/MMS/CreateMMSSourceTerms/CMMSIncNSSolution.py @@ -4,7 +4,7 @@ # \brief Python script that generates the source terms for a # manufactured solution for the incompressible Navier-Stokes eqns. # \author T. Economon -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society diff --git a/Common/src/toolboxes/printing_toolbox.cpp b/Common/src/toolboxes/printing_toolbox.cpp index ae1db824d51b..306395f06907 100644 --- a/Common/src/toolboxes/printing_toolbox.cpp +++ b/Common/src/toolboxes/printing_toolbox.cpp @@ -2,7 +2,7 @@ * \file printing_toolbox.cpp * \brief Printing tools * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Common/src/wall_model.cpp b/Common/src/wall_model.cpp index efb291835bd9..c90aaa9ccc45 100644 --- a/Common/src/wall_model.cpp +++ b/Common/src/wall_model.cpp @@ -3,7 +3,7 @@ * \brief File, which contains the implementation for the wall model functions * for large eddy simulations. * \author E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/Makefile.am b/Makefile.am index 33ff29ba5c79..dbdc2b34bee8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Global makefile for the SU2 project # \author M. Colonno, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society diff --git a/QuickStart/inv_NACA0012.cfg b/QuickStart/inv_NACA0012.cfg index 2f9d6db35ed7..10bcc036c34c 100644 --- a/QuickStart/inv_NACA0012.cfg +++ b/QuickStart/inv_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/README.md b/README.md index 05f5d0bddb0c..e6280ae7b200 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

-# SU2 (ver. 7.1.0 "Blackbird"): The Open-Source CFD Code +# SU2 (ver. 7.1.1 "Blackbird"): The Open-Source CFD Code Computational analysis tools have revolutionized the way we design engineering systems, but most established codes are proprietary, unavailable, or prohibitively expensive for many users. The SU2 team is changing this, making multiphysics analysis and design optimization freely available as open-source software and involving everyone in its creation and development. diff --git a/SU2_CFD/include/CMarkerProfileReaderFVM.hpp b/SU2_CFD/include/CMarkerProfileReaderFVM.hpp index c80e7c2d30aa..7fe5a46dd472 100644 --- a/SU2_CFD/include/CMarkerProfileReaderFVM.hpp +++ b/SU2_CFD/include/CMarkerProfileReaderFVM.hpp @@ -3,7 +3,7 @@ * \brief Header file for the class CMarkerProfileReaderFVM. * The implementations are in the CMarkerProfileReaderFVM.cpp file. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * The current SU2 release has been coordinated by the * SU2 International Developers Society diff --git a/SU2_CFD/include/SU2_CFD.hpp b/SU2_CFD/include/SU2_CFD.hpp index 8261344a4b5c..0df25eb4af5a 100644 --- a/SU2_CFD/include/SU2_CFD.hpp +++ b/SU2_CFD/include/SU2_CFD.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines of the code SU2_CFD. * The subroutines and functions are in the SU2_CFD.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/definition_structure.hpp b/SU2_CFD/include/definition_structure.hpp index c64c601919d7..325b35182ba0 100644 --- a/SU2_CFD/include/definition_structure.hpp +++ b/SU2_CFD/include/definition_structure.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines used by SU2_CFD. * The subroutines and functions are in the definition_structure.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/drivers/CDiscAdjMultizoneDriver.hpp b/SU2_CFD/include/drivers/CDiscAdjMultizoneDriver.hpp index 4d8e461e404c..6a0d0034f1cf 100644 --- a/SU2_CFD/include/drivers/CDiscAdjMultizoneDriver.hpp +++ b/SU2_CFD/include/drivers/CDiscAdjMultizoneDriver.hpp @@ -1,8 +1,8 @@ /*! * \class CDiscAdjMultizoneDriver.hpp * \brief Class for driving adjoint multi-zone problems. - * \author O. Burghardt, T. Albring, R. Sanchez - * \version 7.1.0 "Blackbird" + * \author O. Burghardt, P. Gomes, T. Albring, R. Sanchez + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -27,10 +27,41 @@ #pragma once #include "CMultizoneDriver.hpp" +#include "../../../Common/include/toolboxes/CQuasiNewtonInvLeastSquares.hpp" +#include "../../../Common/include/linear_algebra/CPreconditioner.hpp" +#include "../../../Common/include/linear_algebra/CMatrixVectorProduct.hpp" +#include "../../../Common/include/linear_algebra/CSysSolve.hpp" class CDiscAdjMultizoneDriver : public CMultizoneDriver { protected: +#ifdef CODI_FORWARD_TYPE + using Scalar = su2double; +#else + using Scalar = passivedouble; +#endif + + class AdjointProduct : public CMatrixVectorProduct { + public: + CDiscAdjMultizoneDriver* const driver; + const unsigned short iZone = 0; + mutable unsigned long iInnerIter = 0; + + AdjointProduct(CDiscAdjMultizoneDriver* d, unsigned short i) : driver(d), iZone(i) {} + + inline void operator()(const CSysVector & u, CSysVector & v) const override { + driver->SetAllSolutions(iZone, true, u); + driver->Iterate(iZone, iInnerIter, true); + driver->GetAllSolutions(iZone, true, v); + v -= u; + ++iInnerIter; + } + }; + + class Identity : public CPreconditioner { + public: + inline void operator()(const CSysVector & u, CSysVector & v) const override { v = u; } + }; /*! * \brief Kinds of recordings (three different ones). @@ -58,6 +89,7 @@ class CDiscAdjMultizoneDriver : public CMultizoneDriver { int RecordingState = NONE; /*!< \brief The kind of recording that the tape currently holds. */ + bool eval_transfer = false; /*!< \brief Evaluate the transfer section of the tape. */ su2double ObjFunc; /*!< \brief Value of the objective function. */ int ObjFunc_Index; /*!< \brief Index of the value of the objective function. */ @@ -74,6 +106,15 @@ class CDiscAdjMultizoneDriver : public CMultizoneDriver { for jZone, we need to store all terms to have BGS-type updates with relaxation. */ vector > > Cross_Terms; + /*!< \brief Fixed-Point corrector that can be applied to inner iterations. */ + vector > FixPtCorrector; + + /*!< \brief Members to use GMRES to drive inner iterations (alternative to quasi-Newton). */ + static constexpr unsigned long KrylovMinIters = 3; + const Scalar KrylovTol = 0.01; + vector > LinSolver; + vector > AdjRHS, AdjSol; + public: /*! @@ -82,9 +123,7 @@ class CDiscAdjMultizoneDriver : public CMultizoneDriver { * \param[in] val_nZone - Total number of zones. * \param[in] MPICommunicator - MPI communicator for SU2. */ - CDiscAdjMultizoneDriver(char* confFile, - unsigned short val_nZone, - SU2_Comm MPICommunicator); + CDiscAdjMultizoneDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator); /*! * \brief Destructor of the class. @@ -103,6 +142,12 @@ class CDiscAdjMultizoneDriver : public CMultizoneDriver { */ void Run() override; + /*! + * \brief Run one inner iteration for a given zone. + * \return The result of "monitor". + */ + bool Iterate(unsigned short iZone, unsigned long iInnerIter, bool KrylovMode = false); + /*! * \brief Evaluate sensitivites for the current adjoint solution and output files. * \param[in] iOuterIter - Current outer iteration. @@ -200,6 +245,25 @@ class CDiscAdjMultizoneDriver : public CMultizoneDriver { * \brief gets Convergence on physical time scale, (deactivated in adjoint case) * \return false */ - inline bool GetTimeConvergence() const override {return false;}; + inline bool GetTimeConvergence() const override {return false;} + + /*! + * \brief Get the external of all adjoint solvers in a zone. + * \param[in] iZone - Index of the zone. + * \param[out] rhs - Object with interface (iPoint,iVar), set to -external. + */ + template + void GetAdjointRHS(unsigned short iZone, Container& rhs) const { + const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint(); + for (auto iSol = 0u, offset = 0u; iSol < MAX_SOLS; ++iSol) { + auto solver = solver_container[iZone][INST_0][MESH_0][iSol]; + if (!(solver && solver->GetAdjoint())) continue; + const auto& ext = solver->GetNodes()->Get_External(); + for (auto iPoint = 0ul; iPoint < nPoint; ++iPoint) + for (auto iVar = 0ul; iVar < solver->GetnVar(); ++iVar) + rhs(iPoint,offset+iVar) = -SU2_TYPE::GetValue(ext(iPoint,iVar)); + offset += solver->GetnVar(); + } + } }; diff --git a/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp b/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp index b8ac1335c8b9..93954bde7be6 100644 --- a/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp +++ b/SU2_CFD/include/drivers/CDiscAdjSinglezoneDriver.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for driving single or multi-zone problems. * The subroutines and functions are in the driver_structure.cpp file. * \author T. Economon, H. Kline, R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -33,7 +33,7 @@ * \class CDiscAdjSinglezoneDriver * \brief Class for driving single-zone adjoint solvers. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CDiscAdjSinglezoneDriver : public CSinglezoneDriver { protected: diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index 82bedff1ddc9..30c37ec9e273 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for driving single or multi-zone problems. * The subroutines and functions are in the driver_structure.cpp file. * \author T. Economon, H. Kline, R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -97,10 +97,6 @@ class CDriver { vector > > interpolator_container; /*!< \brief Definition of the interpolation method between non-matching discretizations of the interface. */ CInterface ***interface_container; /*!< \brief Definition of the interface of information and physics. */ - su2double PyWrapVarCoord[3], /*!< \brief This is used to store the VarCoord of each vertex. */ - PyWrapNodalForce[3], /*!< \brief This is used to store the force at each vertex. */ - PyWrapNodalForceDensity[3], /*!< \brief This is used to store the force density at each vertex. */ - PyWrapNodalHeatFlux[3]; /*!< \brief This is used to store the heat flux at each vertex. */ bool dry_run; /*!< \brief Flag if SU2_CFD was started as dry-run via "SU2_CFD -d .cfg" */ public: @@ -360,11 +356,6 @@ class CDriver { */ virtual void DynamicMeshUpdate(unsigned short val_iZone, unsigned long TimeIter) { } - /*! - * \brief Perform a static mesh deformation, without considering grid velocity. - */ - virtual void StaticMeshUpdate() { } - /*! * \brief Perform a mesh deformation as initial condition. */ @@ -373,69 +364,63 @@ class CDriver { /*! * \brief Process the boundary conditions and update the multigrid structure. */ - virtual void BoundaryConditionsUpdate() { } + void BoundaryConditionsUpdate(); /*! * \brief Get the total drag. * \return Total drag. */ - passivedouble Get_Drag(); + passivedouble Get_Drag() const; /*! * \brief Get the total lift. * \return Total lift. */ - passivedouble Get_Lift(); + passivedouble Get_Lift() const; /*! * \brief Get the total x moment. * \return Total x moment. */ - passivedouble Get_Mx(); + passivedouble Get_Mx() const; /*! * \brief Get the total y moment. * \return Total y moment. */ - passivedouble Get_My(); + passivedouble Get_My() const; /*! * \brief Get the total z moment. * \return Total z moment. */ - passivedouble Get_Mz(); + passivedouble Get_Mz() const; /*! * \brief Get the total drag coefficient. * \return Total drag coefficient. */ - passivedouble Get_DragCoeff(); + passivedouble Get_DragCoeff() const; /*! * \brief Get the total lift coefficient. * \return Total lift coefficient. */ - passivedouble Get_LiftCoeff(); - - /*! - * \brief Get the moving marker identifier. - * \return Moving marker identifier. - */ - unsigned short GetMovingMarker(); + passivedouble Get_LiftCoeff() const; /*! * \brief Get the number of vertices (halo nodes included) from a specified marker. * \param[in] iMarker - Marker identifier. * \return Number of vertices. */ - unsigned long GetNumberVertices(unsigned short iMarker); + unsigned long GetNumberVertices(unsigned short iMarker) const; /*! * \brief Get the number of halo vertices from a specified marker. * \param[in] iMarker - Marker identifier. * \return Number of vertices. */ - unsigned long GetNumberHaloVertices(unsigned short iMarker); + unsigned long GetNumberHaloVertices(unsigned short iMarker) const; /*! * \brief Check if a vertex is physical or not (halo node) on a specified marker. @@ -443,13 +428,13 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return True if the specified vertex is a halo node. */ - bool IsAHaloNode(unsigned short iMarker, unsigned long iVertex); + bool IsAHaloNode(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Get the number of external iterations. * \return Number of external iterations. */ - unsigned long GetnTimeIter(); + unsigned long GetnTimeIter() const; /*! * \brief Get the current external iteration. @@ -461,7 +446,7 @@ class CDriver { * \brief Get the unsteady time step. * \return Unsteady time step. */ - passivedouble GetUnsteady_TimeStep(); + passivedouble GetUnsteady_TimeStep() const; /*! * \brief Get the global index of a vertex on a specified marker. @@ -469,119 +454,15 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Vertex global index. */ - unsigned long GetVertexGlobalIndex(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the x coordinate of a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return x coordinate of the vertex. - */ - passivedouble GetVertexCoordX(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the y coordinate of a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return y coordinate of the vertex. - */ - passivedouble GetVertexCoordY(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the z coordinate of a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return z coordinate of the vertex. - */ - passivedouble GetVertexCoordZ(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Compute the total force (pressure and shear stress) at a vertex on a specified marker (3 components). - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return True if the vertex is a halo node (non physical force). - */ - bool ComputeVertexForces(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the x component of the force at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return x component of the force at the vertex. - */ - passivedouble GetVertexForceX(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the y component of the force at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return y component of the force at the vertex. - */ - passivedouble GetVertexForceY(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the z component of the force at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return z component of the force at the vertex. - */ - passivedouble GetVertexForceZ(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the x component of the force density at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return x component of the force density at the vertex. - */ - passivedouble GetVertexForceDensityX(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the y component of the force density at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return y component of the force density at the vertex. - */ - passivedouble GetVertexForceDensityY(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the z component of the force density at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return z component of the force density at the vertex. - */ - passivedouble GetVertexForceDensityZ(unsigned short iMarker, unsigned long iVertex); + unsigned long GetVertexGlobalIndex(unsigned short iMarker, unsigned long iVertex) const; /*! - * \brief Set the x coordinate of a vertex on a specified marker. + * \brief Get undeformed coordinates from the mesh solver. * \param[in] iMarker - Marker identifier. * \param[in] iVertex - Vertex identifier. - * \param[in] newPosX - New x coordinate of the vertex. + * \return x,y,z coordinates of the vertex. */ - void SetVertexCoordX(unsigned short iMarker, unsigned long iVertex, passivedouble newPosX); - - /*! - * \brief Set the y coordinate of a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \param[in] newPosY - New y coordinate of the vertex. - */ - void SetVertexCoordY(unsigned short iMarker, unsigned long iVertex, passivedouble newPosY); - - /*! - * \brief Set the z coordinate of a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \param[in] newPosZ - New z coordinate of the vertex. - */ - void SetVertexCoordZ(unsigned short iMarker, unsigned long iVertex, passivedouble newPosZ); - - /*! - * \brief Set the VarCoord of a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return Norm of the VarCoord. - */ - passivedouble SetVertexVarCoord(unsigned short iMarker, unsigned long iVertex); + vector GetInitialMeshCoord(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Get the temperature at a vertex on a specified marker. @@ -589,7 +470,7 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Temperature of the vertex. */ - passivedouble GetVertexTemperature(unsigned short iMarker, unsigned long iVertex); + passivedouble GetVertexTemperature(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Set the temperature of a vertex on a specified marker. @@ -600,36 +481,12 @@ class CDriver { void SetVertexTemperature(unsigned short iMarker, unsigned long iVertex, passivedouble val_WallTemp); /*! - * \brief Compute the heat flux at a vertex on a specified marker (3 components). + * \brief Get the heat flux at a vertex on a specified marker (3 components). * \param[in] iMarker - Marker identifier. * \param[in] iVertex - Vertex identifier. * \return True if the vertex is a halo node. */ - bool ComputeVertexHeatFluxes(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the x component of the heat flux at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return x component of the heat flux at the vertex. - */ - passivedouble GetVertexHeatFluxX(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the y component of the heat flux at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return y component of the heat flux at the vertex. - */ - passivedouble GetVertexHeatFluxY(unsigned short iMarker, unsigned long iVertex); - - /*! - * \brief Get the z component of the heat flux at a vertex on a specified marker. - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return z component of the heat flux at the vertex. - */ - passivedouble GetVertexHeatFluxZ(unsigned short iMarker, unsigned long iVertex); + vector GetVertexHeatFluxes(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Get the wall normal component of the heat flux at a vertex on a specified marker. @@ -637,7 +494,7 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Wall normal component of the heat flux at the vertex. */ - passivedouble GetVertexNormalHeatFlux(unsigned short iMarker, unsigned long iVertex); + passivedouble GetVertexNormalHeatFlux(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Set the wall normal component of the heat flux at a vertex on a specified marker. @@ -653,7 +510,7 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Thermal conductivity at the vertex. */ - passivedouble GetThermalConductivity(unsigned short iMarker, unsigned long iVertex); + passivedouble GetThermalConductivity(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Preprocess the inlets via file input for all solvers. @@ -661,8 +518,7 @@ class CDriver { * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. */ - void Inlet_Preprocessing(CSolver ***solver, CGeometry **geometry, - CConfig *config) const; + void Inlet_Preprocessing(CSolver ***solver, CGeometry **geometry, CConfig *config) const; /*! * \brief Get the unit normal (vector) at a vertex on a specified marker. @@ -670,55 +526,43 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Unit normal (vector) at the vertex. */ - vector GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex); + vector GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Get all the boundary markers tags. * \return List of boundary markers tags. */ - vector GetAllBoundaryMarkersTag(); - - /*! - * \brief Get all the moving boundary markers tags. - * \return List of moving boundary markers tags. - */ - vector GetAllMovingMarkersTag(); + vector GetAllBoundaryMarkersTag() const; /*! * \brief Get all the deformable boundary marker tags. * \return List of deformable boundary markers tags. */ - vector GetAllDeformMeshMarkersTag(); - - /*! - * \brief Get all the fluid load boundary marker tags. - * \return List of fluid load boundary markers tags. - */ - vector GetAllFluidLoadMarkersTag(); + vector GetAllDeformMeshMarkersTag() const; /*! * \brief Get all the heat transfer boundary markers tags. * \return List of heat transfer boundary markers tags. */ - vector GetAllCHTMarkersTag(); + vector GetAllCHTMarkersTag() const; /*! * \brief Get all the (subsonic) inlet boundary markers tags. * \return List of inlet boundary markers tags. */ - vector GetAllInletMarkersTag(); + vector GetAllInletMarkersTag() const; /*! * \brief Get all the boundary markers tags with their associated indices. * \return List of boundary markers tags with their indices. */ - map GetAllBoundaryMarkers(); + map GetAllBoundaryMarkers() const; /*! * \brief Get all the boundary markers tags with their associated types. * \return List of boundary markers tags with their types. */ - map GetAllBoundaryMarkersType(); + map GetAllBoundaryMarkersType() const; /*! * \brief Set the mesh displacement for the elasticity mesh solver. @@ -741,7 +585,7 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Vector of sensitivities. */ - vector GetMeshDisp_Sensitivity(unsigned short iMarker, unsigned long iVertex); + vector GetMeshDisp_Sensitivity(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Set the load in X direction for the structural solver. @@ -760,7 +604,7 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Vector of displacements. */ - vector GetFEA_Displacements(unsigned short iMarker, unsigned long iVertex); + vector GetFEA_Displacements(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Return the velocities from the FEA Solver. @@ -768,7 +612,7 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Vector of velocities. */ - vector GetFEA_Velocity(unsigned short iMarker, unsigned long iVertex); + vector GetFEA_Velocity(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Return the velocities from the FEA Solver. @@ -776,7 +620,7 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Vector of velocities at time n. */ - vector GetFEA_Velocity_n(unsigned short iMarker, unsigned long iVertex); + vector GetFEA_Velocity_n(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Get the sensitivity of the flow loads for the structural solver. @@ -786,7 +630,7 @@ class CDriver { * \param[in] LoadX - Value of the load in the direction Y. * \param[in] LoadX - Value of the load in the direction Z. */ - vector GetFlowLoad_Sensitivity(unsigned short iMarker, unsigned long iVertex); + vector GetFlowLoad_Sensitivity(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Get the flow load (from the extra step - the repeated methods should be unified once the postprocessing @@ -794,7 +638,7 @@ class CDriver { * \param[in] iMarker - Marker identifier. * \param[in] iVertex - Vertex identifier. */ - vector GetFlowLoad(unsigned short iMarker, unsigned long iVertex); + vector GetFlowLoad(unsigned short iMarker, unsigned long iVertex) const; /*! * \brief Set the adjoint of the flow tractions (from the extra step - @@ -819,14 +663,6 @@ class CDriver { void SetSourceTerm_DispAdjoint(unsigned short iMarker, unsigned long iVertex, passivedouble val_AdjointX, passivedouble val_AdjointY, passivedouble val_AdjointZ); - /*! - * \brief Get the undeformed mesh coordinates - * \param[in] iMarker - Marker identifier. - * \param[in] iVertex - Vertex identifier. - * \return Undeformed Vertex Coordinates - */ - vector GetVertex_UndeformedCoord(unsigned short iMarker, unsigned long iVertex); - /*! * \brief Set the position of the heat source. * \param[in] alpha - Angle of rotation respect to Z axis. @@ -962,60 +798,11 @@ class CFluidDriver : public CDriver { */ void DynamicMeshUpdate(unsigned long TimeIter) override; - /*! - * \brief Perform a static mesh deformation, without considering grid velocity (multiple zone). - */ - void StaticMeshUpdate() override; - - /*! - * \brief Perform a mesh deformation as initial condition (multiple zone). - */ - void SetInitialMesh() override; - - /*! - * \brief Process the boundary conditions and update the multigrid structure. - */ - void BoundaryConditionsUpdate() override; - /*! * \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 long iVertex, passivedouble 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 long iVertex, passivedouble 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 long iVertex, unsigned short iDim, passivedouble 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 long iVertex, unsigned short iDim, passivedouble val_tub_var); - }; diff --git a/SU2_CFD/include/drivers/CDummyDriver.hpp b/SU2_CFD/include/drivers/CDummyDriver.hpp index d29036224879..4a0f168cadf4 100644 --- a/SU2_CFD/include/drivers/CDummyDriver.hpp +++ b/SU2_CFD/include/drivers/CDummyDriver.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for driving single or multi-zone problems. * The subroutines and functions are in the driver_structure.cpp file. * \author T. Economon, H. Kline, R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/drivers/CMultizoneDriver.hpp b/SU2_CFD/include/drivers/CMultizoneDriver.hpp index 079d91ea7f15..a938c1a50ec6 100644 --- a/SU2_CFD/include/drivers/CMultizoneDriver.hpp +++ b/SU2_CFD/include/drivers/CMultizoneDriver.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for driving single or multi-zone problems. * The subroutines and functions are in the driver_structure.cpp file. * \author T. Economon, H. Kline, R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \class CMultizoneDriver * \brief Class for driving zone-specific iterations. * \author R. Sanchez, O. Burghardt - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CMultizoneDriver : public CDriver { protected: diff --git a/SU2_CFD/include/drivers/CSinglezoneDriver.hpp b/SU2_CFD/include/drivers/CSinglezoneDriver.hpp index 82360bd0cc04..a46e799370ff 100644 --- a/SU2_CFD/include/drivers/CSinglezoneDriver.hpp +++ b/SU2_CFD/include/drivers/CSinglezoneDriver.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for driving single or multi-zone problems. * The subroutines and functions are in the driver_structure.cpp file. * \author T. Economon, H. Kline, R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -33,7 +33,7 @@ * \class CSinglezoneDriver * \brief Class for driving single-zone solvers. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSinglezoneDriver : public CDriver { protected: diff --git a/SU2_CFD/include/fluid/CConductivityModel.hpp b/SU2_CFD/include/fluid/CConductivityModel.hpp index 676d7a5047dd..ecf1157130de 100644 --- a/SU2_CFD/include/fluid/CConductivityModel.hpp +++ b/SU2_CFD/include/fluid/CConductivityModel.hpp @@ -2,7 +2,7 @@ * \file CConductivityModel.hpp * \brief Defines an interface class for thermal conductivity models. * \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CConstantConductivity.hpp b/SU2_CFD/include/fluid/CConstantConductivity.hpp index a4b2dbb4d554..7f957887b18c 100644 --- a/SU2_CFD/include/fluid/CConstantConductivity.hpp +++ b/SU2_CFD/include/fluid/CConstantConductivity.hpp @@ -2,7 +2,7 @@ * \file CConstantConductivity.hpp * \brief Defines a constant laminar thermal conductivity model. * \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CConstantConductivityRANS.hpp b/SU2_CFD/include/fluid/CConstantConductivityRANS.hpp index aede30be6250..d67035e67b96 100644 --- a/SU2_CFD/include/fluid/CConstantConductivityRANS.hpp +++ b/SU2_CFD/include/fluid/CConstantConductivityRANS.hpp @@ -2,7 +2,7 @@ * \file CConstantConductivityRANS.hpp * \brief Defines a constant conductivity model for RANS problems. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CConstantDensity.hpp b/SU2_CFD/include/fluid/CConstantDensity.hpp index 0bb57d88908c..eca3b95c0a24 100644 --- a/SU2_CFD/include/fluid/CConstantDensity.hpp +++ b/SU2_CFD/include/fluid/CConstantDensity.hpp @@ -2,7 +2,7 @@ * \file CConstantDensity.hpp * \brief Defines the incompressible constant density model. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CConstantPrandtl.hpp b/SU2_CFD/include/fluid/CConstantPrandtl.hpp index 46ce24d3292b..bb4bc5fd422b 100644 --- a/SU2_CFD/include/fluid/CConstantPrandtl.hpp +++ b/SU2_CFD/include/fluid/CConstantPrandtl.hpp @@ -2,7 +2,7 @@ * \file CConstantPrandtl.hpp * \brief Defines a non-constant laminar Prandtl number thermal conductivity model. * \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CConstantPrandtlRANS.hpp b/SU2_CFD/include/fluid/CConstantPrandtlRANS.hpp index 172a58e5bcca..7cb7439b676e 100644 --- a/SU2_CFD/include/fluid/CConstantPrandtlRANS.hpp +++ b/SU2_CFD/include/fluid/CConstantPrandtlRANS.hpp @@ -2,7 +2,7 @@ * \file CConstantPrandtlRANS.hpp * \brief Defines a non-constant effective thermal conductivity for RANS problems using Prandtl numbers. * \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CConstantViscosity.hpp b/SU2_CFD/include/fluid/CConstantViscosity.hpp index be47ab89fc23..548a2baa7bc5 100644 --- a/SU2_CFD/include/fluid/CConstantViscosity.hpp +++ b/SU2_CFD/include/fluid/CConstantViscosity.hpp @@ -2,7 +2,7 @@ * \file CConstantViscosity.hpp * \brief Defines a constant laminar viscosity model. * \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CFluidModel.hpp b/SU2_CFD/include/fluid/CFluidModel.hpp index aafe78197d9a..a521a3cac838 100644 --- a/SU2_CFD/include/fluid/CFluidModel.hpp +++ b/SU2_CFD/include/fluid/CFluidModel.hpp @@ -2,7 +2,7 @@ * \file CFluidModel.hpp * \brief Defines the main fluid model class for thermophysical properties. * \author S. Vitale, G. Gori, M. Pini, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CIdealGas.hpp b/SU2_CFD/include/fluid/CIdealGas.hpp index 487c2197807a..1282552203a6 100644 --- a/SU2_CFD/include/fluid/CIdealGas.hpp +++ b/SU2_CFD/include/fluid/CIdealGas.hpp @@ -2,7 +2,7 @@ * \file CIdealGas.hpp * \brief Defines the ideal gas model. * \author S. Vitale, G. Gori, M. Pini, A. Guardone, P. Colonna - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CIncIdealGas.hpp b/SU2_CFD/include/fluid/CIncIdealGas.hpp index d9d8193de177..548d0269dd6a 100644 --- a/SU2_CFD/include/fluid/CIncIdealGas.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGas.hpp @@ -2,7 +2,7 @@ * \file CIncIdealGas.hpp * \brief Defines the incompressible Ideal Gas model. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp index 1407a0e4bc03..b789d9b2f921 100644 --- a/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp +++ b/SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp @@ -2,7 +2,7 @@ * \file CIncIdealGasPolynomial.hpp * \brief Defines the incompressible Ideal Gas model with polynomial Cp. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CMutationTCLib.hpp b/SU2_CFD/include/fluid/CMutationTCLib.hpp index f9449721579b..9820eeb164f9 100644 --- a/SU2_CFD/include/fluid/CMutationTCLib.hpp +++ b/SU2_CFD/include/fluid/CMutationTCLib.hpp @@ -2,7 +2,7 @@ * \file CMutationTCLib.hpp * \brief Defines the class for the link to Mutation++ ThermoChemistry library. * \author C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -45,8 +45,7 @@ class CMutationTCLib : public CNEMOGas { vector Cv_ks, /*!< \brief Species specific heats at constant volume. */ es, /*!< \brief Species energies. */ - omega_vec, /*!< \brief Dummy vector for vibrational energy source term. */ - h_RT; /*!< \brief Enthalpy divided by R*T. */ + omega_vec; /*!< \brief Dummy vector for vibrational energy source term. */ su2double Tref; /*!< \brief Reference temperature. */ diff --git a/SU2_CFD/include/fluid/CNEMOGas.hpp b/SU2_CFD/include/fluid/CNEMOGas.hpp index 0cc9b06c97a6..734ac565c3cd 100644 --- a/SU2_CFD/include/fluid/CNEMOGas.hpp +++ b/SU2_CFD/include/fluid/CNEMOGas.hpp @@ -2,7 +2,7 @@ * \file CNEMOGas.hpp * \brief Defines the nonequilibrium gas model. * \author C. Garbacz, W. Maier, S. R. Copeland - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CPengRobinson.hpp b/SU2_CFD/include/fluid/CPengRobinson.hpp index 59d125735985..66061aaf378a 100644 --- a/SU2_CFD/include/fluid/CPengRobinson.hpp +++ b/SU2_CFD/include/fluid/CPengRobinson.hpp @@ -2,7 +2,7 @@ * \file CPengRobinson.hpp * \brief Defines the Peng-Robinson model. * \author S. Vitale, G. Gori, M. Pini, A. Guardone, P. Colonna - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CPolynomialConductivity.hpp b/SU2_CFD/include/fluid/CPolynomialConductivity.hpp index d0d4f56aef88..5626cfc7147d 100644 --- a/SU2_CFD/include/fluid/CPolynomialConductivity.hpp +++ b/SU2_CFD/include/fluid/CPolynomialConductivity.hpp @@ -2,7 +2,7 @@ * \file CPolynomialConductivity.hpp * \brief Defines a non-constant laminar thermal conductivity using a polynomial function of temperature. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CPolynomialConductivityRANS.hpp b/SU2_CFD/include/fluid/CPolynomialConductivityRANS.hpp index 3ef741328340..02fdd35fae3b 100644 --- a/SU2_CFD/include/fluid/CPolynomialConductivityRANS.hpp +++ b/SU2_CFD/include/fluid/CPolynomialConductivityRANS.hpp @@ -3,7 +3,7 @@ * \brief Defines a non-constant thermal conductivity using a polynomial function of temperature * for RANS problems with the addition of a turbulent component based on a turbulent Prandtl number. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CPolynomialViscosity.hpp b/SU2_CFD/include/fluid/CPolynomialViscosity.hpp index f69c021fe717..31ae31304219 100644 --- a/SU2_CFD/include/fluid/CPolynomialViscosity.hpp +++ b/SU2_CFD/include/fluid/CPolynomialViscosity.hpp @@ -2,7 +2,7 @@ * \file CPolynomialViscosity.hpp * \brief Defines a laminar viscosity model as a polynomial function of temperature. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CSU2TCLib.hpp b/SU2_CFD/include/fluid/CSU2TCLib.hpp index b08a03acdb19..0a42773582ab 100644 --- a/SU2_CFD/include/fluid/CSU2TCLib.hpp +++ b/SU2_CFD/include/fluid/CSU2TCLib.hpp @@ -2,7 +2,7 @@ * \file CSU2TCLib.hpp * \brief Defines the classes for different user defined ThermoChemistry libraries. * \author C. Garbacz, W. Maier, S. R. Copeland - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CSutherland.hpp b/SU2_CFD/include/fluid/CSutherland.hpp index a47ab501c555..204c230efa35 100644 --- a/SU2_CFD/include/fluid/CSutherland.hpp +++ b/SU2_CFD/include/fluid/CSutherland.hpp @@ -2,7 +2,7 @@ * \file CSutherland.hpp * \brief Defines Sutherland's Law for laminar viscosity. * \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CVanDerWaalsGas.hpp b/SU2_CFD/include/fluid/CVanDerWaalsGas.hpp index 9167076a90a4..5a9448cc9816 100644 --- a/SU2_CFD/include/fluid/CVanDerWaalsGas.hpp +++ b/SU2_CFD/include/fluid/CVanDerWaalsGas.hpp @@ -2,7 +2,7 @@ * \file CVanDerWaalsGas.hpp * \brief Declaration of the Polytropic Van der Waals model. * \author S. Vitale, G. Gori, M. Pini, A. Guardone, P. Colonna - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/fluid/CViscosityModel.hpp b/SU2_CFD/include/fluid/CViscosityModel.hpp index 04aa7adefb93..7a5b75c102c0 100644 --- a/SU2_CFD/include/fluid/CViscosityModel.hpp +++ b/SU2_CFD/include/fluid/CViscosityModel.hpp @@ -2,7 +2,7 @@ * \file CViscosityModel.hpp * \brief Interface class for defining laminar viscosity models. * \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp index 8c2541c7da5c..0233daa886cb 100644 --- a/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp +++ b/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp @@ -4,7 +4,7 @@ * \note This allows the same implementation to be used for conservative * and primitive variables of any solver. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -103,7 +103,7 @@ void computeGradientsGreenGauss(CSolver* solver, /*--- Determine if edge points inwards or outwards of iPoint. * If inwards we need to flip the area vector. ---*/ - su2double dir = (iPoint == geometry.edges->GetNode(iEdge,0))? 1.0 : -1.0; + su2double dir = (iPoint < jPoint)? 1.0 : -1.0; su2double weight = dir * halfOnVol; const auto area = geometry.edges->GetNormal(iEdge); diff --git a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp index c706a2b6f3b9..6cf2e739a7be 100644 --- a/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp +++ b/SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp @@ -3,7 +3,7 @@ * \brief Generic implementation of Least-Squares gradient computation. * \note This allows the same implementation to be used for conservative * and primitive variables of any solver. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/integration/CFEM_DG_Integration.hpp b/SU2_CFD/include/integration/CFEM_DG_Integration.hpp index 8d3fff4a2afa..13e1c32473c4 100644 --- a/SU2_CFD/include/integration/CFEM_DG_Integration.hpp +++ b/SU2_CFD/include/integration/CFEM_DG_Integration.hpp @@ -2,7 +2,7 @@ * \file CFEM_DG_Integration.hpp * \brief Declaration of class for integration with the FEM DG solver. * \author E. van der Weide, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -31,7 +31,7 @@ * \class CFEM_DG_Integration * \brief Class for integration with the FEM DG solver. * \author E. van der Weide, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEM_DG_Integration final : public CIntegration { public: diff --git a/SU2_CFD/include/integration/CIntegration.hpp b/SU2_CFD/include/integration/CIntegration.hpp index 0c88a5d05596..34d31f00fb3d 100644 --- a/SU2_CFD/include/integration/CIntegration.hpp +++ b/SU2_CFD/include/integration/CIntegration.hpp @@ -2,7 +2,7 @@ * \file CIntegration.hpp * \brief Declaration of the main routines to orchestrate space and time integration. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -108,7 +108,6 @@ class CIntegration { */ inline void SetConvergence(bool value) { Convergence = value; } - /*! * \brief Set the indicator of the convergence for FSI. * \param[in] valueFSI - TRUE means that the convergence criteria for FSI is satisfied; @@ -116,7 +115,6 @@ class CIntegration { */ inline void SetConvergence_FSI(bool valueFSI) { Convergence_FSI = valueFSI; } - /*! * \brief Get the indicator of the convergence for the full multigrid problem. * \return TRUE means that the convergence criteria is satisfied; @@ -125,20 +123,20 @@ class CIntegration { inline bool GetConvergence_FullMG(void) const { return Convergence_FullMG; } /*! - * \brief Save the solution, and volume at different time steps. + * \brief Save the geometry at different time steps. * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solution - Flow solution. + * \param[in] solver - Mesh solver. * \param[in] config - Definition of the particular problem. */ - void SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CConfig *config, unsigned short iMesh); + void SetDualTime_Geometry(CGeometry *geometry, CSolver *mesh_solver, const CConfig *config, unsigned short iMesh); /*! - * \brief Save the structural solution at different time steps. + * \brief Save the solution at different time steps, and reset certain fields for the next timestep. * \param[in] geometry - Geometrical definition of the problem. - * \param[in] solver_container - Structural solution. + * \param[in] solver - Some solver. * \param[in] config - Definition of the particular problem. */ - void SetStructural_Solver(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh); + virtual void SetDualTime_Solver(const CGeometry *geometry, CSolver *solver, const CConfig *config, unsigned short iMesh); /*! * \brief A virtual member. diff --git a/SU2_CFD/include/integration/CMultiGridIntegration.hpp b/SU2_CFD/include/integration/CMultiGridIntegration.hpp index f268190c1e9d..b69342f55ce2 100644 --- a/SU2_CFD/include/integration/CMultiGridIntegration.hpp +++ b/SU2_CFD/include/integration/CMultiGridIntegration.hpp @@ -2,7 +2,7 @@ * \file CMultiGridIntegration.hpp * \brief Declaration of class for time integration using a multigrid method. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/integration/CNewtonIntegration.hpp b/SU2_CFD/include/integration/CNewtonIntegration.hpp new file mode 100644 index 000000000000..86626b7629e6 --- /dev/null +++ b/SU2_CFD/include/integration/CNewtonIntegration.hpp @@ -0,0 +1,214 @@ +/*! + * \file CNewtonIntegration.hpp + * \brief Newton-Krylov integration. + * \author P. Gomes + * \version 7.1.1 "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 "CIntegration.hpp" +#include "../../../Common/include/parallelization/omp_structure.hpp" +#include "../../../Common/include/linear_algebra/CPreconditioner.hpp" +#include "../../../Common/include/linear_algebra/CMatrixVectorProduct.hpp" +#include "../../../Common/include/linear_algebra/CSysSolve.hpp" + +#ifdef HAVE_OMP +#ifdef HAVE_OMP_SIMD +#define CNEWTON_PARFOR SU2_OMP(for simd schedule(static,omp_chunk_size) nowait) +#else +#define CNEWTON_PARFOR SU2_OMP(for schedule(static,omp_chunk_size) nowait) +#endif +#else +#define CNEWTON_PARFOR SU2_OMP_SIMD +#endif + +/*! + * \class CNewtonIntegration + * \brief Class for time integration using a Newton-Krylov method, based + * on matrix-free products with the true Jacobian via finite differences. + */ +class CNewtonIntegration final : public CIntegration { +public: +#ifdef CODI_FORWARD_TYPE + using Scalar = su2double; + using MixedScalar = su2double; +#else + /*--- No point having single precision matrix-free products. ---*/ + using Scalar = passivedouble; + /*--- The block preconditioners may still use single precision. ---*/ + using MixedScalar = su2mixedfloat; +#endif + +private: + /*--- Residual evaluation modes, explicit for products, default to allow preconditioners to be built. ---*/ + enum ResEvalType {EXPLICIT, DEFAULT}; + + bool setup = false; + Scalar finDiffStepND = 0.0; + Scalar finDiffStep = 0.0; /*!< \brief Based on RMS(solution), used in matrix-free products. */ + unsigned long omp_chunk_size; /*!< \brief Chunk size used in light point loops. */ + + /*--- Number of iterations and tolerance for the linear preconditioner, + * 0 iterations forces "weak" preconditioning, i.e. not iterative. ---*/ + unsigned short precondIters = 0; + su2double precondTol = 0.0; + + /*--- For a number of iterations, or before a certain residual drop, + * use the quasi-Newton approach instead of Newton-Krylov. If both + * criteria are zero, or the solver does not provide a linear + * preconditioner, there is no startup phase. ---*/ + bool startupPeriod = false; + unsigned short startupIters = 0; + su2double startupResidual = 0.0; + su2double firstResidual = -20.0; + + /*--- Relax (increase) the tolerance for NK solves by a factor, until a + * certain drop in residuals, to reduce the cost of early iterations. ---*/ + unsigned short tolRelaxFactor = 0; + su2double fullTolResidual = 0.0; + + CConfig* config = nullptr; + CSolver** solvers = nullptr; + CGeometry* geometry = nullptr; + CNumerics*** numerics = nullptr; + + /*--- Residual and linear solver. ---*/ + CSysVector LinSysRes; + CSysSolve LinSolver; + + /*--- If possible the solution vector of the solver is re-used, otherwise this temporary is used. ---*/ + CSysVector LinSysSol; + + template::value> = 0> + inline CSysVector& GetSolutionVec(CSysVector& x) { return x; } + + template::value> = 0> + inline void SetSolutionResult(CSysVector&) const { } + + template::value> = 0> + inline CSysVector& GetSolutionVec(CSysVector&) { + LinSysSol = Scalar(0.0); + return LinSysSol; + } + + template::value> = 0> + inline void SetSolutionResult(CSysVector& x) const { + CNEWTON_PARFOR + for (auto i = 0ul; i < x.GetLocSize(); ++i) x[i] = LinSysSol[i]; + } + + /*--- Preconditioner objects for each active solver. ---*/ + CPreconditioner* preconditioner = nullptr; + + /*--- If mixed precision is used, these temporaries are used to interface with the preconditioner. ---*/ + mutable CSysVector precondIn, precondOut; + + template::value> = 0> + inline unsigned long Preconditioner_impl(const CSysVector& u, CSysVector& v, + unsigned long iters, Scalar& eps) const { + CNEWTON_PARFOR + for (auto i = 0ul; i < u.GetLocSize(); ++i) precondIn[i] = u[i]; + + iters = Preconditioner_impl(precondIn, precondOut, iters, eps); + + CNEWTON_PARFOR + for (auto i = 0ul; i < u.GetLocSize(); ++i) v[i] = precondOut[i]; + SU2_OMP_BARRIER + + return iters; + } + + /*--- Otherwise they are not needed. ---*/ + template::value> = 0> + inline unsigned long Preconditioner_impl(const CSysVector& u, CSysVector& v, + unsigned long iters, Scalar& eps) const { + if (iters == 0) { + (*preconditioner)(u, v); + return 0; + } + auto product = CSysMatrixVectorProduct(solvers[FLOW_SOL]->Jacobian, geometry, config); + v = MixedScalar(0.0); + MixedScalar eps_t = eps; + iters = solvers[FLOW_SOL]->System.FGMRES_LinSolver(u, v, product, *preconditioner, eps, iters, eps_t, false, config); + eps = eps_t; + return iters; + } + + /*! + * \brief Gather solver info, etc.. + */ + void Setup(); + + /*! + * \brief Increment the solution, x := x+mag*dir. + */ + void PerturbSolution(const CSysVector& direction, Scalar magnitude); + + /*! + * \brief Evaluate the nonlinear residual of the solver, which should be capable of alternating + * between implicit and explicit iterations to save time during matrix-free products. + */ + void ComputeResiduals(ResEvalType type); + + /*! + * \brief Compute the step size for finite differences. + */ + void ComputeFinDiffStep(); + +public: + /*! + * \brief Constructor. + */ + CNewtonIntegration() = default; + + /*! + * \brief Destructor. + */ + ~CNewtonIntegration(); + + /*! + * \brief This class overrides this method to make it a drop-in replacement for CMultigridIntegration. + * \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 (the way in which the equations are solved). + * \param[in] config - Definition of the particular problem. + * \param[in] RunTime_EqSystem - System of equations which is going to be solved. + * \param[in] iZone - Current zone. + * \param[in] iInst - Current instance. + */ + void MultiGrid_Iteration(CGeometry ****geometry, CSolver *****solver_container, + CNumerics ******numerics_container, CConfig **config, + unsigned short RunTime_EqSystem, unsigned short iZone, unsigned short iInst) override; + + /*! + * \brief Implementation of matrix-vector product with the real Jacobian of the nonlinear residuals. + */ + void MatrixFreeProduct(const CSysVector& u, CSysVector& v); + + /*! + * \brief Wrapper for the preconditioner. + */ + void Preconditioner(const CSysVector& u, CSysVector& v) const; + +}; + +#undef CNEWTON_PARFOR diff --git a/SU2_CFD/include/integration/CSingleGridIntegration.hpp b/SU2_CFD/include/integration/CSingleGridIntegration.hpp index 02c364b8eefc..53bd4f5966e3 100644 --- a/SU2_CFD/include/integration/CSingleGridIntegration.hpp +++ b/SU2_CFD/include/integration/CSingleGridIntegration.hpp @@ -2,7 +2,7 @@ * \file CSingleGridIntegration.hpp * \brief Declaration of class for numerical integration of fine grid-only problems. * \author A. Bueno. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/integration/CStructuralIntegration.hpp b/SU2_CFD/include/integration/CStructuralIntegration.hpp index 845167a3d4b2..0977f6fe64c0 100644 --- a/SU2_CFD/include/integration/CStructuralIntegration.hpp +++ b/SU2_CFD/include/integration/CStructuralIntegration.hpp @@ -2,7 +2,7 @@ * \file CStructuralIntegration.hpp * \brief Declaration of class for numerical integration of structural problems. * \author R. Sanchez. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -51,6 +51,14 @@ class CStructuralIntegration final : public CIntegration { CNumerics ******numerics_container, CConfig **config, unsigned short RunTime_EqSystem, unsigned short iZone, unsigned short iInst) override; + /*! + * \brief Save the solution at different time steps, and reset certain fields for the next timestep. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver - Structural solver. + * \param[in] config - Definition of the problem. + */ + void SetDualTime_Solver(const CGeometry *geometry, CSolver *solver, const CConfig *config, unsigned short iMesh) override; + private: /*! * \brief Do the space integration of the numerical system on a FEM framework. diff --git a/SU2_CFD/include/interfaces/CInterface.hpp b/SU2_CFD/include/interfaces/CInterface.hpp index d8911e393338..6c9c66edf24a 100644 --- a/SU2_CFD/include/interfaces/CInterface.hpp +++ b/SU2_CFD/include/interfaces/CInterface.hpp @@ -3,7 +3,7 @@ * \brief Declarations and inlines of the transfer structure. * The subroutines and functions are in the physics folders. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -50,7 +50,7 @@ using namespace std; * \class CInterface * \brief Main class for defining the physical transfer of information. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CInterface { diff --git a/SU2_CFD/include/interfaces/cfd/CConservativeVarsInterface.hpp b/SU2_CFD/include/interfaces/cfd/CConservativeVarsInterface.hpp index 8388c30dcc06..8d53bce25868 100644 --- a/SU2_CFD/include/interfaces/cfd/CConservativeVarsInterface.hpp +++ b/SU2_CFD/include/interfaces/cfd/CConservativeVarsInterface.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer conservative variables * from a generic zone into another one. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp b/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp index 7d427134d80e..e758813762dc 100644 --- a/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp +++ b/SU2_CFD/include/interfaces/cfd/CMixingPlaneInterface.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer average variables * needed for MixingPlane computation from a generic zone into another one. * \author S. Vitale - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/interfaces/cfd/CSlidingInterface.hpp b/SU2_CFD/include/interfaces/cfd/CSlidingInterface.hpp index 3c675b87d6b7..9e4b8fdf8c60 100644 --- a/SU2_CFD/include/interfaces/cfd/CSlidingInterface.hpp +++ b/SU2_CFD/include/interfaces/cfd/CSlidingInterface.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer conservative variables * from a generic zone into another * \author G. Gori Politecnico di Milano - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/interfaces/cht/CConjugateHeatInterface.hpp b/SU2_CFD/include/interfaces/cht/CConjugateHeatInterface.hpp index 0db18d0d6cab..0aceee454035 100644 --- a/SU2_CFD/include/interfaces/cht/CConjugateHeatInterface.hpp +++ b/SU2_CFD/include/interfaces/cht/CConjugateHeatInterface.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer temperature and heatflux * density for conjugate heat interfaces between structure and fluid zones. * \author O. Burghardt - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/interfaces/fsi/CDiscAdjFlowTractionInterface.hpp b/SU2_CFD/include/interfaces/fsi/CDiscAdjFlowTractionInterface.hpp index b0d419c2264e..7f527ebdb633 100644 --- a/SU2_CFD/include/interfaces/fsi/CDiscAdjFlowTractionInterface.hpp +++ b/SU2_CFD/include/interfaces/fsi/CDiscAdjFlowTractionInterface.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer flow tractions * from a fluid zone into a structural zone in a discrete adjoint simulation. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/interfaces/fsi/CDisplacementsInterface.hpp b/SU2_CFD/include/interfaces/fsi/CDisplacementsInterface.hpp index 4c16621b94e7..f0594f470d21 100644 --- a/SU2_CFD/include/interfaces/fsi/CDisplacementsInterface.hpp +++ b/SU2_CFD/include/interfaces/fsi/CDisplacementsInterface.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer boundary displacements * from a structural zone into a fluid zone. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp b/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp index b0fcce25defe..d7025943bd52 100644 --- a/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp +++ b/SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer flow tractions * from a fluid zone into a structural zone. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CAdjFluidIteration.hpp b/SU2_CFD/include/iteration/CAdjFluidIteration.hpp index 620dda7bd5b1..88672922358e 100644 --- a/SU2_CFD/include/iteration/CAdjFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CAdjFluidIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CDiscAdjFEAIteration.hpp b/SU2_CFD/include/iteration/CDiscAdjFEAIteration.hpp index fdd23c0040e2..3f1697c9ebe9 100644 --- a/SU2_CFD/include/iteration/CDiscAdjFEAIteration.hpp +++ b/SU2_CFD/include/iteration/CDiscAdjFEAIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CDiscAdjFluidIteration.hpp b/SU2_CFD/include/iteration/CDiscAdjFluidIteration.hpp index b1fa772908bc..c7da838c79ab 100644 --- a/SU2_CFD/include/iteration/CDiscAdjFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CDiscAdjFluidIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CDiscAdjHeatIteration.hpp b/SU2_CFD/include/iteration/CDiscAdjHeatIteration.hpp index 0736fe0a1fc4..933ad64ca651 100644 --- a/SU2_CFD/include/iteration/CDiscAdjHeatIteration.hpp +++ b/SU2_CFD/include/iteration/CDiscAdjHeatIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CFEAIteration.hpp b/SU2_CFD/include/iteration/CFEAIteration.hpp index aadc86fd22b4..1998b19cfa06 100644 --- a/SU2_CFD/include/iteration/CFEAIteration.hpp +++ b/SU2_CFD/include/iteration/CFEAIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \class CFEAIteration * \brief Class for driving an iteration of structural analysis. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEAIteration : public CIteration { public: diff --git a/SU2_CFD/include/iteration/CFEMFluidIteration.hpp b/SU2_CFD/include/iteration/CFEMFluidIteration.hpp index f89896550cf0..aa147b1b1714 100644 --- a/SU2_CFD/include/iteration/CFEMFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CFEMFluidIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \class CFEMFluidIteration * \brief Class for driving an iteration of the finite element flow system. * \author T. Economon, E. van der Weide - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEMFluidIteration : public CFluidIteration { public: diff --git a/SU2_CFD/include/iteration/CFluidIteration.hpp b/SU2_CFD/include/iteration/CFluidIteration.hpp index 82cd95628be0..2e5029d0dd7e 100644 --- a/SU2_CFD/include/iteration/CFluidIteration.hpp +++ b/SU2_CFD/include/iteration/CFluidIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -115,6 +115,8 @@ class CFluidIteration : public CIteration { CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone, unsigned short val_iInst) override; + private: + /*! * \brief Imposes a gust via the grid velocities. * \author S. Padron @@ -146,4 +148,11 @@ class CFluidIteration : public CIteration { * \return Boolean indicating weather calculation should be stopped */ bool MonitorFixed_CL(COutput* output, CGeometry* geometry, CSolver** solver, CConfig* config); + + /*! + * \brief Store old aeroelastic solutions + * \param[in,out] config - Definition of the particular problem. + */ + void SetDualTime_Aeroelastic(CConfig* config) const; + }; diff --git a/SU2_CFD/include/iteration/CHeatIteration.hpp b/SU2_CFD/include/iteration/CHeatIteration.hpp index 54b81aae79a8..6490c30c466c 100644 --- a/SU2_CFD/include/iteration/CHeatIteration.hpp +++ b/SU2_CFD/include/iteration/CHeatIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CIteration.hpp b/SU2_CFD/include/iteration/CIteration.hpp index f4691250b97a..7a75eadf213d 100644 --- a/SU2_CFD/include/iteration/CIteration.hpp +++ b/SU2_CFD/include/iteration/CIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CIterationFactory.hpp b/SU2_CFD/include/iteration/CIterationFactory.hpp index e731134fffb3..af39692f5e6d 100644 --- a/SU2_CFD/include/iteration/CIterationFactory.hpp +++ b/SU2_CFD/include/iteration/CIterationFactory.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/iteration/CTurboIteration.hpp b/SU2_CFD/include/iteration/CTurboIteration.hpp index e93ff07325b2..aab0cd598bfa 100644 --- a/SU2_CFD/include/iteration/CTurboIteration.hpp +++ b/SU2_CFD/include/iteration/CTurboIteration.hpp @@ -3,7 +3,7 @@ * \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.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/limiters/CLimiterDetails.hpp b/SU2_CFD/include/limiters/CLimiterDetails.hpp index d90c54fee50c..2b82e80351c4 100644 --- a/SU2_CFD/include/limiters/CLimiterDetails.hpp +++ b/SU2_CFD/include/limiters/CLimiterDetails.hpp @@ -3,7 +3,7 @@ * \brief A class template that allows defining limiters via * specialization of particular details. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -210,10 +210,10 @@ struct CLimiterDetails SU2_OMP_MASTER { localMin = sharedMin; - SU2_MPI::Allreduce(localMin.data(), sharedMin.data(), varEnd, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(localMin.data(), sharedMin.data(), varEnd, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); localMax = sharedMax; - SU2_MPI::Allreduce(localMax.data(), sharedMax.data(), varEnd, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(localMax.data(), sharedMax.data(), varEnd, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); } SU2_OMP_BARRIER diff --git a/SU2_CFD/include/limiters/computeLimiters.hpp b/SU2_CFD/include/limiters/computeLimiters.hpp index 5b0b2bbfc2e1..a54832af6b97 100644 --- a/SU2_CFD/include/limiters/computeLimiters.hpp +++ b/SU2_CFD/include/limiters/computeLimiters.hpp @@ -2,7 +2,7 @@ * \file computeLimiters.hpp * \brief Compute limiters wrapper function. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/limiters/computeLimiters_impl.hpp b/SU2_CFD/include/limiters/computeLimiters_impl.hpp index f15ebe681093..ae43d10e07a3 100644 --- a/SU2_CFD/include/limiters/computeLimiters_impl.hpp +++ b/SU2_CFD/include/limiters/computeLimiters_impl.hpp @@ -4,7 +4,7 @@ * \note Common methods are derived by defining small details * via specialization of CLimiterDetails. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/CNumerics.hpp b/SU2_CFD/include/numerics/CNumerics.hpp index e5c00debb20b..b3e20801e843 100644 --- a/SU2_CFD/include/numerics/CNumerics.hpp +++ b/SU2_CFD/include/numerics/CNumerics.hpp @@ -3,7 +3,7 @@ * \brief Delaration of the base numerics class, the * implementation is in the CNumerics.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -82,6 +82,9 @@ class CNumerics { Thermal_Diffusivity_i, /*!< \brief Thermal diffusivity at point i. */ Thermal_Diffusivity_j; /*!< \brief Thermal diffusivity at point j. */ su2double + SpecificHeat_i, /*!< \brief Specific heat c_p at point j. */ + SpecificHeat_j; /*!< \brief Specific heat c_p at point j. */ + su2double Cp_i, /*!< \brief Cp at point i. */ Cp_j; /*!< \brief Cp at point j. */ su2double @@ -751,6 +754,17 @@ class CNumerics { Thermal_Diffusivity_j = val_thermal_diffusivity_j; } + /*! + * \brief Set the specifc heat c_p. + * \param[in] val_specific_heat_i - Value of the specific heat at point i. + * \param[in] val_specific_heat_j - Value of the specific heat at point j. + */ + inline void SetSpecificHeat(su2double val_specific_heat_i, + su2double val_specific_heat_j) { + SpecificHeat_i = val_specific_heat_i; + SpecificHeat_j = val_specific_heat_j; + } + /*! * \brief Set the eddy viscosity. * \param[in] val_eddy_viscosity_i - Value of the eddy viscosity at point i. @@ -1495,7 +1509,7 @@ class CNumerics { * \brief A virtual member to compute the averaged nodal stresses * \param[in] element_container - Element structure for the particular element integrated. */ - inline virtual void Compute_Averaged_NodalStress(CElement *element_container, const CConfig* config) { } + inline virtual su2double Compute_Averaged_NodalStress(CElement *element_container, const CConfig* config) { return 0; } /*! * \brief Computes a basis of orthogonal vectors from a supplied vector @@ -1590,6 +1604,11 @@ class CNumerics { */ virtual inline void SetGamma(su2double val_Gamma_i, su2double val_Gamma_j) { } + /*! + * \brief Set massflow, heatflow & inlet temperature for streamwise periodic flow. + * \param[in] SolverSPvals - Struct holding the values. + */ + virtual void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals) { } }; /*! diff --git a/SU2_CFD/include/numerics/NEMO/CNEMONumerics.hpp b/SU2_CFD/include/numerics/NEMO/CNEMONumerics.hpp index 0590231b4e3d..510e755d0837 100644 --- a/SU2_CFD/include/numerics/NEMO/CNEMONumerics.hpp +++ b/SU2_CFD/include/numerics/NEMO/CNEMONumerics.hpp @@ -2,7 +2,7 @@ * \file CNEMONumerics.hpp * \brief Base class template NEMO numerics. * \author C. Garbacz, W. Maier, S. R. Copeland - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp b/SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp index f8fc6c01cb86..a44dbe598b6f 100644 --- a/SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp +++ b/SU2_CFD/include/numerics/NEMO/NEMO_diffusion.hpp @@ -2,7 +2,7 @@ * \file NEMO_diffusion.hpp * \brief Declarations of numerics classes for viscous flux computation. * \author S.R. Copeland, W. Maier, C. Garbacz. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for computing viscous term using the average of gradients. * \ingroup ViscDiscr * \author S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CAvgGrad_NEMO : public CNEMONumerics { private: @@ -89,7 +89,7 @@ class CAvgGrad_NEMO : public CNEMONumerics { * \brief Class for computing viscous term using the average of gradients. * \ingroup ViscDiscr * \author C. Garbacz, W. Maier, S.R. Copeland. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CAvgGradCorrected_NEMO : public CNEMONumerics { private: diff --git a/SU2_CFD/include/numerics/NEMO/NEMO_sources.hpp b/SU2_CFD/include/numerics/NEMO/NEMO_sources.hpp index 7db036298bd4..c94cc1620c75 100644 --- a/SU2_CFD/include/numerics/NEMO/NEMO_sources.hpp +++ b/SU2_CFD/include/numerics/NEMO/NEMO_sources.hpp @@ -2,7 +2,7 @@ * \file NEMO_sources.hpp * \brief Delarations of numerics classes for source-term integration. * \author C. Garbacz, W. Maier, S. Copeland. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for two-temperature model source terms. * \ingroup SourceDiscr * \author C. Garbacz, W. Maier, S. Copeland. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSource_NEMO : public CNEMONumerics { private: diff --git a/SU2_CFD/include/numerics/NEMO/convection/ausm.hpp b/SU2_CFD/include/numerics/NEMO/convection/ausm.hpp index 4f1e2e1a3feb..3a6c15c2211b 100644 --- a/SU2_CFD/include/numerics/NEMO/convection/ausm.hpp +++ b/SU2_CFD/include/numerics/NEMO/convection/ausm.hpp @@ -2,7 +2,7 @@ * \file ausm.hpp * \brief Declaration of numerics classes for the AUSM family of schemes in NEMO. * \author F. Palacios, S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/NEMO/convection/ausmplusup2.hpp b/SU2_CFD/include/numerics/NEMO/convection/ausmplusup2.hpp index e2efa3c47461..4ae5a51c5043 100644 --- a/SU2_CFD/include/numerics/NEMO/convection/ausmplusup2.hpp +++ b/SU2_CFD/include/numerics/NEMO/convection/ausmplusup2.hpp @@ -2,7 +2,7 @@ * \file ausmplusup2.hpp * \brief Declaration of numerics classes for the AUSM family of schemes in NEMO - AUSM+UP2. * \author W. Maier, A. Sachedeva, C. Garbacz. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/NEMO/convection/ausmpwplus.hpp b/SU2_CFD/include/numerics/NEMO/convection/ausmpwplus.hpp index 8796f07ae109..e906b912ea35 100644 --- a/SU2_CFD/include/numerics/NEMO/convection/ausmpwplus.hpp +++ b/SU2_CFD/include/numerics/NEMO/convection/ausmpwplus.hpp @@ -2,7 +2,7 @@ * \file ausmpwplus.hpp * \brief Declaration of numerics classes for the AUSM family of schemes in NEMO - AUSMPWPLUS. * \author F. Palacios, W.Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/NEMO/convection/lax.hpp b/SU2_CFD/include/numerics/NEMO/convection/lax.hpp index 7c89fb579b91..8356749a0a33 100644 --- a/SU2_CFD/include/numerics/NEMO/convection/lax.hpp +++ b/SU2_CFD/include/numerics/NEMO/convection/lax.hpp @@ -2,7 +2,7 @@ * \file lax.hpp * \brief Declaration of numerics classes for Lax centered scheme. * \author F. Palacios, S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/NEMO/convection/msw.hpp b/SU2_CFD/include/numerics/NEMO/convection/msw.hpp index a5c587c1f58f..de280e98038d 100644 --- a/SU2_CFD/include/numerics/NEMO/convection/msw.hpp +++ b/SU2_CFD/include/numerics/NEMO/convection/msw.hpp @@ -2,7 +2,7 @@ * \file msw.hpp * \brief Declaration of numerics classes for modified Steger-Warming scheme. * \author ADL Stanford, S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for solving a flux-vector splitting method by Steger & Warming, modified version. * \ingroup ConvDiscr * \author ADL Stanford, S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CUpwMSW_NEMO : public CNEMONumerics { private: diff --git a/SU2_CFD/include/numerics/NEMO/convection/roe.hpp b/SU2_CFD/include/numerics/NEMO/convection/roe.hpp index 89393c25e3fa..306901c570e0 100644 --- a/SU2_CFD/include/numerics/NEMO/convection/roe.hpp +++ b/SU2_CFD/include/numerics/NEMO/convection/roe.hpp @@ -2,7 +2,7 @@ * \file roe.hpp * \brief Delarations of numerics classes for Roe-type schemes in NEMO. * \author S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for evaluating the Riemann problem using Roe's scheme for a two-temperature model. * \ingroup ConvDiscr * \author S. R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CUpwRoe_NEMO : public CNEMONumerics { private: diff --git a/SU2_CFD/include/numerics/continuous_adjoint/adj_convection.hpp b/SU2_CFD/include/numerics/continuous_adjoint/adj_convection.hpp index 43ec863a17fe..0cad6e0a41b5 100644 --- a/SU2_CFD/include/numerics/continuous_adjoint/adj_convection.hpp +++ b/SU2_CFD/include/numerics/continuous_adjoint/adj_convection.hpp @@ -3,7 +3,7 @@ * \brief Delarations of numerics classes for continuous adjoint * convective discretization. Implemented in adj_convection.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/continuous_adjoint/adj_diffusion.hpp b/SU2_CFD/include/numerics/continuous_adjoint/adj_diffusion.hpp index 07b566bd69d5..9e3bb4619831 100644 --- a/SU2_CFD/include/numerics/continuous_adjoint/adj_diffusion.hpp +++ b/SU2_CFD/include/numerics/continuous_adjoint/adj_diffusion.hpp @@ -3,7 +3,7 @@ * \brief Delarations of numerics classes for continuous adjoint * diffusion discretization. Implemented in adj_diffusion.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/continuous_adjoint/adj_sources.hpp b/SU2_CFD/include/numerics/continuous_adjoint/adj_sources.hpp index 4cca49fc667b..c8e7be9b98b4 100644 --- a/SU2_CFD/include/numerics/continuous_adjoint/adj_sources.hpp +++ b/SU2_CFD/include/numerics/continuous_adjoint/adj_sources.hpp @@ -3,7 +3,7 @@ * \brief Delarations of numerics classes for continuous adjoint * source term integration. Implemented in adj_sources.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/elasticity/CFEAElasticity.hpp b/SU2_CFD/include/numerics/elasticity/CFEAElasticity.hpp index ef7cafbef6f5..dd777faea78a 100644 --- a/SU2_CFD/include/numerics/elasticity/CFEAElasticity.hpp +++ b/SU2_CFD/include/numerics/elasticity/CFEAElasticity.hpp @@ -2,7 +2,7 @@ * \file CFEAElasticity.hpp * \brief Declaration and inlines of the base class for elasticity problems. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -38,7 +38,7 @@ * document the public interface of this class hierarchy. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEAElasticity : public CNumerics { @@ -174,7 +174,33 @@ class CFEAElasticity : public CNumerics { * \param[in,out] element_container - The finite element. * \param[in] config - Definition of the problem. */ - inline void Compute_Averaged_NodalStress(CElement *element_container, const CConfig *config) override { }; + inline su2double Compute_Averaged_NodalStress(CElement *element_container, const CConfig *config) override { return 0; }; + + /*! + * \brief Compute VonMises stress from components Sxx Syy Sxy Szz Sxz Syz. + */ + template + static su2double VonMisesStress(unsigned short nDim, const T& stress) { + if (nDim == 2) { + su2double Sxx = stress[0], Syy = stress[1], Sxy = stress[2]; + + su2double S1, S2; S1 = S2 = (Sxx+Syy)/2; + su2double tauMax = sqrt(pow((Sxx-Syy)/2, 2) + pow(Sxy,2)); + S1 += tauMax; + S2 -= tauMax; + + return sqrt(S1*S1+S2*S2-2*S1*S2); + } + else { + su2double Sxx = stress[0], Syy = stress[1], Szz = stress[3]; + su2double Sxy = stress[2], Sxz = stress[4], Syz = stress[5]; + + return sqrt(0.5*(pow(Sxx - Syy, 2) + + pow(Syy - Szz, 2) + + pow(Szz - Sxx, 2) + + 6.0*(Sxy*Sxy+Sxz*Sxz+Syz*Syz))); + } + } protected: /*! diff --git a/SU2_CFD/include/numerics/elasticity/CFEALinearElasticity.hpp b/SU2_CFD/include/numerics/elasticity/CFEALinearElasticity.hpp index d9d6900714c4..e896c04258aa 100644 --- a/SU2_CFD/include/numerics/elasticity/CFEALinearElasticity.hpp +++ b/SU2_CFD/include/numerics/elasticity/CFEALinearElasticity.hpp @@ -2,7 +2,7 @@ * \file CFEALinearElasticity.hpp * \brief Declaration and inlines of the linear elasticity FE numerics class. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -35,7 +35,7 @@ * \brief Class for computing the stiffness matrix of a linear, elastic problem. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEALinearElasticity : public CFEAElasticity { protected: @@ -72,7 +72,7 @@ class CFEALinearElasticity : public CFEAElasticity { * \param[in,out] element_container - The finite element. * \param[in] config - Definition of the problem. */ - void Compute_Averaged_NodalStress(CElement *element_container, const CConfig *config) final; + su2double Compute_Averaged_NodalStress(CElement *element_container, const CConfig *config) final; private: /*! @@ -90,7 +90,7 @@ class CFEALinearElasticity : public CFEAElasticity { * \brief Particular case of linear elasticity used for mesh deformation. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEAMeshElasticity final : public CFEALinearElasticity { diff --git a/SU2_CFD/include/numerics/elasticity/CFEANonlinearElasticity.hpp b/SU2_CFD/include/numerics/elasticity/CFEANonlinearElasticity.hpp index 430f1b546e22..afffa5351b35 100644 --- a/SU2_CFD/include/numerics/elasticity/CFEANonlinearElasticity.hpp +++ b/SU2_CFD/include/numerics/elasticity/CFEANonlinearElasticity.hpp @@ -2,7 +2,7 @@ * \file CFEANonlinearElasticity.hpp * \brief Declaration and inlines of the nonlinear elasticity FE numerics class. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -37,7 +37,7 @@ * Compute_Plane_Stress_Term and Compute_Stress_Tensor. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEANonlinearElasticity : public CFEAElasticity { @@ -127,7 +127,7 @@ class CFEANonlinearElasticity : public CFEAElasticity { * \param[in,out] element_container - The finite element. * \param[in] config - Definition of the problem. */ - void Compute_Averaged_NodalStress(CElement *element_container, const CConfig *config) final; + su2double Compute_Averaged_NodalStress(CElement *element_container, const CConfig *config) final; protected: /*! diff --git a/SU2_CFD/include/numerics/elasticity/nonlinear_models.hpp b/SU2_CFD/include/numerics/elasticity/nonlinear_models.hpp index e3fa2b0de109..db14e4c9fa13 100644 --- a/SU2_CFD/include/numerics/elasticity/nonlinear_models.hpp +++ b/SU2_CFD/include/numerics/elasticity/nonlinear_models.hpp @@ -2,7 +2,7 @@ * \file nonlinear_models.hpp * \brief Declarations of nonlinear constitutive models. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -35,7 +35,7 @@ * \brief Class for computing the constitutive and stress tensors for a neo-Hookean material model, compressible. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEM_NeoHookean_Comp final : public CFEANonlinearElasticity { @@ -83,7 +83,7 @@ class CFEM_NeoHookean_Comp final : public CFEANonlinearElasticity { * \brief Constitutive and stress tensors for a Knowles stored-energy function, nearly incompressible. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEM_Knowles_NearInc final : public CFEANonlinearElasticity { @@ -134,7 +134,7 @@ class CFEM_Knowles_NearInc final : public CFEANonlinearElasticity { * \brief Class for computing the constitutive and stress tensors for a dielectric elastomer. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEM_DielectricElastomer final : public CFEANonlinearElasticity { @@ -182,7 +182,7 @@ class CFEM_DielectricElastomer final : public CFEANonlinearElasticity { * \brief Class for computing the constitutive and stress tensors for a nearly-incompressible ideal DE. * \ingroup FEM_Discr * \author R.Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEM_IdealDE final : public CFEANonlinearElasticity { diff --git a/SU2_CFD/include/numerics/flow/convection/ausm_slau.hpp b/SU2_CFD/include/numerics/flow/convection/ausm_slau.hpp index 5728634b36d2..e1b6a59f6f78 100644 --- a/SU2_CFD/include/numerics/flow/convection/ausm_slau.hpp +++ b/SU2_CFD/include/numerics/flow/convection/ausm_slau.hpp @@ -3,7 +3,7 @@ * \brief Declaration of numerics classes for the AUSM family of schemes, * including SLAU. The implementation is in ausm.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/flow/convection/centered.hpp b/SU2_CFD/include/numerics/flow/convection/centered.hpp index 3f808c4aa88b..2b140b168a50 100644 --- a/SU2_CFD/include/numerics/flow/convection/centered.hpp +++ b/SU2_CFD/include/numerics/flow/convection/centered.hpp @@ -3,7 +3,7 @@ * \brief Delaration of numerics classes for centered schemes, * the implementation is in centered.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/flow/convection/cusp.hpp b/SU2_CFD/include/numerics/flow/convection/cusp.hpp index 25cc60588764..eed2403cc7fe 100644 --- a/SU2_CFD/include/numerics/flow/convection/cusp.hpp +++ b/SU2_CFD/include/numerics/flow/convection/cusp.hpp @@ -2,7 +2,7 @@ * \file cusp.hpp * \brief Declaration of the CUSP numerics class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/flow/convection/fds.hpp b/SU2_CFD/include/numerics/flow/convection/fds.hpp index 0ac74986d4c1..1cfeed942e18 100644 --- a/SU2_CFD/include/numerics/flow/convection/fds.hpp +++ b/SU2_CFD/include/numerics/flow/convection/fds.hpp @@ -3,7 +3,7 @@ * \brief Declarations of classes for Flux-Difference-Spliting schemes, * the implementations are in fds.cpp * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/flow/convection/fvs.hpp b/SU2_CFD/include/numerics/flow/convection/fvs.hpp index c8f98d6d5f25..da8d27da1527 100644 --- a/SU2_CFD/include/numerics/flow/convection/fvs.hpp +++ b/SU2_CFD/include/numerics/flow/convection/fvs.hpp @@ -3,7 +3,7 @@ * \brief Delarations of classes for Flux-Vector-Spliting schemes, * the implementations are in fvs.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/flow/convection/hllc.hpp b/SU2_CFD/include/numerics/flow/convection/hllc.hpp index 6507ef06df44..9f3914851916 100644 --- a/SU2_CFD/include/numerics/flow/convection/hllc.hpp +++ b/SU2_CFD/include/numerics/flow/convection/hllc.hpp @@ -2,7 +2,7 @@ * \file hllc.hpp * \brief Declaration of HLLC numerics classes, implemented in hllc.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for solving an approximate Riemann HLLC. * \ingroup ConvDiscr * \author G. Gori, Politecnico di Milano - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CUpwHLLC_Flow final : public CNumerics { private: @@ -86,7 +86,7 @@ class CUpwHLLC_Flow final : public CNumerics { * \brief Class for solving an approximate Riemann HLLC. * \ingroup ConvDiscr * \author G. Gori, Politecnico di Milano - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CUpwGeneralHLLC_Flow final : public CNumerics { private: diff --git a/SU2_CFD/include/numerics/flow/convection/roe.hpp b/SU2_CFD/include/numerics/flow/convection/roe.hpp index af53bc18c93c..7de952680d3b 100644 --- a/SU2_CFD/include/numerics/flow/convection/roe.hpp +++ b/SU2_CFD/include/numerics/flow/convection/roe.hpp @@ -3,7 +3,7 @@ * \brief Delarations of numerics classes for Roe-type schemes, * implemented in roe.cpp. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -119,7 +119,7 @@ class CUpwRoe_Flow final : public CUpwRoeBase_Flow { * \brief Class for solving an approximate Riemann solver of L2Roe for the flow equations. * \ingroup ConvDiscr * \author E. Molina, A. Bueno, F. Palacios, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CUpwL2Roe_Flow final : public CUpwRoeBase_Flow { private: @@ -149,7 +149,7 @@ class CUpwL2Roe_Flow final : public CUpwRoeBase_Flow { * \brief Class for solving an approximate Riemann solver of LMRoe for the flow equations. * \ingroup ConvDiscr * \author E. Molina, A. Bueno, F. Palacios, P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CUpwLMRoe_Flow final : public CUpwRoeBase_Flow { private: diff --git a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp index f72677c78e9f..b58a91c7d677 100644 --- a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp +++ b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp @@ -2,7 +2,7 @@ * \file flow_diffusion.hpp * \brief Delarations of numerics classes for viscous flux computation. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/flow/flow_sources.hpp b/SU2_CFD/include/numerics/flow/flow_sources.hpp index 38df4d2e432f..8930af685058 100644 --- a/SU2_CFD/include/numerics/flow/flow_sources.hpp +++ b/SU2_CFD/include/numerics/flow/flow_sources.hpp @@ -2,7 +2,7 @@ * \file flow_sources.hpp * \brief Delarations of numerics classes for source-term integration. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -40,6 +40,7 @@ class CSourceBase_Flow : public CNumerics { protected: su2double* residual = nullptr; su2double** jacobian = nullptr; + struct StreamwisePeriodicValues SPvals; /*! * \brief Constructor of the class. @@ -55,6 +56,12 @@ class CSourceBase_Flow : public CNumerics { */ ~CSourceBase_Flow() override; + /*! + * \brief Set massflow, heatflow & inlet temperature for streamwise periodic flow. + * \param[in] SolverSPvals - Struct holding the values. + */ + void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals) final { SPvals = SolverSPvals; } + }; /*! @@ -170,7 +177,7 @@ class CSourceBodyForce final : public CSourceBase_Flow { * \brief Class for the source term integration of a body force in the incompressible solver. * \ingroup SourceDiscr * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSourceIncBodyForce final : public CSourceBase_Flow { su2double Body_Force_Vector[3]; @@ -197,7 +204,7 @@ class CSourceIncBodyForce final : public CSourceBase_Flow { * \brief Class for the source term integration of the Boussinesq approximation for incompressible flow. * \ingroup SourceDiscr * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSourceBoussinesq final : public CSourceBase_Flow { su2double Gravity_Vector[3]; @@ -226,6 +233,8 @@ class CSourceBoussinesq final : public CSourceBase_Flow { * \author F. Palacios */ class CSourceGravity final : public CSourceBase_Flow { + su2double Force_Ref; + public: /*! * \param[in] val_nDim - Number of dimensions of the problem. @@ -323,21 +332,83 @@ class CSourceWindGust final : public CSourceBase_Flow { }; /*! - * \class CSourceRadiation - * \brief Class for a source term due to radiation. + * \class CSourceIncStreamwise_Periodic + * \brief Class for the source term integration of a streamwise periodic body force in the incompressible solver. * \ingroup SourceDiscr - * \author Ruben Sanchez + * \author T. Kattmann */ -class CSourceRadiation : public CSourceBase_Flow { +class CSourceIncStreamwise_Periodic final : public CSourceBase_Flow { private: - bool implicit; + bool turbulent; /*!< \brief Turbulence model used. */ + bool energy; /*!< \brief Energy equation on. */ + bool streamwisePeriodic_temperature; /*!< \brief Periodicity in energy equation */ + su2double Streamwise_Coord_Vector[MAXNDIM] = {0.0}; /*!< \brief Translation vector between streamwise periodic surfaces. */ + + su2double norm2_translation, /*!< \brief Square of distance between the 2 periodic surfaces. */ + dot_product, /*!< \brief Container for various dot-products. */ + scalar_factor; /*!< \brief Holds scalar factors to simplify final equations. */ + +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. + */ + CSourceIncStreamwise_Periodic(unsigned short val_nDim, + unsigned short val_nVar, + CConfig *config); + + /*! + * \brief Source term integration for a body force. + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig *config) override; + +}; + +/*! + * \class CSourceIncStreamwisePeriodic_Outlet + * \brief Class for the outlet heat sink. Acts like a heatflux boundary on the outlet and not as a volume source. + * \ingroup SourceDiscr + * \author T. Kattmann + */ +class CSourceIncStreamwisePeriodic_Outlet : public CSourceBase_Flow { 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. */ + CSourceIncStreamwisePeriodic_Outlet(unsigned short val_nDim, + unsigned short val_nVar, + CConfig *config); + + /*! + * \brief Source term integration for boundary heat sink. + * \param[in] config - Definition of the particular problem. + */ + ResidualType<> ComputeResidual(const CConfig *config) override; + +}; + + +/*! + * \class CSourceRadiation + * \brief Class for a source term due to radiation. + * \ingroup SourceDiscr + * \author Ruben Sanchez + */ +class CSourceRadiation : public CSourceBase_Flow { +private: + bool implicit; + +public: + CSourceRadiation(unsigned short val_nDim, unsigned short val_nVar, const CConfig *config); /*! diff --git a/SU2_CFD/include/numerics/heat.hpp b/SU2_CFD/include/numerics/heat.hpp index 4a869c73f0e7..58c91a7fd3d2 100644 --- a/SU2_CFD/include/numerics/heat.hpp +++ b/SU2_CFD/include/numerics/heat.hpp @@ -2,7 +2,7 @@ * \file heat.hpp * \brief Delarations of numerics classes for heat transfer problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for scalar centered scheme. * \ingroup ConvDiscr * \author O. Burghardt - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CCentSca_Heat : public CNumerics { @@ -81,7 +81,7 @@ class CCentSca_Heat : public CNumerics { * \brief Class for doing a scalar upwind solver for the heat convection equation. * \ingroup ConvDiscr * \author O. Burghardt. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CUpwSca_Heat : public CNumerics { private: @@ -119,7 +119,7 @@ class CUpwSca_Heat : public CNumerics { * \brief Class for computing viscous term using average of gradients without correction (heat equation). * \ingroup ViscDiscr * \author O. Burghardt. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CAvgGrad_Heat : public CNumerics { private: @@ -160,7 +160,7 @@ class CAvgGrad_Heat : public CNumerics { * \brief Class for computing viscous term using average of gradients with correction (heat equation). * \ingroup ViscDiscr * \author O. Burghardt. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CAvgGradCorrected_Heat : public CNumerics { private: diff --git a/SU2_CFD/include/numerics/radiation.hpp b/SU2_CFD/include/numerics/radiation.hpp index 768ec3a83ebc..dba0db87841f 100644 --- a/SU2_CFD/include/numerics/radiation.hpp +++ b/SU2_CFD/include/numerics/radiation.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the classes used to compute * residual terms in radiation problems. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/template.hpp b/SU2_CFD/include/numerics/template.hpp index b305ce98f003..4dae8622eda8 100644 --- a/SU2_CFD/include/numerics/template.hpp +++ b/SU2_CFD/include/numerics/template.hpp @@ -5,7 +5,7 @@ * new schemes in SU2, in practice you should look for a similar * scheme and try to re-use functionality (not by copy-paste). * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/transition.hpp b/SU2_CFD/include/numerics/transition.hpp index 4be38768ee34..ded785a2ad34 100644 --- a/SU2_CFD/include/numerics/transition.hpp +++ b/SU2_CFD/include/numerics/transition.hpp @@ -2,7 +2,7 @@ * \file transition.hpp * \brief Delarations of numerics classes for transition problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/turbulent/turb_convection.hpp b/SU2_CFD/include/numerics/turbulent/turb_convection.hpp index f50fbaa97649..9abad4d6ad37 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_convection.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_convection.hpp @@ -3,7 +3,7 @@ * \brief Delarations of numerics classes for discretization of * convective fluxes in turbulence problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/turbulent/turb_diffusion.hpp b/SU2_CFD/include/numerics/turbulent/turb_diffusion.hpp index de77c97a6bea..4fdcd62c5e7d 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_diffusion.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_diffusion.hpp @@ -3,7 +3,7 @@ * \brief Declarations of numerics classes for discretization of * viscous fluxes in turbulence problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp index ed2e03a2e5af..92960ca41e49 100644 --- a/SU2_CFD/include/numerics/turbulent/turb_sources.hpp +++ b/SU2_CFD/include/numerics/turbulent/turb_sources.hpp @@ -3,7 +3,7 @@ * \brief Delarations of numerics classes for integration of source * terms in turbulence problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -51,7 +51,7 @@ class CSourceBase_TurbSA : public CNumerics { su2double cw1; su2double cr1; - su2double gamma_BC; + su2double Gamma_BC = 0.0; su2double intermittency; su2double Production, Destruction, CrossProduction; @@ -105,7 +105,7 @@ class CSourceBase_TurbSA : public CNumerics { * \brief Get the intermittency for the BC trans. model. * \return Value of the intermittency. */ - inline su2double GetGammaBC(void) const final { return gamma_BC; } + inline su2double GetGammaBC(void) const final { return Gamma_BC; } /*! * \brief ______________. @@ -158,7 +158,7 @@ class CSourcePieceWise_TurbSA final : public CSourceBase_TurbSA { * \brief Class for integrating the source terms of the Spalart-Allmaras CC modification turbulence model equation. * \ingroup SourceDiscr * \author E.Molina, A. Bueno. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSourcePieceWise_TurbSA_COMP final : public CSourceBase_TurbSA { private: @@ -193,7 +193,7 @@ class CSourcePieceWise_TurbSA_COMP final : public CSourceBase_TurbSA { * \brief Class for integrating the source terms of the Spalart-Allmaras Edwards modification turbulence model equation. * \ingroup SourceDiscr * \author E.Molina, A. Bueno. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSourcePieceWise_TurbSA_E final : public CSourceBase_TurbSA { private: @@ -226,7 +226,7 @@ class CSourcePieceWise_TurbSA_E final : public CSourceBase_TurbSA { * \brief Class for integrating the source terms of the Spalart-Allmaras Edwards modification with CC turbulence model equation. * \ingroup SourceDiscr * \author E.Molina, A. Bueno. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSourcePieceWise_TurbSA_E_COMP : public CSourceBase_TurbSA { private: @@ -305,8 +305,10 @@ class CSourcePieceWise_TurbSST final : public CNumerics { alfa_2, beta_1, beta_2, - sigma_omega_1, - sigma_omega_2, + sigma_k_1, + sigma_k_2, + sigma_w_1, + sigma_w_2, beta_star, a1; @@ -320,12 +322,49 @@ class CSourcePieceWise_TurbSST final : public CNumerics { bool incompressible; bool sustaining_terms; + bool axisymmetric; /*! * \brief A virtual member. Get strain magnitude based on perturbed reynolds stress matrix * \param[in] turb_ke: turbulent kinetic energy of the node */ void SetPerturbedStrainMag(su2double turb_ke); + + /*! + * \brief Add contribution due to axisymmetric formulation to 2D residual + */ + inline void ResidualAxisymmetric(su2double alfa_blended, su2double zeta){ + + if (Coord_i[1] < EPS) return; + + su2double yinv, rhov, k, w; + su2double sigma_k_i, sigma_w_i; + su2double pk_axi, pw_axi, cdk_axi, cdw_axi; + + AD::SetPreaccIn(Coord_i[1]); + + yinv = 1.0/Coord_i[1]; + rhov = Density_i*V_i[2]; + k = TurbVar_i[0]; + w = TurbVar_i[1]; + + /*--- Compute blended constants ---*/ + sigma_k_i = F1_i*sigma_k_1+(1.0-F1_i)*sigma_k_2; + sigma_w_i = F1_i*sigma_w_1+(1.0-F1_i)*sigma_w_2; + + /*--- Production ---*/ + pk_axi = max(0.0,2.0/3.0*rhov*k*(2.0/zeta*(yinv*V_i[2]-PrimVar_Grad_i[2][1]-PrimVar_Grad_i[1][0])-1.0)); + pw_axi = alfa_blended*zeta/k*pk_axi; + + /*--- Convection-Diffusion ---*/ + cdk_axi = rhov*k-(Laminar_Viscosity_i+sigma_k_i*Eddy_Viscosity_i)*TurbVar_Grad_i[0][1]; + cdw_axi = rhov*w-(Laminar_Viscosity_i+sigma_w_i*Eddy_Viscosity_i)*TurbVar_Grad_i[1][1]; + + /*--- Add terms to the residuals ---*/ + Residual[0] += yinv*Volume*(pk_axi-cdk_axi); + Residual[1] += yinv*Volume*(pw_axi-cdw_axi); + + } public: /*! diff --git a/SU2_CFD/include/numerics_simd/CNumericsSIMD.cpp b/SU2_CFD/include/numerics_simd/CNumericsSIMD.cpp index c72222261097..ccc91a7e577d 100644 --- a/SU2_CFD/include/numerics_simd/CNumericsSIMD.cpp +++ b/SU2_CFD/include/numerics_simd/CNumericsSIMD.cpp @@ -4,7 +4,7 @@ * \note This should be the only cpp for this family of classes * (which are all templates). All compilation takes place here. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics_simd/CNumericsSIMD.hpp b/SU2_CFD/include/numerics_simd/CNumericsSIMD.hpp index 893b648f7508..7dbbdb9efa1f 100644 --- a/SU2_CFD/include/numerics_simd/CNumericsSIMD.hpp +++ b/SU2_CFD/include/numerics_simd/CNumericsSIMD.hpp @@ -2,7 +2,7 @@ * \file CNumericsSIMD.hpp * \brief Vectorized (SIMD) numerics classes. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp b/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp index ca0a708256ca..d1180b04466e 100644 --- a/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp +++ b/SU2_CFD/include/numerics_simd/flow/convection/centered.hpp @@ -2,7 +2,7 @@ * \file centered.hpp * \brief Centered convective schemes. * \author P. Gomes, F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics_simd/flow/convection/common.hpp b/SU2_CFD/include/numerics_simd/flow/convection/common.hpp index a1160191d9c4..d05549085bde 100644 --- a/SU2_CFD/include/numerics_simd/flow/convection/common.hpp +++ b/SU2_CFD/include/numerics_simd/flow/convection/common.hpp @@ -2,7 +2,7 @@ * \file common.hpp * \brief Common convection-related methods. * \author P. Gomes, F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics_simd/flow/convection/roe.hpp b/SU2_CFD/include/numerics_simd/flow/convection/roe.hpp index bd875f618ea0..3477ea0f7644 100644 --- a/SU2_CFD/include/numerics_simd/flow/convection/roe.hpp +++ b/SU2_CFD/include/numerics_simd/flow/convection/roe.hpp @@ -2,7 +2,7 @@ * \file roe.hpp * \brief Roe-family of convective schemes. * \author P. Gomes, A. Bueno, F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics_simd/flow/diffusion/common.hpp b/SU2_CFD/include/numerics_simd/flow/diffusion/common.hpp index accad7706507..c6a212c4c6ec 100644 --- a/SU2_CFD/include/numerics_simd/flow/diffusion/common.hpp +++ b/SU2_CFD/include/numerics_simd/flow/diffusion/common.hpp @@ -2,7 +2,7 @@ * \file common.hpp * \brief Helper functions for viscous methods. * \author P. Gomes, C. Pederson, A. Bueno, F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -71,7 +71,7 @@ FORCEINLINE void correctGradient(const PrimitiveType& V, */ template FORCEINLINE MatrixDbl stressTensor(Double viscosity, - const MatrixDbl grad) { + const MatrixDbl& grad) { /*--- Hydrostatic term. ---*/ Double velDiv = 0.0; for (size_t iDim = 0; iDim < nDim; ++iDim) { @@ -154,7 +154,7 @@ FORCEINLINE void addQCR(const MatrixType& grad, MatrixDbl& tau) { */ template FORCEINLINE MatrixDbl stressTensorJacobian(const PrimitiveType& V, - const VectorDbl normal, + const VectorDbl& normal, Double dist_ij) { Double viscosity = V.laminarVisc() + V.eddyVisc(); Double xi = viscosity / (V.density() * dist_ij); diff --git a/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp b/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp index 69801eaae387..020ce7e05ed7 100644 --- a/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp +++ b/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp @@ -2,7 +2,7 @@ * \file viscous_fluxes.hpp * \brief Decorator classes for computation of viscous fluxes. * \author P. Gomes, C. Pederson, A. Bueno, F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics_simd/flow/variables.hpp b/SU2_CFD/include/numerics_simd/flow/variables.hpp index ab270a51c2a5..27dd6b7b3ec9 100644 --- a/SU2_CFD/include/numerics_simd/flow/variables.hpp +++ b/SU2_CFD/include/numerics_simd/flow/variables.hpp @@ -2,7 +2,7 @@ * \file variables.hpp * \brief Collection of types to store physical variables. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/numerics_simd/util.hpp b/SU2_CFD/include/numerics_simd/util.hpp index 3bc993b5929c..785bf894d51e 100644 --- a/SU2_CFD/include/numerics_simd/util.hpp +++ b/SU2_CFD/include/numerics_simd/util.hpp @@ -2,7 +2,7 @@ * \file util.hpp * \brief Generic auxiliary functions. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CAdjElasticityOutput.hpp b/SU2_CFD/include/output/CAdjElasticityOutput.hpp index 4da75e2a0af9..382da9ee2668 100644 --- a/SU2_CFD/include/output/CAdjElasticityOutput.hpp +++ b/SU2_CFD/include/output/CAdjElasticityOutput.hpp @@ -2,7 +2,7 @@ * \file CAdjElasticityOutput.hpp * \brief Headers of the adjoint elasticity output class. * \author T. Albring, R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp index 9f523c0e9818..78fb48a1fdfe 100644 --- a/SU2_CFD/include/output/CAdjFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CAdjFlowIncOutput.hpp @@ -2,7 +2,7 @@ * \file CAdjFlowIncOutput.hpp * \brief Headers of the adjoint incompressible flow output. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CAdjFlowOutput.hpp b/SU2_CFD/include/output/CAdjFlowOutput.hpp index 56c054ecb1d6..6d3e6ccb85a6 100644 --- a/SU2_CFD/include/output/CAdjFlowOutput.hpp +++ b/SU2_CFD/include/output/CAdjFlowOutput.hpp @@ -2,7 +2,7 @@ * \file CAdjFlowCompOutput.hpp * \brief Headers of the adjoint compressible flow output. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CAdjHeatOutput.hpp b/SU2_CFD/include/output/CAdjHeatOutput.hpp index 4da091712c96..1398fd96e556 100644 --- a/SU2_CFD/include/output/CAdjHeatOutput.hpp +++ b/SU2_CFD/include/output/CAdjHeatOutput.hpp @@ -2,7 +2,7 @@ * \file output_fea_discadj.hpp * \brief Headers of the adjoint heat output. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CBaselineOutput.hpp b/SU2_CFD/include/output/CBaselineOutput.hpp index fd0f17b92d46..c2e22dadc0f9 100644 --- a/SU2_CFD/include/output/CBaselineOutput.hpp +++ b/SU2_CFD/include/output/CBaselineOutput.hpp @@ -2,7 +2,7 @@ * \file CBaselineOutput.hpp * \brief Headers of the baseline output. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CElasticityOutput.hpp b/SU2_CFD/include/output/CElasticityOutput.hpp index a8c5ea9a046a..60049187133e 100644 --- a/SU2_CFD/include/output/CElasticityOutput.hpp +++ b/SU2_CFD/include/output/CElasticityOutput.hpp @@ -2,7 +2,7 @@ * \file CElasticityOutput.hpp * \brief Headers of the elasticity output. * \author F. Palacios, T. Economon, M. Colonno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CFlowCompFEMOutput.hpp b/SU2_CFD/include/output/CFlowCompFEMOutput.hpp index ec5c5fbd67e0..d097f9190e12 100644 --- a/SU2_CFD/include/output/CFlowCompFEMOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompFEMOutput.hpp @@ -2,7 +2,7 @@ * \file CFlowCompFEMOutput.hpp * \brief Headers of the compressible FEM flow output. * \author R. Sanchez, T. Albring. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CFlowCompOutput.hpp b/SU2_CFD/include/output/CFlowCompOutput.hpp index 9ce0535959dd..d7370cde9627 100644 --- a/SU2_CFD/include/output/CFlowCompOutput.hpp +++ b/SU2_CFD/include/output/CFlowCompOutput.hpp @@ -2,7 +2,7 @@ * \file CFlowCompOutput.hpp * \brief Headers of the compressible flow output. * \author R. Sanchez, T. Albring. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CFlowIncOutput.hpp b/SU2_CFD/include/output/CFlowIncOutput.hpp index 031343180017..7627b1ee7bc4 100644 --- a/SU2_CFD/include/output/CFlowIncOutput.hpp +++ b/SU2_CFD/include/output/CFlowIncOutput.hpp @@ -2,7 +2,7 @@ * \file CFlowIncCompOutput.hpp * \brief Headers of the incompressible flow output. * \author T. Albring, R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -42,6 +42,8 @@ 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*/ + unsigned short streamwisePeriodic; /*!< \brief Boolean indicating whether it is a streamwise periodic simulation. */ + bool streamwisePeriodic_temperature; /*!< \brief Boolean indicating streamwise periodic temperature is used. */ public: diff --git a/SU2_CFD/include/output/CFlowOutput.hpp b/SU2_CFD/include/output/CFlowOutput.hpp index 01ba58bd2ae3..3571d3e8032e 100644 --- a/SU2_CFD/include/output/CFlowOutput.hpp +++ b/SU2_CFD/include/output/CFlowOutput.hpp @@ -2,7 +2,7 @@ * \file CFlowOutput.hpp * \brief Headers of the flow output. * \author F. Palacios, T. Economon, M. Colonno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CHeatOutput.hpp b/SU2_CFD/include/output/CHeatOutput.hpp index 69ac423ccc71..616562e736eb 100644 --- a/SU2_CFD/include/output/CHeatOutput.hpp +++ b/SU2_CFD/include/output/CHeatOutput.hpp @@ -2,7 +2,7 @@ * \file CHeatOutput.hpp * \brief Headers of the heat output. * \author R. Sanchez, T. Albring. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CMeshOutput.hpp b/SU2_CFD/include/output/CMeshOutput.hpp index 68e0b37ffaa2..39d071c41d47 100644 --- a/SU2_CFD/include/output/CMeshOutput.hpp +++ b/SU2_CFD/include/output/CMeshOutput.hpp @@ -2,7 +2,7 @@ * \file CMeshOutput.hpp * \brief Headers of the mesh output. * \author R. Sanchez, T. Albring. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CMultizoneOutput.hpp b/SU2_CFD/include/output/CMultizoneOutput.hpp index 380660081867..65c088e576a9 100644 --- a/SU2_CFD/include/output/CMultizoneOutput.hpp +++ b/SU2_CFD/include/output/CMultizoneOutput.hpp @@ -2,7 +2,7 @@ * \file CDriverOutput.hpp * \brief Headers of the main subroutines for screen and history output in multizone problems. * \author R. Sanchez, T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/CNEMOCompOutput.hpp b/SU2_CFD/include/output/CNEMOCompOutput.hpp index 47a43ea9c4c4..1458757833a6 100644 --- a/SU2_CFD/include/output/CNEMOCompOutput.hpp +++ b/SU2_CFD/include/output/CNEMOCompOutput.hpp @@ -2,7 +2,7 @@ * \file CNEMOCompOutput.hpp * \brief Headers of the compressible flow output. * \author R. Sanchez, W. Maier. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/COutput.hpp b/SU2_CFD/include/output/COutput.hpp index 7f9f3161a800..88358c8726ec 100644 --- a/SU2_CFD/include/output/COutput.hpp +++ b/SU2_CFD/include/output/COutput.hpp @@ -2,7 +2,7 @@ * \file COutput.hpp * \brief Headers of the output class. * \author T.Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/COutputFactory.hpp b/SU2_CFD/include/output/COutputFactory.hpp index 75a435b7f5b2..ece08e8d8df9 100644 --- a/SU2_CFD/include/output/COutputFactory.hpp +++ b/SU2_CFD/include/output/COutputFactory.hpp @@ -2,7 +2,7 @@ * \file COutput.hpp * \brief Headers of the output class. * \author T.Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/COutputLegacy.hpp b/SU2_CFD/include/output/COutputLegacy.hpp index 17935f935ef5..48d1a7367d47 100644 --- a/SU2_CFD/include/output/COutputLegacy.hpp +++ b/SU2_CFD/include/output/COutputLegacy.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines for generating the file outputs. * The subroutines and functions are in the output_structure.cpp file. * \author F. Palacios, T. Economon, M. Colonno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp b/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp index 7e3955a9aed9..64eda923292e 100644 --- a/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp @@ -2,7 +2,7 @@ * \file CCSVFileWriter.hpp * \brief Headers fo the CSV file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp index 78450d3b5ef1..8a241f5c6f36 100644 --- a/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp @@ -2,7 +2,7 @@ * \file CFEMDataSorter.hpp * \brief Headers fo the FEM data sorter class. * \author T. Albring, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp index f0facc901307..791701a8210f 100644 --- a/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp @@ -2,7 +2,7 @@ * \file CFVMDataSorter.hpp * \brief Headers fo the FVM data sorter class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CFileWriter.hpp b/SU2_CFD/include/output/filewriter/CFileWriter.hpp index 542a0b2b285b..5734841ffecc 100644 --- a/SU2_CFD/include/output/filewriter/CFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CFileWriter.hpp @@ -2,7 +2,7 @@ * \file CFileWriter.hpp * \brief Headers fo the file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp index 1cfc9f7a83e8..5b35820c5c77 100644 --- a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp @@ -2,7 +2,7 @@ * \file CParallelDataSorter.hpp * \brief Headers fo the data sorter class. * \author T. Albring, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp b/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp index fe46ac6eab70..d25f8641481b 100644 --- a/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CParaviewBinaryFileWriter.hpp @@ -2,7 +2,7 @@ * \file CParaviewBinaryFileWriter.hpp * \brief Headers fo paraview binary file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp b/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp index 3bdf3db11b55..bfe1bd69a978 100644 --- a/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp @@ -2,7 +2,7 @@ * \file CParaviewFileWriter.hpp * \brief Headers fo the paraview file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CParaviewVTMFileWriter.hpp b/SU2_CFD/include/output/filewriter/CParaviewVTMFileWriter.hpp index 9a1408fa88b4..c37cc7558b63 100644 --- a/SU2_CFD/include/output/filewriter/CParaviewVTMFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CParaviewVTMFileWriter.hpp @@ -2,7 +2,7 @@ * \file CParaviewVTMFileWriter.hpp * \brief Headers fo paraview binary file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CParaviewXMLFileWriter.hpp b/SU2_CFD/include/output/filewriter/CParaviewXMLFileWriter.hpp index bc91a53bf19e..25890ed10955 100644 --- a/SU2_CFD/include/output/filewriter/CParaviewXMLFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CParaviewXMLFileWriter.hpp @@ -2,7 +2,7 @@ * \file CParaviewXMLFileWriter.hpp * \brief Headers fo paraview binary file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CSTLFileWriter.hpp b/SU2_CFD/include/output/filewriter/CSTLFileWriter.hpp index 868e3d3bec74..94438058cb8b 100644 --- a/SU2_CFD/include/output/filewriter/CSTLFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CSTLFileWriter.hpp @@ -2,7 +2,7 @@ * \file CSTLFileWriter.hpp * \brief Headers fo the STL file writer class. * \author T. Kattmann, T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -33,7 +33,7 @@ * \class CSTLFileWriter * \brief Class for writing STL output files. * \author T. Kattmann, T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSTLFileWriter final : public CFileWriter{ private: diff --git a/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp b/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp index 2b2d3cd1cb12..ec9bed7a15d9 100644 --- a/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CSU2BinaryFileWriter.hpp @@ -2,7 +2,7 @@ * \file CSU2BinaryFileWriter.hpp * \brief Headers fo the SU2 binary file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp b/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp index c33f3a719618..0b5252b6035a 100644 --- a/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CSU2FileWriter.hpp @@ -2,7 +2,7 @@ * \file CSU2FileWriter.hpp * \brief Headers fo the CSV file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp b/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp index 05e35420a6e2..5f35f4226058 100644 --- a/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CSU2MeshFileWriter.hpp @@ -2,7 +2,7 @@ * \file CSU2MeshFileWriter.hpp * \brief Headers fo the CSV file writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp index be26c5157284..4c0f4bf722e5 100644 --- a/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CSurfaceFEMDataSorter.hpp @@ -2,7 +2,7 @@ * \file CSurfaceFEMDataSorter.hpp * \brief Headers fo the surface FEM data sorter class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp b/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp index 79e59827bfac..3eafd7a2cc00 100644 --- a/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CSurfaceFVMDataSorter.hpp @@ -2,7 +2,7 @@ * \file CSurfaceFVMDataSorter.hpp * \brief Headers for the surface FVM data sorter class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp b/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp index 1cf0690e6f44..5b6b1d0ada3a 100644 --- a/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CTecplotBinaryFileWriter.hpp @@ -2,7 +2,7 @@ * \file CTecplotBinaryFileWriter.hpp * \brief Headers fo the tecplot binary writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp b/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp index c69d1a748dd9..20d48810f593 100644 --- a/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp +++ b/SU2_CFD/include/output/filewriter/CTecplotFileWriter.hpp @@ -2,7 +2,7 @@ * \file CTecplotFileWriter.hpp * \brief Headers fo the tecplot ASCII writer class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/output/tools/CWindowingTools.hpp b/SU2_CFD/include/output/tools/CWindowingTools.hpp index 6a86139cee5a..f5d0649b0312 100644 --- a/SU2_CFD/include/output/tools/CWindowingTools.hpp +++ b/SU2_CFD/include/output/tools/CWindowingTools.hpp @@ -2,7 +2,7 @@ * \file signal_processing_toolbox.hpp * \brief Header file for the signal processing toolbox. * \author S. Schotthöfer - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/sgs_model.hpp b/SU2_CFD/include/sgs_model.hpp index 6f6be007616a..280888428014 100644 --- a/SU2_CFD/include/sgs_model.hpp +++ b/SU2_CFD/include/sgs_model.hpp @@ -2,7 +2,7 @@ * \file sgs_model.hpp * \brief Headers of the LES subgrid scale models of the SU2 solvers. * \author E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -38,7 +38,7 @@ using namespace std; * \class CSGSModel * \brief Base class for defining the LES subgrid scale model. * \author: E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSGSModel { @@ -224,7 +224,7 @@ class CSGSModel { * \class CSmagorinskyModel * \brief Derived class for defining the Smagorinsky SGS model. * \author: E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CSmagorinskyModel : public CSGSModel { @@ -413,7 +413,7 @@ class CSmagorinskyModel : public CSGSModel { * \class CWALEModel * \brief Derived class for defining the WALE SGS model. * \author: E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CWALEModel : public CSGSModel { @@ -601,7 +601,7 @@ class CWALEModel : public CSGSModel { * \class CVremanModel * \brief Derived class for defining the WALE SGS model. * \author: E. van der Weide, T. Economon, P. Urbanczyk, E. Molina - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CVremanModel : public CSGSModel { diff --git a/SU2_CFD/include/sgs_model.inl b/SU2_CFD/include/sgs_model.inl index fb65720077a5..74023039c06b 100644 --- a/SU2_CFD/include/sgs_model.inl +++ b/SU2_CFD/include/sgs_model.inl @@ -2,11 +2,11 @@ * \file sgs_model.inl * \brief In-Line subroutines of the sgs_model.hpp file. * \author E. van der Weide, T. Economon, P. Urbanczyk - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * - * The SU2 Project is maintained by the SU2 Foundation + * The SU2 Project is maintained by the SU2 Foundation * (http://su2foundation.org) * * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) @@ -191,8 +191,7 @@ inline void CSmagorinskyModel::ComputeGradEddyViscosity_2D(const su2double rho, const su2double distToWall, su2double &dMuTdx, su2double &dMuTdy) { - cout << "CSmagorinskyModel::ComputeGradEddyViscosity_2D: Not implemented yet" << endl; - exit(1); + SU2_MPI::Error("Not implemented yet", CURRENT_FUNCTION); } inline void CSmagorinskyModel::ComputeGradEddyViscosity_3D(const su2double rho, @@ -231,8 +230,7 @@ inline void CSmagorinskyModel::ComputeGradEddyViscosity_3D(const su2double rho, su2double &dMuTdx, su2double &dMuTdy, su2double &dMuTdz) { - cout << "CSmagorinskyModel::ComputeGradEddyViscosity_3D: Not implemented yet" << endl; - exit(1); + SU2_MPI::Error("Not implemented yet", CURRENT_FUNCTION); } inline CWALEModel::CWALEModel(void) : CSGSModel() { @@ -363,8 +361,7 @@ inline void CWALEModel::ComputeGradEddyViscosity_2D(const su2double rho, const su2double distToWall, su2double &dMuTdx, su2double &dMuTdy) { - cout << "CWALEModel::ComputeGradEddyViscosity_2D: Not implemented yet" << endl; - exit(1); + SU2_MPI::Error("Not implemented yet", CURRENT_FUNCTION); } inline void CWALEModel::ComputeGradEddyViscosity_3D(const su2double rho, @@ -403,12 +400,11 @@ inline void CWALEModel::ComputeGradEddyViscosity_3D(const su2double rho, su2double &dMuTdx, su2double &dMuTdy, su2double &dMuTdz) { - cout << "CWALEModel::ComputeGradEddyViscosity_3D: Not implemented yet" << endl; - exit(1); + SU2_MPI::Error("Not implemented yet", CURRENT_FUNCTION); } inline CVremanModel::CVremanModel(void) : CSGSModel() { - + /* const_Vreman = 2.5*Cs*Cs where Cs is the Smagorinsky constant */ const_Vreman = 0.07; } @@ -422,8 +418,8 @@ inline su2double CVremanModel::ComputeEddyViscosity_2D(const su2double rho, const su2double dvdy, const su2double lenScale, const su2double distToWall) { - cout << "CVremanModel::ComputeEddyViscosity_2D: Not implemented yet" << endl; - exit(1); + SU2_MPI::Error("Not implemented yet", CURRENT_FUNCTION); + return 0; } inline su2double CVremanModel::ComputeEddyViscosity_3D(const su2double rho, @@ -438,7 +434,7 @@ inline su2double CVremanModel::ComputeEddyViscosity_3D(const su2double rho, const su2double dwdz, const su2double lenScale, const su2double distToWall) { - + su2double alpha11 = dudx; su2double alpha22 = dvdy; su2double alpha33 = dwdz; @@ -495,8 +491,7 @@ inline void CVremanModel::ComputeGradEddyViscosity_2D(const su2double rho, const su2double distToWall, su2double &dMuTdx, su2double &dMuTdy) { - cout << "CWALEModel::ComputeGradEddyViscosity_2D: Not implemented yet" << endl; - exit(1); + SU2_MPI::Error("Not implemented yet", CURRENT_FUNCTION); } inline void CVremanModel::ComputeGradEddyViscosity_3D(const su2double rho, @@ -535,6 +530,5 @@ inline void CVremanModel::ComputeGradEddyViscosity_3D(const su2double rho, su2double &dMuTdx, su2double &dMuTdy, su2double &dMuTdz) { - cout << "CWALEModel::ComputeGradEddyViscosity_3D: Not implemented yet" << endl; - exit(1); + SU2_MPI::Error("Not implemented yet", CURRENT_FUNCTION); } diff --git a/SU2_CFD/include/solvers/CAdjEulerSolver.hpp b/SU2_CFD/include/solvers/CAdjEulerSolver.hpp index b6a41031e7a8..c87b3af17715 100644 --- a/SU2_CFD/include/solvers/CAdjEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CAdjEulerSolver.hpp @@ -2,7 +2,7 @@ * \file CAdjEulerSolver.hpp * \brief Headers of the CAdjEulerSolver class * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -230,13 +230,6 @@ class CAdjEulerSolver : public CSolver { CConfig *config, unsigned short iMesh) final; - /*! - * \brief Compute the undivided laplacian for the adjoint solution. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - */ - void SetUndivided_Laplacian(CGeometry *geometry, CConfig *config); - /*! * \brief Value of the characteristic variables at the boundaries. * \param[in] val_marker - Surface marker where the coefficient is computed. diff --git a/SU2_CFD/include/solvers/CAdjNSSolver.hpp b/SU2_CFD/include/solvers/CAdjNSSolver.hpp index 259886e6ade8..98adceed6770 100644 --- a/SU2_CFD/include/solvers/CAdjNSSolver.hpp +++ b/SU2_CFD/include/solvers/CAdjNSSolver.hpp @@ -2,7 +2,7 @@ * \file CAdjNSSolver.hpp * \brief Headers of the CAdjNSSolver class * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CAdjTurbSolver.hpp b/SU2_CFD/include/solvers/CAdjTurbSolver.hpp index 021f2ae36062..459d5039e1ad 100644 --- a/SU2_CFD/include/solvers/CAdjTurbSolver.hpp +++ b/SU2_CFD/include/solvers/CAdjTurbSolver.hpp @@ -2,7 +2,7 @@ * \file CAdjTurbSolver.hpp * \brief Headers of the CAdjTurbSolver class * \author F. Palacios, A. Bueno. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CBaselineSolver.hpp b/SU2_CFD/include/solvers/CBaselineSolver.hpp index 69aeb6665fc5..29fdec3c5b54 100644 --- a/SU2_CFD/include/solvers/CBaselineSolver.hpp +++ b/SU2_CFD/include/solvers/CBaselineSolver.hpp @@ -2,7 +2,7 @@ * \file CBaslineSolver.hpp * \brief Headers of the CBaselineSolver class * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CBaselineSolver_FEM.hpp b/SU2_CFD/include/solvers/CBaselineSolver_FEM.hpp index 12c2f848ddb9..38ef3b20bdb8 100644 --- a/SU2_CFD/include/solvers/CBaselineSolver_FEM.hpp +++ b/SU2_CFD/include/solvers/CBaselineSolver_FEM.hpp @@ -2,7 +2,7 @@ * \file CBaslineSolver_FEM.hpp * \brief Headers of the CBaselineSolver class * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -31,7 +31,7 @@ * \class CBaselineSolver_FEM * \brief Main class for defining a baseline solution from a restart file for the DG-FEM solver output. * \author T. Economon. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CBaselineSolver_FEM final : public CSolver { protected: diff --git a/SU2_CFD/include/solvers/CDiscAdjFEASolver.hpp b/SU2_CFD/include/solvers/CDiscAdjFEASolver.hpp index 6824d0bc6040..8777a720b1f1 100644 --- a/SU2_CFD/include/solvers/CDiscAdjFEASolver.hpp +++ b/SU2_CFD/include/solvers/CDiscAdjFEASolver.hpp @@ -2,7 +2,7 @@ * \file CDiscAdjFEASolver.hpp * \brief Headers of the CDiscAdjFEASolver class * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp b/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp index d5e5882cf500..cc557b4af93a 100644 --- a/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp +++ b/SU2_CFD/include/solvers/CDiscAdjMeshSolver.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to compute the * the discrete adjoint of the linear-elastic mesh solver. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CDiscAdjSolver.hpp b/SU2_CFD/include/solvers/CDiscAdjSolver.hpp index f561cbae26a5..c5b5dcd41382 100644 --- a/SU2_CFD/include/solvers/CDiscAdjSolver.hpp +++ b/SU2_CFD/include/solvers/CDiscAdjSolver.hpp @@ -2,7 +2,7 @@ * \file CDiscAdjSolver.hpp * \brief Headers of the CDiscAdjSolver class * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 2c8efec9691c..8780d54b52c1 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -2,7 +2,7 @@ * \file CEulerSolver.hpp * \brief Headers of the CEulerSolver class * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -37,46 +37,44 @@ */ class CEulerSolver : public CFVMFlowSolverBase { protected: + using BaseClass = CFVMFlowSolverBase; + su2double Prandtl_Lam = 0.0, /*!< \brief Laminar Prandtl number. */ Prandtl_Turb = 0.0; /*!< \brief Turbulent Prandtl number. */ + su2double AllBound_CEquivArea_Inv=0.0; /*!< \brief equivalent area coefficient (inviscid contribution) for all the boundaries. */ + vector CEquivArea_Mnt; /*!< \brief Equivalent area (inviscid contribution) for each boundary. */ + vector CEquivArea_Inv; /*!< \brief Equivalent area (inviscid contribution) for each boundary. */ + + vector Inflow_MassFlow; /*!< \brief Mass flow rate for each boundary. */ + vector Exhaust_MassFlow; /*!< \brief Mass flow rate for each boundary. */ + vector Inflow_Pressure; /*!< \brief Fan face pressure for each boundary. */ + vector Inflow_Mach; /*!< \brief Fan face mach number for each boundary. */ + vector Inflow_Area; /*!< \brief Boundary total area. */ + vector Exhaust_Area; /*!< \brief Boundary total area. */ + vector Exhaust_Pressure; /*!< \brief Fan face pressure for each boundary. */ + vector Exhaust_Temperature; /*!< \brief Fan face mach number for each boundary. */ su2double - AllBound_CEquivArea_Inv = 0.0, /*!< \brief equivalent area coefficient (inviscid contribution) for all the boundaries. */ - *CEquivArea_Mnt = nullptr, /*!< \brief Equivalent area (inviscid contribution) for each boundary. */ - *CEquivArea_Inv = nullptr; /*!< \brief Equivalent area (inviscid contribution) for each boundary. */ - - su2double - *Inflow_MassFlow = nullptr, /*!< \brief Mass flow rate for each boundary. */ - *Exhaust_MassFlow = nullptr, /*!< \brief Mass flow rate for each boundary. */ - *Inflow_Pressure = nullptr, /*!< \brief Fan face pressure for each boundary. */ - *Inflow_Mach = nullptr, /*!< \brief Fan face mach number for each boundary. */ - *Inflow_Area = nullptr, /*!< \brief Boundary total area. */ - *Exhaust_Area = nullptr, /*!< \brief Boundary total area. */ - *Exhaust_Pressure = nullptr, /*!< \brief Fan face pressure for each boundary. */ - *Exhaust_Temperature = nullptr,/*!< \brief Fan face mach number for each boundary. */ Inflow_MassFlow_Total = 0.0, /*!< \brief Mass flow rate for each boundary. */ Exhaust_MassFlow_Total = 0.0, /*!< \brief Mass flow rate for each boundary. */ Inflow_Pressure_Total = 0.0, /*!< \brief Fan face pressure for each boundary. */ Inflow_Mach_Total = 0.0, /*!< \brief Fan face mach number for each boundary. */ InverseDesign = 0.0; /*!< \brief Inverse design functional for each boundary. */ - unsigned long - **DonorGlobalIndex = nullptr; /*!< \brief Value of the donor global index. */ - su2double - ***DonorPrimVar = nullptr, /*!< \brief Value of the donor variables at each boundary. */ - **ActDisk_DeltaP = nullptr, /*!< \brief Value of the Delta P. */ - **ActDisk_DeltaT = nullptr; /*!< \brief Value of the Delta T. */ + vector > DonorGlobalIndex; /*!< \brief Value of the donor global index. */ + vector DonorPrimVar; /*!< \brief Value of the donor variables at each boundary. */ + vector > ActDisk_DeltaP; /*!< \brief Value of the Delta P. */ + vector > ActDisk_DeltaT; /*!< \brief Value of the Delta T. */ su2activevector ActDisk_R; /*!< \brief Value of the actuator disk Radius. */ su2activematrix ActDisk_C, /*!< \brief Value of the actuator disk Center. */ ActDisk_Axis; /*!< \brief Value of the actuator disk Axis. */ - su2double - **ActDisk_Fa, /*!< \brief Value of the actuator disk Axial Force per Unit Area. */ - **ActDisk_Fx, /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */ - **ActDisk_Fy, /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */ - **ActDisk_Fz; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fa; /*!< \brief Value of the actuator disk Axial Force per Unit Area. */ + vector > ActDisk_Fx; /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fy; /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fz; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */ su2double Total_CL_Prev = 0.0, /*!< \brief Total lift coefficient for all the boundaries (fixed lift mode). */ @@ -114,11 +112,6 @@ class CEulerSolver : public CFVMFlowSolverBase { vector FluidModel; /*!< \brief fluid model used in the solver. */ - unsigned long ErrorCounter = 0; /*!< \brief Counter for number of un-physical states. */ - - su2double Global_Delta_Time = 0.0, /*!< \brief Time-step for TIME_STEPPING time marching strategy. */ - Global_Delta_UnstTimeND = 0.0; /*!< \brief Unsteady time step for the dual time strategy. */ - /*--- Turbomachinery Solver Variables ---*/ su2double ***AverageFlux = nullptr, @@ -160,12 +153,6 @@ class CEulerSolver : public CFVMFlowSolverBase { /*--- End of Turbomachinery Solver Variables ---*/ - /*! - * \brief Generic implementation of explicit iterations (RK, Classic RK and EULER). - */ - template - void Explicit_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep); - /*! * \brief Preprocessing actions common to the Euler and NS solvers. * \param[in] geometry - Geometrical definition of the problem. @@ -239,7 +226,7 @@ class CEulerSolver : public CFVMFlowSolverBase { * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. */ - void SetMax_Eigenvalue(CGeometry *geometry, CConfig *config); + void SetMax_Eigenvalue(CGeometry *geometry, const CConfig *config); /*! * \brief Compute the undivided laplacian for the solution. @@ -266,11 +253,10 @@ class CEulerSolver : public CFVMFlowSolverBase { * \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. */ virtual unsigned long SetPrimitive_Variables(CSolver **solver_container, - CConfig *config, bool Output); + const CConfig *config); /*! * \brief Set gradients of coefficients for fixed CL mode @@ -285,6 +271,13 @@ class CEulerSolver : public CFVMFlowSolverBase { */ void InstantiateEdgeNumerics(const CSolver* const* solvers, const CConfig* config) final; + /*! + * \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); + public: /*! * \brief Constructor of the class. @@ -305,13 +298,6 @@ class CEulerSolver : public CFVMFlowSolverBase { */ ~CEulerSolver(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 pressure at the infinity. * \return Value of the pressure at the infinity. @@ -362,20 +348,6 @@ class CEulerSolver : public CFVMFlowSolverBase { CConfig *config, unsigned short iMesh) final; - /*! - * \brief Compute the viscous contribution for a particular edge. - * \note The convective residual methods include a call to this for each edge, - * this allows convective and viscous loops to be "fused". - * \param[in] iEdge - Edge for which the flux and Jacobians are to be computed. - * \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. - */ - inline virtual void Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, - CNumerics *numerics, CConfig *config) { } - using CSolver::Viscous_Residual; /*--- Silence warning ---*/ - /*! * \brief Recompute the extrapolated quantities, after MUSCL reconstruction, * in a more thermodynamically consistent way. @@ -459,8 +431,7 @@ class CEulerSolver : public CFVMFlowSolverBase { * \param[in,out] preconditioner - The preconditioner matrix, must be allocated outside. */ void SetPreconditioner(const CConfig *config, unsigned long iPoint, - su2double delta, su2double** preconditioner) const; - using CSolver::SetPreconditioner; /*--- Silence warning. ---*/ + su2double delta, su2activematrix& preconditioner) const; /*! * \brief Parallelization of Undivided Laplacian. @@ -824,14 +795,18 @@ class CEulerSolver : public CFVMFlowSolverBase { CConfig *config) final; /*! - * \brief Update the solution using an implicit Euler scheme. + * \brief Prepare an implicit iteration. * \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; + void PrepareImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) final; + + /*! + * \brief Complete an implicit iteration. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void CompleteImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) final; /*! * \brief Provide the mass flow rate. @@ -1084,36 +1059,6 @@ class CEulerSolver : public CFVMFlowSolverBase { */ void UpdateCustomBoundaryConditions(CGeometry **geometry_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. @@ -1130,7 +1075,7 @@ class CEulerSolver : public CFVMFlowSolverBase { * \brief Set the solution using the Freestream values. * \param[in] config - Definition of the particular problem. */ - void SetFreeStream_Solution(CConfig *config) final; + void SetFreeStream_Solution(const CConfig *config) final; /*! * \brief Initilize turbo containers. @@ -1656,7 +1601,7 @@ class CEulerSolver : public CFVMFlowSolverBase { void PrintVerificationError(const CConfig* config) const final; /*! - * \brief The Euler and NS solvers support MPI+OpenMP (except the BC bits). + * \brief The Euler and NS solvers support MPI+OpenMP. */ inline bool GetHasHybridParallel() const final { return true; } diff --git a/SU2_CFD/include/solvers/CFEASolver.hpp b/SU2_CFD/include/solvers/CFEASolver.hpp index 09ff0d00a05a..927be283cbd6 100644 --- a/SU2_CFD/include/solvers/CFEASolver.hpp +++ b/SU2_CFD/include/solvers/CFEASolver.hpp @@ -2,7 +2,7 @@ * \file CFEASolver.hpp * \brief Finite element solver for elasticity problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -69,6 +69,7 @@ class CFEASolver : public CSolver { su2double Total_OFVolFrac; /*!< \brief Total Objective Function: Volume fraction (topology optimization). */ su2double Total_OFDiscreteness; /*!< \brief Total Objective Function: Discreteness (topology optimization). */ su2double Total_OFCompliance; /*!< \brief Total Objective Function: Compliance (topology optimization). */ + su2double Total_OFStressPenalty; /*!< \brief Total Objective Function: Stress penalty. */ su2double ObjFunc; su2double Global_OFRefGeom; /*!< \brief Global Objective Function (added over time steps): Reference Geometry. */ @@ -313,7 +314,7 @@ class CFEASolver : public CSolver { * \param[in] numerics - Description of the numerical method. * \param[in] config - Definition of the particular problem. */ - void Compute_MassMatrix(CGeometry *geometry, + void Compute_MassMatrix(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) final; @@ -323,7 +324,7 @@ class CFEASolver : public CSolver { * \param[in] numerics - Description of the numerical method. * \param[in] config - Definition of the particular problem. */ - void Compute_MassRes(CGeometry *geometry, + void Compute_MassRes(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) final; @@ -471,7 +472,7 @@ class CFEASolver : public CSolver { * \param[in] numerics - Numerical methods. * \param[in] config - Definition of the particular problem. */ - void ImplicitNewmark_Iteration(CGeometry *geometry, + void ImplicitNewmark_Iteration(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) final; @@ -480,14 +481,14 @@ class CFEASolver : public CSolver { * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. */ - void ImplicitNewmark_Update(CGeometry *geometry, CConfig *config) final; + void ImplicitNewmark_Update(const CGeometry *geometry, const CConfig *config) final; /*! * \brief A virtual member. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. */ - void ImplicitNewmark_Relaxation(CGeometry *geometry, CConfig *config) final; + void ImplicitNewmark_Relaxation(const CGeometry *geometry, const CConfig *config) final; /*! * \brief Iterate using an implicit Generalized Alpha solver. @@ -495,7 +496,7 @@ class CFEASolver : public CSolver { * \param[in] numerics - Numerical methods. * \param[in] config - Definition of the particular problem. */ - void GeneralizedAlpha_Iteration(CGeometry *geometry, + void GeneralizedAlpha_Iteration(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) final; @@ -504,21 +505,21 @@ class CFEASolver : public CSolver { * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. */ - void GeneralizedAlpha_UpdateDisp(CGeometry *geometry, CConfig *config) final; + void GeneralizedAlpha_UpdateDisp(const CGeometry *geometry, const CConfig *config) final; /*! * \brief Update the solution using an implicit Generalized Alpha solver. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. */ - void GeneralizedAlpha_UpdateSolution(CGeometry *geometry, CConfig *config) final; + void GeneralizedAlpha_UpdateSolution(const CGeometry *geometry, const CConfig *config) final; /*! * \brief Update the solution using an implicit Generalized Alpha solver. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. */ - void GeneralizedAlpha_UpdateLoads(CGeometry *geometry, const CConfig *config) final; + void GeneralizedAlpha_UpdateLoads(const CGeometry *geometry, const CConfig *config) final; /*! * \brief Postprocessing. @@ -546,7 +547,6 @@ class CFEASolver : public CSolver { /*! * \brief Provide the maximum Von Mises Stress for structural analysis. - * \return Value of the maximum Von Mises Stress. */ inline su2double GetTotal_CFEA(void) const final { return Total_CFEA; } @@ -572,10 +572,14 @@ class CFEASolver : public CSolver { /*! * \brief Retrieve the value of the structural compliance objective function - * \return Value of the objective function. */ inline su2double GetTotal_OFCompliance(void) const final { return Total_OFCompliance; } + /*! + * \brief Retrieve the value of the stress penalty objective function + */ + inline su2double GetTotal_OFStressPenalty(void) const final { return Total_OFStressPenalty; } + /*! * \brief Compute the objective function. * \param[in] config - Definition of the problem. @@ -598,6 +602,9 @@ class CFEASolver : public CSolver { case TOPOL_DISCRETENESS: ObjFunc = GetTotal_OFDiscreteness(); break; + case STRESS_PENALTY: + ObjFunc = GetTotal_OFStressPenalty(); + break; } } diff --git a/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp b/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp index aa41b64a18f9..74f22ab79506 100644 --- a/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp +++ b/SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp @@ -2,7 +2,7 @@ * \file CFEM_DG_EulerSolver.hpp * \brief Headers of the CFEM_DG_EulerSolver class * \author E. van der Weide, T. Economon, J. Alonso - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -35,7 +35,7 @@ * \brief Main class for defining the Euler Discontinuous Galerkin finite element flow solver. * \ingroup Euler_Equations * \author E. van der Weide, T. Economon, J. Alonso - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEM_DG_EulerSolver : public CSolver { protected: @@ -92,6 +92,7 @@ class CFEM_DG_EulerSolver : public CSolver { AllBound_CEff_Inv; /*!< \brief Total efficiency (Cl/Cd) (inviscid contribution) for all the boundaries. */ su2double + AeroCoeffForceRef, /*!< \brief Reference force for coefficients */ Total_CL, /*!< \brief Total lift coefficient for all the boundaries. */ Total_CD, /*!< \brief Total drag coefficient for all the boundaries. */ Total_CSF, /*!< \brief Total sideforce coefficient for all the boundaries. */ @@ -306,7 +307,6 @@ class CFEM_DG_EulerSolver : public CSolver { void SetNondimensionalization(CConfig *config, unsigned short iMesh, const bool writeOutput); - using CSolver::SetNondimensionalization; /*! * \brief Get a pointer to the vector of the solution degrees of freedom. @@ -1128,6 +1128,11 @@ class CFEM_DG_EulerSolver : public CSolver { */ inline void SetTotal_CL(su2double val_Total_CL) final { Total_CL = val_Total_CL; } + /*! + * \brief Get the reference force used to compute CL, CD, etc. + */ + inline su2double GetAeroCoeffsReferenceForce() const final { return AeroCoeffForceRef; } + /*! * \brief Provide the total (inviscid + viscous) non dimensional lift coefficient. * \return Value of the lift coefficient (inviscid + viscous contribution). diff --git a/SU2_CFD/include/solvers/CFEM_DG_NSSolver.hpp b/SU2_CFD/include/solvers/CFEM_DG_NSSolver.hpp index 65d8f336a01a..31e44bf29c53 100644 --- a/SU2_CFD/include/solvers/CFEM_DG_NSSolver.hpp +++ b/SU2_CFD/include/solvers/CFEM_DG_NSSolver.hpp @@ -2,7 +2,7 @@ * \file CFEM_DG_NSSolver.hpp * \brief Headers of the CFEM_DG_NSSolver class * \author E. van der Weide, T. Economon, J. Alonso - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -35,7 +35,7 @@ * \brief Main class for defining the Navier-Stokes Discontinuous Galerkin finite element flow solver. * \ingroup Navier_Stokes_Equations * \author E. van der Weide, T. Economon, J. Alonso - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEM_DG_NSSolver final : public CFEM_DG_EulerSolver { private: diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index 75492c114085..acb1135c426e 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -1,7 +1,7 @@ /*! * \file CFVMFlowSolverBase.hpp * \brief Base class template for all FVM flow solvers. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -56,6 +56,11 @@ class CFVMFlowSolverBase : public CSolver { su2double StrainMag_Max; /*!< \brief Maximum Strain Rate magnitude. */ su2double Omega_Max; /*!< \brief Maximum Omega. */ + su2double Global_Delta_Time = 0.0, /*!< \brief Time-step for TIME_STEPPING time marching strategy. */ + Global_Delta_UnstTimeND = 0.0; /*!< \brief Unsteady time step for the dual time strategy. */ + + unsigned long ErrorCounter = 0; /*!< \brief Counter for number of un-physical states. */ + /*! * \brief Auxilary types to store common aero coefficients (avoids repeating oneself so much). */ @@ -120,6 +125,8 @@ class CFVMFlowSolverBase : public CSolver { AeroCoeffsArray SurfaceCoeff; /*!< \brief Totals for each monitoring surface. */ AeroCoeffs TotalCoeff; /*!< \brief Totals for all boundaries. */ + su2double AeroCoeffForceRef = 1.0; /*!< \brief Reference force for aerodynamic coefficients. */ + su2double InverseDesign = 0.0; /*!< \brief Inverse design functional for each boundary. */ su2double Total_ComboObj = 0.0; /*!< \brief Total 'combo' objective for all monitored boundaries */ su2double Total_Custom_ObjFunc = 0.0; /*!< \brief Total custom objective function for all the boundaries. */ @@ -130,28 +137,28 @@ class CFVMFlowSolverBase : public CSolver { su2double Total_Heat = 0.0; /*!< \brief Total heat load for all the boundaries. */ su2double Total_MaxHeat = 0.0; /*!< \brief Maximum heat flux on all boundaries. */ su2double AllBound_CNearFieldOF_Inv = 0.0; /*!< \brief Near-Field press coeff (inviscid) for all the boundaries. */ - su2double* CNearFieldOF_Inv = nullptr; /*!< \brief Near field pressure (inviscid) for each boundary. */ - su2double* Surface_HF_Visc = nullptr; /*!< \brief Total (integrated) heat flux for each monitored surface. */ - su2double* Surface_MaxHF_Visc = nullptr; /*!< \brief Maximum heat flux for each monitored surface. */ - su2double* HF_Visc = nullptr; /*!< \brief Heat load (viscous contribution) for each boundary. */ - su2double* MaxHF_Visc = nullptr; /*!< \brief Maximum heat flux (viscous contribution) for each boundary. */ - su2double AllBound_HF_Visc = 0.0; /*!< \brief Heat load (viscous contribution) for all the boundaries. */ - su2double AllBound_MaxHF_Visc = 0.0; /*!< \brief Maximum heat flux (viscous contribution) for all boundaries. */ - - su2double** Inlet_Ptotal = nullptr; /*!< \brief Value of the Total P. */ - su2double** Inlet_Ttotal = nullptr; /*!< \brief Value of the Total T. */ - su2double*** Inlet_FlowDir = nullptr; /*!< \brief Value of the Flow Direction. */ - su2double** HeatFlux = nullptr; /*!< \brief Heat transfer coefficient for each boundary and vertex. */ - su2double** HeatFluxTarget = nullptr; /*!< \brief Heat transfer coefficient for each boundary and vertex. */ - su2double*** CharacPrimVar = nullptr; /*!< \brief Value of the characteristic variables at each boundary. */ - su2double*** CSkinFriction = nullptr; /*!< \brief Skin friction coefficient for each boundary and vertex. */ - su2double** WallShearStress = nullptr; /*!< \brief Wall Shear Stress for each boundary and vertex. */ - su2double*** HeatConjugateVar = nullptr; /*!< \brief CHT variables for each boundary and vertex. */ - su2double** CPressure = nullptr; /*!< \brief Pressure coefficient for each boundary and vertex. */ - su2double** CPressureTarget = nullptr; /*!< \brief Target Pressure coefficient for each boundary and vertex. */ - su2double** YPlus = nullptr; /*!< \brief Yplus for each boundary and vertex. */ - - bool space_centered; /*!< \brief True if space centered scheeme used. */ + vector CNearFieldOF_Inv; /*!< \brief Near field pressure (inviscid) for each boundary. */ + vector Surface_HF_Visc; /*!< \brief Total (integrated) heat flux for each monitored surface. */ + vector Surface_MaxHF_Visc; /*!< \brief Maximum heat flux for each monitored surface. */ + vector HF_Visc; /*!< \brief Heat load (viscous contribution) for each boundary. */ + vector MaxHF_Visc; /*!< \brief Maximum heat flux (viscous contribution) for each boundary. */ + su2double AllBound_HF_Visc = 0.0; /*!< \brief Heat load (viscous contribution) for all the boundaries. */ + su2double AllBound_MaxHF_Visc = 0.0; /*!< \brief Maximum heat flux (viscous contribution) for all boundaries. */ + + vector > Inlet_Ptotal; /*!< \brief Value of the Total P. */ + vector > Inlet_Ttotal; /*!< \brief Value of the Total T. */ + vector Inlet_FlowDir; /*!< \brief Value of the Flow Direction. */ + vector > HeatFlux; /*!< \brief Heat transfer coefficient for each boundary and vertex. */ + vector > HeatFluxTarget; /*!< \brief Heat transfer coefficient for each boundary and vertex. */ + vector CharacPrimVar; /*!< \brief Value of the characteristic variables at each boundary. */ + vector CSkinFriction; /*!< \brief Skin friction coefficient for each boundary and vertex. */ + vector > WallShearStress; /*!< \brief Wall Shear Stress for each boundary and vertex. */ + vector HeatConjugateVar; /*!< \brief CHT variables for each boundary and vertex. */ + vector > CPressure; /*!< \brief Pressure coefficient for each boundary and vertex. */ + vector > CPressureTarget; /*!< \brief Target Pressure coefficient for each boundary and vertex. */ + vector > YPlus; /*!< \brief Yplus for each boundary and vertex. */ + + bool space_centered; /*!< \brief True if space centered scheme used. */ bool euler_implicit; /*!< \brief True if euler implicit scheme used. */ bool least_squares; /*!< \brief True if computing gradients by least squares. */ su2double Gamma; /*!< \brief Fluid's Gamma constant (ratio of specific heats). */ @@ -159,8 +166,8 @@ class CFVMFlowSolverBase : public CSolver { /*--- Sliding meshes variables ---*/ - su2double**** SlidingState = nullptr; - int** SlidingStateNodes = nullptr; + vector > SlidingState; // vector of matrix of pointers... inner dim alloc'd elsewhere (welcome, to the twilight zone) + vector > SlidingStateNodes; /*--- Shallow copy of grid coloring for OpenMP parallelization. ---*/ @@ -173,7 +180,7 @@ class CFVMFlowSolverBase : public CSolver { static constexpr bool ReducerStrategy = false; #endif - /*--- Edge fluxes, for OpenMP parallelization off difficult-to-color grids. + /*--- Edge fluxes, for OpenMP parallelization of difficult-to-color grids. * We first store the fluxes and then compute the sum for each cell. * This strategy is thread-safe but lower performance than writting to both * end points of each edge, so we only use it when necessary, i.e. when the @@ -244,12 +251,846 @@ class CFVMFlowSolverBase : public CSolver { */ inline virtual void InstantiateEdgeNumerics(const CSolver* const* solvers, const CConfig* config) {} + /*! + * \brief Compute the viscous contribution for a particular edge. + * \note The convective residual methods include a call to this for each edge, + * this allows convective and viscous loops to be "fused". + * \param[in] iEdge - Edge for which the flux and Jacobians are to be computed. + * \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. + */ + inline virtual void Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config) { } + void Viscous_Residual_impl(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config); + using CSolver::Viscous_Residual; /*--- Silence warning ---*/ + + /*! + * \brief Compute a suitable under-relaxation parameter to limit the change in the solution variables over a nonlinear + * iteration for stability. + */ + void ComputeUnderRelaxationFactor(const CConfig* config); + + /*! + * \brief General implementation to load a flow 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] iter - Current external iteration number. + * \param[in] update_geo - Flag for updating coords and grid velocity. + * \param[in] RestartSolution - Optional buffer to load restart vars into, + * this allows default values to be given when nVar > nVar_Restart. + * \param[in] nVar_Restart - Number of restart variables, if 0 defaults to nVar. + */ + void LoadRestart_impl(CGeometry **geometry, CSolver ***solver, CConfig *config, int iter, bool update_geo, + su2double* RestartSolution = nullptr, unsigned short nVar_Restart = 0); + + /*! + * \brief Generic implementation to compute the time step based on CFL and conv/visc eigenvalues. + * \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. + * \tparam SoundSpeedFunc - Function object to compute speed of sound. + * \tparam LambdaViscFunc - Function object to compute the viscous lambda. + * \note Both functors need to implement (nodes,iPoint,jPoint) for edges, and (nodes,iPoint) for vertices. + */ + template + FORCEINLINE void SetTime_Step_impl(const SoundSpeedFunc& soundSpeed, + const LambdaViscFunc& lambdaVisc, + CGeometry *geometry, + CSolver **solver_container, + CConfig *config, + unsigned short iMesh, + unsigned long Iteration) { + + const bool viscous = config->GetViscous(); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool time_stepping = (config->GetTime_Marching() == TIME_STEPPING); + const bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); + const su2double K_v = 0.25; + + /*--- Init thread-shared variables to compute min/max values. + * Critical sections are used for this instead of reduction + * clauses for compatibility with OpenMP 2.0 (Windows...). ---*/ + + SU2_OMP_MASTER + { + Min_Delta_Time = 1e30; + Max_Delta_Time = 0.0; + Global_Delta_UnstTimeND = 1e30; + } + SU2_OMP_BARRIER + + /*--- Loop domain points. ---*/ + + SU2_OMP_FOR_DYN(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < nPointDomain; ++iPoint) { + + /*--- Set maximum eigenvalues to zero. ---*/ + + nodes->SetMax_Lambda_Inv(iPoint,0.0); + + if (viscous) + nodes->SetMax_Lambda_Visc(iPoint,0.0); + + /*--- Loop over the neighbors of point i. ---*/ + + for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) + { + auto jPoint = geometry->nodes->GetPoint(iPoint,iNeigh); + + auto iEdge = geometry->nodes->GetEdge(iPoint,iNeigh); + auto Normal = geometry->edges->GetNormal(iEdge); + auto Area2 = GeometryToolbox::SquaredNorm(nDim, Normal); + + /*--- Mean Values ---*/ + + su2double Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + su2double Mean_SoundSpeed = soundSpeed(*nodes, iPoint, jPoint) * sqrt(Area2); + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + const su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint); + const su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint); + + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Mean_ProjVel -= 0.5 * (GridVel_i[iDim] + GridVel_j[iDim]) * Normal[iDim]; + } + + /*--- Inviscid contribution ---*/ + + su2double Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; + nodes->AddMax_Lambda_Inv(iPoint,Lambda); + + /*--- Viscous contribution ---*/ + + if (!viscous) continue; + + Lambda = lambdaVisc(*nodes, iPoint, jPoint) * Area2; + nodes->AddMax_Lambda_Visc(iPoint, Lambda); + } + + } + + /*--- Loop boundary edges ---*/ + + for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) + for (auto iVertex = 0ul; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + + /*--- Point identification, Normal vector and area ---*/ + + auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (!geometry->nodes->GetDomain(iPoint)) continue; + + auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); + auto Area2 = GeometryToolbox::SquaredNorm(nDim, Normal); + + /*--- Mean Values ---*/ + + su2double ProjVel = nodes->GetProjVel(iPoint,Normal); + su2double SoundSpeed = soundSpeed(*nodes, iPoint) * sqrt(Area2); + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + ProjVel -= GeometryToolbox::DotProduct(nDim, Normal, geometry->nodes->GetGridVel(iPoint)); + } + + /*--- Inviscid contribution ---*/ + + su2double Lambda = fabs(ProjVel) + SoundSpeed; + nodes->AddMax_Lambda_Inv(iPoint, Lambda); + + /*--- Viscous contribution ---*/ + + if (!viscous) continue; + + Lambda = lambdaVisc(*nodes,iPoint) * Area2; + nodes->AddMax_Lambda_Visc(iPoint, Lambda); + } + } + } + + /*--- Each element uses their own speed, steady state simulation. ---*/ + { + /*--- Thread-local variables for min/max reduction. ---*/ + su2double minDt = 1e30, maxDt = 0.0; + + SU2_OMP(for schedule(static,omp_chunk_size) nowait) + for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { + + su2double Vol = geometry->nodes->GetVolume(iPoint); + + if (Vol != 0.0) { + su2double Local_Delta_Time = nodes->GetLocalCFL(iPoint)*Vol / nodes->GetMax_Lambda_Inv(iPoint); + + if(viscous) { + su2double dt_visc = nodes->GetLocalCFL(iPoint)*K_v*Vol*Vol / nodes->GetMax_Lambda_Visc(iPoint); + Local_Delta_Time = min(Local_Delta_Time, dt_visc); + } + + minDt = min(minDt, Local_Delta_Time); + maxDt = max(maxDt, Local_Delta_Time); + + nodes->SetDelta_Time(iPoint, min(Local_Delta_Time, config->GetMax_DeltaTime())); + } + else { + nodes->SetDelta_Time(iPoint,0.0); + } + } + /*--- Min/max over threads. ---*/ + SU2_OMP_CRITICAL + { + Min_Delta_Time = min(Min_Delta_Time, minDt); + Max_Delta_Time = max(Max_Delta_Time, maxDt); + Global_Delta_Time = Min_Delta_Time; + } + SU2_OMP_BARRIER + } + + /*--- Compute the min/max dt (in parallel, now over mpi ranks). ---*/ + + SU2_OMP_MASTER + if (config->GetComm_Level() == COMM_FULL) { + su2double rbuf_time; + SU2_MPI::Allreduce(&Min_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + Min_Delta_Time = rbuf_time; + + SU2_MPI::Allreduce(&Max_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + Max_Delta_Time = rbuf_time; + } + SU2_OMP_BARRIER + + /*--- For exact time solution use the minimum delta time of the whole mesh. ---*/ + if (time_stepping) { + + /*--- 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. ---*/ + + SU2_OMP_MASTER + { + if (config->GetUnst_CFL() == 0.0) { + Global_Delta_Time = config->GetDelta_UnstTime(); + } + else { + Global_Delta_Time = Min_Delta_Time; + } + Max_Delta_Time = Global_Delta_Time; + + config->SetDelta_UnstTimeND(Global_Delta_Time); + } + SU2_OMP_BARRIER + + /*--- Sets the regular CFL equal to the unsteady CFL. ---*/ + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { + nodes->SetLocalCFL(iPoint, config->GetUnst_CFL()); + 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)) { + + /*--- Thread-local variable for reduction. ---*/ + su2double glbDtND = 1e30; + + SU2_OMP(for schedule(static,omp_chunk_size) nowait) + for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { + glbDtND = min(glbDtND, config->GetUnst_CFL()*Global_Delta_Time / nodes->GetLocalCFL(iPoint)); + } + SU2_OMP_CRITICAL + Global_Delta_UnstTimeND = min(Global_Delta_UnstTimeND, glbDtND); + SU2_OMP_BARRIER + + SU2_OMP_MASTER + { + SU2_MPI::Allreduce(&Global_Delta_UnstTimeND, &glbDtND, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + Global_Delta_UnstTimeND = glbDtND; + + config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND); + } + SU2_OMP_BARRIER + } + + /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/ + + if (dual_time && !implicit) { + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { + su2double dt = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); + nodes->SetDelta_Time(iPoint, dt); + } + } + } + + /*! + * \brief Compute the max eigenvalue, gemeric implementation. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \tparam SoundSpeedFunc - Function object to compute speed of sound. + * \note Functor needs to implement (nodes,iPoint,jPoint) for edges, and (nodes,iPoint) for vertices. + */ + template + FORCEINLINE void SetMax_Eigenvalue_impl(const SoundSpeedFunc& soundSpeed, CGeometry *geometry, const CConfig *config) { + + /*--- Loop domain points. ---*/ + + SU2_OMP_FOR_DYN(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) { + + /*--- Set eigenvalues to zero. ---*/ + nodes->SetLambda(iPoint,0.0); + + /*--- Loop over the neighbors of point i. ---*/ + for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) + { + auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); + + auto iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); + auto Normal = geometry->edges->GetNormal(iEdge); + su2double Area = GeometryToolbox::Norm(nDim, Normal); + + /*--- Mean Values ---*/ + + su2double Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); + su2double Mean_SoundSpeed = soundSpeed(*nodes, iPoint, jPoint) * Area; + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + const su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint); + const su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint); + + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Mean_ProjVel -= 0.5 * (GridVel_i[iDim] + GridVel_j[iDim]) * Normal[iDim]; + } + + /*--- Inviscid contribution ---*/ + + nodes->AddLambda(iPoint, fabs(Mean_ProjVel) + Mean_SoundSpeed); + } + } + + /*--- Loop boundary edges ---*/ + + for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) + for (unsigned long iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + + /*--- Point identification, Normal vector and area ---*/ + + auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (!geometry->nodes->GetDomain(iPoint)) continue; + + auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); + su2double Area = GeometryToolbox::Norm(nDim, Normal); + + /*--- Mean Values ---*/ + + su2double Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); + su2double Mean_SoundSpeed = soundSpeed(*nodes, iPoint) * Area; + + /*--- Adjustment for grid movement ---*/ + + if (dynamic_grid) { + Mean_ProjVel -= GeometryToolbox::DotProduct(nDim, Normal, geometry->nodes->GetGridVel(iPoint)); + } + + /*--- Inviscid contribution ---*/ + + nodes->AddLambda(iPoint, fabs(Mean_ProjVel) + Mean_SoundSpeed); + } + } + } + + /*--- Correct the eigenvalue values across any periodic boundaries. ---*/ + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_MAX_EIG); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_MAX_EIG); + } + + /*--- MPI parallelization ---*/ + + InitiateComms(geometry, config, MAX_EIGENVALUE); + CompleteComms(geometry, config, MAX_EIGENVALUE); + } + + /*! + * \brief Compute the dissipation sensor for centered schemes. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + * \tparam SensVarFunc - Function object implementing (nodes, iPoint) to return the sensor variable, e.g. pressure. + */ + template + FORCEINLINE void SetCentered_Dissipation_Sensor_impl(const SensVarFunc& sensVar, + CGeometry *geometry, const CConfig *config) { + + /*--- We can access memory more efficiently if there are no periodic boundaries. ---*/ + + const bool isPeriodic = (config->GetnMarker_Periodic() > 0); + + /*--- Loop domain points. ---*/ + + SU2_OMP_FOR_DYN(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) { + + const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); + const su2double sensVar_i = sensVar(*nodes, iPoint); + + /*--- Initialize. ---*/ + iPoint_UndLapl[iPoint] = 0.0; + jPoint_UndLapl[iPoint] = 0.0; + + /*--- Loop over the neighbors of point i. ---*/ + for (auto jPoint : geometry->nodes->GetPoints(iPoint)) + { + bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); + + /*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/ + if (boundary_i && !boundary_j) continue; + + su2double sensVar_j = sensVar(*nodes, jPoint); + + /*--- Dissipation sensor, add variable difference and variable sum. ---*/ + iPoint_UndLapl[iPoint] += sensVar_j - sensVar_i; + jPoint_UndLapl[iPoint] += sensVar_j + sensVar_i; + } + + if (!isPeriodic) { + /*--- Every neighbor is accounted for, sensor can be computed. ---*/ + nodes->SetSensor(iPoint, fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); + } + } + + if (isPeriodic) { + /*--- Correct the sensor values across any periodic boundaries. ---*/ + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR); + } + + /*--- Set final pressure switch for each point ---*/ + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) + nodes->SetSensor(iPoint, fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); + } + + /*--- MPI parallelization ---*/ + + InitiateComms(geometry, config, SENSOR); + CompleteComms(geometry, config, SENSOR); + + } + + /*! + * \brief Generic implementation of explicit iterations with a preconditioner. + * \note The preconditioner is a functor implementing the methods: + * - compute(config, iPoint): Should prepare the preconditioner for iPoint. + * - apply(iVar, residual[], resTruncError[]): Apply it to compute the iVar update. + * See Explicit_Iteration for the general form of the preconditioner. + */ + template + void Explicit_Iteration_impl(ResidualPrecond& preconditioner, CGeometry *geometry, + CSolver **solver_container, CConfig *config, unsigned short iRKStep) { + + static_assert(IntegrationType == CLASSICAL_RK4_EXPLICIT || + IntegrationType == RUNGE_KUTTA_EXPLICIT || + IntegrationType == EULER_EXPLICIT, ""); + + const bool adjoint = config->GetContinuous_Adjoint(); + + const su2double RK_AlphaCoeff = config->Get_Alpha_RKStep(iRKStep); + + /*--- Hard-coded classical RK4 coefficients. Will be added to config. ---*/ + const su2double RK_FuncCoeff[] = {1.0/6.0, 1.0/3.0, 1.0/3.0, 1.0/6.0}; + const su2double RK_TimeCoeff[] = {0.5, 0.5, 1.0, 1.0}; + + /*--- Set shared residual variables to 0 and declare + * local ones for current thread to work on. ---*/ + + SU2_OMP_MASTER + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + SetRes_RMS(iVar, 0.0); + SetRes_Max(iVar, 0.0, 0); + } + SU2_OMP_BARRIER + + su2double resMax[MAXNVAR] = {0.0}, resRMS[MAXNVAR] = {0.0}; + const su2double* coordMax[MAXNVAR] = {nullptr}; + unsigned long idxMax[MAXNVAR] = {0}; + + /*--- Update the solution and residuals ---*/ + + if (!adjoint) { + SU2_OMP(for schedule(static,omp_chunk_size) nowait) + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + + su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); + su2double Delta = nodes->GetDelta_Time(iPoint) / Vol; + + const su2double* Res_TruncError = nodes->GetResTruncError(iPoint); + const su2double* Residual = LinSysRes.GetBlock(iPoint); + + preconditioner.compute(config, iPoint); + + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + + su2double Res = preconditioner.apply(iVar, Residual, Res_TruncError); + + /*--- "Static" switch which should be optimized at compile time. ---*/ + switch(IntegrationType) { + + case EULER_EXPLICIT: + nodes->AddSolution(iPoint,iVar, -Res*Delta); + break; + + case RUNGE_KUTTA_EXPLICIT: + nodes->AddSolution(iPoint, iVar, -Res*Delta*RK_AlphaCoeff); + break; + + case CLASSICAL_RK4_EXPLICIT: + { + su2double tmp_time = -1.0*RK_TimeCoeff[iRKStep]*Delta; + su2double tmp_func = -1.0*RK_FuncCoeff[iRKStep]*Delta; + + if (iRKStep < 3) { + /* Base Solution Update */ + nodes->AddSolution(iPoint,iVar, tmp_time*Res); + + /* New Solution Update */ + nodes->AddSolution_New(iPoint,iVar, tmp_func*Res); + } else { + nodes->SetSolution(iPoint, iVar, nodes->GetSolution_New(iPoint, iVar) + tmp_func*Res); + } + } + break; + } + + /*--- Update residual information for current thread. ---*/ + resRMS[iVar] += Res*Res; + if (fabs(Res) > resMax[iVar]) { + resMax[iVar] = fabs(Res); + idxMax[iVar] = iPoint; + coordMax[iVar] = geometry->nodes->GetCoord(iPoint); + } + } + } + /*--- Reduce residual information over all threads in this rank. ---*/ + SU2_OMP_CRITICAL + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + AddRes_RMS(iVar, resRMS[iVar]); + AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]); + } + SU2_OMP_BARRIER + } + + /*--- MPI solution ---*/ + + InitiateComms(geometry, config, SOLUTION); + CompleteComms(geometry, config, SOLUTION); + + if (!adjoint) { + SU2_OMP_MASTER { + /*--- Compute the root mean square residual ---*/ + + SetResidual_RMS(geometry, config); + + /*--- For verification cases, compute the global error metrics. ---*/ + + ComputeVerificationError(geometry, config); + } + SU2_OMP_BARRIER + } + + } + + /*! + * \brief Generic implementation of explicit iterations without preconditioner. + */ + template + FORCEINLINE void Explicit_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep) { + struct Identity { + FORCEINLINE void compute(const CConfig*, unsigned long) {} + FORCEINLINE su2double apply(unsigned short iVar, const su2double* res, const su2double* resTrunc) { + return res[iVar] + resTrunc[iVar]; + } + } precond; + + Explicit_Iteration_impl(precond, geometry, solver_container, config, iRKStep); + } + + /*! + * \brief Generic implementation to prepare an implicit iteration with an optional preconditioner applied to the diagonal. + * \tparam DiagonalPrecond - A function object implementing: + * - active: A boolean variable to determine if the preconditioner should be used. + * - (config, iPoint, delta): Compute and return a matrix type compatible with the Jacobian matrix, + * where "delta" is V/dt. + */ + template + void PrepareImplicitIteration_impl(DiagonalPrecond& preconditioner, CGeometry *geometry, CConfig *config) { + + const bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + + /*--- Set shared residual variables to 0 and declare local ones for current thread to work on. ---*/ + + SU2_OMP_MASTER + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + SetRes_RMS(iVar, 0.0); + SetRes_Max(iVar, 0.0, 0); + } + SU2_OMP_BARRIER + + su2double resMax[MAXNVAR] = {0.0}, resRMS[MAXNVAR] = {0.0}; + const su2double* coordMax[MAXNVAR] = {nullptr}; + unsigned long idxMax[MAXNVAR] = {0}; + + /*--- Add pseudotime term to Jacobian. ---*/ + + if (implicit) { + SU2_OMP(for schedule(static,omp_chunk_size) nowait) + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Modify matrix diagonal to improve diagonal dominance. ---*/ + + if (nodes->GetDelta_Time(iPoint) != 0.0) { + + su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); + + su2double Delta = Vol / nodes->GetDelta_Time(iPoint); + + if (preconditioner.active) + Jacobian.AddBlock2Diag(iPoint, preconditioner(config, iPoint, Delta)); + else + Jacobian.AddVal2Diag(iPoint, Delta); + } + else { + Jacobian.SetVal2Diag(iPoint, 1.0); + } + } + } + + /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/ + + SU2_OMP(for schedule(static,omp_chunk_size) nowait) + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Multigrid contribution to residual. ---*/ + + su2double* local_Res_TruncError = nodes->GetResTruncError(iPoint); + + if (nodes->GetDelta_Time(iPoint) == 0.0) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + LinSysRes(iPoint,iVar) = 0.0; + local_Res_TruncError[iVar] = 0.0; + } + } + + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + unsigned long total_index = iPoint*nVar + iVar; + LinSysRes[total_index] = - (LinSysRes[total_index] + local_Res_TruncError[iVar]); + LinSysSol[total_index] = 0.0; + + su2double Res = fabs(LinSysRes[total_index]); + resRMS[iVar] += Res*Res; + if (Res > resMax[iVar]) { + resMax[iVar] = Res; + idxMax[iVar] = iPoint; + coordMax[iVar] = geometry->nodes->GetCoord(iPoint); + } + } + } + SU2_OMP_CRITICAL + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + AddRes_RMS(iVar, resRMS[iVar]); + AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]); + } + SU2_OMP_BARRIER + + /*--- Compute the root mean square residual ---*/ + SU2_OMP_MASTER + SetResidual_RMS(geometry, config); + SU2_OMP_BARRIER + } + + /*! + * \brief Generic implementation to complete an implicit iteration, i.e. update the solution. + * \tparam compute_ur - Whether to use automatic under-relaxation for the update. + */ + template + void CompleteImplicitIteration_impl(CGeometry *geometry, CConfig *config) { + + if (compute_ur) ComputeUnderRelaxationFactor(config); + + /*--- Update solution with under-relaxation and communicate it. ---*/ + + if (!config->GetContinuous_Adjoint()) { + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + nodes->AddSolution(iPoint, iVar, nodes->GetUnderRelaxation(iPoint)*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); + } + + InitiateComms(geometry, config, SOLUTION); + CompleteComms(geometry, config, SOLUTION); + + /*--- For verification cases, compute the global error metrics. ---*/ + SU2_OMP_MASTER + ComputeVerificationError(geometry, config); + SU2_OMP_BARRIER + } + + /*! + * \brief Evaluate the vorticity and strain rate magnitude. + * \tparam VelocityOffset: Index in the primitive variables where the velocity starts. + */ + template + void ComputeVorticityAndStrainMag(const CConfig& config, unsigned short iMesh) { + + const auto& Gradient_Primitive = nodes->GetGradient_Primitive(); + auto& StrainMag = nodes->GetStrainMag(); + + SU2_OMP_MASTER { + StrainMag_Max = 0.0; + Omega_Max = 0.0; + } + SU2_OMP_BARRIER + + su2double strainMax = 0.0, omegaMax = 0.0; + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) { + + constexpr size_t u = VelocityOffset; + constexpr size_t v = VelocityOffset+1; + constexpr size_t w = VelocityOffset+2; + + /*--- Vorticity ---*/ + + su2double* Vorticity = nodes->GetVorticity(iPoint); + + Vorticity[0] = 0.0; Vorticity[1] = 0.0; + + Vorticity[2] = Gradient_Primitive(iPoint,v,0)-Gradient_Primitive(iPoint,u,1); + + if (nDim == 3) { + Vorticity[0] = Gradient_Primitive(iPoint,w,1)-Gradient_Primitive(iPoint,v,2); + Vorticity[1] = -(Gradient_Primitive(iPoint,w,0)-Gradient_Primitive(iPoint,u,2)); + } + + /*--- Strain Magnitude ---*/ + + AD::StartPreacc(); + AD::SetPreaccIn(&Gradient_Primitive[iPoint][VelocityOffset], nDim, nDim); + + su2double Div = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Div += Gradient_Primitive(iPoint, iDim+VelocityOffset, iDim); + Div /= 3.0; + + StrainMag(iPoint) = 0.0; + + /*--- Add diagonal part ---*/ + + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + StrainMag(iPoint) += pow(Gradient_Primitive(iPoint, iDim+VelocityOffset, iDim) - Div, 2); + } + if (nDim == 2) { + StrainMag(iPoint) += pow(Div, 2); + } + + /*--- Add off diagonals ---*/ + + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,u,1) + Gradient_Primitive(iPoint,v,0)), 2); + + if (nDim == 3) { + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,u,2) + Gradient_Primitive(iPoint,w,0)), 2); + StrainMag(iPoint) += 2.0*pow(0.5*(Gradient_Primitive(iPoint,v,2) + Gradient_Primitive(iPoint,w,1)), 2); + } + + StrainMag(iPoint) = sqrt(2.0*StrainMag(iPoint)); + AD::SetPreaccOut(StrainMag(iPoint)); + + /*--- Max is not differentiable, so we not register them for preacc. ---*/ + strainMax = max(strainMax, StrainMag(iPoint)); + omegaMax = max(omegaMax, GeometryToolbox::Norm(3, Vorticity)); + + AD::EndPreacc(); + } + + if ((iMesh == MESH_0) && (config.GetComm_Level() == COMM_FULL)) { + SU2_OMP_CRITICAL { + StrainMag_Max = max(StrainMag_Max, strainMax); + Omega_Max = max(Omega_Max, omegaMax); + } + + SU2_OMP_BARRIER + SU2_OMP_MASTER { + su2double MyOmega_Max = Omega_Max; + su2double MyStrainMag_Max = StrainMag_Max; + + SU2_MPI::Allreduce(&MyStrainMag_Max, &StrainMag_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyOmega_Max, &Omega_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + } + SU2_OMP_BARRIER + } + + } + /*! * \brief Destructor. */ ~CFVMFlowSolverBase(); public: + + /*! + * \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] iter - Current external iteration number. + * \param[in] update_geo - Flag for updating coords and grid velocity. + */ + void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int iter, bool update_geo) override; + + /*! + * \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 ExtIter) override; + /*! * \brief Compute the gradient of the primitive variables using Green-Gauss method, * and stores the result in the Gradient_Primitive variable. @@ -276,11 +1117,21 @@ class CFVMFlowSolverBase : public CSolver { void SetPrimitive_Limiter(CGeometry* geometry, const CConfig* config) final; /*! - * \brief Compute a suitable under-relaxation parameter to limit the change in the solution variables over a nonlinear - * iteration for stability. \param[in] solver - Container vector with all the solutions. \param[in] config - - * Definition of the particular problem. + * \brief Implementation of implicit Euler iteration. + */ + 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 ComputeUnderRelaxationFactor(CSolver** solver, const CConfig* config) final; + void SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep, + unsigned short iMesh, unsigned short RunTime_EqSystem) override; /*! * \brief Set a uniform inlet profile @@ -731,6 +1582,11 @@ class CFVMFlowSolverBase : public CSolver { */ inline su2double GetTotal_CEff() const final { return TotalCoeff.CEff; } + /*! + * \brief Get the reference force used to compute CL, CD, etc. + */ + inline su2double GetAeroCoeffsReferenceForce() const final { return AeroCoeffForceRef; } + /*! * \brief Provide the total (inviscid + viscous) non dimensional lift coefficient. * \return Value of the lift coefficient (inviscid + viscous contribution). @@ -1324,7 +2180,7 @@ class CFVMFlowSolverBase : public CSolver { * \param[in] val_vertex - Vertex of the marker val_marker where the coefficient is evaluated. * \return Value of the pressure coefficient. */ - inline su2double* GetCharacPrimVar(unsigned short val_marker, unsigned long val_vertex) const final { + inline su2double* GetCharacPrimVar(unsigned short val_marker, unsigned long val_vertex) final { return CharacPrimVar[val_marker][val_vertex]; } @@ -1382,8 +2238,6 @@ class CFVMFlowSolverBase : public CSolver { * checking to prevent segmentation faults ---*/ if (val_marker >= nMarker) SU2_MPI::Error("Out-of-bounds marker index used on inlet.", CURRENT_FUNCTION); - else if (Inlet_Ttotal == nullptr || Inlet_Ttotal[val_marker] == nullptr) - SU2_MPI::Error("Tried to set custom inlet BC on an invalid marker.", CURRENT_FUNCTION); else if (val_vertex >= nVertex[val_marker]) SU2_MPI::Error("Out-of-bounds vertex index used on inlet.", CURRENT_FUNCTION); else @@ -1401,8 +2255,6 @@ class CFVMFlowSolverBase : public CSolver { * checking to prevent segmentation faults ---*/ if (val_marker >= nMarker) SU2_MPI::Error("Out-of-bounds marker index used on inlet.", CURRENT_FUNCTION); - else if (Inlet_Ptotal == nullptr || Inlet_Ptotal[val_marker] == nullptr) - SU2_MPI::Error("Tried to set custom inlet BC on an invalid marker.", CURRENT_FUNCTION); else if (val_vertex >= nVertex[val_marker]) SU2_MPI::Error("Out-of-bounds vertex index used on inlet.", CURRENT_FUNCTION); else @@ -1422,8 +2274,6 @@ class CFVMFlowSolverBase : public CSolver { * checking to prevent segmentation faults ---*/ if (val_marker >= nMarker) SU2_MPI::Error("Out-of-bounds marker index used on inlet.", CURRENT_FUNCTION); - else if (Inlet_FlowDir == nullptr || Inlet_FlowDir[val_marker] == nullptr) - SU2_MPI::Error("Tried to set custom inlet BC on an invalid marker.", CURRENT_FUNCTION); else if (val_vertex >= nVertex[val_marker]) SU2_MPI::Error("Out-of-bounds vertex index used on inlet.", CURRENT_FUNCTION); else @@ -1563,7 +2413,7 @@ class CFVMFlowSolverBase : public CSolver { */ inline su2double GetCSkinFriction(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim) const final { - return CSkinFriction[val_marker][val_dim][val_vertex]; + return CSkinFriction[val_marker](val_vertex,val_dim); } /*! diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 8cfcdcd299b3..5cc958538614 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1,7 +1,7 @@ /*! * \file CFVMFlowSolverBase.inl * \brief Base class template for all FVM flow solvers. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -84,8 +84,8 @@ void CFVMFlowSolverBase::AeroCoeffsArray::setZero(int i) { template void CFVMFlowSolverBase::Allocate(const CConfig& config) { - unsigned short iDim, iVar, iMarker; - unsigned long iPoint, iVertex; + unsigned short iVar; + unsigned long iMarker; /*--- Define some auxiliar vector related with the residual ---*/ @@ -114,21 +114,21 @@ void CFVMFlowSolverBase::Allocate(const CConfig& config) { LinSysSol.Initialize(nPoint, nPointDomain, nVar, 0.0); LinSysRes.Initialize(nPoint, nPointDomain, nVar, 0.0); + /*--- LinSysSol will always be init to 0. ---*/ + System.SetxIsZero(true); + /*--- Allocates a 2D array with variable "outer" sizes and init to 0. ---*/ - auto Alloc2D = [](unsigned long M, const unsigned long* N, su2double**& X) { - X = new su2double*[M]; - for (unsigned long i = 0; i < M; ++i) X[i] = new su2double[N[i]](); + auto Alloc2D = [](unsigned long M, const unsigned long* N, vector >& X) { + X.resize(M); + for (unsigned long i = 0; i < M; ++i) X[i].resize(N[i],0.0); }; /*--- Allocates a 3D array with variable "middle" sizes and init to 0. ---*/ - auto Alloc3D = [](unsigned long M, const unsigned long* N, unsigned long P, su2double***& X) { - X = new su2double**[M]; - for (unsigned long i = 0; i < M; ++i) { - X[i] = new su2double*[N[i]]; - for (unsigned long j = 0; j < N[i]; ++j) X[i][j] = new su2double[P](); - } + auto Alloc3D = [](unsigned long M, const unsigned long* N, unsigned long P, vector& X) { + X.resize(M); + for (unsigned long i = 0; i < M; ++i) X[i].resize(N[i],P) = su2double(0.0); }; /*--- Store the value of the characteristic primitive variables at the boundaries ---*/ @@ -164,28 +164,25 @@ void CFVMFlowSolverBase::Allocate(const CConfig& config) { /*--- Heat flux coefficients. ---*/ - HF_Visc = new su2double[nMarker]; - MaxHF_Visc = new su2double[nMarker]; + HF_Visc.resize(nMarker,0.0); + MaxHF_Visc.resize(nMarker,0.0); - Surface_HF_Visc = new su2double[config.GetnMarker_Monitoring()]; - Surface_MaxHF_Visc = new su2double[config.GetnMarker_Monitoring()]; + Surface_HF_Visc.resize(config.GetnMarker_Monitoring()); + Surface_MaxHF_Visc.resize(config.GetnMarker_Monitoring()); /*--- Supersonic coefficients ---*/ - CNearFieldOF_Inv = new su2double[nMarker]; + CNearFieldOF_Inv.resize(nMarker,0.0); /*--- Initializate quantities for SlidingMesh Interface ---*/ - SlidingState = new su2double***[nMarker](); - SlidingStateNodes = new int*[nMarker](); + SlidingState.resize(nMarker); + SlidingStateNodes.resize(nMarker); for (iMarker = 0; iMarker < nMarker; iMarker++) { if (config.GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE) { - SlidingState[iMarker] = new su2double**[nVertex[iMarker]](); - SlidingStateNodes[iMarker] = new int[nVertex[iMarker]](); - - for (iPoint = 0; iPoint < nVertex[iMarker]; iPoint++) - SlidingState[iMarker][iPoint] = new su2double*[nPrimVar + 1](); + SlidingState[iMarker].resize(nVertex[iMarker], nPrimVar+1) = nullptr; + SlidingStateNodes[iMarker].resize(nVertex[iMarker],0); } } @@ -200,13 +197,7 @@ void CFVMFlowSolverBase::Allocate(const CConfig& config) { /*--- Skin friction in all the markers ---*/ - CSkinFriction = new su2double**[nMarker]; - for (iMarker = 0; iMarker < nMarker; iMarker++) { - CSkinFriction[iMarker] = new su2double*[nDim]; - for (iDim = 0; iDim < nDim; iDim++) { - CSkinFriction[iMarker][iDim] = new su2double[nVertex[iMarker]](); - } - } + Alloc3D(nMarker, nVertex, nDim, CSkinFriction); /*--- Wall Shear Stress in all the markers ---*/ @@ -216,20 +207,23 @@ void CFVMFlowSolverBase::Allocate(const CConfig& config) { used for coupling with a solid donor cell ---*/ constexpr auto nHeatConjugateVar = 4u; - HeatConjugateVar = new su2double**[nMarker]; - for (iMarker = 0; iMarker < nMarker; iMarker++) { - HeatConjugateVar[iMarker] = new su2double*[nVertex[iMarker]]; - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { - HeatConjugateVar[iMarker][iVertex] = new su2double[nHeatConjugateVar](); - HeatConjugateVar[iMarker][iVertex][0] = config.GetTemperature_FreeStreamND(); + Alloc3D(nMarker, nVertex, nHeatConjugateVar, HeatConjugateVar); + for (auto& x : HeatConjugateVar) x = config.GetTemperature_FreeStreamND(); + + if (MGLevel == MESH_0) { + VertexTraction.resize(nMarker); + for (iMarker = 0; iMarker < nMarker; iMarker++) { + if (config.GetSolid_Wall(iMarker)) + VertexTraction[iMarker].resize(nVertex[iMarker], nDim) = su2double(0.0); } - } - /*--- Only initialize when there is a Marker_Fluid_Load defined - *--- (this avoids overhead in all other cases while a more permanent structure is being developed) ---*/ - if ((config.GetnMarker_Fluid_Load() > 0) && (MGLevel == MESH_0)) { - Alloc3D(nMarker, nVertex, nDim, VertexTraction); - if (config.GetDiscrete_Adjoint()) Alloc3D(nMarker, nVertex, nDim, VertexTractionAdjoint); + if (config.GetDiscrete_Adjoint()) { + VertexTractionAdjoint.resize(nMarker); + for (iMarker = 0; iMarker < nMarker; iMarker++) { + if (config.GetSolid_Wall(iMarker)) + VertexTractionAdjoint[iMarker].resize(nVertex[iMarker], nDim) = su2double(0.0); + } + } } /*--- Initialize the BGS residuals in FSI problems. ---*/ @@ -347,10 +341,10 @@ void CFVMFlowSolverBase::HybridParallelInitialization(const CConfig& confi /*--- If the reducer strategy is not being forced (by EDGE_COLORING_GROUP_SIZE=0) print some messages. ---*/ if (config.GetEdgeColoringGroupSize() != 1 << 30) { su2double minEff = 1.0; - SU2_MPI::Reduce(¶llelEff, &minEff, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(¶llelEff, &minEff, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, SU2_MPI::GetComm()); int tmp = ReducerStrategy, numRanksUsingReducer = 0; - SU2_MPI::Reduce(&tmp, &numRanksUsingReducer, 1, MPI_INT, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(&tmp, &numRanksUsingReducer, 1, MPI_INT, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); if (minEff < COLORING_EFF_THRESH) { cout << "WARNING: On " << numRanksUsingReducer << " MPI ranks the coloring efficiency was less than " @@ -376,122 +370,9 @@ void CFVMFlowSolverBase::HybridParallelInitialization(const CConfig& confi template CFVMFlowSolverBase::~CFVMFlowSolverBase() { - unsigned short iMarker, iVar, iDim; - unsigned long iVertex; - - delete[] CNearFieldOF_Inv; - delete[] HF_Visc; - delete[] MaxHF_Visc; - delete[] Surface_HF_Visc; - delete[] Surface_MaxHF_Visc; - - if (SlidingState != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - if (SlidingState[iMarker] != nullptr) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) - if (SlidingState[iMarker][iVertex] != nullptr) { - for (iVar = 0; iVar < nPrimVar + 1; iVar++) delete[] SlidingState[iMarker][iVertex][iVar]; - delete[] SlidingState[iMarker][iVertex]; - } - delete[] SlidingState[iMarker]; - } - } - delete[] SlidingState; - } - - if (SlidingStateNodes != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - if (SlidingStateNodes[iMarker] != nullptr) delete[] SlidingStateNodes[iMarker]; - } - delete[] SlidingStateNodes; - } - - if (CPressure != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) delete[] CPressure[iMarker]; - delete[] CPressure; - } - - if (CPressureTarget != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) delete[] CPressureTarget[iMarker]; - delete[] CPressureTarget; - } - - if (CharacPrimVar != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) delete[] CharacPrimVar[iMarker][iVertex]; - delete[] CharacPrimVar[iMarker]; - } - delete[] CharacPrimVar; - } - - if (Inlet_Ttotal != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - if (Inlet_Ttotal[iMarker] != nullptr) delete[] Inlet_Ttotal[iMarker]; - delete[] Inlet_Ttotal; - } - - if (Inlet_Ptotal != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - if (Inlet_Ptotal[iMarker] != nullptr) delete[] Inlet_Ptotal[iMarker]; - delete[] Inlet_Ptotal; - } - - if (Inlet_FlowDir != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - if (Inlet_FlowDir[iMarker] != nullptr) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) delete[] Inlet_FlowDir[iMarker][iVertex]; - delete[] Inlet_FlowDir[iMarker]; - } - } - delete[] Inlet_FlowDir; - } - - if (HeatFlux != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - delete[] HeatFlux[iMarker]; - } - delete[] HeatFlux; - } - if (HeatFluxTarget != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - delete[] HeatFluxTarget[iMarker]; - } - delete[] HeatFluxTarget; - } - - if (YPlus != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - delete[] YPlus[iMarker]; - } - delete[] YPlus; - } - - if (CSkinFriction != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - for (iDim = 0; iDim < nDim; iDim++) { - delete[] CSkinFriction[iMarker][iDim]; - } - delete[] CSkinFriction[iMarker]; - } - delete[] CSkinFriction; - } - - if (WallShearStress != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - delete[] WallShearStress[iMarker]; - } - delete[] WallShearStress; - } - - if (HeatConjugateVar != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { - delete[] HeatConjugateVar[iMarker][iVertex]; - } - delete[] HeatConjugateVar[iMarker]; - } - delete[] HeatConjugateVar; + for (auto& mat : SlidingState) { + for (auto ptr : mat) delete [] ptr; } delete nodes; @@ -541,6 +422,65 @@ void CFVMFlowSolverBase::SetPrimitive_Limiter(CGeometry* geometry, const C nPrimVarGrad, primitives, gradient, primMin, primMax, limiter); } +template +void CFVMFlowSolverBase::Viscous_Residual_impl(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config) { + + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool tkeNeeded = (config->GetKind_Turb_Model() == SST) || + (config->GetKind_Turb_Model() == SST_SUST); + + CVariable* turbNodes = nullptr; + if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); + + /*--- Points, coordinates and normal vector in edge ---*/ + + auto iPoint = geometry->edges->GetNode(iEdge,0); + auto 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)); + + numerics->SetSecondary(nodes->GetSecondary(iPoint), + nodes->GetSecondary(jPoint)); + + /*--- Gradients. ---*/ + + numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(jPoint)); + + /*--- Turbulent kinetic energy. ---*/ + + if (tkeNeeded) + numerics->SetTurbKineticEnergy(turbNodes->GetSolution(iPoint,0), + turbNodes->GetSolution(jPoint,0)); + + /*--- Compute and update residual ---*/ + + auto residual = numerics->ComputeResidual(config); + + if (ReducerStrategy) { + EdgeFluxes.SubtractBlock(iEdge, residual); + if (implicit) + Jacobian.UpdateBlocksSub(iEdge, residual.jacobian_i, residual.jacobian_j); + } + else { + LinSysRes.SubtractBlock(iPoint, residual); + LinSysRes.AddBlock(jPoint, residual); + + if (implicit) + Jacobian.UpdateBlocksSub(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + } + +} + template void CFVMFlowSolverBase::ComputeVerificationError(CGeometry* geometry, CConfig* config) { /*--- The errors only need to be computed on the finest grid. ---*/ @@ -599,7 +539,7 @@ void CFVMFlowSolverBase::ComputeVerificationError(CGeometry* geometry, CCo } template -void CFVMFlowSolverBase::ComputeUnderRelaxationFactor(CSolver** solver_container, const CConfig* config) { +void CFVMFlowSolverBase::ComputeUnderRelaxationFactor(const CConfig* config) { /* Loop over the solution update given by relaxing the linear system for this nonlinear iteration. */ @@ -634,6 +574,30 @@ void CFVMFlowSolverBase::ComputeUnderRelaxationFactor(CSolver** solver_con } } +template +void CFVMFlowSolverBase::ImplicitEuler_Iteration(CGeometry *geometry, CSolver**, CConfig *config) { + + PrepareImplicitIteration(geometry, nullptr, config); + + /*--- Solve or smooth the linear system. ---*/ + + SU2_OMP(for schedule(static,OMP_MIN_SIZE) nowait) + for (unsigned long iPoint = nPointDomain; iPoint < nPoint; iPoint++) { + LinSysRes.SetBlock_Zero(iPoint); + LinSysSol.SetBlock_Zero(iPoint); + } + + auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + + SU2_OMP_MASTER { + SetIterLinSolver(iter); + SetResLinSolver(System.GetResidual()); + } + SU2_OMP_BARRIER + + CompleteImplicitIteration(geometry, nullptr, config); +} + template void CFVMFlowSolverBase::SetInletAtVertex(const su2double* val_inlet, unsigned short iMarker, unsigned long iVertex) { @@ -759,6 +723,283 @@ void CFVMFlowSolverBase::SetUniformInlet(const CConfig* config, unsigned s } } +template +void CFVMFlowSolverBase::LoadRestart_impl(CGeometry **geometry, CSolver ***solver, CConfig *config, + int iter, bool update_geo, su2double* SolutionRestart, + unsigned short nVar_Restart) { + + /*--- 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; + const su2double* Solution_Fine = nullptr; + const passivedouble* Coord = nullptr; + bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND)); + bool static_fsi = ((config->GetTime_Marching() == STEADY) && config->GetFSI_Simulation()); + bool steady_restart = config->GetSteadyRestart(); + bool turbulent = (config->GetKind_Turb_Model() != NONE); + + string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", iter); + + /*--- To make this routine safe to call in parallel most of it can only be executed by one thread. ---*/ + SU2_OMP_MASTER { + + if (nVar_Restart == 0) nVar_Restart = nVar; + + /*--- 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. ---*/ + + unsigned long counter = 0, iPoint_Global = 0; + for (; 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. ---*/ + + auto 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. ---*/ + + index = counter*Restart_Vars[1] + skipVars; + + if (SolutionRestart == nullptr) { + for (iVar = 0; iVar < nVar_Restart; iVar++) + nodes->SetSolution(iPoint_Local, iVar, Restart_Data[index+iVar]); + } + else { + /*--- Used as buffer, allows defaults for nVar > nVar_Restart. ---*/ + for (iVar = 0; iVar < nVar_Restart; iVar++) + SolutionRestart[iVar] = Restart_Data[index+iVar]; + nodes->SetSolution(iPoint_Local, SolutionRestart); + } + + /*--- For dynamic meshes, read in and store the + grid coordinates and grid velocities for each node. ---*/ + + if (dynamic_grid && update_geo) { + + /*--- 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 ---*/ + + /*--- Rewind the index to retrieve the Coords. ---*/ + index = counter*Restart_Vars[1]; + Coord = &Restart_Data[index]; + + su2double GridVel[MAXNDIM] = {0.0}; + if (!steady_restart) { + /*--- Move the index forward to get the grid velocities. ---*/ + index += 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]); + } + } + + /*--- For static FSI problems, grid_movement is 0 but we need to read in and store the + grid coordinates for each node (but not the grid velocities, as there are none). ---*/ + + if (static_fsi && update_geo) { + /*--- Rewind the index to retrieve the Coords. ---*/ + index = counter*Restart_Vars[1]; + Coord = &Restart_Data[index]; + + for (iDim = 0; iDim < nDim; iDim++) { + geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]); + } + } + + /*--- Increment the overall counter for how many points have been loaded. ---*/ + counter++; + } + + } + + /*--- Detect a wrong solution file ---*/ + + if (counter != 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); + } + } // end SU2_OMP_MASTER + SU2_OMP_BARRIER + + /*--- Update the geometry for flows on deforming meshes ---*/ + + if ((dynamic_grid || static_fsi) && update_geo) { + + /*--- 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]->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 also 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); + + /*--- 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++) { + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { + Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint); + su2double Solution_Coarse[MAXNVAR] = {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_Coarse[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; + } + } + solver[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution_Coarse); + } + + solver[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); + solver[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); + + 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); + } + + /*--- Go back to single threaded execution. ---*/ + SU2_OMP_MASTER + { + /*--- Delete the class memory that is used to load the restart. ---*/ + + delete [] Restart_Vars; Restart_Vars = nullptr; + delete [] Restart_Data; Restart_Data = nullptr; + + } // end SU2_OMP_MASTER + SU2_OMP_BARRIER + +} + +template +void CFVMFlowSolverBase::LoadRestart(CGeometry **geometry, CSolver ***solver, + CConfig *config, int iter, bool update_geo) { + LoadRestart_impl(geometry, solver, config, iter, update_geo); +} + +template +void CFVMFlowSolverBase::SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, + CConfig *config, unsigned long TimeIter) { + + const bool restart = (config->GetRestart() || config->GetRestart_Flow()); + const bool rans = (config->GetKind_Turb_Model() != NONE); + const bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND)); + + /*--- Start OpenMP parallel region. ---*/ + + SU2_OMP_PARALLEL { + + unsigned long iPoint; + unsigned short iMesh; + + /*--- Check if a verification solution is to be computed. ---*/ + if ((VerificationSolution) && (TimeIter == 0) && !restart) { + + /*--- Loop over the multigrid levels. ---*/ + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + + /*--- Loop over all grid points. ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { + + /* Set the pointers to the coordinates and solution of this DOF. */ + const su2double *coor = geometry[iMesh]->nodes->GetCoord(iPoint); + su2double *solDOF = solver_container[iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint); + + /* Set the solution in this DOF to the initial condition provided by + the verification solution class. This can be the exact solution, + but this is not necessary. */ + VerificationSolution->GetInitialCondition(coor, solDOF); + } + } + } + + /*--- The value of the solution for the first iteration of the dual time ---*/ + + if (dual_time && (TimeIter == 0 || (restart && TimeIter == config->GetRestart_Iter()))) { + PushSolutionBackInTime(TimeIter, restart, rans, solver_container, geometry, config); + } + + } // end SU2_OMP_PARALLEL + +} + template void CFVMFlowSolverBase::PushSolutionBackInTime(unsigned long TimeIter, bool restart, bool rans, CSolver*** solver_container, CGeometry** geometry, @@ -1180,7 +1421,10 @@ void CFVMFlowSolverBase::BC_Fluid_Interface(CGeometry* geometry, /*--- Set the normal vector and the coordinates ---*/ visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Primitive variables, and gradient ---*/ @@ -1341,6 +1585,183 @@ void CFVMFlowSolverBase::SumEdgeFluxes(const CGeometry* geometry) { } } +template +void CFVMFlowSolverBase::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iRKStep, unsigned short iMesh, + unsigned short RunTime_EqSystem) { + /*--- Local variables ---*/ + + unsigned short iVar, iMarker, iDim, iNeigh; + unsigned long iPoint, jPoint, iEdge, iVertex; + + const su2double *U_time_nM1 = nullptr, *U_time_n = nullptr, *U_time_nP1 = nullptr; + su2double Volume_nM1, Volume_nP1, TimeStep; + const su2double *Normal = nullptr, *GridVel_i = nullptr, *GridVel_j = nullptr; + su2double Residual_GCL; + + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool first_order = (config->GetTime_Marching() == DT_STEPPING_1ST); + const bool second_order = (config->GetTime_Marching() == DT_STEPPING_2ND); + + /*--- 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) ---*/ + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- 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 (first_order) + LinSysRes(iPoint,iVar) += (U_time_nP1[iVar] - U_time_n[iVar])*Volume_nP1 / TimeStep; + if (second_order) + LinSysRes(iPoint,iVar) += ( 3.0*U_time_nP1[iVar] - 4.0*U_time_n[iVar] + +1.0*U_time_nM1[iVar])*Volume_nP1 / (2.0*TimeStep); + } + + /*--- Compute the Jacobian contribution due to the dual time source term. ---*/ + if (implicit) { + if (first_order) Jacobian.AddVal2Diag(iPoint, Volume_nP1/TimeStep); + if (second_order) Jacobian.AddVal2Diag(iPoint, (Volume_nP1*3.0)/(2.0*TimeStep)); + } + } + + } + + 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. ---*/ + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < nPointDomain; ++iPoint) { + + GridVel_i = geometry->nodes->GetGridVel(iPoint); + U_time_n = nodes->GetSolution_time_n(iPoint); + + for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) { + + iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); + Normal = geometry->edges->GetNormal(iEdge); + + jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); + GridVel_j = geometry->nodes->GetGridVel(jPoint); + + /*--- Determine whether to consider the normal outward or inward. ---*/ + su2double dir = (iPoint < jPoint)? 0.5 : -0.5; + + Residual_GCL = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Residual_GCL += dir*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; + + for (iVar = 0; iVar < nVar; iVar++) + LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL; + } + } + + /*--- 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)) { + + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + + /*--- 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++) + LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL; + } + } + } + + /*--- Loop over all nodes (excluding halos) to compute the remainder + of the dual time-stepping source term. ---*/ + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- 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 (first_order) + LinSysRes(iPoint,iVar) += (U_time_nP1[iVar] - U_time_n[iVar])*(Volume_nP1/TimeStep); + if (second_order) + LinSysRes(iPoint,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)); + } + + /*--- Compute the Jacobian contribution due to the dual time source term. ---*/ + if (implicit) { + if (first_order) Jacobian.AddVal2Diag(iPoint, Volume_nP1/TimeStep); + if (second_order) Jacobian.AddVal2Diag(iPoint, (Volume_nP1*3.0)/(2.0*TimeStep)); + } + } + } + +} + template void CFVMFlowSolverBase::Pressure_Forces(const CGeometry* geometry, const CConfig* config) { unsigned long iVertex, iPoint; @@ -1396,7 +1817,8 @@ void CFVMFlowSolverBase::Pressure_Forces(const CGeometry* geometr } } - factor = 1.0 / (0.5 * RefDensity * RefArea * RefVel2); + AeroCoeffForceRef = 0.5 * RefDensity * RefArea * RefVel2; + factor = 1.0 / AeroCoeffForceRef; /*--- Reference pressure is always the far-field value. ---*/ @@ -1599,7 +2021,7 @@ void CFVMFlowSolverBase::Pressure_Forces(const CGeometry* geometr auto Allreduce = [](su2double x) { su2double tmp = x; x = 0.0; - SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); return x; }; AllBoundInvCoeff.CD = Allreduce(AllBoundInvCoeff.CD); @@ -1636,7 +2058,7 @@ void CFVMFlowSolverBase::Pressure_Forces(const CGeometry* geometr su2double* buffer = new su2double[nMarkerMon]; auto Allreduce_inplace = [buffer](int size, su2double* x) { - SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); for (int i = 0; i < size; ++i) x[i] = buffer[i]; }; @@ -1702,57 +2124,18 @@ template void CFVMFlowSolverBase::Momentum_Forces(const CGeometry* geometry, const CConfig* config) { unsigned long iVertex, iPoint; unsigned short iDim, iMarker, Boundary, Monitoring, iMarker_Monitoring; - su2double factor, RefVel2 = 0.0, RefTemp, RefDensity = 0.0, Mach2Vel, Mach_Motion, MassFlow, Density; + su2double MassFlow, Density; const su2double *Normal = nullptr, *Coord = nullptr; string Marker_Tag, Monitoring_Tag; su2double AxiFactor; su2double Alpha = config->GetAoA() * PI_NUMBER / 180.0; su2double Beta = config->GetAoS() * PI_NUMBER / 180.0; - su2double RefArea = config->GetRefArea(); su2double RefLength = config->GetRefLength(); - su2double Gas_Constant = config->GetGas_ConstantND(); auto Origin = config->GetRefOriginMoment(0); bool axisymmetric = config->GetAxisymmetric(); - /// TODO: Move these ifs to specialized functions. - - if (FlowRegime == COMPRESSIBLE) { - /*--- Evaluate reference values for non-dimensionalization. - For dynamic meshes, use the motion Mach number as a reference value - for computing the force coefficients. Otherwise, use the freestream values, - which is the standard convention. ---*/ - - RefTemp = Temperature_Inf; - RefDensity = Density_Inf; - if (dynamic_grid) { - Mach2Vel = sqrt(Gamma * Gas_Constant * RefTemp); - Mach_Motion = config->GetMach_Motion(); - RefVel2 = (Mach_Motion * Mach2Vel) * (Mach_Motion * Mach2Vel); - } else { - RefVel2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim]; - } - } - - if (FlowRegime == INCOMPRESSIBLE) { - /*--- Evaluate reference values for non-dimensionalization. - For dimensional or non-dim based on initial values, use - the far-field state (inf). For a custom non-dim based - on user-provided reference values, use the ref values - to compute the forces. ---*/ - - if ((config->GetRef_Inc_NonDim() == DIMENSIONAL) || (config->GetRef_Inc_NonDim() == INITIAL_VALUES)) { - RefDensity = Density_Inf; - RefVel2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim]; - } else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) { - RefDensity = config->GetInc_Density_Ref(); - RefVel2 = config->GetInc_Velocity_Ref() * config->GetInc_Velocity_Ref(); - } - } - - factor = 1.0 / (0.5 * RefDensity * RefArea * RefVel2); + const su2double factor = 1.0 / AeroCoeffForceRef; /*-- Variables initialization ---*/ @@ -1920,7 +2303,7 @@ void CFVMFlowSolverBase::Momentum_Forces(const CGeometry* geometr auto Allreduce = [](su2double x) { su2double tmp = x; x = 0.0; - SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); return x; }; @@ -1957,7 +2340,7 @@ void CFVMFlowSolverBase::Momentum_Forces(const CGeometry* geometr su2double* buffer = new su2double[nMarkerMon]; auto Allreduce_inplace = [buffer](int size, su2double* x) { - SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); for (int i = 0; i < size; ++i) x[i] = buffer[i]; }; @@ -2027,8 +2410,8 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr unsigned long iVertex, iPoint, iPointNormal; unsigned short iMarker, iMarker_Monitoring, iDim, jDim; unsigned short T_INDEX = 0, TVE_INDEX = 0, VEL_INDEX = 0; - su2double Viscosity = 0.0, WallDist[3] = {0.0}, Area, TauNormal, RefTemp, RefVel2 = 0.0, dTn, dTven, - RefDensity = 0.0, GradTemperature, Density = 0.0, WallDistMod, FrictionVel, Mach2Vel, Mach_Motion, + su2double Viscosity = 0.0, WallDist[3] = {0.0}, Area, TauNormal, dTn, dTven, + GradTemperature, Density = 0.0, WallDistMod, FrictionVel, UnitNormal[3] = {0.0}, TauElem[3] = {0.0}, TauTangent[3] = {0.0}, Tau[3][3] = {{0.0}}, Cp, thermal_conductivity, MaxNorm = 8.0, Grad_Vel[3][3] = {{0.0}}, Grad_Temp[3] = {0.0}, AxiFactor; const su2double *Coord = nullptr, *Coord_Normal = nullptr, *Normal = nullptr; @@ -2037,7 +2420,6 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr su2double Alpha = config->GetAoA() * PI_NUMBER / 180.0; su2double Beta = config->GetAoS() * PI_NUMBER / 180.0; - su2double RefArea = config->GetRefArea(); su2double RefLength = config->GetRefLength(); su2double RefHeatFlux = config->GetHeat_Flux_Ref(); su2double Gas_Constant = config->GetGas_ConstantND(); @@ -2058,44 +2440,8 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr VEL_INDEX = nSpecies+2; } - /// TODO: Move these ifs to specialized functions. - - if (FlowRegime == COMPRESSIBLE) { - /*--- Evaluate reference values for non-dimensionalization. - For dynamic meshes, use the motion Mach number as a reference value - for computing the force coefficients. Otherwise, use the freestream values, - which is the standard convention. ---*/ - - RefTemp = Temperature_Inf; - RefDensity = Density_Inf; - if (dynamic_grid) { - Mach2Vel = sqrt(Gamma * Gas_Constant * RefTemp); - Mach_Motion = config->GetMach_Motion(); - RefVel2 = (Mach_Motion * Mach2Vel) * (Mach_Motion * Mach2Vel); - } else { - RefVel2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim]; - } - } - - if (FlowRegime == INCOMPRESSIBLE) { - /*--- Evaluate reference values for non-dimensionalization. - For dimensional or non-dim based on initial values, use - the far-field state (inf). For a custom non-dim based - on user-provided reference values, use the ref values - to compute the forces. ---*/ - - if ((config->GetRef_Inc_NonDim() == DIMENSIONAL) || (config->GetRef_Inc_NonDim() == INITIAL_VALUES)) { - RefDensity = Density_Inf; - RefVel2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim]; - } else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) { - RefDensity = config->GetInc_Density_Ref(); - RefVel2 = config->GetInc_Velocity_Ref() * config->GetInc_Velocity_Ref(); - } - } - - const su2double factor = 1.0 / (0.5 * RefDensity * RefArea * RefVel2); + const su2double factor = 1.0 / AeroCoeffForceRef; + const su2double factorFric = config->GetRefArea() * factor; /*--- Variables initialization ---*/ @@ -2199,7 +2545,7 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr WallShearStress[iMarker][iVertex] = 0.0; for (iDim = 0; iDim < nDim; iDim++) { TauTangent[iDim] = TauElem[iDim] - TauNormal * UnitNormal[iDim]; - CSkinFriction[iMarker][iDim][iVertex] = TauTangent[iDim] / (0.5 * RefDensity * RefVel2); + CSkinFriction[iMarker](iVertex,iDim) = TauTangent[iDim] * factorFric; WallShearStress[iMarker][iVertex] += TauTangent[iDim] * TauTangent[iDim]; } WallShearStress[iMarker][iVertex] = sqrt(WallShearStress[iMarker][iVertex]); @@ -2216,8 +2562,6 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr /*--- Compute total and maximum heat flux on the wall ---*/ - - /// TODO: Move these ifs to specialized functions. if (!nemo){ @@ -2384,7 +2728,7 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr auto Allreduce = [](su2double x) { su2double tmp = x; x = 0.0; - SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); return x; }; AllBoundViscCoeff.CD = Allreduce(AllBoundViscCoeff.CD); @@ -2423,7 +2767,7 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr su2double* buffer = new su2double[nMarkerMon]; auto Allreduce_inplace = [buffer](int size, su2double* x) { - SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); for (int i = 0; i < size; ++i) x[i] = buffer[i]; }; @@ -2443,8 +2787,8 @@ void CFVMFlowSolverBase::Friction_Forces(const CGeometry* geometr Allreduce_inplace(nMarkerMon, SurfaceViscCoeff.CMy); Allreduce_inplace(nMarkerMon, SurfaceViscCoeff.CMz); - Allreduce_inplace(nMarkerMon, Surface_HF_Visc); - Allreduce_inplace(nMarkerMon, Surface_MaxHF_Visc); + Allreduce_inplace(nMarkerMon, Surface_HF_Visc.data()); + Allreduce_inplace(nMarkerMon, Surface_MaxHF_Visc.data()); delete[] buffer; } diff --git a/SU2_CFD/include/solvers/CHeatSolver.hpp b/SU2_CFD/include/solvers/CHeatSolver.hpp index 004ebdf55f24..95b3a063b23d 100644 --- a/SU2_CFD/include/solvers/CHeatSolver.hpp +++ b/SU2_CFD/include/solvers/CHeatSolver.hpp @@ -2,7 +2,7 @@ * \file CHeatSolver.hpp * \brief Headers of the CHeatSolver class * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \class CHeatSolver * \brief Main class for defining the finite-volume heat solver. * \author O. Burghardt - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CHeatSolver final : public CSolver { protected: @@ -113,13 +113,6 @@ class CHeatSolver final : public CSolver { int val_iter, bool val_update_geo) override; - /*! - * \brief Compute the undivided laplacian for the solution. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - */ - void SetUndivided_Laplacian(CGeometry *geometry, CConfig *config); - /*! * \brief Compute the spatial integration using a centered scheme. * \param[in] geometry - Geometrical definition of the problem. diff --git a/SU2_CFD/include/solvers/CIncEulerSolver.hpp b/SU2_CFD/include/solvers/CIncEulerSolver.hpp index 85cd5b7805dc..b7e650d60876 100644 --- a/SU2_CFD/include/solvers/CIncEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CIncEulerSolver.hpp @@ -2,7 +2,7 @@ * \file CIncEulerSolver.hpp * \brief Headers of the CIncEulerSolver class * \author F. Palacios, T. Economon, T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -38,13 +38,86 @@ */ class CIncEulerSolver : 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. */ + vector FluidModel; /*!< \brief fluid model used in the solver. */ + StreamwisePeriodicValues SPvals; - CFluidModel *FluidModel = nullptr; /*!< \brief fluid model used in the solver */ - su2double **Preconditioner = nullptr; /*!< \brief Auxiliary matrix for storing the low speed preconditioner. */ + /*! + * \brief Preprocessing actions common to the Euler and NS solvers. + * \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 CommonPreprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, + unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output); + + /*! + * \brief Compute the preconditioner for low-Mach flows. + * \param[in] iPoint - Index of the grid point + * \param[in] config - Definition of the particular problem. + * \param[in] delta - Volume over delta time, does not matter for explicit. + * \param[out] preconditioner - The preconditioner matrix. + */ + void SetPreconditioner(const CConfig *config, unsigned long iPoint, + su2double delta, su2activematrix& preconditioner) const; + + /*! + * \brief Compute a pressure sensor switch. + * \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 SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config); + + /*! + * \brief Compute the max eigenvalue. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void SetMax_Eigenvalue(CGeometry *geometry, const CConfig *config); + + /*! + * \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. + * \return - The number of non-physical points. + */ + virtual unsigned long SetPrimitive_Variables(CSolver **solver_container, const CConfig *config); + + /*! + * \brief Update the Beta parameter for the incompressible preconditioner. + * \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 - current mesh level for the multigrid. + */ + void SetBeta_Parameter(CGeometry *geometry, + CSolver **solver_container, + CConfig *config, + unsigned short iMesh); + + /*! + * \brief A virtual member. + */ + void GetOutlet_Properties(CGeometry *geometry, + CConfig *config, + unsigned short iMesh, + bool Output); + + /*! + * \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); + + /*! + * \brief Generic implementation of explicit iterations with preconditioner. + */ + template + void Explicit_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep); public: /*! @@ -66,18 +139,11 @@ class CIncEulerSolver : public CFVMFlowSolverBase a,std::vector b); - /*! * \brief Update the solution using a Runge-Kutta scheme. * \param[in] geometry - Geometrical definition of the problem. @@ -289,6 +303,18 @@ class CIncEulerSolver : public CFVMFlowSolverBase { protected: @@ -46,8 +46,8 @@ class CNEMOEulerSolver : public CFVMFlowSolverBase Surface_Buffet_Metric; /*!< \brief Integrated separation sensor for each monitoring surface. */ + vector Buffet_Metric; /*!< \brief Integrated separation sensor for each boundary. */ + vector > Buffet_Sensor; /*!< \brief Separation sensor for each boundary and vertex. */ + su2double Total_Buffet_Metric = 0.0; /*!< \brief Integrated separation sensor for all the boundaries. */ /*! * \brief A virtual member. @@ -54,11 +54,10 @@ class CNSSolver final : public CEulerSolver { * \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) override; + const CConfig *config) override; /*! * \brief Common code for wall boundaries, add the residual and Jacobian @@ -97,6 +96,25 @@ class CNSSolver final : public CEulerSolver { unsigned short val_marker, bool cht_mode = false); + /*! + * \brief Compute the viscous contribution for a particular edge. + * \param[in] iEdge - Edge for which the flux and Jacobians are to be computed. + * \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 Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config) override; + + /*! + * \brief Computes the wall shear stress (Tau_Wall) on the surface using a wall function. + * \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 SetTauWall_WF(CGeometry *geometry, CSolver** solver_container, const CConfig* config); + public: /*! * \brief Constructor of the class. @@ -113,7 +131,7 @@ class CNSSolver final : public CEulerSolver { /*! * \brief Destructor of the class. */ - ~CNSSolver(void) override; + ~CNSSolver() = default; /*! * \brief Provide the buffet metric. @@ -205,17 +223,6 @@ class CNSSolver final : public CEulerSolver { */ void Buffet_Monitoring(const CGeometry *geometry, const CConfig *config) override; - /*! - * \brief Compute the viscous contribution for a particular edge. - * \param[in] iEdge - Edge for which the flux and Jacobians are to be computed. - * \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 Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, - CNumerics *numerics, CConfig *config) override; - /*! * \brief Get the value of the buffet sensor * \param[in] val_marker - Surface marker where the coefficient is computed. @@ -226,14 +233,4 @@ class CNSSolver final : public CEulerSolver { return Buffet_Sensor[val_marker][val_vertex]; } - /*! - * \brief Computes the wall shear stress (Tau_Wall) on the surface using a wall function. - * \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 SetTauWall_WF(CGeometry *geometry, - CSolver** solver_container, - CConfig* config) override; - }; diff --git a/SU2_CFD/include/solvers/CRadP1Solver.hpp b/SU2_CFD/include/solvers/CRadP1Solver.hpp index 88b34da2c5f7..1c2e144a6ea1 100644 --- a/SU2_CFD/include/solvers/CRadP1Solver.hpp +++ b/SU2_CFD/include/solvers/CRadP1Solver.hpp @@ -2,7 +2,7 @@ * \file CRadP1Solver.hpp * \brief Declaration and inlines of the class to compute a P1 radiation problem. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CRadSolver.hpp b/SU2_CFD/include/solvers/CRadSolver.hpp index 70f148da5d90..b3ab378c5291 100644 --- a/SU2_CFD/include/solvers/CRadSolver.hpp +++ b/SU2_CFD/include/solvers/CRadSolver.hpp @@ -2,7 +2,7 @@ * \file CRadSolver.hpp * \brief Declaration and inlines of the class to compute a generic radiation solver. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 37f615404dce..48e929d665cb 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -3,7 +3,7 @@ * \brief Headers of the CSolver class which is inherited by all of the other * solvers * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -133,8 +133,8 @@ class CSolver { bool dynamic_grid; /*!< \brief Flag that determines whether the grid is dynamic (moving or deforming + grid velocities). */ - su2double ***VertexTraction; /*- Temporary, this will be moved to a new postprocessing structure once in place -*/ - su2double ***VertexTractionAdjoint; /*- Also temporary -*/ + vector VertexTraction; /*- Temporary, this will be moved to a new postprocessing structure once in place -*/ + vector VertexTractionAdjoint; /*- Also temporary -*/ string SolverName; /*!< \brief Store the name of the solver for output purposes. */ @@ -151,6 +151,13 @@ class CSolver { */ inline void SetBaseClassPointerToNodes() { base_nodes = GetBaseClassPointerToNodes(); } + /*! + * \brief Compute the undivided laplacian for the solution variables. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + void SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config); + private: /*--- Private to prevent use by derived solvers, each solver MUST have its own "nodes" member of the @@ -307,13 +314,6 @@ class CSolver { */ inline virtual void SetDualTime_Mesh(void){ } - /*! - * \brief Set the solver nondimensionalization. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - Index of the mesh in multigrid computations. - */ - inline virtual void SetNondimensionalization(CConfig *config, unsigned short iMesh) { } - /*! * \brief Get information whether the initialization is an adjoint solver or not. * \return TRUE means that it is an adjoint solver. @@ -1526,16 +1526,29 @@ class CSolver { * \param[in] solver_container - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - inline virtual void ImplicitEuler_Iteration(CGeometry *geometry, - CSolver **solver_container, - CConfig *config) { } + inline virtual void PrepareImplicitIteration(CGeometry *geometry, + CSolver **solver_container, + CConfig *config) { } + + /*! + * \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. + */ + inline virtual void CompleteImplicitIteration(CGeometry *geometry, + CSolver **solver_container, + CConfig *config) { } /*! * \brief A virtual member. - * \param[in] solver - Container vector with all the solutions. + * \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. */ - inline virtual void ComputeUnderRelaxationFactor(CSolver **solver_container, const CConfig *config) { } + inline virtual void ImplicitEuler_Iteration(CGeometry *geometry, + CSolver **solver_container, + CConfig *config) { } /*! * \brief Adapt the CFL number based on the local under-relaxation parameters @@ -1557,7 +1570,7 @@ class CSolver { * \param[in] numerics - Numerical methods. * \param[in] config - Definition of the particular problem. */ - inline virtual void ImplicitNewmark_Iteration(CGeometry *geometry, + inline virtual void ImplicitNewmark_Iteration(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { } @@ -1567,8 +1580,8 @@ class CSolver { * \param[in] solver_container - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - inline virtual void ImplicitNewmark_Update(CGeometry *geometry, - CConfig *config) { } + inline virtual void ImplicitNewmark_Update(const CGeometry *geometry, + const CConfig *config) { } /*! * \brief A virtual member. @@ -1576,8 +1589,8 @@ class CSolver { * \param[in] solver_container - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - inline virtual void ImplicitNewmark_Relaxation(CGeometry *geometry, - CConfig *config) { } + inline virtual void ImplicitNewmark_Relaxation(const CGeometry *geometry, + const CConfig *config) { } /*! * \brief A virtual member. @@ -1585,7 +1598,7 @@ class CSolver { * \param[in] numerics - Numerical methods. * \param[in] config - Definition of the particular problem. */ - inline virtual void GeneralizedAlpha_Iteration(CGeometry *geometry, + inline virtual void GeneralizedAlpha_Iteration(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { } @@ -1595,8 +1608,8 @@ class CSolver { * \param[in] solver_container - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - inline virtual void GeneralizedAlpha_UpdateDisp(CGeometry *geometry, - CConfig *config) { } + inline virtual void GeneralizedAlpha_UpdateDisp(const CGeometry *geometry, + const CConfig *config) { } /*! * \brief A virtual member. @@ -1604,8 +1617,8 @@ class CSolver { * \param[in] solver_container - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - inline virtual void GeneralizedAlpha_UpdateSolution(CGeometry *geometry, - CConfig *config) { } + inline virtual void GeneralizedAlpha_UpdateSolution(const CGeometry *geometry, + const CConfig *config) { } /*! * \brief A virtual member. @@ -1613,7 +1626,7 @@ class CSolver { * \param[in] solver_container - Container vector with all the solutions. * \param[in] config - Definition of the particular problem. */ - inline virtual void GeneralizedAlpha_UpdateLoads(CGeometry *geometry, + inline virtual void GeneralizedAlpha_UpdateLoads(const CGeometry *geometry, const CConfig *config) { } /*! @@ -1667,13 +1680,6 @@ class CSolver { const CConfig *config, bool reconstruction = false) { } - /*! - * \brief A virtual member. - * \param[in] iPoint - Index of the grid point. - * \param[in] config - Definition of the particular problem. - */ - inline virtual void SetPreconditioner(CConfig *config, unsigned long iPoint) { } - /*! * \brief A virtual member. * \param[in] geometry - Geometrical definition of the problem. @@ -2235,18 +2241,6 @@ class CSolver { */ inline virtual su2double GetInflow_MassFlow(unsigned short val_marker) const { return 0; } - /*! - * \brief A virtual member. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - * \param[in] iMesh - current mesh level for the multigrid. - * \param[in] Output - boolean to determine whether to print output. - */ - inline virtual void GetOutlet_Properties(CGeometry *geometry, - CConfig *config, - unsigned short iMesh, - bool Output) { } - /*! * \brief A virtual member. * \param[in] config - Definition of the particular problem. @@ -2465,16 +2459,22 @@ class CSolver { inline virtual su2double GetTotal_OFVolFrac() const { return 0; } /*! - * \brief Retrieve the value of the discreteness objective function + * \brief Retrieve the value of the discreteness objective function. */ inline virtual su2double GetTotal_OFDiscreteness() const { return 0; } /*! * \brief A virtual member. - * \return Value of the objective function for the structural compliance. + * \return Value of the compliance objective function. */ inline virtual su2double GetTotal_OFCompliance() const { return 0; } + /*! + * \brief A virtual member. + * \return Value of the stress penalty objective function. + */ + inline virtual su2double GetTotal_OFStressPenalty() const { return 0; } + /*! * \brief A virtual member. * \return Bool that defines whether the solution has an element-based file or not @@ -2529,6 +2529,11 @@ class CSolver { */ inline virtual void SetTotal_CNearFieldOF(su2double val_cnearfieldpress) { } + /*! + * \brief Get the reference force used to compute CL, CD, etc. + */ + inline virtual su2double GetAeroCoeffsReferenceForce() const { return 0; } + /*! * \brief A virtual member. * \return Value of the lift coefficient (inviscid + viscous contribution). @@ -2984,7 +2989,7 @@ class CSolver { * \return Value of the pressure coefficient. */ inline virtual su2double *GetCharacPrimVar(unsigned short val_marker, - unsigned long val_vertex) const { return nullptr; } + unsigned long val_vertex) { return nullptr; } /*! * \brief A virtual member @@ -3778,7 +3783,7 @@ class CSolver { * \param[in] numerics - Description of the numerical method. * \param[in] config - Definition of the particular problem. */ - inline virtual void Compute_MassMatrix(CGeometry *geometry, + inline virtual void Compute_MassMatrix(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { } @@ -3788,7 +3793,7 @@ class CSolver { * \param[in] numerics - Description of the numerical method. * \param[in] config - Definition of the particular problem. */ - inline virtual void Compute_MassRes(CGeometry *geometry, + inline virtual void Compute_MassRes(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { } @@ -3925,7 +3930,7 @@ class CSolver { * \brief A virtual member. * \param[in] config - Definition of the particular problem. */ - inline virtual void SetFreeStream_Solution(CConfig *config) { } + inline virtual void SetFreeStream_Solution(const CConfig *config) { } /*! * \brief A virtual member. @@ -3937,29 +3942,6 @@ class CSolver { */ inline virtual unsigned long GetnDOFsGlobal(void) const { return 0; } - /*! - * \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. - */ - inline virtual void SetTauWall_WF(CGeometry *geometry, - CSolver** solver_container, - CConfig* config) { } - - /*! - * \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. - */ - inline virtual void SetNuTilde_WF(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. @@ -4314,18 +4296,6 @@ class CSolver { */ inline virtual void SetFreeStream_TurboSolution(CConfig *config) { } - /*! - * \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 - current mesh level for the multigrid. - */ - inline virtual void SetBeta_Parameter(CGeometry *geometry, - CSolver **solver_container, - CConfig *config, - unsigned short iMesh) { } - /*! * \brief A virtual member. * \param[in] geometry - Geometrical definition. @@ -4382,7 +4352,7 @@ class CSolver { * \param[in] geometry - Geometrical definition. * \param[in] config - Definition of the particular problem. */ - void ComputeVertexTractions(CGeometry *geometry, CConfig *config); + void ComputeVertexTractions(CGeometry *geometry, const CConfig *config); /*! * \brief Set the adjoints of the vertex tractions. @@ -4399,7 +4369,7 @@ class CSolver { * \param[in] geometry - Geometrical definition. * \param[in] config - Definition of the particular problem. */ - void RegisterVertexTractions(CGeometry *geometry, CConfig *config); + void RegisterVertexTractions(CGeometry *geometry, const CConfig *config); /*! * \brief Store the adjoints of the vertex tractions. @@ -4420,7 +4390,7 @@ class CSolver { * \param[in] geometry - Geometrical definition. * \param[in] config - Definition of the particular problem. */ - void SetVertexTractionsAdjoint(CGeometry *geometry, CConfig *config); + void SetVertexTractionsAdjoint(CGeometry *geometry, const CConfig *config); /*! * \brief Get minimun volume in the mesh @@ -4441,6 +4411,13 @@ class CSolver { */ inline virtual bool GetHasHybridParallel() const { return false; } + /*! + * \brief Get values for streamwise periodc flow: delta P, m_dot, inlet T, integrated heat. + * \return Struct holding 4 su2doubles. + */ + virtual StreamwisePeriodicValues GetStreamwisePeriodicValues() const { return StreamwisePeriodicValues(); } + + protected: /*! * \brief Allocate the memory for the verification solution, if necessary. diff --git a/SU2_CFD/include/solvers/CSolverFactory.hpp b/SU2_CFD/include/solvers/CSolverFactory.hpp index e7b470017859..6fa7ec0cfa84 100644 --- a/SU2_CFD/include/solvers/CSolverFactory.hpp +++ b/SU2_CFD/include/solvers/CSolverFactory.hpp @@ -66,6 +66,7 @@ enum class SUB_SOLVER_TYPE { enum class INTEGRATION_TYPE{ MULTIGRID, + NEWTON, SINGLEGRID, DEFAULT, FEM_DG, @@ -83,7 +84,7 @@ class CGeometry; class CConfig; class CSolverFactory { - + private: static map allocatedSolvers; @@ -99,10 +100,10 @@ class CSolverFactory { * \return - A pointer to the allocated turbulent solver */ static CSolver* CreateTurbSolver(ENUM_TURB_MODEL kindTurbModel, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, int adjoint); - + /*! - * \brief Create a heat solver - * \param[in] solver - The solver container + * \brief Create a heat solver + * \param[in] solver - The solver container * \param[in] geometry - The geometry definition * \param[in] config - The configuration * \param[in] iMGLevel - The multigrid level @@ -110,10 +111,10 @@ class CSolverFactory { * \return - A pointer to the allocated heat solver */ static CSolver* CreateHeatSolver(CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, bool adjoint); - + /*! - * \brief Create a mesh solver - * \param[in] solver - The solver container + * \brief Create a mesh solver + * \param[in] solver - The solver container * \param[in] geometry - The geometry definition * \param[in] config - The configuration * \param[in] iMGLevel - The multigrid level @@ -121,9 +122,9 @@ class CSolverFactory { * \return - A pointer to the allocated mesh solver */ static CSolver* CreateMeshSolver(CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, bool adjoint); - + /*! - * \brief Create a DG solver + * \brief Create a DG solver * \param[in] kindTurbModel - Kind of DG solver * \param[in] geometry - The geometry definition * \param[in] config - The configuration @@ -131,9 +132,9 @@ class CSolverFactory { * \return - A pointer to the allocated DG solver */ static CSolver* CreateDGSolver(SUB_SOLVER_TYPE kindDGSolver, CGeometry *geometry, CConfig *config, int iMGLevel); - + /*! - * \brief Create a flow solver + * \brief Create a flow solver * \param[in] kindFlowSolver - Kind of flow solver * \param[in] solver - The solver container * \param[in] geometry - The geometry definition @@ -143,28 +144,17 @@ class CSolverFactory { */ static CSolver* CreateFlowSolver(SUB_SOLVER_TYPE kindFlowSolver, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel); - /*! - * \brief Create a NEMO flow solver - * \param[in] kindNEMOSolver - Kind of flow solver - * \param[in] solver - The solver container - * \param[in] geometry - The geometry definition - * \param[in] config - The configuration - * \param[in] iMGLevel - The multigrid level - * \return - A pointer to the allocated flow solver - */ - static CSolver* CreateNEMOSolver(SUB_SOLVER_TYPE kindNEMOSolver, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel); - /*! - * \brief Generic routine to create a solver + * \brief Generic routine to create a solver * \param[in] kindSolver - Kind of solver - * \param[in] solver - The solver container + * \param[in] solver - The solver container * \param[in] geometry - The geometry definition * \param[in] config - The configuration * \param[in] iMGLevel - The multigrid level * \return - A pointer to the allocated solver */ static CSolver* CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel); - + public: /*! @@ -173,7 +163,7 @@ class CSolverFactory { CSolverFactory() = delete; /*! - * \brief Create the solver container by allocating the primary solver + * \brief Create the solver container by allocating the primary solver * and secondary solvers like heat solver, turbulent solver etc * \param[in] kindSolver - The kind of primary solver * \param[in] config - The configuration diff --git a/SU2_CFD/include/solvers/CTemplateSolver.hpp b/SU2_CFD/include/solvers/CTemplateSolver.hpp index db6c7601f7ec..395564f5201a 100644 --- a/SU2_CFD/include/solvers/CTemplateSolver.hpp +++ b/SU2_CFD/include/solvers/CTemplateSolver.hpp @@ -2,7 +2,7 @@ * \file CTemplateSolver.hpp * \brief Headers of the CTemplateSolver class * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CTransLMSolver.hpp b/SU2_CFD/include/solvers/CTransLMSolver.hpp index f60250a0b56f..d6120fc028d4 100644 --- a/SU2_CFD/include/solvers/CTransLMSolver.hpp +++ b/SU2_CFD/include/solvers/CTransLMSolver.hpp @@ -2,7 +2,7 @@ * \file CTransLMSolver.hpp * \brief Headers of the CTransLMSolver class * \author A. Aranake - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/solvers/CTurbSASolver.hpp b/SU2_CFD/include/solvers/CTurbSASolver.hpp index 23c819a5e62f..320cc5557153 100644 --- a/SU2_CFD/include/solvers/CTurbSASolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSASolver.hpp @@ -2,7 +2,7 @@ * \file CTurbSASolver.hpp * \brief Headers of the CTurbSASolver class * \author A. Bueno. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -51,11 +51,27 @@ class CTurbSASolver final : public CTurbSolver { CGeometry *geometry, CConfig *config); + /*! + * \brief Compute nu tilde from the wall functions. + * \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 SetNuTilde_WF(CGeometry *geometry, + CSolver **solver_container, + CNumerics *conv_numerics, + CNumerics *visc_numerics, + const CConfig *config, + unsigned short val_marker); + public: /*! * \brief Constructor of the class. */ - CTurbSASolver(void); + CTurbSASolver(); /*! * \overload @@ -69,7 +85,7 @@ class CTurbSASolver final : public CTurbSolver { /*! * \brief Destructor of the class. */ - ~CTurbSASolver(void) override; + ~CTurbSASolver() = default; /*! * \brief Restart residual and compute gradients. @@ -353,8 +369,10 @@ class CTurbSASolver final : public CTurbSolver { * \brief Set the solution using the Freestream values. * \param[in] config - Definition of the particular problem. */ - inline void SetFreeStream_Solution(CConfig *config) override { - for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) nodes->SetSolution(iPoint, 0, nu_tilde_Inf); + inline void SetFreeStream_Solution(const CConfig *config) override { + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + nodes->SetSolution(iPoint, 0, nu_tilde_Inf); } /*! @@ -400,19 +418,4 @@ class CTurbSASolver final : public CTurbSolver { */ inline su2double GetNuTilde_Inf(void) const override { return nu_tilde_Inf; } - /*! - * \brief Compute nu tilde from the wall functions. - * \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 SetNuTilde_WF(CGeometry *geometry, - CSolver **solver_container, - CNumerics *conv_numerics, - CNumerics *visc_numerics, - CConfig *config, - unsigned short val_marker) override; }; diff --git a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp index a1f7df67848d..7d38a8050aa3 100644 --- a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp @@ -2,7 +2,7 @@ * \file CTurbSSTSolver.hpp * \brief Headers of the CTurbSSTSolver class * \author A. Campos, F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -59,7 +59,7 @@ class CTurbSSTSolver final : public CTurbSolver { /*! * \brief Destructor of the class. */ - ~CTurbSSTSolver(void) override; + ~CTurbSSTSolver() = default; /*! * \brief Restart residual and compute gradients. @@ -239,7 +239,8 @@ class CTurbSSTSolver final : public CTurbSolver { * \brief Set the solution using the Freestream values. * \param[in] config - Definition of the particular problem. */ - inline void SetFreeStream_Solution(CConfig *config) override { + inline void SetFreeStream_Solution(const CConfig *config) override { + SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){ nodes->SetSolution(iPoint, 0, kine_Inf); nodes->SetSolution(iPoint, 1, omega_Inf); diff --git a/SU2_CFD/include/solvers/CTurbSolver.hpp b/SU2_CFD/include/solvers/CTurbSolver.hpp index cc75f2527f87..31882562bcd3 100644 --- a/SU2_CFD/include/solvers/CTurbSolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSolver.hpp @@ -2,7 +2,7 @@ * \file CTurbSolver.hpp * \brief Headers of the CTurbSolver class * \author A. Bueno. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -52,13 +52,13 @@ class CTurbSolver : public CSolver { lowerlimit[MAXNVAR] = {0.0}, /*!< \brief contains lower limits for turbulence variables. */ upperlimit[MAXNVAR] = {0.0}, /*!< \brief contains upper limits for turbulence variables. */ Gamma, /*!< \brief Fluid's Gamma constant (ratio of specific heats). */ - Gamma_Minus_One, /*!< \brief Fluids's Gamma - 1.0 . */ - ***Inlet_TurbVars = nullptr; /*!< \brief Turbulence variables at inlet profiles */ + Gamma_Minus_One; /*!< \brief Fluids's Gamma - 1.0 . */ + vector Inlet_TurbVars; /*!< \brief Turbulence variables at inlet profiles */ /*--- Sliding meshes variables. ---*/ - su2double ****SlidingState = nullptr; - int **SlidingStateNodes = nullptr; + vector > SlidingState; // vector of matrix of pointers... inner dim alloc'd elsewhere (welcome, to the twilight zone) + vector > SlidingStateNodes; /*--- Shallow copy of grid coloring for OpenMP parallelization. ---*/ @@ -107,6 +107,13 @@ class CTurbSolver : public CSolver { */ void SumEdgeFluxes(CGeometry* geometry); + /*! + * \brief Compute a suitable under-relaxation parameter to limit the change in the solution variables over + * a nonlinear iteration for stability. + * \param[in] config - Definition of the particular problem. + */ + void ComputeUnderRelaxationFactor(const CConfig *config); + public: /*! @@ -242,6 +249,22 @@ class CTurbSolver : public CSolver { CNumerics *visc_numerics, CConfig *config) final; + /*! + * \brief Prepare an implicit iteration. + * \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 PrepareImplicitIteration(CGeometry *geometry, CSolver** solver_container, CConfig *config) final; + + /*! + * \brief Complete an implicit iteration. + * \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 CompleteImplicitIteration(CGeometry *geometry, CSolver** solver_container, CConfig *config) final; + /*! * \brief Update the solution using an implicit solver. * \param[in] geometry - Geometrical definition of the problem. @@ -251,6 +274,7 @@ class CTurbSolver : public CSolver { void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) override; + /*! * \brief Set the total residual adding the term that comes from the Dual Time-Stepping Strategy. * \param[in] geometry - Geometric definition of the problem. @@ -267,13 +291,6 @@ class CTurbSolver : public CSolver { unsigned short iMesh, unsigned short RunTime_EqSystem) final; - /*! - * \brief Compute a suitable under-relaxation parameter to limit the change in the solution variables over a nonlinear iteration for stability. - * \param[in] solver - Container vector with all the solutions. - * \param[in] config - Definition of the particular problem. - */ - void ComputeUnderRelaxationFactor(CSolver **solver, const CConfig *config) final; - /*! * \brief Load a solution from a restart file. * \param[in] geometry - Geometrical definition of the problem. @@ -371,8 +388,6 @@ class CTurbSolver : public CSolver { * checking to prevent segmentation faults ---*/ if (val_marker >= nMarker) SU2_MPI::Error("Out-of-bounds marker index used on inlet.", CURRENT_FUNCTION); - else if (Inlet_TurbVars == nullptr || Inlet_TurbVars[val_marker] == nullptr) - SU2_MPI::Error("Tried to set custom inlet BC on an invalid marker.", CURRENT_FUNCTION); else if (val_vertex >= nVertex[val_marker]) SU2_MPI::Error("Out-of-bounds vertex index used on inlet.", CURRENT_FUNCTION); else if (val_dim >= nVar) diff --git a/SU2_CFD/include/task_definition.hpp b/SU2_CFD/include/task_definition.hpp index ef6318e051b8..fa6aef1f99de 100644 --- a/SU2_CFD/include/task_definition.hpp +++ b/SU2_CFD/include/task_definition.hpp @@ -2,7 +2,7 @@ * \file task_definition.hpp * \brief Header of the task definition class for the SU2 solvers. * \author E. van der Weide, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -37,7 +37,7 @@ using namespace std; * \class CTaskDefinition * \brief Class for defining a task to be carried out * \author: E. van der Weide, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CTaskDefinition { diff --git a/SU2_CFD/include/task_definition.inl b/SU2_CFD/include/task_definition.inl index 2d95de81dc16..8482ab72a0bb 100644 --- a/SU2_CFD/include/task_definition.inl +++ b/SU2_CFD/include/task_definition.inl @@ -2,7 +2,7 @@ * \file task_definition.inl * \brief In-Line subroutines of the task_definition.hpp file. * \author E. van der Weide, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CAdjEulerVariable.hpp b/SU2_CFD/include/variables/CAdjEulerVariable.hpp index abd52c138c24..448f9763e021 100644 --- a/SU2_CFD/include/variables/CAdjEulerVariable.hpp +++ b/SU2_CFD/include/variables/CAdjEulerVariable.hpp @@ -2,7 +2,7 @@ * \file CAdjEulerVariable.hpp * \brief Main class for defining the variables of the adjoint Euler solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -102,6 +102,32 @@ class CAdjEulerVariable : public CVariable { for (unsigned long iVar = 0; iVar < nVar; iVar++) IntBoundary_Jump(iPoint,iVar) = val_IntBoundary_Jump[iVar]; } + /*! + * \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+1) = val_velocity[iDim]*Solution(iPoint,0); + } + + /*! + * \brief Set the momentum part of the truncation error to zero. + * \param[in] iPoint - Point index. + */ + inline void SetVel_ResTruncError_Zero(unsigned long iPoint) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,iDim+1) = 0.0; + } + + /*! + * \brief Specify a vector to set the velocity components of the solution. Multiplied by density for compressible cases. + * \param[in] iPoint - Point index. + * \param[in] val_vector - Pointer to the vector. + */ + inline void SetVelSolutionVector(unsigned long iPoint, const su2double *val_vector) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint, iDim+1) = GetDensity(iPoint) * val_vector[iDim]; + } + /*! * \brief Get the value of the force projection vector. * \return Pointer to the force projection vector. diff --git a/SU2_CFD/include/variables/CAdjNSVariable.hpp b/SU2_CFD/include/variables/CAdjNSVariable.hpp index 83f2c9807f75..cb16c06e5163 100644 --- a/SU2_CFD/include/variables/CAdjNSVariable.hpp +++ b/SU2_CFD/include/variables/CAdjNSVariable.hpp @@ -2,7 +2,7 @@ * \file CAdjNSVariable.hpp * \brief Main class for defining the variables of the adjoint Navier-Stokes solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CAdjTurbVariable.hpp b/SU2_CFD/include/variables/CAdjTurbVariable.hpp index 19a5cc6a6894..0c0cf142add7 100644 --- a/SU2_CFD/include/variables/CAdjTurbVariable.hpp +++ b/SU2_CFD/include/variables/CAdjTurbVariable.hpp @@ -2,7 +2,7 @@ * \file CAdjTurbVariable.hpp * \brief Main class for defining the variables of the adjoint turbulence model. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CBaselineVariable.hpp b/SU2_CFD/include/variables/CBaselineVariable.hpp index be8a1be63480..5cd095e76353 100644 --- a/SU2_CFD/include/variables/CBaselineVariable.hpp +++ b/SU2_CFD/include/variables/CBaselineVariable.hpp @@ -2,7 +2,7 @@ * \file CBaselineVariable.hpp * \brief Main class for defining the variables of a baseline solution from a restart file (for output). * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp index 64226c00dac6..b8d4973cd51f 100644 --- a/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjFEABoundVariable.hpp @@ -2,7 +2,7 @@ * \file CDiscAdjFEABoundVariable.hpp * \brief Main class for defining the variables of the adjoint FEA solver at the boundary. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -35,7 +35,7 @@ * \brief Main class for defining the variables on the FEA boundaries for adjoint applications. * \ingroup Discrete_Adjoint * \author R. Sanchez. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CDiscAdjFEABoundVariable final : public CDiscAdjFEAVariable { private: diff --git a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp index 0d3d0ef806ad..94dd8162c8d7 100644 --- a/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjFEAVariable.hpp @@ -2,7 +2,7 @@ * \file CDiscAdjFEAVariable.hpp * \brief Main class for defining the variables of the adjoint FEA solver. * \author T. Albring, R. Sanchez. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Main class for defining the variables of the adjoint solver. * \ingroup Discrete_Adjoint * \author T. Albring, R. Sanchez. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CDiscAdjFEAVariable : public CVariable { protected: diff --git a/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp b/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp index d6cc480306f7..f994925578ea 100644 --- a/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjMeshBoundVariable.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class * to define the adjoint variables of the mesh movement. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CDiscAdjVariable.hpp b/SU2_CFD/include/variables/CDiscAdjVariable.hpp index b4f5b332316e..ed043787fccc 100644 --- a/SU2_CFD/include/variables/CDiscAdjVariable.hpp +++ b/SU2_CFD/include/variables/CDiscAdjVariable.hpp @@ -2,7 +2,7 @@ * \file CDiscAdjVariable.hpp * \brief Main class for defining the variables of the adjoint solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index 846ed4b867ec..3f7a02735d46 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -2,7 +2,7 @@ * \file CEulerVariable.hpp * \brief Class for defining the variables of the compressible Euler solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -57,6 +57,10 @@ class CEulerVariable : public CVariable { MatrixType Solution_New; /*!< \brief New solution container for Classical RK4. */ + /*--- NS Variables declared here to make it easier to re-use code between compressible and incompressible solvers. ---*/ + MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ + VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + public: /*! * \brief Constructor of the class. @@ -424,6 +428,14 @@ class CEulerVariable : public CVariable { Solution_Old(iPoint,iDim+1) = val_velocity[iDim]*Solution(iPoint,0); } + /*! + * \brief Set the momentum part of the truncation error to zero. + * \param[in] iPoint - Point index. + */ + inline void SetVel_ResTruncError_Zero(unsigned long iPoint) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,iDim+1) = 0.0; + } + /*! * \brief Set the harmonic balance source term. * \param[in] iVar - Index of the variable. @@ -470,4 +482,26 @@ class CEulerVariable : public CVariable { WindGustDer(iPoint,iDim) = val_WindGustDer[iDim]; } + /*! + * \brief Get the value of the vorticity. + * \return Value of the vorticity. + */ + inline su2double *GetVorticity(unsigned long iPoint) final { 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 final { return StrainMag(iPoint); } + inline su2activevector& GetStrainMag() { return StrainMag; } + + /*! + * \brief Specify a vector to set the velocity components of the solution. Multiplied by density for compressible cases. + * \param[in] iPoint - Point index. + * \param[in] val_vector - Pointer to the vector. + */ + inline void SetVelSolutionVector(unsigned long iPoint, const su2double *val_vector) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint, iDim+1) = GetDensity(iPoint) * val_vector[iDim]; + } + }; diff --git a/SU2_CFD/include/variables/CFEABoundVariable.hpp b/SU2_CFD/include/variables/CFEABoundVariable.hpp index 37109f9867d6..ee229b32e669 100644 --- a/SU2_CFD/include/variables/CFEABoundVariable.hpp +++ b/SU2_CFD/include/variables/CFEABoundVariable.hpp @@ -2,7 +2,7 @@ * \file CFEABoundVariable.hpp * \brief Class for defining the variables on the FEA boundaries for FSI applications. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -37,7 +37,7 @@ * A map is constructed so that variables can be referenced by iPoint instead of iVertex. * \ingroup Structural Finite Element Analysis Variables * \author R. Sanchez. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEABoundVariable final : public CFEAVariable { protected: diff --git a/SU2_CFD/include/variables/CFEAVariable.hpp b/SU2_CFD/include/variables/CFEAVariable.hpp index c5890fad7b37..dbaa82b30545 100644 --- a/SU2_CFD/include/variables/CFEAVariable.hpp +++ b/SU2_CFD/include/variables/CFEAVariable.hpp @@ -2,7 +2,7 @@ * \file CFEAVariable.hpp * \brief Class for defining the variables of the FEM structural problem. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,7 +34,7 @@ * \brief Class for defining the variables of the FEM structural problem. * \ingroup Structural Finite Element Analysis Variables * \author F. Palacios, R. Sanchez. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CFEAVariable : public CVariable { protected: @@ -251,13 +251,6 @@ class CFEAVariable : public CVariable { */ inline su2double *GetSolution_Accel_time_n(unsigned long iPoint) final { return Solution_Accel_time_n[iPoint]; } - /*! - * \brief Set the value of the solution predictor. - */ - inline void SetSolution_Pred(unsigned long iPoint) final { - for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred(iPoint,iVar) = Solution(iPoint,iVar); - } - /*! * \brief Set the value of the old solution. * \param[in] val_solution_pred - Pointer to the residual vector. @@ -266,34 +259,11 @@ class CFEAVariable : public CVariable { for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred(iPoint,iVar) = val_solution_pred[iVar]; } - /*! - * \brief Set the value of the predicted solution. - * \param[in] iVar - Index of the variable - * \param[in] val_solution_pred - Value of the predicted solution. - */ - inline void SetSolution_Pred(unsigned long iPoint, unsigned long iVar, su2double val_solution_pred) final { - Solution_Pred(iPoint,iVar) = val_solution_pred; - } - - /*! - * \brief Get the value of the solution predictor. - * \param[in] iVar - Index of the variable. - * \return Pointer to the old solution vector. - */ - inline su2double GetSolution_Pred(unsigned long iPoint, unsigned long iVar) const final { return Solution_Pred(iPoint,iVar); } - /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ - inline su2double *GetSolution_Pred(unsigned long iPoint) final { return Solution_Pred[iPoint]; } - - /*! - * \brief Set the value of the solution predictor. - */ - inline void SetSolution_Pred_Old(unsigned long iPoint) final { - for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred_Old(iPoint,iVar) = Solution_Pred(iPoint,iVar); - } + inline const su2double *GetSolution_Pred(unsigned long iPoint) const final { return Solution_Pred[iPoint]; } /*! * \brief Set the value of the old solution. @@ -303,29 +273,11 @@ class CFEAVariable : public CVariable { for (unsigned long iVar = 0; iVar < nVar; iVar++) Solution_Pred_Old(iPoint,iVar) = val_solution_pred_old[iVar]; } - /*! - * \brief A virtual member. Set the value of the old solution predicted. - * \param[in] iVar - Index of the variable - * \param[in] val_solution_pred_old - Value of the old predicted solution. - */ - inline void SetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar, su2double val_solution_pred_old) final { - Solution_Pred_Old(iPoint,iVar) = val_solution_pred_old; - } - - /*! - * \brief Get the value of the solution predictor. - * \param[in] iVar - Index of the variable. - * \return Pointer to the old solution vector. - */ - inline su2double GetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar) const final { - return Solution_Pred_Old(iPoint,iVar); - } - /*! * \brief Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ - inline su2double *GetSolution_Pred_Old(unsigned long iPoint) final { return Solution_Pred_Old[iPoint]; } + inline const su2double *GetSolution_Pred_Old(unsigned long iPoint) const final { return Solution_Pred_Old[iPoint]; } /*! * \brief A virtual member. @@ -367,14 +319,7 @@ class CFEAVariable : public CVariable { /*! * \brief Get the pointer to the reference geometry */ - inline su2double *GetReference_Geometry(unsigned long iPoint) final { return Reference_Geometry[iPoint]; } - - /*! - * \brief Get the value of the reference geometry for the coordinate iVar - */ - inline su2double GetReference_Geometry(unsigned long iPoint, unsigned long iVar) const final { - return Reference_Geometry(iPoint,iVar); - } + inline const su2double* GetReference_Geometry(unsigned long iPoint) const final { return Reference_Geometry[iPoint]; } /*! * \brief Register the variables in the solution time_n array as input/output variable. diff --git a/SU2_CFD/include/variables/CHeatVariable.hpp b/SU2_CFD/include/variables/CHeatVariable.hpp index a69a05c57baa..92474870a6b6 100644 --- a/SU2_CFD/include/variables/CHeatVariable.hpp +++ b/SU2_CFD/include/variables/CHeatVariable.hpp @@ -2,7 +2,7 @@ * \file CHeatVariable.hpp * \brief Class for defining the variables of the finite-volume heat equation solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -33,7 +33,7 @@ * \class CHeatVariable * \brief Class for defining the variables of the finite-volume heat equation solver. * \author O. Burghardt - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" */ class CHeatVariable final : public CVariable { protected: diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index a5838ec9e0df..c736555483d3 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -2,7 +2,7 @@ * \file CIncEulerVariable.hpp * \brief Class for defining the variables of the incompressible Euler solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -40,13 +40,19 @@ class CIncEulerVariable : public CVariable { static constexpr size_t MAXNVAR = 12; 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. */ + 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). */ + MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (P, vx, vy, vz, T, rho, beta). */ + + /*--- NS Variables declared here to make it easier to re-use code between compressible and incompressible solvers. ---*/ + MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ + VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + + VectorType Streamwise_Periodic_RecoveredPressure, /*!< \brief Recovered/Physical pressure [Pa] for streamwise periodic flow. */ + Streamwise_Periodic_RecoveredTemperature; /*!< \brief Recovered/Physical temperature [K] for streamwise periodic flow. */ public: /*! @@ -289,12 +295,6 @@ class CIncEulerVariable : public CVariable { */ inline su2double GetDensity(unsigned long iPoint) const final { return Primitive(iPoint,nDim+2); } - /*! - * \brief Get the density of the flow from the previous iteration. - * \return Old value of the density of the flow. - */ - inline su2double GetDensity_Old(unsigned long iPoint) const final { return Density_Old(iPoint); } - /*! * \brief Get the temperature of the flow. * \return Value of the temperature of the flow. @@ -329,6 +329,14 @@ class CIncEulerVariable : public CVariable { Solution_Old(iPoint,iDim+1) = val_velocity[iDim]; } + /*! + * \brief Set the momentum part of the truncation error to zero. + * \param[in] iPoint - Point index. + */ + inline void SetVel_ResTruncError_Zero(unsigned long iPoint) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,iDim+1) = 0.0; + } + /*! * \brief Set all the primitive variables for incompressible flows. */ @@ -356,4 +364,62 @@ class CIncEulerVariable : public CVariable { */ inline su2double GetSpecificHeatCv(unsigned long iPoint) const final { return Primitive(iPoint, nDim+8); } + /*! + * \brief Get the value of the vorticity. + * \return Value of the vorticity. + */ + inline su2double *GetVorticity(unsigned long iPoint) final { 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 final { return StrainMag(iPoint); } + inline su2activevector& GetStrainMag() { return StrainMag; } + + /*! + * \brief Set the recovered pressure for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \param[in] val_pressure - pressure value. + */ + inline void SetStreamwise_Periodic_RecoveredPressure(unsigned long iPoint, su2double val_pressure) final { + Streamwise_Periodic_RecoveredPressure(iPoint) = val_pressure; + } + + /*! + * \brief Get the recovered pressure for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \return Recovered/Physical pressure for streamwise periodic flow. + */ + inline su2double GetStreamwise_Periodic_RecoveredPressure(unsigned long iPoint) const final { + return Streamwise_Periodic_RecoveredPressure(iPoint); + } + + /*! + * \brief Set the recovered temperature for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \param[in] val_temperature - temperature value. + */ + inline void SetStreamwise_Periodic_RecoveredTemperature(unsigned long iPoint, su2double val_temperature) final { + Streamwise_Periodic_RecoveredTemperature(iPoint) = val_temperature; + } + + /*! + * \brief Get the recovered temperature for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \return Recovered/Physical temperature for streamwise periodic flow. + */ + inline su2double GetStreamwise_Periodic_RecoveredTemperature(unsigned long iPoint) const final { + return Streamwise_Periodic_RecoveredTemperature(iPoint); + } + + /*! + * \brief Specify a vector to set the velocity components of the solution. + * \param[in] iPoint - Point index. + * \param[in] val_vector - Pointer to the vector. + */ + inline void SetVelSolutionVector(unsigned long iPoint, const su2double *val_vector) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint, iDim+1) = val_vector[iDim]; + } + }; diff --git a/SU2_CFD/include/variables/CIncNSVariable.hpp b/SU2_CFD/include/variables/CIncNSVariable.hpp index 4e4d33df4d48..37d376babdff 100644 --- a/SU2_CFD/include/variables/CIncNSVariable.hpp +++ b/SU2_CFD/include/variables/CIncNSVariable.hpp @@ -3,11 +3,11 @@ * \brief Class for defining the variables of the incompressible Navier-Stokes solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * - * The SU2 Project is maintained by the SU2 Foundation + * The SU2 Project is maintained by the SU2 Foundation * (http://su2foundation.org) * * Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) @@ -38,9 +38,6 @@ */ class CIncNSVariable final : public CIncEulerVariable { private: - MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ - VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ - VectorType DES_LengthScale; public: @@ -69,11 +66,6 @@ class CIncNSVariable final : public CIncEulerVariable { Primitive(iPoint,nDim+4) = laminarViscosity; } - /*! - * \brief Set the vorticity value. - */ - bool SetVorticity_StrainMag() override; - /*! * \overload * \param[in] eddy_visc - Value of the eddy viscosity. @@ -107,18 +99,6 @@ class CIncNSVariable final : public CIncEulerVariable { */ inline su2double GetThermalConductivity(unsigned long iPoint) const override { return Primitive(iPoint,nDim+6); } - /*! - * \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 all the primitive variables for incompressible flows */ diff --git a/SU2_CFD/include/variables/CMeshBoundVariable.hpp b/SU2_CFD/include/variables/CMeshBoundVariable.hpp index 43ef5eba4b44..2300bf4c1f94 100644 --- a/SU2_CFD/include/variables/CMeshBoundVariable.hpp +++ b/SU2_CFD/include/variables/CMeshBoundVariable.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class * to define the variables of the mesh movement at the moving boundaries. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CMeshElement.hpp b/SU2_CFD/include/variables/CMeshElement.hpp index 790c26a2c9cb..4ed2e4906f53 100644 --- a/SU2_CFD/include/variables/CMeshElement.hpp +++ b/SU2_CFD/include/variables/CMeshElement.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class * to define the variables of the mesh movement. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CMeshVariable.hpp b/SU2_CFD/include/variables/CMeshVariable.hpp index 71f68f6e6ff1..d242ba161dca 100644 --- a/SU2_CFD/include/variables/CMeshVariable.hpp +++ b/SU2_CFD/include/variables/CMeshVariable.hpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class * to define the variables of the mesh movement. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CNEMOEulerVariable.hpp b/SU2_CFD/include/variables/CNEMOEulerVariable.hpp index 9e29f47ed552..2d8596f94f35 100644 --- a/SU2_CFD/include/variables/CNEMOEulerVariable.hpp +++ b/SU2_CFD/include/variables/CNEMOEulerVariable.hpp @@ -1,579 +1,597 @@ -/*! - * \file CNEMOEulerVariable.hpp - * \brief Class for defining the variables of the compressible NEMO Euler solver. - * \author C. Garbacz, W. Maier, S.R. Copeland - * \version 7.1.0 "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 "CVariable.hpp" -#include "../fluid/CNEMOGas.hpp" - -/*! - * \class CNEMOEulerVariable - * \brief Main class for defining the variables of the NEMO Euler's solver. - * \ingroup Euler_Equations - * \author S. R. Copeland, F. Palacios, W. Maier, C. Garbacz - * \version 7.0.8 - */ -class CNEMOEulerVariable : public CVariable { -public: - static constexpr size_t MAXNVAR = 25; - -protected: - - bool ionization; /*!< \brief Presence of charged species in gas mixture. */ - bool monoatomic = false; /*!< \brief Presence of single species gas. */ - - VectorType Velocity2; /*!< \brief Square of the velocity vector. */ - MatrixType Precond_Beta; /*!< \brief Low Mach number preconditioner value, Beta. */ - - CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the conservative variables for MUSCL reconstruction for the convective term */ - CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */ - - /*--- Primitive variable definition ---*/ - MatrixType Primitive; /*!< \brief Primitive variables (rhos_s, T, Tve, ...) in compressible flows. */ - MatrixType Primitive_Aux; /*!< \brief Primitive auxiliary variables (Y_s, T, Tve, ...) in compressible flows. */ - CVectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (rhos_s, T, Tve, ...). */ - MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (rhos_s, T, Tve, ...). */ - - /*--- Secondary variable definition ---*/ - MatrixType Secondary; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ - CVectorOfMatrix Gradient_Secondary; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ - - /*--- New solution container for Classical RK4 ---*/ - MatrixType Solution_New; /*!< \brief New solution container for Classical RK4. */ - - /*--- Other Necessary Variable Definition ---*/ - MatrixType dPdU; /*!< \brief Partial derivative of pressure w.r.t. conserved variables. */ - MatrixType dTdU; /*!< \brief Partial derivative of temperature w.r.t. conserved variables. */ - MatrixType dTvedU; /*!< \brief Partial derivative of vib.-el. temperature w.r.t. conserved variables. */ - MatrixType eves; /*!< \brief energy of vib-el mode w.r.t. species. */ - MatrixType Cvves; /*!< \brief Specific heat of vib-el mode w.r.t. species. */ - VectorType Gamma; /*!< \brief Ratio of specific heats. */ - - CNEMOGas *fluidmodel; - - /*!< \brief Index definition for NEMO pritimive variables. */ - unsigned long RHOS_INDEX, T_INDEX, TVE_INDEX, VEL_INDEX, P_INDEX, - RHO_INDEX, H_INDEX, A_INDEX, RHOCVTR_INDEX, RHOCVVE_INDEX, - LAM_VISC_INDEX, EDDY_VISC_INDEX, nSpecies; - - su2double Tve_Freestream; /*!< \brief Freestream vib-el temperature. */ - -public: - - /*! - * \brief Constructor of the class. - * \param[in] val_pressure - Value of the flow pressure (initialization value). - * \param[in] val_massfrac - Value of the mass fraction (initialization value). - * \param[in] val_mach - Value of the Mach number (initialization value). - * \param[in] val_temperature - Value of the flow temperature (initialization value). - * \param[in] val_temperature_ve - Value of the flow temperature_ve (initialization value). - * \param[in] npoint - Number of points/nodes/vertices in the domain. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of conserved variables. - * \param[in] val_nVarPrim - Number of primitive variables. - * \param[in] val_nVarPrimGrad - Number of primitive gradient variables. - * \param[in] config - Definition of the particular problem. - */ - CNEMOEulerVariable(su2double val_pressure, const su2double *val_massfrac, - su2double *val_mach, su2double val_temperature, - su2double val_temperature_ve, unsigned long npoint, - unsigned long ndim, - unsigned long nvar, unsigned long nvalprim, - unsigned long nvarprimgrad, CConfig *config, CNEMOGas *fluidmodel); - - /*! - * \brief Destructor of the class. - */ - ~CNEMOEulerVariable() override = default; - - /*---------------------------------------*/ - /*--- U,V,S Routines ---*/ - /*---------------------------------------*/ - - /*! - * \brief Get the new solution of the problem (Classical RK4). - * \param[in] iVar - Index of the variable. - * \return Pointer to the old solution vector. - */ - inline su2double GetSolution_New(unsigned long iPoint, unsigned long iVar) const final { return Solution_New(iPoint,iVar); } - - /*! - * \brief Set the new solution container for Classical RK4. - */ - void SetSolution_New() final; - - /*! - * \brief Add a value to the new solution container for Classical RK4. - * \param[in] iVar - Number of the variable. - * \param[in] val_solution - Value that we want to add to the solution. - */ - inline void AddSolution_New(unsigned long iPoint, unsigned long iVar, su2double val_solution) final { - Solution_New(iPoint,iVar) += val_solution; - } - - /*! - * \brief Set the value of the primitive variables. - * \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) override { Primitive(iPoint,iVar) = val_prim; } - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_prim - Primitive variables. - * \return Set the value of the primitive variable for the index 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 limiter. - * \return Primitive variables limiter for the entire domain. - */ - inline MatrixType& GetLimiter_Primitive(void) {return Limiter_Primitive; } - - /*! - * \brief Set the gradient of the primitive variables. - * \param[in] iVar - Index of the variable. - * \param[in] iDim - Index of the dimension. - * \param[in] value - Value of the gradient. - */ - inline su2double GetLimiter_Primitive(unsigned long iPoint, unsigned long iVar) const final {return Limiter_Primitive(iPoint,iVar); } - - /*! - * \brief Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - inline su2double *GetLimiter_Primitive(unsigned long iPoint) final { return Limiter_Primitive[iPoint]; } - - /*! - * \brief Set the gradient of the primitive variables. - * \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 Set the value of the primitive variables. - * \param[in] iVar - Index of the variable. - * \param[in] iVar - Index of the variable. - * \return Set the value of the primitive variable for the index iVar. - */ - inline void SetSecondary(unsigned long iPoint, unsigned long iVar, su2double val_secondary) final {Secondary(iPoint,iVar) = val_secondary; } - - /*! - * \brief Set the value of the primitive variables. - * \param[in] val_prim - Primitive variables. - * \return Set the value of the primitive variable for the index iVar. - */ - inline void SetSecondary(unsigned long iPoint, const su2double *val_secondary) final { - for (unsigned long iVar = 0; iVar < nSecondaryVar; iVar++) - Secondary(iPoint,iVar) = val_secondary[iVar]; - } - - /*! - * \brief Set the value of the primitive auxiliary variables - with mass fractions. - * \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_Aux(unsigned long iPoint, unsigned long iVar, su2double val_prim) { Primitive_Aux(iPoint,iVar) = val_prim; } - - - /*! - * \brief Get the primitive variables. - * \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 Get the primitive variables of the problem. - * \return Pointer to the primitive variable vector. - */ - inline su2double *GetPrimitive(unsigned long iPoint) final {return Primitive[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 for all points. - * \return Reference to primitives. - */ - inline const MatrixType& GetPrimitive_Aux(void) const { return Primitive_Aux; } - - - /*! - * \brief Get the primitive variables. - * \param[in] iVar - Index of the variable. - * \return Value of the primitive variable for the index iVar. - */ - inline su2double GetSecondary(unsigned long iPoint, unsigned long iVar) const final {return Secondary(iPoint,iVar); } - - /*! - * \brief Get the primitive variables of the problem. - * \return Pointer to the primitive variable vector. - */ - inline su2double *GetSecondary(unsigned long iPoint) final { return Secondary[iPoint]; } - - /*---------------------------------------*/ - /*--- Gradient Routines ---*/ - /*---------------------------------------*/ - - /*! - * \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 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 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 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) override { - Gradient_Reconstruction(iPoint,iVar,iDim) = value; - } - - /*! - * \brief Set to zero the gradient of the primitive variables. - */ - void SetGradient_PrimitiveZero(); - - /*! - * \brief Add value to the gradient of the primitive variables. - * \param[in] iVar - Index of the variable. - * \param[in] iDim - Index of the dimension. - * \param[in] value - Value to add to the gradient of the primitive variables. - */ - inline void AddGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { - Gradient_Primitive(iPoint,iVar,iDim) += value; - } - - /*! - * \brief Subtract value to the gradient of the primitive variables. - * \param[in] iVar - Index of the variable. - * \param[in] iDim - Index of the dimension. - * \param[in] value - Value to subtract to the gradient of the primitive variables. - */ - inline void SubtractGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) { - Gradient_Primitive(iPoint,iVar,iDim) -= value; - } - - /*! - * \brief Get the value of the primitive variables gradient. - * \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 Set the gradient of the primitive variables. - * \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 Get the value of the primitive variables gradient. - * \return Value of the primitive variables gradient. - */ - inline su2double **GetGradient_Primitive(unsigned long iPoint) final { return Gradient_Primitive[iPoint]; } - - /*! - * \brief Get the primitive variable gradients for all points. - * \return Reference to primitive variable gradient. - */ - inline CVectorOfMatrix& GetGradient_Primitive(void) { return Gradient_Primitive; } - - /*! - * \brief Set all the primitive variables for compressible flows. - */ - bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) override; - - /*! - * \brief Set all the primitive and secondary variables from the conserved vector. - */ - bool Cons2PrimVar(su2double *U, su2double *V, su2double *dPdU, - su2double *dTdU, su2double *dTvedU, su2double *val_eves, - su2double *val_Cvves); - - /*---------------------------------------*/ - /*--- Specific variable routines ---*/ - /*---------------------------------------*/ - - /*! - * \brief Set the norm 2 of the velocity. - * \return Norm 2 of the velocity vector. - */ - void SetVelocity2(unsigned long iPoint) override; - - /*! - * \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,P_INDEX); } - - /*! - * \brief Get the speed of the sound. - * \return Value of speed of the sound. - */ - inline su2double GetSoundSpeed(unsigned long iPoint) const final { return Primitive(iPoint,A_INDEX); } - - /*! - * \brief Get the enthalpy of the flow. - * \return Value of the enthalpy of the flow. - */ - inline su2double GetEnthalpy(unsigned long iPoint) const final { return Primitive(iPoint,H_INDEX); } - - /*! - * \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,RHO_INDEX); } - - /*! - * \brief Get the specie density of the flow. - * \return Value of the specie density of the flow. - */ - inline su2double GetDensity(unsigned long iPoint, unsigned long val_Species) const final { return Primitive(iPoint,RHOS_INDEX+val_Species); } - - /*! - * \brief Get the energy of the flow. - * \return Value of the energy of the flow. - */ - inline su2double GetEnergy(unsigned long iPoint) const final { return Solution(iPoint,nSpecies+nDim)/Primitive(iPoint,RHO_INDEX); } - - /*! - * \brief Get the temperature of the flow. - * \return Value of the temperature of the flow. - */ - inline su2double GetTemperature(unsigned long iPoint) const final { return Primitive(iPoint,T_INDEX); } - - /*! - * \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,VEL_INDEX+iDim); } - - /*! - * \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,VEL_INDEX+iDim)*val_vector[iDim]; - return ProjVel; - } - - /*! - * \brief Set the velocity vector from the solution. - * \param[in] val_velocity - Pointer to the velocity. - */ - inline void SetVelocity(unsigned long iPoint) final { - Velocity2(iPoint) = 0.0; - for (unsigned long iDim = 0; iDim < nDim; iDim++) { - Primitive(iPoint,VEL_INDEX+iDim) = Solution(iPoint,nSpecies+iDim) / Primitive(iPoint,RHO_INDEX); - Velocity2(iPoint) += pow(Primitive(iPoint,VEL_INDEX+iDim),2); - } - } - - /*! - * \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,nSpecies+iDim) = val_velocity[iDim]*Primitive(iPoint,RHO_INDEX); - } - } - - /*! - * \brief A virtual member. - * \return Value of the vibrational-electronic temperature. - */ - inline su2double GetTemperature_ve(unsigned long iPoint) const override - { return Primitive(iPoint,TVE_INDEX); } - - /*! - * \brief Sets the vibrational electronic temperature of the flow. - * \return Value of the temperature of the flow. - */ - inline bool SetTemperature_ve(unsigned long iPoint, su2double val_Tve) override - { Primitive(iPoint,TVE_INDEX) = val_Tve; return false; } - - /*! - * \brief Get the mixture specific heat at constant volume (trans.-rot.). - * \return \f$\rho C^{t-r}_{v} \f$ - */ - inline su2double GetRhoCv_tr(unsigned long iPoint) const override - { return Primitive(iPoint,RHOCVTR_INDEX); } - - /*! - * \brief Get the mixture specific heat at constant volume (vib.-el.). - * \return \f$\rho C^{v-e}_{v} \f$ - */ - inline su2double GetRhoCv_ve(unsigned long iPoint) const override - { return Primitive(iPoint,RHOCVVE_INDEX); } - - /*! - * \brief Returns the stored value of Eve at the specified node - */ - inline su2double *GetEve(unsigned long iPoint) { return eves[iPoint]; } - - /*! - * \brief Returns the value of Cvve at the specified node - */ - su2double *GetCvve(unsigned long iPoint) { return Cvves[iPoint]; } - - /*! - * \brief Set partial derivative of pressure w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ - */ - inline su2double *GetdPdU(unsigned long iPoint) override { return dPdU[iPoint]; } - - /*! - * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial T}{\partial \rho_s}\f$ - */ - inline su2double *GetdTdU(unsigned long iPoint) override { return dTdU[iPoint]; } - - /*! - * \brief Set partial derivative of vib.-el. temperature w.r.t. density \f$\frac{\partial T^{V-E}}{\partial \rho_s}\f$ - */ - inline su2double *GetdTvedU(unsigned long iPoint) override { return dTvedU[iPoint]; } - - /*! - * \brief Get the mass fraction \f$\rho_s / \rho \f$ of species s. - * \param[in] val_Species - Index of species s. - * \return Value of the mass fraction of species s. - */ - inline su2double GetMassFraction(unsigned long iPoint, unsigned long val_Species) const override { - return Primitive(iPoint,RHOS_INDEX+val_Species) / Primitive(iPoint,RHO_INDEX); - } - - /*! - * \brief Returns the stored value of Gamma at the specified node - */ - inline su2double GetGamma(unsigned long iPoint) { return Gamma(iPoint); } - - /*---------------------------------------*/ - /*--- NEMO indices ---*/ - /*---------------------------------------*/ - - /*! - * \brief Retrieves the value of the species density in the primitive variable vector. - */ - inline unsigned short GetRhosIndex(void) { return RHOS_INDEX; } - - /*! - * \brief Retrieves the value of the total density in the primitive variable vector. - */ - inline unsigned short GetRhoIndex(void) { return RHO_INDEX; } - - /*! - * \brief Retrieves the value of the pressure in the primitive variable vector. - */ - inline unsigned short GetPIndex(void) { return P_INDEX; } - - /*! - * \brief Retrieves the value of the in temperature the primitive variable vector. - */ - inline unsigned short GetTIndex(void) { return T_INDEX; } - - /*! - * \brief Retrieves the value of the vibe-elec temperature in the primitive variable vector. - */ - inline unsigned short GetTveIndex(void) { return TVE_INDEX; } - - /*! - * \brief Retrieves the value of the velocity in the primitive variable vector. - */ - inline unsigned short GetVelIndex(void) { return VEL_INDEX; } - - /*! - * \brief Retrieves the value of the enthalpy in the primitive variable vector. - */ - inline unsigned short GetHIndex(void) { return H_INDEX; } - - /*! - * \brief Retrieves the value of the soundspeed in the primitive variable vector. - */ - inline unsigned short GetAIndex(void) { return A_INDEX; } - - /*! - * \brief Retrieves the value of the RhoCvtr in the primitive variable vector. - */ - inline unsigned short GetRhoCvtrIndex(void) { return RHOCVTR_INDEX; } - - /*! - * \brief Retrieves the value of the RhoCvve in the primitive variable vector. - */ - inline unsigned short GetRhoCvveIndex(void) { return RHOCVVE_INDEX; } - -}; +/*! + * \file CNEMOEulerVariable.hpp + * \brief Class for defining the variables of the compressible NEMO Euler solver. + * \author C. Garbacz, W. Maier, S.R. Copeland + * \version 7.1.1 "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 "CVariable.hpp" +#include "../fluid/CNEMOGas.hpp" + +/*! + * \class CNEMOEulerVariable + * \brief Main class for defining the variables of the NEMO Euler's solver. + * \ingroup Euler_Equations + * \author S. R. Copeland, F. Palacios, W. Maier, C. Garbacz + * \version 7.0.8 + */ +class CNEMOEulerVariable : public CVariable { +public: + static constexpr size_t MAXNVAR = 25; + +protected: + + bool ionization; /*!< \brief Presence of charged species in gas mixture. */ + bool monoatomic = false; /*!< \brief Presence of single species gas. */ + + VectorType Velocity2; /*!< \brief Square of the velocity vector. */ + MatrixType Precond_Beta; /*!< \brief Low Mach number preconditioner value, Beta. */ + + CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the conservative variables for MUSCL reconstruction for the convective term */ + CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */ + + /*--- Primitive variable definition ---*/ + MatrixType Primitive; /*!< \brief Primitive variables (rhos_s, T, Tve, ...) in compressible flows. */ + MatrixType Primitive_Aux; /*!< \brief Primitive auxiliary variables (Y_s, T, Tve, ...) in compressible flows. */ + CVectorOfMatrix Gradient_Primitive; /*!< \brief Gradient of the primitive variables (rhos_s, T, Tve, ...). */ + MatrixType Limiter_Primitive; /*!< \brief Limiter of the primitive variables (rhos_s, T, Tve, ...). */ + + /*--- Secondary variable definition ---*/ + MatrixType Secondary; /*!< \brief Primitive variables (T, vx, vy, vz, P, rho, h, c) in compressible flows. */ + CVectorOfMatrix Gradient_Secondary; /*!< \brief Gradient of the primitive variables (T, vx, vy, vz, P, rho). */ + + /*--- New solution container for Classical RK4 ---*/ + MatrixType Solution_New; /*!< \brief New solution container for Classical RK4. */ + + /*--- Other Necessary Variable Definition ---*/ + MatrixType dPdU; /*!< \brief Partial derivative of pressure w.r.t. conserved variables. */ + MatrixType dTdU; /*!< \brief Partial derivative of temperature w.r.t. conserved variables. */ + MatrixType dTvedU; /*!< \brief Partial derivative of vib.-el. temperature w.r.t. conserved variables. */ + MatrixType eves; /*!< \brief energy of vib-el mode w.r.t. species. */ + MatrixType Cvves; /*!< \brief Specific heat of vib-el mode w.r.t. species. */ + VectorType Gamma; /*!< \brief Ratio of specific heats. */ + + CNEMOGas *fluidmodel; + + /*!< \brief Index definition for NEMO pritimive variables. */ + unsigned long RHOS_INDEX, T_INDEX, TVE_INDEX, VEL_INDEX, P_INDEX, + RHO_INDEX, H_INDEX, A_INDEX, RHOCVTR_INDEX, RHOCVVE_INDEX, + LAM_VISC_INDEX, EDDY_VISC_INDEX, nSpecies; + + su2double Tve_Freestream; /*!< \brief Freestream vib-el temperature. */ + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_pressure - Value of the flow pressure (initialization value). + * \param[in] val_massfrac - Value of the mass fraction (initialization value). + * \param[in] val_mach - Value of the Mach number (initialization value). + * \param[in] val_temperature - Value of the flow temperature (initialization value). + * \param[in] val_temperature_ve - Value of the flow temperature_ve (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of conserved variables. + * \param[in] val_nVarPrim - Number of primitive variables. + * \param[in] val_nVarPrimGrad - Number of primitive gradient variables. + * \param[in] config - Definition of the particular problem. + */ + CNEMOEulerVariable(su2double val_pressure, const su2double *val_massfrac, + su2double *val_mach, su2double val_temperature, + su2double val_temperature_ve, unsigned long npoint, + unsigned long ndim, + unsigned long nvar, unsigned long nvalprim, + unsigned long nvarprimgrad, CConfig *config, CNEMOGas *fluidmodel); + + /*! + * \brief Destructor of the class. + */ + ~CNEMOEulerVariable() override = default; + + /*---------------------------------------*/ + /*--- U,V,S Routines ---*/ + /*---------------------------------------*/ + + /*! + * \brief Get the new solution of the problem (Classical RK4). + * \param[in] iVar - Index of the variable. + * \return Pointer to the old solution vector. + */ + inline su2double GetSolution_New(unsigned long iPoint, unsigned long iVar) const final { return Solution_New(iPoint,iVar); } + + /*! + * \brief Set the new solution container for Classical RK4. + */ + void SetSolution_New() final; + + /*! + * \brief Add a value to the new solution container for Classical RK4. + * \param[in] iVar - Number of the variable. + * \param[in] val_solution - Value that we want to add to the solution. + */ + inline void AddSolution_New(unsigned long iPoint, unsigned long iVar, su2double val_solution) final { + Solution_New(iPoint,iVar) += val_solution; + } + + /*! + * \brief Set the value of the primitive variables. + * \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] 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 limiter. + * \return Primitive variables limiter for the entire domain. + */ + inline MatrixType& GetLimiter_Primitive(void) {return Limiter_Primitive; } + + /*! + * \brief Set the gradient of the primitive variables. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] value - Value of the gradient. + */ + inline su2double GetLimiter_Primitive(unsigned long iPoint, unsigned long iVar) const final {return Limiter_Primitive(iPoint,iVar); } + + /*! + * \brief Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double *GetLimiter_Primitive(unsigned long iPoint) final { return Limiter_Primitive[iPoint]; } + + /*! + * \brief Set the gradient of the primitive variables. + * \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 Set the value of the primitive variables. + * \param[in] iVar - Index of the variable. + * \param[in] iVar - Index of the variable. + * \return Set the value of the primitive variable for the index iVar. + */ + inline void SetSecondary(unsigned long iPoint, unsigned long iVar, su2double val_secondary) final {Secondary(iPoint,iVar) = val_secondary; } + + /*! + * \brief Set the value of the primitive variables. + * \param[in] val_prim - Primitive variables. + * \return Set the value of the primitive variable for the index iVar. + */ + inline void SetSecondary(unsigned long iPoint, const su2double *val_secondary) final { + for (unsigned long iVar = 0; iVar < nSecondaryVar; iVar++) + Secondary(iPoint,iVar) = val_secondary[iVar]; + } + + /*! + * \brief Set the value of the primitive auxiliary variables - with mass fractions. + * \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_Aux(unsigned long iPoint, unsigned long iVar, su2double val_prim) { Primitive_Aux(iPoint,iVar) = val_prim; } + + + /*! + * \brief Get the primitive variables. + * \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 Get the primitive variables of the problem. + * \return Pointer to the primitive variable vector. + */ + inline su2double *GetPrimitive(unsigned long iPoint) final {return Primitive[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 for all points. + * \return Reference to primitives. + */ + inline const MatrixType& GetPrimitive_Aux(void) const { return Primitive_Aux; } + + + /*! + * \brief Get the primitive variables. + * \param[in] iVar - Index of the variable. + * \return Value of the primitive variable for the index iVar. + */ + inline su2double GetSecondary(unsigned long iPoint, unsigned long iVar) const final {return Secondary(iPoint,iVar); } + + /*! + * \brief Get the primitive variables of the problem. + * \return Pointer to the primitive variable vector. + */ + inline su2double *GetSecondary(unsigned long iPoint) final { return Secondary[iPoint]; } + + /*---------------------------------------*/ + /*--- Gradient Routines ---*/ + /*---------------------------------------*/ + + /*! + * \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 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 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 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 Set to zero the gradient of the primitive variables. + */ + void SetGradient_PrimitiveZero(); + + /*! + * \brief Add value to the gradient of the primitive variables. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] value - Value to add to the gradient of the primitive variables. + */ + inline void AddGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) final { + Gradient_Primitive(iPoint,iVar,iDim) += value; + } + + /*! + * \brief Subtract value to the gradient of the primitive variables. + * \param[in] iVar - Index of the variable. + * \param[in] iDim - Index of the dimension. + * \param[in] value - Value to subtract to the gradient of the primitive variables. + */ + inline void SubtractGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) { + Gradient_Primitive(iPoint,iVar,iDim) -= value; + } + + /*! + * \brief Get the value of the primitive variables gradient. + * \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 Set the gradient of the primitive variables. + * \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 Get the value of the primitive variables gradient. + * \return Value of the primitive variables gradient. + */ + inline su2double **GetGradient_Primitive(unsigned long iPoint) final { return Gradient_Primitive[iPoint]; } + + /*! + * \brief Get the primitive variable gradients for all points. + * \return Reference to primitive variable gradient. + */ + inline CVectorOfMatrix& GetGradient_Primitive(void) { return Gradient_Primitive; } + + /*! + * \brief Set all the primitive variables for compressible flows. + */ + bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) override; + + /*! + * \brief Set all the primitive and secondary variables from the conserved vector. + */ + bool Cons2PrimVar(su2double *U, su2double *V, su2double *dPdU, + su2double *dTdU, su2double *dTvedU, su2double *val_eves, + su2double *val_Cvves); + + /*---------------------------------------*/ + /*--- Specific variable routines ---*/ + /*---------------------------------------*/ + + /*! + * \brief Set the norm 2 of the velocity. + * \return Norm 2 of the velocity vector. + */ + void SetVelocity2(unsigned long iPoint) final; + + /*! + * \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,P_INDEX); } + + /*! + * \brief Get the speed of the sound. + * \return Value of speed of the sound. + */ + inline su2double GetSoundSpeed(unsigned long iPoint) const final { return Primitive(iPoint,A_INDEX); } + + /*! + * \brief Get the enthalpy of the flow. + * \return Value of the enthalpy of the flow. + */ + inline su2double GetEnthalpy(unsigned long iPoint) const final { return Primitive(iPoint,H_INDEX); } + + /*! + * \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,RHO_INDEX); } + + /*! + * \brief Get the specie density of the flow. + * \return Value of the specie density of the flow. + */ + inline su2double GetDensity(unsigned long iPoint, unsigned long val_Species) const final { return Primitive(iPoint,RHOS_INDEX+val_Species); } + + /*! + * \brief Get the energy of the flow. + * \return Value of the energy of the flow. + */ + inline su2double GetEnergy(unsigned long iPoint) const final { return Solution(iPoint,nSpecies+nDim)/Primitive(iPoint,RHO_INDEX); } + + /*! + * \brief Get the temperature of the flow. + * \return Value of the temperature of the flow. + */ + inline su2double GetTemperature(unsigned long iPoint) const final { return Primitive(iPoint,T_INDEX); } + + /*! + * \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,VEL_INDEX+iDim); } + + /*! + * \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,VEL_INDEX+iDim)*val_vector[iDim]; + return ProjVel; + } + + /*! + * \brief Set the velocity vector from the solution. + * \param[in] val_velocity - Pointer to the velocity. + */ + inline void SetVelocity(unsigned long iPoint) final { + Velocity2(iPoint) = 0.0; + for (unsigned long iDim = 0; iDim < nDim; iDim++) { + Primitive(iPoint,VEL_INDEX+iDim) = Solution(iPoint,nSpecies+iDim) / Primitive(iPoint,RHO_INDEX); + Velocity2(iPoint) += pow(Primitive(iPoint,VEL_INDEX+iDim),2); + } + } + + /*! + * \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,nSpecies+iDim) = val_velocity[iDim]*Primitive(iPoint,RHO_INDEX); + } + } + + /*! + * \brief A virtual member. + * \return Value of the vibrational-electronic temperature. + */ + inline su2double GetTemperature_ve(unsigned long iPoint) const final + { return Primitive(iPoint,TVE_INDEX); } + + /*! + * \brief Sets the vibrational electronic temperature of the flow. + * \return Value of the temperature of the flow. + */ + inline bool SetTemperature_ve(unsigned long iPoint, su2double val_Tve) final + { Primitive(iPoint,TVE_INDEX) = val_Tve; return false; } + + /*! + * \brief Get the mixture specific heat at constant volume (trans.-rot.). + * \return \f$\rho C^{t-r}_{v} \f$ + */ + inline su2double GetRhoCv_tr(unsigned long iPoint) const final + { return Primitive(iPoint,RHOCVTR_INDEX); } + + /*! + * \brief Get the mixture specific heat at constant volume (vib.-el.). + * \return \f$\rho C^{v-e}_{v} \f$ + */ + inline su2double GetRhoCv_ve(unsigned long iPoint) const final + { return Primitive(iPoint,RHOCVVE_INDEX); } + + /*! + * \brief Returns the stored value of Eve at the specified node + */ + inline su2double *GetEve(unsigned long iPoint) { return eves[iPoint]; } + + /*! + * \brief Returns the value of Cvve at the specified node + */ + su2double *GetCvve(unsigned long iPoint) { return Cvves[iPoint]; } + + /*! + * \brief Set partial derivative of pressure w.r.t. density \f$\frac{\partial P}{\partial \rho_s}\f$ + */ + inline su2double *GetdPdU(unsigned long iPoint) final { return dPdU[iPoint]; } + + /*! + * \brief Set partial derivative of temperature w.r.t. density \f$\frac{\partial T}{\partial \rho_s}\f$ + */ + inline su2double *GetdTdU(unsigned long iPoint) final { return dTdU[iPoint]; } + + /*! + * \brief Set partial derivative of vib.-el. temperature w.r.t. density \f$\frac{\partial T^{V-E}}{\partial \rho_s}\f$ + */ + inline su2double *GetdTvedU(unsigned long iPoint) final { return dTvedU[iPoint]; } + + /*! + * \brief Get the mass fraction \f$\rho_s / \rho \f$ of species s. + * \param[in] val_Species - Index of species s. + * \return Value of the mass fraction of species s. + */ + inline su2double GetMassFraction(unsigned long iPoint, unsigned long val_Species) const final { + return Primitive(iPoint,RHOS_INDEX+val_Species) / Primitive(iPoint,RHO_INDEX); + } + + /*! + * \brief Returns the stored value of Gamma at the specified node + */ + inline su2double GetGamma(unsigned long iPoint) { return Gamma(iPoint); } + + /*---------------------------------------*/ + /*--- NEMO indices ---*/ + /*---------------------------------------*/ + + /*! + * \brief Retrieves the value of the species density in the primitive variable vector. + */ + inline unsigned short GetRhosIndex(void) { return RHOS_INDEX; } + + /*! + * \brief Retrieves the value of the total density in the primitive variable vector. + */ + inline unsigned short GetRhoIndex(void) { return RHO_INDEX; } + + /*! + * \brief Retrieves the value of the pressure in the primitive variable vector. + */ + inline unsigned short GetPIndex(void) { return P_INDEX; } + + /*! + * \brief Retrieves the value of the in temperature the primitive variable vector. + */ + inline unsigned short GetTIndex(void) { return T_INDEX; } + + /*! + * \brief Retrieves the value of the vibe-elec temperature in the primitive variable vector. + */ + inline unsigned short GetTveIndex(void) { return TVE_INDEX; } + + /*! + * \brief Retrieves the value of the velocity in the primitive variable vector. + */ + inline unsigned short GetVelIndex(void) { return VEL_INDEX; } + + /*! + * \brief Retrieves the value of the enthalpy in the primitive variable vector. + */ + inline unsigned short GetHIndex(void) { return H_INDEX; } + + /*! + * \brief Retrieves the value of the soundspeed in the primitive variable vector. + */ + inline unsigned short GetAIndex(void) { return A_INDEX; } + + /*! + * \brief Retrieves the value of the RhoCvtr in the primitive variable vector. + */ + inline unsigned short GetRhoCvtrIndex(void) { return RHOCVTR_INDEX; } + + /*! + * \brief Retrieves the value of the RhoCvve in the primitive variable vector. + */ + inline unsigned short GetRhoCvveIndex(void) { return RHOCVVE_INDEX; } + + /*! + * \brief Specify a vector to set the velocity components of the solution. Multiplied by density for compressible cases. + * \param[in] iPoint - Point index. + * \param[in] val_vector - Pointer to the vector. + */ + inline void SetVelSolutionVector(unsigned long iPoint, const su2double *val_vector) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) + Solution(iPoint, nSpecies+iDim) = Primitive(iPoint,RHO_INDEX) * val_vector[iDim]; + } + + /*! + * \brief Set the momentum part of the truncation error to zero. + * \param[in] iPoint - Point index. + */ + inline void SetVel_ResTruncError_Zero(unsigned long iPoint) final { + for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,nSpecies+iDim) = 0.0; + } + +}; diff --git a/SU2_CFD/include/variables/CNEMONSVariable.hpp b/SU2_CFD/include/variables/CNEMONSVariable.hpp index 5531409ce8e0..ba9a87c4a90b 100644 --- a/SU2_CFD/include/variables/CNEMONSVariable.hpp +++ b/SU2_CFD/include/variables/CNEMONSVariable.hpp @@ -1,178 +1,167 @@ -/*! - * \file CNEMONSVariable.hpp - * \brief Class for defining the variables of the compressible NEMO Navier-Stokes solver. - * \author C. Garbacz, W. Maier, S.R. Copeland. - * \version 7.1.0 "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 "CNEMOEulerVariable.hpp" - -/*! - * \class CNEMONSVariable - * \brief Main class for defining the variables of the NEMO Navier-Stokes' solver. - * \ingroup Navier_Stokes_Equations - * \author C. Garbacz, W. Maier, S.R. Copeland. - * \version 7.0.8 - */ -class CNEMONSVariable final : public CNEMOEulerVariable { -private: - VectorType Prandtl_Lam; /*!< \brief Laminar Prandtl number. */ - VectorType Temperature_Ref; /*!< \brief Reference temperature of the fluid. */ - VectorType Viscosity_Ref; /*!< \brief Reference viscosity of the fluid. */ - VectorType Viscosity_Inf; /*!< \brief Viscosity of the fluid at the infinity. */ - MatrixType DiffusionCoeff; /*!< \brief Diffusion coefficient of the mixture. */ - CVectorOfMatrix Dij; /*!< \brief Binary diffusion coefficients. */ - VectorType LaminarViscosity; /*!< \brief Viscosity of the fluid. */ - VectorType ThermalCond; /*!< \brief T-R thermal conductivity of the gas mixture. */ - VectorType ThermalCond_ve; /*!< \brief V-E thermal conductivity of the gas mixture. */ - vector thermalconductivities; - vector Ds; - - su2double inv_TimeScale; /*!< \brief Inverse of the reference time scale. */ - - MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ - VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ - VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ - VectorType DES_LengthScale; /*!< \brief DES Length Scale. */ - VectorType Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */ - VectorType Vortex_Tilting; /*!< \brief Value of the vortex tilting variable for DES length scale computation. */ - -public: - - /*! - * \brief Constructor of the class. - * \param[in] val_density - Value of the flow density (initialization value). - * \param[in] val_massfrac - Value of the flow mass fraction (initialization value). - * \param[in] val_velocity - Value of the flow velocity (initialization value). - * \param[in] val_temperature - Value of the flow temperature (initialization value). - * \param[in] val_temperature_ve - Value of the flow temperature_ve (initialization value). - * \param[in] npoint - Number of points/nodes/vertices in the domain. - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of conserved variables. - * \param[in] val_nPrimVar - Number of primitive variables. - * \param[in] val_nPrimVargrad - Number of primitive gradient variables. - * \param[in] config - Definition of the particular problem. - */ - CNEMONSVariable(su2double val_density, const su2double *val_massfrac, su2double *val_velocity, - su2double val_temperature, su2double val_temperature_ve, unsigned long npoint, - unsigned long val_nDim, unsigned long val_nVar, unsigned long val_nPrimVar, - unsigned long val_nPrimVarGrad, CConfig *config, CNEMOGas *fluidmodel); - - /*! - * \brief Constructor of the class. - * \param[in] val_solution - Pointer to the flow value (initialization value). - * \param[in] val_nDim - Number of dimensions of the problem. - * \param[in] val_nVar - Number of conserved variables. - * \param[in] val_nPrimVar - Number of primitive variables. - * \param[in] val_nPrimgVarGrad - Number of primitive gradient variables. - * \param[in] config - Definition of the particular problem. - */ - CNEMONSVariable(su2double *val_solution, unsigned long val_nDim, unsigned long val_nVar, - unsigned long val_nPrimVar, unsigned long val_nPrimVarGrad, unsigned long npoint, - CConfig *config); - - /*! - * \brief Destructor of the class. - */ - ~CNEMONSVariable() = default; - - /*! - * \brief Get the primitive variables for all points. - * \return Reference to primitives. - */ - inline const MatrixType& GetPrimitive_Aux(void) const { return Primitive_Aux; } - - /*! - * \brief Set 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. - */ - /* Works as a dummy function for consistency since no reconstruction is needed for primitive variables*/ - inline void SetGradient_Reconstruction(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) override { } - - - /*! - * \brief Set all the primitive variables for compressible flows. - */ - bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) final; - - /*! - * \brief Set the vorticity value. - */ - bool SetVorticity(void); - - /*! - * \overload - * \param[in] eddy_visc - Value of the eddy viscosity. - */ - inline void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) override { Primitive(iPoint,EDDY_VISC_INDEX) = eddy_visc; } - - /*! - * \brief Get the species diffusion coefficient. - * \return Value of the species diffusion coefficient. - */ - inline su2double* GetDiffusionCoeff(unsigned long iPoint) override { return DiffusionCoeff[iPoint]; } - - /*! - * \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 LaminarViscosity(iPoint); } - - /*! - * \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,EDDY_VISC_INDEX); } - - /*! - * \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 ThermalCond(iPoint); } - - /*! - * \brief Get the vib-el. thermal conductivity of the flow. - * \return Value of the laminar viscosity of the flow. - */ - inline su2double GetThermalConductivity_ve(unsigned long iPoint) const override { return ThermalCond_ve(iPoint); } - - /*! - * \brief Set the temperature at the wall - */ - inline void SetWallTemperature(unsigned long iPoint, su2double temperature_wall) override { - Primitive(iPoint,T_INDEX) = temperature_wall; - } - - /*! - * \brief Get the value of the vorticity. - * \return Value of the vorticity. - */ - inline su2double *GetVorticity(unsigned long iPoint) override { return Vorticity[iPoint]; } - - -}; +/*! + * \file CNEMONSVariable.hpp + * \brief Class for defining the variables of the compressible NEMO Navier-Stokes solver. + * \author C. Garbacz, W. Maier, S.R. Copeland. + * \version 7.1.1 "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 "CNEMOEulerVariable.hpp" + +/*! + * \class CNEMONSVariable + * \brief Main class for defining the variables of the NEMO Navier-Stokes' solver. + * \ingroup Navier_Stokes_Equations + * \author C. Garbacz, W. Maier, S.R. Copeland. + * \version 7.0.8 + */ +class CNEMONSVariable final : public CNEMOEulerVariable { +private: + VectorType Prandtl_Lam; /*!< \brief Laminar Prandtl number. */ + VectorType Temperature_Ref; /*!< \brief Reference temperature of the fluid. */ + VectorType Viscosity_Ref; /*!< \brief Reference viscosity of the fluid. */ + VectorType Viscosity_Inf; /*!< \brief Viscosity of the fluid at the infinity. */ + MatrixType DiffusionCoeff; /*!< \brief Diffusion coefficient of the mixture. */ + CVectorOfMatrix Dij; /*!< \brief Binary diffusion coefficients. */ + VectorType LaminarViscosity; /*!< \brief Viscosity of the fluid. */ + VectorType ThermalCond; /*!< \brief T-R thermal conductivity of the gas mixture. */ + VectorType ThermalCond_ve; /*!< \brief V-E thermal conductivity of the gas mixture. */ + vector thermalconductivities; + vector Ds; + + su2double inv_TimeScale; /*!< \brief Inverse of the reference time scale. */ + + MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ + VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ + VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ + VectorType DES_LengthScale; /*!< \brief DES Length Scale. */ + VectorType Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */ + VectorType Vortex_Tilting; /*!< \brief Value of the vortex tilting variable for DES length scale computation. */ + +public: + + /*! + * \brief Constructor of the class. + * \param[in] val_density - Value of the flow density (initialization value). + * \param[in] val_massfrac - Value of the flow mass fraction (initialization value). + * \param[in] val_velocity - Value of the flow velocity (initialization value). + * \param[in] val_temperature - Value of the flow temperature (initialization value). + * \param[in] val_temperature_ve - Value of the flow temperature_ve (initialization value). + * \param[in] npoint - Number of points/nodes/vertices in the domain. + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of conserved variables. + * \param[in] val_nPrimVar - Number of primitive variables. + * \param[in] val_nPrimVargrad - Number of primitive gradient variables. + * \param[in] config - Definition of the particular problem. + */ + CNEMONSVariable(su2double val_density, const su2double *val_massfrac, su2double *val_velocity, + su2double val_temperature, su2double val_temperature_ve, unsigned long npoint, + unsigned long val_nDim, unsigned long val_nVar, unsigned long val_nPrimVar, + unsigned long val_nPrimVarGrad, CConfig *config, CNEMOGas *fluidmodel); + + /*! + * \brief Constructor of the class. + * \param[in] val_solution - Pointer to the flow value (initialization value). + * \param[in] val_nDim - Number of dimensions of the problem. + * \param[in] val_nVar - Number of conserved variables. + * \param[in] val_nPrimVar - Number of primitive variables. + * \param[in] val_nPrimgVarGrad - Number of primitive gradient variables. + * \param[in] config - Definition of the particular problem. + */ + CNEMONSVariable(su2double *val_solution, unsigned long val_nDim, unsigned long val_nVar, + unsigned long val_nPrimVar, unsigned long val_nPrimVarGrad, unsigned long npoint, + CConfig *config); + + /*! + * \brief Destructor of the class. + */ + ~CNEMONSVariable() = default; + + /*! + * \brief Get the primitive variables for all points. + * \return Reference to primitives. + */ + inline const MatrixType& GetPrimitive_Aux(void) const { return Primitive_Aux; } + + /*! + * \brief Set all the primitive variables for compressible flows. + */ + bool SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) final; + + /*! + * \brief Set the vorticity value. + */ + bool SetVorticity(void); + + /*! + * \overload + * \param[in] eddy_visc - Value of the eddy viscosity. + */ + inline void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) override { Primitive(iPoint,EDDY_VISC_INDEX) = eddy_visc; } + + /*! + * \brief Get the species diffusion coefficient. + * \return Value of the species diffusion coefficient. + */ + inline su2double* GetDiffusionCoeff(unsigned long iPoint) override { return DiffusionCoeff[iPoint]; } + + /*! + * \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 LaminarViscosity(iPoint); } + + /*! + * \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,EDDY_VISC_INDEX); } + + /*! + * \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 ThermalCond(iPoint); } + + /*! + * \brief Get the vib-el. thermal conductivity of the flow. + * \return Value of the laminar viscosity of the flow. + */ + inline su2double GetThermalConductivity_ve(unsigned long iPoint) const override { return ThermalCond_ve(iPoint); } + + /*! + * \brief Set the temperature at the wall + */ + inline void SetWallTemperature(unsigned long iPoint, su2double temperature_wall) override { + Primitive(iPoint,T_INDEX) = temperature_wall; + } + + /*! + * \brief Get the value of the vorticity. + * \return Value of the vorticity. + */ + inline su2double *GetVorticity(unsigned long iPoint) override { return Vorticity[iPoint]; } + + +}; diff --git a/SU2_CFD/include/variables/CNSVariable.hpp b/SU2_CFD/include/variables/CNSVariable.hpp index 7383334f3e99..0d93d7eb0400 100644 --- a/SU2_CFD/include/variables/CNSVariable.hpp +++ b/SU2_CFD/include/variables/CNSVariable.hpp @@ -2,7 +2,7 @@ * \file CNSVariable.hpp * \brief Class for defining the variables of the compressible Navier-Stokes solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -39,8 +39,6 @@ class CNSVariable final : public CEulerVariable { private: su2double inv_TimeScale; /*!< \brief Inverse of the reference time scale. */ - MatrixType Vorticity; /*!< \brief Vorticity of the fluid. */ - VectorType StrainMag; /*!< \brief Magnitude of rate of strain tensor. */ VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */ VectorType DES_LengthScale; /*!< \brief DES Length Scale. */ VectorType Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */ @@ -84,11 +82,6 @@ class CNSVariable final : public CEulerVariable { */ inline void SetSpecificHeatCp(unsigned long iPoint, su2double val_Cp) override { Primitive(iPoint,nDim+8) = val_Cp; } - /*! - * \brief Set the vorticity value. - */ - bool SetVorticity_StrainMag() override; - /*! * \overload * \param[in] eddy_visc - Value of the eddy viscosity. @@ -126,18 +119,6 @@ class CNSVariable final : public CEulerVariable { Primitive(iPoint,0) = temperature_wall; } - /*! - * \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 derivative of temperature with respect to density (at constant internal energy). */ diff --git a/SU2_CFD/include/variables/CRadP1Variable.hpp b/SU2_CFD/include/variables/CRadP1Variable.hpp index fc50698e5b32..96d466bff5ae 100644 --- a/SU2_CFD/include/variables/CRadP1Variable.hpp +++ b/SU2_CFD/include/variables/CRadP1Variable.hpp @@ -2,7 +2,7 @@ * \file CRadP1Variable.hpp * \brief Class for defining the variables of the P1 radiation model. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CRadVariable.hpp b/SU2_CFD/include/variables/CRadVariable.hpp index 06fab424ab0f..7fc0babcbc51 100644 --- a/SU2_CFD/include/variables/CRadVariable.hpp +++ b/SU2_CFD/include/variables/CRadVariable.hpp @@ -2,7 +2,7 @@ * \file CRadVariable.hpp * \brief Class for defining the variables of the radiation solver. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CTransLMVariable.hpp b/SU2_CFD/include/variables/CTransLMVariable.hpp index b2a315e3f310..c62d5e85ba10 100644 --- a/SU2_CFD/include/variables/CTransLMVariable.hpp +++ b/SU2_CFD/include/variables/CTransLMVariable.hpp @@ -2,7 +2,7 @@ * \file CTransLMVariable.hpp * \brief Declaration of the variables of the transition model. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CTurbSAVariable.hpp b/SU2_CFD/include/variables/CTurbSAVariable.hpp index 2c6491d87569..ee9450fc6fbe 100644 --- a/SU2_CFD/include/variables/CTurbSAVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSAVariable.hpp @@ -2,7 +2,7 @@ * \file CTurbSAVariable.hpp * \brief Declaration of the variables of the SA turbulence model. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CTurbSSTVariable.hpp b/SU2_CFD/include/variables/CTurbSSTVariable.hpp index c208e75b1e31..a9faec3fa452 100644 --- a/SU2_CFD/include/variables/CTurbSSTVariable.hpp +++ b/SU2_CFD/include/variables/CTurbSSTVariable.hpp @@ -2,7 +2,7 @@ * \file CTurbSSTVariable.hpp * \brief Declaration of the variables of the SST turbulence model. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CTurbVariable.hpp b/SU2_CFD/include/variables/CTurbVariable.hpp index 97d2935eb4cc..0cd532ee10fc 100644 --- a/SU2_CFD/include/variables/CTurbVariable.hpp +++ b/SU2_CFD/include/variables/CTurbVariable.hpp @@ -2,7 +2,7 @@ * \file CTurbVariable.hpp * \brief Base class for defining the variables of the turbulence model. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 4accd4ee4580..a1064a90cc70 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -4,7 +4,7 @@ variables, function definitions in file CVariable.cpp. All variables are children of at least this class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -288,29 +288,12 @@ class CVariable { } /*! - * \brief Set to zero the velocity components of the solution. - * \param[in] iPoint - Point index. - */ - inline void SetVelSolutionZero(unsigned long iPoint) { - for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint,iDim+1) = 0.0; - } - - /*! - * \brief Specify a vector to set the velocity components of the solution. + * \brief Virtual Member. Specify a vector to set the velocity components of the solution. + * Multiplied by density for compressible cases. * \param[in] iPoint - Point index. * \param[in] val_vector - Pointer to the vector. */ - inline void SetVelSolutionVector(unsigned long iPoint, const su2double *val_vector) { - for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint, iDim+1) = val_vector[iDim]; - } - - /*! - * \brief Set to zero velocity components of the solution. - * \param[in] iPoint - Point index. - */ - inline void SetVelSolutionOldZero(unsigned long iPoint) { - for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution_Old(iPoint, iDim+1) = 0.0; - } + inline virtual void SetVelSolutionVector(unsigned long iPoint, const su2double *val_vector) { } /*! * \brief Add a value to the solution. @@ -469,6 +452,7 @@ class CVariable { * \return Pointer to the External row for iPoint. */ inline const su2double *Get_External(unsigned long iPoint) const { return External[iPoint]; } + inline const MatrixType& Get_External() const { return External; } /*! * \brief Get the solution at time n. @@ -511,12 +495,6 @@ class CVariable { for (unsigned long iVar = 0; iVar < nVar; iVar++) Residual_Sum(iPoint,iVar) = 0.0; } - /*! - * \brief Set the velocity of the truncation error to zero. - * \param[in] iPoint - Point index. - */ - inline virtual void SetVel_ResTruncError_Zero(unsigned long iPoint, unsigned long iSpecies) {} - /*! * \brief Get the value of the summed residual. * \param[in] iPoint - Point index. @@ -662,12 +640,10 @@ class CVariable { inline void SetVal_ResTruncError_Zero(unsigned long iPoint, unsigned long iVar) {Res_TruncError(iPoint, iVar) = 0.0;} /*! - * \brief Set the velocity of the truncation error to zero. + * \brief Set the momentum part of the truncation error to zero. * \param[in] iPoint - Point index. */ - inline void SetVel_ResTruncError_Zero(unsigned long iPoint) { - for (unsigned long iDim = 0; iDim < nDim; iDim++) Res_TruncError(iPoint,iDim+1) = 0.0; - } + inline virtual void SetVel_ResTruncError_Zero(unsigned long iPoint) { } /*! * \brief Set the velocity of the truncation error to zero. @@ -1051,26 +1027,6 @@ class CVariable { */ inline virtual su2double GetSensor(unsigned long iPoint, unsigned long iSpecies) const { return 0.0; } - /*! - * \brief Add the value of the undivided laplacian of the solution. - * \param[in] iPoint - Point index. - * \param[in] val_und_lapl - Value of the undivided solution. - */ - inline void AddUnd_Lapl(unsigned long iPoint, const su2double *val_und_lapl) { - for (unsigned long iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian(iPoint, iVar) += val_und_lapl[iVar]; - } - - /*! - * \brief Subtract the value of the undivided laplacian of the solution. - * \param[in] iPoint - Point index. - * \param[in] val_und_lapl - Value of the undivided solution. - */ - inline void SubtractUnd_Lapl(unsigned long iPoint, const su2double *val_und_lapl) { - for (unsigned long iVar = 0; iVar < nVar; iVar++) - Undivided_Laplacian(iPoint, iVar) -= val_und_lapl[iVar]; - } - /*! * \brief Increment the value of the undivided laplacian of the solution. * \param[in] iPoint - Point index. @@ -1081,11 +1037,6 @@ class CVariable { Undivided_Laplacian(iPoint, iVar) += val_und_lapl; } - /*! - * \brief Set the undivided laplacian of the solution to zero. - */ - void SetUnd_LaplZero(); - /*! * \brief Set a value to the undivided laplacian. * \param[in] iPoint - Point index. @@ -1119,13 +1070,6 @@ class CVariable { */ inline virtual su2double GetDensity(unsigned long iPoint) const { return 0.0; } - /*! - * \brief A virtual member. - * \param[in] iPoint - Point index. - * \return Old value of the flow density. - */ - inline virtual su2double GetDensity_Old(unsigned long iPoint) const { return 0.0; } - /*! * \brief A virtual member. * \param[in] iPoint - Point index. @@ -1821,11 +1765,6 @@ class CVariable { */ inline virtual void SetSpecificHeatCv(unsigned long iPoint, su2double Cv) {} - /*! - * \brief A virtual member. - */ - inline virtual bool SetVorticity_StrainMag() { return false; } - /*! * \brief A virtual member. */ @@ -2240,40 +2179,17 @@ class CVariable { */ inline virtual void Set_OldSolution_Accel() {} - /*! - * \brief A virtual member. Set the value of the solution predictor. - */ - inline virtual void SetSolution_Pred(unsigned long iPoint) {} - /*! * \brief A virtual member. Set the value of the old solution. * \param[in] solution_pred - Pointer to the residual vector. */ inline virtual void SetSolution_Pred(unsigned long iPoint, const su2double *solution_pred) {} - /*! - * \brief A virtual member. Set the value of the solution predicted. - * \param[in] solution_old - Pointer to the residual vector. - */ - inline virtual void SetSolution_Pred(unsigned long iPoint, unsigned long iVar, su2double solution_pred) {} - - /*! - * \brief A virtual member. Get the value of the solution predictor. - * \param[in] iVar - Index of the variable. - * \return Pointer to the old solution vector. - */ - inline virtual su2double GetSolution_Pred(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - /*! * \brief A virtual member. Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ - inline virtual su2double *GetSolution_Pred(unsigned long iPoint) {return nullptr; } - - /*! - * \brief A virtual member. Set the value of the solution predictor. - */ - inline virtual void SetSolution_Pred_Old(unsigned long iPoint) {} + inline virtual const su2double *GetSolution_Pred(unsigned long iPoint) const { return nullptr; } /*! * \brief A virtual member. Set the value of the old solution. @@ -2281,24 +2197,11 @@ class CVariable { */ inline virtual void SetSolution_Pred_Old(unsigned long iPoint, const su2double *solution_pred_Old) {} - /*! - * \brief A virtual member. Set the value of the old solution predicted. - * \param[in] solution_pred_old - Pointer to the residual vector. - */ - inline virtual void SetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar, su2double solution_pred_old) {} - - /*! - * \brief A virtual member. Get the value of the solution predictor. - * \param[in] iVar - Index of the variable. - * \return Pointer to the old solution vector. - */ - inline virtual su2double GetSolution_Pred_Old(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - /*! * \brief A virtual member. Get the solution at time n. * \return Pointer to the solution (at time n) vector. */ - inline virtual su2double *GetSolution_Pred_Old(unsigned long iPoint) { return nullptr; } + inline virtual const su2double *GetSolution_Pred_Old(unsigned long iPoint) const { return nullptr; } /*! * \brief A virtual member. @@ -2308,7 +2211,7 @@ class CVariable { /*! * \brief A virtual member. */ - inline virtual su2double *GetReference_Geometry(unsigned long iPoint) {return nullptr; } + inline virtual const su2double* GetReference_Geometry(unsigned long iPoint) const { return nullptr; } /*! * \brief A virtual member. @@ -2325,11 +2228,6 @@ class CVariable { */ inline virtual su2double GetPrestretch(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - /*! - * \brief A virtual member. - */ - inline virtual su2double GetReference_Geometry(unsigned long iPoint, unsigned long iVar) const { return 0.0; } - /*! * \brief A virtual member. Get the value of the undeformed coordinates. * \param[in] iDim - Index of Mesh_Coord[nDim] @@ -2653,6 +2551,34 @@ class CVariable { inline virtual su2double GetSolution_Old_Accel(unsigned long iPoint, unsigned long iVar) const { return 0.0; } + /*! + * \brief A virtual member: Set the recovered pressure for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \param[in] val_pressure - pressure value. + */ + inline virtual void SetStreamwise_Periodic_RecoveredPressure(unsigned long iPoint,su2double val_pressure) { } + + /*! + * \brief A virtual member: Get the recovered pressure for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \return Recovered/Physical pressure for streamwise periodic flow. + */ + inline virtual su2double GetStreamwise_Periodic_RecoveredPressure(unsigned long iPoint) const { return 0.0; } + + /*! + * \brief A virtual member: Set the recovered temperature for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \param[in] val_temperature - temperature value. + */ + inline virtual void SetStreamwise_Periodic_RecoveredTemperature(unsigned long iPoint, su2double val_temperature) { } + + /*! + * \brief A virtual member: Get the recovered temperature for streamwise periodic flow. + * \param[in] iPoint - Point index. + * \return Recovered/Physical temperature for streamwise periodic flow. + */ + inline virtual su2double GetStreamwise_Periodic_RecoveredTemperature(unsigned long iPoint) const { return 0.0; } + /*! * \brief Virtual member: Set the Radiative source term at the node * \return value of the radiative source term diff --git a/SU2_CFD/obj/Makefile.am b/SU2_CFD/obj/Makefile.am index 063e1fa70cad..30e7636a0e50 100644 --- a/SU2_CFD/obj/Makefile.am +++ b/SU2_CFD/obj/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for SU2_CFD # \author M. Colonno, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -59,6 +59,7 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/integration/CIntegration.cpp \ ../src/integration/CSingleGridIntegration.cpp \ ../src/integration/CMultiGridIntegration.cpp \ + ../src/integration/CNewtonIntegration.cpp \ ../src/integration/CStructuralIntegration.cpp \ ../src/integration/CFEM_DG_Integration.cpp \ ../src/integration/CIntegrationFactory.cpp \ diff --git a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp index 05a85782420c..c0b289ac7dcb 100644 --- a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp +++ b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp @@ -2,7 +2,7 @@ * \file CMarkerProfileReaderFVM.cpp * \brief Class that handles the reading of marker profile files. * \author T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -208,8 +208,8 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() { /*--- Communicate the total number of nodes on this domain. ---*/ SU2_MPI::Gather(&Buffer_Send_nPoin, 1, MPI_UNSIGNED_LONG, - Buffer_Recv_nPoin, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&nLocalPoint, &MaxLocalPoint, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); + Buffer_Recv_nPoin, 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&nLocalPoint, &MaxLocalPoint, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); /*--- Send and Recv buffers. ---*/ @@ -300,15 +300,15 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() { /*--- Gather the coordinate data on the master node using MPI. ---*/ SU2_MPI::Gather(Buffer_Send_X, (int)MaxLocalPoint, MPI_DOUBLE, - Buffer_Recv_X, (int)MaxLocalPoint, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Buffer_Recv_X, (int)MaxLocalPoint, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); SU2_MPI::Gather(Buffer_Send_Y, (int)MaxLocalPoint, MPI_DOUBLE, - Buffer_Recv_Y, (int)MaxLocalPoint, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Buffer_Recv_Y, (int)MaxLocalPoint, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); if (dimension == 3) { SU2_MPI::Gather(Buffer_Send_Z, (int)MaxLocalPoint, MPI_DOUBLE, - Buffer_Recv_Z, (int)MaxLocalPoint, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + Buffer_Recv_Z, (int)MaxLocalPoint, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); } SU2_MPI::Gather(Buffer_Send_Str, (int)MaxLocalPoint*MAX_STRING_SIZE, MPI_CHAR, - Buffer_Recv_Str, (int)MaxLocalPoint*MAX_STRING_SIZE, MPI_CHAR, MASTER_NODE, MPI_COMM_WORLD); + Buffer_Recv_Str, (int)MaxLocalPoint*MAX_STRING_SIZE, MPI_CHAR, MASTER_NODE, SU2_MPI::GetComm()); /*--- The master node unpacks and sorts this variable by marker tag. ---*/ diff --git a/SU2_CFD/src/SU2_CFD.cpp b/SU2_CFD/src/SU2_CFD.cpp index 8ad8edc08fc2..35d49885482b 100644 --- a/SU2_CFD/src/SU2_CFD.cpp +++ b/SU2_CFD/src/SU2_CFD.cpp @@ -2,7 +2,7 @@ * \file SU2_CFD.cpp * \brief Main file of the SU2 Computational Fluid Dynamics code * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) { /*--- Command line parsing ---*/ - CLI::App app{"SU2 v7.1.0 \"Blackbird\", The Open-Source CFD Code"}; + CLI::App app{"SU2 v7.1.1 \"Blackbird\", The Open-Source CFD Code"}; app.add_flag("-d,--dryrun", dry_run, "Enable dry run mode.\n" "Only execute preprocessing steps using a dummy geometry."); app.add_option("-t,--threads", num_threads, "Number of OpenMP threads per MPI rank."); @@ -60,14 +60,14 @@ int main(int argc, char *argv[]) { /*--- MPI initialization, and buffer setting ---*/ -#ifdef HAVE_OMP +#if defined(HAVE_OMP) && defined(HAVE_MPI) int required = use_thread_mult? MPI_THREAD_MULTIPLE : MPI_THREAD_FUNNELED; int provided; SU2_MPI::Init_thread(&argc, &argv, required, &provided); #else SU2_MPI::Init(&argc, &argv); #endif - SU2_Comm MPICommunicator(MPI_COMM_WORLD); + SU2_MPI::Comm MPICommunicator = SU2_MPI::GetComm(); /*--- Uncomment the following line if runtime NaN catching is desired. ---*/ // feenableexcept(FE_INVALID | FE_OVERFLOW); diff --git a/SU2_CFD/src/definition_structure.cpp b/SU2_CFD/src/definition_structure.cpp index f37d74a9db02..7a05145b4a86 100644 --- a/SU2_CFD/src/definition_structure.cpp +++ b/SU2_CFD/src/definition_structure.cpp @@ -2,7 +2,7 @@ * \file definition_structure.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -46,8 +46,8 @@ void Partition_Analysis(CGeometry *geometry, CConfig *config) { int size = SINGLE_NODE; #ifdef HAVE_MPI - SU2_MPI::Comm_rank(MPI_COMM_WORLD, &rank); - SU2_MPI::Comm_size(MPI_COMM_WORLD, &size); + SU2_MPI::Comm_rank(SU2_MPI::GetComm(), &rank); + SU2_MPI::Comm_size(SU2_MPI::GetComm(), &size); #endif nPointTotal = geometry->GetnPoint(); @@ -119,7 +119,7 @@ void Partition_Analysis(CGeometry *geometry, CConfig *config) { Profile_File << "\"Rank\", \"nNeighbors\", \"nPointTotal\", \"nEdge\", \"nPointGhost\", \"nSendTotal\", \"nRecvTotal\", \"nElemTotal\", \"nElemBoundary\", \"nElemHalo\", \"nnz\"" << endl; Profile_File.close(); } - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Loop through the map and write the results to the file ---*/ @@ -129,7 +129,7 @@ void Partition_Analysis(CGeometry *geometry, CConfig *config) { Profile_File << rank << ", " << nNeighbors << ", " << nPointTotal << ", " << nEdge << "," << nPointGhost << ", " << nSendTotal << ", " << nRecvTotal << ", " << nElemTotal << "," << nElemBound << ", " << nElemHalo << ", " << nnz << endl; Profile_File.close(); } - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); } delete [] isHalo; @@ -151,8 +151,8 @@ void Partition_Analysis_FEM(CGeometry *geometry, CConfig *config) { int size = SINGLE_NODE; #ifdef HAVE_MPI - SU2_MPI::Comm_rank(MPI_COMM_WORLD, &rank); - SU2_MPI::Comm_size(MPI_COMM_WORLD, &size); + SU2_MPI::Comm_rank(SU2_MPI::GetComm(), &rank); + SU2_MPI::Comm_size(SU2_MPI::GetComm(), &size); #endif /*--- Create an object of the class CMeshFEM_DG and retrieve the necessary @@ -218,7 +218,7 @@ void Partition_Analysis_FEM(CGeometry *geometry, CConfig *config) { Profile_File << "\"Rank\", \"nNeighSend\", \"nNeighRecv\", \"nElemOwned\", \"nElemSendTotal\", \"nElemRecvTotal\", \"nDOFOwned\", \"nDOFSendTotal\", \"nDOFRecvTotal\"" << endl; Profile_File.close(); } - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Loop through the map and write the results to the file ---*/ @@ -230,7 +230,7 @@ void Partition_Analysis_FEM(CGeometry *geometry, CConfig *config) { << nDOFSendTotal << ", " << nDOFRecvTotal << endl; Profile_File.close(); } - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); } } diff --git a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp index 33eab6df187c..d8afeb89d142 100644 --- a/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp @@ -1,8 +1,8 @@ /*! * \file CDiscAdjMultizoneDriver.cpp * \brief The main subroutines for driving adjoint multi-zone problems - * \author O. Burghardt, T. Albring, R. Sanchez - * \version 7.1.0 "Blackbird" + * \author O. Burghardt, P. Gomes, T. Albring, R. Sanchez + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -31,7 +31,6 @@ #include "../../include/output/COutputLegacy.hpp" #include "../../include/output/COutput.hpp" #include "../../include/iteration/CIterationFactory.hpp" -#include "../../../Common/include/toolboxes/CQuasiNewtonInvLeastSquares.hpp" CDiscAdjMultizoneDriver::CDiscAdjMultizoneDriver(char* confFile, unsigned short val_nZone, @@ -47,6 +46,12 @@ CDiscAdjMultizoneDriver::CDiscAdjMultizoneDriver(char* confFile, Has_Deformation.resize(nZone) = false; + + FixPtCorrector.resize(nZone); + LinSolver.resize(nZone); + AdjRHS.resize(nZone); + AdjSol.resize(nZone); + direct_iteration = new CIteration**[nZone]; direct_output = new COutput*[nZone]; @@ -156,11 +161,51 @@ void CDiscAdjMultizoneDriver::StartSolver() { } +bool CDiscAdjMultizoneDriver::Iterate(unsigned short iZone, unsigned long iInnerIter, bool KrylovMode) { + + config_container[iZone]->SetInnerIter(iInnerIter); + + /*--- Evaluate the tape section belonging to solvers in iZone. + * Only evaluate TRANSFER terms on the last iteration or after convergence. ---*/ + + eval_transfer = (eval_transfer || (iInnerIter == nInnerIter[iZone]-1)) && !KrylovMode; + + ComputeAdjoints(iZone, eval_transfer); + + /*--- Extracting adjoints for solvers in iZone w.r.t. to outputs in iZone (diagonal part). ---*/ + + iteration_container[iZone][INST_0]->Iterate(output_container[iZone], integration_container, geometry_container, + solver_container, numerics_container, config_container, + surface_movement, grid_movement, FFDBox, iZone, INST_0); + + /*--- Use QN driver to improve the solution. ---*/ + + if (FixPtCorrector[iZone].size()) { + GetAllSolutions(iZone, true, FixPtCorrector[iZone].FPresult()); + FixPtCorrector[iZone].compute(); + if(iInnerIter) SetAllSolutions(iZone, true, FixPtCorrector[iZone]); + } + + /*--- Residuals during GMRES iterations have no meaning ---*/ + + if (KrylovMode && iInnerIter) return false; + + /*--- This is done explicitly here for multizone cases, only in inner iterations and not when + * extracting cross terms so that the adjoint residuals in each zone still make sense. ---*/ + + Set_SolutionOld_To_Solution(iZone); + + /*--- Print out the convergence data to screen and history file. ---*/ + + return iteration_container[iZone][INST_0]->Monitor(output_container[iZone], integration_container, geometry_container, + solver_container, numerics_container, config_container, + surface_movement, grid_movement, FFDBox, iZone, INST_0); +} + void CDiscAdjMultizoneDriver::Run() { unsigned long wrt_sol_freq = 9999; unsigned long nOuterIter = driver_config->GetnOuter_Iter(); - vector > fixPtCorrector(nZone); for (iZone = 0; iZone < nZone; iZone++) { @@ -175,13 +220,21 @@ void CDiscAdjMultizoneDriver::Run() { Set_BGSSolution_k_To_Solution(iZone); - /*--- Prepare quasi-Newton drivers. ---*/ + /*--- Prepare Krylov or quasi-Newton methods. ---*/ + + const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint(); + const auto nPointDomain = geometry_container[iZone][INST_0][MESH_0]->GetnPointDomain(); + const auto nVar = GetTotalNumberOfVariables(iZone, true); - if (config_container[iZone]->GetnQuasiNewtonSamples() > 1) { - fixPtCorrector[iZone].resize(config_container[iZone]->GetnQuasiNewtonSamples(), - geometry_container[iZone][INST_0][MESH_0]->GetnPoint(), - GetTotalNumberOfVariables(iZone, true), - geometry_container[iZone][INST_0][MESH_0]->GetnPointDomain()); + if (config_container[iZone]->GetNewtonKrylov() && + config_container[iZone]->GetnQuasiNewtonSamples() >= KrylovMinIters) { + AdjRHS[iZone].Initialize(nPoint, nPointDomain, nVar, nullptr); + AdjSol[iZone].Initialize(nPoint, nPointDomain, nVar, nullptr); + LinSolver[iZone].SetRecomputeResidual(false); + LinSolver[iZone].SetMonitoringFrequency(config_container[iZone]->GetScreen_Wrt_Freq(2)); + } + else if (config_container[iZone]->GetnQuasiNewtonSamples() > 1) { + FixPtCorrector[iZone].resize(config_container[iZone]->GetnQuasiNewtonSamples(), nPoint, nVar, nPointDomain); } } @@ -197,7 +250,7 @@ void CDiscAdjMultizoneDriver::Run() { /*--- Initialize External with the objective function gradient. ---*/ - su2double rhs_norm = 0.0; + su2double rhs_norm = 0.0; for (iZone = 0; iZone < nZone; iZone++) { @@ -269,66 +322,69 @@ void CDiscAdjMultizoneDriver::Run() { /*--- Inner loop to allow for multiple adjoint updates with respect to solvers in iZone. ---*/ - bool eval_transfer = false; const bool restart = config_container[iZone]->GetRestart(); const bool no_restart = (iOuterIter > 0) || !restart; + eval_transfer = false; /*--- Reset QN driver for new inner iterations. ---*/ - if (fixPtCorrector[iZone].size()) { - fixPtCorrector[iZone].reset(); - if(restart && (iOuterIter==1)) GetAllSolutions(iZone, true, fixPtCorrector[iZone]); + if (FixPtCorrector[iZone].size()) { + FixPtCorrector[iZone].reset(); + if(restart && (iOuterIter==1)) GetAllSolutions(iZone, true, FixPtCorrector[iZone]); } - for (unsigned long iInnerIter = 0; iInnerIter < nInnerIter[iZone]; iInnerIter++) { - - config_container[iZone]->SetInnerIter(iInnerIter); + if (!config_container[iZone]->GetNewtonKrylov() || !no_restart || nInnerIter[iZone] < KrylovMinIters) { - /*--- Add off-diagonal contribution (including the OF gradient) to Solution. ---*/ + /*--- Regular fixed-point, possibly with quasi-Newton method. ---*/ - if (no_restart || (iInnerIter > 0)) { - Add_External_To_Solution(iZone); - } - else { - /*--- If we restarted, Solution already has all contributions, - * we run only one inner iter to compute the cross terms. ---*/ - eval_transfer = true; - } + for (unsigned long iInnerIter = 0; iInnerIter < nInnerIter[iZone]; iInnerIter++) { - /*--- Evaluate the tape section belonging to solvers in iZone. - * Only evaluate TRANSFER terms on the last iteration or after convergence. ---*/ + /*--- Add off-diagonal contribution (including the OF gradient) to Solution. ---*/ - eval_transfer = eval_transfer || (iInnerIter == nInnerIter[iZone]-1); + if (no_restart || (iInnerIter > 0)) { + Add_External_To_Solution(iZone); + } + else { + /*--- If we restarted, Solution already has all contributions, + * we run only one inner iter to compute the cross terms. ---*/ + eval_transfer = true; + } - ComputeAdjoints(iZone, eval_transfer); + const bool converged = Iterate(iZone, iInnerIter); - /*--- Extracting adjoints for solvers in iZone w.r.t. to outputs in iZone (diagonal part). ---*/ + if (eval_transfer) break; - iteration_container[iZone][INST_0]->Iterate(output_container[iZone], integration_container, geometry_container, - solver_container, numerics_container, config_container, - surface_movement, grid_movement, FFDBox, iZone, INST_0); + eval_transfer = converged; + } + } + else { + /*--- Use FGMRES to solve the adjoint system, the RHS is -External, + * the solution are the iZone adjoint variables + External, + * Recall that External also contains the OF gradient. ---*/ - /*--- Use QN driver to improve the solution. ---*/ + GetAdjointRHS(iZone, AdjRHS[iZone]); - if (fixPtCorrector[iZone].size()) { - GetAllSolutions(iZone, true, fixPtCorrector[iZone].FPresult()); - fixPtCorrector[iZone].compute(); - if(iInnerIter) SetAllSolutions(iZone, true, fixPtCorrector[iZone]); - } + Add_External_To_Solution(iZone); - /*--- This is done explicitly here for multizone cases, only in inner iterations and not when - * extracting cross terms so that the adjoint residuals in each zone still make sense. ---*/ + GetAllSolutions(iZone, true, AdjSol[iZone]); - Set_SolutionOld_To_Solution(iZone); + const bool monitor = config_container[iZone]->GetWrt_ZoneConv(); + const auto product = AdjointProduct(this, iZone); - /*--- Print out the convergence data to screen and history file. ---*/ + Scalar eps = 1.0; + for (auto totalIter = nInnerIter[iZone]; totalIter >= KrylovMinIters && eps > KrylovTol;) { + Scalar eps_l = 0.0; + Scalar tol_l = KrylovTol / eps; + auto iter = min(totalIter-1ul, config_container[iZone]->GetnQuasiNewtonSamples()-1ul); + iter = LinSolver[iZone].FGMRES_LinSolver(AdjRHS[iZone], AdjSol[iZone], product, Identity(), + tol_l, iter, eps_l, monitor, config_container[iZone]); + totalIter -= iter+1; + eps *= eps_l; + } - bool converged = iteration_container[iZone][INST_0]->Monitor(output_container[iZone], integration_container, - geometry_container, solver_container, numerics_container, - config_container, surface_movement, grid_movement, FFDBox, iZone, INST_0); - if (eval_transfer) break; - eval_transfer = converged; + SetAllSolutions(iZone, true, AdjSol[iZone]); + Iterate(iZone, nInnerIter[iZone]-1); } /*--- Off-diagonal (coupling term) BGS update. ---*/ @@ -569,7 +625,7 @@ void CDiscAdjMultizoneDriver::SetRecording(unsigned short kind_recording, Kind_T #ifdef CODI_REVERSE_TYPE if (size > SINGLE_NODE) { su2double myMem = AD::globalTape.getTapeValues().getUsedMemorySize(), totMem = 0.0; - SU2_MPI::Allreduce(&myMem, &totMem, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&myMem, &totMem, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); if (rank == MASTER_NODE) { cout << "MPI\n"; cout << "-------------------------------------\n"; diff --git a/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp b/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp index 8cc5edd4437b..fee8c00af659 100644 --- a/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp +++ b/SU2_CFD/src/drivers/CDiscAdjSinglezoneDriver.cpp @@ -2,7 +2,7 @@ * \file driver_adjoint_singlezone.cpp * \brief The main subroutines for driving adjoint single-zone problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -296,7 +296,7 @@ void CDiscAdjSinglezoneDriver::SetRecording(unsigned short kind_recording){ #ifdef CODI_REVERSE_TYPE if (size > SINGLE_NODE) { su2double myMem = AD::globalTape.getTapeValues().getUsedMemorySize(), totMem = 0.0; - SU2_MPI::Allreduce(&myMem, &totMem, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&myMem, &totMem, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); if (rank == MASTER_NODE) { cout << "MPI\n"; cout << "-------------------------------------\n"; diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 7ee5c3571587..32b0e871c8e9 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -2,7 +2,7 @@ * \file driver_structure.cpp * \brief The main subroutines for driving single or multi-zone problems. * \author T. Economon, H. Kline, R. Sanchez, F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -701,6 +701,10 @@ void CDriver::Geometrical_Preprocessing(CConfig* config, CGeometry **&geometry, geometry[iMesh]->MatchPeriodic(config, iPeriodic); } + /*--- For Streamwise Periodic flow, find a unique reference node on the dedicated inlet marker. ---*/ + if (config->GetKind_Streamwise_Periodic() != NONE) + geometry[iMesh]->FindUniqueNode_PeriodicBound(config); + /*--- Initialize the communication framework for the periodic BCs. ---*/ geometry[iMesh]->PreprocessPeriodicComms(geometry[iMesh], config); @@ -1830,6 +1834,9 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol else numerics[iMGlevel][FLOW_SOL][source_first_term] = new CSourceBodyForce(nDim, nVar_Flow, config); } + else if (incompressible && (config->GetKind_Streamwise_Periodic() != NONE)) { + numerics[iMGlevel][FLOW_SOL][source_first_term] = new CSourceIncStreamwise_Periodic(nDim, nVar_Flow, config); + } else if (incompressible && (config->GetKind_DensityModel() == BOUSSINESQ)) { numerics[iMGlevel][FLOW_SOL][source_first_term] = new CSourceBoussinesq(nDim, nVar_Flow, config); } @@ -1860,6 +1867,9 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol /*--- At the moment it is necessary to have the RHT equation in order to have a volumetric heat source. ---*/ if (config->AddRadiation()) numerics[iMGlevel][FLOW_SOL][source_second_term] = new CSourceRadiation(nDim, nVar_Flow, config); + else if ((incompressible && (config->GetKind_Streamwise_Periodic() != NONE)) && + (config->GetEnergy_Equation() && !config->GetStreamwise_Periodic_Temperature())) + numerics[iMGlevel][FLOW_SOL][source_second_term] = new CSourceIncStreamwisePeriodic_Outlet(nDim, nVar_Flow, config); else numerics[iMGlevel][FLOW_SOL][source_second_term] = new CSourceNothing(nDim, nVar_Flow, config); } @@ -2956,10 +2966,8 @@ void CFluidDriver::Preprocess(unsigned long Iter) { config_container[iZone]->SetPhysicalTime(static_cast(Iter)*config_container[iZone]->GetDelta_UnstTimeND()); else config_container[iZone]->SetPhysicalTime(0.0); - } - // /*--- Read the target pressure ---*/ // if (config_container[ZONE_0]->GetInvDesign_Cp() == YES) @@ -2976,14 +2984,7 @@ void CFluidDriver::Preprocess(unsigned long Iter) { if(!fsi) { for (iZone = 0; iZone < nZone; iZone++) { - if ((config_container[iZone]->GetKind_Solver() == EULER) || - (config_container[iZone]->GetKind_Solver() == NAVIER_STOKES) || - (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)) { + if (config_container[iZone]->GetFluidProblem()) { 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); } diff --git a/SU2_CFD/src/drivers/CDummyDriver.cpp b/SU2_CFD/src/drivers/CDummyDriver.cpp index 63780909763f..e6d440b662cd 100644 --- a/SU2_CFD/src/drivers/CDummyDriver.cpp +++ b/SU2_CFD/src/drivers/CDummyDriver.cpp @@ -2,7 +2,7 @@ * \file CDummyDriver.cpp * \brief Dummy driver class for running the preprocessing without geometry preprocessing. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/drivers/CMultizoneDriver.cpp b/SU2_CFD/src/drivers/CMultizoneDriver.cpp index e1e14188a4de..567ee1b14dcd 100644 --- a/SU2_CFD/src/drivers/CMultizoneDriver.cpp +++ b/SU2_CFD/src/drivers/CMultizoneDriver.cpp @@ -2,7 +2,7 @@ * \file driver_structure.cpp * \brief The main subroutines for driving multi-zone problems. * \author R. Sanchez, O. Burghardt - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -81,7 +81,7 @@ CMultizoneDriver::CMultizoneDriver(char* confFile, unsigned short val_nZone, SU2 break; case NEMO_EULER: case NEMO_NAVIER_STOKES: fluid_zone = true; - break; + break; case FEM_ELASTICITY: structural_zone = true; break; @@ -263,9 +263,7 @@ void CMultizoneDriver::Preprocess(unsigned long TimeIter) { } } -#ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); -#endif + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Run a predictor step ---*/ for (iZone = 0; iZone < nZone; iZone++) { diff --git a/SU2_CFD/src/drivers/CSinglezoneDriver.cpp b/SU2_CFD/src/drivers/CSinglezoneDriver.cpp index 30fe1077d670..683798053d5e 100644 --- a/SU2_CFD/src/drivers/CSinglezoneDriver.cpp +++ b/SU2_CFD/src/drivers/CSinglezoneDriver.cpp @@ -2,7 +2,7 @@ * \file driver_direct_singlezone.cpp * \brief The main subroutines for driving single-zone problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -131,9 +131,7 @@ void CSinglezoneDriver::Preprocess(unsigned long TimeIter) { config_container[ZONE_0], TimeIter); } -#ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); -#endif + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Run a predictor step ---*/ if (config_container[ZONE_0]->GetPredictor()) diff --git a/SU2_CFD/src/fluid/CFluidModel.cpp b/SU2_CFD/src/fluid/CFluidModel.cpp index 2d5f73ba2ba0..1ff0728c4f51 100644 --- a/SU2_CFD/src/fluid/CFluidModel.cpp +++ b/SU2_CFD/src/fluid/CFluidModel.cpp @@ -2,7 +2,7 @@ * \file CFluidModel.cpp * \brief Source of the fluid model base class containing thermo-physical subroutines. * \author S.Vitale, M.Pini, G.Gori, A.Guardone, P.Colonna, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/fluid/CIdealGas.cpp b/SU2_CFD/src/fluid/CIdealGas.cpp index ba1b7d9c8b76..78bf83b128ca 100644 --- a/SU2_CFD/src/fluid/CIdealGas.cpp +++ b/SU2_CFD/src/fluid/CIdealGas.cpp @@ -2,7 +2,7 @@ * \file CIdealGas.cpp * \brief Source of the ideal gas model. * \author S. Vitale, G. Gori, M. Pini, A. Guardone, P. Colonna - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/fluid/CMutationTCLib.cpp b/SU2_CFD/src/fluid/CMutationTCLib.cpp index 9e27e18a2c0e..8885bda6a6c6 100644 --- a/SU2_CFD/src/fluid/CMutationTCLib.cpp +++ b/SU2_CFD/src/fluid/CMutationTCLib.cpp @@ -2,7 +2,7 @@ * \file CMutationTCLib.cpp * \brief Source of the Mutation++ 2T nonequilibrium gas model. * \author C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -36,7 +36,6 @@ CMutationTCLib::CMutationTCLib(const CConfig* config, unsigned short val_nDim): /* Allocating memory*/ Cv_ks.resize(nEnergyEq*nSpecies,0.0); - h_RT.resize(nSpecies,0.0); es.resize(nEnergyEq*nSpecies,0.0); omega_vec.resize(1,0.0); @@ -148,12 +147,7 @@ su2double CMutationTCLib::ComputeEveSourceTerm(){ vector& CMutationTCLib::ComputeSpeciesEnthalpy(su2double val_T, su2double val_Tve, su2double *val_eves){ - su2double RuSI = UNIVERSAL_GAS_CONSTANT; - su2double Ru = 1000.0*RuSI; - - mix->speciesHOverRT(val_T, val_Tve, val_T, val_Tve, val_Tve, h_RT.data(), NULL, NULL, NULL, NULL, NULL); - - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) hs[iSpecies] = h_RT[iSpecies]*(RuSI*val_T); + mix->getEnthalpiesMass(hs.data()); return hs; } @@ -213,7 +207,7 @@ vector& CMutationTCLib::GetSpeciesFormationEnthalpy() { mix->speciesHOverRT(Tref, Tref, Tref, Tref, Tref, NULL, NULL, NULL, NULL, NULL, hf_RT.data()); - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) Enthalpy_Formation[iSpecies] = hf_RT[iSpecies]*(RuSI*Tref); + for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) Enthalpy_Formation[iSpecies] = hf_RT[iSpecies]*(RuSI*Tref*1000.0)/MolarMass[iSpecies]; return Enthalpy_Formation; } diff --git a/SU2_CFD/src/fluid/CNEMOGas.cpp b/SU2_CFD/src/fluid/CNEMOGas.cpp index 8bc4f331a2f2..3a36eae72201 100644 --- a/SU2_CFD/src/fluid/CNEMOGas.cpp +++ b/SU2_CFD/src/fluid/CNEMOGas.cpp @@ -2,7 +2,7 @@ * \file CNEMOGas.cpp * \brief Source of the nonequilibrium gas model. * \author C. Garbacz, W. Maier, S. R. Copeland - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -37,16 +37,16 @@ CNEMOGas::CNEMOGas(const CConfig* config, unsigned short val_nDim): CFluidModel( MolarMass.resize(nSpecies,0.0); MolarFractions.resize(nSpecies,0.0); rhos.resize(nSpecies,0.0); - Cvtrs.resize(nSpecies,0.0); - Cvves.resize(nSpecies,0.0); - eves.resize(nSpecies,0.0); - hs.resize(nSpecies,0.0); - ws.resize(nSpecies,0.0); + Cvtrs.resize(nSpecies,0.0); + Cvves.resize(nSpecies,0.0); + eves.resize(nSpecies,0.0); + hs.resize(nSpecies,0.0); + ws.resize(nSpecies,0.0); DiffusionCoeff.resize(nSpecies,0.0); Enthalpy_Formation.resize(nSpecies,0.0); Ref_Temperature.resize(nSpecies,0.0); temperatures.resize(nEnergyEq,0.0); - energies.resize(nEnergyEq,0.0); + energies.resize(nEnergyEq,0.0); ThermalConductivities.resize(nEnergyEq,0.0); gas_model = config->GetGasModel(); @@ -62,12 +62,12 @@ void CNEMOGas::SetTDStatePTTv(su2double val_pressure, const su2double *val_massf su2double denom; for (iSpecies = 0; iSpecies < nHeavy; iSpecies++) - MassFrac[iSpecies] = val_massfrac[iSpecies]; - Pressure = val_pressure; - T = val_temperature; - Tve = val_temperature_ve; - - denom = 0.0; + MassFrac[iSpecies] = val_massfrac[iSpecies]; + Pressure = val_pressure; + T = val_temperature; + Tve = val_temperature_ve; + + denom = 0.0; /*--- Calculate mixture density from supplied primitive quantities ---*/ for (iSpecies = 0; iSpecies < nHeavy; iSpecies++) @@ -79,7 +79,7 @@ void CNEMOGas::SetTDStatePTTv(su2double val_pressure, const su2double *val_massf for (iSpecies = 0; iSpecies < nSpecies; iSpecies++){ rhos[iSpecies] = MassFrac[iSpecies]*Density; MassFrac[iSpecies] = rhos[iSpecies]/Density; - } + } } su2double CNEMOGas::ComputeSoundSpeed(){ @@ -87,7 +87,7 @@ su2double CNEMOGas::ComputeSoundSpeed(){ su2double conc, rhoCvtr; conc = 0.0; - rhoCvtr = 0.0; + rhoCvtr = 0.0; Density = 0.0; auto& Cvtrs = GetSpeciesCvTraRot(); @@ -127,7 +127,7 @@ su2double CNEMOGas::ComputeGasConstant(){ for (iSpecies = 0; iSpecies < nHeavy; iSpecies++) Mass += MassFrac[iSpecies] * MolarMass[iSpecies]; GasConstant = Ru / Mass; - + return GasConstant; } @@ -166,8 +166,7 @@ void CNEMOGas::ComputedPdU(su2double *V, vector& val_eves, su2double su2double CvtrBAR, rhoCvtr, rhoCvve, rho_el, sqvel, conc, ef; if (val_dPdU == NULL) { - cout << "ERROR: CNEMOGas - CalcdPdU - Array dPdU not allocated!" << endl; - exit(1); + SU2_MPI::Error("Array dPdU not allocated!", CURRENT_FUNCTION); } /*--- Determine the electron density (if ionized) ---*/ @@ -188,7 +187,7 @@ void CNEMOGas::ComputedPdU(su2double *V, vector& val_eves, su2double Cvtrs = GetSpeciesCvTraRot(); Enthalpy_Formation = GetSpeciesFormationEnthalpy(); Ref_Temperature = GetRefTemperature(); - + /*--- Rename for convenience ---*/ rhoCvtr = V[RHOCVTR_INDEX]; rhoCvve = V[RHOCVVE_INDEX]; @@ -241,7 +240,7 @@ void CNEMOGas::ComputedPdU(su2double *V, vector& val_eves, su2double /*--- Vib.-el energy derivative ---*/ val_dPdU[nSpecies+nDim+1] = -val_dPdU[nSpecies+nDim] + - rho_el*Ru/MolarMass[nSpecies-1]*1.0/rhoCvve; + rho_el*Ru/MolarMass[nSpecies-1]*1.0/rhoCvve; } @@ -273,9 +272,9 @@ void CNEMOGas::ComputedTdU(su2double *V, su2double *val_dTdU){ ef = Enthalpy_Formation[iSpecies] - Ru/MolarMass[iSpecies]*Ref_Temperature[iSpecies]; val_dTdU[iSpecies] = (-ef + 0.5*v2 + Cvtrs[iSpecies]*(Ref_Temperature[iSpecies]-T)) / rhoCvtr; } + if (ionization) { - cout << "CNEMOGas: NEED TO IMPLEMENT dTdU for IONIZED MIX" << endl; - exit(1); + SU2_MPI::Error("NEED TO IMPLEMENT dTdU for IONIZED MIX",CURRENT_FUNCTION); } /*--- Momentum derivatives ---*/ @@ -286,15 +285,15 @@ void CNEMOGas::ComputedTdU(su2double *V, su2double *val_dTdU){ val_dTdU[nSpecies+nDim] = 1.0 / V[RHOCVTR_INDEX]; val_dTdU[nSpecies+nDim+1] = -1.0 / V[RHOCVTR_INDEX]; -} +} void CNEMOGas::ComputedTvedU(su2double *V, vector& val_eves, su2double *val_dTvedU){ su2double rhoCvve; - /*--- Necessary indexes to assess primitive variables ---*/ + /*--- Necessary indexes to assess primitive variables ---*/ unsigned long RHOCVVE_INDEX = nSpecies+nDim+7; - + /*--- Rename for convenience ---*/ rhoCvve = V[RHOCVVE_INDEX]; @@ -308,7 +307,7 @@ void CNEMOGas::ComputedTvedU(su2double *V, vector& val_eves, su2doubl /*--- Energy derivatives ---*/ val_dTvedU[nSpecies+nDim] = 0.0; - val_dTvedU[nSpecies+nDim+1] = 1.0 / rhoCvve; + val_dTvedU[nSpecies+nDim+1] = 1.0 / rhoCvve; } diff --git a/SU2_CFD/src/fluid/CPengRobinson.cpp b/SU2_CFD/src/fluid/CPengRobinson.cpp index e2205975f850..bf8456af6163 100644 --- a/SU2_CFD/src/fluid/CPengRobinson.cpp +++ b/SU2_CFD/src/fluid/CPengRobinson.cpp @@ -2,7 +2,7 @@ * \file CPengRobinson.cpp * \brief Source of the Peng-Robinson model. * \author S. Vitale, G. Gori, M. Pini, A. Guardone, P. Colonna - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/fluid/CSU2TCLib.cpp b/SU2_CFD/src/fluid/CSU2TCLib.cpp index 5d51bcc360b1..4fbafd8c39d9 100644 --- a/SU2_CFD/src/fluid/CSU2TCLib.cpp +++ b/SU2_CFD/src/fluid/CSU2TCLib.cpp @@ -2,7 +2,7 @@ * \file CSU2TCLib.cpp * \brief Source of user defined 2T nonequilibrium gas model. * \author C. Garbacz, W. Maier, S. R. Copeland - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -66,7 +66,7 @@ CSU2TCLib::CSU2TCLib(const CConfig* config, unsigned short val_nDim, bool viscou if (mf != 1.0) { cout << "CONFIG ERROR: Intial gas mass fractions do not sum to 1!" << " mf is equal to "<< mf < 2N + M RxnConstantTable(0,0) = 3.4907; RxnConstantTable(0,1) = 0.83133; RxnConstantTable(0,2) = 4.0978; RxnConstantTable(0,3) = -12.728; RxnConstantTable(0,4) = 0.07487; //n = 1E14 @@ -1517,7 +1516,7 @@ void CSU2TCLib::GetChemistryEquilConstants(unsigned short iReaction){ RxnConstantTable(5,0) = -0.002428; RxnConstantTable(5,1) = -1.7415; RxnConstantTable(5,2) = -1.2331; RxnConstantTable(5,3) = -0.95365; RxnConstantTable(5,4) = -0.04585; } - } else if (gas_model == "AIR-7"){ + } else if (gas_model == "AIR-7"){ if (iReaction <= 6) { diff --git a/SU2_CFD/src/fluid/CVanDerWaalsGas.cpp b/SU2_CFD/src/fluid/CVanDerWaalsGas.cpp index 7e0efca6c370..e16256be1e7d 100644 --- a/SU2_CFD/src/fluid/CVanDerWaalsGas.cpp +++ b/SU2_CFD/src/fluid/CVanDerWaalsGas.cpp @@ -2,7 +2,7 @@ * \file CVanDerWaalsGas.cpp * \brief Source of the Polytropic Van der Waals model. * \author S. Vitale, G. Gori, M. Pini, A. Guardone, P. Colonna - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/integration/CFEM_DG_Integration.cpp b/SU2_CFD/src/integration/CFEM_DG_Integration.cpp index 9ec00d536de3..f1a339bbbc5c 100644 --- a/SU2_CFD/src/integration/CFEM_DG_Integration.cpp +++ b/SU2_CFD/src/integration/CFEM_DG_Integration.cpp @@ -2,7 +2,7 @@ * \file CFEM_DG_Integration.cpp * \brief Definition of time and space integration for the DG solver. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/integration/CIntegration.cpp b/SU2_CFD/src/integration/CIntegration.cpp index 678361fb7bf4..729eb41958bf 100644 --- a/SU2_CFD/src/integration/CIntegration.cpp +++ b/SU2_CFD/src/integration/CIntegration.cpp @@ -2,7 +2,7 @@ * \file CIntegration.cpp * \brief Implementation of the base class for space and time integration. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -208,14 +208,10 @@ void CIntegration::Time_Integration(CGeometry *geometry, CSolver **solver_contai } -void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CConfig *config, unsigned short iMesh) { +void CIntegration::SetDualTime_Geometry(CGeometry *geometry, CSolver *mesh_solver, const CConfig *config, unsigned short iMesh) { SU2_OMP_PARALLEL { - /*--- Store old solution, volumes and coordinates (in case there is grid movement). ---*/ - - solver->GetNodes()->Set_Solution_time_n1(); - solver->GetNodes()->Set_Solution_time_n(); geometry->nodes->SetVolume_nM1(); geometry->nodes->SetVolume_n(); @@ -225,6 +221,19 @@ void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CCon geometry->nodes->SetCoord_n(); } + if ((iMesh==MESH_0) && config->GetDeform_Mesh()) mesh_solver->SetDualTime_Mesh(); + + } // end SU2_OMP_PARALLEL +} + +void CIntegration::SetDualTime_Solver(const CGeometry *geometry, CSolver *solver, const CConfig *config, unsigned short iMesh) { + + SU2_OMP_PARALLEL + { + /*--- Store old solution ---*/ + solver->GetNodes()->Set_Solution_time_n1(); + solver->GetNodes()->Set_Solution_time_n(); + SU2_OMP_MASTER solver->ResetCFLAdapt(); SU2_OMP_BARRIER @@ -239,113 +248,5 @@ void CIntegration::SetDualTime_Solver(CGeometry *geometry, CSolver *solver, CCon solver->GetNodes()->SetLocalCFL(iPoint, config->GetCFL(iMesh)); } - /*--- Store old aeroelastic solutions ---*/ - SU2_OMP_MASTER - if (config->GetGrid_Movement() && config->GetAeroelastic_Simulation() && (iMesh == MESH_0)) { - - config->SetAeroelastic_n1(); - config->SetAeroelastic_n(); - - /*--- Also communicate plunge and pitch to the master node. Needed for output in case of parallel run ---*/ - -#ifdef HAVE_MPI - su2double plunge, pitch, *plunge_all = NULL, *pitch_all = NULL; - unsigned short iMarker, iMarker_Monitoring; - unsigned long iProcessor, owner, *owner_all = NULL; - - string Marker_Tag, Monitoring_Tag; - int nProcessor = size; - - /*--- Only if master node allocate memory ---*/ - - if (rank == MASTER_NODE) { - plunge_all = new su2double[nProcessor]; - pitch_all = new su2double[nProcessor]; - owner_all = new unsigned long[nProcessor]; - } - - /*--- Find marker and give it's plunge and pitch coordinate to the master node ---*/ - - for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) { - - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - - Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring); - Marker_Tag = config->GetMarker_All_TagBound(iMarker); - if (Marker_Tag == Monitoring_Tag) { owner = 1; break; - } else { - owner = 0; - } - - } - plunge = config->GetAeroelastic_plunge(iMarker_Monitoring); - pitch = config->GetAeroelastic_pitch(iMarker_Monitoring); - - /*--- Gather the data on the master node. ---*/ - - SU2_MPI::Gather(&plunge, 1, MPI_DOUBLE, plunge_all, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(&pitch, 1, MPI_DOUBLE, pitch_all, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(&owner, 1, MPI_UNSIGNED_LONG, owner_all, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - - /*--- Set plunge and pitch on the master node ---*/ - - if (rank == MASTER_NODE) { - for (iProcessor = 0; iProcessor < (unsigned long)nProcessor; iProcessor++) { - if (owner_all[iProcessor] == 1) { - config->SetAeroelastic_plunge(iMarker_Monitoring, plunge_all[iProcessor]); - config->SetAeroelastic_pitch(iMarker_Monitoring, pitch_all[iProcessor]); - break; - } - } - } - - } - - if (rank == MASTER_NODE) { - delete [] plunge_all; - delete [] pitch_all; - delete [] owner_all; - } -#endif - } - SU2_OMP_BARRIER - } // end SU2_OMP_PARALLEL - -} - -void CIntegration::SetStructural_Solver(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) { - - bool fsi = config->GetFSI_Simulation(); - - /*--- Update the solution according to the integration scheme used ---*/ - - switch (config->GetKind_TimeIntScheme_FEA()) { - case (CD_EXPLICIT): - break; - case (NEWMARK_IMPLICIT): - if (fsi) solver_container[FEA_SOL]->ImplicitNewmark_Relaxation(geometry, config); - break; - case (GENERALIZED_ALPHA): - solver_container[FEA_SOL]->GeneralizedAlpha_UpdateSolution(geometry, config); - solver_container[FEA_SOL]->GeneralizedAlpha_UpdateLoads(geometry, config); - break; - } - - /*--- Store the solution at t+1 as solution at t, both for the local points and for the halo points ---*/ - - solver_container[FEA_SOL]->GetNodes()->Set_Solution_time_n(); - solver_container[FEA_SOL]->GetNodes()->SetSolution_Vel_time_n(); - solver_container[FEA_SOL]->GetNodes()->SetSolution_Accel_time_n(); - - /*--- If FSI problem, save the last Aitken relaxation parameter of the previous time step ---*/ - - if (fsi) { - - su2double WAitk=0.0; - - WAitk = solver_container[FEA_SOL]->GetWAitken_Dyn(); - solver_container[FEA_SOL]->SetWAitken_Dyn_tn1(WAitk); - - } } diff --git a/SU2_CFD/src/integration/CIntegrationFactory.cpp b/SU2_CFD/src/integration/CIntegrationFactory.cpp index f350f60eb7ea..844b388442ec 100644 --- a/SU2_CFD/src/integration/CIntegrationFactory.cpp +++ b/SU2_CFD/src/integration/CIntegrationFactory.cpp @@ -2,7 +2,7 @@ * \file CIntegrationFactory.cpp * \brief Main subroutines for CIntegrationFactory . * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -28,6 +28,7 @@ #include "../../include/integration/CIntegrationFactory.hpp" #include "../../include/integration/CSingleGridIntegration.hpp" #include "../../include/integration/CMultiGridIntegration.hpp" +#include "../../include/integration/CNewtonIntegration.hpp" #include "../../include/integration/CStructuralIntegration.hpp" #include "../../include/integration/CFEM_DG_Integration.hpp" @@ -60,6 +61,9 @@ CIntegration* CIntegrationFactory::CreateIntegration(INTEGRATION_TYPE integratio case INTEGRATION_TYPE::MULTIGRID: integration = new CMultiGridIntegration(); break; + case INTEGRATION_TYPE::NEWTON: + integration = new CNewtonIntegration(); + break; case INTEGRATION_TYPE::STRUCTURAL: integration = new CStructuralIntegration(); break; diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp index 7a4588e3c8c7..3441fe82737f 100644 --- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp +++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp @@ -2,7 +2,7 @@ * \file CMultiGridIntegration.cpp * \brief Implementation of the multigrid integration class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -303,7 +303,7 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry, void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqSystem, CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config) { unsigned long Point_Fine, Point_Coarse, iVertex; - unsigned short Boundary, iMarker, iChildren, iVar; + unsigned short iMarker, iChildren, iVar; su2double Area_Parent, Area_Children; const su2double *Solution_Fine = nullptr, *Solution_Coarse = nullptr; @@ -340,10 +340,7 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS /*--- Remove any contributions from no-slip walls. ---*/ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - Boundary = config->GetMarker_All_KindBC(iMarker); - if ((Boundary == HEAT_FLUX) || - (Boundary == ISOTHERMAL) || - (Boundary == CHT_WALL_INTERFACE)) { + if (config->GetViscous_Wall(iMarker)) { SU2_OMP_FOR_STAT(32) for (iVertex = 0; iVertex < geo_coarse->nVertex[iMarker]; iVertex++) { @@ -353,7 +350,8 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS /*--- For dirichlet boundary condtions, set the correction to zero. Note that Solution_Old stores the correction not the actual value ---*/ - sol_coarse->GetNodes()->SetVelSolutionOldZero(Point_Coarse); + su2double zero[3] = {0.0}; + sol_coarse->GetNodes()->SetVelocity_Old(Point_Coarse, zero); } } @@ -364,8 +362,6 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS sol_coarse->InitiateComms(geo_coarse, config, SOLUTION_OLD); sol_coarse->CompleteComms(geo_coarse, config, SOLUTION_OLD); - /// TODO: Need to check for possible race condition here (multiple coarse points setting the same fine). - SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) { @@ -453,7 +449,7 @@ void CMultiGridIntegration::SetProlongated_Correction(CSolver *sol_fine, CGeomet su2double *Solution_Fine, *Residual_Fine; const unsigned short nVar = sol_fine->GetnVar(); - const su2double factor = config->GetDamp_Correc_Prolong(); //pow(config->GetDamp_Correc_Prolong(), iMesh+1); + const su2double factor = config->GetDamp_Correc_Prolong(); SU2_OMP_FOR_STAT(roundUpDiv(geo_fine->GetnPointDomain(), omp_get_num_threads())) for (Point_Fine = 0; Point_Fine < geo_fine->GetnPointDomain(); Point_Fine++) { @@ -479,8 +475,6 @@ void CMultiGridIntegration::SetProlongated_Solution(unsigned short RunTime_EqSys unsigned long Point_Fine, Point_Coarse; unsigned short iChildren; - /// TODO: Need to check for possible race condition here (multiple coarse points setting the same fine). - SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) for (Point_Coarse = 0; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { for (iChildren = 0; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) { @@ -498,7 +492,7 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar const su2double *Residual_Fine; const unsigned short nVar = sol_coarse->GetnVar(); - su2double factor = config->GetDamp_Res_Restric(); //pow(config->GetDamp_Res_Restric(), iMesh); + su2double factor = config->GetDamp_Res_Restric(); su2double *Residual = new su2double[nVar]; @@ -521,10 +515,7 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar delete [] Residual; for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) || - (config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) || - (config->GetMarker_All_KindBC(iMarker) == CHT_WALL_INTERFACE)) { - + if (config->GetViscous_Wall(iMarker)) { SU2_OMP_FOR_STAT(32) for (iVertex = 0; iVertex < geo_coarse->nVertex[iMarker]; iVertex++) { Point_Coarse = geo_coarse->vertex[iMarker][iVertex]->GetNode(); @@ -552,13 +543,12 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config) { unsigned long iVertex, Point_Fine, Point_Coarse; - unsigned short iMarker, iVar, iChildren, iDim; - su2double Area_Parent, Area_Children, Vector[3] = {0.0}; + unsigned short iMarker, iVar, iChildren; + su2double Area_Parent, Area_Children; const su2double *Solution_Fine = nullptr, *Grid_Vel = nullptr; const unsigned short Solver_Position = config->GetContainerPosition(RunTime_EqSystem); const unsigned short nVar = sol_coarse->GetnVar(); - const unsigned short nDim = geo_fine->GetnDim(); const bool grid_movement = config->GetGrid_Movement(); su2double *Solution = new su2double[nVar]; @@ -591,9 +581,7 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst /*--- Update the solution at the no-slip walls ---*/ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) || - (config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) || - (config->GetMarker_All_KindBC(iMarker) == CHT_WALL_INTERFACE)) { + if (config->GetViscous_Wall(iMarker)) { SU2_OMP_FOR_STAT(32) for (iVertex = 0; iVertex < geo_coarse->nVertex[iMarker]; iVertex++) { @@ -606,14 +594,12 @@ void CMultiGridIntegration::SetRestricted_Solution(unsigned short RunTime_EqSyst if (grid_movement) { Grid_Vel = geo_coarse->nodes->GetGridVel(Point_Coarse); - for (iDim = 0; iDim < nDim; iDim++) - Vector[iDim] = sol_coarse->GetNodes()->GetSolution(Point_Coarse,0)*Grid_Vel[iDim]; - sol_coarse->GetNodes()->SetVelSolutionVector(Point_Coarse, Vector); + sol_coarse->GetNodes()->SetVelSolutionVector(Point_Coarse, Grid_Vel); } else { /*--- For stationary no-slip walls, set the velocity to zero. ---*/ - - sol_coarse->GetNodes()->SetVelSolutionZero(Point_Coarse); + su2double zero[3] = {0.0}; + sol_coarse->GetNodes()->SetVelSolutionVector(Point_Coarse, zero); } } diff --git a/SU2_CFD/src/integration/CNewtonIntegration.cpp b/SU2_CFD/src/integration/CNewtonIntegration.cpp new file mode 100644 index 000000000000..a9f3a804c61a --- /dev/null +++ b/SU2_CFD/src/integration/CNewtonIntegration.cpp @@ -0,0 +1,357 @@ +/*! + * \file CNewtonIntegration.cpp + * \brief Newton-Krylov integration. + * \author P. Gomes + * \version 7.1.1 "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/integration/CNewtonIntegration.hpp" +#include "../../../Common/include/linear_algebra/CMatrixVectorProduct.hpp" + +using Scalar = CNewtonIntegration::Scalar; + +namespace { + +class CMatrixFreeProductWrapper final : public CMatrixVectorProduct { + CNewtonIntegration* integration; +public: + CMatrixFreeProductWrapper(CNewtonIntegration* i) : integration(i) {} + + /*! + * \brief Operator for the product operation. + */ + inline void operator()(const CSysVector& u, CSysVector& v) const override { + integration->MatrixFreeProduct(u, v); + } +}; + +class CPreconditionerWrapper final : public CPreconditioner { + const CNewtonIntegration* integration; +public: + CPreconditionerWrapper(const CNewtonIntegration* i) : integration(i) {} + + /*! + * \brief Operator for the preconditioning operation. + */ + inline void operator()(const CSysVector& u, CSysVector& v) const override { + integration->Preconditioner(u, v); + } +}; +} + +CNewtonIntegration::~CNewtonIntegration() { delete preconditioner; } + +void CNewtonIntegration::Setup() { + + auto iparam = config->GetNewtonKrylovIntParam(); + auto dparam = config->GetNewtonKrylovDblParam(); + + startupIters = iparam[0]; + startupResidual = dparam[0]; + precondIters = iparam[1]; + precondTol = dparam[1]; + tolRelaxFactor = iparam[2]; + fullTolResidual = dparam[2]; + finDiffStepND = SU2_TYPE::GetValue(dparam[3]); + + const auto nVar = solvers[FLOW_SOL]->GetnVar(); + const auto nPoint = geometry->GetnPoint(); + const auto nPointDomain = geometry->GetnPointDomain(); + + omp_chunk_size = computeStaticChunkSize(nPoint, omp_get_max_threads(), 1024); + + LinSolver.SetxIsZero(true); + + LinSysRes.Initialize(nPoint, nPointDomain, nVar, 0.0); + + if (!std::is_same::value) { + LinSysSol.Initialize(nPoint, nPointDomain, nVar, nullptr); + } + + /*--- Check if the solver is able to provide a linear preconditioner. ---*/ + if (config->GetKind_TimeIntScheme() != EULER_IMPLICIT) return; + + switch (config->GetKind_Linear_Solver_Prec()) { + case JACOBI: + preconditioner = new CJacobiPreconditioner(solvers[FLOW_SOL]->Jacobian, geometry, config, false); + break; + case LINELET: + preconditioner = new CLineletPreconditioner(solvers[FLOW_SOL]->Jacobian, geometry, config); + break; + case LU_SGS: + preconditioner = new CLU_SGSPreconditioner(solvers[FLOW_SOL]->Jacobian, geometry, config); + break; + case ILU: + preconditioner = new CILUPreconditioner(solvers[FLOW_SOL]->Jacobian, geometry, config, false); + break; + case PASTIX_ILU: case PASTIX_LU_P: case PASTIX_LDLT_P: + preconditioner = new CPastixPreconditioner(solvers[FLOW_SOL]->Jacobian, geometry, config, + config->GetKind_Linear_Solver_Prec(), false); + break; + default: + SU2_MPI::Error("Unrecognized preconditioner for Newton-Krylov iterations.", CURRENT_FUNCTION); + break; + } + + if (!std::is_same::value) { + precondIn.Initialize(nPoint, nPointDomain, nVar, nullptr); + precondOut.Initialize(nPoint, nPointDomain, nVar, nullptr); + } + + /*--- Only possible with a preconditioner. ---*/ + startupPeriod = (startupIters > 0) || (startupResidual < 0.0); + +} + +void CNewtonIntegration::PerturbSolution(const CSysVector& dir, Scalar mag) { + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < geometry->GetnPoint(); ++iPoint) { + SU2_OMP_SIMD + for (auto iVar = 0ul; iVar < solvers[FLOW_SOL]->GetnVar(); ++iVar) + solvers[FLOW_SOL]->GetNodes()->AddSolution(iPoint,iVar, mag*dir(iPoint,iVar)); + } +} + +void CNewtonIntegration::ComputeResiduals(ResEvalType type) { + + /*--- Save the default integration scheme, and force to explicit if required. ---*/ + auto TimeIntScheme = config->GetKind_TimeIntScheme(); + if (type == EXPLICIT) { + SU2_OMP_MASTER + config->SetKind_TimeIntScheme(EULER_EXPLICIT); + SU2_OMP_BARRIER + } + + solvers[FLOW_SOL]->Preprocessing(geometry, solvers, config, MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, false); + + Space_Integration(geometry, solvers, numerics[FLOW_SOL], config, MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS); + + /*--- Restore default. ---*/ + if (type == EXPLICIT) { + SU2_OMP_MASTER + config->SetKind_TimeIntScheme(TimeIntScheme); + SU2_OMP_BARRIER + } + +} + +void CNewtonIntegration::ComputeFinDiffStep() { + + static su2double rmsSol; + su2double rmsSol_loc = 0.0; + + SU2_OMP_MASTER + rmsSol = 0.0; + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < geometry->GetnPointDomain(); ++iPoint) + for (auto iVar = 0ul; iVar < solvers[FLOW_SOL]->GetnVar(); ++iVar) + rmsSol_loc += pow(solvers[FLOW_SOL]->GetNodes()->GetSolution(iPoint,iVar), 2); + + atomicAdd(rmsSol_loc, rmsSol); + + SU2_OMP_BARRIER + SU2_OMP_MASTER { + su2double t = rmsSol; + SU2_MPI::Allreduce(&t, &rmsSol, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + finDiffStep = finDiffStepND * max(1.0, sqrt(SU2_TYPE::GetValue(rmsSol) / geometry->GetGlobal_nPointDomain())); + } + SU2_OMP_BARRIER + +} + +void CNewtonIntegration::MultiGrid_Iteration(CGeometry ****geometry_, CSolver *****solvers_, CNumerics ******numerics_, + CConfig **config_, unsigned short EqSystem, unsigned short iZone, + unsigned short iInst) { + config = config_[iZone]; + solvers = solvers_[iZone][iInst][MESH_0]; + geometry = geometry_[iZone][iInst][MESH_0]; + numerics = numerics_[iZone][iInst][MESH_0]; + + if (!setup) { Setup(); setup = true; } + + SU2_OMP_PARALLEL_(if(solvers[FLOW_SOL]->GetHasHybridParallel())) { + + /*--- Save the current solution to be able to perturb it. ---*/ + + solvers[FLOW_SOL]->Set_OldSolution(); + + /*--- Current residual. ---*/ + + ComputeResiduals(DEFAULT); + + /*--- Compute the approximate Jacobian for preconditioning. ---*/ + + solvers[FLOW_SOL]->SetTime_Step(geometry, solvers, config, MESH_0, config->GetTimeIter()); + + solvers[FLOW_SOL]->PrepareImplicitIteration(geometry, solvers, config); + + if (preconditioner) preconditioner->Build(); + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto i = 0ul; i < LinSysRes.GetNElmDomain(); ++i) + LinSysRes[i] = SU2_TYPE::GetValue(solvers[FLOW_SOL]->LinSysRes[i]); + + su2double residual = 0.0; + for (auto iVar = 0ul; iVar < LinSysRes.GetNVar(); ++iVar) + residual += log10(solvers[FLOW_SOL]->GetRes_RMS(iVar)) / LinSysRes.GetNVar(); + + /*--- Check if startup period should end after this iteration. ---*/ + + bool endStartup = false; + + if (startupPeriod) { + SU2_OMP_MASTER { + firstResidual = max(firstResidual, residual); + if (startupIters) startupIters -= 1; + } + SU2_OMP_BARRIER + endStartup = (startupIters == 0) && (residual - firstResidual < startupResidual); + } + + /*--- The NK solves are expensive, the tolerance is relaxed while the residuals are high. ---*/ + + Scalar toleranceFactor = 1.0; + + if (!startupPeriod && tolRelaxFactor > 1 && fullTolResidual < 0.0) { + SU2_OMP_MASTER + firstResidual = max(firstResidual, residual); + SU2_OMP_BARRIER + su2double x = (residual - firstResidual) / fullTolResidual; + toleranceFactor = 1.0 + (tolRelaxFactor-1)*max(0.0, 1.0-SU2_TYPE::GetValue(x)); + } + + /*--- Solve for the solution update. ---*/ + + auto iter = config->GetLinear_Solver_Iter(); + Scalar eps = SU2_TYPE::GetValue(config->GetLinear_Solver_Error()); + + auto& linSysSol = GetSolutionVec(solvers[FLOW_SOL]->LinSysSol); + + if (startupPeriod) { + iter = Preconditioner_impl(LinSysRes, linSysSol, iter, eps); + } + else { + ComputeFinDiffStep(); + + eps *= toleranceFactor; + iter = LinSolver.FGMRES_LinSolver(LinSysRes, linSysSol, CMatrixFreeProductWrapper(this), + CPreconditionerWrapper(this), eps, iter, eps, false, config); + /*--- Scale back the residual to trick the CFL adaptation. ---*/ + eps /= toleranceFactor; + } + SetSolutionResult(solvers[FLOW_SOL]->LinSysSol); + + SU2_OMP_MASTER { + solvers[FLOW_SOL]->SetIterLinSolver(iter); + solvers[FLOW_SOL]->SetResLinSolver(eps); + } + SU2_OMP_BARRIER + + /// TODO: Clever back-tracking and CFL adaptation based on residual reduction. + + /*--- Update solution. ---*/ + + solvers[FLOW_SOL]->CompleteImplicitIteration(geometry, solvers, config); + + /*--- Call the various post processings. ---*/ + + solvers[FLOW_SOL]->Preprocessing(geometry, solvers, config, MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, true); + + solvers[FLOW_SOL]->Postprocessing(geometry, solvers, config, MESH_0); + + SU2_OMP_MASTER { + solvers[FLOW_SOL]->Pressure_Forces(geometry, config); + solvers[FLOW_SOL]->Momentum_Forces(geometry, config); + solvers[FLOW_SOL]->Friction_Forces(geometry, config); + } + + /*--- At the end of the startup period the CFL is reset to the initial value. ---*/ + + if (endStartup) { + SU2_OMP_MASTER { + startupPeriod = false; + firstResidual = residual; + } + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < geometry->GetnPoint(); ++iPoint) + solvers[FLOW_SOL]->GetNodes()->SetLocalCFL(iPoint, config->GetCFL(MESH_0)); + } + + } // end SU2_OMP_PARALLEL +} + +void CNewtonIntegration::MatrixFreeProduct(const CSysVector& u, CSysVector& v) { + + Scalar factor = finDiffStep / u.norm(); + + PerturbSolution(u, factor); + + ComputeResiduals(EXPLICIT); + + /*--- Finalize product. ---*/ + factor = 1.0 / factor; + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < geometry->GetnPointDomain(); ++iPoint) { + su2double delta = (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)) / + max(EPS, solvers[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint)); + SU2_OMP_SIMD + for (auto iVar = 0ul; iVar < LinSysRes.GetNVar(); ++iVar) { + Scalar perturbRes = SU2_TYPE::GetValue(solvers[FLOW_SOL]->LinSysRes(iPoint,iVar)); + + /*--- The global residual had its sign flipped, so we add to get the difference. ---*/ + v(iPoint,iVar) = (perturbRes + LinSysRes(iPoint,iVar)) * factor; + + /*--- Pseudotime term of the true Jacobian. ---*/ + v(iPoint,iVar) += SU2_TYPE::GetValue(delta) * u(iPoint,iVar); + } + } + + CSysMatrixComms::Initiate(v, geometry, config); + CSysMatrixComms::Complete(v, geometry, config); +} + +void CNewtonIntegration::Preconditioner(const CSysVector& u, CSysVector& v) const { + + if (preconditioner) { + Scalar eps = SU2_TYPE::GetValue(precondTol); + Preconditioner_impl(u, v, precondIters, eps); + } + else { + /*--- Approximate diagonal preconditioner. ---*/ + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < geometry->GetnPointDomain(); ++iPoint) { + su2double delta = solvers[FLOW_SOL]->GetNodes()->GetDelta_Time(iPoint) / + (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); + SU2_OMP_SIMD + for (auto iVar = 0ul; iVar < u.GetNVar(); ++iVar) + v(iPoint,iVar) = SU2_TYPE::GetValue(delta) * u(iPoint,iVar); + } + + CSysMatrixComms::Initiate(v, geometry, config); + CSysMatrixComms::Complete(v, geometry, config); + } +} diff --git a/SU2_CFD/src/integration/CSingleGridIntegration.cpp b/SU2_CFD/src/integration/CSingleGridIntegration.cpp index 69727321c9d6..88da5a71ef91 100644 --- a/SU2_CFD/src/integration/CSingleGridIntegration.cpp +++ b/SU2_CFD/src/integration/CSingleGridIntegration.cpp @@ -2,7 +2,7 @@ * \file CSingleGridIntegration.cpp * \brief Single (fine) grid integration class implementation. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/integration/CStructuralIntegration.cpp b/SU2_CFD/src/integration/CStructuralIntegration.cpp index 3667eba307a4..ee29cde6421c 100644 --- a/SU2_CFD/src/integration/CStructuralIntegration.cpp +++ b/SU2_CFD/src/integration/CStructuralIntegration.cpp @@ -2,7 +2,7 @@ * \file CStructuralIntegration.cpp * \brief Space and time integration for structural problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -190,3 +190,39 @@ void CStructuralIntegration::Time_Integration_FEM(CGeometry *geometry, CSolver * } } + +void CStructuralIntegration::SetDualTime_Solver(const CGeometry *geometry, CSolver *solver, const CConfig *config, unsigned short iMesh) { + + bool fsi = config->GetFSI_Simulation(); + + /*--- Update the solution according to the integration scheme used ---*/ + + switch (config->GetKind_TimeIntScheme_FEA()) { + case (CD_EXPLICIT): + break; + case (NEWMARK_IMPLICIT): + if (fsi) solver->ImplicitNewmark_Relaxation(geometry, config); + break; + case (GENERALIZED_ALPHA): + solver->GeneralizedAlpha_UpdateSolution(geometry, config); + solver->GeneralizedAlpha_UpdateLoads(geometry, config); + break; + } + + /*--- Store the solution at t+1 as solution at t, both for the local points and for the halo points ---*/ + + solver->GetNodes()->Set_Solution_time_n(); + solver->GetNodes()->SetSolution_Vel_time_n(); + solver->GetNodes()->SetSolution_Accel_time_n(); + + /*--- If FSI problem, save the last Aitken relaxation parameter of the previous time step ---*/ + + if (fsi) { + + su2double WAitk=0.0; + + WAitk = solver->GetWAitken_Dyn(); + solver->SetWAitken_Dyn_tn1(WAitk); + + } +} diff --git a/SU2_CFD/src/interfaces/CInterface.cpp b/SU2_CFD/src/interfaces/CInterface.cpp index 97eba31f2c11..8559d1fcf840 100644 --- a/SU2_CFD/src/interfaces/CInterface.cpp +++ b/SU2_CFD/src/interfaces/CInterface.cpp @@ -2,7 +2,7 @@ * \file CInterface.cpp * \brief Main subroutines for MPI transfer of information between zones * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -94,7 +94,7 @@ void CInterface::BroadcastData(const CInterpolator& interpolator, * sums) to perform an Allgatherv of donor indices and variables. ---*/ vector nAllVertexDonor(size), nAllVarCounts(size), displIdx(size,0), displVar(size); - SU2_MPI::Allgather(&nLocalVertexDonor, 1, MPI_INT, nAllVertexDonor.data(), 1, MPI_INT, MPI_COMM_WORLD); + SU2_MPI::Allgather(&nLocalVertexDonor, 1, MPI_INT, nAllVertexDonor.data(), 1, MPI_INT, SU2_MPI::GetComm()); for (int i = 0; i < size; ++i) { nAllVarCounts[i] = nAllVertexDonor[i] * nVar; @@ -131,10 +131,10 @@ void CInterface::BroadcastData(const CInterpolator& interpolator, su2activematrix donorVar(nGlobalVertexDonor, nVar); SU2_MPI::Allgatherv(sendDonorIdx.data(), sendDonorIdx.size(), MPI_UNSIGNED_LONG, donorIdx.data(), - nAllVertexDonor.data(), displIdx.data(), MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + nAllVertexDonor.data(), displIdx.data(), MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); SU2_MPI::Allgatherv(sendDonorVar.data(), sendDonorVar.size(), MPI_DOUBLE, donorVar.data(), - nAllVarCounts.data(), displVar.data(), MPI_DOUBLE, MPI_COMM_WORLD); + nAllVarCounts.data(), displVar.data(), MPI_DOUBLE, SU2_MPI::GetComm()); /*--- This rank does not need to do more work. ---*/ if (markTarget < 0) continue; @@ -242,8 +242,8 @@ void CInterface::PreprocessAverage(CGeometry *donor_geometry, CGeometry *target_ BuffDonorFlag[iSize] = -1; } - SU2_MPI::Allgather(&Marker_Donor, 1 , MPI_INT, BuffMarkerDonor, 1, MPI_INT, MPI_COMM_WORLD); - SU2_MPI::Allgather(&Donor_Flag, 1 , MPI_INT, BuffDonorFlag, 1, MPI_INT, MPI_COMM_WORLD); + SU2_MPI::Allgather(&Marker_Donor, 1 , MPI_INT, BuffMarkerDonor, 1, MPI_INT, SU2_MPI::GetComm()); + SU2_MPI::Allgather(&Donor_Flag, 1 , MPI_INT, BuffDonorFlag, 1, MPI_INT, SU2_MPI::GetComm()); Marker_Donor= -1; Donor_Flag= -1; @@ -468,22 +468,22 @@ void CInterface::AllgatherAverage(CSolver *donor_solution, CSolver *target_solut } SU2_MPI::Allgather(avgDensityDonor, nSpanDonor , MPI_DOUBLE, BuffAvgDensityDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(avgPressureDonor, nSpanDonor , MPI_DOUBLE, BuffAvgPressureDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(avgNormalVelDonor, nSpanDonor , MPI_DOUBLE, BuffAvgNormalVelDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(avgTangVelDonor, nSpanDonor , MPI_DOUBLE, BuffAvgTangVelDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(avg3DVelDonor, nSpanDonor , MPI_DOUBLE, BuffAvg3DVelDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(avgNuDonor, nSpanDonor , MPI_DOUBLE, BuffAvgNuDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(avgKineDonor, nSpanDonor , MPI_DOUBLE, BuffAvgKineDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); SU2_MPI::Allgather(avgOmegaDonor, nSpanDonor , MPI_DOUBLE, BuffAvgOmegaDonor, - nSpanDonor, MPI_DOUBLE, MPI_COMM_WORLD); - SU2_MPI::Allgather(&Marker_Donor, 1 , MPI_INT, BuffMarkerDonor, 1, MPI_INT, MPI_COMM_WORLD); + nSpanDonor, MPI_DOUBLE, SU2_MPI::GetComm()); + SU2_MPI::Allgather(&Marker_Donor, 1 , MPI_INT, BuffMarkerDonor, 1, MPI_INT, SU2_MPI::GetComm()); for (iSpan = 0; iSpan < nSpanDonor; iSpan++){ avgDensityDonor[iSpan] = -1.0; diff --git a/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp b/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp index f0180f697f35..193e310c04f8 100644 --- a/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp +++ b/SU2_CFD/src/interfaces/cfd/CConservativeVarsInterface.cpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer conservative variables * from a generic zone into another one. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp b/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp index be823780208a..b422476cf7df 100644 --- a/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp +++ b/SU2_CFD/src/interfaces/cfd/CMixingPlaneInterface.cpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer average variables * needed for MixingPlane computation from a generic zone into another one. * \author S. Vitale - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp b/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp index 709dba76b334..71dc84edf862 100644 --- a/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp +++ b/SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer conservative variables * from a generic zone into another * \author G. Gori Politecnico di Milano - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp index 6ff35c0490f5..51a5cc6423a4 100644 --- a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp +++ b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer temperature and heatflux * density for conjugate heat interfaces between structure and fluid zones. * \author O. Burghardt - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp b/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp index 706189b4f816..c68ef91deff1 100644 --- a/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp +++ b/SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer flow tractions * from a fluid zone into a structural zone in a discrete adjoint simulation. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp b/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp index 7fbe085bde71..a6d2ac037874 100644 --- a/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp +++ b/SU2_CFD/src/interfaces/fsi/CDisplacementsInterface.cpp @@ -2,7 +2,7 @@ * \file CDisplacementsInterface.cpp * \brief Main subroutines for transferring boundary displacements. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp b/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp index cc70050817a5..8dccbf195624 100644 --- a/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp +++ b/SU2_CFD/src/interfaces/fsi/CFlowTractionInterface.cpp @@ -3,7 +3,7 @@ * \brief Declaration and inlines of the class to transfer flow tractions * from a fluid zone into a structural zone. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/iteration/CAdjFluidIteration.cpp b/SU2_CFD/src/iteration/CAdjFluidIteration.cpp index 315b0d40be6c..427d51851f4c 100644 --- a/SU2_CFD/src/iteration/CAdjFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CAdjFluidIteration.cpp @@ -2,7 +2,7 @@ * \file CAdjFluidIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -181,6 +181,11 @@ void CAdjFluidIteration::Update(COutput* output, CIntegration**** integration, C 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]->SetDualTime_Geometry( + geometry[val_iZone][val_iInst][iMesh], solver[val_iZone][val_iInst][iMesh][MESH_SOL], config[val_iZone], + iMesh); + integration[val_iZone][val_iInst][ADJFLOW_SOL]->SetConvergence(false); } diff --git a/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp b/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp index 8cdf6d85f501..90b4910b2956 100644 --- a/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp +++ b/SU2_CFD/src/iteration/CDiscAdjFEAIteration.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjFEAIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -364,12 +364,6 @@ void CDiscAdjFEAIteration::SetDependencies(CSolver***** solver, CGeometry**** ge 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); @@ -380,6 +374,12 @@ void CDiscAdjFEAIteration::SetDependencies(CSolver***** solver, CGeometry**** ge structural_geometry->CompleteComms(structural_geometry, config[iZone], COORDINATES); } + /*--- 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]); + } + /*--- Topology optimization dependencies. ---*/ /*--- We only differentiate wrt to this variable in the adjoint secondary recording. ---*/ diff --git a/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp b/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp index 9153084ae11c..155307886f51 100644 --- a/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjFluidIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -370,7 +370,6 @@ void CDiscAdjFluidIteration::InitializeAdjoint(CSolver***** solver, CGeometry*** 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 ---*/ @@ -390,7 +389,7 @@ void CDiscAdjFluidIteration::InitializeAdjoint(CSolver***** solver, CGeometry*** solver[iZone][iInst][MESH_0][ADJRAD_SOL]->SetAdjoint_Output(geometry[iZone][iInst][MESH_0], config[iZone]); } - if (interface_boundary) { + if (config[iZone]->GetFluidProblem()) { solver[iZone][iInst][MESH_0][FLOW_SOL]->SetVertexTractionsAdjoint(geometry[iZone][iInst][MESH_0], config[iZone]); } } @@ -510,7 +509,6 @@ void CDiscAdjFluidIteration::RegisterOutput(CSolver***** solver, CGeometry**** g 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 ---*/ @@ -526,7 +524,7 @@ void CDiscAdjFluidIteration::RegisterOutput(CSolver***** solver, CGeometry**** g if (config[iZone]->AddRadiation()) { solver[iZone][iInst][MESH_0][ADJRAD_SOL]->RegisterOutput(geometry[iZone][iInst][MESH_0], config[iZone]); } - if (interface_boundary) { + if (config[iZone]->GetFluidProblem()) { solver[iZone][iInst][MESH_0][FLOW_SOL]->RegisterVertexTractions(geometry[iZone][iInst][MESH_0], config[iZone]); } } diff --git a/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp b/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp index 64048cbce202..54c2daa78ade 100644 --- a/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp +++ b/SU2_CFD/src/iteration/CDiscAdjHeatIteration.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjHeatIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/iteration/CFEAIteration.cpp b/SU2_CFD/src/iteration/CFEAIteration.cpp index 11b553134d61..2b5f0a6560c8 100644 --- a/SU2_CFD/src/iteration/CFEAIteration.cpp +++ b/SU2_CFD/src/iteration/CFEAIteration.cpp @@ -2,7 +2,7 @@ * \file CFEAIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -196,8 +196,9 @@ void CFEAIteration::Update(COutput* output, CIntegration**** integration, CGeome /*----------------- 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]->SetDualTime_Solver( + geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0][FEA_SOL], config[val_iZone], + MESH_0); integration[val_iZone][val_iInst][FEA_SOL]->SetConvergence(false); /*--- Verify convergence criteria (based on total time) ---*/ diff --git a/SU2_CFD/src/iteration/CFEMFluidIteration.cpp b/SU2_CFD/src/iteration/CFEMFluidIteration.cpp index fff55845d865..beda31774102 100644 --- a/SU2_CFD/src/iteration/CFEMFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFEMFluidIteration.cpp @@ -2,7 +2,7 @@ * \file CFEMFluidIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 47a6f2625bb9..aeaf77f96219 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -2,7 +2,7 @@ * \file CFluidIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -102,6 +102,8 @@ void CFluidIteration::Iterate(COutput* output, CIntegration**** integration, CGe integration[val_iZone][val_iInst][FLOW_SOL]->MultiGrid_Iteration(geometry, solver, numerics, config, RUNTIME_FLOW_SYS, val_iZone, val_iInst); + /*--- If the flow integration is not fully coupled, run the various single grid integrations. ---*/ + 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) { @@ -172,13 +174,15 @@ void CFluidIteration::Update(COutput* output, CIntegration**** integration, CGeo 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]->SetDualTime_Geometry(geometry[val_iZone][val_iInst][iMesh], + solver[val_iZone][val_iInst][iMesh][MESH_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(); - } + SetDualTime_Aeroelastic(config[val_iZone]); /*--- Update dual time solver for the turbulence model ---*/ @@ -199,6 +203,15 @@ void CFluidIteration::Update(COutput* output, CIntegration**** integration, CGeo config[val_iZone], MESH_0); integration[val_iZone][val_iInst][TRANS_SOL]->SetConvergence(false); } + + /*--- Update dual time solver for the weakly coupled energy equation ---*/ + + if (config[val_iZone]->GetWeakly_Coupled_Heat()) { + integration[val_iZone][val_iInst][HEAT_SOL]->SetDualTime_Solver(geometry[val_iZone][val_iInst][MESH_0], + solver[val_iZone][val_iInst][MESH_0][HEAT_SOL], + config[val_iZone], MESH_0); + integration[val_iZone][val_iInst][HEAT_SOL]->SetConvergence(false); + } } } @@ -557,3 +570,74 @@ bool CFluidIteration::MonitorFixed_CL(COutput *output, CGeometry *geometry, CSol /* --- Set convergence based on fixed CL convergence --- */ return fixed_cl_convergence; } + +void CFluidIteration::SetDualTime_Aeroelastic(CConfig* config) const { + + /*--- Store old aeroelastic solutions ---*/ + + if (config->GetGrid_Movement() && config->GetAeroelastic_Simulation()) { + + config->SetAeroelastic_n1(); + config->SetAeroelastic_n(); + + /*--- Also communicate plunge and pitch to the master node. Needed for output in case of parallel run ---*/ + +#ifdef HAVE_MPI + su2double plunge, pitch, *plunge_all = nullptr, *pitch_all = nullptr; + unsigned short iMarker, iMarker_Monitoring; + unsigned long iProcessor, owner, *owner_all = nullptr; + + string Marker_Tag, Monitoring_Tag; + int nProcessor = size; + + /*--- Only if master node allocate memory ---*/ + + if (rank == MASTER_NODE) { + plunge_all = new su2double[nProcessor]; + pitch_all = new su2double[nProcessor]; + owner_all = new unsigned long[nProcessor]; + } + + /*--- Find marker and give it's plunge and pitch coordinate to the master node ---*/ + + for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) { + + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + + Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring); + Marker_Tag = config->GetMarker_All_TagBound(iMarker); + if (Marker_Tag == Monitoring_Tag) { owner = 1; break; + } else { + owner = 0; + } + + } + plunge = config->GetAeroelastic_plunge(iMarker_Monitoring); + pitch = config->GetAeroelastic_pitch(iMarker_Monitoring); + + /*--- Gather the data on the master node. ---*/ + + SU2_MPI::Gather(&plunge, 1, MPI_DOUBLE, plunge_all, 1, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(&pitch, 1, MPI_DOUBLE, pitch_all, 1, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(&owner, 1, MPI_UNSIGNED_LONG, owner_all, 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); + + /*--- Set plunge and pitch on the master node ---*/ + + if (rank == MASTER_NODE) { + for (iProcessor = 0; iProcessor < (unsigned long)nProcessor; iProcessor++) { + if (owner_all[iProcessor] == 1) { + config->SetAeroelastic_plunge(iMarker_Monitoring, plunge_all[iProcessor]); + config->SetAeroelastic_pitch(iMarker_Monitoring, pitch_all[iProcessor]); + break; + } + } + } + } + + delete [] plunge_all; + delete [] pitch_all; + delete [] owner_all; +#endif + } + +} diff --git a/SU2_CFD/src/iteration/CHeatIteration.cpp b/SU2_CFD/src/iteration/CHeatIteration.cpp index dbdd69ce22d3..bf125b75885a 100644 --- a/SU2_CFD/src/iteration/CHeatIteration.cpp +++ b/SU2_CFD/src/iteration/CHeatIteration.cpp @@ -2,7 +2,7 @@ * \file CHeatIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -56,6 +56,11 @@ void CHeatIteration::Update(COutput* output, CIntegration**** integration, CGeom 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]->SetDualTime_Geometry(geometry[val_iZone][val_iInst][iMesh], + solver[val_iZone][val_iInst][iMesh][MESH_SOL], + config[val_iZone], iMesh); + integration[val_iZone][val_iInst][HEAT_SOL]->SetConvergence(false); } } diff --git a/SU2_CFD/src/iteration/CIteration.cpp b/SU2_CFD/src/iteration/CIteration.cpp index b33b39131f92..7ebd79a4235a 100644 --- a/SU2_CFD/src/iteration/CIteration.cpp +++ b/SU2_CFD/src/iteration/CIteration.cpp @@ -2,7 +2,7 @@ * \file iteration_structure.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -34,13 +34,8 @@ void CIteration::SetGrid_Movement(CGeometry** geometry, CSurfaceMovement* surfac 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 ---*/ @@ -120,32 +115,6 @@ void CIteration::SetGrid_Movement(CGeometry** geometry, CSurfaceMovement* surfac } } - 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 ---*/ diff --git a/SU2_CFD/src/iteration/CIterationFactory.cpp b/SU2_CFD/src/iteration/CIterationFactory.cpp index d55188cf2abc..3af7adadfeaf 100644 --- a/SU2_CFD/src/iteration/CIterationFactory.cpp +++ b/SU2_CFD/src/iteration/CIterationFactory.cpp @@ -2,7 +2,7 @@ * \file CAdjFluidIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -112,7 +112,7 @@ CIteration* CIterationFactory::CreateIteration(ENUM_MAIN_SOLVER kindSolver, cons iteration = new CDiscAdjHeatIteration(config); break; - case NO_SOLVER: case FLUID_STRUCTURE_INTERACTION: case TEMPLATE_SOLVER: case MULTIPHYSICS: + case NO_SOLVER: case TEMPLATE_SOLVER: case MULTIPHYSICS: SU2_MPI::Error("No iteration found for specified solver.", CURRENT_FUNCTION); break; } diff --git a/SU2_CFD/src/iteration/CTurboIteration.cpp b/SU2_CFD/src/iteration/CTurboIteration.cpp index 7066771c1a17..30e16ca7d1a7 100644 --- a/SU2_CFD/src/iteration/CTurboIteration.cpp +++ b/SU2_CFD/src/iteration/CTurboIteration.cpp @@ -2,7 +2,7 @@ * \file CTurboIteration.cpp * \brief Main subroutines used by SU2_CFD * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/limiters/CLimiterDetails.cpp b/SU2_CFD/src/limiters/CLimiterDetails.cpp index f6c5cc3292e7..c575e44e15f0 100644 --- a/SU2_CFD/src/limiters/CLimiterDetails.cpp +++ b/SU2_CFD/src/limiters/CLimiterDetails.cpp @@ -3,7 +3,7 @@ * \brief A class template that allows defining limiters via * specialization of particular details. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/meson.build b/SU2_CFD/src/meson.build index 49c547a4ec34..53de4efdb1df 100644 --- a/SU2_CFD/src/meson.build +++ b/SU2_CFD/src/meson.build @@ -161,6 +161,7 @@ su2_cfd_src += files(['integration/CIntegration.cpp', 'integration/CIntegrationFactory.cpp', 'integration/CSingleGridIntegration.cpp', 'integration/CMultiGridIntegration.cpp', + 'integration/CNewtonIntegration.cpp', 'integration/CStructuralIntegration.cpp', 'integration/CFEM_DG_Integration.cpp']) diff --git a/SU2_CFD/src/numerics/CNumerics.cpp b/SU2_CFD/src/numerics/CNumerics.cpp index 95b96a4ee865..8d19b52c72f2 100644 --- a/SU2_CFD/src/numerics/CNumerics.cpp +++ b/SU2_CFD/src/numerics/CNumerics.cpp @@ -4,7 +4,7 @@ * Contains methods for common tasks, e.g. compute flux * Jacobians. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/NEMO/CNEMONumerics.cpp b/SU2_CFD/src/numerics/NEMO/CNEMONumerics.cpp index 5795d9a85324..2bbb8d471f71 100644 --- a/SU2_CFD/src/numerics/NEMO/CNEMONumerics.cpp +++ b/SU2_CFD/src/numerics/NEMO/CNEMONumerics.cpp @@ -4,7 +4,7 @@ * Contains methods for common tasks, e.g. compute flux * Jacobians. * \author S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -55,7 +55,7 @@ CNEMONumerics::CNEMONumerics(unsigned short val_nDim, unsigned short val_nVar, EDDY_VISC_INDEX = nSpecies+nDim+9; /*--- Read from CConfig ---*/ - implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); + implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); ionization = config->GetIonization(); if (ionization) { nHeavy = nSpecies-1; nEl = 1; } @@ -69,7 +69,7 @@ CNEMONumerics::CNEMONumerics(unsigned short val_nDim, unsigned short val_nVar, #else SU2_MPI::Error(string("Mutation++ has not been configured/compiled. Add 1) '-Denable-mpp=true' to your meson string or 2) '-DHAVE_MPP' to the CXX FLAGS of your configure string, and recompile."), CURRENT_FUNCTION); - #endif + #endif break; case SU2_NONEQ: fluidmodel = new CSU2TCLib(config, nDim, false); @@ -163,7 +163,7 @@ void CNEMONumerics::GetInviscidProjJac(const su2double *val_U, const su2doubl const su2double *rhos; rhos = &val_V[RHOS_INDEX]; - + /*--- Initialize the Jacobian tensor ---*/ for (iVar = 0; iVar < nVar; iVar++) for (jVar = 0; jVar < nVar; jVar++) @@ -265,7 +265,7 @@ void CNEMONumerics::GetViscousProjFlux(su2double *val_primvar, Ru = 1000.0*RuSI; hs = fluidmodel->ComputeSpeciesEnthalpy(T, Tve, val_eve); - + /*--- Scale thermal conductivity with turb visc ---*/ // TODO: Need to determine proper way to incorporate eddy viscosity // This is only scaling Kve by same factor as ktr @@ -295,13 +295,12 @@ void CNEMONumerics::GetViscousProjFlux(su2double *val_primvar, /*--- Populate entries in the viscous flux vector ---*/ for (iDim = 0; iDim < nDim; iDim++) { /*--- Species diffusion velocity ---*/ - for (iSpecies = 0; iSpecies < nHeavy; iSpecies++) { + for (iSpecies = 0; iSpecies < nHeavy; iSpecies++) { Flux_Tensor[iSpecies][iDim] = rho*Ds[iSpecies]*GV[RHOS_INDEX+iSpecies][iDim] - V[RHOS_INDEX+iSpecies]*Vector[iDim]; } if (ionization) { - cout << "GetViscProjFlux -- NEED TO IMPLEMENT IONIZED FUNCTIONALITY!!!" << endl; - exit(1); + SU2_MPI::Error("NEED TO IMPLEMENT IONIZED FUNCTIONALITY!!!",CURRENT_FUNCTION); } /*--- Shear stress related terms ---*/ @@ -708,7 +707,7 @@ void CNEMONumerics::GetPMatrix(const su2double *U, const su2double *V, const su2 val_p_tensor[nSpecies+iDim][nSpecies+1] = m[iDim]; val_p_tensor[nSpecies+iDim][nSpecies+2] = (V[VEL_INDEX+iDim]+a*val_normal[iDim]) / (2.0*a2); val_p_tensor[nSpecies+iDim][nSpecies+3] = (V[VEL_INDEX+iDim]-a*val_normal[iDim]) / (2.0*a2); - val_p_tensor[nSpecies+iDim][nSpecies+4] = 0.0; + val_p_tensor[nSpecies+iDim][nSpecies+4] = 0.0; } val_p_tensor[nSpecies+3][nSpecies] = vV; diff --git a/SU2_CFD/src/numerics/NEMO/NEMO_diffusion.cpp b/SU2_CFD/src/numerics/NEMO/NEMO_diffusion.cpp index d0f3ac76a133..12ce854348f0 100644 --- a/SU2_CFD/src/numerics/NEMO/NEMO_diffusion.cpp +++ b/SU2_CFD/src/numerics/NEMO/NEMO_diffusion.cpp @@ -3,7 +3,7 @@ * \brief Implementation of numerics classes for discretization * of viscous fluxes in fluid flow NEMO problems. * \author S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/NEMO/NEMO_sources.cpp b/SU2_CFD/src/numerics/NEMO/NEMO_sources.cpp index ec3532bff259..06d1b6ebd4d1 100644 --- a/SU2_CFD/src/numerics/NEMO/NEMO_sources.cpp +++ b/SU2_CFD/src/numerics/NEMO/NEMO_sources.cpp @@ -3,7 +3,7 @@ * \brief Implementation of numerics classes for integration * of source terms in fluid flow NEMO problems. * \author C. Garbacz, W. Maier, S. Copeland. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -376,7 +376,7 @@ CNumerics::ResidualType<> CSource_NEMO::ComputeAxisymmetric(const CConfig *confi +v*TWO3*(2*PrimVar_Grad_i[nSpecies+2][1]-PrimVar_Grad_i[nSpecies+2][0] -v*yinv+rho*turb_ke_i)) -total_conductivity_i*PrimVar_Grad_i[nSpecies][1]) - -TWO3*(AuxVar_Grad_i[1][1]+AuxVar_Grad_i[2][1])); + -TWO3*(AuxVar_Grad_i[1][1]+AuxVar_Grad_i[2][0])); residual[nSpecies+3] -= Volume*(yinv*(sumJeve_y -qy_ve)); } diff --git a/SU2_CFD/src/numerics/NEMO/convection/ausm.cpp b/SU2_CFD/src/numerics/NEMO/convection/ausm.cpp index 9e14008636dc..8888fb62cab8 100644 --- a/SU2_CFD/src/numerics/NEMO/convection/ausm.cpp +++ b/SU2_CFD/src/numerics/NEMO/convection/ausm.cpp @@ -2,7 +2,7 @@ * \file ausm.cpp * \brief Implementations of the AUSM-family of schemes in NEMO. * \author F. Palacios, S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/NEMO/convection/ausmplusup2.cpp b/SU2_CFD/src/numerics/NEMO/convection/ausmplusup2.cpp index d018b81da444..1756b1498ba8 100644 --- a/SU2_CFD/src/numerics/NEMO/convection/ausmplusup2.cpp +++ b/SU2_CFD/src/numerics/NEMO/convection/ausmplusup2.cpp @@ -2,7 +2,7 @@ * \file ausmplusup2.cpp * \brief Implementations of the AUSM-family of schemes - AUSM+UP2. * \author W. Maier, A. Sachedeva, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/NEMO/convection/ausmpwplus.cpp b/SU2_CFD/src/numerics/NEMO/convection/ausmpwplus.cpp index 62796548a340..88293d6f0beb 100644 --- a/SU2_CFD/src/numerics/NEMO/convection/ausmpwplus.cpp +++ b/SU2_CFD/src/numerics/NEMO/convection/ausmpwplus.cpp @@ -2,7 +2,7 @@ * \file ausmpwplus.cpp * \brief Implementations of the AUSM-family of schemes - AUSMPWPLUS. * \author F. Palacios, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/NEMO/convection/lax.cpp b/SU2_CFD/src/numerics/NEMO/convection/lax.cpp index 9f25a48fd621..8cc5714dd714 100644 --- a/SU2_CFD/src/numerics/NEMO/convection/lax.cpp +++ b/SU2_CFD/src/numerics/NEMO/convection/lax.cpp @@ -2,7 +2,7 @@ * \file lax.cpp * \brief Implementations of Lax centered scheme. * \author F. Palacios, S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/NEMO/convection/msw.cpp b/SU2_CFD/src/numerics/NEMO/convection/msw.cpp index 147ad17e3e83..c2fb4ac4ddb0 100644 --- a/SU2_CFD/src/numerics/NEMO/convection/msw.cpp +++ b/SU2_CFD/src/numerics/NEMO/convection/msw.cpp @@ -2,7 +2,7 @@ * \file msw.cpp * \brief Implementations of the modified Steger-Warming scheme. * \author ADL Stanford, S.R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/NEMO/convection/roe.cpp b/SU2_CFD/src/numerics/NEMO/convection/roe.cpp index ddbf00f496dd..fdd146b750fb 100644 --- a/SU2_CFD/src/numerics/NEMO/convection/roe.cpp +++ b/SU2_CFD/src/numerics/NEMO/convection/roe.cpp @@ -2,7 +2,7 @@ * \file roe.cpp * \brief Implementations of Roe-type schemes in NEMO. * \author S. R. Copeland, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/continuous_adjoint/adj_convection.cpp b/SU2_CFD/src/numerics/continuous_adjoint/adj_convection.cpp index e20c7c725ba3..f583e2646208 100644 --- a/SU2_CFD/src/numerics/continuous_adjoint/adj_convection.cpp +++ b/SU2_CFD/src/numerics/continuous_adjoint/adj_convection.cpp @@ -2,7 +2,7 @@ * \file adj_convection.cpp * \brief Implementation of adjoint convection numerics classes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/continuous_adjoint/adj_diffusion.cpp b/SU2_CFD/src/numerics/continuous_adjoint/adj_diffusion.cpp index 6bd9b395c032..e177fa67d6f2 100644 --- a/SU2_CFD/src/numerics/continuous_adjoint/adj_diffusion.cpp +++ b/SU2_CFD/src/numerics/continuous_adjoint/adj_diffusion.cpp @@ -2,7 +2,7 @@ * \file adj_diffusion.cpp * \brief Implementation of adjoint diffusion numerics classes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/continuous_adjoint/adj_sources.cpp b/SU2_CFD/src/numerics/continuous_adjoint/adj_sources.cpp index d9ac7e846871..5a84c76ce537 100644 --- a/SU2_CFD/src/numerics/continuous_adjoint/adj_sources.cpp +++ b/SU2_CFD/src/numerics/continuous_adjoint/adj_sources.cpp @@ -2,7 +2,7 @@ * \file adj_sources.cpp * \brief Implementation of adjoint source numerics classes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/elasticity/CFEAElasticity.cpp b/SU2_CFD/src/numerics/elasticity/CFEAElasticity.cpp index c1b16113ef8f..4c47c6f3847f 100644 --- a/SU2_CFD/src/numerics/elasticity/CFEAElasticity.cpp +++ b/SU2_CFD/src/numerics/elasticity/CFEAElasticity.cpp @@ -2,7 +2,7 @@ * \file CFEAElasticity.cpp * \brief Base class for all elasticity problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -243,6 +243,11 @@ void CFEAElasticity::Compute_Dead_Load(CElement *element, const CConfig *config) SetElement_Properties(element, config); /*-----------------------------------------------------------*/ + /*--- Register pre-accumulation inputs, density and reference coords. ---*/ + AD::StartPreacc(); + AD::SetPreaccIn(Rho_s_DL); + element->SetPreaccIn_Coords(false); + unsigned short iGauss, nGauss; unsigned short iNode, iDim, nNode; @@ -286,6 +291,10 @@ void CFEAElasticity::Compute_Dead_Load(CElement *element, const CConfig *config) } + /*--- Register the dead load as preaccumulation output. ---*/ + element->SetPreaccOut_FDL_a(); + AD::EndPreacc(); + } diff --git a/SU2_CFD/src/numerics/elasticity/CFEALinearElasticity.cpp b/SU2_CFD/src/numerics/elasticity/CFEALinearElasticity.cpp index 86cedc1700b3..dfe849972ccd 100644 --- a/SU2_CFD/src/numerics/elasticity/CFEALinearElasticity.cpp +++ b/SU2_CFD/src/numerics/elasticity/CFEALinearElasticity.cpp @@ -2,7 +2,7 @@ * \file CFEALinearElasticity.cpp * \brief Classes for linear elasticity problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -56,8 +56,6 @@ void CFEALinearElasticity::Compute_Tangent_Matrix(CElement *element, const CConf AD::StartPreacc(); AD::SetPreaccIn(E); AD::SetPreaccIn(Nu); - AD::SetPreaccIn(Rho_s); - AD::SetPreaccIn(Rho_s_DL); element->SetPreaccIn_Coords(); /*--- Recompute Lame parameters as they depend on the material properties ---*/ Compute_Lame_Parameters(); @@ -234,19 +232,27 @@ void CFEALinearElasticity::Compute_Constitutive_Matrix(CElement *element_contain } -void CFEALinearElasticity::Compute_Averaged_NodalStress(CElement *element, const CConfig *config) { +su2double CFEALinearElasticity::Compute_Averaged_NodalStress(CElement *element, const CConfig *config) { unsigned short iVar, jVar; unsigned short iGauss, nGauss; unsigned short iNode, nNode; unsigned short iDim, bDim; - /*--- Auxiliary vector ---*/ - su2double Strain[6], Stress[6]; + su2double avgStress[DIM_STRAIN_3D] = {0.0}; /*--- Set element properties and recompute the constitutive matrix, this is needed for multiple material cases and for correct differentiation ---*/ SetElement_Properties(element, config); + + /*--- Register pre-accumulation inputs ---*/ + AD::StartPreacc(); + AD::SetPreaccIn(E); + AD::SetPreaccIn(Nu); + element->SetPreaccIn_Coords(); + /*--- Recompute Lame parameters as they depend on the material properties ---*/ + Compute_Lame_Parameters(); + Compute_Constitutive_Matrix(element, config); /*--- Initialize auxiliary matrices ---*/ @@ -275,9 +281,7 @@ void CFEALinearElasticity::Compute_Averaged_NodalStress(CElement *element, const } } - for (iVar = 0; iVar < bDim; iVar++) { - Strain[iVar] = 0.0; - } + su2double Strain[DIM_STRAIN_3D] = {0.0}; for (iNode = 0; iNode < nNode; iNode++) { @@ -312,11 +316,13 @@ void CFEALinearElasticity::Compute_Averaged_NodalStress(CElement *element, const /*--- Compute the Stress Vector as D*epsilon ---*/ + su2double Stress[DIM_STRAIN_3D] = {0.0}; + for (iVar = 0; iVar < bDim; iVar++) { - Stress[iVar] = 0.0; for (jVar = 0; jVar < bDim; jVar++) { Stress[iVar] += D_Mat[iVar][jVar]*Strain[jVar]; } + avgStress[iVar] += Stress[iVar] / nGauss; } for (iNode = 0; iNode < nNode; iNode++) { @@ -341,6 +347,15 @@ void CFEALinearElasticity::Compute_Averaged_NodalStress(CElement *element, const } + if (nDim == 3) std::swap(avgStress[2], avgStress[3]); + auto elStress = VonMisesStress(nDim, avgStress); + + /*--- We only differentiate w.r.t. an avg VM stress for the element as + * considering all nodal stresses would use too much memory. ---*/ + AD::SetPreaccOut(elStress); + AD::EndPreacc(); + + return elStress; } diff --git a/SU2_CFD/src/numerics/elasticity/CFEANonlinearElasticity.cpp b/SU2_CFD/src/numerics/elasticity/CFEANonlinearElasticity.cpp index a2ac41145de1..10f5b54999fc 100644 --- a/SU2_CFD/src/numerics/elasticity/CFEANonlinearElasticity.cpp +++ b/SU2_CFD/src/numerics/elasticity/CFEANonlinearElasticity.cpp @@ -3,7 +3,7 @@ * \brief This file contains the routines for setting the tangent matrix and * residual of a FEM nonlinear elastic structural problem. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -240,8 +240,6 @@ void CFEANonlinearElasticity::Compute_Tangent_Matrix(CElement *element, const CC AD::StartPreacc(); AD::SetPreaccIn(E); AD::SetPreaccIn(Nu); - AD::SetPreaccIn(Rho_s); - AD::SetPreaccIn(Rho_s_DL); if (maxwell_stress) { AD::SetPreaccIn(EFieldMod_Ref); AD::SetPreaccIn(ke_DE); @@ -483,8 +481,6 @@ void CFEANonlinearElasticity::Compute_NodalStress_Term(CElement *element, const AD::StartPreacc(); AD::SetPreaccIn(E); AD::SetPreaccIn(Nu); - AD::SetPreaccIn(Rho_s); - AD::SetPreaccIn(Rho_s_DL); if (maxwell_stress) { AD::SetPreaccIn(EFieldMod_Ref); AD::SetPreaccIn(ke_DE); @@ -745,17 +741,34 @@ void CFEANonlinearElasticity::Assign_cijkl_D_Mat(void) { } -void CFEANonlinearElasticity::Compute_Averaged_NodalStress(CElement *element, const CConfig *config) { +su2double CFEANonlinearElasticity::Compute_Averaged_NodalStress(CElement *element, const CConfig *config) { unsigned short iVar, jVar, kVar; unsigned short iGauss, nGauss; unsigned short iDim, iNode, nNode; + su2double avgStress[DIM_STRAIN_3D] = {0.0}; + /*--- TODO: Initialize values for the material model considered ---*/ SetElement_Properties(element, config); if (maxwell_stress) SetElectric_Properties(element, config); /*-----------------------------------------------------------*/ + /*--- Register pre-accumulation inputs ---*/ + /*--- WARNING: Outputs must be registered outside of this method, this allows more + * flexibility in selecting what is captured by AD, capturing the entire stress + * tensor would use more memory than that used by the stress residuals. ---*/ + AD::StartPreacc(); + AD::SetPreaccIn(E); + AD::SetPreaccIn(Nu); + if (maxwell_stress) { + AD::SetPreaccIn(EFieldMod_Ref); + AD::SetPreaccIn(ke_DE); + } + element->SetPreaccIn_Coords(); + /*--- Recompute Lame parameters as they depend on the material properties ---*/ + Compute_Lame_Parameters(); + su2double Weight, Jac_x; element->ClearStress(); @@ -837,6 +850,15 @@ void CFEANonlinearElasticity::Compute_Averaged_NodalStress(CElement *element, co Compute_Stress_Tensor(element, config); if (maxwell_stress) Add_MaxwellStress(element, config); + avgStress[0] += Stress_Tensor[0][0] / nGauss; + avgStress[1] += Stress_Tensor[1][1] / nGauss; + avgStress[2] += Stress_Tensor[0][1] / nGauss; + if (nDim == 3) { + avgStress[3] += Stress_Tensor[2][2] / nGauss; + avgStress[4] += Stress_Tensor[0][2] / nGauss; + avgStress[5] += Stress_Tensor[1][2] / nGauss; + } + for (iNode = 0; iNode < nNode; iNode++) { /*--- Compute the nodal stress term for each gaussian point and for each node, ---*/ @@ -868,4 +890,12 @@ void CFEANonlinearElasticity::Compute_Averaged_NodalStress(CElement *element, co } + auto elStress = VonMisesStress(nDim, avgStress); + + /*--- We only differentiate w.r.t. an avg VM stress for the element as + * considering all nodal stresses would use too much memory. ---*/ + AD::SetPreaccOut(elStress); + AD::EndPreacc(); + + return elStress; } diff --git a/SU2_CFD/src/numerics/elasticity/nonlinear_models.cpp b/SU2_CFD/src/numerics/elasticity/nonlinear_models.cpp index 0f6c032e9df7..76e70f0a5e81 100644 --- a/SU2_CFD/src/numerics/elasticity/nonlinear_models.cpp +++ b/SU2_CFD/src/numerics/elasticity/nonlinear_models.cpp @@ -2,7 +2,7 @@ * \file nonlinear_models.cpp * \brief Definition of nonlinear constitutive models. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp b/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp index 8f965336d25b..86db397ce891 100644 --- a/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp +++ b/SU2_CFD/src/numerics/flow/convection/ausm_slau.cpp @@ -2,7 +2,7 @@ * \file ausm_slau.cpp * \brief Implementations of the AUSM-family of schemes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/convection/centered.cpp b/SU2_CFD/src/numerics/flow/convection/centered.cpp index 69b1b59b46e9..d1a891232cb3 100644 --- a/SU2_CFD/src/numerics/flow/convection/centered.cpp +++ b/SU2_CFD/src/numerics/flow/convection/centered.cpp @@ -2,7 +2,7 @@ * \file centered.cpp * \brief Implementations of centered schemes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/convection/cusp.cpp b/SU2_CFD/src/numerics/flow/convection/cusp.cpp index 063ae16d4609..5840a11b6930 100644 --- a/SU2_CFD/src/numerics/flow/convection/cusp.cpp +++ b/SU2_CFD/src/numerics/flow/convection/cusp.cpp @@ -2,7 +2,7 @@ * \file cusp.cpp * \brief Implementation of the CUSP scheme. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/convection/fds.cpp b/SU2_CFD/src/numerics/flow/convection/fds.cpp index 270bf5dfbada..003d6da0721c 100644 --- a/SU2_CFD/src/numerics/flow/convection/fds.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fds.cpp @@ -2,7 +2,7 @@ * \file fds.cpp * \brief Implementation of Flux-Difference-Splitting schemes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/convection/fvs.cpp b/SU2_CFD/src/numerics/flow/convection/fvs.cpp index 59d6c81be921..bcf44c7a5bbd 100644 --- a/SU2_CFD/src/numerics/flow/convection/fvs.cpp +++ b/SU2_CFD/src/numerics/flow/convection/fvs.cpp @@ -2,7 +2,7 @@ * \file fvs.cpp * \brief Implementations of Flux-Vector-Splitting schemes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/convection/hllc.cpp b/SU2_CFD/src/numerics/flow/convection/hllc.cpp index 27e1e89c2810..5e194ce1f391 100644 --- a/SU2_CFD/src/numerics/flow/convection/hllc.cpp +++ b/SU2_CFD/src/numerics/flow/convection/hllc.cpp @@ -2,7 +2,7 @@ * \file hllc.cpp * \brief Implementations of HLLC schemes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/convection/roe.cpp b/SU2_CFD/src/numerics/flow/convection/roe.cpp index 25199022939d..6d487afb94a9 100644 --- a/SU2_CFD/src/numerics/flow/convection/roe.cpp +++ b/SU2_CFD/src/numerics/flow/convection/roe.cpp @@ -2,7 +2,7 @@ * \file roe.cpp * \brief Implementations of Roe-type schemes. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -219,11 +219,11 @@ CNumerics::ResidualType<> CUpwRoeBase_Flow::ComputeResidual(const CConfig* confi /*--- Initialize residual (flux) and Jacobians ---*/ for (iVar = 0; iVar < nVar; iVar++) - Flux[iVar] = kappa*(ProjFlux_i[iVar]+ProjFlux_j[iVar]); + Flux[iVar] = 0.5*(ProjFlux_i[iVar]+ProjFlux_j[iVar]); if (implicit) { - GetInviscidProjJac(Velocity_i, &Energy_i, Normal, kappa, Jacobian_i); - GetInviscidProjJac(Velocity_j, &Energy_j, Normal, kappa, Jacobian_j); + GetInviscidProjJac(Velocity_i, &Energy_i, Normal, 0.5, Jacobian_i); + GetInviscidProjJac(Velocity_j, &Energy_j, Normal, 0.5, Jacobian_j); } /*--- Finalize in children class ---*/ @@ -316,7 +316,7 @@ void CUpwL2Roe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J /*--- Compute wave amplitudes (characteristics) ---*/ - su2double proj_delta_vel = 0.0, delta_vel[3]; + su2double proj_delta_vel = 0.0, delta_vel[3] = {0.0}; for (iDim = 0; iDim < nDim; iDim++) { delta_vel[iDim] = Velocity_j[iDim] - Velocity_i[iDim]; proj_delta_vel += delta_vel[iDim]*UnitNormal[iDim]; @@ -325,7 +325,7 @@ void CUpwL2Roe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J su2double delta_p = Pressure_j - Pressure_i; su2double delta_rho = Density_j - Density_i; - su2double delta_wave[5] = {0.0, 0.0, 0.0, 0.0, 0.0}; + su2double delta_wave[5] = {0.0}; if (nDim == 2) { delta_wave[0] = delta_rho - delta_p/RoeSoundSpeed2; delta_wave[1] = (UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1])*zeta; @@ -389,7 +389,7 @@ void CUpwLMRoe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J /*--- Compute wave amplitudes (characteristics) ---*/ - su2double proj_delta_vel = 0.0, delta_vel[3]; + su2double proj_delta_vel = 0.0, delta_vel[3] = {0.0}; for (iDim = 0; iDim < nDim; iDim++) { delta_vel[iDim] = Velocity_j[iDim] - Velocity_i[iDim]; proj_delta_vel += delta_vel[iDim]*UnitNormal[iDim]; @@ -398,7 +398,7 @@ void CUpwLMRoe_Flow::FinalizeResidual(su2double *val_residual, su2double **val_J su2double delta_p = Pressure_j - Pressure_i; su2double delta_rho = Density_j - Density_i; - su2double delta_wave[5] = {0.0, 0.0, 0.0, 0.0, 0.0}; + su2double delta_wave[5] = {0.0}; if (nDim == 2) { delta_wave[0] = delta_rho - delta_p/RoeSoundSpeed2; delta_wave[1] = (UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1]); @@ -930,11 +930,11 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co GetPMatrix_inv(invP_Tensor, &RoeDensity, RoeVelocity, &RoeSoundSpeed, &RoeChi , &RoeKappa, UnitNormal); /*--- Jacobians of the inviscid flux, scaled by - kappa because val_resconv ~ kappa*(fc_i+fc_j)*Normal ---*/ + 0.5 because val_resconv ~ 0.5*(fc_i+fc_j)*Normal ---*/ - GetInviscidProjJac(Velocity_i, &Enthalpy_i, &Chi_i, &Kappa_i, Normal, kappa, Jacobian_i); + GetInviscidProjJac(Velocity_i, &Enthalpy_i, &Chi_i, &Kappa_i, Normal, 0.5, Jacobian_i); - GetInviscidProjJac(Velocity_j, &Enthalpy_j, &Chi_j, &Kappa_j, Normal, kappa, Jacobian_j); + GetInviscidProjJac(Velocity_j, &Enthalpy_j, &Chi_j, &Kappa_j, Normal, 0.5, Jacobian_j); /*--- Diference variables iPoint and jPoint ---*/ @@ -943,7 +943,7 @@ CNumerics::ResidualType<> CUpwGeneralRoe_Flow::ComputeResidual(const CConfig* co /*--- Roe's Flux approximation ---*/ for (iVar = 0; iVar < nVar; iVar++) { - Flux[iVar] = kappa*(ProjFlux_i[iVar]+ProjFlux_j[iVar]); + Flux[iVar] = 0.5*(ProjFlux_i[iVar]+ProjFlux_j[iVar]); for (jVar = 0; jVar < nVar; jVar++) { Proj_ModJac_Tensor_ij = 0.0; diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index d9832b726392..1dde3aa910f6 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -3,7 +3,7 @@ * \brief Implementation of numerics classes for discretization * of viscous fluxes in fluid flow problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/flow/flow_sources.cpp b/SU2_CFD/src/numerics/flow/flow_sources.cpp index a107d65159d9..9ed3841c8f55 100644 --- a/SU2_CFD/src/numerics/flow/flow_sources.cpp +++ b/SU2_CFD/src/numerics/flow/flow_sources.cpp @@ -3,7 +3,7 @@ * \brief Implementation of numerics classes for integration * of source terms in fluid flow problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -27,6 +27,7 @@ */ #include "../../../include/numerics/flow/flow_sources.hpp" +#include "../../../../Common/include/toolboxes/geometry_toolbox.hpp" CSourceBase_Flow::CSourceBase_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) : CNumerics(val_nDim, val_nVar, config) { @@ -149,14 +150,14 @@ void CSourceAxisymmetric_Flow::ResidualDiffusion(){ residual[0] -= 0.0; residual[1] -= Volume*(yinv*total_viscosity_i*(PrimVar_Grad_i[1][1]+PrimVar_Grad_i[2][0]) - -TWO3*AuxVar_Grad_i[0][0]); + -TWO3*AuxVar_Grad_i[0][0]); residual[2] -= Volume*(yinv*total_viscosity_i*2*(PrimVar_Grad_i[2][1]-v*yinv) - -TWO3*AuxVar_Grad_i[0][1]); + -TWO3*AuxVar_Grad_i[0][1]); residual[3] -= Volume*(yinv*(total_viscosity_i*(u*(PrimVar_Grad_i[2][0]+PrimVar_Grad_i[1][1]) - +v*TWO3*(2*PrimVar_Grad_i[1][1]-PrimVar_Grad_i[1][0] - -v*yinv+U_i[0]*turb_ke_i)) - -total_conductivity_i*PrimVar_Grad_i[0][1]) - -TWO3*(AuxVar_Grad_i[1][1]+AuxVar_Grad_i[2][1])); + +v*TWO3*(2*PrimVar_Grad_i[1][1]-PrimVar_Grad_i[1][0] + -v*yinv+U_i[0]*turb_ke_i)) + -total_conductivity_i*PrimVar_Grad_i[0][1]) + -TWO3*(AuxVar_Grad_i[1][1]+AuxVar_Grad_i[2][0])); } @@ -469,7 +470,9 @@ CNumerics::ResidualType<> CSourceBoussinesq::ComputeResidual(const CConfig* conf } CSourceGravity::CSourceGravity(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) : - CSourceBase_Flow(val_nDim, val_nVar, config) { } + CSourceBase_Flow(val_nDim, val_nVar, config) { + Force_Ref = config->GetForce_Ref(); + } CNumerics::ResidualType<> CSourceGravity::ComputeResidual(const CConfig* config) { @@ -479,7 +482,7 @@ CNumerics::ResidualType<> CSourceGravity::ComputeResidual(const CConfig* config) residual[iVar] = 0.0; /*--- Evaluate the source term ---*/ - residual[nDim] = Volume * U_i[0] * STANDARD_GRAVITY; + residual[nDim] = Volume * U_i[0] * STANDARD_GRAVITY / Force_Ref; return ResidualType<>(residual, jacobian, nullptr); } @@ -668,6 +671,94 @@ CNumerics::ResidualType<> CSourceWindGust::ComputeResidual(const CConfig* config return ResidualType<>(residual, jacobian, nullptr); } + +CSourceIncStreamwise_Periodic::CSourceIncStreamwise_Periodic(unsigned short val_nDim, + unsigned short val_nVar, + CConfig *config) : + CSourceBase_Flow(val_nDim, val_nVar, config) { + + turbulent = (config->GetKind_Turb_Model() != NONE); + energy = config->GetEnergy_Equation(); + streamwisePeriodic_temperature = config->GetStreamwise_Periodic_Temperature(); + + for (unsigned short iDim = 0; iDim < nDim; iDim++) + Streamwise_Coord_Vector[iDim] = config->GetPeriodic_Translation(0)[iDim]; + + /*--- Compute square of the distance between the 2 periodic surfaces via inner product with itself: + dot_prod(t*t) = (|t|_2)^2 ---*/ + norm2_translation = GeometryToolbox::SquaredNorm(nDim, Streamwise_Coord_Vector); + +} + +CNumerics::ResidualType<> CSourceIncStreamwise_Periodic::ComputeResidual(const CConfig *config) { + + /* Value of prescribed pressure drop which results in an artificial body force vector. */ + const su2double delta_p = SPvals.Streamwise_Periodic_PressureDrop; + + for (unsigned short iVar = 0; iVar < nVar; iVar++) residual[iVar] = 0.0; + + /*--- Compute the momentum equation source based on the prescribed (or computed if massflow) delta pressure ---*/ + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + scalar_factor = delta_p / norm2_translation * Streamwise_Coord_Vector[iDim]; + residual[iDim+1] = -Volume * scalar_factor; + } + + /*--- Compute the periodic temperature contribution to the energy equation, if energy equation is considered ---*/ + if (energy && streamwisePeriodic_temperature) { + + scalar_factor = SPvals.Streamwise_Periodic_IntegratedHeatFlow * DensityInc_i / (SPvals.Streamwise_Periodic_MassFlow * norm2_translation); + + /*--- Compute scalar-product dot_prod(v*t) ---*/ + dot_product = GeometryToolbox::DotProduct(nDim, Streamwise_Coord_Vector, &V_i[1]); + + residual[nDim+1] = Volume * scalar_factor * dot_product; + + /*--- If a RANS turbulence model ias used an additional source term, based on the eddy viscosity gradient is added. ---*/ + if(turbulent) { + + /*--- Compute a scalar factor ---*/ + scalar_factor = SPvals.Streamwise_Periodic_IntegratedHeatFlow / (SPvals.Streamwise_Periodic_MassFlow * sqrt(norm2_translation) * Prandtl_Turb); + + /*--- Compute scalar product between periodic translation vector and eddy viscosity gradient. ---*/ + dot_product = GeometryToolbox::DotProduct(nDim, Streamwise_Coord_Vector, AuxVar_Grad_i[0]); + + residual[nDim+1] -= Volume * scalar_factor * dot_product; + } // if turbulent + } // if energy + + return ResidualType<>(residual, jacobian, nullptr); +} + +CSourceIncStreamwisePeriodic_Outlet::CSourceIncStreamwisePeriodic_Outlet(unsigned short val_nDim, + unsigned short val_nVar, + CConfig *config) : + CSourceBase_Flow(val_nDim, val_nVar, config) { } + +CNumerics::ResidualType<> CSourceIncStreamwisePeriodic_Outlet::ComputeResidual(const CConfig *config) { + + for (unsigned short iVar = 0; iVar < nVar; iVar++) residual[iVar] = 0.0; + + /*--- m_dot_local = rho * dot_prod(n_A*v), with n_A beeing the area-normal ---*/ + const su2double local_Massflow = DensityInc_i * GeometryToolbox::DotProduct(nDim, Normal, &V_i[1]); + + // Massflow weighted heat sink, which takes out + // a) the integrated amount over the Heatflux marker + // b) a user provided quantity, especially the case for CHT cases + su2double factor; + if (config->GetStreamwise_Periodic_OutletHeat() == 0.0) + factor = SPvals.Streamwise_Periodic_IntegratedHeatFlow; + else + factor = config->GetStreamwise_Periodic_OutletHeat() / config->GetHeat_Flux_Ref(); + + residual[nDim+1] -= abs(local_Massflow/SPvals.Streamwise_Periodic_MassFlow) * factor; + + /*--- Force the area avg inlet Temp to match the Inc_Temperature_Init with additional residual contribution ---*/ + const su2double delta_T = SPvals.Streamwise_Periodic_InletTemperature - config->GetInc_Temperature_Init()/config->GetTemperature_Ref(); + residual[nDim+1] += 0.5 * abs(local_Massflow) * SpecificHeat_i * delta_T; + + return ResidualType<>(residual, jacobian, nullptr); +} + CSourceRadiation::CSourceRadiation(unsigned short val_nDim, unsigned short val_nVar, const CConfig *config) : CSourceBase_Flow(val_nDim, val_nVar, config) { diff --git a/SU2_CFD/src/numerics/heat.cpp b/SU2_CFD/src/numerics/heat.cpp index a6b1911d0f19..c6dc5cdde64c 100644 --- a/SU2_CFD/src/numerics/heat.cpp +++ b/SU2_CFD/src/numerics/heat.cpp @@ -2,7 +2,7 @@ * \file heat.cpp * \brief Implementation of numerics classes for heat transfer. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/radiation.cpp b/SU2_CFD/src/numerics/radiation.cpp index 5d4268fe88b2..65222ad3095f 100644 --- a/SU2_CFD/src/numerics/radiation.cpp +++ b/SU2_CFD/src/numerics/radiation.cpp @@ -3,7 +3,7 @@ * \brief This file contains the implementation of the numerical * methods for radiation. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/template.cpp b/SU2_CFD/src/numerics/template.cpp index 81effb5c0d0c..ba0627e47cfb 100644 --- a/SU2_CFD/src/numerics/template.cpp +++ b/SU2_CFD/src/numerics/template.cpp @@ -2,7 +2,7 @@ * \file template.cpp * \brief Empty implementation of numerics templates, see .hpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/transition.cpp b/SU2_CFD/src/numerics/transition.cpp index 99182037c547..4d7ceac91963 100644 --- a/SU2_CFD/src/numerics/transition.cpp +++ b/SU2_CFD/src/numerics/transition.cpp @@ -2,7 +2,7 @@ * \file transition.cpp * \brief Implementation of numerics classes for transition problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/turbulent/turb_convection.cpp b/SU2_CFD/src/numerics/turbulent/turb_convection.cpp index 8dfa4e3c7d21..f294b61778b0 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_convection.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_convection.cpp @@ -3,7 +3,7 @@ * \brief Implementation of numerics classes to compute convective * fluxes in turbulence problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp b/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp index 66d70730450f..cd50f8ed71ce 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_diffusion.cpp @@ -3,7 +3,7 @@ * \brief Implementation of numerics classes to compute viscous * fluxes in turbulence problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp index 9164ffb9edbc..0efc4e00dcf4 100644 --- a/SU2_CFD/src/numerics/turbulent/turb_sources.cpp +++ b/SU2_CFD/src/numerics/turbulent/turb_sources.cpp @@ -3,7 +3,7 @@ * \brief Implementation of numerics classes for integration of * turbulence source-terms. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -94,8 +94,6 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig CrossProduction = 0.0; Jacobian_i[0] = 0.0; - gamma_BC = 0.0; - /*--- Evaluate Omega ---*/ Omega = sqrt(Vorticity_i[0]*Vorticity_i[0] + Vorticity_i[1]*Vorticity_i[1] + Vorticity_i[2]*Vorticity_i[2]); @@ -153,9 +151,10 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig su2double term1 = sqrt(max(re_theta-re_theta_t,0.)/(chi_1*re_theta_t)); su2double term2 = sqrt(max((nu_t*chi_2)/nu,0.)); su2double term_exponential = (term1 + term2); - su2double gamma_BC = 1.0 - exp(-term_exponential); - Production = gamma_BC*cb1*Shat*TurbVar_i[0]*Volume; + Gamma_BC = 1.0 - exp(-term_exponential); + + Production = Gamma_BC*cb1*Shat*TurbVar_i[0]*Volume; } else { Production = cb1*Shat*TurbVar_i[0]*Volume; @@ -192,7 +191,7 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSA::ComputeResidual(const CConfig else dShat = (fv2+TurbVar_i[0]*dfv2)*inv_k2_d2; if (transition) { - Jacobian_i[0] += gamma_BC*cb1*(TurbVar_i[0]*dShat+Shat)*Volume; + Jacobian_i[0] += Gamma_BC*cb1*(TurbVar_i[0]*dShat+Shat)*Volume; } else { Jacobian_i[0] += cb1*(TurbVar_i[0]*dShat+Shat)*Volume; @@ -761,16 +760,19 @@ CSourcePieceWise_TurbSST::CSourcePieceWise_TurbSST(unsigned short val_nDim, incompressible = (config->GetKind_Regime() == INCOMPRESSIBLE); sustaining_terms = (config->GetKind_Turb_Model() == SST_SUST); + axisymmetric = config->GetAxisymmetric(); /*--- Closure constants ---*/ - beta_star = constants[6]; - sigma_omega_1 = constants[2]; - sigma_omega_2 = constants[3]; + sigma_k_1 = constants[0]; + sigma_k_2 = constants[1]; + sigma_w_1 = constants[2]; + sigma_w_2 = constants[3]; beta_1 = constants[4]; beta_2 = constants[5]; + beta_star = constants[6]; + a1 = constants[7]; alfa_1 = constants[8]; alfa_2 = constants[9]; - a1 = constants[7]; /*--- Set the ambient values of k and omega to the free stream values. ---*/ kAmb = val_kine_Inf; @@ -846,7 +848,6 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi pk = Eddy_Viscosity_i*StrainMag_i*StrainMag_i - 2.0/3.0*Density_i*TurbVar_i[0]*diverg; } - pk = min(pk,20.0*beta_star*Density_i*TurbVar_i[1]*TurbVar_i[0]); pk = max(pk,0.0); @@ -890,6 +891,10 @@ CNumerics::ResidualType<> CSourcePieceWise_TurbSST::ComputeResidual(const CConfi /*--- Cross diffusion ---*/ Residual[1] += (1.0 - F1_i)*CDkw_i*Volume; + + /*--- Contribution due to 2D axisymmetric formulation ---*/ + + if (axisymmetric) ResidualAxisymmetric(alfa_blended,zeta); /*--- Implicit part ---*/ diff --git a/SU2_CFD/src/output/CAdjElasticityOutput.cpp b/SU2_CFD/src/output/CAdjElasticityOutput.cpp index 1af8a45ce73e..22b1e5add14e 100644 --- a/SU2_CFD/src/output/CAdjElasticityOutput.cpp +++ b/SU2_CFD/src/output/CAdjElasticityOutput.cpp @@ -2,7 +2,7 @@ * \file CAdjElasticityOutput.cpp * \brief Main subroutines for elasticity discrete adjoint output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp index e45ec3d6cbb0..66e36e8bb8b0 100644 --- a/SU2_CFD/src/output/CAdjFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowCompOutput.cpp @@ -2,7 +2,7 @@ * \file output_adj_flow_comp.cpp * \brief Main subroutines for flow discrete adjoint output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp index 90c33b69f7ad..b7bd9e901157 100644 --- a/SU2_CFD/src/output/CAdjFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CAdjFlowIncOutput.cpp @@ -2,7 +2,7 @@ * \file output_adj_flow_inc.cpp * \brief Main subroutines for flow discrete adjoint output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -372,7 +372,7 @@ void CAdjFlowIncOutput::SetVolumeOutputFields(CConfig *config){ /// END_GROUP // Grid velocity - if (config->GetGrid_Movement()){ + if (config->GetDynamic_Grid()){ AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); if (nDim == 3 ) @@ -537,4 +537,3 @@ bool CAdjFlowIncOutput::SetUpdate_Averages(CConfig *config){ // return (config->GetUnsteady_Simulation() != STEADY && !dualtime); } - diff --git a/SU2_CFD/src/output/CAdjHeatOutput.cpp b/SU2_CFD/src/output/CAdjHeatOutput.cpp index 0ea5b3a74ee9..4c8f2b767a72 100644 --- a/SU2_CFD/src/output/CAdjHeatOutput.cpp +++ b/SU2_CFD/src/output/CAdjHeatOutput.cpp @@ -2,7 +2,7 @@ * \file output_adj_heat.cpp * \brief Main subroutines for flow discrete adjoint output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CBaselineOutput.cpp b/SU2_CFD/src/output/CBaselineOutput.cpp index 168575e6d680..6c8d3bf54991 100644 --- a/SU2_CFD/src/output/CBaselineOutput.cpp +++ b/SU2_CFD/src/output/CBaselineOutput.cpp @@ -2,7 +2,7 @@ * \file output_baseline.cpp * \brief Main subroutines for flow discrete adjoint output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CElasticityOutput.cpp b/SU2_CFD/src/output/CElasticityOutput.cpp index 11fa3e8dca0a..07b52053e40d 100644 --- a/SU2_CFD/src/output/CElasticityOutput.cpp +++ b/SU2_CFD/src/output/CElasticityOutput.cpp @@ -2,7 +2,7 @@ * \file output_elasticity.cpp * \brief Main subroutines for FEA output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -136,6 +136,7 @@ void CElasticityOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS SetHistoryOutputValue("REFERENCE_NODE", fea_solver->GetTotal_OFRefNode()); SetHistoryOutputValue("TOPOL_COMPLIANCE", fea_solver->GetTotal_OFCompliance()); + SetHistoryOutputValue("STRESS_PENALTY", fea_solver->GetTotal_OFStressPenalty()); if (config->GetRefGeom()) { SetHistoryOutputValue("REFERENCE_GEOMETRY", fea_solver->GetTotal_OFRefGeom()); } @@ -171,6 +172,7 @@ void CElasticityOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("REFERENCE_NODE", "RefNode", ScreenOutputFormat::SCIENTIFIC, "STRUCT_COEFF", "", HistoryFieldType::COEFFICIENT); AddHistoryOutput("TOPOL_COMPLIANCE", "TopComp", ScreenOutputFormat::SCIENTIFIC, "STRUCT_COEFF", "", HistoryFieldType::COEFFICIENT); + AddHistoryOutput("STRESS_PENALTY", "StressPen", ScreenOutputFormat::SCIENTIFIC, "STRUCT_COEFF", "", HistoryFieldType::COEFFICIENT); if (config->GetRefGeom()) { AddHistoryOutput("REFERENCE_GEOMETRY", "RefGeom", ScreenOutputFormat::SCIENTIFIC, "STRUCT_COEFF", "", HistoryFieldType::COEFFICIENT); } @@ -178,6 +180,7 @@ void CElasticityOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("VOLUME_FRACTION", "VolFrac", ScreenOutputFormat::SCIENTIFIC, "STRUCT_COEFF", "", HistoryFieldType::COEFFICIENT); AddHistoryOutput("TOPOL_DISCRETENESS", "TopDisc", ScreenOutputFormat::SCIENTIFIC, "STRUCT_COEFF", "", HistoryFieldType::COEFFICIENT); } + } void CElasticityOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){ diff --git a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp index 632bdefad0c9..cb1dc697aaa1 100644 --- a/SU2_CFD/src/output/CFlowCompFEMOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompFEMOutput.cpp @@ -2,7 +2,7 @@ * \file output_flow_comp_fem.cpp * \brief Main subroutines for compressible flow output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CFlowCompOutput.cpp b/SU2_CFD/src/output/CFlowCompOutput.cpp index c3f823ee1cbf..cb226265e0a0 100644 --- a/SU2_CFD/src/output/CFlowCompOutput.cpp +++ b/SU2_CFD/src/output/CFlowCompOutput.cpp @@ -2,7 +2,7 @@ * \file output_flow_comp.cpp * \brief Main subroutines for compressible flow output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -58,7 +58,7 @@ CFlowCompOutput::CFlowCompOutput(CConfig *config, unsigned short nDim) : CFlowOu requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("PRIMITIVE"); - if (config->GetGrid_Movement()) requestedVolumeFields.emplace_back("GRID_VELOCITY"); + if (config->GetDynamic_Grid()) requestedVolumeFields.emplace_back("GRID_VELOCITY"); nRequestedVolumeFields = requestedVolumeFields.size(); } @@ -279,9 +279,6 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){ Add_CpInverseDesignOutput(config); - /*--- Add combo obj value --- */ - - AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); } void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ @@ -315,7 +312,7 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ } // Grid velocity - if (config->GetGrid_Movement()){ + if (config->GetDynamic_Grid()){ AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); if (nDim == 3 ) @@ -370,30 +367,32 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){ break; } - // Limiter values - AddVolumeOutput("LIMITER_VELOCITY-X", "Limiter_Velocity_x", "LIMITER", "Limiter value of the x-velocity"); - AddVolumeOutput("LIMITER_VELOCITY-Y", "Limiter_Velocity_y", "LIMITER", "Limiter value of the y-velocity"); - if (nDim == 3) { - AddVolumeOutput("LIMITER_VELOCITY-Z", "Limiter_Velocity_z", "LIMITER", "Limiter value of the z-velocity"); + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER && config->GetKind_SlopeLimit_Flow() != VAN_ALBADA_EDGE) { + AddVolumeOutput("LIMITER_VELOCITY-X", "Limiter_Velocity_x", "LIMITER", "Limiter value of the x-velocity"); + AddVolumeOutput("LIMITER_VELOCITY-Y", "Limiter_Velocity_y", "LIMITER", "Limiter value of the y-velocity"); + if (nDim == 3) { + AddVolumeOutput("LIMITER_VELOCITY-Z", "Limiter_Velocity_z", "LIMITER", "Limiter value of the z-velocity"); + } + AddVolumeOutput("LIMITER_PRESSURE", "Limiter_Pressure", "LIMITER", "Limiter value of the pressure"); + AddVolumeOutput("LIMITER_DENSITY", "Limiter_Density", "LIMITER", "Limiter value of the density"); + AddVolumeOutput("LIMITER_ENTHALPY", "Limiter_Enthalpy", "LIMITER", "Limiter value of the enthalpy"); } - AddVolumeOutput("LIMITER_PRESSURE", "Limiter_Pressure", "LIMITER", "Limiter value of the pressure"); - AddVolumeOutput("LIMITER_DENSITY", "Limiter_Density", "LIMITER", "Limiter value of the density"); - AddVolumeOutput("LIMITER_ENTHALPY", "Limiter_Enthalpy", "LIMITER", "Limiter value of the enthalpy"); - switch(config->GetKind_Turb_Model()){ - case SST: case SST_SUST: - AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy"); - AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate"); - break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: - AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of the Spalart-Allmaras variable"); - break; - case NONE: - break; + if (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) { + switch(config->GetKind_Turb_Model()){ + case SST: case SST_SUST: + AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy"); + AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate"); + break; + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: + AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of the Spalart-Allmaras variable"); + break; + case NONE: + break; + } } - // Hybrid RANS-LES if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ AddVolumeOutput("DES_LENGTHSCALE", "DES_LengthScale", "DDES", "DES length scale value"); @@ -469,7 +468,7 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv break; } - if (config->GetGrid_Movement()){ + if (config->GetDynamic_Grid()){ SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel(iPoint)[0]); SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel(iPoint)[1]); if (nDim == 3) @@ -522,26 +521,30 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv break; } - SetVolumeOutputValue("LIMITER_VELOCITY-X", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 1)); - SetVolumeOutputValue("LIMITER_VELOCITY-Y", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 2)); - if (nDim == 3){ - SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER && config->GetKind_SlopeLimit_Flow() != VAN_ALBADA_EDGE) { + SetVolumeOutputValue("LIMITER_VELOCITY-X", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 1)); + SetVolumeOutputValue("LIMITER_VELOCITY-Y", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 2)); + if (nDim == 3){ + SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); + } + SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1)); + SetVolumeOutputValue("LIMITER_DENSITY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+2)); + SetVolumeOutputValue("LIMITER_ENTHALPY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+3)); } - SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1)); - SetVolumeOutputValue("LIMITER_DENSITY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+2)); - SetVolumeOutputValue("LIMITER_ENTHALPY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+3)); - switch(config->GetKind_Turb_Model()){ - case SST: case SST_SUST: - SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); - SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 1)); - break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); - break; - case NONE: - break; + if (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) { + switch(config->GetKind_Turb_Model()){ + case SST: case SST_SUST: + SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); + SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter(iPoint, 1)); + break; + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: + SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); + break; + case NONE: + break; + } } if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ @@ -712,10 +715,6 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol Set_CpInverseDesign(flow_solver, geometry, config); - /*--- Set combo obj value --- */ - - SetHistoryOutputValue("COMBO", flow_solver->GetTotal_ComboObj()); - } bool CFlowCompOutput::SetInit_Residuals(CConfig *config){ diff --git a/SU2_CFD/src/output/CFlowIncOutput.cpp b/SU2_CFD/src/output/CFlowIncOutput.cpp index b39647a11aa9..77f8613b93cc 100644 --- a/SU2_CFD/src/output/CFlowIncOutput.cpp +++ b/SU2_CFD/src/output/CFlowIncOutput.cpp @@ -2,7 +2,7 @@ * \file output_flow_inc.cpp * \brief Main subroutines for incompressible flow output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -39,6 +39,9 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); + streamwisePeriodic = config->GetKind_Streamwise_Periodic(); + streamwisePeriodic_temperature = config->GetStreamwise_Periodic_Temperature(); + /*--- Set the default history fields if nothing is set in the config file ---*/ if (nRequestedHistoryFields == 0){ @@ -60,7 +63,7 @@ CFlowIncOutput::CFlowIncOutput(CConfig *config, unsigned short nDim) : CFlowOutp requestedVolumeFields.emplace_back("COORDINATES"); requestedVolumeFields.emplace_back("SOLUTION"); requestedVolumeFields.emplace_back("PRIMITIVE"); - if (config->GetGrid_Movement()) requestedVolumeFields.emplace_back("GRID_VELOCITY"); + if (config->GetDynamic_Grid()) requestedVolumeFields.emplace_back("GRID_VELOCITY"); nRequestedVolumeFields = requestedVolumeFields.size(); } @@ -219,6 +222,11 @@ void CFlowIncOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("DEFORM_RESIDUAL", "DeformRes", ScreenOutputFormat::FIXED, "DEFORM", "Residual of the linear solver for the mesh deformation"); } + if(streamwisePeriodic) { + AddHistoryOutput("STREAMWISE_MASSFLOW", "SWMassflow", ScreenOutputFormat::FIXED, "STREAMWISE_PERIODIC", "Massflow in streamwise periodic flow"); + AddHistoryOutput("STREAMWISE_DP", "SWDeltaP", ScreenOutputFormat::FIXED, "STREAMWISE_PERIODIC", "Pressure drop in streamwise periodic flow"); + AddHistoryOutput("STREAMWISE_HEAT", "SWHeat", ScreenOutputFormat::FIXED, "STREAMWISE_PERIODIC", "Integrated heat for streamwise periodic flow"); + } /*--- Add analyze surface history fields --- */ AddAnalyzeSurfaceOutput(config); @@ -333,6 +341,12 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv SetHistoryOutputValue("MAX_CFL", flow_solver->GetMax_CFL_Local()); SetHistoryOutputValue("AVG_CFL", flow_solver->GetAvg_CFL_Local()); + if(streamwisePeriodic) { + SetHistoryOutputValue("STREAMWISE_MASSFLOW", flow_solver->GetStreamwisePeriodicValues().Streamwise_Periodic_MassFlow); + SetHistoryOutputValue("STREAMWISE_DP", flow_solver->GetStreamwisePeriodicValues().Streamwise_Periodic_PressureDrop); + SetHistoryOutputValue("STREAMWISE_HEAT", flow_solver->GetStreamwisePeriodicValues().Streamwise_Periodic_IntegratedHeatFlow); + } + /*--- Set the analyse surface history values --- */ SetAnalyzeSurface(flow_solver, geometry, config, false); @@ -383,7 +397,7 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("P1-RAD", "Radiative_Energy(P1)", "SOLUTION", "Radiative Energy"); // Grid velocity - if (config->GetGrid_Movement()){ + if (config->GetDynamic_Grid()){ AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); if (nDim == 3 ) @@ -436,25 +450,28 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ break; } - // Limiter values - AddVolumeOutput("LIMITER_PRESSURE", "Limiter_Pressure", "LIMITER", "Limiter value of the pressure"); - AddVolumeOutput("LIMITER_VELOCITY-X", "Limiter_Velocity_x", "LIMITER", "Limiter value of the x-velocity"); - AddVolumeOutput("LIMITER_VELOCITY-Y", "Limiter_Velocity_y", "LIMITER", "Limiter value of the y-velocity"); - if (nDim == 3) - AddVolumeOutput("LIMITER_VELOCITY-Z", "Limiter_Velocity_z", "LIMITER", "Limiter value of the z-velocity"); - AddVolumeOutput("LIMITER_TEMPERATURE", "Limiter_Temperature", "LIMITER", "Limiter value of the temperature"); + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER && config->GetKind_SlopeLimit_Flow() != VAN_ALBADA_EDGE) { + AddVolumeOutput("LIMITER_PRESSURE", "Limiter_Pressure", "LIMITER", "Limiter value of the pressure"); + AddVolumeOutput("LIMITER_VELOCITY-X", "Limiter_Velocity_x", "LIMITER", "Limiter value of the x-velocity"); + AddVolumeOutput("LIMITER_VELOCITY-Y", "Limiter_Velocity_y", "LIMITER", "Limiter value of the y-velocity"); + if (nDim == 3) + AddVolumeOutput("LIMITER_VELOCITY-Z", "Limiter_Velocity_z", "LIMITER", "Limiter value of the z-velocity"); + AddVolumeOutput("LIMITER_TEMPERATURE", "Limiter_Temperature", "LIMITER", "Limiter value of the temperature"); + } - switch(config->GetKind_Turb_Model()){ - case SST: case SST_SUST: - AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy."); - AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate."); - break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: - AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of Spalart–Allmaras variable."); - break; - case NONE: - break; + if (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) { + switch(config->GetKind_Turb_Model()){ + case SST: case SST_SUST: + AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy."); + AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate."); + break; + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: + AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of Spalart–Allmaras variable."); + break; + case NONE: + break; + } } // Hybrid RANS-LES @@ -484,6 +501,13 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("ASPECT_RATIO", "Aspect_Ratio", "MESH_QUALITY", "CV Face Area Aspect Ratio"); AddVolumeOutput("VOLUME_RATIO", "Volume_Ratio", "MESH_QUALITY", "CV Sub-Volume Ratio"); + // Streamwise Periodicity + if(streamwisePeriodic) { + AddVolumeOutput("RECOVERED_PRESSURE", "Recovered_Pressure", "SOLUTION", "Recovered physical pressure"); + if (heat && streamwisePeriodic_temperature) + AddVolumeOutput("RECOVERED_TEMPERATURE", "Recovered_Temperature", "SOLUTION", "Recovered physical temperature"); + } + // MPI-Rank AddVolumeOutput("RANK", "Rank", "MPI", "Rank of the MPI-partition"); } @@ -537,7 +561,7 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve SetVolumeOutputValue("P1-RAD", iPoint, Node_Rad->GetSolution(iPoint,0)); } - if (config->GetGrid_Movement()){ + if (config->GetDynamic_Grid()){ SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel(iPoint)[0]); SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel(iPoint)[1]); if (nDim == 3) @@ -587,27 +611,31 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve break; } - SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 0)); - SetVolumeOutputValue("LIMITER_VELOCITY-X", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 1)); - SetVolumeOutputValue("LIMITER_VELOCITY-Y", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 2)); - if (nDim == 3){ - SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); - SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 4)); - } else { - SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER && config->GetKind_SlopeLimit_Flow() != VAN_ALBADA_EDGE) { + SetVolumeOutputValue("LIMITER_PRESSURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 0)); + SetVolumeOutputValue("LIMITER_VELOCITY-X", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 1)); + SetVolumeOutputValue("LIMITER_VELOCITY-Y", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 2)); + if (nDim == 3){ + SetVolumeOutputValue("LIMITER_VELOCITY-Z", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); + SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 4)); + } else { + SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); + } } - switch(config->GetKind_Turb_Model()){ - case SST: case SST_SUST: - SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); - SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 1)); - break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); - break; - case NONE: - break; + if (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) { + switch(config->GetKind_Turb_Model()){ + case SST: case SST_SUST: + SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); + SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter(iPoint, 1)); + break; + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: + SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); + break; + case NONE: + break; + } } if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){ @@ -630,6 +658,13 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve SetVolumeOutputValue("Q_CRITERION", iPoint, GetQ_Criterion(&(Node_Flow->GetGradient_Primitive(iPoint)[1]))); } + // Streamwise Periodicity + if(streamwisePeriodic) { + SetVolumeOutputValue("RECOVERED_PRESSURE", iPoint, Node_Flow->GetStreamwise_Periodic_RecoveredPressure(iPoint)); + if (heat && streamwisePeriodic_temperature) + SetVolumeOutputValue("RECOVERED_TEMPERATURE", iPoint, Node_Flow->GetStreamwise_Periodic_RecoveredTemperature(iPoint)); + } + // Mesh quality metrics if (config->GetWrt_MeshQuality()) { SetVolumeOutputValue("ORTHOGONALITY", iPoint, geometry->Orthogonality[iPoint]); diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index e7c82a93efbb..38d62e744154 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -2,7 +2,7 @@ * \file output_flow.cpp * \brief Main subroutines for compressible flow output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -114,38 +114,37 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi unsigned short iDim, iMarker, iMarker_Analyze; unsigned long iVertex, iPoint; su2double Mach = 0.0, Pressure, Temperature = 0.0, TotalPressure = 0.0, TotalTemperature = 0.0, - Enthalpy, Velocity[3] = {}, TangVel[3], Velocity2, MassFlow, Density, Area, + Enthalpy, Velocity[3] = {0.0}, TangVel[3], Vector[3], Velocity2, MassFlow, Density, Area, AxiFactor = 1.0, SoundSpeed, Vn, Vn2, Vtang2, Weight = 1.0; - su2double Gas_Constant = config->GetGas_ConstantND(); - su2double Gamma = config->GetGamma(); - unsigned short nMarker = config->GetnMarker_All(); - unsigned short nDim = geometry->GetnDim(); - unsigned short Kind_Average = config->GetKind_Average(); - - bool compressible = config->GetKind_Regime() == COMPRESSIBLE; - bool incompressible = config->GetKind_Regime() == INCOMPRESSIBLE; - bool energy = config->GetEnergy_Equation(); - - - bool axisymmetric = config->GetAxisymmetric(); - unsigned short nMarker_Analyze = config->GetnMarker_Analyze(); - - su2double *Vector = new su2double[nDim]; - su2double *Surface_MassFlow = new su2double[nMarker]; - su2double *Surface_Mach = new su2double[nMarker]; - su2double *Surface_Temperature = new su2double[nMarker]; - su2double *Surface_Density = new su2double[nMarker]; - su2double *Surface_Enthalpy = new su2double[nMarker]; - su2double *Surface_NormalVelocity = new su2double[nMarker]; - su2double *Surface_StreamVelocity2 = new su2double[nMarker]; - su2double *Surface_TransvVelocity2 = new su2double[nMarker]; - su2double *Surface_Pressure = new su2double[nMarker]; - su2double *Surface_TotalTemperature = new su2double[nMarker]; - su2double *Surface_TotalPressure = new su2double[nMarker]; - su2double *Surface_VelocityIdeal = new su2double[nMarker]; - su2double *Surface_Area = new su2double[nMarker]; - su2double *Surface_MassFlow_Abs = new su2double[nMarker]; + const su2double Gas_Constant = config->GetGas_ConstantND(); + const su2double Gamma = config->GetGamma(); + const unsigned short nMarker = config->GetnMarker_All(); + const unsigned short nDim = geometry->GetnDim(); + const unsigned short Kind_Average = config->GetKind_Average(); + + const bool compressible = config->GetKind_Regime() == COMPRESSIBLE; + const bool incompressible = config->GetKind_Regime() == INCOMPRESSIBLE; + const bool energy = config->GetEnergy_Equation(); + const bool streamwisePeriodic = config->GetKind_Streamwise_Periodic(); + + const bool axisymmetric = config->GetAxisymmetric(); + const unsigned short nMarker_Analyze = config->GetnMarker_Analyze(); + + vector Surface_MassFlow (nMarker,0.0); + vector Surface_Mach (nMarker,0.0); + vector Surface_Temperature (nMarker,0.0); + vector Surface_Density (nMarker,0.0); + vector Surface_Enthalpy (nMarker,0.0); + vector Surface_NormalVelocity (nMarker,0.0); + vector Surface_StreamVelocity2 (nMarker,0.0); + vector Surface_TransvVelocity2 (nMarker,0.0); + vector Surface_Pressure (nMarker,0.0); + vector Surface_TotalTemperature (nMarker,0.0); + vector Surface_TotalPressure (nMarker,0.0); + vector Surface_VelocityIdeal (nMarker,0.0); + vector Surface_Area (nMarker,0.0); + vector Surface_MassFlow_Abs (nMarker,0.0); su2double Tot_Surface_MassFlow = 0.0; su2double Tot_Surface_Mach = 0.0; @@ -166,21 +165,6 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi for (iMarker = 0; iMarker < nMarker; iMarker++) { - Surface_MassFlow[iMarker] = 0.0; - Surface_Mach[iMarker] = 0.0; - Surface_Temperature[iMarker] = 0.0; - Surface_Density[iMarker] = 0.0; - Surface_Enthalpy[iMarker] = 0.0; - Surface_NormalVelocity[iMarker] = 0.0; - Surface_StreamVelocity2[iMarker] = 0.0; - Surface_TransvVelocity2[iMarker] = 0.0; - Surface_Pressure[iMarker] = 0.0; - Surface_TotalTemperature[iMarker] = 0.0; - Surface_TotalPressure[iMarker] = 0.0; - Surface_VelocityIdeal[iMarker] = 0.0; - Surface_Area[iMarker] = 0.0; - Surface_MassFlow_Abs[iMarker] = 0.0; - if (config->GetMarker_All_Analyze(iMarker) == YES) { for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { @@ -224,6 +208,8 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi if (AxiFactor == 0.0) Vn = 0.0; else Vn /= Area; Vn2 = Vn * Vn; Pressure = solver->GetNodes()->GetPressure(iPoint); + /*--- Use recovered pressure here as pressure difference between in and outlet is zero otherwise ---*/ + if(streamwisePeriodic) Pressure = solver->GetNodes()->GetStreamwise_Periodic_RecoveredPressure(iPoint); SoundSpeed = solver->GetNodes()->GetSoundSpeed(iPoint); for (iDim = 0; iDim < nDim; iDim++) { @@ -285,68 +271,35 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi /*--- Copy to the appropriate structure ---*/ - su2double *Surface_MassFlow_Local = new su2double [nMarker_Analyze]; - su2double *Surface_Mach_Local = new su2double [nMarker_Analyze]; - su2double *Surface_Temperature_Local = new su2double [nMarker_Analyze]; - su2double *Surface_Density_Local = new su2double [nMarker_Analyze]; - su2double *Surface_Enthalpy_Local = new su2double [nMarker_Analyze]; - su2double *Surface_NormalVelocity_Local = new su2double [nMarker_Analyze]; - su2double *Surface_StreamVelocity2_Local = new su2double [nMarker_Analyze]; - su2double *Surface_TransvVelocity2_Local = new su2double [nMarker_Analyze]; - su2double *Surface_Pressure_Local = new su2double [nMarker_Analyze]; - su2double *Surface_TotalTemperature_Local = new su2double [nMarker_Analyze]; - su2double *Surface_TotalPressure_Local = new su2double [nMarker_Analyze]; - su2double *Surface_Area_Local = new su2double [nMarker_Analyze]; - su2double *Surface_MassFlow_Abs_Local = new su2double [nMarker_Analyze]; - - su2double *Surface_MassFlow_Total = new su2double [nMarker_Analyze]; - su2double *Surface_Mach_Total = new su2double [nMarker_Analyze]; - su2double *Surface_Temperature_Total = new su2double [nMarker_Analyze]; - su2double *Surface_Density_Total = new su2double [nMarker_Analyze]; - su2double *Surface_Enthalpy_Total = new su2double [nMarker_Analyze]; - su2double *Surface_NormalVelocity_Total = new su2double [nMarker_Analyze]; - su2double *Surface_StreamVelocity2_Total = new su2double [nMarker_Analyze]; - su2double *Surface_TransvVelocity2_Total = new su2double [nMarker_Analyze]; - su2double *Surface_Pressure_Total = new su2double [nMarker_Analyze]; - su2double *Surface_TotalTemperature_Total = new su2double [nMarker_Analyze]; - su2double *Surface_TotalPressure_Total = new su2double [nMarker_Analyze]; - su2double *Surface_Area_Total = new su2double [nMarker_Analyze]; - su2double *Surface_MassFlow_Abs_Total = new su2double [nMarker_Analyze]; - - su2double *Surface_MomentumDistortion_Total = new su2double [nMarker_Analyze]; - - for (iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { - Surface_MassFlow_Local[iMarker_Analyze] = 0.0; - Surface_Mach_Local[iMarker_Analyze] = 0.0; - Surface_Temperature_Local[iMarker_Analyze] = 0.0; - Surface_Density_Local[iMarker_Analyze] = 0.0; - Surface_Enthalpy_Local[iMarker_Analyze] = 0.0; - Surface_NormalVelocity_Local[iMarker_Analyze] = 0.0; - Surface_StreamVelocity2_Local[iMarker_Analyze] = 0.0; - Surface_TransvVelocity2_Local[iMarker_Analyze] = 0.0; - Surface_Pressure_Local[iMarker_Analyze] = 0.0; - Surface_TotalTemperature_Local[iMarker_Analyze] = 0.0; - Surface_TotalPressure_Local[iMarker_Analyze] = 0.0; - Surface_Area_Local[iMarker_Analyze] = 0.0; - Surface_MassFlow_Abs_Local[iMarker_Analyze] = 0.0; - - Surface_MassFlow_Total[iMarker_Analyze] = 0.0; - Surface_Mach_Total[iMarker_Analyze] = 0.0; - Surface_Temperature_Total[iMarker_Analyze] = 0.0; - Surface_Density_Total[iMarker_Analyze] = 0.0; - Surface_Enthalpy_Total[iMarker_Analyze] = 0.0; - Surface_NormalVelocity_Total[iMarker_Analyze] = 0.0; - Surface_StreamVelocity2_Total[iMarker_Analyze] = 0.0; - Surface_TransvVelocity2_Total[iMarker_Analyze] = 0.0; - Surface_Pressure_Total[iMarker_Analyze] = 0.0; - Surface_TotalTemperature_Total[iMarker_Analyze] = 0.0; - Surface_TotalPressure_Total[iMarker_Analyze] = 0.0; - Surface_Area_Total[iMarker_Analyze] = 0.0; - Surface_MassFlow_Abs_Total[iMarker_Analyze] = 0.0; - - Surface_MomentumDistortion_Total[iMarker_Analyze] = 0.0; - - } + vector Surface_MassFlow_Local (nMarker_Analyze,0.0); + vector Surface_Mach_Local (nMarker_Analyze,0.0); + vector Surface_Temperature_Local (nMarker_Analyze,0.0); + vector Surface_Density_Local (nMarker_Analyze,0.0); + vector Surface_Enthalpy_Local (nMarker_Analyze,0.0); + vector Surface_NormalVelocity_Local (nMarker_Analyze,0.0); + vector Surface_StreamVelocity2_Local (nMarker_Analyze,0.0); + vector Surface_TransvVelocity2_Local (nMarker_Analyze,0.0); + vector Surface_Pressure_Local (nMarker_Analyze,0.0); + vector Surface_TotalTemperature_Local (nMarker_Analyze,0.0); + vector Surface_TotalPressure_Local (nMarker_Analyze,0.0); + vector Surface_Area_Local (nMarker_Analyze,0.0); + vector Surface_MassFlow_Abs_Local (nMarker_Analyze,0.0); + + vector Surface_MassFlow_Total (nMarker_Analyze,0.0); + vector Surface_Mach_Total (nMarker_Analyze,0.0); + vector Surface_Temperature_Total (nMarker_Analyze,0.0); + vector Surface_Density_Total (nMarker_Analyze,0.0); + vector Surface_Enthalpy_Total (nMarker_Analyze,0.0); + vector Surface_NormalVelocity_Total (nMarker_Analyze,0.0); + vector Surface_StreamVelocity2_Total (nMarker_Analyze,0.0); + vector Surface_TransvVelocity2_Total (nMarker_Analyze,0.0); + vector Surface_Pressure_Total (nMarker_Analyze,0.0); + vector Surface_TotalTemperature_Total (nMarker_Analyze,0.0); + vector Surface_TotalPressure_Total (nMarker_Analyze,0.0); + vector Surface_Area_Total (nMarker_Analyze,0.0); + vector Surface_MassFlow_Abs_Total (nMarker_Analyze,0.0); + + vector Surface_MomentumDistortion_Total (nMarker_Analyze,0.0); /*--- Compute the numerical fan face Mach number, mach number, temperature and the total area ---*/ @@ -380,41 +333,23 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi } -#ifdef HAVE_MPI - - SU2_MPI::Allreduce(Surface_MassFlow_Local, Surface_MassFlow_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Mach_Local, Surface_Mach_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Temperature_Local, Surface_Temperature_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Density_Local, Surface_Density_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Enthalpy_Local, Surface_Enthalpy_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_NormalVelocity_Local, Surface_NormalVelocity_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_StreamVelocity2_Local, Surface_StreamVelocity2_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_TransvVelocity2_Local, Surface_TransvVelocity2_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Pressure_Local, Surface_Pressure_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_TotalTemperature_Local, Surface_TotalTemperature_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_TotalPressure_Local, Surface_TotalPressure_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Area_Local, Surface_Area_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_MassFlow_Abs_Local, Surface_MassFlow_Abs_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - -#else - - for (iMarker_Analyze = 0; iMarker_Analyze < nMarker_Analyze; iMarker_Analyze++) { - Surface_MassFlow_Total[iMarker_Analyze] = Surface_MassFlow_Local[iMarker_Analyze]; - Surface_Mach_Total[iMarker_Analyze] = Surface_Mach_Local[iMarker_Analyze]; - Surface_Temperature_Total[iMarker_Analyze] = Surface_Temperature_Local[iMarker_Analyze]; - Surface_Density_Total[iMarker_Analyze] = Surface_Density_Local[iMarker_Analyze]; - Surface_Enthalpy_Total[iMarker_Analyze] = Surface_Enthalpy_Local[iMarker_Analyze]; - Surface_NormalVelocity_Total[iMarker_Analyze] = Surface_NormalVelocity_Local[iMarker_Analyze]; - Surface_StreamVelocity2_Total[iMarker_Analyze] = Surface_StreamVelocity2_Local[iMarker_Analyze]; - Surface_TransvVelocity2_Total[iMarker_Analyze] = Surface_TransvVelocity2_Local[iMarker_Analyze]; - Surface_Pressure_Total[iMarker_Analyze] = Surface_Pressure_Local[iMarker_Analyze]; - Surface_TotalTemperature_Total[iMarker_Analyze] = Surface_TotalTemperature_Local[iMarker_Analyze]; - Surface_TotalPressure_Total[iMarker_Analyze] = Surface_TotalPressure_Local[iMarker_Analyze]; - Surface_Area_Total[iMarker_Analyze] = Surface_Area_Local[iMarker_Analyze]; - Surface_MassFlow_Abs_Total[iMarker_Analyze] = Surface_MassFlow_Abs_Local[iMarker_Analyze]; - } - -#endif + auto Allreduce = [](const vector& src, vector& dst) { + SU2_MPI::Allreduce(src.data(), dst.data(), src.size(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + }; + + Allreduce(Surface_MassFlow_Local, Surface_MassFlow_Total); + Allreduce(Surface_Mach_Local, Surface_Mach_Total); + Allreduce(Surface_Temperature_Local, Surface_Temperature_Total); + Allreduce(Surface_Density_Local, Surface_Density_Total); + Allreduce(Surface_Enthalpy_Local, Surface_Enthalpy_Total); + Allreduce(Surface_NormalVelocity_Local, Surface_NormalVelocity_Total); + Allreduce(Surface_StreamVelocity2_Local, Surface_StreamVelocity2_Total); + Allreduce(Surface_TransvVelocity2_Local, Surface_TransvVelocity2_Total); + Allreduce(Surface_Pressure_Local, Surface_Pressure_Total); + Allreduce(Surface_TotalTemperature_Local, Surface_TotalTemperature_Total); + Allreduce(Surface_TotalPressure_Local, Surface_TotalPressure_Total); + Allreduce(Surface_Area_Local, Surface_Area_Total); + Allreduce(Surface_MassFlow_Abs_Local, Surface_MassFlow_Abs_Total); /*--- Compute the value of Surface_Area_Total, and Surface_Pressure_Total, and set the value in the config structure for future use ---*/ @@ -559,14 +494,14 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi SetHistoryOutputValue("SURFACE_STATIC_PRESSURE", Tot_Surface_Pressure); SetHistoryOutputValue("AVG_DENSITY", Tot_Surface_Density); SetHistoryOutputValue("AVG_ENTHALPY", Tot_Surface_Enthalpy); - SetHistoryOutputValue("AVG_NORMALVEL", Tot_Surface_Enthalpy); + SetHistoryOutputValue("AVG_NORMALVEL", Tot_Surface_NormalVelocity); SetHistoryOutputValue("SURFACE_UNIFORMITY", Tot_Surface_StreamVelocity2); SetHistoryOutputValue("SURFACE_SECONDARY", Tot_Surface_TransvVelocity2); SetHistoryOutputValue("SURFACE_MOM_DISTORTION", Tot_Momentum_Distortion); SetHistoryOutputValue("SURFACE_SECOND_OVER_UNIFORM", Tot_SecondOverUniformity); SetHistoryOutputValue("SURFACE_TOTAL_TEMPERATURE", Tot_Surface_TotalTemperature); SetHistoryOutputValue("SURFACE_TOTAL_PRESSURE", Tot_Surface_TotalPressure); - SetHistoryOutputValue("SURFACE_PRESSURE_DROP", Tot_Surface_PressureDrop); + SetHistoryOutputValue("SURFACE_PRESSURE_DROP", Tot_Surface_PressureDrop); if ((rank == MASTER_NODE) && !config->GetDiscrete_Adjoint() && output) { @@ -649,51 +584,6 @@ void CFlowOutput::SetAnalyzeSurface(CSolver *solver, CGeometry *geometry, CConfi } - delete [] Surface_MassFlow_Local; - delete [] Surface_Mach_Local; - delete [] Surface_Temperature_Local; - delete [] Surface_Density_Local; - delete [] Surface_Enthalpy_Local; - delete [] Surface_NormalVelocity_Local; - delete [] Surface_StreamVelocity2_Local; - delete [] Surface_TransvVelocity2_Local; - delete [] Surface_Pressure_Local; - delete [] Surface_TotalTemperature_Local; - delete [] Surface_TotalPressure_Local; - delete [] Surface_Area_Local; - delete [] Surface_MassFlow_Abs_Local; - - delete [] Surface_MassFlow_Total; - delete [] Surface_Mach_Total; - delete [] Surface_Temperature_Total; - delete [] Surface_Density_Total; - delete [] Surface_Enthalpy_Total; - delete [] Surface_NormalVelocity_Total; - delete [] Surface_StreamVelocity2_Total; - delete [] Surface_TransvVelocity2_Total; - delete [] Surface_Pressure_Total; - delete [] Surface_TotalTemperature_Total; - delete [] Surface_TotalPressure_Total; - delete [] Surface_Area_Total; - delete [] Surface_MassFlow_Abs_Total; - delete [] Surface_MomentumDistortion_Total; - - delete [] Surface_MassFlow; - delete [] Surface_Mach; - delete [] Surface_Temperature; - delete [] Surface_Density; - delete [] Surface_Enthalpy; - delete [] Surface_NormalVelocity; - delete [] Surface_StreamVelocity2; - delete [] Surface_TransvVelocity2; - delete [] Surface_Pressure; - delete [] Surface_TotalTemperature; - delete [] Surface_TotalPressure; - delete [] Surface_Area; - delete [] Vector; - delete [] Surface_VelocityIdeal; - delete [] Surface_MassFlow_Abs; - std::cout << std::resetiosflags(std::cout.flags()); } @@ -751,6 +641,8 @@ void CFlowOutput::AddAerodynamicCoefficients(CConfig *config){ /// DESCRIPTION: Angle of attack AddHistoryOutput("AOA", "AoA", ScreenOutputFormat::FIXED, "AOA", "Angle of attack"); + + AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); } void CFlowOutput::SetAerodynamicCoefficients(CConfig *config, CSolver *flow_solver){ @@ -793,6 +685,8 @@ void CFlowOutput::SetAerodynamicCoefficients(CConfig *config, CSolver *flow_solv } SetHistoryOutputValue("AOA", config->GetAoA()); + + SetHistoryOutputValue("COMBO", flow_solver->GetTotal_ComboObj()); } void CFlowOutput::SetRotatingFrameCoefficients(CConfig *config, CSolver *flow_solver) { @@ -831,7 +725,7 @@ void CFlowOutput::Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CCon if (!(Surface_file.fail())) { nPointLocal = geometry->GetnPoint(); - SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); Point2Vertex = new unsigned long[nPointGlobal][2]; PointInDomain = new bool[nPointGlobal]; @@ -918,11 +812,8 @@ void CFlowOutput::Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CCon } } -#ifdef HAVE_MPI su2double MyPressDiff = PressDiff; - SU2_MPI::Allreduce(&MyPressDiff, &PressDiff, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); -#endif - + SU2_MPI::Allreduce(&MyPressDiff, &PressDiff, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } /*--- Update the total Cp difference coeffient ---*/ @@ -1022,7 +913,7 @@ void CFlowOutput::WriteMetaData(CConfig *config){ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSolver **solver_container){ - unsigned short iDim, iMarker_Monitoring; + unsigned short iMarker_Monitoring; const bool compressible = (config->GetKind_Regime() == COMPRESSIBLE); const bool incompressible = (config->GetKind_Regime() == INCOMPRESSIBLE); @@ -1368,7 +1259,7 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo Breakdown_file << "\n" <<"-------------------------------------------------------------------------" << "\n"; Breakdown_file << "| ___ _ _ ___ |" << "\n"; - Breakdown_file << "| / __| | | |_ ) Release 7.1.0 \"Blackbird\" |" << "\n"; + Breakdown_file << "| / __| | | |_ ) Release 7.1.1 \"Blackbird\" |" << "\n"; Breakdown_file << "| \\__ \\ |_| |/ / |" << "\n"; Breakdown_file << "| |___/\\___//___| Suite (Computational Fluid Dynamics Code) |" << "\n"; Breakdown_file << "| |" << "\n"; @@ -2144,26 +2035,8 @@ void CFlowOutput::WriteForcesBreakdown(CConfig *config, CGeometry *geometry, CSo /*--- Reference area and force factors. ---*/ - su2double RefDensity, RefArea, RefVel, Factor, Ref; - RefArea = config->GetRefArea(); - if (compressible) { - RefDensity = solver_container[FLOW_SOL]->GetDensity_Inf(); - RefVel = solver_container[FLOW_SOL]->GetModVelocity_Inf(); - } else { - if ((config->GetRef_Inc_NonDim() == DIMENSIONAL) || - (config->GetRef_Inc_NonDim() == INITIAL_VALUES)) { - RefDensity = solver_container[FLOW_SOL]->GetDensity_Inf(); - RefVel = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - RefVel += solver_container[FLOW_SOL]->GetVelocity_Inf(iDim)*solver_container[FLOW_SOL]->GetVelocity_Inf(iDim); - RefVel = sqrt(RefVel); - } else { - RefDensity = config->GetInc_Density_Ref(); - RefVel = config->GetInc_Velocity_Ref(); - } - } - Factor = (0.5*RefDensity*RefArea*RefVel*RefVel); - Ref = config->GetDensity_Ref() * config->GetVelocity_Ref() * config->GetVelocity_Ref() * 1.0 * 1.0; + const su2double Factor = solver_container[FLOW_SOL]->GetAeroCoeffsReferenceForce(); + const su2double Ref = config->GetDensity_Ref() * pow(config->GetVelocity_Ref(),2); Breakdown_file << "NOTE: Multiply forces by the non-dimensional factor: " << Factor << ", and the reference factor: " << Ref << "\n"; Breakdown_file << "to obtain the dimensional force." << "\n" << "\n"; diff --git a/SU2_CFD/src/output/CHeatOutput.cpp b/SU2_CFD/src/output/CHeatOutput.cpp index 857d721011a8..55aa37097d1a 100644 --- a/SU2_CFD/src/output/CHeatOutput.cpp +++ b/SU2_CFD/src/output/CHeatOutput.cpp @@ -2,7 +2,7 @@ * \file output_heat.cpp * \brief Main subroutines for the heat solver output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CMeshOutput.cpp b/SU2_CFD/src/output/CMeshOutput.cpp index 03b067b782cc..0bb79e6ac3bd 100644 --- a/SU2_CFD/src/output/CMeshOutput.cpp +++ b/SU2_CFD/src/output/CMeshOutput.cpp @@ -2,7 +2,7 @@ * \file output_mesh.cpp * \brief Main subroutines for the heat solver output * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CMultizoneOutput.cpp b/SU2_CFD/src/output/CMultizoneOutput.cpp index 0c492df46598..8d182ef1dc57 100644 --- a/SU2_CFD/src/output/CMultizoneOutput.cpp +++ b/SU2_CFD/src/output/CMultizoneOutput.cpp @@ -2,7 +2,7 @@ * \file CMultizoneOutput.cpp * \brief Main subroutines for multizone output * \author R. Sanchez, T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/CNEMOCompOutput.cpp b/SU2_CFD/src/output/CNEMOCompOutput.cpp index 763f9006af56..11f9b6be62a1 100644 --- a/SU2_CFD/src/output/CNEMOCompOutput.cpp +++ b/SU2_CFD/src/output/CNEMOCompOutput.cpp @@ -246,7 +246,9 @@ void CNEMOCompOutput::SetHistoryOutputFields(CConfig *config){ AddHistoryOutput("MAXIMUM_HEATFLUX", "maxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total maximum heatflux on all surfaces set with MARKER_MONITORING.", HistoryFieldType::COEFFICIENT); /// END_GROUP - AddHistoryOutput("CFL_NUMBER", "CFL number", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current value of the CFL number"); + AddHistoryOutput("MIN_CFL", "Min CFL", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current minimum of the local CFL numbers"); + AddHistoryOutput("MAX_CFL", "Max CFL", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current maximum of the local CFL numbers"); + AddHistoryOutput("AVG_CFL", "Avg CFL", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current average of the local CFL numbers"); /// /// BEGIN_GROUP: FIXED_CL, DESCRIPTION: Relevant outputs for the Fixed CL mode if (config->GetFixed_CL_Mode()){ @@ -279,9 +281,6 @@ void CNEMOCompOutput::SetHistoryOutputFields(CConfig *config){ Add_CpInverseDesignOutput(config); - /*--- Add combo obj value --- */ - - AddHistoryOutput("COMBO", "ComboObj", ScreenOutputFormat::SCIENTIFIC, "COMBO", "Combined obj. function value.", HistoryFieldType::COEFFICIENT); } void CNEMOCompOutput::SetVolumeOutputFields(CConfig *config){ @@ -328,7 +327,7 @@ void CNEMOCompOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("MASSFRAC_" + std::to_string(iSpecies), "MassFrac_" + std::to_string(iSpecies), "AUXILIARY", "MassFrac_" + std::to_string(iSpecies)); // Grid velocity - if (config->GetGrid_Movement()){ + if (config->GetDynamic_Grid()){ AddVolumeOutput("GRID_VELOCITY-X", "Grid_Velocity_x", "GRID_VELOCITY", "x-component of the grid velocity vector"); AddVolumeOutput("GRID_VELOCITY-Y", "Grid_Velocity_y", "GRID_VELOCITY", "y-component of the grid velocity vector"); if (nDim == 3 ) @@ -391,17 +390,19 @@ void CNEMOCompOutput::SetVolumeOutputFields(CConfig *config){ AddVolumeOutput("LIMITER_MOMENTUM-Z", "Limiter_Momentum_z", "LIMITER", "Limiter value of the z-momentum"); AddVolumeOutput("LIMITER_ENERGY", "Limiter_Energy", "LIMITER", "Limiter value of the energy"); - switch(config->GetKind_Turb_Model()){ - case SST: case SST_SUST: - AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy"); - AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate"); - break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: - AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of the Spalart-Allmaras variable"); - break; - case NONE: - break; + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) { + switch(config->GetKind_Turb_Model()){ + case SST: case SST_SUST: + AddVolumeOutput("LIMITER_TKE", "Limiter_TKE", "LIMITER", "Limiter value of turb. kinetic energy"); + AddVolumeOutput("LIMITER_DISSIPATION", "Limiter_Omega", "LIMITER", "Limiter value of dissipation rate"); + break; + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: + AddVolumeOutput("LIMITER_NU_TILDE", "Limiter_Nu_Tilde", "LIMITER", "Limiter value of the Spalart-Allmaras variable"); + break; + case NONE: + break; + } } // Roe Low Dissipation @@ -471,7 +472,7 @@ void CNEMOCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv break; } - if (config->GetGrid_Movement()){ + if (config->GetDynamic_Grid()){ SetVolumeOutputValue("GRID_VELOCITY-X", iPoint, Node_Geo->GetGridVel(iPoint)[0]); SetVolumeOutputValue("GRID_VELOCITY-Y", iPoint, Node_Geo->GetGridVel(iPoint)[1]); if (nDim == 3) @@ -535,17 +536,19 @@ void CNEMOCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv SetVolumeOutputValue("LIMITER_ENERGY", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, 3)); } - switch(config->GetKind_Turb_Model()){ - case SST: case SST_SUST: - SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); - SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 1)); - break; - case SA: case SA_COMP: case SA_E: - case SA_E_COMP: case SA_NEG: - SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter_Primitive(iPoint, 0)); - break; - case NONE: - break; + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) { + switch(config->GetKind_Turb_Model()){ + case SST: case SST_SUST: + SetVolumeOutputValue("LIMITER_TKE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); + SetVolumeOutputValue("LIMITER_DISSIPATION", iPoint, Node_Turb->GetLimiter(iPoint, 1)); + break; + case SA: case SA_COMP: case SA_E: + case SA_E_COMP: case SA_NEG: + SetVolumeOutputValue("LIMITER_NU_TILDE", iPoint, Node_Turb->GetLimiter(iPoint, 0)); + break; + case NONE: + break; + } } if (config->GetKind_RoeLowDiss() != NO_ROELOWDISS){ @@ -650,7 +653,9 @@ void CNEMOCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol SetHistoryOutputValue("TOTAL_HEATFLUX", NEMO_solver->GetTotal_HeatFlux()); SetHistoryOutputValue("MAXIMUM_HEATFLUX", NEMO_solver->GetTotal_MaxHeatFlux()); - SetHistoryOutputValue("CFL_NUMBER", config->GetCFL(MESH_0)); + SetHistoryOutputValue("MIN_CFL", NEMO_solver->GetMin_CFL_Local()); + SetHistoryOutputValue("MAX_CFL", NEMO_solver->GetMax_CFL_Local()); + SetHistoryOutputValue("AVG_CFL", NEMO_solver->GetAvg_CFL_Local()); SetHistoryOutputValue("LINSOL_ITER", NEMO_solver->GetIterLinSolver()); SetHistoryOutputValue("LINSOL_RESIDUAL", log10(NEMO_solver->GetResLinSolver())); @@ -682,10 +687,6 @@ void CNEMOCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol Set_CpInverseDesign(NEMO_solver, geometry, config); - /*--- Set combo obj value --- */ - - SetHistoryOutputValue("COMBO", NEMO_solver->GetTotal_ComboObj()); - } bool CNEMOCompOutput::SetInit_Residuals(CConfig *config){ diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 541489766c0c..d8959465121e 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -2,7 +2,7 @@ * \file output_structure.cpp * \brief Main subroutines for output solver information * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -549,7 +549,7 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, unsigned short f /*--- Only sort if there is at least one processor that has this marker ---*/ int globalMarkerSize = 0, localMarkerSize = marker.size(); - SU2_MPI::Allreduce(&localMarkerSize, &globalMarkerSize, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&localMarkerSize, &globalMarkerSize, 1, MPI_INT, MPI_SUM, SU2_MPI::GetComm()); if (globalMarkerSize > 0){ @@ -912,34 +912,9 @@ bool COutput::Convergence_Monitoring(CConfig *config, unsigned long Iteration) { /*--- Apply the same convergence criteria to all the processors ---*/ -#ifdef HAVE_MPI - - unsigned short *sbuf_conv = NULL, *rbuf_conv = NULL; - sbuf_conv = new unsigned short[1]; sbuf_conv[0] = 0; - rbuf_conv = new unsigned short[1]; rbuf_conv[0] = 0; - - /*--- Convergence criteria ---*/ - - sbuf_conv[0] = convergence; - SU2_MPI::Reduce(sbuf_conv, rbuf_conv, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); - - /*-- Compute global convergence criteria in the master node --*/ - - sbuf_conv[0] = 0; - if (rank == MASTER_NODE) { - if (rbuf_conv[0] == size) sbuf_conv[0] = 1; - else sbuf_conv[0] = 0; - } - - SU2_MPI::Bcast(sbuf_conv, 1, MPI_UNSIGNED_SHORT, MASTER_NODE, MPI_COMM_WORLD); - - if (sbuf_conv[0] == 1) { convergence = true; } - else { convergence = false; } - - delete [] sbuf_conv; - delete [] rbuf_conv; - -#endif + unsigned short local = convergence, global = 0; + SU2_MPI::Allreduce(&local, &global, 1, MPI_UNSIGNED_SHORT, MPI_MAX, SU2_MPI::GetComm()); + convergence = global > 0; return convergence; } @@ -1149,49 +1124,49 @@ void COutput::SetScreen_Output(CConfig *config) { void COutput::PreprocessHistoryOutput(CConfig *config, bool wrt){ - noWriting = !wrt; - - /*--- Set the common output fields ---*/ + noWriting = !wrt; - SetCommonHistoryFields(config); + /*--- Set the common output fields ---*/ - /*--- Set the History output fields using a virtual function call to the child implementation ---*/ + SetCommonHistoryFields(config); - SetHistoryOutputFields(config); + /*--- Set the History output fields using a virtual function call to the child implementation ---*/ - /*--- Postprocess the history fields. Creates new fields based on the ones set in the child classes ---*/ + SetHistoryOutputFields(config); - Postprocess_HistoryFields(config); + /*--- Postprocess the history fields. Creates new fields based on the ones set in the child classes ---*/ - /*--- We use a fixed size of the file output summary table ---*/ + Postprocess_HistoryFields(config); - int total_width = 72; - fileWritingTable->AddColumn("File Writing Summary", (total_width)/2-1); - fileWritingTable->AddColumn("Filename", total_width/2-1); - fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::LEFT); + /*--- We use a fixed size of the file output summary table ---*/ - /*--- Check for consistency and remove fields that are requested but not available --- */ + int total_width = 72; + fileWritingTable->AddColumn("File Writing Summary", (total_width)/2-1); + fileWritingTable->AddColumn("Filename", total_width/2-1); + fileWritingTable->SetAlign(PrintingToolbox::CTablePrinter::LEFT); - CheckHistoryOutput(); + /*--- Check for consistency and remove fields that are requested but not available --- */ - if (rank == MASTER_NODE && !noWriting){ + CheckHistoryOutput(); - /*--- Open history file and print the header ---*/ - if (!config->GetMultizone_Problem() || config->GetWrt_ZoneHist()) - PrepareHistoryFile(config); + if (rank == MASTER_NODE && !noWriting){ - total_width = nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1); + /*--- Open history file and print the header ---*/ + if (!config->GetMultizone_Problem() || config->GetWrt_ZoneHist()) + PrepareHistoryFile(config); - /*--- Set the multizone screen header ---*/ + total_width = nRequestedScreenFields*fieldWidth + (nRequestedScreenFields-1); - if (config->GetMultizone_Problem()){ - multiZoneHeaderTable->AddColumn(multiZoneHeaderString, total_width); - multiZoneHeaderTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); - multiZoneHeaderTable->SetPrintHeaderBottomLine(false); - } + /*--- Set the multizone screen header ---*/ + if (config->GetMultizone_Problem()){ + multiZoneHeaderTable->AddColumn(multiZoneHeaderString, total_width); + multiZoneHeaderTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); + multiZoneHeaderTable->SetPrintHeaderBottomLine(false); } + } + } void COutput::PreprocessMultizoneHistoryOutput(COutput **output, CConfig **config, CConfig* driver_config, bool wrt){ @@ -1253,7 +1228,7 @@ void COutput::PrepareHistoryFile(CConfig *config){ historyFileTable->SetAlign(PrintingToolbox::CTablePrinter::CENTER); historyFileTable->SetPrintHeaderTopLine(false); historyFileTable->SetPrintHeaderBottomLine(false); - historyFileTable->SetPrecision(10); + historyFileTable->SetPrecision(config->GetOutput_Precision()); /*--- Add the header to the history file. ---*/ diff --git a/SU2_CFD/src/output/COutputFactory.cpp b/SU2_CFD/src/output/COutputFactory.cpp index a39f315ea0e8..45ef89a92dc8 100644 --- a/SU2_CFD/src/output/COutputFactory.cpp +++ b/SU2_CFD/src/output/COutputFactory.cpp @@ -2,7 +2,7 @@ * \file COutputFactory.cpp * \brief Main subroutines for output solver information * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp b/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp index df37c06faf1c..fbfc78461185 100644 --- a/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CCSVFileWriter.cpp @@ -2,7 +2,7 @@ * \file CCSVFileWriter.cpp * \brief CSV Writer output class * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -71,11 +71,11 @@ void CCSVFileWriter::Write_Data(){ to the master node with collective calls. ---*/ SU2_MPI::Allreduce(&nLocalVertex_Surface, &MaxLocalVertex_Surface, 1, - MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); SU2_MPI::Gather(&Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Recv_nVertex, 1, MPI_UNSIGNED_LONG, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); /*--- Allocate buffers for send/recv of the data and global IDs. ---*/ @@ -113,10 +113,10 @@ void CCSVFileWriter::Write_Data(){ /*--- Collective comms of the solution data and global IDs. ---*/ SU2_MPI::Gather(bufD_Send, (int)MaxLocalVertex_Surface*fieldNames.size(), MPI_DOUBLE, - bufD_Recv, (int)MaxLocalVertex_Surface*fieldNames.size(), MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + bufD_Recv, (int)MaxLocalVertex_Surface*fieldNames.size(), MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); SU2_MPI::Gather(bufL_Send, (int)MaxLocalVertex_Surface, MPI_UNSIGNED_LONG, - bufL_Recv, (int)MaxLocalVertex_Surface, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); + bufL_Recv, (int)MaxLocalVertex_Surface, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); /*--- The master rank alone writes the surface CSV file. ---*/ diff --git a/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp b/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp index ae8425da1eeb..ea2b3c465040 100644 --- a/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CFEMDataSorter.cpp @@ -2,7 +2,7 @@ * \file CFEMDataSorter.cpp * \brief Datasorter class for FEM solvers. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -62,7 +62,7 @@ CFEMDataSorter::CFEMDataSorter(CConfig *config, CGeometry *geometry, const vecto } SU2_MPI::Allreduce(&nLocalPointsBeforeSort, &nGlobalPointBeforeSort, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- Create a linear partition --- */ diff --git a/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp b/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp index a66663304d2c..4d3b50cb7449 100644 --- a/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CFVMDataSorter.cpp @@ -2,7 +2,7 @@ * \file CFVMDataSorter.cpp * \brief Datasorter class for FVM solvers. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -241,7 +241,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, many cells it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, - &(nElem_Cum[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nElem_Cum[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send connectivities. First check how many messages we will be sending and receiving. Here we also put @@ -377,7 +377,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, int source = ii; int tag = ii + 1; SU2_MPI::Irecv(&(connRecv[ll]), count, MPI_UNSIGNED_LONG, source, tag, - MPI_COMM_WORLD, &(recv_req[iMessage])); + SU2_MPI::GetComm(), &(recv_req[iMessage])); iMessage++; } } @@ -393,7 +393,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, int dest = ii; int tag = rank + 1; SU2_MPI::Isend(&(connSend[ll]), count, MPI_UNSIGNED_LONG, dest, tag, - MPI_COMM_WORLD, &(send_req[iMessage])); + SU2_MPI::GetComm(), &(send_req[iMessage])); iMessage++; } } @@ -409,7 +409,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, int source = ii; int tag = ii + 1; SU2_MPI::Irecv(&(haloRecv[ll]), count, MPI_UNSIGNED_SHORT, source, tag, - MPI_COMM_WORLD, &(recv_req[iMessage+nRecvs])); + SU2_MPI::GetComm(), &(recv_req[iMessage+nRecvs])); iMessage++; } } @@ -425,7 +425,7 @@ void CFVMDataSorter::SortVolumetricConnectivity(CConfig *config, int dest = ii; int tag = rank + 1; SU2_MPI::Isend(&(haloSend[ll]), count, MPI_UNSIGNED_SHORT, dest, tag, - MPI_COMM_WORLD, &(send_req[iMessage+nSends])); + SU2_MPI::GetComm(), &(send_req[iMessage+nSends])); iMessage++; } } diff --git a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp index b8ba27ce7cf4..c3d4f9601c5a 100644 --- a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp @@ -2,7 +2,7 @@ * \file CParallelDataSorter.cpp * \brief Datasorter base class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -142,7 +142,7 @@ void CParallelDataSorter::SortOutputData() { int source = ii; int tag = ii + 1; SU2_MPI::Irecv(&(doubleBuffer[ll]), count, MPI_DOUBLE, source, tag, - MPI_COMM_WORLD, &(recv_req[iMessage])); + SU2_MPI::GetComm(), &(recv_req[iMessage])); iMessage++; } } @@ -158,7 +158,7 @@ void CParallelDataSorter::SortOutputData() { int dest = ii; int tag = rank + 1; SU2_MPI::Isend(&(connSend[ll]), count, MPI_DOUBLE, dest, tag, - MPI_COMM_WORLD, &(send_req[iMessage])); + SU2_MPI::GetComm(), &(send_req[iMessage])); iMessage++; } } @@ -174,7 +174,7 @@ void CParallelDataSorter::SortOutputData() { int source = ii; int tag = ii + 1; SU2_MPI::Irecv(&(idRecv[ll]), count, MPI_UNSIGNED_LONG, source, tag, - MPI_COMM_WORLD, &(recv_req[iMessage+nRecvs])); + SU2_MPI::GetComm(), &(recv_req[iMessage+nRecvs])); iMessage++; } } @@ -190,7 +190,7 @@ void CParallelDataSorter::SortOutputData() { int dest = ii; int tag = rank + 1; SU2_MPI::Isend(&(idSend[ll]), count, MPI_UNSIGNED_LONG, dest, tag, - MPI_COMM_WORLD, &(send_req[iMessage+nSends])); + SU2_MPI::GetComm(), &(send_req[iMessage+nSends])); iMessage++; } } @@ -262,7 +262,7 @@ void CParallelDataSorter::SortOutputData() { /*--- Reduce the total number of points we will write in the output files. ---*/ SU2_MPI::Allreduce(&nPoints, &nPointsGlobal, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- Free temporary memory from communications ---*/ @@ -298,7 +298,7 @@ void CParallelDataSorter::PrepareSendBuffers(std::vector& globalI many cells it will receive from each other processor. ---*/ SU2_MPI::Alltoall(&(nPoint_Send[1]), 1, MPI_INT, - &(nPoint_Recv[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nPoint_Recv[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Prepare to send coordinates. First check how many messages we will be sending and receiving. Here we also put @@ -414,7 +414,7 @@ void CParallelDataSorter::SetTotalElements(){ /*--- Reduce the total number of cells we will be writing in the output files. ---*/ - SU2_MPI::Allreduce(nElemPerType.data(), nElemPerTypeGlobal.data(), N_ELEM_TYPES, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(nElemPerType.data(), nElemPerTypeGlobal.data(), N_ELEM_TYPES, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); nElemGlobal = std::accumulate(nElemPerTypeGlobal.begin(), nElemPerTypeGlobal.end(), 0); nElem = std::accumulate(nElemPerType.begin(), nElemPerType.end(), 0); @@ -451,10 +451,10 @@ void CParallelDataSorter::SetTotalElements(){ /*--- Communicate the local counts to all ranks for building offsets. ---*/ SU2_MPI::Alltoall(&(nElem_Send[1]), 1, MPI_INT, - &(nElem_Cum[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nElem_Cum[1]), 1, MPI_INT, SU2_MPI::GetComm()); SU2_MPI::Alltoall(&(nElemConn_Send[1]), 1, MPI_INT, - &(nElemConn_Cum[1]), 1, MPI_INT, MPI_COMM_WORLD); + &(nElemConn_Cum[1]), 1, MPI_INT, SU2_MPI::GetComm()); /*--- Put the counters into cumulative storage format. ---*/ diff --git a/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp index 579aa00a2397..2d9efcf1f88f 100644 --- a/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParallelFileWriter.cpp @@ -2,7 +2,7 @@ * \file CFileWriter.cpp * \brief Filewriter base class. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -216,14 +216,14 @@ bool CFileWriter::OpenMPIFile(){ to write a fresh output file, so we delete any existing files and create a new one. ---*/ - ierr = MPI_File_open(MPI_COMM_WORLD, fileName.c_str(), + ierr = MPI_File_open(SU2_MPI::GetComm(), fileName.c_str(), MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_WRONLY, MPI_INFO_NULL, &fhw); if (ierr != MPI_SUCCESS) { MPI_File_close(&fhw); if (rank == 0) MPI_File_delete(fileName.c_str(), MPI_INFO_NULL); - ierr = MPI_File_open(MPI_COMM_WORLD, fileName.c_str(), + ierr = MPI_File_open(SU2_MPI::GetComm(), fileName.c_str(), MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_WRONLY, MPI_INFO_NULL, &fhw); } @@ -264,7 +264,7 @@ bool CFileWriter::CloseMPIFile(){ su2double my_fileSize = fileSize; SU2_MPI::Allreduce(&my_fileSize, &fileSize, 1, - MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Compute and store the bandwidth ---*/ diff --git a/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp index 1a2d85cef371..467a1e7702f1 100644 --- a/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParaviewBinaryFileWriter.cpp @@ -2,7 +2,7 @@ * \file CParaviewBinaryFileWriter.cpp * \brief Filewriter class for Paraview binary format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp index f1efcadf975e..f49947e88419 100644 --- a/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParaviewFileWriter.cpp @@ -2,7 +2,7 @@ * \file CParaviewFileWriter.cpp * \brief Filewriter class for Paraview ASCII format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -75,7 +75,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.close(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif /*--- Each processor opens the file. ---*/ @@ -99,7 +99,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } @@ -124,7 +124,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif /*--- Write connectivity data. ---*/ @@ -196,7 +196,7 @@ void CParaviewFileWriter::Write_Data(){ } Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } @@ -209,7 +209,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif for (iProcessor = 0; iProcessor < size; iProcessor++) { @@ -224,7 +224,7 @@ void CParaviewFileWriter::Write_Data(){ } Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } @@ -236,7 +236,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif unsigned short varStart = 2; @@ -263,7 +263,7 @@ void CParaviewFileWriter::Write_Data(){ //skip Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif VarCounter++; } @@ -273,7 +273,7 @@ void CParaviewFileWriter::Write_Data(){ //skip Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif VarCounter++; } @@ -288,7 +288,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif /*--- Write surface and volumetric point coordinates. ---*/ @@ -307,7 +307,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } @@ -323,7 +323,7 @@ void CParaviewFileWriter::Write_Data(){ Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif /*--- Write surface and volumetric point coordinates. ---*/ @@ -340,7 +340,7 @@ void CParaviewFileWriter::Write_Data(){ } Paraview_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } diff --git a/SU2_CFD/src/output/filewriter/CParaviewVTMFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParaviewVTMFileWriter.cpp index 8ca0bc411578..658e5bae03d4 100644 --- a/SU2_CFD/src/output/filewriter/CParaviewVTMFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParaviewVTMFileWriter.cpp @@ -2,7 +2,7 @@ * \file CParaviewVTMFileWriter.cpp * \brief Filewriter class for Paraview binary format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp b/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp index 4871946b7cfc..2beed5509646 100644 --- a/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CParaviewXMLFileWriter.cpp @@ -2,7 +2,7 @@ * \file CParaviewXMLFileWriter.cpp * \brief Filewriter class for Paraview binary format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/filewriter/CSTLFileWriter.cpp b/SU2_CFD/src/output/filewriter/CSTLFileWriter.cpp index aba6a6bc5765..1d29acb0ad01 100644 --- a/SU2_CFD/src/output/filewriter/CSTLFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSTLFileWriter.cpp @@ -2,7 +2,7 @@ * \file CSTLFileWriter.cpp * \brief STL Writer output class * \author T. Kattmann, T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -157,7 +157,7 @@ void CSTLFileWriter::ReprocessElementConnectivity(){ for (unsigned long i = 0; i < num_halo_nodes; ++i) ++num_nodes_to_receive[neighbor_partitions[i]]; num_nodes_to_send.resize(size); - SU2_MPI::Alltoall(&num_nodes_to_receive[0], 1, MPI_INT, &num_nodes_to_send[0], 1, MPI_INT, MPI_COMM_WORLD); + SU2_MPI::Alltoall(&num_nodes_to_receive[0], 1, MPI_INT, &num_nodes_to_send[0], 1, MPI_INT, SU2_MPI::GetComm()); /* Now send the global node numbers whose data we need, and receive the same from all other ranks. @@ -182,7 +182,7 @@ void CSTLFileWriter::ReprocessElementConnectivity(){ if (sorted_halo_nodes.empty()) sorted_halo_nodes.resize(1); /* Avoid crash. */ SU2_MPI::Alltoallv(&sorted_halo_nodes[0], &num_nodes_to_receive[0], &nodes_to_receive_displacements[0], MPI_UNSIGNED_LONG, &nodes_to_send[0], &num_nodes_to_send[0], &nodes_to_send_displacements[0], MPI_UNSIGNED_LONG, - MPI_COMM_WORLD); + SU2_MPI::GetComm()); /* Now actually send and receive the data */ data_to_send.resize(max(1, total_num_nodes_to_send * fieldNames.size())); @@ -211,7 +211,7 @@ void CSTLFileWriter::ReprocessElementConnectivity(){ SU2_MPI::Alltoallv(&data_to_send[0], &num_values_to_send[0], &values_to_send_displacements[0], MPI_DOUBLE, &halo_var_data[0], &num_values_to_receive[0], &values_to_receive_displacements[0], MPI_DOUBLE, - MPI_COMM_WORLD); + SU2_MPI::GetComm()); } @@ -244,12 +244,12 @@ void CSTLFileWriter::GatherCoordData(){ to the master node with collective calls. ---*/ SU2_MPI::Allreduce(&nLocalTriaAll, &max_nLocalTriaAll, 1, - MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); SU2_MPI::Gather(&nLocalTriaAll , 1, MPI_UNSIGNED_LONG, buffRecvTriaCount, 1, MPI_UNSIGNED_LONG, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); /*--- Allocate buffer for send/recv of the coordinate data. Only the master rank allocates buffers for the recv. ---*/ buffSendCoords = new su2double[max_nLocalTriaAll*N_POINTS_TRIANGLE*3]; /* Triangle has 3 Points with 3 coords each */ @@ -262,7 +262,7 @@ void CSTLFileWriter::GatherCoordData(){ /*--- Collective comms of the solution data and global IDs. ---*/ SU2_MPI::Gather(buffSendCoords, static_cast(max_nLocalTriaAll*N_POINTS_TRIANGLE*3), MPI_DOUBLE, buffRecvCoords, static_cast(max_nLocalTriaAll*N_POINTS_TRIANGLE*3), MPI_DOUBLE, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); /*--- Free temporary memory. ---*/ delete [] buffSendCoords; diff --git a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp index 1b23f9cad0d6..ccd44f347101 100644 --- a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp @@ -2,7 +2,7 @@ * \file CSU2BinaryFileWriter.cpp * \brief Filewriter class SU2 native binary format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp index 0e0de2555528..1e9a7d523fc9 100644 --- a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp @@ -2,7 +2,7 @@ * \file CSU2FileWriter.cpp * \brief Filewriter class SU2 native ASCII (CSV) format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -76,7 +76,7 @@ void CSU2FileWriter::Write_Data(){ /*--- Wait for iProcessor to finish and close the file. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); } /*--- Compute and store the write time. ---*/ diff --git a/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp index 5a0bf38d09e3..d90a26271e96 100644 --- a/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2MeshFileWriter.cpp @@ -2,7 +2,7 @@ * \file CSU2MeshFileWriter.cpp * \brief Filewriter class SU2 native mesh format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -114,7 +114,7 @@ void CSU2MeshFileWriter::Write_Data() { } /*--- Communicate offset, implies a barrier. ---*/ - SU2_MPI::Allreduce(&nElem, &offset, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nElem, &offset, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); } /*--- Write the node coordinates. ---*/ @@ -150,7 +150,7 @@ void CSU2MeshFileWriter::Write_Data() { } /*--- Communicate offset, implies a barrier. ---*/ - SU2_MPI::Allreduce(&myPoint, &offset, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&myPoint, &offset, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); } if (rank == MASTER_NODE) { @@ -248,5 +248,5 @@ void CSU2MeshFileWriter::Write_Data() { output_file.close(); } - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); } diff --git a/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp b/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp index 1a938d40883f..97221c236bf2 100644 --- a/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CSurfaceFEMDataSorter.cpp @@ -2,7 +2,7 @@ * \file CSurfaceFEMDataSorter.cpp * \brief Datasorter for FEM surfaces. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -58,7 +58,7 @@ CSurfaceFEMDataSorter::CSurfaceFEMDataSorter(CConfig *config, CGeometry *geometr } SU2_MPI::Allreduce(&nLocalPointsBeforeSort, &nGlobalPointBeforeSort, 1, - MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); /*--- Create the linear partitioner --- */ @@ -154,7 +154,7 @@ void CSurfaceFEMDataSorter::SortOutputData() { vector nDOFRecv(size); SU2_MPI::Alltoall(nDOFSend.data(), 1, MPI_UNSIGNED_LONG, - nDOFRecv.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + nDOFRecv.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); /* Determine the number of messages this rank will receive. */ int nRankRecv = 0; @@ -172,7 +172,7 @@ void CSurfaceFEMDataSorter::SortOutputData() { for(int i=0; iGetnElem(LINE), - nParallel_Tria = dataSorter->GetnElem(TRIANGLE), + unsigned long nParallel_Tria = dataSorter->GetnElem(TRIANGLE), nParallel_Quad = dataSorter->GetnElem(QUADRILATERAL), nParallel_Tetr = dataSorter->GetnElem(TETRAHEDRON), nParallel_Hexa = dataSorter->GetnElem(HEXAHEDRON), nParallel_Pris = dataSorter->GetnElem(PRISM), nParallel_Pyra = dataSorter->GetnElem(PYRAMID); - + unsigned long nTot_Line = dataSorter->GetnElemGlobal(LINE), nTot_Tria = dataSorter->GetnElemGlobal(TRIANGLE), nTot_Quad = dataSorter->GetnElemGlobal(QUADRILATERAL), @@ -85,7 +84,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ if (err) cout << "Error opening Tecplot file '" << fileName << "'" << endl; #ifdef HAVE_MPI - err = tecMPIInitialize(file_handle, MPI_COMM_WORLD, MASTER_NODE); + err = tecMPIInitialize(file_handle, SU2_MPI::GetComm(), MASTER_NODE); if (err) cout << "Error initializing Tecplot parallel output." << endl; #endif @@ -135,6 +134,8 @@ void CTecplotBinaryFileWriter::Write_Data(){ #ifdef HAVE_MPI + unsigned long nParallel_Line = dataSorter->GetnElem(LINE); + unsigned short iVar; NodePartitioner node_partitioner(num_nodes, size); std::set halo_nodes; @@ -214,7 +215,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ for (size_t i = 0; i < num_halo_nodes; ++i) ++num_nodes_to_receive[neighbor_partitions[i] - 1]; vector num_nodes_to_send(size); - SU2_MPI::Alltoall(&num_nodes_to_receive[0], 1, MPI_INT, &num_nodes_to_send[0], 1, MPI_INT, MPI_COMM_WORLD); + SU2_MPI::Alltoall(&num_nodes_to_receive[0], 1, MPI_INT, &num_nodes_to_send[0], 1, MPI_INT, SU2_MPI::GetComm()); /* Now send the global node numbers whose data we need, and receive the same from all other ranks. @@ -237,7 +238,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ if (sorted_halo_nodes.empty()) sorted_halo_nodes.resize(1); /* Avoid crash. */ SU2_MPI::Alltoallv(&sorted_halo_nodes[0], &num_nodes_to_receive[0], &nodes_to_receive_displacements[0], MPI_UNSIGNED_LONG, &nodes_to_send[0], &num_nodes_to_send[0], &nodes_to_send_displacements[0], MPI_UNSIGNED_LONG, - MPI_COMM_WORLD); + SU2_MPI::GetComm()); /* Now actually send and receive the data */ vector data_to_send(max(1, total_num_nodes_to_send * (int)fieldNames.size())); @@ -260,7 +261,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ } CBaseMPIWrapper::Alltoallv(&data_to_send[0], &num_values_to_send[0], &values_to_send_displacements[0], MPI_DOUBLE, &halo_var_data[0], &num_values_to_receive[0], &values_to_receive_displacements[0], MPI_DOUBLE, - MPI_COMM_WORLD); + SU2_MPI::GetComm()); } else { /* Zone will be gathered to and output by MASTER_NODE */ @@ -290,7 +291,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ vector var_data; unsigned long nPoint = dataSorter->GetnPoints(); vector num_points(size); - SU2_MPI::Gather(&nPoint, 1, MPI_UNSIGNED_LONG, &num_points[0], 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(&nPoint, 1, MPI_UNSIGNED_LONG, &num_points[0], 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); for(int iRank = 0; iRank < size; ++iRank) { int64_t rank_num_points = num_points[iRank]; @@ -308,7 +309,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ } else { /* Receive data from other rank. */ var_data.resize(max((int64_t)1, (int64_t)fieldNames.size() * rank_num_points)); - CBaseMPIWrapper::Recv(&var_data[0], fieldNames.size() * rank_num_points, MPI_DOUBLE, iRank, iRank, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + CBaseMPIWrapper::Recv(&var_data[0], fieldNames.size() * rank_num_points, MPI_DOUBLE, iRank, iRank, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); for (iVar = 0; err == 0 && iVar < fieldNames.size(); iVar++) { err = tecZoneVarWriteDoubleValues(file_handle, zone, iVar + 1, 0, rank_num_points, &var_data[iVar * rank_num_points]); if (err) cout << rank << ": Error outputting Tecplot surface variable values." << endl; @@ -320,7 +321,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ else { /* Send data to MASTER_NODE */ unsigned long nPoint = dataSorter->GetnPoints(); - SU2_MPI::Gather(&nPoint, 1, MPI_UNSIGNED_LONG, NULL, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(&nPoint, 1, MPI_UNSIGNED_LONG, NULL, 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); vector var_data; size_t var_data_size = fieldNames.size() * dataSorter->GetnPoints(); @@ -330,7 +331,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ var_data.push_back(dataSorter->GetData(iVar,i)); if (var_data.size() > 0) - CBaseMPIWrapper::Send(&var_data[0], static_cast(var_data.size()), MPI_DOUBLE, MASTER_NODE, rank, MPI_COMM_WORLD); + CBaseMPIWrapper::Send(&var_data[0], static_cast(var_data.size()), MPI_DOUBLE, MASTER_NODE, rank, SU2_MPI::GetComm()); } } @@ -431,7 +432,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ vector connectivity_sizes(size); unsigned long unused = 0; - SU2_MPI::Gather(&unused, 1, MPI_UNSIGNED_LONG, &connectivity_sizes[0], 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(&unused, 1, MPI_UNSIGNED_LONG, &connectivity_sizes[0], 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); vector connectivity; for(int iRank = 0; iRank < size; ++iRank) { if (iRank == rank) { @@ -462,7 +463,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ } else { /* Receive node map and write out. */ connectivity.resize(max((unsigned long)1, connectivity_sizes[iRank])); - SU2_MPI::Recv(&connectivity[0], connectivity_sizes[iRank], MPI_UNSIGNED_LONG, iRank, iRank, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + SU2_MPI::Recv(&connectivity[0], connectivity_sizes[iRank], MPI_UNSIGNED_LONG, iRank, iRank, SU2_MPI::GetComm(), MPI_STATUS_IGNORE); err = tecZoneNodeMapWrite64(file_handle, zone, 0, 1, connectivity_sizes[iRank], &connectivity[0]); if (err) cout << rank << ": Error outputting Tecplot node values." << endl; } @@ -473,7 +474,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ unsigned long connectivity_size; connectivity_size = 2 * nParallel_Line + 4 * (nParallel_Tria + nParallel_Quad); - SU2_MPI::Gather(&connectivity_size, 1, MPI_UNSIGNED_LONG, NULL, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(&connectivity_size, 1, MPI_UNSIGNED_LONG, NULL, 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); vector connectivity; connectivity.reserve(connectivity_size); for (iElem = 0; err == 0 && iElem < nParallel_Line; iElem++) { @@ -496,7 +497,7 @@ void CTecplotBinaryFileWriter::Write_Data(){ } if (connectivity.empty()) connectivity.resize(1); /* Avoid crash */ - SU2_MPI::Send(&connectivity[0], connectivity_size, MPI_UNSIGNED_LONG, MASTER_NODE, rank, MPI_COMM_WORLD); + SU2_MPI::Send(&connectivity[0], connectivity_size, MPI_UNSIGNED_LONG, MASTER_NODE, rank, SU2_MPI::GetComm()); } } #else diff --git a/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp b/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp index 4236ab560a2a..c5207a27740d 100644 --- a/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CTecplotFileWriter.cpp @@ -2,7 +2,7 @@ * \file CTecplotFileWriter.cpp * \brief Filewriter class for Tecplot ASCII format. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -118,7 +118,7 @@ void CTecplotFileWriter::Write_Data(){ } #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif /*--- Each processor opens the file. ---*/ @@ -142,7 +142,7 @@ void CTecplotFileWriter::Write_Data(){ Tecplot_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } @@ -204,7 +204,7 @@ void CTecplotFileWriter::Write_Data(){ } Tecplot_File.flush(); #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } diff --git a/SU2_CFD/src/output/output_physics.cpp b/SU2_CFD/src/output/output_physics.cpp index 7d68b8775b5e..621937bd3c60 100644 --- a/SU2_CFD/src/output/output_physics.cpp +++ b/SU2_CFD/src/output/output_physics.cpp @@ -2,7 +2,7 @@ * \file output_physics.cpp * \brief Main subroutines to compute physical output quantities such as CL, CD, entropy generation, mass flow, ecc... . * \author S. Vitale - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/output/output_structure_legacy.cpp b/SU2_CFD/src/output/output_structure_legacy.cpp index b3aabf724d9a..ebac0379aaad 100644 --- a/SU2_CFD/src/output/output_structure_legacy.cpp +++ b/SU2_CFD/src/output/output_structure_legacy.cpp @@ -2,7 +2,7 @@ * \file output_structure.cpp * \brief Main subroutines for output solver information * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -4685,7 +4685,7 @@ void COutputLegacy::SetCp_InverseDesign(CSolver *solver_container, CGeometry *ge nPointLocal = geometry->GetnPoint(); #ifdef HAVE_MPI - SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #else nPointGlobal = nPointLocal; #endif @@ -4811,7 +4811,7 @@ void COutputLegacy::SetCp_InverseDesign(CSolver *solver_container, CGeometry *ge #ifdef HAVE_MPI su2double MyPressDiff = PressDiff; PressDiff = 0.0; - SU2_MPI::Allreduce(&MyPressDiff, &PressDiff, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyPressDiff, &PressDiff, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #endif /*--- Update the total Cp difference coeffient ---*/ @@ -4837,7 +4837,7 @@ void COutputLegacy::SetHeatFlux_InverseDesign(CSolver *solver_container, CGeomet nPointLocal = geometry->GetnPoint(); #ifdef HAVE_MPI - SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nPointLocal, &nPointGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #else nPointGlobal = nPointLocal; #endif @@ -4962,7 +4962,7 @@ void COutputLegacy::SetHeatFlux_InverseDesign(CSolver *solver_container, CGeomet #ifdef HAVE_MPI su2double MyHeatFluxDiff = HeatFluxDiff; HeatFluxDiff = 0.0; - SU2_MPI::Allreduce(&MyHeatFluxDiff, &HeatFluxDiff, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyHeatFluxDiff, &HeatFluxDiff, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #endif /*--- Update the total HeatFlux difference coeffient ---*/ @@ -5102,7 +5102,7 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry #else int nProcessor; - SU2_MPI::Comm_size(MPI_COMM_WORLD, &nProcessor); + SU2_MPI::Comm_size(SU2_MPI::GetComm(), &nProcessor); unsigned long nLocalVertex_NearField = 0, MaxLocalVertex_NearField = 0; int iProcessor; @@ -5132,9 +5132,9 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry /*--- Send Near-Field vertex information --*/ - SU2_MPI::Allreduce(&nLocalVertex_NearField, &nVertex_NearField, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&nLocalVertex_NearField, &MaxLocalVertex_NearField, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Receive_nVertex, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nLocalVertex_NearField, &nVertex_NearField, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&nLocalVertex_NearField, &MaxLocalVertex_NearField, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Receive_nVertex, 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); delete [] Buffer_Send_nVertex; su2double *Buffer_Send_Xcoord = new su2double[MaxLocalVertex_NearField]; @@ -5197,12 +5197,12 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry /*--- Send all the information --*/ - SU2_MPI::Gather(Buffer_Send_Xcoord, nBuffer_Xcoord, MPI_DOUBLE, Buffer_Receive_Xcoord, nBuffer_Xcoord, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Ycoord, nBuffer_Ycoord, MPI_DOUBLE, Buffer_Receive_Ycoord, nBuffer_Ycoord, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Zcoord, nBuffer_Zcoord, MPI_DOUBLE, Buffer_Receive_Zcoord, nBuffer_Zcoord, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_IdPoint, nBuffer_IdPoint, MPI_UNSIGNED_LONG, Buffer_Receive_IdPoint, nBuffer_IdPoint, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Pressure, nBuffer_Pressure, MPI_DOUBLE, Buffer_Receive_Pressure, nBuffer_Pressure, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_FaceArea, nBuffer_FaceArea, MPI_DOUBLE, Buffer_Receive_FaceArea, nBuffer_FaceArea, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(Buffer_Send_Xcoord, nBuffer_Xcoord, MPI_DOUBLE, Buffer_Receive_Xcoord, nBuffer_Xcoord, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Ycoord, nBuffer_Ycoord, MPI_DOUBLE, Buffer_Receive_Ycoord, nBuffer_Ycoord, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Zcoord, nBuffer_Zcoord, MPI_DOUBLE, Buffer_Receive_Zcoord, nBuffer_Zcoord, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_IdPoint, nBuffer_IdPoint, MPI_UNSIGNED_LONG, Buffer_Receive_IdPoint, nBuffer_IdPoint, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Pressure, nBuffer_Pressure, MPI_DOUBLE, Buffer_Receive_Pressure, nBuffer_Pressure, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_FaceArea, nBuffer_FaceArea, MPI_DOUBLE, Buffer_Receive_FaceArea, nBuffer_FaceArea, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); delete [] Buffer_Send_Xcoord; delete [] Buffer_Send_Ycoord; delete [] Buffer_Send_Zcoord; @@ -5592,7 +5592,7 @@ void COutputLegacy::SpecialOutput_SonicBoom(CSolver *solver, CGeometry *geometry /*--- Send the value of the NearField coefficient to all the processors ---*/ - SU2_MPI::Bcast(&InverseDesign, 1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&InverseDesign, 1, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); /*--- Store the value of the NearField coefficient ---*/ @@ -5692,8 +5692,8 @@ void COutputLegacy::SpecialOutput_Distortion(CSolver *solver, CGeometry *geometr if (rank == MASTER_NODE) Buffer_Recv_nVertex = new unsigned long [nProcessor]; #ifdef HAVE_MPI - SU2_MPI::Allreduce(&nLocalVertex_Surface, &MaxLocalVertex_Surface, 1, MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Gather(&Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Recv_nVertex, 1, MPI_UNSIGNED_LONG, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nLocalVertex_Surface, &MaxLocalVertex_Surface, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Gather(&Buffer_Send_nVertex, 1, MPI_UNSIGNED_LONG, Buffer_Recv_nVertex, 1, MPI_UNSIGNED_LONG, MASTER_NODE, SU2_MPI::GetComm()); #else MaxLocalVertex_Surface = nLocalVertex_Surface; Buffer_Recv_nVertex[MASTER_NODE] = Buffer_Send_nVertex[MASTER_NODE]; @@ -5840,19 +5840,19 @@ void COutputLegacy::SpecialOutput_Distortion(CSolver *solver, CGeometry *geometr #ifdef HAVE_MPI - SU2_MPI::Gather(Buffer_Send_Coord_x, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Coord_x, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Coord_y, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Coord_y, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - if (nDim == 3) SU2_MPI::Gather(Buffer_Send_Coord_z, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Coord_z, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_PT, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_PT, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_TT, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_TT, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_P, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_P, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_T, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_T, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Mach, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Mach, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Vel_x, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Vel_x, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Vel_y, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Vel_y, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - if (nDim == 3) SU2_MPI::Gather(Buffer_Send_Vel_z, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Vel_z, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_q, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_q, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); - SU2_MPI::Gather(Buffer_Send_Area, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Area, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Gather(Buffer_Send_Coord_x, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Coord_x, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Coord_y, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Coord_y, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + if (nDim == 3) SU2_MPI::Gather(Buffer_Send_Coord_z, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Coord_z, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_PT, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_PT, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_TT, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_TT, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_P, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_P, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_T, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_T, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Mach, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Mach, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Vel_x, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Vel_x, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Vel_y, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Vel_y, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + if (nDim == 3) SU2_MPI::Gather(Buffer_Send_Vel_z, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Vel_z, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_q, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_q, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Gather(Buffer_Send_Area, MaxLocalVertex_Surface, MPI_DOUBLE, Buffer_Recv_Area, MaxLocalVertex_Surface, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); #else @@ -7568,19 +7568,19 @@ void COutputLegacy::SpecialOutput_AnalyzeSurface(CSolver *solver, CGeometry *geo #ifdef HAVE_MPI if (config->GetComm_Level() == COMM_FULL) { - SU2_MPI::Allreduce(Surface_MassFlow_Local, Surface_MassFlow_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Mach_Local, Surface_Mach_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Temperature_Local, Surface_Temperature_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Density_Local, Surface_Density_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Enthalpy_Local, Surface_Enthalpy_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_NormalVelocity_Local, Surface_NormalVelocity_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_StreamVelocity2_Local, Surface_StreamVelocity2_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_TransvVelocity2_Local, Surface_TransvVelocity2_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Pressure_Local, Surface_Pressure_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_TotalTemperature_Local, Surface_TotalTemperature_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_TotalPressure_Local, Surface_TotalPressure_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_Area_Local, Surface_Area_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Surface_MassFlow_Abs_Local, Surface_MassFlow_Abs_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Surface_MassFlow_Local, Surface_MassFlow_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_Mach_Local, Surface_Mach_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_Temperature_Local, Surface_Temperature_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_Density_Local, Surface_Density_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_Enthalpy_Local, Surface_Enthalpy_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_NormalVelocity_Local, Surface_NormalVelocity_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_StreamVelocity2_Local, Surface_StreamVelocity2_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_TransvVelocity2_Local, Surface_TransvVelocity2_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_Pressure_Local, Surface_Pressure_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_TotalTemperature_Local, Surface_TotalTemperature_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_TotalPressure_Local, Surface_TotalPressure_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_Area_Local, Surface_Area_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Surface_MassFlow_Abs_Local, Surface_MassFlow_Abs_Total, nMarker_Analyze, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } #else diff --git a/SU2_CFD/src/output/tools/CWindowingTools.cpp b/SU2_CFD/src/output/tools/CWindowingTools.cpp index a0bb5a261648..87fc1f250a8e 100644 --- a/SU2_CFD/src/output/tools/CWindowingTools.cpp +++ b/SU2_CFD/src/output/tools/CWindowingTools.cpp @@ -2,7 +2,7 @@ * \file signal_processing_toolbox.cpp * \brief Signal processing tools * \author S. Schotthöfer - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/python_wrapper_structure.cpp b/SU2_CFD/src/python_wrapper_structure.cpp index 1e94251fdd02..e324046844ef 100644 --- a/SU2_CFD/src/python_wrapper_structure.cpp +++ b/SU2_CFD/src/python_wrapper_structure.cpp @@ -2,7 +2,7 @@ * \file python_wrapper_structure.cpp * \brief Driver subroutines that are used by the Python wrapper. Those routines are usually called from an external Python environment. * \author D. Thomas - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -33,10 +33,7 @@ void CDriver::PythonInterface_Preprocessing(CConfig **config, CGeometry ****geometry, CSolver *****solver){ int rank = MASTER_NODE; - -#ifdef HAVE_MPI - MPI_Comm_rank(MPI_COMM_WORLD, &rank); -#endif + SU2_MPI::Comm_rank(SU2_MPI::GetComm(), &rank); /* --- Initialize boundary conditions customization, this is achieve through the Python wrapper --- */ for(iZone=0; iZone < nZone; iZone++){ @@ -59,39 +56,21 @@ void CDriver::PythonInterface_Preprocessing(CConfig **config, CGeometry ****geom } } } - /*--- Initialize some variables used for external communications trough the Py wrapper. ---*/ - PyWrapVarCoord[0] = 0.0; - PyWrapVarCoord[1] = 0.0; - PyWrapVarCoord[2] = 0.0; - PyWrapNodalForce[0] = 0.0; - PyWrapNodalForce[1] = 0.0; - PyWrapNodalForce[2] = 0.0; - PyWrapNodalForceDensity[0] = 0.0; - PyWrapNodalForceDensity[1] = 0.0; - PyWrapNodalForceDensity[2] = 0.0; - PyWrapNodalHeatFlux[0] = 0.0; - PyWrapNodalHeatFlux[1] = 0.0; - PyWrapNodalHeatFlux[2] = 0.0; } -passivedouble CDriver::Get_Drag() { +///////////////////////////////////////////////////////////////////////////// +/* Functions related to the global performance indices (Lift, Drag, ecc..) */ +///////////////////////////////////////////////////////////////////////////// + +passivedouble CDriver::Get_Drag() const { unsigned short val_iZone = ZONE_0; unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); - su2double CDrag, RefDensity, RefArea, RefVel2, factor, val_Drag; - - /*--- Export free-stream density and reference area ---*/ - RefDensity = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetDensity_Inf(); - RefArea = config_container[val_iZone]->GetRefArea(); - - /*--- Calculate free-stream velocity (squared) ---*/ - RefVel2 = 0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - RefVel2 += pow(solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetVelocity_Inf(iDim),2); + su2double CDrag, factor, val_Drag; /*--- Calculate drag force based on drag coefficient ---*/ - factor = 0.5*RefDensity*RefArea*RefVel2; + factor = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetAeroCoeffsReferenceForce(); CDrag = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CD(); val_Drag = CDrag*factor; @@ -99,23 +78,14 @@ passivedouble CDriver::Get_Drag() { return SU2_TYPE::GetValue(val_Drag); } -passivedouble CDriver::Get_Lift() { +passivedouble CDriver::Get_Lift() const { unsigned short val_iZone = ZONE_0; unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); - su2double CLift, RefDensity, RefArea, RefVel2, factor, val_Lift; - - /*--- Export free-stream density and reference area ---*/ - RefDensity = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetDensity_Inf(); - RefArea = config_container[val_iZone]->GetRefArea(); - - /*--- Calculate free-stream velocity (squared) ---*/ - RefVel2 = 0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - RefVel2 += pow(solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetVelocity_Inf(iDim),2); + su2double CLift, factor, val_Lift; /*--- Calculate drag force based on drag coefficient ---*/ - factor = 0.5*RefDensity*RefArea*RefVel2; + factor = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetAeroCoeffsReferenceForce(); CLift = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CL(); val_Lift = CLift*factor; @@ -123,137 +93,90 @@ passivedouble CDriver::Get_Lift() { return SU2_TYPE::GetValue(val_Lift); } -passivedouble CDriver::Get_Mx(){ +passivedouble CDriver::Get_Mx() const { unsigned short val_iZone = ZONE_0; unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); - su2double CMx, RefDensity, RefArea, RefLengthCoeff, RefVel2, factor, val_Mx; + su2double CMx, RefLengthCoeff, factor, val_Mx; - /*--- Export free-stream density and reference area ---*/ - RefDensity = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetDensity_Inf(); - RefArea = config_container[val_iZone]->GetRefArea(); RefLengthCoeff = config_container[val_iZone]->GetRefLength(); - /*--- Calculate free-stream velocity (squared) ---*/ - RefVel2 = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) - RefVel2 += pow(solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetVelocity_Inf(iDim),2); - /*--- Calculate moment around x-axis based on coefficients ---*/ - factor = 0.5*RefDensity*RefArea*RefVel2; + factor = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetAeroCoeffsReferenceForce(); CMx = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CMx(); val_Mx = CMx*factor*RefLengthCoeff; return SU2_TYPE::GetValue(val_Mx); - } -passivedouble CDriver::Get_My(){ +passivedouble CDriver::Get_My() const { unsigned short val_iZone = ZONE_0; unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); - su2double CMy, RefDensity, RefArea, RefLengthCoeff, RefVel2, factor, val_My; + su2double CMy, RefLengthCoeff, factor, val_My; - /*--- Export free-stream density and reference area ---*/ - RefDensity = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetDensity_Inf(); - RefArea = config_container[val_iZone]->GetRefArea(); RefLengthCoeff = config_container[val_iZone]->GetRefLength(); - /*--- Calculate free-stream velocity (squared) ---*/ - RefVel2 = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) - RefVel2 += pow(solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetVelocity_Inf(iDim),2); - /*--- Calculate moment around x-axis based on coefficients ---*/ - factor = 0.5*RefDensity*RefArea*RefVel2; + factor = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetAeroCoeffsReferenceForce(); CMy = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CMy(); val_My = CMy*factor*RefLengthCoeff; return SU2_TYPE::GetValue(val_My); - } -passivedouble CDriver::Get_Mz() { +passivedouble CDriver::Get_Mz() const { unsigned short val_iZone = ZONE_0; unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); - su2double CMz, RefDensity, RefArea, RefLengthCoeff, RefVel2, factor, val_Mz; + su2double CMz, RefLengthCoeff, factor, val_Mz; - /*--- Export free-stream density and reference area ---*/ - RefDensity = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetDensity_Inf(); - RefArea = config_container[val_iZone]->GetRefArea(); RefLengthCoeff = config_container[val_iZone]->GetRefLength(); - /*--- Calculate free-stream velocity (squared) ---*/ - RefVel2 = 0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++) - RefVel2 += pow(solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetVelocity_Inf(iDim),2); - /*--- Calculate moment around z-axis based on coefficients ---*/ - factor = 0.5*RefDensity*RefArea*RefVel2; + factor = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetAeroCoeffsReferenceForce(); CMz = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CMz(); val_Mz = CMz*factor*RefLengthCoeff; return SU2_TYPE::GetValue(val_Mz); - } -passivedouble CDriver::Get_DragCoeff() { +passivedouble CDriver::Get_DragCoeff() const { - unsigned short val_iZone = ZONE_0; - unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); - su2double CDrag; + unsigned short val_iZone = ZONE_0; + unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); + su2double CDrag; - CDrag = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CD(); + CDrag = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CD(); - return SU2_TYPE::GetValue(CDrag); + return SU2_TYPE::GetValue(CDrag); } -passivedouble CDriver::Get_LiftCoeff() { +passivedouble CDriver::Get_LiftCoeff() const { - unsigned short val_iZone = ZONE_0; - unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); - su2double CLift; + unsigned short val_iZone = ZONE_0; + unsigned short FinestMesh = config_container[val_iZone]->GetFinestMesh(); + su2double CLift; - CLift = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CL(); + CLift = solver_container[val_iZone][INST_0][FinestMesh][FLOW_SOL]->GetTotal_CL(); - return SU2_TYPE::GetValue(CLift); + return SU2_TYPE::GetValue(CLift); } -unsigned short CDriver::GetMovingMarker() { - - unsigned short IDtoSend,iMarker, jMarker, Moving; - string Marker_Tag, Moving_Tag; - - IDtoSend = 0; - for (iMarker = 0; iMarker < config_container[ZONE_0]->GetnMarker_All(); iMarker++) { - Moving = config_container[ZONE_0]->GetMarker_All_Moving(iMarker); - if (Moving == YES) { - for (jMarker = 0; jMarkerGetnMarker_Moving(); jMarker++) { - Moving_Tag = config_container[ZONE_0]->GetMarker_Moving_TagBound(jMarker); - Marker_Tag = config_container[ZONE_0]->GetMarker_All_TagBound(iMarker); - if (Marker_Tag == Moving_Tag) { - IDtoSend = iMarker; - break; - } - } - } - } - - return IDtoSend; - -} +///////////////////////////////////////////////////////////////////////////// +/* Functions to obtain information from the geometry/mesh */ +///////////////////////////////////////////////////////////////////////////// -unsigned long CDriver::GetNumberVertices(unsigned short iMarker){ +unsigned long CDriver::GetNumberVertices(unsigned short iMarker) const { return geometry_container[ZONE_0][INST_0][MESH_0]->nVertex[iMarker]; } -unsigned long CDriver::GetNumberHaloVertices(unsigned short iMarker){ +unsigned long CDriver::GetNumberHaloVertices(unsigned short iMarker) const { unsigned long nHaloVertices, iVertex, iPoint; @@ -267,7 +190,7 @@ unsigned long CDriver::GetNumberHaloVertices(unsigned short iMarker){ } -unsigned long CDriver::GetVertexGlobalIndex(unsigned short iMarker, unsigned long iVertex) { +unsigned long CDriver::GetVertexGlobalIndex(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint, GlobalIndex; @@ -278,7 +201,7 @@ unsigned long CDriver::GetVertexGlobalIndex(unsigned short iMarker, unsigned lon } -bool CDriver::IsAHaloNode(unsigned short iMarker, unsigned long iVertex) { +bool CDriver::IsAHaloNode(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; @@ -288,212 +211,69 @@ bool CDriver::IsAHaloNode(unsigned short iMarker, unsigned long iVertex) { } -unsigned long CDriver::GetnTimeIter() { - - return config_container[ZONE_0]->GetnTime_Iter(); -} - -unsigned long CDriver::GetTime_Iter() const{ - - return TimeIter; -} - -passivedouble CDriver::GetUnsteady_TimeStep(){ - - return SU2_TYPE::GetValue(config_container[ZONE_0]->GetTime_Step()); -} - -passivedouble CDriver::GetVertexCoordX(unsigned short iMarker, unsigned long iVertex) { - - su2double* Coord; - unsigned long iPoint; - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint); - return SU2_TYPE::GetValue(Coord[0]); - -} - -passivedouble CDriver::GetVertexCoordY(unsigned short iMarker, unsigned long iVertex) { - - su2double* Coord; - unsigned long iPoint; - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint); - return SU2_TYPE::GetValue(Coord[1]); -} +vector CDriver::GetInitialMeshCoord(unsigned short iMarker, unsigned long iVertex) const { -passivedouble CDriver::GetVertexCoordZ(unsigned short iMarker, unsigned long iVertex) { + vector coord(3,0.0); + vector coord_passive(3, 0.0); - su2double* Coord; - unsigned long iPoint; - - if(nDim == 3) { - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint); - return SU2_TYPE::GetValue(Coord[2]); + auto iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); + for (auto iDim = 0 ; iDim < nDim ; iDim++){ + coord[iDim] = solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->GetMesh_Coord(iPoint,iDim); } - else { - return 0.0; - } - -} - -bool CDriver::ComputeVertexForces(unsigned short iMarker, unsigned long iVertex) { - - unsigned long iPoint; - unsigned short iDim, jDim; - su2double *Normal, AreaSquare, Area; - bool halo; - - unsigned short FinestMesh = config_container[ZONE_0]->GetFinestMesh(); - - /*--- Check the kind of fluid problem ---*/ - bool compressible = (config_container[ZONE_0]->GetKind_Regime() == COMPRESSIBLE); - bool incompressible = (config_container[ZONE_0]->GetKind_Regime() == INCOMPRESSIBLE); - bool viscous_flow = ((config_container[ZONE_0]->GetKind_Solver() == NAVIER_STOKES) || - (config_container[ZONE_0]->GetKind_Solver() == RANS) ); - - /*--- Parameters for the calculations ---*/ - // Pn: Pressure - // Pinf: Pressure_infinite - su2double Pn = 0.0; - su2double Viscosity = 0.0; - su2double Tau[3][3] = {{0.0}}; - su2double Pinf = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetPressure_Inf(); - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - - /*--- It is necessary to distinguish the halo nodes from the others, since they introduce non physical forces. ---*/ - if(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint)) { - /*--- Get the normal at the vertex: this normal goes inside the fluid domain. ---*/ - Normal = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNormal(); - AreaSquare = 0.0; - for(iDim = 0; iDim < nDim; iDim++) { - AreaSquare += Normal[iDim]*Normal[iDim]; - } - Area = sqrt(AreaSquare); - - /*--- Get the values of pressure and viscosity ---*/ - Pn = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetPressure(iPoint); - if (viscous_flow) { - Viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); - } - - /*--- Calculate the inviscid (pressure) part of tn in the fluid nodes (force units) ---*/ - for (iDim = 0; iDim < nDim; iDim++) { - PyWrapNodalForce[iDim] = -(Pn-Pinf)*Normal[iDim]; //NB : norm(Normal) = Area - } - - /*--- Calculate the viscous (shear stress) part of tn in the fluid nodes (force units) ---*/ - if ((incompressible || compressible) && viscous_flow) { - CNumerics::ComputeStressTensor(nDim, Tau, - solver_container[ZONE_0][INST_0][FinestMesh][FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint)+1, Viscosity); - for (iDim = 0; iDim < nDim; iDim++) { - for (jDim = 0 ; jDim < nDim; jDim++) { - PyWrapNodalForce[iDim] += Tau[iDim][jDim]*Normal[jDim]; - } - } - } - - //Divide by local are in case of force density communication. - for(iDim = 0; iDim < nDim; iDim++) { - PyWrapNodalForceDensity[iDim] = PyWrapNodalForce[iDim]/Area; - } - - halo = false; - } - else { - halo = true; - } - - return halo; + coord_passive[0] = SU2_TYPE::GetValue(coord[0]); + coord_passive[1] = SU2_TYPE::GetValue(coord[1]); + coord_passive[2] = SU2_TYPE::GetValue(coord[2]); + return coord_passive; } -passivedouble CDriver::GetVertexForceX(unsigned short iMarker, unsigned long iVertex) { +vector CDriver::GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex) const { - return SU2_TYPE::GetValue(PyWrapNodalForce[0]); - -} - -passivedouble CDriver::GetVertexForceY(unsigned short iMarker, unsigned long iVertex) { - - return SU2_TYPE::GetValue(PyWrapNodalForce[1]); - -} - -passivedouble CDriver::GetVertexForceZ(unsigned short iMarker, unsigned long iVertex) { + su2double *Normal; + su2double Area; + vector ret_Normal(3, 0.0); + vector ret_Normal_passive(3, 0.0); - return SU2_TYPE::GetValue(PyWrapNodalForce[2]); + Normal = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNormal(); -} + Area = GeometryToolbox::Norm(nDim, Normal); -passivedouble CDriver::GetVertexForceDensityX(unsigned short iMarker, unsigned long iVertex) { - return SU2_TYPE::GetValue(PyWrapNodalForceDensity[0]); -} + ret_Normal[0] = Normal[0]/Area; + ret_Normal[1] = Normal[1]/Area; + if(nDim>2) ret_Normal[2] = Normal[2]/Area; -passivedouble CDriver::GetVertexForceDensityY(unsigned short iMarker, unsigned long iVertex) { - return SU2_TYPE::GetValue(PyWrapNodalForceDensity[1]); -} + ret_Normal_passive[0] = SU2_TYPE::GetValue(ret_Normal[0]); + ret_Normal_passive[1] = SU2_TYPE::GetValue(ret_Normal[1]); + ret_Normal_passive[2] = SU2_TYPE::GetValue(ret_Normal[2]); -passivedouble CDriver::GetVertexForceDensityZ(unsigned short iMarker, unsigned long iVertex) { - return SU2_TYPE::GetValue(PyWrapNodalForceDensity[2]); + return ret_Normal_passive; } -void CDriver::SetVertexCoordX(unsigned short iMarker, unsigned long iVertex, passivedouble newPosX) { +////////////////////////////////////////////////////////////////////////////////// +/* Functions to obtain global parameters from SU2 (time steps, delta t, ecc...) */ +////////////////////////////////////////////////////////////////////////////////// - unsigned long iPoint; - su2double *Coord; - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint); - - PyWrapVarCoord[0] = newPosX - Coord[0]; +unsigned long CDriver::GetnTimeIter() const { + return config_container[ZONE_0]->GetnTime_Iter(); } -void CDriver::SetVertexCoordY(unsigned short iMarker, unsigned long iVertex, passivedouble newPosY) { - - unsigned long iPoint; - su2double *Coord; - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint); +unsigned long CDriver::GetTime_Iter() const{ - PyWrapVarCoord[1] = newPosY - Coord[1]; + return TimeIter; } -void CDriver::SetVertexCoordZ(unsigned short iMarker, unsigned long iVertex, passivedouble newPosZ) { - - unsigned long iPoint; - su2double *Coord; - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - Coord = geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetCoord(iPoint); +passivedouble CDriver::GetUnsteady_TimeStep() const { - if(nDim > 2) { - PyWrapVarCoord[2] = newPosZ - Coord[2]; - } - else { - PyWrapVarCoord[2] = 0.0; - } + return SU2_TYPE::GetValue(config_container[ZONE_0]->GetTime_Step()); } -passivedouble CDriver::SetVertexVarCoord(unsigned short iMarker, unsigned long iVertex) { - - su2double nodalVarCoordNorm; +/////////////////////////////////////////////////////////////////////////////// +/* Functions related to CHT solver */ +/////////////////////////////////////////////////////////////////////////////// - geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->SetVarCoord(PyWrapVarCoord); - nodalVarCoordNorm = sqrt((PyWrapVarCoord[0])*(PyWrapVarCoord[0]) + (PyWrapVarCoord[1])*(PyWrapVarCoord[1]) + (PyWrapVarCoord[2])*(PyWrapVarCoord[2])); - - return SU2_TYPE::GetValue(nodalVarCoordNorm); - -} - -passivedouble CDriver::GetVertexTemperature(unsigned short iMarker, unsigned long iVertex){ +passivedouble CDriver::GetVertexTemperature(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; su2double vertexWallTemp(0.0); @@ -515,7 +295,7 @@ void CDriver::SetVertexTemperature(unsigned short iMarker, unsigned long iVertex geometry_container[ZONE_0][INST_0][MESH_0]->SetCustomBoundaryTemperature(iMarker, iVertex, val_WallTemp); } -bool CDriver::ComputeVertexHeatFluxes(unsigned short iMarker, unsigned long iVertex){ +vector CDriver::GetVertexHeatFluxes(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; unsigned short iDim; @@ -525,48 +305,31 @@ bool CDriver::ComputeVertexHeatFluxes(unsigned short iMarker, unsigned long iVer su2double Gamma_Minus_One = Gamma - 1.0; su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant; su2double laminar_viscosity, thermal_conductivity; - su2double GradT[3] = {0.0,0.0,0.0}; + vector GradT (3,0.0); + vector HeatFlux (3,0.0); + vector HeatFluxPassive (3,0.0); bool compressible = (config_container[ZONE_0]->GetKind_Regime() == COMPRESSIBLE); - bool halo; iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - if(geometry_container[ZONE_0][INST_0][MESH_0]->nodes->GetDomain(iPoint)){ - halo = false; - } - else{ - halo = true; - } - - if(!halo && compressible){ + if(compressible){ laminar_viscosity = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetLaminarViscosity(iPoint); thermal_conductivity = Cp * (laminar_viscosity/Prandtl_Lam); for(iDim=0; iDim < nDim; iDim++){ GradT[iDim] = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->GetNodes()->GetGradient_Primitive(iPoint, 0, iDim); - PyWrapNodalHeatFlux[iDim] = -thermal_conductivity*GradT[iDim]; + HeatFlux[iDim] = -thermal_conductivity*GradT[iDim]; } } - return halo; -} - -passivedouble CDriver::GetVertexHeatFluxX(unsigned short iMarker, unsigned long iVertex){ - - return SU2_TYPE::GetValue(PyWrapNodalHeatFlux[0]); -} - -passivedouble CDriver::GetVertexHeatFluxY(unsigned short iMarker, unsigned long iVertex){ + HeatFluxPassive[0] = SU2_TYPE::GetValue(HeatFlux[0]); + HeatFluxPassive[1] = SU2_TYPE::GetValue(HeatFlux[1]); + HeatFluxPassive[2] = SU2_TYPE::GetValue(HeatFlux[2]); - return SU2_TYPE::GetValue(PyWrapNodalHeatFlux[1]); + return HeatFluxPassive; } -passivedouble CDriver::GetVertexHeatFluxZ(unsigned short iMarker, unsigned long iVertex){ - - return SU2_TYPE::GetValue(PyWrapNodalHeatFlux[2]); -} - -passivedouble CDriver::GetVertexNormalHeatFlux(unsigned short iMarker, unsigned long iVertex){ +passivedouble CDriver::GetVertexNormalHeatFlux(unsigned short iMarker, unsigned long iVertex) const{ unsigned long iPoint; unsigned short iDim; @@ -614,7 +377,7 @@ void CDriver::SetVertexNormalHeatFlux(unsigned short iMarker, unsigned long iVer geometry_container[ZONE_0][INST_0][MESH_0]->SetCustomBoundaryHeatFlux(iMarker, iVertex, val_WallHeatFlux); } -passivedouble CDriver::GetThermalConductivity(unsigned short iMarker, unsigned long iVertex){ +passivedouble CDriver::GetThermalConductivity(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; su2double Prandtl_Lam = config_container[ZONE_0]->GetPrandtl_Lam(); @@ -632,31 +395,11 @@ passivedouble CDriver::GetThermalConductivity(unsigned short iMarker, unsigned l } -vector CDriver::GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex){ - - su2double *Normal; - su2double Area; - vector ret_Normal(3, 0.0); - vector ret_Normal_passive(3, 0.0); - - Normal = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNormal(); +//////////////////////////////////////////////////////////////////////////////// +/* Functions related to the management of markers */ +//////////////////////////////////////////////////////////////////////////////// - Area = GeometryToolbox::Norm(nDim, Normal); - - ret_Normal[0] = Normal[0]/Area; - ret_Normal[1] = Normal[1]/Area; - if(nDim>2) ret_Normal[2] = Normal[2]/Area; - - ret_Normal_passive[0] = SU2_TYPE::GetValue(ret_Normal[0]); - ret_Normal_passive[1] = SU2_TYPE::GetValue(ret_Normal[1]); - ret_Normal_passive[2] = SU2_TYPE::GetValue(ret_Normal[2]); - - return ret_Normal_passive; - - -} - -vector CDriver::GetAllBoundaryMarkersTag(){ +vector CDriver::GetAllBoundaryMarkersTag() const { vector boundariesTagList; unsigned short iMarker,nBoundariesMarkers; @@ -673,24 +416,7 @@ vector CDriver::GetAllBoundaryMarkersTag(){ return boundariesTagList; } -vector CDriver::GetAllMovingMarkersTag(){ - - vector movingBoundariesTagList; - unsigned short iMarker, nBoundariesMarker; - string Marker_Tag; - - nBoundariesMarker = config_container[ZONE_0]->GetnMarker_Moving(); - movingBoundariesTagList.resize(nBoundariesMarker); - - for(iMarker=0; iMarker < nBoundariesMarker; iMarker++){ - Marker_Tag = config_container[ZONE_0]->GetMarker_Moving_TagBound(iMarker); - movingBoundariesTagList[iMarker] = Marker_Tag; - } - - return movingBoundariesTagList; -} - -vector CDriver::GetAllDeformMeshMarkersTag(){ +vector CDriver::GetAllDeformMeshMarkersTag() const { vector interfaceBoundariesTagList; unsigned short iMarker, nBoundariesMarker; @@ -707,31 +433,13 @@ vector CDriver::GetAllDeformMeshMarkersTag(){ return interfaceBoundariesTagList; } -vector CDriver::GetAllFluidLoadMarkersTag(){ - - vector interfaceBoundariesTagList; - unsigned short iMarker, nBoundariesMarker; - string Marker_Tag; - - nBoundariesMarker = config_container[ZONE_0]->GetnMarker_Fluid_Load(); - interfaceBoundariesTagList.resize(nBoundariesMarker); - - for(iMarker=0; iMarker < nBoundariesMarker; iMarker++){ - Marker_Tag = config_container[ZONE_0]->GetMarker_Fluid_Load_TagBound(iMarker); - interfaceBoundariesTagList[iMarker] = Marker_Tag; - } - - return interfaceBoundariesTagList; -} - -vector CDriver::GetAllCHTMarkersTag(){ +vector CDriver::GetAllCHTMarkersTag() const { vector CHTBoundariesTagList; unsigned short iMarker, nBoundariesMarker; string Marker_Tag; nBoundariesMarker = config_container[ZONE_0]->GetnMarker_All(); - //CHTBoundariesTagList.resize(nBoundariesMarker); //The CHT markers can be identified as the markers that are customizable with a BC type HEAT_FLUX or ISOTHERMAL. for(iMarker=0; iMarker CDriver::GetAllCHTMarkersTag(){ return CHTBoundariesTagList; } -vector CDriver::GetAllInletMarkersTag(){ +vector CDriver::GetAllInletMarkersTag() const { vector BoundariesTagList; unsigned short iMarker, nBoundariesMarker; @@ -764,7 +472,7 @@ vector CDriver::GetAllInletMarkersTag(){ return BoundariesTagList; } -map CDriver::GetAllBoundaryMarkers(){ +map CDriver::GetAllBoundaryMarkers() const { map allBoundariesMap; unsigned short iMarker, nBoundaryMarkers; @@ -780,7 +488,7 @@ map CDriver::GetAllBoundaryMarkers(){ return allBoundariesMap; } -map CDriver::GetAllBoundaryMarkersType(){ +map CDriver::GetAllBoundaryMarkersType() const { map allBoundariesTypeMap; unsigned short iMarker, KindBC; @@ -823,6 +531,34 @@ map CDriver::GetAllBoundaryMarkersType(){ return allBoundariesTypeMap; } +void CDriver::SetHeatSource_Position(passivedouble alpha, passivedouble pos_x, passivedouble pos_y, passivedouble pos_z){ + + CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][RAD_SOL]; + + config_container[ZONE_0]->SetHeatSource_Rot_Z(alpha); + config_container[ZONE_0]->SetHeatSource_Center(pos_x, pos_y, pos_z); + + solver->SetVolumetricHeatSource(geometry_container[ZONE_0][INST_0][MESH_0], config_container[ZONE_0]); + +} + +void CDriver::SetInlet_Angle(unsigned short iMarker, passivedouble alpha){ + + su2double alpha_rad = alpha * PI_NUMBER/180.0; + + unsigned long iVertex; + + for (iVertex = 0; iVertex < geometry_container[ZONE_0][INST_0][MESH_0]->nVertex[iMarker]; iVertex++){ + solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->SetInlet_FlowDir(iMarker, iVertex, 0, cos(alpha_rad)); + solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->SetInlet_FlowDir(iMarker, iVertex, 1, sin(alpha_rad)); + } + +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* Functions related to simulation control, high level functions (reset convergence, set initial mesh, ecc...) */ +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CDriver::ResetConvergence() { for(iZone = 0; iZone < nZone; iZone++) { @@ -850,44 +586,6 @@ void CDriver::ResetConvergence() { } -void CFluidDriver::StaticMeshUpdate() { - - int rank = MASTER_NODE; - -#ifdef HAVE_MPI - MPI_Comm_rank(MPI_COMM_WORLD, &rank); -#endif - - for(iZone = 0; iZone < nZone; iZone++) { - if(rank == MASTER_NODE) cout << " Deforming the volume grid." << endl; - grid_movement[iZone][INST_0]->SetVolume_Deformation(geometry_container[iZone][INST_0][MESH_0], config_container[iZone], true); - - if(rank == MASTER_NODE) cout << "No grid velocity to be computde : static grid deformation." << endl; - - if(rank == MASTER_NODE) cout << " Updating multigrid structure." << endl; - grid_movement[iZone][INST_0]->UpdateMultiGrid(geometry_container[iZone][INST_0], config_container[iZone]); - } -} - -void CFluidDriver::SetInitialMesh() { - - StaticMeshUpdate(); - - /*--- Propagate the initial deformation to the past ---*/ - //if (!restart) { - for(iZone = 0; iZone < nZone; iZone++) { - for (iMesh = 0; iMesh <= config_container[iZone]->GetnMGLevels(); iMesh++) { - //solver_container[iZone][iMesh][FLOW_SOL]->nodes->Set_Solution_time_n(iPoint); - //solver_container[iZone][iMesh][FLOW_SOL]->nodes->Set_Solution_time_n1(iPoint); - geometry_container[iZone][INST_0][iMesh]->nodes->SetVolume_n(); - geometry_container[iZone][INST_0][iMesh]->nodes->SetVolume_nM1(); - geometry_container[iZone][INST_0][iMesh]->nodes->SetCoord_n(); - geometry_container[iZone][INST_0][iMesh]->nodes->SetCoord_n1(); - } - } - //} -} - void CSinglezoneDriver::SetInitialMesh() { DynamicMeshUpdate(0); @@ -914,52 +612,12 @@ void CSinglezoneDriver::SetInitialMesh() { } } -void CFluidDriver::SetVertexTtotal(unsigned short iMarker, unsigned long iVertex, passivedouble val_Ttotal_passive){ - - su2double val_Ttotal = val_Ttotal_passive; - - solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->SetInlet_Ttotal(iMarker, iVertex, val_Ttotal); - -} - -void CFluidDriver::SetVertexPtotal(unsigned short iMarker, unsigned long iVertex, passivedouble val_Ptotal_passive){ - - su2double val_Ptotal = val_Ptotal_passive; - - solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->SetInlet_Ptotal(iMarker, iVertex, val_Ptotal); - -} - -void CFluidDriver::SetVertexFlowDir(unsigned short iMarker, unsigned long iVertex, unsigned short iDim, passivedouble val_FlowDir_passive){ - - su2double val_FlowDir = val_FlowDir_passive; - - solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->SetInlet_FlowDir(iMarker, iVertex, iDim, val_FlowDir); - -} - -void CFluidDriver::SetVertexTurbVar(unsigned short iMarker, unsigned long iVertex, unsigned short iDim, passivedouble val_turb_var_passive){ - - su2double val_turb_var = val_turb_var_passive; - - if (solver_container[ZONE_0][INST_0] == nullptr || - solver_container[ZONE_0][INST_0][MESH_0] == nullptr) { - SU2_MPI::Error("Could not find an appropriate solver.", CURRENT_FUNCTION); - } else if (solver_container[ZONE_0][INST_0][MESH_0][TURB_SOL] == nullptr) { - SU2_MPI::Error("Tried to set turbulence variables without a turbulence solver.", CURRENT_FUNCTION); - } - solver_container[ZONE_0][INST_0][MESH_0][TURB_SOL]->SetInlet_TurbVar(iMarker, iVertex, iDim, val_turb_var); - -} - -void CFluidDriver::BoundaryConditionsUpdate(){ +void CDriver::BoundaryConditionsUpdate(){ int rank = MASTER_NODE; unsigned short iZone; -#ifdef HAVE_MPI - MPI_Comm_rank(MPI_COMM_WORLD, &rank); -#endif + SU2_MPI::Comm_rank(SU2_MPI::GetComm(), &rank); if(rank == MASTER_NODE) cout << "Updating boundary conditions." << endl; for(iZone = 0; iZone < nZone; iZone++){ @@ -967,67 +625,25 @@ void CFluidDriver::BoundaryConditionsUpdate(){ } } -void CDriver::SetMeshDisplacement(unsigned short iMarker, unsigned long iVertex, passivedouble DispX, passivedouble DispY, passivedouble DispZ) { - - unsigned long iPoint; - PyWrapVarCoord[0] = DispX; - PyWrapVarCoord[1] = DispY; - PyWrapVarCoord[2] = DispZ; - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->SetBound_Disp(iPoint,PyWrapVarCoord); - -} - -void CDriver::CommunicateMeshDisplacement(void) { - - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->InitiateComms(geometry_container[ZONE_0][INST_0][MESH_0], - config_container[ZONE_0], MESH_DISPLACEMENTS); - solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->CompleteComms(geometry_container[ZONE_0][INST_0][MESH_0], - config_container[ZONE_0], MESH_DISPLACEMENTS); - -} - -vector CDriver::GetMeshDisp_Sensitivity(unsigned short iMarker, unsigned long iVertex) { - - unsigned long iPoint; - vector Disp_Sens(3, 0.0); - vector Disp_Sens_passive(3, 0.0); - - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][ADJMESH_SOL]; - CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; - - Disp_Sens[0] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 0); - Disp_Sens[1] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 1); - if (geometry->GetnDim() == 3) - Disp_Sens[2] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 2); - else - Disp_Sens[2] = 0.0; - - Disp_Sens_passive[0] = SU2_TYPE::GetValue(Disp_Sens[0]); - Disp_Sens_passive[1] = SU2_TYPE::GetValue(Disp_Sens[1]); - Disp_Sens_passive[2] = SU2_TYPE::GetValue(Disp_Sens[2]); - - return Disp_Sens_passive; - -} +//////////////////////////////////////////////////////////////////////////////// +/* Functions related to finite elements */ +//////////////////////////////////////////////////////////////////////////////// void CDriver::SetFEA_Loads(unsigned short iMarker, unsigned long iVertex, passivedouble LoadX, passivedouble LoadY, passivedouble LoadZ) { unsigned long iPoint; - PyWrapNodalForce[0] = LoadX; - PyWrapNodalForce[1] = LoadY; - PyWrapNodalForce[2] = LoadZ; + su2double NodalForce[3] = {0.0,0.0,0.0}; + NodalForce[0] = LoadX; + NodalForce[1] = LoadY; + NodalForce[2] = LoadZ; iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - solver_container[ZONE_0][INST_0][MESH_0][FEA_SOL]->GetNodes()->Set_FlowTraction(iPoint,PyWrapNodalForce); + solver_container[ZONE_0][INST_0][MESH_0][FEA_SOL]->GetNodes()->Set_FlowTraction(iPoint,NodalForce); } -vector CDriver::GetFEA_Displacements(unsigned short iMarker, unsigned long iVertex) { +vector CDriver::GetFEA_Displacements(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; vector Displacements(3, 0.0); @@ -1052,7 +668,7 @@ vector CDriver::GetFEA_Displacements(unsigned short iMarker, unsi } -vector CDriver::GetFEA_Velocity(unsigned short iMarker, unsigned long iVertex) { +vector CDriver::GetFEA_Velocity(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; vector Velocity(3, 0.0); @@ -1070,11 +686,6 @@ vector CDriver::GetFEA_Velocity(unsigned short iMarker, unsigned else Velocity[2] = 0.0; } - else{ - Velocity[0] = 0.0; - Velocity[1] = 0.0; - Velocity[2] = 0.0; - } Velocity_passive[0] = SU2_TYPE::GetValue(Velocity[0]); Velocity_passive[1] = SU2_TYPE::GetValue(Velocity[1]); @@ -1083,7 +694,7 @@ vector CDriver::GetFEA_Velocity(unsigned short iMarker, unsigned return Velocity_passive; } -vector CDriver::GetFEA_Velocity_n(unsigned short iMarker, unsigned long iVertex) { +vector CDriver::GetFEA_Velocity_n(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; vector Velocity_n(3, 0.0); @@ -1101,11 +712,6 @@ vector CDriver::GetFEA_Velocity_n(unsigned short iMarker, unsigne else Velocity_n[2] = 0.0; } - else{ - Velocity_n[0] = 0.0; - Velocity_n[1] = 0.0; - Velocity_n[2] = 0.0; - } Velocity_n_passive[0] = SU2_TYPE::GetValue(Velocity_n[0]); Velocity_n_passive[1] = SU2_TYPE::GetValue(Velocity_n[1]); @@ -1115,7 +721,36 @@ vector CDriver::GetFEA_Velocity_n(unsigned short iMarker, unsigne } -vector CDriver::GetFlowLoad_Sensitivity(unsigned short iMarker, unsigned long iVertex) { +//////////////////////////////////////////////////////////////////////////////// +/* Functions related to adjoint simulations */ +//////////////////////////////////////////////////////////////////////////////// + +vector CDriver::GetMeshDisp_Sensitivity(unsigned short iMarker, unsigned long iVertex) const { + + unsigned long iPoint; + vector Disp_Sens(3, 0.0); + vector Disp_Sens_passive(3, 0.0); + + iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); + CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][ADJMESH_SOL]; + CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; + + Disp_Sens[0] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 0); + Disp_Sens[1] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 1); + if (geometry->GetnDim() == 3) + Disp_Sens[2] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 2); + else + Disp_Sens[2] = 0.0; + + Disp_Sens_passive[0] = SU2_TYPE::GetValue(Disp_Sens[0]); + Disp_Sens_passive[1] = SU2_TYPE::GetValue(Disp_Sens[1]); + Disp_Sens_passive[2] = SU2_TYPE::GetValue(Disp_Sens[2]); + + return Disp_Sens_passive; + +} + +vector CDriver::GetFlowLoad_Sensitivity(unsigned short iMarker, unsigned long iVertex) const { unsigned long iPoint; vector FlowLoad_Sens(3, 0.0); @@ -1140,36 +775,6 @@ vector CDriver::GetFlowLoad_Sensitivity(unsigned short iMarker, u } -vector CDriver::GetFlowLoad(unsigned short iMarker, unsigned long iVertex) { - - vector FlowLoad(3, 0.0); - vector FlowLoad_passive(3, 0.0); - - CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]; - CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; - - if (config_container[ZONE_0]->GetMarker_All_Fluid_Load(iMarker) == YES) { - FlowLoad[0] = solver->GetVertexTractions(iMarker, iVertex, 0); - FlowLoad[1] = solver->GetVertexTractions(iMarker, iVertex, 1); - if (geometry->GetnDim() == 3) - FlowLoad[2] = solver->GetVertexTractions(iMarker, iVertex, 2); - else - FlowLoad[2] = 0.0; - } - else{ - FlowLoad[0] = 0.0; - FlowLoad[1] = 0.0; - FlowLoad[2] = 0.0; - } - - FlowLoad_passive[0] = SU2_TYPE::GetValue(FlowLoad[0]); - FlowLoad_passive[1] = SU2_TYPE::GetValue(FlowLoad[1]); - FlowLoad_passive[2] = SU2_TYPE::GetValue(FlowLoad[2]); - - return FlowLoad_passive; - -} - void CDriver::SetFlowLoad_Adjoint(unsigned short iMarker, unsigned long iVertex, passivedouble val_AdjointX, passivedouble val_AdjointY, passivedouble val_AdjointZ) { @@ -1199,58 +804,59 @@ void CDriver::SetSourceTerm_DispAdjoint(unsigned short iMarker, unsigned long iV } -vector CDriver::GetVertex_UndeformedCoord(unsigned short iMarker, unsigned long iVertex) { +//////////////////////////////////////////////////////////////////////////////// +/* Functions related to mesh deformation */ +//////////////////////////////////////////////////////////////////////////////// - unsigned long iPoint; - vector MeshCoord(3, 0.0); - vector MeshCoord_passive(3, 0.0); +void CDriver::SetMeshDisplacement(unsigned short iMarker, unsigned long iVertex, passivedouble DispX, passivedouble DispY, passivedouble DispZ) { - CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]; - CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; - iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); + unsigned long iPoint; + su2double MeshDispl[3] = {0.0,0.0,0.0}; - if (solver != nullptr) { - MeshCoord[0] = solver->GetNodes()->GetMesh_Coord(iPoint,0); - MeshCoord[1] = solver->GetNodes()->GetMesh_Coord(iPoint,1); - if (geometry->GetnDim() == 3) - MeshCoord[2] = solver->GetNodes()->GetMesh_Coord(iPoint,2); - else - MeshCoord[2] = 0.0; - } - else{ - MeshCoord[0] = 0.0; - MeshCoord[1] = 0.0; - MeshCoord[2] = 0.0; - } + MeshDispl[0] = DispX; + MeshDispl[1] = DispY; + MeshDispl[2] = DispZ; - MeshCoord_passive[0] = SU2_TYPE::GetValue(MeshCoord[0]); - MeshCoord_passive[1] = SU2_TYPE::GetValue(MeshCoord[1]); - MeshCoord_passive[2] = SU2_TYPE::GetValue(MeshCoord[2]); + iPoint = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNode(); - return MeshCoord_passive; + solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->GetNodes()->SetBound_Disp(iPoint,MeshDispl); } -void CDriver::SetHeatSource_Position(passivedouble alpha, passivedouble pos_x, passivedouble pos_y, passivedouble pos_z){ - - CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][RAD_SOL]; - - config_container[ZONE_0]->SetHeatSource_Rot_Z(alpha); - config_container[ZONE_0]->SetHeatSource_Center(pos_x, pos_y, pos_z); +void CDriver::CommunicateMeshDisplacement(void) { - solver->SetVolumetricHeatSource(geometry_container[ZONE_0][INST_0][MESH_0], config_container[ZONE_0]); + solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->InitiateComms(geometry_container[ZONE_0][INST_0][MESH_0], + config_container[ZONE_0], MESH_DISPLACEMENTS); + solver_container[ZONE_0][INST_0][MESH_0][MESH_SOL]->CompleteComms(geometry_container[ZONE_0][INST_0][MESH_0], + config_container[ZONE_0], MESH_DISPLACEMENTS); } -void CDriver::SetInlet_Angle(unsigned short iMarker, passivedouble alpha){ +//////////////////////////////////////////////////////////////////////////////// +/* Functions related to flow loads */ +//////////////////////////////////////////////////////////////////////////////// - su2double alpha_rad = alpha * PI_NUMBER/180.0; +vector CDriver::GetFlowLoad(unsigned short iMarker, unsigned long iVertex) const { - unsigned long iVertex; + vector FlowLoad(3, 0.0); + vector FlowLoad_passive(3, 0.0); - for (iVertex = 0; iVertex < geometry_container[ZONE_0][INST_0][MESH_0]->nVertex[iMarker]; iVertex++){ - solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->SetInlet_FlowDir(iMarker, iVertex, 0, cos(alpha_rad)); - solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]->SetInlet_FlowDir(iMarker, iVertex, 1, sin(alpha_rad)); + CSolver *solver = solver_container[ZONE_0][INST_0][MESH_0][FLOW_SOL]; + CGeometry *geometry = geometry_container[ZONE_0][INST_0][MESH_0]; + + if (config_container[ZONE_0]->GetSolid_Wall(iMarker)) { + FlowLoad[0] = solver->GetVertexTractions(iMarker, iVertex, 0); + FlowLoad[1] = solver->GetVertexTractions(iMarker, iVertex, 1); + if (geometry->GetnDim() == 3) + FlowLoad[2] = solver->GetVertexTractions(iMarker, iVertex, 2); + else + FlowLoad[2] = 0.0; } + FlowLoad_passive[0] = SU2_TYPE::GetValue(FlowLoad[0]); + FlowLoad_passive[1] = SU2_TYPE::GetValue(FlowLoad[1]); + FlowLoad_passive[2] = SU2_TYPE::GetValue(FlowLoad[2]); + + return FlowLoad_passive; + } diff --git a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp index 3ffa769de6f6..de3ec622236f 100644 --- a/SU2_CFD/src/solvers/CAdjEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjEulerSolver.cpp @@ -2,7 +2,7 @@ * \file CAdjEulerSolver.cpp * \brief Main subroutines for solving Euler adjoint problems. * \author F. Palacios, T. Economon, H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -316,7 +316,7 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned #ifdef HAVE_MPI Area_Monitored = 0.0; - SU2_MPI::Allreduce(&myArea_Monitored, &Area_Monitored, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&myArea_Monitored, &Area_Monitored, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #else Area_Monitored = myArea_Monitored; #endif @@ -478,7 +478,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo /*--- Communicate the counts to iDomain with non-blocking sends ---*/ - SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, MPI_COMM_WORLD, &req); + SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } else { @@ -504,7 +504,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo /*--- Recv the data by probing for the current sender, jDomain, first and then receiving the values from it. ---*/ - SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, SU2_MPI::GetComm(), &status); } } @@ -514,7 +514,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Initialize the counters for the larger send buffers (by domain) ---*/ @@ -568,7 +568,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo SU2_MPI::Isend(&Buffer_Send_AdjVar[PointTotal_Counter*(nVar+3)], nPointTotal_s[iDomain]*(nVar+3), MPI_DOUBLE, iDomain, - iDomain, MPI_COMM_WORLD, &req); + iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } @@ -612,7 +612,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- The next section begins the recv of all data for the interior points/elements in the mesh. First, create the domain structures for @@ -632,7 +632,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo /*--- Receive the buffers with the coords, global index, and colors ---*/ SU2_MPI::Recv(Buffer_Receive_AdjVar, nPointTotal_r[iDomain]*(nVar+3) , MPI_DOUBLE, - iDomain, rank, MPI_COMM_WORLD, &status); + iDomain, rank, SU2_MPI::GetComm(), &status); /*--- Loop over all of the points that we have recv'd and store the coords, global index vertex and markers ---*/ @@ -664,7 +664,7 @@ void CAdjEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geo /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Free all of the memory used for communicating points and elements ---*/ @@ -711,7 +711,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { nDomain = size; - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- This loop gets the array sizes of points for each rank to send to each other rank. ---*/ @@ -763,7 +763,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Communicate the counts to iDomain with non-blocking sends ---*/ - SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, MPI_COMM_WORLD, &req); + SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } else { @@ -789,7 +789,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Recv the data by probing for the current sender, jDomain, first and then receiving the values from it. ---*/ - SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, SU2_MPI::GetComm(), &status); } } @@ -799,7 +799,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Initialize the counters for the larger send buffers (by domain) ---*/ @@ -852,7 +852,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { SU2_MPI::Isend(&Buffer_Send_AdjVar[PointTotal_Counter*(nVar+3)], nPointTotal_s[iDomain]*(nVar+3), MPI_DOUBLE, iDomain, - iDomain, MPI_COMM_WORLD, &req); + iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } @@ -896,7 +896,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- The next section begins the recv of all data for the interior points/elements in the mesh. First, create the domain structures for @@ -916,7 +916,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Receive the buffers with the coords, global index, and colors ---*/ SU2_MPI::Recv(Buffer_Receive_AdjVar, nPointTotal_r[iDomain]*(nVar+3) , MPI_DOUBLE, - iDomain, rank, MPI_COMM_WORLD, &status); + iDomain, rank, SU2_MPI::GetComm(), &status); /*--- Loop over all of the points that we have recv'd and store the @@ -949,7 +949,7 @@ void CAdjEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Free all of the memory used for communicating points and elements ---*/ @@ -1620,7 +1620,7 @@ void CAdjEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contai if (config->GetComm_Level() == COMM_FULL) { #ifdef HAVE_MPI unsigned long MyErrorCounter = nonPhysicalPoints; nonPhysicalPoints = 0; - SU2_MPI::Allreduce(&MyErrorCounter, &nonPhysicalPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyErrorCounter, &nonPhysicalPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #endif if (iMesh == MESH_0) config->SetNonphysical_Points(nonPhysicalPoints); } @@ -1832,7 +1832,7 @@ void CAdjEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont 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); + SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); #else counter_global = counter_local; #endif @@ -1950,102 +1950,6 @@ void CAdjEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_cont CConfig *config, unsigned short iMesh) { } -void CAdjEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) { - unsigned long iPoint, jPoint, iEdge; - unsigned short iVar; - su2double *Diff; - - Diff = new su2double[nVar]; - - nodes->SetUnd_LaplZero(); - - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { - iPoint = geometry->edges->GetNode(iEdge,0); - jPoint = geometry->edges->GetNode(iEdge,1); - - for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar); - -#ifdef STRUCTURED_GRID - - if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint, Diff); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint, Diff); - -#else - - bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); - bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); - - /*--- Both points inside the domain, or both in the boundary ---*/ - if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint, Diff); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint, Diff); - } - - /*--- iPoint inside the domain, jPoint on the boundary ---*/ - if (!boundary_i && boundary_j) - if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint, Diff); - - /*--- jPoint inside the domain, iPoint on the boundary ---*/ - if (boundary_i && !boundary_j) - if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint, Diff); - -#endif - - } - -#ifdef STRUCTURED_GRID - - unsigned long Point_Normal = 0, iVertex; - unsigned short iMarker; - su2double *Psi_mirror; - - Psi_mirror = new su2double[nVar]; - - /*--- Loop over all boundaries and include an extra contribution - from a halo node. Find the nearest normal, interior point - for a boundary node and make a linear approximation. ---*/ - for (iMarker = 0; iMarker < nMarker; iMarker++) { - - if (config->GetMarker_All_KindBC(iMarker) != SEND_RECEIVE && - config->GetMarker_All_KindBC(iMarker) != INTERFACE_BOUNDARY && - config->GetMarker_All_KindBC(iMarker) != NEARFIELD_BOUNDARY) { - - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - - if (geometry->nodes->GetDomain(iPoint)) { - - Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor(); - - /*--- Interpolate & compute difference in the conserved variables ---*/ - - for (iVar = 0; iVar < nVar; iVar++) { - Psi_mirror[iVar] = 2.0*nodes->GetSolution(iPoint, iVar) - nodes->GetSolution(Point_Normal, iVar); - Diff[iVar] = nodes->GetSolution(iPoint,iVar) - Psi_mirror[iVar]; - } - - /*--- Subtract contribution at the boundary node only ---*/ - - nodes->SubtractUnd_Lapl(iPoint,Diff); - } - } - } - } - - delete [] Psi_mirror; - -#endif - - delete [] Diff; - - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); - CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); - -} - void CAdjEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfig *config) { unsigned long iPoint; @@ -2696,12 +2600,12 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver su2double MyTotal_Sens_Temp = Total_Sens_Temp; Total_Sens_Temp = 0.0; su2double MyTotal_Sens_BPress = Total_Sens_BPress; Total_Sens_BPress = 0.0; - SU2_MPI::Allreduce(&MyTotal_Sens_Geo, &Total_Sens_Geo, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_Mach, &Total_Sens_Mach, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_AoA, &Total_Sens_AoA, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_Press, &Total_Sens_Press, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_BPress, &Total_Sens_BPress, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyTotal_Sens_Geo, &Total_Sens_Geo, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_Mach, &Total_Sens_Mach, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_AoA, &Total_Sens_AoA, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_Press, &Total_Sens_Press, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_BPress, &Total_Sens_BPress, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #endif @@ -3483,8 +3387,10 @@ void CAdjEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain if (config->GetViscous()) { /*--- Points in edge, coordinates and normal vector---*/ - - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[3]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); /*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/ @@ -3597,7 +3503,10 @@ void CAdjEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_ /*--- Points in edge, coordinates and normal vector---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[3]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); /*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/ @@ -3712,7 +3621,10 @@ void CAdjEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver /*--- Points in edge, coordinates and normal vector---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[3]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); /*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/ @@ -3884,7 +3796,10 @@ void CAdjEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, /*--- Points in edge, coordinates and normal vector---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[3]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); /*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/ @@ -3974,7 +3889,10 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - conv_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[3]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + conv_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Allocate the value at the outlet ---*/ @@ -4164,7 +4082,10 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Points in edge, coordinates and normal vector---*/ visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[3]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Conservative variables w/o reconstruction and adjoint variables w/o reconstruction---*/ @@ -4752,7 +4673,7 @@ void CAdjEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf #ifndef HAVE_MPI rbuf_NotMatching = sbuf_NotMatching; #else - SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, SU2_MPI::GetComm()); #endif if (rbuf_NotMatching != 0) { SU2_MPI::Error(string("The solution file ") + filename + string(" doesn't match with the mesh file!\n") + diff --git a/SU2_CFD/src/solvers/CAdjNSSolver.cpp b/SU2_CFD/src/solvers/CAdjNSSolver.cpp index 980b7b32dde3..d887ab8d7dec 100644 --- a/SU2_CFD/src/solvers/CAdjNSSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjNSSolver.cpp @@ -2,7 +2,7 @@ * \file CAdjNSSolver.cpp * \brief Main subroutines for solving Navier-Stokes adjoint problems. * \author F. Palacios, T. Economon, H. Kline - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -254,7 +254,7 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short #ifdef HAVE_MPI Area_Monitored = 0.0; - SU2_MPI::Allreduce(&myArea_Monitored, &Area_Monitored, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&myArea_Monitored, &Area_Monitored, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #else Area_Monitored = myArea_Monitored; #endif @@ -395,7 +395,7 @@ void CAdjNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container if (config->GetComm_Level() == COMM_FULL) { #ifdef HAVE_MPI unsigned long MyErrorCounter = nonPhysicalPoints; nonPhysicalPoints = 0; - SU2_MPI::Allreduce(&MyErrorCounter, &nonPhysicalPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyErrorCounter, &nonPhysicalPoints, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #endif if (iMesh == MESH_0) config->SetNonphysical_Points(nonPhysicalPoints); } @@ -1155,11 +1155,11 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con su2double MyTotal_Sens_Press = Total_Sens_Press; Total_Sens_Press = 0.0; su2double MyTotal_Sens_Temp = Total_Sens_Temp; Total_Sens_Temp = 0.0; - SU2_MPI::Allreduce(&MyTotal_Sens_Geo, &Total_Sens_Geo, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_Mach, &Total_Sens_Mach, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_AoA, &Total_Sens_AoA, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_Press, &Total_Sens_Press, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotal_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyTotal_Sens_Geo, &Total_Sens_Geo, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_Mach, &Total_Sens_Mach, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_AoA, &Total_Sens_AoA, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_Press, &Total_Sens_Press, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotal_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #endif diff --git a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp index 59b5643032d6..b71a5a5347ec 100644 --- a/SU2_CFD/src/solvers/CAdjTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CAdjTurbSolver.cpp @@ -2,7 +2,7 @@ * \file CAdjTurbVariable.cpp * \brief Main subrotuines for solving turbulent adjoint problems. * \author F. Palacios, A. Bueno, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -161,7 +161,7 @@ CAdjTurbSolver::CAdjTurbSolver(CGeometry *geometry, CConfig *config, unsigned sh #ifndef HAVE_MPI rbuf_NotMatching = sbuf_NotMatching; #else - SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, SU2_MPI::GetComm()); #endif if (rbuf_NotMatching != 0) { SU2_MPI::Error(string("The solution file ") + filename + string(" doesn't match with the mesh file!\n") + diff --git a/SU2_CFD/src/solvers/CBaselineSolver.cpp b/SU2_CFD/src/solvers/CBaselineSolver.cpp index e669add5f441..195c38732651 100644 --- a/SU2_CFD/src/solvers/CBaselineSolver.cpp +++ b/SU2_CFD/src/solvers/CBaselineSolver.cpp @@ -2,7 +2,7 @@ * \file CBaselineSolver.cpp * \brief Main subroutines for CBaselineSolver class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -157,7 +157,7 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) { /*--- All ranks open the file using MPI. ---*/ - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -175,7 +175,7 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) { /*--- Broadcast the number of variables to all procs and store more clearly. ---*/ - SU2_MPI::Bcast(var_buf, nVar_Buf, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(var_buf, nVar_Buf, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ @@ -208,7 +208,7 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) { /*--- Broadcast the string names of the variables. ---*/ SU2_MPI::Bcast(mpi_str_buf, nVar*CGNS_STRING_SIZE, MPI_CHAR, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); fields.push_back("Point_ID"); @@ -283,7 +283,7 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) { /*--- All ranks open the file using MPI. ---*/ - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -298,7 +298,7 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) { /*--- Broadcast the number of variables to all procs and store clearly. ---*/ - SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ diff --git a/SU2_CFD/src/solvers/CBaselineSolver_FEM.cpp b/SU2_CFD/src/solvers/CBaselineSolver_FEM.cpp index 63b07e05d521..bff91f15d622 100644 --- a/SU2_CFD/src/solvers/CBaselineSolver_FEM.cpp +++ b/SU2_CFD/src/solvers/CBaselineSolver_FEM.cpp @@ -2,7 +2,7 @@ * \file CBaselineSolver_FEM.cpp * \brief Main subroutines for CBaselineSolver_FEM class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -65,7 +65,7 @@ CBaselineSolver_FEM::CBaselineSolver_FEM(CGeometry *geometry, CConfig *config) { /*--- Determine the global number of DOFs. ---*/ #ifdef HAVE_MPI - SU2_MPI::Allreduce(&nDOFsLocOwned, &nDOFsGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&nDOFsLocOwned, &nDOFsGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #else nDOFsGlobal = nDOFsLocOwned; #endif @@ -157,7 +157,7 @@ void CBaselineSolver_FEM::SetOutputVariables(CGeometry *geometry, CConfig *confi char fname[100]; strcpy(fname, filename.c_str()); - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -174,7 +174,7 @@ void CBaselineSolver_FEM::SetOutputVariables(CGeometry *geometry, CConfig *confi /*--- Broadcast the number of variables to all procs and store more clearly. ---*/ - SU2_MPI::Bcast(var_buf, nVar_Buf, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(var_buf, nVar_Buf, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ @@ -244,7 +244,7 @@ void CBaselineSolver_FEM::SetOutputVariables(CGeometry *geometry, CConfig *confi char fname[100]; strcpy(fname, filename.c_str()); - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -259,7 +259,7 @@ void CBaselineSolver_FEM::SetOutputVariables(CGeometry *geometry, CConfig *confi /*--- Broadcast the number of variables to all procs and store clearly. ---*/ - SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ @@ -368,7 +368,7 @@ void CBaselineSolver_FEM::LoadRestart(CGeometry **geometry, CSolver ***solver, C #ifdef HAVE_MPI unsigned short sbuf_NotMatching = rbuf_NotMatching; - SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_MAX, SU2_MPI::GetComm()); #endif if (rbuf_NotMatching != 0) diff --git a/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp b/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp index 06bbc899e635..74dc958baa9b 100644 --- a/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp +++ b/SU2_CFD/src/solvers/CDiscAdjFEASolver.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjFEASolver.cpp * \brief Main subroutines for solving adjoint FEM elasticity problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -639,10 +639,10 @@ void CDiscAdjFEASolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *c } } - SU2_MPI::Allreduce(Local_Sens_E, Global_Sens_E, nMPROP, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Local_Sens_Nu, Global_Sens_Nu, nMPROP, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Local_Sens_Rho, Global_Sens_Rho, nMPROP, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Local_Sens_Rho_DL, Global_Sens_Rho_DL, nMPROP, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Local_Sens_E, Global_Sens_E, nMPROP, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Local_Sens_Nu, Global_Sens_Nu, nMPROP, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Local_Sens_Rho, Global_Sens_Rho, nMPROP, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Local_Sens_Rho_DL, Global_Sens_Rho_DL, nMPROP, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Extract the adjoint values of the electric field in the case that it is a parameter of the problem. ---*/ @@ -651,7 +651,7 @@ void CDiscAdjFEASolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *c if (local_index) Local_Sens_EField[iVar] = AD::GetDerivative(AD_Idx_EField[iVar]); else Local_Sens_EField[iVar] = SU2_TYPE::GetDerivative(EField[iVar]); } - SU2_MPI::Allreduce(Local_Sens_EField, Global_Sens_EField, nEField, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Local_Sens_EField, Global_Sens_EField, nEField, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } if (fea_dv) { @@ -659,7 +659,7 @@ void CDiscAdjFEASolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *c if (local_index) Local_Sens_DV[iVar] = AD::GetDerivative(AD_Idx_DV_Val[iVar]); else Local_Sens_DV[iVar] = SU2_TYPE::GetDerivative(DV_Val[iVar]); } - SU2_MPI::Allreduce(Local_Sens_DV, Global_Sens_DV, nDV, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Local_Sens_DV, Global_Sens_DV, nDV, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } /*--- Extract the flow traction sensitivities ---*/ diff --git a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp index 73997cff2f9d..067f256cbdf0 100644 --- a/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CDiscAdjMeshSolver.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjMeshSolver.cpp * \brief Main subroutines for solving the discrete adjoint mesh problem. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/solvers/CDiscAdjSolver.cpp b/SU2_CFD/src/solvers/CDiscAdjSolver.cpp index bae0c0de8fc1..166270e3c1b5 100644 --- a/SU2_CFD/src/solvers/CDiscAdjSolver.cpp +++ b/SU2_CFD/src/solvers/CDiscAdjSolver.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjSolver.cpp * \brief Main subroutines for solving the discrete adjoint problem. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -483,10 +483,10 @@ void CDiscAdjSolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *conf Local_Sens_Temp = SU2_TYPE::GetDerivative(Temperature); Local_Sens_Press = SU2_TYPE::GetDerivative(Pressure); - SU2_MPI::Allreduce(&Local_Sens_Mach, &Total_Sens_Mach, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_Sens_AoA, &Total_Sens_AoA, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_Sens_Press, &Total_Sens_Press, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&Local_Sens_Mach, &Total_Sens_Mach, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_Sens_AoA, &Total_Sens_AoA, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_Sens_Press, &Total_Sens_Press, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } if ((config->GetKind_Regime() == COMPRESSIBLE) && (KindDirect_Solver == RUNTIME_FLOW_SYS) && config->GetBoolTurbomachinery()){ @@ -495,8 +495,8 @@ void CDiscAdjSolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *conf Local_Sens_BPress = SU2_TYPE::GetDerivative(BPressure); Local_Sens_Temperature = SU2_TYPE::GetDerivative(Temperature); - SU2_MPI::Allreduce(&Local_Sens_BPress, &Total_Sens_BPress, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_Sens_Temperature, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&Local_Sens_BPress, &Total_Sens_BPress, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_Sens_Temperature, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } if ((config->GetKind_Regime() == INCOMPRESSIBLE) && @@ -509,9 +509,9 @@ void CDiscAdjSolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *conf Local_Sens_BPress = SU2_TYPE::GetDerivative(BPressure); Local_Sens_Temp = SU2_TYPE::GetDerivative(Temperature); - SU2_MPI::Allreduce(&Local_Sens_ModVel, &Total_Sens_ModVel, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_Sens_BPress, &Total_Sens_BPress, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&Local_Sens_ModVel, &Total_Sens_ModVel, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_Sens_BPress, &Total_Sens_BPress, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_Sens_Temp, &Total_Sens_Temp, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } if ((config->GetKind_Regime() == INCOMPRESSIBLE) && @@ -521,7 +521,7 @@ void CDiscAdjSolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *conf su2double Local_Sens_Temp_Rad; Local_Sens_Temp_Rad = SU2_TYPE::GetDerivative(TemperatureRad); - SU2_MPI::Allreduce(&Local_Sens_Temp_Rad, &Total_Sens_Temp_Rad, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&Local_Sens_Temp_Rad, &Total_Sens_Temp_Rad, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Store it in the Total_Sens_Temp container so it's accessible without the need of a new method ---*/ Total_Sens_Temp = Total_Sens_Temp_Rad; @@ -768,7 +768,7 @@ void CDiscAdjSolver::SetSurface_Sensitivity(CGeometry *geometry, CConfig *config Sens_Geo[iMarker_Monitoring] = 0.0; } - SU2_MPI::Allreduce(MySens_Geo, Sens_Geo, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(MySens_Geo, Sens_Geo, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); delete [] MySens_Geo; #endif @@ -886,7 +886,7 @@ void CDiscAdjSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfi if (iPoint_Global_Local < nPointDomain) { sbuf_NotMatching = 1; } - SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, SU2_MPI::GetComm()); if (rbuf_NotMatching != 0) { SU2_MPI::Error(string("The solution file ") + filename + string(" doesn't match with the mesh file!\n") + diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 83221d895ccc..7cd1a186cb13 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -2,7 +2,7 @@ * \file CEulerSolver.cpp * \brief Main subrotuines for solving Finite-Volume Euler flow problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -175,21 +175,16 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, /*--- Allocates a 2D array with variable "outer" sizes and init to 0. ---*/ - auto Alloc2D = [](unsigned long M, const unsigned long* N, su2double**& X) { - X = new su2double* [M]; - for(unsigned long i = 0; i < M; ++i) - X[i] = new su2double [N[i]] (); + auto Alloc2D = [](unsigned long M, const unsigned long* N, vector >& X) { + X.resize(M); + for(unsigned long i = 0; i < M; ++i) X[i].resize(N[i], 0.0); }; /*--- Allocates a 3D array with variable "middle" sizes and init to 0. ---*/ - auto Alloc3D = [](unsigned long M, const unsigned long* N, unsigned long P, su2double***& X) { - X = new su2double** [M]; - for(unsigned long i = 0; i < M; ++i) { - X[i] = new su2double* [N[i]]; - for(unsigned long j = 0; j < N[i]; ++j) - X[i][j] = new su2double [P] (); - } + auto Alloc3D = [](unsigned long M, const unsigned long* N, unsigned long P, vector& X) { + X.resize(M); + for(unsigned long i = 0; i < M; ++i) X[i].resize(N[i],P) = su2double(0.0); }; /*--- Store the value of the primitive variables + 2 turb variables at the boundaries, @@ -199,10 +194,9 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, /*--- Store the value of the characteristic primitive variables index at the boundaries ---*/ - DonorGlobalIndex = new unsigned long* [nMarker]; - for (iMarker = 0; iMarker < nMarker; iMarker++) { - DonorGlobalIndex[iMarker] = new unsigned long [nVertex[iMarker]](); - } + DonorGlobalIndex.resize(nMarker); + for (iMarker = 0; iMarker < nMarker; iMarker++) + DonorGlobalIndex[iMarker].resize(nVertex[iMarker],0); /*--- Actuator Disk Radius allocation ---*/ ActDisk_R.resize(nMarker); @@ -229,19 +223,19 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, /*--- Supersonic coefficients ---*/ - CEquivArea_Inv = new su2double[nMarker]; + CEquivArea_Inv.resize(nMarker); /*--- Engine simulation ---*/ - Inflow_MassFlow = new su2double[nMarker]; - Inflow_Pressure = new su2double[nMarker]; - Inflow_Mach = new su2double[nMarker]; - Inflow_Area = new su2double[nMarker]; + Inflow_MassFlow.resize(nMarker); + Inflow_Pressure.resize(nMarker); + Inflow_Mach.resize(nMarker); + Inflow_Area.resize(nMarker); - Exhaust_Temperature = new su2double[nMarker]; - Exhaust_MassFlow = new su2double[nMarker]; - Exhaust_Pressure = new su2double[nMarker]; - Exhaust_Area = new su2double[nMarker]; + Exhaust_Temperature.resize(nMarker); + Exhaust_MassFlow.resize(nMarker); + Exhaust_Pressure.resize(nMarker); + Exhaust_Area.resize(nMarker); /*--- Read farfield conditions from config ---*/ @@ -336,7 +330,7 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, if (config->GetComm_Level() == COMM_FULL) { - SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); if ((rank == MASTER_NODE) && (counter_global != 0)) cout << "Warning. The original solution contains " << counter_global << " points that are not physical." << endl; @@ -357,74 +351,11 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, CEulerSolver::~CEulerSolver(void) { - unsigned short iMarker, iSpan; - unsigned long iVertex; + unsigned short iSpan; + unsigned long iMarker; /*--- Array deallocation ---*/ - delete [] CEquivArea_Inv; - - delete [] Inflow_MassFlow; - delete [] Exhaust_MassFlow; - delete [] Exhaust_Area; - delete [] Inflow_Pressure; - delete [] Inflow_Mach; - delete [] Inflow_Area; - - delete [] Exhaust_Pressure; - delete [] Exhaust_Temperature; - - if (DonorPrimVar != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) - delete [] DonorPrimVar[iMarker][iVertex]; - delete [] DonorPrimVar[iMarker]; - } - delete [] DonorPrimVar; - } - - if (DonorGlobalIndex != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - delete [] DonorGlobalIndex[iMarker]; - delete [] DonorGlobalIndex; - } - - if (ActDisk_Fa != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - delete [] ActDisk_Fa[iMarker]; - delete [] ActDisk_Fa; - } - - if (ActDisk_Fx != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - delete [] ActDisk_Fx[iMarker]; - delete [] ActDisk_Fx; - } - - if (ActDisk_Fy != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - delete [] ActDisk_Fy[iMarker]; - delete [] ActDisk_Fy; - } - - if (ActDisk_Fz != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - delete [] ActDisk_Fz[iMarker]; - delete [] ActDisk_Fz; - } - - if (ActDisk_DeltaP != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - delete [] ActDisk_DeltaP[iMarker]; - delete [] ActDisk_DeltaP; - } - - if (ActDisk_DeltaT != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) - delete [] ActDisk_DeltaT[iMarker]; - delete [] ActDisk_DeltaT; - } - for(auto& model : FluidModel) delete model; if(AverageVelocity !=nullptr){ @@ -817,7 +748,6 @@ void CEulerSolver::InitTurboContainers(CGeometry *geometry, CConfig *config){ } } - } void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geometry, CConfig *config) { @@ -916,7 +846,7 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet /*--- Communicate the counts to iDomain with non-blocking sends ---*/ - SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, MPI_COMM_WORLD, &req); + SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } else { @@ -942,7 +872,7 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet /*--- Recv the data by probing for the current sender, jDomain, first and then receiving the values from it. ---*/ - SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, SU2_MPI::GetComm(), &status); } } @@ -952,7 +882,7 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Initialize the counters for the larger send buffers (by domain) ---*/ @@ -1014,12 +944,12 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet SU2_MPI::Isend(&Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar_)], nPointTotal_s[iDomain]*(nPrimVar_), MPI_DOUBLE, iDomain, - iDomain, MPI_COMM_WORLD, &req); + iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); SU2_MPI::Isend(&Buffer_Send_Data[PointTotal_Counter*(3)], nPointTotal_s[iDomain]*(3), MPI_LONG, iDomain, - iDomain+nDomain, MPI_COMM_WORLD, &req); + iDomain+nDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } @@ -1070,7 +1000,7 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- The next section begins the recv of all data for the interior points/elements in the mesh. First, create the domain structures for @@ -1091,10 +1021,10 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet /*--- Receive the buffers with the coords, global index, and colors ---*/ SU2_MPI::Recv(Buffer_Receive_PrimVar, nPointTotal_r[iDomain]*(nPrimVar_) , MPI_DOUBLE, - iDomain, rank, MPI_COMM_WORLD, &status); + iDomain, rank, SU2_MPI::GetComm(), &status); SU2_MPI::Recv(Buffer_Receive_Data, nPointTotal_r[iDomain]*(3) , MPI_LONG, - iDomain, rank+nDomain, MPI_COMM_WORLD, &status); + iDomain, rank+nDomain, SU2_MPI::GetComm(), &status); /*--- Loop over all of the points that we have recv'd and store the coords, global index vertex and markers ---*/ @@ -1129,7 +1059,7 @@ void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geomet /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Free all of the memory used for communicating points and elements ---*/ @@ -1226,7 +1156,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Communicate the counts to iDomain with non-blocking sends ---*/ - SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, MPI_COMM_WORLD, &req); + SU2_MPI::Isend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } else { @@ -1252,7 +1182,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Recv the data by probing for the current sender, jDomain, first and then receiving the values from it. ---*/ - SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, MPI_COMM_WORLD, &status); + SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, SU2_MPI::GetComm(), &status); } } @@ -1262,7 +1192,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Initialize the counters for the larger send buffers (by domain) ---*/ @@ -1313,7 +1243,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { SU2_MPI::Isend(&Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar+3)], nPointTotal_s[iDomain]*(nPrimVar+3), MPI_DOUBLE, iDomain, - iDomain, MPI_COMM_WORLD, &req); + iDomain, SU2_MPI::GetComm(), &req); SU2_MPI::Request_free(&req); } @@ -1363,7 +1293,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- The next section begins the recv of all data for the interior points/elements in the mesh. First, create the domain structures for @@ -1383,7 +1313,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Receive the buffers with the coords, global index, and colors ---*/ SU2_MPI::Recv(Buffer_Receive_PrimVar, nPointTotal_r[iDomain]*(nPrimVar+3) , MPI_DOUBLE, - iDomain, rank, MPI_COMM_WORLD, &status); + iDomain, rank, SU2_MPI::GetComm(), &status); /*--- Loop over all of the points that we have recv'd and store the coords, global index vertex and markers ---*/ @@ -1421,7 +1351,7 @@ void CEulerSolver::Set_MPI_Nearfield(CGeometry *geometry, CConfig *config) { /*--- Wait for the non-blocking sends to complete. ---*/ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); /*--- Free all of the memory used for communicating points and elements ---*/ @@ -1985,181 +1915,120 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long TimeIter) { const bool restart = (config->GetRestart() || config->GetRestart_Flow()); - const bool rans = (config->GetKind_Turb_Model() != NONE); - const bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); const bool SubsonicEngine = config->GetSubsonicEngine(); - /*--- Start OpenMP parallel region. ---*/ - - SU2_OMP_PARALLEL - { - - unsigned long iPoint; - unsigned short iMesh, iDim; - su2double X0[3] = {0.0,0.0,0.0}, X1[3] = {0.0,0.0,0.0}, X2[3] = {0.0,0.0,0.0}, - X1_X0[3] = {0.0,0.0,0.0}, X2_X0[3] = {0.0,0.0,0.0}, X2_X1[3] = {0.0,0.0,0.0}, - CP[3] = {0.0,0.0,0.0}, Distance, DotCheck, Radius; + /*--- Use default implementation, then add solver-specifics. ---*/ - /*--- Check if a verification solution is to be computed. ---*/ - if ((VerificationSolution) && (TimeIter == 0) && !restart) { + BaseClass::SetInitialCondition(geometry, solver_container, config, TimeIter); - /*--- Loop over the multigrid levels. ---*/ - for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - - /*--- Loop over all grid points. ---*/ - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - - /* Set the pointers to the coordinates and solution of this DOF. */ - const su2double *coor = geometry[iMesh]->nodes->GetCoord(iPoint); - su2double *solDOF = solver_container[iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint); - - /* Set the solution in this DOF to the initial condition provided by - the verification solution class. This can be the exact solution, - but this is not necessary. */ - VerificationSolution->GetInitialCondition(coor, solDOF); - - } - } - } + /*--- Set subsonic initial condition for engine intakes at iteration 0 ---*/ - /*--- Set subsonic initial condition for engine intakes ---*/ + if (!SubsonicEngine || (TimeIter != 0) || restart) return; - if (SubsonicEngine) { - - /*--- Set initial boundary condition at iteration 0 ---*/ + /*--- Start OpenMP parallel region. ---*/ - if ((TimeIter == 0) && (!restart)) { + SU2_OMP_PARALLEL { - su2double Velocity_Cyl[3] = {0.0, 0.0, 0.0}, Velocity_CylND[3] = {0.0, 0.0, 0.0}, Viscosity_Cyl, - Density_Cyl, Density_CylND, Pressure_CylND, ModVel_Cyl, ModVel_CylND, Energy_CylND, - T_ref = 0.0, S = 0.0, Mu_ref = 0.0; - const su2double *Coord, *SubsonicEngine_Cyl, *SubsonicEngine_Values; + unsigned long iPoint; + unsigned short iMesh, iDim; + su2double X0[MAXNDIM] = {0.0}, X1[MAXNDIM] = {0.0}, X2[MAXNDIM] = {0.0}, + X1_X0[MAXNDIM] = {0.0}, X2_X0[MAXNDIM] = {0.0}, X2_X1[MAXNDIM] = {0.0}, + CP[MAXNDIM] = {0.0}, Distance, DotCheck, Radius; - SubsonicEngine_Values = config->GetSubsonicEngine_Values(); - su2double Mach_Cyl = SubsonicEngine_Values[0]; - su2double Alpha_Cyl = SubsonicEngine_Values[1]; - su2double Beta_Cyl = SubsonicEngine_Values[2]; - su2double Pressure_Cyl = SubsonicEngine_Values[3]; - su2double Temperature_Cyl = SubsonicEngine_Values[4]; + su2double Velocity_Cyl[MAXNDIM] = {0.0}, Velocity_CylND[MAXNDIM] = {0.0}, Viscosity_Cyl, + Density_Cyl, Density_CylND, Pressure_CylND, ModVel_Cyl, ModVel_CylND, Energy_CylND, + T_ref = 0.0, S = 0.0, Mu_ref = 0.0; + const su2double *Coord, *SubsonicEngine_Cyl, *SubsonicEngine_Values; - su2double Alpha = Alpha_Cyl*PI_NUMBER/180.0; - su2double Beta = Beta_Cyl*PI_NUMBER/180.0; + SubsonicEngine_Values = config->GetSubsonicEngine_Values(); + su2double Mach_Cyl = SubsonicEngine_Values[0]; + su2double Alpha_Cyl = SubsonicEngine_Values[1]; + su2double Beta_Cyl = SubsonicEngine_Values[2]; + su2double Pressure_Cyl = SubsonicEngine_Values[3]; + su2double Temperature_Cyl = SubsonicEngine_Values[4]; - su2double Gamma_Minus_One = Gamma - 1.0; - su2double Gas_Constant = config->GetGas_Constant(); + su2double Alpha = Alpha_Cyl*PI_NUMBER/180.0; + su2double Beta = Beta_Cyl*PI_NUMBER/180.0; - su2double Mach2Vel_Cyl = sqrt(Gamma*Gas_Constant*Temperature_Cyl); + su2double Gamma_Minus_One = Gamma - 1.0; + su2double Gas_Constant = config->GetGas_Constant(); - for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { + su2double Mach2Vel_Cyl = sqrt(Gamma*Gas_Constant*Temperature_Cyl); - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { + for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - Velocity_Cyl[0] = cos(Alpha)*cos(Beta)*Mach_Cyl*Mach2Vel_Cyl; - Velocity_Cyl[1] = sin(Beta)*Mach_Cyl*Mach2Vel_Cyl; - Velocity_Cyl[2] = sin(Alpha)*cos(Beta)*Mach_Cyl*Mach2Vel_Cyl; + auto FlowNodes = solver_container[iMesh][FLOW_SOL]->GetNodes(); - ModVel_Cyl = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - ModVel_Cyl += Velocity_Cyl[iDim]*Velocity_Cyl[iDim]; - } - ModVel_Cyl = sqrt(ModVel_Cyl); - - if (config->GetViscous()) { - if (config->GetSystemMeasurements() == SI) { T_ref = 273.15; S = 110.4; Mu_ref = 1.716E-5; } - if (config->GetSystemMeasurements() == US) { - T_ref = (273.15 - 273.15) * 1.8 + 491.67; - S = (110.4 - 273.15) * 1.8 + 491.67; - Mu_ref = 1.716E-5/47.88025898; - } - Viscosity_Cyl = Mu_ref*(pow(Temperature_Cyl/T_ref, 1.5) * (T_ref+S)/(Temperature_Cyl+S)); - Density_Cyl = config->GetReynolds()*Viscosity_Cyl/(ModVel_Cyl*config->GetLength_Reynolds()); - Pressure_Cyl = Density_Cyl*Gas_Constant*Temperature_Cyl; - } - else { - Density_Cyl = Pressure_Cyl/(Gas_Constant*Temperature_Cyl); - } + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - Density_CylND = Density_Cyl/config->GetDensity_Ref(); - Pressure_CylND = Pressure_Cyl/config->GetPressure_Ref(); + Velocity_Cyl[0] = cos(Alpha)*cos(Beta)*Mach_Cyl*Mach2Vel_Cyl; + Velocity_Cyl[1] = sin(Beta)*Mach_Cyl*Mach2Vel_Cyl; + Velocity_Cyl[2] = sin(Alpha)*cos(Beta)*Mach_Cyl*Mach2Vel_Cyl; - for (iDim = 0; iDim < nDim; iDim++) { - Velocity_CylND[iDim] = Velocity_Cyl[iDim]/config->GetVelocity_Ref(); - } + ModVel_Cyl = GeometryToolbox::Norm(nDim, Velocity_Cyl); - ModVel_CylND = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - ModVel_CylND += Velocity_CylND[iDim]*Velocity_CylND[iDim]; + if (config->GetViscous()) { + if (config->GetSystemMeasurements() == SI) { T_ref = 273.15; S = 110.4; Mu_ref = 1.716E-5; } + if (config->GetSystemMeasurements() == US) { + T_ref = (273.15 - 273.15) * 1.8 + 491.67; + S = (110.4 - 273.15) * 1.8 + 491.67; + Mu_ref = 1.716E-5/47.88025898; } - ModVel_CylND = sqrt(ModVel_CylND); + Viscosity_Cyl = Mu_ref*(pow(Temperature_Cyl/T_ref, 1.5) * (T_ref+S)/(Temperature_Cyl+S)); + Density_Cyl = config->GetReynolds()*Viscosity_Cyl/(ModVel_Cyl*config->GetLength_Reynolds()); + Pressure_Cyl = Density_Cyl*Gas_Constant*Temperature_Cyl; + } + else { + Density_Cyl = Pressure_Cyl/(Gas_Constant*Temperature_Cyl); + } - Energy_CylND = Pressure_CylND/(Density_CylND*Gamma_Minus_One)+0.5*ModVel_CylND*ModVel_CylND; + Density_CylND = Density_Cyl/config->GetDensity_Ref(); + Pressure_CylND = Pressure_Cyl/config->GetPressure_Ref(); - Coord = geometry[iMesh]->nodes->GetCoord(iPoint); + for (iDim = 0; iDim < nDim; iDim++) { + Velocity_CylND[iDim] = Velocity_Cyl[iDim]/config->GetVelocity_Ref(); + } - SubsonicEngine_Cyl = config->GetSubsonicEngine_Cyl(); + ModVel_CylND = GeometryToolbox::Norm(nDim, Velocity_CylND); - X0[0] = Coord[0]; X0[1] = Coord[1]; X0[2] = Coord[2]; - X1[0] = SubsonicEngine_Cyl[0]; X1[1] = SubsonicEngine_Cyl[1]; X1[2] = SubsonicEngine_Cyl[2]; - X2[0] = SubsonicEngine_Cyl[3]; X2[1] = SubsonicEngine_Cyl[4]; X2[2] = SubsonicEngine_Cyl[5]; - Radius = SubsonicEngine_Cyl[6]; + Energy_CylND = Pressure_CylND/(Density_CylND*Gamma_Minus_One)+0.5*ModVel_CylND*ModVel_CylND; - for (iDim = 0; iDim < nDim; iDim++) { - X2_X1[iDim]= X1[iDim] - X2[iDim]; - X1_X0[iDim]= X0[iDim] - X1[iDim]; - X2_X0[iDim]= X0[iDim] - X2[iDim]; - } - - CP[0] = (X2_X1[1]*X1_X0[2] - X2_X1[2]*X1_X0[1]); - CP[1] = (X2_X1[2]*X1_X0[0] - X2_X1[0]*X1_X0[2]); - CP[2] = (X2_X1[0]*X1_X0[1] - X2_X1[1]*X1_X0[0]); + Coord = geometry[iMesh]->nodes->GetCoord(iPoint); - Distance = sqrt((CP[0]*CP[0]+CP[1]*CP[1]+CP[2]*CP[2])/(X2_X1[0]*X2_X1[0]+X2_X1[1]*X2_X1[1]+X2_X1[2]*X2_X1[2])); + SubsonicEngine_Cyl = config->GetSubsonicEngine_Cyl(); - DotCheck = -(X1_X0[0]*X2_X1[0]+X1_X0[1]*X2_X1[1]+X1_X0[2]*X2_X1[2]); - if (DotCheck < 0.0) Distance = sqrt(X1_X0[0]*X1_X0[0]+X1_X0[1]*X1_X0[1]+X1_X0[2]*X1_X0[2]); + X0[0] = Coord[0]; X0[1] = Coord[1]; if (nDim==3) X0[2] = Coord[2]; + X1[0] = SubsonicEngine_Cyl[0]; X1[1] = SubsonicEngine_Cyl[1]; X1[2] = SubsonicEngine_Cyl[2]; + X2[0] = SubsonicEngine_Cyl[3]; X2[1] = SubsonicEngine_Cyl[4]; X2[2] = SubsonicEngine_Cyl[5]; + Radius = SubsonicEngine_Cyl[6]; - DotCheck = (X2_X0[0]*X2_X1[0]+X2_X0[1]*X2_X1[1]+X2_X0[2]*X2_X1[2]); - if (DotCheck < 0.0) Distance = sqrt(X2_X0[0]*X2_X0[0]+X2_X0[1]*X2_X0[1]+X2_X0[2]*X2_X0[2]); + GeometryToolbox::Distance(3, X1, X2, X2_X1); + GeometryToolbox::Distance(3, X0, X1, X1_X0); + GeometryToolbox::Distance(3, X0, X2, X2_X0); - if (Distance < Radius) { + GeometryToolbox::CrossProduct(X2_X1, X1_X0, CP); - solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, 0, Density_CylND); - for (iDim = 0; iDim < nDim; iDim++) - solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, iDim+1, Density_CylND*Velocity_CylND[iDim]); - solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint, nVar-1, Density_CylND*Energy_CylND); + Distance = sqrt(GeometryToolbox::SquaredNorm(3,CP) / GeometryToolbox::SquaredNorm(3,X2_X1)); - solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution_Old(iPoint, 0, Density_CylND); - for (iDim = 0; iDim < nDim; iDim++) - solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution_Old(iPoint, iDim+1, Density_CylND*Velocity_CylND[iDim]); - solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution_Old(iPoint, nVar-1, Density_CylND*Energy_CylND); + DotCheck = -GeometryToolbox::DotProduct(3, X1_X0, X2_X1); + if (DotCheck < 0.0) Distance = GeometryToolbox::Norm(3, X1_X0); - } + DotCheck = GeometryToolbox::DotProduct(3, X2_X0, X2_X1); + if (DotCheck < 0.0) Distance = GeometryToolbox::Norm(3, X2_X0); + if (Distance < Radius) { + FlowNodes->SetSolution(iPoint, 0, Density_CylND); + for (iDim = 0; iDim < nDim; iDim++) + FlowNodes->SetSolution(iPoint, iDim+1, Density_CylND*Velocity_CylND[iDim]); + FlowNodes->SetSolution(iPoint, nVar-1, Density_CylND*Energy_CylND); } - /*--- Set the MPI communication ---*/ - - solver_container[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver_container[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); - - solver_container[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION_OLD); - solver_container[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION_OLD); - } - } - - } - - /*--- Make sure that the solution is well initialized for unsteady - calculations with dual time-stepping (load additional restarts for 2nd-order). ---*/ + FlowNodes->Set_OldSolution(); - if (dual_time && ((TimeIter == 0) || (restart && (TimeIter == config->GetRestart_Iter()))) ) { - PushSolutionBackInTime(TimeIter, restart, rans, solver_container, geometry, config); - } + } } // end SU2_OMP_PARALLEL @@ -2200,14 +2069,14 @@ void CEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_con SU2_OMP_BARRIER SU2_OMP_ATOMIC - ErrorCounter += SetPrimitive_Variables(solver_container, config, Output); + ErrorCounter += SetPrimitive_Variables(solver_container, config); if ((iMesh == MESH_0) && (config->GetComm_Level() == COMM_FULL)) { SU2_OMP_BARRIER SU2_OMP_MASTER { unsigned long tmp = ErrorCounter; - SU2_MPI::Allreduce(&tmp, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); config->SetNonphysical_Points(ErrorCounter); } SU2_OMP_BARRIER @@ -2305,7 +2174,7 @@ void CEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container } } -unsigned long CEulerSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) { +unsigned long CEulerSolver::SetPrimitive_Variables(CSolver **solver_container, const CConfig *config) { /*--- Number of non-physical points, local to the thread, needs * further reduction if function is called in parallel ---*/ @@ -2314,7 +2183,7 @@ unsigned long CEulerSolver::SetPrimitive_Variables(CSolver **solver_container, C SU2_OMP_FOR_STAT(omp_chunk_size) for (unsigned long iPoint = 0; iPoint < nPoint; iPoint ++) { - /*--- Compressible flow, primitive variables nDim+5, (T, vx, vy, vz, P, rho, h, c, lamMu, eddyMu, ThCond, Cp) ---*/ + /*--- Compressible flow, primitive variables nDim+9, (T, vx, vy, vz, P, rho, h, c, lamMu, eddyMu, ThCond, Cp) ---*/ bool physical = nodes->SetPrimVar(iPoint, GetFluidModel()); nodes->SetSecondaryVar(iPoint, GetFluidModel()); @@ -2330,260 +2199,50 @@ unsigned long CEulerSolver::SetPrimitive_Variables(CSolver **solver_container, C void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) { - const bool viscous = config->GetViscous(); - const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - const bool time_stepping = (config->GetTime_Marching() == TIME_STEPPING); - const bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND); - const su2double K_v = 0.25; - - /*--- Init thread-shared variables to compute min/max values. - * Critical sections are used for this instead of reduction - * clauses for compatibility with OpenMP 2.0 (Windows...). ---*/ - - SU2_OMP_MASTER - { - Min_Delta_Time = 1e30; - Max_Delta_Time = 0.0; - Global_Delta_UnstTimeND = 1e30; - } - SU2_OMP_BARRIER - - const su2double *Normal = nullptr; - su2double Area, Vol, Mean_SoundSpeed, Mean_ProjVel, Lambda, Local_Delta_Time, Local_Delta_Time_Visc; - su2double Mean_LaminarVisc, Mean_EddyVisc, Mean_Density, Lambda_1, Lambda_2; - unsigned long iEdge, iVertex, iPoint, jPoint; - unsigned short iDim, iMarker; - - /*--- Loop domain points. ---*/ - - SU2_OMP_FOR_DYN(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; ++iPoint) { - - /*--- Set maximum eigenvalues to zero. ---*/ - - nodes->SetMax_Lambda_Inv(iPoint,0.0); - - if (viscous) - nodes->SetMax_Lambda_Visc(iPoint,0.0); - - /*--- Loop over the neighbors of point i. ---*/ - - for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) - { - jPoint = geometry->nodes->GetPoint(iPoint,iNeigh); - - iEdge = geometry->nodes->GetEdge(iPoint,iNeigh); - Normal = geometry->edges->GetNormal(iEdge); - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - - Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); - Mean_SoundSpeed = 0.5 * (nodes->GetSoundSpeed(iPoint) + nodes->GetSoundSpeed(jPoint)) * Area; - - /*--- Adjustment for grid movement ---*/ - - if (dynamic_grid) { - const su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint); - const su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint); - - for (iDim = 0; iDim < nDim; iDim++) - Mean_ProjVel -= 0.5 * (GridVel_i[iDim] + GridVel_j[iDim]) * Normal[iDim]; - } - - /*--- Inviscid contribution ---*/ - - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed ; - nodes->AddMax_Lambda_Inv(iPoint,Lambda); - - /*--- Viscous contribution ---*/ - - if (!viscous) continue; - - Mean_LaminarVisc = 0.5*(nodes->GetLaminarViscosity(iPoint) + nodes->GetLaminarViscosity(jPoint)); - Mean_EddyVisc = 0.5*(nodes->GetEddyViscosity(iPoint) + nodes->GetEddyViscosity(jPoint)); - Mean_Density = 0.5*(nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); - - Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); - //TODO (REAL_GAS) removing Gamma it cannot work with FLUIDPROP - Lambda_2 = (1.0 + (Prandtl_Lam/Prandtl_Turb)*(Mean_EddyVisc/Mean_LaminarVisc))*(Gamma*Mean_LaminarVisc/Prandtl_Lam); - - Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - nodes->AddMax_Lambda_Visc(iPoint, Lambda); + /*--- Define an object to compute the speed of sound. ---*/ + struct SoundSpeed { + FORCEINLINE su2double operator() (const CEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + return 0.5 * (nodes.GetSoundSpeed(iPoint) + nodes.GetSoundSpeed(jPoint)); } - } - - /*--- 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)) { - - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { - - /*--- Point identification, Normal vector and area ---*/ - - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - - if (!geometry->nodes->GetDomain(iPoint)) continue; - - Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - - Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); - Mean_SoundSpeed = nodes->GetSoundSpeed(iPoint) * Area; - - /*--- Adjustment for grid movement ---*/ - - if (dynamic_grid) { - const su2double *GridVel = geometry->nodes->GetGridVel(iPoint); - - for (iDim = 0; iDim < nDim; iDim++) - Mean_ProjVel -= GridVel[iDim]*Normal[iDim]; - } - - /*--- Inviscid contribution ---*/ - - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - nodes->AddMax_Lambda_Inv(iPoint,Lambda); - - /*--- Viscous contribution ---*/ - - if (!viscous) continue; - - Mean_LaminarVisc = nodes->GetLaminarViscosity(iPoint); - Mean_EddyVisc = nodes->GetEddyViscosity(iPoint); - Mean_Density = nodes->GetDensity(iPoint); - - Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); - Lambda_2 = (1.0 + (Prandtl_Lam/Prandtl_Turb)*(Mean_EddyVisc/Mean_LaminarVisc))*(Gamma*Mean_LaminarVisc/Prandtl_Lam); - Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - - nodes->AddMax_Lambda_Visc(iPoint, Lambda); - - } - } - } - - /*--- Each element uses their own speed, steady state simulation. ---*/ - { - /*--- Thread-local variables for min/max reduction. ---*/ - su2double minDt = 1e30, maxDt = 0.0; - - SU2_OMP(for schedule(static,omp_chunk_size) nowait) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - Vol = geometry->nodes->GetVolume(iPoint); - - if (Vol != 0.0) { - Local_Delta_Time = nodes->GetLocalCFL(iPoint)*Vol / nodes->GetMax_Lambda_Inv(iPoint); - - if(viscous) { - Local_Delta_Time_Visc = nodes->GetLocalCFL(iPoint)*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); - Local_Delta_Time = min(Local_Delta_Time, Local_Delta_Time_Visc); - } - - minDt = min(minDt, Local_Delta_Time); - maxDt = max(maxDt, Local_Delta_Time); - - nodes->SetDelta_Time(iPoint, min(Local_Delta_Time, config->GetMax_DeltaTime())); - } - else { - nodes->SetDelta_Time(iPoint,0.0); - } - } - /*--- Min/max over threads. ---*/ - SU2_OMP_CRITICAL - { - Min_Delta_Time = min(Min_Delta_Time, minDt); - Max_Delta_Time = max(Max_Delta_Time, maxDt); - Global_Delta_Time = Min_Delta_Time; + FORCEINLINE su2double operator() (const CEulerVariable& nodes, unsigned long iPoint) const { + return nodes.GetSoundSpeed(iPoint); } - SU2_OMP_BARRIER - } - /*--- Compute the min/max dt (in parallel, now over mpi ranks). ---*/ + } soundSpeed; - SU2_OMP_MASTER - if (config->GetComm_Level() == COMM_FULL) { - su2double rbuf_time; - SU2_MPI::Allreduce(&Min_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - Min_Delta_Time = rbuf_time; + /*--- Define an object to compute the viscous eigenvalue. ---*/ + struct LambdaVisc { + const su2double gamma, prandtlLam, prandtlTurb; - SU2_MPI::Allreduce(&Max_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - Max_Delta_Time = rbuf_time; - } - SU2_OMP_BARRIER + LambdaVisc(su2double g, su2double pl, su2double pt) : gamma(g), prandtlLam(pl), prandtlTurb(pt) {} - /*--- For exact time solution use the minimum delta time of the whole mesh. ---*/ - if (time_stepping) { - - /*--- 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. ---*/ - - SU2_OMP_MASTER - { - if (config->GetUnst_CFL() == 0.0) { - Global_Delta_Time = config->GetDelta_UnstTime(); - } - else { - Global_Delta_Time = Min_Delta_Time; - } - Max_Delta_Time = Global_Delta_Time; - - config->SetDelta_UnstTimeND(Global_Delta_Time); + FORCEINLINE su2double lambda(su2double laminarVisc, su2double eddyVisc, su2double density) const { + su2double Lambda_1 = (4.0/3.0)*(laminarVisc + eddyVisc); + /// TODO: (REAL_GAS) removing gamma as it cannot work with FLUIDPROP + su2double Lambda_2 = (1.0 + (prandtlLam/prandtlTurb)*(eddyVisc/laminarVisc))*(gamma*laminarVisc/prandtlLam); + return (Lambda_1 + Lambda_2) / density; } - SU2_OMP_BARRIER - - /*--- Sets the regular CFL equal to the unsteady CFL. ---*/ - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - nodes->SetLocalCFL(iPoint, config->GetUnst_CFL()); - nodes->SetDelta_Time(iPoint, Global_Delta_Time); + FORCEINLINE su2double operator() (const CEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + su2double laminarVisc = 0.5*(nodes.GetLaminarViscosity(iPoint) + nodes.GetLaminarViscosity(jPoint)); + su2double eddyVisc = 0.5*(nodes.GetEddyViscosity(iPoint) + nodes.GetEddyViscosity(jPoint)); + su2double density = 0.5*(nodes.GetDensity(iPoint) + nodes.GetDensity(jPoint)); + return lambda(laminarVisc, eddyVisc, density); } - } - - /*--- 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)) { - - /*--- Thread-local variable for reduction. ---*/ - su2double glbDtND = 1e30; - - SU2_OMP(for schedule(static,omp_chunk_size) nowait) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - glbDtND = min(glbDtND, config->GetUnst_CFL()*Global_Delta_Time / nodes->GetLocalCFL(iPoint)); + FORCEINLINE su2double operator() (const CEulerVariable& nodes, unsigned long iPoint) const { + su2double laminarVisc = nodes.GetLaminarViscosity(iPoint); + su2double eddyVisc = nodes.GetEddyViscosity(iPoint); + su2double density = nodes.GetDensity(iPoint); + return lambda(laminarVisc, eddyVisc, density); } - SU2_OMP_CRITICAL - Global_Delta_UnstTimeND = min(Global_Delta_UnstTimeND, glbDtND); - SU2_OMP_BARRIER - SU2_OMP_MASTER - { - SU2_MPI::Allreduce(&Global_Delta_UnstTimeND, &glbDtND, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - Global_Delta_UnstTimeND = glbDtND; - - config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND); - } - SU2_OMP_BARRIER - } + } lambdaVisc(Gamma, Prandtl_Lam, Prandtl_Turb); - /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/ + /*--- Now instantiate the generic implementation with the two functors above. ---*/ - if (dual_time && !implicit) { - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); - nodes->SetDelta_Time(iPoint, Local_Delta_Time); - } - } + SetTime_Step_impl(soundSpeed, lambdaVisc, geometry, solver_container, config, iMesh, Iteration); } @@ -2601,7 +2260,6 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain return; } - const auto InnerIter = config->GetInnerIter(); const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool ideal_gas = (config->GetKind_FluidModel() == STANDARD_AIR) || (config->GetKind_FluidModel() == IDEAL_GAS); @@ -2611,8 +2269,7 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain const auto kind_dissipation = config->GetKind_RoeLowDiss(); const bool muscl = (config->GetMUSCL_Flow() && (iMesh == MESH_0)); - const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && - (InnerIter <= config->GetLimiterIter()); + const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE); /*--- Non-physical counter. ---*/ @@ -2651,10 +2308,7 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Roe Turkel preconditioning ---*/ if (roe_turkel) { - su2double sqvel = 0.0; - for (iDim = 0; iDim < nDim; iDim ++) - sqvel += pow(config->GetVelocity_FreeStream()[iDim], 2); - numerics->SetVelocity2_Inf(sqvel); + numerics->SetVelocity2_Inf(GeometryToolbox::SquaredNorm(nDim, config->GetVelocity_FreeStream())); } /*--- Grid movement ---*/ @@ -2688,13 +2342,6 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain auto Gradient_i = nodes->GetGradient_Reconstruction(iPoint); auto Gradient_j = nodes->GetGradient_Reconstruction(jPoint); - su2double *Limiter_i = nullptr, *Limiter_j = nullptr; - - if (limiter) { - Limiter_i = nodes->GetLimiter_Primitive(iPoint); - Limiter_j = nodes->GetLimiter_Primitive(jPoint); - } - for (iVar = 0; iVar < nPrimVarGrad; iVar++) { su2double Project_Grad_i = 0.0; @@ -2705,20 +2352,22 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain Project_Grad_j -= Vector_ij[iDim]*Gradient_j[iVar][iDim]; } - if (limiter) { - if (van_albada) { - su2double V_ij = V_j[iVar] - V_i[iVar]; - Limiter_i[iVar] = V_ij*( 2.0*Project_Grad_i + V_ij) / (4*pow(Project_Grad_i, 2) + pow(V_ij, 2) + EPS); - Limiter_j[iVar] = V_ij*(-2.0*Project_Grad_j + V_ij) / (4*pow(Project_Grad_j, 2) + pow(V_ij, 2) + 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; + su2double lim_i = 1.0; + su2double lim_j = 1.0; + + if (van_albada) { + su2double V_ij = V_j[iVar] - V_i[iVar]; + lim_i = V_ij*( 2.0*Project_Grad_i + V_ij) / (4*pow(Project_Grad_i, 2) + pow(V_ij, 2) + EPS); + lim_j = V_ij*(-2.0*Project_Grad_j + V_ij) / (4*pow(Project_Grad_j, 2) + pow(V_ij, 2) + EPS); } - else { - Primitive_i[iVar] = V_i[iVar] + Project_Grad_i; - Primitive_j[iVar] = V_j[iVar] + Project_Grad_j; + else if (limiter) { + lim_i = nodes->GetLimiter_Primitive(iPoint, iVar); + lim_j = nodes->GetLimiter_Primitive(jPoint, iVar); } + Primitive_i[iVar] = V_i[iVar] + lim_i * Project_Grad_i; + Primitive_j[iVar] = V_j[iVar] + lim_j * Project_Grad_j; + } /*--- Recompute the reconstructed quantities in a thermodynamically consistent way. ---*/ @@ -2833,10 +2482,9 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain SU2_OMP_BARRIER /*--- Add counter results for all ranks. ---*/ - SU2_OMP_MASTER - { + SU2_OMP_MASTER { counter_local = ErrorCounter; - SU2_MPI::Reduce(&counter_local, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(&counter_local, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); config->SetNonphysical_Reconstr(ErrorCounter); } SU2_OMP_BARRIER @@ -3166,97 +2814,23 @@ void CEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_contain } -void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { - - /*--- Loop domain points. ---*/ - - SU2_OMP_FOR_DYN(omp_chunk_size) - for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) { - - /*--- Set eigenvalues to zero. ---*/ - nodes->SetLambda(iPoint,0.0); +void CEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, const CConfig *config) { - /*--- Loop over the neighbors of point i. ---*/ - for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) - { - auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - - auto iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - auto Normal = geometry->edges->GetNormal(iEdge); - su2double Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - - su2double Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); - su2double Mean_SoundSpeed = 0.5 * (nodes->GetSoundSpeed(iPoint) + nodes->GetSoundSpeed(jPoint)) * Area; - - /*--- Adjustment for grid movement ---*/ - - if (dynamic_grid) { - const su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint); - const su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint); - - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Mean_ProjVel -= 0.5 * (GridVel_i[iDim] + GridVel_j[iDim]) * Normal[iDim]; - } - - /*--- Inviscid contribution ---*/ - - su2double Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed ; - nodes->AddLambda(iPoint, Lambda); + /*--- Define an object to compute the speed of sound. ---*/ + struct SoundSpeed { + FORCEINLINE su2double operator() (const CEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + return 0.5 * (nodes.GetSoundSpeed(iPoint) + nodes.GetSoundSpeed(jPoint)); } - } - - /*--- Loop boundary edges ---*/ - - for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && - (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { - - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (unsigned long iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { - - /*--- Point identification, Normal vector and area ---*/ - - auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - su2double Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - - su2double Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); - su2double Mean_SoundSpeed = nodes->GetSoundSpeed(iPoint) * Area; - - /*--- Adjustment for grid movement ---*/ - - if (dynamic_grid) { - auto GridVel = geometry->nodes->GetGridVel(iPoint); - for (unsigned short iDim = 0; iDim < nDim; iDim++) - Mean_ProjVel -= GridVel[iDim]*Normal[iDim]; - } - - /*--- Inviscid contribution ---*/ - - su2double Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) { - nodes->AddLambda(iPoint,Lambda); - } - } + FORCEINLINE su2double operator() (const CEulerVariable& nodes, unsigned long iPoint) const { + return nodes.GetSoundSpeed(iPoint); } - } - /*--- Correct the eigenvalue values across any periodic boundaries. ---*/ - - for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { - InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_MAX_EIG); - CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_MAX_EIG); - } + } soundSpeed; - /*--- MPI parallelization ---*/ + /*--- Instantiate generic implementation. ---*/ - InitiateComms(geometry, config, MAX_EIGENVALUE); - CompleteComms(geometry, config, MAX_EIGENVALUE); + SetMax_Eigenvalue_impl(soundSpeed, geometry, config); } @@ -3299,409 +2873,121 @@ void CEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *co CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN); } - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); - CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); - -} - -void CEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config) { - - /*--- We can access memory more efficiently if there are no periodic boundaries. ---*/ - - const bool isPeriodic = (config->GetnMarker_Periodic() > 0); - - /*--- Loop domain points. ---*/ - - SU2_OMP_FOR_DYN(omp_chunk_size) - for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) { - - const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); - const su2double Pressure_i = nodes->GetPressure(iPoint); - - /*--- Initialize. ---*/ - iPoint_UndLapl[iPoint] = 0.0; - jPoint_UndLapl[iPoint] = 0.0; - - /*--- Loop over the neighbors of point i. ---*/ - for (auto jPoint : geometry->nodes->GetPoints(iPoint)) - { - bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); - - /*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/ - if (boundary_i && !boundary_j) continue; - - su2double Pressure_j = nodes->GetPressure(jPoint); - - /*--- Dissipation sensor, add pressure difference and pressure sum. ---*/ - iPoint_UndLapl[iPoint] += Pressure_j - Pressure_i; - jPoint_UndLapl[iPoint] += Pressure_j + Pressure_i; - } - - if (!isPeriodic) { - nodes->SetSensor(iPoint, fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); - } - } - - if (isPeriodic) { - /*--- Correct the sensor values across any periodic boundaries. ---*/ - - for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { - InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR); - CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR); - } - - /*--- Set final pressure switch for each point ---*/ - - SU2_OMP_FOR_STAT(omp_chunk_size) - for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) - nodes->SetSensor(iPoint, fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); - } - - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, SENSOR); - CompleteComms(geometry, config, SENSOR); - -} - -void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config){ - - SU2_OMP_FOR_STAT(omp_chunk_size) - for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - - /*---- Ducros sensor for iPoint and its neighbor points to avoid lower dissipation near shocks. ---*/ - - su2double Ducros_i = 0.0; - const auto nNeigh = geometry->nodes->GetnPoint(iPoint); - - for (unsigned short iNeigh = 0; iNeigh <= nNeigh; iNeigh++) { - - auto jPoint = iPoint; // when iNeigh == nNeigh - if (iNeigh < nNeigh) jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - - /*---- Dilatation for jPoint ---*/ - - su2double uixi=0.0; - for(unsigned short iDim = 0; iDim < nDim; iDim++){ - uixi += nodes->GetGradient_Primitive(jPoint,iDim+1, iDim); - } - - /*--- Compute norm of vorticity ---*/ - - const su2double* Vorticity = nodes->GetVorticity(jPoint); - su2double Omega = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Omega += pow(Vorticity[iDim], 2); - } - Omega = sqrt(Omega); - - su2double Ducros_j = 0.0; - - if (config->GetKind_RoeLowDiss() == FD_DUCROS) { - Ducros_j = -uixi / (fabs(uixi) + Omega + 1e-20); - } - else if (config->GetKind_RoeLowDiss() == NTS_DUCROS) { - Ducros_j = pow(uixi,2.0) /(pow(uixi,2.0)+ pow(Omega,2.0) + 1e-20); - } - Ducros_i = max(Ducros_i, Ducros_j); - } - - nodes->SetSensor(iPoint, Ducros_i); - } - - InitiateComms(geometry, config, SENSOR); - CompleteComms(geometry, config, SENSOR); - -} - -template -void CEulerSolver::Explicit_Iteration(CGeometry *geometry, CSolver **solver_container, - CConfig *config, unsigned short iRKStep) { - - static_assert(IntegrationType == CLASSICAL_RK4_EXPLICIT || - IntegrationType == RUNGE_KUTTA_EXPLICIT || - IntegrationType == EULER_EXPLICIT, ""); - - const bool adjoint = config->GetContinuous_Adjoint(); - - const su2double RK_AlphaCoeff = config->Get_Alpha_RKStep(iRKStep); - - /*--- Hard-coded classical RK4 coefficients. Will be added to config. ---*/ - const su2double RK_FuncCoeff[] = {1.0/6.0, 1.0/3.0, 1.0/3.0, 1.0/6.0}; - const su2double RK_TimeCoeff[] = {0.5, 0.5, 1.0, 1.0}; - - /*--- Set shared residual variables to 0 and declare - * local ones for current thread to work on. ---*/ - - SU2_OMP_MASTER - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 0); - } - SU2_OMP_BARRIER - - su2double resMax[MAXNVAR] = {0.0}, resRMS[MAXNVAR] = {0.0}; - const su2double* coordMax[MAXNVAR] = {nullptr}; - unsigned long idxMax[MAXNVAR] = {0}; - - /*--- Update the solution and residuals ---*/ - - SU2_OMP(for schedule(static,omp_chunk_size) nowait) - for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { - - su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); - su2double Delta = nodes->GetDelta_Time(iPoint) / Vol; - - const su2double* Res_TruncError = nodes->GetResTruncError(iPoint); - const su2double* Residual = LinSysRes.GetBlock(iPoint); - - if (!adjoint) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - - su2double Res = Residual[iVar] + Res_TruncError[iVar]; - - /*--- "Static" switch which should be optimized at compile time. ---*/ - switch(IntegrationType) { - - case EULER_EXPLICIT: - nodes->AddSolution(iPoint,iVar, -Res*Delta); - break; - - case RUNGE_KUTTA_EXPLICIT: - nodes->AddSolution(iPoint, iVar, -Res*Delta*RK_AlphaCoeff); - break; - - case CLASSICAL_RK4_EXPLICIT: - { - su2double tmp_time = -1.0*RK_TimeCoeff[iRKStep]*Delta; - su2double tmp_func = -1.0*RK_FuncCoeff[iRKStep]*Delta; - - if (iRKStep < 3) { - /* Base Solution Update */ - nodes->AddSolution(iPoint,iVar, tmp_time*Res); - - /* New Solution Update */ - nodes->AddSolution_New(iPoint,iVar, tmp_func*Res); - } else { - nodes->SetSolution(iPoint, iVar, nodes->GetSolution_New(iPoint, iVar) + tmp_func*Res); - } - } - break; - } - - /*--- Update residual information for current thread. ---*/ - resRMS[iVar] += Res*Res; - if (fabs(Res) > resMax[iVar]) { - resMax[iVar] = fabs(Res); - idxMax[iVar] = iPoint; - coordMax[iVar] = geometry->nodes->GetCoord(iPoint); - } - } - } - } - if (!adjoint) { - /*--- Reduce residual information over all threads in this rank. ---*/ - SU2_OMP_CRITICAL - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - AddRes_RMS(iVar, resRMS[iVar]); - AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]); - } - } - SU2_OMP_BARRIER - - /*--- MPI solution ---*/ - - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); - - SU2_OMP_MASTER - { - /*--- Compute the root mean square residual ---*/ - - SetResidual_RMS(geometry, config); - - /*--- For verification cases, compute the global error metrics. ---*/ - - ComputeVerificationError(geometry, config); - } - SU2_OMP_BARRIER - -} - -void CEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_container, - CConfig *config, unsigned short iRKStep) { - - Explicit_Iteration(geometry, solver_container, config, iRKStep); -} - -void CEulerSolver::ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_container, - CConfig *config, unsigned short iRKStep) { - - Explicit_Iteration(geometry, solver_container, config, iRKStep); -} + /*--- MPI parallelization ---*/ -void CEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); + CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); - Explicit_Iteration(geometry, solver_container, config, 0); } -void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - - const bool adjoint = config->GetContinuous_Adjoint(); - const bool roe_turkel = config->GetKind_Upwind_Flow() == TURKEL; - const bool low_mach_prec = config->Low_Mach_Preconditioning(); +void CEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config) { - /*--- Local matrix for preconditioning. ---*/ - su2double** LowMachPrec = nullptr; - if (roe_turkel || low_mach_prec) { - LowMachPrec = new su2double* [nVar]; - for(unsigned short iVar = 0; iVar < nVar; ++iVar) - LowMachPrec[iVar] = new su2double [nVar]; - } + /*--- Define an object for the sensor variable, pressure. ---*/ + struct SensVar { + FORCEINLINE su2double operator() (const CEulerVariable& nodes, unsigned long iPoint) const { + return nodes.GetPressure(iPoint); + } + } sensVar; - /*--- Set shared residual variables to 0 and declare - * local ones for current thread to work on. ---*/ + /*--- Instantiate generic implementation. ---*/ + SetCentered_Dissipation_Sensor_impl(sensVar, geometry, config); +} - SU2_OMP_MASTER - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 0); - } - SU2_OMP_BARRIER +void CEulerSolver::SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config){ - su2double resMax[MAXNVAR] = {0.0}, resRMS[MAXNVAR] = {0.0}; - const su2double* coordMax[MAXNVAR] = {nullptr}; - unsigned long idxMax[MAXNVAR] = {0}; + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) { - /*--- Build implicit system ---*/ + /*---- Ducros sensor for iPoint and its neighbor points to avoid lower dissipation near shocks. ---*/ - SU2_OMP(for schedule(static,omp_chunk_size) nowait) - for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + su2double Ducros_i = 0.0; + const auto nNeigh = geometry->nodes->GetnPoint(iPoint); - /*--- Read the residual ---*/ + for (unsigned short iNeigh = 0; iNeigh <= nNeigh; iNeigh++) { - su2double* local_Res_TruncError = nodes->GetResTruncError(iPoint); + auto jPoint = iPoint; // when iNeigh == nNeigh + if (iNeigh < nNeigh) jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - /*--- Read the volume ---*/ + /*---- Dilatation for jPoint ---*/ - su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); + su2double uixi=0.0; + for(unsigned short iDim = 0; iDim < nDim; iDim++){ + uixi += nodes->GetGradient_Primitive(jPoint,iDim+1, iDim); + } - /*--- Modify matrix diagonal to assure diagonal dominance ---*/ + /*--- Compute norm of vorticity ---*/ - if (nodes->GetDelta_Time(iPoint) != 0.0) { + const su2double* Vorticity = nodes->GetVorticity(jPoint); + su2double Omega = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Omega += pow(Vorticity[iDim], 2); + } + Omega = sqrt(Omega); - su2double Delta = Vol / nodes->GetDelta_Time(iPoint); + su2double Ducros_j = 0.0; - if (roe_turkel || low_mach_prec) { - SetPreconditioner(config, iPoint, Delta, LowMachPrec); - Jacobian.AddBlock2Diag(iPoint, LowMachPrec); - } - else { - Jacobian.AddVal2Diag(iPoint, Delta); + if (config->GetKind_RoeLowDiss() == FD_DUCROS) { + Ducros_j = -uixi / (fabs(uixi) + Omega + 1e-20); } - } - else { - Jacobian.SetVal2Diag(iPoint, 1.0); - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - LinSysRes(iPoint,iVar) = 0.0; - local_Res_TruncError[iVar] = 0.0; + else if (config->GetKind_RoeLowDiss() == NTS_DUCROS) { + Ducros_j = pow(uixi,2.0) /(pow(uixi,2.0)+ pow(Omega,2.0) + 1e-20); } + Ducros_i = max(Ducros_i, Ducros_j); } - /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/ - - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - unsigned long total_index = iPoint*nVar + iVar; - LinSysRes[total_index] = - (LinSysRes[total_index] + local_Res_TruncError[iVar]); - LinSysSol[total_index] = 0.0; - - su2double Res = fabs(LinSysRes[total_index]); - resRMS[iVar] += Res*Res; - if (Res > resMax[iVar]) { - resMax[iVar] = Res; - idxMax[iVar] = iPoint; - coordMax[iVar] = geometry->nodes->GetCoord(iPoint); - } - } - } - SU2_OMP_CRITICAL - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - AddRes_RMS(iVar, resRMS[iVar]); - AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]); + nodes->SetSensor(iPoint, Ducros_i); } - /*--- Initialize residual and solution at the ghost points ---*/ - - SU2_OMP(sections nowait) - { - SU2_OMP(section) - for (unsigned long iPoint = nPointDomain; iPoint < nPoint; iPoint++) - LinSysRes.SetBlock_Zero(iPoint); - - SU2_OMP(section) - for (unsigned long iPoint = nPointDomain; iPoint < nPoint; iPoint++) - LinSysSol.SetBlock_Zero(iPoint); - } + InitiateComms(geometry, config, SENSOR); + CompleteComms(geometry, config, SENSOR); - /*--- Free local preconditioner. ---*/ - if (LowMachPrec) { - for(unsigned short iVar = 0; iVar < nVar; ++iVar) - delete [] LowMachPrec[iVar]; - delete [] LowMachPrec; - } +} - /*--- Solve or smooth the linear system. ---*/ +void CEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iRKStep) { - auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); - SU2_OMP_MASTER - { - SetIterLinSolver(iter); - SetResLinSolver(System.GetResidual()); - } - SU2_OMP_BARRIER + Explicit_Iteration(geometry, solver_container, config, iRKStep); +} +void CEulerSolver::ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iRKStep) { - ComputeUnderRelaxationFactor(solver_container, config); + Explicit_Iteration(geometry, solver_container, config, iRKStep); +} - /*--- Update solution (system written in terms of increments) ---*/ +void CEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - if (!adjoint) { - SU2_OMP_FOR_STAT(omp_chunk_size) - for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - nodes->AddSolution(iPoint, iVar, nodes->GetUnderRelaxation(iPoint)*LinSysSol[iPoint*nVar+iVar]); - } - } - } + Explicit_Iteration(geometry, solver_container, config, 0); +} - for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { - InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); - CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); - } +void CEulerSolver::PrepareImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) { - /*--- MPI solution ---*/ + struct LowMachPrec { + const CEulerSolver* solver; + const bool active; + su2activematrix matrix; - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); + LowMachPrec(const CEulerSolver* s, bool a, unsigned short nVar) : solver(s), active(a) { + if (active) matrix.resize(nVar,nVar); + } - SU2_OMP_MASTER - { - /*--- Compute the root mean square residual ---*/ + FORCEINLINE const su2activematrix& operator() (const CConfig* config, unsigned long iPoint, su2double delta) { + solver->SetPreconditioner(config, iPoint, delta, matrix); + return matrix; + } - SetResidual_RMS(geometry, config); + } precond(this, config->Low_Mach_Preconditioning() || (config->GetKind_Upwind_Flow() == TURKEL), nVar); - /*--- For verification cases, compute the global error metrics. ---*/ + PrepareImplicitIteration_impl(precond, geometry, config); +} - ComputeVerificationError(geometry, config); - } - SU2_OMP_BARRIER +void CEulerSolver::CompleteImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) { + CompleteImplicitIteration_impl(geometry, config); } void CEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPoint, - su2double delta, su2double** preconditioner) const { + su2double delta, su2activematrix& preconditioner) const { unsigned short iDim, jDim, iVar, jVar; su2double local_Mach, rho, enthalpy, soundspeed, sq_vel; @@ -4080,32 +3366,32 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns /*--- All the ranks to compute the total value ---*/ - SU2_MPI::Allreduce(Inlet_MassFlow_Local, Inlet_MassFlow_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_ReverseMassFlow_Local, Inlet_ReverseMassFlow_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_Pressure_Local, Inlet_Pressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_Mach_Local, Inlet_Mach_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_MinPressure_Local, Inlet_MinPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_MaxPressure_Local, Inlet_MaxPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_TotalPressure_Local, Inlet_TotalPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_Temperature_Local, Inlet_Temperature_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_TotalTemperature_Local, Inlet_TotalTemperature_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_RamDrag_Local, Inlet_RamDrag_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_Force_Local, Inlet_Force_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_Power_Local, Inlet_Power_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_Area_Local, Inlet_Area_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_XCG_Local, Inlet_XCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Inlet_YCG_Local, Inlet_YCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - if (nDim == 3) SU2_MPI::Allreduce(Inlet_ZCG_Local, Inlet_ZCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - - SU2_MPI::Allreduce(Outlet_MassFlow_Local, Outlet_MassFlow_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Pressure_Local, Outlet_Pressure_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_TotalPressure_Local, Outlet_TotalPressure_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Temperature_Local, Outlet_Temperature_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_TotalTemperature_Local, Outlet_TotalTemperature_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_GrossThrust_Local, Outlet_GrossThrust_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Force_Local, Outlet_Force_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Power_Local, Outlet_Power_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Area_Local, Outlet_Area_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Inlet_MassFlow_Local, Inlet_MassFlow_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_ReverseMassFlow_Local, Inlet_ReverseMassFlow_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_Pressure_Local, Inlet_Pressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_Mach_Local, Inlet_Mach_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_MinPressure_Local, Inlet_MinPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_MaxPressure_Local, Inlet_MaxPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_TotalPressure_Local, Inlet_TotalPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_Temperature_Local, Inlet_Temperature_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_TotalTemperature_Local, Inlet_TotalTemperature_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_RamDrag_Local, Inlet_RamDrag_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_Force_Local, Inlet_Force_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_Power_Local, Inlet_Power_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_Area_Local, Inlet_Area_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_XCG_Local, Inlet_XCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Inlet_YCG_Local, Inlet_YCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + if (nDim == 3) SU2_MPI::Allreduce(Inlet_ZCG_Local, Inlet_ZCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + + SU2_MPI::Allreduce(Outlet_MassFlow_Local, Outlet_MassFlow_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Pressure_Local, Outlet_Pressure_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_TotalPressure_Local, Outlet_TotalPressure_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Temperature_Local, Outlet_Temperature_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_TotalTemperature_Local, Outlet_TotalTemperature_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_GrossThrust_Local, Outlet_GrossThrust_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Force_Local, Outlet_Force_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Power_Local, Outlet_Power_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Area_Local, Outlet_Area_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Compute the value of the average surface temperature and pressure and set the value in the config structure for future use ---*/ @@ -5084,7 +4370,7 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con if (!ActDisk_Info) config->SetInitial_BCThrust(0.0); MyBCThrust = config->GetInitial_BCThrust(); - SU2_MPI::Allreduce(&MyBCThrust, &BCThrust, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyBCThrust, &BCThrust, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); config->SetInitial_BCThrust(BCThrust); } @@ -5585,10 +4871,10 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, unsigned long iVertex, iPoint, Point_Normal; su2double *GridVel; - su2double Area, UnitNormal[3] = {0.0,0.0,0.0}; - su2double Density, Pressure, Energy, Velocity[3] = {0.0,0.0,0.0}; - su2double Density_Bound, Pressure_Bound, Vel_Bound[3] = {0.0,0.0,0.0}; - su2double Density_Infty, Pressure_Infty, Vel_Infty[3] = {0.0,0.0,0.0}; + su2double Area, UnitNormal[MAXNDIM] = {0.0}; + su2double Density, Pressure, Energy, Velocity[MAXNDIM] = {0.0}; + su2double Density_Bound, Pressure_Bound, Vel_Bound[MAXNDIM] = {0.0}; + su2double Density_Infty, Pressure_Infty, Vel_Infty[MAXNDIM] = {0.0}; su2double SoundSpeed, Entropy, Velocity2, Vn; su2double SoundSpeed_Bound, Entropy_Bound, Vel2_Bound, Vn_Bound; su2double SoundSpeed_Infty, Entropy_Infty, Vel2_Infty, Vn_Infty, Qn_Infty; @@ -5796,8 +5082,10 @@ void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, /*--- Set the normal vector and the coordinates ---*/ visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Primitive variables, and gradient ---*/ @@ -5841,7 +5129,8 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, unsigned short iDim, iVar, jVar, kVar; unsigned long iVertex, iPoint, Point_Normal; - su2double P_Total, T_Total, P_static, T_static, Rho_static, *Mach, *Flow_Dir, Area, UnitNormal[3]; + const su2double *Flow_Dir, *Mach; + su2double P_Total, T_Total, P_static, T_static, Rho_static, Area, UnitNormal[MAXNDIM]; su2double *Velocity_b, Velocity2_b, Enthalpy_b, Energy_b, StaticEnergy_b, Density_b, Kappa_b, Chi_b, Pressure_b, Temperature_b; su2double *Velocity_e, Velocity2_e, VelMag_e, Enthalpy_e, Entropy_e, Energy_e = 0.0, StaticEnthalpy_e, StaticEnergy_e, Density_e = 0.0, Pressure_e; su2double *Velocity_i, Velocity2_i, Enthalpy_i, Energy_i, StaticEnergy_i, Density_i, Kappa_i, Chi_i, Pressure_i, SoundSpeed_i; @@ -6263,7 +5552,10 @@ void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, /*--- Set the normal vector and the coordinates ---*/ visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Primitive variables, and gradient ---*/ @@ -6352,7 +5644,8 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain unsigned short iDim, iVar, jVar, kVar, iSpan; unsigned long iPoint, Point_Normal, oldVertex, iVertex; - su2double P_Total, T_Total, *Flow_Dir; + const su2double *Flow_Dir; + su2double P_Total, T_Total; su2double *Velocity_b, Velocity2_b, Enthalpy_b, Energy_b, StaticEnergy_b, Density_b, Kappa_b, Chi_b, Pressure_b, Temperature_b; su2double *Velocity_e, Velocity2_e, Enthalpy_e, Entropy_e, Energy_e = 0.0, StaticEnthalpy_e, StaticEnergy_e, Density_e = 0.0, Pressure_e; su2double *Velocity_i, Velocity2_i, Enthalpy_i, Energy_i, StaticEnergy_i, Density_i, Kappa_i, Chi_i, Pressure_i, SoundSpeed_i; @@ -6776,7 +6069,10 @@ void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_contain /*--- Set the normal vector and the coordinates ---*/ visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Primitive variables, and gradient ---*/ @@ -6977,12 +6273,12 @@ void CEulerSolver::PreprocessBC_Giles(CGeometry *geometry, CConfig *config, CNum cktemp_out2 = complex(0.0,0.0); - SU2_MPI::Allreduce(&MyRe_inf, &Re_inf, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyIm_inf, &Im_inf, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyRe_out1, &Re_out1, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyIm_out1, &Im_out1, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyRe_out2, &Re_out2, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyIm_out2, &Im_out2, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyRe_inf, &Re_inf, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyIm_inf, &Im_inf, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyRe_out1, &Re_out1, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyIm_out1, &Im_out1, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyRe_out2, &Re_out2, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyIm_out2, &Im_out2, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); cktemp_inf = complex(Re_inf,Im_inf); cktemp_out1 = complex(Re_out1,Im_out1); @@ -7036,7 +6332,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu su2double relfacFouCfg = config->GetGiles_RelaxFactorFourier(Marker_Tag); su2double *Normal; su2double TwoPiThetaFreq_Pitch, pitch,theta; - const su2double *SpanWiseValues = nullptr; + const su2double *SpanWiseValues = nullptr, *FlowDir; su2double spanPercent, extrarelfacAvg = 0.0, deltaSpan = 0.0, relfacAvg, relfacFou, coeffrelfacAvg = 0.0; unsigned short Turbo_Flag; @@ -7053,7 +6349,7 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu S_boundary = new su2double[8]; su2double AvgMach , *cj, GilesBeta, *delta_c, **R_Matrix, *deltaprim, **R_c_inv,**R_c, alphaIn_BC, gammaIn_BC = 0, - P_Total, T_Total, *FlowDir, Enthalpy_BC, Entropy_BC, *R, *c_avg,*dcjs, Beta_inf2, c2js_Re, c3js_Re, cOutjs_Re, avgVel2 =0.0; + P_Total, T_Total, Enthalpy_BC, Entropy_BC, *R, *c_avg,*dcjs, Beta_inf2, c2js_Re, c3js_Re, cOutjs_Re, avgVel2 =0.0; long freq; @@ -7676,7 +6972,10 @@ void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container, CNu /*--- Set the normal vector and the coordinates ---*/ visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Primitive variables, and gradient ---*/ @@ -8016,7 +7315,10 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, // /*--- Set the normal vector and the coordinates ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // @@ -8190,7 +7492,10 @@ void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, // /*--- Set the normal vector and the coordinates ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // @@ -8233,7 +7538,7 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con unsigned long iVertex, iPoint; su2double *V_inlet, *V_domain; - su2double Density, Pressure, Temperature, Energy, *Vel, Velocity2; + su2double Density, Energy, Velocity2; su2double Gas_Constant = config->GetGas_ConstantND(); bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); @@ -8246,9 +7551,9 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con so all flow variables can be imposed at the inlet. First, retrieve the specified values for the primitive variables. ---*/ - Temperature = config->GetInlet_Temperature(Marker_Tag); - Pressure = config->GetInlet_Pressure(Marker_Tag); - Vel = config->GetInlet_Velocity(Marker_Tag); + auto Temperature = config->GetInlet_Temperature(Marker_Tag); + auto Pressure = config->GetInlet_Pressure(Marker_Tag); + auto Vel = config->GetInlet_Velocity(Marker_Tag); /*--- Non-dim. the inputs if necessary. ---*/ @@ -8334,7 +7639,10 @@ void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_con // /*--- Set the normal vector and the coordinates ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // @@ -8456,7 +7764,10 @@ void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_co // /*--- Set the normal vector and the coordinates ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // @@ -8676,7 +7987,10 @@ void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_contai // /*--- Set the normal vector and the coordinates ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // @@ -8927,7 +8241,10 @@ void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_conta // /*--- Set the normal vector and the coordinates ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // @@ -9487,7 +8804,10 @@ void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, C // /*--- Set the normal vector and the coordinates ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->node[iPoint_Normal]->GetCoord()); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // @@ -9760,182 +9080,6 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver } } -void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, - unsigned short iRKStep, unsigned short iMesh, unsigned short RunTime_EqSystem) { - - /*--- Local variables ---*/ - - unsigned short iVar, iMarker, iDim, iNeigh; - unsigned long iPoint, jPoint, iEdge, iVertex; - - const su2double *U_time_nM1 = nullptr, *U_time_n = nullptr, *U_time_nP1 = nullptr; - su2double Volume_nM1, Volume_nP1, TimeStep; - const su2double *Normal = nullptr, *GridVel_i = nullptr, *GridVel_j = nullptr; - su2double Residual_GCL; - - const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - const bool first_order = (config->GetTime_Marching() == DT_STEPPING_1ST); - const bool second_order = (config->GetTime_Marching() == DT_STEPPING_2ND); - - /*--- 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) ---*/ - - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - /*--- 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 (first_order) - LinSysRes(iPoint,iVar) += (U_time_nP1[iVar] - U_time_n[iVar])*Volume_nP1 / TimeStep; - if (second_order) - LinSysRes(iPoint,iVar) += ( 3.0*U_time_nP1[iVar] - 4.0*U_time_n[iVar] - +1.0*U_time_nM1[iVar])*Volume_nP1 / (2.0*TimeStep); - } - - /*--- Compute the Jacobian contribution due to the dual time source term. ---*/ - if (implicit) { - if (first_order) Jacobian.AddVal2Diag(iPoint, Volume_nP1/TimeStep); - if (second_order) Jacobian.AddVal2Diag(iPoint, (Volume_nP1*3.0)/(2.0*TimeStep)); - } - } - - } - - 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. ---*/ - - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; ++iPoint) { - - GridVel_i = geometry->nodes->GetGridVel(iPoint); - U_time_n = nodes->GetSolution_time_n(iPoint); - - for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) { - - iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - Normal = geometry->edges->GetNormal(iEdge); - - jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - GridVel_j = geometry->nodes->GetGridVel(jPoint); - - /*--- Determine whether to consider the normal outward or inward. ---*/ - su2double dir = (geometry->edges->GetNode(iEdge,0) == iPoint)? 0.5 : -0.5; - - Residual_GCL = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - Residual_GCL += dir*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; - - for (iVar = 0; iVar < nVar; iVar++) - LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL; - } - } - - /*--- 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)) { - - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { - - /*--- 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++) - LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL; - } - } - } - - /*--- Loop over all nodes (excluding halos) to compute the remainder - of the dual time-stepping source term. ---*/ - - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - /*--- 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 (first_order) - LinSysRes(iPoint,iVar) += (U_time_nP1[iVar] - U_time_n[iVar])*(Volume_nP1/TimeStep); - if (second_order) - LinSysRes(iPoint,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)); - } - - /*--- Compute the Jacobian contribution due to the dual time source term. ---*/ - if (implicit) { - if (first_order) Jacobian.AddVal2Diag(iPoint, Volume_nP1/TimeStep); - if (second_order) Jacobian.AddVal2Diag(iPoint, (Volume_nP1*3.0)/(2.0*TimeStep)); - } - } - } - -} - void CEulerSolver::PrintVerificationError(const CConfig *config) const { if ((rank != MASTER_NODE) || (MGLevel != MESH_0)) return; @@ -9974,220 +9118,12 @@ void CEulerSolver::PrintVerificationError(const CConfig *config) const { } } -void CEulerSolver::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; - const su2double* Solution_Fine = nullptr; - const passivedouble* Coord = nullptr; - bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - bool static_fsi = ((config->GetTime_Marching() == STEADY) && config->GetFSI_Simulation()); - bool steady_restart = config->GetSteadyRestart(); - bool turbulent = (config->GetKind_Turb_Model() != NONE); - - string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", val_iter); - - /*--- To make this routine safe to call in parallel most of it can only be executed by one thread. ---*/ - SU2_OMP_MASTER { - - /*--- 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. ---*/ - - unsigned long counter = 0, iPoint_Global = 0; - for (; 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. ---*/ - - auto 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. ---*/ - - index = counter*Restart_Vars[1] + skipVars; - for (iVar = 0; iVar < nVar; ++iVar) - nodes->SetSolution(iPoint_Local, iVar, Restart_Data[index+iVar]); - - /*--- For dynamic meshes, read in and store the - grid coordinates and grid velocities for each node. ---*/ - - if (dynamic_grid && val_update_geo) { - - /*--- 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 ---*/ - - /*--- Rewind the index to retrieve the Coords. ---*/ - index = counter*Restart_Vars[1]; - Coord = &Restart_Data[index]; - - su2double GridVel[MAXNDIM] = {0.0}; - if (!steady_restart) { - /*--- Move the index forward to get the grid velocities. ---*/ - index += skipVars + nVar + 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]); - } - } - - /*--- For static FSI problems, grid_movement is 0 but we need to read in and store the - grid coordinates for each node (but not the grid velocities, as there are none). ---*/ - - if (static_fsi && val_update_geo) { - /*--- Rewind the index to retrieve the Coords. ---*/ - index = counter*Restart_Vars[1]; - Coord = &Restart_Data[index]; - - for (iDim = 0; iDim < nDim; iDim++) { - geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]); - } - } - - /*--- Increment the overall counter for how many points have been loaded. ---*/ - counter++; - } - - } - - /*--- Detect a wrong solution file ---*/ - - if (counter != 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); - } - } // end SU2_OMP_MASTER - SU2_OMP_BARRIER - - /*--- Update the geometry for flows on deforming meshes ---*/ - - if ((dynamic_grid || static_fsi) && val_update_geo) { - - /*--- 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]->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 also 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); - - /*--- 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++) { - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint); - su2double Solution_Coarse[MAXNVAR] = {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_Coarse[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; - } - } - solver[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution_Coarse); - } - - solver[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); - - 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); - } - - /*--- Go back to single threaded execution. ---*/ - SU2_OMP_MASTER - { - /*--- Delete the class memory that is used to load the restart. ---*/ - - delete [] Restart_Vars; Restart_Vars = nullptr; - delete [] Restart_Data; Restart_Data = nullptr; - - } // end SU2_OMP_MASTER - SU2_OMP_BARRIER - -} - -void CEulerSolver::SetFreeStream_Solution(CConfig *config) { +void CEulerSolver::SetFreeStream_Solution(const CConfig *config) { unsigned long iPoint; unsigned short iDim; + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPoint; iPoint++) { nodes->SetSolution(iPoint,0, Density_Inf); for (iDim = 0; iDim < nDim; iDim++) { @@ -10202,7 +9138,7 @@ void CEulerSolver::SetFreeStream_TurboSolution(CConfig *config) { unsigned long iPoint; unsigned short iDim; unsigned short iZone = config->GetiZone(); - su2double *turboVelocity, *cartVelocity, *turboNormal; + su2double *turboVelocity, *cartVelocity; su2double Alpha = config->GetAoA()*PI_NUMBER/180.0; su2double Mach = config->GetMach(); @@ -10211,7 +9147,7 @@ void CEulerSolver::SetFreeStream_TurboSolution(CConfig *config) { turboVelocity = new su2double[nDim]; cartVelocity = new su2double[nDim]; - turboNormal = config->GetFreeStreamTurboNormal(); + auto turboNormal = config->GetFreeStreamTurboNormal(); GetFluidModel()->SetTDState_Prho(Pressure_Inf, Density_Inf); SoundSpeed = GetFluidModel()->GetSoundSpeed(); @@ -10324,8 +9260,8 @@ void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CCon su2double MyTotalAreaDensity = TotalAreaDensity; su2double MyTotalAreaPressure = TotalAreaPressure; - SU2_MPI::Allreduce(&MyTotalAreaDensity, &TotalAreaDensity, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyTotalAreaPressure, &TotalAreaPressure, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyTotalAreaDensity, &TotalAreaDensity, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyTotalAreaPressure, &TotalAreaPressure, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); su2double* MyTotalAreaVelocity = new su2double[nDim]; @@ -10333,7 +9269,7 @@ void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CCon MyTotalAreaVelocity[iDim] = TotalAreaVelocity[iDim]; } - SU2_MPI::Allreduce(MyTotalAreaVelocity, TotalAreaVelocity, nDim, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(MyTotalAreaVelocity, TotalAreaVelocity, nDim, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); delete [] MyTotalAreaVelocity; @@ -10652,7 +9588,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC auto Allreduce = [](su2double x) { su2double tmp = x; x = 0.0; - SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &x, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); return x; }; @@ -10677,7 +9613,7 @@ void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CC su2double* buffer = new su2double[max(nVar,nDim)]; auto Allreduce_inplace = [buffer](int size, su2double* x) { - SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(x, buffer, size, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); for(int i=0; i @@ -232,18 +233,6 @@ CFEASolver::CFEASolver(CGeometry *geometry, CConfig *config) : CSolver() { /*--- Penalty value - to maintain constant the stiffness in optimization problems - TODO: this has to be improved ---*/ PenaltyValue = 0.0; - /*--- Perform the MPI communication of the solution ---*/ - - InitiateComms(geometry, config, SOLUTION_FEA); - CompleteComms(geometry, config, SOLUTION_FEA); - - /*--- If dynamic, we also need to communicate the old solution ---*/ - - if (dynamic) { - InitiateComms(geometry, config, SOLUTION_FEA_OLD); - CompleteComms(geometry, config, SOLUTION_FEA_OLD); - } - if (size != SINGLE_NODE) { vector essentialMarkers; for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { @@ -315,7 +304,7 @@ void CFEASolver::HybridParallelInitialization(CGeometry* geometry) { } su2double minEff = 1.0; - SU2_MPI::Reduce(¶llelEff, &minEff, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(¶llelEff, &minEff, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, SU2_MPI::GetComm()); if (minEff < COLORING_EFF_THRESH) { cout << "WARNING: The element coloring efficiency was " << minEff << ", a fallback strategy is in use.\n" @@ -336,23 +325,16 @@ void CFEASolver::HybridParallelInitialization(CGeometry* geometry) { void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) { - unsigned long iElem; - unsigned long index; - unsigned long elProperties[4]; - - unsigned short iZone = config->GetiZone(); - unsigned short nZone = geometry->GetnZone(); - - bool topology_mode = config->GetTopology_Optimization(); + const auto iZone = config->GetiZone(); + const auto nZone = geometry->GetnZone(); - string filename; - ifstream properties_file; + const bool topology_mode = config->GetTopology_Optimization(); element_properties = new CProperty*[nElement]; /*--- Restart the solution from file information ---*/ - filename = config->GetFEA_FileName(); + auto filename = config->GetFEA_FileName(); /*--- If multizone, append zone name ---*/ if (nZone > 1) @@ -360,7 +342,8 @@ void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) { if (rank == MASTER_NODE) cout << "Filename: " << filename << "." << endl; - properties_file.open(filename.data(), ios::in); + ifstream properties_file; + properties_file.open(filename); /*--- In case there is no file, all elements get the same property (0) ---*/ @@ -373,7 +356,7 @@ void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) { SU2_MPI::Error("Topology mode requires an element-based properties file.",CURRENT_FUNCTION); } - for (iElem = 0; iElem < nElement; iElem++){ + for (auto iElem = 0ul; iElem < nElement; iElem++){ element_properties[iElem] = new CElementProperty(FEA_TERM, 0, 0, 0); } @@ -384,24 +367,15 @@ void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) { element_based = true; - /*--- In case this is a parallel simulation, we need to perform the - Global2Local index transformation first. ---*/ - - long *Global2Local = new long[geometry->GetGlobal_nElemDomain()]; - - /*--- First, set all indices to a negative value by default ---*/ + /*--- In case this is a parallel simulation, we need to perform the Global2Local index transformation first. ---*/ - for (iElem = 0; iElem < geometry->GetGlobal_nElemDomain(); iElem++) - Global2Local[iElem] = -1; + unordered_map Global2Local; - /*--- Now fill array with the transform values only for the points in the rank (including halos) ---*/ - - for (iElem = 0; iElem < nElement; iElem++) + for (auto iElem = 0ul; iElem < nElement; iElem++) Global2Local[geometry->elem[iElem]->GetGlobalIndex()] = iElem; /*--- Read all lines in the restart file ---*/ - long iElem_Local; unsigned long iElem_Global_Local = 0, iElem_Global = 0; string text_line; /*--- The first line is the header ---*/ @@ -419,9 +393,13 @@ void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) { Otherwise, the local index for this node on the current processor will be returned and used to instantiate the vars. ---*/ - iElem_Local = Global2Local[iElem_Global]; + auto it = Global2Local.find(iElem_Global); + + if (it != Global2Local.end()) { - if (iElem_Local >= 0) { + auto iElem_Local = it->second; + + unsigned long elProperties[4], index; if (config->GetAdvanced_FEAElementBased() || topology_mode){ point_line >> index >> elProperties[0] >> elProperties[1] >> elProperties[2] >> elProperties[3]; @@ -453,34 +431,18 @@ void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) { string("It could be empty lines at the end of the file."), CURRENT_FUNCTION); } - /*--- Close the restart file ---*/ - - properties_file.close(); - - /*--- Free memory needed for the transformation ---*/ - - delete [] Global2Local; - } } void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { - unsigned long iPoint; - unsigned long index; - - unsigned short iVar; - unsigned short iZone = config->GetiZone(); - unsigned short nZone = geometry->GetnZone(); - - string filename; - ifstream prestretch_file; - + const auto iZone = config->GetiZone(); + const auto nZone = geometry->GetnZone(); /*--- Restart the solution from file information ---*/ - filename = config->GetPrestretch_FEMFileName(); + auto filename = config->GetPrestretch_FEMFileName(); /*--- If multizone, append zone name ---*/ if (nZone > 1) @@ -488,7 +450,8 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { if (rank == MASTER_NODE) cout << "Filename: " << filename << "." << endl; - prestretch_file.open(filename.data(), ios::in); + ifstream prestretch_file; + prestretch_file.open(filename); /*--- In case there is no file ---*/ @@ -496,20 +459,15 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { SU2_MPI::Error(string("There is no FEM prestretch reference file ") + filename, CURRENT_FUNCTION); } - /*--- In case this is a parallel simulation, we need to perform the - Global2Local index transformation first. ---*/ - - map Global2Local; - map::const_iterator MI; + /*--- Make a global to local map that also covers halo nodes (the one in geometry does not). ---*/ - /*--- Now fill array with the transform values only for local points ---*/ + unordered_map Global2Local; - for (iPoint = 0; iPoint < nPointDomain; iPoint++) + for (auto iPoint = 0ul; iPoint < nPoint; ++iPoint) Global2Local[geometry->nodes->GetGlobalIndex(iPoint)] = iPoint; /*--- Read all lines in the restart file ---*/ - long iPoint_Local; unsigned long iPoint_Global_Local = 0, iPoint_Global = 0; string text_line; /*--- The first line is the header ---*/ @@ -522,17 +480,20 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { /*--- Retrieve local index. If this node from the restart file lives on the current processor, we will load and instantiate the vars. ---*/ - MI = Global2Local.find(iPoint_Global); - if (MI != Global2Local.end()) { + auto it = Global2Local.find(iPoint_Global); - iPoint_Local = Global2Local[iPoint_Global]; + if (it != Global2Local.end()) { + + auto iPoint_Local = it->second; su2double Sol[MAXNVAR] = {0.0}; + unsigned long index; if (nDim == 2) point_line >> Sol[0] >> Sol[1] >> index; if (nDim == 3) point_line >> Sol[0] >> Sol[1] >> Sol[2] >> index; - for (iVar = 0; iVar < nVar; iVar++) nodes->SetPrestretch(iPoint_Local,iVar, Sol[iVar]); + for (unsigned short iVar = 0; iVar < nVar; iVar++) + nodes->SetPrestretch(iPoint_Local, iVar, Sol[iVar]); iPoint_Global_Local++; } @@ -541,99 +502,28 @@ void CFEASolver::Set_Prestretch(CGeometry *geometry, CConfig *config) { /*--- Detect a wrong solution file ---*/ - if (iPoint_Global_Local != nPointDomain) { + if (iPoint_Global_Local != nPoint) { SU2_MPI::Error(string("The solution file ") + filename + string(" doesn't match with the mesh file!\n") + string("It could be empty lines at the end of the file."), CURRENT_FUNCTION); } - /*--- Close the restart file ---*/ - - prestretch_file.close(); - -#ifdef HAVE_MPI - /*--- We need to communicate here the prestretched geometry for the halo nodes. ---*/ - /*--- We avoid creating a new function as this may be reformatted. ---*/ - - unsigned short iMarker, MarkerS, MarkerR; - unsigned long iVertex, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector; - su2double *Buffer_Receive_U = nullptr, *Buffer_Send_U = nullptr; - - int send_to, receive_from; - - for (iMarker = 0; iMarker < nMarker; iMarker++) { - - if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) && - (config->GetMarker_All_SendRecv(iMarker) > 0)) { - - MarkerS = iMarker; MarkerR = iMarker+1; - - send_to = config->GetMarker_All_SendRecv(MarkerS)-1; - receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1; - - nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR]; - nBufferS_Vector = nVertexS*nVar; nBufferR_Vector = nVertexR*nVar; - - /*--- Allocate Receive and send buffers ---*/ - Buffer_Receive_U = new su2double [nBufferR_Vector]; - Buffer_Send_U = new su2double[nBufferS_Vector]; - - /*--- Copy the solution that should be sent ---*/ - for (iVertex = 0; iVertex < nVertexS; iVertex++) { - iPoint = geometry->vertex[MarkerS][iVertex]->GetNode(); - for (iVar = 0; iVar < nVar; iVar++) - Buffer_Send_U[iVar*nVertexS+iVertex] = nodes->GetPrestretch(iPoint,iVar); - } - - /*--- Send/Receive information using Sendrecv ---*/ - SU2_MPI::Sendrecv(Buffer_Send_U, nBufferS_Vector, MPI_DOUBLE, send_to, 0, - Buffer_Receive_U, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, nullptr); - - /*--- Deallocate send buffer ---*/ - delete [] Buffer_Send_U; - - /*--- Do the coordinate transformation ---*/ - for (iVertex = 0; iVertex < nVertexR; iVertex++) { - - /*--- Find point and its type of transformation ---*/ - iPoint = geometry->vertex[MarkerR][iVertex]->GetNode(); - - /*--- Store received values back into the variable. ---*/ - for (iVar = 0; iVar < nVar; iVar++) - nodes->SetPrestretch(iPoint, iVar, Buffer_Receive_U[iVar*nVertexR+iVertex]); - - } - - /*--- Deallocate receive buffer ---*/ - delete [] Buffer_Receive_U; - - } - - } -#endif - } void CFEASolver::Set_ReferenceGeometry(CGeometry *geometry, CConfig *config) { - unsigned long iPoint; - - unsigned short iVar; - unsigned short iZone = config->GetiZone(); - unsigned short file_format = config->GetRefGeom_FileFormat(); - - string filename; - ifstream reference_file; - + const auto iZone = config->GetiZone(); + const auto file_format = config->GetRefGeom_FileFormat(); /*--- Restart the solution from file information ---*/ - filename = config->GetRefGeom_FEMFileName(); + auto filename = config->GetRefGeom_FEMFileName(); /*--- If multizone, append zone name ---*/ filename = config->GetMultizone_FileName(filename, iZone, ".csv"); - reference_file.open(filename.data(), ios::in); + ifstream reference_file; + reference_file.open(filename); /*--- In case there is no file ---*/ @@ -643,24 +533,8 @@ void CFEASolver::Set_ReferenceGeometry(CGeometry *geometry, CConfig *config) { if (rank == MASTER_NODE) cout << "Filename: " << filename << " and format " << file_format << "." << endl; - /*--- In case this is a parallel simulation, we need to perform the - Global2Local index transformation first. ---*/ - - long *Global2Local = new long[geometry->GetGlobal_nPointDomain()]; - - /*--- First, set all indices to a negative value by default ---*/ - - for (iPoint = 0; iPoint < geometry->GetGlobal_nPointDomain(); iPoint++) - Global2Local[iPoint] = -1; - - /*--- Now fill array with the transform values only for local points ---*/ - - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - Global2Local[geometry->nodes->GetGlobalIndex(iPoint)] = iPoint; - /*--- Read all lines in the restart file ---*/ - long iPoint_Local; unsigned long iPoint_Global_Local = 0, iPoint_Global = 0; string text_line; /*--- The first line is the header ---*/ @@ -676,7 +550,7 @@ void CFEASolver::Set_ReferenceGeometry(CGeometry *geometry, CConfig *config) { Otherwise, the local index for this node on the current processor will be returned and used to instantiate the vars. ---*/ - iPoint_Local = Global2Local[iPoint_Global]; + auto iPoint_Local = geometry->GetGlobal_to_Local_Point(iPoint_Global); if (iPoint_Local >= 0) { @@ -691,7 +565,7 @@ void CFEASolver::Set_ReferenceGeometry(CGeometry *geometry, CConfig *config) { Sol[2] = PrintingToolbox::stod(point_line[6]); } - for (iVar = 0; iVar < nVar; iVar++) + for (unsigned short iVar = 0; iVar < nVar; iVar++) nodes->SetReference_Geometry(iPoint_Local, iVar, Sol[iVar]); iPoint_Global_Local++; @@ -706,14 +580,6 @@ void CFEASolver::Set_ReferenceGeometry(CGeometry *geometry, CConfig *config) { string("It could be empty lines at the end of the file."), CURRENT_FUNCTION); } - /*--- Close the restart file ---*/ - - reference_file.close(); - - /*--- Free memory needed for the transformation ---*/ - - delete [] Global2Local; - } void CFEASolver::Set_VertexEliminationSchedule(CGeometry *geometry, const vector& markers) { @@ -732,7 +598,7 @@ void CFEASolver::Set_VertexEliminationSchedule(CGeometry *geometry, const vector vector numPoints(size); unsigned long num = myPoints.size(); - SU2_MPI::Allgather(&num, 1, MPI_UNSIGNED_LONG, numPoints.data(), 1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + SU2_MPI::Allgather(&num, 1, MPI_UNSIGNED_LONG, numPoints.data(), 1, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); /*--- Global to local map for the halo points of the rank (not covered by the CGeometry map). ---*/ unordered_map Global2Local; @@ -746,13 +612,13 @@ void CFEASolver::Set_VertexEliminationSchedule(CGeometry *geometry, const vector for (int i = 0; i < size; ++i) { /*--- Send our point list. ---*/ if (rank == i) { - SU2_MPI::Bcast(myPoints.data(), numPoints[i], MPI_UNSIGNED_LONG, rank, MPI_COMM_WORLD); + SU2_MPI::Bcast(myPoints.data(), numPoints[i], MPI_UNSIGNED_LONG, rank, SU2_MPI::GetComm()); continue; } /*--- Receive point list. ---*/ vector theirPoints(numPoints[i]); - SU2_MPI::Bcast(theirPoints.data(), numPoints[i], MPI_UNSIGNED_LONG, i, MPI_COMM_WORLD); + SU2_MPI::Bcast(theirPoints.data(), numPoints[i], MPI_UNSIGNED_LONG, i, SU2_MPI::GetComm()); for (auto iPointGlobal : theirPoints) { /*--- Check if the rank has the point. ---*/ @@ -1070,7 +936,7 @@ void CFEASolver::Compute_StiffMatrix_NodalStressRes(CGeometry *geometry, CNumeri } -void CFEASolver::Compute_MassMatrix(CGeometry *geometry, CNumerics **numerics, const CConfig *config) { +void CFEASolver::Compute_MassMatrix(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { const bool topology_mode = config->GetTopology_Optimization(); const su2double simp_minstiff = config->GetSIMP_MinStiffness(); @@ -1155,7 +1021,7 @@ void CFEASolver::Compute_MassMatrix(CGeometry *geometry, CNumerics **numerics, c } -void CFEASolver::Compute_MassRes(CGeometry *geometry, CNumerics **numerics, const CConfig *config) { +void CFEASolver::Compute_MassRes(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { const bool topology_mode = config->GetTopology_Optimization(); const su2double simp_minstiff = config->GetSIMP_MinStiffness(); @@ -1323,22 +1189,28 @@ void CFEASolver::Compute_NodalStressRes(CGeometry *geometry, CNumerics **numeric void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, const CConfig *config) { - /*--- Never record this method as atm it is not differentiable. ---*/ - const bool wasActive = AD::BeginPassive(); - const bool prestretch_fem = config->GetPrestretch(); const bool topology_mode = config->GetTopology_Optimization(); const su2double simp_exponent = config->GetSIMP_Exponent(); + const su2double simp_minstiff = config->GetSIMP_MinStiffness(); + + const auto stressParam = config->GetStressPenaltyParam(); + const su2double stress_scale = 1.0 / stressParam[0]; + const su2double ks_mult = stressParam[1]; const unsigned short nStress = (nDim == 2) ? 3 : 6; + su2double StressPenalty = 0.0; su2double MaxVonMises_Stress = 0.0; /*--- Start OpenMP parallel region. ---*/ SU2_OMP_PARALLEL { + /*--- Some parts are not recorded, atm only StressPenalty is differentiated to save memory. ---*/ + bool wasActive = AD::BeginPassive(); + /*--- Clear reactions. ---*/ LinSysReact.SetValZero(); @@ -1349,9 +1221,12 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, nodes->SetStress_FEM(iPoint,iStress, 0.0); } } + AD::EndPassive(wasActive); for(auto color : ElemColoring) { + su2double stressPen = 0.0; + /*--- Chunk size is at least OMP_MIN_SIZE and a multiple of the color group size. ---*/ SU2_OMP_FOR_DYN(nextMultiple(OMP_MIN_SIZE, color.groupSize)) for(auto k = 0ul; k < color.size; ++k) { @@ -1379,7 +1254,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, for (iDim = 0; iDim < nDim; iDim++) { /*--- Compute current coordinate. ---*/ - su2double val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim); + su2double val_Coord = geometry->nodes->GetCoord(indexNode[iNode],iDim); su2double val_Sol = nodes->GetSolution(indexNode[iNode],iDim) + val_Coord; /*--- If pre-stretched the reference coordinate is stored in the nodes. ---*/ @@ -1395,7 +1270,8 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, /*--- In topology mode determine the penalty to apply to the stiffness ---*/ su2double simp_penalty = 1.0; if (topology_mode) { - simp_penalty = pow(element_properties[iElem]->GetPhysicalDensity(), simp_exponent); + su2double density = element_properties[iElem]->GetPhysicalDensity(); + simp_penalty = simp_minstiff+(1.0-simp_minstiff)*pow(density,simp_exponent); } /*--- Set the properties of the element. ---*/ @@ -1404,7 +1280,11 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, /*--- Compute the averaged nodal stresses. ---*/ int NUM_TERM = thread*MAX_TERMS + element_properties[iElem]->GetMat_Mod(); - numerics[NUM_TERM]->Compute_Averaged_NodalStress(element, config); + auto elStress = numerics[NUM_TERM]->Compute_Averaged_NodalStress(element, config); + + stressPen += exp(ks_mult * elStress*simp_penalty*stress_scale); + + wasActive = AD::BeginPassive(); for (iNode = 0; iNode < nNodes; iNode++) { @@ -1425,10 +1305,14 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, if (LockStrategy) omp_unset_lock(&UpdateLocks[iPoint]); } + AD::EndPassive(wasActive); + } // end iElem loop + atomicAdd(stressPen, StressPenalty); } // end color loop + wasActive = AD::BeginPassive(); /*--- Compute the von Misses stress at each point, and the maximum for the domain. ---*/ su2double maxVonMises = 0.0; @@ -1436,51 +1320,25 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, SU2_OMP(for schedule(static,omp_chunk_size) nowait) for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { - /*--- Get the stresses, added up from all the elements that connect to the node. ---*/ - - auto Stress = nodes->GetStress_FEM(iPoint); - su2double VonMises_Stress; - - if (nDim == 2) { - - su2double Sxx = Stress[0], Syy = Stress[1], Sxy = Stress[2]; - - su2double S1, S2; S1 = S2 = (Sxx+Syy)/2; - su2double tauMax = sqrt(pow((Sxx-Syy)/2, 2) + pow(Sxy,2)); - S1 += tauMax; - S2 -= tauMax; - - VonMises_Stress = sqrt(S1*S1+S2*S2-2*S1*S2); - } - else { - - su2double Sxx = Stress[0], Syy = Stress[1], Szz = Stress[3]; - su2double Sxy = Stress[2], Sxz = Stress[4], Syz = Stress[5]; - - VonMises_Stress = sqrt(0.5*(pow(Sxx - Syy, 2) + - pow(Syy - Szz, 2) + - pow(Szz - Sxx, 2) + - 6.0*(Sxy*Sxy+Sxz*Sxz+Syz*Syz))); - } - - nodes->SetVonMises_Stress(iPoint,VonMises_Stress); + const auto vms = CFEAElasticity::VonMisesStress(nDim, nodes->GetStress_FEM(iPoint)); - /*--- Update the maximum value of the Von Mises Stress ---*/ + nodes->SetVonMises_Stress(iPoint, vms); - maxVonMises = max(maxVonMises, VonMises_Stress); + maxVonMises = max(maxVonMises, vms); } SU2_OMP_CRITICAL MaxVonMises_Stress = max(MaxVonMises_Stress, maxVonMises); - } // end SU2_OMP_PARALLEL + AD::EndPassive(wasActive); - su2double tmp = MaxVonMises_Stress; - SU2_MPI::Allreduce(&tmp, &MaxVonMises_Stress, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + } // end SU2_OMP_PARALLEL /*--- Set the value of the MaxVonMises_Stress as the CFEA coeffient ---*/ + SU2_MPI::Allreduce(&MaxVonMises_Stress, &Total_CFEA, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); - Total_CFEA = MaxVonMises_Stress; - + /*--- Reduce the stress penalty over all ranks ---*/ + SU2_MPI::Allreduce(&StressPenalty, &Total_OFStressPenalty, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + Total_OFStressPenalty = log(Total_OFStressPenalty)/ks_mult - 1.0; bool outputReactions = false; @@ -1603,8 +1461,6 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics, } - AD::EndPassive(wasActive); - } void CFEASolver::Compute_DeadLoad(CGeometry *geometry, CNumerics **numerics, const CConfig *config) { @@ -1758,7 +1614,7 @@ void CFEASolver::BC_Clamped(CGeometry *geometry, CNumerics *numerics, const CCon nodes->SetBound_Disp(iPoint, zeros); LinSysSol.SetBlock(iPoint, zeros); - LinSysReact.SetBlock(iPoint, zeros); + if (LinSysReact.GetLocSize() > 0) LinSysReact.SetBlock(iPoint, zeros); Jacobian.EnforceSolutionAtNode(iPoint, zeros, LinSysRes); } @@ -1838,9 +1694,7 @@ void CFEASolver::BC_Sym_Plane(CGeometry *geometry, CNumerics *numerics, const CC /*--- Set and enforce 0 solution for mesh deformation ---*/ nodes->SetBound_Disp(iPoint, axis, 0.0); LinSysSol(iPoint, axis) = 0.0; - if (LinSysReact.GetLocSize() > 0){ - LinSysReact(iPoint, axis) = 0.0; - } + if (LinSysReact.GetLocSize() > 0) LinSysReact(iPoint, axis) = 0.0; Jacobian.EnforceSolutionAtDOF(iPoint, axis, su2double(0.0), LinSysRes); } @@ -1928,6 +1782,9 @@ void CFEASolver::Postprocessing(CGeometry *geometry, CConfig *config, CNumerics case VOLUME_FRACTION: Compute_OFVolFrac(geometry, config); break; case TOPOL_DISCRETENESS: Compute_OFVolFrac(geometry, config); break; case TOPOL_COMPLIANCE: Compute_OFCompliance(geometry, config); break; + case STRESS_PENALTY: + Compute_NodalStress(geometry, numerics, config); + break; } return; } @@ -2324,7 +2181,7 @@ su2double CFEASolver::Compute_LoadCoefficient(su2double CurrentTime, su2double R } -void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CNumerics **numerics, const CConfig *config) { +void CFEASolver::ImplicitNewmark_Iteration(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { const bool first_iter = (config->GetInnerIter() == 0); const bool dynamic = (config->GetTime_Domain()); @@ -2408,7 +2265,7 @@ void CFEASolver::ImplicitNewmark_Iteration(CGeometry *geometry, CNumerics **nume } -void CFEASolver::ImplicitNewmark_Update(CGeometry *geometry, CConfig *config) { +void CFEASolver::ImplicitNewmark_Update(const CGeometry *geometry, const CConfig *config) { const bool dynamic = (config->GetTime_Domain()); @@ -2420,7 +2277,7 @@ void CFEASolver::ImplicitNewmark_Update(CGeometry *geometry, CConfig *config) { /*--- Update solution. ---*/ SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (iPoint = 0; iPoint < nPoint; iPoint++) { /*--- Displacement component of the solution. ---*/ for (iVar = 0; iVar < nVar; iVar++) nodes->Add_DeltaSolution(iPoint, iVar, LinSysSol(iPoint,iVar)); @@ -2428,7 +2285,7 @@ void CFEASolver::ImplicitNewmark_Update(CGeometry *geometry, CConfig *config) { if (dynamic) { SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { /*--- Acceleration component of the solution. ---*/ @@ -2452,16 +2309,10 @@ void CFEASolver::ImplicitNewmark_Update(CGeometry *geometry, CConfig *config) { } } } - - /*--- Perform the MPI communication of the solution ---*/ - - InitiateComms(geometry, config, SOLUTION_FEA); - CompleteComms(geometry, config, SOLUTION_FEA); - } // end SU2_OMP_PARALLEL } -void CFEASolver::ImplicitNewmark_Relaxation(CGeometry *geometry, CConfig *config) { +void CFEASolver::ImplicitNewmark_Relaxation(const CGeometry *geometry, const CConfig *config) { const bool dynamic = (config->GetTime_Domain()); @@ -2472,13 +2323,14 @@ void CFEASolver::ImplicitNewmark_Relaxation(CGeometry *geometry, CConfig *config /*--- Update solution and set it to be the solution after applying relaxation. ---*/ SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint=0; iPoint < nPointDomain; iPoint++) { + for (iPoint=0; iPoint < nPoint; iPoint++) { nodes->SetSolution(iPoint, nodes->GetSolution_Pred(iPoint)); + nodes->SetSolution_Pred_Old(iPoint, nodes->GetSolution(iPoint)); } if (dynamic) { SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (iPoint = 0; iPoint < nPoint; iPoint++) { for (iVar = 0; iVar < nVar; iVar++) { /*--- Acceleration component of the solution ---*/ @@ -2503,26 +2355,12 @@ void CFEASolver::ImplicitNewmark_Relaxation(CGeometry *geometry, CConfig *config } } - /*--- Perform the MPI communication of the solution ---*/ - - InitiateComms(geometry, config, SOLUTION_FEA); - CompleteComms(geometry, config, SOLUTION_FEA); - - /*--- After the solution has been communicated, set the 'old' predicted solution as the solution. ---*/ - /*--- Loop over n points (as we have already communicated everything. ---*/ - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPoint; iPoint++) { - for (iVar = 0; iVar < nVar; iVar++) { - nodes->SetSolution_Pred_Old(iPoint,iVar,nodes->GetSolution(iPoint,iVar)); - } - } - } // end SU2_OMP_PARALLEL } -void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CNumerics **numerics, const CConfig *config) { +void CFEASolver::GeneralizedAlpha_Iteration(const CGeometry *geometry, CNumerics **numerics, const CConfig *config) { const bool first_iter = (config->GetInnerIter() == 0); const bool dynamic = (config->GetTime_Domain()); @@ -2630,23 +2468,18 @@ void CFEASolver::GeneralizedAlpha_Iteration(CGeometry *geometry, CNumerics **num } -void CFEASolver::GeneralizedAlpha_UpdateDisp(CGeometry *geometry, CConfig *config) { +void CFEASolver::GeneralizedAlpha_UpdateDisp(const CGeometry *geometry, const CConfig *config) { /*--- Update displacement components of the solution. ---*/ SU2_OMP_PARALLEL_(for schedule(static,omp_chunk_size)) - for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) for (unsigned short iVar = 0; iVar < nVar; iVar++) nodes->Add_DeltaSolution(iPoint, iVar, LinSysSol(iPoint,iVar)); - /*--- Perform the MPI communication of the solution, displacements only. ---*/ - - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); - } -void CFEASolver::GeneralizedAlpha_UpdateSolution(CGeometry *geometry, CConfig *config) { +void CFEASolver::GeneralizedAlpha_UpdateSolution(const CGeometry *geometry, const CConfig *config) { const su2double alpha_f = config->Get_Int_Coeffs(2); const su2double alpha_m = config->Get_Int_Coeffs(3); @@ -2654,7 +2487,7 @@ void CFEASolver::GeneralizedAlpha_UpdateSolution(CGeometry *geometry, CConfig *c /*--- Compute solution at t_n+1, and update velocities and accelerations ---*/ SU2_OMP_PARALLEL_(for schedule(static,omp_chunk_size)) - for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) { unsigned short iVar; @@ -2698,14 +2531,9 @@ void CFEASolver::GeneralizedAlpha_UpdateSolution(CGeometry *geometry, CConfig *c } - /*--- Perform the MPI communication of the solution ---*/ - - InitiateComms(geometry, config, SOLUTION_FEA); - CompleteComms(geometry, config, SOLUTION_FEA); - } -void CFEASolver::GeneralizedAlpha_UpdateLoads(CGeometry *geometry, const CConfig *config) { +void CFEASolver::GeneralizedAlpha_UpdateLoads(const CGeometry *geometry, const CConfig *config) { /*--- Set the load conditions of the time step n+1 as the load conditions for time step n ---*/ nodes->Set_SurfaceLoad_Res_n(); @@ -2716,8 +2544,8 @@ void CFEASolver::GeneralizedAlpha_UpdateLoads(CGeometry *geometry, const CConfig void CFEASolver::Solve_System(CGeometry *geometry, CConfig *config) { /*--- Enforce solution at some halo points possibly not covered by essential BC markers. ---*/ - Jacobian.InitiateComms(LinSysSol, geometry, config, SOLUTION_MATRIX); - Jacobian.CompleteComms(LinSysSol, geometry, config, SOLUTION_MATRIX); + CSysMatrixComms::Initiate(LinSysSol, geometry, config); + CSysMatrixComms::Complete(LinSysSol, geometry, config); for (auto iPoint : ExtraVerticesToEliminate) { Jacobian.EnforceSolutionAtNode(iPoint, LinSysSol.GetBlock(iPoint), LinSysRes); @@ -2752,9 +2580,9 @@ void CFEASolver::PredictStruct_Displacement(CGeometry *geometry, CConfig *config if(predOrder > 2 && rank == MASTER_NODE) cout << "Higher order predictor not implemented. Solving with order 0." << endl; - /*--- To nPointDomain: we need to communicate the predicted solution after setting it. ---*/ + /*--- To nPoint to avoid communication. ---*/ SU2_OMP_PARALLEL_(for schedule(static,omp_chunk_size)) - for (unsigned long iPoint=0; iPoint < nPointDomain; iPoint++) { + for (unsigned long iPoint=0; iPoint < nPoint; iPoint++) { unsigned short iDim; @@ -2762,34 +2590,33 @@ void CFEASolver::PredictStruct_Displacement(CGeometry *geometry, CConfig *config case 1: { const su2double* solDisp = nodes->GetSolution(iPoint); const su2double* solVel = nodes->GetSolution_Vel(iPoint); - su2double* valPred = nodes->GetSolution_Pred(iPoint); + su2double valPred[MAXNVAR] = {0.0}; - for (iDim=0; iDim < nDim; iDim++) { + for (iDim=0; iDim < nDim; iDim++) valPred[iDim] = solDisp[iDim] + Delta_t*solVel[iDim]; - } + + nodes->SetSolution_Pred(iPoint, valPred); } break; case 2: { const su2double* solDisp = nodes->GetSolution(iPoint); const su2double* solVel = nodes->GetSolution_Vel(iPoint); const su2double* solVel_tn = nodes->GetSolution_Vel_time_n(iPoint); - su2double* valPred = nodes->GetSolution_Pred(iPoint); + su2double valPred[MAXNVAR] = {0.0}; - for (iDim=0; iDim < nDim; iDim++) { + for (iDim=0; iDim < nDim; iDim++) valPred[iDim] = solDisp[iDim] + 0.5*Delta_t*(3*solVel[iDim]-solVel_tn[iDim]); - } + + nodes->SetSolution_Pred(iPoint, valPred); } break; default: { - nodes->SetSolution_Pred(iPoint); + nodes->SetSolution_Pred(iPoint, nodes->GetSolution(iPoint)); } break; } } - InitiateComms(geometry, config, SOLUTION_PRED); - CompleteComms(geometry, config, SOLUTION_PRED); - } void CFEASolver::ComputeAitken_Coefficient(CGeometry *geometry, CConfig *config, unsigned long iOuterIter) { @@ -2835,7 +2662,6 @@ void CFEASolver::ComputeAitken_Coefficient(CGeometry *geometry, CConfig *config, } else { - // To nPointDomain; we need to communicate the values for (iPoint = 0; iPoint < nPointDomain; iPoint++) { dispPred = nodes->GetSolution_Pred(iPoint); @@ -2860,8 +2686,8 @@ void CFEASolver::ComputeAitken_Coefficient(CGeometry *geometry, CConfig *config, } - SU2_MPI::Allreduce(&sbuf_numAitk, &rbuf_numAitk, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&sbuf_denAitk, &rbuf_denAitk, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_numAitk, &rbuf_numAitk, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&sbuf_denAitk, &rbuf_denAitk, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); WAitkDyn = GetWAitken_Dyn(); @@ -2887,28 +2713,27 @@ void CFEASolver::SetAitken_Relaxation(CGeometry *geometry, CConfig *config) { const su2double WAitken = GetWAitken_Dyn(); - // To nPointDomain; we need to communicate the solutions (predicted, old and old predicted) after this routine + /*--- To nPoint to avoid communication. ---*/ SU2_OMP_PARALLEL_(for schedule(static,omp_chunk_size)) - for (unsigned long iPoint=0; iPoint < nPointDomain; iPoint++) { + for (unsigned long iPoint=0; iPoint < nPoint; iPoint++) { /*--- Retrieve pointers to the predicted and calculated solutions ---*/ - su2double* dispPred = nodes->GetSolution_Pred(iPoint); + const su2double* dispPred = nodes->GetSolution_Pred(iPoint); const su2double* dispCalc = nodes->GetSolution(iPoint); /*--- Set predicted solution as the old predicted solution ---*/ - nodes->SetSolution_Pred_Old(iPoint); + nodes->SetSolution_Pred_Old(iPoint, dispPred); /*--- Set calculated solution as the old solution (needed for dynamic Aitken relaxation) ---*/ nodes->SetSolution_Old(iPoint, dispCalc); /*--- Apply the Aitken relaxation ---*/ - for (unsigned short iDim=0; iDim < nDim; iDim++) { - dispPred[iDim] = (1.0 - WAitken)*dispPred[iDim] + WAitken*dispCalc[iDim]; - } - } + su2double newDispPred[MAXNVAR] = {0.0}; + for (unsigned short iDim=0; iDim < nDim; iDim++) + newDispPred[iDim] = (1.0 - WAitken)*dispPred[iDim] + WAitken*dispCalc[iDim]; - InitiateComms(geometry, config, SOLUTION_PRED_OLD); - CompleteComms(geometry, config, SOLUTION_PRED_OLD); + nodes->SetSolution_Pred(iPoint, newDispPred); + } } @@ -2988,33 +2813,47 @@ void CFEASolver::Compute_OFRefGeom(CGeometry *geometry, const CConfig *config){ unsigned long TimeIter = config->GetTimeIter(); su2double objective_function = 0.0; + unsigned long nSurfPoints = 0; SU2_OMP_PARALLEL { su2double obj_fun_local = 0.0; + unsigned long nSurf_local = 0; - SU2_OMP_FOR_STAT(omp_chunk_size) - for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { - - for (unsigned short iVar = 0; iVar < nVar; iVar++) { - - /*--- Retrieve the value of the reference geometry ---*/ - su2double reference_geometry = nodes->GetReference_Geometry(iPoint,iVar); + if (!config->GetRefGeomSurf()) { + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { + obj_fun_local += SquaredDistance(nVar, nodes->GetReference_Geometry(iPoint), nodes->GetSolution(iPoint)); + } + } + else { + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) == LOAD_BOUNDARY) || + (config->GetMarker_All_KindBC(iMarker) == LOAD_DIR_BOUNDARY) || + (config->GetMarker_All_KindBC(iMarker) == FLOWLOAD_BOUNDARY)) { + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) + for (unsigned long iVertex = 0; iVertex < geometry->GetnVertex(iMarker); ++iVertex) { + auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - /*--- Retrieve the value of the current solution ---*/ - su2double current_solution = nodes->GetSolution(iPoint,iVar); + nSurf_local += geometry->nodes->GetDomain(iPoint); - /*--- The objective function is the sum of the difference between solution and difference, squared ---*/ - obj_fun_local += pow(current_solution - reference_geometry, 2); + if (geometry->nodes->GetDomain(iPoint)) + obj_fun_local += SquaredDistance(nVar, nodes->GetReference_Geometry(iPoint), nodes->GetSolution(iPoint)); + } + } } } atomicAdd(obj_fun_local, objective_function); + atomicAdd(nSurf_local, nSurfPoints); } + SU2_MPI::Allreduce(&objective_function, &Total_OFRefGeom, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); - SU2_MPI::Allreduce(&objective_function, &Total_OFRefGeom, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - Total_OFRefGeom *= config->GetRefGeom_Penalty() / geometry->GetGlobal_nPointDomain(); + unsigned long nPointsOF = geometry->GetGlobal_nPointDomain(); + if (config->GetRefGeomSurf()) { + SU2_MPI::Allreduce(&nSurfPoints, &nPointsOF, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + } + Total_OFRefGeom *= config->GetRefGeom_Penalty() / nPointsOF; Total_OFRefGeom += PenaltyValue; - Global_OFRefGeom += Total_OFRefGeom; /// TODO: Temporary output files for the direct mode. @@ -3054,7 +2893,7 @@ void CFEASolver::Compute_OFRefNode(CGeometry *geometry, const CConfig *config){ } } - SU2_MPI::Allreduce(dist, dist_reduce, MAXNVAR, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(dist, dist_reduce, MAXNVAR, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); Total_OFRefNode = config->GetRefNode_Penalty() * Norm(int(MAXNVAR),dist_reduce) + PenaltyValue; @@ -3107,11 +2946,11 @@ void CFEASolver::Compute_OFVolFrac(CGeometry *geometry, const CConfig *config) } su2double tmp; - SU2_MPI::Allreduce(&total_volume,&tmp,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + SU2_MPI::Allreduce(&total_volume,&tmp,1,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm()); total_volume = tmp; - SU2_MPI::Allreduce(&integral,&tmp,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + SU2_MPI::Allreduce(&integral,&tmp,1,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm()); integral = tmp; - SU2_MPI::Allreduce(&discreteness,&tmp,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + SU2_MPI::Allreduce(&discreteness,&tmp,1,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm()); discreteness = tmp; Total_OFDiscreteness = discreteness/total_volume; @@ -3167,7 +3006,7 @@ void CFEASolver::Compute_OFCompliance(CGeometry *geometry, const CConfig *config atomicAdd(comp_local, compliance); } - SU2_MPI::Allreduce(&compliance, &Total_OFCompliance, 1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + SU2_MPI::Allreduce(&compliance, &Total_OFCompliance, 1,MPI_DOUBLE,MPI_SUM,SU2_MPI::GetComm()); } @@ -3240,8 +3079,8 @@ void CFEASolver::Stiffness_Penalty(CGeometry *geometry, CNumerics **numerics, CC // Reduce value across processors for parallelization - SU2_MPI::Allreduce(&weightedValue, &weightedValue_reduce, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&totalVolume, &totalVolume_reduce, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&weightedValue, &weightedValue_reduce, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&totalVolume, &totalVolume_reduce, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); su2double ratio = 1.0 - weightedValue_reduce/totalVolume_reduce; @@ -3291,15 +3130,8 @@ void CFEASolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *c for (unsigned short iVar = 0; iVar < nVar; iVar++) { nodes->SetSolution(iPoint_Local, iVar, Sol[iVar]); if (dynamic) { - nodes->Set_Solution_time_n(iPoint_Local, iVar, Sol[iVar]); nodes->SetSolution_Vel(iPoint_Local, iVar, Sol[iVar+nVar]); - nodes->SetSolution_Vel_time_n(iPoint_Local, iVar, Sol[iVar+nVar]); nodes->SetSolution_Accel(iPoint_Local, iVar, Sol[iVar+2*nVar]); - nodes->SetSolution_Accel_time_n(iPoint_Local, iVar, Sol[iVar+2*nVar]); - } - if (fluid_structure && !dynamic) { - nodes->SetSolution_Pred(iPoint_Local, iVar, Sol[iVar]); - nodes->SetSolution_Pred_Old(iPoint_Local, iVar, Sol[iVar]); } if (fluid_structure && discrete_adjoint){ nodes->SetSolution_Old(iPoint_Local, iVar, Sol[iVar]); @@ -3321,19 +3153,25 @@ void CFEASolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *c /*--- MPI. If dynamic, we also need to communicate the old solution. ---*/ - solver[MESH_0][FEA_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION_FEA); - solver[MESH_0][FEA_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION_FEA); + InitiateComms(geometry[MESH_0], config, SOLUTION_FEA); + CompleteComms(geometry[MESH_0], config, SOLUTION_FEA); if (dynamic) { - solver[MESH_0][FEA_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION_FEA_OLD); - solver[MESH_0][FEA_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION_FEA_OLD); + nodes->Set_Solution_time_n(); + nodes->SetSolution_Vel_time_n(); + nodes->SetSolution_Accel_time_n(); } + if (fluid_structure && !dynamic) { - solver[MESH_0][FEA_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION_PRED); - solver[MESH_0][FEA_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION_PRED); + for (auto iPoint = 0ul; iPoint < nPoint; ++iPoint) { + nodes->SetSolution_Pred(iPoint, nodes->GetSolution(iPoint)); + nodes->SetSolution_Pred_Old(iPoint, nodes->GetSolution(iPoint)); + } + } - solver[MESH_0][FEA_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION_PRED_OLD); - solver[MESH_0][FEA_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION_PRED_OLD); + if (fluid_structure && discrete_adjoint) { + for (auto iPoint = 0ul; iPoint < nPoint; ++iPoint) + nodes->SetSolution_Old(iPoint, nodes->GetSolution(iPoint)); } /*--- Delete the class memory that is used to load the restart. ---*/ @@ -3379,7 +3217,7 @@ void CFEASolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *config) #ifdef HAVE_MPI if (rank == MASTER_NODE) rec_buf = new float[nElemDomain]; /*--- Need to use this version of Reduce instead of the wrapped one because we use float ---*/ - MPI_Reduce(send_buf,rec_buf,nElemDomain,MPI_FLOAT,MPI_SUM,MASTER_NODE,MPI_COMM_WORLD); + MPI_Reduce(send_buf,rec_buf,nElemDomain,MPI_FLOAT,MPI_SUM,MASTER_NODE,SU2_MPI::GetComm()); #else rec_buf = send_buf; #endif @@ -3388,9 +3226,8 @@ void CFEASolver::ExtractAdjoint_Variables(CGeometry *geometry, CConfig *config) if (rank == MASTER_NODE) { string filename = config->GetTopology_Optim_FileName(); ofstream file; - file.open(filename.c_str()); + file.open(filename); for(iElem=0; iElem recvBuf(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank, MPI_COMM_WORLD, &status); + source, rank, SU2_MPI::GetComm(), &status); map::const_iterator MI = rankToIndRecvBuf.find(source); source = MI->second; @@ -1415,7 +1415,7 @@ void CFEM_DG_EulerSolver::DetermineGraphDOFs(const CMeshFEM *FEMGeometry, /* Wild cards have been used in the communication, so synchronize the ranks to avoid problems. */ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #else @@ -1523,7 +1523,7 @@ void CFEM_DG_EulerSolver::DetermineGraphDOFs(const CMeshFEM *FEMGeometry, /* Send the data using non-blocking sends to avoid deadlock. */ int dest = ranksRecv[i]; SU2_MPI::Isend(invSendBuf[i].data(), invSendBuf[i].size(), MPI_UNSIGNED_LONG, - dest, dest+1, MPI_COMM_WORLD, &invSendReqs[i]); + dest, dest+1, SU2_MPI::GetComm(), &invSendReqs[i]); } /* Create a map of the inverse receive (i.e. the original send) rank @@ -1539,7 +1539,7 @@ void CFEM_DG_EulerSolver::DetermineGraphDOFs(const CMeshFEM *FEMGeometry, /* Block until a message arrives and determine the source and size of the message. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank+1, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank+1, SU2_MPI::GetComm(), &status); int source = status.MPI_SOURCE; int sizeMess; @@ -1549,7 +1549,7 @@ void CFEM_DG_EulerSolver::DetermineGraphDOFs(const CMeshFEM *FEMGeometry, and determine the actual index of this rank in ranksSend. */ vector recvBuf(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank+1, MPI_COMM_WORLD, &status); + source, rank+1, SU2_MPI::GetComm(), &status); map::const_iterator MI = rankToIndSendBuf.find(source); source = MI->second; @@ -1576,7 +1576,7 @@ void CFEM_DG_EulerSolver::DetermineGraphDOFs(const CMeshFEM *FEMGeometry, /* Wild cards have been used in the communication, so synchronize the ranks to avoid problems. */ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #else /*--- Sequential implementation. Just add the data of the halo DOFs @@ -1718,7 +1718,7 @@ void CFEM_DG_EulerSolver::MetaDataJacobianComputation(const CMeshFEM *FEMGeom const int ind = MI->second; SU2_MPI::Isend(sendBuf[ind].data(), sendBuf[ind].size(), MPI_UNSIGNED_LONG, - dest, dest+2, MPI_COMM_WORLD, &sendReqs[i]); + dest, dest+2, SU2_MPI::GetComm(), &sendReqs[i]); } /* Loop over the ranks from which I receive data to be processed. The number @@ -1730,7 +1730,7 @@ void CFEM_DG_EulerSolver::MetaDataJacobianComputation(const CMeshFEM *FEMGeom /* Block until a message arrives and determine the source and size of the message. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank+2, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank+2, SU2_MPI::GetComm(), &status); int source = status.MPI_SOURCE; int sizeMess; @@ -1742,15 +1742,14 @@ void CFEM_DG_EulerSolver::MetaDataJacobianComputation(const CMeshFEM *FEMGeom sendReturnBuf[i].resize(sizeMess); SU2_MPI::Recv(recvBuf.data(), sizeMess, MPI_UNSIGNED_LONG, - source, rank+2, MPI_COMM_WORLD, &status); + source, rank+2, SU2_MPI::GetComm(), &status); /* Loop over the data just received and fill the return send buffer with the color of the DOFs. */ for(int j=0; j= nDOFsLocOwned) { - cout << "This DOF should be owned, but it is not. This should not happen." << endl; - exit(1); + SU2_MPI::Error("This DOF should be owned, but it is not. This should not happen.",CURRENT_FUNCTION); } sendReturnBuf[i][j] = colorLocalDOFs[jj]; } @@ -1758,7 +1757,7 @@ void CFEM_DG_EulerSolver::MetaDataJacobianComputation(const CMeshFEM *FEMGeom /* Send the return buffer back to the calling rank. Again use non-blocking sends to avoid deadlock. */ SU2_MPI::Isend(sendReturnBuf[i].data(), sendReturnBuf[i].size(), MPI_INT, - source, source+3, MPI_COMM_WORLD, &sendReturnReqs[i]); + source, source+3, SU2_MPI::GetComm(), &sendReturnReqs[i]); } /* Complete the first round of non-blocking sends. */ @@ -1770,7 +1769,7 @@ void CFEM_DG_EulerSolver::MetaDataJacobianComputation(const CMeshFEM *FEMGeom /* Block until a message arrives and determine the source of the message and its index in the original send buffers. */ SU2_MPI::Status status; - SU2_MPI::Probe(MPI_ANY_SOURCE, rank+3, MPI_COMM_WORLD, &status); + SU2_MPI::Probe(MPI_ANY_SOURCE, rank+3, SU2_MPI::GetComm(), &status); int source = status.MPI_SOURCE; MI = rankCommToInd.find(source); @@ -1780,7 +1779,7 @@ void CFEM_DG_EulerSolver::MetaDataJacobianComputation(const CMeshFEM *FEMGeom a blocking receive. */ vector recvBuf(sendBuf[ind].size()); SU2_MPI::Recv(recvBuf.data(), recvBuf.size(), MPI_INT, - source, rank+3, MPI_COMM_WORLD, &status); + source, rank+3, SU2_MPI::GetComm(), &status); /* Loop over the data just received and add them to the map mapMatrixIndToColor .*/ @@ -1793,7 +1792,7 @@ void CFEM_DG_EulerSolver::MetaDataJacobianComputation(const CMeshFEM *FEMGeom /* Wild cards have been used in the communication, so synchronize the ranks to avoid problems. */ - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif @@ -2433,7 +2432,7 @@ void CFEM_DG_EulerSolver::SetUpTaskList(CConfig *config) { } #ifdef HAVE_MPI - SU2_MPI::Barrier(MPI_COMM_WORLD); + SU2_MPI::Barrier(SU2_MPI::GetComm()); #endif } @@ -2750,7 +2749,7 @@ void CFEM_DG_EulerSolver::Initiate_MPI_Communication(CConfig *config, /* Send the data using non-blocking sends. */ int dest = ranksSendMPI[timeLevel][i]; int tag = dest + timeLevel; - SU2_MPI::Isend(sendBuf, ii, MPI_DOUBLE, dest, tag, MPI_COMM_WORLD, + SU2_MPI::Isend(sendBuf, ii, MPI_DOUBLE, dest, tag, SU2_MPI::GetComm(), &commRequests[timeLevel][indComm]); } @@ -2762,7 +2761,7 @@ void CFEM_DG_EulerSolver::Initiate_MPI_Communication(CConfig *config, int tag = rank + timeLevel; SU2_MPI::Irecv(commRecvBuf[timeLevel][i].data(), commRecvBuf[timeLevel][i].size(), - MPI_DOUBLE, source, tag, MPI_COMM_WORLD, + MPI_DOUBLE, source, tag, SU2_MPI::GetComm(), &commRequests[timeLevel][indComm]); } } @@ -2996,7 +2995,7 @@ void CFEM_DG_EulerSolver::Initiate_MPI_ReverseCommunication(CConfig *config, /* Send the data using non-blocking sends. */ int dest = ranksRecvMPI[timeLevel][i]; int tag = dest + timeLevel + 20; - SU2_MPI::Isend(recvBuf, ii, MPI_DOUBLE, dest, tag, MPI_COMM_WORLD, + SU2_MPI::Isend(recvBuf, ii, MPI_DOUBLE, dest, tag, SU2_MPI::GetComm(), &commRequests[timeLevel][indComm]); } @@ -3008,7 +3007,7 @@ void CFEM_DG_EulerSolver::Initiate_MPI_ReverseCommunication(CConfig *config, int tag = rank + timeLevel + 20; SU2_MPI::Irecv(commSendBuf[timeLevel][i].data(), commSendBuf[timeLevel][i].size(), - MPI_DOUBLE, source, tag, MPI_COMM_WORLD, + MPI_DOUBLE, source, tag, SU2_MPI::GetComm(), &commRequests[timeLevel][indComm]); } } @@ -3206,7 +3205,7 @@ void CFEM_DG_EulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_co if (config->GetComm_Level() == COMM_FULL) { #ifdef HAVE_MPI unsigned long MyErrorCounter = ErrorCounter; - SU2_MPI::Allreduce(&MyErrorCounter, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyErrorCounter, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); #endif if (iMesh == MESH_0) config->SetNonphysical_Points(ErrorCounter); } @@ -3726,10 +3725,10 @@ void CFEM_DG_EulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_con if ((config->GetComm_Level() == COMM_FULL) || time_stepping) { #ifdef HAVE_MPI su2double rbuf_time = Min_Delta_Time; - SU2_MPI::Allreduce(&rbuf_time, &Min_Delta_Time, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&rbuf_time, &Min_Delta_Time, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); rbuf_time = Max_Delta_Time; - SU2_MPI::Allreduce(&rbuf_time, &Max_Delta_Time, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&rbuf_time, &Max_Delta_Time, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); #endif } @@ -4147,7 +4146,7 @@ void CFEM_DG_EulerSolver::TolerancesADERPredictorStep(void) { #ifdef HAVE_MPI SU2_MPI::Allreduce(URef, TolSolADER.data(), nVar, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); + SU2_MPI::GetComm()); #else for(unsigned short i=0; iGetComm_Level() == COMM_FULL) { SU2_MPI::Allreduce(locBuf.data(), globBuf.data(), nCommSize, MPI_DOUBLE, - MPI_SUM, MPI_COMM_WORLD); + MPI_SUM, SU2_MPI::GetComm()); } /*--- Copy the data back from globBuf into the required variables. ---*/ @@ -7262,7 +7262,7 @@ void CFEM_DG_EulerSolver::SetResidual_RMS_FEM(CGeometry *geometry, /*--- The local L2 norms must be added to obtain the global value. Also check for divergence. ---*/ vector rbufRes(nVar); - SU2_MPI::Allreduce(Residual_RMS, rbufRes.data(), nVar, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Residual_RMS, rbufRes.data(), nVar, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); for(unsigned short iVar=0; iVar rbufPoint(nVar*size); SU2_MPI::Allgather(Point_Max, nVar, MPI_UNSIGNED_LONG, rbufPoint.data(), - nVar, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); + nVar, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); vector sbufCoor(nDim*nVar); for(unsigned short iVar=0; iVar rbufCoor(nDim*nVar*size); SU2_MPI::Allgather(sbufCoor.data(), nVar*nDim, MPI_DOUBLE, rbufCoor.data(), - nVar*nDim, MPI_DOUBLE, MPI_COMM_WORLD); + nVar*nDim, MPI_DOUBLE, SU2_MPI::GetComm()); for(unsigned short iVar=0; iVarGetRiemann_Var1(Marker_Tag); su2double T_Total = config->GetRiemann_Var2(Marker_Tag); - su2double *Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag); + auto Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag); P_Total /= config->GetPressure_Ref(); T_Total /= config->GetTemperature_Ref(); @@ -7782,7 +7782,7 @@ void CFEM_DG_EulerSolver::BoundaryStates_Riemann(CConfig *confi temperature as well as the three components of the Mach number. */ su2double P_static = config->GetRiemann_Var1(Marker_Tag); su2double T_static = config->GetRiemann_Var2(Marker_Tag); - su2double *Mach = config->GetRiemann_FlowDir(Marker_Tag); + auto Mach = config->GetRiemann_FlowDir(Marker_Tag); P_static /= config->GetPressure_Ref(); T_static /= config->GetTemperature_Ref(); @@ -7833,7 +7833,7 @@ void CFEM_DG_EulerSolver::BoundaryStates_Riemann(CConfig *confi temperature as well as the three components of the Mach number. */ su2double P_static = config->GetRiemann_Var1(Marker_Tag); su2double Rho_static = config->GetRiemann_Var2(Marker_Tag); - su2double *Mach = config->GetRiemann_FlowDir(Marker_Tag); + auto Mach = config->GetRiemann_FlowDir(Marker_Tag); P_static /= config->GetPressure_Ref(); Rho_static /= config->GetDensity_Ref(); @@ -7883,7 +7883,7 @@ void CFEM_DG_EulerSolver::BoundaryStates_Riemann(CConfig *confi flow direction. Retrieve the non-dimensional data. */ su2double Density_e = config->GetRiemann_Var1(Marker_Tag); su2double VelMag_e = config->GetRiemann_Var2(Marker_Tag); - su2double *Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag); + auto Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag); Density_e /= config->GetDensity_Ref(); VelMag_e /= config->GetVelocity_Ref(); @@ -9452,7 +9452,7 @@ void CFEM_DG_EulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, C #ifdef HAVE_MPI unsigned short sbuf_NotMatching = rbuf_NotMatching; - SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_MAX, SU2_MPI::GetComm()); #endif if (rbuf_NotMatching != 0) @@ -9497,7 +9497,7 @@ void CFEM_DG_EulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, C if (config->GetComm_Level() == COMM_FULL) { #ifdef HAVE_MPI unsigned long nBadDOFsLoc = nBadDOFs; - SU2_MPI::Reduce(&nBadDOFsLoc, &nBadDOFs, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(&nBadDOFsLoc, &nBadDOFs, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); #endif if((rank == MASTER_NODE) && (nBadDOFs != 0)) diff --git a/SU2_CFD/src/solvers/CFEM_DG_NSSolver.cpp b/SU2_CFD/src/solvers/CFEM_DG_NSSolver.cpp index 8672eb91ec5c..442380bdff04 100644 --- a/SU2_CFD/src/solvers/CFEM_DG_NSSolver.cpp +++ b/SU2_CFD/src/solvers/CFEM_DG_NSSolver.cpp @@ -2,7 +2,7 @@ * \file CFEM_DG_NSSolver.cpp * \brief Main subroutines for solving finite element Navier-Stokes flow problems * \author J. Alonso, E. van der Weide, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -209,33 +209,13 @@ void CFEM_DG_NSSolver::Friction_Forces(const CGeometry* geometry, const CConfig* /*--- Get the information of the angle of attack, reference area, etc. ---*/ const su2double Alpha = config->GetAoA()*PI_NUMBER/180.0; const su2double Beta = config->GetAoS()*PI_NUMBER/180.0; - const su2double RefArea = config->GetRefArea(); const su2double RefLength = config->GetRefLength(); - const su2double Gas_Constant = config->GetGas_ConstantND(); auto Origin = config->GetRefOriginMoment(0); - const bool grid_movement = config->GetGrid_Movement(); - -/*--- Evaluate reference values for non-dimensionalization. - For dynamic meshes, use the motion Mach number as a reference value - for computing the force coefficients. Otherwise, use the freestream - values, which is the standard convention. ---*/ - const su2double RefTemp = Temperature_Inf; - const su2double RefDensity = Density_Inf; - const su2double RefHeatFlux = config->GetHeat_Flux_Ref(); - su2double RefVel2; - if (grid_movement) { - const su2double Mach2Vel = sqrt(Gamma*Gas_Constant*RefTemp); - const su2double Mach_Motion = config->GetMach_Motion(); - RefVel2 = (Mach_Motion*Mach2Vel)*(Mach_Motion*Mach2Vel); - } - else { - RefVel2 = 0.0; - for(unsigned short iDim=0; iDimGetHeat_Flux_Ref(); - const su2double factor = 1.0/(0.5*RefDensity*RefArea*RefVel2); + const su2double factor = 1.0 / AeroCoeffForceRef; /*--- Variables initialization ---*/ AllBound_CD_Visc = 0.0; AllBound_CL_Visc = 0.0; AllBound_CSF_Visc = 0.0; @@ -850,7 +830,7 @@ void CFEM_DG_NSSolver::Friction_Forces(const CGeometry* geometry, const CConfig* /* Sum up all the data from all ranks. The result will be available on all ranks. */ if (config->GetComm_Level() == COMM_FULL) { SU2_MPI::Allreduce(locBuf.data(), globBuf.data(), nCommSize, MPI_DOUBLE, - MPI_SUM, MPI_COMM_WORLD); + MPI_SUM, SU2_MPI::GetComm()); } /*--- Copy the data back from globBuf into the required variables. ---*/ @@ -877,7 +857,7 @@ void CFEM_DG_NSSolver::Friction_Forces(const CGeometry* geometry, const CConfig* su2double localMax = AllBound_MaxHeatFlux_Visc; if (config->GetComm_Level() == COMM_FULL) { SU2_MPI::Allreduce(&localMax, &AllBound_MaxHeatFlux_Visc, 1, MPI_DOUBLE, - MPI_MAX, MPI_COMM_WORLD); + MPI_MAX, SU2_MPI::GetComm()); } #endif @@ -1301,10 +1281,10 @@ void CFEM_DG_NSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_contai if ((config->GetComm_Level() == COMM_FULL) || time_stepping) { #ifdef HAVE_MPI su2double rbuf_time = Min_Delta_Time; - SU2_MPI::Allreduce(&rbuf_time, &Min_Delta_Time, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&rbuf_time, &Min_Delta_Time, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); rbuf_time = Max_Delta_Time; - SU2_MPI::Allreduce(&rbuf_time, &Max_Delta_Time, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&rbuf_time, &Max_Delta_Time, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); #endif } diff --git a/SU2_CFD/src/solvers/CHeatSolver.cpp b/SU2_CFD/src/solvers/CHeatSolver.cpp index 21618f92304c..7d928c01968f 100644 --- a/SU2_CFD/src/solvers/CHeatSolver.cpp +++ b/SU2_CFD/src/solvers/CHeatSolver.cpp @@ -2,7 +2,7 @@ * \file CHeatSolver.cpp * \brief Main subrotuines for solving the heat equation * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -50,7 +50,7 @@ CHeatSolver::CHeatSolver(CGeometry *geometry, CConfig *config, unsigned short iM dynamic_grid = config->GetDynamic_Grid(); #ifdef HAVE_MPI - MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_rank(SU2_MPI::GetComm(), &rank); #endif /*--- Dimension of the problem --> temperature is the only conservative variable ---*/ @@ -312,15 +312,9 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * for (iDim = 0; iDim < nDim; iDim++) Coord[iDim] = 0.0; - int rank = MASTER_NODE; -#ifdef HAVE_MPI - MPI_Comm_rank(MPI_COMM_WORLD, &rank); -#endif - 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; /*--- Skip coordinates ---*/ @@ -376,25 +370,9 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * /*--- Detect a wrong solution file ---*/ - if (iPoint_Global_Local < nPointDomain) { sbuf_NotMatching = 1; } - -#ifndef HAVE_MPI - rbuf_NotMatching = sbuf_NotMatching; -#else - SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD); -#endif - if (rbuf_NotMatching != 0) { - if (rank == MASTER_NODE) { - cout << endl << "The solution file " << restart_filename.data() << " doesn't match with the mesh file!" << endl; - cout << "It could be empty lines at the end of the file." << endl << endl; - } -#ifndef HAVE_MPI - exit(EXIT_FAILURE); -#else - MPI_Barrier(MPI_COMM_WORLD); - MPI_Abort(MPI_COMM_WORLD,1); - MPI_Finalize(); -#endif + 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); } /*--- Communicate the loaded solution on the fine grid before we transfer @@ -438,59 +416,6 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig * } - -void CHeatSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) { - - unsigned long iPoint, jPoint, iEdge; - su2double *Diff; - unsigned short iVar; - bool boundary_i, boundary_j; - - Diff = new su2double[nVar]; - - nodes->SetUnd_LaplZero(); - - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { - - iPoint = geometry->edges->GetNode(iEdge,0); - jPoint = geometry->edges->GetNode(iEdge,1); - - /*--- Solution differences ---*/ - - for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar); - - boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); - boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); - - /*--- Both points inside the domain, or both in the boundary ---*/ - - if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff); - } - - /*--- iPoint inside the domain, jPoint on the boundary ---*/ - - if (!boundary_i && boundary_j) - if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff); - - /*--- jPoint inside the domain, iPoint on the boundary ---*/ - - if (boundary_i && !boundary_j) - if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff); - - } - - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); - CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); - - delete [] Diff; - -} - void CHeatSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep) { @@ -754,8 +679,8 @@ void CHeatSolver::Set_Heatflux_Areas(CGeometry *geometry, CConfig *config) { } } - SU2_MPI::Allreduce(Local_Surface_Areas, Surface_Areas, config->GetnMarker_HeatFlux(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_HeatFlux_Areas_Monitor, &Total_HeatFlux_Areas_Monitor, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Local_Surface_Areas, Surface_Areas, config->GetnMarker_HeatFlux(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_HeatFlux_Areas_Monitor, &Total_HeatFlux_Areas_Monitor, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); Total_HeatFlux_Areas = 0.0; for( iMarker_HeatFlux = 0; iMarker_HeatFlux < config->GetnMarker_HeatFlux(); iMarker_HeatFlux++ ) { @@ -1264,8 +1189,8 @@ void CHeatSolver::Heat_Fluxes(CGeometry *geometry, CSolver **solver_container, C #ifdef HAVE_MPI MyAllBound_HeatFlux = AllBound_HeatFlux; MyAllBound_AverageT = AllBound_AverageT; - SU2_MPI::Allreduce(&MyAllBound_HeatFlux, &AllBound_HeatFlux, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MyAllBound_AverageT, &AllBound_AverageT, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyAllBound_HeatFlux, &AllBound_HeatFlux, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyAllBound_AverageT, &AllBound_AverageT, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); #endif if (Total_HeatFlux_Areas_Monitor != 0.0) { @@ -1448,13 +1373,13 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, #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); + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); 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); + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); Max_Delta_Time = rbuf_time; #endif } @@ -1464,8 +1389,8 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, #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); + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); Global_Delta_Time = rbuf_time; #endif for (iPoint = 0; iPoint < nPointDomain; iPoint++) @@ -1480,8 +1405,8 @@ void CHeatSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, #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); + SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, SU2_MPI::GetComm()); + SU2_MPI::Bcast(&rbuf_time, 1, MPI_DOUBLE, MASTER_NODE, SU2_MPI::GetComm()); Global_Delta_UnstTimeND = rbuf_time; #endif config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND); @@ -1619,7 +1544,11 @@ void CHeatSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ /*--- Solve or smooth the linear system ---*/ auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + + /*--- Store the the number of iterations of the linear solver ---*/ SetIterLinSolver(iter); + + /*--- Store the value of the residual. ---*/ SetResLinSolver(System.GetResidual()); for (iPoint = 0; iPoint < nPointDomain; iPoint++) { diff --git a/SU2_CFD/src/solvers/CIncEulerSolver.cpp b/SU2_CFD/src/solvers/CIncEulerSolver.cpp index e3df3da16efb..e02b8fd25048 100644 --- a/SU2_CFD/src/solvers/CIncEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CIncEulerSolver.cpp @@ -2,7 +2,7 @@ * \file CIncEulerSolver.cpp * \brief Main subroutines for solving incompressible flow (Euler, Navier-Stokes, etc.). * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -31,6 +31,7 @@ #include "../../include/fluid/CIncIdealGas.hpp" #include "../../include/fluid/CIncIdealGasPolynomial.hpp" #include "../../include/variables/CIncNSVariable.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh, @@ -41,7 +42,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned * being called by itself, or by its derived class CIncNSSolver. ---*/ const string description = navier_stokes? "Navier-Stokes" : "Euler"; - unsigned short iVar, iMarker, nLineLets; + unsigned short iMarker, nLineLets; ifstream restart_file; unsigned short nZone = geometry->GetnZone(); bool restart = (config->GetRestart() || config->GetRestart_Flow()); @@ -103,6 +104,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned nDim = geometry->GetnDim(); + /*--- Make sure to align the sizes with the constructor of CIncEulerVariable. ---*/ nVar = nDim+2; nPrimVar = nDim+9; nPrimVarGrad = nDim+4; /*--- Initialize nVarGrad for deallocation ---*/ @@ -132,26 +134,14 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned SetVerificationSolution(nDim, nVar, config); - /// TODO: This type of variables will be replaced. - - 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 preconditioning matrix. ---*/ - - Preconditioner = new su2double* [nVar]; - for (iVar = 0; iVar < nVar; iVar ++) - Preconditioner[iVar] = new su2double[nVar]; - /*--- Allocate base class members. ---*/ Allocate(*config); + /*--- MPI + OpenMP initialization. ---*/ + + HybridParallelInitialization(*config, *geometry); + /*--- Jacobians and vector structures for implicit computations ---*/ if (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT) { @@ -159,7 +149,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned if (rank == MASTER_NODE) cout << "Initialize Jacobian structure (" << description << "). MG level: " << iMesh <<"." << endl; - Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config); + Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config, ReducerStrategy); if (config->GetKind_Linear_Solver_Prec() == LINELET) { nLineLets = Jacobian.BuildLineletPreconditioner(geometry, config); @@ -226,19 +216,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned CIncEulerSolver::~CIncEulerSolver(void) { - unsigned short iVar; - - delete [] Primitive; - delete [] Primitive_i; - delete [] Primitive_j; - - if (Preconditioner != nullptr) { - for (iVar = 0; iVar < nVar; iVar ++) - delete [] Preconditioner[iVar]; - delete [] Preconditioner; - } - - delete FluidModel; + for(auto& model : FluidModel) delete model; } void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMesh) { @@ -283,21 +261,23 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i /*--- Depending on the density model chosen, select a fluid model. ---*/ + CFluidModel* auxFluidModel = nullptr; + switch (config->GetKind_FluidModel()) { case CONSTANT_DENSITY: - FluidModel = new CConstantDensity(Density_FreeStream, config->GetSpecific_Heat_Cp()); - FluidModel->SetTDState_T(Temperature_FreeStream); + auxFluidModel = new CConstantDensity(Density_FreeStream, config->GetSpecific_Heat_Cp()); + auxFluidModel->SetTDState_T(Temperature_FreeStream); break; case INC_IDEAL_GAS: config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT/(config->GetMolecular_Weight()/1000.0)); Pressure_Thermodynamic = Density_FreeStream*Temperature_FreeStream*config->GetGas_Constant(); - FluidModel = new CIncIdealGas(config->GetSpecific_Heat_Cp(), config->GetGas_Constant(), Pressure_Thermodynamic); - FluidModel->SetTDState_T(Temperature_FreeStream); - Pressure_Thermodynamic = FluidModel->GetPressure(); + auxFluidModel = new CIncIdealGas(config->GetSpecific_Heat_Cp(), config->GetGas_Constant(), Pressure_Thermodynamic); + auxFluidModel->SetTDState_T(Temperature_FreeStream); + Pressure_Thermodynamic = auxFluidModel->GetPressure(); config->SetPressure_Thermodynamic(Pressure_Thermodynamic); break; @@ -305,15 +285,15 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT/(config->GetMolecular_Weight()/1000.0)); Pressure_Thermodynamic = Density_FreeStream*Temperature_FreeStream*config->GetGas_Constant(); - FluidModel = new CIncIdealGasPolynomial(config->GetGas_Constant(), Pressure_Thermodynamic); + auxFluidModel = new CIncIdealGasPolynomial(config->GetGas_Constant(), Pressure_Thermodynamic); if (viscous) { /*--- Variable Cp model via polynomial. ---*/ for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(iVar), iVar); - FluidModel->SetCpModel(config); + auxFluidModel->SetCpModel(config); } - FluidModel->SetTDState_T(Temperature_FreeStream); - Pressure_Thermodynamic = FluidModel->GetPressure(); + auxFluidModel->SetTDState_T(Temperature_FreeStream); + Pressure_Thermodynamic = auxFluidModel->GetPressure(); config->SetPressure_Thermodynamic(Pressure_Thermodynamic); break; @@ -339,8 +319,8 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i /*--- Use the fluid model to compute the dimensional viscosity/conductivity. ---*/ - FluidModel->SetLaminarViscosityModel(config); - Viscosity_FreeStream = FluidModel->GetLaminarViscosity(); + auxFluidModel->SetLaminarViscosityModel(config); + Viscosity_FreeStream = auxFluidModel->GetLaminarViscosity(); config->SetViscosity_FreeStream(Viscosity_FreeStream); Reynolds = Density_FreeStream*ModVel_FreeStream/Viscosity_FreeStream; config->SetReynolds(Reynolds); @@ -397,9 +377,9 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i /*--- Get the freestream energy. Only useful if energy equation is active. ---*/ - Energy_FreeStream = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStream*ModVel_FreeStream; + Energy_FreeStream = auxFluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStream*ModVel_FreeStream; + if (tkeNeeded) { Energy_FreeStream += Tke_FreeStream; }; config->SetEnergy_FreeStream(Energy_FreeStream); - if (tkeNeeded) { Energy_FreeStream += Tke_FreeStream; }; config->SetEnergy_FreeStream(Energy_FreeStream); /*--- Compute Mach number ---*/ @@ -412,17 +392,17 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i /*--- 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_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); + 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); } Temperature_FreeStreamND = Temperature_FreeStream/config->GetTemperature_Ref(); config->SetTemperature_FreeStreamND(Temperature_FreeStreamND); - Gas_ConstantND = config->GetGas_Constant()/Gas_Constant_Ref; config->SetGas_ConstantND(Gas_ConstantND); - Specific_Heat_CpND = config->GetSpecific_Heat_Cp()/Gas_Constant_Ref; config->SetSpecific_Heat_CpND(Specific_Heat_CpND); + Gas_ConstantND = config->GetGas_Constant()/Gas_Constant_Ref; config->SetGas_ConstantND(Gas_ConstantND); + Specific_Heat_CpND = config->GetSpecific_Heat_Cp()/Gas_Constant_Ref; config->SetSpecific_Heat_CpND(Specific_Heat_CpND); /*--- We assume that Cp = Cv for our incompressible fluids. ---*/ Specific_Heat_CvND = config->GetSpecific_Heat_Cp()/Gas_Constant_Ref; config->SetSpecific_Heat_CvND(Specific_Heat_CvND); @@ -449,68 +429,79 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i /*--- Delete the original (dimensional) FluidModel object. No fluid is used for inscompressible cases. ---*/ - delete FluidModel; + delete auxFluidModel; - switch (config->GetKind_FluidModel()) { + /*--- Create one final fluid model object per OpenMP thread to be able to use them in parallel. + * GetFluidModel() should be used to automatically access the "right" object of each thread. ---*/ - case CONSTANT_DENSITY: - FluidModel = new CConstantDensity(Density_FreeStreamND, Specific_Heat_CpND); - break; + assert(FluidModel.empty() && "Potential memory leak!"); + FluidModel.resize(omp_get_max_threads()); - case INC_IDEAL_GAS: - FluidModel = new CIncIdealGas(Specific_Heat_CpND, Gas_ConstantND, Pressure_ThermodynamicND); - break; + for (auto& fluidModel : FluidModel) { - case INC_IDEAL_GAS_POLY: - FluidModel = new CIncIdealGasPolynomial(Gas_ConstantND, Pressure_ThermodynamicND); - if (viscous) { - /*--- Variable Cp model via polynomial. ---*/ - config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(0)/Gas_Constant_Ref, 0); - for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++) - config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Gas_Constant_Ref, iVar); - FluidModel->SetCpModel(config); - } - break; - FluidModel->SetTDState_T(Temperature_FreeStreamND); - } + switch (config->GetKind_FluidModel()) { - Energy_FreeStreamND = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStreamND*ModVel_FreeStreamND; + case CONSTANT_DENSITY: + fluidModel = new CConstantDensity(Density_FreeStreamND, Specific_Heat_CpND); + break; - if (viscous) { + case INC_IDEAL_GAS: + fluidModel = new CIncIdealGas(Specific_Heat_CpND, Gas_ConstantND, Pressure_ThermodynamicND); + break; + + case INC_IDEAL_GAS_POLY: + fluidModel = new CIncIdealGasPolynomial(Gas_ConstantND, Pressure_ThermodynamicND); + if (viscous) { + /*--- Variable Cp model via polynomial. ---*/ + config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(0)/Gas_Constant_Ref, 0); + for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++) + config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Gas_Constant_Ref, iVar); + fluidModel->SetCpModel(config); + } + break; + /// TODO: Why is this outside? + fluidModel->SetTDState_T(Temperature_FreeStreamND); + } - /*--- Constant viscosity model ---*/ + if (viscous) { + + /*--- Constant viscosity model ---*/ - config->SetMu_ConstantND(config->GetMu_Constant()/Viscosity_Ref); + config->SetMu_ConstantND(config->GetMu_Constant()/Viscosity_Ref); - /*--- Sutherland's model ---*/ + /*--- Sutherland's model ---*/ - config->SetMu_RefND(config->GetMu_Ref()/Viscosity_Ref); - config->SetMu_SND(config->GetMu_S()/config->GetTemperature_Ref()); - config->SetMu_Temperature_RefND(config->GetMu_Temperature_Ref()/config->GetTemperature_Ref()); + config->SetMu_RefND(config->GetMu_Ref()/Viscosity_Ref); + config->SetMu_SND(config->GetMu_S()/config->GetTemperature_Ref()); + config->SetMu_Temperature_RefND(config->GetMu_Temperature_Ref()/config->GetTemperature_Ref()); - /*--- Viscosity model via polynomial. ---*/ + /*--- Viscosity model via polynomial. ---*/ - config->SetMu_PolyCoeffND(config->GetMu_PolyCoeff(0)/Viscosity_Ref, 0); - for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++) - config->SetMu_PolyCoeffND(config->GetMu_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Viscosity_Ref, iVar); + config->SetMu_PolyCoeffND(config->GetMu_PolyCoeff(0)/Viscosity_Ref, 0); + for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++) + config->SetMu_PolyCoeffND(config->GetMu_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Viscosity_Ref, iVar); - /*--- Constant thermal conductivity model ---*/ + /*--- Constant thermal conductivity model ---*/ - config->SetKt_ConstantND(config->GetKt_Constant()/Conductivity_Ref); + config->SetKt_ConstantND(config->GetKt_Constant()/Conductivity_Ref); - /*--- Conductivity model via polynomial. ---*/ + /*--- Conductivity model via polynomial. ---*/ - config->SetKt_PolyCoeffND(config->GetKt_PolyCoeff(0)/Conductivity_Ref, 0); - for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++) - config->SetKt_PolyCoeffND(config->GetKt_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Conductivity_Ref, iVar); + config->SetKt_PolyCoeffND(config->GetKt_PolyCoeff(0)/Conductivity_Ref, 0); + for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++) + config->SetKt_PolyCoeffND(config->GetKt_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Conductivity_Ref, iVar); - /*--- Set up the transport property models. ---*/ + /*--- Set up the transport property models. ---*/ - FluidModel->SetLaminarViscosityModel(config); - FluidModel->SetThermalConductivityModel(config); + fluidModel->SetLaminarViscosityModel(config); + fluidModel->SetThermalConductivityModel(config); + + } } + Energy_FreeStreamND = GetFluidModel()->GetStaticEnergy() + 0.5*ModVel_FreeStreamND*ModVel_FreeStreamND; + if (tkeNeeded) { Energy_FreeStreamND += Tke_FreeStreamND; }; config->SetEnergy_FreeStreamND(Energy_FreeStreamND); Energy_Ref = Energy_FreeStream/Energy_FreeStreamND; config->SetEnergy_Ref(Energy_Ref); @@ -822,147 +813,41 @@ void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short i cout << NonDimTableOut.str(); } - - -} - -void CIncEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long TimeIter) { - - unsigned long iPoint, Point_Fine; - unsigned short iMesh, iChildren, iVar; - su2double Area_Children, Area_Parent, *Solution_Fine, *Solution; - - const bool restart = (config->GetRestart() || config->GetRestart_Flow()); - const bool rans = (config->GetKind_Turb_Model() != NONE); - const bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - - /*--- Check if a verification solution is to be computed. ---*/ - if ((VerificationSolution) && (TimeIter == 0) && !restart) { - - /*--- Loop over the multigrid levels. ---*/ - for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - - /*--- Loop over all grid points. ---*/ - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - - /* Set the pointers to the coordinates and solution of this DOF. */ - const su2double *coor = geometry[iMesh]->nodes->GetCoord(iPoint); - su2double *solDOF = solver_container[iMesh][FLOW_SOL]->GetNodes()->GetSolution(iPoint); - - /* Set the solution in this DOF to the initial condition provided by - the verification solution class. This can be the exact solution, - but this is not necessary. */ - VerificationSolution->GetInitialCondition(coor, solDOF); - } - } - } - - /*--- If restart solution, then interpolate the flow solution to - all the multigrid levels, this is important with the dual time strategy ---*/ - - if (restart && (TimeIter == 0)) { - - Solution = new su2double[nVar]; - 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_container[iMesh-1][FLOW_SOL]->GetNodes()->GetSolution(Point_Fine); - for (iVar = 0; iVar < nVar; iVar++) { - Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; - } - } - solver_container[iMesh][FLOW_SOL]->GetNodes()->SetSolution(iPoint,Solution); - } - solver_container[iMesh][FLOW_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION); - solver_container[iMesh][FLOW_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION); - } - delete [] Solution; - - /*--- Interpolate the turblence variable also, if needed ---*/ - - if (rans) { - - unsigned short nVar_Turb = solver_container[MESH_0][TURB_SOL]->GetnVar(); - Solution = new su2double[nVar_Turb]; - 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_Turb; 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_container[iMesh-1][TURB_SOL]->GetNodes()->GetSolution(Point_Fine); - for (iVar = 0; iVar < nVar_Turb; iVar++) { - Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent; - } - } - solver_container[iMesh][TURB_SOL]->GetNodes()->SetSolution(iPoint,Solution); - } - solver_container[iMesh][TURB_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION_EDDY); - solver_container[iMesh][TURB_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION_EDDY); - solver_container[iMesh][TURB_SOL]->Postprocessing(geometry[iMesh], solver_container[iMesh], config, iMesh); - } - delete [] Solution; - } - - } - - /*--- The value of the solution for the first iteration of the dual time ---*/ - - if (dual_time && (TimeIter == 0 || (restart && TimeIter == config->GetRestart_Iter()))) { - PushSolutionBackInTime(TimeIter, restart, rans, solver_container, geometry, config); - } } -void CIncEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { +void CIncEulerSolver::CommonPreprocessing(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 cont_adjoint = config->GetContinuous_Adjoint(); - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool muscl = (config->GetMUSCL_Flow() || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == ROE)); - bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); - bool center = ((config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED)); - bool center_jst = center && (config->GetKind_Centered_Flow() == JST); - bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; - bool outlet = ((config->GetnMarker_Outlet() != 0)); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED); + const bool center_jst = (config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0); + const bool outlet = (config->GetnMarker_Outlet() != 0); /*--- Set the primitive variables ---*/ - ErrorCounter = SetPrimitive_Variables(solver_container, config, Output); - - /*--- Upwind second order reconstruction ---*/ - - if ((muscl && !center) && (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); + SU2_OMP_MASTER + ErrorCounter = 0; + SU2_OMP_BARRIER - /*--- Limiter computation ---*/ + SU2_OMP_ATOMIC + ErrorCounter += SetPrimitive_Variables(solver_container, config); - if ((limiter) && (iMesh == MESH_0) && !Output && !van_albada) { - SetPrimitive_Limiter(geometry, config); + if ((iMesh == MESH_0) && (config->GetComm_Level() == COMM_FULL)) { + SU2_OMP_BARRIER + SU2_OMP_MASTER + { + unsigned long tmp = ErrorCounter; + SU2_MPI::Allreduce(&tmp, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + config->SetNonphysical_Points(ErrorCounter); } - + SU2_OMP_BARRIER } /*--- Artificial dissipation ---*/ if (center && !Output) { SetMax_Eigenvalue(geometry, config); - if ((center_jst) && (iMesh == MESH_0)) { + if (center_jst) { SetCentered_Dissipation_Sensor(geometry, config); SetUndivided_Laplacian(geometry, config); } @@ -974,267 +859,147 @@ void CIncEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contai /*--- Compute properties needed for mass flow BCs. ---*/ - if (outlet) GetOutlet_Properties(geometry, config, iMesh, Output); - - /*--- Initialize the Jacobian matrices ---*/ - - if (implicit && !Output) 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); + if (outlet) { + SU2_OMP_MASTER + GetOutlet_Properties(geometry, config, iMesh, Output); + SU2_OMP_BARRIER } -} - -void CIncEulerSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, - unsigned short iMesh) { } - -unsigned long CIncEulerSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) { - - unsigned long iPoint, nonPhysicalPoints = 0; - bool physical = true; - - for (iPoint = 0; iPoint < nPoint; iPoint ++) { - - /*--- Incompressible flow, primitive variables ---*/ - - physical = nodes->SetPrimVar(iPoint,FluidModel); - - /* Check for non-realizable states for reporting. */ - - if (!physical) nonPhysicalPoints++; - - /*--- Initialize the convective, source and viscous residual vector ---*/ - - if (!Output) LinSysRes.SetBlock_Zero(iPoint); + /*--- Initialize the Jacobian matrix and residual, not needed for the reducer strategy + * as we set blocks (including diagonal ones) and completely overwrite. ---*/ + if(!ReducerStrategy && !Output) { + LinSysRes.SetValZero(); + if (implicit) Jacobian.SetValZero(); + else {SU2_OMP_BARRIER} // because of "nowait" in LinSysRes } - - return nonPhysicalPoints; } -void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, - unsigned short iMesh, unsigned long Iteration) { - - su2double Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, - Mean_BetaInc2, Lambda, Local_Delta_Time, - Global_Delta_Time = 1E6, Global_Delta_UnstTimeND, ProjVel, ProjVel_i, ProjVel_j; - const su2double* Normal; - - unsigned long iEdge, iVertex, iPoint, jPoint; - unsigned short iDim, iMarker; - - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool time_stepping = config->GetTime_Marching() == TIME_STEPPING; - bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - - Min_Delta_Time = 1.E30; Max_Delta_Time = 0.0; - - /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ - - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - nodes->SetMax_Lambda_Inv(iPoint,0.0); +void CIncEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, + unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { - /*--- Loop interior edges ---*/ + const auto InnerIter = config->GetInnerIter(); + const bool muscl = config->GetMUSCL_Flow() && (iMesh == MESH_0); + const bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED); + const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); + const bool van_albada = (config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE); - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + /*--- Common preprocessing steps. ---*/ - /*--- Point identification, Normal vector and area ---*/ - - iPoint = geometry->edges->GetNode(iEdge,0); - jPoint = geometry->edges->GetNode(iEdge,1); - - Normal = geometry->edges->GetNormal(iEdge); - - Area = GeometryToolbox::Norm(nDim, Normal); + CommonPreprocessing(geometry, solver_container, config, iMesh, iRKStep, RunTime_EqSystem, Output); - /*--- Mean Values ---*/ + /*--- Upwind second order reconstruction ---*/ - Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); - Mean_BetaInc2 = 0.5 * (nodes->GetBetaInc2(iPoint) + nodes->GetBetaInc2(jPoint)); - Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); + if (!Output && muscl && !center) { - /*--- Adjustment for grid movement ---*/ + /*--- Gradient computation for MUSCL reconstruction. ---*/ - 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); + switch (config->GetKind_Gradient_Method_Recon()) { + case GREEN_GAUSS: + SetPrimitive_Gradient_GG(geometry, config, true); break; + case LEAST_SQUARES: + case WEIGHTED_LEAST_SQUARES: + SetPrimitive_Gradient_LS(geometry, config, true); break; + default: break; } - /*--- Inviscid contribution ---*/ - - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint,Lambda); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Inv(jPoint,Lambda); + /*--- Limiter computation ---*/ + if (limiter && !van_albada) SetPrimitive_Limiter(geometry, config); } +} - /*--- 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(); - Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ +unsigned long CIncEulerSolver::SetPrimitive_Variables(CSolver **solver_container, const CConfig *config) { - Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); - Mean_BetaInc2 = nodes->GetBetaInc2(iPoint); - Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); + unsigned long iPoint, nonPhysicalPoints = 0; - /*--- Adjustment for grid movement ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < nPoint; iPoint ++) { - 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; - } + /*--- Incompressible flow, primitive variables ---*/ - /*--- Inviscid contribution ---*/ + auto physical = nodes->SetPrimVar(iPoint,GetFluidModel()); - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) { - nodes->AddMax_Lambda_Inv(iPoint,Lambda); - } + /* Check for non-realizable states for reporting. */ - } - } + if (!physical) nonPhysicalPoints++; } - /*--- 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++) { + return nonPhysicalPoints; +} - Vol = geometry->nodes->GetVolume(iPoint); +void CIncEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, + unsigned short iMesh, unsigned long Iteration) { - if (Vol != 0.0) { - Local_Delta_Time = nodes->GetLocalCFL(iPoint)*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); + /*--- Define an object to compute the speed of sound. ---*/ + struct SoundSpeed { + FORCEINLINE su2double operator() (const CIncEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + return sqrt(0.5 * (nodes.GetBetaInc2(iPoint) + nodes.GetBetaInc2(jPoint))); } - } + FORCEINLINE su2double operator() (const CIncEulerVariable& nodes, unsigned long iPoint) const { + return sqrt(nodes.GetBetaInc2(iPoint)); + } - /*--- 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 - } + } soundSpeed; - /*--- For time-accurate simulations use the minimum delta time of the whole mesh (global) ---*/ + /*--- Define an object to compute the viscous eigenvalue. ---*/ + struct LambdaVisc { + const bool energy; - if (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 - /*--- 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 ---*/ + LambdaVisc(bool e) : energy(e) {} - if (config->GetUnst_CFL() == 0.0) { - Global_Delta_Time = config->GetDelta_UnstTime(); + FORCEINLINE su2double lambda(su2double lamVisc, su2double eddyVisc, su2double rho, su2double k, su2double cv) const { + su2double Lambda_1 = (4.0/3.0)*(lamVisc + eddyVisc); + su2double Lambda_2 = 0.0; + if (energy) Lambda_2 = k / cv; + return (Lambda_1 + Lambda_2) / rho; } - config->SetDelta_UnstTimeND(Global_Delta_Time); - for (iPoint = 0; iPoint < nPointDomain; iPoint++){ - - /*--- Sets the regular CFL equal to the unsteady CFL ---*/ - - nodes->SetLocalCFL(iPoint, config->GetUnst_CFL()); - nodes->SetDelta_Time(iPoint, Global_Delta_Time); - Min_Delta_Time = Global_Delta_Time; - Max_Delta_Time = Global_Delta_Time; + FORCEINLINE su2double operator() (const CIncEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + su2double thermalCond = 0.5*(nodes.GetThermalConductivity(iPoint) + nodes.GetThermalConductivity(jPoint)); + su2double laminarVisc = 0.5*(nodes.GetLaminarViscosity(iPoint) + nodes.GetLaminarViscosity(jPoint)); + su2double eddyVisc = 0.5*(nodes.GetEddyViscosity(iPoint) + nodes.GetEddyViscosity(jPoint)); + su2double density = 0.5*(nodes.GetDensity(iPoint) + nodes.GetDensity(jPoint)); + su2double cv = 0.5*(nodes.GetSpecificHeatCv(iPoint) + nodes.GetSpecificHeatCv(jPoint)); + return lambda(laminarVisc, eddyVisc, density, thermalCond, cv); } - } - - /*--- 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 = 1e30; - for (iPoint = 0; iPoint < nPointDomain; iPoint++){ - Global_Delta_UnstTimeND = min(Global_Delta_UnstTimeND,config->GetUnst_CFL()*Global_Delta_Time/nodes->GetLocalCFL(iPoint)); + FORCEINLINE su2double operator() (const CIncEulerVariable& nodes, unsigned long iPoint) const { + su2double thermalCond = nodes.GetThermalConductivity(iPoint); + su2double laminarVisc = nodes.GetLaminarViscosity(iPoint); + su2double eddyVisc = nodes.GetEddyViscosity(iPoint); + su2double density = nodes.GetDensity(iPoint); + su2double cv = nodes.GetSpecificHeatCv(iPoint); + return lambda(laminarVisc, eddyVisc, density, thermalCond, cv); } -#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); - } + } lambdaVisc(config->GetEnergy_Equation()); - /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/ + /*--- Now instantiate the generic implementation with the two functors above. ---*/ - 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); - } - } + SetTime_Step_impl(soundSpeed, lambdaVisc, geometry, solver_container, config, iMesh, Iteration); } void CIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep) { - CNumerics* numerics = numerics_container[CONV_TERM]; + CNumerics* numerics = numerics_container[CONV_TERM + omp_get_thread_num()*MAX_TERMS]; - unsigned long iEdge, iPoint, jPoint; + unsigned long iPoint, jPoint; bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); bool jst_scheme = ((config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0)); - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + /*--- Loop over edge colors. ---*/ + for (auto color : EdgeColoring) + { + /*--- Chunk size is at least OMP_MIN_SIZE and a multiple of the color group size. ---*/ + SU2_OMP_FOR_DYN(nextMultiple(OMP_MIN_SIZE, color.groupSize)) + for(auto k = 0ul; k < color.size; ++k) { + + auto iEdge = color.indices[k]; /*--- Points in edge, set normal vectors, and number of neighbors ---*/ @@ -1267,16 +1032,33 @@ void CIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co auto residual = numerics->ComputeResidual(config); - /*--- Update convective and artificial dissipation residuals ---*/ - - LinSysRes.AddBlock(iPoint, residual); - LinSysRes.SubtractBlock(jPoint, residual); + /*--- Update residual value ---*/ - /*--- Store implicit contributions from the residual calculation. ---*/ + if (ReducerStrategy) { + EdgeFluxes.SetBlock(iEdge, residual); + if (implicit) + Jacobian.SetBlocks(iEdge, residual.jacobian_i, residual.jacobian_j); + } + else { + LinSysRes.AddBlock(iPoint, residual); + LinSysRes.SubtractBlock(jPoint, residual); - if (implicit) { - Jacobian.UpdateBlocks(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + /*--- Set implicit computation ---*/ + if (implicit) + Jacobian.UpdateBlocks(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); } + + /*--- Viscous contribution. ---*/ + + Viscous_Residual(iEdge, geometry, solver_container, + numerics_container[VISC_TERM + omp_get_thread_num()*MAX_TERMS], config); + } + } // end color loop + + if (ReducerStrategy) { + SumEdgeFluxes(geometry); + if (implicit) + Jacobian.SetDiagonalAsColumnSum(); } } @@ -1284,23 +1066,30 @@ void CIncEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_co void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { - CNumerics* numerics = numerics_container[CONV_TERM]; + CNumerics* numerics = numerics_container[CONV_TERM + omp_get_thread_num()*MAX_TERMS]; - su2double **Gradient_i, **Gradient_j, Project_Grad_i, Project_Grad_j, - *V_i, *V_j, *S_i, *S_j, *Limiter_i = nullptr, *Limiter_j = nullptr; + /*--- Static arrays of MUSCL-reconstructed primitives and secondaries (thread safety). ---*/ + su2double Primitive_i[MAXNVAR] = {0.0}, Primitive_j[MAXNVAR] = {0.0}; - unsigned long iEdge, iPoint, jPoint, counter_local = 0, counter_global = 0; + unsigned long iPoint, jPoint, counter_local = 0; unsigned short iDim, iVar; - unsigned long InnerIter = config->GetInnerIter(); - bool implicit = (config->GetKind_TimeIntScheme() == 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; + SU2_OMP_MASTER + ErrorCounter = 0; - /*--- Loop over all the edges ---*/ + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool muscl = (config->GetMUSCL_Flow() && (iMesh == MESH_0)); + const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER); + const bool van_albada = (config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE); - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { + /*--- Loop over edge colors. ---*/ + for (auto color : EdgeColoring) + { + /*--- Chunk size is at least OMP_MIN_SIZE and a multiple of the color group size. ---*/ + SU2_OMP_FOR_DYN(nextMultiple(OMP_MIN_SIZE, color.groupSize)) + for(auto k = 0ul; k < color.size; ++k) { + + auto iEdge = color.indices[k]; /*--- Points in edge and normal vectors ---*/ @@ -1314,44 +1103,49 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Get primitive variables ---*/ - V_i = nodes->GetPrimitive(iPoint); V_j = nodes->GetPrimitive(jPoint); - S_i = nodes->GetSecondary(iPoint); S_j = nodes->GetSecondary(jPoint); + auto V_i = nodes->GetPrimitive(iPoint); + auto V_j = nodes->GetPrimitive(jPoint); /*--- High order reconstruction using MUSCL strategy ---*/ if (muscl) { + auto Coord_i = geometry->nodes->GetCoord(iPoint); + auto Coord_j = geometry->nodes->GetCoord(jPoint); + + su2double Vector_ij[MAXNDIM] = {0.0}; 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)); + Vector_ij[iDim] = 0.5*(Coord_j[iDim] - Coord_i[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); - } + auto Gradient_i = nodes->GetGradient_Reconstruction(iPoint); + auto Gradient_j = nodes->GetGradient_Reconstruction(jPoint); for (iVar = 0; iVar < nPrimVarGrad; iVar++) { - Project_Grad_i = 0.0; Project_Grad_j = 0.0; + + su2double Project_Grad_i = 0.0; + su2double 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]; + Project_Grad_i += Vector_ij[iDim]*Gradient_i[iVar][iDim]; + Project_Grad_j -= Vector_ij[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; + + su2double lim_i = 1.0; + su2double lim_j = 1.0; + + if (van_albada) { + su2double V_ij = V_j[iVar] - V_i[iVar]; + lim_i = V_ij*( 2.0*Project_Grad_i + V_ij) / (4*pow(Project_Grad_i, 2) + pow(V_ij, 2) + EPS); + lim_j = V_ij*(-2.0*Project_Grad_j + V_ij) / (4*pow(Project_Grad_j, 2) + pow(V_ij, 2) + EPS); } - else { - Primitive_i[iVar] = V_i[iVar] + Project_Grad_i; - Primitive_j[iVar] = V_j[iVar] + Project_Grad_j; + else if (limiter) { + lim_i = nodes->GetLimiter_Primitive(iPoint, iVar); + lim_j = nodes->GetLimiter_Primitive(jPoint, iVar); } + + Primitive_i[iVar] = V_i[iVar] + lim_i * Project_Grad_i; + Primitive_j[iVar] = V_j[iVar] + lim_j * Project_Grad_j; } for (iVar = nPrimVarGrad; iVar < nPrimVar; iVar++) { @@ -1373,20 +1167,10 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont bool neg_density_i = (Primitive_i[nDim+2] < 0.0); bool neg_density_j = (Primitive_j[nDim+2] < 0.0); - if (neg_density_i || neg_temperature_i) { - nodes->SetNon_Physical(iPoint, true); - } else { - nodes->SetNon_Physical(iPoint, false); - } - - if (neg_density_j || neg_temperature_j) { - nodes->SetNon_Physical(jPoint, true); - } else { - nodes->SetNon_Physical(jPoint, false); - } + nodes->SetNon_Physical(iPoint, neg_density_i || neg_temperature_i); + nodes->SetNon_Physical(jPoint, neg_density_j || neg_temperature_j); - /* Lastly, check for existing first-order points still active - from previous iterations. */ + /* Lastly, check for existing first-order points still active from previous iterations. */ if (nodes->GetNon_Physical(iPoint)) { counter_local++; @@ -1404,10 +1188,9 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont } else { - /*--- Set conservative variables without reconstruction ---*/ + /*--- Set primitive variables without reconstruction ---*/ numerics->SetPrimitive(V_i, V_j); - numerics->SetSecondary(S_i, S_j); } @@ -1417,23 +1200,48 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Update residual value ---*/ - LinSysRes.AddBlock(iPoint, residual); - LinSysRes.SubtractBlock(jPoint, residual); - - /*--- Set implicit Jacobians ---*/ + if (ReducerStrategy) { + EdgeFluxes.SetBlock(iEdge, residual); + if (implicit) + Jacobian.SetBlocks(iEdge, residual.jacobian_i, residual.jacobian_j); + } + else { + LinSysRes.AddBlock(iPoint, residual); + LinSysRes.SubtractBlock(jPoint, residual); - if (implicit) { - Jacobian.UpdateBlocks(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + /*--- Set implicit computation ---*/ + if (implicit) + Jacobian.UpdateBlocks(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); } + + /*--- Viscous contribution. ---*/ + + Viscous_Residual(iEdge, geometry, solver_container, + numerics_container[VISC_TERM + omp_get_thread_num()*MAX_TERMS], config); + } + } // end color loop + + if (ReducerStrategy) { + SumEdgeFluxes(geometry); + if (implicit) + Jacobian.SetDiagonalAsColumnSum(); } /*--- Warning message about non-physical reconstructions. ---*/ - if (config->GetComm_Level() == COMM_FULL) { - if (iMesh == MESH_0) { - SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); - config->SetNonphysical_Reconstr(counter_global); + if ((iMesh == MESH_0) && (config->GetComm_Level() == COMM_FULL)) { + /*--- Add counter results for all threads. ---*/ + SU2_OMP_ATOMIC + ErrorCounter += counter_local; + SU2_OMP_BARRIER + + /*--- Add counter results for all ranks. ---*/ + SU2_OMP_MASTER { + counter_local = ErrorCounter; + SU2_MPI::Reduce(&counter_local, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); + config->SetNonphysical_Reconstr(ErrorCounter); } + SU2_OMP_BARRIER } } @@ -1441,7 +1249,8 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { - CNumerics* numerics = numerics_container[SOURCE_FIRST_TERM]; + /*--- Pick one numerics object per thread. ---*/ + CNumerics* numerics = numerics_container[SOURCE_FIRST_TERM + omp_get_thread_num()*MAX_TERMS]; unsigned short iVar; unsigned long iPoint; @@ -1454,11 +1263,16 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont const bool viscous = config->GetViscous(); const bool radiation = config->AddRadiation(); const bool vol_heat = config->GetHeatSource(); + const bool turbulent = (config->GetKind_Turb_Model() != NONE); + const bool energy = config->GetEnergy_Equation(); + const bool streamwise_periodic = config->GetKind_Streamwise_Periodic(); + const bool streamwise_periodic_temperature = config->GetStreamwise_Periodic_Temperature(); if (body_force) { /*--- Loop over all points ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the conservative variables ---*/ @@ -1490,6 +1304,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Loop over all points ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the conservative variables ---*/ @@ -1521,6 +1336,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- Loop over all points ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Load the primitive variables ---*/ @@ -1556,6 +1372,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont if (viscous) { + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPoint; iPoint++) { su2double yCoord = geometry->nodes->GetCoord(iPoint, 1); @@ -1566,7 +1383,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont if (yCoord > EPS) AuxVar = Total_Viscosity*yVelocity/yCoord; - /*--- Set the auxilairy variable for this node. ---*/ + /*--- Set the auxiliary variable for this node. ---*/ nodes->SetAuxVar(iPoint, 0, AuxVar); @@ -1585,6 +1402,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont /*--- loop over points ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Conservative variables w/o reconstruction ---*/ @@ -1637,8 +1455,9 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont if (radiation) { - CNumerics* second_numerics = numerics_container[SOURCE_SECOND_TERM]; + CNumerics* second_numerics = numerics_container[SOURCE_SECOND_TERM + omp_get_thread_num()*MAX_TERMS]; + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Store the radiation source term ---*/ @@ -1677,6 +1496,100 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont } + if (streamwise_periodic) { + + /*--- For turbulent streamwise periodic problems w/ energy eq, we need an additional gradient of Eddy viscosity. ---*/ + if (streamwise_periodic_temperature && turbulent) { + + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < nPoint; iPoint++) { + /*--- Set the auxiliary variable, Eddy viscosity mu_t, for this node. ---*/ + nodes->SetAuxVar(iPoint, 0, nodes->GetEddyViscosity(iPoint)); + } + + /*--- Compute the auxiliary variable gradient with GG or WLS. ---*/ + if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { + SetAuxVar_Gradient_GG(geometry, config); + } + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + SetAuxVar_Gradient_LS(geometry, config); + } + + } // if turbulent + + /*--- Set delta_p, m_dot, inlet_T, integrated_heat ---*/ + numerics->SetStreamwisePeriodicValues(SPvals); + + /*--- Loop over all points ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + + /*--- Load the primitive variables ---*/ + numerics->SetPrimitive(nodes->GetPrimitive(iPoint), nullptr); + + /*--- Set incompressible density ---*/ + numerics->SetDensity(nodes->GetDensity(iPoint), 0.0); + + /*--- Load the volume of the dual mesh cell ---*/ + numerics->SetVolume(geometry->nodes->GetVolume(iPoint)); + + /*--- Load the aux variable gradient that we already computed. ---*/ + if(streamwise_periodic_temperature && turbulent) + numerics->SetAuxVarGrad(nodes->GetAuxVarGradient(iPoint), nullptr); + + /*--- Compute the streamwise periodic source residual and add to the total ---*/ + auto residual = numerics->ComputeResidual(config); + LinSysRes.AddBlock(iPoint, residual); + + /*--- Add the implicit Jacobian contribution ---*/ + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + + } // for iPoint + + if(!streamwise_periodic_temperature && energy) { + + CNumerics* second_numerics = numerics_container[SOURCE_SECOND_TERM + omp_get_thread_num()*MAX_TERMS]; + + /*--- Set delta_p, m_dot, inlet_T, integrated_heat ---*/ + second_numerics->SetStreamwisePeriodicValues(SPvals); + + /*--- This bit acts as a boundary condition rather than a source term. But logically it fits better here. ---*/ + for (auto iMarker = 0ul; iMarker < config->GetnMarker_All(); iMarker++) { + + /*--- Only "inlet"/donor periodic marker ---*/ + if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY && + config->GetMarker_All_PerBound(iMarker) == 1) { + + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) + for (auto iVertex = 0ul; iVertex < nVertex[iMarker]; iVertex++) { + + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (!geometry->nodes->GetDomain(iPoint)) continue; + + /*--- Load the primitive variables ---*/ + second_numerics->SetPrimitive(nodes->GetPrimitive(iPoint), nullptr); + + /*--- Set incompressible density ---*/ + second_numerics->SetDensity(nodes->GetDensity(iPoint), 0.0); + + /*--- Set the specific heat ---*/ + second_numerics->SetSpecificHeat(nodes->GetSpecificHeatCp(iPoint), 0.0); + + /*--- Set the area normal ---*/ + second_numerics->SetNormal(geometry->vertex[iMarker][iVertex]->GetNormal()); + + /*--- Compute the streamwise periodic source residual and add to the total ---*/ + auto residual = second_numerics->ComputeResidual(config); + LinSysRes.AddBlock(iPoint, residual); + + }// for iVertex + }// if periodic inlet boundary + }// for iMarker + + }// if !streamwise_periodic_temperature + }// if streamwise_periodic + /*--- Check if a verification solution is to be computed. ---*/ if (VerificationSolution) { @@ -1687,6 +1600,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont if (config->GetTime_Marching()) time = config->GetPhysicalTime(); /*--- Loop over points ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPointDomain; iPoint++) { /*--- Get control volume size. ---*/ @@ -1724,521 +1638,154 @@ void CIncEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_cont } -void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { +void CIncEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, const CConfig *config) { - su2double Area, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, - Mean_BetaInc2, Lambda, ProjVel, ProjVel_i, ProjVel_j, *GridVel, *GridVel_i, *GridVel_j; - const su2double* Normal; + /*--- Define an object to compute the speed of sound. ---*/ + struct SoundSpeed { + FORCEINLINE su2double operator() (const CIncEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + return sqrt(0.5 * (nodes.GetBetaInc2(iPoint) + nodes.GetBetaInc2(jPoint))); + } - unsigned long iEdge, iVertex, iPoint, jPoint; - unsigned short iDim, iMarker; + FORCEINLINE su2double operator() (const CIncEulerVariable& nodes, unsigned long iPoint) const { + return sqrt(nodes.GetBetaInc2(iPoint)); + } - /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/ + } soundSpeed; - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - nodes->SetLambda(iPoint,0.0); - } + /*--- Instantiate generic implementation. ---*/ - /*--- Loop interior edges ---*/ + SetMax_Eigenvalue_impl(soundSpeed, geometry, config); - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { +} - /*--- Point identification, Normal vector and area ---*/ +void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, const CConfig *config) { - iPoint = geometry->edges->GetNode(iEdge,0); - jPoint = geometry->edges->GetNode(iEdge,1); + /*--- Define an object for the sensor variable, density. ---*/ + struct SensVar { + FORCEINLINE su2double operator() (const CIncEulerVariable& nodes, unsigned long iPoint) const { + return nodes.GetDensity(iPoint); + } + } sensVar; - Normal = geometry->edges->GetNormal(iEdge); - Area = GeometryToolbox::Norm(nDim, Normal); + /*--- Instantiate generic implementation. ---*/ + SetCentered_Dissipation_Sensor_impl(sensVar, geometry, config); - /*--- Mean Values ---*/ +} - Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); - Mean_BetaInc2 = 0.5 * (nodes->GetBetaInc2(iPoint) + nodes->GetBetaInc2(jPoint)); - Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); +template +FORCEINLINE void CIncEulerSolver::Explicit_Iteration(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iRKStep) { + struct Precond { + const CIncEulerSolver* solver; + su2activematrix matrix; + unsigned short nVar; - /*--- Adjustment for grid movement ---*/ + Precond(const CIncEulerSolver* s, unsigned short n) : solver(s), nVar(n) { + matrix.resize(nVar,nVar); + } - if (dynamic_grid) { - GridVel_i = geometry->nodes->GetGridVel(iPoint); - 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); - } - - /*--- Inviscid contribution ---*/ - - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) nodes->AddLambda(iPoint,Lambda); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddLambda(jPoint,Lambda); - - } - - /*--- 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(); - Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - - Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); - Mean_BetaInc2 = nodes->GetBetaInc2(iPoint); - Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); - - /*--- Adjustment for grid movement ---*/ - - if (dynamic_grid) { - GridVel = geometry->nodes->GetGridVel(iPoint); - ProjVel = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - ProjVel += GridVel[iDim]*Normal[iDim]; - Mean_ProjVel -= ProjVel; - } - - /*--- Inviscid contribution ---*/ - - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) { - nodes->AddLambda(iPoint,Lambda); - } - - } - } - } - - /*--- Correct the eigenvalue values across any periodic boundaries. ---*/ - - for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { - InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_MAX_EIG); - CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_MAX_EIG); - } - - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, MAX_EIGENVALUE); - CompleteComms(geometry, config, MAX_EIGENVALUE); - -} - -void CIncEulerSolver::SetUndivided_Laplacian(CGeometry *geometry, CConfig *config) { - - unsigned long iPoint, jPoint, iEdge; - su2double *Diff; - unsigned short iVar; - bool boundary_i, boundary_j; - - Diff = new su2double[nVar]; - - nodes->SetUnd_LaplZero(); - - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { - - iPoint = geometry->edges->GetNode(iEdge,0); - jPoint = geometry->edges->GetNode(iEdge,1); - - /*--- Solution differences ---*/ - - for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = nodes->GetSolution(iPoint,iVar) - nodes->GetSolution(jPoint,iVar); - - boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); - boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); - - /*--- Both points inside the domain, or both in the boundary ---*/ - - if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff); + FORCEINLINE void compute(const CConfig* config, unsigned long iPoint) { + solver->SetPreconditioner(config, iPoint, 1.0, matrix); } - /*--- iPoint inside the domain, jPoint on the boundary ---*/ - - if (!boundary_i && boundary_j) - if (geometry->nodes->GetDomain(iPoint)) nodes->SubtractUnd_Lapl(iPoint,Diff); - - /*--- jPoint inside the domain, iPoint on the boundary ---*/ - - if (boundary_i && !boundary_j) - if (geometry->nodes->GetDomain(jPoint)) nodes->AddUnd_Lapl(jPoint,Diff); - - } - - /*--- Correct the Laplacian values across any periodic boundaries. ---*/ - - for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { - InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN); - CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN); - } - - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); - CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); - - delete [] Diff; - -} - -void CIncEulerSolver::SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfig *config) { - - unsigned long iEdge, iPoint, jPoint; - su2double Pressure_i = 0.0, Pressure_j = 0.0; - bool boundary_i, boundary_j; - - /*--- Reset variables to store the undivided pressure ---*/ - - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - iPoint_UndLapl[iPoint] = 0.0; - jPoint_UndLapl[iPoint] = 0.0; - } - - /*--- Evaluate the pressure sensor ---*/ - - for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) { - - iPoint = geometry->edges->GetNode(iEdge,0); - jPoint = geometry->edges->GetNode(iEdge,1); - - /*--- Get the pressure, or density for incompressible solvers ---*/ - - Pressure_i = nodes->GetDensity(iPoint); - Pressure_j = nodes->GetDensity(jPoint); - - boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); - boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); - - /*--- Both points inside the domain, or both on the boundary ---*/ - - if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) { - - if (geometry->nodes->GetDomain(iPoint)) { - iPoint_UndLapl[iPoint] += (Pressure_j - Pressure_i); - jPoint_UndLapl[iPoint] += (Pressure_i + Pressure_j); - } - - if (geometry->nodes->GetDomain(jPoint)) { - iPoint_UndLapl[jPoint] += (Pressure_i - Pressure_j); - jPoint_UndLapl[jPoint] += (Pressure_i + Pressure_j); - } - + FORCEINLINE su2double apply(unsigned short iVar, const su2double* res, const su2double* resTrunc) const { + su2double resPrec = 0.0; + for (unsigned short jVar = 0; jVar < nVar; ++jVar) + resPrec += matrix(iVar,jVar) * (res[jVar] + resTrunc[jVar]); + return resPrec; } + } precond(this, nVar); - /*--- iPoint inside the domain, jPoint on the boundary ---*/ - - if (!boundary_i && boundary_j) - if (geometry->nodes->GetDomain(iPoint)) { - iPoint_UndLapl[iPoint] += (Pressure_j - Pressure_i); - jPoint_UndLapl[iPoint] += (Pressure_i + Pressure_j); - } - - /*--- jPoint inside the domain, iPoint on the boundary ---*/ - - if (boundary_i && !boundary_j) - if (geometry->nodes->GetDomain(jPoint)) { - iPoint_UndLapl[jPoint] += (Pressure_i - Pressure_j); - jPoint_UndLapl[jPoint] += (Pressure_i + Pressure_j); - } - - } - - /*--- Correct the sensor values across any periodic boundaries. ---*/ - - for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { - InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR); - CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_SENSOR); - } - - /*--- Set pressure switch for each point ---*/ - - for (iPoint = 0; iPoint < nPointDomain; iPoint++) - nodes->SetSensor(iPoint,fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]); - - /*--- MPI parallelization ---*/ - - InitiateComms(geometry, config, SENSOR); - CompleteComms(geometry, config, SENSOR); - + Explicit_Iteration_impl(precond, geometry, solver_container, config, iRKStep); } void CIncEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_container, - CConfig *config, unsigned short iRKStep) { - - su2double *Residual, *Res_TruncError, Vol, Delta, Res; - unsigned short iVar, jVar; - unsigned long iPoint; - - su2double RK_AlphaCoeff = config->Get_Alpha_RKStep(iRKStep); - bool adjoint = config->GetContinuous_Adjoint(); - - for (iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 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; - - Res_TruncError = nodes->GetResTruncError(iPoint); - Residual = LinSysRes.GetBlock(iPoint); - - if (!adjoint) { - SetPreconditioner(config, iPoint); - for (iVar = 0; iVar < nVar; iVar ++ ) { - Res = 0.0; - for (jVar = 0; jVar < nVar; jVar ++ ) - Res += Preconditioner[iVar][jVar]*(Residual[jVar] + Res_TruncError[jVar]); - nodes->AddSolution(iPoint,iVar, -Res*Delta*RK_AlphaCoeff); - AddRes_RMS(iVar, Res*Res); - AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint)); - } - } - } - - /*--- MPI solution ---*/ - - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); - - /*--- Compute the root mean square residual ---*/ - - SetResidual_RMS(geometry, config); + CConfig *config, unsigned short iRKStep) { - /*--- For verification cases, compute the global error metrics. ---*/ + Explicit_Iteration(geometry, solver_container, config, iRKStep); +} - ComputeVerificationError(geometry, config); +void CIncEulerSolver::ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iRKStep) { + Explicit_Iteration(geometry, solver_container, config, iRKStep); } void CIncEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - su2double *local_Residual, *local_Res_TruncError, Vol, Delta, Res; - unsigned short iVar, jVar; - unsigned long iPoint; - - bool adjoint = config->GetContinuous_Adjoint(); - - for (iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 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); - - - if (!adjoint) { - SetPreconditioner(config, iPoint); - for (iVar = 0; iVar < nVar; iVar ++ ) { - Res = 0.0; - for (jVar = 0; jVar < nVar; jVar ++ ) - Res += Preconditioner[iVar][jVar]*(local_Residual[jVar] + local_Res_TruncError[jVar]); - nodes->AddSolution(iPoint,iVar, -Res*Delta); - AddRes_RMS(iVar, Res*Res); - AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint)); - } - } - } - - /*--- MPI solution ---*/ - - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); - - /*--- Compute the root mean square residual ---*/ - - SetResidual_RMS(geometry, config); - - /*--- For verification cases, compute the global error metrics. ---*/ - - ComputeVerificationError(geometry, config); - + Explicit_Iteration(geometry, solver_container, config, 0); } -void CIncEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - - unsigned short iVar, jVar; - unsigned long iPoint, total_index, IterLinSol = 0; - su2double Delta, *local_Res_TruncError, Vol; - - bool adjoint = config->GetContinuous_Adjoint(); - - /*--- Set maximum residual to zero ---*/ - - for (iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 0); - } - - /*--- Build implicit system ---*/ +void CIncEulerSolver::PrepareImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) { - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { + struct IncPrec { + const CIncEulerSolver* solver; + const bool active = true; + su2activematrix matrix; - /*--- Read the residual ---*/ + IncPrec(const CIncEulerSolver* s, unsigned short nVar) : solver(s) { matrix.resize(nVar,nVar); } - local_Res_TruncError = nodes->GetResTruncError(iPoint); - - /*--- Read the volume ---*/ - - Vol = (geometry->nodes->GetVolume(iPoint) + - geometry->nodes->GetPeriodicVolume(iPoint)); - - /*--- Apply the preconditioner and add to the diagonal. ---*/ - - if (nodes->GetDelta_Time(iPoint) != 0.0) { - Delta = Vol / nodes->GetDelta_Time(iPoint); - SetPreconditioner(config, iPoint); - for (iVar = 0; iVar < nVar; iVar ++ ) { - for (jVar = 0; jVar < nVar; jVar ++ ) { - Preconditioner[iVar][jVar] = Delta*Preconditioner[iVar][jVar]; - } - } - Jacobian.AddBlock2Diag(iPoint, Preconditioner); - } 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; - } - } - - /*--- 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; + FORCEINLINE const su2activematrix& operator() (const CConfig* config, unsigned long iPoint, su2double delta) { + solver->SetPreconditioner(config, iPoint, delta, matrix); + return matrix; } - } - - /*--- Solve or smooth the linear system ---*/ - - IterLinSol = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); - - /*--- Store the value of the residual. ---*/ - SetResLinSolver(System.GetResidual()); + } precond(this, nVar); - /*--- The the number of iterations of the linear solver ---*/ - - SetIterLinSolver(IterLinSol); - - /*--- Update solution (system written in terms of increments) ---*/ - - if (!adjoint) { - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - for (iVar = 0; iVar < nVar; iVar++) { - nodes->AddSolution(iPoint, iVar, nodes->GetUnderRelaxation(iPoint)*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); - - /*--- For verification cases, compute the global error metrics. ---*/ + PrepareImplicitIteration_impl(precond, geometry, config); +} - ComputeVerificationError(geometry, config); +void CIncEulerSolver::CompleteImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) { + CompleteImplicitIteration_impl(geometry, config); } void CIncEulerSolver::SetBeta_Parameter(CGeometry *geometry, CSolver **solver_container, - CConfig *config, unsigned short iMesh) { - - su2double epsilon2 = config->GetBeta_Factor(); - su2double epsilon2_default = 4.1; - su2double maxVel2 = 0.0; - su2double Beta = 1.0; - - unsigned long iPoint; + CConfig *config, unsigned short iMesh) { + static su2double MaxVel2; + const su2double epsilon2_default = 4.1; /*--- For now, only the finest mesh level stores the Beta for all levels. ---*/ if (iMesh == MESH_0) { + MaxVel2 = 0.0; + su2double maxVel2 = 0.0; - for (iPoint = 0; iPoint < nPoint; iPoint++) { + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) + maxVel2 = max(maxVel2, nodes->GetVelocity2(iPoint)); - /*--- Store the local maximum of the squared velocity in the field. ---*/ + SU2_OMP_CRITICAL + MaxVel2 = max(MaxVel2, maxVel2); - if (nodes->GetVelocity2(iPoint) > maxVel2) - maxVel2 = nodes->GetVelocity2(iPoint); + SU2_OMP_BARRIER - } - - /*--- Communicate the max globally to give a conservative estimate. ---*/ - -#ifdef HAVE_MPI - su2double myMaxVel2 = maxVel2; maxVel2 = 0.0; - SU2_MPI::Allreduce(&myMaxVel2, &maxVel2, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); -#endif - - Beta = max(1e-10,maxVel2); - config->SetMax_Vel2(Beta); + SU2_OMP_MASTER { + maxVel2 = MaxVel2; + SU2_MPI::Allreduce(&maxVel2, &MaxVel2, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + config->SetMax_Vel2(max(1e-10, MaxVel2)); + } + SU2_OMP_BARRIER } /*--- Allow an override if user supplies a large epsilon^2. ---*/ - epsilon2 = max(epsilon2_default,epsilon2); + su2double BetaInc2 = max(epsilon2_default, config->GetBeta_Factor()) * config->GetMax_Vel2(); - for (iPoint = 0; iPoint < nPoint; iPoint++) - nodes->SetBetaInc2(iPoint,epsilon2*config->GetMax_Vel2()); + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) + nodes->SetBetaInc2(iPoint, BetaInc2); } -void CIncEulerSolver::SetPreconditioner(CConfig *config, unsigned long iPoint) { +void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPoint, + su2double delta, su2activematrix& Preconditioner) const { - unsigned short iDim, jDim; + unsigned short iDim, jDim, iVar, jVar; su2double BetaInc2, Density, dRhodT, Temperature, oneOverCp, Cp; - su2double Velocity[3] = {0.0,0.0,0.0}; + su2double Velocity[MAXNDIM] = {0.0}; bool variable_density = (config->GetKind_DensityModel() == VARIABLE); bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); @@ -2296,6 +1843,10 @@ void CIncEulerSolver::SetPreconditioner(CConfig *config, unsigned long iPoint) { if (energy) Preconditioner[nDim+1][nDim+1] = Cp*(dRhodT*Temperature + Density); else Preconditioner[nDim+1][nDim+1] = 1.0; + for (iVar = 0; iVar < nVar; iVar ++ ) + for (jVar = 0; jVar < nVar; jVar ++ ) + Preconditioner[iVar][jVar] = delta*Preconditioner[iVar][jVar]; + } else { /*--- For explicit calculations, we move the residual to the @@ -2337,132 +1888,126 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain unsigned short iDim; unsigned long iVertex, iPoint, Point_Normal; - su2double *V_infty, *V_domain; + const bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT; + const bool viscous = config->GetViscous(); - bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT; - bool viscous = config->GetViscous(); - - su2double *Normal = new su2double[nDim]; + su2double Normal[MAXNDIM] = {0.0}; /*--- Loop over all the vertices on this boundary marker ---*/ + SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - /*--- Allocate the value at the infinity ---*/ - - V_infty = GetCharacPrimVar(val_marker, iVertex); - /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ - if (geometry->nodes->GetDomain(iPoint)) { - - /*--- Index of the closest interior node ---*/ + if (!geometry->nodes->GetDomain(iPoint)) continue; - Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); + /*--- Allocate the value at the infinity ---*/ - /*--- Normal vector for this vertex (negate for outward convention) ---*/ + auto V_infty = GetCharacPrimVar(val_marker, iVertex); - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); + /*--- Index of the closest interior node ---*/ - /*--- Retrieve solution at the farfield boundary node ---*/ + Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - V_domain = nodes->GetPrimitive(iPoint); + /*--- Normal vector for this vertex (negate for outward convention) ---*/ - /*--- Recompute and store the velocity in the primitive variable vector. ---*/ + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) - V_infty[iDim+1] = GetVelocity_Inf(iDim); + /*--- Retrieve solution at the farfield boundary node ---*/ - /*--- Far-field pressure set to static pressure (0.0). ---*/ + auto V_domain = nodes->GetPrimitive(iPoint); - V_infty[0] = GetPressure_Inf(); + /*--- Recompute and store the velocity in the primitive variable vector. ---*/ - /*--- Dirichlet condition for temperature at far-field (if energy is active). ---*/ + for (iDim = 0; iDim < nDim; iDim++) + V_infty[iDim+1] = GetVelocity_Inf(iDim); - V_infty[nDim+1] = GetTemperature_Inf(); + /*--- Far-field pressure set to static pressure (0.0). ---*/ - /*--- Store the density. ---*/ + V_infty[0] = GetPressure_Inf(); - V_infty[nDim+2] = GetDensity_Inf(); + /*--- Dirichlet condition for temperature at far-field (if energy is active). ---*/ - /*--- Beta coefficient stored at the node ---*/ + V_infty[nDim+1] = GetTemperature_Inf(); - V_infty[nDim+3] = nodes->GetBetaInc2(iPoint); + /*--- Store the density. ---*/ - /*--- Cp is needed for Temperature equation. ---*/ + V_infty[nDim+2] = GetDensity_Inf(); - V_infty[nDim+7] = nodes->GetSpecificHeatCp(iPoint); + /*--- Beta coefficient stored at the node ---*/ - /*--- Set various quantities in the numerics class ---*/ + V_infty[nDim+3] = nodes->GetBetaInc2(iPoint); - conv_numerics->SetPrimitive(V_domain, V_infty); + /*--- Cp is needed for Temperature equation. ---*/ - if (dynamic_grid) - conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), - geometry->nodes->GetGridVel(iPoint)); + V_infty[nDim+7] = nodes->GetSpecificHeatCp(iPoint); - /*--- Compute the convective residual using an upwind scheme ---*/ + /*--- Set various quantities in the numerics class ---*/ - auto residual = conv_numerics->ComputeResidual(config); + conv_numerics->SetPrimitive(V_domain, V_infty); - /*--- Update residual value ---*/ + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), + geometry->nodes->GetGridVel(iPoint)); - LinSysRes.AddBlock(iPoint, residual); + /*--- Compute the convective residual using an upwind scheme ---*/ - /*--- Convective Jacobian contribution for implicit integration ---*/ + auto residual = conv_numerics->ComputeResidual(config); - if (implicit) - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + /*--- Update residual value ---*/ - /*--- Viscous residual contribution ---*/ + LinSysRes.AddBlock(iPoint, residual); - if (viscous) { + /*--- Convective Jacobian contribution for implicit integration ---*/ - /*--- Set transport properties at infinity. ---*/ + if (implicit) + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - V_infty[nDim+4] = nodes->GetLaminarViscosity(iPoint); - V_infty[nDim+5] = nodes->GetEddyViscosity(iPoint); - V_infty[nDim+6] = nodes->GetThermalConductivity(iPoint); + /*--- Viscous residual contribution ---*/ - /*--- Set the normal vector and the coordinates ---*/ + if (!viscous) continue; - visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal)); + /*--- Set transport properties at infinity. ---*/ - /*--- Primitive variables, and gradient ---*/ + V_infty[nDim+4] = nodes->GetLaminarViscosity(iPoint); + V_infty[nDim+5] = nodes->GetEddyViscosity(iPoint); + V_infty[nDim+6] = nodes->GetThermalConductivity(iPoint); - visc_numerics->SetPrimitive(V_domain, V_infty); - visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), - nodes->GetGradient_Primitive(iPoint)); + /*--- Set the normal vector and the coordinates ---*/ - /*--- Turbulent kinetic energy ---*/ + visc_numerics->SetNormal(Normal); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); - if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), - solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); + /*--- Primitive variables, and gradient ---*/ - /*--- Compute and update viscous residual ---*/ + visc_numerics->SetPrimitive(V_domain, V_infty); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); - auto residual = visc_numerics->ComputeResidual(config); - LinSysRes.SubtractBlock(iPoint, residual); + /*--- Turbulent kinetic energy ---*/ - /*--- Viscous Jacobian contribution for implicit integration ---*/ + if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); - if (implicit) - Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + /*--- Compute and update viscous residual ---*/ - } + auto residual_v = visc_numerics->ComputeResidual(config); + LinSysRes.SubtractBlock(iPoint, residual_v); - } - } + /*--- Viscous Jacobian contribution for implicit integration ---*/ - /*--- Free locally allocated memory ---*/ + if (implicit) + Jacobian.SubtractBlock2Diag(iPoint, residual_v.jacobian_i); - delete [] Normal; + } } @@ -2473,248 +2018,237 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, unsigned long Point_Normal; su2double *Flow_Dir, Flow_Dir_Mag, Vel_Mag, Area, P_total, P_domain, Vn; su2double *V_inlet, *V_domain; - su2double UnitFlowDir[3] = {0.0,0.0,0.0}; - su2double dV[3] = {0.0,0.0,0.0}; + su2double UnitFlowDir[MAXNDIM] = {0.0}, dV[MAXNDIM] = {0.0}; su2double Damping = config->GetInc_Inlet_Damping(); - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool viscous = config->GetViscous(); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool viscous = config->GetViscous(); - string Marker_Tag = config->GetMarker_All_TagBound(val_marker); + string Marker_Tag = config->GetMarker_All_TagBound(val_marker); unsigned short Kind_Inlet = config->GetKind_Inc_Inlet(Marker_Tag); - su2double *Normal = new su2double[nDim]; + su2double Normal[MAXNDIM] = {0.0}; /*--- Loop over all the vertices on this boundary marker ---*/ + SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - - /*--- Allocate the value at the inlet ---*/ - - V_inlet = GetCharacPrimVar(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)) { + if (!geometry->nodes->GetDomain(iPoint)) continue; - /*--- Index of the closest interior node ---*/ + /*--- Allocate the value at the inlet ---*/ - Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); + V_inlet = GetCharacPrimVar(val_marker, iVertex); - /*--- Normal vector for this vertex (negate for outward convention) ---*/ + /*--- Index of the closest interior node ---*/ - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); + Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - Area = GeometryToolbox::Norm(nDim, Normal); + /*--- Normal vector for this vertex (negate for outward convention) ---*/ - /*--- Both types of inlets may use the prescribed flow direction. - Ensure that the flow direction is a unit vector. ---*/ + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); - 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); + Area = GeometryToolbox::Norm(nDim, Normal); - /*--- Store the unit flow direction vector. ---*/ + /*--- Both types of inlets may use the prescribed flow direction. + Ensure that the flow direction is a unit vector. ---*/ - for (iDim = 0; iDim < nDim; iDim++) - UnitFlowDir[iDim] = Flow_Dir[iDim]/Flow_Dir_Mag; + Flow_Dir = Inlet_FlowDir[val_marker][iVertex]; + Flow_Dir_Mag = GeometryToolbox::Norm(nDim, Flow_Dir); - /*--- Retrieve solution at this boundary node. ---*/ + /*--- Store the unit flow direction vector. ---*/ - V_domain = nodes->GetPrimitive(iPoint); + for (iDim = 0; iDim < nDim; iDim++) + UnitFlowDir[iDim] = Flow_Dir[iDim]/Flow_Dir_Mag; - /*--- Neumann condition for dynamic pressure ---*/ + /*--- Retrieve solution at this boundary node. ---*/ - V_inlet[0] = nodes->GetPressure(iPoint); + V_domain = nodes->GetPrimitive(iPoint); - /*--- The velocity is either prescribed or computed from total pressure. ---*/ + /*--- Neumann condition for dynamic pressure ---*/ - switch (Kind_Inlet) { + V_inlet[0] = nodes->GetPressure(iPoint); - /*--- Velocity and temperature (if required) been specified at the inlet. ---*/ + /*--- The velocity is either prescribed or computed from total pressure. ---*/ - case VELOCITY_INLET: + switch (Kind_Inlet) { - /*--- Retrieve the specified velocity and temperature for the inlet. ---*/ + /*--- Velocity and temperature (if required) been specified at the inlet. ---*/ - Vel_Mag = Inlet_Ptotal[val_marker][iVertex]/config->GetVelocity_Ref(); + case VELOCITY_INLET: - /*--- Store the velocity in the primitive variable vector. ---*/ + /*--- Retrieve the specified velocity and temperature for the inlet. ---*/ - for (iDim = 0; iDim < nDim; iDim++) - V_inlet[iDim+1] = Vel_Mag*UnitFlowDir[iDim]; + Vel_Mag = Inlet_Ptotal[val_marker][iVertex]/config->GetVelocity_Ref(); - /*--- Dirichlet condition for temperature (if energy is active) ---*/ + /*--- Store the velocity in the primitive variable vector. ---*/ - V_inlet[nDim+1] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); + for (iDim = 0; iDim < nDim; iDim++) + V_inlet[iDim+1] = Vel_Mag*UnitFlowDir[iDim]; - break; + /*--- Dirichlet condition for temperature (if energy is active) ---*/ - /*--- Stagnation pressure has been specified at the inlet. ---*/ + V_inlet[nDim+1] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); - case PRESSURE_INLET: + break; - /*--- Retrieve the specified total pressure for the inlet. ---*/ + /*--- Stagnation pressure has been specified at the inlet. ---*/ - P_total = Inlet_Ptotal[val_marker][iVertex]/config->GetPressure_Ref(); + case PRESSURE_INLET: - /*--- Store the current static pressure for clarity. ---*/ + /*--- Retrieve the specified total pressure for the inlet. ---*/ - P_domain = nodes->GetPressure(iPoint); + P_total = Inlet_Ptotal[val_marker][iVertex]/config->GetPressure_Ref(); - /*--- Check for back flow through the inlet. ---*/ + /*--- Store the current static pressure for clarity. ---*/ - Vn = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Vn += V_domain[iDim+1]*(-1.0*Normal[iDim]/Area); - } + P_domain = nodes->GetPressure(iPoint); - /*--- If the local static pressure is larger than the specified - total pressure or the velocity is directed upstream, we have a - back flow situation. The specified total pressure should be used - as a static pressure condition and the velocity from the domain - is used for the BC. ---*/ + /*--- Check for back flow through the inlet. ---*/ - if ((P_domain > P_total) || (Vn < 0.0)) { + Vn = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Vn += V_domain[iDim+1]*(-1.0*Normal[iDim]/Area); + } - /*--- Back flow: use the prescribed P_total as static pressure. ---*/ + /*--- If the local static pressure is larger than the specified + total pressure or the velocity is directed upstream, we have a + back flow situation. The specified total pressure should be used + as a static pressure condition and the velocity from the domain + is used for the BC. ---*/ - V_inlet[0] = Inlet_Ptotal[val_marker][iVertex]/config->GetPressure_Ref(); + if ((P_domain > P_total) || (Vn < 0.0)) { - /*--- Neumann condition for velocity. ---*/ + /*--- Back flow: use the prescribed P_total as static pressure. ---*/ - for (iDim = 0; iDim < nDim; iDim++) - V_inlet[iDim+1] = V_domain[iDim+1]; + V_inlet[0] = Inlet_Ptotal[val_marker][iVertex]/config->GetPressure_Ref(); - /*--- Neumann condition for the temperature. ---*/ + /*--- Neumann condition for velocity. ---*/ - V_inlet[nDim+1] = nodes->GetTemperature(iPoint); + for (iDim = 0; iDim < nDim; iDim++) + V_inlet[iDim+1] = V_domain[iDim+1]; - } else { + /*--- Neumann condition for the temperature. ---*/ - /*--- Update the velocity magnitude using the total pressure. ---*/ + V_inlet[nDim+1] = nodes->GetTemperature(iPoint); - Vel_Mag = sqrt((P_total - P_domain)/(0.5*nodes->GetDensity(iPoint))); + } else { - /*--- If requested, use the local boundary normal (negative), - instead of the prescribed flow direction in the config. ---*/ + /*--- Update the velocity magnitude using the total pressure. ---*/ - if (config->GetInc_Inlet_UseNormal()) { - for (iDim = 0; iDim < nDim; iDim++) - UnitFlowDir[iDim] = -Normal[iDim]/Area; - } + Vel_Mag = sqrt((P_total - P_domain)/(0.5*nodes->GetDensity(iPoint))); - /*--- Compute the delta change in velocity in each direction. ---*/ + /*--- If requested, use the local boundary normal (negative), + instead of the prescribed flow direction in the config. ---*/ + if (config->GetInc_Inlet_UseNormal()) { for (iDim = 0; iDim < nDim; iDim++) - dV[iDim] = Vel_Mag*UnitFlowDir[iDim] - V_domain[iDim+1]; + UnitFlowDir[iDim] = -Normal[iDim]/Area; + } - /*--- Update the velocity in the primitive variable vector. - Note we use damping here to improve stability/convergence. ---*/ + /*--- Compute the delta change in velocity in each direction. ---*/ - for (iDim = 0; iDim < nDim; iDim++) - V_inlet[iDim+1] = V_domain[iDim+1] + Damping*dV[iDim]; + for (iDim = 0; iDim < nDim; iDim++) + dV[iDim] = Vel_Mag*UnitFlowDir[iDim] - V_domain[iDim+1]; - /*--- Dirichlet condition for temperature (if energy is active) ---*/ + /*--- Update the velocity in the primitive variable vector. + Note we use damping here to improve stability/convergence. ---*/ - V_inlet[nDim+1] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); + for (iDim = 0; iDim < nDim; iDim++) + V_inlet[iDim+1] = V_domain[iDim+1] + Damping*dV[iDim]; - } + /*--- Dirichlet condition for temperature (if energy is active) ---*/ - break; + V_inlet[nDim+1] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); - } + } - /*--- Access density at the node. This is either constant by - construction, or will be set fixed implicitly by the temperature - and equation of state. ---*/ + break; - V_inlet[nDim+2] = nodes->GetDensity(iPoint); + } - /*--- Beta coefficient from the config file ---*/ + /*--- Access density at the node. This is either constant by + construction, or will be set fixed implicitly by the temperature + and equation of state. ---*/ - V_inlet[nDim+3] = nodes->GetBetaInc2(iPoint); + V_inlet[nDim+2] = nodes->GetDensity(iPoint); - /*--- Cp is needed for Temperature equation. ---*/ + /*--- Beta coefficient from the config file ---*/ - V_inlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); + V_inlet[nDim+3] = nodes->GetBetaInc2(iPoint); - /*--- Set various quantities in the solver class ---*/ + /*--- Cp is needed for Temperature equation. ---*/ - conv_numerics->SetPrimitive(V_domain, V_inlet); + V_inlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); - if (dynamic_grid) - conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), - geometry->nodes->GetGridVel(iPoint)); + /*--- Set various quantities in the solver class ---*/ - /*--- Compute the residual using an upwind scheme ---*/ + conv_numerics->SetPrimitive(V_domain, V_inlet); - auto residual = conv_numerics->ComputeResidual(config); + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), + geometry->nodes->GetGridVel(iPoint)); - /*--- Update residual value ---*/ + /*--- Compute the residual using an upwind scheme ---*/ - LinSysRes.AddBlock(iPoint, residual); + auto residual = conv_numerics->ComputeResidual(config); - /*--- Jacobian contribution for implicit integration ---*/ + /*--- Update residual value ---*/ - if (implicit) - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + LinSysRes.AddBlock(iPoint, residual); - /*--- Viscous contribution, commented out because serious convergence problems ---*/ + /*--- Jacobian contribution for implicit integration ---*/ - if (viscous) { + if (implicit) + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - /*--- Set transport properties at the inlet ---*/ + /*--- Viscous contribution, commented out because serious convergence problems ---*/ - V_inlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); - V_inlet[nDim+5] = nodes->GetEddyViscosity(iPoint); - V_inlet[nDim+6] = nodes->GetThermalConductivity(iPoint); + if (!viscous) continue; - /*--- Set the normal vector and the coordinates ---*/ + /*--- Set transport properties at the inlet ---*/ - visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal)); + V_inlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); + V_inlet[nDim+5] = nodes->GetEddyViscosity(iPoint); + V_inlet[nDim+6] = nodes->GetThermalConductivity(iPoint); - /*--- Primitive variables, and gradient ---*/ + /*--- Set the normal vector and the coordinates ---*/ - visc_numerics->SetPrimitive(V_domain, V_inlet); - visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), - nodes->GetGradient_Primitive(iPoint)); + visc_numerics->SetNormal(Normal); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); - /*--- Turbulent kinetic energy ---*/ + /*--- Primitive variables, and gradient ---*/ - if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), - solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); + visc_numerics->SetPrimitive(V_domain, V_inlet); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); - /*--- Compute and update residual ---*/ + /*--- Turbulent kinetic energy ---*/ - auto residual = visc_numerics->ComputeResidual(config); + if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); - LinSysRes.SubtractBlock(iPoint, residual); + /*--- Compute and update residual ---*/ - /*--- Jacobian contribution for implicit integration ---*/ + auto residual_v = visc_numerics->ComputeResidual(config); - if (implicit) - Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + LinSysRes.SubtractBlock(iPoint, residual_v); - } + /*--- Jacobian contribution for implicit integration ---*/ - } + if (implicit) + Jacobian.SubtractBlock2Diag(iPoint, residual_v.jacobian_i); } - - /*--- Free locally allocated memory ---*/ - - delete [] Normal; - } void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, @@ -2725,198 +2259,194 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, su2double mDot_Target, mDot_Old, dP, Density_Avg, Area_Outlet; su2double Damping = config->GetInc_Outlet_Damping(); - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool viscous = config->GetViscous(); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool viscous = config->GetViscous(); string Marker_Tag = config->GetMarker_All_TagBound(val_marker); - su2double *Normal = new su2double[nDim]; + su2double Normal[MAXNDIM] = {0.0}; unsigned short Kind_Outlet = config->GetKind_Inc_Outlet(Marker_Tag); /*--- Loop over all the vertices on this boundary marker ---*/ + SU2_OMP_FOR_DYN(OMP_MIN_SIZE) for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - - /*--- Allocate the value at the outlet ---*/ - - V_outlet = GetCharacPrimVar(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)) { + if (!geometry->nodes->GetDomain(iPoint)) continue; - /*--- Index of the closest interior node ---*/ + /*--- Allocate the value at the outlet ---*/ - Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); + V_outlet = GetCharacPrimVar(val_marker, iVertex); - /*--- Normal vector for this vertex (negate for outward convention) ---*/ + /*--- Index of the closest interior node ---*/ - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); + Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - /*--- Current solution at this boundary node ---*/ + /*--- Normal vector for this vertex (negate for outward convention) ---*/ - V_domain = nodes->GetPrimitive(iPoint); + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); - /*--- Store the current static pressure for clarity. ---*/ + /*--- Current solution at this boundary node ---*/ - P_domain = nodes->GetPressure(iPoint); + V_domain = nodes->GetPrimitive(iPoint); - /*--- Compute a boundary value for the pressure depending on whether - we are prescribing a back pressure or a mass flow target. ---*/ + /*--- Store the current static pressure for clarity. ---*/ - switch (Kind_Outlet) { + P_domain = nodes->GetPressure(iPoint); - /*--- Velocity and temperature (if required) been specified at the inlet. ---*/ + /*--- Compute a boundary value for the pressure depending on whether + we are prescribing a back pressure or a mass flow target. ---*/ - case PRESSURE_OUTLET: + switch (Kind_Outlet) { - /*--- Retrieve the specified back pressure for this outlet. ---*/ + /*--- Velocity and temperature (if required) been specified at the inlet. ---*/ - P_Outlet = config->GetOutlet_Pressure(Marker_Tag)/config->GetPressure_Ref(); + case PRESSURE_OUTLET: - /*--- The pressure is prescribed at the outlet. ---*/ + /*--- Retrieve the specified back pressure for this outlet. ---*/ - V_outlet[0] = P_Outlet; + P_Outlet = config->GetOutlet_Pressure(Marker_Tag)/config->GetPressure_Ref(); - /*--- Neumann condition for the velocity. ---*/ + /*--- The pressure is prescribed at the outlet. ---*/ - for (iDim = 0; iDim < nDim; iDim++) { - V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); - } + V_outlet[0] = P_Outlet; - break; + /*--- Neumann condition for the velocity. ---*/ - /*--- A mass flow target has been specified for the outlet. ---*/ + for (iDim = 0; iDim < nDim; iDim++) { + V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); + } - case MASS_FLOW_OUTLET: + break; - /*--- Retrieve the specified target mass flow at the outlet. ---*/ + /*--- A mass flow target has been specified for the outlet. ---*/ - mDot_Target = config->GetOutlet_Pressure(Marker_Tag)/(config->GetDensity_Ref() * config->GetVelocity_Ref()); + case MASS_FLOW_OUTLET: - /*--- Retrieve the old mass flow, density, and area of the outlet, - which has been computed in a preprocessing step. These values - were stored in non-dim. form in the config container. ---*/ + /*--- Retrieve the specified target mass flow at the outlet. ---*/ - mDot_Old = config->GetOutlet_MassFlow(Marker_Tag); - Density_Avg = config->GetOutlet_Density(Marker_Tag); - Area_Outlet = config->GetOutlet_Area(Marker_Tag); + mDot_Target = config->GetOutlet_Pressure(Marker_Tag)/(config->GetDensity_Ref() * config->GetVelocity_Ref()); - /*--- Compute the pressure increment based on the difference - between the current and target mass flow. Note that increasing - pressure decreases flow speed. ---*/ + /*--- Retrieve the old mass flow, density, and area of the outlet, + which has been computed in a preprocessing step. These values + were stored in non-dim. form in the config container. ---*/ - dP = 0.5*Density_Avg*(mDot_Old*mDot_Old - mDot_Target*mDot_Target)/((Density_Avg*Area_Outlet)*(Density_Avg*Area_Outlet)); + mDot_Old = config->GetOutlet_MassFlow(Marker_Tag); + Density_Avg = config->GetOutlet_Density(Marker_Tag); + Area_Outlet = config->GetOutlet_Area(Marker_Tag); - /*--- Update the new outlet pressure. Note that we use damping - here to improve stability/convergence. ---*/ + /*--- Compute the pressure increment based on the difference + between the current and target mass flow. Note that increasing + pressure decreases flow speed. ---*/ - P_Outlet = P_domain + Damping*dP; + dP = 0.5*Density_Avg*(mDot_Old*mDot_Old - mDot_Target*mDot_Target)/((Density_Avg*Area_Outlet)*(Density_Avg*Area_Outlet)); - /*--- The pressure is prescribed at the outlet. ---*/ + /*--- Update the new outlet pressure. Note that we use damping + here to improve stability/convergence. ---*/ - V_outlet[0] = P_Outlet; + P_Outlet = P_domain + Damping*dP; - /*--- Neumann condition for the velocity ---*/ + /*--- The pressure is prescribed at the outlet. ---*/ - for (iDim = 0; iDim < nDim; iDim++) { - V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); - } + V_outlet[0] = P_Outlet; - break; + /*--- Neumann condition for the velocity ---*/ - } + for (iDim = 0; iDim < nDim; iDim++) { + V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); + } - /*--- Neumann condition for the temperature. ---*/ + break; + + } - V_outlet[nDim+1] = nodes->GetTemperature(iPoint); + /*--- Neumann condition for the temperature. ---*/ - /*--- Access density at the interior node. This is either constant by - construction, or will be set fixed implicitly by the temperature - and equation of state. ---*/ + V_outlet[nDim+1] = nodes->GetTemperature(iPoint); - V_outlet[nDim+2] = nodes->GetDensity(iPoint); + /*--- Access density at the interior node. This is either constant by + construction, or will be set fixed implicitly by the temperature + and equation of state. ---*/ - /*--- Beta coefficient from the config file ---*/ + V_outlet[nDim+2] = nodes->GetDensity(iPoint); - V_outlet[nDim+3] = nodes->GetBetaInc2(iPoint); + /*--- Beta coefficient from the config file ---*/ - /*--- Cp is needed for Temperature equation. ---*/ + V_outlet[nDim+3] = nodes->GetBetaInc2(iPoint); - V_outlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); + /*--- Cp is needed for Temperature equation. ---*/ - /*--- Set various quantities in the solver class ---*/ + V_outlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); - conv_numerics->SetPrimitive(V_domain, V_outlet); + /*--- Set various quantities in the solver class ---*/ - if (dynamic_grid) - conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), - geometry->nodes->GetGridVel(iPoint)); + conv_numerics->SetPrimitive(V_domain, V_outlet); - /*--- Compute the residual using an upwind scheme ---*/ + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), + geometry->nodes->GetGridVel(iPoint)); - auto residual = conv_numerics->ComputeResidual(config); + /*--- Compute the residual using an upwind scheme ---*/ - /*--- Update residual value ---*/ + auto residual = conv_numerics->ComputeResidual(config); - LinSysRes.AddBlock(iPoint, residual); + /*--- Update residual value ---*/ - /*--- Jacobian contribution for implicit integration ---*/ + LinSysRes.AddBlock(iPoint, residual); - if (implicit) { - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - } + /*--- Jacobian contribution for implicit integration ---*/ - /*--- Viscous contribution, commented out because serious convergence problems ---*/ + if (implicit) { + Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + } - if (viscous) { + /*--- Viscous contribution, commented out because serious convergence problems ---*/ - /*--- Set transport properties at the outlet. ---*/ + if (!viscous) continue; - V_outlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); - V_outlet[nDim+5] = nodes->GetEddyViscosity(iPoint); - V_outlet[nDim+6] = nodes->GetThermalConductivity(iPoint); + /*--- Set transport properties at the outlet. ---*/ - /*--- Set the normal vector and the coordinates ---*/ + V_outlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); + V_outlet[nDim+5] = nodes->GetEddyViscosity(iPoint); + V_outlet[nDim+6] = nodes->GetThermalConductivity(iPoint); - visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal)); + /*--- Set the normal vector and the coordinates ---*/ - /*--- Primitive variables, and gradient ---*/ + visc_numerics->SetNormal(Normal); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); - visc_numerics->SetPrimitive(V_domain, V_outlet); - visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), - nodes->GetGradient_Primitive(iPoint)); + /*--- Primitive variables, and gradient ---*/ - /*--- Turbulent kinetic energy ---*/ + visc_numerics->SetPrimitive(V_domain, V_outlet); + visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), + nodes->GetGradient_Primitive(iPoint)); - if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) - visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), - solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); + /*--- Turbulent kinetic energy ---*/ - /*--- Compute and update residual ---*/ + if ((config->GetKind_Turb_Model() == SST) || (config->GetKind_Turb_Model() == SST_SUST)) + visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0), + solver_container[TURB_SOL]->GetNodes()->GetSolution(iPoint,0)); - auto residual = visc_numerics->ComputeResidual(config); + /*--- Compute and update residual ---*/ - LinSysRes.SubtractBlock(iPoint, residual); + auto residual_v = visc_numerics->ComputeResidual(config); - /*--- Jacobian contribution for implicit integration ---*/ - if (implicit) - Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + LinSysRes.SubtractBlock(iPoint, residual_v); - } + /*--- Jacobian contribution for implicit integration ---*/ + if (implicit) + Jacobian.SubtractBlock2Diag(iPoint, residual_v.jacobian_i); - } } - /*--- Free locally allocated memory ---*/ - delete [] Normal; - } void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, @@ -2924,18 +2454,26 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver /*--- Local variables ---*/ - unsigned short iVar, jVar, iMarker, iDim; + unsigned short iVar, iMarker, iDim, iNeigh; unsigned long iPoint, jPoint, iEdge, iVertex; - su2double Density, Cp; - su2double *V_time_nM1, *V_time_n, *V_time_nP1; - su2double U_time_nM1[5], U_time_n[5], U_time_nP1[5]; + const su2double *V_time_nM1 = nullptr, *V_time_n = nullptr, *V_time_nP1 = nullptr; + su2double U_time_nM1[MAXNVAR], U_time_n[MAXNVAR], U_time_nP1[MAXNVAR]; su2double Volume_nM1, Volume_nP1, TimeStep; - su2double *GridVel_i = nullptr, *GridVel_j = nullptr, Residual_GCL; - const su2double* Normal; + const su2double *Normal = nullptr, *GridVel_i = nullptr, *GridVel_j = nullptr; + su2double Density, Cp; - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool energy = config->GetEnergy_Equation(); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool first_order = (config->GetTime_Marching() == DT_STEPPING_1ST); + const bool second_order = (config->GetTime_Marching() == DT_STEPPING_2ND); + const bool energy = config->GetEnergy_Equation(); + + const int ndim = nDim; + auto V2U = [ndim](su2double Density, su2double Cp, const su2double* V, su2double* U) { + U[0] = Density; + for (int iDim = 0; iDim < ndim; iDim++) U[iDim+1] = Density*V[iDim+1]; + U[ndim+1] = Density*Cp*V[ndim+1]; + }; /*--- Store the physical time step ---*/ @@ -2947,18 +2485,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver /*--- Loop over all nodes (excluding halos) ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) 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. These are actually @@ -2970,24 +2499,14 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver /*--- Access the density and Cp at this node (constant for now). ---*/ - Density = nodes->GetDensity(iPoint); - Cp = nodes->GetSpecificHeatCp(iPoint); + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); /*--- Compute the conservative variable vector for all time levels. ---*/ - U_time_nM1[0] = Density; - U_time_n[0] = Density; - U_time_nP1[0] = Density; - - for (iDim = 0; iDim < nDim; iDim++) { - U_time_nM1[iDim+1] = Density*V_time_nM1[iDim+1]; - U_time_n[iDim+1] = Density*V_time_n[iDim+1]; - U_time_nP1[iDim+1] = Density*V_time_nP1[iDim+1]; - } - - U_time_nM1[nDim+1] = Density*Cp*V_time_nM1[nDim+1]; - U_time_n[nDim+1] = Density*Cp*V_time_n[nDim+1]; - U_time_nP1[nDim+1] = Density*Cp*V_time_nP1[nDim+1]; + V2U(Density, Cp, V_time_nM1, U_time_nM1); + V2U(Density, Cp, V_time_n, U_time_n); + V2U(Density, Cp, V_time_nP1, U_time_nP1); /*--- 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. ---*/ @@ -2995,41 +2514,28 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver Volume_nP1 = geometry->nodes->GetVolume(iPoint); /*--- Compute the dual time-stepping source term based on the chosen - time discretization scheme (1st- or 2nd-order). Note that for an - incompressible problem, the pressure equation does not have a - contribution, as the time derivative should always be zero. ---*/ - - 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); - } - - if (!energy) Residual[nDim+1] = 0.0; + time discretization scheme (1st- or 2nd-order).---*/ - /*--- Store the residual and compute the Jacobian contribution due - to the dual time source term. ---*/ + for (iVar = 0; iVar < nVar-!energy; iVar++) { + if (first_order) + LinSysRes(iPoint,iVar) += (U_time_nP1[iVar] - U_time_n[iVar])*Volume_nP1 / TimeStep; + if (second_order) + LinSysRes(iPoint,iVar) += ( 3.0*U_time_nP1[iVar] - 4.0*U_time_n[iVar] + +1.0*U_time_nM1[iVar])*Volume_nP1 / (2.0*TimeStep); + } - LinSysRes.AddBlock(iPoint, Residual); + /*--- Compute the Jacobian contribution due to the dual time source term. ---*/ 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); - } + su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / 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.AddVal2Diag(iPoint, iDim+1, delta); - Jacobian.AddBlock2Diag(iPoint, Jacobian_i); + if (energy) delta *= Cp; + Jacobian.AddVal2Diag(iPoint, nDim+1, delta); } - } - } else { @@ -3042,141 +2548,86 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver 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. ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) + for (iPoint = 0; iPoint < nPointDomain; ++iPoint) { - 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 ---*/ + /*--- Compute the conservative variables. ---*/ V_time_n = nodes->GetSolution_time_n(iPoint); + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); + V2U(Density, Cp, V_time_n, U_time_n); - /*--- Access the density and Cp at this node (constant for now). ---*/ + GridVel_i = geometry->nodes->GetGridVel(iPoint); - Density = nodes->GetDensity(iPoint); - Cp = nodes->GetSpecificHeatCp(iPoint); + for (iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); iNeigh++) { - /*--- Compute the conservative variable vector for all time levels. ---*/ - - U_time_n[0] = Density; - for (iDim = 0; iDim < nDim; iDim++) { - U_time_n[iDim+1] = Density*V_time_n[iDim+1]; - } - U_time_n[nDim+1] = Density*Cp*V_time_n[nDim+1]; + iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); + Normal = geometry->edges->GetNormal(iEdge); - for (iVar = 0; iVar < nVar; iVar++) - Residual[iVar] = U_time_n[iVar]*Residual_GCL; + jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); + GridVel_j = geometry->nodes->GetGridVel(jPoint); - if (!energy) Residual[nDim+1] = 0.0; - LinSysRes.AddBlock(iPoint, Residual); + /*--- Determine whether to consider the normal outward or inward. ---*/ + su2double dir = (iPoint < jPoint)? 0.5 : -0.5; - /*--- Compute the GCL component of the source term for node j ---*/ - - V_time_n = nodes->GetSolution_time_n(jPoint); + su2double Residual_GCL = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Residual_GCL += dir*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim]; - U_time_n[0] = Density; - for (iDim = 0; iDim < nDim; iDim++) { - U_time_n[iDim+1] = Density*V_time_n[iDim+1]; + for (iVar = 0; iVar < nVar-!energy; iVar++) + LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL; } - U_time_n[nDim+1] = Density*Cp*V_time_n[nDim+1]; - - for (iVar = 0; iVar < nVar; iVar++) - Residual[iVar] = U_time_n[iVar]*Residual_GCL; - - if (!energy) Residual[nDim+1] = 0.0; - LinSysRes.SubtractBlock(jPoint, Residual); - } - /*--- Loop over the boundary edges ---*/ + /*--- Loop over the boundary edges ---*/ for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && + 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. ---*/ + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) + for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { - for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0; + /*--- Get the index for node i plus the boundary face normal ---*/ - /*--- 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 ---*/ + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - GridVel_i = geometry->nodes->GetGridVel(iPoint); + /*--- Grid velocities stored at boundary node i ---*/ - /*--- Compute the GCL term by dotting the grid velocity with the face - normal. The normal is negated to match the boundary convention. ---*/ + GridVel_i = geometry->nodes->GetGridVel(iPoint); - 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 term by dotting the grid velocity with the face + normal. The normal is negated to match the boundary convention. ---*/ - /*--- Compute the GCL component of the source term for node i ---*/ - - V_time_n = nodes->GetSolution_time_n(iPoint); + su2double Residual_GCL = 0.0; + for (iDim = 0; iDim < nDim; iDim++) + Residual_GCL -= 0.5*(GridVel_i[iDim]+GridVel_i[iDim])*Normal[iDim]; - /*--- Access the density and Cp at this node (constant for now). ---*/ + /*--- Compute the GCL component of the source term for node i ---*/ - Density = nodes->GetDensity(iPoint); - Cp = nodes->GetSpecificHeatCp(iPoint); + V_time_n = nodes->GetSolution_time_n(iPoint); + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); + V2U(Density, Cp, V_time_n, U_time_n); - U_time_n[0] = Density; - for (iDim = 0; iDim < nDim; iDim++) { - U_time_n[iDim+1] = Density*V_time_n[iDim+1]; + for (iVar = 0; iVar < nVar-!energy; iVar++) + LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL; } - U_time_n[nDim+1] = Density*Cp*V_time_n[nDim+1]; - - for (iVar = 0; iVar < nVar; iVar++) - Residual[iVar] = U_time_n[iVar]*Residual_GCL; - - if (!energy) Residual[nDim+1] = 0.0; - LinSysRes.AddBlock(iPoint, Residual); - - } } } /*--- Loop over all nodes (excluding halos) to compute the remainder of the dual time-stepping source term. ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) 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. ---*/ + previous solutions that are stored in memory. These are actually + the primitive values, but we will convert to conservatives. ---*/ V_time_nM1 = nodes->GetSolution_time_n1(iPoint); V_time_n = nodes->GetSolution_time_n(iPoint); @@ -3184,24 +2635,14 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver /*--- Access the density and Cp at this node (constant for now). ---*/ - Density = nodes->GetDensity(iPoint); - Cp = nodes->GetSpecificHeatCp(iPoint); + Density = nodes->GetDensity(iPoint); + Cp = nodes->GetSpecificHeatCp(iPoint); /*--- Compute the conservative variable vector for all time levels. ---*/ - U_time_nM1[0] = Density; - U_time_n[0] = Density; - U_time_nP1[0] = Density; - - for (iDim = 0; iDim < nDim; iDim++) { - U_time_nM1[iDim+1] = Density*V_time_nM1[iDim+1]; - U_time_n[iDim+1] = Density*V_time_n[iDim+1]; - U_time_nP1[iDim+1] = Density*V_time_nP1[iDim+1]; - } - - U_time_nM1[nDim+1] = Density*Cp*V_time_nM1[nDim+1]; - U_time_n[nDim+1] = Density*Cp*V_time_n[nDim+1]; - U_time_nP1[nDim+1] = Density*Cp*V_time_nP1[nDim+1]; + V2U(Density, Cp, V_time_nM1, U_time_nM1); + V2U(Density, Cp, V_time_n, U_time_n); + V2U(Density, Cp, V_time_nP1, U_time_nP1); /*--- 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 @@ -3214,33 +2655,25 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver 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)); + for (iVar = 0; iVar < nVar-!energy; iVar++) { + if (first_order) + LinSysRes(iPoint,iVar) += (U_time_nP1[iVar] - U_time_n[iVar])*(Volume_nP1/TimeStep); + if (second_order) + LinSysRes(iPoint,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. ---*/ - if (!energy) Residual[nDim+1] = 0.0; - LinSysRes.AddBlock(iPoint, Residual); + /*--- Compute the Jacobian contribution due to the dual time source term. ---*/ 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); - } + su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / 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.AddVal2Diag(iPoint, iDim+1, delta); - Jacobian.AddBlock2Diag(iPoint, Jacobian_i); + if (energy) delta *= Cp; + Jacobian.AddVal2Diag(iPoint, nDim+1, delta); } - } } @@ -3254,6 +2687,7 @@ void CIncEulerSolver::GetOutlet_Properties(CGeometry *geometry, CConfig *config, Velocity2, Density, Area, AxiFactor; unsigned short iMarker_Outlet, nMarker_Outlet; string Inlet_TagBound, Outlet_TagBound; + su2double Vector[MAXNDIM] = {0.0}; bool axisymmetric = config->GetAxisymmetric(); @@ -3372,21 +2806,9 @@ void CIncEulerSolver::GetOutlet_Properties(CGeometry *geometry, CConfig *config, /*--- All the ranks to compute the total value ---*/ -#ifdef HAVE_MPI - - SU2_MPI::Allreduce(Outlet_MassFlow_Local, Outlet_MassFlow_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Density_Local, Outlet_Density_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Area_Local, Outlet_Area_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - -#else - - for (iMarker_Outlet = 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++) { - Outlet_MassFlow_Total[iMarker_Outlet] = Outlet_MassFlow_Local[iMarker_Outlet]; - Outlet_Density_Total[iMarker_Outlet] = Outlet_Density_Local[iMarker_Outlet]; - Outlet_Area_Total[iMarker_Outlet] = Outlet_Area_Local[iMarker_Outlet]; - } - -#endif + SU2_MPI::Allreduce(Outlet_MassFlow_Local, Outlet_MassFlow_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Density_Local, Outlet_Density_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Area_Local, Outlet_Area_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); for (iMarker_Outlet = 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++) { if (Outlet_Area_Total[iMarker_Outlet] != 0.0) { @@ -3502,219 +2924,29 @@ void CIncEulerSolver::PrintVerificationError(const CConfig *config) const { void CIncEulerSolver::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 static_fsi = ((config->GetTime_Marching() == STEADY) && config->GetFSI_Simulation()); - bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - bool steady_restart = config->GetSteadyRestart(); - 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; - - /*--- 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; - } - /*--- Adjust the number of solution variables in the restart. We always carry a space in nVar for the energy equation in the solver, but we only write it to the restart if it is active. Therefore, we must reduce nVar here if energy is inactive so that the restart is read correctly. ---*/ - bool energy = config->GetEnergy_Equation(); - bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); + bool energy = config->GetEnergy_Equation(); + bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat(); unsigned short nVar_Restart = nVar; - if ((!energy) && (!weakly_coupled_heat)) nVar_Restart--; + if (!(energy || weakly_coupled_heat)) nVar_Restart--; + su2double Solution[MAXNVAR] = {0.0}; Solution[nVar-1] = GetTemperature_Inf(); - /*--- 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. ---*/ - - index = counter*Restart_Vars[1] + skipVars; - for (iVar = 0; iVar < nVar_Restart; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - nodes->SetSolution(iPoint_Local,Solution); - iPoint_Global_Local++; - - /*--- For dynamic meshes, read in and store the - grid coordinates and grid velocities for each node. ---*/ - - if (dynamic_grid && val_update_geo) { - - /*--- 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 ---*/ - - /*--- Rewind the index to retrieve the Coords. ---*/ - index = counter*Restart_Vars[1]; - for (iDim = 0; iDim < nDim; iDim++) { Coord[iDim] = Restart_Data[index+iDim]; } - - su2double GridVel[3] = {0.0,0.0,0.0}; - if (!steady_restart) { - /*--- 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]); - } - } - - /*--- For static FSI problems, grid_movement is 0 but we need to read in and store the - grid coordinates for each node (but not the grid velocities, as there are none). ---*/ - - if (static_fsi && val_update_geo) { - /*--- Rewind the index to retrieve the Coords. ---*/ - index = counter*Restart_Vars[1]; - for (iDim = 0; iDim < nDim; iDim++) { Coord[iDim] = Restart_Data[index+iDim];} - - for (iDim = 0; iDim < nDim; iDim++) { - geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[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 || static_fsi) && val_update_geo) { - - /*--- 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]->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); - - /*--- 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); - - 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; + LoadRestart_impl(geometry, solver, config, val_iter, val_update_geo, Solution, nVar_Restart); } -void CIncEulerSolver::SetFreeStream_Solution(CConfig *config){ +void CIncEulerSolver::SetFreeStream_Solution(const CConfig *config){ unsigned long iPoint; unsigned short iDim; + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPoint; iPoint++){ nodes->SetSolution(iPoint,0, Pressure_Inf); for (iDim = 0; iDim < nDim; iDim++){ diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 976da459e9e3..2eb8acbd6799 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -2,7 +2,7 @@ * \file CIncNSSolver.cpp * \brief Main subroutines for solving Navier-Stokes incompressible flow. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -54,35 +54,30 @@ CIncNSSolver::CIncNSSolver(CGeometry *geometry, CConfig *config, unsigned short } } -void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { +void CIncNSSolver::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; + const auto InnerIter = config->GetInnerIter(); + const bool muscl = config->GetMUSCL_Flow() && (iMesh == MESH_0); + const bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED); + const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); + const bool van_albada = (config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE); - unsigned long InnerIter = config->GetInnerIter(); - bool cont_adjoint = config->GetContinuous_Adjoint(); - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool center = ((config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED)); - bool center_jst = center && config->GetKind_Centered_Flow() == JST; - 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 limiter_adjflow = (cont_adjoint && (config->GetKind_SlopeLimit_AdjFlow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter())); - bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; - bool outlet = ((config->GetnMarker_Outlet() != 0)); + /*--- Common preprocessing steps (implemented by CEulerSolver) ---*/ - /*--- Set the primitive variables ---*/ + CommonPreprocessing(geometry, solver_container, config, iMesh, iRKStep, RunTime_EqSystem, Output); - ErrorCounter = SetPrimitive_Variables(solver_container, config, Output); + /*--- Compute gradient for MUSCL reconstruction ---*/ - /*--- 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); + if (config->GetReconstructionGradientRequired() && muscl && !center) { + switch (config->GetKind_Gradient_Method_Recon()) { + case GREEN_GAUSS: + SetPrimitive_Gradient_GG(geometry, config, true); break; + case LEAST_SQUARES: + case WEIGHTED_LEAST_SQUARES: + SetPrimitive_Gradient_LS(geometry, config, true); break; + default: break; + } } /*--- Compute gradient of the primitive variables ---*/ @@ -90,84 +85,233 @@ void CIncNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { SetPrimitive_Gradient_GG(geometry, config); } - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + else if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { SetPrimitive_Gradient_LS(geometry, config); } - /*--- 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) ---*/ + /*--- Compute the limiters ---*/ - if ((iMesh == MESH_0) && (limiter_flow || limiter_turb || limiter_adjflow) - && !Output && !van_albada) { SetPrimitive_Limiter(geometry, config); } + if (muscl && !center && limiter && !van_albada && !Output) { + SetPrimitive_Limiter(geometry, config); + } - /*--- Artificial dissipation for centered schemes. ---*/ + ComputeVorticityAndStrainMag<1>(*config, iMesh); - if (center && !Output) { - SetMax_Eigenvalue(geometry, config); - if ((center_jst) && (iMesh == MESH_0)) { - SetCentered_Dissipation_Sensor(geometry, config); - SetUndivided_Laplacian(geometry, config); - } + /*--- Compute recovered pressure and temperature for streamwise periodic flow ---*/ + if (config->GetKind_Streamwise_Periodic() != NONE) + Compute_Streamwise_Periodic_Recovered_Values(config, geometry, iMesh); +} + +void CIncNSSolver::GetStreamwise_Periodic_Properties(const CGeometry *geometry, + CConfig *config, + const unsigned short iMesh) { + + /*---------------------------------------------------------------------------------------------*/ + // 1. Evaluate massflow, area avg density & Temperature and Area at streamwise periodic outlet. + // 2. Update delta_p is target massflow is chosen. + // 3. Loop Heatflux markers and integrate heat across the boundary. Only if energy equation is on. + /*---------------------------------------------------------------------------------------------*/ + + /*-------------------------------------------------------------------------------------------------*/ + /*--- 1. Evaluate Massflow [kg/s], area-averaged density [kg/m^3] and Area [m^2] at the ---*/ + /*--- (there can be only one) streamwise periodic outlet/donor marker. Massflow is obviously ---*/ + /*--- needed for prescribed massflow but also for the additional source and heatflux ---*/ + /*--- boundary terms of the energy equation. Area and the avg-density are used for the ---*/ + /*--- Pressure-Drop update in case of a prescribed massflow. ---*/ + /*-------------------------------------------------------------------------------------------------*/ + + const auto nZone = geometry->GetnZone(); + const auto InnerIter = config->GetInnerIter(); + const auto OuterIter = config->GetOuterIter(); + + su2double Area_Local = 0.0, + MassFlow_Local = 0.0, + Average_Density_Local = 0.0, + Temperature_Local = 0.0; + + for (auto iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + + /*--- Only "outlet"/donor periodic marker ---*/ + if (config->GetMarker_All_KindBC(iMarker) == PERIODIC_BOUNDARY && + config->GetMarker_All_PerBound(iMarker) == 2) { + + for (auto iVertex = 0ul; iVertex < geometry->nVertex[iMarker]; iVertex++) { + + auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (geometry->nodes->GetDomain(iPoint)) { + + /*--- A = dot_prod(n_A*n_A), with n_A beeing the area-normal. ---*/ + + const auto AreaNormal = geometry->vertex[iMarker][iVertex]->GetNormal(); + + auto FaceArea = GeometryToolbox::Norm(nDim, AreaNormal); + + /*--- m_dot = dot_prod(n*v) * A * rho, with n beeing unit normal. ---*/ + MassFlow_Local += nodes->GetProjVel(iPoint, AreaNormal) * nodes->GetDensity(iPoint); + + Area_Local += FaceArea; + + Average_Density_Local += FaceArea * nodes->GetDensity(iPoint); + + /*--- Due to periodicty, temperatures are equal one the inlet(1) and outlet(2) ---*/ + Temperature_Local += FaceArea * nodes->GetTemperature(iPoint); + + } // if domain + } // loop vertices + } // loop periodic boundaries + } // loop MarkerAll + + // MPI Communication: Sum Area, Sum rho*A & T*A and divide by AreaGlobbal, sum massflow + su2double Area_Global(0), Average_Density_Global(0), MassFlow_Global(0), Temperature_Global(0); + SU2_MPI::Allreduce(&Area_Local, &Area_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Average_Density_Local, &Average_Density_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MassFlow_Local, &MassFlow_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Temperature_Local, &Temperature_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + + Average_Density_Global /= Area_Global; + Temperature_Global /= Area_Global; + + /*--- Set solver variables ---*/ + SPvals.Streamwise_Periodic_MassFlow = MassFlow_Global; + SPvals.Streamwise_Periodic_InletTemperature = Temperature_Global; + + /*--- As deltaP changes with prescribed massflow the const config value should only be used once. ---*/ + if((nZone==1 && InnerIter==0) || + (nZone>1 && OuterIter==0 && InnerIter==0)) { + SPvals.Streamwise_Periodic_PressureDrop = config->GetStreamwise_Periodic_PressureDrop() / config->GetPressure_Ref(); } - /*--- Update the beta value based on the maximum velocity / viscosity. ---*/ + if (config->GetKind_Streamwise_Periodic() == STREAMWISE_MASSFLOW) { + /*------------------------------------------------------------------------------------------------*/ + /*--- 2. Update the Pressure Drop [Pa] for the Momentum source term if Massflow is prescribed. ---*/ + /*--- The Pressure drop is iteratively adapted to result in the prescribed Target-Massflow. ---*/ + /*------------------------------------------------------------------------------------------------*/ + + /*--- Load/define all necessary variables ---*/ + const su2double TargetMassFlow = config->GetStreamwise_Periodic_TargetMassFlow() / (config->GetDensity_Ref() * config->GetVelocity_Ref()); + const su2double damping_factor = config->GetInc_Outlet_Damping(); + su2double Pressure_Drop_new, ddP; + + /*--- Compute update to Delta p based on massflow-difference ---*/ + ddP = 0.5 / ( Average_Density_Global * pow(Area_Global, 2)) * (pow(TargetMassFlow, 2) - pow(MassFlow_Global, 2)); + + /*--- Store updated pressure difference ---*/ + Pressure_Drop_new = SPvals.Streamwise_Periodic_PressureDrop + damping_factor*ddP; + /*--- During restarts, this routine GetStreamwise_Periodic_Properties can get called multiple times + (e.g. 4x for INC_RANS restart). Each time, the pressure drop gets updated. For INC_RANS restarts + it gets called 2x before the restart files are read such that the current massflow is + Area*inital-velocity which can be way off! + With this there is still a slight inconsitency wrt to a non-restarted simulation: The restarted "zero-th" + iteration does not get a pressure-update but the continuing simulation would have an update here. This can be + fully neglected if the pressure drop is converged. And for all other cases it should be minor difference at + best ---*/ + if((nZone==1 && InnerIter>0) || + (nZone>1 && OuterIter>0)) { + SPvals.Streamwise_Periodic_PressureDrop = Pressure_Drop_new; + } - SetBeta_Parameter(geometry, solver_container, config, iMesh); + } // if massflow - /*--- Compute properties needed for mass flow BCs. ---*/ - if (outlet) GetOutlet_Properties(geometry, config, iMesh, Output); + if (config->GetEnergy_Equation()) { + /*---------------------------------------------------------------------------------------------*/ + /*--- 3. Compute the integrated Heatflow [W] for the energy equation source term, heatflux ---*/ + /*--- boundary term and recovered Temperature. The computation is not completely clear. ---*/ + /*--- Here the Heatflux from all Bounary markers in the config-file is used. ---*/ + /*---------------------------------------------------------------------------------------------*/ - /*--- Evaluate the vorticity and strain rate magnitude ---*/ + su2double HeatFlow_Local = 0.0, HeatFlow_Global = 0.0; - nodes->SetVorticity_StrainMag(); + /*--- Loop over all heatflux Markers ---*/ + for (auto iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - StrainMag_Max = 0.0; Omega_Max = 0.0; - for (iPoint = 0; iPoint < nPoint; iPoint++) { + if (config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) { - StrainMag = nodes->GetStrainMag(iPoint); - Vorticity = nodes->GetVorticity(iPoint); - Omega = sqrt(Vorticity[0]*Vorticity[0]+ Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]); + /*--- Identify the boundary by string name and retrive heatflux from config ---*/ + const auto Marker_StringTag = config->GetMarker_All_TagBound(iMarker); + const auto Wall_HeatFlux = config->GetWall_HeatFlux(Marker_StringTag); - StrainMag_Max = max(StrainMag_Max, StrainMag); - Omega_Max = max(Omega_Max, Omega); + for (auto iVertex = 0ul; iVertex < geometry->nVertex[iMarker]; iVertex++) { - } + auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + if (!geometry->nodes->GetDomain(iPoint)) continue; - /*--- Initialize the Jacobian matrices ---*/ + const auto AreaNormal = geometry->vertex[iMarker][iVertex]->GetNormal(); - if (implicit && !Output) Jacobian.SetValZero(); + auto FaceArea = GeometryToolbox::Norm(nDim, AreaNormal); - /*--- Error message ---*/ + HeatFlow_Local += FaceArea * (-1.0) * Wall_HeatFlux/config->GetHeat_Flux_Ref();; + } // loop Vertices + } // loop Heatflux marker + } // loop AllMarker - if (config->GetComm_Level() == COMM_FULL) { + /*--- MPI Communication sum up integrated Heatflux from all processes ---*/ + SU2_MPI::Allreduce(&HeatFlow_Local, &HeatFlow_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); -#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; + /*--- Set the solver variable Integrated Heatflux ---*/ + SPvals.Streamwise_Periodic_IntegratedHeatFlow = HeatFlow_Global; + } // if energy +} - 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); +void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config, const CGeometry *geometry, + const unsigned short iMesh) { - } + const bool energy = (config->GetEnergy_Equation() && config->GetStreamwise_Periodic_Temperature()); + const auto InnerIter = config->GetInnerIter(); + + /*--- Reference node on inlet periodic marker to compute relative distance along periodic translation vector. ---*/ + const su2double* ReferenceNode = geometry->GetStreamwise_Periodic_RefNode(); + /*--- Compute square of the distance between the 2 periodic surfaces. ---*/ + const su2double norm2_translation = GeometryToolbox::SquaredNorm(nDim, config->GetPeriodic_Translation(0)); + + /*--- Compute recoverd pressure and temperature for all points ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { + + /*--- First, compute helping terms based on relative distance (0,l) between periodic markers ---*/ + su2double dot_product = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) + dot_product += fabs( (geometry->nodes->GetCoord(iPoint,iDim) - ReferenceNode[iDim]) * config->GetPeriodic_Translation(0)[iDim]); + + /*--- Second, substract/add correction from reduced pressure/temperature to get recoverd pressure/temperature ---*/ + const su2double Pressure_Recovered = nodes->GetPressure(iPoint) - SPvals.Streamwise_Periodic_PressureDrop / + norm2_translation * dot_product; + nodes->SetStreamwise_Periodic_RecoveredPressure(iPoint, Pressure_Recovered); + + /*--- InnerIter > 0 as otherwise MassFlow in the denominator would be zero ---*/ + if (energy && InnerIter > 0) { + su2double Temperature_Recovered = nodes->GetTemperature(iPoint); + Temperature_Recovered += SPvals.Streamwise_Periodic_IntegratedHeatFlow / + (SPvals.Streamwise_Periodic_MassFlow * nodes->GetSpecificHeatCp(iPoint) * norm2_translation) * dot_product; + nodes->SetStreamwise_Periodic_RecoveredTemperature(iPoint, Temperature_Recovered); + } + } // for iPoint + + /*--- Compute the integrated Heatflux Q into the domain, and massflow over periodic markers ---*/ + SU2_OMP_MASTER + GetStreamwise_Periodic_Properties(geometry, config, iMesh); + SU2_OMP_BARRIER } -unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) { +void CIncNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, + CNumerics *numerics, CConfig *config) { + + Viscous_Residual_impl(iEdge, geometry, solver_container, numerics, config); +} + +unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, const CConfig *config) { 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)); + SU2_OMP_FOR_STAT(omp_chunk_size) for (iPoint = 0; iPoint < nPoint; iPoint++) { /*--- Retrieve the value of the kinetic energy (if needed) ---*/ @@ -183,7 +327,7 @@ unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, C /*--- Incompressible flow, primitive variables --- */ - physical = static_cast(nodes)->SetPrimVar(iPoint,eddy_visc, turb_ke, FluidModel); + bool physical = static_cast(nodes)->SetPrimVar(iPoint,eddy_visc, turb_ke, GetFluidModel()); /* Check for non-realizable states for reporting. */ @@ -193,668 +337,252 @@ unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, C nodes->SetDES_LengthScale(iPoint,DES_LengthScale); - /*--- Initialize the convective, source and viscous residual vector ---*/ - - if (!Output) LinSysRes.SetBlock_Zero(iPoint); - } return nonPhysicalPoints; } -void CIncNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) { - - su2double Mean_BetaInc2, Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, Lambda, Local_Delta_Time, Local_Delta_Time_Visc, - Global_Delta_Time = 1E6, Mean_LaminarVisc = 0.0, Mean_EddyVisc = 0.0, Mean_Density = 0.0, Mean_Thermal_Conductivity = 0.0, Mean_Cv = 0.0, Lambda_1, Lambda_2, K_v = 0.25, Global_Delta_UnstTimeND; - unsigned long iEdge, iVertex, iPoint = 0, jPoint = 0; - unsigned short iDim, iMarker; - su2double ProjVel, ProjVel_i, ProjVel_j; - const su2double* Normal; - - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - bool energy = config->GetEnergy_Equation(); - - Min_Delta_Time = 1.E30; Max_Delta_Time = 0.0; - - /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed and viscosity ---*/ - - 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); - - Normal = geometry->edges->GetNormal(iEdge); - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - - Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); - Mean_BetaInc2 = 0.5 * (nodes->GetBetaInc2(iPoint) + nodes->GetBetaInc2(jPoint)); - Mean_Density = 0.5 * (nodes->GetDensity(iPoint) + nodes->GetDensity(jPoint)); - Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); - - /*--- Adjustment for grid movement ---*/ - - 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); - } - - /*--- Inviscid contribution ---*/ - - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Inv(iPoint,Lambda); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Inv(jPoint,Lambda); - - /*--- 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)); - Mean_Thermal_Conductivity = 0.5*(nodes->GetThermalConductivity(iPoint) + nodes->GetThermalConductivity(jPoint)); - Mean_Cv = 0.5*(nodes->GetSpecificHeatCv(iPoint) + nodes->GetSpecificHeatCv(jPoint)); - - Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); - Lambda_2 = 0.0; - if (energy) Lambda_2 = (1.0/Mean_Cv)*Mean_Thermal_Conductivity; - Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - - if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint,Lambda); - if (geometry->nodes->GetDomain(jPoint)) nodes->AddMax_Lambda_Visc(jPoint,Lambda); - - } - - /*--- Loop boundary edges ---*/ +void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *config, + unsigned short val_marker, unsigned short kind_boundary) { - 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++) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool energy = config->GetEnergy_Equation(); - /*--- Point identification, Normal vector and area ---*/ + /*--- Variables for streamwise periodicity ---*/ + const bool streamwise_periodic = (config->GetKind_Streamwise_Periodic() != NONE); + const bool streamwise_periodic_temperature = config->GetStreamwise_Periodic_Temperature(); + su2double Cp, thermal_conductivity, dot_product, scalar_factor; - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - Area = GeometryToolbox::Norm(nDim, Normal); - /*--- Mean Values ---*/ - - Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); - Mean_BetaInc2 = nodes->GetBetaInc2(iPoint); - Mean_Density = nodes->GetDensity(iPoint); - Mean_SoundSpeed = sqrt(Mean_BetaInc2*Area*Area); - - /*--- Adjustment for grid movement ---*/ - - 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; - } - - /*--- Inviscid contribution ---*/ - - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) { - nodes->AddMax_Lambda_Inv(iPoint,Lambda); - } - - /*--- Viscous contribution ---*/ - - Mean_LaminarVisc = nodes->GetLaminarViscosity(iPoint); - Mean_EddyVisc = nodes->GetEddyViscosity(iPoint); - Mean_Density = nodes->GetDensity(iPoint); - Mean_Thermal_Conductivity = nodes->GetThermalConductivity(iPoint); - Mean_Cv = nodes->GetSpecificHeatCv(iPoint); + /*--- Identify the boundary by string name ---*/ - Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); - Lambda_2 = 0.0; - if (energy) Lambda_2 = (1.0/Mean_Cv)*Mean_Thermal_Conductivity; - Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; + const auto Marker_Tag = config->GetMarker_All_TagBound(val_marker); - if (geometry->nodes->GetDomain(iPoint)) nodes->AddMax_Lambda_Visc(iPoint,Lambda); + /*--- Get the specified wall heat flux or temperature from config ---*/ - } - } - } + su2double Wall_HeatFlux = 0.0, Twall = 0.0; - /*--- Each element uses their own speed, steady state simulation ---*/ + if (kind_boundary == HEAT_FLUX) + Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag)/config->GetHeat_Flux_Ref(); + else if (kind_boundary == ISOTHERMAL) + Twall = config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref(); + else + SU2_MPI::Error("Unknown type of boundary condition", CURRENT_FUNCTION); - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - Vol = geometry->nodes->GetVolume(iPoint); - - if (Vol != 0.0) { - Local_Delta_Time = nodes->GetLocalCFL(iPoint)*Vol / nodes->GetMax_Lambda_Inv(iPoint); - Local_Delta_Time_Visc = nodes->GetLocalCFL(iPoint)*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); - } + /*--- Get wall function treatment from config. ---*/ - } + const auto Wall_Function = config->GetWallFunction_Treatment(Marker_Tag); + if (Wall_Function != NO_WALL_FUNCTION) + SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION); - /*--- 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 - } + /*--- Loop over all of the vertices on this boundary marker ---*/ - /*--- 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 - /*--- 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->GetUnst_CFL() == 0.0) { - Global_Delta_Time = config->GetDelta_UnstTime(); - } - config->SetDelta_UnstTimeND(Global_Delta_Time); - for (iPoint = 0; iPoint < nPointDomain; iPoint++){ + SU2_OMP_FOR_DYN(OMP_MIN_SIZE) + for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) { + const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - /*--- Sets the regular CFL equal to the unsteady CFL ---*/ + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ - nodes->SetLocalCFL(iPoint, config->GetUnst_CFL()); - nodes->SetDelta_Time(iPoint, Global_Delta_Time); - Min_Delta_Time = Global_Delta_Time; - Max_Delta_Time = Global_Delta_Time; + if (!geometry->nodes->GetDomain(iPoint)) continue; - } - } + /*--- Compute dual-grid area and boundary normal ---*/ - /*--- 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)) { + const auto Normal = geometry->vertex[val_marker][iVertex]->GetNormal(); - Global_Delta_UnstTimeND = 1e30; - for (iPoint = 0; iPoint < nPointDomain; iPoint++){ - Global_Delta_UnstTimeND = min(Global_Delta_UnstTimeND,config->GetUnst_CFL()*Global_Delta_Time/nodes->GetLocalCFL(iPoint)); - } + const su2double Area = GeometryToolbox::Norm(nDim, Normal); -#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); - } + /*--- 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. ---*/ - /*--- 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); - } + if (dynamic_grid) { + nodes->SetVelocity_Old(iPoint, geometry->nodes->GetGridVel(iPoint)); + } else { + su2double zero[MAXNDIM] = {0.0}; + nodes->SetVelocity_Old(iPoint, zero); } -} - -void CIncNSSolver::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() == EULER_IMPLICIT); - - 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)); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + LinSysRes(iPoint, iDim+1) = 0.0; + nodes->SetVel_ResTruncError_Zero(iPoint); - /*--- 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 ---*/ + /*--- Enforce the no-slip boundary condition in a strong way by + modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/ if (implicit) { - Jacobian.UpdateBlocksSub(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + for (unsigned short iVar = 1; iVar <= nDim; iVar++) + Jacobian.DeleteValsRowi(iPoint*nVar+iVar); } - } - -} - -void CIncNSSolver::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; - - su2double *GridVel, *Normal, Area, Wall_HeatFlux; - - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool energy = config->GetEnergy_Equation(); - - /*--- Identify the boundary by string name ---*/ - - string Marker_Tag = config->GetMarker_All_TagBound(val_marker); - - /*--- Get the specified wall heat flux from config ---*/ - - Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag)/config->GetHeat_Flux_Ref(); - -// /*--- Get wall function treatment from config. ---*/ -// -// Wall_Function = config->GetWallFunction_Treatment(Marker_Tag); -// if (Wall_Function != NO_WALL_FUNCTION) { -// SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION); -// } - - /*--- 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(); + if (!energy) continue; - /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ - - if (geometry->nodes->GetDomain(iPoint)) { + if (kind_boundary == HEAT_FLUX) { - /*--- Compute dual-grid area and boundary normal ---*/ + /*--- Apply a weak boundary condition for the energy equation. + Compute the residual due to the prescribed heat flux. ---*/ - Normal = geometry->vertex[val_marker][iVertex]->GetNormal(); + LinSysRes(iPoint, nDim+1) -= Wall_HeatFlux*Area; - Area = GeometryToolbox::Norm(nDim, Normal); + /*--- With streamwise periodic flow and heatflux walls an additional term is introduced in the boundary formulation ---*/ + if (streamwise_periodic && streamwise_periodic_temperature) { - /*--- Initialize the convective & viscous residuals to zero ---*/ + Cp = nodes->GetSpecificHeatCp(iPoint); + thermal_conductivity = nodes->GetThermalConductivity(iPoint); - 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; - } - } + /*--- Scalar factor of the residual contribution ---*/ + const su2double norm2_translation = GeometryToolbox::SquaredNorm(nDim, config->GetPeriodic_Translation(0)); + scalar_factor = SPvals.Streamwise_Periodic_IntegratedHeatFlow*thermal_conductivity / (SPvals.Streamwise_Periodic_MassFlow * Cp * norm2_translation); - /*--- Store the corrected velocity at the wall which will - be zero (v = 0), unless there are moving walls (v = u_wall)---*/ + /*--- Dot product ---*/ + dot_product = GeometryToolbox::DotProduct(nDim, config->GetPeriodic_Translation(0), Normal); - 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; - } + LinSysRes(iPoint, nDim+1) += scalar_factor*dot_product; + } // if streamwise_periodic + } + else { // ISOTHERMAL - /*--- 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. ---*/ + auto Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - nodes->SetVelocity_Old(iPoint,Vector); + /*--- Get coordinates of i & nearest normal and compute distance ---*/ - for (iDim = 0; iDim < nDim; iDim++) - LinSysRes(iPoint, iDim+1) = 0.0; - nodes->SetVel_ResTruncError_Zero(iPoint); + auto Coord_i = geometry->nodes->GetCoord(iPoint); + auto Coord_j = geometry->nodes->GetCoord(Point_Normal); + su2double Edge_Vector[MAXNDIM]; + GeometryToolbox::Distance(nDim, Coord_j, Coord_i, Edge_Vector); + su2double dist_ij_2 = GeometryToolbox::SquaredNorm(nDim, Edge_Vector); + su2double dist_ij = sqrt(dist_ij_2); - if (energy) { + /*--- Compute the normal gradient in temperature using Twall ---*/ - /*--- Apply a weak boundary condition for the energy equation. - Compute the residual due to the prescribed heat flux. ---*/ + su2double dTdn = -(nodes->GetTemperature(Point_Normal) - Twall)/dist_ij; - Res_Visc[nDim+1] = Wall_HeatFlux*Area; + /*--- Get thermal conductivity ---*/ - /*--- Viscous contribution to the residual at the wall ---*/ + su2double thermal_conductivity = nodes->GetThermalConductivity(iPoint); - LinSysRes.SubtractBlock(iPoint, Res_Visc); + /*--- Apply a weak boundary condition for the energy equation. + Compute the residual due to the prescribed heat flux. ---*/ - } + LinSysRes(iPoint, nDim+1) -= thermal_conductivity*dTdn*Area; - /*--- Enforce the no-slip boundary condition in a strong way by - modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/ + /*--- Jacobian contribution for temperature equation. ---*/ if (implicit) { - for (iVar = 1; iVar <= nDim; iVar++) { - total_index = iPoint*nVar+iVar; - Jacobian.DeleteValsRowi(total_index); - } + su2double proj_vector_ij = 0.0; + if (dist_ij_2 > 0.0) + proj_vector_ij = GeometryToolbox::DotProduct(nDim, Edge_Vector, Normal) / dist_ij_2; + Jacobian.AddVal2Diag(iPoint, nDim+1, thermal_conductivity*proj_vector_ij); } - } } } -void CIncNSSolver::BC_Isothermal_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, Point_Normal, total_index; - - su2double *GridVel; - su2double *Normal, *Coord_i, *Coord_j, Area, dist_ij; - su2double Twall, dTdn; - su2double thermal_conductivity; - - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool energy = config->GetEnergy_Equation(); - - /*--- Identify the boundary by string name ---*/ - - string Marker_Tag = config->GetMarker_All_TagBound(val_marker); - - /*--- Retrieve the specified wall temperature ---*/ - - Twall = config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref(); - - /*--- Get wall function treatment from config. ---*/ - - Wall_Function = config->GetWallFunction_Treatment(Marker_Tag); - if (Wall_Function != NO_WALL_FUNCTION) { - SU2_MPI::Error("Wall function treatment not implemented yet.", CURRENT_FUNCTION); - } - - /*--- 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)) { - - /*--- 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(iPoint, iDim+1) = 0.0; - nodes->SetVel_ResTruncError_Zero(iPoint); - - if (energy) { +void CIncNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver**, CNumerics*, + CNumerics*, CConfig *config, unsigned short val_marker) { - /*--- Compute dual grid area and boundary normal ---*/ - - Normal = geometry->vertex[val_marker][iVertex]->GetNormal(); - - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Compute closest normal neighbor ---*/ - - Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - - /*--- Get coordinates of i & nearest normal and compute distance ---*/ - - Coord_i = geometry->nodes->GetCoord(iPoint); - Coord_j = geometry->nodes->GetCoord(Point_Normal); - dist_ij = 0; - for (iDim = 0; iDim < nDim; iDim++) - dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]); - dist_ij = sqrt(dist_ij); - - /*--- Compute the normal gradient in temperature using Twall ---*/ - - dTdn = -(nodes->GetTemperature(Point_Normal) - Twall)/dist_ij; - - /*--- Get thermal conductivity ---*/ - - thermal_conductivity = nodes->GetThermalConductivity(iPoint); - - /*--- Apply a weak boundary condition for the energy equation. - Compute the residual due to the prescribed heat flux. ---*/ - - Res_Visc[nDim+1] = thermal_conductivity*dTdn*Area; - - /*--- Jacobian contribution for temperature equation. ---*/ - - if (implicit) { - su2double Edge_Vector[3]; - su2double 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]*Normal[iDim]; - } - if (dist_ij_2 == 0.0) proj_vector_ij = 0.0; - else proj_vector_ij = proj_vector_ij/dist_ij_2; - - Jacobian_i[nDim+1][nDim+1] = -thermal_conductivity*proj_vector_ij; - - Jacobian.SubtractBlock2Diag(iPoint, Jacobian_i); - } - - /*--- Viscous contribution to the residual at the wall ---*/ - - LinSysRes.SubtractBlock(iPoint, Res_Visc); - - } - - /*--- Enforce the no-slip boundary condition in a strong way by - modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/ + BC_Wall_Generic(geometry, config, val_marker, HEAT_FLUX); +} - if (implicit) { - for (iVar = 1; iVar <= nDim; iVar++) { - total_index = iPoint*nVar+iVar; - Jacobian.DeleteValsRowi(total_index); - } - } +void CIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver**, CNumerics*, + CNumerics*, CConfig *config, unsigned short val_marker) { - } - } + BC_Wall_Generic(geometry, config, val_marker, ISOTHERMAL); } - void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CConfig *config, unsigned short val_marker) { - unsigned short iVar, jVar, iDim, Wall_Function; - unsigned long iVertex, iPoint, total_index, Point_Normal; - - su2double *Coord_i, *Coord_j, dist_ij; - su2double *GridVel, There, Tconjugate, Twall= 0.0, Temperature_Ref, thermal_conductivity, HF_FactorHere, HF_FactorConjugate; - - Temperature_Ref = config->GetTemperature_Ref(); - - bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - bool energy = config->GetEnergy_Equation(); + const su2double Temperature_Ref = config->GetTemperature_Ref(); + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool energy = config->GetEnergy_Equation(); /*--- Identify the boundary ---*/ - string Marker_Tag = config->GetMarker_All_TagBound(val_marker); + const auto Marker_Tag = config->GetMarker_All_TagBound(val_marker); /*--- Retrieve the specified wall function treatment.---*/ - Wall_Function = config->GetWallFunction_Treatment(Marker_Tag); - if(Wall_Function != NO_WALL_FUNCTION) { - SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION); + const auto Wall_Function = config->GetWallFunction_Treatment(Marker_Tag); + if (Wall_Function != NO_WALL_FUNCTION) { + SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION); } /*--- Loop over boundary points ---*/ - for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + SU2_OMP_FOR_DYN(OMP_MIN_SIZE) + for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) { - iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - if (geometry->nodes->GetDomain(iPoint)) { - - /*--- 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; - } + if (!geometry->nodes->GetDomain(iPoint)) continue; - /*--- 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. ---*/ + /*--- 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); + if (dynamic_grid) { + nodes->SetVelocity_Old(iPoint, geometry->nodes->GetGridVel(iPoint)); + } else { + su2double zero[MAXNDIM] = {0.0}; + nodes->SetVelocity_Old(iPoint, zero); + } - for (iDim = 0; iDim < nDim; iDim++) - LinSysRes(iPoint, iDim+1) = 0.0; - nodes->SetVel_ResTruncError_Zero(iPoint); + for (unsigned short iDim = 0; iDim < nDim; iDim++) + LinSysRes(iPoint, iDim+1) = 0.0; + nodes->SetVel_ResTruncError_Zero(iPoint); - if (energy) { + /*--- Enforce the no-slip boundary condition in a strong way by + modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/ - Tconjugate = GetConjugateHeatVariable(val_marker, iVertex, 0)/Temperature_Ref; + if (implicit) { + for (unsigned short iVar = 1; iVar <= nDim; iVar++) + Jacobian.DeleteValsRowi(iPoint*nVar+iVar); + if (energy) Jacobian.DeleteValsRowi(iPoint*nVar+nDim+1); + } - if ((config->GetKind_CHT_Coupling() == AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX) || - (config->GetKind_CHT_Coupling() == AVERAGED_TEMPERATURE_ROBIN_HEATFLUX)) { + if (!energy) continue; - /*--- Compute closest normal neighbor ---*/ + su2double Tconjugate = GetConjugateHeatVariable(val_marker, iVertex, 0) / Temperature_Ref; + su2double Twall = 0.0; - Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); + if ((config->GetKind_CHT_Coupling() == AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX) || + (config->GetKind_CHT_Coupling() == AVERAGED_TEMPERATURE_ROBIN_HEATFLUX)) { - /*--- Get coordinates of i & nearest normal and compute distance ---*/ + /*--- Compute closest normal neighbor ---*/ - Coord_i = geometry->nodes->GetCoord(iPoint); - Coord_j = geometry->nodes->GetCoord(Point_Normal); - dist_ij = 0; - for (iDim = 0; iDim < nDim; iDim++) - dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]); - dist_ij = sqrt(dist_ij); + auto Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - /*--- Compute wall temperature from both temperatures ---*/ + /*--- Get coordinates of i & nearest normal and compute distance ---*/ - thermal_conductivity = nodes->GetThermalConductivity(iPoint); - There = nodes->GetTemperature(Point_Normal); - HF_FactorHere = thermal_conductivity*config->GetViscosity_Ref()/dist_ij; - HF_FactorConjugate = GetConjugateHeatVariable(val_marker, iVertex, 2); + auto Coord_i = geometry->nodes->GetCoord(iPoint); + auto Coord_j = geometry->nodes->GetCoord(Point_Normal); + su2double dist_ij = GeometryToolbox::Distance(nDim, Coord_j, Coord_i); - Twall = (There*HF_FactorHere + Tconjugate*HF_FactorConjugate)/(HF_FactorHere + HF_FactorConjugate); - } - else if ((config->GetKind_CHT_Coupling() == DIRECT_TEMPERATURE_NEUMANN_HEATFLUX) || - (config->GetKind_CHT_Coupling() == DIRECT_TEMPERATURE_ROBIN_HEATFLUX)) { + /*--- Compute wall temperature from both temperatures ---*/ - /*--- (Directly) Set wall temperature to conjugate temperature. ---*/ + su2double thermal_conductivity = nodes->GetThermalConductivity(iPoint); + su2double There = nodes->GetTemperature(Point_Normal); + su2double HF_FactorHere = thermal_conductivity*config->GetViscosity_Ref()/dist_ij; + su2double HF_FactorConjugate = GetConjugateHeatVariable(val_marker, iVertex, 2); - Twall = Tconjugate; - } - else { - Twall = 0.0; - SU2_MPI::Error("Unknown CHT coupling method.", CURRENT_FUNCTION); - } + Twall = (There*HF_FactorHere + Tconjugate*HF_FactorConjugate)/(HF_FactorHere + HF_FactorConjugate); + } + else if ((config->GetKind_CHT_Coupling() == DIRECT_TEMPERATURE_NEUMANN_HEATFLUX) || + (config->GetKind_CHT_Coupling() == DIRECT_TEMPERATURE_ROBIN_HEATFLUX)) { - /*--- Strong imposition of the temperature on the fluid zone. ---*/ + /*--- (Directly) Set wall temperature to conjugate temperature. ---*/ - LinSysRes(iPoint, nDim+1) = 0.0; - nodes->SetSolution_Old(iPoint, nDim+1, Twall); - nodes->SetEnergy_ResTruncError_Zero(iPoint); - } + Twall = Tconjugate; + } + else { + SU2_MPI::Error("Unknown CHT coupling method.", CURRENT_FUNCTION); + } - /*--- Enforce the no-slip boundary condition in a strong way by - modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/ + /*--- Strong imposition of the temperature on the fluid zone. ---*/ - if (implicit) { - for (iVar = 1; iVar <= nDim; iVar++) { - total_index = iPoint*nVar+iVar; - Jacobian.DeleteValsRowi(total_index); - } - if(energy) { - total_index = iPoint*nVar+nDim+1; - Jacobian.DeleteValsRowi(total_index); - } - } - } + LinSysRes(iPoint, nDim+1) = 0.0; + nodes->SetSolution_Old(iPoint, nDim+1, Twall); + nodes->SetEnergy_ResTruncError_Zero(iPoint); } } diff --git a/SU2_CFD/src/solvers/CMeshSolver.cpp b/SU2_CFD/src/solvers/CMeshSolver.cpp index 5704f6c7bbd1..f008ad0e8121 100644 --- a/SU2_CFD/src/solvers/CMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CMeshSolver.cpp @@ -2,7 +2,7 @@ * \file CMeshSolver.cpp * \brief Main subroutines to solve moving meshes using a pseudo-linear elastic approach. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -249,9 +249,9 @@ void CMeshSolver::SetMinMaxVolume(CGeometry *geometry, CConfig *config, bool upd SU2_OMP_MASTER { elCount = ElemCounter; maxVol = MaxVolume; minVol = MinVolume; - SU2_MPI::Allreduce(&elCount, &ElemCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&maxVol, &MaxVolume, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&minVol, &MinVolume, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&elCount, &ElemCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&maxVol, &MaxVolume, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&minVol, &MinVolume, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); } SU2_OMP_BARRIER @@ -298,7 +298,7 @@ void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { unsigned long nVertex_SolidWall = 0; for(auto iMarker=0u; iMarkerGetnMarker_All(); ++iMarker) { - if(config->GetSolid_Wall(iMarker)) { + if(config->GetSolid_Wall(iMarker) && !config->GetMarker_All_Deform_Mesh_Sym_Plane(iMarker)) { nVertex_SolidWall += geometry->GetnVertex(iMarker); } } @@ -315,7 +315,7 @@ void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { for (unsigned long iMarker=0, ii=0, jj=0; iMarkerGetnMarker_All(); ++iMarker) { - if (!config->GetSolid_Wall(iMarker)) continue; + if (!config->GetSolid_Wall(iMarker) || config->GetMarker_All_Deform_Mesh_Sym_Plane(iMarker)) continue; for (auto iVertex=0u; iVertexGetnVertex(iMarker); ++iVertex) { auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); @@ -379,8 +379,8 @@ void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { { MaxDistance_Local = MaxDistance; MinDistance_Local = MinDistance; - SU2_MPI::Allreduce(&MaxDistance_Local, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&MinDistance_Local, &MinDistance, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MaxDistance_Local, &MaxDistance, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MinDistance_Local, &MinDistance, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); } SU2_OMP_BARRIER } diff --git a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp index 86aa426bef54..aae061ef04d7 100644 --- a/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMOEulerSolver.cpp @@ -2,7 +2,7 @@ * \file CNEMOEulerSolver.cpp * \brief Headers of the CNEMOEulerSolver class * \author S. R. Copeland, F. Palacios, W. Maier, C. Garbacz - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -254,7 +254,7 @@ CNEMOEulerSolver::CNEMOEulerSolver(CGeometry *geometry, CConfig *config, /*--- Warning message about non-physical points ---*/ if (config->GetComm_Level() == COMM_FULL) { - SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); if ((rank == MASTER_NODE) && (counter_global != 0)) cout << "Warning. The original solution contains "<< counter_global << " points that are not physical." << endl; @@ -284,58 +284,6 @@ CNEMOEulerSolver::~CNEMOEulerSolver(void) { } -void CNEMOEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long TimeIter) { - - unsigned long iPoint; - unsigned short iMesh; - const bool restart = (config->GetRestart() || config->GetRestart_Flow()); - const bool rans = false; - const bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - - - /*--- Make sure that the solution is well initialized for unsteady - calculations with dual time-stepping (load additional restarts for 2nd-order). ---*/ - - if (dual_time && (TimeIter == 0 || (restart && TimeIter == config->GetRestart_Iter())) ) { - - /*--- Push back the initial condition to previous solution containers - for a 1st-order restart or when simply intitializing to freestream. ---*/ - - for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); - solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n1(); - if (rans) { - solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); - solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n1(); - } - } - } - - if ((restart && TimeIter == config->GetRestart_Iter()) && - (config->GetTime_Marching() == DT_STEPPING_2ND)) { - - /*--- Load an additional restart file for a 2nd-order restart ---*/ - solver_container[MESH_0][FLOW_SOL]->LoadRestart(geometry, solver_container, config, SU2_TYPE::Int(config->GetRestart_Iter()-1), true); - - /*--- Load an additional restart file for the turbulence model ---*/ - if (rans) - solver_container[MESH_0][TURB_SOL]->LoadRestart(geometry, solver_container, config, SU2_TYPE::Int(config->GetRestart_Iter()-1), false); - - /*--- Push back this new solution to time level N. ---*/ - - for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) { - for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) { - solver_container[iMesh][FLOW_SOL]->GetNodes()->Set_Solution_time_n(); - if (rans) - solver_container[iMesh][TURB_SOL]->GetNodes()->Set_Solution_time_n(); - } - } - } - } -} - void CNEMOEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { @@ -351,7 +299,7 @@ void CNEMOEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver if ((iMesh == MESH_0) && (config->GetComm_Level() == COMM_FULL)) { unsigned long tmp = ErrorCounter; - SU2_MPI::Allreduce(&tmp, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&tmp, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); config->SetNonphysical_Points(ErrorCounter); } @@ -378,17 +326,17 @@ void CNEMOEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_conta unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { - unsigned long InnerIter = config->GetInnerIter(); - bool muscl = config->GetMUSCL_Flow(); - bool limiter = ((config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()) && !(config->GetFrozen_Limiter_Disc())); - bool center = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; - bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; + const unsigned long InnerIter = config->GetInnerIter(); + const bool muscl = config->GetMUSCL_Flow() && (iMesh == MESH_0); + const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); + const bool center = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; + const bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; /*--- Common preprocessing steps ---*/ CommonPreprocessing(geometry, solver_container, config, iMesh, iRKStep, RunTime_EqSystem, Output); /*--- Upwind second order reconstruction ---*/ - if ((muscl && !center) && (iMesh == MESH_0) && !Output) { + if (muscl && !center && !Output) { /*--- Calculate the gradients ---*/ if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { @@ -399,7 +347,7 @@ void CNEMOEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_conta } /*--- Limiter computation ---*/ - if ((limiter) && (iMesh == MESH_0) && !Output && !van_albada) { + if (limiter && !van_albada) { SetPrimitive_Limiter(geometry, config); } } @@ -432,314 +380,71 @@ unsigned long CNEMOEulerSolver::SetPrimitive_Variables(CSolver **solver_containe void CNEMOEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) { - const bool viscous = config->GetViscous(); - const bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); - const bool time_stepping = (config->GetTime_Marching() == TIME_STEPPING); - const bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND); - const su2double K_v = 0.25; - - /*--- Init thread-shared variables to compute min/max values. - * Critical sections are used for this instead of reduction - * clauses for compatibility with OpenMP 2.0 (Windows...). ---*/ - SU2_OMP_MASTER - { - Min_Delta_Time = 1e30; - Max_Delta_Time = 0.0; - Global_Delta_UnstTimeND = 1e30; - } - SU2_OMP_BARRIER - - const su2double *Normal = nullptr; - su2double Area, Vol, Mean_SoundSpeed, Mean_ProjVel, Lambda, Local_Delta_Time, Local_Delta_Time_Visc; - su2double Mean_LaminarVisc, Mean_EddyVisc, Mean_Density, Lambda_1, Lambda_2; - su2double Mean_ThermalCond, Mean_ThermalCond_ve, cv; - unsigned long iEdge, iVertex, iPoint, jPoint; - unsigned short iDim, iMarker; - - /*--- Loop domain points. ---*/ - SU2_OMP_FOR_DYN(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; ++iPoint) { - - /*--- Set maximum eigenvalue to zero. ---*/ - nodes->SetMax_Lambda_Inv(iPoint, 0.0); - - if (viscous) - nodes->SetMax_Lambda_Visc(iPoint,0.0); - - /*--- Loop over the neighbors of point i. ---*/ - for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) - { - jPoint = geometry->nodes->GetPoint(iPoint,iNeigh); - - iEdge = geometry->nodes->GetEdge(iPoint,iNeigh); - Normal = geometry->edges->GetNormal(iEdge); - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint, Normal) + nodes->GetProjVel(jPoint,Normal)); - Mean_SoundSpeed = 0.5 * (nodes->GetSoundSpeed(iPoint) + nodes->GetSoundSpeed(jPoint)) * Area; - - /*--- Adjustment for grid movement ---*/ - if (dynamic_grid) { - const su2double *GridVel_i = geometry->nodes->GetGridVel(iPoint); - const su2double *GridVel_j = geometry->nodes->GetGridVel(jPoint); - - for (iDim = 0; iDim < nDim; iDim++) - Mean_ProjVel -= 0.5 * (GridVel_i[iDim] + GridVel_j[iDim]) * Normal[iDim]; - } - - /*--- Inviscid contribution ---*/ - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - nodes->AddMax_Lambda_Inv(iPoint,Lambda); - - /*--- Viscous contribution ---*/ - if (!viscous) continue; - - /*--- Calculate mean viscous quantities ---*/ - Mean_LaminarVisc = 0.5*(nodes->GetLaminarViscosity(iPoint) + - nodes->GetLaminarViscosity(jPoint)); - Mean_EddyVisc = 0.5*(nodes->GetEddyViscosity(iPoint) + - nodes->GetEddyViscosity(jPoint)); - Mean_ThermalCond = 0.5*(nodes->GetThermalConductivity(iPoint) + - nodes->GetThermalConductivity(jPoint)); - Mean_ThermalCond_ve = 0.5*(nodes->GetThermalConductivity_ve(iPoint) + - nodes->GetThermalConductivity_ve(jPoint)); - Mean_Density = 0.5*(nodes->GetDensity(iPoint) + - nodes->GetDensity(jPoint)); - cv = 0.5*(nodes->GetRhoCv_tr(iPoint) + nodes->GetRhoCv_ve(iPoint) + - nodes->GetRhoCv_tr(jPoint) + nodes->GetRhoCv_ve(jPoint) )/ Mean_Density; - - /*--- Determine the viscous spectral radius and apply it to the control volume ---*/ - Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc); - Lambda_2 = (Mean_ThermalCond+Mean_ThermalCond_ve)/cv; - - Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - nodes->AddMax_Lambda_Visc(iPoint, Lambda); + /*--- Define an object to compute the speed of sound. ---*/ + struct SoundSpeed { + FORCEINLINE su2double operator() (const CNEMOEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + return 0.5 * (nodes.GetSoundSpeed(iPoint) + nodes.GetSoundSpeed(jPoint)); } - } - - /*--- 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)) { - - SU2_OMP_FOR_STAT(OMP_MIN_SIZE) - for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { - - /*--- Point identification, Normal vector and area ---*/ - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - - if (!geometry->nodes->GetDomain(iPoint)) continue; - - Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); - Mean_SoundSpeed = nodes->GetSoundSpeed(iPoint) * Area; - - /*--- Adjustment for grid movement ---*/ - if (dynamic_grid) { - const su2double *GridVel = geometry->nodes->GetGridVel(iPoint); - - for (iDim = 0; iDim < nDim; iDim++) - Mean_ProjVel -= GridVel[iDim]*Normal[iDim]; - } - - /*--- Inviscid contribution ---*/ - Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - nodes->AddMax_Lambda_Inv(iPoint,Lambda); - - /*--- Viscous contribution ---*/ - if (!viscous) continue; - - /*--- Calculate viscous mean quantities ---*/ - Mean_LaminarVisc = nodes->GetLaminarViscosity(iPoint); - Mean_EddyVisc = nodes->GetEddyViscosity(iPoint); - Mean_ThermalCond = nodes->GetThermalConductivity(iPoint); - Mean_ThermalCond_ve = nodes->GetThermalConductivity_ve(iPoint); - Mean_Density = nodes->GetDensity(iPoint); - cv = (nodes->GetRhoCv_tr(iPoint) + - nodes->GetRhoCv_ve(iPoint)) / Mean_Density; - - Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc+Mean_EddyVisc); - Lambda_2 = (Mean_ThermalCond+Mean_ThermalCond_ve)/cv; - Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density; - nodes->AddMax_Lambda_Visc(iPoint,Lambda); - - } + FORCEINLINE su2double operator() (const CNEMOEulerVariable& nodes, unsigned long iPoint) const { + return nodes.GetSoundSpeed(iPoint); } - } - - /*--- Each element uses their own speed, steady state simulation. ---*/ - { - /*--- Thread-local variables for min/max reduction. ---*/ - su2double minDt = 1e30, maxDt = 0.0; - - SU2_OMP(for schedule(static,omp_chunk_size) nowait) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - Vol = geometry->nodes->GetVolume(iPoint); - if (Vol != 0.0) { - Local_Delta_Time = nodes->GetLocalCFL(iPoint)*Vol / nodes->GetMax_Lambda_Inv(iPoint); + } soundSpeed; - if(viscous) { - Local_Delta_Time_Visc = nodes->GetLocalCFL(iPoint)*K_v*Vol*Vol/ nodes->GetMax_Lambda_Visc(iPoint); - Local_Delta_Time = min(Local_Delta_Time, Local_Delta_Time_Visc); - } - - minDt = min(minDt, Local_Delta_Time); - maxDt = max(maxDt, Local_Delta_Time); - - nodes->SetDelta_Time(iPoint, min(Local_Delta_Time, config->GetMax_DeltaTime())); - } - else { - nodes->SetDelta_Time(iPoint,0.0); - } - } - /*--- Min/max over threads. ---*/ - SU2_OMP_CRITICAL - { - Min_Delta_Time = min(Min_Delta_Time, minDt); - Max_Delta_Time = max(Max_Delta_Time, maxDt); - Global_Delta_Time = Min_Delta_Time; - } - SU2_OMP_BARRIER - } - - /*--- Compute the min/max dt (in parallel, now over mpi ranks). ---*/ - SU2_OMP_MASTER - if (config->GetComm_Level() == COMM_FULL) { - su2double rbuf_time; - SU2_MPI::Allreduce(&Min_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - Min_Delta_Time = rbuf_time; - - SU2_MPI::Allreduce(&Max_Delta_Time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - Max_Delta_Time = rbuf_time; - } - SU2_OMP_BARRIER - - /*--- For exact time solution use the minimum delta time of the whole mesh. ---*/ - if (time_stepping) { - - /*--- 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. ---*/ - SU2_OMP_MASTER - { - if (config->GetUnst_CFL() == 0.0) { - Global_Delta_Time = config->GetDelta_UnstTime(); - } - else { - Global_Delta_Time = Min_Delta_Time; - } - Max_Delta_Time = Global_Delta_Time; - - config->SetDelta_UnstTimeND(Global_Delta_Time); + /*--- Define an object to compute the viscous eigenvalue. ---*/ + struct LambdaVisc { + FORCEINLINE su2double lambda(su2double lamVisc, su2double eddyVisc, su2double rho, su2double k, su2double cv) const { + /*--- Determine the viscous spectral radius and apply it to the control volume ---*/ + su2double Lambda_1 = (4.0/3.0)*(lamVisc + eddyVisc); + return (Lambda_1 + k/cv)/rho; } - SU2_OMP_BARRIER - /*--- Sets the regular CFL equal to the unsteady CFL. ---*/ - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - nodes->SetLocalCFL(iPoint, config->GetUnst_CFL()); - nodes->SetDelta_Time(iPoint, Global_Delta_Time); + FORCEINLINE su2double operator() (const CNEMOEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + su2double lamVisc = 0.5*(nodes.GetLaminarViscosity(iPoint) + nodes.GetLaminarViscosity(jPoint)); + su2double eddyVisc = 0.5*(nodes.GetEddyViscosity(iPoint) + nodes.GetEddyViscosity(jPoint)); + su2double thermalCond = 0.5*(nodes.GetThermalConductivity(iPoint) + nodes.GetThermalConductivity(jPoint) + + nodes.GetThermalConductivity_ve(iPoint) + nodes.GetThermalConductivity_ve(jPoint)); + su2double density = 0.5*(nodes.GetDensity(iPoint) + nodes.GetDensity(jPoint)); + su2double cv = 0.5*(nodes.GetRhoCv_tr(iPoint) + nodes.GetRhoCv_ve(iPoint) + + nodes.GetRhoCv_tr(jPoint) + nodes.GetRhoCv_ve(jPoint))/ density; + return lambda(lamVisc, eddyVisc, density, thermalCond, cv); } - } - - /*--- 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)) { - - /*--- Thread-local variable for reduction. ---*/ - su2double glbDtND = 1e30; - - SU2_OMP(for schedule(static,omp_chunk_size) nowait) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - glbDtND = min(glbDtND, config->GetUnst_CFL()*Global_Delta_Time / nodes->GetLocalCFL(iPoint)); + FORCEINLINE su2double operator() (const CNEMOEulerVariable& nodes, unsigned long iPoint) const { + su2double lamVisc = nodes.GetLaminarViscosity(iPoint); + su2double eddyVisc = nodes.GetEddyViscosity(iPoint); + su2double thermalCond = nodes.GetThermalConductivity(iPoint) + nodes.GetThermalConductivity_ve(iPoint); + su2double density = nodes.GetDensity(iPoint); + su2double cv = (nodes.GetRhoCv_tr(iPoint) + nodes.GetRhoCv_ve(iPoint))/ density; + return lambda(lamVisc, eddyVisc, density, thermalCond, cv); } - SU2_OMP_CRITICAL - Global_Delta_UnstTimeND = min(Global_Delta_UnstTimeND, glbDtND); - SU2_OMP_BARRIER - SU2_OMP_MASTER - { - SU2_MPI::Allreduce(&Global_Delta_UnstTimeND, &glbDtND, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - Global_Delta_UnstTimeND = glbDtND; + } lambdaVisc; - config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND); - } - SU2_OMP_BARRIER - } + /*--- Now instantiate the generic implementation with the two functors above. ---*/ - /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/ - if (dual_time && !implicit) { - SU2_OMP_FOR_STAT(omp_chunk_size) - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), nodes->GetDelta_Time(iPoint)); - nodes->SetDelta_Time(iPoint, Local_Delta_Time); - } - } + SetTime_Step_impl(soundSpeed, lambdaVisc, geometry, solver_container, config, iMesh, Iteration); } void CNEMOEulerSolver::SetMax_Eigenvalue(CGeometry *geometry, CConfig *config) { - /*--- Loop domain points. ---*/ - for ( unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) { - - /*--- Set inviscid eigenvalues to zero. ---*/ - nodes->SetLambda(iPoint, 0.0); - - /*--- Loop over the neighbors of point i. ---*/ - for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) - { - auto jPoint = geometry->nodes->GetPoint(iPoint, iNeigh); - - auto iEdge = geometry->nodes->GetEdge(iPoint, iNeigh); - auto Normal = geometry->edges->GetNormal(iEdge); - su2double Area = GeometryToolbox::Norm(nDim, Normal); - - /*--- Mean Values ---*/ - su2double Mean_ProjVel = 0.5 * (nodes->GetProjVel(iPoint,Normal) + nodes->GetProjVel(jPoint,Normal)); - su2double Mean_SoundSpeed = 0.5 * (nodes->GetSoundSpeed(iPoint) + nodes->GetSoundSpeed(jPoint)) * Area; - - /*--- Inviscid contribution ---*/ - su2double Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - nodes->AddLambda(iPoint,Lambda); + /*--- Define an object to compute the speed of sound. ---*/ + struct SoundSpeed { + FORCEINLINE su2double operator() (const CNEMOEulerVariable& nodes, unsigned long iPoint, unsigned long jPoint) const { + return 0.5 * (nodes.GetSoundSpeed(iPoint) + nodes.GetSoundSpeed(jPoint)); } - } - /*--- Loop boundary edges ---*/ - for (unsigned short iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY) && - (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)) { + FORCEINLINE su2double operator() (const CNEMOEulerVariable& nodes, unsigned long iPoint) const { + return nodes.GetSoundSpeed(iPoint); + } - for (unsigned long iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) { + } soundSpeed; - /*--- Point identification, Normal vector and area ---*/ - auto iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - su2double Area = GeometryToolbox::Norm(nDim, Normal); + /*--- Instantiate generic implementation. ---*/ - /*--- Mean Values ---*/ - su2double Mean_ProjVel = nodes->GetProjVel(iPoint,Normal); - su2double Mean_SoundSpeed = nodes->GetSoundSpeed(iPoint) * Area; - - /*--- Inviscid contribution ---*/ - su2double Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed; - if (geometry->nodes->GetDomain(iPoint)) { - nodes->AddLambda(iPoint,Lambda); - } - } - } - } - - /*--- Call the MPI routine ---*/ - InitiateComms(geometry, config, MAX_EIGENVALUE); - CompleteComms(geometry, config, MAX_EIGENVALUE); + SetMax_Eigenvalue_impl(soundSpeed, geometry, config); } @@ -811,11 +516,9 @@ void CNEMOEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_con CConfig *config, unsigned short iMesh) { /*--- Set booleans based on config settings ---*/ - const auto InnerIter = config->GetInnerIter(); //const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool muscl = (config->GetMUSCL_Flow() && (iMesh == MESH_0)); - const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && - (InnerIter <= config->GetLimiterIter()); + const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER); const bool van_albada = (config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE); /*--- Non-physical counter. ---*/ @@ -991,7 +694,7 @@ void CNEMOEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_con SU2_OMP_MASTER { counter_local = ErrorCounter; - SU2_MPI::Reduce(&counter_local, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Reduce(&counter_local, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm()); config->SetNonphysical_Reconstr(ErrorCounter); } SU2_OMP_BARRIER @@ -1300,162 +1003,36 @@ void CNEMOEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_con } } -void CNEMOEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - - su2double *local_Residual, *local_Res_TruncError, Vol, Delta, Res; - unsigned short iVar; - unsigned long iPoint; - - bool adjoint = config->GetContinuous_Adjoint(); - - for (iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 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); - - if (!adjoint) { - for (iVar = 0; iVar < nVar; iVar++) { - - Res = local_Residual[iVar] + local_Res_TruncError[iVar]; - nodes->AddSolution(iPoint, iVar, -Res*Delta); - AddRes_RMS(iVar, Res*Res); - AddRes_Max(iVar, fabs(Res), geometry->nodes->GetGlobalIndex(iPoint), geometry->nodes->GetCoord(iPoint)); - - } - } - } - - /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); - - /*--- Compute the root mean square residual ---*/ - SetResidual_RMS(geometry, config); +void CNEMOEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iRKStep) { + Explicit_Iteration(geometry, solver_container, config, iRKStep); } -void CNEMOEulerSolver::ExplicitRK_Iteration(CGeometry *geometry,CSolver **solver_container, CConfig *config, unsigned short iRKStep) { - - su2double *Residual, *Res_TruncError, Vol, Delta, Res; - unsigned short iVar; - unsigned long iPoint; - - su2double RK_AlphaCoeff = config->Get_Alpha_RKStep(iRKStep); - - for (iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 0); - } - - /*--- Update the solution ---*/ - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - Vol = geometry-> nodes->GetVolume(iPoint); - Delta = nodes->GetDelta_Time(iPoint) / Vol; - - Res_TruncError = nodes->GetResTruncError(iPoint); - Residual = LinSysRes.GetBlock(iPoint); - - for (iVar = 0; iVar < nVar; iVar++) { - Res = Residual[iVar] + Res_TruncError[iVar]; - nodes->AddSolution(iPoint,iVar, -Res*Delta*RK_AlphaCoeff); - AddRes_RMS(iVar, Res*Res); - AddRes_Max(iVar, fabs(Res), geometry-> nodes->GetGlobalIndex(iPoint),geometry->nodes->GetCoord(iPoint)); - } - } - - /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); - - /*--- Compute the root mean square residual ---*/ - SetResidual_RMS(geometry, config); +void CNEMOEulerSolver::ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iRKStep) { + Explicit_Iteration(geometry, solver_container, config, iRKStep); } -void CNEMOEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - - unsigned short iVar; - unsigned long iPoint, total_index, IterLinSol = 0; - su2double Delta, *local_Res_TruncError, Vol; - - /*--- Set maximum residual to zero ---*/ - for (iVar = 0; iVar < nVar; iVar++) { - SetRes_RMS(iVar, 0.0); - SetRes_Max(iVar, 0.0, 0); - } - - /*--- Build implicit system ---*/ - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - /*--- Read the residual ---*/ - local_Res_TruncError = nodes->GetResTruncError(iPoint); - - /*--- Read the volume ---*/ - Vol = geometry-> nodes->GetVolume(iPoint); - - /*--- Modify matrix diagonal to assure diagonal dominance ---*/ - 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; - } - } - - /*--- 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)); - } - } +void CNEMOEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { - /*--- 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; - } - } + Explicit_Iteration(geometry, solver_container, config, 0); +} - /*--- Solve or smooth the linear system ---*/ - IterLinSol = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); +void CNEMOEulerSolver::PrepareImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) { - /*--- The the number of iterations of the linear solver ---*/ - SetIterLinSolver(IterLinSol); + struct DummyPrec { + const bool active = false; + FORCEINLINE su2double** operator() (const CConfig*, unsigned long, su2double) const { return nullptr; } + } precond; - /*--- Update solution (system written in terms of increments) ---*/ - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - for (iVar = 0; iVar < nVar; iVar++) { - nodes->AddSolution(iPoint,iVar, nodes->GetUnderRelaxation(iPoint)*LinSysSol[iPoint*nVar+iVar]); - } - } + PrepareImplicitIteration_impl(precond, geometry, config); +} - /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION); - CompleteComms(geometry, config, SOLUTION); +void CNEMOEulerSolver::CompleteImplicitIteration(CGeometry *geometry, CSolver**, CConfig *config) { - /*--- Compute the root mean square residual ---*/ - SetResidual_RMS(geometry, config); + CompleteImplicitIteration_impl(geometry, config); } void CNEMOEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMesh) { @@ -2056,8 +1633,10 @@ void CNEMOEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contai /*--- Viscous contribution ---*/ if (viscous) { - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal) ); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected ); visc_numerics->SetNormal(Normal); /*--- Primitive variables, and gradient ---*/ @@ -2355,7 +1934,10 @@ void CNEMOEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solution_containe // /*--- Set the normal vector and the coordinates ---*/ // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(), geometry->node[Point_Normal]->GetCoord()); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(), Coord_Reflected); // /*--- Primitive variables, and gradient ---*/ // visc_numerics->SetPrimitive(V_domain, V_inlet); @@ -2575,7 +2157,10 @@ void CNEMOEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solution_contain // /*--- Set the normal vector and the coordinates ---*/ // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(), geometry->node[Point_Normal]->GetCoord()); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(), Coord_Reflected); // /*--- Primitive variables, and gradient ---*/ // visc_numerics->SetPrimitive(V_domain, V_outlet); @@ -2809,7 +2394,10 @@ SU2_MPI::Error("BC_SUPERSONIC_INLET: Not operational in NEMO.", CURRENT_FUNCTION // // /*--- Set the normal vector and the coordinates ---*/ // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Primitive variables, and gradient ---*/ // visc_numerics->SetPrimitive(V_domain, V_inlet); @@ -2913,280 +2501,3 @@ void CNEMOEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solut // BC_Euler_Wall(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker); // //} - -void CNEMOEulerSolver::SetResidual_DualTime(CGeometry *geometry, - CSolver **solution_container, - CConfig *config, - unsigned short iRKStep, - unsigned short iMesh, - unsigned short RunTime_EqSystem) { - unsigned short iVar, jVar; - unsigned long iPoint; - su2double *U_time_nM1, *U_time_n, *U_time_nP1, Volume_nM1, Volume_n, Volume_nP1, TimeStep; - - bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT); - bool dynamic_grid = config->GetGrid_Movement(); - - /*--- loop over points ---*/ - for (iPoint = 0; iPoint < nPointDomain; iPoint++) { - - /*--- Solution at time n-1, n and n+1 ---*/ - U_time_nM1 = nodes->GetSolution_time_n1(iPoint); - U_time_n = nodes->GetSolution_time_n(iPoint); - U_time_nP1 = nodes->GetSolution(iPoint); - - /*--- Volume at time n-1 and n ---*/ - if (dynamic_grid) { - Volume_nM1 = geometry->nodes->GetVolume_nM1(iPoint); - Volume_n = geometry->nodes->GetVolume_n(iPoint); - Volume_nP1 = geometry->nodes->GetVolume(iPoint); - } - else { - Volume_nM1 = geometry->nodes->GetVolume(iPoint); - Volume_n = geometry->nodes->GetVolume(iPoint); - Volume_nP1 = geometry->nodes->GetVolume(iPoint); - } - - /*--- Time Step ---*/ - TimeStep = config->GetDelta_UnstTimeND(); - - /*--- Compute Residual ---*/ - for(iVar = 0; iVar < nVar; iVar++) { - if (config->GetTime_Marching() == DT_STEPPING_1ST) - Residual[iVar] = ( U_time_nP1[iVar]*Volume_nP1 - U_time_n[iVar]*Volume_n ) / TimeStep; - if (config->GetTime_Marching() == DT_STEPPING_2ND) - Residual[iVar] = ( 3.0*U_time_nP1[iVar]*Volume_nP1 - 4.0*U_time_n[iVar]*Volume_n - + 1.0*U_time_nM1[iVar]*Volume_nM1 ) / (2.0*TimeStep); - } - - /*--- Add Residual ---*/ - LinSysRes.AddBlock(iPoint, Residual); - - if (implicit) { - for (iVar = 0; iVar < nVar; iVar++) { - for (jVar = 0; jVar < nVar; jVar++) - Jacobian_i[iVar][jVar] = 0.0; - - 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.AddBlock(iPoint, iPoint, Jacobian_i); - } - } -} - -void CNEMOEulerSolver::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, *Solution_Fine; - bool dynamic_grid = config->GetGrid_Movement(); - bool dual_time = ((config->GetTime_Marching() == DT_STEPPING_1ST) || - (config->GetTime_Marching() == DT_STEPPING_2ND)); - bool static_fsi = ((config->GetTime_Marching() == STEADY) && - (config->GetFSI_Simulation())); - bool steady_restart = config->GetSteadyRestart(); - bool turbulent = false; - - string UnstExt, text_line; - ifstream restart_file; - - string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", val_iter); - - Coord = new su2double [nDim]; - for (iDim = 0; iDim < nDim; iDim++) - Coord[iDim] = 0.0; - - 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; - - /*--- 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) 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. ---*/ - index = counter*Restart_Vars[1] + skipVars; - for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar]; - nodes->SetSolution(iPoint_Local,Solution); - iPoint_Global_Local++; - - /*--- For dynamic meshes, read in and store the - grid coordinates and grid velocities for each node. ---*/ - if (dynamic_grid && val_update_geo) { - - /*--- 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 + 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]); - } - } - - if (static_fsi && val_update_geo) { - /*--- Rewind the index to retrieve the Coords. ---*/ - index = counter*Restart_Vars[1]; - for (iDim = 0; iDim < nDim; iDim++) { Coord[iDim] = Restart_Data[index+iDim];} - - for (iDim = 0; iDim < nDim; iDim++) { - geometry[MESH_0]->nodes->SetCoord(iPoint_Local, iDim, Coord[iDim]); - } - } - - /*--- Increment the overall counter for how many points have been loaded. ---*/ - counter++; - } - } - - /*--- Detect a wrong solution file ---*/ - if (iPoint_Global_Local < nPointDomain) { sbuf_NotMatching = 1; } - -#ifndef HAVE_MPI - rbuf_NotMatching = sbuf_NotMatching; -#else - SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD); -#endif - if (rbuf_NotMatching != 0) { - 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); - } - - /*--- 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]->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[MESH_0][FLOW_SOL]->InitiateComms(geometry[MESH_0], config, SOLUTION); - solver[MESH_0][FLOW_SOL]->CompleteComms(geometry[MESH_0], config, SOLUTION); - solver[iMesh][FLOW_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_FLOW_SYS, false); - } - - /*--- Update the geometry for flows on dynamic meshes ---*/ - if (dynamic_grid && val_update_geo) { - - /*--- 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); - - 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]->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]); - geometry[iMesh]->SetRestricted_GridVelocity(geometry[iMeshFine], config); - geometry[iMesh]->SetMaxLength(config); - } - } - - /*--- Update the geometry for flows on static FSI problems with moving meshes ---*/ - if (static_fsi && val_update_geo) { - - /*--- 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); - - /*--- Recompute the edges and dual mesh control volumes in the - domain and on the boundaries. ---*/ - 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]); - geometry[iMesh]->SetMaxLength(config); - } - } - - - /*--- Update the old geometry (coordinates n and n-1) in dual time-stepping strategy ---*/ - if (dual_time && dynamic_grid) - Restart_OldGeometry(geometry[MESH_0], config); - - delete [] Coord; - - /*--- Delete the class memory that is used to load the restart. ---*/ - - delete [] Restart_Vars; - delete [] Restart_Data; - Restart_Vars = nullptr; Restart_Data = nullptr; - -} - diff --git a/SU2_CFD/src/solvers/CNEMONSSolver.cpp b/SU2_CFD/src/solvers/CNEMONSSolver.cpp index 1f72a622ada8..5fc79496d58d 100644 --- a/SU2_CFD/src/solvers/CNEMONSSolver.cpp +++ b/SU2_CFD/src/solvers/CNEMONSSolver.cpp @@ -2,7 +2,7 @@ * \file CNEMONSSolver.cpp * \brief Headers of the CNEMONSSolver class * \author S. R. Copeland, F. Palacios, W. Maier. - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -52,29 +52,16 @@ CNEMONSSolver::CNEMONSSolver(CGeometry *geometry, CConfig *config, unsigned shor break; } - /* Auxiliary vector for storing primitives for gradient computation in viscous flow */ - /* V = [Y1, ... , Yn, T, Tve, ... ] */ - primitives_aux = new su2double[nPrimVar]; - -} - -CNEMONSSolver::~CNEMONSSolver(void) { - - if (primitives_aux != nullptr) delete [] primitives_aux; - } void CNEMONSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { - unsigned long InnerIter = config->GetInnerIter(); - bool cont_adjoint = config->GetContinuous_Adjoint(); - 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 limiter_adjflow = (cont_adjoint && (config->GetKind_SlopeLimit_AdjFlow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter())); - bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; - bool muscl = config->GetMUSCL_Flow(); - bool center = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; + const unsigned long InnerIter = config->GetInnerIter(); + const bool limiter = (config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (InnerIter <= config->GetLimiterIter()); + const bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE; + const bool muscl = config->GetMUSCL_Flow() && (iMesh == MESH_0); + const bool center = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED; /*--- Common preprocessing steps (implemented by CNEMOEulerSolver) ---*/ @@ -82,7 +69,7 @@ void CNEMONSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe /*--- Compute gradient for MUSCL reconstruction. ---*/ - if ((muscl && !center) && (iMesh == MESH_0)) { + if (config->GetReconstructionGradientRequired() && muscl && !center) { switch (config->GetKind_Gradient_Method_Recon()) { case GREEN_GAUSS: SetPrimitive_Gradient_GG(geometry, config, true); break; @@ -102,10 +89,9 @@ void CNEMONSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe SetPrimitive_Gradient_LS(geometry, config); } - /*--- 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) ---*/ + /*--- Compute the limiters ---*/ - if ((iMesh == MESH_0) && (limiter_flow || limiter_turb || limiter_adjflow) && !Output && !van_albada) { + if (muscl && !center && limiter && !van_albada && !Output) { SetPrimitive_Limiter(geometry, config); } @@ -136,8 +122,8 @@ void CNEMONSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe su2double MyOmega_Max = Omega_Max; //su2double MyStrainMag_Max = StrainMag_Max; - //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); + //SU2_MPI::Allreduce(&MyStrainMag_Max, &StrainMag_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&MyOmega_Max, &Omega_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); } } @@ -154,10 +140,10 @@ void CNEMONSSolver::SetPrimitive_Gradient_GG(CGeometry *geometry, const CConfig /*--- Modify species density to mass concentration ---*/ for ( iPoint = 0; iPoint < nPoint; iPoint++){ - for( iVar = 0; iVar < nPrimVar; iVar++) { + su2double primitives_aux[MAXNVAR] = {0.0}; + for( iVar = 0; iVar < nPrimVar; iVar++) primitives_aux[iVar] = nodes->GetPrimitive(iPoint, iVar); - } - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) + for ( iSpecies = 0; iSpecies < nSpecies; iSpecies++) primitives_aux[RHOS_INDEX+iSpecies] = primitives_aux[RHOS_INDEX+iSpecies]/primitives_aux[RHO_INDEX]; for( iVar = 0; iVar < nPrimVar; iVar++) nodes->SetPrimitive_Aux(iPoint, iVar, primitives_aux[iVar] ); @@ -541,8 +527,7 @@ void CNEMONSSolver::BC_HeatFluxCatalytic_Wall(CGeometry *geometry, } if (catalytic) { - cout << "NEED TO IMPLEMENT CATALYTIC BOUNDARIES IN HEATFLUX!!!" << endl; - exit(1); + SU2_MPI::Error("NEED TO IMPLEMENT CATALYTIC BOUNDARIES IN HEATFLUX!!!",CURRENT_FUNCTION); } else { @@ -678,8 +663,7 @@ void CNEMONSSolver::BC_IsothermalNonCatalytic_Wall(CGeometry *geometry, bool ionization = config->GetIonization(); if (ionization) { - cout << "BC_ISOTHERMAL: NEED TO TAKE A CLOSER LOOK AT THE JACOBIAN W/ IONIZATION" << endl; - exit(1); + SU2_MPI::Error("NEED TO TAKE A CLOSER LOOK AT THE JACOBIAN W/ IONIZATION",CURRENT_FUNCTION); } /*--- Extract required indices ---*/ @@ -986,36 +970,33 @@ void CNEMONSSolver::BC_Smoluchowski_Maxwell(CGeometry *geometry, CConfig *config, unsigned short val_marker) { - - unsigned short iDim, jDim, iVar, iSpecies; + unsigned short iDim, iVar, iSpecies; unsigned short T_INDEX, TVE_INDEX, VEL_INDEX; unsigned long iVertex, iPoint, jPoint; su2double ktr, kve, Mass = 0.0; su2double Ti, Tvei, Tj, Tvej; su2double Twall, Tslip, Tslip_ve, dij; su2double Pi; - su2double Area, *Normal, UnitNormal[3]; - su2double *Coord_i, *Coord_j; + su2double Area, UnitNormal[MAXNDIM]; su2double C, alpha_V, alpha_T; su2double TMAC, TAC; su2double Viscosity, Eddy_Visc, Lambda; su2double Density, GasConstant; - su2double **Grad_PrimVar; - su2double Vector_Tangent_dT[3], Vector_Tangent_dTve[3], Vector_Tangent_HF[3]; + const su2double* const* Grad_PrimVar; + su2double Vector_Tangent_dT[MAXNDIM] = {0.0}, Vector_Tangent_dTve[MAXNDIM] = {0.0}, Vector_Tangent_HF[MAXNDIM] = {0.0}; su2double dTn, dTven; su2double rhoCvtr, rhoCvve; - su2double TauElem[3], TauTangent[3]; - su2double Tau[3][3]; + su2double TauElem[MAXNDIM] = {0.0}, TauTangent[MAXNDIM] = {0.0}; + su2double Tau[MAXNDIM][MAXNDIM] = {{0.0}}; su2double TauNormal; bool ionization = config->GetIonization(); if (ionization) { - cout << "BC_SMOLUCHOWSKI_MAXWELL: NEED TO TAKE A CLOSER LOOK AT THE JACOBIAN W/ IONIZATION" << endl; - exit(1); + SU2_MPI::Error("NEED TO TAKE A CLOSER LOOK AT THE JACOBIAN W/ IONIZATION", CURRENT_FUNCTION); } /*--- Define 'proportional control' constant ---*/ @@ -1045,7 +1026,7 @@ void CNEMONSSolver::BC_Smoluchowski_Maxwell(CGeometry *geometry, if (geometry->nodes->GetDomain(iPoint)) { /*--- Compute dual-grid area and boundary normal ---*/ - Normal = geometry->vertex[val_marker][iVertex]->GetNormal(); + const auto Normal = geometry->vertex[val_marker][iVertex]->GetNormal(); Area = GeometryToolbox::Norm(nDim, Normal); for (iDim = 0; iDim < nDim; iDim++) @@ -1055,13 +1036,10 @@ void CNEMONSSolver::BC_Smoluchowski_Maxwell(CGeometry *geometry, jPoint = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); /*--- Compute distance between wall & normal neighbor ---*/ - Coord_i = geometry->nodes->GetCoord(iPoint); - Coord_j = geometry->nodes->GetCoord(jPoint); + const auto Coord_i = geometry->nodes->GetCoord(iPoint); + const auto Coord_j = geometry->nodes->GetCoord(jPoint); - dij = 0.0; - for (iDim = 0; iDim < nDim; iDim++) - dij += (Coord_j[iDim] - Coord_i[iDim])*(Coord_j[iDim] - Coord_i[iDim]); - dij = sqrt(dij); + dij = GeometryToolbox::Distance(nDim, Coord_i, Coord_j); /*--- Calculate Pressure ---*/ Pi = nodes->GetPressure(iPoint); @@ -1087,7 +1065,7 @@ void CNEMONSSolver::BC_Smoluchowski_Maxwell(CGeometry *geometry, Gamma = nodes->GetGamma(iPoint); /*--- Incorporate turbulence effects ---*/ - auto& Ms = FluidModel->GetSpeciesMolarMass(); + const auto& Ms = FluidModel->GetSpeciesMolarMass(); su2double Ru = 1000.0*UNIVERSAL_GAS_CONSTANT; su2double tmp1, scl, Cptr; su2double *Vi = nodes->GetPrimitive(iPoint); @@ -1110,11 +1088,8 @@ void CNEMONSSolver::BC_Smoluchowski_Maxwell(CGeometry *geometry, GasConstant+=UNIVERSAL_GAS_CONSTANT*1000.0/Ms[iSpecies]*nodes->GetMassFraction(iPoint,iSpecies); /*--- Calculate temperature gradients normal to surface---*/ //Doubt about minus sign - dTn = 0.0; dTven = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - dTn += Grad_PrimVar[T_INDEX][iDim]*UnitNormal[iDim]; - dTven += Grad_PrimVar[TVE_INDEX][iDim]*UnitNormal[iDim]; - } + dTn = GeometryToolbox::DotProduct(nDim, Grad_PrimVar[T_INDEX], UnitNormal); + dTven = GeometryToolbox::DotProduct(nDim, Grad_PrimVar[TVE_INDEX], UnitNormal); /*--- Calculate molecular mean free path ---*/ Lambda = Viscosity/Density*sqrt(PI_NUMBER/(2.0*GasConstant*Ti)); @@ -1140,19 +1115,14 @@ void CNEMONSSolver::BC_Smoluchowski_Maxwell(CGeometry *geometry, Res_Visc[iVar] = 0.0; CNumerics::ComputeStressTensor(nDim, Tau, Grad_PrimVar+VEL_INDEX, Viscosity); - for (iDim = 0; iDim < nDim; iDim++) { - TauElem[iDim] = 0.0; - for (jDim = 0; jDim < nDim; jDim++) - TauElem[iDim] += Tau[iDim][jDim]*UnitNormal[jDim]; - } + for (iDim = 0; iDim < nDim; iDim++) + TauElem[iDim] = GeometryToolbox::DotProduct(nDim, Tau[iDim], UnitNormal); /*--- Compute wall shear stress (using the stress tensor) ---*/ - TauNormal = 0.0; + TauNormal = GeometryToolbox::DotProduct(nDim, TauElem, UnitNormal); + for (iDim = 0; iDim < nDim; iDim++) - TauNormal += TauElem[iDim] * UnitNormal[iDim]; - for (iDim = 0; iDim < nDim; iDim++) { TauTangent[iDim] = TauElem[iDim] - TauNormal * UnitNormal[iDim]; - } /*--- Store the Slip Velocity at the wall */ for (iDim = 0; iDim < nDim; iDim++) diff --git a/SU2_CFD/src/solvers/CNSSolver.cpp b/SU2_CFD/src/solvers/CNSSolver.cpp index 9ea15c36e10a..87df3fb2c726 100644 --- a/SU2_CFD/src/solvers/CNSSolver.cpp +++ b/SU2_CFD/src/solvers/CNSSolver.cpp @@ -2,7 +2,7 @@ * \file CNSSolver.cpp * \brief Main subrotuines for solving Finite-Volume Navier-Stokes flow problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -41,19 +41,12 @@ CNSSolver::CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) /*--- This constructor only allocates/inits what is extra to CEulerSolver. ---*/ - /*--- Allocates a 2D array with variable "outer" sizes and init to 0. ---*/ - - auto Alloc2D = [](unsigned long M, const unsigned long* N, su2double**& X) { - X = new su2double* [M]; - for(unsigned long i = 0; i < M; ++i) - X[i] = new su2double [N[i]] (); - }; - /*--- Buffet sensor in all the markers and coefficients ---*/ - Alloc2D(nMarker, nVertex, Buffet_Sensor); - Buffet_Metric = new su2double[nMarker]; - Surface_Buffet_Metric = new su2double[config->GetnMarker_Monitoring()]; + Buffet_Sensor.resize(nMarker); + for (unsigned long i = 0; i< nMarker; ++i) Buffet_Sensor[i].resize(nVertex[i], 0.0); + Buffet_Metric.resize(nMarker, 0.0); + Surface_Buffet_Metric.resize(config->GetnMarker_Monitoring(), 0.0); /*--- Read farfield conditions from config ---*/ @@ -75,22 +68,6 @@ CNSSolver::CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) } -CNSSolver::~CNSSolver(void) { - - unsigned short iMarker; - - delete [] Buffet_Metric; - delete [] Surface_Buffet_Metric; - - if (Buffet_Sensor != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++){ - delete [] Buffet_Sensor[iMarker]; - } - delete [] Buffet_Sensor; - } - -} - void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { @@ -148,46 +125,7 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C SetPrimitive_Limiter(geometry, config); } - /*--- Evaluate the vorticity and strain rate magnitude ---*/ - - SU2_OMP_MASTER - { - StrainMag_Max = 0.0; - Omega_Max = 0.0; - } - SU2_OMP_BARRIER - - nodes->SetVorticity_StrainMag(); - - /*--- Min and Max are not really differentiable ---*/ - const bool wasActive = AD::BeginPassive(); - - su2double strainMax = 0.0, omegaMax = 0.0; - - SU2_OMP(for schedule(static,omp_chunk_size) nowait) - for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) { - strainMax = max(strainMax, nodes->GetStrainMag(iPoint)); - omegaMax = max(omegaMax, GeometryToolbox::Norm(3, nodes->GetVorticity(iPoint))); - } - SU2_OMP_CRITICAL { - StrainMag_Max = max(StrainMag_Max, strainMax); - Omega_Max = max(Omega_Max, omegaMax); - } - - if ((iMesh == MESH_0) && (config->GetComm_Level() == COMM_FULL)) { - SU2_OMP_BARRIER - SU2_OMP_MASTER - { - su2double MyOmega_Max = Omega_Max; - su2double MyStrainMag_Max = StrainMag_Max; - - 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); - } - SU2_OMP_BARRIER - } - - AD::EndPassive(wasActive); + ComputeVorticityAndStrainMag<1>(*config, iMesh); /*--- Compute the TauWall from the wall functions ---*/ @@ -197,7 +135,7 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C } -unsigned long CNSSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) { +unsigned long CNSSolver::SetPrimitive_Variables(CSolver **solver_container, const CConfig *config) { /*--- Number of non-physical points, local to the thread, needs * further reduction if function is called in parallel ---*/ @@ -240,79 +178,17 @@ unsigned long CNSSolver::SetPrimitive_Variables(CSolver **solver_container, CCon void CNSSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { - const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - const bool tkeNeeded = (config->GetKind_Turb_Model() == SST) || - (config->GetKind_Turb_Model() == SST_SUST); - - CVariable* turbNodes = nullptr; - if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); - - /*--- Points, coordinates and normal vector in edge ---*/ - - auto iPoint = geometry->edges->GetNode(iEdge,0); - auto 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)); - - numerics->SetSecondary(nodes->GetSecondary(iPoint), - nodes->GetSecondary(jPoint)); - - /*--- Gradients. ---*/ - - numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint), - nodes->GetGradient_Primitive(jPoint)); - - /*--- Turbulent kinetic energy. ---*/ - - if (tkeNeeded) - numerics->SetTurbKineticEnergy(turbNodes->GetSolution(iPoint,0), - turbNodes->GetSolution(jPoint,0)); - - /*--- Wall shear stress values (wall functions) ---*/ - - numerics->SetTauWall(nodes->GetTauWall(iPoint), - nodes->GetTauWall(iPoint)); - - /*--- Compute and update residual ---*/ - - auto residual = numerics->ComputeResidual(config); - - if (ReducerStrategy) { - EdgeFluxes.SubtractBlock(iEdge, residual); - if (implicit) - Jacobian.UpdateBlocksSub(iEdge, residual.jacobian_i, residual.jacobian_j); - } - else { - LinSysRes.SubtractBlock(iPoint, residual); - LinSysRes.AddBlock(jPoint, residual); - - if (implicit) - Jacobian.UpdateBlocksSub(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); - } - + Viscous_Residual_impl(iEdge, geometry, solver_container, numerics, config); } void CNSSolver::Buffet_Monitoring(const CGeometry *geometry, const CConfig *config) { unsigned long iVertex; - unsigned short Boundary, Monitoring, iMarker, iMarker_Monitoring, iDim; + unsigned short iMarker, iMarker_Monitoring; const su2double* Vel_FS = Velocity_Inf; - su2double VelMag_FS = 0.0, SkinFrictionMag = 0.0, SkinFrictionDot = 0.0, *Normal, Area, Sref = config->GetRefArea(); - su2double k = config->GetBuffet_k(), lam = config->GetBuffet_lambda(); - string Marker_Tag, Monitoring_Tag; + const su2double k = config->GetBuffet_k(), lam = config->GetBuffet_lambda(), Sref = config->GetRefArea(); - for (iDim = 0; iDim < nDim; iDim++){ - VelMag_FS += Vel_FS[iDim]*Vel_FS[iDim]; - } - VelMag_FS = sqrt(VelMag_FS); + const su2double VelMag_FS = GeometryToolbox::Norm(nDim, Vel_FS); /*-- Variables initialization ---*/ @@ -328,10 +204,9 @@ void CNSSolver::Buffet_Monitoring(const CGeometry *geometry, const CConfig *conf Buffet_Metric[iMarker] = 0.0; - Boundary = config->GetMarker_All_KindBC(iMarker); - Monitoring = config->GetMarker_All_Monitoring(iMarker); + const auto Monitoring = config->GetMarker_All_Monitoring(iMarker); - if ((Boundary == HEAT_FLUX) || (Boundary == ISOTHERMAL) || (Boundary == HEAT_FLUX) || (Boundary == CHT_WALL_INTERFACE)) { + if (config->GetViscous_Wall(iMarker)) { /*--- Loop over the vertices to compute the buffet sensor ---*/ @@ -339,13 +214,8 @@ void CNSSolver::Buffet_Monitoring(const CGeometry *geometry, const CConfig *conf /*--- Perform dot product of skin friction with freestream velocity ---*/ - SkinFrictionMag = 0.0; - SkinFrictionDot = 0.0; - for(iDim = 0; iDim < nDim; iDim++){ - SkinFrictionMag += pow(CSkinFriction[iMarker][iDim][iVertex], 2); - SkinFrictionDot += CSkinFriction[iMarker][iDim][iVertex]*Vel_FS[iDim]; - } - SkinFrictionMag = sqrt(SkinFrictionMag); + const su2double SkinFrictionMag = GeometryToolbox::Norm(nDim, CSkinFriction[iMarker][iVertex]); + su2double SkinFrictionDot = GeometryToolbox::DotProduct(nDim, CSkinFriction[iMarker][iVertex], Vel_FS); /*--- Normalize the dot product ---*/ @@ -357,10 +227,10 @@ void CNSSolver::Buffet_Monitoring(const CGeometry *geometry, const CConfig *conf /*--- Integrate buffet sensor ---*/ - if(Monitoring == YES){ + if (Monitoring == YES){ - Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); - Area = GeometryToolbox::Norm(nDim, Normal); + auto Normal = geometry->vertex[iMarker][iVertex]->GetNormal(); + su2double Area = GeometryToolbox::Norm(nDim, Normal); Buffet_Metric[iMarker] += Buffet_Sensor[iMarker][iVertex]*Area/Sref; @@ -368,16 +238,17 @@ void CNSSolver::Buffet_Monitoring(const CGeometry *geometry, const CConfig *conf } - if(Monitoring == YES){ + if (Monitoring == YES){ Total_Buffet_Metric += Buffet_Metric[iMarker]; /*--- Per surface buffet metric ---*/ for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) { - Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring); - Marker_Tag = config->GetMarker_All_TagBound(iMarker); - if (Marker_Tag == Monitoring_Tag) Surface_Buffet_Metric[iMarker_Monitoring] = Buffet_Metric[iMarker]; + auto Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring); + auto Marker_Tag = config->GetMarker_All_TagBound(iMarker); + if (Marker_Tag == Monitoring_Tag) + Surface_Buffet_Metric[iMarker_Monitoring] = Buffet_Metric[iMarker]; } } @@ -386,26 +257,15 @@ void CNSSolver::Buffet_Monitoring(const CGeometry *geometry, const CConfig *conf } -#ifdef HAVE_MPI - /*--- Add buffet metric information using all the nodes ---*/ su2double MyTotal_Buffet_Metric = Total_Buffet_Metric; - SU2_MPI::Allreduce(&MyTotal_Buffet_Metric, &Total_Buffet_Metric, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&MyTotal_Buffet_Metric, &Total_Buffet_Metric, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Add the buffet metric on the surfaces using all the nodes ---*/ - su2double *MySurface_Buffet_Metric = new su2double[config->GetnMarker_Monitoring()]; - - for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) { - MySurface_Buffet_Metric[iMarker_Monitoring] = Surface_Buffet_Metric[iMarker_Monitoring]; - } - - SU2_MPI::Allreduce(MySurface_Buffet_Metric, Surface_Buffet_Metric, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - - delete [] MySurface_Buffet_Metric; - -#endif + auto local_copy = Surface_Buffet_Metric; + SU2_MPI::Allreduce(local_copy.data(), Surface_Buffet_Metric.data(), local_copy.size(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); } @@ -877,7 +737,7 @@ void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver BC_Isothermal_Wall_Generic(geometry, solver_container, conv_numerics, nullptr, config, val_marker, true); } -void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, CConfig *config) { +void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, const CConfig *config) { const su2double Gas_Constant = config->GetGas_ConstantND(); const su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant; diff --git a/SU2_CFD/src/solvers/CRadP1Solver.cpp b/SU2_CFD/src/solvers/CRadP1Solver.cpp index 3d4533d3a210..5bd1e64f0a31 100644 --- a/SU2_CFD/src/solvers/CRadP1Solver.cpp +++ b/SU2_CFD/src/solvers/CRadP1Solver.cpp @@ -2,7 +2,7 @@ * \file CRadP1Solver.cpp * \brief Main subroutines for solving P1 radiation problems. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -662,10 +662,10 @@ void CRadP1Solver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, su2double sbuf_time; sbuf_time = Min_Delta_Time; - SU2_MPI::Allreduce(&sbuf_time, &Min_Delta_Time, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_time, &Min_Delta_Time, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); sbuf_time = Max_Delta_Time; - SU2_MPI::Allreduce(&sbuf_time, &Max_Delta_Time, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&sbuf_time, &Max_Delta_Time, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); } } diff --git a/SU2_CFD/src/solvers/CRadSolver.cpp b/SU2_CFD/src/solvers/CRadSolver.cpp index ba9228f16927..b780f23d3280 100644 --- a/SU2_CFD/src/solvers/CRadSolver.cpp +++ b/SU2_CFD/src/solvers/CRadSolver.cpp @@ -2,7 +2,7 @@ * \file CRadP1Solver.cpp * \brief Main subroutines for solving generic radiation problems (P1, M1, discrete ordinates...) * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index bb318fd4a0fc..312e5b39d246 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -2,7 +2,7 @@ * \file CSolver.cpp * \brief Main subroutines for CSolver class. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -119,10 +119,6 @@ CSolver::CSolver(bool mesh_deform_mode) : System(mesh_deform_mode) { /*--- Flags for the dynamic grid (rigid movement or unsteady deformation). ---*/ dynamic_grid = false; - /*--- Container to store the vertex tractions. ---*/ - VertexTraction = nullptr; - VertexTractionAdjoint = nullptr; - /*--- Auxiliary data needed for CFL adaption. ---*/ Old_Func = 0; @@ -137,7 +133,6 @@ CSolver::CSolver(bool mesh_deform_mode) : System(mesh_deform_mode) { CSolver::~CSolver(void) { unsigned short iVar; - unsigned long iMarker, iVertex; /*--- Public variables, may be accessible outside ---*/ @@ -222,24 +217,6 @@ CSolver::~CSolver(void) { delete [] Jacobian_jj; } - if (VertexTraction != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) - delete [] VertexTraction[iMarker][iVertex]; - delete [] VertexTraction[iMarker]; - } - delete [] VertexTraction; - } - - if (VertexTractionAdjoint != nullptr) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) - delete [] VertexTractionAdjoint[iMarker][iVertex]; - delete [] VertexTractionAdjoint[iMarker]; - } - delete [] VertexTractionAdjoint; - } - delete [] nVertex; delete [] Restart_Vars; @@ -1398,9 +1375,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, with a subtraction before communicating, so now just add. ---*/ for (iVar = 0; iVar < nVar; iVar++) - Diff[iVar] = bufDRecv[buf_offset+iVar]; - - base_nodes->AddUnd_Lapl(iPoint,Diff); + base_nodes->AddUnd_Lapl(iPoint, iVar, bufDRecv[buf_offset+iVar]); break; @@ -1632,18 +1607,6 @@ void CSolver::GetCommCountAndType(const CConfig* config, COUNT_PER_POINT = nVar; MPI_TYPE = COMM_TYPE_DOUBLE; break; - case SOLUTION_FEA_OLD: - COUNT_PER_POINT = nVar*3; - MPI_TYPE = COMM_TYPE_DOUBLE; - break; - case SOLUTION_PRED: - COUNT_PER_POINT = nVar; - MPI_TYPE = COMM_TYPE_DOUBLE; - break; - case SOLUTION_PRED_OLD: - COUNT_PER_POINT = nVar*3; - MPI_TYPE = COMM_TYPE_DOUBLE; - break; case AUXVAR_GRADIENT: COUNT_PER_POINT = nDim*base_nodes->GetnAuxVar(); MPI_TYPE = COMM_TYPE_DOUBLE; @@ -1791,24 +1754,6 @@ void CSolver::InitiateComms(CGeometry *geometry, } } break; - case SOLUTION_FEA_OLD: - for (iVar = 0; iVar < nVar; iVar++) { - bufDSend[buf_offset+iVar] = base_nodes->GetSolution_time_n(iPoint, iVar); - bufDSend[buf_offset+nVar+iVar] = base_nodes->GetSolution_Vel_time_n(iPoint, iVar); - bufDSend[buf_offset+nVar*2+iVar] = base_nodes->GetSolution_Accel_time_n(iPoint, iVar); - } - break; - case SOLUTION_PRED: - for (iVar = 0; iVar < nVar; iVar++) - bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Pred(iPoint, iVar); - break; - case SOLUTION_PRED_OLD: - for (iVar = 0; iVar < nVar; iVar++) { - bufDSend[buf_offset+iVar] = base_nodes->GetSolution_Old(iPoint, iVar); - bufDSend[buf_offset+nVar+iVar] = base_nodes->GetSolution_Pred(iPoint, iVar); - bufDSend[buf_offset+nVar*2+iVar] = base_nodes->GetSolution_Pred_Old(iPoint, iVar); - } - break; case MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) bufDSend[buf_offset+iDim] = base_nodes->GetBound_Disp(iPoint, iDim); @@ -1969,24 +1914,6 @@ void CSolver::CompleteComms(CGeometry *geometry, } } break; - case SOLUTION_FEA_OLD: - for (iVar = 0; iVar < nVar; iVar++) { - base_nodes->Set_Solution_time_n(iPoint, iVar, bufDRecv[buf_offset+iVar]); - base_nodes->SetSolution_Vel_time_n(iPoint, iVar, bufDRecv[buf_offset+nVar+iVar]); - base_nodes->SetSolution_Accel_time_n(iPoint, iVar, bufDRecv[buf_offset+nVar*2+iVar]); - } - break; - case SOLUTION_PRED: - for (iVar = 0; iVar < nVar; iVar++) - base_nodes->SetSolution_Pred(iPoint, iVar, bufDRecv[buf_offset+iVar]); - break; - case SOLUTION_PRED_OLD: - for (iVar = 0; iVar < nVar; iVar++) { - base_nodes->SetSolution_Old(iPoint, iVar, bufDRecv[buf_offset+iVar]); - base_nodes->SetSolution_Pred(iPoint, iVar, bufDRecv[buf_offset+nVar+iVar]); - base_nodes->SetSolution_Pred_Old(iPoint, iVar, bufDRecv[buf_offset+nVar*2+iVar]); - } - break; case MESH_DISPLACEMENTS: for (iDim = 0; iDim < nDim; iDim++) base_nodes->SetBound_Disp(iPoint, iDim, bufDRecv[buf_offset+iDim]); @@ -2084,7 +2011,7 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry, { /* Only the master thread updates the shared variables. */ /* Check if we should decrease or if we can increase, the 20% is to avoid flip-flopping. */ - resetCFL = linRes > 1.0; + resetCFL = linRes > 0.99; reduceCFL = linRes > 1.2*linTol; canIncrease = linRes < linTol; @@ -2235,9 +2162,9 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry, SU2_OMP_MASTER { /* MPI reduction. */ myCFLMin = Min_CFL_Local; myCFLMax = Max_CFL_Local; myCFLSum = Avg_CFL_Local; - SU2_MPI::Allreduce(&myCFLMin, &Min_CFL_Local, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&myCFLMax, &Max_CFL_Local, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&myCFLSum, &Avg_CFL_Local, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&myCFLMin, &Min_CFL_Local, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&myCFLMax, &Max_CFL_Local, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&myCFLSum, &Avg_CFL_Local, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); Avg_CFL_Local /= su2double(geometry[iMesh]->GetGlobal_nPointDomain()); } SU2_OMP_BARRIER @@ -2283,8 +2210,8 @@ void CSolver::SetResidual_RMS(CGeometry *geometry, CConfig *config) { if (config->GetComm_Level() == COMM_FULL) { unsigned long Local_nPointDomain = geometry->GetnPointDomain(); - SU2_MPI::Allreduce(sbuf_residual, rbuf_residual, nVar, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_nPointDomain, &Global_nPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(sbuf_residual, rbuf_residual, nVar, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_nPointDomain, &Global_nPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); } else { @@ -2329,9 +2256,9 @@ void CSolver::SetResidual_RMS(CGeometry *geometry, CConfig *config) { sbuf_coord[iVar*nDim+iDim] = Coord[iDim]; } - SU2_MPI::Allgather(sbuf_residual, nVar, MPI_DOUBLE, rbuf_residual, nVar, MPI_DOUBLE, MPI_COMM_WORLD); - SU2_MPI::Allgather(sbuf_point, nVar, MPI_UNSIGNED_LONG, rbuf_point, nVar, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); - SU2_MPI::Allgather(sbuf_coord, nVar*nDim, MPI_DOUBLE, rbuf_coord, nVar*nDim, MPI_DOUBLE, MPI_COMM_WORLD); + SU2_MPI::Allgather(sbuf_residual, nVar, MPI_DOUBLE, rbuf_residual, nVar, MPI_DOUBLE, SU2_MPI::GetComm()); + SU2_MPI::Allgather(sbuf_point, nVar, MPI_UNSIGNED_LONG, rbuf_point, nVar, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); + SU2_MPI::Allgather(sbuf_coord, nVar*nDim, MPI_DOUBLE, rbuf_coord, nVar*nDim, MPI_DOUBLE, SU2_MPI::GetComm()); for (iVar = 0; iVar < nVar; iVar++) { for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) { @@ -2386,8 +2313,8 @@ void CSolver::SetResidual_BGS(CGeometry *geometry, CConfig *config) { Local_nPointDomain = geometry->GetnPointDomain(); - SU2_MPI::Allreduce(sbuf_residual, rbuf_residual, nVar, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(&Local_nPointDomain, &Global_nPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(sbuf_residual, rbuf_residual, nVar, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&Local_nPointDomain, &Global_nPointDomain, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); for (iVar = 0; iVar < nVar; iVar++) { @@ -2422,9 +2349,9 @@ void CSolver::SetResidual_BGS(CGeometry *geometry, CConfig *config) { sbuf_coord[iVar*nDim+iDim] = Coord[iDim]; } - SU2_MPI::Allgather(sbuf_residual, nVar, MPI_DOUBLE, rbuf_residual, nVar, MPI_DOUBLE, MPI_COMM_WORLD); - SU2_MPI::Allgather(sbuf_point, nVar, MPI_UNSIGNED_LONG, rbuf_point, nVar, MPI_UNSIGNED_LONG, MPI_COMM_WORLD); - SU2_MPI::Allgather(sbuf_coord, nVar*nDim, MPI_DOUBLE, rbuf_coord, nVar*nDim, MPI_DOUBLE, MPI_COMM_WORLD); + SU2_MPI::Allgather(sbuf_residual, nVar, MPI_DOUBLE, rbuf_residual, nVar, MPI_DOUBLE, SU2_MPI::GetComm()); + SU2_MPI::Allgather(sbuf_point, nVar, MPI_UNSIGNED_LONG, rbuf_point, nVar, MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); + SU2_MPI::Allgather(sbuf_coord, nVar*nDim, MPI_DOUBLE, rbuf_coord, nVar*nDim, MPI_DOUBLE, SU2_MPI::GetComm()); for (iVar = 0; iVar < nVar; iVar++) { for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) { @@ -2464,7 +2391,7 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, const CConfig *config) { const su2double* GridVel_j = geometry->nodes->GetGridVel(jPoint); /*--- Determine whether to consider the normal outward or inward. ---*/ - su2double dir = (geometry->edges->GetNode(iEdge,0) == iPoint)? 0.5 : -0.5; + su2double dir = (iPoint < jPoint)? 0.5 : -0.5; su2double Flux = 0.0; for (auto iDim = 0u; iDim < nDim; iDim++) @@ -2506,8 +2433,8 @@ void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, const CConfig *config) { void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) { - const auto solution = base_nodes->GetAuxVar(); - auto gradient = base_nodes->GetAuxVarGradient(); + const auto& solution = base_nodes->GetAuxVar(); + auto& gradient = base_nodes->GetAuxVarGradient(); computeGradientsGreenGauss(this, AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, solution, 0, base_nodes->GetnAuxVar(), gradient); @@ -2516,8 +2443,8 @@ void CSolver::SetAuxVar_Gradient_GG(CGeometry *geometry, const CConfig *config) void CSolver::SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config) { bool weighted = true; - const auto solution = base_nodes->GetAuxVar(); - auto gradient = base_nodes->GetAuxVarGradient(); + const auto& solution = base_nodes->GetAuxVar(); + auto& gradient = base_nodes->GetAuxVarGradient(); auto& rmatrix = base_nodes->GetRmatrix(); computeGradientsLeastSquares(this, AUXVAR_GRADIENT, PERIODIC_NONE, *geometry, *config, @@ -2552,6 +2479,50 @@ void CSolver::SetSolution_Gradient_LS(CGeometry *geometry, const CConfig *config weighted, solution, 0, nVar, gradient, rmatrix); } +void CSolver::SetUndivided_Laplacian(CGeometry *geometry, const CConfig *config) { + + /*--- Loop domain points. ---*/ + + SU2_OMP_FOR_DYN(256) + for (unsigned long iPoint = 0; iPoint < nPointDomain; ++iPoint) { + + const bool boundary_i = geometry->nodes->GetPhysicalBoundary(iPoint); + + /*--- Initialize. ---*/ + for (unsigned short iVar = 0; iVar < nVar; iVar++) + base_nodes->SetUnd_Lapl(iPoint, iVar, 0.0); + + /*--- Loop over the neighbors of point i. ---*/ + for (auto jPoint : geometry->nodes->GetPoints(iPoint)) { + + bool boundary_j = geometry->nodes->GetPhysicalBoundary(jPoint); + + /*--- If iPoint is boundary it only takes contributions from other boundary points. ---*/ + if (boundary_i && !boundary_j) continue; + + /*--- Add solution differences, with correction for compressible flows which use the enthalpy. ---*/ + + for (unsigned short iVar = 0; iVar < nVar; iVar++) { + su2double delta = base_nodes->GetSolution(jPoint,iVar)-base_nodes->GetSolution(iPoint,iVar); + base_nodes->AddUnd_Lapl(iPoint, iVar, delta); + } + } + } + + /*--- Correct the Laplacian across any periodic boundaries. ---*/ + + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic()/2; iPeriodic++) { + InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN); + CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_LAPLACIAN); + } + + /*--- MPI parallelization ---*/ + + InitiateComms(geometry, config, UNDIVIDED_LAPLACIAN); + CompleteComms(geometry, config, UNDIVIDED_LAPLACIAN); + +} + void CSolver::Add_External_To_Solution() { for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) { base_nodes->AddSolution(iPoint, base_nodes->Get_External(iPoint)); @@ -3150,7 +3121,7 @@ void CSolver::Read_SU2_Restart_ASCII(CGeometry *geometry, const CConfig *config, /*--- All ranks open the file using MPI. ---*/ - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -3166,7 +3137,7 @@ void CSolver::Read_SU2_Restart_ASCII(CGeometry *geometry, const CConfig *config, /*--- Broadcast the number of variables to all procs and store clearly. ---*/ - SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(&magic_number, 1, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ @@ -3335,7 +3306,7 @@ void CSolver::Read_SU2_Restart_Binary(CGeometry *geometry, const CConfig *config /*--- All ranks open the file using MPI. ---*/ - ierr = MPI_File_open(MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); + ierr = MPI_File_open(SU2_MPI::GetComm(), fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw); /*--- Error check opening the file. ---*/ @@ -3352,7 +3323,7 @@ void CSolver::Read_SU2_Restart_Binary(CGeometry *geometry, const CConfig *config /*--- Broadcast the number of variables to all procs and store clearly. ---*/ - SU2_MPI::Bcast(Restart_Vars, nRestart_Vars, MPI_INT, MASTER_NODE, MPI_COMM_WORLD); + SU2_MPI::Bcast(Restart_Vars, nRestart_Vars, MPI_INT, MASTER_NODE, SU2_MPI::GetComm()); /*--- Check that this is an SU2 binary file. SU2 binary files have the hex representation of "SU2" as the first int in the file. ---*/ @@ -3382,7 +3353,7 @@ void CSolver::Read_SU2_Restart_Binary(CGeometry *geometry, const CConfig *config /*--- Broadcast the string names of the variables. ---*/ SU2_MPI::Bcast(mpi_str_buf, nFields*CGNS_STRING_SIZE, MPI_CHAR, - MASTER_NODE, MPI_COMM_WORLD); + MASTER_NODE, SU2_MPI::GetComm()); /*--- Now parse the string names and load into the config class in case we need them for writing visualization files (SU2_SOL). ---*/ @@ -3948,7 +3919,7 @@ void CSolver::LoadInletProfile(CGeometry **geometry, } // end iMarker loop - SU2_MPI::Allreduce(&local_failure, &global_failure, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&local_failure, &global_failure, 1, MPI_UNSIGNED_SHORT, MPI_SUM, SU2_MPI::GetComm()); if (global_failure > 0) { SU2_MPI::Error("Prescribed inlet data does not match markers within tolerance.", CURRENT_FUNCTION); @@ -4020,24 +3991,17 @@ void CSolver::LoadInletProfile(CGeometry **geometry, } -void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){ +void CSolver::ComputeVertexTractions(CGeometry *geometry, const CConfig *config){ /*--- Compute the constant factor to dimensionalize pressure and shear stress. ---*/ - su2double *Velocity_ND, *Velocity_Real; + const su2double *Velocity_ND, *Velocity_Real; su2double Density_ND, Density_Real, Velocity2_Real, Velocity2_ND; su2double factor; - unsigned short iDim, jDim; + unsigned short iDim; // Check whether the problem is viscous - bool viscous_flow = ((config->GetKind_Solver() == NAVIER_STOKES) || - (config->GetKind_Solver() == INC_NAVIER_STOKES) || - (config->GetKind_Solver() == RANS) || - (config->GetKind_Solver() == INC_RANS) || - (config->GetKind_Solver() == DISC_ADJ_NAVIER_STOKES) || - (config->GetKind_Solver() == DISC_ADJ_INC_NAVIER_STOKES) || - (config->GetKind_Solver() == DISC_ADJ_INC_RANS) || - (config->GetKind_Solver() == DISC_ADJ_RANS)); + bool viscous_flow = config->GetViscous(); // Parameters for the calculations su2double Pn = 0.0; @@ -4045,7 +4009,7 @@ void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){ unsigned short iMarker; unsigned long iVertex, iPoint; - su2double const *iNormal; + const su2double* iNormal; su2double Pressure_Inf = config->GetPressure_FreeStreamND(); @@ -4055,59 +4019,52 @@ void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){ Velocity_ND = config->GetVelocity_FreeStreamND(); Density_ND = config->GetDensity_FreeStreamND(); - Velocity2_Real = 0.0; - Velocity2_ND = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Velocity2_Real += Velocity_Real[iDim]*Velocity_Real[iDim]; - Velocity2_ND += Velocity_ND[iDim]*Velocity_ND[iDim]; - } + Velocity2_Real = GeometryToolbox::SquaredNorm(nDim, Velocity_Real); + Velocity2_ND = GeometryToolbox::SquaredNorm(nDim, Velocity_ND); factor = Density_Real * Velocity2_Real / ( Density_ND * Velocity2_ND ); for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - /*--- If this is defined as an interface marker ---*/ - if (config->GetMarker_All_Fluid_Load(iMarker) == YES) { + /*--- If this is defined as a wall ---*/ + if (!config->GetSolid_Wall(iMarker)) continue; - // Loop over the vertices - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + // Loop over the vertices + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - // Recover the point index - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - // Get the normal at the vertex: this normal goes inside the fluid domain. - iNormal = geometry->vertex[iMarker][iVertex]->GetNormal(); + // Recover the point index + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + // Get the normal at the vertex: this normal goes inside the fluid domain. + iNormal = geometry->vertex[iMarker][iVertex]->GetNormal(); - /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ - if (geometry->nodes->GetDomain(iPoint)) { + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + if (geometry->nodes->GetDomain(iPoint)) { - // Retrieve the values of pressure - Pn = base_nodes->GetPressure(iPoint); + // Retrieve the values of pressure + Pn = base_nodes->GetPressure(iPoint); - // Calculate tn in the fluid nodes for the inviscid term --> Units of force (non-dimensional). - for (iDim = 0; iDim < nDim; iDim++) - auxForce[iDim] = -(Pn-Pressure_Inf)*iNormal[iDim]; + // Calculate tn in the fluid nodes for the inviscid term --> Units of force (non-dimensional). + for (iDim = 0; iDim < nDim; iDim++) + auxForce[iDim] = -(Pn-Pressure_Inf)*iNormal[iDim]; - // Calculate tn in the fluid nodes for the viscous term - if (viscous_flow) { - su2double Viscosity = base_nodes->GetLaminarViscosity(iPoint); - su2double Tau[3][3]; - CNumerics::ComputeStressTensor(nDim, Tau, base_nodes->GetGradient_Primitive(iPoint)+1, Viscosity); - for (iDim = 0; iDim < nDim; iDim++) { - for (jDim = 0 ; jDim < nDim; jDim++) { - auxForce[iDim] += Tau[iDim][jDim]*iNormal[jDim]; - } - } - } - - // Redimensionalize the forces + // Calculate tn in the fluid nodes for the viscous term + if (viscous_flow) { + su2double Viscosity = base_nodes->GetLaminarViscosity(iPoint); + su2double Tau[3][3]; + CNumerics::ComputeStressTensor(nDim, Tau, base_nodes->GetGradient_Primitive(iPoint)+1, Viscosity); for (iDim = 0; iDim < nDim; iDim++) { - VertexTraction[iMarker][iVertex][iDim] = factor * auxForce[iDim]; + auxForce[iDim] += GeometryToolbox::DotProduct(nDim, Tau[iDim], iNormal); } } - else{ - for (iDim = 0; iDim < nDim; iDim++) { - VertexTraction[iMarker][iVertex][iDim] = 0.0; - } + + // Redimensionalize the forces + for (iDim = 0; iDim < nDim; iDim++) { + VertexTraction[iMarker][iVertex][iDim] = factor * auxForce[iDim]; + } + } + else{ + for (iDim = 0; iDim < nDim; iDim++) { + VertexTraction[iMarker][iVertex][iDim] = 0.0; } } } @@ -4115,7 +4072,7 @@ void CSolver::ComputeVertexTractions(CGeometry *geometry, CConfig *config){ } -void CSolver::RegisterVertexTractions(CGeometry *geometry, CConfig *config){ +void CSolver::RegisterVertexTractions(CGeometry *geometry, const CConfig *config){ unsigned short iMarker, iDim; unsigned long iVertex, iPoint; @@ -4123,31 +4080,28 @@ void CSolver::RegisterVertexTractions(CGeometry *geometry, CConfig *config){ /*--- Loop over all the markers ---*/ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - /*--- If this is defined as an interface marker ---*/ - if (config->GetMarker_All_Fluid_Load(iMarker) == YES) { + /*--- If this is defined as a wall ---*/ + if (!config->GetSolid_Wall(iMarker)) continue; - /*--- Loop over the vertices ---*/ - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + /*--- Loop over the vertices ---*/ + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - /*--- Recover the point index ---*/ - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + /*--- Recover the point index ---*/ + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ - if (geometry->nodes->GetDomain(iPoint)) { + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + if (!geometry->nodes->GetDomain(iPoint)) continue; - /*--- Register the vertex traction as output ---*/ - for (iDim = 0; iDim < nDim; iDim++) { - AD::RegisterOutput(VertexTraction[iMarker][iVertex][iDim]); - } - - } + /*--- Register the vertex traction as output ---*/ + for (iDim = 0; iDim < nDim; iDim++) { + AD::RegisterOutput(VertexTraction[iMarker][iVertex][iDim]); } } } } -void CSolver::SetVertexTractionsAdjoint(CGeometry *geometry, CConfig *config){ +void CSolver::SetVertexTractionsAdjoint(CGeometry *geometry, const CConfig *config){ unsigned short iMarker, iDim; unsigned long iVertex, iPoint; @@ -4155,26 +4109,22 @@ void CSolver::SetVertexTractionsAdjoint(CGeometry *geometry, CConfig *config){ /*--- Loop over all the markers ---*/ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - /*--- If this is defined as an interface marker ---*/ - if (config->GetMarker_All_Fluid_Load(iMarker) == YES) { + /*--- If this is defined as a wall ---*/ + if (!config->GetSolid_Wall(iMarker)) continue; - /*--- Loop over the vertices ---*/ - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + /*--- Loop over the vertices ---*/ + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - /*--- Recover the point index ---*/ - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + /*--- Recover the point index ---*/ + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ - if (geometry->nodes->GetDomain(iPoint)) { + /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/ + if (!geometry->nodes->GetDomain(iPoint)) continue; - /*--- Set the adjoint of the vertex traction from the value received ---*/ - for (iDim = 0; iDim < nDim; iDim++) { - - SU2_TYPE::SetDerivative(VertexTraction[iMarker][iVertex][iDim], - SU2_TYPE::GetValue(VertexTractionAdjoint[iMarker][iVertex][iDim])); - } - - } + /*--- Set the adjoint of the vertex traction from the value received ---*/ + for (iDim = 0; iDim < nDim; iDim++) { + SU2_TYPE::SetDerivative(VertexTraction[iMarker][iVertex][iDim], + SU2_TYPE::GetValue(VertexTractionAdjoint[iMarker][iVertex][iDim])); } } } diff --git a/SU2_CFD/src/solvers/CSolverFactory.cpp b/SU2_CFD/src/solvers/CSolverFactory.cpp index 02a187090671..5b8804520646 100644 --- a/SU2_CFD/src/solvers/CSolverFactory.cpp +++ b/SU2_CFD/src/solvers/CSolverFactory.cpp @@ -2,7 +2,7 @@ * \file CSolverFactory.cpp * \brief Main subroutines for CSolverFactoryclass. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -73,7 +73,7 @@ CSolver** CSolverFactory::CreateSolverContainer(ENUM_MAIN_SOLVER kindMainSolver, break; case NEMO_EULER: solver[FLOW_SOL] = CreateSubSolver(SUB_SOLVER_TYPE::NEMO_EULER, solver, geometry, config, iMGLevel); - break; + break; case INC_NAVIER_STOKES: 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); @@ -197,7 +197,7 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s CSolver *genericSolver = nullptr; ENUM_TURB_MODEL kindTurbModel = static_cast(config->GetKind_Turb_Model()); - + SolverMetaData metaData; metaData.solverType = kindSolver; @@ -240,28 +240,16 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s metaData.integrationType = INTEGRATION_TYPE::DEFAULT; break; case SUB_SOLVER_TYPE::EULER: - genericSolver = CreateFlowSolver(SUB_SOLVER_TYPE::EULER, solver, geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; - break; + case SUB_SOLVER_TYPE::INC_EULER: case SUB_SOLVER_TYPE::NEMO_EULER: - genericSolver = CreateNEMOSolver(SUB_SOLVER_TYPE::NEMO_EULER, solver, geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; - break; case SUB_SOLVER_TYPE::NAVIER_STOKES: - genericSolver = CreateFlowSolver(SUB_SOLVER_TYPE::NAVIER_STOKES, solver, geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; - break; - case SUB_SOLVER_TYPE::NEMO_NAVIER_STOKES: - genericSolver = CreateNEMOSolver(SUB_SOLVER_TYPE::NEMO_NAVIER_STOKES, solver, geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; - break; - case SUB_SOLVER_TYPE::INC_EULER: - genericSolver = CreateFlowSolver(SUB_SOLVER_TYPE::INC_EULER, solver, geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; - break; case SUB_SOLVER_TYPE::INC_NAVIER_STOKES: - genericSolver = CreateFlowSolver(SUB_SOLVER_TYPE::INC_NAVIER_STOKES, solver, geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; + case SUB_SOLVER_TYPE::NEMO_NAVIER_STOKES: + genericSolver = CreateFlowSolver(kindSolver, solver, geometry, config, iMGLevel); + if (!config->GetNewtonKrylov() || config->GetDiscrete_Adjoint() || config->GetContinuous_Adjoint()) + metaData.integrationType = INTEGRATION_TYPE::MULTIGRID; + else + metaData.integrationType = INTEGRATION_TYPE::NEWTON; break; case SUB_SOLVER_TYPE::FEA: genericSolver = new CFEASolver(geometry, config); @@ -272,11 +260,8 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s metaData.integrationType = INTEGRATION_TYPE::NONE; break; case SUB_SOLVER_TYPE::DG_EULER: - genericSolver = CreateDGSolver(SUB_SOLVER_TYPE::DG_EULER, geometry, config, iMGLevel); - metaData.integrationType = INTEGRATION_TYPE::FEM_DG; - break; case SUB_SOLVER_TYPE::DG_NAVIER_STOKES: - genericSolver = CreateDGSolver(SUB_SOLVER_TYPE::DG_NAVIER_STOKES, geometry, config, iMGLevel); + genericSolver = CreateDGSolver(kindSolver, geometry, config, iMGLevel); metaData.integrationType = INTEGRATION_TYPE::FEM_DG; break; case SUB_SOLVER_TYPE::HEAT: @@ -291,7 +276,9 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s 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: + 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); metaData.integrationType = INTEGRATION_TYPE::SINGLEGRID; break; @@ -315,7 +302,7 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s SU2_MPI::Error("No proper allocation found for requested sub solver", CURRENT_FUNCTION); break; } - + if (genericSolver != nullptr) allocatedSolvers[genericSolver] = metaData; @@ -441,32 +428,17 @@ CSolver* CSolverFactory::CreateFlowSolver(SUB_SOLVER_TYPE kindFlowSolver, CSolve case SUB_SOLVER_TYPE::INC_NAVIER_STOKES: flowSolver = new CIncNSSolver(geometry, config, iMGLevel); break; - default: - SU2_MPI::Error("Flow solver not found", CURRENT_FUNCTION); - break; - } - - return flowSolver; - -} - -CSolver* CSolverFactory::CreateNEMOSolver(SUB_SOLVER_TYPE kindNEMO_Solver, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel){ - - CSolver *NEMOSolver = nullptr; - - switch (kindNEMO_Solver) { case SUB_SOLVER_TYPE::NEMO_EULER: - NEMOSolver = new CNEMOEulerSolver(geometry, config, iMGLevel); - NEMOSolver->Preprocessing(geometry, solver, config, iMGLevel, NO_RK_ITER, RUNTIME_FLOW_SYS, false); + flowSolver = new CNEMOEulerSolver(geometry, config, iMGLevel); + flowSolver->Preprocessing(geometry, solver, config, iMGLevel, NO_RK_ITER, RUNTIME_FLOW_SYS, false); break; case SUB_SOLVER_TYPE::NEMO_NAVIER_STOKES: - NEMOSolver = new CNEMONSSolver(geometry, config, iMGLevel); + flowSolver = new CNEMONSSolver(geometry, config, iMGLevel); break; default: - SU2_MPI::Error("NEMO flow solver not found", CURRENT_FUNCTION); + SU2_MPI::Error("Flow solver not found", CURRENT_FUNCTION); break; } - return NEMOSolver; - + return flowSolver; } diff --git a/SU2_CFD/src/solvers/CTemplateSolver.cpp b/SU2_CFD/src/solvers/CTemplateSolver.cpp index 4019746cb653..b0795469937c 100644 --- a/SU2_CFD/src/solvers/CTemplateSolver.cpp +++ b/SU2_CFD/src/solvers/CTemplateSolver.cpp @@ -2,7 +2,7 @@ * \file CTemplateSolver.cpp * \brief Subroutines to be implemented for any new solvers * \author F. Palacios - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/solvers/CTransLMSolver.cpp b/SU2_CFD/src/solvers/CTransLMSolver.cpp index 8f96d1629dd9..b123c812e536 100644 --- a/SU2_CFD/src/solvers/CTransLMSolver.cpp +++ b/SU2_CFD/src/solvers/CTransLMSolver.cpp @@ -2,7 +2,7 @@ * \file CTransLMSolver.cpp * \brief Main subrotuines for Transition model solver. * \author A. Aranake - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index dcebd9edca34..a33a4795822a 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -2,7 +2,7 @@ * \file CTurbSASolver.cpp * \brief Main subrotuines of CTurbSASolver class * \author F. Palacios, A. Bueno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -89,6 +89,7 @@ CTurbSASolver::CTurbSASolver(CGeometry *geometry, CConfig *config, unsigned shor LinSysSol.Initialize(nPoint, nPointDomain, nVar, 0.0); LinSysRes.Initialize(nPoint, nPointDomain, nVar, 0.0); + System.SetxIsZero(true); if (ReducerStrategy) EdgeFluxes.Initialize(geometry->GetnEdge(), geometry->GetnEdge(), nVar, nullptr); @@ -160,35 +161,22 @@ CTurbSASolver::CTurbSASolver(CGeometry *geometry, CConfig *config, unsigned shor /*--- Initializate quantities for SlidingMesh Interface ---*/ - unsigned long iMarker; + SlidingState.resize(nMarker); + SlidingStateNodes.resize(nMarker); - SlidingState = new su2double*** [nMarker] (); - SlidingStateNodes = new int* [nMarker] (); - - for (iMarker = 0; iMarker < nMarker; iMarker++){ - - if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE){ - - SlidingState[iMarker] = new su2double**[geometry->GetnVertex(iMarker)] (); - SlidingStateNodes[iMarker] = new int [geometry->GetnVertex(iMarker)] (); - - for (iPoint = 0; iPoint < geometry->GetnVertex(iMarker); iPoint++) - SlidingState[iMarker][iPoint] = new su2double*[nPrimVar+1] (); + for (unsigned long iMarker = 0; iMarker < nMarker; iMarker++) { + if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE) { + SlidingState[iMarker].resize(nVertex[iMarker], nPrimVar+1) = nullptr; + SlidingStateNodes[iMarker].resize(nVertex[iMarker],0); } - } /*-- Allocation of inlets has to happen in derived classes (not CTurbSolver), * due to arbitrary number of turbulence variables ---*/ - Inlet_TurbVars = new su2double**[nMarker]; - for (unsigned long iMarker = 0; iMarker < nMarker; iMarker++) { - Inlet_TurbVars[iMarker] = new su2double*[nVertex[iMarker]]; - for(unsigned long iVertex=0; iVertex < nVertex[iMarker]; iVertex++){ - Inlet_TurbVars[iMarker][iVertex] = new su2double[nVar] (); - Inlet_TurbVars[iMarker][iVertex][0] = nu_tilde_Inf; - } - } + Inlet_TurbVars.resize(nMarker); + for (unsigned long iMarker = 0; iMarker < nMarker; iMarker++) + Inlet_TurbVars[iMarker].resize(nVertex[iMarker],nVar) = nu_tilde_Inf; /*--- The turbulence models are always solved implicitly, so set the implicit flag in case we have periodic BCs. ---*/ @@ -210,39 +198,10 @@ CTurbSASolver::CTurbSASolver(CGeometry *geometry, CConfig *config, unsigned shor } -CTurbSASolver::~CTurbSASolver(void) { - - unsigned long iMarker, iVertex; - unsigned short iVar; - - if ( SlidingState != nullptr ) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - if ( SlidingState[iMarker] != nullptr ) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) - if ( SlidingState[iMarker][iVertex] != nullptr ){ - for (iVar = 0; iVar < nPrimVar+1; iVar++) - delete [] SlidingState[iMarker][iVertex][iVar]; - delete [] SlidingState[iMarker][iVertex]; - } - delete [] SlidingState[iMarker]; - } - } - delete [] SlidingState; - } - - if ( SlidingStateNodes != nullptr ){ - for (iMarker = 0; iMarker < nMarker; iMarker++){ - if (SlidingStateNodes[iMarker] != nullptr) - delete [] SlidingStateNodes[iMarker]; - } - delete [] SlidingStateNodes; - } - -} - void CTurbSASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool muscl = config->GetMUSCL_Turb(); const bool limiter = (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) && (config->GetInnerIter() <= config->GetLimiterIter()); @@ -252,12 +211,13 @@ void CTurbSASolver::Preprocessing(CGeometry *geometry, CSolver **solver_containe * reducer strategy as we write over the entire matrix. ---*/ if (!ReducerStrategy) { LinSysRes.SetValZero(); - Jacobian.SetValZero(); + if (implicit) Jacobian.SetValZero(); + else {SU2_OMP_BARRIER} } /*--- Upwind second order reconstruction and gradients ---*/ - if (config->GetReconstructionGradientRequired() && muscl) { + if (config->GetReconstructionGradientRequired()) { if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, true); if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) @@ -338,6 +298,7 @@ void CTurbSASolver::Postprocessing(CGeometry *geometry, CSolver **solver_contain void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool harmonic_balance = (config->GetTime_Marching() == HARMONIC_BALANCE); const bool transition = (config->GetKind_Trans_Model() == LM); const bool transition_BC = (config->GetKind_Trans_Model() == BC); @@ -425,7 +386,7 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai LinSysRes.SubtractBlock(iPoint, residual); - Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); } @@ -463,6 +424,7 @@ void CTurbSASolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_conta return; } + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); bool rough_wall = false; string Marker_Tag = config->GetMarker_All_TagBound(val_marker); unsigned short WallType; su2double Roughness_Height; @@ -489,7 +451,7 @@ void CTurbSASolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_conta /*--- Includes 1 in the diagonal ---*/ - Jacobian.DeleteValsRowi(iPoint); + if (implicit) Jacobian.DeleteValsRowi(iPoint); } else { /*--- For rough walls, the boundary condition is given by * (\frac{\partial \nu}{\partial n})_wall = \frac{\nu}{0.03*k_s} @@ -519,8 +481,7 @@ void CTurbSASolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_conta su2double Jacobian_i = (laminar_viscosity*Area)/(0.03*Roughness_Height*sigma); Jacobian_i += 2.0*RoughWallBC*Area/sigma; - Jacobian_i = -Jacobian_i; - Jacobian.AddVal2Diag(iPoint, Jacobian_i); + if (implicit) Jacobian.AddVal2Diag(iPoint, -Jacobian_i); } } } @@ -536,6 +497,8 @@ void CTurbSASolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_con void CTurbSASolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) for (auto iVertex = 0u; iVertex < geometry->nVertex[val_marker]; iVertex++) { @@ -578,7 +541,7 @@ void CTurbSASolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container /*--- Add residuals and Jacobians ---*/ LinSysRes.AddBlock(iPoint, residual); - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } } @@ -588,6 +551,8 @@ void CTurbSASolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + /*--- Loop over all the vertices on this boundary marker ---*/ SU2_OMP_FOR_STAT(OMP_MIN_SIZE) @@ -637,11 +602,14 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN /*--- Jacobian contribution for implicit integration ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // visc_numerics->SetNormal(Normal); // // /*--- Conservative variables w/o reconstruction ---*/ @@ -670,6 +638,8 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + /*--- Loop over all the vertices on this boundary marker ---*/ SU2_OMP_FOR_STAT(OMP_MIN_SIZE) @@ -717,11 +687,14 @@ void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, C /*--- Jacobian contribution for implicit integration ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // visc_numerics->SetNormal(Normal); // // /*--- Conservative variables w/o reconstruction ---*/ @@ -750,6 +723,8 @@ void CTurbSASolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, C void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + /*--- Loop over all the vertices on this boundary marker ---*/ SU2_OMP_FOR_STAT(OMP_MIN_SIZE) @@ -799,11 +774,14 @@ void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_conta /*--- Jacobian contribution for implicit integration ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // visc_numerics->SetNormal(Normal); // // /*--- Conservative variables w/o reconstruction ---*/ @@ -833,6 +811,8 @@ void CTurbSASolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_conta void CTurbSASolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + /*--- Loop over all the vertices on this boundary marker ---*/ SU2_OMP_FOR_STAT(OMP_MIN_SIZE) @@ -883,11 +863,14 @@ void CTurbSASolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_cont /*--- Jacobian contribution for implicit integration ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // visc_numerics->SetNormal(Normal); // // /*--- Conservative variables w/o reconstruction ---*/ @@ -929,6 +912,8 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker, bool val_inlet_surface) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + /*--- Loop over all the vertices on this boundary marker ---*/ SU2_OMP_FOR_STAT(OMP_MIN_SIZE) @@ -1026,12 +1011,15 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, /*--- Jacobian contribution for implicit integration ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // // visc_numerics->SetNormal(Normal); -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->node[iPoint_Normal]->GetCoord()); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // // /*--- Conservative variables w/o reconstruction ---*/ // @@ -1060,6 +1048,7 @@ void CTurbSASolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto nSpanWiseSections = config->GetnSpanWiseSections(); /*--- Loop over all the vertices on this boundary marker ---*/ @@ -1116,12 +1105,13 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c /*--- Jacobian contribution for implicit integration ---*/ LinSysRes.AddBlock(iPoint, conv_residual); - Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); /*--- Viscous contribution ---*/ - - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); /*--- Conservative variables w/o reconstruction ---*/ @@ -1142,7 +1132,7 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c /*--- Subtract residual, and update Jacobians ---*/ LinSysRes.SubtractBlock(iPoint, visc_residual); - Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); } } @@ -1152,6 +1142,7 @@ void CTurbSASolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_c void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto nSpanWiseSections = config->GetnSpanWiseSections(); CFluidModel *FluidModel = solver_container[FLOW_SOL]->GetFluidModel(); @@ -1216,12 +1207,14 @@ void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contain /*--- Jacobian contribution for implicit integration ---*/ LinSysRes.AddBlock(iPoint, conv_residual); - Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); /*--- Viscous contribution ---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); @@ -1243,7 +1236,7 @@ void CTurbSASolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contain /*--- Subtract residual, and update Jacobians ---*/ LinSysRes.SubtractBlock(iPoint, visc_residual); - Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); } } @@ -1577,8 +1570,9 @@ void CTurbSASolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_ } void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, - CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + CNumerics *visc_numerics, const CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const su2double Gas_Constant = config->GetGas_ConstantND(); const su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant; @@ -1717,7 +1711,7 @@ void CTurbSASolver::SetNuTilde_WF(CGeometry *geometry, CSolver **solver_containe /*--- includes 1 in the diagonal ---*/ - Jacobian.DeleteValsRowi(Point_Normal); + if (implicit) Jacobian.DeleteValsRowi(Point_Normal); } diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index bbf3cb70f9df..c03e2295c191 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -2,7 +2,7 @@ * \file CTurbSSTSolver.cpp * \brief Main subrotuines of CTurbSSTSolver class * \author F. Palacios, A. Bueno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -91,6 +91,7 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned sh LinSysSol.Initialize(nPoint, nPointDomain, nVar, 0.0); LinSysRes.Initialize(nPoint, nPointDomain, nVar, 0.0); + System.SetxIsZero(true); if (ReducerStrategy) EdgeFluxes.Initialize(geometry->GetnEdge(), geometry->GetnEdge(), nVar, nullptr); @@ -159,33 +160,25 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned sh /*--- Initializate quantities for SlidingMesh Interface ---*/ - unsigned long iMarker; + SlidingState.resize(nMarker); + SlidingStateNodes.resize(nMarker); - SlidingState = new su2double*** [nMarker](); - SlidingStateNodes = new int* [nMarker](); - - for (iMarker = 0; iMarker < nMarker; iMarker++){ - - if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE){ - - SlidingState[iMarker] = new su2double**[geometry->GetnVertex(iMarker)](); - SlidingStateNodes[iMarker] = new int [geometry->GetnVertex(iMarker)](); - - for (iPoint = 0; iPoint < geometry->GetnVertex(iMarker); iPoint++) - SlidingState[iMarker][iPoint] = new su2double*[nPrimVar+1](); + for (unsigned long iMarker = 0; iMarker < nMarker; iMarker++) { + if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE) { + SlidingState[iMarker].resize(nVertex[iMarker], nPrimVar+1) = nullptr; + SlidingStateNodes[iMarker].resize(nVertex[iMarker],0); } } /*-- Allocation of inlets has to happen in derived classes (not CTurbSolver), due to arbitrary number of turbulence variables ---*/ - Inlet_TurbVars = new su2double**[nMarker]; + Inlet_TurbVars.resize(nMarker); for (unsigned long iMarker = 0; iMarker < nMarker; iMarker++) { - Inlet_TurbVars[iMarker] = new su2double*[nVertex[iMarker]]; - for(unsigned long iVertex=0; iVertex < nVertex[iMarker]; iVertex++){ - Inlet_TurbVars[iMarker][iVertex] = new su2double[nVar]; - Inlet_TurbVars[iMarker][iVertex][0] = kine_Inf; - Inlet_TurbVars[iMarker][iVertex][1] = omega_Inf; + Inlet_TurbVars[iMarker].resize(nVertex[iMarker],nVar); + for (unsigned long iVertex = 0; iVertex < nVertex[iMarker]; ++iVertex) { + Inlet_TurbVars[iMarker](iVertex,0) = kine_Inf; + Inlet_TurbVars[iMarker](iVertex,1) = omega_Inf; } } @@ -209,39 +202,10 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned sh } -CTurbSSTSolver::~CTurbSSTSolver(void) { - - unsigned long iMarker, iVertex; - unsigned short iVar; - - if ( SlidingState != nullptr ) { - for (iMarker = 0; iMarker < nMarker; iMarker++) { - if ( SlidingState[iMarker] != nullptr ) { - for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) - if ( SlidingState[iMarker][iVertex] != nullptr ){ - for (iVar = 0; iVar < nPrimVar+1; iVar++) - delete [] SlidingState[iMarker][iVertex][iVar]; - delete [] SlidingState[iMarker][iVertex]; - } - delete [] SlidingState[iMarker]; - } - } - delete [] SlidingState; - } - - if ( SlidingStateNodes != nullptr ){ - for (iMarker = 0; iMarker < nMarker; iMarker++){ - if (SlidingStateNodes[iMarker] != nullptr) - delete [] SlidingStateNodes[iMarker]; - } - delete [] SlidingStateNodes; - } - -} - void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool muscl = config->GetMUSCL_Turb(); const bool limiter = (config->GetKind_SlopeLimit_Turb() != NO_LIMITER) && (config->GetInnerIter() <= config->GetLimiterIter()); @@ -250,12 +214,13 @@ void CTurbSSTSolver::Preprocessing(CGeometry *geometry, CSolver **solver_contain * reducer strategy as we write over the entire matrix. ---*/ if (!ReducerStrategy) { LinSysRes.SetValZero(); - Jacobian.SetValZero(); + if (implicit) Jacobian.SetValZero(); + else {SU2_OMP_BARRIER} } /*--- Upwind second order reconstruction and gradients ---*/ - if (config->GetReconstructionGradientRequired() && muscl) { + if (config->GetReconstructionGradientRequired()) { if (config->GetKind_Gradient_Method_Recon() == GREEN_GAUSS) SetSolution_Gradient_GG(geometry, config, true); if (config->GetKind_Gradient_Method_Recon() == LEAST_SQUARES) @@ -323,6 +288,10 @@ void CTurbSSTSolver::Postprocessing(CGeometry *geometry, CSolver **solver_contai void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { + bool axisymmetric = config->GetAxisymmetric(); + + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + CVariable* flowNodes = solver_container[FLOW_SOL]->GetNodes(); /*--- Pick one numerics object per thread. ---*/ @@ -372,6 +341,11 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta numerics->SetCrossDiff(nodes->GetCrossDiff(iPoint),0.0); + if (axisymmetric){ + /*--- Set y coordinate ---*/ + numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint)); + } + /*--- Compute the source term ---*/ auto residual = numerics->ComputeResidual(config); @@ -379,7 +353,7 @@ void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_conta /*--- Subtract residual and the Jacobian ---*/ LinSysRes.SubtractBlock(iPoint, residual); - Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, residual.jacobian_i); } @@ -391,6 +365,9 @@ void CTurbSSTSolver::Source_Template(CGeometry *geometry, CSolver **solver_conta void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + bool rough_wall = false; string Marker_Tag = config->GetMarker_All_TagBound(val_marker); unsigned short WallType; su2double Roughness_Height; @@ -466,9 +443,11 @@ void CTurbSSTSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_cont LinSysRes.SetBlock_Zero(iPoint); } - /*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/ - Jacobian.DeleteValsRowi(iPoint*nVar); - Jacobian.DeleteValsRowi(iPoint*nVar+1); + if (implicit) { + /*--- Change rows of the Jacobian (includes 1 in the diagonal) ---*/ + Jacobian.DeleteValsRowi(iPoint*nVar); + Jacobian.DeleteValsRowi(iPoint*nVar+1); + } } } } @@ -483,6 +462,8 @@ void CTurbSSTSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_co void CTurbSSTSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + SU2_OMP_FOR_STAT(OMP_MIN_SIZE) for (auto iVertex = 0u; iVertex < geometry->nVertex[val_marker]; iVertex++) { @@ -528,7 +509,7 @@ void CTurbSSTSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe /*--- Add residuals and Jacobians ---*/ LinSysRes.AddBlock(iPoint, residual); - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); } } @@ -537,6 +518,8 @@ void CTurbSSTSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_containe void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + /*--- Loop over all the vertices on this boundary marker ---*/ SU2_OMP_FOR_STAT(OMP_MIN_SIZE) @@ -587,11 +570,14 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C /*--- Jacobian contribution for implicit integration ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // - // visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + // su2double Coord_Reflected[MAXNDIM]; + // GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + // geometry->nodes->GetCoord(iPoint), Coord_Reflected); + // visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // visc_numerics->SetNormal(Normal); // // /*--- Conservative variables w/o reconstruction ---*/ @@ -625,6 +611,8 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + /*--- Loop over all the vertices on this boundary marker ---*/ SU2_OMP_FOR_STAT(OMP_MIN_SIZE) @@ -673,11 +661,14 @@ void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, /*--- Jacobian contribution for implicit integration ---*/ - Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); // /*--- Viscous contribution, commented out because serious convergence problems ---*/ // -// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); +// su2double Coord_Reflected[MAXNDIM]; +// GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), +// geometry->nodes->GetCoord(iPoint), Coord_Reflected); +// visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); // visc_numerics->SetNormal(Normal); // // /*--- Conservative variables w/o reconstruction ---*/ @@ -711,6 +702,8 @@ void CTurbSSTSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const auto nSpanWiseSections = config->GetnSpanWiseSections(); /*--- Loop over all the vertices on this boundary marker ---*/ @@ -766,10 +759,13 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_ /*--- Jacobian contribution for implicit integration ---*/ LinSysRes.AddBlock(iPoint, conv_residual); - Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); /*--- Viscous contribution ---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); /*--- Conservative variables w/o reconstruction ---*/ @@ -787,7 +783,7 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_ /*--- Subtract residual, and update Jacobians ---*/ LinSysRes.SubtractBlock(iPoint, visc_residual); - Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); } } @@ -797,6 +793,8 @@ void CTurbSSTSolver::BC_Inlet_MixingPlane(CGeometry *geometry, CSolver **solver_ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const auto nSpanWiseSections = config->GetnSpanWiseSections(); /*--- Quantities for computing the kine and omega to impose at the inlet boundary. ---*/ @@ -870,11 +868,13 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai /*--- Jacobian contribution for implicit integration ---*/ LinSysRes.AddBlock(iPoint, conv_residual); - Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); + if (implicit) Jacobian.AddBlock2Diag(iPoint, conv_residual.jacobian_i); /*--- Viscous contribution ---*/ - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), - geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); visc_numerics->SetNormal(Normal); /*--- Conservative variables w/o reconstruction ---*/ @@ -893,7 +893,7 @@ void CTurbSSTSolver::BC_Inlet_Turbo(CGeometry *geometry, CSolver **solver_contai /*--- Subtract residual, and update Jacobians ---*/ LinSysRes.SubtractBlock(iPoint, visc_residual); - Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); + if (implicit) Jacobian.SubtractBlock2Diag(iPoint, visc_residual.jacobian_i); } } diff --git a/SU2_CFD/src/solvers/CTurbSolver.cpp b/SU2_CFD/src/solvers/CTurbSolver.cpp index e11eb22fa2d9..66d9a7c83081 100644 --- a/SU2_CFD/src/solvers/CTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSolver.cpp @@ -2,7 +2,7 @@ * \file CTurbSolver.cpp * \brief Main subrotuines of CTurbSolver class * \author F. Palacios, A. Bueno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -27,6 +27,7 @@ #include "../../include/solvers/CTurbSolver.hpp" #include "../../../Common/include/parallelization/omp_structure.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" CTurbSolver::CTurbSolver(void) : CSolver() { } @@ -74,16 +75,8 @@ CTurbSolver::CTurbSolver(CGeometry* geometry, CConfig *config) : CSolver() { CTurbSolver::~CTurbSolver(void) { - if (Inlet_TurbVars != nullptr) { - for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) { - if (Inlet_TurbVars[iMarker] != nullptr) { - for (unsigned long iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) { - delete [] Inlet_TurbVars[iMarker][iVertex]; - } - delete [] Inlet_TurbVars[iMarker]; - } - } - delete [] Inlet_TurbVars; + for (auto& mat : SlidingState) { + for (auto ptr : mat) delete [] ptr; } delete nodes; @@ -92,6 +85,7 @@ CTurbSolver::~CTurbSolver(void) { void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const bool muscl = config->GetMUSCL_Turb(); const bool limiter = (config->GetKind_SlopeLimit_Turb() != NO_LIMITER); @@ -221,12 +215,12 @@ void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe if (ReducerStrategy) { EdgeFluxes.SetBlock(iEdge, residual); - Jacobian.SetBlocks(iEdge, residual.jacobian_i, residual.jacobian_j); + if (implicit) Jacobian.SetBlocks(iEdge, residual.jacobian_i, residual.jacobian_j); } else { LinSysRes.AddBlock(iPoint, residual); LinSysRes.SubtractBlock(jPoint, residual); - Jacobian.UpdateBlocks(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + if (implicit) Jacobian.UpdateBlocks(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); } /*--- Viscous contribution. ---*/ @@ -238,13 +232,14 @@ void CTurbSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_containe if (ReducerStrategy) { SumEdgeFluxes(geometry); - Jacobian.SetDiagonalAsColumnSum(); + if (implicit) Jacobian.SetDiagonalAsColumnSum(); } } void CTurbSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config) { + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); CVariable* flowNodes = solver_container[FLOW_SOL]->GetNodes(); /*--- Points in edge ---*/ @@ -286,12 +281,12 @@ void CTurbSolver::Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSo if (ReducerStrategy) { EdgeFluxes.SubtractBlock(iEdge, residual); - Jacobian.UpdateBlocksSub(iEdge, residual.jacobian_i, residual.jacobian_j); + if (implicit) Jacobian.UpdateBlocksSub(iEdge, residual.jacobian_i, residual.jacobian_j); } else { LinSysRes.SubtractBlock(iPoint, residual); LinSysRes.AddBlock(jPoint, residual); - Jacobian.UpdateBlocksSub(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); + if (implicit) Jacobian.UpdateBlocksSub(iEdge, iPoint, jPoint, residual.jacobian_i, residual.jacobian_j); } } @@ -478,7 +473,10 @@ void CTurbSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_conta /*--- Set the normal vector and the coordinates ---*/ visc_numerics->SetNormal(Normal); - visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(Point_Normal)); + su2double Coord_Reflected[MAXNDIM]; + GeometryToolbox::PointPointReflect(nDim, geometry->nodes->GetCoord(Point_Normal), + geometry->nodes->GetCoord(iPoint), Coord_Reflected); + visc_numerics->SetCoord(geometry->nodes->GetCoord(iPoint), Coord_Reflected); /*--- Primitive variables ---*/ @@ -510,12 +508,9 @@ void CTurbSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_conta } -void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { +void CTurbSolver::PrepareImplicitIteration(CGeometry *geometry, CSolver** solver_container, CConfig *config) { - const bool adjoint = config->GetContinuous_Adjoint() || (config->GetDiscrete_Adjoint() && config->GetFrozen_Visc_Disc()); - const bool compressible = (config->GetKind_Regime() == COMPRESSIBLE); - - CVariable* flowNodes = solver_container[FLOW_SOL]->GetNodes(); + const auto flowNodes = solver_container[FLOW_SOL]->GetNodes(); /*--- Set shared residual variables to 0 and declare * local ones for current thread to work on. ---*/ @@ -536,14 +531,20 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ SU2_OMP(for schedule(static,omp_chunk_size) nowait) for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { - /*--- Read the volume ---*/ - - su2double Vol = (geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint)); + /// TODO: This could be the SetTime_Step of this solver. + su2double dt = nodes->GetLocalCFL(iPoint) / flowNodes->GetLocalCFL(iPoint) * flowNodes->GetDelta_Time(iPoint); + nodes->SetDelta_Time(iPoint, dt); - /*--- Modify matrix diagonal to assure diagonal dominance ---*/ + /*--- Modify matrix diagonal to improve diagonal dominance. ---*/ - su2double Delta = Vol / ((nodes->GetLocalCFL(iPoint)/flowNodes->GetLocalCFL(iPoint))*flowNodes->GetDelta_Time(iPoint)); - Jacobian.AddVal2Diag(iPoint, Delta); + if (dt != 0.0) { + su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); + Jacobian.AddVal2Diag(iPoint, Vol / dt); + } + else { + Jacobian.SetVal2Diag(iPoint, 1.0); + LinSysRes.SetBlock_Zero(iPoint); + } /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/ @@ -566,32 +567,21 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ AddRes_RMS(iVar, resRMS[iVar]); AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]); } + SU2_OMP_BARRIER - /*--- Initialize residual and solution at the ghost points ---*/ - - SU2_OMP(sections) - { - SU2_OMP(section) - for (unsigned long iPoint = nPointDomain; iPoint < nPoint; iPoint++) - LinSysRes.SetBlock_Zero(iPoint); - - SU2_OMP(section) - for (unsigned long iPoint = nPointDomain; iPoint < nPoint; iPoint++) - LinSysSol.SetBlock_Zero(iPoint); - } - - /*--- Solve or smooth the linear system ---*/ - - auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + /*--- Compute the root mean square residual ---*/ SU2_OMP_MASTER - { - SetIterLinSolver(iter); - SetResLinSolver(System.GetResidual()); - } + SetResidual_RMS(geometry, config); SU2_OMP_BARRIER +} + +void CTurbSolver::CompleteImplicitIteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + + const bool compressible = (config->GetKind_Regime() == COMPRESSIBLE); + const auto flowNodes = solver_container[FLOW_SOL]->GetNodes(); - ComputeUnderRelaxationFactor(solver_container, config); + ComputeUnderRelaxationFactor(config); /*--- Update solution (system written in terms of increments) ---*/ @@ -636,19 +626,36 @@ void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); } - /*--- MPI solution ---*/ - InitiateComms(geometry, config, SOLUTION_EDDY); CompleteComms(geometry, config, SOLUTION_EDDY); - /*--- Compute the root mean square residual ---*/ - SU2_OMP_MASTER - SetResidual_RMS(geometry, config); +} + +void CTurbSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) { + + PrepareImplicitIteration(geometry, solver_container, config); + + /*--- Solve or smooth the linear system. ---*/ + + SU2_OMP(for schedule(static,OMP_MIN_SIZE) nowait) + for (unsigned long iPoint = nPointDomain; iPoint < nPoint; iPoint++) { + LinSysRes.SetBlock_Zero(iPoint); + LinSysSol.SetBlock_Zero(iPoint); + } + + auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + + SU2_OMP_MASTER { + SetIterLinSolver(iter); + SetResLinSolver(System.GetResidual()); + } SU2_OMP_BARRIER + CompleteImplicitIteration(geometry, solver_container, config); + } -void CTurbSolver::ComputeUnderRelaxationFactor(CSolver **solver_container, const CConfig *config) { +void CTurbSolver::ComputeUnderRelaxationFactor(const CConfig *config) { /* Only apply the turbulent under-relaxation to the SA variants. The SA_NEG model is more robust due to allowing for negative nu_tilde, @@ -830,7 +837,7 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con GridVel_j = geometry->nodes->GetGridVel(jPoint); /*--- Determine whether to consider the normal outward or inward. ---*/ - su2double dir = (geometry->edges->GetNode(iEdge,0) == iPoint)? 0.5 : -0.5; + su2double dir = (iPoint < jPoint)? 0.5 : -0.5; Residual_GCL = 0.0; for (iDim = 0; iDim < nDim; iDim++) diff --git a/SU2_CFD/src/variables/CAdjEulerVariable.cpp b/SU2_CFD/src/variables/CAdjEulerVariable.cpp index 316e18c10546..d8a7c6476fae 100644 --- a/SU2_CFD/src/variables/CAdjEulerVariable.cpp +++ b/SU2_CFD/src/variables/CAdjEulerVariable.cpp @@ -2,7 +2,7 @@ * \file CAdjEulerVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CAdjNSVariable.cpp b/SU2_CFD/src/variables/CAdjNSVariable.cpp index 736929dff7e3..a05de3455b7f 100644 --- a/SU2_CFD/src/variables/CAdjNSVariable.cpp +++ b/SU2_CFD/src/variables/CAdjNSVariable.cpp @@ -2,7 +2,7 @@ * \file CAdjNSVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CAdjTurbVariable.cpp b/SU2_CFD/src/variables/CAdjTurbVariable.cpp index 4836b89d55d9..bebcfde9939c 100644 --- a/SU2_CFD/src/variables/CAdjTurbVariable.cpp +++ b/SU2_CFD/src/variables/CAdjTurbVariable.cpp @@ -2,7 +2,7 @@ * \file CAdjTurbVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, A. Bueno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CBaselineVariable.cpp b/SU2_CFD/src/variables/CBaselineVariable.cpp index 1df84c3198aa..1cc0c7967329 100644 --- a/SU2_CFD/src/variables/CBaselineVariable.cpp +++ b/SU2_CFD/src/variables/CBaselineVariable.cpp @@ -2,7 +2,7 @@ * \file CBaselineVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp b/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp index a71c32ecf81f..0d322292024d 100644 --- a/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjFEABoundVariable.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjFEAVariable.cpp * \brief Definition of the variables for FEM adjoint elastic structural problems. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp index 41f451a5c3a0..87765f8a6642 100644 --- a/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjFEAVariable.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjFEAVariable.cpp * \brief Definition of the variables for FEM adjoint elastic structural problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp b/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp index fe8781d65ded..0d3b6cbfd31c 100644 --- a/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjMeshBoundVariable.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjMeshVariable.cpp * \brief Main subroutines for the discrete adjoint mesh variable structure. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CDiscAdjVariable.cpp b/SU2_CFD/src/variables/CDiscAdjVariable.cpp index c8ed3cb3575f..178cc024d922 100644 --- a/SU2_CFD/src/variables/CDiscAdjVariable.cpp +++ b/SU2_CFD/src/variables/CDiscAdjVariable.cpp @@ -2,7 +2,7 @@ * \file CDiscAdjVariable.cpp * \brief Main subroutines for the discrete adjoint variable structure. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CEulerVariable.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp index ccc28bcf1014..cd7bcbcc4fbc 100644 --- a/SU2_CFD/src/variables/CEulerVariable.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -2,7 +2,7 @@ * \file CEulerVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -32,11 +32,11 @@ CEulerVariable::CEulerVariable(su2double density, const su2double *velocity, su2 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 windgust = config->GetWind_Gust(); - bool classical_rk4 = (config->GetKind_TimeIntScheme_Flow() == CLASSICAL_RK4_EXPLICIT); + const bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); + const bool viscous = config->GetViscous(); + const bool windgust = config->GetWind_Gust(); + const bool classical_rk4 = (config->GetKind_TimeIntScheme_Flow() == CLASSICAL_RK4_EXPLICIT); /*--- Allocate and initialize the primitive variables and gradients ---*/ @@ -59,19 +59,19 @@ CEulerVariable::CEulerVariable(su2double density, const su2double *velocity, su2 } } - /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ + /*--- Allocate undivided laplacian (centered) ---*/ 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 - ) ---*/ + /*--- Allocate the slope limiter (MUSCL upwind) ---*/ - 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); + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER && + config->GetKind_SlopeLimit_Flow() != VAN_ALBADA_EDGE) { + Limiter_Primitive.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Max.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Min.resize(nPoint,nPrimVarGrad) = su2double(0.0); + } /*--- Solution initialization ---*/ @@ -107,17 +107,19 @@ CEulerVariable::CEulerVariable(su2double density, const su2double *velocity, su2 WindGustDer.resize(nPoint,nDim+1); } - /*--- Compressible flow, primitive variables nDim+5, (T, vx, vy, vz, P, rho, h, c) ---*/ + /*--- Compressible flow, primitive variables (T, vx, vy, vz, P, rho, h, c, mu, mut, k, Cp) ---*/ Primitive.resize(nPoint,nPrimVar) = su2double(0.0); Secondary.resize(nPoint,nSecondaryVar) = su2double(0.0); - /*--- Compressible flow, gradients primitive variables nDim+4, (T, vx, vy, vz, P, rho, h) - We need P, and rho for running the adjoint problem ---*/ + /*--- Compressible flow, gradients primitive variables (T, vx, vy, vz, P, rho, h) ---*/ - Gradient_Primitive.resize(nPoint,nPrimVarGrad,nDim,0.0); + if (config->GetMUSCL_Flow() || viscous) { + Gradient_Primitive.resize(nPoint,nPrimVarGrad,nDim,0.0); + } - if (config->GetReconstructionGradientRequired()) { + if (config->GetReconstructionGradientRequired() && + config->GetKind_ConvNumScheme_Flow() != SPACE_CENTERED) { Gradient_Aux.resize(nPoint,nPrimVarGrad,nDim,0.0); } diff --git a/SU2_CFD/src/variables/CFEABoundVariable.cpp b/SU2_CFD/src/variables/CFEABoundVariable.cpp index b493f9510eb9..a60eb0803f2f 100644 --- a/SU2_CFD/src/variables/CFEABoundVariable.cpp +++ b/SU2_CFD/src/variables/CFEABoundVariable.cpp @@ -2,7 +2,7 @@ * \file CFEABoundVariable.cpp * \brief Definition of the variables for FEM elastic structural problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CFEAVariable.cpp b/SU2_CFD/src/variables/CFEAVariable.cpp index b585a7da058a..fb6d808f6456 100644 --- a/SU2_CFD/src/variables/CFEAVariable.cpp +++ b/SU2_CFD/src/variables/CFEAVariable.cpp @@ -2,7 +2,7 @@ * \file CFEAVariable.cpp * \brief Definition of the variables for FEM elastic structural problems. * \author R. Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CHeatVariable.cpp b/SU2_CFD/src/variables/CHeatVariable.cpp index 3eb6ffb8ff82..461077a15a42 100644 --- a/SU2_CFD/src/variables/CHeatVariable.cpp +++ b/SU2_CFD/src/variables/CHeatVariable.cpp @@ -2,7 +2,7 @@ * \file CHeatVariable.cpp * \brief Definition of the variables for heat equation problems. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CIncEulerVariable.cpp b/SU2_CFD/src/variables/CIncEulerVariable.cpp index 35873c08a7a3..e4f24b18622e 100644 --- a/SU2_CFD/src/variables/CIncEulerVariable.cpp +++ b/SU2_CFD/src/variables/CIncEulerVariable.cpp @@ -2,7 +2,7 @@ * \file CIncEulerVariable.cpp * \brief Definition of the variable classes for incompressible flow. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -32,10 +32,12 @@ CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *veloci 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); + const bool dual_time = (config->GetTime_Marching() == DT_STEPPING_1ST) || + (config->GetTime_Marching() == DT_STEPPING_2ND); + const bool viscous = config->GetViscous(); - /*--- Allocate and initialize the primitive variables and gradients ---*/ + /*--- Allocate and initialize the primitive variables and gradients. + Make sure to align the sizes with the constructor of CIncEulerSolver ---*/ nPrimVar = nDim+9; nPrimVarGrad = nDim+4; @@ -53,20 +55,19 @@ CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *veloci } } - /*--- Allocate undivided laplacian (centered) and limiter (upwind)---*/ + /*--- Allocate undivided laplacian (centered) ---*/ 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 - ) ---*/ + /*--- Allocate the slope limiter (MUSCL upwind) ---*/ - 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); + if (config->GetKind_SlopeLimit_Flow() != NO_LIMITER && + config->GetKind_SlopeLimit_Flow() != VAN_ALBADA_EDGE) { + Limiter_Primitive.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Max.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Min.resize(nPoint,nPrimVarGrad) = su2double(0.0); + } /*--- Solution initialization ---*/ @@ -90,12 +91,14 @@ CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *veloci Primitive.resize(nPoint,nPrimVar) = su2double(0.0); - /*--- Incompressible flow, gradients primitive variables nDim+4, (P, vx, vy, vz, T, rho, beta), - We need P, and rho for running the adjoint problem ---*/ + /*--- Incompressible flow, gradients primitive variables nDim+4, (P, vx, vy, vz, T, rho, beta) ---*/ - Gradient_Primitive.resize(nPoint,nPrimVarGrad,nDim,0.0); + if (config->GetMUSCL_Flow() || viscous) { + Gradient_Primitive.resize(nPoint,nPrimVarGrad,nDim,0.0); + } - if (config->GetReconstructionGradientRequired()) { + if (config->GetReconstructionGradientRequired() && + config->GetKind_ConvNumScheme_Flow() != SPACE_CENTERED) { Gradient_Aux.resize(nPoint,nPrimVarGrad,nDim,0.0); } @@ -106,13 +109,18 @@ CIncEulerVariable::CIncEulerVariable(su2double pressure, const su2double *veloci if (config->GetMultizone_Problem()) Set_BGSSolution_k(); - Density_Old.resize(nPoint) = su2double(0.0); Velocity2.resize(nPoint) = su2double(0.0); Max_Lambda_Inv.resize(nPoint) = su2double(0.0); Delta_Time.resize(nPoint) = su2double(0.0); Lambda.resize(nPoint) = su2double(0.0); Sensor.resize(nPoint) = su2double(0.0); + if (config->GetKind_Streamwise_Periodic() != NONE) { + Streamwise_Periodic_RecoveredPressure.resize(nPoint) = su2double(0.0); + if (config->GetStreamwise_Periodic_Temperature()) + Streamwise_Periodic_RecoveredTemperature.resize(nPoint) = su2double(0.0); + } + /* Under-relaxation parameter. */ UnderRelaxation.resize(nPoint) = su2double(1.0); LocalCFL.resize(nPoint) = su2double(0.0); @@ -128,10 +136,6 @@ bool CIncEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel unsigned long iVar; bool check_dens = false, check_temp = false, physical = true; - /*--- Store the density from the previous iteration. ---*/ - - Density_Old(iPoint) = GetDensity(iPoint); - /*--- Set the value of the pressure ---*/ SetPressure(iPoint); diff --git a/SU2_CFD/src/variables/CIncNSVariable.cpp b/SU2_CFD/src/variables/CIncNSVariable.cpp index 0eb93a1946fc..1505fb42b6e1 100644 --- a/SU2_CFD/src/variables/CIncNSVariable.cpp +++ b/SU2_CFD/src/variables/CIncNSVariable.cpp @@ -2,7 +2,7 @@ * \file CIncNSVariable.cpp * \brief Definition of the variable classes for incompressible flow. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -42,70 +42,20 @@ CIncNSVariable::CIncNSVariable(su2double pressure, const su2double *velocity, su AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } -} - -bool CIncNSVariable::SetVorticity_StrainMag() { - - 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 ---*/ - - AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive[iPoint], nDim+1, nDim); - - 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)); - - AD::SetPreaccOut(StrainMag(iPoint)); - AD::EndPreacc(); + /*--- Allocate memory for the AuxVar+gradient of eddy viscosity mu_t ---*/ + if (config->GetStreamwise_Periodic_Temperature() && (config->GetKind_Turb_Model() != NONE)) { + nAuxVar = 1; + AuxVar.resize(nPoint,nAuxVar) = su2double(0.0); + Grad_AuxVar.resize(nPoint,nAuxVar,nDim); } - return false; } - bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) { unsigned short iVar; bool check_dens = false, check_temp = false, physical = true; - /*--- Store the density from the previous iteration. ---*/ - - Density_Old(iPoint) = GetDensity(iPoint); - /*--- Set the value of the pressure ---*/ SetPressure(iPoint); diff --git a/SU2_CFD/src/variables/CMeshBoundVariable.cpp b/SU2_CFD/src/variables/CMeshBoundVariable.cpp index 780496fc5433..82cf0b2698c6 100644 --- a/SU2_CFD/src/variables/CMeshBoundVariable.cpp +++ b/SU2_CFD/src/variables/CMeshBoundVariable.cpp @@ -2,7 +2,7 @@ * \file CMeshBoundVariable.cpp * \brief Definition of the boundary variables for mesh motion using a pseudo-elastic approach. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CMeshElement.cpp b/SU2_CFD/src/variables/CMeshElement.cpp index c25d38a63903..53454882f9d9 100644 --- a/SU2_CFD/src/variables/CMeshElement.cpp +++ b/SU2_CFD/src/variables/CMeshElement.cpp @@ -2,7 +2,7 @@ * \file CMeshElement.cpp * \brief Definition of the mesh elements for mesh deformation using a pseudo-elastic approach. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CMeshVariable.cpp b/SU2_CFD/src/variables/CMeshVariable.cpp index f2bf92d5c81b..d7b0ce383ad5 100644 --- a/SU2_CFD/src/variables/CMeshVariable.cpp +++ b/SU2_CFD/src/variables/CMeshVariable.cpp @@ -2,7 +2,7 @@ * \file CMeshVariable.cpp * \brief Definition of the variables for mesh motion using a pseudo-elastic approach. * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CNEMOEulerVariable.cpp b/SU2_CFD/src/variables/CNEMOEulerVariable.cpp index b50e200e18a4..4424ab95808f 100644 --- a/SU2_CFD/src/variables/CNEMOEulerVariable.cpp +++ b/SU2_CFD/src/variables/CNEMOEulerVariable.cpp @@ -1,351 +1,352 @@ -/*! - * \file CNEMOEulerVariable.cpp - * \brief Definition of the solution fields. - * \author C. Garbacz, W. Maier, S.R. Copeland - * \version 7.1.0 "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/variables/CNEMOEulerVariable.hpp" -#include - -CNEMOEulerVariable::CNEMOEulerVariable(su2double val_pressure, - const su2double *val_massfrac, - su2double *val_mach, - su2double val_temperature, - su2double val_temperature_ve, - unsigned long npoint, - unsigned long ndim, - unsigned long nvar, - unsigned long nvarprim, - unsigned long nvarprimgrad, - CConfig *config, - CNEMOGas *fluidmodel) : CVariable(npoint, - ndim, - nvar, - config ), - Gradient_Reconstruction(config->GetReconstructionGradientRequired() ? Gradient_Aux : Gradient_Primitive) { - - vector energies; - unsigned short iDim, iSpecies; - su2double soundspeed, sqvel, rho; - - /*--- Setting variable amounts ---*/ - nDim = ndim; - nPrimVar = nvarprim; - nPrimVarGrad = nvarprimgrad; - - nSpecies = config->GetnSpecies(); - RHOS_INDEX = 0; - T_INDEX = nSpecies; - TVE_INDEX = nSpecies+1; - VEL_INDEX = nSpecies+2; - P_INDEX = nSpecies+nDim+2; - RHO_INDEX = nSpecies+nDim+3; - H_INDEX = nSpecies+nDim+4; - A_INDEX = nSpecies+nDim+5; - RHOCVTR_INDEX = nSpecies+nDim+6; - RHOCVVE_INDEX = nSpecies+nDim+7; - LAM_VISC_INDEX = nSpecies+nDim+8; - EDDY_VISC_INDEX = nSpecies+nDim+9; - - /*--- Set monoatomic flag ---*/ - if (config->GetMonoatomic()) { - monoatomic = true; - Tve_Freestream = config->GetTemperature_ve_FreeStream(); - } - - /*--- Allocate & initialize residual vectors ---*/ - Res_TruncError.resize(nPoint,nVar) = su2double(0.0); - - /*--- Size Grad_AuxVar for axiysmmetric ---*/ - if (config->GetAxisymmetric()){ - nAuxVar = 3; - Grad_AuxVar.resize(nPoint,nAuxVar,nDim,0.0); - AuxVar.resize(nPoint,nAuxVar) = 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.resize(nPoint,nVar) = su2double(0.0); - Limiter_Primitive.resize(nPoint,nPrimVarGrad) = su2double(0.0); - - Solution_Max.resize(nPoint,nPrimVarGrad) = su2double(0.0); - Solution_Min.resize(nPoint,nPrimVarGrad) = su2double(0.0); - - /*--- Primitive and secondary variables ---*/ - Primitive.resize(nPoint,nPrimVar) = su2double(0.0); - Primitive_Aux.resize(nPoint,nPrimVar) = su2double(0.0); - Secondary.resize(nPoint,nPrimVar) = su2double(0.0); - - dPdU.resize(nPoint, nVar) = su2double(0.0); - dTdU.resize(nPoint, nVar) = su2double(0.0); - dTvedU.resize(nPoint, nVar) = su2double(0.0); - Cvves.resize(nPoint, nSpecies) = su2double(0.0); - eves.resize(nPoint, nSpecies) = su2double(0.0); - Gamma.resize(nPoint) = su2double(0.0); - - /*--- Compressible flow, gradients primitive variables ---*/ - Gradient_Primitive.resize(nPoint,nPrimVarGrad,nDim,0.0); - Gradient.resize(nPoint,nVar,nDim,0.0); - - if (config->GetReconstructionGradientRequired()) { - Gradient_Aux.resize(nPoint,nPrimVarGrad,nDim,0.0); - } - - if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { - Rmatrix.resize(nPoint,nDim,nDim,0.0); - } - - Velocity2.resize(nPoint) = su2double(0.0); - Max_Lambda_Inv.resize(nPoint) = su2double(0.0); - Delta_Time.resize(nPoint) = su2double(0.0); - Lambda.resize(nPoint) = su2double(0.0); - Sensor.resize(nPoint) = su2double(0.0); - - /* Non-physical point (first-order) initialization. */ - Non_Physical.resize(nPoint) = false; - Non_Physical_Counter.resize(nPoint) = 0; - - /* Under-relaxation parameter. */ - LocalCFL.resize(nPoint) = su2double(0.0); - - /*--- Loop over all points --*/ - for(unsigned long iPoint = 0; iPoint < nPoint; ++iPoint){ - - /*--- Reset velocity^2 [m2/s2] to zero ---*/ - sqvel = 0.0; - - /*--- Set mixture state ---*/ - fluidmodel->SetTDStatePTTv(val_pressure, val_massfrac, val_temperature, val_temperature_ve); - - /*--- Compute necessary quantities ---*/ - rho = fluidmodel->GetDensity(); - soundspeed = fluidmodel->ComputeSoundSpeed(); - for (iDim = 0; iDim < nDim; iDim++){ - sqvel += val_mach[iDim]*soundspeed * val_mach[iDim]*soundspeed; - } - energies = fluidmodel->ComputeMixtureEnergies(); - - /*--- Initialize Solution & Solution_Old vectors ---*/ - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) - Solution(iPoint,iSpecies) = rho*val_massfrac[iSpecies]; - for (iDim = 0; iDim < nDim; iDim++) - Solution(iPoint,nSpecies+iDim) = rho*val_mach[iDim]*soundspeed; - - Solution(iPoint,nSpecies+nDim) = rho*(energies[0]+0.5*sqvel); - Solution(iPoint,nSpecies+nDim+1) = rho*(energies[1]); - - Solution_Old = Solution; - - /*--- Assign primitive variables ---*/ - Primitive(iPoint,T_INDEX) = val_temperature; - Primitive(iPoint,TVE_INDEX) = val_temperature_ve; - Primitive(iPoint,P_INDEX) = val_pressure; - } -} - -void CNEMOEulerVariable::SetVelocity2(unsigned long iPoint) { - - unsigned short iDim; - - Velocity2(iPoint) = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Primitive(iPoint,VEL_INDEX+iDim) = Solution(iPoint,nSpecies+iDim) / Primitive(iPoint,RHO_INDEX); - Velocity2(iPoint) += Solution(iPoint,nSpecies+iDim)*Solution(iPoint,nSpecies+iDim) - / (Primitive(iPoint,RHO_INDEX)*Primitive(iPoint,RHO_INDEX)); - } -} - -bool CNEMOEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) { - - bool nonPhys; - unsigned short iVar; - - fluidmodel = static_cast(FluidModel); - - /*--- Convert conserved to primitive variables ---*/ - nonPhys = Cons2PrimVar(Solution[iPoint], Primitive[iPoint], - dPdU[iPoint], dTdU[iPoint], dTvedU[iPoint], eves[iPoint], Cvves[iPoint]); - - /*--- Reset solution to previous one, if nonphys ---*/ - if (nonPhys) { - for (iVar = 0; iVar < nVar; iVar++) - Solution(iPoint,iVar) = Solution_Old(iPoint,iVar); - } - - /*--- Set additional point quantaties ---*/ - Gamma(iPoint) = fluidmodel->ComputeGamma(); - - SetVelocity2(iPoint); - - return nonPhys; -} - -bool CNEMOEulerVariable::Cons2PrimVar(su2double *U, su2double *V, - su2double *val_dPdU, su2double *val_dTdU, - su2double *val_dTvedU, su2double *val_eves, - su2double *val_Cvves) { - - unsigned short iDim, iSpecies; - su2double Tmin, Tmax, Tvemin, Tvemax; - vector rhos; - - rhos.resize(nSpecies,0.0); - - /*--- Conserved & primitive vector layout ---*/ - // U: [rho1, ..., rhoNs, rhou, rhov, rhow, rhoe, rhoeve]^T - // V: [rho1, ..., rhoNs, T, Tve, u, v, w, P, rho, h, a, rhoCvtr, rhoCvve]^T - - /*--- Set booleans ---*/ - bool nonPhys = false; - - /*--- Set temperature clipping values ---*/ - Tmin = 50.0; Tmax = 8E4; - Tvemin = 50.0; Tvemax = 8E4; - - /*--- Rename variables for convenience ---*/ - su2double rhoE = U[nSpecies+nDim]; // Density * energy [J/m3] - su2double rhoEve = U[nSpecies+nDim+1]; // Density * energy_ve [J/m3] - - /*--- Assign species & mixture density ---*/ - // Note: if any species densities are < 0, these values are re-assigned - // in the primitive AND conserved vectors to ensure positive density - V[RHO_INDEX] = 0.0; - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) { - if (U[iSpecies] < 0.0) { - U[iSpecies] = 1E-20; - V[RHOS_INDEX+iSpecies] = 1E-20; - rhos[iSpecies] = 1E-20; - //nonPhys = true; - } else { - V[RHOS_INDEX+iSpecies] = U[iSpecies]; - rhos[iSpecies] = U[iSpecies]; - } - V[RHO_INDEX] += U[iSpecies]; - } - - // Rename for convenience - su2double rho = V[RHO_INDEX]; - - /*--- Assign velocity^2 ---*/ - su2double sqvel = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - V[VEL_INDEX+iDim] = U[nSpecies+iDim]/V[RHO_INDEX]; - sqvel += V[VEL_INDEX+iDim]*V[VEL_INDEX+iDim]; - } - - /*--- Assign temperatures ---*/ - const auto& T = fluidmodel->ComputeTemperatures(rhos, rhoE, rhoEve, 0.5*rho*sqvel); - - /*--- Temperatures ---*/ - V[T_INDEX] = T[0]; - V[TVE_INDEX] = T[1]; - - // Determine if the temperature lies within the acceptable range - //TODO: fIX THIS - if (V[T_INDEX] == Tmin) { - nonPhys = true; - } else if (V[T_INDEX] == Tmax){ - nonPhys = true; - } - - /*--- Vibrational-Electronic Temperature ---*/ - vector eves_min = fluidmodel->ComputeSpeciesEve(Tvemin); - vector eves_max = fluidmodel->ComputeSpeciesEve(Tvemax); - - // Check for non-physical solutions - if (!monoatomic){ - su2double rhoEve_min = 0.0; - su2double rhoEve_max = 0.0; - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) { - rhoEve_min += U[iSpecies] * eves_min[iSpecies]; - rhoEve_max += U[iSpecies] * eves_max[iSpecies]; - } - - if (rhoEve < rhoEve_min) { - - nonPhys = true; - V[TVE_INDEX] = Tvemin; - U[nSpecies+nDim+1] = rhoEve_min; - } else if (rhoEve > rhoEve_max) { - nonPhys = true; - V[TVE_INDEX] = Tvemax; - U[nSpecies+nDim+1] = rhoEve_max; - } - } else { - //TODO: can e-modes/vibe modes be active? - V[TVE_INDEX] = Tve_Freestream; - } - - // Determine other properties of the mixture at the current state - fluidmodel->SetTDStateRhosTTv(rhos, V[T_INDEX], V[TVE_INDEX]); - const auto& cvves = fluidmodel->ComputeSpeciesCvVibEle(); - vector eves = fluidmodel->ComputeSpeciesEve(V[TVE_INDEX]); - - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) { - val_eves[iSpecies] = eves[iSpecies]; - val_Cvves[iSpecies] = cvves[iSpecies]; - } - - su2double rhoCvtr = fluidmodel->ComputerhoCvtr(); - su2double rhoCvve = fluidmodel->ComputerhoCvve(); - - V[RHOCVTR_INDEX] = rhoCvtr; - V[RHOCVVE_INDEX] = rhoCvve; - - /*--- Pressure ---*/ - V[P_INDEX] = fluidmodel->ComputePressure(); - - if (V[P_INDEX] < 0.0) { - V[P_INDEX] = 1E-20; - nonPhys = true; - } - - /*--- Partial derivatives of pressure and temperature ---*/ - fluidmodel->ComputedPdU (V, eves, val_dPdU ); - fluidmodel->ComputedTdU (V, val_dTdU ); - fluidmodel->ComputedTvedU(V, eves, val_dTvedU); - - /*--- Sound speed ---*/ - V[A_INDEX] = fluidmodel->ComputeSoundSpeed(); - - /*--- Enthalpy ---*/ - V[H_INDEX] = (U[nSpecies+nDim] + V[P_INDEX])/V[RHO_INDEX]; - - return nonPhys; -} - -void CNEMOEulerVariable::SetSolution_New() { Solution_New = Solution; } +/*! + * \file CNEMOEulerVariable.cpp + * \brief Definition of the solution fields. + * \author C. Garbacz, W. Maier, S.R. Copeland + * \version 7.1.1 "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/variables/CNEMOEulerVariable.hpp" +#include + +CNEMOEulerVariable::CNEMOEulerVariable(su2double val_pressure, + const su2double *val_massfrac, + su2double *val_mach, + su2double val_temperature, + su2double val_temperature_ve, + unsigned long npoint, + unsigned long ndim, + unsigned long nvar, + unsigned long nvarprim, + unsigned long nvarprimgrad, + CConfig *config, + CNEMOGas *fluidmodel) : CVariable(npoint, + ndim, + nvar, + config ), + Gradient_Reconstruction(config->GetReconstructionGradientRequired() ? Gradient_Aux : Gradient_Primitive) { + + vector energies; + unsigned short iDim, iSpecies; + su2double soundspeed, sqvel, rho; + + /*--- Setting variable amounts ---*/ + nDim = ndim; + nPrimVar = nvarprim; + nPrimVarGrad = nvarprimgrad; + + nSpecies = config->GetnSpecies(); + RHOS_INDEX = 0; + T_INDEX = nSpecies; + TVE_INDEX = nSpecies+1; + VEL_INDEX = nSpecies+2; + P_INDEX = nSpecies+nDim+2; + RHO_INDEX = nSpecies+nDim+3; + H_INDEX = nSpecies+nDim+4; + A_INDEX = nSpecies+nDim+5; + RHOCVTR_INDEX = nSpecies+nDim+6; + RHOCVVE_INDEX = nSpecies+nDim+7; + LAM_VISC_INDEX = nSpecies+nDim+8; + EDDY_VISC_INDEX = nSpecies+nDim+9; + + /*--- Set monoatomic flag ---*/ + if (config->GetMonoatomic()) { + monoatomic = true; + Tve_Freestream = config->GetTemperature_ve_FreeStream(); + } + + /*--- Allocate & initialize residual vectors ---*/ + Res_TruncError.resize(nPoint,nVar) = su2double(0.0); + + /*--- Size Grad_AuxVar for axiysmmetric ---*/ + if (config->GetAxisymmetric()){ + nAuxVar = 3; + Grad_AuxVar.resize(nPoint,nAuxVar,nDim,0.0); + AuxVar.resize(nPoint,nAuxVar) = 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.resize(nPoint,nVar) = su2double(0.0); + Limiter_Primitive.resize(nPoint,nPrimVarGrad) = su2double(0.0); + + Solution_Max.resize(nPoint,nPrimVarGrad) = su2double(0.0); + Solution_Min.resize(nPoint,nPrimVarGrad) = su2double(0.0); + + /*--- Primitive and secondary variables ---*/ + Primitive.resize(nPoint,nPrimVar) = su2double(0.0); + Primitive_Aux.resize(nPoint,nPrimVar) = su2double(0.0); + Secondary.resize(nPoint,nPrimVar) = su2double(0.0); + + dPdU.resize(nPoint, nVar) = su2double(0.0); + dTdU.resize(nPoint, nVar) = su2double(0.0); + dTvedU.resize(nPoint, nVar) = su2double(0.0); + Cvves.resize(nPoint, nSpecies) = su2double(0.0); + eves.resize(nPoint, nSpecies) = su2double(0.0); + Gamma.resize(nPoint) = su2double(0.0); + + /*--- Compressible flow, gradients primitive variables ---*/ + Gradient_Primitive.resize(nPoint,nPrimVarGrad,nDim,0.0); + Gradient.resize(nPoint,nVar,nDim,0.0); + + if (config->GetReconstructionGradientRequired()) { + Gradient_Aux.resize(nPoint,nPrimVarGrad,nDim,0.0); + } + + if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { + Rmatrix.resize(nPoint,nDim,nDim,0.0); + } + + Velocity2.resize(nPoint) = su2double(0.0); + Max_Lambda_Inv.resize(nPoint) = su2double(0.0); + Delta_Time.resize(nPoint) = su2double(0.0); + Lambda.resize(nPoint) = su2double(0.0); + Sensor.resize(nPoint) = su2double(0.0); + + /* Non-physical point (first-order) initialization. */ + Non_Physical.resize(nPoint) = false; + Non_Physical_Counter.resize(nPoint) = 0; + + /* Under-relaxation parameter. */ + UnderRelaxation.resize(nPoint) = su2double(1.0); + LocalCFL.resize(nPoint) = su2double(0.0); + + /*--- Loop over all points --*/ + for(unsigned long iPoint = 0; iPoint < nPoint; ++iPoint){ + + /*--- Reset velocity^2 [m2/s2] to zero ---*/ + sqvel = 0.0; + + /*--- Set mixture state ---*/ + fluidmodel->SetTDStatePTTv(val_pressure, val_massfrac, val_temperature, val_temperature_ve); + + /*--- Compute necessary quantities ---*/ + rho = fluidmodel->GetDensity(); + soundspeed = fluidmodel->ComputeSoundSpeed(); + for (iDim = 0; iDim < nDim; iDim++){ + sqvel += val_mach[iDim]*soundspeed * val_mach[iDim]*soundspeed; + } + energies = fluidmodel->ComputeMixtureEnergies(); + + /*--- Initialize Solution & Solution_Old vectors ---*/ + for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) + Solution(iPoint,iSpecies) = rho*val_massfrac[iSpecies]; + for (iDim = 0; iDim < nDim; iDim++) + Solution(iPoint,nSpecies+iDim) = rho*val_mach[iDim]*soundspeed; + + Solution(iPoint,nSpecies+nDim) = rho*(energies[0]+0.5*sqvel); + Solution(iPoint,nSpecies+nDim+1) = rho*(energies[1]); + + Solution_Old = Solution; + + /*--- Assign primitive variables ---*/ + Primitive(iPoint,T_INDEX) = val_temperature; + Primitive(iPoint,TVE_INDEX) = val_temperature_ve; + Primitive(iPoint,P_INDEX) = val_pressure; + } +} + +void CNEMOEulerVariable::SetVelocity2(unsigned long iPoint) { + + unsigned short iDim; + + Velocity2(iPoint) = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Primitive(iPoint,VEL_INDEX+iDim) = Solution(iPoint,nSpecies+iDim) / Primitive(iPoint,RHO_INDEX); + Velocity2(iPoint) += Solution(iPoint,nSpecies+iDim)*Solution(iPoint,nSpecies+iDim) + / (Primitive(iPoint,RHO_INDEX)*Primitive(iPoint,RHO_INDEX)); + } +} + +bool CNEMOEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) { + + bool nonPhys; + unsigned short iVar; + + fluidmodel = static_cast(FluidModel); + + /*--- Convert conserved to primitive variables ---*/ + nonPhys = Cons2PrimVar(Solution[iPoint], Primitive[iPoint], + dPdU[iPoint], dTdU[iPoint], dTvedU[iPoint], eves[iPoint], Cvves[iPoint]); + + /*--- Reset solution to previous one, if nonphys ---*/ + if (nonPhys) { + for (iVar = 0; iVar < nVar; iVar++) + Solution(iPoint,iVar) = Solution_Old(iPoint,iVar); + } + + /*--- Set additional point quantaties ---*/ + Gamma(iPoint) = fluidmodel->ComputeGamma(); + + SetVelocity2(iPoint); + + return nonPhys; +} + +bool CNEMOEulerVariable::Cons2PrimVar(su2double *U, su2double *V, + su2double *val_dPdU, su2double *val_dTdU, + su2double *val_dTvedU, su2double *val_eves, + su2double *val_Cvves) { + + unsigned short iDim, iSpecies; + su2double Tmin, Tmax, Tvemin, Tvemax; + vector rhos; + + rhos.resize(nSpecies,0.0); + + /*--- Conserved & primitive vector layout ---*/ + // U: [rho1, ..., rhoNs, rhou, rhov, rhow, rhoe, rhoeve]^T + // V: [rho1, ..., rhoNs, T, Tve, u, v, w, P, rho, h, a, rhoCvtr, rhoCvve]^T + + /*--- Set booleans ---*/ + bool nonPhys = false; + + /*--- Set temperature clipping values ---*/ + Tmin = 50.0; Tmax = 8E4; + Tvemin = 50.0; Tvemax = 8E4; + + /*--- Rename variables for convenience ---*/ + su2double rhoE = U[nSpecies+nDim]; // Density * energy [J/m3] + su2double rhoEve = U[nSpecies+nDim+1]; // Density * energy_ve [J/m3] + + /*--- Assign species & mixture density ---*/ + // Note: if any species densities are < 0, these values are re-assigned + // in the primitive AND conserved vectors to ensure positive density + V[RHO_INDEX] = 0.0; + for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) { + if (U[iSpecies] < 0.0) { + U[iSpecies] = 1E-20; + V[RHOS_INDEX+iSpecies] = 1E-20; + rhos[iSpecies] = 1E-20; + //nonPhys = true; + } else { + V[RHOS_INDEX+iSpecies] = U[iSpecies]; + rhos[iSpecies] = U[iSpecies]; + } + V[RHO_INDEX] += U[iSpecies]; + } + + // Rename for convenience + su2double rho = V[RHO_INDEX]; + + /*--- Assign velocity^2 ---*/ + su2double sqvel = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + V[VEL_INDEX+iDim] = U[nSpecies+iDim]/V[RHO_INDEX]; + sqvel += V[VEL_INDEX+iDim]*V[VEL_INDEX+iDim]; + } + + /*--- Assign temperatures ---*/ + const auto& T = fluidmodel->ComputeTemperatures(rhos, rhoE, rhoEve, 0.5*rho*sqvel); + + /*--- Temperatures ---*/ + V[T_INDEX] = T[0]; + V[TVE_INDEX] = T[1]; + + // Determine if the temperature lies within the acceptable range + //TODO: fIX THIS + if (V[T_INDEX] == Tmin) { + nonPhys = true; + } else if (V[T_INDEX] == Tmax){ + nonPhys = true; + } + + /*--- Vibrational-Electronic Temperature ---*/ + vector eves_min = fluidmodel->ComputeSpeciesEve(Tvemin); + vector eves_max = fluidmodel->ComputeSpeciesEve(Tvemax); + + // Check for non-physical solutions + if (!monoatomic){ + su2double rhoEve_min = 0.0; + su2double rhoEve_max = 0.0; + for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) { + rhoEve_min += U[iSpecies] * eves_min[iSpecies]; + rhoEve_max += U[iSpecies] * eves_max[iSpecies]; + } + + if (rhoEve < rhoEve_min) { + + nonPhys = true; + V[TVE_INDEX] = Tvemin; + U[nSpecies+nDim+1] = rhoEve_min; + } else if (rhoEve > rhoEve_max) { + nonPhys = true; + V[TVE_INDEX] = Tvemax; + U[nSpecies+nDim+1] = rhoEve_max; + } + } else { + //TODO: can e-modes/vibe modes be active? + V[TVE_INDEX] = Tve_Freestream; + } + + // Determine other properties of the mixture at the current state + fluidmodel->SetTDStateRhosTTv(rhos, V[T_INDEX], V[TVE_INDEX]); + const auto& cvves = fluidmodel->ComputeSpeciesCvVibEle(); + vector eves = fluidmodel->ComputeSpeciesEve(V[TVE_INDEX]); + + for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) { + val_eves[iSpecies] = eves[iSpecies]; + val_Cvves[iSpecies] = cvves[iSpecies]; + } + + su2double rhoCvtr = fluidmodel->ComputerhoCvtr(); + su2double rhoCvve = fluidmodel->ComputerhoCvve(); + + V[RHOCVTR_INDEX] = rhoCvtr; + V[RHOCVVE_INDEX] = rhoCvve; + + /*--- Pressure ---*/ + V[P_INDEX] = fluidmodel->ComputePressure(); + + if (V[P_INDEX] < 0.0) { + V[P_INDEX] = 1E-20; + nonPhys = true; + } + + /*--- Partial derivatives of pressure and temperature ---*/ + fluidmodel->ComputedPdU (V, eves, val_dPdU ); + fluidmodel->ComputedTdU (V, val_dTdU ); + fluidmodel->ComputedTvedU(V, eves, val_dTvedU); + + /*--- Sound speed ---*/ + V[A_INDEX] = fluidmodel->ComputeSoundSpeed(); + + /*--- Enthalpy ---*/ + V[H_INDEX] = (U[nSpecies+nDim] + V[P_INDEX])/V[RHO_INDEX]; + + return nonPhys; +} + +void CNEMOEulerVariable::SetSolution_New() { Solution_New = Solution; } diff --git a/SU2_CFD/src/variables/CNEMONSVariable.cpp b/SU2_CFD/src/variables/CNEMONSVariable.cpp index 33dfdcae23d9..d8b5066ea294 100644 --- a/SU2_CFD/src/variables/CNEMONSVariable.cpp +++ b/SU2_CFD/src/variables/CNEMONSVariable.cpp @@ -1,142 +1,142 @@ -/*! - * \file CNEMONSVariable.cpp - * \brief Definition of the solution fields. - * \author C. Garbacz, W. Maier, S.R. Copeland - * \version 7.1.0 "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/variables/CNEMONSVariable.hpp" -#include - -CNEMONSVariable::CNEMONSVariable(su2double val_pressure, - const su2double *val_massfrac, - su2double *val_mach, - su2double val_temperature, - su2double val_temperature_ve, - unsigned long npoint, - unsigned long val_ndim, - unsigned long val_nvar, - unsigned long val_nvarprim, - unsigned long val_nvarprimgrad, - CConfig *config, - CNEMOGas *fluidmodel) : CNEMOEulerVariable(val_pressure, - val_massfrac, - val_mach, - val_temperature, - val_temperature_ve, - npoint, - val_ndim, - val_nvar, - val_nvarprim, - val_nvarprimgrad, - config, - fluidmodel) { - - - - Temperature_Ref = config->GetTemperature_Ref(); - Viscosity_Ref = config->GetViscosity_Ref(); - Viscosity_Inf = config->GetViscosity_FreeStreamND(); - Prandtl_Lam = config->GetPrandtl_Lam(); - - DiffusionCoeff.resize(nPoint, nSpecies) = su2double(0.0); - LaminarViscosity.resize(nPoint) = su2double(0.0); - ThermalCond.resize(nPoint) = su2double(0.0); - ThermalCond_ve.resize(nPoint) = su2double(0.0); - - Max_Lambda_Visc.resize(nPoint) = su2double(0.0); - inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); - - Vorticity.resize(nPoint,3) = su2double(0.0); - StrainMag.resize(nPoint) = su2double(0.0); - Tau_Wall.resize(nPoint) = su2double(-1.0); - DES_LengthScale.resize(nPoint) = su2double(0.0); - Roe_Dissipation.resize(nPoint) = su2double(0.0); - Vortex_Tilting.resize(nPoint) = su2double(0.0); - Max_Lambda_Visc.resize(nPoint) = su2double(0.0); -} - -bool CNEMONSVariable::SetVorticity(void) { - - for (unsigned long iPoint=0; iPoint(FluidModel); - - /*--- Convert conserved to primitive variables ---*/ - nonPhys = Cons2PrimVar(Solution[iPoint], Primitive[iPoint], dPdU[iPoint], dTdU[iPoint], dTvedU[iPoint], eves[iPoint], Cvves[iPoint]); - - /*--- Reset solution to previous one, if nonphys ---*/ - if (nonPhys) { - for (iVar = 0; iVar < nVar; iVar++) - Solution(iPoint,iVar) = Solution_Old(iPoint,iVar); - } - - /*--- Set additional point quantaties ---*/ - Gamma(iPoint) = fluidmodel->ComputeGamma(); - - SetVelocity2(iPoint); - - Ds = fluidmodel->GetDiffusionCoeff(); - for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) - DiffusionCoeff(iPoint, iSpecies) = Ds[iSpecies]; - - LaminarViscosity(iPoint) = fluidmodel->GetViscosity(); - - thermalconductivities = fluidmodel->GetThermalConductivities(); - ThermalCond(iPoint) = thermalconductivities[0]; - ThermalCond_ve(iPoint) = thermalconductivities[1]; - - Primitive(iPoint, LAM_VISC_INDEX) = LaminarViscosity(iPoint); - - return nonPhys; -} - - - +/*! + * \file CNEMONSVariable.cpp + * \brief Definition of the solution fields. + * \author C. Garbacz, W. Maier, S.R. Copeland + * \version 7.1.1 "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/variables/CNEMONSVariable.hpp" +#include + +CNEMONSVariable::CNEMONSVariable(su2double val_pressure, + const su2double *val_massfrac, + su2double *val_mach, + su2double val_temperature, + su2double val_temperature_ve, + unsigned long npoint, + unsigned long val_ndim, + unsigned long val_nvar, + unsigned long val_nvarprim, + unsigned long val_nvarprimgrad, + CConfig *config, + CNEMOGas *fluidmodel) : CNEMOEulerVariable(val_pressure, + val_massfrac, + val_mach, + val_temperature, + val_temperature_ve, + npoint, + val_ndim, + val_nvar, + val_nvarprim, + val_nvarprimgrad, + config, + fluidmodel) { + + + + Temperature_Ref = config->GetTemperature_Ref(); + Viscosity_Ref = config->GetViscosity_Ref(); + Viscosity_Inf = config->GetViscosity_FreeStreamND(); + Prandtl_Lam = config->GetPrandtl_Lam(); + + DiffusionCoeff.resize(nPoint, nSpecies) = su2double(0.0); + LaminarViscosity.resize(nPoint) = su2double(0.0); + ThermalCond.resize(nPoint) = su2double(0.0); + ThermalCond_ve.resize(nPoint) = su2double(0.0); + + Max_Lambda_Visc.resize(nPoint) = su2double(0.0); + inv_TimeScale = config->GetModVel_FreeStream() / config->GetRefLength(); + + Vorticity.resize(nPoint,3) = su2double(0.0); + StrainMag.resize(nPoint) = su2double(0.0); + Tau_Wall.resize(nPoint) = su2double(-1.0); + DES_LengthScale.resize(nPoint) = su2double(0.0); + Roe_Dissipation.resize(nPoint) = su2double(0.0); + Vortex_Tilting.resize(nPoint) = su2double(0.0); + Max_Lambda_Visc.resize(nPoint) = su2double(0.0); +} + +bool CNEMONSVariable::SetVorticity(void) { + + for (unsigned long iPoint=0; iPoint(FluidModel); + + /*--- Convert conserved to primitive variables ---*/ + nonPhys = Cons2PrimVar(Solution[iPoint], Primitive[iPoint], dPdU[iPoint], dTdU[iPoint], dTvedU[iPoint], eves[iPoint], Cvves[iPoint]); + + /*--- Reset solution to previous one, if nonphys ---*/ + if (nonPhys) { + for (iVar = 0; iVar < nVar; iVar++) + Solution(iPoint,iVar) = Solution_Old(iPoint,iVar); + } + + /*--- Set additional point quantaties ---*/ + Gamma(iPoint) = fluidmodel->ComputeGamma(); + + SetVelocity2(iPoint); + + Ds = fluidmodel->GetDiffusionCoeff(); + for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) + DiffusionCoeff(iPoint, iSpecies) = Ds[iSpecies]; + + LaminarViscosity(iPoint) = fluidmodel->GetViscosity(); + + thermalconductivities = fluidmodel->GetThermalConductivities(); + ThermalCond(iPoint) = thermalconductivities[0]; + ThermalCond_ve(iPoint) = thermalconductivities[1]; + + Primitive(iPoint, LAM_VISC_INDEX) = LaminarViscosity(iPoint); + + return nonPhys; +} + + + diff --git a/SU2_CFD/src/variables/CNSVariable.cpp b/SU2_CFD/src/variables/CNSVariable.cpp index 082e0d8d7417..98ad4d18adae 100644 --- a/SU2_CFD/src/variables/CNSVariable.cpp +++ b/SU2_CFD/src/variables/CNSVariable.cpp @@ -2,7 +2,7 @@ * \file CNSVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -44,59 +44,6 @@ CNSVariable::CNSVariable(su2double density, const su2double *velocity, su2double Max_Lambda_Visc.resize(nPoint) = su2double(0.0); } -bool CNSVariable::SetVorticity_StrainMag() { - - SU2_OMP_FOR_STAT(256) - 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 ---*/ - - AD::StartPreacc(); - AD::SetPreaccIn(Gradient_Primitive[iPoint], nDim+1, nDim); - - 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)); - - AD::SetPreaccOut(StrainMag(iPoint)); - AD::EndPreacc(); - } - return false; -} - void CNSVariable::SetRoe_Dissipation_NTS(unsigned long iPoint, su2double val_delta, su2double val_const_DES){ diff --git a/SU2_CFD/src/variables/CRadP1Variable.cpp b/SU2_CFD/src/variables/CRadP1Variable.cpp index baaf66f533df..831cbb94d7e0 100644 --- a/SU2_CFD/src/variables/CRadP1Variable.cpp +++ b/SU2_CFD/src/variables/CRadP1Variable.cpp @@ -2,7 +2,7 @@ * \file CRadP1Variable.cpp * \brief Definition of the P1 model variables * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CRadVariable.cpp b/SU2_CFD/src/variables/CRadVariable.cpp index f09aa11593d6..633610f1350b 100644 --- a/SU2_CFD/src/variables/CRadVariable.cpp +++ b/SU2_CFD/src/variables/CRadVariable.cpp @@ -2,7 +2,7 @@ * \file CRadVariable.cpp * \brief Definition of the radiation variables * \author Ruben Sanchez - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CTransLMVariable.cpp b/SU2_CFD/src/variables/CTransLMVariable.cpp index 061225fad4c0..f4120afd35d7 100644 --- a/SU2_CFD/src/variables/CTransLMVariable.cpp +++ b/SU2_CFD/src/variables/CTransLMVariable.cpp @@ -2,7 +2,7 @@ * \file CTransLMVariable.cpp * \brief Definition of the solution fields. * \author A. Aranake - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CTurbSAVariable.cpp b/SU2_CFD/src/variables/CTurbSAVariable.cpp index cb84add72d33..9530f1d1be3c 100644 --- a/SU2_CFD/src/variables/CTurbSAVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSAVariable.cpp @@ -2,7 +2,7 @@ * \file CTurbSAVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, A. Bueno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CTurbSSTVariable.cpp b/SU2_CFD/src/variables/CTurbSSTVariable.cpp index 5b725da8e5a4..b6b9fae8dc89 100644 --- a/SU2_CFD/src/variables/CTurbSSTVariable.cpp +++ b/SU2_CFD/src/variables/CTurbSSTVariable.cpp @@ -2,7 +2,7 @@ * \file CTurbSSTVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, A. Bueno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CTurbVariable.cpp b/SU2_CFD/src/variables/CTurbVariable.cpp index 6f41ae365ab3..c2e7211c192d 100644 --- a/SU2_CFD/src/variables/CTurbVariable.cpp +++ b/SU2_CFD/src/variables/CTurbVariable.cpp @@ -2,7 +2,7 @@ * \file CTurbVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, A. Bueno - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_CFD/src/variables/CVariable.cpp b/SU2_CFD/src/variables/CVariable.cpp index 57f4ea60d11e..5d16271961d6 100644 --- a/SU2_CFD/src/variables/CVariable.cpp +++ b/SU2_CFD/src/variables/CVariable.cpp @@ -2,7 +2,7 @@ * \file CVariable.cpp * \brief Definition of the solution fields. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -110,8 +110,6 @@ void CVariable::Restore_BGSSolution_k() { parallelCopy(Solution_BGS_k.size(), Solution_BGS_k.data(), Solution.data()); } -void CVariable::SetUnd_LaplZero() { parallelSet(Undivided_Laplacian.size(), 0.0, Undivided_Laplacian.data()); } - void CVariable::SetExternalZero() { parallelSet(External.size(), 0.0, External.data()); } void CVariable::RegisterSolution(bool input, bool push_index) { diff --git a/SU2_DEF/include/SU2_DEF.hpp b/SU2_DEF/include/SU2_DEF.hpp index e0cd6911bd86..be5aaf23cbc3 100644 --- a/SU2_DEF/include/SU2_DEF.hpp +++ b/SU2_DEF/include/SU2_DEF.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines of the code SU2_DEF. * The subroutines and functions are in the SU2_DEF.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_DEF/obj/Makefile.am b/SU2_DEF/obj/Makefile.am index 4724b670a632..90fdaf0afd35 100644 --- a/SU2_DEF/obj/Makefile.am +++ b/SU2_DEF/obj/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for SU2_DEF # \author M. Colonno, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_DEF/src/SU2_DEF.cpp b/SU2_DEF/src/SU2_DEF.cpp index ad0f705d1e2a..ca4b5b2ee6e2 100644 --- a/SU2_DEF/src/SU2_DEF.cpp +++ b/SU2_DEF/src/SU2_DEF.cpp @@ -2,7 +2,7 @@ * \file SU2_DEF.cpp * \brief Main file of Mesh Deformation Code (SU2_DEF). * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -39,13 +39,13 @@ int main(int argc, char *argv[]) { /*--- MPI initialization ---*/ -#ifdef HAVE_OMP +#if defined(HAVE_OMP) && defined(HAVE_MPI) int provided; SU2_MPI::Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided); #else SU2_MPI::Init(&argc, &argv); #endif - SU2_MPI::Comm MPICommunicator(MPI_COMM_WORLD); + SU2_MPI::Comm MPICommunicator = SU2_MPI::GetComm(); rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); diff --git a/SU2_DOT/include/SU2_DOT.hpp b/SU2_DOT/include/SU2_DOT.hpp index 97c0a1f30233..e986ea638ed8 100644 --- a/SU2_DOT/include/SU2_DOT.hpp +++ b/SU2_DOT/include/SU2_DOT.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines of the code SU2_DOT. * The subroutines and functions are in the SU2_DOT.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_DOT/obj/Makefile.am b/SU2_DOT/obj/Makefile.am index ad99ef051000..82cfc2f24373 100644 --- a/SU2_DOT/obj/Makefile.am +++ b/SU2_DOT/obj/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for SU2_DOT # \author M. Colonno, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_DOT/src/SU2_DOT.cpp b/SU2_DOT/src/SU2_DOT.cpp index 61e3acb3d96c..0273ff910fd5 100644 --- a/SU2_DOT/src/SU2_DOT.cpp +++ b/SU2_DOT/src/SU2_DOT.cpp @@ -2,7 +2,7 @@ * \file SU2_DOT.cpp * \brief Main file of the Gradient Projection Code (SU2_DOT). * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -38,13 +38,13 @@ int main(int argc, char *argv[]) { /*--- MPI initialization, and buffer setting ---*/ -#ifdef HAVE_OMP +#if defined(HAVE_OMP) && defined(HAVE_MPI) int provided; SU2_MPI::Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided); #else SU2_MPI::Init(&argc, &argv); #endif - SU2_MPI::Comm MPICommunicator(MPI_COMM_WORLD); + SU2_MPI::Comm MPICommunicator = SU2_MPI::GetComm(); const int rank = SU2_MPI::GetRank(); const int size = SU2_MPI::GetSize(); @@ -283,27 +283,25 @@ int main(int argc, char *argv[]) { SetSensitivity_Files(geometry_container, config_container, nZone); } - for (iZone = 0; iZone < nZone; iZone++){ - if ((config_container[iZone]->GetDesign_Variable(0) != NONE) && - (config_container[iZone]->GetDesign_Variable(0) != SURFACE_FILE)) { + /*--- Initialize structure to store the gradient ---*/ + su2double** Gradient = new su2double*[config_container[ZONE_0]->GetnDV()]; - /*--- Initialize structure to store the gradient ---*/ + for (auto iDV = 0u; iDV < config_container[ZONE_0]->GetnDV(); iDV++) { + /*--- Initialize to zero ---*/ + Gradient[iDV] = new su2double[config_container[ZONE_0]->GetnDV_Value(iDV)](); + } - su2double** Gradient = new su2double*[config_container[ZONE_0]->GetnDV()]; + ofstream Gradient_file; + Gradient_file.precision(config->OptionIsSet("OUTPUT_PRECISION") ? config->GetOutput_Precision() : 6); - for (auto iDV = 0u; iDV < config_container[iZone]->GetnDV(); iDV++) { - Gradient[iDV] = new su2double[config_container[iZone]->GetnDV_Value(iDV)] (); - } + /*--- For multizone computations the gradient contributions are summed up and written into one file. ---*/ + for (iZone = 0; iZone < nZone; iZone++){ + if ((config_container[iZone]->GetDesign_Variable(0) != NONE) && + (config_container[iZone]->GetDesign_Variable(0) != SURFACE_FILE)) { if (rank == MASTER_NODE) cout << "\n---------- Start gradient evaluation using sensitivity information ----------" << endl; - /*--- Write the gradient in a external file ---*/ - - ofstream Gradient_file; - if (rank == MASTER_NODE) - Gradient_file.open(config_container[iZone]->GetObjFunc_Grad_FileName().c_str(), ios::out); - /*--- Definition of the Class for surface deformation ---*/ surface_movement[iZone] = new CSurfaceMovement(); @@ -320,16 +318,22 @@ int main(int argc, char *argv[]) { else SetProjection_FD(geometry_container[iZone][INST_0], config_container[iZone], surface_movement[iZone] , Gradient); - /*--- Print gradients to screen and file ---*/ + } + } // for iZone - OutputGradient(Gradient, config_container[iZone], Gradient_file); + /*--- Write the gradient to a file ---*/ - for (auto iDV = 0u; iDV < config_container[iZone]->GetnDV(); iDV++){ - delete [] Gradient[iDV]; - } - delete [] Gradient; - } + if (rank == MASTER_NODE) + Gradient_file.open(config_container[ZONE_0]->GetObjFunc_Grad_FileName().c_str(), ios::out); + + /*--- Print gradients to screen and writes to file ---*/ + + OutputGradient(Gradient, config_container[ZONE_0], Gradient_file); + + for (auto iDV = 0u; iDV < config_container[ZONE_0]->GetnDV(); iDV++){ + delete [] Gradient[iDV]; } + delete [] Gradient; delete config; config = nullptr; @@ -644,7 +648,7 @@ void SetProjection_FD(CGeometry *geometry, CConfig *config, CSurfaceMovement *su } } - SU2_MPI::Allreduce(&my_Gradient, &localGradient, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&my_Gradient, &localGradient, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); Gradient[iDV][0] += localGradient; } } @@ -770,7 +774,7 @@ void SetProjection_AD(CGeometry *geometry, CConfig *config, CSurfaceMovement *su for (iDV_Value = 0; iDV_Value < nDV_Value; iDV_Value++){ DV_Value = config->GetDV_Value(iDV, iDV_Value); my_Gradient = SU2_TYPE::GetDerivative(DV_Value); - SU2_MPI::Allreduce(&my_Gradient, &localGradient, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(&my_Gradient, &localGradient, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Angle of Attack design variable (this is different, the value comes form the input file) ---*/ @@ -933,7 +937,7 @@ void SetSensitivity_Files(CGeometry ***geometry, CConfig **config, unsigned shor output->SetSurface_Filename(config[iZone]->GetSurfSens_FileName()); - /*--- Set the surface filename ---*/ + /*--- Set the volume filename ---*/ output->SetVolume_Filename(config[iZone]->GetVolSens_FileName()); diff --git a/SU2_GEO/include/SU2_GEO.hpp b/SU2_GEO/include/SU2_GEO.hpp index fe4781bd65b9..7824c67bd592 100644 --- a/SU2_GEO/include/SU2_GEO.hpp +++ b/SU2_GEO/include/SU2_GEO.hpp @@ -3,7 +3,7 @@ * \brief Headers of the main subroutines of the code SU2_GEO. * The subroutines and functions are in the SU2_GEO.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_GEO/obj/Makefile.am b/SU2_GEO/obj/Makefile.am index a488af60ad05..55a1c1fe852c 100644 --- a/SU2_GEO/obj/Makefile.am +++ b/SU2_GEO/obj/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for SU2_GEO # \author M. Colonno, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_GEO/src/SU2_GEO.cpp b/SU2_GEO/src/SU2_GEO.cpp index 1e6b07815f5f..c640b717455e 100644 --- a/SU2_GEO/src/SU2_GEO.cpp +++ b/SU2_GEO/src/SU2_GEO.cpp @@ -2,7 +2,7 @@ * \file SU2_GEO.cpp * \brief Main file of the Geometry Definition Code (SU2_GEO). * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) { /*--- MPI initialization ---*/ SU2_MPI::Init(&argc,&argv); - SU2_MPI::Comm MPICommunicator(MPI_COMM_WORLD); + SU2_MPI::Comm MPICommunicator = SU2_MPI::GetComm(); rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); diff --git a/SU2_PY/FSI_tools/FSIInterface.py b/SU2_PY/FSI_tools/FSIInterface.py index c430e923567a..5fcb809263dd 100644 --- a/SU2_PY/FSI_tools/FSIInterface.py +++ b/SU2_PY/FSI_tools/FSIInterface.py @@ -3,7 +3,7 @@ ## \file FSIInterface.py # \brief FSI interface class that handles fluid/solid solvers synchronisation and communication. # \authors Nicola Fonzi, Vittorio Cavalieri based on the work of David Thomas -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -114,7 +114,9 @@ def __init__(self, FSI_config, FluidSolver, SolidSolver, have_MPI): self.localFluidInterface_array_Y_init = None self.localFluidInterface_array_Z_init = None - self.haloNodesPositionsInit = {} #initial position of the halo nodes (fluid side only) + self.localSolidInterface_array_X_init = None #initial solid interface position on each partition (used for mesh mapping) + self.localSolidInterface_array_Y_init = None + self.localSolidInterface_array_Z_init = None self.solidInterface_array_DispX = None #solid interface displacement self.solidInterface_array_DispY = None @@ -311,6 +313,7 @@ def connect(self, FSI_config, FluidSolver, SolidSolver): # Same thing for the solid part self.nLocalSolidInterfaceHaloNode = 0 + # TODO when the solid solver will run in parallel, add here the calculation of halo nodes self.nLocalSolidInterfacePhysicalNodes = self.nLocalSolidInterfaceNodes - self.nLocalSolidInterfaceHaloNode if self.have_MPI: self.SolidHaloNodeList = self.comm.allgather(self.SolidHaloNodeList) @@ -319,36 +322,36 @@ def connect(self, FSI_config, FluidSolver, SolidSolver): # --- Calculate the total number of nodes (with and without halo) at the fluid interface (sum over all the partitions) and broadcast the number accross all processors --- - sendBuffHalo = np.array(int(self.nLocalFluidInterfaceNodes)) + sendBuffTotal = np.array(int(self.nLocalFluidInterfaceNodes)) sendBuffPhysical = np.array(int(self.nLocalFluidInterfacePhysicalNodes)) - rcvBuffHalo = np.zeros(1, dtype=int) + rcvBuffTotal = np.zeros(1, dtype=int) rcvBuffPhysical = np.zeros(1, dtype=int) if self.have_MPI: self.comm.barrier() - self.comm.Allreduce(sendBuffHalo,rcvBuffHalo,op=self.MPI.SUM) + self.comm.Allreduce(sendBuffTotal,rcvBuffTotal,op=self.MPI.SUM) self.comm.Allreduce(sendBuffPhysical,rcvBuffPhysical,op=self.MPI.SUM) - self.nFluidInterfaceNodes = rcvBuffHalo[0] + self.nFluidInterfaceNodes = rcvBuffTotal[0] self.nFluidInterfacePhysicalNodes = rcvBuffPhysical[0] else: - self.nFluidInterfaceNodes = np.copy(sendBuffHalo) + self.nFluidInterfaceNodes = np.copy(sendBuffTotal) self.nFluidInterfacePhysicalNodes = np.copy(sendBuffPhysical) - del sendBuffHalo, rcvBuffHalo, sendBuffPhysical, rcvBuffPhysical + del sendBuffTotal, rcvBuffTotal, sendBuffPhysical, rcvBuffPhysical # Same thing for the solid part - sendBuffHalo = np.array(int(self.nLocalSolidInterfaceNodes)) + sendBuffTotal = np.array(int(self.nLocalSolidInterfaceNodes)) sendBuffPhysical = np.array(int(self.nLocalSolidInterfacePhysicalNodes)) - rcvBuffHalo = np.zeros(1, dtype=int) + rcvBuffTotal = np.zeros(1, dtype=int) rcvBuffPhysical = np.zeros(1, dtype=int) if self.have_MPI: self.comm.barrier() - self.comm.Allreduce(sendBuffHalo,rcvBuffHalo,op=self.MPI.SUM) + self.comm.Allreduce(sendBuffTotal,rcvBuffTotal,op=self.MPI.SUM) self.comm.Allreduce(sendBuffPhysical,rcvBuffPhysical,op=self.MPI.SUM) - self.nSolidInterfaceNodes = rcvBuffHalo[0] + self.nSolidInterfaceNodes = rcvBuffTotal[0] self.nSolidInterfacePhysicalNodes = rcvBuffPhysical[0] else: - self.nSolidInterfaceNodes = np.copy(sendBuffHalo) + self.nSolidInterfaceNodes = np.copy(sendBuffTotal) self.nSolidInterfacePhysicalNodes = np.copy(sendBuffPhysical) - del sendBuffHalo, rcvBuffHalo, sendBuffPhysical, rcvBuffPhysical + del sendBuffTotal, rcvBuffTotal, sendBuffPhysical, rcvBuffPhysical # --- Store the number of physical interface nodes on each processor and allgather the information --- self.fluidPhysicalInterfaceNodesDistribution = np.zeros(MPIsize, dtype=int) @@ -362,7 +365,7 @@ def connect(self, FSI_config, FluidSolver, SolidSolver): # Same thing for the solid part self.solidPhysicalInterfaceNodesDistribution = np.zeros(MPIsize, dtype=int) if self.have_MPI: - sendBuffPhysical = np.array(int(self.nLocalSolidInterfaceNodes)) + sendBuffPhysical = np.array(int(self.nLocalSolidInterfacePhysicalNodes)) self.comm.Allgather(sendBuffPhysical,self.solidPhysicalInterfaceNodesDistribution) del sendBuffPhysical else: @@ -392,7 +395,7 @@ def connect(self, FSI_config, FluidSolver, SolidSolver): globalIndexStart = 0 for iProc in range(myid): globalIndexStart += self.solidPhysicalInterfaceNodesDistribution[iProc] - globalIndexStop = globalIndexStart + self.nLocalSolidInterfaceNodes-1 + globalIndexStop = globalIndexStart + self.nLocalSolidInterfacePhysicalNodes-1 else: globalIndexStart = 0 globalIndexStop = 0 @@ -563,12 +566,8 @@ def interfaceMapping(self,FluidSolver, SolidSolver, FSI_config): # thus when, from a core, we request for the vertices on the interface, we only obtain # those in that node GlobalIndex = FluidSolver.GetVertexGlobalIndex(self.fluidInterfaceIdentifier, iVertex) - posx = FluidSolver.GetVertexCoordX(self.fluidInterfaceIdentifier, iVertex) - posy = FluidSolver.GetVertexCoordY(self.fluidInterfaceIdentifier, iVertex) - posz = FluidSolver.GetVertexCoordZ(self.fluidInterfaceIdentifier, iVertex) - if GlobalIndex in self.FluidHaloNodeList[myid].keys(): - self.haloNodesPositionsInit[GlobalIndex] = (posx, posy, posz) - else: + posx, posy, posz = FluidSolver.GetInitialMeshCoord(self.fluidInterfaceIdentifier, iVertex) + if GlobalIndex not in self.FluidHaloNodeList[myid].keys(): fluidIndexing_temp[GlobalIndex] = self.__getGlobalIndex('fluid', myid, localIndex) self.localFluidInterface_array_X_init[localIndex] = posx self.localFluidInterface_array_Y_init[localIndex] = posy @@ -587,19 +586,17 @@ def interfaceMapping(self,FluidSolver, SolidSolver, FSI_config): # --- Get the solid interface from solid solver on each partition --- localIndex = 0 solidIndexing_temp = {} - self.localSolidInterface_array_X = np.zeros(self.nLocalSolidInterfaceNodes) - self.localSolidInterface_array_Y = np.zeros(self.nLocalSolidInterfaceNodes) - self.localSolidInterface_array_Z = np.zeros(self.nLocalSolidInterfaceNodes) + self.localSolidInterface_array_X_init = np.zeros(self.nLocalSolidInterfaceNodes) + self.localSolidInterface_array_Y_init = np.zeros(self.nLocalSolidInterfaceNodes) + self.localSolidInterface_array_Z_init = np.zeros(self.nLocalSolidInterfaceNodes) for iVertex in range(self.nLocalSolidInterfaceNodes): GlobalIndex = SolidSolver.getInterfaceNodeGlobalIndex(self.solidInterfaceIdentifier, iVertex) - posx, posy, posz = SolidSolver.getInterfaceNodePos(self.solidInterfaceIdentifier, iVertex) - if GlobalIndex in self.SolidHaloNodeList[myid].keys(): - pass - else: + posx, posy, posz = SolidSolver.getInterfaceNodePosInit(self.solidInterfaceIdentifier, iVertex) + if GlobalIndex not in self.SolidHaloNodeList[myid].keys(): solidIndexing_temp[GlobalIndex] = self.__getGlobalIndex('solid', myid, localIndex) - self.localSolidInterface_array_X[localIndex] = posx - self.localSolidInterface_array_Y[localIndex] = posy - self.localSolidInterface_array_Z[localIndex] = posz + self.localSolidInterface_array_X_init[localIndex] = posx + self.localSolidInterface_array_Y_init[localIndex] = posy + self.localSolidInterface_array_Z_init[localIndex] = posz localIndex += 1 if self.have_MPI: solidIndexing_temp = self.comm.allgather(solidIndexing_temp) @@ -682,17 +679,17 @@ def interfaceMapping(self,FluidSolver, SolidSolver, FSI_config): if myid == iProc: for jProc in self.solidInterfaceProcessors: if jProc != iProc: - self.comm.ssend(self.localSolidInterface_array_X, dest=jProc, tag=1) - self.comm.ssend(self.localSolidInterface_array_Y, dest=jProc, tag=2) - self.comm.ssend(self.localSolidInterface_array_Z, dest=jProc, tag=3) + self.comm.ssend(self.localSolidInterface_array_X_init, dest=jProc, tag=1) + self.comm.ssend(self.localSolidInterface_array_Y_init, dest=jProc, tag=2) + self.comm.ssend(self.localSolidInterface_array_Z_init, dest=jProc, tag=3) else: sizeOfBuff = self.solidPhysicalInterfaceNodesDistribution[iProc] solidInterfaceBuffRcv_X = np.zeros(sizeOfBuff) solidInterfaceBuffRcv_Y = np.zeros(sizeOfBuff) solidInterfaceBuffRcv_Z = np.zeros(sizeOfBuff) - solidInterfaceBuffRcv_X = self.localSolidInterface_array_X - solidInterfaceBuffRcv_Y = self.localSolidInterface_array_Y - solidInterfaceBuffRcv_Z = self.localSolidInterface_array_Z + solidInterfaceBuffRcv_X = self.localSolidInterface_array_X_init + solidInterfaceBuffRcv_Y = self.localSolidInterface_array_Y_init + solidInterfaceBuffRcv_Z = self.localSolidInterface_array_Z_init if myid in self.solidInterfaceProcessors: if myid != iProc: sizeOfBuff = self.solidPhysicalInterfaceNodesDistribution[iProc] @@ -708,9 +705,9 @@ def interfaceMapping(self,FluidSolver, SolidSolver, FSI_config): self.TPSMeshMapping_A(solidInterfaceBuffRcv_X, solidInterfaceBuffRcv_Y, solidInterfaceBuffRcv_Z, iProc) else: if FSI_config['MESH_INTERP_METHOD'] == 'RBF': - self.RBFMeshMapping_A(self.localSolidInterface_array_X, self.localSolidInterface_array_Y, self.localSolidInterface_array_Z, 0, self.RBF_rad) + self.RBFMeshMapping_A(self.localSolidInterface_array_X_init, self.localSolidInterface_array_Y_init, self.localSolidInterface_array_Z_init, 0, self.RBF_rad) else: - self.TPSMeshMapping_A(self.localSolidInterface_array_X, self.localSolidInterface_array_Y, self.localSolidInterface_array_Z, 0) + self.TPSMeshMapping_A(self.localSolidInterface_array_X_init, self.localSolidInterface_array_Y_init, self.localSolidInterface_array_Z_init, 0) self.MappingMatrixA.assemblyBegin() self.MappingMatrixA.assemblyEnd() self.MappingMatrixA_T.assemblyBegin() @@ -724,17 +721,17 @@ def interfaceMapping(self,FluidSolver, SolidSolver, FSI_config): if myid == iProc: for jProc in self.fluidInterfaceProcessors: if jProc != iProc: - self.comm.ssend(self.localSolidInterface_array_X, dest=jProc, tag=1) - self.comm.ssend(self.localSolidInterface_array_Y, dest=jProc, tag=2) - self.comm.ssend(self.localSolidInterface_array_Z, dest=jProc, tag=3) + self.comm.ssend(self.localSolidInterface_array_X_init, dest=jProc, tag=1) + self.comm.ssend(self.localSolidInterface_array_Y_init, dest=jProc, tag=2) + self.comm.ssend(self.localSolidInterface_array_Z_init, dest=jProc, tag=3) else: sizeOfBuff = self.solidPhysicalInterfaceNodesDistribution[iProc] solidInterfaceBuffRcv_X = np.zeros(sizeOfBuff) solidInterfaceBuffRcv_Y = np.zeros(sizeOfBuff) solidInterfaceBuffRcv_Z = np.zeros(sizeOfBuff) - solidInterfaceBuffRcv_X = self.localSolidInterface_array_X - solidInterfaceBuffRcv_Y = self.localSolidInterface_array_Y - solidInterfaceBuffRcv_Z = self.localSolidInterface_array_Z + solidInterfaceBuffRcv_X = self.localSolidInterface_array_X_init + solidInterfaceBuffRcv_Y = self.localSolidInterface_array_Y_init + solidInterfaceBuffRcv_Z = self.localSolidInterface_array_Z_init if myid in self.fluidInterfaceProcessors: if myid != iProc: sizeOfBuff = self.solidPhysicalInterfaceNodesDistribution[iProc] @@ -756,13 +753,13 @@ def interfaceMapping(self,FluidSolver, SolidSolver, FSI_config): else: if FSI_config['MATCHING_MESH'] == 'NO': if FSI_config['MESH_INTERP_METHOD'] == 'RBF': - self.RBFMeshMapping_B(self.localSolidInterface_array_X, self.localSolidInterface_array_Y, self.localSolidInterface_array_Z, 0, self.RBF_rad) + self.RBFMeshMapping_B(self.localSolidInterface_array_X_init, self.localSolidInterface_array_Y_init, self.localSolidInterface_array_Z_init, 0, self.RBF_rad) elif FSI_config['MESH_INTERP_METHOD'] == 'TPS' : - self.TPSMeshMapping_B(self.localSolidInterface_array_X, self.localSolidInterface_array_Y, self.localSolidInterface_array_Z, 0) + self.TPSMeshMapping_B(self.localSolidInterface_array_X_init, self.localSolidInterface_array_Y_init, self.localSolidInterface_array_Z_init, 0) else: - self.NearestNeighboorMeshMapping(self.localSolidInterface_array_X, self.localSolidInterface_array_Y, self.localSolidInterface_array_Z, 0) + self.NearestNeighboorMeshMapping(self.localSolidInterface_array_X_init, self.localSolidInterface_array_Y_init, self.localSolidInterface_array_Z_init, 0) else: - self.matchingMeshMapping(self.localSolidInterface_array_X, self.localSolidInterface_array_Y, self.localSolidInterface_array_Z, 0) + self.matchingMeshMapping(self.localSolidInterface_array_X_init, self.localSolidInterface_array_Y_init, self.localSolidInterface_array_Z_init, 0) if FSI_config['MATCHING_MESH'] == 'NO' and (FSI_config['MESH_INTERP_METHOD'] == 'RBF' or FSI_config['MESH_INTERP_METHOD'] == 'TPS'): self.MappingMatrixB.assemblyBegin() @@ -779,9 +776,9 @@ def interfaceMapping(self,FluidSolver, SolidSolver, FSI_config): self.MPIBarrier() - del self.localSolidInterface_array_X - del self.localSolidInterface_array_Y - del self.localSolidInterface_array_Z + del self.localSolidInterface_array_X_init + del self.localSolidInterface_array_Y_init + del self.localSolidInterface_array_Z_init del self.localFluidInterface_array_X_init del self.localFluidInterface_array_Y_init del self.localFluidInterface_array_Z_init @@ -906,10 +903,10 @@ def RBFMeshMapping_A(self, solidInterfaceBuffRcv_X, solidInterfaceBuffRcv_Y, sol else : SolidSpatialTree.add(jVertex, (posX, posY, posZ)) - for iVertexSolid in range(self.nLocalSolidInterfaceNodes): - posX = self.localSolidInterface_array_X[iVertexSolid] - posY = self.localSolidInterface_array_Y[iVertexSolid] - posZ = self.localSolidInterface_array_Z[iVertexSolid] + for iVertexSolid in range(self.nLocalSolidInterfacePhysicalNodes): + posX = self.localSolidInterface_array_X_init[iVertexSolid] + posY = self.localSolidInterface_array_Y_init[iVertexSolid] + posZ = self.localSolidInterface_array_Z_init[iVertexSolid] NodeA = np.array([posX, posY, posZ]) iGlobalVertexSolid = self.__getGlobalIndex('solid', myid, iVertexSolid) if self.nDim == 2: @@ -1003,10 +1000,10 @@ def TPSMeshMapping_A(self, solidInterfaceBuffRcv_X, solidInterfaceBuffRcv_Y, sol nSolidNodes = solidInterfaceBuffRcv_X.shape[0] - for iVertexSolid in range(self.nLocalSolidInterfaceNodes): - posX = self.localSolidInterface_array_X[iVertexSolid] - posY = self.localSolidInterface_array_Y[iVertexSolid] - posZ = self.localSolidInterface_array_Z[iVertexSolid] + for iVertexSolid in range(self.nLocalSolidInterfacePhysicalNodes): + posX = self.localSolidInterface_array_X_init[iVertexSolid] + posY = self.localSolidInterface_array_Y_init[iVertexSolid] + posZ = self.localSolidInterface_array_Z_init[iVertexSolid] NodeA = np.array([posX, posY, posZ]) iGlobalVertexSolid = self.__getGlobalIndex('solid', myid, iVertexSolid) for jVertexSolid in range(nSolidNodes): @@ -1135,9 +1132,7 @@ def interpolateSolidPositionOnFluidMesh(self, FSI_config): KSP_solver.getPC().setType('jacobi') KSP_solver.setOperators(self.MappingMatrixA) KSP_solver.setFromOptions() - #print(KSP_solver.getInitialGuessNonzero()) KSP_solver.setInitialGuessNonzero(True) - #print(KSP_solver.getInitialGuessNonzero()) KSP_solver.solve(self.solidInterface_array_DispX, gamma_array_DispX) KSP_solver.solve(self.solidInterface_array_DispY, gamma_array_DispY) if self.nDim==3: @@ -1204,9 +1199,6 @@ def interpolateSolidPositionOnFluidMesh(self, FSI_config): del sendBuffNumber, rcvBuffNumber - #print("DEBUG MESSAGE From proc {}, counts = {}".format(myid, counts)) - #print("DEBUG MESSAGE From proc {}, displ = {}".format(myid, displ)) - self.comm.Gatherv(self.fluidInterface_array_DispX.getArray(), [self.fluidInterface_array_DispX_recon, counts, displ, self.MPI.DOUBLE], root=self.rootProcess) self.comm.Gatherv(self.fluidInterface_array_DispY.getArray(), [self.fluidInterface_array_DispY_recon, counts, displ, self.MPI.DOUBLE], root=self.rootProcess) self.comm.Gatherv(self.fluidInterface_array_DispZ.getArray(), [self.fluidInterface_array_DispZ_recon, counts, displ, self.MPI.DOUBLE], root=self.rootProcess) @@ -1227,7 +1219,7 @@ def interpolateSolidPositionOnFluidMesh(self, FSI_config): self.localFluidInterface_array_DispX = np.copy(sendBuff_X) self.localFluidInterface_array_DispY = np.copy(sendBuff_Y) self.localFluidInterface_array_DispZ = np.copy(sendBuff_Z) - if iProc != self.rootProcess: + else: self.comm.ssend(sendBuff_X, dest=iProc, tag = 1) self.comm.ssend(sendBuff_Y, dest=iProc, tag = 2) self.comm.ssend(sendBuff_Z, dest=iProc, tag = 3) @@ -1383,33 +1375,54 @@ def interpolateFluidLoadsOnSolidMesh(self, FSI_config): self.comm.ssend(sendBuff_Y, dest=iProc, tag = 2) self.comm.ssend(sendBuff_Z, dest=iProc, tag = 3) else: - self.localSolidLoads_array_X = np.zeros(self.nLocalSolidInterfaceNodes) - self.localSolidLoads_array_Y = np.zeros(self.nLocalSolidInterfaceNodes) - self.localSolidLoads_array_Z = np.zeros(self.nLocalSolidInterfaceNodes) + self.localSolidLoads_array_X = np.zeros(self.nLocalSolidInterfacePhysicalNodes) + self.localSolidLoads_array_Y = np.zeros(self.nLocalSolidInterfacePhysicalNodes) + self.localSolidLoads_array_Z = np.zeros(self.nLocalSolidInterfacePhysicalNodes) self.localSolidLoads_array_X = sendBuff_X self.localSolidLoads_array_Y = sendBuff_Y self.localSolidLoads_array_Z = sendBuff_Z if myid in self.solidInterfaceProcessors: if myid != self.rootProcess: - self.localSolidLoads_array_X = np.zeros(self.nLocalSolidInterfaceNodes) - self.localSolidLoads_array_Y = np.zeros(self.nLocalSolidInterfaceNodes) - self.localSolidLoads_array_Z = np.zeros(self.nLocalSolidInterfaceNodes) + self.localSolidLoads_array_X = np.zeros(self.nLocalSolidInterfacePhysicalNodes) + self.localSolidLoads_array_Y = np.zeros(self.nLocalSolidInterfacePhysicalNodes) + self.localSolidLoads_array_Z = np.zeros(self.nLocalSolidInterfacePhysicalNodes) self.localSolidLoads_array_X = self.comm.recv(source=self.rootProcess, tag = 1) self.localSolidLoads_array_Y = self.comm.recv(source=self.rootProcess, tag = 2) self.localSolidLoads_array_Z = self.comm.recv(source=self.rootProcess, tag = 3) del sendBuff_X del sendBuff_Y del sendBuff_Z - del self.solidLoads_array_X_recon - del self.solidLoads_array_Y_recon - del self.solidLoads_array_Z_recon + self.comm.barrier() else: self.localSolidLoads_array_X = self.solidLoads_array_X.getArray().copy() self.localSolidLoads_array_Y = self.solidLoads_array_Y.getArray().copy() self.localSolidLoads_array_Z = self.solidLoads_array_Z.getArray().copy() - # Special treatment for the halo nodes on the fluid interface - # TODO when we will use parallel solid solver !! + # Special treatment for the halo nodes on the solid interface + self.haloNodesLoads = {} + sendBuff = {} + if self.have_MPI: + if myid == self.rootProcess: + for iProc in self.solidInterfaceProcessors: + sendBuff = {} + for key in self.SolidHaloNodeList[iProc].keys(): + globalIndex = self.solidIndexing[key] + DispX = self.solidLoads_array_X_recon[globalIndex] + DispY = self.solidLoads_array_Y_recon[globalIndex] + DispZ = self.solidLoads_array_Z_recon[globalIndex] + sendBuff[key] = (DispX, DispY, DispZ) + if iProc == self.rootProcess: + self.haloNodesLoads = sendBuff + else: + self.comm.ssend(sendBuff, dest = iProc, tag=4) + if myid in self.solidInterfaceProcessors: + if myid != self.rootProcess: + self.haloNodesLoads = self.comm.recv(source = self.rootProcess, tag = 4) + self.comm.barrier() + del self.solidLoads_array_X_recon + del self.solidLoads_array_Y_recon + del self.solidLoads_array_Z_recon + del sendBuff def getSolidInterfaceDisplacement(self, SolidSolver): """ @@ -1425,9 +1438,7 @@ def getSolidInterfaceDisplacement(self, SolidSolver): localIndex = 0 for iVertex in range(self.nLocalSolidInterfaceNodes): GlobalIndex = SolidSolver.getInterfaceNodeGlobalIndex(self.solidInterfaceIdentifier, iVertex) - if GlobalIndex in self.SolidHaloNodeList[myid].keys(): - pass - else: + if GlobalIndex not in self.SolidHaloNodeList[myid].keys(): newDispx, newDispy, newDispz = SolidSolver.getInterfaceNodeDisp(self.solidInterfaceIdentifier, iVertex) iGlobalVertex = self.__getGlobalIndex('solid', myid, localIndex) self.solidInterface_array_DispX.setValues([iGlobalVertex],newDispx) @@ -1451,10 +1462,8 @@ def getFluidInterfaceNodalForce(self, FSI_config, FluidSolver): else: myid = 0 + GlobalIndex = int() localIndex = 0 - FX = 0.0 - FY = 0.0 - FZ = 0.0 # --- Get the fluid interface loads from the fluid solver and directly fill the corresponding PETSc vector --- for iVertex in range(self.nLocalFluidInterfaceNodes): @@ -1465,16 +1474,8 @@ def getFluidInterfaceNodalForce(self, FSI_config, FluidSolver): self.fluidLoads_array_X.setValues([iGlobalVertex], loadX) self.fluidLoads_array_Y.setValues([iGlobalVertex], loadY) self.fluidLoads_array_Z.setValues([iGlobalVertex], loadZ) - FX += loadX - FY += loadY - FZ += loadZ localIndex += 1 - if self.have_MPI: - FX = self.comm.allreduce(FX) - FY = self.comm.allreduce(FY) - FZ = self.comm.allreduce(FZ) - self.fluidLoads_array_X.assemblyBegin() self.fluidLoads_array_X.assemblyEnd() self.fluidLoads_array_Y.assemblyBegin() @@ -1482,10 +1483,6 @@ def getFluidInterfaceNodalForce(self, FSI_config, FluidSolver): self.fluidLoads_array_Z.assemblyBegin() self.fluidLoads_array_Z.assemblyEnd() - FX_b = self.fluidLoads_array_X.sum() - FY_b = self.fluidLoads_array_Y.sum() - FZ_b = self.fluidLoads_array_Z.sum() - def setFluidInterfaceVarCoord(self, FluidSolver): """ @@ -1515,7 +1512,7 @@ def setFluidInterfaceVarCoord(self, FluidSolver): def setSolidInterfaceLoads(self, SolidSolver, FSI_config): """ Communicates the new solid interface loads to the solid solver. - In case of rigid body motion, calculates the new resultant forces (lift, drag, ...). + Calculates the new resultant forces (lift, drag, ...). """ if self.have_MPI: myid = self.comm.Get_rank() @@ -1534,7 +1531,7 @@ def setSolidInterfaceLoads(self, SolidSolver, FSI_config): FFY = self.fluidLoads_array_Y.sum() FFZ = self.fluidLoads_array_Z.sum() - for iVertex in range(self.nLocalSolidInterfaceNodes): + for iVertex in range(self.nLocalSolidInterfacePhysicalNodes): FX += self.localSolidLoads_array_X[iVertex] FY += self.localSolidLoads_array_Y[iVertex] FZ += self.localSolidLoads_array_Z[iVertex] @@ -1551,17 +1548,16 @@ def setSolidInterfaceLoads(self, SolidSolver, FSI_config): # --- Send the new solid interface loads to the solid solver (on each partition, halo nodes included) --- GlobalIndex = int() localIndex = 0 - if myid in self.solidInterfaceProcessors: - for iVertex in range(self.nLocalSolidInterfaceNodes): - GlobalIndex = SolidSolver.getInterfaceNodeGlobalIndex(self.solidInterfaceIdentifier, iVertex) - if GlobalIndex in self.SolidHaloNodeList[myid].keys(): - pass - else: - Fx = self.localSolidLoads_array_X[localIndex] - Fy = self.localSolidLoads_array_Y[localIndex] - Fz = self.localSolidLoads_array_Z[localIndex] - SolidSolver.applyload(iVertex, Fx, Fy, Fz) - localIndex += 1 + for iVertex in range(self.nLocalSolidInterfaceNodes): + GlobalIndex = SolidSolver.getInterfaceNodeGlobalIndex(self.solidInterfaceIdentifier, iVertex) + if GlobalIndex in self.SolidHaloNodeList[myid].keys(): + pass #TODO here, when the solid solver will run in parallel, we will need to pass the halo loads + else: + Fx = self.localSolidLoads_array_X[localIndex] + Fy = self.localSolidLoads_array_Y[localIndex] + Fz = self.localSolidLoads_array_Z[localIndex] + SolidSolver.applyload(iVertex, Fx, Fy, Fz) + localIndex += 1 def computeSolidInterfaceResidual(self, SolidSolver): """ @@ -1593,14 +1589,16 @@ def computeSolidInterfaceResidual(self, SolidSolver): predDisp_array_X.setSizes(self.nSolidInterfacePhysicalNodes+self.d_RBF) predDisp_array_Y.setSizes(self.nSolidInterfacePhysicalNodes+self.d_RBF) predDisp_array_Z.setSizes(self.nSolidInterfacePhysicalNodes+self.d_RBF) + predDisp_array_X.set(0.0) + predDisp_array_Y.set(0.0) + predDisp_array_Z.set(0.0) - if myid in self.solidSolverProcessors: - for iVertex in range(self.nLocalSolidInterfaceNodes): - predDispx, predDispy, predDispz = SolidSolver.getInterfaceNodeDisp(self.solidInterfaceIdentifier, iVertex) - iGlobalVertex = self.__getGlobalIndex('solid', myid, iVertex) - predDisp_array_X.setValues([iGlobalVertex], predDispx) - predDisp_array_Y.setValues([iGlobalVertex], predDispy) - predDisp_array_Z.setValues([iGlobalVertex], predDispz) + for iVertex in range(self.nLocalSolidInterfaceNodes): + predDispx, predDispy, predDispz = SolidSolver.getInterfaceNodeDisp(self.solidInterfaceIdentifier, iVertex) + iGlobalVertex = self.__getGlobalIndex('solid', myid, iVertex) + predDisp_array_X.setValues([iGlobalVertex], predDispx) + predDisp_array_Y.setValues([iGlobalVertex], predDispy) + predDisp_array_Z.setValues([iGlobalVertex], predDispz) predDisp_array_X.assemblyBegin() predDisp_array_X.assemblyEnd() @@ -1680,11 +1678,11 @@ def setAitkenCoefficient(self, FSI_config): deltaResx_array_Y.setType('seq') deltaResx_array_Z = PETSc.Vec().create() deltaResx_array_Z.setType('seq') - deltaResx_array_X.setSizes(self.nSolidInterfacePhysicalNodes) + deltaResx_array_X.setSizes(self.nSolidInterfacePhysicalNodes + self.d_RBF) deltaResx_array_X.set(0.0) - deltaResx_array_Y.setSizes(self.nSolidInterfacePhysicalNodes) + deltaResx_array_Y.setSizes(self.nSolidInterfacePhysicalNodes + self.d_RBF) deltaResx_array_Y.set(0.0) - deltaResx_array_Z.setSizes(self.nSolidInterfacePhysicalNodes) + deltaResx_array_Z.setSizes(self.nSolidInterfacePhysicalNodes + self.d_RBF) deltaResx_array_Z.set(0.0) # --- Compute the dynamic Aitken coefficient --- @@ -1788,9 +1786,7 @@ def displacementPredictor(self, FSI_config , SolidSolver, deltaT): localIndex = 0 for iVertex in range(self.nLocalSolidInterfaceNodes): GlobalIndex = SolidSolver.getInterfaceNodeGlobalIndex(self.solidInterfaceIdentifier, iVertex) - if GlobalIndex in self.SolidHaloNodeList[myid].keys(): - pass - else: + if GlobalIndex not in self.SolidHaloNodeList[myid].keys(): iGlobalVertex = self.__getGlobalIndex('solid', myid, localIndex) velx, vely, velz = SolidSolver.getInterfaceNodeVel(self.solidInterfaceIdentifier, iVertex) velxNm1, velyNm1, velzNm1 = SolidSolver.getInterfaceNodeVelNm1(self.solidInterfaceIdentifier, iVertex) @@ -1924,10 +1920,6 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): #If restart if FSI_config['RESTART_SOL'] == 'YES': TimeIterTreshold = -1 - self.MPIPrint("Reading the modal amplitudes at time n-1") - if myid in self.solidSolverProcessors: - SolidSolver.setRestart('nM1') - SolidSolver.setRestart('n') self.getSolidInterfaceDisplacement(SolidSolver) self.displacementPredictor(FSI_config, SolidSolver, deltaT) # We need now to update the solution because both restarter functions (solid and fluid) @@ -1935,7 +1927,8 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): # then to push it back once more to compute the solution at the next time level # Also this is required because in the fluid iteration preprocessor, if we do not update # and step to the next time level, there is a flag "fsi" that will initialise the flow - FluidSolver.Update() + if myid in self.fluidSolverProcessors: + FluidSolver.Update() if myid in self.solidSolverProcessors: SolidSolver.updateSolution() #If no restart @@ -1947,7 +1940,8 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): self.interpolateSolidPositionOnFluidMesh(FSI_config) self.setFluidInterfaceVarCoord(FluidSolver) self.MPIPrint('\nPerforming static mesh deformation (ALE) of initial mesh...\n') - FluidSolver.SetInitialMesh() # if there is an initial deformation in the solid, it has to be communicated to the fluid solver + if myid in self.fluidSolverProcessors: + FluidSolver.SetInitialMesh() # if there is an initial deformation in the solid, it has to be communicated to the fluid solver self.MPIPrint('\nFSI initial conditions are set') self.MPIPrint('Beginning time integration\n') @@ -1956,7 +1950,8 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): if TimeIter > TimeIterTreshold: NbFSIIter = NbFSIIterMax - self.MPIPrint('\n*************** Enter Block Gauss Seidel (BGS) method for strong coupling FSI on time iteration {} ***************'.format(TimeIter)) + self.MPIPrint("\n") + self.MPIPrint(" Enter Block Gauss Seidel (BGS) method for strong coupling FSI on time iteration {} ".format(TimeIter).center(80,"*")) else: NbFSIIter = 1 @@ -1972,27 +1967,28 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): self.interpolateSolidPositionOnFluidMesh(FSI_config) self.MPIPrint('\nPerforming dynamic mesh deformation (ALE)...\n') self.setFluidInterfaceVarCoord(FluidSolver) - if self.FSIIter == 0: - FluidSolver.Preprocess(TimeIter) # set some parameters before temporal fluid iteration and dynamic mesh update - else: - FluidSolver.DynamicMeshUpdate(TimeIter) + if myid in self.fluidSolverProcessors: + if self.FSIIter == 0: + FluidSolver.Preprocess(TimeIter) # set some parameters before temporal fluid iteration and dynamic mesh update + else: + FluidSolver.DynamicMeshUpdate(TimeIter) # --- Fluid solver call for FSI subiteration --- # self.MPIPrint('\nLaunching fluid solver for one single dual-time iteration...') self.MPIBarrier() - FluidSolver.ResetConvergence() - FluidSolver.Run() - self.MPIBarrier() - FluidSolver.Postprocess() - self.MPIBarrier() - - # --- Surface fluid loads interpolation and communication --- # - if not self.ImposedMotion: - self.MPIPrint('\nProcessing interface fluid loads...\n') + if myid in self.fluidSolverProcessors: + FluidSolver.ResetConvergence() + FluidSolver.Run() self.MPIBarrier() - self.getFluidInterfaceNodalForce(FSI_config, FluidSolver) + FluidSolver.Postprocess() self.MPIBarrier() + + # --- Surface fluid loads interpolation and communication --- # if TimeIter > TimeIterTreshold: if not self.ImposedMotion: + self.MPIPrint('\nProcessing interface fluid loads...\n') + self.MPIBarrier() + self.getFluidInterfaceNodalForce(FSI_config, FluidSolver) + self.MPIBarrier() self.interpolateFluidLoadsOnSolidMesh(FSI_config) self.setSolidInterfaceLoads(SolidSolver, FSI_config) @@ -2023,9 +2019,10 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): self.writeFSIHistory(TimeIter, time, varCoordNorm, FSIConv) # --- Update, monitor and output the fluid solution before the next time step ---# - FluidSolver.Update() - FluidSolver.Monitor(TimeIter) - FluidSolver.Output(TimeIter) + if myid in self.fluidSolverProcessors: + FluidSolver.Update() + FluidSolver.Monitor(TimeIter) + FluidSolver.Output(TimeIter) if TimeIter >= TimeIterTreshold: if myid in self.solidSolverProcessors: @@ -2069,7 +2066,8 @@ def SteadyFSI(self, FSI_config,FluidSolver, SolidSolver): self.MPIPrint('\n********************************') self.MPIPrint('* Begin steady FSI computation *') self.MPIPrint('********************************\n') - self.MPIPrint('\n*************** Enter Block Gauss Seidel (BGS) method for strong coupling FSI ***************') + self.MPIPrint("\n") + self.MPIPrint(" Enter Block Gauss Seidel (BGS) method for strong coupling FSI ".center(80,"*")) self.MPIPrint('Setting initial deformed mesh') if myid in self.solidSolverProcessors: @@ -2086,15 +2084,16 @@ def SteadyFSI(self, FSI_config,FluidSolver, SolidSolver): self.MPIPrint('\nLaunching fluid solver for a steady computation...') # --- Fluid solver call for FSI subiteration ---# - FluidSolver.ResetConvergence() #This is setting to zero the convergence in the integrator, important to reset it - # The mesh will be deformed in the context of the preprocessor, there is no need to set the initial - # mesh pushing back the solution to avoid spurious velocities, as the velocity is not computed at all - self.MPIPrint('\nPerforming static mesh deformation...\n') - FluidSolver.Preprocess(0)# This will attempt to always set the initial condition, but there is a flag on the unsteady computation that will avoid it - FluidSolver.Run() - FluidSolver.Postprocess() - FluidSolver.Monitor(0) #This is actually not needed, it only saves the fact that the fluid solver converged innerly or reached max iterations - FluidSolver.Output(0) + if myid in self.fluidSolverProcessors: + FluidSolver.ResetConvergence() #This is setting to zero the convergence in the integrator, important to reset it. + # The mesh will be deformed in the context of the preprocessor, there is no need to set the initial + # mesh pushing back the solution to avoid spurious velocities, as the velocity is not computed at all + self.MPIPrint('\nPerforming static mesh deformation...\n') + FluidSolver.Preprocess(0)# This will attempt to always set the initial condition, but there is a flag on the unsteady computation that will avoid it + FluidSolver.Run() + FluidSolver.Postprocess() + FluidSolver.Monitor(0) #This is actually not needed, it only saves the fact that the fluid solver converged innerly or reached max iterations + FluidSolver.Output(0) # --- Surface fluid loads interpolation and communication ---# if not self.ImposedMotion: diff --git a/SU2_PY/FSI_tools/FSI_config.py b/SU2_PY/FSI_tools/FSI_config.py index f41374a4cadd..f121beaebd9d 100644 --- a/SU2_PY/FSI_tools/FSI_config.py +++ b/SU2_PY/FSI_tools/FSI_config.py @@ -3,7 +3,7 @@ ## \file FSI_config.py # \brief Python class for handling configuration file for FSI computation. # \authors Nicola Fonzi, Vittorio Cavalieri based on the work of David Thomas -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society @@ -39,8 +39,10 @@ # Imports # ---------------------------------------------------------------------- -import os, sys, shutil, copy -from FSI_tools.switch import switch +import os +import sys +import shutil +import copy # ---------------------------------------------------------------------- # FSI Configuration Class @@ -56,6 +58,7 @@ def __init__(self,FileName): self.ConfigFileName = FileName self._ConfigContent = {} self.readConfig() + self.applyDefaults() def __str__(self): tempString = str() @@ -85,37 +88,37 @@ def readConfig(self): this_param = line[0].strip() this_value = line[1].strip() - for case in switch(this_param): #integer values - if case("NDIM") : pass - if case("RESTART_ITER") : pass - if case("TIME_TRESHOLD") : pass - if case("NB_FSI_ITER") : - self._ConfigContent[this_param] = int(this_value) - break + if (this_param == "NDIM") or \ + (this_param == "RESTART_ITER") or \ + (this_param == "TIME_TRESHOLD") or \ + (this_param == "NB_FSI_ITER") : + self._ConfigContent[this_param] = int(this_value) #float values - if case("RBF_RADIUS") : pass - if case("AITKEN_PARAM") : pass - if case("UNST_TIMESTEP") : pass - if case("UNST_TIME") : pass - if case("FSI_TOLERANCE") : - self._ConfigContent[this_param] = float(this_value) - break + elif (this_param == "RBF_RADIUS") or \ + (this_param == "AITKEN_PARAM") or \ + (this_param == "UNST_TIMESTEP") or \ + (this_param == "UNST_TIME") or \ + (this_param == "FSI_TOLERANCE") : + self._ConfigContent[this_param] = float(this_value) #string values - if case("CFD_CONFIG_FILE_NAME") : pass - if case("CSD_SOLVER") : pass - if case("CSD_CONFIG_FILE_NAME") : pass - if case("RESTART_SOL") : pass - if case("MATCHING_MESH") : pass - if case("MESH_INTERP_METHOD") : pass - if case("DISP_PRED") : pass - if case("AITKEN_RELAX") : pass - if case("TIME_MARCHING") : - self._ConfigContent[this_param] = this_value - break + elif (this_param == "CFD_CONFIG_FILE_NAME") or \ + (this_param == "CSD_SOLVER") or \ + (this_param == "CSD_CONFIG_FILE_NAME") or \ + (this_param == "RESTART_SOL") or \ + (this_param == "MATCHING_MESH") or \ + (this_param == "MESH_INTERP_METHOD") or \ + (this_param == "DISP_PRED") or \ + (this_param == "AITKEN_RELAX") or \ + (this_param == "TIME_MARCHING") : + self._ConfigContent[this_param] = this_value - if case(): - print(this_param + " is an invalid option !") - break + else : + print(this_param + " is an invalid option !") + + def applyDefaults(self): + if self._ConfigContent["CSD_SOLVER"] == "IMPOSED": + self._ConfigContent["AITKEN_RELAX"] = "STATIC" + self._ConfigContent["AITKEN_PARAM"] = 1.0 diff --git a/SU2_PY/FSI_tools/__init__.py b/SU2_PY/FSI_tools/__init__.py index e843f12bbe49..ec8ad1b64101 100644 --- a/SU2_PY/FSI_tools/__init__.py +++ b/SU2_PY/FSI_tools/__init__.py @@ -1,3 +1,2 @@ from FSI_tools.FSIInterface import Interface -from FSI_tools.switch import switch from FSI_tools.FSI_config import FSIConfig diff --git a/SU2_PY/FSI_tools/switch.py b/SU2_PY/FSI_tools/switch.py deleted file mode 100644 index b42eaf6e9ddd..000000000000 --- a/SU2_PY/FSI_tools/switch.py +++ /dev/null @@ -1,52 +0,0 @@ -# ------------------------------------------------------------------- -# Switch Class -# ------------------------------------------------------------------- -# source: Brian Beck, PSF License, ActiveState Code -# http://code.activestate.com/recipes/410692/ - -class switch(object): - """ Readable switch construction - - Example: - - c = 'z' - for case in switch(c): - if case('a'): pass # only necessary if the rest of the suite is empty - if case('b'): pass - # ... - if case('y'): pass - if case('z'): - print("c is lowercase!") - break - if case('A'): pass - # ... - if case('Z'): - print("c is uppercase!") - break - if case(): # default - print("I dunno what c was!") - - source: Brian Beck, PSF License, ActiveState Code - http://code.activestate.com/recipes/410692/ - """ - - def __init__(self, value): - self.value = value - self.fall = False - - def __iter__(self): - """Return the match method once, then stop""" - yield self.match - raise StopIteration - - def match(self, *args): - """Indicate whether or not to enter a case suite""" - if self.fall or not args: - return True - elif self.value in args: - self.fall = True - return True - else: - return False - -#: class switch() diff --git a/SU2_PY/Makefile.am b/SU2_PY/Makefile.am index 82b41fb5c9dd..a14b487b8628 100644 --- a/SU2_PY/Makefile.am +++ b/SU2_PY/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for the SU2 Python framework # \author M. Colonno, T. Economon, F. Palacios, T. Lukaczyk -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society diff --git a/SU2_PY/OptimalPropeller.py b/SU2_PY/OptimalPropeller.py index 12f95067fe4a..82112804ec12 100644 --- a/SU2_PY/OptimalPropeller.py +++ b/SU2_PY/OptimalPropeller.py @@ -1,7 +1,7 @@ ## \file OptimalPropeller.py # \brief Python script for generating the ActuatorDisk.dat file. # \author E. Saetta, L. Russo, R. Tognaccini -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/eval/design.py b/SU2_PY/SU2/eval/design.py index 606c68a28ce3..96e14e0f8753 100644 --- a/SU2_PY/SU2/eval/design.py +++ b/SU2_PY/SU2/eval/design.py @@ -3,7 +3,7 @@ ## \file design.py # \brief python package for designs # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/eval/functions.py b/SU2_PY/SU2/eval/functions.py index 066182004f28..7f30df262d97 100644 --- a/SU2_PY/SU2/eval/functions.py +++ b/SU2_PY/SU2/eval/functions.py @@ -3,7 +3,7 @@ ## \file functions.py # \brief python package for functions # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -223,6 +223,8 @@ def aerodynamics( config, state=None ): name = su2io.expand_part(name,config) link.extend(name) + pull.extend(config.get('CONFIG_LIST',[])) + # files: restarts if config.get('TIME_DOMAIN', 'NO') == 'YES' and config.get('RESTART_SOL','NO') =='YES': if 'RESTART_FILE_1' in files: # not the case for directdiff restart @@ -311,10 +313,9 @@ def aerodynamics( config, state=None ): su2io.update_persurface(konfig,state) # return output funcs = su2util.ordered_bunch() - for key in su2io.historyOutFields: - if key in state['FUNCTIONS']: + for key in state['FUNCTIONS']: funcs[key] = state['FUNCTIONS'][key] - + return funcs #: def aerodynamics() @@ -909,7 +910,9 @@ def update_mesh(config,state=None): pull = [] link = config['MESH_FILENAME'] link = su2io.expand_part(link,config) - + + pull.extend(config.get('CONFIG_LIST',[])) + # output redirection with redirect_folder('DEFORM',pull,link) as push: with redirect_output(log_deform): diff --git a/SU2_PY/SU2/eval/gradients.py b/SU2_PY/SU2/eval/gradients.py index eef13c15756f..6b33039e030c 100644 --- a/SU2_PY/SU2/eval/gradients.py +++ b/SU2_PY/SU2/eval/gradients.py @@ -3,7 +3,7 @@ ## \file gradients.py # \brief python package for gradients # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -767,15 +767,20 @@ def findiff( config, state=None ): else: step = 0.001 + opt_names = [] + for i in range(config['NZONES']): + for key in sorted(su2io.historyOutFields): + if su2io.historyOutFields[key]['TYPE'] == 'COEFFICIENT': + if (config['NZONES'] == 1): + opt_names.append(key) + else: + opt_names.append(key + '[' + str(i) + ']') + # ---------------------------------------------------- # Redundancy Check # ---------------------------------------------------- # master redundancy check - opt_names = [] - for key in sorted(su2io.historyOutFields): - if su2io.historyOutFields[key]['TYPE'] == 'COEFFICIENT': - opt_names.append(key) findiff_todo = all([key in state.GRADIENTS for key in opt_names]) if findiff_todo: grads = state['GRADIENTS'] @@ -827,7 +832,8 @@ def findiff( config, state=None ): # files to pull files = state['FILES'] - pull = []; link = [] + pull = []; link = [] + pull.extend(config.get('CONFIG_LIST',[])) # files: mesh name = files['MESH'] name = su2io.expand_part(name,konfig) diff --git a/SU2_PY/SU2/io/config.py b/SU2_PY/SU2/io/config.py index 81916ba14abd..242c0b70002c 100755 --- a/SU2_PY/SU2/io/config.py +++ b/SU2_PY/SU2/io/config.py @@ -3,7 +3,7 @@ ## \file config.py # \brief python package for config # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -470,6 +470,10 @@ def read_config(filename): data_dict[this_param] = this_value.strip("()").split(",") data_dict[this_param] = [i.strip(" ") for i in data_dict[this_param]] break + if case("CONFIG_LIST"): + data_dict[this_param] = this_value.strip("()").split(",") + data_dict[this_param] = [i.strip(" ") for i in data_dict[this_param]] + break if case("HISTORY_OUTPUT"): data_dict[this_param] = this_value.strip("()").split(",") data_dict[this_param] = [i.strip(" ") for i in data_dict[this_param]] @@ -907,6 +911,16 @@ def write_config(filename,param_dict): output_file.write(", ") output_file.write(")") break + + if case("CONFIG_LIST"): + n_lists = len(new_value) + output_file.write("(") + for i_value in range(n_lists): + output_file.write(new_value[i_value]) + if i_value+1 < n_lists: + output_file.write(", ") + output_file.write(")") + break if case("HISTORY_OUTPUT"): n_lists = len(new_value) diff --git a/SU2_PY/SU2/io/config_options.py b/SU2_PY/SU2/io/config_options.py index 74fe5e0b663b..e3c24d9227df 100644 --- a/SU2_PY/SU2/io/config_options.py +++ b/SU2_PY/SU2/io/config_options.py @@ -1,7 +1,7 @@ # \file config_options.py # \brief python package for config # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/io/data.py b/SU2_PY/SU2/io/data.py index 0a018be4e8f9..f0fcb80d10c9 100644 --- a/SU2_PY/SU2/io/data.py +++ b/SU2_PY/SU2/io/data.py @@ -3,7 +3,7 @@ ## \file data.py # \brief python package for data utility functions # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/io/filelock.py b/SU2_PY/SU2/io/filelock.py index 14a9d5ed4ad5..7bce2934b5e7 100644 --- a/SU2_PY/SU2/io/filelock.py +++ b/SU2_PY/SU2/io/filelock.py @@ -3,7 +3,7 @@ ## \file filelock.py # \brief python package for filelocking # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/io/historyMap.py b/SU2_PY/SU2/io/historyMap.py index 157218eaeaaf..f809b9a426dc 100644 --- a/SU2_PY/SU2/io/historyMap.py +++ b/SU2_PY/SU2/io/historyMap.py @@ -374,6 +374,10 @@ 'GROUP': 'D_ENGINE_OUTPUT', 'HEADER': 'd[SolidCDrag]', 'TYPE': 'D_COEFFICIENT'}, + 'D_STRESS_PENALTY': {'DESCRIPTION': 'Derivative value', + 'GROUP': 'D_STRUCT_COEFF', + 'HEADER': 'd[StressPen]', + 'TYPE': 'D_COEFFICIENT'}, 'D_SURFACE_MACH': {'DESCRIPTION': 'Derivative value', 'GROUP': 'D_FLOW_COEFF', 'HEADER': 'd[Avg_Mach]', @@ -868,6 +872,10 @@ 'GROUP': 'ENGINE_OUTPUT', 'HEADER': 'SolidCDrag', 'TYPE': 'COEFFICIENT'}, + 'STRESS_PENALTY': {'DESCRIPTION': '', + 'GROUP': 'STRUCT_COEFF', + 'HEADER': 'StressPen', + 'TYPE': 'COEFFICIENT'}, 'SURFACE_MACH': {'DESCRIPTION': 'Total average mach number on all markers set ' 'in MARKER_ANALYZE', 'GROUP': 'FLOW_COEFF', @@ -1114,6 +1122,11 @@ 'GROUP': 'TAVG_D_ENGINE_OUTPUT', 'HEADER': 'dtavg[SolidCDrag]', 'TYPE': 'TAVG_D_COEFFICIENT'}, + 'TAVG_D_STRESS_PENALTY': {'DESCRIPTION': 'weighted time average derivative ' + 'value', + 'GROUP': 'TAVG_D_STRUCT_COEFF', + 'HEADER': 'dtavg[StressPen]', + 'TYPE': 'TAVG_D_COEFFICIENT'}, 'TAVG_D_SURFACE_MACH': {'DESCRIPTION': 'weighted time average derivative ' 'value', 'GROUP': 'TAVG_D_FLOW_COEFF', @@ -1293,6 +1306,10 @@ 'GROUP': 'TAVG_ENGINE_OUTPUT', 'HEADER': 'tavg[SolidCDrag]', 'TYPE': 'TAVG_COEFFICIENT'}, + 'TAVG_STRESS_PENALTY': {'DESCRIPTION': 'weighted time average value', + 'GROUP': 'TAVG_STRUCT_COEFF', + 'HEADER': 'tavg[StressPen]', + 'TYPE': 'TAVG_COEFFICIENT'}, 'TAVG_SURFACE_MACH': {'DESCRIPTION': 'weighted time average value', 'GROUP': 'TAVG_FLOW_COEFF', 'HEADER': 'tavg[Avg_Mach]', diff --git a/SU2_PY/SU2/io/redirect.py b/SU2_PY/SU2/io/redirect.py index b973d189a3c1..a5eb3d719874 100644 --- a/SU2_PY/SU2/io/redirect.py +++ b/SU2_PY/SU2/io/redirect.py @@ -3,7 +3,7 @@ ## \file redirect.py # \brief python package for file redirection # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/io/state.py b/SU2_PY/SU2/io/state.py index be4265640aad..b16e58693e79 100644 --- a/SU2_PY/SU2/io/state.py +++ b/SU2_PY/SU2/io/state.py @@ -3,7 +3,7 @@ ## \file state.py # \brief python package for state # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/io/tools.py b/SU2_PY/SU2/io/tools.py index 4b0f9c401b7e..d03d7bdd1657 100755 --- a/SU2_PY/SU2/io/tools.py +++ b/SU2_PY/SU2/io/tools.py @@ -3,7 +3,7 @@ ## \file tools.py # \brief file i/o functions # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -154,10 +154,15 @@ def read_history( History_filename, nZones = 1): for key in plot_data.keys(): var = key for field in historyOutFields: - if key == historyOutFields[field]['HEADER']: + + if key == historyOutFields[field]['HEADER'] and nZones == 1: var = field + + if key.split('[')[0] == historyOutFields[field]['HEADER'] and nZones > 1: + var = field + '[' + key.split('[')[1] + history_data[var] = plot_data[key] - + return history_data #: def read_history() @@ -323,9 +328,15 @@ def read_aerodynamics( History_filename , nZones = 1, special_cases=[], final_av # pull only these functions Func_Values = ordered_bunch() for this_objfun in historyOutFields: - if this_objfun in history_data: - if historyOutFields[this_objfun]['TYPE'] == 'COEFFICIENT' or historyOutFields[this_objfun]['TYPE'] == 'D_COEFFICIENT': - Func_Values[this_objfun] = history_data[this_objfun] + if nZones == 1: + if this_objfun in history_data: + if historyOutFields[this_objfun]['TYPE'] == 'COEFFICIENT' or historyOutFields[this_objfun]['TYPE'] == 'D_COEFFICIENT': + Func_Values[this_objfun] = history_data[this_objfun] + else: + for iZone in range(nZones): + if this_objfun + '[' + str(iZone) + ']' in history_data: + if historyOutFields[this_objfun]['TYPE'] == 'COEFFICIENT' or historyOutFields[this_objfun]['TYPE'] == 'D_COEFFICIENT': + Func_Values[this_objfun + '[' + str(iZone) + ']'] = history_data[this_objfun + '[' + str(iZone) + ']'] if 'TIME_MARCHING' in special_cases: # for unsteady cases, average time-accurate objective function values diff --git a/SU2_PY/SU2/opt/project.py b/SU2_PY/SU2/opt/project.py index b387bfe1ca17..9b542e0e3e1b 100644 --- a/SU2_PY/SU2/opt/project.py +++ b/SU2_PY/SU2/opt/project.py @@ -3,7 +3,7 @@ ## \file project.py # \brief package for optimization projects # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/opt/scipy_tools.py b/SU2_PY/SU2/opt/scipy_tools.py index 8b49091fa34d..6e96a0f63323 100644 --- a/SU2_PY/SU2/opt/scipy_tools.py +++ b/SU2_PY/SU2/opt/scipy_tools.py @@ -3,7 +3,7 @@ ## \file scipy_tools.py # \brief tools for interfacing with scipy # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/run/adjoint.py b/SU2_PY/SU2/run/adjoint.py index 43c042056d46..66ba0ad05f60 100644 --- a/SU2_PY/SU2/run/adjoint.py +++ b/SU2_PY/SU2/run/adjoint.py @@ -3,7 +3,7 @@ ## \file adjoint.py # \brief python package for running adjoint problems # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/run/deform.py b/SU2_PY/SU2/run/deform.py index dd8394f78aff..94f312c07501 100644 --- a/SU2_PY/SU2/run/deform.py +++ b/SU2_PY/SU2/run/deform.py @@ -3,7 +3,7 @@ ## \file deform.py # \brief python package for deforming meshes # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/run/direct.py b/SU2_PY/SU2/run/direct.py index dd97e0d095c9..abbeb7ca0c9b 100644 --- a/SU2_PY/SU2/run/direct.py +++ b/SU2_PY/SU2/run/direct.py @@ -3,7 +3,7 @@ ## \file direct.py # \brief python package for running direct solutions # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -91,10 +91,15 @@ def direct ( config ): # adapt the history_filename, if a restart solution is chosen # check for 'RESTART_ITER' is to avoid forced restart situation in "compute_polar.py"... if konfig.get('RESTART_SOL','NO') == 'YES' and konfig.get('RESTART_ITER',1) != 1: + if konfig.get('CONFIG_LIST',[]) != []: + konfig['CONV_FILENAME'] = 'config_CFD' # master cfg is always config_CFD. Hardcoded names are prob nt ideal. restart_iter = '_'+str(konfig['RESTART_ITER']).zfill(5) history_filename = konfig['CONV_FILENAME'] + restart_iter + plot_extension else: + if konfig.get('CONFIG_LIST',[]) != []: + konfig['CONV_FILENAME'] = 'config_CFD' history_filename = konfig['CONV_FILENAME'] + plot_extension + special_cases = su2io.get_specialCases(konfig) diff --git a/SU2_PY/SU2/run/geometry.py b/SU2_PY/SU2/run/geometry.py index 311029f75f76..05e9894bd9a5 100644 --- a/SU2_PY/SU2/run/geometry.py +++ b/SU2_PY/SU2/run/geometry.py @@ -3,7 +3,7 @@ ## \file geometry.py # \brief python package for running geometry analyses # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/run/interface.py b/SU2_PY/SU2/run/interface.py index 2d8f901c0c15..aaba83c626eb 100644 --- a/SU2_PY/SU2/run/interface.py +++ b/SU2_PY/SU2/run/interface.py @@ -3,7 +3,7 @@ ## \file interface.py # \brief python package interfacing with the SU2 suite # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/run/merge.py b/SU2_PY/SU2/run/merge.py index f035af4a1c35..bfcb3212e08f 100644 --- a/SU2_PY/SU2/run/merge.py +++ b/SU2_PY/SU2/run/merge.py @@ -1,7 +1,7 @@ ## \file merge.py # \brief python package for merging meshes # \author T. Economon, T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/run/projection.py b/SU2_PY/SU2/run/projection.py index c9878404d4cb..0c5d5256862f 100644 --- a/SU2_PY/SU2/run/projection.py +++ b/SU2_PY/SU2/run/projection.py @@ -3,7 +3,7 @@ ## \file projection.py # \brief python package for running gradient projection # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/util/filter_adjoint.py b/SU2_PY/SU2/util/filter_adjoint.py index 0c70cb12f09e..b3971c11b188 100644 --- a/SU2_PY/SU2/util/filter_adjoint.py +++ b/SU2_PY/SU2/util/filter_adjoint.py @@ -3,7 +3,7 @@ ## \file filter_adjoint.py # \brief Applies various filters to the adjoint surface sensitivities of an airfoil # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/util/plot.py b/SU2_PY/SU2/util/plot.py index 50b25bcc9014..5badbb95f55f 100644 --- a/SU2_PY/SU2/util/plot.py +++ b/SU2_PY/SU2/util/plot.py @@ -3,7 +3,7 @@ ## \file plot.py # \brief python package for plotting # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/util/polarSweepLib.py b/SU2_PY/SU2/util/polarSweepLib.py index 6f731a475bf3..a9a56bbf15e9 100755 --- a/SU2_PY/SU2/util/polarSweepLib.py +++ b/SU2_PY/SU2/util/polarSweepLib.py @@ -2,7 +2,7 @@ # \file polarSweepLib.py # \brief Functions library for compute_polar.py script. # \author E Arad -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2/util/which.py b/SU2_PY/SU2/util/which.py index e35b774f2c71..3e7b4069f1b4 100644 --- a/SU2_PY/SU2/util/which.py +++ b/SU2_PY/SU2/util/which.py @@ -3,7 +3,7 @@ ## \file which.py # \brief looks for where a program is # \author T. Lukaczyk, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2_CFD.py b/SU2_PY/SU2_CFD.py index dcfc15e6c578..b376cd4ae35c 100755 --- a/SU2_PY/SU2_CFD.py +++ b/SU2_PY/SU2_CFD.py @@ -3,7 +3,7 @@ ## \file SU2_CFD.py # \brief Python script to launch SU2_CFD through the Python Wrapper. # \author David Thomas -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/SU2_PY/SU2_Nastran/pysu2_nastran.py b/SU2_PY/SU2_Nastran/pysu2_nastran.py index 7ab6d07919a6..00a57fca8229 100644 --- a/SU2_PY/SU2_Nastran/pysu2_nastran.py +++ b/SU2_PY/SU2_Nastran/pysu2_nastran.py @@ -3,7 +3,7 @@ ## \file pysu2_nastran.py # \brief Structural solver using Nastran models # \authors Nicola Fonzi, Vittorio Cavalieri, based on the work of David Thomas -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -29,17 +29,85 @@ # Imports # ---------------------------------------------------------------------- -import os, sys, shutil, copy +import os +import shutil +import copy import numpy as np import scipy as sp import scipy.linalg as linalg from math import * -from FSI_tools.switch import switch # ---------------------------------------------------------------------- # Config class # ---------------------------------------------------------------------- +class ImposedMotionClass: + + def __init__(self,time0,typeOfMotion,parameters,mode): + + self.time0 = time0 + self.typeOfMotion = typeOfMotion + self.mode = mode + + if self.typeOfMotion == "SINUSOIDAL": + self.bias = parameters["BIAS"] + self.amplitude = parameters["AMPLITUDE"] + self.frequency = parameters["FREQUENCY"] + self.timeStart = parameters["TIME_0"] + + elif self.typeOfMotion == "BLENDED_STEP": + self.kmax = parameters["K_MAX"] + self.vinf = parameters["V_INF"] + self.lref = parameters["L_REF"] + self.amplitude = parameters["AMPLITUDE"] + self.timeStart = parameters["TIME_0"] + self.tmax = 2*pi/self.kmax*self.lref/self.vinf + self.omega0 = 1/2*self.kmax + + else: + raise Exception('Imposed function {} not found, please implement it in pysu2_nastran.py'.format(self.tipo)) + + + def GetDispl(self,time): + time = time - self.time0 - self.timeStart + if self.typeOfMotion == "SINUSOIDAL": + return self.bias+self.amplitude*sin(2*pi*self.frequency*time) + + if self.typeOfMotion == "BLENDED_STEP": + if time < 0: + return 0.0 + elif time < self.tmax: + return self.amplitude/2.0*(1.0-cos(self.omega0*time*self.vinf/self.lref)) + return self.amplitude + + + def GetVel(self,time): + time = time - self.time0 - self.timeStart + + if self.typeOfMotion == "SINUSOIDAL": + return self.amplitude*cos(2*pi*self.frequency*time)*2*pi*self.frequency + + if self.typeOfMotion == "BLENDED_STEP": + if time < 0: + return 0.0 + elif time < self.tmax: + return self.amplitude/2.0*sin(self.omega0*time*self.vinf/self.lref)*(self.omega0*self.vinf/self.lref) + return 0.0 + + def GetAcc(self,time): + time = time - self.time0 - self.timeStart + + if self.typeOfMotion == "SINUSOIDAL": + return -self.amplitude*sin(2*pi*self.frequency*time)*(2*pi*self.frequency)**2 + + if self.typeOfMotion == "BLENDED_STEP": + if time < 0: + return 0.0 + elif time < self.tmax: + return self.amplitude/2.0*cos(self.omega0*time*self.vinf/self.lref)*(self.omega0*self.vinf/self.lref)**2 + return 0.0 + + class RefSystem: def __init__(self): @@ -190,7 +258,8 @@ def __init__(self, config_fileName, ImposedMotion): self.Config_file = config_fileName self.Config = {} - print("\n------------------------------ Configuring the structural tester solver for FSI simulation ------------------------------") + print("\n") + print(" Configuring the structural tester solver for FSI simulation ".center(80,"-")) self.__readConfig() self.Mesh_file = self.Config['MESH_FILE'] @@ -222,14 +291,19 @@ def __init__(self, config_fileName, ImposedMotion): self.node = [] self.markers = {} self.refsystems = [] + self.ImposedMotionToSet = True + self.ImposedMotionFunction = [] - print("\n------------------------------ Reading the mesh ------------------------------") + print("\n") + print(" Reading the mesh ".center(80,"-")) self.__readNastranMesh() - print("\n------------------------------ Creating the structural model ------------------------------") + print("\n") + print(" Creating the structural model ".center(80,"-")) self.__setStructuralMatrices() - print("\n------------------------------ Setting the integration parameters ------------------------------") + print("\n") + print(" Setting the integration parameters ".center(80,"-")) self.__setIntegrationParameters() self.__setInitialConditions() @@ -242,6 +316,9 @@ def __init__(self, config_fileName, ImposedMotion): header = header + '\n' histFile.write(header) histFile.close() + else: + self.__setRestart('nM1') + self.__setRestart('n') def __readConfig(self): """ @@ -265,41 +342,37 @@ def __readConfig(self): this_param = line[0].strip() this_value = line[1].strip() - for case in switch(this_param): - #integer values - if case("NMODES") : pass - if case("IMPOSED_MODE") : pass - if case("RESTART_ITER") : - self.Config[this_param] = int(this_value) - break + #integer values + if (this_param == "NMODES") or \ + (this_param == "RESTART_ITER"): + self.Config[this_param] = int(this_value) - #float values - if case("DELTA_T") : pass - if case("MODAL_DAMPING") : pass - if case("RHO") : - self.Config[this_param] = float(this_value) - break - #string values - if case("TIME_MARCHING") : pass - if case("MESH_FILE") : pass - if case("PUNCH_FILE") : pass - if case("RESTART_SOL") : pass - if case("IMPOSED_DISP") : pass - if case("IMPOSED_VEL") : pass - if case("IMPOSED_ACC") : pass - if case("MOVING_MARKER") : - self.Config[this_param] = this_value - break + #float values + elif (this_param == "DELTA_T") or \ + (this_param == "MODAL_DAMPING") or \ + (this_param == "RHO"): + self.Config[this_param] = float(this_value) - #lists values - if case("INITIAL_MODES"): - self.Config[this_param] = eval(this_value) - break - if case(): - print(this_param + " is an invalid option !") - break + #string values + elif (this_param == "TIME_MARCHING") or \ + (this_param == "MESH_FILE") or \ + (this_param == "PUNCH_FILE") or \ + (this_param == "RESTART_SOL") or \ + (this_param == "MOVING_MARKER"): + self.Config[this_param] = this_value + + + #lists values + elif (this_param == "INITIAL_MODES") or \ + (this_param == "IMPOSED_MODES") or \ + (this_param == "IMPOSED_PARAMETERS"): + self.Config[this_param] = eval(this_value) + + + else: + raise Exception('{} is an invalid option !'.format(this_param)) @@ -342,7 +415,7 @@ def nastran_float(s): if self.refsystems[iRefSys].GetCID()==CP: break if self.refsystems[iRefSys].GetCID()!=CP: - sys.exit('Definition reference {} system not found'.format(CP)) + raise Exception('Definition reference {} system not found'.format(CP)) DeltaPos = self.refsystems[iRefSys].GetOrigin() RotatedPos = self.refsystems[iRefSys].GetRotMatrix().dot(np.array([[x],[y],[z]])) x = RotatedPos[0]+DeltaPos[0] @@ -367,8 +440,7 @@ def nastran_float(s): self.refsystems[self.nRefSys].SetCID(CID) RID = int(line[16:24]) if RID!=0: - print('ERROR: Reference system {} must be defined with respect to global reference system'.format(CID)) - sys.exit() + raise Exception('ERROR: Reference system {} must be defined with respect to global reference system'.format(CID)) self.refsystems[self.nRefSys].SetRID(RID) AX = nastran_float(line[24:32]) AY = nastran_float(line[32:40]) @@ -411,7 +483,7 @@ def nastran_float(s): for iPoint in range(self.nPoint): if self.node[iPoint].GetID() == ID: break - self.markers[self.FSI_marker].append(iPoint) + self.markers[markerTag].append(iPoint) existValue = len(line)>=1 continue @@ -480,7 +552,7 @@ def __setStructuralMatrices(self): if self.refsystems[iRefSys].GetCID()==self.node[iPoint].GetCD(): break if self.refsystems[iRefSys].GetCID()!=self.node[iPoint].GetCD(): - sys.exit('Output reference {} system not found'.format(self.node[iPoint].GetCD())) + raise Exception('Output reference {} system not found'.format(self.node[iPoint].GetCD())) RotatedOutput = self.refsystems[iRefSys].GetRotMatrix().dot(np.array([[ux],[uy],[uz]])) ux = RotatedOutput[0] uy = RotatedOutput[1] @@ -503,8 +575,7 @@ def __setStructuralMatrices(self): self.UzT = self.Uz.transpose() if nSU2_SOL.cpp file. * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/SU2_SOL/obj/Makefile.am b/SU2_SOL/obj/Makefile.am index 0d4d922e5f71..0adac8730146 100644 --- a/SU2_SOL/obj/Makefile.am +++ b/SU2_SOL/obj/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for SU2_SOL # \author M. Colonno, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society diff --git a/SU2_SOL/src/SU2_SOL.cpp b/SU2_SOL/src/SU2_SOL.cpp index c0cfcf719e8b..6b191747cafa 100644 --- a/SU2_SOL/src/SU2_SOL.cpp +++ b/SU2_SOL/src/SU2_SOL.cpp @@ -2,7 +2,7 @@ * \file SU2_SOL.cpp * \brief Main file for the solution export/conversion code (SU2_SOL). * \author F. Palacios, T. Economon - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { /*--- MPI initialization ---*/ SU2_MPI::Init(&argc,&argv); - SU2_MPI::Comm MPICommunicator(MPI_COMM_WORLD); + SU2_MPI::Comm MPICommunicator = SU2_MPI::GetComm(); const int rank = SU2_MPI::GetRank(); const int size = SU2_MPI::GetSize(); diff --git a/TestCases/.gitignore b/TestCases/.gitignore index 6ee7dd18cdce..315ff14f09e1 100644 --- a/TestCases/.gitignore +++ b/TestCases/.gitignore @@ -9,19 +9,23 @@ # changes to the meshes/solutions/restarts. # Things appearing in TestCases/ repo to ignore: +# mesh files *.su2 +*.cgns +*.pw + +# binary/ascii restart/solution files. Note that .csv can be a history, of_grad, etc file as well. *.dat -*.vtk *.csv -*.plt -*.szplt -*.pw + +# auto-generated files by regression tests +*.autotest +config_*.cfg + +# flip the pickle +*.pkl + *.IGS -*.cgns *.tgz COPYING -README.md -*.autotest -config_*.cfg *.eqn -*.pkl diff --git a/TestCases/TestCase.py b/TestCases/TestCase.py index 10907f87fb20..bfba1a8aa8a0 100644 --- a/TestCases/TestCase.py +++ b/TestCases/TestCase.py @@ -3,7 +3,7 @@ ## \file TestCase.py # \brief Python class for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/TestCases/aeroelastic/aeroelastic_NACA64A010.cfg b/TestCases/aeroelastic/aeroelastic_NACA64A010.cfg index e54c2d5e5a2b..4b0e1af21f7f 100644 --- a/TestCases/aeroelastic/aeroelastic_NACA64A010.cfg +++ b/TestCases/aeroelastic/aeroelastic_NACA64A010.cfg @@ -5,7 +5,7 @@ % Author: Santiago Padron % % Institution: Stanford University % % Date: 07-09-15 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/axisymmetric_rans/air_nozzle/air_nozzle.cfg b/TestCases/axisymmetric_rans/air_nozzle/air_nozzle.cfg new file mode 100644 index 000000000000..f40f1775b496 --- /dev/null +++ b/TestCases/axisymmetric_rans/air_nozzle/air_nozzle.cfg @@ -0,0 +1,214 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Axisymmetric supersonic converging-diverging air nozzle % +% Author: Florian Dittmann % +% Date: 2021.12.02 % +% File Version 7.10 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +% Physical governing equations (EULER, NAVIER_STOKES, +% FEM_EULER, FEM_NAVIER_STOKES, FEM_RANS, FEM_LES, +% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY, +% POISSON_EQUATION) +SOLVER= RANS +% +% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP) +KIND_TURB_MODEL= SST +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= YES +% +% System of measurements (SI, US) +% International system of units (SI): ( meters, kilograms, Kelvins, +% Newtons = kg m/s^2, Pascals = N/m^2, +% Density = kg/m^3, Speed = m/s, +% Equiv. Area = m^2 ) +% United States customary units (US): ( inches, slug, Rankines, lbf = slug ft/s^2, +% psf = lbf/ft^2, Density = slug/ft^3, +% Speed = ft/s, Equiv. Area = ft^2 ) +SYSTEM_MEASUREMENTS= SI +% +AXISYMMETRIC= YES +% +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 1E-9 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 0.0 +% +% Side-slip angle (degrees, only for compressible flows) +SIDESLIP_ANGLE= 0.0 +% +% Init option to choose between Reynolds (default) or thermodynamics quantities +% for initializing the solution (REYNOLDS, TD_CONDITIONS) +INIT_OPTION= TD_CONDITIONS +% +% Free-stream option to choose between density and temperature (default) for +% initializing the solution (TEMPERATURE_FS, DENSITY_FS) +FREESTREAM_OPTION= TEMPERATURE_FS +% +% Free-stream pressure (101325.0 N/m^2, 2116.216 psf by default) +FREESTREAM_PRESSURE= 1400000 +% +% Free-stream temperature (288.15 K, 518.67 R by default) +FREESTREAM_TEMPERATURE= 373.15 +% +% Compressible flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE, +% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE) +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ---- IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------% +% +% Fluid model (STANDARD_AIR, IDEAL_GAS, VW_GAS, PR_GAS, +% CONSTANT_DENSITY, INC_IDEAL_GAS, INC_IDEAL_GAS_POLY) +FLUID_MODEL= STANDARD_AIR + +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY, POLYNOMIAL_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity that would be constant (1.716E-5 by default) +MU_CONSTANT= 1.716E-5 + +% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% +% +% Laminar Conductivity model (CONSTANT_CONDUCTIVITY, CONSTANT_PRANDTL, +% POLYNOMIAL_CONDUCTIVITY). +CONDUCTIVITY_MODEL= CONSTANT_PRANDTL +% +% Laminar Prandtl number (0.72 (air), only for CONSTANT_PRANDTL) +PRANDTL_LAM= 0.72 +% +% Turbulent Prandtl number (0.9 (air) by default) +PRANDTL_TURB= 0.90 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% Navier-Stokes (no-slip), constant heat flux wall marker(s) (NONE = no marker) +% Format: ( marker name, constant heat flux (J/m^2), ... ) +MARKER_HEATFLUX= ( WALL, 0.0 ) +% +% Symmetry boundary marker(s) (NONE = no marker) +MARKER_SYM= ( SYMMETRY ) +% +% Riemann boundary marker(s) (NONE = no marker) +% Format: (marker, data kind flag, list of data) +MARKER_RIEMANN= ( INFLOW, TOTAL_CONDITIONS_PT, 1400000.0, 373.15, 1.0, 0.0, 0.0, OUTFLOW, STATIC_PRESSURE, 100000.0, 0.0, 0.0, 0.0, 0.0 ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= GREEN_GAUSS +% +% CFL number (initial value for the adaptive CFL number) +CFL_NUMBER= 1000.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= ( 0.1, 2.0, 10.0, 1000.0 ) +% +% Maximum Delta Time in local time stepping simulations +MAX_DELTA_TIME= 1E6 + +% ----------- SLOPE LIMITER AND DISSIPATION SENSOR DEFINITION -----------------% +% +% 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 + +% ------------------------ 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 +% +% Linear 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= 0.01 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-grid levels (0 = no multi-grid) +MGLEVEL= 0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, AUSMPLUSUP, AUSMPLUSUP2, HLLC, +% TURKEL_PREC, MSW, FDS) +CONV_NUM_METHOD_FLOW= ROE +% +% Entropy fix coefficient (0.0 implies no entropy fixing, 1.0 implies scalar +% artificial dissipation) +ENTROPY_FIX_COEFF= 0.1 +% +% 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 +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT +% +% Reduction factor of the CFL coefficient in the turbulence problem +CFL_REDUCTION_TURB= 1.0 + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Number of total iterations +ITER= 1000 +% +% Convergence criteria (CAUCHY, RESIDUAL) +CONV_CRITERIA= RESIDUAL +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -12 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= nozzle.su2 +% +% Mesh input file format (SU2, CGNS) +MESH_FORMAT= SU2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 1000 +% +% Screen output +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, RMS_TKE, RMS_DISSIPATION) diff --git a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg index e519891a2a1d..8e900c460e8b 100644 --- a/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg +++ b/TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -112,7 +112,7 @@ LINEAR_SOLVER_ERROR= 1E-6 % Max number of iterations of the linear solver for the implicit formulation LINEAR_SOLVER_ITER= 5 % -% Linael solver ILU preconditioner fill-in level (1 by default) +% Linear solver ILU preconditioner fill-in level (1 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % -------------------------- MULTIGRID PARAMETERS -----------------------------% diff --git a/TestCases/cont_adj_euler/naca0012/inv_NACA0012_FD.cfg b/TestCases/cont_adj_euler/naca0012/inv_NACA0012_FD.cfg index d5e37789b0c0..336c812eef1f 100644 --- a/TestCases/cont_adj_euler/naca0012/inv_NACA0012_FD.cfg +++ b/TestCases/cont_adj_euler/naca0012/inv_NACA0012_FD.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -110,7 +110,7 @@ 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 (1 by default) +% Linear solver ILU preconditioner fill-in level (1 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % -------------------------- MULTIGRID PARAMETERS -----------------------------% diff --git a/TestCases/cont_adj_euler/naca0012/inv_NACA0012_discadj.cfg b/TestCases/cont_adj_euler/naca0012/inv_NACA0012_discadj.cfg index 04fc13125f2d..91212cb018da 100644 --- a/TestCases/cont_adj_euler/naca0012/inv_NACA0012_discadj.cfg +++ b/TestCases/cont_adj_euler/naca0012/inv_NACA0012_discadj.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/cont_adj_euler/oneram6/inv_ONERAM6.cfg b/TestCases/cont_adj_euler/oneram6/inv_ONERAM6.cfg index 8d43458e9a6e..786d4594004d 100644 --- a/TestCases/cont_adj_euler/oneram6/inv_ONERAM6.cfg +++ b/TestCases/cont_adj_euler/oneram6/inv_ONERAM6.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2015.08.25 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/cont_adj_euler/wedge/inv_wedge_ROE.cfg b/TestCases/cont_adj_euler/wedge/inv_wedge_ROE.cfg index 74273c989ee0..8345cee9d9f1 100644 --- a/TestCases/cont_adj_euler/wedge/inv_wedge_ROE.cfg +++ b/TestCases/cont_adj_euler/wedge/inv_wedge_ROE.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.10.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/cont_adj_euler/wedge/inv_wedge_ROE_multiobj.cfg b/TestCases/cont_adj_euler/wedge/inv_wedge_ROE_multiobj.cfg index 88ba1cf853b9..5857b07586d5 100644 --- a/TestCases/cont_adj_euler/wedge/inv_wedge_ROE_multiobj.cfg +++ b/TestCases/cont_adj_euler/wedge/inv_wedge_ROE_multiobj.cfg @@ -6,7 +6,7 @@ % Author: H.L. Kline, modified from inviscid wedge by Thomas D. Economon % % Institution: Stanford University % % Date: 2018.01.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -112,7 +112,7 @@ LINEAR_SOLVER_ITER= 5 % Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) LINEAR_SOLVER_PREC= ILU % -% Linael solver ILU preconditioner fill-in level (1 by default) +% Linear solver ILU preconditioner fill-in level (1 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 diff --git a/TestCases/cont_adj_navierstokes/cylinder/lam_cylinder.cfg b/TestCases/cont_adj_navierstokes/cylinder/lam_cylinder.cfg index 7da2d683a4ac..903168413769 100644 --- a/TestCases/cont_adj_navierstokes/cylinder/lam_cylinder.cfg +++ b/TestCases/cont_adj_navierstokes/cylinder/lam_cylinder.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.03.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/cont_adj_navierstokes/naca0012_sub/lam_NACA0012.cfg b/TestCases/cont_adj_navierstokes/naca0012_sub/lam_NACA0012.cfg index 2f37c5b145ad..0ebb8b70f646 100644 --- a/TestCases/cont_adj_navierstokes/naca0012_sub/lam_NACA0012.cfg +++ b/TestCases/cont_adj_navierstokes/naca0012_sub/lam_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: Jul 18th, 2014 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/cont_adj_navierstokes/naca0012_trans/lam_NACA0012.cfg b/TestCases/cont_adj_navierstokes/naca0012_trans/lam_NACA0012.cfg index 4db33d41c087..55a1c41fd9b2 100644 --- a/TestCases/cont_adj_navierstokes/naca0012_trans/lam_NACA0012.cfg +++ b/TestCases/cont_adj_navierstokes/naca0012_trans/lam_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: Jul 18th, 2014 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/cont_adj_rans/naca0012/turb_nasa.cfg b/TestCases/cont_adj_rans/naca0012/turb_nasa.cfg index d0a39d3dc852..58120e751a48 100644 --- a/TestCases/cont_adj_rans/naca0012/turb_nasa.cfg +++ b/TestCases/cont_adj_rans/naca0012/turb_nasa.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.03.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -257,25 +257,6 @@ CONV_CAUCHY_ELEMS= 100 % % Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-6 -% - -% ------------------------- GRID ADAPTATION STRATEGY --------------------------% -% -% Percentage of new elements (% of the original number of elements) -NEW_ELEMS= 5 -% -% Kind of grid adaptation (NONE, FULL, FULL_FLOW, GRAD_FLOW, FULL_ADJOINT, -% GRAD_ADJOINT, GRAD_FLOW_ADJ, ROBUST, -% FULL_LINEAR, COMPUTABLE, COMPUTABLE_ROBUST, -% REMAINING, WAKE, SMOOTHING, SUPERSONIC_SHOCK, -% TWOPHASE) -KIND_ADAPT= FULL_FLOW -% -% Scale factor for the dual volume -DUALVOL_POWER= 0.5 -% -% Before each computation do an implicit smoothing of the nodes coord (NO, YES) -SMOOTH_GEOMETRY= NO % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % diff --git a/TestCases/cont_adj_rans/naca0012/turb_nasa_binary.cfg b/TestCases/cont_adj_rans/naca0012/turb_nasa_binary.cfg index 662e2cda6248..f4d84af47dbc 100644 --- a/TestCases/cont_adj_rans/naca0012/turb_nasa_binary.cfg +++ b/TestCases/cont_adj_rans/naca0012/turb_nasa_binary.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.03.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -259,24 +259,6 @@ CONV_CAUCHY_ELEMS= 100 CONV_CAUCHY_EPS= 1E-6 % -% ------------------------- GRID ADAPTATION STRATEGY --------------------------% -% -% Percentage of new elements (% of the original number of elements) -NEW_ELEMS= 5 -% -% Kind of grid adaptation (NONE, FULL, FULL_FLOW, GRAD_FLOW, FULL_ADJOINT, -% GRAD_ADJOINT, GRAD_FLOW_ADJ, ROBUST, -% FULL_LINEAR, COMPUTABLE, COMPUTABLE_ROBUST, -% REMAINING, WAKE, SMOOTHING, SUPERSONIC_SHOCK, -% TWOPHASE) -KIND_ADAPT= FULL_FLOW -% -% Scale factor for the dual volume -DUALVOL_POWER= 0.5 -% -% Before each computation do an implicit smoothing of the nodes coord (NO, YES) -SMOOTH_GEOMETRY= NO - % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % % Mesh input file diff --git a/TestCases/cont_adj_rans/oneram6/turb_ONERAM6.cfg b/TestCases/cont_adj_rans/oneram6/turb_ONERAM6.cfg index 5c7f5c8dcdd8..c99768abe2fd 100644 --- a/TestCases/cont_adj_rans/oneram6/turb_ONERAM6.cfg +++ b/TestCases/cont_adj_rans/oneram6/turb_ONERAM6.cfg @@ -5,18 +5,13 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.03.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% % -% Physical governing equations (EULER, NAVIER_STOKES, -% PLASMA_EULER, PLASMA_NAVIER_STOKES, -% FREE_SURFACE_EULER, FREE_SURFACE_NAVIER_STOKES, -% FLUID_STRUCTURE_EULER, FLUID_STRUCTURE_NAVIER_STOKES, -% AEROACOUSTIC_EULER, AEROACOUSTIC_NAVIER_STOKES, -% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY) +% Physical governing equations (EULER, NAVIER_STOKES, etc.) SOLVER= NAVIER_STOKES % % Specify turbulence model (NONE, SA, SA_NEG, SST) diff --git a/TestCases/cont_adj_rans/rae2822/turb_SA_RAE2822.cfg b/TestCases/cont_adj_rans/rae2822/turb_SA_RAE2822.cfg index f40989f50645..a434b460159a 100644 --- a/TestCases/cont_adj_rans/rae2822/turb_SA_RAE2822.cfg +++ b/TestCases/cont_adj_rans/rae2822/turb_SA_RAE2822.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/control_surface/inv_ONERAM6_moving.cfg b/TestCases/control_surface/inv_ONERAM6_moving.cfg index a5874ceada3e..9234a2724069 100644 --- a/TestCases/control_surface/inv_ONERAM6_moving.cfg +++ b/TestCases/control_surface/inv_ONERAM6_moving.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 09.07.2011 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/control_surface/inv_ONERAM6_setting.cfg b/TestCases/control_surface/inv_ONERAM6_setting.cfg index 2f1d7ab3023f..244383bc307a 100644 --- a/TestCases/control_surface/inv_ONERAM6_setting.cfg +++ b/TestCases/control_surface/inv_ONERAM6_setting.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 09.07.2011 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/coupled_cht/comp_2d/flow_cylinder.cfg b/TestCases/coupled_cht/comp_2d/flow_cylinder.cfg index c15f371c0d4d..bbc1ffd9c49a 100644 --- a/TestCases/coupled_cht/comp_2d/flow_cylinder.cfg +++ b/TestCases/coupled_cht/comp_2d/flow_cylinder.cfg @@ -97,7 +97,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/comp_2d/solid_cylinder1.cfg b/TestCases/coupled_cht/comp_2d/solid_cylinder1.cfg index 06325af0a5e1..9f8ec43f71ed 100644 --- a/TestCases/coupled_cht/comp_2d/solid_cylinder1.cfg +++ b/TestCases/coupled_cht/comp_2d/solid_cylinder1.cfg @@ -89,7 +89,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/comp_2d/solid_cylinder2.cfg b/TestCases/coupled_cht/comp_2d/solid_cylinder2.cfg index 05756d604714..bca1647b7dfd 100644 --- a/TestCases/coupled_cht/comp_2d/solid_cylinder2.cfg +++ b/TestCases/coupled_cht/comp_2d/solid_cylinder2.cfg @@ -98,7 +98,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/comp_2d/solid_cylinder3.cfg b/TestCases/coupled_cht/comp_2d/solid_cylinder3.cfg index 22ee243c51b3..e834d1134beb 100644 --- a/TestCases/coupled_cht/comp_2d/solid_cylinder3.cfg +++ b/TestCases/coupled_cht/comp_2d/solid_cylinder3.cfg @@ -98,7 +98,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/disc_adj_incomp_2d/flow_cylinder.cfg b/TestCases/coupled_cht/disc_adj_incomp_2d/flow_cylinder.cfg index aba99dce0511..c4c66039fd96 100644 --- a/TestCases/coupled_cht/disc_adj_incomp_2d/flow_cylinder.cfg +++ b/TestCases/coupled_cht/disc_adj_incomp_2d/flow_cylinder.cfg @@ -151,7 +151,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder1.cfg b/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder1.cfg index 5e45bd1daad6..feccb6c2413c 100644 --- a/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder1.cfg +++ b/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder1.cfg @@ -89,7 +89,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder2.cfg b/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder2.cfg index 6dcccea26062..b9a20fa95db7 100644 --- a/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder2.cfg +++ b/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder2.cfg @@ -98,7 +98,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder3.cfg b/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder3.cfg index 47d064accbcf..f7576060b5dc 100644 --- a/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder3.cfg +++ b/TestCases/coupled_cht/disc_adj_incomp_2d/solid_cylinder3.cfg @@ -98,7 +98,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d/flow_cylinder.cfg b/TestCases/coupled_cht/incomp_2d/flow_cylinder.cfg index c587d6907b3d..072923c45e3e 100644 --- a/TestCases/coupled_cht/incomp_2d/flow_cylinder.cfg +++ b/TestCases/coupled_cht/incomp_2d/flow_cylinder.cfg @@ -148,7 +148,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d/solid_cylinder1.cfg b/TestCases/coupled_cht/incomp_2d/solid_cylinder1.cfg index df303ab245eb..ea93e593514e 100644 --- a/TestCases/coupled_cht/incomp_2d/solid_cylinder1.cfg +++ b/TestCases/coupled_cht/incomp_2d/solid_cylinder1.cfg @@ -89,7 +89,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d/solid_cylinder2.cfg b/TestCases/coupled_cht/incomp_2d/solid_cylinder2.cfg index 3f2a7a5d5f65..4b296aedbc5d 100644 --- a/TestCases/coupled_cht/incomp_2d/solid_cylinder2.cfg +++ b/TestCases/coupled_cht/incomp_2d/solid_cylinder2.cfg @@ -98,7 +98,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d/solid_cylinder3.cfg b/TestCases/coupled_cht/incomp_2d/solid_cylinder3.cfg index 3e33cbe1a989..201c4f681e79 100644 --- a/TestCases/coupled_cht/incomp_2d/solid_cylinder3.cfg +++ b/TestCases/coupled_cht/incomp_2d/solid_cylinder3.cfg @@ -98,7 +98,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d_unsteady/flow_cylinder.cfg b/TestCases/coupled_cht/incomp_2d_unsteady/flow_cylinder.cfg index 75f4590a4814..a12beaa28d9b 100644 --- a/TestCases/coupled_cht/incomp_2d_unsteady/flow_cylinder.cfg +++ b/TestCases/coupled_cht/incomp_2d_unsteady/flow_cylinder.cfg @@ -135,7 +135,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder1.cfg b/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder1.cfg index c424aca32456..56f56418c637 100644 --- a/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder1.cfg +++ b/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder1.cfg @@ -76,7 +76,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder2.cfg b/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder2.cfg index 379a6eaf3803..1013307d8f46 100644 --- a/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder2.cfg +++ b/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder2.cfg @@ -76,7 +76,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder3.cfg b/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder3.cfg index 439aa0f77e4b..2f5cdfd50cdd 100644 --- a/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder3.cfg +++ b/TestCases/coupled_cht/incomp_2d_unsteady/solid_cylinder3.cfg @@ -76,7 +76,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/ddes/flatplate/ddes_flatplate.cfg b/TestCases/ddes/flatplate/ddes_flatplate.cfg index d0b564801362..5ebc821109d6 100644 --- a/TestCases/ddes/flatplate/ddes_flatplate.cfg +++ b/TestCases/ddes/flatplate/ddes_flatplate.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.10 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/deformation/cylindrical_ffd/def_cylindrical.cfg b/TestCases/deformation/cylindrical_ffd/def_cylindrical.cfg index a00fcc713080..a5a2b071d5b1 100644 --- a/TestCases/deformation/cylindrical_ffd/def_cylindrical.cfg +++ b/TestCases/deformation/cylindrical_ffd/def_cylindrical.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/deformation/intersection_prevention/def_intersect.cfg b/TestCases/deformation/intersection_prevention/def_intersect.cfg new file mode 100644 index 000000000000..9da3baedc893 --- /dev/null +++ b/TestCases/deformation/intersection_prevention/def_intersect.cfg @@ -0,0 +1,452 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% case description: % +% This is a test for the new implementation to prevent % +% self-intersecting meshes % +% after mesh deformation. You can run the test by first running SU2_CFD % +% and then SU2_DEF % +% documentation: Lennaert Tol, Automatic Design Optimization of a Bunsen % +% Burner, MSc. Thesis Technische Universiteit Eindhoven (2020) % +% https://pure.tue.nl/ws/portalfiles/portal/165889356/0894988_Tol.pdf % +% the new keywords are on line 374-397 % +% Author: % +% Lennaert Tol and Nijso Beishuizen % +% Institution: % +% Technische Universiteit Eindhoven % +% Date: 2021.01.08 % +% File Version 7.0.8 "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 + +% Specify turbulent model (NONE, SA, SA_NEG, SST) +KIND_TURB_MODEL= NONE + +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) +MATH_PROBLEM= DIRECT + +% Restart solution (NO, YES) +RESTART_SOL = NO + +AXISYMMETRIC = 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 (air), 998.2 Kg/m^3 (water)) +INC_DENSITY_INIT= 1.1728 + +% Initial velocity for incompressible flows (1.0,0,0 m/s by default) +INC_VELOCITY_INIT= (1.0, 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 + +% 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 +% +% Damping coefficient for iterative updates at pressure inlets. (0.1 by default) +INC_INLET_DAMPING= 0.1 + +% List of outlet types for incompressible flows. List length must +% match number of outlet markers. Options: PRESSURE_OUTLET, MASS_FLOW_OUTLET +INC_OUTLET_TYPE= PRESSURE_OUTLET +% +% Damping coefficient for iterative updates at mass flow outlets. (0.1 by default) +INC_OUTLET_DAMPING= 0.1 + +% 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= DIMENSIONAL + + +% ---- IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------% +% +% Fluid model (STANDARD_AIR, IDEAL_GAS, VW_GAS, PR_GAS, +% CONSTANT_DENSITY, INC_IDEAL_GAS) +FLUID_MODEL= CONSTANT_DENSITY +% +% Specific heat at constant pressure, Cp (1004.703 J/kg*K (air)). +% Incompressible fluids with energy eqn. only (CONSTANT_DENSITY, INC_IDEAL_GAS). +SPECIFIC_HEAT_CP= 1004.703 + +% --------------------------- 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.83463e-05 + +% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% +% +% Conductivity model (CONSTANT_CONDUCTIVITY, CONSTANT_PRANDTL). +CONDUCTIVITY_MODEL= CONSTANT_PRANDTL +% +% Laminar Prandtl number (0.72 (air), only for CONSTANT_PRANDTL) +PRANDTL_LAM= 0.72 +% +% Turbulent Prandtl number (0.9 (air), only for CONSTANT_PRANDTL) +PRANDTL_TURB= 0.90 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% + +% Reference origin for moment computation +REF_ORIGIN_MOMENT_X = 0.00 +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= 0.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% + +% Navier-Stokes wall boundary marker(s) (NONE = no marker) + +MARKER_PLOTTING = (outlet) +MARKER_ANALYZE = (outlet) + +MARKER_HEATFLUX= (wall_inner_bottom, 0.0, wall_inner_right, 0.0, wall_inner_top, 0.0) + +SPECIFIED_INLET_PROFILE= NO + +INLET_FILENAME = inletVelocity.dat + +INLET_MATCHING_TOLERANCE= 1e-5 + +% Inlet boundary marker(s) +MARKER_INLET = (inlet, 300.0, 1.0, 1.0, 0.0, 0.0) + +% Outler boundary marker (s) +MARKER_OUTLET = (outlet, 0.0) + +% Symmetry boundary marker +MARKER_SYM = (wall_outer) + +% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated +MARKER_MONITORING= (outlet) + +% ------------- 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=100 + +% 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 = 25 +ITER = 10000 + +% Writing solution file frequency +OUTPUT_WRT_FREQ= 50 + +% ------------------------ 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 + +% 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= 100 + +% -------------------------- 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= ( 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, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% TURKEL_PREC, MSW) +CONV_NUM_METHOD_FLOW= FDS + +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_FLOW= NO + +% Slope limiter (VENKATAKRISHNAN, MINMOD) +SLOPE_LIMITER_FLOW= NONE + +% Coefficient for the limiter (smooth regions) +VENKAT_LIMITER_COEFF= 10.0 + +% 2nd and 4th order artificial dissipation coefficients +JST_SENSOR_COEFF= ( 0.05, 0.02 ) + +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +CONV_NUM_METHOD_ADJFLOW= FDS +ADJ_JST_SENSOR_COEFF= ( 0.05, 0.02 ) +CFL_REDUCTION_ADJFLOW= 0.5 +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% + +% Convergence criteria (CAUCHY, RESIDUAL) +CONV_CRITERIA= RESIDUAL + +% Min value of the residual (log10 of the residual) +%RESIDUAL_MINVAL= -13 +CONV_RESIDUAL_MINVAL= -10 + +% Start convergence criteria at iteration number +CONV_STARTITER= 100 + +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 20 + +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-6 + +% Function to apply the criteria (LIFT, DRAG, NEARFIELD_PRESS, SENS_GEOMETRY, +% SENS_MACH, DELTA_LIFT, DELTA_DRAG) + +SCREEN_OUTPUT = INNER_ITER WALL_TIME RMS_PRESSURE RMS_VELOCITY-X RMS_ADJ_PRESSURE RMS_ADJ_VELOCITY-X U +CONV_FIELD = (RMS_PRESSURE, RMS_ADJ_PRESSURE) + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% + + + +% Mesh input file format (SU2, CGNS, NETCDF_ASCII) +MESH_FORMAT= SU2 + +% Restart flow input file +%SOLUTION_FLOW_FILENAME= solution_flow.dat +SOLUTION_FILENAME= solution_flow.dat + +% Restart adjoint input file +SOLUTION_ADJ_FILENAME= solution_adj.dat + +% Output file format (PARAVIEW, PARAVIEW_BINARY, TECPLOT, STL) +OUTPUT_FILES = (RESTART, PARAVIEW_ASCII, SURFACE_CSV) +TABULAR_FORMAT = CSV + +% Output file convergence history (w/o extension) +CONV_FILENAME= history + +% Output file restart flow +%RESTART_FLOW_FILENAME= restart_flow.dat +RESTART_FILENAME= restart_flow.dat + +% Output file restart adjoint +RESTART_ADJ_FILENAME= restart_adj.dat + +% Output file flow (w/o extension) variables +%VOLUME_FLOW_FILENAME= flow +VOLUME_FILENAME= flow + +% Output file adjoint (w/o extension) variables +VOLUME_ADJ_FILENAME= adjoint + +% Output objective function gradient (using continuous adjoint) +GRAD_OBJFUNC_FILENAME= of_grad.dat + +% Output file surface flow coefficient (w/o extension) +%SURFACE_FLOW_FILENAME= surface_flow +SURFACE_FILENAME= surface_flow + +% Output file surface adjoint coefficient (w/o extension) +SURFACE_ADJ_FILENAME= surface_adjoint + +VOLUME_OUTPUT= RESIDUAL PRIMITIVE SOURCE SENSITIVITY COEFFICIENT + +% Writing convergence history frequency +SCREEN_WRT_FREQ_INNER = 1 +SCREEN_WRT_FREQ_OUTER = 1 + +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% +% +% Kind of deformation (NO_DEFORMATION, TRANSLATION, ROTATION, SCALE, +% FFD_SETTING, FFD_NACELLE +% FFD_CONTROL_POINT, FFD_CAMBER, FFD_THICKNESS, FFD_TWIST +% FFD_CONTROL_POINT_2D, FFD_CAMBER_2D, FFD_THICKNESS_2D, FFD_TWIST_2D, +% HICKS_HENNE, SURFACE_BUMP) + +DV_KIND= FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D, FFD_CONTROL_POINT_2D + +MESH_FILENAME = mesh_ffd.su2 + +% Mesh output file +MESH_OUT_FILENAME= mesh_ffd_deformed.su2 + +% Marker of the surface in which we are going apply the shape deformation +DV_MARKER= (wall_inner_bottom, wall_inner_right, wall_inner_top) + +% Parameters of the shape deformation +DV_PARAM= (MAIN_BOX, 0, 0, 0.0, 1.0); (MAIN_BOX, 1, 0, 0.0, 1.0); (MAIN_BOX, 2, 0, 0.0, 1.0); (MAIN_BOX, 3, 0, 0.0, 1.0); (MAIN_BOX, 4, 0, 0.0, 1.0); (MAIN_BOX, 5, 0, 0.0, 1.0); (MAIN_BOX, 6, 0, 0.0, 1.0); (MAIN_BOX, 7, 0, 0.0, 1.0); (MAIN_BOX, 8, 0, 0.0, 1.0); (MAIN_BOX, 9, 0, 0.0, 1.0); (MAIN_BOX, 10, 0, 0.0, 1.0); (MAIN_BOX, 0, 1, 0.0, 1.0); (MAIN_BOX, 1, 1, 0.0, 1.0); (MAIN_BOX, 2, 1, 0.0, 1.0); (MAIN_BOX, 3, 1, 0.0, 1.0); (MAIN_BOX, 4, 1, 0.0, 1.0); (MAIN_BOX, 5, 1, 0.0, 1.0); (MAIN_BOX, 6, 1, 0.0, 1.0); (MAIN_BOX, 7, 1, 0.0, 1.0); (MAIN_BOX, 8, 1, 0.0, 1.0); (MAIN_BOX, 9, 1, 0.0, 1.0); (MAIN_BOX, 10, 1, 0.0, 1.0) + +% Value of the shape deformation +DV_VALUE = 0, 0.0002, 0.0004, 0.0006, 0.0008, 0.001, 0.0012, 0.0014, 0.0016, 0.0018, 0.002, 0,-0.0002, -0.0004, -0.0006, -0.0008, -0.0010, -0.0012, -0.0014, -0.0016, -0.0018, -0.002 + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +% Linear solver or smoother for implicit formulations (FGMRES, RESTARTED_FGMRES, BCGSTAB) +DEFORM_LINEAR_SOLVER= FGMRES +% +% Number of smoothing iterations for mesh deformation +DEFORM_LINEAR_SOLVER_ITER= 1000 +% +% Number of nonlinear deformation iterations (surface deformation increments) +DEFORM_NONLINEAR_ITER= 1 +% +% Print the residuals during mesh deformation to the console (YES, NO) +DEFORM_CONSOLE_OUTPUT= YES +% +% Factor to multiply smallest cell volume for deform tolerance (0.001 default) +% DEFORM_TOL_FACTOR = 1e-10 +DEFORM_LINEAR_SOLVER_ERROR = 1e-5 +% +% Type of element stiffness imposed for FEA mesh deformation (INVERSE_VOLUME, +% WALL_DISTANCE, CONSTANT_STIFFNESS) +DEFORM_STIFFNESS_TYPE= WALL_DISTANCE +% + + +% -------------------- FREE-FORM DEFORMATION PARAMETERS -----------------------% +% +% Tolerance of the Free-Form Deformation point inversion +FFD_TOLERANCE= 1E-10 + +% Maximum number of iterations in the Free-Form Deformation point inversion +FFD_ITERATIONS= 500 + +% ----- CHECK AND REPAIR MESH INTERSECTION ------------------------- % +% Parameters to check and repair self-intersections within FFD box +% (after deformation) +% +% switch on the intersection prevention +FFD_INTPREV = YES +% number of deformation iterations to make sure that the self-intersection has been resolved +FFD_INTPREV_ITER = 2 +% number of times we half the deformation size within the iteration +FFD_INTPREV_DEPTH= 3 + +% ----- CHECK AND REPAIR NONCONVEX CELLS ------------------------- % +% Parameters to check and repair nonconvex elements in mesh +% (after deformation) +% +% switch on the check for convexity of cells +CONVEXITY_CHECK = YES +% number of iterations +CONVEXITY_CHECK_ITER = 10 +% number of times we half the deformation size within the iteration +CONVEXITY_CHECK_DEPTH = 3 +% -------------------------------------------------------------------------- % + +% +% FFD box definition: 3D case (FFD_BoxTag, X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3, X4, Y4, Z4, +% X5, Y5, Z5, X6, Y6, Z6, X7, Y7, Z7, X8, Y8, Z8) +% 2D case (FFD_BoxTag, X1, Y1, 0.0, X2, Y2, 0.0, X3, Y3, 0.0, X4, Y4, 0.0, +% 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) +FFD_DEFINITION= (MAIN_BOX, 0.02, 0.005, 0, 0.05, 0.005, 0.0, 0.05, 0.007, 0.0, 0.02, 0.007, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) + +% +% FFD box degree: 3D case (x_degree, y_degree, z_degree) +% 2D case (x_degree, y_degree, 0) +FFD_DEGREE= ( 10, 1, 0) + +% +% Surface continuity at the intersection with the FFD (1ST_DERIVATIVE, 2ND_DERIVATIVE) +FFD_CONTINUITY= USER_INPUT + +% +% Optimization objective function with scaling factor, separated by semicolons. +% To include quadratic penalty function: use OPT_CONSTRAINT option syntax within the OPT_OBJECTIVE list. +% ex= Objective * Scale +%OPT_OBJECTIVE= TOTAL_HEATFLUX * 1e-5 +OPT_OBJECTIVE= DRAG*5.0e-3 + +% +% Optimization constraint functions with pushing factors (affects its value, not the gradient in the python scripts), separated by semicolons +% ex= (Objective = Value ) * Scale, use '>','<','=' +OPT_CONSTRAINT= NONE + +% +% Factor to reduce the norm of the gradient (affects the objective function and gradient in the python scripts) +% In general, a norm of the gradient ~1E-6 is desired. +OPT_GRADIENT_FACTOR= 1.0 +% +% Factor to relax or accelerate the optimizer convergence (affects the line search in SU2_DEF) +% In general, surface deformations of 0.01'' or 0.0001m are desirable +OPT_RELAX_FACTOR= 1.0 +% +% Maximum number of iterations +OPT_ITERATIONS= 20 +% +% Requested accuracy +OPT_ACCURACY= 1E-200 + +% Optimization bound (bounds the line search in SU2_DEF) +OPT_LINE_SEARCH_BOUND= 1E6 +% +% Upper bound for each design variable (bound in the python optimizer) +OPT_BOUND_UPPER = 1e10 +OPT_BOUND_LOWER = -1e10 + +% +% Finite difference step size for python scripts (0.001 default, recommended +% 0.001 x REF_LENGTH) +FIN_DIFF_STEP = 1e-3 +% +DEFINITION_DV= (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 0, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 1, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 2, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 3, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 4, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 5, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 6, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 7, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 8, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 9, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 10, 0, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 0, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 1, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 2, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 3, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 4, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 5, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 6, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 7, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 8, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 9, 1, 0.0, 1.0); (19, 1.0 | wall_inner_bottom, wall_inner_right, wall_inner_top | MAIN_BOX, 10, 1, 0.0, 1.0) diff --git a/TestCases/deformation/naca0012/def_NACA0012.cfg b/TestCases/deformation/naca0012/def_NACA0012.cfg index d13acfebbfdc..237649bcff9d 100644 --- a/TestCases/deformation/naca0012/def_NACA0012.cfg +++ b/TestCases/deformation/naca0012/def_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/deformation/naca0012/surface_file_NACA0012.cfg b/TestCases/deformation/naca0012/surface_file_NACA0012.cfg index 6d5e142b4410..38c2686b7b66 100644 --- a/TestCases/deformation/naca0012/surface_file_NACA0012.cfg +++ b/TestCases/deformation/naca0012/surface_file_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/deformation/naca4412/def_NACA4412.cfg b/TestCases/deformation/naca4412/def_NACA4412.cfg index cb98b56ecb4e..21574c36151c 100644 --- a/TestCases/deformation/naca4412/def_NACA4412.cfg +++ b/TestCases/deformation/naca4412/def_NACA4412.cfg @@ -6,7 +6,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2016.05.06 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/deformation/rae2822/def_RAE2822.cfg b/TestCases/deformation/rae2822/def_RAE2822.cfg index 710c5d2c3088..f335445d7513 100644 --- a/TestCases/deformation/rae2822/def_RAE2822.cfg +++ b/TestCases/deformation/rae2822/def_RAE2822.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/deformation/spherical_ffd/def_spherical.cfg b/TestCases/deformation/spherical_ffd/def_spherical.cfg index 2717d372e1c8..76f747ad6fce 100644 --- a/TestCases/deformation/spherical_ffd/def_spherical.cfg +++ b/TestCases/deformation/spherical_ffd/def_spherical.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/deformation/spherical_ffd/def_spherical_bspline.cfg b/TestCases/deformation/spherical_ffd/def_spherical_bspline.cfg index 878226806f49..af96e91c9b1f 100644 --- a/TestCases/deformation/spherical_ffd/def_spherical_bspline.cfg +++ b/TestCases/deformation/spherical_ffd/def_spherical_bspline.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/disc_adj_euler/arina2k/Arina2KRS.cfg b/TestCases/disc_adj_euler/arina2k/Arina2KRS.cfg index 085f32cd7872..d201209a6521 100644 --- a/TestCases/disc_adj_euler/arina2k/Arina2KRS.cfg +++ b/TestCases/disc_adj_euler/arina2k/Arina2KRS.cfg @@ -288,7 +288,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations @@ -376,23 +376,6 @@ GEO_PLOT_STATIONS= NO % Geometrical evaluation mode (FUNCTION, GRADIENT) GEO_MODE= FUNCTION -% ------------------------- GRID ADAPTATION STRATEGY --------------------------% -% -% Kind of grid adaptation (NONE, PERIODIC, FULL, FULL_FLOW, GRAD_FLOW, -% FULL_ADJOINT, GRAD_ADJOINT, GRAD_FLOW_ADJ, ROBUST, -% FULL_LINEAR, COMPUTABLE, COMPUTABLE_ROBUST, -% REMAINING, WAKE, SMOOTHING, SUPERSONIC_SHOCK) -KIND_ADAPT= FULL_FLOW -% -% Percentage of new elements (% of the original number of elements) -NEW_ELEMS= 5 -% -% Scale factor for the dual volume -DUALVOL_POWER= 0.5 -% -% Adapt the boundary elements (NO, YES) -ADAPT_BOUNDARY= YES - % ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% % % Kind of deformation (NO_DEFORMATION, SCALE_GRID, TRANSLATE_GRID, ROTATE_GRID, diff --git a/TestCases/disc_adj_euler/cylinder3D/inv_cylinder3D.cfg b/TestCases/disc_adj_euler/cylinder3D/inv_cylinder3D.cfg index fe1b637bbba4..ce67c9b4b572 100644 --- a/TestCases/disc_adj_euler/cylinder3D/inv_cylinder3D.cfg +++ b/TestCases/disc_adj_euler/cylinder3D/inv_cylinder3D.cfg @@ -5,7 +5,7 @@ % Author: ___________________________________________________________________ % % Institution: ______________________________________________________________ % % Date: __________ % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -206,7 +206,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/disc_adj_euler/oneram6/inv_ONERAM6.cfg b/TestCases/disc_adj_euler/oneram6/inv_ONERAM6.cfg index 0ad3d1d65159..65d3a91bfe73 100644 --- a/TestCases/disc_adj_euler/oneram6/inv_ONERAM6.cfg +++ b/TestCases/disc_adj_euler/oneram6/inv_ONERAM6.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios, Heather Kline % % Institution: Stanford University % % Date: 01.17.2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/disc_adj_fea/configAD_fem.cfg b/TestCases/disc_adj_fea/configAD_fem.cfg index 2877dfcbf041..7211b34b5f70 100644 --- a/TestCases/disc_adj_fea/configAD_fem.cfg +++ b/TestCases/disc_adj_fea/configAD_fem.cfg @@ -4,7 +4,7 @@ % Author: R.Sanchez % % Institution: Imperial College London % % Date: 2017.11.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLVER= ELASTICITY @@ -22,6 +22,8 @@ REFERENCE_GEOMETRY = YES REFERENCE_GEOMETRY_FILENAME = reference_geometry.dat REFERENCE_GEOMETRY_FORMAT = SU2 REFERENCE_GEOMETRY_PENALTY = 1E6 +% Consider only the surface +REFERENCE_GEOMETRY_SURFACE = NO READ_BINARY_RESTART=NO diff --git a/TestCases/disc_adj_fsi/configFEA.cfg b/TestCases/disc_adj_fsi/configFEA.cfg index 15d744400f95..5106c5040754 100644 --- a/TestCases/disc_adj_fsi/configFEA.cfg +++ b/TestCases/disc_adj_fsi/configFEA.cfg @@ -4,7 +4,7 @@ % Author: R.Sanchez % % Institution: Imperial College London % % Date: 2017.11.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLVER= ELASTICITY @@ -24,6 +24,8 @@ ELECTRIC_FIELD_MOD = 20E5 REFERENCE_GEOMETRY = YES REFERENCE_GEOMETRY_FILENAME = reference_geometry.dat REFERENCE_GEOMETRY_FORMAT = SU2 +% Consider only the surface +REFERENCE_GEOMETRY_SURFACE = NO READ_BINARY_RESTART=NO diff --git a/TestCases/disc_adj_fsi/configFlow.cfg b/TestCases/disc_adj_fsi/configFlow.cfg index ae108876bd30..5b1d91c1be1e 100644 --- a/TestCases/disc_adj_fsi/configFlow.cfg +++ b/TestCases/disc_adj_fsi/configFlow.cfg @@ -4,7 +4,7 @@ % Author: R.Sanchez % % Institution: Imperial College London % % Date: 2017.11.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLVER= NAVIER_STOKES diff --git a/TestCases/disc_adj_heat/disc_adj_heat.cfg b/TestCases/disc_adj_heat/disc_adj_heat.cfg index 9f57eda99931..f708e0109516 100644 --- a/TestCases/disc_adj_heat/disc_adj_heat.cfg +++ b/TestCases/disc_adj_heat/disc_adj_heat.cfg @@ -6,7 +6,7 @@ % Author: Ole Burghardt % % Institution: Chair for Scientific Computing, TU Kaiserslautern % % Date: November 26th, 2018 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/disc_adj_incomp_euler/naca0012/incomp_NACA0012_disc.cfg b/TestCases/disc_adj_incomp_euler/naca0012/incomp_NACA0012_disc.cfg index d7fd4a6a180f..e23f83ed9103 100644 --- a/TestCases/disc_adj_incomp_euler/naca0012/incomp_NACA0012_disc.cfg +++ b/TestCases/disc_adj_incomp_euler/naca0012/incomp_NACA0012_disc.cfg @@ -4,7 +4,7 @@ % Case description: Subsonic incompressible inviscid flow around a NACA0012 % % Author: Thomas D. Economon % % Date: 2018.10.30 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg b/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg index e54a8b047034..60c8139f98cf 100644 --- a/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg +++ b/TestCases/disc_adj_incomp_navierstokes/cylinder/heated_cylinder.cfg @@ -4,7 +4,7 @@ % Case description: Steady incompressible laminar flow past a heated cylinder % % Author: Thomas D. Economon % % Date: 2018.06.10 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -212,7 +212,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sa.cfg b/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sa.cfg index 3ebb6e30fbcc..919ce23a2e18 100755 --- a/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sa.cfg +++ b/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sa.cfg @@ -5,7 +5,7 @@ % http://turbmodels.larc.nasa.gov/naca0012_val_sa.html % % Author: Thomas D. Economon & Francisco Palacios % % Date: 2018.06.10 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -131,7 +131,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sst.cfg b/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sst.cfg index 1b7577fe53ed..6393a25ea83f 100755 --- a/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sst.cfg +++ b/TestCases/disc_adj_incomp_rans/naca0012/turb_naca0012_sst.cfg @@ -5,7 +5,7 @@ % http://turbmodels.larc.nasa.gov/naca0012_val_sst.html % % Author: Thomas D. Economon & Francisco Palacios % % Date: 2018.06.10 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -131,7 +131,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/disc_adj_rans/naca0012/naca0012.cfg b/TestCases/disc_adj_rans/naca0012/naca0012.cfg index d09767d292aa..4c9a1e86b7af 100644 --- a/TestCases/disc_adj_rans/naca0012/naca0012.cfg +++ b/TestCases/disc_adj_rans/naca0012/naca0012.cfg @@ -5,7 +5,7 @@ % Author: Steffen Schotthöfer % % Institution: TU Kaiserslautern % % Date: Mar 16, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg b/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg index 6e9e98762bdc..e354059f006b 100644 --- a/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg +++ b/TestCases/disc_adj_turbomachinery/transonic_stator_2D/transonic_stator.cfg @@ -187,12 +187,6 @@ MARKER_PLOTTING= (airfoil) MARKER_MONITORING= (airfoil) % % -% ------------------------- GRID ADAPTATION STRATEGY --------------------------% -% -% Kind of grid adaptation (NONE, PERIODIC) -KIND_ADAPT= PERIODIC -% -% % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % % Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) diff --git a/TestCases/euler/CRM/inv_CRM_JST.cfg b/TestCases/euler/CRM/inv_CRM_JST.cfg index 714e87e96195..336a3de04244 100644 --- a/TestCases/euler/CRM/inv_CRM_JST.cfg +++ b/TestCases/euler/CRM/inv_CRM_JST.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.10.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/euler/biparabolic/BIPARABOLIC.cfg b/TestCases/euler/biparabolic/BIPARABOLIC.cfg index d4e82c83bdb6..44c033f35678 100644 --- a/TestCases/euler/biparabolic/BIPARABOLIC.cfg +++ b/TestCases/euler/biparabolic/BIPARABOLIC.cfg @@ -5,7 +5,7 @@ % Author: Trent W. Lukaczyk % % Institution: Stanford University % % Date: 2012.08.16 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/euler/channel/inv_channel.cfg b/TestCases/euler/channel/inv_channel.cfg index fc12e26bec1c..5f6d169a93b4 100644 --- a/TestCases/euler/channel/inv_channel.cfg +++ b/TestCases/euler/channel/inv_channel.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.09.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/euler/channel/inv_channel_RK.cfg b/TestCases/euler/channel/inv_channel_RK.cfg index 25f1bab40560..f51a9465ebaa 100644 --- a/TestCases/euler/channel/inv_channel_RK.cfg +++ b/TestCases/euler/channel/inv_channel_RK.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.10.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/euler/naca0012/inv_NACA0012.cfg b/TestCases/euler/naca0012/inv_NACA0012.cfg index e1a1d45112db..e09e6d323a61 100644 --- a/TestCases/euler/naca0012/inv_NACA0012.cfg +++ b/TestCases/euler/naca0012/inv_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg index 645dac16c571..c3e78b809b70 100644 --- a/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg +++ b/TestCases/euler/naca0012/inv_NACA0012_Roe.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.10.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/euler/oneram6/inv_ONERAM6.cfg b/TestCases/euler/oneram6/inv_ONERAM6.cfg index b70c03b4f421..994d0972a4fc 100644 --- a/TestCases/euler/oneram6/inv_ONERAM6.cfg +++ b/TestCases/euler/oneram6/inv_ONERAM6.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2015.08.25 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/euler/wedge/inv_wedge_HLLC.cfg b/TestCases/euler/wedge/inv_wedge_HLLC.cfg index 4941d153bbc1..1ca52a45772a 100644 --- a/TestCases/euler/wedge/inv_wedge_HLLC.cfg +++ b/TestCases/euler/wedge/inv_wedge_HLLC.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.10.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg b/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg index a0254de7d6e4..9d8608e5a646 100644 --- a/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg +++ b/TestCases/fea_fsi/Airfoil_RBF/configFEA.cfg @@ -2,7 +2,7 @@ % SU2 configuration file % % Case description: 2D airfoil FSI with radial basis function interp. % % Institution: Imperial College London % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Interface options ---------------------------------------------------- % diff --git a/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg b/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg index 3f3849f89944..97d415216b04 100644 --- a/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg +++ b/TestCases/fea_fsi/Airfoil_RBF/configFlow.cfg @@ -2,7 +2,7 @@ % SU2 configuration file % % Case description: 2D airfoil FSI with radial basis function interp. % % Institution: Imperial College London % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Interface options ---------------------------------------------------- % diff --git a/TestCases/fea_fsi/DynBeam_2d/configBeam_2d.cfg b/TestCases/fea_fsi/DynBeam_2d/configBeam_2d.cfg index c9444eec576a..bee4b761f66e 100644 --- a/TestCases/fea_fsi/DynBeam_2d/configBeam_2d.cfg +++ b/TestCases/fea_fsi/DynBeam_2d/configBeam_2d.cfg @@ -4,7 +4,7 @@ % Author: Ruben Sanchez Fernandez % % Institution: Imperial College London % % Date: 2016.02.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLVER= ELASTICITY diff --git a/TestCases/fea_fsi/MixElemsKnowles/config.cfg b/TestCases/fea_fsi/MixElemsKnowles/config.cfg index c18c69d3b282..a983d3c69fa7 100644 --- a/TestCases/fea_fsi/MixElemsKnowles/config.cfg +++ b/TestCases/fea_fsi/MixElemsKnowles/config.cfg @@ -4,7 +4,7 @@ % Case description: Tip-loaded 3D cantilever beam, mix of element types, % % nonlinear elasticity with Knowles material model. % % Institution: Imperial College London % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % diff --git a/TestCases/fea_fsi/StatBeam_3d/configBeam_3d.cfg b/TestCases/fea_fsi/StatBeam_3d/configBeam_3d.cfg index d1ea8003c908..40aadb1cb70e 100644 --- a/TestCases/fea_fsi/StatBeam_3d/configBeam_3d.cfg +++ b/TestCases/fea_fsi/StatBeam_3d/configBeam_3d.cfg @@ -4,7 +4,7 @@ % Author: Ruben Sanchez Fernandez % % Institution: Imperial College London % % Date: 2016.02.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLVER= ELASTICITY diff --git a/TestCases/fea_topology/config.cfg b/TestCases/fea_topology/config.cfg index ec6229018ba0..e541c15a1847 100644 --- a/TestCases/fea_topology/config.cfg +++ b/TestCases/fea_topology/config.cfg @@ -2,7 +2,7 @@ % SU2 configuration file % % Case description: 4 by 1 cantilever optim. for stiff. @ 50% material % % Institution: Imperial College London % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Optimization @@ -50,12 +50,16 @@ TOPOL_OPTIM_OUTFILE= grad_ref_node.dat % - VOLUME_FRACTION: Volume average of rho, 1 means totally solid; % - TOPOL_DISCRETENESS: Volume average of 4*rho*(1-rho), % 0 means perfect solid-void topology. +% - STRESS_PENALTY: KS-aggregated maximum element-average VM stress, +% use it as a <= 0 constraint. % REFERENCE_NODE can be used in lieu of compliance for simple load cases. OBJECTIVE_FUNCTION= REFERENCE_NODE REFERENCE_NODE= 5225 REFERENCE_NODE_DISPLACEMENT= (0.0, 0.0) REFERENCE_NODE_PENALTY= 1.0 DESIGN_VARIABLE_FEA= YOUNG_MODULUS +% Parameters for the corresponding OF (allowed stress and KS multiplier). +STRESS_PENALTY_PARAM= (1.0, 10.0) % ITER=1 % diff --git a/TestCases/gust/inv_gust_NACA0012.cfg b/TestCases/gust/inv_gust_NACA0012.cfg index 61950875cf14..17d8ec72dbb2 100644 --- a/TestCases/gust/inv_gust_NACA0012.cfg +++ b/TestCases/gust/inv_gust_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Santiago Padron % % Institution: Stanford University % % Date: 06-26-2015 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -72,7 +72,7 @@ INNER_ITER= 100 % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% % % Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, -% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, ELASTICITY, +% MOVING_WALL, AEROELASTIC, ELASTICITY, % EXTERNAL, AEROELASTIC_RIGID_MOTION) GRID_MOVEMENT= GUST % diff --git a/TestCases/harmonic_balance/HB.cfg b/TestCases/harmonic_balance/HB.cfg index a944f9383b76..9dfcb122b4a0 100644 --- a/TestCases/harmonic_balance/HB.cfg +++ b/TestCases/harmonic_balance/HB.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2016.20.09 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/harmonic_balance/hb_rans_preconditioning/davis.cfg b/TestCases/harmonic_balance/hb_rans_preconditioning/davis.cfg index 1c2e5908ae29..5ee0581dd9e4 100644 --- a/TestCases/harmonic_balance/hb_rans_preconditioning/davis.cfg +++ b/TestCases/harmonic_balance/hb_rans_preconditioning/davis.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2016.20.09 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/NACA0012_3D_Hybrid_4thOrder/fem_NACA0012.cfg b/TestCases/hom_euler/NACA0012_3D_Hybrid_4thOrder/fem_NACA0012.cfg index f0c08c377578..3ae0b6beb02c 100644 --- a/TestCases/hom_euler/NACA0012_3D_Hybrid_4thOrder/fem_NACA0012.cfg +++ b/TestCases/hom_euler/NACA0012_3D_Hybrid_4thOrder/fem_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012.cfg b/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012.cfg index 8d0218250412..18140671830b 100644 --- a/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012.cfg +++ b/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012_reg.cfg b/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012_reg.cfg index 17297d1ed8de..c6b91e727d56 100644 --- a/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012_reg.cfg +++ b/TestCases/hom_euler/NACA0012_5thOrder/fem_NACA0012_reg.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/Sphere_4thOrder_Hexa/fem_Sphere.cfg b/TestCases/hom_euler/Sphere_4thOrder_Hexa/fem_Sphere.cfg index 78d4ec2b022d..e16acb081631 100644 --- a/TestCases/hom_euler/Sphere_4thOrder_Hexa/fem_Sphere.cfg +++ b/TestCases/hom_euler/Sphere_4thOrder_Hexa/fem_Sphere.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/Sphere_4thOrder_Tet/fem_Sphere.cfg b/TestCases/hom_euler/Sphere_4thOrder_Tet/fem_Sphere.cfg index 3aa873d3a7d0..6bace675413c 100644 --- a/TestCases/hom_euler/Sphere_4thOrder_Tet/fem_Sphere.cfg +++ b/TestCases/hom_euler/Sphere_4thOrder_Tet/fem_Sphere.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel.cfg b/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel.cfg index 3bce52ca758d..de36771e9734 100644 --- a/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel.cfg +++ b/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel_Farfield.cfg b/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel_Farfield.cfg index a6031c6ef54b..55ee0a156fc8 100644 --- a/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel_Farfield.cfg +++ b/TestCases/hom_euler/SubsonicChannel/nPoly1/fem_SubsonicChannel_Farfield.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel.cfg b/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel.cfg index eeacdcd6a64d..d92e605ee0fa 100644 --- a/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel.cfg +++ b/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel_Farfield.cfg b/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel_Farfield.cfg index 30f2279fb85b..eabc7275c6f9 100644 --- a/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel_Farfield.cfg +++ b/TestCases/hom_euler/SubsonicChannel/nPoly2/fem_SubsonicChannel_Farfield.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel.cfg b/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel.cfg index 88702865987f..31c47cb59ca7 100644 --- a/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel.cfg +++ b/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel_Farfield.cfg b/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel_Farfield.cfg index c16ab4b6d79c..84aad1673eed 100644 --- a/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel_Farfield.cfg +++ b/TestCases/hom_euler/SubsonicChannel/nPoly4/fem_SubsonicChannel_Farfield.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_navierstokes/CylinderViscous/nPoly3/fem_Cylinder_reg.cfg b/TestCases/hom_navierstokes/CylinderViscous/nPoly3/fem_Cylinder_reg.cfg index b952e1a2a192..002ef01668b9 100644 --- a/TestCases/hom_navierstokes/CylinderViscous/nPoly3/fem_Cylinder_reg.cfg +++ b/TestCases/hom_navierstokes/CylinderViscous/nPoly3/fem_Cylinder_reg.cfg @@ -5,7 +5,7 @@ % Author: Edwin van der Weide % % Institution: University of Twente % % Date: 2016.07.15 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_navierstokes/FlatPlate/nPoly4/lam_flatplate_reg.cfg b/TestCases/hom_navierstokes/FlatPlate/nPoly4/lam_flatplate_reg.cfg index 28bb98b8065c..0dd054528862 100644 --- a/TestCases/hom_navierstokes/FlatPlate/nPoly4/lam_flatplate_reg.cfg +++ b/TestCases/hom_navierstokes/FlatPlate/nPoly4/lam_flatplate_reg.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.09.30 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg.cfg b/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg.cfg index 81902a5478ad..50e605568edc 100644 --- a/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg.cfg +++ b/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg.cfg @@ -5,7 +5,7 @@ % Author: Edwin van der Weide % % Institution: University of Twente % % Date: 2016.07.15 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg_ADER.cfg b/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg_ADER.cfg index 3547f2855bd2..71c22aa583eb 100644 --- a/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg_ADER.cfg +++ b/TestCases/hom_navierstokes/SphereViscous/nPoly3_QuadDominant/fem_Sphere_reg_ADER.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder.cfg b/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder.cfg index 9ed040ca9339..40de22f80662 100644 --- a/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder.cfg +++ b/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder_ADER.cfg b/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder_ADER.cfg index 1d01d02f5260..744417f1a5c0 100644 --- a/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder_ADER.cfg +++ b/TestCases/hom_navierstokes/UnsteadyCylinder/nPoly4/fem_unst_cylinder_ADER.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index 387e03ad7123..9e418b76b806 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -3,7 +3,7 @@ ## \file parallel_regression.py # \brief Python script for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -210,6 +210,18 @@ def main(): propeller.test_vals = [-3.389576, -8.409529, 0.000048, 0.056329] test_list.append(propeller) + ####################################### + ### Axisymmetric Compressible RANS ### + ####################################### + + # Axisymmetric air nozzle (transonic) + axi_rans_air_nozzle = TestCase('axi_rans_air_nozzle') + axi_rans_air_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" + axi_rans_air_nozzle.cfg_file = "air_nozzle.cfg" + axi_rans_air_nozzle.test_iter = 10 + axi_rans_air_nozzle.test_vals = [-12.094937, -6.622043, -8.814412, -2.393288] + test_list.append(axi_rans_air_nozzle) + ################################# ## Compressible RANS Restart ### ################################# @@ -289,6 +301,88 @@ def main(): hb_rans_preconditioning.new_output = False test_list.append(hb_rans_preconditioning) + ############################# + ### Incompressible Euler ### + ############################# + + # NACA0012 Hydrofoil + inc_euler_naca0012 = TestCase('inc_euler_naca0012') + inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" + inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" + inc_euler_naca0012.test_iter = 20 + inc_euler_naca0012.test_vals = [-4.858287, -3.810487, 0.491850, 0.007002] + inc_euler_naca0012.new_output = True + test_list.append(inc_euler_naca0012) + + # C-D nozzle with pressure inlet and mass flow outlet + inc_nozzle = TestCase('inc_nozzle') + inc_nozzle.cfg_dir = "incomp_euler/nozzle" + inc_nozzle.cfg_file = "inv_nozzle.cfg" + inc_nozzle.test_iter = 20 + inc_nozzle.test_vals = [-5.973103, -4.911802, -0.000195, 0.121643] + inc_nozzle.new_output = True + test_list.append(inc_nozzle) + + ############################# + ### Incompressible N-S ### + ############################# + + # Laminar cylinder + inc_lam_cylinder = TestCase('inc_lam_cylinder') + inc_lam_cylinder.cfg_dir = "incomp_navierstokes/cylinder" + inc_lam_cylinder.cfg_file = "incomp_cylinder.cfg" + inc_lam_cylinder.test_iter = 10 + inc_lam_cylinder.test_vals = [-4.004277, -3.227956, 0.003852, 7.626578] + inc_lam_cylinder.new_output = True + test_list.append(inc_lam_cylinder) + + # Buoyancy-driven cavity + inc_buoyancy = TestCase('inc_buoyancy') + inc_buoyancy.cfg_dir = "incomp_navierstokes/buoyancy_cavity" + inc_buoyancy.cfg_file = "lam_buoyancy_cavity.cfg" + inc_buoyancy.test_iter = 20 + inc_buoyancy.test_vals = [-4.432484, 0.507522, 0.000000, 0.000000] + inc_buoyancy.new_output = True + test_list.append(inc_buoyancy) + + # Laminar heated cylinder with polynomial fluid model + inc_poly_cylinder = TestCase('inc_poly_cylinder') + inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" + inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" + inc_poly_cylinder.test_iter = 20 + inc_poly_cylinder.test_vals = [-7.849071, -2.092548, 0.029423, 1.922053] + inc_poly_cylinder.new_output = True + test_list.append(inc_poly_cylinder) + + # X-coarse laminar bend as a mixed element CGNS test + inc_lam_bend = TestCase('inc_lam_bend') + inc_lam_bend.cfg_dir = "incomp_navierstokes/bend" + inc_lam_bend.cfg_file = "lam_bend.cfg" + inc_lam_bend.test_iter = 10 + inc_lam_bend.test_vals = [-3.438863, -3.102176, -0.017532, -0.193429] + test_list.append(inc_lam_bend) + + ############################ + ### Incompressible RANS ### + ############################ + + # NACA0012, SA + inc_turb_naca0012 = TestCase('inc_turb_naca0012') + inc_turb_naca0012.cfg_dir = "incomp_rans/naca0012" + inc_turb_naca0012.cfg_file = "naca0012.cfg" + inc_turb_naca0012.test_iter = 20 + inc_turb_naca0012.test_vals = [-4.788495, -11.040511, 0.000023, 0.309503] + inc_turb_naca0012.new_output = True + test_list.append(inc_turb_naca0012) + + # NACA0012, SST_SUST + inc_turb_naca0012_sst_sust = TestCase('inc_turb_naca0012_sst_sust') + inc_turb_naca0012_sst_sust.cfg_dir = "incomp_rans/naca0012" + inc_turb_naca0012_sst_sust.cfg_file = "naca0012_SST_SUST.cfg" + inc_turb_naca0012_sst_sust.test_iter = 20 + inc_turb_naca0012_sst_sust.test_vals = [-7.276424, 0.145861, 0.000003, 0.312011] + test_list.append(inc_turb_naca0012_sst_sust) + ###################################### ### Moving Wall ### ###################################### @@ -349,6 +443,24 @@ def main(): ddes_flatplate.unsteady = True test_list.append(ddes_flatplate) + # unsteady pitching NACA0015, SA + unst_inc_turb_naca0015_sa = TestCase('unst_inc_turb_naca0015_sa') + unst_inc_turb_naca0015_sa.cfg_dir = "unsteady/pitching_naca0015_rans_inc" + unst_inc_turb_naca0015_sa.cfg_file = "config_incomp_turb_sa.cfg" + unst_inc_turb_naca0015_sa.test_iter = 1 + unst_inc_turb_naca0015_sa.test_vals = [-3.008629, -6.888974, 1.435193, 0.433537] + unst_inc_turb_naca0015_sa.unsteady = True + test_list.append(unst_inc_turb_naca0015_sa) + + # unsteady pitching NACA0012, Euler, Deforming + unst_deforming_naca0012 = TestCase('unst_deforming_naca0012') + unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" + unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" + unst_deforming_naca0012.test_iter = 5 + unst_deforming_naca0012.test_vals = [-3.665128, -3.793593, -3.716506, -3.148308] + unst_deforming_naca0012.unsteady = True + test_list.append(unst_deforming_naca0012) + ###################################### ### NICFD ### ###################################### @@ -378,7 +490,7 @@ def main(): Jones_tc.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc.cfg_file = "Jones.cfg" Jones_tc.test_iter = 5 - Jones_tc.test_vals = [-5.280316, 0.379651, 72.212090, 1.277440] + Jones_tc.test_vals = [-5.279930, 0.379651, 72.212090, 1.277440] Jones_tc.new_output = False test_list.append(Jones_tc) @@ -491,6 +603,15 @@ def main(): bars_SST_2D.multizone = True test_list.append(bars_SST_2D) + # Sliding mesh with incompressible flows (steady) + slinc_steady = TestCase('slinc_steady') + slinc_steady.cfg_dir = "sliding_interface/incompressible_steady" + slinc_steady.cfg_file = "config.cfg" + slinc_steady.test_iter = 19 + slinc_steady.test_vals = [19.000000, -1.800461, -2.115195] #last 3 columns + slinc_steady.multizone = True + test_list.append(slinc_steady) + ########################## ### FEA - FSI ### ########################## @@ -562,6 +683,22 @@ def main(): mms_fvm_ns.test_vals = [-2.851428, 2.192348, 0.000000, 0.000000] test_list.append(mms_fvm_ns) + # FVM, incompressible, euler + mms_fvm_inc_euler = TestCase('mms_fvm_inc_euler') + mms_fvm_inc_euler.cfg_dir = "mms/fvm_incomp_euler" + mms_fvm_inc_euler.cfg_file = "inv_mms_jst.cfg" + mms_fvm_inc_euler.test_iter = 20 + mms_fvm_inc_euler.test_vals = [-9.128033, -9.441406, 0.000000, 0.000000] + test_list.append(mms_fvm_inc_euler) + + # FVM, incompressible, laminar N-S + mms_fvm_inc_ns = TestCase('mms_fvm_inc_ns') + mms_fvm_inc_ns.cfg_dir = "mms/fvm_incomp_navierstokes" + mms_fvm_inc_ns.cfg_file = "lam_mms_fds.cfg" + mms_fvm_inc_ns.test_iter = 20 + mms_fvm_inc_ns.test_vals = [-7.414944, -7.631546, 0.000000, 0.000000] + test_list.append(mms_fvm_inc_ns) + ###################################### ### RUN TESTS ### ###################################### @@ -576,7 +713,7 @@ def main(): # Tests summary print('==================================================================') - print('Summary of the parallel tests') + print('Summary of the hybrid parallel tests') print('python version:', sys.version) for i, test in enumerate(test_list): if (pass_list[i]): diff --git a/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg b/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg index f8c1dd91eb56..cb374e90f6b0 100644 --- a/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg +++ b/TestCases/incomp_euler/naca0012/incomp_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 09/18/2011 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/incomp_euler/nozzle/inv_nozzle.cfg b/TestCases/incomp_euler/nozzle/inv_nozzle.cfg index fc9eb30d4ed0..20b639b8d86d 100644 --- a/TestCases/incomp_euler/nozzle/inv_nozzle.cfg +++ b/TestCases/incomp_euler/nozzle/inv_nozzle.cfg @@ -4,7 +4,7 @@ % Case description: Inv. inc. nozzle with pressure inlet and mass flow outlet % % Author: Thomas D. Economon % % Date: 2018.11.30 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -119,7 +119,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg b/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg index 52371510ccc2..474e719298ac 100644 --- a/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg +++ b/TestCases/incomp_navierstokes/buoyancy_cavity/lam_buoyancy_cavity.cfg @@ -4,7 +4,7 @@ % Case description: Buoyancy-driven flow inside a cavity % % Author: Thomas D. Economon % % Date: 2018.06.10 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -144,7 +144,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Min error of the linear solver for the implicit formulation diff --git a/TestCases/incomp_navierstokes/cylinder/incomp_cylinder.cfg b/TestCases/incomp_navierstokes/cylinder/incomp_cylinder.cfg index c50c80d42c39..2817c9327001 100644 --- a/TestCases/incomp_navierstokes/cylinder/incomp_cylinder.cfg +++ b/TestCases/incomp_navierstokes/cylinder/incomp_cylinder.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 2012.03.14 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg b/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg index c9b8c73ca425..17438af462b1 100644 --- a/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg +++ b/TestCases/incomp_navierstokes/cylinder/poly_cylinder.cfg @@ -5,7 +5,7 @@ % custom fluid using polynomial fluid models. % % Author: Thomas D. Economon % % Date: 2018.12.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -195,7 +195,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/README.md b/TestCases/incomp_navierstokes/streamwise_periodic/README.md new file mode 100644 index 000000000000..0162663ce5c9 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/README.md @@ -0,0 +1,29 @@ +# Streamwise Periodicity testcases + +This folder contains the additional Testcases for streamwise periodic flow. +A Tutorial can be found on the SU2 website. +For all Testcases a gmsh .geo file is provided which allows to recreate/modify the mesh. + +## `pipe_slice_3d` + +Hagen Poiseuille flow through a 1-primal-cell thick pipe slice in 3D. + +Analytical solution of the velocity magnitude for steady laminar pipe flow in a round pipe `v_mag (r) = -1/(4*mu) * (Delta p / Delta x) * (R**2 - r**2)` therefore a pressure drop Delta p is prescribed. + +`Re = rho * v * L / mu = 1.0 * 0.6 * 5e-3 / 1.8e-5` makes Re=167, with the critical Reynolds number being Re~=2300. + +This testcase is a regression test. + +## `chtPinArray_2d` + +Extension of the tutorial case to a CHT problem with 1 additional solid zone. +A gradient validation between discrete and finite differences for this setup is described in the README of that folder. + +This gradient validation is also part of the regression tests. + +## `chtPinArray_3d` + +Extension of the `chtPinArray_2d` to the 3rd dimension with again one solid zone. +The mesh provided is coarse to keep the filesize and computation time low, but using the gmsh .geo script much higher mesh resolutions can be created. + +This primal simulation is part of the regression tests. diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg new file mode 100644 index 000000000000..ebe8ec21332e --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/DA_configMaster.cfg @@ -0,0 +1,113 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: 2D cylinder array with CHT couplings % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 2020.12.15 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +SOLVER= MULTIPHYSICS +% +CONFIG_LIST= (configFluid.cfg, configSolid.cfg) +% +MARKER_ZONE_INTERFACE= ( fluid_pin1_interface, solid_pin1_interface, fluid_pin2_interface, solid_pin2_interface, fluid_pin3_interface, solid_pin3_interface ) +% +MARKER_CHT_INTERFACE= ( fluid_pin1_interface, solid_pin1_interface, fluid_pin2_interface, solid_pin2_interface, fluid_pin3_interface, solid_pin3_interface ) +% +CONV_RESIDUAL_MINVAL= -26 +% +% Number of total iterations +OUTER_ITER= 3000 +% +%CHT_ROBIN= NO +% +SCREEN_OUTPUT= (OUTER_ITER, BGS_ADJ_PRESSURE[0], BGS_ADJ_TEMPERATURE[0], BGS_ADJ_TEMPERATURE[1]) +SCREEN_WRT_FREQ_OUTER= 100 +% +HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1] ) +% +OUTPUT_FILES= ( RESTART, PARAVIEW_MULTIBLOCK ) +OUTPUT_WRT_FREQ= 1000 +% +MESH_FILENAME= 2D-PinArray_FFD.su2 +MESH_FORMAT= SU2 +% +SOLUTION_ADJ_FILENAME= restart_adj +% +% -------------------- FREE-FORM DEFORMATION PARAMETERS -----------------------% +% +FFD_TOLERANCE= 1E-10 +FFD_ITERATIONS= 500 +% +% FFD box definition: 2D case (FFD_BoxTag, X1, Y1, 0.0, X2, Y2, 0.0, X3, Y3, 0.0, X4, Y4, 0.0, +% 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) +FFD_DEFINITION= (BOX, 0.0029772,0.0,0.0, 0.0081772,0.0,0.0 0.0081772,0.0026,0.0, 0.0029772,0.0026,0.0, 0.0,0.0,0.0, 0.0,0.0,0.0 0.0,0.0,0.0, 0.0,0.0,0.0 ) +% +% FFD box degree: 2D case (x_degree, y_degree, 0) +FFD_DEGREE= (8, 1, 0) +% +% Surface grid continuity at the intersection with the faces of the FFD boxes. +% To keep a particular level of surface continuity, SU2 automatically freezes the right +% number of control point planes (NO_DERIVATIVE, 1ST_DERIVATIVE, 2ND_DERIVATIVE, USER_INPUT) +FFD_CONTINUITY= NO_DERIVATIVE +% +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% +% +%DV_KIND= FFD_SETTING +DV_KIND= FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D +% +% Marker of the surface in which we are going apply the shape deformation +MARKER_SYM= ( fluid_symmetry ) +DV_MARKER= ( fluid_pin2_interface, solid_pin2_interface, fluid_symmetry ) +% +% Parameters of the shape deformation +% - FFD_SETTING ( 1.0 ) +% - FFD_CONTROL_POINT_2D ( FFD_BoxTag, i_Ind, j_Ind, x_Disp, y_Disp ) +%DV_PARAM= ( 1.0 ) +DV_PARAM= \ +( BOX, 0, 1, 0.0, 1.0);\ +( BOX, 1, 1, 0.0, 1.0);\ +( BOX, 2, 1, 0.0, 1.0);\ +( BOX, 3, 1, 0.0, 1.0);\ +( BOX, 4, 1, 0.0, 1.0);\ +( BOX, 5, 1, 0.0, 1.0);\ +( BOX, 6, 1, 0.0, 1.0);\ +( BOX, 7, 1, 0.0, 1.0);\ +( BOX, 8, 1, 0.0, 1.0) +% +% Value of the shape deformation +%DV_VALUE= 1.0 +DV_VALUE= 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0 +% +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +DEFORM_LINEAR_SOLVER= FGMRES +DEFORM_LINEAR_SOLVER_PREC= ILU +DEFORM_LINEAR_SOLVER_ERROR= 1E-14 +% +DEFORM_NONLINEAR_ITER= 1 +DEFORM_LINEAR_SOLVER_ITER= 1000 +% +DEFORM_CONSOLE_OUTPUT= YES +DEFORM_STIFFNESS_TYPE= WALL_DISTANCE +% +% Deformation coefficient (linear elasticity limits from -1.0 to 0.5, a larger +% value is also possible) +% !!! What is this doing !!! +DEFORM_COEFF = 1E6 +% +DEFINITION_DV= \ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 0, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 1, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 2, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 3, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 4, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 5, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 6, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 7, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 8, 1, 0.0, 1.0 ) + +%DEFORM_MESH= YES diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg new file mode 100644 index 000000000000..63ca0b64f309 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/FD_configMaster.cfg @@ -0,0 +1,127 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: 2D cylinder array with CHT couplings % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 2020.12.15 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +SOLVER= MULTIPHYSICS +% +CONFIG_LIST= (configFluid.cfg, configSolid.cfg) +% +MARKER_ZONE_INTERFACE= ( fluid_pin1_interface, solid_pin1_interface, fluid_pin2_interface, solid_pin2_interface, fluid_pin3_interface, solid_pin3_interface ) +% +MARKER_CHT_INTERFACE= ( fluid_pin1_interface, solid_pin1_interface, fluid_pin2_interface, solid_pin2_interface, fluid_pin3_interface, solid_pin3_interface ) +% +CONV_RESIDUAL_MINVAL= -26 +% +% FOR FAST RUNING REGRESSION TEST ONLY! +% FOR GADIENT VALIDATION USE OUTER_ITER= 3000! +OUTER_ITER= 101 + +% +%CHT_ROBIN= NO +% +SCREEN_OUTPUT= ( WALL_TIME, OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) +SCREEN_WRT_FREQ_OUTER= 100 +% +HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], AERO_COEFF[0], HEAT[1] ) +% +OUTPUT_FILES= ( RESTART, PARAVIEW_MULTIBLOCK ) +OUTPUT_WRT_FREQ= 10000 +% +MESH_FILENAME= 2D-PinArray_FFD.su2 +MESH_FORMAT= SU2 +% +% Options that have to be kept for finite_differences.py. Otherwise it won't run. +RESTART_SOL= NO +MARKER_MONITORING= ( NONE ) +SOLUTION_FILENAME= restart +SOLUTION_ADJ_FILENAME= restart_adj +RESTART_FILENAME= restart +CONV_FILENAME= history +TABULAR_FORMAT= CSV +% +% -------------------- FREE-FORM DEFORMATION PARAMETERS -----------------------% +% +FFD_TOLERANCE= 1E-10 +FFD_ITERATIONS= 500 +% +% FFD box definition: 2D case (FFD_BoxTag, X1, Y1, 0.0, X2, Y2, 0.0, X3, Y3, 0.0, X4, Y4, 0.0, +% 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) +FFD_DEFINITION= (BOX, 0.0029772,0.0,0.0, 0.0081772,0.0,0.0 0.0081772,0.0026,0.0, 0.0029772,0.0026,0.0, 0.0,0.0,0.0, 0.0,0.0,0.0 0.0,0.0,0.0, 0.0,0.0,0.0 ) +% +% FFD box degree: 2D case (x_degree, y_degree, 0) +FFD_DEGREE= (8, 1, 0) +% +% Surface grid continuity at the intersection with the faces of the FFD boxes. +% To keep a particular level of surface continuity, SU2 automatically freezes the right +% number of control point planes (NO_DERIVATIVE, 1ST_DERIVATIVE, 2ND_DERIVATIVE, USER_INPUT) +FFD_CONTINUITY= NO_DERIVATIVE +% +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% +% +DV_KIND= FFD_SETTING +%DV_KIND= FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D +% +% Marker of the surface in which we are going apply the shape deformation +MARKER_SYM= ( fluid_symmetry ) +DV_MARKER= ( fluid_pin2_interface, solid_pin2_interface, fluid_symmetry ) +% +% Parameters of the shape deformation +% - FFD_SETTING ( 1.0 ) +% - FFD_CONTROL_POINT_2D ( FFD_BoxTag, i_Ind, j_Ind, x_Disp, y_Disp ) +DV_PARAM= ( 1.0 ) +%DV_PARAM= \ +%( BOX, 0, 1, 0.0, 1.0);\ +%( BOX, 1, 1, 0.0, 1.0);\ +%( BOX, 2, 1, 0.0, 1.0);\ +%( BOX, 3, 1, 0.0, 1.0);\ +%( BOX, 4, 1, 0.0, 1.0);\ +%( BOX, 5, 1, 0.0, 1.0);\ +%( BOX, 6, 1, 0.0, 1.0);\ +%( BOX, 7, 1, 0.0, 1.0);\ +%( BOX, 8, 1, 0.0, 1.0) +% +% Value of the shape deformation +DV_VALUE= 1.0 +%DV_VALUE= 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0 +% +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +DEFORM_LINEAR_SOLVER= FGMRES +DEFORM_LINEAR_SOLVER_PREC= ILU +DEFORM_LINEAR_SOLVER_ERROR= 1E-14 +% +DEFORM_NONLINEAR_ITER= 1 +DEFORM_LINEAR_SOLVER_ITER= 1000 +% +DEFORM_CONSOLE_OUTPUT= YES +DEFORM_STIFFNESS_TYPE= WALL_DISTANCE +% +% Deformation coefficient (linear elasticity limits from -1.0 to 0.5, a larger +% value is also possible) +% !!! What is this doing !!! +DEFORM_COEFF = 1E6 +% +% For gradient validation uncomment the other DV's! +DEFINITION_DV= \ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 0, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 1, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 2, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 3, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 4, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 5, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 6, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 7, 1, 0.0, 1.0 );\ +%( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 8, 1, 0.0, 1.0 ) + +%DEFORM_MESH= YES + +OPT_OBJECTIVE= AVG_TOTALTEMP +FIN_DIFF_STEP= 1e-8 +NZONES=2 diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/README.md b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/README.md new file mode 100644 index 000000000000..6b5b3615d406 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/README.md @@ -0,0 +1,28 @@ +# Gradient validation from start to finish + +This guide steps you through the steps necessary to perform a validation of the discrete adjoint sensitivities using finite differences. + +All necessary config files are present and this guide steps through the different tasks to do. + +If you are lucky enough too have some cores to spare, 14 is a suitable substitution for the `<#cores>` placeholder. + +## FFD-box creation +This step is optional as the provided mesh already contains FFD box. This is for completeness if a new mesh e.g. with different resolution is created. +In `configMaster.cfg` the mentioned options have to be uncommented and others commented if they appear twice in the config. +Note that (only!) for the FFD-box creation a `MARKER_HEATFLUX= ( fluid_symmetry ) is artificially is set to avoid an error. This has to be done to make the config-Postprocessing aware that this marker exists as it is used in `DV_MARKER`. +Call `SU2_DEF configMaster.cfg` which creates the new mesh with the name given in 'MESH_OUT_FILENAME'. + +## Primal run +Run `mpirun -n <#cores> SU2_CFD configMaster.cfg` + +## Discrete-Adjoint run +Rename\copy\symlink `restart_*.dat` -> `solution_*.dat` +Run `mpirun -n <#cores> SU2_CFD_AD DA_configMaster.cfg` and afterwards `SU2_DOT_AD DA_configMaster.cfg` + +## Finite-Differences run +The `OUTER_ITER` is set low in order to be suitable for the regression test. Set that back the number given in the config. +For the full gradient validation uncomment all design variables of the `DEFINITION_DV` config option. +Run `finite_differences.py -f FD_configMaster.cfg -z 2 -n <#cores>`. + +## Comparing results +Just plot the `of_grad.csv` and `FINDIFF/of_grad_findiff.csv` with your tool of choice. Paraview's `Line Chart View` is one option. diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configFluid.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configFluid.cfg new file mode 100644 index 000000000000..9f156eaa9090 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configFluid.cfg @@ -0,0 +1,128 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Unit Cell flow around pin array (fluid) % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 2020.12.15 % +% File Version 7.0.8 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= INC_RANS +% +KIND_TURB_MODEL= SST +% +OBJECTIVE_FUNCTION= AVG_TEMPERATURE +OBJECTIVE_WEIGHT= 0.0 +% +OPT_OBJECTIVE= NONE +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +INC_DENSITY_MODEL= CONSTANT +INC_DENSITY_INIT= 1045.0 +INC_VELOCITY_INIT= ( 0.1, 0.0, 0.0 ) +% +INC_ENERGY_EQUATION = YES +INC_TEMPERATURE_INIT= 338.0 +INC_NONDIM= DIMENSIONAL +SPECIFIC_HEAT_CP= 3540.0 +% +FREESTREAM_TURBULENCEINTENSITY= 0.05 +FREESTREAM_TURB2LAMVISCRATIO= 10.0 +% +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 0.001385 +% +% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% +% +% Pr_lam = mu_lam [Pa*s] * c_p [J/(kg*K)] / lambda[W/(m*K)] +% = 1.385e-3 * 3540 / 0.42 +% = 11.7 +CONDUCTIVITY_MODEL= CONSTANT_PRANDTL +PRANDTL_LAM= 11.7 +% +TURBULENT_CONDUCTIVITY_MODEL= CONSTANT_PRANDTL_TURB +PRANDTL_TURB= 0.90 +% +% --------------------- STREAMWISE PERIODICITY DEFINITION ---------------------% +% +KIND_STREAMWISE_PERIODIC= PRESSURE_DROP +STREAMWISE_PERIODIC_PRESSURE_DROP= 208.023676 +%STREAMWISE_PERIODIC_MASSFLOW= 0.85 +%INC_OUTLET_DAMPING= 0.001 +% +STREAMWISE_PERIODIC_TEMPERATURE= NO +% +% inner pin length 0.00376991 m = (0.00322-0.00262)*2*pi +% with 5e5 W/m that is Q = 1884.96 +STREAMWISE_PERIODIC_OUTLET_HEAT= -1884.96 +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_SYM= ( fluid_symmetry ) +MARKER_PERIODIC= ( fluid_inlet, fluid_outlet, 0.0,0.0,0.0, 0.0,0.0,0.0, 0.0111544,0.0,0.0 ) +% +% Alternative to periodic simulation with velocity inlet and pressure outlet +%MARKER_HEATFLUX= ( fluid_pin1_interface, 5e5, \ +% fluid_pin2_interface, 5e5, \ +% fluid_pin3_interface, 5e5 ) +% +% Alternative options for non-periodic flow +%INC_INLET_TYPE= VELOCITY_INLET +%MARKER_INLET= ( fluid_inlet, 338.0, 0.75, 1.0, 0.0, 0.0 ) +% Test vals to hinder outlet backflow +%MARKER_INLET= ( fluid_inlet, 338.0, 0.3, 1.0, 0.0, 0.0 ) +% +%INC_OUTLET_TYPE= PRESSURE_OUTLET +%MARKER_OUTLET= ( fluid_outlet, 0.0 ) +% +% ------------------------ SURFACES IDENTIFICATION ----------------------------% +% +MARKER_MONITORING= ( NONE ) +% +MARKER_ANALYZE = ( fluid_outlet, fluid_inlet ) +MARKER_ANALYZE_AVERAGE = MASSFLUX +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +%ITER= 3500 +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 1e3 +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1e-15 +LINEAR_SOLVER_ITER= 10 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= FDS +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= NONE +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +SLOPE_LIMITER_TURB= NONE +TIME_DISCRE_TURB= EULER_IMPLICIT +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_CRITERIA= RESIDUAL +CONV_RESIDUAL_MINVAL= -26 +CONV_STARTITER= 100000000 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +%MESH_FILENAME= fluid.su2 +% +HISTORY_OUTPUT= ( ITER, RMS_RES, STREAMWISE_PERIODIC, FLOW_COEFF, LINSOL, HEAT ) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg new file mode 100644 index 000000000000..f452de8088b3 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configMaster.cfg @@ -0,0 +1,116 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: 2D cylinder array with CHT couplings % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 2020.12.15 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +SOLVER= MULTIPHYSICS +% +CONFIG_LIST= (configFluid.cfg, configSolid.cfg) +% +MARKER_ZONE_INTERFACE= ( fluid_pin1_interface, solid_pin1_interface, fluid_pin2_interface, solid_pin2_interface, fluid_pin3_interface, solid_pin3_interface ) +% +MARKER_CHT_INTERFACE= ( fluid_pin1_interface, solid_pin1_interface, fluid_pin2_interface, solid_pin2_interface, fluid_pin3_interface, solid_pin3_interface ) +% +CONV_RESIDUAL_MINVAL= -26 +% +% Number of total iterations +OUTER_ITER= 4000 +% +%CHT_ROBIN= NO +% +SCREEN_OUTPUT= ( OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) +SCREEN_WRT_FREQ_OUTER= 100 +% +HISTORY_OUTPUT= ( ITER, BGS_RES[0], BGS_RES[1], RMS_RES[0], RMS_RES[1], STREAMWISE_PERIODIC[0], FLOW_COEFF[0], HEAT[1], LINSOL[0], LINSOL[1], HEAT[0] ) +% +OUTPUT_FILES= ( RESTART, PARAVIEW_MULTIBLOCK ) +OUTPUT_WRT_FREQ= 1000 +% +MESH_FILENAME= 2D-PinArray_FFD.su2 +MESH_FORMAT= SU2 +% +% -------------------- FREE-FORM DEFORMATION PARAMETERS -----------------------% +% +FFD_TOLERANCE= 1E-10 +FFD_ITERATIONS= 500 +% +% FFD box definition: 2D case (FFD_BoxTag, X1, Y1, 0.0, X2, Y2, 0.0, X3, Y3, 0.0, X4, Y4, 0.0, +% 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) +FFD_DEFINITION= (BOX, 0.0029772,0.0,0.0, 0.0081772,0.0,0.0 0.0081772,0.0026,0.0, 0.0029772,0.0026,0.0, 0.0,0.0,0.0, 0.0,0.0,0.0 0.0,0.0,0.0, 0.0,0.0,0.0 ) +% +% FFD box degree: 2D case (x_degree, y_degree, 0) +FFD_DEGREE= (8, 1, 0) +% +% Surface grid continuity at the intersection with the faces of the FFD boxes. +% To keep a particular level of surface continuity, SU2 automatically freezes the right +% number of control point planes (NO_DERIVATIVE, 1ST_DERIVATIVE, 2ND_DERIVATIVE, USER_INPUT) +FFD_CONTINUITY= NO_DERIVATIVE +% +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% +% +% Config options for writing the FFD-box into the mesh. +% Comment these options if they appear elsewhere in the .cfg file. +%DV_KIND= FFD_SETTING +%DV_PARAM= ( 1.0 ) +%DV_VALUE= 1.0 +%MESH_FILENAME= 2D-PinArray.su2 +%MESH_OUT_FILENAME= 2D-PinArray_FFD.su2 +MARKER_SYM= ( fluid_symmetry ) + +DV_KIND= FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D,FFD_CONTROL_POINT_2D +% +% Marker of the surface in which we are going apply the shape deformation +DV_MARKER= ( fluid_pin2_interface, solid_pin2_interface, fluid_symmetry ) +% +% Parameters of the shape deformation +% - FFD_SETTING ( 1.0 ) +% - FFD_CONTROL_POINT_2D ( FFD_BoxTag, i_Ind, j_Ind, x_Disp, y_Disp ) +DV_PARAM= \ +( BOX, 0, 1, 0.0, 1.0);\ +( BOX, 1, 1, 0.0, 1.0);\ +( BOX, 2, 1, 0.0, 1.0);\ +( BOX, 3, 1, 0.0, 1.0);\ +( BOX, 4, 1, 0.0, 1.0);\ +( BOX, 5, 1, 0.0, 1.0);\ +( BOX, 6, 1, 0.0, 1.0);\ +( BOX, 7, 1, 0.0, 1.0);\ +( BOX, 8, 1, 0.0, 1.0) +% +% Value of the shape deformation +DV_VALUE= 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0 +% +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% +% +DEFORM_LINEAR_SOLVER= FGMRES +DEFORM_LINEAR_SOLVER_PREC= ILU +DEFORM_LINEAR_SOLVER_ERROR= 1E-14 +% +DEFORM_NONLINEAR_ITER= 1 +DEFORM_LINEAR_SOLVER_ITER= 1000 +% +DEFORM_CONSOLE_OUTPUT= YES +DEFORM_STIFFNESS_TYPE= WALL_DISTANCE +% +% Deformation coefficient (linear elasticity limits from -1.0 to 0.5, a larger +% value is also possible) +% !!! What is this doing !!! +DEFORM_COEFF = 1E6 +% +DEFINITION_DV= \ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 0, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 1, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 2, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 3, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 4, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 5, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 6, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 7, 1, 0.0, 1.0 );\ +( 19, 1.0 | fluid_pin2_interface, solid_pin2_interface, fluid_symmetry | BOX, 8, 1, 0.0, 1.0 ) + +%DEFORM_MESH= YES diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configSolid.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configSolid.cfg new file mode 100644 index 000000000000..3b49b93125e3 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/configSolid.cfg @@ -0,0 +1,70 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Unit Cell flow around pin array (solid) % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 2020.12.15 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= HEAT_EQUATION +% +OBJECTIVE_FUNCTION= AVG_TEMPERATURE +OBJECTIVE_WEIGHT= 1.0 +% +OPT_OBJECTIVE= AVG_TOTALTEMP +% +% ---------------- (SOLIDS) CONDUCTION CONDITION DEFINITION -------------------% +% +INC_NONDIM= DIMENSIONAL +SOLID_TEMPERATURE_INIT= 345.0 +SOLID_DENSITY= 2719 +SPECIFIC_HEAT_CP = 871.0 +SOLID_THERMAL_CONDUCTIVITY= 200 +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= (solid_pin1_inner, 5e5, \ + solid_pin2_inner, 5e5, \ + solid_pin3_inner, 5e5, \ + solid_pin1_walls, 0.0, \ + solid_pin2_walls, 0.0, \ + solid_pin3_walls, 0.0) +% +%MARKER_ISOTHERMAL= (solid_pin1_inner, 300, solid_pin2_inner, 300, solid_pin3_inner, 300, solid_pin1_walls, 300, solid_pin2_walls, 300, solid_pin3_walls, 300) +% +% ------------------------ SURFACES IDENTIFICATION ----------------------------% +% +MARKER_MONITORING = ( solid_pin2_inner ) +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 1e4 +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-15 +LINEAR_SOLVER_ITER= 20 +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_CRITERIA= RESIDUAL +CONV_RESIDUAL_MINVAL= -20 +CONV_STARTITER= 10000000000 +% +% -------------------- HEAT NUMERICAL METHOD DEFINITION -----------------------% +% +TIME_DISCRE_HEAT= EULER_IMPLICIT +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +%MESH_FILENAME= solid.su2 +% +HISTORY_OUTPUT= (ITER, RMS_RES, HEAT, LINSOL) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref new file mode 100644 index 000000000000..c830b62a8379 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/of_grad_findiff.csv.ref @@ -0,0 +1,2 @@ +"VARIABLE" , "AVG_DENSITY[0]", "AVG_ENTHALPY[0]", "AVG_NORMALVEL[0]", "DRAG[0]" , "EFFICIENCY[0]" , "FORCE_X[0]" , "FORCE_Y[0]" , "FORCE_Z[0]" , "LIFT[0]" , "MOMENT_X[0]" , "MOMENT_Y[0]" , "MOMENT_Z[0]" , "SIDEFORCE[0]" , "SURFACE_MACH[0]", "SURFACE_MASSFLOW[0]", "SURFACE_MOM_DISTORTION[0]", "SURFACE_PRESSURE_DROP[0]", "SURFACE_SECONDARY[0]", "SURFACE_SECOND_OVER_UNIFORM[0]", "SURFACE_STATIC_PRESSURE[0]", "SURFACE_STATIC_TEMPERATURE[0]", "SURFACE_TOTAL_PRESSURE[0]", "SURFACE_TOTAL_TEMPERATURE[0]", "SURFACE_UNIFORMITY[0]", "AVG_TEMPERATURE[1]", "MAXIMUM_HEATFLUX[1]", "TOTAL_HEATFLUX[1]", "FINDIFF_STEP" +0 , 0.0 , -100000.01639127731, 8.88180000002836e-08, 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , -0.04999999997368221, -5.5510000002640306e-08, -2.069999999187999 , 0.0 , 2.129999999989085 , 3.6999999980524834 , 330.00000030369847 , -30.00000106112566 , 314.99999977313564 , -30.00000106112566 , -1.400000004814217 , -129.99999512430804, 0.0 , -510.0000066704524, 1e-08 diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg new file mode 100644 index 000000000000..b7ef1fa5a759 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configFluid.cfg @@ -0,0 +1,114 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Unit Cell flow around pin array 3d (fluid) % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 07.06.2019 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= INC_RANS +KIND_TURB_MODEL= SST +% +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +INC_DENSITY_MODEL= CONSTANT +INC_DENSITY_INIT= 1045.0 +INC_VELOCITY_INIT= ( 0.1, 0.0, 0.0 ) +% +INC_ENERGY_EQUATION = YES +INC_TEMPERATURE_INIT= 338.0 +SPECIFIC_HEAT_CP= 3540.0 +% +INC_NONDIM= DIMENSIONAL +% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 0.001385 +% +FREESTREAM_TURBULENCEINTENSITY= 0.05 +FREESTREAM_TURB2LAMVISCRATIO= 10.0 +% +% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% +% +% Pr_lam = mu_lam [Pa*s] * c_p [J/(kg*K)] / lambda[W/(m*K)] +% = 1.385e-3 * 3540 / 0.42 +% = 11.7 +CONDUCTIVITY_MODEL= CONSTANT_PRANDTL +PRANDTL_LAM= 11.7 +% +TURBULENT_CONDUCTIVITY_MODEL= CONSTANT_PRANDTL_TURB +PRANDTL_TURB= 0.90 +% +% --------------------- STREAMWISE PERIODICITY DEFINITION ---------------------% +% +KIND_STREAMWISE_PERIODIC= MASSFLOW +STREAMWISE_PERIODIC_PRESSURE_DROP= 210 +STREAMWISE_PERIODIC_MASSFLOW= 0.009675 +INC_OUTLET_DAMPING= 0.001 +% +STREAMWISE_PERIODIC_TEMPERATURE= NO +STREAMWISE_PERIODIC_OUTLET_HEAT= -17.958584 +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( fluid_top, 0.0, \ + fluid_bottom_interface, 0.0, \ + fluid_pin1, 0.0, \ + fluid_pin3, 0.0 ) +MARKER_SYM= ( fluid_sym_sides ) +MARKER_PERIODIC= ( fluid_inlet, fluid_outlet, 0.0,0.0,0.0, 0.0,0.0,0.0, 0.0111544,0.0,0.0 ) +% +% Alternative to periodic simulation +%INC_INLET_TYPE= VELOCITY_INLET +%MARKER_INLET= ( fluid_inlet, 338.0, 0.75, 1.0, 0.0, 0.0 ) +% +%INC_OUTLET_TYPE= PRESSURE_OUTLET +%MARKER_OUTLET= ( fluid_outlet, 0.0 ) +% +% ------------------------ SURFACES IDENTIFICATION ----------------------------% +% +MARKER_MONITORING= ( fluid_inlet, fluid_outlet ) +% +MARKER_ANALYZE = ( fluid_outlet, fluid_inlet ) +MARKER_ANALYZE_AVERAGE = MASSFLUX +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 10 +CFL_ADAPT= NO +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-15 +LINEAR_SOLVER_ITER= 15 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= FDS +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= NONE +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +SLOPE_LIMITER_TURB= NONE +TIME_DISCRE_TURB= EULER_IMPLICIT +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_CRITERIA= RESIDUAL +CONV_RESIDUAL_MINVAL= -26 +CONV_STARTITER= 100000000 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +HISTORY_OUTPUT= ( ITER, RMS_RES, STREAMWISE_PERIODIC, FLOW_COEFF ) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg new file mode 100644 index 000000000000..fac9c99f4c64 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configMaster.cfg @@ -0,0 +1,42 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: 3D cylinder array with CHT couplings % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 2020.12.15 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +SOLVER= MULTIPHYSICS +% +CONFIG_LIST = (configFluid.cfg, configSolid.cfg) +% +MARKER_ZONE_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pin1, solid_pin1, fluid_pin2, solid_pin2, fluid_pin3, solid_pin3 ) +% +MARKER_CHT_INTERFACE= (fluid_bottom_interface, solid_bottom_interface, fluid_pin1, solid_pin1, fluid_pin2, solid_pin2, fluid_pin3, solid_pin3 ) +% +OUTER_ITER = 15000 +% +CONV_RESIDUAL_MINVAL= -26 +% +SCREEN_OUTPUT= (OUTER_ITER, BGS_PRESSURE[0], BGS_TEMPERATURE[0], BGS_TEMPERATURE[1], STREAMWISE_MASSFLOW[0], STREAMWISE_DP[0], AVG_TEMPERATURE[1] ) +SCREEN_WRT_FREQ_OUTER= 100 +% +OUTPUT_FILES= (RESTART, PARAVIEW_MULTIBLOCK) +OUTPUT_WRT_FREQ= 2500 +% +%CHT_ROBIN= NO +% +% Mesh input file +MESH_FILENAME= 3D_chtPinArray_coarse.su2 +% +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% +% +% These are just default parameters so that we can run SU2_DOT_AD, they have no physical meaning for this test case. +% +DV_KIND= HICKS_HENNE +DV_MARKER= (fluid_pin2, solid_pin2) +DV_PARAM= (0.0, 0.5) +DV_VALUE= 0.1 diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configSolid.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configSolid.cfg new file mode 100644 index 000000000000..a1362711f77c --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_3d/configSolid.cfg @@ -0,0 +1,70 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Unit Cell flow around pin array (solid) % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 07.06.2019 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= HEAT_EQUATION +% +% ---------------- (SOLIDS) CONDUCTION CONDITION DEFINITION -------------------% +% +INC_NONDIM= DIMENSIONAL +SOLID_TEMPERATURE_INIT= 345.0 +SOLID_DENSITY= 2719 +SPECIFIC_HEAT_CP = 871.0 +SOLID_THERMAL_CONDUCTIVITY= 200 +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_SYM= ( solid_sym_sides) +% +MARKER_HEATFLUX= ( solid_bottom_heater, 5e5, \ + solid_block_inlet, 0.0, \ + solid_block_outlet, 0.0, \ + solid_pin1_inlet, 0.0, \ + solid_pin3_outlet, 0.0, \ + solid_pins_top, 0.0, \ + solid_bottom_interface, 0.0, \ + solid_pin1, 0.0, \ + solid_pin3, 0.0 ) +% +%MARKER_HEATFLUX= ( solid_bottom_heater, 5e5, solid_block_inlet, 0.0, solid_block_outlet, 0.0, solid_pin1_inlet, 0.0, solid_pin3_outlet, 0.0, solid_pins_top, 0.0 ) +%MARKER_ISOTHERMAL= ( solid_bottom_heater, 300 ) +% +% ------------------------ SURFACES IDENTIFICATION ----------------------------% +% +MARKER_MONITORING = ( solid_bottom_heater ) +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 1000 +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-18 +LINEAR_SOLVER_ITER= 15 +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_CRITERIA= RESIDUAL +CONV_RESIDUAL_MINVAL= -20 +CONV_STARTITER= 10000000000 +% +% -------------------- HEAT NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_HEAT = SPACE_CENTERED +TIME_DISCRE_HEAT= EULER_IMPLICIT +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +HISTORY_OUTPUT= (ITER, RMS_RES, HEAT) diff --git a/TestCases/incomp_navierstokes/streamwise_periodic/pipeSlice_3d/sp_pipeSlice_3d_dp_hf_tp.cfg b/TestCases/incomp_navierstokes/streamwise_periodic/pipeSlice_3d/sp_pipeSlice_3d_dp_hf_tp.cfg new file mode 100644 index 000000000000..249beb91e714 --- /dev/null +++ b/TestCases/incomp_navierstokes/streamwise_periodic/pipeSlice_3d/sp_pipeSlice_3d_dp_hf_tp.cfg @@ -0,0 +1,86 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Poiseuille flow for testing a body force/periodicity % +% Author: T. Kattmann % +% Institution: Robert Bosch GmbH % +% Date: 2020.12.14 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= INC_NAVIER_STOKES +% +KIND_TURB_MODEL= NONE +% +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +INC_DENSITY_MODEL= CONSTANT +INC_ENERGY_EQUATION = NO +INC_DENSITY_INIT= 1.0 +INC_VELOCITY_INIT= ( 0.0, 0.0, 0.3 ) +INC_NONDIM= DIMENSIONAL +% +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 1.8e-5 +% +% --------------------- STREAMWISE PERIODICITY DEFINITION ---------------------% +% +KIND_STREAMWISE_PERIODIC= PRESSURE_DROP +STREAMWISE_PERIODIC_PRESSURE_DROP= 0.001 +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= (wall, 0.0) +MARKER_PERIODIC= ( inlet, outlet, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0005 ) +% +MARKER_PLOTTING= ( inlet ) +MARKER_MONITORING= ( wall ) +MARKER_ANALYZE = ( oulet ) +MARKER_ANALYZE_AVERAGE = AREA +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +%CFL_NUMBER= 1e10 +CFL_NUMBER= 50000 +%CFL_ADAPT= YES +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 0.5, 10, 15.0, 1e30 ) +ITER= 15000 +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-15 +LINEAR_SOLVER_ITER= 10 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= FDS +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= NONE +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_CRITERIA= RESIDUAL +CONV_RESIDUAL_MINVAL= -24 +CONV_STARTITER= 10 +% +% ------------------------- INPUT/OUTPUT INFORMATION ----------------------.su2 +% +MESH_FILENAME= pipe1cell3D.su2 +% +OUTPUT_FILES= ( RESTART, PARAVIEW_MULTIBLOCK, SURFACE_TECPLOT_ASCII ) +OUTPUT_WRT_FREQ= 1000 +% +HISTORY_OUTPUT= ( RMS_RES, FLOW_COEFF, STREAMWISE_PERIODIC, LINSOL ) +% +SCREEN_OUTPUT= ( INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Z, STREAMWISE_MASSFLOW ) +SCREEN_WRT_FREQ_INNER= 100 diff --git a/TestCases/incomp_rans/naca0012/naca0012.cfg b/TestCases/incomp_rans/naca0012/naca0012.cfg index b49ec5a95c7b..5cd1ee3b0ad6 100644 --- a/TestCases/incomp_rans/naca0012/naca0012.cfg +++ b/TestCases/incomp_rans/naca0012/naca0012.cfg @@ -6,7 +6,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: Feb 18th, 2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/incomp_rans/naca0012/naca0012_SST_SUST.cfg b/TestCases/incomp_rans/naca0012/naca0012_SST_SUST.cfg index a4861b05b814..73392f31c69a 100644 --- a/TestCases/incomp_rans/naca0012/naca0012_SST_SUST.cfg +++ b/TestCases/incomp_rans/naca0012/naca0012_SST_SUST.cfg @@ -6,7 +6,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: Feb 18th, 2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/incomp_rans/rough_flatplate/rough_flatplate_incomp.cfg b/TestCases/incomp_rans/rough_flatplate/rough_flatplate_incomp.cfg index ce00494b14d9..8b50e4df8e2b 100644 --- a/TestCases/incomp_rans/rough_flatplate/rough_flatplate_incomp.cfg +++ b/TestCases/incomp_rans/rough_flatplate/rough_flatplate_incomp.cfg @@ -155,7 +155,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/mms/fvm_incomp_euler/inv_mms_jst.cfg b/TestCases/mms/fvm_incomp_euler/inv_mms_jst.cfg index a7017d93c384..e52d87969f93 100755 --- a/TestCases/mms/fvm_incomp_euler/inv_mms_jst.cfg +++ b/TestCases/mms/fvm_incomp_euler/inv_mms_jst.cfg @@ -4,7 +4,7 @@ % Case description: Incompressible inviscid MMS test case % % Author: Thomas D. Economon % % Date: 2019.04.09 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -111,7 +111,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/mms/fvm_incomp_navierstokes/lam_mms_fds.cfg b/TestCases/mms/fvm_incomp_navierstokes/lam_mms_fds.cfg index cfabd77e7300..a361a2e79337 100755 --- a/TestCases/mms/fvm_incomp_navierstokes/lam_mms_fds.cfg +++ b/TestCases/mms/fvm_incomp_navierstokes/lam_mms_fds.cfg @@ -4,7 +4,7 @@ % Case description: Incompressible laminar MMS test case % % Author: Thomas D. Economon % % Date: 2019.04.09 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -129,7 +129,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/mms/fvm_navierstokes/lam_mms_roe.cfg b/TestCases/mms/fvm_navierstokes/lam_mms_roe.cfg index 011294a777ba..a571fe895620 100755 --- a/TestCases/mms/fvm_navierstokes/lam_mms_roe.cfg +++ b/TestCases/mms/fvm_navierstokes/lam_mms_roe.cfg @@ -4,7 +4,7 @@ % Case description: Compressible laminar MMS test case % % Author: Thomas D. Economon % % Date: 2019.04.09 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -146,7 +146,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/moving_wall/cavity/lam_cavity.cfg b/TestCases/moving_wall/cavity/lam_cavity.cfg index 545e44b297b5..dd68814dc411 100644 --- a/TestCases/moving_wall/cavity/lam_cavity.cfg +++ b/TestCases/moving_wall/cavity/lam_cavity.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.10.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -48,8 +48,7 @@ REYNOLDS_LENGTH= 1.0 % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% % % Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, -% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, ELASTICITY, -% EXTERNAL) +% MOVING_WALL, AEROELASTIC, ELASTICITY, EXTERNAL) SURFACE_MOVEMENT= MOVING_WALL % % Motion mach number (non-dimensional). Used for initializing a viscous flow diff --git a/TestCases/moving_wall/spinning_cylinder/spinning_cylinder.cfg b/TestCases/moving_wall/spinning_cylinder/spinning_cylinder.cfg index 4dc1a80d0a7b..88af508918ad 100644 --- a/TestCases/moving_wall/spinning_cylinder/spinning_cylinder.cfg +++ b/TestCases/moving_wall/spinning_cylinder/spinning_cylinder.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.08.21 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -48,7 +48,7 @@ REYNOLDS_LENGTH= 1.0 % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% % % Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, -% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, EXTERNAL) +% MOVING_WALL, AEROELASTIC, EXTERNAL) SURFACE_MOVEMENT= MOVING_WALL % % Motion mach number (non-dimensional). Used for intitializing a viscous flow diff --git a/TestCases/multiple_ffd/naca0012/inv_NACA0012_ffd.cfg b/TestCases/multiple_ffd/naca0012/inv_NACA0012_ffd.cfg index 9b28228fc943..805bc7130663 100644 --- a/TestCases/multiple_ffd/naca0012/inv_NACA0012_ffd.cfg +++ b/TestCases/multiple_ffd/naca0012/inv_NACA0012_ffd.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios, Charanya Venkatesan-Crome % % Institution: Stanford University % % Date: 2018.07.23 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/navierstokes/cylinder/cylinder_lowmach.cfg b/TestCases/navierstokes/cylinder/cylinder_lowmach.cfg index db91c5d4bdd7..de990f8c2257 100644 --- a/TestCases/navierstokes/cylinder/cylinder_lowmach.cfg +++ b/TestCases/navierstokes/cylinder/cylinder_lowmach.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.09.30 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/navierstokes/cylinder/lam_cylinder.cfg b/TestCases/navierstokes/cylinder/lam_cylinder.cfg index 9672ff6f3e05..b5e7d9cc60df 100644 --- a/TestCases/navierstokes/cylinder/lam_cylinder.cfg +++ b/TestCases/navierstokes/cylinder/lam_cylinder.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.09.30 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/navierstokes/flatplate/lam_flatplate.cfg b/TestCases/navierstokes/flatplate/lam_flatplate.cfg index 5712c970bff2..7b470bd118d5 100644 --- a/TestCases/navierstokes/flatplate/lam_flatplate.cfg +++ b/TestCases/navierstokes/flatplate/lam_flatplate.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.09.30 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/navierstokes/naca0012/lam_NACA0012.cfg b/TestCases/navierstokes/naca0012/lam_NACA0012.cfg index 3e144f7e2373..9545f582201d 100644 --- a/TestCases/navierstokes/naca0012/lam_NACA0012.cfg +++ b/TestCases/navierstokes/naca0012/lam_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: Sep 28, 2012 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/navierstokes/poiseuille/lam_poiseuille.cfg b/TestCases/navierstokes/poiseuille/lam_poiseuille.cfg index 554104dd03ba..0aba572cd340 100644 --- a/TestCases/navierstokes/poiseuille/lam_poiseuille.cfg +++ b/TestCases/navierstokes/poiseuille/lam_poiseuille.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2017.02.27 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -130,9 +130,6 @@ MARKER_PLOTTING= ( lower ) % % Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated MARKER_MONITORING= ( left, right ) -% -% Kind of adaptation (needed to create the initial periodic mesh) -KIND_ADAPT= PERIODIC % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % diff --git a/TestCases/navierstokes/poiseuille/profile_poiseuille.cfg b/TestCases/navierstokes/poiseuille/profile_poiseuille.cfg index e1704782600f..d91ca807083d 100644 --- a/TestCases/navierstokes/poiseuille/profile_poiseuille.cfg +++ b/TestCases/navierstokes/poiseuille/profile_poiseuille.cfg @@ -141,9 +141,6 @@ MARKER_PLOTTING= ( upper ) % % Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated MARKER_MONITORING= ( left, right ) -% -% Kind of adaptation (needed to create the initial periodic mesh) -KIND_ADAPT= PERIODIC % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % diff --git a/TestCases/nicf/edge/edge_PPR.cfg b/TestCases/nicf/edge/edge_PPR.cfg index d14295477209..c0924e6b1392 100644 --- a/TestCases/nicf/edge/edge_PPR.cfg +++ b/TestCases/nicf/edge/edge_PPR.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.09.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/nicf/edge/edge_VW.cfg b/TestCases/nicf/edge/edge_VW.cfg index 3b068bd61bbe..2a2e2bbcace4 100644 --- a/TestCases/nicf/edge/edge_VW.cfg +++ b/TestCases/nicf/edge/edge_VW.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2012.09.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/nonequilibrium/invwedge/invwedge.cfg b/TestCases/nonequilibrium/invwedge/invwedge.cfg index f783a7fb7995..bedfd32f6c75 100644 --- a/TestCases/nonequilibrium/invwedge/invwedge.cfg +++ b/TestCases/nonequilibrium/invwedge/invwedge.cfg @@ -5,7 +5,7 @@ % Author: C. Garbacz % % Institution: Strathclyde University % % Date: 2020.11.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/nonequilibrium/viscwedge/viscwedge.cfg b/TestCases/nonequilibrium/viscwedge/viscwedge.cfg index 1a70c0273917..df60ff248c24 100644 --- a/TestCases/nonequilibrium/viscwedge/viscwedge.cfg +++ b/TestCases/nonequilibrium/viscwedge/viscwedge.cfg @@ -5,7 +5,7 @@ % Author: C. Garbacz % % Institution: Strathclyde University % % Date: 2020.11.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/nonequilibrium/viscwedge_mpp/viscwedge_mpp.cfg b/TestCases/nonequilibrium/viscwedge_mpp/viscwedge_mpp.cfg index d81488cc453d..b230e52a280f 100644 --- a/TestCases/nonequilibrium/viscwedge_mpp/viscwedge_mpp.cfg +++ b/TestCases/nonequilibrium/viscwedge_mpp/viscwedge_mpp.cfg @@ -5,7 +5,7 @@ % Author: C. Garbacz % % Institution: Strathclyde University % % Date: 2020.11.01 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_2surf_1obj.cfg b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_2surf_1obj.cfg index 30f8b9432d1e..75081c5600de 100644 --- a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_2surf_1obj.cfg +++ b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_2surf_1obj.cfg @@ -7,7 +7,7 @@ % Author: H.L. Kline, modified from inviscid wedge by Thomas D. Economon % % Institution: Stanford University % % Date: 2018.01.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -111,7 +111,7 @@ LINEAR_SOLVER_ITER= 5 % Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) LINEAR_SOLVER_PREC= ILU % -% Linael solver ILU preconditioner fill-in level (1 by default) +% Linear solver ILU preconditioner fill-in level (1 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 diff --git a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj.cfg b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj.cfg index 24171325ad6d..94ebce1f915e 100644 --- a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj.cfg +++ b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj.cfg @@ -8,7 +8,7 @@ % Author: H.L. Kline, modified from inviscid wedge by Thomas D. Economon % % Institution: Stanford University % % Date: 2018.01.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -112,7 +112,7 @@ LINEAR_SOLVER_ITER= 5 % Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) LINEAR_SOLVER_PREC= ILU % -% Linael solver ILU preconditioner fill-in level (1 by default) +% Linear solver ILU preconditioner fill-in level (1 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 diff --git a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_1surf.cfg b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_1surf.cfg index 09bc08fd8650..322bee977cc7 100644 --- a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_1surf.cfg +++ b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_1surf.cfg @@ -8,7 +8,7 @@ % Author: H.L. Kline, modified from inviscid wedge by Thomas D. Economon % % Institution: Stanford University % % Date: 2018.01.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -112,7 +112,7 @@ LINEAR_SOLVER_ITER= 5 % Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) LINEAR_SOLVER_PREC= ILU % -% Linael solver ILU preconditioner fill-in level (1 by default) +% Linear solver ILU preconditioner fill-in level (1 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 diff --git a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_combo.cfg b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_combo.cfg index 767b543cac4f..a724e5c6d185 100644 --- a/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_combo.cfg +++ b/TestCases/optimization_euler/multiobjective_wedge/inv_wedge_ROE_multiobj_combo.cfg @@ -10,7 +10,7 @@ % Author: H.L. Kline, modified from inviscid wedge by Thomas D. Economon % % Institution: Stanford University % % Date: 2018.01.07 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -114,7 +114,7 @@ LINEAR_SOLVER_ITER= 5 % Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI) LINEAR_SOLVER_PREC= ILU % -% Linael solver ILU preconditioner fill-in level (1 by default) +% Linear solver ILU preconditioner fill-in level (1 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 diff --git a/TestCases/optimization_euler/multipoint_naca0012/inv_NACA0012_multipoint.cfg b/TestCases/optimization_euler/multipoint_naca0012/inv_NACA0012_multipoint.cfg index da556c2ab1c3..bcc583531343 100644 --- a/TestCases/optimization_euler/multipoint_naca0012/inv_NACA0012_multipoint.cfg +++ b/TestCases/optimization_euler/multipoint_naca0012/inv_NACA0012_multipoint.cfg @@ -5,7 +5,7 @@ % Author: Indiana Stokes % % Institution: % % Date: 2017.07.03 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_euler/pitching_naca64a010/pitching_NACA64A010.cfg b/TestCases/optimization_euler/pitching_naca64a010/pitching_NACA64A010.cfg index 8d22b6507446..c5eb434078de 100644 --- a/TestCases/optimization_euler/pitching_naca64a010/pitching_NACA64A010.cfg +++ b/TestCases/optimization_euler/pitching_naca64a010/pitching_NACA64A010.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -51,7 +51,7 @@ UNST_ADJOINT_ITER= 251 % Dynamic mesh simulation (NO, YES) GRID_MOVEMENT= YES % -% Type of mesh motion (NONE, FLUTTER, RIGID_MOTION, FLUID_STRUCTURE) +% Type of mesh motion (NONE, FLUTTER, RIGID_MOTION) GRID_MOVEMENT_KIND= RIGID_MOTION % % Motion mach number (non-dimensional). Used for initializing a viscous flow diff --git a/TestCases/optimization_euler/pitching_oneram6/pitching_ONERAM6.cfg b/TestCases/optimization_euler/pitching_oneram6/pitching_ONERAM6.cfg index 8a1ab1851c2b..5e148350c5bd 100644 --- a/TestCases/optimization_euler/pitching_oneram6/pitching_ONERAM6.cfg +++ b/TestCases/optimization_euler/pitching_oneram6/pitching_ONERAM6.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 09.07.2011 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -65,7 +65,7 @@ UNST_ADJOINT_ITER= 251 GRID_MOVEMENT= YES % % Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, -% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, EXTERNAL) +% MOVING_WALL, AEROELASTIC, EXTERNAL) GRID_MOVEMENT_KIND= RIGID_MOTION % % Motion mach number (non-dimensional). Used for intitializing a viscous flow diff --git a/TestCases/optimization_euler/rotating_naca0012/rotating_NACA0012.cfg b/TestCases/optimization_euler/rotating_naca0012/rotating_NACA0012.cfg index ff3a00c420f0..b139c62ffee4 100644 --- a/TestCases/optimization_euler/rotating_naca0012/rotating_NACA0012.cfg +++ b/TestCases/optimization_euler/rotating_naca0012/rotating_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.03.06 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -58,7 +58,7 @@ REF_AREA= 1.0 GRID_MOVEMENT= YES % % Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, -% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, EXTERNAL) +% MOVING_WALL, AEROELASTIC, EXTERNAL) GRID_MOVEMENT_KIND= ROTATING_FRAME % % Motion mach number (non-dimensional). Used for intitializing a viscous flow diff --git a/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_adv.cfg b/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_adv.cfg index b9778401b9e1..6226b16062c8 100644 --- a/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_adv.cfg +++ b/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_adv.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 2013.09.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_basic.cfg b/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_basic.cfg index bbc1cdd2c9b1..856ce0717353 100644 --- a/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_basic.cfg +++ b/TestCases/optimization_euler/steady_naca0012/inv_NACA0012_basic.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 2013.09.29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_adv.cfg b/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_adv.cfg index 3d65a14543a1..b183a7738f30 100644 --- a/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_adv.cfg +++ b/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_adv.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios, Heather Kline % % Institution: Stanford University % % Date: 01.17.2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_basic.cfg b/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_basic.cfg index 4a95a416992b..7058184e15be 100644 --- a/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_basic.cfg +++ b/TestCases/optimization_euler/steady_oneram6/inv_ONERAM6_basic.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios, Heather Kline % % Institution: Stanford University % % Date: 01.17.2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_rans/naca0012/naca0012.cfg b/TestCases/optimization_rans/naca0012/naca0012.cfg index 1d1eaec533db..2d0c373a422a 100644 --- a/TestCases/optimization_rans/naca0012/naca0012.cfg +++ b/TestCases/optimization_rans/naca0012/naca0012.cfg @@ -5,7 +5,7 @@ % Author: Steffen Schotthöfer % % Institution: TU Kaiserslautern % % Date: Mar 16, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_rans/pitching_naca64a010/turb_NACA64A010.cfg b/TestCases/optimization_rans/pitching_naca64a010/turb_NACA64A010.cfg index 082307c57eba..15f61229e8be 100644 --- a/TestCases/optimization_rans/pitching_naca64a010/turb_NACA64A010.cfg +++ b/TestCases/optimization_rans/pitching_naca64a010/turb_NACA64A010.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_rans/pitching_oneram6/turb_ONERAM6.cfg b/TestCases/optimization_rans/pitching_oneram6/turb_ONERAM6.cfg index bcd5b3afab39..02dc5dd64800 100644 --- a/TestCases/optimization_rans/pitching_oneram6/turb_ONERAM6.cfg +++ b/TestCases/optimization_rans/pitching_oneram6/turb_ONERAM6.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_rans/steady_oneram6/turb_ONERAM6.cfg b/TestCases/optimization_rans/steady_oneram6/turb_ONERAM6.cfg index 8c90a847c612..a078945f5cec 100644 --- a/TestCases/optimization_rans/steady_oneram6/turb_ONERAM6.cfg +++ b/TestCases/optimization_rans/steady_oneram6/turb_ONERAM6.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/optimization_rans/steady_rae2822/turb_SA_RAE2822.cfg b/TestCases/optimization_rans/steady_rae2822/turb_SA_RAE2822.cfg index 2c377163067d..99c6487b5b79 100644 --- a/TestCases/optimization_rans/steady_rae2822/turb_SA_RAE2822.cfg +++ b/TestCases/optimization_rans/steady_rae2822/turb_SA_RAE2822.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 286a4cb1105e..0ac0942e97ab 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -3,7 +3,7 @@ ## \file parallel_regression.py # \brief Python script for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -59,7 +59,7 @@ def main(): thermalbath_frozen.cfg_dir = "nonequilibrium/thermalbath/frozen" thermalbath_frozen.cfg_file = "thermalbath_frozen.cfg" thermalbath_frozen.test_iter = 10 - thermalbath_frozen.test_vals = [ -32.000000, -32.000000, -11.92359, -11.962329, -32.000000, 10.813864] + thermalbath_frozen.test_vals = [ -32.000000, -32.000000, -11.92359, -11.962329, -32.000000, 10.813864] thermalbath_frozen.su2_exec = "mpirun -n 2 SU2_CFD" thermalbath_frozen.timeout = 1600 thermalbath_frozen.new_output = True @@ -303,6 +303,17 @@ def main(): turb_oneram6.tol = 0.00001 test_list.append(turb_oneram6) + # ONERA M6 Wing - Newton-Krylov + turb_oneram6_nk = TestCase('turb_oneram6_nk') + turb_oneram6_nk.cfg_dir = "rans/oneram6" + turb_oneram6_nk.cfg_file = "turb_ONERAM6_nk.cfg" + turb_oneram6_nk.test_iter = 20 + turb_oneram6_nk.test_vals = [-4.892257, -4.514011, -11.432312, 0.221025, 0.045570, 2, -0.899459, 3.1384e+01] + turb_oneram6_nk.su2_exec = "mpirun -n 2 SU2_CFD" + turb_oneram6_nk.timeout = 600 + turb_oneram6_nk.tol = 0.0001 + test_list.append(turb_oneram6_nk) + # NACA0012 (SA, FUN3D finest grid results: CL=1.0983, CD=0.01242) turb_naca0012_sa = TestCase('turb_naca0012_sa') turb_naca0012_sa.cfg_dir = "rans/naca0012" @@ -347,6 +358,21 @@ def main(): propeller.tol = 0.00001 test_list.append(propeller) + ####################################### + ### Axisymmetric Compressible RANS ### + ####################################### + + # Axisymmetric air nozzle (transonic) + axi_rans_air_nozzle = TestCase('axi_rans_air_nozzle') + axi_rans_air_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" + axi_rans_air_nozzle.cfg_file = "air_nozzle.cfg" + axi_rans_air_nozzle.test_iter = 10 + axi_rans_air_nozzle.test_vals = [ -12.096569, -6.625843, -8.807541, -2.393279] + axi_rans_air_nozzle.su2_exec = "mpirun -n 2 SU2_CFD" + axi_rans_air_nozzle.timeout = 1600 + axi_rans_air_nozzle.tol = 0.0001 + test_list.append(axi_rans_air_nozzle) + ################################# ## Compressible RANS Restart ### ################################# @@ -420,7 +446,7 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-7.796386, -2.062578, 0.013001, 1.913804] + inc_poly_cylinder.test_vals = [-7.791831, -2.062292, 0.013040, 1.913997] inc_poly_cylinder.su2_exec = "parallel_computation.py -f" inc_poly_cylinder.timeout = 1600 inc_poly_cylinder.tol = 0.00001 @@ -437,6 +463,17 @@ def main(): inc_lam_bend.tol = 0.00001 test_list.append(inc_lam_bend) + # 3D laminar channnel with 1 cell in flow direction, streamwise periodic + sp_pipeSlice_3d_dp_hf_tp = TestCase('sp_pipeSlice_3d_dp_hf_tp') + sp_pipeSlice_3d_dp_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/pipeSlice_3d" + sp_pipeSlice_3d_dp_hf_tp.cfg_file = "sp_pipeSlice_3d_dp_hf_tp.cfg" + sp_pipeSlice_3d_dp_hf_tp.test_iter = 10 + sp_pipeSlice_3d_dp_hf_tp.test_vals = [-11.119796, -11.234737, -8.694310, -0.000023] #last 4 lines + sp_pipeSlice_3d_dp_hf_tp.su2_exec = "mpirun -n 2 SU2_CFD" + sp_pipeSlice_3d_dp_hf_tp.timeout = 1600 + sp_pipeSlice_3d_dp_hf_tp.tol = 0.00001 + test_list.append(sp_pipeSlice_3d_dp_hf_tp) + ############################ ### Incompressible RANS ### ############################ @@ -559,7 +596,7 @@ def main(): schubauer_klebanoff_transition.cfg_dir = "transition/Schubauer_Klebanoff" schubauer_klebanoff_transition.cfg_file = "transitional_BC_model_ConfigFile.cfg" schubauer_klebanoff_transition.test_iter = 10 - schubauer_klebanoff_transition.test_vals = [-7.994740, -14.268326, 0.000046, 0.007987] + schubauer_klebanoff_transition.test_vals = [-7.994740, -14.268433, 0.000046, 0.007987] schubauer_klebanoff_transition.su2_exec = "parallel_computation.py -f" schubauer_klebanoff_transition.timeout = 1600 schubauer_klebanoff_transition.tol = 0.00001 @@ -910,7 +947,7 @@ def main(): Jones_tc.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc.cfg_file = "Jones.cfg" Jones_tc.test_iter = 5 - Jones_tc.test_vals = [-5.280323, 0.379652, 72.211410, 1.277509] + Jones_tc.test_vals = [-5.279937, 0.379652, 72.211410, 1.277508] Jones_tc.su2_exec = "parallel_computation.py -f" Jones_tc.timeout = 1600 Jones_tc.new_output = False @@ -934,7 +971,7 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [-1.933208, 5.379977, 73.357930, 0.925863] + axial_stage2D.test_vals = [-1.933143, 5.379977, 73.357940, 0.925863] axial_stage2D.su2_exec = "parallel_computation.py -f" axial_stage2D.timeout = 1600 axial_stage2D.new_output = False @@ -987,7 +1024,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.398053, 0.352779, 0.405462] + channel_2D.test_vals = [2.000000, 0.000000, 0.397970, 0.352779, 0.405462] channel_2D.su2_exec = "parallel_computation.py -f" channel_2D.timeout = 100 channel_2D.tol = 0.00001 @@ -1064,7 +1101,7 @@ def main(): slinc_steady.cfg_dir = "sliding_interface/incompressible_steady" slinc_steady.cfg_file = "config.cfg" slinc_steady.test_iter = 19 - slinc_steady.test_vals = [19.000000, -1.766116, -2.206522] #last 4 columns + slinc_steady.test_vals = [19.000000, -1.803326, -2.097400] #last 4 columns slinc_steady.su2_exec = "SU2_CFD" slinc_steady.timeout = 100 slinc_steady.tol = 0.00002 @@ -1217,6 +1254,30 @@ def main(): cht_compressible.tol = 0.00001 test_list.append(cht_compressible) + # 2D CHT case streamwise periodicity + sp_pinArray_cht_2d_dp_hf = TestCase('sp_pinArray_cht_2d_dp_hf') + sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" + sp_pinArray_cht_2d_dp_hf.cfg_file = "configMaster.cfg" + sp_pinArray_cht_2d_dp_hf.test_iter = 100 + sp_pinArray_cht_2d_dp_hf.test_vals = [0.247022, -0.812199, -0.974877, -0.753315, 208.023676, 349.950000] #last 7 lines + sp_pinArray_cht_2d_dp_hf.su2_exec = "mpirun -n 2 SU2_CFD" + sp_pinArray_cht_2d_dp_hf.timeout = 1600 + sp_pinArray_cht_2d_dp_hf.tol = 0.00001 + sp_pinArray_cht_2d_dp_hf.multizone = True + test_list.append(sp_pinArray_cht_2d_dp_hf) + + # simple small 3D pin case massflow periodic with heatflux BC + sp_pinArray_3d_cht_mf_hf_tp = TestCase('sp_pinArray_3d_cht_mf_hf_tp') + sp_pinArray_3d_cht_mf_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_3d" + sp_pinArray_3d_cht_mf_hf_tp.cfg_file = "configMaster.cfg" + sp_pinArray_3d_cht_mf_hf_tp.test_iter = 30 + sp_pinArray_3d_cht_mf_hf_tp.test_vals = [0.511984, -3.063453, -0.451732, -0.008477, 214.707868, 365.670000] #last 7 lines + sp_pinArray_3d_cht_mf_hf_tp.su2_exec = "mpirun -n 2 SU2_CFD" + sp_pinArray_3d_cht_mf_hf_tp.timeout = 1600 + sp_pinArray_3d_cht_mf_hf_tp.tol = 0.00001 + sp_pinArray_3d_cht_mf_hf_tp.multizone = True + test_list.append(sp_pinArray_3d_cht_mf_hf_tp) + ########################## ### Python wrapper ### ########################## @@ -1298,7 +1359,7 @@ def main(): pywrapper_rigidMotion.cfg_dir = "py_wrapper/flatPlate_rigidMotion" pywrapper_rigidMotion.cfg_file = "flatPlate_rigidMotion_Conf.cfg" pywrapper_rigidMotion.test_iter = 5 - pywrapper_rigidMotion.test_vals = [-1.614165, 2.242641, -0.038307, 0.173866] + pywrapper_rigidMotion.test_vals = [-1.551335, 2.295594, 0.350036, 0.093081] pywrapper_rigidMotion.su2_exec = "mpirun -np 2 python launch_flatPlate_rigidMotion.py --parallel -f" pywrapper_rigidMotion.timeout = 1600 pywrapper_rigidMotion.tol = 0.00001 @@ -1570,6 +1631,20 @@ def main(): pass_list.append(sphere_ffd_def_bspline.run_def()) test_list.append(sphere_ffd_def_bspline) + # 2D FD streamwise periodic cht, avg temp obj func + fd_sp_pinArray_cht_2d_dp_hf = TestCase('fd_sp_pinArray_cht_2d_dp_hf') + fd_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" + fd_sp_pinArray_cht_2d_dp_hf.cfg_file = "FD_configMaster.cfg" + fd_sp_pinArray_cht_2d_dp_hf.test_iter = 100 + fd_sp_pinArray_cht_2d_dp_hf.su2_exec = "finite_differences.py -z 2 -n 2 -f" + fd_sp_pinArray_cht_2d_dp_hf.timeout = 1600 + fd_sp_pinArray_cht_2d_dp_hf.reference_file = "of_grad_findiff.csv.ref" + fd_sp_pinArray_cht_2d_dp_hf.test_file = "FINDIFF/of_grad_findiff.csv" + fd_sp_pinArray_cht_2d_dp_hf.multizone = True + + pass_list.append(fd_sp_pinArray_cht_2d_dp_hf.run_filediff()) + test_list.append(fd_sp_pinArray_cht_2d_dp_hf) + # Tests summary print('==================================================================') diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index b545e806bd6d..26b4a8b461ee 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -3,7 +3,7 @@ ## \file parallel_regression.py # \brief Python script for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -125,7 +125,7 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -2.195519, -2.126967, 0.000000] + discadj_incomp_cylinder.test_vals = [20.000000, -2.195614, -2.162059, 0.000000] discadj_incomp_cylinder.su2_exec = "parallel_computation.py -f" discadj_incomp_cylinder.timeout = 1600 discadj_incomp_cylinder.tol = 0.00001 @@ -261,7 +261,7 @@ def main(): discadj_fea.cfg_dir = "disc_adj_fea" discadj_fea.cfg_file = "configAD_fem.cfg" discadj_fea.test_iter = 4 - discadj_fea.test_vals = [-2.849526, -3.238467, -3.6413e-04, -8.7087] #last 4 columns + discadj_fea.test_vals = [-2.849496, -3.238424, -3.6413e-04, -8.7087] #last 4 columns discadj_fea.su2_exec = "parallel_computation.py -f" discadj_fea.timeout = 1600 discadj_fea.tol = 0.00001 @@ -321,8 +321,19 @@ def main(): discadj_cht.su2_exec = "mpirun -n 2 SU2_CFD_AD" discadj_cht.timeout = 1600 discadj_cht.tol = 0.00001 - test_list.append(discadj_cht) - + test_list.append(discadj_cht) + + # 2D DA cht streamwise periodic case, 2 zones, avg temp objective + da_sp_pinArray_cht_2d_dp_hf = TestCase('da_sp_pinArray_cht_2d_dp_hf') + da_sp_pinArray_cht_2d_dp_hf.cfg_dir = "incomp_navierstokes/streamwise_periodic/chtPinArray_2d" + da_sp_pinArray_cht_2d_dp_hf.cfg_file = "DA_configMaster.cfg" + da_sp_pinArray_cht_2d_dp_hf.test_iter = 100 + da_sp_pinArray_cht_2d_dp_hf.test_vals = [-4.793283, -4.065832, -4.137121] #last 4 lines + da_sp_pinArray_cht_2d_dp_hf.su2_exec = "mpirun -n 2 SU2_CFD_AD" + da_sp_pinArray_cht_2d_dp_hf.timeout = 1600 + da_sp_pinArray_cht_2d_dp_hf.tol = 0.00001 + da_sp_pinArray_cht_2d_dp_hf.multizone = True + test_list.append(da_sp_pinArray_cht_2d_dp_hf) ###################################### ### RUN TESTS ### diff --git a/TestCases/pastix_support/config.cfg b/TestCases/pastix_support/config.cfg index bbfab201580c..e119d21b9c33 100644 --- a/TestCases/pastix_support/config.cfg +++ b/TestCases/pastix_support/config.cfg @@ -2,7 +2,7 @@ % SU2 configuration file % % PaStiX options (http://pastix.gforge.inria.fr/files/README-txt.html) % % Institution: Imperial College London % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Intro: diff --git a/TestCases/pastix_support/readme.txt b/TestCases/pastix_support/readme.txt index e8d264b97b6d..17f832ae302d 100644 --- a/TestCases/pastix_support/readme.txt +++ b/TestCases/pastix_support/readme.txt @@ -2,7 +2,7 @@ % SU2 configuration file % % PaStiX support build instructions. % % Institution: Imperial College London % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % 1 - Download diff --git a/TestCases/polar/naca0012/inv_NACA0012.cfg b/TestCases/polar/naca0012/inv_NACA0012.cfg index 00881bf58dde..9832313a221e 100644 --- a/TestCases/polar/naca0012/inv_NACA0012.cfg +++ b/TestCases/polar/naca0012/inv_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.11 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/py_wrapper/disc_adj_fea/flow_load_sens/run_adjoint.py b/TestCases/py_wrapper/disc_adj_fea/flow_load_sens/run_adjoint.py index fe244e692f65..18870e67fe94 100755 --- a/TestCases/py_wrapper/disc_adj_fea/flow_load_sens/run_adjoint.py +++ b/TestCases/py_wrapper/disc_adj_fea/flow_load_sens/run_adjoint.py @@ -3,7 +3,7 @@ ## \file run_adjoint.py # \brief Python script to launch SU2_CFD_AD and compute the sensitivity of the FEA problem respect to flow loads. # \author Ruben Sanchez -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society diff --git a/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/run_adjoint.py b/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/run_adjoint.py index 752458d3a967..88ce70e31123 100755 --- a/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/run_adjoint.py +++ b/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/run_adjoint.py @@ -3,7 +3,7 @@ ## \file run_adjoint.py # \brief Python script to launch SU2_CFD_AD # \author Ruben Sanchez -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society diff --git a/TestCases/py_wrapper/flatPlate_rigidMotion/flatPlate_rigidMotion_Conf.cfg b/TestCases/py_wrapper/flatPlate_rigidMotion/flatPlate_rigidMotion_Conf.cfg index 0ebe07328e12..cc1dc0b3e6e3 100644 --- a/TestCases/py_wrapper/flatPlate_rigidMotion/flatPlate_rigidMotion_Conf.cfg +++ b/TestCases/py_wrapper/flatPlate_rigidMotion/flatPlate_rigidMotion_Conf.cfg @@ -5,7 +5,7 @@ % Author: ___________________________________________________________________ % % Institution: ______________________________________________________________ % % Date: __________ % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -22,29 +22,9 @@ KIND_TURB_MODEL= SST % Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) MATH_PROBLEM= DIRECT % -% -% Axisymmetric simulation, only compressible flows (NO, YES) -AXISYMMETRIC= NO -% % Restart solution (NO, YES) RESTART_SOL= NO % -% Discard the data storaged in the solution and geometry files -% e.g. AOA, dCL/dAoA, dCD/dCL, iter, etc. -% Note that AoA in the solution and geometry files is critical -% to aero design using AoA as a variable. (NO, YES) -DISCARD_INFILES= NO -% -% System of measurements (SI, US) -% International system of units (SI): ( meters, kilograms, Kelvins, -% Newtons = kg m/s^2, Pascals = N/m^2, -% Density = kg/m^3, Speed = m/s, -% Equiv. Area = m^2 ) -% United States customary units (US): ( inches, slug, Rankines, lbf = slug ft/s^2, -% psf = lbf/ft^2, Density = slug/ft^3, -% Speed = ft/s, Equiv. Area = ft^2 ) -SYSTEM_MEASUREMENTS= SI - % -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% % % Mach number (non-dimensional, based on the free-stream values) @@ -53,9 +33,6 @@ MACH_NUMBER= 0.03059 % Angle of attack (degrees, only for compressible flows) AOA= 0.0 % -% Side-slip angle (degrees, only for compressible flows) -SIDESLIP_ANGLE= 0.0 -% % Init option to choose between Reynolds (default) or thermodynamics quantities % for initializing the solution (REYNOLDS, TD_CONDITIONS) INIT_OPTION= REYNOLDS @@ -64,9 +41,6 @@ INIT_OPTION= REYNOLDS % initializing the solution (TEMPERATURE_FS, DENSITY_FS) FREESTREAM_OPTION= TEMPERATURE_FS % -% Free-stream pressure (101325.0 N/m^2, 2116.216 psf by default) -FREESTREAM_PRESSURE= 101325.0 -% % Free-stream temperature (288.15 K, 518.67 R by default) FREESTREAM_TEMPERATURE= 293.15 % @@ -75,18 +49,7 @@ REYNOLDS_NUMBER= 24407.25244 % % Reynolds length (1 m, 1 inch by default) REYNOLDS_LENGTH= 0.035 - -% -------------------- INCOMPRESSIBLE FREE-STREAM DEFINITION ------------------% % -% Free-stream density (1.2886 Kg/m^3, 0.0025 slug/ft^3 by default) -FREESTREAM_DENSITY= 1.204 -% -% Free-stream velocity (1.0 m/s, 1.0 ft/s by default) -FREESTREAM_VELOCITY= ( 1.0, 0.00, 0.00 ) -% -% Free-stream viscosity (1.853E-5 N s/m^2, 3.87E-7 lbf s/ft^2 by default) -FREESTREAM_VISCOSITY= 1.82E-5 - % ---------------------- REFERENCE VALUE DEFINITION ---------------------------% % % Reference origin for moment computation (m or in) @@ -101,60 +64,25 @@ REF_LENGTH= 0.035 % calculation) (m^2 or in^2) REF_AREA= 0.035 % -% Aircraft semi-span (0 implies automatic calculation) (m or in) -SEMI_SPAN= 0.0 -% % Flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE, % FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE) REF_DIMENSIONALIZATION= DIMENSIONAL - +% % ---- IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------% % % Different gas model (STANDARD_AIR, IDEAL_GAS, VW_GAS, PR_GAS) FLUID_MODEL= STANDARD_AIR % -% Ratio of specific heats (1.4 default and the value is hardcoded -% for the model STANDARD_AIR) -GAMMA_VALUE= 1.4 -% -% Specific gas constant (287.058 J/kg*K default and this value is hardcoded -% for the model STANDARD_AIR) -GAS_CONSTANT= 287.058 -% -% Critical Temperature (131.00 K by default) -CRITICAL_TEMPERATURE= 131.00 -% -% Critical Pressure (3588550.0 N/m^2 by default) -CRITICAL_PRESSURE= 3588550.0 -% -% Acentri factor (0.035 (air)) -ACENTRIC_FACTOR= 0.035 - % --------------------------- VISCOSITY MODEL ---------------------------------% % % Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). VISCOSITY_MODEL= SUTHERLAND % -% Molecular Viscosity that would be constant (1.716E-5 by default) -MU_CONSTANT= 1.716E-5 -% -% 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 - % --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% % % Conductivity model (CONSTANT_CONDUCTIVITY, CONSTANT_PRANDTL). CONDUCTIVITY_MODEL= CONSTANT_PRANDTL % -% Molecular Thermal Conductivity that would be constant (0.0257 by default) -KT_CONSTANT= 0.0257 - % ------------------------- UNSTEADY SIMULATION -------------------------------% % TIME_DOMAIN=YES @@ -167,54 +95,20 @@ TIME_STEP= 0.003 % % Total Physical Time for dual time stepping simulations (s) MAX_TIME= 1.0 -% -% Unsteady Courant-Friedrichs-Lewy number of the finest grid -UNST_CFL_NUMBER= 0.0 +TIME_ITER = 9999 % % Number of internal iterations (dual time method) INNER_ITER= 10 % % Iteration number to begin unsteady restarts RESTART_ITER= 0 - -TIME_ITER=9999 % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% -% Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME, -% MOVING_WALL, STEADY_TRANSLATION, FLUID_STRUCTURE, -% AEROELASTIC, ELASTICITY, EXTERNAL, -% AEROELASTIC_RIGID_MOTION, GUST) -SURFACE_MOVEMENT= FLUID_STRUCTURE -% -% Motion mach number (non-dimensional). Used for initializing a viscous flow -% with the Reynolds number and for computing force coeffs. with dynamic meshes. -MACH_MOTION= 0.03059 -% -% Moving wall boundary marker(s) (NONE = no marker, ignored for RIGID_MOTION) -MARKER_MOVING= ( plate ) -% -% Coordinates of the motion origin -SURFACE_MOTION_ORIGIN= -0.0028 0.0 0.0 -% -% Move Motion Origin for marker moving (1 or 0) -MOVE_MOTION_ORIGIN = 1 - -% ----------------------- BODY FORCE DEFINITION -------------------------------% % -% Apply a body force as a source term (NO, YES) -BODY_FORCE= NO +DEFORM_MESH = YES +MARKER_DEFORM_MESH = (plate) % -% Vector of body force values (BodyForce_X, BodyForce_Y, BodyForce_Z) -BODY_FORCE_VECTOR= ( 0.0, 0.0, 0.0 ) - % -------------------- BOUNDARY CONDITION DEFINITION --------------------------% % -% Euler wall boundary marker(s) (NONE = no marker) -MARKER_EULER= ( NONE ) -% -% Navier-Stokes (no-slip), constant heat flux wall marker(s) (NONE = no marker) -% Format: ( marker name, constant heat flux (J/m^2), ... ) -%MARKER_HEATFLUX= ( plate, 1000.0 ) -% % Navier-Stokes (no-slip), isothermal wall marker(s) (NONE = no marker) % Format: ( marker name, constant wall temperature (K), ... ) MARKER_ISOTHERMAL= ( plate, 293 ) @@ -230,22 +124,6 @@ MARKER_PLOTTING = ( plate ) % Marker(s) of the surface where the non-dimensional coefficients are evaluated. MARKER_MONITORING = ( plate ) % -% Viscous wall markers for which wall functions must be applied. (NONE = no marker) -% Format: ( marker name, wall function type, ... ) -MARKER_WALL_FUNCTIONS= ( plate, NO_WALL_FUNCTION ) -% -% Marker(s) of the surface where custom thermal BC's are defined. -MARKER_PYTHON_CUSTOM = (NONE) -% -% Marker(s) of the surface where obj. func. (design problem) will be evaluated -MARKER_DESIGNING = ( NONE ) -% -% Marker(s) of the surface that is going to be analyzed in detail (massflow, average pressure, distortion, etc) -MARKER_ANALYZE = ( NONE ) -% -% Method to compute the average value in MARKER_ANALYZE (AREA, MASSFLUX). -MARKER_ANALYZE_AVERAGE = MASSFLUX - % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% % % Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) @@ -254,99 +132,16 @@ NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES % CFL number (initial value for the adaptive CFL number) CFL_NUMBER= 7.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.25, 50.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 ) -% -% Objective function in gradient evaluation (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, TOTAL_HEATFLUX, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, -% SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH) -% For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order. -OBJECTIVE_FUNCTION= DRAG -% -% List of weighting values when using more than one OBJECTIVE_FUNCTION. Separate by commas and match with MARKER_MONITORING. -OBJECTIVE_WEIGHT = 1.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 - % ----------- SLOPE LIMITER AND DISSIPATION SENSOR DEFINITION -----------------% % % 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= VENKATAKRISHNAN +MUSCL_FLOW= NO % % Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. % Required for 2nd order upwind schemes (NO, YES) MUSCL_TURB= NO % -% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, -% BARTH_JESPERSEN, VAN_ALBADA_EDGE) -SLOPE_LIMITER_TURB= VENKATAKRISHNAN -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, -% SHARP_EDGES, WALL_DISTANCE) -SLOPE_LIMITER_ADJFLOW= VENKATAKRISHNAN -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence adjoint equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJTURB= NO -% -% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE) -SLOPE_LIMITER_ADJTURB= VENKATAKRISHNAN -% -% Coefficient for the Venkat's limiter (upwind scheme). A larger values decrease -% the extent of limiting, values approaching zero cause -% lower-order approximation to the solution (0.05 by default) -VENKAT_LIMITER_COEFF= 0.05 -% -% Coefficient for the adjoint sharp edges limiter (3.0 by default). -ADJ_SHARP_LIMITER_COEFF= 3.0 -% -% Freeze the value of the limiter after a number of iterations -LIMITER_ITER= 999999 -% -% 1st order artificial dissipation coefficients for -% the Lax–Friedrichs method ( 0.15 by default ) -LAX_SENSOR_COEFF= 0.15 -% -% 2nd and 4th order artificial dissipation coefficients for -% the JST method ( 0.5, 0.02 by default ) -JST_SENSOR_COEFF= ( 0.5, 0.02 ) -% -% 1st order artificial dissipation coefficients for -% the adjoint Lax–Friedrichs method ( 0.15 by default ) -ADJ_LAX_SENSOR_COEFF= 0.15 -% -% 2nd, and 4th order artificial dissipation coefficients for -% the adjoint JST method ( 0.5, 0.02 by default ) -ADJ_JST_SENSOR_COEFF= ( 0.5, 0.02 ) - % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% % % Linear solver or smoother for implicit formulations (BCGSTAB, FGMRES, SMOOTHER) @@ -355,7 +150,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations @@ -367,26 +162,8 @@ LINEAR_SOLVER_ITER= 10 % -------------------------- MULTIGRID PARAMETERS -----------------------------% % % Multi-grid levels (0 = no multi-grid) -MGLEVEL= 3 -% -% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE) -MGCYCLE= W_CYCLE -% -% Multi-grid pre-smoothing level -MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) -% -% 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 ) +MGLEVEL= 0 % -% 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, @@ -397,8 +174,7 @@ CONV_NUM_METHOD_FLOW= JST % Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT % -% Relaxation coefficient - +% % -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% % % Convective numerical method (SCALAR_UPWIND) @@ -407,11 +183,6 @@ CONV_NUM_METHOD_TURB= SCALAR_UPWIND % Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT % -% Reduction factor of the CFL coefficient in the turbulence problem -CFL_REDUCTION_TURB= 1.0 -% -% Relaxation coefficient - % ------------------------ GRID DEFORMATION PARAMETERS ------------------------% % % Linear solver or smoother for implicit formulations (FGMRES, RESTARTED_FGMRES, BCGSTAB) @@ -432,38 +203,11 @@ DEFORM_CONSOLE_OUTPUT= YES % Minimum residual criteria for the linear solver convergence of grid deformation DEFORM_LINEAR_SOLVER_ERROR= 1E-14 % -% Deformation coefficient (linear elasticity limits from -1.0 to 0.5, a larger -% value is also possible) -DEFORM_COEFF = 1E6 % % Type of element stiffness imposed for FEA mesh deformation (INVERSE_VOLUME, % WALL_DISTANCE, CONSTANT_STIFFNESS) -DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME -% -% Deform the grid only close to the surface. It is possible to specify how much -% of the volumetric grid is going to be deformed in meters or inches (1E6 by default) -DEFORM_LIMIT = 1E6 - -% --------------------------- CONVERGENCE PARAMETERS --------------------------% -% Convergence criteria (CAUCHY, RESIDUAL) -% -CONV_CRITERIA= CAUCHY -% -% -% Min value of the residual (log10 of the residual) -CONV_RESIDUAL_MINVAL= -10 +DEFORM_STIFFNESS_TYPE= WALL_DISTANCE % -% Start convergence criteria at iteration number -CONV_STARTITER= 4 -% -% Number of elements to apply the criteria -CONV_CAUCHY_ELEMS= 10 -% -% Epsilon to control the series convergence -CONV_CAUCHY_EPS= 1E-6 -% -% - % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % % Mesh input file @@ -472,55 +216,23 @@ MESH_FILENAME= 2D_FlatPlate_Rounded.su2 % Mesh input file format (SU2, CGNS) MESH_FORMAT= SU2 % -% Mesh output file -MESH_OUT_FILENAME= mesh_out.su2 -% -% Restart flow input file -SOLUTION_FILENAME= restart_flow.dat -% -% Restart adjoint input file -SOLUTION_ADJ_FILENAME= solution_adj.dat % % Output file format (TECPLOT, TECPLOT_BINARY, PARAVIEW, % FIELDVIEW, FIELDVIEW_BINARY) -TABULAR_FORMAT= CSV +TABULAR_FORMAT= TECPLOT % % Output file convergence history (w/o extension) CONV_FILENAME= history % -% Output file with the forces breakdown -BREAKDOWN_FILENAME= forces_breakdown.dat -% -% Output file restart flow -RESTART_FILENAME= restart_flow.dat -% -% Output file restart adjoint -RESTART_ADJ_FILENAME= restart_adj.dat -% % Output file flow (w/o extension) variables VOLUME_FILENAME= flow % -% Output file adjoint (w/o extension) variables -VOLUME_ADJ_FILENAME= adjoint -% -% Output Objective function -VALUE_OBJFUNC_FILENAME= of_eval.dat -% -% Output objective function gradient (using continuous adjoint) -GRAD_OBJFUNC_FILENAME= of_grad.dat -% % Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow % -% Output file surface adjoint coefficient (w/o extension) -SURFACE_ADJ_FILENAME= surface_adjoint -% % Writing solution file frequency for physical time steps (dual time) OUTPUT_WRT_FREQ= 3 % -% -% Read binary restart files (YES, NO) -READ_BINARY_RESTART= YES -% % Screen output SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) +HISTORY_OUTPUT=(ITER,RMS_RES,AERO_COEFF) diff --git a/TestCases/py_wrapper/flatPlate_rigidMotion/launch_flatPlate_rigidMotion.py b/TestCases/py_wrapper/flatPlate_rigidMotion/launch_flatPlate_rigidMotion.py index 6c6a97a8f1f9..e2a1d13f326f 100755 --- a/TestCases/py_wrapper/flatPlate_rigidMotion/launch_flatPlate_rigidMotion.py +++ b/TestCases/py_wrapper/flatPlate_rigidMotion/launch_flatPlate_rigidMotion.py @@ -3,7 +3,7 @@ ## \file flatPlate_rigidMotion.py # \brief Python script to launch SU2_CFD with customized unsteady boundary conditions using the Python wrapper. # \author David Thomas -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society @@ -46,7 +46,7 @@ import numpy as np # ------------------------------------------------------------------- -# Main +# Main # ------------------------------------------------------------------- def main(): @@ -54,38 +54,12 @@ def main(): # Command line options parser=OptionParser() parser.add_option("-f", "--file", dest="filename", help="Read config from FILE", metavar="FILE") - parser.add_option("--nDim", dest="nDim", default=2, help="Define the number of DIMENSIONS", - metavar="DIMENSIONS") - parser.add_option("--nZone", dest="nZone", default=1, help="Define the number of ZONES", - metavar="ZONES") parser.add_option("--parallel", action="store_true", help="Specify if we need to initialize MPI", dest="with_MPI", default=False) - parser.add_option("--fsi", dest="fsi", default="False", help="Launch the FSI driver", metavar="FSI") - - parser.add_option("--fem", dest="fem", default="False", help="Launch the FEM driver (General driver)", metavar="FEM") - - parser.add_option("--harmonic_balance", dest="harmonic_balance", default="False", - help="Launch the Harmonic Balance (HB) driver", metavar="HB") - - parser.add_option("--poisson_equation", dest="poisson_equation", default="False", - help="Launch the poisson equation driver (General driver)", metavar="POIS_EQ") - - parser.add_option("--wave_equation", dest="wave_equation", default="False", - help="Launch the wave equation driver (General driver)", metavar="WAVE_EQ") - - parser.add_option("--heat_equation", dest="heat_equation", default="False", - help="Launch the heat equation driver (General driver)", metavar="HEAT_EQ") - (options, args) = parser.parse_args() - options.nDim = int( options.nDim ) - options.nZone = int( options.nZone ) - options.fsi = options.fsi.upper() == 'TRUE' - options.fem = options.fem.upper() == 'TRUE' - options.harmonic_balance = options.harmonic_balance.upper() == 'TRUE' - options.poisson_equation = options.poisson_equation.upper() == 'TRUE' - options.wave_equation = options.wave_equation.upper() == 'TRUE' - options.heat_equation = options.heat_equation.upper() == 'TRUE' + options.nDim = int(2) + options.nZone = int(1) # Import mpi4py for parallel run if options.with_MPI == True: @@ -98,13 +72,6 @@ def main(): # Initialize the corresponding driver of SU2, this includes solver preprocessing try: - if (options.nZone == 1) and ( options.fem or options.poisson_equation or options.wave_equation or options.heat_equation ): - SU2Driver = pysu2.CSinglezoneDriver(options.filename, options.nZone, comm); - elif options.harmonic_balance: - SU2Driver = pysu2.CHBDriver(options.filename, options.nZone, comm); - elif (options.nZone == 2) and (options.fsi): - SU2Driver = pysu2.CFSIDriver(options.filename, options.nZone, comm); - else: SU2Driver = pysu2.CSinglezoneDriver(options.filename, options.nZone, comm); except TypeError as exception: print('A TypeError occured in pysu2.CDriver : ',exception) @@ -119,7 +86,7 @@ def main(): MovingMarker = 'plate' #specified by the user # Get all the tags with the moving option - MovingMarkerList = SU2Driver.GetAllMovingMarkersTag() + MovingMarkerList = SU2Driver.GetAllDeformMeshMarkersTag() # Get all the markers defined on this rank and their associated indices. allMarkerIDs = SU2Driver.GetAllBoundaryMarkers() @@ -147,9 +114,9 @@ def main(): # Extract the initial position of each node on the moving marker CoordX = np.zeros(nVertex_MovingMarker) CoordY = np.zeros(nVertex_MovingMarker) + CoordZ = np.zeros(nVertex_MovingMarker) for iVertex in range(nVertex_MovingMarker): - CoordX[iVertex] = SU2Driver.GetVertexCoordX(MovingMarkerID, iVertex) - CoordY[iVertex] = SU2Driver.GetVertexCoordY(MovingMarkerID, iVertex) + CoordX[iVertex], CoordY[iVertex], CoordZ[iVertex] = SU2Driver.GetInitialMeshCoord(MovingMarkerID, iVertex) # Time loop is defined in Python so that we have acces to SU2 functionalities at each time step if rank == 0: @@ -162,16 +129,13 @@ def main(): # Define the rigid body displacement and set the new coords of each node on the marker d_y = 0.0175*sin(2*pi*time) for iVertex in range(nVertex_MovingMarker): - newCoordX = CoordX[iVertex] - newCoordY = CoordY[iVertex] + d_y - SU2Driver.SetVertexCoordX(MovingMarkerID, iVertex, newCoordX) - SU2Driver.SetVertexCoordY(MovingMarkerID, iVertex, newCoordY) - SU2Driver.SetVertexCoordZ(MovingMarkerID, iVertex, 0.0) - SU2Driver.SetVertexVarCoord(MovingMarkerID, iVertex) + SU2Driver.SetMeshDisplacement(MovingMarkerID, int(iVertex), 0.0, d_y, 0.0) # Time iteration preprocessing SU2Driver.Preprocess(TimeIter) # Run one time iteration (e.g. dual-time) SU2Driver.Run() + # Postprocess the solver + SU2Driver.Postprocess() # Update the solver for the next time iteration SU2Driver.Update() # Monitor the solver and output solution to file if required @@ -195,4 +159,4 @@ def main(): # this is only accessed if running from command prompt if __name__ == '__main__': - main() + main() diff --git a/TestCases/py_wrapper/flatPlate_unsteady_CHT/launch_unsteady_CHT_FlatPlate.py b/TestCases/py_wrapper/flatPlate_unsteady_CHT/launch_unsteady_CHT_FlatPlate.py index 1ed717dd6974..d58968b03228 100755 --- a/TestCases/py_wrapper/flatPlate_unsteady_CHT/launch_unsteady_CHT_FlatPlate.py +++ b/TestCases/py_wrapper/flatPlate_unsteady_CHT/launch_unsteady_CHT_FlatPlate.py @@ -3,7 +3,7 @@ ## \file launch_unsteady_CHT_FlatPlate.py # \brief Python script to launch SU2_CFD with customized unsteady boundary conditions using the Python wrapper. # \author David Thomas -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # The current SU2 release has been coordinated by the # SU2 International Developers Society @@ -45,7 +45,7 @@ from math import * # ------------------------------------------------------------------- -# Main +# Main # ------------------------------------------------------------------- def main(): @@ -53,38 +53,12 @@ def main(): # Command line options parser=OptionParser() parser.add_option("-f", "--file", dest="filename", help="Read config from FILE", metavar="FILE") - parser.add_option("--nDim", dest="nDim", default=2, help="Define the number of DIMENSIONS", - metavar="DIMENSIONS") - parser.add_option("--nZone", dest="nZone", default=1, help="Define the number of ZONES", - metavar="ZONES") parser.add_option("--parallel", action="store_true", help="Specify if we need to initialize MPI", dest="with_MPI", default=False) - parser.add_option("--fsi", dest="fsi", default="False", help="Launch the FSI driver", metavar="FSI") - - parser.add_option("--fem", dest="fem", default="False", help="Launch the FEM driver (General driver)", metavar="FEM") - - parser.add_option("--harmonic_balance", dest="harmonic_balance", default="False", - help="Launch the Harmonic Balance (HB) driver", metavar="HB") - - parser.add_option("--poisson_equation", dest="poisson_equation", default="False", - help="Launch the poisson equation driver (General driver)", metavar="POIS_EQ") - - parser.add_option("--wave_equation", dest="wave_equation", default="False", - help="Launch the wave equation driver (General driver)", metavar="WAVE_EQ") - - parser.add_option("--heat_equation", dest="heat_equation", default="False", - help="Launch the heat equation driver (General driver)", metavar="HEAT_EQ") - (options, args) = parser.parse_args() - options.nDim = int( options.nDim ) - options.nZone = int( options.nZone ) - options.fsi = options.fsi.upper() == 'TRUE' - options.fem = options.fem.upper() == 'TRUE' - options.harmonic_balance = options.harmonic_balance.upper() == 'TRUE' - options.poisson_equation = options.poisson_equation.upper() == 'TRUE' - options.wave_equation = options.wave_equation.upper() == 'TRUE' - options.heat_equation = options.heat_equation.upper() == 'TRUE' + options.nDim = int(2) + options.nZone = int(1) # Import mpi4py for parallel run if options.with_MPI == True: @@ -92,18 +66,11 @@ def main(): comm = MPI.COMM_WORLD rank = comm.Get_rank() else: - comm = 0 + comm = 0 rank = 0 # Initialize the corresponding driver of SU2, this includes solver preprocessing try: - if (options.nZone == 1) and ( options.fem or options.poisson_equation or options.wave_equation or options.heat_equation ): - SU2Driver = pysu2.CGeneralDriver(options.filename, options.nZone, comm); - elif options.harmonic_balance: - SU2Driver = pysu2.CHBDriver(options.filename, options.nZone, comm); - elif (options.nZone == 2) and (options.fsi): - SU2Driver = pysu2.CFSIDriver(options.filename, options.nZone, comm); - else: SU2Driver = pysu2.CSinglezoneDriver(options.filename, options.nZone, comm); except TypeError as exception: print('A TypeError occured in pysu2.CDriver : ',exception) @@ -162,6 +129,8 @@ def main(): SU2Driver.BoundaryConditionsUpdate() # Run one time iteration (e.g. dual-time) SU2Driver.Run() + # Postprocess the solver and exit cleanly + SU2Driver.Postprocess() # Update the solver for the next time iteration SU2Driver.Update() # Monitor the solver and output solution to file if required @@ -173,9 +142,6 @@ def main(): TimeIter += 1 time += deltaT - # Postprocess the solver and exit cleanly - SU2Driver.Postprocessing() - if SU2Driver != None: del SU2Driver @@ -185,4 +151,4 @@ def main(): # this is only accessed if running from command prompt if __name__ == '__main__': - main() + main() diff --git a/TestCases/py_wrapper/flatPlate_unsteady_CHT/unsteady_CHT_FlatPlate_Conf.cfg b/TestCases/py_wrapper/flatPlate_unsteady_CHT/unsteady_CHT_FlatPlate_Conf.cfg index 9454f923fbb8..c1781b361eaa 100644 --- a/TestCases/py_wrapper/flatPlate_unsteady_CHT/unsteady_CHT_FlatPlate_Conf.cfg +++ b/TestCases/py_wrapper/flatPlate_unsteady_CHT/unsteady_CHT_FlatPlate_Conf.cfg @@ -5,7 +5,7 @@ % Author: David THOMAS % % Institution: University of Liège % % Date: 12/12/2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -335,7 +335,7 @@ 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 preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations diff --git a/TestCases/radiation/p1adjoint/configp1adjoint.cfg b/TestCases/radiation/p1adjoint/configp1adjoint.cfg index 7dfb6926bfee..a544cb86437d 100644 --- a/TestCases/radiation/p1adjoint/configp1adjoint.cfg +++ b/TestCases/radiation/p1adjoint/configp1adjoint.cfg @@ -4,7 +4,7 @@ % Case description: Coupled CFD-RHT adjoint problem % % Author: Ruben Sanchez (TU Kaiserslautern) % % Date: 2020-02-13 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/radiation/p1model/configp1.cfg b/TestCases/radiation/p1model/configp1.cfg index 1388199e00d2..35cfe695db11 100644 --- a/TestCases/radiation/p1model/configp1.cfg +++ b/TestCases/radiation/p1model/configp1.cfg @@ -5,7 +5,7 @@ % Author: Ruben Sanchez % % Institution: Chair for Scientific Computing, TU Kaiserslautern % % Date: 2019-01-29 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -23,6 +23,7 @@ INC_DENSITY_MODEL= VARIABLE INC_ENERGY_EQUATION = YES INC_DENSITY_INIT= 0.00597782417156 INC_TEMPERATURE_INIT= 288.15 +INC_VELOCITY_INIT= (0, 0, 0) INC_NONDIM = DIMENSIONAL FLUID_MODEL= INC_IDEAL_GAS diff --git a/TestCases/rans/actuatordisk_variable_load/propeller_variable_load.cfg b/TestCases/rans/actuatordisk_variable_load/propeller_variable_load.cfg index 2c3097ba04b0..7e2c33b9873f 100644 --- a/TestCases/rans/actuatordisk_variable_load/propeller_variable_load.cfg +++ b/TestCases/rans/actuatordisk_variable_load/propeller_variable_load.cfg @@ -1,237 +1,237 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% SU2 configuration file % -% Case description: Actuator Disk with a semi-infinite spinner % -% Author: E. Saetta, L. Russo, R. Tognaccini % -% Institution: Theoretical and Applied Aerodynamic Research Group (TAARG) % -% University of Naples Federico II % -% Comments: Grid file and propeller data courtesy of Mauro Minervino, % -% Centro Italiano Ricerche Aerospaziali (CIRA) % -% Date: 07/08/2020 % -% File Version 7.1.0 "Blackbird" % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%----------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION -------------------------% -% Solver type (EULER, NAVIER_STOKES, RANS, -% INC_EULER, INC_NAVIER_STOKES, INC_RANS -% FEM_EULER, FEM_NAVIER_STOKES, FEM_RANS, FEM_LES, -% HEAT_EQUATION_FVM, ELASTICITY) -SOLVER= RANS -% -% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP, SST_SUST) -KIND_TURB_MODEL= SA -% -% Turbulence intensity at freestream -FREESTREAM_TURBULENCEINTENSITY=0.01 -% -% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) -MATH_PROBLEM= DIRECT -% -% Restart solution (NO, YES) -RESTART_SOL= NO -% -% System of measurements (SI, US) -% International system of units (SI): ( meters, kilograms, Kelvins, -% Newtons = kg m/s^2, Pascals = N/m^2, -% Density = kg/m^3, Speed = m/s, -% Equiv. Area = m^2 ) -SYSTEM_MEASUREMENTS= SI -% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% -% Mach number (non-dimensional, based on the free-stream values) -MACH_NUMBER= 0.55996 -% -% Angle of attack (degrees, only for compressible flows) -AOA= 0.0 -% -% Side-slip angle (degrees, only for compressible flows) -SIDESLIP_ANGLE= 0.0 -% -% Reynolds number (non-dimensional, based on the free-stream values) -REYNOLDS_NUMBER= 3.65E7 -% -% Reynolds length (1 m, 1 inch by default) -REYNOLDS_LENGTH= 5.0292 -% -% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% -% Reference origin for moment computation (m or in) -REF_ORIGIN_MOMENT_X = 0.0 -REF_ORIGIN_MOMENT_Y = 0.0 -REF_ORIGIN_MOMENT_Z = 0.0 -% -% Reference length for moment non-dimensional coefficients (m or in) -REF_LENGTH= 1.0 -% -% Reference area for non-dimensional force coefficients (0 implies automatic -% calculation) (m^2 or in^2) -REF_AREA= 19.8649 -% -% Compressible flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE, -% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE) -REF_DIMENSIONALIZATION= DIMENSIONAL -% -% --------------- ENGINE AND ACTUATOR DISK SIMULATION -------------------------% -% Highlite area to compute MFR (1 in by default) -HIGHLITE_AREA= 19.8649 -% -% Engine nu factor (SA model). -ENGINE_NU_FACTOR= 0.0 -% -% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -ACTDISK_DOUBLE_SURFACE = YES -% -% Actuator disk boundary type (VARIABLE_LOAD, VARIABLES_JUMP, BC_THRUST, -% DRAG_MINUS_THRUST) -ACTDISK_TYPE= VARIABLE_LOAD -% -% Actuator disk data input file name -ACTDISK_FILENAME= ActuatorDisk.dat -% -% Actuator disk boundary marker(s) with the following formats (NONE = no marker) -% Variable Load: (inlet face marker, outlet face marker, -% 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) Markers only effectively used. -MARKER_ACTDISK = ( DISK, DISK_BACK, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ) -% -% Far-field boundary marker(s) (NONE = no marker) -MARKER_FAR= ( FF ) -% -% Outlet boundary marker(s) (NONE = no marker) -% Compressible: ( outlet marker, back pressure (static thermodynamic), ... ) -MARKER_OUTLET = ( OUT , 56370.2) -% -% Navier-Stokes (no-slip), constant heat flux wall marker(s) (NONE = no marker) -% Format: ( marker name, constant heat flux (J/m^2), ... ) -MARKER_HEATFLUX = (SPINNER, 0.0) -% -% ------------------------ SURFACES IDENTIFICATION ----------------------------% -% Marker(s) of the surface in the surface flow solution file -MARKER_PLOTTING = ( DISK, DISK_BACK, SPINNER ) -% -% Marker(s) of the surface where the non-dimensional coefficients are evaluated. -MARKER_MONITORING = ( DISK, DISK_BACK, SPINNER ) -% -% Marker(s) of the surface that is going to be analyzed in detail (massflow, average pressure, distortion, etc) -MARKER_ANALYZE = ( DISK, DISK_BACK ) -% -% Method to compute the average value in MARKER_ANALYZE (AREA, MASSFLUX). -MARKER_ANALYZE_AVERAGE = MASSFLUX -% -% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) -NUM_METHOD_GRAD= GREEN_GAUSS -% -% CFL number (initial value for the adaptive CFL number) -CFL_NUMBER= 20.0 -% -% Adaptive CFL number (NO, YES) -CFL_ADAPT= NO -% -% Objective function in gradient evaluation (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, BUFFET, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, TOTAL_HEATFLUX, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, -% SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH) -% For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order. -OBJECTIVE_FUNCTION= DRAG -% -% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% -% Linear solver or smoother for implicit formulations: -% BCGSTAB, FGMRES, RESTARTED_FGMRES, CONJUGATE_GRADIENT (self-adjoint problems only), SMOOTHER. -LINEAR_SOLVER= FGMRES -% -% Preconditioner of the Krylov linear solver or type of smoother (ILU, LU_SGS, LINELET, JACOBI) -LINEAR_SOLVER_PREC= ILU -% -% 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= 3 -% -% Number of elements to apply the criteria -CONV_CAUCHY_ELEMS= 1000 -% -% Epsilon to control the series convergence -CONV_CAUCHY_EPS= 1E-10 -% -% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% -% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, AUSMPLUSUP, -% AUSMPLUSUP2, HLLC, TURKEL_PREC, MSW, FDS, SLAU, SLAU2) -CONV_NUM_METHOD_FLOW= JST -% -% 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 (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, -% BARTH_JESPERSEN, VAN_ALBADA_EDGE) -SLOPE_LIMITER_TURB= VENKATAKRISHNAN -% -% Time discretization (EULER_IMPLICIT) -TIME_DISCRE_TURB= EULER_IMPLICIT -% -% --------------------------- CONVERGENCE PARAMETERS --------------------------% -% Maximum number of iterations -ITER= 1500 -% -% Convergence criteria (CAUCHY, RESIDUAL) -CONV_CRITERIA= RESIDUAL -% -% Min value of the residual (log10 of the residual) -CONV_RESIDUAL_MINVAL= -8 -% -% Start convergence criteria at iteration number -CONV_STARTITER= 10 -% -% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% -% Mesh input file -MESH_FILENAME= propeller_variable_load.su2 -% -% Mesh input file format (SU2, CGNS) -MESH_FORMAT= SU2 -% -% Mesh output file -MESH_OUT_FILENAME= mesh_out.su2 -% -% Restart flow input file -SOLUTION_FILENAME= restart_flow.dat -% -% Output tabular file format (TECPLOT, CSV) -TABULAR_FORMAT= TECPLOT -% -% Output file convergence history (w/o extension) -CONV_FILENAME= history -% -% Write the forces breakdown file option (NO, YES) -WRT_FORCES_BREAKDOWN= YES -% -% Output file with the forces breakdown -BREAKDOWN_FILENAME= forces_breakdown.dat -% -% 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 -OUTPUT_WRT_FREQ= 250 -% -% -% -% -% Screen output fields -SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Actuator Disk with a semi-infinite spinner % +% Author: E. Saetta, L. Russo, R. Tognaccini % +% Institution: Theoretical and Applied Aerodynamic Research Group (TAARG) % +% University of Naples Federico II % +% Comments: Grid file and propeller data courtesy of Mauro Minervino, % +% Centro Italiano Ricerche Aerospaziali (CIRA) % +% Date: 07/08/2020 % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%----------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION -------------------------% +% Solver type (EULER, NAVIER_STOKES, RANS, +% INC_EULER, INC_NAVIER_STOKES, INC_RANS +% FEM_EULER, FEM_NAVIER_STOKES, FEM_RANS, FEM_LES, +% HEAT_EQUATION_FVM, ELASTICITY) +SOLVER= RANS +% +% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP, SST_SUST) +KIND_TURB_MODEL= SA +% +% Turbulence intensity at freestream +FREESTREAM_TURBULENCEINTENSITY=0.01 +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% +% System of measurements (SI, US) +% International system of units (SI): ( meters, kilograms, Kelvins, +% Newtons = kg m/s^2, Pascals = N/m^2, +% Density = kg/m^3, Speed = m/s, +% Equiv. Area = m^2 ) +SYSTEM_MEASUREMENTS= SI +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.55996 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 0.0 +% +% Side-slip angle (degrees, only for compressible flows) +SIDESLIP_ANGLE= 0.0 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 3.65E7 +% +% Reynolds length (1 m, 1 inch by default) +REYNOLDS_LENGTH= 5.0292 +% +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% Reference origin for moment computation (m or in) +REF_ORIGIN_MOMENT_X = 0.0 +REF_ORIGIN_MOMENT_Y = 0.0 +REF_ORIGIN_MOMENT_Z = 0.0 +% +% Reference length for moment non-dimensional coefficients (m or in) +REF_LENGTH= 1.0 +% +% Reference area for non-dimensional force coefficients (0 implies automatic +% calculation) (m^2 or in^2) +REF_AREA= 19.8649 +% +% Compressible flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE, +% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE) +REF_DIMENSIONALIZATION= DIMENSIONAL +% +% --------------- ENGINE AND ACTUATOR DISK SIMULATION -------------------------% +% Highlite area to compute MFR (1 in by default) +HIGHLITE_AREA= 19.8649 +% +% Engine nu factor (SA model). +ENGINE_NU_FACTOR= 0.0 +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +ACTDISK_DOUBLE_SURFACE = YES +% +% Actuator disk boundary type (VARIABLE_LOAD, VARIABLES_JUMP, BC_THRUST, +% DRAG_MINUS_THRUST) +ACTDISK_TYPE= VARIABLE_LOAD +% +% Actuator disk data input file name +ACTDISK_FILENAME= ActuatorDisk.dat +% +% Actuator disk boundary marker(s) with the following formats (NONE = no marker) +% Variable Load: (inlet face marker, outlet face marker, +% 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) Markers only effectively used. +MARKER_ACTDISK = ( DISK, DISK_BACK, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ) +% +% Far-field boundary marker(s) (NONE = no marker) +MARKER_FAR= ( FF ) +% +% Outlet boundary marker(s) (NONE = no marker) +% Compressible: ( outlet marker, back pressure (static thermodynamic), ... ) +MARKER_OUTLET = ( OUT , 56370.2) +% +% Navier-Stokes (no-slip), constant heat flux wall marker(s) (NONE = no marker) +% Format: ( marker name, constant heat flux (J/m^2), ... ) +MARKER_HEATFLUX = (SPINNER, 0.0) +% +% ------------------------ SURFACES IDENTIFICATION ----------------------------% +% Marker(s) of the surface in the surface flow solution file +MARKER_PLOTTING = ( DISK, DISK_BACK, SPINNER ) +% +% Marker(s) of the surface where the non-dimensional coefficients are evaluated. +MARKER_MONITORING = ( DISK, DISK_BACK, SPINNER ) +% +% Marker(s) of the surface that is going to be analyzed in detail (massflow, average pressure, distortion, etc) +MARKER_ANALYZE = ( DISK, DISK_BACK ) +% +% Method to compute the average value in MARKER_ANALYZE (AREA, MASSFLUX). +MARKER_ANALYZE_AVERAGE = MASSFLUX +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= GREEN_GAUSS +% +% CFL number (initial value for the adaptive CFL number) +CFL_NUMBER= 20.0 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Objective function in gradient evaluation (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, BUFFET, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, TOTAL_HEATFLUX, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, +% SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH) +% For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order. +OBJECTIVE_FUNCTION= DRAG +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% Linear solver or smoother for implicit formulations: +% BCGSTAB, FGMRES, RESTARTED_FGMRES, CONJUGATE_GRADIENT (self-adjoint problems only), SMOOTHER. +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver or type of smoother (ILU, LU_SGS, LINELET, JACOBI) +LINEAR_SOLVER_PREC= ILU +% +% 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= 3 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 1000 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-10 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, AUSMPLUSUP, +% AUSMPLUSUP2, HLLC, TURKEL_PREC, MSW, FDS, SLAU, SLAU2) +CONV_NUM_METHOD_FLOW= JST +% +% 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 (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, +% BARTH_JESPERSEN, VAN_ALBADA_EDGE) +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% Maximum number of iterations +ITER= 1500 +% +% Convergence criteria (CAUCHY, RESIDUAL) +CONV_CRITERIA= RESIDUAL +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% Mesh input file +MESH_FILENAME= propeller_variable_load.su2 +% +% Mesh input file format (SU2, CGNS) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= restart_flow.dat +% +% Output tabular file format (TECPLOT, CSV) +TABULAR_FORMAT= TECPLOT +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Write the forces breakdown file option (NO, YES) +WRT_FORCES_BREAKDOWN= YES +% +% Output file with the forces breakdown +BREAKDOWN_FILENAME= forces_breakdown.dat +% +% 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 +OUTPUT_WRT_FREQ= 250 +% +% +% +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) diff --git a/TestCases/rans/flatplate/turb_SA_flatplate.cfg b/TestCases/rans/flatplate/turb_SA_flatplate.cfg index 52762ef7167e..c2adda14f573 100644 --- a/TestCases/rans/flatplate/turb_SA_flatplate.cfg +++ b/TestCases/rans/flatplate/turb_SA_flatplate.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.10 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/flatplate/turb_SST_flatplate.cfg b/TestCases/rans/flatplate/turb_SST_flatplate.cfg index 6f38e571850a..77b8f8f61ccf 100644 --- a/TestCases/rans/flatplate/turb_SST_flatplate.cfg +++ b/TestCases/rans/flatplate/turb_SST_flatplate.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.10 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/naca0012/turb_NACA0012_sst_multigrid_restart.cfg b/TestCases/rans/naca0012/turb_NACA0012_sst_multigrid_restart.cfg index e11452f40596..71227c60c0e4 100644 --- a/TestCases/rans/naca0012/turb_NACA0012_sst_multigrid_restart.cfg +++ b/TestCases/rans/naca0012/turb_NACA0012_sst_multigrid_restart.cfg @@ -6,7 +6,7 @@ % Author: David E. Manosalvas % % Institution: Stanford University % % Date: 02.14.2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/oneram6/turb_ONERAM6.cfg b/TestCases/rans/oneram6/turb_ONERAM6.cfg index 046f93463e6c..e7229150f0ec 100644 --- a/TestCases/rans/oneram6/turb_ONERAM6.cfg +++ b/TestCases/rans/oneram6/turb_ONERAM6.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2014.06.14 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/oneram6/turb_ONERAM6_nk.cfg b/TestCases/rans/oneram6/turb_ONERAM6_nk.cfg new file mode 100644 index 000000000000..63bea2013395 --- /dev/null +++ b/TestCases/rans/oneram6/turb_ONERAM6_nk.cfg @@ -0,0 +1,127 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Turbulent flow, ONERA M6, Newton-Krylov solver % +% File Version 7.1.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +SOLVER= RANS +KIND_TURB_MODEL= SA +MATH_PROBLEM= DIRECT +RESTART_SOL= NO + +% ------------------------- NEWTON-KRYLOV PARAMETERS --------------------------% +% +% --- Things that matter --- +NEWTON_KRYLOV= YES + +% Iterations and tolerance for the Krylov part, it is important not to +% "over solve", tolerance should be as high as possible. +LINEAR_SOLVER_ITER= 5 +LINEAR_SOLVER_ERROR= 0.25 + +% For "n0" iterations or "r0" residual reduction, the normal quasi-Newton iterations +% are used. Then, they become the preconditioner for the NK iterations with "np" linear +% iterations or "tp" tolerance, with "np"=0 the linear preconditioner (e.g. ILU) is +% used directly (this may be enough for unsteady). +% The tolerance for NK iterations is initially relaxed by factor "ft", and reaches +% LINEAR_SOLVER_ERROR after "rf" residual reduction (additional to "r0"). +% The Jacobian-free products are based on finite differences with step "e". +NEWTON_KRYLOV_IPARAM= (10, 3, 2) % n0, np, ft +NEWTON_KRYLOV_DPARAM= (1.0, 0.1, -6.0, 1e-5) % r0, tp, rf, e + +CFL_ADAPT= YES % it's needed +CFL_NUMBER= 10 +CFL_ADAPT_PARAM= ( 0.8, 1.1, 5, 1000 ) % no point using NK with low CFL values + +% It is important (more than usual) to have similar magnitude variables +REF_DIMENSIONALIZATION= FREESTREAM_VEL_EQ_MACH + +USE_VECTORIZATION= YES % compile the code for AVX and mixed precision or it will be slow! +TIME_DISCRE_FLOW= EULER_IMPLICIT % what else +LINEAR_SOLVER_PREC= ILU % or LU_SGS + +% --- Things that don't --- +MGLEVEL= 0 % NK replaces MG +LINEAR_SOLVER= FGMRES % It will be FGMRES regardless + +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +MACH_NUMBER= 0.8395 +AOA= 3.06 +SIDESLIP_ANGLE= 0.0 + +FREESTREAM_TEMPERATURE= 288.15 +REYNOLDS_NUMBER= 11.72E6 +REYNOLDS_LENGTH= 0.64607 + +% ---- IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------% +% +FLUID_MODEL= STANDARD_AIR +GAMMA_VALUE= 1.4 +GAS_CONSTANT= 287.058 +ACENTRIC_FACTOR= 0.035 + +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +VISCOSITY_MODEL= SUTHERLAND +MU_CONSTANT= 1.716E-5 +MU_REF= 1.716E-5 +MU_T_REF= 273.15 +SUTHERLAND_CONSTANT= 110.4 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 0.64607 +REF_AREA= 0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( WING, 0.0 ) +MARKER_FAR= ( FARFIELD ) +MARKER_SYM= ( SYMMETRY ) +MARKER_PLOTTING= ( WING ) +MARKER_MONITORING= ( WING ) + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= VAN_ALBADA_EDGE + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +TIME_DISCRE_TURB= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_CRITERIA= RESIDUAL +CONV_RESIDUAL_MINVAL= -11 +CONV_STARTITER= 10 +ITER= 2000 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= mesh_ONERAM6_turb_hexa_43008.su2 +MESH_FORMAT= SU2 +TABULAR_FORMAT= CSV +SOLUTION_FILENAME= solution.dat +RESTART_FILENAME= restart.dat +SOLUTION_ADJ_FILENAME= solution_adj.dat +RESTART_ADJ_FILENAME= restart_adj.dat +VOLUME_FILENAME= flow +VOLUME_ADJ_FILENAME= adjoint +SURFACE_FILENAME= surface_flow +SURFACE_ADJ_FILENAME= surface_adjoint +OUTPUT_FILES=(RESTART, PARAVIEW, SURFACE_PARAVIEW) +OUTPUT_WRT_FREQ= 10000 +SCREEN_OUTPUT = (INNER_ITER, WALL_TIME, RMS_DENSITY, RMS_ENERGY, RMS_NU_TILDE, LIFT, DRAG, LINSOL_ITER, LINSOL_RESIDUAL, AVG_CFL) +CONV_FILENAME= history + diff --git a/TestCases/rans/propeller/propeller.cfg b/TestCases/rans/propeller/propeller.cfg index 2ddb5835d796..99ee5a22d9ec 100644 --- a/TestCases/rans/propeller/propeller.cfg +++ b/TestCases/rans/propeller/propeller.cfg @@ -5,7 +5,7 @@ % Author: % % Institution: % % Date: % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/rae2822/turb_SA_RAE2822.cfg b/TestCases/rans/rae2822/turb_SA_RAE2822.cfg index e7cd0b9fe8cb..ce48b26de819 100644 --- a/TestCases/rans/rae2822/turb_SA_RAE2822.cfg +++ b/TestCases/rans/rae2822/turb_SA_RAE2822.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/rae2822/turb_SST_RAE2822.cfg b/TestCases/rans/rae2822/turb_SST_RAE2822.cfg index 6671d4163914..e0d4b5239f7c 100644 --- a/TestCases/rans/rae2822/turb_SST_RAE2822.cfg +++ b/TestCases/rans/rae2822/turb_SST_RAE2822.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/rae2822/turb_SST_SUST_RAE2822.cfg b/TestCases/rans/rae2822/turb_SST_SUST_RAE2822.cfg index 725d764efcc2..ccb93d4e65a8 100644 --- a/TestCases/rans/rae2822/turb_SST_SUST_RAE2822.cfg +++ b/TestCases/rans/rae2822/turb_SST_SUST_RAE2822.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/restart_directdiff_naca/naca0012.cfg b/TestCases/rans/restart_directdiff_naca/naca0012.cfg index e5a4bf5e851c..a6f7452d55c8 100644 --- a/TestCases/rans/restart_directdiff_naca/naca0012.cfg +++ b/TestCases/rans/restart_directdiff_naca/naca0012.cfg @@ -5,7 +5,7 @@ % Author: Steffen Schotthöfer % % Institution: TU Kaiserslautern % % Date: Mar 16, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/s809/trans_s809.cfg b/TestCases/rans/s809/trans_s809.cfg index 09efbc7ee426..3aabee6d8531 100644 --- a/TestCases/rans/s809/trans_s809.cfg +++ b/TestCases/rans/s809/trans_s809.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/s809/turb_S809.cfg b/TestCases/rans/s809/turb_S809.cfg index 1f01e8f6079b..6e4cbf0a0c16 100644 --- a/TestCases/rans/s809/turb_S809.cfg +++ b/TestCases/rans/s809/turb_S809.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios % % Institution: Stanford University % % Date: 5/15/2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rans/vki_turbine/turb_vki.cfg b/TestCases/rans/vki_turbine/turb_vki.cfg index f800446a4414..984f2abc149c 100644 --- a/TestCases/rans/vki_turbine/turb_vki.cfg +++ b/TestCases/rans/vki_turbine/turb_vki.cfg @@ -5,7 +5,7 @@ % Author: Francisco Palacios, Thomas D. Economon % % Institution: Stanford University % % Date: Feb 18th, 2013 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rotating/caradonna_tung/rot_caradonna_tung.cfg b/TestCases/rotating/caradonna_tung/rot_caradonna_tung.cfg index 9136aefef335..310939f2d5a4 100644 --- a/TestCases/rotating/caradonna_tung/rot_caradonna_tung.cfg +++ b/TestCases/rotating/caradonna_tung/rot_caradonna_tung.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2020.05.24 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/rotating/naca0012/rot_NACA0012.cfg b/TestCases/rotating/naca0012/rot_NACA0012.cfg index af4b128969a7..63f3c151f216 100644 --- a/TestCases/rotating/naca0012/rot_NACA0012.cfg +++ b/TestCases/rotating/naca0012/rot_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2020.06.06 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index 6604a107f87c..0b0a36e31b9d 100644 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -3,7 +3,7 @@ ## \file serial_regression.py # \brief Python script for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -86,8 +86,8 @@ def main(): viscwedge.timeout = 1600 viscwedge.new_output = True viscwedge.tol = 0.00001 - test_list.append(viscwedge) - + test_list.append(viscwedge) + ######################### ## Compressible Euler ### ######################### @@ -375,6 +375,21 @@ def main(): propeller.tol = 0.00001 test_list.append(propeller) + ####################################### + ### Axisymmetric Compressible RANS ### + ####################################### + + # Axisymmetric air nozzle (transonic) + axi_rans_air_nozzle = TestCase('axi_rans_air_nozzle') + axi_rans_air_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" + axi_rans_air_nozzle.cfg_file = "air_nozzle.cfg" + axi_rans_air_nozzle.test_iter = 10 + axi_rans_air_nozzle.test_vals = [ -12.093130, -6.619801, -8.806060, -2.393278] + axi_rans_air_nozzle.su2_exec = "SU2_CFD" + axi_rans_air_nozzle.timeout = 1600 + axi_rans_air_nozzle.tol = 0.0001 + test_list.append(axi_rans_air_nozzle) + ################################# ## Compressible RANS Restart ### ################################# @@ -469,7 +484,7 @@ def main(): inc_poly_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_poly_cylinder.cfg_file = "poly_cylinder.cfg" inc_poly_cylinder.test_iter = 20 - inc_poly_cylinder.test_vals = [-8.108218, -2.158606, 0.019142, 1.902461] #last 4 columns + inc_poly_cylinder.test_vals = [-8.106741, -2.160042, 0.019225, 1.902421] #last 4 columns inc_poly_cylinder.new_output = True inc_poly_cylinder.su2_exec = "SU2_CFD" inc_poly_cylinder.timeout = 1600 @@ -643,7 +658,7 @@ def main(): schubauer_klebanoff_transition.cfg_file = "transitional_BC_model_ConfigFile.cfg" schubauer_klebanoff_transition.test_iter = 10 schubauer_klebanoff_transition.new_output = True - schubauer_klebanoff_transition.test_vals = [-8.029786, -14.268310, 0.000053, 0.007986] #last 4 columns + schubauer_klebanoff_transition.test_vals = [-8.029786, -14.268417, 0.000053, 0.007986] #last 4 columns schubauer_klebanoff_transition.su2_exec = "SU2_CFD" schubauer_klebanoff_transition.timeout = 1600 schubauer_klebanoff_transition.tol = 0.00001 @@ -1058,7 +1073,7 @@ def main(): Jones_tc.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc.cfg_file = "Jones.cfg" Jones_tc.test_iter = 5 - Jones_tc.test_vals = [-5.280323, 0.379653, 72.211730, 1.277473] #last 4 columns + Jones_tc.test_vals = [-5.279937, 0.379653, 72.211730, 1.277472] #last 4 columns Jones_tc.su2_exec = "SU2_CFD" Jones_tc.new_output = False Jones_tc.timeout = 1600 @@ -1082,7 +1097,7 @@ def main(): axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D" axial_stage2D.cfg_file = "Axial_stage2D.cfg" axial_stage2D.test_iter = 20 - axial_stage2D.test_vals = [-1.933219, 5.379657, 73.357940, 0.925870] #last 4 columns + axial_stage2D.test_vals = [-1.933153, 5.379657, 73.357940, 0.925870] #last 4 columns axial_stage2D.su2_exec = "SU2_CFD" axial_stage2D.new_output = False axial_stage2D.timeout = 1600 @@ -1144,7 +1159,7 @@ def main(): channel_2D.cfg_dir = "sliding_interface/channel_2D" channel_2D.cfg_file = "channel_2D_WA.cfg" channel_2D.test_iter = 2 - channel_2D.test_vals = [2.000000, 0.000000, 0.397985, 0.352786, 0.405475] #last 4 columns + channel_2D.test_vals = [2.000000, 0.000000, 0.398017, 0.352786, 0.405475] #last 4 columns channel_2D.su2_exec = "SU2_CFD" channel_2D.timeout = 100 channel_2D.tol = 0.00001 @@ -1221,7 +1236,7 @@ def main(): slinc_steady.cfg_dir = "sliding_interface/incompressible_steady" slinc_steady.cfg_file = "config.cfg" slinc_steady.test_iter = 19 - slinc_steady.test_vals = [19.000000, -1.766116, -2.206522] #last 3 columns + slinc_steady.test_vals = [19.000000, -1.803326, -2.097400] #last 3 columns slinc_steady.su2_exec = "SU2_CFD" slinc_steady.timeout = 100 slinc_steady.tol = 0.00001 @@ -1511,6 +1526,19 @@ def main(): ### RUN SU2_DEF TESTS ### ###################################### + # intersection prevention + intersect_def = TestCase('intersectionprevention') + intersect_def.cfg_dir = "deformation/intersection_prevention" + intersect_def.cfg_file = "def_intersect.cfg" + intersect_def.test_iter = 10 + intersect_def.test_vals = [0.000112] #residual + intersect_def.su2_exec = "SU2_DEF" + intersect_def.timeout = 1600 + intersect_def.tol = 1e-04 + + pass_list.append(intersect_def.run_def()) + test_list.append(intersect_def) + # Inviscid NACA0012 (triangles) naca0012_def = TestCase('naca0012_def') naca0012_def.cfg_dir = "deformation/naca0012" @@ -1864,7 +1892,7 @@ def main(): pywrapper_rigidMotion.cfg_dir = "py_wrapper/flatPlate_rigidMotion" pywrapper_rigidMotion.cfg_file = "flatPlate_rigidMotion_Conf.cfg" pywrapper_rigidMotion.test_iter = 5 - pywrapper_rigidMotion.test_vals = [-1.614167, 2.242632, -0.037871, 0.173912] + pywrapper_rigidMotion.test_vals = [-1.551335, 2.295594, 0.350050, 0.093081] pywrapper_rigidMotion.su2_exec = "python launch_flatPlate_rigidMotion.py -f" pywrapper_rigidMotion.new_output = True pywrapper_rigidMotion.timeout = 1600 diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index b1081b1ab677..9f30bd552003 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -3,7 +3,7 @@ ## \file serial_regression.py # \brief Python script for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -125,7 +125,7 @@ def main(): discadj_incomp_cylinder.cfg_dir = "disc_adj_incomp_navierstokes/cylinder" discadj_incomp_cylinder.cfg_file = "heated_cylinder.cfg" discadj_incomp_cylinder.test_iter = 20 - discadj_incomp_cylinder.test_vals = [20.000000, -2.374306, -2.371564, 0.000000] #last 4 columns + discadj_incomp_cylinder.test_vals = [20.000000, -2.373367, -2.368305, 0.000000] #last 4 columns discadj_incomp_cylinder.su2_exec = "SU2_CFD_AD" discadj_incomp_cylinder.timeout = 1600 discadj_incomp_cylinder.tol = 0.00001 diff --git a/TestCases/sliding_interface/bars_SST_2D/bars.cfg b/TestCases/sliding_interface/bars_SST_2D/bars.cfg index 0a4e4874332f..71d771280982 100644 --- a/TestCases/sliding_interface/bars_SST_2D/bars.cfg +++ b/TestCases/sliding_interface/bars_SST_2D/bars.cfg @@ -5,7 +5,7 @@ % Author: A. Rubino % % Institution: Delft University of Technology % % Date: Feb 27th, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/sliding_interface/bars_SST_2D/zone_1.cfg b/TestCases/sliding_interface/bars_SST_2D/zone_1.cfg index 647ba376a171..1dd8d41836fb 100644 --- a/TestCases/sliding_interface/bars_SST_2D/zone_1.cfg +++ b/TestCases/sliding_interface/bars_SST_2D/zone_1.cfg @@ -5,7 +5,7 @@ % Author: A. Rubino % % Institution: Delft University of Technology % % Date: Feb 27th, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % diff --git a/TestCases/sliding_interface/bars_SST_2D/zone_2.cfg b/TestCases/sliding_interface/bars_SST_2D/zone_2.cfg index d98ec02e6645..d922c308466e 100644 --- a/TestCases/sliding_interface/bars_SST_2D/zone_2.cfg +++ b/TestCases/sliding_interface/bars_SST_2D/zone_2.cfg @@ -5,7 +5,7 @@ % Author: A. Rubino % % Institution: Delft University of Technology % % Date: Feb 27th, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/sliding_interface/bars_SST_2D/zone_3.cfg b/TestCases/sliding_interface/bars_SST_2D/zone_3.cfg index b6e9674d74a3..a3ed15dbebc4 100644 --- a/TestCases/sliding_interface/bars_SST_2D/zone_3.cfg +++ b/TestCases/sliding_interface/bars_SST_2D/zone_3.cfg @@ -5,7 +5,7 @@ % Author: A. Rubino % % Institution: Delft University of Technology % % Date: Feb 27th, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % diff --git a/TestCases/sliding_interface/channel_2D/zone_2.cfg b/TestCases/sliding_interface/channel_2D/zone_2.cfg index 301abf1e2057..fcc887a5cdc4 100644 --- a/TestCases/sliding_interface/channel_2D/zone_2.cfg +++ b/TestCases/sliding_interface/channel_2D/zone_2.cfg @@ -5,7 +5,7 @@ % Author: A. Rubino % % Institution: Delft University of Technology % % Date: Feb 27th, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/sliding_interface/channel_2D/zone_3.cfg b/TestCases/sliding_interface/channel_2D/zone_3.cfg index b6e9674d74a3..a3ed15dbebc4 100644 --- a/TestCases/sliding_interface/channel_2D/zone_3.cfg +++ b/TestCases/sliding_interface/channel_2D/zone_3.cfg @@ -5,7 +5,7 @@ % Author: A. Rubino % % Institution: Delft University of Technology % % Date: Feb 27th, 2017 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % diff --git a/TestCases/transition/E387_Airfoil/transitional_BC_model_ConfigFile.cfg b/TestCases/transition/E387_Airfoil/transitional_BC_model_ConfigFile.cfg index 1a445f2156b4..792b3faa62a2 100644 --- a/TestCases/transition/E387_Airfoil/transitional_BC_model_ConfigFile.cfg +++ b/TestCases/transition/E387_Airfoil/transitional_BC_model_ConfigFile.cfg @@ -6,7 +6,7 @@ % Institution: TOBB University of Economics and Technology % % TAI-TUSAS Turkish Aerospace Industries % % Date: Oct 10th, 2016 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/transition/Schubauer_Klebanoff/transitional_BC_model_ConfigFile.cfg b/TestCases/transition/Schubauer_Klebanoff/transitional_BC_model_ConfigFile.cfg index c4f25979729a..9d32610dae14 100644 --- a/TestCases/transition/Schubauer_Klebanoff/transitional_BC_model_ConfigFile.cfg +++ b/TestCases/transition/Schubauer_Klebanoff/transitional_BC_model_ConfigFile.cfg @@ -6,7 +6,7 @@ % Institution: TOBB University of Economics and Technology % % TAI-TUSAS Turkish Aerospace Industries % % Date: Oct 10th, 2016 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/transition/T3A_FlatPlate/transitional_BC_model_ConfigFile.cfg b/TestCases/transition/T3A_FlatPlate/transitional_BC_model_ConfigFile.cfg index 34149021cc26..bc262ad41387 100644 --- a/TestCases/transition/T3A_FlatPlate/transitional_BC_model_ConfigFile.cfg +++ b/TestCases/transition/T3A_FlatPlate/transitional_BC_model_ConfigFile.cfg @@ -6,7 +6,7 @@ % Institution: TOBB University of Economics and Technology % % TAI-TUSAS Turkish Aerospace Industries % % Date: Oct 10th, 2016 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg b/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg index e33415dc7eca..caa0b59ec86d 100755 --- a/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg +++ b/TestCases/turbomachinery/centrifugal_blade/centrifugal_blade.cfg @@ -157,15 +157,6 @@ MARKER_PLOTTING= ( wall1, wall2 ) MARKER_TURBO_PERFORMANCE= (inflow, outflow, BLADE) % % -% -% ------------------------- GRID ADAPTATION STRATEGY --------------------------% -% -% Kind of grid adaptation (NONE, PERIODIC) -KIND_ADAPT= PERIODIC -% -% -% -% % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% % % Dynamic mesh simulation (NO, YES) diff --git a/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg b/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg index 40d7b49f8a36..bb572ed5c13c 100755 --- a/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg +++ b/TestCases/turbomachinery/centrifugal_stage/centrifugal_stage.cfg @@ -163,16 +163,6 @@ MARKER_MONITORING= ( wall1, wall2 ) MARKER_TURBO_PERFORMANCE= (inflow, outflow, STAGE, inflow, outmix, BLADE, inmix, outflow, BLADE) % % -% -% -% ------------------------- GRID ADAPTATION STRATEGY --------------------------% -% -% Kind of grid adaptation (NONE, PERIODIC) -KIND_ADAPT= PERIODIC -% -% -% -% % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% % % Dynamic mesh simulation (NO, YES) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index dbb4d8526761..5295588f255f 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -3,11 +3,11 @@ ## \file parallel_regression.py # \brief Python script for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io -# -# The SU2 Project is maintained by the SU2 Foundation +# +# The SU2 Project is maintained by the SU2 Foundation # (http://su2foundation.org) # # Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) @@ -16,7 +16,7 @@ # 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 @@ -29,21 +29,45 @@ from __future__ import print_function import sys -from TestCase import TestCase +from TestCase import TestCase def main(): - '''This program runs SU2 and ensures that the output matches specified values. - This will be used to do checks when code is pushed to github + '''This program runs SU2 and ensures that the output matches specified values. + This will be used to do checks when code is pushed to github to make sure nothing is broken. ''' test_list = [] - + ###################################### ### RUN TUTORIAL CASES ### ###################################### - + + ### Incompressible Flow + + # 2D pin case massflow periodic with heatflux BC and prescribed extracted outlet heat + sp_pinArray_2d_mf_hf = TestCase('sp_pinArray_2d_mf_hf') + sp_pinArray_2d_mf_hf.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" + sp_pinArray_2d_mf_hf.cfg_file = "sp_pinArray_2d_mf_hf.cfg" + sp_pinArray_2d_mf_hf.test_iter = 25 + sp_pinArray_2d_mf_hf.test_vals = [-4.600340, 1.470386, -0.778623, 266.569743] #last 4 lines + sp_pinArray_2d_mf_hf.su2_exec = "mpirun -n 2 SU2_CFD" + sp_pinArray_2d_mf_hf.timeout = 1600 + sp_pinArray_2d_mf_hf.tol = 0.00001 + test_list.append(sp_pinArray_2d_mf_hf) + + # 2D pin case pressure drop periodic with heatflux BC and temperature periodicity + sp_pinArray_2d_dp_hf_tp = TestCase('sp_pinArray_2d_dp_hf_tp') + sp_pinArray_2d_dp_hf_tp.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic" + sp_pinArray_2d_dp_hf_tp.cfg_file = "sp_pinArray_2d_dp_hf_tp.cfg" + sp_pinArray_2d_dp_hf_tp.test_iter = 25 + sp_pinArray_2d_dp_hf_tp.test_vals = [-4.667133, 1.395801, -0.709306, 208.023676] #last 4 lines + sp_pinArray_2d_dp_hf_tp.su2_exec = "mpirun -n 2 SU2_CFD" + sp_pinArray_2d_dp_hf_tp.timeout = 1600 + sp_pinArray_2d_dp_hf_tp.tol = 0.00001 + test_list.append(sp_pinArray_2d_dp_hf_tp) + ### Compressible Flow - + # Inviscid Bump tutorial_inv_bump = TestCase('inviscid_bump_tutorial') tutorial_inv_bump.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Bump" @@ -55,7 +79,7 @@ def main(): tutorial_inv_bump.tol = 0.00001 tutorial_inv_bump.no_restart = True test_list.append(tutorial_inv_bump) - + # Inviscid Wedge tutorial_inv_wedge = TestCase('inviscid_wedge_tutorial') tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge" @@ -67,7 +91,7 @@ def main(): tutorial_inv_wedge.tol = 0.00001 tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) - + # Inviscid ONERA M6 tutorial_inv_onera = TestCase('inviscid_onera_tutorial') tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6" @@ -79,7 +103,7 @@ def main(): tutorial_inv_onera.tol = 0.00001 tutorial_inv_onera.no_restart = True test_list.append(tutorial_inv_onera) - + # Laminar Cylinder tutorial_lam_cylinder = TestCase('laminar_cylinder_tutorial') tutorial_lam_cylinder.cfg_dir = "../Tutorials/compressible_flow/Laminar_Cylinder" @@ -103,7 +127,7 @@ def main(): tutorial_lam_flatplate.tol = 0.00001 tutorial_lam_flatplate.no_restart = True test_list.append(tutorial_lam_flatplate) - + # Turbulent Flat Plate tutorial_turb_flatplate = TestCase('turbulent_flatplate_tutorial') tutorial_turb_flatplate.cfg_dir = "../Tutorials/compressible_flow/Turbulent_Flat_Plate" @@ -115,7 +139,7 @@ def main(): tutorial_turb_flatplate.tol = 0.00001 tutorial_turb_flatplate.no_restart = True test_list.append(tutorial_turb_flatplate) - + # Transitional FlatPlate tutorial_trans_flatplate = TestCase('transitional_flatplate_tutorial') tutorial_trans_flatplate.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate" @@ -150,7 +174,6 @@ def main(): tutorial_nicfd_nozzle.tol = 0.00001 tutorial_nicfd_nozzle.no_restart = True test_list.append(tutorial_nicfd_nozzle) - # Unsteady NACA0012 tutorial_unst_naca0012 = TestCase('unsteady_naca0012') @@ -163,7 +186,7 @@ def main(): tutorial_unst_naca0012.tol = 0.00001 tutorial_unst_naca0012.unsteady = True test_list.append(tutorial_unst_naca0012) - + # PROPELLER VARIBLE LOAD propeller_var_load = TestCase('propeller_variable_load') propeller_var_load.cfg_dir = "../Tutorials/compressible_flow/ActuatorDisk_VariableLoad" @@ -176,7 +199,7 @@ def main(): test_list.append(propeller_var_load) ### Design - + # Inviscid NACA 0012 Design tutorial_design_inv_naca0012 = TestCase('design_inv_naca0012') tutorial_design_inv_naca0012.cfg_dir = "../Tutorials/design/Inviscid_2D_Unconstrained_NACA0012" @@ -216,7 +239,7 @@ def main(): ###################################### ### RUN TESTS ### ###################################### - + pass_list = [ test.run_test() for test in test_list ] # Tests summary diff --git a/TestCases/unsteady/pitching_naca64a010_euler/pitching_NACA64A010.cfg b/TestCases/unsteady/pitching_naca64a010_euler/pitching_NACA64A010.cfg index 1bc72884c2e0..0bb4beb22982 100644 --- a/TestCases/unsteady/pitching_naca64a010_euler/pitching_NACA64A010.cfg +++ b/TestCases/unsteady/pitching_naca64a010_euler/pitching_NACA64A010.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/unsteady/pitching_naca64a010_rans/turb_NACA64A010.cfg b/TestCases/unsteady/pitching_naca64a010_rans/turb_NACA64A010.cfg index 8fa7c6affaee..7c74ee76c386 100644 --- a/TestCases/unsteady/pitching_naca64a010_rans/turb_NACA64A010.cfg +++ b/TestCases/unsteady/pitching_naca64a010_rans/turb_NACA64A010.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2011.11.02 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/unsteady/plunging_naca0012/plunging_NACA0012.cfg b/TestCases/unsteady/plunging_naca0012/plunging_NACA0012.cfg index 1eb4b09ae3e7..8470bf0cb4cc 100644 --- a/TestCases/unsteady/plunging_naca0012/plunging_NACA0012.cfg +++ b/TestCases/unsteady/plunging_naca0012/plunging_NACA0012.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: Jun 12, 2014 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/TestCases/unsteady/square_cylinder/turb_square.cfg b/TestCases/unsteady/square_cylinder/turb_square.cfg index ce0cd4f7fa92..ca0b55cfe7c7 100644 --- a/TestCases/unsteady/square_cylinder/turb_square.cfg +++ b/TestCases/unsteady/square_cylinder/turb_square.cfg @@ -5,7 +5,7 @@ % Author: Thomas D. Economon % % Institution: Stanford University % % Date: 2013.02.25 % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/UnitTests/Common/geometry/CGeometry_test.cpp b/UnitTests/Common/geometry/CGeometry_test.cpp index 920c50e50036..3767f56a37c5 100644 --- a/UnitTests/Common/geometry/CGeometry_test.cpp +++ b/UnitTests/Common/geometry/CGeometry_test.cpp @@ -2,7 +2,7 @@ * \file CGeometry_tests.cpp * \brief Unit tests for CGeometry. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp b/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp index fa4003f5f822..e718b49674a4 100644 --- a/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp +++ b/UnitTests/Common/geometry/dual_grid/CDualGrid_tests.cpp @@ -2,7 +2,7 @@ * \file CDualGrid_tests.cpp * \brief Unit tests for the dual grid classes * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/Common/geometry/primal_grid/CPrimalGrid_tests.cpp b/UnitTests/Common/geometry/primal_grid/CPrimalGrid_tests.cpp index f840f8ecf9d3..b7ef26c36e2d 100644 --- a/UnitTests/Common/geometry/primal_grid/CPrimalGrid_tests.cpp +++ b/UnitTests/Common/geometry/primal_grid/CPrimalGrid_tests.cpp @@ -2,7 +2,7 @@ * \file CPrimalGrid_tests.cpp * \brief Unit tests for the primal grid classes * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/Common/simple_ad_test.cpp b/UnitTests/Common/simple_ad_test.cpp index 9e253cb3af85..0282b40cfbe8 100644 --- a/UnitTests/Common/simple_ad_test.cpp +++ b/UnitTests/Common/simple_ad_test.cpp @@ -4,7 +4,7 @@ * basic functionality, this also serves as a regression test * to make sure that AD works within unit testing. * \author C. Pederson - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/Common/simple_directdiff_test.cpp b/UnitTests/Common/simple_directdiff_test.cpp index 91893e894e63..086616b9cbd3 100644 --- a/UnitTests/Common/simple_directdiff_test.cpp +++ b/UnitTests/Common/simple_directdiff_test.cpp @@ -4,7 +4,7 @@ * basic functionality, this also serves as a regression test * to make sure that DD works within unit testing. * \author C. Pederson - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/Common/toolboxes/CQuasiNewtonInvLeastSquares_tests.cpp b/UnitTests/Common/toolboxes/CQuasiNewtonInvLeastSquares_tests.cpp index d33d31a59a30..82f6d4063e03 100644 --- a/UnitTests/Common/toolboxes/CQuasiNewtonInvLeastSquares_tests.cpp +++ b/UnitTests/Common/toolboxes/CQuasiNewtonInvLeastSquares_tests.cpp @@ -3,7 +3,7 @@ * \brief Unit tests for the CQuasiNewtonInvLeastSquares class. * Which should find the root of a n-d linear problem in n+1 iterations. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/Common/vectorization.cpp b/UnitTests/Common/vectorization.cpp index 9c4a3551da55..44972b043970 100644 --- a/UnitTests/Common/vectorization.cpp +++ b/UnitTests/Common/vectorization.cpp @@ -2,7 +2,7 @@ * \file vectorization.cpp * \brief Unit tests for the SIMD type and associated expression templates. * \author P. Gomes - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/SU2_CFD/gradients.cpp b/UnitTests/SU2_CFD/gradients.cpp index cc6b342d1fca..7757b14e1dfb 100644 --- a/UnitTests/SU2_CFD/gradients.cpp +++ b/UnitTests/SU2_CFD/gradients.cpp @@ -2,7 +2,7 @@ * \file gradients.cpp * \brief Unit tests for gradient calculation. * \author P. Gomes, T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp b/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp index 5e4e313dcd7d..e92062f8ba46 100644 --- a/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp +++ b/UnitTests/SU2_CFD/numerics/CNumerics_tests.cpp @@ -2,7 +2,7 @@ * \file CNumerics_tests.cpp * \brief Unit tests for the numerics classes. * \author C. Pederson - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * @@ -39,8 +39,6 @@ TEST_CASE("NTS blending has a minimum of 0.05", "[Upwind/central blending]") { /*--- Setup ---*/ - const unsigned short nDim = 3; - CConfig* config = new CConfig(config_options, SU2_CFD, false); const su2double dissipation_i = 0; diff --git a/UnitTests/UnitQuadTestCase.hpp b/UnitTests/UnitQuadTestCase.hpp index 513e5ed31c1c..d9e24cd5d2fa 100644 --- a/UnitTests/UnitQuadTestCase.hpp +++ b/UnitTests/UnitQuadTestCase.hpp @@ -2,7 +2,7 @@ * \file UnitQuadTestCase.hpp * \brief Simple unit quad test to be used in unit tests. * \author T. Albring - * \version 7.1.0 "Blackbird" + * \version 7.1.1 "Blackbird" * * SU2 Project Website: https://su2code.github.io * diff --git a/UnitTests/test_driver.cpp b/UnitTests/test_driver.cpp index d53ef2b9063d..bdf8d6c33c2e 100644 --- a/UnitTests/test_driver.cpp +++ b/UnitTests/test_driver.cpp @@ -37,13 +37,12 @@ int main(int argc, char *argv[]) { /*--- Startup MPI, if supported ---*/ -#ifdef HAVE_OMP +#if defined(HAVE_OMP) && defined(HAVE_MPI) int provided; SU2_MPI::Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided); #else SU2_MPI::Init(&argc, &argv); #endif - SU2_Comm MPICommunicator(MPI_COMM_WORLD); /*--- Run the test driver supplied by Catch ---*/ int result = Catch::Session().run(argc, argv); diff --git a/config_template.cfg b/config_template.cfg index bcb6f59b9674..949004c7d4e6 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -5,7 +5,7 @@ % Author: ___________________________________________________________________ % % Institution: ______________________________________________________________ % % Date: __________ % -% File Version 7.1.0 "Blackbird" % +% File Version 7.1.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -53,11 +53,11 @@ DISCARD_INFILES= NO % % System of measurements (SI, US) % International system of units (SI): ( meters, kilograms, Kelvins, -% Newtons = kg m/s^2, Pascals = N/m^2, +% Newtons = kg m/s^2, Pascals = N/m^2, % Density = kg/m^3, Speed = m/s, % Equiv. Area = m^2 ) -% United States customary units (US): ( inches, slug, Rankines, lbf = slug ft/s^2, -% psf = lbf/ft^2, Density = slug/ft^3, +% United States customary units (US): ( inches, slug, Rankines, lbf = slug ft/s^2, +% psf = lbf/ft^2, Density = slug/ft^3, % Speed = ft/s, Equiv. Area = ft^2 ) SYSTEM_MEASUREMENTS= SI % @@ -79,7 +79,7 @@ OUTER_ITER= 1 % Maximum number of time iterations TIME_ITER= 1 % -% Convergence field +% Convergence field CONV_FIELD= DRAG % % Min value of the residual (log10 of the residual) @@ -100,7 +100,7 @@ RESTART_ITER= 0 %% Time convergence monitoring WINDOW_CAUCHY_CRIT = YES % -% List of time convergence fields +% List of time convergence fields CONV_WINDOW_FIELD = (TAVG_DRAG, TAVG_LIFT) % % Time Convergence Monitoring starts at Iteration WINDOW_START_ITER + CONV_WINDOW_STARTITER @@ -135,7 +135,7 @@ UNST_CFL_NUMBER= 0.0 % Time iteration to start the windowed time average in a direct run WINDOW_START_ITER = 500 % -% Window used for reverse sweep and direct run. Options (SQUARE, HANN, HANN_SQUARE, BUMP) Square is default. +% Window used for reverse sweep and direct run. Options (SQUARE, HANN, HANN_SQUARE, BUMP) Square is default. WINDOW_FUNCTION = SQUARE % % ------------------------------- DES Parameters ------------------------------% @@ -216,8 +216,8 @@ INC_DENSITY_INIT= 1.2886 % Initial velocity for incompressible flows (1.0,0,0 m/s by default) INC_VELOCITY_INIT= ( 1.0, 0.0, 0.0 ) % -% Initial temperature for incompressible flows that include the -% energy equation (288.15 K by default). Value is ignored if +% 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= 288.15 % @@ -232,7 +232,7 @@ 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 +% Reference temperature for incompressible flows that include the % energy equation (1.0 K by default) INC_TEMPERATURE_REF = 1.0 % @@ -321,11 +321,11 @@ CRITICAL_PRESSURE= 3588550.0 % Acentri factor (0.035 (air)) ACENTRIC_FACTOR= 0.035 % -% Specific heat at constant pressure, Cp (1004.703 J/kg*K (air)). +% Specific heat at constant pressure, Cp (1004.703 J/kg*K (air)). % Incompressible fluids with energy eqn. (CONSTANT_DENSITY, INC_IDEAL_GAS) and the heat equation. SPECIFIC_HEAT_CP= 1004.703 % -% Thermal expansion coefficient (0.00347 K^-1 (air)) +% Thermal expansion coefficient (0.00347 K^-1 (air)) % Used with Boussinesq approx. (incompressible, BOUSSINESQ density model only) THERMAL_EXPANSION_COEFF= 0.00347 % @@ -370,7 +370,7 @@ MU_POLYCOEFFS= (0.0, 0.0, 0.0, 0.0, 0.0) % --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% % -% Laminar Conductivity model (CONSTANT_CONDUCTIVITY, CONSTANT_PRANDTL, +% Laminar Conductivity model (CONSTANT_CONDUCTIVITY, CONSTANT_PRANDTL, % POLYNOMIAL_CONDUCTIVITY). CONDUCTIVITY_MODEL= CONSTANT_PRANDTL % @@ -428,7 +428,7 @@ PLUNGING_OMEGA= 0.0 0.0 0.0 % Plunging amplitude (m or ft) in x, y, & z directions PLUNGING_AMPL= 0.0 0.0 0.0 % -% Type of dynamic surface movement (NONE, DEFORMING, +% Type of dynamic surface movement (NONE, DEFORMING, % MOVING_WALL, FLUID_STRUCTURE, FLUID_STRUCTURE_STATIC, % AEROELASTIC, EXTERNAL, EXTERNAL_ROTATION, % AEROELASTIC_RIGID_MOTION) @@ -470,7 +470,7 @@ MOVE_MOTION_ORIGIN = 0 % If BUFFET objective/constraint is specified, the objective is given by % the integrated sensor normalized by reference area % -% See doi: 10.2514/1.J055172 +% See doi: 10.2514/1.J055172 % % Evaluate buffet sensor on Navier-Stokes markers (NO, YES) BUFFET_MONITORING= NO @@ -687,6 +687,35 @@ BODY_FORCE= NO % Vector of body force values (BodyForce_X, BodyForce_Y, BodyForce_Z) BODY_FORCE_VECTOR= ( 0.0, 0.0, 0.0 ) +% --------------------- STREAMWISE PERIODICITY DEFINITION ---------------------% +% +% Generally for streamwise periodictiy one has to set MARKER_PERIODIC= (, , ...) +% appropriately as a boundary condition. +% +% Specify type of streamwise periodictiy (default=NONE, PRESSURE_DROP, MASSFLOW) +KIND_STREAMWISE_PERIODIC= NONE +% +% Delta P [Pa] value that drives the flow as a source term in the momentum equations. +% Defaults to 1.0. +STREAMWISE_PERIODIC_PRESSURE_DROP= 1.0 +% +% Target massflow [kg/s]. Necessary pressure drop is determined iteratively. +% Initial value is given via STREAMWISE_PERIODIC_PRESSURE_DROP. Default value 1.0. +% Use INC_OUTLET_DAMPING as a relaxation factor. Default value 0.1 is a good start. +STREAMWISE_PERIODIC_MASSFLOW= 0.0 +% +% Use streamwise periodic temperature (default=NO, YES) +% If NO, the heatflux is taken out at the outlet. +% This option is only necessary if INC_ENERGY_EQUATION=YES +STREAMWISE_PERIODIC_TEMPERATURE= NO +% +% Prescribe integrated heat [W] extracted at the periodic "outlet". +% Only active if STREAMWISE_PERIODIC_TEMPERATURE= NO. +% If set to zero, the heat is integrated automatically over all present MARKER_HEATFLUX. +% Upon convergence, the area averaged inlet temperature will be INC_TEMPERATURE_INIT. +% Defaults to 0.0. +STREAMWISE_PERIODIC_OUTLET_HEAT= 0.0 +% % -------------------- BOUNDARY CONDITION DEFINITION --------------------------% % % Euler wall boundary marker(s) (NONE = no marker) @@ -786,7 +815,7 @@ ENGINE_INFLOW_TYPE= FAN_FACE_MACH % Format: (engine inflow marker, fan face Mach, ... ) MARKER_ENGINE_INFLOW= ( NONE ) % -% Engine exhaust boundary marker(s) with the following formats (NONE = no marker) +% Engine exhaust boundary marker(s) with the following formats (NONE = no marker) % Format: (engine exhaust marker, total nozzle temp, total nozzle pressure, ... ) MARKER_ENGINE_EXHAUST= ( NONE ) % @@ -863,7 +892,7 @@ SPATIAL_FOURIER= NO CATALYTIC_WALL= ( NONE ) % ------------------------ WALL ROUGHNESS DEFINITION --------------------------% -% The equivalent sand grain roughness height (k_s) on each of the wall. This must be in m. +% The equivalent sand grain roughness height (k_s) on each of the wall. This must be in m. % This is a list of (string, double) each element corresponding to the MARKER defined in WALL_TYPE. WALL_ROUGHNESS = (wall1, ks1, wall2, ks2) %WALL_ROUGHNESS = (wall1, ks1, wall2, 0.0) %is also allowed @@ -901,7 +930,7 @@ NUM_METHOD_GRAD= GREEN_GAUSS % Numerical method for spatial gradients to be used for MUSCL reconstruction % Options are (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES, LEAST_SQUARES). Default value is -% NONE and the method specified in NUM_METHOD_GRAD is used. +% NONE and the method specified in NUM_METHOD_GRAD is used. NUM_METHOD_GRAD_RECON = LEAST_SQUARES % % CFL number (initial value for the adaptive CFL number) @@ -930,7 +959,7 @@ RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) % FORCE_X, FORCE_Y, FORCE_Z, THRUST, % TORQUE, TOTAL_HEATFLUX, % MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, +% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, % SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH) % For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order. OBJECTIVE_FUNCTION= DRAG @@ -1019,7 +1048,7 @@ LINEAR_SOLVER_PREC= ILU % Same for discrete adjoint (JACOBI or ILU), replaces LINEAR_SOLVER_PREC in SU2_*_AD codes. DISCADJ_LIN_PREC= ILU % -% Linael solver ILU preconditioner fill-in level (0 by default) +% Linear solver ILU preconditioner fill-in level (0 by default) LINEAR_SOLVER_ILU_FILL_IN= 0 % % Minimum error of the linear solver for implicit formulations @@ -1091,6 +1120,11 @@ CENTRAL_JACOBIAN_FIX_FACTOR= 4.0 % % Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% Use a Newton-Krylov method on the flow equations, see TestCases/rans/oneram6/turb_ONERAM6_nk.cfg +% For multizone discrete adjoint it will use FGMRES on inner iterations with restart frequency +% equal to "QUASI_NEWTON_NUM_SAMPLES". +NEWTON_KRYLOV= NO % ------------------- FEM FLOW NUMERICAL METHOD DEFINITION --------------------% % @@ -1256,7 +1290,7 @@ ADAPT_BOUNDARY= YES % Kind of deformation (NO_DEFORMATION, SCALE_GRID, TRANSLATE_GRID, ROTATE_GRID, % FFD_SETTING, FFD_NACELLE, % FFD_CONTROL_POINT, FFD_CAMBER, FFD_THICKNESS, FFD_TWIST -% FFD_CONTROL_POINT_2D, FFD_CAMBER_2D, FFD_THICKNESS_2D, +% FFD_CONTROL_POINT_2D, FFD_CAMBER_2D, FFD_THICKNESS_2D, % FFD_TWIST_2D, HICKS_HENNE, SURFACE_BUMP, SURFACE_FILE) DV_KIND= FFD_SETTING % @@ -1319,6 +1353,7 @@ DEFORM_MESH= YES % % Moving markers which deform the mesh MARKER_DEFORM_MESH = ( airfoil ) +MARKER_DEFORM_MESH_SYM_PLANE = ( wall ) % ------------------------ GRID DEFORMATION PARAMETERS ------------------------% % @@ -1477,14 +1512,14 @@ VOLUME_OUTPUT= (COORDINATES, SOLUTION, PRIMITIVE) SCREEN_WRT_FREQ_INNER= 1 % SCREEN_WRT_FREQ_OUTER= 1 -% +% SCREEN_WRT_FREQ_TIME= 1 % % Writing frequency for history output HISTORY_WRT_FREQ_INNER= 1 % HISTORY_WRT_FREQ_OUTER= 1 -% +% HISTORY_WRT_FREQ_TIME= 1 % % Writing frequency for volume/surface output @@ -1510,9 +1545,9 @@ SOLUTION_ADJ_FILENAME= solution_adj.dat % Output tabular file format (TECPLOT, CSV) TABULAR_FORMAT= TECPLOT % -% Files to output +% Files to output % Possible formats : (TECPLOT, TECPLOT_BINARY, SURFACE_TECPLOT, -% SURFACE_TECPLOT_BINARY, CSV, SURFACE_CSV, PARAVIEW, PARAVIEW_BINARY, SURFACE_PARAVIEW, +% SURFACE_TECPLOT_BINARY, CSV, SURFACE_CSV, PARAVIEW, PARAVIEW_BINARY, SURFACE_PARAVIEW, % SURFACE_PARAVIEW_BINARY, MESH, RESTART_BINARY, RESTART_ASCII, CGNS, STL) % default : (RESTART, PARAVIEW, SURFACE_PARAVIEW) OUTPUT_FILES= (RESTART, PARAVIEW, SURFACE_PARAVIEW) @@ -1556,7 +1591,7 @@ REORIENT_ELEMENTS= YES % --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% % % Available flow based objective functions or constraint functions -% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, +% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET, % FORCE_X, FORCE_Y, FORCE_Z, % MOMENT_X, MOMENT_Y, MOMENT_Z, % THRUST, TORQUE, FIGURE_OF_MERIT, diff --git a/configure.ac b/configure.ac index 3415d019da91..a0f5f1441a28 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # \file configure.ac # \brief Main file for configuring the autoconf/automake build process # \author M. Colonno, T. Economon, F. Palacios, B. Kirk -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/externals/Makefile.am b/externals/Makefile.am index 2adc6eb09adb..9a04f06dc254 100644 --- a/externals/Makefile.am +++ b/externals/Makefile.am @@ -3,7 +3,7 @@ # \file Makefile.am # \brief Makefile for external libraries # \author B. Kirk, T. Economon, F. Palacios -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/externals/cgns/meson.build b/externals/cgns/meson.build index 1f201e585749..e7bc68e38c09 100644 --- a/externals/cgns/meson.build +++ b/externals/cgns/meson.build @@ -1,7 +1,12 @@ if build_machine.system() == 'windows' or meson.get_compiler('cpp').get_id() == 'intel' cgns_default_warnings = [] else - cgns_default_warnings = ['-Wno-unused-result'] + cgns_default_warnings = ['-Wno-unused-result', + '-Wno-unused-parameter', + '-Wno-unused-variable', + '-Wno-unused-but-set-variable', + '-Wno-sign-compare', + '-Wno-pedantic'] endif cgns_include = include_directories('adf', './') diff --git a/externals/medi b/externals/medi index b84cef4272ab..6aef76912e70 160000 --- a/externals/medi +++ b/externals/medi @@ -1 +1 @@ -Subproject commit b84cef4272ab8bad981c0d0386d855daa8fbd340 +Subproject commit 6aef76912e7099c4f08c9705848797ca9e8070da diff --git a/externals/metis/meson.build b/externals/metis/meson.build index 905368c6bae8..067e863847c7 100644 --- a/externals/metis/meson.build +++ b/externals/metis/meson.build @@ -4,7 +4,19 @@ metis_default_warnings = [] if build_machine.system() != 'windows' metis_default_warnings += ['-Wno-implicit-function-declaration'] if meson.get_compiler('cpp').get_id() != 'intel' - metis_default_warnings += ['-Wno-unused-result', '-Wno-macro-redefined'] + metis_default_warnings += ['-Wno-unused-result', + '-Wno-unused-parameter', + '-Wno-unused-variable', + '-Wno-unused-but-set-variable', + '-Wno-macro-redefined', + '-Wno-unknown-pragmas', + '-Wno-sign-compare', + '-Wno-clobbered', + '-Wno-empty-body', + '-Wno-unused-label', + '-Wno-misleading-indentation', + '-Wno-maybe-uninitialized', + '-Wno-pedantic'] endif endif diff --git a/externals/parmetis/meson.build b/externals/parmetis/meson.build index 47a11c0891fc..51d3dbe4b426 100644 --- a/externals/parmetis/meson.build +++ b/externals/parmetis/meson.build @@ -41,6 +41,6 @@ parmetis = static_library('parmetis', 'libparmetis/match.c', 'libparmetis/mmetis.c', install : false, include_directories: parmetis_include, - dependencies: [mpi_dep, metis_dep], c_args: parmetis_c_args) + dependencies: [mpi_dep, metis_dep], c_args: parmetis_c_args + metis_default_warnings) parmetis_dep = declare_dependency(link_with: parmetis, include_directories: parmetis_include) diff --git a/externals/tecio/teciompisrc/meson.build b/externals/tecio/teciompisrc/meson.build index 427a7129dcda..383ea75fa6db 100644 --- a/externals/tecio/teciompisrc/meson.build +++ b/externals/tecio/teciompisrc/meson.build @@ -12,6 +12,15 @@ if (host_machine.system() == 'windows') tec_cxx_flags += ['-DMSWIN'] endif +if build_machine.system() != 'windows' + if meson.get_compiler('cpp').get_id() != 'intel' + tec_cxx_flags += ['-Wno-misleading-indentation', + '-Wno-uninitialized', + '-Wno-placement-new', + '-Wno-pedantic'] + endif +endif + teciompi_include = include_directories(['../', './']) diff --git a/externals/tecio/teciosrc/meson.build b/externals/tecio/teciosrc/meson.build index 4ef7481e156f..6c8fa088c215 100644 --- a/externals/tecio/teciosrc/meson.build +++ b/externals/tecio/teciosrc/meson.build @@ -12,6 +12,15 @@ if (host_machine.system() == 'windows') tecio_cpp_flags += ['-DMSWIN'] endif +if build_machine.system() != 'windows' + if meson.get_compiler('cpp').get_id() != 'intel' + tecio_cpp_flags += ['-Wno-misleading-indentation', + '-Wno-uninitialized', + '-Wno-placement-new', + '-Wno-pedantic'] + endif +endif + tecio_include = include_directories('../', './') tecio = static_library('tecio', 'ClassicZoneWriterAbstract.cpp', diff --git a/meson.build b/meson.build index 1dc70b6a41cb..d15905334d9d 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('SU2', 'c', 'cpp', - version: '7.1.0 "Blackbird"', + version: '7.1.1 "Blackbird"', license: 'LGPL2', default_options: ['buildtype=release', 'warning_level=0', @@ -18,9 +18,11 @@ if build_machine.system() != 'windows' default_warning_flags += ['-Wno-empty-body'] endif default_warning_flags += ['-Wno-unused-parameter', - '-Wno-format-security', - '-Wno-deprecated-declarations', - '-Wno-non-virtual-dtor'] + '-Wno-deprecated-declarations'] + + if get_option('enable-autodiff') or get_option('enable-directdiff') + default_warning_flags += ['-Wno-non-virtual-dtor'] + endif endif # meson script path @@ -196,7 +198,7 @@ endif message('''------------------------------------------------------------------------- | ___ _ _ ___ | - | / __| | | |_ ) Release 7.1.0 "Blackbird" | + | / __| | | |_ ) Release 7.1.1 "Blackbird" | | \__ \ |_| |/ / | | |___/\___//___| Meson Configuration Summary | | | @@ -236,4 +238,4 @@ if get_option('enable-mpp') export LD_LIBRARY_PATH=$SU2_HOME//subprojects/Mutationpp ''') -endif \ No newline at end of file +endif diff --git a/meson.py b/meson.py index 8bab2e16064e..282ab3531339 100755 --- a/meson.py +++ b/meson.py @@ -3,7 +3,7 @@ ## \file meson.py # \brief An extended meson script for setting up the environment and running meson # \author T. Albring -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # diff --git a/meson_scripts/init.py b/meson_scripts/init.py index d3395baec917..f0d477136542 100755 --- a/meson_scripts/init.py +++ b/meson_scripts/init.py @@ -4,7 +4,7 @@ # \brief Initializes necessary dependencies for SU2 either using git or it # fetches zip files. # \author T. Albring -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -46,14 +46,14 @@ def init_submodules(method = 'auto'): # The sha tag must be maintained manually to point to the correct commit sha_version_codi = '1b8d3f5f03de560fb63a2a76ad91ab7bb3fa67d8' github_repo_codi = 'https://github.com/scicompkl/CoDiPack' - sha_version_medi = 'b84cef4272ab8bad981c0d0386d855daa8fbd340' + sha_version_medi = '6aef76912e7099c4f08c9705848797ca9e8070da' github_repo_medi = 'https://github.com/SciCompKL/MeDiPack' sha_version_meson = '29ef4478df6d3aaca40c7993f125b29409be1de2' github_repo_meson = 'https://github.com/mesonbuild/meson' sha_version_ninja = '52649de2c56b63f42bc59513d51286531c595b44' github_repo_ninja = 'https://github.com/ninja-build/ninja' sha_version_mpp = '5ff579f43781cae07411e5ab46291c9971536be6' - github_repo_mpp = 'https://github.com/mutationpp/Mutationpp.git' + github_repo_mpp = 'https://github.com/mutationpp/Mutationpp' medi_name = 'MeDiPack' codi_name = 'CoDiPack' diff --git a/preconfigure.py b/preconfigure.py index c34638b6a2e0..4c0094bed584 100755 --- a/preconfigure.py +++ b/preconfigure.py @@ -3,7 +3,7 @@ ## \file configure.py # \brief An extended configuration script. # \author T. Albring -# \version 7.1.0 "Blackbird" +# \version 7.1.1 "Blackbird" # # SU2 Project Website: https://su2code.github.io # @@ -289,7 +289,7 @@ def init_codi(argument_dict, modes, mpi_support = False, update = False): # The sha tag must be maintained manually to point to the correct commit sha_version_codi = '1b8d3f5f03de560fb63a2a76ad91ab7bb3fa67d8' github_repo_codi = 'https://github.com/scicompkl/CoDiPack' - sha_version_medi = 'b84cef4272ab8bad981c0d0386d855daa8fbd340' + sha_version_medi = '6aef76912e7099c4f08c9705848797ca9e8070da' github_repo_medi = 'https://github.com/SciCompKL/MeDiPack' medi_name = 'MeDiPack'