diff --git a/SU2_CFD/include/drivers/CDriver.hpp b/SU2_CFD/include/drivers/CDriver.hpp index 75ae58581de2..f6890b53a095 100644 --- a/SU2_CFD/include/drivers/CDriver.hpp +++ b/SU2_CFD/include/drivers/CDriver.hpp @@ -525,7 +525,11 @@ class CDriver { * \param[in] iVertex - Vertex identifier. * \return Unit normal (vector) at the vertex. */ - vector GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex) const; + vector GetVertexNormal(unsigned short iMarker, unsigned long iVertex, bool unitNormal = false) const; + + inline vector GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex) const { + return GetVertexNormal(iMarker, iVertex, true); + } /*! * \brief Get all the boundary markers tags. diff --git a/SU2_CFD/src/python_wrapper_structure.cpp b/SU2_CFD/src/python_wrapper_structure.cpp index 0617674ec787..588e61d43f17 100644 --- a/SU2_CFD/src/python_wrapper_structure.cpp +++ b/SU2_CFD/src/python_wrapper_structure.cpp @@ -228,7 +228,7 @@ vector CDriver::GetInitialMeshCoord(unsigned short iMarker, unsig return coord_passive; } -vector CDriver::GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex) const { +vector CDriver::GetVertexNormal(unsigned short iMarker, unsigned long iVertex, bool unitNormal) const { su2double *Normal; su2double Area; @@ -237,6 +237,15 @@ vector CDriver::GetVertexUnitNormal(unsigned short iMarker, unsig Normal = geometry_container[ZONE_0][INST_0][MESH_0]->vertex[iMarker][iVertex]->GetNormal(); + if (!unitNormal) { + + ret_Normal_passive[0] = SU2_TYPE::GetValue(Normal[0]); + ret_Normal_passive[1] = SU2_TYPE::GetValue(Normal[1]); + if(nDim>2) ret_Normal_passive[2] = SU2_TYPE::GetValue(Normal[2]); + + return ret_Normal_passive; + } + Area = GeometryToolbox::Norm(nDim, Normal); ret_Normal[0] = Normal[0]/Area; diff --git a/SU2_CFD/src/solvers/CMeshSolver.cpp b/SU2_CFD/src/solvers/CMeshSolver.cpp index e8f68c9a3afb..c9db520150ed 100644 --- a/SU2_CFD/src/solvers/CMeshSolver.cpp +++ b/SU2_CFD/src/solvers/CMeshSolver.cpp @@ -284,6 +284,7 @@ void CMeshSolver::SetMinMaxVolume(CGeometry *geometry, CConfig *config, bool upd SU2_OMP_BARRIER AD::EndPassive(wasActive); + } void CMeshSolver::SetWallDistance(CGeometry *geometry, CConfig *config) { diff --git a/SU2_PY/FSI_tools/FSIInterface.py b/SU2_PY/FSI_tools/FSIInterface.py index 2b1e167d79b1..70f0f164b15e 100644 --- a/SU2_PY/FSI_tools/FSIInterface.py +++ b/SU2_PY/FSI_tools/FSIInterface.py @@ -1900,8 +1900,8 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): if FSI_config['RESTART_SOL'] == 'YES': NbTimeIter = ((totTime)/deltaT)-1 - time = (FSI_config['RESTART_ITER']+1)*deltaT - TimeIter = FSI_config['RESTART_ITER']+1 + time = (FSI_config['RESTART_ITER'])*deltaT + TimeIter = FSI_config['RESTART_ITER'] else: NbTimeIter = (totTime/deltaT)-1 # number of time iterations time = 0.0 # initial time @@ -1922,13 +1922,6 @@ def UnsteadyFSI(self,FSI_config, FluidSolver, SolidSolver): TimeIterTreshold = -1 self.getSolidInterfaceDisplacement(SolidSolver) self.displacementPredictor(FSI_config, SolidSolver, deltaT) - # We need now to update the solution because both restarter functions (solid and fluid) - # load the files in the solution containers, pushing back the previous solutions. We need - # 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 - if myid in self.fluidSolverProcessors: - FluidSolver.Update() if myid in self.solidSolverProcessors: SolidSolver.updateSolution() #If no restart diff --git a/SU2_PY/FSI_tools/FSI_config.py b/SU2_PY/FSI_tools/FSI_config.py index aad28ff0ee19..6a1dc3f88d00 100644 --- a/SU2_PY/FSI_tools/FSI_config.py +++ b/SU2_PY/FSI_tools/FSI_config.py @@ -122,3 +122,6 @@ def applyDefaults(self): if self._ConfigContent["CSD_SOLVER"] == "IMPOSED": self._ConfigContent["AITKEN_RELAX"] = "STATIC" self._ConfigContent["AITKEN_PARAM"] = 1.0 + + if self._ConfigContent["RESTART_SOL"] == "YES": + self._ConfigContent["TIME_TRESHOLD"] = -1 diff --git a/SU2_PY/SU2_Nastran/pysu2_nastran.py b/SU2_PY/SU2_Nastran/pysu2_nastran.py index 6c9aebe1d2ca..1994ec7b512c 100644 --- a/SU2_PY/SU2_Nastran/pysu2_nastran.py +++ b/SU2_PY/SU2_Nastran/pysu2_nastran.py @@ -722,7 +722,7 @@ def __computeInterfacePosVel(self, initialize): Y_disp = self.Uy.dot(self.q) Z_disp = self.Uz.dot(self.q) - for iPoint in range(len(self.node)): + for iPoint in range(self.nPoint): coord0 = self.node[iPoint].GetCoord0() self.node[iPoint].SetCoord((X_disp[iPoint]+coord0[0],Y_disp[iPoint]+coord0[1],Z_disp[iPoint]+coord0[2])) self.node[iPoint].SetVel((X_vel[iPoint],Y_vel[iPoint],Z_vel[iPoint])) @@ -870,7 +870,7 @@ def __setRestart(self, timeIter): print("The restart iteration was not found in the structural history") break line = line.strip('\r\n').split() - if int(line[1])==(self.Config["RESTART_ITER"]-1): + if int(line[1])==(self.Config["RESTART_ITER"]-2): break index = 0 for index_mode in range(self.nDof): @@ -896,7 +896,7 @@ def __setRestart(self, timeIter): print("The restart iteration was not found in the structural history") break line = line.strip('\r\n').split() - if int(line[1])==self.Config["RESTART_ITER"]: + if int(line[1])==(self.Config["RESTART_ITER"]-1): break index = 0 for index_mode in range(self.nDof): @@ -935,11 +935,7 @@ def updateSolution(self): self.__reset(self.qddot) self.__reset(self.a) - makerID = list(self.markers.keys()) - makerID = makerID[0] - nodeList = self.markers[makerID] - - for iPoint in nodeList: + for iPoint in range(self.nPoint): self.node[iPoint].updateCoordVel()