Mapdl
module#
Mapdl
methods and attributes#
- class ansys.mapdl.core.mapdl.MapdlBase(loglevel='DEBUG', use_vtk=None, log_apdl=None, log_file=False, local=True, print_com=False, file_type_for_plots='PNG', **start_parm)#
Base MAPDL class shared across all MAPDL subclasses.
Warning
This class should NOT be imported by itself. You should always import a subclass of it
|
Add a file handler to the mapdl log. |
Chain several mapdl commands. |
|
Current MAPDL directory. |
|
|
Retrieves a value and stores it as a scalar parameter or part of an array parameter. |
|
Uses the |
|
Runs the MAPDL GET command and returns a Python value. |
Invalid commands will be ignored rather than exceptions |
|
MAPDL job name. |
|
Returns the last response from MAPDL. |
|
|
Load a table from Python to into MAPDL. |
Mesh information. |
|
|
Run a modal with basic settings analysis |
Non-interactive context manager. |
|
|
Start writing all APDL commands to an MAPDL input file. |
|
Save the existing database and open it up in the MAPDL GUI. |
Collection of MAPDL parameters. |
|
Binary interface to the result file using |
|
|
Run single APDL command. |
|
Run several commands as a single block :rtype: |
|
Run several commands as a single block. |
|
Sets log level |
MAPDL build version. |
|
Returns if using VTK by default or not. |
|
Returns the current file type for plotting. |
Constants#
Built-in mutable sequence. |
|
Built-in mutable sequence. |
mapdl_grpc.MapdlGrpc
methods#
- class ansys.mapdl.core.mapdl_grpc.MapdlGrpc(ip=None, port=None, timeout=15, loglevel='WARNING', log_file=False, cleanup_on_exit=False, log_apdl=None, set_no_abort=True, remove_temp_files=None, remove_temp_dir_on_exit=False, print_com=False, disable_run_at_connect=False, channel=None, remote_instance=None, **start_parm)#
This class connects to a GRPC MAPDL server and allows commands to be passed to a persistent session.
- Parameters:
- ip
str
,optional
IP address to connect to the server. The default is ‘localhost’.
- port
int
,optional
Port to connect to the MAPDL server. The default is
50052
.- timeout
float
,optional
Maximum allowable time to connect to the MAPDL server.
- loglevel
str
,optional
Sets which messages are printed to the console. Default ‘INFO’ prints out all ANSYS messages, ‘WARNING` prints only messages containing ANSYS warnings, and ‘ERROR’ prints only error messages.
- cleanup_on_exitbool,
optional
Exit MAPDL when Python exits or when this instance is garbage collected.
- set_no_abortbool,
optional
Sets MAPDL to not abort at the first error within /BATCH mode. The default is
True
.- remove_temp_dirbool,
optional
When this parameter is
True
, the MAPDL working directory will be deleted when MAPDL is exited provided that it is within the temporary user directory. The default isFalse
.- log_filebool,
optional
Copy the log to a file called logs.log located where the python script is executed. The default is
True
.- print_combool,
optional
Print the command
/COM
arguments to the standard output. The default isFalse
.- disable_run_at_connect: bool, optional
Whether to disable the housekeeping commands when connecting. The default is
False
.- channel
grpc.Channel
,optional
gRPC channel to use for the connection. This parameter can be used as an alternative to the
ip
andport
parameters.- remote_instance
ansys.platform.instancemanagement.Instance
The corresponding remote instance when MAPDL is launched through PyPIM. This instance will be deleted when calling
Mapdl.exit
.- file_type_for_plots: [“PNG”, “TIFF”, “PNG”, “VRML”, “TERM”], Optional
Change the default file type for plots using
/SHOW
, by default it isPNG
.
- ip
Examples
Connect to an instance of MAPDL already running on locally on the default port 50052.
>>> from ansys.mapdl import core as pymapdl >>> mapdl = pymapdl.Mapdl()
Connect to an instance of MAPDL running on the LAN on a default port.
>>> mapdl = pymapdl.Mapdl('192.168.1.101')
Connect to an instance of MAPDL running on the LAN on a non-default port.
>>> mapdl = pymapdl.Mapdl('192.168.1.101', port=60001)
If you wish to customize the channel, you can also directly connect directly to gRPC channels. For example, if you wanted to create an insecure channel with a maximum message length of 8 MB.
>>> import grpc >>> channel = grpc.insecure_channel( ... '127.0.0.1:50052', ... options=[ ... ("grpc.max_receive_message_length", 8*1024**2), ... ], ... ) >>> mapdl = pymapdl.Mapdl(channel=channel)
|
Download files from the gRPC instance working directory :rtype: |
Listing of errors written in JOBNAME.err |
|
|
List the files in the working directory of MAPDL. |
Silence the response from all MAPDL functions unless explicitly set to |
|
|
Upload a file to the grpc instance |
Information
class attributes#
Retrieve the product from the MAPDL instance. |
|
Retrieve the MAPDL version from the MAPDL instance. |
|
Retrieve the PyMAPDL version from the MAPDL instance. |
|
Retrieve the products from the MAPDL instance. |
|
Retrieve the preprocessing capabilities from the MAPDL instance. |
|
Retrieve the aux capabilities from the MAPDL instance. |
|
Retrieve the solution options from the MAPDL instance. |
|
Retrieve the post capabilities from the MAPDL instance. |
|
Retrieve and set the title from the MAPDL instance. |
|
Retrieve the titles from the MAPDL instance. |
|
Retrieve or set the value for the MAPDL stitle (subtitles). |
|
Retrieve the units from the MAPDL instance. |
|
Retrieve the scratch memory status from the MAPDL instance. |
|
Retrieve the database status from the MAPDL instance. |
|
Retrieve the config values from the MAPDL instance. |
|
Retrieve the global status from the MAPDL instance. |
|
Retrieve the job information from the MAPDL instance. |
|
Retrieve the model information from the MAPDL instance. |
|
Retrieve the boundary condition information from the MAPDL instance. |
|
Retrieve the routine information from the MAPDL instance. |
|
Retrieve the solution options configuration from the MAPDL instance. |
|
Retrieve the load step options from the MAPDL instance. |