ansys / pymapdl

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

class ansys.mapdl.core.mapdl_grpc.MapdlGrpc error #457

Closed 1990chs closed 3 years ago

1990chs commented 3 years ago

When I use class ansys.mapdl.core.mapdl_grpc.MapdlGrpc API, there is error as follow. from ansys.mapdl import core as pymapdl mapdl = pymapdl.Mapdl() But the following commands can work. from ansys.mapdl.core import launch_mapdl mapdl = launch_mapdl() Is the Mapdl() replace with launch_mapdl() ? image

natter1 commented 3 years ago

pymapdl.Mapdl() uses gRPC interface, which is not available with ANSYS 19.5. With launch_mapdl() you use the older CORBA interface: https://mapdldocs.pyansys.com/getting_started/versioning.html?highlight=corba

akaszynski commented 3 years ago

Thanks @natter1!

Additionally, Mapdl() can be only used if you have an existing instance of MAPDL you're trying to connect to (either remote or local). It's actually really cool as you can treat the instance of MAPDL as if it's running locally on your machine and send individual commands, plot, etc (basically everything except open_gui).

1990chs commented 3 years ago

Thanks @natter1!

Additionally, Mapdl() can be only used if you have an existing instance of MAPDL you're trying to connect to (either remote or local). It's actually really cool as you can treat the instance of MAPDL as if it's running locally on your machine and send individual commands, plot, etc (basically everything except open_gui).

Thinks. What's the meaning of this sentence:"Mapdl() can be only used if you have an existing instance of MAPDL you're trying to connect to (either remote or local)."?

akaszynski commented 3 years ago

What's the meaning of this sentence:"Mapdl() can be only used if you have an existing instance of MAPDL you're trying to connect to (either remote or local)."?

Please see https://mapdldocs.pyansys.com/getting_started/running_mapdl.html#launching-mapdl

Effectively, it means that you start MAPDL in "server mode" whereby you can connect to it from a different computer.

For example, if I have two computers, one running Mac OS and another running Windows, I can startup MAPDL on the Windows machine and then connect to it from the Mac. In code:

Windows Machine:

C:/Program Files/ANSYS Inc/v211/ansys/bin/winx64/ANSYS211.exe -grpc

 ##############################
 ### START GRPC SERVER      ###
 ##############################

 Server Executable   : MapdlGrpc.Server
 Server listening on : 0.0.0.0:50052

Provided I know the IP address of the Windows machine on the LAN (let's just say it's 192.168.0.10 from ipconfig) then you can run from the Mac:

>>> from ansys.mapdl.core import Mapdl
>>> mapdl = Mapdl(ip='192.168.0.10', port=50052)
>>> print(mapdl)
Product:             Ansys Mechanical Enterprise
MAPDL Version:       21.1
ansys.mapdl Version: 0.59.0
1990chs commented 3 years ago

@akaszynski Thinks