How to use the pyansys.launch_mapdl function in pyansys

To help you get started, we’ve selected a few pyansys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github akaszynski / pyansys / tests / test_console.py View on Github external
def mapdl():
    mapdl_instance = pyansys.launch_mapdl(MAPDLBIN,
                                          override=True,
                                          additional_switches='-smp',  # for Linux
                                          prefer_pexpect=True)
    assert isinstance(mapdl_instance, MapdlConsole)
    return mapdl_instance
github akaszynski / pyansys / tests / test_corba.py View on Github external
def mapdl():
    mapdl = pyansys.launch_mapdl(MAPDLBIN,
                                 override=True,
                                 additional_switches='-smp',  # for Linux
                                 prefer_pexpect=False)

    # build the cyclic model
    mapdl.prep7()
    mapdl.shpp('off')
    mapdl.cdread('db', pyansys.examples.sector_archive_file)
    mapdl.prep7()
    mapdl.cyclic()

    # set material properties
    mapdl.mp('NUXY', 1, 0.31)
    mapdl.mp('DENS', 1, 4.1408E-04)
    mapdl.mp('EX', 1, 16900000)
    mapdl.emodif('ALL', 'MAT', 1)
github akaszynski / pyansys / examples / 01-mapdl-examples / pyvista_mesh.py View on Github external
PyVista Mesh Integration
~~~~~~~~~~~~~~~~~~~~~~~~

Run a modal analysis on a mesh generated from pyvista within MAPDL.

"""
# sphinx_gallery_thumbnail_number = 2

import os
import pyvista as pv
import pyansys

# launch MAPDL and run a modal analysis
os.environ['I_MPI_SHM_LMT'] = 'shm'  # necessary for Ubuntu
mapdl = pyansys.launch_mapdl(loglevel='WARNING', override=True)

# Create a simple plane mesh centered at (0, 0, 0) on the XY plane
mesh = pv.Plane(i_resolution=100, j_resolution=100)

mesh.plot(color='w', show_edges=True)

###############################################################################
# Write the mesh to an archive file
archive_filename = os.path.join(mapdl.path, 'tmp.cdb')
pyansys.save_as_archive(archive_filename, mesh)


###############################################################################
# mapdl = pyansys.launch_mapdl(prefer_pexpect=True, override=True)

# Read in the archive file
github akaszynski / pyansys / examples / 01-mapdl-examples / mapdl_3d_beam.py View on Github external
MAPDL 3D Beam Example
~~~~~~~~~~~~~~~~~~~~~

This is a simple example that loads an archive file containing a beam
and then runs a modal analysis using the simplified ``modal_analysis``
method.

"""

import os
from pyansys import examples
import pyansys

os.environ['I_MPI_SHM_LMT'] = 'shm'  # necessary on ubuntu
mapdl = pyansys.launch_mapdl(override=True)

mapdl.cdread('db', examples.hexarchivefile)
mapdl.esel('s', 'ELEM', vmin=5, vmax=20)
mapdl.cm('ELEM_COMP', 'ELEM')
mapdl.nsel('s', 'NODE', vmin=5, vmax=20)
mapdl.cm('NODE_COMP', 'NODE')

# boundary conditions
mapdl.allsel()

# dummy steel properties
mapdl.prep7()
mapdl.mp('EX', 1, 200E9)  # Elastic moduli in Pa (kg/(m*s**2))
mapdl.mp('DENS', 1, 7800)  # Density in kg/m3
mapdl.mp('NUXY', 1, 0.3)  # Poissons Ratio
mapdl.emodif('ALL', 'MAT', 1)
github akaszynski / pyansys / _downloads / 81a5e2e588577f9490a1e42b8ead946f / pyvista_mesh.py View on Github external
PyVista Mesh Integration
~~~~~~~~~~~~~~~~~~~~~~~~

Run a modal analysis on a mesh generated from pyvista within MAPDL.

"""
# sphinx_gallery_thumbnail_number = 2

import os
import pyvista as pv
import pyansys

# launch MAPDL and run a modal analysis
os.environ['I_MPI_SHM_LMT'] = 'shm'  # necessary for Ubuntu
mapdl = pyansys.launch_mapdl(loglevel='WARNING', override=True)

# Create a simple plane mesh centered at (0, 0, 0) on the XY plane
mesh = pv.Plane(i_resolution=100, j_resolution=100)

mesh.plot(color='w', show_edges=True)

###############################################################################
# Write the mesh to an archive file
archive_filename = os.path.join(mapdl.path, 'tmp.cdb')
pyansys.save_as_archive(archive_filename, mesh)


###############################################################################
# mapdl = pyansys.launch_mapdl(prefer_pexpect=True, override=True)

# Read in the archive file
github akaszynski / pyansys / _downloads / 6200d60057fdffd1ad95288dc09aba29 / mapdl_3d_beam.py View on Github external
MAPDL 3D Beam Example
~~~~~~~~~~~~~~~~~~~~~

This is a simple example that loads an archive file containing a beam
and then runs a modal analysis using the simplified ``modal_analysis``
method.

"""

import os
from pyansys import examples
import pyansys

os.environ['I_MPI_SHM_LMT'] = 'shm'  # necessary on ubuntu
mapdl = pyansys.launch_mapdl(override=True)

mapdl.cdread('db', examples.hexarchivefile)
mapdl.esel('s', 'ELEM', vmin=5, vmax=20)
mapdl.cm('ELEM_COMP', 'ELEM')
mapdl.nsel('s', 'NODE', vmin=5, vmax=20)
mapdl.cm('NODE_COMP', 'NODE')

# boundary conditions
mapdl.allsel()

# dummy steel properties
mapdl.prep7()
mapdl.mp('EX', 1, 200E9)  # Elastic moduli in Pa (kg/(m*s**2))
mapdl.mp('DENS', 1, 7800)  # Density in kg/m3
mapdl.mp('NUXY', 1, 0.3)  # Poissons Ratio
mapdl.emodif('ALL', 'MAT', 1)
github akaszynski / pyansys / pyansys / examples / examples.py View on Github external
"""
    # cylinder parameters
    # torque = 100
    radius = 2
    h_tip = 2
    height = 20
    elemsize = 0.5
    force = 100/radius
    pressure = force/(h_tip*2*np.pi*radius)

    # start ANSYS
    if as_test:
        loglevel = 'ERROR'
    else:
        loglevel = 'INFO'
    ansys = pyansys.launch_mapdl(exec_file=exec_file, override=True, loglevel=loglevel)

    # Define higher-order SOLID186
    # Define surface effect elements SURF154 to apply torque
    # as a tangential pressure
    ansys.prep7()
    ansys.et(1, 186)
    ansys.et(2, 154)
    ansys.r(1)
    ansys.r(2)

    # Aluminum properties (or something)
    ansys.mp('ex', 1, 10e6)
    ansys.mp('nuxy', 1, 0.3)
    ansys.mp('dens', 1, 0.1/386.1)
    ansys.mp('dens', 2, 0)