Skip to content

Commit

Permalink
Merge pull request #1412 from Nicola-Fonzi/publish
Browse files Browse the repository at this point in the history
Fix grid velocity output for dynamic mesh (with option DEFORM_MESH)
  • Loading branch information
pcarruscag authored Oct 21, 2021
2 parents 1477381 + 6ed9a1d commit c531be4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion SU2_CFD/src/output/COutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output):
size(SU2_MPI::GetSize()),
nDim(ndim),
multiZone(config->GetMultizone_Problem()),
gridMovement(config->GetGrid_Movement()),
gridMovement(config->GetDynamic_Grid()),
femOutput(fem_output),
si_units(config->GetSystemMeasurements() == SI),
us_units(config->GetSystemMeasurements() == US) {
Expand Down
31 changes: 24 additions & 7 deletions SU2_PY/FSI_tools/FSI_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ class FSIConfig:
Read the file and store all the options into a dictionary.
"""

def __init__(self,FileName):
def __init__(self,FileName,comm):
self.ConfigFileName = FileName
self.comm = comm
self._ConfigContent = {}
self.readConfig()
self.applyDefaults()
Expand Down Expand Up @@ -118,25 +119,41 @@ def readConfig(self):
self._ConfigContent[this_param] = this_value

else :
print(this_param + " is an invalid option !")
self.MPIPrint(this_param + " is an invalid option !",False)

def applyDefaults(self):

if "MAPPING_MODES" not in self._ConfigContent:
self._ConfigContent["MAPPING_MODES"] = "NO"
print("MAPPING_MODES keyword was not found in the configuration file of the interface, setting to NO")
self.MPIPrint("MAPPING_MODES keyword was not found in the configuration file of the interface, setting to NO",False)

if "IMPOSED_MOTION" not in self._ConfigContent:
self._ConfigContent["IMPOSED_MOTION"] = "NO"
print("IMPOSED_MOTION keyword was not found in the configuration file of the interface, setting to NO")
self.MPIPrint("IMPOSED_MOTION keyword was not found in the configuration file of the interface, setting to NO",False)

if self._ConfigContent["IMPOSED_MOTION"] == "YES":
if self._ConfigContent["AITKEN_RELAX"] != "STATIC" or self._ConfigContent["AITKEN_PARAM"] != 1.0:
raise Exception("When imposing motion, the Aitken parameter must be static and equal to 1")
self.MPIPrint("When imposing motion, the Aitken parameter must be static and equal to 1",True)

if self._ConfigContent["RESTART_SOL"] == "YES":
if self._ConfigContent["TIME_TRESHOLD"] != -1:
raise Exception("When restarting a simulation, the time threshold must be -1 for immediate coupling")
self.MPIPrint("When restarting a simulation, the time threshold must be -1 for immediate coupling",True)

if self._ConfigContent["MAPPING_MODES"] == "YES" and self._ConfigContent["CSD_SOLVER"]!="NATIVE":
raise Exception("Mapping modes only works with the native solver")
self.MPIPrint("Mapping modes only works with the native solver",True)

def MPIPrint(self, message, error):
"""
Print a message, or raise error, on screen only from the master process.
"""

if self.comm:
myid = self.comm.Get_rank()
else:
myid = 0

if not myid:
if error:
raise Exception(message)
else:
print(message)
2 changes: 1 addition & 1 deletion SU2_PY/fsi_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def main():

confFile = str(options.filename)

FSI_config = FSI.FSIConfig(confFile) # FSI configuration file
FSI_config = FSI.FSIConfig(confFile, comm) # FSI configuration file
CFD_ConFile = FSI_config['CFD_CONFIG_FILE_NAME'] # CFD configuration file
CSD_ConFile = FSI_config['CSD_CONFIG_FILE_NAME'] # CSD configuration file

Expand Down

0 comments on commit c531be4

Please sign in to comment.