diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index c477d884e6d..c8a9819435f 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -393,17 +393,14 @@ class CConfig { short *Marker_All_SendRecv; /*!< \brief Information about if the boundary is sended (+), received (-). */ short *Marker_All_PerBound; /*!< \brief Global index for periodic bc using the grid information. */ - unsigned long nExtIter; /*!< \brief Number of external iterations. */ unsigned long ExtIter; /*!< \brief Current external iteration number. */ unsigned long ExtIter_OffSet; /*!< \brief External iteration number offset. */ unsigned long IntIter; /*!< \brief Current internal iteration number. */ unsigned long OuterIter; /*!< \brief Current Outer iterations for multizone problems. */ unsigned long InnerIter; /*!< \brief Current inner iterations for multizone problems. */ unsigned long TimeIter; /*!< \brief Current time iterations for multizone problems. */ - long Unst_RestartIter; /*!< \brief Iteration number to restart an unsteady simulation (Dual time Method). */ long Unst_AdjointIter; /*!< \brief Iteration number to begin the reverse time integration in the direct solver for the unsteady adjoint. */ long Iter_Avg_Objective; /*!< \brief Iteration the number of time steps to be averaged, counting from the back */ - long Dyn_RestartIter; /*!< \brief Iteration number to restart a dynamic structural analysis. */ su2double PhysicalTime; /*!< \brief Physical time at the current iteration in the solver for unsteady problems. */ unsigned short nLevels_TimeAccurateLTS; /*!< \brief Number of time levels for time accurate local time stepping. */ @@ -8295,22 +8292,19 @@ class CConfig { void GEMMProfilingCSV(void); /*! - * * \brief Set freestream turbonormal for initializing solution. */ void SetFreeStreamTurboNormal(const su2double* turboNormal); /*! - * * \brief Set freestream turbonormal for initializing solution. */ const su2double* GetFreeStreamTurboNormal(void) const { return FreeStreamTurboNormal; } /*! - * * \brief Set multizone properties. */ - void SetMultizone(CConfig *driver_config, CConfig **config_container); + void SetMultizone(const CConfig *driver_config, const CConfig* const* config_container); /*! * \brief Get the verbosity level of the console output. diff --git a/Common/include/fem/fem_geometry_structure.hpp b/Common/include/fem/fem_geometry_structure.hpp index cd8f3251524..fb4787d645c 100644 --- a/Common/include/fem/fem_geometry_structure.hpp +++ b/Common/include/fem/fem_geometry_structure.hpp @@ -828,7 +828,7 @@ class CMeshFEM_DG: public CMeshFEM { * \param[in] Kind_Grid_Movement - The type of prescribed grid motion. * \param[in] iZone - The currently active zone number. */ - void InitStaticMeshMovement(CConfig *config, + void InitStaticMeshMovement(const CConfig *config, const unsigned short Kind_Grid_Movement, const unsigned short iZone); diff --git a/Common/include/geometry/CGeometry.hpp b/Common/include/geometry/CGeometry.hpp index 8b78e9b8445..cc8aa2867b2 100644 --- a/Common/include/geometry/CGeometry.hpp +++ b/Common/include/geometry/CGeometry.hpp @@ -886,34 +886,40 @@ class CGeometry { * \param[in] config - Definition of the particular problem. * \param[in] print - Display information on screen. */ - void SetRotationalVelocity(CConfig *config, bool print = false); + void SetRotationalVelocity(const CConfig *config, bool print = false); /*! * \brief Set the rotational velocity of the points on the shroud markers to 0. * \param[in] config - Definition of the particular problem. */ - void SetShroudVelocity(CConfig *config); + void SetShroudVelocity(const CConfig *config); /*! * \brief Set the translational velocity at each node. * \param[in] config - Definition of the particular problem. * \param[in] print - Display information on screen. */ - void SetTranslationalVelocity(CConfig *config, bool print = false); + void SetTranslationalVelocity(const CConfig *config, bool print = false); + + /*! + * \brief Set the translational/rotational velocity for all moving walls. + * \param[in] config - Definition of the particular problem. + * \param[in] print - Display information on screen. + */ + void SetWallVelocity(const CConfig *config, bool print = false); /*! * \brief Set the grid velocity via finite differencing at each node. * \param[in] config - Definition of the particular problem. - * \param[in] iter - Current physical time step. */ - void SetGridVelocity(CConfig *config, unsigned long iter); + void SetGridVelocity(const CConfig *config); /*! * \brief A virtual member. * \param[in] geometry - Geometry of the fine mesh. * \param[in] config - Definition of the particular problem. */ - inline virtual void SetRestricted_GridVelocity(CGeometry *fine_mesh, CConfig *config) {} + inline virtual void SetRestricted_GridVelocity(CGeometry *fine_mesh, const CConfig *config) {} /*! * \brief Check if a boundary is straight(2D) / plane(3D) for EULER_WALL and SYMMETRY_PLANE diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 740bfe754ab..c09e593c545 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -155,7 +155,7 @@ class CMultiGridGeometry final : public CGeometry { * \param[in] fine_mesh - Geometry container for the finer mesh level. * \param[in] config - Definition of the particular problem. */ - void SetRestricted_GridVelocity(CGeometry *fine_mesh, CConfig *config) override; + void SetRestricted_GridVelocity(CGeometry *fine_mesh, const CConfig *config) override; /*! * \brief Find and store the closest neighbor to a vertex. diff --git a/Common/include/grid_movement/CSurfaceMovement.hpp b/Common/include/grid_movement/CSurfaceMovement.hpp index fdbaa3253f1..627ea598eef 100644 --- a/Common/include/grid_movement/CSurfaceMovement.hpp +++ b/Common/include/grid_movement/CSurfaceMovement.hpp @@ -125,15 +125,6 @@ class CSurfaceMovement : public CGridMovement { */ void SetRotation(CGeometry *boundary, CConfig *config, unsigned short iDV, bool ResetDef); - /*! - * \brief Set the translational/rotational velocity for a moving wall. - * \param[in] geometry - Geometrical definition of the problem. - * \param[in] config - Definition of the particular problem. - * \param[in] iZone - Zone number in the mesh. - * \param[in] iter - Physical time iteration number. - */ - void Moving_Walls(CGeometry *geometry, CConfig *config, unsigned short iZone, unsigned long iter); - /*! * \brief Computes the displacement of a rotating surface for a dynamic mesh simulation. * \param[in] geometry - Geometrical definition of the problem. diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 36eb1db282d..c1bcec5d1c3 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1644,14 +1644,10 @@ void CConfig::SetConfig_Options() { addDoubleOption("HB_PERIOD", HarmonicBalance_Period, -1.0); /* DESCRIPTION: Turn on/off harmonic balance preconditioning */ addBoolOption("HB_PRECONDITION", HB_Precondition, false); - /* DESCRIPTION: Iteration number to begin unsteady restarts (dual time method) */ - addLongOption("UNST_RESTART_ITER", Unst_RestartIter, 0); /* DESCRIPTION: Starting direct solver iteration for the unsteady adjoint */ addLongOption("UNST_ADJOINT_ITER", Unst_AdjointIter, 0); /* DESCRIPTION: Number of iterations to average the objective */ addLongOption("ITER_AVERAGE_OBJ", Iter_Avg_Objective , 0); - /* DESCRIPTION: Iteration number to begin unsteady restarts (structural analysis) */ - addLongOption("DYN_RESTART_ITER", Dyn_RestartIter, 0); /* DESCRIPTION: Time discretization */ addEnumOption("TIME_DISCRE_FLOW", Kind_TimeIntScheme_Flow, Time_Int_Map, EULER_IMPLICIT); /* DESCRIPTION: Time discretization */ @@ -2884,6 +2880,10 @@ void CConfig::SetConfig_Parsing(istream& config_buffer){ newString.append("WRT_SOL_FREQ is deprecated. Use OUTPUT_WRT_FREQ instead.\n\n"); else if (!option_name.compare("WRT_SOL_FREQ_DUALTIME")) newString.append("WRT_SOL_FREQ_DUALTIME is deprecated. Use OUTPUT_WRT_FREQ instead.\n\n"); + else if (!option_name.compare("UNST_RESTART_ITER")) + newString.append("UNST_RESTART_ITER is deprecated. Use RESTART_ITER instead.\n\n"); + else if (!option_name.compare("DYN_RESTART_ITER")) + newString.append("DYN_RESTART_ITER is deprecated. Use RESTART_ITER instead.\n\n"); // This option is deprecated. After a grace period until 7.2.0 the usage warning should become an error. /*else if (!option_name.compare("CONV_CRITERIA")) newString.append(string("CONV_CRITERIA is deprecated. SU2 will choose the criteria automatically based on the CONV_FIELD.\n") + @@ -3634,7 +3634,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i } if (nKind_SurfaceMovement != nMarker_Moving) { - SU2_MPI::Error("Number of KIND_SURFACE_MOVEMENT must match number of MARKER_MOVING", CURRENT_FUNCTION); + SU2_MPI::Error("Number of SURFACE_MOVEMENT must match number of MARKER_MOVING", CURRENT_FUNCTION); } if (TimeMarching == TIME_MARCHING::TIME_STEPPING){ @@ -9699,7 +9699,7 @@ void CConfig::SetFreeStreamTurboNormal(const su2double* turboNormal){ } -void CConfig::SetMultizone(CConfig *driver_config, CConfig **config_container){ +void CConfig::SetMultizone(const CConfig *driver_config, const CConfig* const* config_container){ for (unsigned short iZone = 0; iZone < nZone; iZone++){ @@ -9715,6 +9715,10 @@ void CConfig::SetMultizone(CConfig *driver_config, CConfig **config_container){ if (config_container[iZone]->GetTime_Step() != GetTime_Step()){ SU2_MPI::Error("Option TIME_STEP must be the same in all zones.", CURRENT_FUNCTION); } + if (config_container[iZone]->GetUnst_CFL() != 0.0){ + SU2_MPI::Error("Option UNST_CFL_NUMBER cannot be used in multizone problems (must be 0)," + " use a fixed TIME_STEP instead.", CURRENT_FUNCTION); + } if (config_container[iZone]->GetMultizone_Problem() != GetMultizone_Problem()){ SU2_MPI::Error("Option MULTIZONE must be the same in all zones.", CURRENT_FUNCTION); } @@ -9750,12 +9754,6 @@ void CConfig::SetMultizone(CConfig *driver_config, CConfig **config_container){ } } - /*--- Set the Restart iter for time dependent problems ---*/ - if (driver_config->GetRestart()){ - Unst_RestartIter = driver_config->GetRestart_Iter(); - Dyn_RestartIter = driver_config->GetRestart_Iter(); - } - /*--- Fix the Time Step for all subdomains, for the case of time-dependent problems ---*/ if (driver_config->GetTime_Domain()){ Delta_UnstTime = driver_config->GetTime_Step(); @@ -9768,29 +9766,19 @@ void CConfig::SetMultizone(CConfig *driver_config, CConfig **config_container){ /*------ Determine the special properties of the problem -----*/ /*------------------------------------------------------------*/ - bool structural_zone = false; bool fluid_zone = false; - - unsigned short iZone = 0; + bool structural_zone = false; /*--- If there is at least a fluid and a structural zone ---*/ - for (iZone = 0; iZone < nZone; iZone++){ - switch (config_container[iZone]->GetKind_Solver()) { - case EULER: case NAVIER_STOKES: case RANS: - case INC_EULER: case INC_NAVIER_STOKES: case INC_RANS: - case NEMO_EULER: case NEMO_NAVIER_STOKES: - fluid_zone = true; - break; - case FEM_ELASTICITY: - structural_zone = true; - Relaxation = true; - break; - } + for (auto iZone = 0u; iZone < nZone; iZone++) { + fluid_zone |= config_container[iZone]->GetFluidProblem(); + structural_zone |= config_container[iZone]->GetStructuralProblem(); } + if (structural_zone) Relaxation = true; + /*--- If the problem has FSI properties ---*/ FSI_Problem = fluid_zone && structural_zone; Multizone_Residual = true; - } diff --git a/Common/src/fem/fem_geometry_structure.cpp b/Common/src/fem/fem_geometry_structure.cpp index 19f387818bc..e1409697c8f 100644 --- a/Common/src/fem/fem_geometry_structure.cpp +++ b/Common/src/fem/fem_geometry_structure.cpp @@ -6589,7 +6589,7 @@ void CMeshFEM_DG::HighOrderContainmentSearch(const su2double *coor, SU2_MPI::Error("Newton did not converge", CURRENT_FUNCTION); } -void CMeshFEM_DG::InitStaticMeshMovement(CConfig *config, +void CMeshFEM_DG::InitStaticMeshMovement(const CConfig *config, const unsigned short Kind_Grid_Movement, const unsigned short iZone) { diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index 175d30bff82..cf708b8a112 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -28,24 +28,7 @@ #include "../../include/geometry/CGeometry.hpp" #include "../../include/geometry/elements/CElement.hpp" #include "../../include/parallelization/omp_structure.hpp" - -/*--- Cross product ---*/ - -#define CROSS(dest,v1,v2) \ -(dest)[0] = (v1)[1]*(v2)[2] - (v1)[2]*(v2)[1]; \ -(dest)[1] = (v1)[2]*(v2)[0] - (v1)[0]*(v2)[2]; \ -(dest)[2] = (v1)[0]*(v2)[1] - (v1)[1]*(v2)[0]; - -/*--- Cross product ---*/ - -#define DOT(v1,v2) ((v1)[0]*(v2)[0] + (v1)[1]*(v2)[1] + (v1)[2]*(v2)[2]); - -/*--- a = b - c ---*/ - -#define SUB(dest,v1,v2) \ -(dest)[0] = (v1)[0] - (v2)[0]; \ -(dest)[1] = (v1)[1] - (v2)[1]; \ -(dest)[2] = (v1)[2] - (v2)[2]; +#include "../../include/toolboxes/geometry_toolbox.hpp" CGeometry::CGeometry(void) : size(SU2_MPI::GetSize()), @@ -1626,16 +1609,16 @@ bool CGeometry::RayIntersectsTriangle(const su2double orig[3], const su2double d /*--- Find vectors for two edges sharing vert0 ---*/ - SUB(edge1, vert1, vert0); - SUB(edge2, vert2, vert0); + GeometryToolbox::Distance(3, vert1, vert0, edge1); + GeometryToolbox::Distance(3, vert2, vert0, edge2); /*--- Begin calculating determinant - also used to calculate U parameter ---*/ - CROSS(pvec, dir, edge2); + GeometryToolbox::CrossProduct(dir, edge2, pvec); /*--- If determinant is near zero, ray lies in plane of triangle ---*/ - det = DOT(edge1, pvec); + det = GeometryToolbox::DotProduct(3, edge1, pvec); if (fabs(det) < epsilon) return(false); @@ -1644,27 +1627,27 @@ bool CGeometry::RayIntersectsTriangle(const su2double orig[3], const su2double d /*--- Calculate distance from vert0 to ray origin ---*/ - SUB(tvec, orig, vert0); + GeometryToolbox::Distance(3, orig, vert0, tvec); /*--- Calculate U parameter and test bounds ---*/ - u = inv_det * DOT(tvec, pvec); + u = inv_det * GeometryToolbox::DotProduct(3, tvec, pvec); if (u < 0.0 || u > 1.0) return(false); /*--- prepare to test V parameter ---*/ - CROSS(qvec, tvec, edge1); + GeometryToolbox::CrossProduct(tvec, edge1, qvec); /*--- Calculate V parameter and test bounds ---*/ - v = inv_det * DOT(dir, qvec); + v = inv_det * GeometryToolbox::DotProduct(3, dir, qvec); if (v < 0.0 || u + v > 1.0) return(false); /*--- Calculate t, ray intersects triangle ---*/ - t = inv_det * DOT(edge2, qvec); + t = inv_det * GeometryToolbox::DotProduct(3, edge2, qvec); /*--- Compute the intersection point in cartesian coordinates ---*/ @@ -1724,21 +1707,21 @@ bool CGeometry::SegmentIntersectsTriangle(su2double point0[3], const su2double p su2double dir[3], intersect[3], u[3], v[3], edge1[3], edge2[3], Plane_Normal[3], Denominator, Numerator, Aux; - SUB(dir, point1, point0); + GeometryToolbox::Distance(3, point1, point0, dir); if (RayIntersectsTriangle(point0, dir, vert0, vert1, vert2, intersect)) { /*--- Check that the intersection is in the segment ---*/ - SUB(u, point0, intersect); - SUB(v, point1, intersect); + GeometryToolbox::Distance(3, point0, intersect, u); + GeometryToolbox::Distance(3, point1, intersect, v); - SUB(edge1, vert1, vert0); - SUB(edge2, vert2, vert0); - CROSS(Plane_Normal, edge1, edge2); + GeometryToolbox::Distance(3, vert1, vert0, edge1); + GeometryToolbox::Distance(3, vert2, vert0, edge2); + GeometryToolbox::CrossProduct(edge1, edge2, Plane_Normal); - Denominator = DOT(Plane_Normal, u); - Numerator = DOT(Plane_Normal, v); + Denominator = GeometryToolbox::DotProduct(3, Plane_Normal, u); + Numerator = GeometryToolbox::DotProduct(3, Plane_Normal, v); Aux = Numerator * Denominator; @@ -3549,7 +3532,7 @@ void CGeometry::SetElemVolume() END_SU2_OMP_PARALLEL } -void CGeometry::SetRotationalVelocity(CConfig *config, bool print) { +void CGeometry::SetRotationalVelocity(const CConfig *config, bool print) { unsigned long iPoint; unsigned short iDim; @@ -3602,7 +3585,7 @@ void CGeometry::SetRotationalVelocity(CConfig *config, bool print) { } -void CGeometry::SetShroudVelocity(CConfig *config) { +void CGeometry::SetShroudVelocity(const CConfig *config) { unsigned long iPoint, iVertex; unsigned short iMarker, iMarkerShroud; @@ -3621,7 +3604,7 @@ void CGeometry::SetShroudVelocity(CConfig *config) { } } -void CGeometry::SetTranslationalVelocity(CConfig *config, bool print) { +void CGeometry::SetTranslationalVelocity(const CConfig *config, bool print) { su2double xDot[3] = {0.0,0.0,0.0}; @@ -3641,10 +3624,68 @@ void CGeometry::SetTranslationalVelocity(CConfig *config, bool print) { for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) nodes->SetGridVel(iPoint, xDot); +} + +void CGeometry::SetWallVelocity(const CConfig *config, bool print) { + + const su2double L_Ref = config->GetLength_Ref(); + const su2double Omega_Ref = config->GetOmega_Ref(); + const su2double Vel_Ref = config->GetVelocity_Ref(); + + /*--- Store grid velocity for each node on the moving surface(s). + Sum and store the x, y, & z velocities due to translation and rotation. ---*/ + + for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) { + if (config->GetMarker_All_Moving(iMarker) != YES) continue; + + /*--- Identify iMarker from the list of those under MARKER_MOVING + Get prescribed wall speed from config for this marker. ---*/ + const auto Marker_Tag = config->GetMarker_All_TagBound(iMarker); + const auto jMarker = config->GetMarker_Moving(Marker_Tag); + + su2double xDot[MAXNDIM], Center[MAXNDIM], Omega[MAXNDIM]; + + for (auto iDim = 0u; iDim < MAXNDIM; iDim++){ + Center[iDim] = config->GetMarkerMotion_Origin(jMarker, iDim); + Omega[iDim] = config->GetMarkerRotationRate(jMarker, iDim) / Omega_Ref; + xDot[iDim] = config->GetMarkerTranslationRate(jMarker, iDim) / Vel_Ref; + } + + if (rank == MASTER_NODE && print) { + cout << " Storing grid velocity for marker: "; + cout << Marker_Tag << ".\n"; + cout << " Translational velocity: (" << xDot[0]*config->GetVelocity_Ref() << ", " << xDot[1]*config->GetVelocity_Ref(); + cout << ", " << xDot[2]*config->GetVelocity_Ref(); + if (config->GetSystemMeasurements() == SI) cout << ") m/s.\n"; + else cout << ") ft/s.\n"; + cout << " Angular velocity: (" << Omega[0] << ", " << Omega[1]; + cout << ", " << Omega[2] << ") rad/s about origin: (" << Center[0]; + cout << ", " << Center[1] << ", " << Center[2] << ")." << endl; + } + + for (auto iVertex = 0ul; iVertex < nVertex[iMarker]; iVertex++) { + const auto iPoint = vertex[iMarker][iVertex]->GetNode(); + + /*--- Calculate non-dim. position from rotation center ---*/ + su2double r[MAXNDIM] = {0.0}; + for (auto iDim = 0u; iDim < nDim; iDim++) + r[iDim] = (nodes->GetCoord(iPoint,iDim) - Center[iDim]) / L_Ref; + + /*--- Cross Product of angular velocity and distance from center to + get the rotational velocity. Note that we are adding on the velocity + due to pure translation as well. ---*/ + + su2double GridVel[MAXNDIM]; + GeometryToolbox::CrossProduct(Omega, r, GridVel); + + for (auto iDim = 0u; iDim < nDim; iDim++) + nodes->SetGridVel(iPoint, iDim, xDot[iDim]+GridVel[iDim]); + } + } } -void CGeometry::SetGridVelocity(CConfig *config, unsigned long iter) { +void CGeometry::SetGridVelocity(const CConfig *config) { /*--- Get timestep and whether to use 1st or 2nd order backward finite differences ---*/ diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index c027b51fcf8..0fc3f53473f 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -1301,7 +1301,7 @@ void CMultiGridGeometry::SetMultiGridWallTemperature(CGeometry *geometry, unsign } -void CMultiGridGeometry::SetRestricted_GridVelocity(CGeometry *fine_mesh, CConfig *config) { +void CMultiGridGeometry::SetRestricted_GridVelocity(CGeometry *fine_mesh, const CConfig *config) { /*--- Loop over all coarse mesh points. ---*/ SU2_OMP_FOR_STAT(roundUpDiv(nPoint,omp_get_max_threads())) diff --git a/Common/src/grid_movement/CSurfaceMovement.cpp b/Common/src/grid_movement/CSurfaceMovement.cpp index e527285daa4..6eeef1fd3a3 100644 --- a/Common/src/grid_movement/CSurfaceMovement.cpp +++ b/Common/src/grid_movement/CSurfaceMovement.cpp @@ -3163,80 +3163,6 @@ void CSurfaceMovement::SetScale(CGeometry *boundary, CConfig *config, unsigned s } -void CSurfaceMovement::Moving_Walls(CGeometry *geometry, CConfig *config, - unsigned short iZone, unsigned long iter) { - - /*--- Local variables ---*/ - unsigned short iMarker, jMarker, iDim, nDim = geometry->GetnDim(); - unsigned long iPoint, iVertex; - su2double xDot[3] = {0.0,0.0,0.0}, *Coord, Center[3] = {0.0,0.0,0.0}, Omega[3] = {0.0,0.0,0.0}, r[3] = {0.0,0.0,0.0}, GridVel[3] = {0.0,0.0,0.0}; - su2double L_Ref = config->GetLength_Ref(); - su2double Omega_Ref = config->GetOmega_Ref(); - su2double Vel_Ref = config->GetVelocity_Ref(); - string Marker_Tag; - - /*--- Store grid velocity for each node on the moving surface(s). - Sum and store the x, y, & z velocities due to translation and rotation. ---*/ - - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - if (config->GetMarker_All_Moving(iMarker) == YES) { - - /*--- Identify iMarker from the list of those under MARKER_MOVING ---*/ - - Marker_Tag = config->GetMarker_All_TagBound(iMarker); - jMarker = config->GetMarker_Moving(Marker_Tag); - - /*--- Get prescribed wall speed from config for this marker ---*/ - - for (iDim = 0; iDim < 3; iDim++){ - Center[iDim] = config->GetMarkerMotion_Origin(jMarker, iDim); - Omega[iDim] = config->GetMarkerRotationRate(jMarker, iDim)/Omega_Ref; - xDot[iDim] = config->GetMarkerTranslationRate(jMarker, iDim)/Vel_Ref; - } - - - if (rank == MASTER_NODE && iter == 0) { - cout << " Storing grid velocity for marker: "; - cout << Marker_Tag << "." << endl; - cout << " Translational velocity: (" << xDot[0]*config->GetVelocity_Ref() << ", " << xDot[1]*config->GetVelocity_Ref(); - cout << ", " << xDot[2]*config->GetVelocity_Ref(); - if (config->GetSystemMeasurements() == SI) cout << ") m/s." << endl; - else cout << ") ft/s." << endl; - cout << " Angular velocity: (" << Omega[0] << ", " << Omega[1]; - cout << ", " << Omega[2] << ") rad/s about origin: (" << Center[0]; - cout << ", " << Center[1] << ", " << Center[2] << ")." << endl; - } - - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - - /*--- Get the index and coordinates of the current point ---*/ - - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - Coord = geometry->nodes->GetCoord(iPoint); - - /*--- Calculate non-dim. position from rotation center ---*/ - for (iDim = 0; iDim < nDim; iDim++) - r[iDim] = (Coord[iDim]-Center[iDim])/L_Ref; - if (nDim == 2) r[nDim] = 0.0; - - /*--- Cross Product of angular velocity and distance from center to - get the rotational velocity. Note that we are adding on the velocity - due to pure translation as well. ---*/ - - GridVel[0] = xDot[0] + Omega[1]*r[2] - Omega[2]*r[1]; - GridVel[1] = xDot[1] + Omega[2]*r[0] - Omega[0]*r[2]; - GridVel[2] = xDot[2] + Omega[0]*r[1] - Omega[1]*r[0]; - - /*--- Store the moving wall velocity for this node ---*/ - - for (iDim = 0; iDim < nDim; iDim++) - geometry->nodes->SetGridVel(iPoint, iDim, GridVel[iDim]); - - } - } - } -} - void CSurfaceMovement::AeroelasticDeform(CGeometry *geometry, CConfig *config, unsigned long TimeIter, unsigned short iMarker, unsigned short iMarker_Monitoring, vector& displacements) { /* The sign conventions of these are those of the Typical Section Wing Model, below the signs are corrected */ diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index 8a0b597365b..21341a6dbe1 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -246,7 +246,7 @@ class CDriver { /*! * \brief Initiate value for static mesh movement such as the gridVel for the ROTATING frame. */ - void StaticMesh_Preprocessing(CConfig *config, CGeometry **geometry, CSurfaceMovement *surface_movement); + void StaticMesh_Preprocessing(const CConfig *config, CGeometry **geometry); /*! * \brief Initiate value for static mesh movement such as the gridVel for the ROTATING frame. @@ -254,7 +254,6 @@ class CDriver { void Turbomachinery_Preprocessing(CConfig** config, CGeometry**** geometry, CSolver***** solver, CInterface*** interface); - /*! * \brief A virtual member. * \param[in] donorZone - zone in which the displacements will be predicted. diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index d293bb827da..7a915698154 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -524,9 +524,10 @@ class CFVMFlowSolverBase : public CSolver { } - /*--- Recompute the unsteady time step for the dual time strategy if the unsteady CFL is diferent from 0. ---*/ + /*--- Recompute the unsteady time step for the dual time strategy if the unsteady CFL is diferent from 0. + * This is only done once because in dual time the time step cannot be variable. ---*/ - if ((dual_time) && (Iteration == 0) && (config->GetUnst_CFL() != 0.0) && (iMesh == MESH_0)) { + if (dual_time && (Iteration == config->GetRestart_Iter()) && (config->GetUnst_CFL() != 0.0) && (iMesh == MESH_0)) { /*--- Thread-local variable for reduction. ---*/ su2double glbDtND = 1e30; @@ -541,8 +542,7 @@ class CFVMFlowSolverBase : public CSolver { END_SU2_OMP_CRITICAL SU2_OMP_BARRIER - SU2_OMP_MASTER - { + SU2_OMP_MASTER { SU2_MPI::Allreduce(&Global_Delta_UnstTimeND, &glbDtND, 1, MPI_DOUBLE, MPI_MIN, SU2_MPI::GetComm()); Global_Delta_UnstTimeND = glbDtND; diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index c37c6283d92..e79729e4b8b 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -225,7 +225,7 @@ CDriver::CDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunica iteration_container[iZone][iInst], grid_movement[iZone][iInst], surface_movement[iZone]); /*--- Static mesh processing. ---*/ - StaticMesh_Preprocessing(config_container[iZone], geometry_container[iZone][iInst], surface_movement[iZone]); + StaticMesh_Preprocessing(config_container[iZone], geometry_container[iZone][iInst]); } @@ -2583,7 +2583,7 @@ void CDriver::Interface_Preprocessing(CConfig **config, CSolver***** solver, CGe } -void CDriver::StaticMesh_Preprocessing(CConfig *config, CGeometry** geometry, CSurfaceMovement* surface_movement){ +void CDriver::StaticMesh_Preprocessing(const CConfig *config, CGeometry** geometry){ unsigned short iMGlevel, iMGfine; unsigned short Kind_Grid_Movement; @@ -2643,8 +2643,7 @@ void CDriver::StaticMesh_Preprocessing(CConfig *config, CGeometry** geometry, CS if (rank == MASTER_NODE) cout << endl << " Setting the moving wall velocities." << endl; - assert(surface_movement != nullptr && "A surface_movement was not instantiated."); - surface_movement->Moving_Walls(geometry[MESH_0], config, iZone, 0); + geometry[MESH_0]->SetWallVelocity(config, true); /*--- Update the grid velocities on the coarser multigrid levels after setting the moving wall velocities for the finest mesh. ---*/ diff --git a/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp b/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp index 2095c065643..5c32d15c039 100644 --- a/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp @@ -249,7 +249,7 @@ void CDiscAdjFluidIteration::Preprocess(COutput* output, CIntegration**** integr /*--- Compute & set Grid Velocity via finite differences of the Coordinates. ---*/ if (grid_IsMoving) for (auto iMesh = 0u; iMesh <= config[iZone]->GetnMGLevels(); iMesh++) - geometries[iMesh]->SetGridVelocity(config[iZone], TimeIter); + geometries[iMesh]->SetGridVelocity(config[iZone]); } // if unsteady diff --git a/SU2_CFD/src/iteration/CIteration.cpp b/SU2_CFD/src/iteration/CIteration.cpp index a3c32da31e3..3fbe23c695c 100644 --- a/SU2_CFD/src/iteration/CIteration.cpp +++ b/SU2_CFD/src/iteration/CIteration.cpp @@ -106,7 +106,7 @@ void CIteration::SetGrid_Movement(CGeometry** geometry, CSurfaceMovement* surfac differencing based on node coordinates at previous times. ---*/ if (rank == MASTER_NODE) cout << " Computing grid velocities by finite differencing." << endl; - geometry[MESH_0]->SetGridVelocity(config, TimeIter); + geometry[MESH_0]->SetGridVelocity(config); /*--- Update the multigrid structure after moving the finest grid, including computing the grid velocities on the coarser levels. ---*/ @@ -138,7 +138,7 @@ void CIteration::SetGrid_Movement(CGeometry** geometry, CSurfaceMovement* surfac if (!adjoint) { if (rank == MASTER_NODE) cout << " Computing grid velocities by finite differencing." << endl; - geometry[MESH_0]->SetGridVelocity(config, TimeIter); + geometry[MESH_0]->SetGridVelocity(config); } /*--- Update the multigrid structure after moving the finest grid, diff --git a/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform.cfg b/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform.cfg index 8825db75313..38c4f885636 100644 --- a/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform.cfg +++ b/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform.cfg @@ -10,7 +10,6 @@ TIME_DOMAIN= YES TIME_MARCHING= DUAL_TIME_STEPPING-2ND_ORDER TIME_STEP= 0.0023555025613149587 MAX_TIME= 0.01 -UNST_RESTART_ITER= 5 UNST_ADJOINT_ITER= 5 % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% diff --git a/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform_ad.cfg b/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform_ad.cfg index a57a965f2dc..35fd81abe9a 100644 --- a/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform_ad.cfg +++ b/TestCases/disc_adj_euler/naca0012_pitching_def/inv_NACA0012_pitching_deform_ad.cfg @@ -10,7 +10,6 @@ TIME_DOMAIN= YES TIME_MARCHING= DUAL_TIME_STEPPING-2ND_ORDER TIME_STEP= 0.0023555025613149587 MAX_TIME= 0.01 -UNST_RESTART_ITER= 5 UNST_ADJOINT_ITER= 5 % ----------------------- DYNAMIC MESH DEFINITION -----------------------------% diff --git a/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/configAD_flow.cfg b/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/configAD_flow.cfg index 9e2a8b1ecfc..cde462e8186 100644 --- a/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/configAD_flow.cfg +++ b/TestCases/py_wrapper/disc_adj_flow/mesh_disp_sens/configAD_flow.cfg @@ -20,7 +20,6 @@ KIND_TURB_MODEL= NONE MATH_PROBLEM= DISCRETE_ADJOINT RESTART_SOL= NO -UNST_RESTART_ITER = 1 MULTIZONE_MESH = NO