Skip to content

Commit c531be4

Browse files
authored
Merge pull request #1412 from Nicola-Fonzi/publish
Fix grid velocity output for dynamic mesh (with option DEFORM_MESH)
2 parents 1477381 + 6ed9a1d commit c531be4

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

SU2_CFD/src/output/COutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output):
5252
size(SU2_MPI::GetSize()),
5353
nDim(ndim),
5454
multiZone(config->GetMultizone_Problem()),
55-
gridMovement(config->GetGrid_Movement()),
55+
gridMovement(config->GetDynamic_Grid()),
5656
femOutput(fem_output),
5757
si_units(config->GetSystemMeasurements() == SI),
5858
us_units(config->GetSystemMeasurements() == US) {

SU2_PY/FSI_tools/FSI_config.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ class FSIConfig:
5454
Read the file and store all the options into a dictionary.
5555
"""
5656

57-
def __init__(self,FileName):
57+
def __init__(self,FileName,comm):
5858
self.ConfigFileName = FileName
59+
self.comm = comm
5960
self._ConfigContent = {}
6061
self.readConfig()
6162
self.applyDefaults()
@@ -118,25 +119,41 @@ def readConfig(self):
118119
self._ConfigContent[this_param] = this_value
119120

120121
else :
121-
print(this_param + " is an invalid option !")
122+
self.MPIPrint(this_param + " is an invalid option !",False)
122123

123124
def applyDefaults(self):
124125

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

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

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

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

141142
if self._ConfigContent["MAPPING_MODES"] == "YES" and self._ConfigContent["CSD_SOLVER"]!="NATIVE":
142-
raise Exception("Mapping modes only works with the native solver")
143+
self.MPIPrint("Mapping modes only works with the native solver",True)
144+
145+
def MPIPrint(self, message, error):
146+
"""
147+
Print a message, or raise error, on screen only from the master process.
148+
"""
149+
150+
if self.comm:
151+
myid = self.comm.Get_rank()
152+
else:
153+
myid = 0
154+
155+
if not myid:
156+
if error:
157+
raise Exception(message)
158+
else:
159+
print(message)

SU2_PY/fsi_computation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def main():
8686

8787
confFile = str(options.filename)
8888

89-
FSI_config = FSI.FSIConfig(confFile) # FSI configuration file
89+
FSI_config = FSI.FSIConfig(confFile, comm) # FSI configuration file
9090
CFD_ConFile = FSI_config['CFD_CONFIG_FILE_NAME'] # CFD configuration file
9191
CSD_ConFile = FSI_config['CSD_CONFIG_FILE_NAME'] # CSD configuration file
9292

0 commit comments

Comments
 (0)