Skip to content

Commit 9cfc283

Browse files
authored
Merge branch 'develop' into fix_primalgrid_const
2 parents a155206 + 76fa1e9 commit 9cfc283

3 files changed

Lines changed: 37 additions & 25 deletions

File tree

SU2_PY/FSI_tools/FSIInterface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __init__(self, FSI_config, FluidSolver, SolidSolver, have_MPI):
145145
self.aitkenParam = FSI_config['AITKEN_PARAM'] #relaxation parameter for the BGS method
146146
self.FSIIter = 0 #current FSI iteration
147147
self.unsteady = False #flag for steady or unsteady simulation (default is steady)
148-
if FSI_config['CSD_SOLVER']=='IMPOSED':
148+
if FSI_config['IMPOSED_MOTION']=='YES':
149149
self.ImposedMotion = True
150150
else:
151151
self.ImposedMotion = False

SU2_PY/FSI_tools/FSI_config.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,31 @@ def readConfig(self):
112112
(this_param == "MESH_INTERP_METHOD") or \
113113
(this_param == "DISP_PRED") or \
114114
(this_param == "AITKEN_RELAX") or \
115-
(this_param == "TIME_MARCHING") :
115+
(this_param == "TIME_MARCHING") or \
116+
(this_param == "IMPOSED_MOTION") or \
117+
(this_param == "MAPPING_MODES"):
116118
self._ConfigContent[this_param] = this_value
117119

118120
else :
119121
print(this_param + " is an invalid option !")
120122

121123
def applyDefaults(self):
122-
if self._ConfigContent["CSD_SOLVER"] == "IMPOSED":
124+
125+
if "MAPPING_MODES" not in self._ConfigContent:
126+
self._ConfigContent["MAPPING_MODES"] = "NO"
127+
print("MAPPING_MODES keyword was not found in the configuration file of the interface, setting to NO")
128+
129+
if "IMPOSED_MOTION" not in self._ConfigContent:
130+
self._ConfigContent["IMPOSED_MOTION"] = "NO"
131+
print("IMPOSED_MOTION keyword was not found in the configuration file of the interface, setting to NO")
132+
133+
if self._ConfigContent["IMPOSED_MOTION"] == "YES":
123134
if self._ConfigContent["AITKEN_RELAX"] != "STATIC" or self._ConfigContent["AITKEN_PARAM"] != 1.0:
124-
print("WARNING: Setting the Aitken parameter as static and equal to 1 for IMPOSED solver")
125-
self._ConfigContent["AITKEN_RELAX"] = "STATIC"
126-
self._ConfigContent["AITKEN_PARAM"] = 1.0
135+
raise Exception("When imposing motion, the Aitken parameter must be static and equal to 1")
127136

128137
if self._ConfigContent["RESTART_SOL"] == "YES":
129138
if self._ConfigContent["TIME_TRESHOLD"] != -1:
130-
print("WARNING: Setting the time threshold to -1 for immediate coupling when using restart")
131-
self._ConfigContent["TIME_TRESHOLD"] = -1
139+
raise Exception("When restarting a simulation, the time threshold must be -1 for immediate coupling")
140+
141+
if self._ConfigContent["MAPPING_MODES"] == "YES" and self._ConfigContent["CSD_SOLVER"]!="NATIVE":
142+
raise Exception("Mapping modes only works with the native solver")

SU2_PY/fsi_computation.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main():
5757
(options, args)=parser.parse_args()
5858

5959
if options.with_MPI:
60-
from mpi4py import MPI # MPI is initialized from now by python and can be continued in C++ !
60+
from mpi4py import MPI # MPI is initialized from now by python and can be continued in C++
6161
comm = MPI.COMM_WORLD
6262
myid = comm.Get_rank()
6363
numberPart = comm.Get_size()
@@ -112,23 +112,24 @@ def main():
112112
if have_MPI:
113113
comm.barrier()
114114

115-
# --- Initialize the solid solver --- # (!! for now we are using only serial solid solvers)
116-
if myid == rootProcess:
117-
print("\n")
118-
print(" Initializing solid solver ".center(80,"*"))
119-
if CSD_Solver == 'AEROELASTIC':
120-
from SU2_Nastran import pysu2_nastran
121-
SolidSolver = pysu2_nastran.Solver(CSD_ConFile,False)
122-
elif CSD_Solver == 'IMPOSED':
123-
from SU2_Nastran import pysu2_nastran
124-
SolidSolver = pysu2_nastran.Solver(CSD_ConFile,True)
125-
elif CSD_Solver == 'MAPPING':
126-
from SU2_Nastran import pysu2_nastran
127-
SolidSolver = pysu2_nastran.Solver(CSD_ConFile,True)
115+
# --- Initialize the solid solver --- #
116+
# Serial solvers
117+
if CSD_Solver in ["NATIVE"]:
118+
if myid == rootProcess:
119+
print("\n")
120+
print(" Initializing solid solver ".center(80,"*"))
121+
if CSD_Solver == 'NATIVE':
122+
from SU2_Nastran import pysu2_nastran
123+
if FSI_config["IMPOSED_MOTION"] == "NO":
124+
SolidSolver = pysu2_nastran.Solver(CSD_ConFile,False)
125+
else:
126+
SolidSolver = pysu2_nastran.Solver(CSD_ConFile,True)
128127
else:
129-
print("\n Invalid solid solver option")
128+
SolidSolver = None
129+
# Parallel solvers
130+
# For now we are only using serial solvers
130131
else:
131-
SolidSolver = None
132+
raise Exception('\n Invalid solid solver option')
132133

133134
if have_MPI:
134135
comm.barrier()
@@ -158,7 +159,7 @@ def main():
158159
if have_MPI:
159160
comm.barrier()
160161

161-
if CSD_Solver != "MAPPING":
162+
if FSI_config["MAPPING_MODES"] == "NO":
162163
# --- Launch a steady or unsteady FSI computation --- #
163164
if FSI_config['TIME_MARCHING'] == "YES":
164165
try:

0 commit comments

Comments
 (0)