ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
423 stars 119 forks source link

can not SOLVE during Acoustic radiation analysis #1428

Closed FemLearner closed 2 years ago

FemLearner commented 2 years ago

Before submitting the issue

Description of the bug

pymapdl cannot complete mapdl.solve() Before the mapdl.solve() step,all the other steps are run successfully,but the examples like 2D Plane Stress Concentration Analysis can run successfully and out put the result. An acoustic radiation belongs to an harmonic response analysis , I converted APDL language sentence by sentence to pymapdl language , it can run successfully in the ansys19.2 GUI interface but failed in the pymapdl. I'm thinking about whether it's my code writing error that makes it impossible to calculate .This is my short demo,is there anyone who can help me see if it is a code error,thanks!!!

Steps To Reproduce

Which Operating System are you using?

Windows

Which Python version are you using?

3.8

PyMAPDL Report

PyMAPDL Software and Environment Report

Packages Requirements


Core packages

ansys.mapdl.core : 0.63.1 numpy : 1.23.2 appdirs : 1.4.4 scipy : 1.9.1 grpc : Package not found ansys.api.mapdl.v0 : Package not found ansys.mapdl.reader : 0.51.15 google.protobuf : Package not found

Optional packages

matplotlib : 3.5.3 pyvista : 0.36.1 pyiges : 0.2.1 tqdm : 4.64.0 ansys_corba : 0.1.1

Ansys Installation


Unable to locate any Ansys installations

Ansys Environment Variables


ANSYS192_DIR D:\setup_position_1\ansys19.2\ANSYS Inc\v192\ANSYS ANSYS_SYSDIR winx64 ANSYS_SYSDIR32 win32 AWP_ROOT192 D:\setup_position_1\ansys19.2\ANSYS Inc\v192 CADOE_LIBDIR192 D:\setup_position_1\ansys19.2\ANSYS Inc\v192\CommonFiles\Language\en-us

Installed packages

aiohttp==3.8.1 aiosignal==1.2.0 ansys-api-mapdl==0.5.1 ansys-api-platform-instancemanagement==1.0.0b3 ansys-corba==0.1.1 ansys-mapdl-core==0.63.1 ansys-mapdl-reader==0.51.15 ansys-platform-instancemanagement==1.0.2 appdirs==1.4.4 async-timeout==4.0.2 attrs==22.1.0 charset-normalizer==2.1.1 colorama==0.4.5 cycler==0.11.0 fonttools==4.37.1 frozenlist==1.3.1 geomdl==5.3.1 googleapis-common-protos==1.56.4 grpcio==1.48.0 idna==3.3 imageio==2.21.2 importlib-metadata==4.12.0 kiwisolver==1.4.4 matplotlib==3.5.3 multidict==6.0.2 numpy==1.23.2 packaging==21.3 Pillow==9.2.0 protobuf==3.20.1 protoc-gen-swagger==0.1.0 pyiges==0.2.1 pyparsing==3.0.9 python-dateutil==2.8.2 pyvista==0.36.1 scipy==1.9.1 scooby==0.6.0 six==1.16.0 tqdm==4.64.0 vtk==9.1.0 wslink==1.8.2 yarl==1.8.1 zipp==3.8.1

mikerife commented 2 years ago

Hi @FemLearner is there any way you can update to a later version of MAPDL? I just ran this model though I had to change keyopt 2=1 for the Fluid30 element type as the options have changed (and 3 is no longer an option):

Capture1

Then at the solve:

Capture2

Mike

FemLearner commented 2 years ago

I updated my Ansys version from 19.2 to 2022r1 , and now a new problem appeared ,all the demo including static and harmic analysis,the error is:

