|
[Sponsors] |
TypeError in pysu2.CSinglezoneDriver in trying to run in Serial mode |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 4, 2022, 04:18 |
TypeError in pysu2.CSinglezoneDriver while trying to run in Serial mode
|
#1 |
New Member
Vishnu_iitb
Join Date: Oct 2020
Location: Mumbai
Posts: 16
Rep Power: 6 |
Hi there,
I want to run the inv_NACA0012 test case from the QuickStart folder (link here) using pysu2 through a python script in serial mode. I have enabled the python wrapper correctly and it gets imported without any error. I have attached my code below: Code:
import sys import shutil import SU2 import pysu2 #from mpi4py import MPI def main(): flow_filename = "inv_NACA0012.cfg" #comm = MPI.COMM_WORLD comm = 0 FlowDriver = pysu2.CSinglezoneDriver(flow_filename, 1, comm); FlowMarkerID = None FlowMarkerIDs = FlowDriver.GetAllBoundaryMarkers() sys.stdout.flush() #comm.Barrier() FlowDriver.ResetConvergence() FlowDriver.Preprocess(0) FlowDriver.run() FlowDriver.Postprocess() stopCalc = FlowDriver.Monitor(0) FlowDriver.Output(0) if __name__ == '__main__': main() SU2/bin/pysu2.py", line 527, in __init__ _pysu2.CSinglezoneDriver_swiginit(self, _pysu2.new_CSinglezoneDriver(confFile, val_nZone, MPICommunicator)) TypeError: in method 'new_CSinglezoneDriver', argument 3 of type 'SU2_Comm' Even if I enable MPI and use comm = MPI.COMM_WORLD instead of comm = 0,I get another error: The MPI_Comm_rank() function was called before MPI_INIT was invoked. *** This is disallowed by the MPI standard. *** Your MPI job will now abort. Right now I am only interested in running SU2 in the serial mode, could you help me in resolving the issue (the first error)? Thanks! -- I am using SU2 version 7.4.0 swig version: 4.0.2 gcc version 4.9.2 Last edited by Vishnu Sankar; October 4, 2022 at 08:18. Reason: Added the code in the correct format |
|
November 1, 2022, 05:19 |
|
#2 |
New Member
Vishnu_iitb
Join Date: Oct 2020
Location: Mumbai
Posts: 16
Rep Power: 6 |
Hi there,
Can anyone give some guidance on how to sort out this issue? I tried out running the example codes in mpi4py documentation page (link here), and they work fine. But when I am specifically running this piece of code with SU2 involved in it, I get the error mentioned above. I went through various online discussion forums but could not get it sorted :/ Thanks in advance! |
|
November 3, 2022, 06:48 |
|
#3 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 676
Rep Power: 21 |
I'm not too familiar with it, but have a look in the code at
SU2_CFD/src/python_wrapper_structure and you see what kind of functions are available. It looks like there is a Get_Drag() and Get_Lift() function and similar functions are present as well. |
|
November 3, 2022, 07:08 |
|
#4 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 676
Rep Power: 21 |
There are a couple of examples for the pywrapper in TestCases/py_wrapper, you can first run them to make sure that everything is working properly on your local machine (if you haven't done so already)
|
|
June 17, 2023, 03:03 |
|
#5 |
New Member
Vishnu_iitb
Join Date: Oct 2020
Location: Mumbai
Posts: 16
Rep Power: 6 |
Apologies for the very late reply, apparently I got busy with other projects and had to pause the one with SU2 for a while. Thanks a lot your prompt replies @bigfoot, seems the MPI version was creating the issue. I had a lot of trouble with setting up openMPI in the right way. Here are a few suggestions to get do it right for newbies like me who want to use the python wrapper of SU2
- Install openMPI and mpi4py as mention here: https://mdolab-mach-aero.readthedocs...yPackages.html (best source I ever found for mpi installation) - Install SU2 in parallel mode - Install the python wrapper appropriately (look at the last reply from the thread: ImportError: pysu2 incase you are facing python path issues) Python Code for running the Quick Start is re-written with corrections below: Code:
import sys import shutil import SU2 import pysu2 from mpi4py import MPI def main(): flow_filename="inv_NACA0012.cfg" comm= MPI.COMM_WORLD #comm = None FlowDriver=pysu2.CSinglezoneDriver(flow_filename, 1, comm); FlowMarkerID=None FlowMarkerIDs=FlowDriver.GetAllBoundaryMarkers() FlowMarkerList=FlowDriver.GetAllBoundaryMarkersTag() sys.stdout.flush() #comm.Barrier() FlowDriver.ResetConvergence() FlowDriver.Preprocess(0) FlowDriver.Run() FlowDriver.Postprocess() stopCalc=FlowDriver.Monitor(0) FlowDriver.Output(0) Cl=FlowDriver.Get_LiftCoeff() Cd=FlowDriver.Get_DragCoeff() Mz=FlowDriver.Get_Mz() if __name__=='__main__': main() |
|
Tags |
pysu2, su2 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[PyFoam] having problems with pyfoam Installation | vitorspadetoventurin | OpenFOAM Community Contributions | 3 | December 2, 2014 08:18 |
How to run icoFsiFoam in parallel mode? | AsDF | OpenFOAM Running, Solving & CFD | 2 | February 21, 2014 08:56 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 21:02 |
How to run numeca in serial/parallel mode? | sangamesh | Fidelity CFD | 0 | June 30, 2009 11:26 |
Parallel run diverges, serial does not | SammyB | OpenFOAM Running, Solving & CFD | 1 | May 10, 2009 04:28 |