su2code / SU2

SU2: An Open-Source Suite for Multiphysics Simulation and Design
https://su2code.github.io
Other
1.33k stars 843 forks source link

FSI: Less arguments than in the C++ code #642

Closed komahanb closed 4 years ago

komahanb commented 5 years ago

https://github.com/su2code/SU2/blob/f4116f45f80b7360169e3126e58cc17e24f9aaa6/SU2_PY/fsi_computation.py#L109

The base C++ code ~/git/su2/SU2_CFD/src/driver_structure.cpp has five arguments:

new CFluidDriver(config_file_name, nZone, nDim, periodic, MPICommunicator)

However, the python script fsi_computations.py provides uses four arguments

    FluidSolver = pysu2.CFluidDriver(CFD_ConFile, 1, FSI_config['NDIM'], comm)

Missing argument error

This gives the following error during execution.

  File "~/git/su2/bin/pysu2.py", line 579, in __init__
    this = _pysu2.new_CFluidDriver(*args)
TypeError: new_CFluidDriver() takes exactly 5 arguments (4 given)

I was able to get rid off this error by adding proving the missing argument for periodic BCs.

Order of arguments did not cause any issues

It seems that

cfd = pysu2.CFluidDriver(fsi_config['CFD_CONFIG_FILE_NAME'],
                         1,
                         fsi_config['NDIM'],
                         False,
                         MPI.COMM_WORLD)

and

cfd = pysu2.CFluidDriver(fsi_config['CFD_CONFIG_FILE_NAME'],
                         1,
                         False,
                         fsi_config['NDIM'],
                         MPI.COMM_WORLD)

are both valid calls and the simulation runs. I am not sure if this is safe!

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still a relevant issue please comment on it to restart the discussion. Thank you for your contributions.

Bill-Zhang-BUAA commented 4 years ago

Hi, Komahan, I also noticed this error in fsi_computation.py. And this error was fixed by adding a periodic boundary condition. For example: Adding one line in parser part: parser.add_option("--periodic", dest="periodic", default="False", help="Define whether the problem has periodic boundary conditions", metavar="PERIODIC") And the Line 109 changes to FluidSolver = pysu2.CFluidDriver(CFD_ConFile, 1, FSI_config['NDIM'], options.periodic, comm)

However, when I want to run the basic fsi coupling of two-dimensional pitching-plunging NACA 0012 airfoil by using the 'TESTER' CSD Solver 'PitchPlungeAirfoilStructuralTester', another error occurs.

If I run by typing: fsi_computation.py -f FSICoupler_config.cfg This gives the following error: ***************************** Initializing fluid solver ***************************** ('A TypeError occured in pysu2.CSingleZoneDriver : ', TypeError("in method 'new_CFluidDriver', argument 5 of type 'SU2_Comm'",)) ERROR : You are trying to launch a computation without initializing MPI but the wrapper has been built in parallel. Please add the --parallel option in order to initialize MPI for the wrapper.

If I run in parallel by typing: 'fsi_computation.py -f FSICoupler_config.cfg --parallel' This works without error but the program stops at Mapping fluid-solid interfaces ***************************** Mapping fluid-solid interfaces ***************************** Building interpolation matrices...

Here I upload the config files and the mesh, hope someone can notice those bugs and help to solve.

Best!

2d_coupled_fsi.zip includes: FSICoupler_config.cfg, NACA0012RANS_FullHexa.su2, StructuralTester_config.cfg, SU2_config.cfg

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still a relevant issue please comment on it to restart the discussion. Thank you for your contributions.