Traceback (most recent call last):
  File "D:/CODE_1/puthon_code/main.py", line 8, in <module>
    mapdl = launch_mapdl()
  File "D:\code_language\python3.8.10\lib\site-packages\ansys\mapdl\core\launcher.py", line 1514, in launch_mapdl
    port, actual_run_location = launch_grpc(
  File "D:\code_language\python3.8.10\lib\site-packages\ansys\mapdl\core\launcher.py", line 532, in launch_grpc
    time.sleep(sleep_time)
KeyboardInterrupt

I try to figure out whether the ansys221 can be found with such code:

from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
print(mapdl)

But error happened as "Unable to locate program input point MPI_lalltoall........." image

FemLearner commented 2 years ago

I choose another version Ansys2021 r1 , and still can not solve , the err changed:

CRITICAL -  -  logging - handle_exception - Uncaught exception
Traceback (most recent call last):
  File "D:/CODE_1/puthon_code/SPHERE_INFEM", line 71, in <module>
    output =mapdl.solve()
  File "D:\code_language\python3.8.10\lib\site-packages\ansys\mapdl\core\_commands\solution\analysis_options.py", line 3425, in solve
    return self.run(command, **kwargs)
  File "D:\code_language\python3.8.10\lib\site-packages\ansys\mapdl\core\mapdl.py", line 2630, in run
    text = self._run(command, verbose=verbose, mute=mute)
  File "D:\code_language\python3.8.10\lib\site-packages\ansys\mapdl\core\mapdl_grpc.py", line 736, in _run
    response = self._send_command(cmd, mute=mute)
  File "D:\code_language\python3.8.10\lib\site-packages\ansys\mapdl\core\errors.py", line 138, in wrapper
    raise MapdlExitedError("MAPDL server connection terminated") from None
ansys.mapdl.core.errors.MapdlExitedError: MAPDL server connection terminated
mikerife commented 2 years ago

Hi @FemLearner It looks like there is a MPI version already installed on the system. So let's try running PyMAPDL in shared memory parallel (not distributed) and take MPI out of the equation for now. Please try to run the following:

from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(additional_switches = '-smp')
print(mapdl)

And let us know what happens. Mike

FemLearner commented 2 years ago

I choosed the version 2021 instead of version 2022 , to avoid the error"Unable to locate program input point MPI_lalltoall........." , and when i used the version 2021 , it occured the error "MAPDL server connection terminated" , I think it is because of the fail in identification of licenses , and I add the code mapdl = launch_mapdl(exec_file=r"D:\setup_position_1\ansys2021r1\ANSYSInc\v211\ansys\bin\winx64\ANSYS211.exe",additional_switches = '-smp') and the problem is down , and I want to know whether the sentence "additional_switches = '-smp''' will impact the calculation. Summary: The Ansys version2022r1 will cause the "Unable to locate program input point MPI_lalltoall........." problem , and it can be solved by changed the version to 2021r1 , and the problem "MAPDL server connection terminated" can be solved in 2021r1 by the sentence"additional_switches = '-smp'"

mikerife commented 2 years ago

Hi @FemLearner "SMP" is 'shared memory parallel', which was the default at version 19.2. Your question depends on what you mean by 'impact'. SMP and DMP [distributed parallel] are two types of parallelism. They should return the same results, but their computational performance will most likely be different. It depends on various factors like the model size (in terms of total degrees-of-freedom being solved), hardware set up, etc.

The message about MPI_Ialltoall relates to MPI being installed and some environment variables relating to it existing. DMP relies on MPI for its communication. As with other programs that use MPI, MAPDL has requirements on the type, version, and configuration of MPI that it supports. A simple workaround is to use SMP and bypass MPI use. If you anticipate your models getting larger and DMP needed then you would need address the issue. If you are an Ansys Inc customer I'd recommend opening a standard service request at that point. If not, maybe posting to the learning forum here (open to all https://forum.ansys.com/ ). Or maybe discussing with your companies IT department...etc.

Mike

akaszynski commented 2 years ago

If it's alright with you @FemLearner, i'd like to make this an example in https://mapdl.docs.pyansys.com/examples/index.html.

FemLearner commented 2 years ago

@mikerife Thanks! I run the programs on my personal computer , so I think I can choose SMP to make the program stable. @akaszynski It is ok. And I hope it will be helpful to someone solving an Acoustic harmonic problem.